failproofai 0.0.6-beta.2 → 0.0.6-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (511) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/required-server-files.json +7 -1
  5. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  6. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
  10. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  11. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  12. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
  13. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  14. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  16. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/_not-found.html +2 -2
  19. package/.next/standalone/.next/server/app/_not-found.rsc +17 -17
  20. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +17 -17
  21. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  22. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +11 -11
  23. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  24. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  25. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  26. package/.next/standalone/.next/server/app/index.html +1 -1
  27. package/.next/standalone/.next/server/app/index.rsc +16 -16
  28. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  29. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +16 -16
  30. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
  31. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +11 -11
  32. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  33. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  34. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  36. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +8 -8
  37. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  39. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  40. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  42. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  43. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  44. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  46. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  47. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  49. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g72weg._.js +1 -1
  50. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_0z7w.hh._.js +1 -1
  51. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__092s1ta._.js +2 -2
  52. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09icjsf._.js +2 -2
  53. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g.lg8b._.js +2 -2
  54. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h..k-e._.js +2 -2
  55. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0okos0k._.js +2 -2
  56. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0i5kvry._.js → [root-of-the-server]__0om-5pe._.js} +2 -2
  57. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0w6l33k._.js +2 -2
  58. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__05akje6._.js → [root-of-the-server]__111.vxi._.js} +2 -2
  59. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11pa2ra._.js +2 -2
  60. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12t-wym._.js +2 -2
  61. package/.next/standalone/.next/server/chunks/ssr/_10lm7or._.js +2 -2
  62. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0xerkr6._.js +1 -1
  63. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_0q-m0y-._.js +1 -1
  64. package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0mebn66._.js +1 -1
  65. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  66. package/.next/standalone/.next/server/pages/404.html +2 -2
  67. package/.next/standalone/.next/server/pages/500.html +1 -1
  68. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  69. package/.next/standalone/.next/server/server-reference-manifest.json +9 -9
  70. package/.next/standalone/.next/static/chunks/{05j1px0r8yzh6.js → 02dqjyv6_9mhq.js} +2 -2
  71. package/.next/standalone/.next/static/chunks/{14cl9poem30dq.js → 070orfsl6.xal.js} +1 -1
  72. package/.next/standalone/.next/static/chunks/0mir9jdxn35~s.css +1 -0
  73. package/.next/standalone/.next/static/chunks/{00j0rr7rh8ef8.js → 0o547jv-k_k35.js} +1 -1
  74. package/.next/standalone/.next/static/chunks/{0ijk_kek9_wyx.js → 0pk2h2.mjxy.m.js} +1 -1
  75. package/.next/standalone/.next/static/chunks/{0xpl.oscrakvx.js → 0rcwkbh24w38b.js} +1 -1
  76. package/.next/standalone/.next/static/chunks/{1052sguyd-.ka.js → 140xx_tfr~lm_.js} +1 -1
  77. package/.next/standalone/.next/static/chunks/{0npb~873.wvg3.js → 169_e4dq~1~b6.js} +1 -1
  78. package/.next/standalone/.next/static/chunks/{0badv41uxa56..js → 17ne4p.1sw1jy.js} +1 -1
  79. package/.next/standalone/next.config.ts +6 -0
  80. package/.next/standalone/package.json +2 -2
  81. package/.next/standalone/server.js +1 -1
  82. package/bin/failproofai.mjs +91 -4
  83. package/dist/cli.mjs +1155 -54
  84. package/package.json +2 -2
  85. package/scripts/prune-standalone.mjs +128 -0
  86. package/src/auth/login.ts +104 -0
  87. package/src/auth/logout.ts +50 -0
  88. package/src/auth/token-store.ts +64 -0
  89. package/src/hooks/builtin-policies.ts +22 -20
  90. package/src/hooks/handler.ts +35 -15
  91. package/src/relay/daemon.ts +362 -0
  92. package/src/relay/pid.ts +76 -0
  93. package/src/relay/queue.ts +225 -0
  94. package/.next/standalone/.claude/settings.json +0 -316
  95. package/.next/standalone/.failproofai/policies/review-policies.mjs +0 -113
  96. package/.next/standalone/.failproofai/policies/workflow-policies.mjs +0 -63
  97. package/.next/standalone/.failproofai/policies-config.json +0 -39
  98. package/.next/standalone/.next/static/chunks/0gu_a.a80ritd.css +0 -1
  99. package/.next/standalone/AGENTS.md +0 -80
  100. package/.next/standalone/CHANGELOG.md +0 -151
  101. package/.next/standalone/CLAUDE.md +0 -165
  102. package/.next/standalone/CONTRIBUTING.md +0 -76
  103. package/.next/standalone/Dockerfile.docs +0 -12
  104. package/.next/standalone/LICENSE +0 -42
  105. package/.next/standalone/README.md +0 -301
  106. package/.next/standalone/bin/failproofai.mjs +0 -352
  107. package/.next/standalone/bun.lock +0 -1119
  108. package/.next/standalone/components.json +0 -23
  109. package/.next/standalone/dist/cli.mjs +0 -3595
  110. package/.next/standalone/dist/index.js +0 -80
  111. package/.next/standalone/docs/ar/architecture.mdx +0 -334
  112. package/.next/standalone/docs/ar/built-in-policies.mdx +0 -574
  113. package/.next/standalone/docs/ar/cli/dashboard.mdx +0 -28
  114. package/.next/standalone/docs/ar/cli/environment-variables.mdx +0 -34
  115. package/.next/standalone/docs/ar/cli/hook.mdx +0 -31
  116. package/.next/standalone/docs/ar/cli/install-policies.mdx +0 -48
  117. package/.next/standalone/docs/ar/cli/list-policies.mdx +0 -31
  118. package/.next/standalone/docs/ar/cli/remove-policies.mdx +0 -43
  119. package/.next/standalone/docs/ar/cli/version.mdx +0 -13
  120. package/.next/standalone/docs/ar/configuration.mdx +0 -223
  121. package/.next/standalone/docs/ar/custom-policies.mdx +0 -354
  122. package/.next/standalone/docs/ar/dashboard.mdx +0 -142
  123. package/.next/standalone/docs/ar/examples.mdx +0 -307
  124. package/.next/standalone/docs/ar/for-agents.mdx +0 -39
  125. package/.next/standalone/docs/ar/getting-started.mdx +0 -187
  126. package/.next/standalone/docs/ar/introduction.mdx +0 -58
  127. package/.next/standalone/docs/ar/package-aliases.mdx +0 -82
  128. package/.next/standalone/docs/ar/testing.mdx +0 -261
  129. package/.next/standalone/docs/architecture.mdx +0 -332
  130. package/.next/standalone/docs/built-in-policies.mdx +0 -574
  131. package/.next/standalone/docs/cli/dashboard.mdx +0 -28
  132. package/.next/standalone/docs/cli/environment-variables.mdx +0 -34
  133. package/.next/standalone/docs/cli/hook.mdx +0 -30
  134. package/.next/standalone/docs/cli/install-policies.mdx +0 -47
  135. package/.next/standalone/docs/cli/list-policies.mdx +0 -31
  136. package/.next/standalone/docs/cli/remove-policies.mdx +0 -43
  137. package/.next/standalone/docs/cli/version.mdx +0 -12
  138. package/.next/standalone/docs/configuration.mdx +0 -222
  139. package/.next/standalone/docs/custom-policies.mdx +0 -353
  140. package/.next/standalone/docs/dashboard.mdx +0 -142
  141. package/.next/standalone/docs/de/architecture.mdx +0 -332
  142. package/.next/standalone/docs/de/built-in-policies.mdx +0 -574
  143. package/.next/standalone/docs/de/cli/dashboard.mdx +0 -28
  144. package/.next/standalone/docs/de/cli/environment-variables.mdx +0 -34
  145. package/.next/standalone/docs/de/cli/hook.mdx +0 -30
  146. package/.next/standalone/docs/de/cli/install-policies.mdx +0 -47
  147. package/.next/standalone/docs/de/cli/list-policies.mdx +0 -31
  148. package/.next/standalone/docs/de/cli/remove-policies.mdx +0 -43
  149. package/.next/standalone/docs/de/cli/version.mdx +0 -12
  150. package/.next/standalone/docs/de/configuration.mdx +0 -222
  151. package/.next/standalone/docs/de/custom-policies.mdx +0 -353
  152. package/.next/standalone/docs/de/dashboard.mdx +0 -142
  153. package/.next/standalone/docs/de/examples.mdx +0 -307
  154. package/.next/standalone/docs/de/for-agents.mdx +0 -38
  155. package/.next/standalone/docs/de/getting-started.mdx +0 -186
  156. package/.next/standalone/docs/de/introduction.mdx +0 -57
  157. package/.next/standalone/docs/de/package-aliases.mdx +0 -82
  158. package/.next/standalone/docs/de/testing.mdx +0 -260
  159. package/.next/standalone/docs/docs.json +0 -1002
  160. package/.next/standalone/docs/es/architecture.mdx +0 -332
  161. package/.next/standalone/docs/es/built-in-policies.mdx +0 -574
  162. package/.next/standalone/docs/es/cli/dashboard.mdx +0 -28
  163. package/.next/standalone/docs/es/cli/environment-variables.mdx +0 -34
  164. package/.next/standalone/docs/es/cli/hook.mdx +0 -30
  165. package/.next/standalone/docs/es/cli/install-policies.mdx +0 -47
  166. package/.next/standalone/docs/es/cli/list-policies.mdx +0 -31
  167. package/.next/standalone/docs/es/cli/remove-policies.mdx +0 -43
  168. package/.next/standalone/docs/es/cli/version.mdx +0 -12
  169. package/.next/standalone/docs/es/configuration.mdx +0 -222
  170. package/.next/standalone/docs/es/custom-policies.mdx +0 -353
  171. package/.next/standalone/docs/es/dashboard.mdx +0 -142
  172. package/.next/standalone/docs/es/examples.mdx +0 -307
  173. package/.next/standalone/docs/es/for-agents.mdx +0 -38
  174. package/.next/standalone/docs/es/getting-started.mdx +0 -186
  175. package/.next/standalone/docs/es/introduction.mdx +0 -57
  176. package/.next/standalone/docs/es/package-aliases.mdx +0 -82
  177. package/.next/standalone/docs/es/testing.mdx +0 -260
  178. package/.next/standalone/docs/examples.mdx +0 -307
  179. package/.next/standalone/docs/favicon.ico +0 -0
  180. package/.next/standalone/docs/for-agents.mdx +0 -38
  181. package/.next/standalone/docs/fr/architecture.mdx +0 -332
  182. package/.next/standalone/docs/fr/built-in-policies.mdx +0 -574
  183. package/.next/standalone/docs/fr/cli/dashboard.mdx +0 -28
  184. package/.next/standalone/docs/fr/cli/environment-variables.mdx +0 -34
  185. package/.next/standalone/docs/fr/cli/hook.mdx +0 -30
  186. package/.next/standalone/docs/fr/cli/install-policies.mdx +0 -47
  187. package/.next/standalone/docs/fr/cli/list-policies.mdx +0 -31
  188. package/.next/standalone/docs/fr/cli/remove-policies.mdx +0 -43
  189. package/.next/standalone/docs/fr/cli/version.mdx +0 -12
  190. package/.next/standalone/docs/fr/configuration.mdx +0 -222
  191. package/.next/standalone/docs/fr/custom-policies.mdx +0 -353
  192. package/.next/standalone/docs/fr/dashboard.mdx +0 -142
  193. package/.next/standalone/docs/fr/examples.mdx +0 -307
  194. package/.next/standalone/docs/fr/for-agents.mdx +0 -38
  195. package/.next/standalone/docs/fr/getting-started.mdx +0 -186
  196. package/.next/standalone/docs/fr/introduction.mdx +0 -57
  197. package/.next/standalone/docs/fr/package-aliases.mdx +0 -82
  198. package/.next/standalone/docs/fr/testing.mdx +0 -260
  199. package/.next/standalone/docs/getting-started.mdx +0 -186
  200. package/.next/standalone/docs/he/architecture.mdx +0 -333
  201. package/.next/standalone/docs/he/built-in-policies.mdx +0 -574
  202. package/.next/standalone/docs/he/cli/dashboard.mdx +0 -28
  203. package/.next/standalone/docs/he/cli/environment-variables.mdx +0 -34
  204. package/.next/standalone/docs/he/cli/hook.mdx +0 -30
  205. package/.next/standalone/docs/he/cli/install-policies.mdx +0 -47
  206. package/.next/standalone/docs/he/cli/list-policies.mdx +0 -32
  207. package/.next/standalone/docs/he/cli/remove-policies.mdx +0 -43
  208. package/.next/standalone/docs/he/cli/version.mdx +0 -12
  209. package/.next/standalone/docs/he/configuration.mdx +0 -223
  210. package/.next/standalone/docs/he/custom-policies.mdx +0 -353
  211. package/.next/standalone/docs/he/dashboard.mdx +0 -142
  212. package/.next/standalone/docs/he/examples.mdx +0 -307
  213. package/.next/standalone/docs/he/for-agents.mdx +0 -38
  214. package/.next/standalone/docs/he/getting-started.mdx +0 -186
  215. package/.next/standalone/docs/he/introduction.mdx +0 -57
  216. package/.next/standalone/docs/he/package-aliases.mdx +0 -82
  217. package/.next/standalone/docs/he/testing.mdx +0 -260
  218. package/.next/standalone/docs/hi/architecture.mdx +0 -334
  219. package/.next/standalone/docs/hi/built-in-policies.mdx +0 -576
  220. package/.next/standalone/docs/hi/cli/dashboard.mdx +0 -28
  221. package/.next/standalone/docs/hi/cli/environment-variables.mdx +0 -34
  222. package/.next/standalone/docs/hi/cli/hook.mdx +0 -30
  223. package/.next/standalone/docs/hi/cli/install-policies.mdx +0 -47
  224. package/.next/standalone/docs/hi/cli/list-policies.mdx +0 -31
  225. package/.next/standalone/docs/hi/cli/remove-policies.mdx +0 -43
  226. package/.next/standalone/docs/hi/cli/version.mdx +0 -12
  227. package/.next/standalone/docs/hi/configuration.mdx +0 -222
  228. package/.next/standalone/docs/hi/custom-policies.mdx +0 -354
  229. package/.next/standalone/docs/hi/dashboard.mdx +0 -142
  230. package/.next/standalone/docs/hi/examples.mdx +0 -309
  231. package/.next/standalone/docs/hi/for-agents.mdx +0 -38
  232. package/.next/standalone/docs/hi/getting-started.mdx +0 -187
  233. package/.next/standalone/docs/hi/introduction.mdx +0 -57
  234. package/.next/standalone/docs/hi/package-aliases.mdx +0 -82
  235. package/.next/standalone/docs/hi/testing.mdx +0 -260
  236. package/.next/standalone/docs/i18n/README.ar.md +0 -312
  237. package/.next/standalone/docs/i18n/README.de.md +0 -307
  238. package/.next/standalone/docs/i18n/README.es.md +0 -307
  239. package/.next/standalone/docs/i18n/README.fr.md +0 -307
  240. package/.next/standalone/docs/i18n/README.he.md +0 -312
  241. package/.next/standalone/docs/i18n/README.hi.md +0 -307
  242. package/.next/standalone/docs/i18n/README.it.md +0 -307
  243. package/.next/standalone/docs/i18n/README.ja.md +0 -307
  244. package/.next/standalone/docs/i18n/README.ko.md +0 -307
  245. package/.next/standalone/docs/i18n/README.pt-br.md +0 -307
  246. package/.next/standalone/docs/i18n/README.ru.md +0 -308
  247. package/.next/standalone/docs/i18n/README.tr.md +0 -307
  248. package/.next/standalone/docs/i18n/README.vi.md +0 -307
  249. package/.next/standalone/docs/i18n/README.zh.md +0 -307
  250. package/.next/standalone/docs/introduction.mdx +0 -57
  251. package/.next/standalone/docs/it/architecture.mdx +0 -334
  252. package/.next/standalone/docs/it/built-in-policies.mdx +0 -574
  253. package/.next/standalone/docs/it/cli/dashboard.mdx +0 -28
  254. package/.next/standalone/docs/it/cli/environment-variables.mdx +0 -34
  255. package/.next/standalone/docs/it/cli/hook.mdx +0 -30
  256. package/.next/standalone/docs/it/cli/install-policies.mdx +0 -47
  257. package/.next/standalone/docs/it/cli/list-policies.mdx +0 -31
  258. package/.next/standalone/docs/it/cli/remove-policies.mdx +0 -43
  259. package/.next/standalone/docs/it/cli/version.mdx +0 -12
  260. package/.next/standalone/docs/it/configuration.mdx +0 -222
  261. package/.next/standalone/docs/it/custom-policies.mdx +0 -353
  262. package/.next/standalone/docs/it/dashboard.mdx +0 -142
  263. package/.next/standalone/docs/it/examples.mdx +0 -307
  264. package/.next/standalone/docs/it/for-agents.mdx +0 -38
  265. package/.next/standalone/docs/it/getting-started.mdx +0 -186
  266. package/.next/standalone/docs/it/introduction.mdx +0 -57
  267. package/.next/standalone/docs/it/package-aliases.mdx +0 -82
  268. package/.next/standalone/docs/it/testing.mdx +0 -260
  269. package/.next/standalone/docs/ja/architecture.mdx +0 -332
  270. package/.next/standalone/docs/ja/built-in-policies.mdx +0 -572
  271. package/.next/standalone/docs/ja/cli/dashboard.mdx +0 -28
  272. package/.next/standalone/docs/ja/cli/environment-variables.mdx +0 -34
  273. package/.next/standalone/docs/ja/cli/hook.mdx +0 -30
  274. package/.next/standalone/docs/ja/cli/install-policies.mdx +0 -47
  275. package/.next/standalone/docs/ja/cli/list-policies.mdx +0 -31
  276. package/.next/standalone/docs/ja/cli/remove-policies.mdx +0 -43
  277. package/.next/standalone/docs/ja/cli/version.mdx +0 -12
  278. package/.next/standalone/docs/ja/configuration.mdx +0 -222
  279. package/.next/standalone/docs/ja/custom-policies.mdx +0 -353
  280. package/.next/standalone/docs/ja/dashboard.mdx +0 -142
  281. package/.next/standalone/docs/ja/examples.mdx +0 -307
  282. package/.next/standalone/docs/ja/for-agents.mdx +0 -38
  283. package/.next/standalone/docs/ja/getting-started.mdx +0 -186
  284. package/.next/standalone/docs/ja/introduction.mdx +0 -57
  285. package/.next/standalone/docs/ja/package-aliases.mdx +0 -82
  286. package/.next/standalone/docs/ja/testing.mdx +0 -260
  287. package/.next/standalone/docs/ko/architecture.mdx +0 -332
  288. package/.next/standalone/docs/ko/built-in-policies.mdx +0 -572
  289. package/.next/standalone/docs/ko/cli/dashboard.mdx +0 -28
  290. package/.next/standalone/docs/ko/cli/environment-variables.mdx +0 -34
  291. package/.next/standalone/docs/ko/cli/hook.mdx +0 -30
  292. package/.next/standalone/docs/ko/cli/install-policies.mdx +0 -47
  293. package/.next/standalone/docs/ko/cli/list-policies.mdx +0 -31
  294. package/.next/standalone/docs/ko/cli/remove-policies.mdx +0 -43
  295. package/.next/standalone/docs/ko/cli/version.mdx +0 -12
  296. package/.next/standalone/docs/ko/configuration.mdx +0 -222
  297. package/.next/standalone/docs/ko/custom-policies.mdx +0 -353
  298. package/.next/standalone/docs/ko/dashboard.mdx +0 -142
  299. package/.next/standalone/docs/ko/examples.mdx +0 -307
  300. package/.next/standalone/docs/ko/for-agents.mdx +0 -38
  301. package/.next/standalone/docs/ko/getting-started.mdx +0 -186
  302. package/.next/standalone/docs/ko/introduction.mdx +0 -57
  303. package/.next/standalone/docs/ko/package-aliases.mdx +0 -82
  304. package/.next/standalone/docs/ko/testing.mdx +0 -260
  305. package/.next/standalone/docs/logo/dark.svg +0 -21
  306. package/.next/standalone/docs/logo/exosphere-dark.png +0 -0
  307. package/.next/standalone/docs/logo/exosphere-light.png +0 -0
  308. package/.next/standalone/docs/logo/light.svg +0 -21
  309. package/.next/standalone/docs/package-aliases.mdx +0 -82
  310. package/.next/standalone/docs/pt-br/architecture.mdx +0 -332
  311. package/.next/standalone/docs/pt-br/built-in-policies.mdx +0 -574
  312. package/.next/standalone/docs/pt-br/cli/dashboard.mdx +0 -28
  313. package/.next/standalone/docs/pt-br/cli/environment-variables.mdx +0 -34
  314. package/.next/standalone/docs/pt-br/cli/hook.mdx +0 -30
  315. package/.next/standalone/docs/pt-br/cli/install-policies.mdx +0 -47
  316. package/.next/standalone/docs/pt-br/cli/list-policies.mdx +0 -31
  317. package/.next/standalone/docs/pt-br/cli/remove-policies.mdx +0 -43
  318. package/.next/standalone/docs/pt-br/cli/version.mdx +0 -12
  319. package/.next/standalone/docs/pt-br/configuration.mdx +0 -222
  320. package/.next/standalone/docs/pt-br/custom-policies.mdx +0 -353
  321. package/.next/standalone/docs/pt-br/dashboard.mdx +0 -142
  322. package/.next/standalone/docs/pt-br/examples.mdx +0 -307
  323. package/.next/standalone/docs/pt-br/for-agents.mdx +0 -38
  324. package/.next/standalone/docs/pt-br/getting-started.mdx +0 -186
  325. package/.next/standalone/docs/pt-br/introduction.mdx +0 -57
  326. package/.next/standalone/docs/pt-br/package-aliases.mdx +0 -82
  327. package/.next/standalone/docs/pt-br/testing.mdx +0 -260
  328. package/.next/standalone/docs/ru/architecture.mdx +0 -333
  329. package/.next/standalone/docs/ru/built-in-policies.mdx +0 -574
  330. package/.next/standalone/docs/ru/cli/dashboard.mdx +0 -28
  331. package/.next/standalone/docs/ru/cli/environment-variables.mdx +0 -34
  332. package/.next/standalone/docs/ru/cli/hook.mdx +0 -30
  333. package/.next/standalone/docs/ru/cli/install-policies.mdx +0 -48
  334. package/.next/standalone/docs/ru/cli/list-policies.mdx +0 -32
  335. package/.next/standalone/docs/ru/cli/remove-policies.mdx +0 -43
  336. package/.next/standalone/docs/ru/cli/version.mdx +0 -12
  337. package/.next/standalone/docs/ru/configuration.mdx +0 -222
  338. package/.next/standalone/docs/ru/custom-policies.mdx +0 -354
  339. package/.next/standalone/docs/ru/dashboard.mdx +0 -142
  340. package/.next/standalone/docs/ru/examples.mdx +0 -309
  341. package/.next/standalone/docs/ru/for-agents.mdx +0 -38
  342. package/.next/standalone/docs/ru/getting-started.mdx +0 -186
  343. package/.next/standalone/docs/ru/introduction.mdx +0 -57
  344. package/.next/standalone/docs/ru/package-aliases.mdx +0 -82
  345. package/.next/standalone/docs/ru/testing.mdx +0 -260
  346. package/.next/standalone/docs/testing.mdx +0 -260
  347. package/.next/standalone/docs/tr/architecture.mdx +0 -333
  348. package/.next/standalone/docs/tr/built-in-policies.mdx +0 -574
  349. package/.next/standalone/docs/tr/cli/dashboard.mdx +0 -28
  350. package/.next/standalone/docs/tr/cli/environment-variables.mdx +0 -34
  351. package/.next/standalone/docs/tr/cli/hook.mdx +0 -30
  352. package/.next/standalone/docs/tr/cli/install-policies.mdx +0 -47
  353. package/.next/standalone/docs/tr/cli/list-policies.mdx +0 -31
  354. package/.next/standalone/docs/tr/cli/remove-policies.mdx +0 -44
  355. package/.next/standalone/docs/tr/cli/version.mdx +0 -12
  356. package/.next/standalone/docs/tr/configuration.mdx +0 -222
  357. package/.next/standalone/docs/tr/custom-policies.mdx +0 -353
  358. package/.next/standalone/docs/tr/dashboard.mdx +0 -142
  359. package/.next/standalone/docs/tr/examples.mdx +0 -308
  360. package/.next/standalone/docs/tr/for-agents.mdx +0 -38
  361. package/.next/standalone/docs/tr/getting-started.mdx +0 -186
  362. package/.next/standalone/docs/tr/introduction.mdx +0 -57
  363. package/.next/standalone/docs/tr/package-aliases.mdx +0 -82
  364. package/.next/standalone/docs/tr/testing.mdx +0 -260
  365. package/.next/standalone/docs/vi/architecture.mdx +0 -334
  366. package/.next/standalone/docs/vi/built-in-policies.mdx +0 -575
  367. package/.next/standalone/docs/vi/cli/dashboard.mdx +0 -28
  368. package/.next/standalone/docs/vi/cli/environment-variables.mdx +0 -34
  369. package/.next/standalone/docs/vi/cli/hook.mdx +0 -30
  370. package/.next/standalone/docs/vi/cli/install-policies.mdx +0 -47
  371. package/.next/standalone/docs/vi/cli/list-policies.mdx +0 -31
  372. package/.next/standalone/docs/vi/cli/remove-policies.mdx +0 -43
  373. package/.next/standalone/docs/vi/cli/version.mdx +0 -13
  374. package/.next/standalone/docs/vi/configuration.mdx +0 -222
  375. package/.next/standalone/docs/vi/custom-policies.mdx +0 -353
  376. package/.next/standalone/docs/vi/dashboard.mdx +0 -142
  377. package/.next/standalone/docs/vi/examples.mdx +0 -308
  378. package/.next/standalone/docs/vi/for-agents.mdx +0 -38
  379. package/.next/standalone/docs/vi/getting-started.mdx +0 -186
  380. package/.next/standalone/docs/vi/introduction.mdx +0 -57
  381. package/.next/standalone/docs/vi/package-aliases.mdx +0 -82
  382. package/.next/standalone/docs/vi/testing.mdx +0 -260
  383. package/.next/standalone/docs/zh/architecture.mdx +0 -332
  384. package/.next/standalone/docs/zh/built-in-policies.mdx +0 -572
  385. package/.next/standalone/docs/zh/cli/dashboard.mdx +0 -28
  386. package/.next/standalone/docs/zh/cli/environment-variables.mdx +0 -34
  387. package/.next/standalone/docs/zh/cli/hook.mdx +0 -30
  388. package/.next/standalone/docs/zh/cli/install-policies.mdx +0 -47
  389. package/.next/standalone/docs/zh/cli/list-policies.mdx +0 -31
  390. package/.next/standalone/docs/zh/cli/remove-policies.mdx +0 -43
  391. package/.next/standalone/docs/zh/cli/version.mdx +0 -12
  392. package/.next/standalone/docs/zh/configuration.mdx +0 -222
  393. package/.next/standalone/docs/zh/custom-policies.mdx +0 -353
  394. package/.next/standalone/docs/zh/dashboard.mdx +0 -142
  395. package/.next/standalone/docs/zh/examples.mdx +0 -307
  396. package/.next/standalone/docs/zh/for-agents.mdx +0 -38
  397. package/.next/standalone/docs/zh/getting-started.mdx +0 -186
  398. package/.next/standalone/docs/zh/introduction.mdx +0 -57
  399. package/.next/standalone/docs/zh/package-aliases.mdx +0 -82
  400. package/.next/standalone/docs/zh/testing.mdx +0 -260
  401. package/.next/standalone/eslint.config.mjs +0 -15
  402. package/.next/standalone/examples/convention-policies/security-policies.mjs +0 -40
  403. package/.next/standalone/examples/convention-policies/workflow-policies.mjs +0 -41
  404. package/.next/standalone/examples/policies-advanced/index.js +0 -103
  405. package/.next/standalone/examples/policies-advanced/utils.js +0 -35
  406. package/.next/standalone/examples/policies-basic.js +0 -77
  407. package/.next/standalone/examples/policies-notification.js +0 -104
  408. package/.next/standalone/node_modules/@img/colour/color.cjs +0 -1594
  409. package/.next/standalone/node_modules/@img/colour/index.cjs +0 -1
  410. package/.next/standalone/node_modules/@img/colour/package.json +0 -45
  411. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/README.md +0 -46
  412. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h +0 -221
  413. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/index.js +0 -1
  414. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3 +0 -0
  415. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/package.json +0 -42
  416. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/versions.json +0 -30
  417. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/README.md +0 -46
  418. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/glib-2.0/include/glibconfig.h +0 -221
  419. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/index.js +0 -1
  420. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.8.17.3 +0 -0
  421. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/package.json +0 -42
  422. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/versions.json +0 -30
  423. package/.next/standalone/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
  424. package/.next/standalone/node_modules/@img/sharp-linux-x64/package.json +0 -46
  425. package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64.node +0 -0
  426. package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/package.json +0 -46
  427. package/.next/standalone/node_modules/detect-libc/lib/detect-libc.js +0 -313
  428. package/.next/standalone/node_modules/detect-libc/lib/elf.js +0 -39
  429. package/.next/standalone/node_modules/detect-libc/lib/filesystem.js +0 -51
  430. package/.next/standalone/node_modules/detect-libc/lib/process.js +0 -24
  431. package/.next/standalone/node_modules/detect-libc/package.json +0 -44
  432. package/.next/standalone/node_modules/sharp/lib/channel.js +0 -177
  433. package/.next/standalone/node_modules/sharp/lib/colour.js +0 -195
  434. package/.next/standalone/node_modules/sharp/lib/composite.js +0 -212
  435. package/.next/standalone/node_modules/sharp/lib/constructor.js +0 -499
  436. package/.next/standalone/node_modules/sharp/lib/index.js +0 -16
  437. package/.next/standalone/node_modules/sharp/lib/input.js +0 -809
  438. package/.next/standalone/node_modules/sharp/lib/is.js +0 -143
  439. package/.next/standalone/node_modules/sharp/lib/libvips.js +0 -207
  440. package/.next/standalone/node_modules/sharp/lib/operation.js +0 -1016
  441. package/.next/standalone/node_modules/sharp/lib/output.js +0 -1666
  442. package/.next/standalone/node_modules/sharp/lib/resize.js +0 -595
  443. package/.next/standalone/node_modules/sharp/lib/sharp.js +0 -121
  444. package/.next/standalone/node_modules/sharp/lib/utility.js +0 -291
  445. package/.next/standalone/node_modules/sharp/node_modules/semver/classes/comparator.js +0 -143
  446. package/.next/standalone/node_modules/sharp/node_modules/semver/classes/range.js +0 -557
  447. package/.next/standalone/node_modules/sharp/node_modules/semver/classes/semver.js +0 -333
  448. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/cmp.js +0 -54
  449. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/coerce.js +0 -62
  450. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/compare.js +0 -7
  451. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/eq.js +0 -5
  452. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/gt.js +0 -5
  453. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/gte.js +0 -5
  454. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/lt.js +0 -5
  455. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/lte.js +0 -5
  456. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/neq.js +0 -5
  457. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/parse.js +0 -18
  458. package/.next/standalone/node_modules/sharp/node_modules/semver/functions/satisfies.js +0 -12
  459. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/constants.js +0 -37
  460. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/debug.js +0 -11
  461. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/identifiers.js +0 -29
  462. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/lrucache.js +0 -42
  463. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/parse-options.js +0 -17
  464. package/.next/standalone/node_modules/sharp/node_modules/semver/internal/re.js +0 -223
  465. package/.next/standalone/node_modules/sharp/node_modules/semver/package.json +0 -78
  466. package/.next/standalone/node_modules/sharp/package.json +0 -202
  467. package/.next/standalone/scripts/alias-proxy.js +0 -18
  468. package/.next/standalone/scripts/dev.ts +0 -3
  469. package/.next/standalone/scripts/install-telemetry.mjs +0 -108
  470. package/.next/standalone/scripts/launch.ts +0 -83
  471. package/.next/standalone/scripts/parse-script-args.ts +0 -87
  472. package/.next/standalone/scripts/postinstall.mjs +0 -121
  473. package/.next/standalone/scripts/preuninstall.mjs +0 -131
  474. package/.next/standalone/scripts/publish-aliases.mjs +0 -87
  475. package/.next/standalone/scripts/start.ts +0 -3
  476. package/.next/standalone/scripts/sync-hook-events-prompt.md +0 -60
  477. package/.next/standalone/scripts/translate-docs/cache.ts +0 -62
  478. package/.next/standalone/scripts/translate-docs/cli.ts +0 -357
  479. package/.next/standalone/scripts/translate-docs/config.ts +0 -248
  480. package/.next/standalone/scripts/translate-docs/mdx-translator.ts +0 -153
  481. package/.next/standalone/scripts/translate-docs/mintlify-nav.ts +0 -107
  482. package/.next/standalone/scripts/translate-docs/readme-translator.ts +0 -154
  483. package/.next/standalone/scripts/translate-docs/translator.ts +0 -68
  484. package/.next/standalone/scripts/translate-docs/types.ts +0 -43
  485. package/.next/standalone/src/cli-error.ts +0 -18
  486. package/.next/standalone/src/hooks/builtin-policies.ts +0 -1613
  487. package/.next/standalone/src/hooks/custom-hooks-loader.ts +0 -205
  488. package/.next/standalone/src/hooks/custom-hooks-registry.ts +0 -30
  489. package/.next/standalone/src/hooks/handler.ts +0 -202
  490. package/.next/standalone/src/hooks/hook-activity-store.ts +0 -349
  491. package/.next/standalone/src/hooks/hook-logger.ts +0 -133
  492. package/.next/standalone/src/hooks/hook-telemetry.ts +0 -43
  493. package/.next/standalone/src/hooks/hooks-config.ts +0 -166
  494. package/.next/standalone/src/hooks/install-prompt.ts +0 -357
  495. package/.next/standalone/src/hooks/llm-client.ts +0 -90
  496. package/.next/standalone/src/hooks/loader-utils.ts +0 -178
  497. package/.next/standalone/src/hooks/manager.ts +0 -692
  498. package/.next/standalone/src/hooks/policy-evaluator.ts +0 -224
  499. package/.next/standalone/src/hooks/policy-helpers.ts +0 -16
  500. package/.next/standalone/src/hooks/policy-registry.ts +0 -90
  501. package/.next/standalone/src/hooks/policy-types.ts +0 -77
  502. package/.next/standalone/src/hooks/types.ts +0 -63
  503. package/.next/standalone/src/index.ts +0 -19
  504. package/.next/standalone/src/posthog-key.ts +0 -5
  505. package/.next/standalone/tailwind.config.ts +0 -11
  506. package/.next/standalone/tsconfig.json +0 -42
  507. package/.next/standalone/vitest.config.e2e.mts +0 -24
  508. package/.next/standalone/vitest.config.mts +0 -23
  509. /package/.next/standalone/.next/static/{A9pNTZdoYJTVyPAYwQMx5 → wOkJXoch1UmRAmyIuKZWc}/_buildManifest.js +0 -0
  510. /package/.next/standalone/.next/static/{A9pNTZdoYJTVyPAYwQMx5 → wOkJXoch1UmRAmyIuKZWc}/_clientMiddlewareManifest.js +0 -0
  511. /package/.next/standalone/.next/static/{A9pNTZdoYJTVyPAYwQMx5 → wOkJXoch1UmRAmyIuKZWc}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[74493,a=>{"use strict";let b,c,d,e,f;var g,h=a.i(14747);function i(a){return a.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}let j=a=>void 0===a?void 0:a.variant??a.enabled,k=a=>{if("string"!=typeof a)return a;try{return JSON.parse(a)}catch{return a}};async function l(a,b=!0){try{let b=new Blob([a],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return await new Response(b).blob()}catch(a){return b&&console.error("Failed to gzip compress data",a),null}}let m="0123456789abcdef";class n{constructor(a){this.bytes=a}static ofInner(a){if(16===a.length)return new n(a);throw TypeError("not 128-bit length")}static fromFieldsV7(a,b,c,d){if(!Number.isInteger(a)||!Number.isInteger(b)||!Number.isInteger(c)||!Number.isInteger(d)||a<0||b<0||c<0||d<0||a>0xffffffffffff||b>4095||c>0x3fffffff||d>0xffffffff)throw RangeError("invalid field value");let e=new Uint8Array(16);return e[0]=a/0x10000000000,e[1]=a/0x100000000,e[2]=a/0x1000000,e[3]=a/65536,e[4]=a/256,e[5]=a,e[6]=112|b>>>8,e[7]=b,e[8]=128|c>>>24,e[9]=c>>>16,e[10]=c>>>8,e[11]=c,e[12]=d>>>24,e[13]=d>>>16,e[14]=d>>>8,e[15]=d,new n(e)}static parse(a){let b;switch(a.length){case 32:b=/^[0-9a-f]{32}$/i.exec(a)?.[0];break;case 36:b=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(a)?.slice(1,6).join("");break;case 38:b=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(a)?.slice(1,6).join("");break;case 45:b=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(a)?.slice(1,6).join("")}if(b){let a=new Uint8Array(16);for(let c=0;c<16;c+=4){let d=parseInt(b.substring(2*c,2*c+8),16);a[c+0]=d>>>24,a[c+1]=d>>>16,a[c+2]=d>>>8,a[c+3]=d}return new n(a)}throw SyntaxError("could not parse UUID string")}toString(){let a="";for(let b=0;b<this.bytes.length;b++)a+=m.charAt(this.bytes[b]>>>4),a+=m.charAt(15&this.bytes[b]),(3===b||5===b||7===b||9===b)&&(a+="-");return a}toHex(){let a="";for(let b=0;b<this.bytes.length;b++)a+=m.charAt(this.bytes[b]>>>4),a+=m.charAt(15&this.bytes[b]);return a}toJSON(){return this.toString()}getVariant(){let a=this.bytes[8]>>>4;if(a<0)throw Error("unreachable");if(a<=7)return this.bytes.every(a=>0===a)?"NIL":"VAR_0";if(a<=11)return"VAR_10";if(a<=13)return"VAR_110";if(a<=15)return this.bytes.every(a=>255===a)?"MAX":"VAR_RESERVED";throw Error("unreachable")}getVersion(){return"VAR_10"===this.getVariant()?this.bytes[6]>>>4:void 0}clone(){return new n(this.bytes.slice(0))}equals(a){return 0===this.compareTo(a)}compareTo(a){for(let b=0;b<16;b++){let c=this.bytes[b]-a.bytes[b];if(0!==c)return Math.sign(c)}return 0}}class o{constructor(a){this.timestamp=0,this.counter=0,this.random=a??p()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(a,b){let c=this.generateOrAbortCore(a,b);return void 0===c&&(this.timestamp=0,c=this.generateOrAbortCore(a,b)),c}generateOrAbortCore(a,b){if(!Number.isInteger(a)||a<1||a>0xffffffffffff)throw RangeError("`unixTsMs` must be a 48-bit positive integer");if(b<0||b>0xffffffffffff)throw RangeError("`rollbackAllowance` out of reasonable range");if(a>this.timestamp)this.timestamp=a,this.resetCounter();else{if(!(a+b>=this.timestamp))return;this.counter++,this.counter>0x3ffffffffff&&(this.timestamp++,this.resetCounter())}return n.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 a=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return a[6]=64|a[6]>>>4,a[8]=128|a[8]>>>2,n.ofInner(a)}}let p=()=>({nextUint32:()=>65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random())}),q=()=>(b||(b=new o)).generate();var r=((g={}).AnonymousId="anonymous_id",g.DistinctId="distinct_id",g.Props="props",g.EnablePersonProcessing="enable_person_processing",g.PersonMode="person_mode",g.FeatureFlagDetails="feature_flag_details",g.FeatureFlags="feature_flags",g.FeatureFlagPayloads="feature_flag_payloads",g.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",g.BootstrapFeatureFlags="bootstrap_feature_flags",g.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",g.OverrideFeatureFlags="override_feature_flags",g.Queue="queue",g.OptedOut="opted_out",g.SessionId="session_id",g.SessionStartTimestamp="session_start_timestamp",g.SessionLastTimestamp="session_timestamp",g.PersonProperties="person_properties",g.GroupProperties="group_properties",g.InstalledAppBuild="installed_app_build",g.InstalledAppVersion="installed_app_version",g.SessionReplay="session_replay",g.SurveyLastSeenDate="survey_last_seen_date",g.SurveysSeen="surveys_seen",g.Surveys="surveys",g.RemoteConfig="remote_config",g.FlagsEndpointWasHit="flags_endpoint_was_hit",g.DeviceId="device_id",g);let s={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:a=>`api_error_${a}`},t=Array.isArray,u=Object.prototype;u.hasOwnProperty;let v=u.toString,w=t||function(a){return"[object Array]"===v.call(a)},x=a=>"[object String]"==v.call(a);function y(a){return null===a||"object"!=typeof a}function z(a,b){return Object.prototype.toString.call(a)===`[object ${b}]`}function A(a){return"u">typeof Event&&function(a,b){try{return a instanceof b}catch{return!1}}(a,Event)}let B="Android",C="BlackBerry",D="Nintendo",E="PlayStation",F="Xbox",G="Windows",H="(\\d+(\\.\\d+)?)";RegExp("Version/"+H),RegExp(F,"i"),RegExp(E+" \\w+","i"),RegExp(D+" \\w+","i"),RegExp(C+"|PlayBook|BB10","i");async function I(a,b){let c=null;for(let d=0;d<b.retryCount+1;d++){d>0&&await new Promise(a=>setTimeout(a,b.retryDelay));try{return await a()}catch(a){if(c=a,!b.retryCheck(a))throw a}}throw c}function J(){return new Date().toISOString()}function K(a,b){let c=setTimeout(a,b);return c?.unref&&c?.unref(),c}RegExp("rv:"+H),RegExp("Edge?\\/"+H),RegExp("(Chrome|CrMo)\\/"+H),RegExp("CriOS\\/"+H),RegExp("(UCBrowser|UCWEB)\\/"+H),RegExp("(Opera|OPR)\\/"+H),RegExp("Firefox\\/"+H),RegExp("FxiOS\\/"+H),RegExp("Konqueror[:/]?"+H,"i"),RegExp(C+" "+H),RegExp("android\\s"+H,"i"),RegExp("SamsungBrowser\\/"+H),RegExp("(rv:|MSIE )"+H),RegExp("rv:"+H),RegExp(F+"; "+F+" (.*?)[);]","i"),RegExp(D,"i"),RegExp(E,"i"),RegExp(G,"i"),RegExp("("+B+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+B+")","i");let L=a=>a instanceof Error;function M(a){return Promise.all(a.map(a=>(a??Promise.resolve()).then(a=>({status:"fulfilled",value:a}),a=>({status:"rejected",reason:a}))))}class N{constructor(){this.events={},this.events={}}on(a,b){return this.events[a]||(this.events[a]=[]),this.events[a].push(b),()=>{this.events[a]=this.events[a].filter(a=>a!==b)}}emit(a,b){for(let c of this.events[a]||[])c(b);for(let c of this.events["*"]||[])c(a,b)}}class O{add(a){let b=q().toString();return this.promiseByIds[b]=a,a.catch(()=>{}).finally(()=>{delete this.promiseByIds[b]}),a}async join(){let a=Object.values(this.promiseByIds),b=a.length;for(;b>0;)await Promise.all(a),b=(a=Object.values(this.promiseByIds)).length}get length(){return Object.keys(this.promiseByIds).length}constructor(){this.promiseByIds={}}}let P=(a,b,c)=>{function d(e,...f){b(()=>{(0,c[e])(a,...f)})}return{info:(...a)=>{d("log",...a)},warn:(...a)=>{d("warn",...a)},error:(...a)=>{d("error",...a)},critical:(...b)=>{c.error(a,...b)},createLogger:d=>P(`${a} ${d}`,b,c)}};class Q extends Error{constructor(a,b){super("HTTP error while fetching PostHog: status="+a.status+", reqByteLength="+b),this.response=a,this.reqByteLength=b,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}}class R extends Error{constructor(a){super("Network error while fetching PostHog",a instanceof Error?{cause:a}:{}),this.error=a,this.name="PostHogFetchNetworkError"}}async function S(a){if(a instanceof Q){let b="";try{b=await a.text}catch{}console.error(`Error while flushing PostHog: message=${a.message}, response body=${b}`,a)}else console.error("Error while flushing PostHog",a);return Promise.resolve()}function T(a){return"object"==typeof a&&(a instanceof Q||a instanceof R)}function U(a){return"object"==typeof a&&a instanceof Q&&413===a.status}class V{constructor(a,b={}){this.flushPromise=null,this.shutdownPromise=null,this.promiseQueue=new O,this._events=new N,this._isInitialized=!1,function(a,b){if(!a||"string"!=typeof a||0===a.trim().length)throw Error(b)}(a,"You must pass your PostHog project's api key."),this.apiKey=a,this.host=function(a){return a?.replace(/\/+$/,"")}(b.host||"https://us.i.posthog.com"),this.flushAt=b.flushAt?Math.max(b.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,b.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,b.maxQueueSize??1e3),this.flushInterval=b.flushInterval??1e4,this.preloadFeatureFlags=b.preloadFeatureFlags??!0,this.defaultOptIn=b.defaultOptIn??!0,this.disableSurveys=b.disableSurveys??!1,this._retryOptions={retryCount:b.fetchRetryCount??3,retryDelay:b.fetchRetryDelay??3e3,retryCheck:T},this.requestTimeout=b.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=b.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=b.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=b.disableGeoip??!0,this.disabled=b.disabled??!1,this.historicalMigration=b?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0,this._logger=function(a,b=a=>a()){return P(a,b,function(a=console){return{log:a.log.bind(a),warn:a.warn.bind(a),error:a.error.bind(a),debug:a.debug.bind(a)}}())}("[PostHog]",this.logMsgIfDebug.bind(this)),this.evaluationContexts=b?.evaluationContexts??b?.evaluationEnvironments,b?.evaluationEnvironments&&!b?.evaluationContexts&&this._logger.warn("evaluationEnvironments is deprecated. Use evaluationContexts instead. This property will be removed in a future version."),this.disableCompression=!("CompressionStream"in globalThis)||(b?.disableCompression??!1)}logMsgIfDebug(a){this.isDebug&&a()}wrap(a){return this.disabled?void this._logger.warn("The client is disabled"):this._isInitialized?a():void this._initPromise.then(()=>a())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(r.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(r.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(r.OptedOut,!0)})}on(a,b){return this._events.on(a,b)}debug(a=!0){if(this.removeDebugCallback?.(),a){let a=this.on("*",(a,b)=>this._logger.info(a,b));this.removeDebugCallback=()=>{a(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(a){return{distinct_id:a.distinct_id,event:a.event,properties:{...a.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(a){return this.promiseQueue.add(a)}identifyStateless(a,b,c){this.wrap(()=>{let d={...this.buildPayload({distinct_id:a,event:"$identify",properties:b})};this.enqueue("identify",d,c)})}async identifyStatelessImmediate(a,b,c){let d={...this.buildPayload({distinct_id:a,event:"$identify",properties:b})};await this.sendImmediate("identify",d,c)}captureStateless(a,b,c,d){this.wrap(()=>{let e=this.buildPayload({distinct_id:a,event:b,properties:c});this.enqueue("capture",e,d)})}async captureStatelessImmediate(a,b,c,d){let e=this.buildPayload({distinct_id:a,event:b,properties:c});await this.sendImmediate("capture",e,d)}aliasStateless(a,b,c,d){this.wrap(()=>{let e=this.buildPayload({event:"$create_alias",distinct_id:b,properties:{...c||{},distinct_id:b,alias:a}});this.enqueue("alias",e,d)})}async aliasStatelessImmediate(a,b,c,d){let e=this.buildPayload({event:"$create_alias",distinct_id:b,properties:{...c||{},distinct_id:b,alias:a}});await this.sendImmediate("alias",e,d)}groupIdentifyStateless(a,b,c,d,e,f){this.wrap(()=>{let g=this.buildPayload({distinct_id:e||`$${a}_${b}`,event:"$groupidentify",properties:{$group_type:a,$group_key:b,$group_set:c||{},...f||{}}});this.enqueue("capture",g,d)})}async getRemoteConfig(){await this._initPromise;let a=this.host;"https://us.i.posthog.com"===a?a="https://us-assets.i.posthog.com":"https://eu.i.posthog.com"===a&&(a="https://eu-assets.i.posthog.com");let b=`${a}/array/${this.apiKey}/config`,c={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(b,c,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(a=>a.json()).catch(a=>{this._logger.error("Remote config could not be loaded",a),this._events.emit("error",a)})}async getFlags(a,b={},c={},d={},e={},f=!1){await this._initPromise;let g=`${this.host}/flags/?v=2${f?"&config=true":""}`,h={token:this.apiKey,distinct_id:a,groups:b,person_properties:c,group_properties:d,...e};c.$device_id&&(h.$device_id=c.$device_id),this.evaluationContexts&&this.evaluationContexts.length>0&&(h.evaluation_contexts=this.evaluationContexts);let i={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify(h)};return this._logger.info("Flags URL",g),this.fetchWithRetry(g,i,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(a=>a.json()).then(a=>({success:!0,response:(a=>{if("flags"in a){let b,c=Object.fromEntries(Object.entries(a.flags??{}).map(([a,b])=>[a,j(b)]).filter(([,a])=>void 0!==a)),d=Object.fromEntries(Object.keys(b=a.flags??{}).filter(a=>{let c=b[a];return c.enabled&&c.metadata&&void 0!==c.metadata.payload}).map(a=>{let c=b[a].metadata?.payload;return[a,c?k(c):void 0]}));return{...a,featureFlags:c,featureFlagPayloads:d}}{let b=a.featureFlags??{},c=Object.fromEntries(Object.entries(a.featureFlagPayloads||{}).map(([a,b])=>[a,k(b)])),d=Object.fromEntries(Object.entries(b).map(([a,b])=>{var d,e;return[a,{key:a,enabled:"string"==typeof(d=b)||d,variant:"string"==typeof d?d:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:(e=c[a])?JSON.stringify(e):void 0,description:void 0}}]}));return{...a,featureFlags:b,featureFlagPayloads:c,flags:d}}})(a)})).catch(a=>(this._events.emit("error",a),{success:!1,error:this.categorizeRequestError(a)}))}categorizeRequestError(a){if(a instanceof Q)return{type:"api_error",statusCode:a.status};if(a instanceof R){let b=a.error;return b instanceof Error&&("AbortError"===b.name||"TimeoutError"===b.name)?{type:"timeout"}:{type:"connection_error"}}return{type:"unknown_error"}}async getFeatureFlagStateless(a,b,c={},d={},e={},f){await this._initPromise;let g=await this.getFeatureFlagDetailStateless(a,b,c,d,e,f);if(void 0===g)return{response:void 0,requestId:void 0};let h=j(g.response);return void 0===h&&(h=!1),{response:h,requestId:g.requestId}}async getFeatureFlagDetailStateless(a,b,c={},d={},e={},f){await this._initPromise;let g=await this.getFeatureFlagDetailsStateless(b,c,d,e,f,[a]);if(void 0!==g)return{response:g.flags[a],requestId:g.requestId,evaluatedAt:g.evaluatedAt}}async getFeatureFlagPayloadStateless(a,b,c={},d={},e={},f){await this._initPromise;let g=await this.getFeatureFlagPayloadsStateless(b,c,d,e,f,[a]);if(!g)return;let h=g[a];return void 0===h?null:h}async getFeatureFlagPayloadsStateless(a,b={},c={},d={},e,f){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(a,b,c,d,e,f)).payloads}async getFeatureFlagsStateless(a,b={},c={},d={},e,f){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(a,b,c,d,e,f)}async getFeatureFlagsAndPayloadsStateless(a,b={},c={},d={},e,f){await this._initPromise;let g=await this.getFeatureFlagDetailsStateless(a,b,c,d,e,f);return g?{flags:g.featureFlags,payloads:g.featureFlagPayloads,requestId:g.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(a,b={},c={},d={},e,f){await this._initPromise;let g={};(e??this.disableGeoip)&&(g.geoip_disable=!0),f&&(g.flag_keys_to_evaluate=f);let h=await this.getFlags(a,b,c,d,g);if(!h.success)return;let i=h.response;return(i.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"),i.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:i?.requestId,quotaLimited:i.quotaLimited}):i}async getSurveysStateless(){if(await this._initPromise,!0===this.disableSurveys)return this._logger.info("Loading surveys is disabled."),[];let a=`${this.host}/api/surveys/?token=${this.apiKey}`,b={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},c=await this.fetchWithRetry(a,b).then(a=>{if(200!==a.status||!a.json){let b=`Surveys API could not be loaded: ${a.status}`,c=Error(b);this._logger.error(c),this._events.emit("error",Error(b));return}return a.json()}).catch(a=>{this._logger.error("Surveys API could not be loaded",a),this._events.emit("error",a)}),d=c?.surveys;return d&&this._logger.info("Surveys fetched from API: ",JSON.stringify(d)),d??[]}get props(){return this._props||(this._props=this.getPersistedProperty(r.Props)),this._props||{}}set props(a){this._props=a}async register(a){this.wrap(()=>{this.props={...this.props,...a},this.setPersistedProperty(r.Props,this.props)})}async unregister(a){this.wrap(()=>{delete this.props[a],this.setPersistedProperty(r.Props,this.props)})}processBeforeEnqueue(a){return a}async flushStorage(){}enqueue(a,b,c){this.wrap(()=>{if(this.optedOut)return void this._events.emit(a,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let d=this.prepareMessage(a,b,c);if(null===(d=this.processBeforeEnqueue(d)))return;let e=this.getPersistedProperty(r.Queue)||[];e.length>=this.maxQueueSize&&(e.shift(),this._logger.info("Queue is full, the oldest event is dropped.")),e.push({message:d}),this.setPersistedProperty(r.Queue,e),this._events.emit(a,d),e.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=K(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(a,b,c){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(a,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let d=this.prepareMessage(a,b,c);if(null===(d=this.processBeforeEnqueue(d)))return;let e={api_key:this.apiKey,batch:[d],sent_at:J()};this.historicalMigration&&(e.historical_migration=!0);let f=JSON.stringify(e),g=`${this.host}/batch/`,h=this.disableCompression?null:await l(f,this.isDebug),i={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...null!==h&&{"Content-Encoding":"gzip"}},body:h||f};try{await this.fetchWithRetry(g,i)}catch(a){this._events.emit("error",a)}}prepareMessage(a,b,c){let d={...b,type:a,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:c?.timestamp?c?.timestamp:J(),uuid:c?.uuid?c.uuid:q().toString()};return(c?.disableGeoip??this.disableGeoip)&&(d.properties||(d.properties={}),d.properties.$geoip_disable=!0),d.distinctId&&(d.distinct_id=d.distinctId,delete d.distinctId),d}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async a=>{await S(a)})}async flush(){let a=M([this.flushPromise]).then(()=>this._flush());return this.flushPromise=a,this.addPendingPromise(a),M([a]).then(()=>{this.flushPromise===a&&(this.flushPromise=null)}),a}getCustomHeaders(){let a=this.getCustomUserAgent(),b={};return a&&""!==a&&(b["User-Agent"]=a),b}async _flush(){this.clearFlushTimer(),await this._initPromise;let a=this.getPersistedProperty(r.Queue)||[];if(!a.length)return;let b=[],c=a.length;for(;a.length>0&&b.length<c;){let c=a.slice(0,this.maxBatchSize),d=c.map(a=>a.message),e=async()=>{let b=(this.getPersistedProperty(r.Queue)||[]).slice(c.length);this.setPersistedProperty(r.Queue,b),a=b,await this.flushStorage()},f={api_key:this.apiKey,batch:d,sent_at:J()};this.historicalMigration&&(f.historical_migration=!0);let g=JSON.stringify(f),h=`${this.host}/batch/`,i=this.disableCompression?null:await l(g,this.isDebug),j={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...null!==i&&{"Content-Encoding":"gzip"}},body:i||g},k={retryCheck:a=>!U(a)&&T(a)};try{await this.fetchWithRetry(h,j,k)}catch(a){if(U(a)&&d.length>1){this.maxBatchSize=Math.max(1,Math.floor(d.length/2)),this._logger.warn(`Received 413 when sending batch of size ${d.length}, reducing batch size to ${this.maxBatchSize}`);continue}throw a instanceof R||await e(),this._events.emit("error",a),a}await e(),b.push(...d)}this._events.emit("flush",b)}async fetchWithRetry(a,b,c,d){let e=b.body?b.body:"",f=-1;try{f=e instanceof Blob?e.size:Buffer.byteLength(e,"utf8")}catch{f=e instanceof Blob?e.size:new TextEncoder().encode(e).length}return await I(async()=>{let c=new AbortController,e=K(()=>c.abort(),d??this.requestTimeout),g=null;try{g=await this.fetch(a,{signal:c.signal,...b})}catch(a){throw new R(a)}finally{clearTimeout(e)}if("no-cors"!==b.mode&&(g.status<200||g.status>=400))throw new Q(g,f);return g},{...this._retryOptions,...c})}async _shutdown(a=3e4){let b;await this._initPromise;let c=!1;this.clearFlushTimer();let d=async()=>{try{for(await this.promiseQueue.join();;){let a=this.getPersistedProperty(r.Queue)||[];if(0===a.length||(await this.flush(),c))break}}catch(a){if(!T(a))throw a;await S(a)}};try{return await Promise.race([new Promise((d,e)=>{b=K(()=>{this._logger.error("Timed out while shutting down PostHog"),c=!0,e("Timeout while shutting down PostHog. Some events may not have been sent.")},a)}),d()])}finally{clearTimeout(b)}}async shutdown(a=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(a).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}}class W{constructor(a,b,c=[]){this.coercers=a,this.stackParser=b,this.modifiers=c}buildFromUnknown(a,b={}){let c=b&&b.mechanism||{handled:!0,type:"generic"},d=this.buildCoercingContext(c,b,0).apply(a),e=this.buildParsingContext(b),f=this.parseStacktrace(d,e);return{$exception_list:this.convertToExceptionList(f,c),$exception_level:"error"}}async modifyFrames(a){for(let b of a)b.stacktrace&&b.stacktrace.frames&&w(b.stacktrace.frames)&&(b.stacktrace.frames=await this.applyModifiers(b.stacktrace.frames));return a}coerceFallback(a){return{type:"Error",value:"Unknown error",stack:a.syntheticException?.stack,synthetic:!0}}parseStacktrace(a,b){let c,d;return null!=a.cause&&(c=this.parseStacktrace(a.cause,b)),""!=a.stack&&null!=a.stack&&(d=this.applyChunkIds(this.stackParser(a.stack,a.synthetic?b.skipFirstLines:0),b.chunkIdMap)),{...a,cause:c,stack:d}}applyChunkIds(a,b){return a.map(a=>(a.filename&&b&&(a.chunk_id=b[a.filename]),a))}applyCoercers(a,b){for(let c of this.coercers)if(c.match(a))return c.coerce(a,b);return this.coerceFallback(b)}async applyModifiers(a){let b=a;for(let a of this.modifiers)b=await a(b);return b}convertToExceptionList(a,b){let c={type:a.type,value:a.value,mechanism:{type:b.type??"generic",handled:b.handled??!0,synthetic:a.synthetic??!1}};a.stack&&(c.stacktrace={type:"raw",frames:a.stack});let d=[c];return null!=a.cause&&d.push(...this.convertToExceptionList(a.cause,{...b,handled:!0})),d}buildParsingContext(a){return{chunkIdMap:function(a){let b=globalThis._posthogChunkIds;if(!b)return;let f=Object.keys(b);return e&&f.length===d?e:(d=f.length,e=f.reduce((d,e)=>{c||(c={});let f=c[e];if(f)d[f[0]]=f[1];else{let f=a(e);for(let a=f.length-1;a>=0;a--){let g=f[a],h=g?.filename,i=b[e];if(h&&i){d[h]=i,c[e]=[h,i];break}}}return d},{}))}(this.stackParser),skipFirstLines:a.skipFirstLines??1}}buildCoercingContext(a,b,c=0){let d=(c,d)=>{if(d<=4){let e=this.buildCoercingContext(a,b,d);return this.applyCoercers(c,e)}};return{...b,syntheticException:0==c?b.syntheticException:void 0,mechanism:a,apply:a=>d(a,c),next:a=>d(a,c+1)}}}function X(a,b,c,d,e){let f={platform:a,filename:b,function:"<anonymous>"===c?"?":c,in_app:!0};return void 0!==d&&(f.lineno=d),void 0!==e&&(f.colno=e),f}a.s(["ErrorPropertiesBuilder",0,W],6762);let Y=(a,b)=>{let c=-1!==a.indexOf("safari-extension"),d=-1!==a.indexOf("safari-web-extension");return c||d?[-1!==a.indexOf("@")?a.split("@")[0]:"?",c?`safari-extension:${b}`:`safari-web-extension:${b}`]:[a,b]},Z=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,$=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,_=/\((\S*)(?::(\d+))(?::(\d+))\)/,aa=(a,b)=>{let c=Z.exec(a);if(c){let[,a,d,e]=c;return X(b,a,"?",+d,+e)}let d=$.exec(a);if(d){if(d[2]&&0===d[2].indexOf("eval")){let a=_.exec(d[2]);a&&(d[2]=a[1],d[3]=a[2],d[4]=a[3])}let[a,c]=Y(d[1]||"?",d[2]);return X(b,c,a,d[3]?+d[3]:void 0,d[4]?+d[4]:void 0)}},ab=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ac=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ad=(a,b)=>{let c=ab.exec(a);if(c){if(c[3]&&c[3].indexOf(" > eval")>-1){let a=ac.exec(c[3]);a&&(c[1]=c[1]||"eval",c[3]=a[1],c[4]=a[2],c[5]="")}let a=c[3],d=c[1]||"?";return[d,a]=Y(d,a),X(b,a,d,c[4]?+c[4]:void 0,c[5]?+c[5]:void 0)}},ae=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,af=(a,b)=>{let c=ae.exec(a);return c?X(b,c[2],c[1]||"?",+c[3],c[4]?+c[4]:void 0):void 0},ag=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,ah=(a,b)=>{let c=ag.exec(a);return c?X(b,c[2],c[3]||"?",+c[1]):void 0},ai=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,aj=(a,b)=>{let c=ai.exec(a);return c?X(b,c[5],c[3]||c[4]||"?",+c[1],+c[2]):void 0},ak=/^\s*[-]{4,}$/,al=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,am=(a,b)=>{let c=a.match(al);if(c){let a,d,e,f,g;if(c[1]){let b=(e=c[1]).lastIndexOf(".");if("."===e[b-1]&&b--,b>0){a=e.slice(0,b),d=e.slice(b+1);let c=a.indexOf(".Module");c>0&&(e=e.slice(c+1),a=a.slice(0,c))}f=void 0}d&&(f=a,g=d),"<anonymous>"===d&&(g=void 0,e=void 0),void 0===e&&(g=g||"?",e=f?`${f}.${g}`:g);let h=c[2]?.startsWith("file://")?c[2].slice(7):c[2],i="native"===c[5];return h?.match(/\/[A-Z]:/)&&(h=h.slice(1)),h||!c[5]||i||(h=c[5]),{filename:h?decodeURI(h):void 0,module:void 0,function:e,lineno:an(c[3]),colno:an(c[4]),in_app:function(a,b=!1){return!(b||a&&!a.startsWith("/")&&!a.match(/^[A-Z]:/)&&!a.startsWith(".")&&!a.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&void 0!==a&&!a.includes("node_modules/")}(h||"",i),platform:b}}if(a.match(ak))return{filename:a,platform:b}};function an(a){return parseInt(a||"",10)||void 0}let ao=/\(error: (.*)\)/;function ap(a){if(!a.length)return[];let b=Array.from(a);return b.reverse(),b.slice(0,50).map(a=>{var c;return{...a,filename:a.filename||((c=b)[c.length-1]||{}).filename,function:a.function||"?"}})}function aq(){return ar("web:javascript",aa,ad)}function ar(a,...b){return(c,d=0)=>{let e=[],f=c.split("\n");for(let c=d;c<f.length;c++){let d=f[c];if(d.length>1024)continue;let g=ao.test(d)?d.replace(ao,"$1"):d;if(!g.match(/\S*Error: /)){for(let c of b){let b=c(g,a);if(b){e.push(b);break}}if(e.length>=50)break}}return ap(e)}}a.s(["createDefaultStackParser",0,aq,"createStackParser",0,ar,"reverseAndStripFrames",0,ap],67970);class as{match(a){return this.isDOMException(a)||this.isDOMError(a)}coerce(a,b){let c=x(a.stack);return{type:this.getType(a),value:this.getValue(a),stack:c?a.stack:void 0,cause:a.cause?b.next(a.cause):void 0,synthetic:!1}}getType(a){return this.isDOMError(a)?"DOMError":"DOMException"}getValue(a){let b=a.name||(this.isDOMError(a)?"DOMError":"DOMException");return a.message?`${b}: ${a.message}`:b}isDOMException(a){return z(a,"DOMException")}isDOMError(a){return z(a,"DOMError")}}a.s(["DOMExceptionCoercer",0,as],51671);class at{match(a){return a instanceof Error}coerce(a,b){return{type:this.getType(a),value:this.getMessage(a,b),stack:this.getStack(a),cause:a.cause?b.next(a.cause):void 0,synthetic:!1}}getType(a){return a.name||a.constructor.name}getMessage(a,b){let c=a.message;return c.error&&"string"==typeof c.error.message?String(c.error.message):String(c)}getStack(a){return a.stacktrace||a.stack||void 0}}a.s(["ErrorCoercer",0,at],10692);class au{match(a){return z(a,"ErrorEvent")&&void 0!=a.error}coerce(a,b){let c=b.apply(a.error);return c||{type:"ErrorEvent",value:a.message,stack:b.syntheticException?.stack,synthetic:!0}}}a.s(["ErrorEventCoercer",0,au],75368);let av=["fatal","error","warning","log","info","debug"];function aw(a,b=40){let c=Object.keys(a);if(c.sort(),!c.length)return"[object has no keys]";for(let a=c.length;a>0;a--){let d=c.slice(0,a).join(", ");if(!(d.length>b)){if(a===c.length)return d;return d.length<=b?d:`${d.slice(0,b)}...`}}return""}class ax{match(a){return"object"==typeof a&&null!==a}coerce(a,b){let c=this.getErrorPropertyFromObject(a);return c?b.apply(c):{type:this.getType(a),value:this.getValue(a),stack:b.syntheticException?.stack,level:this.isSeverityLevel(a.level)?a.level:"error",synthetic:!0}}getType(a){return A(a)?a.constructor.name:"Error"}getValue(a){if("name"in a&&"string"==typeof a.name){let b=`'${a.name}' captured as exception`;return"message"in a&&"string"==typeof a.message&&(b+=` with message: '${a.message}'`),b}if("message"in a&&"string"==typeof a.message)return a.message;let b=this.getObjectClassName(a),c=aw(a);return`${b&&"Object"!==b?`'${b}'`:"Object"} captured as exception with keys: ${c}`}isSeverityLevel(a){return x(a)&&!(x(a)&&0===a.trim().length)&&av.indexOf(a)>=0}getErrorPropertyFromObject(a){for(let b in a)if(Object.prototype.hasOwnProperty.call(a,b)){let c=a[b];if(L(c))return c}}getObjectClassName(a){try{let b=Object.getPrototypeOf(a);return b?b.constructor.name:void 0}catch(a){return}}}a.s(["ObjectCoercer",0,ax],93874);class ay{match(a){return A(a)}coerce(a,b){let c=a.constructor.name;return{type:c,value:`${c} captured as exception with keys: ${aw(a)}`,stack:b.syntheticException?.stack,synthetic:!0}}}a.s(["EventCoercer",0,ay],46980);class az{match(a){return y(a)}coerce(a,b){return{type:"Error",value:`Primitive value captured as exception: ${String(a)}`,stack:b.syntheticException?.stack,synthetic:!0}}}a.s(["PrimitiveCoercer",0,az],28150);class aA{match(a){return z(a,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(a)}isCustomEventWrappingRejection(a){if(!A(a))return!1;try{let b=a.detail;return null!=b&&"object"==typeof b&&"reason"in b}catch{return!1}}coerce(a,b){let c=this.getUnhandledRejectionReason(a);return y(c)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(c)}`,stack:b.syntheticException?.stack,synthetic:!0}:b.apply(c)}getUnhandledRejectionReason(a){try{if("reason"in a)return a.reason;if("detail"in a&&null!=a.detail&&"object"==typeof a.detail&&"reason"in a.detail)return a.detail.reason}catch{}return a}}a.s(["PromiseRejectionEventCoercer",0,aA],98140),a.s([],7610),a.s([],48153),a.i(48153),a.i(6762),a.i(67970),a.s(["chromeStackLineParser",0,aa,"createDefaultStackParser",0,aq,"createStackParser",0,ar,"geckoStackLineParser",0,ad,"nodeStackLineParser",0,am,"opera10StackLineParser",0,ah,"opera11StackLineParser",0,aj,"reverseAndStripFrames",0,ap,"winjsStackLineParser",0,af],64583),a.i(64583),a.i(7610),a.i(51671),a.i(10692),a.i(75368);let aB=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class aC{match(a){return"string"==typeof a}coerce(a,b){let[c,d]=this.getInfos(a);return{type:c??"Error",value:d??a,stack:b.syntheticException?.stack,synthetic:!0}}getInfos(a){let b="Error",c=a,d=a.match(aB);return d&&(b=d[1],c=d[2]),[b,c]}}a.s(["StringCoercer",0,aC],57802),a.i(57802),a.i(93874),a.i(46980),a.i(28150),a.i(98140),a.s(["DOMExceptionCoercer",0,as,"ErrorCoercer",0,at,"ErrorEventCoercer",0,au,"EventCoercer",0,ay,"ObjectCoercer",0,ax,"PrimitiveCoercer",0,az,"PromiseRejectionEventCoercer",0,aA,"StringCoercer",0,aC],54253),a.i(54253);class aD{constructor(a){this._maxSize=a,this._cache=new Map}get(a){let b=this._cache.get(a);if(void 0!==b)return this._cache.delete(a),this._cache.set(a,b),b}set(a,b){this._cache.set(a,b)}reduce(){for(;this._cache.size>=this._maxSize;){let a=this._cache.keys().next().value;a&&this._cache.delete(a)}}}a.s(["ReduceableCache",0,aD],98966),a.i(98966),a.s(["DOMExceptionCoercer",0,as,"ErrorCoercer",0,at,"ErrorEventCoercer",0,au,"ErrorPropertiesBuilder",0,W,"EventCoercer",0,ay,"ObjectCoercer",0,ax,"PrimitiveCoercer",0,az,"PromiseRejectionEventCoercer",0,aA,"ReduceableCache",0,aD,"StringCoercer",0,aC,"chromeStackLineParser",0,aa,"createDefaultStackParser",0,aq,"createStackParser",0,ar,"geckoStackLineParser",0,ad,"nodeStackLineParser",0,am,"opera10StackLineParser",0,ah,"opera11StackLineParser",0,aj,"reverseAndStripFrames",0,ap,"winjsStackLineParser",0,af],60485);var aE=a.i(60485),aF=aE,aG=a.i(2157),aH=a.i(1457);let aI=new aF.ReduceableCache(25),aJ=new aF.ReduceableCache(20);async function aK(a){let b={};for(let e=a.length-1;e>=0;e--){var c,d;let f=a[e],g=f?.filename;!(!f||"string"!=typeof g||"number"!=typeof f.lineno||(c=g).startsWith("node:")||c.endsWith(".min.js")||c.endsWith(".min.cjs")||c.endsWith(".min.mjs")||c.startsWith("data:")||void 0!==(d=f).lineno&&d.lineno>1e4||void 0!==d.colno&&d.colno>1e3)&&(b[g]||(b[g]=[]),b[g].push(f.lineno))}let e=Object.keys(b);if(0==e.length)return a;let f=[];for(let a of e){if(aJ.get(a))continue;let c=b[a];if(!c)continue;c.sort((a,b)=>a-b);let d=function(a){if(!a.length)return[];let b=0,c=a[0];if("number"!=typeof c)return[];let d=aM(c),e=[];for(;;){if(b===a.length-1){e.push(d);break}let c=a[b+1];if("number"!=typeof c)break;c<=d[1]?d[1]=c+7:(e.push(d),d=aM(c)),b++}return e}(c);if(d.every(b=>(function(a,b){let c=aI.get(a);if(void 0===c)return!1;for(let a=b[0];a<=b[1];a++)if(void 0===c[a])return!1;return!0})(a,b)))continue;let e=function(a,b,c){let d=a.get(b);return void 0===d?(a.set(b,c),c):d}(aI,a,{});f.push(function(a,b,c){return new Promise(d=>{let e=(0,aG.createReadStream)(a),f=(0,aH.createInterface)({input:e});function g(){e.destroy(),d()}let h=0,i=0,j=b[0];if(void 0===j)return void g();let k=j[0],l=j[1];function m(){aJ.set(a,1),f.close(),f.removeAllListeners(),g()}e.on("error",m),f.on("error",m),f.on("close",g),f.on("line",a=>{if(!(++h<k)&&(c[h]=function(a,b){let c=a,d=c.length;if(d<=150)return c;b>d&&(b=d);let e=Math.max(b-60,0);e<5&&(e=0);let f=Math.min(e+140,d);return f>d-5&&(f=d),f===d&&(e=Math.max(f-140,0)),c=c.slice(e,f),e>0&&(c=`...${c}`),f<d&&(c+="..."),c}(a,0),h>=l)){if(i===b.length-1){f.close(),f.removeAllListeners();return}let a=b[++i];if(void 0===a){f.close(),f.removeAllListeners();return}k=a[0],l=a[1]}})})}(a,d,e))}return await Promise.all(f).catch(()=>{}),a&&a.length>0&&function(a,b){for(let c of a)if(c.filename&&void 0===c.context_line&&"number"==typeof c.lineno){let a=b.get(c.filename);if(void 0===a)continue;!function(a,b,c){if(void 0===b.lineno||void 0===c)return;b.pre_context=[];for(let d=aN(a);d<a;d++){let a=c[d];if(void 0===a)return void aL(b);b.pre_context.push(a)}if(void 0===c[a])return aL(b);b.context_line=c[a];let d=function(a){return a+7}(a);b.post_context=[];for(let e=a+1;e<=d;e++){let a=c[e];if(void 0===a)break;b.post_context.push(a)}}(c.lineno,c,a)}}(a,aI),aI.reduce(),a}function aL(a){delete a.pre_context,delete a.context_line,delete a.post_context}function aM(a){return[aN(a),a+7]}function aN(a){return Math.max(1,a-7)}function aO(a,b,c,d,e){if(b>c&&(d.warn("min cannot be greater than max."),b=c),"[object Number]"==v.call(a)&&a==a)if(a>c)return d.warn(" cannot be greater than max: "+c+". Using max value instead."),c;else return a<b?(d.warn(" cannot be less than min: "+b+". Using min value instead."),b):a;return d.warn(" must be a number. using max or fallback. max: "+c+", fallback: "+e),aO(e||c,b,c,d)}class aP{constructor(a){this._buckets={},this._onBucketRateLimited=a._onBucketRateLimited,this._bucketSize=aO(a.bucketSize,0,100,a._logger),this._refillRate=aO(a.refillRate,0,this._bucketSize,a._logger),this._refillInterval=aO(a.refillInterval,0,864e5,a._logger)}_applyRefill(a,b){let c=Math.floor((b-a.lastAccess)/this._refillInterval);if(c>0){let b=c*this._refillRate;a.tokens=Math.min(a.tokens+b,this._bucketSize),a.lastAccess=a.lastAccess+c*this._refillInterval}}consumeRateLimit(a){let b=Date.now(),c=String(a),d=this._buckets[c];return d?this._applyRefill(d,b):(d={tokens:this._bucketSize,lastAccess:b},this._buckets[c]=d),0===d.tokens||(d.tokens--,0===d.tokens&&this._onBucketRateLimited?.(a),0===d.tokens)}stop(){this._buckets={}}}class aQ{constructor(a,b,c){this.client=a,this._exceptionAutocaptureEnabled=b.enableExceptionAutocapture||!1,this._logger=c,this._rateLimiter=new aP({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(a){return a===Object(a)&&!w(a)&&"__posthog_previously_captured_error"in a&&!0===a.__posthog_previously_captured_error}static async buildEventMessage(a,b,c,d){let e={...d},f=this.errorPropertiesBuilder.buildFromUnknown(a,b);return f.$exception_list=await this.errorPropertiesBuilder.modifyFrames(f.$exception_list),{event:"$exception",distinctId:c,properties:{...f,...e},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){if(this.isEnabled()){var b,c,d;let e;b=this.onException.bind(this),c=this.onFatalError.bind(this),globalThis.process?.on("uncaughtException",(e=!1,Object.assign(d=>{let f=a.g.process.listeners("uncaughtException").filter(a=>"domainUncaughtExceptionClear"!==a.name&&!0!==a._posthogErrorHandler).length;b(d,{mechanism:{type:"onuncaughtexception",handled:!1}}),e||0!==f||(e=!0,c(d))},{_posthogErrorHandler:!0}))),d=this.onException.bind(this),globalThis.process?.on("unhandledRejection",a=>d(a,{mechanism:{type:"onunhandledrejection",handled:!1}}))}}onException(a,b){this.client.addPendingPromise((async()=>{if(!aQ.isPreviouslyCapturedError(a)){let c=await aQ.buildEventMessage(a,b),d=c.properties,e=d?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(e)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:e}):this.client.capture(c)}})())}async onFatalError(a){console.error(a),await this.client.shutdown(2e3),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}}let aR=["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"],aS=function(a,b=[]){if(!a)return!1;let c=a.toLowerCase();return aR.concat(b).some(a=>{let b=a.toLowerCase();return -1!==c.indexOf(b)})},aT={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function aU(a){let b=globalThis.crypto?.subtle;if(!b)throw Error("SubtleCrypto API not available");return Array.from(new Uint8Array(await b.digest("SHA-1",new TextEncoder().encode(a)))).map(a=>a.toString(16).padStart(2,"0")).join("")}a.s(["FeatureFlagError",0,aT],46539);let aV=["is_not"];class aW extends Error{constructor(a){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=a,Object.setPrototypeOf(this,aW.prototype)}}class aX extends Error{constructor(a){super(a),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,aX.prototype)}}class aY extends Error{constructor(a){super(a),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,aY.prototype)}}class aZ{constructor({pollingInterval:a,personalApiKey:b,projectApiKey:c,timeout:d,host:e,customHeaders:f,...g}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=a,this.personalApiKey=b,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=d,this.projectApiKey=c,this.host=e,this.poller=void 0,this.fetch=g.fetch||fetch,this.onError=g.onError,this.customHeaders=f,this.onLoad=g.onLoad,this.cacheProvider=g.cacheProvider,this.strictLocalEvaluation=g.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(a=!0){this.debugMode=a}logMsgIfDebug(a){this.debugMode&&a()}createEvaluationContext(a,b={},c={},d={},e={}){return{distinctId:a,groups:b,personProperties:c,groupProperties:d,evaluationCache:e}}async getFeatureFlag(a,b,c={},d={},e={}){let f,g;if(await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return f;if(void 0!==(g=this.featureFlagsByKey[a])){let h=this.createEvaluationContext(b,c,d,e);try{f=(await this.computeFlagAndPayloadLocally(g,h)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${a} -> ${f}`))}catch(b){b instanceof aY||b instanceof aX?this.logMsgIfDebug(()=>console.debug(`${b.name} when computing flag locally: ${a}: ${b.message}`)):b instanceof Error&&this.onError?.(Error(`Error computing flag locally: ${a}: ${b}`))}}return f}async getAllFlagsAndPayloads(a,b){await this.loadFeatureFlags();let c={},d={},e=0==this.featureFlags.length,f=b?b.map(a=>this.featureFlagsByKey[a]).filter(Boolean):this.featureFlags,g={...a,evaluationCache:a.evaluationCache??{}};return await Promise.all(f.map(async a=>{try{let{value:b,payload:e}=await this.computeFlagAndPayloadLocally(a,g);c[a.key]=b,e&&(d[a.key]=e)}catch(b){b instanceof aY||b instanceof aX?this.logMsgIfDebug(()=>console.debug(`${b.name} when computing flag locally: ${a.key}: ${b.message}`)):b instanceof Error&&this.onError?.(Error(`Error computing flag locally: ${a.key}: ${b}`)),e=!0}})),{response:c,payloads:d,fallbackToFlags:e}}async computeFlagAndPayloadLocally(a,b,c={}){let d,{matchValue:e,skipLoadCheck:f=!1}=c;if(f||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};d=void 0!==e?e:await this.computeFlagValueLocally(a,b);let g=this.getFeatureFlagPayload(a.key,d);return{value:d,payload:g}}async computeFlagValueLocally(a,b){let{distinctId:c,groups:d,personProperties:e,groupProperties:f}=b;if(a.ensure_experience_continuity)throw new aX("Flag has experience continuity enabled");if(!a.active)return!1;let g=(a.filters||{}).aggregation_group_type_index;if(void 0!=g){let c=this.groupTypeMapping[String(g)];if(!c)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${g} for feature flag ${a.key}`)),new aX("Flag has unknown group type index");if(!(c in d))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${a.key} without group names passed in`)),!1;"device_id"===a.bucketing_identifier&&(e?.$device_id===void 0||e?.$device_id===null||e?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${a.key}`));let h=f[c];return await this.matchFeatureFlagProperties(a,d[c],h,b)}{let d=this.getBucketingValueForFlag(a,c,e);if(void 0===d)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${a.key} without $device_id, falling back to server evaluation`)),new aX(`Can't compute feature flag: ${a.key} without $device_id`);return await this.matchFeatureFlagProperties(a,d,e,b)}}getBucketingValueForFlag(a,b,c){if(a.filters?.aggregation_group_type_index!=void 0)return b;if("device_id"===a.bucketing_identifier){let a=c?.$device_id;if(null==a||""===a)return;return a}return b}getFeatureFlagPayload(a,b){let c=null;if(!1!==b&&null!=b&&("boolean"==typeof b?c=this.featureFlagsByKey?.[a]?.filters?.payloads?.[b.toString()]||null:"string"==typeof b&&(c=this.featureFlagsByKey?.[a]?.filters?.payloads?.[b]||null),null!=c)){if("object"==typeof c)return c;if("string"==typeof c)try{return JSON.parse(c)}catch{}return c}return null}async evaluateFlagDependency(a,b,c){let{evaluationCache:d}=c,e=a.key;if(!this.featureFlagsByKey)throw new aX("Feature flags not available for dependency evaluation");if(!("dependency_chain"in a))throw new aX(`Flag dependency property for '${e}' is missing required 'dependency_chain' field`);let f=a.dependency_chain;if(!Array.isArray(f))throw new aX(`Flag dependency property for '${e}' has an invalid 'dependency_chain' (expected array, got ${typeof f})`);if(0===f.length)throw new aX(`Circular dependency detected for flag '${e}' (empty dependency chain)`);for(let a of f){if(!(a in d)){let b=this.featureFlagsByKey[a];if(b)if(b.active)try{let e=await this.computeFlagValueLocally(b,c);d[a]=e}catch(b){throw new aX(`Error evaluating flag dependency '${a}' for flag '${e}': ${b}`)}else d[a]=!1;else throw new aX(`Missing flag dependency '${a}' for flag '${e}'`)}if(null==d[a])throw new aX(`Dependency '${a}' could not be evaluated`)}let g=d[e];return this.flagEvaluatesToExpectedValue(a.value,g)}flagEvaluatesToExpectedValue(a,b){return"boolean"==typeof a?a===b||"string"==typeof b&&""!==b&&!0===a:"string"==typeof a&&b===a}async matchFeatureFlagProperties(a,b,c,d){let e,f=a.filters||{},g=f.groups||[],h=!1;for(let i of g)try{if(await this.isConditionMatch(a,b,i,c,d)){let c=i.variant,d=f.multivariate?.variants||[];e=c&&d.some(a=>a.key===c)?c:await this.getMatchingVariant(a,b)||!0;break}}catch(a){if(a instanceof aY)throw a;if(a instanceof aX)h=!0;else throw a}if(void 0!==e)return e;if(h)throw new aX("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(a,b,c,d,e){let f=c.rollout_percentage,g=a=>{this.logMsgIfDebug(()=>console.warn(a))};if((c.properties||[]).length>0){for(let a of c.properties){let b=a.type;if(!("cohort"===b?function a(b,c,d,e=!1){let f=String(b.value);if(!(f in d))throw new aY(`cohort ${f} not found in local cohorts - likely a static cohort that requires server evaluation`);return function b(c,d,e,f=!1){if(!c)return!0;let g=c.type,h=c.values;if(!h||0===h.length)return!0;let i=!1;if("values"in h[0]){for(let a of h)try{let c=b(a,d,e,f);if("AND"===g){if(!c)return!1}else if(c)return!0}catch(b){if(b instanceof aY)throw b;if(b instanceof aX)f&&console.debug(`Failed to compute property ${a} locally: ${b}`),i=!0;else throw b}if(i)throw new aX("Can't match cohort without a given cohort property value");return"AND"===g}for(let b of h)try{let c;if("cohort"===b.type)c=a(b,d,e,f);else if("flag"===b.type){f&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${b.key||"unknown"}'`);continue}else c=a_(b,d);let h=b.negation||!1;if("AND"===g){if(!c&&!h||c&&h)return!1}else if(c&&!h||!c&&h)return!0}catch(a){if(a instanceof aY)throw a;if(a instanceof aX)f&&console.debug(`Failed to compute property ${b} locally: ${a}`),i=!0;else throw a}if(i)throw new aX("can't match cohort without a given cohort property value");return"AND"===g}(d[f],c,d,e)}(a,d,this.cohorts,this.debugMode):"flag"===b?await this.evaluateFlagDependency(a,d,e):a_(a,d,g)))return!1}if(void 0==f)return!0}return!(void 0!=f&&await a$(a.key,b)>f/100)}async getMatchingVariant(a,b){let c=await a$(a.key,b,"variant"),d=this.variantLookupTable(a).find(a=>c>=a.valueMin&&c<a.valueMax);if(d)return d.key}variantLookupTable(a){let b=[],c=0,d=0,e=a.filters||{};return(e.multivariate?.variants||[]).forEach(a=>{d=c+a.rollout_percentage/100,b.push({valueMin:c,valueMax:d,key:a.key}),c=d}),b}updateFlagState(a){this.featureFlags=a.flags,this.featureFlagsByKey=a.flags.reduce((a,b)=>(a[b.key]=b,a),{}),this.groupTypeMapping=a.groupTypeMapping,this.cohorts=a.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(a){if(this.strictLocalEvaluation)return;let b=a.filter(a=>a.ensure_experience_continuity);b.length>0&&console.warn(`[PostHog] You are using local evaluation but ${b.length} flag(s) have experience continuity enabled: ${b.map(a=>a.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(a){if(!this.cacheProvider)return!1;try{let b=await this.cacheProvider.getFlagDefinitions();if(b)return this.updateFlagState(b),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${a} (${b.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(b.flags),!0;return!1}catch(a){return this.onError?.(Error(`Failed to load from cache: ${a}`)),!1}}async loadFeatureFlags(a=!1){if(!this.loadedSuccessfullyOnce||a)return!a&&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(a=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${a}`))).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 a=!0;if(this.cacheProvider)try{a=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(a){this.onError?.(Error(`Error in shouldFetchFlagDefinitions: ${a}`))}if(!a&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let b=await this._requestFeatureFlagDefinitions();if(!b)return;switch(b.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=b.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new aW(`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 aW(`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 aW(`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 c=await b.json()??{};if(!("flags"in c))return void this.onError?.(Error(`Invalid response when getting feature flags: ${JSON.stringify(c)}`));this.flagsEtag=b.headers?.get("ETag")??void 0;let d={flags:c.flags??[],groupTypeMapping:c.group_type_mapping||{},cohorts:c.cohorts||{}};if(this.updateFlagState(d),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&a)try{await this.cacheProvider.onFlagDefinitionsReceived(d)}catch(a){this.onError?.(Error(`Failed to store in cache: ${a}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(d.flags);break}default:return}}catch(a){a instanceof aW&&this.onError?.(a)}}getPersonalApiKeyRequestOptions(a="GET",b){let c={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return b&&(c["If-None-Match"]=b),{method:a,headers:c}}_requestFeatureFlagDefinitions(){let a=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,b=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),c=null;if(this.timeout&&"number"==typeof this.timeout){let a=new AbortController;c=K(()=>{a.abort()},this.timeout),b.signal=a.signal}try{return(0,this.fetch)(a,b)}finally{clearTimeout(c)}}async stopPoller(a=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let b=this.cacheProvider.shutdown();b instanceof Promise&&await Promise.race([b,new Promise((b,c)=>setTimeout(()=>c(Error(`Cache shutdown timeout after ${a}ms`)),a))])}catch(a){this.onError?.(Error(`Error during cache shutdown: ${a}`))}}}async function a$(a,b,c=""){return parseInt((await aU(`${a}.${b}${c}`)).slice(0,15),16)/0x1000000000000000}function a_(a,b,c){let d=a.key,e=a.value,f=a.operator||"exact";if(d in b){if("is_not_set"===f)throw new aX("Operator is_not_set is not supported")}else throw new aX(`Property ${d} not found in propertyValues`);let g=b[d];if(null==g&&!aV.includes(f))return c&&c(`Property ${d} cannot have a value of null/undefined with the ${f} operator`),!1;function h(a,b){return Array.isArray(a)?a.map(a=>String(a).toLowerCase()).includes(String(b).toLowerCase()):String(a).toLowerCase()===String(b).toLowerCase()}function i(a,b,c){if("gt"===c)return a>b;if("gte"===c)return a>=b;if("lt"===c)return a<b;if("lte"===c)return a<=b;throw Error(`Invalid operator: ${c}`)}switch(f){case"exact":return h(e,g);case"is_not":return!h(e,g);case"is_set":return d in b;case"icontains":return String(g).toLowerCase().includes(String(e).toLowerCase());case"not_icontains":return!String(g).toLowerCase().includes(String(e).toLowerCase());case"regex":return a0(String(e))&&null!==String(g).match(String(e));case"not_regex":return a0(String(e))&&null===String(g).match(String(e));case"gt":case"gte":case"lt":case"lte":{let a="number"==typeof e?e:null;if("string"==typeof e)try{a=parseFloat(e)}catch(a){}if(null==a||null==g)return i(String(g),String(e),f);if("string"==typeof g)return i(g,String(e),f);return i(g,a,f)}case"is_date_after":case"is_date_before":{if("boolean"==typeof e)throw new aX("Date operations cannot be performed on boolean values");let a=function(a){let b=a.match(/^-?(?<number>[0-9]+)(?<interval>[a-z])$/),c=new Date(new Date().toISOString());if(!b)return null;{if(!b.groups)return null;let a=parseInt(b.groups.number);if(a>=1e4)return null;let d=b.groups.interval;if("h"==d)c.setUTCHours(c.getUTCHours()-a);else if("d"==d)c.setUTCDate(c.getUTCDate()-a);else if("w"==d)c.setUTCDate(c.getUTCDate()-7*a);else if("m"==d)c.setUTCMonth(c.getUTCMonth()-a);else{if("y"!=d)return null;c.setUTCFullYear(c.getUTCFullYear()-a)}return c}}(String(e));if(null==a&&(a=a3(e)),null==a)throw new aX(`Invalid date: ${e}`);let b=a3(g);if(["is_date_before"].includes(f))return b<a;return b>a}case"semver_eq":return 0===a2(a1(String(g)),a1(String(e)));case"semver_neq":return 0!==a2(a1(String(g)),a1(String(e)));case"semver_gt":return a2(a1(String(g)),a1(String(e)))>0;case"semver_gte":return a2(a1(String(g)),a1(String(e)))>=0;case"semver_lt":return 0>a2(a1(String(g)),a1(String(e)));case"semver_lte":return 0>=a2(a1(String(g)),a1(String(e)));case"semver_tilde":{let a,b=a1(String(g)),{lower:c,upper:d}={lower:[(a=a1(String(e)))[0],a[1],a[2]],upper:[a[0],a[1]+1,0]};return a2(b,c)>=0&&0>a2(b,d)}case"semver_caret":{let a=a1(String(g)),{lower:b,upper:c}=function(a){let[b,c,d]=a1(a);return{lower:[b,c,d],upper:b>0?[b+1,0,0]:c>0?[0,c+1,0]:[0,0,d+1]}}(String(e));return a2(a,b)>=0&&0>a2(a,c)}case"semver_wildcard":{let a=a1(String(g)),{lower:b,upper:c}=function(a){let b,c,d=String(a).trim().replace(/^[vV]/,"").replace(/\.\*$/,"").replace(/\*$/,"");if(!d)throw new aX(`Invalid wildcard semver: ${a}`);let e=d.split("."),f=parseInt(e[0],10);if(isNaN(f))throw new aX(`Invalid wildcard semver: ${a}`);if(1===e.length)b=[f,0,0],c=[f+1,0,0];else{let d=parseInt(e[1],10);if(isNaN(d))throw new aX(`Invalid wildcard semver: ${a}`);b=[f,d,0],c=[f,d+1,0]}return{lower:b,upper:c}}(String(e));return a2(a,b)>=0&&0>a2(a,c)}default:throw new aX(`Unknown operator: ${f}`)}}function a0(a){try{return new RegExp(a),!0}catch(a){return!1}}function a1(a){let b=String(a).trim().replace(/^[vV]/,"").split("-")[0].split("+")[0];if(!b||b.startsWith("."))throw new aX(`Invalid semver: ${a}`);let c=b.split("."),d=b=>{if(void 0===b||""===b)return 0;if(!/^\d+$/.test(b))throw new aX(`Invalid semver: ${a}`);return parseInt(b,10)};return[d(c[0]),d(c[1]),d(c[2])]}function a2(a,b){for(let c=0;c<3;c++){if(a[c]<b[c])return -1;if(a[c]>b[c])return 1}return 0}function a3(a){if(a instanceof Date)return a;if("string"==typeof a||"number"==typeof a){let b=new Date(a);if(!isNaN(b.valueOf()))return b;throw new aX(`${a} is in an invalid date format`)}throw new aX(`The date provided ${a} must be a string, number, or date object`)}class a4{getProperty(a){return this._memoryStorage[a]}setProperty(a,b){this._memoryStorage[a]=null!==b?b:void 0}constructor(){this._memoryStorage={}}}class a5 extends V{constructor(a,b={}){if(super(a,b),this._memoryStorage=new a4,this.options=b,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval="number"==typeof b.featureFlagsPollingInterval?Math.max(b.featureFlagsPollingInterval,100):3e4,"number"==typeof b.waitUntilDebounceMs&&(this.options.waitUntilDebounceMs=Math.max(b.waitUntilDebounceMs,0)),"number"==typeof b.waitUntilMaxWaitMs&&(this.options.waitUntilMaxWaitMs=Math.max(b.waitUntilMaxWaitMs,0)),b.personalApiKey){if(b.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!==b.enableLocalEvaluation&&(this.featureFlagsPoller=new aZ({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:b.personalApiKey,projectApiKey:a,timeout:b.requestTimeout??1e4,host:this.host,fetch:b.fetch,onError:a=>{this._events.emit("error",a)},onLoad:a=>{this._events.emit("localEvaluationFlagsLoaded",a)},customHeaders:this.getCustomHeaders(),cacheProvider:b.flagDefinitionCacheProvider,strictLocalEvaluation:b.strictLocalEvaluation}))}this.errorTracking=new aQ(this,b,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=b.maxCacheSize||5e4}enqueue(a,b,c){super.enqueue(a,b,c),this.scheduleDebouncedFlush()}async flush(){let a=super.flush(),b=this.options.waitUntil;if(b&&!this._waitUntilCycle)try{b(a.catch(()=>{}))}catch{}return a}scheduleDebouncedFlush(){let a=this.options.waitUntil;if(!a||this.disabled||this.optedOut)return;if(!this._waitUntilCycle){let b,c=new Promise(a=>{b=a});try{a(c)}catch{return}this._waitUntilCycle={resolve:b,startedAt:Date.now(),timer:void 0}}let b=Date.now()-this._waitUntilCycle.startedAt,c=this.options.waitUntilMaxWaitMs??500;if(void 0!==this._waitUntilCycle.timer&&clearTimeout(this._waitUntilCycle.timer),b>=c)return void this.resolveWaitUntilFlush();let d=this.options.waitUntilDebounceMs??50;this._waitUntilCycle.timer=K(()=>{this.resolveWaitUntilFlush()},d)}_consumeWaitUntilCycle(){let a=this._waitUntilCycle;return a&&(clearTimeout(a.timer),this._waitUntilCycle=void 0),a?.resolve}async resolveWaitUntilFlush(){let a=this._consumeWaitUntilCycle();try{await super.flush()}catch{}finally{a?.()}}getPersistedProperty(a){return this._memoryStorage.getProperty(a)}setPersistedProperty(a,b){return this._memoryStorage.setProperty(a,b)}fetch(a,b){return this.options.fetch?this.options.fetch(a,b):fetch(a,b)}getLibraryVersion(){return"5.29.2"}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(a=!0){super.debug(a),this.featureFlagsPoller?.debug(a)}capture(a){"string"==typeof a&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),"$exception"!==a.event||a._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(a).then(({distinctId:a,event:b,properties:c,options:d})=>super.captureStateless(a,b,c,{timestamp:d.timestamp,disableGeoip:d.disableGeoip,uuid:d.uuid})).catch(a=>{a&&console.error(a)}))}async captureImmediate(a){return"string"==typeof a&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),"$exception"!==a.event||a._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(a).then(({distinctId:a,event:b,properties:c,options:d})=>super.captureStatelessImmediate(a,b,c,{timestamp:d.timestamp,disableGeoip:d.disableGeoip,uuid:d.uuid})).catch(a=>{a&&console.error(a)}))}identify({distinctId:a,properties:b={},disableGeoip:c}){let{$set:d,$set_once:e,$anon_distinct_id:f,...g}=b;super.identifyStateless(a,{$set:d||g,$set_once:e||{},$anon_distinct_id:f??void 0},{disableGeoip:c})}async identifyImmediate({distinctId:a,properties:b={},disableGeoip:c}){let{$set:d,$set_once:e,$anon_distinct_id:f,...g}=b;super.identifyStatelessImmediate(a,{$set:d||g,$set_once:e||{},$anon_distinct_id:f??void 0},{disableGeoip:c})}alias(a){super.aliasStateless(a.alias,a.distinctId,void 0,{disableGeoip:a.disableGeoip})}async aliasImmediate(a){await super.aliasStatelessImmediate(a.alias,a.distinctId,void 0,{disableGeoip:a.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(a=3e4){return!!this.isLocalEvaluationReady()||void 0!==this.featureFlagsPoller&&new Promise(b=>{let c=setTimeout(()=>{d(),b(!1)},a),d=this._events.on("localEvaluationFlagsLoaded",a=>{clearTimeout(c),d(),b(a>0)})})}_resolveDistinctId(a,b){return"string"==typeof a?{distinctId:a,options:b}:{distinctId:this.context?.get()?.distinctId,options:a}}async _getFeatureFlagResult(a,b,c={},d){let e,f,g,h,i,j,k,l=c.sendFeatureFlagEvents??!0;if(void 0!==this._flagOverrides&&a in this._flagOverrides){let b=this._flagOverrides[a];if(void 0===b)return;let c=this._payloadOverrides?.[a];return{key:a,enabled:!1!==b,variant:"string"==typeof b?b:void 0,payload:c}}let{groups:m,disableGeoip:n}=c,{onlyEvaluateLocally:o,personProperties:p,groupProperties:q}=c,r=this.addLocalPersonAndGroupProperties(b,m,p,q);p=r.allPersonProperties,q=r.allGroupProperties;let s=this.createFeatureFlagEvaluationContext(b,m,p,q);void 0==o&&(o=this.options.strictLocalEvaluation??!1);let t=!1;if(void 0!==this.featureFlagsPoller){await this.featureFlagsPoller?.loadFeatureFlags();let b=this.featureFlagsPoller?.featureFlagsByKey[a];if(b)try{let c=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(b,s,{matchValue:d});if(c){t=!0;let d=c.value;i=b.id,k="Evaluated locally",e={key:a,enabled:!1!==d,variant:"string"==typeof d?d:void 0,payload:c.payload??void 0}}}catch(b){if(b instanceof aY||b instanceof aX)this._logger?.info(`${b.name} when computing flag locally: ${a}: ${b.message}`);else throw b}}if(!t&&!o){let b=await super.getFeatureFlagDetailsStateless(s.distinctId,s.groups,s.personProperties,s.groupProperties,n,[a]);if(void 0===b)h=aT.UNKNOWN_ERROR;else{f=b.requestId,g=b.evaluatedAt;let c=[];b.errorsWhileComputingFlags&&c.push(aT.ERRORS_WHILE_COMPUTING),b.quotaLimited?.includes("feature_flags")&&c.push(aT.QUOTA_LIMITED);let d=b.flags[a];if(void 0===d)c.push(aT.FLAG_MISSING);else{let b;if(i=d.metadata?.id,j=d.metadata?.version,k=d.reason?.description??d.reason?.code,d.metadata?.payload!==void 0)try{b=JSON.parse(d.metadata.payload)}catch{b=d.metadata.payload}e={key:a,enabled:d.enabled,variant:d.variant,payload:b}}c.length>0&&(h=c.join(","))}}if(l){let c=void 0===e?void 0:!1!==e.enabled&&(e.variant??!0),d=`${a}_${c}`;if(!(b in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[b].includes(d)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[b])?this.distinctIdHasSentFlagCalls[b].push(d):this.distinctIdHasSentFlagCalls[b]=[d];let e={$feature_flag:a,$feature_flag_response:c,$feature_flag_id:i,$feature_flag_version:j,$feature_flag_reason:k,locally_evaluated:t,[`$feature/${a}`]:c,$feature_flag_request_id:f,$feature_flag_evaluated_at:t?Date.now():g};if(t&&this.featureFlagsPoller){let a=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();void 0!==a&&(e.$feature_flag_definitions_loaded_at=a)}h&&(e.$feature_flag_error=h),this.capture({distinctId:b,event:"$feature_flag_called",properties:e,groups:m,disableGeoip:n})}}return void 0!==e&&void 0!==this._payloadOverrides&&a in this._payloadOverrides&&(e={...e,payload:this._payloadOverrides[a]}),e}async getFeatureFlag(a,b,c){let d=await this._getFeatureFlagResult(a,b,{...c,sendFeatureFlagEvents:c?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(void 0!==d)return!1!==d.enabled&&(d.variant??!0)}async getFeatureFlagPayload(a,b,c,d){if(void 0!==this._payloadOverrides&&a in this._payloadOverrides)return this._payloadOverrides[a];let e=await this._getFeatureFlagResult(a,b,{...d,sendFeatureFlagEvents:!1},c);if(void 0!==e)return e.payload??null}async getFeatureFlagResult(a,b,c){let{distinctId:d,options:e}=this._resolveDistinctId(b,c);return d?this._getFeatureFlagResult(a,d,{...e,sendFeatureFlagEvents:e?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required — pass it explicitly or use withContext()")}async getRemoteConfigPayload(a){if(!this.options.personalApiKey)throw Error("Personal API key is required for remote config payload decryption");let b=await this._requestRemoteConfigPayload(a);if(!b)return;let c=await b.json();if("string"==typeof c)try{return JSON.parse(c)}catch(a){}return c}async isFeatureEnabled(a,b,c){let d=await this.getFeatureFlag(a,b,c);if(void 0!==d)return!!d}async getAllFlags(a,b){let{distinctId:c,options:d}=this._resolveDistinctId(a,b);return c?(await this.getAllFlagsAndPayloads(c,d)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags — pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(a,b){let{distinctId:c,options:d}=this._resolveDistinctId(a,b);if(!c)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads — pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:e,disableGeoip:f,flagKeys:g}=d||{},{onlyEvaluateLocally:h,personProperties:i,groupProperties:j}=d||{},k=this.addLocalPersonAndGroupProperties(c,e,i,j);i=k.allPersonProperties,j=k.allGroupProperties;let l=this.createFeatureFlagEvaluationContext(c,e,i,j);void 0==h&&(h=this.options.strictLocalEvaluation??!1);let m=await this.featureFlagsPoller?.getAllFlagsAndPayloads(l,g),n={},o={},p=!0;if(m&&(n=m.response,o=m.payloads,p=m.fallbackToFlags),p&&!h){let a=await super.getFeatureFlagsAndPayloadsStateless(l.distinctId,l.groups,l.personProperties,l.groupProperties,f,g);n={...n,...a.flags||{}},o={...o,...a.payloads||{}}}return void 0!==this._flagOverrides&&(n={...n,...this._flagOverrides}),void 0!==this._payloadOverrides&&(o={...o,...this._payloadOverrides}),{featureFlags:n,featureFlagPayloads:o}}groupIdentify({groupType:a,groupKey:b,properties:c,distinctId:d,disableGeoip:e}){super.groupIdentifyStateless(a,b,c,{disableGeoip:e},d)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(a){let b=a=>Object.fromEntries(a.map(a=>[a,!0]));if(!1===a){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(a)){this._flagOverrides=b(a);return}if(this._isFeatureFlagOverrideOptions(a)){"flags"in a&&(!1===a.flags?this._flagOverrides=void 0:Array.isArray(a.flags)?this._flagOverrides=b(a.flags):void 0!==a.flags&&(this._flagOverrides={...a.flags})),"payloads"in a&&(!1===a.payloads?this._payloadOverrides=void 0:void 0!==a.payloads&&(this._payloadOverrides={...a.payloads}));return}this._flagOverrides={...a}}_isFeatureFlagOverrideOptions(a){if("object"!=typeof a||null===a||Array.isArray(a))return!1;if("flags"in a){let b=a.flags;if(!1===b||Array.isArray(b)||"object"==typeof b&&null!==b)return!0}if("payloads"in a){let b=a.payloads;if(!1===b||"object"==typeof b&&null!==b)return!0}return!1}withContext(a,b,c){return this.context?this.context.run(a,b,c):b()}getContext(){return this.context?.get()}enterContext(a,b){this.context?.enter(a,b)}async _shutdown(a){let b=this._consumeWaitUntilCycle();await this.featureFlagsPoller?.stopPoller(a),this.errorTracking.shutdown();try{return await super._shutdown(a)}finally{b?.()}}async _requestRemoteConfigPayload(a){if(!this.options.personalApiKey)return;let b=`${this.host}/api/projects/@current/feature_flags/${a}/remote_config?token=${encodeURIComponent(this.apiKey)}`,c={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},d=null;if(this.options.requestTimeout&&"number"==typeof this.options.requestTimeout){let a=new AbortController;d=K(()=>{a.abort()},this.options.requestTimeout),c.signal=a.signal}try{return await this.fetch(b,c)}catch(a){this._events.emit("error",a);return}finally{d&&clearTimeout(d)}}extractPropertiesFromEvent(a,b){if(!a)return{personProperties:{},groupProperties:{}};let c={},d={};for(let[e,f]of Object.entries(a))if(z(f,"Object")&&b&&e in b){let a={};for(let[b,c]of Object.entries(f))a[String(b)]=String(c);d[String(e)]=a}else c[String(e)]=String(f);return{personProperties:c,groupProperties:d}}async getFeatureFlagsForEvent(a,b,c,d){let e=d?.personProperties||{},f=d?.groupProperties||{},g=d?.flagKeys;if(d?.onlyEvaluateLocally??this.options.strictLocalEvaluation)if(!((this.featureFlagsPoller?.featureFlags?.length||0)>0))return{};else{let d={};for(let[a,c]of Object.entries(b||{}))d[a]=String(c);return await this.getAllFlags(a,{groups:d,personProperties:e,groupProperties:f,disableGeoip:c,onlyEvaluateLocally:!0,flagKeys:g})}if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let d={};for(let[a,c]of Object.entries(b||{}))d[a]=String(c);return await this.getAllFlags(a,{groups:d,personProperties:e,groupProperties:f,disableGeoip:c,onlyEvaluateLocally:!0,flagKeys:g})}return(await super.getFeatureFlagsStateless(a,b,e,f,c)).flags}addLocalPersonAndGroupProperties(a,b,c,d){let e={distinct_id:a,...c||{}},f={};if(b)for(let a of Object.keys(b))f[a]={$group_key:b[a],...d?.[a]||{}};return{allPersonProperties:e,allGroupProperties:f}}createFeatureFlagEvaluationContext(a,b,c,d){return{distinctId:a,groups:b||{},personProperties:c||{},groupProperties:d||{},evaluationCache:{}}}captureException(a,b,c,d){if(!aQ.isPreviouslyCapturedError(a)){let e=Error("PostHog syntheticException");this.addPendingPromise(aQ.buildEventMessage(a,{syntheticException:e},b,c).then(a=>this.capture({...a,uuid:d})))}}async captureExceptionImmediate(a,b,c){if(!aQ.isPreviouslyCapturedError(a)){let d=Error("PostHog syntheticException");return this.addPendingPromise(aQ.buildEventMessage(a,{syntheticException:d},b,c).then(a=>this.captureImmediate(a)))}}async prepareEventMessage(a){let{distinctId:b,event:c,properties:d,groups:e,sendFeatureFlags:f,timestamp:g,disableGeoip:h,uuid:i}=a,j=this.context?.get(),k=b||j?.distinctId,l={...this.props,...j?.properties||{},...d||{}};k||(k=q().toString(),l.$process_person_profile=!1),j?.sessionId&&!l.$session_id&&(l.$session_id=j.sessionId);let m=this._runBeforeSend({distinctId:k,event:c,properties:l,groups:e,sendFeatureFlags:f,timestamp:g,disableGeoip:h,uuid:i});if(!m)return Promise.reject(null);let n=await Promise.resolve().then(async()=>f?await this.getFeatureFlagsForEvent(m.distinctId,e,h,"object"==typeof f?f:void 0):(m.event,{})).then(a=>{let b={};if(a)for(let[c,d]of Object.entries(a))b[`$feature/${c}`]=d;let c=Object.keys(a||{}).filter(b=>a?.[b]!==!1).sort();return c.length>0&&(b.$active_feature_flags=c),b}).catch(()=>({})).then(a=>({...a,...m.properties||{},$groups:m.groups||e}));return"$pageview"===m.event&&this.options.__preview_capture_bot_pageviews&&"string"==typeof n.$raw_user_agent&&aS(n.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(m.event="$bot_pageview",n.$browser_type="bot"),{distinctId:m.distinctId,event:m.event,properties:n,options:{timestamp:m.timestamp,disableGeoip:m.disableGeoip,uuid:m.uuid}}}_runBeforeSend(a){let b=this.options.before_send;if(!b)return a;let c=Array.isArray(b)?b:[b],d=a;for(let b of c){if(!(d=b(d)))return this._logger.info(`Event '${a.event}' was rejected in beforeSend function`),null;if(!d.properties||0===Object.keys(d.properties).length){let a=`Event '${d.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(a)}}return d}}var aF=aE,a6=a.i(78500);class a7{constructor(){this.storage=new a6.AsyncLocalStorage}get(){return this.storage.getStore()}run(a,b,c){return this.storage.run(this.resolve(a,c),b)}enter(a,b){this.storage.enterWith(this.resolve(a,b))}resolve(a,b){if(b?.fresh===!0)return a;let c=this.get()||{};return{distinctId:a.distinctId??c.distinctId,sessionId:a.sessionId??c.sessionId,properties:{...c.properties||{},...a.properties||{}}}}}function a8(a,b){var c;b.use((c=a,(a,b,d,e)=>{if(aQ.isPreviouslyCapturedError(a))return void e(a);let f=b.headers["x-posthog-session-id"],g=b.headers["x-posthog-distinct-id"],h=Error("Synthetic exception");c.addPendingPromise(aQ.buildEventMessage(a,{mechanism:{type:"middleware",handled:!1},syntheticException:h},g,{$session_id:f,$current_url:b.url,$request_method:b.method,$request_path:b.path,$user_agent:b.headers["user-agent"],$response_status_code:d.statusCode,$ip:b.headers["x-forwarded-for"]||b?.socket?.remoteAddress}).then(a=>{c.capture(a)})),e(a)}))}a.s(["setupExpressErrorHandler",0,a8],40602),a.s([],51328),aQ.errorPropertiesBuilder=new aF.ErrorPropertiesBuilder([new aF.EventCoercer,new aF.ErrorCoercer,new aF.ObjectCoercer,new aF.StringCoercer,new aF.PrimitiveCoercer],aF.createStackParser("node:javascript",aF.nodeStackLineParser),[(f=function(a=process.argv[1]?(0,h.dirname)(process.argv[1]):process.cwd(),b="\\"===h.sep){let c=b?i(a):a;return a=>{if(!a)return;let d=b?i(a):a,{dir:e,base:f,ext:g}=h.posix.parse(d);(".js"===g||".mjs"===g||".cjs"===g)&&(f=f.slice(0,-1*g.length));let j=decodeURIComponent(f);e||(e=".");let k=e.lastIndexOf("/node_modules");if(k>-1)return`${e.slice(k+14).replace(/\//g,".")}:${j}`;if(e.startsWith(c)){let a=e.slice(c.length+1).replace(/\//g,".");return a?`${a}:${j}`:j}return j}}(),async a=>{for(let b of a)b.module=f(b.filename);return a}),aK]);class a9 extends a5{getLibraryId(){return"posthog-node"}initializeContext(){return new a7}}a.s(["PostHog",0,a9],81035),a.i(81035),a.i(51328);let ba="posthog-node";function bb(a,{organization:b,projectId:c,prefix:d,severityAllowList:e=["error"],sendExceptionsToPostHog:f=!0}={}){return g=>{if(!("*"===e||e.includes(g.level)))return g;g.tags||(g.tags={});let h=g.tags[bd.POSTHOG_ID_TAG];if(void 0===h)return g;let i=a.options.host??"https://us.i.posthog.com",j=new URL(`/project/${a.apiKey}/person/${h}`,i).toString();g.tags["PostHog Person URL"]=j;let k=g.exception?.values||[],l=k.map(a=>({...a,stacktrace:a.stacktrace?{...a.stacktrace,type:"raw",frames:(a.stacktrace.frames||[]).map(a=>({...a,platform:"node:javascript"}))}:void 0})),m={$exception_message:k[0]?.value||g.message,$exception_type:k[0]?.type,$exception_level:g.level,$exception_list:l,$sentry_event_id:g.event_id,$sentry_exception:g.exception,$sentry_exception_message:k[0]?.value||g.message,$sentry_exception_type:k[0]?.type,$sentry_tags:g.tags};return b&&c&&(m.$sentry_url=(d||"https://sentry.io/organizations/")+b+"/issues/?project="+c+"&query="+g.event_id),f&&a.capture({event:"$exception",distinctId:h,properties:m}),g}}function bc(a,b){let c=bb(a,b);return{name:ba,processEvent:a=>c(a)}}class bd{static #a=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(a,b,c,d,e){this.name=ba,this.name=ba,this.setupOnce=function(f,g){f(bb(a,{organization:b,projectId:g()?.getClient()?.getDsn()?.projectId,prefix:c,severityAllowList:d,sendExceptionsToPostHog:e??!0}))}}}a.s(["PostHogSentryIntegration",0,bd,"createEventProcessor",0,bb,"sentryIntegration",0,bc],9318),a.i(9318),a.i(40602),a.i(46539),a.s(["FeatureFlagError",0,s,"PostHogSentryIntegration",0,bd,"createEventProcessor",0,bb,"sentryIntegration",0,bc,"setupExpressErrorHandler",0,a8],80456),a.i(80456),a.s(["FeatureFlagError",0,s,"PostHog",0,a9,"PostHogSentryIntegration",0,bd,"createEventProcessor",0,bb,"sentryIntegration",0,bc,"setupExpressErrorHandler",0,a8],74493)}];
1
+ module.exports=[74493,a=>{"use strict";let b,c,d,e,f;var g,h=a.i(14747);function i(a){return a.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}let j=a=>void 0===a?void 0:a.variant??a.enabled,k=a=>{if("string"!=typeof a)return a;try{return JSON.parse(a)}catch{return a}};async function l(a,b=!0){try{let b=new Blob([a],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return await new Response(b).blob()}catch(a){return b&&console.error("Failed to gzip compress data",a),null}}let m="0123456789abcdef";class n{constructor(a){this.bytes=a}static ofInner(a){if(16===a.length)return new n(a);throw TypeError("not 128-bit length")}static fromFieldsV7(a,b,c,d){if(!Number.isInteger(a)||!Number.isInteger(b)||!Number.isInteger(c)||!Number.isInteger(d)||a<0||b<0||c<0||d<0||a>0xffffffffffff||b>4095||c>0x3fffffff||d>0xffffffff)throw RangeError("invalid field value");let e=new Uint8Array(16);return e[0]=a/0x10000000000,e[1]=a/0x100000000,e[2]=a/0x1000000,e[3]=a/65536,e[4]=a/256,e[5]=a,e[6]=112|b>>>8,e[7]=b,e[8]=128|c>>>24,e[9]=c>>>16,e[10]=c>>>8,e[11]=c,e[12]=d>>>24,e[13]=d>>>16,e[14]=d>>>8,e[15]=d,new n(e)}static parse(a){let b;switch(a.length){case 32:b=/^[0-9a-f]{32}$/i.exec(a)?.[0];break;case 36:b=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(a)?.slice(1,6).join("");break;case 38:b=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(a)?.slice(1,6).join("");break;case 45:b=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(a)?.slice(1,6).join("")}if(b){let a=new Uint8Array(16);for(let c=0;c<16;c+=4){let d=parseInt(b.substring(2*c,2*c+8),16);a[c+0]=d>>>24,a[c+1]=d>>>16,a[c+2]=d>>>8,a[c+3]=d}return new n(a)}throw SyntaxError("could not parse UUID string")}toString(){let a="";for(let b=0;b<this.bytes.length;b++)a+=m.charAt(this.bytes[b]>>>4),a+=m.charAt(15&this.bytes[b]),(3===b||5===b||7===b||9===b)&&(a+="-");return a}toHex(){let a="";for(let b=0;b<this.bytes.length;b++)a+=m.charAt(this.bytes[b]>>>4),a+=m.charAt(15&this.bytes[b]);return a}toJSON(){return this.toString()}getVariant(){let a=this.bytes[8]>>>4;if(a<0)throw Error("unreachable");if(a<=7)return this.bytes.every(a=>0===a)?"NIL":"VAR_0";if(a<=11)return"VAR_10";if(a<=13)return"VAR_110";if(a<=15)return this.bytes.every(a=>255===a)?"MAX":"VAR_RESERVED";throw Error("unreachable")}getVersion(){return"VAR_10"===this.getVariant()?this.bytes[6]>>>4:void 0}clone(){return new n(this.bytes.slice(0))}equals(a){return 0===this.compareTo(a)}compareTo(a){for(let b=0;b<16;b++){let c=this.bytes[b]-a.bytes[b];if(0!==c)return Math.sign(c)}return 0}}class o{constructor(a){this.timestamp=0,this.counter=0,this.random=a??p()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(a,b){let c=this.generateOrAbortCore(a,b);return void 0===c&&(this.timestamp=0,c=this.generateOrAbortCore(a,b)),c}generateOrAbortCore(a,b){if(!Number.isInteger(a)||a<1||a>0xffffffffffff)throw RangeError("`unixTsMs` must be a 48-bit positive integer");if(b<0||b>0xffffffffffff)throw RangeError("`rollbackAllowance` out of reasonable range");if(a>this.timestamp)this.timestamp=a,this.resetCounter();else{if(!(a+b>=this.timestamp))return;this.counter++,this.counter>0x3ffffffffff&&(this.timestamp++,this.resetCounter())}return n.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 a=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return a[6]=64|a[6]>>>4,a[8]=128|a[8]>>>2,n.ofInner(a)}}let p=()=>({nextUint32:()=>65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random())}),q=()=>(b||(b=new o)).generate();var r=((g={}).AnonymousId="anonymous_id",g.DistinctId="distinct_id",g.Props="props",g.EnablePersonProcessing="enable_person_processing",g.PersonMode="person_mode",g.FeatureFlagDetails="feature_flag_details",g.FeatureFlags="feature_flags",g.FeatureFlagPayloads="feature_flag_payloads",g.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",g.BootstrapFeatureFlags="bootstrap_feature_flags",g.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",g.OverrideFeatureFlags="override_feature_flags",g.Queue="queue",g.OptedOut="opted_out",g.SessionId="session_id",g.SessionStartTimestamp="session_start_timestamp",g.SessionLastTimestamp="session_timestamp",g.PersonProperties="person_properties",g.GroupProperties="group_properties",g.InstalledAppBuild="installed_app_build",g.InstalledAppVersion="installed_app_version",g.SessionReplay="session_replay",g.SurveyLastSeenDate="survey_last_seen_date",g.SurveysSeen="surveys_seen",g.Surveys="surveys",g.RemoteConfig="remote_config",g.FlagsEndpointWasHit="flags_endpoint_was_hit",g.DeviceId="device_id",g);let s={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:a=>`api_error_${a}`},t=Array.isArray,u=Object.prototype;u.hasOwnProperty;let v=u.toString,w=t||function(a){return"[object Array]"===v.call(a)},x=a=>"[object String]"==v.call(a);function y(a){return null===a||"object"!=typeof a}function z(a,b){return Object.prototype.toString.call(a)===`[object ${b}]`}function A(a){return"u">typeof Event&&function(a,b){try{return a instanceof b}catch{return!1}}(a,Event)}let B="Android",C="BlackBerry",D="Nintendo",E="PlayStation",F="Xbox",G="Windows",H="(\\d+(\\.\\d+)?)";RegExp("Version/"+H),RegExp(F,"i"),RegExp(E+" \\w+","i"),RegExp(D+" \\w+","i"),RegExp(C+"|PlayBook|BB10","i");async function I(a,b){let c=null;for(let d=0;d<b.retryCount+1;d++){d>0&&await new Promise(a=>setTimeout(a,b.retryDelay));try{return await a()}catch(a){if(c=a,!b.retryCheck(a))throw a}}throw c}function J(){return new Date().toISOString()}function K(a,b){let c=setTimeout(a,b);return c?.unref&&c?.unref(),c}RegExp("rv:"+H),RegExp("Edge?\\/"+H),RegExp("(Chrome|CrMo)\\/"+H),RegExp("CriOS\\/"+H),RegExp("(UCBrowser|UCWEB)\\/"+H),RegExp("(Opera|OPR)\\/"+H),RegExp("Firefox\\/"+H),RegExp("FxiOS\\/"+H),RegExp("Konqueror[:/]?"+H,"i"),RegExp(C+" "+H),RegExp("android\\s"+H,"i"),RegExp("SamsungBrowser\\/"+H),RegExp("(rv:|MSIE )"+H),RegExp("rv:"+H),RegExp(F+"; "+F+" (.*?)[);]","i"),RegExp(D,"i"),RegExp(E,"i"),RegExp(G,"i"),RegExp("("+B+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+B+")","i");let L=a=>a instanceof Error;function M(a){return Promise.all(a.map(a=>(a??Promise.resolve()).then(a=>({status:"fulfilled",value:a}),a=>({status:"rejected",reason:a}))))}class N{constructor(){this.events={},this.events={}}on(a,b){return this.events[a]||(this.events[a]=[]),this.events[a].push(b),()=>{this.events[a]=this.events[a].filter(a=>a!==b)}}emit(a,b){for(let c of this.events[a]||[])c(b);for(let c of this.events["*"]||[])c(a,b)}}class O{add(a){let b=q().toString();return this.promiseByIds[b]=a,a.catch(()=>{}).finally(()=>{delete this.promiseByIds[b]}),a}async join(){let a=Object.values(this.promiseByIds),b=a.length;for(;b>0;)await Promise.all(a),b=(a=Object.values(this.promiseByIds)).length}get length(){return Object.keys(this.promiseByIds).length}constructor(){this.promiseByIds={}}}let P=(a,b,c)=>{function d(e,...f){b(()=>{(0,c[e])(a,...f)})}return{info:(...a)=>{d("log",...a)},warn:(...a)=>{d("warn",...a)},error:(...a)=>{d("error",...a)},critical:(...b)=>{c.error(a,...b)},createLogger:d=>P(`${a} ${d}`,b,c)}};class Q extends Error{constructor(a,b){super("HTTP error while fetching PostHog: status="+a.status+", reqByteLength="+b),this.response=a,this.reqByteLength=b,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}}class R extends Error{constructor(a){super("Network error while fetching PostHog",a instanceof Error?{cause:a}:{}),this.error=a,this.name="PostHogFetchNetworkError"}}async function S(a){if(a instanceof Q){let b="";try{b=await a.text}catch{}console.error(`Error while flushing PostHog: message=${a.message}, response body=${b}`,a)}else console.error("Error while flushing PostHog",a);return Promise.resolve()}function T(a){return"object"==typeof a&&(a instanceof Q||a instanceof R)}function U(a){return"object"==typeof a&&a instanceof Q&&413===a.status}class V{constructor(a,b={}){this.flushPromise=null,this.shutdownPromise=null,this.promiseQueue=new O,this._events=new N,this._isInitialized=!1,function(a,b){if(!a||"string"!=typeof a||0===a.trim().length)throw Error(b)}(a,"You must pass your PostHog project's api key."),this.apiKey=a,this.host=function(a){return a?.replace(/\/+$/,"")}(b.host||"https://us.i.posthog.com"),this.flushAt=b.flushAt?Math.max(b.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,b.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,b.maxQueueSize??1e3),this.flushInterval=b.flushInterval??1e4,this.preloadFeatureFlags=b.preloadFeatureFlags??!0,this.defaultOptIn=b.defaultOptIn??!0,this.disableSurveys=b.disableSurveys??!1,this._retryOptions={retryCount:b.fetchRetryCount??3,retryDelay:b.fetchRetryDelay??3e3,retryCheck:T},this.requestTimeout=b.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=b.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=b.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=b.disableGeoip??!0,this.disabled=b.disabled??!1,this.historicalMigration=b?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0,this._logger=function(a,b=a=>a()){return P(a,b,function(a=console){return{log:a.log.bind(a),warn:a.warn.bind(a),error:a.error.bind(a),debug:a.debug.bind(a)}}())}("[PostHog]",this.logMsgIfDebug.bind(this)),this.evaluationContexts=b?.evaluationContexts??b?.evaluationEnvironments,b?.evaluationEnvironments&&!b?.evaluationContexts&&this._logger.warn("evaluationEnvironments is deprecated. Use evaluationContexts instead. This property will be removed in a future version."),this.disableCompression=!("CompressionStream"in globalThis)||(b?.disableCompression??!1)}logMsgIfDebug(a){this.isDebug&&a()}wrap(a){return this.disabled?void this._logger.warn("The client is disabled"):this._isInitialized?a():void this._initPromise.then(()=>a())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(r.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(r.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(r.OptedOut,!0)})}on(a,b){return this._events.on(a,b)}debug(a=!0){if(this.removeDebugCallback?.(),a){let a=this.on("*",(a,b)=>this._logger.info(a,b));this.removeDebugCallback=()=>{a(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(a){return{distinct_id:a.distinct_id,event:a.event,properties:{...a.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(a){return this.promiseQueue.add(a)}identifyStateless(a,b,c){this.wrap(()=>{let d={...this.buildPayload({distinct_id:a,event:"$identify",properties:b})};this.enqueue("identify",d,c)})}async identifyStatelessImmediate(a,b,c){let d={...this.buildPayload({distinct_id:a,event:"$identify",properties:b})};await this.sendImmediate("identify",d,c)}captureStateless(a,b,c,d){this.wrap(()=>{let e=this.buildPayload({distinct_id:a,event:b,properties:c});this.enqueue("capture",e,d)})}async captureStatelessImmediate(a,b,c,d){let e=this.buildPayload({distinct_id:a,event:b,properties:c});await this.sendImmediate("capture",e,d)}aliasStateless(a,b,c,d){this.wrap(()=>{let e=this.buildPayload({event:"$create_alias",distinct_id:b,properties:{...c||{},distinct_id:b,alias:a}});this.enqueue("alias",e,d)})}async aliasStatelessImmediate(a,b,c,d){let e=this.buildPayload({event:"$create_alias",distinct_id:b,properties:{...c||{},distinct_id:b,alias:a}});await this.sendImmediate("alias",e,d)}groupIdentifyStateless(a,b,c,d,e,f){this.wrap(()=>{let g=this.buildPayload({distinct_id:e||`$${a}_${b}`,event:"$groupidentify",properties:{$group_type:a,$group_key:b,$group_set:c||{},...f||{}}});this.enqueue("capture",g,d)})}async getRemoteConfig(){await this._initPromise;let a=this.host;"https://us.i.posthog.com"===a?a="https://us-assets.i.posthog.com":"https://eu.i.posthog.com"===a&&(a="https://eu-assets.i.posthog.com");let b=`${a}/array/${this.apiKey}/config`,c={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(b,c,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(a=>a.json()).catch(a=>{this._logger.error("Remote config could not be loaded",a),this._events.emit("error",a)})}async getFlags(a,b={},c={},d={},e={},f=!1){await this._initPromise;let g=`${this.host}/flags/?v=2${f?"&config=true":""}`,h={token:this.apiKey,distinct_id:a,groups:b,person_properties:c,group_properties:d,...e};c.$device_id&&(h.$device_id=c.$device_id),this.evaluationContexts&&this.evaluationContexts.length>0&&(h.evaluation_contexts=this.evaluationContexts);let i={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify(h)};return this._logger.info("Flags URL",g),this.fetchWithRetry(g,i,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(a=>a.json()).then(a=>({success:!0,response:(a=>{if("flags"in a){let b,c=Object.fromEntries(Object.entries(a.flags??{}).map(([a,b])=>[a,j(b)]).filter(([,a])=>void 0!==a)),d=Object.fromEntries(Object.keys(b=a.flags??{}).filter(a=>{let c=b[a];return c.enabled&&c.metadata&&void 0!==c.metadata.payload}).map(a=>{let c=b[a].metadata?.payload;return[a,c?k(c):void 0]}));return{...a,featureFlags:c,featureFlagPayloads:d}}{let b=a.featureFlags??{},c=Object.fromEntries(Object.entries(a.featureFlagPayloads||{}).map(([a,b])=>[a,k(b)])),d=Object.fromEntries(Object.entries(b).map(([a,b])=>{var d,e;return[a,{key:a,enabled:"string"==typeof(d=b)||d,variant:"string"==typeof d?d:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:(e=c[a])?JSON.stringify(e):void 0,description:void 0}}]}));return{...a,featureFlags:b,featureFlagPayloads:c,flags:d}}})(a)})).catch(a=>(this._events.emit("error",a),{success:!1,error:this.categorizeRequestError(a)}))}categorizeRequestError(a){if(a instanceof Q)return{type:"api_error",statusCode:a.status};if(a instanceof R){let b=a.error;return b instanceof Error&&("AbortError"===b.name||"TimeoutError"===b.name)?{type:"timeout"}:{type:"connection_error"}}return{type:"unknown_error"}}async getFeatureFlagStateless(a,b,c={},d={},e={},f){await this._initPromise;let g=await this.getFeatureFlagDetailStateless(a,b,c,d,e,f);if(void 0===g)return{response:void 0,requestId:void 0};let h=j(g.response);return void 0===h&&(h=!1),{response:h,requestId:g.requestId}}async getFeatureFlagDetailStateless(a,b,c={},d={},e={},f){await this._initPromise;let g=await this.getFeatureFlagDetailsStateless(b,c,d,e,f,[a]);if(void 0!==g)return{response:g.flags[a],requestId:g.requestId,evaluatedAt:g.evaluatedAt}}async getFeatureFlagPayloadStateless(a,b,c={},d={},e={},f){await this._initPromise;let g=await this.getFeatureFlagPayloadsStateless(b,c,d,e,f,[a]);if(!g)return;let h=g[a];return void 0===h?null:h}async getFeatureFlagPayloadsStateless(a,b={},c={},d={},e,f){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(a,b,c,d,e,f)).payloads}async getFeatureFlagsStateless(a,b={},c={},d={},e,f){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(a,b,c,d,e,f)}async getFeatureFlagsAndPayloadsStateless(a,b={},c={},d={},e,f){await this._initPromise;let g=await this.getFeatureFlagDetailsStateless(a,b,c,d,e,f);return g?{flags:g.featureFlags,payloads:g.featureFlagPayloads,requestId:g.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(a,b={},c={},d={},e,f){await this._initPromise;let g={};(e??this.disableGeoip)&&(g.geoip_disable=!0),f&&(g.flag_keys_to_evaluate=f);let h=await this.getFlags(a,b,c,d,g);if(!h.success)return;let i=h.response;return(i.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"),i.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:i?.requestId,quotaLimited:i.quotaLimited}):i}async getSurveysStateless(){if(await this._initPromise,!0===this.disableSurveys)return this._logger.info("Loading surveys is disabled."),[];let a=`${this.host}/api/surveys/?token=${this.apiKey}`,b={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},c=await this.fetchWithRetry(a,b).then(a=>{if(200!==a.status||!a.json){let b=`Surveys API could not be loaded: ${a.status}`,c=Error(b);this._logger.error(c),this._events.emit("error",Error(b));return}return a.json()}).catch(a=>{this._logger.error("Surveys API could not be loaded",a),this._events.emit("error",a)}),d=c?.surveys;return d&&this._logger.info("Surveys fetched from API: ",JSON.stringify(d)),d??[]}get props(){return this._props||(this._props=this.getPersistedProperty(r.Props)),this._props||{}}set props(a){this._props=a}async register(a){this.wrap(()=>{this.props={...this.props,...a},this.setPersistedProperty(r.Props,this.props)})}async unregister(a){this.wrap(()=>{delete this.props[a],this.setPersistedProperty(r.Props,this.props)})}processBeforeEnqueue(a){return a}async flushStorage(){}enqueue(a,b,c){this.wrap(()=>{if(this.optedOut)return void this._events.emit(a,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let d=this.prepareMessage(a,b,c);if(null===(d=this.processBeforeEnqueue(d)))return;let e=this.getPersistedProperty(r.Queue)||[];e.length>=this.maxQueueSize&&(e.shift(),this._logger.info("Queue is full, the oldest event is dropped.")),e.push({message:d}),this.setPersistedProperty(r.Queue,e),this._events.emit(a,d),e.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=K(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(a,b,c){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(a,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let d=this.prepareMessage(a,b,c);if(null===(d=this.processBeforeEnqueue(d)))return;let e={api_key:this.apiKey,batch:[d],sent_at:J()};this.historicalMigration&&(e.historical_migration=!0);let f=JSON.stringify(e),g=`${this.host}/batch/`,h=this.disableCompression?null:await l(f,this.isDebug),i={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...null!==h&&{"Content-Encoding":"gzip"}},body:h||f};try{await this.fetchWithRetry(g,i)}catch(a){this._events.emit("error",a)}}prepareMessage(a,b,c){let d={...b,type:a,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:c?.timestamp?c?.timestamp:J(),uuid:c?.uuid?c.uuid:q().toString()};return(c?.disableGeoip??this.disableGeoip)&&(d.properties||(d.properties={}),d.properties.$geoip_disable=!0),d.distinctId&&(d.distinct_id=d.distinctId,delete d.distinctId),d}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async a=>{await S(a)})}async flush(){let a=M([this.flushPromise]).then(()=>this._flush());return this.flushPromise=a,this.addPendingPromise(a),M([a]).then(()=>{this.flushPromise===a&&(this.flushPromise=null)}),a}getCustomHeaders(){let a=this.getCustomUserAgent(),b={};return a&&""!==a&&(b["User-Agent"]=a),b}async _flush(){this.clearFlushTimer(),await this._initPromise;let a=this.getPersistedProperty(r.Queue)||[];if(!a.length)return;let b=[],c=a.length;for(;a.length>0&&b.length<c;){let c=a.slice(0,this.maxBatchSize),d=c.map(a=>a.message),e=async()=>{let b=(this.getPersistedProperty(r.Queue)||[]).slice(c.length);this.setPersistedProperty(r.Queue,b),a=b,await this.flushStorage()},f={api_key:this.apiKey,batch:d,sent_at:J()};this.historicalMigration&&(f.historical_migration=!0);let g=JSON.stringify(f),h=`${this.host}/batch/`,i=this.disableCompression?null:await l(g,this.isDebug),j={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...null!==i&&{"Content-Encoding":"gzip"}},body:i||g},k={retryCheck:a=>!U(a)&&T(a)};try{await this.fetchWithRetry(h,j,k)}catch(a){if(U(a)&&d.length>1){this.maxBatchSize=Math.max(1,Math.floor(d.length/2)),this._logger.warn(`Received 413 when sending batch of size ${d.length}, reducing batch size to ${this.maxBatchSize}`);continue}throw a instanceof R||await e(),this._events.emit("error",a),a}await e(),b.push(...d)}this._events.emit("flush",b)}async fetchWithRetry(a,b,c,d){let e=b.body?b.body:"",f=-1;try{f=e instanceof Blob?e.size:Buffer.byteLength(e,"utf8")}catch{f=e instanceof Blob?e.size:new TextEncoder().encode(e).length}return await I(async()=>{let c=new AbortController,e=K(()=>c.abort(),d??this.requestTimeout),g=null;try{g=await this.fetch(a,{signal:c.signal,...b})}catch(a){throw new R(a)}finally{clearTimeout(e)}if("no-cors"!==b.mode&&(g.status<200||g.status>=400))throw new Q(g,f);return g},{...this._retryOptions,...c})}async _shutdown(a=3e4){let b;await this._initPromise;let c=!1;this.clearFlushTimer();let d=async()=>{try{for(await this.promiseQueue.join();;){let a=this.getPersistedProperty(r.Queue)||[];if(0===a.length||(await this.flush(),c))break}}catch(a){if(!T(a))throw a;await S(a)}};try{return await Promise.race([new Promise((d,e)=>{b=K(()=>{this._logger.error("Timed out while shutting down PostHog"),c=!0,e("Timeout while shutting down PostHog. Some events may not have been sent.")},a)}),d()])}finally{clearTimeout(b)}}async shutdown(a=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(a).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}}class W{constructor(a,b,c=[]){this.coercers=a,this.stackParser=b,this.modifiers=c}buildFromUnknown(a,b={}){let c=b&&b.mechanism||{handled:!0,type:"generic"},d=this.buildCoercingContext(c,b,0).apply(a),e=this.buildParsingContext(b),f=this.parseStacktrace(d,e);return{$exception_list:this.convertToExceptionList(f,c),$exception_level:"error"}}async modifyFrames(a){for(let b of a)b.stacktrace&&b.stacktrace.frames&&w(b.stacktrace.frames)&&(b.stacktrace.frames=await this.applyModifiers(b.stacktrace.frames));return a}coerceFallback(a){return{type:"Error",value:"Unknown error",stack:a.syntheticException?.stack,synthetic:!0}}parseStacktrace(a,b){let c,d;return null!=a.cause&&(c=this.parseStacktrace(a.cause,b)),""!=a.stack&&null!=a.stack&&(d=this.applyChunkIds(this.stackParser(a.stack,a.synthetic?b.skipFirstLines:0),b.chunkIdMap)),{...a,cause:c,stack:d}}applyChunkIds(a,b){return a.map(a=>(a.filename&&b&&(a.chunk_id=b[a.filename]),a))}applyCoercers(a,b){for(let c of this.coercers)if(c.match(a))return c.coerce(a,b);return this.coerceFallback(b)}async applyModifiers(a){let b=a;for(let a of this.modifiers)b=await a(b);return b}convertToExceptionList(a,b){let c={type:a.type,value:a.value,mechanism:{type:b.type??"generic",handled:b.handled??!0,synthetic:a.synthetic??!1}};a.stack&&(c.stacktrace={type:"raw",frames:a.stack});let d=[c];return null!=a.cause&&d.push(...this.convertToExceptionList(a.cause,{...b,handled:!0})),d}buildParsingContext(a){return{chunkIdMap:function(a){let b=globalThis._posthogChunkIds;if(!b)return;let f=Object.keys(b);return e&&f.length===d?e:(d=f.length,e=f.reduce((d,e)=>{c||(c={});let f=c[e];if(f)d[f[0]]=f[1];else{let f=a(e);for(let a=f.length-1;a>=0;a--){let g=f[a],h=g?.filename,i=b[e];if(h&&i){d[h]=i,c[e]=[h,i];break}}}return d},{}))}(this.stackParser),skipFirstLines:a.skipFirstLines??1}}buildCoercingContext(a,b,c=0){let d=(c,d)=>{if(d<=4){let e=this.buildCoercingContext(a,b,d);return this.applyCoercers(c,e)}};return{...b,syntheticException:0==c?b.syntheticException:void 0,mechanism:a,apply:a=>d(a,c),next:a=>d(a,c+1)}}}function X(a,b,c,d,e){let f={platform:a,filename:b,function:"<anonymous>"===c?"?":c,in_app:!0};return void 0!==d&&(f.lineno=d),void 0!==e&&(f.colno=e),f}a.s(["ErrorPropertiesBuilder",0,W],6762);let Y=(a,b)=>{let c=-1!==a.indexOf("safari-extension"),d=-1!==a.indexOf("safari-web-extension");return c||d?[-1!==a.indexOf("@")?a.split("@")[0]:"?",c?`safari-extension:${b}`:`safari-web-extension:${b}`]:[a,b]},Z=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,$=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,_=/\((\S*)(?::(\d+))(?::(\d+))\)/,aa=(a,b)=>{let c=Z.exec(a);if(c){let[,a,d,e]=c;return X(b,a,"?",+d,+e)}let d=$.exec(a);if(d){if(d[2]&&0===d[2].indexOf("eval")){let a=_.exec(d[2]);a&&(d[2]=a[1],d[3]=a[2],d[4]=a[3])}let[a,c]=Y(d[1]||"?",d[2]);return X(b,c,a,d[3]?+d[3]:void 0,d[4]?+d[4]:void 0)}},ab=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ac=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ad=(a,b)=>{let c=ab.exec(a);if(c){if(c[3]&&c[3].indexOf(" > eval")>-1){let a=ac.exec(c[3]);a&&(c[1]=c[1]||"eval",c[3]=a[1],c[4]=a[2],c[5]="")}let a=c[3],d=c[1]||"?";return[d,a]=Y(d,a),X(b,a,d,c[4]?+c[4]:void 0,c[5]?+c[5]:void 0)}},ae=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,af=(a,b)=>{let c=ae.exec(a);return c?X(b,c[2],c[1]||"?",+c[3],c[4]?+c[4]:void 0):void 0},ag=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,ah=(a,b)=>{let c=ag.exec(a);return c?X(b,c[2],c[3]||"?",+c[1]):void 0},ai=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,aj=(a,b)=>{let c=ai.exec(a);return c?X(b,c[5],c[3]||c[4]||"?",+c[1],+c[2]):void 0},ak=/^\s*[-]{4,}$/,al=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,am=(a,b)=>{let c=a.match(al);if(c){let a,d,e,f,g;if(c[1]){let b=(e=c[1]).lastIndexOf(".");if("."===e[b-1]&&b--,b>0){a=e.slice(0,b),d=e.slice(b+1);let c=a.indexOf(".Module");c>0&&(e=e.slice(c+1),a=a.slice(0,c))}f=void 0}d&&(f=a,g=d),"<anonymous>"===d&&(g=void 0,e=void 0),void 0===e&&(g=g||"?",e=f?`${f}.${g}`:g);let h=c[2]?.startsWith("file://")?c[2].slice(7):c[2],i="native"===c[5];return h?.match(/\/[A-Z]:/)&&(h=h.slice(1)),h||!c[5]||i||(h=c[5]),{filename:h?decodeURI(h):void 0,module:void 0,function:e,lineno:an(c[3]),colno:an(c[4]),in_app:function(a,b=!1){return!(b||a&&!a.startsWith("/")&&!a.match(/^[A-Z]:/)&&!a.startsWith(".")&&!a.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&void 0!==a&&!a.includes("node_modules/")}(h||"",i),platform:b}}if(a.match(ak))return{filename:a,platform:b}};function an(a){return parseInt(a||"",10)||void 0}let ao=/\(error: (.*)\)/;function ap(a){if(!a.length)return[];let b=Array.from(a);return b.reverse(),b.slice(0,50).map(a=>{var c;return{...a,filename:a.filename||((c=b)[c.length-1]||{}).filename,function:a.function||"?"}})}function aq(){return ar("web:javascript",aa,ad)}function ar(a,...b){return(c,d=0)=>{let e=[],f=c.split("\n");for(let c=d;c<f.length;c++){let d=f[c];if(d.length>1024)continue;let g=ao.test(d)?d.replace(ao,"$1"):d;if(!g.match(/\S*Error: /)){for(let c of b){let b=c(g,a);if(b){e.push(b);break}}if(e.length>=50)break}}return ap(e)}}a.s(["createDefaultStackParser",0,aq,"createStackParser",0,ar,"reverseAndStripFrames",0,ap],67970);class as{match(a){return this.isDOMException(a)||this.isDOMError(a)}coerce(a,b){let c=x(a.stack);return{type:this.getType(a),value:this.getValue(a),stack:c?a.stack:void 0,cause:a.cause?b.next(a.cause):void 0,synthetic:!1}}getType(a){return this.isDOMError(a)?"DOMError":"DOMException"}getValue(a){let b=a.name||(this.isDOMError(a)?"DOMError":"DOMException");return a.message?`${b}: ${a.message}`:b}isDOMException(a){return z(a,"DOMException")}isDOMError(a){return z(a,"DOMError")}}a.s(["DOMExceptionCoercer",0,as],51671);class at{match(a){return a instanceof Error}coerce(a,b){return{type:this.getType(a),value:this.getMessage(a,b),stack:this.getStack(a),cause:a.cause?b.next(a.cause):void 0,synthetic:!1}}getType(a){return a.name||a.constructor.name}getMessage(a,b){let c=a.message;return c.error&&"string"==typeof c.error.message?String(c.error.message):String(c)}getStack(a){return a.stacktrace||a.stack||void 0}}a.s(["ErrorCoercer",0,at],10692);class au{match(a){return z(a,"ErrorEvent")&&void 0!=a.error}coerce(a,b){let c=b.apply(a.error);return c||{type:"ErrorEvent",value:a.message,stack:b.syntheticException?.stack,synthetic:!0}}}a.s(["ErrorEventCoercer",0,au],75368);let av=["fatal","error","warning","log","info","debug"];function aw(a,b=40){let c=Object.keys(a);if(c.sort(),!c.length)return"[object has no keys]";for(let a=c.length;a>0;a--){let d=c.slice(0,a).join(", ");if(!(d.length>b)){if(a===c.length)return d;return d.length<=b?d:`${d.slice(0,b)}...`}}return""}class ax{match(a){return"object"==typeof a&&null!==a}coerce(a,b){let c=this.getErrorPropertyFromObject(a);return c?b.apply(c):{type:this.getType(a),value:this.getValue(a),stack:b.syntheticException?.stack,level:this.isSeverityLevel(a.level)?a.level:"error",synthetic:!0}}getType(a){return A(a)?a.constructor.name:"Error"}getValue(a){if("name"in a&&"string"==typeof a.name){let b=`'${a.name}' captured as exception`;return"message"in a&&"string"==typeof a.message&&(b+=` with message: '${a.message}'`),b}if("message"in a&&"string"==typeof a.message)return a.message;let b=this.getObjectClassName(a),c=aw(a);return`${b&&"Object"!==b?`'${b}'`:"Object"} captured as exception with keys: ${c}`}isSeverityLevel(a){return x(a)&&!(x(a)&&0===a.trim().length)&&av.indexOf(a)>=0}getErrorPropertyFromObject(a){for(let b in a)if(Object.prototype.hasOwnProperty.call(a,b)){let c=a[b];if(L(c))return c}}getObjectClassName(a){try{let b=Object.getPrototypeOf(a);return b?b.constructor.name:void 0}catch(a){return}}}a.s(["ObjectCoercer",0,ax],93874);class ay{match(a){return A(a)}coerce(a,b){let c=a.constructor.name;return{type:c,value:`${c} captured as exception with keys: ${aw(a)}`,stack:b.syntheticException?.stack,synthetic:!0}}}a.s(["EventCoercer",0,ay],46980);class az{match(a){return y(a)}coerce(a,b){return{type:"Error",value:`Primitive value captured as exception: ${String(a)}`,stack:b.syntheticException?.stack,synthetic:!0}}}a.s(["PrimitiveCoercer",0,az],28150);class aA{match(a){return z(a,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(a)}isCustomEventWrappingRejection(a){if(!A(a))return!1;try{let b=a.detail;return null!=b&&"object"==typeof b&&"reason"in b}catch{return!1}}coerce(a,b){let c=this.getUnhandledRejectionReason(a);return y(c)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(c)}`,stack:b.syntheticException?.stack,synthetic:!0}:b.apply(c)}getUnhandledRejectionReason(a){try{if("reason"in a)return a.reason;if("detail"in a&&null!=a.detail&&"object"==typeof a.detail&&"reason"in a.detail)return a.detail.reason}catch{}return a}}a.s(["PromiseRejectionEventCoercer",0,aA],98140),a.s([],7610),a.s([],48153),a.i(48153),a.i(6762),a.i(67970),a.s(["chromeStackLineParser",0,aa,"createDefaultStackParser",0,aq,"createStackParser",0,ar,"geckoStackLineParser",0,ad,"nodeStackLineParser",0,am,"opera10StackLineParser",0,ah,"opera11StackLineParser",0,aj,"reverseAndStripFrames",0,ap,"winjsStackLineParser",0,af],64583),a.i(64583),a.i(7610),a.i(51671),a.i(10692),a.i(75368);let aB=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class aC{match(a){return"string"==typeof a}coerce(a,b){let[c,d]=this.getInfos(a);return{type:c??"Error",value:d??a,stack:b.syntheticException?.stack,synthetic:!0}}getInfos(a){let b="Error",c=a,d=a.match(aB);return d&&(b=d[1],c=d[2]),[b,c]}}a.s(["StringCoercer",0,aC],57802),a.i(57802),a.i(93874),a.i(46980),a.i(28150),a.i(98140),a.s(["DOMExceptionCoercer",0,as,"ErrorCoercer",0,at,"ErrorEventCoercer",0,au,"EventCoercer",0,ay,"ObjectCoercer",0,ax,"PrimitiveCoercer",0,az,"PromiseRejectionEventCoercer",0,aA,"StringCoercer",0,aC],54253),a.i(54253);class aD{constructor(a){this._maxSize=a,this._cache=new Map}get(a){let b=this._cache.get(a);if(void 0!==b)return this._cache.delete(a),this._cache.set(a,b),b}set(a,b){this._cache.set(a,b)}reduce(){for(;this._cache.size>=this._maxSize;){let a=this._cache.keys().next().value;a&&this._cache.delete(a)}}}a.s(["ReduceableCache",0,aD],98966),a.i(98966),a.s(["DOMExceptionCoercer",0,as,"ErrorCoercer",0,at,"ErrorEventCoercer",0,au,"ErrorPropertiesBuilder",0,W,"EventCoercer",0,ay,"ObjectCoercer",0,ax,"PrimitiveCoercer",0,az,"PromiseRejectionEventCoercer",0,aA,"ReduceableCache",0,aD,"StringCoercer",0,aC,"chromeStackLineParser",0,aa,"createDefaultStackParser",0,aq,"createStackParser",0,ar,"geckoStackLineParser",0,ad,"nodeStackLineParser",0,am,"opera10StackLineParser",0,ah,"opera11StackLineParser",0,aj,"reverseAndStripFrames",0,ap,"winjsStackLineParser",0,af],60485);var aE=a.i(60485),aF=aE,aG=a.i(2157),aH=a.i(1457);let aI=new aF.ReduceableCache(25),aJ=new aF.ReduceableCache(20);async function aK(a){let b={};for(let e=a.length-1;e>=0;e--){var c,d;let f=a[e],g=f?.filename;!(!f||"string"!=typeof g||"number"!=typeof f.lineno||(c=g).startsWith("node:")||c.endsWith(".min.js")||c.endsWith(".min.cjs")||c.endsWith(".min.mjs")||c.startsWith("data:")||void 0!==(d=f).lineno&&d.lineno>1e4||void 0!==d.colno&&d.colno>1e3)&&(b[g]||(b[g]=[]),b[g].push(f.lineno))}let e=Object.keys(b);if(0==e.length)return a;let f=[];for(let a of e){if(aJ.get(a))continue;let c=b[a];if(!c)continue;c.sort((a,b)=>a-b);let d=function(a){if(!a.length)return[];let b=0,c=a[0];if("number"!=typeof c)return[];let d=aM(c),e=[];for(;;){if(b===a.length-1){e.push(d);break}let c=a[b+1];if("number"!=typeof c)break;c<=d[1]?d[1]=c+7:(e.push(d),d=aM(c)),b++}return e}(c);if(d.every(b=>(function(a,b){let c=aI.get(a);if(void 0===c)return!1;for(let a=b[0];a<=b[1];a++)if(void 0===c[a])return!1;return!0})(a,b)))continue;let e=function(a,b,c){let d=a.get(b);return void 0===d?(a.set(b,c),c):d}(aI,a,{});f.push(function(a,b,c){return new Promise(d=>{let e=(0,aG.createReadStream)(a),f=(0,aH.createInterface)({input:e});function g(){e.destroy(),d()}let h=0,i=0,j=b[0];if(void 0===j)return void g();let k=j[0],l=j[1];function m(){aJ.set(a,1),f.close(),f.removeAllListeners(),g()}e.on("error",m),f.on("error",m),f.on("close",g),f.on("line",a=>{if(!(++h<k)&&(c[h]=function(a,b){let c=a,d=c.length;if(d<=150)return c;b>d&&(b=d);let e=Math.max(b-60,0);e<5&&(e=0);let f=Math.min(e+140,d);return f>d-5&&(f=d),f===d&&(e=Math.max(f-140,0)),c=c.slice(e,f),e>0&&(c=`...${c}`),f<d&&(c+="..."),c}(a,0),h>=l)){if(i===b.length-1){f.close(),f.removeAllListeners();return}let a=b[++i];if(void 0===a){f.close(),f.removeAllListeners();return}k=a[0],l=a[1]}})})}(a,d,e))}return await Promise.all(f).catch(()=>{}),a&&a.length>0&&function(a,b){for(let c of a)if(c.filename&&void 0===c.context_line&&"number"==typeof c.lineno){let a=b.get(c.filename);if(void 0===a)continue;!function(a,b,c){if(void 0===b.lineno||void 0===c)return;b.pre_context=[];for(let d=aN(a);d<a;d++){let a=c[d];if(void 0===a)return void aL(b);b.pre_context.push(a)}if(void 0===c[a])return aL(b);b.context_line=c[a];let d=function(a){return a+7}(a);b.post_context=[];for(let e=a+1;e<=d;e++){let a=c[e];if(void 0===a)break;b.post_context.push(a)}}(c.lineno,c,a)}}(a,aI),aI.reduce(),a}function aL(a){delete a.pre_context,delete a.context_line,delete a.post_context}function aM(a){return[aN(a),a+7]}function aN(a){return Math.max(1,a-7)}function aO(a,b,c,d,e){if(b>c&&(d.warn("min cannot be greater than max."),b=c),"[object Number]"==v.call(a)&&a==a)if(a>c)return d.warn(" cannot be greater than max: "+c+". Using max value instead."),c;else return a<b?(d.warn(" cannot be less than min: "+b+". Using min value instead."),b):a;return d.warn(" must be a number. using max or fallback. max: "+c+", fallback: "+e),aO(e||c,b,c,d)}class aP{constructor(a){this._buckets={},this._onBucketRateLimited=a._onBucketRateLimited,this._bucketSize=aO(a.bucketSize,0,100,a._logger),this._refillRate=aO(a.refillRate,0,this._bucketSize,a._logger),this._refillInterval=aO(a.refillInterval,0,864e5,a._logger)}_applyRefill(a,b){let c=Math.floor((b-a.lastAccess)/this._refillInterval);if(c>0){let b=c*this._refillRate;a.tokens=Math.min(a.tokens+b,this._bucketSize),a.lastAccess=a.lastAccess+c*this._refillInterval}}consumeRateLimit(a){let b=Date.now(),c=String(a),d=this._buckets[c];return d?this._applyRefill(d,b):(d={tokens:this._bucketSize,lastAccess:b},this._buckets[c]=d),0===d.tokens||(d.tokens--,0===d.tokens&&this._onBucketRateLimited?.(a),0===d.tokens)}stop(){this._buckets={}}}class aQ{constructor(a,b,c){this.client=a,this._exceptionAutocaptureEnabled=b.enableExceptionAutocapture||!1,this._logger=c,this._rateLimiter=new aP({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(a){return a===Object(a)&&!w(a)&&"__posthog_previously_captured_error"in a&&!0===a.__posthog_previously_captured_error}static async buildEventMessage(a,b,c,d){let e={...d},f=this.errorPropertiesBuilder.buildFromUnknown(a,b);return f.$exception_list=await this.errorPropertiesBuilder.modifyFrames(f.$exception_list),{event:"$exception",distinctId:c,properties:{...f,...e},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){if(this.isEnabled()){var b,c,d;let e;b=this.onException.bind(this),c=this.onFatalError.bind(this),globalThis.process?.on("uncaughtException",(e=!1,Object.assign(d=>{let f=a.g.process.listeners("uncaughtException").filter(a=>"domainUncaughtExceptionClear"!==a.name&&!0!==a._posthogErrorHandler).length;b(d,{mechanism:{type:"onuncaughtexception",handled:!1}}),e||0!==f||(e=!0,c(d))},{_posthogErrorHandler:!0}))),d=this.onException.bind(this),globalThis.process?.on("unhandledRejection",a=>d(a,{mechanism:{type:"onunhandledrejection",handled:!1}}))}}onException(a,b){this.client.addPendingPromise((async()=>{if(!aQ.isPreviouslyCapturedError(a)){let c=await aQ.buildEventMessage(a,b),d=c.properties,e=d?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(e)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:e}):this.client.capture(c)}})())}async onFatalError(a){console.error(a),await this.client.shutdown(2e3),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}}let aR=["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"],aS=function(a,b=[]){if(!a)return!1;let c=a.toLowerCase();return aR.concat(b).some(a=>{let b=a.toLowerCase();return -1!==c.indexOf(b)})},aT={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function aU(a){let b=globalThis.crypto?.subtle;if(!b)throw Error("SubtleCrypto API not available");return Array.from(new Uint8Array(await b.digest("SHA-1",new TextEncoder().encode(a)))).map(a=>a.toString(16).padStart(2,"0")).join("")}a.s(["FeatureFlagError",0,aT],46539);let aV=["is_not"];class aW extends Error{constructor(a){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=a,Object.setPrototypeOf(this,aW.prototype)}}class aX extends Error{constructor(a){super(a),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,aX.prototype)}}class aY extends Error{constructor(a){super(a),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,aY.prototype)}}class aZ{constructor({pollingInterval:a,personalApiKey:b,projectApiKey:c,timeout:d,host:e,customHeaders:f,...g}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=a,this.personalApiKey=b,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=d,this.projectApiKey=c,this.host=e,this.poller=void 0,this.fetch=g.fetch||fetch,this.onError=g.onError,this.customHeaders=f,this.onLoad=g.onLoad,this.cacheProvider=g.cacheProvider,this.strictLocalEvaluation=g.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(a=!0){this.debugMode=a}logMsgIfDebug(a){this.debugMode&&a()}createEvaluationContext(a,b={},c={},d={},e={}){return{distinctId:a,groups:b,personProperties:c,groupProperties:d,evaluationCache:e}}async getFeatureFlag(a,b,c={},d={},e={}){let f,g;if(await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return f;if(void 0!==(g=this.featureFlagsByKey[a])){let h=this.createEvaluationContext(b,c,d,e);try{f=(await this.computeFlagAndPayloadLocally(g,h)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${a} -> ${f}`))}catch(b){b instanceof aY||b instanceof aX?this.logMsgIfDebug(()=>console.debug(`${b.name} when computing flag locally: ${a}: ${b.message}`)):b instanceof Error&&this.onError?.(Error(`Error computing flag locally: ${a}: ${b}`))}}return f}async getAllFlagsAndPayloads(a,b){await this.loadFeatureFlags();let c={},d={},e=0==this.featureFlags.length,f=b?b.map(a=>this.featureFlagsByKey[a]).filter(Boolean):this.featureFlags,g={...a,evaluationCache:a.evaluationCache??{}};return await Promise.all(f.map(async a=>{try{let{value:b,payload:e}=await this.computeFlagAndPayloadLocally(a,g);c[a.key]=b,e&&(d[a.key]=e)}catch(b){b instanceof aY||b instanceof aX?this.logMsgIfDebug(()=>console.debug(`${b.name} when computing flag locally: ${a.key}: ${b.message}`)):b instanceof Error&&this.onError?.(Error(`Error computing flag locally: ${a.key}: ${b}`)),e=!0}})),{response:c,payloads:d,fallbackToFlags:e}}async computeFlagAndPayloadLocally(a,b,c={}){let d,{matchValue:e,skipLoadCheck:f=!1}=c;if(f||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};d=void 0!==e?e:await this.computeFlagValueLocally(a,b);let g=this.getFeatureFlagPayload(a.key,d);return{value:d,payload:g}}async computeFlagValueLocally(a,b){let{distinctId:c,groups:d,personProperties:e,groupProperties:f}=b;if(a.ensure_experience_continuity)throw new aX("Flag has experience continuity enabled");if(!a.active)return!1;let g=(a.filters||{}).aggregation_group_type_index;if(void 0!=g){let c=this.groupTypeMapping[String(g)];if(!c)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${g} for feature flag ${a.key}`)),new aX("Flag has unknown group type index");if(!(c in d))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${a.key} without group names passed in`)),!1;"device_id"===a.bucketing_identifier&&(e?.$device_id===void 0||e?.$device_id===null||e?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${a.key}`));let h=f[c];return await this.matchFeatureFlagProperties(a,d[c],h,b)}{let d=this.getBucketingValueForFlag(a,c,e);if(void 0===d)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${a.key} without $device_id, falling back to server evaluation`)),new aX(`Can't compute feature flag: ${a.key} without $device_id`);return await this.matchFeatureFlagProperties(a,d,e,b)}}getBucketingValueForFlag(a,b,c){if(a.filters?.aggregation_group_type_index!=void 0)return b;if("device_id"===a.bucketing_identifier){let a=c?.$device_id;if(null==a||""===a)return;return a}return b}getFeatureFlagPayload(a,b){let c=null;if(!1!==b&&null!=b&&("boolean"==typeof b?c=this.featureFlagsByKey?.[a]?.filters?.payloads?.[b.toString()]||null:"string"==typeof b&&(c=this.featureFlagsByKey?.[a]?.filters?.payloads?.[b]||null),null!=c)){if("object"==typeof c)return c;if("string"==typeof c)try{return JSON.parse(c)}catch{}return c}return null}async evaluateFlagDependency(a,b,c){let{evaluationCache:d}=c,e=a.key;if(!this.featureFlagsByKey)throw new aX("Feature flags not available for dependency evaluation");if(!("dependency_chain"in a))throw new aX(`Flag dependency property for '${e}' is missing required 'dependency_chain' field`);let f=a.dependency_chain;if(!Array.isArray(f))throw new aX(`Flag dependency property for '${e}' has an invalid 'dependency_chain' (expected array, got ${typeof f})`);if(0===f.length)throw new aX(`Circular dependency detected for flag '${e}' (empty dependency chain)`);for(let a of f){if(!(a in d)){let b=this.featureFlagsByKey[a];if(b)if(b.active)try{let e=await this.computeFlagValueLocally(b,c);d[a]=e}catch(b){throw new aX(`Error evaluating flag dependency '${a}' for flag '${e}': ${b}`)}else d[a]=!1;else throw new aX(`Missing flag dependency '${a}' for flag '${e}'`)}if(null==d[a])throw new aX(`Dependency '${a}' could not be evaluated`)}let g=d[e];return this.flagEvaluatesToExpectedValue(a.value,g)}flagEvaluatesToExpectedValue(a,b){return"boolean"==typeof a?a===b||"string"==typeof b&&""!==b&&!0===a:"string"==typeof a&&b===a}async matchFeatureFlagProperties(a,b,c,d){let e,f=a.filters||{},g=f.groups||[],h=!1;for(let i of g)try{if(await this.isConditionMatch(a,b,i,c,d)){let c=i.variant,d=f.multivariate?.variants||[];e=c&&d.some(a=>a.key===c)?c:await this.getMatchingVariant(a,b)||!0;break}}catch(a){if(a instanceof aY)throw a;if(a instanceof aX)h=!0;else throw a}if(void 0!==e)return e;if(h)throw new aX("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(a,b,c,d,e){let f=c.rollout_percentage,g=a=>{this.logMsgIfDebug(()=>console.warn(a))};if((c.properties||[]).length>0){for(let a of c.properties){let b=a.type;if(!("cohort"===b?function a(b,c,d,e=!1){let f=String(b.value);if(!(f in d))throw new aY(`cohort ${f} not found in local cohorts - likely a static cohort that requires server evaluation`);return function b(c,d,e,f=!1){if(!c)return!0;let g=c.type,h=c.values;if(!h||0===h.length)return!0;let i=!1;if("values"in h[0]){for(let a of h)try{let c=b(a,d,e,f);if("AND"===g){if(!c)return!1}else if(c)return!0}catch(b){if(b instanceof aY)throw b;if(b instanceof aX)f&&console.debug(`Failed to compute property ${a} locally: ${b}`),i=!0;else throw b}if(i)throw new aX("Can't match cohort without a given cohort property value");return"AND"===g}for(let b of h)try{let c;if("cohort"===b.type)c=a(b,d,e,f);else if("flag"===b.type){f&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${b.key||"unknown"}'`);continue}else c=a_(b,d);let h=b.negation||!1;if("AND"===g){if(!c&&!h||c&&h)return!1}else if(c&&!h||!c&&h)return!0}catch(a){if(a instanceof aY)throw a;if(a instanceof aX)f&&console.debug(`Failed to compute property ${b} locally: ${a}`),i=!0;else throw a}if(i)throw new aX("can't match cohort without a given cohort property value");return"AND"===g}(d[f],c,d,e)}(a,d,this.cohorts,this.debugMode):"flag"===b?await this.evaluateFlagDependency(a,d,e):a_(a,d,g)))return!1}if(void 0==f)return!0}return!(void 0!=f&&await a$(a.key,b)>f/100)}async getMatchingVariant(a,b){let c=await a$(a.key,b,"variant"),d=this.variantLookupTable(a).find(a=>c>=a.valueMin&&c<a.valueMax);if(d)return d.key}variantLookupTable(a){let b=[],c=0,d=0,e=a.filters||{};return(e.multivariate?.variants||[]).forEach(a=>{d=c+a.rollout_percentage/100,b.push({valueMin:c,valueMax:d,key:a.key}),c=d}),b}updateFlagState(a){this.featureFlags=a.flags,this.featureFlagsByKey=a.flags.reduce((a,b)=>(a[b.key]=b,a),{}),this.groupTypeMapping=a.groupTypeMapping,this.cohorts=a.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(a){if(this.strictLocalEvaluation)return;let b=a.filter(a=>a.ensure_experience_continuity);b.length>0&&console.warn(`[PostHog] You are using local evaluation but ${b.length} flag(s) have experience continuity enabled: ${b.map(a=>a.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(a){if(!this.cacheProvider)return!1;try{let b=await this.cacheProvider.getFlagDefinitions();if(b)return this.updateFlagState(b),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${a} (${b.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(b.flags),!0;return!1}catch(a){return this.onError?.(Error(`Failed to load from cache: ${a}`)),!1}}async loadFeatureFlags(a=!1){if(!this.loadedSuccessfullyOnce||a)return!a&&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(a=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${a}`))).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 a=!0;if(this.cacheProvider)try{a=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(a){this.onError?.(Error(`Error in shouldFetchFlagDefinitions: ${a}`))}if(!a&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let b=await this._requestFeatureFlagDefinitions();if(!b)return;switch(b.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=b.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new aW(`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 aW(`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 aW(`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 c=await b.json()??{};if(!("flags"in c))return void this.onError?.(Error(`Invalid response when getting feature flags: ${JSON.stringify(c)}`));this.flagsEtag=b.headers?.get("ETag")??void 0;let d={flags:c.flags??[],groupTypeMapping:c.group_type_mapping||{},cohorts:c.cohorts||{}};if(this.updateFlagState(d),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&a)try{await this.cacheProvider.onFlagDefinitionsReceived(d)}catch(a){this.onError?.(Error(`Failed to store in cache: ${a}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(d.flags);break}default:return}}catch(a){a instanceof aW&&this.onError?.(a)}}getPersonalApiKeyRequestOptions(a="GET",b){let c={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return b&&(c["If-None-Match"]=b),{method:a,headers:c}}_requestFeatureFlagDefinitions(){let a=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,b=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),c=null;if(this.timeout&&"number"==typeof this.timeout){let a=new AbortController;c=K(()=>{a.abort()},this.timeout),b.signal=a.signal}try{return(0,this.fetch)(a,b)}finally{clearTimeout(c)}}async stopPoller(a=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let b=this.cacheProvider.shutdown();b instanceof Promise&&await Promise.race([b,new Promise((b,c)=>setTimeout(()=>c(Error(`Cache shutdown timeout after ${a}ms`)),a))])}catch(a){this.onError?.(Error(`Error during cache shutdown: ${a}`))}}}async function a$(a,b,c=""){return parseInt((await aU(`${a}.${b}${c}`)).slice(0,15),16)/0x1000000000000000}function a_(a,b,c){let d=a.key,e=a.value,f=a.operator||"exact";if(d in b){if("is_not_set"===f)throw new aX("Operator is_not_set is not supported")}else throw new aX(`Property ${d} not found in propertyValues`);let g=b[d];if(null==g&&!aV.includes(f))return c&&c(`Property ${d} cannot have a value of null/undefined with the ${f} operator`),!1;function h(a,b){return Array.isArray(a)?a.map(a=>String(a).toLowerCase()).includes(String(b).toLowerCase()):String(a).toLowerCase()===String(b).toLowerCase()}function i(a,b,c){if("gt"===c)return a>b;if("gte"===c)return a>=b;if("lt"===c)return a<b;if("lte"===c)return a<=b;throw Error(`Invalid operator: ${c}`)}switch(f){case"exact":return h(e,g);case"is_not":return!h(e,g);case"is_set":return d in b;case"icontains":return String(g).toLowerCase().includes(String(e).toLowerCase());case"not_icontains":return!String(g).toLowerCase().includes(String(e).toLowerCase());case"regex":return a0(String(e))&&null!==String(g).match(String(e));case"not_regex":return a0(String(e))&&null===String(g).match(String(e));case"gt":case"gte":case"lt":case"lte":{let a="number"==typeof e?e:null;if("string"==typeof e)try{a=parseFloat(e)}catch(a){}if(null==a||null==g)return i(String(g),String(e),f);if("string"==typeof g)return i(g,String(e),f);return i(g,a,f)}case"is_date_after":case"is_date_before":{if("boolean"==typeof e)throw new aX("Date operations cannot be performed on boolean values");let a=function(a){let b=a.match(/^-?(?<number>[0-9]+)(?<interval>[a-z])$/),c=new Date(new Date().toISOString());if(!b)return null;{if(!b.groups)return null;let a=parseInt(b.groups.number);if(a>=1e4)return null;let d=b.groups.interval;if("h"==d)c.setUTCHours(c.getUTCHours()-a);else if("d"==d)c.setUTCDate(c.getUTCDate()-a);else if("w"==d)c.setUTCDate(c.getUTCDate()-7*a);else if("m"==d)c.setUTCMonth(c.getUTCMonth()-a);else{if("y"!=d)return null;c.setUTCFullYear(c.getUTCFullYear()-a)}return c}}(String(e));if(null==a&&(a=a3(e)),null==a)throw new aX(`Invalid date: ${e}`);let b=a3(g);if(["is_date_before"].includes(f))return b<a;return b>a}case"semver_eq":return 0===a2(a1(String(g)),a1(String(e)));case"semver_neq":return 0!==a2(a1(String(g)),a1(String(e)));case"semver_gt":return a2(a1(String(g)),a1(String(e)))>0;case"semver_gte":return a2(a1(String(g)),a1(String(e)))>=0;case"semver_lt":return 0>a2(a1(String(g)),a1(String(e)));case"semver_lte":return 0>=a2(a1(String(g)),a1(String(e)));case"semver_tilde":{let a,b=a1(String(g)),{lower:c,upper:d}={lower:[(a=a1(String(e)))[0],a[1],a[2]],upper:[a[0],a[1]+1,0]};return a2(b,c)>=0&&0>a2(b,d)}case"semver_caret":{let a=a1(String(g)),{lower:b,upper:c}=function(a){let[b,c,d]=a1(a);return{lower:[b,c,d],upper:b>0?[b+1,0,0]:c>0?[0,c+1,0]:[0,0,d+1]}}(String(e));return a2(a,b)>=0&&0>a2(a,c)}case"semver_wildcard":{let a=a1(String(g)),{lower:b,upper:c}=function(a){let b,c,d=String(a).trim().replace(/^[vV]/,"").replace(/\.\*$/,"").replace(/\*$/,"");if(!d)throw new aX(`Invalid wildcard semver: ${a}`);let e=d.split("."),f=parseInt(e[0],10);if(isNaN(f))throw new aX(`Invalid wildcard semver: ${a}`);if(1===e.length)b=[f,0,0],c=[f+1,0,0];else{let d=parseInt(e[1],10);if(isNaN(d))throw new aX(`Invalid wildcard semver: ${a}`);b=[f,d,0],c=[f,d+1,0]}return{lower:b,upper:c}}(String(e));return a2(a,b)>=0&&0>a2(a,c)}default:throw new aX(`Unknown operator: ${f}`)}}function a0(a){try{return new RegExp(a),!0}catch(a){return!1}}function a1(a){let b=String(a).trim().replace(/^[vV]/,"").split("-")[0].split("+")[0];if(!b||b.startsWith("."))throw new aX(`Invalid semver: ${a}`);let c=b.split("."),d=b=>{if(void 0===b||""===b)return 0;if(!/^\d+$/.test(b))throw new aX(`Invalid semver: ${a}`);return parseInt(b,10)};return[d(c[0]),d(c[1]),d(c[2])]}function a2(a,b){for(let c=0;c<3;c++){if(a[c]<b[c])return -1;if(a[c]>b[c])return 1}return 0}function a3(a){if(a instanceof Date)return a;if("string"==typeof a||"number"==typeof a){let b=new Date(a);if(!isNaN(b.valueOf()))return b;throw new aX(`${a} is in an invalid date format`)}throw new aX(`The date provided ${a} must be a string, number, or date object`)}class a4{getProperty(a){return this._memoryStorage[a]}setProperty(a,b){this._memoryStorage[a]=null!==b?b:void 0}constructor(){this._memoryStorage={}}}class a5 extends V{constructor(a,b={}){if(super(a,b),this._memoryStorage=new a4,this.options=b,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval="number"==typeof b.featureFlagsPollingInterval?Math.max(b.featureFlagsPollingInterval,100):3e4,"number"==typeof b.waitUntilDebounceMs&&(this.options.waitUntilDebounceMs=Math.max(b.waitUntilDebounceMs,0)),"number"==typeof b.waitUntilMaxWaitMs&&(this.options.waitUntilMaxWaitMs=Math.max(b.waitUntilMaxWaitMs,0)),b.personalApiKey){if(b.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!==b.enableLocalEvaluation&&(this.featureFlagsPoller=new aZ({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:b.personalApiKey,projectApiKey:a,timeout:b.requestTimeout??1e4,host:this.host,fetch:b.fetch,onError:a=>{this._events.emit("error",a)},onLoad:a=>{this._events.emit("localEvaluationFlagsLoaded",a)},customHeaders:this.getCustomHeaders(),cacheProvider:b.flagDefinitionCacheProvider,strictLocalEvaluation:b.strictLocalEvaluation}))}this.errorTracking=new aQ(this,b,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=b.maxCacheSize||5e4}enqueue(a,b,c){super.enqueue(a,b,c),this.scheduleDebouncedFlush()}async flush(){let a=super.flush(),b=this.options.waitUntil;if(b&&!this._waitUntilCycle)try{b(a.catch(()=>{}))}catch{}return a}scheduleDebouncedFlush(){let a=this.options.waitUntil;if(!a||this.disabled||this.optedOut)return;if(!this._waitUntilCycle){let b,c=new Promise(a=>{b=a});try{a(c)}catch{return}this._waitUntilCycle={resolve:b,startedAt:Date.now(),timer:void 0}}let b=Date.now()-this._waitUntilCycle.startedAt,c=this.options.waitUntilMaxWaitMs??500;if(void 0!==this._waitUntilCycle.timer&&clearTimeout(this._waitUntilCycle.timer),b>=c)return void this.resolveWaitUntilFlush();let d=this.options.waitUntilDebounceMs??50;this._waitUntilCycle.timer=K(()=>{this.resolveWaitUntilFlush()},d)}_consumeWaitUntilCycle(){let a=this._waitUntilCycle;return a&&(clearTimeout(a.timer),this._waitUntilCycle=void 0),a?.resolve}async resolveWaitUntilFlush(){let a=this._consumeWaitUntilCycle();try{await super.flush()}catch{}finally{a?.()}}getPersistedProperty(a){return this._memoryStorage.getProperty(a)}setPersistedProperty(a,b){return this._memoryStorage.setProperty(a,b)}fetch(a,b){return this.options.fetch?this.options.fetch(a,b):fetch(a,b)}getLibraryVersion(){return"5.29.2"}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(a=!0){super.debug(a),this.featureFlagsPoller?.debug(a)}capture(a){"string"==typeof a&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),"$exception"!==a.event||a._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(a).then(({distinctId:a,event:b,properties:c,options:d})=>super.captureStateless(a,b,c,{timestamp:d.timestamp,disableGeoip:d.disableGeoip,uuid:d.uuid})).catch(a=>{a&&console.error(a)}))}async captureImmediate(a){return"string"==typeof a&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),"$exception"!==a.event||a._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(a).then(({distinctId:a,event:b,properties:c,options:d})=>super.captureStatelessImmediate(a,b,c,{timestamp:d.timestamp,disableGeoip:d.disableGeoip,uuid:d.uuid})).catch(a=>{a&&console.error(a)}))}identify({distinctId:a,properties:b={},disableGeoip:c}){let{$set:d,$set_once:e,$anon_distinct_id:f,...g}=b;super.identifyStateless(a,{$set:d||g,$set_once:e||{},$anon_distinct_id:f??void 0},{disableGeoip:c})}async identifyImmediate({distinctId:a,properties:b={},disableGeoip:c}){let{$set:d,$set_once:e,$anon_distinct_id:f,...g}=b;super.identifyStatelessImmediate(a,{$set:d||g,$set_once:e||{},$anon_distinct_id:f??void 0},{disableGeoip:c})}alias(a){super.aliasStateless(a.alias,a.distinctId,void 0,{disableGeoip:a.disableGeoip})}async aliasImmediate(a){await super.aliasStatelessImmediate(a.alias,a.distinctId,void 0,{disableGeoip:a.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(a=3e4){return!!this.isLocalEvaluationReady()||void 0!==this.featureFlagsPoller&&new Promise(b=>{let c=setTimeout(()=>{d(),b(!1)},a),d=this._events.on("localEvaluationFlagsLoaded",a=>{clearTimeout(c),d(),b(a>0)})})}_resolveDistinctId(a,b){return"string"==typeof a?{distinctId:a,options:b}:{distinctId:this.context?.get()?.distinctId,options:a}}async _getFeatureFlagResult(a,b,c={},d){let e,f,g,h,i,j,k,l=c.sendFeatureFlagEvents??!0;if(void 0!==this._flagOverrides&&a in this._flagOverrides){let b=this._flagOverrides[a];if(void 0===b)return;let c=this._payloadOverrides?.[a];return{key:a,enabled:!1!==b,variant:"string"==typeof b?b:void 0,payload:c}}let{groups:m,disableGeoip:n}=c,{onlyEvaluateLocally:o,personProperties:p,groupProperties:q}=c,r=this.addLocalPersonAndGroupProperties(b,m,p,q);p=r.allPersonProperties,q=r.allGroupProperties;let s=this.createFeatureFlagEvaluationContext(b,m,p,q);void 0==o&&(o=this.options.strictLocalEvaluation??!1);let t=!1;if(void 0!==this.featureFlagsPoller){await this.featureFlagsPoller?.loadFeatureFlags();let b=this.featureFlagsPoller?.featureFlagsByKey[a];if(b)try{let c=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(b,s,{matchValue:d});if(c){t=!0;let d=c.value;i=b.id,k="Evaluated locally",e={key:a,enabled:!1!==d,variant:"string"==typeof d?d:void 0,payload:c.payload??void 0}}}catch(b){if(b instanceof aY||b instanceof aX)this._logger?.info(`${b.name} when computing flag locally: ${a}: ${b.message}`);else throw b}}if(!t&&!o){let b=await super.getFeatureFlagDetailsStateless(s.distinctId,s.groups,s.personProperties,s.groupProperties,n,[a]);if(void 0===b)h=aT.UNKNOWN_ERROR;else{f=b.requestId,g=b.evaluatedAt;let c=[];b.errorsWhileComputingFlags&&c.push(aT.ERRORS_WHILE_COMPUTING),b.quotaLimited?.includes("feature_flags")&&c.push(aT.QUOTA_LIMITED);let d=b.flags[a];if(void 0===d)c.push(aT.FLAG_MISSING);else{let b;if(i=d.metadata?.id,j=d.metadata?.version,k=d.reason?.description??d.reason?.code,d.metadata?.payload!==void 0)try{b=JSON.parse(d.metadata.payload)}catch{b=d.metadata.payload}e={key:a,enabled:d.enabled,variant:d.variant,payload:b}}c.length>0&&(h=c.join(","))}}if(l){let c=void 0===e?void 0:!1!==e.enabled&&(e.variant??!0),d=`${a}_${c}`;if(!(b in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[b].includes(d)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[b])?this.distinctIdHasSentFlagCalls[b].push(d):this.distinctIdHasSentFlagCalls[b]=[d];let e={$feature_flag:a,$feature_flag_response:c,$feature_flag_id:i,$feature_flag_version:j,$feature_flag_reason:k,locally_evaluated:t,[`$feature/${a}`]:c,$feature_flag_request_id:f,$feature_flag_evaluated_at:t?Date.now():g};if(t&&this.featureFlagsPoller){let a=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();void 0!==a&&(e.$feature_flag_definitions_loaded_at=a)}h&&(e.$feature_flag_error=h),this.capture({distinctId:b,event:"$feature_flag_called",properties:e,groups:m,disableGeoip:n})}}return void 0!==e&&void 0!==this._payloadOverrides&&a in this._payloadOverrides&&(e={...e,payload:this._payloadOverrides[a]}),e}async getFeatureFlag(a,b,c){let d=await this._getFeatureFlagResult(a,b,{...c,sendFeatureFlagEvents:c?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(void 0!==d)return!1!==d.enabled&&(d.variant??!0)}async getFeatureFlagPayload(a,b,c,d){if(void 0!==this._payloadOverrides&&a in this._payloadOverrides)return this._payloadOverrides[a];let e=await this._getFeatureFlagResult(a,b,{...d,sendFeatureFlagEvents:!1},c);if(void 0!==e)return e.payload??null}async getFeatureFlagResult(a,b,c){let{distinctId:d,options:e}=this._resolveDistinctId(b,c);return d?this._getFeatureFlagResult(a,d,{...e,sendFeatureFlagEvents:e?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required — pass it explicitly or use withContext()")}async getRemoteConfigPayload(a){if(!this.options.personalApiKey)throw Error("Personal API key is required for remote config payload decryption");let b=await this._requestRemoteConfigPayload(a);if(!b)return;let c=await b.json();if("string"==typeof c)try{return JSON.parse(c)}catch(a){}return c}async isFeatureEnabled(a,b,c){let d=await this.getFeatureFlag(a,b,c);if(void 0!==d)return!!d}async getAllFlags(a,b){let{distinctId:c,options:d}=this._resolveDistinctId(a,b);return c?(await this.getAllFlagsAndPayloads(c,d)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags — pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(a,b){let{distinctId:c,options:d}=this._resolveDistinctId(a,b);if(!c)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads — pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:e,disableGeoip:f,flagKeys:g}=d||{},{onlyEvaluateLocally:h,personProperties:i,groupProperties:j}=d||{},k=this.addLocalPersonAndGroupProperties(c,e,i,j);i=k.allPersonProperties,j=k.allGroupProperties;let l=this.createFeatureFlagEvaluationContext(c,e,i,j);void 0==h&&(h=this.options.strictLocalEvaluation??!1);let m=await this.featureFlagsPoller?.getAllFlagsAndPayloads(l,g),n={},o={},p=!0;if(m&&(n=m.response,o=m.payloads,p=m.fallbackToFlags),p&&!h){let a=await super.getFeatureFlagsAndPayloadsStateless(l.distinctId,l.groups,l.personProperties,l.groupProperties,f,g);n={...n,...a.flags||{}},o={...o,...a.payloads||{}}}return void 0!==this._flagOverrides&&(n={...n,...this._flagOverrides}),void 0!==this._payloadOverrides&&(o={...o,...this._payloadOverrides}),{featureFlags:n,featureFlagPayloads:o}}groupIdentify({groupType:a,groupKey:b,properties:c,distinctId:d,disableGeoip:e}){super.groupIdentifyStateless(a,b,c,{disableGeoip:e},d)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(a){let b=a=>Object.fromEntries(a.map(a=>[a,!0]));if(!1===a){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(a)){this._flagOverrides=b(a);return}if(this._isFeatureFlagOverrideOptions(a)){"flags"in a&&(!1===a.flags?this._flagOverrides=void 0:Array.isArray(a.flags)?this._flagOverrides=b(a.flags):void 0!==a.flags&&(this._flagOverrides={...a.flags})),"payloads"in a&&(!1===a.payloads?this._payloadOverrides=void 0:void 0!==a.payloads&&(this._payloadOverrides={...a.payloads}));return}this._flagOverrides={...a}}_isFeatureFlagOverrideOptions(a){if("object"!=typeof a||null===a||Array.isArray(a))return!1;if("flags"in a){let b=a.flags;if(!1===b||Array.isArray(b)||"object"==typeof b&&null!==b)return!0}if("payloads"in a){let b=a.payloads;if(!1===b||"object"==typeof b&&null!==b)return!0}return!1}withContext(a,b,c){return this.context?this.context.run(a,b,c):b()}getContext(){return this.context?.get()}enterContext(a,b){this.context?.enter(a,b)}async _shutdown(a){let b=this._consumeWaitUntilCycle();await this.featureFlagsPoller?.stopPoller(a),this.errorTracking.shutdown();try{return await super._shutdown(a)}finally{b?.()}}async _requestRemoteConfigPayload(a){if(!this.options.personalApiKey)return;let b=`${this.host}/api/projects/@current/feature_flags/${a}/remote_config?token=${encodeURIComponent(this.apiKey)}`,c={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},d=null;if(this.options.requestTimeout&&"number"==typeof this.options.requestTimeout){let a=new AbortController;d=K(()=>{a.abort()},this.options.requestTimeout),c.signal=a.signal}try{return await this.fetch(b,c)}catch(a){this._events.emit("error",a);return}finally{d&&clearTimeout(d)}}extractPropertiesFromEvent(a,b){if(!a)return{personProperties:{},groupProperties:{}};let c={},d={};for(let[e,f]of Object.entries(a))if(z(f,"Object")&&b&&e in b){let a={};for(let[b,c]of Object.entries(f))a[String(b)]=String(c);d[String(e)]=a}else c[String(e)]=String(f);return{personProperties:c,groupProperties:d}}async getFeatureFlagsForEvent(a,b,c,d){let e=d?.personProperties||{},f=d?.groupProperties||{},g=d?.flagKeys;if(d?.onlyEvaluateLocally??this.options.strictLocalEvaluation)if(!((this.featureFlagsPoller?.featureFlags?.length||0)>0))return{};else{let d={};for(let[a,c]of Object.entries(b||{}))d[a]=String(c);return await this.getAllFlags(a,{groups:d,personProperties:e,groupProperties:f,disableGeoip:c,onlyEvaluateLocally:!0,flagKeys:g})}if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let d={};for(let[a,c]of Object.entries(b||{}))d[a]=String(c);return await this.getAllFlags(a,{groups:d,personProperties:e,groupProperties:f,disableGeoip:c,onlyEvaluateLocally:!0,flagKeys:g})}return(await super.getFeatureFlagsStateless(a,b,e,f,c)).flags}addLocalPersonAndGroupProperties(a,b,c,d){let e={distinct_id:a,...c||{}},f={};if(b)for(let a of Object.keys(b))f[a]={$group_key:b[a],...d?.[a]||{}};return{allPersonProperties:e,allGroupProperties:f}}createFeatureFlagEvaluationContext(a,b,c,d){return{distinctId:a,groups:b||{},personProperties:c||{},groupProperties:d||{},evaluationCache:{}}}captureException(a,b,c,d){if(!aQ.isPreviouslyCapturedError(a)){let e=Error("PostHog syntheticException");this.addPendingPromise(aQ.buildEventMessage(a,{syntheticException:e},b,c).then(a=>this.capture({...a,uuid:d})))}}async captureExceptionImmediate(a,b,c){if(!aQ.isPreviouslyCapturedError(a)){let d=Error("PostHog syntheticException");return this.addPendingPromise(aQ.buildEventMessage(a,{syntheticException:d},b,c).then(a=>this.captureImmediate(a)))}}async prepareEventMessage(a){let{distinctId:b,event:c,properties:d,groups:e,sendFeatureFlags:f,timestamp:g,disableGeoip:h,uuid:i}=a,j=this.context?.get(),k=b||j?.distinctId,l={...this.props,...j?.properties||{},...d||{}};k||(k=q().toString(),l.$process_person_profile=!1),j?.sessionId&&!l.$session_id&&(l.$session_id=j.sessionId);let m=this._runBeforeSend({distinctId:k,event:c,properties:l,groups:e,sendFeatureFlags:f,timestamp:g,disableGeoip:h,uuid:i});if(!m)return Promise.reject(null);let n=await Promise.resolve().then(async()=>f?await this.getFeatureFlagsForEvent(m.distinctId,e,h,"object"==typeof f?f:void 0):(m.event,{})).then(a=>{let b={};if(a)for(let[c,d]of Object.entries(a))b[`$feature/${c}`]=d;let c=Object.keys(a||{}).filter(b=>a?.[b]!==!1).sort();return c.length>0&&(b.$active_feature_flags=c),b}).catch(()=>({})).then(a=>({...a,...m.properties||{},$groups:m.groups||e}));return"$pageview"===m.event&&this.options.__preview_capture_bot_pageviews&&"string"==typeof n.$raw_user_agent&&aS(n.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(m.event="$bot_pageview",n.$browser_type="bot"),{distinctId:m.distinctId,event:m.event,properties:n,options:{timestamp:m.timestamp,disableGeoip:m.disableGeoip,uuid:m.uuid}}}_runBeforeSend(a){let b=this.options.before_send;if(!b)return a;let c=Array.isArray(b)?b:[b],d=a;for(let b of c){if(!(d=b(d)))return this._logger.info(`Event '${a.event}' was rejected in beforeSend function`),null;if(!d.properties||0===Object.keys(d.properties).length){let a=`Event '${d.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(a)}}return d}}var aF=aE,a6=a.i(78500);class a7{constructor(){this.storage=new a6.AsyncLocalStorage}get(){return this.storage.getStore()}run(a,b,c){return this.storage.run(this.resolve(a,c),b)}enter(a,b){this.storage.enterWith(this.resolve(a,b))}resolve(a,b){if(b?.fresh===!0)return a;let c=this.get()||{};return{distinctId:a.distinctId??c.distinctId,sessionId:a.sessionId??c.sessionId,properties:{...c.properties||{},...a.properties||{}}}}}function a8(a,b){var c;b.use((c=a,(a,b,d,e)=>{if(aQ.isPreviouslyCapturedError(a))return void e(a);let f=b.headers["x-posthog-session-id"],g=b.headers["x-posthog-distinct-id"],h=Error("Synthetic exception");c.addPendingPromise(aQ.buildEventMessage(a,{mechanism:{type:"middleware",handled:!1},syntheticException:h},g,{$session_id:f,$current_url:b.url,$request_method:b.method,$request_path:b.path,$user_agent:b.headers["user-agent"],$response_status_code:d.statusCode,$ip:b.headers["x-forwarded-for"]||b?.socket?.remoteAddress}).then(a=>{c.capture(a)})),e(a)}))}a.s(["setupExpressErrorHandler",0,a8],40602),a.s([],93051),aQ.errorPropertiesBuilder=new aF.ErrorPropertiesBuilder([new aF.EventCoercer,new aF.ErrorCoercer,new aF.ObjectCoercer,new aF.StringCoercer,new aF.PrimitiveCoercer],aF.createStackParser("node:javascript",aF.nodeStackLineParser),[(f=function(a=process.argv[1]?(0,h.dirname)(process.argv[1]):process.cwd(),b="\\"===h.sep){let c=b?i(a):a;return a=>{if(!a)return;let d=b?i(a):a,{dir:e,base:f,ext:g}=h.posix.parse(d);(".js"===g||".mjs"===g||".cjs"===g)&&(f=f.slice(0,-1*g.length));let j=decodeURIComponent(f);e||(e=".");let k=e.lastIndexOf("/node_modules");if(k>-1)return`${e.slice(k+14).replace(/\//g,".")}:${j}`;if(e.startsWith(c)){let a=e.slice(c.length+1).replace(/\//g,".");return a?`${a}:${j}`:j}return j}}(),async a=>{for(let b of a)b.module=f(b.filename);return a}),aK]);class a9 extends a5{getLibraryId(){return"posthog-node"}initializeContext(){return new a7}}a.s(["PostHog",0,a9],81035),a.i(81035),a.i(93051);let ba="posthog-node";function bb(a,{organization:b,projectId:c,prefix:d,severityAllowList:e=["error"],sendExceptionsToPostHog:f=!0}={}){return g=>{if(!("*"===e||e.includes(g.level)))return g;g.tags||(g.tags={});let h=g.tags[bd.POSTHOG_ID_TAG];if(void 0===h)return g;let i=a.options.host??"https://us.i.posthog.com",j=new URL(`/project/${a.apiKey}/person/${h}`,i).toString();g.tags["PostHog Person URL"]=j;let k=g.exception?.values||[],l=k.map(a=>({...a,stacktrace:a.stacktrace?{...a.stacktrace,type:"raw",frames:(a.stacktrace.frames||[]).map(a=>({...a,platform:"node:javascript"}))}:void 0})),m={$exception_message:k[0]?.value||g.message,$exception_type:k[0]?.type,$exception_level:g.level,$exception_list:l,$sentry_event_id:g.event_id,$sentry_exception:g.exception,$sentry_exception_message:k[0]?.value||g.message,$sentry_exception_type:k[0]?.type,$sentry_tags:g.tags};return b&&c&&(m.$sentry_url=(d||"https://sentry.io/organizations/")+b+"/issues/?project="+c+"&query="+g.event_id),f&&a.capture({event:"$exception",distinctId:h,properties:m}),g}}function bc(a,b){let c=bb(a,b);return{name:ba,processEvent:a=>c(a)}}class bd{static #a=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(a,b,c,d,e){this.name=ba,this.name=ba,this.setupOnce=function(f,g){f(bb(a,{organization:b,projectId:g()?.getClient()?.getDsn()?.projectId,prefix:c,severityAllowList:d,sendExceptionsToPostHog:e??!0}))}}}a.s(["PostHogSentryIntegration",0,bd,"createEventProcessor",0,bb,"sentryIntegration",0,bc],9318),a.i(9318),a.i(40602),a.i(46539),a.s(["FeatureFlagError",0,s,"PostHogSentryIntegration",0,bd,"createEventProcessor",0,bb,"sentryIntegration",0,bc,"setupExpressErrorHandler",0,a8],80456),a.i(80456),a.s(["FeatureFlagError",0,s,"PostHog",0,a9,"PostHogSentryIntegration",0,bd,"createEventProcessor",0,bb,"sentryIntegration",0,bc,"setupExpressErrorHandler",0,a8],74493)}];
2
2
 
3
3
  //# sourceMappingURL=node_modules_posthog-node_dist_entrypoints_index_node_mjs_0mebn66._.js.map
@@ -7,9 +7,9 @@ globalThis.__BUILD_MANIFEST = {
7
7
  "static/chunks/03~yq9q893hmn.js"
8
8
  ],
9
9
  "lowPriorityFiles": [
10
- "static/A9pNTZdoYJTVyPAYwQMx5/_buildManifest.js",
11
- "static/A9pNTZdoYJTVyPAYwQMx5/_ssgManifest.js",
12
- "static/A9pNTZdoYJTVyPAYwQMx5/_clientMiddlewareManifest.js"
10
+ "static/wOkJXoch1UmRAmyIuKZWc/_buildManifest.js",
11
+ "static/wOkJXoch1UmRAmyIuKZWc/_ssgManifest.js",
12
+ "static/wOkJXoch1UmRAmyIuKZWc/_clientMiddlewareManifest.js"
13
13
  ],
14
14
  "rootMainFiles": [
15
15
  "static/chunks/0tyw4u3~2isbh.js",
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="image" href="/exospheresmall.png"/><link rel="stylesheet" href="/_next/static/chunks/0gu_a.a80ritd.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/0tyw4u3~2isbh.js"/><script src="/_next/static/chunks/150i0n26fnvso.js" async=""></script><script src="/_next/static/chunks/07uz2g0_38qia.js" async=""></script><script src="/_next/static/chunks/12simlrcfk3g2.js" async=""></script><script src="/_next/static/chunks/01q52wg_amm60.js" async=""></script><script src="/_next/static/chunks/turbopack-0o7k.hakttp4k.js" async=""></script><script src="/_next/static/chunks/1052sguyd-.ka.js" async=""></script><script src="/_next/static/chunks/05j1px0r8yzh6.js" async=""></script><script src="/_next/static/chunks/0d3shmwh5_nmn.js" async=""></script><script src="/_next/static/chunks/0ksdlt_1hucdm.js" async=""></script><script src="/_next/static/chunks/15fklyav5py5m.js" async=""></script><script src="/_next/static/chunks/00j0rr7rh8ef8.js" async=""></script><title>404: This page could not be found.</title><meta name="robots" content="noindex"/><title>Failproof AI - Hooks &amp; Project Monitor</title><meta name="description" content="Open-source hooks, policies, and project visualization for Claude Code &amp; Agents SDK"/><link rel="icon" href="/icon.png"/><script>
1
+ <!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="image" href="/exospheresmall.png"/><link rel="stylesheet" href="/_next/static/chunks/0mir9jdxn35~s.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/0tyw4u3~2isbh.js"/><script src="/_next/static/chunks/150i0n26fnvso.js" async=""></script><script src="/_next/static/chunks/07uz2g0_38qia.js" async=""></script><script src="/_next/static/chunks/12simlrcfk3g2.js" async=""></script><script src="/_next/static/chunks/01q52wg_amm60.js" async=""></script><script src="/_next/static/chunks/turbopack-0o7k.hakttp4k.js" async=""></script><script src="/_next/static/chunks/140xx_tfr~lm_.js" async=""></script><script src="/_next/static/chunks/02dqjyv6_9mhq.js" async=""></script><script src="/_next/static/chunks/0d3shmwh5_nmn.js" async=""></script><script src="/_next/static/chunks/0ksdlt_1hucdm.js" async=""></script><script src="/_next/static/chunks/15fklyav5py5m.js" async=""></script><script src="/_next/static/chunks/0o547jv-k_k35.js" async=""></script><title>404: This page could not be found.</title><meta name="robots" content="noindex"/><title>Failproof AI - Hooks &amp; Project Monitor</title><meta name="description" content="Open-source hooks, policies, and project visualization for Claude Code &amp; Agents SDK"/><link rel="icon" href="/icon.png"/><script>
2
2
  (function() {
3
3
  try {
4
4
  // Ensure we don't add duplicate classes
@@ -27,4 +27,4 @@
27
27
  transition: opacity 0.15s;
28
28
  }
29
29
  body > *:not(#__loading) { opacity: 0; }
30
- </style><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body class="antialiased"><div hidden=""><!--$--><!--/$--></div><div id="__loading">Loading…</div><header class="relative z-50 border-b border-border bg-card/50 backdrop-blur supports-[backdrop-filter]:bg-card/50"><div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"><div class="flex items-center justify-between h-16"><div class="flex items-center gap-3"><a href="https://github.com/exospherehost/failproofai" target="_blank" rel="noopener noreferrer" class="flex items-center gap-3 hover:opacity-80 transition-opacity"><img alt="Exosphere Logo" width="28" height="28" decoding="async" data-nimg="1" class="flex-shrink-0" style="color:transparent" src="/exospheresmall.png"/><h1 class="text-lg font-semibold text-foreground leading-tight tracking-tight">Failproof AI</h1></a><span class="text-[0.6rem] font-mono leading-none text-muted-foreground/70 border border-border/60 rounded-md px-1.5 py-0.5 select-none tracking-wide">v<!-- -->0.0.6-beta.2</span><div class="w-px h-8 bg-border ml-2"></div><nav class="flex items-center h-16"><a class="relative flex items-center gap-1.5 px-3 h-full text-sm transition-colors text-muted-foreground hover:text-foreground" href="/policies"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-shield w-4 h-4" aria-hidden="true"><path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"></path></svg>Policies<span class="absolute inset-x-1 bottom-0 h-[2px] rounded-full transition-all bg-transparent group-hover:bg-muted"></span></a><a class="relative flex items-center gap-1.5 px-3 h-full text-sm transition-colors text-muted-foreground hover:text-foreground" href="/projects"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-folder-open w-4 h-4" aria-hidden="true"><path d="m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"></path></svg>Projects<span class="absolute inset-x-1 bottom-0 h-[2px] rounded-full transition-all bg-transparent group-hover:bg-muted"></span></a></nav></div><div class="flex items-center gap-1"><div class="inline-flex items-center rounded-lg border border-border bg-muted/50 p-0.5 gap-0.5"><button title="Refresh" class="inline-flex items-center justify-center rounded-md p-1.5 transition-colors text-muted-foreground hover:text-foreground hover:bg-muted"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-refresh-cw w-3.5 h-3.5" aria-hidden="true"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"></path><path d="M8 16H3v5"></path></svg></button><div class="w-px h-4 bg-border"></div><div class="inline-flex items-center gap-0.5" role="group" aria-label="Auto-refresh interval"><button aria-pressed="true" class="px-2 py-1 text-[11px] font-medium rounded-md transition-colors bg-background text-foreground shadow-sm">Off</button><button aria-pressed="false" class="px-2 py-1 text-[11px] font-medium rounded-md transition-colors text-muted-foreground hover:text-foreground hover:bg-muted">5s</button><button aria-pressed="false" class="px-2 py-1 text-[11px] font-medium rounded-md transition-colors text-muted-foreground hover:text-foreground hover:bg-muted">10s</button><button aria-pressed="false" class="px-2 py-1 text-[11px] font-medium rounded-md transition-colors text-muted-foreground hover:text-foreground hover:bg-muted">30s</button></div></div><div class="w-px h-6 bg-border mx-1"></div><div class="relative"><button class="justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none hover:bg-muted h-9 px-3 relative z-50 flex items-center gap-1.5 text-muted-foreground hover:text-foreground" type="button" aria-expanded="false" aria-haspopup="true"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-git-branch h-4 w-4" aria-hidden="true"><path d="M15 6a9 9 0 0 0-9 9V3"></path><circle cx="18" cy="6" r="3"></circle><circle cx="6" cy="18" r="3"></circle></svg><span class="hidden sm:inline text-xs">Reach Us</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down h-3 w-3 transition-transform" aria-hidden="true"><path d="m6 9 6 6 6-6"></path></svg></button></div><button class="inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none hover:bg-muted hover:text-muted-foreground h-10 w-10 relative" aria-label="Switch to light mode"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sun h-[1.2rem] w-[1.2rem] transition-all rotate-90 scale-0" aria-hidden="true"><circle cx="12" cy="12" r="4"></circle><path d="M12 2v2"></path><path d="M12 20v2"></path><path d="m4.93 4.93 1.41 1.41"></path><path d="m17.66 17.66 1.41 1.41"></path><path d="M2 12h2"></path><path d="M20 12h2"></path><path d="m6.34 17.66-1.41 1.41"></path><path d="m19.07 4.93-1.41 1.41"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-moon absolute h-[1.2rem] w-[1.2rem] transition-all rotate-0 scale-100" aria-hidden="true"><path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"></path></svg></button></div></div></div></header><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><div class="fixed bottom-4 right-4 z-50 flex flex-col gap-2"></div><script src="/_next/static/chunks/0tyw4u3~2isbh.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[12344,[\"/_next/static/chunks/1052sguyd-.ka.js\",\"/_next/static/chunks/05j1px0r8yzh6.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"PostHogProvider\"]\n3:I[97917,[\"/_next/static/chunks/1052sguyd-.ka.js\",\"/_next/static/chunks/05j1px0r8yzh6.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"GlobalErrorListeners\"]\n4:I[47613,[\"/_next/static/chunks/1052sguyd-.ka.js\",\"/_next/static/chunks/05j1px0r8yzh6.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"ThemeProvider\"]\n5:I[85881,[\"/_next/static/chunks/1052sguyd-.ka.js\",\"/_next/static/chunks/05j1px0r8yzh6.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"AutoRefreshProvider\"]\n6:I[63780,[\"/_next/static/chunks/1052sguyd-.ka.js\",\"/_next/static/chunks/05j1px0r8yzh6.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"Navbar\"]\n7:I[39756,[\"/_next/static/chunks/1052sguyd-.ka.js\",\"/_next/static/chunks/05j1px0r8yzh6.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"default\"]\n8:I[8821,[\"/_next/static/chunks/1052sguyd-.ka.js\",\"/_next/static/chunks/05j1px0r8yzh6.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\",\"/_next/static/chunks/15fklyav5py5m.js\"],\"default\"]\n9:I[37457,[\"/_next/static/chunks/1052sguyd-.ka.js\",\"/_next/static/chunks/05j1px0r8yzh6.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"default\"]\na:I[55574,[\"/_next/static/chunks/1052sguyd-.ka.js\",\"/_next/static/chunks/05j1px0r8yzh6.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"Toaster\"]\nf:I[53348,[\"/_next/static/chunks/1052sguyd-.ka.js\",\"/_next/static/chunks/05j1px0r8yzh6.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\",\"/_next/static/chunks/00j0rr7rh8ef8.js\"],\"default\"]\n:HL[\"/_next/static/chunks/0gu_a.a80ritd.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",16],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/0gu_a.a80ritd.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/1052sguyd-.ka.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/05j1px0r8yzh6.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-2\",{\"src\":\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-3\",{\"src\":\"/_next/static/chunks/0ksdlt_1hucdm.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n (function() {\\n try {\\n // Ensure we don't add duplicate classes\\n document.documentElement.classList.remove('light', 'dark');\\n \\n var theme = localStorage.getItem('theme');\\n if (theme \u0026\u0026 (theme === 'light' || theme === 'dark')) {\\n document.documentElement.classList.add(theme);\\n } else {\\n document.documentElement.classList.add('dark');\\n }\\n } catch (e) {\\n // Fallback to dark theme if there's any error\\n document.documentElement.classList.remove('light', 'dark');\\n document.documentElement.classList.add('dark');\\n }\\n })();\\n \"}}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n #__loading {\\n position: fixed; inset: 0; z-index: 9999;\\n display: flex; align-items: center; justify-content: center;\\n background: var(--background, #031035);\\n color: var(--foreground, #f8fafc);\\n font-family: system-ui, sans-serif;\\n font-size: 1rem;\\n transition: opacity 0.15s;\\n }\\n body \u003e *:not(#__loading) { opacity: 0; }\\n \"}}]]}],[\"$\",\"body\",null,{\"className\":\"antialiased\",\"children\":[[\"$\",\"div\",null,{\"id\":\"__loading\",\"children\":\"Loading…\"}],[\"$\",\"$L2\",null,{\"children\":[[\"$\",\"$L3\",null,{}],[\"$\",\"$L4\",null,{\"children\":[[\"$\",\"$L5\",null,{\"children\":[[\"$\",\"$L6\",null,{\"disabledPages\":[]}],[\"$\",\"$L7\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$8\",\"errorStyles\":[],\"errorScripts\":[[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/15fklyav5py5m.js\",\"async\":true}]],\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],[\"$\",\"$La\",null,{}]]}]]}]]}]]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L7\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[\"$Lb\",null,\"$Lc\"]}],{},null,false,null]},null,false,\"$@d\"]},null,false,null],\"$Le\",false]],\"m\":\"$undefined\",\"G\":[\"$f\",[\"$L10\"]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"A9pNTZdoYJTVyPAYwQMx5\"}\n"])</script><script>self.__next_f.push([1,"11:I[97367,[\"/_next/static/chunks/1052sguyd-.ka.js\",\"/_next/static/chunks/05j1px0r8yzh6.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"OutletBoundary\"]\n12:\"$Sreact.suspense\"\n15:I[97367,[\"/_next/static/chunks/1052sguyd-.ka.js\",\"/_next/static/chunks/05j1px0r8yzh6.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"ViewportBoundary\"]\n17:I[97367,[\"/_next/static/chunks/1052sguyd-.ka.js\",\"/_next/static/chunks/05j1px0r8yzh6.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"MetadataBoundary\"]\nb:[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:1:props:children:1:props:children:0:props:children:1:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:1:props:children:1:props:children:0:props:children:1:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:1:props:children:1:props:children:0:props:children:1:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:1:props:children:1:props:children:0:props:children:1:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]]\nc:[\"$\",\"$L11\",null,{\"children\":[\"$\",\"$12\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@13\"}]}]\n14:[]\nd:\"$W14\"\ne:[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$L15\",null,{\"children\":\"$L16\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L17\",null,{\"children\":[\"$\",\"$12\",null,{\"name\":\"Next.Metadata\",\"children\":\"$L18\"}]}]}],null]}]\n10:[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/0gu_a.a80ritd.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]\n"])</script><script>self.__next_f.push([1,"16:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"19:I[27201,[\"/_next/static/chunks/1052sguyd-.ka.js\",\"/_next/static/chunks/05j1px0r8yzh6.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"IconMark\"]\n13:null\n18:[[\"$\",\"title\",\"0\",{\"children\":\"Failproof AI - Hooks \u0026 Project Monitor\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Open-source hooks, policies, and project visualization for Claude Code \u0026 Agents SDK\"}],[\"$\",\"link\",\"2\",{\"rel\":\"icon\",\"href\":\"/icon.png\"}],[\"$\",\"$L19\",\"3\",{}]]\n"])</script></body></html>
30
+ </style><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body class="antialiased"><div hidden=""><!--$--><!--/$--></div><div id="__loading">Loading…</div><header class="relative z-50 border-b border-border bg-card/50 backdrop-blur supports-[backdrop-filter]:bg-card/50"><div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"><div class="flex items-center justify-between h-16"><div class="flex items-center gap-3"><a href="https://github.com/exospherehost/failproofai" target="_blank" rel="noopener noreferrer" class="flex items-center gap-3 hover:opacity-80 transition-opacity"><img alt="Exosphere Logo" width="28" height="28" decoding="async" data-nimg="1" class="flex-shrink-0" style="color:transparent" src="/exospheresmall.png"/><h1 class="text-lg font-semibold text-foreground leading-tight tracking-tight">Failproof AI</h1></a><span class="text-[0.6rem] font-mono leading-none text-muted-foreground/70 border border-border/60 rounded-md px-1.5 py-0.5 select-none tracking-wide">v<!-- -->0.0.6-beta.4</span><div class="w-px h-8 bg-border ml-2"></div><nav class="flex items-center h-16"><a class="relative flex items-center gap-1.5 px-3 h-full text-sm transition-colors text-muted-foreground hover:text-foreground" href="/policies"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-shield w-4 h-4" aria-hidden="true"><path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"></path></svg>Policies<span class="absolute inset-x-1 bottom-0 h-[2px] rounded-full transition-all bg-transparent group-hover:bg-muted"></span></a><a class="relative flex items-center gap-1.5 px-3 h-full text-sm transition-colors text-muted-foreground hover:text-foreground" href="/projects"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-folder-open w-4 h-4" aria-hidden="true"><path d="m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"></path></svg>Projects<span class="absolute inset-x-1 bottom-0 h-[2px] rounded-full transition-all bg-transparent group-hover:bg-muted"></span></a></nav></div><div class="flex items-center gap-1"><div class="inline-flex items-center rounded-lg border border-border bg-muted/50 p-0.5 gap-0.5"><button title="Refresh" class="inline-flex items-center justify-center rounded-md p-1.5 transition-colors text-muted-foreground hover:text-foreground hover:bg-muted"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-refresh-cw w-3.5 h-3.5" aria-hidden="true"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"></path><path d="M8 16H3v5"></path></svg></button><div class="w-px h-4 bg-border"></div><div class="inline-flex items-center gap-0.5" role="group" aria-label="Auto-refresh interval"><button aria-pressed="true" class="px-2 py-1 text-[11px] font-medium rounded-md transition-colors bg-background text-foreground shadow-sm">Off</button><button aria-pressed="false" class="px-2 py-1 text-[11px] font-medium rounded-md transition-colors text-muted-foreground hover:text-foreground hover:bg-muted">5s</button><button aria-pressed="false" class="px-2 py-1 text-[11px] font-medium rounded-md transition-colors text-muted-foreground hover:text-foreground hover:bg-muted">10s</button><button aria-pressed="false" class="px-2 py-1 text-[11px] font-medium rounded-md transition-colors text-muted-foreground hover:text-foreground hover:bg-muted">30s</button></div></div><div class="w-px h-6 bg-border mx-1"></div><div class="relative"><button class="justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none hover:bg-muted h-9 px-3 relative z-50 flex items-center gap-1.5 text-muted-foreground hover:text-foreground" type="button" aria-expanded="false" aria-haspopup="true"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-git-branch h-4 w-4" aria-hidden="true"><path d="M15 6a9 9 0 0 0-9 9V3"></path><circle cx="18" cy="6" r="3"></circle><circle cx="6" cy="18" r="3"></circle></svg><span class="hidden sm:inline text-xs">Reach Us</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down h-3 w-3 transition-transform" aria-hidden="true"><path d="m6 9 6 6 6-6"></path></svg></button></div><button class="inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none hover:bg-muted hover:text-muted-foreground h-10 w-10 relative" aria-label="Switch to light mode"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sun h-[1.2rem] w-[1.2rem] transition-all rotate-90 scale-0" aria-hidden="true"><circle cx="12" cy="12" r="4"></circle><path d="M12 2v2"></path><path d="M12 20v2"></path><path d="m4.93 4.93 1.41 1.41"></path><path d="m17.66 17.66 1.41 1.41"></path><path d="M2 12h2"></path><path d="M20 12h2"></path><path d="m6.34 17.66-1.41 1.41"></path><path d="m19.07 4.93-1.41 1.41"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-moon absolute h-[1.2rem] w-[1.2rem] transition-all rotate-0 scale-100" aria-hidden="true"><path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"></path></svg></button></div></div></div></header><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><div class="fixed bottom-4 right-4 z-50 flex flex-col gap-2"></div><script src="/_next/static/chunks/0tyw4u3~2isbh.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[12344,[\"/_next/static/chunks/140xx_tfr~lm_.js\",\"/_next/static/chunks/02dqjyv6_9mhq.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"PostHogProvider\"]\n3:I[97917,[\"/_next/static/chunks/140xx_tfr~lm_.js\",\"/_next/static/chunks/02dqjyv6_9mhq.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"GlobalErrorListeners\"]\n4:I[47613,[\"/_next/static/chunks/140xx_tfr~lm_.js\",\"/_next/static/chunks/02dqjyv6_9mhq.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"ThemeProvider\"]\n5:I[85881,[\"/_next/static/chunks/140xx_tfr~lm_.js\",\"/_next/static/chunks/02dqjyv6_9mhq.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"AutoRefreshProvider\"]\n6:I[63780,[\"/_next/static/chunks/140xx_tfr~lm_.js\",\"/_next/static/chunks/02dqjyv6_9mhq.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"Navbar\"]\n7:I[39756,[\"/_next/static/chunks/140xx_tfr~lm_.js\",\"/_next/static/chunks/02dqjyv6_9mhq.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"default\"]\n8:I[8821,[\"/_next/static/chunks/140xx_tfr~lm_.js\",\"/_next/static/chunks/02dqjyv6_9mhq.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\",\"/_next/static/chunks/15fklyav5py5m.js\"],\"default\"]\n9:I[37457,[\"/_next/static/chunks/140xx_tfr~lm_.js\",\"/_next/static/chunks/02dqjyv6_9mhq.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"default\"]\na:I[55574,[\"/_next/static/chunks/140xx_tfr~lm_.js\",\"/_next/static/chunks/02dqjyv6_9mhq.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"Toaster\"]\nf:I[53348,[\"/_next/static/chunks/140xx_tfr~lm_.js\",\"/_next/static/chunks/02dqjyv6_9mhq.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\",\"/_next/static/chunks/0o547jv-k_k35.js\"],\"default\"]\n:HL[\"/_next/static/chunks/0mir9jdxn35~s.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",16],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/0mir9jdxn35~s.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/140xx_tfr~lm_.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/02dqjyv6_9mhq.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-2\",{\"src\":\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-3\",{\"src\":\"/_next/static/chunks/0ksdlt_1hucdm.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n (function() {\\n try {\\n // Ensure we don't add duplicate classes\\n document.documentElement.classList.remove('light', 'dark');\\n \\n var theme = localStorage.getItem('theme');\\n if (theme \u0026\u0026 (theme === 'light' || theme === 'dark')) {\\n document.documentElement.classList.add(theme);\\n } else {\\n document.documentElement.classList.add('dark');\\n }\\n } catch (e) {\\n // Fallback to dark theme if there's any error\\n document.documentElement.classList.remove('light', 'dark');\\n document.documentElement.classList.add('dark');\\n }\\n })();\\n \"}}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n #__loading {\\n position: fixed; inset: 0; z-index: 9999;\\n display: flex; align-items: center; justify-content: center;\\n background: var(--background, #031035);\\n color: var(--foreground, #f8fafc);\\n font-family: system-ui, sans-serif;\\n font-size: 1rem;\\n transition: opacity 0.15s;\\n }\\n body \u003e *:not(#__loading) { opacity: 0; }\\n \"}}]]}],[\"$\",\"body\",null,{\"className\":\"antialiased\",\"children\":[[\"$\",\"div\",null,{\"id\":\"__loading\",\"children\":\"Loading…\"}],[\"$\",\"$L2\",null,{\"children\":[[\"$\",\"$L3\",null,{}],[\"$\",\"$L4\",null,{\"children\":[[\"$\",\"$L5\",null,{\"children\":[[\"$\",\"$L6\",null,{\"disabledPages\":[]}],[\"$\",\"$L7\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$8\",\"errorStyles\":[],\"errorScripts\":[[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/15fklyav5py5m.js\",\"async\":true}]],\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],[\"$\",\"$La\",null,{}]]}]]}]]}]]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L7\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[\"$Lb\",null,\"$Lc\"]}],{},null,false,null]},null,false,\"$@d\"]},null,false,null],\"$Le\",false]],\"m\":\"$undefined\",\"G\":[\"$f\",[\"$L10\"]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"wOkJXoch1UmRAmyIuKZWc\"}\n"])</script><script>self.__next_f.push([1,"11:I[97367,[\"/_next/static/chunks/140xx_tfr~lm_.js\",\"/_next/static/chunks/02dqjyv6_9mhq.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"OutletBoundary\"]\n12:\"$Sreact.suspense\"\n15:I[97367,[\"/_next/static/chunks/140xx_tfr~lm_.js\",\"/_next/static/chunks/02dqjyv6_9mhq.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"ViewportBoundary\"]\n17:I[97367,[\"/_next/static/chunks/140xx_tfr~lm_.js\",\"/_next/static/chunks/02dqjyv6_9mhq.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"MetadataBoundary\"]\nb:[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:1:props:children:1:props:children:0:props:children:1:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:1:props:children:1:props:children:0:props:children:1:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:1:props:children:1:props:children:0:props:children:1:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:1:props:children:1:props:children:0:props:children:1:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]]\nc:[\"$\",\"$L11\",null,{\"children\":[\"$\",\"$12\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@13\"}]}]\n14:[]\nd:\"$W14\"\ne:[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$L15\",null,{\"children\":\"$L16\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L17\",null,{\"children\":[\"$\",\"$12\",null,{\"name\":\"Next.Metadata\",\"children\":\"$L18\"}]}]}],null]}]\n10:[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/0mir9jdxn35~s.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]\n"])</script><script>self.__next_f.push([1,"16:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"19:I[27201,[\"/_next/static/chunks/140xx_tfr~lm_.js\",\"/_next/static/chunks/02dqjyv6_9mhq.js\",\"/_next/static/chunks/0d3shmwh5_nmn.js\",\"/_next/static/chunks/0ksdlt_1hucdm.js\"],\"IconMark\"]\n13:null\n18:[[\"$\",\"title\",\"0\",{\"children\":\"Failproof AI - Hooks \u0026 Project Monitor\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Open-source hooks, policies, and project visualization for Claude Code \u0026 Agents SDK\"}],[\"$\",\"link\",\"2\",{\"rel\":\"icon\",\"href\":\"/icon.png\"}],[\"$\",\"$L19\",\"3\",{}]]\n"])</script></body></html>