@claudeye/linux-arm64 1.0.9 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/assets/standalone/.next/BUILD_ID +1 -1
  2. package/assets/standalone/.next/build-manifest.json +5 -5
  3. package/assets/standalone/.next/prerender-manifest.json +3 -3
  4. package/assets/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
  5. package/assets/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  6. package/assets/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  7. package/assets/standalone/.next/server/app/_global-error.html +1 -1
  8. package/assets/standalone/.next/server/app/_global-error.rsc +7 -7
  9. package/assets/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  10. package/assets/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  11. package/assets/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
  12. package/assets/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  13. package/assets/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/assets/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
  15. package/assets/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  16. package/assets/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  17. package/assets/standalone/.next/server/app/_not-found.html +2 -2
  18. package/assets/standalone/.next/server/app/_not-found.rsc +15 -15
  19. package/assets/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
  20. package/assets/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  21. package/assets/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
  22. package/assets/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  23. package/assets/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  24. package/assets/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  25. package/assets/standalone/.next/server/app/dashboard/[viewName]/page/build-manifest.json +2 -2
  26. package/assets/standalone/.next/server/app/dashboard/[viewName]/page/server-reference-manifest.json +5 -5
  27. package/assets/standalone/.next/server/app/dashboard/[viewName]/page_client-reference-manifest.js +1 -1
  28. package/assets/standalone/.next/server/app/dashboard/page/build-manifest.json +2 -2
  29. package/assets/standalone/.next/server/app/dashboard/page/server-reference-manifest.json +5 -5
  30. package/assets/standalone/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
  31. package/assets/standalone/.next/server/app/index.html +1 -1
  32. package/assets/standalone/.next/server/app/index.rsc +15 -15
  33. package/assets/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  34. package/assets/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
  35. package/assets/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
  36. package/assets/standalone/.next/server/app/index.segments/_index.segment.rsc +10 -10
  37. package/assets/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  38. package/assets/standalone/.next/server/app/login/page/build-manifest.json +2 -2
  39. package/assets/standalone/.next/server/app/login/page/server-reference-manifest.json +3 -3
  40. package/assets/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  41. package/assets/standalone/.next/server/app/login.html +2 -2
  42. package/assets/standalone/.next/server/app/login.rsc +17 -17
  43. package/assets/standalone/.next/server/app/login.segments/_full.segment.rsc +17 -17
  44. package/assets/standalone/.next/server/app/login.segments/_head.segment.rsc +4 -4
  45. package/assets/standalone/.next/server/app/login.segments/_index.segment.rsc +10 -10
  46. package/assets/standalone/.next/server/app/login.segments/_tree.segment.rsc +1 -1
  47. package/assets/standalone/.next/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
  48. package/assets/standalone/.next/server/app/login.segments/login.segment.rsc +3 -3
  49. package/assets/standalone/.next/server/app/page/build-manifest.json +2 -2
  50. package/assets/standalone/.next/server/app/page/server-reference-manifest.json +2 -2
  51. package/assets/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  52. package/assets/standalone/.next/server/app/policies/page/build-manifest.json +2 -2
  53. package/assets/standalone/.next/server/app/policies/page/server-reference-manifest.json +9 -9
  54. package/assets/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  55. package/assets/standalone/.next/server/app/project/[name]/page/build-manifest.json +2 -2
  56. package/assets/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +2 -2
  57. package/assets/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  58. package/assets/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +2 -2
  59. package/assets/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  60. package/assets/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +10 -10
  61. package/assets/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  62. package/assets/standalone/.next/server/app/projects/page/build-manifest.json +2 -2
  63. package/assets/standalone/.next/server/app/projects/page/server-reference-manifest.json +2 -2
  64. package/assets/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  65. package/assets/standalone/.next/server/app/queue/page/build-manifest.json +2 -2
  66. package/assets/standalone/.next/server/app/queue/page/server-reference-manifest.json +4 -4
  67. package/assets/standalone/.next/server/app/queue/page_client-reference-manifest.js +1 -1
  68. package/assets/standalone/.next/server/chunks/[root-of-the-server]__0.lwwrp._.js +1 -1
  69. package/assets/standalone/.next/server/chunks/[root-of-the-server]__0f_5ws6._.js +1 -1
  70. package/assets/standalone/.next/server/chunks/[root-of-the-server]__0g72weg._.js +1 -1
  71. package/assets/standalone/.next/server/chunks/[root-of-the-server]__0rtkhr~._.js +1 -1
  72. package/assets/standalone/.next/server/chunks/[root-of-the-server]__0tlbu6c._.js +1 -1
  73. package/assets/standalone/.next/server/chunks/[root-of-the-server]__0vfmej5._.js +2 -2
  74. package/assets/standalone/.next/server/chunks/_0aylu-q._.js +1 -1
  75. package/assets/standalone/.next/server/chunks/_0lq2_wn._.js +2 -2
  76. package/assets/standalone/.next/server/chunks/_0oqawqx._.js +2 -2
  77. package/assets/standalone/.next/server/chunks/_0vt409y._.js +1 -1
  78. package/assets/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0bdfoky.js +1 -1
  79. package/assets/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0l15kkr.js +1 -1
  80. package/assets/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_00~~2w9._.js +1 -1
  81. package/assets/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_05pz9._._.js +1 -1
  82. package/assets/standalone/.next/server/chunks/package_json_[json]_cjs_0z7w.hh._.js +1 -1
  83. package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__0-_oq51._.js +1 -1
  84. package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__0-wbic0._.js +1 -1
  85. package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__04qo1w2._.js +1 -1
  86. package/assets/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0-9w~bh._.js → [root-of-the-server]__07vr-m8._.js} +2 -2
  87. package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__09y6src._.js +1 -1
  88. package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__09y7ni.._.js +1 -1
  89. package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__0bubgf_._.js +1 -1
  90. package/assets/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0f7wkrr._.js → [root-of-the-server]__0hzootc._.js} +2 -2
  91. package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__0m0x9dt._.js +1 -1
  92. package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__0pw0g9c._.js +1 -1
  93. package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rm4qtt._.js +1 -1
  94. package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__0spfsp5._.js +1 -1
  95. package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__0x7-awk._.js +1 -1
  96. package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__0zva2n_._.js +1 -1
  97. package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__1370kzv._.js +1 -1
  98. package/assets/standalone/.next/server/chunks/ssr/_01fj_8s._.js +1 -1
  99. package/assets/standalone/.next/server/chunks/ssr/_04.u7zx._.js +1 -1
  100. package/assets/standalone/.next/server/chunks/ssr/_06383ya._.js +1 -1
  101. package/assets/standalone/.next/server/chunks/ssr/_06nq9qk._.js +1 -1
  102. package/assets/standalone/.next/server/chunks/ssr/_0i~.gk_._.js +1 -1
  103. package/assets/standalone/.next/server/chunks/ssr/_0kfjwwu._.js +1 -1
  104. package/assets/standalone/.next/server/chunks/ssr/_0km.fsf._.js +1 -1
  105. package/assets/standalone/.next/server/chunks/ssr/_0rr.uoo._.js +3 -3
  106. package/assets/standalone/.next/server/chunks/ssr/_0x26hbi._.js +1 -1
  107. package/assets/standalone/.next/server/chunks/ssr/_0xg44oj._.js +1 -1
  108. package/assets/standalone/.next/server/chunks/ssr/_11ou~_x._.js +1 -1
  109. package/assets/standalone/.next/server/chunks/ssr/_1207ol.._.js +1 -1
  110. package/assets/standalone/.next/server/chunks/ssr/app_04qfs8z._.js +1 -1
  111. package/assets/standalone/.next/server/chunks/ssr/app_05evmdg._.js +1 -1
  112. package/assets/standalone/.next/server/chunks/ssr/app_07izk21._.js +1 -1
  113. package/assets/standalone/.next/server/chunks/ssr/app_0uosk1e._.js +1 -1
  114. package/assets/standalone/.next/server/chunks/ssr/app_13f0ohr._.js +1 -1
  115. package/assets/standalone/.next/server/chunks/ssr/app_actions_compute-dashboard_ts_13cb_9d._.js +1 -1
  116. package/assets/standalone/.next/server/chunks/ssr/app_global-error_tsx_0xerkr6._.js +1 -1
  117. package/assets/standalone/.next/server/chunks/ssr/app_login_page_tsx_0z71ad3._.js +1 -1
  118. package/assets/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_0q-m0y-._.js +1 -1
  119. package/assets/standalone/.next/server/chunks/ssr/app_queue_queue-client_tsx_0c0olxv._.js +1 -1
  120. package/assets/standalone/.next/server/chunks/ssr/node_modules_next_0rd0oc-._.js +2 -2
  121. package/assets/standalone/.next/server/chunks/ssr/node_modules_next_dist_0h9llsw._.js +2 -2
  122. package/assets/standalone/.next/server/chunks/ssr/node_modules_next_dist_0~3yv~8._.js +1 -1
  123. package/assets/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0mebn66._.js +1 -1
  124. package/assets/standalone/.next/server/middleware-build-manifest.js +5 -5
  125. package/assets/standalone/.next/server/pages/404.html +2 -2
  126. package/assets/standalone/.next/server/pages/500.html +1 -1
  127. package/assets/standalone/.next/server/server-reference-manifest.js +1 -1
  128. package/assets/standalone/.next/server/server-reference-manifest.json +23 -23
  129. package/assets/standalone/.next/static/chunks/{0u95dh6lcl7tm.js → 031pa5~qfzt~_.js} +1 -1
  130. package/assets/standalone/.next/static/chunks/{0r33ook0mzjdp.js → 053fkn7ps6kaz.js} +2 -2
  131. package/assets/standalone/.next/static/chunks/{0r-uj~~hfjn~d.js → 0c7lqtrcy3f9..js} +1 -1
  132. package/assets/standalone/.next/static/chunks/{0tdv9t00~jli0.js → 0dxnepassa~ef.js} +1 -1
  133. package/assets/standalone/.next/static/chunks/{0.llxyobdk9ao.js → 0s3ccto17p65b.js} +1 -1
  134. package/assets/standalone/.next/static/chunks/{0eozapv72nxu9.js → 0su8rjooh3ypl.js} +1 -1
  135. package/assets/standalone/.next/static/chunks/{0yby34zxp~u9y.js → 0t9elhfl1ut1l.js} +1 -1
  136. package/assets/standalone/.next/static/chunks/{041yg1qijsts_.js → 0uii3kvke.3a6.js} +1 -1
  137. package/assets/standalone/.next/static/chunks/{01z1mkd0jlg01.js → 0wbz7205d6p7w.js} +1 -1
  138. package/assets/standalone/.next/static/chunks/{013e6ucdn~oej.js → 0xtj0hdw6ymaw.js} +1 -1
  139. package/assets/standalone/.next/static/chunks/{01i5gpaes1u49.js → 0z1t1-lgk7n30.js} +1 -1
  140. package/assets/standalone/.next/static/chunks/turbopack-0uc5y~g6h.n7-.js +1 -0
  141. package/assets/standalone/README.md +17 -2643
  142. package/assets/standalone/node_modules/@next/env/package.json +1 -1
  143. package/assets/standalone/node_modules/next/dist/build/swc/index.js +1 -1
  144. package/assets/standalone/node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +2 -2
  145. package/assets/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
  146. package/assets/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +3 -3
  147. package/assets/standalone/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.js +80 -0
  148. package/assets/standalone/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.js +24 -20
  149. package/assets/standalone/node_modules/next/dist/server/config-schema.js +1 -0
  150. package/assets/standalone/node_modules/next/dist/server/config.js +1 -1
  151. package/assets/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +13 -16
  152. package/assets/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1 -1
  153. package/assets/standalone/node_modules/next/dist/server/lib/app-info-log.js +1 -1
  154. package/assets/standalone/node_modules/next/dist/server/lib/router-server.js +14 -1
  155. package/assets/standalone/node_modules/next/dist/server/lib/start-server.js +1 -1
  156. package/assets/standalone/node_modules/next/dist/server/route-modules/app-route/module.js +25 -10
  157. package/assets/standalone/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +1 -1
  158. package/assets/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
  159. package/assets/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
  160. package/assets/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
  161. package/assets/standalone/node_modules/next/package.json +15 -15
  162. package/assets/standalone/package.json +5 -5
  163. package/bin/claudeye +0 -0
  164. package/package.json +2 -2
  165. package/assets/standalone/.next/static/chunks/turbopack-0.w3uhj.ln7pt.js +0 -1
  166. /package/assets/standalone/.next/static/{T2uFRf42cIG4zxcRtc0qK → gYWWFmr61HWYw5tmB9lVi}/_buildManifest.js +0 -0
  167. /package/assets/standalone/.next/static/{T2uFRf42cIG4zxcRtc0qK → gYWWFmr61HWYw5tmB9lVi}/_clientMiddlewareManifest.js +0 -0
  168. /package/assets/standalone/.next/static/{T2uFRf42cIG4zxcRtc0qK → gYWWFmr61HWYw5tmB9lVi}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[28864,e=>{"use strict";let t,r,i,s,a;var n,o=e.i(14747);function l(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}let u=e=>void 0===e?void 0:e.variant??e.enabled,c=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch{return e}};async function h(e,t=!0){try{let t=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return await new Response(t).blob()}catch(e){return t&&console.error("Failed to gzip compress data",e),null}}let d="0123456789abcdef";class g{constructor(e){this.bytes=e}static ofInner(e){if(16===e.length)return new g(e);throw TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||e<0||t<0||r<0||i<0||e>0xffffffffffff||t>4095||r>0x3fffffff||i>0xffffffff)throw RangeError("invalid field value");let s=new Uint8Array(16);return s[0]=e/0x10000000000,s[1]=e/0x100000000,s[2]=e/0x1000000,s[3]=e/65536,s[4]=e/256,s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new g(s)}static parse(e){let t;switch(e.length){case 32:t=/^[0-9a-f]{32}$/i.exec(e)?.[0];break;case 36:t=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e)?.slice(1,6).join("");break;case 38:t=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(e)?.slice(1,6).join("");break;case 45:t=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e)?.slice(1,6).join("")}if(t){let e=new Uint8Array(16);for(let r=0;r<16;r+=4){let i=parseInt(t.substring(2*r,2*r+8),16);e[r+0]=i>>>24,e[r+1]=i>>>16,e[r+2]=i>>>8,e[r+3]=i}return new g(e)}throw SyntaxError("could not parse UUID string")}toString(){let e="";for(let t=0;t<this.bytes.length;t++)e+=d.charAt(this.bytes[t]>>>4),e+=d.charAt(15&this.bytes[t]),(3===t||5===t||7===t||9===t)&&(e+="-");return e}toHex(){let e="";for(let t=0;t<this.bytes.length;t++)e+=d.charAt(this.bytes[t]>>>4),e+=d.charAt(15&this.bytes[t]);return e}toJSON(){return this.toString()}getVariant(){let e=this.bytes[8]>>>4;if(e<0)throw Error("unreachable");if(e<=7)return this.bytes.every(e=>0===e)?"NIL":"VAR_0";if(e<=11)return"VAR_10";if(e<=13)return"VAR_110";if(e<=15)return this.bytes.every(e=>255===e)?"MAX":"VAR_RESERVED";throw Error("unreachable")}getVersion(){return"VAR_10"===this.getVariant()?this.bytes[6]>>>4:void 0}clone(){return new g(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(let t=0;t<16;t++){let r=this.bytes[t]-e.bytes[t];if(0!==r)return Math.sign(r)}return 0}}class p{constructor(e){this.timestamp=0,this.counter=0,this.random=e??f()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(e,t){let r=this.generateOrAbortCore(e,t);return void 0===r&&(this.timestamp=0,r=this.generateOrAbortCore(e,t)),r}generateOrAbortCore(e,t){if(!Number.isInteger(e)||e<1||e>0xffffffffffff)throw RangeError("`unixTsMs` must be a 48-bit positive integer");if(t<0||t>0xffffffffffff)throw RangeError("`rollbackAllowance` out of reasonable range");if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+t>=this.timestamp))return;this.counter++,this.counter>0x3ffffffffff&&(this.timestamp++,this.resetCounter())}return g.fromFieldsV7(this.timestamp,Math.trunc(this.counter/0x40000000),this.counter&0x40000000-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}generateV4(){let e=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return e[6]=64|e[6]>>>4,e[8]=128|e[8]>>>2,g.ofInner(e)}}let f=()=>({nextUint32:()=>65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random())}),y=()=>(t||(t=new p)).generate();var m=((n={}).AnonymousId="anonymous_id",n.DistinctId="distinct_id",n.Props="props",n.EnablePersonProcessing="enable_person_processing",n.PersonMode="person_mode",n.FeatureFlagDetails="feature_flag_details",n.FeatureFlags="feature_flags",n.FeatureFlagPayloads="feature_flag_payloads",n.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",n.BootstrapFeatureFlags="bootstrap_feature_flags",n.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",n.OverrideFeatureFlags="override_feature_flags",n.Queue="queue",n.OptedOut="opted_out",n.SessionId="session_id",n.SessionStartTimestamp="session_start_timestamp",n.SessionLastTimestamp="session_timestamp",n.PersonProperties="person_properties",n.GroupProperties="group_properties",n.InstalledAppBuild="installed_app_build",n.InstalledAppVersion="installed_app_version",n.SessionReplay="session_replay",n.SurveyLastSeenDate="survey_last_seen_date",n.SurveysSeen="surveys_seen",n.Surveys="surveys",n.RemoteConfig="remote_config",n.FlagsEndpointWasHit="flags_endpoint_was_hit",n);let v={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",TIMEOUT:"timeout",CONNECTION_ERROR:"connection_error",UNKNOWN_ERROR:"unknown_error",apiError:e=>`api_error_${e}`},b=Array.isArray,_=Object.prototype;_.hasOwnProperty;let w=_.toString,E=b||function(e){return"[object Array]"===w.call(e)},F=e=>"[object String]"==w.call(e);function P(e){return null===e||"object"!=typeof e}function x(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function S(e){return"u">typeof Event&&function(e,t){try{return e instanceof t}catch{return!1}}(e,Event)}let k="Android",C="BlackBerry",I="Nintendo",$="PlayStation",O="Xbox",A="Windows",R="(\\d+(\\.\\d+)?)";RegExp("Version/"+R),RegExp(O,"i"),RegExp($+" \\w+","i"),RegExp(I+" \\w+","i"),RegExp(C+"|PlayBook|BB10","i");async function T(e,t){let r=null;for(let i=0;i<t.retryCount+1;i++){i>0&&await new Promise(e=>setTimeout(e,t.retryDelay));try{return await e()}catch(e){if(r=e,!t.retryCheck(e))throw e}}throw r}function L(){return new Date().toISOString()}function M(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}RegExp("rv:"+R),RegExp("Edge?\\/"+R),RegExp("(Chrome|CrMo)\\/"+R),RegExp("CriOS\\/"+R),RegExp("(UCBrowser|UCWEB)\\/"+R),RegExp("(Opera|OPR)\\/"+R),RegExp("Firefox\\/"+R),RegExp("FxiOS\\/"+R),RegExp("Konqueror[:/]?"+R,"i"),RegExp(C+" "+R),RegExp("android\\s"+R,"i"),RegExp("SamsungBrowser\\/"+R),RegExp("(rv:|MSIE )"+R),RegExp("rv:"+R),RegExp(O+"; "+O+" (.*?)[);]","i"),RegExp(I,"i"),RegExp($,"i"),RegExp(A,"i"),RegExp("("+k+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+k+")","i");let j=e=>e instanceof Error;function D(e){return Promise.all(e.map(e=>(e??Promise.resolve()).then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))))}class U{constructor(){this.events={},this.events={}}on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter(e=>e!==t)}}emit(e,t){for(let r of this.events[e]||[])r(t);for(let r of this.events["*"]||[])r(e,t)}}class B{add(e){let t=y().toString();return this.promiseByIds[t]=e,e.catch(()=>{}).finally(()=>{delete this.promiseByIds[t]}),e}async join(){let e=Object.values(this.promiseByIds),t=e.length;for(;t>0;)await Promise.all(e),t=(e=Object.values(this.promiseByIds)).length}get length(){return Object.keys(this.promiseByIds).length}constructor(){this.promiseByIds={}}}let q=(e,t,r)=>{function i(s,...a){t(()=>{(0,r[s])(e,...a)})}return{info:(...e)=>{i("log",...e)},warn:(...e)=>{i("warn",...e)},error:(...e)=>{i("error",...e)},critical:(...t)=>{r.error(e,...t)},createLogger:i=>q(`${e} ${i}`,t,r)}};class H extends Error{constructor(e,t){super("HTTP error while fetching PostHog: status="+e.status+", reqByteLength="+t),this.response=e,this.reqByteLength=t,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}}class N extends Error{constructor(e){super("Network error while fetching PostHog",e instanceof Error?{cause:e}:{}),this.error=e,this.name="PostHogFetchNetworkError"}}async function G(e){if(e instanceof H){let t="";try{t=await e.text}catch{}console.error(`Error while flushing PostHog: message=${e.message}, response body=${t}`,e)}else console.error("Error while flushing PostHog",e);return Promise.resolve()}function z(e){return"object"==typeof e&&(e instanceof H||e instanceof N)}function W(e){return"object"==typeof e&&e instanceof H&&413===e.status}class K{constructor(e,t={}){this.flushPromise=null,this.shutdownPromise=null,this.promiseQueue=new B,this._events=new U,this._isInitialized=!1,function(e,t){if(!e||"string"!=typeof e||0===e.trim().length)throw Error(t)}(e,"You must pass your PostHog project's api key."),this.apiKey=e,this.host=function(e){return e?.replace(/\/+$/,"")}(t.host||"https://us.i.posthog.com"),this.flushAt=t.flushAt?Math.max(t.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,t.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,t.maxQueueSize??1e3),this.flushInterval=t.flushInterval??1e4,this.preloadFeatureFlags=t.preloadFeatureFlags??!0,this.defaultOptIn=t.defaultOptIn??!0,this.disableSurveys=t.disableSurveys??!1,this._retryOptions={retryCount:t.fetchRetryCount??3,retryDelay:t.fetchRetryDelay??3e3,retryCheck:z},this.requestTimeout=t.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=t.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=t.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=t.disableGeoip??!0,this.disabled=t.disabled??!1,this.historicalMigration=t?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0,this._logger=function(e,t=e=>e()){return q(e,t,function(e=console){return{log:e.log.bind(e),warn:e.warn.bind(e),error:e.error.bind(e),debug:e.debug.bind(e)}}())}("[PostHog]",this.logMsgIfDebug.bind(this)),this.evaluationContexts=t?.evaluationContexts??t?.evaluationEnvironments,t?.evaluationEnvironments&&!t?.evaluationContexts&&this._logger.warn("evaluationEnvironments is deprecated. Use evaluationContexts instead. This property will be removed in a future version."),this.disableCompression=!("CompressionStream"in globalThis)||(t?.disableCompression??!1)}logMsgIfDebug(e){this.isDebug&&e()}wrap(e){return this.disabled?void this._logger.warn("The client is disabled"):this._isInitialized?e():void this._initPromise.then(()=>e())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(m.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(m.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(m.OptedOut,!0)})}on(e,t){return this._events.on(e,t)}debug(e=!0){if(this.removeDebugCallback?.(),e){let e=this.on("*",(e,t)=>this._logger.info(e,t));this.removeDebugCallback=()=>{e(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(e){return{distinct_id:e.distinct_id,event:e.event,properties:{...e.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(e){return this.promiseQueue.add(e)}identifyStateless(e,t,r){this.wrap(()=>{let i={...this.buildPayload({distinct_id:e,event:"$identify",properties:t})};this.enqueue("identify",i,r)})}async identifyStatelessImmediate(e,t,r){let i={...this.buildPayload({distinct_id:e,event:"$identify",properties:t})};await this.sendImmediate("identify",i,r)}captureStateless(e,t,r,i){this.wrap(()=>{let s=this.buildPayload({distinct_id:e,event:t,properties:r});this.enqueue("capture",s,i)})}async captureStatelessImmediate(e,t,r,i){let s=this.buildPayload({distinct_id:e,event:t,properties:r});await this.sendImmediate("capture",s,i)}aliasStateless(e,t,r,i){this.wrap(()=>{let s=this.buildPayload({event:"$create_alias",distinct_id:t,properties:{...r||{},distinct_id:t,alias:e}});this.enqueue("alias",s,i)})}async aliasStatelessImmediate(e,t,r,i){let s=this.buildPayload({event:"$create_alias",distinct_id:t,properties:{...r||{},distinct_id:t,alias:e}});await this.sendImmediate("alias",s,i)}groupIdentifyStateless(e,t,r,i,s,a){this.wrap(()=>{let n=this.buildPayload({distinct_id:s||`$${e}_${t}`,event:"$groupidentify",properties:{$group_type:e,$group_key:t,$group_set:r||{},...a||{}}});this.enqueue("capture",n,i)})}async getRemoteConfig(){await this._initPromise;let e=this.host;"https://us.i.posthog.com"===e?e="https://us-assets.i.posthog.com":"https://eu.i.posthog.com"===e&&(e="https://eu-assets.i.posthog.com");let t=`${e}/array/${this.apiKey}/config`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(t,r,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(e=>e.json()).catch(e=>{this._logger.error("Remote config could not be loaded",e),this._events.emit("error",e)})}async getFlags(e,t={},r={},i={},s={},a=!1){await this._initPromise;let n=`${this.host}/flags/?v=2${a?"&config=true":""}`,o={token:this.apiKey,distinct_id:e,groups:t,person_properties:r,group_properties:i,...s};this.evaluationContexts&&this.evaluationContexts.length>0&&(o.evaluation_contexts=this.evaluationContexts);let l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify(o)};return this._logger.info("Flags URL",n),this.fetchWithRetry(n,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(e=>e.json()).then(e=>({success:!0,response:(e=>{if("flags"in e){let t,r=Object.fromEntries(Object.entries(e.flags??{}).map(([e,t])=>[e,u(t)]).filter(([,e])=>void 0!==e)),i=Object.fromEntries(Object.keys(t=e.flags??{}).filter(e=>{let r=t[e];return r.enabled&&r.metadata&&void 0!==r.metadata.payload}).map(e=>{let r=t[e].metadata?.payload;return[e,r?c(r):void 0]}));return{...e,featureFlags:r,featureFlagPayloads:i}}{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([e,t])=>[e,c(t)])),i=Object.fromEntries(Object.entries(t).map(([e,t])=>{var i,s;return[e,{key:e,enabled:"string"==typeof(i=t)||i,variant:"string"==typeof i?i:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:(s=r[e])?JSON.stringify(s):void 0,description:void 0}}]}));return{...e,featureFlags:t,featureFlagPayloads:r,flags:i}}})(e)})).catch(e=>(this._events.emit("error",e),{success:!1,error:this.categorizeRequestError(e)}))}categorizeRequestError(e){if(e instanceof H)return{type:"api_error",statusCode:e.status};if(e instanceof N){let t=e.error;return t instanceof Error&&("AbortError"===t.name||"TimeoutError"===t.name)?{type:"timeout"}:{type:"connection_error"}}return{type:"unknown_error"}}async getFeatureFlagStateless(e,t,r={},i={},s={},a){await this._initPromise;let n=await this.getFeatureFlagDetailStateless(e,t,r,i,s,a);if(void 0===n)return{response:void 0,requestId:void 0};let o=u(n.response);return void 0===o&&(o=!1),{response:o,requestId:n.requestId}}async getFeatureFlagDetailStateless(e,t,r={},i={},s={},a){await this._initPromise;let n=await this.getFeatureFlagDetailsStateless(t,r,i,s,a,[e]);if(void 0!==n)return{response:n.flags[e],requestId:n.requestId,evaluatedAt:n.evaluatedAt}}async getFeatureFlagPayloadStateless(e,t,r={},i={},s={},a){await this._initPromise;let n=await this.getFeatureFlagPayloadsStateless(t,r,i,s,a,[e]);if(!n)return;let o=n[e];return void 0===o?null:o}async getFeatureFlagPayloadsStateless(e,t={},r={},i={},s,a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(e,t,r,i,s,a)).payloads}async getFeatureFlagsStateless(e,t={},r={},i={},s,a){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(e,t,r,i,s,a)}async getFeatureFlagsAndPayloadsStateless(e,t={},r={},i={},s,a){await this._initPromise;let n=await this.getFeatureFlagDetailsStateless(e,t,r,i,s,a);return n?{flags:n.featureFlags,payloads:n.featureFlagPayloads,requestId:n.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(e,t={},r={},i={},s,a){await this._initPromise;let n={};(s??this.disableGeoip)&&(n.geoip_disable=!0),a&&(n.flag_keys_to_evaluate=a);let o=await this.getFlags(e,t,r,i,n);if(!o.success)return;let l=o.response;return(l.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),l.quotaLimited?.includes("feature_flags"))?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:l?.requestId,quotaLimited:l.quotaLimited}):l}async getSurveysStateless(){if(await this._initPromise,!0===this.disableSurveys)return this._logger.info("Loading surveys is disabled."),[];let e=`${this.host}/api/surveys/?token=${this.apiKey}`,t={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},r=await this.fetchWithRetry(e,t).then(e=>{if(200!==e.status||!e.json){let t=`Surveys API could not be loaded: ${e.status}`,r=Error(t);this._logger.error(r),this._events.emit("error",Error(t));return}return e.json()}).catch(e=>{this._logger.error("Surveys API could not be loaded",e),this._events.emit("error",e)}),i=r?.surveys;return i&&this._logger.info("Surveys fetched from API: ",JSON.stringify(i)),i??[]}get props(){return this._props||(this._props=this.getPersistedProperty(m.Props)),this._props||{}}set props(e){this._props=e}async register(e){this.wrap(()=>{this.props={...this.props,...e},this.setPersistedProperty(m.Props,this.props)})}async unregister(e){this.wrap(()=>{delete this.props[e],this.setPersistedProperty(m.Props,this.props)})}processBeforeEnqueue(e){return e}async flushStorage(){}enqueue(e,t,r){this.wrap(()=>{if(this.optedOut)return void this._events.emit(e,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(e,t,r);if(null===(i=this.processBeforeEnqueue(i)))return;let s=this.getPersistedProperty(m.Queue)||[];s.length>=this.maxQueueSize&&(s.shift(),this._logger.info("Queue is full, the oldest event is dropped.")),s.push({message:i}),this.setPersistedProperty(m.Queue,s),this._events.emit(e,i),s.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=M(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(e,t,r){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized||await this._initPromise,this.optedOut)return void this._events.emit(e,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(e,t,r);if(null===(i=this.processBeforeEnqueue(i)))return;let s={api_key:this.apiKey,batch:[i],sent_at:L()};this.historicalMigration&&(s.historical_migration=!0);let a=JSON.stringify(s),n=`${this.host}/batch/`,o=this.disableCompression?null:await h(a,this.isDebug),l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...null!==o&&{"Content-Encoding":"gzip"}},body:o||a};try{await this.fetchWithRetry(n,l)}catch(e){this._events.emit("error",e)}}prepareMessage(e,t,r){let i={...t,type:e,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:r?.timestamp?r?.timestamp:L(),uuid:r?.uuid?r.uuid:y().toString()};return(r?.disableGeoip??this.disableGeoip)&&(i.properties||(i.properties={}),i.properties.$geoip_disable=!0),i.distinctId&&(i.distinct_id=i.distinctId,delete i.distinctId),i}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async e=>{await G(e)})}async flush(){let e=D([this.flushPromise]).then(()=>this._flush());return this.flushPromise=e,this.addPendingPromise(e),D([e]).then(()=>{this.flushPromise===e&&(this.flushPromise=null)}),e}getCustomHeaders(){let e=this.getCustomUserAgent(),t={};return e&&""!==e&&(t["User-Agent"]=e),t}async _flush(){this.clearFlushTimer(),await this._initPromise;let e=this.getPersistedProperty(m.Queue)||[];if(!e.length)return;let t=[],r=e.length;for(;e.length>0&&t.length<r;){let r=e.slice(0,this.maxBatchSize),i=r.map(e=>e.message),s=async()=>{let t=(this.getPersistedProperty(m.Queue)||[]).slice(r.length);this.setPersistedProperty(m.Queue,t),e=t,await this.flushStorage()},a={api_key:this.apiKey,batch:i,sent_at:L()};this.historicalMigration&&(a.historical_migration=!0);let n=JSON.stringify(a),o=`${this.host}/batch/`,l=this.disableCompression?null:await h(n,this.isDebug),u={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...null!==l&&{"Content-Encoding":"gzip"}},body:l||n},c={retryCheck:e=>!W(e)&&z(e)};try{await this.fetchWithRetry(o,u,c)}catch(e){if(W(e)&&i.length>1){this.maxBatchSize=Math.max(1,Math.floor(i.length/2)),this._logger.warn(`Received 413 when sending batch of size ${i.length}, reducing batch size to ${this.maxBatchSize}`);continue}throw e instanceof N||await s(),this._events.emit("error",e),e}await s(),t.push(...i)}this._events.emit("flush",t)}async fetchWithRetry(e,t,r,i){let s=t.body?t.body:"",a=-1;try{a=s instanceof Blob?s.size:Buffer.byteLength(s,"utf8")}catch{a=s instanceof Blob?s.size:new TextEncoder().encode(s).length}return await T(async()=>{let r=new AbortController,s=M(()=>r.abort(),i??this.requestTimeout),n=null;try{n=await this.fetch(e,{signal:r.signal,...t})}catch(e){throw new N(e)}finally{clearTimeout(s)}if("no-cors"!==t.mode&&(n.status<200||n.status>=400))throw new H(n,a);return n},{...this._retryOptions,...r})}async _shutdown(e=3e4){let t;await this._initPromise;let r=!1;this.clearFlushTimer();let i=async()=>{try{for(await this.promiseQueue.join();;){let e=this.getPersistedProperty(m.Queue)||[];if(0===e.length||(await this.flush(),r))break}}catch(e){if(!z(e))throw e;await G(e)}};try{return await Promise.race([new Promise((i,s)=>{t=M(()=>{this._logger.error("Timed out while shutting down PostHog"),r=!0,s("Timeout while shutting down PostHog. Some events may not have been sent.")},e)}),i()])}finally{clearTimeout(t)}}async shutdown(e=3e4){return this.shutdownPromise?this._logger.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup"):this.shutdownPromise=this._shutdown(e).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}}class V{constructor(e,t,r=[]){this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t={}){let r=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,t,0).apply(e),s=this.buildParsingContext(t),a=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(a,r),$exception_level:"error"}}async modifyFrames(e){for(let t of e)t.stacktrace&&t.stacktrace.frames&&E(t.stacktrace.frames)&&(t.stacktrace.frames=await this.applyModifiers(t.stacktrace.frames));return e}coerceFallback(e){return{type:"Error",value:"Unknown error",stack:e.syntheticException?.stack,synthetic:!0}}parseStacktrace(e,t){let r,i;return null!=e.cause&&(r=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),{...e,cause:r,stack:i}}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(let r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}async applyModifiers(e){let t=e;for(let e of this.modifiers)t=await e(t);return t}convertToExceptionList(e,t){let r={type:e.type,value:e.value,mechanism:{type:t.type??"generic",handled:t.handled??!0,synthetic:e.synthetic??!1}};e.stack&&(r.stacktrace={type:"raw",frames:e.stack});let i=[r];return null!=e.cause&&i.push(...this.convertToExceptionList(e.cause,{...t,handled:!0})),i}buildParsingContext(e){return{chunkIdMap:function(e){let t=globalThis._posthogChunkIds;if(!t)return;let a=Object.keys(t);return s&&a.length===i?s:(i=a.length,s=a.reduce((i,s)=>{r||(r={});let a=r[s];if(a)i[a[0]]=a[1];else{let a=e(s);for(let e=a.length-1;e>=0;e--){let n=a[e],o=n?.filename,l=t[s];if(o&&l){i[o]=l,r[s]=[o,l];break}}}return i},{}))}(this.stackParser),skipFirstLines:e.skipFirstLines??1}}buildCoercingContext(e,t,r=0){let i=(r,i)=>{if(i<=4){let s=this.buildCoercingContext(e,t,i);return this.applyCoercers(r,s)}};return{...t,syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>i(e,r),next:e=>i(e,r+1)}}}function Q(e,t,r,i,s){let a={platform:e,filename:t,function:"<anonymous>"===r?"?":r,in_app:!0};return void 0!==i&&(a.lineno=i),void 0!==s&&(a.colno=s),a}e.s(["ErrorPropertiesBuilder",0,V],80446);let J=(e,t)=>{let r=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return r||i?[-1!==e.indexOf("@")?e.split("@")[0]:"?",r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Y=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Z=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,X=/\((\S*)(?::(\d+))(?::(\d+))\)/,ee=(e,t)=>{let r=Y.exec(e);if(r){let[,e,i,s]=r;return Q(t,e,"?",+i,+s)}let i=Z.exec(e);if(i){if(i[2]&&0===i[2].indexOf("eval")){let e=X.exec(i[2]);e&&(i[2]=e[1],i[3]=e[2],i[4]=e[3])}let[e,r]=J(i[1]||"?",i[2]);return Q(t,r,e,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},et=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,er=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ei=(e,t)=>{let r=et.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){let e=er.exec(r[3]);e&&(r[1]=r[1]||"eval",r[3]=e[1],r[4]=e[2],r[5]="")}let e=r[3],i=r[1]||"?";return[i,e]=J(i,e),Q(t,e,i,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},es=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,ea=(e,t)=>{let r=es.exec(e);return r?Q(t,r[2],r[1]||"?",+r[3],r[4]?+r[4]:void 0):void 0},en=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,eo=(e,t)=>{let r=en.exec(e);return r?Q(t,r[2],r[3]||"?",+r[1]):void 0},el=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,eu=(e,t)=>{let r=el.exec(e);return r?Q(t,r[5],r[3]||r[4]||"?",+r[1],+r[2]):void 0},ec=/^\s*[-]{4,}$/,eh=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,ed=(e,t)=>{let r=e.match(eh);if(r){let e,i,s,a,n;if(r[1]){let t=(s=r[1]).lastIndexOf(".");if("."===s[t-1]&&t--,t>0){e=s.slice(0,t),i=s.slice(t+1);let r=e.indexOf(".Module");r>0&&(s=s.slice(r+1),e=e.slice(0,r))}a=void 0}i&&(a=e,n=i),"<anonymous>"===i&&(n=void 0,s=void 0),void 0===s&&(n=n||"?",s=a?`${a}.${n}`:n);let o=r[2]?.startsWith("file://")?r[2].slice(7):r[2],l="native"===r[5];return o?.match(/\/[A-Z]:/)&&(o=o.slice(1)),o||!r[5]||l||(o=r[5]),{filename:o?decodeURI(o):void 0,module:void 0,function:s,lineno:eg(r[3]),colno:eg(r[4]),in_app:function(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&void 0!==e&&!e.includes("node_modules/")}(o||"",l),platform:t}}if(e.match(ec))return{filename:e,platform:t}};function eg(e){return parseInt(e||"",10)||void 0}let ep=/\(error: (.*)\)/;function ef(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{var r;return{...e,filename:e.filename||((r=t)[r.length-1]||{}).filename,function:e.function||"?"}})}function ey(){return em("web:javascript",ee,ei)}function em(e,...t){return(r,i=0)=>{let s=[],a=r.split("\n");for(let r=i;r<a.length;r++){let i=a[r];if(i.length>1024)continue;let n=ep.test(i)?i.replace(ep,"$1"):i;if(!n.match(/\S*Error: /)){for(let r of t){let t=r(n,e);if(t){s.push(t);break}}if(s.length>=50)break}}return ef(s)}}e.s(["createDefaultStackParser",0,ey,"createStackParser",0,em,"reverseAndStripFrames",0,ef],34246);class ev{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){let r=F(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){let t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return x(e,"DOMException")}isDOMError(e){return x(e,"DOMError")}}e.s(["DOMExceptionCoercer",0,ev],29569);class eb{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){let r=e.message;return r.error&&"string"==typeof r.error.message?String(r.error.message):String(r)}getStack(e){return e.stacktrace||e.stack||void 0}}e.s(["ErrorCoercer",0,eb],11475);class e_{match(e){return x(e,"ErrorEvent")&&void 0!=e.error}coerce(e,t){let r=t.apply(e.error);return r||{type:"ErrorEvent",value:e.message,stack:t.syntheticException?.stack,synthetic:!0}}}e.s(["ErrorEventCoercer",0,e_],43179);let ew=["fatal","error","warning","log","info","debug"];function eE(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let e=r.length;e>0;e--){let i=r.slice(0,e).join(", ");if(!(i.length>t)){if(e===r.length)return i;return i.length<=t?i:`${i.slice(0,t)}...`}}return""}class eF{match(e){return"object"==typeof e&&null!==e}coerce(e,t){let r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:t.syntheticException?.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return S(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){let 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;let t=this.getObjectClassName(e),r=eE(e);return`${t&&"Object"!==t?`'${t}'`:"Object"} captured as exception with keys: ${r}`}isSeverityLevel(e){return F(e)&&!(F(e)&&0===e.trim().length)&&ew.indexOf(e)>=0}getErrorPropertyFromObject(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(j(r))return r}}getObjectClassName(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}e.s(["ObjectCoercer",0,eF],6881);class eP{match(e){return S(e)}coerce(e,t){let r=e.constructor.name;return{type:r,value:`${r} captured as exception with keys: ${eE(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}}e.s(["EventCoercer",0,eP],80322);class ex{match(e){return P(e)}coerce(e,t){return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}}e.s(["PrimitiveCoercer",0,ex],80049);class eS{match(e){return x(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!S(e))return!1;try{let t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch{return!1}}coerce(e,t){let r=this.getUnhandledRejectionReason(e);return P(r)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(r)}`,stack:t.syntheticException?.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch{}return e}}e.s(["PromiseRejectionEventCoercer",0,eS],98689),e.s([],99573),e.s([],47114),e.i(47114),e.i(80446),e.i(34246),e.s(["chromeStackLineParser",0,ee,"createDefaultStackParser",0,ey,"createStackParser",0,em,"geckoStackLineParser",0,ei,"nodeStackLineParser",0,ed,"opera10StackLineParser",0,eo,"opera11StackLineParser",0,eu,"reverseAndStripFrames",0,ef,"winjsStackLineParser",0,ea],70736),e.i(70736),e.i(99573),e.i(29569),e.i(11475),e.i(43179);let ek=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class eC{match(e){return"string"==typeof e}coerce(e,t){let[r,i]=this.getInfos(e);return{type:r??"Error",value:i??e,stack:t.syntheticException?.stack,synthetic:!0}}getInfos(e){let t="Error",r=e,i=e.match(ek);return i&&(t=i[1],r=i[2]),[t,r]}}e.s(["StringCoercer",0,eC],45098),e.i(45098),e.i(6881),e.i(80322),e.i(80049),e.i(98689),e.s(["DOMExceptionCoercer",0,ev,"ErrorCoercer",0,eb,"ErrorEventCoercer",0,e_,"EventCoercer",0,eP,"ObjectCoercer",0,eF,"PrimitiveCoercer",0,ex,"PromiseRejectionEventCoercer",0,eS,"StringCoercer",0,eC],21854),e.i(21854);class eI{constructor(e){this._maxSize=e,this._cache=new Map}get(e){let t=this._cache.get(e);if(void 0!==t)return this._cache.delete(e),this._cache.set(e,t),t}set(e,t){this._cache.set(e,t)}reduce(){for(;this._cache.size>=this._maxSize;){let e=this._cache.keys().next().value;e&&this._cache.delete(e)}}}e.s(["ReduceableCache",0,eI],46986),e.i(46986),e.s(["DOMExceptionCoercer",0,ev,"ErrorCoercer",0,eb,"ErrorEventCoercer",0,e_,"ErrorPropertiesBuilder",0,V,"EventCoercer",0,eP,"ObjectCoercer",0,eF,"PrimitiveCoercer",0,ex,"PromiseRejectionEventCoercer",0,eS,"ReduceableCache",0,eI,"StringCoercer",0,eC,"chromeStackLineParser",0,ee,"createDefaultStackParser",0,ey,"createStackParser",0,em,"geckoStackLineParser",0,ei,"nodeStackLineParser",0,ed,"opera10StackLineParser",0,eo,"opera11StackLineParser",0,eu,"reverseAndStripFrames",0,ef,"winjsStackLineParser",0,ea],96117);var e$=e.i(96117),eO=e$,eA=e.i(2157),eR=e.i(1457);let eT=new eO.ReduceableCache(25),eL=new eO.ReduceableCache(20);async function eM(e){let t={};for(let s=e.length-1;s>=0;s--){var r,i;let a=e[s],n=a?.filename;!(!a||"string"!=typeof n||"number"!=typeof a.lineno||(r=n).startsWith("node:")||r.endsWith(".min.js")||r.endsWith(".min.cjs")||r.endsWith(".min.mjs")||r.startsWith("data:")||void 0!==(i=a).lineno&&i.lineno>1e4||void 0!==i.colno&&i.colno>1e3)&&(t[n]||(t[n]=[]),t[n].push(a.lineno))}let s=Object.keys(t);if(0==s.length)return e;let a=[];for(let e of s){if(eL.get(e))continue;let r=t[e];if(!r)continue;r.sort((e,t)=>e-t);let i=function(e){if(!e.length)return[];let t=0,r=e[0];if("number"!=typeof r)return[];let i=eD(r),s=[];for(;;){if(t===e.length-1){s.push(i);break}let r=e[t+1];if("number"!=typeof r)break;r<=i[1]?i[1]=r+7:(s.push(i),i=eD(r)),t++}return s}(r);if(i.every(t=>(function(e,t){let r=eT.get(e);if(void 0===r)return!1;for(let e=t[0];e<=t[1];e++)if(void 0===r[e])return!1;return!0})(e,t)))continue;let s=function(e,t,r){let i=e.get(t);return void 0===i?(e.set(t,r),r):i}(eT,e,{});a.push(function(e,t,r){return new Promise(i=>{let s=(0,eA.createReadStream)(e),a=(0,eR.createInterface)({input:s});function n(){s.destroy(),i()}let o=0,l=0,u=t[0];if(void 0===u)return void n();let c=u[0],h=u[1];function d(){eL.set(e,1),a.close(),a.removeAllListeners(),n()}s.on("error",d),a.on("error",d),a.on("close",n),a.on("line",e=>{if(!(++o<c)&&(r[o]=function(e,t){let r=e,i=r.length;if(i<=150)return r;t>i&&(t=i);let s=Math.max(t-60,0);s<5&&(s=0);let a=Math.min(s+140,i);return a>i-5&&(a=i),a===i&&(s=Math.max(a-140,0)),r=r.slice(s,a),s>0&&(r=`...${r}`),a<i&&(r+="..."),r}(e,0),o>=h)){if(l===t.length-1){a.close(),a.removeAllListeners();return}let e=t[++l];if(void 0===e){a.close(),a.removeAllListeners();return}c=e[0],h=e[1]}})})}(e,i,s))}return await Promise.all(a).catch(()=>{}),e&&e.length>0&&function(e,t){for(let r of e)if(r.filename&&void 0===r.context_line&&"number"==typeof r.lineno){let e=t.get(r.filename);if(void 0===e)continue;!function(e,t,r){if(void 0===t.lineno||void 0===r)return;t.pre_context=[];for(let i=eU(e);i<e;i++){let e=r[i];if(void 0===e)return void ej(t);t.pre_context.push(e)}if(void 0===r[e])return ej(t);t.context_line=r[e];let i=function(e){return e+7}(e);t.post_context=[];for(let s=e+1;s<=i;s++){let e=r[s];if(void 0===e)break;t.post_context.push(e)}}(r.lineno,r,e)}}(e,eT),eT.reduce(),e}function ej(e){delete e.pre_context,delete e.context_line,delete e.post_context}function eD(e){return[eU(e),e+7]}function eU(e){return Math.max(1,e-7)}function eB(e,t,r,i,s){if(t>r&&(i.warn("min cannot be greater than max."),t=r),"[object Number]"==w.call(e)&&e==e)if(e>r)return i.warn(" cannot be greater than max: "+r+". Using max value instead."),r;else return e<t?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e;return i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+s),eB(s||r,t,r,i)}class eq{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=eB(e.bucketSize,0,100,e._logger),this._refillRate=eB(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=eB(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){let r=Math.floor((t-e.lastAccess)/this._refillInterval);if(r>0){let t=r*this._refillRate;e.tokens=Math.min(e.tokens+t,this._bucketSize),e.lastAccess=e.lastAccess+r*this._refillInterval}}consumeRateLimit(e){let t=Date.now(),r=String(e),i=this._buckets[r];return i?this._applyRefill(i,t):(i={tokens:this._bucketSize,lastAccess:t},this._buckets[r]=i),0===i.tokens||(i.tokens--,0===i.tokens&&this._onBucketRateLimited?.(e),0===i.tokens)}stop(){this._buckets={}}}class eH{constructor(e,t,r){this.client=e,this._exceptionAutocaptureEnabled=t.enableExceptionAutocapture||!1,this._logger=r,this._rateLimiter=new eq({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(e){return e===Object(e)&&!E(e)&&"__posthog_previously_captured_error"in e&&!0===e.__posthog_previously_captured_error}static async buildEventMessage(e,t,r,i){let s={...i},a=this.errorPropertiesBuilder.buildFromUnknown(e,t);return a.$exception_list=await this.errorPropertiesBuilder.modifyFrames(a.$exception_list),{event:"$exception",distinctId:r,properties:{...a,...s},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){if(this.isEnabled()){var t,r,i;let s;t=this.onException.bind(this),r=this.onFatalError.bind(this),globalThis.process?.on("uncaughtException",(s=!1,Object.assign(i=>{let a=e.g.process.listeners("uncaughtException").filter(e=>"domainUncaughtExceptionClear"!==e.name&&!0!==e._posthogErrorHandler).length;t(i,{mechanism:{type:"onuncaughtexception",handled:!1}}),s||0!==a||(s=!0,r(i))},{_posthogErrorHandler:!0}))),i=this.onException.bind(this),globalThis.process?.on("unhandledRejection",e=>i(e,{mechanism:{type:"onunhandledrejection",handled:!1}}))}}onException(e,t){this.client.addPendingPromise((async()=>{if(!eH.isPreviouslyCapturedError(e)){let r=await eH.buildEventMessage(e,t),i=r.properties,s=i?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(s)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:s}):this.client.capture(r)}})())}async onFatalError(e){console.error(e),await this.client.shutdown(2e3),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}}let eN=["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"],eG=function(e,t=[]){if(!e)return!1;let r=e.toLowerCase();return eN.concat(t).some(e=>{let t=e.toLowerCase();return -1!==r.indexOf(t)})},ez={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function eW(e){let t=globalThis.crypto?.subtle;if(!t)throw Error("SubtleCrypto API not available");return Array.from(new Uint8Array(await t.digest("SHA-1",new TextEncoder().encode(e)))).map(e=>e.toString(16).padStart(2,"0")).join("")}e.s(["FeatureFlagError",0,ez],58325);let eK=["is_not"];class eV extends Error{constructor(e){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=e,Object.setPrototypeOf(this,eV.prototype)}}class eQ extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,eQ.prototype)}}class eJ extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,eJ.prototype)}}class eY{constructor({pollingInterval:e,personalApiKey:t,projectApiKey:r,timeout:i,host:s,customHeaders:a,...n}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=e,this.personalApiKey=t,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=r,this.host=s,this.poller=void 0,this.fetch=n.fetch||fetch,this.onError=n.onError,this.customHeaders=a,this.onLoad=n.onLoad,this.cacheProvider=n.cacheProvider,this.strictLocalEvaluation=n.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(e=!0){this.debugMode=e}logMsgIfDebug(e){this.debugMode&&e()}createEvaluationContext(e,t={},r={},i={},s={}){return{distinctId:e,groups:t,personProperties:r,groupProperties:i,evaluationCache:s}}async getFeatureFlag(e,t,r={},i={},s={}){let a,n;if(await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return a;if(void 0!==(n=this.featureFlagsByKey[e])){let o=this.createEvaluationContext(t,r,i,s);try{a=(await this.computeFlagAndPayloadLocally(n,o)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${e} -> ${a}`))}catch(t){t instanceof eJ||t instanceof eQ?this.logMsgIfDebug(()=>console.debug(`${t.name} when computing flag locally: ${e}: ${t.message}`)):t instanceof Error&&this.onError?.(Error(`Error computing flag locally: ${e}: ${t}`))}}return a}async getAllFlagsAndPayloads(e,t){await this.loadFeatureFlags();let r={},i={},s=0==this.featureFlags.length,a=t?t.map(e=>this.featureFlagsByKey[e]).filter(Boolean):this.featureFlags,n={...e,evaluationCache:e.evaluationCache??{}};return await Promise.all(a.map(async e=>{try{let{value:t,payload:s}=await this.computeFlagAndPayloadLocally(e,n);r[e.key]=t,s&&(i[e.key]=s)}catch(t){t instanceof eJ||t instanceof eQ?this.logMsgIfDebug(()=>console.debug(`${t.name} when computing flag locally: ${e.key}: ${t.message}`)):t instanceof Error&&this.onError?.(Error(`Error computing flag locally: ${e.key}: ${t}`)),s=!0}})),{response:r,payloads:i,fallbackToFlags:s}}async computeFlagAndPayloadLocally(e,t,r={}){let i,{matchValue:s,skipLoadCheck:a=!1}=r;if(a||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};i=void 0!==s?s:await this.computeFlagValueLocally(e,t);let n=this.getFeatureFlagPayload(e.key,i);return{value:i,payload:n}}async computeFlagValueLocally(e,t){let{distinctId:r,groups:i,personProperties:s,groupProperties:a}=t;if(e.ensure_experience_continuity)throw new eQ("Flag has experience continuity enabled");if(!e.active)return!1;let n=(e.filters||{}).aggregation_group_type_index;if(void 0!=n){let r=this.groupTypeMapping[String(n)];if(!r)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${n} for feature flag ${e.key}`)),new eQ("Flag has unknown group type index");if(!(r in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${e.key} without group names passed in`)),!1;"device_id"===e.bucketing_identifier&&(s?.$device_id===void 0||s?.$device_id===null||s?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${e.key}`));let o=a[r];return await this.matchFeatureFlagProperties(e,i[r],o,t)}{let i=this.getBucketingValueForFlag(e,r,s);if(void 0===i)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${e.key} without $device_id, falling back to server evaluation`)),new eQ(`Can't compute feature flag: ${e.key} without $device_id`);return await this.matchFeatureFlagProperties(e,i,s,t)}}getBucketingValueForFlag(e,t,r){if(e.filters?.aggregation_group_type_index!=void 0)return t;if("device_id"===e.bucketing_identifier){let e=r?.$device_id;if(null==e||""===e)return;return e}return t}getFeatureFlagPayload(e,t){let r=null;if(!1!==t&&null!=t&&("boolean"==typeof t?r=this.featureFlagsByKey?.[e]?.filters?.payloads?.[t.toString()]||null:"string"==typeof t&&(r=this.featureFlagsByKey?.[e]?.filters?.payloads?.[t]||null),null!=r)){if("object"==typeof r)return r;if("string"==typeof r)try{return JSON.parse(r)}catch{}return r}return null}async evaluateFlagDependency(e,t,r){let{evaluationCache:i}=r,s=e.key;if(!this.featureFlagsByKey)throw new eQ("Feature flags not available for dependency evaluation");if(!("dependency_chain"in e))throw new eQ(`Flag dependency property for '${s}' is missing required 'dependency_chain' field`);let a=e.dependency_chain;if(!Array.isArray(a))throw new eQ(`Flag dependency property for '${s}' has an invalid 'dependency_chain' (expected array, got ${typeof a})`);if(0===a.length)throw new eQ(`Circular dependency detected for flag '${s}' (empty dependency chain)`);for(let e of a){if(!(e in i)){let t=this.featureFlagsByKey[e];if(t)if(t.active)try{let s=await this.computeFlagValueLocally(t,r);i[e]=s}catch(t){throw new eQ(`Error evaluating flag dependency '${e}' for flag '${s}': ${t}`)}else i[e]=!1;else throw new eQ(`Missing flag dependency '${e}' for flag '${s}'`)}if(null==i[e])throw new eQ(`Dependency '${e}' could not be evaluated`)}let n=i[s];return this.flagEvaluatesToExpectedValue(e.value,n)}flagEvaluatesToExpectedValue(e,t){return"boolean"==typeof e?e===t||"string"==typeof t&&""!==t&&!0===e:"string"==typeof e&&t===e}async matchFeatureFlagProperties(e,t,r,i){let s,a=e.filters||{},n=a.groups||[],o=!1;for(let l of n)try{if(await this.isConditionMatch(e,t,l,r,i)){let r=l.variant,i=a.multivariate?.variants||[];s=r&&i.some(e=>e.key===r)?r:await this.getMatchingVariant(e,t)||!0;break}}catch(e){if(e instanceof eJ)throw e;if(e instanceof eQ)o=!0;else throw e}if(void 0!==s)return s;if(o)throw new eQ("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(e,t,r,i,s){let a=r.rollout_percentage,n=e=>{this.logMsgIfDebug(()=>console.warn(e))};if((r.properties||[]).length>0){for(let e of r.properties){let t=e.type;if(!("cohort"===t?function e(t,r,i,s=!1){let a=String(t.value);if(!(a in i))throw new eJ(`cohort ${a} not found in local cohorts - likely a static cohort that requires server evaluation`);return function t(r,i,s,a=!1){if(!r)return!0;let n=r.type,o=r.values;if(!o||0===o.length)return!0;let l=!1;if("values"in o[0]){for(let e of o)try{let r=t(e,i,s,a);if("AND"===n){if(!r)return!1}else if(r)return!0}catch(t){if(t instanceof eJ)throw t;if(t instanceof eQ)a&&console.debug(`Failed to compute property ${e} locally: ${t}`),l=!0;else throw t}if(l)throw new eQ("Can't match cohort without a given cohort property value");return"AND"===n}for(let t of o)try{let r;if("cohort"===t.type)r=e(t,i,s,a);else if("flag"===t.type){a&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${t.key||"unknown"}'`);continue}else r=eX(t,i);let o=t.negation||!1;if("AND"===n){if(!r&&!o||r&&o)return!1}else if(r&&!o||!r&&o)return!0}catch(e){if(e instanceof eJ)throw e;if(e instanceof eQ)a&&console.debug(`Failed to compute property ${t} locally: ${e}`),l=!0;else throw e}if(l)throw new eQ("can't match cohort without a given cohort property value");return"AND"===n}(i[a],r,i,s)}(e,i,this.cohorts,this.debugMode):"flag"===t?await this.evaluateFlagDependency(e,i,s):eX(e,i,n)))return!1}if(void 0==a)return!0}return!(void 0!=a&&await eZ(e.key,t)>a/100)}async getMatchingVariant(e,t){let r=await eZ(e.key,t,"variant"),i=this.variantLookupTable(e).find(e=>r>=e.valueMin&&r<e.valueMax);if(i)return i.key}variantLookupTable(e){let t=[],r=0,i=0,s=e.filters||{};return(s.multivariate?.variants||[]).forEach(e=>{i=r+e.rollout_percentage/100,t.push({valueMin:r,valueMax:i,key:e.key}),r=i}),t}updateFlagState(e){this.featureFlags=e.flags,this.featureFlagsByKey=e.flags.reduce((e,t)=>(e[t.key]=t,e),{}),this.groupTypeMapping=e.groupTypeMapping,this.cohorts=e.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(e){if(this.strictLocalEvaluation)return;let t=e.filter(e=>e.ensure_experience_continuity);t.length>0&&console.warn(`[PostHog] You are using local evaluation but ${t.length} flag(s) have experience continuity enabled: ${t.map(e=>e.key).join(", ")}. Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).`)}async loadFromCache(e){if(!this.cacheProvider)return!1;try{let t=await this.cacheProvider.getFlagDefinitions();if(t)return this.updateFlagState(t),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${e} (${t.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(t.flags),!0;return!1}catch(e){return this.onError?.(Error(`Failed to load from cache: ${e}`)),!1}}async loadFeatureFlags(e=!1){if(!this.loadedSuccessfullyOnce||e)return!e&&this.nextFetchAllowedAt&&Date.now()<this.nextFetchAllowedAt?void this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Skipping fetch, in backoff period")):(this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(e=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${e}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise)}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getFlagDefinitionsLoadedAt(){return this.flagDefinitionsLoadedAt}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(6e4,this.pollingInterval*2**this.backOffCount):this.pollingInterval}beginBackoff(){this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,this.nextFetchAllowedAt=Date.now()+this.getPollingInterval()}clearBackoff(){this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.nextFetchAllowedAt=void 0}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let e=!0;if(this.cacheProvider)try{e=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(e){this.onError?.(Error(`Error in shouldFetchFlagDefinitions: ${e}`))}if(!e&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let t=await this._requestFeatureFlagDefinitions();if(!t)return;switch(t.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=t.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new eV(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.beginBackoff(),new eV(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.beginBackoff(),new eV(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let r=await t.json()??{};if(!("flags"in r))return void this.onError?.(Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`));this.flagsEtag=t.headers?.get("ETag")??void 0;let i={flags:r.flags??[],groupTypeMapping:r.group_type_mapping||{},cohorts:r.cohorts||{}};if(this.updateFlagState(i),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&e)try{await this.cacheProvider.onFlagDefinitionsReceived(i)}catch(e){this.onError?.(Error(`Failed to store in cache: ${e}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(i.flags);break}default:return}}catch(e){e instanceof eV&&this.onError?.(e)}}getPersonalApiKeyRequestOptions(e="GET",t){let r={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return t&&(r["If-None-Match"]=t),{method:e,headers:r}}_requestFeatureFlagDefinitions(){let e=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,t=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),r=null;if(this.timeout&&"number"==typeof this.timeout){let e=new AbortController;r=M(()=>{e.abort()},this.timeout),t.signal=e.signal}try{return(0,this.fetch)(e,t)}finally{clearTimeout(r)}}async stopPoller(e=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let t=this.cacheProvider.shutdown();t instanceof Promise&&await Promise.race([t,new Promise((t,r)=>setTimeout(()=>r(Error(`Cache shutdown timeout after ${e}ms`)),e))])}catch(e){this.onError?.(Error(`Error during cache shutdown: ${e}`))}}}async function eZ(e,t,r=""){return parseInt((await eW(`${e}.${t}${r}`)).slice(0,15),16)/0x1000000000000000}function eX(e,t,r){let i=e.key,s=e.value,a=e.operator||"exact";if(i in t){if("is_not_set"===a)throw new eQ("Operator is_not_set is not supported")}else throw new eQ(`Property ${i} not found in propertyValues`);let n=t[i];if(null==n&&!eK.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function o(e,t){return Array.isArray(e)?e.map(e=>String(e).toLowerCase()).includes(String(t).toLowerCase()):String(e).toLowerCase()===String(t).toLowerCase()}function l(e,t,r){if("gt"===r)return e>t;if("gte"===r)return e>=t;if("lt"===r)return e<t;if("lte"===r)return e<=t;throw Error(`Invalid operator: ${r}`)}switch(a){case"exact":return o(s,n);case"is_not":return!o(s,n);case"is_set":return i in t;case"icontains":return String(n).toLowerCase().includes(String(s).toLowerCase());case"not_icontains":return!String(n).toLowerCase().includes(String(s).toLowerCase());case"regex":return e0(String(s))&&null!==String(n).match(String(s));case"not_regex":return e0(String(s))&&null===String(n).match(String(s));case"gt":case"gte":case"lt":case"lte":{let e="number"==typeof s?s:null;if("string"==typeof s)try{e=parseFloat(s)}catch(e){}if(null==e||null==n)return l(String(n),String(s),a);if("string"==typeof n)return l(n,String(s),a);return l(n,e,a)}case"is_date_after":case"is_date_before":{if("boolean"==typeof s)throw new eQ("Date operations cannot be performed on boolean values");let e=function(e){let t=e.match(/^-?(?<number>[0-9]+)(?<interval>[a-z])$/),r=new Date(new Date().toISOString());if(!t)return null;{if(!t.groups)return null;let e=parseInt(t.groups.number);if(e>=1e4)return null;let i=t.groups.interval;if("h"==i)r.setUTCHours(r.getUTCHours()-e);else if("d"==i)r.setUTCDate(r.getUTCDate()-e);else if("w"==i)r.setUTCDate(r.getUTCDate()-7*e);else if("m"==i)r.setUTCMonth(r.getUTCMonth()-e);else{if("y"!=i)return null;r.setUTCFullYear(r.getUTCFullYear()-e)}return r}}(String(s));if(null==e&&(e=e2(s)),null==e)throw new eQ(`Invalid date: ${s}`);let t=e2(n);if(["is_date_before"].includes(a))return t<e;return t>e}case"semver_eq":return 0===e4(e1(String(n)),e1(String(s)));case"semver_neq":return 0!==e4(e1(String(n)),e1(String(s)));case"semver_gt":return e4(e1(String(n)),e1(String(s)))>0;case"semver_gte":return e4(e1(String(n)),e1(String(s)))>=0;case"semver_lt":return 0>e4(e1(String(n)),e1(String(s)));case"semver_lte":return 0>=e4(e1(String(n)),e1(String(s)));case"semver_tilde":{let e,t=e1(String(n)),{lower:r,upper:i}={lower:[(e=e1(String(s)))[0],e[1],e[2]],upper:[e[0],e[1]+1,0]};return e4(t,r)>=0&&0>e4(t,i)}case"semver_caret":{let e=e1(String(n)),{lower:t,upper:r}=function(e){let[t,r,i]=e1(e);return{lower:[t,r,i],upper:t>0?[t+1,0,0]:r>0?[0,r+1,0]:[0,0,i+1]}}(String(s));return e4(e,t)>=0&&0>e4(e,r)}case"semver_wildcard":{let e=e1(String(n)),{lower:t,upper:r}=function(e){let t,r,i=String(e).trim().replace(/^[vV]/,"").replace(/\.\*$/,"").replace(/\*$/,"");if(!i)throw new eQ(`Invalid wildcard semver: ${e}`);let s=i.split("."),a=parseInt(s[0],10);if(isNaN(a))throw new eQ(`Invalid wildcard semver: ${e}`);if(1===s.length)t=[a,0,0],r=[a+1,0,0];else{let i=parseInt(s[1],10);if(isNaN(i))throw new eQ(`Invalid wildcard semver: ${e}`);t=[a,i,0],r=[a,i+1,0]}return{lower:t,upper:r}}(String(s));return e4(e,t)>=0&&0>e4(e,r)}default:throw new eQ(`Unknown operator: ${a}`)}}function e0(e){try{return new RegExp(e),!0}catch(e){return!1}}function e1(e){let t=String(e).trim().replace(/^[vV]/,"").split("-")[0].split("+")[0];if(!t||t.startsWith("."))throw new eQ(`Invalid semver: ${e}`);let r=t.split("."),i=t=>{if(void 0===t||""===t)return 0;if(!/^\d+$/.test(t))throw new eQ(`Invalid semver: ${e}`);return parseInt(t,10)};return[i(r[0]),i(r[1]),i(r[2])]}function e4(e,t){for(let r=0;r<3;r++){if(e[r]<t[r])return -1;if(e[r]>t[r])return 1}return 0}function e2(e){if(e instanceof Date)return e;if("string"==typeof e||"number"==typeof e){let t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new eQ(`${e} is in an invalid date format`)}throw new eQ(`The date provided ${e} must be a string, number, or date object`)}class e3{getProperty(e){return this._memoryStorage[e]}setProperty(e,t){this._memoryStorage[e]=null!==t?t:void 0}constructor(){this._memoryStorage={}}}class e5 extends K{constructor(e,t={}){if(super(e,t),this._memoryStorage=new e3,this.options=t,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval="number"==typeof t.featureFlagsPollingInterval?Math.max(t.featureFlagsPollingInterval,100):3e4,"number"==typeof t.waitUntilDebounceMs&&(this.options.waitUntilDebounceMs=Math.max(t.waitUntilDebounceMs,0)),"number"==typeof t.waitUntilMaxWaitMs&&(this.options.waitUntilMaxWaitMs=Math.max(t.waitUntilMaxWaitMs,0)),t.personalApiKey){if(t.personalApiKey.includes("phc_"))throw Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');!1!==t.enableLocalEvaluation&&(this.featureFlagsPoller=new eY({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:t.personalApiKey,projectApiKey:e,timeout:t.requestTimeout??1e4,host:this.host,fetch:t.fetch,onError:e=>{this._events.emit("error",e)},onLoad:e=>{this._events.emit("localEvaluationFlagsLoaded",e)},customHeaders:this.getCustomHeaders(),cacheProvider:t.flagDefinitionCacheProvider,strictLocalEvaluation:t.strictLocalEvaluation}))}this.errorTracking=new eH(this,t,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=t.maxCacheSize||5e4}enqueue(e,t,r){super.enqueue(e,t,r),this.scheduleDebouncedFlush()}async flush(){let e=super.flush(),t=this.options.waitUntil;if(t&&!this._waitUntilCycle)try{t(e.catch(()=>{}))}catch{}return e}scheduleDebouncedFlush(){let e=this.options.waitUntil;if(!e||this.disabled||this.optedOut)return;if(!this._waitUntilCycle){let t,r=new Promise(e=>{t=e});try{e(r)}catch{return}this._waitUntilCycle={resolve:t,startedAt:Date.now(),timer:void 0}}let t=Date.now()-this._waitUntilCycle.startedAt,r=this.options.waitUntilMaxWaitMs??500;if(void 0!==this._waitUntilCycle.timer&&clearTimeout(this._waitUntilCycle.timer),t>=r)return void this.resolveWaitUntilFlush();let i=this.options.waitUntilDebounceMs??50;this._waitUntilCycle.timer=M(()=>{this.resolveWaitUntilFlush()},i)}_consumeWaitUntilCycle(){let e=this._waitUntilCycle;return e&&(clearTimeout(e.timer),this._waitUntilCycle=void 0),e?.resolve}async resolveWaitUntilFlush(){let e=this._consumeWaitUntilCycle();try{await super.flush()}catch{}finally{e?.()}}getPersistedProperty(e){return this._memoryStorage.getProperty(e)}setPersistedProperty(e,t){return this._memoryStorage.setProperty(e,t)}fetch(e,t){return this.options.fetch?this.options.fetch(e,t):fetch(e,t)}getLibraryVersion(){return"5.28.9"}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(e=!0){super.debug(e),this.featureFlagsPoller?.debug(e)}capture(e){"string"==typeof e&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),"$exception"!==e.event||e._originatedFromCaptureException||this._logger.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.addPendingPromise(this.prepareEventMessage(e).then(({distinctId:e,event:t,properties:r,options:i})=>super.captureStateless(e,t,r,{timestamp:i.timestamp,disableGeoip:i.disableGeoip,uuid:i.uuid})).catch(e=>{e&&console.error(e)}))}async captureImmediate(e){return"string"==typeof e&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),"$exception"!==e.event||e._originatedFromCaptureException||this._logger.warn("Capturing a `$exception` event via `posthog.captureImmediate('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureExceptionImmediate(error)` instead, which attaches this metadata by default."),this.addPendingPromise(this.prepareEventMessage(e).then(({distinctId:e,event:t,properties:r,options:i})=>super.captureStatelessImmediate(e,t,r,{timestamp:i.timestamp,disableGeoip:i.disableGeoip,uuid:i.uuid})).catch(e=>{e&&console.error(e)}))}identify({distinctId:e,properties:t={},disableGeoip:r}){let{$set:i,$set_once:s,$anon_distinct_id:a,...n}=t;super.identifyStateless(e,{$set:i||n,$set_once:s||{},$anon_distinct_id:a??void 0},{disableGeoip:r})}async identifyImmediate({distinctId:e,properties:t={},disableGeoip:r}){let{$set:i,$set_once:s,$anon_distinct_id:a,...n}=t;super.identifyStatelessImmediate(e,{$set:i||n,$set_once:s||{},$anon_distinct_id:a??void 0},{disableGeoip:r})}alias(e){super.aliasStateless(e.alias,e.distinctId,void 0,{disableGeoip:e.disableGeoip})}async aliasImmediate(e){await super.aliasStatelessImmediate(e.alias,e.distinctId,void 0,{disableGeoip:e.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(e=3e4){return!!this.isLocalEvaluationReady()||void 0!==this.featureFlagsPoller&&new Promise(t=>{let r=setTimeout(()=>{i(),t(!1)},e),i=this._events.on("localEvaluationFlagsLoaded",e=>{clearTimeout(r),i(),t(e>0)})})}_resolveDistinctId(e,t){return"string"==typeof e?{distinctId:e,options:t}:{distinctId:this.context?.get()?.distinctId,options:e}}async _getFeatureFlagResult(e,t,r={},i){let s,a,n,o,l,u,c,h=r.sendFeatureFlagEvents??!0;if(void 0!==this._flagOverrides&&e in this._flagOverrides){let t=this._flagOverrides[e];if(void 0===t)return;let r=this._payloadOverrides?.[e];return{key:e,enabled:!1!==t,variant:"string"==typeof t?t:void 0,payload:r}}let{groups:d,disableGeoip:g}=r,{onlyEvaluateLocally:p,personProperties:f,groupProperties:y}=r,m=this.addLocalPersonAndGroupProperties(t,d,f,y);f=m.allPersonProperties,y=m.allGroupProperties;let v=this.createFeatureFlagEvaluationContext(t,d,f,y);void 0==p&&(p=this.options.strictLocalEvaluation??!1);let b=!1;if(void 0!==this.featureFlagsPoller){await this.featureFlagsPoller?.loadFeatureFlags();let t=this.featureFlagsPoller?.featureFlagsByKey[e];if(t)try{let r=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(t,v,{matchValue:i});if(r){b=!0;let i=r.value;l=t.id,c="Evaluated locally",s={key:e,enabled:!1!==i,variant:"string"==typeof i?i:void 0,payload:r.payload??void 0}}}catch(t){if(t instanceof eJ||t instanceof eQ)this._logger?.info(`${t.name} when computing flag locally: ${e}: ${t.message}`);else throw t}}if(!b&&!p){let t=await super.getFeatureFlagDetailsStateless(v.distinctId,v.groups,v.personProperties,v.groupProperties,g,[e]);if(void 0===t)o=ez.UNKNOWN_ERROR;else{a=t.requestId,n=t.evaluatedAt;let r=[];t.errorsWhileComputingFlags&&r.push(ez.ERRORS_WHILE_COMPUTING),t.quotaLimited?.includes("feature_flags")&&r.push(ez.QUOTA_LIMITED);let i=t.flags[e];if(void 0===i)r.push(ez.FLAG_MISSING);else{let t;if(l=i.metadata?.id,u=i.metadata?.version,c=i.reason?.description??i.reason?.code,i.metadata?.payload!==void 0)try{t=JSON.parse(i.metadata.payload)}catch{t=i.metadata.payload}s={key:e,enabled:i.enabled,variant:i.variant,payload:t}}r.length>0&&(o=r.join(","))}}if(h){let r=void 0===s?void 0:!1!==s.enabled&&(s.variant??!0),i=`${e}_${r}`;if(!(t in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[t].includes(i)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[t])?this.distinctIdHasSentFlagCalls[t].push(i):this.distinctIdHasSentFlagCalls[t]=[i];let s={$feature_flag:e,$feature_flag_response:r,$feature_flag_id:l,$feature_flag_version:u,$feature_flag_reason:c,locally_evaluated:b,[`$feature/${e}`]:r,$feature_flag_request_id:a,$feature_flag_evaluated_at:b?Date.now():n};if(b&&this.featureFlagsPoller){let e=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();void 0!==e&&(s.$feature_flag_definitions_loaded_at=e)}o&&(s.$feature_flag_error=o),this.capture({distinctId:t,event:"$feature_flag_called",properties:s,groups:d,disableGeoip:g})}}return void 0!==s&&void 0!==this._payloadOverrides&&e in this._payloadOverrides&&(s={...s,payload:this._payloadOverrides[e]}),s}async getFeatureFlag(e,t,r){let i=await this._getFeatureFlagResult(e,t,{...r,sendFeatureFlagEvents:r?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(void 0!==i)return!1!==i.enabled&&(i.variant??!0)}async getFeatureFlagPayload(e,t,r,i){if(void 0!==this._payloadOverrides&&e in this._payloadOverrides)return this._payloadOverrides[e];let s=await this._getFeatureFlagResult(e,t,{...i,sendFeatureFlagEvents:!1},r);if(void 0!==s)return s.payload??null}async getFeatureFlagResult(e,t,r){let{distinctId:i,options:s}=this._resolveDistinctId(t,r);return i?this._getFeatureFlagResult(e,i,{...s,sendFeatureFlagEvents:s?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required — pass it explicitly or use withContext()")}async getRemoteConfigPayload(e){if(!this.options.personalApiKey)throw Error("Personal API key is required for remote config payload decryption");let t=await this._requestRemoteConfigPayload(e);if(!t)return;let r=await t.json();if("string"==typeof r)try{return JSON.parse(r)}catch(e){}return r}async isFeatureEnabled(e,t,r){let i=await this.getFeatureFlag(e,t,r);if(void 0!==i)return!!i}async getAllFlags(e,t){let{distinctId:r,options:i}=this._resolveDistinctId(e,t);return r?(await this.getAllFlagsAndPayloads(r,i)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags — pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(e,t){let{distinctId:r,options:i}=this._resolveDistinctId(e,t);if(!r)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads — pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:s,disableGeoip:a,flagKeys:n}=i||{},{onlyEvaluateLocally:o,personProperties:l,groupProperties:u}=i||{},c=this.addLocalPersonAndGroupProperties(r,s,l,u);l=c.allPersonProperties,u=c.allGroupProperties;let h=this.createFeatureFlagEvaluationContext(r,s,l,u);void 0==o&&(o=this.options.strictLocalEvaluation??!1);let d=await this.featureFlagsPoller?.getAllFlagsAndPayloads(h,n),g={},p={},f=!0;if(d&&(g=d.response,p=d.payloads,f=d.fallbackToFlags),f&&!o){let e=await super.getFeatureFlagsAndPayloadsStateless(h.distinctId,h.groups,h.personProperties,h.groupProperties,a,n);g={...g,...e.flags||{}},p={...p,...e.payloads||{}}}return void 0!==this._flagOverrides&&(g={...g,...this._flagOverrides}),void 0!==this._payloadOverrides&&(p={...p,...this._payloadOverrides}),{featureFlags:g,featureFlagPayloads:p}}groupIdentify({groupType:e,groupKey:t,properties:r,distinctId:i,disableGeoip:s}){super.groupIdentifyStateless(e,t,r,{disableGeoip:s},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(e){let t=e=>Object.fromEntries(e.map(e=>[e,!0]));if(!1===e){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(e)){this._flagOverrides=t(e);return}if(this._isFeatureFlagOverrideOptions(e)){"flags"in e&&(!1===e.flags?this._flagOverrides=void 0:Array.isArray(e.flags)?this._flagOverrides=t(e.flags):void 0!==e.flags&&(this._flagOverrides={...e.flags})),"payloads"in e&&(!1===e.payloads?this._payloadOverrides=void 0:void 0!==e.payloads&&(this._payloadOverrides={...e.payloads}));return}this._flagOverrides={...e}}_isFeatureFlagOverrideOptions(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;if("flags"in e){let t=e.flags;if(!1===t||Array.isArray(t)||"object"==typeof t&&null!==t)return!0}if("payloads"in e){let t=e.payloads;if(!1===t||"object"==typeof t&&null!==t)return!0}return!1}withContext(e,t,r){return this.context?this.context.run(e,t,r):t()}getContext(){return this.context?.get()}enterContext(e,t){this.context?.enter(e,t)}async _shutdown(e){let t=this._consumeWaitUntilCycle();await this.featureFlagsPoller?.stopPoller(e),this.errorTracking.shutdown();try{return await super._shutdown(e)}finally{t?.()}}async _requestRemoteConfigPayload(e){if(!this.options.personalApiKey)return;let t=`${this.host}/api/projects/@current/feature_flags/${e}/remote_config?token=${encodeURIComponent(this.apiKey)}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},i=null;if(this.options.requestTimeout&&"number"==typeof this.options.requestTimeout){let e=new AbortController;i=M(()=>{e.abort()},this.options.requestTimeout),r.signal=e.signal}try{return await this.fetch(t,r)}catch(e){this._events.emit("error",e);return}finally{i&&clearTimeout(i)}}extractPropertiesFromEvent(e,t){if(!e)return{personProperties:{},groupProperties:{}};let r={},i={};for(let[s,a]of Object.entries(e))if(x(a,"Object")&&t&&s in t){let e={};for(let[t,r]of Object.entries(a))e[String(t)]=String(r);i[String(s)]=e}else r[String(s)]=String(a);return{personProperties:r,groupProperties:i}}async getFeatureFlagsForEvent(e,t,r,i){let s=i?.personProperties||{},a=i?.groupProperties||{},n=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation)if(!((this.featureFlagsPoller?.featureFlags?.length||0)>0))return{};else{let i={};for(let[e,r]of Object.entries(t||{}))i[e]=String(r);return await this.getAllFlags(e,{groups:i,personProperties:s,groupProperties:a,disableGeoip:r,onlyEvaluateLocally:!0,flagKeys:n})}if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let i={};for(let[e,r]of Object.entries(t||{}))i[e]=String(r);return await this.getAllFlags(e,{groups:i,personProperties:s,groupProperties:a,disableGeoip:r,onlyEvaluateLocally:!0,flagKeys:n})}return(await super.getFeatureFlagsStateless(e,t,s,a,r)).flags}addLocalPersonAndGroupProperties(e,t,r,i){let s={distinct_id:e,...r||{}},a={};if(t)for(let e of Object.keys(t))a[e]={$group_key:t[e],...i?.[e]||{}};return{allPersonProperties:s,allGroupProperties:a}}createFeatureFlagEvaluationContext(e,t,r,i){return{distinctId:e,groups:t||{},personProperties:r||{},groupProperties:i||{},evaluationCache:{}}}captureException(e,t,r,i){if(!eH.isPreviouslyCapturedError(e)){let s=Error("PostHog syntheticException");this.addPendingPromise(eH.buildEventMessage(e,{syntheticException:s},t,r).then(e=>this.capture({...e,uuid:i})))}}async captureExceptionImmediate(e,t,r){if(!eH.isPreviouslyCapturedError(e)){let i=Error("PostHog syntheticException");return this.addPendingPromise(eH.buildEventMessage(e,{syntheticException:i},t,r).then(e=>this.captureImmediate(e)))}}async prepareEventMessage(e){let{distinctId:t,event:r,properties:i,groups:s,sendFeatureFlags:a,timestamp:n,disableGeoip:o,uuid:l}=e,u=this.context?.get(),c=t||u?.distinctId,h={...this.props,...u?.properties||{},...i||{}};c||(c=y().toString(),h.$process_person_profile=!1),u?.sessionId&&!h.$session_id&&(h.$session_id=u.sessionId);let d=this._runBeforeSend({distinctId:c,event:r,properties:h,groups:s,sendFeatureFlags:a,timestamp:n,disableGeoip:o,uuid:l});if(!d)return Promise.reject(null);let g=await Promise.resolve().then(async()=>a?await this.getFeatureFlagsForEvent(d.distinctId,s,o,"object"==typeof a?a:void 0):(d.event,{})).then(e=>{let t={};if(e)for(let[r,i]of Object.entries(e))t[`$feature/${r}`]=i;let r=Object.keys(e||{}).filter(t=>e?.[t]!==!1).sort();return r.length>0&&(t.$active_feature_flags=r),t}).catch(()=>({})).then(e=>({...e,...d.properties||{},$groups:d.groups||s}));return"$pageview"===d.event&&this.options.__preview_capture_bot_pageviews&&"string"==typeof g.$raw_user_agent&&eG(g.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(d.event="$bot_pageview",g.$browser_type="bot"),{distinctId:d.distinctId,event:d.event,properties:g,options:{timestamp:d.timestamp,disableGeoip:d.disableGeoip,uuid:d.uuid}}}_runBeforeSend(e){let t=this.options.before_send;if(!t)return e;let r=Array.isArray(t)?t:[t],i=e;for(let t of r){if(!(i=t(i)))return this._logger.info(`Event '${e.event}' was rejected in beforeSend function`),null;if(!i.properties||0===Object.keys(i.properties).length){let e=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(e)}}return i}}var eO=e$,e9=e.i(78500);class e6{constructor(){this.storage=new e9.AsyncLocalStorage}get(){return this.storage.getStore()}run(e,t,r){return this.storage.run(this.resolve(e,r),t)}enter(e,t){this.storage.enterWith(this.resolve(e,t))}resolve(e,t){if(t?.fresh===!0)return e;let r=this.get()||{};return{distinctId:e.distinctId??r.distinctId,sessionId:e.sessionId??r.sessionId,properties:{...r.properties||{},...e.properties||{}}}}}function e8(e,t){var r;t.use((r=e,(e,t,i,s)=>{if(eH.isPreviouslyCapturedError(e))return void s(e);let a=t.headers["x-posthog-session-id"],n=t.headers["x-posthog-distinct-id"],o=Error("Synthetic exception");r.addPendingPromise(eH.buildEventMessage(e,{mechanism:{type:"middleware",handled:!1},syntheticException:o},n,{$session_id:a,$current_url:t.url,$request_method:t.method,$request_path:t.path,$user_agent:t.headers["user-agent"],$response_status_code:i.statusCode,$ip:t.headers["x-forwarded-for"]||t?.socket?.remoteAddress}).then(e=>{r.capture(e)})),s(e)}))}e.s(["setupExpressErrorHandler",0,e8],93546),e.s([],92998),eH.errorPropertiesBuilder=new eO.ErrorPropertiesBuilder([new eO.EventCoercer,new eO.ErrorCoercer,new eO.ObjectCoercer,new eO.StringCoercer,new eO.PrimitiveCoercer],eO.createStackParser("node:javascript",eO.nodeStackLineParser),[(a=function(e=process.argv[1]?(0,o.dirname)(process.argv[1]):process.cwd(),t="\\"===o.sep){let r=t?l(e):e;return e=>{if(!e)return;let i=t?l(e):e,{dir:s,base:a,ext:n}=o.posix.parse(i);(".js"===n||".mjs"===n||".cjs"===n)&&(a=a.slice(0,-1*n.length));let u=decodeURIComponent(a);s||(s=".");let c=s.lastIndexOf("/node_modules");if(c>-1)return`${s.slice(c+14).replace(/\//g,".")}:${u}`;if(s.startsWith(r)){let e=s.slice(r.length+1).replace(/\//g,".");return e?`${e}:${u}`:u}return u}}(),async e=>{for(let t of e)t.module=a(t.filename);return e}),eM]);class e7 extends e5{getLibraryId(){return"posthog-node"}initializeContext(){return new e6}}e.s(["PostHog",0,e7],47839),e.i(47839),e.i(92998);let te="posthog-node";function tt(e,{organization:t,projectId:r,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:a=!0}={}){return n=>{if(!("*"===s||s.includes(n.level)))return n;n.tags||(n.tags={});let o=n.tags[ti.POSTHOG_ID_TAG];if(void 0===o)return n;let l=e.options.host??"https://us.i.posthog.com",u=new URL(`/project/${e.apiKey}/person/${o}`,l).toString();n.tags["PostHog Person URL"]=u;let c=n.exception?.values||[],h=c.map(e=>({...e,stacktrace:e.stacktrace?{...e.stacktrace,type:"raw",frames:(e.stacktrace.frames||[]).map(e=>({...e,platform:"node:javascript"}))}:void 0})),d={$exception_message:c[0]?.value||n.message,$exception_type:c[0]?.type,$exception_level:n.level,$exception_list:h,$sentry_event_id:n.event_id,$sentry_exception:n.exception,$sentry_exception_message:c[0]?.value||n.message,$sentry_exception_type:c[0]?.type,$sentry_tags:n.tags};return t&&r&&(d.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+n.event_id),a&&e.capture({event:"$exception",distinctId:o,properties:d}),n}}function tr(e,t){let r=tt(e,t);return{name:te,processEvent:e=>r(e)}}class ti{static #e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(e,t,r,i,s){this.name=te,this.name=te,this.setupOnce=function(a,n){a(tt(e,{organization:t,projectId:n()?.getClient()?.getDsn()?.projectId,prefix:r,severityAllowList:i,sendExceptionsToPostHog:s??!0}))}}}e.s(["PostHogSentryIntegration",0,ti,"createEventProcessor",0,tt,"sentryIntegration",0,tr],91573),e.i(91573),e.i(93546),e.i(58325),e.s(["FeatureFlagError",0,v,"PostHogSentryIntegration",0,ti,"createEventProcessor",0,tt,"sentryIntegration",0,tr,"setupExpressErrorHandler",0,e8],57564),e.i(57564),e.s(["FeatureFlagError",0,v,"PostHog",0,e7,"PostHogSentryIntegration",0,ti,"createEventProcessor",0,tt,"sentryIntegration",0,tr,"setupExpressErrorHandler",0,e8],28864)}];
1
+ module.exports=[28864,e=>{"use strict";let t,r,i,s,a;var n,o=e.i(14747);function l(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}let u=e=>void 0===e?void 0:e.variant??e.enabled,c=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch{return e}};async function h(e,t=!0){try{let t=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return await new Response(t).blob()}catch(e){return t&&console.error("Failed to gzip compress data",e),null}}let d="0123456789abcdef";class g{constructor(e){this.bytes=e}static ofInner(e){if(16===e.length)return new g(e);throw TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||e<0||t<0||r<0||i<0||e>0xffffffffffff||t>4095||r>0x3fffffff||i>0xffffffff)throw RangeError("invalid field value");let s=new Uint8Array(16);return s[0]=e/0x10000000000,s[1]=e/0x100000000,s[2]=e/0x1000000,s[3]=e/65536,s[4]=e/256,s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new g(s)}static parse(e){let t;switch(e.length){case 32:t=/^[0-9a-f]{32}$/i.exec(e)?.[0];break;case 36:t=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e)?.slice(1,6).join("");break;case 38:t=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(e)?.slice(1,6).join("");break;case 45:t=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e)?.slice(1,6).join("")}if(t){let e=new Uint8Array(16);for(let r=0;r<16;r+=4){let i=parseInt(t.substring(2*r,2*r+8),16);e[r+0]=i>>>24,e[r+1]=i>>>16,e[r+2]=i>>>8,e[r+3]=i}return new g(e)}throw SyntaxError("could not parse UUID string")}toString(){let e="";for(let t=0;t<this.bytes.length;t++)e+=d.charAt(this.bytes[t]>>>4),e+=d.charAt(15&this.bytes[t]),(3===t||5===t||7===t||9===t)&&(e+="-");return e}toHex(){let e="";for(let t=0;t<this.bytes.length;t++)e+=d.charAt(this.bytes[t]>>>4),e+=d.charAt(15&this.bytes[t]);return e}toJSON(){return this.toString()}getVariant(){let e=this.bytes[8]>>>4;if(e<0)throw Error("unreachable");if(e<=7)return this.bytes.every(e=>0===e)?"NIL":"VAR_0";if(e<=11)return"VAR_10";if(e<=13)return"VAR_110";if(e<=15)return this.bytes.every(e=>255===e)?"MAX":"VAR_RESERVED";throw Error("unreachable")}getVersion(){return"VAR_10"===this.getVariant()?this.bytes[6]>>>4:void 0}clone(){return new g(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(let t=0;t<16;t++){let r=this.bytes[t]-e.bytes[t];if(0!==r)return Math.sign(r)}return 0}}class p{constructor(e){this.timestamp=0,this.counter=0,this.random=e??f()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(e,t){let r=this.generateOrAbortCore(e,t);return void 0===r&&(this.timestamp=0,r=this.generateOrAbortCore(e,t)),r}generateOrAbortCore(e,t){if(!Number.isInteger(e)||e<1||e>0xffffffffffff)throw RangeError("`unixTsMs` must be a 48-bit positive integer");if(t<0||t>0xffffffffffff)throw RangeError("`rollbackAllowance` out of reasonable range");if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+t>=this.timestamp))return;this.counter++,this.counter>0x3ffffffffff&&(this.timestamp++,this.resetCounter())}return g.fromFieldsV7(this.timestamp,Math.trunc(this.counter/0x40000000),this.counter&0x40000000-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}generateV4(){let e=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return e[6]=64|e[6]>>>4,e[8]=128|e[8]>>>2,g.ofInner(e)}}let f=()=>({nextUint32:()=>65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random())}),y=()=>(t||(t=new p)).generate();var m=((n={}).AnonymousId="anonymous_id",n.DistinctId="distinct_id",n.Props="props",n.EnablePersonProcessing="enable_person_processing",n.PersonMode="person_mode",n.FeatureFlagDetails="feature_flag_details",n.FeatureFlags="feature_flags",n.FeatureFlagPayloads="feature_flag_payloads",n.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",n.BootstrapFeatureFlags="bootstrap_feature_flags",n.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",n.OverrideFeatureFlags="override_feature_flags",n.Queue="queue",n.OptedOut="opted_out",n.SessionId="session_id",n.SessionStartTimestamp="session_start_timestamp",n.SessionLastTimestamp="session_timestamp",n.PersonProperties="person_properties",n.GroupProperties="group_properties",n.InstalledAppBuild="installed_app_build",n.InstalledAppVersion="installed_app_version",n.SessionReplay="session_replay",n.SurveyLastSeenDate="survey_last_seen_date",n.SurveysSeen="surveys_seen",n.Surveys="surveys",n.RemoteConfig="remote_config",n.FlagsEndpointWasHit="flags_endpoint_was_hit",n);let v={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",TIMEOUT:"timeout",CONNECTION_ERROR:"connection_error",UNKNOWN_ERROR:"unknown_error",apiError:e=>`api_error_${e}`},b=Array.isArray,_=Object.prototype;_.hasOwnProperty;let w=_.toString,E=b||function(e){return"[object Array]"===w.call(e)},F=e=>"[object String]"==w.call(e);function P(e){return null===e||"object"!=typeof e}function x(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function S(e){return"u">typeof Event&&function(e,t){try{return e instanceof t}catch{return!1}}(e,Event)}let k="Android",C="BlackBerry",I="Nintendo",$="PlayStation",O="Xbox",A="Windows",R="(\\d+(\\.\\d+)?)";RegExp("Version/"+R),RegExp(O,"i"),RegExp($+" \\w+","i"),RegExp(I+" \\w+","i"),RegExp(C+"|PlayBook|BB10","i");async function T(e,t){let r=null;for(let i=0;i<t.retryCount+1;i++){i>0&&await new Promise(e=>setTimeout(e,t.retryDelay));try{return await e()}catch(e){if(r=e,!t.retryCheck(e))throw e}}throw r}function L(){return new Date().toISOString()}function M(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}RegExp("rv:"+R),RegExp("Edge?\\/"+R),RegExp("(Chrome|CrMo)\\/"+R),RegExp("CriOS\\/"+R),RegExp("(UCBrowser|UCWEB)\\/"+R),RegExp("(Opera|OPR)\\/"+R),RegExp("Firefox\\/"+R),RegExp("FxiOS\\/"+R),RegExp("Konqueror[:/]?"+R,"i"),RegExp(C+" "+R),RegExp("android\\s"+R,"i"),RegExp("SamsungBrowser\\/"+R),RegExp("(rv:|MSIE )"+R),RegExp("rv:"+R),RegExp(O+"; "+O+" (.*?)[);]","i"),RegExp(I,"i"),RegExp($,"i"),RegExp(A,"i"),RegExp("("+k+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+k+")","i");let j=e=>e instanceof Error;function D(e){return Promise.all(e.map(e=>(e??Promise.resolve()).then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))))}class U{constructor(){this.events={},this.events={}}on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter(e=>e!==t)}}emit(e,t){for(let r of this.events[e]||[])r(t);for(let r of this.events["*"]||[])r(e,t)}}class B{add(e){let t=y().toString();return this.promiseByIds[t]=e,e.catch(()=>{}).finally(()=>{delete this.promiseByIds[t]}),e}async join(){let e=Object.values(this.promiseByIds),t=e.length;for(;t>0;)await Promise.all(e),t=(e=Object.values(this.promiseByIds)).length}get length(){return Object.keys(this.promiseByIds).length}constructor(){this.promiseByIds={}}}let q=(e,t,r)=>{function i(s,...a){t(()=>{(0,r[s])(e,...a)})}return{info:(...e)=>{i("log",...e)},warn:(...e)=>{i("warn",...e)},error:(...e)=>{i("error",...e)},critical:(...t)=>{r.error(e,...t)},createLogger:i=>q(`${e} ${i}`,t,r)}};class H extends Error{constructor(e,t){super("HTTP error while fetching PostHog: status="+e.status+", reqByteLength="+t),this.response=e,this.reqByteLength=t,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}}class N extends Error{constructor(e){super("Network error while fetching PostHog",e instanceof Error?{cause:e}:{}),this.error=e,this.name="PostHogFetchNetworkError"}}async function G(e){if(e instanceof H){let t="";try{t=await e.text}catch{}console.error(`Error while flushing PostHog: message=${e.message}, response body=${t}`,e)}else console.error("Error while flushing PostHog",e);return Promise.resolve()}function z(e){return"object"==typeof e&&(e instanceof H||e instanceof N)}function W(e){return"object"==typeof e&&e instanceof H&&413===e.status}class K{constructor(e,t={}){this.flushPromise=null,this.shutdownPromise=null,this.promiseQueue=new B,this._events=new U,this._isInitialized=!1,function(e,t){if(!e||"string"!=typeof e||0===e.trim().length)throw Error(t)}(e,"You must pass your PostHog project's api key."),this.apiKey=e,this.host=function(e){return e?.replace(/\/+$/,"")}(t.host||"https://us.i.posthog.com"),this.flushAt=t.flushAt?Math.max(t.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,t.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,t.maxQueueSize??1e3),this.flushInterval=t.flushInterval??1e4,this.preloadFeatureFlags=t.preloadFeatureFlags??!0,this.defaultOptIn=t.defaultOptIn??!0,this.disableSurveys=t.disableSurveys??!1,this._retryOptions={retryCount:t.fetchRetryCount??3,retryDelay:t.fetchRetryDelay??3e3,retryCheck:z},this.requestTimeout=t.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=t.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=t.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=t.disableGeoip??!0,this.disabled=t.disabled??!1,this.historicalMigration=t?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0,this._logger=function(e,t=e=>e()){return q(e,t,function(e=console){return{log:e.log.bind(e),warn:e.warn.bind(e),error:e.error.bind(e),debug:e.debug.bind(e)}}())}("[PostHog]",this.logMsgIfDebug.bind(this)),this.evaluationContexts=t?.evaluationContexts??t?.evaluationEnvironments,t?.evaluationEnvironments&&!t?.evaluationContexts&&this._logger.warn("evaluationEnvironments is deprecated. Use evaluationContexts instead. This property will be removed in a future version."),this.disableCompression=!("CompressionStream"in globalThis)||(t?.disableCompression??!1)}logMsgIfDebug(e){this.isDebug&&e()}wrap(e){return this.disabled?void this._logger.warn("The client is disabled"):this._isInitialized?e():void this._initPromise.then(()=>e())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(m.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(m.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(m.OptedOut,!0)})}on(e,t){return this._events.on(e,t)}debug(e=!0){if(this.removeDebugCallback?.(),e){let e=this.on("*",(e,t)=>this._logger.info(e,t));this.removeDebugCallback=()=>{e(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(e){return{distinct_id:e.distinct_id,event:e.event,properties:{...e.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(e){return this.promiseQueue.add(e)}identifyStateless(e,t,r){this.wrap(()=>{let i={...this.buildPayload({distinct_id:e,event:"$identify",properties:t})};this.enqueue("identify",i,r)})}async identifyStatelessImmediate(e,t,r){let i={...this.buildPayload({distinct_id:e,event:"$identify",properties:t})};await this.sendImmediate("identify",i,r)}captureStateless(e,t,r,i){this.wrap(()=>{let s=this.buildPayload({distinct_id:e,event:t,properties:r});this.enqueue("capture",s,i)})}async captureStatelessImmediate(e,t,r,i){let s=this.buildPayload({distinct_id:e,event:t,properties:r});await this.sendImmediate("capture",s,i)}aliasStateless(e,t,r,i){this.wrap(()=>{let s=this.buildPayload({event:"$create_alias",distinct_id:t,properties:{...r||{},distinct_id:t,alias:e}});this.enqueue("alias",s,i)})}async aliasStatelessImmediate(e,t,r,i){let s=this.buildPayload({event:"$create_alias",distinct_id:t,properties:{...r||{},distinct_id:t,alias:e}});await this.sendImmediate("alias",s,i)}groupIdentifyStateless(e,t,r,i,s,a){this.wrap(()=>{let n=this.buildPayload({distinct_id:s||`$${e}_${t}`,event:"$groupidentify",properties:{$group_type:e,$group_key:t,$group_set:r||{},...a||{}}});this.enqueue("capture",n,i)})}async getRemoteConfig(){await this._initPromise;let e=this.host;"https://us.i.posthog.com"===e?e="https://us-assets.i.posthog.com":"https://eu.i.posthog.com"===e&&(e="https://eu-assets.i.posthog.com");let t=`${e}/array/${this.apiKey}/config`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(t,r,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(e=>e.json()).catch(e=>{this._logger.error("Remote config could not be loaded",e),this._events.emit("error",e)})}async getFlags(e,t={},r={},i={},s={},a=!1){await this._initPromise;let n=`${this.host}/flags/?v=2${a?"&config=true":""}`,o={token:this.apiKey,distinct_id:e,groups:t,person_properties:r,group_properties:i,...s};this.evaluationContexts&&this.evaluationContexts.length>0&&(o.evaluation_contexts=this.evaluationContexts);let l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify(o)};return this._logger.info("Flags URL",n),this.fetchWithRetry(n,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(e=>e.json()).then(e=>({success:!0,response:(e=>{if("flags"in e){let t,r=Object.fromEntries(Object.entries(e.flags??{}).map(([e,t])=>[e,u(t)]).filter(([,e])=>void 0!==e)),i=Object.fromEntries(Object.keys(t=e.flags??{}).filter(e=>{let r=t[e];return r.enabled&&r.metadata&&void 0!==r.metadata.payload}).map(e=>{let r=t[e].metadata?.payload;return[e,r?c(r):void 0]}));return{...e,featureFlags:r,featureFlagPayloads:i}}{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([e,t])=>[e,c(t)])),i=Object.fromEntries(Object.entries(t).map(([e,t])=>{var i,s;return[e,{key:e,enabled:"string"==typeof(i=t)||i,variant:"string"==typeof i?i:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:(s=r[e])?JSON.stringify(s):void 0,description:void 0}}]}));return{...e,featureFlags:t,featureFlagPayloads:r,flags:i}}})(e)})).catch(e=>(this._events.emit("error",e),{success:!1,error:this.categorizeRequestError(e)}))}categorizeRequestError(e){if(e instanceof H)return{type:"api_error",statusCode:e.status};if(e instanceof N){let t=e.error;return t instanceof Error&&("AbortError"===t.name||"TimeoutError"===t.name)?{type:"timeout"}:{type:"connection_error"}}return{type:"unknown_error"}}async getFeatureFlagStateless(e,t,r={},i={},s={},a){await this._initPromise;let n=await this.getFeatureFlagDetailStateless(e,t,r,i,s,a);if(void 0===n)return{response:void 0,requestId:void 0};let o=u(n.response);return void 0===o&&(o=!1),{response:o,requestId:n.requestId}}async getFeatureFlagDetailStateless(e,t,r={},i={},s={},a){await this._initPromise;let n=await this.getFeatureFlagDetailsStateless(t,r,i,s,a,[e]);if(void 0!==n)return{response:n.flags[e],requestId:n.requestId,evaluatedAt:n.evaluatedAt}}async getFeatureFlagPayloadStateless(e,t,r={},i={},s={},a){await this._initPromise;let n=await this.getFeatureFlagPayloadsStateless(t,r,i,s,a,[e]);if(!n)return;let o=n[e];return void 0===o?null:o}async getFeatureFlagPayloadsStateless(e,t={},r={},i={},s,a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(e,t,r,i,s,a)).payloads}async getFeatureFlagsStateless(e,t={},r={},i={},s,a){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(e,t,r,i,s,a)}async getFeatureFlagsAndPayloadsStateless(e,t={},r={},i={},s,a){await this._initPromise;let n=await this.getFeatureFlagDetailsStateless(e,t,r,i,s,a);return n?{flags:n.featureFlags,payloads:n.featureFlagPayloads,requestId:n.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(e,t={},r={},i={},s,a){await this._initPromise;let n={};(s??this.disableGeoip)&&(n.geoip_disable=!0),a&&(n.flag_keys_to_evaluate=a);let o=await this.getFlags(e,t,r,i,n);if(!o.success)return;let l=o.response;return(l.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),l.quotaLimited?.includes("feature_flags"))?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:l?.requestId,quotaLimited:l.quotaLimited}):l}async getSurveysStateless(){if(await this._initPromise,!0===this.disableSurveys)return this._logger.info("Loading surveys is disabled."),[];let e=`${this.host}/api/surveys/?token=${this.apiKey}`,t={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},r=await this.fetchWithRetry(e,t).then(e=>{if(200!==e.status||!e.json){let t=`Surveys API could not be loaded: ${e.status}`,r=Error(t);this._logger.error(r),this._events.emit("error",Error(t));return}return e.json()}).catch(e=>{this._logger.error("Surveys API could not be loaded",e),this._events.emit("error",e)}),i=r?.surveys;return i&&this._logger.info("Surveys fetched from API: ",JSON.stringify(i)),i??[]}get props(){return this._props||(this._props=this.getPersistedProperty(m.Props)),this._props||{}}set props(e){this._props=e}async register(e){this.wrap(()=>{this.props={...this.props,...e},this.setPersistedProperty(m.Props,this.props)})}async unregister(e){this.wrap(()=>{delete this.props[e],this.setPersistedProperty(m.Props,this.props)})}processBeforeEnqueue(e){return e}async flushStorage(){}enqueue(e,t,r){this.wrap(()=>{if(this.optedOut)return void this._events.emit(e,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(e,t,r);if(null===(i=this.processBeforeEnqueue(i)))return;let s=this.getPersistedProperty(m.Queue)||[];s.length>=this.maxQueueSize&&(s.shift(),this._logger.info("Queue is full, the oldest event is dropped.")),s.push({message:i}),this.setPersistedProperty(m.Queue,s),this._events.emit(e,i),s.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=M(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(e,t,r){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized||await this._initPromise,this.optedOut)return void this._events.emit(e,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(e,t,r);if(null===(i=this.processBeforeEnqueue(i)))return;let s={api_key:this.apiKey,batch:[i],sent_at:L()};this.historicalMigration&&(s.historical_migration=!0);let a=JSON.stringify(s),n=`${this.host}/batch/`,o=this.disableCompression?null:await h(a,this.isDebug),l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...null!==o&&{"Content-Encoding":"gzip"}},body:o||a};try{await this.fetchWithRetry(n,l)}catch(e){this._events.emit("error",e)}}prepareMessage(e,t,r){let i={...t,type:e,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:r?.timestamp?r?.timestamp:L(),uuid:r?.uuid?r.uuid:y().toString()};return(r?.disableGeoip??this.disableGeoip)&&(i.properties||(i.properties={}),i.properties.$geoip_disable=!0),i.distinctId&&(i.distinct_id=i.distinctId,delete i.distinctId),i}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async e=>{await G(e)})}async flush(){let e=D([this.flushPromise]).then(()=>this._flush());return this.flushPromise=e,this.addPendingPromise(e),D([e]).then(()=>{this.flushPromise===e&&(this.flushPromise=null)}),e}getCustomHeaders(){let e=this.getCustomUserAgent(),t={};return e&&""!==e&&(t["User-Agent"]=e),t}async _flush(){this.clearFlushTimer(),await this._initPromise;let e=this.getPersistedProperty(m.Queue)||[];if(!e.length)return;let t=[],r=e.length;for(;e.length>0&&t.length<r;){let r=e.slice(0,this.maxBatchSize),i=r.map(e=>e.message),s=async()=>{let t=(this.getPersistedProperty(m.Queue)||[]).slice(r.length);this.setPersistedProperty(m.Queue,t),e=t,await this.flushStorage()},a={api_key:this.apiKey,batch:i,sent_at:L()};this.historicalMigration&&(a.historical_migration=!0);let n=JSON.stringify(a),o=`${this.host}/batch/`,l=this.disableCompression?null:await h(n,this.isDebug),u={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...null!==l&&{"Content-Encoding":"gzip"}},body:l||n},c={retryCheck:e=>!W(e)&&z(e)};try{await this.fetchWithRetry(o,u,c)}catch(e){if(W(e)&&i.length>1){this.maxBatchSize=Math.max(1,Math.floor(i.length/2)),this._logger.warn(`Received 413 when sending batch of size ${i.length}, reducing batch size to ${this.maxBatchSize}`);continue}throw e instanceof N||await s(),this._events.emit("error",e),e}await s(),t.push(...i)}this._events.emit("flush",t)}async fetchWithRetry(e,t,r,i){let s=t.body?t.body:"",a=-1;try{a=s instanceof Blob?s.size:Buffer.byteLength(s,"utf8")}catch{a=s instanceof Blob?s.size:new TextEncoder().encode(s).length}return await T(async()=>{let r=new AbortController,s=M(()=>r.abort(),i??this.requestTimeout),n=null;try{n=await this.fetch(e,{signal:r.signal,...t})}catch(e){throw new N(e)}finally{clearTimeout(s)}if("no-cors"!==t.mode&&(n.status<200||n.status>=400))throw new H(n,a);return n},{...this._retryOptions,...r})}async _shutdown(e=3e4){let t;await this._initPromise;let r=!1;this.clearFlushTimer();let i=async()=>{try{for(await this.promiseQueue.join();;){let e=this.getPersistedProperty(m.Queue)||[];if(0===e.length||(await this.flush(),r))break}}catch(e){if(!z(e))throw e;await G(e)}};try{return await Promise.race([new Promise((i,s)=>{t=M(()=>{this._logger.error("Timed out while shutting down PostHog"),r=!0,s("Timeout while shutting down PostHog. Some events may not have been sent.")},e)}),i()])}finally{clearTimeout(t)}}async shutdown(e=3e4){return this.shutdownPromise?this._logger.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup"):this.shutdownPromise=this._shutdown(e).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}}class V{constructor(e,t,r=[]){this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t={}){let r=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,t,0).apply(e),s=this.buildParsingContext(t),a=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(a,r),$exception_level:"error"}}async modifyFrames(e){for(let t of e)t.stacktrace&&t.stacktrace.frames&&E(t.stacktrace.frames)&&(t.stacktrace.frames=await this.applyModifiers(t.stacktrace.frames));return e}coerceFallback(e){return{type:"Error",value:"Unknown error",stack:e.syntheticException?.stack,synthetic:!0}}parseStacktrace(e,t){let r,i;return null!=e.cause&&(r=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),{...e,cause:r,stack:i}}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(let r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}async applyModifiers(e){let t=e;for(let e of this.modifiers)t=await e(t);return t}convertToExceptionList(e,t){let r={type:e.type,value:e.value,mechanism:{type:t.type??"generic",handled:t.handled??!0,synthetic:e.synthetic??!1}};e.stack&&(r.stacktrace={type:"raw",frames:e.stack});let i=[r];return null!=e.cause&&i.push(...this.convertToExceptionList(e.cause,{...t,handled:!0})),i}buildParsingContext(e){return{chunkIdMap:function(e){let t=globalThis._posthogChunkIds;if(!t)return;let a=Object.keys(t);return s&&a.length===i?s:(i=a.length,s=a.reduce((i,s)=>{r||(r={});let a=r[s];if(a)i[a[0]]=a[1];else{let a=e(s);for(let e=a.length-1;e>=0;e--){let n=a[e],o=n?.filename,l=t[s];if(o&&l){i[o]=l,r[s]=[o,l];break}}}return i},{}))}(this.stackParser),skipFirstLines:e.skipFirstLines??1}}buildCoercingContext(e,t,r=0){let i=(r,i)=>{if(i<=4){let s=this.buildCoercingContext(e,t,i);return this.applyCoercers(r,s)}};return{...t,syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>i(e,r),next:e=>i(e,r+1)}}}function Q(e,t,r,i,s){let a={platform:e,filename:t,function:"<anonymous>"===r?"?":r,in_app:!0};return void 0!==i&&(a.lineno=i),void 0!==s&&(a.colno=s),a}e.s(["ErrorPropertiesBuilder",0,V],80446);let J=(e,t)=>{let r=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return r||i?[-1!==e.indexOf("@")?e.split("@")[0]:"?",r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Y=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Z=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,X=/\((\S*)(?::(\d+))(?::(\d+))\)/,ee=(e,t)=>{let r=Y.exec(e);if(r){let[,e,i,s]=r;return Q(t,e,"?",+i,+s)}let i=Z.exec(e);if(i){if(i[2]&&0===i[2].indexOf("eval")){let e=X.exec(i[2]);e&&(i[2]=e[1],i[3]=e[2],i[4]=e[3])}let[e,r]=J(i[1]||"?",i[2]);return Q(t,r,e,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},et=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,er=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ei=(e,t)=>{let r=et.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){let e=er.exec(r[3]);e&&(r[1]=r[1]||"eval",r[3]=e[1],r[4]=e[2],r[5]="")}let e=r[3],i=r[1]||"?";return[i,e]=J(i,e),Q(t,e,i,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},es=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,ea=(e,t)=>{let r=es.exec(e);return r?Q(t,r[2],r[1]||"?",+r[3],r[4]?+r[4]:void 0):void 0},en=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,eo=(e,t)=>{let r=en.exec(e);return r?Q(t,r[2],r[3]||"?",+r[1]):void 0},el=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,eu=(e,t)=>{let r=el.exec(e);return r?Q(t,r[5],r[3]||r[4]||"?",+r[1],+r[2]):void 0},ec=/^\s*[-]{4,}$/,eh=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,ed=(e,t)=>{let r=e.match(eh);if(r){let e,i,s,a,n;if(r[1]){let t=(s=r[1]).lastIndexOf(".");if("."===s[t-1]&&t--,t>0){e=s.slice(0,t),i=s.slice(t+1);let r=e.indexOf(".Module");r>0&&(s=s.slice(r+1),e=e.slice(0,r))}a=void 0}i&&(a=e,n=i),"<anonymous>"===i&&(n=void 0,s=void 0),void 0===s&&(n=n||"?",s=a?`${a}.${n}`:n);let o=r[2]?.startsWith("file://")?r[2].slice(7):r[2],l="native"===r[5];return o?.match(/\/[A-Z]:/)&&(o=o.slice(1)),o||!r[5]||l||(o=r[5]),{filename:o?decodeURI(o):void 0,module:void 0,function:s,lineno:eg(r[3]),colno:eg(r[4]),in_app:function(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&void 0!==e&&!e.includes("node_modules/")}(o||"",l),platform:t}}if(e.match(ec))return{filename:e,platform:t}};function eg(e){return parseInt(e||"",10)||void 0}let ep=/\(error: (.*)\)/;function ef(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{var r;return{...e,filename:e.filename||((r=t)[r.length-1]||{}).filename,function:e.function||"?"}})}function ey(){return em("web:javascript",ee,ei)}function em(e,...t){return(r,i=0)=>{let s=[],a=r.split("\n");for(let r=i;r<a.length;r++){let i=a[r];if(i.length>1024)continue;let n=ep.test(i)?i.replace(ep,"$1"):i;if(!n.match(/\S*Error: /)){for(let r of t){let t=r(n,e);if(t){s.push(t);break}}if(s.length>=50)break}}return ef(s)}}e.s(["createDefaultStackParser",0,ey,"createStackParser",0,em,"reverseAndStripFrames",0,ef],34246);class ev{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){let r=F(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){let t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return x(e,"DOMException")}isDOMError(e){return x(e,"DOMError")}}e.s(["DOMExceptionCoercer",0,ev],29569);class eb{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){let r=e.message;return r.error&&"string"==typeof r.error.message?String(r.error.message):String(r)}getStack(e){return e.stacktrace||e.stack||void 0}}e.s(["ErrorCoercer",0,eb],11475);class e_{match(e){return x(e,"ErrorEvent")&&void 0!=e.error}coerce(e,t){let r=t.apply(e.error);return r||{type:"ErrorEvent",value:e.message,stack:t.syntheticException?.stack,synthetic:!0}}}e.s(["ErrorEventCoercer",0,e_],43179);let ew=["fatal","error","warning","log","info","debug"];function eE(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let e=r.length;e>0;e--){let i=r.slice(0,e).join(", ");if(!(i.length>t)){if(e===r.length)return i;return i.length<=t?i:`${i.slice(0,t)}...`}}return""}class eF{match(e){return"object"==typeof e&&null!==e}coerce(e,t){let r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:t.syntheticException?.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return S(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){let 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;let t=this.getObjectClassName(e),r=eE(e);return`${t&&"Object"!==t?`'${t}'`:"Object"} captured as exception with keys: ${r}`}isSeverityLevel(e){return F(e)&&!(F(e)&&0===e.trim().length)&&ew.indexOf(e)>=0}getErrorPropertyFromObject(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(j(r))return r}}getObjectClassName(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}e.s(["ObjectCoercer",0,eF],6881);class eP{match(e){return S(e)}coerce(e,t){let r=e.constructor.name;return{type:r,value:`${r} captured as exception with keys: ${eE(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}}e.s(["EventCoercer",0,eP],80322);class ex{match(e){return P(e)}coerce(e,t){return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}}e.s(["PrimitiveCoercer",0,ex],80049);class eS{match(e){return x(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!S(e))return!1;try{let t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch{return!1}}coerce(e,t){let r=this.getUnhandledRejectionReason(e);return P(r)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(r)}`,stack:t.syntheticException?.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch{}return e}}e.s(["PromiseRejectionEventCoercer",0,eS],98689),e.s([],99573),e.s([],47114),e.i(47114),e.i(80446),e.i(34246),e.s(["chromeStackLineParser",0,ee,"createDefaultStackParser",0,ey,"createStackParser",0,em,"geckoStackLineParser",0,ei,"nodeStackLineParser",0,ed,"opera10StackLineParser",0,eo,"opera11StackLineParser",0,eu,"reverseAndStripFrames",0,ef,"winjsStackLineParser",0,ea],70736),e.i(70736),e.i(99573),e.i(29569),e.i(11475),e.i(43179);let ek=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class eC{match(e){return"string"==typeof e}coerce(e,t){let[r,i]=this.getInfos(e);return{type:r??"Error",value:i??e,stack:t.syntheticException?.stack,synthetic:!0}}getInfos(e){let t="Error",r=e,i=e.match(ek);return i&&(t=i[1],r=i[2]),[t,r]}}e.s(["StringCoercer",0,eC],45098),e.i(45098),e.i(6881),e.i(80322),e.i(80049),e.i(98689),e.s(["DOMExceptionCoercer",0,ev,"ErrorCoercer",0,eb,"ErrorEventCoercer",0,e_,"EventCoercer",0,eP,"ObjectCoercer",0,eF,"PrimitiveCoercer",0,ex,"PromiseRejectionEventCoercer",0,eS,"StringCoercer",0,eC],21854),e.i(21854);class eI{constructor(e){this._maxSize=e,this._cache=new Map}get(e){let t=this._cache.get(e);if(void 0!==t)return this._cache.delete(e),this._cache.set(e,t),t}set(e,t){this._cache.set(e,t)}reduce(){for(;this._cache.size>=this._maxSize;){let e=this._cache.keys().next().value;e&&this._cache.delete(e)}}}e.s(["ReduceableCache",0,eI],46986),e.i(46986),e.s(["DOMExceptionCoercer",0,ev,"ErrorCoercer",0,eb,"ErrorEventCoercer",0,e_,"ErrorPropertiesBuilder",0,V,"EventCoercer",0,eP,"ObjectCoercer",0,eF,"PrimitiveCoercer",0,ex,"PromiseRejectionEventCoercer",0,eS,"ReduceableCache",0,eI,"StringCoercer",0,eC,"chromeStackLineParser",0,ee,"createDefaultStackParser",0,ey,"createStackParser",0,em,"geckoStackLineParser",0,ei,"nodeStackLineParser",0,ed,"opera10StackLineParser",0,eo,"opera11StackLineParser",0,eu,"reverseAndStripFrames",0,ef,"winjsStackLineParser",0,ea],96117);var e$=e.i(96117),eO=e$,eA=e.i(2157),eR=e.i(1457);let eT=new eO.ReduceableCache(25),eL=new eO.ReduceableCache(20);async function eM(e){let t={};for(let s=e.length-1;s>=0;s--){var r,i;let a=e[s],n=a?.filename;!(!a||"string"!=typeof n||"number"!=typeof a.lineno||(r=n).startsWith("node:")||r.endsWith(".min.js")||r.endsWith(".min.cjs")||r.endsWith(".min.mjs")||r.startsWith("data:")||void 0!==(i=a).lineno&&i.lineno>1e4||void 0!==i.colno&&i.colno>1e3)&&(t[n]||(t[n]=[]),t[n].push(a.lineno))}let s=Object.keys(t);if(0==s.length)return e;let a=[];for(let e of s){if(eL.get(e))continue;let r=t[e];if(!r)continue;r.sort((e,t)=>e-t);let i=function(e){if(!e.length)return[];let t=0,r=e[0];if("number"!=typeof r)return[];let i=eD(r),s=[];for(;;){if(t===e.length-1){s.push(i);break}let r=e[t+1];if("number"!=typeof r)break;r<=i[1]?i[1]=r+7:(s.push(i),i=eD(r)),t++}return s}(r);if(i.every(t=>(function(e,t){let r=eT.get(e);if(void 0===r)return!1;for(let e=t[0];e<=t[1];e++)if(void 0===r[e])return!1;return!0})(e,t)))continue;let s=function(e,t,r){let i=e.get(t);return void 0===i?(e.set(t,r),r):i}(eT,e,{});a.push(function(e,t,r){return new Promise(i=>{let s=(0,eA.createReadStream)(e),a=(0,eR.createInterface)({input:s});function n(){s.destroy(),i()}let o=0,l=0,u=t[0];if(void 0===u)return void n();let c=u[0],h=u[1];function d(){eL.set(e,1),a.close(),a.removeAllListeners(),n()}s.on("error",d),a.on("error",d),a.on("close",n),a.on("line",e=>{if(!(++o<c)&&(r[o]=function(e,t){let r=e,i=r.length;if(i<=150)return r;t>i&&(t=i);let s=Math.max(t-60,0);s<5&&(s=0);let a=Math.min(s+140,i);return a>i-5&&(a=i),a===i&&(s=Math.max(a-140,0)),r=r.slice(s,a),s>0&&(r=`...${r}`),a<i&&(r+="..."),r}(e,0),o>=h)){if(l===t.length-1){a.close(),a.removeAllListeners();return}let e=t[++l];if(void 0===e){a.close(),a.removeAllListeners();return}c=e[0],h=e[1]}})})}(e,i,s))}return await Promise.all(a).catch(()=>{}),e&&e.length>0&&function(e,t){for(let r of e)if(r.filename&&void 0===r.context_line&&"number"==typeof r.lineno){let e=t.get(r.filename);if(void 0===e)continue;!function(e,t,r){if(void 0===t.lineno||void 0===r)return;t.pre_context=[];for(let i=eU(e);i<e;i++){let e=r[i];if(void 0===e)return void ej(t);t.pre_context.push(e)}if(void 0===r[e])return ej(t);t.context_line=r[e];let i=function(e){return e+7}(e);t.post_context=[];for(let s=e+1;s<=i;s++){let e=r[s];if(void 0===e)break;t.post_context.push(e)}}(r.lineno,r,e)}}(e,eT),eT.reduce(),e}function ej(e){delete e.pre_context,delete e.context_line,delete e.post_context}function eD(e){return[eU(e),e+7]}function eU(e){return Math.max(1,e-7)}function eB(e,t,r,i,s){if(t>r&&(i.warn("min cannot be greater than max."),t=r),"[object Number]"==w.call(e)&&e==e)if(e>r)return i.warn(" cannot be greater than max: "+r+". Using max value instead."),r;else return e<t?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e;return i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+s),eB(s||r,t,r,i)}class eq{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=eB(e.bucketSize,0,100,e._logger),this._refillRate=eB(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=eB(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){let r=Math.floor((t-e.lastAccess)/this._refillInterval);if(r>0){let t=r*this._refillRate;e.tokens=Math.min(e.tokens+t,this._bucketSize),e.lastAccess=e.lastAccess+r*this._refillInterval}}consumeRateLimit(e){let t=Date.now(),r=String(e),i=this._buckets[r];return i?this._applyRefill(i,t):(i={tokens:this._bucketSize,lastAccess:t},this._buckets[r]=i),0===i.tokens||(i.tokens--,0===i.tokens&&this._onBucketRateLimited?.(e),0===i.tokens)}stop(){this._buckets={}}}class eH{constructor(e,t,r){this.client=e,this._exceptionAutocaptureEnabled=t.enableExceptionAutocapture||!1,this._logger=r,this._rateLimiter=new eq({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(e){return e===Object(e)&&!E(e)&&"__posthog_previously_captured_error"in e&&!0===e.__posthog_previously_captured_error}static async buildEventMessage(e,t,r,i){let s={...i},a=this.errorPropertiesBuilder.buildFromUnknown(e,t);return a.$exception_list=await this.errorPropertiesBuilder.modifyFrames(a.$exception_list),{event:"$exception",distinctId:r,properties:{...a,...s},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){if(this.isEnabled()){var t,r,i;let s;t=this.onException.bind(this),r=this.onFatalError.bind(this),globalThis.process?.on("uncaughtException",(s=!1,Object.assign(i=>{let a=e.g.process.listeners("uncaughtException").filter(e=>"domainUncaughtExceptionClear"!==e.name&&!0!==e._posthogErrorHandler).length;t(i,{mechanism:{type:"onuncaughtexception",handled:!1}}),s||0!==a||(s=!0,r(i))},{_posthogErrorHandler:!0}))),i=this.onException.bind(this),globalThis.process?.on("unhandledRejection",e=>i(e,{mechanism:{type:"onunhandledrejection",handled:!1}}))}}onException(e,t){this.client.addPendingPromise((async()=>{if(!eH.isPreviouslyCapturedError(e)){let r=await eH.buildEventMessage(e,t),i=r.properties,s=i?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(s)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:s}):this.client.capture(r)}})())}async onFatalError(e){console.error(e),await this.client.shutdown(2e3),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}}let eN=["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"],eG=function(e,t=[]){if(!e)return!1;let r=e.toLowerCase();return eN.concat(t).some(e=>{let t=e.toLowerCase();return -1!==r.indexOf(t)})},ez={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function eW(e){let t=globalThis.crypto?.subtle;if(!t)throw Error("SubtleCrypto API not available");return Array.from(new Uint8Array(await t.digest("SHA-1",new TextEncoder().encode(e)))).map(e=>e.toString(16).padStart(2,"0")).join("")}e.s(["FeatureFlagError",0,ez],58325);let eK=["is_not"];class eV extends Error{constructor(e){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=e,Object.setPrototypeOf(this,eV.prototype)}}class eQ extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,eQ.prototype)}}class eJ extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,eJ.prototype)}}class eY{constructor({pollingInterval:e,personalApiKey:t,projectApiKey:r,timeout:i,host:s,customHeaders:a,...n}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=e,this.personalApiKey=t,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=r,this.host=s,this.poller=void 0,this.fetch=n.fetch||fetch,this.onError=n.onError,this.customHeaders=a,this.onLoad=n.onLoad,this.cacheProvider=n.cacheProvider,this.strictLocalEvaluation=n.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(e=!0){this.debugMode=e}logMsgIfDebug(e){this.debugMode&&e()}createEvaluationContext(e,t={},r={},i={},s={}){return{distinctId:e,groups:t,personProperties:r,groupProperties:i,evaluationCache:s}}async getFeatureFlag(e,t,r={},i={},s={}){let a,n;if(await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return a;if(void 0!==(n=this.featureFlagsByKey[e])){let o=this.createEvaluationContext(t,r,i,s);try{a=(await this.computeFlagAndPayloadLocally(n,o)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${e} -> ${a}`))}catch(t){t instanceof eJ||t instanceof eQ?this.logMsgIfDebug(()=>console.debug(`${t.name} when computing flag locally: ${e}: ${t.message}`)):t instanceof Error&&this.onError?.(Error(`Error computing flag locally: ${e}: ${t}`))}}return a}async getAllFlagsAndPayloads(e,t){await this.loadFeatureFlags();let r={},i={},s=0==this.featureFlags.length,a=t?t.map(e=>this.featureFlagsByKey[e]).filter(Boolean):this.featureFlags,n={...e,evaluationCache:e.evaluationCache??{}};return await Promise.all(a.map(async e=>{try{let{value:t,payload:s}=await this.computeFlagAndPayloadLocally(e,n);r[e.key]=t,s&&(i[e.key]=s)}catch(t){t instanceof eJ||t instanceof eQ?this.logMsgIfDebug(()=>console.debug(`${t.name} when computing flag locally: ${e.key}: ${t.message}`)):t instanceof Error&&this.onError?.(Error(`Error computing flag locally: ${e.key}: ${t}`)),s=!0}})),{response:r,payloads:i,fallbackToFlags:s}}async computeFlagAndPayloadLocally(e,t,r={}){let i,{matchValue:s,skipLoadCheck:a=!1}=r;if(a||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};i=void 0!==s?s:await this.computeFlagValueLocally(e,t);let n=this.getFeatureFlagPayload(e.key,i);return{value:i,payload:n}}async computeFlagValueLocally(e,t){let{distinctId:r,groups:i,personProperties:s,groupProperties:a}=t;if(e.ensure_experience_continuity)throw new eQ("Flag has experience continuity enabled");if(!e.active)return!1;let n=(e.filters||{}).aggregation_group_type_index;if(void 0!=n){let r=this.groupTypeMapping[String(n)];if(!r)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${n} for feature flag ${e.key}`)),new eQ("Flag has unknown group type index");if(!(r in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${e.key} without group names passed in`)),!1;"device_id"===e.bucketing_identifier&&(s?.$device_id===void 0||s?.$device_id===null||s?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${e.key}`));let o=a[r];return await this.matchFeatureFlagProperties(e,i[r],o,t)}{let i=this.getBucketingValueForFlag(e,r,s);if(void 0===i)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${e.key} without $device_id, falling back to server evaluation`)),new eQ(`Can't compute feature flag: ${e.key} without $device_id`);return await this.matchFeatureFlagProperties(e,i,s,t)}}getBucketingValueForFlag(e,t,r){if(e.filters?.aggregation_group_type_index!=void 0)return t;if("device_id"===e.bucketing_identifier){let e=r?.$device_id;if(null==e||""===e)return;return e}return t}getFeatureFlagPayload(e,t){let r=null;if(!1!==t&&null!=t&&("boolean"==typeof t?r=this.featureFlagsByKey?.[e]?.filters?.payloads?.[t.toString()]||null:"string"==typeof t&&(r=this.featureFlagsByKey?.[e]?.filters?.payloads?.[t]||null),null!=r)){if("object"==typeof r)return r;if("string"==typeof r)try{return JSON.parse(r)}catch{}return r}return null}async evaluateFlagDependency(e,t,r){let{evaluationCache:i}=r,s=e.key;if(!this.featureFlagsByKey)throw new eQ("Feature flags not available for dependency evaluation");if(!("dependency_chain"in e))throw new eQ(`Flag dependency property for '${s}' is missing required 'dependency_chain' field`);let a=e.dependency_chain;if(!Array.isArray(a))throw new eQ(`Flag dependency property for '${s}' has an invalid 'dependency_chain' (expected array, got ${typeof a})`);if(0===a.length)throw new eQ(`Circular dependency detected for flag '${s}' (empty dependency chain)`);for(let e of a){if(!(e in i)){let t=this.featureFlagsByKey[e];if(t)if(t.active)try{let s=await this.computeFlagValueLocally(t,r);i[e]=s}catch(t){throw new eQ(`Error evaluating flag dependency '${e}' for flag '${s}': ${t}`)}else i[e]=!1;else throw new eQ(`Missing flag dependency '${e}' for flag '${s}'`)}if(null==i[e])throw new eQ(`Dependency '${e}' could not be evaluated`)}let n=i[s];return this.flagEvaluatesToExpectedValue(e.value,n)}flagEvaluatesToExpectedValue(e,t){return"boolean"==typeof e?e===t||"string"==typeof t&&""!==t&&!0===e:"string"==typeof e&&t===e}async matchFeatureFlagProperties(e,t,r,i){let s,a=e.filters||{},n=a.groups||[],o=!1;for(let l of n)try{if(await this.isConditionMatch(e,t,l,r,i)){let r=l.variant,i=a.multivariate?.variants||[];s=r&&i.some(e=>e.key===r)?r:await this.getMatchingVariant(e,t)||!0;break}}catch(e){if(e instanceof eJ)throw e;if(e instanceof eQ)o=!0;else throw e}if(void 0!==s)return s;if(o)throw new eQ("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(e,t,r,i,s){let a=r.rollout_percentage,n=e=>{this.logMsgIfDebug(()=>console.warn(e))};if((r.properties||[]).length>0){for(let e of r.properties){let t=e.type;if(!("cohort"===t?function e(t,r,i,s=!1){let a=String(t.value);if(!(a in i))throw new eJ(`cohort ${a} not found in local cohorts - likely a static cohort that requires server evaluation`);return function t(r,i,s,a=!1){if(!r)return!0;let n=r.type,o=r.values;if(!o||0===o.length)return!0;let l=!1;if("values"in o[0]){for(let e of o)try{let r=t(e,i,s,a);if("AND"===n){if(!r)return!1}else if(r)return!0}catch(t){if(t instanceof eJ)throw t;if(t instanceof eQ)a&&console.debug(`Failed to compute property ${e} locally: ${t}`),l=!0;else throw t}if(l)throw new eQ("Can't match cohort without a given cohort property value");return"AND"===n}for(let t of o)try{let r;if("cohort"===t.type)r=e(t,i,s,a);else if("flag"===t.type){a&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${t.key||"unknown"}'`);continue}else r=eX(t,i);let o=t.negation||!1;if("AND"===n){if(!r&&!o||r&&o)return!1}else if(r&&!o||!r&&o)return!0}catch(e){if(e instanceof eJ)throw e;if(e instanceof eQ)a&&console.debug(`Failed to compute property ${t} locally: ${e}`),l=!0;else throw e}if(l)throw new eQ("can't match cohort without a given cohort property value");return"AND"===n}(i[a],r,i,s)}(e,i,this.cohorts,this.debugMode):"flag"===t?await this.evaluateFlagDependency(e,i,s):eX(e,i,n)))return!1}if(void 0==a)return!0}return!(void 0!=a&&await eZ(e.key,t)>a/100)}async getMatchingVariant(e,t){let r=await eZ(e.key,t,"variant"),i=this.variantLookupTable(e).find(e=>r>=e.valueMin&&r<e.valueMax);if(i)return i.key}variantLookupTable(e){let t=[],r=0,i=0,s=e.filters||{};return(s.multivariate?.variants||[]).forEach(e=>{i=r+e.rollout_percentage/100,t.push({valueMin:r,valueMax:i,key:e.key}),r=i}),t}updateFlagState(e){this.featureFlags=e.flags,this.featureFlagsByKey=e.flags.reduce((e,t)=>(e[t.key]=t,e),{}),this.groupTypeMapping=e.groupTypeMapping,this.cohorts=e.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(e){if(this.strictLocalEvaluation)return;let t=e.filter(e=>e.ensure_experience_continuity);t.length>0&&console.warn(`[PostHog] You are using local evaluation but ${t.length} flag(s) have experience continuity enabled: ${t.map(e=>e.key).join(", ")}. Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).`)}async loadFromCache(e){if(!this.cacheProvider)return!1;try{let t=await this.cacheProvider.getFlagDefinitions();if(t)return this.updateFlagState(t),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${e} (${t.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(t.flags),!0;return!1}catch(e){return this.onError?.(Error(`Failed to load from cache: ${e}`)),!1}}async loadFeatureFlags(e=!1){if(!this.loadedSuccessfullyOnce||e)return!e&&this.nextFetchAllowedAt&&Date.now()<this.nextFetchAllowedAt?void this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Skipping fetch, in backoff period")):(this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(e=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${e}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise)}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getFlagDefinitionsLoadedAt(){return this.flagDefinitionsLoadedAt}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(6e4,this.pollingInterval*2**this.backOffCount):this.pollingInterval}beginBackoff(){this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,this.nextFetchAllowedAt=Date.now()+this.getPollingInterval()}clearBackoff(){this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.nextFetchAllowedAt=void 0}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let e=!0;if(this.cacheProvider)try{e=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(e){this.onError?.(Error(`Error in shouldFetchFlagDefinitions: ${e}`))}if(!e&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let t=await this._requestFeatureFlagDefinitions();if(!t)return;switch(t.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=t.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new eV(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.beginBackoff(),new eV(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.beginBackoff(),new eV(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let r=await t.json()??{};if(!("flags"in r))return void this.onError?.(Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`));this.flagsEtag=t.headers?.get("ETag")??void 0;let i={flags:r.flags??[],groupTypeMapping:r.group_type_mapping||{},cohorts:r.cohorts||{}};if(this.updateFlagState(i),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&e)try{await this.cacheProvider.onFlagDefinitionsReceived(i)}catch(e){this.onError?.(Error(`Failed to store in cache: ${e}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(i.flags);break}default:return}}catch(e){e instanceof eV&&this.onError?.(e)}}getPersonalApiKeyRequestOptions(e="GET",t){let r={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return t&&(r["If-None-Match"]=t),{method:e,headers:r}}_requestFeatureFlagDefinitions(){let e=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,t=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),r=null;if(this.timeout&&"number"==typeof this.timeout){let e=new AbortController;r=M(()=>{e.abort()},this.timeout),t.signal=e.signal}try{return(0,this.fetch)(e,t)}finally{clearTimeout(r)}}async stopPoller(e=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let t=this.cacheProvider.shutdown();t instanceof Promise&&await Promise.race([t,new Promise((t,r)=>setTimeout(()=>r(Error(`Cache shutdown timeout after ${e}ms`)),e))])}catch(e){this.onError?.(Error(`Error during cache shutdown: ${e}`))}}}async function eZ(e,t,r=""){return parseInt((await eW(`${e}.${t}${r}`)).slice(0,15),16)/0x1000000000000000}function eX(e,t,r){let i=e.key,s=e.value,a=e.operator||"exact";if(i in t){if("is_not_set"===a)throw new eQ("Operator is_not_set is not supported")}else throw new eQ(`Property ${i} not found in propertyValues`);let n=t[i];if(null==n&&!eK.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function o(e,t){return Array.isArray(e)?e.map(e=>String(e).toLowerCase()).includes(String(t).toLowerCase()):String(e).toLowerCase()===String(t).toLowerCase()}function l(e,t,r){if("gt"===r)return e>t;if("gte"===r)return e>=t;if("lt"===r)return e<t;if("lte"===r)return e<=t;throw Error(`Invalid operator: ${r}`)}switch(a){case"exact":return o(s,n);case"is_not":return!o(s,n);case"is_set":return i in t;case"icontains":return String(n).toLowerCase().includes(String(s).toLowerCase());case"not_icontains":return!String(n).toLowerCase().includes(String(s).toLowerCase());case"regex":return e0(String(s))&&null!==String(n).match(String(s));case"not_regex":return e0(String(s))&&null===String(n).match(String(s));case"gt":case"gte":case"lt":case"lte":{let e="number"==typeof s?s:null;if("string"==typeof s)try{e=parseFloat(s)}catch(e){}if(null==e||null==n)return l(String(n),String(s),a);if("string"==typeof n)return l(n,String(s),a);return l(n,e,a)}case"is_date_after":case"is_date_before":{if("boolean"==typeof s)throw new eQ("Date operations cannot be performed on boolean values");let e=function(e){let t=e.match(/^-?(?<number>[0-9]+)(?<interval>[a-z])$/),r=new Date(new Date().toISOString());if(!t)return null;{if(!t.groups)return null;let e=parseInt(t.groups.number);if(e>=1e4)return null;let i=t.groups.interval;if("h"==i)r.setUTCHours(r.getUTCHours()-e);else if("d"==i)r.setUTCDate(r.getUTCDate()-e);else if("w"==i)r.setUTCDate(r.getUTCDate()-7*e);else if("m"==i)r.setUTCMonth(r.getUTCMonth()-e);else{if("y"!=i)return null;r.setUTCFullYear(r.getUTCFullYear()-e)}return r}}(String(s));if(null==e&&(e=e2(s)),null==e)throw new eQ(`Invalid date: ${s}`);let t=e2(n);if(["is_date_before"].includes(a))return t<e;return t>e}case"semver_eq":return 0===e4(e1(String(n)),e1(String(s)));case"semver_neq":return 0!==e4(e1(String(n)),e1(String(s)));case"semver_gt":return e4(e1(String(n)),e1(String(s)))>0;case"semver_gte":return e4(e1(String(n)),e1(String(s)))>=0;case"semver_lt":return 0>e4(e1(String(n)),e1(String(s)));case"semver_lte":return 0>=e4(e1(String(n)),e1(String(s)));case"semver_tilde":{let e,t=e1(String(n)),{lower:r,upper:i}={lower:[(e=e1(String(s)))[0],e[1],e[2]],upper:[e[0],e[1]+1,0]};return e4(t,r)>=0&&0>e4(t,i)}case"semver_caret":{let e=e1(String(n)),{lower:t,upper:r}=function(e){let[t,r,i]=e1(e);return{lower:[t,r,i],upper:t>0?[t+1,0,0]:r>0?[0,r+1,0]:[0,0,i+1]}}(String(s));return e4(e,t)>=0&&0>e4(e,r)}case"semver_wildcard":{let e=e1(String(n)),{lower:t,upper:r}=function(e){let t,r,i=String(e).trim().replace(/^[vV]/,"").replace(/\.\*$/,"").replace(/\*$/,"");if(!i)throw new eQ(`Invalid wildcard semver: ${e}`);let s=i.split("."),a=parseInt(s[0],10);if(isNaN(a))throw new eQ(`Invalid wildcard semver: ${e}`);if(1===s.length)t=[a,0,0],r=[a+1,0,0];else{let i=parseInt(s[1],10);if(isNaN(i))throw new eQ(`Invalid wildcard semver: ${e}`);t=[a,i,0],r=[a,i+1,0]}return{lower:t,upper:r}}(String(s));return e4(e,t)>=0&&0>e4(e,r)}default:throw new eQ(`Unknown operator: ${a}`)}}function e0(e){try{return new RegExp(e),!0}catch(e){return!1}}function e1(e){let t=String(e).trim().replace(/^[vV]/,"").split("-")[0].split("+")[0];if(!t||t.startsWith("."))throw new eQ(`Invalid semver: ${e}`);let r=t.split("."),i=t=>{if(void 0===t||""===t)return 0;if(!/^\d+$/.test(t))throw new eQ(`Invalid semver: ${e}`);return parseInt(t,10)};return[i(r[0]),i(r[1]),i(r[2])]}function e4(e,t){for(let r=0;r<3;r++){if(e[r]<t[r])return -1;if(e[r]>t[r])return 1}return 0}function e2(e){if(e instanceof Date)return e;if("string"==typeof e||"number"==typeof e){let t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new eQ(`${e} is in an invalid date format`)}throw new eQ(`The date provided ${e} must be a string, number, or date object`)}class e3{getProperty(e){return this._memoryStorage[e]}setProperty(e,t){this._memoryStorage[e]=null!==t?t:void 0}constructor(){this._memoryStorage={}}}class e5 extends K{constructor(e,t={}){if(super(e,t),this._memoryStorage=new e3,this.options=t,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval="number"==typeof t.featureFlagsPollingInterval?Math.max(t.featureFlagsPollingInterval,100):3e4,"number"==typeof t.waitUntilDebounceMs&&(this.options.waitUntilDebounceMs=Math.max(t.waitUntilDebounceMs,0)),"number"==typeof t.waitUntilMaxWaitMs&&(this.options.waitUntilMaxWaitMs=Math.max(t.waitUntilMaxWaitMs,0)),t.personalApiKey){if(t.personalApiKey.includes("phc_"))throw Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');!1!==t.enableLocalEvaluation&&(this.featureFlagsPoller=new eY({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:t.personalApiKey,projectApiKey:e,timeout:t.requestTimeout??1e4,host:this.host,fetch:t.fetch,onError:e=>{this._events.emit("error",e)},onLoad:e=>{this._events.emit("localEvaluationFlagsLoaded",e)},customHeaders:this.getCustomHeaders(),cacheProvider:t.flagDefinitionCacheProvider,strictLocalEvaluation:t.strictLocalEvaluation}))}this.errorTracking=new eH(this,t,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=t.maxCacheSize||5e4}enqueue(e,t,r){super.enqueue(e,t,r),this.scheduleDebouncedFlush()}async flush(){let e=super.flush(),t=this.options.waitUntil;if(t&&!this._waitUntilCycle)try{t(e.catch(()=>{}))}catch{}return e}scheduleDebouncedFlush(){let e=this.options.waitUntil;if(!e||this.disabled||this.optedOut)return;if(!this._waitUntilCycle){let t,r=new Promise(e=>{t=e});try{e(r)}catch{return}this._waitUntilCycle={resolve:t,startedAt:Date.now(),timer:void 0}}let t=Date.now()-this._waitUntilCycle.startedAt,r=this.options.waitUntilMaxWaitMs??500;if(void 0!==this._waitUntilCycle.timer&&clearTimeout(this._waitUntilCycle.timer),t>=r)return void this.resolveWaitUntilFlush();let i=this.options.waitUntilDebounceMs??50;this._waitUntilCycle.timer=M(()=>{this.resolveWaitUntilFlush()},i)}_consumeWaitUntilCycle(){let e=this._waitUntilCycle;return e&&(clearTimeout(e.timer),this._waitUntilCycle=void 0),e?.resolve}async resolveWaitUntilFlush(){let e=this._consumeWaitUntilCycle();try{await super.flush()}catch{}finally{e?.()}}getPersistedProperty(e){return this._memoryStorage.getProperty(e)}setPersistedProperty(e,t){return this._memoryStorage.setProperty(e,t)}fetch(e,t){return this.options.fetch?this.options.fetch(e,t):fetch(e,t)}getLibraryVersion(){return"5.28.11"}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(e=!0){super.debug(e),this.featureFlagsPoller?.debug(e)}capture(e){"string"==typeof e&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),"$exception"!==e.event||e._originatedFromCaptureException||this._logger.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.addPendingPromise(this.prepareEventMessage(e).then(({distinctId:e,event:t,properties:r,options:i})=>super.captureStateless(e,t,r,{timestamp:i.timestamp,disableGeoip:i.disableGeoip,uuid:i.uuid})).catch(e=>{e&&console.error(e)}))}async captureImmediate(e){return"string"==typeof e&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),"$exception"!==e.event||e._originatedFromCaptureException||this._logger.warn("Capturing a `$exception` event via `posthog.captureImmediate('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureExceptionImmediate(error)` instead, which attaches this metadata by default."),this.addPendingPromise(this.prepareEventMessage(e).then(({distinctId:e,event:t,properties:r,options:i})=>super.captureStatelessImmediate(e,t,r,{timestamp:i.timestamp,disableGeoip:i.disableGeoip,uuid:i.uuid})).catch(e=>{e&&console.error(e)}))}identify({distinctId:e,properties:t={},disableGeoip:r}){let{$set:i,$set_once:s,$anon_distinct_id:a,...n}=t;super.identifyStateless(e,{$set:i||n,$set_once:s||{},$anon_distinct_id:a??void 0},{disableGeoip:r})}async identifyImmediate({distinctId:e,properties:t={},disableGeoip:r}){let{$set:i,$set_once:s,$anon_distinct_id:a,...n}=t;super.identifyStatelessImmediate(e,{$set:i||n,$set_once:s||{},$anon_distinct_id:a??void 0},{disableGeoip:r})}alias(e){super.aliasStateless(e.alias,e.distinctId,void 0,{disableGeoip:e.disableGeoip})}async aliasImmediate(e){await super.aliasStatelessImmediate(e.alias,e.distinctId,void 0,{disableGeoip:e.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(e=3e4){return!!this.isLocalEvaluationReady()||void 0!==this.featureFlagsPoller&&new Promise(t=>{let r=setTimeout(()=>{i(),t(!1)},e),i=this._events.on("localEvaluationFlagsLoaded",e=>{clearTimeout(r),i(),t(e>0)})})}_resolveDistinctId(e,t){return"string"==typeof e?{distinctId:e,options:t}:{distinctId:this.context?.get()?.distinctId,options:e}}async _getFeatureFlagResult(e,t,r={},i){let s,a,n,o,l,u,c,h=r.sendFeatureFlagEvents??!0;if(void 0!==this._flagOverrides&&e in this._flagOverrides){let t=this._flagOverrides[e];if(void 0===t)return;let r=this._payloadOverrides?.[e];return{key:e,enabled:!1!==t,variant:"string"==typeof t?t:void 0,payload:r}}let{groups:d,disableGeoip:g}=r,{onlyEvaluateLocally:p,personProperties:f,groupProperties:y}=r,m=this.addLocalPersonAndGroupProperties(t,d,f,y);f=m.allPersonProperties,y=m.allGroupProperties;let v=this.createFeatureFlagEvaluationContext(t,d,f,y);void 0==p&&(p=this.options.strictLocalEvaluation??!1);let b=!1;if(void 0!==this.featureFlagsPoller){await this.featureFlagsPoller?.loadFeatureFlags();let t=this.featureFlagsPoller?.featureFlagsByKey[e];if(t)try{let r=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(t,v,{matchValue:i});if(r){b=!0;let i=r.value;l=t.id,c="Evaluated locally",s={key:e,enabled:!1!==i,variant:"string"==typeof i?i:void 0,payload:r.payload??void 0}}}catch(t){if(t instanceof eJ||t instanceof eQ)this._logger?.info(`${t.name} when computing flag locally: ${e}: ${t.message}`);else throw t}}if(!b&&!p){let t=await super.getFeatureFlagDetailsStateless(v.distinctId,v.groups,v.personProperties,v.groupProperties,g,[e]);if(void 0===t)o=ez.UNKNOWN_ERROR;else{a=t.requestId,n=t.evaluatedAt;let r=[];t.errorsWhileComputingFlags&&r.push(ez.ERRORS_WHILE_COMPUTING),t.quotaLimited?.includes("feature_flags")&&r.push(ez.QUOTA_LIMITED);let i=t.flags[e];if(void 0===i)r.push(ez.FLAG_MISSING);else{let t;if(l=i.metadata?.id,u=i.metadata?.version,c=i.reason?.description??i.reason?.code,i.metadata?.payload!==void 0)try{t=JSON.parse(i.metadata.payload)}catch{t=i.metadata.payload}s={key:e,enabled:i.enabled,variant:i.variant,payload:t}}r.length>0&&(o=r.join(","))}}if(h){let r=void 0===s?void 0:!1!==s.enabled&&(s.variant??!0),i=`${e}_${r}`;if(!(t in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[t].includes(i)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[t])?this.distinctIdHasSentFlagCalls[t].push(i):this.distinctIdHasSentFlagCalls[t]=[i];let s={$feature_flag:e,$feature_flag_response:r,$feature_flag_id:l,$feature_flag_version:u,$feature_flag_reason:c,locally_evaluated:b,[`$feature/${e}`]:r,$feature_flag_request_id:a,$feature_flag_evaluated_at:b?Date.now():n};if(b&&this.featureFlagsPoller){let e=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();void 0!==e&&(s.$feature_flag_definitions_loaded_at=e)}o&&(s.$feature_flag_error=o),this.capture({distinctId:t,event:"$feature_flag_called",properties:s,groups:d,disableGeoip:g})}}return void 0!==s&&void 0!==this._payloadOverrides&&e in this._payloadOverrides&&(s={...s,payload:this._payloadOverrides[e]}),s}async getFeatureFlag(e,t,r){let i=await this._getFeatureFlagResult(e,t,{...r,sendFeatureFlagEvents:r?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(void 0!==i)return!1!==i.enabled&&(i.variant??!0)}async getFeatureFlagPayload(e,t,r,i){if(void 0!==this._payloadOverrides&&e in this._payloadOverrides)return this._payloadOverrides[e];let s=await this._getFeatureFlagResult(e,t,{...i,sendFeatureFlagEvents:!1},r);if(void 0!==s)return s.payload??null}async getFeatureFlagResult(e,t,r){let{distinctId:i,options:s}=this._resolveDistinctId(t,r);return i?this._getFeatureFlagResult(e,i,{...s,sendFeatureFlagEvents:s?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required — pass it explicitly or use withContext()")}async getRemoteConfigPayload(e){if(!this.options.personalApiKey)throw Error("Personal API key is required for remote config payload decryption");let t=await this._requestRemoteConfigPayload(e);if(!t)return;let r=await t.json();if("string"==typeof r)try{return JSON.parse(r)}catch(e){}return r}async isFeatureEnabled(e,t,r){let i=await this.getFeatureFlag(e,t,r);if(void 0!==i)return!!i}async getAllFlags(e,t){let{distinctId:r,options:i}=this._resolveDistinctId(e,t);return r?(await this.getAllFlagsAndPayloads(r,i)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags — pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(e,t){let{distinctId:r,options:i}=this._resolveDistinctId(e,t);if(!r)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads — pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:s,disableGeoip:a,flagKeys:n}=i||{},{onlyEvaluateLocally:o,personProperties:l,groupProperties:u}=i||{},c=this.addLocalPersonAndGroupProperties(r,s,l,u);l=c.allPersonProperties,u=c.allGroupProperties;let h=this.createFeatureFlagEvaluationContext(r,s,l,u);void 0==o&&(o=this.options.strictLocalEvaluation??!1);let d=await this.featureFlagsPoller?.getAllFlagsAndPayloads(h,n),g={},p={},f=!0;if(d&&(g=d.response,p=d.payloads,f=d.fallbackToFlags),f&&!o){let e=await super.getFeatureFlagsAndPayloadsStateless(h.distinctId,h.groups,h.personProperties,h.groupProperties,a,n);g={...g,...e.flags||{}},p={...p,...e.payloads||{}}}return void 0!==this._flagOverrides&&(g={...g,...this._flagOverrides}),void 0!==this._payloadOverrides&&(p={...p,...this._payloadOverrides}),{featureFlags:g,featureFlagPayloads:p}}groupIdentify({groupType:e,groupKey:t,properties:r,distinctId:i,disableGeoip:s}){super.groupIdentifyStateless(e,t,r,{disableGeoip:s},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(e){let t=e=>Object.fromEntries(e.map(e=>[e,!0]));if(!1===e){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(e)){this._flagOverrides=t(e);return}if(this._isFeatureFlagOverrideOptions(e)){"flags"in e&&(!1===e.flags?this._flagOverrides=void 0:Array.isArray(e.flags)?this._flagOverrides=t(e.flags):void 0!==e.flags&&(this._flagOverrides={...e.flags})),"payloads"in e&&(!1===e.payloads?this._payloadOverrides=void 0:void 0!==e.payloads&&(this._payloadOverrides={...e.payloads}));return}this._flagOverrides={...e}}_isFeatureFlagOverrideOptions(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;if("flags"in e){let t=e.flags;if(!1===t||Array.isArray(t)||"object"==typeof t&&null!==t)return!0}if("payloads"in e){let t=e.payloads;if(!1===t||"object"==typeof t&&null!==t)return!0}return!1}withContext(e,t,r){return this.context?this.context.run(e,t,r):t()}getContext(){return this.context?.get()}enterContext(e,t){this.context?.enter(e,t)}async _shutdown(e){let t=this._consumeWaitUntilCycle();await this.featureFlagsPoller?.stopPoller(e),this.errorTracking.shutdown();try{return await super._shutdown(e)}finally{t?.()}}async _requestRemoteConfigPayload(e){if(!this.options.personalApiKey)return;let t=`${this.host}/api/projects/@current/feature_flags/${e}/remote_config?token=${encodeURIComponent(this.apiKey)}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},i=null;if(this.options.requestTimeout&&"number"==typeof this.options.requestTimeout){let e=new AbortController;i=M(()=>{e.abort()},this.options.requestTimeout),r.signal=e.signal}try{return await this.fetch(t,r)}catch(e){this._events.emit("error",e);return}finally{i&&clearTimeout(i)}}extractPropertiesFromEvent(e,t){if(!e)return{personProperties:{},groupProperties:{}};let r={},i={};for(let[s,a]of Object.entries(e))if(x(a,"Object")&&t&&s in t){let e={};for(let[t,r]of Object.entries(a))e[String(t)]=String(r);i[String(s)]=e}else r[String(s)]=String(a);return{personProperties:r,groupProperties:i}}async getFeatureFlagsForEvent(e,t,r,i){let s=i?.personProperties||{},a=i?.groupProperties||{},n=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation)if(!((this.featureFlagsPoller?.featureFlags?.length||0)>0))return{};else{let i={};for(let[e,r]of Object.entries(t||{}))i[e]=String(r);return await this.getAllFlags(e,{groups:i,personProperties:s,groupProperties:a,disableGeoip:r,onlyEvaluateLocally:!0,flagKeys:n})}if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let i={};for(let[e,r]of Object.entries(t||{}))i[e]=String(r);return await this.getAllFlags(e,{groups:i,personProperties:s,groupProperties:a,disableGeoip:r,onlyEvaluateLocally:!0,flagKeys:n})}return(await super.getFeatureFlagsStateless(e,t,s,a,r)).flags}addLocalPersonAndGroupProperties(e,t,r,i){let s={distinct_id:e,...r||{}},a={};if(t)for(let e of Object.keys(t))a[e]={$group_key:t[e],...i?.[e]||{}};return{allPersonProperties:s,allGroupProperties:a}}createFeatureFlagEvaluationContext(e,t,r,i){return{distinctId:e,groups:t||{},personProperties:r||{},groupProperties:i||{},evaluationCache:{}}}captureException(e,t,r,i){if(!eH.isPreviouslyCapturedError(e)){let s=Error("PostHog syntheticException");this.addPendingPromise(eH.buildEventMessage(e,{syntheticException:s},t,r).then(e=>this.capture({...e,uuid:i})))}}async captureExceptionImmediate(e,t,r){if(!eH.isPreviouslyCapturedError(e)){let i=Error("PostHog syntheticException");return this.addPendingPromise(eH.buildEventMessage(e,{syntheticException:i},t,r).then(e=>this.captureImmediate(e)))}}async prepareEventMessage(e){let{distinctId:t,event:r,properties:i,groups:s,sendFeatureFlags:a,timestamp:n,disableGeoip:o,uuid:l}=e,u=this.context?.get(),c=t||u?.distinctId,h={...this.props,...u?.properties||{},...i||{}};c||(c=y().toString(),h.$process_person_profile=!1),u?.sessionId&&!h.$session_id&&(h.$session_id=u.sessionId);let d=this._runBeforeSend({distinctId:c,event:r,properties:h,groups:s,sendFeatureFlags:a,timestamp:n,disableGeoip:o,uuid:l});if(!d)return Promise.reject(null);let g=await Promise.resolve().then(async()=>a?await this.getFeatureFlagsForEvent(d.distinctId,s,o,"object"==typeof a?a:void 0):(d.event,{})).then(e=>{let t={};if(e)for(let[r,i]of Object.entries(e))t[`$feature/${r}`]=i;let r=Object.keys(e||{}).filter(t=>e?.[t]!==!1).sort();return r.length>0&&(t.$active_feature_flags=r),t}).catch(()=>({})).then(e=>({...e,...d.properties||{},$groups:d.groups||s}));return"$pageview"===d.event&&this.options.__preview_capture_bot_pageviews&&"string"==typeof g.$raw_user_agent&&eG(g.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(d.event="$bot_pageview",g.$browser_type="bot"),{distinctId:d.distinctId,event:d.event,properties:g,options:{timestamp:d.timestamp,disableGeoip:d.disableGeoip,uuid:d.uuid}}}_runBeforeSend(e){let t=this.options.before_send;if(!t)return e;let r=Array.isArray(t)?t:[t],i=e;for(let t of r){if(!(i=t(i)))return this._logger.info(`Event '${e.event}' was rejected in beforeSend function`),null;if(!i.properties||0===Object.keys(i.properties).length){let e=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(e)}}return i}}var eO=e$,e6=e.i(78500);class e9{constructor(){this.storage=new e6.AsyncLocalStorage}get(){return this.storage.getStore()}run(e,t,r){return this.storage.run(this.resolve(e,r),t)}enter(e,t){this.storage.enterWith(this.resolve(e,t))}resolve(e,t){if(t?.fresh===!0)return e;let r=this.get()||{};return{distinctId:e.distinctId??r.distinctId,sessionId:e.sessionId??r.sessionId,properties:{...r.properties||{},...e.properties||{}}}}}function e8(e,t){var r;t.use((r=e,(e,t,i,s)=>{if(eH.isPreviouslyCapturedError(e))return void s(e);let a=t.headers["x-posthog-session-id"],n=t.headers["x-posthog-distinct-id"],o=Error("Synthetic exception");r.addPendingPromise(eH.buildEventMessage(e,{mechanism:{type:"middleware",handled:!1},syntheticException:o},n,{$session_id:a,$current_url:t.url,$request_method:t.method,$request_path:t.path,$user_agent:t.headers["user-agent"],$response_status_code:i.statusCode,$ip:t.headers["x-forwarded-for"]||t?.socket?.remoteAddress}).then(e=>{r.capture(e)})),s(e)}))}e.s(["setupExpressErrorHandler",0,e8],93546),e.s([],92998),eH.errorPropertiesBuilder=new eO.ErrorPropertiesBuilder([new eO.EventCoercer,new eO.ErrorCoercer,new eO.ObjectCoercer,new eO.StringCoercer,new eO.PrimitiveCoercer],eO.createStackParser("node:javascript",eO.nodeStackLineParser),[(a=function(e=process.argv[1]?(0,o.dirname)(process.argv[1]):process.cwd(),t="\\"===o.sep){let r=t?l(e):e;return e=>{if(!e)return;let i=t?l(e):e,{dir:s,base:a,ext:n}=o.posix.parse(i);(".js"===n||".mjs"===n||".cjs"===n)&&(a=a.slice(0,-1*n.length));let u=decodeURIComponent(a);s||(s=".");let c=s.lastIndexOf("/node_modules");if(c>-1)return`${s.slice(c+14).replace(/\//g,".")}:${u}`;if(s.startsWith(r)){let e=s.slice(r.length+1).replace(/\//g,".");return e?`${e}:${u}`:u}return u}}(),async e=>{for(let t of e)t.module=a(t.filename);return e}),eM]);class e7 extends e5{getLibraryId(){return"posthog-node"}initializeContext(){return new e9}}e.s(["PostHog",0,e7],47839),e.i(47839),e.i(92998);let te="posthog-node";function tt(e,{organization:t,projectId:r,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:a=!0}={}){return n=>{if(!("*"===s||s.includes(n.level)))return n;n.tags||(n.tags={});let o=n.tags[ti.POSTHOG_ID_TAG];if(void 0===o)return n;let l=e.options.host??"https://us.i.posthog.com",u=new URL(`/project/${e.apiKey}/person/${o}`,l).toString();n.tags["PostHog Person URL"]=u;let c=n.exception?.values||[],h=c.map(e=>({...e,stacktrace:e.stacktrace?{...e.stacktrace,type:"raw",frames:(e.stacktrace.frames||[]).map(e=>({...e,platform:"node:javascript"}))}:void 0})),d={$exception_message:c[0]?.value||n.message,$exception_type:c[0]?.type,$exception_level:n.level,$exception_list:h,$sentry_event_id:n.event_id,$sentry_exception:n.exception,$sentry_exception_message:c[0]?.value||n.message,$sentry_exception_type:c[0]?.type,$sentry_tags:n.tags};return t&&r&&(d.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+n.event_id),a&&e.capture({event:"$exception",distinctId:o,properties:d}),n}}function tr(e,t){let r=tt(e,t);return{name:te,processEvent:e=>r(e)}}class ti{static #e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(e,t,r,i,s){this.name=te,this.name=te,this.setupOnce=function(a,n){a(tt(e,{organization:t,projectId:n()?.getClient()?.getDsn()?.projectId,prefix:r,severityAllowList:i,sendExceptionsToPostHog:s??!0}))}}}e.s(["PostHogSentryIntegration",0,ti,"createEventProcessor",0,tt,"sentryIntegration",0,tr],91573),e.i(91573),e.i(93546),e.i(58325),e.s(["FeatureFlagError",0,v,"PostHogSentryIntegration",0,ti,"createEventProcessor",0,tt,"sentryIntegration",0,tr,"setupExpressErrorHandler",0,e8],57564),e.i(57564),e.s(["FeatureFlagError",0,v,"PostHog",0,e7,"PostHogSentryIntegration",0,ti,"createEventProcessor",0,tt,"sentryIntegration",0,tr,"setupExpressErrorHandler",0,e8],28864)}];
2
2
 
3
3
  //# sourceMappingURL=node_modules_posthog-node_dist_entrypoints_index_node_mjs_05pz9._._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[93133,(e,s,t)=>{s.exports={name:"claudeye",version:"1.0.9",description:"Watchtower for Claude Code & Agents SDK replay sessions, run custom evals, debug agent traces locally",bin:{claudeye:"./bin/claudeye.mjs"},main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{import:"./dist/index.js",types:"./dist/index.d.ts"}},files:["bin/","dist/",".next/standalone/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{dev:"bun scripts/dev.ts --port 8020",build:"bun --bun next build","build:evals":"tsc -p tsconfig.evals.json && bun scripts/minify-dist.mjs","build:binary":"bun build --compile src/binary-entry.ts --outfile claudeye-local",start:"bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",prepublishOnly:"bun run build:evals && bun run build && bun scripts/prepare-package.mjs","set-versions":"bun scripts/set-versions.mjs","test:binary":"bash scripts/test-local.sh","test:binary:quick":"bash scripts/test-local.sh --skip-build","test:npx":"bash scripts/test-npx.sh","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts"},keywords:["claude","claude-code","claude-agents-sdk","anthropic","ai-agent","llm-observability","agent-observability","log-viewer","session-replay","eval-framework","developer-tools","devtools","cli","dashboard","local-first","monitoring","debugging","tracing"],author:"ExosphereHost Inc. <claudeye@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://claudeye.exosphere.host",repository:{type:"git",url:"https://github.com/exospherehost/claudeye.git"},bugs:{url:"https://github.com/exospherehost/claudeye/issues"},publishConfig:{access:"restricted"},devDependencies:{"@tailwindcss/postcss":"^4.1.18","@tanstack/react-virtual":"^3.13.18","@testing-library/jest-dom":"^6.9.1","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.1","@types/node":"^25.2.0","@types/react":"^19.2.13","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.0.1",autoprefixer:"^10.4.24","class-variance-authority":"^0.7.1",clsx:"^2.1.1",eslint:"^10.0.3","eslint-config-next":"^16.1.6","happy-dom":"^20.7.0","lucide-react":"^1.0.1",next:"^16.1.6",postcss:"^8.5.6",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.1.18","tw-animate-css":"^1.4.0",typescript:"^6.0.2",vite:"^8.0.0",vitest:"^4.0.18"},dependencies:{"posthog-node":"^5.28.0"}}}];
1
+ module.exports=[93133,(e,s,t)=>{s.exports={name:"claudeye",version:"1.1.0",description:"Claudeye is now FailproofAI open-source oversight & observability for Claude Code & AI agents",bin:{claudeye:"./bin/claudeye.mjs"},main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{import:"./dist/index.js",types:"./dist/index.d.ts"}},files:["bin/","dist/",".next/standalone/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{dev:"bun scripts/dev.ts --port 8020",build:"bun --bun next build","build:evals":"tsc -p tsconfig.evals.json && bun scripts/minify-dist.mjs","build:binary":"bun build --compile src/binary-entry.ts --outfile claudeye-local",start:"bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",prepublishOnly:"bun run build:evals && bun run build && bun scripts/prepare-package.mjs","set-versions":"bun scripts/set-versions.mjs","test:binary":"bash scripts/test-local.sh","test:binary:quick":"bash scripts/test-local.sh --skip-build","test:npx":"bash scripts/test-npx.sh","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts"},keywords:["claude","claude-code","claude-agents-sdk","anthropic","ai-agent","llm-observability","agent-observability","log-viewer","session-replay","eval-framework","developer-tools","devtools","cli","dashboard","local-first","monitoring","debugging","tracing"],author:"ExosphereHost Inc. <claudeye@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://befailproof.ai",repository:{type:"git",url:"https://github.com/exospherehost/failproofai.git"},bugs:{url:"https://github.com/exospherehost/failproofai/issues"},publishConfig:{access:"restricted"},devDependencies:{"@tailwindcss/postcss":"^4.1.18","@tanstack/react-virtual":"^3.13.18","@testing-library/jest-dom":"^6.9.1","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.1","@types/node":"^25.2.0","@types/react":"^19.2.13","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.0.1",autoprefixer:"^10.4.24","class-variance-authority":"^0.7.1",clsx:"^2.1.1",eslint:"^10.0.3","eslint-config-next":"^16.1.6","happy-dom":"^20.7.0","lucide-react":"^1.0.1",next:"^16.1.6",postcss:"^8.5.6",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.1.18","tw-animate-css":"^1.4.0",typescript:"^6.0.2",vite:"^8.0.0",vitest:"^4.0.18"},dependencies:{"posthog-node":"^5.28.0"}}}];
2
2
 
3
3
  //# sourceMappingURL=package_json_%5Bjson%5D_cjs_0z7w.hh._.js.map
@@ -1,4 +1,4 @@
1
1
  module.exports=[37936,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"registerServerReference",{enumerable:!0,get:function(){return d.registerServerReference}});let d=a.r(11857)},13095,(a,b,c)=>{"use strict";function d(a){for(let b=0;b<a.length;b++){let c=a[b];if("function"!=typeof c)throw Object.defineProperty(Error(`A "use server" file can only export async functions, found ${typeof c}.
2
- Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"ensureServerEntryExports",{enumerable:!0,get:function(){return d}})},2157,(a,b,c)=>{b.exports=a.x("node:fs",()=>require("node:fs"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},48781,69839,79779,a=>{"use strict";let b;var c=a.i(2157),d=a.i(50227),e=a.i(60526),f=a.i(66680);a.i(74533);let g=d.default.join(e.default.homedir(),".claudeye"),h=d.default.join(g,"instance-id");function i(a){return f.default.createHmac("sha256","claudeye-telemetry-v1").update(a).digest("hex")}a.s(["getInstanceId",0,function(){if(b)return b;let a=function(){try{for(let a of(e.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let b=c.default.readFileSync(a,"utf-8").trim();if(b)return b}catch{}}catch{}}();if(a)return b=i(a);let d=[e.default.hostname(),e.default.homedir(),e.default.platform(),e.default.arch(),e.default.cpus()[0]?.model??""].join(":");return b=d?i(d):function(){try{let a=c.default.readFileSync(h,"utf-8").trim();if(a)return a}catch{}let a=f.default.randomUUID();try{c.default.mkdirSync(g,{recursive:!0}),c.default.writeFileSync(h,a,"utf-8")}catch{}return a}()},"hashToId",0,i],69839),a.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX"],79779),a.s(["isTelemetryEnabled",0,function(){return"1"!==process.env.CLAUDEYE_TELEMETRY_DISABLED}],48781)},12072,(a,b,c)=>{b.exports={name:"claudeye",version:"1.0.9",description:"Watchtower for Claude Code & Agents SDK replay sessions, run custom evals, debug agent traces locally",bin:{claudeye:"./bin/claudeye.mjs"},main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{import:"./dist/index.js",types:"./dist/index.d.ts"}},files:["bin/","dist/",".next/standalone/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{dev:"bun scripts/dev.ts --port 8020",build:"bun --bun next build","build:evals":"tsc -p tsconfig.evals.json && bun scripts/minify-dist.mjs","build:binary":"bun build --compile src/binary-entry.ts --outfile claudeye-local",start:"bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",prepublishOnly:"bun run build:evals && bun run build && bun scripts/prepare-package.mjs","set-versions":"bun scripts/set-versions.mjs","test:binary":"bash scripts/test-local.sh","test:binary:quick":"bash scripts/test-local.sh --skip-build","test:npx":"bash scripts/test-npx.sh","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts"},keywords:["claude","claude-code","claude-agents-sdk","anthropic","ai-agent","llm-observability","agent-observability","log-viewer","session-replay","eval-framework","developer-tools","devtools","cli","dashboard","local-first","monitoring","debugging","tracing"],author:"ExosphereHost Inc. <claudeye@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://claudeye.exosphere.host",repository:{type:"git",url:"https://github.com/exospherehost/claudeye.git"},bugs:{url:"https://github.com/exospherehost/claudeye/issues"},publishConfig:{access:"restricted"},devDependencies:{"@tailwindcss/postcss":"^4.1.18","@tanstack/react-virtual":"^3.13.18","@testing-library/jest-dom":"^6.9.1","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.1","@types/node":"^25.2.0","@types/react":"^19.2.13","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.0.1",autoprefixer:"^10.4.24","class-variance-authority":"^0.7.1",clsx:"^2.1.1",eslint:"^10.0.3","eslint-config-next":"^16.1.6","happy-dom":"^20.7.0","lucide-react":"^1.0.1",next:"^16.1.6",postcss:"^8.5.6",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.1.18","tw-animate-css":"^1.4.0",typescript:"^6.0.2",vite:"^8.0.0",vitest:"^4.0.18"},dependencies:{"posthog-node":"^5.28.0"}}},36359,a=>{"use strict";var b=a.i(37936),c=a.i(69839),d=a.i(48781),e=a.i(12072);async function f(){let a=(0,d.isTelemetryEnabled)();return{enabled:a,distinctId:a?(0,c.getInstanceId)():"",apiKey:process.env.CLAUDEYE_POSTHOG_KEY??"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX",host:process.env.CLAUDEYE_POSTHOG_HOST??"https://us.i.posthog.com",version:e.version}}(0,a.i(13095).ensureServerEntryExports)([f]),(0,b.registerServerReference)(f,"0083a359745c64ab349d8a8718e7b884b057921f57",null),a.s(["getTelemetryConfig",0,f])},39027,a=>{"use strict";var b=a.i(36359);a.s([],35268),a.i(35268),a.s(["0083a359745c64ab349d8a8718e7b884b057921f57",()=>b.getTelemetryConfig],39027)},2726,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[externals]__12dv.x0._.js","server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0mebn66._.js"].map(b=>a.l(b))).then(()=>b(74493)))}];
2
+ Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"ensureServerEntryExports",{enumerable:!0,get:function(){return d}})},2157,(a,b,c)=>{b.exports=a.x("node:fs",()=>require("node:fs"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},48781,69839,79779,a=>{"use strict";let b;var c=a.i(2157),d=a.i(50227),e=a.i(60526),f=a.i(66680);a.i(74533);let g=d.default.join(e.default.homedir(),".claudeye"),h=d.default.join(g,"instance-id");function i(a){return f.default.createHmac("sha256","claudeye-telemetry-v1").update(a).digest("hex")}a.s(["getInstanceId",0,function(){if(b)return b;let a=function(){try{for(let a of(e.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let b=c.default.readFileSync(a,"utf-8").trim();if(b)return b}catch{}}catch{}}();if(a)return b=i(a);let d=[e.default.hostname(),e.default.homedir(),e.default.platform(),e.default.arch(),e.default.cpus()[0]?.model??""].join(":");return b=d?i(d):function(){try{let a=c.default.readFileSync(h,"utf-8").trim();if(a)return a}catch{}let a=f.default.randomUUID();try{c.default.mkdirSync(g,{recursive:!0}),c.default.writeFileSync(h,a,"utf-8")}catch{}return a}()},"hashToId",0,i],69839),a.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX"],79779),a.s(["isTelemetryEnabled",0,function(){return"1"!==process.env.CLAUDEYE_TELEMETRY_DISABLED}],48781)},12072,(a,b,c)=>{b.exports={name:"claudeye",version:"1.1.0",description:"Claudeye is now FailproofAI open-source oversight & observability for Claude Code & AI agents",bin:{claudeye:"./bin/claudeye.mjs"},main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{import:"./dist/index.js",types:"./dist/index.d.ts"}},files:["bin/","dist/",".next/standalone/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{dev:"bun scripts/dev.ts --port 8020",build:"bun --bun next build","build:evals":"tsc -p tsconfig.evals.json && bun scripts/minify-dist.mjs","build:binary":"bun build --compile src/binary-entry.ts --outfile claudeye-local",start:"bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",prepublishOnly:"bun run build:evals && bun run build && bun scripts/prepare-package.mjs","set-versions":"bun scripts/set-versions.mjs","test:binary":"bash scripts/test-local.sh","test:binary:quick":"bash scripts/test-local.sh --skip-build","test:npx":"bash scripts/test-npx.sh","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts"},keywords:["claude","claude-code","claude-agents-sdk","anthropic","ai-agent","llm-observability","agent-observability","log-viewer","session-replay","eval-framework","developer-tools","devtools","cli","dashboard","local-first","monitoring","debugging","tracing"],author:"ExosphereHost Inc. <claudeye@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://befailproof.ai",repository:{type:"git",url:"https://github.com/exospherehost/failproofai.git"},bugs:{url:"https://github.com/exospherehost/failproofai/issues"},publishConfig:{access:"restricted"},devDependencies:{"@tailwindcss/postcss":"^4.1.18","@tanstack/react-virtual":"^3.13.18","@testing-library/jest-dom":"^6.9.1","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.1","@types/node":"^25.2.0","@types/react":"^19.2.13","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.0.1",autoprefixer:"^10.4.24","class-variance-authority":"^0.7.1",clsx:"^2.1.1",eslint:"^10.0.3","eslint-config-next":"^16.1.6","happy-dom":"^20.7.0","lucide-react":"^1.0.1",next:"^16.1.6",postcss:"^8.5.6",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.1.18","tw-animate-css":"^1.4.0",typescript:"^6.0.2",vite:"^8.0.0",vitest:"^4.0.18"},dependencies:{"posthog-node":"^5.28.0"}}},36359,a=>{"use strict";var b=a.i(37936),c=a.i(69839),d=a.i(48781),e=a.i(12072);async function f(){let a=(0,d.isTelemetryEnabled)();return{enabled:a,distinctId:a?(0,c.getInstanceId)():"",apiKey:process.env.CLAUDEYE_POSTHOG_KEY??"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX",host:process.env.CLAUDEYE_POSTHOG_HOST??"https://us.i.posthog.com",version:e.version}}(0,a.i(13095).ensureServerEntryExports)([f]),(0,b.registerServerReference)(f,"002e75faef8fec11b3638d60b23cc34c6fe620bc96",null),a.s(["getTelemetryConfig",0,f])},39027,a=>{"use strict";var b=a.i(36359);a.s([],35268),a.i(35268),a.s(["002e75faef8fec11b3638d60b23cc34c6fe620bc96",()=>b.getTelemetryConfig],39027)},2726,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[externals]__12dv.x0._.js","server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0mebn66._.js"].map(b=>a.l(b))).then(()=>b(74493)))}];
3
3
 
4
4
  //# sourceMappingURL=%5Broot-of-the-server%5D__0-_oq51._.js.map
@@ -40,6 +40,6 @@ export default _cjs;`;return await (0,ad.writeFile)(c,d,"utf-8"),{shimPath:c,shi
40
40
  Valid policies: ${a}`)}}function aB(a,b){let c=aw(a,b);if(!(0,f.existsSync)(c))return!1;try{let a=ax(c);if(!a.hooks)return!1;for(let b of Object.values(a.hooks))if(Array.isArray(b)){for(let a of b)if(a.hooks&&a.hooks.some(a=>az(a)))return!0}}catch{}return!1}async function aC(a,b="user",c,d=!1,e,f,i=!1){let j,k,l=function(){try{return(0,y.execSync)("which claudeye",{encoding:"utf8"}).trim().split("\n")[0].trim()}catch{throw Error("claudeye binary not found in PATH.\nInstall it globally first: npm install -g claudeye")}}(),m=v(),n=new Set(m.enabledPolicies);if(void 0!==a){let b;1===a.length&&"all"===a[0]?b=_.filter(a=>d||!a.beta).map(a=>a.name):(a.length>0&&aA(a),b=a),j=[...new Set([...m.enabledPolicies,...b])]}else{let a=m.enabledPolicies.length>0?m.enabledPolicies:void 0;j=await aa(a,{includeBeta:d})}let o={...v(),enabledPolicies:j};if(i)delete o.customHooksPath;else if(f){let a;o.customHooksPath=(0,g.resolve)(f);try{a=await aq(o.customHooksPath,{strict:!0})}catch(a){console.error(`Error: ${a instanceof Error?a.message:String(a)}`),process.exit(1)}0===a.length&&(console.error(`Error: no hooks registered in ${f}. Make sure your file calls customPolicies.add(...) at least once.`),process.exit(1)),console.log(`
41
41
  Validated ${a.length} custom hook(s): ${a.map(a=>a.name).join(", ")}`)}w(o),console.log(`
42
42
  Enabled ${j.length} policy(ies): ${j.join(", ")}`),i?console.log("Custom hooks path cleared."):o.customHooksPath&&console.log(`Custom hooks path: ${o.customHooksPath}`);let p=new Set(["verify-intent"]);j.some(a=>p.has(a))&&(x()||(console.log(`
43
- \x1b[33mNote: verify-intent requires an LLM provider.`),console.log("Configure one with: claudeye --configure-llm\x1b[0m")));let q=aw(b,c),r=ax(q);for(let a of(r.hooks||(r.hooks={}),A)){let b={type:"command",command:`"${l}" --hook ${a}`,timeout:6e4,[B]:!0};r.hooks[a]||(r.hooks[a]=[]);let c=r.hooks[a],d=!1;for(let a of c){if(!a.hooks)continue;let c=a.hooks.findIndex(a=>az(a));if(c>=0){a.hooks[c]=b,d=!0;break}}d||c.push({hooks:[b]})}ay(q,r);try{let a=new Set(j),c=j.filter(a=>!n.has(a)),d=[...n].filter(b=>!a.has(b)),f=(0,au.getInstanceId)();await at(f,"hooks_installed",{scope:b,policies:j,policy_count:j.length,policies_added:c,policies_removed:d,...e?{source:e}:{},platform:(0,h.platform)(),arch:(0,h.arch)(),os_release:(0,h.release)(),hostname_hash:(0,au.hashToId)((0,h.hostname)()),has_custom_hooks_path:!!o.customHooksPath,has_policy_params:!!(o.policyParams&&Object.keys(o.policyParams).length>0),param_policy_names:o.policyParams?Object.keys(o.policyParams):[]})}catch{}console.log(`Claudeye hooks installed for all ${A.length} event types (scope: ${b}).`),console.log(`Settings: ${q}`),console.log(`Binary: ${l}`);let s=(k=new Set,z.filter(a=>{let b=aw(a,c);return!k.has(b)&&(k.add(b),!0)})).filter(a=>a!==b).filter(a=>aB(a,c));if(s.length>0){let a=s.map(a=>`${a} (${function(a){switch(a){case"user":return"~/.claude/settings.json";case"project":return"{cwd}/.claude/settings.json";case"local":return"{cwd}/.claude/settings.local.json"}}(a)})`).join(", ");console.log(),console.log(`\x1b[33mWarning: Claudeye hooks are also installed at ${a}.\x1b[0m`),console.log("Having hooks in multiple scopes may cause duplicate policy evaluation."),console.log(`Use \`claudeye --remove-hooks --scope ${s[0]}\` to remove the other installation,`),console.log("or `claudeye --list-hooks` to see all scopes.")}}async function aD(a,b="user",c,d){if(a&&a.length>0&&(1!==a.length||"all"!==a[0])){aA(a);let c=v(),e=new Set(a),f=c.enabledPolicies.filter(a=>!e.has(a)),g=a.filter(a=>!c.enabledPolicies.includes(a));g.length>0&&console.log(`Warning: policy(ies) not currently enabled: ${g.join(", ")}`);let{policyParams:i,...j}=c,k=i?Object.fromEntries(Object.entries(i).filter(([a])=>!e.has(a))):null;w({...j,enabledPolicies:f,...k&&Object.keys(k).length>0?{policyParams:k}:{}});try{let e=(0,au.getInstanceId)(),f=a.filter(a=>c.enabledPolicies.includes(a));await at(e,"hooks_removed",{scope:b,removal_mode:d?.betaOnly?"beta_policies":"policies",beta_only:d?.betaOnly??!1,policies_removed:f,removed_count:f.length,...d?.source?{source:d.source}:{},platform:(0,h.platform)(),arch:(0,h.arch)(),os_release:(0,h.release)(),hostname_hash:(0,au.hashToId)((0,h.hostname)())})}catch{}console.log(`Disabled ${a.length-g.length} policy(ies).`),console.log(`Remaining: ${f.length>0?f.join(", "):"(none)"}`);return}let e=v(),g="all"===b?[...z]:[b],i=0;for(let a of g){let d=aw(a,c);if(!(0,f.existsSync)(d)){if("all"!==b)return void console.log("No settings file found. Nothing to remove.");continue}if(!ax(d).hooks){if("all"!==b)return void console.log("No hooks found in settings. Nothing to remove.");continue}let e=function(a){let b=ax(a);if(!b.hooks)return 0;let c=0;for(let a of Object.keys(b.hooks)){let d=b.hooks[a];if(Array.isArray(d)){for(let a=d.length-1;a>=0;a--){let b=d[a];if(!b.hooks)continue;let e=b.hooks.length;b.hooks=b.hooks.filter(a=>!az(a)),c+=e-b.hooks.length,0===b.hooks.length&&d.splice(a,1)}0===d.length&&delete b.hooks[a]}}return 0===Object.keys(b.hooks).length&&delete b.hooks,ay(a,b),c}(d);i+=e,"all"!==b&&(console.log(`Removed ${e} claudeye hook(s) from settings.`),console.log(`Settings: ${d}`))}if("all"===b)for(let a of(console.log(`Removed ${i} claudeye hook(s) from all scopes.`),g))console.log(` ${a}: ${aw(a,c)}`);try{let a=(0,au.getInstanceId)();await at(a,"hooks_removed",{scope:b,removal_mode:"hooks",policies_removed:e.enabledPolicies,removed_count:i,...d?.source?{source:d.source}:{},platform:(0,h.platform)(),arch:(0,h.arch)(),os_release:(0,h.release)(),hostname_hash:(0,au.hashToId)((0,h.hostname)())})}catch{}if("all"===b||!z.some(a=>aB(a,c))){let{customHooksPath:a,policyParams:b,...c}=v();w({...c,enabledPolicies:[]})}}var aE=a.i(13095);async function aF(a){if(!(0,f.existsSync)(a))return[];let b=await (0,D.readFile)(a,"utf-8"),c=[],d=b.split(/customPolicies\.add\s*\(/);for(let a=1;a<d.length;a++){let b=d[a],e=b.match(/name:\s*["'`]([^"'`]+)["'`]/);if(!e)continue;let f=b.match(/description:\s*["'`]([^"'`]+)["'`]/),g=b.match(/events:\s*\[([^\]]+)\]/),h=g?g[1].replace(/["'`\s]/g,"").split(",").filter(Boolean).join(", "):void 0;c.push({name:e[1],description:f?.[1],eventScope:h})}return c}async function aG(){let a=v(),b=new Set(a.enabledPolicies),c=z.filter(a=>aB(a)),d=aw(c[0]??"user"),e=_.map(c=>{var d;let e,f;return{name:c.name,description:c.description,category:c.category,defaultEnabled:c.defaultEnabled,beta:!!c.beta,enabled:b.has(c.name),eventScope:(d=c.match,e=d.events?.join(", ")??"",f=d.toolNames?` \xb7 ${d.toolNames.join(", ")}`:"",`${e}${f}`),params:c.params?Object.fromEntries(Object.entries(c.params).map(([a,b])=>[a,{type:b.type,description:b.description,default:b.default}])):void 0,currentParams:c.params?a.policyParams?.[c.name]??{}:void 0}}),f=a.customHooksPath?await aF(a.customHooksPath):void 0;return{enabledPolicies:a.enabledPolicies,installedScopes:c,settingsPath:d,policies:e,customHooksPath:a.customHooksPath,customPolicies:f?.length?f:void 0}}async function aH(a,b){let c=v(),d=new Set(c.enabledPolicies);b?d.add(a):d.delete(a),w({...c,enabledPolicies:[...d]});try{let c=(0,au.getInstanceId)();await at(c,"policy_toggled",{policy_name:a,enabled:b,action:b?"enable":"disable",source:"web"})}catch{}}async function aI(a="user"){let b=v(),c=b.enabledPolicies.length>0?b.enabledPolicies:_.filter(a=>a.defaultEnabled&&!a.beta).map(a=>a.name);await aC(c,a,void 0,!1,"web")}async function aJ(a="user"){await aD(void 0,a,void 0,{source:"web"})}async function aK(a,b){let c=v(),d={...c.policyParams??{},[a]:b};w({...c,policyParams:d});try{let c=(0,au.getInstanceId)();await at(c,"policy_params_updated",{policy_name:a,param_keys:Object.keys(b),source:"web"})}catch{}}(0,aE.ensureServerEntryExports)([aG]),(0,e.registerServerReference)(aG,"002569392ae732575c764414749b761d1ea2620387",null),(0,aE.ensureServerEntryExports)([aH]),(0,e.registerServerReference)(aH,"604f971c899887c5fe2dd0904a38e24f4bb138ae21",null),(0,aE.ensureServerEntryExports)([aI,aJ]),(0,e.registerServerReference)(aI,"4073b98f592f47ab4dee360318c78ba940f2bd13eb",null),(0,e.registerServerReference)(aJ,"40a49c13a668e7a4c89fdfbdf0a2a3976d9f43bd34",null),(0,aE.ensureServerEntryExports)([aK]),(0,e.registerServerReference)(aK,"605eaa5aaa4640854292ad3d86724a4b0501f07699",null),a.s([],15387),a.i(15387),a.s(["002569392ae732575c764414749b761d1ea2620387",0,aG,"0083a359745c64ab349d8a8718e7b884b057921f57",()=>b.getTelemetryConfig,"00f8db623cce8cbb65413709ca6a47fb7ef4d4608d",()=>c.logout,"4073b98f592f47ab4dee360318c78ba940f2bd13eb",0,aI,"40985fcad95b1dfb5ce5ad080f01dc6797f4adce5c",()=>d.getHookActivityAction,"40a49c13a668e7a4c89fdfbdf0a2a3976d9f43bd34",0,aJ,"602bbc72facb5faaec730a7e10bdd3c426fb357a36",()=>d.searchHookActivityAction,"604f971c899887c5fe2dd0904a38e24f4bb138ae21",0,aH,"605eaa5aaa4640854292ad3d86724a4b0501f07699",0,aK],76110)}];
43
+ \x1b[33mNote: verify-intent requires an LLM provider.`),console.log("Configure one with: claudeye --configure-llm\x1b[0m")));let q=aw(b,c),r=ax(q);for(let a of(r.hooks||(r.hooks={}),A)){let b={type:"command",command:`"${l}" --hook ${a}`,timeout:6e4,[B]:!0};r.hooks[a]||(r.hooks[a]=[]);let c=r.hooks[a],d=!1;for(let a of c){if(!a.hooks)continue;let c=a.hooks.findIndex(a=>az(a));if(c>=0){a.hooks[c]=b,d=!0;break}}d||c.push({hooks:[b]})}ay(q,r);try{let a=new Set(j),c=j.filter(a=>!n.has(a)),d=[...n].filter(b=>!a.has(b)),f=(0,au.getInstanceId)();await at(f,"hooks_installed",{scope:b,policies:j,policy_count:j.length,policies_added:c,policies_removed:d,...e?{source:e}:{},platform:(0,h.platform)(),arch:(0,h.arch)(),os_release:(0,h.release)(),hostname_hash:(0,au.hashToId)((0,h.hostname)()),has_custom_hooks_path:!!o.customHooksPath,has_policy_params:!!(o.policyParams&&Object.keys(o.policyParams).length>0),param_policy_names:o.policyParams?Object.keys(o.policyParams):[]})}catch{}console.log(`Claudeye hooks installed for all ${A.length} event types (scope: ${b}).`),console.log(`Settings: ${q}`),console.log(`Binary: ${l}`);let s=(k=new Set,z.filter(a=>{let b=aw(a,c);return!k.has(b)&&(k.add(b),!0)})).filter(a=>a!==b).filter(a=>aB(a,c));if(s.length>0){let a=s.map(a=>`${a} (${function(a){switch(a){case"user":return"~/.claude/settings.json";case"project":return"{cwd}/.claude/settings.json";case"local":return"{cwd}/.claude/settings.local.json"}}(a)})`).join(", ");console.log(),console.log(`\x1b[33mWarning: Claudeye hooks are also installed at ${a}.\x1b[0m`),console.log("Having hooks in multiple scopes may cause duplicate policy evaluation."),console.log(`Use \`claudeye --remove-hooks --scope ${s[0]}\` to remove the other installation,`),console.log("or `claudeye --list-hooks` to see all scopes.")}}async function aD(a,b="user",c,d){if(a&&a.length>0&&(1!==a.length||"all"!==a[0])){aA(a);let c=v(),e=new Set(a),f=c.enabledPolicies.filter(a=>!e.has(a)),g=a.filter(a=>!c.enabledPolicies.includes(a));g.length>0&&console.log(`Warning: policy(ies) not currently enabled: ${g.join(", ")}`);let{policyParams:i,...j}=c,k=i?Object.fromEntries(Object.entries(i).filter(([a])=>!e.has(a))):null;w({...j,enabledPolicies:f,...k&&Object.keys(k).length>0?{policyParams:k}:{}});try{let e=(0,au.getInstanceId)(),f=a.filter(a=>c.enabledPolicies.includes(a));await at(e,"hooks_removed",{scope:b,removal_mode:d?.betaOnly?"beta_policies":"policies",beta_only:d?.betaOnly??!1,policies_removed:f,removed_count:f.length,...d?.source?{source:d.source}:{},platform:(0,h.platform)(),arch:(0,h.arch)(),os_release:(0,h.release)(),hostname_hash:(0,au.hashToId)((0,h.hostname)())})}catch{}console.log(`Disabled ${a.length-g.length} policy(ies).`),console.log(`Remaining: ${f.length>0?f.join(", "):"(none)"}`);return}let e=v(),g="all"===b?[...z]:[b],i=0;for(let a of g){let d=aw(a,c);if(!(0,f.existsSync)(d)){if("all"!==b)return void console.log("No settings file found. Nothing to remove.");continue}if(!ax(d).hooks){if("all"!==b)return void console.log("No hooks found in settings. Nothing to remove.");continue}let e=function(a){let b=ax(a);if(!b.hooks)return 0;let c=0;for(let a of Object.keys(b.hooks)){let d=b.hooks[a];if(Array.isArray(d)){for(let a=d.length-1;a>=0;a--){let b=d[a];if(!b.hooks)continue;let e=b.hooks.length;b.hooks=b.hooks.filter(a=>!az(a)),c+=e-b.hooks.length,0===b.hooks.length&&d.splice(a,1)}0===d.length&&delete b.hooks[a]}}return 0===Object.keys(b.hooks).length&&delete b.hooks,ay(a,b),c}(d);i+=e,"all"!==b&&(console.log(`Removed ${e} claudeye hook(s) from settings.`),console.log(`Settings: ${d}`))}if("all"===b)for(let a of(console.log(`Removed ${i} claudeye hook(s) from all scopes.`),g))console.log(` ${a}: ${aw(a,c)}`);try{let a=(0,au.getInstanceId)();await at(a,"hooks_removed",{scope:b,removal_mode:"hooks",policies_removed:e.enabledPolicies,removed_count:i,...d?.source?{source:d.source}:{},platform:(0,h.platform)(),arch:(0,h.arch)(),os_release:(0,h.release)(),hostname_hash:(0,au.hashToId)((0,h.hostname)())})}catch{}if("all"===b||!z.some(a=>aB(a,c))){let{customHooksPath:a,policyParams:b,...c}=v();w({...c,enabledPolicies:[]})}}var aE=a.i(13095);async function aF(a){if(!(0,f.existsSync)(a))return[];let b=await (0,D.readFile)(a,"utf-8"),c=[],d=b.split(/customPolicies\.add\s*\(/);for(let a=1;a<d.length;a++){let b=d[a],e=b.match(/name:\s*["'`]([^"'`]+)["'`]/);if(!e)continue;let f=b.match(/description:\s*["'`]([^"'`]+)["'`]/),g=b.match(/events:\s*\[([^\]]+)\]/),h=g?g[1].replace(/["'`\s]/g,"").split(",").filter(Boolean).join(", "):void 0;c.push({name:e[1],description:f?.[1],eventScope:h})}return c}async function aG(){let a=v(),b=new Set(a.enabledPolicies),c=z.filter(a=>aB(a)),d=aw(c[0]??"user"),e=_.map(c=>{var d;let e,f;return{name:c.name,description:c.description,category:c.category,defaultEnabled:c.defaultEnabled,beta:!!c.beta,enabled:b.has(c.name),eventScope:(d=c.match,e=d.events?.join(", ")??"",f=d.toolNames?` \xb7 ${d.toolNames.join(", ")}`:"",`${e}${f}`),params:c.params?Object.fromEntries(Object.entries(c.params).map(([a,b])=>[a,{type:b.type,description:b.description,default:b.default}])):void 0,currentParams:c.params?a.policyParams?.[c.name]??{}:void 0}}),f=a.customHooksPath?await aF(a.customHooksPath):void 0;return{enabledPolicies:a.enabledPolicies,installedScopes:c,settingsPath:d,policies:e,customHooksPath:a.customHooksPath,customPolicies:f?.length?f:void 0}}async function aH(a,b){let c=v(),d=new Set(c.enabledPolicies);b?d.add(a):d.delete(a),w({...c,enabledPolicies:[...d]});try{let c=(0,au.getInstanceId)();await at(c,"policy_toggled",{policy_name:a,enabled:b,action:b?"enable":"disable",source:"web"})}catch{}}async function aI(a="user"){let b=v(),c=b.enabledPolicies.length>0?b.enabledPolicies:_.filter(a=>a.defaultEnabled&&!a.beta).map(a=>a.name);await aC(c,a,void 0,!1,"web")}async function aJ(a="user"){await aD(void 0,a,void 0,{source:"web"})}async function aK(a,b){let c=v(),d={...c.policyParams??{},[a]:b};w({...c,policyParams:d});try{let c=(0,au.getInstanceId)();await at(c,"policy_params_updated",{policy_name:a,param_keys:Object.keys(b),source:"web"})}catch{}}(0,aE.ensureServerEntryExports)([aG]),(0,e.registerServerReference)(aG,"0028fda270ca3d0108f87465647ffac157574432a6",null),(0,aE.ensureServerEntryExports)([aH]),(0,e.registerServerReference)(aH,"60abe89e6be833e34447862fb01bc68a7a60da91fc",null),(0,aE.ensureServerEntryExports)([aI,aJ]),(0,e.registerServerReference)(aI,"40f63cd767462f387fd39c4e8293db85c121eebdcf",null),(0,e.registerServerReference)(aJ,"40933654b4319674f826de0d6b39f25edf49f39313",null),(0,aE.ensureServerEntryExports)([aK]),(0,e.registerServerReference)(aK,"602795442f367f4a365e2ac5969e6e6371684cbe4a",null),a.s([],15387),a.i(15387),a.s(["0028fda270ca3d0108f87465647ffac157574432a6",0,aG,"002e75faef8fec11b3638d60b23cc34c6fe620bc96",()=>b.getTelemetryConfig,"00ed121d4e34eb07ff3cf35c84ea7b7bc10d677373",()=>c.logout,"402cef3876f2170f8f50b6df0d279774141e2700b1",()=>d.getHookActivityAction,"40933654b4319674f826de0d6b39f25edf49f39313",0,aJ,"40f63cd767462f387fd39c4e8293db85c121eebdcf",0,aI,"602795442f367f4a365e2ac5969e6e6371684cbe4a",0,aK,"60415f7645fb1a70067457ca7cf96ce759bc4e3e6b",()=>d.searchHookActivityAction,"60abe89e6be833e34447862fb01bc68a7a60da91fc",0,aH],76110)}];
44
44
 
45
45
  //# sourceMappingURL=%5Broot-of-the-server%5D__0-wbic0._.js.map