tokentracker-cli 0.87.11 → 0.87.13
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/dashboard/dist/assets/AchievementBadge-ea7qapyL.js +1 -0
- package/dashboard/dist/assets/{AchievementsPage-BAtc6581.js → AchievementsPage-DoOYRLD5.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-Bok48qmR.js → AchievementsSection-B7uvcdxK.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-CnR1S5Fk.js → BadgeDetailModal-1KF-h3Cm.js} +1 -1
- package/dashboard/dist/assets/{Card-A4JQKxIZ.js → Card-DQgKBViP.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-CNRbH_ri.js → ClawdAnimated-CbKk5C9F.js} +1 -1
- package/dashboard/dist/assets/{CommandPalette-CAkZSh_I.js → CommandPalette-MIRqk8Dp.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-Dh1PvEU5.js → CommunityStatsModal-CgHWU_T1.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-DtUn4PvI.js → ConfirmModal-D05J-QUB.js} +1 -1
- package/dashboard/dist/assets/{Controls-Bju6_Qgc.js → Controls-D5LSYH96.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-BFXwPC6L.js → DashboardPage-H2Bl3Bwo.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-BbiVkFkJ.js → DevicePage-TtCdnGIm.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-OelNPG0Y.js → DialogClose-BfCS-Ntd.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-DVH6GzL7.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-C_CTTQtO.js → DialogTitle-O5nTArna.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-CkRSoCb2.js → FadeIn-CigBazQo.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-CTX7kP5L.js → HeaderGithubStar-DeMyqNpO.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-CPlF8ZwO.js → HoverTooltip-tOIlqXjb.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-BJsKVMC-.js → IpCheckPage-CCeG4lE9.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-9jAUDqx0.js → LandingPage-33uNffc7.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardAvatar-8dN340iC.js → LeaderboardAvatar-BRJKEfhb.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-B1MBedOd.js → LeaderboardPage-_Fs74yLu.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfileModal-CxrQFLfo.js → LeaderboardProfileModal-CFt90SC6.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-C7LkCn7j.js → LeaderboardProfilePage-CC9315s4.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-CX2ohexs.js → LimitsPage-fNLiGJas.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-Bx3Y6V6z.js → LocalOnlyNotice-DJWlZgug.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-C6nKjmVd.js → LoginCard-B6zjmb6m.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-Cy3pcURe.js → LoginModal-D7VtT-pA.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-DwA2WE_J.js → LoginPage-CmKUywl4.js} +1 -1
- package/dashboard/dist/assets/{PetPage-CeMz69em.js → PetPage-U28hAlPp.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-Dr_89ZsN.js → PopoverPopup-DREcMHrJ.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-yBPK67if.js → ProviderIcon-CxpFegpD.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-5foVX-ji.js → ResetPasswordPage-XjbWpa4B.js} +1 -1
- package/dashboard/dist/assets/{SegmentedControl-ByMBjrQu.js → SegmentedControl-BUZrG_65.js} +1 -1
- package/dashboard/dist/assets/{Select-BmiLelJH.js → Select-Coxp19gW.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-ra9fOxTH.js → SelectItemText-Dw-zi_PN.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-DN15AhqV.js → ServiceStatusPage-c4Gz9ND_.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-DcNtVUlG.js → SessionsPage-CJUJDivQ.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-B62dIBq2.js → SettingsPage-BoUeuTQk.js} +1 -1
- package/dashboard/dist/assets/{SkillsPage-BH9Y-Jr3.js → SkillsPage-Chv4kDY_.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-Dop8r6gR.js → TokenGalaxy-UtsDkqN-.js} +1 -1
- package/dashboard/dist/assets/{ToolbarRootContext--p8cQmQC.js → ToolbarRootContext-D3Xvbsmu.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-O_3Y-SZE.js → TrendMonitor-hjyZhVhp.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-fmeuoBRn.js → WidgetsPage-BaJJOspc.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-D31IOcLs.js → WrappedPage-BdBZXCyS.js} +1 -1
- package/dashboard/dist/assets/{__vite-browser-external-B8xHeUWG.js → __vite-browser-external-CU0HL6hY.js} +18 -18
- package/dashboard/dist/assets/{agent-logos-qv-6cVem.js → agent-logos-D15jo0lu.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-D2jDALUn.js → arrow-up-right-C6W_K-fZ.js} +1 -1
- package/dashboard/dist/assets/{check-Ct6KAwPF.js → check-D1DIUZ3y.js} +1 -1
- package/dashboard/dist/assets/{chevron-right-C6_7i5IV.js → chevron-right-DaZ6r6U5.js} +1 -1
- package/dashboard/dist/assets/{copy-CuN61rn4.js → copy-DGTadiXw.js} +1 -1
- package/dashboard/dist/assets/{download-CGQHQ_O1.js → download-CBYnlCsF.js} +1 -1
- package/dashboard/dist/assets/{external-link-DMK8oGV1.js → external-link-BDjUPxFn.js} +1 -1
- package/dashboard/dist/assets/{flame-DYDfZm4m.js → flame-BSTr9RX6.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-Cr3tGM0M.js → format-tokens-CxjDlh0r.js} +1 -1
- package/dashboard/dist/assets/{icons-C5uWoSyt.js → icons-pOJhx7lO.js} +1 -1
- package/dashboard/dist/assets/{index-BxQbRCxm.js → index-Bym1hEGy.js} +1 -1
- package/dashboard/dist/assets/{index-BnRjukrI.js → index-CbpwbfY1.js} +1 -1
- package/dashboard/dist/assets/{index-CvXbHj4v.js → index-XCZRFozo.js} +1 -1
- package/dashboard/dist/assets/{info-DrAzGhOW.js → info-DlZkEw5y.js} +1 -1
- package/dashboard/dist/assets/{limits-providers-DxW9ioQB.js → limits-providers-DOW-oPEP.js} +1 -1
- package/dashboard/dist/assets/{link-2-BI38rNr_.js → link-2-BaAMrLia.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-Bo5D6bhR.js → loader-circle-BvEjzy5k.js} +1 -1
- package/dashboard/dist/assets/{maximize-2-CYdScbRg.js → maximize-2-DNjgO_My.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-quleLIKM.js → modifiers.esm-DpXL6h3m.js} +1 -1
- package/dashboard/dist/assets/module-CzlIpkuW.js +2 -0
- package/dashboard/dist/assets/{monitor-smartphone-BIX1vqmO.js → monitor-smartphone-DPmp8gGF.js} +1 -1
- package/dashboard/dist/assets/{provider-display-BIgyIwfN.js → provider-display-YTGYyKIU.js} +1 -1
- package/dashboard/dist/assets/{react-D3GtDc7w.js → react-CBi7M7dK.js} +1 -1
- package/dashboard/dist/assets/{search-BkIdCRLX.js → search-MLfdUv_4.js} +1 -1
- package/dashboard/dist/assets/{skills-api-CderQz5B.js → skills-api-C4jX9Owj.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-2gcAB4zs.js → sortable.esm-YyExnyg0.js} +1 -1
- package/dashboard/dist/assets/{store-C1IKZc33.js → store-PiuqLY56.js} +1 -1
- package/dashboard/dist/assets/{terminal-p1ztJj4p.js → terminal-DQkiIx3c.js} +1 -1
- package/dashboard/dist/assets/{trash-2-CJWF-VNC.js → trash-2-qoXweL8H.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-Dn06TrFv.js → use-community-stats-ByIG8K-M.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-BgaBwlW4.js → use-limits-display-prefs-CpW6_ZBo.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-CLAfnQJp.js → use-ordered-list--ijka38Z.js} +1 -1
- package/dashboard/dist/assets/use-reduced-motion-DW0-IRCM.js +1 -0
- package/dashboard/dist/assets/{use-session-efficiency-pref-Bjt6Wz-F.js → use-session-efficiency-pref-Di41rY7h.js} +1 -1
- package/dashboard/dist/assets/{use-transform-Bacfpv38.js → use-transform-CKw05one.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-BF6HF4CU.js → use-usage-limits-DxAyfksJ.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-BResSm4n.js → useCurrency-DKrZtU2Z.js} +1 -1
- package/dashboard/dist/assets/{useScrollLock-C7qX5L-D.js → useScrollLock-D2roJGoE.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-COB2oujy.js → useTokenFormat-C8hwTvLr.js} +1 -1
- package/dashboard/dist/assets/{zap-8w1maR-b.js → zap-BcmVPhUG.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/ip-check.html +1 -1
- package/dashboard/dist/leaderboard.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/lib/pricing/curated-overrides.json +11 -11
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/dashboard/dist/assets/AchievementBadge-C-w9f93M.js +0 -1
- package/dashboard/dist/assets/DialogDescription-DtcxB2Zm.js +0 -1
- package/dashboard/dist/assets/module-Ci-Lrj0I.js +0 -2
- package/dashboard/dist/assets/use-reduced-motion-DAOu1VYi.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var v=typeof window<"u"?window:void 0,ge=typeof globalThis<"u"?globalThis:v,me=ge?.navigator,S=ge?.document,oe=ge?.location,vr=ge?.fetch,Is=ge!=null&&ge.XMLHttpRequest&&"withCredentials"in new ge.XMLHttpRequest?ge.XMLHttpRequest:void 0,Or=ge?.AbortController,ko=ge?.CompressionStream,we=me?.userAgent;function Hn(){return!(!v||v.navigator.onLine===!1)}var Mt=typeof globalThis<"u"?globalThis:v;Mt&&typeof self>"u"&&(Mt.self=Mt),Mt&&typeof File>"u"&&(Mt.File=function(){});var $=v??{},B={DEBUG:!1,LIB_VERSION:"0.3.1",LIB_NAME:"browser-common"};function Ar(i,e,t,s,r,n,a){try{var o=i[n](a),l=o.value}catch(u){return void t(u)}o.done?e(l):Promise.resolve(l).then(s,r)}function Y(i){return function(){var e=this,t=arguments;return new Promise((function(s,r){var n=i.apply(e,t);function a(l){Ar(n,s,r,a,o,"next",l)}function o(l){Ar(n,s,r,a,o,"throw",l)}a(void 0)}))}}function y(){return y=Object.assign?Object.assign.bind():function(i){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var s in t)({}).hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},y.apply(null,arguments)}function zn(i,e){if(i==null)return{};var t={};for(var s in i)if({}.hasOwnProperty.call(i,s)){if(e.indexOf(s)!==-1)continue;t[s]=i[s]}return t}var Lr=i=>{if(typeof i!="string")return i;try{return JSON.parse(i)}catch{return i}};function Dr(i){return typeof i=="string"||i}function Nr(i){return typeof i=="string"?i:void 0}var Rt,So=["$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","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Be=(function(i){return i.AnonymousId="anonymous_id",i.DistinctId="distinct_id",i.Props="props",i.EnablePersonProcessing="enable_person_processing",i.PersonMode="person_mode",i.FeatureFlagDetails="feature_flag_details",i.FeatureFlags="feature_flags",i.FeatureFlagPayloads="feature_flag_payloads",i.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",i.BootstrapFeatureFlags="bootstrap_feature_flags",i.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",i.OverrideFeatureFlags="override_feature_flags",i.Queue="queue",i.AiQueue="ai_queue",i.LogsQueue="logs_queue",i.OptedOut="opted_out",i.SessionId="session_id",i.SessionStartTimestamp="session_start_timestamp",i.SessionLastTimestamp="session_timestamp",i.PersonProperties="person_properties",i.GroupProperties="group_properties",i.InstalledAppBuild="installed_app_build",i.InstalledAppVersion="installed_app_version",i.SessionReplay="session_replay",i.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",i.SurveyLastSeenDate="survey_last_seen_date",i.SurveysSeen="surveys_seen",i.Surveys="surveys",i.RemoteConfig="remote_config",i.FlagsEndpointWasHit="flags_endpoint_was_hit",i.DeviceId="device_id",i})({}),jr=(function(i){return i.GZipJS="gzip-js",i.Base64="base64",i})({}),Po=["$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"],To=["token"],Un="NativeGzipValidationError",Ms=i=>i.length>=2&&i[0]===31&&i[1]===139,qr=(i,e)=>i===jr.GZipJS||e===jr.GZipJS||e==="gzip",Br=i=>!(!i||typeof i!="object")&&("name"in i?String(i.name):"")==="NotReadableError",li=i=>{var e=new Error("Native gzip produced invalid output: "+i);throw e.name=Un,e},Fo=(function(){var i=Y((function*(e,t){18>e.size&&li("too-short");var s=new Uint8Array(yield e.slice(0,10).arrayBuffer());Ms(s)&&s[2]===8||li("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(a=>{for(var o=(()=>{if(Rt)return Rt;Rt=[];for(var c=0;256>c;c++){for(var h=c,d=0;8>d;d++)h=1&h?3988292384^h>>>1:h>>>1;Rt[c]=h>>>0}return Rt})(),l=4294967295,u=0;a.length>u;u++)l=o[255&(l^a[u])]^l>>>8;return(4294967295^l)>>>0})(t)&&li("invalid-crc");var n=t.length>>>0;r.getUint32(4,!0)!==n&&li("invalid-size")}));return function(e,t){return i.apply(this,arguments)}})();function Rs(){return Rs=Y((function*(i,e,t){e===void 0&&(e=!0);try{var s=new TextEncoder().encode(i),r=new globalThis.CompressionStream("gzip"),n=r.writable.getWriter(),a=n.write(s).then((()=>n.close())).catch((function(){var u=Y((function*(c){try{yield n.abort(c)}catch{}throw c}));return function(c){return u.apply(this,arguments)}})()),o=new Response(r.readable).blob(),l=(yield Promise.all([o,a]))[0];return yield Fo(l,s),l}catch(u){if(t!=null&&t.rethrow)throw u;return e&&console.error("Failed to gzip compress data",u),null}})),Rs.apply(this,arguments)}var $o=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Hr=function(i,e){if(e===void 0&&(e=[]),!i)return!1;var t=i.toLowerCase();return $o.concat(e).some((s=>{var r=s.toLowerCase();return t.indexOf(r)!==-1}))};function M(i,e){return i.indexOf(e)!==-1}var Xi=function(i){return i.trim()},Cs=function(i){return i.replace(/^\$/,"")};function Gn(i){var e,t=[];return(e=JSON.stringify(i,(function(s,r){if(typeof r=="bigint")return r.toString();if(typeof r!="function"&&typeof r!="symbol"){if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&typeof r=="object"){for(;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 Vn=Object.prototype,Wn=Vn.hasOwnProperty,Ki=Vn.toString,R=Array.isArray||function(i){return Ki.call(i)==="[object Array]"},Ee=i=>typeof i=="function",K=i=>i===Object(i)&&!R(i),Xe=i=>{if(K(i)){for(var e in i)if(Wn.call(i,e))return!1;return!0}return!1},x=i=>i===void 0,U=i=>Ki.call(i)=="[object String]",Os=i=>U(i)&&i.trim().length===0,ye=i=>i===null,C=i=>x(i)||ye(i),de=i=>Ki.call(i)=="[object Number]"&&i==i,je=i=>de(i)&&i>0,Ce=i=>Ki.call(i)==="[object Boolean]",Io=i=>i instanceof FormData,Mo=i=>M(Po,i),Ro=i=>M(To,i);function Jn(i){return i===null||typeof i!="object"}function Pi(i,e){return{}.toString.call(i)==="[object "+e+"]"}function gr(i){return typeof Event<"u"&&(function(e,t){try{return e instanceof t}catch{return!1}})(i,Event)}var Co=[!0,"true",1,"1","yes"],ts=i=>M(Co,i),Oo=[!1,"false",0,"0","no"];function Le(i,e,t,s,r){return e>t&&(s.warn("min cannot be greater than max."),e=t),de(i)?i>t?(s.warn(" cannot be greater than max: "+t+". Using max value instead."),t):e>i?(s.warn(" cannot be less than min: "+e+". Using min value instead."),e):i:(s.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+r),Le(r||t,e,t,s))}class Ao{constructor(e){this.tt={},this.et=e.et,this.rt=Le(e.bucketSize,0,100,e.it),this.nt=Le(e.refillRate,0,this.rt,e.it),this.st=Le(e.refillInterval,0,864e5,e.it)}ot(e,t){var s=Math.floor((t-e.lastAccess)/this.st);s>0&&(e.tokens=Math.min(e.tokens+s*this.nt,this.rt),e.lastAccess=e.lastAccess+s*this.st)}consumeRateLimit(e){var t,s=Date.now(),r=String(e),n=this.tt[r];return n?this.ot(n,s):this.tt[r]=n={tokens:this.rt,lastAccess:s},n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.et)==null||t.call(this,e)),n.tokens===0)}stop(){this.tt={}}}var Se="Mobile",Ti="iOS",Ve="Android",Et="Tablet",Xn=Ve+" "+Et,Kn="iPad",Yn="Apple",Zn=Yn+" Watch",Vt="Safari",kt="BlackBerry",Qn="Samsung",ea=Qn+"Browser",ta=Qn+" Internet",ct="Chrome",Lo=ct+" OS",ia=ct+" "+Ti,fr="Internet Explorer",sa=fr+" "+Se,_r="Opera",Do=_r+" Mini",mr="Edge",ra="Microsoft "+mr,wt="Firefox",na=wt+" "+Ti,Zt="Nintendo",Qt="PlayStation",xt="Xbox",aa=Ve+" "+Se,oa=Se+" "+Vt,Bt="Windows",As=Bt+" Phone",zr="Nokia",Ls="Ouya",la="Generic",No=la+" "+Se.toLowerCase(),ua=la+" "+Et.toLowerCase(),Ds="Konqueror",ca="Oculus Browser",Fi="Vivaldi",ha="Yandex",$i="Whale",Ns="DuckDuckGo",da="Pale Moon",Ii="Waterfox",Wt="Brave",pa="Google Search App",se="(\\d+(\\.\\d+)?)",is=new RegExp("Version/"+se),jo=new RegExp(xt,"i"),qo=new RegExp(Qt+" \\w+","i"),Bo=new RegExp(Zt+" \\w+","i"),yr=new RegExp(kt+"|PlayBook|BB10","i"),Ho={"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"},va=function(i,e,t,s){e=e||"";var r=(function(n){return n!=null&&n.brave?Wt:null})(t);return r||(s!=null&&s.detectGoogleSearchApp&&M(i,"GSA/")?pa:M(i," OPR/")&&M(i,"Mini")?Do:M(i," OPR/")?_r:yr.test(i)?kt:M(i,"IE"+Se)||M(i,"WPDesktop")?sa:M(i,"OculusBrowser")?ca:M(i,ea)?ta:M(i,mr)||M(i,"Edg/")?ra:M(i,Fi+"/")?Fi:M(i,"YaBrowser/")?ha:M(i,$i+"/")?$i:M(i,Ns+"/")||M(i,"Ddg/")?Ns:M(i,"FBIOS")?"Facebook "+Se:M(i,"UCWEB")||M(i,"UCBrowser")?"UC Browser":M(i,"CriOS")?ia:M(i,"CrMo")||M(i,ct)?ct:M(i,Ve)&&M(i,Vt)?aa:M(i,"FxiOS")?na:M(i.toLowerCase(),Ds.toLowerCase())?Ds:M(i,Wt+"/")?Wt:((n,a)=>a&&M(a,Yn)||(function(o){return M(o,Vt)&&!M(o,ct)&&!M(o,Ve)})(n))(i,e)?M(i,Se)?oa:Vt:M(i,"PaleMoon/")?da:M(i,Ii+"/")?Ii:M(i,wt)?wt:M(i,"MSIE")||M(i,"Trident/")?fr:M(i,"Gecko")?wt:"")},zo={[sa]:[new RegExp("rv:"+se)],[ra]:[new RegExp(mr+"?\\/"+se)],[ct]:[new RegExp("("+ct+"|CrMo)\\/"+se)],[ia]:[new RegExp("CriOS\\/"+se)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+se)],[Vt]:[is],[oa]:[is],[_r]:[new RegExp("(Opera|OPR)\\/"+se)],[wt]:[new RegExp(wt+"\\/"+se)],[na]:[new RegExp("FxiOS\\/"+se)],[Ds]:[new RegExp("Konqueror[:/]?"+se,"i")],[kt]:[new RegExp(kt+" "+se),is],[aa]:[new RegExp("android\\s"+se,"i")],[ta]:[new RegExp(ea+"\\/"+se)],[ca]:[new RegExp("OculusBrowser\\/"+se)],[Fi]:[new RegExp(Fi+"\\/"+se)],[ha]:[new RegExp("YaBrowser\\/"+se)],[$i]:[new RegExp($i+"\\/"+se)],[Wt]:[new RegExp(Wt+"\\/"+se)],[Ns]:[new RegExp("(DuckDuckGo|Ddg)\\/"+se)],[da]:[new RegExp("PaleMoon\\/"+se)],[Ii]:[new RegExp(Ii+"\\/"+se)],[pa]:[new RegExp("GSA\\/"+se)],[fr]:[new RegExp("(rv:|MSIE )"+se)],Mozilla:[new RegExp("rv:"+se)]},Uo=function(i,e,t,s){var r=va(i,e,t,s),n=zo[r];if(x(n))return null;for(var a=0;n.length>a;a++){var o=i.match(n[a]);if(o)return parseFloat(o[o.length-2])}return null},Ur=[[new RegExp(xt+"; "+xt+" (.*?)[);]","i"),i=>[xt,i&&i[1]||""]],[new RegExp(Zt,"i"),[Zt,""]],[new RegExp(Qt,"i"),[Qt,""]],[yr,[kt,""]],[new RegExp(Bt,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[As,""];if(new RegExp(Se).test(e)&&!/IEMobile\b/.test(e))return[Bt+" "+Se,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var s=Ho[t[1]]||"";return/arm/i.test(e)&&(s="RT"),[Bt,s]}return[Bt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>i&&i[3]?[Ti,[i[3],i[4],i[5]||"0"].join(".")]:[Ti,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=x(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+Ve+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ve+")","i"),i=>i&&i[2]?[Ve,[i[2],i[3],i[4]||"0"].join(".")]:[Ve,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];return i&&i[1]&&(e[1]=[i[1],i[2],i[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Lo,""]],[/Linux|debian/i,["Linux",""]]],Gr=function(i){return Bo.test(i)?Zt:qo.test(i)?Qt:jo.test(i)?xt:new RegExp(Ls,"i").test(i)?Ls:new RegExp("("+As+"|WPDesktop)","i").test(i)?As:/iPad/.test(i)?Kn:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?Zn:yr.test(i)?kt:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(zr,"i").test(i)?zr:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?new RegExp(Se).test(i)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)||/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?Ve:Xn:new RegExp("(pda|"+Se+")","i").test(i)?No:new RegExp(Et,"i").test(i)&&!new RegExp(Et+" pc","i").test(i)?ua:""},Go=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Vr(i,e){return typeof(t=i)=="string"&&Go.test(t)?i:e();var t}function Ke(i){return i&&i.split("#")[0]}function yi(i,e){var t=setTimeout(i,e);return t?.unref&&t?.unref(),t}var Vo=i=>i instanceof Error,ga={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}},Wo=ga.info;function fa(i){if(Ce(i))return{boolValue:i};if(typeof i=="number")return Number.isFinite(i)?Number.isInteger(i)?{intValue:i}:{doubleValue:i}:{stringValue:String(i)};if(typeof i=="string")return{stringValue:i};if(R(i))return{arrayValue:{values:i.map((e=>fa(e)))}};try{return{stringValue:JSON.stringify(i)}}catch{return{stringValue:String(i)}}}function Mi(i){var e=[];for(var t in i){var s=i[t];ye(s)||x(s)||e.push({key:t,value:fa(s)})}return e}function Jo(i,e){var t=ga[i.level||"info"]||Wo,s=t.text,r=t.number,n=String(Date.now())+"000000",a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),C(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),C(e.lastActivityTimestamp)||(a.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(a["url.full"]=e.currentUrl),e.screenName&&(a["screen.name"]=e.screenName),e.appState&&(a["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(a.feature_flags=e.activeFeatureFlags);var o=y({},a,i.attributes||{}),l={timeUnixNano:n,observedTimeUnixNano:n,severityNumber:r,severityText:s,body:{stringValue:i.body},attributes:Mi(o)};return i.trace_id&&(l.traceId=i.trace_id),i.span_id&&(l.spanId=i.span_id),x(i.trace_flags)||(l.flags=i.trace_flags),l}function _a(i,e,t){return y({},i.resourceAttributes,{"service.name":i.serviceName||"unknown_service"},i.environment&&{"deployment.environment":i.environment},i.serviceVersion&&{"service.version":i.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":t})}function ma(i,e,t,s){return{resourceLogs:[{resource:{attributes:Mi(e)},scopeLogs:[{scope:{name:t,version:s},logRecords:i}]}]}}let Xo=class{constructor(i,e,t,s,r,n,a){var o;n===void 0&&(n=()=>Promise.resolve()),this._instance=i,this.Te=e,this.it=t,this.ut=s,this.ht=r,this.dt=n,this.ct=a,this.vt=null,this.ft=0,this.yt=0,this.bt=0,this._t=0,this.wt=!1,this.xt=e.maxBufferSize,this.kt=Math.max((o=e.maxQueueSize)!==null&&o!==void 0?o:e.maxBufferSize,e.maxBufferSize),this.St=e.flushIntervalMs,this.Ct=e.maxBatchRecordsPerPost,this.Mt=e.rateCapWindowMs,this.It=e.maxLogsPerInterval}reset(){this.Tt(),this.vt=null,this.bt=0,this._t=0,this.wt=!1,this.ft=0,this.yt=0,this.Ct=this.Te.maxBatchRecordsPerPost}onReconnect(){this.yt=0,this.Et()}captureLog(i){if(!this._instance.isDisabled&&!this._instance.optedOut&&i!=null&&i.body){var e=this.Rt(i);if(e!==null)if(e.body){if(this.Pt()){var t={record:Jo(e,this.ut())};this.ht((()=>this.Ot(t)))}}else this.it.info("Log was rejected in beforeSend function")}}Rt(i){var e=this.Te.beforeSend;if(!e)return i;var t=R(e)?e:[e],s=i;for(var r of t)try{var n=r(s);if(!n)return this.it.info("Log was rejected in beforeSend function"),null;s=n}catch(a){return this.it.error("Error in beforeSend function for log:",a),null}return s}Pt(){if(this.It===void 0)return!0;var i=Date.now(),e=i-this.bt;return this.Mt>e&&e>=0||(this.bt=i,this._t=0,this.wt=!1),this.It>this._t?(this._t++,!0):(this.wt||(this.it.warn("captureLog dropping logs: exceeded "+this.It+" logs per "+this.Mt+"ms"),this.wt=!0),!1)}flush(){var i=this;return Y((function*(){if(!i._instance.isDisabled)return i.vt||(i.vt=i.Ft().finally((()=>{i.vt=null}))),i.vt}))()}Ft(){var i=this;return Y((function*(){var e;i.Tt();var t=(e=i._instance.getPersistedProperty(Be.LogsQueue))!==null&&e!==void 0?e:[];if(t.length!==0)for(var s=t.length,r=0;t.length>0&&s>r;){var n,a;i.ft=0;var o=Math.min(t.length,i.Ct),l=t.slice(0,o),u=ma(l.map((h=>h.record)),i.At(),(n=i.ct)!==null&&n!==void 0?n:i._instance.getLibraryId(),i._instance.getLibraryVersion()),c=yield i._instance.$t(u);if(c.kind==="too-large"&&l.length>1)i.Ct=Math.max(1,Math.floor(l.length/2)),i.it.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+i.Ct);else if(c.kind==="retry-later"||(c.kind==="too-large"?i.it.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"&&i.Te.maxBatchRecordsPerPost>i.Ct&&(i.Ct=Math.min(i.Te.maxBatchRecordsPerPost,i.Ct+1)),yield i.Lt(l.length),t=(a=i._instance.getPersistedProperty(Be.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,c.kind==="fatal"))throw c.error}}))()}Lt(i){var e=this;return Y((function*(){var t,s=Math.max(0,i-e.ft),r=(t=e._instance.getPersistedProperty(Be.LogsQueue))!==null&&t!==void 0?t:[];e._instance.setPersistedProperty(Be.LogsQueue,r.slice(s)),yield e.dt()}))()}At(){return _a(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ot(i){var e;if(!this._instance.optedOut){var t=(e=this._instance.getPersistedProperty(Be.LogsQueue))!==null&&e!==void 0?e:[];this.kt>t.length||(t.shift(),this.ft++,this.it.info("Logs queue is full, dropping oldest record.")),t.push(i),this._instance.setPersistedProperty(Be.LogsQueue,t),this.xt>t.length?this.Dt():this.Et()}}Dt(i){i===void 0&&(i=this.St),this.Nt||(this.Nt=yi((()=>{this.Nt=void 0,this.Et()}),i))}qt(){var i=Math.min(Math.max(0,this.yt-1),6);return this.St*Math.pow(2,i)}jt(){var i=this._instance.getPersistedProperty(Be.LogsQueue);return!!i&&i.length>0}shutdown(i){var e=this;return Y((function*(){e.Tt();var t=e.flush().catch((()=>{}));i!==void 0?yield Promise.race([t,new Promise((s=>yi(s,i)))]):yield t}))()}flushWithTimeout(i){var e=this;return Y((function*(){var t=!1,s=e.flush(),r=new Promise((n=>yi((()=>{t=!0,n()}),i)));try{yield Promise.race([s,r])}finally{t&&s.catch((()=>{}))}}))()}Et(){this.flush().then((()=>{this.yt=0}),(i=>{this.yt++,this.it.error("PostHog logs flush failed:",i)})).finally((()=>{!this._instance.isDisabled&&this.jt()&&this.Dt(this.qt())}))}Tt(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}};var ss=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Wr(i){return String(i)+"000000"}function Jr(i,e,t,s){var r="";return s&&(r=Object.keys(s).sort().map((n=>JSON.stringify(n)+":"+JSON.stringify(s[n]))).join(",")),i+"\0"+e+"\0"+(t??"")+"\0"+r}let Ko=class{constructor(i,e,t){this._instance=i,this.Te=e,this.it=t,this.Bt=new Map,this.vt=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Vt=0}count(i,e,t){e===void 0&&(e=1),this.Wt({name:i,type:"count",value:e,unit:t?.unit,attributes:t?.attributes})}gauge(i,e,t){this.Wt({name:i,type:"gauge",value:e,unit:t?.unit,attributes:t?.attributes})}histogram(i,e,t){this.Wt({name:i,type:"histogram",value:e,unit:t?.unit,attributes:t?.attributes})}flush(){var i=this,e=this.vt,t=(function(){var r=Y((function*(){e&&(yield e.catch((()=>{}))),yield i.Zt()}));return function(){return r.apply(this,arguments)}})(),s=t().finally((()=>{this.vt===s&&(this.vt=null)}));return this.vt=s,s}drainWindow(){if(this.Bt.size===0)return null;var i=this.Bt;return this.Bt=new Map,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Gt(i)}reset(){this.Vt++,this.Tt(),this.Bt=new Map,this.vt=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set}Wt(i){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.Rt(i);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.it.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var t,s;try{t=e.attributes?y({},e.attributes):void 0,s=Jr(e.type,e.name,e.unit,t)}catch(a){return void this.it.warn("Dropping metric '"+e.name+"': attributes could not be serialized",a)}var r=this.Bt.get(s);if(!r){if(!this.Qt())return;r={name:e.name,type:e.type,unit:e.unit,attributes:t,windowStartMs:Date.now()},this.Bt.set(s,r)}var n=this.Ut.get(e.name);n===void 0?this.Ut.set(e.name,e.type):n===e.type||this.zt.has(e.name)||(this.zt.add(e.name),this.it.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.Jt(r,e.value),this.Dt()}else this.it.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.it.warn("Dropping metric with empty name")}}Qt(){return this.Te.maxSeriesPerFlush>this.Bt.size||(this.Ht||(this.Ht=!0,this.it.warn("Metric series cap reached ("+this.Te.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Jt(i,e){var t;switch(i.type){case"count":i.total=((t=i.total)!==null&&t!==void 0?t:0)+e;break;case"gauge":i.last=e;break;case"histogram":i.hist||(i.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(ss.length+1).fill(0)});var s=i.hist;s.count+=1,s.sum+=e,s.min=Math.min(s.min,e),s.max=Math.max(s.max,e),s.bucketCounts[(function(r,n){for(var a=0;n.length>a;a++)if(n[a]>=r)return a;return n.length})(e,ss)]+=1}}Rt(i){var e=this.Te.beforeSend;if(!e)return i;var t=R(e)?e:[e],s=i;for(var r of t)try{var n=r(s);if(!n)return this.it.info("Metric was rejected in beforeSend function"),null;s=n}catch(a){return this.it.error("Error in beforeSend function for metric:",a),null}return s}Dt(){this.Nt||(this.Nt=yi((()=>{this.Nt=void 0,this.flush().catch((i=>{this.it.error("Metrics flush failed:",i)}))}),this.Te.flushIntervalMs))}Tt(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}Zt(){var i=this;return Y((function*(){if(i.Bt.size!==0){var e=i.Bt;i.Bt=new Map,i.Ht=!1,i.Ut=new Map,i.zt=new Set;var t=i.Vt,s=yield i._instance.Kt(i.Gt(e));if(t===i.Vt)switch(s.kind){case"ok":return;case"retry-later":return i.Yt(e),void i.Dt();case"too-large":return void i.it.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void i.it.error("Failed to send metrics batch:",s.error)}}}))()}Gt(i){return e=this.Xt(i),t=(function(n,a,o){return y({},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.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Mi(t)},scopeMetrics:[{scope:{name:s,version:r},metrics:e}]}]};var e,t,s,r}Xt(i){var e=Wr(Date.now()),t=new Map;for(var s of i.values()){var r,n=Jr(s.type,s.name,s.unit,void 0),a=t.get(n);a||(a=y({name:s.name},s.unit&&{unit:s.unit}),s.type==="count"?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:s.type==="gauge"?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},t.set(n,a));var o=Mi((r=s.attributes)!==null&&r!==void 0?r:{}),l=Wr(s.windowStartMs);if(s.type==="count"){var u,c={attributes:o,startTimeUnixNano:l,timeUnixNano:e,asDouble:(u=s.total)!==null&&u!==void 0?u:0};a.sum.dataPoints.push(c)}else if(s.type==="gauge"){var h,d={attributes:o,timeUnixNano:e,asDouble:(h=s.last)!==null&&h!==void 0?h:0};a.gauge.dataPoints.push(d)}else s.hist&&a.histogram.dataPoints.push({attributes:o,startTimeUnixNano:l,timeUnixNano:e,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:ss})}return Array.from(t.values())}Yt(i){var e,t;for(var s of i){var r=s[0],n=s[1],a=this.Bt.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.Qt()&&this.Bt.set(r,n)}}};var ui,Xr,rs;function Yo(i){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return rs&&t.length===Xr||(Xr=t.length,rs=t.reduce(((s,r)=>{ui||(ui={});var n=ui[r];if(n)s[n[0]]=n[1];else for(var a=i(r),o=a.length-1;o>=0;o--){var l=a[o],u=l?.filename,c=e[r];if(u&&c){s[u]=c,ui[r]=[u,c];break}}return s}),{})),rs}}class Zo{constructor(e,t,s){s===void 0&&(s=[]),this.coercers=e,this.stackParser=t,this.modifiers=s}buildFromUnknown(e,t){t===void 0&&(t={});var s=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(s,t,0).apply(e),n=this.buildParsingContext(t),a=this.parseStacktrace(r,n);return{$exception_list:this.convertToExceptionList(a,s),$exception_level:"error"}}modifyFrames(e){var t=this;return Y((function*(){for(var s of e)s.stacktrace&&s.stacktrace.frames&&R(s.stacktrace.frames)&&(s.stacktrace.frames=yield t.applyModifiers(s.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 s,r;return e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),y({},e,{cause:s,stack:r})}applyChunkIds(e,t){return e.map((s=>(s.filename&&t&&(s.chunk_id=t[s.filename]),s)))}applyCoercers(e,t){for(var s of this.coercers)if(s.match(e))return s.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Y((function*(){var s=e;for(var r of t.modifiers)s=yield r(s);return s}))()}convertToExceptionList(e,t){var s,r,n,a={type:e.type,value:e.value,mechanism:{type:(s=t.type)!==null&&s!==void 0?s:"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,y({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:Yo(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,s){s===void 0&&(s=0);var r=(n,a)=>{if(4>=a){var o=this.buildCoercingContext(e,t,a);return this.applyCoercers(n,o)}};return y({},t,{syntheticException:s==0?t.syntheticException:void 0,mechanism:e,apply:n=>r(n,s),next:n=>r(n,s+1)})}}var St="?";function js(i,e,t,s,r){var n={platform:i,filename:e,function:t==="<anonymous>"?St:t,in_app:!0};return x(s)||(n.lineno=s),x(r)||(n.colno=r),n}var ya=(i,e)=>{var t=i.indexOf("safari-extension")!==-1,s=i.indexOf("safari-web-extension")!==-1;return t||s?[i.indexOf("@")!==-1?i.split("@")[0]:St,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},Qo=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,el=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tl=/\((\S*)(?::(\d+))(?::(\d+))\)/,il=(i,e)=>{var t=Qo.exec(i);if(t)return js(e,t[1],St,+t[2],+t[3]);var s=el.exec(i);if(s){if(s[2]&&s[2].indexOf("eval")===0){var r=tl.exec(s[2]);r&&(s[2]=r[1],s[3]=r[2],s[4]=r[3])}var n=ya(s[1]||St,s[2]);return js(e,n[1],n[0],s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},sl=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,rl=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,nl=(i,e)=>{var t=sl.exec(i);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var s=rl.exec(t[3]);s&&(t[1]=t[1]||"eval",t[3]=s[1],t[4]=s[2],t[5]="")}var r=t[3],n=t[1]||St,a=ya(n,r);return js(e,r=a[1],n=a[0],t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Kr=/\(error: (.*)\)/;class al{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var s=U(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:s?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 Pi(e,"DOMException")}isDOMError(e){return Pi(e,"DOMError")}}class ol{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var s=e.message;return String(s.error&&typeof s.error.message=="string"?s.error.message:s)}getStack(e){return e.stacktrace||e.stack||void 0}}class ll{constructor(){}match(e){return Pi(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var s;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}var ul=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class cl{match(e){return typeof e=="string"}coerce(e,t){var s,r=this.getInfos(e),n=r[0],a=r[1];return{type:n??"Error",value:a??e,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}getInfos(e){var t="Error",s=e,r=e.match(ul);return r&&(t=r[1],s=r[2]),[t,s]}}var hl=["fatal","error","warning","log","info","debug"];function ba(i,e){e===void 0&&(e=40);var t=Object.keys(i);if(t.sort(),!t.length)return"[object has no keys]";for(var s=t.length;s>0;s--){var r=t.slice(0,s).join(", ");if(e>=r.length)return s===t.length?r:r.length>e?r.slice(0,e)+"...":r}return""}class dl{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var s,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(s=t.syntheticException)==null?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return gr(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var s=this.getObjectClassName(e);return(s&&s!=="Object"?"'"+s+"'":"Object")+" captured as exception with keys: "+ba(e)}isSeverityLevel(e){return U(e)&&!Os(e)&&hl.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var s=e[t];if(Vo(s))return s}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}}class pl{match(e){return gr(e)}coerce(e,t){var s,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+ba(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class vl{match(e){return Jn(e)}coerce(e,t){var s;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class gl{match(e){return Pi(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!gr(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var s,r=this.getUnhandledRejectionReason(e);return Jn(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(s=t.syntheticException)==null?void 0:s.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 Ri="$message",Ci="$timestamp",fl=new Set([Ri,Ci]),ns={enabled:!0,max_bytes:32768};function Oi(i){var e;return i?{enabled:(e=i.enabled)!==null&&e!==void 0?e:ns.enabled,max_bytes:ml(i.max_bytes,ns.max_bytes)}:y({},ns)}class _l{constructor(e){this.$e=[],this.ze=0,this.Te=Oi(e)}setConfig(e){this.Te=Oi(e),this.Ze()}add(e){var t=(function(r){var n;try{n=Gn(r)}catch{return}try{var a=JSON.parse(n);if(!K(a))return;var o=a,l=o[Ri],u=o[Ci];return!U(l)||l.trim().length===0||!U(u)&&!de(u)?void 0:{step:o,json:n}}catch{return}})(e);if(t){var s=(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);s>this.Te.max_bytes||(this.$e.push({step:t.step,bytes:s}),this.ze+=s,this.Ze())}}getAttachable(){return this.$e.map((e=>e.step))}clear(){this.$e=[],this.ze=0}size(){return this.$e.length}Ze(){for(;this.ze>this.Te.max_bytes&&this.$e.length>0;){var e=this.$e.shift();e&&(this.ze-=e.bytes)}}}function ml(i,e){if(!de(i)||i===1/0||i===-1/0)return e;var t=Math.floor(i);return 0>t?e:t}var wa=function(i,e){var t=(e===void 0?{}:e).debugEnabled,s={k(r){if(v&&(B.DEBUG||v.POSTHOG_DEBUG||t)&&!x(v.console)&&v.console){for(var n=("__rrweb_original__"in v.console[r])?v.console[r].__rrweb_original__:v.console[r],a=arguments.length,o=new Array(a>1?a-1:0),l=1;a>l;l++)o[l-1]=arguments[l];n(i,...o)}},debug(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("debug",...n)},info(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("log",...n)},warn(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("warn",...n)},error(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("error",...n)},critical(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];console.error(i,...n)},uninitializedWarning(r){s.error("You must initialize PostHog before calling "+r)},createLogger:(r,n)=>wa(i+" "+r,n)};return s},E=wa("[PostHog.js]"),Q=E.createLogger,yl=Q("[ExternalScriptsLoader]"),as=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return yl.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var s=S?.querySelectorAll("script");if(s){for(var r,n=function(){if(s[a].src===e){var l=s[a];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(u=>{l.__posthog_loading_callback_fired=!0,t(void 0,u)})),l.onerror=u=>t(u),{v:void 0})}},a=0;s.length>a;a++)if(r=n())return r.v}var o=()=>{if(!S)return t("document not found");var l=S.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=h=>{l.__posthog_loading_callback_fired=!0,t(void 0,h)},l.onerror=h=>t(h),i.config.prepare_external_dependency_script&&(l=i.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(i.config.external_scripts_inject_target==="head")S.head.appendChild(l);else{var u,c=S.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)==null||u.insertBefore(l,c[0]):S.body.appendChild(l)}};S!=null&&S.body?o():S?.addEventListener("DOMContentLoaded",o)};$.__PosthogExtensions__=$.__PosthogExtensions__||{},$.__PosthogExtensions__.loadExternalDependency=(i,e,t)=>{if(e!=="remote-config"){var s;if(i.config.strict_script_versioning)s=i.requestRouter.endpointFor("assets","/static/"+i.version+"/"+e+".js");else{var r="/static/"+e+".js?v="+i.version;if(e==="toolbar"){var n=3e5;r=r+"&t="+Math.floor(Date.now()/n)*n}s=i.requestRouter.endpointFor("assets",r)}as(i,s,t)}else{var a=i.requestRouter.endpointFor("assets","/array/"+i.config.token+"/config.js");as(i,a,t)}},$.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var s=i.requestRouter.endpointFor("api",e);as(i,s,t)};B.DEBUG=!1,B.LIB_VERSION="1.409.5",B.LIB_NAME="web";var xa="$people_distinct_id",ei="$device_id",os="$device_model",Ht="__alias",zt="__timers",qs="$autocapture_disabled_server_side",Bs="$heatmaps_enabled_server_side",Hs="$exception_capture_enabled_server_side",zs="$error_tracking_suppression_rules",Us="$error_tracking_capture_extension_exceptions",Gs="$web_vitals_enabled_server_side",br="$dead_clicks_enabled_server_side",wr="$product_tours_enabled_server_side",Vs="$web_vitals_allowed_metrics",ut="$session_recording_remote_config",Ea="$replay_sample_rate",ka="$replay_override_sampling",Sa="$replay_override_linked_flag",Pa="$replay_override_url_trigger",Ta="$replay_override_event_trigger",yt="$sesid",xr="$session_is_sampled",lt="$enabled_feature_flags",bi="$active_feature_flags",Ut="$early_access_features",Ws="$feature_flag_details",wi="$feature_flag_payloads",Js="$feature_flag_request_id",Ai="$minimal_flag_called_events",qe="$override_feature_flags",ft="$override_feature_flag_payloads",nt="$stored_person_properties",at="$stored_group_properties",Xs="$surveys",Li="$surveys_loaded_at",Ks="$surveys_activated",xi="$surveys_activated_session",Gt="ph_product_tours",Jt="$flag_call_reported",Ys="$flag_call_reported_session_id",Zs="$feature_flag_errors",ti="$feature_flag_evaluated_at",Fe="$user_state",Qs="$client_session_props",er="$capture_rate_limit",tr="$initial_campaign_params",ir="$initial_referrer_info",Di="$initial_person_info",Ni="$epp",ci="$posthog_cookieless",Fa="$cookieless_mode",$a="$sdk_debug_extensions_init_method",Ia="$sdk_debug_extensions_init_time_ms",Ma="$sdk_debug_recording_script_not_loaded",Er="PostHog loadExternalDependency extension not found.",ot="on_reject",ze="always",dt="anonymous",Ze="identified",sr="identified_only",ji="visibilitychange",qi="beforeunload",_t="$pageview",ls="$pageleave",us="$identify",Yr="$groupidentify";function hi(i,e){R(i)&&i.forEach(e)}function G(i,e){if(!C(i))if(R(i))i.forEach(e);else if(Io(i))i.forEach(((s,r)=>e(s,r)));else for(var t in i)Wn.call(i,t)&&e(i[t],t)}var W=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),s=1;e>s;s++)t[s-1]=arguments[s];for(var r of t)for(var n in r)r[n]!==void 0&&(i[n]=r[n]);return i};function Ei(i){for(var e=Object.keys(i),t=e.length,s=new Array(t);t--;)s[t]=[e[t],i[e[t]]];return s}var Zr=function(i){try{return i()}catch{return}},bl=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),s=0;e>s;s++)t[s]=arguments[s];return i.apply(this,t)}catch(r){E.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),E.critical(r)}}},kr=function(i){var e={};return G(i,(function(t,s){(U(t)&&t.length>0||de(t))&&(e[s]=t)})),e},wl=["herokuapp.com","vercel.app","netlify.app"];function xl(i){var e=i?.hostname;if(!U(e))return!1;var t=e.split(".").slice(-2).join(".");for(var s of wl)if(t===s)return!1;return!0}function re(i,e,t,s){var r=s??{},n=r.capture,a=r.passive;i?.addEventListener(e,t,{capture:n!==void 0&&n,passive:a===void 0||a})}function Ra(i){return i.name==="ph_toolbar_internal"}var Ca=i=>{if(S){try{for(var e=i+"=",t=S.cookie.split(";").filter((n=>n.length)),s=0;t.length>s;s++){for(var r=t[s];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(i){return 0>i?Math.ceil(i):Math.floor(i)}),Number.isInteger||(Number.isInteger=function(i){return de(i)&&isFinite(i)&&Math.floor(i)===i});class Bi{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,s,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(s)||!Number.isInteger(r)||0>e||0>t||0>s||0>r||e>0xffffffffffff||t>4095||s>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|s>>>24,n[9]=s>>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new Bi(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 Bi(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;16>t;t++){var s=this.bytes[t]-e.bytes[t];if(s!==0)return Math.sign(s)}return 0}}class El{generate(){var e=this.generateOrAbort();if(!x(e))return e;this.S=0;var t=this.generateOrAbort();if(x(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.C();else{if(this.S>=e+1e4)return;this.M++,this.M>4398046511103&&(this.S++,this.C())}return Bi.fromFieldsV7(this.S,Math.trunc(this.M/Math.pow(2,30)),this.M&Math.pow(2,30)-1,this.I.nextUint32())}C(){this.M=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}constructor(){this.S=0,this.M=0,this.I=new kl}}var Qr,Oa=i=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;i.length>e;e++)i[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return i};v&&!x(v.crypto)&&crypto.getRandomValues&&(Oa=i=>crypto.getRandomValues(i));class kl{nextUint32(){return this.R.length>this.O||(Oa(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var He=()=>Sl().toString(),Sl=()=>(Qr||(Qr=new El)).generate(),Ct="",Pl=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Ue={N:()=>!!S,P(i){E.error("cookieStore error: "+i)},q:Ca,F(i){var e;try{e=JSON.parse(Ue.q(i))||{}}catch{}return e},A(i,e,t,s,r){if(!S)return!1;try{var n="",a="",o=(function(c,h){if(h){var d=(function(f,g){if(g===void 0&&(g=S),Ct)return Ct;if(!g||["localhost","127.0.0.1"].includes(f))return"";for(var m=f.split("."),b=Math.min(m.length,8),P="dmn_chk_"+He();!Ct&&b--;){var _=m.slice(b).join("."),k=P+"=1;domain=."+_+";path=/";g.cookie=k+";max-age=3",g.cookie.includes(P)&&(g.cookie=k+";max-age=0",Ct=_)}return Ct})(c);if(!d){var p=(f=>{var g=f.match(Pl);return g?g[0]:""})(c);p!==d&&E.info("Warning: cookie subdomain discovery mismatch",p,d),d=p}return d?"; domain=."+d:""}return""})(S.location.hostname,s);if(t){var l=new Date;l.setTime(l.getTime()+864e5*t),n="; expires="+l.toUTCString()}r&&(a="; secure");var u=i+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&E.warn("cookieStore warning: large cookie, len="+u.length),S.cookie=u,!0}catch{return!1}},D(i,e){if(S!=null&&S.cookie)try{Ue.A(i,"",-1,e)}catch{return}}},cs=null,V={N(){if(!ye(cs))return cs;var i=!0;if(x(v))i=!1;else try{var e="__mplssupport__";V.A(e,"xyz"),V.q(e)!=='"xyz"'&&(i=!1),V.D(e)}catch{i=!1}return i||E.error("localStorage unsupported; falling back to cookie store"),cs=i,i},P(i){E.error("localStorage error: "+i)},q(i){try{return v?.localStorage.getItem(i)}catch(e){V.P(e)}return null},F(i){try{return JSON.parse(V.q(i))||{}}catch{}return null},A(i,e){try{return v?.localStorage.setItem(i,JSON.stringify(e)),!0}catch(t){V.P(t)}return!1},D(i){try{v?.localStorage.removeItem(i)}catch(e){V.P(e)}}},Tl=[ei,"distinct_id",yt,xr,Ni,Di,Fe],di={},Fl={N:()=>!0,P(i){E.error("memoryStorage error: "+i)},q:i=>di[i]||null,F:i=>di[i]||null,A:(i,e)=>(di[i]=e,!0),D(i){delete di[i]}},Qe=null,he={N(){if(!ye(Qe))return Qe;if(Qe=!0,x(v))Qe=!1;else try{var i="__support__";he.A(i,"xyz"),he.q(i)!=='"xyz"'&&(Qe=!1),he.D(i)}catch{Qe=!1}return Qe},P(i){E.error("sessionStorage error: ",i)},q(i){try{return v?.sessionStorage.getItem(i)}catch(e){he.P(e)}return null},F(i){try{return JSON.parse(he.q(i))||null}catch{}return null},A(i,e){try{return v?.sessionStorage.setItem(i,JSON.stringify(e)),!0}catch(t){he.P(t)}return!1},D(i){try{v?.sessionStorage.removeItem(i)}catch(e){he.P(e)}}};class $l{constructor(e){this._instance=e}get Te(){return this._instance.config}get consent(){return this.Ge()?0:this.Qe}isOptedOut(){return this.Te.cookieless_mode===ze||this.isRejected()||this.consent===-1&&this.Te.cookieless_mode===ot}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Te.opt_out_capturing_by_default}optInOut(e){this.Je.A(this.Ke,e?1:0,this.Te.cookie_expiration,this.Te.cross_subdomain_cookie,this.Te.secure_cookie)}reset(){this.Je.D(this.Ke,this.Te.cross_subdomain_cookie)}get Ke(){var e=this._instance.config,t=e.token,s=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(s?s+t:"__ph_opt_in_out_"+t)}get Qe(){var e=this.Je.q(this.Ke);return ts(e)?1:M(Oo,e)?0:-1}get Je(){var e=this.Te.opt_out_capturing_persistence_type,t=e==="localStorage"?V:Ue;if(!this.Ye||this.Ye!==t){this.Ye=t;var s=e==="localStorage"?Ue:V;s.q(this.Ke)&&(this.Ye.q(this.Ke)||this.optInOut(ts(s.q(this.Ke))),s.D(this.Ke,this.Te.cross_subdomain_cookie))}return this.Ye}Ge(){return!!this.Te.respect_dnt&&[me?.doNotTrack,me?.msDoNotTrack,$.doNotTrack].some((e=>ts(e)))}}function Aa(i,e){var t,s=i==null||(t=i.config)==null?void 0:t.get_current_url;if(!Ee(s))return e;try{var r=s(e);return U(r)&&r?r:e}catch(n){return E.error("Error in get_current_url, falling back to window.location.href",n),e}}var La="__POSTHOG_TOOLBAR__",Il=1,Ml=3,Rl=11;function en(i){return i instanceof Element&&(i.id===La||!(i.closest==null||!i.closest(".toolbar-global-fade-container")))}function Ye(i){return!!i&&i.nodeType===Il}function ke(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function Da(i){return!!i&&i.nodeType===Ml}function Na(i){return!!i&&i.nodeType===Rl&&Ye(i.host)}var ja=1e3;function Sr(i){return i?Xi(i).split(/\s+/):[]}function tn(i,e){var t=(function(s){var r,n=v==null||(r=v.location)==null?void 0:r.href;return x(n)?void 0:Aa(s,n)})(e);return!!(t&&i&&i.some((s=>t.match(s))))}function Hi(i){var e="";switch(typeof i.className){case"string":e=i.className;break;case"object":e=(i.className&&"baseVal"in i.className?i.className.baseVal:null)||i.getAttribute("class")||"";break;default:e=""}return Sr(e)}function qa(i){return C(i)?null:Xi(i).split(/(\s+)/).filter((e=>Xt(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ii(i){var e="";return nr(i)&&!Ua(i)&&i.childNodes&&i.childNodes.length&&G(i.childNodes,(function(t){var s;Da(t)&&t.textContent&&(e+=(s=qa(t.textContent))!==null&&s!==void 0?s:"")})),Xi(e)}function hs(i){var e;return x(i.target)?i.srcElement||null:(e=i.target)!=null&&e.shadowRoot?i.composedPath()[0]||null:i.target||null}var Pr=["a","button","form","input","select","textarea","label"];function rr(i,e){if(x(e))return!0;var t,s=function(n){if(e.some((a=>(function(o,l){var u=o.matches||o.matchesSelector||o.msMatchesSelector||o.mozMatchesSelector||o.webkitMatchesSelector||o.oMatchesSelector;try{return!!u&&u.call(o,l)}catch{return!1}})(n,a))))return{v:!0}};for(var r of i)if(t=s(r))return t.v;return!1}function Ba(i){var e=i.parentNode;return!(!e||!Ye(e))&&e}var Cl=[".ph-no-autocapture","[data-ph-no-autocapture]"],Ha=["next","previous","prev",">","<"],Ol=[...Ha,"+","-","−","–"],sn=(i,e)=>/[a-z0-9]/i.test(e)?i.includes(e):i===e,rn=[".ph-no-rageclick",".ph-no-capture"],Al=["","text","search","email","password","url","tel","number"];function nn(i,e){if(!v||Tr(i))return!1;var t,s,r,n,a;if(Ce(e)?(t=!!e&&rn,s=void 0,r=!1):(t=(n=e?.css_selector_ignorelist)!==null&&n!==void 0?n:rn,s=e?.content_ignorelist,r=(a=e?.ignore_text_selection)!==null&&a!==void 0&&a),t===!1||r&&(function(l){return!(!l||!Ye(l))&&(!!ke(l,"textarea")||(ke(l,"input")?M(Al,(l.getAttribute("type")||"").toLowerCase()):(function(u){if(u.isContentEditable)return!0;var c=u.getAttribute==null?void 0:u.getAttribute("contenteditable");return c==="true"||c===""})(l)))})(i))return!1;var o=za(i,!1).targetElementList;return!(function(l,u){if(l===!1||x(l))return!1;var c;if(l===!0)c=Ha;else{if(!R(l))return!1;if(l.length>10)return E.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;c=l.map((h=>h.toLowerCase()))}return u.some((h=>{var d=h.safeText,p=h.ariaLabel;return c.some((f=>sn(d,f)||sn(p,f)))}))})(s,o.map((l=>{var u;return{safeText:ii(l).toLowerCase(),ariaLabel:((u=l.getAttribute("aria-label"))==null?void 0:u.toLowerCase().trim())||""}})))&&!rr(o,t)}var Tr=i=>!i||ke(i,"html")||!Ye(i),za=(i,e)=>{if(!v||Tr(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,s=[i],r=i;r.parentNode&&!ke(r,"body");)if(Na(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=Ba(r);if(!n)break;if(e||Pr.indexOf(n.tagName.toLowerCase())>-1)t=!0;else try{var a=v.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(t=!0)}catch{}s.push(n),r=n}return{parentIsUsefulElement:t,targetElementList:s}};function nr(i){for(var e=new Set,t=0,s=i;s.parentNode&&!ke(s,"body");s=s.parentNode){if(t++>=ja||e.has(s))return!1;e.add(s);var r=Hi(s);if(M(r,"ph-sensitive")||M(r,"ph-no-capture"))return!1}if(M(Hi(i),"ph-include"))return!0;var n=i.type||"";if(U(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var a=i.name||i.id||"";return!U(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 Ua(i){return!!(ke(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||ke(i,"select")||ke(i,"textarea")||i.getAttribute("contenteditable")==="true")}var an=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),on=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Ll=[16,15,14,13],Dl=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),ln=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),un=/[0-9A-Za-z_]/;function Nl(i){for(var e=0,t=!1,s=i.length-1;s>=0;s--){var r=i.charCodeAt(s)-48;t&&(r*=2)>9&&(r-=9),e+=r,t=!t}return e%10==0}function Xt(i,e){if(e===void 0&&(e=!0),C(i))return!1;if(U(i)){i=Xi(i);var t=e?an.test((i||"").replace(/[- ]/g,"")):(function(r){var n;for(on.lastIndex=0;n=on.exec(r);){var a=n[2];if(a)for(var o=a.replace(/[- ]/g,""),l=0;o.length>l;l++)for(var u of Ll){var c=l+u;if(o.length>=c){var h=o.slice(l,c);if(an.test(h)&&Nl(h))return!0}}}return!1})(i);if(t)return!1;var s=e?Dl.test(i):(function(r){var n;for(ln.lastIndex=0;n=ln.exec(r);){var a=n[1],o=n[3];if(!(a&&o&&un.test(a)&&un.test(o)))return!0}return!1})(i);if(s)return!1}return!0}function cn(i){var e=ii(i);return Xt(e=(e+" "+Ga(i)).trim())?e:""}function Ga(i){var e="";return i&&i.childNodes&&i.childNodes.length&&G(i.childNodes,(function(t){var s;if(t&&((s=t.tagName)==null?void 0:s.toLowerCase())==="span")try{var r=ii(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Ga(t)).trim())}catch(n){E.error("[AutoCapture]",n)}})),e}function hn(i){return i.replace(/"|\\"/g,'\\"')}function jl(i){var e=i.attr__class;if(e)return R(e)?e:Sr(e)}var pi=Q("[Dead Clicks]"),ql=()=>!0,Bl=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(br)),s=i.instance.config.capture_dead_clicks;return Ce(s)?s:!!K(s)||t};class dn{get lazyLoadedDeadClicksAutocapture(){return this.Xe}constructor(e,t,s){this.instance=e,this.isEnabled=t,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[br]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.tr((()=>{this.er()})):this.stop()}tr(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture?e():(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"dead-clicks-autocapture",(r=>{r?pi.error("failed to load script",r):e()}))}er(){var e;if(S){if(!this.Xe&&(e=$.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=K(this.instance.config.capture_dead_clicks)?y({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Xe=$.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Xe.start(S),pi.info("starting...")}}else pi.error("`document` not found. Cannot start.")}stop(){this.Xe&&(this.Xe.stop(),this.Xe=void 0,pi.info("stopping..."))}}var ds=Q("[SegmentIntegration]"),Va="posthog-js";function Wa(i,e){var t=e===void 0?{}:e,s=t.organization,r=t.projectId,n=t.prefix,a=t.severityAllowList,o=a===void 0?["error"]:a,l=t.sendExceptionsToPostHog,u=l===void 0||l;return c=>{var h,d,p,f,g;if(o!=="*"&&!o.includes(c.level)||!i.__loaded)return c;c.tags||(c.tags={});var m=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/person/"+i.get_distinct_id());c.tags["PostHog Person URL"]=m,i.sessionRecordingStarted()&&(c.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var b,P=((h=c.exception)==null?void 0:h.values)||[],_=P.map((F=>y({},F,{stacktrace:F.stacktrace?y({},F.stacktrace,{type:"raw",frames:(F.stacktrace.frames||[]).map((D=>y({},D,{platform:"web:javascript"})))}):void 0}))),k={$exception_message:((d=P[0])==null?void 0:d.value)||c.message,$exception_type:(p=P[0])==null?void 0:p.type,$exception_level:c.level,$exception_list:_,$sentry_event_id:c.event_id,$sentry_exception:c.exception,$sentry_exception_message:((f=P[0])==null?void 0:f.value)||c.message,$sentry_exception_type:(g=P[0])==null?void 0:g.type,$sentry_tags:c.tags};return s&&r&&(k.$sentry_url=(n||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+c.event_id),u&&((b=i.exceptions)==null||b.sendExceptionEvent(k)),c}}class Hl{constructor(e,t,s,r,n,a){this.name=Va,this.setupOnce=function(o){o(Wa(e,{organization:t,projectId:s,prefix:r,severityAllowList:n,sendExceptionsToPostHog:a==null||a}))}}}class pn{constructor(e){this.rr=(t,s,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(E.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:r}),this.ir=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.nr()}nr(){var e;this.sr=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.rr)}destroy(){var e;(e=this.sr)==null||e.call(this),this.sr=void 0}doPageView(e,t){var s,r=this.ar(e,t);return this.ir={pathname:(s=v?.location.pathname)!==null&&s!==void 0?s:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.ar(e,(t=this.ir)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.ir)==null?void 0:e.pageViewId}}ar(e,t){var s=this.ir;if(!s)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:s.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var a=n.maxScrollHeight,o=n.lastScrollY,l=n.maxScrollY,u=n.maxContentHeight,c=n.lastContentY,h=n.maxContentY;if(!(x(a)||x(o)||x(l)||x(u)||x(c)||x(h))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),h=Math.ceil(h);var d=a>1?Le(o/a,0,1,E):1,p=a>1?Le(l/a,0,1,E):1,f=u>1?Le(c/u,0,1,E):1,g=u>1?Le(h/u,0,1,E):1;r=W(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:c,$prev_pageview_last_content_percentage:f,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:g})}}return s.pathname&&(r.$prev_pageview_pathname=s.pathname),s.timestamp&&(r.$prev_pageview_duration=(e.getTime()-s.timestamp.getTime())/1e3),r}}var ps=["flags","surveys"],zl={[xa]:{exposure:"hidden"},[Ht]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[zt]:{exposure:"hidden"},[qs]:{exposure:"event"},[Bs]:{exposure:"hidden"},[Hs]:{exposure:"event"},[zs]:{exposure:"hidden"},[Us]:{exposure:"event"},[Gs]:{exposure:"event"},[br]:{exposure:"event"},[wr]:{exposure:"hidden"},[Vs]:{exposure:"event"},[ut]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[yt]:{exposure:"hidden"},[xr]:{exposure:"event"},[Ea]:{exposure:"event",shouldSkipFromEventProperties:i=>ye(i)},$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"},[lt]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(i,e)=>e(),transformToEventProperties(i){if(!K(i))return{};for(var e={},t=Object.keys(i),s=0;t.length>s;s++)e["$feature/"+t[s]]=i[t[s]];return e}},[bi]:{exposure:"event",storageGroup:"flags"},[Ut]:{exposure:"hidden"},[Ws]:{exposure:"hidden",storageGroup:"flags"},[wi]:{exposure:"event",storageGroup:"flags"},[Js]:{exposure:"event",storageGroup:"flags",volatile:!0},[Ai]:{exposure:"hidden",storageGroup:"flags"},[qe]:{exposure:"event"},[ft]:{exposure:"hidden"},[nt]:{exposure:"hidden"},[at]:{exposure:"hidden"},[Xs]:{exposure:"hidden",storageGroup:"surveys"},[Li]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Ks]:{exposure:"event"},[xi]:{exposure:"hidden"},[Gt]:{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"},[Jt]:{exposure:"hidden"},[Ys]:{exposure:"hidden"},[Zs]:{exposure:"hidden"},[ti]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Fe]:{exposure:"hidden"},[Qs]:{exposure:"hidden"},[er]:{exposure:"hidden"},[tr]:{exposure:"hidden"},[ir]:{exposure:"hidden"},[Di]:{exposure:"hidden"},[Ni]:{exposure:"hidden"},[ka]:{exposure:"event"},[Sa]:{exposure:"event"},[Pa]:{exposure:"event"},[Ta]:{exposure:"event"},[$a]:{exposure:"event"},[Ia]:{exposure:"event"},[Ma]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Ul=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],et=i=>{var e=zl[i];if(e)return e;for(var t of Ul){var s=t[1];if(i.indexOf(t[0])===0)return s}},bt=(i,e)=>{try{return JSON.stringify(i,((t,s)=>typeof s=="bigint"?s.toString():s),e)}catch{return Gn(i)}},zi=i=>{var e=S?.createElement("a");return x(e)?null:(e.href=i,e)},Pt=function(i,e){for(var t,s=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===e){t=n;break}}if(!R(t)||2>t.length)return"";var a=t[1];try{a=decodeURIComponent(a)}catch{E.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},si=function(i,e,t){if(!i||!e||!e.length)return i;for(var s=i.split("#"),r=s[1],n=(s[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),u=[],c=0;l.length>c;c++){var h=l[c].split("=");R(h)&&(e.includes(h[0])?u.push(h[0]+"="+t):u.push(l[c]))}var d=o;return a!=null&&(d+="?"+u.join("&")),r!=null&&(d+="#"+r),d},Ui=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Ja=(i,e)=>i>=e&&Hn(),Xa=(i,e,t,s)=>{if(i===0){if(Hn()){var r=e+1;return r===t&&s(),r}return e}return 0},vi="https?://(.*)",Tt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Gl=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Tt],ri="<masked>",Vl=["li_fat_id"];function Ka(i,e,t){if(!S)return{};var s,r=e?[...Tt,...t||[]]:[],n=Ya(si(S.URL,r,ri),i),a=(s={},G(Vl,(function(o){var l=Ca(o);s[o]=l||null})),s);return W(a,n)}function Ya(i,e){var t=Gl.concat(e||[]),s={};return G(t,(function(r){var n=Pt(i,r);s[r]=n||null})),s}function Za(i){var e=(function(n){return n?n.search(vi+"google.([^/?]*)")===0?"google":n.search(vi+"bing.com")===0?"bing":n.search(vi+"yahoo.com")===0?"yahoo":n.search(vi+"duckduckgo.com")===0?"duckduckgo":null:null})(i),t=e!="yahoo"?"q":"p",s={};if(!ye(e)){s.$search_engine=e;var r=S?Pt(S.referrer,t):"";r.length&&(s.ph_keyword=r)}return s}function vn(){return navigator.language||navigator.userLanguage}var Gi="$direct";function Qa(){return S?.referrer||Gi}function eo(i,e,t){t===void 0&&(t=!1);var s=i?[...Tt,...e||[]]:[],r=t?Ke(oe?.href):oe?.href,n=r?.substring(0,1e3);return{r:Qa().substring(0,1e3),u:n?si(n,s,ri):void 0}}function to(i,e){var t;e===void 0&&(e=!1);var s=i.r,r=i.u,n=e?Ke(r):r,a={$referrer:s,$referring_domain:s==null?void 0:s==Gi?Gi:(t=zi(s))==null?void 0:t.host};if(n){a.$current_url=n;var o=zi(n);a.$host=o?.host,a.$pathname=o?.pathname;var l=Ya(n);W(a,l)}if(s){var u=Za(s);W(a,u)}return a}function io(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Wl(){try{return new Date().getTimezoneOffset()}catch{return}}var Jl={flags:ti,surveys:Li},Xl=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],pt="main";class vs{constructor(e,t,s){if(s===void 0&&(s=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=e,this.dr=s,this.props={},this.cr=void 0,this.vr=(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.Je=this.pr(e),this.hr=this.gr(e),this.load(),e.debug&&E.info("Persistence loaded",e.persistence,y({},this.props)),this.update_config(e,e,t),this.save(),v){var r=()=>this.flush();re(v,"beforeunload",r,{capture:!1}),re(v,"pagehide",r,{capture:!1})}}mr(){var e,t=(e=this.Te)==null?void 0:e.persistence_save_debounce_ms;return de(t)&&t>0?t:0}isDisabled(){return!!this.yr}pr(e){Xl.indexOf(e.persistence.toLowerCase())===-1&&(E.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=(function(a,o){a===void 0&&(a=[]),o===void 0&&(o=!1);var l=[...Tl,...a];return y({},V,{F(u){try{var c={};try{c=Ue.F(u)||{}}catch{}var h,d=JSON.parse(V.q(u)||"{}");if(o){var p={};for(var f in c){var g=c[f];ye(g)||g===""||(p[f]=g)}h=W(d,p)}else h=W(c,d);return V.A(u,h),h}catch{}return null},A(u,c,h,d,p,f){var g=V.A(u,c,void 0,void 0,f);try{var m={};l.forEach((b=>{c[b]&&(m[b]=c[b])})),Object.keys(m).length&&Ue.A(u,m,h,d,p,f)}catch(b){V.P(b)}return g},D(u,c){try{v?.localStorage.removeItem(u),Ue.D(u,c)}catch(h){V.P(h)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,n=e.persistence.toLowerCase();return n==="localstorage"&&V.N()?(t=V,r=!0):n==="localstorage+cookie"&&s.N()?(t=s,r=!0):n==="sessionstorage"&&he.N()?t=he:n==="memory"?t=Fl:n==="cookie"?t=Ue:s.N()?(t=s,r=!0):t=Ue,this.ur=r,t}br(e){return this.vr+"__"+e}gr(e){return this.ur&&!!e.split_storage}_r(e){var t=e??this.Te.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var s=this.props[ti];return!s||typeof s!="number"||Date.now()-s>t}properties(){var e={};return G(this.props,((t,s)=>{var r=et(s);if(r?.exposure==="derived"){if(r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t,s===lt?()=>this._r():()=>!1))return;r.transformToEventProperties&&W(e,r.transformToEventProperties(t))}else if(!r||r.exposure==="event"){if(r!=null&&r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t,(()=>!1)))return;e[s]=t}})),e}load(){if(!this.yr){var e=this.Je.F(this.vr);e&&(this.props=W({},e)),this.hr&&this.wr()}}wr(){for(var e of ps){var t=V.F(this.br(e));if(t&&!Xe(t)){var s=this.kr(e);s.persisted=!0,this.Sr(e)||(s.fingerprint=this.Cr(t,e)),this.Mr(e,t)||W(this.props,t)}}}Sr(e){return Object.keys(this.props).some((t=>{var s;return((s=et(t))==null?void 0:s.storageGroup)===e}))}Mr(e,t){var s=Jl[e];if(!s)return!1;var r=t[s],n=this.props[s];return de(r)&&de(n)&&n>r}refreshKey(e){var t;if(!this.yr){var s=this.hr?(t=et(e))==null?void 0:t.storageGroup:void 0,r=s?V.F(this.br(s)):this.Je.F(this.vr);if(r&&e in r)this.Ir(e,r[e]);else{if(s){var n=this.Je.F(this.vr);if(n&&e in n)return void this.Ir(e,n[e])}this.Tr(e)}}}save(){if(!this.yr){var e=this.mr();e>0?x(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),e)):this.Rr()}}flush(){x(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr())}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Je,this.vr,this.props,pt))}Pr(){var e=this.Fr(),t=e.main,s=e.groups;for(var r of(this.Or(this.Je,this.vr,t,pt),ps)){var n,a=s[r];(!Xe(a)||(n=this.lr[r])!=null&&n.persisted)&&this.Or(V,this.br(r),a,r)}}Fr(){var e={},t={flags:{},surveys:{}};return G(this.props,((s,r)=>{var n,a=(n=et(r))==null?void 0:n.storageGroup;a?t[a][r]=s:e[r]=s})),{main:e,groups:t}}Cr(e,t){if(t===pt)return JSON.stringify(e)+"|"+this.Ar+"|"+this.$r+"|"+this.Lr;var s={};return G(e,((r,n)=>{var a;s[n]=(a=et(n))!=null&&a.volatile?"__volatile__":r})),JSON.stringify(s)}Or(e,t,s,r){var n=this.kr(r);if(r===pt||n.dirty||x(n.fingerprint)){var a;try{if((a=this.Cr(s,r))===n.fingerprint)return void(n.dirty=!1)}catch{a=void 0}e.A(t,s,this.Ar,this.$r,this.Lr,this.Te.debug)?(n.dirty=!1,r!==pt&&(n.persisted=!0),x(a)||(n.fingerprint=a)):this.Te.debug&&E.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var t=(e===void 0?{}:e).keepGroupEntries,s=t!==void 0&&t;if(x(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Je.D(this.vr,!1),this.Je.D(this.vr,!0),!s&&this.dr)for(var r of ps)V.D(this.br(r));s?delete this.lr[pt]:this.lr={}}clear(){this.remove(),this.props={}}register_once(e,t,s){if(K(e)){x(t)&&(t="None"),this.Ar=x(s)?this.Dr:s;var r=!1;if(G(e,((n,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.Ir(a,n),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(K(e)){this.Ar=x(t)?this.Dr:t;var s=!1;if(G(e,((r,n)=>{e.hasOwnProperty(n)&&this.props[n]!==r&&(this.Ir(n,r),s=!0)})),s)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Tr(e),this.save())}update_campaign_params(){var e=S?.URL;if(e!==this.cr){var t=Ka(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);Xe(kr(t))||this.register(t),this.cr=e}}update_search_keyword(){var e;this.register((e=S?.referrer)?Za(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Qa(),$referring_domain:S!=null&&S.referrer&&((e=zi(S.referrer))==null?void 0:e.host)||Gi},void 0)}set_initial_person_info(){this.props[tr]||this.props[ir]||this.register_once({[Di]:eo(this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties,this.Te.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};G([ir,tr],(r=>{var n=this.props[r];n&&G(n,(function(a,o){e["$initial_"+Cs(o)]=a}))}));var t=this.props[Di];if(t){var s=(function(r,n){n===void 0&&(n=!1);var a=to(r,n),o={};return G(a,(function(l,u){o["$initial_"+Cs(u)]=l})),o})(t,this.Te.disable_capture_url_hashes);W(e,s)}return e}safe_merge(e){return G(this.props,(function(t,s){s in e||(e[s]=t)})),e}update_config(e,t,s){this.Dr=this.Ar=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!s),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var r=e.persistence!==t.persistence||!((l,u)=>{if(l.length!==u.length)return!1;var c=[...l].sort(),h=[...u].sort();return c.every(((d,p)=>d===h[p]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=r?this.pr(e):this.Je,a=this.gr(e);if(r||a!==this.hr){var o=this.props;this.clear(),this.Je=n,this.hr=a,this.props=o,this.save()}}set_disabled(e){this.yr=e,this.yr?this.remove():this.save()}set_cross_subdomain(e){e!==this.$r&&(this.$r=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Lr&&(this.Lr=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var s=this.props[zt]||{};s[e]=t,this.Ir(zt,s),this.save()}remove_event_timer(e){var t=this.props[zt]||{},s=t[e];return x(s)||(delete t[e],this.Ir(zt,t),this.save()),s}get_property(e){return this.props[e]}set_property(e,t){this.Ir(e,t),this.save()}Ir(e,t){var s;this.props[e]=t,(s=et(e))!=null&&s.volatile||this.Nr(e)}Tr(e){delete this.props[e],this.Nr(e)}Nr(e){var t,s=(t=et(e))==null?void 0:t.storageGroup;s&&(this.kr(s).dirty=!0)}kr(e){return this.lr[e]||(this.lr[e]={})}}function gi(i){var e=!0;return{dispose(){if(e){e=!1;var t=i();t&&Ee(t.then)&&t.then(void 0,(()=>{}))}}}}var _e={GZipJS:"gzip-js",Base64:"base64"},Ot={Activation:"events",Cancellation:"cancelEvents"},gs={Popover:"popover",API:"api",Widget:"widget"},Ge={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},fs={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},ar={Popover:"popover",Inline:"inline"},Kl={SHOWN:"product tour shown"},gn={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},fn=Q("[RateLimiter]");class Yl{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var s=t.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach((r=>{fn.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4}))}catch(r){return void fn.warn('could not rate limit - continuing. Error: "'+r?.message+'"',{text:s})}},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,s,r;e===void 0&&(e=!1);var n=this.captureEventsBurstLimit,a=this.captureEventsPerSecond,o=new Date().getTime(),l=(t=(s=this.instance.persistence)==null?void 0:s.get_property(er))!==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 u=1>l.tokens;return u||e||(l.tokens=Math.max(0,l.tokens-1)),!u||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+a+" events per second and "+n+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=u,(r=this.instance.persistence)==null||r.set_property(er,l),{isRateLimited:u,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var tt=Q("[RemoteConfig]");class so{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}qr(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.loadExternalDependency?(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}jr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return tt.info("Using preloaded remote config",this.remoteConfig),this.Br(this.remoteConfig),void this.Hr();if(this._instance.Ur())return void tt.warn("Remote config is disabled. Falling back to local config.");this.qr((e=>{if(!e)return tt.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr((t=>{this.Br(t),this.Hr()}));this.Br(e),this.Hr()}))}catch(e){tt.error("Error loading remote config",e),this.Br()}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&S&&S.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Hr(){var e;if(!this.zr){var t=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;t!==0&&(this.zr=setInterval((()=>{this.refresh()}),t))}}Br(e){e||tt.error("Failed to fetch remote config from PostHog.");try{this._instance.Br(e?{ok:!0,config:e}:{ok:!1})}catch(s){tt.error("Error applying remote config",s)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var t;(t=this._instance.featureFlags)==null||t.ensureFlagsLoaded()}catch(s){tt.error("Error loading feature flags",s)}}}var Ie=Uint8Array,xe=Uint16Array,Ft=Uint32Array,Fr=new Ie([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),$r=new Ie([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_n=new Ie([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ro=function(i,e){for(var t=new xe(31),s=0;31>s;++s)t[s]=e+=1<<i[s-1];var r=new Ft(t[30]);for(s=1;30>s;++s)for(var n=t[s];t[s+1]>n;++n)r[n]=n-t[s]<<5|s;return[t,r]},no=ro(Fr,2),or=no[1];no[0][28]=258,or[258]=28;for(var mn=ro($r,0)[1],ao=new xe(32768),Z=0;32768>Z;++Z){var vt=(43690&Z)>>>1|(21845&Z)<<1;ao[Z]=((65280&(vt=(61680&(vt=(52428&vt)>>>2|(13107&vt)<<2))>>>4|(3855&vt)<<4))>>>8|(255&vt)<<8)>>>1}var Kt=function(i,e,t){for(var s=i.length,r=0,n=new xe(e);s>r;++r)++n[i[r]-1];var a,o=new xe(e);for(r=0;e>r;++r)o[r]=o[r-1]+n[r-1]<<1;for(a=new xe(s),r=0;s>r;++r)a[r]=ao[o[i[r]-1]++]>>>15-i[r];return a},ht=new Ie(288);for(Z=0;144>Z;++Z)ht[Z]=8;for(Z=144;256>Z;++Z)ht[Z]=9;for(Z=256;280>Z;++Z)ht[Z]=7;for(Z=280;288>Z;++Z)ht[Z]=8;var Vi=new Ie(32);for(Z=0;32>Z;++Z)Vi[Z]=5;var Zl=Kt(ht,9),Ql=Kt(Vi,5),oo=function(i){return(i/8>>0)+(7&i&&1)},lo=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var s=new(i instanceof xe?xe:i instanceof Ft?Ft:Ie)(t-e);return s.set(i.subarray(e,t)),s},De=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8},At=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8,i[s+2]|=t>>>16},_s=function(i,e){for(var t=[],s=0;i.length>s;++s)i[s]&&t.push({s,f:i[s]});var r=t.length,n=t.slice();if(!r)return[new Ie(0),0];if(r==1){var a=new Ie(t[0].s+1);return a[t[0].s]=1,[a,1]}t.sort((function(F,D){return F.f-D.f})),t.push({s:-1,f:25001});var o=t[0],l=t[1],u=0,c=1,h=2;for(t[0]={s:-1,f:o.f+l.f,l:o,r:l};c!=r-1;)o=t[t[h].f>t[u].f?u++:h++],l=t[u!=c&&t[h].f>t[u].f?u++:h++],t[c++]={s:-1,f:o.f+l.f,l:o,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var p=new xe(d+1),f=lr(t[c-1],p,0);if(f>e){s=0;var g=0,m=f-e,b=1<<m;for(n.sort((function(F,D){return p[D.s]-p[F.s]||F.f-D.f}));r>s;++s){var P=n[s].s;if(e>=p[P])break;g+=b-(1<<f-p[P]),p[P]=e}for(g>>>=m;g>0;){var _=n[s].s;e>p[_]?g-=1<<e-p[_]++-1:++s}for(;s>=0&&g;--s){var k=n[s].s;p[k]==e&&(--p[k],++g)}f=e}return[new Ie(p),f]},lr=function(i,e,t){return i.s==-1?Math.max(lr(i.l,e,t+1),lr(i.r,e,t+1)):e[i.s]=t},yn=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new xe(++e),s=0,r=i[0],n=1,a=function(l){t[s++]=l},o=1;e>=o;++o)if(i[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=i[o]}return[t.subarray(0,s),e]},Lt=function(i,e){for(var t=0,s=0;e.length>s;++s)t+=i[s]*e[s];return t},ur=function(i,e,t){var s=t.length,r=oo(e+2);i[r]=255&s,i[r+1]=s>>>8,i[r+2]=255^i[r],i[r+3]=255^i[r+1];for(var n=0;s>n;++n)i[r+n+4]=t[n];return 8*(r+4+s)},bn=function(i,e,t,s,r,n,a,o,l,u,c){De(e,c++,t),++r[256];for(var h=_s(r,15),d=h[0],p=h[1],f=_s(n,15),g=f[0],m=f[1],b=yn(d),P=b[0],_=b[1],k=yn(g),F=k[0],D=k[1],O=new xe(19),w=0;P.length>w;++w)O[31&P[w]]++;for(w=0;F.length>w;++w)O[31&F[w]]++;for(var T=_s(O,7),I=T[0],A=T[1],L=19;L>4&&!I[_n[L-1]];--L);var j,ne,ae,q,ee=u+5<<3,X=Lt(r,ht)+Lt(n,Vi)+a,pe=Lt(r,d)+Lt(n,g)+a+14+3*L+Lt(O,I)+(2*O[16]+3*O[17]+7*O[18]);if(X>=ee&&pe>=ee)return ur(e,c,i.subarray(l,l+u));if(De(e,c,1+(X>pe)),c+=2,X>pe){j=Kt(d,p),ne=d,ae=Kt(g,m),q=g;var te=Kt(I,A);for(De(e,c,_-257),De(e,c+5,D-1),De(e,c+10,L-4),c+=14,w=0;L>w;++w)De(e,c+3*w,I[_n[w]]);c+=3*L;for(var z=[P,F],ce=0;2>ce;++ce){var N=z[ce];for(w=0;N.length>w;++w)De(e,c,te[J=31&N[w]]),c+=I[J],J>15&&(De(e,c,N[w]>>>5&127),c+=N[w]>>>12)}}else j=Zl,ne=ht,ae=Ql,q=Vi;for(w=0;o>w;++w)if(s[w]>255){var J;At(e,c,j[257+(J=s[w]>>>18&31)]),c+=ne[J+257],J>7&&(De(e,c,s[w]>>>23&31),c+=Fr[J]);var ie=31&s[w];At(e,c,ae[ie]),c+=q[ie],ie>3&&(At(e,c,s[w]>>>5&8191),c+=$r[ie])}else At(e,c,j[s[w]]),c+=ne[s[w]];return At(e,c,j[256]),c+ne[256]},eu=new Ft([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tu=(function(){for(var i=new Ft(256),e=0;256>e;++e){for(var t=e,s=9;--s;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i})(),ms=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8};function iu(i,e){e===void 0&&(e={});var t=(function(){var h=4294967295;return{p(d){for(var p=h,f=0;d.length>f;++f)p=tu[255&p^d[f]]^p>>>8;h=p},d(){return 4294967295^h}}})(),s=i.length;t.p(i);var r,n,a,o,l,u=(o=10+((r=e).filename&&r.filename.length+1||0),l=8,(function(h,d,p,f,g,m){var b=h.length,P=new Ie(f+b+5*(1+Math.floor(b/7e3))+g),_=P.subarray(f,P.length-g),k=0;if(!d||8>b)for(var F=0;b>=F;F+=65535){var D=F+65535;b>D?k=ur(_,k,h.subarray(F,D)):(_[F]=!0,k=ur(_,k,h.subarray(F,b)))}else{for(var O=eu[d-1],w=O>>>13,T=8191&O,I=(1<<p)-1,A=new xe(32768),L=new xe(I+1),j=Math.ceil(p/3),ne=2*j,ae=function(es){return(h[es]^h[es+1]<<j^h[es+2]<<ne)&I},q=new Ft(25e3),ee=new xe(288),X=new xe(32),pe=0,te=0,z=(F=0,0),ce=0,N=0;b>F;++F){var J=ae(F),ie=32767&F,le=L[J];if(A[ie]=le,L[J]=ie,F>=ce){var We=b-F;if((pe>7e3||z>24576)&&We>423){k=bn(h,_,0,q,ee,X,te,z,N,F-N,k),z=pe=te=0,N=F;for(var fe=0;286>fe;++fe)ee[fe]=0;for(fe=0;30>fe;++fe)X[fe]=0}var Me=2,Je=0,be=T,Re=ie-le&32767;if(We>2&&J==ae(F-Re))for(var ni=Math.min(w,We)-1,$t=Math.min(32767,F),ai=Math.min(258,We);$t>=Re&&--be&&ie!=le;){if(h[F+Me]==h[F+Me-Re]){for(var Pe=0;ai>Pe&&h[F+Pe]==h[F+Pe-Re];++Pe);if(Pe>Me){if(Me=Pe,Je=Re,Pe>ni)break;var oi=Math.min(Re,Pe-2),It=0;for(fe=0;oi>fe;++fe){var Qi=F-Re+fe+32768&32767,Mr=Qi-A[Qi]+32768&32767;Mr>It&&(It=Mr,le=Qi)}}}Re+=(ie=le)-(le=A[ie])+32768&32767}if(Je){q[z++]=268435456|or[Me]<<18|mn[Je];var Rr=31&or[Me],Cr=31&mn[Je];te+=Fr[Rr]+$r[Cr],++ee[257+Rr],++X[Cr],ce=F+Me,++pe}else q[z++]=h[F],++ee[h[F]]}}k=bn(h,_,!0,q,ee,X,te,z,N,F-N,k)}return lo(P,0,f+oo(k)+g)})(n=i,(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)),c=u.length;return(function(h,d){var p=d.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>d.level?4:d.level==9?2:0,h[9]=3,d.mtime!=0&&ms(h,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),p){h[3]=8;for(var f=0;p.length>=f;++f)h[f+10]=p.charCodeAt(f)}})(u,e),ms(u,c-8,t.d()),ms(u,c-4,s),u}var su=!!Is||!!vr,uo="text/plain",ki=!1,co=(i,e)=>{var t=i.split("#"),s=t[1],r=t[0].split("?"),n=r[0],a=r[1];if(!a)return i;var o=a.split("&").filter((l=>l.split("=")[0]!==e)).join("&");return n+(o?"?"+o:"")+(s?"#"+s:"")},Yi=function(i,e,t){var s;t===void 0&&(t=!0);var r=i.split("?"),n=r[0],a=r[1],o=y({},e),l=(s=a?.split("&").map((c=>{var h,d=c.split("="),p=d[0],f=t&&(h=o[p])!==null&&h!==void 0?h:d[1];return delete o[p],p+"="+f})))!==null&&s!==void 0?s:[],u=(function(c,h){var d,p;h===void 0&&(h="&");var f=[];return G(c,(function(g,m){x(g)||x(m)||m==="undefined"||(d=encodeURIComponent((b=>b instanceof File)(g)?g.name:g.toString()),p=encodeURIComponent(m),f[f.length]=p+"="+d)})),f.join(h)})(o);return u&&l.push(u),l.length>0?n+"?"+l.join("&"):n},ys=i=>{if(i.Vr)return i.Vr;var e=i.data,t=i.compression;if(e){if(t===_e.GZipJS){var s=iu((function(o,l){var u=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var c=new Ie(o.length+(o.length>>>1)),h=0,d=function(m){c[h++]=m},p=0;u>p;++p){if(h+5>c.length){var f=new Ie(h+8+(u-p<<1));f.set(c),c=f}var g=o.charCodeAt(p);128>g?d(g):2048>g?(d(192|g>>>6),d(128|63&g)):g>55295&&57344>g?(d(240|(g=65536+(1047552&g)|1023&o.charCodeAt(++p))>>>18),d(128|g>>>12&63),d(128|g>>>6&63),d(128|63&g)):(d(224|g>>>12),d(128|g>>>6&63),d(128|63&g))}return lo(c,0,h)})(bt(e)),{mtime:0});return{contentType:uo,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(t===_e.Base64){var r=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,((l,u)=>String.fromCharCode(parseInt(u,16)))))})(bt(e)),n=(o=>"data="+encodeURIComponent(typeof o=="string"?o:bt(o)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var a=bt(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},ho=i=>{var e,t,s=()=>i.transport==="sendBeacon"?{url:Yi(i.url,{compression:_e.Base64}),encodedBody:ys(y({},i,{compression:_e.Base64,Vr:void 0}))}:{url:co(i.url,"compression"),encodedBody:ys(y({},i,{compression:void 0,Vr:void 0}))};try{e=ys(i)}catch(r){if(qr(i.compression,Pt(i.url,"compression")))return E.error("Failed to gzip request body, sending uncompressed payload",r),s();throw r}return e&&qr(i.compression,Pt(i.url,"compression"))&&!((t=e.body)instanceof ArrayBuffer?Ms(new Uint8Array(t)):ArrayBuffer.isView(t)&&Ms(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?(ki=!0,s()):{url:i.url,encodedBody:e}},po=i=>{try{return ho(i)}catch(e){return E.error(e),void(i.callback==null||i.callback({statusCode:0,error:e}))}},ru=(function(){var i=Y((function*(e){var t=bt(e.data),s=yield(function(n,a,o){return Rs.apply(this,arguments)})(t,B.DEBUG,{rethrow:!0});if(!s)return e;var r=yield s.arrayBuffer();return y({},e,{Vr:{contentType:uo,body:r,estimatedSize:r.byteLength}})}));return function(e){return i.apply(this,arguments)}})(),nu=/Failed to fetch|NetworkError|Load failed/i,vo=i=>{var e=po(i);if(e){var t=e.url,s=e.encodedBody,r=s??{},n=r.contentType,a=r.body,o=r.estimatedSize,l=new Headers;G(i.headers,(function(f,g){l.append(g,f)})),n&&l.append("Content-Type",n);var u=null,c=!1;if(Or){var h=new Or;u={signal:h.signal,timeout:setTimeout((()=>{var f,g;c=!0,h.abort((f=i.timeout,(g=new Error("PostHog request timed out"+(f?" after "+f+"ms":""))).name="AbortError",g))}),i.timeout)}}var d=f=>{c&&f?.name==="AbortError"||(g=>g?.name==="TypeError"&&nu.test(g?.message||""))(f)?E.warn(f):E.error(f),i.callback==null||i.callback({statusCode:0,error:f})};try{var p;vr(t,y({method:i?.method||"GET",headers:l,keepalive:i.method==="POST"&&!i.Wr&&52428.8>(o||0),body:a,signal:(p=u)==null?void 0:p.signal},i.fetchOptions)).then((f=>f.text().then((g=>{var m={statusCode:f.status,text:g};if(f.status===200)try{m.json=JSON.parse(g)}catch(b){E.error(b)}i.callback==null||i.callback(m)})))).catch(d).finally((()=>u?clearTimeout(u.timeout):null))}catch(f){u&&clearTimeout(u.timeout),d(f)}}},cr=i=>{try{var e,t=ho(i),s=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(me.sendBeacon(s,l))return;var u=R(i.data)?i.data:(e=i.data)==null?void 0:e.batch;if(R(u)&&u.length>1&&(o??0)>16384){var c=Math.ceil(u.length/2),h=d=>R(i.data)?d:y({},i.data,{batch:d});return cr(y({},i,{data:h(u.slice(0,c))})),void cr(y({},i,{data:h(u.slice(c))}))}E.warn("Beacon of ~"+(o??0)+" bytes was rejected by the browser, falling back to fetch"),vo(y({},i,{Wr:!0}))}catch(d){E.warn("Beacon send failed",d)}},wn=(i,e,t,s)=>{var r=s==="query"?e==="POST"?"sent_at":"_":void 0;return Yi(t===_e.GZipJS?co(i,"compression"):i,y({},r?{[r]:Date.now().toString()}:{},t===_e.GZipJS?{}:{compression:t}))},Si=[];vr&&Si.push({transport:"fetch",method:vo}),Is&&Si.push({transport:"XHR",method(i){var e=po(i);if(e){var t=new Is,s=e.encodedBody;t.open(i.method||"GET",e.url,!0);var r=s??{},n=r.contentType,a=r.body;G(i.headers,(function(o,l){t.setRequestHeader(l,o)})),n&&t.setRequestHeader("Content-Type",n),i.timeout&&(t.timeout=i.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{}i.callback==null||i.callback(o)}},t.send(a)}}}),me!=null&&me.sendBeacon&&Si.push({transport:"sendBeacon",method:cr});var hr=3e3;class au{constructor(e,t){this.Zr=!0,this.Gr=[],this.Qr=Le(t?.flush_interval_ms||hr,250,5e3,E.createLogger("flush interval"),hr),this.Jr=e}enqueue(e){this.Gr.push(e),this.Kr||this.Yr()}unload(){this.Xr();var e=this.Gr.length>0?this.ti():{},t=Object.values(e);[...t.filter((s=>s.url.indexOf("/e")===0)),...t.filter((s=>s.url.indexOf("/e")!==0))].map((s=>{this.ei(y({},s,{transport:"sendBeacon"}))}))}enable(){this.Zr=!1,this.Yr()}Yr(){var e=this;this.Zr||(this.Kr=setTimeout((()=>{if(this.Xr(),this.Gr.length>0){var t=this.ti(),s=function(){var n=t[r],a=new Date().getTime();n.data&&R(n.data)&&G(n.data,(o=>{o.offset=Math.abs(o.timestamp-a),delete o.timestamp})),e.ei(n)};for(var r in t)s()}}),this.Qr))}ei(e){try{this.Jr(e)}catch(t){E.error(t)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ti(){var e={};return G(this.Gr,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;x(e[n])&&(e[n]=y({},r,{data:[]})),(s=e[n].data)==null||s.push(r.data)})),this.Gr=[],e}}var ou=["retriesPerformedSoFar"];class lu{constructor(e){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=e,this.Gr=[],this.ni=!0,!x(v)&&"onLine"in v.navigator&&(this.ni=v.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},re(v,"online",this.si),re(v,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(e){var t=e.retriesPerformedSoFar,s=zn(e,ou);je(t)&&(s.url=Yi(s.url,{retry_count:t})),this._instance._send_request(y({},s,{callback:r=>{if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(t??0))return void this.Ot(y({retriesPerformedSoFar:t},s));r.statusCode===0&&E.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.")}s.callback==null||s.callback(r)}}))}Ot(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var s=(function(a){var o=3e3*Math.pow(2,a),l=o/2,u=Math.min(18e5,o),c=Math.random()-.5;return Math.ceil(u+c*(u-l))})(t),r=Date.now()+s;this.Gr.push({retryAt:r,requestOptions:e});var n="Enqueued failed request for retry in "+s;navigator.onLine||(n+=" (Browser is offline)"),E.warn(n),this.ri||(this.ri=!0,this.li())}li(){if(this.ui&&clearTimeout(this.ui),this.Gr.length===0)return this.ri=!1,void(this.ui=void 0);this.ui=setTimeout((()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li()}),this.ii)}oi(){var e=Date.now(),t=[],s=this.Gr.filter((n=>e>n.retryAt||(t.push(n),!1)));if(this.Gr=t,s.length>0)for(var r of s)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,x(v)||(this.si&&(v.removeEventListener("online",this.si),this.si=void 0),this.ai&&(v.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var t=e.requestOptions;try{this._instance._send_request(y({},t,{transport:"sendBeacon"}))}catch(s){E.error(s)}}this.Gr=[]}}class uu{constructor(e){this.hi=()=>{var t,s,r,n;this.di||(this.di={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,u=o+(a?.clientHeight||0),c=a?.scrollHeight||0;this.di.lastScrollY=Math.ceil(o),this.di.maxScrollY=Math.max(o,(t=this.di.maxScrollY)!==null&&t!==void 0?t:0),this.di.maxScrollHeight=Math.max(l,(s=this.di.maxScrollHeight)!==null&&s!==void 0?s:0),this.di.lastContentY=u,this.di.maxContentY=Math.max(u,(r=this.di.maxContentY)!==null&&r!==void 0?r:0),this.di.maxContentHeight=Math.max(c,(n=this.di.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}get ci(){return this._instance.config.scroll_root_selector}getContext(){return this.di}resetContext(){var e=this.di;return setTimeout(this.hi,0),e}startMeasuringScrollPosition(){re(v,"scroll",this.hi,{capture:!0}),re(v,"scrollend",this.hi,{capture:!0}),re(v,"resize",this.hi)}scrollElement(){if(!this.ci)return v?.document.documentElement;var e=R(this.ci)?this.ci:[this.ci];for(var t of e){var s=v?.document.querySelector(t);if(s)return s}}vi(e){var t=e==="y"?"scrollTop":"scrollLeft";if(this.ci){var s=this.scrollElement();return s&&s[t]||0}return v?e==="y"?v.scrollY||v.pageYOffset||v.document.documentElement.scrollTop||0:v.scrollX||v.pageXOffset||v.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}}var cu=i=>eo(i?.config.mask_personal_data_properties,i?.config.custom_personal_data_properties,i?.config.disable_capture_url_hashes);class xn{constructor(e,t,s,r){this.fi=n=>{var a=this.pi();if(!a||a.sessionId!==n){var o={sessionId:n,props:this.gi(this._instance)};this.mi.register({[Qs]:o})}},this._instance=e,this.yi=t,this.mi=s,this.gi=r||cu,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[Qs]}getSetOnceProps(){var e,t=(e=this.pi())==null?void 0:e.props;return t?"r"in t?to(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 G(kr(this.getSetOnceProps()),((t,s)=>{s==="$current_url"&&(s="url"),e["$session_entry_"+Cs(s)]=t})),e}}class Ir{on(e,t){return this.bi[e]||(this.bi[e]=[]),this.bi[e].push(t),()=>{this.bi[e]=this.bi[e].filter((s=>s!==t))}}emit(e,t){for(var s of this.bi[e]||[])s(t);for(var r of this.bi["*"]||[])r(e,t)}constructor(){this.bi={}}}var Dt=Q("[SessionId]");class En{on(e,t){return this.wi.on(e,t)}constructor(e,t,s){var r;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new Ir,this.Mi=(u,c)=>!(!je(u)||!je(c))&&Math.abs(u-c)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===ze)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Te=e.config,this.mi=e.persistence,this.Ii=void 0,this.Ti=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ei=t||He,this.Ri=s||He;var n=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*Le(this.Te.session_idle_timeout_seconds||1800,60,36e3,Dt.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+n+"_window_id",this.Fi="ph_"+n+"_primary_window_exists",this.Ai()){var a=he.F(this.Oi),o=he.F(this.Fi);a&&!o?this.Ii=a:he.D(this.Oi),he.A(this.Fi,!0)}if((r=this.Te.bootstrap)!=null&&r.sessionID)try{var l=(u=>{var c=this.Te.bootstrap.sessionID.replace(/-/g,"");if(c.length!==32)throw new Error("Not a valid UUID");if(c[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(c.substring(0,12),16)})();this.$i(this.Te.bootstrap.sessionID,new Date().getTime(),l)}catch(u){Dt.error("Invalid sessionID in bootstrap",u)}this.Li()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return x(this.ki)&&(this.ki=[]),this.ki.push(e),this.Ti&&e(this.Ti,this.Ii),()=>{this.ki=this.ki.filter((t=>t!==e))}}Ai(){return this.Te.persistence!=="memory"&&!this.mi.yr&&he.N()}Di(e){e!==this.Ii&&(this.Ii=e,this.Ai()&&he.A(this.Oi,e))}Ni(){return this.Ii?this.Ii:this.Ai()?he.F(this.Oi):null}qi(e){var t=this.xi;return!ye(t)&&!ye(e)&&5e3>Math.abs(e-t)}$i(e,t,s){var r=t!==this._sessionActivityTimestamp,n=!(e!==this.Ti||s!==this._sessionStartTimestamp);this._sessionStartTimestamp=s,this._sessionActivityTimestamp=t,this.Ti=e,n&&!r||n&&this.qi(t)||(this.xi=t,this.mi.register({[yt]:[t,e,s]}))}ji(){var e,t=(e=this.Te)==null?void 0:e.persistence_save_debounce_ms;return je(t)&&t>0}Bi(){this.ji()?this.mi.refreshKey(yt):(this.mi.flush(),this.mi.load())}Hi(){var e;if(!ye(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Bi();var t=this.Ui();t[1]===this.Ti&&t[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[yt]:[this._sessionActivityTimestamp,(e=this.Ti)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var e=this.Ui()[0],t=je(e)?e:0,s=je(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,s)}Vi(e){return this.Bi(),this.Mi(e,this.zi())}Ui(){var e=this.mi.props[yt];return R(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.xi=null,clearTimeout(this.Wi),this.Wi=void 0,this.$i(null,null,null)}destroy(){this.Ci=!0,this.Hi(),clearTimeout(this.Wi),this.Wi=void 0,this.Si&&v&&(v.removeEventListener(qi,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Li(){this.Si=()=>{this.Hi(),this.Ai()&&he.D(this.Fi)},re(v,qi,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.Te.cookieless_mode===ze)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=t||new Date().getTime(),r=this.Ui(),n=r[1],a=r[2],o=this.zi(),l=this.Ni(),u=je(a)&&Math.abs(s-a)>864e5,c=!1,h=!1,d=!n,p=n,f=!d&&!e&&this.Mi(s,o);if(f){(f=this.Vi(s))||Dt.info("cross-tab refresh kept the session alive",{sessionId:n});var g=this.Ui();n=g[1],a=g[2]}d||f||u?(n=this.Ei(),l=this.Ri(),Dt.info("new session ID generated",{sessionId:n,windowId:l,changeReason:{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:u}}),a=s,c=!0):(l||(l=this.Ri(),c=!0),(h=n!==p)&&(Dt.info("adopted cross-tab session id",{sessionId:n,windowId:l}),c=!0));var m=je(o)&&e&&!u?o:s,b=je(a)?a:new Date().getTime();this.Di(l),this.$i(n,m,b),e||this.Pi();var P={noSessionId:d,activityTimeout:f,sessionPastMaximumLength:u,crossTabAdoption:h};return c&&this.ki.forEach((_=>_(n,l,P))),{sessionId:n,windowId:l,sessionStartTimestamp:b,changeReason:c?P:void 0,lastActivityTimestamp:o}}Pi(){this.Ci||(clearTimeout(this.Wi),this.Wi=setTimeout((()=>{if(!this.Ci)if(this.Vi(new Date().getTime())){var e=this.Ti;this.resetSessionId(),this.wi.emit("forcedIdleReset",{idleSessionId:e})}else this.Pi()}),1.1*this.sessionTimeoutMs))}}var go=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&Hr(t,e))return!0;try{var s=i?.userAgentData;if(s!=null&&s.brands&&s.brands.some((r=>Hr(r?.brand,e))))return!0}catch{}return!!i.webdriver};function fo(){return(fo=Y((function*(){var i=me?.userAgentData;if(i!=null&&i.getHighEntropyValues)try{var e=yield i.getHighEntropyValues(["model"]),t=e?.model;return U(t)&&t.length>0?t:void 0}catch(s){return void E.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",s)}}))).apply(this,arguments)}var Wi=function(i,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(i)}catch{return!1}};function bs(i,e,t){return bt({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var _o={exact:(i,e)=>e.some((t=>i.some((s=>t===s)))),is_not:(i,e)=>e.every((t=>i.every((s=>t!==s)))),regex:(i,e)=>e.some((t=>i.some((s=>Wi(t,s))))),not_regex:(i,e)=>e.every((t=>i.every((s=>!Wi(t,s))))),icontains:(i,e)=>e.map(fi).some((t=>i.map(fi).some((s=>t.includes(s))))),not_icontains:(i,e)=>e.map(fi).every((t=>i.map(fi).every((s=>!t.includes(s))))),gt:(i,e)=>e.some((t=>{var s=parseFloat(t);return!isNaN(s)&&i.some((r=>s>parseFloat(r)))})),lt:(i,e)=>e.some((t=>{var s=parseFloat(t);return!isNaN(s)&&i.some((r=>s<parseFloat(r)))}))},fi=i=>i.toLowerCase();function mo(i,e){return!i||Object.entries(i).every((t=>{var s=t[1],r=e?.[t[0]];if(x(r)||ye(r))return!1;var n=[String(r)],a=_o[s.operator];return!!a&&a(s.values,n)}))}var dr="custom",kn="i.posthog.com",hu=/^\/static\//;class du{constructor(e){this.Zi={},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("."+kn,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Zi[this.apiHost]||(this.Zi[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":dr),this.Zi[this.apiHost]}Gi(e){if(hu.test(e)){var t=this.instance.config.asset_host;if(typeof t=="string")return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(e==="assets"){var s=this.Gi(t);if(s)return""+s+t}if(this.region===dr)return this.apiHost+t;var r=kn+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}function yo(i){var e;return!((e=i.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var H=Q("[Surveys]"),bo="seenSurvey_",wo=i=>{try{var e=(t=>((s,r)=>""+bo+(function(n){return n.current_iteration&&n.current_iteration>0?n.id+"_"+n.current_iteration:n.id})(r))(0,t))(i);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){H.error("Failed to persist survey seen state",t)}},pu=[gs.Popover,gs.Widget,gs.API],vu={ignoreConditions:!1,ignoreDelay:!1,displayType:ar.Popover},gu=Q("[PostHog ExternalIntegrations]"),fu={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class _u{constructor(e){this._instance=e}tr(e,t){var s;(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,e,(r=>{if(r)return gu.error("failed to load script",r);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var n,a,o,l=s[0],u=s[1];!u||(n=$.__PosthogExtensions__)!=null&&(n=n.integrations)!=null&&n[l]||e.tr(fu[l],(()=>{var c;(c=$.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[l])==null||c.start(e._instance)})),!u&&(a=$.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[l]&&((o=$.__PosthogExtensions__)==null||(o=o.integrations)==null||(o=o[l])==null||o.stop())};for(var s of Object.entries((r=this._instance.config.integrations)!==null&&r!==void 0?r:{})){var r;t()}}}class mu{constructor(e,t){this.it=e,this.Qi=t,this.Ji=new Map,this.Ki=!1}add(e){var t=this;return Y((function*(){if(t.Ki)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.Ji.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');t.Ji.set(e.name,e);try{var s=e.setup(t.Qi);s&&(yield s)}catch(n){var r=t.Ji.get(e.name)===e;r&&t.Ji.delete(e.name),t.it.error('Failed to set up browser extension "'+e.name+'"',n),r&&t.Yi(e)}}))()}dispose(){if(!this.Ki){this.Ki=!0;var e=Array.from(this.Ji.values()).reverse();for(var t of(this.Ji.clear(),e))this.Yi(t)}}Yi(e){try{var t=e.dispose==null?void 0:e.dispose();t&&Ee(t.then)&&t.then(void 0,(s=>{this.it.error('Failed to dispose browser extension "'+e.name+'"',s)}))}catch(s){this.it.error('Failed to dispose browser extension "'+e.name+'"',s)}}}class yu{constructor(e){this._instance=e}get(e){var t;return(t=this._instance.persistence)==null?void 0:t.get_property(e)}set(e,t){var s;(s=this._instance.persistence)==null||s.set_property(e,t)}remove(e){var t;(t=this._instance.persistence)==null||t.unregister(e)}}var Sn="extensionsRemoteConfig";class bu{constructor(e){this.Ki=!1,this.instance=e,this.it=E.createLogger("[BrowserExtensions]"),this.Xi=e.tn,this.kv=new yu(e),this.onEvent=t=>gi(this.instance.on("eventCaptured",(s=>{try{t({event:s.event,properties:s.properties})}catch(r){this.it.error("Browser extension event listener failed",r)}}))),this.onRemoteConfig=t=>{if(this.Ki)return gi((()=>{}));var s=n=>{try{t(n)}catch(a){this.it.error("Browser extension remote config listener failed",a)}},r=this.instance.en.on(Sn,s);return this.Xi&&s(this.Xi),gi(r)},this.rn=new mu(this.it,this)}get logger(){return this.it}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property(ei))!==null&&e!==void 0?e:this.distinctId}get groups(){return this.instance.getGroups()}get session(){try{var e,t,s,r,n=(e=this.instance.sessionManager)==null?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=n?.sessionId)!==null&&t!==void 0?t:"",windowId:(s=n?.windowId)!==null&&s!==void 0?s:"",sessionStartTimestamp:(r=n?.sessionStartTimestamp)!==null&&r!==void 0?r:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(e){return this.rn.add(e)}capture(e,t,s){var r=this;return Y((function*(){s?r.instance.capture(e,t,{timestamp:s.timestamp,uuid:s.uuid,$set:s.set,$set_once:s.setOnce}):r.instance.capture(e,t)}))()}registerDynamicEventProperties(e){return gi(this.instance.nn(e))}handleRemoteConfig(e){this.Ki||(this.Xi=e,this.instance.en.emit(Sn,e))}sendRequest(e,t){var s=this;return Y((function*(){var r;t===void 0&&(t={});var n=s.instance.requestRouter.endpointFor((r=t.target)!==null&&r!==void 0?r:"api",e),a={method:t.method,url:t.query?Yi(n,t.query):n,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport};return t.transport==="sendBeacon"?(s.instance._send_request(a),{statusCode:202}):new Promise((o=>{a.callback=o,s.instance._send_request(a)}))}))()}dispose(){this.Ki||(this.Ki=!0,this.rn.dispose())}}var Yt={},ws=0,Ji=()=>{},Pn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Nt="Surveys module not available",Tn="sanitize_properties is deprecated. Use before_send instead",xo="Invalid value for property_denylist config: ",wu=["token","distinct_id",Fa],mt="posthog",Eo=!su&&we?.indexOf("MSIE")===-1&&we?.indexOf("Mozilla")===-1,xs=i=>{var e;return y({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:xl(S?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ji,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:i??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:oe&&U(oe?.search)&&oe.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:!1,enable_recording_console_log:void 0,secure_cookie:(v==null||(e=v.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){E.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:sr,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:hr},error_tracking:{},_onCapture:Ji},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Ol,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:t&&t>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,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)}))(i))},xu=[["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"]],Fn=i=>{var e={};for(var t of xu){var s=t[0],r=t[1];x(i[s])||(e[r]=i[s])}var n=W({},e,i),a=i.__preview_external_dependency_versioned_paths;return x(a)||(x(i.strict_script_versioning)&&(n.strict_script_versioning=!!a),U(a)&&x(i.asset_host)&&(n.asset_host=a)),R(i.property_blacklist)&&(x(i.property_denylist)?n.property_denylist=i.property_blacklist:R(i.property_denylist)?n.property_denylist=[...i.property_blacklist,...i.property_denylist]:E.error(xo+i.property_denylist)),n};class Eu{constructor(){this.__forceAllowLocalhost=!1}get sn(){return this.__forceAllowLocalhost}set sn(e){E.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class $e{an(e,t){if(e){var s=this.Ji.indexOf(e);s!==-1&&this.Ji.splice(s,1)}return this.Ji.push(t),t.initialize==null||t.initialize(),t}ln(){return this.config.cookieless_mode===ze||this.config.cookieless_mode===ot&&this.consent.isRejected()}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 Eu,this.un=!1,this.version=B.LIB_VERSION,this.en=new Ir,this.Ji=[],this.hn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=xs(),this.SentryIntegration=Hl,this.sentryIntegration=s=>(function(r,n){var a=Wa(r,n);return{name:Va,processEvent:o=>a(o)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.dn=!1,this.cn=null,this.vn=null,this.fn=null,this.scrollManager=new uu(this),this.pageViewManager=new pn(this),this.rateLimiter=new Yl(this),this.requestRouter=new du(this),this.consent=new $l(this),this.externalIntegrations=new _u(this);var t=(e=$e.__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:(s,r,n)=>{var a=U(s)?{[s]:r}:s;this.setPersonProperties(a),n?.({})},set_once:(s,r,n)=>{var a=U(s)?{[s]:r}:s;this.setPersonProperties(void 0,a),n?.({})}},this.on("eventCaptured",(s=>E.info('send "'+s?.event+'"',s)))}init(e,t,s){if(s&&s!==mt){var r,n=(r=Yt[s])!==null&&r!==void 0?r:new $e;return n._init(e,t,s),Yt[s]=n,Yt[mt][s]=n,n}return this._init(e,t,s)}_init(e,t,s){var r,n;t===void 0&&(t={});var a=U(e)?e.trim():"";if(!a)return E.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=xs(t.defaults),t.debug=this.pn(t.debug),this.gn=t,this.mn=[],t.person_profiles?this.vn=t.person_profiles:t.process_person&&(this.vn=t.process_person);var o=xs(t.defaults),l=Fn(t),u=W({},o,l,{name:s,token:a});K(o.rageclick)&&K(l.rageclick)&&(u.rageclick=W({},o.rageclick,l.rageclick)),K(o.session_recording)&&K(l.session_recording)&&(u.session_recording=W({},o.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&E.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:_e.GZipJS;var c=this.yn();this.persistence=new vs(this.config,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new vs(y({},this.config,{persistence:"sessionStorage"}),c,!1);var h=y({},this.persistence.props),d=y({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.bn=new au((k=>this._n(k)),this.config.request_queue_config),this.wn=new lu(this),this.__request_queue=[];var p=this.ln();if(p||(this.sessionManager=new En(this),this.sessionPropsManager=new xn(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(E.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.xn(p)}),0)):(E.info("Initializing extensions synchronously"),this.xn(p)),B.DEBUG=B.DEBUG||this.config.debug,B.DEBUG&&E.info("Starting in debug mode",{this:this,config:t,thisC:y({},this.config),p:h,s:d}),!this.config.identity_distinct_id||(r=t.bootstrap)!=null&&r.distinctID||(t.bootstrap=y({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((n=t.bootstrap)==null?void 0:n.distinctID)!==void 0){var f=t.bootstrap.distinctID,g=this.get_distinct_id(),m=this.persistence.get_property(Fe);if(t.bootstrap.isIdentifiedID&&g!=null&&g!==f&&m===dt)this.identify(f);else if(t.bootstrap.isIdentifiedID&&g!=null&&g!==f&&m===Ze)E.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var b=this.config.get_device_id(He()),P=t.bootstrap.isIdentifiedID?b:f;this.persistence.set_property(Fe,t.bootstrap.isIdentifiedID?Ze:dt),this.register({distinct_id:f,$device_id:P})}}if(p)this.register_once({distinct_id:ci,$device_id:null},"");else if(!this.get_distinct_id()){var _=this.config.get_device_id(He());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(Fe,dt)}return re(v,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?(function(k,F){var D=k.config.segment;if(!D)return F();(function(O,w){var T=O.config.segment;if(!T)return w();var I=L=>{var j=()=>L.anonymousId()||He();O.config.get_device_id=j,L.id()&&(O.register({distinct_id:L.id(),$device_id:j()}),O.persistence.set_property(Fe,Ze)),w()},A=T.user();"then"in A&&Ee(A.then)?A.then(I):I(A)})(k,(()=>{D.register((O=>{typeof Promise<"u"&&Promise.resolve||ds.warn("This browser does not have Promise support, and can not use the segment integration");var w=(T,I)=>{if(!I)return T;T.event.userId||T.event.anonymousId===O.get_distinct_id()||(ds.info("No userId set, resetting PostHog"),O.reset()),T.event.userId&&T.event.userId!==O.get_distinct_id()&&(ds.info("UserId set, identifying with PostHog"),O.identify(T.event.userId));var A=O.calculateEventProperties(I,T.event.properties);return T.event.properties=Object.assign({},A,T.event.properties),T};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:T=>w(T,T.event.event),page:T=>w(T,_t),identify:T=>w(T,us),screen:T=>w(T,"$screen")}})(k)).then((()=>{F()}))}))})(this,(()=>this.kn())):this.kn(),Ee(this.config._onCapture)&&this.config._onCapture!==Ji&&(E.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&E.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 fo.apply(this,arguments)})().then((k=>{k&&this.register({[os]:k})})).catch(Ji),this}xn(e){var t,s,r,n,a,o,l,u,c=performance.now(),h=y({},$e.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.Ji.push(this.featureFlags=(t=this.featureFlags)!==null&&t!==void 0?t:new h.featureFlags(this)),h.exceptions&&this.Ji.push(this.exceptions=(s=this.exceptions)!==null&&s!==void 0?s:new h.exceptions(this)),h.historyAutocapture&&this.Ji.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Ji.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.Ji.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!e&&this.Ji.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.Ji.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.Ji.push(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new h.surveys(this)),h.logs&&this.Ji.push(this.logs=(n=this.logs)!==null&&n!==void 0?n:new h.logs(this)),h.metrics&&this.Ji.push(this.metrics=(a=this.metrics)!==null&&a!==void 0?a:new h.metrics(this)),h.conversations&&this.Ji.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new h.conversations(this)),h.productTours&&this.Ji.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Ji.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Ji.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Ji.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Ji.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,Bl)),h.toolbar&&this.Ji.push(this.toolbar=(l=this.toolbar)!==null&&l!==void 0?l:new h.toolbar(this)),h.experiments&&this.Ji.push(this.experiments=(u=this.experiments)!==null&&u!==void 0?u:new h.experiments(this)),this.Ji.forEach((p=>{p.initialize&&d.push((()=>{p.initialize==null||p.initialize()}))})),d.push((()=>{if(this.Sn){var p=this.Sn;this.Sn=void 0,this.Ji.forEach((f=>f.onRemoteConfig==null?void 0:f.onRemoteConfig(p)))}})),this.Cn(d,c)}Cn(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.Cn(e,t)}),0);var s=e.shift();if(s)try{s()}catch(n){E.error("Error initializing extension:",n)}}var r=Math.round(performance.now()-t);this.register_for_session({[$a]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ia]:r}),this.config.__preview_deferred_init_extensions&&E.info("PostHog extensions initialized ("+r+"ms)")}Br(e){var t;if(!S||!S.body)return E.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Br(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this.Sn=e),this.tn=e,this.compression=void 0,e.ok){var s,r=e.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=M(r.supportedCompression,_e.GZipJS)?_e.GZipJS:M(r.supportedCompression,_e.Base64)?_e.Base64:void 0),(s=r.analytics)!=null&&s.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.vn?this.vn:sr}),(t=this.Mn)==null||t.handleRemoteConfig(e),this.Ji.forEach((n=>n.onRemoteConfig==null?void 0:n.onRemoteConfig(e)))}kn(){try{this.config.loaded(this)}catch(s){E.critical("`loaded` function failed",s)}if(this.In(),this.config.internal_or_test_user_hostname&&oe!=null&&oe.hostname){var e=oe.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.ln())&&this.Tn()}),1),this.En=new so(this),this.En.load()}In(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.bn)==null||e.enable())}_dom_loaded(){this.is_capturing()&&hi(this.__request_queue,(e=>this._n(e))),this.__request_queue=[],this.In()}_handle_unload(){var e,t,s,r,n;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(t=this.metrics)==null||t.flush("sendBeacon"),this.config.request_batching?(this.Rn()&&this.capture(ls),(s=this.logs)==null||s.flushLogs("sendBeacon"),(r=this.bn)==null||r.unload(),(n=this.wn)==null||n.unload()):this.Rn()&&this.capture(ls,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?Eo?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=y({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(x(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var s,r,n,a=y({},t);a.timeout=a.timeout||6e4;var o,l,u,c,h,d=(s=a.transport)!==null&&s!==void 0?s:"fetch";d==="sendBeacon"&&x(a.compression)&&a.data&&(a.compression=_e.Base64),a.method==="POST"&&a.data&&(a.timestampMode==="capture-body"?a.data={api_key:(l=(h=(c=R(o=a.data)?o:[o])[0])==null||(u=h.properties)==null?void 0:u.token)!==null&&l!==void 0?l:h?.token,batch:c,sent_at:new Date().toISOString()}:a.timestampMode==="body"&&(a.data=(function(g,m){return m===void 0&&(m=new Date().toISOString()),R(g)?g.map((b=>y({},b,{sent_at:m}))):y({},g,{sent_at:m})})(a.data))),a.url=wn(a.url,a.method,a.compression,a.timestampMode);var p=Si.filter((g=>!a.disableTransport||!g.transport||!a.disableTransport.includes(g.transport))),f=(r=(n=(function(g,m){for(var b=0;g.length>b;b++)if(g[b].transport===d)return g[b]})(p))==null?void 0:n.method)!==null&&r!==void 0?r:p[0].method;if(!f)throw new Error("No available transport method");d!=="sendBeacon"&&a.data&&a.compression===_e.GZipJS&&ko&&typeof Promise<"u"&&!ki?ru(a).then((g=>{f(g)})).catch((g=>{if(Br(g))return ki=!0,void f(y({},a,{compression:void 0,url:wn(t.url,t.method,void 0,t.timestampMode)}));(m=>{if(!m||typeof m!="object")return!1;var b="name"in m?String(m.name):"";return Br(m)||b===Un})(g)&&(ki=!0),f(a)})):f(a)})(y({},e,{callback:t=>{var s,r;this.rateLimiter.checkForLimiting(t),400>t.statusCode||(s=(r=this.config).on_request_error)==null||s.call(r,t),e.callback==null||e.callback(t)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}_n(e){this.wn?this.wn.retriableRequest(e):this._send_request(e)}_execute_array(e){ws++;try{var t,s=[],r=[],n=[];hi(e,(o=>{if(o)if(R(t=o[0]))n.push(o);else if(Ee(o))try{o.call(this)}catch(l){E.error("Error executing queued PostHog call",o,l)}else R(o)&&t==="alias"?s.push(o):R(o)&&t.indexOf("capture")!==-1&&Ee(this[t])?n.push(o):r.push(o)}));var a=function(o,l){hi(o,(function(u){try{if(R(u[0])){var c=l;G(u,(function(h){c=c[h[0]].apply(c,h.slice(1))}))}else l[u[0]].apply(l,u.slice(1))}catch(h){E.error("Error executing queued PostHog call",u,h)}}))};a(s,this),a(r,this),a(n,this)}finally{ws--}}push(e){if(ws>0&&R(e)&&U(e[0])){var t=$e.prototype[e[0]];Ee(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,a,o,l,u,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.bn){if(this.is_capturing())if(!x(e)&&U(e)){var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var d=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(d==null||!d.isRateLimited){if(this.hn.length>0){var p={};for(var f of this.hn.slice())try{W(p,f())}catch(te){E.error("Failed to produce browser extension event properties",te)}t=y({},p,t??{})}var g;(r=t)!=null&&r.$current_url&&!U((n=t)==null?void 0:n.$current_url)&&(E.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),(g=t)==null||delete g.$current_url),e!=="$exception"||s!=null&&s.Pn||E.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 m=new Date,b=s?.timestamp||m,P=Vr(s?.uuid,He),_={uuid:P,event:e,properties:this.calculateEventProperties(e,t||{},b,P)};e===_t&&this.config.__preview_capture_bot_pageviews&&h&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),d&&(_.properties.$lib_rate_limit_remaining_tokens=d.remainingTokens);var k=e==="$feature_flag_called"&&_.properties.$feature_flag_has_experiment===!1&&this.get_property(Ai)===!0;s?.$set&&!k&&(_.$set=s?.$set);var F=s?.$unset;F&&(_.$unset=F);var D,O,w,T=k?void 0:this.On(s?.$set_once,e!==Yr,e===us);if(T&&(_.$set_once=T),s!=null&&s._noTruncate||(o=this.config.properties_string_max_length,l=_,u=te=>U(te)?te.slice(0,o):te,c=new Set,_=(function te(z,ce){if(z!==Object(z))return u?u(z):z;if(!c.has(z)){var N;if(c.add(z),R(z))N=[],hi(z,(ie=>{N.push(te(ie))}));else{var J={};G(z,((ie,le)=>{c.has(ie)||(J[le]=te(ie))})),N=J}return N}})(l)),_.timestamp=b,x(s?.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=m),k&&(_.properties=(function(te,z){z===void 0&&(z=[]);var ce={},N=J=>{te[J]!==void 0&&(ce[J]=te[J])};return So.forEach(N),z.forEach(N),ce})(_.properties,wu)),e===Ge.DISMISSED||e===Ge.SENT){var I,A,L=(I=t)==null?void 0:I[fs.SURVEY_ID],j=(A=t)==null?void 0:A[fs.SURVEY_ITERATION];wo({id:L,current_iteration:j}),_.$set=y({},_.$set,{[(D={id:L,current_iteration:j},O=e===Ge.SENT?"responded":"dismissed",w="$survey_"+O+"/"+D.id,D.current_iteration&&D.current_iteration>0&&(w="$survey_"+O+"/"+D.id+"/"+D.current_iteration),w)]:!0})}else e===Ge.SHOWN&&(_.$set=y({},_.$set,{[fs.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===Kl.SHOWN){var ne,ae=(ne=t)==null?void 0:ne[gn.TOUR_TYPE];ae&&(_.$set=y({},_.$set,{[gn.TOUR_LAST_SEEN_DATE+"/"+ae]:new Date().toISOString()}))}var q=y({},_.properties.$set,_.$set);if(Xe(q)||this.setPersonPropertiesForFlags(q),!C(this.config.before_send)){var ee=this.Rt(_);if(!ee)return;(_=ee).uuid=Vr(_.uuid,He)}this.en.emit("eventCaptured",_);var X=(a=s?._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),pe={method:"POST",url:X,data:_,compression:"best-available",timestampMode:s?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(X)?"body":"capture-body",batchKey:s?._batchKey,transport:s?.transport};return!this.config.request_batching||s&&(s==null||!s._batchKey)||s!=null&&s.send_instantly?this._n(pe):this.bn.enqueue(pe),_}E.critical("This capture call is ignored due to client rate limiting.")}}else E.error("No event name provided to posthog.capture")}else E.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}Fn(){var e;return(e=this.Mn)!==null&&e!==void 0?e:this.Mn=new bu(this)}nn(e){this.hn.push(e);var t=!0;return()=>{if(t){t=!1;var s=this.hn.indexOf(e);s!==-1&&this.hn.splice(s,1)}}}calculateEventProperties(e,t,s,r,n){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;var a=n?void 0:this.persistence.remove_event_timer(e),o=y({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.ln()&&(o[Fa]=!0),e==="$snapshot"){var l=y({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!U(o.distinct_id)&&!de(o.distinct_id)||Os(o.distinct_id))&&E.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u,c=(function(_,k,F,D){var O,w,T,I;if(D===void 0&&(D=!1),!we)return{};var A,L=_?[...Tt,...k||[]]:[],j=(function(ni){for(var $t=0;Ur.length>$t;$t++){var ai=Ur[$t],Pe=ai[1],oi=ai[0].exec(ni),It=oi&&(Ee(Pe)?Pe(oi,ni):Pe);if(It)return It}return["",""]})(we),ne=j[0],ae=j[1],q=(A=typeof navigator<"u"?navigator:void 0)!=null&&A.brave?{brave:!0}:{},ee={};x(F)||(ee.detectGoogleSearchApp=F);var X={},pe=(O=navigator)==null||(O=O.userAgentData)==null?void 0:O.platform,te=(w=navigator)==null?void 0:w.maxTouchPoints,z=v==null||(T=v.screen)==null?void 0:T.width,ce=v==null||(I=v.screen)==null?void 0:I.height,N=v?.devicePixelRatio;x(pe)||(X.userAgentDataPlatform=pe),x(te)||(X.maxTouchPoints=te),x(z)||(X.screenWidth=z),x(ce)||(X.screenHeight=ce),x(N)||(X.devicePixelRatio=N);var J,ie,le,We,fe,Me,Je,be,Re=W(kr({$os:ne,$os_version:ae,$browser:va(we,navigator.vendor,q,ee),$device:Gr(we),$device_type:(ie=we,le=X,be=Gr(ie),be===Kn||be===Xn||be==="Kobo"||be==="Kindle Fire"||be===ua?Et:be===Zt||be===xt||be===Qt||be===Ls?"Console":be===Zn?"Wearable":be?Se:le?.userAgentDataPlatform==="Android"&&((We=le?.maxTouchPoints)!==null&&We!==void 0?We:0)>0?600>Math.min((fe=le?.screenWidth)!==null&&fe!==void 0?fe:0,(Me=le?.screenHeight)!==null&&Me!==void 0?Me:0)/((Je=le?.devicePixelRatio)!==null&&Je!==void 0?Je:1)?Se:Et:"Desktop"),$timezone:io(),$timezone_offset:Wl()}),{$current_url:si(D?Ke(oe?.href):oe?.href,L,ri),$host:oe?.host,$pathname:oe?.pathname,$raw_user_agent:we.length>1e3?we.substring(0,997)+"...":we,$browser_version:Uo(we,navigator.vendor,q,ee),$browser_language:vn(),$browser_language_prefix:(J=vn(),typeof J=="string"?J.split("-")[0]:void 0),$screen_height:v?.screen.height,$screen_width:v?.screen.width,$viewport_height:v?.innerHeight,$viewport_width:v?.innerWidth,$lib:B.LIB_NAME,$lib_version:B.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return B.SDK_DIST_CHANNEL&&(Re.$sdk_dist_channel=B.SDK_DIST_CHANNEL),Re})(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 h=this.sessionManager.checkAndGetSessionAndWindowId(n,s.getTime()),d=h.windowId;o.$session_id=h.sessionId,o.$window_id=d}this.sessionPropsManager&&W(o,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&W(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(p=this.wn)==null?void 0:p.length}catch(_){o.$sdk_debug_error_capturing_properties=String(_)}if(this.requestRouter.region===dr&&(o.$lib_custom_api_host=this.config.api_host),u=e!==_t||n?e!==ls||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),o=W(o,u),e===_t&&S&&(o.title=S.title),!x(a)){var f=s.getTime()-a;o.$duration=parseFloat((f/1e3).toFixed(3))}we&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser");var g=this.persistence.properties(),m=this.sessionPersistence.properties();G(["$referrer","$referring_domain"],(_=>{_ in g&&delete m[_]})),(o=W({},c,g,m,o)).$is_identified=this._isIdentified(),R(this.config.property_denylist)?G(this.config.property_denylist,(function(_){delete o[_]})):E.error(xo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(E.error(Tn),o=b(o,e));var P=this.An();return o.$process_person_profile=P,P&&!n&&this.$n("_calculate_event_properties"),o}On(e,t,s){var r;if(t===void 0&&(t=!0),s===void 0&&(s=!1),!this.persistence||!this.An()||this.un&&!s)return e;var n=this.persistence.get_initial_props(),a=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),o=W({},n,a||{},e||{}),l=this.config.sanitize_properties;return l&&(E.error(Tn),o=l(o,"$set_once")),t&&(this.un=!0),Xe(o)?void 0:o}register(e,t){var s;(s=this.persistence)==null||s.register(e,t)}register_once(e,t,s){var r;(r=this.persistence)==null||r.register_once(e,t,s)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}Ln(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return(t=this.featureFlags)==null?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var s;return(s=this.featureFlags)==null?void 0:s.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 s,r;return(s=(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,t))!==null&&s!==void 0?s:t?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,s){var r;(r=this.featureFlags)==null||r.updateFlags(e,t,s)}updateEarlyAccessFeatureEnrollment(e,t,s){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,t,s)}getEarlyAccessFeatures(e,t,s){var r;return t===void 0&&(t=!1),(r=this.featureFlags)==null?void 0:r.getEarlyAccessFeatures(e,t,s)}on(e,t){return this.en.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:Nt}),()=>{})}onSessionId(e){var t,s;return(t=(s=this.sessionManager)==null?void 0:s.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:Nt})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Nt})}renderSurvey(e,t){var s;(s=this.surveys)==null||s.renderSurvey(e,t)}displaySurvey(e,t){var s;t===void 0&&(t=vu),(s=this.surveys)==null||s.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,s;return(t=(s=this.surveys)==null?void 0:s.canRenderSurvey(e))!==null&&t!==void 0?t:{visible:!1,disabledReason:Nt}}canRenderSurveyAsync(e,t){var s,r;return t===void 0&&(t=!1),(s=(r=this.surveys)==null?void 0:r.canRenderSurveyAsync(e,t))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:Nt})}Dn(e){return!e||Os(e)?(E.critical("Unique user id has not been set in posthog.identify"),!1):e===ci?(E.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())||(E.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,s){if(!this.__loaded||!this.persistence)return E.uninitializedWarning("posthog.identify");if(de(e)&&(e=e.toString(),E.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Dn(e)&&this.$n("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(ei)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(Ht)&&(this.unregister(Ht),this.register({distinct_id:e}));var n,a=(this.persistence.get_property(Fe)||dt)===dt,o=e!==r,l=!o&&a;if(o&&a)this.persistence.set_property(Fe,Ze),this.setPersonPropertiesForFlags({$set:t||{},$set_once:s||{}},!1),this.capture(us,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:s||{}}),this.fn=bs(e,t,s),(n=this.featureFlags)==null||n.setAnonymousDistinctId(r);else if(l){this.persistence.set_property(Fe,Ze);var u=t||{},c=s||{};this.setPersonPropertiesForFlags({$set:u,$set_once:c},!1),this.capture("$set",{$set:u,$set_once:c}),this.fn=bs(e,t,s)}else(t||s)&&this.setPersonProperties(t,s);o?(this.reloadFeatureFlags(),this.unregister(Jt)):l&&(t||s)&&this.reloadFeatureFlags()}}setPersonProperties(e,t){if((e||t)&&this.$n("posthog.setPersonProperties")){var s=bs(this.get_distinct_id(),e,t);this.fn!==s?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.fn=s):E.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,s=(R(e)?e:[e]).filter((r=>U(r)&&r.length>0));s.length!==0&&this.$n("posthog.unsetPersonProperties")&&((t=this.featureFlags)==null||t.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this.fn=null)}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:y({},r,{[e]:t})}),n||s){var a={$group_type:e,$group_key:t};s&&(a.$group_set=s),this.capture(Yr,a)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else E.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var s;t===void 0&&(t=!0),(s=this.featureFlags)==null||s.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;e===void 0&&(e=!0),(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var s;t===void 0&&(t=!0),this.$n("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)==null||s.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){var t,s,r,n,a,o,l,u,c,h;if(E.info("reset"),!this.__loaded)return E.uninitializedWarning("posthog.reset");var d,p=this.get_property(ei),f=this.get_property(os),g=this.get_property(ut);if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(s=this.sessionPersistence)==null||s.clear(),x(g)||(d=this.persistence)==null||d.register({[ut]:g}),(r=this.surveys)==null||r.reset(),(n=this.En)==null||n.stop(),(a=this.featureFlags)==null||a.reset(),(o=this.conversations)==null||o.reset(),(l=this.logs)==null||l.reset(),(u=this.metrics)==null||u.reset(),(c=this.persistence)==null||c.set_property(Fe,dt),(h=this.sessionManager)==null||h.resetSessionId(),this.fn=null,this.config.cookieless_mode===ze)this.register_once({distinct_id:ci,$device_id:null},"");else{var m=this.config.get_device_id(He());this.register_once({distinct_id:m,$device_id:e?m:p},""),e||x(f)||this.register({[os]:f})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var t=this;return Y((function*(){var s,r,n,a,o,l,u;t.__loaded?((s=t.En)==null||s.stop(),(r=t.Mn)==null||r.dispose(),(n=t.logs)==null||n.flushLogs("sendBeacon"),(a=t.metrics)==null||a.flush("sendBeacon"),(o=t.bn)==null||o.unload(),(l=t.wn)==null||l.unload(),(u=t.featureFlags)==null||u.destroy()):E.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,t){var s;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(s=this.conversations)==null||s.Nn()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.qn()}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),s=t.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(e!=null&&e.withTimestamp&&s){var n,a=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!s)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-s)/1e3)-a,0)}return r}alias(e,t){return e===this.get_property(xa)?(E.critical("Attempting to create alias for existing People user - aborting."),-2):this.$n("posthog.alias")?(x(t)&&(t=this.get_distinct_id()),e!==t?(this.Ln(Ht,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(E.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=y({},this.config);if(K(e)){var s,r,n,a,o,l,u,c,h,d,p;W(this.config,Fn(e));var f=this.yn();(s=this.persistence)==null||s.update_config(this.config,t,f),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new vs(y({},this.config,{persistence:"sessionStorage"}),f,!1);var g=this.pn(this.config.debug);Ce(g)&&(this.config.debug=g),Ce(this.config.debug)&&(this.config.debug?(B.DEBUG=!0,V.N()&&V.A("ph_debug",!0),E.info("set_config",{config:e,oldConfig:t,newConfig:y({},this.config)})):(B.DEBUG=!1,V.N()&&V.D("ph_debug"))),(r=this.exceptionObserver)==null||r.onConfigChange(),(n=this.exceptions)==null||n.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(o=this.tracingHeaders)==null||o.startIfEnabledOrStop(),(l=this.autocapture)==null||l.startIfEnabled(),(u=this.heatmaps)==null||u.startIfEnabled(),(c=this.exceptionObserver)==null||c.startIfEnabledOrStop(),(h=this.deadClicksAutocapture)==null||h.startIfEnabledOrStop(),(d=this.surveys)==null||d.loadIfEnabled(),this.jn(),(p=this.externalIntegrations)==null||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){B.LIB_NAME=e,B.LIB_VERSION=t}startSessionRecording(e){var t,s,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&&((s=this.sessionRecording)==null||s.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 s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(y({},r,t))}}addExceptionStep(e,t){var s;(s=this.exceptions)==null||s.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:$e.Bn}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,s;return(t=(s=this.toolbar)==null?void 0:s.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:mt;return t!==mt&&(t=mt+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(Fe))===Ze||((t=this.sessionPersistence)==null?void 0:t.get_property(Fe))===Ze}An(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles===sr&&!this._isIdentified()&&Xe(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Ht])&&((t=this.persistence)==null||(t=t.props)==null||!t[Ni]))}Rn(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.An()||this.$n("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.$n("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}$n(e){return this.config.person_profiles==="never"?(E.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ln(Ni,!0),!0)}yn(){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!==ot)}jn(){var e,t,s,r,n=this.yn();return((e=this.persistence)==null?void 0:e.yr)!==n&&((s=this.persistence)==null||s.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.yr)!==n&&((r=this.sessionPersistence)==null||r.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==ze){if(this.ln()){var s,r,n,a,o;this.reset(!0),(s=this.sessionManager)==null||s.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=new En(this),this.pageViewManager=new pn(this),this.persistence&&(this.sessionPropsManager=new xn(this,this.sessionManager,this.persistence));var l,u=(n=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&n!==void 0?n:(o=$e.__defaultExtensionClasses)==null?void 0:o.sessionRecording;u&&(this.sessionRecording=this.an(this.sessionRecording,new u(this)),this.tn&&((l=this.sessionRecording)==null||l.onRemoteConfig==null||l.onRemoteConfig(this.tn)))}var c,h;this.consent.optInOut(!0),this.jn(),this.In(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==ot&&((c=this.surveys)==null||c.loadIfEnabled()),(x(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((h=e?.captureEventName)!==null&&h!==void 0?h:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Tn()}else E.warn(Pn)}opt_out_capturing(){var e,t,s;this.config.cookieless_mode!==ze?(this.config.cookieless_mode===ot&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.jn(),this.config.cookieless_mode===ot&&(this.register({distinct_id:ci,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Tn(),this.In())):E.warn(Pn)}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===ze||(this.config.cookieless_mode===ot?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.jn()}_is_bot(){return me?go(me,this.config.custom_blocked_useragents):void 0}Tn(){S&&(S.visibilityState==="visible"?this.dn||(this.dn=!0,this.capture(_t,{title:S.title},{send_instantly:!0}),this.cn&&(S.removeEventListener(ji,this.cn),this.cn=null)):this.cn||(this.cn=this.Tn.bind(this),re(S,ji,this.cn)))}debug(e){e===!1?(v?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(v?.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}))}Ur(){var e=this.gn||{};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?(E.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,s,r,n,a){var o=s in t&&!C(t[s]),l=r in t&&!C(t[r]);return o?t[s]:!!l&&(a&&a.warn("Config field '"+r+"' is deprecated. Please use '"+s+"' instead. The old field will be removed in a future major version."),t[r])})(e,"advanced_disable_flags","advanced_disable_decide",0,E)}Rt(e){var t;if(C(this.config.before_send))return e;var s=Object.keys((t=e.properties)!==null&&t!==void 0?t:{}).filter(Ro),r=R(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var a of r){if(n=a(n),C(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Mo(e.event)?E.warn(o+". This can cause unexpected behavior."):E.info(o),null}n.properties&&!Xe(n.properties)||E.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var l of s)if(n.properties&&C(n.properties[l]))return E.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.ir)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,s){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(s)})}pn(e){var t=Ce(e)&&!e,s=V.N()&&V.q("ph_debug")==="true";return!t&&(!!s||e)}}$e.__defaultExtensionClasses={},$e.Bn=(()=>{var i=()=>{};return{trace:i,debug:i,info:i,warn:i,error:i,fatal:i}})(),(function(i,e){for(var t=0;e.length>t;t++)i.prototype[e[t]]=bl(i.prototype[e[t]])})($e,["identify"]);class $n{constructor(e){this.disabled=e===!1;var t=K(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,s){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>s-r.timestamp){if(this.clicks.push({x:e,y:t,timestamp:s}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:s}];return!1}}var Es="$copy_autocapture",ks=Q("[AutoCapture]");function Ss(i,e){return e.length>i?e.slice(0,i)+"...":e}function ku(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!Ye(e));return e}function Su(i,e){var t,s,r=e.e,n=e.maskAllElementAttributes,a=e.maskAllText,o=e.elementAttributeIgnoreList,l=e.elementsChainAsString,u=e.disableCaptureUrlHashes;if(!Ye(i))return{props:{}};for(var c=[i],h=new Set([i]),d=i;d.parentNode&&!ke(d,"body")&&ja>c.length;)if(Na(d.parentNode)){var p=d.parentNode.host;if(h.has(p))break;h.add(p),c.push(p),d=p}else{if(!Ye(d.parentNode)||h.has(d.parentNode))break;h.add(d.parentNode),c.push(d.parentNode),d=d.parentNode}var f,g,m=[],b={},P=!1,_=!1;if(G(c,(w=>{var T=nr(w);if(ke(w,"a")){var I=w.getAttribute("href");P=!!(T&&I&&Xt(I))&&(u?Ke(I):I)}M(Hi(w),"ph-no-capture")&&(_=!0),m.push((function(L,j,ne,ae,q){q===void 0&&(q=!1);var ee=L.tagName.toLowerCase(),X={tag_name:ee};Pr.indexOf(ee)>-1&&!ne&&(X.$el_text=ee.toLowerCase()==="a"||ee.toLowerCase()==="button"?Ss(1024,cn(L)):Ss(1024,ii(L)));var pe=Hi(L);pe.length>0&&(X.classes=pe.filter((function(N){return N!==""}))),G(L.attributes,(function(N){var J;if((!Ua(L)||["name","id","class","aria-label"].indexOf(N.name)!==-1)&&(ae==null||!ae.includes(N.name))&&!j&&Xt(N.value)&&(!U(J=N.name)||J.substring(0,10)!=="_ngcontent"&&J.substring(0,7)!=="_nghost")){var ie=N.value;N.name==="class"&&(ie=Sr(ie).join(" ")),X["attr__"+N.name]=Ss(1024,N.name==="href"&&q?Ke(ie):ie)}}));for(var te=1,z=1,ce=L;ce=ku(ce);)te++,ce.tagName===L.tagName&&z++;return X.nth_child=te,X.nth_of_type=z,X})(w,n,a,o,u));var A=(function(L){if(!nr(L))return{};var j={};return G(L.attributes,(function(ne){if(ne.name&&ne.name.indexOf("data-ph-capture-attribute")===0){var ae=ne.name.replace("data-ph-capture-attribute-",""),q=ne.value;ae&&q&&Xt(q)&&(j[ae]=q)}})),j})(w);W(b,A)})),_)return{props:{},explicitNoCapture:_};if(a||(m[0].$el_text=ke(i,"a")||ke(i,"button")?cn(i):ii(i)),P){var k,F;m[0].attr__href=P;var D=(k=zi(P))==null?void 0:k.host,O=v==null||(F=v.location)==null?void 0:F.host;D&&O&&D!==O&&(f=P)}return{props:W({$event_type:r.type,$ce_version:1},l?{}:{$elements:m},{$elements_chain:(g=m,(function(w){return w.map((T=>{var I,A,L="";if(T.tag_name&&(L+=T.tag_name),T.attr_class)for(var j of(T.attr_class.sort(),T.attr_class))L+="."+j.replace(/"/g,"");var ne=y({},T.text?{text:T.text}:{},{"nth-child":(I=T.nth_child)!==null&&I!==void 0?I:0,"nth-of-type":(A=T.nth_of_type)!==null&&A!==void 0?A:0},T.href?{href:T.href}:{},T.attr_id?{attr_id:T.attr_id}:{},T.attributes),ae={};return Ei(ne).sort(((q,ee)=>q[0].localeCompare(ee[0]))).forEach((q=>{var ee=q[1];return ae[hn(q[0].toString())]=hn(ee.toString())})),(L+=":")+Ei(ae).map((q=>q[0]+'="'+q[1]+'"')).join("")})).join(";")})((function(w){return w.map((T=>{var I,A,L={text:(I=T.$el_text)==null?void 0:I.slice(0,400),tag_name:T.tag_name,href:(A=T.attr__href)==null?void 0:A.slice(0,2048),attr_class:jl(T),attr_id:T.attr__id,nth_child:T.nth_child,nth_of_type:T.nth_of_type,attributes:{}};return Ei(T).filter((j=>j[0].indexOf("attr__")===0)).forEach((j=>L.attributes[j[0]]=j[1])),L}))})(g)))},(t=m[0])!=null&&t.$el_text?{$el_text:(s=m[0])==null?void 0:s.$el_text}:{},f&&r.type==="click"?{$external_click_url:f}:{},b)}}var jt=Q("[ExceptionAutocapture]"),In=()=>{},Pu=Q("[TracingHeaders]"),it=Q("[Web Vitals]"),Mn=9e5,Rn="disabled",Cn="lazy_loading",qt="awaiting_config",_i="missing_config";Q("[SessionRecording]"),Q("[SessionRecording]");var pr="[SessionRecording]",Ne=Q(pr),Tu=Q("[Heatmaps]");function Ps(i){return K(i)&&"clientX"in i&&"clientY"in i&&de(i.clientX)&&de(i.clientY)}var Ts=Q("[Product Tours]"),Fs=i=>{var e;return!i.config.disable_product_tours&&!((e=i.persistence)==null||!e.get_property(wr))},Fu=["$set_once","$set"],Oe=Q("[SiteApps]"),On="Error while initializing PostHog app with config id ";function gt(i,e,t){if(C(i))return!1;switch(t){case"exact":return i===e;case"contains":var s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(i);case"regex":try{return new RegExp(e).test(i)}catch{return!1}default:return!1}}class $u{constructor(e){this.Hn=new Ir,this.Un=(t,s)=>this.zn(t,s)&&this.Vn(t,s)&&this.Wn(t,s)&&this.Zn(t,s),this.zn=(t,s)=>s==null||!s.event||t?.event===s?.event,this._instance=e,this.Gn=new Set,this.Qn=new Set}init(){var e,t;x((e=this._instance)==null?void 0:e._addCaptureHook)||(t=this._instance)==null||t._addCaptureHook(((s,r)=>{this.on(s,r)}))}register(e){var t,s;if(!x((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((a=>{var o,l;(o=this.Qn)==null||o.add(a),(l=a.steps)==null||l.forEach((u=>{var c;(c=this.Gn)==null||c.add(u?.event||"")}))})),(s=this._instance)!=null&&s.autocapture)){var r,n=new Set;e.forEach((a=>{var o;(o=a.steps)==null||o.forEach((l=>{l!=null&&l.selector&&n.add(l?.selector)}))})),(r=this._instance)==null||r.autocapture.setElementSelectors(n)}}on(e,t){var s;t!=null&&e.length!=0&&(this.Gn.has(e)||this.Gn.has(t.event))&&this.Qn&&((s=this.Qn)==null?void 0:s.size)>0&&this.Qn.forEach((r=>{this.Jn(t,r)&&this.Hn.emit("actionCaptured",r.name)}))}Kn(e){this.onAction("actionCaptured",(t=>e(t)))}Jn(e,t){if(t?.steps==null)return!1;for(var s of t.steps)if(this.Un(e,s))return!0;return!1}onAction(e,t){return this.Hn.on(e,t)}Vn(e,t){if(t!=null&&t.url){var s,r=e==null||(s=e.properties)==null?void 0:s.$current_url;if(!r||typeof r!="string"||!gt(r,t.url,t.url_matching||"contains"))return!1}return!0}Wn(e,t){return!!this.Yn(e,t)&&!!this.Xn(e,t)&&!!this.ts(e,t)}Yn(e,t){var s;if(t==null||!t.href)return!0;var r=this.es(e);if(r.length>0)return r.some((o=>gt(o.href,t.href,t.href_matching||"exact")));var n,a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!a&>((n=a.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}Xn(e,t){var s;if(t==null||!t.text)return!0;var r=this.es(e);if(r.length>0)return r.some((u=>gt(u.text,t.text,t.text_matching||"exact")||gt(u.$el_text,t.text,t.text_matching||"exact")));var n,a,o,l=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!l&&(n=(function(u){for(var c,h=[],d=/(?::|")text="(.*?)"/g;!C(c=d.exec(u));)h.includes(c[1])||h.push(c[1]);return h})(l),a=t.text,o=t.text_matching||"exact",n.some((u=>gt(u,a,o))))}ts(e,t){var s,r;if(t==null||!t.selector)return!0;var n=e==null||(s=e.properties)==null?void 0:s.$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}es(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Zn(e,t){return t==null||!t.properties||t.properties.length===0||mo(t.properties.reduce(((s,r)=>{var n=R(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return s[r.key]={values:n,operator:r.operator||"exact"},s}),{}),e?.properties)}}class Iu{constructor(e){var t;this.rs=[],this._instance=e,this.ns=new Map,this.ss=new Map,this.os=new Map,(t=this._instance)==null||t.onSessionId==null||t.onSessionId((s=>this.ls(s)))}us(e,t){return!!e&&mo(e.propertyFilters,t?.properties)}hs(e,t){var s=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=s.get(a.name)||[];o.push(r.id),s.set(a.name,o)}}))})),s}ds(e,t,s){var r=(s===Ot.Activation?this.ns:this.ss).get(e),n=[];return this.cs((a=>{n=a.filter((o=>r?.includes(o.id)))})),n.filter((a=>{var o,l=(o=a.conditions)==null||(o=o[s])==null||(o=o.values)==null?void 0:o.find((u=>u.name===e));return this.us(l,t)}))}register(e){var t;x((t=this._instance)==null?void 0:t._addCaptureHook)||(this.vs(e),this.fs(e))}fs(e){var t=e.filter((s=>{var r,n;return((r=s.conditions)==null?void 0:r.actions)&&((n=s.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.ps==null&&(this.ps=new $u(this._instance),this.ps.init(),this.ps.Kn((s=>{this.onAction(s)}))),t.forEach((s=>{var r,n,a,o,l;s.conditions&&(r=s.conditions)!=null&&r.actions&&(n=s.conditions)!=null&&(n=n.actions)!=null&&n.values&&((a=s.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((o=this.ps)==null||o.register(s.conditions.actions.values),(l=s.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((u=>{if(u&&u.name){var c=this.os.get(u.name);c&&c.push(s.id),this.os.set(u.name,c||[s.id])}})))})))}vs(e){var t,s=e.filter((n=>{var a,o;return((a=n.conditions)==null?void 0:a.events)&&((o=n.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.length)>0})),r=e.filter((n=>{var a,o;return((a=n.conditions)==null?void 0:a.cancelEvents)&&((o=n.conditions)==null||(o=o.cancelEvents)==null||(o=o.values)==null?void 0:o.length)>0}));s.length===0&&r.length===0||((t=this._instance)==null||t._addCaptureHook(((n,a)=>{this.onEvent(n,a)})),this.ns=this.hs(e,Ot.Activation),this.ss=this.hs(e,Ot.Cancellation))}onEvent(e,t){var s,r,n=this.gs(),a=(t==null||(s=t.properties)==null?void 0:s.$survey_id)||(t==null||(r=t.properties)==null?void 0:r.$product_tour_id);if(a&&this.getActivatedIds().includes(a)){var o=this.ys(e,a);if(o==="consume")return n.info("event consumed activated item, removing it",{event:e,itemId:a}),void this.bs([a]);if(o==="persist")return n.info("shown item promoted to persisted activation",{event:e,itemId:a}),void this._s(a)}if(this.ss.has(e)){var l=this.ds(e,t,Ot.Cancellation);l.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:l.map((c=>c.id))}),this.bs(l.map((c=>c.id))),l.forEach((c=>this.ws(c.id))))}if(this.ns.has(e)){n.info("event name matched",{event:e,eventPayload:t,items:this.ns.get(e)});var u=this.ds(e,t,Ot.Activation);this.xs(u.map((c=>c.id)))}}onAction(e){this.os.has(e)&&this.xs(this.os.get(e)||[])}xs(e){e.length!==0&&(this.rs=[...new Set([...this.rs,...e])],this.gs().info("updating activated items",{activatedItems:this.getActivatedIds()}))}_s(e){this.rs=this.rs.filter((s=>s!==e));var t=this.ks();t.includes(e)||(this.Ss([...t,e]),this.Cs())}bs(e){var t=new Set(e);this.rs=this.rs.filter((n=>!t.has(n)));var s=this.Ms(),r=s.filter((n=>!t.has(n)));r.length!==s.length&&(this.Ss(r),r.length===0&&this.Is())}Ms(){var e,t=this.Ts();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}ks(){var e,t,s=this.Ms();if(s.length===0)return[];var r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this.Es()],n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();return n&&r===n?s:[]}Cs(){var e,t=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();t&&this.Rs(t)}Is(){this.Ps()}ls(e){var t,s=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.Es()];s&&s!==e&&(this.Ms().length>0&&this.Ss([]),this.Is())}getActivatedIds(){return[...new Set([...this.ks(),...this.rs])].filter((e=>!this.Os(e)))}reset(){this.rs=[],this.Ms().length>0&&this.Ss([]),this.Is()}getEventToItemsMap(){return this.ns}Fs(){return this.ps}}class Mu extends Iu{constructor(e){super(e)}Ts(){return Ks}Es(){return xi}As(){return Ge.SHOWN}cs(e){var t;(t=this._instance)==null||t.getSurveys(e)}ws(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}gs(){return H}Ss(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Ks]:e})}Rs(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[xi]:e})}Ps(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(xi)}Os(){return!1}ys(e,t){var s;this.cs((n=>{s=n.find((a=>a.id===t))}));var r=!s||(function(n){var a;return yo(n)&&!((a=n.conditions)==null||(a=a.events)==null||!a.repeatedActivation)||n.schedule==="always"})(s);return r?e===Ge.SHOWN?"consume":"ignore":e===Ge.SHOWN?"persist":e===Ge.DISMISSED||e===Ge.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var mi="SDK is not enabled or survey functionality is not yet loaded",An="Disabled. Not loading surveys.",Ru=v!=null&&v.location?Ui(v.location.hash,"__posthog")||Ui(location.hash,"state"):null,Ln="_postHogToolbarParams",Dn=Q("[Toolbar]"),ue=Q("[FeatureFlags]"),st=Q("[FeatureFlags]",{debugEnabled:!0}),$s=`" failed. Feature flags didn't load in time.`,Nn=i=>{for(var e={},t=0;i.length>t;t++)e[i[t]]=!0;return e},jn=i=>{var e={};for(var t of Ei(i||{})){var s=t[1];s&&(e[t[0]]=s)}return e},Ae=Q("[Error tracking]"),qn="Refusing to render web experiment since the viewer is a likely bot",Cu={icontains:(i,e)=>e.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>e.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>Wi(e,i),not_regex:(i,e)=>!Wi(e,i),exact:(i,e)=>e===i,is_not:(i,e)=>e!==i};class ve{get Te(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(s){s===void 0&&(s=!1),t.getWebExperiments((r=>{ve.$s("retrieved web experiments from the server"),t.Ls=new Map,r.forEach((n=>{if(n.feature_flag_key){var a;t.Ls&&(ve.$s("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=t.Ls)==null||a.set(n.feature_flag_key,n));var o=t._instance.getFeatureFlag(n.feature_flag_key);U(o)&&n.variants[o]&&t.Ds(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var u=n.variants[l];ve.Ns(u,t._instance)&&t.Ds(n.name,l,u.transforms)}}))}),s)},this._instance=e,this._instance.onFeatureFlags((s=>{this.onFeatureFlags(s)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())ve.$s(qn);else if(!this.Te.disable_web_experiments){if(C(this.Ls))return this.Ls=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ve.$s("applying feature flags",e),e.forEach((t=>{var s;if(this.Ls&&(s=this.Ls)!=null&&s.has(t)){var r,n=this._instance.getFeatureFlag(t),a=(r=this.Ls)==null?void 0:r.get(t);n&&a!=null&&a.variants[n]&&this.Ds(a.name,n,a.variants[n].transforms)}}))}}previewWebExperiment(){var e=ve.getWindowLocation();if(e!=null&&e.search){var t=Pt(e?.search,"__experiment_id"),s=Pt(e?.search,"__experiment_variant");t&&s&&(ve.$s("previewing web experiments "+t+" && "+s),this.getWebExperiments((r=>{this.qs(parseInt(t),s,r)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,s){if(this.Te.disable_web_experiments&&!s)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.Te.token),method:"GET",timestampMode:"query",callback:n=>e(n.statusCode===200&&n.json&&n.json.experiments||[])})}qs(e,t,s){var r=s.filter((n=>n.id===e));r&&r.length>0&&(ve.$s("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.Ds(r[0].name,t,r[0].variants[t].transforms))}static Ns(e,t){return!C(e.conditions)&&ve.js(e,t)&&ve.Bs(e)}static js(e,t){var s;if(C(e.conditions)||C((s=e.conditions)==null?void 0:s.url))return!0;var r=ve.getWindowLocation();if(r){var n,a,o,l=Aa(t,r.href);return(n=e.conditions)==null||!n.url||Cu[(a=(o=e.conditions)==null?void 0:o.urlMatchType)!==null&&a!==void 0?a:"icontains"](e.conditions.url,l)}return!1}static getWindowLocation(){return v?.location}static Bs(e){var t;if(C(e.conditions)||C((t=e.conditions)==null?void 0:t.utm))return!0;var s=Ka();if(s.utm_source){var r,n,a,o,l,u,c,h,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)==s.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)==s.utm_source,f=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==s.utm_medium,g=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==s.utm_term;return d&&f&&g&&p}return!1}static $s(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;t>r;r++)s[r-1]=arguments[r];E.info("[WebExperiments] "+e,s)}Ds(e,t,s){this._is_bot()?ve.$s(qn):t!=="control"?s.forEach((r=>{if(r.selector){var n;ve.$s("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)}))}})):ve.$s("Control variants leave the page unmodified.")}_is_bot(){return me&&this._instance?go(me,this.Te.custom_blocked_useragents):void 0}}var Te=Q("[Conversations]"),rt="Conversations not available yet.",Bn="console",Zi={featureFlags:class{constructor(i){this.Hs=!1,this.Us=!1,this.zs=!1,this.Vs=!1,this.Ws=!1,this.Zs=!1,this.Gs=!1,this.Qs=!1,this.Js=0,this.Ks=()=>{var e=this.Ys();this.Js=0,e&&this.reloadFeatureFlags()},this._instance=i,this.featureFlagEventHandlers=[],v&&re(v,"online",this.Ks)}destroy(){v?.removeEventListener("online",this.Ks)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}Xs(i){return this._instance.get_property(i)}eo(){var i,e;return(i=(e=this.mi)==null?void 0:e._r(this.Te.feature_flag_cache_ttl_ms))!==null&&i!==void 0&&i}ro(){return!!this.eo()&&(this.Qs||this.zs||(this.Qs=!0,ue.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}io(){var i,e=(i=this.Te.evaluation_contexts)!==null&&i!==void 0?i:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.Gs||(ue.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gs=!0),e!=null&&e.length?e.filter((t=>{var s=t&&typeof t=="string"&&t.trim().length>0;return s||ue.error("Invalid evaluation context found:",t,"Expected non-empty string"),s})):[]}no(){return this.io().length>0}so(){var i=this.Te.flag_keys;if(!x(i)){if(R(i))return i.filter((e=>{var t=e&&typeof e=="string"&&e.trim().length>0;return t||ue.error("Invalid flag key found:",e,"Expected non-empty string"),t}));ue.error("Invalid flag_keys found:",i,"Expected array of non-empty strings")}}initialize(){var i,e,t=this._instance.config,s=(i=(e=t.bootstrap)==null?void 0:e.featureFlags)!==null&&i!==void 0?i:{};if(Object.keys(s).length){var r,n,a=(r=(n=t.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&r!==void 0?r:{},o=Object.keys(s).filter((u=>!!s[u])).reduce(((u,c)=>(u[c]=s[c]||!1,u)),{}),l=Object.keys(a).filter((u=>o[u])).reduce(((u,c)=>(a[c]&&(u[c]=a[c]),u)),{});this.receivedFeatureFlags({featureFlags:o,featureFlagPayloads:l})}}updateFlags(i,e,t){var s,r,n=t!=null&&t.merge&&(s=this.Xs(lt))!==null&&s!==void 0?s:{},a=t!=null&&t.merge&&(r=this.Xs(wi))!==null&&r!==void 0?r:{},o=y({},n,i),l=y({},a,e),u={};for(var c of Object.entries(o)){var h=c[0],d=c[1];u[h]={key:h,enabled:Dr(d),variant:Nr(d),reason:void 0,metadata:x(l?.[h])?void 0:{id:0,version:void 0,description:void 0,payload:l[h]}}}this.receivedFeatureFlags({flags:u})}get hasLoadedFlags(){return this.Us}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var i=this.Xs(Ws),e=this.Xs(qe),t=this.Xs(ft);if(!t&&!e)return i||{};var s=W({},i||{}),r=[...new Set([...Object.keys(t||{}),...Object.keys(e||{})])];for(var n of r){var a,o,l=s[n],u=e?.[n],c=x(u)?(a=l?.enabled)!==null&&a!==void 0&&a:!!u,h=x(u)?l.variant:typeof u=="string"?u:void 0,d=t?.[n],p=y({},l,{enabled:c,variant:c?h??l?.variant:void 0});c!==l?.enabled&&(p.original_enabled=l?.enabled),h!==l?.variant&&(p.original_variant=l?.variant),d&&(p.metadata=y({},l?.metadata,{payload:d,original_payload:l==null||(o=l.metadata)==null?void 0:o.payload})),s[n]=p}return this.Hs||(ue.warn(" Overriding feature flag details!",{flagDetails:i,overriddenPayloads:t,finalDetails:s}),this.Hs=!0),s}getAllFeatureFlags(){var i=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(i).map((t=>{var s=i[t];return{key:t,enabled:Dr(s),variant:Nr(s),payload:Lr(e[t])}}))}getFlagVariants(){var i=this.Xs(lt),e=this.Xs(qe);if(!e)return i||{};for(var t=W({},i),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.Hs||(ue.warn(" Overriding feature flags!",{enabledFlags:i,overriddenFlags:e,finalFlags:t}),this.Hs=!0),t}getFlagPayloads(){var i=this.Xs(wi),e=this.Xs(ft);if(!e)return i||{};for(var t=W({},i||{}),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.Hs||(ue.warn(" Overriding feature flag payloads!",{flagPayloads:i,overriddenPayloads:e,finalPayloads:t}),this.Hs=!0),t}reloadFeatureFlags(){this.Vs||this.Te.advanced_disable_feature_flags||this.Ys()||this.oo||(this._instance.en.emit("featureFlagsReloading",!0),this.oo=setTimeout((()=>{this.ao()}),5))}lo(){clearTimeout(this.oo),this.oo=void 0}ensureFlagsLoaded(){this.Us||this.zs||this.oo||this.reloadFeatureFlags()}setAnonymousDistinctId(i){this.$anon_distinct_id=i}setReloadingPaused(i){this.Vs=i}ao(i){var e;if(this.lo(),!this._instance.Ur()&&!this.Ys())if(this.zs)this.Ws=!0;else{var t=this.Te.token,s=this.Xs(ei),r={token:t,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:y({},((e=this.mi)==null?void 0:e.get_initial_props())||{},this.Xs(nt)||{},{$lib:B.LIB_NAME,$lib_version:B.LIB_VERSION}),group_properties:this.Xs(at),timezone:io()};ye(s)||x(s)||(r.$device_id=s),(i!=null&&i.disableFlags||this.Te.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.no()&&(r.evaluation_contexts=this.io());var n=this.so();x(n)||(r.flag_keys=n);var a=!!this.Te.advanced_only_evaluate_survey_feature_flags,o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Te.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.zs=!0,this._instance._send_request({method:"POST",url:o,data:r,compression:this.Te.disable_compression?void 0:_e.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:l=>{var u,c,h,d=!0;if(this.uo(l.statusCode),l.statusCode===200&&(this.Ws||(this.$anon_distinct_id=void 0),d=!1),this.zs=!1,!r.disable_flags||this.Ws){this.Zs=!d;var p=[];l.error?l.error instanceof Error?p.push(l.error.name==="AbortError"?"timeout":"connection_error"):p.push("unknown_error"):l.statusCode!==200&&p.push("api_error_"+l.statusCode),(u=l.json)!=null&&u.errorsWhileComputingFlags&&p.push("errors_while_computing_flags");var f,g=!((c=l.json)==null||(c=c.quotaLimited)==null||!c.includes("feature_flags"));g&&p.push("quota_limited"),(h=this.mi)==null||h.register({[Zs]:p}),g?ue.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."):(r.disable_flags||this.receivedFeatureFlags((f=l.json)!==null&&f!==void 0?f:{},d,{partialResponse:a}),this.Ws&&(this.Ws=!1,this.ao()))}}})}}Ys(){return Ja(this.Js,3)}uo(i){this.Js=Xa(i,this.Js,3,(()=>ue.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(i,e){var t;if(e===void 0&&(e={}),!e.fresh||this.Zs)if(this.Us||this.getFlags()&&this.getFlags().length>0){if(!this.ro()){var s=this.getFeatureFlagResult(i,e);return(t=s?.variant)!==null&&t!==void 0?t:s?.enabled}}else ue.warn('getFeatureFlag for key "'+i+$s)}getFeatureFlagDetails(i){return this.getFlagsWithDetails()[i]}getFeatureFlagPayload(i){var e=this.getFeatureFlagResult(i,{send_event:!1});return e?.payload}getFeatureFlagResult(i,e){if(e===void 0&&(e={}),!e.fresh||this.Zs)if(this.Us||this.getFlags()&&this.getFlags().length>0){if(!this.ro()){var t=this.getFlagVariants(),s=i in t,r=t[i],n=this.getFlagPayloads()[i],a=String(r),o=this.Xs(Js)||void 0,l=this.Xs(ti)||void 0,u=this.Xs(Jt)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var c,h=this._instance.get_session_id(),d=this.Xs(Ys);h&&h!==d&&(u={},(c=this.mi)==null||c.register({[Jt]:u,[Ys]:h}))}if((e.send_event||!("send_event"in e))&&(!(i in u)||!u[i].includes(a))){var p,f,g,m,b,P,_,k,F,D,O;R(u[i])?u[i].push(a):u[i]=[a],(p=this.mi)==null||p.register({[Jt]:u});var w=this.getFeatureFlagDetails(i),T=[...(f=this.Xs(Zs))!==null&&f!==void 0?f:[]];x(r)&&T.push("flag_missing");var I={$feature_flag:i,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((g=this.Te.bootstrap)==null||(g=g.featureFlags)==null?void 0:g[i])||null,$feature_flag_bootstrapped_payload:((m=this.Te.bootstrap)==null||(m=m.featureFlagPayloads)==null?void 0:m[i])||null,$used_bootstrap_value:!this.Zs};x(w==null||(b=w.metadata)==null?void 0:b.has_experiment)||(I.$feature_flag_has_experiment=w.metadata.has_experiment),x(w==null||(P=w.metadata)==null?void 0:P.version)||(I.$feature_flag_version=w.metadata.version);var A,L=(_=w==null||(k=w.reason)==null?void 0:k.description)!==null&&_!==void 0?_:w==null||(F=w.reason)==null?void 0:F.code;L&&(I.$feature_flag_reason=L),w!=null&&(D=w.metadata)!=null&&D.id&&(I.$feature_flag_id=w.metadata.id),x(w?.original_variant)&&x(w?.original_enabled)||(I.$feature_flag_original_response=x(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(O=w.metadata)!=null&&O.original_payload&&(I.$feature_flag_original_payload=w==null||(A=w.metadata)==null?void 0:A.original_payload),T.length&&(I.$feature_flag_error=T.join(",")),this._instance.capture("$feature_flag_called",I)}if(s)return{key:i,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:Lr(n)}}}else ue.warn('getFeatureFlagResult for key "'+i+$s)}getRemoteConfigPayload(i,e){var t=this.Te.token,s={distinct_id:this._instance.get_distinct_id(),token:t,person_properties:{$lib:B.LIB_NAME,$lib_version:B.LIB_VERSION}};this.no()&&(s.evaluation_contexts=this.io());var r=this.so();x(r)||(s.flag_keys=r),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.Te.disable_compression?void 0:_e.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(n){var a,o=(a=n.json)==null?void 0:a.featureFlagPayloads;e(o?.[i]||void 0)}})}isFeatureEnabled(i,e){if(e===void 0&&(e={}),e.fresh&&!this.Zs)return e.defaultValue;if(!(this.Us||this.getFlags()&&this.getFlags().length>0))return ue.warn('isFeatureEnabled for key "'+i+$s),e.defaultValue;var t=this.getFeatureFlag(i,e);return x(t)?e.defaultValue:!!t}addFeatureFlagsHandler(i){this.featureFlagEventHandlers.push(i)}removeFeatureFlagsHandler(i){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==i))}receivedFeatureFlags(i,e,t){if(this.mi){this.Us=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(a,o,l,u,c,h){l===void 0&&(l={}),u===void 0&&(u={}),c===void 0&&(c={});var d=(w=>{var T=w.flags;return T?(w.featureFlags=Object.fromEntries(Object.keys(T).map((I=>{var A;return[I,(A=T[I].variant)!==null&&A!==void 0?A:T[I].enabled]}))),w.featureFlagPayloads=Object.fromEntries(Object.keys(T).filter((I=>T[I].enabled)).filter((I=>{var A;return(A=T[I].metadata)==null?void 0:A.payload})).map((I=>{var A;return[I,(A=T[I].metadata)==null?void 0:A.payload]})))):w.featureFlags&&ue.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),w})(a),p=d.flags,f=d.featureFlags,g=d.featureFlagPayloads;if(f){var m=a.requestId,b=a.evaluatedAt;if(R(f)){ue.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var P={};if(f)for(var _=0;f.length>_;_++)P[f[_]]=!0;o&&o.register({[bi]:f,[lt]:P,[Ai]:!1})}else{var k=f,F=g,D=p;if(h!=null&&h.partialResponse)k=y({},l,k),F=y({},u,F),D=y({},c,D);else if(a.errorsWhileComputingFlags)if(p){var O=new Set(Object.keys(p).filter((w=>{var T;return!((T=p[w])!=null&&T.failed)})));k=y({},l,Object.fromEntries(Object.entries(k).filter((w=>O.has(w[0]))))),F=y({},u,Object.fromEntries(Object.entries(F||{}).filter((w=>O.has(w[0]))))),D=y({},c,Object.fromEntries(Object.entries(D||{}).filter((w=>O.has(w[0])))))}else k=y({},l,k),F=y({},u,F),D=y({},c,D);o&&o.register(y({[bi]:Object.keys(jn(k)),[lt]:k||{},[wi]:F||{},[Ws]:D||{},[Ai]:a.minimalFlagCalledEvents===!0},m?{[Js]:m}:{},b?{[ti]:b}:{}))}}})(i,this.mi,s,r,n,t),e||(this.Qs=!1),this.ho(e)}}override(i,e){e===void 0&&(e=!1),ue.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:i,suppressWarning:e})}overrideFeatureFlags(i){if(!this._instance.__loaded||!this.mi)return ue.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(i===!1)return this.mi.unregister(qe),this.mi.unregister(ft),this.ho(),st.info("All overrides cleared");if(R(i)){var e=Nn(i);return this.mi.register({[qe]:e}),this.ho(),st.info("Flag overrides set",{flags:i})}if(i&&typeof i=="object"&&("flags"in i||"payloads"in i)){var t,s=i;if(this.Hs=!!((t=s.suppressWarning)!==null&&t!==void 0&&t),"flags"in s){if(s.flags===!1)this.mi.unregister(qe),st.info("Flag overrides cleared");else if(s.flags){if(R(s.flags)){var r=Nn(s.flags);this.mi.register({[qe]:r})}else this.mi.register({[qe]:s.flags});st.info("Flag overrides set",{flags:s.flags})}}return"payloads"in s&&(s.payloads===!1?(this.mi.unregister(ft),st.info("Payload overrides cleared")):s.payloads&&(this.mi.register({[ft]:s.payloads}),st.info("Payload overrides set",{payloads:s.payloads}))),void this.ho()}if(i&&typeof i=="object")return this.mi.register({[qe]:i}),this.ho(),st.info("Flag overrides set",{flags:i});ue.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:i})}onFeatureFlags(i){if(this.addFeatureFlagsHandler(i),this.Us){var e=this.do(),t=e.flags,s=e.flagVariants;try{i(t,s)}catch(r){ue.error("Error while running feature flags callback",r)}}return()=>this.removeFeatureFlagsHandler(i)}updateEarlyAccessFeatureEnrollment(i,e,t){var s,r=(this.Xs(Ut)||[]).find((l=>l.flagKey===i)),n={["$feature_enrollment/"+i]:e},a={$feature_flag:i,$feature_enrollment:e,$set:n};r&&(a.$early_access_feature_name=r.name),t&&(a.$feature_enrollment_stage=t),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(n,!1);var o=y({},this.getFlagVariants(),{[i]:e});(s=this.mi)==null||s.register({[bi]:Object.keys(jn(o)),[lt]:o}),this.ho()}getEarlyAccessFeatures(i,e,t){e===void 0&&(e=!1);var s=this.Xs(Ut),r=t?"&"+t.map((n=>"stage="+n)).join("&"):"";if(s&&!e)return i(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+r),method:"GET",timestampMode:"query",callback:n=>{var a,o;if(n.json){var l=n.json.earlyAccessFeatures;return(a=this.mi)==null||a.unregister(Ut),(o=this.mi)==null||o.register({[Ut]:l}),i(l)}}})}do(){var i=this.getFlags(),e=this.getFlagVariants();return{flags:i.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,s)=>(t[s]=e[s],t)),{})}}ho(i){var e=this.do(),t=e.flags,s=e.flagVariants;this.featureFlagEventHandlers.forEach((r=>{try{r(t,s,{errorsLoading:i})}catch(n){ue.error("Error while running feature flags callback",n)}}))}setPersonPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.Xs(nt)||{},s=i?.$set||(i!=null&&i.$set_once?{}:i),r=i?.$set_once,n={};if(r)for(var a in r)({}).hasOwnProperty.call(r,a)&&(a in t||(n[a]=r[a]));this._instance.register({[nt]:y({},t,n,s)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=y({},this.Xs(nt)||{});i.forEach((s=>{delete t[s]})),this._instance.register({[nt]:t}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(i){i===void 0&&(i=!0),this._instance.unregister(nt),i&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.Xs(at)||{};Object.keys(t).length!==0&&Object.keys(t).forEach((s=>{t[s]=y({},t[s],i[s]),delete i[s]})),this._instance.register({[at]:y({},t,i)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(i){if(i){var e=this.Xs(at)||{};this._instance.register({[at]:y({},e,{[i]:{}})})}else this._instance.unregister(at)}reset(){this.Us=!1,this.zs=!1,this.Vs=!1,this.Ws=!1,this.Zs=!1,this.$anon_distinct_id=void 0,this.lo(),this.Hs=!1,this.Js=0}}},Ou={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var i;return!((i=this.co)==null||!i.isStarted)}get status(){var i,e;return this.vo===qt||this.vo===_i?this.vo:(i=(e=this.co)==null?void 0:e.status)!==null&&i!==void 0?i:this.vo}constructor(i){if(this._forceAllowLocalhostNetworkCapture=!1,this.vo=Rn,this.fo=void 0,this._instance=i,!this._instance.sessionManager)throw Ne.error("started without valid sessionManager"),new Error(pr+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===ze)throw new Error(pr+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get po(){var i,e=!((i=this._instance.get_property(ut))==null||!i.enabled),t=!this.Te.disable_session_recording,s=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return v&&e&&t&&!s}startIfEnabledOrStop(i){var e;if(!this.po||(e=this.co)==null||!e.isStarted){var t=!x(Object.assign)&&!x(Array.from);this.po&&t?(this.mo(i),Ne.info("starting")):(this.vo=Rn,this.stopRecording())}}mo(i){var e,t,s;this.po&&(this.vo!==qt&&this.vo!==_i&&(this.vo=Cn),$!=null&&(e=$.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(t=$.__PosthogExtensions__)!=null&&t.initSessionRecording?this.yo(i):(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.bo,(r=>{if(r)return Ne.error("could not load recorder",r);this.yo(i)})))}stopRecording(){var i,e;(i=this.fo)==null||i.call(this),this.fo=void 0,(e=this.co)==null||e.stop()}_o(){var i,e;(i=this.fo)==null||i.call(this),this.fo=void 0,(e=this.co)==null||e.discard()}wo(){var i,e;(i=this.mi)==null||i.unregister(xr),(e=this.mi)==null||e.unregister(Ea)}xo(i,e){if(C(i))return null;var t,s=de(i)?i:parseFloat(i);return typeof(t=s)!="number"||!Number.isFinite(t)||0>t||t>1?(Ne.warn(e+" must be between 0 and 1. Ignoring invalid value:",i),null):s}ko(i){if(this.mi){var e,t,s=this.mi,r=()=>{var n,a=i.sessionRecording===!1?void 0:i.sessionRecording,o=this.xo((n=this.Te.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.xo(a?.sampleRate,"remote config sampleRate"),u=o??l;C(u)&&this.wo();var c=a?.minimumDurationMilliseconds;s.register({[ut]:y({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:y({capturePerformance:i.capturePerformance},a?.networkPayloadCapture),canvasRecording:{enabled:a?.recordCanvas,fps:a?.canvasFps,quality:a?.canvasQuality},sampleRate:u,minimumDurationMilliseconds:x(c)?null:c,endpoint:a?.endpoint,triggerMatchType:a?.triggerMatchType,masking:a?.masking,urlTriggers:a?.urlTriggers,version:a?.version,triggerGroups:a?.triggerGroups})})};r(),(e=this.fo)==null||e.call(this),this.fo=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(r)}}onRemoteConfig(i){var e=i.ok?i.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.ko(e),void this._o()):(this.ko(e),void this.startIfEnabledOrStop()):(this.vo===qt&&(this.vo=_i,Ne.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(i,e){var t;e===void 0&&(e="log"),(t=this.co)!=null&&t.log?this.co.log(i,e):Ne.warn("log called before recorder was ready")}get bo(){var i,e,t=(i=this._instance)==null||(i=i.persistence)==null?void 0:i.get_property(ut);return(t==null||(e=t.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}So(){var i,e,t=this._instance.get_property(ut);if(!t)return!1;try{e=typeof t=="object"?t:JSON.parse(t)}catch(r){return Ne.warn("persisted remote config for session recording is invalid and will be ignored",r),!1}var s=(i=e.cache_timestamp)!==null&&i!==void 0?i:Date.now();return 36e5>=Date.now()-s}yo(i){var e,t;if((e=$.__PosthogExtensions__)==null||!e.initSessionRecording)return Ne.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Ma]:!0});if(this.co||(this.co=(t=$.__PosthogExtensions__)==null?void 0:t.initSessionRecording(this._instance),this.co._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.So())return this.vo===_i||this.vo===qt?void 0:(this.vo=qt,Ne.info("persisted remote config is stale, requesting fresh config before starting"),void new so(this._instance).load());this.vo=Cn,this.co.start(i)}onRRwebEmit(i){var e;(e=this.co)==null||e.onRRwebEmit==null||e.onRRwebEmit(i)}overrideLinkedFlag(){var i,e;this.co||(e=this.mi)==null||e.register({[Sa]:!0}),(i=this.co)==null||i.overrideLinkedFlag()}overrideSampling(){var i,e;this.co||(e=this.mi)==null||e.register({[ka]:!0}),(i=this.co)==null||i.overrideSampling()}overrideTrigger(i){var e,t;this.co||(t=this.mi)==null||t.register({[i==="url"?Pa:Ta]:!0}),(e=this.co)==null||e.overrideTrigger(i)}get sdkDebugProperties(){var i;return((i=this.co)==null?void 0:i.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(i,e){var t;return!((t=this.co)==null||!t.tryAddCustomEvent(i,e))}}},Au={autocapture:class{constructor(i){this.Co=!1,this.Mo=null,this.Io=!1,this.To=!1,this.instance=i,this.rageclicks=new $n(i.config.rageclick),this.Eo=null}initialize(){this.startIfEnabled()}get Te(){var i,e,t=K(this.instance.config.autocapture)?this.instance.config.autocapture:{};return t.url_allowlist=(i=t.url_allowlist)==null?void 0:i.map((s=>new RegExp(s))),t.url_ignorelist=(e=t.url_ignorelist)==null?void 0:e.map((s=>new RegExp(s))),t}Ro(){if(this.isBrowserSupported()){if(v&&S){var i=t=>{t=t||v?.event;try{this.Po(t)}catch(s){ks.error("Failed to capture event",s)}};if(re(S,"submit",i,{capture:!0}),re(S,"change",i,{capture:!0}),re(S,"click",i,{capture:!0}),this.Te.capture_copied_text){var e=t=>{t=t||v?.event;try{this.Po(t,Es)}catch(s){ks.error("Failed to capture copy/cut event",s)}};re(S,"copy",e,{capture:!0}),re(S,"cut",e,{capture:!0})}}}else ks.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Co&&(this.Ro(),this.Co=!0)}onRemoteConfig(i){if(this.Io=!0,i.ok){var e=i.config;e.elementsChainAsString&&(this.To=e.elementsChainAsString);var t=e.autocapture_opt_out;Ce(t)&&(this.instance.persistence&&this.instance.persistence.register({[qs]:t}),this.Mo=t),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(i){this.Eo=i}getElementSelectors(i){var e,t=[];return(e=this.Eo)==null||e.forEach((s=>{var r=S?.querySelectorAll(s);r?.forEach((n=>{i===n&&t.push(s)}))})),t}get isEnabled(){var i,e,t=(i=this.instance.persistence)==null?void 0:i.props[qs],s=this.Mo,r=this.instance.Ur()&&!this.Io;if(ye(s)&&!Ce(t)&&!r)return!1;var n=(e=this.Mo)!==null&&e!==void 0?e:!!t;return!!this.instance.config.autocapture&&!n}Po(i,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var t,s=hs(i);Da(s)&&(s=s.parentNode||null),e==="$autocapture"&&i.type==="click"&&i instanceof MouseEvent&&this.instance.config.rageclick&&(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,i.timeStamp||new Date().getTime())&&nn(s,this.instance.config.rageclick)&&this.Po(i,"$rageclick");var r=e===Es;if(s&&(function(h,d,p,f,g,m){var b;if(!v||Tr(h)||p!=null&&p.url_allowlist&&!tn(p.url_allowlist,m)||p!=null&&p.url_ignorelist&&tn(p.url_ignorelist,m))return!1;if(p!=null&&p.dom_event_allowlist){var P=p.dom_event_allowlist;if(P&&!P.some((w=>d.type===w)))return!1}var _=za(h,f),k=_.parentIsUsefulElement,F=_.targetElementList;if(!(function(w,T){var I=T?.element_allowlist;if(x(I))return!0;var A,L=function(ne){if(I.some((ae=>ne.tagName.toLowerCase()===ae)))return{v:!0}};for(var j of w)if(A=L(j))return A.v;return!1})(F,p)||!rr(F,p?.css_selector_allowlist)||rr(F,(b=p?.css_selector_ignorelist)!==null&&b!==void 0?b:Cl))return!1;try{var D=v.getComputedStyle(h);if(D&&D.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0}catch{}var O=h.tagName.toLowerCase();switch(O){case"html":return!1;case"form":return(g||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(g||["change","click"]).indexOf(d.type)>=0;default:return k?(g||["click"]).indexOf(d.type)>=0:(g||["click"]).indexOf(d.type)>=0&&(Pr.indexOf(O)>-1||h.getAttribute("contenteditable")==="true")}})(s,i,this.Te,r,r?["copy","cut"]:void 0,this.instance)){var n=Su(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Te.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),a=n.props;if(n.explicitNoCapture)return!1;var o=this.getElementSelectors(s);if(o&&o.length>0&&(a.$element_selectors=o),e===Es){var l,u=qa(v==null||(l=v.getSelection())==null?void 0:l.toString()),c=i.type||"clipboard";if(!u)return!1;a.$selected_content=u,a.$copy_type=c}return this.instance.capture(e,a),!0}}}isBrowserSupported(){return Ee(S?.querySelectorAll)}},historyAutocapture:class{constructor(i){var e;this._instance=i,this.Oo=(v==null||(e=v.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(E.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Fo&&this.Fo(),this.Fo=void 0,E.info("History API monitoring stopped")}monitorHistoryChanges(){v&&v.history&&(this.Ao("pushState"),this.Ao("replaceState"),this.$o())}Ao(i){var e;if(v&&((e=v.history[i])==null||!e.__posthog_wrapped__)){var t=this;(function(s,r,n){try{if(!(r in s))return In;var a={next:s[r]},o=n((function(){for(var l=arguments.length,u=new Array(l),c=0;l>c;c++)u[c]=arguments[c];return a.next.apply(this,u)}));return Ee(o)&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:a}})),s[r]=o,()=>{if(s[r]!==o)for(var l=s[r];Ee(l)&&l.__posthog_layer__;){var u=l.__posthog_layer__;if(u.next===o)return void(u.next=a.next);l=u.next}else s[r]=a.next}}catch{return In}})(v.history,i,(s=>function(r,n,a){s.call(this,r,n,a),t.Lo(i)}))}}Lo(i){try{var e,t=v==null||(e=v.location)==null?void 0:e.pathname;if(!t)return;t!==this.Oo&&this.isEnabled&&this._instance.capture(_t,{navigation_type:i}),this.Oo=t}catch(s){E.error("Error capturing "+i+" pageview",s)}}$o(){if(!this.Fo){var i=()=>{this.Lo("popstate")};re(v,"popstate",i),this.Fo=()=>{v&&v.removeEventListener("popstate",i)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(i){var e;this.Do=!1,this.Co=!1,this.No=null,this.instance=i,this.Do=!((e=this.instance.persistence)==null||!e.props[Bs]),this.rageclicks=new $n(i.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var i=5e3;return K(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(i=this.Te.capture_heatmaps.flush_interval_milliseconds),i}get isEnabled(){return C(this.Te.capture_heatmaps)?C(this.Te.enable_heatmaps)?this.Do:this.Te.enable_heatmaps:this.Te.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Co)return;Tu.info("starting..."),this.qo(),this.xe()}else{var i;clearInterval((i=this.No)!==null&&i!==void 0?i:void 0),this.jo(),this.getAndClearBuffer()}}onRemoteConfig(i){if(i.ok){var e=i.config;if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Bs]:t}),this.Do=t,this.startIfEnabled()}}}getAndClearBuffer(){var i=this.R;return this.R=void 0,i}Bo(i){Ps(i.originalEvent)&&this.pe(i.originalEvent,"deadclick")}xe(){this.No&&clearInterval(this.No),this.No=S?.visibilityState==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}qo(){v&&S&&(this.Ho=this.oi.bind(this),re(v,qi,this.Ho),this.Uo=i=>this.pe(i||v?.event),re(S,"click",this.Uo,{capture:!0}),this.zo=i=>this.Vo(i||v?.event),re(S,"mousemove",this.zo,{capture:!0}),this.Wo=new dn(this.instance,ql,this.Bo.bind(this)),this.Wo.startIfEnabledOrStop(),this.Zo=this.xe.bind(this),re(S,ji,this.Zo),this.Co=!0)}jo(){var i;v&&S&&(this.Ho&&v.removeEventListener(qi,this.Ho),this.Uo&&S.removeEventListener("click",this.Uo,{capture:!0}),this.zo&&S.removeEventListener("mousemove",this.zo,{capture:!0}),this.Zo&&S.removeEventListener(ji,this.Zo),clearTimeout(this.Go),(i=this.Wo)==null||i.stop(),this.Co=!1)}Qo(i,e){var t=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=(function(a,o,l){for(var u=a;u&&Ye(u)&&!ke(u,"body");){if(u===l)return!1;var c=void 0;try{var h,d,p;c=(h=(d=(p=u.ownerDocument)==null?void 0:p.defaultView)!==null&&d!==void 0?d:v)==null?void 0:h.getComputedStyle(u).position}catch{return!1}if(M(o,c))return!0;u=Ba(u)}return!1})(hs(i),["fixed","sticky"],r);return{x:i.clientX+(n?0:s),y:i.clientY+(n?0:t),target_fixed:n,type:e}}pe(i,e){var t;if(e===void 0&&(e="click"),!en(i.target)&&Ps(i)){var s=this.Qo(i,e);(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,new Date().getTime())&&nn(hs(i),this.instance.config.rageclick)&&this.Wt(y({},s,{type:"rageclick"})),this.Wt(s)}}Vo(i){!en(i.target)&&Ps(i)&&(clearTimeout(this.Go),this.Go=setTimeout((()=>{this.Wt(this.Qo(i,"mousemove"))}),500))}Wt(i){if(v){var e=this.Te.disable_capture_url_hashes?Ke(v.location.href):v.location.href,t=this.Te.custom_personal_data_properties,s=this.Te.mask_personal_data_properties?[...Tt,...t||[]]:[],r=si(e,s,ri);this.R=this.R||{},this.R[r]||(this.R[r]=[]),this.R[r].push(i)}}oi(){this.R&&!Xe(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:dn,webVitalsAutocapture:class{constructor(i){var e;this.Do=!1,this.Co=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Jo=()=>{clearTimeout(this.Ko),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((t,s)=>y({},t,{["$web_vitals_"+s.name+"_event"]:y({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Yo=t=>{var s;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Xo();if(!x(r))if(C(t?.name)||C(t?.value))it.error("Invalid metric received",t);else if(!this.ta||this.ta>t.value){this.R.url!==r&&(this.Jo(),this.Ko=setTimeout(this.Jo,this.flushToCaptureTimeoutMs)),x(this.R.url)&&(this.R.url=r),this.R.firstMetricTimestamp=x(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var n=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0),a=y({},t,{$current_url:r,timestamp:Date.now()});x(n)||(a.$session_id=n.sessionId,a.$window_id=n.windowId),this.R.metrics.push(a),this.R.metrics.length===this.allowedMetrics.length&&this.Jo()}else it.error("Ignoring metric with value >= "+this.ta,t)},this.ea=()=>{if(!this.Co){var t,s,r,n,a=$.__PosthogExtensions__;if(!x(a)&&!x(a.postHogWebVitalsCallbacks)){var o=a.postHogWebVitalsCallbacks;t=o.onLCP,s=o.onCLS,r=o.onFCP,n=o.onINP}t&&s&&r&&n?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.Yo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.Yo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Yo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&n(this.Yo.bind(this)),this.Co=!0):it.error("web vitals callbacks not loaded - not starting")}},this._instance=i,this.Do=!((e=this._instance.persistence)==null||!e.props[Gs]),this.startIfEnabled()}get ra(){return this._instance.config.capture_performance}get allowedMetrics(){var i,e,t=K(this.ra)?(i=this.ra)==null?void 0:i.web_vitals_allowed_metrics:void 0;return C(t)?((e=this._instance.persistence)==null?void 0:e.props[Vs])||["CLS","FCP","INP","LCP"]:t}get flushToCaptureTimeoutMs(){return(K(this.ra)?this.ra.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var i=K(this.ra)?this.ra.web_vitals_attribution:void 0;return i!=null&&i}get ta(){var i=K(this.ra)&&de(this.ra.__web_vitals_max_value)?this.ra.__web_vitals_max_value:Mn;return i>0&&6e4>=i?Mn:i}get isEnabled(){var i=oe?.protocol;if(i!=="http:"&&i!=="https:")return it.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=K(this.ra)?this.ra.web_vitals:Ce(this.ra)?this.ra:void 0;return Ce(e)?e:this.Do}startIfEnabled(){this.isEnabled&&!this.Co&&(it.info("enabled, starting..."),this.tr(this.ea))}onRemoteConfig(i){if(i.ok){var e=i.config;if("capturePerformance"in e){var t=K(e.capturePerformance)&&!!e.capturePerformance.web_vitals,s=K(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Gs]:t}),this._instance.persistence.register({[Vs]:s})),this.Do=t,this.startIfEnabled()}}}tr(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(s=>{s?it.error("failed to load script",s):i()}))}Xo(){var i=v?this._instance.config.disable_capture_url_hashes?Ke(v.location.href):v.location.href:void 0;if(i){var e=this._instance.config.custom_personal_data_properties,t=this._instance.config.mask_personal_data_properties?[...Tt,...e||[]]:[];return si(i,t,ri)}it.error("Could not determine current URL")}}},Lu={exceptionObserver:class{constructor(i){var e;this.ea=()=>{var t;if(v&&this.isEnabled&&(t=$.__PosthogExtensions__)!=null&&t.errorWrappingFunctions){var s=$.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=$.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=$.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ia&&this.Te.capture_unhandled_errors&&(this.ia=s(this.captureException.bind(this))),!this.na&&this.Te.capture_unhandled_rejections&&(this.na=r(this.captureException.bind(this))),!this.sa&&this.Te.capture_console_errors&&(this.sa=n(this.captureException.bind(this)))}catch(a){jt.error("failed to start",a),this.oa()}}},this._instance=i,this.aa=!((e=this._instance.persistence)==null||!e.props[Hs]),this.la=new Ao(y({},(function(t){var s,r,n,a;return t===void 0&&(t={}),{refillRate:(s=(r=t.exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:t.__exceptionRateLimiterRefillRate)!==null&&s!==void 0?s: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,it:jt})),this.Te=this.ua(),this.startIfEnabledOrStop()}ua(){var i=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return K(i)?e=y({},e,i):(x(i)?this.aa:i)&&(e=y({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Te.capture_console_errors||this.Te.capture_unhandled_errors||this.Te.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(jt.info("enabled"),this.oa(),this.tr(this.ea)):this.oa()}tr(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return jt.error("failed to load script",s);i()}))}oa(){var i,e,t;(i=this.ia)==null||i.call(this),this.ia=void 0,(e=this.na)==null||e.call(this),this.na=void 0,(t=this.sa)==null||t.call(this),this.sa=void 0}onRemoteConfig(i){if(i.ok){var e=i.config;"autocaptureExceptions"in e&&(this.aa=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Hs]:this.aa}),this.Te=this.ua(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ua()}captureException(i){var e,t,s,r=(e=i==null||(t=i.$exception_list)==null||(t=t[0])==null?void 0:t.type)!==null&&e!==void 0?e:"Exception";this.la.consumeRateLimit(r)?jt.info("Skipping exception capture because of client rate limiting.",{exception:r}):(s=this._instance.exceptions)==null||s.sendExceptionEvent(i)}},exceptions:class{constructor(i){var e,t;this.ha=[],this.da=new Zo([new al,new gl,new ll,new ol,new pl,new dl,new cl,new vl],(function(s){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 u=[],c=o.split(`
|
|
2
|
+
`),h=l;c.length>h;h++){var d=c[h];if(1024>=d.length){var p=Kr.test(d)?d.replace(Kr,"$1"):d;if(!p.match(/\S*Error: /)){for(var f of n){var g=f(p,s);if(g){u.push(g);break}}if(u.length>=50)break}}}return(function(m){if(!m.length)return[];var b=Array.from(m);return b.reverse(),b.slice(0,50).map((P=>{return y({},P,{filename:P.filename||(_=b,_[_.length-1]||{}).filename,function:P.function||St});var _}))})(u)}})("web:javascript",il,nl)),this._instance=i,this.ha=(e=(t=this._instance.persistence)==null?void 0:t.get_property(zs))!==null&&e!==void 0?e:[],this.ca=Oi(this.va()),this.fa=new _l(this.ca)}onConfigChange(){this.ca=Oi(this.va()),this.fa.setConfig(this.ca)}onRemoteConfig(i){var e,t,s;if(i.ok){var r=i.config;if("errorTracking"in r){var n=(e=(t=r.errorTracking)==null?void 0:t.suppressionRules)!==null&&e!==void 0?e:[],a=(s=r.errorTracking)==null?void 0:s.captureExtensionExceptions;this.ha=n,this._instance.persistence&&this._instance.persistence.register({[zs]:this.ha,[Us]:a})}}}get pa(){var i,e=!!this._instance.get_property(Us),t=this._instance.config.error_tracking.captureExtensionExceptions;return(i=t??e)!==null&&i!==void 0&&i}buildProperties(i,e){return this.da.buildFromUnknown(i,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(i,e){if(this.ca.enabled)try{if(!U(i)||i.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)=>fl.has(l)?(a.push(l),o):(o[l]=n[l],o)),{}),droppedKeys:a}})(this.ga(e)),s=t.sanitizedProperties,r=t.droppedKeys;r.length>0&&Ae.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.fa.add(y({[Ri]:i,[Ci]:new Date().toISOString()},s))}catch(n){Ae.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(i){try{var e=i.$exception_list;if(this.ma(e)){if(this.ya(e))return this.ba("Exception dropped: matched a suppression rule"),void Ae.info("Skipping exception capture because a suppression rule matched");if(!this.pa&&this._a(e))return this.ba("Exception dropped: thrown by a browser extension"),void Ae.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.wa(e))return this.ba("Exception dropped: thrown by the PostHog SDK"),void Ae.info("Skipping exception capture because it was thrown by the PostHog SDK")}var t=this.ca.enabled&&C(i.$exception_steps)?this.xa(i):i,s=typeof(n=globalThis._posthogReleaseId)=="string"&&n.length>0?n:void 0;s&&(t.$release_id=s);try{var r=this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",Pn:!0});return r&&this.fa.clear(),r}catch(a){return Ae.error("Failed to capture exception event. Dropping this exception.",a),void this.fa.clear()}}catch(a){return void Ae.error("Failed to process exception event. Ignoring this exception.",a)}var n}xa(i){try{var e=this.fa.getAttachable();return e.length===0?i:y({},i,{$exception_steps:e})}catch(t){return Ae.error("Failed to read buffered exception steps. Capturing exception without steps.",t),i}}ba(i){this.ca.enabled&&this.fa.add({[Ri]:i,[Ci]:new Date().toISOString()})}ga(i){return K(i)?y({},i):{}}va(){var i,e;return(i=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&i!==void 0?i:{}}ya(i){if(i.length===0)return!1;try{var e=i.reduce(((t,s)=>{var r=s.type,n=s.value;return U(r)&&r.length>0&&t.$exception_types.push(r),U(n)&&n.length>0&&t.$exception_values.push(n),t}),{$exception_types:[],$exception_values:[]});return this.ha.some((t=>{var s=t.values.map((r=>{var n=_o[r.operator],a=e[r.key];if(!n||!a)return!1;var o=R(r.value)?r.value:[r.value];return o.length>0&&n(o,a)}));return t.type==="OR"?s.some(Boolean):s.every(Boolean)}))}catch(t){return Ae.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}_a(i){return i.flatMap((e=>{var t,s;return(t=(s=e.stacktrace)==null?void 0:s.frames)!==null&&t!==void 0?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}wa(i){if(i.length>0){var e,t,s,r,n=(e=(t=i[0].stacktrace)==null?void 0:t.frames)!==null&&e!==void 0?e:[],a=n[n.length-1];return(s=a==null||(r=a.filename)==null?void 0:r.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}ma(i){return!C(i)&&R(i)}}},Du=y({productTours:class{get mi(){return this._instance.persistence}constructor(i){this.ka=null,this.Sa=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(i.ok){var e=i.config;if("productTours"in e){var t,s;if(this.mi&&this.mi.register({[wr]:!!e.productTours}),!Fs(this._instance))return!this.ka&&C((t=this.mi)==null?void 0:t.props[Gt])||Ts.info("product tours disabled; stopping and clearing cached tours"),(s=this.ka)==null||s.stop(),this.ka=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.ka&&Fs(this._instance)&&this.tr((()=>this.Ca()))}tr(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.generateProductTours?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"product-tours",(s=>{s?Ts.error("Could not load product tours script",s):i()}))}Ca(){var i;!this.ka&&(i=$.__PosthogExtensions__)!=null&&i.generateProductTours&&(this.ka=$.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(i,e){if(e===void 0&&(e=!1),!R(this.Sa)||e){var t=this.mi;if(t){var s=t.props[Gt];if(R(s)&&!e)return this.Sa=s,void i(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:r=>{if(Fs(this._instance)){var n=r.statusCode;if(n!==200||!r.json){var a="Product Tours API could not be loaded, status: "+n;return Ts.error(a),void i([],{isLoaded:!1,error:a})}var o=R(r.json.product_tours)?r.json.product_tours:[];this.Sa=o,t&&t.register({[Gt]:o}),i(o,{isLoaded:!0})}else i([],{isLoaded:!0})}})}else i(this.Sa,{isLoaded:!0})}getActiveProductTours(i){C(this.ka)?i([],{isLoaded:!1,error:"Product tours not loaded"}):this.ka.getActiveProductTours(i)}showProductTour(i){var e;(e=this.ka)==null||e.showTourById(i)}previewTour(i){this.ka?this.ka.previewTour(i):this.tr((()=>{var e;this.Ca(),(e=this.ka)==null||e.previewTour(i)}))}dismissProductTour(){var i;(i=this.ka)==null||i.dismissTour("user_clicked_skip")}nextStep(){var i;(i=this.ka)==null||i.nextStep()}previousStep(){var i;(i=this.ka)==null||i.previousStep()}clearCache(){var i;this.Sa=null,(i=this.mi)==null||i.unregister(Gt)}resetTour(i){var e;(e=this.ka)==null||e.resetTour(i)}resetAllTours(){var i;(i=this.ka)==null||i.resetAllTours()}cancelPendingTour(i){var e;(e=this.ka)==null||e.cancelPendingTour(i)}}},Zi),Nu={siteApps:class{constructor(i){this.Ma=0,this._instance=i,this.Ia=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ta(i,e){if(e){var t=this.globalsForEvent(e);this.Ia.push(t),this.Ia.length>1e3&&(this.Ia=this.Ia.slice(10))}}get siteAppLoaders(){var i;return(i=$._POSTHOG_REMOTE_CONFIG)==null||(i=i[this._instance.config.token])==null?void 0:i.siteApps}initialize(){if(this.isEnabled){var i=this._instance._addCaptureHook(this.Ta.bind(this));this.Ea=()=>{i(),this.Ia=[],this.Ea=void 0}}}globalsForEvent(i){var e,t,s,r,n,a,o;if(!i)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var h of Object.entries(c)){var d=h[0];l[d]={id:u[d],type:d,properties:h[1]}}var p=i.$set_once,f=i.$set;return{event:y({},zn(i,Fu),{properties:y({},i.properties,f?{$set:y({},(e=(t=i.properties)==null?void 0:t.$set)!==null&&e!==void 0?e:{},f)}:{},p?{$set_once:y({},(s=(r=i.properties)==null?void 0:r.$set_once)!==null&&s!==void 0?s:{},p)}:{}),elements_chain:(n=(a=i.properties)==null?void 0:a.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(o=i.properties)==null?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}Ra(i){var e,t=(e=i.tagName)==null?void 0:e.toLowerCase();return t==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(i)||(Oe.error("prepare_external_dependency_stylesheet returned null"),null):t==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(i)||(Oe.error("prepare_external_dependency_script returned null"),null):i}Pa(){var i,e,t,s,r,n,a,o;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=S?.defaultView,u=l==null||(i=l.Node)==null?void 0:i.prototype;if(!l||!u)return()=>{};if(this.Ma++,this.Oa)return this.Fa();var c=[],h=this,d=new WeakSet,p=(m,b,P)=>{if(m!=null&&m[b]){var _=m[b];m[b]=P(_),c.push((()=>{m[b]=_}))}},f=m=>{if(d.has(m))return m;var b=h.Ra(m);return b&&d.add(b),b},g=m=>m.map((b=>typeof b=="string"?b:f(b))).filter((b=>!ye(b)));return p(u,"appendChild",(m=>function(b){var P=f(b);return P?m.call(this,P):b})),p(u,"insertBefore",(m=>function(b,P){var _=f(b);return _?m.call(this,_,P):b})),p(u,"replaceChild",(m=>function(b,P){var _=f(b);return _?m.call(this,_,P):P})),[(e=l.Element)==null?void 0:e.prototype,(t=l.Document)==null?void 0:t.prototype,(s=l.DocumentFragment)==null?void 0:s.prototype].forEach((m=>{p(m,"append",(b=>function(){for(var P=arguments.length,_=new Array(P),k=0;P>k;k++)_[k]=arguments[k];return b.apply(this,g(_))})),p(m,"prepend",(b=>function(){for(var P=arguments.length,_=new Array(P),k=0;P>k;k++)_[k]=arguments[k];return b.apply(this,g(_))}))})),[(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",(b=>function(){for(var P=arguments.length,_=new Array(P),k=0;P>k;k++)_[k]=arguments[k];return b.apply(this,g(_))})),p(m,"after",(b=>function(){for(var P=arguments.length,_=new Array(P),k=0;P>k;k++)_[k]=arguments[k];return b.apply(this,g(_))})),p(m,"replaceWith",(b=>function(){for(var P=arguments.length,_=new Array(P),k=0;P>k;k++)_[k]=arguments[k];var F=g(_);return _.length&&!F.length?void 0:b.apply(this,F)}))})),p((o=l.Element)==null?void 0:o.prototype,"insertAdjacentElement",(m=>function(b,P){var _=f(P);return _?m.call(this,b,_):null})),this.Oa=()=>{c.forEach((m=>m())),this.Oa=void 0},this.Fa()}Fa(){var i=!1;return()=>{var e;i||(i=!0,this.Ma--,this.Ma===0&&((e=this.Oa)==null||e.call(this)))}}Aa(i,e){e===void 0&&(e=!0);var t=this.Pa();try{var s=i(t);return e&&t(),s}catch(r){throw t(),r}}setupSiteApp(i){var e=this.apps[i.id],t=()=>{var a;!e.errored&&this.Ia.length&&(Oe.info("Processing "+this.Ia.length+" events for site app with id "+i.id),this.Ia.forEach((o=>this.Aa((()=>e.processEvent==null?void 0:e.processEvent(o))))),e.processedBuffer=!0),Object.values(this.apps).every((o=>o.processedBuffer||o.errored))&&((a=this.Ea)==null||a.call(this))},s=!1,r=a=>{e.errored=!a,e.loaded=!0,Oe.info("Site app with id "+i.id+" "+(a?"loaded":"errored")),s&&t()};try{var n=this.Aa((a=>i.init({posthog:this._instance,callback(o){a(),r(o)}})),!1).processEvent;n&&(e.processEvent=n),s=!0}catch(a){Oe.error(On+i.id,a),r(!1)}if(s&&e.loaded)try{t()}catch(a){Oe.error("Error while processing buffered events PostHog app with config id "+i.id,a),e.errored=!0}}$a(){var i=this.siteAppLoaders||[];for(var e of i)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var t of i)this.setupSiteApp(t)}La(i){var e=this;if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(i),s=function(n){try{e.Aa((()=>n.processEvent==null?void 0:n.processEvent(t)))}catch(a){Oe.error("Error while processing event "+i.event+" for site app "+n.id,a)}};for(var r of Object.values(this.apps))s(r)}}onRemoteConfig(i){var e,t,s,r=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.$a(),void this._instance.on("eventCaptured",(l=>this.La(l)))):void Oe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((t=this.Ea)==null||t.call(this),i.ok){var n=i.config;if((s=n.siteApps)!=null&&s.length)if(this.isEnabled){var a=function(){var l,u=o.id,c=o.url;$["__$$ph_site_app_"+u]=r._instance,(l=$.__PosthogExtensions__)==null||l.loadSiteApp==null||l.loadSiteApp(r._instance,c,(h=>{if(h)return Oe.error(On+u,h)}))};for(var o of n.siteApps)a()}else Oe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},ju={tracingHeaders:class{constructor(i){this.Da=void 0,this.Na=void 0,this.qa=void 0,this.ea=()=>{var e,t,s=this.ja();s?(x(this.Da)&&(this.Da=(e=$.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),x(this.Na)&&(this.Na=(t=$.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchFetch(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.oa()},this._instance=i}initialize(){this.startIfEnabledOrStop()}tr(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return Pu.error("failed to load script",s);i()}))}Ba(){var i,e;return(i=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&i!==void 0?i:this._instance.config.__add_tracing_headers}ja(){var i=this.Ba();return R(i)?(R(this.qa)?this.qa.splice(0,this.qa.length,...i):this.qa=[...i],i.length>0?this.qa:void 0):(R(this.qa)&&this.qa.splice(0),this.qa=i||void 0,this.qa)}oa(){var i,e;(i=this.Da)==null||i.call(this),(e=this.Na)==null||e.call(this),this.Da=void 0,this.Na=void 0}startIfEnabledOrStop(){this.ja()?this.tr(this.ea):this.oa()}}},qu=y({surveys:class{get Te(){return this._instance.config}constructor(i){this.Ha=void 0,this._surveyManager=null,this.Ua=!1,this.za=[],this.Va=null,this.Wa=null,this._instance=i,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this.Te.disable_surveys){if(!i.ok)return H.warn("Remote config unavailable. Not loading surveys.");var e=i.config.surveys;if(C(e))return H.warn("Flags not loaded yet. Not loading surveys.");var t=R(e);this.Ha=t?e.length>0:e,H.info("flags response received, isSurveysEnabled: "+this.Ha),this.loadIfEnabled()}}reset(){try{var i;(i=this._surveyEventReceiver)==null||i.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var s=localStorage.key(t);(s!=null&&s.startsWith(bo)||s!=null&&s.startsWith("inProgressSurvey_"))&&e.push(s)}e.forEach((r=>localStorage.removeItem(r)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.Ua)H.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)H.info(An);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())H.info("Not loading surveys in cookieless mode without consent.");else{var i=$?.__PosthogExtensions__;if(i){if(!x(this.Ha)||this.Te.advanced_enable_surveys){var e=this.Ha||this.Te.advanced_enable_surveys;this.Ua=!0;try{var t=i.generateSurveys;if(t)return void this.Za(t,e);var s=i.loadExternalDependency;if(!s)return void this.Ga(Er);s(this._instance,"surveys",(r=>{r||!i.generateSurveys?this.Ga("Could not load surveys script",r):this.Za(i.generateSurveys,e)}))}catch(r){throw this.Ga("Error initializing surveys",r),r}finally{this.Ua=!1}}}else H.error("PostHog Extensions not found.")}}Za(i,e){this._surveyManager=i(this._instance,e),this._surveyEventReceiver=new Mu(this._instance),H.info("Surveys loaded successfully"),this.Qa({isLoaded:!0})}Ga(i,e){H.error(i,e),this.Qa({isLoaded:!1,error:i})}onSurveysLoaded(i){return this.za.push(i),this._surveyManager&&this.Qa({isLoaded:!0}),()=>{this.za=this.za.filter((e=>e!==i))}}getSurveys(i,e){if(e===void 0&&(e=!1),this.Te.disable_surveys)return H.info(An),i([]);var t,s=this._instance.get_property(Xs);if(s&&!e)return i(s,{isLoaded:!0}),void(this.Ja()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Va?this.Va.then((r=>i(r.surveys,r.context))):(typeof Promise<"u"&&(this.Va=new Promise((r=>{t=r}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Te.token),method:"GET",timestampMode:"query",timeout:this.Te.surveys_request_timeout_ms,callback:r=>{var n;this.Va=null;var a=r.statusCode;if(a!==200||!r.json){var o="Surveys API could not be loaded, status: "+a;H.error(o),this.Wa=Date.now();var l={isLoaded:!1,error:o};return i([],l),void(t==null||t({surveys:[],context:l}))}this.Wa=null;var u,c=r.json.surveys||[],h=c.filter((p=>(function(f){return!(!f.start_date||f.end_date)})(p)&&(yo(p)||(function(f){var g;return!((g=f.conditions)==null||(g=g.actions)==null||(g=g.values)==null||!g.length)})(p))));h.length>0&&((u=this._surveyEventReceiver)==null||u.register(h)),(n=this._instance.persistence)==null||n.register({[Xs]:c,[Li]:Date.now()});var d={isLoaded:!0};i(c,d),t?.({surveys:c,context:d})}}))}Ja(){return this.Ka()&&!this.Va&&!this.Ya()}Ka(){var i=this._instance.get_property(Li);return de(i)&&Date.now()-i>3e5}Ya(){return de(this.Wa)&&3e5>Date.now()-this.Wa}markSurveyAsSeen(i,e){var t,s={id:i,current_iteration:(t=e?.iteration)!==null&&t!==void 0?t:null};wo(s);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Qa(i){for(var e of this.za)try{if(!i.isLoaded)return e([],i);this.getSurveys(e)}catch(t){H.error("Error in survey callback",t)}}getActiveMatchingSurveys(i,e){if(e===void 0&&(e=!1),!C(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(i,e);H.warn("init was not called")}Xa(i){var e=null;return this.getSurveys((t=>{var s;e=(s=t.find((r=>r.id===i)))!==null&&s!==void 0?s:null})),e}tl(i){if(C(this._surveyManager))return{eligible:!1,reason:mi};var e=typeof i=="string"?this.Xa(i):i;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}el(i){if(C(this._surveyManager))return{eligible:!1,reason:mi};var e=typeof i=="string"?this.Xa(i):i;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(i){if(C(this._surveyManager))return H.warn("init was not called"),{visible:!1,disabledReason:mi};var e=this.el(i);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(i,e){return C(this._surveyManager)?(H.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:mi})):new Promise((t=>{this.getSurveys((s=>{var r,n=(r=s.find((o=>o.id===i)))!==null&&r!==void 0?r:null;if(n){var a=this.el(n);t({visible:a.eligible,disabledReason:a.reason})}else t({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(i,e,t){var s;if(C(this._surveyManager))H.warn("init was not called");else{var r=typeof i=="string"?this.Xa(i):i;if(r!=null&&r.id)if(pu.includes(r.type)){var n=S?.querySelector(e);if(n)return(s=r.appearance)!=null&&s.surveyPopupDelaySeconds?(H.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,o;H.info("Rendering survey "+r.id+" with delay of "+((a=r.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(o=this._surveyManager)==null||o.renderSurvey(r,n,t),H.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,t);H.warn("Survey element not found")}else H.warn("Surveys of type "+r.type+" cannot be rendered in the app");else H.warn("Survey not found")}}displaySurvey(i,e){var t;if(C(this._surveyManager))H.warn("init was not called");else{var s=this.Xa(i);if(s){var r=s;if((t=s.appearance)!=null&&t.surveyPopupDelaySeconds&&e.ignoreDelay&&(r=y({},s,{appearance:y({},s.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==ar.Popover&&e.initialResponses&&H.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var n=this.tl(s);if(!n.eligible)return void H.warn("Survey is not eligible to be displayed: ",n.reason)}e.displayType!==ar.Inline?this._surveyManager.handlePopoverSurvey(r,e):this.renderSurvey(r,e.selector,e.properties)}else H.warn("Survey not found")}}cancelPendingSurvey(i){C(this._surveyManager)?H.warn("init was not called"):this._surveyManager.cancelSurvey(i)}handlePageUnload(){var i;(i=this._surveyManager)==null||i.handlePageUnload==null||i.handlePageUnload()}}},Zi),Bu={toolbar:class{constructor(i){this.instance=i}rl(i){$.ph_toolbar_state=i}il(){var i;return(i=$.ph_toolbar_state)!==null&&i!==void 0?i:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,t){if(i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),Ra(this.instance.config)||!v||!S)return!1;i=i??v.location,t=t??v.history;try{if(!e){try{v.localStorage.setItem("test","test"),v.localStorage.removeItem("test")}catch{return!1}e=v?.localStorage}var s,r=Ru||Ui(i.hash,"__posthog")||Ui(i.hash,"state"),n=r?Zr((()=>JSON.parse(atob(decodeURIComponent(r)))))||Zr((()=>JSON.parse(decodeURIComponent(r)))):null;return n&&n.action==="ph_authorize"?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?i.hash=n.desiredHash:t?t.replaceState(t.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem(Ln)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}nl(i){var e=$.ph_load_toolbar||$.ph_load_editor;!C(e)&&Ee(e)?e(i,this.instance):Dn.warn("No toolbar load function found")}loadToolbar(i){var e=!(S==null||!S.getElementById(La));if(!v||e)return!1;var t=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=y({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},t?{instrument:!1}:{});if(v.localStorage.setItem(Ln,JSON.stringify(y({},s,{source:void 0}))),this.il()===2)this.nl(s);else if(this.il()===0){var r;this.rl(1),(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"toolbar",(n=>{if(n)return Dn.error("[Toolbar] Failed to load",n),void this.rl(0);this.rl(2),this.nl(s)})),re(v,"turbolinks:load",(()=>{this.rl(0),this.loadToolbar(s)}))}return!0}sl(i){return this.loadToolbar(i)}maybeLoadEditor(i,e,t){return i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.maybeLoadToolbar(i,e,t)}}},Hu=y({experiments:ve},Zi),zu={conversations:class{constructor(i){this.ol=void 0,this._conversationsManager=null,this.al=!1,this.ll=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this._instance.config.disable_conversations&&i.ok){var e=i.config.conversations;C(e)||(Ce(e)?this.ol=e:(this.ol=e.enabled,this.ll=e),this.loadIfEnabled())}}reset(){var i;(i=this._conversationsManager)==null||i.reset(),this._conversationsManager=null,this.ol=void 0,this.ll=null}loadIfEnabled(){if(!(this._conversationsManager||this.al||this._instance.config.disable_conversations||Ra(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=$?.__PosthogExtensions__;if(i&&!x(this.ol)&&this.ol)if(this.ll&&this.ll.token){this.al=!0;try{var e=i.initConversations;if(e)return this.ul(e),void(this.al=!1);var t=i.loadExternalDependency;if(!t)return void this.hl(Er);t(this._instance,"conversations",(s=>{s||!i.initConversations?this.hl("Could not load conversations script",s):this.ul(i.initConversations),this.al=!1}))}catch(s){this.hl("Error initializing conversations",s),this.al=!1}}else Te.error("Conversations enabled but missing token in remote config.")}}ul(i){if(this.ll)try{this._conversationsManager=i(this.ll,this._instance),Te.info("Conversations loaded successfully")}catch(e){this.hl("Error completing conversations initialization",e)}else Te.error("Cannot complete initialization: remote config is null")}hl(i,e){Te.error(i,e),this._conversationsManager=null,this.al=!1}show(){this._conversationsManager?this._conversationsManager.show():Te.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.ol===!0&&!ye(this._conversationsManager)}isVisible(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&i!==void 0&&i}sendMessage(i,e,t){var s=this;return Y((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(i,e,t):(Te.warn(rt),null)}))()}getMessages(i,e){var t=this;return Y((function*(){return t._conversationsManager?t._conversationsManager.getMessages(i,e):(Te.warn(rt),null)}))()}markAsRead(i){var e=this;return Y((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(i):(Te.warn(rt),null)}))()}getTickets(i){var e=this;return Y((function*(){return e._conversationsManager?e._conversationsManager.getTickets(i):(Te.warn(rt),null)}))()}requestRestoreLink(i){var e=this;return Y((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(i):(Te.warn(rt),null)}))()}restoreFromToken(i){var e=this;return Y((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(i):(Te.warn(rt),null)}))()}restoreFromUrlToken(){var i=this;return Y((function*(){return i._conversationsManager?i._conversationsManager.restoreFromUrlToken():(Te.warn(rt),null)}))()}getCurrentTicketId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&i!==void 0?i:null}getWidgetSessionId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&i!==void 0?i:null}Nn(){var i;(i=this._conversationsManager)==null||i.setIdentity()}qn(){var i;(i=this._conversationsManager)==null||i.clearIdentity()}}},Uu={logs:class{constructor(i){var e;this.dl=!1,this.cl=!1,this.it=Q("[logs]"),this.Gr=[],this.vl=[],this.Js=0,this.fl=()=>{var t,s;this.Js=0,(t=this.pl)==null||t.onReconnect(),(s=this.gl)==null||s.onReconnect()},this._instance=i,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.dl=!0),v&&re(v,"online",this.fl)}ml(i,e,t,s){var r,n=(function(a,o){var l,u,c,h,d,p,f,g=(l=a?.flushIntervalMs)!==null&&l!==void 0?l:3e3,m=(u=a?.maxBufferSize)!==null&&u!==void 0?u:100,b=o!=null&&o.consoleCapture?void 0:(c=a?.maxLogsPerInterval)!==null&&c!==void 0?c:1e3,P=x(b)?Math.max(m,2048):Math.max(m,b),_=a?.resourceAttributes;return{serviceName:(h=(d=_?.["service.name"])!==null&&d!==void 0?d:a?.serviceName)!==null&&h!==void 0?h:o?.serviceNameDefault,serviceVersion:(p=_?.["service.version"])!==null&&p!==void 0?p:a?.serviceVersion,environment:(f=_?.["deployment.environment"])!==null&&f!==void 0?f:a?.environment,resourceAttributes:_,beforeSend:a?.beforeSend,flushIntervalMs:g,maxBufferSize:m,maxQueueSize:P,maxBatchRecordsPerPost:100,rateCapWindowMs:g,maxLogsPerInterval:b,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((r=this._instance)==null||(r=r.config)==null?void 0:r.logs,t);return[new Xo(this.yl(i,e),n,this.it,(()=>this.bl()),(a=>a()),void 0,s),n]}_l(){var i,e=(i=this._instance)==null||(i=i.config)==null?void 0:i.logs;if(!this.pl||this.wl!==e){var t;(t=this.pl)==null||t.reset(),this.wl=e;var s=this.ml((()=>this.Gr),(r=>{this.Gr=r}));this.pl=s[0],this.xl=s[1]}return this.pl}kl(){var i,e=(i=this._instance)==null||(i=i.config)==null?void 0:i.logs;if(!this.gl||this.Sl!==e){var t;(t=this.gl)==null||t.reset(),this.Sl=e;var s=this.ml((()=>this.vl),(r=>{this.vl=r}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Bn);this.gl=s[0],this.Cl=s[1]}return this.gl}initialize(){this.loadIfEnabled()}onRemoteConfig(i){var e;if(i.ok){var t=(e=i.config.logs)==null?void 0:e.captureConsoleLogs;!C(t)&&t&&(this.dl=!0,this.loadIfEnabled())}}reset(){var i,e;this.Gr=[],(i=this.pl)==null||i.reset(),this.vl=[],(e=this.gl)==null||e.reset(),this.Js=0}captureLog(i){this._l().captureLog(i)}le(i){this.kl().captureLog(i)}get logger(){return this.Ml||(this.Ml={trace:(i,e)=>this.captureLog({body:i,level:"trace",attributes:e}),debug:(i,e)=>this.captureLog({body:i,level:"debug",attributes:e}),info:(i,e)=>this.captureLog({body:i,level:"info",attributes:e}),warn:(i,e)=>this.captureLog({body:i,level:"warn",attributes:e}),error:(i,e)=>this.captureLog({body:i,level:"error",attributes:e}),fatal:(i,e)=>this.captureLog({body:i,level:"fatal",attributes:e})}),this.Ml}flushLogs(i){i?this.Il(i):(this.pl&&this.pl.flush().catch((e=>this.it.error("PostHog logs flush failed:",e))),this.gl&&this.gl.flush().catch((e=>this.it.error("PostHog logs flush failed:",e))))}loadIfEnabled(){if(this.dl&&!this.cl){var i=$?.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",(t=>{var s;t||(s=i.logs)==null||!s.initializeLogs?this.it.error("Could not load logs script",t):(i.logs.initializeLogs(this._instance),this.cl=!0)})):this.it.error(Er)}else this.it.error("PostHog Extensions not found.")}}yl(i,e){var t=this._instance;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},getPersistedProperty:s=>s===Be.LogsQueue?i():void 0,setPersistedProperty(s,r){var n;s===Be.LogsQueue&&e((n=r)!==null&&n!==void 0?n:[])},$t:s=>this.$t(s),getLibraryId:()=>B.LIB_NAME,getLibraryVersion:()=>B.LIB_VERSION}}$t(i){return new Promise((e=>{if(Ja(this.Js,3))e({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var t=!1,s=n=>{t||(t=!0,clearTimeout(r),e(n))},r=setTimeout((()=>s({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Tl(),data:i,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:n=>{var a=n.statusCode;if(this.El(a),a>=200&&300>a)s({kind:"ok"});else if(a===413)s({kind:"too-large"});else if(a!==0&&a!==429&&500>a)s({kind:"fatal",error:new Error("logs request failed with status "+a)});else{var o;s({kind:"retry-later",error:(o=n.error)!==null&&o!==void 0?o:new Error("logs request failed with status "+a)})}}})}}))}El(i){(i!==0||this._instance.__loaded)&&(this.Js=Xa(i,this.Js,3,(()=>this.it.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."))))}Il(i){this.Gr.length>0&&this.Rl(i,this.Gr,this.xl,B.LIB_NAME,(e=>{this.Gr=e})),this.vl.length>0&&this.Rl(i,this.vl,this.Cl,Bn,(e=>{this.vl=e}))}Rl(i,e,t,s,r){if(e.length!==0){var n=e.map((o=>o.record));r([]);var a=ma(n,_a(t,B.LIB_NAME,B.LIB_VERSION),s,B.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Tl(),data:a,compression:"best-available",batchKey:"logs",transport:i})}}Tl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}bl(){var i,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var t=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),s=t.windowId,r=t.sessionStartTimestamp,n=t.lastActivityTimestamp;e.sessionId=t.sessionId,e.windowId=s,C(r)||(e.sessionStartTimestamp=r),C(n)||(e.lastActivityTimestamp=n)}if($!=null&&(i=$.location)!=null&&i.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Ke($.location.href):$.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(e.activeFeatureFlags=a)}return e}}},Gu={metrics:class{constructor(i){this.it=Q("[metrics]"),this._instance=i}initialize(){}_l(){var i,e,t=(i=this._instance)==null||(i=i.config)==null?void 0:i.metrics;return this.pl&&this.wl===t||((e=this.pl)==null||e.reset(),this.wl=t,this.pl=new Ko(this.yl(),(function(s){var r,n,a,o,l,u=s?.resourceAttributes;return{serviceName:(r=u?.["service.name"])!==null&&r!==void 0?r:s?.serviceName,serviceVersion:(n=u?.["service.version"])!==null&&n!==void 0?n:s?.serviceVersion,environment:(a=u?.["deployment.environment"])!==null&&a!==void 0?a:s?.environment,resourceAttributes:u,beforeSend:s?.beforeSend,flushIntervalMs:(o=s?.flushIntervalMs)!==null&&o!==void 0?o:1e4,maxSeriesPerFlush:(l=s?.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}})(t),this.it)),this.pl}count(i,e,t){e===void 0&&(e=1),this._l().count(i,e,t)}gauge(i,e,t){this._l().gauge(i,e,t)}histogram(i,e,t){this._l().histogram(i,e,t)}flush(i){if(!this.pl)return Promise.resolve();if(i){var e=this.pl.drainWindow();return e&&this.Kt(e,i),Promise.resolve()}return this.pl.flush().catch((t=>this.it.error("PostHog metrics flush failed:",t)))}reset(){var i;(i=this.pl)==null||i.reset()}yl(){var i=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},Kt:t=>e.Kt(t),getLibraryId:()=>B.LIB_NAME,getLibraryVersion:()=>B.LIB_VERSION}}Kt(i,e){return new Promise((t=>{var s=!1,r=a=>{s||(s=!0,clearTimeout(n),t(a))},n=setTimeout((()=>r({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(y({method:"POST",url:this.Pl(),data:i,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!==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)})}}}))}))}Pl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Vu=y({},Zi,Ou,Au,Lu,Du,Nu,qu,ju,Bu,Hu,zu,Uu,Gu);$e.__defaultExtensionClasses=y({},Vu);var Wu=(function(){B.SDK_DIST_CHANNEL="npm";var i=Yt[mt]=new $e;return(function(){function e(){e.done||(e.done=!0,Eo=!1,G(Yt,(function(t){t._dom_loaded()})))}S!=null&&S.addEventListener?S.readyState==="complete"?e():re(S,"DOMContentLoaded",e,{capture:!1}):v&&E.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),i})();export{_e as Compression,ar as DisplaySurveyType,$e as PostHog,Kl as ProductTourEventName,gn as ProductTourEventProperties,Ge as SurveyEventName,fs as SurveyEventProperties,Ot as SurveyEventType,gs as SurveyType,Wu as default,Wu as posthog};
|