tokentracker-cli 0.91.0 → 0.91.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/README.de.md +6 -5
  2. package/README.ja.md +8 -5
  3. package/README.ko.md +8 -5
  4. package/README.md +6 -5
  5. package/README.zh-CN.md +5 -4
  6. package/dashboard/dist/assets/{AchievementBadge-iyRg0rYF.js → AchievementBadge-LHOuekQ3.js} +1 -1
  7. package/dashboard/dist/assets/{AchievementsPage-CkBm3bN3.js → AchievementsPage-DNzeYWBl.js} +2 -2
  8. package/dashboard/dist/assets/{AchievementsSection-a4Z7VtlP.js → AchievementsSection-Ch5dImt8.js} +1 -1
  9. package/dashboard/dist/assets/{BadgeDetailModal-DHTN0Ky6.js → BadgeDetailModal-CuikWkUy.js} +1 -1
  10. package/dashboard/dist/assets/{Card-CdygGEqz.js → Card-Chwjmxjz.js} +1 -1
  11. package/dashboard/dist/assets/{ClawdAnimated-D-Z823Nc.js → ClawdAnimated-BdB7aycS.js} +1 -1
  12. package/dashboard/dist/assets/{CommandPalette-VGkj8w2X.js → CommandPalette-BMwuSEWM.js} +1 -1
  13. package/dashboard/dist/assets/{CommunityStatsModal-BDT4xqfF.js → CommunityStatsModal-eEDF-xn8.js} +1 -1
  14. package/dashboard/dist/assets/{ConfirmModal-BIKv4AlL.js → ConfirmModal-Be7f6XdL.js} +1 -1
  15. package/dashboard/dist/assets/{Controls-BkZVm9t1.js → Controls-CtBFPCBY.js} +1 -1
  16. package/dashboard/dist/assets/{DashboardPage-BFkdjUdd.js → DashboardPage-M0p-SU-f.js} +1 -1
  17. package/dashboard/dist/assets/{DevicePage-BGw861bu.js → DevicePage-CAfcUond.js} +1 -1
  18. package/dashboard/dist/assets/{DialogClose-CSEl6ru8.js → DialogClose-kd1wIljN.js} +1 -1
  19. package/dashboard/dist/assets/DialogDescription-CjJLpfCL.js +1 -0
  20. package/dashboard/dist/assets/{DialogTitle-CWPdu5V-.js → DialogTitle-DhB-tbnZ.js} +1 -1
  21. package/dashboard/dist/assets/{FadeIn-CdCANtvs.js → FadeIn-B8eRWBdy.js} +1 -1
  22. package/dashboard/dist/assets/{HeaderGithubStar-dQQnH85f.js → HeaderGithubStar-DmWep8uP.js} +1 -1
  23. package/dashboard/dist/assets/{HoverTooltip-CqJUI-WG.js → HoverTooltip-DDyTZli0.js} +1 -1
  24. package/dashboard/dist/assets/{IpCheckPage-BRqTXlSu.js → IpCheckPage-CN8hYm4o.js} +1 -1
  25. package/dashboard/dist/assets/{LandingPage-DhMTgDng.js → LandingPage-B3cHASqK.js} +2 -2
  26. package/dashboard/dist/assets/{LeaderboardAvatar-BrGcByG1.js → LeaderboardAvatar-CEcLXrJL.js} +1 -1
  27. package/dashboard/dist/assets/{LeaderboardPage-BmdopPjo.js → LeaderboardPage-H6HW9hon.js} +2 -2
  28. package/dashboard/dist/assets/{LeaderboardProfileModal-DRZqPo-A.js → LeaderboardProfileModal-B_5PyjRA.js} +4 -4
  29. package/dashboard/dist/assets/{LeaderboardProfilePage-CTbC39KX.js → LeaderboardProfilePage-DR9KWLWv.js} +3 -3
  30. package/dashboard/dist/assets/{LimitsPage-B7AuLq1S.js → LimitsPage-Da0hRxO_.js} +1 -1
  31. package/dashboard/dist/assets/{LocalOnlyNotice-DyIAspoq.js → LocalOnlyNotice-DuTdva_n.js} +1 -1
  32. package/dashboard/dist/assets/LoginCard-DOL3osrj.js +1 -0
  33. package/dashboard/dist/assets/{LoginModal-D3bmr_jI.js → LoginModal-DBmaQL2L.js} +1 -1
  34. package/dashboard/dist/assets/{LoginPage-D7SgmEhZ.js → LoginPage-Dk08VrkC.js} +1 -1
  35. package/dashboard/dist/assets/{PetPage-5A3Q0zlw.js → PetPage-BbCIdpzx.js} +1 -1
  36. package/dashboard/dist/assets/{PopoverPopup-ajEhdI8m.js → PopoverPopup-C1fJZ4qt.js} +1 -1
  37. package/dashboard/dist/assets/ProviderIcon-FfLD-f73.js +1 -0
  38. package/dashboard/dist/assets/{ResetPasswordPage-Bwbt8tH2.js → ResetPasswordPage-Bg7eVc6L.js} +1 -1
  39. package/dashboard/dist/assets/{SegmentedControl-BSa5hMnN.js → SegmentedControl-CFNHcUz7.js} +1 -1
  40. package/dashboard/dist/assets/{Select-kPKDGb7M.js → Select-B0Q0eDcJ.js} +1 -1
  41. package/dashboard/dist/assets/{SelectItemText-DNgLclTV.js → SelectItemText-BVbLYxSQ.js} +1 -1
  42. package/dashboard/dist/assets/{ServiceStatusPage-C1j7rPDp.js → ServiceStatusPage-DCZH2kz5.js} +1 -1
  43. package/dashboard/dist/assets/{SessionsPage-BgoKs_Yq.js → SessionsPage-DO5Et7ss.js} +2 -2
  44. package/dashboard/dist/assets/{SettingsPage-BUaPftV0.js → SettingsPage-afgxGfzT.js} +2 -2
  45. package/dashboard/dist/assets/{SkillsPage-C5GkzfWW.js → SkillsPage-DDKiHCF7.js} +1 -1
  46. package/dashboard/dist/assets/{TokenGalaxy-DZffAa_0.js → TokenGalaxy-DV1Xoe5z.js} +1 -1
  47. package/dashboard/dist/assets/{ToolbarRootContext-CuLP92P_.js → ToolbarRootContext-DNckd9Qz.js} +1 -1
  48. package/dashboard/dist/assets/TrendMonitor-CliMJxCC.js +19 -0
  49. package/dashboard/dist/assets/{WidgetsPage-BUhiCpcq.js → WidgetsPage-BrwG6YMM.js} +1 -1
  50. package/dashboard/dist/assets/{WrappedPage-sNFISXVG.js → WrappedPage-Ft9YJd0D.js} +1 -1
  51. package/dashboard/dist/assets/{__vite-browser-external-Cyw7ZNtj.js → __vite-browser-external-C6_BtvDo.js} +4 -3
  52. package/dashboard/dist/assets/agent-logos-yYNu1ZUy.js +1 -0
  53. package/dashboard/dist/assets/{arrow-up-right-BcRkt7hr.js → arrow-up-right-B_K57Vbg.js} +1 -1
  54. package/dashboard/dist/assets/{check-qhr4U2S5.js → check-xH63o2xJ.js} +1 -1
  55. package/dashboard/dist/assets/{chevron-right-iLGEAP7_.js → chevron-right-D3F2rAfr.js} +1 -1
  56. package/dashboard/dist/assets/{copy-BhEPCq-q.js → copy-WPfJGGI0.js} +1 -1
  57. package/dashboard/dist/assets/{download-D7O1ZzsX.js → download-BgtWtEXI.js} +1 -1
  58. package/dashboard/dist/assets/{external-link-CY2kK2hC.js → external-link-DSHGoZRM.js} +1 -1
  59. package/dashboard/dist/assets/{flame-D4FPuBNn.js → flame-CNGl6Qac.js} +1 -1
  60. package/dashboard/dist/assets/{format-tokens-CVHJ7Hdh.js → format-tokens-jVm2UX7Y.js} +1 -1
  61. package/dashboard/dist/assets/{icons-B_-51UXa.js → icons-B1JZg-Id.js} +1 -1
  62. package/dashboard/dist/assets/{index-cwdr25Zm.js → index-BTZibjLi.js} +1 -1
  63. package/dashboard/dist/assets/{index-Djv-aJy0.js → index-BjD81Qce.js} +1 -1
  64. package/dashboard/dist/assets/{index-ClVWat-1.js → index-CUFHknAy.js} +1 -1
  65. package/dashboard/dist/assets/{info-DOab0eZz.js → info-CLM460KM.js} +1 -1
  66. package/dashboard/dist/assets/{limits-providers-CESm2d6B.js → limits-providers-CFO4O1qh.js} +1 -1
  67. package/dashboard/dist/assets/{link-2-B4LMsC4m.js → link-2-BHOsUnAI.js} +1 -1
  68. package/dashboard/dist/assets/{loader-circle-CPx6wpSn.js → loader-circle-CgcIQi92.js} +1 -1
  69. package/dashboard/dist/assets/{maximize-2-C9z8mbdn.js → maximize-2-DvqfuJEA.js} +1 -1
  70. package/dashboard/dist/assets/{modifiers.esm-5xRgAl_R.js → modifiers.esm-CNiwIkPh.js} +1 -1
  71. package/dashboard/dist/assets/module-CV1mYFsv.js +3 -0
  72. package/dashboard/dist/assets/{monitor-smartphone-B9HAspdR.js → monitor-smartphone-BLutpxrG.js} +1 -1
  73. package/dashboard/dist/assets/provider-display-BxIgWUEa.js +42 -0
  74. package/dashboard/dist/assets/{react-C45OGvDd.js → react-CM-ozVnh.js} +1 -1
  75. package/dashboard/dist/assets/{search-Bg1qyEdz.js → search-4T07INKt.js} +1 -1
  76. package/dashboard/dist/assets/{skills-api-a8pi7UTd.js → skills-api-EXMD3LD1.js} +1 -1
  77. package/dashboard/dist/assets/{sortable.esm-CtPp8cFA.js → sortable.esm-jC6mPJiL.js} +1 -1
  78. package/dashboard/dist/assets/{store-b8zXM1yr.js → store-CvSEdgf2.js} +1 -1
  79. package/dashboard/dist/assets/{terminal-CPf0K0Fn.js → terminal-D9fyE2pP.js} +1 -1
  80. package/dashboard/dist/assets/{trash-2-uorzBdA0.js → trash-2-QLUsAY3l.js} +1 -1
  81. package/dashboard/dist/assets/{use-community-stats-DaVwywsM.js → use-community-stats-Chrt3kpU.js} +1 -1
  82. package/dashboard/dist/assets/{use-limits-display-prefs-UIzz7PJ3.js → use-limits-display-prefs-BJJd750e.js} +1 -1
  83. package/dashboard/dist/assets/{use-ordered-list-C2XOfMH3.js → use-ordered-list-BBJp5lFv.js} +1 -1
  84. package/dashboard/dist/assets/use-reduced-motion-BvXZCGFC.js +1 -0
  85. package/dashboard/dist/assets/{use-session-efficiency-pref-D5KHakYg.js → use-session-efficiency-pref-BXbvx2Ht.js} +1 -1
  86. package/dashboard/dist/assets/{use-transform-Cfo_2_id.js → use-transform-BVp_MUsU.js} +1 -1
  87. package/dashboard/dist/assets/{use-usage-limits-CANTpxrA.js → use-usage-limits-Dk3EkeIs.js} +1 -1
  88. package/dashboard/dist/assets/{useCurrency-CjvWekKH.js → useCurrency-Bi88Sd__.js} +1 -1
  89. package/dashboard/dist/assets/{useScrollLock-ChQdbuJg.js → useScrollLock-if34g2H-.js} +1 -1
  90. package/dashboard/dist/assets/{useTokenFormat-4MY04JPl.js → useTokenFormat-C2cz-5qJ.js} +1 -1
  91. package/dashboard/dist/assets/{zap-BSXHFUBb.js → zap-D1yHmcQR.js} +1 -1
  92. package/dashboard/dist/index.html +12 -10
  93. package/dashboard/dist/ip-check.html +1 -1
  94. package/dashboard/dist/leaderboard.html +1 -1
  95. package/dashboard/dist/llms.txt +2 -1
  96. package/dashboard/dist/share.html +1 -1
  97. package/package.json +2 -2
  98. package/src/commands/init.js +2 -1
  99. package/src/commands/status.js +46 -0
  100. package/src/commands/sync.js +188 -4
  101. package/src/lib/account-usage-dedup.js +267 -0
  102. package/src/lib/local-api.js +4 -0
  103. package/src/lib/pricing/curated-overrides.json +15 -9
  104. package/src/lib/pricing/index.js +32 -1
  105. package/src/lib/pricing/seed-snapshot.json +1 -1
  106. package/src/lib/rollout.js +730 -1
  107. package/src/lib/source-metadata.js +1 -1
  108. package/src/lib/trae-cn-config.js +539 -0
  109. package/dashboard/dist/assets/DialogDescription-DfNXnqay.js +0 -1
  110. package/dashboard/dist/assets/LoginCard-LcOaKaCK.js +0 -1
  111. package/dashboard/dist/assets/ProviderIcon-C4yuu9FG.js +0 -1
  112. package/dashboard/dist/assets/TrendMonitor-BKLAKJmT.js +0 -19
  113. package/dashboard/dist/assets/agent-logos-Bwf2YFHS.js +0 -1
  114. package/dashboard/dist/assets/module-BRJxSJmz.js +0 -3
  115. package/dashboard/dist/assets/provider-display-C0NS0EvN.js +0 -42
  116. package/dashboard/dist/assets/use-reduced-motion-CNyMWBog.js +0 -1
@@ -0,0 +1,3 @@
1
+ var v=typeof window<"u"?window:void 0,ce=typeof globalThis<"u"?globalThis:v,ve=ce?.navigator,k=ce?.document,X=ce?.location,mr=ce?.fetch,qs=ce!=null&&ce.XMLHttpRequest&&"withCredentials"in new ce.XMLHttpRequest?ce.XMLHttpRequest:void 0,Dr=ce?.AbortController,Do=ce?.CompressionStream,me=ve?.userAgent;function Qn(){return!(!v||v.navigator.onLine===!1)}var qt=typeof globalThis<"u"?globalThis:v;qt&&typeof self>"u"&&(qt.self=qt),qt&&typeof File>"u"&&(qt.File=function(){});var C=v??{},U={DEBUG:!1,LIB_VERSION:"0.5.0",LIB_NAME:"browser-common"};function Nr(i,e,t,s,r,n,a){try{var o=i[n](a),l=o.value}catch(h){return void t(h)}o.done?e(l):Promise.resolve(l).then(s,r)}function G(i){return function(){var e=this,t=arguments;return new Promise((function(s,r){var n=i.apply(e,t);function a(l){Nr(n,s,r,a,o,"next",l)}function o(l){Nr(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 ea(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 jr=i=>{if(typeof i!="string")return i;try{return JSON.parse(i)}catch{return i}};function Hr(i){return typeof i=="string"||i}function zr(i){return typeof i=="string"?i:void 0}var Lt,No=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],He=(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.AiCaptureQueue="ai_capture_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.PushRegistered="push_registered",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})({}),Br=(function(i){return i.GZipJS="gzip-js",i.Base64="base64",i})({}),jo=["$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"],Ho=["token"],ta="NativeGzipValidationError",Ls=i=>i.length>=2&&i[0]===31&&i[1]===139,Ur=(i,e)=>i===Br.GZipJS||e===Br.GZipJS||e==="gzip",Vr=i=>!(!i||typeof i!="object")&&("name"in i?String(i.name):"")==="NotReadableError",pi=i=>{var e=new Error("Native gzip produced invalid output: "+i);throw e.name=ta,e},zo=(function(){var i=G((function*(e,t){18>e.size&&pi("too-short");var s=new Uint8Array(yield e.slice(0,10).arrayBuffer());Ls(s)&&s[2]===8||pi("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(a=>{for(var o=(()=>{if(Lt)return Lt;Lt=[];for(var u=0;256>u;u++){for(var c=u,d=0;8>d;d++)c=1&c?3988292384^c>>>1:c>>>1;Lt[u]=c>>>0}return Lt})(),l=4294967295,h=0;a.length>h;h++)l=o[255&(l^a[h])]^l>>>8;return(4294967295^l)>>>0})(t)&&pi("invalid-crc");var n=t.length>>>0;r.getUint32(4,!0)!==n&&pi("invalid-size")}));return function(e,t){return i.apply(this,arguments)}})();function Ds(){return Ds=G((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 h=G((function*(u){try{yield n.abort(u)}catch{}throw u}));return function(u){return h.apply(this,arguments)}})()),o=new Response(r.readable).blob(),l=(yield Promise.all([o,a]))[0];return yield zo(l,s),l}catch(h){if(t!=null&&t.rethrow)throw h;return e&&console.error("Failed to gzip compress data",h),null}})),Ds.apply(this,arguments)}var Bo=["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"],Gr=function(i,e){if(e===void 0&&(e=[]),!i)return!1;var t=i.toLowerCase();return Bo.concat(e).some((s=>{var r=s.toLowerCase();return t.indexOf(r)!==-1}))};function A(i,e){return i.indexOf(e)!==-1}var is=function(i){return i.trim()},Ns=function(i){return i.replace(/^\$/,"")};function ia(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 sa=Object.prototype,ra=sa.hasOwnProperty,ss=sa.toString,q=Array.isArray||function(i){return ss.call(i)==="[object Array]"},de=i=>typeof i=="function",Y=i=>i===Object(i)&&!q(i),Ge=i=>{if(Y(i)){for(var e in i)if(ra.call(i,e))return!1;return!0}return!1},w=i=>i===void 0,j=i=>ss.call(i)=="[object String]",js=i=>j(i)&&i.trim().length===0,be=i=>i===null,L=i=>w(i)||be(i),ne=i=>ss.call(i)=="[object Number]"&&i==i,Ne=i=>ne(i)&&i>0,Ee=i=>ss.call(i)==="[object Boolean]",Uo=i=>i instanceof FormData,Vo=i=>A(jo,i),Go=i=>A(Ho,i);function na(i){return i===null||typeof i!="object"}function Mi(i,e){return{}.toString.call(i)==="[object "+e+"]"}function yr(i){return typeof Event<"u"&&aa(i,Event)}function aa(i,e){try{return i instanceof e}catch{return!1}}var Wo=[!0,"true",1,"1","yes"],os=i=>A(Wo,i),Jo=[!1,"false",0,"0","no"];function qe(i,e,t,s,r){return e>t&&(s.warn("min cannot be greater than max."),e=t),ne(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),qe(r||t,e,t,s))}class Yo{constructor(e){this.it={},this.rt=e.rt,this.nt=qe(e.bucketSize,0,100,e.st),this.ot=qe(e.refillRate,0,this.nt,e.st),this.ut=qe(e.refillInterval,0,864e5,e.st)}ht(e,t){var s=Math.floor((t-e.lastAccess)/this.ut);s>0&&(e.tokens=Math.min(e.tokens+s*this.ot,this.nt),e.lastAccess=e.lastAccess+s*this.ut)}consumeRateLimit(e){var t,s=Date.now(),r=String(e),n=this.it[r];return n?this.ht(n,s):this.it[r]=n={tokens:this.nt,lastAccess:s},n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.rt)==null||t.call(this,e)),n.tokens===0)}stop(){this.it={}}}var Fe="Mobile",Oi="iOS",We="Android",Pt="Tablet",oa=We+" "+Pt,la="iPad",ua="Apple",ha=ua+" Watch",Zt="Safari",It="BlackBerry",ca="Samsung",da=ca+"Browser",pa=ca+" Internet",pt="Chrome",Ko=pt+" OS",va=pt+" "+Oi,br="Internet Explorer",fa=br+" "+Fe,wr="Opera",Xo=wr+" Mini",xr="Edge",ga="Microsoft "+xr,St="Firefox",_a=St+" "+Oi,ri="Nintendo",ni="PlayStation",Ft="Xbox",ma=We+" "+Fe,ya=Fe+" "+Zt,Vt="Windows",Hs=Vt+" Phone",Wr="Nokia",zs="Ouya",ba="Generic",Zo=ba+" "+Fe.toLowerCase(),wa=ba+" "+Pt.toLowerCase(),Bs="Konqueror",xa="Oculus Browser",Ai="Vivaldi",ka="Yandex",qi="Whale",Us="DuckDuckGo",Ea="Pale Moon",Li="Waterfox",Qt="Brave",Sa="Google Search App",ie="(\\d+(\\.\\d+)?)",ls=new RegExp("Version/"+ie),Qo=new RegExp(Ft,"i"),el=new RegExp(ni+" \\w+","i"),tl=new RegExp(ri+" \\w+","i"),kr=new RegExp(It+"|PlayBook|BB10","i"),il={"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"},Fa=function(i,e,t,s){e=e||"";var r=(function(n){return n!=null&&n.brave?Qt:null})(t);return r||(s!=null&&s.detectGoogleSearchApp&&A(i,"GSA/")?Sa:A(i," OPR/")&&A(i,"Mini")?Xo:A(i," OPR/")?wr:kr.test(i)?It:A(i,"IE"+Fe)||A(i,"WPDesktop")?fa:A(i,"OculusBrowser")?xa:A(i,da)?pa:A(i,xr)||A(i,"Edg/")?ga:A(i,Ai+"/")?Ai:A(i,"YaBrowser/")?ka:A(i,qi+"/")?qi:A(i,Us+"/")||A(i,"Ddg/")?Us:A(i,"FBIOS")?"Facebook "+Fe:A(i,"UCWEB")||A(i,"UCBrowser")?"UC Browser":A(i,"CriOS")?va:A(i,"CrMo")||A(i,pt)?pt:A(i,We)&&A(i,Zt)?ma:A(i,"FxiOS")?_a:A(i.toLowerCase(),Bs.toLowerCase())?Bs:A(i,Qt+"/")?Qt:((n,a)=>a&&A(a,ua)||(function(o){return A(o,Zt)&&!A(o,pt)&&!A(o,We)})(n))(i,e)?A(i,Fe)?ya:Zt:A(i,"PaleMoon/")?Ea:A(i,Li+"/")?Li:A(i,St)?St:A(i,"MSIE")||A(i,"Trident/")?br:A(i,"Gecko")?St:"")},sl={[fa]:[new RegExp("rv:"+ie)],[ga]:[new RegExp(xr+"?\\/"+ie)],[pt]:[new RegExp("("+pt+"|CrMo)\\/"+ie)],[va]:[new RegExp("CriOS\\/"+ie)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ie)],[Zt]:[ls],[ya]:[ls],[wr]:[new RegExp("(Opera|OPR)\\/"+ie)],[St]:[new RegExp(St+"\\/"+ie)],[_a]:[new RegExp("FxiOS\\/"+ie)],[Bs]:[new RegExp("Konqueror[:/]?"+ie,"i")],[It]:[new RegExp(It+" "+ie),ls],[ma]:[new RegExp("android\\s"+ie,"i")],[pa]:[new RegExp(da+"\\/"+ie)],[xa]:[new RegExp("OculusBrowser\\/"+ie)],[Ai]:[new RegExp(Ai+"\\/"+ie)],[ka]:[new RegExp("YaBrowser\\/"+ie)],[qi]:[new RegExp(qi+"\\/"+ie)],[Qt]:[new RegExp(Qt+"\\/"+ie)],[Us]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ie)],[Ea]:[new RegExp("PaleMoon\\/"+ie)],[Li]:[new RegExp(Li+"\\/"+ie)],[Sa]:[new RegExp("GSA\\/"+ie)],[br]:[new RegExp("(rv:|MSIE )"+ie)],Mozilla:[new RegExp("rv:"+ie)]},rl=function(i,e,t,s){var r=Fa(i,e,t,s),n=sl[r];if(w(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},Jr=[[new RegExp(Ft+"; "+Ft+" (.*?)[);]","i"),i=>[Ft,i&&i[1]||""]],[new RegExp(ri,"i"),[ri,""]],[new RegExp(ni,"i"),[ni,""]],[kr,[It,""]],[new RegExp(Vt,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Hs,""];if(new RegExp(Fe).test(e)&&!/IEMobile\b/.test(e))return[Vt+" "+Fe,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var s=il[t[1]]||"";return/arm/i.test(e)&&(s="RT"),[Vt,s]}return[Vt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>i&&i[3]?[Oi,[i[3],i[4],i[5]||"0"].join(".")]:[Oi,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=w(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+We+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+We+")","i"),i=>i&&i[2]?[We,[i[2],i[3],i[4]||"0"].join(".")]:[We,""]],[/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/,[Ko,""]],[/Linux|debian/i,["Linux",""]]],Yr=function(i){return tl.test(i)?ri:el.test(i)?ni:Qo.test(i)?Ft:new RegExp(zs,"i").test(i)?zs:new RegExp("("+Hs+"|WPDesktop)","i").test(i)?Hs:/iPad/.test(i)?la:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?ha:kr.test(i)?It:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(Wr,"i").test(i)?Wr:/(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(Fe).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)?We:oa:new RegExp("(pda|"+Fe+")","i").test(i)?Zo:new RegExp(Pt,"i").test(i)&&!new RegExp(Pt+" pc","i").test(i)?wa:""},nl=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Kr(i,e){return typeof(t=i)=="string"&&nl.test(t)?i:e();var t}function Xe(i){return i&&i.split("#")[0]}function Er(i,e){var t=setTimeout(i,e);return t?.unref&&t?.unref(),t}function Xr(i,e,t){return Pa.apply(this,arguments)}function Pa(){return(Pa=G((function*(i,e,t){var s;try{return yield Promise.race([i,new Promise(((r,n)=>{s=Er((()=>{try{t?.(),r()}catch(a){n(a)}}),e)}))])}finally{clearTimeout(s)}}))).apply(this,arguments)}var al=i=>i instanceof Error,Ia={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}},ol=Ia.info;function $a(i){if(Ee(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(q(i))return{arrayValue:{values:i.map((e=>$a(e)))}};try{return{stringValue:JSON.stringify(i)}}catch{return{stringValue:String(i)}}}function Di(i){var e=[];for(var t in i){var s=i[t];be(s)||w(s)||e.push({key:t,value:$a(s)})}return e}function ll(i,e){var t=Ia[i.level||"info"]||ol,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),L(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),L(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:Di(o)};return i.trace_id&&(l.traceId=i.trace_id),i.span_id&&(l.spanId=i.span_id),w(i.trace_flags)||(l.flags=i.trace_flags),l}function Ra(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 Ta(i,e,t,s){return{resourceLogs:[{resource:{attributes:Di(e)},scopeLogs:[{scope:{name:t,version:s},logRecords:i}]}]}}let ul=class{constructor(i,e,t,s,r,n,a){var o;n===void 0&&(n=()=>Promise.resolve()),this._instance=i,this.qe=e,this.st=t,this.dt=s,this.vt=r,this.ct=n,this.ft=a,this.yt=null,this.bt=0,this._t=0,this.wt=0,this.kt=0,this.xt=!1,this.St=e.maxBufferSize,this.Ct=Math.max((o=e.maxQueueSize)!==null&&o!==void 0?o:e.maxBufferSize,e.maxBufferSize),this.Mt=e.flushIntervalMs,this.Tt=e.maxBatchRecordsPerPost,this.Et=e.rateCapWindowMs,this.It=e.maxLogsPerInterval}reset(){this.Pt(),this.yt=null,this.wt=0,this.kt=0,this.xt=!1,this.bt=0,this._t=0,this.Tt=this.qe.maxBatchRecordsPerPost}onReconnect(){this._t=0,this.Rt()}captureLog(i){if(!this._instance.isDisabled&&!this._instance.optedOut&&i!=null&&i.body){var e=this.At(i);if(e!==null)if(e.body){if(this.Ft()){var t={record:ll(e,this.dt())};this.vt((()=>this.Lt(t)))}}else this.st.info("Log was rejected in beforeSend function")}}At(i){var e=this.qe.beforeSend;if(!e)return i;var t=q(e)?e:[e],s=i;for(var r of t)try{var n=r(s);if(!n)return this.st.info("Log was rejected in beforeSend function"),null;s=n}catch(a){return this.st.error("Error in beforeSend function for log:",a),null}return s}Ft(){if(this.It===void 0)return!0;var i=Date.now(),e=i-this.wt;return this.Et>e&&e>=0||(this.wt=i,this.kt=0,this.xt=!1),this.It>this.kt?(this.kt++,!0):(this.xt||(this.st.warn("captureLog dropping logs: exceeded "+this.It+" logs per "+this.Et+"ms"),this.xt=!0),!1)}flush(){var i=this;return G((function*(){if(!i._instance.isDisabled)return i.yt||(i.yt=i.Ot().finally((()=>{i.yt=null}))),i.yt}))()}Ot(){var i=this;return G((function*(){var e;i.Pt();var t=(e=i._instance.getPersistedProperty(He.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.bt=0;var o=Math.min(t.length,i.Tt),l=t.slice(0,o),h=Ta(l.map((c=>c.record)),i.Dt(),(n=i.ft)!==null&&n!==void 0?n:i._instance.getLibraryId(),i._instance.getLibraryVersion()),u=yield i._instance.$t(h);if(u.kind==="too-large"&&l.length>1)i.Tt=Math.max(1,Math.floor(l.length/2)),i.st.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+i.Tt);else if(u.kind==="retry-later"||(u.kind==="too-large"?i.st.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."):u.kind==="ok"&&i.qe.maxBatchRecordsPerPost>i.Tt&&(i.Tt=Math.min(i.qe.maxBatchRecordsPerPost,i.Tt+1)),yield i.Nt(l.length),t=(a=i._instance.getPersistedProperty(He.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,u.kind==="fatal"))throw u.error}}))()}Nt(i){var e=this;return G((function*(){var t,s=Math.max(0,i-e.bt),r=(t=e._instance.getPersistedProperty(He.LogsQueue))!==null&&t!==void 0?t:[];e._instance.setPersistedProperty(He.LogsQueue,r.slice(s)),yield e.ct()}))()}Dt(){return Ra(this.qe,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Lt(i){var e;if(!this._instance.optedOut){var t=(e=this._instance.getPersistedProperty(He.LogsQueue))!==null&&e!==void 0?e:[];this.Ct>t.length||(t.shift(),this.bt++,this.st.info("Logs queue is full, dropping oldest record.")),t.push(i),this._instance.setPersistedProperty(He.LogsQueue,t),this.St>t.length?this.qt():this.Rt()}}qt(i){i===void 0&&(i=this.Mt),this.jt||(this.jt=Er((()=>{this.jt=void 0,this.Rt()}),i))}Bt(){var i=Math.min(Math.max(0,this._t-1),6);return this.Mt*Math.pow(2,i)}Ht(){var i=this._instance.getPersistedProperty(He.LogsQueue);return!!i&&i.length>0}shutdown(i){var e=this;return G((function*(){e.Pt();var t=e.flush().catch((()=>{}));i!==void 0?yield Xr(t,i):yield t}))()}flushWithTimeout(i){var e=this;return G((function*(){var t=e.flush();yield Xr(t,i,(()=>{t.catch((()=>{}))}))}))()}Rt(){this.flush().then((()=>{this._t=0}),(i=>{this._t++,this.st.error("PostHog logs flush failed:",i)})).finally((()=>{!this._instance.isDisabled&&this.Ht()&&this.qt(this.Bt())}))}Pt(){this.jt&&(clearTimeout(this.jt),this.jt=void 0)}};var us=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Zr(i){return String(i)+"000000"}function Qr(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 hl=class{constructor(i,e,t){this._instance=i,this.qe=e,this.st=t,this.Ut=new Map,this.yt=null,this.zt=!1,this.Wt=new Map,this.Vt=new Set,this.Zt=0}count(i,e,t){e===void 0&&(e=1),this.Gt({name:i,type:"count",value:e,unit:t?.unit,attributes:t?.attributes})}gauge(i,e,t){this.Gt({name:i,type:"gauge",value:e,unit:t?.unit,attributes:t?.attributes})}histogram(i,e,t){this.Gt({name:i,type:"histogram",value:e,unit:t?.unit,attributes:t?.attributes})}flush(){var i=this,e=this.yt,t=(function(){var r=G((function*(){e&&(yield e.catch((()=>{}))),yield i.Qt()}));return function(){return r.apply(this,arguments)}})(),s=t().finally((()=>{this.yt===s&&(this.yt=null)}));return this.yt=s,s}drainWindow(){if(this.Ut.size===0)return null;var i=this.Ut;return this.Ut=new Map,this.zt=!1,this.Wt=new Map,this.Vt=new Set,this.Kt(i)}reset(){this.Zt++,this.Pt(),this.Ut=new Map,this.yt=null,this.zt=!1,this.Wt=new Map,this.Vt=new Set}Gt(i){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.At(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.st.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=Qr(e.type,e.name,e.unit,t)}catch(a){return void this.st.warn("Dropping metric '"+e.name+"': attributes could not be serialized",a)}var r=this.Ut.get(s);if(!r){if(!this.Jt())return;r={name:e.name,type:e.type,unit:e.unit,attributes:t,windowStartMs:Date.now()},this.Ut.set(s,r)}var n=this.Wt.get(e.name);n===void 0?this.Wt.set(e.name,e.type):n===e.type||this.Vt.has(e.name)||(this.Vt.add(e.name),this.st.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.Yt(r,e.value),this.qt()}else this.st.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.st.warn("Dropping metric with empty name")}}Jt(){return this.qe.maxSeriesPerFlush>this.Ut.size||(this.zt||(this.zt=!0,this.st.warn("Metric series cap reached ("+this.qe.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Yt(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(us.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,us)]+=1}}At(i){var e=this.qe.beforeSend;if(!e)return i;var t=q(e)?e:[e],s=i;for(var r of t)try{var n=r(s);if(!n)return this.st.info("Metric was rejected in beforeSend function"),null;s=n}catch(a){return this.st.error("Error in beforeSend function for metric:",a),null}return s}qt(){this.jt||(this.jt=Er((()=>{this.jt=void 0,this.flush().catch((i=>{this.st.error("Metrics flush failed:",i)}))}),this.qe.flushIntervalMs))}Pt(){this.jt&&(clearTimeout(this.jt),this.jt=void 0)}Qt(){var i=this;return G((function*(){if(i.Ut.size!==0){var e=i.Ut;i.Ut=new Map,i.zt=!1,i.Wt=new Map,i.Vt=new Set;var t=i.Zt,s=yield i._instance.Xt(i.Kt(e));if(t===i.Zt)switch(s.kind){case"ok":return;case"retry-later":return i.ti(e),void i.qt();case"too-large":return void i.st.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void i.st.error("Failed to send metrics batch:",s.error)}}}))()}Kt(i){return e=this.ei(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.qe,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Di(t)},scopeMetrics:[{scope:{name:s,version:r},metrics:e}]}]};var e,t,s,r}ei(i){var e=Zr(Date.now()),t=new Map;for(var s of i.values()){var r,n=Qr(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=Di((r=s.attributes)!==null&&r!==void 0?r:{}),l=Zr(s.windowStartMs);if(s.type==="count"){var h,u={attributes:o,startTimeUnixNano:l,timeUnixNano:e,asDouble:(h=s.total)!==null&&h!==void 0?h:0};a.sum.dataPoints.push(u)}else if(s.type==="gauge"){var c,d={attributes:o,timeUnixNano:e,asDouble:(c=s.last)!==null&&c!==void 0?c: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:us})}return Array.from(t.values())}ti(i){var e,t;for(var s of i){var r=s[0],n=s[1],a=this.Ut.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.Jt()&&this.Ut.set(r,n)}}};var vi,en,hs;function cl(i){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return hs&&t.length===en||(en=t.length,hs=t.reduce(((s,r)=>{vi||(vi={});var n=vi[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],h=l?.filename,u=e[r];if(h&&u){s[h]=u,vi[r]=[h,u];break}}return s}),{})),hs}}class dl{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 G((function*(){for(var s of e)s.stacktrace&&s.stacktrace.frames&&q(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 G((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:cl(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 $t="?";function Vs(i,e,t,s,r){var n={platform:i,filename:e,function:t==="<anonymous>"?$t:t,in_app:!0};return w(s)||(n.lineno=s),w(r)||(n.colno=r),n}var Ca=(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]:$t,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},pl=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,vl=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,fl=/\((\S*)(?::(\d+))(?::(\d+))\)/,gl=(i,e)=>{var t=pl.exec(i);if(t)return Vs(e,t[1],$t,+t[2],+t[3]);var s=vl.exec(i);if(s){if(s[2]&&s[2].indexOf("eval")===0){var r=fl.exec(s[2]);r&&(s[2]=r[1],s[3]=r[2],s[4]=r[3])}var n=Ca(s[1]||$t,s[2]);return Vs(e,n[1],n[0],s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},_l=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ml=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,yl=(i,e)=>{var t=_l.exec(i);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var s=ml.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]||$t,a=Ca(n,r);return Vs(e,r=a[1],n=a[0],t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},tn=/\(error: (.*)\)/;class bl{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var s=j(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 Mi(e,"DOMException")}isDOMError(e){return Mi(e,"DOMError")}}class wl{match(e){return(function(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return aa(t,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 xl{constructor(){}match(e){return!!Mi(e,"ErrorEvent")&&(e.error!=null||this.fe(e))}coerce(e,t){var s;if(e.error!=null)return t.apply(e.error);var r=t.apply(e.message);return y({},r,{stack:(s=this.pe(e))!==null&&s!==void 0?s:r.stack,synthetic:!0})}fe(e){return j(e.message)&&e.message.length>0}pe(e){var t=e;if(j(t.filename)&&t.filename.length>0){var s,r,n=(s=t.lineno)!==null&&s!==void 0?s:0,a=(r=t.colno)!==null&&r!==void 0?r:0;return`Error
2
+ at `+t.filename+":"+n+":"+a}}}var kl=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class El{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(kl);return r&&(t=r[1],s=r[2]),[t,s]}}var Sl=["fatal","error","warning","log","info","debug"];function Ma(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 Fl{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var s,r,n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:(s=this.getStack(e))!==null&&s!==void 0?s:(r=t.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return yr(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: "+Ma(e)}isSeverityLevel(e){return j(e)&&!js(e)&&Sl.indexOf(e)>=0}getStack(e){try{return j(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:j(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var s=e[t];if(al(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 yr(e)}coerce(e,t){var s,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Ma(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class Il{match(e){return na(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 $l{match(e){return Mi(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!yr(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 na(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 Ni="$message",ji="$timestamp",Rl=new Set([Ni,ji]),cs={enabled:!0,max_bytes:32768};function Hi(i){var e;return i?{enabled:(e=i.enabled)!==null&&e!==void 0?e:cs.enabled,max_bytes:Cl(i.max_bytes,cs.max_bytes)}:y({},cs)}class Tl{constructor(e){this.ii=[],this.ri=0,this.qe=Hi(e)}setConfig(e){this.qe=Hi(e),this.ni()}add(e){var t=(function(r){var n;try{n=ia(r)}catch{return}try{var a=JSON.parse(n);if(!Y(a))return;var o=a,l=o[Ni],h=o[ji];return!j(l)||l.trim().length===0||!j(h)&&!ne(h)?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.qe.max_bytes||(this.ii.push({step:t.step,bytes:s}),this.ri+=s,this.ni())}}getAttachable(){return this.ii.map((e=>e.step))}clear(){this.ii=[],this.ri=0}size(){return this.ii.length}ni(){for(;this.ri>this.qe.max_bytes&&this.ii.length>0;){var e=this.ii.shift();e&&(this.ri-=e.bytes)}}}function Cl(i,e){if(!ne(i)||i===1/0||i===-1/0)return e;var t=Math.floor(i);return 0>t?e:t}var Oa=function(i,e){var t=(e===void 0?{}:e).debugEnabled,s={k(r){if(v&&(U.DEBUG||v.POSTHOG_DEBUG||t)&&!w(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)=>Oa(i+" "+r,n)};return s},x=Oa("[PostHog.js]"),K=x.createLogger,Ml=K("[ExternalScriptsLoader]"),zi=i=>{var e=k?.querySelectorAll("script");if(e){for(var t=0;e.length>t;t++)if(e[t].src===i)return e[t]}},at=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return Ml.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var s=zi(e);if(s){if(s.__posthog_loading_callback_fired)return t();var r=s.__posthog_loading_error;return r?t(r):(s.addEventListener("load",(a=>{s.__posthog_loading_callback_fired=!0,t(void 0,a)})),void s.addEventListener("error",(a=>{s.__posthog_loading_error=a,t(a)})))}var n=()=>{if(!k)return t("document not found");if(zi(e))return at(i,e,t);var a=k.createElement("script");if(a.type="text/javascript",a.crossOrigin="anonymous",a.src=e,a.onload=h=>{a.__posthog_loading_callback_fired=!0,t(void 0,h)},a.onerror=h=>{a.__posthog_loading_error=h,t(h)},i.config.prepare_external_dependency_script&&(a=i.config.prepare_external_dependency_script(a)),!a)return t("prepare_external_dependency_script returned null");if(i.config.external_scripts_inject_target==="head")k.head.appendChild(a);else{var o,l=k.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)==null||o.insertBefore(a,l[0]):k.body.appendChild(a)}};k!=null&&k.body?n():k?.addEventListener("DOMContentLoaded",n)},ds={},sn=(i,e)=>{var t="/static/"+e+".js?v="+i.version;if(e==="toolbar"){var s=3e5;t=t+"&t="+Math.floor(Date.now()/s)*s}return i.requestRouter.endpointFor("assets",t)};C.__PosthogExtensions__=C.__PosthogExtensions__||{},C.__PosthogExtensions__.loadExternalDependency=(i,e,t)=>{if(e!=="remote-config"){var s=i.config.strict_script_versioning;if(s){var r=i.requestRouter.endpointFor("assets","/static/"+i.version+"/"+e+".js"),n=ds[r];if(s==="fallback"&&n){if(zi(n))return void at(i,n,t);delete ds[r]}at(i,r,s==="fallback"?(o,l)=>{if(o)if(typeof o=="string")t(o);else{var h,u=sn(i,e);ds[r]=u;var c=zi(r);c==null||(h=c.parentNode)==null||h.removeChild(c),at(i,u,t)}else t(void 0,l)}:t)}else at(i,sn(i,e),t)}else{var a=i.requestRouter.endpointFor("assets","/array/"+i.config.token+"/config.js");at(i,a,t)}},C.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var s=i.requestRouter.endpointFor("api",e);at(i,s,t)};U.DEBUG=!1,U.LIB_VERSION="1.417.1",U.LIB_NAME="web";var Aa="$people_distinct_id",ai="$device_id",ps="$device_model",Gt="__alias",Wt="__timers",Gs="$autocapture_disabled_server_side",Ws="$heatmaps_enabled_server_side",Js="$exception_capture_enabled_server_side",Ys="$error_tracking_suppression_rules",Ks="$error_tracking_capture_extension_exceptions",Xs="$web_vitals_enabled_server_side",Sr="$dead_clicks_enabled_server_side",Fr="$product_tours_enabled_server_side",Zs="$web_vitals_allowed_metrics",dt="$session_recording_remote_config",qa="$replay_sample_rate",La="$replay_override_sampling",Da="$replay_override_linked_flag",Na="$replay_override_url_trigger",ja="$replay_override_event_trigger",kt="$sesid",Pr="$session_is_sampled",ot="$enabled_feature_flags",Jt="$active_feature_flags",Si="$early_access_features",Qs="$feature_flag_details",Yt="$feature_flag_payloads",Fi="$feature_flag_request_id",Bi="$minimal_flag_called_events",Ae="$override_feature_flags",lt="$override_feature_flag_payloads",je="$stored_person_properties",ut="$stored_group_properties",er="$surveys",Ui="$surveys_loaded_at",tr="$surveys_activated",Pi="$surveys_activated_session",Ii="$surveys_activated_timestamps",Kt="ph_product_tours",ct="$flag_call_reported",Xt="$flag_call_reported_session_id",$i="$feature_flag_errors",ei="$feature_flag_evaluated_at",xe="$user_state",ir="$client_session_props",sr="$capture_rate_limit",rr="$initial_campaign_params",nr="$initial_referrer_info",Vi="$initial_person_info",Gi="$epp",fi="$posthog_cookieless",Ha="$cookieless_mode",za="$sdk_debug_extensions_init_method",Ba="$sdk_debug_extensions_init_time_ms",Ua="$sdk_debug_recording_script_not_loaded",Ir="PostHog loadExternalDependency extension not found.",ht="on_reject",Be="always",et="anonymous",Ye="identified",ar="identified_only",Wi="visibilitychange",Ji="beforeunload",wt="$pageview",vs="$pageleave",fs="$identify",rn="$groupidentify";function gi(i,e){q(i)&&i.forEach(e)}function V(i,e){if(!L(i))if(q(i))i.forEach(e);else if(Uo(i))i.forEach(((s,r)=>e(s,r)));else for(var t in i)ra.call(i,t)&&e(i[t],t)}var J=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 Ri(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 nn=function(i){try{return i()}catch{return}},Ol=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){x.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),x.critical(r)}}},$r=function(i){var e={};return V(i,(function(t,s){(j(t)&&t.length>0||ne(t))&&(e[s]=t)})),e},Al=["herokuapp.com","vercel.app","netlify.app"];function ql(i){var e=i?.hostname;if(!j(e))return!1;var t=e.split(".").slice(-2).join(".");for(var s of Al)if(t===s)return!1;return!0}function Z(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 or(i){return i.name==="ph_toolbar_internal"}var Va=i=>{if(k){try{for(var e=i+"=",t=k.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 ne(i)&&isFinite(i)&&Math.floor(i)===i});class Yi{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 Yi(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 Yi(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 Ll{generate(){var e=this.generateOrAbort();if(!w(e))return e;this.S=0;var t=this.generateOrAbort();if(w(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.C();else{if(this.S>=e+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return Yi.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.A.nextUint32())}C(){this.I=1024*this.A.nextUint32()+(1023&this.A.nextUint32())}constructor(){this.S=0,this.I=0,this.A=new Dl}}var an,Ga=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&&!w(v.crypto)&&crypto.getRandomValues&&(Ga=i=>crypto.getRandomValues(i));class Dl{nextUint32(){return this.R.length>this.O||(Ga(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var ze=()=>Nl().toString(),Nl=()=>(an||(an=new Ll)).generate(),Dt="",jl=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Ue={N:()=>!!k,j(i){x.error("cookieStore error: "+i)},P:Va,H(i){var e;try{e=JSON.parse(Ue.P(i))||{}}catch{}return e},F(i,e,t,s,r){if(!k)return!1;try{var n="",a="",o=(function(u,c){if(c){var d=(function(p,g){if(g===void 0&&(g=k),Dt)return Dt;if(!g||["localhost","127.0.0.1"].includes(p))return"";for(var _=p.split("."),m=Math.min(_.length,8),b="dmn_chk_"+ze();!Dt&&m--;){var E=_.slice(m).join("."),P=b+"=1;domain=."+E+";path=/";g.cookie=P+";max-age=3",g.cookie.includes(b)&&(g.cookie=P+";max-age=0",Dt=E)}return Dt})(u);if(!d){var f=(p=>{var g=p.match(jl);return g?g[0]:""})(u);f!==d&&x.info("Warning: cookie subdomain discovery mismatch",f,d),d=f}return d?"; domain=."+d:""}return""})(k.location.hostname,s);if(t){var l=new Date;l.setTime(l.getTime()+864e5*t),n="; expires="+l.toUTCString()}r&&(a="; secure");var h=i+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return h.length>3686.4&&x.warn("cookieStore warning: large cookie, len="+h.length),k.cookie=h,!0}catch{return!1}},q(i,e){if(k!=null&&k.cookie)try{Ue.F(i,"",-1,e)}catch{return}}},gs=null,W={N(){if(!be(gs))return gs;var i=!0;if(w(v))i=!1;else try{var e="__mplssupport__";W.F(e,"xyz"),W.P(e)!=='"xyz"'&&(i=!1),W.q(e)}catch{i=!1}return i||x.error("localStorage unsupported; falling back to cookie store"),gs=i,i},j(i){x.error("localStorage error: "+i)},P(i){try{return v?.localStorage.getItem(i)}catch(e){W.j(e)}return null},H(i){try{return JSON.parse(W.P(i))||{}}catch{}return null},F(i,e){try{return v?.localStorage.setItem(i,JSON.stringify(e)),!0}catch(t){W.j(t)}return!1},q(i){try{v?.localStorage.removeItem(i)}catch(e){W.j(e)}}},Hl=[ai,"distinct_id",kt,Pr,Gi,Vi,xe],_i={},zl={N:()=>!0,j(i){x.error("memoryStorage error: "+i)},P:i=>_i[i]||null,H:i=>_i[i]||null,F:(i,e)=>(_i[i]=e,!0),q(i){delete _i[i]}},tt=null,se={N(){if(!be(tt))return tt;if(tt=!0,w(v))tt=!1;else try{var i="__support__";se.F(i,"xyz"),se.P(i)!=='"xyz"'&&(tt=!1),se.q(i)}catch{tt=!1}return tt},j(i){x.error("sessionStorage error: ",i)},P(i){try{return v?.sessionStorage.getItem(i)}catch(e){se.j(e)}return null},H(i){try{return JSON.parse(se.P(i))||null}catch{}return null},F(i,e){try{return v?.sessionStorage.setItem(i,JSON.stringify(e)),!0}catch(t){se.j(t)}return!1},q(i){try{v?.sessionStorage.removeItem(i)}catch(e){se.j(e)}}};class Bl{constructor(e){this._instance=e}get qe(){return this._instance.config}get consent(){return this.si()?0:this.ai}isOptedOut(){return this.qe.cookieless_mode===Be||this.isRejected()||this.consent===-1&&this.qe.cookieless_mode===ht}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.qe.opt_out_capturing_by_default}optInOut(e){this.oi.F(this.li,e?1:0,this.qe.cookie_expiration,this.qe.cross_subdomain_cookie,this.qe.secure_cookie)}reset(){this.oi.q(this.li,this.qe.cross_subdomain_cookie)}get li(){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 ai(){var e=this.oi.P(this.li);return os(e)?1:A(Jo,e)?0:-1}get oi(){var e=this.qe.opt_out_capturing_persistence_type,t=e==="localStorage"?W:Ue;if(!this.ui||this.ui!==t){this.ui=t;var s=e==="localStorage"?Ue:W;s.P(this.li)&&(this.ui.P(this.li)||this.optInOut(os(s.P(this.li))),s.q(this.li,this.qe.cross_subdomain_cookie))}return this.ui}si(){return!!this.qe.respect_dnt&&[ve?.doNotTrack,ve?.msDoNotTrack,C.doNotTrack].some((e=>os(e)))}}function Wa(i,e){var t,s=i==null||(t=i.config)==null?void 0:t.get_current_url;if(!de(s))return e;try{var r=s(e);return j(r)&&r?r:e}catch(n){return x.error("Error in get_current_url, falling back to window.location.href",n),e}}var Ja="__POSTHOG_TOOLBAR__",Ul=1,Vl=3,Gl=11;function on(i){return i instanceof Element&&(i.id===Ja||!(i.closest==null||!i.closest(".toolbar-global-fade-container")))}function Ze(i){return!!i&&i.nodeType===Ul}function Se(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function Ya(i){return!!i&&i.nodeType===Vl}function Ka(i){return!!i&&i.nodeType===Gl&&Ze(i.host)}var Xa=1e3;function Rr(i){return i?is(i).split(/\s+/):[]}function ln(i,e){var t=(function(s){var r,n=v==null||(r=v.location)==null?void 0:r.href;return w(n)?void 0:Wa(s,n)})(e);return!!(t&&i&&i.some((s=>t.match(s))))}function Ki(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 Rr(e)}function Za(i){return L(i)?null:is(i).split(/(\s+)/).filter((e=>ti(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function oi(i){var e="";return ur(i)&&!io(i)&&i.childNodes&&i.childNodes.length&&V(i.childNodes,(function(t){var s;Ya(t)&&t.textContent&&(e+=(s=Za(t.textContent))!==null&&s!==void 0?s:"")})),is(e)}function _s(i){var e;return w(i.target)?i.srcElement||null:(e=i.target)!=null&&e.shadowRoot?i.composedPath()[0]||null:i.target||null}var Tr=["a","button","form","input","select","textarea","label"];function lr(i,e){if(w(e))return!0;var t,s=function(n){if(e.some((a=>(function(o,l){var h=o.matches||o.matchesSelector||o.msMatchesSelector||o.mozMatchesSelector||o.webkitMatchesSelector||o.oMatchesSelector;try{return!!h&&h.call(o,l)}catch{return!1}})(n,a))))return{v:!0}};for(var r of i)if(t=s(r))return t.v;return!1}function Qa(i){var e=i.parentNode;return!(!e||!Ze(e))&&e}var Wl=[".ph-no-autocapture","[data-ph-no-autocapture]"],eo=["next","previous","prev",">","<"],Jl=[...eo,"+","-","−","–"],un=(i,e)=>/[a-z0-9]/i.test(e)?i.includes(e):i===e,hn=[".ph-no-rageclick",".ph-no-capture"],Yl=["","text","search","email","password","url","tel","number"];function cn(i,e){if(!v||Cr(i))return!1;var t,s,r,n,a;if(Ee(e)?(t=!!e&&hn,s=void 0,r=!1):(t=(n=e?.css_selector_ignorelist)!==null&&n!==void 0?n:hn,s=e?.content_ignorelist,r=(a=e?.ignore_text_selection)!==null&&a!==void 0&&a),t===!1||r&&(function(l){return!(!l||!Ze(l))&&(!!Se(l,"textarea")||(Se(l,"input")?A(Yl,(l.getAttribute("type")||"").toLowerCase()):(function(h){if(h.isContentEditable)return!0;var u=h.getAttribute==null?void 0:h.getAttribute("contenteditable");return u==="true"||u===""})(l)))})(i))return!1;var o=to(i,!1).targetElementList;return!(function(l,h){if(l===!1||w(l))return!1;var u;if(l===!0)u=eo;else{if(!q(l))return!1;if(l.length>10)return x.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;u=l.map((c=>c.toLowerCase()))}return h.some((c=>{var d=c.safeText,f=c.ariaLabel;return u.some((p=>un(d,p)||un(f,p)))}))})(s,o.map((l=>{var h;return{safeText:oi(l).toLowerCase(),ariaLabel:((h=l.getAttribute("aria-label"))==null?void 0:h.toLowerCase().trim())||""}})))&&!lr(o,t)}var Cr=i=>!i||Se(i,"html")||!Ze(i),to=(i,e)=>{if(!v||Cr(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,s=[i],r=i;r.parentNode&&!Se(r,"body");)if(Ka(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=Qa(r);if(!n)break;if(e||Tr.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 ur(i){for(var e=new Set,t=0,s=i;s.parentNode&&!Se(s,"body");s=s.parentNode){if(t++>=Xa||e.has(s))return!1;e.add(s);var r=Ki(s);if(A(r,"ph-sensitive")||A(r,"ph-no-capture"))return!1}if(A(Ki(i),"ph-include"))return!0;var n=i.type||"";if(j(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var a=i.name||i.id||"";return!j(a)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))}function io(i){return!!(Se(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||Se(i,"select")||Se(i,"textarea")||i.getAttribute("contenteditable")==="true")}var dn=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}))$"),pn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Kl=[16,15,14,13],Xl=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),vn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),fn=/[0-9A-Za-z_]/;function Zl(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 ti(i,e){if(e===void 0&&(e=!0),L(i))return!1;if(j(i)){i=is(i);var t=e?dn.test((i||"").replace(/[- ]/g,"")):(function(r){var n;for(pn.lastIndex=0;n=pn.exec(r);){var a=n[2];if(a)for(var o=a.replace(/[- ]/g,""),l=0;o.length>l;l++)for(var h of Kl){var u=l+h;if(o.length>=u){var c=o.slice(l,u);if(dn.test(c)&&Zl(c))return!0}}}return!1})(i);if(t)return!1;var s=e?Xl.test(i):(function(r){var n;for(vn.lastIndex=0;n=vn.exec(r);){var a=n[1],o=n[3];if(!(a&&o&&fn.test(a)&&fn.test(o)))return!0}return!1})(i);if(s)return!1}return!0}function gn(i){var e=oi(i);return ti(e=(e+" "+so(i)).trim())?e:""}function so(i){var e="";return i&&i.childNodes&&i.childNodes.length&&V(i.childNodes,(function(t){var s;if(t&&((s=t.tagName)==null?void 0:s.toLowerCase())==="span")try{var r=oi(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+so(t)).trim())}catch(n){x.error("[AutoCapture]",n)}})),e}function _n(i){return i.replace(/"|\\"/g,'\\"')}function Ql(i){var e=i.attr__class;if(e)return q(e)?e:Rr(e)}var mi=K("[Dead Clicks]"),eu=()=>!0,tu=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(Sr)),s=i.instance.config.capture_dead_clicks;return Ee(s)?s:!!Y(s)||t};class mn{get lazyLoadedDeadClicksAutocapture(){return this.hi}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({[Sr]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.di((()=>{this.vi()})):this.stop()}di(e){var t,s;(t=C.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture?e():(s=C.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"dead-clicks-autocapture",(r=>{r?mi.error("failed to load script",r):e()}))}vi(){var e;if(k){if(!this.hi&&(e=C.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=Y(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.hi=C.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.hi.start(k),mi.info("starting...")}}else mi.error("`document` not found. Cannot start.")}stop(){this.hi&&(this.hi.stop(),this.hi=void 0,mi.info("stopping..."))}}var ms=K("[SegmentIntegration]"),ro="posthog-js";function no(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,h=l===void 0||l;return u=>{var c,d,f,p,g;if(o!=="*"&&!o.includes(u.level)||!i.__loaded)return u;u.tags||(u.tags={});var _=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/person/"+i.get_distinct_id());u.tags["PostHog Person URL"]=_,i.sessionRecordingStarted()&&(u.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var m,b=((c=u.exception)==null?void 0:c.values)||[],E=b.map((S=>y({},S,{stacktrace:S.stacktrace?y({},S.stacktrace,{type:"raw",frames:(S.stacktrace.frames||[]).map((R=>y({},R,{platform:"web:javascript"})))}):void 0}))),P={$exception_message:((d=b[0])==null?void 0:d.value)||u.message,$exception_type:(f=b[0])==null?void 0:f.type,$exception_level:u.level,$exception_list:E,$sentry_event_id:u.event_id,$sentry_exception:u.exception,$sentry_exception_message:((p=b[0])==null?void 0:p.value)||u.message,$sentry_exception_type:(g=b[0])==null?void 0:g.type,$sentry_tags:u.tags};return s&&r&&(P.$sentry_url=(n||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+u.event_id),h&&((m=i.exceptions)==null||m.sendExceptionEvent(P)),u}}class iu{constructor(e,t,s,r,n,a){this.name=ro,this.setupOnce=function(o){o(no(e,{organization:t,projectId:s,prefix:r,severityAllowList:n,sendExceptionsToPostHog:a==null||a}))}}}class yn{constructor(e){this.ci=(t,s,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(x.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:r}),this.fi=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.pi()}pi(){var e;this.gi=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.ci)}destroy(){var e;(e=this.gi)==null||e.call(this),this.gi=void 0}doPageView(e,t){var s,r=this.mi(e,t);return this.fi={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.mi(e,(t=this.fi)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.fi)==null?void 0:e.pageViewId}}mi(e,t){var s=this.fi;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,h=n.maxContentHeight,u=n.lastContentY,c=n.maxContentY;if(!(w(a)||w(o)||w(l)||w(h)||w(u)||w(c))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u),c=Math.ceil(c);var d=a>1?qe(o/a,0,1,x):1,f=a>1?qe(l/a,0,1,x):1,p=h>1?qe(u/h,0,1,x):1,g=h>1?qe(c/h,0,1,x):1;r=J(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$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 ys=["flags","surveys"],su={[Aa]:{exposure:"hidden"},[Gt]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Wt]:{exposure:"hidden"},[Gs]:{exposure:"event"},[Ws]:{exposure:"hidden"},[Js]:{exposure:"event"},[Ys]:{exposure:"hidden"},[Ks]:{exposure:"event"},[Xs]:{exposure:"event"},[Sr]:{exposure:"event"},[Fr]:{exposure:"hidden"},[Zs]:{exposure:"event"},[dt]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[kt]:{exposure:"hidden"},[Pr]:{exposure:"event"},[qa]:{exposure:"event",shouldSkipFromEventProperties:i=>be(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"},[ot]:{exposure:"hidden",storageGroup:"flags"},[Jt]:{exposure:"hidden",storageGroup:"flags"},[Si]:{exposure:"hidden"},[Qs]:{exposure:"hidden",storageGroup:"flags"},[Yt]:{exposure:"hidden",storageGroup:"flags"},[Fi]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Bi]:{exposure:"hidden",storageGroup:"flags"},[Ae]:{exposure:"hidden"},[lt]:{exposure:"hidden"},[je]:{exposure:"hidden"},[ut]:{exposure:"hidden"},[er]:{exposure:"hidden",storageGroup:"surveys"},[Ui]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[tr]:{exposure:"event"},[Pi]:{exposure:"hidden"},[Ii]:{exposure:"hidden"},[Kt]:{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"},[ct]:{exposure:"hidden"},[Xt]:{exposure:"hidden"},[$i]:{exposure:"hidden"},[ei]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[xe]:{exposure:"hidden"},[ir]:{exposure:"hidden"},[sr]:{exposure:"hidden"},[rr]:{exposure:"hidden"},[nr]:{exposure:"hidden"},[Vi]:{exposure:"hidden"},[Gi]:{exposure:"hidden"},[La]:{exposure:"event"},[Da]:{exposure:"event"},[Na]:{exposure:"event"},[ja]:{exposure:"event"},[za]:{exposure:"event"},[Ba]:{exposure:"event"},[Ua]:{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"}},ru=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],it=i=>{var e=su[i];if(e)return e;for(var t of ru){var s=t[1];if(i.indexOf(t[0])===0)return s}},Et=(i,e)=>{try{return JSON.stringify(i,((t,s)=>typeof s=="bigint"?s.toString():s),e)}catch{return ia(i)}},Rt=i=>{var e=k?.createElement("a");return w(e)?null:(e.href=i,e)},Tt=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(!q(t)||2>t.length)return"";var a=t[1];try{a=decodeURIComponent(a)}catch{x.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},li=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("&"),h=[],u=0;l.length>u;u++){var c=l[u].split("=");q(c)&&(e.includes(c[0])?h.push(c[0]+"="+t):h.push(l[u]))}var d=o;return a!=null&&(d+="?"+h.join("&")),r!=null&&(d+="#"+r),d},Xi=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},ao=(i,e)=>i>=e&&Qn(),oo=(i,e,t,s)=>{if(i===0){if(Qn()){var r=e+1;return r===t&&s(),r}return e}return 0},yi="https?://(.*)",Ct=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],nu=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ct],ui="<masked>",au=["li_fat_id"];function lo(i,e,t){if(!k)return{};var s,r=e?[...Ct,...t||[]]:[],n=uo(li(k.URL,r,ui),i),a=(s={},V(au,(function(o){var l=Va(o);s[o]=l||null})),s);return J(a,n)}function uo(i,e){var t=nu.concat(e||[]),s={};return V(t,(function(r){var n=Tt(i,r);s[r]=n||null})),s}function ho(i){var e=(function(n){return n?n.search(yi+"google.([^/?]*)")===0?"google":n.search(yi+"bing.com")===0?"bing":n.search(yi+"yahoo.com")===0?"yahoo":n.search(yi+"duckduckgo.com")===0?"duckduckgo":null:null})(i),t=e!="yahoo"?"q":"p",s={};if(!be(e)){s.$search_engine=e;var r=k?Tt(k.referrer,t):"";r.length&&(s.ph_keyword=r)}return s}function bn(){return navigator.language||navigator.userLanguage}var Zi="$direct";function co(){return k?.referrer||Zi}function po(i,e,t){t===void 0&&(t=!1);var s=i?[...Ct,...e||[]]:[],r=t?Xe(X?.href):X?.href,n=r?.substring(0,1e3);return{r:co().substring(0,1e3),u:n?li(n,s,ui):void 0}}function vo(i,e){var t;e===void 0&&(e=!1);var s=i.r,r=i.u,n=e?Xe(r):r,a={$referrer:s,$referring_domain:s==null?void 0:s==Zi?Zi:(t=Rt(s))==null?void 0:t.host};if(n){a.$current_url=n;var o=Rt(n);a.$host=o?.host,a.$pathname=o?.pathname;var l=uo(n);J(a,l)}if(s){var h=ho(s);J(a,h)}return a}function fo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function ou(){try{return new Date().getTimezoneOffset()}catch{return}}var lu={flags:ei,surveys:Ui},uu=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],_t="main";class bs{constructor(e,t,s){if(s===void 0&&(s=!0),this.yi={},this.bi=!1,this.wi=!1,this.qe=e,this.ki=s,this.props={},this.xi=void 0,this.Si=(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.oi=this.Ci(e),this.wi=this.Mi(e),this.load(),e.debug&&x.info("Persistence loaded",e.persistence,y({},this.props)),this.update_config(e,e,t),this.save(),v){var r=()=>this.flush();Z(v,"beforeunload",r,{capture:!1}),Z(v,"pagehide",r,{capture:!1})}}Ti(){var e,t=(e=this.qe)==null?void 0:e.persistence_save_debounce_ms;return ne(t)&&t>0?t:0}isDisabled(){return!!this.Ei}Ci(e){uu.indexOf(e.persistence.toLowerCase())===-1&&(x.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=[...Hl,...a];return y({},W,{H(h){try{var u={};try{u=Ue.H(h)||{}}catch{}var c,d=JSON.parse(W.P(h)||"{}");if(o){var f={};for(var p in u){var g=u[p];be(g)||g===""||(f[p]=g)}c=J(d,f)}else c=J(u,d);return W.F(h,c),c}catch{}return null},F(h,u,c,d,f,p){var g=W.F(h,u,void 0,void 0,p);try{var _={};l.forEach((m=>{u[m]&&(_[m]=u[m])})),Object.keys(_).length&&Ue.F(h,_,c,d,f,p)}catch(m){W.j(m)}return g},q(h,u){try{v?.localStorage.removeItem(h),Ue.q(h,u)}catch(c){W.j(c)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,n=e.persistence.toLowerCase();return n==="localstorage"&&W.N()?(t=W,r=!0):n==="localstorage+cookie"&&s.N()?(t=s,r=!0):n==="sessionstorage"&&se.N()?t=se:n==="memory"?t=zl:n==="cookie"?t=Ue:s.N()?(t=s,r=!0):t=Ue,this.bi=r,t}Ii(e){return this.Si+"__"+e}Mi(e){return this.bi&&!!e.split_storage}properties(){var e={};return V(this.props,((t,s)=>{var r=it(s);if(!r||r.exposure==="event"){if(r!=null&&r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t))return;e[s]=t}})),e}load(){if(!this.Ei){var e=this.oi.H(this.Si);e&&(this.props=J({},e)),this.wi&&this.Pi()}}Pi(){for(var e of ys){var t=W.H(this.Ii(e));if(t&&!Ge(t)){var s=this.Ri(e);s.persisted=!0,this.Ai(e)||(s.fingerprint=this.Fi(t,e)),this.Li(e,t)||J(this.props,t)}}}Ai(e){return Object.keys(this.props).some((t=>{var s;return((s=it(t))==null?void 0:s.storageGroup)===e}))}Li(e,t){var s=lu[e];if(!s)return!1;var r=t[s],n=this.props[s];return ne(r)&&ne(n)&&n>r}refreshKey(e){var t;if(!this.Ei){var s=this.wi?(t=it(e))==null?void 0:t.storageGroup:void 0,r=s?W.H(this.Ii(s)):this.oi.H(this.Si);if(r&&e in r)this.Oi(e,r[e]);else{if(s){var n=this.oi.H(this.Si);if(n&&e in n)return void this.Oi(e,n[e])}this.Di(e)}}}save(){if(!this.Ei){var e=this.Ti();e>0?w(this.$i)&&(this.$i=setTimeout((()=>{this.$i=void 0,this.Ni()}),e)):this.Ni()}}flush(){w(this.$i)||(clearTimeout(this.$i),this.$i=void 0,this.Ni())}Ni(){this.Ei||(this.wi?this.qi():this.ji(this.oi,this.Si,this.props,_t))}qi(){var e=this.Bi(),t=e.main,s=e.groups;for(var r of(this.ji(this.oi,this.Si,t,_t),ys)){var n,a=s[r];(!Ge(a)||(n=this.yi[r])!=null&&n.persisted)&&this.ji(W,this.Ii(r),a,r)}}Bi(){var e={},t={flags:{},surveys:{}};return V(this.props,((s,r)=>{var n,a=(n=it(r))==null?void 0:n.storageGroup;a?t[a][r]=s:e[r]=s})),{main:e,groups:t}}Fi(e,t){if(t===_t)return JSON.stringify(e)+"|"+this.Hi+"|"+this.Ui+"|"+this.zi;var s={};return V(e,((r,n)=>{var a;s[n]=(a=it(n))!=null&&a.volatile?"__volatile__":r})),JSON.stringify(s)}ji(e,t,s,r){var n=this.Ri(r);if(r===_t||n.dirty||w(n.fingerprint)){var a;try{if((a=this.Fi(s,r))===n.fingerprint)return void(n.dirty=!1)}catch{a=void 0}e.F(t,s,this.Hi,this.Ui,this.zi,this.qe.debug)?(n.dirty=!1,r!==_t&&(n.persisted=!0),w(a)||(n.fingerprint=a)):this.qe.debug&&x.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(w(this.$i)||(clearTimeout(this.$i),this.$i=void 0),this.oi.q(this.Si,!1),this.oi.q(this.Si,!0),!s&&this.ki)for(var r of ys)W.q(this.Ii(r));s?delete this.yi[_t]:this.yi={}}clear(){this.remove(),this.props={}}register_once(e,t,s){if(Y(e)){w(t)&&(t="None"),this.Hi=w(s)?this.Wi:s;var r=!1;if(V(e,((n,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.Oi(a,n),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(Y(e)){this.Hi=w(t)?this.Wi:t;var s=!1;if(V(e,((r,n)=>{e.hasOwnProperty(n)&&(this.props[n]!==r||Y(r)||q(r))&&(this.Oi(n,r),s=!0)})),s)return this.save(),!0}return!1}unregister(e){var t=typeof e=="string"?[e]:e,s=!1;for(var r of t)r in this.props&&(this.Di(r),s=!0);s&&this.save()}update_campaign_params(){var e=k?.URL;if(e!==this.xi){var t=lo(this.qe.custom_campaign_params,this.qe.mask_personal_data_properties,this.qe.custom_personal_data_properties);Ge($r(t))||this.register(t),this.xi=e}}update_search_keyword(){var e;this.register((e=k?.referrer)?ho(e):{})}update_referrer_info(){var e;this.register_once({$referrer:co(),$referring_domain:k!=null&&k.referrer&&((e=Rt(k.referrer))==null?void 0:e.host)||Zi},void 0)}set_initial_person_info(){this.props[rr]||this.props[nr]||this.register_once({[Vi]:po(this.qe.mask_personal_data_properties,this.qe.custom_personal_data_properties,this.qe.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};V([nr,rr],(r=>{var n=this.props[r];n&&V(n,(function(a,o){e["$initial_"+Ns(o)]=a}))}));var t=this.props[Vi];if(t){var s=(function(r,n){n===void 0&&(n=!1);var a=vo(r,n),o={};return V(a,(function(l,h){o["$initial_"+Ns(h)]=l})),o})(t,this.qe.disable_capture_url_hashes);J(e,s)}return e}safe_merge(e){return V(this.props,(function(t,s){s in e||(e[s]=t)})),e}update_config(e,t,s){this.Wi=this.Hi=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,h)=>{if(l.length!==h.length)return!1;var u=[...l].sort(),c=[...h].sort();return u.every(((d,f)=>d===c[f]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=r?this.Ci(e):this.oi,a=this.Mi(e);if(r||a!==this.wi){var o=this.props;this.clear(),this.oi=n,this.wi=a,this.props=o,this.save()}}set_disabled(e){this.Ei=e,this.Ei?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ui&&(this.Ui=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.zi&&(this.zi=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var s=this.props[Wt]||{};s[e]=t,this.Oi(Wt,s),this.save()}remove_event_timer(e){var t=this.props[Wt]||{},s=t[e];return w(s)||(delete t[e],this.Oi(Wt,t),this.save()),s}get_property(e){return this.props[e]}set_property(e,t){this.Oi(e,t),this.save()}Oi(e,t){var s;this.props[e]=t,(s=it(e))!=null&&s.volatile||this.Vi(e)}Di(e){delete this.props[e],this.Vi(e)}Vi(e){var t,s=(t=it(e))==null?void 0:t.storageGroup;s&&(this.Ri(s).dirty=!0)}Ri(e){return this.yi[e]||(this.yi[e]={})}}function bi(i){var e=!0;return{dispose(){if(e){e=!1;var t=i();t&&de(t.then)&&t.then(void 0,(()=>{}))}}}}var pe={GZipJS:"gzip-js",Base64:"base64"},Nt={Activation:"events",Cancellation:"cancelEvents"},ws={Popover:"popover",API:"api",Widget:"widget"},Ve={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},xs={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},hr={Popover:"popover",Inline:"inline"},hu={SHOWN:"product tour shown"},wn={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},xn=K("[RateLimiter]");class cu{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=>{xn.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4}))}catch(r){return void xn.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(sr))!==null&&t!==void 0?t:{tokens:n,last:o};l.tokens+=(o-l.last)/1e3*a,l.last=o,l.tokens>n&&(l.tokens=n);var h=1>l.tokens;if(h||e||(l.tokens=Math.max(0,l.tokens-1)),h&&!e){var u=(ne(l.dropped)?l.dropped:0)+1;l.dropped=u,!this.lastEventRateLimited&&this.Zi(u)&&(l.dropped=0)}return this.lastEventRateLimited=h,(r=this.instance.persistence)==null||r.set_property(sr,l),{isRateLimited:h,remainingTokens:l.tokens}}Gi(e){var t=this.instance.config.property_denylist;return!q(t)||!t.includes(e)}Qi(){var e;if(this.Gi("$current_url")&&this.Gi("$pathname")&&X!=null&&X.pathname)return""+((e=X.origin)!==null&&e!==void 0?e:"")+X.pathname}Zi(e){var t,s,r=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,a=this.Qi(),o=this.Gi("$session_id")?(t=(s=this.instance).get_session_id)==null?void 0:t.call(s):void 0,l=[e+" event(s) dropped since the last warning",a?"triggered on "+a:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+l+". Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var Ke=K("[RemoteConfig]");class go{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=C._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Ki(e){var t,s;(t=C.__PosthogExtensions__)!=null&&t.loadExternalDependency?(s=C.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}Ji(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:e})}load(){try{if(this.remoteConfig)return Ke.info("Using preloaded remote config",this.remoteConfig),this.Yi(this.remoteConfig),void this.Xi();if(this._instance.tr())return void Ke.warn("Remote config is disabled. Falling back to local config.");this.Ki((e=>{if(!e)return Ke.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ji((t=>{this.Yi(t.json,t),this.Xi()}));this.Yi(e),this.Xi()}))}catch(e){Ke.error("Error loading remote config",e),this.Yi()}}stop(){this.er&&(clearInterval(this.er),this.er=void 0)}refresh(){!this._instance.tr()&&k&&k.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Xi(){var e;if(!this.er){var t=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;t!==0&&(this.er=setInterval((()=>{this.refresh()}),t))}}Yi(e,t){!e&&t&&(t.statusCode===0?t.error||Ke.warn("Failed to fetch remote config from PostHog."):Ke.error("Failed to fetch remote config from PostHog."));try{this._instance.Yi(e?{ok:!0,config:e}:{ok:!1})}catch(r){Ke.error("Error applying remote config",r)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var s;(s=this._instance.featureFlags)==null||s.ensureFlagsLoaded()}catch(r){Ke.error("Error loading feature flags",r)}}}var Re=Uint8Array,ye=Uint16Array,Mt=Uint32Array,Mr=new Re([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Or=new Re([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),kn=new Re([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_o=function(i,e){for(var t=new ye(31),s=0;31>s;++s)t[s]=e+=1<<i[s-1];var r=new Mt(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]},mo=_o(Mr,2),cr=mo[1];mo[0][28]=258,cr[258]=28;for(var En=_o(Or,0)[1],yo=new ye(32768),Q=0;32768>Q;++Q){var mt=(43690&Q)>>>1|(21845&Q)<<1;yo[Q]=((65280&(mt=(61680&(mt=(52428&mt)>>>2|(13107&mt)<<2))>>>4|(3855&mt)<<4))>>>8|(255&mt)<<8)>>>1}var ii=function(i,e,t){for(var s=i.length,r=0,n=new ye(e);s>r;++r)++n[i[r]-1];var a,o=new ye(e);for(r=0;e>r;++r)o[r]=o[r-1]+n[r-1]<<1;for(a=new ye(s),r=0;s>r;++r)a[r]=yo[o[i[r]-1]++]>>>15-i[r];return a},vt=new Re(288);for(Q=0;144>Q;++Q)vt[Q]=8;for(Q=144;256>Q;++Q)vt[Q]=9;for(Q=256;280>Q;++Q)vt[Q]=7;for(Q=280;288>Q;++Q)vt[Q]=8;var Qi=new Re(32);for(Q=0;32>Q;++Q)Qi[Q]=5;var du=ii(vt,9),pu=ii(Qi,5),bo=function(i){return(i/8>>0)+(7&i&&1)},wo=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var s=new(i instanceof ye?ye:i instanceof Mt?Mt:Re)(t-e);return s.set(i.subarray(e,t)),s},Le=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8},jt=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8,i[s+2]|=t>>>16},ks=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 Re(0),0];if(r==1){var a=new Re(t[0].s+1);return a[t[0].s]=1,[a,1]}t.sort((function(S,R){return S.f-R.f})),t.push({s:-1,f:25001});var o=t[0],l=t[1],h=0,u=1,c=2;for(t[0]={s:-1,f:o.f+l.f,l:o,r:l};u!=r-1;)o=t[t[c].f>t[h].f?h++:c++],l=t[h!=u&&t[c].f>t[h].f?h++:c++],t[u++]={s:-1,f:o.f+l.f,l:o,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var f=new ye(d+1),p=dr(t[u-1],f,0);if(p>e){s=0;var g=0,_=p-e,m=1<<_;for(n.sort((function(S,R){return f[R.s]-f[S.s]||S.f-R.f}));r>s;++s){var b=n[s].s;if(e>=f[b])break;g+=m-(1<<p-f[b]),f[b]=e}for(g>>>=_;g>0;){var E=n[s].s;e>f[E]?g-=1<<e-f[E]++-1:++s}for(;s>=0&&g;--s){var P=n[s].s;f[P]==e&&(--f[P],++g)}p=e}return[new Re(f),p]},dr=function(i,e,t){return i.s==-1?Math.max(dr(i.l,e,t+1),dr(i.r,e,t+1)):e[i.s]=t},Sn=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new ye(++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]},Ht=function(i,e){for(var t=0,s=0;e.length>s;++s)t+=i[s]*e[s];return t},pr=function(i,e,t){var s=t.length,r=bo(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)},Fn=function(i,e,t,s,r,n,a,o,l,h,u){Le(e,u++,t),++r[256];for(var c=ks(r,15),d=c[0],f=c[1],p=ks(n,15),g=p[0],_=p[1],m=Sn(d),b=m[0],E=m[1],P=Sn(g),S=P[0],R=P[1],D=new ye(19),F=0;b.length>F;++F)D[31&b[F]]++;for(F=0;S.length>F;++F)D[31&S[F]]++;for(var $=ks(D,7),I=$[0],M=$[1],T=19;T>4&&!I[kn[T-1]];--T);var O,H,z,N,ee=h+5<<3,ae=Ht(r,vt)+Ht(n,Qi)+a,fe=Ht(r,d)+Ht(n,g)+a+14+3*T+Ht(D,I)+(2*D[16]+3*D[17]+7*D[18]);if(ae>=ee&&fe>=ee)return pr(e,u,i.subarray(l,l+h));if(Le(e,u,1+(ae>fe)),u+=2,ae>fe){O=ii(d,f),H=d,z=ii(g,_),N=g;var ue=ii(I,M);for(Le(e,u,E-257),Le(e,u+5,R-1),Le(e,u+10,T-4),u+=14,F=0;T>F;++F)Le(e,u+3*F,I[kn[F]]);u+=3*T;for(var ge=[b,S],we=0;2>we;++we){var te=ge[we];for(F=0;te.length>F;++F)Le(e,u,ue[le=31&te[F]]),u+=I[le],le>15&&(Le(e,u,te[F]>>>5&127),u+=te[F]>>>12)}}else O=du,H=vt,z=pu,N=Qi;for(F=0;o>F;++F)if(s[F]>255){var le;jt(e,u,O[257+(le=s[F]>>>18&31)]),u+=H[le+257],le>7&&(Le(e,u,s[F]>>>23&31),u+=Mr[le]);var oe=31&s[F];jt(e,u,z[oe]),u+=N[oe],oe>3&&(jt(e,u,s[F]>>>5&8191),u+=Or[oe])}else jt(e,u,O[s[F]]),u+=H[s[F]];return jt(e,u,O[256]),u+H[256]},vu=new Mt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),fu=(function(){for(var i=new Mt(256),e=0;256>e;++e){for(var t=e,s=9;--s;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i})(),Es=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8};function gu(i,e){e===void 0&&(e={});var t=(function(){var c=4294967295;return{p(d){for(var f=c,p=0;d.length>p;++p)f=fu[255&f^d[p]]^f>>>8;c=f},d(){return 4294967295^c}}})(),s=i.length;t.p(i);var r,n,a,o,l,h=(o=10+((r=e).filename&&r.filename.length+1||0),l=8,(function(c,d,f,p,g,_){var m=c.length,b=new Re(p+m+5*(1+Math.floor(m/7e3))+g),E=b.subarray(p,b.length-g),P=0;if(!d||8>m)for(var S=0;m>=S;S+=65535){var R=S+65535;m>R?P=pr(E,P,c.subarray(S,R)):(E[S]=!0,P=pr(E,P,c.subarray(S,m)))}else{for(var D=vu[d-1],F=D>>>13,$=8191&D,I=(1<<f)-1,M=new ye(32768),T=new ye(I+1),O=Math.ceil(f/3),H=2*O,z=function(as){return(c[as]^c[as+1]<<O^c[as+2]<<H)&I},N=new Mt(25e3),ee=new ye(288),ae=new ye(32),fe=0,ue=0,ge=(S=0,0),we=0,te=0;m>S;++S){var le=z(S),oe=32767&S,Ce=T[le];if(M[oe]=Ce,T[le]=oe,S>=we){var Qe=m-S;if((fe>7e3||ge>24576)&&Qe>423){P=Fn(c,E,0,N,ee,ae,ue,ge,te,S-te,P),ge=fe=ue=0,te=S;for(var re=0;286>re;++re)ee[re]=0;for(re=0;30>re;++re)ae[re]=0}var Te=2,Je=0,Ot=$,Pe=oe-Ce&32767;if(Qe>2&&le==z(S-Pe))for(var _e=Math.min(F,Qe)-1,hi=Math.min(32767,S),ci=Math.min(258,Qe);hi>=Pe&&--Ot&&oe!=Ce;){if(c[S+Te]==c[S+Te-Pe]){for(var Ie=0;ci>Ie&&c[S+Ie]==c[S+Ie-Pe];++Ie);if(Ie>Te){if(Te=Ie,Je=Pe,Ie>_e)break;var di=Math.min(Pe,Ie-2),ft=0;for(re=0;di>re;++re){var gt=S-Pe+re+32768&32767,At=gt-M[gt]+32768&32767;At>ft&&(ft=At,Ce=gt)}}}Pe+=(oe=Ce)-(Ce=M[oe])+32768&32767}if(Je){N[ge++]=268435456|cr[Te]<<18|En[Je];var qr=31&cr[Te],Lr=31&En[Je];ue+=Mr[qr]+Or[Lr],++ee[257+qr],++ae[Lr],we=S+Te,++fe}else N[ge++]=c[S],++ee[c[S]]}}P=Fn(c,E,!0,N,ee,ae,ue,ge,te,S-te,P)}return wo(b,0,p+bo(P)+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)),u=h.length;return(function(c,d){var f=d.filename;if(c[0]=31,c[1]=139,c[2]=8,c[8]=2>d.level?4:d.level==9?2:0,c[9]=3,d.mtime!=0&&Es(c,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),f){c[3]=8;for(var p=0;f.length>=p;++p)c[p+10]=f.charCodeAt(p)}})(h,e),Es(h,u-8,t.d()),Es(h,u-4,s),h}var _u=!!qs||!!mr,xo="text/plain",Ti=!1,ko=(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:"")},rs=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((u=>{var c,d=u.split("="),f=d[0],p=t&&(c=o[f])!==null&&c!==void 0?c:d[1];return delete o[f],f+"="+p})))!==null&&s!==void 0?s:[],h=(function(u,c){var d,f;c===void 0&&(c="&");var p=[];return V(u,(function(g,_){w(g)||w(_)||_==="undefined"||(d=encodeURIComponent((m=>m instanceof File)(g)?g.name:g.toString()),f=encodeURIComponent(_),p[p.length]=f+"="+d)})),p.join(c)})(o);return h&&l.push(h),l.length>0?n+"?"+l.join("&"):n},Ss=i=>{if(i.ir)return i.ir;var e=i.data,t=i.compression;if(e){if(t===pe.GZipJS){var s=gu((function(o,l){var h=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var u=new Re(o.length+(o.length>>>1)),c=0,d=function(_){u[c++]=_},f=0;h>f;++f){if(c+5>u.length){var p=new Re(c+8+(h-f<<1));p.set(u),u=p}var g=o.charCodeAt(f);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(++f))>>>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 wo(u,0,c)})(Et(e)),{mtime:0});return{contentType:xo,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(t===pe.Base64){var r=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,((l,h)=>String.fromCharCode(parseInt(h,16)))))})(Et(e)),n=(o=>"data="+encodeURIComponent(typeof o=="string"?o:Et(o)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var a=Et(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Eo=i=>{var e,t,s=()=>i.transport==="sendBeacon"?{url:rs(i.url,{compression:pe.Base64}),encodedBody:Ss(y({},i,{compression:pe.Base64,ir:void 0}))}:{url:ko(i.url,"compression"),encodedBody:Ss(y({},i,{compression:void 0,ir:void 0}))};try{e=Ss(i)}catch(r){if(Ur(i.compression,Tt(i.url,"compression")))return x.error("Failed to gzip request body, sending uncompressed payload",r),s();throw r}return e&&Ur(i.compression,Tt(i.url,"compression"))&&!((t=e.body)instanceof ArrayBuffer?Ls(new Uint8Array(t)):ArrayBuffer.isView(t)&&Ls(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?(Ti=!0,s()):{url:i.url,encodedBody:e}},So=i=>{try{return Eo(i)}catch(e){return x.error(e),void(i.callback==null||i.callback({statusCode:0,error:e}))}},mu=(function(){var i=G((function*(e){var t=Et(e.data),s=yield(function(n,a,o){return Ds.apply(this,arguments)})(t,U.DEBUG,{rethrow:!0});if(!s)return e;var r=yield s.arrayBuffer();return y({},e,{ir:{contentType:xo,body:r,estimatedSize:r.byteLength}})}));return function(e){return i.apply(this,arguments)}})(),yu=/Failed to fetch|NetworkError|Load failed/i,Fo=i=>i?.name==="TypeError"&&yu.test(i?.message||""),Po=i=>{var e=So(i);if(e){var t=e.url,s=e.encodedBody,r=s??{},n=r.contentType,a=r.body,o=r.estimatedSize,l=new Headers;V(i.headers,(function(p,g){l.append(g,p)})),n&&l.append("Content-Type",n);var h=null,u=!1;if(Dr){var c=new Dr;h={signal:c.signal,timeout:setTimeout((()=>{var p,g;u=!0,c.abort((p=i.timeout,(g=new Error("PostHog request timed out"+(p?" after "+p+"ms":""))).name="AbortError",g))}),i.timeout)}}var d=p=>{u&&p?.name==="AbortError"||Fo(p)?x.warn(p):x.error(p),i.callback==null||i.callback({statusCode:0,error:p})};try{var f;mr(t,y({method:i?.method||"GET",headers:l,keepalive:i.method==="POST"&&!i.rr&&52428.8>(o||0),body:a,signal:(f=h)==null?void 0:f.signal},i.fetchOptions)).then((p=>p.text().then((g=>{var _={statusCode:p.status,text:g};if(p.status===200)try{_.json=JSON.parse(g)}catch(m){x.error(m)}i.callback==null||i.callback(_)})))).catch(d).finally((()=>h?clearTimeout(h.timeout):null))}catch(p){h&&clearTimeout(h.timeout),d(p)}}},vr=i=>{try{var e,t=Eo(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(ve.sendBeacon(s,l))return;var h=q(i.data)?i.data:(e=i.data)==null?void 0:e.batch;if(q(h)&&h.length>1&&(o??0)>16384){var u=Math.ceil(h.length/2),c=d=>q(i.data)?d:y({},i.data,{batch:d});return vr(y({},i,{data:c(h.slice(0,u))})),void vr(y({},i,{data:c(h.slice(u))}))}x.warn("Beacon of ~"+(o??0)+" bytes was rejected by the browser, falling back to fetch"),Po(y({},i,{rr:!0}))}catch(d){x.warn("Beacon send failed",d)}},Pn=(i,e,t,s)=>{var r=s==="query"?e==="POST"?"sent_at":"_":void 0;return rs(t===pe.GZipJS?ko(i,"compression"):i,y({},r?{[r]:Date.now().toString()}:{},t===pe.GZipJS?{}:{compression:t}))},Ci=[];mr&&Ci.push({transport:"fetch",method:Po}),qs&&Ci.push({transport:"XHR",method(i){var e=So(i);if(e){var t=new qs,s=e.encodedBody;t.open(i.method||"GET",e.url,!0);var r=s??{},n=r.contentType,a=r.body;V(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)}}}),ve!=null&&ve.sendBeacon&&Ci.push({transport:"sendBeacon",method:vr});var fr=3e3;class bu{constructor(e,t){this.nr=!0,this.sr=[],this.ar=qe(t?.flush_interval_ms||fr,250,5e3,x.createLogger("flush interval"),fr),this.lr=e}enqueue(e){this.sr.push(e),this.ur||this.hr()}unload(){this.dr();var e=this.sr.length>0?this.vr():{},t=Object.values(e);[...t.filter((s=>s.url.indexOf("/e")===0)),...t.filter((s=>s.url.indexOf("/e")!==0))].map((s=>{this.cr(y({},s,{transport:"sendBeacon"}))}))}enable(){this.nr=!1,this.hr()}hr(){var e=this;this.nr||(this.ur=setTimeout((()=>{if(this.dr(),this.sr.length>0){var t=this.vr(),s=function(){var n=t[r],a=new Date().getTime();n.data&&q(n.data)&&V(n.data,(o=>{o.offset=Math.abs(o.timestamp-a),delete o.timestamp})),e.cr(n)};for(var r in t)s()}}),this.ar))}cr(e){try{this.lr(e)}catch(t){x.error(t)}}dr(){clearTimeout(this.ur),this.ur=void 0}vr(){var e={};return V(this.sr,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;w(e[n])&&(e[n]=y({},r,{data:[]})),(s=e[n].data)==null||s.push(r.data)})),this.sr=[],e}}var wu=["retriesPerformedSoFar"];class xu{constructor(e){this.pr=!1,this.gr=3e3,this.sr=[],this._instance=e,this.sr=[],this.mr=!0,!w(v)&&"onLine"in v.navigator&&(this.mr=v.navigator.onLine,this.yr=()=>{this.mr=!0,this.br()},this._r=()=>{this.mr=!1},Z(v,"online",this.yr),Z(v,"offline",this._r))}get length(){return this.sr.length}retriableRequest(e){var t=e.retriesPerformedSoFar,s=ea(e,wu);Ne(t)&&(s.url=rs(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.Lt(y({retriesPerformedSoFar:t},s));r.statusCode===0&&x.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)}}))}Lt(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var s=(function(a){var o=3e3*Math.pow(2,a),l=o/2,h=Math.min(18e5,o),u=Math.random()-.5;return Math.ceil(h+u*(h-l))})(t),r=Date.now()+s;this.sr.push({retryAt:r,requestOptions:e});var n="Enqueued failed request for retry in "+s;navigator.onLine||(n+=" (Browser is offline)"),x.warn(n),this.pr||(this.pr=!0,this.wr())}wr(){if(this.kr&&clearTimeout(this.kr),this.sr.length===0)return this.pr=!1,void(this.kr=void 0);this.kr=setTimeout((()=>{this.mr&&this.sr.length>0&&this.br(),this.wr()}),this.gr)}br(){var e=Date.now(),t=[],s=this.sr.filter((n=>e>n.retryAt||(t.push(n),!1)));if(this.sr=t,s.length>0)for(var r of s)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.kr&&(clearTimeout(this.kr),this.kr=void 0),this.pr=!1,w(v)||(this.yr&&(v.removeEventListener("online",this.yr),this.yr=void 0),this._r&&(v.removeEventListener("offline",this._r),this._r=void 0)),this.sr)){var t=e.requestOptions;try{this._instance._send_request(y({},t,{transport:"sendBeacon"}))}catch(s){x.error(s)}}this.sr=[]}}class ku{constructor(e){this.Sr=()=>{var t,s,r,n;this.Cr||(this.Cr={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,h=o+(a?.clientHeight||0),u=a?.scrollHeight||0;this.Cr.lastScrollY=Math.ceil(o),this.Cr.maxScrollY=Math.max(o,(t=this.Cr.maxScrollY)!==null&&t!==void 0?t:0),this.Cr.maxScrollHeight=Math.max(l,(s=this.Cr.maxScrollHeight)!==null&&s!==void 0?s:0),this.Cr.lastContentY=h,this.Cr.maxContentY=Math.max(h,(r=this.Cr.maxContentY)!==null&&r!==void 0?r:0),this.Cr.maxContentHeight=Math.max(u,(n=this.Cr.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}get Mr(){return this._instance.config.scroll_root_selector}getContext(){return this.Cr}resetContext(){var e=this.Cr;return setTimeout(this.Sr,0),e}startMeasuringScrollPosition(){Z(v,"scroll",this.Sr,{capture:!0}),Z(v,"scrollend",this.Sr,{capture:!0}),Z(v,"resize",this.Sr)}scrollElement(){if(!this.Mr)return v?.document.documentElement;var e=q(this.Mr)?this.Mr:[this.Mr];for(var t of e){var s=v?.document.querySelector(t);if(s)return s}}Tr(e){var t=e==="y"?"scrollTop":"scrollLeft";if(this.Mr){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.Tr("y")}scrollX(){return this.Tr("x")}}var Eu=i=>po(i?.config.mask_personal_data_properties,i?.config.custom_personal_data_properties,i?.config.disable_capture_url_hashes);class In{constructor(e,t,s,r){this.Er=n=>{var a=this.Ir();if(!a||a.sessionId!==n){var o={sessionId:n,props:this.Pr(this._instance)};this.Rr.register({[ir]:o})}},this._instance=e,this.Ar=t,this.Rr=s,this.Pr=r||Eu,this.Ar.onSessionId(this.Er)}Ir(){return this.Rr.props[ir]}getSetOnceProps(){var e,t=(e=this.Ir())==null?void 0:e.props;return t?"r"in t?vo(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 V($r(this.getSetOnceProps()),((t,s)=>{s==="$current_url"&&(s="url"),e["$session_entry_"+Ns(s)]=t})),e}}class Ar{on(e,t){return this.Fr[e]||(this.Fr[e]=[]),this.Fr[e].push(t),()=>{this.Fr[e]=this.Fr[e].filter((s=>s!==t))}}emit(e,t){for(var s of this.Fr[e]||[])s(t);for(var r of this.Fr["*"]||[])r(e,t)}constructor(){this.Fr={}}}var yt=K("[SessionId]"),$n=864e5;class Rn{on(e,t){return this.Lr.on(e,t)}constructor(e,t,s){var r;if(this.Or=null,this.Dr=[],this.$r=void 0,this.Nr=!1,this.Lr=new Ar,this.qr=(l,h)=>!(!Ne(l)||!Ne(h))&&Math.abs(l-h)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Be)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qe=e.config,this.Rr=e.persistence,this.jr=void 0,this.Br=void 0,this._sessionStartTimestamp=null,this.Hr=void 0,this._sessionActivityTimestamp=null,this.Ur=t||ze,this.zr=s||ze;var n=this.qe.persistence_name||this.qe.token;if(this._sessionTimeoutMs=1e3*qe(this.qe.session_idle_timeout_seconds||1800,60,36e3,yt.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Wr(),this.Vr="ph_"+n+"_window_id",this.Zr="ph_"+n+"_primary_window_exists",this.Gr()){var a=se.H(this.Vr),o=se.H(this.Zr);a&&!o?this.jr=a:se.q(this.Vr),se.F(this.Zr,!0)}(r=this.qe.bootstrap)!=null&&r.sessionID&&this.setBootstrapSessionId(this.qe.bootstrap.sessionID),this.Qr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return w(this.Dr)&&(this.Dr=[]),this.Dr.push(e),this.Br&&e(this.Br,this.jr),()=>{this.Dr=this.Dr.filter((t=>t!==e))}}Gr(){return this.qe.persistence!=="memory"&&!this.Rr.Ei&&se.N()}Kr(e){e!==this.jr&&(this.jr=e,this.Gr()&&se.F(this.Vr,e))}Jr(){return this.jr?this.jr:this.Gr()?se.H(this.Vr):null}Yr(e){var t=this.Or;return!be(t)&&!be(e)&&5e3>Math.abs(e-t)}Xr(e,t,s){var r=t!==this._sessionActivityTimestamp,n=!(e!==this.Br||s!==this._sessionStartTimestamp);this._sessionStartTimestamp=s,this._sessionActivityTimestamp=t,this.Br=e,n&&!r||n&&this.Yr(t)||(this.Or=t,this.Rr.register({[kt]:[t,e,s]}))}tn(){var e,t=(e=this.qe)==null?void 0:e.persistence_save_debounce_ms;return Ne(t)&&t>0}en(){this.tn()?this.Rr.refreshKey(kt):(this.Rr.flush(),this.Rr.load())}rn(){var e;if(!be(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Or){this.en();var t=this.nn();t[1]===this.Br&&t[2]===this._sessionStartTimestamp&&(this.Or=this._sessionActivityTimestamp,this.Rr.register({[kt]:[this._sessionActivityTimestamp,(e=this.Br)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Rr.flush())}}sn(){var e=this.nn()[0],t=Ne(e)?e:0,s=Ne(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,s)}an(e){return this.en(),this.qr(e,this.sn())}nn(){var e=this.Rr.props[kt];return q(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Or=null,this.Hr=void 0,clearTimeout(this.ln),this.ln=void 0,this.Xr(null,null,null)}setBootstrapSessionId(e,t){t===void 0&&(t=!1);var s=(function(r,n){n===void 0&&(n=new Date().getTime());try{var a=(o=>{var l=o.replace(/-/g,"");if(l.length!==32)throw new Error("Not a valid UUID");if(l[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(l.substring(0,12),16)})(r);return a>n+6e4?void yt.error("Bootstrap sessionID cannot be in the future"):a}catch(o){return void yt.error("Invalid sessionID in bootstrap",o)}})(e);return!w(s)&&(t?this.Hr={sessionId:e,sessionStartTimestamp:s}:this.Xr(e,new Date().getTime(),s),!0)}destroy(){this.Nr=!0,this.rn(),clearTimeout(this.ln),this.ln=void 0,this.$r&&v&&(v.removeEventListener(Ji,this.$r,{capture:!1}),this.$r=void 0),this.Dr=[]}Qr(){this.$r=()=>{this.rn(),this.Gr()&&se.q(this.Zr)},Z(v,Ji,this.$r,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.qe.cookieless_mode===Be)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=t||new Date().getTime(),r=this.nn(),n=r[1],a=r[2],o=this.sn(),l=this.Jr(),h=this.Hr,u=!!h&&(h.sessionStartTimestamp>s+6e4||s-h.sessionStartTimestamp>$n),c=h?u:Ne(a)&&Math.abs(s-a)>$n,d=!1,f=!1,p=!n||!!h,g=n,_=!p&&!e&&this.qr(s,o);if(_){(_=this.an(s))||yt.info("cross-tab refresh kept the session alive",{sessionId:n});var m=this.nn();n=m[1],a=m[2]}if(p||_||c){var b=h&&!u;n=b?h.sessionId:this.Ur(),l=this.zr(),yt.info("new session ID assigned",{sessionId:n,windowId:l,bootstrapped:!!b,changeReason:{noSessionId:p,activityTimeout:_,sessionPastMaximumLength:c}}),a=b?h.sessionStartTimestamp:s,this.Hr=void 0,d=!0}else l||(l=this.zr(),d=!0),(f=n!==g)&&(yt.info("adopted cross-tab session id",{sessionId:n,windowId:l}),d=!0);var E=Ne(o)&&e&&!c?o:s,P=Ne(a)?a:new Date().getTime();this.Kr(l),this.Xr(n,E,P),e||this.Wr();var S={noSessionId:p,activityTimeout:_,sessionPastMaximumLength:c,crossTabAdoption:f};return d&&this.Dr.forEach((R=>R(n,l,S))),{sessionId:n,windowId:l,sessionStartTimestamp:P,changeReason:d?S:void 0,lastActivityTimestamp:o}}Wr(){this.Nr||(clearTimeout(this.ln),this.ln=setTimeout((()=>{if(!this.Nr)if(this.an(new Date().getTime())){var e=this.Br;this.resetSessionId(),this.Lr.emit("forcedIdleReset",{idleSessionId:e})}else this.Wr()}),1.1*this.sessionTimeoutMs))}}var Io=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&Gr(t,e))return!0;try{var s=i?.userAgentData;if(s!=null&&s.brands&&s.brands.some((r=>Gr(r?.brand,e))))return!0}catch{}return!!i.webdriver};function $o(){return($o=G((function*(){var i=ve?.userAgentData;if(i!=null&&i.getHighEntropyValues)try{var e=yield i.getHighEntropyValues(["model"]),t=e?.model;return j(t)&&t.length>0?t:void 0}catch(s){return void x.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",s)}}))).apply(this,arguments)}var es=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 Fs(i,e,t){return Et({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Ro={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=>es(t,s))))),not_regex:(i,e)=>e.every((t=>i.every((s=>!es(t,s))))),icontains:(i,e)=>e.map(wi).some((t=>i.map(wi).some((s=>t.includes(s))))),not_icontains:(i,e)=>e.map(wi).every((t=>i.map(wi).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)))}))},wi=i=>i.toLowerCase();function To(i,e){return!i||Object.entries(i).every((t=>{var s=t[1],r=e?.[t[0]];if(w(r)||be(r))return!1;var n=[String(r)],a=Ro[s.operator];return!!a&&a(s.values,n)}))}var gr="custom",Tn="i.posthog.com",Su=/^\/static\//,Fu=["/s/","/e/","/i/"];class Pu{constructor(e){this.un={},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("."+Tn,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.un[this.apiHost]||(this.un[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":gr),this.un[this.apiHost]}hn(e){if(Su.test(e)){var t=this.instance.config.asset_host;if(typeof t=="string")return t.trim().replace(/\/$/,"")||void 0}}dn(e){var t=Rt(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}vn(e,t,s){if(e==="ui")return s;var r=s,n=this.instance.config.rewriteRequestPath;if(n){var a,o=((a=Rt(s))==null?void 0:a.href)||s;r=n(new URL(o)).toString()}if(n&&e==="api"&&Fu.some((d=>t.indexOf(d)===0))){var l=this.dn(r);if(l){var h,u=this.apiHost,c=this.cn;((h=c)==null?void 0:h.apiHost)===u&&c.rewriteRequestPath===n||(c={apiHost:u,rewriteRequestPath:n,urls:new Set},this.cn=c),c.urls.add(l)}}return r}isIngestionEndpoint(e){var t=this.cn,s=this.dn(e);return t?.apiHost===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!s&&t.urls.has(s)}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.vn(e,t,this.uiHost+t);if(e==="flags")return this.vn(e,t,this.flagsApiHost+t);if(e==="assets"){var s=this.hn(t);if(s)return this.vn(e,t,""+s+t)}if(this.region===gr)return this.vn(e,t,this.apiHost+t);var r=Tn+t;switch(e){case"assets":return this.vn(e,t,"https://"+this.region+"-assets."+r);case"api":return this.vn(e,t,"https://"+this.region+"."+r)}}}function Co(i){var e;return!((e=i.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var B=K("[Surveys]"),Mo="seenSurvey_",Oo=i=>{try{var e=(t=>((s,r)=>""+Mo+(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){B.error("Failed to persist survey seen state",t)}},Iu=[ws.Popover,ws.Widget,ws.API],$u={ignoreConditions:!1,ignoreDelay:!1,displayType:hr.Popover},Ru=K("[PostHog ExternalIntegrations]"),Tu={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Cu{constructor(e){this._instance=e}di(e,t){var s;(s=C.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,e,(r=>{if(r)return Ru.error("failed to load script",r);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var n,a,o,l=s[0],h=s[1];!h||(n=C.__PosthogExtensions__)!=null&&(n=n.integrations)!=null&&n[l]||e.di(Tu[l],(()=>{var u;(u=C.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[l])==null||u.start(e._instance)})),!h&&(a=C.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[l]&&((o=C.__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.st=e,this.fn=t,this.pn=new Map,this.gn=!1}add(e){var t=this;return G((function*(){if(t.gn)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.pn.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');t.pn.set(e.name,e);try{var s=e.setup(t.fn);s&&(yield s)}catch(n){var r=t.pn.get(e.name)===e;r&&t.pn.delete(e.name),t.st.error('Failed to set up browser extension "'+e.name+'"',n),r&&t.mn(e)}}))()}dispose(){if(!this.gn){this.gn=!0;var e=Array.from(this.pn.values()).reverse();for(var t of(this.pn.clear(),e))this.mn(t)}}mn(e){try{var t=e.dispose==null?void 0:e.dispose();t&&de(t.then)&&t.then(void 0,(s=>{this.st.error('Failed to dispose browser extension "'+e.name+'"',s)}))}catch(s){this.st.error('Failed to dispose browser extension "'+e.name+'"',s)}}}class Ou{constructor(e){this._instance=e}initialize(){}get(e){var t=this._instance.persistence;if(typeof e=="string")return t?.get_property(e);var s={};for(var r of e){var n=t?.get_property(r);w(n)||(s[r]=n)}return s}set(e,t){var s;(s=this._instance.persistence)==null||s.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)==null||t.unregister(e)}}var Cn="extensionsRemoteConfig";class Au{constructor(e){this.gn=!1,this.instance=e,this.st=x,this.yn=e.bn,this.kv=new Ou(e),this.onEvent=t=>bi(this.instance.on("eventCaptured",(s=>{try{t({event:s.event,properties:s.properties})}catch(r){this.st.error("Browser extension event listener failed",r)}}))),this.onRemoteConfig=t=>{if(this.gn)return bi((()=>{}));var s=n=>{try{t(n)}catch(a){this.st.error("Browser extension remote config listener failed",a)}},r=this.instance._n.on(Cn,s);return this.yn&&s(this.yn),bi(r)},this.wn=new Mu(x.createLogger("[BrowserExtensions]"),this)}get logger(){return this.st}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property(ai))!==null&&e!==void 0?e:this.distinctId}get deviceId(){var e=this.instance.get_property(ai);return typeof e=="string"?e:void 0}get library(){return{name:U.LIB_NAME,version:U.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)==null?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,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.wn.add(e)}capture(e,t,s){var r=this;return G((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 bi(this.instance.kn(e))}handleRemoteConfig(e){this.gn||(this.yn=e,this.instance._n.emit(Cn,e))}sendRequest(e,t){var s=this;return G((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?rs(n,t.query):n,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt};return t.transport==="sendBeacon"?(s.instance._send_request(a),{statusCode:202}):new Promise((o=>{a.callback=o,s.instance._send_request(a)}))}))()}dispose(){this.gn||(this.gn=!0,this.wn.dispose())}}var si={},Ps=0,ts=()=>{},Mn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',zt="Surveys module not available",On="sanitize_properties is deprecated. Use before_send instead",Ao="Invalid value for property_denylist config: ",qu=["token","distinct_id",Ha],xt="posthog",qo=!_u&&me?.indexOf("MSIE")===-1&&me?.indexOf("Mozilla")===-1,Is=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:ql(k?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ts,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:X&&j(X?.search)&&X.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(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){x.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:ar,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:fr},error_tracking:{},_onCapture:ts},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Jl,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))},Lu=[["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"]],An=i=>{var e={};for(var t of Lu){var s=t[0],r=t[1];w(i[s])||(e[r]=i[s])}var n=J({},e,i),a=i.__preview_external_dependency_versioned_paths;return w(a)||(w(i.strict_script_versioning)&&(n.strict_script_versioning=!!a),j(a)&&w(i.asset_host)&&(n.asset_host=a)),q(i.property_blacklist)&&(w(i.property_denylist)?n.property_denylist=i.property_blacklist:q(i.property_denylist)?n.property_denylist=[...i.property_blacklist,...i.property_denylist]:x.error(Ao+i.property_denylist)),n};class Du{constructor(){this.__forceAllowLocalhost=!1}get xn(){return this.__forceAllowLocalhost}set xn(e){x.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class ke{Sn(e,t){if(e){var s=this.pn.indexOf(e);s!==-1&&this.pn.splice(s,1)}return this.pn.push(t),t.initialize==null||t.initialize(),t}Cn(){return this.config.cookieless_mode===Be||this.config.cookieless_mode===ht&&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 Du,this.Mn=!1,this.version=U.LIB_VERSION,this.Tn=new Set,this.En="",this._n=new Ar,this.pn=[],this.In=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Is(),this.SentryIntegration=iu,this.sentryIntegration=s=>(function(r,n){var a=no(r,n);return{name:ro,processEvent:o=>a(o)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Pn=!1,this.Rn=null,this.An=null,this.Fn=null,this.scrollManager=new ku(this),this.pageViewManager=new yn(this),this.rateLimiter=new cu(this),this.requestRouter=new Pu(this),this.consent=new Bl(this),this.externalIntegrations=new Cu(this);var t=(e=ke.__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=j(s)?{[s]:r}:s;this.setPersonProperties(a),n?.({})},set_once:(s,r,n)=>{var a=j(s)?{[s]:r}:s;this.setPersonProperties(void 0,a),n?.({})}},this.on("eventCaptured",(s=>x.info('send "'+s?.event+'"',s)))}init(e,t,s){if(s&&s!==xt){var r,n=(r=si[s])!==null&&r!==void 0?r:new ke;return n._init(e,t,s),si[s]=n,si[xt][s]=n,n}return this._init(e,t,s)}_init(e,t,s){var r,n;t===void 0&&(t={});var a,o=j(e)?e.trim():"";if(!o)return x.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return o!==((a=this.config)==null?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+o+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Is(t.defaults),t.debug=this.Ln(t.debug),this.On=t,this.Dn=[],t.person_profiles?this.An=t.person_profiles:t.process_person&&(this.An=t.process_person);var l=Is(t.defaults),h=An(t),u=J({},l,h,{name:s,token:o});Y(l.rageclick)&&Y(h.rageclick)&&(u.rageclick=J({},l.rageclick,h.rageclick)),Y(l.session_recording)&&Y(h.session_recording)&&(u.session_recording=J({},l.session_recording,h.session_recording)),this.set_config(u),this.config.on_xhr_error&&x.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:pe.GZipJS;var c=this.$n();if(this.persistence=new bs(this.config,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new bs(y({},this.config,{persistence:"sessionStorage"}),c,!1),this.En="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!c&&se.N()){var d=se.H(this.En);q(d)&&d.forEach((R=>{j(R)&&this.Tn.add(R)}))}else se.q(this.En);var f=y({},this.persistence.props),p=y({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Nn=new bu((R=>this.qn(R)),this.config.request_queue_config),this.jn=new xu(this),this.__request_queue=[];var g=this.Cn();if(g||(this.sessionManager=new Rn(this),this.sessionPropsManager=new In(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((R,D,F)=>{(F!=null&&F.activityTimeout||F!=null&&F.sessionPastMaximumLength||F!=null&&F.crossTabAdoption)&&this.Bn()}))),this.Hn(),this.config.__preview_deferred_init_extensions?(x.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Un(g)}),0)):(x.info("Initializing extensions synchronously"),this.Un(g)),U.DEBUG=U.DEBUG||this.config.debug,U.DEBUG&&x.info("Starting in debug mode",{this:this,config:t,thisC:y({},this.config),p:f,s:p}),!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 _=t.bootstrap.distinctID,m=this.get_distinct_id(),b=this.persistence.get_property(xe);if(t.bootstrap.isIdentifiedID&&m!=null&&m!==_&&b===et)this.identify(_);else if(t.bootstrap.isIdentifiedID&&m!=null&&m!==_&&b===Ye)x.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 E=this.config.get_device_id(ze()),P=t.bootstrap.isIdentifiedID?E:_;this.persistence.set_property(xe,t.bootstrap.isIdentifiedID?Ye:et),this.register({distinct_id:_,$device_id:P})}}if(g)this.register_once({distinct_id:fi,$device_id:null},"");else if(!this.get_distinct_id()){var S=this.config.get_device_id(ze());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(xe,et)}return Z(v,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?(function(R,D){var F=R.config.segment;if(!F)return D();(function($,I){var M=$.config.segment;if(!M)return I();var T=H=>{var z=()=>H.anonymousId()||ze();$.config.get_device_id=z,H.id()&&($.register({distinct_id:H.id(),$device_id:z()}),$.persistence.set_property(xe,Ye)),I()},O=M.user();"then"in O&&de(O.then)?O.then(T):T(O)})(R,(()=>{F.register(($=>{typeof Promise<"u"&&Promise.resolve||ms.warn("This browser does not have Promise support, and can not use the segment integration");var I=(M,T)=>{if(!T)return M;M.event.userId||M.event.anonymousId===$.get_distinct_id()||(ms.info("No userId set, resetting PostHog"),$.reset()),M.event.userId&&M.event.userId!==$.get_distinct_id()&&(ms.info("UserId set, identifying with PostHog"),$.identify(M.event.userId));var O=$.calculateEventProperties(T,M.event.properties);return M.event.properties=Object.assign({},O,M.event.properties),M};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:M=>I(M,M.event.event),page:M=>I(M,wt),identify:M=>I(M,fs),screen:M=>I(M,"$screen")}})(R)).then((()=>{D()}))}))})(this,(()=>this.zn())):this.zn(),de(this.config._onCapture)&&this.config._onCapture!==ts&&(x.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(R=>this.config._onCapture(R.event,R)))),this.config.ip&&x.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 $o.apply(this,arguments)})().then((R=>{R&&this.register({[ps]:R})})).catch(ts),this}Hn(){var e,t,s,r,n,a,o=(e=(t=this.config.__extensionClasses)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:(s=ke.__defaultExtensionClasses)==null?void 0:s.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||((r=this.Wn)==null||r.call(this),this.Wn=void 0,this.featureFlags=new o(this)),de(this.featureFlags.onReloading)&&de(this.featureFlags.setup)?this.Wn||(this.Wn=this.featureFlags.onReloading((()=>{this._n.emit("featureFlagsReloading",!0)})),this.Vn().add(this.featureFlags)):(n=(a=this.featureFlags).initialize)==null||n.call(a))}Un(e){var t,s,r,n,a,o,l,h=performance.now(),u=y({},ke.__defaultExtensionClasses,this.config.__extensionClasses),c=[];u.exceptions&&this.pn.push(this.exceptions=(t=this.exceptions)!==null&&t!==void 0?t:new u.exceptions(this)),u.historyAutocapture&&this.pn.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.pn.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.pn.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.pn.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||c.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.pn.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.pn.push(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new u.surveys(this)),u.logs&&this.pn.push(this.logs=(r=this.logs)!==null&&r!==void 0?r:new u.logs(this)),u.metrics&&this.pn.push(this.metrics=(n=this.metrics)!==null&&n!==void 0?n:new u.metrics(this)),u.conversations&&this.pn.push(this.conversations=(a=this.conversations)!==null&&a!==void 0?a:new u.conversations(this)),u.productTours&&this.pn.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.pn.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.pn.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.pn.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.pn.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,tu)),u.toolbar&&this.pn.push(this.toolbar=(o=this.toolbar)!==null&&o!==void 0?o:new u.toolbar(this)),u.experiments&&this.pn.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new u.experiments(this)),this.pn.forEach((d=>{d.initialize&&c.push((()=>{d.initialize==null||d.initialize()}))})),c.push((()=>{if(this.Zn){var d=this.Zn;this.Zn=void 0,this.pn.forEach((f=>f.onRemoteConfig==null?void 0:f.onRemoteConfig(d)))}})),this.Gn(c,h)}Gn(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.Gn(e,t)}),0);var s=e.shift();if(s)try{s()}catch(n){x.error("Error initializing extension:",n)}}var r=Math.round(performance.now()-t);this.register_for_session({[za]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ba]:r}),this.config.__preview_deferred_init_extensions&&x.info("PostHog extensions initialized ("+r+"ms)")}Yi(e){var t;if(!k||!k.body)return x.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Yi(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this.Zn=e),this.bn=e,this.compression=void 0,e.ok){var s,r=e.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=A(r.supportedCompression,pe.GZipJS)?pe.GZipJS:A(r.supportedCompression,pe.Base64)?pe.Base64:void 0),(s=r.analytics)!=null&&s.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.An?this.An:ar}),(t=this.Qn)==null||t.handleRemoteConfig(e),this.pn.forEach((n=>n.onRemoteConfig==null?void 0:n.onRemoteConfig(e)))}zn(){try{this.config.loaded(this)}catch(s){x.critical("`loaded` function failed",s)}if(this.Kn(),this.config.internal_or_test_user_hostname&&X!=null&&X.hostname){var e=X.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.Cn())&&this.Jn()}),1),this.Yn=new go(this),this.Yn.load()}Kn(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Nn)==null||e.enable())}_dom_loaded(){this.is_capturing()&&gi(this.__request_queue,(e=>this.qn(e))),this.__request_queue=[],this.Kn()}_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.Xn()&&this.capture(vs),(s=this.logs)==null||s.flushLogs("sendBeacon"),(r=this.Nn)==null||r.unload(),(n=this.jn)==null||n.unload()):this.Xn()&&this.capture(vs,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?qo?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,(w(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var s,r,n,a=y({},t);a.timeout=a.timeout||6e4;var o,l,h,u,c,d=(s=a.transport)!==null&&s!==void 0?s:"fetch";d==="sendBeacon"&&w(a.compression)&&a.data&&(a.compression=pe.Base64),a.method==="POST"&&a.data&&(a.timestampMode==="capture-body"?a.data={api_key:(l=(c=(u=(q(o=a.data)?o:[o]).map((_=>y({},_,_.timestamp instanceof Date&&!isNaN(_.timestamp.getTime())?{timestamp:_.timestamp.toISOString()}:{}))))[0])==null||(h=c.properties)==null?void 0:h.token)!==null&&l!==void 0?l:c?.token,batch:u,sent_at:new Date().toISOString()}:a.timestampMode==="body"&&(a.data=(function(_,m){return m===void 0&&(m=new Date().toISOString()),q(_)?_.map((b=>y({},b,{sent_at:m}))):y({},_,{sent_at:m})})(a.data))),a.url=Pn(a.url,a.method,a.compression,a.timestampMode);var f=Ci.filter((_=>!a.disableTransport||!_.transport||!a.disableTransport.includes(_.transport))),p=(r=(n=(function(_,m){for(var b=0;_.length>b;b++)if(_[b].transport===d)return _[b]})(f))==null?void 0:n.method)!==null&&r!==void 0?r:f[0].method;if(!p)throw new Error("No available transport method");var g=_=>{try{p(_)}catch(m){Fo(m)?x.warn(m):x.error(m),a.callback==null||a.callback({statusCode:0,error:m})}};d!=="sendBeacon"&&a.data&&a.compression===pe.GZipJS&&Do&&typeof Promise<"u"&&!Ti?mu(a).then((_=>{g(_)})).catch((_=>{if(Vr(_))return Ti=!0,void g(y({},a,{compression:void 0,url:Pn(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 Vr(m)||b===ta})(_)&&(Ti=!0),g(a)})):p(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}))}qn(e){this.jn?this.jn.retriableRequest(e):this._send_request(e)}_execute_array(e){Ps++;try{var t,s=[],r=[],n=[];gi(e,(o=>{if(o)if(q(t=o[0]))n.push(o);else if(de(o))try{o.call(this)}catch(l){x.error("Error executing queued PostHog call",o,l)}else q(o)&&t==="alias"?s.push(o):q(o)&&t.indexOf("capture")!==-1&&de(this[t])?n.push(o):r.push(o)}));var a=function(o,l){gi(o,(function(h){try{if(q(h[0])){var u=l;V(h,(function(c){u=u[c[0]].apply(u,c.slice(1))}))}else l[h[0]].apply(l,h.slice(1))}catch(c){x.error("Error executing queued PostHog call",h,c)}}))};a(s,this),a(r,this),a(n,this)}finally{Ps--}}push(e){if(Ps>0&&q(e)&&j(e[0])){var t=ke.prototype[e[0]];de(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,a,o,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Nn){if(this.is_capturing())if(!w(e)&&j(e)){var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var u=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(u==null||!u.isRateLimited){t!=null&&t.$current_url&&!j(t?.$current_url)&&(x.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!=="$exception"||s!=null&&s.ts||x.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var c=new Date,d=s?.timestamp||c,f=Kr(s?.uuid,ze),p={uuid:f,event:e,properties:this.calculateEventProperties(e,t||{},d,f)};e===wt&&this.config.__preview_capture_bot_pageviews&&h&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);var g=e==="$feature_flag_called"&&p.properties.$feature_flag_has_experiment===!1&&this.get_property(Bi)===!0;s?.$set&&!g&&(p.$set=s?.$set);var _=s?.$unset;_&&(p.$unset=_);var m,b,E,P=g?void 0:this.es(s?.$set_once,e!==rn,e===fs);if(P&&(p.$set_once=P),s!=null&&s._noTruncate||(n=this.config.properties_string_max_length,a=p,o=T=>j(T)?T.slice(0,n):T,l=new Set,p=(function T(O,H){if(O!==Object(O))return o?o(O):O;if(!l.has(O)){var z;if(l.add(O),q(O))z=[],gi(O,(ee=>{z.push(T(ee))}));else{var N={};V(O,((ee,ae)=>{l.has(ee)||(N[ae]=T(ee))})),z=N}return z}})(a)),p.timestamp=d,w(s?.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=c),g&&(p.properties=(function(T,O){O===void 0&&(O=[]);var H={},z=N=>{T[N]!==void 0&&(H[N]=T[N])};return No.forEach(z),O.forEach(z),H})(p.properties,qu)),e===Ve.DISMISSED||e===Ve.SENT){var S=t?.[xs.SURVEY_ID],R=t?.[xs.SURVEY_ITERATION];Oo({id:S,current_iteration:R}),p.$set=y({},p.$set,{[(m={id:S,current_iteration:R},b=e===Ve.SENT?"responded":"dismissed",E="$survey_"+b+"/"+m.id,m.current_iteration&&m.current_iteration>0&&(E="$survey_"+b+"/"+m.id+"/"+m.current_iteration),E)]:!0})}else e===Ve.SHOWN&&(p.$set=y({},p.$set,{[xs.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===hu.SHOWN){var D=t?.[wn.TOUR_TYPE];D&&(p.$set=y({},p.$set,{[wn.TOUR_LAST_SEEN_DATE+"/"+D]:new Date().toISOString()}))}var F=y({},p.properties.$set,p.$set);if(Ge(F)||this.setPersonPropertiesForFlags(F),!L(this.config.before_send)){var $=this.At(p);if(!$)return;(p=$).uuid=Kr(p.uuid,ze)}this._n.emit("eventCaptured",p);var I=(r=s?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),M={method:"POST",url:I,data:p,compression:"best-available",timestampMode:s?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(I)?"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.qn(M):this.Nn.enqueue(M),p}x.critical("This capture call is ignored due to client rate limiting.")}}else x.error("No event name provided to posthog.capture")}else x.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}Vn(){var e;return(e=this.Qn)!==null&&e!==void 0?e:this.Qn=new Au(this)}kn(e){this.In.push(e);var t=!0;return()=>{if(t){t=!1;var s=this.In.indexOf(e);s!==-1&&this.In.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.Cn()&&(o[Ha]=!0),e==="$snapshot"){var l=y({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!j(o.distinct_id)&&!ne(o.distinct_id)||js(o.distinct_id))&&x.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var h,u=(function(S,R,D,F){var $,I,M,T;if(F===void 0&&(F=!1),!me)return{};var O,H=S?[...Ct,...R||[]]:[],z=(function(ci){for(var Ie=0;Jr.length>Ie;Ie++){var di=Jr[Ie],ft=di[1],gt=di[0].exec(ci),At=gt&&(de(ft)?ft(gt,ci):ft);if(At)return At}return["",""]})(me),N=z[0],ee=z[1],ae=(O=typeof navigator<"u"?navigator:void 0)!=null&&O.brave?{brave:!0}:{},fe={};w(D)||(fe.detectGoogleSearchApp=D);var ue={},ge=($=navigator)==null||($=$.userAgentData)==null?void 0:$.platform,we=(I=navigator)==null?void 0:I.maxTouchPoints,te=v==null||(M=v.screen)==null?void 0:M.width,le=v==null||(T=v.screen)==null?void 0:T.height,oe=v?.devicePixelRatio;w(ge)||(ue.userAgentDataPlatform=ge),w(we)||(ue.maxTouchPoints=we),w(te)||(ue.screenWidth=te),w(le)||(ue.screenHeight=le),w(oe)||(ue.devicePixelRatio=oe);var Ce,Qe,re,Te,Je,Ot,Pe,_e,hi=J($r({$os:N,$os_version:ee,$browser:Fa(me,navigator.vendor,ae,fe),$device:Yr(me),$device_type:(Qe=me,re=ue,_e=Yr(Qe),_e===la||_e===oa||_e==="Kobo"||_e==="Kindle Fire"||_e===wa?Pt:_e===ri||_e===Ft||_e===ni||_e===zs?"Console":_e===ha?"Wearable":_e?Fe:re?.userAgentDataPlatform==="Android"&&((Te=re?.maxTouchPoints)!==null&&Te!==void 0?Te:0)>0?600>Math.min((Je=re?.screenWidth)!==null&&Je!==void 0?Je:0,(Ot=re?.screenHeight)!==null&&Ot!==void 0?Ot:0)/((Pe=re?.devicePixelRatio)!==null&&Pe!==void 0?Pe:1)?Fe:Pt:"Desktop"),$timezone:fo(),$timezone_offset:ou()}),{$current_url:li(F?Xe(X?.href):X?.href,H,ui),$host:X?.host,$pathname:X?.pathname,$raw_user_agent:me.length>1e3?me.substring(0,997)+"...":me,$browser_version:rl(me,navigator.vendor,ae,fe),$browser_language:bn(),$browser_language_prefix:(Ce=bn(),typeof Ce=="string"?Ce.split("-")[0]:void 0),$screen_height:v?.screen.height,$screen_width:v?.screen.width,$viewport_height:v?.innerHeight,$viewport_width:v?.innerWidth,$lib:U.LIB_NAME,$lib_version:U.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return U.SDK_DIST_CHANNEL&&(hi.$sdk_dist_channel=U.SDK_DIST_CHANNEL),hi})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var c=this.sessionManager.checkAndGetSessionAndWindowId(n,s.getTime()),d=c.windowId;o.$session_id=c.sessionId,o.$window_id=d}this.sessionPropsManager&&J(o,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&J(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(f=this.jn)==null?void 0:f.length}catch(S){o.$sdk_debug_error_capturing_properties=String(S)}if(this.requestRouter.region===gr&&(o.$lib_custom_api_host=this.config.api_host),h=e!==wt||n?e!==vs||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),o=J(o,h),e===wt&&k&&(o.title=k.title),!w(a)){var p=s.getTime()-a;o.$duration=parseFloat((p/1e3).toFixed(3))}me&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser");var g=this.persistence.properties(),_=this.sessionPersistence.properties();V(["$referrer","$referring_domain"],(S=>{S in g&&delete _[S]}));var m={};if(this.In.length>0)for(var b of this.In.slice())try{J(m,b())}catch(S){x.error("Failed to produce browser extension event properties",S)}(o=J({},u,g,_,y({},m,o))).$is_identified=this._isIdentified(),q(this.config.property_denylist)?V(this.config.property_denylist,(function(S){delete o[S]})):x.error(Ao+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var E=this.config.sanitize_properties;E&&(x.error(On),o=E(o,e));var P=this.rs();return o.$process_person_profile=P,P&&!n&&this.ns("_calculate_event_properties"),o}es(e,t,s){var r;if(t===void 0&&(t=!0),s===void 0&&(s=!1),!this.persistence||!this.rs()||this.Mn&&!s)return e;var n=this.persistence.get_initial_props(),a=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),o=J({},n,a||{},e||{}),l=this.config.sanitize_properties;return l&&(x.error(On),o=l(o,"$set_once")),t&&(this.Mn=!0),Ge(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),Object.keys(e).forEach((s=>this.Tn.add(s))),this.ss()}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e),this.Tn.delete(e),this.ss()}os(e,t){this.register({[e]:t})}Bn(){this.Tn.forEach((e=>{var t;(t=this.sessionPersistence)==null||t.unregister(e)})),this.Tn.clear(),this.ss()}ss(){var e;if(this.En)if(this.config.persistence==="memory"||(e=this.sessionPersistence)!=null&&e.Ei||!se.N())se.q(this.En);else{var t=[];this.Tn.forEach((s=>t.push(s))),t.length>0?se.F(this.En,t):se.q(this.En)}}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._n.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:zt}),()=>{})}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:zt})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:zt})}renderSurvey(e,t){var s;(s=this.surveys)==null||s.renderSurvey(e,t)}displaySurvey(e,t){var s;t===void 0&&(t=$u),(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:zt}}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:zt})}ls(e){return!e||js(e)?(x.critical("Unique user id has not been set in posthog.identify"),!1):e===fi?(x.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())||(x.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 x.uninitializedWarning("posthog.identify");if(ne(e)&&(e=e.toString(),x.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.ls(e)&&this.ns("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(ai)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(Gt)&&(this.unregister(Gt),this.register({distinct_id:e}));var n,a=(this.persistence.get_property(xe)||et)===et,o=e!==r,l=!o&&a;if(o&&a)this.persistence.set_property(xe,Ye),this.setPersonPropertiesForFlags({$set:t||{},$set_once:s||{}},!1),this.capture(fs,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:s||{}}),this.Fn=Fs(e,t,s),(n=this.featureFlags)==null||n.setAnonymousDistinctId(r);else if(l){this.persistence.set_property(xe,Ye);var h=t||{},u=s||{};this.setPersonPropertiesForFlags({$set:h,$set_once:u},!1),this.capture("$set",{$set:h,$set_once:u}),this.Fn=Fs(e,t,s)}else(t||s)&&this.setPersonProperties(t,s);o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ct)):l&&(t||s)&&this.reloadFeatureFlags()}}setPersonProperties(e,t){if((e||t)&&this.ns("posthog.setPersonProperties")){var s=Fs(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):x.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,s=(q(e)?e:[e]).filter((r=>j(r)&&r.length>0));s.length!==0&&this.ns("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(rn,a)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else x.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.ns("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=Ee(e)?e:e?.resetDeviceID,s=Ee(e)||e==null?void 0:e.bootstrap;this.us(t,!1,s)}us(e,t,s){var r,n,a,o,l,h,u,c,d,f,p,g;if(t===void 0&&(t=!1),x.info("reset"),!this.__loaded)return x.uninitializedWarning("posthog.reset");var _=s?.sessionID;this.config.bootstrap=s||((r=this.On)==null?void 0:r.bootstrap)||{},(n=this.featureFlags)==null||n.updateConfig==null||n.updateConfig(this.config,this.tr());var m,b,E,P,S=this.get_property(ai),R=this.get_property(ps),D=this.get_property(dt),F=this.is_capturing();if(this.consent.reset(),t||!F||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after."),(a=this.persistence)==null||a.clear(),(o=this.sessionPersistence)==null||o.clear(),this.Tn.clear(),this.ss(),w(D)||(m=this.persistence)==null||m.register({[dt]:D}),(l=this.surveys)==null||l.reset(),(h=this.Yn)==null||h.stop(),(u=this.featureFlags)==null||u.reset(),(c=this.conversations)==null||c.reset(),(d=this.logs)==null||d.reset(),(f=this.metrics)==null||f.reset(),(p=this.persistence)==null||p.set_property(xe,et),(g=this.sessionManager)==null||g.resetSessionId(),this.Fn=null,this.config.cookieless_mode===Be)this.register_once({distinct_id:fi,$device_id:null},"");else{var $=this.config.get_device_id(ze());this.register_once({distinct_id:$,$device_id:e?$:S},""),e||w(R)||this.register({[ps]:R})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),s&&(s.distinctID===void 0||this.Cn()||((P=this.persistence)==null||P.set_property(xe,s.isIdentifiedID?Ye:et),this.register({distinct_id:s.distinctID})),(b=this.featureFlags)==null||b.initialize(),!(w(_)||(E=this.sessionManager)!=null&&E.setBootstrapSessionId(_,!0)))){var I=y({},s);delete I.sessionID,this.config.bootstrap=I}delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var t=this;return G((function*(){var s,r,n,a,o,l,h;if(t.__loaded){(s=t.Yn)==null||s.stop(),(r=t.Qn)==null||r.dispose(),(n=t.sessionRecording)==null||n.dispose(),(a=t.logs)==null||a.flushLogs("sendBeacon"),(o=t.metrics)==null||o.flush("sendBeacon"),(l=t.Nn)==null||l.unload(),(h=t.jn)==null||h.unload();try{var u;(u=t.featureFlags)==null||u.destroy()}catch(c){x.error("Error while destroying feature flags",c)}}else x.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.hs()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.ds()}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(Aa)?(x.critical("Attempting to create alias for existing People user - aborting."),-2):this.ns("posthog.alias")?(w(t)&&(t=this.get_distinct_id()),e!==t?(this.os(Gt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(x.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=y({},this.config);if(Y(e)){var s,r,n,a,o,l,h,u,c,d,f,p;J(this.config,An(e));var g=this.$n();(s=this.persistence)==null||s.update_config(this.config,t,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new bs(y({},this.config,{persistence:"sessionStorage"}),g,!1);var _=this.Ln(this.config.debug);Ee(_)&&(this.config.debug=_),Ee(this.config.debug)&&(this.config.debug?(U.DEBUG=!0,W.N()&&W.F("ph_debug",!0),x.info("set_config",{config:e,oldConfig:t,newConfig:y({},this.config)})):(U.DEBUG=!1,W.N()&&W.q("ph_debug"))),(r=this.featureFlags)==null||r.updateConfig==null||r.updateConfig(this.config,this.tr()),(n=this.exceptionObserver)==null||n.onConfigChange(),(a=this.exceptions)==null||a.onConfigChange(),(o=this.sessionRecording)==null||o.startIfEnabledOrStop(),(l=this.tracingHeaders)==null||l.startIfEnabledOrStop(),(h=this.autocapture)==null||h.startIfEnabled(),(u=this.heatmaps)==null||u.startIfEnabled(),(c=this.exceptionObserver)==null||c.startIfEnabledOrStop(),(d=this.deadClicksAutocapture)==null||d.startIfEnabledOrStop(),(f=this.surveys)==null||f.loadIfEnabled(),this.vs(),(p=this.externalIntegrations)==null||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){U.LIB_NAME=e,U.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:ke.cs}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:xt;return t!==xt&&(t=xt+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(xe))===Ye||((t=this.sessionPersistence)==null?void 0:t.get_property(xe))===Ye}rs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles===ar&&!this._isIdentified()&&Ge(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Gt])&&((t=this.persistence)==null||(t=t.props)==null||!t[Gi]))}Xn(){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.rs()||this.ns("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ns("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ns(e){return this.config.person_profiles==="never"?(x.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.os(Gi,!0),!0)}$n(){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!==ht)}vs(){var e,t,s,r,n=this.$n();return((e=this.persistence)==null?void 0:e.Ei)!==n&&((s=this.persistence)==null||s.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.Ei)!==n&&((r=this.sessionPersistence)==null||r.set_disabled(n)),n&&(this.Tn.clear(),this.ss()),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==Be){if(this.Cn()){var s,r,n,a,o;this.us(!0,!0),(s=this.sessionManager)==null||s.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=new Rn(this),this.pageViewManager=new yn(this),this.persistence&&(this.sessionPropsManager=new In(this,this.sessionManager,this.persistence));var l,h=(n=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&n!==void 0?n:(o=ke.__defaultExtensionClasses)==null?void 0:o.sessionRecording;h&&(this.sessionRecording=this.Sn(this.sessionRecording,new h(this)),this.bn&&((l=this.sessionRecording)==null||l.onRemoteConfig==null||l.onRemoteConfig(this.bn)))}var u,c;this.consent.optInOut(!0),this.vs(),this.Kn(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==ht&&((u=this.surveys)==null||u.loadIfEnabled()),(w(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((c=e?.captureEventName)!==null&&c!==void 0?c:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Jn()}else x.warn(Mn)}opt_out_capturing(){var e,t,s;this.config.cookieless_mode!==Be?(this.config.cookieless_mode===ht&&this.consent.isOptedIn()&&this.us(!0,!0),this.consent.optInOut(!1),this.vs(),this.config.cookieless_mode===ht&&(this.register({distinct_id:fi,$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.Jn(),this.Kn())):x.warn(Mn)}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===Be||(this.config.cookieless_mode===ht?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.vs()}_is_bot(){return ve?Io(ve,this.config.custom_blocked_useragents):void 0}Jn(){k&&(k.visibilityState==="visible"?this.Pn||(this.Pn=!0,this.capture(wt,{title:k.title},{send_instantly:!0}),this.Rn&&(k.removeEventListener(Wi,this.Rn),this.Rn=null)):this.Rn||(this.Rn=this.Jn.bind(this),Z(k,Wi,this.Rn)))}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}))}tr(){var e=this.On||{};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?(x.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&&!L(t[s]),l=r in t&&!L(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,x)}At(e){var t;if(L(this.config.before_send))return e;var s=Object.keys((t=e.properties)!==null&&t!==void 0?t:{}).filter(Go),r=q(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var a of r){if(n=a(n),L(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Vo(e.event)?x.warn(o+". This can cause unexpected behavior."):x.info(o),null}n.properties&&!Ge(n.properties)||x.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var l of s)if(n.properties&&L(n.properties[l]))return x.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.fi)==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)})}Ln(e){var t=Ee(e)&&!e,s=W.N()&&W.P("ph_debug")==="true";return!t&&(!!s||e)}}ke.__defaultExtensionClasses={},ke.cs=(()=>{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]]=Ol(i.prototype[e[t]])})(ke,["identify"]);class qn{constructor(e){this.disabled=e===!1;var t=Y(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 $s="$copy_autocapture",Rs=K("[AutoCapture]");function Ts(i,e){return e.length>i?e.slice(0,i)+"...":e}function Nu(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!Ze(e));return e}function ju(i,e){var t,s,r=e.e,n=e.maskAllElementAttributes,a=e.maskAllText,o=e.elementAttributeIgnoreList,l=e.elementsChainAsString,h=e.disableCaptureUrlHashes;if(!Ze(i))return{props:{}};for(var u=[i],c=new Set([i]),d=i;d.parentNode&&!Se(d,"body")&&Xa>u.length;)if(Ka(d.parentNode)){var f=d.parentNode.host;if(c.has(f))break;c.add(f),u.push(f),d=f}else{if(!Ze(d.parentNode)||c.has(d.parentNode))break;c.add(d.parentNode),u.push(d.parentNode),d=d.parentNode}var p,g,_=[],m={},b=!1,E=!1;if(V(u,(F=>{var $=ur(F);if(Se(F,"a")){var I=F.getAttribute("href");b=!!($&&I&&ti(I))&&(h?Xe(I):I)}A(Ki(F),"ph-no-capture")&&(E=!0),_.push((function(T,O,H,z,N){N===void 0&&(N=!1);var ee=T.tagName.toLowerCase(),ae={tag_name:ee};Tr.indexOf(ee)>-1&&!H&&(ae.$el_text=ee.toLowerCase()==="a"||ee.toLowerCase()==="button"?Ts(1024,gn(T)):Ts(1024,oi(T)));var fe=Ki(T);fe.length>0&&(ae.classes=fe.filter((function(te){return te!==""}))),V(T.attributes,(function(te){var le;if((!io(T)||["name","id","class","aria-label"].indexOf(te.name)!==-1)&&(z==null||!z.includes(te.name))&&!O&&ti(te.value)&&(!j(le=te.name)||le.substring(0,10)!=="_ngcontent"&&le.substring(0,7)!=="_nghost")){var oe=te.value;te.name==="class"&&(oe=Rr(oe).join(" ")),ae["attr__"+te.name]=Ts(1024,te.name==="href"&&N?Xe(oe):oe)}}));for(var ue=1,ge=1,we=T;we=Nu(we);)ue++,we.tagName===T.tagName&&ge++;return ae.nth_child=ue,ae.nth_of_type=ge,ae})(F,n,a,o,h));var M=(function(T){if(!ur(T))return{};var O={};return V(T.attributes,(function(H){if(H.name&&H.name.indexOf("data-ph-capture-attribute")===0){var z=H.name.replace("data-ph-capture-attribute-",""),N=H.value;z&&N&&ti(N)&&(O[z]=N)}})),O})(F);J(m,M)})),E)return{props:{},explicitNoCapture:E};if(a||(_[0].$el_text=Se(i,"a")||Se(i,"button")?gn(i):oi(i)),b){var P,S;_[0].attr__href=b;var R=(P=Rt(b))==null?void 0:P.host,D=v==null||(S=v.location)==null?void 0:S.host;R&&D&&R!==D&&(p=b)}return{props:J({$event_type:r.type,$ce_version:1},l?{}:{$elements:_},{$elements_chain:(g=_,(function(F){return F.map(($=>{var I,M,T="";if($.tag_name&&(T+=$.tag_name),$.attr_class)for(var O of($.attr_class.sort(),$.attr_class))T+="."+O.replace(/"/g,"");var H=y({},$.text?{text:$.text}:{},{"nth-child":(I=$.nth_child)!==null&&I!==void 0?I:0,"nth-of-type":(M=$.nth_of_type)!==null&&M!==void 0?M:0},$.href?{href:$.href}:{},$.attr_id?{attr_id:$.attr_id}:{},$.attributes),z={};return Ri(H).sort(((N,ee)=>N[0].localeCompare(ee[0]))).forEach((N=>{var ee=N[1];return z[_n(N[0].toString())]=_n(ee.toString())})),(T+=":")+Ri(z).map((N=>N[0]+'="'+N[1]+'"')).join("")})).join(";")})((function(F){return F.map(($=>{var I,M,T={text:(I=$.$el_text)==null?void 0:I.slice(0,400),tag_name:$.tag_name,href:(M=$.attr__href)==null?void 0:M.slice(0,2048),attr_class:Ql($),attr_id:$.attr__id,nth_child:$.nth_child,nth_of_type:$.nth_of_type,attributes:{}};return Ri($).filter((O=>O[0].indexOf("attr__")===0)).forEach((O=>T.attributes[O[0]]=O[1])),T}))})(g)))},(t=_[0])!=null&&t.$el_text?{$el_text:(s=_[0])==null?void 0:s.$el_text}:{},p&&r.type==="click"?{$external_click_url:p}:{},m)}}var Bt=K("[ExceptionAutocapture]"),Ln=()=>{},Hu=K("[TracingHeaders]"),st=K("[Web Vitals]"),Dn=9e5,Nn="disabled",jn="lazy_loading",Ut="awaiting_config",xi="missing_config";K("[SessionRecording]"),K("[SessionRecording]");var _r="[SessionRecording]",De=K(_r),zu=K("[Heatmaps]");function Cs(i){return Y(i)&&"clientX"in i&&"clientY"in i&&ne(i.clientX)&&ne(i.clientY)}var ki=K("[Product Tours]"),Ms=i=>{var e;return!i.config.disable_product_tours&&!((e=i.persistence)==null||!e.get_property(Fr))},Bu=["$set_once","$set"],Me=K("[SiteApps]"),Hn="Error while initializing PostHog app with config id ";function bt(i,e,t){if(L(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 Uu{constructor(e){this.fs=new Ar,this.ps=(t,s)=>this.gs(t,s)&&this.ys(t,s)&&this.bs(t,s)&&this._s(t,s),this.gs=(t,s)=>s==null||!s.event||t?.event===s?.event,this._instance=e,this.ws=new Set,this.ks=new Set}init(){var e,t;w((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(!w((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((a=>{var o,l;(o=this.ks)==null||o.add(a),(l=a.steps)==null||l.forEach((h=>{var u;(u=this.ws)==null||u.add(h?.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.ws.has(e)||this.ws.has(t.event))&&this.ks&&((s=this.ks)==null?void 0:s.size)>0&&this.ks.forEach((r=>{this.xs(t,r)&&this.fs.emit("actionCaptured",r.name)}))}Ss(e){this.onAction("actionCaptured",(t=>e(t)))}xs(e,t){if(t?.steps==null)return!1;for(var s of t.steps)if(this.ps(e,s))return!0;return!1}onAction(e,t){return this.fs.on(e,t)}ys(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"||!bt(r,t.url,t.url_matching||"contains"))return!1}return!0}bs(e,t){return!!this.Cs(e,t)&&!!this.Ms(e,t)&&!!this.Ts(e,t)}Cs(e,t){var s;if(t==null||!t.href)return!0;var r=this.Es(e);if(r.length>0)return r.some((o=>bt(o.href,t.href,t.href_matching||"exact")));var n,a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!a&&bt((n=a.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}Ms(e,t){var s;if(t==null||!t.text)return!0;var r=this.Es(e);if(r.length>0)return r.some((h=>bt(h.text,t.text,t.text_matching||"exact")||bt(h.$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(h){for(var u,c=[],d=/(?::|")text="(.*?)"/g;!L(u=d.exec(h));)c.includes(u[1])||c.push(u[1]);return c})(l),a=t.text,o=t.text_matching||"exact",n.some((h=>bt(h,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}_s(e,t){return t==null||!t.properties||t.properties.length===0||To(t.properties.reduce(((s,r)=>{var n=q(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 Vu{constructor(e){var t;this.Is=[],this._instance=e,this.Ps=new Map,this.Rs=new Map,this.As=new Map,(t=this._instance)==null||t.onSessionId==null||t.onSessionId((s=>this.Fs(s)))}Ls(e){return!1}Os(){return null}Ds(e){}$s(){}Ns(e,t){return!!e&&To(e.propertyFilters,t?.properties)}qs(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}js(e,t,s){var r=(s===Nt.Activation?this.Ps:this.Rs).get(e),n=[];return this.Bs((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((h=>h.name===e));return this.Ns(l,t)}))}register(e){var t;w((t=this._instance)==null?void 0:t._addCaptureHook)||(this.Hs(e),this.Us(e))}Us(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.zs==null&&(this.zs=new Uu(this._instance),this.zs.init(),this.zs.Ss((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.zs)==null||o.register(s.conditions.actions.values),(l=s.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((h=>{if(h&&h.name){var u=this.As.get(h.name);u&&u.push(s.id),this.As.set(h.name,u||[s.id])}})))})))}Hs(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.Ps=this.qs(e,Nt.Activation),this.Rs=this.qs(e,Nt.Cancellation))}onEvent(e,t){var s,r,n=this.Ws(),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.Vs(e,a);if(o==="consume")return n.info("event consumed activated item, removing it",{event:e,itemId:a}),void this.Zs([a]);if(o==="persist")return n.info("shown item promoted to persisted activation",{event:e,itemId:a}),this.Gs(a),void this.Qs([a])}if(this.Rs.has(e)){var l=this.js(e,t,Nt.Cancellation);l.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:l.map((u=>u.id))}),this.Zs(l.map((u=>u.id))),l.forEach((u=>this.Ks(u.id))))}if(this.Ps.has(e)){n.info("event name matched",{event:e,eventPayload:t,items:this.Ps.get(e)});var h=this.js(e,t,Nt.Activation);this.Js(h.map((u=>u.id)))}}onAction(e){this.As.has(e)&&this.Js(this.As.get(e)||[])}Js(e){var t;if(e.length!==0){var s=!((t=this._instance)==null||t.get_session_id==null||!t.get_session_id()),r=[];for(var n of e)s&&this.Ls(n)?this.Gs(n)&&this.Ys(n):r.push(n);r.length>0&&(this.Is=[...new Set([...this.Is,...r])]),this.Ws().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Gs(e){this.Is=this.Is.filter((s=>s!==e));var t=this.Xs();return!t.includes(e)&&(this.ta([...t,e]),this.ea(),!0)}Zs(e){var t=new Set(e);this.Is=this.Is.filter((n=>!t.has(n)));var s=this.ia(),r=s.filter((n=>!t.has(n)));r.length!==s.length&&(this.ta(r),r.length===0&&this.ra()),this.Qs(e)}na(){var e,t=this.Os();if(!t)return{};var s=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return s&&typeof s=="object"?s:{}}Ys(e){if(this.Os()){var t=this.na();this.Ds(y({},t,{[e]:Date.now()}))}}Qs(e){if(this.Os()){var t=this.na(),s={},r=!1;for(var n of Object.entries(t)){var a=n[0],o=n[1];e.includes(a)?r=!0:s[a]=o}r&&(Ge(s)?this.$s():this.Ds(s))}}sa(){this.Os()&&this.$s()}getActivationTimestamp(e){if(this.Xs().includes(e)){var t=this.na()[e];return ne(t)?t:void 0}}ia(){var e,t=this.aa();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}Xs(){var e,t,s=this.ia();if(s.length===0)return[];var r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this.oa()],n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();return n&&r===n?s:[]}ea(){var e,t=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();t&&this.la(t)}ra(){this.ua()}Fs(e){var t,s=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.oa()];if(s&&s!==e){var r=this.ia(),n=this.na();r.length>0&&(this.ta([]),r.filter((a=>ne(n[a]))).forEach((a=>this.Ks(a)))),this.ra(),this.sa()}}getActivatedIds(){return[...new Set([...this.Xs(),...this.Is])].filter((e=>!this.ha(e)))}reset(){this.Is=[],this.ia().length>0&&this.ta([]),this.ra(),this.sa()}getEventToItemsMap(){return this.Ps}da(){return this.zs}}class Gu extends Vu{constructor(e){super(e)}aa(){return tr}oa(){return Pi}Os(){return Ii}Ds(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Ii]:e})}$s(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(Ii)}Ls(e){var t,s;this.Bs((n=>{s=n.find((a=>a.id===e))}));var r=(t=s)==null||(t=t.appearance)==null?void 0:t.surveyPopupDelaySeconds;return ne(r)&&r>0}va(){return Ve.SHOWN}Bs(e){var t;(t=this._instance)==null||t.getSurveys(e)}Ks(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}Ws(){return B}ta(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[tr]:e})}la(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Pi]:e})}ua(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(Pi)}ha(){return!1}Vs(e,t){var s;this.Bs((n=>{s=n.find((a=>a.id===t))}));var r=!s||(function(n){var a;return Co(n)&&!((a=n.conditions)==null||(a=a.events)==null||!a.repeatedActivation)||n.schedule==="always"})(s);return r?e===Ve.SHOWN?"consume":"ignore":e===Ve.SHOWN?"persist":e===Ve.DISMISSED||e===Ve.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Ei="SDK is not enabled or survey functionality is not yet loaded",zn="Disabled. Not loading surveys.",Wu=v!=null&&v.location?Xi(v.location.hash,"__posthog")||Xi(location.hash,"state"):null,Bn="_postHogToolbarParams",Un=K("[Toolbar]"),Vn=K("[FeatureFlags]");class Ju{constructor(e,t){t===void 0&&(t=!1),this.ca=!1,this.update(e,t)}update(e,t){this.fa=((s,r)=>{var n,a,o,l;return{bootstrap:{featureFlags:(n=s.bootstrap)==null?void 0:n.featureFlags,featureFlagPayloads:(a=s.bootstrap)==null?void 0:a.featureFlagPayloads},remoteRequestsDisabled:r,featureFlagsDisabled:!!s.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!s.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!s.advanced_feature_flags_dedup_per_session,cacheTtlMs:s.feature_flag_cache_ttl_ms,requestTimeoutMs:s.feature_flag_request_timeout_ms,compression:s.disable_compression?"none":"base64",evaluationContexts:(o=(l=s.evaluation_contexts)!==null&&l!==void 0?l:s.evaluation_environments)!==null&&o!==void 0?o:[],flagKeys:q(s.flag_keys)?s.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.ca||(Vn.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ca=!0),w(e.flag_keys)||q(e.flag_keys)||Vn.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.fa}}var Gn=K("[FeatureFlags]"),rt=K("[FeatureFlags]",{debugEnabled:!0}),Os=`" failed. Feature flags didn't load in time.`,Wn="connection_error",Jn=i=>{for(var e={},t=0;i.length>t;t++)e[i[t]]=!0;return e},Yn=i=>{var e={};for(var t of Ri(i||{})){var s=t[1];s&&(e[t[0]]=s)}return e},Oe=K("[Error tracking]"),Kn="Refusing to render web experiment since the viewer is a likely bot",Yu={icontains:(i,e)=>e.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>e.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>es(e,i),not_regex:(i,e)=>!es(e,i),exact:(i,e)=>e===i,is_not:(i,e)=>e!==i};class he{get qe(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(s){s===void 0&&(s=!1),t.getWebExperiments((r=>{he.pa("retrieved web experiments from the server"),t.ga=new Map,r.forEach((n=>{if(n.feature_flag_key){var a;t.ga&&(he.pa("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=t.ga)==null||a.set(n.feature_flag_key,n));var o=t._instance.getFeatureFlag(n.feature_flag_key);j(o)&&n.variants[o]&&t.ma(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var h=n.variants[l];he.ya(h,t._instance)&&t.ma(n.name,l,h.transforms)}}))}),s)},this._instance=e,this._instance.onFeatureFlags((s=>{this.onFeatureFlags(s)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())he.pa(Kn);else if(!this.qe.disable_web_experiments){if(L(this.ga))return this.ga=new Map,this.loadIfEnabled(),void this.previewWebExperiment();he.pa("applying feature flags",e),e.forEach((t=>{var s;if(this.ga&&(s=this.ga)!=null&&s.has(t)){var r,n=this._instance.getFeatureFlag(t),a=(r=this.ga)==null?void 0:r.get(t);n&&a!=null&&a.variants[n]&&this.ma(a.name,n,a.variants[n].transforms)}}))}}previewWebExperiment(){var e=he.getWindowLocation();if(e!=null&&e.search){var t=Tt(e?.search,"__experiment_id"),s=Tt(e?.search,"__experiment_variant");t&&s&&(he.pa("previewing web experiments "+t+" && "+s),this.getWebExperiments((r=>{this.ba(parseInt(t),s,r)}),!1,!0))}}loadIfEnabled(){this.qe.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,s){if(this.qe.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.qe.token),method:"GET",timestampMode:"query",callback:n=>e(n.statusCode===200&&n.json&&n.json.experiments||[])})}ba(e,t,s){var r=s.filter((n=>n.id===e));r&&r.length>0&&(he.pa("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.ma(r[0].name,t,r[0].variants[t].transforms))}static ya(e,t){return!L(e.conditions)&&he._a(e,t)&&he.wa(e)}static _a(e,t){var s;if(L(e.conditions)||L((s=e.conditions)==null?void 0:s.url))return!0;var r=he.getWindowLocation();if(r){var n,a,o,l=Wa(t,r.href);return(n=e.conditions)==null||!n.url||Yu[(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 wa(e){var t;if(L(e.conditions)||L((t=e.conditions)==null?void 0:t.utm))return!0;var s=lo();if(s.utm_source){var r,n,a,o,l,h,u,c,d=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==s.utm_campaign,f=(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,p=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_medium)==s.utm_medium,g=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_term)==s.utm_term;return d&&p&&g&&f}return!1}static pa(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;t>r;r++)s[r-1]=arguments[r];x.info("[WebExperiments] "+e,s)}ma(e,t,s){this._is_bot()?he.pa(Kn):t!=="control"?s.forEach((r=>{if(r.selector){var n;he.pa("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)}))}})):he.pa("Control variants leave the page unmodified.")}_is_bot(){return ve&&this._instance?Io(ve,this.qe.custom_blocked_useragents):void 0}}var $e=K("[Conversations]"),nt="Conversations not available yet.",Xn="console",Lo="__posthogHandledLogsRequestError",As=(i,e)=>{var t=i instanceof Error?i:new Error(e);return t[Lo]=!0,t},Zn=i=>!!i&&typeof i=="object"&&i[Lo]===!0,ns={featureFlags:class{constructor(i){this.name="featureFlags",this.ka=!1,this.featureFlagEventHandlers=[],this.st=Gn,this.xa={},this.Sa={},this.Ca=[],this.Ma=!1,this.Ta=!1,this.Ea=0,this.Ia=!1,this.Pa=!1,this.Ra=!1,this.Aa=!1,this.Fa=0,this.La=()=>{var e=this.Oa();this.Fa=0,e&&this.reloadFeatureFlags()},"get"in i?this.Da=i:(this.$a=new Ju(i.config,i.tr()),this.Da=this.$a)}updateConfig(i,e){var t;(t=this.$a)==null||t.update(i,e)}setup(i){return this.Na=i,this.st=i.logger.createLogger("[FeatureFlags]"),t=()=>{this.Na===i&&(this.Na=void 0,this.fn=i,this.qa(i))},(e=i.kv.initialize())!=null&&e.then?e.then(t):t();var e,t}qa(i){if(this.fn===i)return v&&Z(v,"online",this.La),this.ja=i.registerDynamicEventProperties((()=>this.Ba()?this.xa:this.Sa)),this.Ha(),this.initialize()}destroy(){v?.removeEventListener("online",this.La)}dispose(){var i;this.Ea++,this.Pa=!1,this.Na=void 0,this.fn&&(this.Ua(),(i=this.ja)==null||i.dispose(),this.ja=void 0,this.Ca=[],v?.removeEventListener("online",this.La),this.fn=void 0)}get qe(){return this.Da.get()}za(i){var e;return(e=this.fn)==null?void 0:e.kv.get(i)}F(i){this.Wa((()=>{var e;return(e=this.fn)==null?void 0:e.kv.set(i)}))}q(i){this.Wa((()=>{var e;return(e=this.fn)==null?void 0:e.kv.remove(i)}))}Wa(i){try{i()}catch(e){this.st.error("Failed to update feature flag persistence",e)}}Ha(){var i={};for(var e of[Jt,Yt,Fi,Ae]){var t=this.za(e);w(t)||(i[e]=t)}this.xa=i;var s=y({},i),r=this.za(ot);if(r)for(var n of Object.entries(r))s["$feature/"+n[0]]=n[1];this.Sa=s}Ba(){var i=this.qe.cacheTtlMs;if(!i||0>=i)return!1;var e=this.za(ei);return typeof e!="number"||Date.now()-e>i}Va(){return!!this.Ba()&&(this.Aa||this.Ta||(this.Aa=!0,this.st.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Za(){var i=this.qe.evaluationContexts;return i!=null&&i.length?i.filter((e=>{var t=e&&typeof e=="string"&&e.trim().length>0;return t||this.st.error("Invalid evaluation context found:",e,"Expected non-empty string"),t})):[]}Ga(){var i=this.qe.flagKeys;if(!w(i))return i.filter((e=>{var t=e&&typeof e=="string"&&e.trim().length>0;return t||this.st.error("Invalid flag key found:",e,"Expected non-empty string"),t}))}initialize(){var i,e,t=this.qe,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((h=>!!s[h])).reduce(((h,u)=>(h[u]=s[u]||!1,h)),{}),l=Object.keys(a).filter((h=>o[h])).reduce(((h,u)=>(h[u]=a[u],h)),{});return this.Qa({featureFlags:o,featureFlagPayloads:l})}}updateFlags(i,e,t){var s,r,n=t!=null&&t.merge&&(s=this.za(ot))!==null&&s!==void 0?s:{},a=t!=null&&t.merge&&(r=this.za(Yt))!==null&&r!==void 0?r:{},o=y({},n,i),l=y({},a,e),h={};for(var u of Object.entries(o)){var c=u[0],d=u[1];h[c]={key:c,enabled:Hr(d),variant:zr(d),reason:void 0,metadata:w(l?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:l[c]}}}this.Qa({flags:h})}get hasLoadedFlags(){return this.Ma}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var i=this.za(Qs),e=this.za(Ae),t=this.za(lt);if(!t&&!e)return i||{};var s=J({},i||{}),r=[...new Set([...Object.keys(t||{}),...Object.keys(e||{})])];for(var n of r){var a,o,l=s[n],h=e?.[n],u=w(h)?(a=l?.enabled)!==null&&a!==void 0&&a:!!h,c=w(h)?l?.variant:typeof h=="string"?h:void 0,d=t?.[n],f=y({},l,{enabled:u,variant:u?c??l?.variant:void 0});u!==l?.enabled&&(f.original_enabled=l?.enabled),c!==l?.variant&&(f.original_variant=l?.variant),d&&(f.metadata=y({},l?.metadata,{payload:d,original_payload:l==null||(o=l.metadata)==null?void 0:o.payload})),s[n]=f}return this.ka||(this.st.warn(" Overriding feature flag details!",{flagDetails:i,overriddenPayloads:t,finalDetails:s}),this.ka=!0),s}getAllFeatureFlags(){var i=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(i).map((t=>{var s=i[t];return{key:t,enabled:Hr(s),variant:zr(s),payload:jr(e[t])}}))}getFlagVariants(){var i=this.za(ot),e=this.za(Ae);if(!e)return i||{};for(var t=J({},i||{}),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.ka||(this.st.warn(" Overriding feature flags!",{enabledFlags:i,overriddenFlags:e,finalFlags:t}),this.ka=!0),t}getFlagPayloads(){var i=this.za(Yt),e=this.za(lt);if(!e)return i||{};for(var t=J({},i||{}),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.ka||(this.st.warn(" Overriding feature flag payloads!",{flagPayloads:i,overriddenPayloads:e,finalPayloads:t}),this.ka=!0),t}reloadFeatureFlags(){this.Ia||this.qe.featureFlagsDisabled||this.Oa()||this.Ka||(this.Ca.slice().forEach((i=>{try{i()}catch(e){this.st.error("Error while running feature flags reloading callback",e)}})),this.Ka=setTimeout((()=>{this.Ja()}),5))}Ua(){clearTimeout(this.Ka),this.Ka=void 0}onReloading(i){return this.Ca.push(i),()=>{this.Ca=this.Ca.filter((e=>e!==i))}}ensureFlagsLoaded(){this.Ma||this.Ta||this.Ka||this.reloadFeatureFlags()}setAnonymousDistinctId(i){this.$anon_distinct_id=i}setReloadingPaused(i){this.Ia=i}resetFlagCallReported(){this.q(ct)}Ja(i){this.Ua();var e=this.fn;if(e&&!this.qe.remoteRequestsDisabled&&!this.Oa())if(this.Ta)this.Pa=!0;else{var t={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:y({},e.initialPersonProperties,this.za(je)||{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.za(ut),timezone:fo()};w(e.deviceId)||(t.$device_id=e.deviceId),(i!=null&&i.disableFlags||this.qe.featureFlagsDisabled)&&(t.disable_flags=!0);var s=this.Za();s.length&&(t.evaluation_contexts=s);var r=this.Ga();w(r)||(t.flag_keys=r);var n=this.qe.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),o=this.Ea;this.Ta=!0;var l=()=>{this.Pa&&(this.Pa=!1,this.Ja())},h=u=>{this.Ta=!1,o===this.Ea&&(this.F({[$i]:[Wn]}),this.st.error("Feature flag request failed",u)),l()};try{e.sendRequest(a,{target:"flags",method:"POST",body:t,compression:this.qe.compression==="base64"?pe.Base64:void 0,sentAt:"body",timeoutMs:this.qe.requestTimeoutMs}).then((u=>{var c,d,f=(c=u.json)!==null&&c!==void 0?c:{},p=u.statusCode!==200;if(this.Ta=!1,o===this.Ea){if(this.Ya(u.statusCode),p||this.Pa||(this.$anon_distinct_id=void 0),!t.disable_flags||this.Pa){this.Ra=!p;var g=[];u.error?g.push(u.error instanceof Error&&u.error.name==="AbortError"?"timeout":u.error instanceof Error?Wn:"unknown_error"):u.statusCode!==200&&g.push("api_error_"+u.statusCode),f.errorsWhileComputingFlags&&g.push("errors_while_computing_flags");var _=!((d=f.quotaLimited)==null||!d.includes("feature_flags"));_&&g.push("quota_limited"),this.F({[$i]:g}),_?this.st.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):t.disable_flags||this.Qa(f,p,{partialResponse:n}),l()}}else l()})).catch(h)}catch(u){h(u)}}}Oa(){return ao(this.Fa,3)}Ya(i){this.Fa=oo(i,this.Fa,3,(()=>this.st.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.Ra)if(this.Ma||this.getFlags()&&this.getFlags().length>0){if(!this.Va()){var s=this.getFeatureFlagResult(i,e);return(t=s?.variant)!==null&&t!==void 0?t:s?.enabled}}else this.st.warn('getFeatureFlag for key "'+i+Os)}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.Ra)if(this.Ma||this.getFlags()&&this.getFlags().length>0){if(!this.Va()){var t,s=this.getFlagVariants(),r=i in s,n=s[i],a=this.getFlagPayloads()[i],o=String(n),l=this.za(Fi)||void 0,h=this.za(ei)||void 0,u=this.za(ct)||{};if(this.qe.deduplicateCallsPerSession){var c,d=(c=this.fn)==null?void 0:c.session.sessionId,f=this.za(Xt);d&&d!==f&&(u={},t=d)}if(e.send_event||!("send_event"in e))if(i in u&&u[i].includes(o))t&&this.F({[ct]:u,[Xt]:t});else{var p,g,_,m,b,E,P,S,R,D,F,$;q(u[i])?u[i].push(o):u[i]=[o],this.F(y({[ct]:u},t?{[Xt]:t}:{}));var I=this.getFeatureFlagDetails(i),M=[...(p=this.za($i))!==null&&p!==void 0?p:[]];w(n)&&M.push("flag_missing");var T={$feature_flag:i,$feature_flag_response:n,$feature_flag_payload:a??null,$feature_flag_request_id:l,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:(g=(_=this.qe.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[i])!==null&&g!==void 0?g:null,$feature_flag_bootstrapped_payload:(m=(b=this.qe.bootstrap)==null||(b=b.featureFlagPayloads)==null?void 0:b[i])!==null&&m!==void 0?m:null,$used_bootstrap_value:!this.Ra};w(I==null||(E=I.metadata)==null?void 0:E.has_experiment)||(T.$feature_flag_has_experiment=I.metadata.has_experiment),w(I==null||(P=I.metadata)==null?void 0:P.version)||(T.$feature_flag_version=I.metadata.version);var O,H=(S=I==null||(R=I.reason)==null?void 0:R.description)!==null&&S!==void 0?S:I==null||(D=I.reason)==null?void 0:D.code;H&&(T.$feature_flag_reason=H),I!=null&&(F=I.metadata)!=null&&F.id&&(T.$feature_flag_id=I.metadata.id),w(I?.original_variant)&&w(I?.original_enabled)||(T.$feature_flag_original_response=w(I.original_variant)?I.original_enabled:I.original_variant),I!=null&&($=I.metadata)!=null&&$.original_payload&&(T.$feature_flag_original_payload=I==null||(O=I.metadata)==null?void 0:O.original_payload),M.length&&(T.$feature_flag_error=M.join(",")),this.Xa(T)}else t&&this.F({[ct]:u,[Xt]:t});if(r)return{key:i,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:jr(a)}}}else this.st.warn('getFeatureFlagResult for key "'+i+Os)}Xa(i){try{var e;(e=this.fn)==null||e.capture("$feature_flag_called",i).catch((t=>{this.st.error("Failed to capture feature flag call",t)}))}catch(t){this.st.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(i,e){this.eo(i,e)}eo(i,e){var t=this;return G((function*(){var s=t.fn;if(s){var r={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},n=t.Za();n.length&&(r.evaluation_contexts=n);var a,o=t.Ga();w(o)||(r.flag_keys=o);try{var l,h=(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:r,compression:t.qe.compression==="base64"?pe.Base64:void 0,sentAt:"body",timeoutMs:t.qe.requestTimeoutMs})).json)==null?void 0:l.featureFlagPayloads;a=h?.[i]||void 0}catch(u){return void t.st.error("Remote config feature flag request failed",u)}try{e(a)}catch(u){t.st.error("Remote config feature flag callback failed",u)}}}))()}isFeatureEnabled(i,e){if(e===void 0&&(e={}),e.fresh&&!this.Ra)return e.defaultValue;if(!(this.Ma||this.getFlags()&&this.getFlags().length>0))return this.st.warn('isFeatureEnabled for key "'+i+Os),e.defaultValue;var t=this.getFeatureFlag(i,e);return w(t)?e.defaultValue:!!t}addFeatureFlagsHandler(i){this.featureFlagEventHandlers.push(i)}removeFeatureFlagsHandler(i){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==i))}receivedFeatureFlags(i,e,t){this.Qa(i,e,t)}Qa(i,e,t){if(this.fn){this.Ma=!0;var s=(function(r,n,a,o,l,h){n===void 0&&(n={}),a===void 0&&(a={}),o===void 0&&(o={}),h===void 0&&(h=Gn);var u=((R,D)=>{var F=R.flags;return F?y({},R,{featureFlags:Object.fromEntries(Object.keys(F).map(($=>{var I;return[$,(I=F[$].variant)!==null&&I!==void 0?I:F[$].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(F).filter(($=>F[$].enabled)).filter(($=>{var I;return(I=F[$].metadata)==null?void 0:I.payload})).map(($=>{var I;return[$,(I=F[$].metadata)==null?void 0:I.payload]})))}):(R.featureFlags&&D.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),R)})(r,h),c=u.flags,d=u.featureFlags,f=u.featureFlagPayloads;if(d){var p=r.requestId,g=r.evaluatedAt;if(q(d)){h.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var _={};if(d)for(var m=0;d.length>m;m++)_[d[m]]=!0;return{[Jt]:d,[ot]:_,[Bi]:!1}}var b=d,E=f,P=c;if(l!=null&&l.partialResponse)b=y({},n,b),E=y({},a,E),P=y({},o,P);else if(r.errorsWhileComputingFlags)if(c){var S=new Set(Object.keys(c).filter((R=>{var D;return!((D=c[R])!=null&&D.failed)})));b=y({},n,Object.fromEntries(Object.entries(b).filter((R=>S.has(R[0]))))),E=y({},a,Object.fromEntries(Object.entries(E||{}).filter((R=>S.has(R[0]))))),P=y({},o,Object.fromEntries(Object.entries(P||{}).filter((R=>S.has(R[0])))))}else b=y({},n,b),E=y({},a,E),P=y({},o,P);return y({[Jt]:Object.keys(Yn(b)),[ot]:b||{},[Yt]:E||{},[Qs]:P||{},[Bi]:r.minimalFlagCalledEvents===!0},p?{[Fi]:p}:{},g?{[ei]:g}:{})}})(i,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),t,this.st);s&&this.F(s),e||(this.Aa=!1),this.io(e)}}override(i,e){e===void 0&&(e=!1),this.st.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:i,suppressWarning:e})}overrideFeatureFlags(i){this.ro(i)}ro(i){if(this.fn){if(i===!1)return this.q([Ae,lt]),this.io(),void rt.info("All overrides cleared");if(q(i))return this.F({[Ae]:Jn(i)}),this.io(),void rt.info("Flag overrides set",{flags:i});if(i&&typeof i=="object"&&("flags"in i||"payloads"in i)){var e,t=i;this.ka=!!((e=t.suppressWarning)!==null&&e!==void 0&&e);var s={},r=t.flags,n=t.payloads;return r&&(s[Ae]=q(r)?Jn(r):r),n&&(s[lt]=n),Object.keys(s).length&&this.F(s),r===!1&&n===!1?this.q([Ae,lt]):r===!1?this.q(Ae):n===!1&&this.q(lt),this.io(),r===!1?rt.info("Flag overrides cleared"):r&&rt.info("Flag overrides set",{flags:r}),void(n===!1?rt.info("Payload overrides cleared"):n&&rt.info("Payload overrides set",{payloads:n}))}if(i&&typeof i=="object")return this.F({[Ae]:i}),this.io(),void rt.info("Flag overrides set",{flags:i});this.st.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:i})}else this.st.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(i){if(this.addFeatureFlagsHandler(i),this.Ma){var e=this.no(),t=e.flags,s=e.flagVariants;try{i(t,s)}catch(r){this.st.error("Error while running feature flags callback",r)}}return()=>this.removeFeatureFlagsHandler(i)}updateEarlyAccessFeatureEnrollment(i,e,t){var s=(this.za(Si)||[]).find((l=>l.flagKey===i)),r={["$feature_enrollment/"+i]:e},n={$feature_flag:i,$feature_enrollment:e,$set:r};s&&(n.$early_access_feature_name=s.name),t&&(n.$feature_enrollment_stage=t);var a=y({},this.getFlagVariants(),{[i]:e});this.F({[Jt]:Object.keys(Yn(a)),[ot]:a,[je]:y({},this.za(je)||{},r)}),this.io();try{var o;(o=this.fn)==null||o.capture("$feature_enrollment_update",n).catch((l=>{this.st.error("Failed to capture early access feature enrollment",l)}))}catch(l){this.st.error("Failed to capture early access feature enrollment",l)}}getEarlyAccessFeatures(i,e,t){e===void 0&&(e=!1);var s=this.za(Si);!s||e?this.so(i,t):i(s)}so(i,e){var t=this;return G((function*(){var s=t.fn;if(s){var r,n=e?"&"+e.map((o=>"stage="+o)).join("&"):"";try{var a=yield s.sendRequest("/api/early_access_features/?token="+s.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!a.json)return;t.F({[Si]:r=a.json.earlyAccessFeatures})}catch(o){return void t.st.error("Early access feature request failed",o)}try{i(r)}catch(o){t.st.error("Early access feature callback failed",o)}}}))()}no(){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)),{})}}io(i){this.Ha();var e=this.no(),t=e.flags,s=e.flagVariants;this.featureFlagEventHandlers.forEach((r=>{try{r(t,s,{errorsLoading:i})}catch(n){this.st.error("Error while running feature flags callback",n)}}))}setPersonPropertiesForFlags(i,e){e===void 0&&(e=!0),this.ao(i,e)}ao(i,e){e===void 0&&(e=!0);var t=this.za(je)||{},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.F({[je]:y({},t,n,s)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=y({},this.za(je)||{});i.forEach((s=>{delete t[s]})),this.F({[je]:t}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(i){i===void 0&&(i=!0),this.q(je),i&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.za(ut)||{},s=y({},t);for(var r of Object.keys(i))s[r]=y({},t[r],i[r]);this.F({[ut]:s}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(i){if(i){var e=this.za(ut)||{};this.F({[ut]:y({},e,{[i]:{}})})}else this.q(ut)}reset(){this.Ea++,this.Pa=!1,this.Ha(),this.Ma=!1,this.Ia=!1,this.Ra=!1,this.$anon_distinct_id=void 0,this.Ua(),this.ka=!1,this.Fa=0}}},Ku={sessionRecording:class{get qe(){return this._instance.config}get Rr(){return this._instance.persistence}get started(){var i;return!((i=this.oo)==null||!i.isStarted)}get status(){var i,e;return this.lo===Ut||this.lo===xi?this.lo:(i=(e=this.oo)==null?void 0:e.status)!==null&&i!==void 0?i:this.lo}constructor(i){if(this._forceAllowLocalhostNetworkCapture=!1,this.lo=Nn,this.uo=void 0,this.ho=!1,this.do=(()=>{var e;if(k==null||!k.visibilityState||k.visibilityState==="visible")return!0;var t=v==null||(e=v.performance)==null||e.getEntriesByType==null?void 0:e.getEntriesByType("visibility-state");return!(t!=null&&t.length)||t.some((s=>s.name==="visible"))})(),this.Ee=()=>{var e;k?.visibilityState==="visible"&&(this.do=!0,(e=this.oo)==null||e.setDocumentWasEverVisible==null||e.setDocumentWasEverVisible(!0))},this._instance=i,!this._instance.sessionManager)throw De.error("started without valid sessionManager"),new Error(_r+" started without valid sessionManager. This is a bug.");if(this.qe.cookieless_mode===Be)throw new Error(_r+' cannot be used with cookieless_mode="always"');k!=null&&k.addEventListener&&Z(k,"visibilitychange",this.Ee)}initialize(){this.startIfEnabledOrStop()}dispose(){this.ho=!0,k==null||k.removeEventListener==null||k.removeEventListener("visibilitychange",this.Ee),this.stopRecording()}get vo(){var i,e=!((i=this._instance.get_property(dt))==null||!i.enabled),t=!this.qe.disable_session_recording,s=this.qe.disable_session_recording||this._instance.consent.isOptedOut();return v&&e&&t&&!s}startIfEnabledOrStop(i){var e;if(!(this.ho||this.vo&&(e=this.oo)!=null&&e.isStarted)){var t=!w(Object.assign)&&!w(Array.from);this.vo&&t?(this.co(i),De.info("starting")):(this.lo=Nn,this.stopRecording())}}co(i){var e,t,s;this.vo&&(this.lo!==Ut&&this.lo!==xi&&(this.lo=jn),C!=null&&(e=C.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(t=C.__PosthogExtensions__)!=null&&t.initSessionRecording?this.fo(i):(s=C.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.po,(r=>{if(r)return De.error("could not load recorder",r);this.fo(i)})))}stopRecording(){var i,e;(i=this.uo)==null||i.call(this),this.uo=void 0,(e=this.oo)==null||e.stop()}mo(){var i,e;(i=this.uo)==null||i.call(this),this.uo=void 0,(e=this.oo)==null||e.discard()}yo(){var i,e;(i=this.Rr)==null||i.unregister(Pr),(e=this.Rr)==null||e.unregister(qa)}bo(i,e){if(L(i))return null;var t,s=ne(i)?i:parseFloat(i);return typeof(t=s)!="number"||!Number.isFinite(t)||0>t||t>1?(De.warn(e+" must be between 0 and 1. Ignoring invalid value:",i),null):s}_o(i){if(this.Rr){var e,t,s=this.Rr,r=()=>{var n,a=i.sessionRecording===!1?void 0:i.sessionRecording,o=this.bo((n=this.qe.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.bo(a?.sampleRate,"remote config sampleRate"),h=o??l;L(h)&&this.yo();var u=a?.minimumDurationMilliseconds;s.register({[dt]: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:h,minimumDurationMilliseconds:w(u)?null:u,endpoint:a?.endpoint,triggerMatchType:a?.triggerMatchType,masking:a?.masking,urlTriggers:a?.urlTriggers,version:a?.version,triggerGroups:a?.triggerGroups})})};r(),(e=this.uo)==null||e.call(this),this.uo=(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._o(e),void this.mo()):(this._o(e),void this.startIfEnabledOrStop()):(this.lo===Ut&&(this.lo=xi,De.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.oo)!=null&&t.log?this.oo.log(i,e):De.warn("log called before recorder was ready")}get po(){var i,e,t=(i=this._instance)==null||(i=i.persistence)==null?void 0:i.get_property(dt);return(t==null||(e=t.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}wo(){var i,e=this._instance.get_property(dt);if(!e)return!1;try{i=typeof e=="object"?e:JSON.parse(e)}catch(t){return De.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!L(i.cache_timestamp)&&36e5>=Date.now()-i.cache_timestamp}fo(i){var e,t,s;if(!this.ho){if((e=C.__PosthogExtensions__)==null||!e.initSessionRecording)return De.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Ua]:!0});var r;if(this.oo||(this.oo=(r=C.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance,this.do),this.oo._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.wo())return this.lo===xi||this.lo===Ut?void 0:(this.lo=Ut,De.info("persisted remote config is stale, requesting fresh config before starting"),void new go(this._instance).load());this.lo=jn,(t=(s=this.oo).setDocumentWasEverVisible)==null||t.call(s,this.do),this.oo.start(i)}}onRRwebEmit(i){var e;(e=this.oo)==null||e.onRRwebEmit==null||e.onRRwebEmit(i)}overrideLinkedFlag(){var i,e;this.oo||(e=this.Rr)==null||e.register({[Da]:!0}),(i=this.oo)==null||i.overrideLinkedFlag()}overrideSampling(){var i,e;this.oo||(e=this.Rr)==null||e.register({[La]:!0}),(i=this.oo)==null||i.overrideSampling()}overrideTrigger(i){var e,t;this.oo||(t=this.Rr)==null||t.register({[i==="url"?Na:ja]:!0}),(e=this.oo)==null||e.overrideTrigger(i)}get sdkDebugProperties(){var i;return((i=this.oo)==null?void 0:i.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(i,e){var t;return!((t=this.oo)==null||!t.tryAddCustomEvent(i,e))}}},Xu={autocapture:class{constructor(i){this.ko=!1,this.xo=null,this.So=!1,this.Co=!1,this.instance=i,this.rageclicks=new qn(i.config.rageclick),this.Mo=null}initialize(){this.startIfEnabled()}get qe(){var i,e,t=Y(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}To(){if(this.isBrowserSupported()){if(v&&k){var i=t=>{t=t||v?.event;try{this.Eo(t)}catch(s){Rs.error("Failed to capture event",s)}};if(Z(k,"submit",i,{capture:!0}),Z(k,"change",i,{capture:!0}),Z(k,"click",i,{capture:!0}),this.qe.capture_copied_text){var e=t=>{t=t||v?.event;try{this.Eo(t,$s)}catch(s){Rs.error("Failed to capture copy/cut event",s)}};Z(k,"copy",e,{capture:!0}),Z(k,"cut",e,{capture:!0})}}}else Rs.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.ko&&(this.To(),this.ko=!0)}onRemoteConfig(i){if(this.So=!0,i.ok){var e=i.config;e.elementsChainAsString&&(this.Co=e.elementsChainAsString);var t=e.autocapture_opt_out;Ee(t)&&(this.instance.persistence&&this.instance.persistence.register({[Gs]:t}),this.xo=t),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(i){this.Mo=i}getElementSelectors(i){var e,t=[];return(e=this.Mo)==null||e.forEach((s=>{var r=k?.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[Gs],s=this.xo,r=this.instance.tr()&&!this.So;if(be(s)&&!Ee(t)&&!r)return!1;var n=(e=this.xo)!==null&&e!==void 0?e:!!t;return!!this.instance.config.autocapture&&!n}Eo(i,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var t,s=_s(i);Ya(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())&&cn(s,this.instance.config.rageclick)&&this.Eo(i,"$rageclick");var r=e===$s;if(s&&(function(c,d,f,p,g,_){var m;if(!v||Cr(c)||f!=null&&f.url_allowlist&&!ln(f.url_allowlist,_)||f!=null&&f.url_ignorelist&&ln(f.url_ignorelist,_))return!1;if(f!=null&&f.dom_event_allowlist){var b=f.dom_event_allowlist;if(b&&!b.some((F=>d.type===F)))return!1}var E=to(c,p),P=E.parentIsUsefulElement,S=E.targetElementList;if(!(function(F,$){var I=$?.element_allowlist;if(w(I))return!0;var M,T=function(H){if(I.some((z=>H.tagName.toLowerCase()===z)))return{v:!0}};for(var O of F)if(M=T(O))return M.v;return!1})(S,f)||!lr(S,f?.css_selector_allowlist)||lr(S,(m=f?.css_selector_ignorelist)!==null&&m!==void 0?m:Wl))return!1;try{var R=v.getComputedStyle(c);if(R&&R.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0}catch{}var D=c.tagName.toLowerCase();switch(D){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 P?(g||["click"]).indexOf(d.type)>=0:(g||["click"]).indexOf(d.type)>=0&&(Tr.indexOf(D)>-1||c.getAttribute("contenteditable")==="true")}})(s,i,this.qe,r,r?["copy","cut"]:void 0,this.instance)){var n=ju(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.qe.element_attribute_ignorelist,elementsChainAsString:this.Co,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===$s){var l,h=Za(v==null||(l=v.getSelection())==null?void 0:l.toString()),u=i.type||"clipboard";if(!h)return!1;a.$selected_content=h,a.$copy_type=u}return this.instance.capture(e,a),!0}}}isBrowserSupported(){return de(k?.querySelectorAll)}},historyAutocapture:class{constructor(i){var e;this._instance=i,this.Io=(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&&(x.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Po&&this.Po(),this.Po=void 0,x.info("History API monitoring stopped")}monitorHistoryChanges(){v&&v.history&&(this.Ro("pushState"),this.Ro("replaceState"),this.Ao())}Ro(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 Ln;var a={next:s[r]},o=n((function(){for(var l=arguments.length,h=new Array(l),u=0;l>u;u++)h[u]=arguments[u];return a.next.apply(this,h)}));return de(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];de(l)&&l.__posthog_layer__;){var h=l.__posthog_layer__;if(h.next===o)return void(h.next=a.next);l=h.next}else s[r]=a.next}}catch{return Ln}})(v.history,i,(s=>function(r,n,a){s.call(this,r,n,a),t.Fo(i)}))}}Fo(i){try{var e,t=v==null||(e=v.location)==null?void 0:e.pathname;if(!t)return;t!==this.Io&&this.isEnabled&&this._instance.capture(wt,{navigation_type:i}),this.Io=t}catch(s){x.error("Error capturing "+i+" pageview",s)}}Ao(){if(!this.Po){var i=()=>{this.Fo("popstate")};Z(v,"popstate",i),this.Po=()=>{v&&v.removeEventListener("popstate",i)}}}},heatmaps:class{get qe(){return this.instance.config}constructor(i){var e;this.Lo=!1,this.ko=!1,this.Oo=null,this.instance=i,this.Lo=!((e=this.instance.persistence)==null||!e.props[Ws]),this.rageclicks=new qn(i.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var i=5e3;return Y(this.qe.capture_heatmaps)&&this.qe.capture_heatmaps.flush_interval_milliseconds&&(i=this.qe.capture_heatmaps.flush_interval_milliseconds),i}get isEnabled(){return L(this.qe.capture_heatmaps)?L(this.qe.enable_heatmaps)?this.Lo:this.qe.enable_heatmaps:this.qe.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ko)return;zu.info("starting..."),this.Do(),this.Ee()}else{var i;clearInterval((i=this.Oo)!==null&&i!==void 0?i:void 0),this.$o(),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({[Ws]:t}),this.Lo=t,this.startIfEnabled()}}}getAndClearBuffer(){var i=this.R;return this.R=void 0,i}No(i){Cs(i.originalEvent)&&this.ke(i.originalEvent,"deadclick")}Ee(){this.Oo&&clearInterval(this.Oo),this.Oo=k?.visibilityState==="visible"?setInterval(this.br.bind(this),this.flushIntervalMilliseconds):null}Do(){v&&k&&(this.qo=this.br.bind(this),Z(v,Ji,this.qo),this.jo=i=>this.ke(i||v?.event),Z(k,"click",this.jo,{capture:!0}),this.Bo=i=>this.Ho(i||v?.event),Z(k,"mousemove",this.Bo,{capture:!0}),this.Uo=new mn(this.instance,eu,this.No.bind(this)),this.Uo.startIfEnabledOrStop(),this.zo=this.Ee.bind(this),Z(k,Wi,this.zo),this.ko=!0)}$o(){var i;v&&k&&(this.qo&&v.removeEventListener(Ji,this.qo),this.jo&&k.removeEventListener("click",this.jo,{capture:!0}),this.Bo&&k.removeEventListener("mousemove",this.Bo,{capture:!0}),this.zo&&k.removeEventListener(Wi,this.zo),clearTimeout(this.Wo),(i=this.Uo)==null||i.stop(),this.ko=!1)}Vo(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 h=a;h&&Ze(h)&&!Se(h,"body");){if(h===l)return!1;var u=void 0;try{var c,d,f;u=(c=(d=(f=h.ownerDocument)==null?void 0:f.defaultView)!==null&&d!==void 0?d:v)==null?void 0:c.getComputedStyle(h).position}catch{return!1}if(A(o,u))return!0;h=Qa(h)}return!1})(_s(i),["fixed","sticky"],r);return{x:i.clientX+(n?0:s),y:i.clientY+(n?0:t),target_fixed:n,type:e}}ke(i,e){var t;if(e===void 0&&(e="click"),!on(i.target)&&Cs(i)){var s=this.Vo(i,e);(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,new Date().getTime())&&cn(_s(i),this.instance.config.rageclick)&&this.Gt(y({},s,{type:"rageclick"})),this.Gt(s)}}Ho(i){!on(i.target)&&Cs(i)&&(clearTimeout(this.Wo),this.Wo=setTimeout((()=>{this.Gt(this.Vo(i,"mousemove"))}),500))}Gt(i){if(v){var e=this.qe.disable_capture_url_hashes?Xe(v.location.href):v.location.href,t=this.qe.custom_personal_data_properties,s=this.qe.mask_personal_data_properties?[...Ct,...t||[]]:[],r=li(e,s,ui);this.R=this.R||{},this.R[r]||(this.R[r]=[]),this.R[r].push(i)}}br(){this.R&&!Ge(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:mn,webVitalsAutocapture:class{constructor(i){var e;this.Lo=!1,this.ko=!1,this.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Zo=()=>{clearTimeout(this.Go),this.Go=void 0,this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",y({$current_url:this.R.url},this.R.metrics.reduce(((t,s)=>y({},t,{["$web_vitals_"+s.name+"_event"]:y({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{}))),this.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Qo=t=>{var s;if(this.R=this.R||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},L(t?.name)||L(t?.value))st.error("Invalid metric received",t);else{var r=typeof t.navigationURL=="string"?t.navigationURL:void 0,n=this.Ko(r);if(!w(n)){var a=ne(t.navigationId)||typeof t.navigationId=="string"?"navigation:"+t.navigationId:"url:"+n;if(!this.Jo||this.Jo>t.value){this.R.navigationKey!==a&&(this.Zo(),this.Go=setTimeout(this.Zo,this.flushToCaptureTimeoutMs)),w(this.R.navigationKey)&&(this.R.navigationKey=a,this.R.url=n),this.R.firstMetricTimestamp=w(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var o=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0),l=y({},t,r?{navigationURL:n}:{},{$current_url:n,timestamp:Date.now()});w(o)||(l.$session_id=o.sessionId,l.$window_id=o.windowId),this.R.metrics.push(l),this.R.metrics.length===this.allowedMetrics.length&&this.Zo()}else st.error("Ignoring metric with value >= "+this.Jo,t)}}},this.Yo=()=>{if(!this.ko){var t,s,r,n,a=C.__PosthogExtensions__,o=a?.postHogWebVitalsCallbacksByFlavor,l=o?.[this.Xo]||(this.Xo==="web-vitals"&&w(o)?a?.postHogWebVitalsCallbacks:void 0);if(w(l)||(t=l.onLCP,s=l.onCLS,r=l.onFCP,n=l.onINP),t&&s&&r&&n){var h={reportSoftNavs:this.useSoftNavs};this.allowedMetrics.indexOf("LCP")>-1&&t(this.Qo.bind(this),h),this.allowedMetrics.indexOf("CLS")>-1&&s(this.Qo.bind(this),h),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Qo.bind(this),h),this.allowedMetrics.indexOf("INP")>-1&&n(this.Qo.bind(this),h),this.ko=!0}else st.error("web vitals callbacks not loaded - not starting")}},this._instance=i,this.Lo=!((e=this._instance.persistence)==null||!e.props[Xs]),this.startIfEnabled()}get tl(){return this._instance.config.capture_performance}get allowedMetrics(){var i,e,t=Y(this.tl)?(i=this.tl)==null?void 0:i.web_vitals_allowed_metrics:void 0;return L(t)?((e=this._instance.persistence)==null?void 0:e.props[Zs])||["CLS","FCP","INP","LCP"]:t}get flushToCaptureTimeoutMs(){return(Y(this.tl)?this.tl.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var i=Y(this.tl)?this.tl.web_vitals_attribution:void 0;return i!=null&&i}get useSoftNavs(){var i=Y(this.tl)?this.tl.__preview_web_vitals_soft_navs:void 0;return i!=null&&i}get Jo(){var i=Y(this.tl)&&ne(this.tl.__web_vitals_max_value)?this.tl.__web_vitals_max_value:Dn;return i>0&&6e4>=i?Dn:i}get isEnabled(){var i=X?.protocol;if(i!=="http:"&&i!=="https:")return st.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=Y(this.tl)?this.tl.web_vitals:Ee(this.tl)?this.tl:void 0;return Ee(e)?e:this.Lo}startIfEnabled(){this.isEnabled&&!this.ko&&(st.info("enabled, starting..."),this.di(this.Yo))}onRemoteConfig(i){if(i.ok){var e=i.config;if("capturePerformance"in e){var t=Y(e.capturePerformance)&&!!e.capturePerformance.web_vitals,s=Y(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Xs]:t}),this._instance.persistence.register({[Zs]:s})),this.Lo=t,this.startIfEnabled()}}}get Xo(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}di(i){var e=C.__PosthogExtensions__,t=this.Xo,s=e?.postHogWebVitalsCallbacksByFlavor;s!=null&&s[t]||t==="web-vitals"&&w(s)&&e!=null&&e.postHogWebVitalsCallbacks?i():e==null||e.loadExternalDependency==null||e.loadExternalDependency(this._instance,t,(r=>{r?st.error("failed to load script",r):i()}))}Ko(i){var e=i||v?.location.href;if(e){var t=this._instance.config.disable_capture_url_hashes?Xe(e):e,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Ct,...s||[]]:[];return li(t,r,ui)}st.error("Could not determine current URL")}}},Zu={exceptionObserver:class{constructor(i){var e;this.Yo=()=>{var t;if(v&&this.isEnabled&&(t=C.__PosthogExtensions__)!=null&&t.errorWrappingFunctions){var s=C.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=C.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=C.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.el&&this.qe.capture_unhandled_errors&&(this.el=s(this.captureException.bind(this))),!this.il&&this.qe.capture_unhandled_rejections&&(this.il=r(this.captureException.bind(this))),!this.rl&&this.qe.capture_console_errors&&(this.rl=n(this.captureException.bind(this)))}catch(a){Bt.error("failed to start",a),this.nl()}}},this._instance=i,this.sl=!((e=this._instance.persistence)==null||!e.props[Js]),this.al=new Yo(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,st:Bt})),this.qe=this.ol(),this.startIfEnabledOrStop()}ol(){var i=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Y(i)?e=y({},e,i):(w(i)?this.sl:i)&&(e=y({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.qe.capture_console_errors||this.qe.capture_unhandled_errors||this.qe.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Bt.info("enabled"),this.nl(),this.di(this.Yo)):this.nl()}di(i){var e,t;(e=C.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?i():(t=C.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return Bt.error("failed to load script",s);i()}))}nl(){var i,e,t;(i=this.el)==null||i.call(this),this.el=void 0,(e=this.il)==null||e.call(this),this.il=void 0,(t=this.rl)==null||t.call(this),this.rl=void 0}onRemoteConfig(i){if(i.ok){var e=i.config;"autocaptureExceptions"in e&&(this.sl=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Js]:this.sl}),this.qe=this.ol(),this.startIfEnabledOrStop())}}onConfigChange(){this.qe=this.ol()}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.al.consumeRateLimit(r)?Bt.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.ll=[],this.ul=new dl([new bl,new $l,new xl,new wl,new Pl,new Fl,new El,new Il],(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 h=[],u=o.split(`
3
+ `),c=l;u.length>c;c++){var d=u[c];if(1024>=d.length){var f=tn.test(d)?d.replace(tn,"$1"):d;if(!f.match(/\S*Error: /)){for(var p of n){var g=p(f,s);if(g){h.push(g);break}}if(h.length>=50)break}}}return(function(_){if(!_.length)return[];var m=Array.from(_);return m.reverse(),m.slice(0,50).map((b=>{return y({},b,{filename:b.filename||(E=m,E[E.length-1]||{}).filename,function:b.function||$t});var E}))})(h)}})("web:javascript",gl,yl)),this._instance=i,this.ll=(e=(t=this._instance.persistence)==null?void 0:t.get_property(Ys))!==null&&e!==void 0?e:[],this.hl=Hi(this.dl()),this.vl=new Tl(this.hl)}onConfigChange(){this.hl=Hi(this.dl()),this.vl.setConfig(this.hl)}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.ll=n,this._instance.persistence&&this._instance.persistence.register({[Ys]:this.ll,[Ks]:a})}}}get cl(){var i,e=!!this._instance.get_property(Ks),t=this._instance.config.error_tracking.captureExtensionExceptions;return(i=t??e)!==null&&i!==void 0&&i}buildProperties(i,e){return this.ul.buildFromUnknown(i,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(i,e){if(this.hl.enabled)try{if(!j(i)||i.trim().length===0)return void Oe.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)=>Rl.has(l)?(a.push(l),o):(o[l]=n[l],o)),{}),droppedKeys:a}})(this.fl(e)),s=t.sanitizedProperties,r=t.droppedKeys;r.length>0&&Oe.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.vl.add(y({[Ni]:i,[ji]:new Date().toISOString()},s))}catch(n){Oe.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(i){try{var e=i.$exception_list;if(this.pl(e)){if(this.gl(e))return this.ml("Exception dropped: matched a suppression rule"),void Oe.info("Skipping exception capture because a suppression rule matched");if(!this.cl&&this.yl(e))return this.ml("Exception dropped: thrown by a browser extension"),void Oe.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.bl(e))return this.ml("Exception dropped: thrown by the PostHog SDK"),void Oe.info("Skipping exception capture because it was thrown by the PostHog SDK")}var t=this.hl.enabled&&L(i.$exception_steps)?this._l(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",ts:!0});return r&&this.vl.clear(),r}catch(a){return Oe.error("Failed to capture exception event. Dropping this exception.",a),void this.vl.clear()}}catch(a){return void Oe.error("Failed to process exception event. Ignoring this exception.",a)}var n}_l(i){try{var e=this.vl.getAttachable();return e.length===0?i:y({},i,{$exception_steps:e})}catch(t){return Oe.error("Failed to read buffered exception steps. Capturing exception without steps.",t),i}}ml(i){this.hl.enabled&&this.vl.add({[Ni]:i,[ji]:new Date().toISOString()})}fl(i){return Y(i)?y({},i):{}}dl(){var i,e;return(i=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&i!==void 0?i:{}}gl(i){if(i.length===0)return!1;try{var e=i.reduce(((t,s)=>{var r=s.type,n=s.value;return j(r)&&r.length>0&&t.$exception_types.push(r),j(n)&&n.length>0&&t.$exception_values.push(n),t}),{$exception_types:[],$exception_values:[]});return this.ll.some((t=>{var s=t.values.map((r=>{var n=Ro[r.operator],a=e[r.key];if(!n||!a)return!1;var o=q(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 Oe.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}yl(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://")))}bl(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}pl(i){return!L(i)&&q(i)}}},Qu=y({productTours:class{get Rr(){return this._instance.persistence}constructor(i){this.wl=null,this.kl=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.Rr&&this.Rr.register({[Fr]:!!e.productTours}),!Ms(this._instance))return!this.wl&&L((t=this.Rr)==null?void 0:t.props[Kt])||ki.info("product tours disabled; stopping and clearing cached tours"),(s=this.wl)==null||s.stop(),this.wl=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.wl&&Ms(this._instance)&&this.di((()=>this.xl()))}di(i){var e,t;(e=C.__PosthogExtensions__)!=null&&e.generateProductTours?i():(t=C.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"product-tours",(s=>{s?ki.error("Could not load product tours script",s):i()}))}xl(){var i;!this.wl&&(i=C.__PosthogExtensions__)!=null&&i.generateProductTours&&(this.wl=C.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(i,e){if(e===void 0&&(e=!1),!q(this.kl)||e){var t=this.Rr;if(t){var s=t.props[Kt];if(q(s)&&!e)return this.kl=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(Ms(this._instance)){var n=r.statusCode;if(n!==200||!r.json){var a="Product Tours API could not be loaded, status: "+n;return n===0?r.error||ki.warn(a):ki.error(a),void i([],{isLoaded:!1,error:a})}var o=q(r.json.product_tours)?r.json.product_tours:[];this.kl=o,t&&t.register({[Kt]:o}),i(o,{isLoaded:!0})}else i([],{isLoaded:!0})}})}else i(this.kl,{isLoaded:!0})}getActiveProductTours(i){L(this.wl)?i([],{isLoaded:!1,error:"Product tours not loaded"}):this.wl.getActiveProductTours(i)}showProductTour(i){var e;(e=this.wl)==null||e.showTourById(i)}previewTour(i){this.wl?this.wl.previewTour(i):this.di((()=>{var e;this.xl(),(e=this.wl)==null||e.previewTour(i)}))}dismissProductTour(){var i;(i=this.wl)==null||i.dismissTour("user_clicked_skip")}nextStep(){var i;(i=this.wl)==null||i.nextStep()}previousStep(){var i;(i=this.wl)==null||i.previousStep()}clearCache(){var i;this.kl=null,(i=this.Rr)==null||i.unregister(Kt)}resetTour(i){var e;(e=this.wl)==null||e.resetTour(i)}resetAllTours(){var i;(i=this.wl)==null||i.resetAllTours()}cancelPendingTour(i){var e;(e=this.wl)==null||e.cancelPendingTour(i)}}},ns),eh={siteApps:class{constructor(i){this.Sl=0,this._instance=i,this.Cl=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ml(i,e){if(e){var t=this.globalsForEvent(e);this.Cl.push(t),this.Cl.length>1e3&&(this.Cl=this.Cl.slice(10))}}get siteAppLoaders(){var i;return(i=C._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.Ml.bind(this));this.Tl=()=>{i(),this.Cl=[],this.Tl=void 0}}}globalsForEvent(i){var e,t,s,r,n,a,o;if(!i)throw new Error("Event payload is required");var l={},h=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var c of Object.entries(u)){var d=c[0];l[d]={id:h[d],type:d,properties:c[1]}}var f=i.$set_once,p=i.$set;return{event:y({},ea(i,Bu),{properties:y({},i.properties,p?{$set:y({},(e=(t=i.properties)==null?void 0:t.$set)!==null&&e!==void 0?e:{},p)}:{},f?{$set_once:y({},(s=(r=i.properties)==null?void 0:r.$set_once)!==null&&s!==void 0?s:{},f)}:{}),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}}El(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)||(Me.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)||(Me.error("prepare_external_dependency_script returned null"),null):i}Il(){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=k?.defaultView,h=l==null||(i=l.Node)==null?void 0:i.prototype;if(!l||!h)return()=>{};if(this.Sl++,this.Pl)return this.Rl();var u=[],c=this,d=new WeakSet,f=(_,m,b)=>{if(_!=null&&_[m]){var E=_[m];_[m]=b(E),u.push((()=>{_[m]=E}))}},p=_=>{if(d.has(_))return _;var m=c.El(_);return m&&d.add(m),m},g=_=>_.map((m=>typeof m=="string"?m:p(m))).filter((m=>!be(m)));return f(h,"appendChild",(_=>function(m){var b=p(m);return b?_.call(this,b):m})),f(h,"insertBefore",(_=>function(m,b){var E=p(m);return E?_.call(this,E,b):m})),f(h,"replaceChild",(_=>function(m,b){var E=p(m);return E?_.call(this,E,b):b})),[(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((_=>{f(_,"append",(m=>function(){for(var b=arguments.length,E=new Array(b),P=0;b>P;P++)E[P]=arguments[P];return m.apply(this,g(E))})),f(_,"prepend",(m=>function(){for(var b=arguments.length,E=new Array(b),P=0;b>P;P++)E[P]=arguments[P];return m.apply(this,g(E))}))})),[(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((_=>{f(_,"before",(m=>function(){for(var b=arguments.length,E=new Array(b),P=0;b>P;P++)E[P]=arguments[P];return m.apply(this,g(E))})),f(_,"after",(m=>function(){for(var b=arguments.length,E=new Array(b),P=0;b>P;P++)E[P]=arguments[P];return m.apply(this,g(E))})),f(_,"replaceWith",(m=>function(){for(var b=arguments.length,E=new Array(b),P=0;b>P;P++)E[P]=arguments[P];var S=g(E);return E.length&&!S.length?void 0:m.apply(this,S)}))})),f((o=l.Element)==null?void 0:o.prototype,"insertAdjacentElement",(_=>function(m,b){var E=p(b);return E?_.call(this,m,E):null})),this.Pl=()=>{u.forEach((_=>_())),this.Pl=void 0},this.Rl()}Rl(){var i=!1;return()=>{var e;i||(i=!0,this.Sl--,this.Sl===0&&((e=this.Pl)==null||e.call(this)))}}Al(i,e){e===void 0&&(e=!0);var t=this.Il();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.Cl.length&&(Me.info("Processing "+this.Cl.length+" events for site app with id "+i.id),this.Cl.forEach((o=>this.Al((()=>e.processEvent==null?void 0:e.processEvent(o))))),e.processedBuffer=!0),Object.values(this.apps).every((o=>o.processedBuffer||o.errored))&&((a=this.Tl)==null||a.call(this))},s=!1,r=a=>{e.errored=!a,e.loaded=!0,Me.info("Site app with id "+i.id+" "+(a?"loaded":"errored")),s&&t()};try{var n=this.Al((a=>i.init({posthog:this._instance,callback(o){a(),r(o)}})),!1).processEvent;n&&(e.processEvent=n),s=!0}catch(a){Me.error(Hn+i.id,a),r(!1)}if(s&&e.loaded)try{t()}catch(a){Me.error("Error while processing buffered events PostHog app with config id "+i.id,a),e.errored=!0}}Fl(){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)}Ll(i){var e=this;if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(i),s=function(n){try{e.Al((()=>n.processEvent==null?void 0:n.processEvent(t)))}catch(a){Me.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.Fl(),void this._instance.on("eventCaptured",(l=>this.Ll(l)))):void Me.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((t=this.Tl)==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,h=o.id,u=o.url;C["__$$ph_site_app_"+h]=r._instance,(l=C.__PosthogExtensions__)==null||l.loadSiteApp==null||l.loadSiteApp(r._instance,u,(c=>{if(c)return Me.error(Hn+h,c)}))};for(var o of n.siteApps)a()}else Me.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},th={tracingHeaders:class{constructor(i){this.Ol=void 0,this.Dl=void 0,this.$l=void 0,this.Yo=()=>{var e,t,s=this.Nl();s?(w(this.Ol)&&(this.Ol=(e=C.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),w(this.Dl)&&(this.Dl=(t=C.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchFetch(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.nl()},this._instance=i}initialize(){this.startIfEnabledOrStop()}di(i){var e,t;(e=C.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?i():(t=C.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return Hu.error("failed to load script",s);i()}))}ql(){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}Nl(){var i=this.ql();return q(i)?(q(this.$l)?this.$l.splice(0,this.$l.length,...i):this.$l=[...i],i.length>0?this.$l:void 0):(q(this.$l)&&this.$l.splice(0),this.$l=i||void 0,this.$l)}nl(){var i,e;(i=this.Ol)==null||i.call(this),(e=this.Dl)==null||e.call(this),this.Ol=void 0,this.Dl=void 0}startIfEnabledOrStop(){this.Nl()?this.di(this.Yo):this.nl()}}},ih=y({surveys:class{get qe(){return this._instance.config}constructor(i){this.jl=void 0,this._surveyManager=null,this.Bl=!1,this.Hl=[],this.Ul=null,this.zl=null,this._instance=i,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this.qe.disable_surveys){if(!i.ok)return B.warn("Remote config unavailable. Not loading surveys.");var e=i.config.surveys;if(L(e))return B.warn("Flags not loaded yet. Not loading surveys.");var t=q(e);this.jl=t?e.length>0:e,B.info("flags response received, isSurveysEnabled: "+this.jl),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(Mo)||s!=null&&s.startsWith("inProgressSurvey_"))&&e.push(s)}e.forEach((r=>localStorage.removeItem(r)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.Bl)B.info("Already initializing surveys, skipping...");else if(this.qe.disable_surveys)B.info(zn);else if(this.qe.cookieless_mode&&this._instance.consent.isOptedOut())B.info("Not loading surveys in cookieless mode without consent.");else{var i=C?.__PosthogExtensions__;if(i){if(!w(this.jl)||this.qe.advanced_enable_surveys){var e=this.jl||this.qe.advanced_enable_surveys;this.Bl=!0;try{var t=i.generateSurveys;if(t)return void this.Wl(t,e);var s=i.loadExternalDependency;if(!s)return void this.Vl(Ir);s(this._instance,"surveys",(r=>{r||!i.generateSurveys?this.Vl("Could not load surveys script",r):this.Wl(i.generateSurveys,e)}))}catch(r){throw this.Vl("Error initializing surveys",r),r}finally{this.Bl=!1}}}else B.error("PostHog Extensions not found.")}}Wl(i,e){this._surveyManager=i(this._instance,e),this._surveyEventReceiver=new Gu(this._instance),B.info("Surveys loaded successfully"),this.Zl({isLoaded:!0})}Vl(i,e){B.error(i,e),this.Zl({isLoaded:!1,error:i})}onSurveysLoaded(i){return this.Hl.push(i),this._surveyManager&&this.Zl({isLoaded:!0}),()=>{this.Hl=this.Hl.filter((e=>e!==i))}}getSurveys(i,e){if(e===void 0&&(e=!1),this.qe.disable_surveys)return B.info(zn),i([]);var t,s=this._instance.get_property(er);if(s&&!e)return i(s,{isLoaded:!0}),void(this.Gl()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Ul?this.Ul.then((r=>i(r.surveys,r.context))):(typeof Promise<"u"&&(this.Ul=new Promise((r=>{t=r}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.qe.token),method:"GET",timestampMode:"query",timeout:this.qe.surveys_request_timeout_ms,callback:r=>{var n;this.Ul=null;var a=r.statusCode;if(a!==200||!r.json){var o="Surveys API could not be loaded, status: "+a;a!==0?B.error(o):r.error||B.warn(o),this.zl=Date.now();var l={isLoaded:!1,error:o};return i([],l),void(t==null||t({surveys:[],context:l}))}this.zl=null;var h,u=r.json.surveys||[],c=u.filter((f=>(function(p){return!(!p.start_date||p.end_date)})(f)&&(Co(f)||(function(p){var g;return!((g=p.conditions)==null||(g=g.actions)==null||(g=g.values)==null||!g.length)})(f))));c.length>0&&((h=this._surveyEventReceiver)==null||h.register(c)),(n=this._instance.persistence)==null||n.register({[er]:u,[Ui]:Date.now()});var d={isLoaded:!0};i(u,d),t?.({surveys:u,context:d})}}))}Gl(){return this.Ql()&&!this.Ul&&!this.Kl()}Ql(){var i=this._instance.get_property(Ui);return ne(i)&&Date.now()-i>3e5}Kl(){return ne(this.zl)&&3e5>Date.now()-this.zl}markSurveyAsSeen(i,e){var t,s={id:i,current_iteration:(t=e?.iteration)!==null&&t!==void 0?t:null};Oo(s);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Zl(i){for(var e of this.Hl)try{if(!i.isLoaded)return e([],i);this.getSurveys(e)}catch(t){B.error("Error in survey callback",t)}}getActiveMatchingSurveys(i,e){if(e===void 0&&(e=!1),!L(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(i,e);B.warn("init was not called")}Jl(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}Yl(i){if(L(this._surveyManager))return{eligible:!1,reason:Ei};var e=typeof i=="string"?this.Jl(i):i;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Xl(i){if(L(this._surveyManager))return{eligible:!1,reason:Ei};var e=typeof i=="string"?this.Jl(i):i;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(i){if(L(this._surveyManager))return B.warn("init was not called"),{visible:!1,disabledReason:Ei};var e=this.Xl(i);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(i,e){return L(this._surveyManager)?(B.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ei})):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.Xl(n);t({visible:a.eligible,disabledReason:a.reason})}else t({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(i,e,t){var s;if(L(this._surveyManager))B.warn("init was not called");else{var r=typeof i=="string"?this.Jl(i):i;if(r!=null&&r.id)if(Iu.includes(r.type)){var n=k?.querySelector(e);if(n)return(s=r.appearance)!=null&&s.surveyPopupDelaySeconds?(B.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,o;B.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),B.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,t);B.warn("Survey element not found")}else B.warn("Surveys of type "+r.type+" cannot be rendered in the app");else B.warn("Survey not found")}}displaySurvey(i,e){var t;if(L(this._surveyManager))B.warn("init was not called");else{var s=this.Jl(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!==hr.Popover&&e.initialResponses&&B.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var n=this.Yl(s);if(!n.eligible)return void B.warn("Survey is not eligible to be displayed: ",n.reason)}e.displayType!==hr.Inline?this._surveyManager.handlePopoverSurvey(r,e):this.renderSurvey(r,e.selector,e.properties)}else B.warn("Survey not found")}}cancelPendingSurvey(i){L(this._surveyManager)?B.warn("init was not called"):this._surveyManager.cancelSurvey(i)}handlePageUnload(){var i;(i=this._surveyManager)==null||i.handlePageUnload==null||i.handlePageUnload()}}},ns),sh={toolbar:class{constructor(i){this.instance=i}tu(i){C.ph_toolbar_state=i}eu(){var i;return(i=C.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),or(this.instance.config)||!v||!k)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=Wu||Xi(i.hash,"__posthog")||Xi(i.hash,"state"),n=r?nn((()=>JSON.parse(atob(decodeURIComponent(r)))))||nn((()=>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(Bn)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}iu(i){var e=C.ph_load_toolbar||C.ph_load_editor;!L(e)&&de(e)?e(i,this.instance):Un.warn("No toolbar load function found")}loadToolbar(i){var e=!(k==null||!k.getElementById(Ja));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(Bn,JSON.stringify(y({},s,{source:void 0}))),this.eu()===2)this.iu(s);else if(this.eu()===0){var r;this.tu(1),(r=C.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"toolbar",(n=>{if(n)return Un.error("[Toolbar] Failed to load",n),void this.tu(0);this.tu(2),this.iu(s)})),Z(v,"turbolinks:load",(()=>{this.tu(0),this.loadToolbar(s)}))}return!0}ru(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)}}},rh=y({experiments:he},ns),nh={conversations:class{constructor(i){this.nu=void 0,this._conversationsManager=null,this.su=!1,this.au=null,this.ou=!1,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this._instance.config.disable_conversations&&(this.lu=i.ok,i.ok)){var e=i.config.conversations;L(e)||(Ee(e)?this.nu=e:(this.nu=e.enabled,this.au=e),this.loadIfEnabled())}}reset(){var i;(i=this._conversationsManager)==null||i.reset(),this._conversationsManager=null,this.nu=void 0,this.au=null,this.lu=void 0,this.ou=!1}loadIfEnabled(){if(!(this._conversationsManager||this.su||this._instance.config.disable_conversations||or(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=C?.__PosthogExtensions__;if(i&&!w(this.nu)&&this.nu)if(this.au&&this.au.token){this.su=!0;try{var e=i.initConversations;if(e)return this.uu(e),void(this.su=!1);var t=i.loadExternalDependency;if(!t)return void this.hu(Ir);t(this._instance,"conversations",(s=>{s||!i.initConversations?this.hu("Could not load conversations script",s):this.uu(i.initConversations),this.su=!1}))}catch(s){this.hu("Error initializing conversations",s),this.su=!1}}else $e.error("Conversations enabled but missing token in remote config.")}}uu(i){if(this.au)try{this._conversationsManager=i(this.au,this._instance),this.ou=!1,$e.info("Conversations loaded successfully")}catch(e){this.hu("Error completing conversations initialization",e)}else $e.error("Cannot complete initialization: remote config is null")}hu(i,e){$e.error(i,e),this._conversationsManager=null,this.su=!1,this.ou=!0}show(){this._conversationsManager?this._conversationsManager.show():$e.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.nu===!0&&!be(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":or(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.lu===!1?"remote_config_failed":w(this.nu)?this.lu?"disabled_in_project":"remote_config_pending":this.nu?L(this.au)||!this.au.token?"missing_token":C!=null&&C.__PosthogExtensions__?this.su?"initializing":this.ou?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}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 G((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(i,e,t):($e.warn(nt),null)}))()}getMessages(i,e){var t=this;return G((function*(){return t._conversationsManager?t._conversationsManager.getMessages(i,e):($e.warn(nt),null)}))()}markAsRead(i){var e=this;return G((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(i):($e.warn(nt),null)}))()}getTickets(i){var e=this;return G((function*(){return e._conversationsManager?e._conversationsManager.getTickets(i):($e.warn(nt),null)}))()}requestRestoreLink(i){var e=this;return G((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(i):($e.warn(nt),null)}))()}restoreFromToken(i){var e=this;return G((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(i):($e.warn(nt),null)}))()}restoreFromUrlToken(){var i=this;return G((function*(){return i._conversationsManager?i._conversationsManager.restoreFromUrlToken():($e.warn(nt),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}hs(){var i;(i=this._conversationsManager)==null||i.setIdentity()}ds(){var i;(i=this._conversationsManager)==null||i.clearIdentity()}}},ah={logs:class{constructor(i){var e,t=this;this.du=!1,this.vu=!1,this.st=K("[logs]"),this.cu=y({},this.st,{error(){for(var s=arguments.length,r=new Array(s),n=0;s>n;n++)r[n]=arguments[n];r.some(Zn)||t.st.error(...r)}}),this.sr=[],this.fu=[],this.Fa=0,this.pu=()=>{var s,r;this.Fa=0,(s=this.gu)==null||s.onReconnect(),(r=this.mu)==null||r.onReconnect()},this._instance=i,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.du=!0),v&&Z(v,"online",this.pu)}yu(i,e,t,s){var r,n=(function(a,o){var l,h,u,c,d,f,p,g=(l=a?.flushIntervalMs)!==null&&l!==void 0?l:3e3,_=(h=a?.maxBufferSize)!==null&&h!==void 0?h:100,m=o!=null&&o.consoleCapture?void 0:(u=a?.maxLogsPerInterval)!==null&&u!==void 0?u:1e3,b=w(m)?Math.max(_,2048):Math.max(_,m),E=a?.resourceAttributes;return{serviceName:(c=(d=E?.["service.name"])!==null&&d!==void 0?d:a?.serviceName)!==null&&c!==void 0?c:o?.serviceNameDefault,serviceVersion:(f=E?.["service.version"])!==null&&f!==void 0?f:a?.serviceVersion,environment:(p=E?.["deployment.environment"])!==null&&p!==void 0?p:a?.environment,resourceAttributes:E,beforeSend:a?.beforeSend,flushIntervalMs:g,maxBufferSize:_,maxQueueSize:b,maxBatchRecordsPerPost:100,rateCapWindowMs:g,maxLogsPerInterval:m,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((r=this._instance)==null||(r=r.config)==null?void 0:r.logs,t);return[new ul(this.bu(i,e),n,this.cu,(()=>this._u()),(a=>a()),void 0,s),n]}wu(){var i,e=(i=this._instance)==null||(i=i.config)==null?void 0:i.logs;if(!this.gu||this.ku!==e){var t;(t=this.gu)==null||t.reset(),this.ku=e;var s=this.yu((()=>this.sr),(r=>{this.sr=r}));this.gu=s[0],this.xu=s[1]}return this.gu}Su(){var i,e=(i=this._instance)==null||(i=i.config)==null?void 0:i.logs;if(!this.mu||this.Cu!==e){var t;(t=this.mu)==null||t.reset(),this.Cu=e;var s=this.yu((()=>this.fu),(r=>{this.fu=r}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Xn);this.mu=s[0],this.Mu=s[1]}return this.mu}initialize(){this.loadIfEnabled()}onRemoteConfig(i){var e;if(i.ok){var t=(e=i.config.logs)==null?void 0:e.captureConsoleLogs;!L(t)&&t&&(this.du=!0,this.loadIfEnabled())}}reset(){var i,e;this.sr=[],(i=this.gu)==null||i.reset(),this.fu=[],(e=this.mu)==null||e.reset(),this.Fa=0}captureLog(i){this.wu().captureLog(i)}he(i){this.Su().captureLog(i)}get logger(){return this.Tu||(this.Tu={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.Tu}flushLogs(i){i?this.Eu(i):(this.gu&&this.gu.flush().catch((e=>this.Iu(e))),this.mu&&this.mu.flush().catch((e=>this.Iu(e))))}Iu(i){Zn(i)||this.st.error("PostHog logs flush failed:",i)}loadIfEnabled(){if(this.du&&!this.vu){var i=C?.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",(t=>{var s;t||(s=i.logs)==null||!s.initializeLogs?this.st.error("Could not load logs script",t):(i.logs.initializeLogs(this._instance),this.vu=!0)})):this.st.error(Ir)}else this.st.error("PostHog Extensions not found.")}}bu(i,e){var t=this._instance;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},getPersistedProperty:s=>s===He.LogsQueue?i():void 0,setPersistedProperty(s,r){var n;s===He.LogsQueue&&e((n=r)!==null&&n!==void 0?n:[])},$t:s=>this.$t(s),getLibraryId:()=>U.LIB_NAME,getLibraryVersion:()=>U.LIB_VERSION}}$t(i){return new Promise((e=>{if(ao(this.Fa,3))e({kind:"fatal",error:As(void 0,"logs endpoint is unreachable, dropping batch")});else{var t=!1,s=n=>{t||(t=!0,clearTimeout(r),e(n))},r=setTimeout((()=>{this.st.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:As(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Pu(),data:i,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:n=>{var a=n.statusCode;if(this.Ru(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;a===0?(n.error||this.st.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:As(n.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:(o=n.error)!==null&&o!==void 0?o:new Error("logs request failed with status "+a)})}}})}}))}Ru(i){(i!==0||this._instance.__loaded)&&(this.Fa=oo(i,this.Fa,3,(()=>this.st.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."))))}Eu(i){this.sr.length>0&&this.Au(i,this.sr,this.xu,U.LIB_NAME,(e=>{this.sr=e})),this.fu.length>0&&this.Au(i,this.fu,this.Mu,Xn,(e=>{this.fu=e}))}Au(i,e,t,s,r){if(e.length!==0){var n=e.map((o=>o.record));r([]);var a=Ta(n,Ra(t,U.LIB_NAME,U.LIB_VERSION),s,U.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Pu(),data:a,compression:"best-available",batchKey:"logs",transport:i})}}Pu(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}_u(){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,L(r)||(e.sessionStartTimestamp=r),L(n)||(e.lastActivityTimestamp=n)}if(C!=null&&(i=C.location)!=null&&i.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Xe(C.location.href):C.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(e.activeFeatureFlags=a)}return e}}},oh={metrics:class{constructor(i){this.st=K("[metrics]"),this._instance=i}initialize(){}wu(){var i,e,t=(i=this._instance)==null||(i=i.config)==null?void 0:i.metrics;return this.gu&&this.ku===t||((e=this.gu)==null||e.reset(),this.ku=t,this.gu=new hl(this.bu(),(function(s){var r,n,a,o,l,h=s?.resourceAttributes;return{serviceName:(r=h?.["service.name"])!==null&&r!==void 0?r:s?.serviceName,serviceVersion:(n=h?.["service.version"])!==null&&n!==void 0?n:s?.serviceVersion,environment:(a=h?.["deployment.environment"])!==null&&a!==void 0?a:s?.environment,resourceAttributes:h,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.st)),this.gu}count(i,e,t){e===void 0&&(e=1),this.wu().count(i,e,t)}gauge(i,e,t){this.wu().gauge(i,e,t)}histogram(i,e,t){this.wu().histogram(i,e,t)}flush(i){if(!this.gu)return Promise.resolve();if(i){var e=this.gu.drainWindow();return e&&this.Xt(e,i),Promise.resolve()}return this.gu.flush().catch((t=>this.st.error("PostHog metrics flush failed:",t)))}reset(){var i;(i=this.gu)==null||i.reset()}bu(){var i=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},Xt:t=>e.Xt(t),getLibraryId:()=>U.LIB_NAME,getLibraryVersion:()=>U.LIB_VERSION}}Xt(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.Fu(),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)})}}}))}))}Fu(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},lh=y({},ns,Ku,Xu,Zu,Qu,eh,ih,th,sh,rh,nh,ah,oh);ke.__defaultExtensionClasses=y({},lh);var uh=(function(){U.SDK_DIST_CHANNEL="npm";var i=si[xt]=new ke;return(function(){function e(){e.done||(e.done=!0,qo=!1,V(si,(function(t){t._dom_loaded()})))}k!=null&&k.addEventListener?k.readyState==="complete"?e():Z(k,"DOMContentLoaded",e,{capture:!1}):v&&x.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),i})();export{pe as Compression,hr as DisplaySurveyType,ke as PostHog,hu as ProductTourEventName,wn as ProductTourEventProperties,Ve as SurveyEventName,xs as SurveyEventProperties,Nt as SurveyEventType,ws as SurveyType,uh as default,uh as posthog};