tokentracker-cli 0.90.2 → 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 (117) hide show
  1. package/README.de.md +7 -5
  2. package/README.ja.md +9 -5
  3. package/README.ko.md +9 -5
  4. package/README.md +7 -5
  5. package/README.zh-CN.md +6 -4
  6. package/dashboard/dist/assets/{AchievementBadge-BJl0ibLg.js → AchievementBadge-LHOuekQ3.js} +1 -1
  7. package/dashboard/dist/assets/{AchievementsPage-CV6aNe3g.js → AchievementsPage-DNzeYWBl.js} +2 -2
  8. package/dashboard/dist/assets/{AchievementsSection-DxLHu9EV.js → AchievementsSection-Ch5dImt8.js} +1 -1
  9. package/dashboard/dist/assets/{BadgeDetailModal-ConoHhIL.js → BadgeDetailModal-CuikWkUy.js} +1 -1
  10. package/dashboard/dist/assets/{Card-C_VQxG6G.js → Card-Chwjmxjz.js} +1 -1
  11. package/dashboard/dist/assets/{ClawdAnimated-_Mfn4MnU.js → ClawdAnimated-BdB7aycS.js} +1 -1
  12. package/dashboard/dist/assets/{CommandPalette-CCRCnYY9.js → CommandPalette-BMwuSEWM.js} +1 -1
  13. package/dashboard/dist/assets/{CommunityStatsModal-DuICwpdM.js → CommunityStatsModal-eEDF-xn8.js} +1 -1
  14. package/dashboard/dist/assets/{ConfirmModal-CI27robt.js → ConfirmModal-Be7f6XdL.js} +1 -1
  15. package/dashboard/dist/assets/{Controls-Cwu0gtgj.js → Controls-CtBFPCBY.js} +1 -1
  16. package/dashboard/dist/assets/{DashboardPage-GsFvPie1.js → DashboardPage-M0p-SU-f.js} +1 -1
  17. package/dashboard/dist/assets/{DevicePage-BSK76UQE.js → DevicePage-CAfcUond.js} +1 -1
  18. package/dashboard/dist/assets/{DialogClose-BXQlPs02.js → DialogClose-kd1wIljN.js} +1 -1
  19. package/dashboard/dist/assets/DialogDescription-CjJLpfCL.js +1 -0
  20. package/dashboard/dist/assets/{DialogTitle-DyvhHV1-.js → DialogTitle-DhB-tbnZ.js} +1 -1
  21. package/dashboard/dist/assets/{FadeIn-DaP6F4f8.js → FadeIn-B8eRWBdy.js} +1 -1
  22. package/dashboard/dist/assets/{HeaderGithubStar-CKB5puCd.js → HeaderGithubStar-DmWep8uP.js} +1 -1
  23. package/dashboard/dist/assets/{HoverTooltip-BG6k61dF.js → HoverTooltip-DDyTZli0.js} +1 -1
  24. package/dashboard/dist/assets/{IpCheckPage-Oqt1J9S2.js → IpCheckPage-CN8hYm4o.js} +1 -1
  25. package/dashboard/dist/assets/{LandingPage-45qoUn79.js → LandingPage-B3cHASqK.js} +2 -2
  26. package/dashboard/dist/assets/{LeaderboardAvatar-ZgXnaI_N.js → LeaderboardAvatar-CEcLXrJL.js} +1 -1
  27. package/dashboard/dist/assets/{LeaderboardPage-C7E_LrFk.js → LeaderboardPage-H6HW9hon.js} +2 -2
  28. package/dashboard/dist/assets/{LeaderboardProfileModal-D6PUcj3b.js → LeaderboardProfileModal-B_5PyjRA.js} +4 -4
  29. package/dashboard/dist/assets/{LeaderboardProfilePage-VcC9DK_B.js → LeaderboardProfilePage-DR9KWLWv.js} +3 -3
  30. package/dashboard/dist/assets/{LimitsPage-B9K0RFQD.js → LimitsPage-Da0hRxO_.js} +1 -1
  31. package/dashboard/dist/assets/{LocalOnlyNotice-BGsfKEM9.js → LocalOnlyNotice-DuTdva_n.js} +1 -1
  32. package/dashboard/dist/assets/LoginCard-DOL3osrj.js +1 -0
  33. package/dashboard/dist/assets/{LoginModal-N3pWGciC.js → LoginModal-DBmaQL2L.js} +1 -1
  34. package/dashboard/dist/assets/{LoginPage-TGgL0aXF.js → LoginPage-Dk08VrkC.js} +1 -1
  35. package/dashboard/dist/assets/{PetPage-DPi7OT_4.js → PetPage-BbCIdpzx.js} +1 -1
  36. package/dashboard/dist/assets/{PopoverPopup-BkptZaPd.js → PopoverPopup-C1fJZ4qt.js} +1 -1
  37. package/dashboard/dist/assets/ProviderIcon-FfLD-f73.js +1 -0
  38. package/dashboard/dist/assets/{ResetPasswordPage-DQ4qdjBD.js → ResetPasswordPage-Bg7eVc6L.js} +1 -1
  39. package/dashboard/dist/assets/{SegmentedControl-CuTrxHXS.js → SegmentedControl-CFNHcUz7.js} +1 -1
  40. package/dashboard/dist/assets/{Select-_Txi2j1D.js → Select-B0Q0eDcJ.js} +1 -1
  41. package/dashboard/dist/assets/{SelectItemText-DVKhj-YN.js → SelectItemText-BVbLYxSQ.js} +1 -1
  42. package/dashboard/dist/assets/{ServiceStatusPage-ChflNSK0.js → ServiceStatusPage-DCZH2kz5.js} +1 -1
  43. package/dashboard/dist/assets/{SessionsPage-CHv6xK2J.js → SessionsPage-DO5Et7ss.js} +2 -2
  44. package/dashboard/dist/assets/{SettingsPage-DkWAYALG.js → SettingsPage-afgxGfzT.js} +2 -2
  45. package/dashboard/dist/assets/{SkillsPage-DnTSlBl-.js → SkillsPage-DDKiHCF7.js} +1 -1
  46. package/dashboard/dist/assets/{TokenGalaxy-yAMCaU-k.js → TokenGalaxy-DV1Xoe5z.js} +1 -1
  47. package/dashboard/dist/assets/{ToolbarRootContext-BeDIqB0k.js → ToolbarRootContext-DNckd9Qz.js} +1 -1
  48. package/dashboard/dist/assets/TrendMonitor-CliMJxCC.js +19 -0
  49. package/dashboard/dist/assets/{WidgetsPage-y_qKZ9Gv.js → WidgetsPage-BrwG6YMM.js} +1 -1
  50. package/dashboard/dist/assets/{WrappedPage-BGUGI6vk.js → WrappedPage-Ft9YJd0D.js} +1 -1
  51. package/dashboard/dist/assets/{__vite-browser-external-CRvi_9hb.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-CjEesyJI.js → arrow-up-right-B_K57Vbg.js} +1 -1
  54. package/dashboard/dist/assets/{check-KDrH1gwE.js → check-xH63o2xJ.js} +1 -1
  55. package/dashboard/dist/assets/{chevron-right-DseqFm-D.js → chevron-right-D3F2rAfr.js} +1 -1
  56. package/dashboard/dist/assets/{copy-CFJ1QKAQ.js → copy-WPfJGGI0.js} +1 -1
  57. package/dashboard/dist/assets/{download-BQUNGUdh.js → download-BgtWtEXI.js} +1 -1
  58. package/dashboard/dist/assets/{external-link-BCEOLLH2.js → external-link-DSHGoZRM.js} +1 -1
  59. package/dashboard/dist/assets/{flame-BigtoGg2.js → flame-CNGl6Qac.js} +1 -1
  60. package/dashboard/dist/assets/{format-tokens-CS1GUpAV.js → format-tokens-jVm2UX7Y.js} +1 -1
  61. package/dashboard/dist/assets/{icons-DpZ1a8Ct.js → icons-B1JZg-Id.js} +1 -1
  62. package/dashboard/dist/assets/{index-DqkwD6eO.js → index-BTZibjLi.js} +1 -1
  63. package/dashboard/dist/assets/{index-lGAAw1Rv.js → index-BjD81Qce.js} +1 -1
  64. package/dashboard/dist/assets/{index-DFU_yVc5.js → index-CUFHknAy.js} +1 -1
  65. package/dashboard/dist/assets/{info-Br_jtGtO.js → info-CLM460KM.js} +1 -1
  66. package/dashboard/dist/assets/{limits-providers-CkqO1LMQ.js → limits-providers-CFO4O1qh.js} +1 -1
  67. package/dashboard/dist/assets/{link-2-D-nAhkk-.js → link-2-BHOsUnAI.js} +1 -1
  68. package/dashboard/dist/assets/{loader-circle-CuNPuDRR.js → loader-circle-CgcIQi92.js} +1 -1
  69. package/dashboard/dist/assets/{maximize-2-dlvwitfg.js → maximize-2-DvqfuJEA.js} +1 -1
  70. package/dashboard/dist/assets/{modifiers.esm-ORha_lPI.js → modifiers.esm-CNiwIkPh.js} +1 -1
  71. package/dashboard/dist/assets/module-CV1mYFsv.js +3 -0
  72. package/dashboard/dist/assets/{monitor-smartphone-CI2qvlMB.js → monitor-smartphone-BLutpxrG.js} +1 -1
  73. package/dashboard/dist/assets/provider-display-BxIgWUEa.js +42 -0
  74. package/dashboard/dist/assets/{react-Dy9iWvqT.js → react-CM-ozVnh.js} +1 -1
  75. package/dashboard/dist/assets/{search-Do7tzc3k.js → search-4T07INKt.js} +1 -1
  76. package/dashboard/dist/assets/{skills-api-CJ-8EFac.js → skills-api-EXMD3LD1.js} +1 -1
  77. package/dashboard/dist/assets/{sortable.esm-BKQg8NHC.js → sortable.esm-jC6mPJiL.js} +1 -1
  78. package/dashboard/dist/assets/{store-SUT-n3k3.js → store-CvSEdgf2.js} +1 -1
  79. package/dashboard/dist/assets/{terminal-BX4DOxd6.js → terminal-D9fyE2pP.js} +1 -1
  80. package/dashboard/dist/assets/{trash-2-VERlG247.js → trash-2-QLUsAY3l.js} +1 -1
  81. package/dashboard/dist/assets/{use-community-stats-BX6_XUdu.js → use-community-stats-Chrt3kpU.js} +1 -1
  82. package/dashboard/dist/assets/{use-limits-display-prefs-BpC3tYRw.js → use-limits-display-prefs-BJJd750e.js} +1 -1
  83. package/dashboard/dist/assets/{use-ordered-list-CX-LREPo.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-B1G8hzVM.js → use-session-efficiency-pref-BXbvx2Ht.js} +1 -1
  86. package/dashboard/dist/assets/{use-transform-DNCqLbUD.js → use-transform-BVp_MUsU.js} +1 -1
  87. package/dashboard/dist/assets/{use-usage-limits-Cvbvf30m.js → use-usage-limits-Dk3EkeIs.js} +1 -1
  88. package/dashboard/dist/assets/{useCurrency-EciQmJkm.js → useCurrency-Bi88Sd__.js} +1 -1
  89. package/dashboard/dist/assets/{useScrollLock-sLkmam8C.js → useScrollLock-if34g2H-.js} +1 -1
  90. package/dashboard/dist/assets/{useTokenFormat-nb9na-2-.js → useTokenFormat-C2cz-5qJ.js} +1 -1
  91. package/dashboard/dist/assets/{zap-BQOWCMov.js → zap-D1yHmcQR.js} +1 -1
  92. package/dashboard/dist/index.html +28 -24
  93. package/dashboard/dist/ip-check.html +1 -1
  94. package/dashboard/dist/leaderboard.html +1 -1
  95. package/dashboard/dist/llms.txt +4 -2
  96. package/dashboard/dist/share.html +1 -1
  97. package/package.json +2 -2
  98. package/src/commands/init.js +12 -1
  99. package/src/commands/status.js +59 -0
  100. package/src/commands/sync.js +220 -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 +38 -2
  105. package/src/lib/pricing/matcher.js +1 -0
  106. package/src/lib/pricing/seed-snapshot.json +1 -1
  107. package/src/lib/rollout.js +853 -14
  108. package/src/lib/source-metadata.js +1 -1
  109. package/src/lib/trae-cn-config.js +539 -0
  110. package/dashboard/dist/assets/DialogDescription-M_lg2jhD.js +0 -1
  111. package/dashboard/dist/assets/LoginCard-j5HVFRdP.js +0 -1
  112. package/dashboard/dist/assets/ProviderIcon-zaz4nwxI.js +0 -1
  113. package/dashboard/dist/assets/TrendMonitor-BthLuYwy.js +0 -19
  114. package/dashboard/dist/assets/agent-logos-DwHwn_cb.js +0 -1
  115. package/dashboard/dist/assets/module-BRJxSJmz.js +0 -3
  116. package/dashboard/dist/assets/provider-display-BNCdZ83n.js +0 -42
  117. package/dashboard/dist/assets/use-reduced-motion-DbebVWBw.js +0 -1
@@ -1,3 +0,0 @@
1
- var v=typeof window<"u"?window:void 0,ge=typeof globalThis<"u"?globalThis:v,me=ge?.navigator,S=ge?.document,ee=ge?.location,fs=ge?.fetch,Rr=ge!=null&&ge.XMLHttpRequest&&"withCredentials"in new ge.XMLHttpRequest?ge.XMLHttpRequest:void 0,Ls=ge?.AbortController,Co=ge?.CompressionStream,we=me?.userAgent;function Wn(){return!(!v||v.navigator.onLine===!1)}var Rt=typeof globalThis<"u"?globalThis:v;Rt&&typeof self>"u"&&(Rt.self=Rt),Rt&&typeof File>"u"&&(Rt.File=function(){});var I=v??{},U={DEBUG:!1,LIB_VERSION:"0.4.0",LIB_NAME:"browser-common"};function Ds(i,e,t,r,s,n,a){try{var o=i[n](a),l=o.value}catch(u){return void t(u)}o.done?e(l):Promise.resolve(l).then(r,s)}function Z(i){return function(){var e=this,t=arguments;return new Promise((function(r,s){var n=i.apply(e,t);function a(l){Ds(n,r,s,a,o,"next",l)}function o(l){Ds(n,r,s,a,o,"throw",l)}a(void 0)}))}}function b(){return b=Object.assign?Object.assign.bind():function(i){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},b.apply(null,arguments)}function Yn(i,e){if(i==null)return{};var t={};for(var r in i)if({}.hasOwnProperty.call(i,r)){if(e.indexOf(r)!==-1)continue;t[r]=i[r]}return t}var js=i=>{if(typeof i!="string")return i;try{return JSON.parse(i)}catch{return i}};function qs(i){return typeof i=="string"||i}function Bs(i){return typeof i=="string"?i:void 0}var Ct,Mo=["$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"],Be=(function(i){return i.AnonymousId="anonymous_id",i.DistinctId="distinct_id",i.Props="props",i.EnablePersonProcessing="enable_person_processing",i.PersonMode="person_mode",i.FeatureFlagDetails="feature_flag_details",i.FeatureFlags="feature_flags",i.FeatureFlagPayloads="feature_flag_payloads",i.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",i.BootstrapFeatureFlags="bootstrap_feature_flags",i.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",i.OverrideFeatureFlags="override_feature_flags",i.Queue="queue",i.AiQueue="ai_queue",i.LogsQueue="logs_queue",i.OptedOut="opted_out",i.SessionId="session_id",i.SessionStartTimestamp="session_start_timestamp",i.SessionLastTimestamp="session_timestamp",i.PersonProperties="person_properties",i.GroupProperties="group_properties",i.InstalledAppBuild="installed_app_build",i.InstalledAppVersion="installed_app_version",i.SessionReplay="session_replay",i.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})({}),Hs=(function(i){return i.GZipJS="gzip-js",i.Base64="base64",i})({}),Oo=["$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"],No=["token"],Kn="NativeGzipValidationError",Cr=i=>i.length>=2&&i[0]===31&&i[1]===139,Us=(i,e)=>i===Hs.GZipJS||e===Hs.GZipJS||e==="gzip",zs=i=>!(!i||typeof i!="object")&&("name"in i?String(i.name):"")==="NotReadableError",li=i=>{var e=new Error("Native gzip produced invalid output: "+i);throw e.name=Kn,e},Ao=(function(){var i=Z((function*(e,t){18>e.size&&li("too-short");var r=new Uint8Array(yield e.slice(0,10).arrayBuffer());Cr(r)&&r[2]===8||li("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(a=>{for(var o=(()=>{if(Ct)return Ct;Ct=[];for(var c=0;256>c;c++){for(var h=c,d=0;8>d;d++)h=1&h?3988292384^h>>>1:h>>>1;Ct[c]=h>>>0}return Ct})(),l=4294967295,u=0;a.length>u;u++)l=o[255&(l^a[u])]^l>>>8;return(4294967295^l)>>>0})(t)&&li("invalid-crc");var n=t.length>>>0;s.getUint32(4,!0)!==n&&li("invalid-size")}));return function(e,t){return i.apply(this,arguments)}})();function Mr(){return Mr=Z((function*(i,e,t){e===void 0&&(e=!0);try{var r=new TextEncoder().encode(i),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),a=n.write(r).then((()=>n.close())).catch((function(){var u=Z((function*(c){try{yield n.abort(c)}catch{}throw c}));return function(c){return u.apply(this,arguments)}})()),o=new Response(s.readable).blob(),l=(yield Promise.all([o,a]))[0];return yield Ao(l,r),l}catch(u){if(t!=null&&t.rethrow)throw u;return e&&console.error("Failed to gzip compress data",u),null}})),Mr.apply(this,arguments)}var Lo=["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"],Gs=function(i,e){if(e===void 0&&(e=[]),!i)return!1;var t=i.toLowerCase();return Lo.concat(e).some((r=>{var s=r.toLowerCase();return t.indexOf(s)!==-1}))};function M(i,e){return i.indexOf(e)!==-1}var Ji=function(i){return i.trim()},Or=function(i){return i.replace(/^\$/,"")};function Jn(i){var e,t=[];return(e=JSON.stringify(i,(function(r,s){if(typeof s=="bigint")return s.toString();if(typeof s!="function"&&typeof s!="symbol"){if(s instanceof Error)return{name:s.name,message:s.message,stack:s.stack};if(s&&typeof s=="object"){for(;t.length>0&&t[t.length-1]!==this;)t.pop();if(t.includes(s))return"[Circular]";t.push(s)}return s}})))!==null&&e!==void 0?e:"null"}var Zn=Object.prototype,Qn=Zn.hasOwnProperty,Zi=Zn.toString,O=Array.isArray||function(i){return Zi.call(i)==="[object Array]"},Ee=i=>typeof i=="function",K=i=>i===Object(i)&&!O(i),Ve=i=>{if(K(i)){for(var e in i)if(Qn.call(i,e))return!1;return!0}return!1},x=i=>i===void 0,j=i=>Zi.call(i)=="[object String]",Nr=i=>j(i)&&i.trim().length===0,ye=i=>i===null,A=i=>x(i)||ye(i),ue=i=>Zi.call(i)=="[object Number]"&&i==i,je=i=>ue(i)&&i>0,Me=i=>Zi.call(i)==="[object Boolean]",Do=i=>i instanceof FormData,jo=i=>M(Oo,i),qo=i=>M(No,i);function Xn(i){return i===null||typeof i!="object"}function Fi(i,e){return{}.toString.call(i)==="[object "+e+"]"}function _s(i){return typeof Event<"u"&&ea(i,Event)}function ea(i,e){try{return i instanceof e}catch{return!1}}var Bo=[!0,"true",1,"1","yes"],ir=i=>M(Bo,i),Ho=[!1,"false",0,"0","no"];function Ae(i,e,t,r,s){return e>t&&(r.warn("min cannot be greater than max."),e=t),ue(i)?i>t?(r.warn(" cannot be greater than max: "+t+". Using max value instead."),t):e>i?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):i:(r.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+s),Ae(s||t,e,t,r))}class Uo{constructor(e){this.tt={},this.et=e.et,this.it=Ae(e.bucketSize,0,100,e.rt),this.nt=Ae(e.refillRate,0,this.it,e.rt),this.st=Ae(e.refillInterval,0,864e5,e.rt)}ot(e,t){var r=Math.floor((t-e.lastAccess)/this.st);r>0&&(e.tokens=Math.min(e.tokens+r*this.nt,this.it),e.lastAccess=e.lastAccess+r*this.st)}consumeRateLimit(e){var t,r=Date.now(),s=String(e),n=this.tt[s];return n?this.ot(n,r):this.tt[s]=n={tokens:this.it,lastAccess:r},n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.et)==null||t.call(this,e)),n.tokens===0)}stop(){this.tt={}}}var Se="Mobile",Ti="iOS",We="Android",Et="Tablet",ta=We+" "+Et,ia="iPad",ra="Apple",sa=ra+" Watch",Vt="Safari",kt="BlackBerry",na="Samsung",aa=na+"Browser",oa=na+" Internet",ct="Chrome",zo=ct+" OS",la=ct+" "+Ti,ms="Internet Explorer",ua=ms+" "+Se,ys="Opera",Go=ys+" Mini",bs="Edge",ca="Microsoft "+bs,wt="Firefox",ha=wt+" "+Ti,Qt="Nintendo",Xt="PlayStation",xt="Xbox",da=We+" "+Se,pa=Se+" "+Vt,Bt="Windows",Ar=Bt+" Phone",Vs="Nokia",Lr="Ouya",va="Generic",Vo=va+" "+Se.toLowerCase(),ga=va+" "+Et.toLowerCase(),Dr="Konqueror",fa="Oculus Browser",$i="Vivaldi",_a="Yandex",Ii="Whale",jr="DuckDuckGo",ma="Pale Moon",Ri="Waterfox",Wt="Brave",ya="Google Search App",oe="(\\d+(\\.\\d+)?)",rr=new RegExp("Version/"+oe),Wo=new RegExp(xt,"i"),Yo=new RegExp(Xt+" \\w+","i"),Ko=new RegExp(Qt+" \\w+","i"),ws=new RegExp(kt+"|PlayBook|BB10","i"),Jo={"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"},ba=function(i,e,t,r){e=e||"";var s=(function(n){return n!=null&&n.brave?Wt:null})(t);return s||(r!=null&&r.detectGoogleSearchApp&&M(i,"GSA/")?ya:M(i," OPR/")&&M(i,"Mini")?Go:M(i," OPR/")?ys:ws.test(i)?kt:M(i,"IE"+Se)||M(i,"WPDesktop")?ua:M(i,"OculusBrowser")?fa:M(i,aa)?oa:M(i,bs)||M(i,"Edg/")?ca:M(i,$i+"/")?$i:M(i,"YaBrowser/")?_a:M(i,Ii+"/")?Ii:M(i,jr+"/")||M(i,"Ddg/")?jr:M(i,"FBIOS")?"Facebook "+Se:M(i,"UCWEB")||M(i,"UCBrowser")?"UC Browser":M(i,"CriOS")?la:M(i,"CrMo")||M(i,ct)?ct:M(i,We)&&M(i,Vt)?da:M(i,"FxiOS")?ha:M(i.toLowerCase(),Dr.toLowerCase())?Dr:M(i,Wt+"/")?Wt:((n,a)=>a&&M(a,ra)||(function(o){return M(o,Vt)&&!M(o,ct)&&!M(o,We)})(n))(i,e)?M(i,Se)?pa:Vt:M(i,"PaleMoon/")?ma:M(i,Ri+"/")?Ri:M(i,wt)?wt:M(i,"MSIE")||M(i,"Trident/")?ms:M(i,"Gecko")?wt:"")},Zo={[ua]:[new RegExp("rv:"+oe)],[ca]:[new RegExp(bs+"?\\/"+oe)],[ct]:[new RegExp("("+ct+"|CrMo)\\/"+oe)],[la]:[new RegExp("CriOS\\/"+oe)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+oe)],[Vt]:[rr],[pa]:[rr],[ys]:[new RegExp("(Opera|OPR)\\/"+oe)],[wt]:[new RegExp(wt+"\\/"+oe)],[ha]:[new RegExp("FxiOS\\/"+oe)],[Dr]:[new RegExp("Konqueror[:/]?"+oe,"i")],[kt]:[new RegExp(kt+" "+oe),rr],[da]:[new RegExp("android\\s"+oe,"i")],[oa]:[new RegExp(aa+"\\/"+oe)],[fa]:[new RegExp("OculusBrowser\\/"+oe)],[$i]:[new RegExp($i+"\\/"+oe)],[_a]:[new RegExp("YaBrowser\\/"+oe)],[Ii]:[new RegExp(Ii+"\\/"+oe)],[Wt]:[new RegExp(Wt+"\\/"+oe)],[jr]:[new RegExp("(DuckDuckGo|Ddg)\\/"+oe)],[ma]:[new RegExp("PaleMoon\\/"+oe)],[Ri]:[new RegExp(Ri+"\\/"+oe)],[ya]:[new RegExp("GSA\\/"+oe)],[ms]:[new RegExp("(rv:|MSIE )"+oe)],Mozilla:[new RegExp("rv:"+oe)]},Qo=function(i,e,t,r){var s=ba(i,e,t,r),n=Zo[s];if(x(n))return null;for(var a=0;n.length>a;a++){var o=i.match(n[a]);if(o)return parseFloat(o[o.length-2])}return null},Ws=[[new RegExp(xt+"; "+xt+" (.*?)[);]","i"),i=>[xt,i&&i[1]||""]],[new RegExp(Qt,"i"),[Qt,""]],[new RegExp(Xt,"i"),[Xt,""]],[ws,[kt,""]],[new RegExp(Bt,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Ar,""];if(new RegExp(Se).test(e)&&!/IEMobile\b/.test(e))return[Bt+" "+Se,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var r=Jo[t[1]]||"";return/arm/i.test(e)&&(r="RT"),[Bt,r]}return[Bt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>i&&i[3]?[Ti,[i[3],i[4],i[5]||"0"].join(".")]:[Ti,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=x(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+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/,[zo,""]],[/Linux|debian/i,["Linux",""]]],Ys=function(i){return Ko.test(i)?Qt:Yo.test(i)?Xt:Wo.test(i)?xt:new RegExp(Lr,"i").test(i)?Lr:new RegExp("("+Ar+"|WPDesktop)","i").test(i)?Ar:/iPad/.test(i)?ia:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?sa:ws.test(i)?kt:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(Vs,"i").test(i)?Vs:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?new RegExp(Se).test(i)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)||/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?We:ta:new RegExp("(pda|"+Se+")","i").test(i)?Vo:new RegExp(Et,"i").test(i)&&!new RegExp(Et+" pc","i").test(i)?ga:""},Xo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ks(i,e){return typeof(t=i)=="string"&&Xo.test(t)?i:e();var t}function Ze(i){return i&&i.split("#")[0]}function xs(i,e){var t=setTimeout(i,e);return t?.unref&&t?.unref(),t}function Js(i,e,t){return wa.apply(this,arguments)}function wa(){return(wa=Z((function*(i,e,t){var r;try{return yield Promise.race([i,new Promise(((s,n)=>{r=xs((()=>{try{t?.(),s()}catch(a){n(a)}}),e)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var el=i=>i instanceof Error,xa={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}},tl=xa.info;function Ea(i){if(Me(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(O(i))return{arrayValue:{values:i.map((e=>Ea(e)))}};try{return{stringValue:JSON.stringify(i)}}catch{return{stringValue:String(i)}}}function Ci(i){var e=[];for(var t in i){var r=i[t];ye(r)||x(r)||e.push({key:t,value:Ea(r)})}return e}function il(i,e){var t=xa[i.level||"info"]||tl,r=t.text,s=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),A(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),A(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=b({},a,i.attributes||{}),l={timeUnixNano:n,observedTimeUnixNano:n,severityNumber:s,severityText:r,body:{stringValue:i.body},attributes:Ci(o)};return i.trace_id&&(l.traceId=i.trace_id),i.span_id&&(l.spanId=i.span_id),x(i.trace_flags)||(l.flags=i.trace_flags),l}function ka(i,e,t){return b({},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 Sa(i,e,t,r){return{resourceLogs:[{resource:{attributes:Ci(e)},scopeLogs:[{scope:{name:t,version:r},logRecords:i}]}]}}let rl=class{constructor(i,e,t,r,s,n,a){var o;n===void 0&&(n=()=>Promise.resolve()),this._instance=i,this.Ne=e,this.rt=t,this.ut=r,this.ht=s,this.dt=n,this.vt=a,this.ct=null,this.ft=0,this.yt=0,this.bt=0,this._t=0,this.wt=!1,this.kt=e.maxBufferSize,this.xt=Math.max((o=e.maxQueueSize)!==null&&o!==void 0?o:e.maxBufferSize,e.maxBufferSize),this.St=e.flushIntervalMs,this.Ct=e.maxBatchRecordsPerPost,this.Mt=e.rateCapWindowMs,this.Tt=e.maxLogsPerInterval}reset(){this.Et(),this.ct=null,this.bt=0,this._t=0,this.wt=!1,this.ft=0,this.yt=0,this.Ct=this.Ne.maxBatchRecordsPerPost}onReconnect(){this.yt=0,this.It()}captureLog(i){if(!this._instance.isDisabled&&!this._instance.optedOut&&i!=null&&i.body){var e=this.Pt(i);if(e!==null)if(e.body){if(this.Rt()){var t={record:il(e,this.ut())};this.ht((()=>this.At(t)))}}else this.rt.info("Log was rejected in beforeSend function")}}Pt(i){var e=this.Ne.beforeSend;if(!e)return i;var t=O(e)?e:[e],r=i;for(var s of t)try{var n=s(r);if(!n)return this.rt.info("Log was rejected in beforeSend function"),null;r=n}catch(a){return this.rt.error("Error in beforeSend function for log:",a),null}return r}Rt(){if(this.Tt===void 0)return!0;var i=Date.now(),e=i-this.bt;return this.Mt>e&&e>=0||(this.bt=i,this._t=0,this.wt=!1),this.Tt>this._t?(this._t++,!0):(this.wt||(this.rt.warn("captureLog dropping logs: exceeded "+this.Tt+" logs per "+this.Mt+"ms"),this.wt=!0),!1)}flush(){var i=this;return Z((function*(){if(!i._instance.isDisabled)return i.ct||(i.ct=i.Ft().finally((()=>{i.ct=null}))),i.ct}))()}Ft(){var i=this;return Z((function*(){var e;i.Et();var t=(e=i._instance.getPersistedProperty(Be.LogsQueue))!==null&&e!==void 0?e:[];if(t.length!==0)for(var r=t.length,s=0;t.length>0&&r>s;){var n,a;i.ft=0;var o=Math.min(t.length,i.Ct),l=t.slice(0,o),u=Sa(l.map((h=>h.record)),i.Lt(),(n=i.vt)!==null&&n!==void 0?n:i._instance.getLibraryId(),i._instance.getLibraryVersion()),c=yield i._instance.Ot(u);if(c.kind==="too-large"&&l.length>1)i.Ct=Math.max(1,Math.floor(l.length/2)),i.rt.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+i.Ct);else if(c.kind==="retry-later"||(c.kind==="too-large"?i.rt.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):c.kind==="ok"&&i.Ne.maxBatchRecordsPerPost>i.Ct&&(i.Ct=Math.min(i.Ne.maxBatchRecordsPerPost,i.Ct+1)),yield i.Dt(l.length),t=(a=i._instance.getPersistedProperty(Be.LogsQueue))!==null&&a!==void 0?a:[],s+=l.length,c.kind==="fatal"))throw c.error}}))()}Dt(i){var e=this;return Z((function*(){var t,r=Math.max(0,i-e.ft),s=(t=e._instance.getPersistedProperty(Be.LogsQueue))!==null&&t!==void 0?t:[];e._instance.setPersistedProperty(Be.LogsQueue,s.slice(r)),yield e.dt()}))()}Lt(){return ka(this.Ne,this._instance.getLibraryId(),this._instance.getLibraryVersion())}At(i){var e;if(!this._instance.optedOut){var t=(e=this._instance.getPersistedProperty(Be.LogsQueue))!==null&&e!==void 0?e:[];this.xt>t.length||(t.shift(),this.ft++,this.rt.info("Logs queue is full, dropping oldest record.")),t.push(i),this._instance.setPersistedProperty(Be.LogsQueue,t),this.kt>t.length?this.$t():this.It()}}$t(i){i===void 0&&(i=this.St),this.Nt||(this.Nt=xs((()=>{this.Nt=void 0,this.It()}),i))}qt(){var i=Math.min(Math.max(0,this.yt-1),6);return this.St*Math.pow(2,i)}jt(){var i=this._instance.getPersistedProperty(Be.LogsQueue);return!!i&&i.length>0}shutdown(i){var e=this;return Z((function*(){e.Et();var t=e.flush().catch((()=>{}));i!==void 0?yield Js(t,i):yield t}))()}flushWithTimeout(i){var e=this;return Z((function*(){var t=e.flush();yield Js(t,i,(()=>{t.catch((()=>{}))}))}))()}It(){this.flush().then((()=>{this.yt=0}),(i=>{this.yt++,this.rt.error("PostHog logs flush failed:",i)})).finally((()=>{!this._instance.isDisabled&&this.jt()&&this.$t(this.qt())}))}Et(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}};var sr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Zs(i){return String(i)+"000000"}function Qs(i,e,t,r){var s="";return r&&(s=Object.keys(r).sort().map((n=>JSON.stringify(n)+":"+JSON.stringify(r[n]))).join(",")),i+"\0"+e+"\0"+(t??"")+"\0"+s}let sl=class{constructor(i,e,t){this._instance=i,this.Ne=e,this.rt=t,this.Bt=new Map,this.ct=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Wt=0}count(i,e,t){e===void 0&&(e=1),this.Vt({name:i,type:"count",value:e,unit:t?.unit,attributes:t?.attributes})}gauge(i,e,t){this.Vt({name:i,type:"gauge",value:e,unit:t?.unit,attributes:t?.attributes})}histogram(i,e,t){this.Vt({name:i,type:"histogram",value:e,unit:t?.unit,attributes:t?.attributes})}flush(){var i=this,e=this.ct,t=(function(){var s=Z((function*(){e&&(yield e.catch((()=>{}))),yield i.Zt()}));return function(){return s.apply(this,arguments)}})(),r=t().finally((()=>{this.ct===r&&(this.ct=null)}));return this.ct=r,r}drainWindow(){if(this.Bt.size===0)return null;var i=this.Bt;return this.Bt=new Map,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Gt(i)}reset(){this.Wt++,this.Et(),this.Bt=new Map,this.ct=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set}Vt(i){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.Pt(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.rt.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var t,r;try{t=e.attributes?b({},e.attributes):void 0,r=Qs(e.type,e.name,e.unit,t)}catch(a){return void this.rt.warn("Dropping metric '"+e.name+"': attributes could not be serialized",a)}var s=this.Bt.get(r);if(!s){if(!this.Qt())return;s={name:e.name,type:e.type,unit:e.unit,attributes:t,windowStartMs:Date.now()},this.Bt.set(r,s)}var n=this.Ut.get(e.name);n===void 0?this.Ut.set(e.name,e.type):n===e.type||this.zt.has(e.name)||(this.zt.add(e.name),this.rt.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.Kt(s,e.value),this.$t()}else this.rt.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.rt.warn("Dropping metric with empty name")}}Qt(){return this.Ne.maxSeriesPerFlush>this.Bt.size||(this.Ht||(this.Ht=!0,this.rt.warn("Metric series cap reached ("+this.Ne.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Kt(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(sr.length+1).fill(0)});var r=i.hist;r.count+=1,r.sum+=e,r.min=Math.min(r.min,e),r.max=Math.max(r.max,e),r.bucketCounts[(function(s,n){for(var a=0;n.length>a;a++)if(n[a]>=s)return a;return n.length})(e,sr)]+=1}}Pt(i){var e=this.Ne.beforeSend;if(!e)return i;var t=O(e)?e:[e],r=i;for(var s of t)try{var n=s(r);if(!n)return this.rt.info("Metric was rejected in beforeSend function"),null;r=n}catch(a){return this.rt.error("Error in beforeSend function for metric:",a),null}return r}$t(){this.Nt||(this.Nt=xs((()=>{this.Nt=void 0,this.flush().catch((i=>{this.rt.error("Metrics flush failed:",i)}))}),this.Ne.flushIntervalMs))}Et(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}Zt(){var i=this;return Z((function*(){if(i.Bt.size!==0){var e=i.Bt;i.Bt=new Map,i.Ht=!1,i.Ut=new Map,i.zt=new Set;var t=i.Wt,r=yield i._instance.Jt(i.Gt(e));if(t===i.Wt)switch(r.kind){case"ok":return;case"retry-later":return i.Yt(e),void i.$t();case"too-large":return void i.rt.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void i.rt.error("Failed to send metrics batch:",r.error)}}}))()}Gt(i){return e=this.Xt(i),t=(function(n,a,o){return b({},n.resourceAttributes,{"service.name":n.serviceName||"unknown_service"},n.environment&&{"deployment.environment":n.environment},n.serviceVersion&&{"service.version":n.serviceVersion},{"telemetry.sdk.name":a,"telemetry.sdk.version":o})})(this.Ne,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Ci(t)},scopeMetrics:[{scope:{name:r,version:s},metrics:e}]}]};var e,t,r,s}Xt(i){var e=Zs(Date.now()),t=new Map;for(var r of i.values()){var s,n=Qs(r.type,r.name,r.unit,void 0),a=t.get(n);a||(a=b({name:r.name},r.unit&&{unit:r.unit}),r.type==="count"?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type==="gauge"?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},t.set(n,a));var o=Ci((s=r.attributes)!==null&&s!==void 0?s:{}),l=Zs(r.windowStartMs);if(r.type==="count"){var u,c={attributes:o,startTimeUnixNano:l,timeUnixNano:e,asDouble:(u=r.total)!==null&&u!==void 0?u:0};a.sum.dataPoints.push(c)}else if(r.type==="gauge"){var h,d={attributes:o,timeUnixNano:e,asDouble:(h=r.last)!==null&&h!==void 0?h:0};a.gauge.dataPoints.push(d)}else r.hist&&a.histogram.dataPoints.push({attributes:o,startTimeUnixNano:l,timeUnixNano:e,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:sr})}return Array.from(t.values())}Yt(i){var e,t;for(var r of i){var s=r[0],n=r[1],a=this.Bt.get(s);if(a)switch(a.windowStartMs=Math.min(a.windowStartMs,n.windowStartMs),a.type){case"count":a.total=((e=a.total)!==null&&e!==void 0?e:0)+((t=n.total)!==null&&t!==void 0?t:0);break;case"gauge":break;case"histogram":if(n.hist)if(a.hist){a.hist.count+=n.hist.count,a.hist.sum+=n.hist.sum,a.hist.min=Math.min(a.hist.min,n.hist.min),a.hist.max=Math.max(a.hist.max,n.hist.max);for(var o=0;a.hist.bucketCounts.length>o;o++)a.hist.bucketCounts[o]+=n.hist.bucketCounts[o]}else a.hist=n.hist}else this.Qt()&&this.Bt.set(s,n)}}};var ui,Xs,nr;function nl(i){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return nr&&t.length===Xs||(Xs=t.length,nr=t.reduce(((r,s)=>{ui||(ui={});var n=ui[s];if(n)r[n[0]]=n[1];else for(var a=i(s),o=a.length-1;o>=0;o--){var l=a[o],u=l?.filename,c=e[s];if(u&&c){r[u]=c,ui[s]=[u,c];break}}return r}),{})),nr}}class al{constructor(e,t,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t){t===void 0&&(t={});var r=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(r,t,0).apply(e),n=this.buildParsingContext(t),a=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(a,r),$exception_level:"error"}}modifyFrames(e){var t=this;return Z((function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&O(r.stacktrace.frames)&&(r.stacktrace.frames=yield t.applyModifiers(r.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 r,s;return e.cause!=null&&(r=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),b({},e,{cause:r,stack:s})}applyChunkIds(e,t){return e.map((r=>(r.filename&&t&&(r.chunk_id=t[r.filename]),r)))}applyCoercers(e,t){for(var r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Z((function*(){var r=e;for(var s of t.modifiers)r=yield s(r);return r}))()}convertToExceptionList(e,t){var r,s,n,a={type:e.type,value:e.value,mechanism:{type:(r=t.type)!==null&&r!==void 0?r:"generic",handled:(s=t.handled)===null||s===void 0||s,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var o=[a];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,b({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:nl(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,r){r===void 0&&(r=0);var s=(n,a)=>{if(4>=a){var o=this.buildCoercingContext(e,t,a);return this.applyCoercers(n,o)}};return b({},t,{syntheticException:r==0?t.syntheticException:void 0,mechanism:e,apply:n=>s(n,r),next:n=>s(n,r+1)})}}var St="?";function qr(i,e,t,r,s){var n={platform:i,filename:e,function:t==="<anonymous>"?St:t,in_app:!0};return x(r)||(n.lineno=r),x(s)||(n.colno=s),n}var Pa=(i,e)=>{var t=i.indexOf("safari-extension")!==-1,r=i.indexOf("safari-web-extension")!==-1;return t||r?[i.indexOf("@")!==-1?i.split("@")[0]:St,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},ol=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ll=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ul=/\((\S*)(?::(\d+))(?::(\d+))\)/,cl=(i,e)=>{var t=ol.exec(i);if(t)return qr(e,t[1],St,+t[2],+t[3]);var r=ll.exec(i);if(r){if(r[2]&&r[2].indexOf("eval")===0){var s=ul.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=Pa(r[1]||St,r[2]);return qr(e,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},hl=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,dl=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,pl=(i,e)=>{var t=hl.exec(i);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var r=dl.exec(t[3]);r&&(t[1]=t[1]||"eval",t[3]=r[1],t[4]=r[2],t[5]="")}var s=t[3],n=t[1]||St,a=Pa(n,s);return qr(e,s=a[1],n=a[0],t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},en=/\(error: (.*)\)/;class vl{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=j(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?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 Fi(e,"DOMException")}isDOMError(e){return Fi(e,"DOMError")}}class gl{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 ea(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 r=e.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class fl{constructor(){}match(e){return!!Fi(e,"ErrorEvent")&&(e.error!=null||this.fe(e))}coerce(e,t){var r;if(e.error!=null)return t.apply(e.error);var s=t.apply(e.message);return b({},s,{stack:(r=this.pe(e))!==null&&r!==void 0?r:s.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 r,s,n=(r=t.lineno)!==null&&r!==void 0?r:0,a=(s=t.colno)!==null&&s!==void 0?s:0;return`Error
2
- at `+t.filename+":"+n+":"+a}}}var _l=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class ml{match(e){return typeof e=="string"}coerce(e,t){var r,s=this.getInfos(e),n=s[0],a=s[1];return{type:n??"Error",value:a??e,stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,s=e.match(_l);return s&&(t=s[1],r=s[2]),[t,r]}}var yl=["fatal","error","warning","log","info","debug"];function Fa(i,e){e===void 0&&(e=40);var t=Object.keys(i);if(t.sort(),!t.length)return"[object has no keys]";for(var r=t.length;r>0;r--){var s=t.slice(0,r).join(", ");if(e>=s.length)return r===t.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class bl{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var r,s,n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:(r=this.getStack(e))!==null&&r!==void 0?r:(s=t.syntheticException)==null?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return _s(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 r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+Fa(e)}isSeverityLevel(e){return j(e)&&!Nr(e)&&yl.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 r=e[t];if(el(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}}class wl{match(e){return _s(e)}coerce(e,t){var r,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+Fa(e),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class xl{match(e){return Xn(e)}coerce(e,t){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class El{match(e){return Fi(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!_s(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var r,s=this.getUnhandledRejectionReason(e);return Xn(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var Mi="$message",Oi="$timestamp",kl=new Set([Mi,Oi]),ar={enabled:!0,max_bytes:32768};function Ni(i){var e;return i?{enabled:(e=i.enabled)!==null&&e!==void 0?e:ar.enabled,max_bytes:Pl(i.max_bytes,ar.max_bytes)}:b({},ar)}class Sl{constructor(e){this.Ke=[],this.Je=0,this.Ne=Ni(e)}setConfig(e){this.Ne=Ni(e),this.Xe()}add(e){var t=(function(s){var n;try{n=Jn(s)}catch{return}try{var a=JSON.parse(n);if(!K(a))return;var o=a,l=o[Mi],u=o[Oi];return!j(l)||l.trim().length===0||!j(u)&&!ue(u)?void 0:{step:o,json:n}}catch{return}})(e);if(t){var r=(function(s){if(typeof TextEncoder<"u")return new TextEncoder().encode(s).length;for(var n=encodeURIComponent(s),a=0,o=0;n.length>o;o++)n[o]==="%"?(a+=1,o+=2):a+=1;return a})(t.json);r>this.Ne.max_bytes||(this.Ke.push({step:t.step,bytes:r}),this.Je+=r,this.Xe())}}getAttachable(){return this.Ke.map((e=>e.step))}clear(){this.Ke=[],this.Je=0}size(){return this.Ke.length}Xe(){for(;this.Je>this.Ne.max_bytes&&this.Ke.length>0;){var e=this.Ke.shift();e&&(this.Je-=e.bytes)}}}function Pl(i,e){if(!ue(i)||i===1/0||i===-1/0)return e;var t=Math.floor(i);return 0>t?e:t}var Ta=function(i,e){var t=(e===void 0?{}:e).debugEnabled,r={k(s){if(v&&(U.DEBUG||v.POSTHOG_DEBUG||t)&&!x(v.console)&&v.console){for(var n=("__rrweb_original__"in v.console[s])?v.console[s].__rrweb_original__:v.console[s],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 s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];r.k("debug",...n)},info(){for(var s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];r.k("log",...n)},warn(){for(var s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];r.k("warn",...n)},error(){for(var s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];r.k("error",...n)},critical(){for(var s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];console.error(i,...n)},uninitializedWarning(s){r.error("You must initialize PostHog before calling "+s)},createLogger:(s,n)=>Ta(i+" "+s,n)};return r},E=Ta("[PostHog.js]"),re=E.createLogger,Fl=re("[ExternalScriptsLoader]"),or=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return Fl.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var r=S?.querySelectorAll("script");if(r){for(var s,n=function(){if(r[a].src===e){var l=r[a];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(u=>{l.__posthog_loading_callback_fired=!0,t(void 0,u)})),l.onerror=u=>t(u),{v:void 0})}},a=0;r.length>a;a++)if(s=n())return s.v}var o=()=>{if(!S)return t("document not found");var l=S.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=h=>{l.__posthog_loading_callback_fired=!0,t(void 0,h)},l.onerror=h=>t(h),i.config.prepare_external_dependency_script&&(l=i.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(i.config.external_scripts_inject_target==="head")S.head.appendChild(l);else{var u,c=S.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)==null||u.insertBefore(l,c[0]):S.body.appendChild(l)}};S!=null&&S.body?o():S?.addEventListener("DOMContentLoaded",o)};I.__PosthogExtensions__=I.__PosthogExtensions__||{},I.__PosthogExtensions__.loadExternalDependency=(i,e,t)=>{if(e!=="remote-config"){var r;if(i.config.strict_script_versioning)r=i.requestRouter.endpointFor("assets","/static/"+i.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+i.version;if(e==="toolbar"){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=i.requestRouter.endpointFor("assets",s)}or(i,r,t)}else{var a=i.requestRouter.endpointFor("assets","/array/"+i.config.token+"/config.js");or(i,a,t)}},I.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var r=i.requestRouter.endpointFor("api",e);or(i,r,t)};U.DEBUG=!1,U.LIB_VERSION="1.414.0",U.LIB_NAME="web";var $a="$people_distinct_id",ei="$device_id",lr="$device_model",Ht="__alias",Ut="__timers",Br="$autocapture_disabled_server_side",Hr="$heatmaps_enabled_server_side",Ur="$exception_capture_enabled_server_side",zr="$error_tracking_suppression_rules",Gr="$error_tracking_capture_extension_exceptions",Vr="$web_vitals_enabled_server_side",Es="$dead_clicks_enabled_server_side",ks="$product_tours_enabled_server_side",Wr="$web_vitals_allowed_metrics",ut="$session_recording_remote_config",Ia="$replay_sample_rate",Ra="$replay_override_sampling",Ca="$replay_override_linked_flag",Ma="$replay_override_url_trigger",Oa="$replay_override_event_trigger",yt="$sesid",Ss="$session_is_sampled",lt="$enabled_feature_flags",bi="$active_feature_flags",zt="$early_access_features",Yr="$feature_flag_details",wi="$feature_flag_payloads",Kr="$feature_flag_request_id",Ai="$minimal_flag_called_events",qe="$override_feature_flags",ft="$override_feature_flag_payloads",nt="$stored_person_properties",at="$stored_group_properties",Jr="$surveys",Li="$surveys_loaded_at",Zr="$surveys_activated",xi="$surveys_activated_session",Ei="$surveys_activated_timestamps",Gt="ph_product_tours",Yt="$flag_call_reported",Qr="$flag_call_reported_session_id",Xr="$feature_flag_errors",ti="$feature_flag_evaluated_at",Te="$user_state",es="$client_session_props",ts="$capture_rate_limit",is="$initial_campaign_params",rs="$initial_referrer_info",Di="$initial_person_info",ji="$epp",ci="$posthog_cookieless",Na="$cookieless_mode",Aa="$sdk_debug_extensions_init_method",La="$sdk_debug_extensions_init_time_ms",Da="$sdk_debug_recording_script_not_loaded",Ps="PostHog loadExternalDependency extension not found.",ot="on_reject",Ue="always",dt="anonymous",Xe="identified",ss="identified_only",qi="visibilitychange",Bi="beforeunload",_t="$pageview",ur="$pageleave",cr="$identify",tn="$groupidentify";function hi(i,e){O(i)&&i.forEach(e)}function G(i,e){if(!A(i))if(O(i))i.forEach(e);else if(Do(i))i.forEach(((r,s)=>e(r,s)));else for(var t in i)Qn.call(i,t)&&e(i[t],t)}var Y=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;e>r;r++)t[r-1]=arguments[r];for(var s of t)for(var n in s)s[n]!==void 0&&(i[n]=s[n]);return i};function ki(i){for(var e=Object.keys(i),t=e.length,r=new Array(t);t--;)r[t]=[e[t],i[e[t]]];return r}var rn=function(i){try{return i()}catch{return}},Tl=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return i.apply(this,t)}catch(s){E.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),E.critical(s)}}},Fs=function(i){var e={};return G(i,(function(t,r){(j(t)&&t.length>0||ue(t))&&(e[r]=t)})),e},$l=["herokuapp.com","vercel.app","netlify.app"];function Il(i){var e=i?.hostname;if(!j(e))return!1;var t=e.split(".").slice(-2).join(".");for(var r of $l)if(t===r)return!1;return!0}function te(i,e,t,r){var s=r??{},n=s.capture,a=s.passive;i?.addEventListener(e,t,{capture:n!==void 0&&n,passive:a===void 0||a})}function ns(i){return i.name==="ph_toolbar_internal"}var ja=i=>{if(S){try{for(var e=i+"=",t=S.cookie.split(";").filter((n=>n.length)),r=0;t.length>r;r++){for(var s=t[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.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 ue(i)&&isFinite(i)&&Math.floor(i)===i});class Hi{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(s)||0>e||0>t||0>r||0>s||e>0xffffffffffff||t>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/256,n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new Hi(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 Hi(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;16>t;t++){var r=this.bytes[t]-e.bytes[t];if(r!==0)return Math.sign(r)}return 0}}class Rl{generate(){var e=this.generateOrAbort();if(!x(e))return e;this.S=0;var t=this.generateOrAbort();if(x(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.C();else{if(this.S>=e+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return Hi.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 Cl}}var sn,qa=i=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;i.length>e;e++)i[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return i};v&&!x(v.crypto)&&crypto.getRandomValues&&(qa=i=>crypto.getRandomValues(i));class Cl{nextUint32(){return this.R.length>this.O||(qa(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var He=()=>Ml().toString(),Ml=()=>(sn||(sn=new Rl)).generate(),Mt="",Ol=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ze={N:()=>!!S,j(i){E.error("cookieStore error: "+i)},P:ja,H(i){var e;try{e=JSON.parse(ze.P(i))||{}}catch{}return e},F(i,e,t,r,s){if(!S)return!1;try{var n="",a="",o=(function(c,h){if(h){var d=(function(g,f){if(f===void 0&&(f=S),Mt)return Mt;if(!f||["localhost","127.0.0.1"].includes(g))return"";for(var m=g.split("."),_=Math.min(m.length,8),k="dmn_chk_"+He();!Mt&&_--;){var y=m.slice(_).join("."),P=k+"=1;domain=."+y+";path=/";f.cookie=P+";max-age=3",f.cookie.includes(k)&&(f.cookie=P+";max-age=0",Mt=y)}return Mt})(c);if(!d){var p=(g=>{var f=g.match(Ol);return f?f[0]:""})(c);p!==d&&E.info("Warning: cookie subdomain discovery mismatch",p,d),d=p}return d?"; domain=."+d:""}return""})(S.location.hostname,r);if(t){var l=new Date;l.setTime(l.getTime()+864e5*t),n="; expires="+l.toUTCString()}s&&(a="; secure");var u=i+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&E.warn("cookieStore warning: large cookie, len="+u.length),S.cookie=u,!0}catch{return!1}},q(i,e){if(S!=null&&S.cookie)try{ze.F(i,"",-1,e)}catch{return}}},hr=null,W={N(){if(!ye(hr))return hr;var i=!0;if(x(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||E.error("localStorage unsupported; falling back to cookie store"),hr=i,i},j(i){E.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)}}},Nl=[ei,"distinct_id",yt,Ss,ji,Di,Te],di={},Al={N:()=>!0,j(i){E.error("memoryStorage error: "+i)},P:i=>di[i]||null,H:i=>di[i]||null,F:(i,e)=>(di[i]=e,!0),q(i){delete di[i]}},et=null,le={N(){if(!ye(et))return et;if(et=!0,x(v))et=!1;else try{var i="__support__";le.F(i,"xyz"),le.P(i)!=='"xyz"'&&(et=!1),le.q(i)}catch{et=!1}return et},j(i){E.error("sessionStorage error: ",i)},P(i){try{return v?.sessionStorage.getItem(i)}catch(e){le.j(e)}return null},H(i){try{return JSON.parse(le.P(i))||null}catch{}return null},F(i,e){try{return v?.sessionStorage.setItem(i,JSON.stringify(e)),!0}catch(t){le.j(t)}return!1},q(i){try{v?.sessionStorage.removeItem(i)}catch(e){le.j(e)}}};class Ll{constructor(e){this._instance=e}get Ne(){return this._instance.config}get consent(){return this.ti()?0:this.ei}isOptedOut(){return this.Ne.cookieless_mode===Ue||this.isRejected()||this.consent===-1&&this.Ne.cookieless_mode===ot}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Ne.opt_out_capturing_by_default}optInOut(e){this.ii.F(this.ri,e?1:0,this.Ne.cookie_expiration,this.Ne.cross_subdomain_cookie,this.Ne.secure_cookie)}reset(){this.ii.q(this.ri,this.Ne.cross_subdomain_cookie)}get ri(){var e=this._instance.config,t=e.token,r=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(r?r+t:"__ph_opt_in_out_"+t)}get ei(){var e=this.ii.P(this.ri);return ir(e)?1:M(Ho,e)?0:-1}get ii(){var e=this.Ne.opt_out_capturing_persistence_type,t=e==="localStorage"?W:ze;if(!this.ni||this.ni!==t){this.ni=t;var r=e==="localStorage"?ze:W;r.P(this.ri)&&(this.ni.P(this.ri)||this.optInOut(ir(r.P(this.ri))),r.q(this.ri,this.Ne.cross_subdomain_cookie))}return this.ni}ti(){return!!this.Ne.respect_dnt&&[me?.doNotTrack,me?.msDoNotTrack,I.doNotTrack].some((e=>ir(e)))}}function Ba(i,e){var t,r=i==null||(t=i.config)==null?void 0:t.get_current_url;if(!Ee(r))return e;try{var s=r(e);return j(s)&&s?s:e}catch(n){return E.error("Error in get_current_url, falling back to window.location.href",n),e}}var Ha="__POSTHOG_TOOLBAR__",Dl=1,jl=3,ql=11;function nn(i){return i instanceof Element&&(i.id===Ha||!(i.closest==null||!i.closest(".toolbar-global-fade-container")))}function Qe(i){return!!i&&i.nodeType===Dl}function ke(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function Ua(i){return!!i&&i.nodeType===jl}function za(i){return!!i&&i.nodeType===ql&&Qe(i.host)}var Ga=1e3;function Ts(i){return i?Ji(i).split(/\s+/):[]}function an(i,e){var t=(function(r){var s,n=v==null||(s=v.location)==null?void 0:s.href;return x(n)?void 0:Ba(r,n)})(e);return!!(t&&i&&i.some((r=>t.match(r))))}function Ui(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 Ts(e)}function Va(i){return A(i)?null:Ji(i).split(/(\s+)/).filter((e=>Kt(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ii(i){var e="";return os(i)&&!Ja(i)&&i.childNodes&&i.childNodes.length&&G(i.childNodes,(function(t){var r;Ua(t)&&t.textContent&&(e+=(r=Va(t.textContent))!==null&&r!==void 0?r:"")})),Ji(e)}function dr(i){var e;return x(i.target)?i.srcElement||null:(e=i.target)!=null&&e.shadowRoot?i.composedPath()[0]||null:i.target||null}var $s=["a","button","form","input","select","textarea","label"];function as(i,e){if(x(e))return!0;var t,r=function(n){if(e.some((a=>(function(o,l){var u=o.matches||o.matchesSelector||o.msMatchesSelector||o.mozMatchesSelector||o.webkitMatchesSelector||o.oMatchesSelector;try{return!!u&&u.call(o,l)}catch{return!1}})(n,a))))return{v:!0}};for(var s of i)if(t=r(s))return t.v;return!1}function Wa(i){var e=i.parentNode;return!(!e||!Qe(e))&&e}var Bl=[".ph-no-autocapture","[data-ph-no-autocapture]"],Ya=["next","previous","prev",">","<"],Hl=[...Ya,"+","-","−","–"],on=(i,e)=>/[a-z0-9]/i.test(e)?i.includes(e):i===e,ln=[".ph-no-rageclick",".ph-no-capture"],Ul=["","text","search","email","password","url","tel","number"];function un(i,e){if(!v||Is(i))return!1;var t,r,s,n,a;if(Me(e)?(t=!!e&&ln,r=void 0,s=!1):(t=(n=e?.css_selector_ignorelist)!==null&&n!==void 0?n:ln,r=e?.content_ignorelist,s=(a=e?.ignore_text_selection)!==null&&a!==void 0&&a),t===!1||s&&(function(l){return!(!l||!Qe(l))&&(!!ke(l,"textarea")||(ke(l,"input")?M(Ul,(l.getAttribute("type")||"").toLowerCase()):(function(u){if(u.isContentEditable)return!0;var c=u.getAttribute==null?void 0:u.getAttribute("contenteditable");return c==="true"||c===""})(l)))})(i))return!1;var o=Ka(i,!1).targetElementList;return!(function(l,u){if(l===!1||x(l))return!1;var c;if(l===!0)c=Ya;else{if(!O(l))return!1;if(l.length>10)return E.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;c=l.map((h=>h.toLowerCase()))}return u.some((h=>{var d=h.safeText,p=h.ariaLabel;return c.some((g=>on(d,g)||on(p,g)))}))})(r,o.map((l=>{var u;return{safeText:ii(l).toLowerCase(),ariaLabel:((u=l.getAttribute("aria-label"))==null?void 0:u.toLowerCase().trim())||""}})))&&!as(o,t)}var Is=i=>!i||ke(i,"html")||!Qe(i),Ka=(i,e)=>{if(!v||Is(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,r=[i],s=i;s.parentNode&&!ke(s,"body");)if(za(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Wa(s);if(!n)break;if(e||$s.indexOf(n.tagName.toLowerCase())>-1)t=!0;else try{var a=v.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(t=!0)}catch{}r.push(n),s=n}return{parentIsUsefulElement:t,targetElementList:r}};function os(i){for(var e=new Set,t=0,r=i;r.parentNode&&!ke(r,"body");r=r.parentNode){if(t++>=Ga||e.has(r))return!1;e.add(r);var s=Ui(r);if(M(s,"ph-sensitive")||M(s,"ph-no-capture"))return!1}if(M(Ui(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 Ja(i){return!!(ke(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||ke(i,"select")||ke(i,"textarea")||i.getAttribute("contenteditable")==="true")}var cn=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}))$"),hn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,zl=[16,15,14,13],Gl=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),dn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),pn=/[0-9A-Za-z_]/;function Vl(i){for(var e=0,t=!1,r=i.length-1;r>=0;r--){var s=i.charCodeAt(r)-48;t&&(s*=2)>9&&(s-=9),e+=s,t=!t}return e%10==0}function Kt(i,e){if(e===void 0&&(e=!0),A(i))return!1;if(j(i)){i=Ji(i);var t=e?cn.test((i||"").replace(/[- ]/g,"")):(function(s){var n;for(hn.lastIndex=0;n=hn.exec(s);){var a=n[2];if(a)for(var o=a.replace(/[- ]/g,""),l=0;o.length>l;l++)for(var u of zl){var c=l+u;if(o.length>=c){var h=o.slice(l,c);if(cn.test(h)&&Vl(h))return!0}}}return!1})(i);if(t)return!1;var r=e?Gl.test(i):(function(s){var n;for(dn.lastIndex=0;n=dn.exec(s);){var a=n[1],o=n[3];if(!(a&&o&&pn.test(a)&&pn.test(o)))return!0}return!1})(i);if(r)return!1}return!0}function vn(i){var e=ii(i);return Kt(e=(e+" "+Za(i)).trim())?e:""}function Za(i){var e="";return i&&i.childNodes&&i.childNodes.length&&G(i.childNodes,(function(t){var r;if(t&&((r=t.tagName)==null?void 0:r.toLowerCase())==="span")try{var s=ii(t);e=(e+" "+s).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Za(t)).trim())}catch(n){E.error("[AutoCapture]",n)}})),e}function gn(i){return i.replace(/"|\\"/g,'\\"')}function Wl(i){var e=i.attr__class;if(e)return O(e)?e:Ts(e)}var pi=re("[Dead Clicks]"),Yl=()=>!0,Kl=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(Es)),r=i.instance.config.capture_dead_clicks;return Me(r)?r:!!K(r)||t};class fn{get lazyLoadedDeadClicksAutocapture(){return this.si}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Es]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.ai((()=>{this.oi()})):this.stop()}ai(e){var t,r;(t=I.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture?e():(r=I.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(s=>{s?pi.error("failed to load script",s):e()}))}oi(){var e;if(S){if(!this.si&&(e=I.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=K(this.instance.config.capture_dead_clicks)?b({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.si=I.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.si.start(S),pi.info("starting...")}}else pi.error("`document` not found. Cannot start.")}stop(){this.si&&(this.si.stop(),this.si=void 0,pi.info("stopping..."))}}var pr=re("[SegmentIntegration]"),Qa="posthog-js";function Xa(i,e){var t=e===void 0?{}:e,r=t.organization,s=t.projectId,n=t.prefix,a=t.severityAllowList,o=a===void 0?["error"]:a,l=t.sendExceptionsToPostHog,u=l===void 0||l;return c=>{var h,d,p,g,f;if(o!=="*"&&!o.includes(c.level)||!i.__loaded)return c;c.tags||(c.tags={});var m=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/person/"+i.get_distinct_id());c.tags["PostHog Person URL"]=m,i.sessionRecordingStarted()&&(c.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var _,k=((h=c.exception)==null?void 0:h.values)||[],y=k.map((F=>b({},F,{stacktrace:F.stacktrace?b({},F.stacktrace,{type:"raw",frames:(F.stacktrace.frames||[]).map((C=>b({},C,{platform:"web:javascript"})))}):void 0}))),P={$exception_message:((d=k[0])==null?void 0:d.value)||c.message,$exception_type:(p=k[0])==null?void 0:p.type,$exception_level:c.level,$exception_list:y,$sentry_event_id:c.event_id,$sentry_exception:c.exception,$sentry_exception_message:((g=k[0])==null?void 0:g.value)||c.message,$sentry_exception_type:(f=k[0])==null?void 0:f.type,$sentry_tags:c.tags};return r&&s&&(P.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+c.event_id),u&&((_=i.exceptions)==null||_.sendExceptionEvent(P)),c}}class Jl{constructor(e,t,r,s,n,a){this.name=Qa,this.setupOnce=function(o){o(Xa(e,{organization:t,projectId:r,prefix:s,severityAllowList:n,sendExceptionsToPostHog:a==null||a}))}}}class _n{constructor(e){this.li=(t,r,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength||s.crossTabAdoption)&&(E.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this.ui=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.hi()}hi(){var e;this.di=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.li)}destroy(){var e;(e=this.di)==null||e.call(this),this.di=void 0}doPageView(e,t){var r,s=this.vi(e,t);return this.ui={pathname:(r=v?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.vi(e,(t=this.ui)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.ui)==null?void 0:e.pageViewId}}vi(e,t){var r=this.ui;if(!r)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:r.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var a=n.maxScrollHeight,o=n.lastScrollY,l=n.maxScrollY,u=n.maxContentHeight,c=n.lastContentY,h=n.maxContentY;if(!(x(a)||x(o)||x(l)||x(u)||x(c)||x(h))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),h=Math.ceil(h);var d=a>1?Ae(o/a,0,1,E):1,p=a>1?Ae(l/a,0,1,E):1,g=u>1?Ae(c/u,0,1,E):1,f=u>1?Ae(h/u,0,1,E):1;s=Y(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:p,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:f})}}return r.pathname&&(s.$prev_pageview_pathname=r.pathname),r.timestamp&&(s.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),s}}var vr=["flags","surveys"],Zl={[$a]:{exposure:"hidden"},[Ht]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Ut]:{exposure:"hidden"},[Br]:{exposure:"event"},[Hr]:{exposure:"hidden"},[Ur]:{exposure:"event"},[zr]:{exposure:"hidden"},[Gr]:{exposure:"event"},[Vr]:{exposure:"event"},[Es]:{exposure:"event"},[ks]:{exposure:"hidden"},[Wr]:{exposure:"event"},[ut]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[yt]:{exposure:"hidden"},[Ss]:{exposure:"event"},[Ia]:{exposure:"event",shouldSkipFromEventProperties:i=>ye(i)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[lt]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(i,e)=>e(),transformToEventProperties(i){if(!K(i))return{};for(var e={},t=Object.keys(i),r=0;t.length>r;r++)e["$feature/"+t[r]]=i[t[r]];return e}},[bi]:{exposure:"event",storageGroup:"flags"},[zt]:{exposure:"hidden"},[Yr]:{exposure:"hidden",storageGroup:"flags"},[wi]:{exposure:"event",storageGroup:"flags"},[Kr]:{exposure:"event",storageGroup:"flags",volatile:!0},[Ai]:{exposure:"hidden",storageGroup:"flags"},[qe]:{exposure:"event"},[ft]:{exposure:"hidden"},[nt]:{exposure:"hidden"},[at]:{exposure:"hidden"},[Jr]:{exposure:"hidden",storageGroup:"surveys"},[Li]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Zr]:{exposure:"event"},[xi]:{exposure:"hidden"},[Ei]:{exposure:"hidden"},[Gt]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Yt]:{exposure:"hidden"},[Qr]:{exposure:"hidden"},[Xr]:{exposure:"hidden"},[ti]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Te]:{exposure:"hidden"},[es]:{exposure:"hidden"},[ts]:{exposure:"hidden"},[is]:{exposure:"hidden"},[rs]:{exposure:"hidden"},[Di]:{exposure:"hidden"},[ji]:{exposure:"hidden"},[Ra]:{exposure:"event"},[Ca]:{exposure:"event"},[Ma]:{exposure:"event"},[Oa]:{exposure:"event"},[Aa]:{exposure:"event"},[La]:{exposure:"event"},[Da]:{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"}},Ql=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],tt=i=>{var e=Zl[i];if(e)return e;for(var t of Ql){var r=t[1];if(i.indexOf(t[0])===0)return r}},bt=(i,e)=>{try{return JSON.stringify(i,((t,r)=>typeof r=="bigint"?r.toString():r),e)}catch{return Jn(i)}},zi=i=>{var e=S?.createElement("a");return x(e)?null:(e.href=i,e)},Pt=function(i,e){for(var t,r=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){t=n;break}}if(!O(t)||2>t.length)return"";var a=t[1];try{a=decodeURIComponent(a)}catch{E.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},ri=function(i,e,t){if(!i||!e||!e.length)return i;for(var r=i.split("#"),s=r[1],n=(r[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),u=[],c=0;l.length>c;c++){var h=l[c].split("=");O(h)&&(e.includes(h[0])?u.push(h[0]+"="+t):u.push(l[c]))}var d=o;return a!=null&&(d+="?"+u.join("&")),s!=null&&(d+="#"+s),d},Gi=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},eo=(i,e)=>i>=e&&Wn(),to=(i,e,t,r)=>{if(i===0){if(Wn()){var s=e+1;return s===t&&r(),s}return e}return 0},vi="https?://(.*)",Ft=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Xl=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ft],si="<masked>",eu=["li_fat_id"];function io(i,e,t){if(!S)return{};var r,s=e?[...Ft,...t||[]]:[],n=ro(ri(S.URL,s,si),i),a=(r={},G(eu,(function(o){var l=ja(o);r[o]=l||null})),r);return Y(a,n)}function ro(i,e){var t=Xl.concat(e||[]),r={};return G(t,(function(s){var n=Pt(i,s);r[s]=n||null})),r}function so(i){var e=(function(n){return n?n.search(vi+"google.([^/?]*)")===0?"google":n.search(vi+"bing.com")===0?"bing":n.search(vi+"yahoo.com")===0?"yahoo":n.search(vi+"duckduckgo.com")===0?"duckduckgo":null:null})(i),t=e!="yahoo"?"q":"p",r={};if(!ye(e)){r.$search_engine=e;var s=S?Pt(S.referrer,t):"";s.length&&(r.ph_keyword=s)}return r}function mn(){return navigator.language||navigator.userLanguage}var Vi="$direct";function no(){return S?.referrer||Vi}function ao(i,e,t){t===void 0&&(t=!1);var r=i?[...Ft,...e||[]]:[],s=t?Ze(ee?.href):ee?.href,n=s?.substring(0,1e3);return{r:no().substring(0,1e3),u:n?ri(n,r,si):void 0}}function oo(i,e){var t;e===void 0&&(e=!1);var r=i.r,s=i.u,n=e?Ze(s):s,a={$referrer:r,$referring_domain:r==null?void 0:r==Vi?Vi:(t=zi(r))==null?void 0:t.host};if(n){a.$current_url=n;var o=zi(n);a.$host=o?.host,a.$pathname=o?.pathname;var l=ro(n);Y(a,l)}if(r){var u=so(r);Y(a,u)}return a}function lo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function tu(){try{return new Date().getTimezoneOffset()}catch{return}}var iu={flags:ti,surveys:Li},ru=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],pt="main";class gr{constructor(e,t,r){if(r===void 0&&(r=!0),this.ci={},this.fi=!1,this.pi=!1,this.Ne=e,this.gi=r,this.props={},this.mi=void 0,this.yi=(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.ii=this.bi(e),this.pi=this.wi(e),this.load(),e.debug&&E.info("Persistence loaded",e.persistence,b({},this.props)),this.update_config(e,e,t),this.save(),v){var s=()=>this.flush();te(v,"beforeunload",s,{capture:!1}),te(v,"pagehide",s,{capture:!1})}}ki(){var e,t=(e=this.Ne)==null?void 0:e.persistence_save_debounce_ms;return ue(t)&&t>0?t:0}isDisabled(){return!!this.xi}bi(e){ru.indexOf(e.persistence.toLowerCase())===-1&&(E.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,r=(function(a,o){a===void 0&&(a=[]),o===void 0&&(o=!1);var l=[...Nl,...a];return b({},W,{H(u){try{var c={};try{c=ze.H(u)||{}}catch{}var h,d=JSON.parse(W.P(u)||"{}");if(o){var p={};for(var g in c){var f=c[g];ye(f)||f===""||(p[g]=f)}h=Y(d,p)}else h=Y(c,d);return W.F(u,h),h}catch{}return null},F(u,c,h,d,p,g){var f=W.F(u,c,void 0,void 0,g);try{var m={};l.forEach((_=>{c[_]&&(m[_]=c[_])})),Object.keys(m).length&&ze.F(u,m,h,d,p,g)}catch(_){W.j(_)}return f},q(u,c){try{v?.localStorage.removeItem(u),ze.q(u,c)}catch(h){W.j(h)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),s=!1,n=e.persistence.toLowerCase();return n==="localstorage"&&W.N()?(t=W,s=!0):n==="localstorage+cookie"&&r.N()?(t=r,s=!0):n==="sessionstorage"&&le.N()?t=le:n==="memory"?t=Al:n==="cookie"?t=ze:r.N()?(t=r,s=!0):t=ze,this.fi=s,t}Si(e){return this.yi+"__"+e}wi(e){return this.fi&&!!e.split_storage}Ci(e){var t=e??this.Ne.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var r=this.props[ti];return!r||typeof r!="number"||Date.now()-r>t}properties(){var e={};return G(this.props,((t,r)=>{var s=tt(r);if(s?.exposure==="derived"){if(s.shouldSkipFromEventProperties!=null&&s.shouldSkipFromEventProperties(t,r===lt?()=>this.Ci():()=>!1))return;s.transformToEventProperties&&Y(e,s.transformToEventProperties(t))}else if(!s||s.exposure==="event"){if(s!=null&&s.shouldSkipFromEventProperties!=null&&s.shouldSkipFromEventProperties(t,(()=>!1)))return;e[r]=t}})),e}load(){if(!this.xi){var e=this.ii.H(this.yi);e&&(this.props=Y({},e)),this.pi&&this.Mi()}}Mi(){for(var e of vr){var t=W.H(this.Si(e));if(t&&!Ve(t)){var r=this.Ti(e);r.persisted=!0,this.Ei(e)||(r.fingerprint=this.Ii(t,e)),this.Pi(e,t)||Y(this.props,t)}}}Ei(e){return Object.keys(this.props).some((t=>{var r;return((r=tt(t))==null?void 0:r.storageGroup)===e}))}Pi(e,t){var r=iu[e];if(!r)return!1;var s=t[r],n=this.props[r];return ue(s)&&ue(n)&&n>s}refreshKey(e){var t;if(!this.xi){var r=this.pi?(t=tt(e))==null?void 0:t.storageGroup:void 0,s=r?W.H(this.Si(r)):this.ii.H(this.yi);if(s&&e in s)this.Ri(e,s[e]);else{if(r){var n=this.ii.H(this.yi);if(n&&e in n)return void this.Ri(e,n[e])}this.Ai(e)}}}save(){if(!this.xi){var e=this.ki();e>0?x(this.Fi)&&(this.Fi=setTimeout((()=>{this.Fi=void 0,this.Li()}),e)):this.Li()}}flush(){x(this.Fi)||(clearTimeout(this.Fi),this.Fi=void 0,this.Li())}Li(){this.xi||(this.pi?this.Oi():this.Di(this.ii,this.yi,this.props,pt))}Oi(){var e=this.$i(),t=e.main,r=e.groups;for(var s of(this.Di(this.ii,this.yi,t,pt),vr)){var n,a=r[s];(!Ve(a)||(n=this.ci[s])!=null&&n.persisted)&&this.Di(W,this.Si(s),a,s)}}$i(){var e={},t={flags:{},surveys:{}};return G(this.props,((r,s)=>{var n,a=(n=tt(s))==null?void 0:n.storageGroup;a?t[a][s]=r:e[s]=r})),{main:e,groups:t}}Ii(e,t){if(t===pt)return JSON.stringify(e)+"|"+this.Ni+"|"+this.qi+"|"+this.ji;var r={};return G(e,((s,n)=>{var a;r[n]=(a=tt(n))!=null&&a.volatile?"__volatile__":s})),JSON.stringify(r)}Di(e,t,r,s){var n=this.Ti(s);if(s===pt||n.dirty||x(n.fingerprint)){var a;try{if((a=this.Ii(r,s))===n.fingerprint)return void(n.dirty=!1)}catch{a=void 0}e.F(t,r,this.Ni,this.qi,this.ji,this.Ne.debug)?(n.dirty=!1,s!==pt&&(n.persisted=!0),x(a)||(n.fingerprint=a)):this.Ne.debug&&E.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var t=(e===void 0?{}:e).keepGroupEntries,r=t!==void 0&&t;if(x(this.Fi)||(clearTimeout(this.Fi),this.Fi=void 0),this.ii.q(this.yi,!1),this.ii.q(this.yi,!0),!r&&this.gi)for(var s of vr)W.q(this.Si(s));r?delete this.ci[pt]:this.ci={}}clear(){this.remove(),this.props={}}register_once(e,t,r){if(K(e)){x(t)&&(t="None"),this.Ni=x(r)?this.Bi:r;var s=!1;if(G(e,((n,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.Ri(a,n),s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(K(e)){this.Ni=x(t)?this.Bi:t;var r=!1;if(G(e,((s,n)=>{e.hasOwnProperty(n)&&(this.props[n]!==s||K(s)||O(s))&&(this.Ri(n,s),r=!0)})),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Ai(e),this.save())}update_campaign_params(){var e=S?.URL;if(e!==this.mi){var t=io(this.Ne.custom_campaign_params,this.Ne.mask_personal_data_properties,this.Ne.custom_personal_data_properties);Ve(Fs(t))||this.register(t),this.mi=e}}update_search_keyword(){var e;this.register((e=S?.referrer)?so(e):{})}update_referrer_info(){var e;this.register_once({$referrer:no(),$referring_domain:S!=null&&S.referrer&&((e=zi(S.referrer))==null?void 0:e.host)||Vi},void 0)}set_initial_person_info(){this.props[is]||this.props[rs]||this.register_once({[Di]:ao(this.Ne.mask_personal_data_properties,this.Ne.custom_personal_data_properties,this.Ne.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};G([rs,is],(s=>{var n=this.props[s];n&&G(n,(function(a,o){e["$initial_"+Or(o)]=a}))}));var t=this.props[Di];if(t){var r=(function(s,n){n===void 0&&(n=!1);var a=oo(s,n),o={};return G(a,(function(l,u){o["$initial_"+Or(u)]=l})),o})(t,this.Ne.disable_capture_url_hashes);Y(e,r)}return e}safe_merge(e){return G(this.props,(function(t,r){r in e||(e[r]=t)})),e}update_config(e,t,r){this.Bi=this.Ni=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==t.persistence||!((l,u)=>{if(l.length!==u.length)return!1;var c=[...l].sort(),h=[...u].sort();return c.every(((d,p)=>d===h[p]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=s?this.bi(e):this.ii,a=this.wi(e);if(s||a!==this.pi){var o=this.props;this.clear(),this.ii=n,this.pi=a,this.props=o,this.save()}}set_disabled(e){this.xi=e,this.xi?this.remove():this.save()}set_cross_subdomain(e){e!==this.qi&&(this.qi=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.ji&&(this.ji=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var r=this.props[Ut]||{};r[e]=t,this.Ri(Ut,r),this.save()}remove_event_timer(e){var t=this.props[Ut]||{},r=t[e];return x(r)||(delete t[e],this.Ri(Ut,t),this.save()),r}get_property(e){return this.props[e]}set_property(e,t){this.Ri(e,t),this.save()}Ri(e,t){var r;this.props[e]=t,(r=tt(e))!=null&&r.volatile||this.Hi(e)}Ai(e){delete this.props[e],this.Hi(e)}Hi(e){var t,r=(t=tt(e))==null?void 0:t.storageGroup;r&&(this.Ti(r).dirty=!0)}Ti(e){return this.ci[e]||(this.ci[e]={})}}function gi(i){var e=!0;return{dispose(){if(e){e=!1;var t=i();t&&Ee(t.then)&&t.then(void 0,(()=>{}))}}}}var _e={GZipJS:"gzip-js",Base64:"base64"},Ot={Activation:"events",Cancellation:"cancelEvents"},fr={Popover:"popover",API:"api",Widget:"widget"},Ge={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},_r={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},ls={Popover:"popover",Inline:"inline"},su={SHOWN:"product tour shown"},yn={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},bn=re("[RateLimiter]");class nu{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var r=t.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((s=>{bn.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4}))}catch(s){return void bn.warn('could not rate limit - continuing. Error: "'+s?.message+'"',{text:r})}},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,r,s;e===void 0&&(e=!1);var n=this.captureEventsBurstLimit,a=this.captureEventsPerSecond,o=new Date().getTime(),l=(t=(r=this.instance.persistence)==null?void 0:r.get_property(ts))!==null&&t!==void 0?t:{tokens:n,last:o};l.tokens+=(o-l.last)/1e3*a,l.last=o,l.tokens>n&&(l.tokens=n);var u=1>l.tokens;if(u||e||(l.tokens=Math.max(0,l.tokens-1)),u&&!e){var c=(ue(l.dropped)?l.dropped:0)+1;l.dropped=c,!this.lastEventRateLimited&&this.Ui(c)&&(l.dropped=0)}return this.lastEventRateLimited=u,(s=this.instance.persistence)==null||s.set_property(ts,l),{isRateLimited:u,remainingTokens:l.tokens}}zi(e){var t=this.instance.config.property_denylist;return!O(t)||!t.includes(e)}Wi(){var e;if(this.zi("$current_url")&&this.zi("$pathname")&&ee!=null&&ee.pathname)return""+((e=ee.origin)!==null&&e!==void 0?e:"")+ee.pathname}Ui(e){var t,r,s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,a=this.Wi(),o=this.zi("$session_id")?(t=(r=this.instance).get_session_id)==null?void 0:t.call(r):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 "+s+" 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 Je=re("[RemoteConfig]");class uo{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=I._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Vi(e){var t,r;(t=I.__PosthogExtensions__)!=null&&t.loadExternalDependency?(r=I.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}Zi(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 Je.info("Using preloaded remote config",this.remoteConfig),this.Gi(this.remoteConfig),void this.Qi();if(this._instance.Ki())return void Je.warn("Remote config is disabled. Falling back to local config.");this.Vi((e=>{if(!e)return Je.info("No config found after loading remote JS config. Falling back to JSON."),void this.Zi((t=>{this.Gi(t.json,t),this.Qi()}));this.Gi(e),this.Qi()}))}catch(e){Je.error("Error loading remote config",e),this.Gi()}}stop(){this.Ji&&(clearInterval(this.Ji),this.Ji=void 0)}refresh(){!this._instance.Ki()&&S&&S.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Qi(){var e;if(!this.Ji){var t=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;t!==0&&(this.Ji=setInterval((()=>{this.refresh()}),t))}}Gi(e,t){!e&&t&&(t.statusCode===0?t.error||Je.warn("Failed to fetch remote config from PostHog."):Je.error("Failed to fetch remote config from PostHog."));try{this._instance.Gi(e?{ok:!0,config:e}:{ok:!1})}catch(s){Je.error("Error applying remote config",s)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var r;(r=this._instance.featureFlags)==null||r.ensureFlagsLoaded()}catch(s){Je.error("Error loading feature flags",s)}}}var Ie=Uint8Array,xe=Uint16Array,Tt=Uint32Array,Rs=new Ie([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Cs=new Ie([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),wn=new Ie([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),co=function(i,e){for(var t=new xe(31),r=0;31>r;++r)t[r]=e+=1<<i[r-1];var s=new Tt(t[30]);for(r=1;30>r;++r)for(var n=t[r];t[r+1]>n;++n)s[n]=n-t[r]<<5|r;return[t,s]},ho=co(Rs,2),us=ho[1];ho[0][28]=258,us[258]=28;for(var xn=co(Cs,0)[1],po=new xe(32768),ie=0;32768>ie;++ie){var vt=(43690&ie)>>>1|(21845&ie)<<1;po[ie]=((65280&(vt=(61680&(vt=(52428&vt)>>>2|(13107&vt)<<2))>>>4|(3855&vt)<<4))>>>8|(255&vt)<<8)>>>1}var Jt=function(i,e,t){for(var r=i.length,s=0,n=new xe(e);r>s;++s)++n[i[s]-1];var a,o=new xe(e);for(s=0;e>s;++s)o[s]=o[s-1]+n[s-1]<<1;for(a=new xe(r),s=0;r>s;++s)a[s]=po[o[i[s]-1]++]>>>15-i[s];return a},ht=new Ie(288);for(ie=0;144>ie;++ie)ht[ie]=8;for(ie=144;256>ie;++ie)ht[ie]=9;for(ie=256;280>ie;++ie)ht[ie]=7;for(ie=280;288>ie;++ie)ht[ie]=8;var Wi=new Ie(32);for(ie=0;32>ie;++ie)Wi[ie]=5;var au=Jt(ht,9),ou=Jt(Wi,5),vo=function(i){return(i/8>>0)+(7&i&&1)},go=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var r=new(i instanceof xe?xe:i instanceof Tt?Tt:Ie)(t-e);return r.set(i.subarray(e,t)),r},Le=function(i,e,t){var r=e/8>>0;i[r]|=t<<=7&e,i[r+1]|=t>>>8},Nt=function(i,e,t){var r=e/8>>0;i[r]|=t<<=7&e,i[r+1]|=t>>>8,i[r+2]|=t>>>16},mr=function(i,e){for(var t=[],r=0;i.length>r;++r)i[r]&&t.push({s:r,f:i[r]});var s=t.length,n=t.slice();if(!s)return[new Ie(0),0];if(s==1){var a=new Ie(t[0].s+1);return a[t[0].s]=1,[a,1]}t.sort((function(F,C){return F.f-C.f})),t.push({s:-1,f:25001});var o=t[0],l=t[1],u=0,c=1,h=2;for(t[0]={s:-1,f:o.f+l.f,l:o,r:l};c!=s-1;)o=t[t[h].f>t[u].f?u++:h++],l=t[u!=c&&t[h].f>t[u].f?u++:h++],t[c++]={s:-1,f:o.f+l.f,l:o,r:l};var d=n[0].s;for(r=1;s>r;++r)n[r].s>d&&(d=n[r].s);var p=new xe(d+1),g=cs(t[c-1],p,0);if(g>e){r=0;var f=0,m=g-e,_=1<<m;for(n.sort((function(F,C){return p[C.s]-p[F.s]||F.f-C.f}));s>r;++r){var k=n[r].s;if(e>=p[k])break;f+=_-(1<<g-p[k]),p[k]=e}for(f>>>=m;f>0;){var y=n[r].s;e>p[y]?f-=1<<e-p[y]++-1:++r}for(;r>=0&&f;--r){var P=n[r].s;p[P]==e&&(--p[P],++f)}g=e}return[new Ie(p),g]},cs=function(i,e,t){return i.s==-1?Math.max(cs(i.l,e,t+1),cs(i.r,e,t+1)):e[i.s]=t},En=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new xe(++e),r=0,s=i[0],n=1,a=function(l){t[r++]=l},o=1;e>=o;++o)if(i[o]==s&&o!=e)++n;else{if(!s&&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(s),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(s);n=1,s=i[o]}return[t.subarray(0,r),e]},At=function(i,e){for(var t=0,r=0;e.length>r;++r)t+=i[r]*e[r];return t},hs=function(i,e,t){var r=t.length,s=vo(e+2);i[s]=255&r,i[s+1]=r>>>8,i[s+2]=255^i[s],i[s+3]=255^i[s+1];for(var n=0;r>n;++n)i[s+n+4]=t[n];return 8*(s+4+r)},kn=function(i,e,t,r,s,n,a,o,l,u,c){Le(e,c++,t),++s[256];for(var h=mr(s,15),d=h[0],p=h[1],g=mr(n,15),f=g[0],m=g[1],_=En(d),k=_[0],y=_[1],P=En(f),F=P[0],C=P[1],L=new xe(19),w=0;k.length>w;++w)L[31&k[w]]++;for(w=0;F.length>w;++w)L[31&F[w]]++;for(var T=mr(L,7),R=T[0],$=T[1],N=19;N>4&&!R[wn[N-1]];--N);var D,V,Q,B,se=u+5<<3,X=At(s,ht)+At(n,Wi)+a,pe=At(s,d)+At(n,f)+a+14+3*N+At(L,R)+(2*L[16]+3*L[17]+7*L[18]);if(X>=se&&pe>=se)return hs(e,c,i.subarray(l,l+u));if(Le(e,c,1+(X>pe)),c+=2,X>pe){D=Jt(d,p),V=d,Q=Jt(f,m),B=f;var ne=Jt(R,$);for(Le(e,c,y-257),Le(e,c+5,C-1),Le(e,c+10,N-4),c+=14,w=0;N>w;++w)Le(e,c+3*w,R[wn[w]]);c+=3*N;for(var z=[k,F],de=0;2>de;++de){var q=z[de];for(w=0;q.length>w;++w)Le(e,c,ne[J=31&q[w]]),c+=R[J],J>15&&(Le(e,c,q[w]>>>5&127),c+=q[w]>>>12)}}else D=au,V=ht,Q=ou,B=Wi;for(w=0;o>w;++w)if(r[w]>255){var J;Nt(e,c,D[257+(J=r[w]>>>18&31)]),c+=V[J+257],J>7&&(Le(e,c,r[w]>>>23&31),c+=Rs[J]);var ae=31&r[w];Nt(e,c,Q[ae]),c+=B[ae],ae>3&&(Nt(e,c,r[w]>>>5&8191),c+=Cs[ae])}else Nt(e,c,D[r[w]]),c+=V[r[w]];return Nt(e,c,D[256]),c+V[256]},lu=new Tt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),uu=(function(){for(var i=new Tt(256),e=0;256>e;++e){for(var t=e,r=9;--r;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i})(),yr=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8};function cu(i,e){e===void 0&&(e={});var t=(function(){var h=4294967295;return{p(d){for(var p=h,g=0;d.length>g;++g)p=uu[255&p^d[g]]^p>>>8;h=p},d(){return 4294967295^h}}})(),r=i.length;t.p(i);var s,n,a,o,l,u=(o=10+((s=e).filename&&s.filename.length+1||0),l=8,(function(h,d,p,g,f,m){var _=h.length,k=new Ie(g+_+5*(1+Math.floor(_/7e3))+f),y=k.subarray(g,k.length-f),P=0;if(!d||8>_)for(var F=0;_>=F;F+=65535){var C=F+65535;_>C?P=hs(y,P,h.subarray(F,C)):(y[F]=!0,P=hs(y,P,h.subarray(F,_)))}else{for(var L=lu[d-1],w=L>>>13,T=8191&L,R=(1<<p)-1,$=new xe(32768),N=new xe(R+1),D=Math.ceil(p/3),V=2*D,Q=function(tr){return(h[tr]^h[tr+1]<<D^h[tr+2]<<V)&R},B=new Tt(25e3),se=new xe(288),X=new xe(32),pe=0,ne=0,z=(F=0,0),de=0,q=0;_>F;++F){var J=Q(F),ae=32767&F,ce=N[J];if($[ae]=ce,N[J]=ae,F>=de){var Ye=_-F;if((pe>7e3||z>24576)&&Ye>423){P=kn(h,y,0,B,se,X,ne,z,q,F-q,P),z=pe=ne=0,q=F;for(var fe=0;286>fe;++fe)se[fe]=0;for(fe=0;30>fe;++fe)X[fe]=0}var Re=2,Ke=0,be=T,Ce=ae-ce&32767;if(Ye>2&&J==Q(F-Ce))for(var ni=Math.min(w,Ye)-1,$t=Math.min(32767,F),ai=Math.min(258,Ye);$t>=Ce&&--be&&ae!=ce;){if(h[F+Re]==h[F+Re-Ce]){for(var Pe=0;ai>Pe&&h[F+Pe]==h[F+Pe-Ce];++Pe);if(Pe>Re){if(Re=Pe,Ke=Ce,Pe>ni)break;var oi=Math.min(Ce,Pe-2),It=0;for(fe=0;oi>fe;++fe){var er=F-Ce+fe+32768&32767,Os=er-$[er]+32768&32767;Os>It&&(It=Os,ce=er)}}}Ce+=(ae=ce)-(ce=$[ae])+32768&32767}if(Ke){B[z++]=268435456|us[Re]<<18|xn[Ke];var Ns=31&us[Re],As=31&xn[Ke];ne+=Rs[Ns]+Cs[As],++se[257+Ns],++X[As],de=F+Re,++pe}else B[z++]=h[F],++se[h[F]]}}P=kn(h,y,!0,B,se,X,ne,z,q,F-q,P)}return go(k,0,g+vo(P)+f)})(n=i,(a=e).level==null?6:a.level,a.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+a.mem,o,l)),c=u.length;return(function(h,d){var p=d.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>d.level?4:d.level==9?2:0,h[9]=3,d.mtime!=0&&yr(h,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),p){h[3]=8;for(var g=0;p.length>=g;++g)h[g+10]=p.charCodeAt(g)}})(u,e),yr(u,c-8,t.d()),yr(u,c-4,r),u}var hu=!!Rr||!!fs,fo="text/plain",Si=!1,_o=(i,e)=>{var t=i.split("#"),r=t[1],s=t[0].split("?"),n=s[0],a=s[1];if(!a)return i;var o=a.split("&").filter((l=>l.split("=")[0]!==e)).join("&");return n+(o?"?"+o:"")+(r?"#"+r:"")},Qi=function(i,e,t){var r;t===void 0&&(t=!0);var s=i.split("?"),n=s[0],a=s[1],o=b({},e),l=(r=a?.split("&").map((c=>{var h,d=c.split("="),p=d[0],g=t&&(h=o[p])!==null&&h!==void 0?h:d[1];return delete o[p],p+"="+g})))!==null&&r!==void 0?r:[],u=(function(c,h){var d,p;h===void 0&&(h="&");var g=[];return G(c,(function(f,m){x(f)||x(m)||m==="undefined"||(d=encodeURIComponent((_=>_ instanceof File)(f)?f.name:f.toString()),p=encodeURIComponent(m),g[g.length]=p+"="+d)})),g.join(h)})(o);return u&&l.push(u),l.length>0?n+"?"+l.join("&"):n},br=i=>{if(i.Yi)return i.Yi;var e=i.data,t=i.compression;if(e){if(t===_e.GZipJS){var r=cu((function(o,l){var u=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var c=new Ie(o.length+(o.length>>>1)),h=0,d=function(m){c[h++]=m},p=0;u>p;++p){if(h+5>c.length){var g=new Ie(h+8+(u-p<<1));g.set(c),c=g}var f=o.charCodeAt(p);128>f?d(f):2048>f?(d(192|f>>>6),d(128|63&f)):f>55295&&57344>f?(d(240|(f=65536+(1047552&f)|1023&o.charCodeAt(++p))>>>18),d(128|f>>>12&63),d(128|f>>>6&63),d(128|63&f)):(d(224|f>>>12),d(128|f>>>6&63),d(128|63&f))}return go(c,0,h)})(bt(e)),{mtime:0});return{contentType:fo,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(t===_e.Base64){var s=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,((l,u)=>String.fromCharCode(parseInt(u,16)))))})(bt(e)),n=(o=>"data="+encodeURIComponent(typeof o=="string"?o:bt(o)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var a=bt(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},mo=i=>{var e,t,r=()=>i.transport==="sendBeacon"?{url:Qi(i.url,{compression:_e.Base64}),encodedBody:br(b({},i,{compression:_e.Base64,Yi:void 0}))}:{url:_o(i.url,"compression"),encodedBody:br(b({},i,{compression:void 0,Yi:void 0}))};try{e=br(i)}catch(s){if(Us(i.compression,Pt(i.url,"compression")))return E.error("Failed to gzip request body, sending uncompressed payload",s),r();throw s}return e&&Us(i.compression,Pt(i.url,"compression"))&&!((t=e.body)instanceof ArrayBuffer?Cr(new Uint8Array(t)):ArrayBuffer.isView(t)&&Cr(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?(Si=!0,r()):{url:i.url,encodedBody:e}},yo=i=>{try{return mo(i)}catch(e){return E.error(e),void(i.callback==null||i.callback({statusCode:0,error:e}))}},du=(function(){var i=Z((function*(e){var t=bt(e.data),r=yield(function(n,a,o){return Mr.apply(this,arguments)})(t,U.DEBUG,{rethrow:!0});if(!r)return e;var s=yield r.arrayBuffer();return b({},e,{Yi:{contentType:fo,body:s,estimatedSize:s.byteLength}})}));return function(e){return i.apply(this,arguments)}})(),pu=/Failed to fetch|NetworkError|Load failed/i,bo=i=>i?.name==="TypeError"&&pu.test(i?.message||""),wo=i=>{var e=yo(i);if(e){var t=e.url,r=e.encodedBody,s=r??{},n=s.contentType,a=s.body,o=s.estimatedSize,l=new Headers;G(i.headers,(function(g,f){l.append(f,g)})),n&&l.append("Content-Type",n);var u=null,c=!1;if(Ls){var h=new Ls;u={signal:h.signal,timeout:setTimeout((()=>{var g,f;c=!0,h.abort((g=i.timeout,(f=new Error("PostHog request timed out"+(g?" after "+g+"ms":""))).name="AbortError",f))}),i.timeout)}}var d=g=>{c&&g?.name==="AbortError"||bo(g)?E.warn(g):E.error(g),i.callback==null||i.callback({statusCode:0,error:g})};try{var p;fs(t,b({method:i?.method||"GET",headers:l,keepalive:i.method==="POST"&&!i.Xi&&52428.8>(o||0),body:a,signal:(p=u)==null?void 0:p.signal},i.fetchOptions)).then((g=>g.text().then((f=>{var m={statusCode:g.status,text:f};if(g.status===200)try{m.json=JSON.parse(f)}catch(_){E.error(_)}i.callback==null||i.callback(m)})))).catch(d).finally((()=>u?clearTimeout(u.timeout):null))}catch(g){u&&clearTimeout(u.timeout),d(g)}}},ds=i=>{try{var e,t=mo(i),r=t.url,s=t.encodedBody,n=s??{},a=n.body,o=n.estimatedSize;if(!a)return;var l=a instanceof Blob?a:new Blob([a],{type:n.contentType});if(me.sendBeacon(r,l))return;var u=O(i.data)?i.data:(e=i.data)==null?void 0:e.batch;if(O(u)&&u.length>1&&(o??0)>16384){var c=Math.ceil(u.length/2),h=d=>O(i.data)?d:b({},i.data,{batch:d});return ds(b({},i,{data:h(u.slice(0,c))})),void ds(b({},i,{data:h(u.slice(c))}))}E.warn("Beacon of ~"+(o??0)+" bytes was rejected by the browser, falling back to fetch"),wo(b({},i,{Xi:!0}))}catch(d){E.warn("Beacon send failed",d)}},Sn=(i,e,t,r)=>{var s=r==="query"?e==="POST"?"sent_at":"_":void 0;return Qi(t===_e.GZipJS?_o(i,"compression"):i,b({},s?{[s]:Date.now().toString()}:{},t===_e.GZipJS?{}:{compression:t}))},Pi=[];fs&&Pi.push({transport:"fetch",method:wo}),Rr&&Pi.push({transport:"XHR",method(i){var e=yo(i);if(e){var t=new Rr,r=e.encodedBody;t.open(i.method||"GET",e.url,!0);var s=r??{},n=s.contentType,a=s.body;G(i.headers,(function(o,l){t.setRequestHeader(l,o)})),n&&t.setRequestHeader("Content-Type",n),i.timeout&&(t.timeout=i.timeout),t.onreadystatechange=()=>{if(t.readyState===4){var o={statusCode:t.status,text:t.responseText};if(t.status===200)try{o.json=JSON.parse(t.responseText)}catch{}i.callback==null||i.callback(o)}},t.send(a)}}}),me!=null&&me.sendBeacon&&Pi.push({transport:"sendBeacon",method:ds});var ps=3e3;class vu{constructor(e,t){this.tr=!0,this.er=[],this.ir=Ae(t?.flush_interval_ms||ps,250,5e3,E.createLogger("flush interval"),ps),this.rr=e}enqueue(e){this.er.push(e),this.nr||this.sr()}unload(){this.ar();var e=this.er.length>0?this.lr():{},t=Object.values(e);[...t.filter((r=>r.url.indexOf("/e")===0)),...t.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.ur(b({},r,{transport:"sendBeacon"}))}))}enable(){this.tr=!1,this.sr()}sr(){var e=this;this.tr||(this.nr=setTimeout((()=>{if(this.ar(),this.er.length>0){var t=this.lr(),r=function(){var n=t[s],a=new Date().getTime();n.data&&O(n.data)&&G(n.data,(o=>{o.offset=Math.abs(o.timestamp-a),delete o.timestamp})),e.ur(n)};for(var s in t)r()}}),this.ir))}ur(e){try{this.rr(e)}catch(t){E.error(t)}}ar(){clearTimeout(this.nr),this.nr=void 0}lr(){var e={};return G(this.er,(t=>{var r,s=t,n=(s?s.batchKey:null)||s.url;x(e[n])&&(e[n]=b({},s,{data:[]})),(r=e[n].data)==null||r.push(s.data)})),this.er=[],e}}var gu=["retriesPerformedSoFar"];class fu{constructor(e){this.hr=!1,this.dr=3e3,this.er=[],this._instance=e,this.er=[],this.vr=!0,!x(v)&&"onLine"in v.navigator&&(this.vr=v.navigator.onLine,this.cr=()=>{this.vr=!0,this.pr()},this.gr=()=>{this.vr=!1},te(v,"online",this.cr),te(v,"offline",this.gr))}get length(){return this.er.length}retriableRequest(e){var t=e.retriesPerformedSoFar,r=Yn(e,gu);je(t)&&(r.url=Qi(r.url,{retry_count:t})),this._instance._send_request(b({},r,{callback:s=>{if(s.statusCode!==200&&(400>s.statusCode||s.statusCode>=500)){if((s.statusCode===0?3:10)>(t??0))return void this.At(b({retriesPerformedSoFar:t},r));s.statusCode===0&&E.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(t??0)+" retries.")}r.callback==null||r.callback(s)}}))}At(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var r=(function(a){var o=3e3*Math.pow(2,a),l=o/2,u=Math.min(18e5,o),c=Math.random()-.5;return Math.ceil(u+c*(u-l))})(t),s=Date.now()+r;this.er.push({retryAt:s,requestOptions:e});var n="Enqueued failed request for retry in "+r;navigator.onLine||(n+=" (Browser is offline)"),E.warn(n),this.hr||(this.hr=!0,this.mr())}mr(){if(this.yr&&clearTimeout(this.yr),this.er.length===0)return this.hr=!1,void(this.yr=void 0);this.yr=setTimeout((()=>{this.vr&&this.er.length>0&&this.pr(),this.mr()}),this.dr)}pr(){var e=Date.now(),t=[],r=this.er.filter((n=>e>n.retryAt||(t.push(n),!1)));if(this.er=t,r.length>0)for(var s of r)this.retriableRequest(s.requestOptions)}unload(){for(var e of(this.yr&&(clearTimeout(this.yr),this.yr=void 0),this.hr=!1,x(v)||(this.cr&&(v.removeEventListener("online",this.cr),this.cr=void 0),this.gr&&(v.removeEventListener("offline",this.gr),this.gr=void 0)),this.er)){var t=e.requestOptions;try{this._instance._send_request(b({},t,{transport:"sendBeacon"}))}catch(r){E.error(r)}}this.er=[]}}class _u{constructor(e){this.br=()=>{var t,r,s,n;this._r||(this._r={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,u=o+(a?.clientHeight||0),c=a?.scrollHeight||0;this._r.lastScrollY=Math.ceil(o),this._r.maxScrollY=Math.max(o,(t=this._r.maxScrollY)!==null&&t!==void 0?t:0),this._r.maxScrollHeight=Math.max(l,(r=this._r.maxScrollHeight)!==null&&r!==void 0?r:0),this._r.lastContentY=u,this._r.maxContentY=Math.max(u,(s=this._r.maxContentY)!==null&&s!==void 0?s:0),this._r.maxContentHeight=Math.max(c,(n=this._r.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}get wr(){return this._instance.config.scroll_root_selector}getContext(){return this._r}resetContext(){var e=this._r;return setTimeout(this.br,0),e}startMeasuringScrollPosition(){te(v,"scroll",this.br,{capture:!0}),te(v,"scrollend",this.br,{capture:!0}),te(v,"resize",this.br)}scrollElement(){if(!this.wr)return v?.document.documentElement;var e=O(this.wr)?this.wr:[this.wr];for(var t of e){var r=v?.document.querySelector(t);if(r)return r}}kr(e){var t=e==="y"?"scrollTop":"scrollLeft";if(this.wr){var r=this.scrollElement();return r&&r[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.kr("y")}scrollX(){return this.kr("x")}}var mu=i=>ao(i?.config.mask_personal_data_properties,i?.config.custom_personal_data_properties,i?.config.disable_capture_url_hashes);class Pn{constructor(e,t,r,s){this.Sr=n=>{var a=this.Cr();if(!a||a.sessionId!==n){var o={sessionId:n,props:this.Mr(this._instance)};this.Tr.register({[es]:o})}},this._instance=e,this.Er=t,this.Tr=r,this.Mr=s||mu,this.Er.onSessionId(this.Sr)}Cr(){return this.Tr.props[es]}getSetOnceProps(){var e,t=(e=this.Cr())==null?void 0:e.props;return t?"r"in t?oo(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return G(Fs(this.getSetOnceProps()),((t,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+Or(r)]=t})),e}}class Ms{on(e,t){return this.Ir[e]||(this.Ir[e]=[]),this.Ir[e].push(t),()=>{this.Ir[e]=this.Ir[e].filter((r=>r!==t))}}emit(e,t){for(var r of this.Ir[e]||[])r(t);for(var s of this.Ir["*"]||[])s(e,t)}constructor(){this.Ir={}}}var Lt=re("[SessionId]");class Fn{on(e,t){return this.Pr.on(e,t)}constructor(e,t,r){var s;if(this.Rr=null,this.Ar=[],this.Fr=void 0,this.Lr=!1,this.Pr=new Ms,this.Or=(u,c)=>!(!je(u)||!je(c))&&Math.abs(u-c)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Ue)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ne=e.config,this.Tr=e.persistence,this.Dr=void 0,this.$r=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Nr=t||He,this.qr=r||He;var n=this.Ne.persistence_name||this.Ne.token;if(this._sessionTimeoutMs=1e3*Ae(this.Ne.session_idle_timeout_seconds||1800,60,36e3,Lt.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.jr(),this.Br="ph_"+n+"_window_id",this.Hr="ph_"+n+"_primary_window_exists",this.Ur()){var a=le.H(this.Br),o=le.H(this.Hr);a&&!o?this.Dr=a:le.q(this.Br),le.F(this.Hr,!0)}if((s=this.Ne.bootstrap)!=null&&s.sessionID)try{var l=(u=>{var c=this.Ne.bootstrap.sessionID.replace(/-/g,"");if(c.length!==32)throw new Error("Not a valid UUID");if(c[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(c.substring(0,12),16)})();this.zr(this.Ne.bootstrap.sessionID,new Date().getTime(),l)}catch(u){Lt.error("Invalid sessionID in bootstrap",u)}this.Wr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return x(this.Ar)&&(this.Ar=[]),this.Ar.push(e),this.$r&&e(this.$r,this.Dr),()=>{this.Ar=this.Ar.filter((t=>t!==e))}}Ur(){return this.Ne.persistence!=="memory"&&!this.Tr.xi&&le.N()}Vr(e){e!==this.Dr&&(this.Dr=e,this.Ur()&&le.F(this.Br,e))}Zr(){return this.Dr?this.Dr:this.Ur()?le.H(this.Br):null}Gr(e){var t=this.Rr;return!ye(t)&&!ye(e)&&5e3>Math.abs(e-t)}zr(e,t,r){var s=t!==this._sessionActivityTimestamp,n=!(e!==this.$r||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this.$r=e,n&&!s||n&&this.Gr(t)||(this.Rr=t,this.Tr.register({[yt]:[t,e,r]}))}Qr(){var e,t=(e=this.Ne)==null?void 0:e.persistence_save_debounce_ms;return je(t)&&t>0}Kr(){this.Qr()?this.Tr.refreshKey(yt):(this.Tr.flush(),this.Tr.load())}Jr(){var e;if(!ye(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Rr){this.Kr();var t=this.Yr();t[1]===this.$r&&t[2]===this._sessionStartTimestamp&&(this.Rr=this._sessionActivityTimestamp,this.Tr.register({[yt]:[this._sessionActivityTimestamp,(e=this.$r)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Tr.flush())}}Xr(){var e=this.Yr()[0],t=je(e)?e:0,r=je(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,r)}tn(e){return this.Kr(),this.Or(e,this.Xr())}Yr(){var e=this.Tr.props[yt];return O(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Rr=null,clearTimeout(this.en),this.en=void 0,this.zr(null,null,null)}destroy(){this.Lr=!0,this.Jr(),clearTimeout(this.en),this.en=void 0,this.Fr&&v&&(v.removeEventListener(Bi,this.Fr,{capture:!1}),this.Fr=void 0),this.Ar=[]}Wr(){this.Fr=()=>{this.Jr(),this.Ur()&&le.q(this.Hr)},te(v,Bi,this.Fr,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.Ne.cookieless_mode===Ue)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||new Date().getTime(),s=this.Yr(),n=s[1],a=s[2],o=this.Xr(),l=this.Zr(),u=je(a)&&Math.abs(r-a)>864e5,c=!1,h=!1,d=!n,p=n,g=!d&&!e&&this.Or(r,o);if(g){(g=this.tn(r))||Lt.info("cross-tab refresh kept the session alive",{sessionId:n});var f=this.Yr();n=f[1],a=f[2]}d||g||u?(n=this.Nr(),l=this.qr(),Lt.info("new session ID generated",{sessionId:n,windowId:l,changeReason:{noSessionId:d,activityTimeout:g,sessionPastMaximumLength:u}}),a=r,c=!0):(l||(l=this.qr(),c=!0),(h=n!==p)&&(Lt.info("adopted cross-tab session id",{sessionId:n,windowId:l}),c=!0));var m=je(o)&&e&&!u?o:r,_=je(a)?a:new Date().getTime();this.Vr(l),this.zr(n,m,_),e||this.jr();var k={noSessionId:d,activityTimeout:g,sessionPastMaximumLength:u,crossTabAdoption:h};return c&&this.Ar.forEach((y=>y(n,l,k))),{sessionId:n,windowId:l,sessionStartTimestamp:_,changeReason:c?k:void 0,lastActivityTimestamp:o}}jr(){this.Lr||(clearTimeout(this.en),this.en=setTimeout((()=>{if(!this.Lr)if(this.tn(new Date().getTime())){var e=this.$r;this.resetSessionId(),this.Pr.emit("forcedIdleReset",{idleSessionId:e})}else this.jr()}),1.1*this.sessionTimeoutMs))}}var xo=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&Gs(t,e))return!0;try{var r=i?.userAgentData;if(r!=null&&r.brands&&r.brands.some((s=>Gs(s?.brand,e))))return!0}catch{}return!!i.webdriver};function Eo(){return(Eo=Z((function*(){var i=me?.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(r){return void E.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",r)}}))).apply(this,arguments)}var Yi=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 wr(i,e,t){return bt({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var ko={exact:(i,e)=>e.some((t=>i.some((r=>t===r)))),is_not:(i,e)=>e.every((t=>i.every((r=>t!==r)))),regex:(i,e)=>e.some((t=>i.some((r=>Yi(t,r))))),not_regex:(i,e)=>e.every((t=>i.every((r=>!Yi(t,r))))),icontains:(i,e)=>e.map(fi).some((t=>i.map(fi).some((r=>t.includes(r))))),not_icontains:(i,e)=>e.map(fi).every((t=>i.map(fi).every((r=>!t.includes(r))))),gt:(i,e)=>e.some((t=>{var r=parseFloat(t);return!isNaN(r)&&i.some((s=>r>parseFloat(s)))})),lt:(i,e)=>e.some((t=>{var r=parseFloat(t);return!isNaN(r)&&i.some((s=>r<parseFloat(s)))}))},fi=i=>i.toLowerCase();function So(i,e){return!i||Object.entries(i).every((t=>{var r=t[1],s=e?.[t[0]];if(x(s)||ye(s))return!1;var n=[String(s)],a=ko[r.operator];return!!a&&a(r.values,n)}))}var vs="custom",Tn="i.posthog.com",yu=/^\/static\//;class bu{constructor(e){this.rn={},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.rn[this.apiHost]||(this.rn[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":vs),this.rn[this.apiHost]}nn(e){if(yu.test(e)){var t=this.instance.config.asset_host;if(typeof t=="string")return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(e==="assets"){var r=this.nn(t);if(r)return""+r+t}if(this.region===vs)return this.apiHost+t;var s=Tn+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}function Po(i){var e;return!((e=i.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var H=re("[Surveys]"),Fo="seenSurvey_",To=i=>{try{var e=(t=>((r,s)=>""+Fo+(function(n){return n.current_iteration&&n.current_iteration>0?n.id+"_"+n.current_iteration:n.id})(s))(0,t))(i);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){H.error("Failed to persist survey seen state",t)}},wu=[fr.Popover,fr.Widget,fr.API],xu={ignoreConditions:!1,ignoreDelay:!1,displayType:ls.Popover},Eu=re("[PostHog ExternalIntegrations]"),ku={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Su{constructor(e){this._instance=e}ai(e,t){var r;(r=I.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,(s=>{if(s)return Eu.error("failed to load script",s);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var n,a,o,l=r[0],u=r[1];!u||(n=I.__PosthogExtensions__)!=null&&(n=n.integrations)!=null&&n[l]||e.ai(ku[l],(()=>{var c;(c=I.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[l])==null||c.start(e._instance)})),!u&&(a=I.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[l]&&((o=I.__PosthogExtensions__)==null||(o=o.integrations)==null||(o=o[l])==null||o.stop())};for(var r of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;t()}}}class Pu{constructor(e,t){this.rt=e,this.sn=t,this.an=new Map,this.ln=!1}add(e){var t=this;return Z((function*(){if(t.ln)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.an.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');t.an.set(e.name,e);try{var r=e.setup(t.sn);r&&(yield r)}catch(n){var s=t.an.get(e.name)===e;s&&t.an.delete(e.name),t.rt.error('Failed to set up browser extension "'+e.name+'"',n),s&&t.un(e)}}))()}dispose(){if(!this.ln){this.ln=!0;var e=Array.from(this.an.values()).reverse();for(var t of(this.an.clear(),e))this.un(t)}}un(e){try{var t=e.dispose==null?void 0:e.dispose();t&&Ee(t.then)&&t.then(void 0,(r=>{this.rt.error('Failed to dispose browser extension "'+e.name+'"',r)}))}catch(r){this.rt.error('Failed to dispose browser extension "'+e.name+'"',r)}}}class Fu{constructor(e){this._instance=e}get(e){var t;return(t=this._instance.persistence)==null?void 0:t.get_property(e)}set(e,t){var r;(r=this._instance.persistence)==null||r.set_property(e,t)}remove(e){var t;(t=this._instance.persistence)==null||t.unregister(e)}}var $n="extensionsRemoteConfig";class Tu{constructor(e){this.ln=!1,this.instance=e,this.rt=E.createLogger("[BrowserExtensions]"),this.hn=e.dn,this.kv=new Fu(e),this.onEvent=t=>gi(this.instance.on("eventCaptured",(r=>{try{t({event:r.event,properties:r.properties})}catch(s){this.rt.error("Browser extension event listener failed",s)}}))),this.onRemoteConfig=t=>{if(this.ln)return gi((()=>{}));var r=n=>{try{t(n)}catch(a){this.rt.error("Browser extension remote config listener failed",a)}},s=this.instance.vn.on($n,r);return this.hn&&r(this.hn),gi(s)},this.cn=new Pu(this.rt,this)}get logger(){return this.rt}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property(ei))!==null&&e!==void 0?e:this.distinctId}get groups(){return this.instance.getGroups()}get session(){try{var e,t,r,s,n=(e=this.instance.sessionManager)==null?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=n?.sessionId)!==null&&t!==void 0?t:"",windowId:(r=n?.windowId)!==null&&r!==void 0?r:"",sessionStartTimestamp:(s=n?.sessionStartTimestamp)!==null&&s!==void 0?s:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(e){return this.cn.add(e)}capture(e,t,r){var s=this;return Z((function*(){r?s.instance.capture(e,t,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):s.instance.capture(e,t)}))()}registerDynamicEventProperties(e){return gi(this.instance.fn(e))}handleRemoteConfig(e){this.ln||(this.hn=e,this.instance.vn.emit($n,e))}sendRequest(e,t){var r=this;return Z((function*(){var s;t===void 0&&(t={});var n=r.instance.requestRouter.endpointFor((s=t.target)!==null&&s!==void 0?s:"api",e),a={method:t.method,url:t.query?Qi(n,t.query):n,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport};return t.transport==="sendBeacon"?(r.instance._send_request(a),{statusCode:202}):new Promise((o=>{a.callback=o,r.instance._send_request(a)}))}))()}dispose(){this.ln||(this.ln=!0,this.cn.dispose())}}var Zt={},xr=0,Ki=()=>{},In='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Dt="Surveys module not available",Rn="sanitize_properties is deprecated. Use before_send instead",$o="Invalid value for property_denylist config: ",$u=["token","distinct_id",Na],mt="posthog",Io=!hu&&we?.indexOf("MSIE")===-1&&we?.indexOf("Mozilla")===-1,Er=i=>{var e;return b({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Il(S?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ki,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:ee&&j(ee?.search)&&ee.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(v==null||(e=v.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){E.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ss,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:ps},error_tracking:{},_onCapture:Ki},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Hl,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))},Iu=[["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"]],Cn=i=>{var e={};for(var t of Iu){var r=t[0],s=t[1];x(i[r])||(e[s]=i[r])}var n=Y({},e,i),a=i.__preview_external_dependency_versioned_paths;return x(a)||(x(i.strict_script_versioning)&&(n.strict_script_versioning=!!a),j(a)&&x(i.asset_host)&&(n.asset_host=a)),O(i.property_blacklist)&&(x(i.property_denylist)?n.property_denylist=i.property_blacklist:O(i.property_denylist)?n.property_denylist=[...i.property_blacklist,...i.property_denylist]:E.error($o+i.property_denylist)),n};class Ru{constructor(){this.__forceAllowLocalhost=!1}get pn(){return this.__forceAllowLocalhost}set pn(e){E.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class $e{gn(e,t){if(e){var r=this.an.indexOf(e);r!==-1&&this.an.splice(r,1)}return this.an.push(t),t.initialize==null||t.initialize(),t}mn(){return this.config.cookieless_mode===Ue||this.config.cookieless_mode===ot&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new Ru,this.yn=!1,this.version=U.LIB_VERSION,this.bn=new Set,this._n="",this.vn=new Ms,this.an=[],this.wn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Er(),this.SentryIntegration=Jl,this.sentryIntegration=r=>(function(s,n){var a=Xa(s,n);return{name:Qa,processEvent:o=>a(o)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.kn=!1,this.xn=null,this.Sn=null,this.Cn=null,this.scrollManager=new _u(this),this.pageViewManager=new _n(this),this.rateLimiter=new nu(this),this.requestRouter=new bu(this),this.consent=new Ll(this),this.externalIntegrations=new Su(this);var t=(e=$e.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(r,s,n)=>{var a=j(r)?{[r]:s}:r;this.setPersonProperties(a),n?.({})},set_once:(r,s,n)=>{var a=j(r)?{[r]:s}:r;this.setPersonProperties(void 0,a),n?.({})}},this.on("eventCaptured",(r=>E.info('send "'+r?.event+'"',r)))}init(e,t,r){if(r&&r!==mt){var s,n=(s=Zt[r])!==null&&s!==void 0?s:new $e;return n._init(e,t,r),Zt[r]=n,Zt[mt][r]=n,n}return this._init(e,t,r)}_init(e,t,r){var s,n;t===void 0&&(t={});var a,o=j(e)?e.trim():"";if(!o)return E.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return 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=Er(t.defaults),t.debug=this.Mn(t.debug),this.Tn=t,this.En=[],t.person_profiles?this.Sn=t.person_profiles:t.process_person&&(this.Sn=t.process_person);var l=Er(t.defaults),u=Cn(t),c=Y({},l,u,{name:r,token:o});K(l.rageclick)&&K(u.rageclick)&&(c.rageclick=Y({},l.rageclick,u.rageclick)),K(l.session_recording)&&K(u.session_recording)&&(c.session_recording=Y({},l.session_recording,u.session_recording)),this.set_config(c),this.config.on_xhr_error&&E.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:_e.GZipJS;var h=this.In();if(this.persistence=new gr(this.config,h),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new gr(b({},this.config,{persistence:"sessionStorage"}),h,!1),this._n="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!h&&le.N()){var d=le.H(this._n);O(d)&&d.forEach((C=>{j(C)&&this.bn.add(C)}))}else le.q(this._n);var p=b({},this.persistence.props),g=b({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Pn=new vu((C=>this.Rn(C)),this.config.request_queue_config),this.An=new fu(this),this.__request_queue=[];var f=this.mn();if(f||(this.sessionManager=new Fn(this),this.sessionPropsManager=new Pn(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((C,L,w)=>{(w!=null&&w.activityTimeout||w!=null&&w.sessionPastMaximumLength||w!=null&&w.crossTabAdoption)&&this.Fn()}))),this.config.__preview_deferred_init_extensions?(E.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ln(f)}),0)):(E.info("Initializing extensions synchronously"),this.Ln(f)),U.DEBUG=U.DEBUG||this.config.debug,U.DEBUG&&E.info("Starting in debug mode",{this:this,config:t,thisC:b({},this.config),p,s:g}),!this.config.identity_distinct_id||(s=t.bootstrap)!=null&&s.distinctID||(t.bootstrap=b({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((n=t.bootstrap)==null?void 0:n.distinctID)!==void 0){var m=t.bootstrap.distinctID,_=this.get_distinct_id(),k=this.persistence.get_property(Te);if(t.bootstrap.isIdentifiedID&&_!=null&&_!==m&&k===dt)this.identify(m);else if(t.bootstrap.isIdentifiedID&&_!=null&&_!==m&&k===Xe)E.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var y=this.config.get_device_id(He()),P=t.bootstrap.isIdentifiedID?y:m;this.persistence.set_property(Te,t.bootstrap.isIdentifiedID?Xe:dt),this.register({distinct_id:m,$device_id:P})}}if(f)this.register_once({distinct_id:ci,$device_id:null},"");else if(!this.get_distinct_id()){var F=this.config.get_device_id(He());this.register_once({distinct_id:F,$device_id:F},""),this.persistence.set_property(Te,dt)}return te(v,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?(function(C,L){var w=C.config.segment;if(!w)return L();(function(T,R){var $=T.config.segment;if(!$)return R();var N=V=>{var Q=()=>V.anonymousId()||He();T.config.get_device_id=Q,V.id()&&(T.register({distinct_id:V.id(),$device_id:Q()}),T.persistence.set_property(Te,Xe)),R()},D=$.user();"then"in D&&Ee(D.then)?D.then(N):N(D)})(C,(()=>{w.register((T=>{typeof Promise<"u"&&Promise.resolve||pr.warn("This browser does not have Promise support, and can not use the segment integration");var R=($,N)=>{if(!N)return $;$.event.userId||$.event.anonymousId===T.get_distinct_id()||(pr.info("No userId set, resetting PostHog"),T.reset()),$.event.userId&&$.event.userId!==T.get_distinct_id()&&(pr.info("UserId set, identifying with PostHog"),T.identify($.event.userId));var D=T.calculateEventProperties(N,$.event.properties);return $.event.properties=Object.assign({},D,$.event.properties),$};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:$=>R($,$.event.event),page:$=>R($,_t),identify:$=>R($,cr),screen:$=>R($,"$screen")}})(C)).then((()=>{L()}))}))})(this,(()=>this.On())):this.On(),Ee(this.config._onCapture)&&this.config._onCapture!==Ki&&(E.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(C=>this.config._onCapture(C.event,C)))),this.config.ip&&E.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return Eo.apply(this,arguments)})().then((C=>{C&&this.register({[lr]:C})})).catch(Ki),this}Ln(e){var t,r,s,n,a,o,l,u,c=performance.now(),h=b({},$e.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.an.push(this.featureFlags=(t=this.featureFlags)!==null&&t!==void 0?t:new h.featureFlags(this)),h.exceptions&&this.an.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new h.exceptions(this)),h.historyAutocapture&&this.an.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.an.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.an.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!e&&this.an.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.an.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.an.push(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new h.surveys(this)),h.logs&&this.an.push(this.logs=(n=this.logs)!==null&&n!==void 0?n:new h.logs(this)),h.metrics&&this.an.push(this.metrics=(a=this.metrics)!==null&&a!==void 0?a:new h.metrics(this)),h.conversations&&this.an.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new h.conversations(this)),h.productTours&&this.an.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.an.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.an.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.an.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.an.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,Kl)),h.toolbar&&this.an.push(this.toolbar=(l=this.toolbar)!==null&&l!==void 0?l:new h.toolbar(this)),h.experiments&&this.an.push(this.experiments=(u=this.experiments)!==null&&u!==void 0?u:new h.experiments(this)),this.an.forEach((p=>{p.initialize&&d.push((()=>{p.initialize==null||p.initialize()}))})),d.push((()=>{if(this.Dn){var p=this.Dn;this.Dn=void 0,this.an.forEach((g=>g.onRemoteConfig==null?void 0:g.onRemoteConfig(p)))}})),this.$n(d,c)}$n(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.$n(e,t)}),0);var r=e.shift();if(r)try{r()}catch(n){E.error("Error initializing extension:",n)}}var s=Math.round(performance.now()-t);this.register_for_session({[Aa]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[La]:s}),this.config.__preview_deferred_init_extensions&&E.info("PostHog extensions initialized ("+s+"ms)")}Gi(e){var t;if(!S||!S.body)return E.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Gi(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this.Dn=e),this.dn=e,this.compression=void 0,e.ok){var r,s=e.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=M(s.supportedCompression,_e.GZipJS)?_e.GZipJS:M(s.supportedCompression,_e.Base64)?_e.Base64:void 0),(r=s.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.Sn?this.Sn:ss}),(t=this.Nn)==null||t.handleRemoteConfig(e),this.an.forEach((n=>n.onRemoteConfig==null?void 0:n.onRemoteConfig(e)))}On(){try{this.config.loaded(this)}catch(r){E.critical("`loaded` function failed",r)}if(this.qn(),this.config.internal_or_test_user_hostname&&ee!=null&&ee.hostname){var e=ee.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.mn())&&this.jn()}),1),this.Bn=new uo(this),this.Bn.load()}qn(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Pn)==null||e.enable())}_dom_loaded(){this.is_capturing()&&hi(this.__request_queue,(e=>this.Rn(e))),this.__request_queue=[],this.qn()}_handle_unload(){var e,t,r,s,n;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(t=this.metrics)==null||t.flush("sendBeacon"),this.config.request_batching?(this.Hn()&&this.capture(ur),(r=this.logs)==null||r.flushLogs("sendBeacon"),(s=this.Pn)==null||s.unload(),(n=this.An)==null||n.unload()):this.Hn()&&this.capture(ur,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?Io?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=b({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(x(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var r,s,n,a=b({},t);a.timeout=a.timeout||6e4;var o,l,u,c,h,d=(r=a.transport)!==null&&r!==void 0?r:"fetch";d==="sendBeacon"&&x(a.compression)&&a.data&&(a.compression=_e.Base64),a.method==="POST"&&a.data&&(a.timestampMode==="capture-body"?a.data={api_key:(l=(h=(c=O(o=a.data)?o:[o])[0])==null||(u=h.properties)==null?void 0:u.token)!==null&&l!==void 0?l:h?.token,batch:c,sent_at:new Date().toISOString()}:a.timestampMode==="body"&&(a.data=(function(m,_){return _===void 0&&(_=new Date().toISOString()),O(m)?m.map((k=>b({},k,{sent_at:_}))):b({},m,{sent_at:_})})(a.data))),a.url=Sn(a.url,a.method,a.compression,a.timestampMode);var p=Pi.filter((m=>!a.disableTransport||!m.transport||!a.disableTransport.includes(m.transport))),g=(s=(n=(function(m,_){for(var k=0;m.length>k;k++)if(m[k].transport===d)return m[k]})(p))==null?void 0:n.method)!==null&&s!==void 0?s:p[0].method;if(!g)throw new Error("No available transport method");var f=m=>{try{g(m)}catch(_){bo(_)?E.warn(_):E.error(_),a.callback==null||a.callback({statusCode:0,error:_})}};d!=="sendBeacon"&&a.data&&a.compression===_e.GZipJS&&Co&&typeof Promise<"u"&&!Si?du(a).then((m=>{f(m)})).catch((m=>{if(zs(m))return Si=!0,void f(b({},a,{compression:void 0,url:Sn(t.url,t.method,void 0,t.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;var k="name"in _?String(_.name):"";return zs(_)||k===Kn})(m)&&(Si=!0),f(a)})):g(a)})(b({},e,{callback:t=>{var r,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||(r=(s=this.config).on_request_error)==null||r.call(s,t),e.callback==null||e.callback(t)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}Rn(e){this.An?this.An.retriableRequest(e):this._send_request(e)}_execute_array(e){xr++;try{var t,r=[],s=[],n=[];hi(e,(o=>{if(o)if(O(t=o[0]))n.push(o);else if(Ee(o))try{o.call(this)}catch(l){E.error("Error executing queued PostHog call",o,l)}else O(o)&&t==="alias"?r.push(o):O(o)&&t.indexOf("capture")!==-1&&Ee(this[t])?n.push(o):s.push(o)}));var a=function(o,l){hi(o,(function(u){try{if(O(u[0])){var c=l;G(u,(function(h){c=c[h[0]].apply(c,h.slice(1))}))}else l[u[0]].apply(l,u.slice(1))}catch(h){E.error("Error executing queued PostHog call",u,h)}}))};a(r,this),a(s,this),a(n,this)}finally{xr--}}push(e){if(xr>0&&O(e)&&j(e[0])){var t=$e.prototype[e[0]];Ee(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,r){var s,n,a,o,l,u,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Pn){if(this.is_capturing())if(!x(e)&&j(e)){var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var d=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(d==null||!d.isRateLimited){if(this.wn.length>0){var p={};for(var g of this.wn.slice())try{Y(p,g())}catch(ne){E.error("Failed to produce browser extension event properties",ne)}t=b({},p,t??{})}var f;(s=t)!=null&&s.$current_url&&!j((n=t)==null?void 0:n.$current_url)&&(E.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),(f=t)==null||delete f.$current_url),e!=="$exception"||r!=null&&r.Un||E.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var m=new Date,_=r?.timestamp||m,k=Ks(r?.uuid,He),y={uuid:k,event:e,properties:this.calculateEventProperties(e,t||{},_,k)};e===_t&&this.config.__preview_capture_bot_pageviews&&h&&(y.event="$bot_pageview",y.properties.$browser_type="bot"),d&&(y.properties.$lib_rate_limit_remaining_tokens=d.remainingTokens);var P=e==="$feature_flag_called"&&y.properties.$feature_flag_has_experiment===!1&&this.get_property(Ai)===!0;r?.$set&&!P&&(y.$set=r?.$set);var F=r?.$unset;F&&(y.$unset=F);var C,L,w,T=P?void 0:this.zn(r?.$set_once,e!==tn,e===cr);if(T&&(y.$set_once=T),r!=null&&r._noTruncate||(o=this.config.properties_string_max_length,l=y,u=ne=>j(ne)?ne.slice(0,o):ne,c=new Set,y=(function ne(z,de){if(z!==Object(z))return u?u(z):z;if(!c.has(z)){var q;if(c.add(z),O(z))q=[],hi(z,(ae=>{q.push(ne(ae))}));else{var J={};G(z,((ae,ce)=>{c.has(ae)||(J[ce]=ne(ae))})),q=J}return q}})(l)),y.timestamp=_,x(r?.timestamp)||(y.properties.$event_time_override_provided=!0,y.properties.$event_time_override_system_time=m),P&&(y.properties=(function(ne,z){z===void 0&&(z=[]);var de={},q=J=>{ne[J]!==void 0&&(de[J]=ne[J])};return Mo.forEach(q),z.forEach(q),de})(y.properties,$u)),e===Ge.DISMISSED||e===Ge.SENT){var R,$,N=(R=t)==null?void 0:R[_r.SURVEY_ID],D=($=t)==null?void 0:$[_r.SURVEY_ITERATION];To({id:N,current_iteration:D}),y.$set=b({},y.$set,{[(C={id:N,current_iteration:D},L=e===Ge.SENT?"responded":"dismissed",w="$survey_"+L+"/"+C.id,C.current_iteration&&C.current_iteration>0&&(w="$survey_"+L+"/"+C.id+"/"+C.current_iteration),w)]:!0})}else e===Ge.SHOWN&&(y.$set=b({},y.$set,{[_r.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===su.SHOWN){var V,Q=(V=t)==null?void 0:V[yn.TOUR_TYPE];Q&&(y.$set=b({},y.$set,{[yn.TOUR_LAST_SEEN_DATE+"/"+Q]:new Date().toISOString()}))}var B=b({},y.properties.$set,y.$set);if(Ve(B)||this.setPersonPropertiesForFlags(B),!A(this.config.before_send)){var se=this.Pt(y);if(!se)return;(y=se).uuid=Ks(y.uuid,He)}this.vn.emit("eventCaptured",y);var X=(a=r?._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),pe={method:"POST",url:X,data:y,compression:"best-available",timestampMode:r?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(X)?"body":"capture-body",batchKey:r?._batchKey,transport:r?.transport};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Rn(pe):this.Pn.enqueue(pe),y}E.critical("This capture call is ignored due to client rate limiting.")}}else E.error("No event name provided to posthog.capture")}else E.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}Wn(){var e;return(e=this.Nn)!==null&&e!==void 0?e:this.Nn=new Tu(this)}fn(e){this.wn.push(e);var t=!0;return()=>{if(t){t=!1;var r=this.wn.indexOf(e);r!==-1&&this.wn.splice(r,1)}}}calculateEventProperties(e,t,r,s,n){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;var a=n?void 0:this.persistence.remove_event_timer(e),o=b({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.mn()&&(o[Na]=!0),e==="$snapshot"){var l=b({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!j(o.distinct_id)&&!ue(o.distinct_id)||Nr(o.distinct_id))&&E.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u,c=(function(y,P,F,C){var L,w,T,R;if(C===void 0&&(C=!1),!we)return{};var $,N=y?[...Ft,...P||[]]:[],D=(function(ni){for(var $t=0;Ws.length>$t;$t++){var ai=Ws[$t],Pe=ai[1],oi=ai[0].exec(ni),It=oi&&(Ee(Pe)?Pe(oi,ni):Pe);if(It)return It}return["",""]})(we),V=D[0],Q=D[1],B=($=typeof navigator<"u"?navigator:void 0)!=null&&$.brave?{brave:!0}:{},se={};x(F)||(se.detectGoogleSearchApp=F);var X={},pe=(L=navigator)==null||(L=L.userAgentData)==null?void 0:L.platform,ne=(w=navigator)==null?void 0:w.maxTouchPoints,z=v==null||(T=v.screen)==null?void 0:T.width,de=v==null||(R=v.screen)==null?void 0:R.height,q=v?.devicePixelRatio;x(pe)||(X.userAgentDataPlatform=pe),x(ne)||(X.maxTouchPoints=ne),x(z)||(X.screenWidth=z),x(de)||(X.screenHeight=de),x(q)||(X.devicePixelRatio=q);var J,ae,ce,Ye,fe,Re,Ke,be,Ce=Y(Fs({$os:V,$os_version:Q,$browser:ba(we,navigator.vendor,B,se),$device:Ys(we),$device_type:(ae=we,ce=X,be=Ys(ae),be===ia||be===ta||be==="Kobo"||be==="Kindle Fire"||be===ga?Et:be===Qt||be===xt||be===Xt||be===Lr?"Console":be===sa?"Wearable":be?Se:ce?.userAgentDataPlatform==="Android"&&((Ye=ce?.maxTouchPoints)!==null&&Ye!==void 0?Ye:0)>0?600>Math.min((fe=ce?.screenWidth)!==null&&fe!==void 0?fe:0,(Re=ce?.screenHeight)!==null&&Re!==void 0?Re:0)/((Ke=ce?.devicePixelRatio)!==null&&Ke!==void 0?Ke:1)?Se:Et:"Desktop"),$timezone:lo(),$timezone_offset:tu()}),{$current_url:ri(C?Ze(ee?.href):ee?.href,N,si),$host:ee?.host,$pathname:ee?.pathname,$raw_user_agent:we.length>1e3?we.substring(0,997)+"...":we,$browser_version:Qo(we,navigator.vendor,B,se),$browser_language:mn(),$browser_language_prefix:(J=mn(),typeof J=="string"?J.split("-")[0]:void 0),$screen_height:v?.screen.height,$screen_width:v?.screen.width,$viewport_height:v?.innerHeight,$viewport_width:v?.innerWidth,$lib: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&&(Ce.$sdk_dist_channel=U.SDK_DIST_CHANNEL),Ce})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var h=this.sessionManager.checkAndGetSessionAndWindowId(n,r.getTime()),d=h.windowId;o.$session_id=h.sessionId,o.$window_id=d}this.sessionPropsManager&&Y(o,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&Y(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(p=this.An)==null?void 0:p.length}catch(y){o.$sdk_debug_error_capturing_properties=String(y)}if(this.requestRouter.region===vs&&(o.$lib_custom_api_host=this.config.api_host),u=e!==_t||n?e!==ur||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),o=Y(o,u),e===_t&&S&&(o.title=S.title),!x(a)){var g=r.getTime()-a;o.$duration=parseFloat((g/1e3).toFixed(3))}we&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser");var f=this.persistence.properties(),m=this.sessionPersistence.properties();G(["$referrer","$referring_domain"],(y=>{y in f&&delete m[y]})),(o=Y({},c,f,m,o)).$is_identified=this._isIdentified(),O(this.config.property_denylist)?G(this.config.property_denylist,(function(y){delete o[y]})):E.error($o+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(E.error(Rn),o=_(o,e));var k=this.Vn();return o.$process_person_profile=k,k&&!n&&this.Zn("_calculate_event_properties"),o}zn(e,t,r){var s;if(t===void 0&&(t=!0),r===void 0&&(r=!1),!this.persistence||!this.Vn()||this.yn&&!r)return e;var n=this.persistence.get_initial_props(),a=(s=this.sessionPropsManager)==null?void 0:s.getSetOnceProps(),o=Y({},n,a||{},e||{}),l=this.config.sanitize_properties;return l&&(E.error(Rn),o=l(o,"$set_once")),t&&(this.yn=!0),Ve(o)?void 0:o}register(e,t){var r;(r=this.persistence)==null||r.register(e,t)}register_once(e,t,r){var s;(s=this.persistence)==null||s.register_once(e,t,r)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e),Object.keys(e).forEach((r=>this.bn.add(r))),this.Gn()}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.bn.delete(e),this.Gn()}Qn(e,t){this.register({[e]:t})}Fn(){this.bn.forEach((e=>{var t;(t=this.sessionPersistence)==null||t.unregister(e)})),this.bn.clear(),this.Gn()}Gn(){var e;if(this._n)if(this.config.persistence==="memory"||(e=this.sessionPersistence)!=null&&e.xi||!le.N())le.q(this._n);else{var t=[];this.bn.forEach((r=>t.push(r))),t.length>0?le.F(this._n,t):le.q(this._n)}}getFeatureFlag(e,t){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return(t=this.featureFlags)==null?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var r;return(r=this.featureFlags)==null?void 0:r.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 r,s;return(r=(s=this.featureFlags)==null?void 0:s.isFeatureEnabled(e,t))!==null&&r!==void 0?r:t?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,r){var s;(s=this.featureFlags)==null||s.updateFlags(e,t,r)}updateEarlyAccessFeatureEnrollment(e,t,r){var s;(s=this.featureFlags)==null||s.updateEarlyAccessFeatureEnrollment(e,t,r)}getEarlyAccessFeatures(e,t,r){var s;return t===void 0&&(t=!1),(s=this.featureFlags)==null?void 0:s.getEarlyAccessFeatures(e,t,r)}on(e,t){return this.vn.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:Dt}),()=>{})}onSessionId(e){var t,r;return(t=(r=this.sessionManager)==null?void 0:r.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:Dt})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Dt})}renderSurvey(e,t){var r;(r=this.surveys)==null||r.renderSurvey(e,t)}displaySurvey(e,t){var r;t===void 0&&(t=xu),(r=this.surveys)==null||r.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,r;return(t=(r=this.surveys)==null?void 0:r.canRenderSurvey(e))!==null&&t!==void 0?t:{visible:!1,disabledReason:Dt}}canRenderSurveyAsync(e,t){var r,s;return t===void 0&&(t=!1),(r=(s=this.surveys)==null?void 0:s.canRenderSurveyAsync(e,t))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:Dt})}Kn(e){return!e||Nr(e)?(E.critical("Unique user id has not been set in posthog.identify"),!1):e===ci?(E.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(E.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,r){if(!this.__loaded||!this.persistence)return E.uninitializedWarning("posthog.identify");if(ue(e)&&(e=e.toString(),E.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Kn(e)&&this.Zn("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(ei)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(Ht)&&(this.unregister(Ht),this.register({distinct_id:e}));var n,a=(this.persistence.get_property(Te)||dt)===dt,o=e!==s,l=!o&&a;if(o&&a)this.persistence.set_property(Te,Xe),this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!1),this.capture(cr,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:r||{}}),this.Cn=wr(e,t,r),(n=this.featureFlags)==null||n.setAnonymousDistinctId(s);else if(l){this.persistence.set_property(Te,Xe);var u=t||{},c=r||{};this.setPersonPropertiesForFlags({$set:u,$set_once:c},!1),this.capture("$set",{$set:u,$set_once:c}),this.Cn=wr(e,t,r)}else(t||r)&&this.setPersonProperties(t,r);o?(this.reloadFeatureFlags(),this.unregister(Yt)):l&&(t||r)&&this.reloadFeatureFlags()}}setPersonProperties(e,t){if((e||t)&&this.Zn("posthog.setPersonProperties")){var r=wr(this.get_distinct_id(),e,t);this.Cn!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Cn=r):E.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,r=(O(e)?e:[e]).filter((s=>j(s)&&s.length>0));r.length!==0&&this.Zn("posthog.unsetPersonProperties")&&((t=this.featureFlags)==null||t.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.Cn=null)}group(e,t,r){if(e&&t){var s=this.getGroups(),n=s[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:b({},s,{[e]:t})}),n||r){var a={$group_type:e,$group_key:t};r&&(a.$group_set=r),this.capture(tn,a)}r&&this.setGroupPropertiesForFlags({[e]:r}),n&&!r&&this.reloadFeatureFlags()}else E.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var r;t===void 0&&(t=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;e===void 0&&(e=!0),(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var r;t===void 0&&(t=!0),this.Zn("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){this.Jn(e)}Jn(e,t){var r,s,n,a,o,l,u,c,h,d;if(t===void 0&&(t=!1),E.info("reset"),!this.__loaded)return E.uninitializedWarning("posthog.reset");var p,g=this.get_property(ei),f=this.get_property(lr),m=this.get_property(ut),_=this.is_capturing();if(this.consent.reset(),t||!_||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."),(r=this.persistence)==null||r.clear(),(s=this.sessionPersistence)==null||s.clear(),this.bn.clear(),this.Gn(),x(m)||(p=this.persistence)==null||p.register({[ut]:m}),(n=this.surveys)==null||n.reset(),(a=this.Bn)==null||a.stop(),(o=this.featureFlags)==null||o.reset(),(l=this.conversations)==null||l.reset(),(u=this.logs)==null||u.reset(),(c=this.metrics)==null||c.reset(),(h=this.persistence)==null||h.set_property(Te,dt),(d=this.sessionManager)==null||d.resetSessionId(),this.Cn=null,this.config.cookieless_mode===Ue)this.register_once({distinct_id:ci,$device_id:null},"");else{var k=this.config.get_device_id(He());this.register_once({distinct_id:k,$device_id:e?k:g},""),e||x(f)||this.register({[lr]:f})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var t=this;return Z((function*(){var r,s,n,a,o,l,u,c;t.__loaded?((r=t.Bn)==null||r.stop(),(s=t.Nn)==null||s.dispose(),(n=t.sessionRecording)==null||n.dispose(),(a=t.logs)==null||a.flushLogs("sendBeacon"),(o=t.metrics)==null||o.flush("sendBeacon"),(l=t.Pn)==null||l.unload(),(u=t.An)==null||u.unload(),(c=t.featureFlags)==null||c.destroy()):E.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,t){var r;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(r=this.conversations)==null||r.Yn()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.Xn()}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),r=t.sessionStartTimestamp,s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(e!=null&&e.withTimestamp&&r){var n,a=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!r)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-a,0)}return s}alias(e,t){return e===this.get_property($a)?(E.critical("Attempting to create alias for existing People user - aborting."),-2):this.Zn("posthog.alias")?(x(t)&&(t=this.get_distinct_id()),e!==t?(this.Qn(Ht,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(E.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=b({},this.config);if(K(e)){var r,s,n,a,o,l,u,c,h,d,p;Y(this.config,Cn(e));var g=this.In();(r=this.persistence)==null||r.update_config(this.config,t,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new gr(b({},this.config,{persistence:"sessionStorage"}),g,!1);var f=this.Mn(this.config.debug);Me(f)&&(this.config.debug=f),Me(this.config.debug)&&(this.config.debug?(U.DEBUG=!0,W.N()&&W.F("ph_debug",!0),E.info("set_config",{config:e,oldConfig:t,newConfig:b({},this.config)})):(U.DEBUG=!1,W.N()&&W.q("ph_debug"))),(s=this.exceptionObserver)==null||s.onConfigChange(),(n=this.exceptions)==null||n.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(o=this.tracingHeaders)==null||o.startIfEnabledOrStop(),(l=this.autocapture)==null||l.startIfEnabled(),(u=this.heatmaps)==null||u.startIfEnabled(),(c=this.exceptionObserver)==null||c.startIfEnabledOrStop(),(h=this.deadClicksAutocapture)==null||h.startIfEnabledOrStop(),(d=this.surveys)==null||d.loadIfEnabled(),this.ts(),(p=this.externalIntegrations)==null||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){U.LIB_NAME=e,U.LIB_VERSION=t}startSessionRecording(e){var t,r,s,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&&((r=this.sessionRecording)==null||r.overrideSampling()),l.linked_flag&&((s=this.sessionRecording)==null||s.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 r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(b({},s,t))}}addExceptionStep(e,t){var r;(r=this.exceptions)==null||r.addExceptionStep(e,t)}captureLog(e){var t;(t=this.logs)==null||t.captureLog(e)}get logger(){var e,t;return(e=(t=this.logs)==null?void 0:t.logger)!==null&&e!==void 0?e:$e.es}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,r;return(t=(r=this.toolbar)==null?void 0:r.loadToolbar(e))!==null&&t!==void 0&&t}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:mt;return t!==mt&&(t=mt+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(Te))===Xe||((t=this.sessionPersistence)==null?void 0:t.get_property(Te))===Xe}Vn(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles===ss&&!this._isIdentified()&&Ve(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Ht])&&((t=this.persistence)==null||(t=t.props)==null||!t[ji]))}Hn(){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.Vn()||this.Zn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Zn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Zn(e){return this.config.person_profiles==="never"?(E.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Qn(ji,!0),!0)}In(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ot)}ts(){var e,t,r,s,n=this.In();return((e=this.persistence)==null?void 0:e.xi)!==n&&((r=this.persistence)==null||r.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.xi)!==n&&((s=this.sessionPersistence)==null||s.set_disabled(n)),n&&(this.bn.clear(),this.Gn()),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==Ue){if(this.mn()){var r,s,n,a,o;this.Jn(!0,!0),(r=this.sessionManager)==null||r.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new Fn(this),this.pageViewManager=new _n(this),this.persistence&&(this.sessionPropsManager=new Pn(this,this.sessionManager,this.persistence));var l,u=(n=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&n!==void 0?n:(o=$e.__defaultExtensionClasses)==null?void 0:o.sessionRecording;u&&(this.sessionRecording=this.gn(this.sessionRecording,new u(this)),this.dn&&((l=this.sessionRecording)==null||l.onRemoteConfig==null||l.onRemoteConfig(this.dn)))}var c,h;this.consent.optInOut(!0),this.ts(),this.qn(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==ot&&((c=this.surveys)==null||c.loadIfEnabled()),(x(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((h=e?.captureEventName)!==null&&h!==void 0?h:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.jn()}else E.warn(In)}opt_out_capturing(){var e,t,r;this.config.cookieless_mode!==Ue?(this.config.cookieless_mode===ot&&this.consent.isOptedIn()&&this.Jn(!0,!0),this.consent.optInOut(!1),this.ts(),this.config.cookieless_mode===ot&&(this.register({distinct_id:ci,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.jn(),this.qn())):E.warn(In)}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===Ue||(this.config.cookieless_mode===ot?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.ts()}_is_bot(){return me?xo(me,this.config.custom_blocked_useragents):void 0}jn(){S&&(S.visibilityState==="visible"?this.kn||(this.kn=!0,this.capture(_t,{title:S.title},{send_instantly:!0}),this.xn&&(S.removeEventListener(qi,this.xn),this.xn=null)):this.xn||(this.xn=this.jn.bind(this),te(S,qi,this.xn)))}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}))}Ki(){var e=this.Tn||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(E.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(t,r,s,n,a){var o=r in t&&!A(t[r]),l=s in t&&!A(t[s]);return o?t[r]:!!l&&(a&&a.warn("Config field '"+s+"' is deprecated. Please use '"+r+"' instead. The old field will be removed in a future major version."),t[s])})(e,"advanced_disable_flags","advanced_disable_decide",0,E)}Pt(e){var t;if(A(this.config.before_send))return e;var r=Object.keys((t=e.properties)!==null&&t!==void 0?t:{}).filter(qo),s=O(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var a of s){if(n=a(n),A(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return jo(e.event)?E.warn(o+". This can cause unexpected behavior."):E.info(o),null}n.properties&&!Ve(n.properties)||E.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var l of r)if(n.properties&&A(n.properties[l]))return E.warn("Event '"+e.event+"' had its '"+l+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return n}getPageViewId(){var e;return(e=this.pageViewManager.ui)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(r)})}Mn(e){var t=Me(e)&&!e,r=W.N()&&W.P("ph_debug")==="true";return!t&&(!!r||e)}}$e.__defaultExtensionClasses={},$e.es=(()=>{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]]=Tl(i.prototype[e[t]])})($e,["identify"]);class Mn{constructor(e){this.disabled=e===!1;var t=K(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,r){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>r-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}}var kr="$copy_autocapture",Sr=re("[AutoCapture]");function Pr(i,e){return e.length>i?e.slice(0,i)+"...":e}function Cu(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!Qe(e));return e}function Mu(i,e){var t,r,s=e.e,n=e.maskAllElementAttributes,a=e.maskAllText,o=e.elementAttributeIgnoreList,l=e.elementsChainAsString,u=e.disableCaptureUrlHashes;if(!Qe(i))return{props:{}};for(var c=[i],h=new Set([i]),d=i;d.parentNode&&!ke(d,"body")&&Ga>c.length;)if(za(d.parentNode)){var p=d.parentNode.host;if(h.has(p))break;h.add(p),c.push(p),d=p}else{if(!Qe(d.parentNode)||h.has(d.parentNode))break;h.add(d.parentNode),c.push(d.parentNode),d=d.parentNode}var g,f,m=[],_={},k=!1,y=!1;if(G(c,(w=>{var T=os(w);if(ke(w,"a")){var R=w.getAttribute("href");k=!!(T&&R&&Kt(R))&&(u?Ze(R):R)}M(Ui(w),"ph-no-capture")&&(y=!0),m.push((function(N,D,V,Q,B){B===void 0&&(B=!1);var se=N.tagName.toLowerCase(),X={tag_name:se};$s.indexOf(se)>-1&&!V&&(X.$el_text=se.toLowerCase()==="a"||se.toLowerCase()==="button"?Pr(1024,vn(N)):Pr(1024,ii(N)));var pe=Ui(N);pe.length>0&&(X.classes=pe.filter((function(q){return q!==""}))),G(N.attributes,(function(q){var J;if((!Ja(N)||["name","id","class","aria-label"].indexOf(q.name)!==-1)&&(Q==null||!Q.includes(q.name))&&!D&&Kt(q.value)&&(!j(J=q.name)||J.substring(0,10)!=="_ngcontent"&&J.substring(0,7)!=="_nghost")){var ae=q.value;q.name==="class"&&(ae=Ts(ae).join(" ")),X["attr__"+q.name]=Pr(1024,q.name==="href"&&B?Ze(ae):ae)}}));for(var ne=1,z=1,de=N;de=Cu(de);)ne++,de.tagName===N.tagName&&z++;return X.nth_child=ne,X.nth_of_type=z,X})(w,n,a,o,u));var $=(function(N){if(!os(N))return{};var D={};return G(N.attributes,(function(V){if(V.name&&V.name.indexOf("data-ph-capture-attribute")===0){var Q=V.name.replace("data-ph-capture-attribute-",""),B=V.value;Q&&B&&Kt(B)&&(D[Q]=B)}})),D})(w);Y(_,$)})),y)return{props:{},explicitNoCapture:y};if(a||(m[0].$el_text=ke(i,"a")||ke(i,"button")?vn(i):ii(i)),k){var P,F;m[0].attr__href=k;var C=(P=zi(k))==null?void 0:P.host,L=v==null||(F=v.location)==null?void 0:F.host;C&&L&&C!==L&&(g=k)}return{props:Y({$event_type:s.type,$ce_version:1},l?{}:{$elements:m},{$elements_chain:(f=m,(function(w){return w.map((T=>{var R,$,N="";if(T.tag_name&&(N+=T.tag_name),T.attr_class)for(var D of(T.attr_class.sort(),T.attr_class))N+="."+D.replace(/"/g,"");var V=b({},T.text?{text:T.text}:{},{"nth-child":(R=T.nth_child)!==null&&R!==void 0?R:0,"nth-of-type":($=T.nth_of_type)!==null&&$!==void 0?$:0},T.href?{href:T.href}:{},T.attr_id?{attr_id:T.attr_id}:{},T.attributes),Q={};return ki(V).sort(((B,se)=>B[0].localeCompare(se[0]))).forEach((B=>{var se=B[1];return Q[gn(B[0].toString())]=gn(se.toString())})),(N+=":")+ki(Q).map((B=>B[0]+'="'+B[1]+'"')).join("")})).join(";")})((function(w){return w.map((T=>{var R,$,N={text:(R=T.$el_text)==null?void 0:R.slice(0,400),tag_name:T.tag_name,href:($=T.attr__href)==null?void 0:$.slice(0,2048),attr_class:Wl(T),attr_id:T.attr__id,nth_child:T.nth_child,nth_of_type:T.nth_of_type,attributes:{}};return ki(T).filter((D=>D[0].indexOf("attr__")===0)).forEach((D=>N.attributes[D[0]]=D[1])),N}))})(f)))},(t=m[0])!=null&&t.$el_text?{$el_text:(r=m[0])==null?void 0:r.$el_text}:{},g&&s.type==="click"?{$external_click_url:g}:{},_)}}var jt=re("[ExceptionAutocapture]"),On=()=>{},Ou=re("[TracingHeaders]"),it=re("[Web Vitals]"),Nn=9e5,An="disabled",Ln="lazy_loading",qt="awaiting_config",_i="missing_config";re("[SessionRecording]"),re("[SessionRecording]");var gs="[SessionRecording]",De=re(gs),Nu=re("[Heatmaps]");function Fr(i){return K(i)&&"clientX"in i&&"clientY"in i&&ue(i.clientX)&&ue(i.clientY)}var mi=re("[Product Tours]"),Tr=i=>{var e;return!i.config.disable_product_tours&&!((e=i.persistence)==null||!e.get_property(ks))},Au=["$set_once","$set"],Oe=re("[SiteApps]"),Dn="Error while initializing PostHog app with config id ";function gt(i,e,t){if(A(i))return!1;switch(t){case"exact":return i===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(i);case"regex":try{return new RegExp(e).test(i)}catch{return!1}default:return!1}}class Lu{constructor(e){this.rs=new Ms,this.ns=(t,r)=>this.ss(t,r)&&this.os(t,r)&&this.ls(t,r)&&this.us(t,r),this.ss=(t,r)=>r==null||!r.event||t?.event===r?.event,this._instance=e,this.hs=new Set,this.ds=new Set}init(){var e,t;x((e=this._instance)==null?void 0:e._addCaptureHook)||(t=this._instance)==null||t._addCaptureHook(((r,s)=>{this.on(r,s)}))}register(e){var t,r;if(!x((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((a=>{var o,l;(o=this.ds)==null||o.add(a),(l=a.steps)==null||l.forEach((u=>{var c;(c=this.hs)==null||c.add(u?.event||"")}))})),(r=this._instance)!=null&&r.autocapture)){var s,n=new Set;e.forEach((a=>{var o;(o=a.steps)==null||o.forEach((l=>{l!=null&&l.selector&&n.add(l?.selector)}))})),(s=this._instance)==null||s.autocapture.setElementSelectors(n)}}on(e,t){var r;t!=null&&e.length!=0&&(this.hs.has(e)||this.hs.has(t.event))&&this.ds&&((r=this.ds)==null?void 0:r.size)>0&&this.ds.forEach((s=>{this.vs(t,s)&&this.rs.emit("actionCaptured",s.name)}))}cs(e){this.onAction("actionCaptured",(t=>e(t)))}vs(e,t){if(t?.steps==null)return!1;for(var r of t.steps)if(this.ns(e,r))return!0;return!1}onAction(e,t){return this.rs.on(e,t)}os(e,t){if(t!=null&&t.url){var r,s=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!s||typeof s!="string"||!gt(s,t.url,t.url_matching||"contains"))return!1}return!0}ls(e,t){return!!this.fs(e,t)&&!!this.ps(e,t)&&!!this.gs(e,t)}fs(e,t){var r;if(t==null||!t.href)return!0;var s=this.ys(e);if(s.length>0)return s.some((o=>gt(o.href,t.href,t.href_matching||"exact")));var n,a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!a&&gt((n=a.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}ps(e,t){var r;if(t==null||!t.text)return!0;var s=this.ys(e);if(s.length>0)return s.some((u=>gt(u.text,t.text,t.text_matching||"exact")||gt(u.$el_text,t.text,t.text_matching||"exact")));var n,a,o,l=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!l&&(n=(function(u){for(var c,h=[],d=/(?::|")text="(.*?)"/g;!A(c=d.exec(u));)h.includes(c[1])||h.push(c[1]);return h})(l),a=t.text,o=t.text_matching||"exact",n.some((u=>gt(u,a,o))))}gs(e,t){var r,s;if(t==null||!t.selector)return!0;var n=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch{return!1}return!1}ys(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}us(e,t){return t==null||!t.properties||t.properties.length===0||So(t.properties.reduce(((r,s)=>{var n=O(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return r[s.key]={values:n,operator:s.operator||"exact"},r}),{}),e?.properties)}}class Du{constructor(e){var t;this.bs=[],this._instance=e,this._s=new Map,this.ws=new Map,this.ks=new Map,(t=this._instance)==null||t.onSessionId==null||t.onSessionId((r=>this.xs(r)))}Ss(e){return!1}Cs(){return null}Ms(e){}Ts(){}Es(e,t){return!!e&&So(e.propertyFilters,t?.properties)}Is(e,t){var r=new Map;return e.forEach((s=>{var n;(n=s.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEach((a=>{if(a!=null&&a.name){var o=r.get(a.name)||[];o.push(s.id),r.set(a.name,o)}}))})),r}Ps(e,t,r){var s=(r===Ot.Activation?this._s:this.ws).get(e),n=[];return this.Rs((a=>{n=a.filter((o=>s?.includes(o.id)))})),n.filter((a=>{var o,l=(o=a.conditions)==null||(o=o[r])==null||(o=o.values)==null?void 0:o.find((u=>u.name===e));return this.Es(l,t)}))}register(e){var t;x((t=this._instance)==null?void 0:t._addCaptureHook)||(this.As(e),this.Fs(e))}Fs(e){var t=e.filter((r=>{var s,n;return((s=r.conditions)==null?void 0:s.actions)&&((n=r.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.Ls==null&&(this.Ls=new Lu(this._instance),this.Ls.init(),this.Ls.cs((r=>{this.onAction(r)}))),t.forEach((r=>{var s,n,a,o,l;r.conditions&&(s=r.conditions)!=null&&s.actions&&(n=r.conditions)!=null&&(n=n.actions)!=null&&n.values&&((a=r.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((o=this.Ls)==null||o.register(r.conditions.actions.values),(l=r.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((u=>{if(u&&u.name){var c=this.ks.get(u.name);c&&c.push(r.id),this.ks.set(u.name,c||[r.id])}})))})))}As(e){var t,r=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})),s=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}));r.length===0&&s.length===0||((t=this._instance)==null||t._addCaptureHook(((n,a)=>{this.onEvent(n,a)})),this._s=this.Is(e,Ot.Activation),this.ws=this.Is(e,Ot.Cancellation))}onEvent(e,t){var r,s,n=this.Os(),a=(t==null||(r=t.properties)==null?void 0:r.$survey_id)||(t==null||(s=t.properties)==null?void 0:s.$product_tour_id);if(a&&this.getActivatedIds().includes(a)){var o=this.Ds(e,a);if(o==="consume")return n.info("event consumed activated item, removing it",{event:e,itemId:a}),void this.$s([a]);if(o==="persist")return n.info("shown item promoted to persisted activation",{event:e,itemId:a}),this.Ns(a),void this.qs([a])}if(this.ws.has(e)){var l=this.Ps(e,t,Ot.Cancellation);l.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:l.map((c=>c.id))}),this.$s(l.map((c=>c.id))),l.forEach((c=>this.js(c.id))))}if(this._s.has(e)){n.info("event name matched",{event:e,eventPayload:t,items:this._s.get(e)});var u=this.Ps(e,t,Ot.Activation);this.Bs(u.map((c=>c.id)))}}onAction(e){this.ks.has(e)&&this.Bs(this.ks.get(e)||[])}Bs(e){var t;if(e.length!==0){var r=!((t=this._instance)==null||t.get_session_id==null||!t.get_session_id()),s=[];for(var n of e)r&&this.Ss(n)?this.Ns(n)&&this.Hs(n):s.push(n);s.length>0&&(this.bs=[...new Set([...this.bs,...s])]),this.Os().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Ns(e){this.bs=this.bs.filter((r=>r!==e));var t=this.Us();return!t.includes(e)&&(this.zs([...t,e]),this.Ws(),!0)}$s(e){var t=new Set(e);this.bs=this.bs.filter((n=>!t.has(n)));var r=this.Vs(),s=r.filter((n=>!t.has(n)));s.length!==r.length&&(this.zs(s),s.length===0&&this.Zs()),this.qs(e)}Gs(){var e,t=this.Cs();if(!t)return{};var r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return r&&typeof r=="object"?r:{}}Hs(e){if(this.Cs()){var t=this.Gs();this.Ms(b({},t,{[e]:Date.now()}))}}qs(e){if(this.Cs()){var t=this.Gs(),r={},s=!1;for(var n of Object.entries(t)){var a=n[0],o=n[1];e.includes(a)?s=!0:r[a]=o}s&&(Ve(r)?this.Ts():this.Ms(r))}}Qs(){this.Cs()&&this.Ts()}getActivationTimestamp(e){if(this.Us().includes(e)){var t=this.Gs()[e];return ue(t)?t:void 0}}Vs(){var e,t=this.Ks();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}Us(){var e,t,r=this.Vs();if(r.length===0)return[];var s=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this.Js()],n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();return n&&s===n?r:[]}Ws(){var e,t=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();t&&this.Ys(t)}Zs(){this.Xs()}xs(e){var t,r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.Js()];if(r&&r!==e){var s=this.Vs(),n=this.Gs();s.length>0&&(this.zs([]),s.filter((a=>ue(n[a]))).forEach((a=>this.js(a)))),this.Zs(),this.Qs()}}getActivatedIds(){return[...new Set([...this.Us(),...this.bs])].filter((e=>!this.ta(e)))}reset(){this.bs=[],this.Vs().length>0&&this.zs([]),this.Zs(),this.Qs()}getEventToItemsMap(){return this._s}ea(){return this.Ls}}class ju extends Du{constructor(e){super(e)}Ks(){return Zr}Js(){return xi}Cs(){return Ei}Ms(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Ei]:e})}Ts(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(Ei)}Ss(e){var t,r;this.Rs((n=>{r=n.find((a=>a.id===e))}));var s=(t=r)==null||(t=t.appearance)==null?void 0:t.surveyPopupDelaySeconds;return ue(s)&&s>0}ia(){return Ge.SHOWN}Rs(e){var t;(t=this._instance)==null||t.getSurveys(e)}js(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}Os(){return H}zs(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Zr]:e})}Ys(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[xi]:e})}Xs(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(xi)}ta(){return!1}Ds(e,t){var r;this.Rs((n=>{r=n.find((a=>a.id===t))}));var s=!r||(function(n){var a;return Po(n)&&!((a=n.conditions)==null||(a=a.events)==null||!a.repeatedActivation)||n.schedule==="always"})(r);return s?e===Ge.SHOWN?"consume":"ignore":e===Ge.SHOWN?"persist":e===Ge.DISMISSED||e===Ge.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var yi="SDK is not enabled or survey functionality is not yet loaded",jn="Disabled. Not loading surveys.",qu=v!=null&&v.location?Gi(v.location.hash,"__posthog")||Gi(location.hash,"state"):null,qn="_postHogToolbarParams",Bn=re("[Toolbar]"),he=re("[FeatureFlags]"),rt=re("[FeatureFlags]",{debugEnabled:!0}),$r=`" failed. Feature flags didn't load in time.`,Hn=i=>{for(var e={},t=0;i.length>t;t++)e[i[t]]=!0;return e},Un=i=>{var e={};for(var t of ki(i||{})){var r=t[1];r&&(e[t[0]]=r)}return e},Ne=re("[Error tracking]"),zn="Refusing to render web experiment since the viewer is a likely bot",Bu={icontains:(i,e)=>e.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>e.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>Yi(e,i),not_regex:(i,e)=>!Yi(e,i),exact:(i,e)=>e===i,is_not:(i,e)=>e!==i};class ve{get Ne(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),t.getWebExperiments((s=>{ve.ra("retrieved web experiments from the server"),t.na=new Map,s.forEach((n=>{if(n.feature_flag_key){var a;t.na&&(ve.ra("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=t.na)==null||a.set(n.feature_flag_key,n));var o=t._instance.getFeatureFlag(n.feature_flag_key);j(o)&&n.variants[o]&&t.sa(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var u=n.variants[l];ve.aa(u,t._instance)&&t.sa(n.name,l,u.transforms)}}))}),r)},this._instance=e,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())ve.ra(zn);else if(!this.Ne.disable_web_experiments){if(A(this.na))return this.na=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ve.ra("applying feature flags",e),e.forEach((t=>{var r;if(this.na&&(r=this.na)!=null&&r.has(t)){var s,n=this._instance.getFeatureFlag(t),a=(s=this.na)==null?void 0:s.get(t);n&&a!=null&&a.variants[n]&&this.sa(a.name,n,a.variants[n].transforms)}}))}}previewWebExperiment(){var e=ve.getWindowLocation();if(e!=null&&e.search){var t=Pt(e?.search,"__experiment_id"),r=Pt(e?.search,"__experiment_variant");t&&r&&(ve.ra("previewing web experiments "+t+" && "+r),this.getWebExperiments((s=>{this.oa(parseInt(t),r,s)}),!1,!0))}}loadIfEnabled(){this.Ne.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this.Ne.disable_web_experiments&&!r)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Ne.token),method:"GET",timestampMode:"query",callback:n=>e(n.statusCode===200&&n.json&&n.json.experiments||[])})}oa(e,t,r){var s=r.filter((n=>n.id===e));s&&s.length>0&&(ve.ra("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.sa(s[0].name,t,s[0].variants[t].transforms))}static aa(e,t){return!A(e.conditions)&&ve.la(e,t)&&ve.ua(e)}static la(e,t){var r;if(A(e.conditions)||A((r=e.conditions)==null?void 0:r.url))return!0;var s=ve.getWindowLocation();if(s){var n,a,o,l=Ba(t,s.href);return(n=e.conditions)==null||!n.url||Bu[(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 ua(e){var t;if(A(e.conditions)||A((t=e.conditions)==null?void 0:t.utm))return!0;var r=io();if(r.utm_source){var s,n,a,o,l,u,c,h,d=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==r.utm_campaign,p=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==r.utm_source,g=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==r.utm_medium,f=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==r.utm_term;return d&&g&&f&&p}return!1}static ra(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;t>s;s++)r[s-1]=arguments[s];E.info("[WebExperiments] "+e,r)}sa(e,t,r){this._is_bot()?ve.ra(zn):t!=="control"?r.forEach((s=>{if(s.selector){var n;ve.ra("applying transform of variant "+t+" for experiment "+e+" ",s);var a=(n=document)==null?void 0:n.querySelectorAll(s.selector);a?.forEach((o=>{var l=o;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)}))}})):ve.ra("Control variants leave the page unmodified.")}_is_bot(){return me&&this._instance?xo(me,this.Ne.custom_blocked_useragents):void 0}}var Fe=re("[Conversations]"),st="Conversations not available yet.",Gn="console",Ro="__posthogHandledLogsRequestError",Ir=(i,e)=>{var t=i instanceof Error?i:new Error(e);return t[Ro]=!0,t},Vn=i=>!!i&&typeof i=="object"&&i[Ro]===!0,Xi={featureFlags:class{constructor(i){this.ha=!1,this.da=!1,this.va=!1,this.ca=!1,this.fa=!1,this.pa=!1,this.ga=!1,this.ma=!1,this.ya=0,this.ba=()=>{var e=this._a();this.ya=0,e&&this.reloadFeatureFlags()},this._instance=i,this.featureFlagEventHandlers=[],v&&te(v,"online",this.ba)}destroy(){v?.removeEventListener("online",this.ba)}get Ne(){return this._instance.config}get Tr(){return this._instance.persistence}wa(i){return this._instance.get_property(i)}ka(){var i,e;return(i=(e=this.Tr)==null?void 0:e.Ci(this.Ne.feature_flag_cache_ttl_ms))!==null&&i!==void 0&&i}xa(){return!!this.ka()&&(this.ma||this.va||(this.ma=!0,he.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Sa(){var i,e=(i=this.Ne.evaluation_contexts)!==null&&i!==void 0?i:this.Ne.evaluation_environments;return!this.Ne.evaluation_environments||this.Ne.evaluation_contexts||this.ga||(he.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ga=!0),e!=null&&e.length?e.filter((t=>{var r=t&&typeof t=="string"&&t.trim().length>0;return r||he.error("Invalid evaluation context found:",t,"Expected non-empty string"),r})):[]}Ca(){return this.Sa().length>0}Ma(){var i=this.Ne.flag_keys;if(!x(i)){if(O(i))return i.filter((e=>{var t=e&&typeof e=="string"&&e.trim().length>0;return t||he.error("Invalid flag key found:",e,"Expected non-empty string"),t}));he.error("Invalid flag_keys found:",i,"Expected array of non-empty strings")}}initialize(){var i,e,t=this._instance.config,r=(i=(e=t.bootstrap)==null?void 0:e.featureFlags)!==null&&i!==void 0?i:{};if(Object.keys(r).length){var s,n,a=(s=(n=t.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&s!==void 0?s:{},o=Object.keys(r).filter((u=>!!r[u])).reduce(((u,c)=>(u[c]=r[c]||!1,u)),{}),l=Object.keys(a).filter((u=>o[u])).reduce(((u,c)=>(a[c]&&(u[c]=a[c]),u)),{});this.receivedFeatureFlags({featureFlags:o,featureFlagPayloads:l})}}updateFlags(i,e,t){var r,s,n=t!=null&&t.merge&&(r=this.wa(lt))!==null&&r!==void 0?r:{},a=t!=null&&t.merge&&(s=this.wa(wi))!==null&&s!==void 0?s:{},o=b({},n,i),l=b({},a,e),u={};for(var c of Object.entries(o)){var h=c[0],d=c[1];u[h]={key:h,enabled:qs(d),variant:Bs(d),reason:void 0,metadata:x(l?.[h])?void 0:{id:0,version:void 0,description:void 0,payload:l[h]}}}this.receivedFeatureFlags({flags:u})}get hasLoadedFlags(){return this.da}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var i=this.wa(Yr),e=this.wa(qe),t=this.wa(ft);if(!t&&!e)return i||{};var r=Y({},i||{}),s=[...new Set([...Object.keys(t||{}),...Object.keys(e||{})])];for(var n of s){var a,o,l=r[n],u=e?.[n],c=x(u)?(a=l?.enabled)!==null&&a!==void 0&&a:!!u,h=x(u)?l.variant:typeof u=="string"?u:void 0,d=t?.[n],p=b({},l,{enabled:c,variant:c?h??l?.variant:void 0});c!==l?.enabled&&(p.original_enabled=l?.enabled),h!==l?.variant&&(p.original_variant=l?.variant),d&&(p.metadata=b({},l?.metadata,{payload:d,original_payload:l==null||(o=l.metadata)==null?void 0:o.payload})),r[n]=p}return this.ha||(he.warn(" Overriding feature flag details!",{flagDetails:i,overriddenPayloads:t,finalDetails:r}),this.ha=!0),r}getAllFeatureFlags(){var i=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(i).map((t=>{var r=i[t];return{key:t,enabled:qs(r),variant:Bs(r),payload:js(e[t])}}))}getFlagVariants(){var i=this.wa(lt),e=this.wa(qe);if(!e)return i||{};for(var t=Y({},i),r=Object.keys(e),s=0;r.length>s;s++)t[r[s]]=e[r[s]];return this.ha||(he.warn(" Overriding feature flags!",{enabledFlags:i,overriddenFlags:e,finalFlags:t}),this.ha=!0),t}getFlagPayloads(){var i=this.wa(wi),e=this.wa(ft);if(!e)return i||{};for(var t=Y({},i||{}),r=Object.keys(e),s=0;r.length>s;s++)t[r[s]]=e[r[s]];return this.ha||(he.warn(" Overriding feature flag payloads!",{flagPayloads:i,overriddenPayloads:e,finalPayloads:t}),this.ha=!0),t}reloadFeatureFlags(){this.ca||this.Ne.advanced_disable_feature_flags||this._a()||this.Ta||(this._instance.vn.emit("featureFlagsReloading",!0),this.Ta=setTimeout((()=>{this.Ea()}),5))}Ia(){clearTimeout(this.Ta),this.Ta=void 0}ensureFlagsLoaded(){this.da||this.va||this.Ta||this.reloadFeatureFlags()}setAnonymousDistinctId(i){this.$anon_distinct_id=i}setReloadingPaused(i){this.ca=i}Ea(i){var e;if(this.Ia(),!this._instance.Ki()&&!this._a())if(this.va)this.fa=!0;else{var t=this.Ne.token,r=this.wa(ei),s={token:t,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:b({},((e=this.Tr)==null?void 0:e.get_initial_props())||{},this.wa(nt)||{},{$lib:U.LIB_NAME,$lib_version:U.LIB_VERSION}),group_properties:this.wa(at),timezone:lo()};ye(r)||x(r)||(s.$device_id=r),(i!=null&&i.disableFlags||this.Ne.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.Ca()&&(s.evaluation_contexts=this.Sa());var n=this.Ma();x(n)||(s.flag_keys=n);var a=!!this.Ne.advanced_only_evaluate_survey_feature_flags,o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Ne.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.va=!0,this._instance._send_request({method:"POST",url:o,data:s,compression:this.Ne.disable_compression?void 0:_e.Base64,timestampMode:"body",timeout:this.Ne.feature_flag_request_timeout_ms,callback:l=>{var u,c,h,d=!0;if(this.Pa(l.statusCode),l.statusCode===200&&(this.fa||(this.$anon_distinct_id=void 0),d=!1),this.va=!1,!s.disable_flags||this.fa){this.pa=!d;var p=[];l.error?l.error instanceof Error?p.push(l.error.name==="AbortError"?"timeout":"connection_error"):p.push("unknown_error"):l.statusCode!==200&&p.push("api_error_"+l.statusCode),(u=l.json)!=null&&u.errorsWhileComputingFlags&&p.push("errors_while_computing_flags");var g,f=!((c=l.json)==null||(c=c.quotaLimited)==null||!c.includes("feature_flags"));f&&p.push("quota_limited"),(h=this.Tr)==null||h.register({[Xr]:p}),f?he.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."):(s.disable_flags||this.receivedFeatureFlags((g=l.json)!==null&&g!==void 0?g:{},d,{partialResponse:a}),this.fa&&(this.fa=!1,this.Ea()))}}})}}_a(){return eo(this.ya,3)}Pa(i){this.ya=to(i,this.ya,3,(()=>he.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.pa)if(this.da||this.getFlags()&&this.getFlags().length>0){if(!this.xa()){var r=this.getFeatureFlagResult(i,e);return(t=r?.variant)!==null&&t!==void 0?t:r?.enabled}}else he.warn('getFeatureFlag for key "'+i+$r)}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.pa)if(this.da||this.getFlags()&&this.getFlags().length>0){if(!this.xa()){var t=this.getFlagVariants(),r=i in t,s=t[i],n=this.getFlagPayloads()[i],a=String(s),o=this.wa(Kr)||void 0,l=this.wa(ti)||void 0,u=this.wa(Yt)||{};if(this.Ne.advanced_feature_flags_dedup_per_session){var c,h=this._instance.get_session_id(),d=this.wa(Qr);h&&h!==d&&(u={},(c=this.Tr)==null||c.register({[Yt]:u,[Qr]:h}))}if((e.send_event||!("send_event"in e))&&(!(i in u)||!u[i].includes(a))){var p,g,f,m,_,k,y,P,F,C,L;O(u[i])?u[i].push(a):u[i]=[a],(p=this.Tr)==null||p.register({[Yt]:u});var w=this.getFeatureFlagDetails(i),T=[...(g=this.wa(Xr))!==null&&g!==void 0?g:[]];x(s)&&T.push("flag_missing");var R={$feature_flag:i,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((f=this.Ne.bootstrap)==null||(f=f.featureFlags)==null?void 0:f[i])||null,$feature_flag_bootstrapped_payload:((m=this.Ne.bootstrap)==null||(m=m.featureFlagPayloads)==null?void 0:m[i])||null,$used_bootstrap_value:!this.pa};x(w==null||(_=w.metadata)==null?void 0:_.has_experiment)||(R.$feature_flag_has_experiment=w.metadata.has_experiment),x(w==null||(k=w.metadata)==null?void 0:k.version)||(R.$feature_flag_version=w.metadata.version);var $,N=(y=w==null||(P=w.reason)==null?void 0:P.description)!==null&&y!==void 0?y:w==null||(F=w.reason)==null?void 0:F.code;N&&(R.$feature_flag_reason=N),w!=null&&(C=w.metadata)!=null&&C.id&&(R.$feature_flag_id=w.metadata.id),x(w?.original_variant)&&x(w?.original_enabled)||(R.$feature_flag_original_response=x(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(L=w.metadata)!=null&&L.original_payload&&(R.$feature_flag_original_payload=w==null||($=w.metadata)==null?void 0:$.original_payload),T.length&&(R.$feature_flag_error=T.join(",")),this._instance.capture("$feature_flag_called",R)}if(r)return{key:i,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:js(n)}}}else he.warn('getFeatureFlagResult for key "'+i+$r)}getRemoteConfigPayload(i,e){var t=this.Ne.token,r={distinct_id:this._instance.get_distinct_id(),token:t,person_properties:{$lib:U.LIB_NAME,$lib_version:U.LIB_VERSION}};this.Ca()&&(r.evaluation_contexts=this.Sa());var s=this.Ma();x(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Ne.disable_compression?void 0:_e.Base64,timestampMode:"body",timeout:this.Ne.feature_flag_request_timeout_ms,callback(n){var a,o=(a=n.json)==null?void 0:a.featureFlagPayloads;e(o?.[i]||void 0)}})}isFeatureEnabled(i,e){if(e===void 0&&(e={}),e.fresh&&!this.pa)return e.defaultValue;if(!(this.da||this.getFlags()&&this.getFlags().length>0))return he.warn('isFeatureEnabled for key "'+i+$r),e.defaultValue;var t=this.getFeatureFlag(i,e);return x(t)?e.defaultValue:!!t}addFeatureFlagsHandler(i){this.featureFlagEventHandlers.push(i)}removeFeatureFlagsHandler(i){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==i))}receivedFeatureFlags(i,e,t){if(this.Tr){this.da=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(a,o,l,u,c,h){l===void 0&&(l={}),u===void 0&&(u={}),c===void 0&&(c={});var d=(w=>{var T=w.flags;return T?(w.featureFlags=Object.fromEntries(Object.keys(T).map((R=>{var $;return[R,($=T[R].variant)!==null&&$!==void 0?$:T[R].enabled]}))),w.featureFlagPayloads=Object.fromEntries(Object.keys(T).filter((R=>T[R].enabled)).filter((R=>{var $;return($=T[R].metadata)==null?void 0:$.payload})).map((R=>{var $;return[R,($=T[R].metadata)==null?void 0:$.payload]})))):w.featureFlags&&he.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),w})(a),p=d.flags,g=d.featureFlags,f=d.featureFlagPayloads;if(g){var m=a.requestId,_=a.evaluatedAt;if(O(g)){he.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var k={};if(g)for(var y=0;g.length>y;y++)k[g[y]]=!0;o&&o.register({[bi]:g,[lt]:k,[Ai]:!1})}else{var P=g,F=f,C=p;if(h!=null&&h.partialResponse)P=b({},l,P),F=b({},u,F),C=b({},c,C);else if(a.errorsWhileComputingFlags)if(p){var L=new Set(Object.keys(p).filter((w=>{var T;return!((T=p[w])!=null&&T.failed)})));P=b({},l,Object.fromEntries(Object.entries(P).filter((w=>L.has(w[0]))))),F=b({},u,Object.fromEntries(Object.entries(F||{}).filter((w=>L.has(w[0]))))),C=b({},c,Object.fromEntries(Object.entries(C||{}).filter((w=>L.has(w[0])))))}else P=b({},l,P),F=b({},u,F),C=b({},c,C);o&&o.register(b({[bi]:Object.keys(Un(P)),[lt]:P||{},[wi]:F||{},[Yr]:C||{},[Ai]:a.minimalFlagCalledEvents===!0},m?{[Kr]:m}:{},_?{[ti]:_}:{}))}}})(i,this.Tr,r,s,n,t),e||(this.ma=!1),this.Ra(e)}}override(i,e){e===void 0&&(e=!1),he.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:i,suppressWarning:e})}overrideFeatureFlags(i){if(!this._instance.__loaded||!this.Tr)return he.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(i===!1)return this.Tr.unregister(qe),this.Tr.unregister(ft),this.Ra(),rt.info("All overrides cleared");if(O(i)){var e=Hn(i);return this.Tr.register({[qe]:e}),this.Ra(),rt.info("Flag overrides set",{flags:i})}if(i&&typeof i=="object"&&("flags"in i||"payloads"in i)){var t,r=i;if(this.ha=!!((t=r.suppressWarning)!==null&&t!==void 0&&t),"flags"in r){if(r.flags===!1)this.Tr.unregister(qe),rt.info("Flag overrides cleared");else if(r.flags){if(O(r.flags)){var s=Hn(r.flags);this.Tr.register({[qe]:s})}else this.Tr.register({[qe]:r.flags});rt.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this.Tr.unregister(ft),rt.info("Payload overrides cleared")):r.payloads&&(this.Tr.register({[ft]:r.payloads}),rt.info("Payload overrides set",{payloads:r.payloads}))),void this.Ra()}if(i&&typeof i=="object")return this.Tr.register({[qe]:i}),this.Ra(),rt.info("Flag overrides set",{flags:i});he.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:i})}onFeatureFlags(i){if(this.addFeatureFlagsHandler(i),this.da){var e=this.Aa(),t=e.flags,r=e.flagVariants;try{i(t,r)}catch(s){he.error("Error while running feature flags callback",s)}}return()=>this.removeFeatureFlagsHandler(i)}updateEarlyAccessFeatureEnrollment(i,e,t){var r,s=(this.wa(zt)||[]).find((l=>l.flagKey===i)),n={["$feature_enrollment/"+i]:e},a={$feature_flag:i,$feature_enrollment:e,$set:n};s&&(a.$early_access_feature_name=s.name),t&&(a.$feature_enrollment_stage=t),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(n,!1);var o=b({},this.getFlagVariants(),{[i]:e});(r=this.Tr)==null||r.register({[bi]:Object.keys(Un(o)),[lt]:o}),this.Ra()}getEarlyAccessFeatures(i,e,t){e===void 0&&(e=!1);var r=this.wa(zt),s=t?"&"+t.map((n=>"stage="+n)).join("&"):"";if(r&&!e)return i(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Ne.token+s),method:"GET",timestampMode:"query",callback:n=>{var a,o;if(n.json){var l=n.json.earlyAccessFeatures;return(a=this.Tr)==null||a.unregister(zt),(o=this.Tr)==null||o.register({[zt]:l}),i(l)}}})}Aa(){var i=this.getFlags(),e=this.getFlagVariants();return{flags:i.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,r)=>(t[r]=e[r],t)),{})}}Ra(i){var e=this.Aa(),t=e.flags,r=e.flagVariants;this.featureFlagEventHandlers.forEach((s=>{try{s(t,r,{errorsLoading:i})}catch(n){he.error("Error while running feature flags callback",n)}}))}setPersonPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.wa(nt)||{},r=i?.$set||(i!=null&&i.$set_once?{}:i),s=i?.$set_once,n={};if(s)for(var a in s)({}).hasOwnProperty.call(s,a)&&(a in t||(n[a]=s[a]));this._instance.register({[nt]:b({},t,n,r)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=b({},this.wa(nt)||{});i.forEach((r=>{delete t[r]})),this._instance.register({[nt]:t}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(i){i===void 0&&(i=!0),this._instance.unregister(nt),i&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.wa(at)||{};Object.keys(t).length!==0&&Object.keys(t).forEach((r=>{t[r]=b({},t[r],i[r]),delete i[r]})),this._instance.register({[at]:b({},t,i)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(i){if(i){var e=this.wa(at)||{};this._instance.register({[at]:b({},e,{[i]:{}})})}else this._instance.unregister(at)}reset(){this.da=!1,this.va=!1,this.ca=!1,this.fa=!1,this.pa=!1,this.$anon_distinct_id=void 0,this.Ia(),this.ha=!1,this.ya=0}}},Hu={sessionRecording:class{get Ne(){return this._instance.config}get Tr(){return this._instance.persistence}get started(){var i;return!((i=this.Fa)==null||!i.isStarted)}get status(){var i,e;return this.La===qt||this.La===_i?this.La:(i=(e=this.Fa)==null?void 0:e.status)!==null&&i!==void 0?i:this.La}constructor(i){if(this._forceAllowLocalhostNetworkCapture=!1,this.La=An,this.Oa=void 0,this.Da=!1,this.$a=(()=>{var e;if(S==null||!S.visibilityState||S.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((r=>r.name==="visible"))})(),this.Ie=()=>{var e;S?.visibilityState==="visible"&&(this.$a=!0,(e=this.Fa)==null||e.setDocumentWasEverVisible==null||e.setDocumentWasEverVisible(!0))},this._instance=i,!this._instance.sessionManager)throw De.error("started without valid sessionManager"),new Error(gs+" started without valid sessionManager. This is a bug.");if(this.Ne.cookieless_mode===Ue)throw new Error(gs+' cannot be used with cookieless_mode="always"');S!=null&&S.addEventListener&&te(S,"visibilitychange",this.Ie)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Da=!0,S==null||S.removeEventListener==null||S.removeEventListener("visibilitychange",this.Ie),this.stopRecording()}get Na(){var i,e=!((i=this._instance.get_property(ut))==null||!i.enabled),t=!this.Ne.disable_session_recording,r=this.Ne.disable_session_recording||this._instance.consent.isOptedOut();return v&&e&&t&&!r}startIfEnabledOrStop(i){var e;if(!(this.Da||this.Na&&(e=this.Fa)!=null&&e.isStarted)){var t=!x(Object.assign)&&!x(Array.from);this.Na&&t?(this.qa(i),De.info("starting")):(this.La=An,this.stopRecording())}}qa(i){var e,t,r;this.Na&&(this.La!==qt&&this.La!==_i&&(this.La=Ln),I!=null&&(e=I.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(t=I.__PosthogExtensions__)!=null&&t.initSessionRecording?this.ja(i):(r=I.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Ba,(s=>{if(s)return De.error("could not load recorder",s);this.ja(i)})))}stopRecording(){var i,e;(i=this.Oa)==null||i.call(this),this.Oa=void 0,(e=this.Fa)==null||e.stop()}Ha(){var i,e;(i=this.Oa)==null||i.call(this),this.Oa=void 0,(e=this.Fa)==null||e.discard()}Ua(){var i,e;(i=this.Tr)==null||i.unregister(Ss),(e=this.Tr)==null||e.unregister(Ia)}za(i,e){if(A(i))return null;var t,r=ue(i)?i:parseFloat(i);return typeof(t=r)!="number"||!Number.isFinite(t)||0>t||t>1?(De.warn(e+" must be between 0 and 1. Ignoring invalid value:",i),null):r}Wa(i){if(this.Tr){var e,t,r=this.Tr,s=()=>{var n,a=i.sessionRecording===!1?void 0:i.sessionRecording,o=this.za((n=this.Ne.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.za(a?.sampleRate,"remote config sampleRate"),u=o??l;A(u)&&this.Ua();var c=a?.minimumDurationMilliseconds;r.register({[ut]:b({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:b({capturePerformance:i.capturePerformance},a?.networkPayloadCapture),canvasRecording:{enabled:a?.recordCanvas,fps:a?.canvasFps,quality:a?.canvasQuality},sampleRate:u,minimumDurationMilliseconds:x(c)?null:c,endpoint:a?.endpoint,triggerMatchType:a?.triggerMatchType,masking:a?.masking,urlTriggers:a?.urlTriggers,version:a?.version,triggerGroups:a?.triggerGroups})})};s(),(e=this.Oa)==null||e.call(this),this.Oa=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(s)}}onRemoteConfig(i){var e=i.ok?i.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.Wa(e),void this.Ha()):(this.Wa(e),void this.startIfEnabledOrStop()):(this.La===qt&&(this.La=_i,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.Fa)!=null&&t.log?this.Fa.log(i,e):De.warn("log called before recorder was ready")}get Ba(){var i,e,t=(i=this._instance)==null||(i=i.persistence)==null?void 0:i.get_property(ut);return(t==null||(e=t.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}Va(){var i,e,t=this._instance.get_property(ut);if(!t)return!1;try{e=typeof t=="object"?t:JSON.parse(t)}catch(s){return De.warn("persisted remote config for session recording is invalid and will be ignored",s),!1}var r=(i=e.cache_timestamp)!==null&&i!==void 0?i:Date.now();return 36e5>=Date.now()-r}ja(i){var e,t,r;if(!this.Da){if((e=I.__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({[Da]:!0});var s;if(this.Fa||(this.Fa=(s=I.__PosthogExtensions__)==null?void 0:s.initSessionRecording(this._instance,this.$a),this.Fa._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Va())return this.La===_i||this.La===qt?void 0:(this.La=qt,De.info("persisted remote config is stale, requesting fresh config before starting"),void new uo(this._instance).load());this.La=Ln,(t=(r=this.Fa).setDocumentWasEverVisible)==null||t.call(r,this.$a),this.Fa.start(i)}}onRRwebEmit(i){var e;(e=this.Fa)==null||e.onRRwebEmit==null||e.onRRwebEmit(i)}overrideLinkedFlag(){var i,e;this.Fa||(e=this.Tr)==null||e.register({[Ca]:!0}),(i=this.Fa)==null||i.overrideLinkedFlag()}overrideSampling(){var i,e;this.Fa||(e=this.Tr)==null||e.register({[Ra]:!0}),(i=this.Fa)==null||i.overrideSampling()}overrideTrigger(i){var e,t;this.Fa||(t=this.Tr)==null||t.register({[i==="url"?Ma:Oa]:!0}),(e=this.Fa)==null||e.overrideTrigger(i)}get sdkDebugProperties(){var i;return((i=this.Fa)==null?void 0:i.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(i,e){var t;return!((t=this.Fa)==null||!t.tryAddCustomEvent(i,e))}}},Uu={autocapture:class{constructor(i){this.Za=!1,this.Ga=null,this.Qa=!1,this.Ka=!1,this.instance=i,this.rageclicks=new Mn(i.config.rageclick),this.Ja=null}initialize(){this.startIfEnabled()}get Ne(){var i,e,t=K(this.instance.config.autocapture)?this.instance.config.autocapture:{};return t.url_allowlist=(i=t.url_allowlist)==null?void 0:i.map((r=>new RegExp(r))),t.url_ignorelist=(e=t.url_ignorelist)==null?void 0:e.map((r=>new RegExp(r))),t}Ya(){if(this.isBrowserSupported()){if(v&&S){var i=t=>{t=t||v?.event;try{this.Xa(t)}catch(r){Sr.error("Failed to capture event",r)}};if(te(S,"submit",i,{capture:!0}),te(S,"change",i,{capture:!0}),te(S,"click",i,{capture:!0}),this.Ne.capture_copied_text){var e=t=>{t=t||v?.event;try{this.Xa(t,kr)}catch(r){Sr.error("Failed to capture copy/cut event",r)}};te(S,"copy",e,{capture:!0}),te(S,"cut",e,{capture:!0})}}}else Sr.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Za&&(this.Ya(),this.Za=!0)}onRemoteConfig(i){if(this.Qa=!0,i.ok){var e=i.config;e.elementsChainAsString&&(this.Ka=e.elementsChainAsString);var t=e.autocapture_opt_out;Me(t)&&(this.instance.persistence&&this.instance.persistence.register({[Br]:t}),this.Ga=t),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(i){this.Ja=i}getElementSelectors(i){var e,t=[];return(e=this.Ja)==null||e.forEach((r=>{var s=S?.querySelectorAll(r);s?.forEach((n=>{i===n&&t.push(r)}))})),t}get isEnabled(){var i,e,t=(i=this.instance.persistence)==null?void 0:i.props[Br],r=this.Ga,s=this.instance.Ki()&&!this.Qa;if(ye(r)&&!Me(t)&&!s)return!1;var n=(e=this.Ga)!==null&&e!==void 0?e:!!t;return!!this.instance.config.autocapture&&!n}Xa(i,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var t,r=dr(i);Ua(r)&&(r=r.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())&&un(r,this.instance.config.rageclick)&&this.Xa(i,"$rageclick");var s=e===kr;if(r&&(function(h,d,p,g,f,m){var _;if(!v||Is(h)||p!=null&&p.url_allowlist&&!an(p.url_allowlist,m)||p!=null&&p.url_ignorelist&&an(p.url_ignorelist,m))return!1;if(p!=null&&p.dom_event_allowlist){var k=p.dom_event_allowlist;if(k&&!k.some((w=>d.type===w)))return!1}var y=Ka(h,g),P=y.parentIsUsefulElement,F=y.targetElementList;if(!(function(w,T){var R=T?.element_allowlist;if(x(R))return!0;var $,N=function(V){if(R.some((Q=>V.tagName.toLowerCase()===Q)))return{v:!0}};for(var D of w)if($=N(D))return $.v;return!1})(F,p)||!as(F,p?.css_selector_allowlist)||as(F,(_=p?.css_selector_ignorelist)!==null&&_!==void 0?_:Bl))return!1;try{var C=v.getComputedStyle(h);if(C&&C.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0}catch{}var L=h.tagName.toLowerCase();switch(L){case"html":return!1;case"form":return(f||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(f||["change","click"]).indexOf(d.type)>=0;default:return P?(f||["click"]).indexOf(d.type)>=0:(f||["click"]).indexOf(d.type)>=0&&($s.indexOf(L)>-1||h.getAttribute("contenteditable")==="true")}})(r,i,this.Ne,s,s?["copy","cut"]:void 0,this.instance)){var n=Mu(r,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Ne.element_attribute_ignorelist,elementsChainAsString:this.Ka,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),a=n.props;if(n.explicitNoCapture)return!1;var o=this.getElementSelectors(r);if(o&&o.length>0&&(a.$element_selectors=o),e===kr){var l,u=Va(v==null||(l=v.getSelection())==null?void 0:l.toString()),c=i.type||"clipboard";if(!u)return!1;a.$selected_content=u,a.$copy_type=c}return this.instance.capture(e,a),!0}}}isBrowserSupported(){return Ee(S?.querySelectorAll)}},historyAutocapture:class{constructor(i){var e;this._instance=i,this.eo=(v==null||(e=v.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(E.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.io&&this.io(),this.io=void 0,E.info("History API monitoring stopped")}monitorHistoryChanges(){v&&v.history&&(this.ro("pushState"),this.ro("replaceState"),this.no())}ro(i){var e;if(v&&((e=v.history[i])==null||!e.__posthog_wrapped__)){var t=this;(function(r,s,n){try{if(!(s in r))return On;var a={next:r[s]},o=n((function(){for(var l=arguments.length,u=new Array(l),c=0;l>c;c++)u[c]=arguments[c];return a.next.apply(this,u)}));return Ee(o)&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:a}})),r[s]=o,()=>{if(r[s]!==o)for(var l=r[s];Ee(l)&&l.__posthog_layer__;){var u=l.__posthog_layer__;if(u.next===o)return void(u.next=a.next);l=u.next}else r[s]=a.next}}catch{return On}})(v.history,i,(r=>function(s,n,a){r.call(this,s,n,a),t.so(i)}))}}so(i){try{var e,t=v==null||(e=v.location)==null?void 0:e.pathname;if(!t)return;t!==this.eo&&this.isEnabled&&this._instance.capture(_t,{navigation_type:i}),this.eo=t}catch(r){E.error("Error capturing "+i+" pageview",r)}}no(){if(!this.io){var i=()=>{this.so("popstate")};te(v,"popstate",i),this.io=()=>{v&&v.removeEventListener("popstate",i)}}}},heatmaps:class{get Ne(){return this.instance.config}constructor(i){var e;this.ao=!1,this.Za=!1,this.oo=null,this.instance=i,this.ao=!((e=this.instance.persistence)==null||!e.props[Hr]),this.rageclicks=new Mn(i.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var i=5e3;return K(this.Ne.capture_heatmaps)&&this.Ne.capture_heatmaps.flush_interval_milliseconds&&(i=this.Ne.capture_heatmaps.flush_interval_milliseconds),i}get isEnabled(){return A(this.Ne.capture_heatmaps)?A(this.Ne.enable_heatmaps)?this.ao:this.Ne.enable_heatmaps:this.Ne.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Za)return;Nu.info("starting..."),this.lo(),this.Ie()}else{var i;clearInterval((i=this.oo)!==null&&i!==void 0?i:void 0),this.uo(),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({[Hr]:t}),this.ao=t,this.startIfEnabled()}}}getAndClearBuffer(){var i=this.R;return this.R=void 0,i}ho(i){Fr(i.originalEvent)&&this.ke(i.originalEvent,"deadclick")}Ie(){this.oo&&clearInterval(this.oo),this.oo=S?.visibilityState==="visible"?setInterval(this.pr.bind(this),this.flushIntervalMilliseconds):null}lo(){v&&S&&(this.do=this.pr.bind(this),te(v,Bi,this.do),this.vo=i=>this.ke(i||v?.event),te(S,"click",this.vo,{capture:!0}),this.co=i=>this.fo(i||v?.event),te(S,"mousemove",this.co,{capture:!0}),this.po=new fn(this.instance,Yl,this.ho.bind(this)),this.po.startIfEnabledOrStop(),this.mo=this.Ie.bind(this),te(S,qi,this.mo),this.Za=!0)}uo(){var i;v&&S&&(this.do&&v.removeEventListener(Bi,this.do),this.vo&&S.removeEventListener("click",this.vo,{capture:!0}),this.co&&S.removeEventListener("mousemove",this.co,{capture:!0}),this.mo&&S.removeEventListener(qi,this.mo),clearTimeout(this.yo),(i=this.po)==null||i.stop(),this.Za=!1)}bo(i,e){var t=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=(function(a,o,l){for(var u=a;u&&Qe(u)&&!ke(u,"body");){if(u===l)return!1;var c=void 0;try{var h,d,p;c=(h=(d=(p=u.ownerDocument)==null?void 0:p.defaultView)!==null&&d!==void 0?d:v)==null?void 0:h.getComputedStyle(u).position}catch{return!1}if(M(o,c))return!0;u=Wa(u)}return!1})(dr(i),["fixed","sticky"],s);return{x:i.clientX+(n?0:r),y:i.clientY+(n?0:t),target_fixed:n,type:e}}ke(i,e){var t;if(e===void 0&&(e="click"),!nn(i.target)&&Fr(i)){var r=this.bo(i,e);(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,new Date().getTime())&&un(dr(i),this.instance.config.rageclick)&&this.Vt(b({},r,{type:"rageclick"})),this.Vt(r)}}fo(i){!nn(i.target)&&Fr(i)&&(clearTimeout(this.yo),this.yo=setTimeout((()=>{this.Vt(this.bo(i,"mousemove"))}),500))}Vt(i){if(v){var e=this.Ne.disable_capture_url_hashes?Ze(v.location.href):v.location.href,t=this.Ne.custom_personal_data_properties,r=this.Ne.mask_personal_data_properties?[...Ft,...t||[]]:[],s=ri(e,r,si);this.R=this.R||{},this.R[s]||(this.R[s]=[]),this.R[s].push(i)}}pr(){this.R&&!Ve(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:fn,webVitalsAutocapture:class{constructor(i){var e;this.ao=!1,this.Za=!1,this.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this._o=()=>{clearTimeout(this.wo),this.wo=void 0,this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",b({$current_url:this.R.url},this.R.metrics.reduce(((t,r)=>b({},t,{["$web_vitals_"+r.name+"_event"]:b({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{}))),this.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ko=t=>{var r;if(this.R=this.R||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},A(t?.name)||A(t?.value))it.error("Invalid metric received",t);else{var s=typeof t.navigationURL=="string"?t.navigationURL:void 0,n=this.xo(s);if(!x(n)){var a=ue(t.navigationId)||typeof t.navigationId=="string"?"navigation:"+t.navigationId:"url:"+n;if(!this.So||this.So>t.value){this.R.navigationKey!==a&&(this._o(),this.wo=setTimeout(this._o,this.flushToCaptureTimeoutMs)),x(this.R.navigationKey)&&(this.R.navigationKey=a,this.R.url=n),this.R.firstMetricTimestamp=x(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var o=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),l=b({},t,s?{navigationURL:n}:{},{$current_url:n,timestamp:Date.now()});x(o)||(l.$session_id=o.sessionId,l.$window_id=o.windowId),this.R.metrics.push(l),this.R.metrics.length===this.allowedMetrics.length&&this._o()}else it.error("Ignoring metric with value >= "+this.So,t)}}},this.Co=()=>{if(!this.Za){var t,r,s,n,a=I.__PosthogExtensions__,o=a?.postHogWebVitalsCallbacksByFlavor,l=o?.[this.Mo]||(this.Mo==="web-vitals"&&x(o)?a?.postHogWebVitalsCallbacks:void 0);if(x(l)||(t=l.onLCP,r=l.onCLS,s=l.onFCP,n=l.onINP),t&&r&&s&&n){var u={reportSoftNavs:this.useSoftNavs};this.allowedMetrics.indexOf("LCP")>-1&&t(this.ko.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&r(this.ko.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&s(this.ko.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&n(this.ko.bind(this),u),this.Za=!0}else it.error("web vitals callbacks not loaded - not starting")}},this._instance=i,this.ao=!((e=this._instance.persistence)==null||!e.props[Vr]),this.startIfEnabled()}get To(){return this._instance.config.capture_performance}get allowedMetrics(){var i,e,t=K(this.To)?(i=this.To)==null?void 0:i.web_vitals_allowed_metrics:void 0;return A(t)?((e=this._instance.persistence)==null?void 0:e.props[Wr])||["CLS","FCP","INP","LCP"]:t}get flushToCaptureTimeoutMs(){return(K(this.To)?this.To.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var i=K(this.To)?this.To.web_vitals_attribution:void 0;return i!=null&&i}get useSoftNavs(){var i=K(this.To)?this.To.__preview_web_vitals_soft_navs:void 0;return i!=null&&i}get So(){var i=K(this.To)&&ue(this.To.__web_vitals_max_value)?this.To.__web_vitals_max_value:Nn;return i>0&&6e4>=i?Nn:i}get isEnabled(){var i=ee?.protocol;if(i!=="http:"&&i!=="https:")return it.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=K(this.To)?this.To.web_vitals:Me(this.To)?this.To:void 0;return Me(e)?e:this.ao}startIfEnabled(){this.isEnabled&&!this.Za&&(it.info("enabled, starting..."),this.ai(this.Co))}onRemoteConfig(i){if(i.ok){var e=i.config;if("capturePerformance"in e){var t=K(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=K(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Vr]:t}),this._instance.persistence.register({[Wr]:r})),this.ao=t,this.startIfEnabled()}}}get Mo(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}ai(i){var e=I.__PosthogExtensions__,t=this.Mo,r=e?.postHogWebVitalsCallbacksByFlavor;r!=null&&r[t]||t==="web-vitals"&&x(r)&&e!=null&&e.postHogWebVitalsCallbacks?i():e==null||e.loadExternalDependency==null||e.loadExternalDependency(this._instance,t,(s=>{s?it.error("failed to load script",s):i()}))}xo(i){var e=i||v?.location.href;if(e){var t=this._instance.config.disable_capture_url_hashes?Ze(e):e,r=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...Ft,...r||[]]:[];return ri(t,s,si)}it.error("Could not determine current URL")}}},zu={exceptionObserver:class{constructor(i){var e;this.Co=()=>{var t;if(v&&this.isEnabled&&(t=I.__PosthogExtensions__)!=null&&t.errorWrappingFunctions){var r=I.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=I.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=I.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Eo&&this.Ne.capture_unhandled_errors&&(this.Eo=r(this.captureException.bind(this))),!this.Io&&this.Ne.capture_unhandled_rejections&&(this.Io=s(this.captureException.bind(this))),!this.Po&&this.Ne.capture_console_errors&&(this.Po=n(this.captureException.bind(this)))}catch(a){jt.error("failed to start",a),this.Ro()}}},this._instance=i,this.Ao=!((e=this._instance.persistence)==null||!e.props[Ur]),this.Fo=new Uo(b({},(function(t){var r,s,n,a;return t===void 0&&(t={}),{refillRate:(r=(s=t.exceptionRateLimiterRefillRate)!==null&&s!==void 0?s:t.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r: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,rt:jt})),this.Ne=this.Lo(),this.startIfEnabledOrStop()}Lo(){var i=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return K(i)?e=b({},e,i):(x(i)?this.Ao:i)&&(e=b({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Ne.capture_console_errors||this.Ne.capture_unhandled_errors||this.Ne.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(jt.info("enabled"),this.Ro(),this.ai(this.Co)):this.Ro()}ai(i){var e,t;(e=I.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?i():(t=I.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return jt.error("failed to load script",r);i()}))}Ro(){var i,e,t;(i=this.Eo)==null||i.call(this),this.Eo=void 0,(e=this.Io)==null||e.call(this),this.Io=void 0,(t=this.Po)==null||t.call(this),this.Po=void 0}onRemoteConfig(i){if(i.ok){var e=i.config;"autocaptureExceptions"in e&&(this.Ao=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Ur]:this.Ao}),this.Ne=this.Lo(),this.startIfEnabledOrStop())}}onConfigChange(){this.Ne=this.Lo()}captureException(i){var e,t,r,s=(e=i==null||(t=i.$exception_list)==null||(t=t[0])==null?void 0:t.type)!==null&&e!==void 0?e:"Exception";this.Fo.consumeRateLimit(s)?jt.info("Skipping exception capture because of client rate limiting.",{exception:s}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(i)}},exceptions:class{constructor(i){var e,t;this.Oo=[],this.Do=new al([new vl,new El,new fl,new gl,new wl,new bl,new ml,new xl],(function(r){for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;s>a;a++)n[a-1]=arguments[a];return function(o,l){l===void 0&&(l=0);for(var u=[],c=o.split(`
3
- `),h=l;c.length>h;h++){var d=c[h];if(1024>=d.length){var p=en.test(d)?d.replace(en,"$1"):d;if(!p.match(/\S*Error: /)){for(var g of n){var f=g(p,r);if(f){u.push(f);break}}if(u.length>=50)break}}}return(function(m){if(!m.length)return[];var _=Array.from(m);return _.reverse(),_.slice(0,50).map((k=>{return b({},k,{filename:k.filename||(y=_,y[y.length-1]||{}).filename,function:k.function||St});var y}))})(u)}})("web:javascript",cl,pl)),this._instance=i,this.Oo=(e=(t=this._instance.persistence)==null?void 0:t.get_property(zr))!==null&&e!==void 0?e:[],this.$o=Ni(this.No()),this.qo=new Sl(this.$o)}onConfigChange(){this.$o=Ni(this.No()),this.qo.setConfig(this.$o)}onRemoteConfig(i){var e,t,r;if(i.ok){var s=i.config;if("errorTracking"in s){var n=(e=(t=s.errorTracking)==null?void 0:t.suppressionRules)!==null&&e!==void 0?e:[],a=(r=s.errorTracking)==null?void 0:r.captureExtensionExceptions;this.Oo=n,this._instance.persistence&&this._instance.persistence.register({[zr]:this.Oo,[Gr]:a})}}}get jo(){var i,e=!!this._instance.get_property(Gr),t=this._instance.config.error_tracking.captureExtensionExceptions;return(i=t??e)!==null&&i!==void 0&&i}buildProperties(i,e){return this.Do.buildFromUnknown(i,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(i,e){if(this.$o.enabled)try{if(!j(i)||i.trim().length===0)return void Ne.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)=>kl.has(l)?(a.push(l),o):(o[l]=n[l],o)),{}),droppedKeys:a}})(this.Bo(e)),r=t.sanitizedProperties,s=t.droppedKeys;s.length>0&&Ne.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.qo.add(b({[Mi]:i,[Oi]:new Date().toISOString()},r))}catch(n){Ne.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(i){try{var e=i.$exception_list;if(this.Ho(e)){if(this.Uo(e))return this.zo("Exception dropped: matched a suppression rule"),void Ne.info("Skipping exception capture because a suppression rule matched");if(!this.jo&&this.Wo(e))return this.zo("Exception dropped: thrown by a browser extension"),void Ne.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Vo(e))return this.zo("Exception dropped: thrown by the PostHog SDK"),void Ne.info("Skipping exception capture because it was thrown by the PostHog SDK")}var t=this.$o.enabled&&A(i.$exception_steps)?this.Zo(i):i,r=typeof(n=globalThis._posthogReleaseId)=="string"&&n.length>0?n:void 0;r&&(t.$release_id=r);try{var s=this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",Un:!0});return s&&this.qo.clear(),s}catch(a){return Ne.error("Failed to capture exception event. Dropping this exception.",a),void this.qo.clear()}}catch(a){return void Ne.error("Failed to process exception event. Ignoring this exception.",a)}var n}Zo(i){try{var e=this.qo.getAttachable();return e.length===0?i:b({},i,{$exception_steps:e})}catch(t){return Ne.error("Failed to read buffered exception steps. Capturing exception without steps.",t),i}}zo(i){this.$o.enabled&&this.qo.add({[Mi]:i,[Oi]:new Date().toISOString()})}Bo(i){return K(i)?b({},i):{}}No(){var i,e;return(i=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&i!==void 0?i:{}}Uo(i){if(i.length===0)return!1;try{var e=i.reduce(((t,r)=>{var s=r.type,n=r.value;return j(s)&&s.length>0&&t.$exception_types.push(s),j(n)&&n.length>0&&t.$exception_values.push(n),t}),{$exception_types:[],$exception_values:[]});return this.Oo.some((t=>{var r=t.values.map((s=>{var n=ko[s.operator],a=e[s.key];if(!n||!a)return!1;var o=O(s.value)?s.value:[s.value];return o.length>0&&n(o,a)}));return t.type==="OR"?r.some(Boolean):r.every(Boolean)}))}catch(t){return Ne.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Wo(i){return i.flatMap((e=>{var t,r;return(t=(r=e.stacktrace)==null?void 0:r.frames)!==null&&t!==void 0?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}Vo(i){if(i.length>0){var e,t,r,s,n=(e=(t=i[0].stacktrace)==null?void 0:t.frames)!==null&&e!==void 0?e:[],a=n[n.length-1];return(r=a==null||(s=a.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}Ho(i){return!A(i)&&O(i)}}},Gu=b({productTours:class{get Tr(){return this._instance.persistence}constructor(i){this.Go=null,this.Qo=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(i.ok){var e=i.config;if("productTours"in e){var t,r;if(this.Tr&&this.Tr.register({[ks]:!!e.productTours}),!Tr(this._instance))return!this.Go&&A((t=this.Tr)==null?void 0:t.props[Gt])||mi.info("product tours disabled; stopping and clearing cached tours"),(r=this.Go)==null||r.stop(),this.Go=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Go&&Tr(this._instance)&&this.ai((()=>this.Ko()))}ai(i){var e,t;(e=I.__PosthogExtensions__)!=null&&e.generateProductTours?i():(t=I.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"product-tours",(r=>{r?mi.error("Could not load product tours script",r):i()}))}Ko(){var i;!this.Go&&(i=I.__PosthogExtensions__)!=null&&i.generateProductTours&&(this.Go=I.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(i,e){if(e===void 0&&(e=!1),!O(this.Qo)||e){var t=this.Tr;if(t){var r=t.props[Gt];if(O(r)&&!e)return this.Qo=r,void i(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:s=>{if(Tr(this._instance)){var n=s.statusCode;if(n!==200||!s.json){var a="Product Tours API could not be loaded, status: "+n;return n===0?s.error||mi.warn(a):mi.error(a),void i([],{isLoaded:!1,error:a})}var o=O(s.json.product_tours)?s.json.product_tours:[];this.Qo=o,t&&t.register({[Gt]:o}),i(o,{isLoaded:!0})}else i([],{isLoaded:!0})}})}else i(this.Qo,{isLoaded:!0})}getActiveProductTours(i){A(this.Go)?i([],{isLoaded:!1,error:"Product tours not loaded"}):this.Go.getActiveProductTours(i)}showProductTour(i){var e;(e=this.Go)==null||e.showTourById(i)}previewTour(i){this.Go?this.Go.previewTour(i):this.ai((()=>{var e;this.Ko(),(e=this.Go)==null||e.previewTour(i)}))}dismissProductTour(){var i;(i=this.Go)==null||i.dismissTour("user_clicked_skip")}nextStep(){var i;(i=this.Go)==null||i.nextStep()}previousStep(){var i;(i=this.Go)==null||i.previousStep()}clearCache(){var i;this.Qo=null,(i=this.Tr)==null||i.unregister(Gt)}resetTour(i){var e;(e=this.Go)==null||e.resetTour(i)}resetAllTours(){var i;(i=this.Go)==null||i.resetAllTours()}cancelPendingTour(i){var e;(e=this.Go)==null||e.cancelPendingTour(i)}}},Xi),Vu={siteApps:class{constructor(i){this.Jo=0,this._instance=i,this.Yo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Xo(i,e){if(e){var t=this.globalsForEvent(e);this.Yo.push(t),this.Yo.length>1e3&&(this.Yo=this.Yo.slice(10))}}get siteAppLoaders(){var i;return(i=I._POSTHOG_REMOTE_CONFIG)==null||(i=i[this._instance.config.token])==null?void 0:i.siteApps}initialize(){if(this.isEnabled){var i=this._instance._addCaptureHook(this.Xo.bind(this));this.tl=()=>{i(),this.Yo=[],this.tl=void 0}}}globalsForEvent(i){var e,t,r,s,n,a,o;if(!i)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var h of Object.entries(c)){var d=h[0];l[d]={id:u[d],type:d,properties:h[1]}}var p=i.$set_once,g=i.$set;return{event:b({},Yn(i,Au),{properties:b({},i.properties,g?{$set:b({},(e=(t=i.properties)==null?void 0:t.$set)!==null&&e!==void 0?e:{},g)}:{},p?{$set_once:b({},(r=(s=i.properties)==null?void 0:s.$set_once)!==null&&r!==void 0?r:{},p)}:{}),elements_chain:(n=(a=i.properties)==null?void 0:a.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(o=i.properties)==null?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}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)||(Oe.error("prepare_external_dependency_stylesheet returned null"),null):t==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(i)||(Oe.error("prepare_external_dependency_script returned null"),null):i}il(){var i,e,t,r,s,n,a,o;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=S?.defaultView,u=l==null||(i=l.Node)==null?void 0:i.prototype;if(!l||!u)return()=>{};if(this.Jo++,this.rl)return this.nl();var c=[],h=this,d=new WeakSet,p=(m,_,k)=>{if(m!=null&&m[_]){var y=m[_];m[_]=k(y),c.push((()=>{m[_]=y}))}},g=m=>{if(d.has(m))return m;var _=h.el(m);return _&&d.add(_),_},f=m=>m.map((_=>typeof _=="string"?_:g(_))).filter((_=>!ye(_)));return p(u,"appendChild",(m=>function(_){var k=g(_);return k?m.call(this,k):_})),p(u,"insertBefore",(m=>function(_,k){var y=g(_);return y?m.call(this,y,k):_})),p(u,"replaceChild",(m=>function(_,k){var y=g(_);return y?m.call(this,y,k):k})),[(e=l.Element)==null?void 0:e.prototype,(t=l.Document)==null?void 0:t.prototype,(r=l.DocumentFragment)==null?void 0:r.prototype].forEach((m=>{p(m,"append",(_=>function(){for(var k=arguments.length,y=new Array(k),P=0;k>P;P++)y[P]=arguments[P];return _.apply(this,f(y))})),p(m,"prepend",(_=>function(){for(var k=arguments.length,y=new Array(k),P=0;k>P;P++)y[P]=arguments[P];return _.apply(this,f(y))}))})),[(s=l.Element)==null?void 0:s.prototype,(n=l.CharacterData)==null?void 0:n.prototype,(a=l.DocumentType)==null?void 0:a.prototype].forEach((m=>{p(m,"before",(_=>function(){for(var k=arguments.length,y=new Array(k),P=0;k>P;P++)y[P]=arguments[P];return _.apply(this,f(y))})),p(m,"after",(_=>function(){for(var k=arguments.length,y=new Array(k),P=0;k>P;P++)y[P]=arguments[P];return _.apply(this,f(y))})),p(m,"replaceWith",(_=>function(){for(var k=arguments.length,y=new Array(k),P=0;k>P;P++)y[P]=arguments[P];var F=f(y);return y.length&&!F.length?void 0:_.apply(this,F)}))})),p((o=l.Element)==null?void 0:o.prototype,"insertAdjacentElement",(m=>function(_,k){var y=g(k);return y?m.call(this,_,y):null})),this.rl=()=>{c.forEach((m=>m())),this.rl=void 0},this.nl()}nl(){var i=!1;return()=>{var e;i||(i=!0,this.Jo--,this.Jo===0&&((e=this.rl)==null||e.call(this)))}}sl(i,e){e===void 0&&(e=!0);var t=this.il();try{var r=i(t);return e&&t(),r}catch(s){throw t(),s}}setupSiteApp(i){var e=this.apps[i.id],t=()=>{var a;!e.errored&&this.Yo.length&&(Oe.info("Processing "+this.Yo.length+" events for site app with id "+i.id),this.Yo.forEach((o=>this.sl((()=>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))},r=!1,s=a=>{e.errored=!a,e.loaded=!0,Oe.info("Site app with id "+i.id+" "+(a?"loaded":"errored")),r&&t()};try{var n=this.sl((a=>i.init({posthog:this._instance,callback(o){a(),s(o)}})),!1).processEvent;n&&(e.processEvent=n),r=!0}catch(a){Oe.error(Dn+i.id,a),s(!1)}if(r&&e.loaded)try{t()}catch(a){Oe.error("Error while processing buffered events PostHog app with config id "+i.id,a),e.errored=!0}}al(){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)}ol(i){var e=this;if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(i),r=function(n){try{e.sl((()=>n.processEvent==null?void 0:n.processEvent(t)))}catch(a){Oe.error("Error while processing event "+i.event+" for site app "+n.id,a)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(i){var e,t,r,s=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.al(),void this._instance.on("eventCaptured",(l=>this.ol(l)))):void Oe.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((r=n.siteApps)!=null&&r.length)if(this.isEnabled){var a=function(){var l,u=o.id,c=o.url;I["__$$ph_site_app_"+u]=s._instance,(l=I.__PosthogExtensions__)==null||l.loadSiteApp==null||l.loadSiteApp(s._instance,c,(h=>{if(h)return Oe.error(Dn+u,h)}))};for(var o of n.siteApps)a()}else Oe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Wu={tracingHeaders:class{constructor(i){this.ll=void 0,this.ul=void 0,this.hl=void 0,this.Co=()=>{var e,t,r=this.dl();r?(x(this.ll)&&(this.ll=(e=I.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),x(this.ul)&&(this.ul=(t=I.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ro()},this._instance=i}initialize(){this.startIfEnabledOrStop()}ai(i){var e,t;(e=I.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?i():(t=I.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return Ou.error("failed to load script",r);i()}))}vl(){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}dl(){var i=this.vl();return O(i)?(O(this.hl)?this.hl.splice(0,this.hl.length,...i):this.hl=[...i],i.length>0?this.hl:void 0):(O(this.hl)&&this.hl.splice(0),this.hl=i||void 0,this.hl)}Ro(){var i,e;(i=this.ll)==null||i.call(this),(e=this.ul)==null||e.call(this),this.ll=void 0,this.ul=void 0}startIfEnabledOrStop(){this.dl()?this.ai(this.Co):this.Ro()}}},Yu=b({surveys:class{get Ne(){return this._instance.config}constructor(i){this.cl=void 0,this._surveyManager=null,this.fl=!1,this.pl=[],this.gl=null,this.ml=null,this._instance=i,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this.Ne.disable_surveys){if(!i.ok)return H.warn("Remote config unavailable. Not loading surveys.");var e=i.config.surveys;if(A(e))return H.warn("Flags not loaded yet. Not loading surveys.");var t=O(e);this.cl=t?e.length>0:e,H.info("flags response received, isSurveysEnabled: "+this.cl),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 r=localStorage.key(t);(r!=null&&r.startsWith(Fo)||r!=null&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((s=>localStorage.removeItem(s)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.fl)H.info("Already initializing surveys, skipping...");else if(this.Ne.disable_surveys)H.info(jn);else if(this.Ne.cookieless_mode&&this._instance.consent.isOptedOut())H.info("Not loading surveys in cookieless mode without consent.");else{var i=I?.__PosthogExtensions__;if(i){if(!x(this.cl)||this.Ne.advanced_enable_surveys){var e=this.cl||this.Ne.advanced_enable_surveys;this.fl=!0;try{var t=i.generateSurveys;if(t)return void this.yl(t,e);var r=i.loadExternalDependency;if(!r)return void this.bl(Ps);r(this._instance,"surveys",(s=>{s||!i.generateSurveys?this.bl("Could not load surveys script",s):this.yl(i.generateSurveys,e)}))}catch(s){throw this.bl("Error initializing surveys",s),s}finally{this.fl=!1}}}else H.error("PostHog Extensions not found.")}}yl(i,e){this._surveyManager=i(this._instance,e),this._surveyEventReceiver=new ju(this._instance),H.info("Surveys loaded successfully"),this._l({isLoaded:!0})}bl(i,e){H.error(i,e),this._l({isLoaded:!1,error:i})}onSurveysLoaded(i){return this.pl.push(i),this._surveyManager&&this._l({isLoaded:!0}),()=>{this.pl=this.pl.filter((e=>e!==i))}}getSurveys(i,e){if(e===void 0&&(e=!1),this.Ne.disable_surveys)return H.info(jn),i([]);var t,r=this._instance.get_property(Jr);if(r&&!e)return i(r,{isLoaded:!0}),void(this.wl()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.gl?this.gl.then((s=>i(s.surveys,s.context))):(typeof Promise<"u"&&(this.gl=new Promise((s=>{t=s}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Ne.token),method:"GET",timestampMode:"query",timeout:this.Ne.surveys_request_timeout_ms,callback:s=>{var n;this.gl=null;var a=s.statusCode;if(a!==200||!s.json){var o="Surveys API could not be loaded, status: "+a;a!==0?H.error(o):s.error||H.warn(o),this.ml=Date.now();var l={isLoaded:!1,error:o};return i([],l),void(t==null||t({surveys:[],context:l}))}this.ml=null;var u,c=s.json.surveys||[],h=c.filter((p=>(function(g){return!(!g.start_date||g.end_date)})(p)&&(Po(p)||(function(g){var f;return!((f=g.conditions)==null||(f=f.actions)==null||(f=f.values)==null||!f.length)})(p))));h.length>0&&((u=this._surveyEventReceiver)==null||u.register(h)),(n=this._instance.persistence)==null||n.register({[Jr]:c,[Li]:Date.now()});var d={isLoaded:!0};i(c,d),t?.({surveys:c,context:d})}}))}wl(){return this.kl()&&!this.gl&&!this.xl()}kl(){var i=this._instance.get_property(Li);return ue(i)&&Date.now()-i>3e5}xl(){return ue(this.ml)&&3e5>Date.now()-this.ml}markSurveyAsSeen(i,e){var t,r={id:i,current_iteration:(t=e?.iteration)!==null&&t!==void 0?t:null};To(r);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}_l(i){for(var e of this.pl)try{if(!i.isLoaded)return e([],i);this.getSurveys(e)}catch(t){H.error("Error in survey callback",t)}}getActiveMatchingSurveys(i,e){if(e===void 0&&(e=!1),!A(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(i,e);H.warn("init was not called")}Sl(i){var e=null;return this.getSurveys((t=>{var r;e=(r=t.find((s=>s.id===i)))!==null&&r!==void 0?r:null})),e}Cl(i){if(A(this._surveyManager))return{eligible:!1,reason:yi};var e=typeof i=="string"?this.Sl(i):i;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Ml(i){if(A(this._surveyManager))return{eligible:!1,reason:yi};var e=typeof i=="string"?this.Sl(i):i;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(i){if(A(this._surveyManager))return H.warn("init was not called"),{visible:!1,disabledReason:yi};var e=this.Ml(i);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(i,e){return A(this._surveyManager)?(H.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:yi})):new Promise((t=>{this.getSurveys((r=>{var s,n=(s=r.find((o=>o.id===i)))!==null&&s!==void 0?s:null;if(n){var a=this.Ml(n);t({visible:a.eligible,disabledReason:a.reason})}else t({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(i,e,t){var r;if(A(this._surveyManager))H.warn("init was not called");else{var s=typeof i=="string"?this.Sl(i):i;if(s!=null&&s.id)if(wu.includes(s.type)){var n=S?.querySelector(e);if(n)return(r=s.appearance)!=null&&r.surveyPopupDelaySeconds?(H.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,o;H.info("Rendering survey "+s.id+" with delay of "+((a=s.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(o=this._surveyManager)==null||o.renderSurvey(s,n,t),H.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,t);H.warn("Survey element not found")}else H.warn("Surveys of type "+s.type+" cannot be rendered in the app");else H.warn("Survey not found")}}displaySurvey(i,e){var t;if(A(this._surveyManager))H.warn("init was not called");else{var r=this.Sl(i);if(r){var s=r;if((t=r.appearance)!=null&&t.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=b({},r,{appearance:b({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==ls.Popover&&e.initialResponses&&H.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var n=this.Cl(r);if(!n.eligible)return void H.warn("Survey is not eligible to be displayed: ",n.reason)}e.displayType!==ls.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else H.warn("Survey not found")}}cancelPendingSurvey(i){A(this._surveyManager)?H.warn("init was not called"):this._surveyManager.cancelSurvey(i)}handlePageUnload(){var i;(i=this._surveyManager)==null||i.handlePageUnload==null||i.handlePageUnload()}}},Xi),Ku={toolbar:class{constructor(i){this.instance=i}Tl(i){I.ph_toolbar_state=i}El(){var i;return(i=I.ph_toolbar_state)!==null&&i!==void 0?i:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,t){if(i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),ns(this.instance.config)||!v||!S)return!1;i=i??v.location,t=t??v.history;try{if(!e){try{v.localStorage.setItem("test","test"),v.localStorage.removeItem("test")}catch{return!1}e=v?.localStorage}var r,s=qu||Gi(i.hash,"__posthog")||Gi(i.hash,"state"),n=s?rn((()=>JSON.parse(atob(decodeURIComponent(s)))))||rn((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&n.action==="ph_authorize"?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?i.hash=n.desiredHash:t?t.replaceState(t.state,"",i.pathname+i.search):i.hash="")):((r=JSON.parse(e.getItem(qn)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}Il(i){var e=I.ph_load_toolbar||I.ph_load_editor;!A(e)&&Ee(e)?e(i,this.instance):Bn.warn("No toolbar load function found")}loadToolbar(i){var e=!(S==null||!S.getElementById(Ha));if(!v||e)return!1;var t=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=b({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},t?{instrument:!1}:{});if(v.localStorage.setItem(qn,JSON.stringify(b({},r,{source:void 0}))),this.El()===2)this.Il(r);else if(this.El()===0){var s;this.Tl(1),(s=I.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(n=>{if(n)return Bn.error("[Toolbar] Failed to load",n),void this.Tl(0);this.Tl(2),this.Il(r)})),te(v,"turbolinks:load",(()=>{this.Tl(0),this.loadToolbar(r)}))}return!0}Pl(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)}}},Ju=b({experiments:ve},Xi),Zu={conversations:class{constructor(i){this.Rl=void 0,this._conversationsManager=null,this.Al=!1,this.Fl=null,this.Ll=!1,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this._instance.config.disable_conversations&&(this.Ol=i.ok,i.ok)){var e=i.config.conversations;A(e)||(Me(e)?this.Rl=e:(this.Rl=e.enabled,this.Fl=e),this.loadIfEnabled())}}reset(){var i;(i=this._conversationsManager)==null||i.reset(),this._conversationsManager=null,this.Rl=void 0,this.Fl=null,this.Ol=void 0,this.Ll=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Al||this._instance.config.disable_conversations||ns(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=I?.__PosthogExtensions__;if(i&&!x(this.Rl)&&this.Rl)if(this.Fl&&this.Fl.token){this.Al=!0;try{var e=i.initConversations;if(e)return this.Dl(e),void(this.Al=!1);var t=i.loadExternalDependency;if(!t)return void this.$l(Ps);t(this._instance,"conversations",(r=>{r||!i.initConversations?this.$l("Could not load conversations script",r):this.Dl(i.initConversations),this.Al=!1}))}catch(r){this.$l("Error initializing conversations",r),this.Al=!1}}else Fe.error("Conversations enabled but missing token in remote config.")}}Dl(i){if(this.Fl)try{this._conversationsManager=i(this.Fl,this._instance),this.Ll=!1,Fe.info("Conversations loaded successfully")}catch(e){this.$l("Error completing conversations initialization",e)}else Fe.error("Cannot complete initialization: remote config is null")}$l(i,e){Fe.error(i,e),this._conversationsManager=null,this.Al=!1,this.Ll=!0}show(){this._conversationsManager?this._conversationsManager.show():Fe.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Rl===!0&&!ye(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":ns(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Ol===!1?"remote_config_failed":x(this.Rl)?this.Ol?"disabled_in_project":"remote_config_pending":this.Rl?A(this.Fl)||!this.Fl.token?"missing_token":I!=null&&I.__PosthogExtensions__?this.Al?"initializing":this.Ll?"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 r=this;return Z((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(i,e,t):(Fe.warn(st),null)}))()}getMessages(i,e){var t=this;return Z((function*(){return t._conversationsManager?t._conversationsManager.getMessages(i,e):(Fe.warn(st),null)}))()}markAsRead(i){var e=this;return Z((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(i):(Fe.warn(st),null)}))()}getTickets(i){var e=this;return Z((function*(){return e._conversationsManager?e._conversationsManager.getTickets(i):(Fe.warn(st),null)}))()}requestRestoreLink(i){var e=this;return Z((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(i):(Fe.warn(st),null)}))()}restoreFromToken(i){var e=this;return Z((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(i):(Fe.warn(st),null)}))()}restoreFromUrlToken(){var i=this;return Z((function*(){return i._conversationsManager?i._conversationsManager.restoreFromUrlToken():(Fe.warn(st),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}Yn(){var i;(i=this._conversationsManager)==null||i.setIdentity()}Xn(){var i;(i=this._conversationsManager)==null||i.clearIdentity()}}},Qu={logs:class{constructor(i){var e,t=this;this.Nl=!1,this.ql=!1,this.rt=re("[logs]"),this.jl=b({},this.rt,{error(){for(var r=arguments.length,s=new Array(r),n=0;r>n;n++)s[n]=arguments[n];s.some(Vn)||t.rt.error(...s)}}),this.er=[],this.Bl=[],this.ya=0,this.Hl=()=>{var r,s;this.ya=0,(r=this.Ul)==null||r.onReconnect(),(s=this.zl)==null||s.onReconnect()},this._instance=i,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.Nl=!0),v&&te(v,"online",this.Hl)}Wl(i,e,t,r){var s,n=(function(a,o){var l,u,c,h,d,p,g,f=(l=a?.flushIntervalMs)!==null&&l!==void 0?l:3e3,m=(u=a?.maxBufferSize)!==null&&u!==void 0?u:100,_=o!=null&&o.consoleCapture?void 0:(c=a?.maxLogsPerInterval)!==null&&c!==void 0?c:1e3,k=x(_)?Math.max(m,2048):Math.max(m,_),y=a?.resourceAttributes;return{serviceName:(h=(d=y?.["service.name"])!==null&&d!==void 0?d:a?.serviceName)!==null&&h!==void 0?h:o?.serviceNameDefault,serviceVersion:(p=y?.["service.version"])!==null&&p!==void 0?p:a?.serviceVersion,environment:(g=y?.["deployment.environment"])!==null&&g!==void 0?g:a?.environment,resourceAttributes:y,beforeSend:a?.beforeSend,flushIntervalMs:f,maxBufferSize:m,maxQueueSize:k,maxBatchRecordsPerPost:100,rateCapWindowMs:f,maxLogsPerInterval:_,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((s=this._instance)==null||(s=s.config)==null?void 0:s.logs,t);return[new rl(this.Vl(i,e),n,this.jl,(()=>this.Zl()),(a=>a()),void 0,r),n]}Gl(){var i,e=(i=this._instance)==null||(i=i.config)==null?void 0:i.logs;if(!this.Ul||this.Ql!==e){var t;(t=this.Ul)==null||t.reset(),this.Ql=e;var r=this.Wl((()=>this.er),(s=>{this.er=s}));this.Ul=r[0],this.Kl=r[1]}return this.Ul}Jl(){var i,e=(i=this._instance)==null||(i=i.config)==null?void 0:i.logs;if(!this.zl||this.Yl!==e){var t;(t=this.zl)==null||t.reset(),this.Yl=e;var r=this.Wl((()=>this.Bl),(s=>{this.Bl=s}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Gn);this.zl=r[0],this.Xl=r[1]}return this.zl}initialize(){this.loadIfEnabled()}onRemoteConfig(i){var e;if(i.ok){var t=(e=i.config.logs)==null?void 0:e.captureConsoleLogs;!A(t)&&t&&(this.Nl=!0,this.loadIfEnabled())}}reset(){var i,e;this.er=[],(i=this.Ul)==null||i.reset(),this.Bl=[],(e=this.zl)==null||e.reset(),this.ya=0}captureLog(i){this.Gl().captureLog(i)}he(i){this.Jl().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.Ul&&this.Ul.flush().catch((e=>this.iu(e))),this.zl&&this.zl.flush().catch((e=>this.iu(e))))}iu(i){Vn(i)||this.rt.error("PostHog logs flush failed:",i)}loadIfEnabled(){if(this.Nl&&!this.ql){var i=I?.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",(t=>{var r;t||(r=i.logs)==null||!r.initializeLogs?this.rt.error("Could not load logs script",t):(i.logs.initializeLogs(this._instance),this.ql=!0)})):this.rt.error(Ps)}else this.rt.error("PostHog Extensions not found.")}}Vl(i,e){var t=this._instance;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},getPersistedProperty:r=>r===Be.LogsQueue?i():void 0,setPersistedProperty(r,s){var n;r===Be.LogsQueue&&e((n=s)!==null&&n!==void 0?n:[])},Ot:r=>this.Ot(r),getLibraryId:()=>U.LIB_NAME,getLibraryVersion:()=>U.LIB_VERSION}}Ot(i){return new Promise((e=>{if(eo(this.ya,3))e({kind:"fatal",error:Ir(void 0,"logs endpoint is unreachable, dropping batch")});else{var t=!1,r=n=>{t||(t=!0,clearTimeout(s),e(n))},s=setTimeout((()=>{this.rt.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Ir(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.ru(),data:i,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:n=>{var a=n.statusCode;if(this.nu(a),a>=200&&300>a)r({kind:"ok"});else if(a===413)r({kind:"too-large"});else if(a!==0&&a!==429&&500>a)r({kind:"fatal",error:new Error("logs request failed with status "+a)});else{var o;a===0?(n.error||this.rt.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Ir(n.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:(o=n.error)!==null&&o!==void 0?o:new Error("logs request failed with status "+a)})}}})}}))}nu(i){(i!==0||this._instance.__loaded)&&(this.ya=to(i,this.ya,3,(()=>this.rt.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.er.length>0&&this.su(i,this.er,this.Kl,U.LIB_NAME,(e=>{this.er=e})),this.Bl.length>0&&this.su(i,this.Bl,this.Xl,Gn,(e=>{this.Bl=e}))}su(i,e,t,r,s){if(e.length!==0){var n=e.map((o=>o.record));s([]);var a=Sa(n,ka(t,U.LIB_NAME,U.LIB_VERSION),r,U.LIB_VERSION);this._instance._send_request({method:"POST",url:this.ru(),data:a,compression:"best-available",batchKey:"logs",transport:i})}}ru(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Zl(){var i,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var t=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=t.windowId,s=t.sessionStartTimestamp,n=t.lastActivityTimestamp;e.sessionId=t.sessionId,e.windowId=r,A(s)||(e.sessionStartTimestamp=s),A(n)||(e.lastActivityTimestamp=n)}if(I!=null&&(i=I.location)!=null&&i.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Ze(I.location.href):I.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(e.activeFeatureFlags=a)}return e}}},Xu={metrics:class{constructor(i){this.rt=re("[metrics]"),this._instance=i}initialize(){}Gl(){var i,e,t=(i=this._instance)==null||(i=i.config)==null?void 0:i.metrics;return this.Ul&&this.Ql===t||((e=this.Ul)==null||e.reset(),this.Ql=t,this.Ul=new sl(this.Vl(),(function(r){var s,n,a,o,l,u=r?.resourceAttributes;return{serviceName:(s=u?.["service.name"])!==null&&s!==void 0?s:r?.serviceName,serviceVersion:(n=u?.["service.version"])!==null&&n!==void 0?n:r?.serviceVersion,environment:(a=u?.["deployment.environment"])!==null&&a!==void 0?a:r?.environment,resourceAttributes:u,beforeSend:r?.beforeSend,flushIntervalMs:(o=r?.flushIntervalMs)!==null&&o!==void 0?o:1e4,maxSeriesPerFlush:(l=r?.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}})(t),this.rt)),this.Ul}count(i,e,t){e===void 0&&(e=1),this.Gl().count(i,e,t)}gauge(i,e,t){this.Gl().gauge(i,e,t)}histogram(i,e,t){this.Gl().histogram(i,e,t)}flush(i){if(!this.Ul)return Promise.resolve();if(i){var e=this.Ul.drainWindow();return e&&this.Jt(e,i),Promise.resolve()}return this.Ul.flush().catch((t=>this.rt.error("PostHog metrics flush failed:",t)))}reset(){var i;(i=this.Ul)==null||i.reset()}Vl(){var i=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},Jt:t=>e.Jt(t),getLibraryId:()=>U.LIB_NAME,getLibraryVersion:()=>U.LIB_VERSION}}Jt(i,e){return new Promise((t=>{var r=!1,s=a=>{r||(r=!0,clearTimeout(n),t(a))},n=setTimeout((()=>s({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(b({method:"POST",url:this.au(),data:i,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(a){var o=a.statusCode;if(o>=200&&300>o)s({kind:"ok"});else if(o===413)s({kind:"too-large"});else if(o!==0&&o!==429&&500>o)s({kind:"fatal",error:new Error("metrics request failed with status "+o)});else{var l;s({kind:"retry-later",error:(l=a.error)!==null&&l!==void 0?l:new Error("metrics request failed with status "+o)})}}}))}))}au(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},ec=b({},Xi,Hu,Uu,zu,Gu,Vu,Yu,Wu,Ku,Ju,Zu,Qu,Xu);$e.__defaultExtensionClasses=b({},ec);var tc=(function(){U.SDK_DIST_CHANNEL="npm";var i=Zt[mt]=new $e;return(function(){function e(){e.done||(e.done=!0,Io=!1,G(Zt,(function(t){t._dom_loaded()})))}S!=null&&S.addEventListener?S.readyState==="complete"?e():te(S,"DOMContentLoaded",e,{capture:!1}):v&&E.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),i})();export{_e as Compression,ls as DisplaySurveyType,$e as PostHog,su as ProductTourEventName,yn as ProductTourEventProperties,Ge as SurveyEventName,_r as SurveyEventProperties,Ot as SurveyEventType,fr as SurveyType,tc as default,tc as posthog};