denchclaw 2.0.2 → 2.0.4

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 (121) hide show
  1. package/apps/web/.next/standalone/apps/web/.env +1 -0
  2. package/apps/web/.next/standalone/apps/web/.next/BUILD_ID +1 -1
  3. package/apps/web/.next/standalone/apps/web/.next/app-build-manifest.json +78 -77
  4. package/apps/web/.next/standalone/apps/web/.next/app-path-routes-manifest.json +23 -23
  5. package/apps/web/.next/standalone/apps/web/.next/build-manifest.json +2 -2
  6. package/apps/web/.next/standalone/apps/web/.next/server/app/_not-found/page.js +2 -2
  7. package/apps/web/.next/standalone/apps/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  8. package/apps/web/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  9. package/apps/web/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
  10. package/apps/web/.next/standalone/apps/web/.next/server/app/_not-found.rsc +14 -13
  11. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/active/route_client-reference-manifest.js +1 -1
  12. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/route.js +2 -2
  13. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/route.js.nft.json +1 -1
  14. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/route_client-reference-manifest.js +1 -1
  15. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stop/route.js +1 -1
  16. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stop/route.js.nft.json +1 -1
  17. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stop/route_client-reference-manifest.js +1 -1
  18. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stream/route_client-reference-manifest.js +1 -1
  19. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/subagents/route_client-reference-manifest.js +1 -1
  20. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/jobs/[jobId]/runs/route_client-reference-manifest.js +1 -1
  21. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/jobs/route_client-reference-manifest.js +1 -1
  22. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/runs/[sessionId]/route_client-reference-manifest.js +1 -1
  23. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/runs/search-transcript/route_client-reference-manifest.js +1 -1
  24. package/apps/web/.next/standalone/apps/web/.next/server/app/api/memories/route_client-reference-manifest.js +1 -1
  25. package/apps/web/.next/standalone/apps/web/.next/server/app/api/profiles/route_client-reference-manifest.js +1 -1
  26. package/apps/web/.next/standalone/apps/web/.next/server/app/api/profiles/switch/route_client-reference-manifest.js +1 -1
  27. package/apps/web/.next/standalone/apps/web/.next/server/app/api/sessions/[sessionId]/route_client-reference-manifest.js +1 -1
  28. package/apps/web/.next/standalone/apps/web/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
  29. package/apps/web/.next/standalone/apps/web/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  30. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/[id]/messages/route_client-reference-manifest.js +1 -1
  31. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/[id]/route_client-reference-manifest.js +1 -1
  32. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/route.js +1 -1
  33. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/route.js.nft.json +1 -1
  34. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/route_client-reference-manifest.js +1 -1
  35. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/assets/[...path]/route_client-reference-manifest.js +1 -1
  36. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/browse/route_client-reference-manifest.js +1 -1
  37. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/browse-file/route_client-reference-manifest.js +1 -1
  38. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/context/route_client-reference-manifest.js +1 -1
  39. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/copy/route_client-reference-manifest.js +1 -1
  40. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/db/introspect/route_client-reference-manifest.js +1 -1
  41. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/db/query/route_client-reference-manifest.js +1 -1
  42. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/delete/route.js +1 -1
  43. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/delete/route.js.nft.json +1 -1
  44. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/delete/route_client-reference-manifest.js +1 -1
  45. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/file/route_client-reference-manifest.js +1 -1
  46. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/init/route.js +3 -3
  47. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/init/route.js.nft.json +1 -1
  48. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/init/route_client-reference-manifest.js +1 -1
  49. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/list/route_client-reference-manifest.js +1 -1
  50. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/mkdir/route_client-reference-manifest.js +1 -1
  51. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/move/route_client-reference-manifest.js +1 -1
  52. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/display-field/route_client-reference-manifest.js +1 -1
  53. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/[id]/route_client-reference-manifest.js +1 -1
  54. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/bulk-delete/route_client-reference-manifest.js +1 -1
  55. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/options/route_client-reference-manifest.js +1 -1
  56. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/route.js +1 -1
  57. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/route.js.nft.json +1 -1
  58. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/route_client-reference-manifest.js +1 -1
  59. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/[fieldId]/enum-rename/route_client-reference-manifest.js +1 -1
  60. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/[fieldId]/route_client-reference-manifest.js +1 -1
  61. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/reorder/route_client-reference-manifest.js +1 -1
  62. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/route_client-reference-manifest.js +1 -1
  63. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/views/route_client-reference-manifest.js +1 -1
  64. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/open-file/route_client-reference-manifest.js +1 -1
  65. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/path-info/route_client-reference-manifest.js +1 -1
  66. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/query/route_client-reference-manifest.js +1 -1
  67. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/raw-file/route_client-reference-manifest.js +1 -1
  68. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/rename/route_client-reference-manifest.js +1 -1
  69. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/reports/execute/route.js +1 -1
  70. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/reports/execute/route.js.nft.json +1 -1
  71. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/reports/execute/route_client-reference-manifest.js +1 -1
  72. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/search-index/route_client-reference-manifest.js +1 -1
  73. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/suggest-files/route_client-reference-manifest.js +1 -1
  74. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/switch/route.js +1 -1
  75. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/switch/route.js.nft.json +1 -1
  76. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/switch/route_client-reference-manifest.js +1 -1
  77. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/thumbnail/route_client-reference-manifest.js +1 -1
  78. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/tree/route_client-reference-manifest.js +1 -1
  79. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/upload/route.js +1 -1
  80. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/upload/route.js.nft.json +1 -1
  81. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/upload/route_client-reference-manifest.js +1 -1
  82. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/virtual-file/route_client-reference-manifest.js +1 -1
  83. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/watch/route_client-reference-manifest.js +1 -1
  84. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/write-binary/route_client-reference-manifest.js +1 -1
  85. package/apps/web/.next/standalone/apps/web/.next/server/app/index.html +2 -2
  86. package/apps/web/.next/standalone/apps/web/.next/server/app/index.rsc +18 -17
  87. package/apps/web/.next/standalone/apps/web/.next/server/app/page.js +3 -3
  88. package/apps/web/.next/standalone/apps/web/.next/server/app/page.js.nft.json +1 -1
  89. package/apps/web/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  90. package/apps/web/.next/standalone/apps/web/.next/server/app/workspace/page.js +8 -8
  91. package/apps/web/.next/standalone/apps/web/.next/server/app/workspace/page.js.nft.json +1 -1
  92. package/apps/web/.next/standalone/apps/web/.next/server/app/workspace/page_client-reference-manifest.js +1 -1
  93. package/apps/web/.next/standalone/apps/web/.next/server/app/workspace.html +1 -1
  94. package/apps/web/.next/standalone/apps/web/.next/server/app/workspace.rsc +18 -17
  95. package/apps/web/.next/standalone/apps/web/.next/server/app-paths-manifest.json +23 -23
  96. package/apps/web/.next/standalone/apps/web/.next/server/chunks/3180.js +9 -0
  97. package/apps/web/.next/standalone/apps/web/.next/server/chunks/3536.js +1 -0
  98. package/apps/web/.next/standalone/apps/web/.next/server/functions-config-manifest.json +18 -18
  99. package/apps/web/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
  100. package/apps/web/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
  101. package/apps/web/.next/{static/chunks/9978-67863ef76a85970a.js → standalone/apps/web/.next/static/chunks/9978-a2bf90231d08284f.js} +1 -1
  102. package/apps/web/.next/standalone/apps/web/.next/static/chunks/app/layout-292b6d5625f1c941.js +1 -0
  103. package/apps/web/.next/standalone/apps/web/.next/static/chunks/df90ee31-33cbf7968acd3b6e.js +1 -0
  104. package/apps/web/.next/standalone/apps/web/package.json +3 -1
  105. package/apps/web/.next/standalone/package.json +2 -1
  106. package/apps/web/.next/{standalone/apps/web/.next/static/chunks/9978-67863ef76a85970a.js → static/chunks/9978-a2bf90231d08284f.js} +1 -1
  107. package/apps/web/.next/static/chunks/app/layout-292b6d5625f1c941.js +1 -0
  108. package/apps/web/.next/static/chunks/df90ee31-33cbf7968acd3b6e.js +1 -0
  109. package/dist/{cli-name-8WJ6gVD5.js → cli-name-yhDyCrts.js} +1 -1
  110. package/dist/entry.js +2 -2
  111. package/dist/{program-DSR-Zphq.js → program-BjjW6tCn.js} +49 -2
  112. package/dist/{run-main-B-QwRglo.js → run-main-CZ4r6_2T.js} +3 -3
  113. package/dist/telemetry-Drjj3hin.js +118 -0
  114. package/package.json +2 -1
  115. package/apps/web/.next/standalone/apps/web/.next/server/chunks/9402.js +0 -9
  116. package/apps/web/.next/standalone/apps/web/.next/static/chunks/app/layout-3095921daec5aebc.js +0 -1
  117. package/apps/web/.next/static/chunks/app/layout-3095921daec5aebc.js +0 -1
  118. /package/apps/web/.next/standalone/apps/web/.next/static/{rfl8V4U-KWtyivUflJxQF → uJ5FgQAeCz2zbk8ixyWyc}/_buildManifest.js +0 -0
  119. /package/apps/web/.next/standalone/apps/web/.next/static/{rfl8V4U-KWtyivUflJxQF → uJ5FgQAeCz2zbk8ixyWyc}/_ssgManifest.js +0 -0
  120. /package/apps/web/.next/static/{rfl8V4U-KWtyivUflJxQF → uJ5FgQAeCz2zbk8ixyWyc}/_buildManifest.js +0 -0
  121. /package/apps/web/.next/static/{rfl8V4U-KWtyivUflJxQF → uJ5FgQAeCz2zbk8ixyWyc}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{9455:(e,s,u)=>{Promise.resolve().then(u.bind(u,21460)),Promise.resolve().then(u.t.bind(u,89480,23))},21460:(e,s,u)=>{"use strict";u.d(s,{PostHogPageviewTracker:()=>n});var r=u(29341),a=u(74166),t=u(99197);function n(){let e=(0,t.usePathname)(),s=(0,t.useSearchParams)();return(0,a.useEffect)(()=>{},[]),(0,a.useEffect)(()=>{1},[e,s]),null}},89480:()=>{},99197:(e,s,u)=>{"use strict";var r=u(84841);u.o(r,"usePathname")&&u.d(s,{usePathname:function(){return r.usePathname}}),u.o(r,"useRouter")&&u.d(s,{useRouter:function(){return r.useRouter}}),u.o(r,"useSearchParams")&&u.d(s,{useSearchParams:function(){return r.useSearchParams}})}},e=>{e.O(0,[6827,5700,1705,8522,7358],()=>e(e.s=9455)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5700],{29341:(e,t,i)=>{i.d(t,{Ay:()=>np});var s="undefined"!=typeof window?window:void 0,r="undefined"!=typeof globalThis?globalThis:s;"undefined"==typeof self&&(r.self=r),"undefined"==typeof File&&(r.File=function(){});var n=Array.prototype,o=n.forEach,a=n.indexOf,l=null==r?void 0:r.navigator,c=null==r?void 0:r.document,u=null==r?void 0:r.location,h=null==r?void 0:r.fetch,d=null!=r&&r.XMLHttpRequest&&"withCredentials"in new r.XMLHttpRequest?r.XMLHttpRequest:void 0,p=null==r?void 0:r.AbortController,_=null==l?void 0:l.userAgent,g=null!=s?s:{},v={DEBUG:!1,LIB_VERSION:"1.358.1"};function f(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function m(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function o(e){f(n,s,r,o,a,"next",e)}function a(e){f(n,s,r,o,a,"throw",e)}o(void 0)})}}function y(){return(y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e}).apply(null,arguments)}function b(e,t){if(null==e)return{};var i={};for(var s in e)if(({}).hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}var E=["$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"],w=["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"],x=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return w.concat(t).some(e=>{var t=e.toLowerCase();return -1!==i.indexOf(t)})};function k(e,t){return -1!==e.indexOf(t)}var S=function(e){return e.trim()},P=function(e){return e.replace(/^\$/,"")},T=Array.isArray,O=Object.prototype,$=O.hasOwnProperty,F=O.toString,I=T||function(e){return"[object Array]"===F.call(e)},C=e=>"function"==typeof e,R=e=>e===Object(e)&&!I(e),A=e=>{if(R(e)){for(var t in e)if($.call(e,t))return!1;return!0}return!1},M=e=>void 0===e,L=e=>"[object String]"==F.call(e),N=e=>L(e)&&0===e.trim().length,D=e=>null===e,j=e=>M(e)||D(e),U=e=>"[object Number]"==F.call(e)&&e==e,H=e=>U(e)&&e>0,q=e=>"[object Boolean]"===F.call(e),W=e=>k(E,e);function V(e){return null===e||"object"!=typeof e}function z(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function B(e){return!M(Event)&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var G=[!0,"true",1,"1","yes"],Y=e=>k(G,e),K=[!1,"false",0,"0","no"];function X(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),U(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e<t?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),X(r||i,t,i,s))}class J{constructor(e){this.t={},this.i=e.i,this.o=X(e.bucketSize,0,100,e.h),this.m=X(e.refillRate,0,this.o,e.h),this.S=X(e.refillInterval,0,864e5,e.h)}$(e,t){var i=Math.floor((t-e.lastAccess)/this.S);if(i>0){var s=i*this.m;e.tokens=Math.min(e.tokens+s,this.o),e.lastAccess=e.lastAccess+i*this.S}}consumeRateLimit(e){var t,i=Date.now(),s=String(e),r=this.t[s];return r?this.$(r,i):(r={tokens:this.o,lastAccess:i},this.t[s]=r),0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.i)||t.call(this,e)),0===r.tokens)}stop(){this.t={}}}var Z,Q,ee,et="Mobile",ei="Android",es="Tablet",er=ei+" "+es,en="iPad",eo="Apple",ea=eo+" Watch",el="Safari",ec="BlackBerry",eu="Samsung",eh=eu+"Browser",ed=eu+" Internet",ep="Chrome",e_=ep+" OS",eg=ep+" iOS",ev="Internet Explorer",ef=ev+" "+et,em="Opera",ey=em+" Mini",eb="Edge",eE="Microsoft "+eb,ew="Firefox",ex=ew+" iOS",ek="Nintendo",eS="PlayStation",eP="Xbox",eT=ei+" "+et,eO=et+" "+el,e$="Windows",eF=e$+" Phone",eI="Nokia",eC="Ouya",eR="Generic",eA=eR+" "+et.toLowerCase(),eM=eR+" "+es.toLowerCase(),eL="Konqueror",eN="(\\d+(\\.\\d+)?)",eD=RegExp("Version/"+eN),ej=RegExp(eP,"i"),eU=RegExp(eS+" \\w+","i"),eH=RegExp(ek+" \\w+","i"),eq=RegExp(ec+"|PlayBook|BB10","i"),eW={"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"},eV=function(e,t){let i;return t=t||"",k(e," OPR/")&&k(e,"Mini")?ey:k(e," OPR/")?em:eq.test(e)?ec:k(e,"IE"+et)||k(e,"WPDesktop")?ef:k(e,eh)?ed:k(e,eb)||k(e,"Edg/")?eE:k(e,"FBIOS")?"Facebook "+et:k(e,"UCWEB")||k(e,"UCBrowser")?"UC Browser":k(e,"CriOS")?eg:k(e,"CrMo")||k(e,ep)?ep:k(e,ei)&&k(e,el)?eT:k(e,"FxiOS")?ex:k(e.toLowerCase(),eL.toLowerCase())?eL:(i=t)&&k(i,eo)||k(e,el)&&!k(e,ep)&&!k(e,ei)?k(e,et)?eO:el:k(e,ew)?ew:k(e,"MSIE")||k(e,"Trident/")?ev:k(e,"Gecko")?ew:""},ez={[ef]:[RegExp("rv:"+eN)],[eE]:[RegExp(eb+"?\\/"+eN)],[ep]:[RegExp("("+ep+"|CrMo)\\/"+eN)],[eg]:[RegExp("CriOS\\/"+eN)],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/"+eN)],[el]:[eD],[eO]:[eD],[em]:[RegExp("(Opera|OPR)\\/"+eN)],[ew]:[RegExp(ew+"\\/"+eN)],[ex]:[RegExp("FxiOS\\/"+eN)],[eL]:[RegExp("Konqueror[:/]?"+eN,"i")],[ec]:[RegExp(ec+" "+eN),eD],[eT]:[RegExp("android\\s"+eN,"i")],[ed]:[RegExp(eh+"\\/"+eN)],[ev]:[RegExp("(rv:|MSIE )"+eN)],Mozilla:[RegExp("rv:"+eN)]},eB=function(e,t){var i=ez[eV(e,t)];if(M(i))return null;for(var s=0;s<i.length;s++){var r=i[s],n=e.match(r);if(n)return parseFloat(n[n.length-2])}return null},eG=[[RegExp(eP+"; "+eP+" (.*?)[);]","i"),e=>[eP,e&&e[1]||""]],[RegExp(ek,"i"),[ek,""]],[RegExp(eS,"i"),[eS,""]],[eq,[ec,""]],[RegExp(e$,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[eF,""];if(new RegExp(et).test(t)&&!/IEMobile\b/.test(t))return[e$+" "+et,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=eW[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[e$,s]}return[e$,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=M(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+ei+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ei+")","i"),e=>e&&e[2]?[ei,[e[2],e[3],e[4]||"0"].join(".")]:[ei,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var i=[e[1],e[2],e[3]||"0"];t[1]=i.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[e_,""]],[/Linux|debian/i,["Linux",""]]],eY=function(e){return eH.test(e)?ek:eU.test(e)?eS:ej.test(e)?eP:RegExp(eC,"i").test(e)?eC:RegExp("("+eF+"|WPDesktop)","i").test(e)?eF:/iPad/.test(e)?en:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ea:eq.test(e)?ec:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(eI,"i").test(e)?eI:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(et).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?ei:er:RegExp("(pda|"+et+")","i").test(e)?eA:RegExp(es,"i").test(e)&&!RegExp(es+" pc","i").test(e)?eM:""},eK=e=>e instanceof Error;class eX{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return m(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&I(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,s;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),y({},e,{cause:i,stack:s})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return m(function*(){var i=e;for(var s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){var i,s,r,n={type:e.type,value:e.value,mechanism:{type:null!=(i=t.type)?i:"generic",handled:null==(s=t.handled)||s,synthetic:null!=(r=e.synthetic)&&r}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,y({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:function(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return ee&&i.length===Q||(Q=i.length,ee=i.reduce((i,s)=>{Z||(Z={});var r=Z[s];if(r)i[r[0]]=r[1];else for(var n=e(s),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,c=t[s];if(l&&c){i[l]=c,Z[s]=[l,c];break}}return i},{})),ee}}(this.stackParser),skipFirstLines:null!=(t=e.skipFirstLines)?t:1}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var s=(i,s)=>{if(s<=4){var r=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,r)}};return y({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,i),next:e=>s(e,i+1)})}}function eJ(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:!0};return M(s)||(n.lineno=s),M(r)||(n.colno=r),n}var eZ=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},eQ=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,e0=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,e1=/\((\S*)(?::(\d+))(?::(\d+))\)/,e2=(e,t)=>{var i=eQ.exec(e);if(i){var[,s,r,n]=i;return eJ(t,s,"?",+r,+n)}var o=e0.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=e1.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=eZ(o[1]||"?",o[2]);return eJ(t,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},e3=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,e5=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,e6=(e,t)=>{var i=e3.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=e5.exec(i[3]);s&&(i[1]=i[1]||"eval",i[3]=s[1],i[4]=s[2],i[5]="")}var r=i[3],n=i[1]||"?";return[n,r]=eZ(n,r),eJ(t,r,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},e8=/\(error: (.*)\)/;class e4{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=L(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return z(e,"DOMException")}isDOMError(e){return z(e,"DOMError")}}class e7{match(e){return e instanceof Error}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 i=e.message;return i.error&&"string"==typeof i.error.message?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}}class e9{constructor(){}match(e){return z(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}var te=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class tt{match(e){return"string"==typeof e}coerce(e,t){var i,[s,r]=this.getInfos(e);return{type:null!=s?s:"Error",value:null!=r?r:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(te);return s&&(t=s[1],i=s[2]),[t,i]}}var ti=["fatal","error","warning","log","info","debug"];function ts(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var s=i.length;s>0;s--){var r=i.slice(0,s).join(", ");if(!(r.length>t))return s===i.length||r.length<=t?r:r.slice(0,t)+"..."}return""}class tr{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return B(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+ts(e)}isSeverityLevel(e){return L(e)&&!N(e)&&ti.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(eK(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class tn{match(e){return B(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+ts(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class to{match(e){return V(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class ta{match(e){return z(e,"PromiseRejectionEvent")}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return V(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){if(V(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var tl=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,r={k:function(t){if(s&&(v.DEBUG||g.POSTHOG_DEBUG||i)&&!M(s.console)&&s.console){for(var r=("__rrweb_original__"in s.console[t])?s.console[t].__rrweb_original__:s.console[t],n=arguments.length,o=Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];r(e,...o)}},info:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];r.k("log",...t)},warn:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];r.k("warn",...t)},error:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];r.k("error",...t)},critical:function(){for(var t=arguments.length,i=Array(t),s=0;s<t;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning:e=>{r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>tl(e+" "+t,i)};return r},tc=tl("[PostHog.js]"),tu=tc.createLogger,th=tu("[ExternalScriptsLoader]"),td=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return th.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==c?void 0:c.querySelectorAll("script");if(s){for(var r,n=0;n<s.length;n++)if(r=function(){if(s[n].src===t){var e=s[n];return e.__posthog_loading_callback_fired?{v:i()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,i(void 0,t)}),e.onerror=e=>i(e),{v:void 0})}}())return r.v}var o=()=>{if(!c)return i("document not found");var s=c.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)},s.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)c.head.appendChild(s);else{var r,n=c.querySelectorAll("body > script");n.length>0?null==(r=n[0].parentNode)||r.insertBefore(s,n[0]):c.body.appendChild(s)}};null!=c&&c.body?o():null==c||c.addEventListener("DOMContentLoaded",o)};g.__PosthogExtensions__=g.__PosthogExtensions__||{},g.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{var s="/static/"+t+".js?v="+e.version;"remote-config"===t&&(s="/array/"+e.config.token+"/config.js"),"toolbar"===t&&(s=s+"&t="+3e5*Math.floor(Date.now()/3e5));var r=e.requestRouter.endpointFor("assets",s);td(e,r,i)},g.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var s=e.requestRouter.endpointFor("api",t);td(e,s,i)};var tp={};function t_(e,t,i){if(I(e)){if(o&&e.forEach===o)e.forEach(t,i);else if("length"in e&&e.length===+e.length){for(var s=0,r=e.length;s<r;s++)if(s in e&&t.call(i,e[s],s)===tp)return}}}function tg(e,t,i){if(!j(e)){if(I(e))return t_(e,t,i);if(e instanceof FormData){for(var s of e.entries())if(t.call(i,s[1],s[0])===tp)return}else for(var r in e)if($.call(e,r)&&t.call(i,e[r],r)===tp)return}}var tv=function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];return t_(i,function(t){for(var i in t)void 0!==t[i]&&(e[i]=t[i])}),e},tf=function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];return t_(i,function(t){t_(t,function(t){e.push(t)})}),e};function tm(e){for(var t=Object.keys(e),i=t.length,s=Array(i);i--;)s[i]=[t[i],e[t[i]]];return s}var ty=function(e){try{return e()}catch(e){return}},tb=function(e){return function(){try{for(var t=arguments.length,i=Array(t),s=0;s<t;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){tc.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),tc.critical(e)}}},tE=function(e){var t={};return tg(e,function(e,i){(L(e)&&e.length>0||U(e))&&(t[i]=e)}),t},tw=["herokuapp.com","vercel.app","netlify.app"];function tx(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}function tk(e,t,i,s){var{capture:r=!1,passive:n=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:r,passive:n})}function tS(e){return"ph_toolbar_internal"===e.name}var tP="$people_distinct_id",tT="__alias",tO="__timers",t$="$autocapture_disabled_server_side",tF="$heatmaps_enabled_server_side",tI="$exception_capture_enabled_server_side",tC="$error_tracking_suppression_rules",tR="$error_tracking_capture_extension_exceptions",tA="$web_vitals_enabled_server_side",tM="$dead_clicks_enabled_server_side",tL="$product_tours_enabled_server_side",tN="$web_vitals_allowed_metrics",tD="$session_recording_remote_config",tj="$sesid",tU="$session_is_sampled",tH="$enabled_feature_flags",tq="$early_access_features",tW="$feature_flag_details",tV="$stored_person_properties",tz="$stored_group_properties",tB="$surveys",tG="$flag_call_reported",tY="$feature_flag_errors",tK="$feature_flag_evaluated_at",tX="$user_state",tJ="$client_session_props",tZ="$capture_rate_limit",tQ="$initial_campaign_params",t0="$initial_referrer_info",t1="$initial_person_info",t2="$epp",t3="__POSTHOG_TOOLBAR__",t5="$posthog_cookieless",t6=[tP,tT,"__cmpns",tO,"$session_recording_enabled_server_side",tF,tj,tH,tC,tX,tq,tW,tz,tV,tB,tG,tY,tK,tJ,tZ,tQ,t0,t2,t1];Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return U(e)&&isFinite(e)&&Math.floor(e)===e});var t8="0123456789abcdef";class t4{constructor(e){if(this.bytes=e,16!==e.length)throw TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||e<0||t<0||i<0||s<0||e>0xffffffffffff||t>4095||i>0x3fffffff||s>0xffffffff)throw RangeError("invalid field value");var r=new Uint8Array(16);return r[0]=e/0x10000000000,r[1]=e/0x100000000,r[2]=e/0x1000000,r[3]=e/65536,r[4]=e/256,r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new t4(r)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+t8.charAt(this.bytes[t]>>>4)+t8.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw Error("Invalid UUIDv7 was generated");return e}clone(){return new t4(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class t7{constructor(){this.P=0,this.T=0,this.R=new it}generate(){var e=this.generateOrAbort();if(M(e)){this.P=0;var t=this.generateOrAbort();if(M(t))throw Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.P)this.P=e,this.I();else{if(!(e+1e4>this.P))return;this.T++,this.T>0x3ffffffffff&&(this.P++,this.I())}return t4.fromFieldsV7(this.P,Math.trunc(this.T/0x40000000),0x3fffffff&this.T,this.R.nextUint32())}I(){this.T=1024*this.R.nextUint32()+(1023&this.R.nextUint32())}}var t9,ie=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};s&&!M(s.crypto)&&crypto.getRandomValues&&(ie=e=>crypto.getRandomValues(e));class it{constructor(){this.C=new Uint32Array(8),this.O=1/0}nextUint32(){return this.O>=this.C.length&&(ie(this.C),this.O=0),this.C[this.O++]}}var ii=()=>is().toString(),is=()=>(t9||(t9=new t7)).generate(),ir="",io=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ia={F:()=>!!c,M:function(e){tc.error("cookieStore error: "+e)},A:function(e){if(c){try{for(var t=e+"=",i=c.cookie.split(";").filter(e=>e.length),s=0;s<i.length;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},D:function(e){var t;try{t=JSON.parse(ia.A(e))||{}}catch(e){}return t},L:function(e,t,i,s,r){if(c)try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=c),ir)return ir;if(!t||["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+ii();!ir&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",ir=n)}return ir}(e);if(!i){var s,r=(s=e.match(io))?s[0]:"";r!==i&&tc.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(c.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+24*i*36e5),n="; expires="+l.toUTCString()}r&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&tc.warn("cookieStore warning: large cookie, len="+u.length),c.cookie=u,u}catch(e){return}},j:function(e,t){if(null!=c&&c.cookie)try{ia.L(e,"",-1,t)}catch(e){return}}},il=null,ic={F:function(){if(!D(il))return il;var e=!0;if(M(s))e=!1;else try{var t="__mplssupport__";ic.L(t,"xyz"),'"xyz"'!==ic.A(t)&&(e=!1),ic.j(t)}catch(t){e=!1}return e||tc.error("localStorage unsupported; falling back to cookie store"),il=e,e},M:function(e){tc.error("localStorage error: "+e)},A:function(e){try{return null==s?void 0:s.localStorage.getItem(e)}catch(e){ic.M(e)}return null},D:function(e){try{return JSON.parse(ic.A(e))||{}}catch(e){}return null},L:function(e,t){try{null==s||s.localStorage.setItem(e,JSON.stringify(t))}catch(e){ic.M(e)}},j:function(e){try{null==s||s.localStorage.removeItem(e)}catch(e){ic.M(e)}}},iu=["$device_id","distinct_id",tj,tU,t2,t1,tX],ih={},id={F:function(){return!0},M:function(e){tc.error("memoryStorage error: "+e)},A:function(e){return ih[e]||null},D:function(e){return ih[e]||null},L:function(e,t){ih[e]=t},j:function(e){delete ih[e]}},ip=null,i_={F:function(){if(!D(ip))return ip;if(ip=!0,M(s))ip=!1;else try{var e="__support__";i_.L(e,"xyz"),'"xyz"'!==i_.A(e)&&(ip=!1),i_.j(e)}catch(e){ip=!1}return ip},M:function(e){tc.error("sessionStorage error: ",e)},A:function(e){try{return null==s?void 0:s.sessionStorage.getItem(e)}catch(e){i_.M(e)}return null},D:function(e){try{return JSON.parse(i_.A(e))||null}catch(e){}return null},L:function(e,t){try{null==s||s.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){i_.M(e)}},j:function(e){try{null==s||s.sessionStorage.removeItem(e)}catch(e){i_.M(e)}}},ig=function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e}({});class iv{constructor(e){this._instance=e}get N(){return this._instance.config}get consent(){return this.U()?ig.DENIED:this.H}isOptedOut(){return"always"===this.N.cookieless_mode||this.consent===ig.DENIED||this.consent===ig.PENDING&&(this.N.opt_out_capturing_by_default||"on_reject"===this.N.cookieless_mode)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===ig.DENIED}optInOut(e){this.B.L(this.q,+!!e,this.N.cookie_expiration,this.N.cross_subdomain_cookie,this.N.secure_cookie)}reset(){this.B.j(this.q,this.N.cross_subdomain_cookie)}get q(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get H(){var e=this.B.A(this.q);return Y(e)?ig.GRANTED:k(K,e)?ig.DENIED:ig.PENDING}get B(){if(!this.V){var e=this.N.opt_out_capturing_persistence_type;this.V="localStorage"===e?ic:ia;var t="localStorage"===e?ia:ic;t.A(this.q)&&(this.V.A(this.q)||this.optInOut(Y(t.A(this.q))),t.j(this.q,this.N.cross_subdomain_cookie))}return this.V}U(){return!!this.N.respect_dnt&&!!tx([null==l?void 0:l.doNotTrack,null==l?void 0:l.msDoNotTrack,g.doNotTrack],e=>Y(e))}}var im=tu("[Dead Clicks]"),iy=()=>!0,ib=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(tM)),s=e.instance.config.capture_dead_clicks;return q(s)?s:!!R(s)||i};class iE{get lazyLoadedDeadClicksAutocapture(){return this.W}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[tM]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.G(()=>{this.Y()}):this.stop()}G(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?im.error("failed to load script",t):e()})}Y(){var e;if(c){if(!this.W&&null!=(e=g.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=R(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.W=g.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.W.start(c),im.info("starting...")}}else im.error("`document` not found. Cannot start.")}stop(){this.W&&(this.W.stop(),this.W=void 0,im.info("stopping..."))}}var iw=tu("[SegmentIntegration]"),ix="posthog-js";function ik(e,t){var{organization:i,projectId:s,prefix:r,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===t?{}:t;return t=>{if(!("*"===n||n.includes(t.level))||!e.__loaded)return t;t.tags||(t.tags={});var a=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=a,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var l,c,u,h,d,p,_=(null==(l=t.exception)?void 0:l.values)||[],g=_.map(e=>y({},e,{stacktrace:e.stacktrace?y({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>y({},e,{platform:"web:javascript"}))}):void 0})),v={$exception_message:(null==(c=_[0])?void 0:c.value)||t.message,$exception_type:null==(u=_[0])?void 0:u.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(h=_[0])?void 0:h.value)||t.message,$sentry_exception_type:null==(d=_[0])?void 0:d.type,$sentry_tags:t.tags};return i&&s&&(v.$sentry_url=(r||"https://sentry.io/organizations/")+i+"/issues/?project="+s+"&query="+t.event_id),o&&(null==(p=e.exceptions)||p.sendExceptionEvent(v)),t}}class iS{constructor(e,t,i,s,r,n){this.name=ix,this.setupOnce=function(o){o(ik(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class iP{constructor(e){this.J=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(tc.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.K=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.X()}X(){var e;this.Z=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.J)}destroy(){var e;null==(e=this.Z)||e.call(this),this.Z=void 0}doPageView(e,t){var i,r=this.tt(e,t);return this.K={pathname:null!=(i=null==s?void 0:s.location.pathname)?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.tt(e,null==(t=this.K)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.K)?void 0:e.pageViewId}}tt(e,t){var i=this.K;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:c,maxContentY:u}=r;if(!(M(n)||M(o)||M(a)||M(l)||M(c)||M(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);var h=n<=1?1:X(o/n,0,1,tc),d=n<=1?1:X(a/n,0,1,tc),p=l<=1?1:X(c/l,0,1,tc),_=l<=1?1:X(u/l,0,1,tc);s=tv(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var iT=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),iO=e=>{var t=null==c?void 0:c.createElement("a");return M(t)?null:(t.href=e,t)},i$=function(e,t){void 0===t&&(t="&");var i,s,r=[];return tg(e,function(e,t){M(e)||M(t)||"undefined"===t||(i=encodeURIComponent(e instanceof File?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)}),r.join(t)},iF=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<s.length;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!I(i)||i.length<2)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){tc.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},iI=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[0]||"",n=s[1],o=r.split("?"),a=o[1],l=o[0],c=(a||"").split("&"),u=[],h=0;h<c.length;h++){var d=c[h].split("=");I(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(c[h]))}var p=l;return null!=a&&(p+="?"+u.join("&")),null!=n&&(p+="#"+n),p},iC=function(e,t){var i=e.match(RegExp(t+"=([^&]*)"));return i?i[1]:null},iR="https?://(.*)",iA=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],iM=tf(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],iA),iL="<masked>",iN=["li_fat_id"];function iD(e,t,i){if(!c)return{};var s,r=t?tf([],iA,i||[]):[],n=ij(iI(c.URL,r,iL),e);return tv((s={},tg(iN,function(e){var t=ia.A(e);s[e]=t||null}),s),n)}function ij(e,t){var i=iM.concat(t||[]),s={};return tg(i,function(t){var i=iF(e,t);s[t]=i||null}),s}function iU(e){var t=e?0===e.search(iR+"google.([^/?]*)")?"google":0===e.search(iR+"bing.com")?"bing":0===e.search(iR+"yahoo.com")?"yahoo":0===e.search(iR+"duckduckgo.com")?"duckduckgo":null:null,i={};if(!D(t)){i.$search_engine=t;var s=c?iF(c.referrer,"yahoo"!=t?"q":"p"):"";s.length&&(i.ph_keyword=s)}return i}function iH(){return navigator.language||navigator.userLanguage}function iq(){return(null==c?void 0:c.referrer)||"$direct"}function iW(e,t){var i=e?tf([],iA,t||[]):[],s=null==u?void 0:u.href.substring(0,1e3);return{r:iq().substring(0,1e3),u:s?iI(s,i,iL):void 0}}function iV(e){var t,{r:i,u:s}=e,r={$referrer:i,$referring_domain:null==i?void 0:"$direct"==i?"$direct":null==(t=iO(i))?void 0:t.host};if(s){r.$current_url=s;var n=iO(s);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname,tv(r,ij(s))}return i&&tv(r,iU(i)),r}function iz(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}var iB=tu("[FeatureFlags]"),iG=tu("[FeatureFlags]",{debugEnabled:!0}),iY="$active_feature_flags",iK="$override_feature_flags",iX="$feature_flag_payloads",iJ="$override_feature_flag_payloads",iZ="$feature_flag_request_id",iQ=e=>{var t={};for(var[i,s]of tm(e||{}))s&&(t[i]=s);return t},i0=function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e}({});class i1{constructor(e){this.it=!1,this.et=!1,this.rt=!1,this.st=!1,this.nt=!1,this.ot=!1,this.ut=!1,this.ht=!1,this._instance=e,this.featureFlagEventHandlers=[]}dt(){var e,t;return null!=(e=null==(t=this._instance.persistence)?void 0:t.vt(this._instance.config.feature_flag_cache_ttl_ms))&&e}ct(){return!!this.dt()&&(this.ht||this.rt||(this.ht=!0,iB.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ft(){var e,t=null!=(e=this._instance.config.evaluation_contexts)?e:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.ut||(iB.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ut=!0),null!=t&&t.length?t.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||iB.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}_t(){return this.ft().length>0}get hasLoadedFlags(){return this.et}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(tW),t=this._instance.get_property(iK),i=this._instance.get_property(iJ);if(!i&&!t)return e||{};var s=tv({},e||{});for(var r of[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])]){var n,o,a=s[r],l=null==t?void 0:t[r],c=M(l)?null!=(n=null==a?void 0:a.enabled)&&n:!!l,u=M(l)?a.variant:"string"==typeof l?l:void 0,h=null==i?void 0:i[r],d=y({},a,{enabled:c,variant:c?null!=u?u:null==a?void 0:a.variant:void 0});c!==(null==a?void 0:a.enabled)&&(d.original_enabled=null==a?void 0:a.enabled),u!==(null==a?void 0:a.variant)&&(d.original_variant=null==a?void 0:a.variant),h&&(d.metadata=y({},null==a?void 0:a.metadata,{payload:h,original_payload:null==a||null==(o=a.metadata)?void 0:o.payload})),s[r]=d}return this.it||(iB.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.it=!0),s}getFlagVariants(){var e=this._instance.get_property(tH),t=this._instance.get_property(iK);if(!t)return e||{};for(var i=tv({},e),s=Object.keys(t),r=0;r<s.length;r++)i[s[r]]=t[s[r]];return this.it||(iB.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.it=!0),i}getFlagPayloads(){var e=this._instance.get_property(iX),t=this._instance.get_property(iJ);if(!t)return e||{};for(var i=tv({},e||{}),s=Object.keys(t),r=0;r<s.length;r++)i[s[r]]=t[s[r]];return this.it||(iB.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.it=!0),i}reloadFeatureFlags(){this.st||this._instance.config.advanced_disable_feature_flags||this.bt||(this._instance.yt.emit("featureFlagsReloading",!0),this.bt=setTimeout(()=>{this.wt()},5))}Et(){clearTimeout(this.bt),this.bt=void 0}ensureFlagsLoaded(){this.et||this.rt||this.bt||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.st=e}wt(e){var t;if(this.Et(),!this._instance.xt())if(this.rt)this.nt=!0;else{var i=this._instance.config.token,s=this._instance.get_property("$device_id"),r={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:y({},(null==(t=this._instance.persistence)?void 0:t.get_initial_props())||{},this._instance.get_property(tV)||{}),group_properties:this._instance.get_property(tz),timezone:iz()};D(s)||M(s)||(r.$device_id=s),(null!=e&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0),this._t()&&(r.evaluation_contexts=this.ft());var n=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+n);this.rt=!0,this._instance._send_request({method:"POST",url:o,data:r,compression:this._instance.config.disable_compression?void 0:iT.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var t,i,s,n=!0;if(200===e.statusCode&&(this.nt||(this.$anon_distinct_id=void 0),n=!1),this.rt=!1,!r.disable_flags||this.nt){this.ot=!n;var o,a=[];e.error?e.error instanceof Error?a.push("AbortError"===e.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==e.statusCode&&a.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var l=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes(i0.FeatureFlags));(l&&a.push("quota_limited"),null==(s=this._instance.persistence)||s.register({[tY]:a}),l)?iB.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(r.disable_flags||this.receivedFeatureFlags(null!=(o=e.json)?o:{},n),this.nt&&(this.nt=!1,this.wt()))}}})}}getFeatureFlag(e,t){var i;if(void 0===t&&(t={}),!t.fresh||this.ot)if(this.et||this.getFlags()&&this.getFlags().length>0){if(!this.ct()){var s=this.getFeatureFlagResult(e,t);return null!=(i=null==s?void 0:s.variant)?i:null==s?void 0:s.enabled}}else iB.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this.ot)if(this.et||this.getFlags()&&this.getFlags().length>0){if(!this.ct()){var i=this.getFlagVariants(),s=e in i,r=i[e],n=this.getFlagPayloads()[e],o=String(r),a=this._instance.get_property(iZ)||void 0,l=this._instance.get_property(tK)||void 0,c=this._instance.get_property(tG)||{};if((t.send_event||!("send_event"in t))&&(!(e in c)||!c[e].includes(o))){I(c[e])?c[e].push(o):c[e]=[o],null==(p=this._instance.persistence)||p.register({[tG]:c});var u=this.getFeatureFlagDetails(e),h=[...null!=(_=this._instance.get_property(tY))?_:[]];M(r)&&h.push("flag_missing");var d={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(g=this._instance.config.bootstrap)||null==(g=g.featureFlags)?void 0:g[e])||null,$feature_flag_bootstrapped_payload:(null==(v=this._instance.config.bootstrap)||null==(v=v.featureFlagPayloads)?void 0:v[e])||null,$used_bootstrap_value:!this.ot};M(null==u||null==(f=u.metadata)?void 0:f.version)||(d.$feature_flag_version=u.metadata.version);var p,_,g,v,f,m,y,b,E,w,x,k=null!=(m=null==u||null==(y=u.reason)?void 0:y.description)?m:null==u||null==(b=u.reason)?void 0:b.code;k&&(d.$feature_flag_reason=k),null!=u&&null!=(E=u.metadata)&&E.id&&(d.$feature_flag_id=u.metadata.id),M(null==u?void 0:u.original_variant)&&M(null==u?void 0:u.original_enabled)||(d.$feature_flag_original_response=M(u.original_variant)?u.original_enabled:u.original_variant),null!=u&&null!=(w=u.metadata)&&w.original_payload&&(d.$feature_flag_original_payload=null==u||null==(x=u.metadata)?void 0:x.original_payload),h.length&&(d.$feature_flag_error=h.join(",")),this._instance.capture("$feature_flag_called",d)}if(s){var S=n;if(!M(n))try{S=JSON.parse(n)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:S}}}}else iB.warn('getFeatureFlagResult for key "'+e+"\" failed. Feature flags didn't load in time.")}getRemoteConfigPayload(e,t){var i=this._instance.config.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this._t()&&(s.evaluation_contexts=this.ft()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this._instance.config.disable_compression?void 0:iT.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:i=>{var s,r=null==(s=i.json)?void 0:s.featureFlagPayloads;t((null==r?void 0:r[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),!t.fresh||this.ot){if(this.et||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return M(i)?void 0:!!i}iB.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this._instance.persistence){this.et=!0;var i=this.getFlagVariants(),s=this.getFlagPayloads(),r=this.getFlagsWithDetails();!function(e,t,i,s,r){void 0===i&&(i={}),void 0===s&&(s={}),void 0===r&&(r={});var n,o=((n=e.flags)?(e.featureFlags=Object.fromEntries(Object.keys(n).map(e=>{var t;return[e,null!=(t=n[e].variant)?t:n[e].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(n).filter(e=>n[e].enabled).filter(e=>{var t;return null==(t=n[e].metadata)?void 0:t.payload}).map(e=>{var t;return[e,null==(t=n[e].metadata)?void 0:t.payload]}))):iB.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e),a=o.flags,l=o.featureFlags,c=o.featureFlagPayloads;if(l){var u=e.requestId,h=e.evaluatedAt;if(I(l)){iB.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var d={};if(l)for(var p=0;p<l.length;p++)d[l[p]]=!0;t&&t.register({[iY]:l,[tH]:d})}else{var _=l,g=c,v=a;if(e.errorsWhileComputingFlags)if(a){var f=new Set(Object.keys(a).filter(e=>{var t;return!(null!=(t=a[e])&&t.failed)}));_=y({},i,Object.fromEntries(Object.entries(_).filter(e=>{var[t]=e;return f.has(t)}))),g=y({},s,Object.fromEntries(Object.entries(g||{}).filter(e=>{var[t]=e;return f.has(t)}))),v=y({},r,Object.fromEntries(Object.entries(v||{}).filter(e=>{var[t]=e;return f.has(t)})))}else _=y({},i,_),g=y({},s,g),v=y({},r,v);t&&t.register(y({[iY]:Object.keys(iQ(_)),[tH]:_||{},[iX]:g||{},[tW]:v||{}},u?{[iZ]:u}:{},h?{[tK]:h}:{}))}}}(e,this._instance.persistence,i,s,r),t||(this.ht=!1),this.St(t)}}override(e,t){void 0===t&&(t=!1),iB.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return iB.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._instance.persistence.unregister(iK),this._instance.persistence.unregister(iJ),this.St(),iG.info("All overrides cleared");if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t;if(this.it=!!(null!=(t=e.suppressWarning)&&t),"flags"in e){if(!1===e.flags)this._instance.persistence.unregister(iK),iG.info("Flag overrides cleared");else if(e.flags){if(I(e.flags)){for(var i={},s=0;s<e.flags.length;s++)i[e.flags[s]]=!0;this._instance.persistence.register({[iK]:i})}else this._instance.persistence.register({[iK]:e.flags});iG.info("Flag overrides set",{flags:e.flags})}}return"payloads"in e&&(!1===e.payloads?(this._instance.persistence.unregister(iJ),iG.info("Payload overrides cleared")):e.payloads&&(this._instance.persistence.register({[iJ]:e.payloads}),iG.info("Payload overrides set",{payloads:e.payloads}))),void this.St()}this.St()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.et){var{flags:t,flagVariants:i}=this.$t();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,r=(this._instance.get_property(tq)||[]).find(t=>t.flagKey===e),n={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(o.$early_access_feature_name=r.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=y({},this.getFlagVariants(),{[e]:t});null==(s=this._instance.persistence)||s.register({[iY]:Object.keys(iQ(a)),[tH]:a}),this.St()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this._instance.get_property(tq),r=i?"&"+i.map(e=>"stage="+e).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+r),method:"GET",callback:t=>{var i,s;if(t.json){var r=t.json.earlyAccessFeatures;return null==(i=this._instance.persistence)||i.unregister(tq),null==(s=this._instance.persistence)||s.register({[tq]:r}),e(r)}}})}$t(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}St(e){var{flags:t,flagVariants:i}=this.$t();this.featureFlagEventHandlers.forEach(s=>s(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._instance.get_property(tV)||{};this._instance.register({[tV]:y({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(tV)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._instance.get_property(tz)||{};0!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=y({},i[t],e[t]),delete e[t]}),this._instance.register({[tz]:y({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(tz)||{};this._instance.register({[tz]:y({},t,{[e]:{}})})}else this._instance.unregister(tz)}reset(){this.et=!1,this.rt=!1,this.st=!1,this.nt=!1,this.ot=!1,this.$anon_distinct_id=void 0,this.Et(),this.it=!1}}var i2=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class i3{constructor(e,t){this.N=e,this.props={},this.kt=!1,this.Pt=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.B=this.Tt(e),this.load(),e.debug&&tc.info("Persistence loaded",e.persistence,y({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.Rt}Tt(e){-1===i2.indexOf(e.persistence.toLowerCase())&&(tc.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,i,r=(void 0===(t=e.cookie_persisted_properties||[])&&(t=[]),i=[...iu,...t],y({},ic,{D:function(e){try{var t={};try{t=ia.D(e)||{}}catch(e){}var i=tv(t,JSON.parse(ic.A(e)||"{}"));return ic.L(e,i),i}catch(e){}return null},L:function(e,t,s,r,n,o){try{ic.L(e,t,void 0,void 0,o);var a={};i.forEach(e=>{t[e]&&(a[e]=t[e])}),Object.keys(a).length&&ia.L(e,a,s,r,n,o)}catch(e){ic.M(e)}},j:function(e,t){try{null==s||s.localStorage.removeItem(e),ia.j(e,t)}catch(e){ic.M(e)}}})),n=e.persistence.toLowerCase();return"localstorage"===n&&ic.F()?ic:"localstorage+cookie"===n&&r.F()?r:"sessionstorage"===n&&i_.F()?i_:"memory"===n?id:"cookie"===n?ia:r.F()?r:ia}vt(e){var t=null!=e?e:this.N.feature_flag_cache_ttl_ms;if(!t||t<=0)return!1;var i=this.props[tK];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return tg(this.props,(t,i)=>{if(i===tH&&R(t)){if(!this.vt())for(var s,r=Object.keys(t),n=0;n<r.length;n++)e["$feature/"+r[n]]=t[r[n]]}else s=!1,(D(t6)?s:a&&t6.indexOf===a?-1!=t6.indexOf(i):(tg(t6,function(e){if(s||(s=e===i))return tp}),s))||(e[i]=t)}),e}load(){if(!this.Rt){var e=this.B.D(this.Pt);e&&(this.props=tv({},e))}}save(){this.Rt||this.B.L(this.Pt,this.props,this.It,this.Ct,this.Ot,this.N.debug)}remove(){this.B.j(this.Pt,!1),this.B.j(this.Pt,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(R(e)){M(t)&&(t="None"),this.It=M(i)?this.Ft:i;var s=!1;if(tg(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(R(e)){this.It=M(t)?this.Ft:t;var i=!1;if(tg(e,(t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this.props[s]=t,i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.kt){var e=iD(this.N.custom_campaign_params,this.N.mask_personal_data_properties,this.N.custom_personal_data_properties);A(tE(e))||this.register(e),this.kt=!0}}update_search_keyword(){var e;this.register((e=null==c?void 0:c.referrer)?iU(e):{})}update_referrer_info(){var e;this.register_once({$referrer:iq(),$referring_domain:null!=c&&c.referrer&&(null==(e=iO(c.referrer))?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[tQ]||this.props[t0]||this.register_once({[t1]:iW(this.N.mask_personal_data_properties,this.N.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};tg([t0,tQ],t=>{var i=this.props[t];i&&tg(i,function(t,i){e["$initial_"+P(i)]=t})});var t,i,s=this.props[t1];return s&&tv(e,(t=iV(s),i={},tg(t,function(e,t){i["$initial_"+P(t)]=e}),i)),e}safe_merge(e){return tg(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){if(this.Ft=this.It=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var s=this.Tt(e),r=this.props;this.clear(),this.B=s,this.props=r,this.save()}}set_disabled(e){this.Rt=e,this.Rt?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ct&&(this.Ct=e,this.remove(),this.save())}set_secure(e){e!==this.Ot&&(this.Ot=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[tO]||{};i[e]=t,this.props[tO]=i,this.save()}remove_event_timer(e){var t=(this.props[tO]||{})[e];return M(t)||(delete this.props[tO][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var i5={Activation:"events",Cancellation:"cancelEvents"},i6={Popover:"popover",API:"api",Widget:"widget"},i8={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},i4={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},i7={Popover:"popover",Inline:"inline"},i9=function(e){return e.SHOWN="product tour shown",e.DISMISSED="product tour dismissed",e.COMPLETED="product tour completed",e.STEP_SHOWN="product tour step shown",e.STEP_COMPLETED="product tour step completed",e.BUTTON_CLICKED="product tour button clicked",e.STEP_SELECTOR_FAILED="product tour step selector failed",e.BANNER_CONTAINER_SELECTOR_FAILED="product tour banner container selector failed",e.BANNER_ACTION_CLICKED="product tour banner action clicked",e}({}),se=function(e){return e.TOUR_ID="$product_tour_id",e.TOUR_NAME="$product_tour_name",e.TOUR_ITERATION="$product_tour_iteration",e.TOUR_RENDER_REASON="$product_tour_render_reason",e.TOUR_STEP_ID="$product_tour_step_id",e.TOUR_STEP_ORDER="$product_tour_step_order",e.TOUR_STEP_TYPE="$product_tour_step_type",e.TOUR_DISMISS_REASON="$product_tour_dismiss_reason",e.TOUR_BUTTON_TEXT="$product_tour_button_text",e.TOUR_BUTTON_ACTION="$product_tour_button_action",e.TOUR_BUTTON_LINK="$product_tour_button_link",e.TOUR_BUTTON_TOUR_ID="$product_tour_button_tour_id",e.TOUR_STEPS_COUNT="$product_tour_steps_count",e.TOUR_STEP_SELECTOR="$product_tour_step_selector",e.TOUR_STEP_SELECTOR_FOUND="$product_tour_step_selector_found",e.TOUR_STEP_ELEMENT_TAG="$product_tour_step_element_tag",e.TOUR_STEP_ELEMENT_ID="$product_tour_step_element_id",e.TOUR_STEP_ELEMENT_CLASSES="$product_tour_step_element_classes",e.TOUR_STEP_ELEMENT_TEXT="$product_tour_step_element_text",e.TOUR_ERROR="$product_tour_error",e.TOUR_MATCHES_COUNT="$product_tour_matches_count",e.TOUR_FAILURE_PHASE="$product_tour_failure_phase",e.TOUR_WAITED_FOR_ELEMENT="$product_tour_waited_for_element",e.TOUR_WAIT_DURATION_MS="$product_tour_wait_duration_ms",e.TOUR_BANNER_SELECTOR="$product_tour_banner_selector",e.TOUR_LINKED_SURVEY_ID="$product_tour_linked_survey_id",e.USE_MANUAL_SELECTOR="$use_manual_selector",e.INFERENCE_DATA_PRESENT="$inference_data_present",e.TOUR_LAST_SEEN_DATE="$product_tour_last_seen_date",e.TOUR_TYPE="$product_tour_type",e}({}),st=tu("[RateLimiter]");class si{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{st.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void st.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){void 0===e&&(e=!1);var t,i,s,{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!=(t=null==(i=this.instance.persistence)?void 0:i.get_property(tZ))?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=a.tokens<1;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(tZ,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var ss=tu("[RemoteConfig]");class sr{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=g._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}Mt(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}At(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return ss.info("Using preloaded remote config",this.remoteConfig),this.Dt(this.remoteConfig),void this.Lt();if(this._instance.xt())return void ss.warn("Remote config is disabled. Falling back to local config.");this.Mt(e=>{if(!e)return ss.info("No config found after loading remote JS config. Falling back to JSON."),void this.At(e=>{this.Dt(e),this.Lt()});this.Dt(e),this.Lt()})}catch(e){ss.error("Error loading remote config",e)}}stop(){this.jt&&(clearInterval(this.jt),this.jt=void 0)}refresh(){this._instance.xt()||"hidden"===(null==c?void 0:c.visibilityState)||this._instance.featureFlags.reloadFeatureFlags()}Lt(){var e;if(!this.jt){var t=null!=(e=this._instance.config.remote_config_refresh_interval_ms)?e:3e5;0!==t&&(this.jt=setInterval(()=>{this.refresh()},t))}}Dt(e){e||ss.error("Failed to fetch remote config from PostHog."),this._instance.Dt(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||this._instance.featureFlags.ensureFlagsLoaded())}}var sn=Uint8Array,so=Uint16Array,sa=Uint32Array,sl=new sn([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]),sc=new sn([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]),su=new sn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sh=function(e,t){for(var i=new so(31),s=0;s<31;++s)i[s]=t+=1<<e[s-1];var r=new sa(i[30]);for(s=1;s<30;++s)for(var n=i[s];n<i[s+1];++n)r[n]=n-i[s]<<5|s;return[i,r]},sd=sh(sl,2),sp=sd[0],s_=sd[1];sp[28]=258,s_[258]=28;for(var sg=sh(sc,0)[1],sv=new so(32768),sf=0;sf<32768;++sf){var sm=(43690&sf)>>>1|(21845&sf)<<1;sm=(61680&(sm=(52428&sm)>>>2|(13107&sm)<<2))>>>4|(3855&sm)<<4,sv[sf]=((65280&sm)>>>8|(255&sm)<<8)>>>1}var sy=function(e,t,i){for(var s=e.length,r=0,n=new so(t);r<s;++r)++n[e[r]-1];var o,a=new so(t);for(r=0;r<t;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new so(1<<t);var l=15-t;for(r=0;r<s;++r)if(e[r])for(var c=r<<4|e[r],u=t-e[r],h=a[e[r]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)o[sv[h]>>>l]=c}else for(o=new so(s),r=0;r<s;++r)o[r]=sv[a[e[r]-1]++]>>>15-e[r];return o},sb=new sn(288);for(sf=0;sf<144;++sf)sb[sf]=8;for(sf=144;sf<256;++sf)sb[sf]=9;for(sf=256;sf<280;++sf)sb[sf]=7;for(sf=280;sf<288;++sf)sb[sf]=8;var sE=new sn(32);for(sf=0;sf<32;++sf)sE[sf]=5;var sw=sy(sb,9,0),sx=sy(sE,5,0),sk=function(e){return(e/8|0)+(7&e&&1)},sS=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof so?so:e instanceof sa?sa:sn)(i-t);return s.set(e.subarray(t,i)),s},sP=function(e,t,i){i<<=7&t;var s=t/8|0;e[s]|=i,e[s+1]|=i>>>8},sT=function(e,t,i){i<<=7&t;var s=t/8|0;e[s]|=i,e[s+1]|=i>>>8,e[s+2]|=i>>>16},sO=function(e,t){for(var i=[],s=0;s<e.length;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new sn(0),0];if(1==r){var o=new sn(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,u=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=r-1;)a=i[i[c].f<i[h].f?c++:h++],l=i[c!=u&&i[c].f<i[h].f?c++:h++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var d=n[0].s;for(s=1;s<r;++s)n[s].s>d&&(d=n[s].s);var p=new so(d+1),_=s$(i[u-1],p,0);if(_>t){s=0;var g=0,v=_-t,f=1<<v;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});s<r;++s){var m=n[s].s;if(!(p[m]>t))break;g+=f-(1<<_-p[m]),p[m]=t}for(g>>>=v;g>0;){var y=n[s].s;p[y]<t?g-=1<<t-p[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;p[b]==t&&(--p[b],++g)}_=t}return[new sn(p),_]},s$=function(e,t,i){return -1==e.s?Math.max(s$(e.l,t,i+1),s$(e.r,t,i+1)):t[e.s]=i},sF=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new so(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;a<=t;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},sI=function(e,t){for(var i=0,s=0;s<t.length;++s)i+=e[s]*t[s];return i},sC=function(e,t,i){var s=i.length,r=sk(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;n<s;++n)e[r+n+4]=i[n];return 8*(r+4+s)},sR=function(e,t,i,s,r,n,o,a,l,c,u){sP(t,u++,i),++r[256];for(var h=sO(r,15),d=h[0],p=h[1],_=sO(n,15),g=_[0],v=_[1],f=sF(d),m=f[0],y=f[1],b=sF(g),E=b[0],w=b[1],x=new so(19),k=0;k<m.length;++k)x[31&m[k]]++;for(k=0;k<E.length;++k)x[31&E[k]]++;for(var S=sO(x,7),P=S[0],T=S[1],O=19;O>4&&!P[su[O-1]];--O);var $,F,I,C,R=c+5<<3,A=sI(r,sb)+sI(n,sE)+o,M=sI(r,d)+sI(n,g)+o+14+3*O+sI(x,P)+(2*x[16]+3*x[17]+7*x[18]);if(R<=A&&R<=M)return sC(t,u,e.subarray(l,l+c));if(sP(t,u,1+(M<A)),u+=2,M<A){$=sy(d,p,0),F=d,I=sy(g,v,0),C=g;var L=sy(P,T,0);for(sP(t,u,y-257),sP(t,u+5,w-1),sP(t,u+10,O-4),u+=14,k=0;k<O;++k)sP(t,u+3*k,P[su[k]]);u+=3*O;for(var N=[m,E],D=0;D<2;++D){var j=N[D];for(k=0;k<j.length;++k){var U=31&j[k];sP(t,u,L[U]),u+=P[U],U>15&&(sP(t,u,j[k]>>>5&127),u+=j[k]>>>12)}}}else $=sw,F=sb,I=sx,C=sE;for(k=0;k<a;++k)if(s[k]>255){sT(t,u,$[(U=s[k]>>>18&31)+257]),u+=F[U+257],U>7&&(sP(t,u,s[k]>>>23&31),u+=sl[U]);var H=31&s[k];sT(t,u,I[H]),u+=C[H],H>3&&(sT(t,u,s[k]>>>5&8191),u+=sc[H])}else sT(t,u,$[s[k]]),u+=F[s[k]];return sT(t,u,$[256]),u+F[256]},sA=new sa([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),sM=function(){for(var e=new sa(256),t=0;t<256;++t){for(var i=t,s=9;--s;)i=(1&i&&0xedb88320)^i>>>1;e[t]=i}return e}(),sL=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},sN=function(e){var t,i,s,r,n="";for(t=i=0,s=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,r=0;r<s;r++){var o=e.charCodeAt(r),a=null;o<128?i++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),D(a)||(i>t&&(n+=e.substring(t,i)),n+=a,t=i=r+1)}return i>t&&(n+=e.substring(t,e.length)),n},sD=!!d||!!h,sj=function(e,t,i){void 0===i&&(i=!0);var s,[r,n]=e.split("?"),o=y({},t),a=null!=(s=null==n?void 0:n.split("&").map(e=>{var t,[s,r]=e.split("="),n=i&&null!=(t=o[s])?t:r;return delete o[s],s+"="+n}))?s:[],l=i$(o);return l&&a.push(l),r+"?"+a.join("&")},sU=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),sH=e=>{var{data:t,compression:i}=e;if(t){if(i===iT.GZipJS){var s=function(e,t){void 0===t&&(t={});var i=(r=0xffffffff,{p:function(e){for(var t=r,i=0;i<e.length;++i)t=sM[255&t^e[i]]^t>>>8;r=t},d:function(){return 0xffffffff^r}}),s=e.length;i.p(e);var r,n,o,a,l=(n=t,o=10+((a=t).filename&&a.filename.length+1||0),function(e,t,i,s,r,n){var o=e.length,a=new sn(s+o+5*(1+Math.floor(o/7e3))+8),l=a.subarray(s,a.length-r),c=0;if(!t||o<8)for(var u=0;u<=o;u+=65535){var h=u+65535;h<o?c=sC(l,c,e.subarray(u,h)):(l[u]=n,c=sC(l,c,e.subarray(u,o)))}else{for(var d=sA[t-1],p=d>>>13,_=8191&d,g=(1<<i)-1,v=new so(32768),f=new so(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},E=new sa(25e3),w=new so(288),x=new so(32),k=0,S=0,P=(u=0,0),T=0,O=0;u<o;++u){var $=b(u),F=32767&u,I=f[$];if(v[F]=I,f[$]=F,T<=u){var C=o-u;if((k>7e3||P>24576)&&C>423){c=sR(e,l,0,E,w,x,S,P,O,u-O,c),P=k=S=0,O=u;for(var R=0;R<286;++R)w[R]=0;for(R=0;R<30;++R)x[R]=0}var A=2,M=0,L=_,N=F-I&32767;if(C>2&&$==b(u-N))for(var D=Math.min(p,C)-1,j=Math.min(32767,u),U=Math.min(258,C);N<=j&&--L&&F!=I;){if(e[u+A]==e[u+A-N]){for(var H=0;H<U&&e[u+H]==e[u+H-N];++H);if(H>A){if(A=H,M=N,H>D)break;var q=Math.min(N,H-2),W=0;for(R=0;R<q;++R){var V=u-N+R+32768&32767,z=V-v[V]+32768&32767;z>W&&(W=z,I=V)}}}N+=(F=I)-(I=v[F])+32768&32767}if(M){E[P++]=0x10000000|s_[A]<<18|sg[M];var B=31&s_[A],G=31&sg[M];S+=sl[B]+sc[G],++w[257+B],++x[G],T=u+A,++k}else E[P++]=e[u],++w[e[u]]}}c=sR(e,l,n,E,w,x,S,P,O,u-O,c)}return sS(a,0,s+sk(c)+r)}(e,null==n.level?6:n.level,null==n.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+n.mem,o,8,!0)),c=l.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:2*(9==t.level),e[9]=3,0!=t.mtime&&sL(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;s<=i.length;++s)e[s+10]=i.charCodeAt(s)}}(l,t),sL(l,c-8,i.d()),sL(l,c-4,s),l}(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new sn(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},o=0;o<i;++o){if(r+5>s.length){var a=new sn(r+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);l<128?n(l):(l<2048?n(192|l>>>6):(l>55295&&l<57344?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63)):n(224|l>>>12),n(128|l>>>6&63)),n(128|63&l))}return sS(s,0,r)}(sU(t)),{mtime:0});return{contentType:"text/plain",body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===iT.Base64){var r=(e=>"data="+encodeURIComponent("string"==typeof e?e:sU(e)))(function(e){var t,i,s,r,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,c="",u=[];if(!e)return e;e=sN(e);do t=(n=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,i=n>>12&63,s=n>>6&63,r=63&n,u[l++]=o.charAt(t)+o.charAt(i)+o.charAt(s)+o.charAt(r);while(a<e.length);switch(c=u.join(""),e.length%3){case 1:c=c.slice(0,-2)+"==";break;case 2:c=c.slice(0,-1)+"="}return c}(sU(t)));return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}var n=sU(t);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},sq=[];h&&sq.push({transport:"fetch",method:e=>{var t,i,{contentType:s,body:r,estimatedSize:n}=null!=(t=sH(e))?t:{},o=new Headers;tg(e.headers,function(e,t){o.append(t,e)}),s&&o.append("Content-Type",s);var a=e.url,l=null;if(p){var c=new p;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),e.timeout)}}h(a,y({method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&52428.8>(n||0),body:r,signal:null==(i=l)?void 0:i.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){tc.error(e)}null==e.callback||e.callback(s)})).catch(t=>{tc.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(()=>l?clearTimeout(l.timeout):null)}}),d&&sq.push({transport:"XHR",method:e=>{var t,i=new d;i.open(e.method||"GET",e.url,!0);var{contentType:s,body:r}=null!=(t=sH(e))?t:{};tg(e.headers,function(e,t){i.setRequestHeader(t,e)}),s&&i.setRequestHeader("Content-Type",s),e.timeout&&(i.timeout=e.timeout),e.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(r)}}),null!=l&&l.sendBeacon&&sq.push({transport:"sendBeacon",method:e=>{var t=sj(e.url,{beacon:"1"});try{var i,{contentType:s,body:r}=null!=(i=sH(e))?i:{},n="string"==typeof r?new Blob([r],{type:s}):r;l.sendBeacon(t,n)}catch(e){}}});class sW{constructor(e,t){this.Nt=!0,this.Ut=[],this.zt=X((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,tc.createLogger("flush interval"),3e3),this.Ht=e}enqueue(e){this.Ut.push(e),this.Bt||this.qt()}unload(){this.Vt();var e=Object.values(this.Ut.length>0?this.Wt():{});[...e.filter(e=>0===e.url.indexOf("/e")),...e.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.Ht(y({},e,{transport:"sendBeacon"}))})}enable(){this.Nt=!1,this.qt()}qt(){var e=this;this.Nt||(this.Bt=setTimeout(()=>{if(this.Vt(),this.Ut.length>0){var t=this.Wt();for(var i in t)!function(){var s=t[i],r=(new Date).getTime();s.data&&I(s.data)&&tg(s.data,e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp}),e.Ht(s)}()}},this.zt))}Vt(){clearTimeout(this.Bt),this.Bt=void 0}Wt(){var e={};return tg(this.Ut,t=>{var i,s=(t?t.batchKey:null)||t.url;M(e[s])&&(e[s]=y({},t,{data:[]})),null==(i=e[s].data)||i.push(t.data)}),this.Ut=[],e}}var sV=["retriesPerformedSoFar"];class sz{constructor(e){this.Gt=!1,this.Yt=3e3,this.Ut=[],this._instance=e,this.Ut=[],this.Jt=!0,!M(s)&&"onLine"in s.navigator&&(this.Jt=s.navigator.onLine,this.Kt=()=>{this.Jt=!0,this.Xt()},this.Qt=()=>{this.Jt=!1},tk(s,"online",this.Kt),tk(s,"offline",this.Qt))}get length(){return this.Ut.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=b(e,sV);H(t)&&(i.url=sj(i.url,{retry_count:t})),this._instance._send_request(y({},i,{callback:e=>{200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this.Zt(y({retriesPerformedSoFar:t},i)):null==i.callback||i.callback(e)}}))}Zt(e){var t,i,s,r=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=r+1;var n=(s=(Math.random()-.5)*((i=Math.min(18e5,t=3e3*Math.pow(2,r)))-t/2),Math.ceil(i+s)),o=Date.now()+n;this.Ut.push({retryAt:o,requestOptions:e});var a="Enqueued failed request for retry in "+n;navigator.onLine||(a+=" (Browser is offline)"),tc.warn(a),this.Gt||(this.Gt=!0,this.ti())}ti(){if(this.ii&&clearTimeout(this.ii),0===this.Ut.length)return this.Gt=!1,void(this.ii=void 0);this.ii=setTimeout(()=>{this.Jt&&this.Ut.length>0&&this.Xt(),this.ti()},this.Yt)}Xt(){var e=Date.now(),t=[],i=this.Ut.filter(i=>i.retryAt<e||(t.push(i),!1));if(this.Ut=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.ii&&(clearTimeout(this.ii),this.ii=void 0),this.Gt=!1,M(s)||(this.Kt&&(s.removeEventListener("online",this.Kt),this.Kt=void 0),this.Qt&&(s.removeEventListener("offline",this.Qt),this.Qt=void 0)),this.Ut))try{this._instance._send_request(y({},e,{transport:"sendBeacon"}))}catch(e){tc.error(e)}this.Ut=[]}}class sB{constructor(e){this.ei=()=>{this.ri||(this.ri={});var e,t,i,s,r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this.ri.lastScrollY=Math.ceil(n),this.ri.maxScrollY=Math.max(n,null!=(e=this.ri.maxScrollY)?e:0),this.ri.maxScrollHeight=Math.max(o,null!=(t=this.ri.maxScrollHeight)?t:0),this.ri.lastContentY=a,this.ri.maxContentY=Math.max(a,null!=(i=this.ri.maxContentY)?i:0),this.ri.maxContentHeight=Math.max(l,null!=(s=this.ri.maxContentHeight)?s:0)},this._instance=e}getContext(){return this.ri}resetContext(){var e=this.ri;return setTimeout(this.ei,0),e}startMeasuringScrollPosition(){tk(s,"scroll",this.ei,{capture:!0}),tk(s,"scrollend",this.ei,{capture:!0}),tk(s,"resize",this.ei)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==s?void 0:s.document.documentElement;for(var e of I(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector]){var t=null==s?void 0:s.document.querySelector(e);if(t)return t}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return s&&(s.scrollY||s.pageYOffset||s.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return s&&(s.scrollX||s.pageXOffset||s.document.documentElement.scrollLeft)||0}}var sG=e=>iW(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class sY{constructor(e,t,i,s){this.si=e=>{var t=this.ni();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.oi(this._instance)};this.ai.register({[tJ]:i})}},this._instance=e,this.li=t,this.ai=i,this.oi=s||sG,this.li.onSessionId(this.si)}ni(){return this.ai.props[tJ]}getSetOnceProps(){var e,t=null==(e=this.ni())?void 0:e.props;return t?"r"in t?iV(t):{$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 tg(tE(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+P(i)]=t}),e}}class sK{constructor(){this.ui={},this.ui={}}on(e,t){return this.ui[e]||(this.ui[e]=[]),this.ui[e].push(t),()=>{this.ui[e]=this.ui[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.ui[e]||[])i(t);for(var s of this.ui["*"]||[])s(e,t)}}var sX=tu("[SessionId]");class sJ{on(e,t){return this.hi.on(e,t)}constructor(e,t,i){if(this.di=[],this.vi=void 0,this.hi=new sK,this.ci=(e,t)=>!(!H(e)||!H(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw Error('SessionIdManager cannot be used with cookieless_mode="always"');this.N=e.config,this.ai=e.persistence,this.fi=void 0,this.pi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.gi=t||ii,this.mi=i||ii;var s,r=this.N.persistence_name||this.N.token,n=this.N.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*X(n,60,36e3,sX.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.bi(),this.yi="ph_"+r+"_window_id",this.wi="ph_"+r+"_primary_window_exists",this.Ei()){var o=i_.D(this.yi),a=i_.D(this.wi);o&&!a?this.fi=o:i_.j(this.yi),i_.L(this.wi,!0)}if(null!=(s=this.N.bootstrap)&&s.sessionID)try{var l=(e=>{var t=e.replace(/-/g,"");if(32!==t.length)throw Error("Not a valid UUID");if("7"!==t[12])throw Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(this.N.bootstrap.sessionID);this.xi(this.N.bootstrap.sessionID,(new Date).getTime(),l)}catch(e){sX.error("Invalid sessionID in bootstrap",e)}this.Si()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return M(this.di)&&(this.di=[]),this.di.push(e),this.pi&&e(this.pi,this.fi),()=>{this.di=this.di.filter(t=>t!==e)}}Ei(){return"memory"!==this.N.persistence&&!this.ai.Rt&&i_.F()}$i(e){e!==this.fi&&(this.fi=e,this.Ei()&&i_.L(this.yi,e))}ki(){return this.fi?this.fi:this.Ei()?i_.D(this.yi):null}xi(e,t,i){e===this.pi&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.pi=e,this.ai.register({[tj]:[t,e,i]}))}Pi(){var e=this.ai.props[tj];return I(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.xi(null,null,null)}destroy(){clearTimeout(this.Ti),this.Ti=void 0,this.vi&&s&&(s.removeEventListener("beforeunload",this.vi,{capture:!1}),this.vi=void 0),this.di=[]}Si(){this.vi=()=>{this.Ei()&&i_.j(this.wi)},tk(s,"beforeunload",this.vi,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),"always"===this.N.cookieless_mode)throw Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[s,r,n]=this.Pi(),o=this.ki(),a=H(n)&&Math.abs(i-n)>864e5,l=!1,c=!r,u=!c&&!e&&this.ci(i,s);c||u||a?(r=this.gi(),o=this.mi(),sX.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this.mi(),l=!0);var h=H(s)&&e&&!a?s:i,d=H(n)?n:(new Date).getTime();return this.$i(o),this.xi(r,h,d),e||this.bi(),l&&this.di.forEach(e=>e(r,o,l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0)),{sessionId:r,windowId:o,sessionStartTimestamp:d,changeReason:l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:s}}bi(){clearTimeout(this.Ti),this.Ti=setTimeout(()=>{var[e]=this.Pi();if(this.ci((new Date).getTime(),e)){var t=this.pi;this.resetSessionId(),this.hi.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}}var sZ=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&x(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>x(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver},sQ=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function s0(e,t,i){return sU({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var s1={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>sQ(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!sQ(t,e))),icontains:(e,t)=>t.map(s2).some(t=>e.map(s2).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(s2).every(t=>e.map(s2).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})},s2=e=>e.toLowerCase();function s3(e,t){return!e||Object.entries(e).every(e=>{var[i,s]=e,r=null==t?void 0:t[i];if(M(r)||D(r))return!1;var n=[String(r)],o=s1[s.operator];return!!o&&o(s.values,n)})}var s5=function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e}({}),s6="i.posthog.com";class s8{constructor(e){this.Ri={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"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=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+s6,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Ri[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Ri[this.apiHost]=s5.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Ri[this.apiHost]=s5.EU:this.Ri[this.apiHost]=s5.CUSTOM),this.Ri[this.apiHost]}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if(this.region===s5.CUSTOM)return this.apiHost+t;var i=s6+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var s4=tu("[Surveys]"),s7="seenSurvey_",s9=e=>((e,t)=>{var i=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+e+t.id+"_"+t.current_iteration),i})(s7,e),re=[i6.Popover,i6.Widget,i6.API],rt={ignoreConditions:!1,ignoreDelay:!1,displayType:i7.Popover},ri=tu("[PostHog ExternalIntegrations]"),rs={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class rr{constructor(e){this._instance=e}G(e,t){var i;null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return ri.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e,t=this,i=function(e){var i,s,n;!r||null!=(i=g.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.G(rs[e],()=>{var i;null==(i=g.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)}),!r&&null!=(s=g.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=g.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[s,r]of Object.entries(null!=(e=this._instance.config.integrations)?e:{}))i(s)}}var rn={},ro=0,ra=()=>{},rl="posthog",rc=!sD&&-1===(null==_?void 0:_.indexOf("MSIE"))&&-1===(null==_?void 0:_.indexOf("Mozilla")),ru=e=>{var t;return y({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:function(e){var t=null==e?void 0:e.hostname;if(!L(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of tw)if(i===s)return!1;return!0}(null==c?void 0:c.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ra,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,debug:u&&L(null==u?void 0:u.search)&&-1!==u.search.indexOf("__posthog_debug=true")||!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,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==s||null==(t=s.location)?void 0:t.protocol),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_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;tc.error(t)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:ra,__preview_eager_load_replay:!1},(e=>({rageclick:!(e&&e>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(e&&e>="2025-05-24")||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(e))},rh=e=>{var t={};M(e.process_person)||(t.person_profiles=e.process_person),M(e.xhr_headers)||(t.request_headers=e.xhr_headers),M(e.cookie_name)||(t.persistence_name=e.cookie_name),M(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),M(e.store_google)||(t.save_campaign_params=e.store_google),M(e.verbose)||(t.debug=e.verbose);var i=tv({},t,e);return I(e.property_blacklist)&&(M(e.property_denylist)?i.property_denylist=e.property_blacklist:I(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:tc.error("Invalid value for property_denylist config: "+e.property_denylist)),i};class rd{constructor(){this.__forceAllowLocalhost=!1}get Ii(){return this.__forceAllowLocalhost}set Ii(e){tc.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class rp{Ci(e,t){if(e){var i=this.Oi.indexOf(e);-1!==i&&this.Oi.splice(i,1)}return this.Oi.push(t),null==t.initialize||t.initialize(),t}get decideEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}get flagsEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}constructor(){this.webPerformance=new rd,this.Fi=!1,this.version=v.LIB_VERSION,this.yt=new sK,this.Oi=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ru(),this.SentryIntegration=iS,this.sentryIntegration=e=>(function(e,t){var i=ik(e,t);return{name:ix,processEvent:e=>i(e)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Mi=!1,this.Ai=null,this.Di=null,this.Li=null,this.featureFlags=new i1(this),this.scrollManager=new sB(this),this.pageViewManager=new iP(this),this.rateLimiter=new si(this),this.requestRouter=new s8(this),this.consent=new iv(this),this.externalIntegrations=new rr(this);var e,t=null!=(e=rp.__defaultExtensionClasses)?e:{};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.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,i)=>{var s=L(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=L(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>tc.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==rl){var s,r=null!=(s=rn[i])?s:new rp;return r._init(e,t,i),rn[i]=r,rn[rl][i]=r,r}return this._init(e,t,i)}_init(e,t,i){if(void 0===t&&(t={}),M(e)||N(e))return tc.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.ji(t.debug),this.Ni=t,this.Ui=[],t.person_profiles?this.Di=t.person_profiles:t.process_person&&(this.Di=t.process_person),this.set_config(tv({},ru(t.defaults),rh(t),{name:i,token:e})),this.config.on_xhr_error&&tc.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:iT.GZipJS;var r=this.zi();this.persistence=new i3(this.config,r),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new i3(y({},this.config,{persistence:"sessionStorage"}),r);var n=y({},this.persistence.props),o=y({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Hi=new sW(e=>this.Bi(e),this.config.request_queue_config),this.qi=new sz(this),this.__request_queue=[];var a="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(a||(this.sessionManager=new sJ(this),this.sessionPropsManager=new sY(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(tc.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Vi(a)},0)):(tc.info("Initializing extensions synchronously"),this.Vi(a)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&tc.info("Starting in debug mode",{this:this,config:t,thisC:y({},this.config),p:n,s:o}),void 0!==(null==(l=t.bootstrap)?void 0:l.distinctID)){var l,c,u,h=this.config.get_device_id(ii()),d=null!=(c=t.bootstrap)&&c.isIdentifiedID?h:t.bootstrap.distinctID;this.persistence.set_property(tX,null!=(u=t.bootstrap)&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:d})}if(this.Wi()){var p,_,g=Object.keys((null==(p=t.bootstrap)?void 0:p.featureFlags)||{}).filter(e=>{var i;return!(null==(i=t.bootstrap)||null==(i=i.featureFlags)||!i[e])}).reduce((e,i)=>{var s;return e[i]=(null==(s=t.bootstrap)||null==(s=s.featureFlags)?void 0:s[i])||!1,e},{}),f=Object.keys((null==(_=t.bootstrap)?void 0:_.featureFlagPayloads)||{}).filter(e=>g[e]).reduce((e,i)=>{var s,r;return null!=(s=t.bootstrap)&&null!=(s=s.featureFlagPayloads)&&s[i]&&(e[i]=null==(r=t.bootstrap)||null==(r=r.featureFlagPayloads)?void 0:r[i]),e},{});this.featureFlags.receivedFeatureFlags({featureFlags:g,featureFlagPayloads:f})}if(a)this.register_once({distinct_id:t5,$device_id:null},"");else if(!this.get_distinct_id()){var m=this.config.get_device_id(ii());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(tX,"anonymous")}return tk(s,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||ii();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(tX,"identified")),t()},r=i.user();"then"in r&&C(r.then)?r.then(s):s(r)}(e,()=>{var s;i.register((Promise&&Promise.resolve||iw.warn("This browser does not have Promise support, and can not use the segment integration"),s=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(iw.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(iw.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t},{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>s(e,e.event.event),page:e=>s(e,"$pageview"),identify:e=>s(e,"$identify"),screen:e=>s(e,"$screen")})).then(()=>{t()})})}(this,()=>this.Gi()):this.Gi(),C(this.config._onCapture)&&this.config._onCapture!==ra&&(tc.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&tc.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}Vi(e){var t,i,s,r,n,o,a=performance.now(),l=y({},rp.__defaultExtensionClasses,this.config.__extensionClasses),c=[];l.exceptions&&this.Oi.push(this.exceptions=null!=(t=this.exceptions)?t:new l.exceptions(this)),l.historyAutocapture&&this.Oi.push(this.historyAutocapture=new l.historyAutocapture(this)),l.tracingHeaders&&this.Oi.push(new l.tracingHeaders(this)),l.siteApps&&this.Oi.push(this.siteApps=new l.siteApps(this)),l.sessionRecording&&!e&&this.Oi.push(this.sessionRecording=new l.sessionRecording(this)),this.config.disable_scroll_properties||c.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),l.autocapture&&this.Oi.push(this.autocapture=new l.autocapture(this)),l.surveys&&this.Oi.push(this.surveys=null!=(i=this.surveys)?i:new l.surveys(this)),l.logs&&this.Oi.push(this.logs=null!=(s=this.logs)?s:new l.logs(this)),l.conversations&&this.Oi.push(this.conversations=null!=(r=this.conversations)?r:new l.conversations(this)),l.productTours&&this.Oi.push(this.productTours=new l.productTours(this)),l.heatmaps&&this.Oi.push(this.heatmaps=new l.heatmaps(this)),l.webVitalsAutocapture&&this.Oi.push(this.webVitalsAutocapture=new l.webVitalsAutocapture(this)),l.exceptionObserver&&this.Oi.push(this.exceptionObserver=new l.exceptionObserver(this)),l.deadClicksAutocapture&&this.Oi.push(this.deadClicksAutocapture=new l.deadClicksAutocapture(this,ib)),l.toolbar&&this.Oi.push(this.toolbar=null!=(n=this.toolbar)?n:new l.toolbar(this)),l.experiments&&this.Oi.push(this.experiments=null!=(o=this.experiments)?o:new l.experiments(this)),this.Oi.forEach(e=>{e.initialize&&c.push(()=>{null==e.initialize||e.initialize()})}),c.push(()=>{if(this.Yi){var e=this.Yi;this.Yi=void 0,this.Dt(e)}}),this.Ji(c,a)}Ji(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.Ji(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){tc.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:s}),this.config.__preview_deferred_init_extensions&&tc.info("PostHog extensions initialized ("+s+"ms)")}Dt(e){var t;if(!c||!c.body)return tc.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Dt(e)},500);this.config.__preview_deferred_init_extensions&&(this.Yi=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=k(e.supportedCompression,iT.GZipJS)?iT.GZipJS:k(e.supportedCompression,iT.Base64)?iT.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Di?this.Di:"identified_only"}),this.Oi.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}Gi(){try{this.config.loaded(this)}catch(e){tc.critical("`loaded` function failed",e)}if(this.Ki(),this.config.internal_or_test_user_hostname&&null!=u&&u.hostname){var e=u.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.Xi()},1),this.Qi=new sr(this),this.Qi.load()}Ki(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Hi)||e.enable())}_dom_loaded(){this.is_capturing()&&t_(this.__request_queue,e=>this.Bi(e)),this.__request_queue=[],this.Ki()}_handle_unload(){var e,t,i;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this.Zi()&&this.capture("$pageleave"),null==(t=this.Hi)||t.unload(),null==(i=this.qi)||i.unload()):this.Zi()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(rc?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=sj(e.url,{ip:+!!this.config.ip}),e.headers=y({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,s,r=y({},e);r.timeout=r.timeout||6e4,r.url=sj(r.url,{_:(new Date).getTime().toString(),ver:v.LIB_VERSION,compression:r.compression});var n=null!=(t=r.transport)?t:"fetch",o=sq.filter(e=>!r.disableTransport||!e.transport||!r.disableTransport.includes(e.transport)),a=null!=(i=null==(s=tx(o,e=>e.transport===n))?void 0:s.method)?i:o[0].method;if(!a)throw Error("No available transport method");a(r)})(y({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&(null==(i=(s=this.config).on_request_error)||i.call(s,t)),null==e.callback||e.callback(t)}}))))}Bi(e){this.qi?this.qi.retriableRequest(e):this._send_request(e)}_execute_array(e){ro++;try{var t,i=[],s=[],r=[];t_(e,e=>{e&&(t=e[0],I(t)?r.push(e):C(e)?e.call(this):I(e)&&"alias"===t?i.push(e):I(e)&&-1!==t.indexOf("capture")&&C(this[t])?r.push(e):s.push(e))});var n=function(e,t){t_(e,function(e){if(I(e[0])){var i=t;tg(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};n(i,this),n(s,this),n(r,this)}finally{ro--}}Wi(){var e,t;return(null==(e=this.config.bootstrap)?void 0:e.featureFlags)&&Object.keys(null==(t=this.config.bootstrap)?void 0:t.featureFlags).length>0||!1}push(e){if(ro>0&&I(e)&&L(e[0])){var t=rp.prototype[e[0]];C(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,i){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Hi){if(this.is_capturing())if(!M(e)&&L(e)){var r=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(r&&!this.config.__preview_capture_bot_pageviews)){var n=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==n||!n.isRateLimited){null!=t&&t.$current_url&&!L(null==t?void 0:t.$current_url)&&(tc.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=i&&i.te||tc.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 o=new Date,a=(null==i?void 0:i.timestamp)||o,l=ii(),c={uuid:l,event:e,properties:this.calculateEventProperties(e,t||{},a,l)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&r&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),n&&(c.properties.$lib_rate_limit_remaining_tokens=n.remainingTokens),(null==i?void 0:i.$set)&&(c.$set=null==i?void 0:i.$set);var u,h="$groupidentify"!==e,d=this.ie(null==i?void 0:i.$set_once,h);if(d&&(c.$set_once=d),(p=c,_=null!=i&&i._noTruncate?null:this.config.properties_string_max_length,g=e=>L(e)&&!D(_)?e.slice(0,_):e,v=new Set,c=function e(t,i){var s;return t!==Object(t)?g?g(t,i):t:v.has(t)?void 0:(v.add(t),I(t)?(s=[],t_(t,t=>{s.push(e(t))})):(s={},tg(t,(t,i)=>{v.has(t)||(s[i]=e(t,i))})),s)}(p)).timestamp=a,M(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=o),e===i8.DISMISSED||e===i8.SENT){var p,_,g,v,f,m,b,E=null==t?void 0:t[i4.SURVEY_ID],w=null==t?void 0:t[i4.SURVEY_ITERATION];u={id:E,current_iteration:w},localStorage.getItem(s9(u))||localStorage.setItem(s9(u),"true"),c.$set=y({},c.$set,{[(f={id:E,current_iteration:w},b="$survey_"+(m=e===i8.SENT?"responded":"dismissed")+"/"+f.id,f.current_iteration&&f.current_iteration>0&&(b="$survey_"+m+"/"+f.id+"/"+f.current_iteration),b)]:!0})}else e===i8.SHOWN&&(c.$set=y({},c.$set,{[i4.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===i9.SHOWN){var x=null==t?void 0:t[se.TOUR_TYPE];x&&(c.$set=y({},c.$set,{[se.TOUR_LAST_SEEN_DATE+"/"+x]:(new Date).toISOString()}))}var k=y({},c.properties.$set,c.$set);if(A(k)||this.setPersonPropertiesForFlags(k),!j(this.config.before_send)){var S=this.ee(c);if(!S)return;c=S}this.yt.emit("eventCaptured",c);var P={method:"POST",url:null!=(s=null==i?void 0:i._url)?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Bi(P):this.Hi.enqueue(P),c}tc.critical("This capture call is ignored due to client rate limiting.")}}else tc.error("No event name provided to posthog.capture")}else tc.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,r,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var o,a=n?void 0:this.persistence.remove_event_timer(e),l=y({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,("always"==this.config.cookieless_mode||"on_reject"==this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())&&(l.$cookieless_mode=!0),"$snapshot"===e){var h=y({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!L(l.distinct_id)&&!U(l.distinct_id)||N(l.distinct_id))&&tc.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var d,p=function(e,t){if(!_)return{};var i,r,n,o,a,l,c,h,d,p,g,f=e?tf([],iA,t||[]):[],[m,y]=function(e){for(var t=0;t<eG.length;t++){var[i,s]=eG[t],r=i.exec(e),n=r&&(C(s)?s(r,e):s);if(n)return n}return["",""]}(_);return tv(tE({$os:m,$os_version:y,$browser:eV(_,navigator.vendor),$device:eY(_),$device_type:(l={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(r=navigator)?void 0:r.maxTouchPoints,screenWidth:null==s||null==(n=s.screen)?void 0:n.width,screenHeight:null==s||null==(o=s.screen)?void 0:o.height,devicePixelRatio:null==s?void 0:s.devicePixelRatio},(g=eY(_))===en||g===er||"Kobo"===g||"Kindle Fire"===g||g===eM?es:g===ek||g===eP||g===eS||g===eC?"Console":g===ea?"Wearable":g?et:"Android"===(null==l?void 0:l.userAgentDataPlatform)&&(null!=(c=null==l?void 0:l.maxTouchPoints)?c:0)>0?Math.min(null!=(h=null==l?void 0:l.screenWidth)?h:0,null!=(d=null==l?void 0:l.screenHeight)?d:0)/(null!=(p=null==l?void 0:l.devicePixelRatio)?p:1)>=600?es:et:"Desktop"),$timezone:iz(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:iI(null==u?void 0:u.href,f,iL),$host:null==u?void 0:u.host,$pathname:null==u?void 0:u.pathname,$raw_user_agent:_.length>1e3?_.substring(0,997)+"...":_,$browser_version:eB(_,navigator.vendor),$browser_language:iH(),$browser_language_prefix:"string"==typeof(a=iH())?a.split("-")[0]:void 0,$screen_height:null==s?void 0:s.screen.height,$screen_width:null==s?void 0:s.screen.width,$viewport_height:null==s?void 0:s.innerHeight,$viewport_width:null==s?void 0:s.innerWidth,$lib:"web",$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:g,windowId:f}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime());l.$session_id=g,l.$window_id=f}this.sessionPropsManager&&tv(l,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&tv(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(o=this.qi)?void 0:o.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===s5.CUSTOM&&(l.$lib_custom_api_host=this.config.api_host),d="$pageview"!==e||n?"$pageleave"!==e||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),l=tv(l,d),"$pageview"===e&&c&&(l.title=c.title),!M(a)){var m=i.getTime()-a;l.$duration=parseFloat((m/1e3).toFixed(3))}_&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=tv({},p,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),I(this.config.property_denylist)?tg(this.config.property_denylist,function(e){delete l[e]}):tc.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(tc.error("sanitize_properties is deprecated. Use before_send instead"),l=b(l,e));var E=this.re();return l.$process_person_profile=E,E&&!n&&this.se("_calculate_event_properties"),l}ie(e,t){if(void 0===t&&(t=!0),!this.persistence||!this.re()||this.Fi)return e;var i,s=tv({},this.persistence.get_initial_props(),(null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps())||{},e||{}),r=this.config.sanitize_properties;return r&&(tc.error("sanitize_properties is deprecated. Use before_send instead"),s=r(s,"$set_once")),t&&(this.Fi=!0),A(s)?void 0:s}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}ne(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,i){var s=null!=i&&i.merge?this.featureFlags.getFlagVariants():{},r=null!=i&&i.merge?this.featureFlags.getFlagPayloads():{},n=y({},s,e),o=y({},r,t),a={};for(var[l,c]of Object.entries(n)){var u="string"==typeof c;a[l]={key:l,enabled:!!u||!!c,variant:u?c:void 0,reason:void 0,metadata:M(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.featureFlags.receivedFeatureFlags({flags:a})}updateEarlyAccessFeatureEnrollment(e,t,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return void 0===t&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.yt.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:"Surveys module not available"}),()=>{})}onSessionId(e){var t,i;return null!=(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:"Surveys module not available"})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:"Surveys module not available"})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=rt),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!=(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))?t:{visible:!1,disabledReason:"Surveys module not available"}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!=(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))?i:Promise.resolve({visible:!1,disabledReason:"Surveys module not available"})}identify(e,t,i){if(!this.__loaded||!this.persistence)return tc.uninitializedWarning("posthog.identify");if(U(e)&&(e=e.toString(),tc.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))tc.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.');else if(e!==t5){if(this.se("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(tT)&&(this.unregister(tT),this.register({distinct_id:e}));var r="anonymous"===(this.persistence.get_property(tX)||"anonymous");e!==s&&r?(this.persistence.set_property(tX,"identified"),this.setPersonPropertiesForFlags(y({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.Li=s0(e,t,i),this.featureFlags.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(tG))}}else tc.critical('The string "'+t5+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else tc.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.se("posthog.setPersonProperties")){var i=s0(this.get_distinct_id(),e,t);this.Li!==i?(this.setPersonPropertiesForFlags(y({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Li=i):tc.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){var s=this.getGroups();s[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:y({},s,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),s[e]===t||i||this.reloadFeatureFlags()}else tc.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0),this.se("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){if(tc.info("reset"),!this.__loaded)return tc.uninitializedWarning("posthog.reset");var t,i,s,r,n,o,a=this.get_property("$device_id");if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),null==(s=this.surveys)||s.reset(),null==(r=this.Qi)||r.stop(),this.featureFlags.reset(),null==(n=this.persistence)||n.set_property(tX,"anonymous"),null==(o=this.sessionManager)||o.resetSessionId(),this.Li=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:t5,$device_id:null},"");else{var l=this.config.get_device_id(ii());this.register_once({distinct_id:l,$device_id:e?l:a},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!=(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var r,n=null!=(r=e.timestampLookBack)?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(tP)?(tc.critical("Attempting to create alias for existing People user - aborting."),-2):this.se("posthog.alias")?(M(t)&&(t=this.get_distinct_id()),e!==t?(this.ne(tT,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(tc.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=y({},this.config);if(R(e)){tv(this.config,rh(e));var i,s,r,n,o,a,l,c,u,h=this.zi();null==(i=this.persistence)||i.update_config(this.config,t,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new i3(y({},this.config,{persistence:"sessionStorage"}),h);var d=this.ji(this.config.debug);q(d)&&(this.config.debug=d),q(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,ic.F()&&ic.L("ph_debug","true"),tc.info("set_config",{config:e,oldConfig:t,newConfig:y({},this.config)})):(v.DEBUG=!1,ic.F()&&ic.j("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(n=this.autocapture)||n.startIfEnabled(),null==(o=this.heatmaps)||o.startIfEnabled(),null==(a=this.exceptionObserver)||a.startIfEnabledOrStop(),null==(l=this.deadClicksAutocapture)||l.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.oe(),null==(u=this.externalIntegrations)||u.startIfEnabledOrStop()}}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var i=Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(y({},s,t))}}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!=(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!=(e=this.config.name)?e:rl;return t!==rl&&(t=rl+"."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property(tX))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property(tX))}re(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&A(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[tT])&&(null==(t=this.persistence)||null==(t=t.props)||!t[t2]))}Zi(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.re()||this.se("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.se("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}se(e){return"never"===this.config.person_profiles?(tc.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.ne(t2,!0),!0)}zi(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||e&&!!t}oe(){var e,t,i,s,r=this.zi();return(null==(e=this.persistence)?void 0:e.Rt)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t.Rt)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if("always"!==this.config.cookieless_mode){if("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut()){this.reset(!0),null==(r=this.sessionManager)||r.destroy(),null==(n=this.pageViewManager)||n.destroy(),this.sessionManager=new sJ(this),this.pageViewManager=new iP(this),this.persistence&&(this.sessionPropsManager=new sY(this,this.sessionManager,this.persistence));var i,s,r,n,o,a,l,c=null!=(o=null==(a=this.config.__extensionClasses)?void 0:a.sessionRecording)?o:null==(l=rp.__defaultExtensionClasses)?void 0:l.sessionRecording;c&&(this.sessionRecording=this.Ci(this.sessionRecording,new c(this)))}this.consent.optInOut(!0),this.oe(),this.Ki(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(i=this.surveys)||i.loadIfEnabled()),(M(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!=(s=null==e?void 0:e.captureEventName)?s:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Xi()}else tc.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,i;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.oe(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:t5,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.Xi())):tc.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}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===ig.GRANTED?"granted":e===ig.DENIED?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.oe()}_is_bot(){return l?sZ(l,this.config.custom_blocked_useragents):void 0}Xi(){c&&("visible"===c.visibilityState?this.Mi||(this.Mi=!0,this.capture("$pageview",{title:c.title},{send_instantly:!0}),this.Ai&&(c.removeEventListener("visibilitychange",this.Ai),this.Ai=null)):this.Ai||(this.Ai=this.Xi.bind(this),tk(c,"visibilitychange",this.Ai)))}debug(e){!1===e?(null==s||s.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==s||s.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}))}xt(){var e,t,i,s,r=this.Ni||{};return"advanced_disable_flags"in r?!!r.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(tc.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):(t="advanced_disable_decide",i=(e="advanced_disable_flags")in r&&!j(r[e]),s=t in r&&!j(r[t]),i?r[e]:!!s&&(tc&&tc.warn("Config field '"+t+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),r[t]))}ee(e){if(j(this.config.before_send))return e;var t=I(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(j(i=s(i))){var r="Event '"+e.event+"' was rejected in beforeSend function";return W(e.event)?tc.warn(r+". This can cause unexpected behavior."):tc.info(r),null}i.properties&&!A(i.properties)||tc.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager.K)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}ji(e){var t=q(e)&&!e,i=ic.F()&&"true"===ic.A("ph_debug");return!t&&(!!i||e)}}function r_(e){return e instanceof Element&&(e.id===t3||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function rg(e){return!!e&&1===e.nodeType}function rv(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function rf(e){return!!e&&3===e.nodeType}function rm(e){return!!e&&11===e.nodeType}function ry(e){return e?S(e).split(/\s+/):[]}function rb(e){var t=null==s?void 0:s.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function rE(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return ry(t)}function rw(e){return j(e)?null:S(e).split(/(\s+)/).filter(e=>rU(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function rx(e){var t="";return rC(e)&&!rR(e)&&e.childNodes&&e.childNodes.length&&tg(e.childNodes,function(e){var i;rf(e)&&e.textContent&&(t+=null!=(i=rw(e.textContent))?i:"")}),S(t)}function rk(e){var t;return M(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}rp.__defaultExtensionClasses={},function(e,t){for(var i=0;i<t.length;i++)e.prototype[t[i]]=tb(e.prototype[t[i]])}(rp,["identify"]);var rS=["a","button","form","input","select","textarea","label"];function rP(e,t){if(M(t))return!0;var i,s=function(e){if(t.some(t=>e.matches(t)))return{v:!0}};for(var r of e)if(i=s(r))return i.v;return!1}function rT(e){var t=e.parentNode;return!(!t||!rg(t))&&t}var rO=["next","previous","prev",">","<"],r$=[".ph-no-rageclick",".ph-no-capture"],rF=e=>!e||rv(e,"html")||!rg(e),rI=(e,t)=>{if(!s||rF(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],n=e;n.parentNode&&!rv(n,"body");)if(rm(n.parentNode))r.push(n.parentNode.host),n=n.parentNode.host;else{var o=rT(n);if(!o)break;if(t||rS.indexOf(o.tagName.toLowerCase())>-1)i=!0;else{var a=s.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}r.push(o),n=o}return{parentIsUsefulElement:i,targetElementList:r}};function rC(e){for(var t=e;t.parentNode&&!rv(t,"body");t=t.parentNode){var i=rE(t);if(k(i,"ph-sensitive")||k(i,"ph-no-capture"))return!1}if(k(rE(e),"ph-include"))return!0;var s=e.type||"";if(L(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!(L(r)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,"")))}function rR(e){return!!(rv(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||rv(e,"select")||rv(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var rA="(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})",rM=RegExp("^(?:"+rA+")$"),rL=new RegExp(rA),rN="\\d{3}-?\\d{2}-?\\d{4}",rD=RegExp("^("+rN+")$"),rj=RegExp("("+rN+")");function rU(e,t){return void 0===t&&(t=!0),!(j(e)||L(e)&&(e=S(e),(t?rM:rL).test((e||"").replace(/[- ]/g,""))||(t?rD:rj).test(e)))&&!0}function rH(e){var t=rx(e);return rU(t=(t+" "+function e(t){var i="";return t&&t.childNodes&&t.childNodes.length&&tg(t.childNodes,function(t){var s;if(t&&"span"===(null==(s=t.tagName)?void 0:s.toLowerCase()))try{var r=rx(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+e(t)).trim())}catch(e){tc.error("[AutoCapture]",e)}}),i}(e)).trim())?t:""}function rq(e){return e.replace(/"|\\"/g,'\\"')}class rW{constructor(e){this.disabled=!1===e;var t=R(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&i-s.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var rV="$copy_autocapture",rz=tu("[AutoCapture]");function rB(e,t){return t.length>e?t.slice(0,e)+"...":t}var rG=tu("[ExceptionAutocapture]");function rY(e,t,i){try{if(!(t in e))return()=>{};var s=e[t],r=i(s);return C(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,()=>{e[t]=s}}catch(e){return()=>{}}}var rK=tu("[TracingHeaders]"),rX=tu("[Web Vitals]"),rJ="disabled",rZ="lazy_loading",rQ="awaiting_config",r0="missing_config";tu("[SessionRecording]");var r1="[SessionRecording]",r2=tu(r1),r3=tu("[Heatmaps]");function r5(e){return R(e)&&"clientX"in e&&"clientY"in e&&U(e.clientX)&&U(e.clientY)}var r6=tu("[Product Tours]"),r8="ph_product_tours",r4=["$set_once","$set"],r7=tu("[SiteApps]");function r9(e,t,i){if(j(e))return!1;switch(i){case"exact":return e===t;case"contains":return RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*"),"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class ne{constructor(e){this.ae=new sK,this.le=(e,t)=>this.ue(e,t)&&this.he(e,t)&&this.de(e,t)&&this.ve(e,t),this.ue=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.ce=new Set,this.fe=new Set}init(){var e,t;M(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.on(e,t)})}register(e){var t,i;if(!M(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t,i;null==(t=this.fe)||t.add(e),null==(i=e.steps)||i.forEach(e=>{var t;null==(t=this.ce)||t.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var s,r=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&r.add(null==e?void 0:e.selector)})}),null==(s=this._instance)||s.autocapture.setElementSelectors(r)}}on(e,t){var i;null!=t&&0!=e.length&&(this.ce.has(e)||this.ce.has(null==t?void 0:t.event))&&this.fe&&(null==(i=this.fe)?void 0:i.size)>0&&this.fe.forEach(e=>{this.pe(t,e)&&this.ae.emit("actionCaptured",e.name)})}_e(e){this.onAction("actionCaptured",t=>e(t))}pe(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.le(e,i))return!0;return!1}onAction(e,t){return this.ae.on(e,t)}he(e,t){if(null!=t&&t.url){var i,s=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!s||"string"!=typeof s||!r9(s,t.url,t.url_matching||"contains"))return!1}return!0}de(e,t){return!!this.ge(e,t)&&!!this.me(e,t)&&!!this.be(e,t)}ge(e,t){if(null==t||!t.href)return!0;var i=this.ye(e);if(i.length>0)return i.some(e=>r9(e.href,t.href,t.href_matching||"exact"));var s,r,n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!n&&r9((r=n.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}me(e,t){if(null==t||!t.text)return!0;var i=this.ye(e);if(i.length>0)return i.some(e=>r9(e.text,t.text,t.text_matching||"exact")||r9(e.$el_text,t.text,t.text_matching||"exact"));var s,r,n,o,a=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!a&&(r=function(e){for(var t,i=[],s=/(?::|")text="(.*?)"/g;!j(t=s.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",r.some(e=>r9(e,n,o)))}be(e,t){if(null==t||!t.selector)return!0;var i,s,r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=r&&r.includes(t.selector))return!0;var n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){}return!1}ye(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}ve(e,t){return null==t||!t.properties||0===t.properties.length||s3(t.properties.reduce((e,t)=>{var i=I(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}class nt{constructor(e){this._instance=e,this.we=new Map,this.Ee=new Map,this.xe=new Map}Se(e,t){return!!e&&s3(e.propertyFilters,null==t?void 0:t.properties)}$e(e,t){var i=new Map;return e.forEach(e=>{var s;null==(s=e.conditions)||null==(s=s[t])||null==(s=s.values)||s.forEach(t=>{if(null!=t&&t.name){var s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}ke(e,t,i){var s=(i===i5.Activation?this.we:this.Ee).get(e),r=[];return this.Pe(e=>{r=e.filter(e=>null==s?void 0:s.includes(e.id))}),r.filter(s=>{var r,n=null==(r=s.conditions)||null==(r=r[i])||null==(r=r.values)?void 0:r.find(t=>t.name===e);return this.Se(n,t)})}register(e){var t;M(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Te(e),this.Re(e))}Re(e){var t=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0});0!==t.length&&(null==this.Ie&&(this.Ie=new ne(this._instance),this.Ie.init(),this.Ie._e(e=>{this.onAction(e)})),t.forEach(e=>{var t,i,s,r,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)?void 0:s.length)>0&&(null==(r=this.Ie)||r.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach(t=>{if(t&&t.name){var i=this.xe.get(t.name);i&&i.push(e.id),this.xe.set(t.name,i||[e.id])}}))}))}Te(e){var t,i=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0}),s=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0});(0!==i.length||0!==s.length)&&(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.onEvent(e,t)}),this.we=this.$e(e,i5.Activation),this.Ee=this.$e(e,i5.Cancellation))}onEvent(e,t){var i,s=this.Ce(),r=this.Oe(),n=this.Fe(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[r])||[];if(n===e&&t&&o.length>0){s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var a,l,c=(null==t||null==(a=t.properties)?void 0:a.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(c){var u=o.indexOf(c);u>=0&&(o.splice(u,1),this.Me(o))}}else{if(this.Ee.has(e)){var h=this.ke(e,t,i5.Cancellation);h.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(e=>e.id)}),h.forEach(e=>{var t=o.indexOf(e.id);t>=0&&o.splice(t,1),this.Ae(e.id)}),this.Me(o))}if(this.we.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.we.get(e)});var d=this.ke(e,t,i5.Activation);this.Me(o.concat(d.map(e=>e.id)||[]))}}}onAction(e){var t,i=this.Oe(),s=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this.xe.has(e)&&this.Me(s.concat(this.xe.get(e)||[]))}Me(e){var t,i=this.Ce(),s=this.Oe(),r=[...new Set(e)].filter(e=>!this.De(e));i.info("updating activated items",{activatedItems:r}),null==(t=this._instance)||null==(t=t.persistence)||t.register({[s]:r})}getActivatedIds(){var e,t=this.Oe();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this.we}Le(){return this.Ie}}class ni extends nt{constructor(e){super(e)}Oe(){return"$surveys_activated"}Fe(){return i8.SHOWN}Pe(e){var t;null==(t=this._instance)||t.getSurveys(e)}Ae(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}Ce(){return s4}De(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var ns=null!=s&&s.location?iC(s.location.hash,"__posthog")||iC(location.hash,"state"):null,nr="_postHogToolbarParams",nn=tu("[Toolbar]"),no=function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e}(no||{}),na=tu("[Error tracking]"),nl={icontains:(e,t)=>!!s&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!s&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!s&&sQ(t.href,e),not_regex:(e,t)=>!!s&&!sQ(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class nc{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{nc.je("retrieved web experiments from the server"),t.Ne=new Map,e.forEach(e=>{if(e.feature_flag_key){t.Ne&&(nc.je("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t.Ne)||i.set(e.feature_flag_key,e));var i,s=t._instance.getFeatureFlag(e.feature_flag_key);L(s)&&e.variants[s]&&t.Ue(e.name,s,e.variants[s].transforms)}else if(e.variants)for(var r in e.variants){var n=e.variants[r];nc.ze(n)&&t.Ue(e.name,r,n.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())nc.je("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(j(this.Ne))return this.Ne=new Map,this.loadIfEnabled(),void this.previewWebExperiment();nc.je("applying feature flags",e),e.forEach(e=>{var t;if(this.Ne&&null!=(t=this.Ne)&&t.has(e)){var i,s=this._instance.getFeatureFlag(e),r=null==(i=this.Ne)?void 0:i.get(e);s&&null!=r&&r.variants[s]&&this.Ue(r.name,s,r.variants[s].transforms)}})}}previewWebExperiment(){var e=nc.getWindowLocation();if(null!=e&&e.search){var t=iF(null==e?void 0:e.search,"__experiment_id"),i=iF(null==e?void 0:e.search,"__experiment_variant");t&&i&&(nc.je("previewing web experiments "+t+" && "+i),this.getWebExperiments(e=>{this.He(parseInt(t),i,e)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)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._instance.config.token),method:"GET",callback:t=>200===t.statusCode&&t.json?e(t.json.experiments||[]):e([])})}He(e,t,i){var s=i.filter(t=>t.id===e);s&&s.length>0&&(nc.je("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.Ue(s[0].name,t,s[0].variants[t].transforms))}static ze(e){return!j(e.conditions)&&nc.Be(e)&&nc.qe(e)}static Be(e){if(j(e.conditions)||j(null==(t=e.conditions)?void 0:t.url))return!0;var t,i,s,r,n=nc.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||nl[null!=(s=null==(r=e.conditions)?void 0:r.urlMatchType)?s:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==s?void 0:s.location}static qe(e){if(j(e.conditions)||j(null==(i=e.conditions)?void 0:i.utm))return!0;var t=iD();if(t.utm_source){var i,s,r,n,o,a,l,c,u,h=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==t.utm_campaign,d=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==t.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==t.utm_medium,_=null==(c=e.conditions)||null==(c=c.utm)||!c.utm_term||(null==(u=e.conditions)||null==(u=u.utm)?void 0:u.utm_term)==t.utm_term;return h&&p&&_&&d}return!1}static je(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];tc.info("[WebExperiments] "+e,i)}Ue(e,t,i){this._is_bot()?nc.je("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?i.forEach(i=>{if(i.selector){nc.je("applying transform of variant "+t+" for experiment "+e+" ",i);var s,r=null==(s=document)?void 0:s.querySelectorAll(i.selector);null==r||r.forEach(e=>{i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)})}}):nc.je("Control variants leave the page unmodified.")}_is_bot(){return l&&this._instance?sZ(l,this._instance.config.custom_blocked_useragents):void 0}}var nu=tu("[Conversations]"),nh=y({},{sessionRecording:class{get started(){var e;return!(null==(e=this.Ve)||!e.isStarted)}get status(){var e,t;return this.We===rQ||this.We===r0?this.We:null!=(e=null==(t=this.Ve)?void 0:t.status)?e:this.We}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.We=rJ,this.Ge=void 0,this._instance=e,!this._instance.sessionManager)throw r2.error("started without valid sessionManager"),Error(r1+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw Error(r1+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ye(){var e,t=!(null==(e=this._instance.get_property(tD))||!e.enabled),i=!this._instance.config.disable_session_recording,r=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return s&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!this.Ye||null==(t=this.Ve)||!t.isStarted){var i=!M(Object.assign)&&!M(Array.from);this.Ye&&i?(this.Je(e),r2.info("starting")):(this.We=rJ,this.stopRecording())}}Je(e){var t,i,s;this.Ye&&(this.We!==rQ&&this.We!==r0&&(this.We=rZ),null!=g&&null!=(t=g.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=g.__PosthogExtensions__)&&i.initSessionRecording?this.Ke(e):null==(s=g.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this.Xe,t=>{if(t)return r2.error("could not load recorder",t);this.Ke(e)}))}stopRecording(){var e,t;null==(e=this.Ge)||e.call(this),this.Ge=void 0,null==(t=this.Ve)||t.stop()}Qe(){var e,t;null==(e=this.Ge)||e.call(this),this.Ge=void 0,null==(t=this.Ve)||t.discard()}Ze(){var e;null==(e=this._instance.persistence)||e.unregister(tU)}tr(e,t){if(j(e))return null;var i=U(e)?e:parseFloat(e);return"number"==typeof i&&Number.isFinite(i)&&i>=0&&i<=1?i:(r2.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null)}ir(e){if(this._instance.persistence){var t,i,s=this._instance.persistence,r=()=>{var t,i=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.tr(null==(t=this._instance.config.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.tr(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=r?r:n;j(o)&&this.Ze();var a=null==i?void 0:i.minimumDurationMilliseconds;s.register({[tD]:y({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:y({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:M(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers})})};r(),null==(t=this.Ge)||t.call(this),this.Ge=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(r)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.ir(e),void this.Qe()):(this.ir(e),void this.startIfEnabledOrStop()):(this.We===rQ&&(this.We=r0,r2.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this.Ve)&&i.log?this.Ve.log(e,t):r2.warn("log called before recorder was ready")}get Xe(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(tD);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}er(){var e,t=this._instance.get_property(tD);if(!t)return!1;var i=null!=(e=("object"==typeof t?t:JSON.parse(t)).cache_timestamp)?e:0;return Date.now()-i<=36e5}Ke(e){var t,i;if(null==(t=g.__PosthogExtensions__)||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");if(this.Ve||(this.Ve=null==(i=g.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.Ve._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.er()){if(this.We===r0||this.We===rQ)return;return this.We=rQ,r2.info("persisted remote config is stale, requesting fresh config before starting"),void new sr(this._instance).load()}this.We=rZ,this.Ve.start(e)}onRRwebEmit(e){var t;null==(t=this.Ve)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Ve||null==(t=this._instance.persistence)||t.register({$replay_override_linked_flag:!0}),null==(e=this.Ve)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Ve||null==(t=this._instance.persistence)||t.register({$replay_override_sampling:!0}),null==(e=this.Ve)||e.overrideSampling()}overrideTrigger(e){var t,i;this.Ve||null==(i=this._instance.persistence)||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(t=this.Ve)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.Ve)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.Ve)||!i.tryAddCustomEvent(e,t))}}},{autocapture:class{constructor(e){this.rr=!1,this.sr=null,this.nr=!1,this.instance=e,this.rageclicks=new rW(e.config.rageclick),this.ar=null}initialize(){this.startIfEnabled()}get N(){var e,t,i=R(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map(e=>new RegExp(e)),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),i}lr(){if(this.isBrowserSupported()){if(s&&c){var e=e=>{e=e||(null==s?void 0:s.event);try{this.ur(e)}catch(e){rz.error("Failed to capture event",e)}};if(tk(c,"submit",e,{capture:!0}),tk(c,"change",e,{capture:!0}),tk(c,"click",e,{capture:!0}),this.N.capture_copied_text){var t=e=>{e=e||(null==s?void 0:s.event),this.ur(e,rV)};tk(c,"copy",t,{capture:!0}),tk(c,"cut",t,{capture:!0})}}}else rz.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.rr&&(this.lr(),this.rr=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.nr=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[t$]:!!e.autocapture_opt_out}),this.sr=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.ar=e}getElementSelectors(e){var t,i=[];return null==(t=this.ar)||t.forEach(t=>{var s=null==c?void 0:c.querySelectorAll(t);null==s||s.forEach(s=>{e===s&&i.push(t)})}),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[t$];if(D(this.sr)&&!q(i)&&!this.instance.xt())return!1;var s=null!=(t=this.sr)?t:!!i;return!!this.instance.config.autocapture&&!s}ur(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,r=rk(e);rf(r)&&(r=r.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,t){if(!s||rF(e)||(q(t)?(i=!!t&&r$,r=void 0):(i=null!=(n=null==t?void 0:t.css_selector_ignorelist)?n:r$,r=null==t?void 0:t.content_ignorelist),!1===i))return!1;var i,r,n,{targetElementList:o}=rI(e,!1);return!function(e,t){var i;if(!1===e||M(e))return!1;if(!0===e)i=rO;else{if(!I(e))return!1;if(e.length>10)return tc.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(e=>{var{safeText:t,ariaLabel:s}=e;return i.some(e=>t.includes(e)||s.includes(e))})}(r,o.map(e=>{var t;return{safeText:rx(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!rP(o,i)}(r,this.instance.config.rageclick)&&this.ur(e,"$rageclick");var n=t===rV;if(r&&function(e,t,i,r,n){if(void 0===i&&(i=void 0),!s||rF(e)||null!=(o=i)&&o.url_allowlist&&!rb(i.url_allowlist)||null!=(a=i)&&a.url_ignorelist&&rb(i.url_ignorelist))return!1;if(null!=(l=i)&&l.dom_event_allowlist){var o,a,l,c,u=i.dom_event_allowlist;if(u&&!u.some(e=>t.type===e))return!1}var{parentIsUsefulElement:h,targetElementList:d}=rI(e,r);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(M(i))return!0;var s,r=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(s=r(n))return s.v;return!1}(d,i)||!rP(d,null==(c=i)?void 0:c.css_selector_allowlist))return!1;var p=s.getComputedStyle(e);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===t.type)return!0;var _=e.tagName.toLowerCase();switch(_){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return h?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(rS.indexOf(_)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,this.N,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=function(e,t){for(var i,r,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:c}=t,u=[e],h=e;h.parentNode&&!rv(h,"body");)rm(h.parentNode)?(u.push(h.parentNode.host),h=h.parentNode.host):(u.push(h.parentNode),h=h.parentNode);var d,p=[],_={},g=!1,v=!1;if(tg(u,e=>{var t=rC(e);"a"===e.tagName.toLowerCase()&&(g=e.getAttribute("href"),g=t&&g&&rU(g)&&g),k(rE(e),"ph-no-capture")&&(v=!0),p.push(function(e,t,i,s){var r=e.tagName.toLowerCase(),n={tag_name:r};rS.indexOf(r)>-1&&!i&&("a"===r.toLowerCase()||"button"===r.toLowerCase()?n.$el_text=rB(1024,rH(e)):n.$el_text=rB(1024,rx(e)));var o=rE(e);o.length>0&&(n.classes=o.filter(function(e){return""!==e})),tg(e.attributes,function(i){var r;if((!rR(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&!t&&rU(i.value)&&(!L(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=i.value;"class"===i.name&&(o=ry(o).join(" ")),n["attr__"+i.name]=rB(1024,o)}});for(var a=1,l=1,c=e;c=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!rg(t));return t}(c);)a++,c.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,o,a,l)),tv(_,function(e){if(!rC(e))return{};var t={};return tg(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&rU(s)&&(t[i]=s)}}),t}(e))}),v)return{props:{},explicitNoCapture:v};if(a||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?p[0].$el_text=rH(e):p[0].$el_text=rx(e)),g){p[0].attr__href=g;var f,m,b=null==(f=iO(g))?void 0:f.host,E=null==s||null==(m=s.location)?void 0:m.host;b&&E&&b!==E&&(d=g)}return{props:tv({$event_type:n.type,$ce_version:1},c?{}:{$elements:p},{$elements_chain:p.map(e=>{var t,i,s,r={text:null==(i=e.$el_text)?void 0:i.slice(0,400),tag_name:e.tag_name,href:null==(s=e.attr__href)?void 0:s.slice(0,2048),attr_class:(t=e.attr__class)?I(t)?t:ry(t):void 0,attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return tm(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,i]=e;return r.attributes[t]=i}),r}).map(e=>{var t,i,s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(var r of(e.attr_class.sort(),e.attr_class))s+="."+r.replace(/"/g,"");var n=y({},e.text?{text:e.text}:{},{"nth-child":null!=(t=e.nth_child)?t:0,"nth-of-type":null!=(i=e.nth_of_type)?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return tm(n).sort((e,t)=>{var[i]=e,[s]=t;return i.localeCompare(s)}).forEach(e=>{var[t,i]=e;return o[rq(t.toString())]=rq(i.toString())}),s+=":",s+=tm(o).map(e=>{var[t,i]=e;return t+'="'+i+'"'}).join("")}).join(";")},null!=(i=p[0])&&i.$el_text?{$el_text:null==(r=p[0])?void 0:r.$el_text}:{},d&&"click"===n.type?{$external_click_url:d}:{},_)}}(r,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.N.element_attribute_ignorelist,elementsChainAsString:this.nr});if(a)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(o.$element_selectors=l),t===rV){var c,u=rw(null==s||null==(c=s.getSelection())?void 0:c.toString()),h=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=h}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return C(null==c?void 0:c.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.hr=(null==s||null==(t=s.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(tc.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.dr&&this.dr(),this.dr=void 0,tc.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(s&&s.history){var i=this;null!=(e=s.history.pushState)&&e.__posthog_wrapped__||rY(s.history,"pushState",e=>function(t,s,r){e.call(this,t,s,r),i.vr("pushState")}),null!=(t=s.history.replaceState)&&t.__posthog_wrapped__||rY(s.history,"replaceState",e=>function(t,s,r){e.call(this,t,s,r),i.vr("replaceState")}),this.cr()}}vr(e){try{var t,i=null==s||null==(t=s.location)?void 0:t.pathname;if(!i)return;i!==this.hr&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.hr=i}catch(t){tc.error("Error capturing "+e+" pageview",t)}}cr(){if(!this.dr){var e=()=>{this.vr("popstate")};tk(s,"popstate",e),this.dr=()=>{s&&s.removeEventListener("popstate",e)}}}},heatmaps:class{constructor(e){var t;this.pr=!1,this.rr=!1,this._r=null,this.instance=e,this.pr=!(null==(t=this.instance.persistence)||!t.props[tF]),this.rageclicks=new rW(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return R(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return j(this.instance.config.capture_heatmaps)?j(this.instance.config.enable_heatmaps)?this.pr:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled)this.rr||(r3.info("starting..."),this.gr(),this.mr());else{var e;clearInterval(null!=(e=this._r)?e:void 0),this.br(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[tF]:t}),this.pr=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.C;return this.C=void 0,e}yr(e){this.wr(e.originalEvent,"deadclick")}mr(){this._r&&clearInterval(this._r),this._r="visible"===(null==c?void 0:c.visibilityState)?setInterval(this.Xt.bind(this),this.flushIntervalMilliseconds):null}gr(){s&&c&&(this.Er=this.Xt.bind(this),tk(s,"beforeunload",this.Er),this.Sr=e=>this.wr(e||(null==s?void 0:s.event)),tk(c,"click",this.Sr,{capture:!0}),this.$r=e=>this.kr(e||(null==s?void 0:s.event)),tk(c,"mousemove",this.$r,{capture:!0}),this.Pr=new iE(this.instance,iy,this.yr.bind(this)),this.Pr.startIfEnabledOrStop(),this.Tr=this.mr.bind(this),tk(c,"visibilitychange",this.Tr),this.rr=!0)}br(){var e;s&&c&&(this.Er&&s.removeEventListener("beforeunload",this.Er),this.Sr&&c.removeEventListener("click",this.Sr,{capture:!0}),this.$r&&c.removeEventListener("mousemove",this.$r,{capture:!0}),this.Tr&&c.removeEventListener("visibilitychange",this.Tr),clearTimeout(this.Rr),null==(e=this.Pr)||e.stop(),this.rr=!1)}Ir(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,t,i){for(var r=e;r&&rg(r)&&!rv(r,"body")&&r!==i;){if(k(t,null==s?void 0:s.getComputedStyle(r).position))return!0;r=rT(r)}return!1}(rk(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:i),target_fixed:o,type:t}}wr(e,t){var i;if(void 0===t&&(t="click"),!r_(e.target)&&r5(e)){var s=this.Ir(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.Cr(y({},s,{type:"rageclick"})),this.Cr(s)}}kr(e){!r_(e.target)&&r5(e)&&(clearTimeout(this.Rr),this.Rr=setTimeout(()=>{this.Cr(this.Ir(e,"mousemove"))},500))}Cr(e){if(s){var t=s.location.href,i=this.instance.config.mask_personal_data_properties,r=this.instance.config.custom_personal_data_properties,n=iI(t,i?tf([],iA,r||[]):[],iL);this.C=this.C||{},this.C[n]||(this.C[n]=[]),this.C[n].push(e)}}Xt(){this.C&&!A(this.C)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:iE,webVitalsAutocapture:class{constructor(e){var t;this.pr=!1,this.rr=!1,this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Or=()=>{clearTimeout(this.Fr),0!==this.C.metrics.length&&(this._instance.capture("$web_vitals",this.C.metrics.reduce((e,t)=>y({},e,{["$web_vitals_"+t.name+"_event"]:y({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Mr=e=>{var t,i=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(M(i))rX.error("Could not read session ID. Dropping metrics!");else{this.C=this.C||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.Ar();M(s)||(j(null==e?void 0:e.name)||j(null==e?void 0:e.value)?rX.error("Invalid metric received",e):this.Dr&&e.value>=this.Dr?rX.error("Ignoring metric with value >= "+this.Dr,e):(this.C.url!==s&&(this.Or(),this.Fr=setTimeout(this.Or,this.flushToCaptureTimeoutMs)),M(this.C.url)&&(this.C.url=s),this.C.firstMetricTimestamp=M(this.C.firstMetricTimestamp)?Date.now():this.C.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.C.metrics.push(y({},e,{$current_url:s,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.C.metrics.length===this.allowedMetrics.length&&this.Or()))}},this.Lr=()=>{if(!this.rr){var e,t,i,s,r=g.__PosthogExtensions__;M(r)||M(r.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:s}=r.postHogWebVitalsCallbacks),e&&t&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.Mr.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.Mr.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Mr.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.Mr.bind(this)),this.rr=!0):rX.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.pr=!(null==(t=this._instance.persistence)||!t.props[tA]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=R(this._instance.config.capture_performance)?null==(e=this._instance.config.capture_performance)?void 0:e.web_vitals_allowed_metrics:void 0;return j(i)?(null==(t=this._instance.persistence)?void 0:t.props[tN])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return null!=e&&e}get Dr(){var e=R(this._instance.config.capture_performance)&&U(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:9e5;return 0<e&&e<=6e4?9e5:e}get isEnabled(){var e=null==u?void 0:u.protocol;if("http:"!==e&&"https:"!==e)return rX.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:q(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return q(t)?t:this.pr}startIfEnabled(){this.isEnabled&&!this.rr&&(rX.info("enabled, starting..."),this.G(this.Lr))}onRemoteConfig(e){if("capturePerformance"in e){var t=R(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=R(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[tA]:t}),this._instance.persistence.register({[tN]:i})),this.pr=t,this.startIfEnabled()}}G(e){var t,i;if(null!=(t=g.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks)e();else{var s=this.useAttribution?"web-vitals-with-attribution":"web-vitals";null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,s,t=>{t?rX.error("failed to load script",t):e()})}}Ar(){var e=s?s.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties;return iI(e,t?tf([],iA,i||[]):[],iL)}rX.error("Could not determine current URL")}}},{exceptionObserver:class{constructor(e){var t,i,r;this.Lr=()=>{var e;if(s&&this.isEnabled&&null!=(e=g.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=g.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=g.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=g.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.jr&&this.N.capture_unhandled_errors&&(this.jr=t(this.captureException.bind(this))),!this.Nr&&this.N.capture_unhandled_rejections&&(this.Nr=i(this.captureException.bind(this))),!this.Ur&&this.N.capture_console_errors&&(this.Ur=r(this.captureException.bind(this)))}catch(e){rG.error("failed to start",e),this.zr()}}},this._instance=e,this.Hr=!(null==(t=this._instance.persistence)||!t.props[tI]),this.Br=new J({refillRate:null!=(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)?i:1,bucketSize:null!=(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)?r:10,refillInterval:1e4,h:rG}),this.N=this.qr(),this.startIfEnabledOrStop()}qr(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return R(e)?t=y({},t,e):(M(e)?this.Hr:e)&&(t=y({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.N.capture_console_errors||this.N.capture_unhandled_errors||this.N.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(rG.info("enabled"),this.zr(),this.G(this.Lr)):this.zr()}G(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return rG.error("failed to load script",t);e()})}zr(){var e,t,i;null==(e=this.jr)||e.call(this),this.jr=void 0,null==(t=this.Nr)||t.call(this),this.Nr=void 0,null==(i=this.Ur)||i.call(this),this.Ur=void 0}onRemoteConfig(e){if("autocaptureExceptions"in e){var t=e.autocaptureExceptions;this.Hr=!!t,this._instance.persistence&&this._instance.persistence.register({[tI]:this.Hr}),this.N=this.qr(),this.startIfEnabledOrStop()}}onConfigChange(){this.N=this.qr()}captureException(e){var t,i,s,r=null!=(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)?t:"Exception";this.Br.consumeRateLimit(r)?rG.info("Skipping exception capture because of client rate limiting.",{exception:r}):null==(s=this._instance.exceptions)||s.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,i;this.Vr=[],this.Wr=new eX([new e4,new ta,new e9,new e7,new tn,new tr,new tt,new to],function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];return function(t,s){void 0===s&&(s=0);for(var r=[],n=t.split("\n"),o=s;o<n.length;o++){var a=n[o];if(!(a.length>1024)){var l=e8.test(a)?a.replace(e8,"$1"):a;if(!l.match(/\S*Error: /)){for(var c of i){var u=c(l,e);if(u){r.push(u);break}}if(r.length>=50)break}}}if(!r.length)return[];var h=Array.from(r);return h.reverse(),h.slice(0,50).map(e=>y({},e,{filename:e.filename||(h[h.length-1]||{}).filename,function:e.function||"?"}))}}("web:javascript",e2,e6)),this._instance=e,this.Vr=null!=(t=null==(i=this._instance.persistence)?void 0:i.get_property(tC))?t:[]}onRemoteConfig(e){var t,i,s;if("errorTracking"in e){var r=null!=(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)?t:[],n=null==(s=e.errorTracking)?void 0:s.captureExtensionExceptions;this.Vr=r,this._instance.persistence&&this._instance.persistence.register({[tC]:this.Vr,[tR]:n})}}get Gr(){var e,t=!!this._instance.get_property(tR),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!=(e=null!=i?i:t)&&e}buildProperties(e,t){return this.Wr.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.Yr(t)){if(this.Jr(t))return void na.info("Skipping exception capture because a suppression rule matched");if(!this.Gr&&this.Kr(t))return void na.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Xr(t))return void na.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",te:!0})}Jr(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>{var{type:i,value:s}=t;return L(i)&&i.length>0&&e.$exception_types.push(i),L(s)&&s.length>0&&e.$exception_values.push(s),e},{$exception_types:[],$exception_values:[]});return this.Vr.some(e=>{var i=e.values.map(e=>{var i,s=s1[e.operator],r=I(e.value)?e.value:[e.value],n=null!=(i=t[e.key])?i:[];return r.length>0&&s(r,n)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}Kr(e){return e.flatMap(e=>{var t,i;return null!=(t=null==(i=e.stacktrace)?void 0:i.frames)?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}Xr(e){if(e.length>0){var t,i,s,r,n=null!=(t=null==(i=e[0].stacktrace)?void 0:i.frames)?t:[],o=n[n.length-1];return null!=(s=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&s}return!1}Yr(e){return!j(e)&&I(e)}}},{productTours:class{constructor(e){this.Qr=null,this.Zr=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this._instance.persistence&&this._instance.persistence.register({[tL]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.Qr||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(tL)||this.G(()=>this.ts())}G(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",t=>{t?r6.error("Could not load product tours script",t):e()})}ts(){var e;!this.Qr&&null!=(e=g.__PosthogExtensions__)&&e.generateProductTours&&(this.Qr=g.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!I(this.Zr)||t){var i=this._instance.persistence;if(i){var s=i.props[r8];if(I(s)&&!t)return this.Zr=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:t=>{var s=t.statusCode;if(200!==s||!t.json){var r="Product Tours API could not be loaded, status: "+s;return r6.error(r),void e([],{isLoaded:!1,error:r})}var n=I(t.json.product_tours)?t.json.product_tours:[];this.Zr=n,i&&i.register({[r8]:n}),e(n,{isLoaded:!0})}})}else e(this.Zr,{isLoaded:!0})}getActiveProductTours(e){j(this.Qr)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Qr.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.Qr)||t.showTourById(e)}previewTour(e){this.Qr?this.Qr.previewTour(e):this.G(()=>{var t;this.ts(),null==(t=this.Qr)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.Qr)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.Qr)||e.nextStep()}previousStep(){var e;null==(e=this.Qr)||e.previousStep()}clearCache(){var e;this.Zr=null,null==(e=this._instance.persistence)||e.unregister(r8)}resetTour(e){var t;null==(t=this.Qr)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.Qr)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.Qr)||t.cancelPendingTour(e)}}},{siteApps:class{constructor(e){this._instance=e,this.es=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}rs(e,t){if(t){var i=this.globalsForEvent(t);this.es.push(i),this.es.length>1e3&&(this.es=this.es.slice(10))}}get siteAppLoaders(){var e;return null==(e=g._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.rs.bind(this));this.ss=()=>{e(),this.es=[],this.ss=void 0}}}globalsForEvent(e){if(!e)throw Error("Event payload is required");var t,i,s,r,n,o,a,l={},c=this._instance.get_property("$groups")||[];for(var[u,h]of Object.entries(this._instance.get_property("$stored_group_properties")||{}))l[u]={id:c[u],type:u,properties:h};var{$set_once:d,$set:p}=e;return{event:y({},b(e,r4),{properties:y({},e.properties,p?{$set:y({},null!=(t=null==(i=e.properties)?void 0:i.$set)?t:{},p)}:{},d?{$set_once:y({},null!=(s=null==(r=e.properties)?void 0:r.$set_once)?s:{},d)}:{}),elements_chain:null!=(n=null==(o=e.properties)?void 0:o.$elements_chain)?n:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this.es.length&&(r7.info("Processing "+this.es.length+" events for site app with id "+e.id),this.es.forEach(e=>null==t.processEvent?void 0:t.processEvent(e)),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.ss)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,r7.info("Site app with id "+e.id+" "+(r?"loaded":"errored")),s&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback:e=>{r(e)}});n&&(t.processEvent=n),s=!0}catch(t){r7.error("Error while initializing PostHog app with config id "+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){r7.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}ns(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}os(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(t){r7.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,s,r=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.ns(),void this._instance.on("eventCaptured",e=>this.os(e))):void r7.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.ss)||i.call(this),null!=(s=e.siteApps)&&s.length)if(this.isEnabled){var n=function(e){var t;g["__$$ph_site_app_"+e]=r._instance,null==(t=g.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(r._instance,a,t=>{if(t)return r7.error("Error while initializing PostHog app with config id "+e,t)})};for(var{id:o,url:a}of e.siteApps)n(o)}else r7.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},{tracingHeaders:class{constructor(e){this.ls=void 0,this.us=void 0,this.Lr=()=>{var e,t;M(this.ls)&&(null==(e=g.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),M(this.us)&&(null==(t=g.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}G(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return rK.error("failed to load script",t);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.G(this.Lr):(null==(e=this.ls)||e.call(this),null==(t=this.us)||t.call(this),this.ls=void 0,this.us=void 0)}}},{surveys:class{constructor(e){this.hs=void 0,this._surveyManager=null,this.ds=!1,this.vs=[],this.cs=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(j(t))return s4.warn("Flags not loaded yet. Not loading surveys.");var i=I(t);this.hs=i?t.length>0:t,s4.info("flags response received, isSurveysEnabled: "+this.hs),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(s7)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.ds)s4.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)s4.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())s4.info("Not loading surveys in cookieless mode without consent.");else{var e=null==g?void 0:g.__PosthogExtensions__;if(e){if(!M(this.hs)||this._instance.config.advanced_enable_surveys){var t=this.hs||this._instance.config.advanced_enable_surveys;this.ds=!0;try{var i=e.generateSurveys;if(i)return void this.fs(i,t);var s=e.loadExternalDependency;if(!s)return void this.ps("PostHog loadExternalDependency extension not found.");s(this._instance,"surveys",i=>{i||!e.generateSurveys?this.ps("Could not load surveys script",i):this.fs(e.generateSurveys,t)})}catch(e){throw this.ps("Error initializing surveys",e),e}finally{this.ds=!1}}}else s4.error("PostHog Extensions not found.")}}fs(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new ni(this._instance),s4.info("Surveys loaded successfully"),this._s({isLoaded:!0})}ps(e,t){s4.error(e,t),this._s({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.vs.push(e),this._surveyManager&&this._s({isLoaded:!0}),()=>{this.vs=this.vs.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this._instance.config.disable_surveys)return s4.info("Disabled. Not loading surveys."),e([]);var i,s=this._instance.get_property(tB);if(s&&!t)return e(s,{isLoaded:!0});"undefined"!=typeof Promise&&this.cs?this.cs.then(t=>{var{surveys:i,context:s}=t;return e(i,s)}):("undefined"!=typeof Promise&&(this.cs=new Promise(e=>{i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:t=>{this.cs=null;var s=t.statusCode;if(200!==s||!t.json){var r="Surveys API could not be loaded, status: "+s;s4.error(r);var n={isLoaded:!1,error:r};return e([],n),void(null==i||i({surveys:[],context:n}))}var o,a,l=t.json.surveys||[],c=l.filter(e=>{var t,i;return!(!e.start_date||e.end_date)&&(!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)||!(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length))});c.length>0&&(null==(a=this._surveyEventReceiver)||a.register(c)),null==(o=this._instance.persistence)||o.register({[tB]:l});var u={isLoaded:!0};e(l,u),null==i||i({surveys:l,context:u})}}))}_s(e){for(var t of this.vs)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){s4.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!j(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);s4.warn("init was not called")}gs(e){var t=null;return this.getSurveys(i=>{var s;t=null!=(s=i.find(t=>t.id===e))?s:null}),t}bs(e){if(j(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t="string"==typeof e?this.gs(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(j(this._surveyManager))return s4.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.bs(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return j(this._surveyManager)?(s4.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(i=>{this.getSurveys(t=>{var s,r=null!=(s=t.find(t=>t.id===e))?s:null;if(r){var n=this.bs(r);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(j(this._surveyManager))s4.warn("init was not called");else{var r="string"==typeof e?this.gs(e):e;if(null!=r&&r.id)if(re.includes(r.type)){var n=null==c?void 0:c.querySelector(t);if(n)return null!=(s=r.appearance)&&s.surveyPopupDelaySeconds?(s4.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;s4.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,n,i),s4.info("Survey "+r.id+" rendered")},1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,i);s4.warn("Survey element not found")}else s4.warn("Surveys of type "+r.type+" cannot be rendered in the app");else s4.warn("Survey not found")}}displaySurvey(e,t){var i;if(j(this._surveyManager))s4.warn("init was not called");else{var s=this.gs(e);if(s){var r=s;if(null!=(i=s.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=y({},s,{appearance:y({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==i7.Popover&&t.initialResponses&&s4.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var n=this.canRenderSurvey(s);if(!n.visible)return void s4.warn("Survey is not eligible to be displayed: ",n.disabledReason)}t.displayType!==i7.Inline?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else s4.warn("Survey not found")}}cancelPendingSurvey(e){j(this._surveyManager)?s4.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},{toolbar:class{constructor(e){this.instance=e}ys(e){g.ph_toolbar_state=e}ws(){var e;return null!=(e=g.ph_toolbar_state)?e:no.UNINITIALIZED}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),tS(this.instance.config)||!s||!c)return!1;e=null!=e?e:s.location,i=null!=i?i:s.history;try{if(!t){try{s.localStorage.setItem("test","test"),s.localStorage.removeItem("test")}catch(e){return!1}t=null==s?void 0:s.localStorage}var r,n=ns||iC(e.hash,"__posthog")||iC(e.hash,"state"),o=n?ty(()=>JSON.parse(atob(decodeURIComponent(n))))||ty(()=>JSON.parse(decodeURIComponent(n))):null;return o&&"ph_authorize"===o.action?((r=o).source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(nr)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token)&&(this.loadToolbar(r),!0)}catch(e){return!1}}Es(e){var t=g.ph_load_toolbar||g.ph_load_editor;!j(t)&&C(t)?t(e,this.instance):nn.warn("No toolbar load function found")}loadToolbar(e){var t,i=!(null==c||!c.getElementById(t3));if(!s||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=y({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});return(s.localStorage.setItem(nr,JSON.stringify(y({},n,{source:void 0}))),this.ws()===no.LOADED)?this.Es(n):this.ws()===no.UNINITIALIZED&&(this.ys(no.LOADING),null==(t=g.__PosthogExtensions__)||null==t.loadExternalDependency||t.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return nn.error("[Toolbar] Failed to load",e),void this.ys(no.UNINITIALIZED);this.ys(no.LOADED),this.Es(n)}),tk(s,"turbolinks:load",()=>{this.ys(no.UNINITIALIZED),this.loadToolbar(n)})),!0}xs(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}},{experiments:nc},{conversations:class{constructor(e){this.Ss=void 0,this._conversationsManager=null,this.$s=!1,this.ks=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;j(t)||(q(t)?this.Ss=t:(this.Ss=t.enabled,this.ks=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Ss=void 0,this.ks=null}loadIfEnabled(){if(!(this._conversationsManager||this.$s||this._instance.config.disable_conversations||tS(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==g?void 0:g.__PosthogExtensions__;if(e&&!M(this.Ss)&&this.Ss)if(this.ks&&this.ks.token){this.$s=!0;try{var t=e.initConversations;if(t)return this.Ps(t),void(this.$s=!1);var i=e.loadExternalDependency;if(!i)return void this.Ts("PostHog loadExternalDependency extension not found.");i(this._instance,"conversations",t=>{t||!e.initConversations?this.Ts("Could not load conversations script",t):this.Ps(e.initConversations),this.$s=!1})}catch(e){this.Ts("Error initializing conversations",e),this.$s=!1}}else nu.error("Conversations enabled but missing token in remote config.")}}Ps(e){if(this.ks)try{this._conversationsManager=e(this.ks,this._instance),nu.info("Conversations loaded successfully")}catch(e){this.Ts("Error completing conversations initialization",e)}else nu.error("Cannot complete initialization: remote config is null")}Ts(e,t){nu.error(e,t),this._conversationsManager=null,this.$s=!1}show(){this._conversationsManager?this._conversationsManager.show():nu.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Ss&&!D(this._conversationsManager)}isVisible(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&e}sendMessage(e,t,i){var s=this;return m(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(nu.warn("Conversations not available yet."),null)})()}getMessages(e,t){var i=this;return m(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(nu.warn("Conversations not available yet."),null)})()}markAsRead(e){var t=this;return m(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(nu.warn("Conversations not available yet."),null)})()}getTickets(e){var t=this;return m(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(nu.warn("Conversations not available yet."),null)})()}requestRestoreLink(e){var t=this;return m(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(nu.warn("Conversations not available yet."),null)})()}restoreFromToken(e){var t=this;return m(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(nu.warn("Conversations not available yet."),null)})()}restoreFromUrlToken(){var e=this;return m(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(nu.warn("Conversations not available yet."),null)})()}getCurrentTicketId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())?e:null}getWidgetSessionId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())?e:null}}},{logs:class{constructor(e){var t;this.Rs=!1,this.Is=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.Rs=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,i=null==(t=e.logs)?void 0:t.captureConsoleLogs;!j(i)&&i&&(this.Rs=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Rs&&!this.Is){var e=tu("[logs]"),t=null==g?void 0:g.__PosthogExtensions__;if(t){var i=t.loadExternalDependency;i?i(this._instance,"logs",i=>{var s;i||null==(s=t.logs)||!s.initializeLogs?e.error("Could not load logs script",i):(t.logs.initializeLogs(this._instance),this.Is=!0)}):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}}});rp.__defaultExtensionClasses=y({},nh);var nd,np=(nd=rn[rl]=new rp,function(){function e(){e.done||(e.done=!0,rc=!1,tg(rn,function(e){e._dom_loaded()}))}null!=c&&c.addEventListener?"complete"===c.readyState?e():tk(c,"DOMContentLoaded",e,{capture:!1}):s&&tc.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),nd)}}]);
@@ -1,4 +1,4 @@
1
- import { r as visibleWidth, u as hasRootVersionAlias } from "./entry.js";
1
+ import { d as hasRootVersionAlias, i as visibleWidth } from "./entry.js";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import fs from "node:fs";
package/dist/entry.js CHANGED
@@ -1143,11 +1143,11 @@ if (!ensureExperimentalWarningSuppressed()) {
1143
1143
  const appliedProfile = applyCliProfileEnv({ profile: parsed.profile ?? void 0 });
1144
1144
  if (appliedProfile.warning) console.warn(`[denchclaw] ${appliedProfile.warning}`);
1145
1145
  process$1.argv = parsed.argv;
1146
- import("./run-main-B-QwRglo.js").then(({ runCli }) => runCli(process$1.argv)).catch((error) => {
1146
+ import("./run-main-CZ4r6_2T.js").then(({ runCli }) => runCli(process$1.argv)).then(() => import("./telemetry-Drjj3hin.js").then((n) => n.n).then(({ shutdownTelemetry }) => shutdownTelemetry())).catch((error) => {
1147
1147
  console.error("[denchclaw] Failed to start CLI:", error instanceof Error ? error.stack ?? error.message : error);
1148
1148
  process$1.exitCode = 1;
1149
1149
  });
1150
1150
  }
1151
1151
 
1152
1152
  //#endregion
1153
- export { normalizeWindowsArgv as a, hasFlag as c, applyCliProfileEnv as d, expandHomePrefix as f, defaultRuntime as i, hasHelpOrVersion as l, normalizeEnv as n, getCommandPath as o, resolveRequiredHomeDir as p, visibleWidth as r, getPrimaryCommand as s, isTruthyEnvValue as t, hasRootVersionAlias as u };
1153
+ export { defaultRuntime as a, getPrimaryCommand as c, hasRootVersionAlias as d, applyCliProfileEnv as f, visibleWidth as i, hasFlag as l, resolveRequiredHomeDir as m, normalizeEnv as n, normalizeWindowsArgv as o, expandHomePrefix as p, resolveStateDir as r, getCommandPath as s, isTruthyEnvValue as t, hasHelpOrVersion as u };
@@ -1,5 +1,6 @@
1
- import { c as hasFlag, d as applyCliProfileEnv, f as expandHomePrefix, i as defaultRuntime, p as resolveRequiredHomeDir, s as getPrimaryCommand, t as isTruthyEnvValue, u as hasRootVersionAlias } from "./entry.js";
2
- import { a as hasEmittedCliBanner, c as theme, i as formatCliBannerLine, n as resolveCliName, o as VERSION, s as isRich, t as replaceCliName } from "./cli-name-8WJ6gVD5.js";
1
+ import { a as readTelemetryConfig, i as markNoticeShown, o as writeTelemetryConfig, r as track, t as isTelemetryEnabled } from "./telemetry-Drjj3hin.js";
2
+ import { a as defaultRuntime, c as getPrimaryCommand, d as hasRootVersionAlias, f as applyCliProfileEnv, l as hasFlag, m as resolveRequiredHomeDir, p as expandHomePrefix, t as isTruthyEnvValue } from "./entry.js";
3
+ import { a as hasEmittedCliBanner, c as theme, i as formatCliBannerLine, n as resolveCliName, o as VERSION, s as isRich, t as replaceCliName } from "./cli-name-yhDyCrts.js";
3
4
  import { execFileSync, spawn } from "node:child_process";
4
5
  import process$1 from "node:process";
5
6
  import os from "node:os";
@@ -1712,6 +1713,14 @@ async function bootstrapCommand(opts, runtime = defaultRuntime) {
1712
1713
  const stateDir = resolveProfileStateDir(profile);
1713
1714
  const workspaceDir = resolveBootstrapWorkspaceDir(stateDir);
1714
1715
  if (appliedProfile.warning && !opts.json) runtime.log(theme.warn(appliedProfile.warning));
1716
+ const bootstrapStartTime = Date.now();
1717
+ track("cli_bootstrap_started", { version: VERSION });
1718
+ if (!opts.json) {
1719
+ if (!readTelemetryConfig().noticeShown) {
1720
+ runtime.log(theme.muted("DenchClaw collects anonymous telemetry to improve the product.\nNo personal data is ever collected. Disable anytime:\n denchclaw telemetry disable\n DENCHCLAW_TELEMETRY_DISABLED=1\n DO_NOT_TRACK=1\nLearn more: https://github.com/openclaw/openclaw/blob/main/TELEMETRY.md\n"));
1721
+ markNoticeShown();
1722
+ }
1723
+ }
1715
1724
  const installResult = await ensureOpenClawCliAvailable({
1716
1725
  stateDir,
1717
1726
  showProgress: !opts.json
@@ -1877,6 +1886,13 @@ async function bootstrapCommand(opts, runtime = defaultRuntime) {
1877
1886
  webOpened: opened,
1878
1887
  diagnostics
1879
1888
  };
1889
+ track("cli_bootstrap_completed", {
1890
+ duration_ms: Date.now() - bootstrapStartTime,
1891
+ workspace_created: Boolean(workspaceSeed),
1892
+ gateway_reachable: gatewayProbe.ok,
1893
+ web_reachable: webReachable,
1894
+ version: VERSION
1895
+ });
1880
1896
  if (opts.json) runtime.log(JSON.stringify(summary, null, 2));
1881
1897
  return summary;
1882
1898
  }
@@ -2221,6 +2237,30 @@ function registerStopCommand(program) {
2221
2237
  });
2222
2238
  }
2223
2239
 
2240
+ //#endregion
2241
+ //#region src/cli/program/register.telemetry.ts
2242
+ function registerTelemetryCommand(program) {
2243
+ const cmd = program.command("telemetry").description("Manage anonymous telemetry for DenchClaw");
2244
+ cmd.command("status").description("Show current telemetry status").action(() => {
2245
+ const config = readTelemetryConfig();
2246
+ const envDisabled = process.env.DO_NOT_TRACK === "1" || process.env.DENCHCLAW_TELEMETRY_DISABLED === "1" || Boolean(process.env.CI);
2247
+ const effective = isTelemetryEnabled();
2248
+ console.log(`Telemetry config: ${config.enabled ? "enabled" : "disabled"}`);
2249
+ if (envDisabled) console.log("Environment override: disabled (DO_NOT_TRACK, DENCHCLAW_TELEMETRY_DISABLED, or CI)");
2250
+ console.log(`Effective status: ${effective ? "enabled" : "disabled"}`);
2251
+ console.log("\nLearn more: https://github.com/openclaw/openclaw/blob/main/TELEMETRY.md");
2252
+ });
2253
+ cmd.command("disable").description("Disable anonymous telemetry").action(() => {
2254
+ writeTelemetryConfig({ enabled: false });
2255
+ console.log("Telemetry has been disabled.");
2256
+ console.log("You can re-enable it anytime with: denchclaw telemetry enable");
2257
+ });
2258
+ cmd.command("enable").description("Enable anonymous telemetry").action(() => {
2259
+ writeTelemetryConfig({ enabled: true });
2260
+ console.log("Telemetry has been enabled. Thank you for helping improve DenchClaw!");
2261
+ });
2262
+ }
2263
+
2224
2264
  //#endregion
2225
2265
  //#region src/cli/program/register.update.ts
2226
2266
  function registerUpdateCommand(program) {
@@ -2267,6 +2307,13 @@ const CORE_CLI_ENTRIES = [
2267
2307
  register: ({ program }) => {
2268
2308
  registerStartCommand(program);
2269
2309
  }
2310
+ },
2311
+ {
2312
+ name: "telemetry",
2313
+ description: "Manage anonymous telemetry",
2314
+ register: ({ program }) => {
2315
+ registerTelemetryCommand(program);
2316
+ }
2270
2317
  }
2271
2318
  ];
2272
2319
  const CORE_CLI_ENTRY_BY_NAME = new Map(CORE_CLI_ENTRIES.map((entry) => [entry.name, entry]));
@@ -1,5 +1,5 @@
1
- import { a as normalizeWindowsArgv, l as hasHelpOrVersion, n as normalizeEnv, o as getCommandPath, s as getPrimaryCommand, t as isTruthyEnvValue } from "./entry.js";
2
- import { n as resolveCliName, o as VERSION, r as emitCliBanner } from "./cli-name-8WJ6gVD5.js";
1
+ import { c as getPrimaryCommand, n as normalizeEnv, o as normalizeWindowsArgv, s as getCommandPath, t as isTruthyEnvValue, u as hasHelpOrVersion } from "./entry.js";
2
+ import { n as resolveCliName, o as VERSION, r as emitCliBanner } from "./cli-name-yhDyCrts.js";
3
3
  import { spawn } from "node:child_process";
4
4
  import process$1 from "node:process";
5
5
  import os from "node:os";
@@ -219,7 +219,7 @@ async function runCli(argv = process$1.argv) {
219
219
  process$1.exitCode = await delegateToGlobalOpenClaw(parseArgv);
220
220
  return;
221
221
  }
222
- const { buildProgram } = await import("./program-DSR-Zphq.js");
222
+ const { buildProgram } = await import("./program-BjjW6tCn.js");
223
223
  await buildProgram().parseAsync(parseArgv);
224
224
  }
225
225