claude-code-best 2.8.1 → 2.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (445) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/{AddWorkspaceDirectory-CNyPaerF.js → AddWorkspaceDirectory-CM5PYqoF.js} +1 -1
  3. package/dist/chunks/{App-hiKxO6UA.js → App-BLLQEMkd.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-AMXQPmfE.js +1 -0
  5. package/dist/chunks/{ApproveApiKey-Cd43j9Wa.js → ApproveApiKey-DrflOSA-.js} +1 -1
  6. package/dist/chunks/{AssistantSessionChooser-C8OxwSGM.js → AssistantSessionChooser-SlRne98s.js} +1 -1
  7. package/dist/chunks/BackgroundTasksDialog-Cciww_FF.js +2 -0
  8. package/dist/chunks/{BypassPermissionsModeDialog-Ddjzluka.js → BypassPermissionsModeDialog-HaciDdx0.js} +1 -1
  9. package/dist/chunks/{ClaudeInChromeOnboarding-BhvrEJlm.js → ClaudeInChromeOnboarding-EA3k_q2M.js} +1 -1
  10. package/dist/chunks/ClaudeMdExternalIncludesDialog-C-T8G8O7.js +1 -0
  11. package/dist/chunks/{ClaudeMdExternalIncludesDialog-DoNd72PS.js → ClaudeMdExternalIncludesDialog-xBclyqKk.js} +1 -1
  12. package/dist/chunks/ConsoleOAuthFlow-BTN62PKj.js +1 -0
  13. package/dist/chunks/{DesktopHandoff-DVUOZjb0.js → DesktopHandoff-BhY_F3Ob.js} +1 -1
  14. package/dist/chunks/{DevChannelsDialog-DJbRHAIy.js → DevChannelsDialog-DU5komVT.js} +1 -1
  15. package/dist/chunks/DiffDialog-D_-znREV.js +3 -0
  16. package/dist/chunks/Doctor-BhrEYzPO.js +3 -0
  17. package/dist/chunks/Doctor-CjnUU1CY.js +1 -0
  18. package/dist/chunks/{ExitFlow-BPbtGcEg.js → ExitFlow-cRfxceuS.js} +2 -2
  19. package/dist/chunks/{Feedback-BSagYjmf.js → Feedback-BMv8Kt05.js} +2 -2
  20. package/dist/chunks/Grove-CRAZGlvf.js +1 -0
  21. package/dist/chunks/{Grove-BrP9JNpK.js → Grove-CjfR7Acp.js} +1 -1
  22. package/dist/chunks/{HybridTransport-DLaxmXCR.js → HybridTransport-D32dn9xc.js} +1 -1
  23. package/dist/chunks/{ITermBackend-tXN55G2D.js → ITermBackend-BxjzkptA.js} +1 -1
  24. package/dist/chunks/{InvalidConfigDialog-BzFQdfwu.js → InvalidConfigDialog-CnCOCqMT.js} +1 -1
  25. package/dist/chunks/{InvalidSettingsDialog-KFg61s41.js → InvalidSettingsDialog-CLOgpfR2.js} +1 -1
  26. package/dist/chunks/MCPConnectionManager-BhbT4Sah.js +1 -0
  27. package/dist/chunks/{McpParsingWarnings-DsHSSgsx.js → McpParsingWarnings-B5X5HVnQ.js} +1 -1
  28. package/dist/chunks/MessageSelector-DLofsxam.js +3 -0
  29. package/dist/chunks/Messages-D1-i4MMT.js +11 -0
  30. package/dist/chunks/{Onboarding-DBJX6Cnf.js → Onboarding-Co5P3gZs.js} +1 -1
  31. package/dist/chunks/{OverageCreditUpsell-B4beCEX2.js → OverageCreditUpsell-DjgcfVt2.js} +1 -1
  32. package/dist/chunks/PluginSettings-NB-Wod-9.js +17 -0
  33. package/dist/chunks/{PromptInputHelpMenu-Bjjr3tYl.js → PromptInputHelpMenu-BDI5IF1s.js} +1 -1
  34. package/dist/chunks/QueryEngine-B217mLel.js +1 -0
  35. package/dist/chunks/REPL-BfprHNDt.js +1 -0
  36. package/dist/chunks/{REPL-CXcCBQuz.js → REPL-DCm_BFr_.js} +36 -36
  37. package/dist/chunks/{RemoteCallout-CuxqarhC.js → RemoteCallout-dGnKRIDB.js} +1 -1
  38. package/dist/chunks/{RemoteSessionManager-BhPF41Wn.js → RemoteSessionManager-BidAIOqZ.js} +2 -2
  39. package/dist/chunks/ResumeConversation-SDRT6hO3.js +1 -0
  40. package/dist/chunks/{SSETransport-8yaTbdSK.js → SSETransport-BM2xz03M.js} +1 -1
  41. package/dist/chunks/SearchExtraToolsTool-DCSReOsq.js +1 -0
  42. package/dist/chunks/{SentryErrorBoundary-ydwbrVTx.js → SentryErrorBoundary-D5niZGEU.js} +1 -1
  43. package/dist/chunks/SentryErrorBoundary-DzwCuftg.js +1 -0
  44. package/dist/chunks/Settings-D3ds_WCz.js +2 -0
  45. package/dist/chunks/{TeleportProgress-CNcl_DxR.js → TeleportProgress-Dg6HcEO9.js} +1 -1
  46. package/dist/chunks/{TeleportRepoMismatchDialog-DJc8_mjE.js → TeleportRepoMismatchDialog-BUKNU2jx.js} +1 -1
  47. package/dist/chunks/{TeleportResumeWrapper-Cw438s-J.js → TeleportResumeWrapper-5FTzA9R_.js} +1 -1
  48. package/dist/chunks/{ThemePicker-8X6yAwuQ.js → ThemePicker-Bdm12PmJ.js} +1 -1
  49. package/dist/chunks/{TmuxBackend-CqAnVFoI.js → TmuxBackend-CYx3Hdf1.js} +2 -2
  50. package/dist/chunks/{TrustDialog-Ch1FJzxi.js → TrustDialog-DGKf4iwh.js} +1 -1
  51. package/dist/chunks/{ValidationErrorsList-sgfvJPWZ.js → ValidationErrorsList-BP7vG1uX.js} +1 -1
  52. package/dist/chunks/{WelcomeV2-Bu8l3w90.js → WelcomeV2-k_969SnB.js} +1 -1
  53. package/dist/chunks/{WindowsTerminalBackend-Bvq7nHOp.js → WindowsTerminalBackend-K_zVZBSP.js} +2 -2
  54. package/dist/chunks/{add-dir-DqrRNnxe.js → add-dir-DnfUkb1n.js} +1 -1
  55. package/dist/chunks/{agentDisplay-DcxzWi1v.js → agentDisplay-DT04Kqdm.js} +1 -1
  56. package/dist/chunks/{agents-Do1ynqiW.js → agents-ELZyUElQ.js} +7 -7
  57. package/dist/chunks/{agents-QqLm1wcM.js → agents-hh7Zcqm6.js} +1 -1
  58. package/dist/chunks/{ant-D5gD6O-r.js → ant-CuQC6xHS.js} +1 -1
  59. package/dist/chunks/api-BY3NFL4L.js +1 -0
  60. package/dist/chunks/{api-hcsOinLV.js → api-C-KY7A3r.js} +1 -1
  61. package/dist/chunks/asciicast-BeEmDIKr.js +1 -0
  62. package/dist/chunks/{asciicast-C_1Pi99k.js → asciicast-C0fPsv7_.js} +1 -1
  63. package/dist/chunks/assistant-C669PK45.js +1 -0
  64. package/dist/chunks/{assistant-CemNvrYr.js → assistant-DbtrknMt.js} +1 -1
  65. package/dist/chunks/{assistant-DkECAILU.js → assistant-Z-xFHPiY.js} +1 -1
  66. package/dist/chunks/{auth-Dm8aWPRh.js → auth-Bo_eeRO9.js} +1 -1
  67. package/dist/chunks/auth-C-rD91K7.js +1 -0
  68. package/dist/chunks/{autoMode-dygqoN_C.js → autoMode-BhsFtU8_.js} +6 -6
  69. package/dist/chunks/{autonomy-BdxnxJnk.js → autonomy-B-d3Xamr.js} +1 -1
  70. package/dist/chunks/{autonomy-DPeEmb00.js → autonomy-C5wE-5B8.js} +12 -12
  71. package/dist/chunks/{autonomyPanel-Bocl2taZ.js → autonomyPanel-CMy4Zs1a.js} +1 -1
  72. package/dist/chunks/backgroundHousekeeping-YAOGWoo4.js +17 -0
  73. package/dist/chunks/backgroundHousekeeping-xFmPDL7y.js +1 -0
  74. package/dist/chunks/{branch-DwdVgun5.js → branch-DoV3sEJf.js} +2 -2
  75. package/dist/chunks/{bridge-DkkMogD_.js → bridge-8RYx23zW.js} +2 -2
  76. package/dist/chunks/{bridgeConfig-l6Ldi_hk.js → bridgeConfig-C8tQXEsd.js} +1 -1
  77. package/dist/chunks/bridgeConfig-D5awYlvd.js +1 -0
  78. package/dist/chunks/bridgeEnabled-0tZw2TlM.js +1 -0
  79. package/dist/chunks/{bridgeEnabled-DYclTb9d.js → bridgeEnabled-B3KTIVe4.js} +1 -1
  80. package/dist/chunks/bridgeMain-DKkE8RYG.js +1 -0
  81. package/dist/chunks/bridgeMain-Ssp8HRcV.js +68 -0
  82. package/dist/chunks/{bridgeMessaging-CYe1Cixl.js → bridgeMessaging-DGTm_wDk.js} +1 -1
  83. package/dist/chunks/{btw-CyOlY5R-.js → btw-Du0mHeiD.js} +1 -1
  84. package/dist/chunks/{buddy-q-utA1_5.js → buddy-D04AYSW6.js} +1 -1
  85. package/dist/chunks/{bypassPermissionsKillswitch-CTrRxzdz.js → bypassPermissionsKillswitch-CRYkShwu.js} +1 -1
  86. package/dist/chunks/caches-Byd8SjTZ.js +1 -0
  87. package/dist/chunks/{caches-Bz4yVQyE.js → caches-DYf69-N9.js} +2 -2
  88. package/dist/chunks/{ccrClient-DXiEw9xU.js → ccrClient-CDrBxSox.js} +1 -1
  89. package/dist/chunks/changeDetector-CGzGs92S.js +1 -0
  90. package/dist/chunks/{channelNotification-CLPdvxGZ.js → channelNotification-CtA9HHFW.js} +1 -1
  91. package/dist/chunks/channelNotification-DOvTvOGt.js +1 -0
  92. package/dist/chunks/{chrome-DxbhLWDW.js → chrome-BHbT4cc4.js} +1 -1
  93. package/dist/chunks/clear-BGLxPs_B.js +1 -0
  94. package/dist/chunks/client-CtOmoNuQ.js +1 -0
  95. package/dist/chunks/color-MOZYZ1cM.js +1 -0
  96. package/dist/chunks/commands-B3XpQmEm.js +1 -0
  97. package/dist/chunks/{commitAttribution-CJXF8wMs.js → commitAttribution-BTtCTr8c.js} +1 -1
  98. package/dist/chunks/commitAttribution-CXNK79GW.js +1 -0
  99. package/dist/chunks/compact-CMqxm2yG.js +3 -0
  100. package/dist/chunks/{companion-rXSt0nmz.js → companion-ChxkOPHB.js} +1 -1
  101. package/dist/chunks/{config-BE3jrcr-.js → config-cRyRIPI7.js} +1 -1
  102. package/dist/chunks/{config-CzC08IjE.js → config-wvQYYbwU.js} +1 -1
  103. package/dist/chunks/{context-BHE99SMA.js → context-7ds9guuJ.js} +1 -1
  104. package/dist/chunks/{context-noninteractive-BZQIUH_y.js → context-noninteractive-CISZymIU.js} +2 -2
  105. package/dist/chunks/context-noninteractive-CwJBBF8h.js +1 -0
  106. package/dist/chunks/conversation-Bgsdn99n.js +1 -0
  107. package/dist/chunks/conversation-D30CU_jS.js +1 -0
  108. package/dist/chunks/{copy-TgphIVzy.js → copy-Dvz2Mge4.js} +2 -2
  109. package/dist/chunks/{createSSHSession-CSKEZ4ic.js → createSSHSession-Befx8LiM.js} +1 -1
  110. package/dist/chunks/createSession-Cp0KTjPL.js +1 -0
  111. package/dist/chunks/{createSession-Ce218tQj.js → createSession-CsZGoika.js} +1 -1
  112. package/dist/chunks/{cronJitterConfig-CnKed5Gi.js → cronJitterConfig-Dfl7iZqE.js} +3 -3
  113. package/dist/chunks/{crossProjectResume-BFlsTYOq.js → crossProjectResume-DK8nt_cn.js} +3 -3
  114. package/dist/chunks/{datadog-D5jSRybW.js → datadog-2vPhbh6g.js} +1 -1
  115. package/dist/chunks/datadog-DLTYg-S2.js +1 -0
  116. package/dist/chunks/{desktop-cjA0tGOa.js → desktop-DY9Nw2Fi.js} +1 -1
  117. package/dist/chunks/{diff-DMd61IjE.js → diff-Ci6rs6S6.js} +1 -1
  118. package/dist/chunks/{directoryCompletion-DqtWZsoW.js → directoryCompletion-DLxCFk_m.js} +1 -1
  119. package/dist/chunks/{doctor-ueUYyjyL.js → doctor-DBYGgS-y.js} +1 -1
  120. package/dist/chunks/{effort-B9IvAstG.js → effort-Bi_t4J_o.js} +2 -2
  121. package/dist/chunks/{entry-Bq_KRMWs.js → entry-p_5l64_p.js} +5 -5
  122. package/dist/chunks/{envLessBridgeConfig-CpjlwmvF.js → envLessBridgeConfig-C_sqoGX6.js} +1 -1
  123. package/dist/chunks/envLessBridgeConfig-Cfbqwjew.js +1 -0
  124. package/dist/chunks/exit-Bc8L5oQT.js +1 -0
  125. package/dist/chunks/{export-CP638-TO.js → export-kvnEu9Iw.js} +1 -1
  126. package/dist/chunks/{exportRenderer-B5emJDvn.js → exportRenderer-DmpMgUiv.js} +1 -1
  127. package/dist/chunks/extra-usage-BnO6knuC.js +1 -0
  128. package/dist/chunks/{extra-usage-DIm8nrKj.js → extra-usage-CmP6V7HX.js} +1 -1
  129. package/dist/chunks/{extra-usage-core-DERKSEe1.js → extra-usage-core-BqJClmf4.js} +1 -1
  130. package/dist/chunks/{extra-usage-noninteractive-Dq5dog_-.js → extra-usage-noninteractive-BWyPFx53.js} +1 -1
  131. package/dist/chunks/extraUsage-DgMspmL4.js +1 -0
  132. package/dist/chunks/extractMemories-uQJS_i6E.js +1 -0
  133. package/dist/chunks/fast-Bunl4ivM.js +1 -0
  134. package/dist/chunks/{fast-BP2t1xDM.js → fast-Dd2jZVF-.js} +1 -1
  135. package/dist/chunks/{feedback-C-mR6zJr.js → feedback-8UeDx3Yc.js} +1 -1
  136. package/dist/chunks/{firstPartyEventLogger-sMmHdYjg.js → firstPartyEventLogger-cKEuzfyR.js} +1 -1
  137. package/dist/chunks/{flushGate-C18XwNsa.js → flushGate-B3upNVdV.js} +1 -1
  138. package/dist/chunks/{gates-Be5r2kKS.js → gates-lWoKqpJ1.js} +1 -1
  139. package/dist/chunks/gates-uo2owWkc.js +1 -0
  140. package/dist/chunks/{gemini-BberPcp1.js → gemini-DDSP4ArG.js} +1 -1
  141. package/dist/chunks/{generateRecap-B76UcVUS.js → generateRecap-DCBzHqag.js} +1 -1
  142. package/dist/chunks/{generateSessionName-BwtXd8TC.js → generateSessionName-Db5pZ3cL.js} +1 -1
  143. package/dist/chunks/{githubRepoPathMapping-5IlVgR2l.js → githubRepoPathMapping-v_U9b0Fe.js} +1 -1
  144. package/dist/chunks/{goal-DQ0jNcLO.js → goal-EZCOCHZa.js} +3 -3
  145. package/dist/chunks/{grok-Dh_thT2_.js → grok-H8K_fDKF.js} +1 -1
  146. package/dist/chunks/{growthbook-4ADV3CAt.js → growthbook-mMD0jkbu.js} +1 -1
  147. package/dist/chunks/{heapdump-Dwqmh4SX.js → heapdump-CbVvtQuH.js} +1 -1
  148. package/dist/chunks/{help-Bznaywoi.js → help-Bq4jxCSJ.js} +1 -1
  149. package/dist/chunks/hooks-CVlFJfV0.js +1 -0
  150. package/dist/chunks/{hooks-F-82cg6M.js → hooks-DbKUS0fN.js} +2 -2
  151. package/dist/chunks/{hostAdapter-DpfLr3hX.js → hostAdapter-BhVpIn1Y.js} +1 -1
  152. package/dist/chunks/{ide-BfAKWufQ.js → ide-DZJheXyl.js} +2 -2
  153. package/dist/chunks/{inboundAttachments-CFV_eqMu.js → inboundAttachments-B9NxWIDx.js} +1 -1
  154. package/dist/chunks/inboundAttachments-_vhgWPEL.js +1 -0
  155. package/dist/chunks/initReplBridge-BCIaWf78.js +1 -0
  156. package/dist/chunks/{insights-BNsCwNYa.js → insights-D1BFvhw_.js} +68 -68
  157. package/dist/chunks/{install-Bszzs98N.js → install-D_xm-9s1.js} +1 -1
  158. package/dist/chunks/{install-github-app-DVxGR2rp.js → install-github-app-CUEACXdr.js} +2 -2
  159. package/dist/chunks/{install-slack-app-CjlRL19o.js → install-slack-app-DGV6l9wy.js} +1 -1
  160. package/dist/chunks/{instrumentation-BOYPOtyu.js → instrumentation-CEfWNakt.js} +3 -3
  161. package/dist/chunks/{job-BvD5_lGz.js → job-BeeAFieV.js} +1 -1
  162. package/dist/chunks/{keybindings-RPmPPGhp.js → keybindings-CeYhuE5G.js} +2 -2
  163. package/dist/chunks/{lang-9VNaOJMz.js → lang-BmwAsgo1.js} +1 -1
  164. package/dist/chunks/{language-Ct5Nkqm6.js → language-BcWiv2lr.js} +1 -1
  165. package/dist/chunks/language-BnQye2Mx.js +1 -0
  166. package/dist/chunks/{launchAgentsPlatform-CnoxFIXV.js → launchAgentsPlatform-DqQzwcqV.js} +1 -1
  167. package/dist/chunks/{launchAutofixPr-ChaDUtvx.js → launchAutofixPr-XltBpICW.js} +3 -3
  168. package/dist/chunks/{launchLocalMemory-MwZfEJxz.js → launchLocalMemory-CHSU4_or.js} +2 -2
  169. package/dist/chunks/{launchLocalVault-B6Ib5WXx.js → launchLocalVault-CnvCdQ1M.js} +3 -3
  170. package/dist/chunks/{launchMemoryStores-D6xyGwQ1.js → launchMemoryStores-DD2duIDU.js} +1 -1
  171. package/dist/chunks/{launchOnboarding-BtdAOO3p.js → launchOnboarding-JTKef_jU.js} +1 -1
  172. package/dist/chunks/{launchSchedule-XVljzNKg.js → launchSchedule-BVtfNQtS.js} +1 -1
  173. package/dist/chunks/{launchSkillStore-QT8Qcc5N.js → launchSkillStore-TisTmZ3O.js} +1 -1
  174. package/dist/chunks/{launchTeleport-DwxPesKQ.js → launchTeleport-BO_V6ggj.js} +3 -3
  175. package/dist/chunks/{launchVault-Dbti6pph.js → launchVault-Civro2KB.js} +1 -1
  176. package/dist/chunks/{loadAgentsDir-BYWykYwn.js → loadAgentsDir-BfEZacjM.js} +740 -690
  177. package/dist/chunks/loadAgentsDir-rYxb2igq.js +1 -0
  178. package/dist/chunks/loadPluginHooks-Cniyh-tZ.js +1 -0
  179. package/dist/chunks/localSearch-C0J7ETJQ.js +1 -0
  180. package/dist/chunks/{localSearch-eWjZxMc8.js → localSearch-COJcqOWl.js} +1 -1
  181. package/dist/chunks/login-B4wjtpEU.js +1 -0
  182. package/dist/chunks/{login-D1aQCqp0.js → login-SuUxFLIY.js} +1 -1
  183. package/dist/chunks/{logoV2Utils-CPNvLtol.js → logoV2Utils-DvjpZkyF.js} +1 -1
  184. package/dist/chunks/logout-o16yNWNB.js +1 -0
  185. package/dist/chunks/{magicDocs-DAvjAbAJ.js → magicDocs-BZBrH9zB.js} +2 -2
  186. package/dist/chunks/{main-BKlQiSuc.js → main-p9Tke3lb.js} +90 -63
  187. package/dist/chunks/mappers-BcXg_fI3.js +1 -0
  188. package/dist/chunks/mcp-BFxLEf3X.js +1 -0
  189. package/dist/chunks/{mcp-ya96irNP.js → mcp-CIJL0PTq.js} +2 -2
  190. package/dist/chunks/mcp-DfuQ1MJu.js +6 -0
  191. package/dist/chunks/{mcpServer-B1q9blAc.js → mcpServer-D2kI_m2H.js} +1 -1
  192. package/dist/chunks/{mcpServer-BJB5g6j2.js → mcpServer-DPk-oJOU.js} +1 -1
  193. package/dist/chunks/{memory-CxiukAGg.js → memory-CJOtY_Uv.js} +1 -1
  194. package/dist/chunks/{mode-DqAJ2y6R.js → mode-DkpKiyTE.js} +1 -1
  195. package/dist/chunks/{model-C8TW-qjl.js → model-DZyzd39E.js} +1 -1
  196. package/dist/chunks/model-De0AGQ3F.js +1 -0
  197. package/dist/chunks/{onChangeAppState-BG1pF7ht.js → onChangeAppState-CvtxqUDG.js} +1 -1
  198. package/dist/chunks/{openai-CHoRhRtf.js → openai-B888nVou.js} +3 -3
  199. package/dist/chunks/{overageCreditGrant-DYMg1lV4.js → overageCreditGrant-BOSyVk3U.js} +1 -1
  200. package/dist/chunks/{panelCall-SYrmrKt9.js → panelCall-BVdu8oii.js} +1 -1
  201. package/dist/chunks/{passes-CSV-SZJc.js → passes-DeSsjipz.js} +1 -1
  202. package/dist/chunks/{path-BE28AJwZ.js → path-Cit7LKW-.js} +1 -1
  203. package/dist/chunks/{paths-BZjPDxMm.js → paths-nIHVpTn2.js} +3 -3
  204. package/dist/chunks/permissions-DGdr-wOj.js +3 -0
  205. package/dist/chunks/{pipeTransport-uK7GxbSG.js → pipeTransport-ClZYq1sd.js} +1 -1
  206. package/dist/chunks/{plan-DEbo-Adi.js → plan-D9bnkDwv.js} +1 -1
  207. package/dist/chunks/{plugin-Cops24hg.js → plugin-BE0r1g1g.js} +1 -1
  208. package/dist/chunks/{pluginAutoupdate-Bg7JMOHN.js → pluginAutoupdate-xyXksEJv.js} +1 -1
  209. package/dist/chunks/pluginBlocklist-Dd7XBe8U.js +1 -0
  210. package/dist/chunks/{pluginCliCommands-DyYEg7Cv.js → pluginCliCommands-8MJCk1nq.js} +1 -1
  211. package/dist/chunks/{pluginFlagging-DwChUZMJ.js → pluginFlagging-7zuXXBD5.js} +1 -1
  212. package/dist/chunks/pluginOperations-DFzbASMD.js +2 -0
  213. package/dist/chunks/{pluginStartupCheck-DCxJJkYs.js → pluginStartupCheck-BC5npqdw.js} +1 -1
  214. package/dist/chunks/pluginStartupCheck-C6IH0haF.js +1 -0
  215. package/dist/chunks/plugins-Bhc2pbAj.js +4 -0
  216. package/dist/chunks/policyLimits-CfrU0rIR.js +1 -0
  217. package/dist/chunks/{pollConfig-DBNHhvHf.js → pollConfig-B3hNYQ_n.js} +1 -1
  218. package/dist/chunks/{poor-aPQce502.js → poor-BjTGCuqc.js} +1 -1
  219. package/dist/chunks/{poorMode-CFRuV-nB.js → poorMode-CGVMMLlz.js} +1 -1
  220. package/dist/chunks/poorMode-DWLhTldO.js +1 -0
  221. package/dist/chunks/{print-Cf2tY__0.js → print-BJkyuCzw.js} +11 -11
  222. package/dist/chunks/{privacy-settings-CYkM3Aem.js → privacy-settings-BDVjqVcX.js} +1 -1
  223. package/dist/chunks/processBashCommand-DnzyTwtS.js +1 -0
  224. package/dist/chunks/processSlashCommand-BGBRvSCA.js +6 -0
  225. package/dist/chunks/prompt-BXrvaHyx.js +1 -0
  226. package/dist/chunks/prompt-DgIuTC6Q.js +227 -0
  227. package/dist/chunks/prompt-Fax-fxAf.js +1 -0
  228. package/dist/chunks/{promptEditor-U03qQWbq.js → promptEditor-BkHY_Vzb.js} +2 -2
  229. package/dist/chunks/{protocolHandler-3yBj9w5N.js → protocolHandler-CrXWRkxh.js} +1 -1
  230. package/dist/chunks/rate-limit-options-skMSi19l.js +1 -0
  231. package/dist/chunks/{rcDebugLog-ClX1msJX.js → rcDebugLog-Bv_x5w_B.js} +1 -1
  232. package/dist/chunks/{referral-qe-yqXJE.js → referral-DfKWr4Jf.js} +1 -1
  233. package/dist/chunks/refresh-zosTlttX.js +1 -0
  234. package/dist/chunks/{registerProtocol-CClQph00.js → registerProtocol-De6y1iOi.js} +1 -1
  235. package/dist/chunks/registry-C8JbYbJI.js +1 -0
  236. package/dist/chunks/{release-notes-CyZHxWTF.js → release-notes-Su1UPyE4.js} +1 -1
  237. package/dist/chunks/{releaseNotes-BtxL5R5Q.js → releaseNotes-C7-JnhrH.js} +2 -2
  238. package/dist/chunks/{reload-plugins-B0eR8JHH.js → reload-plugins-C8lWCq8M.js} +1 -1
  239. package/dist/chunks/{remote-env-B_sIjY87.js → remote-env-tQuvJmrt.js} +1 -1
  240. package/dist/chunks/{remoteBridgeCore-C3WRaLpU.js → remoteBridgeCore-CwOTDmNP.js} +1 -1
  241. package/dist/chunks/{remoteControlServer-BOj9qmgH.js → remoteControlServer-DIKi-0lr.js} +2 -2
  242. package/dist/chunks/rename-Trg9EHjT.js +1 -0
  243. package/dist/chunks/{resume-CpivBr9S.js → resume-Nt_EbjKh.js} +2 -2
  244. package/dist/chunks/{runtimeObserver-sOnfVR7t.js → runtimeObserver-CyWhTJpz.js} +4 -4
  245. package/dist/chunks/{runtimeObserver-C2_7Vsnd.js → runtimeObserver-T9QERJ_O.js} +1 -1
  246. package/dist/chunks/sandbox-adapter-BDGhDrPl.js +1 -0
  247. package/dist/chunks/{sandbox-toggle-Bv68-Ca7.js → sandbox-toggle-C6v31S7-.js} +1 -1
  248. package/dist/chunks/searchExtraTools-C8ehknh0.js +1 -0
  249. package/dist/chunks/{sentry-BBCn6RGP.js → sentry-CK_GHX79.js} +1 -1
  250. package/dist/chunks/{session-DfvxYP8o.js → session-Ys3KvmQ0.js} +1 -1
  251. package/dist/chunks/{sessionDiscovery-CyuRBTAm.js → sessionDiscovery-Cg3X2fKe.js} +1 -1
  252. package/dist/chunks/sessionFileAccessHooks-vthxapHk.js +1 -0
  253. package/dist/chunks/sessionMemory-ek1SfYG_.js +1 -0
  254. package/dist/chunks/sessionMemory-l-S0jpuk.js +1 -0
  255. package/dist/chunks/sessionMemoryUtils-BGJeJyKn.js +1 -0
  256. package/dist/chunks/sessionObserver-COTvvM3Z.js +1 -0
  257. package/dist/chunks/{sessionObserver-CTkIYplM.js → sessionObserver-DvAdG6vQ.js} +2 -2
  258. package/dist/chunks/sessionStorage-GKe4ALVr.js +1 -0
  259. package/dist/chunks/{sessionTitle-ePQRpeV2.js → sessionTitle-DJMmUKBJ.js} +2 -2
  260. package/dist/chunks/{sessionTracing-81-RIJBo.js → sessionTracing-DuQ3kbq6.js} +1 -1
  261. package/dist/chunks/{settingsSync-DEFWnE1o.js → settingsSync-1mhDakFG.js} +1 -1
  262. package/dist/chunks/{setup-CTfYsKsz.js → setup-CAy0HkI3.js} +1 -1
  263. package/dist/chunks/setup-CGxUKG8x.js +3 -0
  264. package/dist/chunks/{setup-2611vmGJ.js → setup-D5ioKRsS.js} +1 -1
  265. package/dist/chunks/{shadowedRuleDetection-CGD7Nx03.js → shadowedRuleDetection-Cq0y9pLR.js} +1 -1
  266. package/dist/chunks/{sideQuestion-BcP9Mm-5.js → sideQuestion-ZII6LMSM.js} +3 -3
  267. package/dist/chunks/{sink-D_t1TIt9.js → sink-Cd5g6Qqh.js} +1 -1
  268. package/dist/chunks/sink-Df9tds-b.js +1 -0
  269. package/dist/chunks/sinks-C4DwU8Xs.js +1 -0
  270. package/dist/chunks/{sinks-DXsozhmS.js → sinks-DZlIEjLZ.js} +2 -2
  271. package/dist/chunks/{skill-learning-CZm2iMik.js → skill-learning-DO21PjpF.js} +1 -1
  272. package/dist/chunks/skillChangeDetector-B6tL2yC9.js +1 -0
  273. package/dist/chunks/{skillGapStore-DzHv8v-D.js → skillGapStore-B_xv3GUy.js} +1 -1
  274. package/dist/chunks/{skillGapStore-cWo6Ra90.js → skillGapStore-CTD8MYTx.js} +2 -2
  275. package/dist/chunks/{skillGenerator-D_W1IeP3.js → skillGenerator-CO9r-gft.js} +2 -2
  276. package/dist/chunks/skillLearning-BJS4lsNk.js +1 -0
  277. package/dist/chunks/skillLearning-C2NmdcYQ.js +1 -0
  278. package/dist/chunks/{skillPanel-ChmOZu4F.js → skillPanel-DSumFGKN.js} +3 -3
  279. package/dist/chunks/{skillSearchPanel-CVx2b4Pr.js → skillSearchPanel-SqkfYBjV.js} +4 -4
  280. package/dist/chunks/{skills-CWX1SydA.js → skills-Bj3g5apl.js} +1 -1
  281. package/dist/chunks/{sprites-BuvEFwW6.js → sprites-CxMz3tIE.js} +1 -1
  282. package/dist/chunks/{stats-wjMQA-CA.js → stats-D1wYx84O.js} +1 -1
  283. package/dist/chunks/{status-CyU7IQhO.js → status-BWCqbeJ3.js} +1 -1
  284. package/dist/chunks/statusNoticeHelpers-DY0Cblkd.js +1 -0
  285. package/dist/chunks/{tag-opEEZI5B.js → tag-Hc7nOYm5.js} +2 -2
  286. package/dist/chunks/{tasks-CCtnU5u1.js → tasks-BSqecqVm.js} +1 -1
  287. package/dist/chunks/{teamHelpers-BJJs8taN.js → teamHelpers-BOmVFTLS.js} +1 -1
  288. package/dist/chunks/teamHelpers-BueGmQcw.js +1 -0
  289. package/dist/chunks/{teammateModeSnapshot-CLiiOCkO.js → teammateModeSnapshot-DhXjREuo.js} +1 -1
  290. package/dist/chunks/teammateModeSnapshot-_MCm6NGJ.js +1 -0
  291. package/dist/chunks/teleport-W2iPwivh.js +1 -0
  292. package/dist/chunks/{templateJobs-C6D7GC-Q.js → templateJobs-1oMC9yLQ.js} +1 -1
  293. package/dist/chunks/{terminalSetup-2ioFcRAA.js → terminalSetup-Bkml3uSP.js} +1 -1
  294. package/dist/chunks/{terminalSetup-B3bN4Cj8.js → terminalSetup-DJX1hqKs.js} +1 -1
  295. package/dist/chunks/{theme-Dgq_Og2P.js → theme-ia4cIc4d.js} +1 -1
  296. package/dist/chunks/thinkback-1NYskewu.js +1 -0
  297. package/dist/chunks/{thinkback-C43WBHis.js → thinkback-DWLUXUQC.js} +1 -1
  298. package/dist/chunks/thinkback-play-DZmXMRtq.js +1 -0
  299. package/dist/chunks/{toolEventObserver-B7EA-nNa.js → toolEventObserver-Ci0BECRu.js} +1 -1
  300. package/dist/chunks/{toolEventObserver-BG_3sGCL.js → toolEventObserver-nPwMQ5Vf.js} +1 -1
  301. package/dist/chunks/toolPool-ByCdlOak.js +1 -0
  302. package/dist/chunks/toolPool-IkNWjuk2.js +1 -0
  303. package/dist/chunks/{trustedDevice-S34i6Jc9.js → trustedDevice-BynTLVs4.js} +1 -1
  304. package/dist/chunks/{trustedDevice-DeNxe6bl.js → trustedDevice-CtL2IGDX.js} +1 -1
  305. package/dist/chunks/{ultrareviewCommand-C45bmZqN.js → ultrareviewCommand-DN-QhQ-f.js} +2 -2
  306. package/dist/chunks/undercover-CqJzV_Ar.js +1 -0
  307. package/dist/chunks/{undercover-DoUSM8d6.js → undercover-DLr5xI3K.js} +1 -1
  308. package/dist/chunks/{updateCCB-BuAm25MX.js → updateCCB-C6Ov8SNx.js} +4 -4
  309. package/dist/chunks/{upgrade-BDKg286g.js → upgrade-CVM1ffhq.js} +1 -1
  310. package/dist/chunks/upgrade-d40dVpDc.js +1 -0
  311. package/dist/chunks/{upload-CMptZXZs.js → upload-DSNwGLNd.js} +1 -1
  312. package/dist/chunks/{usage-Bw_LK9YI.js → usage-BRv8mBDf.js} +1 -1
  313. package/dist/chunks/{usage-DEWsKPXj.js → usage-GMw8NiO_.js} +1 -1
  314. package/dist/chunks/{useMainLoopModel-D0PmGDuy.js → useMainLoopModel-CEM_50a0.js} +1 -1
  315. package/dist/chunks/{useManagePlugins-B-ejJsXy.js → useManagePlugins-hCqb5F5n.js} +1 -1
  316. package/dist/chunks/{useMergedTools-B6x9qtfj.js → useMergedTools-DxvRmxVF.js} +1 -1
  317. package/dist/chunks/{useSearchInput-BpMLsxaS.js → useSearchInput-BCErnYur.js} +1 -1
  318. package/dist/chunks/useSettingsErrors-BwNeCSA6.js +1 -0
  319. package/dist/chunks/{useVoice-C3ryR2HE.js → useVoice-Cu39ifSa.js} +1 -1
  320. package/dist/chunks/{util-DWl5gjmI.js → util-DYuasrIE.js} +1 -1
  321. package/dist/chunks/utils-DSGFJaZ_.js +1 -0
  322. package/dist/chunks/{validatePlugin-8EMSASvV.js → validatePlugin-b1ec7M7n.js} +1 -1
  323. package/dist/chunks/{vim-CaZ20SrQ.js → vim-CrAzv4cM.js} +1 -1
  324. package/dist/chunks/{voice-BrnKguEV.js → voice-DKG3SYqi.js} +2 -2
  325. package/dist/chunks/{voiceModeEnabled-3eg8vSqy.js → voiceModeEnabled-By2qa3A2.js} +1 -1
  326. package/dist/chunks/voiceModeEnabled-DwYcj-FH.js +1 -0
  327. package/dist/chunks/voiceStreamSTT-DD8ulbg1.js +1 -0
  328. package/dist/chunks/{voiceStreamSTT-D7jWIYwz.js → voiceStreamSTT-DEV82xnN.js} +1 -1
  329. package/dist/chunks/{web-tools-BT3TbzG5.js → web-tools-8QRyE7va.js} +1 -1
  330. package/dist/chunks/windowsPaths-CRq9Bt5c.js +1 -0
  331. package/dist/chunks/windowsPaths-jbJ-skB_.js +1 -0
  332. package/dist/chunks/{workerRegistry-C_i5wwjL.js → workerRegistry-S7pO5khK.js} +1 -1
  333. package/dist/chunks/worktree-CfXrXsQ2.js +1 -0
  334. package/dist/chunks/{xml-DOXio8vw.js → xml-CPJXOUFt.js} +1 -1
  335. package/dist/cli.js +1 -1
  336. package/package.json +1 -1
  337. package/dist/chunks/ApproveApiKey-DUoUTxFp.js +0 -1
  338. package/dist/chunks/BackgroundTasksDialog-VKhuyQLe.js +0 -2
  339. package/dist/chunks/ClaudeMdExternalIncludesDialog-COO2W0ij.js +0 -1
  340. package/dist/chunks/ConsoleOAuthFlow-CPWq7O57.js +0 -1
  341. package/dist/chunks/DiffDialog-D0RK4t-9.js +0 -3
  342. package/dist/chunks/Doctor-0Nv3L1Oy.js +0 -3
  343. package/dist/chunks/Doctor-Ba9zhV0V.js +0 -1
  344. package/dist/chunks/Grove-DyvIToPa.js +0 -1
  345. package/dist/chunks/MCPConnectionManager-N-oJu3qn.js +0 -1
  346. package/dist/chunks/MessageSelector-D10JMnsc.js +0 -3
  347. package/dist/chunks/Messages-CQdQJ2AA.js +0 -11
  348. package/dist/chunks/PluginSettings-BBrFCSpQ.js +0 -17
  349. package/dist/chunks/QueryEngine-BSk8-8vB.js +0 -1
  350. package/dist/chunks/REPL-D-akKdFc.js +0 -1
  351. package/dist/chunks/ResumeConversation-hmIOkZ2U.js +0 -1
  352. package/dist/chunks/SearchExtraToolsTool-wDSdfnRo.js +0 -1
  353. package/dist/chunks/SentryErrorBoundary-Duyg6HeT.js +0 -1
  354. package/dist/chunks/Settings-BSbzT25q.js +0 -2
  355. package/dist/chunks/api-VMfJpk1G.js +0 -1
  356. package/dist/chunks/asciicast-DA6TudSH.js +0 -1
  357. package/dist/chunks/assistant-D7D1sqTB.js +0 -1
  358. package/dist/chunks/auth-CGdLe3rq.js +0 -1
  359. package/dist/chunks/backgroundHousekeeping-4H6yTjsj.js +0 -1
  360. package/dist/chunks/backgroundHousekeeping-zf-tDimg.js +0 -17
  361. package/dist/chunks/bridgeConfig-CTJBoASk.js +0 -1
  362. package/dist/chunks/bridgeEnabled-SMuWz3Is.js +0 -1
  363. package/dist/chunks/bridgeMain-Ct5oDosG.js +0 -68
  364. package/dist/chunks/bridgeMain-UqwOi37W.js +0 -1
  365. package/dist/chunks/caches-DKMoKTAZ.js +0 -1
  366. package/dist/chunks/changeDetector--KPj2maX.js +0 -1
  367. package/dist/chunks/channelNotification-fJgjqRMx.js +0 -1
  368. package/dist/chunks/clear-CYVCwiwu.js +0 -1
  369. package/dist/chunks/client-DvWRsIpi.js +0 -1
  370. package/dist/chunks/color-DiLtK8_L.js +0 -1
  371. package/dist/chunks/commands-BT2_ICaW.js +0 -1
  372. package/dist/chunks/commitAttribution-Bpbro1a4.js +0 -1
  373. package/dist/chunks/compact-C6xm1N5a.js +0 -3
  374. package/dist/chunks/context-noninteractive-BQDOgVUW.js +0 -1
  375. package/dist/chunks/conversation-Bt6QdGd-.js +0 -1
  376. package/dist/chunks/conversation-CBPRFDod.js +0 -1
  377. package/dist/chunks/createSession-BaHXBnfG.js +0 -1
  378. package/dist/chunks/datadog-DgYqUGa-.js +0 -1
  379. package/dist/chunks/envLessBridgeConfig-D_GCqhTu.js +0 -1
  380. package/dist/chunks/exit-DtjFIrvJ.js +0 -1
  381. package/dist/chunks/extra-usage-C4dUWLhg.js +0 -1
  382. package/dist/chunks/extraUsage-BMvDY0Sk.js +0 -1
  383. package/dist/chunks/extractMemories-DS7XXeEo.js +0 -1
  384. package/dist/chunks/fast-D1xIHYaN.js +0 -1
  385. package/dist/chunks/gates-CUAwAhPL.js +0 -1
  386. package/dist/chunks/hooks-DynUngv2.js +0 -1
  387. package/dist/chunks/inboundAttachments-Cug-8Xdy.js +0 -1
  388. package/dist/chunks/initReplBridge-DV9KhSic.js +0 -1
  389. package/dist/chunks/language-CjFs6_la.js +0 -1
  390. package/dist/chunks/loadAgentsDir-tPgCg0WD.js +0 -1
  391. package/dist/chunks/loadPluginHooks-2U3UO__Q.js +0 -1
  392. package/dist/chunks/localSearch-CxwxzM8W.js +0 -1
  393. package/dist/chunks/login-CVVFklZw.js +0 -1
  394. package/dist/chunks/logout-BYsszpXx.js +0 -1
  395. package/dist/chunks/mappers-BBkM1aA5.js +0 -1
  396. package/dist/chunks/mcp-C3jlClk0.js +0 -6
  397. package/dist/chunks/mcp-Cmw8ecKk.js +0 -1
  398. package/dist/chunks/model-VB4ItNVB.js +0 -1
  399. package/dist/chunks/permissions-DBddT2NP.js +0 -3
  400. package/dist/chunks/pluginBlocklist-DEM_RWc2.js +0 -1
  401. package/dist/chunks/pluginOperations-COyT4tHs.js +0 -2
  402. package/dist/chunks/pluginStartupCheck-DjfIaOch.js +0 -1
  403. package/dist/chunks/plugins-BanQjHmw.js +0 -4
  404. package/dist/chunks/policyLimits-D-Y_soHx.js +0 -1
  405. package/dist/chunks/poorMode-DQagHYWe.js +0 -1
  406. package/dist/chunks/processBashCommand-BLSC8o8M.js +0 -1
  407. package/dist/chunks/processSlashCommand-Ch9B-6nh.js +0 -6
  408. package/dist/chunks/prompt-BGNhFY1n.js +0 -227
  409. package/dist/chunks/prompt-CrNwH5kr.js +0 -1
  410. package/dist/chunks/prompt-dH0MMivt.js +0 -1
  411. package/dist/chunks/rate-limit-options-D-xl_9PO.js +0 -1
  412. package/dist/chunks/refresh-CO_P3WKA.js +0 -1
  413. package/dist/chunks/registry-C0zdU2Hb.js +0 -1
  414. package/dist/chunks/rename-BFAC3WLD.js +0 -1
  415. package/dist/chunks/sandbox-adapter-jX_WzvnK.js +0 -1
  416. package/dist/chunks/searchExtraTools-xPuOKDpi.js +0 -1
  417. package/dist/chunks/sessionFileAccessHooks-DiKsr7H7.js +0 -1
  418. package/dist/chunks/sessionMemory-C34-eFnJ.js +0 -1
  419. package/dist/chunks/sessionMemory-kYQnpcyG.js +0 -1
  420. package/dist/chunks/sessionMemoryUtils-CcJcgftx.js +0 -1
  421. package/dist/chunks/sessionObserver-B73s6yu8.js +0 -1
  422. package/dist/chunks/sessionStorage-BHi7PKs-.js +0 -1
  423. package/dist/chunks/setup-BJSk1czd.js +0 -3
  424. package/dist/chunks/sink-i8NmYch9.js +0 -1
  425. package/dist/chunks/sinks-3w0mLszx.js +0 -1
  426. package/dist/chunks/skillChangeDetector-1aFn40GC.js +0 -1
  427. package/dist/chunks/skillLearning-Bddmbx8E.js +0 -1
  428. package/dist/chunks/skillLearning-C-uI_jZB.js +0 -1
  429. package/dist/chunks/statusNoticeHelpers-JNibsI_v.js +0 -1
  430. package/dist/chunks/teamHelpers-D41zdxpl.js +0 -1
  431. package/dist/chunks/teammateModeSnapshot-q-bARbLL.js +0 -1
  432. package/dist/chunks/teleport-ClxQigSQ.js +0 -1
  433. package/dist/chunks/thinkback-BE8NNmAo.js +0 -1
  434. package/dist/chunks/thinkback-play-D2_n_aoQ.js +0 -1
  435. package/dist/chunks/toolPool-BLshLuvo.js +0 -1
  436. package/dist/chunks/toolPool-HYKCHxDA.js +0 -1
  437. package/dist/chunks/undercover-B4sdXe12.js +0 -1
  438. package/dist/chunks/upgrade-BiWGhm2d.js +0 -1
  439. package/dist/chunks/useSettingsErrors-DUe4k_RK.js +0 -1
  440. package/dist/chunks/utils-DP3EtI6F.js +0 -1
  441. package/dist/chunks/voiceModeEnabled-B1ARFTcz.js +0 -1
  442. package/dist/chunks/voiceStreamSTT-CONK4g-B.js +0 -1
  443. package/dist/chunks/windowsPaths-BeDSnJ23.js +0 -2
  444. package/dist/chunks/windowsPaths-ttHiMKpR.js +0 -1
  445. package/dist/chunks/worktree-CFNQKVGn.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as e,n as t,o as n,r}from"./chunk-DR8-3Aex.js";import{a as i,i as a,n as o,o as s,r as c,t as l}from"./isObject-DaxDnPKm.js";import{g as u,h as d,l as f,n as p,t as m,u as ee}from"./memoize-DNnuA2aU.js";import{a as te,c as ne,f as re,l as ie,n as ae,s as h,t as oe,u as g}from"./envUtils-BWeoiL4Y.js";import{t as se}from"./client-_sjL0I7A.js";import{n as ce,t as _}from"./defineProperty-80gRi2ZW.js";import{_ as le,d as ue,h as de,n as fe,o as pe,r as me,s as he}from"./esm-CJlBxjtx.js";import{B as ge,D as _e,Q as ve,Tt as ye,V as be,Z as xe,_ as Se,a as Ce,c as we,d as Te,j as Ee,jt as De,o as Oe,t as ke,u as Ae,x as je,z as Me}from"./esm-DcdOXSzi.js";import{i as Ne,r as Pe,t as Fe}from"./esm-BGQPWnJy.js";import{n as v,t as Ie}from"./axios-DhfaybwJ.js";import{Cn as y,En as Le,In as Re,Ln as b,Mn as x,Mr as ze,St as Be,Tt as S,Xn as Ve,Yn as C,kn as He,kt as w,ln as Ue,un as T,vt as E,wn as D,zt as We}from"./schemas-BGAvj1T4.js";import{a as Ge,n as Ke,o as qe,t as Je}from"./v4-f1i_CNUT.js";import{Bn as Ye,In as Xe,Ln as Ze,zn as Qe}from"./src-Di342QoJ.js";import{i as $e,r as et}from"./isSymbol-Dp3irZaY.js";import{$i as tt,$r as nt,Bn as rt,Br as it,Ct as at,Dn as ot,E as st,Ei as ct,Et as lt,F as ut,Fi as dt,Fr as ft,Gi as pt,H as mt,Hi as ht,Hr as gt,I as _t,Ii as vt,Ji as yt,Jr as bt,K as xt,Ki as St,Kr as Ct,Lr as wt,Mi as Tt,Ni as Et,Pi as Dt,Pr as Ot,Qr as kt,Rr as At,Ti as jt,U as Mt,Ur as Nt,Vi as Pt,Vr as Ft,Wr as It,Xi as Lt,Xr as Rt,Yi as zt,Yr as Bt,Zr as Vt,_i as Ht,ai as Ut,ar as Wt,at as Gt,b as Kt,ci as qt,cn as O,cr as Jt,di as Yt,ea as Xt,ei as Zt,en as Qt,et as $t,fi as en,gi as tn,hi as nn,hn as rn,ia as an,ii as on,ji as sn,na as cn,ni as ln,oi as un,ot as dn,qi as fn,qr as pn,ra as mn,ri as hn,rt as gn,si as _n,st as vn,ta as yn,ti as bn,ut as xn,vi as Sn,vt as Cn,x as wn,zr as Tn}from"./state-sIHsFpDu.js";import{A as En,B as Dn,Ct as On,D as kn,E as An,G as jn,J as Mn,K as Nn,N as Pn,O as k,Q as Fn,St as In,T as Ln,Tt as Rn,U as zn,Z as Bn,_ as Vn,_t as Hn,at as Un,bt as Wn,ct as Gn,d as Kn,dt as qn,f as Jn,ft as Yn,gt as Xn,h as A,ht as Zn,it as Qn,l as j,lt as $n,mt as er,nt as tr,ot as nr,p as M,pt as rr,rt as ir,st as ar,tt as or,ut as sr,vt as cr,wt as lr,x as ur,xt as dr,yt as fr,z as pr}from"./debug-otxXY3j-.js";import{a as mr,n as hr,r as N}from"./analytics-DqMQntaB.js";import{n as gr,t as _r}from"./cwd--iizewsn.js";import{t as vr}from"./sdk-DEtgRZvI.js";import{F as yr,P as br,h as xr,n as Sr,t as Cr,v as wr}from"./git-C0IuvuIy.js";import{l as P,n as Tr,r as Er,s as Dr,t as Or,u as kr}from"./oauth-CdZEzMww.js";import{n as Ar,t as jr}from"./bundledMode-kSQejuY4.js";import{n as Mr,r as Nr,t as Pr}from"./execa-CGue6Z3n.js";import{a as Fr,i as Ir,n as Lr,r as F,t as Rr}from"./env-C2A9gV_G.js";import{d as zr,f as Br,o as Vr,p as Hr,s as I,u as Ur}from"./log-DSV4Ht5l.js";import{a as Wr,i as Gr,n as Kr,o as qr,r as Jr}from"./platform-mh9ypxS8.js";import{r as Yr,t as Xr}from"./memoize-DJ1XCN-z.js";import{m as Zr}from"./sessionStoragePortable-CJUZrbIq.js";import{a as Qr,i as $r,n as ei}from"./path-BE28AJwZ.js";import{a as ti,i as ni,n as ri,r as ii,t as ai}from"./execFileNoThrow-azCkYhmF.js";import{a as oi,f as si,l as ci,p as li,r as ui,s as di,u as fi}from"./types-KeqFPzY5.js";import{C as pi,D as mi,E as hi,T as gi,a as _i,b as vi,f as yi,i as bi,l as xi,t as Si,x as Ci}from"./teammate-CbskW5G9.js";import{i as wi,n as Ti}from"./startupProfiler-CBcN1Chw.js";import{n as L,t as Ei}from"./lazySchema-B0QShMaQ.js";import{i as Di,r as Oi,t as ki}from"./permissions-BsVJvaEe.js";import{n as Ai,t as ji}from"./normalization-BLfP0Kqt.js";import{l as Mi,n as Ni,o as Pi}from"./stringUtils-KZoO4GUd.js";import{a as Fi,o as Ii,u as Li}from"./proxy-CF7ZDxaW.js";import{n as Ri,t as zi}from"./sleep-C6koP5Ka.js";import{i as Bi,t as Vi}from"./genericProcessUtils-tJxf3yqB.js";import{i as Hi,o as Ui}from"./common-NEOWMwtB.js";import{homedir as Wi,userInfo as Gi}from"os";import*as Ki from"path";import{basename as qi,dirname as Ji,extname as Yi,isAbsolute as Xi,join as R,normalize as Zi,relative as Qi,resolve as $i,sep as ea}from"path";import{chmodSync as ta,existsSync as na,mkdirSync as ra,readFileSync as ia,unwatchFile as aa,watchFile as oa,writeFileSync as sa}from"fs";import{createHash as ca,randomBytes as la,randomUUID as ua}from"crypto";import{appendFile as da,mkdir as fa,readFile as pa,readdir as ma,realpath as ha,stat as ga,unlink as _a,writeFile as va}from"fs/promises";import{exec as ya,execFile as ba}from"child_process";import{AsyncLocalStorage as xa}from"async_hooks";function Sa(){return Ga}function Ca(e){let t=2166136261,n=e.length;for(let r=0;r<n;r++)t^=e.charCodeAt(r),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}function wa(e,t,n){return n===2?Ca(Ca(e+t)+``)%1e4/1e4:n===1?Ca(t+e)%1e3/1e3:null}function Ta(e){return e<=0?[]:Array(e).fill(1/e)}function Ea(e,t){return e>=t[0]&&e<t[1]}function Da(e,t){let n=wa(`__`+t[0],e,1);return n===null?!1:n>=t[1]&&n<t[2]}function Oa(e,t){for(let n=0;n<t.length;n++)if(Ea(e,t[n]))return n;return-1}function ka(e){try{let t=e.replace(/([^\\])\//g,`$1\\/`);return new RegExp(t)}catch(e){console.error(e);return}}function Aa(e,t){if(!t.length)return!1;let n=!1,r=!1;for(let i=0;i<t.length;i++){let a=Na(e,t[i].type,t[i].pattern);if(t[i].include===!1){if(a)return!1}else n=!0,a&&(r=!0)}return r||!n}function ja(e,t,n){try{let r=t.replace(/[*.+?^${}()|[\]\\]/g,`\\$&`).replace(/_____/g,`.*`);return n&&(r=`\\/?`+r.replace(/(^\/|\/$)/g,``)+`\\/?`),RegExp(`^`+r+`$`,`i`).test(e)}catch{return!1}}function Ma(e,t){try{let n=new URL(t.replace(/^([^:/?]*)\./i,`https://$1.`).replace(/\*/g,`_____`),`https://_____`),r=[[e.host,n.host,!1],[e.pathname,n.pathname,!0]];return n.hash&&r.push([e.hash,n.hash,!1]),n.searchParams.forEach((t,n)=>{r.push([e.searchParams.get(n)||``,t,!1])}),!r.some(e=>!ja(e[0],e[1],e[2]))}catch{return!1}}function Na(e,t,n){try{let r=new URL(e,`https://_`);if(t===`regex`){let e=ka(n);return e?e.test(r.href)||e.test(r.href.substring(r.origin.length)):!1}else if(t===`simple`)return Ma(r,n);return!1}catch{return!1}}function Pa(e,t,n){t=t===void 0?1:t,t<0?t=0:t>1&&(t=1);let r=Ta(e);n=n||r,n.length!==e&&(n=r);let i=n.reduce((e,t)=>t+e,0);(i<.99||i>1.01)&&(n=r);let a=0;return n.map(e=>{let n=a;return a+=e,[n,n+t*e]})}function Fa(e,t,n){if(!t)return null;let r=t.split(`?`)[1];if(!r)return null;let i=r.replace(/#.*/,``).split(`&`).map(e=>e.split(`=`,2)).filter(([t])=>t===e).map(([,e])=>parseInt(e));return i.length>0&&i[0]>=0&&i[0]<n?i[0]:null}function Ia(e){try{return e()}catch(e){return console.error(e),!1}}async function La(e,t,n){if(t=t||``,n=n||globalThis.crypto&&globalThis.crypto.subtle||Ga.SubtleCrypto,!n)throw Error(`No SubtleCrypto implementation found`);try{let r=await n.importKey(`raw`,Ka(t),{name:`AES-CBC`,length:128},!0,[`encrypt`,`decrypt`]),[i,a]=e.split(`.`),o=await n.decrypt({name:`AES-CBC`,iv:Ka(i)},r,Ka(a));return new TextDecoder().decode(o)}catch{throw Error(`Failed to decrypt`)}}function Ra(e){return typeof e==`string`?e:JSON.stringify(e)}function za(e){typeof e==`number`&&(e+=``),(!e||typeof e!=`string`)&&(e=`0`);let t=e.replace(/(^v|\+.*$)/g,``).split(/[-.]/);return t.length===3&&t.push(`~`),t.map(e=>e.match(/^[0-9]+$/)?e.padStart(5,` `):e).join(`-`)}function Ba(){let e;try{e=`1.6.5`}catch{e=``}return e}function Va(e,t){let n,r;try{n=new URL(e),r=new URL(t)}catch(e){return console.error(`Unable to merge query strings: ${e}`),t}return n.searchParams.forEach((e,t)=>{r.searchParams.has(t)||r.searchParams.set(t,e)}),r.toString()}function Ha(e){return typeof e==`object`&&!!e}function Ua(e){return e.urlPatterns&&e.variations.some(e=>Ha(e)&&`urlRedirect`in e)?`redirect`:e.variations.some(e=>Ha(e)&&(e.domMutations||`js`in e||`css`in e))?`visual`:`unknown`}async function Wa(e,t){return new Promise(n=>{let r=!1,i,a=e=>{r||(r=!0,i&&clearTimeout(i),n(e||null))};t&&(i=setTimeout(()=>a(),t)),e.then(e=>a(e)).catch(()=>a())})}var Ga,Ka,qa=t((()=>{Ga={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource},Ka=e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0))}));function Ja(e){Object.assign(z,e),z.backgroundSync||ho()}async function Ya({instance:e,timeout:t,skipCache:n,allowStale:r,backgroundSync:i}){return i||(z.backgroundSync=!1),to({instance:e,allowStale:r,timeout:t,skipCache:n})}function Xa(e){let t=no(e),n=yo.get(t)||new Set;n.add(e),yo.set(t,n)}function Za(e){yo.forEach(t=>t.delete(e))}function Qa(){Co.forEach(e=>{e&&(e.state=`idle`,fo(e))})}function $a(){Co.forEach(e=>{e&&e.state===`idle`&&po(e)})}async function eo(){try{if(!_o.localStorage)return;await _o.localStorage.setItem(z.cacheKey,JSON.stringify(Array.from(xo.entries())))}catch{}}async function to({instance:e,allowStale:t,timeout:n,skipCache:r}){let i=no(e),a=ro(e),o=new Date,s=new Date(o.getTime()-z.maxAge+z.staleTTL);await io();let c=!z.disableCache&&!r?xo.get(a):void 0;return c&&(t||c.staleAt>o)&&c.staleAt>s?(c.sse&&wo.add(i),c.staleAt<o?co(e):lo(e),{data:c.data,success:!0,source:`cache`}):await Wa(co(e),n)||{data:null,success:!1,source:`timeout`,error:Error(`Timeout`)}}function no(e){let[t,n]=e.getApiInfo();return`${t}||${n}`}function ro(e){let t=no(e);if(!(`isRemoteEval`in e)||!e.isRemoteEval())return t;let n=e.getAttributes(),r=e.getCacheKeyAttributes()||Object.keys(e.getAttributes()),i={};r.forEach(e=>{i[e]=n[e]});let a=e.getForcedVariations(),o=e.getUrl();return`${t}||${JSON.stringify({ca:i,fv:a,url:o})}`}async function io(){if(!bo){bo=!0;try{if(_o.localStorage){let e=await _o.localStorage.getItem(z.cacheKey);if(!z.disableCache&&e){let t=JSON.parse(e);t&&Array.isArray(t)&&t.forEach(([e,t])=>{xo.set(e,{...t,staleAt:new Date(t.staleAt)})}),ao()}}}catch{}if(!z.disableIdleStreams){let e=vo.startIdleListener();e&&(vo.stopIdleListener=e)}}}function ao(){let e=Array.from(xo.entries()).map(([e,t])=>({key:e,staleAt:t.staleAt.getTime()})).sort((e,t)=>e.staleAt-t.staleAt),t=Math.min(Math.max(0,xo.size-z.maxEntries),xo.size);for(let n=0;n<t;n++)xo.delete(e[n].key)}function oo(e,t,n){let r=n.dateUpdated||``,i=new Date(Date.now()+z.staleTTL),a=z.disableCache?void 0:xo.get(t);if(a&&r&&a.version===r){a.staleAt=i,eo();return}z.disableCache||(xo.set(t,{data:n,version:r,staleAt:i,sse:wo.has(e)}),ao()),eo();let o=yo.get(e);o&&o.forEach(e=>so(e,n))}async function so(e,t){await e.setPayload(t||e.getPayload())}async function co(e){let{apiHost:t,apiRequestHeaders:n}=e.getApiHosts(),r=e.getClientKey(),i=`isRemoteEval`in e&&e.isRemoteEval(),a=no(e),o=ro(e),s=So.get(o);return s||(s=(i?vo.fetchRemoteEvalCall({host:t,clientKey:r,payload:{attributes:e.getAttributes(),forcedVariations:e.getForcedVariations(),forcedFeatures:Array.from(e.getForcedFeatures().entries()),url:e.getUrl()},headers:n}):vo.fetchFeaturesCall({host:t,clientKey:r,headers:n})).then(e=>{if(!e.ok)throw Error(`HTTP error: ${e.status}`);return e.headers.get(`x-sse-support`)===`enabled`&&wo.add(a),e.json()}).then(t=>(oo(a,o,t),lo(e),So.delete(o),{data:t,success:!0,source:`network`})).catch(e=>(So.delete(o),{data:null,source:`error`,success:!1,error:e})),So.set(o,s)),s}function lo(e,t=!1){let n=no(e),r=ro(e),{streamingHost:i,streamingHostRequestHeaders:a}=e.getApiHosts(),o=e.getClientKey();if(t&&wo.add(n),z.backgroundSync&&wo.has(n)&&_o.EventSource){if(Co.has(n))return;let e={src:null,host:i,clientKey:o,headers:a,cb:t=>{try{if(t.type===`features-updated`){let e=yo.get(n);e&&e.forEach(e=>{co(e)})}else t.type===`features`&&oo(n,r,JSON.parse(t.data));e.errors=0}catch{uo(e)}},errors:0,state:`active`};Co.set(n,e),po(e)}}function uo(e){if(e.state!==`idle`&&(e.errors++,e.errors>3||e.src&&e.src.readyState===2)){let t=3**(e.errors-3)*(1e3+Math.random()*1e3);fo(e),setTimeout(()=>{[`idle`,`active`].includes(e.state)||po(e)},Math.min(t,3e5))}}function fo(e){e.src&&(e.src.onopen=null,e.src.onerror=null,e.src.close(),e.src=null,e.state===`active`&&(e.state=`disabled`))}function po(e){e.src=vo.eventSourceCall({host:e.host,clientKey:e.clientKey,headers:e.headers}),e.state=`active`,e.src.addEventListener(`features`,e.cb),e.src.addEventListener(`features-updated`,e.cb),e.src.onerror=()=>uo(e),e.src.onopen=()=>{e.errors=0}}function mo(e,t){fo(e),Co.delete(t)}function ho(){wo.clear(),Co.forEach(mo),yo.clear(),vo.stopIdleListener()}function go(e,t){if(t.streaming){if(!e.getClientKey())throw Error(`Must specify clientKey to enable streaming`);t.payload&&lo(e,!0),Xa(e)}}var z,_o,vo,yo,bo,xo,So,Co,wo,To=t((()=>{qa(),z={staleTTL:1e3*60,maxAge:1e3*60*60*4,cacheKey:`gbFeaturesCache`,backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},_o=Sa(),vo={fetchFeaturesCall:({host:e,clientKey:t,headers:n})=>_o.fetch(`${e}/api/features/${t}`,{headers:n}),fetchRemoteEvalCall:({host:e,clientKey:t,payload:n,headers:r})=>{let i={method:`POST`,headers:{"Content-Type":`application/json`,...r},body:JSON.stringify(n)};return _o.fetch(`${e}/api/eval/${t}`,i)},eventSourceCall:({host:e,clientKey:t,headers:n})=>n?new _o.EventSource(`${e}/sub/${t}`,{headers:n}):new _o.EventSource(`${e}/sub/${t}`),startIdleListener:()=>{let e;if(!(typeof window<`u`&&typeof document<`u`))return;let t=()=>{document.visibilityState===`visible`?(window.clearTimeout(e),$a()):document.visibilityState===`hidden`&&(e=window.setTimeout(Qa,z.idleStreamInterval))};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(_o.localStorage=globalThis.localStorage)}catch{}yo=new Map,bo=!1,xo=new Map,So=new Map,Co=new Map,wo=new Set}));function Eo(e){return e===`html`?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[e]}}function Do(e){var t=is.get(e);return t||(t={element:e,attributes:{}},is.set(e,t)),t}function Oo(e,t,n,r,i){var a=n(e),o={isDirty:!1,originalValue:a,virtualValue:a,mutations:[],el:e,_positionTimeout:null,observer:new MutationObserver(function(){if(!(t===`position`&&o._positionTimeout)){t===`position`&&(o._positionTimeout=setTimeout(function(){o._positionTimeout=null},1e3));var r=n(e);t===`position`&&r.parentNode===o.virtualValue.parentNode&&r.insertBeforeNode===o.virtualValue.insertBeforeNode||r!==o.virtualValue&&(o.originalValue=r,i(o))}}),mutationRunner:i,setValue:r,getCurrentValue:n};return t===`position`&&e.parentNode?o.observer.observe(e.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(e,Eo(t)),o}function ko(e,t){var n=t.getCurrentValue(t.el);t.virtualValue=e,e&&typeof e!=`string`?(!n||e.parentNode!==n.parentNode||e.insertBeforeNode!==n.insertBeforeNode)&&(t.isDirty=!0,Uo()):e!==n&&(t.isDirty=!0,Uo())}function Ao(e){var t=e.originalValue;e.mutations.forEach(function(e){return t=e.mutate(t)}),ko(Bo(t),e)}function jo(e){var t=new Set(e.originalValue.split(/\s+/).filter(Boolean));e.mutations.forEach(function(e){return e.mutate(t)}),ko(Array.from(t).filter(Boolean).join(` `),e)}function Mo(e){var t=e.originalValue;e.mutations.forEach(function(e){return t=e.mutate(t)}),ko(t,e)}function No(e){var t=e.parentSelector,n=e.insertBeforeSelector,r=document.querySelector(t);if(!r)return null;var i=n?document.querySelector(n):null;return n&&!i?null:{parentNode:r,insertBeforeNode:i}}function Po(e){var t=e.originalValue;e.mutations.forEach(function(e){t=No(e.mutate())||t}),ko(t,e)}function Fo(e){var t=Do(e);return t.html||(t.html=Oo(e,`html`,os,ss,Ao)),t.html}function Io(e){var t=Do(e);return t.position||(t.position=Oo(e,`position`,cs,ls,Po)),t.position}function Lo(e){var t=Do(e);return t.classes||(t.classes=Oo(e,`class`,ds,us,jo)),t.classes}function Ro(e,t){var n=Do(e);return n.attributes[t]||(n.attributes[t]=Oo(e,t,fs(t),ps(t),Mo)),n.attributes[t]}function zo(e,t){var n=is.get(e);if(n)if(t===`html`){var r,i;(r=n.html)==null||(i=r.observer)==null||i.disconnect(),delete n.html}else if(t===`class`){var a,o;(a=n.classes)==null||(o=a.observer)==null||o.disconnect(),delete n.classes}else if(t===`position`){var s,c;(s=n.position)==null||(c=s.observer)==null||c.disconnect(),delete n.position}else{var l,u,d;(l=n.attributes)==null||(u=l[t])==null||(d=u.observer)==null||d.disconnect(),delete n.attributes[t]}}function Bo(e){return ms||(ms=document.createElement(`div`)),ms.innerHTML=e,ms.innerHTML}function Vo(e,t,n){if(n.isDirty){n.isDirty=!1;var r=n.virtualValue;n.mutations.length||zo(e,t),n.setValue(e,r)}}function Ho(e,t){e.html&&Vo(t,`html`,e.html),e.classes&&Vo(t,`class`,e.classes),e.position&&Vo(t,`position`,e.position),Object.keys(e.attributes).forEach(function(n){Vo(t,n,e.attributes[n])})}function Uo(){is.forEach(Ho)}function Wo(e,t){var n=null;e.kind===`html`?n=Fo(t):e.kind===`class`?n=Lo(t):e.kind===`attribute`?n=Ro(t,e.attribute):e.kind===`position`&&(n=Io(t)),n&&(n.mutations.push(e),n.mutationRunner(n))}function Go(e,t){var n=null;if(e.kind===`html`?n=Fo(t):e.kind===`class`?n=Lo(t):e.kind===`attribute`?n=Ro(t,e.attribute):e.kind===`position`&&(n=Io(t)),n){var r=n.mutations.indexOf(e);r!==-1&&n.mutations.splice(r,1),n.mutationRunner(n)}}function Ko(e){if(!(e.kind===`position`&&e.elements.size===1)){var t=new Set(e.elements);document.querySelectorAll(e.selector).forEach(function(n){t.has(n)||(e.elements.add(n),Wo(e,n))})}}function qo(e){e.elements.forEach(function(t){return Go(e,t)}),e.elements.clear(),as.delete(e)}function Jo(){as.forEach(Ko)}function Yo(){typeof document>`u`||(hs||(hs=new MutationObserver(function(){Jo()})),Jo(),hs.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}function Xo(e){return typeof document>`u`?rs:(as.add(e),Ko(e),{revert:function(){qo(e)}})}function Zo(e,t){return Xo({kind:`html`,elements:new Set,mutate:t,selector:e})}function Qo(e,t){return Xo({kind:`position`,elements:new Set,mutate:t,selector:e})}function $o(e,t){return Xo({kind:`class`,elements:new Set,mutate:t,selector:e})}function es(e,t,n){return ns.test(t)?t===`class`||t===`className`?$o(e,function(e){var t=n(Array.from(e).join(` `));e.clear(),t&&t.split(/\s+/g).filter(Boolean).forEach(function(t){return e.add(t)})}):Xo({kind:`attribute`,attribute:t,elements:new Set,mutate:n,selector:e}):rs}function ts(e){var t=e.selector,n=e.action,r=e.value,i=e.attribute,a=e.parentSelector,o=e.insertBeforeSelector;if(i===`html`){if(n===`append`)return Zo(t,function(e){return e+(r??``)});if(n===`set`)return Zo(t,function(){return r??``})}else if(i===`class`){if(n===`append`)return $o(t,function(e){r&&e.add(r)});if(n===`remove`)return $o(t,function(e){r&&e.delete(r)});if(n===`set`)return $o(t,function(e){e.clear(),r&&e.add(r)})}else if(i===`position`){if(n===`set`&&a)return Qo(t,function(){return{insertBeforeSelector:o,parentSelector:a}})}else if(n===`append`)return es(t,i,function(e){return e===null?r??``:e+(r??``)});else if(n===`set`)return es(t,i,function(){return r??``});else if(n===`remove`)return es(t,i,function(){return null});return rs}var ns,rs,is,as,os,ss,cs,ls,us,ds,fs,ps,ms,hs,gs,_s=t((()=>{ns=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,rs={revert:function(){}},is=new Map,as=new Set,os=function(e){return e.innerHTML},ss=function(e,t){return e.innerHTML=t},cs=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},ls=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)},us=function(e,t){return t?e.className=t:e.removeAttribute(`class`)},ds=function(e){return e.className},fs=function(e){return function(t){return t.getAttribute(e)??null}},ps=function(e){return function(t,n){return n===null?t.removeAttribute(e):t.setAttribute(e,n)}},Yo(),gs={html:Zo,classes:$o,attribute:es,position:Qo,declarative:ts}}));function vs(e,t,n){n=n||{};for(let[r,i]of Object.entries(t))switch(r){case`$or`:if(!Os(e,i,n))return!1;break;case`$nor`:if(Os(e,i,n))return!1;break;case`$and`:if(!ks(e,i,n))return!1;break;case`$not`:if(vs(e,i,n))return!1;break;default:if(!xs(i,ys(e,r),n))return!1}return!0}function ys(e,t){let n=t.split(`.`),r=e;for(let e=0;e<n.length;e++)if(r&&typeof r==`object`&&n[e]in r)r=r[n[e]];else return null;return r}function bs(e,t=!1){let n=`${e}${t?`/i`:``}`;return As[n]||(As[n]=new RegExp(e.replace(/([^\\])\//g,`$1\\/`),t?`i`:void 0)),As[n]}function xs(e,t,n,r=!1){if(typeof e==`string`)return r?String(t).toLowerCase()===e.toLowerCase():t+``===e;if(typeof e==`number`)return t*1===e;if(typeof e==`boolean`)return t!==null&&!!t===e;if(e===null)return t===null;if(Array.isArray(e)||!Ss(e))return JSON.stringify(t)===JSON.stringify(e);for(let r in e)if(!Ds(r,t,e[r],n))return!1;return!0}function Ss(e){let t=Object.keys(e);return t.length>0&&t.filter(e=>e[0]===`$`).length===t.length}function Cs(e){if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=typeof e;return[`string`,`number`,`boolean`,`object`,`undefined`].includes(t)?t:`unknown`}function ws(e,t,n){if(!Array.isArray(e))return!1;let r=Ss(t)?e=>xs(t,e,n):e=>vs(e,t,n);for(let t=0;t<e.length;t++)if(e[t]&&r(e[t]))return!0;return!1}function Ts(e,t,n=!1){if(n){let n=e=>typeof e==`string`?e.toLowerCase():e;return Array.isArray(e)?e.some(e=>t.some(t=>n(e)===n(t))):t.some(t=>n(e)===n(t))}return Array.isArray(e)?e.some(e=>t.includes(e)):t.includes(e)}function Es(e,t,n,r=!1){if(!Array.isArray(e))return!1;for(let i=0;i<t.length;i++){let a=!1;for(let o=0;o<e.length;o++)if(xs(t[i],e[o],n,r)){a=!0;break}if(!a)return!1}return!0}function Ds(e,t,n,r){switch(e){case`$veq`:return za(t)===za(n);case`$vne`:return za(t)!==za(n);case`$vgt`:return za(t)>za(n);case`$vgte`:return za(t)>=za(n);case`$vlt`:return za(t)<za(n);case`$vlte`:return za(t)<=za(n);case`$eq`:return t===n;case`$ne`:return t!==n;case`$lt`:return t<n;case`$lte`:return t<=n;case`$gt`:return t>n;case`$gte`:return t>=n;case`$exists`:return n?t!=null:t==null;case`$in`:return Array.isArray(n)?Ts(t,n):!1;case`$ini`:return Array.isArray(n)?Ts(t,n,!0):!1;case`$inGroup`:return Ts(t,r[n]||[]);case`$notInGroup`:return!Ts(t,r[n]||[]);case`$nin`:return Array.isArray(n)?!Ts(t,n):!1;case`$nini`:return Array.isArray(n)?!Ts(t,n,!0):!1;case`$not`:return!xs(n,t,r);case`$size`:return Array.isArray(t)?xs(n,t.length,r):!1;case`$elemMatch`:return ws(t,n,r);case`$all`:return Array.isArray(n)?Es(t,n,r):!1;case`$alli`:return Array.isArray(n)?Es(t,n,r,!0):!1;case`$regex`:try{return bs(n).test(t)}catch{return!1}case`$regexi`:try{return bs(n,!0).test(t)}catch{return!1}case`$type`:return Cs(t)===n;default:return console.error(`Unknown operator: `+e),!1}}function Os(e,t,n){if(!t.length)return!0;for(let r=0;r<t.length;r++)if(vs(e,t[r],n))return!0;return!1}function ks(e,t,n){for(let r=0;r<t.length;r++)if(!vs(e,t[r],n))return!1;return!0}var As,js=t((()=>{qa(),As={}}));function Ms(e){let t=new Map;return e.global.forcedFeatureValues&&e.global.forcedFeatureValues.forEach((e,n)=>t.set(n,e)),e.user.forcedFeatureValues&&e.user.forcedFeatureValues.forEach((e,n)=>t.set(n,e)),t}function Ns(e){return e.global.forcedVariations&&e.user.forcedVariations?{...e.global.forcedVariations,...e.user.forcedVariations}:e.global.forcedVariations?e.global.forcedVariations:e.user.forcedVariations?e.user.forcedVariations:{}}async function Ps(e){try{await e()}catch{}}function Fs(e,t,n){if(e.user.trackedExperiments){let r=ic(t,n);if(e.user.trackedExperiments.has(r))return[];e.user.trackedExperiments.add(r)}e.user.enableDevMode&&e.user.devLogs&&e.user.devLogs.push({experiment:t,result:n,timestamp:Date.now().toString(),logType:`experiment`});let r=[];if(e.global.trackingCallback){let i=e.global.trackingCallback;r.push(Ps(()=>i(t,n,e.user)))}if(e.user.trackingCallback){let i=e.user.trackingCallback;r.push(Ps(()=>i(t,n)))}if(e.global.eventLogger){let i=e.global.eventLogger;r.push(Ps(()=>i(oc,{experimentId:t.key,variationId:n.key,hashAttribute:n.hashAttribute,hashValue:n.hashValue},e.user)))}return r}function Is(e,t,n){if(e.user.trackedFeatureUsage){let r=JSON.stringify(n.value);if(e.user.trackedFeatureUsage[t]===r)return;e.user.trackedFeatureUsage[t]=r,e.user.enableDevMode&&e.user.devLogs&&e.user.devLogs.push({featureKey:t,result:n,timestamp:Date.now().toString(),logType:`feature`})}if(e.global.onFeatureUsage){let r=e.global.onFeatureUsage;Ps(()=>r(t,n,e.user))}if(e.user.onFeatureUsage){let r=e.user.onFeatureUsage;Ps(()=>r(t,n))}if(e.global.eventLogger){let r=e.global.eventLogger;Ps(()=>r(ac,{feature:t,source:n.source,value:n.value,ruleId:n.source===`defaultValue`?`$default`:n.ruleId||``,variationId:n.experimentResult?n.experimentResult.key:``},e.user))}}function Ls(e,t){if(t.stack.evaluatedFeatures.has(e))return zs(t,e,null,`cyclicPrerequisite`);t.stack.evaluatedFeatures.add(e),t.stack.id=e;let n=Ms(t);if(n.has(e))return zs(t,e,n.get(e),`override`);if(!t.global.features||!t.global.features[e])return zs(t,e,null,`unknownFeature`);let r=t.global.features[e];if(r.rules){let n=new Set(t.stack.evaluatedFeatures);rules:for(let i of r.rules){if(i.parentConditions)for(let r of i.parentConditions){t.stack.evaluatedFeatures=new Set(n);let i=Ls(r.id,t);if(i.source===`cyclicPrerequisite`)return zs(t,e,null,`cyclicPrerequisite`);if(!vs({value:i.value},r.condition||{})){if(r.gate)return zs(t,e,null,`prerequisite`);continue rules}}if(i.filters&&Hs(i.filters,t))continue;if(`force`in i){if(i.condition&&!Vs(i.condition,t)||!Us(t,i.seed||e,i.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion))continue;return i.tracks&&i.tracks.forEach(e=>{!Fs(t,e.experiment,e.result).length&&t.global.saveDeferredTrack&&t.global.saveDeferredTrack({experiment:e.experiment,result:e.result})}),zs(t,e,i.force,`force`,i.id)}if(!i.variations)continue;let r={variations:i.variations,key:i.key||e};`coverage`in i&&(r.coverage=i.coverage),i.weights&&(r.weights=i.weights),i.hashAttribute&&(r.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(r.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(r.disableStickyBucketing=i.disableStickyBucketing),i.bucketVersion!==void 0&&(r.bucketVersion=i.bucketVersion),i.minBucketVersion!==void 0&&(r.minBucketVersion=i.minBucketVersion),i.namespace&&(r.namespace=i.namespace),i.meta&&(r.meta=i.meta),i.ranges&&(r.ranges=i.ranges),i.name&&(r.name=i.name),i.phase&&(r.phase=i.phase),i.seed&&(r.seed=i.seed),i.hashVersion&&(r.hashVersion=i.hashVersion),i.filters&&(r.filters=i.filters),i.condition&&(r.condition=i.condition);let{result:a}=Rs(r,e,t);if(t.global.onExperimentEval&&t.global.onExperimentEval(r,a),a.inExperiment&&!a.passthrough)return zs(t,e,a.value,`experiment`,i.id,r,a)}}return zs(t,e,r.defaultValue===void 0?null:r.defaultValue,`defaultValue`)}function Rs(e,t,n){let r=e.key,i=e.variations.length;if(i<2||n.global.enabled===!1||n.user.enabled===!1||(e=Ws(e,n),e.urlPatterns&&!Aa(n.user.url||``,e.urlPatterns)))return{result:B(n,e,-1,!1,t)};let a=Fa(r,n.user.url||``,i);if(a!==null)return{result:B(n,e,a,!1,t)};let o=Ns(n);if(r in o){let i=o[r];return{result:B(n,e,i,!1,t)}}if(e.status===`draft`||e.active===!1)return{result:B(n,e,-1,!1,t)};let{hashAttribute:s,hashValue:c}=Gs(n,e.hashAttribute,n.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!c)return{result:B(n,e,-1,!1,t)};let l=-1,u=!1,d=!1;if(n.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{variation:t,versionIsBlocked:r}=Js({ctx:n,expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta});u=t>=0,l=t,d=!!r}if(!u){if(e.filters){if(Hs(e.filters,n))return{result:B(n,e,-1,!1,t)}}else if(e.namespace&&!Da(c,e.namespace))return{result:B(n,e,-1,!1,t)};if(e.include&&!Ia(e.include)||e.condition&&!Vs(e.condition,n))return{result:B(n,e,-1,!1,t)};if(e.parentConditions){let r=new Set(n.stack.evaluatedFeatures);for(let i of e.parentConditions){n.stack.evaluatedFeatures=new Set(r);let a=Ls(i.id,n);if(a.source===`cyclicPrerequisite`||!vs({value:a.value},i.condition||{}))return{result:B(n,e,-1,!1,t)}}}if(e.groups&&!qs(e.groups,n))return{result:B(n,e,-1,!1,t)}}if(e.url&&!Ks(e.url,n))return{result:B(n,e,-1,!1,t)};let f=wa(e.seed||r,c,e.hashVersion||1);if(f===null)return{result:B(n,e,-1,!1,t)};if(u||(l=Oa(f,e.ranges||Pa(i,e.coverage===void 0?1:e.coverage,e.weights))),d)return{result:B(n,e,-1,!1,t,void 0,!0)};if(l<0)return{result:B(n,e,-1,!1,t)};if(`force`in e)return{result:B(n,e,e.force===void 0?-1:e.force,!1,t)};if(n.global.qaMode||n.user.qaMode||e.status===`stopped`)return{result:B(n,e,-1,!1,t)};let p=B(n,e,l,!0,t,f,u);if(n.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{changed:t,key:r,doc:i}=Qs(n,s,Ra(c),{[Ys(e.key,e.bucketVersion)]:p.key});t&&(n.user.stickyBucketAssignmentDocs=n.user.stickyBucketAssignmentDocs||{},n.user.stickyBucketAssignmentDocs[r]=i,n.user.saveStickyBucketAssignmentDoc(i))}let m=Fs(n,e,p);m.length===0&&n.global.saveDeferredTrack&&n.global.saveDeferredTrack({experiment:e,result:p});let ee=m.length?m.length===1?m[0]:Promise.all(m).then(()=>{}):void 0;return`changeId`in e&&e.changeId&&n.global.recordChangeId&&n.global.recordChangeId(e.changeId),{result:p,trackingCall:ee}}function zs(e,t,n,r,i,a,o){let s={value:n,on:!!n,off:!n,source:r,ruleId:i||``};return a&&(s.experiment=a),o&&(s.experimentResult=o),r!==`override`&&Is(e,t,s),s}function Bs(e){return{...e.user.attributes,...e.user.attributeOverrides}}function Vs(e,t){return vs(Bs(t),e,t.global.savedGroups||{})}function Hs(e,t){return e.some(e=>{let{hashValue:n}=Gs(t,e.attribute);if(!n)return!0;let r=wa(e.seed,n,e.hashVersion||2);return r===null?!0:!e.ranges.some(e=>Ea(r,e))})}function Us(e,t,n,r,i,a,o){if(!i&&a===void 0)return!0;if(!i&&a===0)return!1;let{hashValue:s}=Gs(e,n,r);if(!s)return!1;let c=wa(t,s,o||1);return c===null?!1:i?Ea(c,i):a===void 0?!0:c<=a}function B(e,t,n,r,i,a,o){let s=!0;(n<0||n>=t.variations.length)&&(n=0,s=!1);let{hashAttribute:c,hashValue:l}=Gs(e,t.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0),u=t.meta?t.meta[n]:{},d={key:u.key||``+n,featureId:i,inExperiment:s,hashUsed:r,variationId:n,value:t.variations[n],hashAttribute:c,hashValue:l,stickyBucketUsed:!!o};return u.name&&(d.name=u.name),a!==void 0&&(d.bucket=a),u.passthrough&&(d.passthrough=u.passthrough),d}function Ws(e,t){let n=e.key,r=t.global.overrides;return r&&r[n]&&(e=Object.assign({},e,r[n]),typeof e.url==`string`&&(e.url=ka(e.url))),e}function Gs(e,t,n){let r=t||`id`,i=``,a=Bs(e);return a[r]&&(i=a[r]),!i&&n&&(a[n]&&(i=a[n]),i&&(r=n)),{hashAttribute:r,hashValue:i}}function Ks(e,t){let n=t.user.url;if(!n)return!1;let r=n.replace(/^https?:\/\//,``).replace(/^[^/]*\//,`/`);return!!(e.test(n)||e.test(r))}function qs(e,t){let n=t.global.groups||{};for(let t=0;t<e.length;t++)if(n[e[t]])return!0;return!1}function Js({ctx:e,expKey:t,expBucketVersion:n,expHashAttribute:r,expFallbackAttribute:i,expMinBucketVersion:a,expMeta:o}){n=n||0,a=a||0,r=r||`id`,o=o||[];let s=Ys(t,n),c=Zs(e,r,i);if(a>0){for(let e=0;e<a;e++)if(c[Ys(t,e)]!==void 0)return{variation:-1,versionIsBlocked:!0}}let l=c[s];if(l===void 0)return{variation:-1};let u=o.findIndex(e=>e.key===l);return u<0?{variation:-1}:{variation:u}}function Ys(e,t){return t=t||0,`${e}__${t}`}function Xs(e,t){return`${e}||${t}`}function Zs(e,t,n){if(!e.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:r,hashValue:i}=Gs(e,t),a=Xs(r,Ra(i)),{hashAttribute:o,hashValue:s}=Gs(e,n),c=s?Xs(o,Ra(s)):null,l={};return c&&e.user.stickyBucketAssignmentDocs[c]&&Object.assign(l,e.user.stickyBucketAssignmentDocs[c].assignments||{}),e.user.stickyBucketAssignmentDocs[a]&&Object.assign(l,e.user.stickyBucketAssignmentDocs[a].assignments||{}),l}function Qs(e,t,n,r){let i=Xs(t,n),a=e.user.stickyBucketAssignmentDocs&&e.user.stickyBucketAssignmentDocs[i]&&e.user.stickyBucketAssignmentDocs[i].assignments||{},o={...a,...r},s=JSON.stringify(a)!==JSON.stringify(o);return{key:i,doc:{attributeName:t,attributeValue:n,assignments:o},changed:s}}function $s(e,t){let n=new Set,r=t&&t.features?t.features:e.global.features||{},i=t&&t.experiments?t.experiments:e.global.experiments||[];return Object.keys(r).forEach(e=>{let t=r[e];if(t.rules)for(let e of t.rules)e.variations&&(n.add(e.hashAttribute||`id`),e.fallbackAttribute&&n.add(e.fallbackAttribute))}),i.map(e=>{n.add(e.hashAttribute||`id`),e.fallbackAttribute&&n.add(e.fallbackAttribute)}),Array.from(n)}async function ec(e,t,n){let r=tc(e,n);return t.getAllAssignments(r)}function tc(e,t){let n={};return $s(e,t).forEach(t=>{let{hashValue:r}=Gs(e,t);n[t]=Ra(r)}),n}async function nc(e,t,n){if(e={...e},e.encryptedFeatures){try{e.features=JSON.parse(await La(e.encryptedFeatures,t,n))}catch(e){console.error(e)}delete e.encryptedFeatures}if(e.encryptedExperiments){try{e.experiments=JSON.parse(await La(e.encryptedExperiments,t,n))}catch(e){console.error(e)}delete e.encryptedExperiments}if(e.encryptedSavedGroups){try{e.savedGroups=JSON.parse(await La(e.encryptedSavedGroups,t,n))}catch(e){console.error(e)}delete e.encryptedSavedGroups}return e}function rc(e){let t=e.apiHost||`https://cdn.growthbook.io`;return{apiHost:t.replace(/\/*$/,``),streamingHost:(e.streamingHost||t).replace(/\/*$/,``),apiRequestHeaders:e.apiHostRequestHeaders,streamingHostRequestHeaders:e.streamingHostRequestHeaders}}function ic(e,t){return t.hashAttribute+t.hashValue+e.key+t.variationId}var ac,oc,sc=t((()=>{js(),qa(),ac=`Feature Evaluated`,oc=`Experiment Viewed`})),cc,lc,uc,dc=t((()=>{_s(),qa(),To(),sc(),cc=typeof window<`u`&&typeof document<`u`,lc=Ba(),uc=class{constructor(e){if(e=e||{},this.version=lc,this._options=this.context=e,this._renderer=e.renderer||null,this._trackedExperiments=new Set,this._completedChangeIds=new Set,this._trackedFeatures={},this.debug=!!e.debug,this._subscriptions=new Set,this.ready=!1,this._assigned=new Map,this._activeAutoExperiments=new Map,this._triggeredExpKeys=new Set,this._initialized=!1,this._redirectedUrl=``,this._deferredTrackingCalls=new Map,this._autoExperimentsAllowed=!e.disableExperimentsOnLoad,this._destroyCallbacks=[],this.logs=[],this.log=this.log.bind(this),this._saveDeferredTrack=this._saveDeferredTrack.bind(this),this._onExperimentEval=this._onExperimentEval.bind(this),this._fireSubscriptions=this._fireSubscriptions.bind(this),this._recordChangedId=this._recordChangedId.bind(this),e.remoteEval){if(e.decryptionKey)throw Error(`Encryption is not available for remoteEval`);if(!e.clientKey)throw Error(`Missing clientKey`);let t=!1;try{t=!!new URL(e.apiHost||``).hostname.match(/growthbook\.io$/i)}catch{}if(t)throw Error(`Cannot use remoteEval on GrowthBook Cloud`)}else if(e.cacheKeyAttributes)throw Error(`cacheKeyAttributes are only used for remoteEval`);if(e.stickyBucketService){let t=e.stickyBucketService;this._saveStickyBucketAssignmentDoc=e=>t.saveAssignments(e)}if(e.plugins)for(let t of e.plugins)t(this);if(e.features&&(this.ready=!0),cc&&e.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event(`gbloaded`))),e.experiments&&(this.ready=!0,this._updateAllAutoExperiments()),this._options.stickyBucketService&&this._options.stickyBucketAssignmentDocs)for(let e in this._options.stickyBucketAssignmentDocs){let t=this._options.stickyBucketAssignmentDocs[e];t&&this._options.stickyBucketService.saveAssignments(t).catch(()=>{})}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(e){this._payload=e;let t=await nc(e,this._options.decryptionKey);this._decryptedPayload=t,await this.refreshStickyBuckets(t),t.features&&(this._options.features=t.features),t.savedGroups&&(this._options.savedGroups=t.savedGroups),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,this._render()}initSync(e){this._initialized=!0;let t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw Error(`initSync does not support encrypted payloads`);return this._options.stickyBucketService&&!this._options.stickyBucketAssignmentDocs&&(this._options.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this._options.stickyBucketService,t)),this._payload=t,this._decryptedPayload=t,t.features&&(this._options.features=t.features),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,go(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&Ja(e.cacheSettings),e.payload)return await this.setPayload(e.payload),go(this,e),{success:!0,source:`init`};{let{data:t,...n}=await this._refresh({...e,allowStale:!0});return go(this,e),await this.setPayload(t||{}),n}}async loadFeatures(e){e=e||{},await this.init({skipCache:e.skipCache,timeout:e.timeout,streaming:(this._options.backgroundSync??!0)&&(e.autoRefresh||this._options.subscribeToChanges)})}async refreshFeatures(e){let t=await this._refresh({...e||{},allowStale:!1});t.data&&await this.setPayload(t.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return rc(this._options)}getClientKey(){return this._options.clientKey||``}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}isRemoteEval(){return this._options.remoteEval||!1}getCacheKeyAttributes(){return this._options.cacheKeyAttributes}async _refresh({timeout:e,skipCache:t,allowStale:n,streaming:r}){if(!this._options.clientKey)throw Error(`Missing clientKey`);return Ya({instance:this,timeout:e,skipCache:t||this._options.disableCache,allowStale:n,backgroundSync:r??this._options.backgroundSync??!0})}_render(){if(this._renderer)try{this._renderer()}catch(e){console.error(`Failed to render`,e)}}setFeatures(e){this._options.features=e,this.ready=!0,this._render()}async setEncryptedFeatures(e,t,n){let r=await La(e,t||this._options.decryptionKey,n);this.setFeatures(JSON.parse(r))}setExperiments(e){this._options.experiments=e,this.ready=!0,this._updateAllAutoExperiments()}async setEncryptedExperiments(e,t,n){let r=await La(e,t||this._options.decryptionKey,n);this.setExperiments(JSON.parse(r))}async setAttributes(e){if(this._options.attributes=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async updateAttributes(e){return this.setAttributes({...this._options.attributes,...e})}async setAttributeOverrides(e){if(this._options.attributeOverrides=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async setForcedVariations(e){if(this._options.forcedVariations=e||{},this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}setForcedFeatures(e){this._options.forcedFeatureValues=e,this._render()}async setURL(e){if(e!==this._options.url){if(this._options.url=e,this._redirectedUrl=``,this._options.remoteEval){await this._refreshForRemoteEval(),this._updateAllAutoExperiments(!0);return}this._updateAllAutoExperiments(!0)}}getAttributes(){return{...this._options.attributes,...this._options.attributeOverrides}}getForcedVariations(){return this._options.forcedVariations||{}}getForcedFeatures(){return this._options.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this._options.stickyBucketAssignmentDocs||{}}getUrl(){return this._options.url||``}getFeatures(){return this._options.features||{}}getExperiments(){return this._options.experiments||[]}getCompletedChangeIds(){return Array.from(this._completedChangeIds)}subscribe(e){return this._subscriptions.add(e),()=>{this._subscriptions.delete(e)}}async _refreshForRemoteEval(){if(!this._options.remoteEval||!this._initialized)return;let e=await this._refresh({allowStale:!1});e.data&&await this.setPayload(e.data)}getAllResults(){return new Map(this._assigned)}onDestroy(e){this._destroyCallbacks.push(e)}isDestroyed(){return!!this._destroyed}destroy(e){e=e||{},this._destroyed=!0,this._destroyCallbacks.forEach(e=>{try{e()}catch(e){console.error(e)}}),this._subscriptions.clear(),this._assigned.clear(),this._trackedExperiments.clear(),this._completedChangeIds.clear(),this._deferredTrackingCalls.clear(),this._trackedFeatures={},this._destroyCallbacks=[],this._payload=void 0,this._saveStickyBucketAssignmentDoc=void 0,Za(this),e.destroyAllStreams&&ho(),this.logs=[],cc&&window._growthbook===this&&delete window._growthbook,this._activeAutoExperiments.forEach(e=>{e.undo()}),this._activeAutoExperiments.clear(),this._triggeredExpKeys.clear()}setRenderer(e){this._renderer=e}forceVariation(e,t){if(this._options.forcedVariations=this._options.forcedVariations||{},this._options.forcedVariations[e]=t,this._options.remoteEval){this._refreshForRemoteEval();return}this._updateAllAutoExperiments(),this._render()}run(e){let{result:t}=Rs(e,null,this._getEvalContext());return this._onExperimentEval(e,t),t}triggerExperiment(e){return this._triggeredExpKeys.add(e),this._options.experiments?this._options.experiments.filter(t=>t.key===e).map(e=>this._runAutoExperiment(e)).filter(e=>e!==null):null}triggerAutoExperiments(){this._autoExperimentsAllowed=!0,this._updateAllAutoExperiments(!0)}_getEvalContext(){return{user:this._getUserContext(),global:this._getGlobalContext(),stack:{evaluatedFeatures:new Set}}}_getUserContext(){return{attributes:this._options.user?{...this._options.user,...this._options.attributes}:this._options.attributes,enableDevMode:this._options.enableDevMode,blockedChangeIds:this._options.blockedChangeIds,stickyBucketAssignmentDocs:this._options.stickyBucketAssignmentDocs,url:this._getContextUrl(),forcedVariations:this._options.forcedVariations,forcedFeatureValues:this._options.forcedFeatureValues,attributeOverrides:this._options.attributeOverrides,saveStickyBucketAssignmentDoc:this._saveStickyBucketAssignmentDoc,trackingCallback:this._options.trackingCallback,onFeatureUsage:this._options.onFeatureUsage,devLogs:this.logs,trackedExperiments:this._trackedExperiments,trackedFeatureUsage:this._trackedFeatures}}_getGlobalContext(){return{features:this._options.features,experiments:this._options.experiments,log:this.log,enabled:this._options.enabled,qaMode:this._options.qaMode,savedGroups:this._options.savedGroups,groups:this._options.groups,overrides:this._options.overrides,onExperimentEval:this._onExperimentEval,recordChangeId:this._recordChangedId,saveDeferredTrack:this._saveDeferredTrack,eventLogger:this._options.eventLogger}}_runAutoExperiment(e,t){let n=this._activeAutoExperiments.get(e);if(e.manual&&!this._triggeredExpKeys.has(e.key)&&!n)return null;let r=this._isAutoExperimentBlockedByContext(e),i,a;r?i=B(this._getEvalContext(),e,-1,!1,``):({result:i,trackingCall:a}=Rs(e,null,this._getEvalContext()),this._onExperimentEval(e,i));let o=JSON.stringify(i.value);if(!t&&i.inExperiment&&n&&n.valueHash===o)return i;if(n&&this._undoActiveAutoExperiment(e),i.inExperiment){let t=Ua(e);if(t===`redirect`&&i.value.urlRedirect&&e.urlPatterns){let t=e.persistQueryString?Va(this._getContextUrl(),i.value.urlRedirect):i.value.urlRedirect;if(Aa(t,e.urlPatterns))return this.log(`Skipping redirect because original URL matches redirect URL`,{id:e.key}),i;this._redirectedUrl=t;let{navigate:n,delay:r}=this._getNavigateFunction();if(n)if(cc)Promise.all([...a?[Wa(a,this._options.maxNavigateDelay??1e3)]:[],new Promise(e=>window.setTimeout(e,this._options.navigateDelay??r))]).then(()=>{try{n(t)}catch(e){console.error(e)}});else try{n(t)}catch(e){console.error(e)}}else if(t===`visual`){let t=this._options.applyDomChangesCallback?this._options.applyDomChangesCallback(i.value):this._applyDOMChanges(i.value);t&&this._activeAutoExperiments.set(e,{undo:t,valueHash:o})}}return i}_undoActiveAutoExperiment(e){let t=this._activeAutoExperiments.get(e);t&&(t.undo(),this._activeAutoExperiments.delete(e))}_updateAllAutoExperiments(e){if(!this._autoExperimentsAllowed)return;let t=this._options.experiments||[],n=new Set(t);this._activeAutoExperiments.forEach((e,t)=>{n.has(t)||(e.undo(),this._activeAutoExperiments.delete(t))});for(let n of t){let t=this._runAutoExperiment(n,e);if(t&&t.inExperiment&&Ua(n)===`redirect`)break}}_onExperimentEval(e,t){let n=this._assigned.get(e.key);this._assigned.set(e.key,{experiment:e,result:t}),this._subscriptions.size>0&&this._fireSubscriptions(e,t,n)}_fireSubscriptions(e,t,n){(!n||n.result.inExperiment!==t.inExperiment||n.result.variationId!==t.variationId)&&this._subscriptions.forEach(n=>{try{n(e,t)}catch(e){console.error(e)}})}_recordChangedId(e){this._completedChangeIds.add(e)}isOn(e){return this.evalFeature(e).on}isOff(e){return this.evalFeature(e).off}getFeatureValue(e,t){let n=this.evalFeature(e).value;return n===null?t:n}feature(e){return this.evalFeature(e)}evalFeature(e){return Ls(e,this._getEvalContext())}log(e,t){this.debug&&(this._options.log?this._options.log(e,t):console.log(e,t))}getDeferredTrackingCalls(){return Array.from(this._deferredTrackingCalls.values())}setDeferredTrackingCalls(e){this._deferredTrackingCalls=new Map(e.filter(e=>e&&e.experiment&&e.result).map(e=>[ic(e.experiment,e.result),e]))}async fireDeferredTrackingCalls(){if(!this._options.trackingCallback)return;let e=[];this._deferredTrackingCalls.forEach(t=>{!t||!t.experiment||!t.result?console.error(`Invalid deferred tracking call`,{call:t}):e.push(this._options.trackingCallback(t.experiment,t.result))}),this._deferredTrackingCalls.clear(),await Promise.all(e)}setTrackingCallback(e){this._options.trackingCallback=e,this.fireDeferredTrackingCalls()}setFeatureUsageCallback(e){this._options.onFeatureUsage=e}setEventLogger(e){this._options.eventLogger=e}async logEvent(e,t){if(this._destroyed){console.error(`Cannot log event to destroyed GrowthBook instance`);return}if(this._options.enableDevMode&&this.logs.push({eventName:e,properties:t,timestamp:Date.now().toString(),logType:`event`}),this._options.eventLogger)try{await this._options.eventLogger(e,t||{},this._getUserContext())}catch(e){console.error(e)}else console.error(`No event logger configured`)}_saveDeferredTrack(e){this._deferredTrackingCalls.set(ic(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(cc?window.location.href:``)}_isAutoExperimentBlockedByContext(e){let t=Ua(e);if(t===`visual`){if(this._options.disableVisualExperiments||this._options.disableJsInjection&&e.variations.some(e=>e.js))return!0}else if(t===`redirect`){if(this._options.disableUrlRedirectExperiments)return!0;try{let t=new URL(this._getContextUrl());for(let n of e.variations){if(!n||!n.urlRedirect)continue;let e=new URL(n.urlRedirect);if(this._options.disableCrossOriginUrlRedirectExperiments&&(e.protocol!==t.protocol||e.host!==t.host))return!0}}catch(t){return this.log(`Error parsing current or redirect URL`,{id:e.key,error:t}),!0}}else return!0;return!!(e.changeId&&(this._options.blockedChangeIds||[]).includes(e.changeId))}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._options.navigate?{navigate:this._options.navigate,delay:0}:cc?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!cc)return;let t=[];if(e.css){let n=document.createElement(`style`);n.innerHTML=e.css,document.head.appendChild(n),t.push(()=>n.remove())}if(e.js){let n=document.createElement(`script`);n.innerHTML=e.js,this._options.jsInjectionNonce&&(n.nonce=this._options.jsInjectionNonce),document.head.appendChild(n),t.push(()=>n.remove())}return e.domMutations&&e.domMutations.forEach(e=>{t.push(gs.declarative(e).revert)}),()=>{t.forEach(e=>e())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=await ec(this._getEvalContext(),this._options.stickyBucketService,e);this._options.stickyBucketAssignmentDocs=t}}generateStickyBucketAssignmentDocsSync(e,t){if(!(`getAllAssignmentsSync`in e)){console.error(`generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync`);return}let n=tc(this._getEvalContext(),t);return e.getAllAssignmentsSync(n)}inDevMode(){return!!this._options.enableDevMode}}})),fc=t((()=>{To(),dc(),qa(),sc(),js()}));function pc(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var mc=t((()=>{}));function hc(e){var t=0,n=0;return function(){var r=vc(),i=_c-(r-n);if(n=r,i>0){if(++t>=gc)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var gc,_c,vc,yc=t((()=>{gc=800,_c=16,vc=Date.now}));function bc(e){return function(){return e}}var xc=t((()=>{})),Sc,Cc=t((()=>{xc(),On(),Rt(),Sc=In?function(e,t){return In(e,`toString`,{configurable:!0,enumerable:!1,value:bc(t),writable:!0})}:Bt})),wc,Tc=t((()=>{Cc(),yc(),wc=hc(Sc)}));function Ec(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}var Dc=t((()=>{}));function Oc(e){return e!==e}var kc=t((()=>{}));function Ac(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}var jc=t((()=>{}));function Mc(e,t,n){return t===t?Ac(e,t,n):Ec(e,Oc,n)}var Nc=t((()=>{Dc(),kc(),jc()}));function Pc(e,t){return!!(e!=null&&e.length)&&Mc(e,t,0)>-1}var Fc=t((()=>{Nc()}));function Ic(e,t,n){return t=Lc(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=Lc(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),pc(e,this,s)}}var Lc,Rc=t((()=>{mc(),Lc=Math.max}));function zc(e,t){return wc(Ic(e,t,Bt),e+``)}var Bc=t((()=>{Rt(),Rc(),Tc()}));function Vc(e,t,n){if(!o(n))return!1;var r=typeof t;return(r==`number`?Sn(n)&&Tt(t,n.length):r==`string`&&t in n)?f(n[t],e):!1}var Hc=t((()=>{ee(),Ht(),sn(),l()}));function Uc(e){return zc(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&Vc(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var Wc=t((()=>{Bc(),Hc()}));function Gc(e){return St(e)||vt(e)||!!(Kc&&e&&e[Kc])}var Kc,qc=t((()=>{s(),dt(),pt(),Kc=i?i.isConcatSpreadable:void 0}));function Jc(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=Gc),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?Jc(s,t-1,n,r,i):fn(i,s):r||(i[i.length]=s)}return i}var Yc=t((()=>{yt(),qc()}));function Xc(e){return e!=null&&e.length?Jc(e,1):[]}var Zc=t((()=>{Yc()}));function Qc(e){return wc(Ic(e,void 0,Xc),e+``)}var $c=t((()=>{Zc(),Rc(),Tc()}));function el(e){if(!$e(e)||c(e)!=tl)return!1;var t=Yn(e);if(t===null)return!0;var n=al.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&il.call(n)==ol}var tl,nl,rl,il,al,ol,sl=t((()=>{a(),rr(),et(),tl=`[object Object]`,nl=Function.prototype,rl=Object.prototype,il=nl.toString,al=rl.hasOwnProperty,ol=il.call(Object)}));function cl(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}var ll=t((()=>{}));function ul(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:cl(e,t,n)}var dl=t((()=>{ll()}));function fl(e){return pl.test(e)}var pl,ml=t((()=>{pl=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`)}));function hl(e){return e.split(``)}var gl=t((()=>{}));function _l(e){return e.match(Pl)||[]}var vl,yl,bl,xl,Sl,Cl,wl,Tl,El,Dl,Ol,kl,Al,jl,Ml,Nl,Pl,Fl=t((()=>{vl=`\\ud800-\\udfff`,yl=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,bl=`\\ufe0e\\ufe0f`,xl=`[`+vl+`]`,Sl=`[`+yl+`]`,Cl=`\\ud83c[\\udffb-\\udfff]`,wl=`(?:`+Sl+`|`+Cl+`)`,Tl=`[^`+vl+`]`,El=`(?:\\ud83c[\\udde6-\\uddff]){2}`,Dl=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Ol=`\\u200d`,kl=wl+`?`,Al=`[`+bl+`]?`,jl=`(?:`+Ol+`(?:`+[Tl,El,Dl].join(`|`)+`)`+Al+kl+`)*`,Ml=Al+kl+jl,Nl=`(?:`+[Tl+Sl+`?`,Sl,El,Dl,xl].join(`|`)+`)`,Pl=RegExp(Cl+`(?=`+Cl+`)|`+Nl+Ml,`g`)}));function Il(e){return fl(e)?_l(e):hl(e)}var Ll=t((()=>{gl(),ml(),Fl()}));function Rl(e){return function(t){t=on(t);var n=fl(t)?Il(t):void 0,r=n?n[0]:t.charAt(0),i=n?ul(n,1).join(``):t.slice(1);return r[e]()+i}}var zl=t((()=>{dl(),ml(),Ll(),hn()})),Bl,Vl=t((()=>{zl(),Bl=Rl(`toUpperCase`)}));function Hl(e){return Bl(on(e).toLowerCase())}var Ul=t((()=>{hn(),Vl()}));function Wl(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}var Gl=t((()=>{}));function Kl(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var ql=t((()=>{})),Jl,Yl=t((()=>{ql(),Jl=Kl()}));function Xl(e,t){return e&&Jl(e,t,tn)}var Zl=t((()=>{Yl(),nn()}));function Ql(e,t){return function(n,r){if(n==null)return n;if(!Sn(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}var $l=t((()=>{Ht()})),eu,tu=t((()=>{Zl(),$l(),eu=Ql(Xl)}));function nu(e,t,n,r){return eu(e,function(e,i,a){t(r,e,n(e),a)}),r}var ru=t((()=>{tu()}));function iu(e,t){return function(n,r){var i=St(n)?Wl:nu,a=t?t():{};return i(n,e,pn(r,2),a)}}var au=t((()=>{Gl(),ru(),bt(),pt()}));function ou(e,t,n){(n!==void 0&&!f(e[t],n)||n===void 0&&!(t in e))&&Wn(e,t,n)}var su=t((()=>{dr(),ee()}));function cu(e){return $e(e)&&Sn(e)}var lu=t((()=>{Ht(),et()}));function uu(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}var du=t((()=>{}));function fu(e){return Xn(e,Zn(e))}var pu=t((()=>{Hn(),er()}));function mu(e,t,n,r,i,a,s){var c=uu(e,n),l=uu(t,n),d=s.get(l);if(d){ou(e,n,d);return}var f=a?a(c,l,n+``,e,t,s):void 0,p=f===void 0;if(p){var m=St(l),ee=!m&&Dt(l),te=!m&&!ee&&ct(l);f=l,m||ee||te?St(c)?f=c:cu(c)?f=lr(c):ee?(p=!1,f=sr(l,!0)):te?(p=!1,f=nr(l,!0)):f=[]:el(l)||vt(l)?(f=c,vt(c)?f=fu(c):(!o(c)||u(c))&&(f=Qn(l))):p=!1}p&&(s.set(l,f),i(f,l,r,a,s),s.delete(l)),ou(e,n,f)}var hu=t((()=>{su(),qn(),ar(),Rn(),Un(),dt(),pt(),lu(),Et(),d(),l(),sl(),jt(),du(),pu()}));function gu(e,t,n,r,i){e!==t&&Jl(t,function(a,s){if(i||(i=new mn),o(a))mu(e,t,s,n,gu,r,i);else{var c=r?r(uu(e,s),a,s+``,e,t,i):void 0;c===void 0&&(c=a),ou(e,s,c)}},Zn)}var _u=t((()=>{an(),su(),Yl(),hu(),l(),er(),du()})),vu,yu=t((()=>{_u(),Wc(),vu=Uc(function(e,t,n,r){gu(e,t,n,r)})}));function bu(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}var xu=t((()=>{}));function Su(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var Cu=t((()=>{}));function wu(e,t){var n=[];return eu(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}var Tu=t((()=>{tu()}));function Eu(e,t){return Ut(t,function(t){return e[t]})}var Du=t((()=>{un()}));function Ou(e){return e==null?[]:Eu(e,tn(e))}var ku=t((()=>{Du(),nn()}));function Au(e,t){return t.length<2?e:Vt(e,cl(t,0,-1))}var ju=t((()=>{kt(),ll()}));function Mu(e,t){return _n(e,t)}var Nu=t((()=>{qt()}));function Pu(e,t){var n={};return t=pn(t,3),Xl(e,function(e,r,i){Wn(n,r,t(e,r,i))}),n}var Fu=t((()=>{dr(),Zl(),bt()}));function Iu(e){if(typeof e!=`function`)throw TypeError(Lu);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var Lu,Ru=t((()=>{Lu=`Expected a function`}));function zu(e,t){t=bn(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=Zt(t[n]);if(i===`__proto__`&&!Bu.call(e,`__proto__`)||(i===`constructor`||i===`prototype`)&&n<r-1)return!1}var a=Au(e,t);return a==null||delete a[Zt(Su(t))]}var Bu,Vu=t((()=>{ln(),Cu(),ju(),nt(),Bu=Object.prototype.hasOwnProperty}));function Hu(e){return el(e)?void 0:e}var Uu=t((()=>{sl()})),Wu,Gu,Ku,qu,Ju=t((()=>{un(),ir(),Vu(),ln(),Hn(),Uu(),$c(),$n(),Wu=1,Gu=2,Ku=4,qu=Qc(function(e,t){var n={};if(e==null)return n;var r=!1;t=Ut(t,function(t){return t=bn(t,e),r||(r=t.length>1),t}),Xn(e,Gn(e),n),r&&(n=tr(n,Wu|Gu|Ku,Hu));for(var i=t.length;i--;)zu(n,t[i]);return n})}));function Yu(e,t,n,r){if(!o(e))return e;t=bn(t,e);for(var i=-1,a=t.length,s=a-1,c=e;c!=null&&++i<a;){var l=Zt(t[i]),u=n;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(i!=s){var d=c[l];u=r?r(d,l,c):void 0,u===void 0&&(u=o(d)?d:Tt(t[i+1])?[]:{})}cr(c,l,u),c=c[l]}return e}var Xu=t((()=>{fr(),ln(),sn(),l(),nt()}));function Zu(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=Vt(e,o);n(s,o)&&Yu(a,bn(o,e),s)}return a}var Qu=t((()=>{kt(),Xu(),ln()}));function $u(e,t){if(e==null)return{};var n=Ut(Gn(e),function(e){return[e]});return t=pn(t),Zu(e,n,function(e,n){return t(e,n[0])})}var ed=t((()=>{un(),bt(),Qu(),$n()})),td,nd=t((()=>{au(),td=iu(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]})}));function rd(e,t){return e+id(ad()*(t-e+1))}var id,ad,od=t((()=>{id=Math.floor,ad=Math.random}));function sd(e,t){return(St(e)?Pt:wu)(e,Iu(pn(t,3)))}var cd=t((()=>{ht(),Tu(),bt(),pt(),Ru()}));function ld(e){var t=e.length;return t?e[rd(0,t-1)]:void 0}var ud=t((()=>{od()}));function dd(e){return ld(Ou(e))}var fd=t((()=>{ud(),ku()}));function pd(e){return(St(e)?ld:dd)(e)}var md=t((()=>{ud(),fd(),pt()}));function hd(e,t,n,r){return r=typeof r==`function`?r:void 0,e==null?e:Yu(e,t,n,r)}var gd=t((()=>{Xu()})),_d,vd=t((()=>{en(),Qe(),zt(),_d=Yt&&1/Lt(new Yt([,-0]))[1]==1/0?function(e){return new Yt(e)}:Ye}));function yd(e,t,n){var r=-1,i=Pc,a=e.length,o=!0,s=[],c=s;if(n)o=!1,i=bu;else if(a>=bd){var l=t?null:_d(e);if(l)return Lt(l);o=!1,i=tt,c=new yn}else c=t?[]:s;outer:for(;++r<a;){var u=e[r],d=t?t(u):u;if(u=n||u!==0?u:0,o&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue outer;t&&c.push(d),s.push(u)}else i(c,d,n)||(c!==s&&c.push(d),s.push(u))}return s}var bd,xd=t((()=>{cn(),Fc(),xu(),Xt(),vd(),zt(),bd=200}));function Sd(e,t){return e&&e.length?yd(e,pn(t,2)):[]}var Cd=t((()=>{bt(),xd()}));function wd(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}var Td=t((()=>{}));function Ed(e,t){return wd(e||[],t||[],cr)}var Dd=t((()=>{fr(),Td()})),Od=t((()=>{mc(),yc(),Tc(),Fc(),Wc(),$c(),Bc(),sl(),Ul(),ll(),Hc(),or(),Yc(),xc(),au(),_u(),yu(),xu(),lu(),Cu(),tu(),ql(),$l(),Tu(),Dc(),Zl(),Zc(),Yl(),Nc(),ku(),ju(),Nu(),kc(),zl(),Fu(),Ru(),Ll(),Ju(),ed(),dl(),ml(),nd(),Qu(),Vu(),od(),cd(),md(),Xu(),gd(),Vl(),Du(),pu(),xd(),Cd(),Dd(),Td()}));function kd(){return process.env.CLAUDE_GB_ADAPTER_KEY||(process.env.USER_TYPE===`ant`?g(process.env.ENABLE_GROWTHBOOK_DEV)?`sdk-yZQvlplybuXjYh6L`:`sdk-xRVcrliHIlrg4og4`:`sdk-zAZezfDKGoZuXXKe`)}var Ad=t((()=>{h()}));function jd(e){let{buffer:t,bytesRead:n}=A().readSync(e,{length:4096});return n===0?`utf8`:n>=2&&t[0]===255&&t[1]===254?`utf16le`:(n>=3&&t[0]===239&&t[1]===187&&t[2],`utf8`)}function Md(e){let t=0,n=0;for(let r=0;r<e.length;r++)e[r]===`
1
+ import{a as e,n as t,o as n,r}from"./chunk-DR8-3Aex.js";import{a as i,i as a,n as o,o as s,r as c,t as l}from"./isObject-DaxDnPKm.js";import{g as u,h as d,l as f,n as p,t as m,u as ee}from"./memoize-DNnuA2aU.js";import{a as te,c as ne,f as re,l as ie,n as ae,s as h,t as oe,u as g}from"./envUtils-BWeoiL4Y.js";import{t as se}from"./client-_sjL0I7A.js";import{n as ce,t as _}from"./defineProperty-80gRi2ZW.js";import{_ as le,d as ue,h as de,n as fe,o as pe,r as me,s as he}from"./esm-CJlBxjtx.js";import{B as ge,D as _e,Q as ve,Tt as ye,V as be,Z as xe,_ as Se,a as Ce,c as we,d as Te,j as Ee,jt as De,o as Oe,t as ke,u as Ae,x as je,z as Me}from"./esm-DcdOXSzi.js";import{i as Ne,r as Pe,t as Fe}from"./esm-BGQPWnJy.js";import{n as v,t as Ie}from"./axios-DhfaybwJ.js";import{Cn as y,En as Le,In as Re,Ln as b,Mn as x,Mr as ze,St as Be,Tt as S,Xn as Ve,Yn as C,kn as He,kt as w,ln as Ue,un as T,vt as E,wn as D,zt as We}from"./schemas-BGAvj1T4.js";import{a as Ge,n as Ke,o as qe,t as Je}from"./v4-f1i_CNUT.js";import{Bn as Ye,In as Xe,Ln as Ze,zn as Qe}from"./src-Di342QoJ.js";import{i as $e,r as et}from"./isSymbol-Dp3irZaY.js";import{$i as tt,$r as nt,Bn as rt,Br as it,Ct as at,Dn as ot,E as st,Ei as ct,Et as lt,F as ut,Fi as dt,Fr as ft,Gi as pt,H as mt,Hi as ht,Hr as gt,I as _t,Ii as vt,Ji as yt,Jr as bt,K as xt,Ki as St,Kr as Ct,Lr as wt,Mi as Tt,Ni as Et,Pi as Dt,Pr as Ot,Qr as kt,Rr as At,Ti as jt,U as Mt,Ur as Nt,Vi as Pt,Vr as Ft,Wr as It,Xi as Lt,Xr as Rt,Yi as zt,Yr as Bt,Zr as Vt,_i as Ht,ai as Ut,ar as Wt,at as Gt,b as Kt,ci as qt,cn as O,cr as Jt,di as Yt,ea as Xt,ei as Zt,en as Qt,et as $t,fi as en,gi as tn,hi as nn,hn as rn,ia as an,ii as on,ji as sn,na as cn,ni as ln,oi as un,ot as dn,qi as fn,qr as pn,ra as mn,ri as hn,rt as gn,si as _n,st as vn,ta as yn,ti as bn,ut as xn,vi as Sn,vt as Cn,x as wn,zr as Tn}from"./state-sIHsFpDu.js";import{A as En,B as Dn,Ct as On,D as kn,E as An,G as jn,J as Mn,K as Nn,N as Pn,O as k,Q as Fn,St as In,T as Ln,Tt as Rn,U as zn,Z as Bn,_ as Vn,_t as Hn,at as Un,bt as Wn,ct as Gn,d as Kn,dt as qn,f as Jn,ft as Yn,gt as Xn,h as A,ht as Zn,it as Qn,l as j,lt as $n,mt as er,nt as tr,ot as nr,p as M,pt as rr,rt as ir,st as ar,tt as or,ut as sr,vt as cr,wt as lr,x as ur,xt as dr,yt as fr,z as pr}from"./debug-otxXY3j-.js";import{a as mr,n as hr,r as N}from"./analytics-DqMQntaB.js";import{n as gr,t as _r}from"./cwd--iizewsn.js";import{t as vr}from"./sdk-DEtgRZvI.js";import{F as yr,P as br,h as xr,n as Sr,t as Cr,v as wr}from"./git-C0IuvuIy.js";import{l as P,n as Tr,r as Er,s as Dr,t as Or,u as kr}from"./oauth-CdZEzMww.js";import{n as Ar,t as jr}from"./bundledMode-kSQejuY4.js";import{n as Mr,r as Nr,t as Pr}from"./execa-CGue6Z3n.js";import{a as Fr,i as Ir,n as Lr,r as F,t as Rr}from"./env-C2A9gV_G.js";import{d as zr,f as Br,o as Vr,p as Hr,s as I,u as Ur}from"./log-DSV4Ht5l.js";import{a as Wr,i as Gr,n as Kr,o as qr,r as Jr}from"./platform-mh9ypxS8.js";import{r as Yr,t as Xr}from"./memoize-DJ1XCN-z.js";import{m as Zr}from"./sessionStoragePortable-CJUZrbIq.js";import{a as Qr,i as $r,n as ei}from"./path-Cit7LKW-.js";import{a as ti,i as ni,n as ri,r as ii,t as ai}from"./execFileNoThrow-azCkYhmF.js";import{a as oi,f as si,l as ci,p as li,r as ui,s as di,u as fi}from"./types-KeqFPzY5.js";import{C as pi,D as mi,E as hi,T as gi,a as _i,b as vi,f as yi,i as bi,l as xi,t as Si,x as Ci}from"./teammate-CbskW5G9.js";import{i as wi,n as Ti}from"./startupProfiler-CBcN1Chw.js";import{n as L,t as Ei}from"./lazySchema-B0QShMaQ.js";import{i as Di,r as Oi,t as ki}from"./permissions-BsVJvaEe.js";import{n as Ai,t as ji}from"./normalization-BLfP0Kqt.js";import{l as Mi,n as Ni,o as Pi}from"./stringUtils-KZoO4GUd.js";import{a as Fi,o as Ii,u as Li}from"./proxy-CF7ZDxaW.js";import{n as Ri,t as zi}from"./sleep-C6koP5Ka.js";import{i as Bi,t as Vi}from"./genericProcessUtils-tJxf3yqB.js";import{i as Hi,o as Ui}from"./common-NEOWMwtB.js";import{homedir as Wi,userInfo as Gi}from"os";import*as Ki from"path";import{basename as qi,dirname as Ji,extname as Yi,isAbsolute as Xi,join as R,normalize as Zi,relative as Qi,resolve as $i,sep as ea}from"path";import{chmodSync as ta,existsSync as na,mkdirSync as ra,readFileSync as ia,unwatchFile as aa,watchFile as oa,writeFileSync as sa}from"fs";import{createHash as ca,randomBytes as la,randomUUID as ua}from"crypto";import{appendFile as da,mkdir as fa,readFile as pa,readdir as ma,realpath as ha,stat as ga,unlink as _a,writeFile as va}from"fs/promises";import{exec as ya,execFile as ba}from"child_process";import{AsyncLocalStorage as xa}from"async_hooks";function Sa(){return Ga}function Ca(e){let t=2166136261,n=e.length;for(let r=0;r<n;r++)t^=e.charCodeAt(r),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}function wa(e,t,n){return n===2?Ca(Ca(e+t)+``)%1e4/1e4:n===1?Ca(t+e)%1e3/1e3:null}function Ta(e){return e<=0?[]:Array(e).fill(1/e)}function Ea(e,t){return e>=t[0]&&e<t[1]}function Da(e,t){let n=wa(`__`+t[0],e,1);return n===null?!1:n>=t[1]&&n<t[2]}function Oa(e,t){for(let n=0;n<t.length;n++)if(Ea(e,t[n]))return n;return-1}function ka(e){try{let t=e.replace(/([^\\])\//g,`$1\\/`);return new RegExp(t)}catch(e){console.error(e);return}}function Aa(e,t){if(!t.length)return!1;let n=!1,r=!1;for(let i=0;i<t.length;i++){let a=Na(e,t[i].type,t[i].pattern);if(t[i].include===!1){if(a)return!1}else n=!0,a&&(r=!0)}return r||!n}function ja(e,t,n){try{let r=t.replace(/[*.+?^${}()|[\]\\]/g,`\\$&`).replace(/_____/g,`.*`);return n&&(r=`\\/?`+r.replace(/(^\/|\/$)/g,``)+`\\/?`),RegExp(`^`+r+`$`,`i`).test(e)}catch{return!1}}function Ma(e,t){try{let n=new URL(t.replace(/^([^:/?]*)\./i,`https://$1.`).replace(/\*/g,`_____`),`https://_____`),r=[[e.host,n.host,!1],[e.pathname,n.pathname,!0]];return n.hash&&r.push([e.hash,n.hash,!1]),n.searchParams.forEach((t,n)=>{r.push([e.searchParams.get(n)||``,t,!1])}),!r.some(e=>!ja(e[0],e[1],e[2]))}catch{return!1}}function Na(e,t,n){try{let r=new URL(e,`https://_`);if(t===`regex`){let e=ka(n);return e?e.test(r.href)||e.test(r.href.substring(r.origin.length)):!1}else if(t===`simple`)return Ma(r,n);return!1}catch{return!1}}function Pa(e,t,n){t=t===void 0?1:t,t<0?t=0:t>1&&(t=1);let r=Ta(e);n=n||r,n.length!==e&&(n=r);let i=n.reduce((e,t)=>t+e,0);(i<.99||i>1.01)&&(n=r);let a=0;return n.map(e=>{let n=a;return a+=e,[n,n+t*e]})}function Fa(e,t,n){if(!t)return null;let r=t.split(`?`)[1];if(!r)return null;let i=r.replace(/#.*/,``).split(`&`).map(e=>e.split(`=`,2)).filter(([t])=>t===e).map(([,e])=>parseInt(e));return i.length>0&&i[0]>=0&&i[0]<n?i[0]:null}function Ia(e){try{return e()}catch(e){return console.error(e),!1}}async function La(e,t,n){if(t=t||``,n=n||globalThis.crypto&&globalThis.crypto.subtle||Ga.SubtleCrypto,!n)throw Error(`No SubtleCrypto implementation found`);try{let r=await n.importKey(`raw`,Ka(t),{name:`AES-CBC`,length:128},!0,[`encrypt`,`decrypt`]),[i,a]=e.split(`.`),o=await n.decrypt({name:`AES-CBC`,iv:Ka(i)},r,Ka(a));return new TextDecoder().decode(o)}catch{throw Error(`Failed to decrypt`)}}function Ra(e){return typeof e==`string`?e:JSON.stringify(e)}function za(e){typeof e==`number`&&(e+=``),(!e||typeof e!=`string`)&&(e=`0`);let t=e.replace(/(^v|\+.*$)/g,``).split(/[-.]/);return t.length===3&&t.push(`~`),t.map(e=>e.match(/^[0-9]+$/)?e.padStart(5,` `):e).join(`-`)}function Ba(){let e;try{e=`1.6.5`}catch{e=``}return e}function Va(e,t){let n,r;try{n=new URL(e),r=new URL(t)}catch(e){return console.error(`Unable to merge query strings: ${e}`),t}return n.searchParams.forEach((e,t)=>{r.searchParams.has(t)||r.searchParams.set(t,e)}),r.toString()}function Ha(e){return typeof e==`object`&&!!e}function Ua(e){return e.urlPatterns&&e.variations.some(e=>Ha(e)&&`urlRedirect`in e)?`redirect`:e.variations.some(e=>Ha(e)&&(e.domMutations||`js`in e||`css`in e))?`visual`:`unknown`}async function Wa(e,t){return new Promise(n=>{let r=!1,i,a=e=>{r||(r=!0,i&&clearTimeout(i),n(e||null))};t&&(i=setTimeout(()=>a(),t)),e.then(e=>a(e)).catch(()=>a())})}var Ga,Ka,qa=t((()=>{Ga={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource},Ka=e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0))}));function Ja(e){Object.assign(z,e),z.backgroundSync||ho()}async function Ya({instance:e,timeout:t,skipCache:n,allowStale:r,backgroundSync:i}){return i||(z.backgroundSync=!1),to({instance:e,allowStale:r,timeout:t,skipCache:n})}function Xa(e){let t=no(e),n=yo.get(t)||new Set;n.add(e),yo.set(t,n)}function Za(e){yo.forEach(t=>t.delete(e))}function Qa(){Co.forEach(e=>{e&&(e.state=`idle`,fo(e))})}function $a(){Co.forEach(e=>{e&&e.state===`idle`&&po(e)})}async function eo(){try{if(!_o.localStorage)return;await _o.localStorage.setItem(z.cacheKey,JSON.stringify(Array.from(xo.entries())))}catch{}}async function to({instance:e,allowStale:t,timeout:n,skipCache:r}){let i=no(e),a=ro(e),o=new Date,s=new Date(o.getTime()-z.maxAge+z.staleTTL);await io();let c=!z.disableCache&&!r?xo.get(a):void 0;return c&&(t||c.staleAt>o)&&c.staleAt>s?(c.sse&&wo.add(i),c.staleAt<o?co(e):lo(e),{data:c.data,success:!0,source:`cache`}):await Wa(co(e),n)||{data:null,success:!1,source:`timeout`,error:Error(`Timeout`)}}function no(e){let[t,n]=e.getApiInfo();return`${t}||${n}`}function ro(e){let t=no(e);if(!(`isRemoteEval`in e)||!e.isRemoteEval())return t;let n=e.getAttributes(),r=e.getCacheKeyAttributes()||Object.keys(e.getAttributes()),i={};r.forEach(e=>{i[e]=n[e]});let a=e.getForcedVariations(),o=e.getUrl();return`${t}||${JSON.stringify({ca:i,fv:a,url:o})}`}async function io(){if(!bo){bo=!0;try{if(_o.localStorage){let e=await _o.localStorage.getItem(z.cacheKey);if(!z.disableCache&&e){let t=JSON.parse(e);t&&Array.isArray(t)&&t.forEach(([e,t])=>{xo.set(e,{...t,staleAt:new Date(t.staleAt)})}),ao()}}}catch{}if(!z.disableIdleStreams){let e=vo.startIdleListener();e&&(vo.stopIdleListener=e)}}}function ao(){let e=Array.from(xo.entries()).map(([e,t])=>({key:e,staleAt:t.staleAt.getTime()})).sort((e,t)=>e.staleAt-t.staleAt),t=Math.min(Math.max(0,xo.size-z.maxEntries),xo.size);for(let n=0;n<t;n++)xo.delete(e[n].key)}function oo(e,t,n){let r=n.dateUpdated||``,i=new Date(Date.now()+z.staleTTL),a=z.disableCache?void 0:xo.get(t);if(a&&r&&a.version===r){a.staleAt=i,eo();return}z.disableCache||(xo.set(t,{data:n,version:r,staleAt:i,sse:wo.has(e)}),ao()),eo();let o=yo.get(e);o&&o.forEach(e=>so(e,n))}async function so(e,t){await e.setPayload(t||e.getPayload())}async function co(e){let{apiHost:t,apiRequestHeaders:n}=e.getApiHosts(),r=e.getClientKey(),i=`isRemoteEval`in e&&e.isRemoteEval(),a=no(e),o=ro(e),s=So.get(o);return s||(s=(i?vo.fetchRemoteEvalCall({host:t,clientKey:r,payload:{attributes:e.getAttributes(),forcedVariations:e.getForcedVariations(),forcedFeatures:Array.from(e.getForcedFeatures().entries()),url:e.getUrl()},headers:n}):vo.fetchFeaturesCall({host:t,clientKey:r,headers:n})).then(e=>{if(!e.ok)throw Error(`HTTP error: ${e.status}`);return e.headers.get(`x-sse-support`)===`enabled`&&wo.add(a),e.json()}).then(t=>(oo(a,o,t),lo(e),So.delete(o),{data:t,success:!0,source:`network`})).catch(e=>(So.delete(o),{data:null,source:`error`,success:!1,error:e})),So.set(o,s)),s}function lo(e,t=!1){let n=no(e),r=ro(e),{streamingHost:i,streamingHostRequestHeaders:a}=e.getApiHosts(),o=e.getClientKey();if(t&&wo.add(n),z.backgroundSync&&wo.has(n)&&_o.EventSource){if(Co.has(n))return;let e={src:null,host:i,clientKey:o,headers:a,cb:t=>{try{if(t.type===`features-updated`){let e=yo.get(n);e&&e.forEach(e=>{co(e)})}else t.type===`features`&&oo(n,r,JSON.parse(t.data));e.errors=0}catch{uo(e)}},errors:0,state:`active`};Co.set(n,e),po(e)}}function uo(e){if(e.state!==`idle`&&(e.errors++,e.errors>3||e.src&&e.src.readyState===2)){let t=3**(e.errors-3)*(1e3+Math.random()*1e3);fo(e),setTimeout(()=>{[`idle`,`active`].includes(e.state)||po(e)},Math.min(t,3e5))}}function fo(e){e.src&&(e.src.onopen=null,e.src.onerror=null,e.src.close(),e.src=null,e.state===`active`&&(e.state=`disabled`))}function po(e){e.src=vo.eventSourceCall({host:e.host,clientKey:e.clientKey,headers:e.headers}),e.state=`active`,e.src.addEventListener(`features`,e.cb),e.src.addEventListener(`features-updated`,e.cb),e.src.onerror=()=>uo(e),e.src.onopen=()=>{e.errors=0}}function mo(e,t){fo(e),Co.delete(t)}function ho(){wo.clear(),Co.forEach(mo),yo.clear(),vo.stopIdleListener()}function go(e,t){if(t.streaming){if(!e.getClientKey())throw Error(`Must specify clientKey to enable streaming`);t.payload&&lo(e,!0),Xa(e)}}var z,_o,vo,yo,bo,xo,So,Co,wo,To=t((()=>{qa(),z={staleTTL:1e3*60,maxAge:1e3*60*60*4,cacheKey:`gbFeaturesCache`,backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},_o=Sa(),vo={fetchFeaturesCall:({host:e,clientKey:t,headers:n})=>_o.fetch(`${e}/api/features/${t}`,{headers:n}),fetchRemoteEvalCall:({host:e,clientKey:t,payload:n,headers:r})=>{let i={method:`POST`,headers:{"Content-Type":`application/json`,...r},body:JSON.stringify(n)};return _o.fetch(`${e}/api/eval/${t}`,i)},eventSourceCall:({host:e,clientKey:t,headers:n})=>n?new _o.EventSource(`${e}/sub/${t}`,{headers:n}):new _o.EventSource(`${e}/sub/${t}`),startIdleListener:()=>{let e;if(!(typeof window<`u`&&typeof document<`u`))return;let t=()=>{document.visibilityState===`visible`?(window.clearTimeout(e),$a()):document.visibilityState===`hidden`&&(e=window.setTimeout(Qa,z.idleStreamInterval))};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(_o.localStorage=globalThis.localStorage)}catch{}yo=new Map,bo=!1,xo=new Map,So=new Map,Co=new Map,wo=new Set}));function Eo(e){return e===`html`?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[e]}}function Do(e){var t=is.get(e);return t||(t={element:e,attributes:{}},is.set(e,t)),t}function Oo(e,t,n,r,i){var a=n(e),o={isDirty:!1,originalValue:a,virtualValue:a,mutations:[],el:e,_positionTimeout:null,observer:new MutationObserver(function(){if(!(t===`position`&&o._positionTimeout)){t===`position`&&(o._positionTimeout=setTimeout(function(){o._positionTimeout=null},1e3));var r=n(e);t===`position`&&r.parentNode===o.virtualValue.parentNode&&r.insertBeforeNode===o.virtualValue.insertBeforeNode||r!==o.virtualValue&&(o.originalValue=r,i(o))}}),mutationRunner:i,setValue:r,getCurrentValue:n};return t===`position`&&e.parentNode?o.observer.observe(e.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(e,Eo(t)),o}function ko(e,t){var n=t.getCurrentValue(t.el);t.virtualValue=e,e&&typeof e!=`string`?(!n||e.parentNode!==n.parentNode||e.insertBeforeNode!==n.insertBeforeNode)&&(t.isDirty=!0,Uo()):e!==n&&(t.isDirty=!0,Uo())}function Ao(e){var t=e.originalValue;e.mutations.forEach(function(e){return t=e.mutate(t)}),ko(Bo(t),e)}function jo(e){var t=new Set(e.originalValue.split(/\s+/).filter(Boolean));e.mutations.forEach(function(e){return e.mutate(t)}),ko(Array.from(t).filter(Boolean).join(` `),e)}function Mo(e){var t=e.originalValue;e.mutations.forEach(function(e){return t=e.mutate(t)}),ko(t,e)}function No(e){var t=e.parentSelector,n=e.insertBeforeSelector,r=document.querySelector(t);if(!r)return null;var i=n?document.querySelector(n):null;return n&&!i?null:{parentNode:r,insertBeforeNode:i}}function Po(e){var t=e.originalValue;e.mutations.forEach(function(e){t=No(e.mutate())||t}),ko(t,e)}function Fo(e){var t=Do(e);return t.html||(t.html=Oo(e,`html`,os,ss,Ao)),t.html}function Io(e){var t=Do(e);return t.position||(t.position=Oo(e,`position`,cs,ls,Po)),t.position}function Lo(e){var t=Do(e);return t.classes||(t.classes=Oo(e,`class`,ds,us,jo)),t.classes}function Ro(e,t){var n=Do(e);return n.attributes[t]||(n.attributes[t]=Oo(e,t,fs(t),ps(t),Mo)),n.attributes[t]}function zo(e,t){var n=is.get(e);if(n)if(t===`html`){var r,i;(r=n.html)==null||(i=r.observer)==null||i.disconnect(),delete n.html}else if(t===`class`){var a,o;(a=n.classes)==null||(o=a.observer)==null||o.disconnect(),delete n.classes}else if(t===`position`){var s,c;(s=n.position)==null||(c=s.observer)==null||c.disconnect(),delete n.position}else{var l,u,d;(l=n.attributes)==null||(u=l[t])==null||(d=u.observer)==null||d.disconnect(),delete n.attributes[t]}}function Bo(e){return ms||(ms=document.createElement(`div`)),ms.innerHTML=e,ms.innerHTML}function Vo(e,t,n){if(n.isDirty){n.isDirty=!1;var r=n.virtualValue;n.mutations.length||zo(e,t),n.setValue(e,r)}}function Ho(e,t){e.html&&Vo(t,`html`,e.html),e.classes&&Vo(t,`class`,e.classes),e.position&&Vo(t,`position`,e.position),Object.keys(e.attributes).forEach(function(n){Vo(t,n,e.attributes[n])})}function Uo(){is.forEach(Ho)}function Wo(e,t){var n=null;e.kind===`html`?n=Fo(t):e.kind===`class`?n=Lo(t):e.kind===`attribute`?n=Ro(t,e.attribute):e.kind===`position`&&(n=Io(t)),n&&(n.mutations.push(e),n.mutationRunner(n))}function Go(e,t){var n=null;if(e.kind===`html`?n=Fo(t):e.kind===`class`?n=Lo(t):e.kind===`attribute`?n=Ro(t,e.attribute):e.kind===`position`&&(n=Io(t)),n){var r=n.mutations.indexOf(e);r!==-1&&n.mutations.splice(r,1),n.mutationRunner(n)}}function Ko(e){if(!(e.kind===`position`&&e.elements.size===1)){var t=new Set(e.elements);document.querySelectorAll(e.selector).forEach(function(n){t.has(n)||(e.elements.add(n),Wo(e,n))})}}function qo(e){e.elements.forEach(function(t){return Go(e,t)}),e.elements.clear(),as.delete(e)}function Jo(){as.forEach(Ko)}function Yo(){typeof document>`u`||(hs||(hs=new MutationObserver(function(){Jo()})),Jo(),hs.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}function Xo(e){return typeof document>`u`?rs:(as.add(e),Ko(e),{revert:function(){qo(e)}})}function Zo(e,t){return Xo({kind:`html`,elements:new Set,mutate:t,selector:e})}function Qo(e,t){return Xo({kind:`position`,elements:new Set,mutate:t,selector:e})}function $o(e,t){return Xo({kind:`class`,elements:new Set,mutate:t,selector:e})}function es(e,t,n){return ns.test(t)?t===`class`||t===`className`?$o(e,function(e){var t=n(Array.from(e).join(` `));e.clear(),t&&t.split(/\s+/g).filter(Boolean).forEach(function(t){return e.add(t)})}):Xo({kind:`attribute`,attribute:t,elements:new Set,mutate:n,selector:e}):rs}function ts(e){var t=e.selector,n=e.action,r=e.value,i=e.attribute,a=e.parentSelector,o=e.insertBeforeSelector;if(i===`html`){if(n===`append`)return Zo(t,function(e){return e+(r??``)});if(n===`set`)return Zo(t,function(){return r??``})}else if(i===`class`){if(n===`append`)return $o(t,function(e){r&&e.add(r)});if(n===`remove`)return $o(t,function(e){r&&e.delete(r)});if(n===`set`)return $o(t,function(e){e.clear(),r&&e.add(r)})}else if(i===`position`){if(n===`set`&&a)return Qo(t,function(){return{insertBeforeSelector:o,parentSelector:a}})}else if(n===`append`)return es(t,i,function(e){return e===null?r??``:e+(r??``)});else if(n===`set`)return es(t,i,function(){return r??``});else if(n===`remove`)return es(t,i,function(){return null});return rs}var ns,rs,is,as,os,ss,cs,ls,us,ds,fs,ps,ms,hs,gs,_s=t((()=>{ns=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,rs={revert:function(){}},is=new Map,as=new Set,os=function(e){return e.innerHTML},ss=function(e,t){return e.innerHTML=t},cs=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},ls=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)},us=function(e,t){return t?e.className=t:e.removeAttribute(`class`)},ds=function(e){return e.className},fs=function(e){return function(t){return t.getAttribute(e)??null}},ps=function(e){return function(t,n){return n===null?t.removeAttribute(e):t.setAttribute(e,n)}},Yo(),gs={html:Zo,classes:$o,attribute:es,position:Qo,declarative:ts}}));function vs(e,t,n){n=n||{};for(let[r,i]of Object.entries(t))switch(r){case`$or`:if(!Os(e,i,n))return!1;break;case`$nor`:if(Os(e,i,n))return!1;break;case`$and`:if(!ks(e,i,n))return!1;break;case`$not`:if(vs(e,i,n))return!1;break;default:if(!xs(i,ys(e,r),n))return!1}return!0}function ys(e,t){let n=t.split(`.`),r=e;for(let e=0;e<n.length;e++)if(r&&typeof r==`object`&&n[e]in r)r=r[n[e]];else return null;return r}function bs(e,t=!1){let n=`${e}${t?`/i`:``}`;return As[n]||(As[n]=new RegExp(e.replace(/([^\\])\//g,`$1\\/`),t?`i`:void 0)),As[n]}function xs(e,t,n,r=!1){if(typeof e==`string`)return r?String(t).toLowerCase()===e.toLowerCase():t+``===e;if(typeof e==`number`)return t*1===e;if(typeof e==`boolean`)return t!==null&&!!t===e;if(e===null)return t===null;if(Array.isArray(e)||!Ss(e))return JSON.stringify(t)===JSON.stringify(e);for(let r in e)if(!Ds(r,t,e[r],n))return!1;return!0}function Ss(e){let t=Object.keys(e);return t.length>0&&t.filter(e=>e[0]===`$`).length===t.length}function Cs(e){if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=typeof e;return[`string`,`number`,`boolean`,`object`,`undefined`].includes(t)?t:`unknown`}function ws(e,t,n){if(!Array.isArray(e))return!1;let r=Ss(t)?e=>xs(t,e,n):e=>vs(e,t,n);for(let t=0;t<e.length;t++)if(e[t]&&r(e[t]))return!0;return!1}function Ts(e,t,n=!1){if(n){let n=e=>typeof e==`string`?e.toLowerCase():e;return Array.isArray(e)?e.some(e=>t.some(t=>n(e)===n(t))):t.some(t=>n(e)===n(t))}return Array.isArray(e)?e.some(e=>t.includes(e)):t.includes(e)}function Es(e,t,n,r=!1){if(!Array.isArray(e))return!1;for(let i=0;i<t.length;i++){let a=!1;for(let o=0;o<e.length;o++)if(xs(t[i],e[o],n,r)){a=!0;break}if(!a)return!1}return!0}function Ds(e,t,n,r){switch(e){case`$veq`:return za(t)===za(n);case`$vne`:return za(t)!==za(n);case`$vgt`:return za(t)>za(n);case`$vgte`:return za(t)>=za(n);case`$vlt`:return za(t)<za(n);case`$vlte`:return za(t)<=za(n);case`$eq`:return t===n;case`$ne`:return t!==n;case`$lt`:return t<n;case`$lte`:return t<=n;case`$gt`:return t>n;case`$gte`:return t>=n;case`$exists`:return n?t!=null:t==null;case`$in`:return Array.isArray(n)?Ts(t,n):!1;case`$ini`:return Array.isArray(n)?Ts(t,n,!0):!1;case`$inGroup`:return Ts(t,r[n]||[]);case`$notInGroup`:return!Ts(t,r[n]||[]);case`$nin`:return Array.isArray(n)?!Ts(t,n):!1;case`$nini`:return Array.isArray(n)?!Ts(t,n,!0):!1;case`$not`:return!xs(n,t,r);case`$size`:return Array.isArray(t)?xs(n,t.length,r):!1;case`$elemMatch`:return ws(t,n,r);case`$all`:return Array.isArray(n)?Es(t,n,r):!1;case`$alli`:return Array.isArray(n)?Es(t,n,r,!0):!1;case`$regex`:try{return bs(n).test(t)}catch{return!1}case`$regexi`:try{return bs(n,!0).test(t)}catch{return!1}case`$type`:return Cs(t)===n;default:return console.error(`Unknown operator: `+e),!1}}function Os(e,t,n){if(!t.length)return!0;for(let r=0;r<t.length;r++)if(vs(e,t[r],n))return!0;return!1}function ks(e,t,n){for(let r=0;r<t.length;r++)if(!vs(e,t[r],n))return!1;return!0}var As,js=t((()=>{qa(),As={}}));function Ms(e){let t=new Map;return e.global.forcedFeatureValues&&e.global.forcedFeatureValues.forEach((e,n)=>t.set(n,e)),e.user.forcedFeatureValues&&e.user.forcedFeatureValues.forEach((e,n)=>t.set(n,e)),t}function Ns(e){return e.global.forcedVariations&&e.user.forcedVariations?{...e.global.forcedVariations,...e.user.forcedVariations}:e.global.forcedVariations?e.global.forcedVariations:e.user.forcedVariations?e.user.forcedVariations:{}}async function Ps(e){try{await e()}catch{}}function Fs(e,t,n){if(e.user.trackedExperiments){let r=ic(t,n);if(e.user.trackedExperiments.has(r))return[];e.user.trackedExperiments.add(r)}e.user.enableDevMode&&e.user.devLogs&&e.user.devLogs.push({experiment:t,result:n,timestamp:Date.now().toString(),logType:`experiment`});let r=[];if(e.global.trackingCallback){let i=e.global.trackingCallback;r.push(Ps(()=>i(t,n,e.user)))}if(e.user.trackingCallback){let i=e.user.trackingCallback;r.push(Ps(()=>i(t,n)))}if(e.global.eventLogger){let i=e.global.eventLogger;r.push(Ps(()=>i(oc,{experimentId:t.key,variationId:n.key,hashAttribute:n.hashAttribute,hashValue:n.hashValue},e.user)))}return r}function Is(e,t,n){if(e.user.trackedFeatureUsage){let r=JSON.stringify(n.value);if(e.user.trackedFeatureUsage[t]===r)return;e.user.trackedFeatureUsage[t]=r,e.user.enableDevMode&&e.user.devLogs&&e.user.devLogs.push({featureKey:t,result:n,timestamp:Date.now().toString(),logType:`feature`})}if(e.global.onFeatureUsage){let r=e.global.onFeatureUsage;Ps(()=>r(t,n,e.user))}if(e.user.onFeatureUsage){let r=e.user.onFeatureUsage;Ps(()=>r(t,n))}if(e.global.eventLogger){let r=e.global.eventLogger;Ps(()=>r(ac,{feature:t,source:n.source,value:n.value,ruleId:n.source===`defaultValue`?`$default`:n.ruleId||``,variationId:n.experimentResult?n.experimentResult.key:``},e.user))}}function Ls(e,t){if(t.stack.evaluatedFeatures.has(e))return zs(t,e,null,`cyclicPrerequisite`);t.stack.evaluatedFeatures.add(e),t.stack.id=e;let n=Ms(t);if(n.has(e))return zs(t,e,n.get(e),`override`);if(!t.global.features||!t.global.features[e])return zs(t,e,null,`unknownFeature`);let r=t.global.features[e];if(r.rules){let n=new Set(t.stack.evaluatedFeatures);rules:for(let i of r.rules){if(i.parentConditions)for(let r of i.parentConditions){t.stack.evaluatedFeatures=new Set(n);let i=Ls(r.id,t);if(i.source===`cyclicPrerequisite`)return zs(t,e,null,`cyclicPrerequisite`);if(!vs({value:i.value},r.condition||{})){if(r.gate)return zs(t,e,null,`prerequisite`);continue rules}}if(i.filters&&Hs(i.filters,t))continue;if(`force`in i){if(i.condition&&!Vs(i.condition,t)||!Us(t,i.seed||e,i.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion))continue;return i.tracks&&i.tracks.forEach(e=>{!Fs(t,e.experiment,e.result).length&&t.global.saveDeferredTrack&&t.global.saveDeferredTrack({experiment:e.experiment,result:e.result})}),zs(t,e,i.force,`force`,i.id)}if(!i.variations)continue;let r={variations:i.variations,key:i.key||e};`coverage`in i&&(r.coverage=i.coverage),i.weights&&(r.weights=i.weights),i.hashAttribute&&(r.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(r.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(r.disableStickyBucketing=i.disableStickyBucketing),i.bucketVersion!==void 0&&(r.bucketVersion=i.bucketVersion),i.minBucketVersion!==void 0&&(r.minBucketVersion=i.minBucketVersion),i.namespace&&(r.namespace=i.namespace),i.meta&&(r.meta=i.meta),i.ranges&&(r.ranges=i.ranges),i.name&&(r.name=i.name),i.phase&&(r.phase=i.phase),i.seed&&(r.seed=i.seed),i.hashVersion&&(r.hashVersion=i.hashVersion),i.filters&&(r.filters=i.filters),i.condition&&(r.condition=i.condition);let{result:a}=Rs(r,e,t);if(t.global.onExperimentEval&&t.global.onExperimentEval(r,a),a.inExperiment&&!a.passthrough)return zs(t,e,a.value,`experiment`,i.id,r,a)}}return zs(t,e,r.defaultValue===void 0?null:r.defaultValue,`defaultValue`)}function Rs(e,t,n){let r=e.key,i=e.variations.length;if(i<2||n.global.enabled===!1||n.user.enabled===!1||(e=Ws(e,n),e.urlPatterns&&!Aa(n.user.url||``,e.urlPatterns)))return{result:B(n,e,-1,!1,t)};let a=Fa(r,n.user.url||``,i);if(a!==null)return{result:B(n,e,a,!1,t)};let o=Ns(n);if(r in o){let i=o[r];return{result:B(n,e,i,!1,t)}}if(e.status===`draft`||e.active===!1)return{result:B(n,e,-1,!1,t)};let{hashAttribute:s,hashValue:c}=Gs(n,e.hashAttribute,n.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!c)return{result:B(n,e,-1,!1,t)};let l=-1,u=!1,d=!1;if(n.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{variation:t,versionIsBlocked:r}=Js({ctx:n,expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta});u=t>=0,l=t,d=!!r}if(!u){if(e.filters){if(Hs(e.filters,n))return{result:B(n,e,-1,!1,t)}}else if(e.namespace&&!Da(c,e.namespace))return{result:B(n,e,-1,!1,t)};if(e.include&&!Ia(e.include)||e.condition&&!Vs(e.condition,n))return{result:B(n,e,-1,!1,t)};if(e.parentConditions){let r=new Set(n.stack.evaluatedFeatures);for(let i of e.parentConditions){n.stack.evaluatedFeatures=new Set(r);let a=Ls(i.id,n);if(a.source===`cyclicPrerequisite`||!vs({value:a.value},i.condition||{}))return{result:B(n,e,-1,!1,t)}}}if(e.groups&&!qs(e.groups,n))return{result:B(n,e,-1,!1,t)}}if(e.url&&!Ks(e.url,n))return{result:B(n,e,-1,!1,t)};let f=wa(e.seed||r,c,e.hashVersion||1);if(f===null)return{result:B(n,e,-1,!1,t)};if(u||(l=Oa(f,e.ranges||Pa(i,e.coverage===void 0?1:e.coverage,e.weights))),d)return{result:B(n,e,-1,!1,t,void 0,!0)};if(l<0)return{result:B(n,e,-1,!1,t)};if(`force`in e)return{result:B(n,e,e.force===void 0?-1:e.force,!1,t)};if(n.global.qaMode||n.user.qaMode||e.status===`stopped`)return{result:B(n,e,-1,!1,t)};let p=B(n,e,l,!0,t,f,u);if(n.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{changed:t,key:r,doc:i}=Qs(n,s,Ra(c),{[Ys(e.key,e.bucketVersion)]:p.key});t&&(n.user.stickyBucketAssignmentDocs=n.user.stickyBucketAssignmentDocs||{},n.user.stickyBucketAssignmentDocs[r]=i,n.user.saveStickyBucketAssignmentDoc(i))}let m=Fs(n,e,p);m.length===0&&n.global.saveDeferredTrack&&n.global.saveDeferredTrack({experiment:e,result:p});let ee=m.length?m.length===1?m[0]:Promise.all(m).then(()=>{}):void 0;return`changeId`in e&&e.changeId&&n.global.recordChangeId&&n.global.recordChangeId(e.changeId),{result:p,trackingCall:ee}}function zs(e,t,n,r,i,a,o){let s={value:n,on:!!n,off:!n,source:r,ruleId:i||``};return a&&(s.experiment=a),o&&(s.experimentResult=o),r!==`override`&&Is(e,t,s),s}function Bs(e){return{...e.user.attributes,...e.user.attributeOverrides}}function Vs(e,t){return vs(Bs(t),e,t.global.savedGroups||{})}function Hs(e,t){return e.some(e=>{let{hashValue:n}=Gs(t,e.attribute);if(!n)return!0;let r=wa(e.seed,n,e.hashVersion||2);return r===null?!0:!e.ranges.some(e=>Ea(r,e))})}function Us(e,t,n,r,i,a,o){if(!i&&a===void 0)return!0;if(!i&&a===0)return!1;let{hashValue:s}=Gs(e,n,r);if(!s)return!1;let c=wa(t,s,o||1);return c===null?!1:i?Ea(c,i):a===void 0?!0:c<=a}function B(e,t,n,r,i,a,o){let s=!0;(n<0||n>=t.variations.length)&&(n=0,s=!1);let{hashAttribute:c,hashValue:l}=Gs(e,t.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0),u=t.meta?t.meta[n]:{},d={key:u.key||``+n,featureId:i,inExperiment:s,hashUsed:r,variationId:n,value:t.variations[n],hashAttribute:c,hashValue:l,stickyBucketUsed:!!o};return u.name&&(d.name=u.name),a!==void 0&&(d.bucket=a),u.passthrough&&(d.passthrough=u.passthrough),d}function Ws(e,t){let n=e.key,r=t.global.overrides;return r&&r[n]&&(e=Object.assign({},e,r[n]),typeof e.url==`string`&&(e.url=ka(e.url))),e}function Gs(e,t,n){let r=t||`id`,i=``,a=Bs(e);return a[r]&&(i=a[r]),!i&&n&&(a[n]&&(i=a[n]),i&&(r=n)),{hashAttribute:r,hashValue:i}}function Ks(e,t){let n=t.user.url;if(!n)return!1;let r=n.replace(/^https?:\/\//,``).replace(/^[^/]*\//,`/`);return!!(e.test(n)||e.test(r))}function qs(e,t){let n=t.global.groups||{};for(let t=0;t<e.length;t++)if(n[e[t]])return!0;return!1}function Js({ctx:e,expKey:t,expBucketVersion:n,expHashAttribute:r,expFallbackAttribute:i,expMinBucketVersion:a,expMeta:o}){n=n||0,a=a||0,r=r||`id`,o=o||[];let s=Ys(t,n),c=Zs(e,r,i);if(a>0){for(let e=0;e<a;e++)if(c[Ys(t,e)]!==void 0)return{variation:-1,versionIsBlocked:!0}}let l=c[s];if(l===void 0)return{variation:-1};let u=o.findIndex(e=>e.key===l);return u<0?{variation:-1}:{variation:u}}function Ys(e,t){return t=t||0,`${e}__${t}`}function Xs(e,t){return`${e}||${t}`}function Zs(e,t,n){if(!e.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:r,hashValue:i}=Gs(e,t),a=Xs(r,Ra(i)),{hashAttribute:o,hashValue:s}=Gs(e,n),c=s?Xs(o,Ra(s)):null,l={};return c&&e.user.stickyBucketAssignmentDocs[c]&&Object.assign(l,e.user.stickyBucketAssignmentDocs[c].assignments||{}),e.user.stickyBucketAssignmentDocs[a]&&Object.assign(l,e.user.stickyBucketAssignmentDocs[a].assignments||{}),l}function Qs(e,t,n,r){let i=Xs(t,n),a=e.user.stickyBucketAssignmentDocs&&e.user.stickyBucketAssignmentDocs[i]&&e.user.stickyBucketAssignmentDocs[i].assignments||{},o={...a,...r},s=JSON.stringify(a)!==JSON.stringify(o);return{key:i,doc:{attributeName:t,attributeValue:n,assignments:o},changed:s}}function $s(e,t){let n=new Set,r=t&&t.features?t.features:e.global.features||{},i=t&&t.experiments?t.experiments:e.global.experiments||[];return Object.keys(r).forEach(e=>{let t=r[e];if(t.rules)for(let e of t.rules)e.variations&&(n.add(e.hashAttribute||`id`),e.fallbackAttribute&&n.add(e.fallbackAttribute))}),i.map(e=>{n.add(e.hashAttribute||`id`),e.fallbackAttribute&&n.add(e.fallbackAttribute)}),Array.from(n)}async function ec(e,t,n){let r=tc(e,n);return t.getAllAssignments(r)}function tc(e,t){let n={};return $s(e,t).forEach(t=>{let{hashValue:r}=Gs(e,t);n[t]=Ra(r)}),n}async function nc(e,t,n){if(e={...e},e.encryptedFeatures){try{e.features=JSON.parse(await La(e.encryptedFeatures,t,n))}catch(e){console.error(e)}delete e.encryptedFeatures}if(e.encryptedExperiments){try{e.experiments=JSON.parse(await La(e.encryptedExperiments,t,n))}catch(e){console.error(e)}delete e.encryptedExperiments}if(e.encryptedSavedGroups){try{e.savedGroups=JSON.parse(await La(e.encryptedSavedGroups,t,n))}catch(e){console.error(e)}delete e.encryptedSavedGroups}return e}function rc(e){let t=e.apiHost||`https://cdn.growthbook.io`;return{apiHost:t.replace(/\/*$/,``),streamingHost:(e.streamingHost||t).replace(/\/*$/,``),apiRequestHeaders:e.apiHostRequestHeaders,streamingHostRequestHeaders:e.streamingHostRequestHeaders}}function ic(e,t){return t.hashAttribute+t.hashValue+e.key+t.variationId}var ac,oc,sc=t((()=>{js(),qa(),ac=`Feature Evaluated`,oc=`Experiment Viewed`})),cc,lc,uc,dc=t((()=>{_s(),qa(),To(),sc(),cc=typeof window<`u`&&typeof document<`u`,lc=Ba(),uc=class{constructor(e){if(e=e||{},this.version=lc,this._options=this.context=e,this._renderer=e.renderer||null,this._trackedExperiments=new Set,this._completedChangeIds=new Set,this._trackedFeatures={},this.debug=!!e.debug,this._subscriptions=new Set,this.ready=!1,this._assigned=new Map,this._activeAutoExperiments=new Map,this._triggeredExpKeys=new Set,this._initialized=!1,this._redirectedUrl=``,this._deferredTrackingCalls=new Map,this._autoExperimentsAllowed=!e.disableExperimentsOnLoad,this._destroyCallbacks=[],this.logs=[],this.log=this.log.bind(this),this._saveDeferredTrack=this._saveDeferredTrack.bind(this),this._onExperimentEval=this._onExperimentEval.bind(this),this._fireSubscriptions=this._fireSubscriptions.bind(this),this._recordChangedId=this._recordChangedId.bind(this),e.remoteEval){if(e.decryptionKey)throw Error(`Encryption is not available for remoteEval`);if(!e.clientKey)throw Error(`Missing clientKey`);let t=!1;try{t=!!new URL(e.apiHost||``).hostname.match(/growthbook\.io$/i)}catch{}if(t)throw Error(`Cannot use remoteEval on GrowthBook Cloud`)}else if(e.cacheKeyAttributes)throw Error(`cacheKeyAttributes are only used for remoteEval`);if(e.stickyBucketService){let t=e.stickyBucketService;this._saveStickyBucketAssignmentDoc=e=>t.saveAssignments(e)}if(e.plugins)for(let t of e.plugins)t(this);if(e.features&&(this.ready=!0),cc&&e.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event(`gbloaded`))),e.experiments&&(this.ready=!0,this._updateAllAutoExperiments()),this._options.stickyBucketService&&this._options.stickyBucketAssignmentDocs)for(let e in this._options.stickyBucketAssignmentDocs){let t=this._options.stickyBucketAssignmentDocs[e];t&&this._options.stickyBucketService.saveAssignments(t).catch(()=>{})}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(e){this._payload=e;let t=await nc(e,this._options.decryptionKey);this._decryptedPayload=t,await this.refreshStickyBuckets(t),t.features&&(this._options.features=t.features),t.savedGroups&&(this._options.savedGroups=t.savedGroups),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,this._render()}initSync(e){this._initialized=!0;let t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw Error(`initSync does not support encrypted payloads`);return this._options.stickyBucketService&&!this._options.stickyBucketAssignmentDocs&&(this._options.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this._options.stickyBucketService,t)),this._payload=t,this._decryptedPayload=t,t.features&&(this._options.features=t.features),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,go(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&Ja(e.cacheSettings),e.payload)return await this.setPayload(e.payload),go(this,e),{success:!0,source:`init`};{let{data:t,...n}=await this._refresh({...e,allowStale:!0});return go(this,e),await this.setPayload(t||{}),n}}async loadFeatures(e){e=e||{},await this.init({skipCache:e.skipCache,timeout:e.timeout,streaming:(this._options.backgroundSync??!0)&&(e.autoRefresh||this._options.subscribeToChanges)})}async refreshFeatures(e){let t=await this._refresh({...e||{},allowStale:!1});t.data&&await this.setPayload(t.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return rc(this._options)}getClientKey(){return this._options.clientKey||``}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}isRemoteEval(){return this._options.remoteEval||!1}getCacheKeyAttributes(){return this._options.cacheKeyAttributes}async _refresh({timeout:e,skipCache:t,allowStale:n,streaming:r}){if(!this._options.clientKey)throw Error(`Missing clientKey`);return Ya({instance:this,timeout:e,skipCache:t||this._options.disableCache,allowStale:n,backgroundSync:r??this._options.backgroundSync??!0})}_render(){if(this._renderer)try{this._renderer()}catch(e){console.error(`Failed to render`,e)}}setFeatures(e){this._options.features=e,this.ready=!0,this._render()}async setEncryptedFeatures(e,t,n){let r=await La(e,t||this._options.decryptionKey,n);this.setFeatures(JSON.parse(r))}setExperiments(e){this._options.experiments=e,this.ready=!0,this._updateAllAutoExperiments()}async setEncryptedExperiments(e,t,n){let r=await La(e,t||this._options.decryptionKey,n);this.setExperiments(JSON.parse(r))}async setAttributes(e){if(this._options.attributes=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async updateAttributes(e){return this.setAttributes({...this._options.attributes,...e})}async setAttributeOverrides(e){if(this._options.attributeOverrides=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async setForcedVariations(e){if(this._options.forcedVariations=e||{},this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}setForcedFeatures(e){this._options.forcedFeatureValues=e,this._render()}async setURL(e){if(e!==this._options.url){if(this._options.url=e,this._redirectedUrl=``,this._options.remoteEval){await this._refreshForRemoteEval(),this._updateAllAutoExperiments(!0);return}this._updateAllAutoExperiments(!0)}}getAttributes(){return{...this._options.attributes,...this._options.attributeOverrides}}getForcedVariations(){return this._options.forcedVariations||{}}getForcedFeatures(){return this._options.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this._options.stickyBucketAssignmentDocs||{}}getUrl(){return this._options.url||``}getFeatures(){return this._options.features||{}}getExperiments(){return this._options.experiments||[]}getCompletedChangeIds(){return Array.from(this._completedChangeIds)}subscribe(e){return this._subscriptions.add(e),()=>{this._subscriptions.delete(e)}}async _refreshForRemoteEval(){if(!this._options.remoteEval||!this._initialized)return;let e=await this._refresh({allowStale:!1});e.data&&await this.setPayload(e.data)}getAllResults(){return new Map(this._assigned)}onDestroy(e){this._destroyCallbacks.push(e)}isDestroyed(){return!!this._destroyed}destroy(e){e=e||{},this._destroyed=!0,this._destroyCallbacks.forEach(e=>{try{e()}catch(e){console.error(e)}}),this._subscriptions.clear(),this._assigned.clear(),this._trackedExperiments.clear(),this._completedChangeIds.clear(),this._deferredTrackingCalls.clear(),this._trackedFeatures={},this._destroyCallbacks=[],this._payload=void 0,this._saveStickyBucketAssignmentDoc=void 0,Za(this),e.destroyAllStreams&&ho(),this.logs=[],cc&&window._growthbook===this&&delete window._growthbook,this._activeAutoExperiments.forEach(e=>{e.undo()}),this._activeAutoExperiments.clear(),this._triggeredExpKeys.clear()}setRenderer(e){this._renderer=e}forceVariation(e,t){if(this._options.forcedVariations=this._options.forcedVariations||{},this._options.forcedVariations[e]=t,this._options.remoteEval){this._refreshForRemoteEval();return}this._updateAllAutoExperiments(),this._render()}run(e){let{result:t}=Rs(e,null,this._getEvalContext());return this._onExperimentEval(e,t),t}triggerExperiment(e){return this._triggeredExpKeys.add(e),this._options.experiments?this._options.experiments.filter(t=>t.key===e).map(e=>this._runAutoExperiment(e)).filter(e=>e!==null):null}triggerAutoExperiments(){this._autoExperimentsAllowed=!0,this._updateAllAutoExperiments(!0)}_getEvalContext(){return{user:this._getUserContext(),global:this._getGlobalContext(),stack:{evaluatedFeatures:new Set}}}_getUserContext(){return{attributes:this._options.user?{...this._options.user,...this._options.attributes}:this._options.attributes,enableDevMode:this._options.enableDevMode,blockedChangeIds:this._options.blockedChangeIds,stickyBucketAssignmentDocs:this._options.stickyBucketAssignmentDocs,url:this._getContextUrl(),forcedVariations:this._options.forcedVariations,forcedFeatureValues:this._options.forcedFeatureValues,attributeOverrides:this._options.attributeOverrides,saveStickyBucketAssignmentDoc:this._saveStickyBucketAssignmentDoc,trackingCallback:this._options.trackingCallback,onFeatureUsage:this._options.onFeatureUsage,devLogs:this.logs,trackedExperiments:this._trackedExperiments,trackedFeatureUsage:this._trackedFeatures}}_getGlobalContext(){return{features:this._options.features,experiments:this._options.experiments,log:this.log,enabled:this._options.enabled,qaMode:this._options.qaMode,savedGroups:this._options.savedGroups,groups:this._options.groups,overrides:this._options.overrides,onExperimentEval:this._onExperimentEval,recordChangeId:this._recordChangedId,saveDeferredTrack:this._saveDeferredTrack,eventLogger:this._options.eventLogger}}_runAutoExperiment(e,t){let n=this._activeAutoExperiments.get(e);if(e.manual&&!this._triggeredExpKeys.has(e.key)&&!n)return null;let r=this._isAutoExperimentBlockedByContext(e),i,a;r?i=B(this._getEvalContext(),e,-1,!1,``):({result:i,trackingCall:a}=Rs(e,null,this._getEvalContext()),this._onExperimentEval(e,i));let o=JSON.stringify(i.value);if(!t&&i.inExperiment&&n&&n.valueHash===o)return i;if(n&&this._undoActiveAutoExperiment(e),i.inExperiment){let t=Ua(e);if(t===`redirect`&&i.value.urlRedirect&&e.urlPatterns){let t=e.persistQueryString?Va(this._getContextUrl(),i.value.urlRedirect):i.value.urlRedirect;if(Aa(t,e.urlPatterns))return this.log(`Skipping redirect because original URL matches redirect URL`,{id:e.key}),i;this._redirectedUrl=t;let{navigate:n,delay:r}=this._getNavigateFunction();if(n)if(cc)Promise.all([...a?[Wa(a,this._options.maxNavigateDelay??1e3)]:[],new Promise(e=>window.setTimeout(e,this._options.navigateDelay??r))]).then(()=>{try{n(t)}catch(e){console.error(e)}});else try{n(t)}catch(e){console.error(e)}}else if(t===`visual`){let t=this._options.applyDomChangesCallback?this._options.applyDomChangesCallback(i.value):this._applyDOMChanges(i.value);t&&this._activeAutoExperiments.set(e,{undo:t,valueHash:o})}}return i}_undoActiveAutoExperiment(e){let t=this._activeAutoExperiments.get(e);t&&(t.undo(),this._activeAutoExperiments.delete(e))}_updateAllAutoExperiments(e){if(!this._autoExperimentsAllowed)return;let t=this._options.experiments||[],n=new Set(t);this._activeAutoExperiments.forEach((e,t)=>{n.has(t)||(e.undo(),this._activeAutoExperiments.delete(t))});for(let n of t){let t=this._runAutoExperiment(n,e);if(t&&t.inExperiment&&Ua(n)===`redirect`)break}}_onExperimentEval(e,t){let n=this._assigned.get(e.key);this._assigned.set(e.key,{experiment:e,result:t}),this._subscriptions.size>0&&this._fireSubscriptions(e,t,n)}_fireSubscriptions(e,t,n){(!n||n.result.inExperiment!==t.inExperiment||n.result.variationId!==t.variationId)&&this._subscriptions.forEach(n=>{try{n(e,t)}catch(e){console.error(e)}})}_recordChangedId(e){this._completedChangeIds.add(e)}isOn(e){return this.evalFeature(e).on}isOff(e){return this.evalFeature(e).off}getFeatureValue(e,t){let n=this.evalFeature(e).value;return n===null?t:n}feature(e){return this.evalFeature(e)}evalFeature(e){return Ls(e,this._getEvalContext())}log(e,t){this.debug&&(this._options.log?this._options.log(e,t):console.log(e,t))}getDeferredTrackingCalls(){return Array.from(this._deferredTrackingCalls.values())}setDeferredTrackingCalls(e){this._deferredTrackingCalls=new Map(e.filter(e=>e&&e.experiment&&e.result).map(e=>[ic(e.experiment,e.result),e]))}async fireDeferredTrackingCalls(){if(!this._options.trackingCallback)return;let e=[];this._deferredTrackingCalls.forEach(t=>{!t||!t.experiment||!t.result?console.error(`Invalid deferred tracking call`,{call:t}):e.push(this._options.trackingCallback(t.experiment,t.result))}),this._deferredTrackingCalls.clear(),await Promise.all(e)}setTrackingCallback(e){this._options.trackingCallback=e,this.fireDeferredTrackingCalls()}setFeatureUsageCallback(e){this._options.onFeatureUsage=e}setEventLogger(e){this._options.eventLogger=e}async logEvent(e,t){if(this._destroyed){console.error(`Cannot log event to destroyed GrowthBook instance`);return}if(this._options.enableDevMode&&this.logs.push({eventName:e,properties:t,timestamp:Date.now().toString(),logType:`event`}),this._options.eventLogger)try{await this._options.eventLogger(e,t||{},this._getUserContext())}catch(e){console.error(e)}else console.error(`No event logger configured`)}_saveDeferredTrack(e){this._deferredTrackingCalls.set(ic(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(cc?window.location.href:``)}_isAutoExperimentBlockedByContext(e){let t=Ua(e);if(t===`visual`){if(this._options.disableVisualExperiments||this._options.disableJsInjection&&e.variations.some(e=>e.js))return!0}else if(t===`redirect`){if(this._options.disableUrlRedirectExperiments)return!0;try{let t=new URL(this._getContextUrl());for(let n of e.variations){if(!n||!n.urlRedirect)continue;let e=new URL(n.urlRedirect);if(this._options.disableCrossOriginUrlRedirectExperiments&&(e.protocol!==t.protocol||e.host!==t.host))return!0}}catch(t){return this.log(`Error parsing current or redirect URL`,{id:e.key,error:t}),!0}}else return!0;return!!(e.changeId&&(this._options.blockedChangeIds||[]).includes(e.changeId))}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._options.navigate?{navigate:this._options.navigate,delay:0}:cc?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!cc)return;let t=[];if(e.css){let n=document.createElement(`style`);n.innerHTML=e.css,document.head.appendChild(n),t.push(()=>n.remove())}if(e.js){let n=document.createElement(`script`);n.innerHTML=e.js,this._options.jsInjectionNonce&&(n.nonce=this._options.jsInjectionNonce),document.head.appendChild(n),t.push(()=>n.remove())}return e.domMutations&&e.domMutations.forEach(e=>{t.push(gs.declarative(e).revert)}),()=>{t.forEach(e=>e())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=await ec(this._getEvalContext(),this._options.stickyBucketService,e);this._options.stickyBucketAssignmentDocs=t}}generateStickyBucketAssignmentDocsSync(e,t){if(!(`getAllAssignmentsSync`in e)){console.error(`generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync`);return}let n=tc(this._getEvalContext(),t);return e.getAllAssignmentsSync(n)}inDevMode(){return!!this._options.enableDevMode}}})),fc=t((()=>{To(),dc(),qa(),sc(),js()}));function pc(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var mc=t((()=>{}));function hc(e){var t=0,n=0;return function(){var r=vc(),i=_c-(r-n);if(n=r,i>0){if(++t>=gc)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var gc,_c,vc,yc=t((()=>{gc=800,_c=16,vc=Date.now}));function bc(e){return function(){return e}}var xc=t((()=>{})),Sc,Cc=t((()=>{xc(),On(),Rt(),Sc=In?function(e,t){return In(e,`toString`,{configurable:!0,enumerable:!1,value:bc(t),writable:!0})}:Bt})),wc,Tc=t((()=>{Cc(),yc(),wc=hc(Sc)}));function Ec(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}var Dc=t((()=>{}));function Oc(e){return e!==e}var kc=t((()=>{}));function Ac(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}var jc=t((()=>{}));function Mc(e,t,n){return t===t?Ac(e,t,n):Ec(e,Oc,n)}var Nc=t((()=>{Dc(),kc(),jc()}));function Pc(e,t){return!!(e!=null&&e.length)&&Mc(e,t,0)>-1}var Fc=t((()=>{Nc()}));function Ic(e,t,n){return t=Lc(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=Lc(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),pc(e,this,s)}}var Lc,Rc=t((()=>{mc(),Lc=Math.max}));function zc(e,t){return wc(Ic(e,t,Bt),e+``)}var Bc=t((()=>{Rt(),Rc(),Tc()}));function Vc(e,t,n){if(!o(n))return!1;var r=typeof t;return(r==`number`?Sn(n)&&Tt(t,n.length):r==`string`&&t in n)?f(n[t],e):!1}var Hc=t((()=>{ee(),Ht(),sn(),l()}));function Uc(e){return zc(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&Vc(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var Wc=t((()=>{Bc(),Hc()}));function Gc(e){return St(e)||vt(e)||!!(Kc&&e&&e[Kc])}var Kc,qc=t((()=>{s(),dt(),pt(),Kc=i?i.isConcatSpreadable:void 0}));function Jc(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=Gc),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?Jc(s,t-1,n,r,i):fn(i,s):r||(i[i.length]=s)}return i}var Yc=t((()=>{yt(),qc()}));function Xc(e){return e!=null&&e.length?Jc(e,1):[]}var Zc=t((()=>{Yc()}));function Qc(e){return wc(Ic(e,void 0,Xc),e+``)}var $c=t((()=>{Zc(),Rc(),Tc()}));function el(e){if(!$e(e)||c(e)!=tl)return!1;var t=Yn(e);if(t===null)return!0;var n=al.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&il.call(n)==ol}var tl,nl,rl,il,al,ol,sl=t((()=>{a(),rr(),et(),tl=`[object Object]`,nl=Function.prototype,rl=Object.prototype,il=nl.toString,al=rl.hasOwnProperty,ol=il.call(Object)}));function cl(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}var ll=t((()=>{}));function ul(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:cl(e,t,n)}var dl=t((()=>{ll()}));function fl(e){return pl.test(e)}var pl,ml=t((()=>{pl=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`)}));function hl(e){return e.split(``)}var gl=t((()=>{}));function _l(e){return e.match(Pl)||[]}var vl,yl,bl,xl,Sl,Cl,wl,Tl,El,Dl,Ol,kl,Al,jl,Ml,Nl,Pl,Fl=t((()=>{vl=`\\ud800-\\udfff`,yl=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,bl=`\\ufe0e\\ufe0f`,xl=`[`+vl+`]`,Sl=`[`+yl+`]`,Cl=`\\ud83c[\\udffb-\\udfff]`,wl=`(?:`+Sl+`|`+Cl+`)`,Tl=`[^`+vl+`]`,El=`(?:\\ud83c[\\udde6-\\uddff]){2}`,Dl=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Ol=`\\u200d`,kl=wl+`?`,Al=`[`+bl+`]?`,jl=`(?:`+Ol+`(?:`+[Tl,El,Dl].join(`|`)+`)`+Al+kl+`)*`,Ml=Al+kl+jl,Nl=`(?:`+[Tl+Sl+`?`,Sl,El,Dl,xl].join(`|`)+`)`,Pl=RegExp(Cl+`(?=`+Cl+`)|`+Nl+Ml,`g`)}));function Il(e){return fl(e)?_l(e):hl(e)}var Ll=t((()=>{gl(),ml(),Fl()}));function Rl(e){return function(t){t=on(t);var n=fl(t)?Il(t):void 0,r=n?n[0]:t.charAt(0),i=n?ul(n,1).join(``):t.slice(1);return r[e]()+i}}var zl=t((()=>{dl(),ml(),Ll(),hn()})),Bl,Vl=t((()=>{zl(),Bl=Rl(`toUpperCase`)}));function Hl(e){return Bl(on(e).toLowerCase())}var Ul=t((()=>{hn(),Vl()}));function Wl(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}var Gl=t((()=>{}));function Kl(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var ql=t((()=>{})),Jl,Yl=t((()=>{ql(),Jl=Kl()}));function Xl(e,t){return e&&Jl(e,t,tn)}var Zl=t((()=>{Yl(),nn()}));function Ql(e,t){return function(n,r){if(n==null)return n;if(!Sn(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}var $l=t((()=>{Ht()})),eu,tu=t((()=>{Zl(),$l(),eu=Ql(Xl)}));function nu(e,t,n,r){return eu(e,function(e,i,a){t(r,e,n(e),a)}),r}var ru=t((()=>{tu()}));function iu(e,t){return function(n,r){var i=St(n)?Wl:nu,a=t?t():{};return i(n,e,pn(r,2),a)}}var au=t((()=>{Gl(),ru(),bt(),pt()}));function ou(e,t,n){(n!==void 0&&!f(e[t],n)||n===void 0&&!(t in e))&&Wn(e,t,n)}var su=t((()=>{dr(),ee()}));function cu(e){return $e(e)&&Sn(e)}var lu=t((()=>{Ht(),et()}));function uu(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}var du=t((()=>{}));function fu(e){return Xn(e,Zn(e))}var pu=t((()=>{Hn(),er()}));function mu(e,t,n,r,i,a,s){var c=uu(e,n),l=uu(t,n),d=s.get(l);if(d){ou(e,n,d);return}var f=a?a(c,l,n+``,e,t,s):void 0,p=f===void 0;if(p){var m=St(l),ee=!m&&Dt(l),te=!m&&!ee&&ct(l);f=l,m||ee||te?St(c)?f=c:cu(c)?f=lr(c):ee?(p=!1,f=sr(l,!0)):te?(p=!1,f=nr(l,!0)):f=[]:el(l)||vt(l)?(f=c,vt(c)?f=fu(c):(!o(c)||u(c))&&(f=Qn(l))):p=!1}p&&(s.set(l,f),i(f,l,r,a,s),s.delete(l)),ou(e,n,f)}var hu=t((()=>{su(),qn(),ar(),Rn(),Un(),dt(),pt(),lu(),Et(),d(),l(),sl(),jt(),du(),pu()}));function gu(e,t,n,r,i){e!==t&&Jl(t,function(a,s){if(i||(i=new mn),o(a))mu(e,t,s,n,gu,r,i);else{var c=r?r(uu(e,s),a,s+``,e,t,i):void 0;c===void 0&&(c=a),ou(e,s,c)}},Zn)}var _u=t((()=>{an(),su(),Yl(),hu(),l(),er(),du()})),vu,yu=t((()=>{_u(),Wc(),vu=Uc(function(e,t,n,r){gu(e,t,n,r)})}));function bu(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}var xu=t((()=>{}));function Su(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var Cu=t((()=>{}));function wu(e,t){var n=[];return eu(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}var Tu=t((()=>{tu()}));function Eu(e,t){return Ut(t,function(t){return e[t]})}var Du=t((()=>{un()}));function Ou(e){return e==null?[]:Eu(e,tn(e))}var ku=t((()=>{Du(),nn()}));function Au(e,t){return t.length<2?e:Vt(e,cl(t,0,-1))}var ju=t((()=>{kt(),ll()}));function Mu(e,t){return _n(e,t)}var Nu=t((()=>{qt()}));function Pu(e,t){var n={};return t=pn(t,3),Xl(e,function(e,r,i){Wn(n,r,t(e,r,i))}),n}var Fu=t((()=>{dr(),Zl(),bt()}));function Iu(e){if(typeof e!=`function`)throw TypeError(Lu);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var Lu,Ru=t((()=>{Lu=`Expected a function`}));function zu(e,t){t=bn(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=Zt(t[n]);if(i===`__proto__`&&!Bu.call(e,`__proto__`)||(i===`constructor`||i===`prototype`)&&n<r-1)return!1}var a=Au(e,t);return a==null||delete a[Zt(Su(t))]}var Bu,Vu=t((()=>{ln(),Cu(),ju(),nt(),Bu=Object.prototype.hasOwnProperty}));function Hu(e){return el(e)?void 0:e}var Uu=t((()=>{sl()})),Wu,Gu,Ku,qu,Ju=t((()=>{un(),ir(),Vu(),ln(),Hn(),Uu(),$c(),$n(),Wu=1,Gu=2,Ku=4,qu=Qc(function(e,t){var n={};if(e==null)return n;var r=!1;t=Ut(t,function(t){return t=bn(t,e),r||(r=t.length>1),t}),Xn(e,Gn(e),n),r&&(n=tr(n,Wu|Gu|Ku,Hu));for(var i=t.length;i--;)zu(n,t[i]);return n})}));function Yu(e,t,n,r){if(!o(e))return e;t=bn(t,e);for(var i=-1,a=t.length,s=a-1,c=e;c!=null&&++i<a;){var l=Zt(t[i]),u=n;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(i!=s){var d=c[l];u=r?r(d,l,c):void 0,u===void 0&&(u=o(d)?d:Tt(t[i+1])?[]:{})}cr(c,l,u),c=c[l]}return e}var Xu=t((()=>{fr(),ln(),sn(),l(),nt()}));function Zu(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=Vt(e,o);n(s,o)&&Yu(a,bn(o,e),s)}return a}var Qu=t((()=>{kt(),Xu(),ln()}));function $u(e,t){if(e==null)return{};var n=Ut(Gn(e),function(e){return[e]});return t=pn(t),Zu(e,n,function(e,n){return t(e,n[0])})}var ed=t((()=>{un(),bt(),Qu(),$n()})),td,nd=t((()=>{au(),td=iu(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]})}));function rd(e,t){return e+id(ad()*(t-e+1))}var id,ad,od=t((()=>{id=Math.floor,ad=Math.random}));function sd(e,t){return(St(e)?Pt:wu)(e,Iu(pn(t,3)))}var cd=t((()=>{ht(),Tu(),bt(),pt(),Ru()}));function ld(e){var t=e.length;return t?e[rd(0,t-1)]:void 0}var ud=t((()=>{od()}));function dd(e){return ld(Ou(e))}var fd=t((()=>{ud(),ku()}));function pd(e){return(St(e)?ld:dd)(e)}var md=t((()=>{ud(),fd(),pt()}));function hd(e,t,n,r){return r=typeof r==`function`?r:void 0,e==null?e:Yu(e,t,n,r)}var gd=t((()=>{Xu()})),_d,vd=t((()=>{en(),Qe(),zt(),_d=Yt&&1/Lt(new Yt([,-0]))[1]==1/0?function(e){return new Yt(e)}:Ye}));function yd(e,t,n){var r=-1,i=Pc,a=e.length,o=!0,s=[],c=s;if(n)o=!1,i=bu;else if(a>=bd){var l=t?null:_d(e);if(l)return Lt(l);o=!1,i=tt,c=new yn}else c=t?[]:s;outer:for(;++r<a;){var u=e[r],d=t?t(u):u;if(u=n||u!==0?u:0,o&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue outer;t&&c.push(d),s.push(u)}else i(c,d,n)||(c!==s&&c.push(d),s.push(u))}return s}var bd,xd=t((()=>{cn(),Fc(),xu(),Xt(),vd(),zt(),bd=200}));function Sd(e,t){return e&&e.length?yd(e,pn(t,2)):[]}var Cd=t((()=>{bt(),xd()}));function wd(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}var Td=t((()=>{}));function Ed(e,t){return wd(e||[],t||[],cr)}var Dd=t((()=>{fr(),Td()})),Od=t((()=>{mc(),yc(),Tc(),Fc(),Wc(),$c(),Bc(),sl(),Ul(),ll(),Hc(),or(),Yc(),xc(),au(),_u(),yu(),xu(),lu(),Cu(),tu(),ql(),$l(),Tu(),Dc(),Zl(),Zc(),Yl(),Nc(),ku(),ju(),Nu(),kc(),zl(),Fu(),Ru(),Ll(),Ju(),ed(),dl(),ml(),nd(),Qu(),Vu(),od(),cd(),md(),Xu(),gd(),Vl(),Du(),pu(),xd(),Cd(),Dd(),Td()}));function kd(){return process.env.CLAUDE_GB_ADAPTER_KEY||(process.env.USER_TYPE===`ant`?g(process.env.ENABLE_GROWTHBOOK_DEV)?`sdk-yZQvlplybuXjYh6L`:`sdk-xRVcrliHIlrg4og4`:`sdk-zAZezfDKGoZuXXKe`)}var Ad=t((()=>{h()}));function jd(e){let{buffer:t,bytesRead:n}=A().readSync(e,{length:4096});return n===0?`utf8`:n>=2&&t[0]===255&&t[1]===254?`utf16le`:(n>=3&&t[0]===239&&t[1]===187&&t[2],`utf8`)}function Md(e){let t=0,n=0;for(let r=0;r<e.length;r++)e[r]===`
2
2
  `&&(r>0&&e[r-1]===`\r`?t++:n++);return t>n?`CRLF`:`LF`}function Nd(e){let t=A(),{resolvedPath:n,isSymlink:r}=ur(t,e);r&&M(`Reading through symlink: ${e} -> ${n}`);let i=jd(n),a=t.readFileSync(n,{encoding:i}),o=Md(a.slice(0,4096));return{content:a.replaceAll(`\r
3
3
  `,`
4
4
  `),encoding:i,lineEndings:o}}function Pd(e){return Nd(e).content}var Fd=t((()=>{j(),Vn()})),Id,Ld,Rd=t((()=>{uf(),Vn(),ce(),Id=class{constructor(){_(this,`cache`,new Map),_(this,`maxCacheSize`,1e3)}readFile(e){let t=A(),n;try{n=t.statSync(e)}catch(t){throw this.cache.delete(e),t}let r=e,i=this.cache.get(r);if(i&&i.mtime===n.mtimeMs)return{content:i.content,encoding:i.encoding};let a=Wd(e),o=t.readFileSync(e,{encoding:a}).replaceAll(`\r
@@ -29,8 +29,8 @@ For longer work: ack → work → result. Between those, send a checkpoint when
29
29
  Keep messages tight — the decision, the file:line, the PR number. Second person always ("your config"), never third.`}));function Bh(e){return Yh[e]??e}function Vh(e){let t=[];for(let[n,r]of Object.entries(Yh))r===e&&t.push(n);return t}function Hh(e){return e.replace(/\\/g,`\\\\`).replace(/\(/g,`\\(`).replace(/\)/g,`\\)`)}function Uh(e){return e.replace(/\\\(/g,`(`).replace(/\\\)/g,`)`).replace(/\\\\/g,`\\`)}function Wh(e){let t=Kh(e,`(`);if(t===-1)return{toolName:Bh(e)};let n=qh(e,`)`);if(n===-1||n<=t||n!==e.length-1)return{toolName:Bh(e)};let r=e.substring(0,t),i=e.substring(t+1,n);if(!r)return{toolName:Bh(e)};if(i===``||i===`*`)return{toolName:Bh(r)};let a=Uh(i);return{toolName:Bh(r),ruleContent:a}}function Gh(e){if(!e.ruleContent)return e.toolName;let t=Hh(e.ruleContent);return`${e.toolName}(${t})`}function Kh(e,t){for(let n=0;n<e.length;n++)if(e[n]===t){let t=0,r=n-1;for(;r>=0&&e[r]===`\\`;)t++,r--;if(t%2==0)return n}return-1}function qh(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t){let t=0,r=n-1;for(;r>=0&&e[r]===`\\`;)t++,r--;if(t%2==0)return n}return-1}var Jh,Yh,Xh=t((()=>{Dh(),kh(),Mh(),Jh=(zh(),e(Nh)).BRIEF_TOOL_NAME,Yh={Task:Ch,KillShell:Ah,AgentOutputTool:Oh,BashOutputTool:Oh,...Jh?{Brief:Jh}:{}}}));function Zh(e){return eg.filePatternTools.includes(e)}function Qh(e){return eg.bashPrefixTools.includes(e)}function $h(e){return eg.customValidation[e]}var eg,tg=t((()=>{eg={filePatternTools:[`Read`,`Write`,`Edit`,`Glob`,`NotebookRead`,`NotebookEdit`],bashPrefixTools:[`Bash`],customValidation:{WebSearch:e=>e.includes(`*`)||e.includes(`?`)?{valid:!1,error:`WebSearch does not support wildcards`,suggestion:`Use exact search terms without * or ?`,examples:[`WebSearch(claude ai)`,`WebSearch(typescript tutorial)`]}:{valid:!0},WebFetch:e=>e.includes(`://`)||e.startsWith(`http`)?{valid:!1,error:`WebFetch permissions use domain format, not URLs`,suggestion:`Use "domain:hostname" format`,examples:[`WebFetch(domain:example.com)`,`WebFetch(domain:github.com)`]}:e.startsWith(`domain:`)?{valid:!0}:{valid:!1,error:`WebFetch permissions must use "domain:" prefix`,suggestion:`Use "domain:hostname" format`,examples:[`WebFetch(domain:example.com)`,`WebFetch(domain:*.google.com)`]}}}}));function ng(e,t){let n=0,r=t-1;for(;r>=0&&e[r]===`\\`;)n++,r--;return n%2!=0}function rg(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&!ng(e,r)&&n++;return n}function ig(e){for(let t=0;t<e.length-1;t++)if(e[t]===`(`&&e[t+1]===`)`&&!ng(e,t))return!0;return!1}function ag(e,t){if(!e||e.trim()===``)return{valid:!1,error:`Permission rule cannot be empty`};if(rg(e,`(`)!==rg(e,`)`))return{valid:!1,error:`Mismatched parentheses`,suggestion:`Ensure all opening parentheses have matching closing parentheses`};if(ig(e)){let t=e.substring(0,e.indexOf(`(`));return t?{valid:!1,error:`Empty parentheses`,suggestion:`Either specify a pattern or use just "${t}" without parentheses`,examples:[`${t}`,`${t}(some-pattern)`]}:{valid:!1,error:`Empty parentheses with no tool name`,suggestion:`Specify a tool name before the parentheses`}}let n=Wh(e),r=gh(n.toolName);if(r)return n.ruleContent!==void 0||rg(e,`(`)>0?{valid:!1,error:`MCP rules do not support patterns in parentheses`,suggestion:`Use "${n.toolName}" without parentheses, or use "mcp__${r.serverName}__*" for all tools`,examples:[`mcp__${r.serverName}`,`mcp__${r.serverName}__*`,r.toolName&&r.toolName!==`*`?`mcp__${r.serverName}__${r.toolName}`:void 0].filter(Boolean)}:{valid:!0};if(!n.toolName||n.toolName.length===0)return{valid:!1,error:`Tool name cannot be empty`};if(n.toolName[0]!==n.toolName[0]?.toUpperCase())return{valid:!1,error:`Tool names must start with uppercase`,suggestion:`Use "${Ni(String(n.toolName))}"`};let i=$h(n.toolName);if(i&&n.ruleContent!==void 0){let e=i(n.ruleContent);if(!e.valid)return e}if(Qh(n.toolName)&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.includes(`:*`)&&!e.endsWith(`:*`))return{valid:!1,error:`The :* pattern must be at the end`,suggestion:`Move :* to the end for prefix matching, or use * for wildcard matching`,examples:[`Bash(npm run:*) - prefix matching (legacy)`,`Bash(npm run *) - wildcard matching`]};if(e===`:*`)return{valid:!1,error:`Prefix cannot be empty before :*`,suggestion:`Specify a command prefix before :*`,examples:[`Bash(npm:*)`,`Bash(git:*)`]}}if(Zh(n.toolName)&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.includes(`:*`))return{valid:!1,error:`The ":*" syntax is only for Bash prefix rules`,suggestion:`Use glob patterns like "*" or "**" for file matching`,examples:[`${n.toolName}(*.ts) - matches .ts files`,`${n.toolName}(src/**) - matches all files in src`,`${n.toolName}(**/*.test.ts) - matches test files`]};if(e.includes(`*`)&&!e.match(/^\*|\*$|\*\*|\/\*|\*\.|\*\)/)&&!e.includes(`**`))return{valid:!1,error:`Wildcard placement might be incorrect`,suggestion:`Wildcards are typically used at path boundaries`,examples:[`${n.toolName}(*.js) - all .js files`,`${n.toolName}(src/*) - all files directly in src`,`${n.toolName}(src/**) - all files recursively in src`]}}if(n&&n.toolName===`VaultHttpFetch`&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.length>384)return{valid:!1,error:`VaultHttpFetch rule content is too long (${e.length} chars; max 384)`,suggestion:`Use a shorter key name and host, or use the wildcard form <key>@*`};if(/[\x00-\x1F\x7F]/.test(e))return{valid:!1,error:`VaultHttpFetch rule content contains control characters (only printable ASCII allowed in key@host)`,suggestion:`Remove control characters from the rule content`}}if(n&&n.toolName===`VaultHttpFetch`&&t===`deny`&&n.ruleContent!==void 0&&!/^[A-Za-z0-9._-]{1,128}@(?:\*|(?:\[[A-Fa-f0-9:]+\]|[A-Za-z0-9.-]{1,253})(?::(?:[1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5]))?)$/.test(n.ruleContent))return{valid:!1,error:`VaultHttpFetch deny rule content must be '<key>@<host>' or '<key>@*' (or whole-tool deny without parentheses for kill switch)`,suggestion:`Found '${n.ruleContent}'. Use 'VaultHttpFetch' (no parens) for kill switch, or 'VaultHttpFetch(${n.ruleContent}@*)' for any-host.`,examples:[`VaultHttpFetch — whole-tool kill switch`,`VaultHttpFetch(${n.ruleContent}@api.github.com)`,`VaultHttpFetch(${n.ruleContent}@*)`]};if(t===`allow`&&n){if(n.ruleContent===void 0&&og.has(n.toolName))return{valid:!1,error:`Whole-tool allow forbidden for vault tool '${n.toolName}'`,suggestion:`Use per-key + per-host allow: '${n.toolName}(your-key-name@host)'`,examples:[`${n.toolName}(github-token@api.github.com)`,`${n.toolName}(my-api@*) - allow any host (advanced)`]};if(n.toolName===`VaultHttpFetch`&&n.ruleContent!==void 0&&!/^[A-Za-z0-9._-]{1,128}@(?:\*|(?:\[[A-Fa-f0-9:]+\]|[A-Za-z0-9.-]{1,253})(?::(?:[1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5]))?)$/.test(n.ruleContent))return{valid:!1,error:`VaultHttpFetch rule content must be '<key>@<host>' or '<key>@*'`,suggestion:`Found '${n.ruleContent}'. Use e.g. 'github-token@api.github.com' or 'admin-key@127.0.0.1:8443' to bind a key to a host.`,examples:[`VaultHttpFetch(github-token@api.github.com)`,`VaultHttpFetch(local-admin@localhost:8443)`,`VaultHttpFetch(stripe-key@*) - any host (advanced)`]}}return{valid:!0}}var og,sg,cg=t((()=>{Je(),Sh(),Ei(),Xh(),Pi(),tg(),og=new Set([`LocalVaultFetch`,`VaultHttpFetch`]),sg=L(()=>b().superRefine((e,t)=>{let n=ag(e);if(!n.valid){let r=n.error;n.suggestion&&(r+=`. ${n.suggestion}`),n.examples&&n.examples.length>0&&(r+=`. Examples: ${n.examples.join(`, `)}`),t.addIssue({code:qe.custom,message:r,params:{received:e}})}}))}));function lg(e){return`serverName`in e&&e.serverName!==void 0}function ug(e){return`serverCommand`in e&&e.serverCommand!==void 0}function dg(e){return`serverUrl`in e&&e.serverUrl!==void 0}var fg,pg,mg,hg,gg,_g,vg,yg=t((()=>{Je(),Hp(),h(),Ei(),am(),hh(),Np(),cg(),gm(),Ci(),fg=L(()=>x(b(),Ge())),pg=L(()=>D({allow:S(sg()).optional().describe(`List of permission rules for allowed operations`),deny:S(sg()).optional().describe(`List of permission rules for denied operations`),ask:S(sg()).optional().describe(`List of permission rules that should always prompt for confirmation`),defaultMode:E(Oi).optional().describe(`Default permission mode when Claude Code needs access`),disableBypassPermissionsMode:E([`disable`]).optional().describe(`Disable the ability to bypass permission prompts`),disableAutoMode:E([`disable`]).optional().describe(`Disable auto mode`),additionalDirectories:S(b()).optional().describe(`Additional directories to include in the permission scope`)}).passthrough()),mg=L(()=>D({source:$m().describe(`Where to fetch the marketplace from`),installLocation:b().optional().describe(`Local cache path where marketplace manifest is stored (auto-generated if not provided)`),autoUpdate:w().optional().describe(`Whether to automatically update this marketplace and its installed plugins on startup`)})),hg=L(()=>D({serverName:b().regex(/^[a-zA-Z0-9_-]+$/,`Server name can only contain letters, numbers, hyphens, and underscores`).optional().describe(`Name of the MCP server that users are allowed to configure`),serverCommand:S(b()).min(1,`Server command must have at least one element (the command)`).optional().describe(`Command array [command, ...args] to match exactly for allowed stdio servers`),serverUrl:b().optional().describe(`URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers`)}).refine(e=>vi([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:`Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"`})),gg=L(()=>D({serverName:b().regex(/^[a-zA-Z0-9_-]+$/,`Server name can only contain letters, numbers, hyphens, and underscores`).optional().describe(`Name of the MCP server that is explicitly blocked`),serverCommand:S(b()).min(1,`Server command must have at least one element (the command)`).optional().describe(`Command array [command, ...args] to match exactly for blocked stdio servers`),serverUrl:b().optional().describe(`URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers`)}).refine(e=>vi([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:`Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"`})),_g=[`skills`,`agents`,`hooks`,`mcp`],vg=L(()=>D({$schema:T(Mp).optional().describe(`JSON Schema reference for Claude Code settings`),apiKeyHelper:b().optional().describe(`Path to a script that outputs authentication values`),awsCredentialExport:b().optional().describe(`Path to a script that exports AWS credentials`),awsAuthRefresh:b().optional().describe(`Path to a script that refreshes AWS authentication`),gcpAuthRefresh:b().optional().describe(`Command to refresh GCP authentication (e.g., gcloud auth application-default login)`),...g(process.env.CLAUDE_CODE_ENABLE_XAA)?{xaaIdp:D({issuer:b().url().describe(`IdP issuer URL for OIDC discovery`),clientId:b().describe(`Claude Code's client_id registered at the IdP`),callbackPort:y().int().positive().optional().describe(`Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.`)}).optional().describe(`XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.`)}:{},fileSuggestion:D({type:T(`command`),command:b()}).optional().describe(`Custom file suggestion configuration for @ mentions`),respectGitignore:w().optional().describe(`Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected.`),cleanupPeriodDays:y().nonnegative().int().optional().describe(`Number of days to retain chat transcripts (default: 30). Setting to 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup.`),env:fg().optional().describe(`Environment variables to set for Claude Code sessions`),attribution:D({commit:b().optional().describe(`Attribution text for git commits, including any trailers. Empty string hides attribution.`),pr:b().optional().describe(`Attribution text for pull request descriptions. Empty string hides attribution.`)}).optional().describe(`Customize attribution text for commits and PRs. Each field defaults to the standard Claude Code attribution if not set.`),includeCoAuthoredBy:w().optional().describe(`Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)`),includeGitInstructions:w().optional().describe(`Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)`),permissions:pg().optional().describe(`Tool usage permissions configuration`),modelType:E([`anthropic`,`openai`,`gemini`,`grok`]).optional().describe(`API provider type. "anthropic" uses the Anthropic API (default), "openai" uses the OpenAI Chat Completions API, "gemini" uses the Gemini API, and "grok" uses the xAI Grok API (OpenAI-compatible). When set to "openai", configure OPENAI_API_KEY, OPENAI_BASE_URL, and OPENAI_MODEL. When set to "gemini", configure GEMINI_API_KEY and optional GEMINI_BASE_URL. When set to "grok", configure GROK_API_KEY (or XAI_API_KEY), optional GROK_BASE_URL, GROK_MODEL, and GROK_MODEL_MAP.`),model:b().optional().describe(`Override the default model used by Claude Code`),availableModels:S(b()).optional().describe(`Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.`),modelOverrides:x(b(),b()).optional().describe(`Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.`),enableAllProjectMcpServers:w().optional().describe(`Whether to automatically approve all MCP servers in the project`),enabledMcpjsonServers:S(b()).optional().describe(`List of approved MCP servers from .mcp.json`),disabledMcpjsonServers:S(b()).optional().describe(`List of rejected MCP servers from .mcp.json`),allowedMcpServers:S(hg()).optional().describe(`Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied.`),deniedMcpServers:S(gg()).optional().describe(`Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied.`),hooks:hm().optional().describe(`Custom commands to run before/after tool executions`),worktree:D({symlinkDirectories:S(b()).optional().describe(`Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"`),sparsePaths:S(b()).optional().describe(`Directories to include when creating worktrees, via git sparse-checkout (cone mode). Dramatically faster in large monorepos — only the listed paths are written to disk.`)}).optional().describe(`Git worktree configuration for --worktree flag.`),disableAllHooks:w().optional().describe(`Disable all hooks and statusLine execution`),defaultShell:E([`bash`,`powershell`]).optional().describe(`Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip).`),allowManagedHooksOnly:w().optional().describe(`When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored.`),allowedHttpHookUrls:S(b()).optional().describe(`Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).`),httpHookAllowedEnvVars:S(b()).optional().describe(`Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers).`),allowManagedPermissionRulesOnly:w().optional().describe(`When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored.`),allowManagedMcpServersOnly:w().optional().describe(`When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies.`),strictPluginOnlyCustomization:He(e=>Array.isArray(e)?e.filter(e=>_g.includes(e)):e,C([w(),S(E(_g))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.claude/{surface}/, .claude/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. Composes with strictKnownMarketplaces for end-to-end admin control — plugins gated by marketplace allowlist, everything else blocked here.'),statusLine:D({type:T(`command`),command:b(),padding:y().optional(),refreshInterval:y().optional()}).optional().describe(`Custom status line display configuration`),statusLineEnabled:w().optional().describe(`Whether to render the fork built-in status line (model + ctx + 5h/7d limits + cost + cache pill). Toggled with /statusline.`),enabledPlugins:x(b(),C([S(b()),w(),Be()])).optional().describe(`Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints.`),extraKnownMarketplaces:x(b(),mg()).check(e=>{for(let[t,n]of Object.entries(e.value))n.source.source===`settings`&&n.source.name!==t&&e.issues.push({code:`custom`,input:n.source.name,path:[t,`source`,`name`],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${t}" but source.name "${n.source.name}")`})}).optional().describe(`Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources.`),strictKnownMarketplaces:S($m()).optional().describe(`Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem. Note: this is a policy gate only — it does NOT register marketplaces. To pre-register allowed marketplaces for users, also set extraKnownMarketplaces.`),blockedMarketplaces:S($m()).optional().describe(`Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem.`),forceLoginMethod:E([`claudeai`,`console`]).optional().describe(`Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing`),forceLoginOrgUUID:b().optional().describe(`Organization UUID to use for OAuth login`),otelHeadersHelper:b().optional().describe(`Path to a script that outputs OpenTelemetry headers`),outputStyle:b().optional().describe(`Controls the output style for assistant responses`),language:b().optional().describe(`Preferred language for Claude responses and voice dictation (e.g., "japanese", "spanish")`),skipWebFetchPreflight:w().optional().describe(`Skip the WebFetch blocklist check for enterprise environments with restrictive security policies`),webSearchAdapter:E([`api`,`bing`,`brave`,`exa`,`tavily`]).optional().describe(`Web search backend adapter. "tavily" uses Tavily Search API (default), "api" uses Anthropic server-side search, "bing" scrapes Bing HTML, "brave" uses Brave Search API, "exa" uses Exa AI.`),webFetchAdapter:E([`tavily`,`http`]).optional().describe(`Web fetch backend. "tavily" uses Tavily Extract API which returns Markdown directly (default), "http" fetches the URL directly via HTTP.`),tavilyEndpointUrl:b().optional().describe(`Custom Tavily API endpoint URL. Defaults to https://tavily.claude-code-best.win. Used by both WebSearch and WebFetch when tavily adapter is selected.`),braveApiKey:b().optional().describe(`Brave Search API key. Required when using the brave web search adapter.`),webFetchHttpTimeoutMs:y().int().positive().optional().describe(`HTTP timeout in milliseconds for the HTTP direct web fetch backend. Defaults to 60000 (60s).`),exaApiKey:b().optional().describe(`Exa AI API key. Required when using the exa web search adapter.`),exaEndpointUrl:b().optional().describe(`Custom Exa AI MCP endpoint URL. Defaults to https://mcp.exa.ai/mcp.`),sandbox:Vp().optional(),feedbackSurveyRate:y().min(0).max(1).optional().describe(`Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point.`),spinnerTipsEnabled:w().optional().describe(`Whether to show tips in the spinner`),spinnerVerbs:D({mode:E([`append`,`replace`]),verbs:S(b())}).optional().describe(`Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.`),spinnerTipsOverride:D({excludeDefault:w().optional(),tips:S(b())}).optional().describe(`Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false).`),syntaxHighlightingDisabled:w().optional().describe(`Whether to disable syntax highlighting in diffs`),terminalTitleFromRename:w().optional().describe(`Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles.`),alwaysThinkingEnabled:w().optional().describe(`When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models.`),effortLevel:E(process.env.USER_TYPE===`ant`?[`low`,`medium`,`high`,`xhigh`,`max`]:[`low`,`medium`,`high`,`xhigh`]).optional().catch(void 0).describe(`Persisted effort level for supported models.`),advisorModel:b().optional().describe(`Advisor model for the server-side advisor tool.`),fastMode:w().optional().describe(`When true, fast mode is enabled. When absent or false, fast mode is off.`),fastModePerSessionOptIn:w().optional().describe(`When true, fast mode does not persist across sessions. Each session starts with fast mode off.`),promptSuggestionEnabled:w().optional().describe(`When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled.`),poorMode:w().optional().describe(`When true, poor mode is active — extract_memories and prompt_suggestion are disabled to save tokens.`),showClearContextOnPlanAccept:w().optional().describe(`When true, the plan-approval dialog offers a "clear context" option. Defaults to false.`),agent:b().optional().describe(`Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model.`),companyAnnouncements:S(b()).optional().describe(`Company announcements to display at startup (one will be randomly selected if multiple are provided)`),pluginConfigs:x(b(),D({mcpServers:x(b(),x(b(),C([b(),y(),w(),S(b())]))).optional().describe(`User configuration values for MCP servers keyed by server name`),options:x(b(),C([b(),y(),w(),S(b())])).optional().describe(`Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.`)})).optional().describe(`Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)`),remote:D({defaultEnvironmentId:b().optional().describe(`Default environment ID to use for remote sessions`)}).optional().describe(`Remote session configuration`),autoUpdatesChannel:E([`latest`,`stable`]).optional().describe(`Release channel for auto-updates (latest or stable)`),disableDeepLinkRegistration:E([`disable`]).optional().describe(`Prevent claude-cli:// protocol handler registration with the OS`),minimumVersion:b().optional().describe(`Minimum version to stay on - prevents downgrades when switching to stable channel`),plansDirectory:b().optional().describe(`Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/`),...process.env.USER_TYPE===`ant`?{classifierPermissionsEnabled:w().optional().describe(`Enable AI-based classification for Bash(prompt:...) permission rules`)}:{},minSleepDurationMs:y().nonnegative().int().optional().describe(`Minimum duration in milliseconds that the Sleep tool must sleep for. Useful for throttling proactive tick frequency.`),maxSleepDurationMs:y().int().min(-1).optional().describe(`Maximum duration in milliseconds that the Sleep tool can sleep for. Set to -1 for indefinite sleep (waits for user input). Useful for limiting idle time in remote/managed environments.`),voiceEnabled:w().optional().describe(`Enable voice mode (hold-to-talk dictation)`),voiceProvider:E([`anthropic`,`doubao`]).optional().describe(`Voice STT backend: "anthropic" (default) or "doubao" (Doubao ASR)`),assistant:w().optional().describe(`Start Claude in assistant mode (custom system prompt, brief view, scheduled check-in skills)`),assistantName:b().optional().describe(`Display name for the assistant, shown in the claude.ai session list`),channelsEnabled:w().optional().describe(`Teams/Enterprise opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). Default off. Set true to allow; users then select servers via --channels.`),allowedChannelPlugins:S(D({marketplace:b(),plugin:b()})).optional().describe(`Teams/Enterprise allowlist of channel plugins. When set, replaces the default Anthropic allowlist — admins decide which plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true.`),defaultView:E([`chat`,`transcript`]).optional().describe(`Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)`),prefersReducedMotion:w().optional().describe(`Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)`),autoMemoryEnabled:w().optional().describe(`Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory.`),autoMemoryDirectory:b().optional().describe(`Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .claude/settings.json) for security. When unset, defaults to ~/.claude/projects/<sanitized-cwd>/memory/.`),autoDreamEnabled:w().optional().describe(`Enable background memory consolidation (auto-dream). When set, overrides the server-side default.`),showThinkingSummaries:w().optional().describe(`Show thinking summaries in the transcript view (ctrl+o). Default: false.`),skipDangerousModePermissionPrompt:w().optional().describe(`Whether the user has accepted the bypass permissions mode dialog`),skipAutoPermissionPrompt:w().optional().describe(`Whether the user has accepted the auto mode opt-in dialog`),useAutoModeDuringPlan:w().optional().describe(`Whether plan mode uses auto mode semantics when auto mode is available (default: true)`),autoMode:D({allow:S(b()).optional().describe(`Rules for the auto mode classifier allow section`),soft_deny:S(b()).optional().describe(`Rules for the auto mode classifier deny section`),...process.env.USER_TYPE===`ant`?{deny:S(b()).optional()}:{},environment:S(b()).optional().describe(`Entries for the auto mode classifier environment section`)}).optional().describe(`Auto mode classifier prompt customization`),disableAutoMode:E([`disable`]).optional().describe(`Disable auto mode`),sshConfigs:S(D({id:b().describe(`Unique identifier for this SSH config. Used to match configs across settings sources.`),name:b().describe(`Display name for the SSH connection`),sshHost:b().describe(`SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config`),sshPort:y().int().optional().describe(`SSH port (default: 22)`),sshIdentityFile:b().optional().describe(`Path to SSH identity file (private key)`),startDirectory:b().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe(`SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members.`),claudeMdExcludes:S(b()).optional().describe(`Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"`),cacheThreshold:y().int().min(0).max(100).optional().describe(`Prompt cache hit rate threshold (0-100). Warnings shown when cache hit rate falls below this percentage. Default: 80.`),cacheWarningEnabled:w().optional().describe(`Whether to show cache hit rate warnings in the message flow when the rate falls below cacheThreshold. Default: true.`),pluginTrustMessage:b().optional().describe(`Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").`),workspaceApiKey:b().optional().describe(`Workspace API key (sk-ant-api03-*) saved via /login UI. Stored in plaintext — keep this file gitignored and restrict its permissions. ANTHROPIC_API_KEY environment variable takes precedence when both are set.`)}).passthrough())}));function bg(){return k(ze(vg(),{unrepresentable:`any`}),null,2)}var xg=t((()=>{Je(),An(),yg()}));function Sg(e){let t=wg.find(t=>t.matches(e));if(!t)return null;let n={...t.tip};if(e.code===`invalid_value`&&e.enumValues&&!n.suggestion&&(n.suggestion=`Valid values: ${e.enumValues.map(e=>`"${e}"`).join(`, `)}`),!n.docLink&&e.path){let t=e.path.split(`.`)[0];t&&(n.docLink=Tg[t])}return n}var Cg,wg,Tg,Eg=t((()=>{Cg=`https://code.claude.com/docs/en`,wg=[{matches:e=>e.path===`permissions.defaultMode`&&e.code===`invalid_value`,tip:{suggestion:`Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)`,docLink:`${Cg}/iam#permission-modes`}},{matches:e=>e.path===`apiKeyHelper`&&e.code===`invalid_type`,tip:{suggestion:`Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"`}},{matches:e=>e.path===`cleanupPeriodDays`&&e.code===`too_small`&&e.expected===`0`,tip:{suggestion:`Must be 0 or greater. Set a positive number for days to retain transcripts (default is 30). Setting 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup.`}},{matches:e=>e.path.startsWith(`env.`)&&e.code===`invalid_type`,tip:{suggestion:`Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"`,docLink:`${Cg}/settings#environment-variables`}},{matches:e=>(e.path===`permissions.allow`||e.path===`permissions.deny`)&&e.code===`invalid_type`&&e.expected===`array`,tip:{suggestion:`Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.`}},{matches:e=>e.path.includes(`hooks`)&&e.code===`invalid_type`,tip:{suggestion:`Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}`}},{matches:e=>e.code===`invalid_type`&&e.expected===`boolean`,tip:{suggestion:`Use true or false without quotes. Example: "includeCoAuthoredBy": true`}},{matches:e=>e.code===`unrecognized_keys`,tip:{suggestion:`Check for typos or refer to the documentation for valid fields`,docLink:`${Cg}/settings`}},{matches:e=>e.code===`invalid_value`&&e.enumValues!==void 0,tip:{suggestion:void 0}},{matches:e=>e.code===`invalid_type`&&e.expected===`object`&&e.received===null&&e.path===``,tip:{suggestion:`Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error.`}},{matches:e=>e.path===`permissions.additionalDirectories`&&e.code===`invalid_type`,tip:{suggestion:`Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command`,docLink:`${Cg}/iam#working-directories`}}],Tg={permissions:`${Cg}/iam#configuring-permissions`,env:`${Cg}/settings#environment-variables`,hooks:`${Cg}/hooks`}}));function Dg(e){return e.code===`invalid_type`}function Og(e){return e.code===`invalid_value`}function kg(e){return e.code===`unrecognized_keys`}function Ag(e){return e.code===`too_small`}function jg(e){return e===null?`null`:e===void 0?`undefined`:Array.isArray(e)?`array`:typeof e}function Mg(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function Ng(e,t){return e.issues.map(e=>{let n=e.path.map(String).join(`.`),r=e.message,i,a,o,s,c;if(Og(e))a=e.values.map(e=>String(e)),o=a.join(` | `),s=void 0,c=void 0;else if(Dg(e)){o=e.expected;let t=Mg(e.message);s=t??jg(e.input),c=t??jg(e.input)}else Ag(e)?o=String(e.minimum):e.code===`custom`&&`params`in e&&(s=e.params.received,c=s);let l=Sg({path:n,code:e.code,expected:o,received:s,enumValues:a,message:e.message,value:s});if(Og(e))i=a?.map(e=>`"${e}"`).join(`, `),r=`Invalid value. Expected one of: ${i}`;else if(Dg(e)){let t=Mg(e.message)??jg(e.input);r=e.expected===`object`&&t===`null`&&n===``?`Invalid or malformed JSON`:`Expected ${e.expected}, but received ${t}`}else if(kg(e)){let t=e.keys.join(`, `);r=`Unrecognized ${Mi(e.keys.length,`field`)}: ${t}`}else Ag(e)&&(r=`Number must be greater than or equal to ${e.minimum}`,i=String(e.minimum));return{file:t,path:n,message:r,expected:i,invalidValue:c,suggestion:l?.suggestion,docLink:l?.docLink}})}function Pg(e){try{let t=kn(e),n=vg().strict().safeParse(t);return n.success?{isValid:!0}:{isValid:!1,error:`Settings validation failed:
30
30
  `+Ng(n.error,`settings`).map(e=>`- ${e.path}: ${e.message}`).join(`
31
31
  `),fullSchema:bg()}}catch(e){return{isValid:!1,error:`Invalid JSON: ${e instanceof Error?e.message:`Unknown parsing error`}`,fullSchema:bg()}}}function Fg(e,t){if(!e||typeof e!=`object`)return[];let n=e;if(!n.permissions||typeof n.permissions!=`object`)return[];let r=n.permissions,i=[];for(let e of[`allow`,`deny`,`ask`]){let n=r[e];Array.isArray(n)&&(r[e]=n.filter(n=>{if(typeof n!=`string`)return i.push({file:t,path:`permissions.${e}`,message:`Non-string value in ${e} array was removed`,invalidValue:n}),!1;let r=ag(n,e);if(!r.valid){let a=`Invalid permission rule "${n}" was skipped`;return r.error&&(a+=`: ${r.error}`),r.suggestion&&(a+=`. ${r.suggestion}`),i.push({file:t,path:`permissions.${e}`,message:a,invalidValue:n}),!1}return!0}))}return i}var Ig=t((()=>{An(),Pi(),cg(),xg(),yg(),Eg()}));function Lg(){let e=``;try{e=Gi().username}catch{}let t=[];return e&&t.push({path:`/Library/Managed Preferences/${e}/${Rg}.plist`,label:`per-user managed preferences`}),t.push({path:`/Library/Managed Preferences/${Rg}.plist`,label:`device-level managed preferences`}),process.env.USER_TYPE===`ant`&&t.push({path:R(Wi(),`Library`,`Preferences`,`${Rg}.plist`),label:`user preferences (ant-only)`}),t}var Rg,zg,Bg,Vg,Hg,Ug,Wg,Gg=t((()=>{Rg=`com.anthropic.claudecode`,zg=`HKLM\\SOFTWARE\\Policies\\ClaudeCode`,Bg=`HKCU\\SOFTWARE\\Policies\\ClaudeCode`,Vg=`Settings`,Hg=`/usr/bin/plutil`,Ug=[`-convert`,`json`,`-o`,`-`,`--`],Wg=5e3}));function Kg(e,t){return new Promise(n=>{ba(e,t,{encoding:`utf-8`,timeout:Wg},(e,t)=>{n({stdout:t??``,code:+!!e})})})}function qg(){return(async()=>{if(process.platform===`darwin`){let e=Lg(),t=(await Promise.all(e.map(async({path:e,label:t})=>{if(!na(e))return{stdout:``,label:t,ok:!1};let{stdout:n,code:r}=await Kg(Hg,[...Ug,e]);return{stdout:n,label:t,ok:r===0&&!!n}}))).find(e=>e.ok);return{plistStdouts:t?[{stdout:t.stdout,label:t.label}]:[],hklmStdout:null,hkcuStdout:null}}if(process.platform===`win32`){let[e,t]=await Promise.all([Kg(`reg`,[`query`,zg,`/v`,Vg]),Kg(`reg`,[`query`,Bg,`/v`,Vg])]);return{plistStdouts:null,hklmStdout:e.code===0?e.stdout:null,hkcuStdout:t.code===0?t.stdout:null}}return{plistStdouts:null,hklmStdout:null,hkcuStdout:null}})()}function Jg(){Xg||(Xg=qg())}function Yg(){return Xg}var Xg,Zg=t((()=>{Gg(),Xg=null}));function Qg(){d_||(d_=(async()=>{wi(`mdm_load_start`);let e=Date.now(),{mdm:t,hkcu:n}=o_(await(Yg()??qg()));l_=t,u_=n,wi(`mdm_load_end`);let r=Date.now()-e;if(M(`MDM settings load completed in ${r}ms`),Object.keys(t.settings).length>0){M(`MDM settings found: ${Object.keys(t.settings).join(`, `)}`);try{yr(`info`,`mdm_settings_loaded`,{duration_ms:r,key_count:Object.keys(t.settings).length,error_count:t.errors.length})}catch{}}})())}async function $g(){d_||Qg(),await d_}function e_(){return l_??c_}function t_(){return u_??c_}function n_(e,t){l_=e,u_=t}async function r_(){return o_(await qg())}function i_(e,t){let n=fi(e,!1);if(!n||typeof n!=`object`)return{settings:{},errors:[]};let r=Fg(n,t),i=vg().safeParse(n);if(!i.success){let e=Ng(i.error,t);return{settings:{},errors:[...r,...e]}}return{settings:i.data,errors:r}}function a_(e,t=`Settings`){let n=e.split(/\r?\n/),r=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),i=RegExp(`^\\s+${r}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,`i`);for(let e of n){let t=e.match(i);if(t&&t[1])return t[1].trimEnd()}return null}function o_(e){if(e.plistStdouts&&e.plistStdouts.length>0){let{stdout:t,label:n}=e.plistStdouts[0],r=i_(t,n);if(Object.keys(r.settings).length>0)return{mdm:r,hkcu:c_}}if(e.hklmStdout){let t=a_(e.hklmStdout);if(t){let e=i_(t,`Registry: ${zg}\\${Vg}`);if(Object.keys(e.settings).length>0)return{mdm:e,hkcu:c_}}}if(s_())return{mdm:c_,hkcu:c_};if(e.hkcuStdout){let t=a_(e.hkcuStdout);if(t)return{mdm:c_,hkcu:i_(t,`Registry: ${Bg}\\${Vg}`)}}return{mdm:c_,hkcu:c_}}function s_(){try{let e=fi(Pd(R(df(),`managed-settings.json`)),!1);if(e&&typeof e==`object`&&Object.keys(e).length>0)return!0}catch{}try{let e=ff(),t=A().readdirSync(e);for(let n of t)if(!(!(n.isFile()||n.isSymbolicLink())||!n.name.endsWith(`.json`)||n.name.startsWith(`.`)))try{let t=fi(Pd(R(e,n.name)),!1);if(t&&typeof t==`object`&&Object.keys(t).length>0)return!0}catch{}}catch{}return!1}var c_,l_,u_,d_,f_=t((()=>{j(),br(),Fd(),Vn(),di(),Ti(),pf(),yg(),Ig(),Gg(),Zg(),c_=Object.freeze({settings:{},errors:[]}),l_=null,u_=null,d_=null}));function p_(){return R(df(),`managed-settings.json`)}function m_(){let e=[],t={},n=!1,{settings:r,errors:i}=__(p_());e.push(...i),r&&Object.keys(r).length>0&&(t=vu(t,r,D_),n=!0);let a=ff();try{let r=A().readdirSync(a).filter(e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(`.json`)&&!e.name.startsWith(`.`)).map(e=>e.name).sort();for(let i of r){let{settings:r,errors:o}=__(R(a,i));e.push(...o),r&&Object.keys(r).length>0&&(t=vu(t,r,D_),n=!0)}}catch(e){let t=Dn(e);t!==`ENOENT`&&t!==`ENOTDIR`&&I(e)}return{settings:n?t:null,errors:e}}function h_(){let{settings:e}=__(p_()),t=!!e&&Object.keys(e).length>0,n=!1,r=ff();try{n=A().readdirSync(r).some(e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(`.json`)&&!e.name.startsWith(`.`))}catch{}return{hasBase:t,hasDropIns:n}}function g_(e,t){typeof e==`object`&&e&&`code`in e&&e.code===`ENOENT`?M(`Broken symlink or missing file encountered for settings.json at path: ${t}`):I(e)}function __(e){let t=wt(e);if(t)return{settings:t.settings?Ln(t.settings):null,errors:t.errors};let n=v_(e);return Nt(e,n),{settings:n.settings?Ln(n.settings):null,errors:n.errors}}function v_(e){try{let{resolvedPath:t}=ur(A(),e),n=Pd(t);if(n.trim()===``)return{settings:{},errors:[]};let r=fi(n,!1),i=Fg(r,e),a=vg().safeParse(r);if(!a.success){let t=Ng(a.error,e);return{settings:null,errors:[...i,...t]}}return{settings:a.data,errors:i}}catch(t){return g_(t,e),{settings:null,errors:[]}}}function y_(e){switch(e){case`userSettings`:return $i(ae());case`policySettings`:case`projectSettings`:case`localSettings`:return $i(dn());case`flagSettings`:{let e=_t();return e?Ji($i(e)):$i(dn())}}}function b_(){return Qt()||g(process.env.CLAUDE_CODE_USE_COWORK_PLUGINS)?`cowork_settings.json`:`settings.json`}function x_(e){switch(e){case`userSettings`:return R(y_(e),b_());case`projectSettings`:case`localSettings`:return R(y_(e),S_(e));case`policySettings`:return p_();case`flagSettings`:return _t()}}function S_(e){switch(e){case`projectSettings`:return R(`.claude`,`settings.json`);case`localSettings`:return R(`.claude`,`settings.local.json`)}}function U(e){let t=At(e);if(t!==void 0)return t;let n=C_(e);return It(e,n),n}function C_(e){if(e===`policySettings`){let e=mp();if(e&&Object.keys(e).length>0)return e;let t=e_();if(Object.keys(t.settings).length>0)return t.settings;let{settings:n}=m_();if(n)return n;let r=t_();return Object.keys(r.settings).length>0?r.settings:null}let t=x_(e),{settings:n}=t?__(t):{settings:null};if(e===`flagSettings`){let e=ut();if(e){let t=vg().safeParse(e);if(t.success)return vu(n||{},t.data,D_)}}return n}function w_(){let e=mp();if(e&&Object.keys(e).length>0)return`remote`;let t=e_();if(Object.keys(t.settings).length>0)return Gr()===`macos`?`plist`:`hklm`;let{settings:n}=m_();if(n)return`file`;let r=t_();return Object.keys(r.settings).length>0?`hkcu`:null}function T_(e,t){if(e===`policySettings`||e===`flagSettings`)return{error:null};let n=x_(e);if(!n)return{error:null};try{A().mkdirSync(Ji(n));let r=C_(e);if(!r){let e=null;try{e=Pd(n)}catch(e){if(!jn(e))throw e}if(e!==null){let t=fi(e);if(t===null)return{error:Error(`Invalid JSON syntax in settings file at ${n}`)};t&&typeof t==`object`&&(r=t,M(`Using raw settings from ${n} due to validation failure`))}}let i=vu(r||{},t,(e,t,n,r)=>{if(t===void 0&&r&&typeof n==`string`){delete r[n];return}if(Array.isArray(t))return t});Pp(n),nf(n,k(i,null,2)+`
32
- `),gt(),e===`localSettings`&&xp(S_(`localSettings`),dn())}catch(e){let t=Error(`Failed to read raw settings from ${n}: ${e}`);return I(t),{error:t}}return{error:null}}function E_(e,t){return pi([...e,...t])}function D_(e,t){if(Array.isArray(e)&&Array.isArray(t))return E_(e,t)}function O_(e){let t=vg().strip().parse(e),n=[`permissions`,`sandbox`,`hooks`],r=[],i={permissions:new Set([`allow`,`deny`,`ask`,`defaultMode`,`disableBypassPermissionsMode`,...[`disableAutoMode`],`additionalDirectories`]),sandbox:new Set([`enabled`,`failIfUnavailable`,`allowUnsandboxedCommands`,`network`,`filesystem`,`ignoreViolations`,`excludedCommands`,`autoAllowBashIfSandboxed`,`enableWeakerNestedSandbox`,`enableWeakerNetworkIsolation`,`ripgrep`]),hooks:new Set([`PreToolUse`,`PostToolUse`,`Notification`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`,`SubagentStop`,`PreCompact`,`PostCompact`,`TeammateIdle`,`TaskCreated`,`TaskCompleted`])};for(let e of Object.keys(t))if(n.includes(e)&&t[e]&&typeof t[e]==`object`){let n=t[e],a=i[e];if(a)for(let t of Object.keys(n))a.has(t)&&r.push(`${e}.${t}`)}else r.push(e);return r.sort()}function k_(){if(R_)return{settings:{},errors:[]};let e=Date.now();wi(`loadSettingsFromDisk_start`),yr(`info`,`settings_load_started`),R_=!0;try{let t=Tn(),n={};t&&(n=vu(n,t,D_));let r=[],i=new Set,a=new Set;for(let e of Op()){if(e===`policySettings`){let e=null,t=[],a=mp();if(a&&Object.keys(a).length>0){let n=vg().safeParse(a);n.success?e=n.data:t.push(...Ng(n.error,`remote managed settings`))}if(!e){let n=e_();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}if(!e){let{settings:n,errors:r}=m_();n&&(e=n),t.push(...r)}if(!e){let n=t_();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}e&&(n=vu(n,e,D_));for(let e of t){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}continue}let t=x_(e);if(t){let e=$i(t);if(!a.has(e)){a.add(e);let{settings:o,errors:s}=__(t);for(let e of s){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}o&&(n=vu(n,o,D_))}}if(e===`flagSettings`){let e=ut();if(e){let t=vg().safeParse(e);t.success&&(n=vu(n,t.data,D_))}}}return yr(`info`,`settings_load_completed`,{duration_ms:Date.now()-e,source_count:a.size,error_count:r.length}),{settings:n,errors:r}}finally{R_=!1}}function A_(){let{settings:e}=M_();return e||{}}function j_(){gt();let e=[];for(let t of Op()){let n=U(t);n&&Object.keys(n).length>0&&e.push({source:t,settings:n})}return{effective:A_(),sources:e}}function M_(){let e=it();if(e!==null)return e;let t=k_();return wi(`loadSettingsFromDisk_end`),Ct(t),t}function N_(){return!!(U(`userSettings`)?.skipDangerousModePermissionPrompt||U(`localSettings`)?.skipDangerousModePermissionPrompt||U(`flagSettings`)?.skipDangerousModePermissionPrompt||U(`policySettings`)?.skipDangerousModePermissionPrompt)}function P_(){return!0}function F_(){return U(`policySettings`)?.useAutoModeDuringPlan!==!1&&U(`flagSettings`)?.useAutoModeDuringPlan!==!1&&U(`userSettings`)?.useAutoModeDuringPlan!==!1&&U(`localSettings`)?.useAutoModeDuringPlan!==!1}function I_(){{let e=D({allow:S(b()).optional(),soft_deny:S(b()).optional(),deny:S(b()).optional(),environment:S(b()).optional()}),t=[],n=[],r=[];for(let i of[`userSettings`,`localSettings`,`flagSettings`,`policySettings`]){let a=U(i);if(!a)continue;let o=e.safeParse(a.autoMode);o.success&&(o.data.allow&&t.push(...o.data.allow),o.data.soft_deny&&n.push(...o.data.soft_deny),process.env.USER_TYPE===`ant`&&o.data.deny&&n.push(...o.data.deny),o.data.environment&&r.push(...o.data.environment))}if(t.length>0||n.length>0||r.length>0)return{...t.length>0&&{allow:t},...n.length>0&&{soft_deny:n},...r.length>0&&{environment:r}}}}function L_(e){for(let t of Op()){if(t===`policySettings`)continue;let n=x_(t);if(n)try{let{resolvedPath:t}=ur(A(),n),r=Pd(t);if(!r.trim())continue;let i=fi(r,!1);if(i&&typeof i==`object`&&e in i)return!0}catch(e){g_(e,n)}}return!1}var R_,z_,B_=t((()=>{yu(),Je(),O(),vp(),Ci(),j(),br(),h(),zn(),uf(),Fd(),Vn(),Sp(),di(),Vr(),qr(),An(),Ti(),Np(),Rp(),pf(),f_(),Ft(),yg(),Ig(),R_=!1,z_=A_}));function V_(e,t){return e.find(e=>e.includes(t))??null}async function H_(){let{BedrockClient:e}=await import(`./dist-es-4z5T3Jzm.js`),t=oe(),n=g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await Fi(),...n&&{requestHandler:new(await(import(`./dist-es-hdN_ShpZ.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-CZkzHpjF.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await Lw();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}async function U_(){let{BedrockRuntimeClient:e}=await import(`./dist-es-DN7otr6F.js`),t=oe(),n=g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await Fi(),...n&&{requestHandler:new(await(import(`./dist-es-hdN_ShpZ.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-CZkzHpjF.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await Lw();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}function W_(e){return e.startsWith(`anthropic.`)}function G_(e){if(!e.startsWith(`arn:`))return e;let t=e.lastIndexOf(`/`);return t===-1?e:e.substring(t+1)}function K_(e){let t=G_(e);for(let e of X_)if(t.startsWith(`${e}.anthropic.`))return e}function q_(e,t){let n=K_(e);return n?e.replace(`${n}.`,`${t}.`):W_(e)?`${t}.${e}`:e}var J_,Y_,X_,Z_=t((()=>{m(),Q(),h(),Vr(),Li(),J_=p(async function(){let[e,{ListInferenceProfilesCommand:t}]=await Promise.all([H_(),import(`./dist-es-4z5T3Jzm.js`)]),n=[],r;try{do{let i=new t({...r&&{nextToken:r},typeEquals:`SYSTEM_DEFINED`}),a=await e.send(i);a.inferenceProfileSummaries&&n.push(...a.inferenceProfileSummaries),r=a.nextToken}while(r);return n.filter(e=>e.inferenceProfileId?.includes(`anthropic`)).map(e=>e.inferenceProfileId).filter(Boolean)}catch(e){throw I(e),e}}),Y_=p(async function(e){try{let[t,{GetInferenceProfileCommand:n}]=await Promise.all([H_(),import(`./dist-es-4z5T3Jzm.js`)]),r=new n({inferenceProfileIdentifier:e}),i=await t.send(r);if(!i.models||i.models.length===0)return null;let a=i.models[0];if(!a?.modelArn)return null;let o=a.modelArn.lastIndexOf(`/`);return o>=0?a.modelArn.substring(o+1):a.modelArn}catch(e){return I(e),null}}),X_=[`us`,`eu`,`apac`,`global`]})),Q_,$_,ev,tv,nv,rv,iv,av,ov,sv,cv,lv,uv,dv,fv=t((()=>{Q_={firstParty:`claude-3-7-sonnet-20250219`,bedrock:`us.anthropic.claude-3-7-sonnet-20250219-v1:0`,vertex:`claude-3-7-sonnet@20250219`,foundry:`claude-3-7-sonnet`,openai:`claude-3-7-sonnet-20250219`,gemini:`claude-3-7-sonnet-20250219`,grok:`claude-3-7-sonnet-20250219`},$_={firstParty:`claude-3-5-sonnet-20241022`,bedrock:`anthropic.claude-3-5-sonnet-20241022-v2:0`,vertex:`claude-3-5-sonnet-v2@20241022`,foundry:`claude-3-5-sonnet`,openai:`claude-3-5-sonnet-20241022`,gemini:`claude-3-5-sonnet-20241022`,grok:`claude-3-5-sonnet-20241022`},ev={firstParty:`claude-3-5-haiku-20241022`,bedrock:`us.anthropic.claude-3-5-haiku-20241022-v1:0`,vertex:`claude-3-5-haiku@20241022`,foundry:`claude-3-5-haiku`,openai:`claude-3-5-haiku-20241022`,gemini:`claude-3-5-haiku-20241022`,grok:`claude-3-5-haiku-20241022`},tv={firstParty:`claude-haiku-4-5-20251001`,bedrock:`us.anthropic.claude-haiku-4-5-20251001-v1:0`,vertex:`claude-haiku-4-5@20251001`,foundry:`claude-haiku-4-5`,openai:`claude-haiku-4-5-20251001`,gemini:`claude-haiku-4-5-20251001`,grok:`claude-haiku-4-5-20251001`},nv={firstParty:`claude-sonnet-4-20250514`,bedrock:`us.anthropic.claude-sonnet-4-20250514-v1:0`,vertex:`claude-sonnet-4@20250514`,foundry:`claude-sonnet-4`,openai:`claude-sonnet-4-20250514`,gemini:`claude-sonnet-4-20250514`,grok:`claude-sonnet-4-20250514`},rv={firstParty:`claude-sonnet-4-5-20250929`,bedrock:`us.anthropic.claude-sonnet-4-5-20250929-v1:0`,vertex:`claude-sonnet-4-5@20250929`,foundry:`claude-sonnet-4-5`,openai:`claude-sonnet-4-5-20250929`,gemini:`claude-sonnet-4-5-20250929`,grok:`claude-sonnet-4-5-20250929`},iv={firstParty:`claude-opus-4-20250514`,bedrock:`us.anthropic.claude-opus-4-20250514-v1:0`,vertex:`claude-opus-4@20250514`,foundry:`claude-opus-4`,openai:`claude-opus-4-20250514`,gemini:`claude-opus-4-20250514`,grok:`claude-opus-4-20250514`},av={firstParty:`claude-opus-4-1-20250805`,bedrock:`us.anthropic.claude-opus-4-1-20250805-v1:0`,vertex:`claude-opus-4-1@20250805`,foundry:`claude-opus-4-1`,openai:`claude-opus-4-1-20250805`,gemini:`claude-opus-4-1-20250805`,grok:`claude-opus-4-1-20250805`},ov={firstParty:`claude-opus-4-5-20251101`,bedrock:`us.anthropic.claude-opus-4-5-20251101-v1:0`,vertex:`claude-opus-4-5@20251101`,foundry:`claude-opus-4-5`,openai:`claude-opus-4-5-20251101`,gemini:`claude-opus-4-5-20251101`,grok:`claude-opus-4-5-20251101`},sv={firstParty:`claude-opus-4-6`,bedrock:`us.anthropic.claude-opus-4-6-v1`,vertex:`claude-opus-4-6`,foundry:`claude-opus-4-6`,openai:`claude-opus-4-6`,gemini:`claude-opus-4-6`,grok:`claude-opus-4-6`},cv={firstParty:`claude-opus-4-7`,bedrock:`us.anthropic.claude-opus-4-7-v1`,vertex:`claude-opus-4-7`,foundry:`claude-opus-4-7`,openai:`claude-opus-4-7`,gemini:`claude-opus-4-7`,grok:`claude-opus-4-7`},lv={firstParty:`claude-sonnet-4-6`,bedrock:`us.anthropic.claude-sonnet-4-6`,vertex:`claude-sonnet-4-6`,foundry:`claude-sonnet-4-6`,openai:`claude-sonnet-4-6`,gemini:`claude-sonnet-4-6`,grok:`claude-sonnet-4-6`},uv={haiku35:ev,haiku45:tv,sonnet35:$_,sonnet37:Q_,sonnet40:nv,sonnet45:rv,sonnet46:lv,opus40:iv,opus41:av,opus45:ov,opus46:sv,opus47:cv},Object.values(uv).map(e=>e.firstParty),dv=Object.fromEntries(Object.entries(uv).map(([e,t])=>[t.firstParty,e]))}));function W(e=A_()){let t=e.modelType;return t===`openai`?`openai`:t===`gemini`?`gemini`:t===`grok`?`grok`:g(process.env.CLAUDE_CODE_USE_BEDROCK)?`bedrock`:g(process.env.CLAUDE_CODE_USE_VERTEX)?`vertex`:g(process.env.CLAUDE_CODE_USE_FOUNDRY)?`foundry`:g(process.env.CLAUDE_CODE_USE_OPENAI)?`openai`:g(process.env.CLAUDE_CODE_USE_GEMINI)?`gemini`:g(process.env.CLAUDE_CODE_USE_GROK)?`grok`:`firstParty`}function pv(){return W()}function mv(){let e=process.env.ANTHROPIC_BASE_URL;if(!e)return!0;try{let t=new URL(e).host,n=[`api.anthropic.com`];return process.env.USER_TYPE===`ant`&&n.push(`api-staging.anthropic.com`),n.includes(t)}catch{return!1}}var hv=t((()=>{B_(),h()}));function gv(e){let t={};for(let n of Sv)t[n]=uv[n][e];return t}async function _v(){let e=gv(`bedrock`),t;try{t=await J_()}catch(t){return I(t),e}if(!t?.length)return e;let n={};for(let r of Sv){let i=uv[r].firstParty;n[r]=V_(t,i)||e[r]}return n}function vv(e){let t=A_().modelOverrides;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=dv[e];t&&r&&(n[t]=r)}return n}function yv(e){let t;try{t=A_().modelOverrides}catch{return e}if(!t)return e;for(let[n,r]of Object.entries(t))if(r===e)return n;return e}function bv(){if(gn()===null){if(W()!==`bedrock`){Wt(gv(W()));return}Cv()}}function G(){let e=gn();return e===null?(bv(),vv(gv(W()))):vv(e)}async function xv(){if(gn()===null){if(W()!==`bedrock`){Wt(gv(W()));return}await Cv()}}var Sv,Cv,wv=t((()=>{O(),Vr(),cp(),B_(),Z_(),fv(),hv(),Sv=Object.keys(uv),Cv=sp(async()=>{if(gn()===null)try{Wt(await _v())}catch(e){I(e)}})}));function Tv(){if(g(process.env.DISABLE_COST_WARNINGS)||Y())return!1;let e=SC(),t=CC()!==null;if(!e.hasToken&&!t)return!1;let n=H(),r=n.oauthAccount?.organizationRole,i=n.oauthAccount?.workspaceRole;return!r||!i?!1:[`admin`,`billing`].includes(r)||[`workspace_admin`,`workspace_billing`].includes(i)}function Ev(e){Ov=e}function Dv(){if(Ov!==null)return Ov;if(!Y())return!1;let e=X();if(e===`max`||e===`pro`)return!0;let t=H().oauthAccount?.organizationRole;return!!t&&[`admin`,`billing`,`owner`,`primary_owner`].includes(t)}var Ov,kv=t((()=>{Q(),op(),h(),Ov=null}));function Av(){return process.env.USER_TYPE===`ant`?process.env.CLAUDE_MOCK_HEADERLESS_429?process.env.CLAUDE_MOCK_HEADERLESS_429:Bv?Vv:null:null}function jv(){return!Bv||process.env.USER_TYPE!==`ant`||Object.keys(zv).length===0?null:zv}function Mv(){zv={},Kv=[],Hv=null,Uv=null,Wv=null,Vv=null,Ev(null),Bv=!1}function Nv(e){let t=jv();if(!t)return e;let n=new globalThis.Headers(e);return Object.entries(t).forEach(([e,t])=>{t!==void 0&&n.set(e,t)}),n}function Pv(){return process.env.USER_TYPE===`ant`?Bv||!!process.env.CLAUDE_MOCK_HEADERLESS_429:!1}function Fv(){return!Bv||process.env.USER_TYPE!==`ant`?null:Hv||Gv}function Iv(){return Bv&&Hv!==null&&process.env.USER_TYPE===`ant`}function Lv(){return Uv!==null}function Rv(e){if(Uv===null||!e)return null;if(Wv!==null&&Date.now()>=Wv)return Mv(),null;Wv===null&&(Wv=Date.now()+Uv);let t=Wv-Date.now(),n={...zv};return n[`retry-after`]=String(Math.max(1,Math.ceil(t/1e3))),n}var zv,Bv,Vv,Hv,Uv,Wv,Gv,Kv,qv=t((()=>{kv(),zv={},Bv=!1,Vv=null,Hv=null,Uv=null,Wv=null,Gv=`max`}));async function Jv(){let e=H().oauthAccount?.accountUuid,t=CC();if(!e||!t)return;let n=`${P().BASE_API_URL}/api/claude_cli_profile`;try{return(await v.get(n,{headers:{"x-api-key":t,"anthropic-beta":Dr},params:{account_uuid:e},timeout:1e4})).data}catch(e){I(e)}}async function Yv(e){let t=`${P().BASE_API_URL}/api/oauth/profile`;try{return(await v.get(t,{headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},timeout:1e4})).data}catch(e){I(e)}}var Xv=t((()=>{Ie(),kr(),Q(),op(),Vr()}));function Zv(e){return!!e?.includes(Tr)}function Qv(e){return e?.split(` `).filter(Boolean)??[]}function $v({codeChallenge:e,state:t,port:n,isManual:r,loginWithClaudeAi:i,inferenceOnly:a,orgUUID:o,loginHint:s,loginMethod:c}){let l=i?P().CLAUDE_AI_AUTHORIZE_URL:P().CONSOLE_AUTHORIZE_URL,u=new URL(l);u.searchParams.append(`code`,`true`),u.searchParams.append(`client_id`,P().CLIENT_ID),u.searchParams.append(`response_type`,`code`),u.searchParams.append(`redirect_uri`,r?P().MANUAL_REDIRECT_URL:`http://localhost:${n}/callback`);let d=a?[Tr]:Or;return u.searchParams.append(`scope`,d.join(` `)),u.searchParams.append(`code_challenge`,e),u.searchParams.append(`code_challenge_method`,`S256`),u.searchParams.append(`state`,t),o&&u.searchParams.append(`orgUUID`,o),s&&u.searchParams.append(`login_hint`,s),c&&u.searchParams.append(`login_method`,c),u.toString()}async function ey(e,t,n,r,i=!1,a){let o={grant_type:`authorization_code`,code:e,redirect_uri:i?P().MANUAL_REDIRECT_URL:`http://localhost:${r}/callback`,client_id:P().CLIENT_ID,code_verifier:n,state:t};a!==void 0&&(o.expires_in=a);let s=await v.post(P().TOKEN_URL,o,{headers:{"Content-Type":`application/json`},timeout:15e3});if(s.status!==200)throw Error(s.status===401?`Authentication failed: Invalid authorization code`:`Token exchange failed (${s.status}): ${s.statusText}`);return N(`tengu_oauth_token_exchange_success`,{}),s.data}async function ty(e,{scopes:t}={}){let n={grant_type:`refresh_token`,refresh_token:e,client_id:P().CLIENT_ID,scope:(t?.length?t:Er).join(` `)};try{let t=await v.post(P().TOKEN_URL,n,{headers:{"Content-Type":`application/json`},timeout:15e3});if(t.status!==200)throw Error(`Token refresh failed: ${t.statusText}`);let r=t.data,{access_token:i,refresh_token:a=e,expires_in:o}=r,s=Date.now()+o*1e3,c=Qv(r.scope);N(`tengu_oauth_token_refresh_success`,{});let l=H(),u=Z(),d=l.oauthAccount?.billingType!==void 0&&l.oauthAccount?.accountCreatedAt!==void 0&&l.oauthAccount?.subscriptionCreatedAt!==void 0&&u?.subscriptionType!=null&&u?.rateLimitTier!=null?null:await ay(i);if(d&&l.oauthAccount){let e={};d.displayName!==void 0&&(e.displayName=d.displayName),typeof d.hasExtraUsageEnabled==`boolean`&&(e.hasExtraUsageEnabled=d.hasExtraUsageEnabled),d.billingType!==null&&(e.billingType=d.billingType),d.accountCreatedAt!==void 0&&(e.accountCreatedAt=d.accountCreatedAt),d.subscriptionCreatedAt!==void 0&&(e.subscriptionCreatedAt=d.subscriptionCreatedAt),Object.keys(e).length>0&&V(t=>({...t,oauthAccount:t.oauthAccount?{...t.oauthAccount,...e}:t.oauthAccount}))}return{accessToken:i,refreshToken:a,expiresAt:s,scopes:c,subscriptionType:d?.subscriptionType??u?.subscriptionType??null,rateLimitTier:d?.rateLimitTier??u?.rateLimitTier??null,profile:d?.rawProfile,tokenAccount:r.account?{uuid:r.account.uuid,emailAddress:r.account.email_address,organizationUuid:r.organization?.uuid}:void 0}}catch(e){let t=v.isAxiosError(e)&&e.response?.data?JSON.stringify(e.response.data):void 0;throw N(`tengu_oauth_token_refresh_failure`,{error:e.message,...t&&{responseBody:t}}),e}}async function ny(e){let t=await v.get(P().ROLES_URL,{headers:{Authorization:`Bearer ${e}`}});if(t.status!==200)throw Error(`Failed to fetch user roles: ${t.statusText}`);let n=t.data;if(!H().oauthAccount)throw Error(`OAuth account information not found in config`);V(e=>({...e,oauthAccount:e.oauthAccount?{...e.oauthAccount,organizationRole:n.organization_role,workspaceRole:n.workspace_role,organizationName:n.organization_name}:e.oauthAccount})),N(`tengu_oauth_roles_stored`,{org_role:n.organization_role})}async function ry(e){try{let t=await v.post(P().API_KEY_URL,null,{headers:{Authorization:`Bearer ${e}`}}),n=t.data?.raw_key;return n?(await $C(n),N(`tengu_oauth_api_key`,{status:`success`,statusCode:t.status}),n):null}catch(e){throw N(`tengu_oauth_api_key`,{status:`failure`,error:e instanceof Error?e.message:String(e)}),e}}function iy(e){return e===null?!1:Date.now()+300*1e3>=e}async function ay(e){let t=await Yv(e),n=t?.organization?.organization_type,r=null;switch(n){case`claude_max`:r=`max`;break;case`claude_pro`:r=`pro`;break;case`claude_enterprise`:r=`enterprise`;break;case`claude_team`:r=`team`;break;default:r=null;break}let i={subscriptionType:r,rateLimitTier:t?.organization?.rate_limit_tier??null,hasExtraUsageEnabled:t?.organization?.has_extra_usage_enabled??null,billingType:t?.organization?.billing_type??null};return t?.account?.display_name&&(i.displayName=t.account.display_name),t?.account?.created_at&&(i.accountCreatedAt=t.account.created_at),t?.organization?.subscription_created_at&&(i.subscriptionCreatedAt=t.organization.subscription_created_at),N(`tengu_oauth_profile_fetch_success`,{}),{...i,rawProfile:t}}async function oy(){let e=H().oauthAccount?.organizationUuid;if(e)return e;let t=Z()?.accessToken;return t===void 0||!dw()?null:(await Yv(t))?.organization?.uuid||null}async function sy(){let e=process.env.CLAUDE_CODE_ACCOUNT_UUID,t=process.env.CLAUDE_CODE_USER_EMAIL,n=process.env.CLAUDE_CODE_ORGANIZATION_UUID,r=!!(e&&t&&n);e&&t&&n&&(H().oauthAccount||cy({accountUuid:e,emailAddress:t,organizationUuid:n})),await lw();let i=H();if(i.oauthAccount&&i.oauthAccount.billingType!==void 0&&i.oauthAccount.accountCreatedAt!==void 0&&i.oauthAccount.subscriptionCreatedAt!==void 0||!Y()||!dw())return!1;let a=Z();if(a?.accessToken){let e=await Yv(a.accessToken);if(e)return r&&M(`OAuth profile fetch succeeded, overriding env var account info`,{level:`info`}),cy({accountUuid:e.account.uuid,emailAddress:e.account.email,organizationUuid:e.organization.uuid,displayName:e.account.display_name||void 0,hasExtraUsageEnabled:e.organization.has_extra_usage_enabled??!1,billingType:e.organization.billing_type??void 0,accountCreatedAt:e.account.created_at,subscriptionCreatedAt:e.organization.subscription_created_at??void 0}),!0}return!1}function cy({accountUuid:e,emailAddress:t,organizationUuid:n,displayName:r,hasExtraUsageEnabled:i,billingType:a,accountCreatedAt:o,subscriptionCreatedAt:s}){let c={accountUuid:e,emailAddress:t,organizationUuid:n,hasExtraUsageEnabled:i,billingType:a,accountCreatedAt:o,subscriptionCreatedAt:s};r&&(c.displayName=r),V(e=>e.oauthAccount?.accountUuid===c.accountUuid&&e.oauthAccount?.emailAddress===c.emailAddress&&e.oauthAccount?.organizationUuid===c.organizationUuid&&e.oauthAccount?.displayName===c.displayName&&e.oauthAccount?.hasExtraUsageEnabled===c.hasExtraUsageEnabled&&e.oauthAccount?.billingType===c.billingType&&e.oauthAccount?.accountCreatedAt===c.accountCreatedAt&&e.oauthAccount?.subscriptionCreatedAt===c.subscriptionCreatedAt?e:{...e,oauthAccount:c})}var ly=t((()=>{Ie(),hr(),kr(),Q(),op(),j(),Xv()}));function uy(e,t,n){if(g(process.env.CLAUDE_CODE_REMOTE))try{ra(hy,{recursive:!0,mode:448}),sa(e,t,{encoding:`utf8`,mode:384}),M(`Persisted ${n} to ${e} for subprocess access`)}catch(e){M(`Failed to persist ${n} to disk (non-fatal): ${pr(e)}`,{level:`error`})}}function dy(e,t){try{let n=A().readFileSync(e,{encoding:`utf8`}).trim();return n?(M(`Read ${t} from well-known file ${e}`),n):null}catch(n){return jn(n)||M(`Failed to read ${t} from ${e}: ${pr(n)}`,{level:`debug`}),null}}function fy({envVar:e,wellKnownPath:t,label:n,getCached:r,setCached:i}){let a=r();if(a!==void 0)return a;let o=process.env[e];if(!o){let e=dy(t,n);return i(e),e}let s=parseInt(o,10);if(Number.isNaN(s))return M(`${e} must be a valid file descriptor number, got: ${o}`,{level:`error`}),i(null),null;try{let e=A(),r=process.platform===`darwin`||process.platform===`freebsd`?`/dev/fd/${s}`:`/proc/self/fd/${s}`,a=e.readFileSync(r,{encoding:`utf8`}).trim();return a?(M(`Successfully read ${n} from file descriptor ${s}`),i(a),uy(t,a,n),a):(M(`File descriptor contained empty ${n}`,{level:`error`}),i(null),null)}catch(e){M(`Failed to read ${n} from file descriptor ${s}: ${pr(e)}`,{level:`error`});let r=dy(t,n);return i(r),r}}function py(){return fy({envVar:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,wellKnownPath:gy,label:`OAuth token`,getCached:Gt,setCached:Jt})}function my(){return fy({envVar:`CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR`,wellKnownPath:_y,label:`API key`,getCached:wn,setCached:ot})}var hy,gy,_y,vy,yy=t((()=>{O(),j(),h(),zn(),Vn(),hy=`/home/claude/.claude/remote`,gy=`${hy}/.oauth_token`,_y=`${hy}/.api_key`,vy=`${hy}/.session_ingress_token`}));function by(e=``){let t=ae(),n=process.env.CLAUDE_CONFIG_DIR?`-${ca(`sha256`).update(t).digest(`hex`).substring(0,8)}`:``;return`Claude Code${P().OAUTH_FILE_SUFFIX}${e}${n}`}function xy(){try{return process.env.USER||Gi().username}catch{return`claude-code-user`}}function Sy(){K.cache={data:null,cachedAt:0},K.generation++,K.readInFlight=null}function Cy(e){if(K.cache.cachedAt!==0)return;let t=null;if(e)try{t=JSON.parse(e)}catch{return}K.cache={data:t,cachedAt:Date.now()}}var wy,K,Ty=t((()=>{kr(),h(),wy=`-credentials`,K={cache:{data:null,cachedAt:0},generation:0,readInFlight:null}}));async function Ey(){if(process.platform===`darwin`&&(await Pr(`security delete-generic-password -a $USER -s "${by()}"`,{shell:!0,reject:!1})).exitCode!==0)throw Error(`Failed to delete keychain entry`)}function Dy(e){return e.slice(-20)}var Oy=t((()=>{Nr(),Ty()}));function ky(e){return e?.name===`CredentialsProviderError`}function Ay(e){if(!e||typeof e!=`object`)return!1;let t=e;if(!t.Credentials||typeof t.Credentials!=`object`)return!1;let n=t.Credentials;return typeof n.AccessKeyId==`string`&&typeof n.SecretAccessKey==`string`&&typeof n.SessionToken==`string`&&n.AccessKeyId.length>0&&n.SecretAccessKey.length>0&&n.SessionToken.length>0}async function jy(){let{STSClient:e,GetCallerIdentityCommand:t}=await import(`./dist-es-D1LN6CJd.js`);await new e().send(new t({}))}async function My(){try{M(`Clearing AWS credential provider cache`);let{fromIni:e}=await import(`./dist-es-DGn8uOwQ2.js`);await e({ignoreCache:!0})(),M(`AWS credential provider cache refreshed`)}catch{M(`Failed to clear AWS credential cache (this is expected if no credentials are configured)`)}}var Ny=t((()=>{j()})),Py,Fy=t((()=>{ft(),ce(),Py=class e{constructor(){_(this,`status`,{isAuthenticating:!1,output:[]}),_(this,`changed`,Ot()),_(this,`subscribe`,this.changed.subscribe)}static getInstance(){return e.instance||(e.instance=new e),e.instance}getStatus(){return{...this.status,output:[...this.status.output]}}startAuthentication(){this.status={isAuthenticating:!0,output:[]},this.changed.emit(this.getStatus())}addOutput(e){this.status.output.push(e),this.changed.emit(this.getStatus())}setError(e){this.status.error=e,this.changed.emit(this.getStatus())}endAuthentication(e){e?this.status={isAuthenticating:!1,output:[]}:this.status.isAuthenticating=!1,this.changed.emit(this.getStatus())}static reset(){e.instance&&(e.instance.changed.clear(),e.instance=null)}},_(Py,`instance`,null)})),Iy,Ly,Ry,zy,By,Vy,Hy,Uy,Wy,Gy,Ky,qy,Jy,Yy,Xy,Zy,Qy,$y,eb=t((()=>{Iy=`claude-code-20250219`,Ly=`interleaved-thinking-2025-05-14`,Ry=`context-1m-2025-08-07`,zy=`context-management-2025-06-27`,By=`structured-outputs-2025-12-15`,Vy=`web-search-2025-03-05`,Hy=`tool-search-tool-2025-10-19`,Uy=`effort-2025-11-24`,Wy=`task-budgets-2026-03-13`,Gy=`prompt-caching-scope-2026-01-05`,Ky=`fast-mode-2026-02-01`,qy=`redact-thinking-2026-02-12`,Jy=`token-efficient-tools-2026-03-28`,Yy=`afk-mode-2026-01-31`,Xy=process.env.USER_TYPE===`ant`?`cli-internal-2026-02-09`:``,Zy=`advisor-tool-2026-03-01`,Qy=new Set([Ly,Ry,Hy]),$y=new Set([Iy,Ly,zy])}));function tb(){return process.env.USER_TYPE===`ant`?bO(`tengu_ant_model_override`,null):null}function nb(){return process.env.USER_TYPE===`ant`?tb()?.antModels??[]:[]}function rb(e){if(process.env.USER_TYPE!==`ant`||e===void 0)return;let t=e.toLowerCase();return nb().find(n=>n.alias===e||t.includes(n.model.toLowerCase()))}var ib=t((()=>{XO()}));function ab(){return!g(process.env.CLAUDE_CODE_DISABLE_FAST_MODE)}function ob(){return ab()?cb()===null:!1}function sb(e,t){switch(e){case`free`:return t===`oauth`?`Fast mode requires a paid subscription`:`Fast mode unavailable during evaluation. Please purchase credits.`;case`preference`:return`Fast mode has been disabled by your organization`;case`extra_usage_disabled`:return`Fast mode requires extra usage billing · /extra-usage to enable`;case`network_error`:return`Fast mode unavailable due to network connectivity issues`;case`unknown`:return`Fast mode is currently unavailable`}}function cb(){if(!ab())return`Fast mode is not available`;let e=bO(`tengu_penguins_off`,null);if(e!==null)return M(`Fast mode unavailable: ${e}`),e;if(!Ar()&&bO(`tengu_marble_sandcastle`,!1))return`Fast mode requires the native binary · Install from: https://claude.com/product/claude-code`;if(Mt()&&rn()&&!xt()&&!U(`flagSettings`)?.fastMode){let e=`Fast mode is not available in the Agent SDK`;return M(`Fast mode unavailable: ${e}`),e}if(W()!==`firstParty`){let e=`Fast mode is not available on Bedrock, Vertex, or Foundry`;return M(`Fast mode unavailable: ${e}`),e}if(q.status===`disabled`){if((q.reason===`network_error`||q.reason===`unknown`)&&g(process.env.CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS))return null;let e=Z()===null?`api-key`:`oauth`,t=sb(q.reason,e);return M(`Fast mode unavailable: ${t}`),t}return null}function lb(){return`opus`+(Fx()?`[1m]`:``)}function ub(e){if(!ab()||!ob()||!db(e))return!1;let t=A_();return t.fastModePerSessionOptIn?!1:t.fastMode===!0}function db(e){if(!ab())return!1;let t=Bx(e??kx());return t.toLowerCase().includes(`opus-4-7`)||t.toLowerCase().includes(`opus-4-6`)}function fb(){return Tb.status===`cooldown`&&Date.now()>=Tb.resetAt&&(ab()&&!Eb&&(M(`Fast mode cooldown expired, re-enabling fast mode`),Eb=!0,Ob.emit()),Tb={status:`active`}),Tb}function pb(e,t){if(!ab())return;Tb={status:`cooldown`,resetAt:e,reason:t},Eb=!1;let n=e-Date.now();M(`Fast mode cooldown triggered (${t}), duration ${Math.round(n/1e3)}s`),N(`tengu_fast_mode_fallback_triggered`,{cooldown_duration_ms:n,cooldown_reason:t}),Db.emit(e,t)}function mb(){Tb={status:`active`}}function hb(){q.status!==`disabled`&&(q={status:`disabled`,reason:`preference`},T_(`userSettings`,{fastMode:void 0}),V(e=>({...e,penguinModeOrgEnabled:!1})),Nb.emit(!1))}function gb(e){switch(e){case`out_of_credits`:return`Fast mode disabled · extra usage credits exhausted`;case`org_level_disabled`:case`org_service_level_disabled`:return`Fast mode disabled · extra usage disabled by your organization`;case`org_level_disabled_until`:return`Fast mode disabled · extra usage spending cap reached`;case`member_level_disabled`:return`Fast mode disabled · extra usage disabled for your account`;case`seat_tier_level_disabled`:case`seat_tier_zero_credit_limit`:case`member_zero_credit_limit`:return`Fast mode disabled · extra usage not available for your plan`;case`overage_not_provisioned`:case`no_limits_configured`:return`Fast mode requires extra usage billing · /extra-usage to enable`;default:return`Fast mode disabled · extra usage not available`}}function _b(e){return e===`org_level_disabled_until`||e===`out_of_credits`}function vb(e){let t=gb(e);M(`Fast mode overage rejection: ${e??`unknown`} — ${t}`),N(`tengu_fast_mode_overage_rejected`,{overage_disabled_reason:e??`unknown`}),_b(e)||(T_(`userSettings`,{fastMode:void 0}),V(e=>({...e,penguinModeOrgEnabled:!1}))),jb.emit(t)}function yb(){return fb().status===`cooldown`}function bb(e,t){let n=ab()&&ob()&&!!t&&db(e);return n&&yb()?`cooldown`:n?`on`:`off`}async function xb(e){let t=`${P().BASE_API_URL}/api/claude_code_penguin_mode`,n=`accessToken`in e?{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":Dr}:{"x-api-key":e.apiKey};return(await v.get(t,{headers:n})).data}function Sb(){if(!ab()||q.status!==`pending`)return;let e=process.env.USER_TYPE===`ant`,t=H().penguinModeOrgEnabled===!0;q=e||t?{status:`enabled`}:{status:`disabled`,reason:`unknown`}}async function Cb(){if(Br()||!ab())return;if(Lb)return M(`Fast mode prefetch in progress, returning in-flight promise`),Lb;let e=CC();if(!(Z()?.accessToken&&dw())&&!e){let e=process.env.USER_TYPE===`ant`,t=H().penguinModeOrgEnabled===!0;q=e||t?{status:`enabled`}:{status:`disabled`,reason:`preference`};return}let t=Date.now();if(t-Ib<Fb){M(`Skipping fast mode prefetch, fetched recently`);return}Ib=t;let n=async()=>{let t=Z(),n=t?.accessToken&&dw()?{accessToken:t.accessToken}:e?{apiKey:e}:null;if(!n)throw Error(`No auth available`);return xb(n)};async function r(){try{let e;try{e=await n()}catch(t){if(v.isAxiosError(t)&&(t.response?.status===401||t.response?.status===403&&typeof t.response?.data==`string`&&t.response.data.includes(`OAuth token has been revoked`))){let r=Z()?.accessToken;if(r)await ow(r),e=await n();else throw t}else throw t}let t=q.status===`pending`?H().penguinModeOrgEnabled:q.status===`enabled`;q=e.enabled?{status:`enabled`}:{status:`disabled`,reason:e.disabled_reason??`preference`},t!==e.enabled&&(e.enabled||T_(`userSettings`,{fastMode:void 0}),V(t=>({...t,penguinModeOrgEnabled:e.enabled})),Nb.emit(e.enabled)),M(`Org fast mode: ${e.enabled?`enabled`:`disabled (${e.disabled_reason??`preference`})`}`)}catch(e){let t=process.env.USER_TYPE===`ant`,n=H().penguinModeOrgEnabled===!0;q=t||n?{status:`enabled`}:{status:`disabled`,reason:`network_error`},M(`Failed to fetch org fast mode status, defaulting to ${q.status===`enabled`?`enabled (cached)`:`disabled (network_error)`}: ${e}`,{level:`error`}),N(`tengu_org_penguin_mode_fetch_failed`,{})}finally{Lb=null}}return Lb=r(),Lb}var wb,Tb,Eb,Db,Ob,kb,Ab,jb,Mb,q,Nb,Pb,Fb,Ib,Lb,Rb=t((()=>{Ie(),kr(),XO(),O(),hr(),Q(),jr(),op(),j(),h(),Jx(),hv(),zr(),B_(),ft(),wb=`Opus 4.7`,Tb={status:`active`},Eb=!1,Db=Ot(),Ob=Ot(),kb=Db.subscribe,Ab=Ob.subscribe,jb=Ot(),Mb=jb.subscribe,q={status:`pending`},Nb=Ot(),Pb=Nb.subscribe,Fb=3e4,Ib=0,Lb=null}));function zb(e){return ab()&&e?Xb:Yb}function Bb(e,t){return t.input_tokens/1e6*e.inputTokens+t.output_tokens/1e6*e.outputTokens+(t.cache_read_input_tokens??0)/1e6*e.promptCacheReadTokens+(t.cache_creation_input_tokens??0)/1e6*e.promptCacheWriteTokens+(t.server_tool_use?.web_search_requests??0)*e.webSearchRequests}function Vb(e,t){let n=jx(e);return n===J(sv.firstParty)?zb(t.speed===`fast`):ex[n]||(Hb(e,n),ex[jx(kx())]??$b)}function Hb(e,t){N(`tengu_unknown_model_cost`,{model:e,shortName:t}),rt()}function Ub(e,t){return Bb(Vb(e,t),t)}function Wb(e,t){return Ub(e,{input_tokens:t.inputTokens,output_tokens:t.outputTokens,cache_read_input_tokens:t.cacheReadInputTokens,cache_creation_input_tokens:t.cacheCreationInputTokens})}function Gb(e){return Number.isInteger(e)?`$${e}`:`$${e.toFixed(2)}`}function Kb(e){return`${Gb(e.inputTokens)}/${Gb(e.outputTokens)} per Mtok`}var qb,Jb,Yb,Xb,Zb,Qb,$b,ex,tx=t((()=>{hr(),O(),Rb(),fv(),Jx(),qb={inputTokens:3,outputTokens:15,promptCacheWriteTokens:3.75,promptCacheReadTokens:.3,webSearchRequests:.01},Jb={inputTokens:15,outputTokens:75,promptCacheWriteTokens:18.75,promptCacheReadTokens:1.5,webSearchRequests:.01},Yb={inputTokens:5,outputTokens:25,promptCacheWriteTokens:6.25,promptCacheReadTokens:.5,webSearchRequests:.01},Xb={inputTokens:30,outputTokens:150,promptCacheWriteTokens:37.5,promptCacheReadTokens:3,webSearchRequests:.01},Zb={inputTokens:.8,outputTokens:4,promptCacheWriteTokens:1,promptCacheReadTokens:.08,webSearchRequests:.01},Qb={inputTokens:1,outputTokens:5,promptCacheWriteTokens:1.25,promptCacheReadTokens:.1,webSearchRequests:.01},$b=Yb,ex={[J(ev.firstParty)]:Zb,[J(tv.firstParty)]:Qb,[J($_.firstParty)]:qb,[J(Q_.firstParty)]:qb,[J(nv.firstParty)]:qb,[J(rv.firstParty)]:qb,[J(lv.firstParty)]:qb,[J(iv.firstParty)]:Jb,[J(av.firstParty)]:Jb,[J(ov.firstParty)]:Yb,[J(sv.firstParty)]:Yb}}));function nx(e){return ix.includes(e)}function rx(e){return ax.includes(e)}var ix,ax,ox=t((()=>{ix=[`sonnet`,`opus`,`haiku`,`best`,`sonnet[1m]`,`opus[1m]`,`opusplan`],ax=[`sonnet`,`opus`,`haiku`]}));function sx(e,t){return e.includes(t)?!0:nx(e)?Bx(e).toLowerCase().includes(t):!1}function cx(e,t){return e.startsWith(t)?e.length===t.length||e[t.length]===`-`:!1}function lx(e,t){let n=nx(e)?Bx(e).toLowerCase():e;return!!(cx(n,t)||!t.startsWith(`claude-`)&&cx(n,`claude-${t}`))}function ux(e,t){for(let n of t){if(rx(n))continue;let t=n.indexOf(e);if(t===-1)continue;let r=t+e.length;if(r===n.length||n[r]===`-`)return!0}return!1}function dx(e){let{availableModels:t}=z_()||{};if(!t)return!0;if(t.length===0)return!1;let n=yv(e).trim().toLowerCase(),r=t.map(e=>e.trim().toLowerCase());if(r.includes(n)&&(!rx(n)||!ux(n,r)))return!0;for(let e of r)if(rx(e)&&!ux(e,r)&&sx(n,e))return!0;if(nx(n)){let e=Bx(n).toLowerCase();if(r.includes(e))return!0}for(let e of r)if(!rx(e)&&nx(e)&&Bx(e).toLowerCase()===n)return!0;for(let e of r)if(!rx(e)&&!nx(e)&&lx(n,e))return!0;return!1}var fx=t((()=>{B_(),ox(),Jx(),wv()}));function px(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}function mx(e){let t=e.toLowerCase().replace(/\[1m\]$/,``);return _x.some(e=>e.value.toLowerCase()===t)}var hx,gx,_x,vx=t((()=>{hx=`gpt-5.5`,gx=`gpt-5.4-mini`,_x=[{value:`gpt-5.5`,label:`GPT-5.5`,description:`Frontier model for complex coding, research, and real-world work`},{value:`gpt-5.4`,label:`GPT-5.4`,description:`Strong model for everyday coding`},{value:`gpt-5.4-mini`,label:`GPT-5.4-Mini`,description:`Small, fast, and cost-efficient model for simpler coding tasks`},{value:`gpt-5.3-codex`,label:`GPT-5.3-Codex`,description:`Coding-optimized model`},{value:`gpt-5.3-codex-spark`,label:`GPT-5.3-Codex-Spark`,description:`Ultra-fast coding model`},{value:`gpt-5.2`,label:`GPT-5.2`,description:`Optimized for professional work and long-running agents`}]}));function yx(){let e=W();return e===`openai`&&px()?process.env.OPENAI_SMALL_FAST_MODEL??`gpt-5.4-mini`:e===`openai`&&process.env.OPENAI_SMALL_FAST_MODEL?process.env.OPENAI_SMALL_FAST_MODEL:e===`gemini`&&process.env.GEMINI_SMALL_FAST_MODEL?process.env.GEMINI_SMALL_FAST_MODEL:process.env.ANTHROPIC_SMALL_FAST_MODEL||Dx()}function bx(e){return e===G().opus40||e===G().opus41||e===G().opus45||e===G().opus46||e===G().opus47}function xx(){let e,t=$t();if(t!==void 0)e=t;else{let t=z_()||{};e=process.env.ANTHROPIC_MODEL||t.model||void 0}if(!(e&&!dx(e)))return e}function Sx(){let e=xx();return e==null?Ax():Bx(e)}function Cx(){return Tx()}function wx(){let e=W();if(e===`openai`)return process.env.OPENAI_MODEL;if(e===`gemini`)return process.env.GEMINI_MODEL;if(e===`grok`)return process.env.GROK_MODEL}function Tx(){let e=W();return e===`openai`&&px()?hx:e===`openai`&&process.env.OPENAI_DEFAULT_OPUS_MODEL?process.env.OPENAI_DEFAULT_OPUS_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_OPUS_MODEL?process.env.GEMINI_DEFAULT_OPUS_MODEL:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL?process.env.ANTHROPIC_DEFAULT_OPUS_MODEL:wx()||G().opus47}function Ex(){let e=W();return e===`openai`&&px()?hx:e===`openai`&&process.env.OPENAI_DEFAULT_SONNET_MODEL?process.env.OPENAI_DEFAULT_SONNET_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_SONNET_MODEL?process.env.GEMINI_DEFAULT_SONNET_MODEL:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL?process.env.ANTHROPIC_DEFAULT_SONNET_MODEL:wx()||(e===`firstParty`?G().sonnet46:G().sonnet45)}function Dx(){let e=W();return e===`openai`&&px()?gx:e===`openai`&&process.env.OPENAI_DEFAULT_HAIKU_MODEL?process.env.OPENAI_DEFAULT_HAIKU_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_HAIKU_MODEL?process.env.GEMINI_DEFAULT_HAIKU_MODEL:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL?process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL:wx()||G().haiku45}function Ox(e){let{permissionMode:t,mainLoopModel:n,exceeds200kTokens:r=!1}=e;return xx()===`opusplan`&&t===`plan`&&!r?Tx():xx()===`haiku`&&t===`plan`?Ex():n}function kx(){return process.env.USER_TYPE===`ant`?tb()?.defaultModel??Tx()+`[1m]`:gw()||vw()?Tx()+(Fx()?`[1m]`:``):Ex()}function Ax(){return Bx(kx())}function J(e){if(e=e.toLowerCase(),e.includes(`claude-opus-4-7`))return`claude-opus-4-7`;if(e.includes(`claude-opus-4-6`))return`claude-opus-4-6`;if(e.includes(`claude-opus-4-5`))return`claude-opus-4-5`;if(e.includes(`claude-opus-4-1`))return`claude-opus-4-1`;if(e.includes(`claude-opus-4`))return`claude-opus-4`;if(e.includes(`claude-sonnet-4-6`))return`claude-sonnet-4-6`;if(e.includes(`claude-sonnet-4-5`))return`claude-sonnet-4-5`;if(e.includes(`claude-sonnet-4`))return`claude-sonnet-4`;if(e.includes(`claude-haiku-4-5`))return`claude-haiku-4-5`;if(e.includes(`claude-3-7-sonnet`))return`claude-3-7-sonnet`;if(e.includes(`claude-3-5-sonnet`))return`claude-3-5-sonnet`;if(e.includes(`claude-3-5-haiku`))return`claude-3-5-haiku`;if(e.includes(`claude-3-opus`))return`claude-3-opus`;if(e.includes(`claude-3-sonnet`))return`claude-3-sonnet`;if(e.includes(`claude-3-haiku`))return`claude-3-haiku`;let t=e.match(/(claude-(\d+-\d+-)?\w+)/);return t&&t[1]?t[1]:e}function jx(e){return J(yv(e))}function Mx(e=!1){return gw()||vw()?Fx()?`Opus 4.7 with 1M context · Most capable for complex work${e?Px(!0):``}`:`Opus 4.7 · Most capable for complex work${e?Px(!0):``}`:`Sonnet 4.6 · Best for everyday tasks`}function Nx(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:zx(Bx(e))}function Px(e){if(W()!==`firstParty`)return``;let t=Kb(zb(e));return` ·${e?` (↯)`:``} ${t}`}function Fx(){return!(fS()||bw()||W()!==`firstParty`||!mv()||Y()&&X()===null)}function Ix(e){return e===`opusplan`?`Opus Plan`:nx(e)?Ni(e):zx(e)}function Lx(e){switch(e){case G().opus47:return`Opus 4.7`;case G().opus47+`[1m]`:return`Opus 4.7 (1M context)`;case G().opus46:return`Opus 4.6`;case G().opus46+`[1m]`:return`Opus 4.6 (1M context)`;case G().opus45:return`Opus 4.5`;case G().opus41:return`Opus 4.1`;case G().opus40:return`Opus 4`;case G().sonnet46+`[1m]`:return`Sonnet 4.6 (1M context)`;case G().sonnet46:return`Sonnet 4.6`;case G().sonnet45+`[1m]`:return`Sonnet 4.5 (1M context)`;case G().sonnet45:return`Sonnet 4.5`;case G().sonnet40:return`Sonnet 4`;case G().sonnet40+`[1m]`:return`Sonnet 4 (1M context)`;case G().sonnet37:return`Sonnet 3.7`;case G().sonnet35:return`Sonnet 3.5`;case G().haiku45:return`Haiku 4.5`;case G().haiku35:return`Haiku 3.5`;default:return null}}function Rx(e){let[t=``,...n]=e.split(`-`);return[t.slice(0,3)+`*`.repeat(Math.max(0,t.length-3)),...n].join(`-`)}function zx(e){let t=Lx(e);if(t)return t;if(process.env.USER_TYPE===`ant`){let t=Bx(e),n=rb(e);return n?Rx(n.model.replace(/\[1m\]$/i,``))+(pS(t)?`[1m]`:``):t===e?t:`${e} (${t})`}return e}function Bx(e){let t=e.trim(),n=t.toLowerCase(),r=pS(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(nx(i))switch(i){case`opusplan`:return Ex()+(r?`[1m]`:``);case`sonnet`:return Ex()+(r?`[1m]`:``);case`haiku`:return Dx()+(r?`[1m]`:``);case`opus`:return Tx()+(r?`[1m]`:``);case`best`:return Cx();default:}if(W()===`firstParty`&&Hx(i)&&Ux())return Tx()+(r?`[1m]`:``);if(process.env.USER_TYPE===`ant`){let e=pS(n),t=rb(n.replace(/\[1m]$/i,``).trim());if(t){let n=e?`[1m]`:``;return t.model+n}}return r?t.replace(/\[1m\]$/i,``).trim()+`[1m]`:t}function Vx(e,t){return pS(e)||!pS(t)?e:mS(Bx(e))?e+`[1m]`:e}function Hx(e){return qx.includes(e)}function Ux(){return!g(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function Wx(e){if(e===null)return process.env.USER_TYPE===`ant`?`Default for Ants (${Nx(kx())})`:Y()?`Default (${Mx()})`:`Default (${Ax()})`;let t=Bx(e);return e===t?t:`${e} (${t})`}function Gx(e){if(W()===`foundry`)return;let t=e.toLowerCase().includes(`[1m]`),n=jx(e);if(n.includes(`claude-opus-4-7`))return t?`Opus 4.7 (with 1M context)`:`Opus 4.7`;if(n.includes(`claude-opus-4-6`))return t?`Opus 4.6 (with 1M context)`:`Opus 4.6`;if(n.includes(`claude-opus-4-5`))return`Opus 4.5`;if(n.includes(`claude-opus-4-1`))return`Opus 4.1`;if(n.includes(`claude-opus-4`))return`Opus 4`;if(n.includes(`claude-sonnet-4-6`))return t?`Sonnet 4.6 (with 1M context)`:`Sonnet 4.6`;if(n.includes(`claude-sonnet-4-5`))return t?`Sonnet 4.5 (with 1M context)`:`Sonnet 4.5`;if(n.includes(`claude-sonnet-4`))return t?`Sonnet 4 (with 1M context)`:`Sonnet 4`;if(n.includes(`claude-3-7-sonnet`))return`Claude 3.7 Sonnet`;if(n.includes(`claude-3-5-sonnet`))return`Claude 3.5 Sonnet`;if(n.includes(`claude-haiku-4-5`))return`Haiku 4.5`;if(n.includes(`claude-3-5-haiku`))return`Claude 3.5 Haiku`}function Kx(e){return e.replace(/\[(1|2)m\]/gi,``)}var qx,Jx=t((()=>{O(),ib(),Q(),ES(),h(),wv(),tx(),B_(),hv(),Kp(),fx(),ox(),Pi(),vx(),qx=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));function Yx(){return{error:(e,...t)=>console.error(`[Anthropic SDK ERROR]`,e,...t),warn:(e,...t)=>console.error(`[Anthropic SDK WARN]`,e,...t),info:(e,...t)=>console.error(`[Anthropic SDK INFO]`,e,...t),debug:(e,...t)=>console.error(`[Anthropic SDK DEBUG]`,e,...t)}}async function Xx({apiKey:e,maxRetries:t,model:r,fetchOverride:i,source:a}){let o=process.env.CLAUDE_CODE_CONTAINER_ID,s=process.env.CLAUDE_CODE_REMOTE_SESSION_ID,c=process.env.CLAUDE_AGENT_SDK_CLIENT_APP,l=Qx(),u={"x-app":`cli`,"User-Agent":rT(),"X-Claude-Code-Session-Id":at(),...l,...o?{"x-claude-remote-container-id":o}:{},...s?{"x-claude-remote-session-id":s}:{},...c?{"x-client-app":c}:{},...process.env.ANTHROPIC_AUTH_NONCE?{"x-auth-nonce":process.env.ANTHROPIC_AUTH_NONCE}:{}};M(`[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: ${!!process.env.ANTHROPIC_CUSTOM_HEADERS}, has Authorization header: ${!!l.Authorization}`),g(process.env.CLAUDE_CODE_ADDITIONAL_PROTECTION)&&(u[`x-anthropic-additional-protection`]=`true`),M(`[API:auth] OAuth token check starting`),await lw(),M(`[API:auth] OAuth token check complete`),Y()||await Zx(u,Mt());let d=$x(i,a),f={defaultHeaders:u,maxRetries:t,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:Ii({forAnthropicAPI:!0}),...d&&{fetch:d}};if(g(process.env.CLAUDE_CODE_USE_BEDROCK)){let{BedrockClient:e}=await import(`./bedrockClient-BfPpXPI0.js`),t=r===yx()&&process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION?process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:oe(),n={...f,awsRegion:t,...g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&{skipAuth:!0},...Kn()&&{logger:Yx()}};if(process.env.AWS_BEARER_TOKEN_BEDROCK)n.skipAuth=!0,n.defaultHeaders={...n.defaultHeaders,Authorization:`Bearer ${process.env.AWS_BEARER_TOKEN_BEDROCK}`};else if(!g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)){let e=await Lw();e&&(n.awsAccessKey=e.accessKeyId,n.awsSecretKey=e.secretAccessKey,n.awsSessionToken=e.sessionToken)}return new e(n)}if(g(process.env.CLAUDE_CODE_USE_FOUNDRY)){let{AnthropicFoundry:e}=await import(`./foundry-sdk-BFN5VDFQ.js`),t;if(!process.env.ANTHROPIC_FOUNDRY_API_KEY)if(g(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH))t=()=>Promise.resolve(``);else{let{DefaultAzureCredential:e,getBearerTokenProvider:n}=await import(`./esm-CsGLyWmS.js`);t=n(new e,`https://cognitiveservices.azure.com/.default`)}return new e({...f,...t&&{azureADTokenProvider:t},...Kn()&&{logger:Yx()}})}if(g(process.env.CLAUDE_CODE_USE_VERTEX)){g(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)||await Vw();let[{AnthropicVertex:e},{GoogleAuth:t}]=await Promise.all([import(`./vertex-sdk-CSGw3fvU.js`),import(`./src-hdbPEvzO.js`).then(e=>n(e.default,1))]),i=process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project,a=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials,o=g(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)?{getClient:()=>({getRequestHeaders:()=>({})})}:new t({scopes:[`https://www.googleapis.com/auth/cloud-platform`],...i||a?{}:{projectId:process.env.ANTHROPIC_VERTEX_PROJECT_ID}});return new e({...f,region:te(r),googleAuth:o,...Kn()&&{logger:Yx()}})}return new se({apiKey:Y()?null:e||CC(),authToken:Y()?Z()?.accessToken:void 0,...process.env.USER_TYPE===`ant`&&g(process.env.USE_STAGING_OAUTH)?{baseURL:P().BASE_API_URL}:{},...f,...Kn()&&{logger:Yx()}})}async function Zx(e,t){let n=process.env.ANTHROPIC_AUTH_TOKEN||await PC(t);n&&(e.Authorization=`Bearer ${n}`)}function Qx(){let e={},t=process.env.ANTHROPIC_CUSTOM_HEADERS;if(!t)return e;let n=t.split(/\n|\r\n/);for(let t of n){if(!t.trim())continue;let n=t.indexOf(`:`);if(n===-1)continue;let r=t.slice(0,n).trim(),i=t.slice(n+1).trim();r&&(e[r]=i)}return e}function $x(e,t){let n=e??globalThis.fetch,r=W()===`firstParty`&&mv();return(e,i)=>{let a=new Headers(i?.headers);r&&!a.has(`x-client-request-id`)&&a.set(eS,ua());try{let n=e instanceof Request?e.url:String(e),r=a.get(eS);M(`[API REQUEST] ${new URL(n).pathname}${r?` ${eS}=${r}`:``} source=${t??`unknown`}`)}catch{}return n(e,{...i,headers:a})}}var eS,tS=t((()=>{vr(),Q(),cT(),Jx(),hv(),Li(),O(),kr(),j(),h(),eS=`x-client-request-id`}));function nS(){return R(ae(),`cache`)}function rS(){return R(nS(),`model-capabilities.json`)}function iS(){return!(W()!==`firstParty`||!mv())}function aS(e){return[...e].sort((e,t)=>t.id.length-e.id.length||e.id.localeCompare(t.id))}function oS(e){if(!iS())return;let t=uS(rS());if(!t||t.length===0)return;let n=e.toLowerCase();return t.find(e=>e.id.toLowerCase()===n)||t.find(e=>n.includes(e.id.toLowerCase()))}async function sS(){if(iS()&&!Br())try{let e=await Xx({maxRetries:1}),t=Y()?[Dr]:void 0,n=[];for await(let r of e.models.list({betas:t})){let e=cS().safeParse(r);e.success&&n.push(e.data)}if(n.length===0)return;let r=rS(),i=aS(n);if(Mu(uS(r),i)){M(`[modelCapabilities] cache unchanged, skipping write`);return}await fa(nS(),{recursive:!0}),await va(r,k({models:i,timestamp:Date.now()}),{encoding:`utf-8`,mode:384}),uS.cache.delete(r),M(`[modelCapabilities] cached ${i.length} models`)}catch(e){M(`[modelCapabilities] fetch failed: ${e instanceof Error?e.message:`unknown`}`)}}var cS,lS,uS,dS=t((()=>{Nu(),m(),Je(),kr(),tS(),Q(),j(),h(),di(),Ei(),zr(),An(),hv(),cS=L(()=>D({id:b(),max_input_tokens:y().optional(),max_tokens:y().optional()}).strip()),lS=L(()=>D({models:S(cS()),timestamp:y()})),uS=p(e=>{try{let t=ia(e,`utf-8`),n=lS().safeParse(fi(t,!1));return n.success?n.data.models:null}catch{return null}},e=>e)}));function fS(){return g(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function pS(e){return fS()?!1:/\[1m\]/i.test(e)}function mS(e){if(fS())return!1;let t=jx(e);return t.includes(`claude-sonnet-4`)||t.includes(`opus-4-6`)||t.includes(`opus-4-7`)}function hS(e,t){if(process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS){let e=parseInt(process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS,10);if(!isNaN(e)&&e>0)return e}if(pS(e))return 1e6;let n=oS(e);if(n?.max_input_tokens&&n.max_input_tokens>=1e5)return n.max_input_tokens>2e5&&fS()?bS:n.max_input_tokens;if(t?.includes(`context-1m-2025-08-07`)&&mS(e)||gS(e))return 1e6;if(process.env.USER_TYPE===`ant`){let t=rb(e);if(t?.contextWindow)return t.contextWindow}return bS}function gS(e){return fS()||pS(e)||!jx(e).includes(`sonnet-4-6`)?!1:H().clientDataCache?.coral_reef_sonnet===`true`}function _S(e,t){if(!e)return{used:null,remaining:null};let n=e.input_tokens+e.cache_creation_input_tokens+e.cache_read_input_tokens;if(n===0)return{used:null,remaining:null};let r=Math.round(n/t*100),i=Math.min(100,Math.max(0,r));return{used:i,remaining:100-i}}function vS(e){let t,n;if(process.env.USER_TYPE===`ant`){let r=rb(e.toLowerCase());if(r)return t=r.defaultMaxTokens??SS,n=r.upperMaxTokensLimit??CS,{default:t,upperLimit:n}}let r=jx(e);r.includes(`opus-4-7`)||r.includes(`opus-4-6`)?(t=64e3,n=128e3):r.includes(`sonnet-4-6`)?(t=32e3,n=128e3):r.includes(`opus-4-5`)||r.includes(`sonnet-4`)||r.includes(`haiku-4`)?(t=32e3,n=64e3):r.includes(`opus-4-1`)||r.includes(`opus-4`)?(t=32e3,n=32e3):r.includes(`claude-3-opus`)?(t=4096,n=4096):r.includes(`claude-3-sonnet`)?(t=8192,n=8192):r.includes(`claude-3-haiku`)?(t=4096,n=4096):r.includes(`3-5-sonnet`)||r.includes(`3-5-haiku`)?(t=8192,n=8192):r.includes(`3-7-sonnet`)?(t=32e3,n=64e3):(t=SS,n=CS);let i=oS(e);return i?.max_tokens&&i.max_tokens>=4096&&(n=i.max_tokens,t=Math.min(t,n)),{default:t,upperLimit:n}}function yS(e){return vS(e).upperLimit-1}var bS,xS,SS,CS,wS,TS,ES=t((()=>{eb(),op(),h(),Jx(),ib(),dS(),bS=2e5,xS=2e4,SS=32e3,CS=64e3,wS=8e3,TS=64e3})),DS,OS,kS,AS=t((()=>{m(),hv(),DS=[{modelEnvVar:`ANTHROPIC_DEFAULT_OPUS_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`ANTHROPIC_DEFAULT_SONNET_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`ANTHROPIC_DEFAULT_HAIKU_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`}],OS=[{modelEnvVar:`OPENAI_DEFAULT_OPUS_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`OPENAI_DEFAULT_SONNET_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`OPENAI_DEFAULT_HAIKU_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`}],kS=p((e,t)=>{if(W()===`firstParty`)return;let n=e.toLowerCase(),r=W()===`openai`?OS:DS;for(let e of r){let r=process.env[e.modelEnvVar],i=process.env[e.capabilitiesEnvVar];if(!(!r||i===void 0)&&n===r.toLowerCase())return i.toLowerCase().split(`,`).map(e=>e.trim()).includes(t)}},(e,t)=>`${e.toLowerCase()}:${t}`)}));function jS(e){let t=[],n=[];for(let r of e)HS.includes(r)?t.push(r):n.push(r);return{allowed:t,disallowed:n}}function MS(e){if(!e||e.length===0)return;if(Y()){console.warn(`Warning: Custom betas are only available for API key users. Ignoring provided betas.`);return}let{allowed:t,disallowed:n}=jS(e);for(let e of n)console.warn(`Warning: Beta header '${e}' is not allowed. Only the following betas are supported: ${HS.join(`, `)}`);return t.length>0?t:void 0}function NS(e){let t=kS(e,`interleaved_thinking`);if(t!==void 0)return t;let n=jx(e),r=W();return r===`foundry`?!0:r===`firstParty`?!n.includes(`claude-3-`):n.includes(`claude-opus-4`)||n.includes(`claude-sonnet-4`)}function PS(e){let t=jx(e);return t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function FS(e){let t=jx(e),n=W();return n===`foundry`?!0:n===`firstParty`?!t.includes(`claude-3-`):t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function IS(e){let t=jx(e),n=W();return n!==`firstParty`&&n!==`foundry`?!1:t.includes(`claude-sonnet-4-6`)||t.includes(`claude-sonnet-4-5`)||t.includes(`claude-opus-4-1`)||t.includes(`claude-opus-4-5`)||t.includes(`claude-opus-4-6`)||t.includes(`claude-opus-4-7`)||t.includes(`claude-haiku-4-5`)}function LS(e){return!0}function RS(){return(W()===`firstParty`||W()===`foundry`)&&!g(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)&&mv()}function zS(){return W()===`firstParty`&&!g(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function BS(e,t){let n=[...WS(e)];t?.isAgenticQuery&&(n.includes(`claude-code-20250219`)||n.push(Iy),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&Xy&&!n.includes(Xy)&&n.push(Xy));let r=Cn();return!r||r.length===0?n:[...n,...r.filter(e=>!n.includes(e))]}function VS(){US.cache?.clear?.(),WS.cache?.clear?.(),GS.cache?.clear?.()}var HS,US,WS,GS,KS=t((()=>{m(),XO(),O(),eb(),kr(),Q(),ES(),h(),Jx(),AS(),hv(),B_(),HS=[Ry],US=p(e=>{let t=[],n=jx(e).includes(`haiku`),r=W(),i=RS();n||(t.push(Iy),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&Xy&&t.push(Xy)),Y()&&t.push(Dr),pS(e)&&t.push(Ry),!g(process.env.DISABLE_INTERLEAVED_THINKING)&&NS(e)&&t.push(Ly),i&&NS(e)&&!Mt()&&A_().showThinkingSummaries!==!0&&t.push(qy);let a=g(process.env.USE_API_CONTEXT_MANAGEMENT)||FS(e),o=FS(e);RS()&&(a||o)&&t.push(zy);let s=SO(`tengu_tool_pear`),c=!s&&bO(`tengu_amber_json_tools`,!1);return i&&IS(e)&&s&&t.push(By),process.env.USER_TYPE===`ant`&&i&&c&&t.push(Jy),r===`vertex`&&PS(e)&&t.push(Vy),r===`foundry`&&t.push(Vy),i&&t.push(Gy),process.env.ANTHROPIC_BETAS&&t.push(...process.env.ANTHROPIC_BETAS.split(`,`).map(e=>e.trim()).filter(Boolean)),t}),WS=p(e=>{let t=US(e);return W()===`bedrock`?t.filter(e=>!Qy.has(e)):t}),GS=p(e=>US(e).filter(e=>Qy.has(e)))}));function qS(e,t){return{name:`${e.name}-with-${t.name}-fallback`,read(){return e.read()??(t.read()||{})},async readAsync(){return await e.readAsync()??(await t.readAsync()||{})},update(n){let r=e.read(),i=e.update(n);if(i.success)return r===null&&t.delete(),i;let a=t.update(n);return a.success?(r!==null&&e.delete(),{success:!0,warning:a.warning}):{success:!1}},delete(){let n=e.delete(),r=t.delete();return n||r}}}var JS=t((()=>{}));async function YS(){try{let e=by(wy),{stdout:t,code:n}=await ai(`security`,[`find-generic-password`,`-a`,xy(),`-w`,`-s`,e],{useCwd:!1,preserveOutputOnError:!1});if(n===0&&t)return kn(t.trim())}catch{}return null}function XS(){if($S!==void 0)return $S;if(process.platform!==`darwin`)return $S=!1,!1;try{$S=Mr(`security`,[`show-keychain-info`],{reject:!1,stdio:[`ignore`,`pipe`,`pipe`]}).exitCode===36}catch{$S=!1}return $S}var ZS,QS,$S,eC=t((()=>{Nr(),j(),ii(),ti(),An(),Ty(),ZS=4032,QS={name:`keychain`,read(){let e=K.cache;if(Date.now()-e.cachedAt<3e4)return e.data;try{let e=by(wy),t=ni(`security find-generic-password -a "${xy()}" -w -s "${e}"`);if(t){let e=kn(t);return K.cache={data:e,cachedAt:Date.now()},e}}catch{}return e.data===null?(K.cache={data:null,cachedAt:Date.now()},null):(M(`[keychain] read failed; serving stale cache`,{level:`warn`}),K.cache={data:e.data,cachedAt:Date.now()},e.data)},async readAsync(){let e=K.cache;if(Date.now()-e.cachedAt<3e4)return e.data;if(K.readInFlight)return K.readInFlight;let t=K.generation,n=YS().then(n=>{if(t===K.generation){n===null&&e.data!==null&&M(`[keychain] readAsync failed; serving stale cache`,{level:`warn`});let t=n??e.data;return K.cache={data:t,cachedAt:Date.now()},K.readInFlight=null,t}return n});return K.readInFlight=n,n},update(e){Sy();try{let t=by(wy),n=xy(),r=k(e),i=Buffer.from(r,`utf-8`).toString(`hex`),a=`add-generic-password -U -a "${n}" -s "${t}" -X "${i}"\n`,o;return a.length<=ZS?o=Mr(`security`,[`-i`],{input:a,stdio:[`pipe`,`pipe`,`pipe`],reject:!1}):(M(`Keychain payload (${r.length}B JSON) exceeds security -i stdin limit; using argv`,{level:`warn`}),o=Mr(`security`,[`add-generic-password`,`-U`,`-a`,n,`-s`,t,`-X`,i],{stdio:[`ignore`,`pipe`,`pipe`],reject:!1})),o.exitCode===0?(K.cache={data:e,cachedAt:Date.now()},{success:!0}):{success:!1}}catch{return{success:!1}}},delete(){Sy();try{let e=by(wy);return ni(`security delete-generic-password -a "${xy()}" -s "${e}"`),!0}catch{return!1}}}}));function tC(){let e=ae();return{storageDir:e,storagePath:R(e,`.credentials.json`)}}var nC,rC=t((()=>{h(),zn(),Vn(),An(),nC={name:`plaintext`,read(){let{storagePath:e}=tC();try{return kn(A().readFileSync(e,{encoding:`utf8`}))}catch{return null}},async readAsync(){let{storagePath:e}=tC();try{return kn(await A().readFile(e,{encoding:`utf8`}))}catch{return null}},update(e){try{let{storageDir:t,storagePath:n}=tC();try{A().mkdirSync(t)}catch(e){if(Dn(e)!==`EEXIST`)throw e}return En(n,k(e),{encoding:`utf8`,flush:!1}),ta(n,384),{success:!0,warning:`Warning: Storing credentials in plaintext.`}}catch{return{success:!1}}},delete(){let{storagePath:e}=tC();try{return A().unlinkSync(e),!0}catch(e){return Dn(e)===`ENOENT`}}}}));function iC(){return process.platform===`darwin`?qS(QS,nC):nC}var aC=t((()=>{JS(),eC(),rC()}));function oC(e){return new Promise(t=>{ba(`security`,[`find-generic-password`,`-a`,xy(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:dC},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function sC(){if(process.platform!==`darwin`||pC||ne())return;let e=oC(by(wy)),t=oC(by());pC=Promise.all([e,t]).then(([e,t])=>{e.timedOut||Cy(e.stdout),t.timedOut||(fC={stdout:t.stdout})})}async function cC(){pC&&await pC}function lC(){return fC}function uC(){fC=null}var dC,fC,pC,mC=t((()=>{h(),Ty(),dC=1e4,fC=null,pC=null}));function hC(){return _C}function gC(){_C.clear()}var _C,vC=t((()=>{_C=new Map})),yC=r({calculateApiKeyHelperTTL:()=>MC,checkAndRefreshOAuthTokenIfNeeded:()=>lw,checkGcpCredentialsValid:()=>KC,clearApiKeyHelperCache:()=>RC,clearAwsCredentialsCache:()=>UC,clearGcpCredentialsCache:()=>YC,clearOAuthTokenCache:()=>iw,getAccountInformation:()=>kw,getAnthropicApiKey:()=>CC,getAnthropicApiKeyWithSource:()=>TC,getApiKeyFromApiKeyHelper:()=>PC,getApiKeyFromApiKeyHelperCached:()=>LC,getApiKeyFromConfigOrMacOSKeychain:()=>Hw,getApiKeyHelperElapsedMs:()=>NC,getAuthTokenSource:()=>SC,getClaudeAIOAuthTokens:()=>Z,getClaudeAIOAuthTokensAsync:()=>cw,getConfiguredApiKeyHelper:()=>EC,getOauthAccountInfo:()=>pw,getOtelHeadersFromHelper:()=>Ew,getRateLimitTier:()=>xw,getSubscriptionName:()=>Sw,getSubscriptionType:()=>X,handleOAuth401Error:()=>ow,hasAnthropicApiKeyAuth:()=>wC,hasOpusAccess:()=>hw,hasProfileScope:()=>dw,is1PApiCustomer:()=>fw,isAnthropicAuthEnabled:()=>xC,isAwsAuthRefreshFromProjectSettings:()=>kC,isAwsCredentialExportFromProjectSettings:()=>jC,isClaudeAISubscriber:()=>Y,isConsumerSubscriber:()=>Ow,isCustomApiKeyApproved:()=>ew,isEnterpriseSubscriber:()=>yw,isGcpAuthRefreshFromProjectSettings:()=>GC,isMaxSubscriber:()=>gw,isOtelHeadersHelperFromProjectOrLocalSettings:()=>Tw,isOverageProvisioningAllowed:()=>mw,isProSubscriber:()=>bw,isTeamPremiumSubscriber:()=>vw,isTeamSubscriber:()=>_w,isUsing3PServices:()=>Cw,prefetchApiKeyFromApiKeyHelperIfSafe:()=>zC,prefetchAwsCredentialsAndBedRockInfoIfSafe:()=>ZC,prefetchGcpCredentialsIfSafe:()=>XC,refreshAndGetAwsCredentials:()=>Lw,refreshAwsAuth:()=>VC,refreshGcpAuth:()=>JC,refreshGcpCredentialsIfNeeded:()=>Vw,removeApiKey:()=>tw,saveApiKey:()=>$C,saveOAuthTokensIfNeeded:()=>rw,validateForceLoginOrg:()=>Aw});function bC(){return g(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`}function xC(){if(ne())return!1;if(process.env.ANTHROPIC_UNIX_SOCKET)return!!process.env.CLAUDE_CODE_OAUTH_TOKEN;let e=z_()||{},t=g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||e.modelType===`openai`||e.modelType===`gemini`||!!process.env.OPENAI_BASE_URL||!!process.env.GEMINI_BASE_URL,n=e.apiKeyHelper,r=process.env.ANTHROPIC_AUTH_TOKEN||n||process.env.CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR,{source:i}=TC({skipRetrievingKeyFromApiKeyHelper:!0}),a=i===`ANTHROPIC_API_KEY`||i===`apiKeyHelper`;return!(t||r&&!bC()||a&&!bC())}function SC(){if(ne())return EC()?{source:`apiKeyHelper`,hasToken:!0}:{source:`none`,hasToken:!1};if(process.env.ANTHROPIC_AUTH_TOKEN&&!bC())return{source:`ANTHROPIC_AUTH_TOKEN`,hasToken:!0};if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{source:`CLAUDE_CODE_OAUTH_TOKEN`,hasToken:!0};if(py())return process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR?{source:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,hasToken:!0}:{source:`CCR_OAUTH_TOKEN_FILE`,hasToken:!0};if(EC()&&!bC())return{source:`apiKeyHelper`,hasToken:!0};let e=Z();return Zv(e?.scopes)&&e?.accessToken?{source:`claude.ai`,hasToken:!0}:{source:`none`,hasToken:!1}}function CC(){let{key:e}=TC();return e}function wC(){let{key:e,source:t}=TC({skipRetrievingKeyFromApiKeyHelper:!0});return e!==null&&t!==`none`}function TC(e={}){if(ne())return process.env.ANTHROPIC_API_KEY?{key:process.env.ANTHROPIC_API_KEY,source:`ANTHROPIC_API_KEY`}:EC()?{key:e.skipRetrievingKeyFromApiKeyHelper?null:LC(),source:`apiKeyHelper`}:{key:null,source:`none`};let t=re()?void 0:process.env.ANTHROPIC_API_KEY;if(rn()&&t)return{key:t,source:`ANTHROPIC_API_KEY`};if(g(process.env.CI)){let e=my();if(e)return{key:e,source:`ANTHROPIC_API_KEY`};if(!t&&!process.env.CLAUDE_CODE_OAUTH_TOKEN&&!process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR)throw Error(`ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN env var is required`);return t?{key:t,source:`ANTHROPIC_API_KEY`}:{key:null,source:`none`}}if(t&&H().customApiKeyResponses?.approved?.includes(Dy(t)))return{key:t,source:`ANTHROPIC_API_KEY`};let n=my();return n?{key:n,source:`ANTHROPIC_API_KEY`}:EC()?e.skipRetrievingKeyFromApiKeyHelper?{key:null,source:`apiKeyHelper`}:{key:LC(),source:`apiKeyHelper`}:Hw()||{key:null,source:`none`}}function EC(){return ne()?U(`flagSettings`)?.apiKeyHelper:(z_()||{}).apiKeyHelper}function DC(){let e=EC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.apiKeyHelper===e||n?.apiKeyHelper===e}function OC(){return(z_()||{}).awsAuthRefresh}function kC(){let e=OC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.awsAuthRefresh===e||n?.awsAuthRefresh===e}function AC(){return(z_()||{}).awsCredentialExport}function jC(){let e=AC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.awsCredentialExport===e||n?.awsCredentialExport===e}function MC(){let e=process.env.CLAUDE_CODE_API_KEY_HELPER_TTL_MS;if(e){let t=parseInt(e,10);if(!Number.isNaN(t)&&t>=0)return t;M(`Found CLAUDE_CODE_API_KEY_HELPER_TTL_MS env var, but it was not a valid number. Got ${e}`,{level:`error`})}return jw}function NC(){let e=Nw?.startedAt;return e?Date.now()-e:0}async function PC(e){if(!EC())return null;let t=MC();return Mw?(Date.now()-Mw.timestamp<t||Nw||(Nw={promise:FC(e,!1,Pw),startedAt:null}),Mw.value):(Nw||(Nw={promise:FC(e,!0,Pw),startedAt:Date.now()}),Nw.promise)}async function FC(e,t,n){try{let t=await IC(e);return n===Pw&&t!==null&&(Mw={value:t,timestamp:Date.now()}),t}catch(e){if(n!==Pw)return` `;let r=e instanceof Error?e.message:String(e);return console.error(Xe.red(`apiKeyHelper failed: ${r}`)),M(`Error getting API key from apiKeyHelper: ${r}`,{level:`error`}),!t&&Mw&&Mw.value!==` `?(Mw={...Mw,timestamp:Date.now()},Mw.value):(Mw={value:` `,timestamp:Date.now()},` `)}finally{n===Pw&&(Nw=null)}}async function IC(e){let t=EC();if(!t)return null;if(DC()&&!yf()&&!e)return Jn(`apiKeyHelper invoked before trust check`,Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_apiKeyHelper_missing_trust11`,{}),null;let n=await Pr(t,{shell:!0,timeout:600*1e3,reject:!1});if(n.failed){let e=n.timedOut?`timed out`:`exited ${n.exitCode}`,t=n.stderr?.trim();throw Error(t?`${e}: ${t}`:e)}let r=n.stdout?.trim();if(!r)throw Error(`did not return a value`);return r}function LC(){return Mw?.value??null}function RC(){Pw++,Mw=null,Nw=null}function zC(e){DC()&&!yf()||PC(e)}async function BC(){let e=OC();if(!e)return!1;if(kC()&&!yf()&&!Mt())return Jn(`awsAuthRefresh invoked before trust check`,Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_awsAuthRefresh_missing_trust`,{}),!1;try{return M(`Fetching AWS caller identity for AWS auth refresh command`),await jy(),M(`Fetched AWS caller identity, skipping AWS auth refresh command`),!1}catch{return VC(e)}}function VC(e){M(`Running AWS auth refresh command`);let t=Py.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ya(e,{timeout:Iw});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),M(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),M(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)M(`AWS auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?Xe.red(`AWS auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):Xe.red(`Error running awsAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}async function HC(){let e=AC();if(!e)return null;if(jC()&&!yf()&&!Mt())return Jn(`awsCredentialExport invoked before trust check`,Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_awsCredentialExport_missing_trust`,{}),null;try{return M(`Fetching AWS caller identity for credential export command`),await jy(),M(`Fetched AWS caller identity, skipping AWS credential export command`),null}catch{try{M(`Running AWS credential export command`);let t=await Pr(e,{shell:!0,reject:!1});if(t.exitCode!==0||!t.stdout)throw Error(`awsCredentialExport did not return a valid value`);let n=kn(t.stdout.trim());if(!Ay(n))throw Error(`awsCredentialExport did not return valid AWS STS output structure`);return M(`AWS credentials retrieved from awsCredentialExport`),{accessKeyId:n.Credentials.AccessKeyId,secretAccessKey:n.Credentials.SecretAccessKey,sessionToken:n.Credentials.SessionToken}}catch(e){let t=Xe.red(`Error getting AWS credentials from awsCredentialExport (in settings or ~/.claude.json):`);return e instanceof Error?console.error(t,e.message):console.error(t,e),null}}}function UC(){Lw.cache.clear()}function WC(){return(z_()||{}).gcpAuthRefresh}function GC(){let e=WC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.gcpAuthRefresh===e||n?.gcpAuthRefresh===e}async function KC(){try{let{GoogleAuth:e}=await import(`./src-hdbPEvzO.js`).then(e=>n(e.default,1)),t=new e({scopes:[`https://www.googleapis.com/auth/cloud-platform`]}),r=(async()=>{await(await t.getClient()).getAccessToken()})(),i=Ri(Rw).then(()=>{throw new Yw(`GCP credentials check timed out`)});return await Promise.race([r,i]),!0}catch{return!1}}async function qC(){let e=WC();if(!e)return!1;if(GC()&&!yf()&&!Mt())return Jn(`gcpAuthRefresh invoked before trust check`,Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_gcpAuthRefresh_missing_trust`,{}),!1;try{if(M(`Checking GCP credentials validity for auth refresh`),await KC())return M(`GCP credentials are valid, skipping auth refresh command`),!1}catch{}return JC(e)}function JC(e){M(`Running GCP auth refresh command`);let t=Py.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ya(e,{timeout:Bw});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),M(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),M(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)M(`GCP auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?Xe.red(`GCP auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):Xe.red(`Error running gcpAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}function YC(){Vw.cache.clear()}function XC(){WC()&&(GC()&&!yf()&&!Mt()||Vw())}function ZC(){let e=OC(),t=AC();!e&&!t||(kC()||jC())&&!yf()&&!Mt()||(Lw(),G())}function QC(e){return/^[a-zA-Z0-9-_]+$/.test(e)}async function $C(e){if(!QC(e))throw Error(`Invalid API key format. API key must contain only alphanumeric characters, dashes, and underscores.`);await nw();let t=!1;if(process.platform===`darwin`)try{let n=by();await Pr(`security`,[`-i`],{input:`add-generic-password -U -a "${xy()}" -s "${n}" -X "${Buffer.from(e,`utf-8`).toString(`hex`)}"\n`,reject:!1}),N(`tengu_api_key_saved_to_keychain`,{}),t=!0}catch(e){I(e),N(`tengu_api_key_keychain_error`,{error:pr(e)}),N(`tengu_api_key_saved_to_config`,{})}else N(`tengu_api_key_saved_to_config`,{});let n=Dy(e);V(r=>{let i=r.customApiKeyResponses?.approved??[];return{...r,primaryApiKey:t?r.primaryApiKey:e,customApiKeyResponses:{...r.customApiKeyResponses,approved:i.includes(n)?i:[...i,n],rejected:r.customApiKeyResponses?.rejected??[]}}}),Hw.cache.clear?.(),uC()}function ew(e){let t=H(),n=Dy(e);return t.customApiKeyResponses?.approved?.includes(n)??!1}async function tw(){await nw(),V(e=>({...e,primaryApiKey:void 0})),Hw.cache.clear?.(),uC()}async function nw(){try{await Ey()}catch(e){I(e)}}function rw(e){if(!Zv(e.scopes))return N(`tengu_oauth_tokens_not_claude_ai`,{}),{success:!0};if(!e.refreshToken||!e.expiresAt)return N(`tengu_oauth_tokens_inference_only`,{}),{success:!0};let t=iC(),n=t.name;try{let r=t.read()||{},i=r.claudeAiOauth;r.claudeAiOauth={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:e.expiresAt,scopes:e.scopes,subscriptionType:e.subscriptionType??i?.subscriptionType??null,rateLimitTier:e.rateLimitTier??i?.rateLimitTier??null};let a=t.update(r);return a.success?N(`tengu_oauth_tokens_saved`,{storageBackend:n}):N(`tengu_oauth_tokens_save_failed`,{storageBackend:n}),Z.cache?.clear?.(),VS(),gC(),a}catch(e){return I(e),N(`tengu_oauth_tokens_save_exception`,{storageBackend:n,error:pr(e)}),{success:!1,warning:`Failed to save OAuth tokens`}}}function iw(){Z.cache?.clear?.(),Sy()}async function aw(){try{let{mtimeMs:e}=await ga(R(ae(),`.credentials.json`));e!==Uw&&(Uw=e,iw())}catch{Z.cache?.clear?.()}}function ow(e){let t=Ww.get(e);if(t)return t;let n=sw(e).finally(()=>{Ww.delete(e)});return Ww.set(e,n),n}async function sw(e){iw();let t=await cw();return t?.refreshToken?t.accessToken===e?lw(0,!0):(N(`tengu_oauth_401_recovered_from_keychain`,{}),!0):!1}async function cw(){if(ne())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||py())return Z();try{let e=(await iC().readAsync())?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return I(e),null}}function lw(e=0,t=!1){return e===0&&!t?Gw||(Gw=uw(e,t).finally(()=>{Gw=null}),Gw):uw(e,t)}async function uw(e,t){await aw();let n=Z();if(!t&&(!n?.refreshToken||!iy(n.expiresAt))||!n?.refreshToken||!Zv(n.scopes))return!1;Z.cache?.clear?.(),Sy();let r=await cw();if(!r?.refreshToken||!iy(r.expiresAt))return!1;let i=ae();await fa(i,{recursive:!0});let a;try{N(`tengu_oauth_token_refresh_lock_acquiring`,{}),a=await hi(i),N(`tengu_oauth_token_refresh_lock_acquired`,{})}catch(n){return n.code===`ELOCKED`?e<5?(N(`tengu_oauth_token_refresh_lock_retry`,{retryCount:e+1}),await Ri(1e3+Math.random()*1e3),uw(e+1,t)):(N(`tengu_oauth_token_refresh_lock_retry_limit_reached`,{maxRetries:5}),!1):(I(n),N(`tengu_oauth_token_refresh_lock_error`,{error:pr(n)}),!1)}try{Z.cache?.clear?.(),Sy();let e=await cw();return!e?.refreshToken||!iy(e.expiresAt)?(N(`tengu_oauth_token_refresh_race_resolved`,{}),!1):(N(`tengu_oauth_token_refresh_starting`,{}),rw(await ty(e.refreshToken,{scopes:Zv(e.scopes)?void 0:e.scopes})),Z.cache?.clear?.(),Sy(),!0)}catch(e){I(e),Z.cache?.clear?.(),Sy();let t=await cw();return t&&!iy(t.expiresAt)?(N(`tengu_oauth_token_refresh_race_recovered`,{}),!0):!1}finally{N(`tengu_oauth_token_refresh_lock_releasing`,{}),await a(),N(`tengu_oauth_token_refresh_lock_released`,{})}}function Y(){return xC()?Zv(Z()?.scopes):!1}function dw(){return Z()?.scopes?.includes(`user:profile`)??!1}function fw(){return!(g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||Y())}function pw(){return xC()?H().oauthAccount:void 0}function mw(){let e=pw()?.billingType;return!(!Y()||!e||e!==`stripe_subscription`&&e!==`stripe_subscription_contracted`&&e!==`apple_subscription`&&e!==`google_play_subscription`)}function hw(){let e=X();return e===`max`||e===`enterprise`||e===`team`||e===`pro`||e===null}function X(){if(Iv())return Fv();if(!xC())return null;let e=Z();return e?e.subscriptionType??null:null}function gw(){return X()===`max`}function _w(){return X()===`team`}function vw(){return X()===`team`&&xw()===`default_claude_max_5x`}function yw(){return X()===`enterprise`}function bw(){return X()===`pro`}function xw(){if(!xC())return null;let e=Z();return e?e.rateLimitTier??null:null}function Sw(){switch(X()){case`enterprise`:return`Claude Enterprise`;case`team`:return`Claude Team`;case`max`:return`Claude Max`;case`pro`:return`Claude Pro`;default:return`Claude API`}}function Cw(){return!!(g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||g(process.env.CLAUDE_CODE_USE_OPENAI)||g(process.env.CLAUDE_CODE_USE_GEMINI)||g(process.env.CLAUDE_CODE_USE_GROK))}function ww(){return(z_()||{}).otelHeadersHelper}function Tw(){let e=ww();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.otelHeadersHelper===e||n?.otelHeadersHelper===e}function Ew(){let e=ww();if(!e)return{};let t=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||Jw.toString(),10);if(Kw&&Date.now()-qw<t)return Kw;if(Tw()&&!yf())return{};try{let t=ni(e,{timeout:3e4})?.toString().trim();if(!t)throw Error(`otelHeadersHelper did not return a valid value`);let n=kn(t);if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`otelHeadersHelper must return a JSON object with string key-value pairs`);for(let[e,t]of Object.entries(n))if(typeof t!=`string`)throw Error(`otelHeadersHelper returned non-string value for key "${e}": ${typeof t}`);return Kw=n,qw=Date.now(),Kw}catch(e){throw I(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${pr(e)}`)),e}}function Dw(e){return e===`max`||e===`pro`}function Ow(){let e=X();return Y()&&e!==null&&Dw(e)}function kw(){if(W()!==`firstParty`)return;let{source:e}=SC(),t={};e===`CLAUDE_CODE_OAUTH_TOKEN`||e===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`?t.tokenSource=e:Y()?t.subscription=Sw():t.tokenSource=e;let{key:n,source:r}=TC();if(n&&(t.apiKeySource=r),e===`claude.ai`||r===`/login managed key`){let e=pw()?.organizationName;e&&(t.organization=e)}let i=pw()?.emailAddress;return(e===`claude.ai`||r===`/login managed key`)&&i&&(t.email=i),t}async function Aw(){if(process.env.ANTHROPIC_UNIX_SOCKET||!xC())return{valid:!0};let e=U(`policySettings`)?.forceLoginOrgUUID;if(!e)return{valid:!0};await lw();let t=Z();if(!t)return{valid:!0};let{source:n}=SC(),r=n===`CLAUDE_CODE_OAUTH_TOKEN`||n===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,i=await Yv(t.accessToken);if(!i)return{valid:!1,message:`Unable to verify organization for the current authentication token.\nThis machine requires organization ${e} but the profile could not be fetched.\nThis may be a network error, or the token may lack the user:profile scope required for\nverification (tokens from 'claude setup-token' do not include this scope).\nTry again, or obtain a full-scope token via 'claude auth login'.`};let a=i.organization.uuid;return a===e?{valid:!0}:r?{valid:!1,message:`The ${n===`CLAUDE_CODE_OAUTH_TOKEN`?`CLAUDE_CODE_OAUTH_TOKEN`:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`} environment variable provides a token for a\ndifferent organization than required by this machine's managed settings.\n\nRequired organization: ${e}\nToken organization: ${a}\n\nRemove the environment variable or obtain a token for the correct organization.`}:{valid:!1,message:`Your authentication token belongs to organization ${a},\nbut this machine requires organization ${e}.\n\nPlease log in with the correct organization: claude auth login`}}var jw,Mw,Nw,Pw,Fw,Iw,Lw,Rw,zw,Bw,Vw,Hw,Z,Uw,Ww,Gw,Kw,qw,Jw,Yw,Q=t((()=>{Ze(),Nr(),m(),kr(),hr(),wv(),hv(),O(),qv(),ly(),Xv(),yy(),Oy(),Ny(),Fy(),KS(),op(),j(),h(),zn(),ii(),gi(),Vr(),Xr(),aC(),mC(),Ty(),B_(),zi(),An(),vC(),jw=300*1e3,Mw=null,Nw=null,Pw=0,Fw=3600*1e3,Iw=180*1e3,Lw=Yr(async()=>{let e=await BC(),t=await HC();return(e||t)&&await My(),t},Fw),Rw=5e3,zw=3600*1e3,Bw=180*1e3,Vw=Yr(async()=>await qC(),zw),Hw=p(()=>{if(ne())return null;if(process.platform===`darwin`){let e=lC();if(e){if(e.stdout)return{key:e.stdout,source:`/login managed key`}}else{let e=by();try{let t=ni(`security find-generic-password -a $USER -w -s "${e}"`);if(t)return{key:t,source:`/login managed key`}}catch(e){I(e)}}}let e=H();return e.primaryApiKey?{key:e.primaryApiKey,source:`/login managed key`}:null}),Z=p(()=>{if(ne())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{accessToken:process.env.CLAUDE_CODE_OAUTH_TOKEN,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};let e=py();if(e)return{accessToken:e,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};try{let e=iC().read()?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return I(e),null}}),Uw=0,Ww=new Map,Gw=null,Kw=null,qw=0,Jw=1740*1e3,Yw=class extends Error{}}));function Xw(){return`claude-code/2.8.1`}var Zw=t((()=>{}));function Qw(){return tT.getStore()?.workload}function $w(e,t){return tT.run({workload:e},t)}var eT,tT,nT=t((()=>{eT=`cron`,tT=new xa}));function rT(){let e=process.env.CLAUDE_AGENT_SDK_VERSION?`, agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`:``,t=process.env.CLAUDE_AGENT_SDK_CLIENT_APP?`, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`:``,n=Qw(),r=n?`, workload/${n}`:``;return`claude-cli/2.8.1 (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}${e}${t}${r})`}function iT(){let e=[];return process.env.CLAUDE_CODE_ENTRYPOINT&&e.push(process.env.CLAUDE_CODE_ENTRYPOINT),process.env.CLAUDE_AGENT_SDK_VERSION&&e.push(`agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`),process.env.CLAUDE_AGENT_SDK_CLIENT_APP&&e.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`),`claude-code/2.8.1${e.length>0?` (${e.join(`, `)})`:``}`}function aT(){return`Claude-User (${Xw()}; +https://support.anthropic.com/)`}function oT(){if(Y()){let e=Z();return e?.accessToken?{headers:{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":Dr}}:{headers:{},error:`No OAuth token available`}}let e=CC();return e?{headers:{"x-api-key":e}}:{headers:{},error:`No API key available`}}async function sT(e,t){try{return await e()}catch(n){if(!v.isAxiosError(n))throw n;let r=n.response?.status;if(!(r===401||t?.also403Revoked&&r===403&&typeof n.response?.data==`string`&&n.response.data.includes(`OAuth token has been revoked`)))throw n;let i=Z()?.accessToken;if(!i)throw n;return await ow(i),await e()}}var cT=t((()=>{Ie(),kr(),Q(),Zw(),nT()}));async function lT(){mT===null&&!hT&&(hT=pT(),mT=await hT,hT=null,gT.cache.clear?.())}function uT(){mT=null,hT=null,gT.cache.clear?.(),_T.cache.clear?.()}function dT(){return gT(!0)}function fT(){if(mT!==null)return mT;let e=pw();if(e?.emailAddress)return e.emailAddress;if(process.env.USER_TYPE===`ant`&&process.env.COO_CREATOR)return`${process.env.COO_CREATOR}@anthropic.com`}async function pT(){let e=pw();if(e?.emailAddress)return e.emailAddress;if(process.env.USER_TYPE===`ant`)return process.env.COO_CREATOR?`${process.env.COO_CREATOR}@anthropic.com`:_T()}var mT,hT,gT,_T,vT=t((()=>{Nr(),m(),O(),Q(),op(),gr(),Fr(),h(),mT=null,hT=null,gT=p(e=>{let t=Hf(),n=H(),r,i,a;if(e&&(r=X()??void 0,i=xw()??void 0,r&&n.claudeCodeFirstTokenDate)){let e=new Date(n.claudeCodeFirstTokenDate).getTime();isNaN(e)||(a=e)}let o=pw(),s=o?.organizationUuid,c=o?.accountUuid;return{deviceId:t,sessionId:at(),email:fT(),appVersion:`2.8.1`,platform:Ir(),organizationUuid:s,accountUuid:c,userType:process.env.USER_TYPE,subscriptionType:r,rateLimitTier:i,firstTokenTime:a,...g(process.env.GITHUB_ACTIONS)&&{githubActionsMetadata:{actor:process.env.GITHUB_ACTOR,actorId:process.env.GITHUB_ACTOR_ID,repository:process.env.GITHUB_REPOSITORY,repositoryId:process.env.GITHUB_REPOSITORY_ID,repositoryOwner:process.env.GITHUB_REPOSITORY_OWNER,repositoryOwnerId:process.env.GITHUB_REPOSITORY_OWNER_ID}}}}),_T=p(async()=>{let e=await Pr(`git config --get user.email`,{shell:!0,reject:!1,cwd:_r()});return e.exitCode===0&&e.stdout?e.stdout.trim():void 0})}));function yT(e){return bT(e,new WeakSet)}function bT(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>bT(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>bT(e,t))}return!1}var xT=t((()=>{})),ST,CT=t((()=>{fe(),we(),Ee(),xT(),ce(),ST=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){_(this,`hrTime`,void 0),_(this,`hrTimeObserved`,void 0),_(this,`spanContext`,void 0),_(this,`resource`,void 0),_(this,`instrumentationScope`,void 0),_(this,`attributes`,{}),_(this,`_severityText`,void 0),_(this,`_severityNumber`,void 0),_(this,`_body`,void 0),_(this,`_eventName`,void 0),_(this,`_attributesCount`,0),_(this,`_droppedAttributesCount`,0),_(this,`_isReadonly`,!1),_(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=_e(r??f),this.hrTimeObserved=_e(i??f),d){let e=me.getSpanContext(d);e&&ue(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return pe.warn(`Invalid attribute key: ${e}`),this;if(!yT(t))return pe.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&pe.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return pe.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Me,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(be,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(be,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Me,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(ge,n.stack),t=!0)}t||pe.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&pe.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}})),wT,TT=t((()=>{Fe(),fe(),CT(),ce(),wT=class{constructor(e,t){_(this,`instrumentationScope`,void 0),_(this,`_sharedState`,void 0),_(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,n=e.context||he.active(),r=e.severityNumber??Ne.UNSPECIFIED;if(r!==Ne.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=me.getSpanContext(n);if(e&&ue(e)&&(e.traceFlags&de.SAMPLED)!==de.SAMPLED)return}let i=new ST(this._sharedState,this.instrumentationScope,{context:n,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==Ne.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||he.active();if(t.traceBased){let e=me.getSpanContext(r);if(e&&ue(e)&&(e.traceFlags&de.SAMPLED)!==de.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}}})),ET,DT=t((()=>{ET=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}})),OT,kT=t((()=>{we(),ce(),OT=class{constructor(e,t){_(this,`processors`,void 0),_(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>Te(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}}}));function AT(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var jT=t((()=>{})),MT,NT=t((()=>{MT=`otel.sdk.log.created`})),PT,FT=t((()=>{NT(),ce(),PT=class{constructor(e){_(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(MT,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}})),IT,LT=t((()=>{IT=`0.215.0`})),RT,zT,BT,VT=t((()=>{fe(),Fe(),DT(),kT(),jT(),FT(),LT(),ce(),RT={disabled:!1,minimumSeverity:Ne.UNSPECIFIED,traceBased:!1},zT=()=>({...RT}),BT=class{constructor(e,t,n,r,i,a){_(this,`loggers`,new Map),_(this,`activeProcessor`,void 0),_(this,`registeredLogRecordProcessors`,[]),_(this,`resource`,void 0),_(this,`forceFlushTimeoutMillis`,void 0),_(this,`logRecordLimits`,void 0),_(this,`processors`,void 0),_(this,`loggerMetrics`,void 0),_(this,`_loggerConfigurator`,void 0),_(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new OT(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new ET,this._loggerConfigurator=i??zT,this.loggerMetrics=new PT(a?a.getMeter(`@opentelemetry/sdk-logs`,IT):le())}getLoggerConfig(e){let t=AT(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}})),HT,UT=t((()=>{fe(),Fe(),ke(),we(),TT(),VT(),ce(),HT=class{constructor(e={}){_(this,`_shutdownOnce`,void 0),_(this,`_sharedState`,void 0);let t={resource:e.resource??Ce(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??zT,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new BT(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new Ae(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return pe.warn(`A shutdown LoggerProvider cannot provide a Logger`),Pe;e||pe.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new wT({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(pe.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(pe.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}})),WT,GT=t((()=>{we(),WT=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:je(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});t?.({code:Se.SUCCESS})}}}));async function KT(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var qT,JT,YT=t((()=>{fe(),we(),ce(),qT=class{constructor(e,t,n){_(this,`_exportCompleted`,void 0),_(this,`_exportScheduledPromise`,void 0),_(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await KT(t),await he.with(De(he.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){ye(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===Se.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},JT=class{constructor(e,t){_(this,`_maxExportBatchSize`,void 0),_(this,`_maxQueueSize`,void 0),_(this,`_scheduledDelayMillis`,void 0),_(this,`_exportTimeoutMillis`,void 0),_(this,`_exporter`,void 0),_(this,`_currentExport`,null),_(this,`_finishedLogRecords`,[]),_(this,`_timer`,void 0),_(this,`_shutdownOnce`,void 0),_(this,`_flushing`,!1),this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new Ae(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(pe.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new qT(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){ye(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new qT(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,ye(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),XT,ZT=t((()=>{YT(),XT=class extends JT{onShutdown(){}}})),QT=t((()=>{ZT()})),$T=t((()=>{QT()})),eE=t((()=>{UT(),GT(),$T()}));function tE(){return g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||Hr()}function nE(){return Hr()}var rE=t((()=>{h(),zr()}));function iE(){return{seconds:0,nanos:0}}function aE(e){return e!=null}var oE,sE=t((()=>{oE={fromJSON(e){return{seconds:aE(e.seconds)?globalThis.Number(e.seconds):0,nanos:aE(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let t={};return e.seconds!==void 0&&(t.seconds=Math.round(e.seconds)),e.nanos!==void 0&&(t.nanos=Math.round(e.nanos)),t},create(e){return oE.fromPartial(e??{})},fromPartial(e){let t=iE();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}}}));function cE(){return{account_id:0,organization_uuid:``,account_uuid:``}}function lE(e){return e!=null}var uE,dE=t((()=>{uE={fromJSON(e){return{account_id:lE(e.account_id)?globalThis.Number(e.account_id):0,organization_uuid:lE(e.organization_uuid)?globalThis.String(e.organization_uuid):``,account_uuid:lE(e.account_uuid)?globalThis.String(e.account_uuid):``}},toJSON(e){let t={};return e.account_id!==void 0&&(t.account_id=Math.round(e.account_id)),e.organization_uuid!==void 0&&(t.organization_uuid=e.organization_uuid),e.account_uuid!==void 0&&(t.account_uuid=e.account_uuid),t},create(e){return uE.fromPartial(e??{})},fromPartial(e){let t=cE();return t.account_id=e.account_id??0,t.organization_uuid=e.organization_uuid??``,t.account_uuid=e.account_uuid??``,t}}}));function fE(){return{actor_id:``,repository_id:``,repository_owner_id:``}}function pE(){return{platform:``,node_version:``,terminal:``,package_managers:``,runtimes:``,is_running_with_bun:!1,is_ci:!1,is_claubbit:!1,is_github_action:!1,is_claude_code_action:!1,is_claude_ai_auth:!1,version:``,github_event_name:``,github_actions_runner_environment:``,github_actions_runner_os:``,github_action_ref:``,wsl_version:``,github_actions_metadata:void 0,arch:``,is_claude_code_remote:!1,remote_environment_type:``,claude_code_container_id:``,claude_code_remote_session_id:``,tags:[],deployment_environment:``,is_conductor:!1,version_base:``,coworker_type:``,build_time:``,is_local_agent_mode:!1,linux_distro_id:``,linux_distro_version:``,linux_kernel:``,vcs:``,platform_raw:``}}function mE(){return{slack_team_id:``,is_enterprise_install:!1,trigger:``,creation_method:``}}function hE(){return{event_name:``,client_timestamp:void 0,model:``,session_id:``,user_type:``,betas:``,env:void 0,entrypoint:``,agent_sdk_version:``,is_interactive:!1,client_type:``,process:``,additional_metadata:``,auth:void 0,server_timestamp:void 0,event_id:``,device_id:``,swe_bench_run_id:``,swe_bench_instance_id:``,swe_bench_task_id:``,email:``,agent_id:``,parent_session_id:``,agent_type:``,slack:void 0,team_name:``,skill_name:``,plugin_name:``,marketplace_name:``}}function gE(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function _E(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):gE(oE.fromJSON(e))}function $(e){return e!=null}var vE,yE,bE,xE,SE=t((()=>{sE(),dE(),vE={fromJSON(e){return{actor_id:$(e.actor_id)?globalThis.String(e.actor_id):``,repository_id:$(e.repository_id)?globalThis.String(e.repository_id):``,repository_owner_id:$(e.repository_owner_id)?globalThis.String(e.repository_owner_id):``}},toJSON(e){let t={};return e.actor_id!==void 0&&(t.actor_id=e.actor_id),e.repository_id!==void 0&&(t.repository_id=e.repository_id),e.repository_owner_id!==void 0&&(t.repository_owner_id=e.repository_owner_id),t},create(e){return vE.fromPartial(e??{})},fromPartial(e){let t=fE();return t.actor_id=e.actor_id??``,t.repository_id=e.repository_id??``,t.repository_owner_id=e.repository_owner_id??``,t}},yE={fromJSON(e){return{platform:$(e.platform)?globalThis.String(e.platform):``,node_version:$(e.node_version)?globalThis.String(e.node_version):``,terminal:$(e.terminal)?globalThis.String(e.terminal):``,package_managers:$(e.package_managers)?globalThis.String(e.package_managers):``,runtimes:$(e.runtimes)?globalThis.String(e.runtimes):``,is_running_with_bun:$(e.is_running_with_bun)?globalThis.Boolean(e.is_running_with_bun):!1,is_ci:$(e.is_ci)?globalThis.Boolean(e.is_ci):!1,is_claubbit:$(e.is_claubbit)?globalThis.Boolean(e.is_claubbit):!1,is_github_action:$(e.is_github_action)?globalThis.Boolean(e.is_github_action):!1,is_claude_code_action:$(e.is_claude_code_action)?globalThis.Boolean(e.is_claude_code_action):!1,is_claude_ai_auth:$(e.is_claude_ai_auth)?globalThis.Boolean(e.is_claude_ai_auth):!1,version:$(e.version)?globalThis.String(e.version):``,github_event_name:$(e.github_event_name)?globalThis.String(e.github_event_name):``,github_actions_runner_environment:$(e.github_actions_runner_environment)?globalThis.String(e.github_actions_runner_environment):``,github_actions_runner_os:$(e.github_actions_runner_os)?globalThis.String(e.github_actions_runner_os):``,github_action_ref:$(e.github_action_ref)?globalThis.String(e.github_action_ref):``,wsl_version:$(e.wsl_version)?globalThis.String(e.wsl_version):``,github_actions_metadata:$(e.github_actions_metadata)?vE.fromJSON(e.github_actions_metadata):void 0,arch:$(e.arch)?globalThis.String(e.arch):``,is_claude_code_remote:$(e.is_claude_code_remote)?globalThis.Boolean(e.is_claude_code_remote):!1,remote_environment_type:$(e.remote_environment_type)?globalThis.String(e.remote_environment_type):``,claude_code_container_id:$(e.claude_code_container_id)?globalThis.String(e.claude_code_container_id):``,claude_code_remote_session_id:$(e.claude_code_remote_session_id)?globalThis.String(e.claude_code_remote_session_id):``,tags:globalThis.Array.isArray(e?.tags)?e.tags.map(e=>globalThis.String(e)):[],deployment_environment:$(e.deployment_environment)?globalThis.String(e.deployment_environment):``,is_conductor:$(e.is_conductor)?globalThis.Boolean(e.is_conductor):!1,version_base:$(e.version_base)?globalThis.String(e.version_base):``,coworker_type:$(e.coworker_type)?globalThis.String(e.coworker_type):``,build_time:$(e.build_time)?globalThis.String(e.build_time):``,is_local_agent_mode:$(e.is_local_agent_mode)?globalThis.Boolean(e.is_local_agent_mode):!1,linux_distro_id:$(e.linux_distro_id)?globalThis.String(e.linux_distro_id):``,linux_distro_version:$(e.linux_distro_version)?globalThis.String(e.linux_distro_version):``,linux_kernel:$(e.linux_kernel)?globalThis.String(e.linux_kernel):``,vcs:$(e.vcs)?globalThis.String(e.vcs):``,platform_raw:$(e.platform_raw)?globalThis.String(e.platform_raw):``}},toJSON(e){let t={};return e.platform!==void 0&&(t.platform=e.platform),e.node_version!==void 0&&(t.node_version=e.node_version),e.terminal!==void 0&&(t.terminal=e.terminal),e.package_managers!==void 0&&(t.package_managers=e.package_managers),e.runtimes!==void 0&&(t.runtimes=e.runtimes),e.is_running_with_bun!==void 0&&(t.is_running_with_bun=e.is_running_with_bun),e.is_ci!==void 0&&(t.is_ci=e.is_ci),e.is_claubbit!==void 0&&(t.is_claubbit=e.is_claubbit),e.is_github_action!==void 0&&(t.is_github_action=e.is_github_action),e.is_claude_code_action!==void 0&&(t.is_claude_code_action=e.is_claude_code_action),e.is_claude_ai_auth!==void 0&&(t.is_claude_ai_auth=e.is_claude_ai_auth),e.version!==void 0&&(t.version=e.version),e.github_event_name!==void 0&&(t.github_event_name=e.github_event_name),e.github_actions_runner_environment!==void 0&&(t.github_actions_runner_environment=e.github_actions_runner_environment),e.github_actions_runner_os!==void 0&&(t.github_actions_runner_os=e.github_actions_runner_os),e.github_action_ref!==void 0&&(t.github_action_ref=e.github_action_ref),e.wsl_version!==void 0&&(t.wsl_version=e.wsl_version),e.github_actions_metadata!==void 0&&(t.github_actions_metadata=vE.toJSON(e.github_actions_metadata)),e.arch!==void 0&&(t.arch=e.arch),e.is_claude_code_remote!==void 0&&(t.is_claude_code_remote=e.is_claude_code_remote),e.remote_environment_type!==void 0&&(t.remote_environment_type=e.remote_environment_type),e.claude_code_container_id!==void 0&&(t.claude_code_container_id=e.claude_code_container_id),e.claude_code_remote_session_id!==void 0&&(t.claude_code_remote_session_id=e.claude_code_remote_session_id),e.tags?.length&&(t.tags=e.tags),e.deployment_environment!==void 0&&(t.deployment_environment=e.deployment_environment),e.is_conductor!==void 0&&(t.is_conductor=e.is_conductor),e.version_base!==void 0&&(t.version_base=e.version_base),e.coworker_type!==void 0&&(t.coworker_type=e.coworker_type),e.build_time!==void 0&&(t.build_time=e.build_time),e.is_local_agent_mode!==void 0&&(t.is_local_agent_mode=e.is_local_agent_mode),e.linux_distro_id!==void 0&&(t.linux_distro_id=e.linux_distro_id),e.linux_distro_version!==void 0&&(t.linux_distro_version=e.linux_distro_version),e.linux_kernel!==void 0&&(t.linux_kernel=e.linux_kernel),e.vcs!==void 0&&(t.vcs=e.vcs),e.platform_raw!==void 0&&(t.platform_raw=e.platform_raw),t},create(e){return yE.fromPartial(e??{})},fromPartial(e){let t=pE();return t.platform=e.platform??``,t.node_version=e.node_version??``,t.terminal=e.terminal??``,t.package_managers=e.package_managers??``,t.runtimes=e.runtimes??``,t.is_running_with_bun=e.is_running_with_bun??!1,t.is_ci=e.is_ci??!1,t.is_claubbit=e.is_claubbit??!1,t.is_github_action=e.is_github_action??!1,t.is_claude_code_action=e.is_claude_code_action??!1,t.is_claude_ai_auth=e.is_claude_ai_auth??!1,t.version=e.version??``,t.github_event_name=e.github_event_name??``,t.github_actions_runner_environment=e.github_actions_runner_environment??``,t.github_actions_runner_os=e.github_actions_runner_os??``,t.github_action_ref=e.github_action_ref??``,t.wsl_version=e.wsl_version??``,t.github_actions_metadata=e.github_actions_metadata!==void 0&&e.github_actions_metadata!==null?vE.fromPartial(e.github_actions_metadata):void 0,t.arch=e.arch??``,t.is_claude_code_remote=e.is_claude_code_remote??!1,t.remote_environment_type=e.remote_environment_type??``,t.claude_code_container_id=e.claude_code_container_id??``,t.claude_code_remote_session_id=e.claude_code_remote_session_id??``,t.tags=e.tags?.map(e=>e)||[],t.deployment_environment=e.deployment_environment??``,t.is_conductor=e.is_conductor??!1,t.version_base=e.version_base??``,t.coworker_type=e.coworker_type??``,t.build_time=e.build_time??``,t.is_local_agent_mode=e.is_local_agent_mode??!1,t.linux_distro_id=e.linux_distro_id??``,t.linux_distro_version=e.linux_distro_version??``,t.linux_kernel=e.linux_kernel??``,t.vcs=e.vcs??``,t.platform_raw=e.platform_raw??``,t}},bE={fromJSON(e){return{slack_team_id:$(e.slack_team_id)?globalThis.String(e.slack_team_id):``,is_enterprise_install:$(e.is_enterprise_install)?globalThis.Boolean(e.is_enterprise_install):!1,trigger:$(e.trigger)?globalThis.String(e.trigger):``,creation_method:$(e.creation_method)?globalThis.String(e.creation_method):``}},toJSON(e){let t={};return e.slack_team_id!==void 0&&(t.slack_team_id=e.slack_team_id),e.is_enterprise_install!==void 0&&(t.is_enterprise_install=e.is_enterprise_install),e.trigger!==void 0&&(t.trigger=e.trigger),e.creation_method!==void 0&&(t.creation_method=e.creation_method),t},create(e){return bE.fromPartial(e??{})},fromPartial(e){let t=mE();return t.slack_team_id=e.slack_team_id??``,t.is_enterprise_install=e.is_enterprise_install??!1,t.trigger=e.trigger??``,t.creation_method=e.creation_method??``,t}},xE={fromJSON(e){return{event_name:$(e.event_name)?globalThis.String(e.event_name):``,client_timestamp:$(e.client_timestamp)?_E(e.client_timestamp):void 0,model:$(e.model)?globalThis.String(e.model):``,session_id:$(e.session_id)?globalThis.String(e.session_id):``,user_type:$(e.user_type)?globalThis.String(e.user_type):``,betas:$(e.betas)?globalThis.String(e.betas):``,env:$(e.env)?yE.fromJSON(e.env):void 0,entrypoint:$(e.entrypoint)?globalThis.String(e.entrypoint):``,agent_sdk_version:$(e.agent_sdk_version)?globalThis.String(e.agent_sdk_version):``,is_interactive:$(e.is_interactive)?globalThis.Boolean(e.is_interactive):!1,client_type:$(e.client_type)?globalThis.String(e.client_type):``,process:$(e.process)?globalThis.String(e.process):``,additional_metadata:$(e.additional_metadata)?globalThis.String(e.additional_metadata):``,auth:$(e.auth)?uE.fromJSON(e.auth):void 0,server_timestamp:$(e.server_timestamp)?_E(e.server_timestamp):void 0,event_id:$(e.event_id)?globalThis.String(e.event_id):``,device_id:$(e.device_id)?globalThis.String(e.device_id):``,swe_bench_run_id:$(e.swe_bench_run_id)?globalThis.String(e.swe_bench_run_id):``,swe_bench_instance_id:$(e.swe_bench_instance_id)?globalThis.String(e.swe_bench_instance_id):``,swe_bench_task_id:$(e.swe_bench_task_id)?globalThis.String(e.swe_bench_task_id):``,email:$(e.email)?globalThis.String(e.email):``,agent_id:$(e.agent_id)?globalThis.String(e.agent_id):``,parent_session_id:$(e.parent_session_id)?globalThis.String(e.parent_session_id):``,agent_type:$(e.agent_type)?globalThis.String(e.agent_type):``,slack:$(e.slack)?bE.fromJSON(e.slack):void 0,team_name:$(e.team_name)?globalThis.String(e.team_name):``,skill_name:$(e.skill_name)?globalThis.String(e.skill_name):``,plugin_name:$(e.plugin_name)?globalThis.String(e.plugin_name):``,marketplace_name:$(e.marketplace_name)?globalThis.String(e.marketplace_name):``}},toJSON(e){let t={};return e.event_name!==void 0&&(t.event_name=e.event_name),e.client_timestamp!==void 0&&(t.client_timestamp=e.client_timestamp.toISOString()),e.model!==void 0&&(t.model=e.model),e.session_id!==void 0&&(t.session_id=e.session_id),e.user_type!==void 0&&(t.user_type=e.user_type),e.betas!==void 0&&(t.betas=e.betas),e.env!==void 0&&(t.env=yE.toJSON(e.env)),e.entrypoint!==void 0&&(t.entrypoint=e.entrypoint),e.agent_sdk_version!==void 0&&(t.agent_sdk_version=e.agent_sdk_version),e.is_interactive!==void 0&&(t.is_interactive=e.is_interactive),e.client_type!==void 0&&(t.client_type=e.client_type),e.process!==void 0&&(t.process=e.process),e.additional_metadata!==void 0&&(t.additional_metadata=e.additional_metadata),e.auth!==void 0&&(t.auth=uE.toJSON(e.auth)),e.server_timestamp!==void 0&&(t.server_timestamp=e.server_timestamp.toISOString()),e.event_id!==void 0&&(t.event_id=e.event_id),e.device_id!==void 0&&(t.device_id=e.device_id),e.swe_bench_run_id!==void 0&&(t.swe_bench_run_id=e.swe_bench_run_id),e.swe_bench_instance_id!==void 0&&(t.swe_bench_instance_id=e.swe_bench_instance_id),e.swe_bench_task_id!==void 0&&(t.swe_bench_task_id=e.swe_bench_task_id),e.email!==void 0&&(t.email=e.email),e.agent_id!==void 0&&(t.agent_id=e.agent_id),e.parent_session_id!==void 0&&(t.parent_session_id=e.parent_session_id),e.agent_type!==void 0&&(t.agent_type=e.agent_type),e.slack!==void 0&&(t.slack=bE.toJSON(e.slack)),e.team_name!==void 0&&(t.team_name=e.team_name),e.skill_name!==void 0&&(t.skill_name=e.skill_name),e.plugin_name!==void 0&&(t.plugin_name=e.plugin_name),e.marketplace_name!==void 0&&(t.marketplace_name=e.marketplace_name),t},create(e){return xE.fromPartial(e??{})},fromPartial(e){let t=hE();return t.event_name=e.event_name??``,t.client_timestamp=e.client_timestamp??void 0,t.model=e.model??``,t.session_id=e.session_id??``,t.user_type=e.user_type??``,t.betas=e.betas??``,t.env=e.env!==void 0&&e.env!==null?yE.fromPartial(e.env):void 0,t.entrypoint=e.entrypoint??``,t.agent_sdk_version=e.agent_sdk_version??``,t.is_interactive=e.is_interactive??!1,t.client_type=e.client_type??``,t.process=e.process??``,t.additional_metadata=e.additional_metadata??``,t.auth=e.auth!==void 0&&e.auth!==null?uE.fromPartial(e.auth):void 0,t.server_timestamp=e.server_timestamp??void 0,t.event_id=e.event_id??``,t.device_id=e.device_id??``,t.swe_bench_run_id=e.swe_bench_run_id??``,t.swe_bench_instance_id=e.swe_bench_instance_id??``,t.swe_bench_task_id=e.swe_bench_task_id??``,t.email=e.email??``,t.agent_id=e.agent_id??``,t.parent_session_id=e.parent_session_id??``,t.agent_type=e.agent_type??``,t.slack=e.slack!==void 0&&e.slack!==null?bE.fromPartial(e.slack):void 0,t.team_name=e.team_name??``,t.skill_name=e.skill_name??``,t.plugin_name=e.plugin_name??``,t.marketplace_name=e.marketplace_name??``,t}}}));function CE(){return{event_id:``,timestamp:void 0,experiment_id:``,variation_id:0,environment:``,user_attributes:``,experiment_metadata:``,device_id:``,auth:void 0,session_id:``,anonymous_id:``,event_metadata_vars:``}}function wE(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function TE(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):wE(oE.fromJSON(e))}function EE(e){return e!=null}var DE,OE=t((()=>{sE(),dE(),DE={fromJSON(e){return{event_id:EE(e.event_id)?globalThis.String(e.event_id):``,timestamp:EE(e.timestamp)?TE(e.timestamp):void 0,experiment_id:EE(e.experiment_id)?globalThis.String(e.experiment_id):``,variation_id:EE(e.variation_id)?globalThis.Number(e.variation_id):0,environment:EE(e.environment)?globalThis.String(e.environment):``,user_attributes:EE(e.user_attributes)?globalThis.String(e.user_attributes):``,experiment_metadata:EE(e.experiment_metadata)?globalThis.String(e.experiment_metadata):``,device_id:EE(e.device_id)?globalThis.String(e.device_id):``,auth:EE(e.auth)?uE.fromJSON(e.auth):void 0,session_id:EE(e.session_id)?globalThis.String(e.session_id):``,anonymous_id:EE(e.anonymous_id)?globalThis.String(e.anonymous_id):``,event_metadata_vars:EE(e.event_metadata_vars)?globalThis.String(e.event_metadata_vars):``}},toJSON(e){let t={};return e.event_id!==void 0&&(t.event_id=e.event_id),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.experiment_id!==void 0&&(t.experiment_id=e.experiment_id),e.variation_id!==void 0&&(t.variation_id=Math.round(e.variation_id)),e.environment!==void 0&&(t.environment=e.environment),e.user_attributes!==void 0&&(t.user_attributes=e.user_attributes),e.experiment_metadata!==void 0&&(t.experiment_metadata=e.experiment_metadata),e.device_id!==void 0&&(t.device_id=e.device_id),e.auth!==void 0&&(t.auth=uE.toJSON(e.auth)),e.session_id!==void 0&&(t.session_id=e.session_id),e.anonymous_id!==void 0&&(t.anonymous_id=e.anonymous_id),e.event_metadata_vars!==void 0&&(t.event_metadata_vars=e.event_metadata_vars),t},create(e){return DE.fromPartial(e??{})},fromPartial(e){let t=CE();return t.event_id=e.event_id??``,t.timestamp=e.timestamp??void 0,t.experiment_id=e.experiment_id??``,t.variation_id=e.variation_id??0,t.environment=e.environment??``,t.user_attributes=e.user_attributes??``,t.experiment_metadata=e.experiment_metadata??``,t.device_id=e.device_id??``,t.auth=e.auth!==void 0&&e.auth!==null?uE.fromPartial(e.auth):void 0,t.session_id=e.session_id??``,t.anonymous_id=e.anonymous_id??``,t.event_metadata_vars=e.event_metadata_vars??``,t}}}));function kE(){return process.platform===`linux`&&g(process.env.CLAUDE_CODE_BUBBLEWRAP)}function AE(){return process.platform===`linux`?IE??!1:!1}async function jE(){if(LE!==void 0)return LE;if(process.platform===`darwin`)return LE=null,null;try{let e=await Vi(process.pid,10);for(let t of e){let e=t.toLowerCase();for(let t of Rr)if(e.includes(t))return LE=t,t}}catch{}return LE=null,null}async function ME(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Lr.platform!==`darwin`?await jE()||`pycharm`:Lr.terminal}function NE(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Lr.platform!==`darwin`?LE===void 0?`pycharm`:LE||`pycharm`:Lr.terminal}async function PE(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await jE()}var FE,IE,LE,RE,zE=t((()=>{m(),Fr(),h(),ii(),Bi(),FE=p(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await ai(`test`,[`-f`,`/.dockerenv`]);return e===0}),IE=null,process.platform===`linux`&&ga(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{IE=!0},()=>{IE=!1}),RE={...Lr,terminal:NE(),getIsDocker:FE,getIsBubblewrapSandbox:kE,isMuslEnvironment:AE,getTerminalWithJetBrainsDetectionAsync:ME,initJetBrainsDetection:PE}}));function BE(e){return VE?.has(e)??!1}var VE,HE=t((()=>{j(),zn()}));function UE(){return!g(process.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS_DISABLED)}var WE=t((()=>{h()}));function GE(){return XE.getStore()}function KE(e,t){return XE.run(e,t)}function qE(e){return e?.agentType===`subagent`}function JE(){let e=GE();if(!(!qE(e)||!e.subagentName))return e.isBuiltIn?e.subagentName:`user-defined`}function YE(){let e=GE();if(!(!e?.invokingRequestId||e.invocationEmitted))return e.invocationEmitted=!0,{invokingRequestId:e.invokingRequestId,invocationKind:e.invocationKind}}var XE,ZE=t((()=>{WE(),XE=new xa}));function QE(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function $E(){return g(process.env.OTEL_LOG_TOOL_DETAILS)}function eD(e,t){return!!(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`||e===`claudeai-proxy`||t&&BE(t))}function tD(e,t,n){let r=nD(e);return!r||!fD.has(r.serverName)&&!eD(t,n)?{}:{mcpServerName:r.serverName,mcpToolName:r.mcpToolName}}function nD(e){if(!e.startsWith(`mcp__`))return;let t=e.split(`__`);if(t.length<3)return;let n=t[1],r=t.slice(2).join(`__`);if(!(!n||!r))return{serverName:n,mcpToolName:r}}function rD(e,t){if(e===`Skill`&&typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function iD(e,t=0){if(typeof e==`string`)return e.length>pD?`${e.slice(0,mD)}…[${e.length} chars]`:e;if(typeof e==`number`||typeof e==`boolean`||e==null)return e;if(t>=_D)return`<nested>`;if(Array.isArray(e)){let n=e.slice(0,gD).map(e=>iD(e,t+1));return e.length>gD&&n.push(`…[${e.length} items]`),n}if(typeof e==`object`){let n=Object.entries(e).filter(([e])=>!e.startsWith(`_`)),r=n.slice(0,gD).map(([e,n])=>[e,iD(n,t+1)]);return n.length>gD&&r.push([`…`,`${n.length} keys`]),Object.fromEntries(r)}return String(e)}function aD(e){if(!$E())return;let t=k(iD(e));return t.length>hD&&(t=t.slice(0,hD)+`…[truncated]`),t}function oD(e){let t=Yi(e).toLowerCase();if(!t||t===`.`)return;let n=t.slice(1);return n.length>vD?`other`:n}function sD(e,t){if(!e.includes(`.`)&&!t)return;let n,r=new Set;if(t){let e=oD(t);e&&(r.add(e),n=e)}for(let t of e.split(bD)){if(!t)continue;let e=t.split(xD);if(e.length<2)continue;let i=e[0],a=i.lastIndexOf(`/`),o=a>=0?i.slice(a+1):i;if(yD.has(o))for(let t=1;t<e.length;t++){let i=e[t];if(i.charCodeAt(0)===45)continue;let a=oD(i);a&&!r.has(a)&&(r.add(a),n=n?n+`,`+a:a)}}if(n)return n}function cD(){let e=GE();if(e){let t={agentId:e.agentId,parentSessionId:e.parentSessionId,agentType:e.agentType};return e.agentType===`teammate`&&(t.teamName=e.teamName),t}let t=Si(),n=bi(),r=_i(),i=yi()?`teammate`:t?`standalone`:void 0;if(t||i||n||r)return{...t?{agentId:t}:{},...i?{agentType:i}:{},...n?{parentSessionId:n}:{},...r?{teamName:r}:{}};let a=vn();return a?{parentSessionId:a}:{}}function lD(){try{let e=process.memoryUsage(),t=process.cpuUsage(),n=Date.now(),r;if(wD&&TD){let e=n-TD;e>0&&(r=(t.user-wD.user+(t.system-wD.system))/(e*1e3)*100)}return wD=t,TD=n,{uptime:process.uptime(),rss:e.rss,heapTotal:e.heapTotal,heapUsed:e.heapUsed,external:e.external,arrayBuffers:e.arrayBuffers,constrainedMemory:process.constrainedMemory(),cpuUsage:t,cpuPercent:r}}catch{return}}async function uD(e={}){let t=e.model?String(e.model):Sx(),n=typeof e.betas==`string`?e.betas:WS(t).join(`,`),[r,i]=await Promise.all([CD(),xr()]),a=lD();return{model:t,sessionId:at(),userType:process.env.USER_TYPE||``,...n.length>0?{betas:n}:{},envContext:r,...process.env.CLAUDE_CODE_ENTRYPOINT&&{entrypoint:process.env.CLAUDE_CODE_ENTRYPOINT},...process.env.CLAUDE_AGENT_SDK_VERSION&&{agentSdkVersion:process.env.CLAUDE_AGENT_SDK_VERSION},isInteractive:String(mt()),clientType:st(),...a&&{processMetrics:a},sweBenchRunId:process.env.SWE_BENCH_RUN_ID||``,sweBenchInstanceId:process.env.SWE_BENCH_INSTANCE_ID||``,sweBenchTaskId:process.env.SWE_BENCH_TASK_ID||``,...cD(),...X()&&{subscriptionType:X()},...xt()?{kairosActive:!0}:{},...i&&{rh:i}}}function dD(e,t,n={}){let{envContext:r,processMetrics:i,rh:a,kairosActive:o,skillMode:s,observerMode:c,...l}=e,u={platform:r.platform,platform_raw:r.platformRaw,arch:r.arch,node_version:r.nodeVersion,terminal:r.terminal||`unknown`,package_managers:r.packageManagers,runtimes:r.runtimes,is_running_with_bun:r.isRunningWithBun,is_ci:r.isCi,is_claubbit:r.isClaubbit,is_claude_code_remote:r.isClaudeCodeRemote,is_local_agent_mode:r.isLocalAgentMode,is_conductor:r.isConductor,is_github_action:r.isGithubAction,is_claude_code_action:r.isClaudeCodeAction,is_claude_ai_auth:r.isClaudeAiAuth,version:r.version,build_time:r.buildTime,deployment_environment:r.deploymentEnvironment};r.remoteEnvironmentType&&(u.remote_environment_type=r.remoteEnvironmentType),r.claudeCodeContainerId&&(u.claude_code_container_id=r.claudeCodeContainerId),r.claudeCodeRemoteSessionId&&(u.claude_code_remote_session_id=r.claudeCodeRemoteSessionId),r.tags&&(u.tags=r.tags.split(`,`).map(e=>e.trim()).filter(Boolean)),r.githubEventName&&(u.github_event_name=r.githubEventName),r.githubActionsRunnerEnvironment&&(u.github_actions_runner_environment=r.githubActionsRunnerEnvironment),r.githubActionsRunnerOs&&(u.github_actions_runner_os=r.githubActionsRunnerOs),r.githubActionRef&&(u.github_action_ref=r.githubActionRef),r.wslVersion&&(u.wsl_version=r.wslVersion),r.linuxDistroId&&(u.linux_distro_id=r.linuxDistroId),r.linuxDistroVersion&&(u.linux_distro_version=r.linuxDistroVersion),r.linuxKernel&&(u.linux_kernel=r.linuxKernel),r.vcs&&(u.vcs=r.vcs),r.versionBase&&(u.version_base=r.versionBase);let d={session_id:l.sessionId,model:l.model,user_type:l.userType,is_interactive:l.isInteractive===`true`,client_type:l.clientType};if(l.betas&&(d.betas=l.betas),l.entrypoint&&(d.entrypoint=l.entrypoint),l.agentSdkVersion&&(d.agent_sdk_version=l.agentSdkVersion),l.sweBenchRunId&&(d.swe_bench_run_id=l.sweBenchRunId),l.sweBenchInstanceId&&(d.swe_bench_instance_id=l.sweBenchInstanceId),l.sweBenchTaskId&&(d.swe_bench_task_id=l.sweBenchTaskId),l.agentId&&(d.agent_id=l.agentId),l.parentSessionId&&(d.parent_session_id=l.parentSessionId),l.agentType&&(d.agent_type=l.agentType),l.teamName&&(d.team_name=l.teamName),t.githubActionsMetadata){let e=t.githubActionsMetadata;u.github_actions_metadata={actor_id:e.actorId,repository_id:e.repositoryId,repository_owner_id:e.repositoryOwnerId}}let f;return(t.accountUuid||t.organizationUuid)&&(f={account_uuid:t.accountUuid,organization_uuid:t.organizationUuid}),{env:u,...i&&{process:Buffer.from(k(i)).toString(`base64`)},...f&&{auth:f},core:d,additional:{...a&&{rh:a},...o&&{is_assistant_mode:!0},...s&&{skill_mode:s},...c&&{observer_mode:c},...n}}}var fD,pD,mD,hD,gD,_D,vD,yD,bD,xD,SD,CD,wD,TD,ED=t((()=>{m(),Fr(),zE(),KS(),Jx(),O(),h(),HE(),Q(),wr(),qr(),ZE(),An(),xi(),fD=new Set([(Ui(),e(Hi)).COMPUTER_USE_MCP_SERVER_NAME]),pD=512,mD=128,hD=4*1024,gD=20,_D=2,vD=10,yD=new Set([`rm`,`mv`,`cp`,`touch`,`mkdir`,`chmod`,`chown`,`cat`,`head`,`tail`,`sort`,`stat`,`diff`,`wc`,`grep`,`rg`,`sed`]),bD=/\s*(?:&&|\|\||[;|])\s*/,xD=/\s+/,SD=p(()=>{let e=`2.8.1`.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);return e?e[0]:void 0}),CD=p(async()=>{let[e,t,n,r]=await Promise.all([Lr.getPackageManagers(),Lr.getRuntimes(),Jr(),Kr()]);return{platform:Ir(),platformRaw:process.env.CLAUDE_CODE_HOST_PLATFORM||process.platform,arch:Lr.arch,nodeVersion:Lr.nodeVersion,terminal:RE.terminal,packageManagers:e.join(`,`),runtimes:t.join(`,`),isRunningWithBun:Lr.isRunningWithBun(),isCi:g(process.env.CI),isClaubbit:g(process.env.CLAUBBIT),isClaudeCodeRemote:g(process.env.CLAUDE_CODE_REMOTE),isLocalAgentMode:process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`,isConductor:Lr.isConductor(),...process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE&&{remoteEnvironmentType:process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE},...process.env.CLAUDE_CODE_CONTAINER_ID&&{claudeCodeContainerId:process.env.CLAUDE_CODE_CONTAINER_ID},...process.env.CLAUDE_CODE_REMOTE_SESSION_ID&&{claudeCodeRemoteSessionId:process.env.CLAUDE_CODE_REMOTE_SESSION_ID},...process.env.CLAUDE_CODE_TAGS&&{tags:process.env.CLAUDE_CODE_TAGS},isGithubAction:g(process.env.GITHUB_ACTIONS),isClaudeCodeAction:g(process.env.CLAUDE_CODE_ACTION),isClaudeAiAuth:Y(),version:`2.8.1`,versionBase:SD(),buildTime:`2026-06-22T02:02:40.865Z`,deploymentEnvironment:Lr.detectDeploymentEnvironment(),...g(process.env.GITHUB_ACTIONS)&&{githubEventName:process.env.GITHUB_EVENT_NAME,githubActionsRunnerEnvironment:process.env.RUNNER_ENVIRONMENT,githubActionsRunnerOs:process.env.RUNNER_OS,githubActionRef:process.env.GITHUB_ACTION_PATH?.includes(`claude-code-action/`)?process.env.GITHUB_ACTION_PATH.split(`claude-code-action/`)[1]:void 0},...Wr()&&{wslVersion:Wr()},...n??{},...r.length>0?{vcs:r.join(`,`)}:{}}}),wD=null,TD=null}));function DD(){return Ki.join(ae(),`telemetry`)}function OD(e){if(!v.isAxiosError(e))return pr(e);let t=[],n=e.response?.headers?.[`request-id`];return n&&t.push(`request-id=${n}`),e.response?.status&&t.push(`status=${e.response.status}`),e.code&&t.push(`code=${e.code}`),e.message&&t.push(e.message),t.join(`, `)}var kD,AD,jD,MD=t((()=>{we(),Ie(),O(),SE(),OE(),Q(),op(),j(),h(),zn(),cT(),di(),Vr(),zi(),An(),Zw(),ly(),hr(),ED(),ce(),kD=ua(),AD=`1p_failed_events.`,jD=class{constructor(e={}){_(this,`endpoint`,void 0),_(this,`timeout`,void 0),_(this,`maxBatchSize`,void 0),_(this,`skipAuth`,void 0),_(this,`batchDelayMs`,void 0),_(this,`baseBackoffDelayMs`,void 0),_(this,`maxBackoffDelayMs`,void 0),_(this,`maxAttempts`,void 0),_(this,`isKilled`,void 0),_(this,`pendingExports`,[]),_(this,`isShutdown`,!1),_(this,`schedule`,void 0),_(this,`cancelBackoff`,null),_(this,`attempts`,0),_(this,`isRetrying`,!1),_(this,`lastExportErrorContext`,void 0),this.endpoint=`${e.baseUrl||(process.env.ANTHROPIC_BASE_URL===`https://api-staging.anthropic.com`?`https://api-staging.anthropic.com`:`https://api.anthropic.com`)}${e.path||`/api/event_logging/batch`}`,this.timeout=e.timeout||1e4,this.maxBatchSize=e.maxBatchSize||200,this.skipAuth=e.skipAuth??!1,this.batchDelayMs=e.batchDelayMs||100,this.baseBackoffDelayMs=e.baseBackoffDelayMs||500,this.maxBackoffDelayMs=e.maxBackoffDelayMs||3e4,this.maxAttempts=e.maxAttempts??8,this.isKilled=e.isKilled??(()=>!1),this.schedule=e.schedule??((e,t)=>{let n=setTimeout(e,t);return()=>clearTimeout(n)}),this.retryPreviousBatches()}async getQueuedEventCount(){return(await this.loadEventsFromCurrentBatch()).length}getCurrentBatchFilePath(){return Ki.join(DD(),`${AD}${at()}.${kD}.json`)}async loadEventsFromFile(e){try{return await ci(e)}catch{return[]}}async loadEventsFromCurrentBatch(){return this.loadEventsFromFile(this.getCurrentBatchFilePath())}async saveEventsToFile(e,t){try{if(t.length===0)try{await _a(e)}catch{}else await fa(DD(),{recursive:!0}),await va(e,t.map(e=>k(e)).join(`
32
+ `),gt(),e===`localSettings`&&xp(S_(`localSettings`),dn())}catch(e){let t=Error(`Failed to read raw settings from ${n}: ${e}`);return I(t),{error:t}}return{error:null}}function E_(e,t){return pi([...e,...t])}function D_(e,t){if(Array.isArray(e)&&Array.isArray(t))return E_(e,t)}function O_(e){let t=vg().strip().parse(e),n=[`permissions`,`sandbox`,`hooks`],r=[],i={permissions:new Set([`allow`,`deny`,`ask`,`defaultMode`,`disableBypassPermissionsMode`,...[`disableAutoMode`],`additionalDirectories`]),sandbox:new Set([`enabled`,`failIfUnavailable`,`allowUnsandboxedCommands`,`network`,`filesystem`,`ignoreViolations`,`excludedCommands`,`autoAllowBashIfSandboxed`,`enableWeakerNestedSandbox`,`enableWeakerNetworkIsolation`,`ripgrep`]),hooks:new Set([`PreToolUse`,`PostToolUse`,`Notification`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`,`SubagentStop`,`PreCompact`,`PostCompact`,`TeammateIdle`,`TaskCreated`,`TaskCompleted`])};for(let e of Object.keys(t))if(n.includes(e)&&t[e]&&typeof t[e]==`object`){let n=t[e],a=i[e];if(a)for(let t of Object.keys(n))a.has(t)&&r.push(`${e}.${t}`)}else r.push(e);return r.sort()}function k_(){if(R_)return{settings:{},errors:[]};let e=Date.now();wi(`loadSettingsFromDisk_start`),yr(`info`,`settings_load_started`),R_=!0;try{let t=Tn(),n={};t&&(n=vu(n,t,D_));let r=[],i=new Set,a=new Set;for(let e of Op()){if(e===`policySettings`){let e=null,t=[],a=mp();if(a&&Object.keys(a).length>0){let n=vg().safeParse(a);n.success?e=n.data:t.push(...Ng(n.error,`remote managed settings`))}if(!e){let n=e_();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}if(!e){let{settings:n,errors:r}=m_();n&&(e=n),t.push(...r)}if(!e){let n=t_();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}e&&(n=vu(n,e,D_));for(let e of t){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}continue}let t=x_(e);if(t){let e=$i(t);if(!a.has(e)){a.add(e);let{settings:o,errors:s}=__(t);for(let e of s){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}o&&(n=vu(n,o,D_))}}if(e===`flagSettings`){let e=ut();if(e){let t=vg().safeParse(e);t.success&&(n=vu(n,t.data,D_))}}}return yr(`info`,`settings_load_completed`,{duration_ms:Date.now()-e,source_count:a.size,error_count:r.length}),{settings:n,errors:r}}finally{R_=!1}}function A_(){let{settings:e}=M_();return e||{}}function j_(){gt();let e=[];for(let t of Op()){let n=U(t);n&&Object.keys(n).length>0&&e.push({source:t,settings:n})}return{effective:A_(),sources:e}}function M_(){let e=it();if(e!==null)return e;let t=k_();return wi(`loadSettingsFromDisk_end`),Ct(t),t}function N_(){return!!(U(`userSettings`)?.skipDangerousModePermissionPrompt||U(`localSettings`)?.skipDangerousModePermissionPrompt||U(`flagSettings`)?.skipDangerousModePermissionPrompt||U(`policySettings`)?.skipDangerousModePermissionPrompt)}function P_(){return!0}function F_(){return U(`policySettings`)?.useAutoModeDuringPlan!==!1&&U(`flagSettings`)?.useAutoModeDuringPlan!==!1&&U(`userSettings`)?.useAutoModeDuringPlan!==!1&&U(`localSettings`)?.useAutoModeDuringPlan!==!1}function I_(){{let e=D({allow:S(b()).optional(),soft_deny:S(b()).optional(),deny:S(b()).optional(),environment:S(b()).optional()}),t=[],n=[],r=[];for(let i of[`userSettings`,`localSettings`,`flagSettings`,`policySettings`]){let a=U(i);if(!a)continue;let o=e.safeParse(a.autoMode);o.success&&(o.data.allow&&t.push(...o.data.allow),o.data.soft_deny&&n.push(...o.data.soft_deny),process.env.USER_TYPE===`ant`&&o.data.deny&&n.push(...o.data.deny),o.data.environment&&r.push(...o.data.environment))}if(t.length>0||n.length>0||r.length>0)return{...t.length>0&&{allow:t},...n.length>0&&{soft_deny:n},...r.length>0&&{environment:r}}}}function L_(e){for(let t of Op()){if(t===`policySettings`)continue;let n=x_(t);if(n)try{let{resolvedPath:t}=ur(A(),n),r=Pd(t);if(!r.trim())continue;let i=fi(r,!1);if(i&&typeof i==`object`&&e in i)return!0}catch(e){g_(e,n)}}return!1}var R_,z_,B_=t((()=>{yu(),Je(),O(),vp(),Ci(),j(),br(),h(),zn(),uf(),Fd(),Vn(),Sp(),di(),Vr(),qr(),An(),Ti(),Np(),Rp(),pf(),f_(),Ft(),yg(),Ig(),R_=!1,z_=A_}));function V_(e,t){return e.find(e=>e.includes(t))??null}async function H_(){let{BedrockClient:e}=await import(`./dist-es-4z5T3Jzm.js`),t=oe(),n=g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await Fi(),...n&&{requestHandler:new(await(import(`./dist-es-hdN_ShpZ.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-CZkzHpjF.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await Lw();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}async function U_(){let{BedrockRuntimeClient:e}=await import(`./dist-es-DN7otr6F.js`),t=oe(),n=g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await Fi(),...n&&{requestHandler:new(await(import(`./dist-es-hdN_ShpZ.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-CZkzHpjF.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await Lw();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}function W_(e){return e.startsWith(`anthropic.`)}function G_(e){if(!e.startsWith(`arn:`))return e;let t=e.lastIndexOf(`/`);return t===-1?e:e.substring(t+1)}function K_(e){let t=G_(e);for(let e of X_)if(t.startsWith(`${e}.anthropic.`))return e}function q_(e,t){let n=K_(e);return n?e.replace(`${n}.`,`${t}.`):W_(e)?`${t}.${e}`:e}var J_,Y_,X_,Z_=t((()=>{m(),Q(),h(),Vr(),Li(),J_=p(async function(){let[e,{ListInferenceProfilesCommand:t}]=await Promise.all([H_(),import(`./dist-es-4z5T3Jzm.js`)]),n=[],r;try{do{let i=new t({...r&&{nextToken:r},typeEquals:`SYSTEM_DEFINED`}),a=await e.send(i);a.inferenceProfileSummaries&&n.push(...a.inferenceProfileSummaries),r=a.nextToken}while(r);return n.filter(e=>e.inferenceProfileId?.includes(`anthropic`)).map(e=>e.inferenceProfileId).filter(Boolean)}catch(e){throw I(e),e}}),Y_=p(async function(e){try{let[t,{GetInferenceProfileCommand:n}]=await Promise.all([H_(),import(`./dist-es-4z5T3Jzm.js`)]),r=new n({inferenceProfileIdentifier:e}),i=await t.send(r);if(!i.models||i.models.length===0)return null;let a=i.models[0];if(!a?.modelArn)return null;let o=a.modelArn.lastIndexOf(`/`);return o>=0?a.modelArn.substring(o+1):a.modelArn}catch(e){return I(e),null}}),X_=[`us`,`eu`,`apac`,`global`]})),Q_,$_,ev,tv,nv,rv,iv,av,ov,sv,cv,lv,uv,dv,fv=t((()=>{Q_={firstParty:`claude-3-7-sonnet-20250219`,bedrock:`us.anthropic.claude-3-7-sonnet-20250219-v1:0`,vertex:`claude-3-7-sonnet@20250219`,foundry:`claude-3-7-sonnet`,openai:`claude-3-7-sonnet-20250219`,gemini:`claude-3-7-sonnet-20250219`,grok:`claude-3-7-sonnet-20250219`},$_={firstParty:`claude-3-5-sonnet-20241022`,bedrock:`anthropic.claude-3-5-sonnet-20241022-v2:0`,vertex:`claude-3-5-sonnet-v2@20241022`,foundry:`claude-3-5-sonnet`,openai:`claude-3-5-sonnet-20241022`,gemini:`claude-3-5-sonnet-20241022`,grok:`claude-3-5-sonnet-20241022`},ev={firstParty:`claude-3-5-haiku-20241022`,bedrock:`us.anthropic.claude-3-5-haiku-20241022-v1:0`,vertex:`claude-3-5-haiku@20241022`,foundry:`claude-3-5-haiku`,openai:`claude-3-5-haiku-20241022`,gemini:`claude-3-5-haiku-20241022`,grok:`claude-3-5-haiku-20241022`},tv={firstParty:`claude-haiku-4-5-20251001`,bedrock:`us.anthropic.claude-haiku-4-5-20251001-v1:0`,vertex:`claude-haiku-4-5@20251001`,foundry:`claude-haiku-4-5`,openai:`claude-haiku-4-5-20251001`,gemini:`claude-haiku-4-5-20251001`,grok:`claude-haiku-4-5-20251001`},nv={firstParty:`claude-sonnet-4-20250514`,bedrock:`us.anthropic.claude-sonnet-4-20250514-v1:0`,vertex:`claude-sonnet-4@20250514`,foundry:`claude-sonnet-4`,openai:`claude-sonnet-4-20250514`,gemini:`claude-sonnet-4-20250514`,grok:`claude-sonnet-4-20250514`},rv={firstParty:`claude-sonnet-4-5-20250929`,bedrock:`us.anthropic.claude-sonnet-4-5-20250929-v1:0`,vertex:`claude-sonnet-4-5@20250929`,foundry:`claude-sonnet-4-5`,openai:`claude-sonnet-4-5-20250929`,gemini:`claude-sonnet-4-5-20250929`,grok:`claude-sonnet-4-5-20250929`},iv={firstParty:`claude-opus-4-20250514`,bedrock:`us.anthropic.claude-opus-4-20250514-v1:0`,vertex:`claude-opus-4@20250514`,foundry:`claude-opus-4`,openai:`claude-opus-4-20250514`,gemini:`claude-opus-4-20250514`,grok:`claude-opus-4-20250514`},av={firstParty:`claude-opus-4-1-20250805`,bedrock:`us.anthropic.claude-opus-4-1-20250805-v1:0`,vertex:`claude-opus-4-1@20250805`,foundry:`claude-opus-4-1`,openai:`claude-opus-4-1-20250805`,gemini:`claude-opus-4-1-20250805`,grok:`claude-opus-4-1-20250805`},ov={firstParty:`claude-opus-4-5-20251101`,bedrock:`us.anthropic.claude-opus-4-5-20251101-v1:0`,vertex:`claude-opus-4-5@20251101`,foundry:`claude-opus-4-5`,openai:`claude-opus-4-5-20251101`,gemini:`claude-opus-4-5-20251101`,grok:`claude-opus-4-5-20251101`},sv={firstParty:`claude-opus-4-6`,bedrock:`us.anthropic.claude-opus-4-6-v1`,vertex:`claude-opus-4-6`,foundry:`claude-opus-4-6`,openai:`claude-opus-4-6`,gemini:`claude-opus-4-6`,grok:`claude-opus-4-6`},cv={firstParty:`claude-opus-4-7`,bedrock:`us.anthropic.claude-opus-4-7-v1`,vertex:`claude-opus-4-7`,foundry:`claude-opus-4-7`,openai:`claude-opus-4-7`,gemini:`claude-opus-4-7`,grok:`claude-opus-4-7`},lv={firstParty:`claude-sonnet-4-6`,bedrock:`us.anthropic.claude-sonnet-4-6`,vertex:`claude-sonnet-4-6`,foundry:`claude-sonnet-4-6`,openai:`claude-sonnet-4-6`,gemini:`claude-sonnet-4-6`,grok:`claude-sonnet-4-6`},uv={haiku35:ev,haiku45:tv,sonnet35:$_,sonnet37:Q_,sonnet40:nv,sonnet45:rv,sonnet46:lv,opus40:iv,opus41:av,opus45:ov,opus46:sv,opus47:cv},Object.values(uv).map(e=>e.firstParty),dv=Object.fromEntries(Object.entries(uv).map(([e,t])=>[t.firstParty,e]))}));function W(e=A_()){let t=e.modelType;return t===`openai`?`openai`:t===`gemini`?`gemini`:t===`grok`?`grok`:g(process.env.CLAUDE_CODE_USE_BEDROCK)?`bedrock`:g(process.env.CLAUDE_CODE_USE_VERTEX)?`vertex`:g(process.env.CLAUDE_CODE_USE_FOUNDRY)?`foundry`:g(process.env.CLAUDE_CODE_USE_OPENAI)?`openai`:g(process.env.CLAUDE_CODE_USE_GEMINI)?`gemini`:g(process.env.CLAUDE_CODE_USE_GROK)?`grok`:`firstParty`}function pv(){return W()}function mv(){let e=process.env.ANTHROPIC_BASE_URL;if(!e)return!0;try{let t=new URL(e).host,n=[`api.anthropic.com`];return process.env.USER_TYPE===`ant`&&n.push(`api-staging.anthropic.com`),n.includes(t)}catch{return!1}}var hv=t((()=>{B_(),h()}));function gv(e){let t={};for(let n of Sv)t[n]=uv[n][e];return t}async function _v(){let e=gv(`bedrock`),t;try{t=await J_()}catch(t){return I(t),e}if(!t?.length)return e;let n={};for(let r of Sv){let i=uv[r].firstParty;n[r]=V_(t,i)||e[r]}return n}function vv(e){let t=A_().modelOverrides;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=dv[e];t&&r&&(n[t]=r)}return n}function yv(e){let t;try{t=A_().modelOverrides}catch{return e}if(!t)return e;for(let[n,r]of Object.entries(t))if(r===e)return n;return e}function bv(){if(gn()===null){if(W()!==`bedrock`){Wt(gv(W()));return}Cv()}}function G(){let e=gn();return e===null?(bv(),vv(gv(W()))):vv(e)}async function xv(){if(gn()===null){if(W()!==`bedrock`){Wt(gv(W()));return}await Cv()}}var Sv,Cv,wv=t((()=>{O(),Vr(),cp(),B_(),Z_(),fv(),hv(),Sv=Object.keys(uv),Cv=sp(async()=>{if(gn()===null)try{Wt(await _v())}catch(e){I(e)}})}));function Tv(){if(g(process.env.DISABLE_COST_WARNINGS)||Y())return!1;let e=SC(),t=CC()!==null;if(!e.hasToken&&!t)return!1;let n=H(),r=n.oauthAccount?.organizationRole,i=n.oauthAccount?.workspaceRole;return!r||!i?!1:[`admin`,`billing`].includes(r)||[`workspace_admin`,`workspace_billing`].includes(i)}function Ev(e){Ov=e}function Dv(){if(Ov!==null)return Ov;if(!Y())return!1;let e=X();if(e===`max`||e===`pro`)return!0;let t=H().oauthAccount?.organizationRole;return!!t&&[`admin`,`billing`,`owner`,`primary_owner`].includes(t)}var Ov,kv=t((()=>{Q(),op(),h(),Ov=null}));function Av(){return process.env.USER_TYPE===`ant`?process.env.CLAUDE_MOCK_HEADERLESS_429?process.env.CLAUDE_MOCK_HEADERLESS_429:Bv?Vv:null:null}function jv(){return!Bv||process.env.USER_TYPE!==`ant`||Object.keys(zv).length===0?null:zv}function Mv(){zv={},Kv=[],Hv=null,Uv=null,Wv=null,Vv=null,Ev(null),Bv=!1}function Nv(e){let t=jv();if(!t)return e;let n=new globalThis.Headers(e);return Object.entries(t).forEach(([e,t])=>{t!==void 0&&n.set(e,t)}),n}function Pv(){return process.env.USER_TYPE===`ant`?Bv||!!process.env.CLAUDE_MOCK_HEADERLESS_429:!1}function Fv(){return!Bv||process.env.USER_TYPE!==`ant`?null:Hv||Gv}function Iv(){return Bv&&Hv!==null&&process.env.USER_TYPE===`ant`}function Lv(){return Uv!==null}function Rv(e){if(Uv===null||!e)return null;if(Wv!==null&&Date.now()>=Wv)return Mv(),null;Wv===null&&(Wv=Date.now()+Uv);let t=Wv-Date.now(),n={...zv};return n[`retry-after`]=String(Math.max(1,Math.ceil(t/1e3))),n}var zv,Bv,Vv,Hv,Uv,Wv,Gv,Kv,qv=t((()=>{kv(),zv={},Bv=!1,Vv=null,Hv=null,Uv=null,Wv=null,Gv=`max`}));async function Jv(){let e=H().oauthAccount?.accountUuid,t=CC();if(!e||!t)return;let n=`${P().BASE_API_URL}/api/claude_cli_profile`;try{return(await v.get(n,{headers:{"x-api-key":t,"anthropic-beta":Dr},params:{account_uuid:e},timeout:1e4})).data}catch(e){I(e)}}async function Yv(e){let t=`${P().BASE_API_URL}/api/oauth/profile`;try{return(await v.get(t,{headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},timeout:1e4})).data}catch(e){I(e)}}var Xv=t((()=>{Ie(),kr(),Q(),op(),Vr()}));function Zv(e){return!!e?.includes(Tr)}function Qv(e){return e?.split(` `).filter(Boolean)??[]}function $v({codeChallenge:e,state:t,port:n,isManual:r,loginWithClaudeAi:i,inferenceOnly:a,orgUUID:o,loginHint:s,loginMethod:c}){let l=i?P().CLAUDE_AI_AUTHORIZE_URL:P().CONSOLE_AUTHORIZE_URL,u=new URL(l);u.searchParams.append(`code`,`true`),u.searchParams.append(`client_id`,P().CLIENT_ID),u.searchParams.append(`response_type`,`code`),u.searchParams.append(`redirect_uri`,r?P().MANUAL_REDIRECT_URL:`http://localhost:${n}/callback`);let d=a?[Tr]:Or;return u.searchParams.append(`scope`,d.join(` `)),u.searchParams.append(`code_challenge`,e),u.searchParams.append(`code_challenge_method`,`S256`),u.searchParams.append(`state`,t),o&&u.searchParams.append(`orgUUID`,o),s&&u.searchParams.append(`login_hint`,s),c&&u.searchParams.append(`login_method`,c),u.toString()}async function ey(e,t,n,r,i=!1,a){let o={grant_type:`authorization_code`,code:e,redirect_uri:i?P().MANUAL_REDIRECT_URL:`http://localhost:${r}/callback`,client_id:P().CLIENT_ID,code_verifier:n,state:t};a!==void 0&&(o.expires_in=a);let s=await v.post(P().TOKEN_URL,o,{headers:{"Content-Type":`application/json`},timeout:15e3});if(s.status!==200)throw Error(s.status===401?`Authentication failed: Invalid authorization code`:`Token exchange failed (${s.status}): ${s.statusText}`);return N(`tengu_oauth_token_exchange_success`,{}),s.data}async function ty(e,{scopes:t}={}){let n={grant_type:`refresh_token`,refresh_token:e,client_id:P().CLIENT_ID,scope:(t?.length?t:Er).join(` `)};try{let t=await v.post(P().TOKEN_URL,n,{headers:{"Content-Type":`application/json`},timeout:15e3});if(t.status!==200)throw Error(`Token refresh failed: ${t.statusText}`);let r=t.data,{access_token:i,refresh_token:a=e,expires_in:o}=r,s=Date.now()+o*1e3,c=Qv(r.scope);N(`tengu_oauth_token_refresh_success`,{});let l=H(),u=Z(),d=l.oauthAccount?.billingType!==void 0&&l.oauthAccount?.accountCreatedAt!==void 0&&l.oauthAccount?.subscriptionCreatedAt!==void 0&&u?.subscriptionType!=null&&u?.rateLimitTier!=null?null:await ay(i);if(d&&l.oauthAccount){let e={};d.displayName!==void 0&&(e.displayName=d.displayName),typeof d.hasExtraUsageEnabled==`boolean`&&(e.hasExtraUsageEnabled=d.hasExtraUsageEnabled),d.billingType!==null&&(e.billingType=d.billingType),d.accountCreatedAt!==void 0&&(e.accountCreatedAt=d.accountCreatedAt),d.subscriptionCreatedAt!==void 0&&(e.subscriptionCreatedAt=d.subscriptionCreatedAt),Object.keys(e).length>0&&V(t=>({...t,oauthAccount:t.oauthAccount?{...t.oauthAccount,...e}:t.oauthAccount}))}return{accessToken:i,refreshToken:a,expiresAt:s,scopes:c,subscriptionType:d?.subscriptionType??u?.subscriptionType??null,rateLimitTier:d?.rateLimitTier??u?.rateLimitTier??null,profile:d?.rawProfile,tokenAccount:r.account?{uuid:r.account.uuid,emailAddress:r.account.email_address,organizationUuid:r.organization?.uuid}:void 0}}catch(e){let t=v.isAxiosError(e)&&e.response?.data?JSON.stringify(e.response.data):void 0;throw N(`tengu_oauth_token_refresh_failure`,{error:e.message,...t&&{responseBody:t}}),e}}async function ny(e){let t=await v.get(P().ROLES_URL,{headers:{Authorization:`Bearer ${e}`}});if(t.status!==200)throw Error(`Failed to fetch user roles: ${t.statusText}`);let n=t.data;if(!H().oauthAccount)throw Error(`OAuth account information not found in config`);V(e=>({...e,oauthAccount:e.oauthAccount?{...e.oauthAccount,organizationRole:n.organization_role,workspaceRole:n.workspace_role,organizationName:n.organization_name}:e.oauthAccount})),N(`tengu_oauth_roles_stored`,{org_role:n.organization_role})}async function ry(e){try{let t=await v.post(P().API_KEY_URL,null,{headers:{Authorization:`Bearer ${e}`}}),n=t.data?.raw_key;return n?(await $C(n),N(`tengu_oauth_api_key`,{status:`success`,statusCode:t.status}),n):null}catch(e){throw N(`tengu_oauth_api_key`,{status:`failure`,error:e instanceof Error?e.message:String(e)}),e}}function iy(e){return e===null?!1:Date.now()+300*1e3>=e}async function ay(e){let t=await Yv(e),n=t?.organization?.organization_type,r=null;switch(n){case`claude_max`:r=`max`;break;case`claude_pro`:r=`pro`;break;case`claude_enterprise`:r=`enterprise`;break;case`claude_team`:r=`team`;break;default:r=null;break}let i={subscriptionType:r,rateLimitTier:t?.organization?.rate_limit_tier??null,hasExtraUsageEnabled:t?.organization?.has_extra_usage_enabled??null,billingType:t?.organization?.billing_type??null};return t?.account?.display_name&&(i.displayName=t.account.display_name),t?.account?.created_at&&(i.accountCreatedAt=t.account.created_at),t?.organization?.subscription_created_at&&(i.subscriptionCreatedAt=t.organization.subscription_created_at),N(`tengu_oauth_profile_fetch_success`,{}),{...i,rawProfile:t}}async function oy(){let e=H().oauthAccount?.organizationUuid;if(e)return e;let t=Z()?.accessToken;return t===void 0||!dw()?null:(await Yv(t))?.organization?.uuid||null}async function sy(){let e=process.env.CLAUDE_CODE_ACCOUNT_UUID,t=process.env.CLAUDE_CODE_USER_EMAIL,n=process.env.CLAUDE_CODE_ORGANIZATION_UUID,r=!!(e&&t&&n);e&&t&&n&&(H().oauthAccount||cy({accountUuid:e,emailAddress:t,organizationUuid:n})),await lw();let i=H();if(i.oauthAccount&&i.oauthAccount.billingType!==void 0&&i.oauthAccount.accountCreatedAt!==void 0&&i.oauthAccount.subscriptionCreatedAt!==void 0||!Y()||!dw())return!1;let a=Z();if(a?.accessToken){let e=await Yv(a.accessToken);if(e)return r&&M(`OAuth profile fetch succeeded, overriding env var account info`,{level:`info`}),cy({accountUuid:e.account.uuid,emailAddress:e.account.email,organizationUuid:e.organization.uuid,displayName:e.account.display_name||void 0,hasExtraUsageEnabled:e.organization.has_extra_usage_enabled??!1,billingType:e.organization.billing_type??void 0,accountCreatedAt:e.account.created_at,subscriptionCreatedAt:e.organization.subscription_created_at??void 0}),!0}return!1}function cy({accountUuid:e,emailAddress:t,organizationUuid:n,displayName:r,hasExtraUsageEnabled:i,billingType:a,accountCreatedAt:o,subscriptionCreatedAt:s}){let c={accountUuid:e,emailAddress:t,organizationUuid:n,hasExtraUsageEnabled:i,billingType:a,accountCreatedAt:o,subscriptionCreatedAt:s};r&&(c.displayName=r),V(e=>e.oauthAccount?.accountUuid===c.accountUuid&&e.oauthAccount?.emailAddress===c.emailAddress&&e.oauthAccount?.organizationUuid===c.organizationUuid&&e.oauthAccount?.displayName===c.displayName&&e.oauthAccount?.hasExtraUsageEnabled===c.hasExtraUsageEnabled&&e.oauthAccount?.billingType===c.billingType&&e.oauthAccount?.accountCreatedAt===c.accountCreatedAt&&e.oauthAccount?.subscriptionCreatedAt===c.subscriptionCreatedAt?e:{...e,oauthAccount:c})}var ly=t((()=>{Ie(),hr(),kr(),Q(),op(),j(),Xv()}));function uy(e,t,n){if(g(process.env.CLAUDE_CODE_REMOTE))try{ra(hy,{recursive:!0,mode:448}),sa(e,t,{encoding:`utf8`,mode:384}),M(`Persisted ${n} to ${e} for subprocess access`)}catch(e){M(`Failed to persist ${n} to disk (non-fatal): ${pr(e)}`,{level:`error`})}}function dy(e,t){try{let n=A().readFileSync(e,{encoding:`utf8`}).trim();return n?(M(`Read ${t} from well-known file ${e}`),n):null}catch(n){return jn(n)||M(`Failed to read ${t} from ${e}: ${pr(n)}`,{level:`debug`}),null}}function fy({envVar:e,wellKnownPath:t,label:n,getCached:r,setCached:i}){let a=r();if(a!==void 0)return a;let o=process.env[e];if(!o){let e=dy(t,n);return i(e),e}let s=parseInt(o,10);if(Number.isNaN(s))return M(`${e} must be a valid file descriptor number, got: ${o}`,{level:`error`}),i(null),null;try{let e=A(),r=process.platform===`darwin`||process.platform===`freebsd`?`/dev/fd/${s}`:`/proc/self/fd/${s}`,a=e.readFileSync(r,{encoding:`utf8`}).trim();return a?(M(`Successfully read ${n} from file descriptor ${s}`),i(a),uy(t,a,n),a):(M(`File descriptor contained empty ${n}`,{level:`error`}),i(null),null)}catch(e){M(`Failed to read ${n} from file descriptor ${s}: ${pr(e)}`,{level:`error`});let r=dy(t,n);return i(r),r}}function py(){return fy({envVar:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,wellKnownPath:gy,label:`OAuth token`,getCached:Gt,setCached:Jt})}function my(){return fy({envVar:`CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR`,wellKnownPath:_y,label:`API key`,getCached:wn,setCached:ot})}var hy,gy,_y,vy,yy=t((()=>{O(),j(),h(),zn(),Vn(),hy=`/home/claude/.claude/remote`,gy=`${hy}/.oauth_token`,_y=`${hy}/.api_key`,vy=`${hy}/.session_ingress_token`}));function by(e=``){let t=ae(),n=process.env.CLAUDE_CONFIG_DIR?`-${ca(`sha256`).update(t).digest(`hex`).substring(0,8)}`:``;return`Claude Code${P().OAUTH_FILE_SUFFIX}${e}${n}`}function xy(){try{return process.env.USER||Gi().username}catch{return`claude-code-user`}}function Sy(){K.cache={data:null,cachedAt:0},K.generation++,K.readInFlight=null}function Cy(e){if(K.cache.cachedAt!==0)return;let t=null;if(e)try{t=JSON.parse(e)}catch{return}K.cache={data:t,cachedAt:Date.now()}}var wy,K,Ty=t((()=>{kr(),h(),wy=`-credentials`,K={cache:{data:null,cachedAt:0},generation:0,readInFlight:null}}));async function Ey(){if(process.platform===`darwin`&&(await Pr(`security delete-generic-password -a $USER -s "${by()}"`,{shell:!0,reject:!1})).exitCode!==0)throw Error(`Failed to delete keychain entry`)}function Dy(e){return e.slice(-20)}var Oy=t((()=>{Nr(),Ty()}));function ky(e){return e?.name===`CredentialsProviderError`}function Ay(e){if(!e||typeof e!=`object`)return!1;let t=e;if(!t.Credentials||typeof t.Credentials!=`object`)return!1;let n=t.Credentials;return typeof n.AccessKeyId==`string`&&typeof n.SecretAccessKey==`string`&&typeof n.SessionToken==`string`&&n.AccessKeyId.length>0&&n.SecretAccessKey.length>0&&n.SessionToken.length>0}async function jy(){let{STSClient:e,GetCallerIdentityCommand:t}=await import(`./dist-es-D1LN6CJd.js`);await new e().send(new t({}))}async function My(){try{M(`Clearing AWS credential provider cache`);let{fromIni:e}=await import(`./dist-es-DGn8uOwQ2.js`);await e({ignoreCache:!0})(),M(`AWS credential provider cache refreshed`)}catch{M(`Failed to clear AWS credential cache (this is expected if no credentials are configured)`)}}var Ny=t((()=>{j()})),Py,Fy=t((()=>{ft(),ce(),Py=class e{constructor(){_(this,`status`,{isAuthenticating:!1,output:[]}),_(this,`changed`,Ot()),_(this,`subscribe`,this.changed.subscribe)}static getInstance(){return e.instance||(e.instance=new e),e.instance}getStatus(){return{...this.status,output:[...this.status.output]}}startAuthentication(){this.status={isAuthenticating:!0,output:[]},this.changed.emit(this.getStatus())}addOutput(e){this.status.output.push(e),this.changed.emit(this.getStatus())}setError(e){this.status.error=e,this.changed.emit(this.getStatus())}endAuthentication(e){e?this.status={isAuthenticating:!1,output:[]}:this.status.isAuthenticating=!1,this.changed.emit(this.getStatus())}static reset(){e.instance&&(e.instance.changed.clear(),e.instance=null)}},_(Py,`instance`,null)})),Iy,Ly,Ry,zy,By,Vy,Hy,Uy,Wy,Gy,Ky,qy,Jy,Yy,Xy,Zy,Qy,$y,eb=t((()=>{Iy=`claude-code-20250219`,Ly=`interleaved-thinking-2025-05-14`,Ry=`context-1m-2025-08-07`,zy=`context-management-2025-06-27`,By=`structured-outputs-2025-12-15`,Vy=`web-search-2025-03-05`,Hy=`tool-search-tool-2025-10-19`,Uy=`effort-2025-11-24`,Wy=`task-budgets-2026-03-13`,Gy=`prompt-caching-scope-2026-01-05`,Ky=`fast-mode-2026-02-01`,qy=`redact-thinking-2026-02-12`,Jy=`token-efficient-tools-2026-03-28`,Yy=`afk-mode-2026-01-31`,Xy=process.env.USER_TYPE===`ant`?`cli-internal-2026-02-09`:``,Zy=`advisor-tool-2026-03-01`,Qy=new Set([Ly,Ry,Hy]),$y=new Set([Iy,Ly,zy])}));function tb(){return process.env.USER_TYPE===`ant`?bO(`tengu_ant_model_override`,null):null}function nb(){return process.env.USER_TYPE===`ant`?tb()?.antModels??[]:[]}function rb(e){if(process.env.USER_TYPE!==`ant`||e===void 0)return;let t=e.toLowerCase();return nb().find(n=>n.alias===e||t.includes(n.model.toLowerCase()))}var ib=t((()=>{XO()}));function ab(){return!g(process.env.CLAUDE_CODE_DISABLE_FAST_MODE)}function ob(){return ab()?cb()===null:!1}function sb(e,t){switch(e){case`free`:return t===`oauth`?`Fast mode requires a paid subscription`:`Fast mode unavailable during evaluation. Please purchase credits.`;case`preference`:return`Fast mode has been disabled by your organization`;case`extra_usage_disabled`:return`Fast mode requires extra usage billing · /extra-usage to enable`;case`network_error`:return`Fast mode unavailable due to network connectivity issues`;case`unknown`:return`Fast mode is currently unavailable`}}function cb(){if(!ab())return`Fast mode is not available`;let e=bO(`tengu_penguins_off`,null);if(e!==null)return M(`Fast mode unavailable: ${e}`),e;if(!Ar()&&bO(`tengu_marble_sandcastle`,!1))return`Fast mode requires the native binary · Install from: https://claude.com/product/claude-code`;if(Mt()&&rn()&&!xt()&&!U(`flagSettings`)?.fastMode){let e=`Fast mode is not available in the Agent SDK`;return M(`Fast mode unavailable: ${e}`),e}if(W()!==`firstParty`){let e=`Fast mode is not available on Bedrock, Vertex, or Foundry`;return M(`Fast mode unavailable: ${e}`),e}if(q.status===`disabled`){if((q.reason===`network_error`||q.reason===`unknown`)&&g(process.env.CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS))return null;let e=Z()===null?`api-key`:`oauth`,t=sb(q.reason,e);return M(`Fast mode unavailable: ${t}`),t}return null}function lb(){return`opus`+(Fx()?`[1m]`:``)}function ub(e){if(!ab()||!ob()||!db(e))return!1;let t=A_();return t.fastModePerSessionOptIn?!1:t.fastMode===!0}function db(e){if(!ab())return!1;let t=Bx(e??kx());return t.toLowerCase().includes(`opus-4-7`)||t.toLowerCase().includes(`opus-4-6`)}function fb(){return Tb.status===`cooldown`&&Date.now()>=Tb.resetAt&&(ab()&&!Eb&&(M(`Fast mode cooldown expired, re-enabling fast mode`),Eb=!0,Ob.emit()),Tb={status:`active`}),Tb}function pb(e,t){if(!ab())return;Tb={status:`cooldown`,resetAt:e,reason:t},Eb=!1;let n=e-Date.now();M(`Fast mode cooldown triggered (${t}), duration ${Math.round(n/1e3)}s`),N(`tengu_fast_mode_fallback_triggered`,{cooldown_duration_ms:n,cooldown_reason:t}),Db.emit(e,t)}function mb(){Tb={status:`active`}}function hb(){q.status!==`disabled`&&(q={status:`disabled`,reason:`preference`},T_(`userSettings`,{fastMode:void 0}),V(e=>({...e,penguinModeOrgEnabled:!1})),Nb.emit(!1))}function gb(e){switch(e){case`out_of_credits`:return`Fast mode disabled · extra usage credits exhausted`;case`org_level_disabled`:case`org_service_level_disabled`:return`Fast mode disabled · extra usage disabled by your organization`;case`org_level_disabled_until`:return`Fast mode disabled · extra usage spending cap reached`;case`member_level_disabled`:return`Fast mode disabled · extra usage disabled for your account`;case`seat_tier_level_disabled`:case`seat_tier_zero_credit_limit`:case`member_zero_credit_limit`:return`Fast mode disabled · extra usage not available for your plan`;case`overage_not_provisioned`:case`no_limits_configured`:return`Fast mode requires extra usage billing · /extra-usage to enable`;default:return`Fast mode disabled · extra usage not available`}}function _b(e){return e===`org_level_disabled_until`||e===`out_of_credits`}function vb(e){let t=gb(e);M(`Fast mode overage rejection: ${e??`unknown`} — ${t}`),N(`tengu_fast_mode_overage_rejected`,{overage_disabled_reason:e??`unknown`}),_b(e)||(T_(`userSettings`,{fastMode:void 0}),V(e=>({...e,penguinModeOrgEnabled:!1}))),jb.emit(t)}function yb(){return fb().status===`cooldown`}function bb(e,t){let n=ab()&&ob()&&!!t&&db(e);return n&&yb()?`cooldown`:n?`on`:`off`}async function xb(e){let t=`${P().BASE_API_URL}/api/claude_code_penguin_mode`,n=`accessToken`in e?{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":Dr}:{"x-api-key":e.apiKey};return(await v.get(t,{headers:n})).data}function Sb(){if(!ab()||q.status!==`pending`)return;let e=process.env.USER_TYPE===`ant`,t=H().penguinModeOrgEnabled===!0;q=e||t?{status:`enabled`}:{status:`disabled`,reason:`unknown`}}async function Cb(){if(Br()||!ab())return;if(Lb)return M(`Fast mode prefetch in progress, returning in-flight promise`),Lb;let e=CC();if(!(Z()?.accessToken&&dw())&&!e){let e=process.env.USER_TYPE===`ant`,t=H().penguinModeOrgEnabled===!0;q=e||t?{status:`enabled`}:{status:`disabled`,reason:`preference`};return}let t=Date.now();if(t-Ib<Fb){M(`Skipping fast mode prefetch, fetched recently`);return}Ib=t;let n=async()=>{let t=Z(),n=t?.accessToken&&dw()?{accessToken:t.accessToken}:e?{apiKey:e}:null;if(!n)throw Error(`No auth available`);return xb(n)};async function r(){try{let e;try{e=await n()}catch(t){if(v.isAxiosError(t)&&(t.response?.status===401||t.response?.status===403&&typeof t.response?.data==`string`&&t.response.data.includes(`OAuth token has been revoked`))){let r=Z()?.accessToken;if(r)await ow(r),e=await n();else throw t}else throw t}let t=q.status===`pending`?H().penguinModeOrgEnabled:q.status===`enabled`;q=e.enabled?{status:`enabled`}:{status:`disabled`,reason:e.disabled_reason??`preference`},t!==e.enabled&&(e.enabled||T_(`userSettings`,{fastMode:void 0}),V(t=>({...t,penguinModeOrgEnabled:e.enabled})),Nb.emit(e.enabled)),M(`Org fast mode: ${e.enabled?`enabled`:`disabled (${e.disabled_reason??`preference`})`}`)}catch(e){let t=process.env.USER_TYPE===`ant`,n=H().penguinModeOrgEnabled===!0;q=t||n?{status:`enabled`}:{status:`disabled`,reason:`network_error`},M(`Failed to fetch org fast mode status, defaulting to ${q.status===`enabled`?`enabled (cached)`:`disabled (network_error)`}: ${e}`,{level:`error`}),N(`tengu_org_penguin_mode_fetch_failed`,{})}finally{Lb=null}}return Lb=r(),Lb}var wb,Tb,Eb,Db,Ob,kb,Ab,jb,Mb,q,Nb,Pb,Fb,Ib,Lb,Rb=t((()=>{Ie(),kr(),XO(),O(),hr(),Q(),jr(),op(),j(),h(),Jx(),hv(),zr(),B_(),ft(),wb=`Opus 4.7`,Tb={status:`active`},Eb=!1,Db=Ot(),Ob=Ot(),kb=Db.subscribe,Ab=Ob.subscribe,jb=Ot(),Mb=jb.subscribe,q={status:`pending`},Nb=Ot(),Pb=Nb.subscribe,Fb=3e4,Ib=0,Lb=null}));function zb(e){return ab()&&e?Xb:Yb}function Bb(e,t){return t.input_tokens/1e6*e.inputTokens+t.output_tokens/1e6*e.outputTokens+(t.cache_read_input_tokens??0)/1e6*e.promptCacheReadTokens+(t.cache_creation_input_tokens??0)/1e6*e.promptCacheWriteTokens+(t.server_tool_use?.web_search_requests??0)*e.webSearchRequests}function Vb(e,t){let n=jx(e);return n===J(sv.firstParty)?zb(t.speed===`fast`):ex[n]||(Hb(e,n),ex[jx(kx())]??$b)}function Hb(e,t){N(`tengu_unknown_model_cost`,{model:e,shortName:t}),rt()}function Ub(e,t){return Bb(Vb(e,t),t)}function Wb(e,t){return Ub(e,{input_tokens:t.inputTokens,output_tokens:t.outputTokens,cache_read_input_tokens:t.cacheReadInputTokens,cache_creation_input_tokens:t.cacheCreationInputTokens})}function Gb(e){return Number.isInteger(e)?`$${e}`:`$${e.toFixed(2)}`}function Kb(e){return`${Gb(e.inputTokens)}/${Gb(e.outputTokens)} per Mtok`}var qb,Jb,Yb,Xb,Zb,Qb,$b,ex,tx=t((()=>{hr(),O(),Rb(),fv(),Jx(),qb={inputTokens:3,outputTokens:15,promptCacheWriteTokens:3.75,promptCacheReadTokens:.3,webSearchRequests:.01},Jb={inputTokens:15,outputTokens:75,promptCacheWriteTokens:18.75,promptCacheReadTokens:1.5,webSearchRequests:.01},Yb={inputTokens:5,outputTokens:25,promptCacheWriteTokens:6.25,promptCacheReadTokens:.5,webSearchRequests:.01},Xb={inputTokens:30,outputTokens:150,promptCacheWriteTokens:37.5,promptCacheReadTokens:3,webSearchRequests:.01},Zb={inputTokens:.8,outputTokens:4,promptCacheWriteTokens:1,promptCacheReadTokens:.08,webSearchRequests:.01},Qb={inputTokens:1,outputTokens:5,promptCacheWriteTokens:1.25,promptCacheReadTokens:.1,webSearchRequests:.01},$b=Yb,ex={[J(ev.firstParty)]:Zb,[J(tv.firstParty)]:Qb,[J($_.firstParty)]:qb,[J(Q_.firstParty)]:qb,[J(nv.firstParty)]:qb,[J(rv.firstParty)]:qb,[J(lv.firstParty)]:qb,[J(iv.firstParty)]:Jb,[J(av.firstParty)]:Jb,[J(ov.firstParty)]:Yb,[J(sv.firstParty)]:Yb}}));function nx(e){return ix.includes(e)}function rx(e){return ax.includes(e)}var ix,ax,ox=t((()=>{ix=[`sonnet`,`opus`,`haiku`,`best`,`sonnet[1m]`,`opus[1m]`,`opusplan`],ax=[`sonnet`,`opus`,`haiku`]}));function sx(e,t){return e.includes(t)?!0:nx(e)?Bx(e).toLowerCase().includes(t):!1}function cx(e,t){return e.startsWith(t)?e.length===t.length||e[t.length]===`-`:!1}function lx(e,t){let n=nx(e)?Bx(e).toLowerCase():e;return!!(cx(n,t)||!t.startsWith(`claude-`)&&cx(n,`claude-${t}`))}function ux(e,t){for(let n of t){if(rx(n))continue;let t=n.indexOf(e);if(t===-1)continue;let r=t+e.length;if(r===n.length||n[r]===`-`)return!0}return!1}function dx(e){let{availableModels:t}=z_()||{};if(!t)return!0;if(t.length===0)return!1;let n=yv(e).trim().toLowerCase(),r=t.map(e=>e.trim().toLowerCase());if(r.includes(n)&&(!rx(n)||!ux(n,r)))return!0;for(let e of r)if(rx(e)&&!ux(e,r)&&sx(n,e))return!0;if(nx(n)){let e=Bx(n).toLowerCase();if(r.includes(e))return!0}for(let e of r)if(!rx(e)&&nx(e)&&Bx(e).toLowerCase()===n)return!0;for(let e of r)if(!rx(e)&&!nx(e)&&lx(n,e))return!0;return!1}var fx=t((()=>{B_(),ox(),Jx(),wv()}));function px(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}function mx(e){let t=e.toLowerCase().replace(/\[1m\]$/,``);return _x.some(e=>e.value.toLowerCase()===t)}var hx,gx,_x,vx=t((()=>{hx=`gpt-5.5`,gx=`gpt-5.4-mini`,_x=[{value:`gpt-5.5`,label:`GPT-5.5`,description:`Frontier model for complex coding, research, and real-world work`},{value:`gpt-5.4`,label:`GPT-5.4`,description:`Strong model for everyday coding`},{value:`gpt-5.4-mini`,label:`GPT-5.4-Mini`,description:`Small, fast, and cost-efficient model for simpler coding tasks`},{value:`gpt-5.3-codex`,label:`GPT-5.3-Codex`,description:`Coding-optimized model`},{value:`gpt-5.3-codex-spark`,label:`GPT-5.3-Codex-Spark`,description:`Ultra-fast coding model`},{value:`gpt-5.2`,label:`GPT-5.2`,description:`Optimized for professional work and long-running agents`}]}));function yx(){let e=W();return e===`openai`&&px()?process.env.OPENAI_SMALL_FAST_MODEL??`gpt-5.4-mini`:e===`openai`&&process.env.OPENAI_SMALL_FAST_MODEL?process.env.OPENAI_SMALL_FAST_MODEL:e===`gemini`&&process.env.GEMINI_SMALL_FAST_MODEL?process.env.GEMINI_SMALL_FAST_MODEL:process.env.ANTHROPIC_SMALL_FAST_MODEL||Dx()}function bx(e){return e===G().opus40||e===G().opus41||e===G().opus45||e===G().opus46||e===G().opus47}function xx(){let e,t=$t();if(t!==void 0)e=t;else{let t=z_()||{};e=process.env.ANTHROPIC_MODEL||t.model||void 0}if(!(e&&!dx(e)))return e}function Sx(){let e=xx();return e==null?Ax():Bx(e)}function Cx(){return Tx()}function wx(){let e=W();if(e===`openai`)return process.env.OPENAI_MODEL;if(e===`gemini`)return process.env.GEMINI_MODEL;if(e===`grok`)return process.env.GROK_MODEL}function Tx(){let e=W();return e===`openai`&&px()?hx:e===`openai`&&process.env.OPENAI_DEFAULT_OPUS_MODEL?process.env.OPENAI_DEFAULT_OPUS_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_OPUS_MODEL?process.env.GEMINI_DEFAULT_OPUS_MODEL:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL?process.env.ANTHROPIC_DEFAULT_OPUS_MODEL:wx()||G().opus47}function Ex(){let e=W();return e===`openai`&&px()?hx:e===`openai`&&process.env.OPENAI_DEFAULT_SONNET_MODEL?process.env.OPENAI_DEFAULT_SONNET_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_SONNET_MODEL?process.env.GEMINI_DEFAULT_SONNET_MODEL:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL?process.env.ANTHROPIC_DEFAULT_SONNET_MODEL:wx()||(e===`firstParty`?G().sonnet46:G().sonnet45)}function Dx(){let e=W();return e===`openai`&&px()?gx:e===`openai`&&process.env.OPENAI_DEFAULT_HAIKU_MODEL?process.env.OPENAI_DEFAULT_HAIKU_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_HAIKU_MODEL?process.env.GEMINI_DEFAULT_HAIKU_MODEL:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL?process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL:wx()||G().haiku45}function Ox(e){let{permissionMode:t,mainLoopModel:n,exceeds200kTokens:r=!1}=e;return xx()===`opusplan`&&t===`plan`&&!r?Tx():xx()===`haiku`&&t===`plan`?Ex():n}function kx(){return process.env.USER_TYPE===`ant`?tb()?.defaultModel??Tx()+`[1m]`:gw()||vw()?Tx()+(Fx()?`[1m]`:``):Ex()}function Ax(){return Bx(kx())}function J(e){if(e=e.toLowerCase(),e.includes(`claude-opus-4-7`))return`claude-opus-4-7`;if(e.includes(`claude-opus-4-6`))return`claude-opus-4-6`;if(e.includes(`claude-opus-4-5`))return`claude-opus-4-5`;if(e.includes(`claude-opus-4-1`))return`claude-opus-4-1`;if(e.includes(`claude-opus-4`))return`claude-opus-4`;if(e.includes(`claude-sonnet-4-6`))return`claude-sonnet-4-6`;if(e.includes(`claude-sonnet-4-5`))return`claude-sonnet-4-5`;if(e.includes(`claude-sonnet-4`))return`claude-sonnet-4`;if(e.includes(`claude-haiku-4-5`))return`claude-haiku-4-5`;if(e.includes(`claude-3-7-sonnet`))return`claude-3-7-sonnet`;if(e.includes(`claude-3-5-sonnet`))return`claude-3-5-sonnet`;if(e.includes(`claude-3-5-haiku`))return`claude-3-5-haiku`;if(e.includes(`claude-3-opus`))return`claude-3-opus`;if(e.includes(`claude-3-sonnet`))return`claude-3-sonnet`;if(e.includes(`claude-3-haiku`))return`claude-3-haiku`;let t=e.match(/(claude-(\d+-\d+-)?\w+)/);return t&&t[1]?t[1]:e}function jx(e){return J(yv(e))}function Mx(e=!1){return gw()||vw()?Fx()?`Opus 4.7 with 1M context · Most capable for complex work${e?Px(!0):``}`:`Opus 4.7 · Most capable for complex work${e?Px(!0):``}`:`Sonnet 4.6 · Best for everyday tasks`}function Nx(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:zx(Bx(e))}function Px(e){if(W()!==`firstParty`)return``;let t=Kb(zb(e));return` ·${e?` (↯)`:``} ${t}`}function Fx(){return!(fS()||bw()||W()!==`firstParty`||!mv()||Y()&&X()===null)}function Ix(e){return e===`opusplan`?`Opus Plan`:nx(e)?Ni(e):zx(e)}function Lx(e){switch(e){case G().opus47:return`Opus 4.7`;case G().opus47+`[1m]`:return`Opus 4.7 (1M context)`;case G().opus46:return`Opus 4.6`;case G().opus46+`[1m]`:return`Opus 4.6 (1M context)`;case G().opus45:return`Opus 4.5`;case G().opus41:return`Opus 4.1`;case G().opus40:return`Opus 4`;case G().sonnet46+`[1m]`:return`Sonnet 4.6 (1M context)`;case G().sonnet46:return`Sonnet 4.6`;case G().sonnet45+`[1m]`:return`Sonnet 4.5 (1M context)`;case G().sonnet45:return`Sonnet 4.5`;case G().sonnet40:return`Sonnet 4`;case G().sonnet40+`[1m]`:return`Sonnet 4 (1M context)`;case G().sonnet37:return`Sonnet 3.7`;case G().sonnet35:return`Sonnet 3.5`;case G().haiku45:return`Haiku 4.5`;case G().haiku35:return`Haiku 3.5`;default:return null}}function Rx(e){let[t=``,...n]=e.split(`-`);return[t.slice(0,3)+`*`.repeat(Math.max(0,t.length-3)),...n].join(`-`)}function zx(e){let t=Lx(e);if(t)return t;if(process.env.USER_TYPE===`ant`){let t=Bx(e),n=rb(e);return n?Rx(n.model.replace(/\[1m\]$/i,``))+(pS(t)?`[1m]`:``):t===e?t:`${e} (${t})`}return e}function Bx(e){let t=e.trim(),n=t.toLowerCase(),r=pS(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(nx(i))switch(i){case`opusplan`:return Ex()+(r?`[1m]`:``);case`sonnet`:return Ex()+(r?`[1m]`:``);case`haiku`:return Dx()+(r?`[1m]`:``);case`opus`:return Tx()+(r?`[1m]`:``);case`best`:return Cx();default:}if(W()===`firstParty`&&Hx(i)&&Ux())return Tx()+(r?`[1m]`:``);if(process.env.USER_TYPE===`ant`){let e=pS(n),t=rb(n.replace(/\[1m]$/i,``).trim());if(t){let n=e?`[1m]`:``;return t.model+n}}return r?t.replace(/\[1m\]$/i,``).trim()+`[1m]`:t}function Vx(e,t){return pS(e)||!pS(t)?e:mS(Bx(e))?e+`[1m]`:e}function Hx(e){return qx.includes(e)}function Ux(){return!g(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function Wx(e){if(e===null)return process.env.USER_TYPE===`ant`?`Default for Ants (${Nx(kx())})`:Y()?`Default (${Mx()})`:`Default (${Ax()})`;let t=Bx(e);return e===t?t:`${e} (${t})`}function Gx(e){if(W()===`foundry`)return;let t=e.toLowerCase().includes(`[1m]`),n=jx(e);if(n.includes(`claude-opus-4-7`))return t?`Opus 4.7 (with 1M context)`:`Opus 4.7`;if(n.includes(`claude-opus-4-6`))return t?`Opus 4.6 (with 1M context)`:`Opus 4.6`;if(n.includes(`claude-opus-4-5`))return`Opus 4.5`;if(n.includes(`claude-opus-4-1`))return`Opus 4.1`;if(n.includes(`claude-opus-4`))return`Opus 4`;if(n.includes(`claude-sonnet-4-6`))return t?`Sonnet 4.6 (with 1M context)`:`Sonnet 4.6`;if(n.includes(`claude-sonnet-4-5`))return t?`Sonnet 4.5 (with 1M context)`:`Sonnet 4.5`;if(n.includes(`claude-sonnet-4`))return t?`Sonnet 4 (with 1M context)`:`Sonnet 4`;if(n.includes(`claude-3-7-sonnet`))return`Claude 3.7 Sonnet`;if(n.includes(`claude-3-5-sonnet`))return`Claude 3.5 Sonnet`;if(n.includes(`claude-haiku-4-5`))return`Haiku 4.5`;if(n.includes(`claude-3-5-haiku`))return`Claude 3.5 Haiku`}function Kx(e){return e.replace(/\[(1|2)m\]/gi,``)}var qx,Jx=t((()=>{O(),ib(),Q(),ES(),h(),wv(),tx(),B_(),hv(),Kp(),fx(),ox(),Pi(),vx(),qx=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));function Yx(){return{error:(e,...t)=>console.error(`[Anthropic SDK ERROR]`,e,...t),warn:(e,...t)=>console.error(`[Anthropic SDK WARN]`,e,...t),info:(e,...t)=>console.error(`[Anthropic SDK INFO]`,e,...t),debug:(e,...t)=>console.error(`[Anthropic SDK DEBUG]`,e,...t)}}async function Xx({apiKey:e,maxRetries:t,model:r,fetchOverride:i,source:a}){let o=process.env.CLAUDE_CODE_CONTAINER_ID,s=process.env.CLAUDE_CODE_REMOTE_SESSION_ID,c=process.env.CLAUDE_AGENT_SDK_CLIENT_APP,l=Qx(),u={"x-app":`cli`,"User-Agent":rT(),"X-Claude-Code-Session-Id":at(),...l,...o?{"x-claude-remote-container-id":o}:{},...s?{"x-claude-remote-session-id":s}:{},...c?{"x-client-app":c}:{},...process.env.ANTHROPIC_AUTH_NONCE?{"x-auth-nonce":process.env.ANTHROPIC_AUTH_NONCE}:{}};M(`[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: ${!!process.env.ANTHROPIC_CUSTOM_HEADERS}, has Authorization header: ${!!l.Authorization}`),g(process.env.CLAUDE_CODE_ADDITIONAL_PROTECTION)&&(u[`x-anthropic-additional-protection`]=`true`),M(`[API:auth] OAuth token check starting`),await lw(),M(`[API:auth] OAuth token check complete`),Y()||await Zx(u,Mt());let d=$x(i,a),f={defaultHeaders:u,maxRetries:t,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:Ii({forAnthropicAPI:!0}),...d&&{fetch:d}};if(g(process.env.CLAUDE_CODE_USE_BEDROCK)){let{BedrockClient:e}=await import(`./bedrockClient-BfPpXPI0.js`),t=r===yx()&&process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION?process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:oe(),n={...f,awsRegion:t,...g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&{skipAuth:!0},...Kn()&&{logger:Yx()}};if(process.env.AWS_BEARER_TOKEN_BEDROCK)n.skipAuth=!0,n.defaultHeaders={...n.defaultHeaders,Authorization:`Bearer ${process.env.AWS_BEARER_TOKEN_BEDROCK}`};else if(!g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)){let e=await Lw();e&&(n.awsAccessKey=e.accessKeyId,n.awsSecretKey=e.secretAccessKey,n.awsSessionToken=e.sessionToken)}return new e(n)}if(g(process.env.CLAUDE_CODE_USE_FOUNDRY)){let{AnthropicFoundry:e}=await import(`./foundry-sdk-BFN5VDFQ.js`),t;if(!process.env.ANTHROPIC_FOUNDRY_API_KEY)if(g(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH))t=()=>Promise.resolve(``);else{let{DefaultAzureCredential:e,getBearerTokenProvider:n}=await import(`./esm-CsGLyWmS.js`);t=n(new e,`https://cognitiveservices.azure.com/.default`)}return new e({...f,...t&&{azureADTokenProvider:t},...Kn()&&{logger:Yx()}})}if(g(process.env.CLAUDE_CODE_USE_VERTEX)){g(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)||await Vw();let[{AnthropicVertex:e},{GoogleAuth:t}]=await Promise.all([import(`./vertex-sdk-CSGw3fvU.js`),import(`./src-hdbPEvzO.js`).then(e=>n(e.default,1))]),i=process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project,a=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials,o=g(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)?{getClient:()=>({getRequestHeaders:()=>({})})}:new t({scopes:[`https://www.googleapis.com/auth/cloud-platform`],...i||a?{}:{projectId:process.env.ANTHROPIC_VERTEX_PROJECT_ID}});return new e({...f,region:te(r),googleAuth:o,...Kn()&&{logger:Yx()}})}return new se({apiKey:Y()?null:e||CC(),authToken:Y()?Z()?.accessToken:void 0,...process.env.USER_TYPE===`ant`&&g(process.env.USE_STAGING_OAUTH)?{baseURL:P().BASE_API_URL}:{},...f,...Kn()&&{logger:Yx()}})}async function Zx(e,t){let n=process.env.ANTHROPIC_AUTH_TOKEN||await PC(t);n&&(e.Authorization=`Bearer ${n}`)}function Qx(){let e={},t=process.env.ANTHROPIC_CUSTOM_HEADERS;if(!t)return e;let n=t.split(/\n|\r\n/);for(let t of n){if(!t.trim())continue;let n=t.indexOf(`:`);if(n===-1)continue;let r=t.slice(0,n).trim(),i=t.slice(n+1).trim();r&&(e[r]=i)}return e}function $x(e,t){let n=e??globalThis.fetch,r=W()===`firstParty`&&mv();return(e,i)=>{let a=new Headers(i?.headers);r&&!a.has(`x-client-request-id`)&&a.set(eS,ua());try{let n=e instanceof Request?e.url:String(e),r=a.get(eS);M(`[API REQUEST] ${new URL(n).pathname}${r?` ${eS}=${r}`:``} source=${t??`unknown`}`)}catch{}return n(e,{...i,headers:a})}}var eS,tS=t((()=>{vr(),Q(),cT(),Jx(),hv(),Li(),O(),kr(),j(),h(),eS=`x-client-request-id`}));function nS(){return R(ae(),`cache`)}function rS(){return R(nS(),`model-capabilities.json`)}function iS(){return!(W()!==`firstParty`||!mv())}function aS(e){return[...e].sort((e,t)=>t.id.length-e.id.length||e.id.localeCompare(t.id))}function oS(e){if(!iS())return;let t=uS(rS());if(!t||t.length===0)return;let n=e.toLowerCase();return t.find(e=>e.id.toLowerCase()===n)||t.find(e=>n.includes(e.id.toLowerCase()))}async function sS(){if(iS()&&!Br())try{let e=await Xx({maxRetries:1}),t=Y()?[Dr]:void 0,n=[];for await(let r of e.models.list({betas:t})){let e=cS().safeParse(r);e.success&&n.push(e.data)}if(n.length===0)return;let r=rS(),i=aS(n);if(Mu(uS(r),i)){M(`[modelCapabilities] cache unchanged, skipping write`);return}await fa(nS(),{recursive:!0}),await va(r,k({models:i,timestamp:Date.now()}),{encoding:`utf-8`,mode:384}),uS.cache.delete(r),M(`[modelCapabilities] cached ${i.length} models`)}catch(e){M(`[modelCapabilities] fetch failed: ${e instanceof Error?e.message:`unknown`}`)}}var cS,lS,uS,dS=t((()=>{Nu(),m(),Je(),kr(),tS(),Q(),j(),h(),di(),Ei(),zr(),An(),hv(),cS=L(()=>D({id:b(),max_input_tokens:y().optional(),max_tokens:y().optional()}).strip()),lS=L(()=>D({models:S(cS()),timestamp:y()})),uS=p(e=>{try{let t=ia(e,`utf-8`),n=lS().safeParse(fi(t,!1));return n.success?n.data.models:null}catch{return null}},e=>e)}));function fS(){return g(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function pS(e){return fS()?!1:/\[1m\]/i.test(e)}function mS(e){if(fS())return!1;let t=jx(e);return t.includes(`claude-sonnet-4`)||t.includes(`opus-4-6`)||t.includes(`opus-4-7`)}function hS(e,t){if(process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS){let e=parseInt(process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS,10);if(!isNaN(e)&&e>0)return e}if(pS(e))return 1e6;let n=oS(e);if(n?.max_input_tokens&&n.max_input_tokens>=1e5)return n.max_input_tokens>2e5&&fS()?bS:n.max_input_tokens;if(t?.includes(`context-1m-2025-08-07`)&&mS(e)||gS(e))return 1e6;if(process.env.USER_TYPE===`ant`){let t=rb(e);if(t?.contextWindow)return t.contextWindow}return bS}function gS(e){return fS()||pS(e)||!jx(e).includes(`sonnet-4-6`)?!1:H().clientDataCache?.coral_reef_sonnet===`true`}function _S(e,t){if(!e)return{used:null,remaining:null};let n=e.input_tokens+e.cache_creation_input_tokens+e.cache_read_input_tokens;if(n===0)return{used:null,remaining:null};let r=Math.round(n/t*100),i=Math.min(100,Math.max(0,r));return{used:i,remaining:100-i}}function vS(e){let t,n;if(process.env.USER_TYPE===`ant`){let r=rb(e.toLowerCase());if(r)return t=r.defaultMaxTokens??SS,n=r.upperMaxTokensLimit??CS,{default:t,upperLimit:n}}let r=jx(e);r.includes(`opus-4-7`)||r.includes(`opus-4-6`)?(t=64e3,n=128e3):r.includes(`sonnet-4-6`)?(t=32e3,n=128e3):r.includes(`opus-4-5`)||r.includes(`sonnet-4`)||r.includes(`haiku-4`)?(t=32e3,n=64e3):r.includes(`opus-4-1`)||r.includes(`opus-4`)?(t=32e3,n=32e3):r.includes(`claude-3-opus`)?(t=4096,n=4096):r.includes(`claude-3-sonnet`)?(t=8192,n=8192):r.includes(`claude-3-haiku`)?(t=4096,n=4096):r.includes(`3-5-sonnet`)||r.includes(`3-5-haiku`)?(t=8192,n=8192):r.includes(`3-7-sonnet`)?(t=32e3,n=64e3):(t=SS,n=CS);let i=oS(e);return i?.max_tokens&&i.max_tokens>=4096&&(n=i.max_tokens,t=Math.min(t,n)),{default:t,upperLimit:n}}function yS(e){return vS(e).upperLimit-1}var bS,xS,SS,CS,wS,TS,ES=t((()=>{eb(),op(),h(),Jx(),ib(),dS(),bS=2e5,xS=2e4,SS=32e3,CS=64e3,wS=8e3,TS=64e3})),DS,OS,kS,AS=t((()=>{m(),hv(),DS=[{modelEnvVar:`ANTHROPIC_DEFAULT_OPUS_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`ANTHROPIC_DEFAULT_SONNET_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`ANTHROPIC_DEFAULT_HAIKU_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`}],OS=[{modelEnvVar:`OPENAI_DEFAULT_OPUS_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`OPENAI_DEFAULT_SONNET_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`OPENAI_DEFAULT_HAIKU_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`}],kS=p((e,t)=>{if(W()===`firstParty`)return;let n=e.toLowerCase(),r=W()===`openai`?OS:DS;for(let e of r){let r=process.env[e.modelEnvVar],i=process.env[e.capabilitiesEnvVar];if(!(!r||i===void 0)&&n===r.toLowerCase())return i.toLowerCase().split(`,`).map(e=>e.trim()).includes(t)}},(e,t)=>`${e.toLowerCase()}:${t}`)}));function jS(e){let t=[],n=[];for(let r of e)HS.includes(r)?t.push(r):n.push(r);return{allowed:t,disallowed:n}}function MS(e){if(!e||e.length===0)return;if(Y()){console.warn(`Warning: Custom betas are only available for API key users. Ignoring provided betas.`);return}let{allowed:t,disallowed:n}=jS(e);for(let e of n)console.warn(`Warning: Beta header '${e}' is not allowed. Only the following betas are supported: ${HS.join(`, `)}`);return t.length>0?t:void 0}function NS(e){let t=kS(e,`interleaved_thinking`);if(t!==void 0)return t;let n=jx(e),r=W();return r===`foundry`?!0:r===`firstParty`?!n.includes(`claude-3-`):n.includes(`claude-opus-4`)||n.includes(`claude-sonnet-4`)}function PS(e){let t=jx(e);return t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function FS(e){let t=jx(e),n=W();return n===`foundry`?!0:n===`firstParty`?!t.includes(`claude-3-`):t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function IS(e){let t=jx(e),n=W();return n!==`firstParty`&&n!==`foundry`?!1:t.includes(`claude-sonnet-4-6`)||t.includes(`claude-sonnet-4-5`)||t.includes(`claude-opus-4-1`)||t.includes(`claude-opus-4-5`)||t.includes(`claude-opus-4-6`)||t.includes(`claude-opus-4-7`)||t.includes(`claude-haiku-4-5`)}function LS(e){return!0}function RS(){return(W()===`firstParty`||W()===`foundry`)&&!g(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)&&mv()}function zS(){return W()===`firstParty`&&!g(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function BS(e,t){let n=[...WS(e)];t?.isAgenticQuery&&(n.includes(`claude-code-20250219`)||n.push(Iy),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&Xy&&!n.includes(Xy)&&n.push(Xy));let r=Cn();return!r||r.length===0?n:[...n,...r.filter(e=>!n.includes(e))]}function VS(){US.cache?.clear?.(),WS.cache?.clear?.(),GS.cache?.clear?.()}var HS,US,WS,GS,KS=t((()=>{m(),XO(),O(),eb(),kr(),Q(),ES(),h(),Jx(),AS(),hv(),B_(),HS=[Ry],US=p(e=>{let t=[],n=jx(e).includes(`haiku`),r=W(),i=RS();n||(t.push(Iy),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&Xy&&t.push(Xy)),Y()&&t.push(Dr),pS(e)&&t.push(Ry),!g(process.env.DISABLE_INTERLEAVED_THINKING)&&NS(e)&&t.push(Ly),i&&NS(e)&&!Mt()&&A_().showThinkingSummaries!==!0&&t.push(qy);let a=g(process.env.USE_API_CONTEXT_MANAGEMENT)||FS(e),o=FS(e);RS()&&(a||o)&&t.push(zy);let s=SO(`tengu_tool_pear`),c=!s&&bO(`tengu_amber_json_tools`,!1);return i&&IS(e)&&s&&t.push(By),process.env.USER_TYPE===`ant`&&i&&c&&t.push(Jy),r===`vertex`&&PS(e)&&t.push(Vy),r===`foundry`&&t.push(Vy),i&&t.push(Gy),process.env.ANTHROPIC_BETAS&&t.push(...process.env.ANTHROPIC_BETAS.split(`,`).map(e=>e.trim()).filter(Boolean)),t}),WS=p(e=>{let t=US(e);return W()===`bedrock`?t.filter(e=>!Qy.has(e)):t}),GS=p(e=>US(e).filter(e=>Qy.has(e)))}));function qS(e,t){return{name:`${e.name}-with-${t.name}-fallback`,read(){return e.read()??(t.read()||{})},async readAsync(){return await e.readAsync()??(await t.readAsync()||{})},update(n){let r=e.read(),i=e.update(n);if(i.success)return r===null&&t.delete(),i;let a=t.update(n);return a.success?(r!==null&&e.delete(),{success:!0,warning:a.warning}):{success:!1}},delete(){let n=e.delete(),r=t.delete();return n||r}}}var JS=t((()=>{}));async function YS(){try{let e=by(wy),{stdout:t,code:n}=await ai(`security`,[`find-generic-password`,`-a`,xy(),`-w`,`-s`,e],{useCwd:!1,preserveOutputOnError:!1});if(n===0&&t)return kn(t.trim())}catch{}return null}function XS(){if($S!==void 0)return $S;if(process.platform!==`darwin`)return $S=!1,!1;try{$S=Mr(`security`,[`show-keychain-info`],{reject:!1,stdio:[`ignore`,`pipe`,`pipe`]}).exitCode===36}catch{$S=!1}return $S}var ZS,QS,$S,eC=t((()=>{Nr(),j(),ii(),ti(),An(),Ty(),ZS=4032,QS={name:`keychain`,read(){let e=K.cache;if(Date.now()-e.cachedAt<3e4)return e.data;try{let e=by(wy),t=ni(`security find-generic-password -a "${xy()}" -w -s "${e}"`);if(t){let e=kn(t);return K.cache={data:e,cachedAt:Date.now()},e}}catch{}return e.data===null?(K.cache={data:null,cachedAt:Date.now()},null):(M(`[keychain] read failed; serving stale cache`,{level:`warn`}),K.cache={data:e.data,cachedAt:Date.now()},e.data)},async readAsync(){let e=K.cache;if(Date.now()-e.cachedAt<3e4)return e.data;if(K.readInFlight)return K.readInFlight;let t=K.generation,n=YS().then(n=>{if(t===K.generation){n===null&&e.data!==null&&M(`[keychain] readAsync failed; serving stale cache`,{level:`warn`});let t=n??e.data;return K.cache={data:t,cachedAt:Date.now()},K.readInFlight=null,t}return n});return K.readInFlight=n,n},update(e){Sy();try{let t=by(wy),n=xy(),r=k(e),i=Buffer.from(r,`utf-8`).toString(`hex`),a=`add-generic-password -U -a "${n}" -s "${t}" -X "${i}"\n`,o;return a.length<=ZS?o=Mr(`security`,[`-i`],{input:a,stdio:[`pipe`,`pipe`,`pipe`],reject:!1}):(M(`Keychain payload (${r.length}B JSON) exceeds security -i stdin limit; using argv`,{level:`warn`}),o=Mr(`security`,[`add-generic-password`,`-U`,`-a`,n,`-s`,t,`-X`,i],{stdio:[`ignore`,`pipe`,`pipe`],reject:!1})),o.exitCode===0?(K.cache={data:e,cachedAt:Date.now()},{success:!0}):{success:!1}}catch{return{success:!1}}},delete(){Sy();try{let e=by(wy);return ni(`security delete-generic-password -a "${xy()}" -s "${e}"`),!0}catch{return!1}}}}));function tC(){let e=ae();return{storageDir:e,storagePath:R(e,`.credentials.json`)}}var nC,rC=t((()=>{h(),zn(),Vn(),An(),nC={name:`plaintext`,read(){let{storagePath:e}=tC();try{return kn(A().readFileSync(e,{encoding:`utf8`}))}catch{return null}},async readAsync(){let{storagePath:e}=tC();try{return kn(await A().readFile(e,{encoding:`utf8`}))}catch{return null}},update(e){try{let{storageDir:t,storagePath:n}=tC();try{A().mkdirSync(t)}catch(e){if(Dn(e)!==`EEXIST`)throw e}return En(n,k(e),{encoding:`utf8`,flush:!1}),ta(n,384),{success:!0,warning:`Warning: Storing credentials in plaintext.`}}catch{return{success:!1}}},delete(){let{storagePath:e}=tC();try{return A().unlinkSync(e),!0}catch(e){return Dn(e)===`ENOENT`}}}}));function iC(){return process.platform===`darwin`?qS(QS,nC):nC}var aC=t((()=>{JS(),eC(),rC()}));function oC(e){return new Promise(t=>{ba(`security`,[`find-generic-password`,`-a`,xy(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:dC},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function sC(){if(process.platform!==`darwin`||pC||ne())return;let e=oC(by(wy)),t=oC(by());pC=Promise.all([e,t]).then(([e,t])=>{e.timedOut||Cy(e.stdout),t.timedOut||(fC={stdout:t.stdout})})}async function cC(){pC&&await pC}function lC(){return fC}function uC(){fC=null}var dC,fC,pC,mC=t((()=>{h(),Ty(),dC=1e4,fC=null,pC=null}));function hC(){return _C}function gC(){_C.clear()}var _C,vC=t((()=>{_C=new Map})),yC=r({calculateApiKeyHelperTTL:()=>MC,checkAndRefreshOAuthTokenIfNeeded:()=>lw,checkGcpCredentialsValid:()=>KC,clearApiKeyHelperCache:()=>RC,clearAwsCredentialsCache:()=>UC,clearGcpCredentialsCache:()=>YC,clearOAuthTokenCache:()=>iw,getAccountInformation:()=>kw,getAnthropicApiKey:()=>CC,getAnthropicApiKeyWithSource:()=>TC,getApiKeyFromApiKeyHelper:()=>PC,getApiKeyFromApiKeyHelperCached:()=>LC,getApiKeyFromConfigOrMacOSKeychain:()=>Hw,getApiKeyHelperElapsedMs:()=>NC,getAuthTokenSource:()=>SC,getClaudeAIOAuthTokens:()=>Z,getClaudeAIOAuthTokensAsync:()=>cw,getConfiguredApiKeyHelper:()=>EC,getOauthAccountInfo:()=>pw,getOtelHeadersFromHelper:()=>Ew,getRateLimitTier:()=>xw,getSubscriptionName:()=>Sw,getSubscriptionType:()=>X,handleOAuth401Error:()=>ow,hasAnthropicApiKeyAuth:()=>wC,hasOpusAccess:()=>hw,hasProfileScope:()=>dw,is1PApiCustomer:()=>fw,isAnthropicAuthEnabled:()=>xC,isAwsAuthRefreshFromProjectSettings:()=>kC,isAwsCredentialExportFromProjectSettings:()=>jC,isClaudeAISubscriber:()=>Y,isConsumerSubscriber:()=>Ow,isCustomApiKeyApproved:()=>ew,isEnterpriseSubscriber:()=>yw,isGcpAuthRefreshFromProjectSettings:()=>GC,isMaxSubscriber:()=>gw,isOtelHeadersHelperFromProjectOrLocalSettings:()=>Tw,isOverageProvisioningAllowed:()=>mw,isProSubscriber:()=>bw,isTeamPremiumSubscriber:()=>vw,isTeamSubscriber:()=>_w,isUsing3PServices:()=>Cw,prefetchApiKeyFromApiKeyHelperIfSafe:()=>zC,prefetchAwsCredentialsAndBedRockInfoIfSafe:()=>ZC,prefetchGcpCredentialsIfSafe:()=>XC,refreshAndGetAwsCredentials:()=>Lw,refreshAwsAuth:()=>VC,refreshGcpAuth:()=>JC,refreshGcpCredentialsIfNeeded:()=>Vw,removeApiKey:()=>tw,saveApiKey:()=>$C,saveOAuthTokensIfNeeded:()=>rw,validateForceLoginOrg:()=>Aw});function bC(){return g(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`}function xC(){if(ne())return!1;if(process.env.ANTHROPIC_UNIX_SOCKET)return!!process.env.CLAUDE_CODE_OAUTH_TOKEN;let e=z_()||{},t=g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||e.modelType===`openai`||e.modelType===`gemini`||!!process.env.OPENAI_BASE_URL||!!process.env.GEMINI_BASE_URL,n=e.apiKeyHelper,r=process.env.ANTHROPIC_AUTH_TOKEN||n||process.env.CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR,{source:i}=TC({skipRetrievingKeyFromApiKeyHelper:!0}),a=i===`ANTHROPIC_API_KEY`||i===`apiKeyHelper`;return!(t||r&&!bC()||a&&!bC())}function SC(){if(ne())return EC()?{source:`apiKeyHelper`,hasToken:!0}:{source:`none`,hasToken:!1};if(process.env.ANTHROPIC_AUTH_TOKEN&&!bC())return{source:`ANTHROPIC_AUTH_TOKEN`,hasToken:!0};if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{source:`CLAUDE_CODE_OAUTH_TOKEN`,hasToken:!0};if(py())return process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR?{source:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,hasToken:!0}:{source:`CCR_OAUTH_TOKEN_FILE`,hasToken:!0};if(EC()&&!bC())return{source:`apiKeyHelper`,hasToken:!0};let e=Z();return Zv(e?.scopes)&&e?.accessToken?{source:`claude.ai`,hasToken:!0}:{source:`none`,hasToken:!1}}function CC(){let{key:e}=TC();return e}function wC(){let{key:e,source:t}=TC({skipRetrievingKeyFromApiKeyHelper:!0});return e!==null&&t!==`none`}function TC(e={}){if(ne())return process.env.ANTHROPIC_API_KEY?{key:process.env.ANTHROPIC_API_KEY,source:`ANTHROPIC_API_KEY`}:EC()?{key:e.skipRetrievingKeyFromApiKeyHelper?null:LC(),source:`apiKeyHelper`}:{key:null,source:`none`};let t=re()?void 0:process.env.ANTHROPIC_API_KEY;if(rn()&&t)return{key:t,source:`ANTHROPIC_API_KEY`};if(g(process.env.CI)){let e=my();if(e)return{key:e,source:`ANTHROPIC_API_KEY`};if(!t&&!process.env.CLAUDE_CODE_OAUTH_TOKEN&&!process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR)throw Error(`ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN env var is required`);return t?{key:t,source:`ANTHROPIC_API_KEY`}:{key:null,source:`none`}}if(t&&H().customApiKeyResponses?.approved?.includes(Dy(t)))return{key:t,source:`ANTHROPIC_API_KEY`};let n=my();return n?{key:n,source:`ANTHROPIC_API_KEY`}:EC()?e.skipRetrievingKeyFromApiKeyHelper?{key:null,source:`apiKeyHelper`}:{key:LC(),source:`apiKeyHelper`}:Hw()||{key:null,source:`none`}}function EC(){return ne()?U(`flagSettings`)?.apiKeyHelper:(z_()||{}).apiKeyHelper}function DC(){let e=EC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.apiKeyHelper===e||n?.apiKeyHelper===e}function OC(){return(z_()||{}).awsAuthRefresh}function kC(){let e=OC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.awsAuthRefresh===e||n?.awsAuthRefresh===e}function AC(){return(z_()||{}).awsCredentialExport}function jC(){let e=AC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.awsCredentialExport===e||n?.awsCredentialExport===e}function MC(){let e=process.env.CLAUDE_CODE_API_KEY_HELPER_TTL_MS;if(e){let t=parseInt(e,10);if(!Number.isNaN(t)&&t>=0)return t;M(`Found CLAUDE_CODE_API_KEY_HELPER_TTL_MS env var, but it was not a valid number. Got ${e}`,{level:`error`})}return jw}function NC(){let e=Nw?.startedAt;return e?Date.now()-e:0}async function PC(e){if(!EC())return null;let t=MC();return Mw?(Date.now()-Mw.timestamp<t||Nw||(Nw={promise:FC(e,!1,Pw),startedAt:null}),Mw.value):(Nw||(Nw={promise:FC(e,!0,Pw),startedAt:Date.now()}),Nw.promise)}async function FC(e,t,n){try{let t=await IC(e);return n===Pw&&t!==null&&(Mw={value:t,timestamp:Date.now()}),t}catch(e){if(n!==Pw)return` `;let r=e instanceof Error?e.message:String(e);return console.error(Xe.red(`apiKeyHelper failed: ${r}`)),M(`Error getting API key from apiKeyHelper: ${r}`,{level:`error`}),!t&&Mw&&Mw.value!==` `?(Mw={...Mw,timestamp:Date.now()},Mw.value):(Mw={value:` `,timestamp:Date.now()},` `)}finally{n===Pw&&(Nw=null)}}async function IC(e){let t=EC();if(!t)return null;if(DC()&&!yf()&&!e)return Jn(`apiKeyHelper invoked before trust check`,Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_apiKeyHelper_missing_trust11`,{}),null;let n=await Pr(t,{shell:!0,timeout:600*1e3,reject:!1});if(n.failed){let e=n.timedOut?`timed out`:`exited ${n.exitCode}`,t=n.stderr?.trim();throw Error(t?`${e}: ${t}`:e)}let r=n.stdout?.trim();if(!r)throw Error(`did not return a value`);return r}function LC(){return Mw?.value??null}function RC(){Pw++,Mw=null,Nw=null}function zC(e){DC()&&!yf()||PC(e)}async function BC(){let e=OC();if(!e)return!1;if(kC()&&!yf()&&!Mt())return Jn(`awsAuthRefresh invoked before trust check`,Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_awsAuthRefresh_missing_trust`,{}),!1;try{return M(`Fetching AWS caller identity for AWS auth refresh command`),await jy(),M(`Fetched AWS caller identity, skipping AWS auth refresh command`),!1}catch{return VC(e)}}function VC(e){M(`Running AWS auth refresh command`);let t=Py.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ya(e,{timeout:Iw});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),M(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),M(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)M(`AWS auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?Xe.red(`AWS auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):Xe.red(`Error running awsAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}async function HC(){let e=AC();if(!e)return null;if(jC()&&!yf()&&!Mt())return Jn(`awsCredentialExport invoked before trust check`,Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_awsCredentialExport_missing_trust`,{}),null;try{return M(`Fetching AWS caller identity for credential export command`),await jy(),M(`Fetched AWS caller identity, skipping AWS credential export command`),null}catch{try{M(`Running AWS credential export command`);let t=await Pr(e,{shell:!0,reject:!1});if(t.exitCode!==0||!t.stdout)throw Error(`awsCredentialExport did not return a valid value`);let n=kn(t.stdout.trim());if(!Ay(n))throw Error(`awsCredentialExport did not return valid AWS STS output structure`);return M(`AWS credentials retrieved from awsCredentialExport`),{accessKeyId:n.Credentials.AccessKeyId,secretAccessKey:n.Credentials.SecretAccessKey,sessionToken:n.Credentials.SessionToken}}catch(e){let t=Xe.red(`Error getting AWS credentials from awsCredentialExport (in settings or ~/.claude.json):`);return e instanceof Error?console.error(t,e.message):console.error(t,e),null}}}function UC(){Lw.cache.clear()}function WC(){return(z_()||{}).gcpAuthRefresh}function GC(){let e=WC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.gcpAuthRefresh===e||n?.gcpAuthRefresh===e}async function KC(){try{let{GoogleAuth:e}=await import(`./src-hdbPEvzO.js`).then(e=>n(e.default,1)),t=new e({scopes:[`https://www.googleapis.com/auth/cloud-platform`]}),r=(async()=>{await(await t.getClient()).getAccessToken()})(),i=Ri(Rw).then(()=>{throw new Yw(`GCP credentials check timed out`)});return await Promise.race([r,i]),!0}catch{return!1}}async function qC(){let e=WC();if(!e)return!1;if(GC()&&!yf()&&!Mt())return Jn(`gcpAuthRefresh invoked before trust check`,Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_gcpAuthRefresh_missing_trust`,{}),!1;try{if(M(`Checking GCP credentials validity for auth refresh`),await KC())return M(`GCP credentials are valid, skipping auth refresh command`),!1}catch{}return JC(e)}function JC(e){M(`Running GCP auth refresh command`);let t=Py.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ya(e,{timeout:Bw});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),M(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),M(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)M(`GCP auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?Xe.red(`GCP auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):Xe.red(`Error running gcpAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}function YC(){Vw.cache.clear()}function XC(){WC()&&(GC()&&!yf()&&!Mt()||Vw())}function ZC(){let e=OC(),t=AC();!e&&!t||(kC()||jC())&&!yf()&&!Mt()||(Lw(),G())}function QC(e){return/^[a-zA-Z0-9-_]+$/.test(e)}async function $C(e){if(!QC(e))throw Error(`Invalid API key format. API key must contain only alphanumeric characters, dashes, and underscores.`);await nw();let t=!1;if(process.platform===`darwin`)try{let n=by();await Pr(`security`,[`-i`],{input:`add-generic-password -U -a "${xy()}" -s "${n}" -X "${Buffer.from(e,`utf-8`).toString(`hex`)}"\n`,reject:!1}),N(`tengu_api_key_saved_to_keychain`,{}),t=!0}catch(e){I(e),N(`tengu_api_key_keychain_error`,{error:pr(e)}),N(`tengu_api_key_saved_to_config`,{})}else N(`tengu_api_key_saved_to_config`,{});let n=Dy(e);V(r=>{let i=r.customApiKeyResponses?.approved??[];return{...r,primaryApiKey:t?r.primaryApiKey:e,customApiKeyResponses:{...r.customApiKeyResponses,approved:i.includes(n)?i:[...i,n],rejected:r.customApiKeyResponses?.rejected??[]}}}),Hw.cache.clear?.(),uC()}function ew(e){let t=H(),n=Dy(e);return t.customApiKeyResponses?.approved?.includes(n)??!1}async function tw(){await nw(),V(e=>({...e,primaryApiKey:void 0})),Hw.cache.clear?.(),uC()}async function nw(){try{await Ey()}catch(e){I(e)}}function rw(e){if(!Zv(e.scopes))return N(`tengu_oauth_tokens_not_claude_ai`,{}),{success:!0};if(!e.refreshToken||!e.expiresAt)return N(`tengu_oauth_tokens_inference_only`,{}),{success:!0};let t=iC(),n=t.name;try{let r=t.read()||{},i=r.claudeAiOauth;r.claudeAiOauth={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:e.expiresAt,scopes:e.scopes,subscriptionType:e.subscriptionType??i?.subscriptionType??null,rateLimitTier:e.rateLimitTier??i?.rateLimitTier??null};let a=t.update(r);return a.success?N(`tengu_oauth_tokens_saved`,{storageBackend:n}):N(`tengu_oauth_tokens_save_failed`,{storageBackend:n}),Z.cache?.clear?.(),VS(),gC(),a}catch(e){return I(e),N(`tengu_oauth_tokens_save_exception`,{storageBackend:n,error:pr(e)}),{success:!1,warning:`Failed to save OAuth tokens`}}}function iw(){Z.cache?.clear?.(),Sy()}async function aw(){try{let{mtimeMs:e}=await ga(R(ae(),`.credentials.json`));e!==Uw&&(Uw=e,iw())}catch{Z.cache?.clear?.()}}function ow(e){let t=Ww.get(e);if(t)return t;let n=sw(e).finally(()=>{Ww.delete(e)});return Ww.set(e,n),n}async function sw(e){iw();let t=await cw();return t?.refreshToken?t.accessToken===e?lw(0,!0):(N(`tengu_oauth_401_recovered_from_keychain`,{}),!0):!1}async function cw(){if(ne())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||py())return Z();try{let e=(await iC().readAsync())?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return I(e),null}}function lw(e=0,t=!1){return e===0&&!t?Gw||(Gw=uw(e,t).finally(()=>{Gw=null}),Gw):uw(e,t)}async function uw(e,t){await aw();let n=Z();if(!t&&(!n?.refreshToken||!iy(n.expiresAt))||!n?.refreshToken||!Zv(n.scopes))return!1;Z.cache?.clear?.(),Sy();let r=await cw();if(!r?.refreshToken||!iy(r.expiresAt))return!1;let i=ae();await fa(i,{recursive:!0});let a;try{N(`tengu_oauth_token_refresh_lock_acquiring`,{}),a=await hi(i),N(`tengu_oauth_token_refresh_lock_acquired`,{})}catch(n){return n.code===`ELOCKED`?e<5?(N(`tengu_oauth_token_refresh_lock_retry`,{retryCount:e+1}),await Ri(1e3+Math.random()*1e3),uw(e+1,t)):(N(`tengu_oauth_token_refresh_lock_retry_limit_reached`,{maxRetries:5}),!1):(I(n),N(`tengu_oauth_token_refresh_lock_error`,{error:pr(n)}),!1)}try{Z.cache?.clear?.(),Sy();let e=await cw();return!e?.refreshToken||!iy(e.expiresAt)?(N(`tengu_oauth_token_refresh_race_resolved`,{}),!1):(N(`tengu_oauth_token_refresh_starting`,{}),rw(await ty(e.refreshToken,{scopes:Zv(e.scopes)?void 0:e.scopes})),Z.cache?.clear?.(),Sy(),!0)}catch(e){I(e),Z.cache?.clear?.(),Sy();let t=await cw();return t&&!iy(t.expiresAt)?(N(`tengu_oauth_token_refresh_race_recovered`,{}),!0):!1}finally{N(`tengu_oauth_token_refresh_lock_releasing`,{}),await a(),N(`tengu_oauth_token_refresh_lock_released`,{})}}function Y(){return xC()?Zv(Z()?.scopes):!1}function dw(){return Z()?.scopes?.includes(`user:profile`)??!1}function fw(){return!(g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||Y())}function pw(){return xC()?H().oauthAccount:void 0}function mw(){let e=pw()?.billingType;return!(!Y()||!e||e!==`stripe_subscription`&&e!==`stripe_subscription_contracted`&&e!==`apple_subscription`&&e!==`google_play_subscription`)}function hw(){let e=X();return e===`max`||e===`enterprise`||e===`team`||e===`pro`||e===null}function X(){if(Iv())return Fv();if(!xC())return null;let e=Z();return e?e.subscriptionType??null:null}function gw(){return X()===`max`}function _w(){return X()===`team`}function vw(){return X()===`team`&&xw()===`default_claude_max_5x`}function yw(){return X()===`enterprise`}function bw(){return X()===`pro`}function xw(){if(!xC())return null;let e=Z();return e?e.rateLimitTier??null:null}function Sw(){switch(X()){case`enterprise`:return`Claude Enterprise`;case`team`:return`Claude Team`;case`max`:return`Claude Max`;case`pro`:return`Claude Pro`;default:return`Claude API`}}function Cw(){return!!(g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||g(process.env.CLAUDE_CODE_USE_OPENAI)||g(process.env.CLAUDE_CODE_USE_GEMINI)||g(process.env.CLAUDE_CODE_USE_GROK))}function ww(){return(z_()||{}).otelHeadersHelper}function Tw(){let e=ww();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.otelHeadersHelper===e||n?.otelHeadersHelper===e}function Ew(){let e=ww();if(!e)return{};let t=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||Jw.toString(),10);if(Kw&&Date.now()-qw<t)return Kw;if(Tw()&&!yf())return{};try{let t=ni(e,{timeout:3e4})?.toString().trim();if(!t)throw Error(`otelHeadersHelper did not return a valid value`);let n=kn(t);if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`otelHeadersHelper must return a JSON object with string key-value pairs`);for(let[e,t]of Object.entries(n))if(typeof t!=`string`)throw Error(`otelHeadersHelper returned non-string value for key "${e}": ${typeof t}`);return Kw=n,qw=Date.now(),Kw}catch(e){throw I(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${pr(e)}`)),e}}function Dw(e){return e===`max`||e===`pro`}function Ow(){let e=X();return Y()&&e!==null&&Dw(e)}function kw(){if(W()!==`firstParty`)return;let{source:e}=SC(),t={};e===`CLAUDE_CODE_OAUTH_TOKEN`||e===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`?t.tokenSource=e:Y()?t.subscription=Sw():t.tokenSource=e;let{key:n,source:r}=TC();if(n&&(t.apiKeySource=r),e===`claude.ai`||r===`/login managed key`){let e=pw()?.organizationName;e&&(t.organization=e)}let i=pw()?.emailAddress;return(e===`claude.ai`||r===`/login managed key`)&&i&&(t.email=i),t}async function Aw(){if(process.env.ANTHROPIC_UNIX_SOCKET||!xC())return{valid:!0};let e=U(`policySettings`)?.forceLoginOrgUUID;if(!e)return{valid:!0};await lw();let t=Z();if(!t)return{valid:!0};let{source:n}=SC(),r=n===`CLAUDE_CODE_OAUTH_TOKEN`||n===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,i=await Yv(t.accessToken);if(!i)return{valid:!1,message:`Unable to verify organization for the current authentication token.\nThis machine requires organization ${e} but the profile could not be fetched.\nThis may be a network error, or the token may lack the user:profile scope required for\nverification (tokens from 'claude setup-token' do not include this scope).\nTry again, or obtain a full-scope token via 'claude auth login'.`};let a=i.organization.uuid;return a===e?{valid:!0}:r?{valid:!1,message:`The ${n===`CLAUDE_CODE_OAUTH_TOKEN`?`CLAUDE_CODE_OAUTH_TOKEN`:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`} environment variable provides a token for a\ndifferent organization than required by this machine's managed settings.\n\nRequired organization: ${e}\nToken organization: ${a}\n\nRemove the environment variable or obtain a token for the correct organization.`}:{valid:!1,message:`Your authentication token belongs to organization ${a},\nbut this machine requires organization ${e}.\n\nPlease log in with the correct organization: claude auth login`}}var jw,Mw,Nw,Pw,Fw,Iw,Lw,Rw,zw,Bw,Vw,Hw,Z,Uw,Ww,Gw,Kw,qw,Jw,Yw,Q=t((()=>{Ze(),Nr(),m(),kr(),hr(),wv(),hv(),O(),qv(),ly(),Xv(),yy(),Oy(),Ny(),Fy(),KS(),op(),j(),h(),zn(),ii(),gi(),Vr(),Xr(),aC(),mC(),Ty(),B_(),zi(),An(),vC(),jw=300*1e3,Mw=null,Nw=null,Pw=0,Fw=3600*1e3,Iw=180*1e3,Lw=Yr(async()=>{let e=await BC(),t=await HC();return(e||t)&&await My(),t},Fw),Rw=5e3,zw=3600*1e3,Bw=180*1e3,Vw=Yr(async()=>await qC(),zw),Hw=p(()=>{if(ne())return null;if(process.platform===`darwin`){let e=lC();if(e){if(e.stdout)return{key:e.stdout,source:`/login managed key`}}else{let e=by();try{let t=ni(`security find-generic-password -a $USER -w -s "${e}"`);if(t)return{key:t,source:`/login managed key`}}catch(e){I(e)}}}let e=H();return e.primaryApiKey?{key:e.primaryApiKey,source:`/login managed key`}:null}),Z=p(()=>{if(ne())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{accessToken:process.env.CLAUDE_CODE_OAUTH_TOKEN,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};let e=py();if(e)return{accessToken:e,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};try{let e=iC().read()?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return I(e),null}}),Uw=0,Ww=new Map,Gw=null,Kw=null,qw=0,Jw=1740*1e3,Yw=class extends Error{}}));function Xw(){return`claude-code/2.8.3`}var Zw=t((()=>{}));function Qw(){return tT.getStore()?.workload}function $w(e,t){return tT.run({workload:e},t)}var eT,tT,nT=t((()=>{eT=`cron`,tT=new xa}));function rT(){let e=process.env.CLAUDE_AGENT_SDK_VERSION?`, agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`:``,t=process.env.CLAUDE_AGENT_SDK_CLIENT_APP?`, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`:``,n=Qw(),r=n?`, workload/${n}`:``;return`claude-cli/2.8.3 (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}${e}${t}${r})`}function iT(){let e=[];return process.env.CLAUDE_CODE_ENTRYPOINT&&e.push(process.env.CLAUDE_CODE_ENTRYPOINT),process.env.CLAUDE_AGENT_SDK_VERSION&&e.push(`agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`),process.env.CLAUDE_AGENT_SDK_CLIENT_APP&&e.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`),`claude-code/2.8.3${e.length>0?` (${e.join(`, `)})`:``}`}function aT(){return`Claude-User (${Xw()}; +https://support.anthropic.com/)`}function oT(){if(Y()){let e=Z();return e?.accessToken?{headers:{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":Dr}}:{headers:{},error:`No OAuth token available`}}let e=CC();return e?{headers:{"x-api-key":e}}:{headers:{},error:`No API key available`}}async function sT(e,t){try{return await e()}catch(n){if(!v.isAxiosError(n))throw n;let r=n.response?.status;if(!(r===401||t?.also403Revoked&&r===403&&typeof n.response?.data==`string`&&n.response.data.includes(`OAuth token has been revoked`)))throw n;let i=Z()?.accessToken;if(!i)throw n;return await ow(i),await e()}}var cT=t((()=>{Ie(),kr(),Q(),Zw(),nT()}));async function lT(){mT===null&&!hT&&(hT=pT(),mT=await hT,hT=null,gT.cache.clear?.())}function uT(){mT=null,hT=null,gT.cache.clear?.(),_T.cache.clear?.()}function dT(){return gT(!0)}function fT(){if(mT!==null)return mT;let e=pw();if(e?.emailAddress)return e.emailAddress;if(process.env.USER_TYPE===`ant`&&process.env.COO_CREATOR)return`${process.env.COO_CREATOR}@anthropic.com`}async function pT(){let e=pw();if(e?.emailAddress)return e.emailAddress;if(process.env.USER_TYPE===`ant`)return process.env.COO_CREATOR?`${process.env.COO_CREATOR}@anthropic.com`:_T()}var mT,hT,gT,_T,vT=t((()=>{Nr(),m(),O(),Q(),op(),gr(),Fr(),h(),mT=null,hT=null,gT=p(e=>{let t=Hf(),n=H(),r,i,a;if(e&&(r=X()??void 0,i=xw()??void 0,r&&n.claudeCodeFirstTokenDate)){let e=new Date(n.claudeCodeFirstTokenDate).getTime();isNaN(e)||(a=e)}let o=pw(),s=o?.organizationUuid,c=o?.accountUuid;return{deviceId:t,sessionId:at(),email:fT(),appVersion:`2.8.3`,platform:Ir(),organizationUuid:s,accountUuid:c,userType:process.env.USER_TYPE,subscriptionType:r,rateLimitTier:i,firstTokenTime:a,...g(process.env.GITHUB_ACTIONS)&&{githubActionsMetadata:{actor:process.env.GITHUB_ACTOR,actorId:process.env.GITHUB_ACTOR_ID,repository:process.env.GITHUB_REPOSITORY,repositoryId:process.env.GITHUB_REPOSITORY_ID,repositoryOwner:process.env.GITHUB_REPOSITORY_OWNER,repositoryOwnerId:process.env.GITHUB_REPOSITORY_OWNER_ID}}}}),_T=p(async()=>{let e=await Pr(`git config --get user.email`,{shell:!0,reject:!1,cwd:_r()});return e.exitCode===0&&e.stdout?e.stdout.trim():void 0})}));function yT(e){return bT(e,new WeakSet)}function bT(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>bT(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>bT(e,t))}return!1}var xT=t((()=>{})),ST,CT=t((()=>{fe(),we(),Ee(),xT(),ce(),ST=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){_(this,`hrTime`,void 0),_(this,`hrTimeObserved`,void 0),_(this,`spanContext`,void 0),_(this,`resource`,void 0),_(this,`instrumentationScope`,void 0),_(this,`attributes`,{}),_(this,`_severityText`,void 0),_(this,`_severityNumber`,void 0),_(this,`_body`,void 0),_(this,`_eventName`,void 0),_(this,`_attributesCount`,0),_(this,`_droppedAttributesCount`,0),_(this,`_isReadonly`,!1),_(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=_e(r??f),this.hrTimeObserved=_e(i??f),d){let e=me.getSpanContext(d);e&&ue(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return pe.warn(`Invalid attribute key: ${e}`),this;if(!yT(t))return pe.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&pe.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return pe.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Me,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(be,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(be,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Me,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(ge,n.stack),t=!0)}t||pe.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&pe.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}})),wT,TT=t((()=>{Fe(),fe(),CT(),ce(),wT=class{constructor(e,t){_(this,`instrumentationScope`,void 0),_(this,`_sharedState`,void 0),_(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,n=e.context||he.active(),r=e.severityNumber??Ne.UNSPECIFIED;if(r!==Ne.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=me.getSpanContext(n);if(e&&ue(e)&&(e.traceFlags&de.SAMPLED)!==de.SAMPLED)return}let i=new ST(this._sharedState,this.instrumentationScope,{context:n,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==Ne.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||he.active();if(t.traceBased){let e=me.getSpanContext(r);if(e&&ue(e)&&(e.traceFlags&de.SAMPLED)!==de.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}}})),ET,DT=t((()=>{ET=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}})),OT,kT=t((()=>{we(),ce(),OT=class{constructor(e,t){_(this,`processors`,void 0),_(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>Te(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}}}));function AT(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var jT=t((()=>{})),MT,NT=t((()=>{MT=`otel.sdk.log.created`})),PT,FT=t((()=>{NT(),ce(),PT=class{constructor(e){_(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(MT,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}})),IT,LT=t((()=>{IT=`0.215.0`})),RT,zT,BT,VT=t((()=>{fe(),Fe(),DT(),kT(),jT(),FT(),LT(),ce(),RT={disabled:!1,minimumSeverity:Ne.UNSPECIFIED,traceBased:!1},zT=()=>({...RT}),BT=class{constructor(e,t,n,r,i,a){_(this,`loggers`,new Map),_(this,`activeProcessor`,void 0),_(this,`registeredLogRecordProcessors`,[]),_(this,`resource`,void 0),_(this,`forceFlushTimeoutMillis`,void 0),_(this,`logRecordLimits`,void 0),_(this,`processors`,void 0),_(this,`loggerMetrics`,void 0),_(this,`_loggerConfigurator`,void 0),_(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new OT(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new ET,this._loggerConfigurator=i??zT,this.loggerMetrics=new PT(a?a.getMeter(`@opentelemetry/sdk-logs`,IT):le())}getLoggerConfig(e){let t=AT(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}})),HT,UT=t((()=>{fe(),Fe(),ke(),we(),TT(),VT(),ce(),HT=class{constructor(e={}){_(this,`_shutdownOnce`,void 0),_(this,`_sharedState`,void 0);let t={resource:e.resource??Ce(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??zT,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new BT(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new Ae(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return pe.warn(`A shutdown LoggerProvider cannot provide a Logger`),Pe;e||pe.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new wT({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(pe.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(pe.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}})),WT,GT=t((()=>{we(),WT=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:je(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});t?.({code:Se.SUCCESS})}}}));async function KT(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var qT,JT,YT=t((()=>{fe(),we(),ce(),qT=class{constructor(e,t,n){_(this,`_exportCompleted`,void 0),_(this,`_exportScheduledPromise`,void 0),_(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await KT(t),await he.with(De(he.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){ye(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===Se.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},JT=class{constructor(e,t){_(this,`_maxExportBatchSize`,void 0),_(this,`_maxQueueSize`,void 0),_(this,`_scheduledDelayMillis`,void 0),_(this,`_exportTimeoutMillis`,void 0),_(this,`_exporter`,void 0),_(this,`_currentExport`,null),_(this,`_finishedLogRecords`,[]),_(this,`_timer`,void 0),_(this,`_shutdownOnce`,void 0),_(this,`_flushing`,!1),this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new Ae(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(pe.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new qT(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){ye(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new qT(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,ye(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),XT,ZT=t((()=>{YT(),XT=class extends JT{onShutdown(){}}})),QT=t((()=>{ZT()})),$T=t((()=>{QT()})),eE=t((()=>{UT(),GT(),$T()}));function tE(){return g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||Hr()}function nE(){return Hr()}var rE=t((()=>{h(),zr()}));function iE(){return{seconds:0,nanos:0}}function aE(e){return e!=null}var oE,sE=t((()=>{oE={fromJSON(e){return{seconds:aE(e.seconds)?globalThis.Number(e.seconds):0,nanos:aE(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let t={};return e.seconds!==void 0&&(t.seconds=Math.round(e.seconds)),e.nanos!==void 0&&(t.nanos=Math.round(e.nanos)),t},create(e){return oE.fromPartial(e??{})},fromPartial(e){let t=iE();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}}}));function cE(){return{account_id:0,organization_uuid:``,account_uuid:``}}function lE(e){return e!=null}var uE,dE=t((()=>{uE={fromJSON(e){return{account_id:lE(e.account_id)?globalThis.Number(e.account_id):0,organization_uuid:lE(e.organization_uuid)?globalThis.String(e.organization_uuid):``,account_uuid:lE(e.account_uuid)?globalThis.String(e.account_uuid):``}},toJSON(e){let t={};return e.account_id!==void 0&&(t.account_id=Math.round(e.account_id)),e.organization_uuid!==void 0&&(t.organization_uuid=e.organization_uuid),e.account_uuid!==void 0&&(t.account_uuid=e.account_uuid),t},create(e){return uE.fromPartial(e??{})},fromPartial(e){let t=cE();return t.account_id=e.account_id??0,t.organization_uuid=e.organization_uuid??``,t.account_uuid=e.account_uuid??``,t}}}));function fE(){return{actor_id:``,repository_id:``,repository_owner_id:``}}function pE(){return{platform:``,node_version:``,terminal:``,package_managers:``,runtimes:``,is_running_with_bun:!1,is_ci:!1,is_claubbit:!1,is_github_action:!1,is_claude_code_action:!1,is_claude_ai_auth:!1,version:``,github_event_name:``,github_actions_runner_environment:``,github_actions_runner_os:``,github_action_ref:``,wsl_version:``,github_actions_metadata:void 0,arch:``,is_claude_code_remote:!1,remote_environment_type:``,claude_code_container_id:``,claude_code_remote_session_id:``,tags:[],deployment_environment:``,is_conductor:!1,version_base:``,coworker_type:``,build_time:``,is_local_agent_mode:!1,linux_distro_id:``,linux_distro_version:``,linux_kernel:``,vcs:``,platform_raw:``}}function mE(){return{slack_team_id:``,is_enterprise_install:!1,trigger:``,creation_method:``}}function hE(){return{event_name:``,client_timestamp:void 0,model:``,session_id:``,user_type:``,betas:``,env:void 0,entrypoint:``,agent_sdk_version:``,is_interactive:!1,client_type:``,process:``,additional_metadata:``,auth:void 0,server_timestamp:void 0,event_id:``,device_id:``,swe_bench_run_id:``,swe_bench_instance_id:``,swe_bench_task_id:``,email:``,agent_id:``,parent_session_id:``,agent_type:``,slack:void 0,team_name:``,skill_name:``,plugin_name:``,marketplace_name:``}}function gE(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function _E(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):gE(oE.fromJSON(e))}function $(e){return e!=null}var vE,yE,bE,xE,SE=t((()=>{sE(),dE(),vE={fromJSON(e){return{actor_id:$(e.actor_id)?globalThis.String(e.actor_id):``,repository_id:$(e.repository_id)?globalThis.String(e.repository_id):``,repository_owner_id:$(e.repository_owner_id)?globalThis.String(e.repository_owner_id):``}},toJSON(e){let t={};return e.actor_id!==void 0&&(t.actor_id=e.actor_id),e.repository_id!==void 0&&(t.repository_id=e.repository_id),e.repository_owner_id!==void 0&&(t.repository_owner_id=e.repository_owner_id),t},create(e){return vE.fromPartial(e??{})},fromPartial(e){let t=fE();return t.actor_id=e.actor_id??``,t.repository_id=e.repository_id??``,t.repository_owner_id=e.repository_owner_id??``,t}},yE={fromJSON(e){return{platform:$(e.platform)?globalThis.String(e.platform):``,node_version:$(e.node_version)?globalThis.String(e.node_version):``,terminal:$(e.terminal)?globalThis.String(e.terminal):``,package_managers:$(e.package_managers)?globalThis.String(e.package_managers):``,runtimes:$(e.runtimes)?globalThis.String(e.runtimes):``,is_running_with_bun:$(e.is_running_with_bun)?globalThis.Boolean(e.is_running_with_bun):!1,is_ci:$(e.is_ci)?globalThis.Boolean(e.is_ci):!1,is_claubbit:$(e.is_claubbit)?globalThis.Boolean(e.is_claubbit):!1,is_github_action:$(e.is_github_action)?globalThis.Boolean(e.is_github_action):!1,is_claude_code_action:$(e.is_claude_code_action)?globalThis.Boolean(e.is_claude_code_action):!1,is_claude_ai_auth:$(e.is_claude_ai_auth)?globalThis.Boolean(e.is_claude_ai_auth):!1,version:$(e.version)?globalThis.String(e.version):``,github_event_name:$(e.github_event_name)?globalThis.String(e.github_event_name):``,github_actions_runner_environment:$(e.github_actions_runner_environment)?globalThis.String(e.github_actions_runner_environment):``,github_actions_runner_os:$(e.github_actions_runner_os)?globalThis.String(e.github_actions_runner_os):``,github_action_ref:$(e.github_action_ref)?globalThis.String(e.github_action_ref):``,wsl_version:$(e.wsl_version)?globalThis.String(e.wsl_version):``,github_actions_metadata:$(e.github_actions_metadata)?vE.fromJSON(e.github_actions_metadata):void 0,arch:$(e.arch)?globalThis.String(e.arch):``,is_claude_code_remote:$(e.is_claude_code_remote)?globalThis.Boolean(e.is_claude_code_remote):!1,remote_environment_type:$(e.remote_environment_type)?globalThis.String(e.remote_environment_type):``,claude_code_container_id:$(e.claude_code_container_id)?globalThis.String(e.claude_code_container_id):``,claude_code_remote_session_id:$(e.claude_code_remote_session_id)?globalThis.String(e.claude_code_remote_session_id):``,tags:globalThis.Array.isArray(e?.tags)?e.tags.map(e=>globalThis.String(e)):[],deployment_environment:$(e.deployment_environment)?globalThis.String(e.deployment_environment):``,is_conductor:$(e.is_conductor)?globalThis.Boolean(e.is_conductor):!1,version_base:$(e.version_base)?globalThis.String(e.version_base):``,coworker_type:$(e.coworker_type)?globalThis.String(e.coworker_type):``,build_time:$(e.build_time)?globalThis.String(e.build_time):``,is_local_agent_mode:$(e.is_local_agent_mode)?globalThis.Boolean(e.is_local_agent_mode):!1,linux_distro_id:$(e.linux_distro_id)?globalThis.String(e.linux_distro_id):``,linux_distro_version:$(e.linux_distro_version)?globalThis.String(e.linux_distro_version):``,linux_kernel:$(e.linux_kernel)?globalThis.String(e.linux_kernel):``,vcs:$(e.vcs)?globalThis.String(e.vcs):``,platform_raw:$(e.platform_raw)?globalThis.String(e.platform_raw):``}},toJSON(e){let t={};return e.platform!==void 0&&(t.platform=e.platform),e.node_version!==void 0&&(t.node_version=e.node_version),e.terminal!==void 0&&(t.terminal=e.terminal),e.package_managers!==void 0&&(t.package_managers=e.package_managers),e.runtimes!==void 0&&(t.runtimes=e.runtimes),e.is_running_with_bun!==void 0&&(t.is_running_with_bun=e.is_running_with_bun),e.is_ci!==void 0&&(t.is_ci=e.is_ci),e.is_claubbit!==void 0&&(t.is_claubbit=e.is_claubbit),e.is_github_action!==void 0&&(t.is_github_action=e.is_github_action),e.is_claude_code_action!==void 0&&(t.is_claude_code_action=e.is_claude_code_action),e.is_claude_ai_auth!==void 0&&(t.is_claude_ai_auth=e.is_claude_ai_auth),e.version!==void 0&&(t.version=e.version),e.github_event_name!==void 0&&(t.github_event_name=e.github_event_name),e.github_actions_runner_environment!==void 0&&(t.github_actions_runner_environment=e.github_actions_runner_environment),e.github_actions_runner_os!==void 0&&(t.github_actions_runner_os=e.github_actions_runner_os),e.github_action_ref!==void 0&&(t.github_action_ref=e.github_action_ref),e.wsl_version!==void 0&&(t.wsl_version=e.wsl_version),e.github_actions_metadata!==void 0&&(t.github_actions_metadata=vE.toJSON(e.github_actions_metadata)),e.arch!==void 0&&(t.arch=e.arch),e.is_claude_code_remote!==void 0&&(t.is_claude_code_remote=e.is_claude_code_remote),e.remote_environment_type!==void 0&&(t.remote_environment_type=e.remote_environment_type),e.claude_code_container_id!==void 0&&(t.claude_code_container_id=e.claude_code_container_id),e.claude_code_remote_session_id!==void 0&&(t.claude_code_remote_session_id=e.claude_code_remote_session_id),e.tags?.length&&(t.tags=e.tags),e.deployment_environment!==void 0&&(t.deployment_environment=e.deployment_environment),e.is_conductor!==void 0&&(t.is_conductor=e.is_conductor),e.version_base!==void 0&&(t.version_base=e.version_base),e.coworker_type!==void 0&&(t.coworker_type=e.coworker_type),e.build_time!==void 0&&(t.build_time=e.build_time),e.is_local_agent_mode!==void 0&&(t.is_local_agent_mode=e.is_local_agent_mode),e.linux_distro_id!==void 0&&(t.linux_distro_id=e.linux_distro_id),e.linux_distro_version!==void 0&&(t.linux_distro_version=e.linux_distro_version),e.linux_kernel!==void 0&&(t.linux_kernel=e.linux_kernel),e.vcs!==void 0&&(t.vcs=e.vcs),e.platform_raw!==void 0&&(t.platform_raw=e.platform_raw),t},create(e){return yE.fromPartial(e??{})},fromPartial(e){let t=pE();return t.platform=e.platform??``,t.node_version=e.node_version??``,t.terminal=e.terminal??``,t.package_managers=e.package_managers??``,t.runtimes=e.runtimes??``,t.is_running_with_bun=e.is_running_with_bun??!1,t.is_ci=e.is_ci??!1,t.is_claubbit=e.is_claubbit??!1,t.is_github_action=e.is_github_action??!1,t.is_claude_code_action=e.is_claude_code_action??!1,t.is_claude_ai_auth=e.is_claude_ai_auth??!1,t.version=e.version??``,t.github_event_name=e.github_event_name??``,t.github_actions_runner_environment=e.github_actions_runner_environment??``,t.github_actions_runner_os=e.github_actions_runner_os??``,t.github_action_ref=e.github_action_ref??``,t.wsl_version=e.wsl_version??``,t.github_actions_metadata=e.github_actions_metadata!==void 0&&e.github_actions_metadata!==null?vE.fromPartial(e.github_actions_metadata):void 0,t.arch=e.arch??``,t.is_claude_code_remote=e.is_claude_code_remote??!1,t.remote_environment_type=e.remote_environment_type??``,t.claude_code_container_id=e.claude_code_container_id??``,t.claude_code_remote_session_id=e.claude_code_remote_session_id??``,t.tags=e.tags?.map(e=>e)||[],t.deployment_environment=e.deployment_environment??``,t.is_conductor=e.is_conductor??!1,t.version_base=e.version_base??``,t.coworker_type=e.coworker_type??``,t.build_time=e.build_time??``,t.is_local_agent_mode=e.is_local_agent_mode??!1,t.linux_distro_id=e.linux_distro_id??``,t.linux_distro_version=e.linux_distro_version??``,t.linux_kernel=e.linux_kernel??``,t.vcs=e.vcs??``,t.platform_raw=e.platform_raw??``,t}},bE={fromJSON(e){return{slack_team_id:$(e.slack_team_id)?globalThis.String(e.slack_team_id):``,is_enterprise_install:$(e.is_enterprise_install)?globalThis.Boolean(e.is_enterprise_install):!1,trigger:$(e.trigger)?globalThis.String(e.trigger):``,creation_method:$(e.creation_method)?globalThis.String(e.creation_method):``}},toJSON(e){let t={};return e.slack_team_id!==void 0&&(t.slack_team_id=e.slack_team_id),e.is_enterprise_install!==void 0&&(t.is_enterprise_install=e.is_enterprise_install),e.trigger!==void 0&&(t.trigger=e.trigger),e.creation_method!==void 0&&(t.creation_method=e.creation_method),t},create(e){return bE.fromPartial(e??{})},fromPartial(e){let t=mE();return t.slack_team_id=e.slack_team_id??``,t.is_enterprise_install=e.is_enterprise_install??!1,t.trigger=e.trigger??``,t.creation_method=e.creation_method??``,t}},xE={fromJSON(e){return{event_name:$(e.event_name)?globalThis.String(e.event_name):``,client_timestamp:$(e.client_timestamp)?_E(e.client_timestamp):void 0,model:$(e.model)?globalThis.String(e.model):``,session_id:$(e.session_id)?globalThis.String(e.session_id):``,user_type:$(e.user_type)?globalThis.String(e.user_type):``,betas:$(e.betas)?globalThis.String(e.betas):``,env:$(e.env)?yE.fromJSON(e.env):void 0,entrypoint:$(e.entrypoint)?globalThis.String(e.entrypoint):``,agent_sdk_version:$(e.agent_sdk_version)?globalThis.String(e.agent_sdk_version):``,is_interactive:$(e.is_interactive)?globalThis.Boolean(e.is_interactive):!1,client_type:$(e.client_type)?globalThis.String(e.client_type):``,process:$(e.process)?globalThis.String(e.process):``,additional_metadata:$(e.additional_metadata)?globalThis.String(e.additional_metadata):``,auth:$(e.auth)?uE.fromJSON(e.auth):void 0,server_timestamp:$(e.server_timestamp)?_E(e.server_timestamp):void 0,event_id:$(e.event_id)?globalThis.String(e.event_id):``,device_id:$(e.device_id)?globalThis.String(e.device_id):``,swe_bench_run_id:$(e.swe_bench_run_id)?globalThis.String(e.swe_bench_run_id):``,swe_bench_instance_id:$(e.swe_bench_instance_id)?globalThis.String(e.swe_bench_instance_id):``,swe_bench_task_id:$(e.swe_bench_task_id)?globalThis.String(e.swe_bench_task_id):``,email:$(e.email)?globalThis.String(e.email):``,agent_id:$(e.agent_id)?globalThis.String(e.agent_id):``,parent_session_id:$(e.parent_session_id)?globalThis.String(e.parent_session_id):``,agent_type:$(e.agent_type)?globalThis.String(e.agent_type):``,slack:$(e.slack)?bE.fromJSON(e.slack):void 0,team_name:$(e.team_name)?globalThis.String(e.team_name):``,skill_name:$(e.skill_name)?globalThis.String(e.skill_name):``,plugin_name:$(e.plugin_name)?globalThis.String(e.plugin_name):``,marketplace_name:$(e.marketplace_name)?globalThis.String(e.marketplace_name):``}},toJSON(e){let t={};return e.event_name!==void 0&&(t.event_name=e.event_name),e.client_timestamp!==void 0&&(t.client_timestamp=e.client_timestamp.toISOString()),e.model!==void 0&&(t.model=e.model),e.session_id!==void 0&&(t.session_id=e.session_id),e.user_type!==void 0&&(t.user_type=e.user_type),e.betas!==void 0&&(t.betas=e.betas),e.env!==void 0&&(t.env=yE.toJSON(e.env)),e.entrypoint!==void 0&&(t.entrypoint=e.entrypoint),e.agent_sdk_version!==void 0&&(t.agent_sdk_version=e.agent_sdk_version),e.is_interactive!==void 0&&(t.is_interactive=e.is_interactive),e.client_type!==void 0&&(t.client_type=e.client_type),e.process!==void 0&&(t.process=e.process),e.additional_metadata!==void 0&&(t.additional_metadata=e.additional_metadata),e.auth!==void 0&&(t.auth=uE.toJSON(e.auth)),e.server_timestamp!==void 0&&(t.server_timestamp=e.server_timestamp.toISOString()),e.event_id!==void 0&&(t.event_id=e.event_id),e.device_id!==void 0&&(t.device_id=e.device_id),e.swe_bench_run_id!==void 0&&(t.swe_bench_run_id=e.swe_bench_run_id),e.swe_bench_instance_id!==void 0&&(t.swe_bench_instance_id=e.swe_bench_instance_id),e.swe_bench_task_id!==void 0&&(t.swe_bench_task_id=e.swe_bench_task_id),e.email!==void 0&&(t.email=e.email),e.agent_id!==void 0&&(t.agent_id=e.agent_id),e.parent_session_id!==void 0&&(t.parent_session_id=e.parent_session_id),e.agent_type!==void 0&&(t.agent_type=e.agent_type),e.slack!==void 0&&(t.slack=bE.toJSON(e.slack)),e.team_name!==void 0&&(t.team_name=e.team_name),e.skill_name!==void 0&&(t.skill_name=e.skill_name),e.plugin_name!==void 0&&(t.plugin_name=e.plugin_name),e.marketplace_name!==void 0&&(t.marketplace_name=e.marketplace_name),t},create(e){return xE.fromPartial(e??{})},fromPartial(e){let t=hE();return t.event_name=e.event_name??``,t.client_timestamp=e.client_timestamp??void 0,t.model=e.model??``,t.session_id=e.session_id??``,t.user_type=e.user_type??``,t.betas=e.betas??``,t.env=e.env!==void 0&&e.env!==null?yE.fromPartial(e.env):void 0,t.entrypoint=e.entrypoint??``,t.agent_sdk_version=e.agent_sdk_version??``,t.is_interactive=e.is_interactive??!1,t.client_type=e.client_type??``,t.process=e.process??``,t.additional_metadata=e.additional_metadata??``,t.auth=e.auth!==void 0&&e.auth!==null?uE.fromPartial(e.auth):void 0,t.server_timestamp=e.server_timestamp??void 0,t.event_id=e.event_id??``,t.device_id=e.device_id??``,t.swe_bench_run_id=e.swe_bench_run_id??``,t.swe_bench_instance_id=e.swe_bench_instance_id??``,t.swe_bench_task_id=e.swe_bench_task_id??``,t.email=e.email??``,t.agent_id=e.agent_id??``,t.parent_session_id=e.parent_session_id??``,t.agent_type=e.agent_type??``,t.slack=e.slack!==void 0&&e.slack!==null?bE.fromPartial(e.slack):void 0,t.team_name=e.team_name??``,t.skill_name=e.skill_name??``,t.plugin_name=e.plugin_name??``,t.marketplace_name=e.marketplace_name??``,t}}}));function CE(){return{event_id:``,timestamp:void 0,experiment_id:``,variation_id:0,environment:``,user_attributes:``,experiment_metadata:``,device_id:``,auth:void 0,session_id:``,anonymous_id:``,event_metadata_vars:``}}function wE(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function TE(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):wE(oE.fromJSON(e))}function EE(e){return e!=null}var DE,OE=t((()=>{sE(),dE(),DE={fromJSON(e){return{event_id:EE(e.event_id)?globalThis.String(e.event_id):``,timestamp:EE(e.timestamp)?TE(e.timestamp):void 0,experiment_id:EE(e.experiment_id)?globalThis.String(e.experiment_id):``,variation_id:EE(e.variation_id)?globalThis.Number(e.variation_id):0,environment:EE(e.environment)?globalThis.String(e.environment):``,user_attributes:EE(e.user_attributes)?globalThis.String(e.user_attributes):``,experiment_metadata:EE(e.experiment_metadata)?globalThis.String(e.experiment_metadata):``,device_id:EE(e.device_id)?globalThis.String(e.device_id):``,auth:EE(e.auth)?uE.fromJSON(e.auth):void 0,session_id:EE(e.session_id)?globalThis.String(e.session_id):``,anonymous_id:EE(e.anonymous_id)?globalThis.String(e.anonymous_id):``,event_metadata_vars:EE(e.event_metadata_vars)?globalThis.String(e.event_metadata_vars):``}},toJSON(e){let t={};return e.event_id!==void 0&&(t.event_id=e.event_id),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.experiment_id!==void 0&&(t.experiment_id=e.experiment_id),e.variation_id!==void 0&&(t.variation_id=Math.round(e.variation_id)),e.environment!==void 0&&(t.environment=e.environment),e.user_attributes!==void 0&&(t.user_attributes=e.user_attributes),e.experiment_metadata!==void 0&&(t.experiment_metadata=e.experiment_metadata),e.device_id!==void 0&&(t.device_id=e.device_id),e.auth!==void 0&&(t.auth=uE.toJSON(e.auth)),e.session_id!==void 0&&(t.session_id=e.session_id),e.anonymous_id!==void 0&&(t.anonymous_id=e.anonymous_id),e.event_metadata_vars!==void 0&&(t.event_metadata_vars=e.event_metadata_vars),t},create(e){return DE.fromPartial(e??{})},fromPartial(e){let t=CE();return t.event_id=e.event_id??``,t.timestamp=e.timestamp??void 0,t.experiment_id=e.experiment_id??``,t.variation_id=e.variation_id??0,t.environment=e.environment??``,t.user_attributes=e.user_attributes??``,t.experiment_metadata=e.experiment_metadata??``,t.device_id=e.device_id??``,t.auth=e.auth!==void 0&&e.auth!==null?uE.fromPartial(e.auth):void 0,t.session_id=e.session_id??``,t.anonymous_id=e.anonymous_id??``,t.event_metadata_vars=e.event_metadata_vars??``,t}}}));function kE(){return process.platform===`linux`&&g(process.env.CLAUDE_CODE_BUBBLEWRAP)}function AE(){return process.platform===`linux`?IE??!1:!1}async function jE(){if(LE!==void 0)return LE;if(process.platform===`darwin`)return LE=null,null;try{let e=await Vi(process.pid,10);for(let t of e){let e=t.toLowerCase();for(let t of Rr)if(e.includes(t))return LE=t,t}}catch{}return LE=null,null}async function ME(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Lr.platform!==`darwin`?await jE()||`pycharm`:Lr.terminal}function NE(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Lr.platform!==`darwin`?LE===void 0?`pycharm`:LE||`pycharm`:Lr.terminal}async function PE(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await jE()}var FE,IE,LE,RE,zE=t((()=>{m(),Fr(),h(),ii(),Bi(),FE=p(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await ai(`test`,[`-f`,`/.dockerenv`]);return e===0}),IE=null,process.platform===`linux`&&ga(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{IE=!0},()=>{IE=!1}),RE={...Lr,terminal:NE(),getIsDocker:FE,getIsBubblewrapSandbox:kE,isMuslEnvironment:AE,getTerminalWithJetBrainsDetectionAsync:ME,initJetBrainsDetection:PE}}));function BE(e){return VE?.has(e)??!1}var VE,HE=t((()=>{j(),zn()}));function UE(){return!g(process.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS_DISABLED)}var WE=t((()=>{h()}));function GE(){return XE.getStore()}function KE(e,t){return XE.run(e,t)}function qE(e){return e?.agentType===`subagent`}function JE(){let e=GE();if(!(!qE(e)||!e.subagentName))return e.isBuiltIn?e.subagentName:`user-defined`}function YE(){let e=GE();if(!(!e?.invokingRequestId||e.invocationEmitted))return e.invocationEmitted=!0,{invokingRequestId:e.invokingRequestId,invocationKind:e.invocationKind}}var XE,ZE=t((()=>{WE(),XE=new xa}));function QE(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function $E(){return g(process.env.OTEL_LOG_TOOL_DETAILS)}function eD(e,t){return!!(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`||e===`claudeai-proxy`||t&&BE(t))}function tD(e,t,n){let r=nD(e);return!r||!fD.has(r.serverName)&&!eD(t,n)?{}:{mcpServerName:r.serverName,mcpToolName:r.mcpToolName}}function nD(e){if(!e.startsWith(`mcp__`))return;let t=e.split(`__`);if(t.length<3)return;let n=t[1],r=t.slice(2).join(`__`);if(!(!n||!r))return{serverName:n,mcpToolName:r}}function rD(e,t){if(e===`Skill`&&typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function iD(e,t=0){if(typeof e==`string`)return e.length>pD?`${e.slice(0,mD)}…[${e.length} chars]`:e;if(typeof e==`number`||typeof e==`boolean`||e==null)return e;if(t>=_D)return`<nested>`;if(Array.isArray(e)){let n=e.slice(0,gD).map(e=>iD(e,t+1));return e.length>gD&&n.push(`…[${e.length} items]`),n}if(typeof e==`object`){let n=Object.entries(e).filter(([e])=>!e.startsWith(`_`)),r=n.slice(0,gD).map(([e,n])=>[e,iD(n,t+1)]);return n.length>gD&&r.push([`…`,`${n.length} keys`]),Object.fromEntries(r)}return String(e)}function aD(e){if(!$E())return;let t=k(iD(e));return t.length>hD&&(t=t.slice(0,hD)+`…[truncated]`),t}function oD(e){let t=Yi(e).toLowerCase();if(!t||t===`.`)return;let n=t.slice(1);return n.length>vD?`other`:n}function sD(e,t){if(!e.includes(`.`)&&!t)return;let n,r=new Set;if(t){let e=oD(t);e&&(r.add(e),n=e)}for(let t of e.split(bD)){if(!t)continue;let e=t.split(xD);if(e.length<2)continue;let i=e[0],a=i.lastIndexOf(`/`),o=a>=0?i.slice(a+1):i;if(yD.has(o))for(let t=1;t<e.length;t++){let i=e[t];if(i.charCodeAt(0)===45)continue;let a=oD(i);a&&!r.has(a)&&(r.add(a),n=n?n+`,`+a:a)}}if(n)return n}function cD(){let e=GE();if(e){let t={agentId:e.agentId,parentSessionId:e.parentSessionId,agentType:e.agentType};return e.agentType===`teammate`&&(t.teamName=e.teamName),t}let t=Si(),n=bi(),r=_i(),i=yi()?`teammate`:t?`standalone`:void 0;if(t||i||n||r)return{...t?{agentId:t}:{},...i?{agentType:i}:{},...n?{parentSessionId:n}:{},...r?{teamName:r}:{}};let a=vn();return a?{parentSessionId:a}:{}}function lD(){try{let e=process.memoryUsage(),t=process.cpuUsage(),n=Date.now(),r;if(wD&&TD){let e=n-TD;e>0&&(r=(t.user-wD.user+(t.system-wD.system))/(e*1e3)*100)}return wD=t,TD=n,{uptime:process.uptime(),rss:e.rss,heapTotal:e.heapTotal,heapUsed:e.heapUsed,external:e.external,arrayBuffers:e.arrayBuffers,constrainedMemory:process.constrainedMemory(),cpuUsage:t,cpuPercent:r}}catch{return}}async function uD(e={}){let t=e.model?String(e.model):Sx(),n=typeof e.betas==`string`?e.betas:WS(t).join(`,`),[r,i]=await Promise.all([CD(),xr()]),a=lD();return{model:t,sessionId:at(),userType:process.env.USER_TYPE||``,...n.length>0?{betas:n}:{},envContext:r,...process.env.CLAUDE_CODE_ENTRYPOINT&&{entrypoint:process.env.CLAUDE_CODE_ENTRYPOINT},...process.env.CLAUDE_AGENT_SDK_VERSION&&{agentSdkVersion:process.env.CLAUDE_AGENT_SDK_VERSION},isInteractive:String(mt()),clientType:st(),...a&&{processMetrics:a},sweBenchRunId:process.env.SWE_BENCH_RUN_ID||``,sweBenchInstanceId:process.env.SWE_BENCH_INSTANCE_ID||``,sweBenchTaskId:process.env.SWE_BENCH_TASK_ID||``,...cD(),...X()&&{subscriptionType:X()},...xt()?{kairosActive:!0}:{},...i&&{rh:i}}}function dD(e,t,n={}){let{envContext:r,processMetrics:i,rh:a,kairosActive:o,skillMode:s,observerMode:c,...l}=e,u={platform:r.platform,platform_raw:r.platformRaw,arch:r.arch,node_version:r.nodeVersion,terminal:r.terminal||`unknown`,package_managers:r.packageManagers,runtimes:r.runtimes,is_running_with_bun:r.isRunningWithBun,is_ci:r.isCi,is_claubbit:r.isClaubbit,is_claude_code_remote:r.isClaudeCodeRemote,is_local_agent_mode:r.isLocalAgentMode,is_conductor:r.isConductor,is_github_action:r.isGithubAction,is_claude_code_action:r.isClaudeCodeAction,is_claude_ai_auth:r.isClaudeAiAuth,version:r.version,build_time:r.buildTime,deployment_environment:r.deploymentEnvironment};r.remoteEnvironmentType&&(u.remote_environment_type=r.remoteEnvironmentType),r.claudeCodeContainerId&&(u.claude_code_container_id=r.claudeCodeContainerId),r.claudeCodeRemoteSessionId&&(u.claude_code_remote_session_id=r.claudeCodeRemoteSessionId),r.tags&&(u.tags=r.tags.split(`,`).map(e=>e.trim()).filter(Boolean)),r.githubEventName&&(u.github_event_name=r.githubEventName),r.githubActionsRunnerEnvironment&&(u.github_actions_runner_environment=r.githubActionsRunnerEnvironment),r.githubActionsRunnerOs&&(u.github_actions_runner_os=r.githubActionsRunnerOs),r.githubActionRef&&(u.github_action_ref=r.githubActionRef),r.wslVersion&&(u.wsl_version=r.wslVersion),r.linuxDistroId&&(u.linux_distro_id=r.linuxDistroId),r.linuxDistroVersion&&(u.linux_distro_version=r.linuxDistroVersion),r.linuxKernel&&(u.linux_kernel=r.linuxKernel),r.vcs&&(u.vcs=r.vcs),r.versionBase&&(u.version_base=r.versionBase);let d={session_id:l.sessionId,model:l.model,user_type:l.userType,is_interactive:l.isInteractive===`true`,client_type:l.clientType};if(l.betas&&(d.betas=l.betas),l.entrypoint&&(d.entrypoint=l.entrypoint),l.agentSdkVersion&&(d.agent_sdk_version=l.agentSdkVersion),l.sweBenchRunId&&(d.swe_bench_run_id=l.sweBenchRunId),l.sweBenchInstanceId&&(d.swe_bench_instance_id=l.sweBenchInstanceId),l.sweBenchTaskId&&(d.swe_bench_task_id=l.sweBenchTaskId),l.agentId&&(d.agent_id=l.agentId),l.parentSessionId&&(d.parent_session_id=l.parentSessionId),l.agentType&&(d.agent_type=l.agentType),l.teamName&&(d.team_name=l.teamName),t.githubActionsMetadata){let e=t.githubActionsMetadata;u.github_actions_metadata={actor_id:e.actorId,repository_id:e.repositoryId,repository_owner_id:e.repositoryOwnerId}}let f;return(t.accountUuid||t.organizationUuid)&&(f={account_uuid:t.accountUuid,organization_uuid:t.organizationUuid}),{env:u,...i&&{process:Buffer.from(k(i)).toString(`base64`)},...f&&{auth:f},core:d,additional:{...a&&{rh:a},...o&&{is_assistant_mode:!0},...s&&{skill_mode:s},...c&&{observer_mode:c},...n}}}var fD,pD,mD,hD,gD,_D,vD,yD,bD,xD,SD,CD,wD,TD,ED=t((()=>{m(),Fr(),zE(),KS(),Jx(),O(),h(),HE(),Q(),wr(),qr(),ZE(),An(),xi(),fD=new Set([(Ui(),e(Hi)).COMPUTER_USE_MCP_SERVER_NAME]),pD=512,mD=128,hD=4*1024,gD=20,_D=2,vD=10,yD=new Set([`rm`,`mv`,`cp`,`touch`,`mkdir`,`chmod`,`chown`,`cat`,`head`,`tail`,`sort`,`stat`,`diff`,`wc`,`grep`,`rg`,`sed`]),bD=/\s*(?:&&|\|\||[;|])\s*/,xD=/\s+/,SD=p(()=>{let e=`2.8.3`.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);return e?e[0]:void 0}),CD=p(async()=>{let[e,t,n,r]=await Promise.all([Lr.getPackageManagers(),Lr.getRuntimes(),Jr(),Kr()]);return{platform:Ir(),platformRaw:process.env.CLAUDE_CODE_HOST_PLATFORM||process.platform,arch:Lr.arch,nodeVersion:Lr.nodeVersion,terminal:RE.terminal,packageManagers:e.join(`,`),runtimes:t.join(`,`),isRunningWithBun:Lr.isRunningWithBun(),isCi:g(process.env.CI),isClaubbit:g(process.env.CLAUBBIT),isClaudeCodeRemote:g(process.env.CLAUDE_CODE_REMOTE),isLocalAgentMode:process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`,isConductor:Lr.isConductor(),...process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE&&{remoteEnvironmentType:process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE},...process.env.CLAUDE_CODE_CONTAINER_ID&&{claudeCodeContainerId:process.env.CLAUDE_CODE_CONTAINER_ID},...process.env.CLAUDE_CODE_REMOTE_SESSION_ID&&{claudeCodeRemoteSessionId:process.env.CLAUDE_CODE_REMOTE_SESSION_ID},...process.env.CLAUDE_CODE_TAGS&&{tags:process.env.CLAUDE_CODE_TAGS},isGithubAction:g(process.env.GITHUB_ACTIONS),isClaudeCodeAction:g(process.env.CLAUDE_CODE_ACTION),isClaudeAiAuth:Y(),version:`2.8.3`,versionBase:SD(),buildTime:`2026-07-09T03:55:21.231Z`,deploymentEnvironment:Lr.detectDeploymentEnvironment(),...g(process.env.GITHUB_ACTIONS)&&{githubEventName:process.env.GITHUB_EVENT_NAME,githubActionsRunnerEnvironment:process.env.RUNNER_ENVIRONMENT,githubActionsRunnerOs:process.env.RUNNER_OS,githubActionRef:process.env.GITHUB_ACTION_PATH?.includes(`claude-code-action/`)?process.env.GITHUB_ACTION_PATH.split(`claude-code-action/`)[1]:void 0},...Wr()&&{wslVersion:Wr()},...n??{},...r.length>0?{vcs:r.join(`,`)}:{}}}),wD=null,TD=null}));function DD(){return Ki.join(ae(),`telemetry`)}function OD(e){if(!v.isAxiosError(e))return pr(e);let t=[],n=e.response?.headers?.[`request-id`];return n&&t.push(`request-id=${n}`),e.response?.status&&t.push(`status=${e.response.status}`),e.code&&t.push(`code=${e.code}`),e.message&&t.push(e.message),t.join(`, `)}var kD,AD,jD,MD=t((()=>{we(),Ie(),O(),SE(),OE(),Q(),op(),j(),h(),zn(),cT(),di(),Vr(),zi(),An(),Zw(),ly(),hr(),ED(),ce(),kD=ua(),AD=`1p_failed_events.`,jD=class{constructor(e={}){_(this,`endpoint`,void 0),_(this,`timeout`,void 0),_(this,`maxBatchSize`,void 0),_(this,`skipAuth`,void 0),_(this,`batchDelayMs`,void 0),_(this,`baseBackoffDelayMs`,void 0),_(this,`maxBackoffDelayMs`,void 0),_(this,`maxAttempts`,void 0),_(this,`isKilled`,void 0),_(this,`pendingExports`,[]),_(this,`isShutdown`,!1),_(this,`schedule`,void 0),_(this,`cancelBackoff`,null),_(this,`attempts`,0),_(this,`isRetrying`,!1),_(this,`lastExportErrorContext`,void 0),this.endpoint=`${e.baseUrl||(process.env.ANTHROPIC_BASE_URL===`https://api-staging.anthropic.com`?`https://api-staging.anthropic.com`:`https://api.anthropic.com`)}${e.path||`/api/event_logging/batch`}`,this.timeout=e.timeout||1e4,this.maxBatchSize=e.maxBatchSize||200,this.skipAuth=e.skipAuth??!1,this.batchDelayMs=e.batchDelayMs||100,this.baseBackoffDelayMs=e.baseBackoffDelayMs||500,this.maxBackoffDelayMs=e.maxBackoffDelayMs||3e4,this.maxAttempts=e.maxAttempts??8,this.isKilled=e.isKilled??(()=>!1),this.schedule=e.schedule??((e,t)=>{let n=setTimeout(e,t);return()=>clearTimeout(n)}),this.retryPreviousBatches()}async getQueuedEventCount(){return(await this.loadEventsFromCurrentBatch()).length}getCurrentBatchFilePath(){return Ki.join(DD(),`${AD}${at()}.${kD}.json`)}async loadEventsFromFile(e){try{return await ci(e)}catch{return[]}}async loadEventsFromCurrentBatch(){return this.loadEventsFromFile(this.getCurrentBatchFilePath())}async saveEventsToFile(e,t){try{if(t.length===0)try{await _a(e)}catch{}else await fa(DD(),{recursive:!0}),await va(e,t.map(e=>k(e)).join(`
33
33
  `)+`
34
34
  `,`utf8`)}catch(e){I(e)}}async appendEventsToFile(e,t){if(t.length!==0)try{await fa(DD(),{recursive:!0}),await da(e,t.map(e=>k(e)).join(`
35
35
  `)+`
36
- `,`utf8`)}catch(e){I(e)}}async deleteFile(e){try{await _a(e)}catch{}}async retryPreviousBatches(){try{let e=`${AD}${at()}.`,t;try{t=(await ma(DD())).filter(t=>t.startsWith(e)&&t.endsWith(`.json`)).filter(e=>!e.includes(kD))}catch(e){if(Nn(e))return;throw e}for(let e of t){let t=Ki.join(DD(),e);this.retryFileInBackground(t)}}catch(e){I(e)}}async retryFileInBackground(e){if(this.attempts>=this.maxAttempts){await this.deleteFile(e);return}let t=await this.loadEventsFromFile(e);if(t.length===0){await this.deleteFile(e);return}process.env.USER_TYPE===`ant`&&M(`1P event logging: retrying ${t.length} events from previous batch`);let n=await this.sendEventsInBatches(t);n.length===0?(await this.deleteFile(e),process.env.USER_TYPE===`ant`&&M(`1P event logging: previous batch retry succeeded`)):(await this.saveEventsToFile(e,n),process.env.USER_TYPE===`ant`&&M(`1P event logging: previous batch retry failed, ${n.length} events remain`))}async export(e,t){if(this.isShutdown){process.env.USER_TYPE===`ant`&&M(`1P event logging export failed: Exporter has been shutdown`),t({code:Se.FAILED,error:Error(`Exporter has been shutdown`)});return}let n=this.doExport(e,t);this.pendingExports.push(n),n.finally(()=>{let e=this.pendingExports.indexOf(n);e>-1&&this.pendingExports.splice(e,1)})}async doExport(e,t){try{let n=e.filter(e=>e.instrumentationScope?.name===`com.anthropic.claude_code.events`);if(n.length===0){t({code:Se.SUCCESS});return}let r=this.transformLogsToEvents(n).events;if(r.length===0){t({code:Se.SUCCESS});return}if(this.attempts>=this.maxAttempts){t({code:Se.FAILED,error:Error(`Dropped ${r.length} events: max attempts (${this.maxAttempts}) reached`)});return}let i=await this.sendEventsInBatches(r);if(this.attempts++,i.length>0){await this.queueFailedEvents(i),this.scheduleBackoffRetry();let e=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``;t({code:Se.FAILED,error:Error(`Failed to export ${i.length} events${e}`)});return}this.resetBackoff(),await this.getQueuedEventCount()>0&&!this.isRetrying&&this.retryFailedEvents(),t({code:Se.SUCCESS})}catch(e){process.env.USER_TYPE===`ant`&&M(`1P event logging export failed: ${pr(e)}`),I(e),t({code:Se.FAILED,error:Mn(e)})}}async sendEventsInBatches(e){let t=[];for(let n=0;n<e.length;n+=this.maxBatchSize)t.push(e.slice(n,n+this.maxBatchSize));process.env.USER_TYPE===`ant`&&M(`1P event logging: exporting ${e.length} events in ${t.length} batch(es)`);let n=[],r;for(let e=0;e<t.length;e++){let i=t[e];try{await this.sendBatchWithRetry({events:i})}catch(i){r=OD(i);for(let r=e;r<t.length;r++)n.push(...t[r]);if(process.env.USER_TYPE===`ant`){let n=t.length-1-e;M(`1P event logging: batch ${e+1}/${t.length} failed (${r}); short-circuiting ${n} remaining batch(es)`)}break}e<t.length-1&&this.batchDelayMs>0&&await Ri(this.batchDelayMs)}return n.length>0&&r&&(this.lastExportErrorContext=r),n}async queueFailedEvents(e){let t=this.getCurrentBatchFilePath();await this.appendEventsToFile(t,e);let n=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``,r=`1P event logging: ${e.length} events failed to export${n}`;I(Error(r))}scheduleBackoffRetry(){if(this.cancelBackoff||this.isRetrying||this.isShutdown)return;let e=Math.min(this.baseBackoffDelayMs*this.attempts*this.attempts,this.maxBackoffDelayMs);process.env.USER_TYPE===`ant`&&M(`1P event logging: scheduling backoff retry in ${e}ms (attempt ${this.attempts})`),this.cancelBackoff=this.schedule(async()=>{this.cancelBackoff=null,await this.retryFailedEvents()},e)}async retryFailedEvents(){let e=this.getCurrentBatchFilePath();for(;!this.isShutdown;){let t=await this.loadEventsFromFile(e);if(t.length===0)break;if(this.attempts>=this.maxAttempts){process.env.USER_TYPE===`ant`&&M(`1P event logging: max attempts (${this.maxAttempts}) reached, dropping ${t.length} events`),await this.deleteFile(e),this.resetBackoff();return}this.isRetrying=!0,await this.deleteFile(e),process.env.USER_TYPE===`ant`&&M(`1P event logging: retrying ${t.length} failed events (attempt ${this.attempts+1})`);let n=await this.sendEventsInBatches(t);if(this.attempts++,this.isRetrying=!1,n.length>0){await this.saveEventsToFile(e,n),this.scheduleBackoffRetry();return}this.resetBackoff(),process.env.USER_TYPE===`ant`&&M(`1P event logging: backoff retry succeeded`)}}resetBackoff(){this.attempts=0,this.cancelBackoff&&(this.cancelBackoff(),this.cancelBackoff=null)}async sendBatchWithRetry(e){if(this.isKilled())throw Error(`firstParty sink killswitch active`);let t={"Content-Type":`application/json`,"User-Agent":Xw(),"x-service-name":`claude-code`},n=yf()||Mt();process.env.USER_TYPE===`ant`&&!n&&M(`1P event logging: Trust not accepted`);let r=this.skipAuth||!n;if(!r&&Y()){let e=Z();dw()?e&&iy(e.expiresAt)&&(r=!0,process.env.USER_TYPE===`ant`&&M(`1P event logging: OAuth token expired, skipping auth to avoid 401`)):r=!0}let i=r?{headers:{},error:`trust not established or Oauth token expired`}:oT(),a=!i.error;!a&&process.env.USER_TYPE===`ant`&&M(`1P event logging: auth not available, sending without auth`);let o=a?{...t,...i.headers}:t;try{let t=await v.post(this.endpoint,e,{timeout:this.timeout,headers:o});this.logSuccess(e.events.length,a,t.data);return}catch(n){if(a&&v.isAxiosError(n)&&n.response?.status===401){process.env.USER_TYPE===`ant`&&M(`1P event logging: 401 auth error, retrying without auth`);let n=await v.post(this.endpoint,e,{timeout:this.timeout,headers:t});this.logSuccess(e.events.length,!1,n.data);return}throw n}}logSuccess(e,t,n){process.env.USER_TYPE===`ant`&&(M(`1P event logging: ${e} events exported successfully${t?` (with auth)`:` (without auth)`}`),M(`API Response: ${k(n,null,2)}`))}hrTimeToDate(e){let[t,n]=e;return new Date(t*1e3+n/1e6)}transformLogsToEvents(e){let t=[];for(let n of e){let e=n.attributes||{};if(e.event_type===`GrowthbookExperimentEvent`){let r=this.hrTimeToDate(n.hrTime),i=e.account_uuid,a=e.organization_uuid;t.push({event_type:`GrowthbookExperimentEvent`,event_data:DE.toJSON({event_id:e.event_id,timestamp:r,experiment_id:e.experiment_id,variation_id:e.variation_id,environment:e.environment,user_attributes:e.user_attributes,experiment_metadata:e.experiment_metadata,device_id:e.device_id,session_id:e.session_id,auth:i||a?{account_uuid:i,organization_uuid:a}:void 0})});continue}let r=e.event_name||n.body||`unknown`,i=e.core_metadata,a=e.user_metadata,o=e.event_metadata||{};if(!i){process.env.USER_TYPE===`ant`&&M(`1P event logging: core_metadata missing for event ${r}`),t.push({event_type:`ClaudeCodeInternalEvent`,event_data:xE.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),session_id:at(),additional_metadata:Buffer.from(k({transform_error:`core_metadata attribute is missing`})).toString(`base64`)})});continue}let s=dD(i,a,o),{_PROTO_skill_name:c,_PROTO_plugin_name:l,_PROTO_marketplace_name:u,...d}=s.additional,f=mr(d);t.push({event_type:`ClaudeCodeInternalEvent`,event_data:xE.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),device_id:e.user_id,email:a?.email,auth:s.auth,...s.core,env:s.env,process:s.process,skill_name:typeof c==`string`?c:void 0,plugin_name:typeof l==`string`?l:void 0,marketplace_name:typeof u==`string`?u:void 0,additional_metadata:Object.keys(f).length>0?Buffer.from(k(f)).toString(`base64`):void 0})})}return{events:t}}async shutdown(){this.isShutdown=!0,this.resetBackoff(),await this.forceFlush(),process.env.USER_TYPE===`ant`&&M(`1P event logging exporter shutdown complete`)}async forceFlush(){await Promise.all(this.pendingExports),process.env.USER_TYPE===`ant`&&M(`1P event logging exporter flush complete`)}}}));function ND(e){return jO(PD,{})?.[e]===!0}var PD,FD=t((()=>{XO(),PD=`tengu_frond_boric`}));function ID(){return jO(qD,{})}function LD(e){let t=ID()[e];if(!t)return null;let n=t.sample_rate;return typeof n!=`number`||n<0||n>1||n>=1?null:n<=0?0:Math.random()<n?n:0}function RD(){return jO(JD,{})}async function zD(){if(XD)try{await XD.shutdown(),process.env.USER_TYPE===`ant`&&M(`1P event logging: final shutdown complete`)}catch{}}function BD(){return!tE()}async function VD(e,t,n={}){try{let r=await uD({model:n.model,betas:n.betas}),i={event_name:t,event_id:ua(),core_metadata:r,user_metadata:gT(!0),event_metadata:n},a=Hf();a&&(i.user_id=a),process.env.USER_TYPE===`ant`&&M(`[ANT-ONLY] 1P event: ${t} ${k(n,null,0)}`),e.emit({body:t,attributes:i})}catch(e){process.env.USER_TYPE===`ant`&&I(e)}}function HD(e,t={}){BD()&&(!YD||ND(`firstParty`)||VD(YD,e,t))}function UD(){return`production`}function WD(e){if(!BD()||!YD||ND(`firstParty`))return;let t=Hf(),{accountUuid:n,organizationUuid:r}=gT(!0),i={event_type:`GrowthbookExperimentEvent`,event_id:ua(),experiment_id:e.experimentId,variation_id:e.variationId,...t&&{device_id:t},...n&&{account_uuid:n},...r&&{organization_uuid:r},...e.userAttributes&&{session_id:e.userAttributes.sessionId,user_attributes:k(e.userAttributes)},...e.experimentMetadata&&{experiment_metadata:k(e.experimentMetadata)},environment:UD()};process.env.USER_TYPE===`ant`&&M(`[ANT-ONLY] 1P GrowthBook experiment: ${e.experimentId} variation=${e.variationId}`),YD.emit({body:`growthbook_experiment`,attributes:i})}function GD(){if(wi(`1p_event_logging_start`),!BD()){process.env.USER_TYPE===`ant`&&M(`1P event logging not enabled`);return}let e=RD();ZD=e,wi(`1p_event_after_growthbook_config`);let t=e.scheduledDelayMillis||parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||QD.toString(),10),n=e.maxExportBatchSize||$D,r=e.maxQueueSize||eO,i=Gr(),a={[xe]:`claude-code`,[ve]:`2.8.1`};if(i===`wsl`){let e=Wr();e&&(a[`wsl.version`]=e)}XD=new HT({resource:Oe(a),processors:[new XT(new jD({maxBatchSize:n,skipAuth:e.skipAuth,maxAttempts:e.maxAttempts,path:e.path,baseUrl:e.baseUrl,isKilled:()=>ND(`firstParty`)}),{scheduledDelayMillis:t,maxExportBatchSize:n,maxQueueSize:r})]}),YD=XD.getLogger(`com.anthropic.claude_code.events`,`2.8.1`)}async function KD(){if(!BD()||!XD||Mu(RD(),ZD))return;process.env.USER_TYPE===`ant`&&M(`1P event logging: ${JD} changed, reinitializing`);let e=XD,t=YD;YD=null;try{await e.forceFlush()}catch{}XD=null;try{GD()}catch(n){XD=e,YD=t,I(n);return}e.shutdown().catch(()=>{})}var qD,JD,YD,XD,ZD,QD,$D,eO,tO=t((()=>{ke(),eE(),Ee(),Od(),op(),j(),Vr(),qr(),An(),Ti(),vT(),rE(),MD(),XO(),ED(),FD(),qD=`tengu_event_sampling_config`,JD=`tengu_1p_event_batch_config`,YD=null,XD=null,ZD=null,QD=1e4,$D=200,eO=8192}));function nO(e){try{Promise.resolve(e()).catch(e=>{I(e)})}catch(e){I(e)}}function rO(e){let t=!0,n=VO.subscribe(()=>nO(e));return LO.size>0&&queueMicrotask(()=>{t&&LO.size>0&&nO(e)}),()=>{t=!1,n()}}function iO(){if(!UO&&(UO=!0,process.env.USER_TYPE===`ant`)){let e=process.env.CLAUDE_INTERNAL_FC_OVERRIDES;if(e)try{HO=JSON.parse(e),M(`GrowthBook: Using env var overrides for ${Object.keys(HO).length} features: ${Object.keys(HO).join(`, `)}`)}catch{I(Error(`GrowthBook: Failed to parse CLAUDE_INTERNAL_FC_OVERRIDES: ${e}`))}}return HO}function aO(e){let t=iO();return t!==null&&e in t}function oO(){if(process.env.USER_TYPE===`ant`)try{return H().growthBookOverrides}catch{return}}function sO(){return LO.size>0?Object.fromEntries(LO):H().cachedGrowthBookFeatures??{}}function cO(){return oO()??{}}function lO(e,t){if(process.env.USER_TYPE===`ant`)try{V(n=>{let r=n.growthBookOverrides??{};if(t===void 0){if(!(e in r))return n;let{[e]:t,...i}=r;if(Object.keys(i).length===0){let{growthBookOverrides:e,...t}=n;return t}return{...n,growthBookOverrides:i}}return Mu(r[e],t)?n:{...n,growthBookOverrides:{...r,[e]:t}}}),VO.emit()}catch(e){I(e)}}function uO(){if(process.env.USER_TYPE===`ant`)try{V(e=>{if(!e.growthBookOverrides||Object.keys(e.growthBookOverrides).length===0)return e;let{growthBookOverrides:t,...n}=e;return n}),VO.emit()}catch(e){I(e)}}function dO(e){if(zO.has(e))return;let t=IO.get(e);t&&(zO.add(e),WD({experimentId:t.experimentId,variationId:t.variationId,userAttributes:_O(),experimentMetadata:{feature_id:e}}))}async function fO(e){let t=e.getPayload();if(!t?.features||Object.keys(t.features).length===0)return!1;IO.clear();let n={};for(let[e,r]of Object.entries(t.features)){let t=r;if(`value`in t&&!(`defaultValue`in t)?n[e]={...t,defaultValue:t.value}:n[e]=t,t.source===`experiment`&&t.experimentResult){let n=t.experimentResult,r=t.experiment;r?.key&&n.variationId!==void 0&&IO.set(e,{experimentId:r.key,variationId:n.variationId})}}await e.setPayload({...t,features:n}),LO.clear();for(let[e,t]of Object.entries(n)){let n=`value`in t?t.value:t.defaultValue;n!==void 0&&LO.set(e,n)}return!0}function pO(){let e=Object.fromEntries(LO);Mu(H().cachedGrowthBookFeatures,e)||V(t=>({...t,cachedGrowthBookFeatures:e}))}function mO(e){if(!process.env.CLAUDE_CODE_DISABLE_LOCAL_GATES)return WO[e]}function hO(){return process.env.CLAUDE_GB_ADAPTER_URL&&process.env.CLAUDE_GB_ADAPTER_KEY?!0:BD()}function gO(){let e=process.env.ANTHROPIC_BASE_URL;if(e)try{let t=new URL(e).host;return t===`api.anthropic.com`?void 0:t}catch{return}}function _O(){let e=dT(),t=e.email;!t&&process.env.USER_TYPE===`ant`&&(t=H().oauthAccount?.emailAddress);let n=gO();return{id:e.deviceId,sessionId:e.sessionId,deviceID:e.deviceId,platform:e.platform,...n&&{apiBaseUrlHost:n},...e.organizationUuid&&{organizationUUID:e.organizationUuid},...e.accountUuid&&{accountUUID:e.accountUuid},...e.userType&&{userType:e.userType},...e.subscriptionType&&{subscriptionType:e.subscriptionType},...e.rateLimitTier&&{rateLimitTier:e.rateLimitTier},...e.firstTokenTime&&{firstTokenTime:e.firstTokenTime},...t&&{email:t},...e.appVersion&&{appVersion:e.appVersion},...e.githubActionsMetadata&&{githubActionsMetadata:e.githubActionsMetadata}}}async function vO(e,t,n){let r=iO();if(r&&e in r)return r[e];let i=oO();if(i&&e in i)return i[e];if(!hO()){let n=mO(e);return n===void 0?t:n}let a=await KO();if(!a){let n=mO(e);return n===void 0?t:n}let o;return o=LO.has(e)?LO.get(e):a.getFeatureValue(e,t),n&&dO(e),process.env.USER_TYPE===`ant`&&M(`GrowthBook: getFeatureValue("${e}") = ${k(o)}`),o}async function yO(e,t){return vO(e,t,!0)}function bO(e,t){let n=iO();if(n&&e in n)return n[e];let r=oO();if(r&&e in r)return r[e];if(!hO()){let n=mO(e);return n===void 0?t:n}let i=mO(e);if(i!==void 0)return i;if(IO.has(e)?dO(e):RO.add(e),LO.has(e))return LO.get(e);try{let t=H().cachedGrowthBookFeatures?.[e];if(t!==void 0)return t}catch{}return t}function xO(e,t,n){return bO(e,t)}function SO(e){let t=iO();if(t&&e in t)return!!t[e];let n=oO();if(n&&e in n)return!!n[e];if(!hO()){let t=mO(e);return t===void 0?!1:!!t}IO.has(e)?dO(e):RO.add(e);try{let t=H(),n=t.cachedGrowthBookFeatures?.[e];if(n!==void 0)return!!n;let r=t.cachedStatsigGates?.[e];if(r!==void 0)return r}catch{}let r=mO(e);return r===void 0?!1:!!r}async function CO(e){let t=iO();if(t&&e in t)return!!t[e];let n=oO();if(n&&e in n)return!!n[e];if(!hO())return!1;BO&&await BO;let r=H(),i=r.cachedStatsigGates?.[e];if(i!==void 0)return!!i;let a=r.cachedGrowthBookFeatures?.[e];return a===void 0?!1:!!a}async function wO(e){let t=iO();if(t&&e in t)return!!t[e];let n=oO();if(n&&e in n)return!!n[e];if(!hO()){let t=mO(e);return t===void 0?!1:!!t}return H().cachedGrowthBookFeatures?.[e]===!0?(IO.has(e)?dO(e):RO.add(e),!0):vO(e,!1,!0)}function TO(){if(hO())try{EO(),VO.emit(),BO=KO().catch(e=>(I(Mn(e)),null)).finally(()=>{BO=null})}catch(e){I(Mn(e))}}function EO(){kO(),NO&&(process.off(`beforeExit`,NO),NO=null),PO&&(process.off(`exit`,PO),PO=null),MO?.destroy(),MO=null,FO=!1,BO=null,IO.clear(),RO.clear(),zO.clear(),LO.clear(),GO.cache?.clear?.(),KO.cache?.clear?.(),HO=null,UO=!1}async function DO(){if(hO())try{let e=await KO();if(!e)return;if(await e.refreshFeatures(),e!==MO){process.env.USER_TYPE===`ant`&&M(`GrowthBook: Skipping refresh processing for replaced client`);return}let t=await fO(e);if(e!==MO)return;process.env.USER_TYPE===`ant`&&M(`GrowthBook: Light refresh completed`),t&&(pO(),VO.emit())}catch(e){I(Mn(e))}}function OO(){hO()&&(JO&&clearInterval(JO),JO=setInterval(()=>{DO()},qO),JO.unref?.(),YO||(YO=()=>{kO()},process.once(`beforeExit`,YO)))}function kO(){JO&&(clearInterval(JO),JO=null),YO&&(process.removeListener(`beforeExit`,YO),YO=null)}async function AO(e,t){return yO(e,t)}function jO(e,t){return bO(e,t)}var MO,NO,PO,FO,IO,LO,RO,zO,BO,VO,HO,UO,WO,GO,KO,qO,JO,YO,XO=t((()=>{fc(),Od(),O(),Ad(),op(),j(),zn(),cT(),Vr(),ft(),An(),vT(),tO(),MO=null,NO=null,PO=null,FO=!1,IO=new Map,LO=new Map,RO=new Set,zO=new Set,BO=null,VO=Ot(),HO=null,UO=!1,WO={tengu_keybinding_customization_release:!0,tengu_streaming_tool_execution2:!0,tengu_kairos_cron:!0,tengu_amber_json_tools:!0,tengu_immediate_model_command:!0,tengu_basalt_3kr:!0,tengu_pebble_leaf_prune:!0,tengu_chair_sermon:!0,tengu_lodestone_enabled:!0,tengu_auto_background_agents:!0,tengu_fgts:!0,tengu_session_memory:!0,tengu_passport_quail:!0,tengu_moth_copse:!0,tengu_coral_fern:!0,tengu_chomp_inflection:!0,tengu_hive_evidence:!0,tengu_kairos_brief:!0,tengu_kairos_brief_config:{enable_slash_command:!0},tengu_sedge_lantern:!0,tengu_onyx_plover:{enabled:!0},tengu_willow_mode:`dialog`,tengu_turtle_carbon:!0,tengu_amber_stoat:!0,tengu_amber_flint:!0,tengu_slim_subagent_claudemd:!0,tengu_birch_trellis:!0,tengu_collage_kaleidoscope:!0,tengu_compact_cache_prefix:!0,tengu_kairos_assistant:!0,tengu_kairos_cron_durable:!0,tengu_attribution_header:!0,tengu_slate_prism:!0,tengu_review_bughunter_config:{enabled:!0},tengu_ccr_bundle_seed_enabled:!0},GO=p(()=>{if(!hO())return null;let e=_O(),t=kd(),n=process.env.CLAUDE_GB_ADAPTER_URL||process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_GB_BASE_URL||`https://api.anthropic.com/`,r=!!(process.env.CLAUDE_GB_ADAPTER_URL&&process.env.CLAUDE_GB_ADAPTER_KEY);process.env.USER_TYPE===`ant`&&M(`GrowthBook: Creating client with clientKey=${t}, attributes: ${k(e)}`);let i=yf()||lt()||Mt()?oT():{headers:{},error:`trust not established`},a=r||!i.error;FO=a;let o=new uc({apiHost:n,clientKey:t,attributes:e,remoteEval:!r,...r?{}:{cacheKeyAttributes:[`id`,`organizationUUID`]},...i.error?{}:{apiHostRequestHeaders:i.headers},...process.env.USER_TYPE===`ant`?{log:(e,t)=>{M(`GrowthBook: ${e} ${k(t)}`)}}:{}});if(MO=o,!a)return{client:o,initialized:Promise.resolve()};let s=o.init({timeout:5e3}).then(async e=>{if(MO!==o){process.env.USER_TYPE===`ant`&&M(`GrowthBook: Skipping init callback for replaced client`);return}process.env.USER_TYPE===`ant`&&M(`GrowthBook initialized, source: ${e.source}, success: ${e.success}`);let t=await fO(o);if(MO===o){if(t){for(let e of RO)dO(e);RO.clear(),pO(),VO.emit()}if(process.env.USER_TYPE===`ant`){let e=o.getFeatures();if(e){let t=Object.keys(e);M(`GrowthBook loaded ${t.length} features: ${t.slice(0,10).join(`, `)}${t.length>10?`...`:``}`)}}}}).catch(e=>{process.env.USER_TYPE===`ant`&&I(Mn(e))});return NO=()=>MO?.destroy(),PO=()=>MO?.destroy(),process.on(`beforeExit`,NO),process.on(`exit`,PO),{client:o,initialized:s}}),KO=p(async()=>{let e=GO();return!e||!FO&&(yf()||lt()||Mt())&&!oT().error&&(process.env.USER_TYPE===`ant`&&M(`GrowthBook: Auth became available after client creation, reinitializing`),EO(),e=GO(),!e)?null:(await e.initialized,OO(),e.client)}),qO=process.env.USER_TYPE===`ant`?1200*1e3:360*60*1e3,JO=null,YO=null}));function ZO(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(g(e))return!1;if(ie(e))return!0;if(g(process.env.CLAUDE_CODE_SIMPLE)||g(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=A_();return t.autoMemoryEnabled===void 0?!0:t.autoMemoryEnabled}function QO(){return bO(`tengu_passport_quail`,!1)?!Mt()||bO(`tengu_slate_thimble`,!1):!1}function $O(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:ae()}function ek(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=Zi(e||`.`);if(t===`.`||t===`..`)return;n=R(Wi(),e)}let r=Zi(n).replace(/[/\\]+$/,``);if(!(!Xi(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+ea).normalize(`NFC`)}function tk(){return ek(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function nk(){return ek(U(`policySettings`)?.autoMemoryDirectory??U(`flagSettings`)?.autoMemoryDirectory??U(`localSettings`)?.autoMemoryDirectory??U(`userSettings`)?.autoMemoryDirectory,!0)}function rk(){return tk()!==void 0}function ik(){return Sr(xn())??xn()}function ak(){return R(lk(),ck)}function ok(e){return Zi(e).startsWith(lk())}var sk,ck,lk,uk=t((()=>{m(),O(),XO(),h(),wr(),$r(),B_(),sk=`memory`,ck=`MEMORY.md`,lk=p(()=>(tk()??nk())||(R(R($O(),`projects`),Zr(ik()),sk)+ea).normalize(`NFC`),()=>xn())}));export{GE as $,y_ as $a,Xd as $c,Ty as $i,zS as $n,gh as $o,ox as $r,up as $s,xw as $t,kO as A,xv as Aa,ff as Ac,tb as Ai,sl as Al,tw as An,Gh as Ao,Lx as Ar,Yp as As,Xw as At,FD as B,U_ as Ba,Jd as Bc,Gy as Bi,iC as Bn,Oh as Bo,Bx as Br,Op as Bs,kw as Bt,KO as C,jv as Ca,V as Cc,Ab as Ci,Pu as Cl,zC as Cn,ug as Co,Ax as Cr,Qp as Cs,aT as Ct,EO as D,Dv as Da,gf as Dc,Cb as Di,Su as Dl,VC as Dn,Xh as Do,Sx as Dr,$p as Ds,Qw as Dt,DO as E,Pv as Ea,mf as Ec,Pb as Ei,Cu as El,Lw as En,Vh as Eo,Ex as Er,nm as Es,eT as Et,HD as F,hv as Fa,Kd as Fc,Yy as Fi,hC as Fn,zh as Fo,Ux as Fr,Ip as Fs,KC as Ft,uD as G,I_ as Ga,ef as Gc,eb as Gi,MS as Gn,Th as Go,hx as Gr,Np as Gs,Hw as Gt,nD as H,Y_ as Ha,Hd as Hc,By as Hi,eC as Hn,Ch as Ho,zx as Hr,Tp as Hs,TC as Ht,WD as I,mv as Ia,Wd as Ic,Ry as Ii,vC as In,Nh as Io,bx as Ir,Fp as Is,RC as It,ED as J,O_ as Ja,zd as Jc,Ny as Ji,WS as Jn,xh as Jo,px as Jr,Sp as Js,Z as Jt,oD as K,A_ as Ka,af as Kc,Py as Ki,GS as Kn,Dh as Ko,_x as Kr,kp as Ks,NC as Kt,KD as L,sv as La,Gd as Lc,zy as Li,cC as Ln,jh as Lo,Fx as Lr,Rp as Ls,UC as Lt,tO as M,wv as Ma,lf as Mc,ib as Mi,rw as Mn,Lh as Mo,yx as Mr,Gp as Ms,yC as Mt,GD as N,W as Na,cf as Nc,rb as Ni,Aw as Nn,Ih as No,xx as Nr,Wp as Ns,MC as Nt,lO as O,Tv as Oa,_f as Oc,Sb as Oi,Hl as Ol,JC as On,Bh as Oo,Gx as Or,em as Os,nT as Ot,BD as P,pv as Pa,Qd as Pc,Zy as Pi,gC as Pn,Fh as Po,Jx as Pr,Kp as Ps,lw as Pt,YE as Q,U as Qa,$d as Qc,Sy as Qi,RS as Qn,Sh as Qo,ix as Qr,vp as Qs,Ew as Qt,LD as R,fv as Ra,Yd as Rc,Uy as Ri,mC as Rn,Ah as Ro,Wx as Rr,Ap as Rs,YC as Rt,XO as S,Av as Sa,Lf as Sc,db as Si,Fu as Sl,Cw as Sn,yg as So,Dx as Sr,am as Ss,rT as St,TO as T,Lv as Ta,hf as Tc,Mb as Ti,Mu as Tl,XC as Tn,dg as To,Tx as Tr,Xp as Ts,sT as Tt,rD as U,Z_ as Ua,uf as Uc,Wy as Ui,XS as Un,wh as Uo,Ix as Ur,Cp as Us,PC as Ut,ND as V,K_ as Va,Vd as Vc,qy as Vi,aC as Vn,kh as Vo,Nx as Vr,Ep as Vs,CC as Vt,aD as W,W_ as Wa,Zd as Wc,$y as Wi,VS as Wn,Eh as Wo,Vx as Wr,wp as Ws,LC as Wt,tD as X,S_ as Xa,Bd as Xc,Oy as Xi,LS as Xn,_h as Xo,fx as Xr,mp as Xs,EC as Xt,$E as Y,w_ as Ya,sf as Yc,ky as Yi,KS as Yn,bh as Yo,mx as Yr,yp as Ys,cw as Yt,QE as Z,x_ as Za,tf as Zc,Dy as Zi,IS as Zn,yh as Zo,dx as Zr,fp as Zs,pw as Zt,bO as _,Jv as _a,Of as _c,hb as _i,td as _l,Tw as _n,Jg as _o,tS as _r,um as _s,lT as _t,uk as a,ry as aa,yf as ac,Ub as ai,Od as al,dw as an,N_ as ao,_S as ar,Fm as as,RE as at,cO as b,Nv as ba,Rf as bc,yb as bi,Ju as bl,vw as bn,_g as bo,jx as br,rm as bs,oT as bt,QO as c,ay as ca,Vf as cc,tx as ci,Cd as cl,xC as cn,L_ as co,vS as cr,rh as cs,rE as ct,SO as d,iy as da,H as dc,lb as di,hd as dl,Y as dn,t_ as do,ES as dr,xm as ds,eE as dt,vy as ea,dp as ec,Zb as ei,Ud as el,Sw as en,M_ as eo,kS as er,Sm as es,JE as et,uO as f,Qv as fa,Sf as fc,fb as fi,md as fl,Ow as fn,e_ as fo,fS as fr,bm as fs,XT as ft,jO as g,cy as ga,ap as gc,vb as gi,nd as gl,gw as gn,Zg as go,Xx as gr,lm as gs,_T as gt,AO as h,Zv as ha,Hf as hc,ub as hi,sd as hl,GC as hn,n_ as ho,eS as hr,hm as hs,gT as ht,rk as i,$v as ia,Yf as ic,Wb as ii,Nd as il,hw as in,P_ as io,TS as ir,Jm as is,UE as it,ID as j,G as ja,pf as jc,nb as ji,el as jl,$C as jn,Ph as jo,Ox as jr,Up as js,Zw as jt,OO as k,kv as ka,df as kc,pb as ki,Ul as kl,Vw as kn,Wh as ko,Px as kr,Zp as ks,$w as kt,wO as l,oy as la,If as lc,wb as li,Sd as ll,kC as ln,T_ as lo,gS as lr,ih as ls,tE as lt,gO as m,ty as ma,Wf as mc,cb as mi,cd as ml,yw as mn,r_ as mo,sS as mr,ym as ms,HT as mt,lk as n,uy as na,cp as nc,qb as ni,Fd as nl,ow as nn,z_ as no,wS as nr,fh as ns,KE as nt,ok as o,ey as oa,Mf as oc,Kb as oi,Dd as ol,Q as on,B_ as oo,hS as or,ah as os,PE as ot,sO as p,sy as pa,Gf as pc,bb as pi,pd as pl,ew as pn,f_ as po,dS as pr,_m as ps,WT as pt,sD as q,h_ as qa,of as qc,Fy as qi,BS as qn,vh as qo,vx as qr,Dp as qs,SC as qt,$O as r,dy as ra,sp as rc,ex as ri,Pd as rl,wC as rn,F_ as ro,xS as rr,mh as rs,WE as rt,ZO as s,ny as sa,Bf as sc,zb as si,Ed as sl,fw as sn,__ as so,yS as sr,Qm as ss,zE as st,ak as t,yy as ta,lp as tc,Qb as ti,jd as tl,X as tn,j_ as to,AS as tr,lh as ts,ZE as tt,CO as u,ly as ua,kf as uc,mb as ui,gd as ul,jC as un,$g as uo,pS as ur,hh as us,nE as ut,xO as v,Yv as va,Kf as vc,Rb as vi,ed as vl,mw as vn,Ig as vo,J as vr,om as vs,vT as vt,rO as w,qv as wa,zf as wc,kb as wi,Nu as wl,ZC as wn,lg as wo,kx as wr,qp as ws,cT as wt,aO as x,Rv as xa,Uf as xc,ab as xi,qu as xl,_w as xn,vg as xo,Mx as xr,tm as xs,iT as xt,yO as y,Xv as ya,op as yc,ob as yi,$u as yl,bw as yn,Pg as yo,Cx as yr,sm as ys,uT as yt,zD as z,q_ as za,rf as zc,Ky as zi,sC as zn,Mh as zo,Kx as zr,jp as zs,iw as zt};
36
+ `,`utf8`)}catch(e){I(e)}}async deleteFile(e){try{await _a(e)}catch{}}async retryPreviousBatches(){try{let e=`${AD}${at()}.`,t;try{t=(await ma(DD())).filter(t=>t.startsWith(e)&&t.endsWith(`.json`)).filter(e=>!e.includes(kD))}catch(e){if(Nn(e))return;throw e}for(let e of t){let t=Ki.join(DD(),e);this.retryFileInBackground(t)}}catch(e){I(e)}}async retryFileInBackground(e){if(this.attempts>=this.maxAttempts){await this.deleteFile(e);return}let t=await this.loadEventsFromFile(e);if(t.length===0){await this.deleteFile(e);return}process.env.USER_TYPE===`ant`&&M(`1P event logging: retrying ${t.length} events from previous batch`);let n=await this.sendEventsInBatches(t);n.length===0?(await this.deleteFile(e),process.env.USER_TYPE===`ant`&&M(`1P event logging: previous batch retry succeeded`)):(await this.saveEventsToFile(e,n),process.env.USER_TYPE===`ant`&&M(`1P event logging: previous batch retry failed, ${n.length} events remain`))}async export(e,t){if(this.isShutdown){process.env.USER_TYPE===`ant`&&M(`1P event logging export failed: Exporter has been shutdown`),t({code:Se.FAILED,error:Error(`Exporter has been shutdown`)});return}let n=this.doExport(e,t);this.pendingExports.push(n),n.finally(()=>{let e=this.pendingExports.indexOf(n);e>-1&&this.pendingExports.splice(e,1)})}async doExport(e,t){try{let n=e.filter(e=>e.instrumentationScope?.name===`com.anthropic.claude_code.events`);if(n.length===0){t({code:Se.SUCCESS});return}let r=this.transformLogsToEvents(n).events;if(r.length===0){t({code:Se.SUCCESS});return}if(this.attempts>=this.maxAttempts){t({code:Se.FAILED,error:Error(`Dropped ${r.length} events: max attempts (${this.maxAttempts}) reached`)});return}let i=await this.sendEventsInBatches(r);if(this.attempts++,i.length>0){await this.queueFailedEvents(i),this.scheduleBackoffRetry();let e=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``;t({code:Se.FAILED,error:Error(`Failed to export ${i.length} events${e}`)});return}this.resetBackoff(),await this.getQueuedEventCount()>0&&!this.isRetrying&&this.retryFailedEvents(),t({code:Se.SUCCESS})}catch(e){process.env.USER_TYPE===`ant`&&M(`1P event logging export failed: ${pr(e)}`),I(e),t({code:Se.FAILED,error:Mn(e)})}}async sendEventsInBatches(e){let t=[];for(let n=0;n<e.length;n+=this.maxBatchSize)t.push(e.slice(n,n+this.maxBatchSize));process.env.USER_TYPE===`ant`&&M(`1P event logging: exporting ${e.length} events in ${t.length} batch(es)`);let n=[],r;for(let e=0;e<t.length;e++){let i=t[e];try{await this.sendBatchWithRetry({events:i})}catch(i){r=OD(i);for(let r=e;r<t.length;r++)n.push(...t[r]);if(process.env.USER_TYPE===`ant`){let n=t.length-1-e;M(`1P event logging: batch ${e+1}/${t.length} failed (${r}); short-circuiting ${n} remaining batch(es)`)}break}e<t.length-1&&this.batchDelayMs>0&&await Ri(this.batchDelayMs)}return n.length>0&&r&&(this.lastExportErrorContext=r),n}async queueFailedEvents(e){let t=this.getCurrentBatchFilePath();await this.appendEventsToFile(t,e);let n=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``,r=`1P event logging: ${e.length} events failed to export${n}`;I(Error(r))}scheduleBackoffRetry(){if(this.cancelBackoff||this.isRetrying||this.isShutdown)return;let e=Math.min(this.baseBackoffDelayMs*this.attempts*this.attempts,this.maxBackoffDelayMs);process.env.USER_TYPE===`ant`&&M(`1P event logging: scheduling backoff retry in ${e}ms (attempt ${this.attempts})`),this.cancelBackoff=this.schedule(async()=>{this.cancelBackoff=null,await this.retryFailedEvents()},e)}async retryFailedEvents(){let e=this.getCurrentBatchFilePath();for(;!this.isShutdown;){let t=await this.loadEventsFromFile(e);if(t.length===0)break;if(this.attempts>=this.maxAttempts){process.env.USER_TYPE===`ant`&&M(`1P event logging: max attempts (${this.maxAttempts}) reached, dropping ${t.length} events`),await this.deleteFile(e),this.resetBackoff();return}this.isRetrying=!0,await this.deleteFile(e),process.env.USER_TYPE===`ant`&&M(`1P event logging: retrying ${t.length} failed events (attempt ${this.attempts+1})`);let n=await this.sendEventsInBatches(t);if(this.attempts++,this.isRetrying=!1,n.length>0){await this.saveEventsToFile(e,n),this.scheduleBackoffRetry();return}this.resetBackoff(),process.env.USER_TYPE===`ant`&&M(`1P event logging: backoff retry succeeded`)}}resetBackoff(){this.attempts=0,this.cancelBackoff&&(this.cancelBackoff(),this.cancelBackoff=null)}async sendBatchWithRetry(e){if(this.isKilled())throw Error(`firstParty sink killswitch active`);let t={"Content-Type":`application/json`,"User-Agent":Xw(),"x-service-name":`claude-code`},n=yf()||Mt();process.env.USER_TYPE===`ant`&&!n&&M(`1P event logging: Trust not accepted`);let r=this.skipAuth||!n;if(!r&&Y()){let e=Z();dw()?e&&iy(e.expiresAt)&&(r=!0,process.env.USER_TYPE===`ant`&&M(`1P event logging: OAuth token expired, skipping auth to avoid 401`)):r=!0}let i=r?{headers:{},error:`trust not established or Oauth token expired`}:oT(),a=!i.error;!a&&process.env.USER_TYPE===`ant`&&M(`1P event logging: auth not available, sending without auth`);let o=a?{...t,...i.headers}:t;try{let t=await v.post(this.endpoint,e,{timeout:this.timeout,headers:o});this.logSuccess(e.events.length,a,t.data);return}catch(n){if(a&&v.isAxiosError(n)&&n.response?.status===401){process.env.USER_TYPE===`ant`&&M(`1P event logging: 401 auth error, retrying without auth`);let n=await v.post(this.endpoint,e,{timeout:this.timeout,headers:t});this.logSuccess(e.events.length,!1,n.data);return}throw n}}logSuccess(e,t,n){process.env.USER_TYPE===`ant`&&(M(`1P event logging: ${e} events exported successfully${t?` (with auth)`:` (without auth)`}`),M(`API Response: ${k(n,null,2)}`))}hrTimeToDate(e){let[t,n]=e;return new Date(t*1e3+n/1e6)}transformLogsToEvents(e){let t=[];for(let n of e){let e=n.attributes||{};if(e.event_type===`GrowthbookExperimentEvent`){let r=this.hrTimeToDate(n.hrTime),i=e.account_uuid,a=e.organization_uuid;t.push({event_type:`GrowthbookExperimentEvent`,event_data:DE.toJSON({event_id:e.event_id,timestamp:r,experiment_id:e.experiment_id,variation_id:e.variation_id,environment:e.environment,user_attributes:e.user_attributes,experiment_metadata:e.experiment_metadata,device_id:e.device_id,session_id:e.session_id,auth:i||a?{account_uuid:i,organization_uuid:a}:void 0})});continue}let r=e.event_name||n.body||`unknown`,i=e.core_metadata,a=e.user_metadata,o=e.event_metadata||{};if(!i){process.env.USER_TYPE===`ant`&&M(`1P event logging: core_metadata missing for event ${r}`),t.push({event_type:`ClaudeCodeInternalEvent`,event_data:xE.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),session_id:at(),additional_metadata:Buffer.from(k({transform_error:`core_metadata attribute is missing`})).toString(`base64`)})});continue}let s=dD(i,a,o),{_PROTO_skill_name:c,_PROTO_plugin_name:l,_PROTO_marketplace_name:u,...d}=s.additional,f=mr(d);t.push({event_type:`ClaudeCodeInternalEvent`,event_data:xE.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),device_id:e.user_id,email:a?.email,auth:s.auth,...s.core,env:s.env,process:s.process,skill_name:typeof c==`string`?c:void 0,plugin_name:typeof l==`string`?l:void 0,marketplace_name:typeof u==`string`?u:void 0,additional_metadata:Object.keys(f).length>0?Buffer.from(k(f)).toString(`base64`):void 0})})}return{events:t}}async shutdown(){this.isShutdown=!0,this.resetBackoff(),await this.forceFlush(),process.env.USER_TYPE===`ant`&&M(`1P event logging exporter shutdown complete`)}async forceFlush(){await Promise.all(this.pendingExports),process.env.USER_TYPE===`ant`&&M(`1P event logging exporter flush complete`)}}}));function ND(e){return jO(PD,{})?.[e]===!0}var PD,FD=t((()=>{XO(),PD=`tengu_frond_boric`}));function ID(){return jO(qD,{})}function LD(e){let t=ID()[e];if(!t)return null;let n=t.sample_rate;return typeof n!=`number`||n<0||n>1||n>=1?null:n<=0?0:Math.random()<n?n:0}function RD(){return jO(JD,{})}async function zD(){if(XD)try{await XD.shutdown(),process.env.USER_TYPE===`ant`&&M(`1P event logging: final shutdown complete`)}catch{}}function BD(){return!tE()}async function VD(e,t,n={}){try{let r=await uD({model:n.model,betas:n.betas}),i={event_name:t,event_id:ua(),core_metadata:r,user_metadata:gT(!0),event_metadata:n},a=Hf();a&&(i.user_id=a),process.env.USER_TYPE===`ant`&&M(`[ANT-ONLY] 1P event: ${t} ${k(n,null,0)}`),e.emit({body:t,attributes:i})}catch(e){process.env.USER_TYPE===`ant`&&I(e)}}function HD(e,t={}){BD()&&(!YD||ND(`firstParty`)||VD(YD,e,t))}function UD(){return`production`}function WD(e){if(!BD()||!YD||ND(`firstParty`))return;let t=Hf(),{accountUuid:n,organizationUuid:r}=gT(!0),i={event_type:`GrowthbookExperimentEvent`,event_id:ua(),experiment_id:e.experimentId,variation_id:e.variationId,...t&&{device_id:t},...n&&{account_uuid:n},...r&&{organization_uuid:r},...e.userAttributes&&{session_id:e.userAttributes.sessionId,user_attributes:k(e.userAttributes)},...e.experimentMetadata&&{experiment_metadata:k(e.experimentMetadata)},environment:UD()};process.env.USER_TYPE===`ant`&&M(`[ANT-ONLY] 1P GrowthBook experiment: ${e.experimentId} variation=${e.variationId}`),YD.emit({body:`growthbook_experiment`,attributes:i})}function GD(){if(wi(`1p_event_logging_start`),!BD()){process.env.USER_TYPE===`ant`&&M(`1P event logging not enabled`);return}let e=RD();ZD=e,wi(`1p_event_after_growthbook_config`);let t=e.scheduledDelayMillis||parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||QD.toString(),10),n=e.maxExportBatchSize||$D,r=e.maxQueueSize||eO,i=Gr(),a={[xe]:`claude-code`,[ve]:`2.8.3`};if(i===`wsl`){let e=Wr();e&&(a[`wsl.version`]=e)}XD=new HT({resource:Oe(a),processors:[new XT(new jD({maxBatchSize:n,skipAuth:e.skipAuth,maxAttempts:e.maxAttempts,path:e.path,baseUrl:e.baseUrl,isKilled:()=>ND(`firstParty`)}),{scheduledDelayMillis:t,maxExportBatchSize:n,maxQueueSize:r})]}),YD=XD.getLogger(`com.anthropic.claude_code.events`,`2.8.3`)}async function KD(){if(!BD()||!XD||Mu(RD(),ZD))return;process.env.USER_TYPE===`ant`&&M(`1P event logging: ${JD} changed, reinitializing`);let e=XD,t=YD;YD=null;try{await e.forceFlush()}catch{}XD=null;try{GD()}catch(n){XD=e,YD=t,I(n);return}e.shutdown().catch(()=>{})}var qD,JD,YD,XD,ZD,QD,$D,eO,tO=t((()=>{ke(),eE(),Ee(),Od(),op(),j(),Vr(),qr(),An(),Ti(),vT(),rE(),MD(),XO(),ED(),FD(),qD=`tengu_event_sampling_config`,JD=`tengu_1p_event_batch_config`,YD=null,XD=null,ZD=null,QD=1e4,$D=200,eO=8192}));function nO(e){try{Promise.resolve(e()).catch(e=>{I(e)})}catch(e){I(e)}}function rO(e){let t=!0,n=VO.subscribe(()=>nO(e));return LO.size>0&&queueMicrotask(()=>{t&&LO.size>0&&nO(e)}),()=>{t=!1,n()}}function iO(){if(!UO&&(UO=!0,process.env.USER_TYPE===`ant`)){let e=process.env.CLAUDE_INTERNAL_FC_OVERRIDES;if(e)try{HO=JSON.parse(e),M(`GrowthBook: Using env var overrides for ${Object.keys(HO).length} features: ${Object.keys(HO).join(`, `)}`)}catch{I(Error(`GrowthBook: Failed to parse CLAUDE_INTERNAL_FC_OVERRIDES: ${e}`))}}return HO}function aO(e){let t=iO();return t!==null&&e in t}function oO(){if(process.env.USER_TYPE===`ant`)try{return H().growthBookOverrides}catch{return}}function sO(){return LO.size>0?Object.fromEntries(LO):H().cachedGrowthBookFeatures??{}}function cO(){return oO()??{}}function lO(e,t){if(process.env.USER_TYPE===`ant`)try{V(n=>{let r=n.growthBookOverrides??{};if(t===void 0){if(!(e in r))return n;let{[e]:t,...i}=r;if(Object.keys(i).length===0){let{growthBookOverrides:e,...t}=n;return t}return{...n,growthBookOverrides:i}}return Mu(r[e],t)?n:{...n,growthBookOverrides:{...r,[e]:t}}}),VO.emit()}catch(e){I(e)}}function uO(){if(process.env.USER_TYPE===`ant`)try{V(e=>{if(!e.growthBookOverrides||Object.keys(e.growthBookOverrides).length===0)return e;let{growthBookOverrides:t,...n}=e;return n}),VO.emit()}catch(e){I(e)}}function dO(e){if(zO.has(e))return;let t=IO.get(e);t&&(zO.add(e),WD({experimentId:t.experimentId,variationId:t.variationId,userAttributes:_O(),experimentMetadata:{feature_id:e}}))}async function fO(e){let t=e.getPayload();if(!t?.features||Object.keys(t.features).length===0)return!1;IO.clear();let n={};for(let[e,r]of Object.entries(t.features)){let t=r;if(`value`in t&&!(`defaultValue`in t)?n[e]={...t,defaultValue:t.value}:n[e]=t,t.source===`experiment`&&t.experimentResult){let n=t.experimentResult,r=t.experiment;r?.key&&n.variationId!==void 0&&IO.set(e,{experimentId:r.key,variationId:n.variationId})}}await e.setPayload({...t,features:n}),LO.clear();for(let[e,t]of Object.entries(n)){let n=`value`in t?t.value:t.defaultValue;n!==void 0&&LO.set(e,n)}return!0}function pO(){let e=Object.fromEntries(LO);Mu(H().cachedGrowthBookFeatures,e)||V(t=>({...t,cachedGrowthBookFeatures:e}))}function mO(e){if(!process.env.CLAUDE_CODE_DISABLE_LOCAL_GATES)return WO[e]}function hO(){return process.env.CLAUDE_GB_ADAPTER_URL&&process.env.CLAUDE_GB_ADAPTER_KEY?!0:BD()}function gO(){let e=process.env.ANTHROPIC_BASE_URL;if(e)try{let t=new URL(e).host;return t===`api.anthropic.com`?void 0:t}catch{return}}function _O(){let e=dT(),t=e.email;!t&&process.env.USER_TYPE===`ant`&&(t=H().oauthAccount?.emailAddress);let n=gO();return{id:e.deviceId,sessionId:e.sessionId,deviceID:e.deviceId,platform:e.platform,...n&&{apiBaseUrlHost:n},...e.organizationUuid&&{organizationUUID:e.organizationUuid},...e.accountUuid&&{accountUUID:e.accountUuid},...e.userType&&{userType:e.userType},...e.subscriptionType&&{subscriptionType:e.subscriptionType},...e.rateLimitTier&&{rateLimitTier:e.rateLimitTier},...e.firstTokenTime&&{firstTokenTime:e.firstTokenTime},...t&&{email:t},...e.appVersion&&{appVersion:e.appVersion},...e.githubActionsMetadata&&{githubActionsMetadata:e.githubActionsMetadata}}}async function vO(e,t,n){let r=iO();if(r&&e in r)return r[e];let i=oO();if(i&&e in i)return i[e];if(!hO()){let n=mO(e);return n===void 0?t:n}let a=await KO();if(!a){let n=mO(e);return n===void 0?t:n}let o;return o=LO.has(e)?LO.get(e):a.getFeatureValue(e,t),n&&dO(e),process.env.USER_TYPE===`ant`&&M(`GrowthBook: getFeatureValue("${e}") = ${k(o)}`),o}async function yO(e,t){return vO(e,t,!0)}function bO(e,t){let n=iO();if(n&&e in n)return n[e];let r=oO();if(r&&e in r)return r[e];if(!hO()){let n=mO(e);return n===void 0?t:n}let i=mO(e);if(i!==void 0)return i;if(IO.has(e)?dO(e):RO.add(e),LO.has(e))return LO.get(e);try{let t=H().cachedGrowthBookFeatures?.[e];if(t!==void 0)return t}catch{}return t}function xO(e,t,n){return bO(e,t)}function SO(e){let t=iO();if(t&&e in t)return!!t[e];let n=oO();if(n&&e in n)return!!n[e];if(!hO()){let t=mO(e);return t===void 0?!1:!!t}IO.has(e)?dO(e):RO.add(e);try{let t=H(),n=t.cachedGrowthBookFeatures?.[e];if(n!==void 0)return!!n;let r=t.cachedStatsigGates?.[e];if(r!==void 0)return r}catch{}let r=mO(e);return r===void 0?!1:!!r}async function CO(e){let t=iO();if(t&&e in t)return!!t[e];let n=oO();if(n&&e in n)return!!n[e];if(!hO())return!1;BO&&await BO;let r=H(),i=r.cachedStatsigGates?.[e];if(i!==void 0)return!!i;let a=r.cachedGrowthBookFeatures?.[e];return a===void 0?!1:!!a}async function wO(e){let t=iO();if(t&&e in t)return!!t[e];let n=oO();if(n&&e in n)return!!n[e];if(!hO()){let t=mO(e);return t===void 0?!1:!!t}return H().cachedGrowthBookFeatures?.[e]===!0?(IO.has(e)?dO(e):RO.add(e),!0):vO(e,!1,!0)}function TO(){if(hO())try{EO(),VO.emit(),BO=KO().catch(e=>(I(Mn(e)),null)).finally(()=>{BO=null})}catch(e){I(Mn(e))}}function EO(){kO(),NO&&(process.off(`beforeExit`,NO),NO=null),PO&&(process.off(`exit`,PO),PO=null),MO?.destroy(),MO=null,FO=!1,BO=null,IO.clear(),RO.clear(),zO.clear(),LO.clear(),GO.cache?.clear?.(),KO.cache?.clear?.(),HO=null,UO=!1}async function DO(){if(hO())try{let e=await KO();if(!e)return;if(await e.refreshFeatures(),e!==MO){process.env.USER_TYPE===`ant`&&M(`GrowthBook: Skipping refresh processing for replaced client`);return}let t=await fO(e);if(e!==MO)return;process.env.USER_TYPE===`ant`&&M(`GrowthBook: Light refresh completed`),t&&(pO(),VO.emit())}catch(e){I(Mn(e))}}function OO(){hO()&&(JO&&clearInterval(JO),JO=setInterval(()=>{DO()},qO),JO.unref?.(),YO||(YO=()=>{kO()},process.once(`beforeExit`,YO)))}function kO(){JO&&(clearInterval(JO),JO=null),YO&&(process.removeListener(`beforeExit`,YO),YO=null)}async function AO(e,t){return yO(e,t)}function jO(e,t){return bO(e,t)}var MO,NO,PO,FO,IO,LO,RO,zO,BO,VO,HO,UO,WO,GO,KO,qO,JO,YO,XO=t((()=>{fc(),Od(),O(),Ad(),op(),j(),zn(),cT(),Vr(),ft(),An(),vT(),tO(),MO=null,NO=null,PO=null,FO=!1,IO=new Map,LO=new Map,RO=new Set,zO=new Set,BO=null,VO=Ot(),HO=null,UO=!1,WO={tengu_keybinding_customization_release:!0,tengu_streaming_tool_execution2:!0,tengu_kairos_cron:!0,tengu_amber_json_tools:!0,tengu_immediate_model_command:!0,tengu_basalt_3kr:!0,tengu_pebble_leaf_prune:!0,tengu_chair_sermon:!0,tengu_lodestone_enabled:!0,tengu_auto_background_agents:!0,tengu_fgts:!0,tengu_session_memory:!0,tengu_passport_quail:!0,tengu_moth_copse:!0,tengu_coral_fern:!0,tengu_chomp_inflection:!0,tengu_hive_evidence:!0,tengu_kairos_brief:!0,tengu_kairos_brief_config:{enable_slash_command:!0},tengu_sedge_lantern:!0,tengu_onyx_plover:{enabled:!0},tengu_willow_mode:`dialog`,tengu_turtle_carbon:!0,tengu_amber_stoat:!0,tengu_amber_flint:!0,tengu_slim_subagent_claudemd:!0,tengu_birch_trellis:!0,tengu_collage_kaleidoscope:!0,tengu_compact_cache_prefix:!0,tengu_kairos_assistant:!0,tengu_kairos_cron_durable:!0,tengu_attribution_header:!0,tengu_slate_prism:!0,tengu_review_bughunter_config:{enabled:!0},tengu_ccr_bundle_seed_enabled:!0},GO=p(()=>{if(!hO())return null;let e=_O(),t=kd(),n=process.env.CLAUDE_GB_ADAPTER_URL||process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_GB_BASE_URL||`https://api.anthropic.com/`,r=!!(process.env.CLAUDE_GB_ADAPTER_URL&&process.env.CLAUDE_GB_ADAPTER_KEY);process.env.USER_TYPE===`ant`&&M(`GrowthBook: Creating client with clientKey=${t}, attributes: ${k(e)}`);let i=yf()||lt()||Mt()?oT():{headers:{},error:`trust not established`},a=r||!i.error;FO=a;let o=new uc({apiHost:n,clientKey:t,attributes:e,remoteEval:!r,...r?{}:{cacheKeyAttributes:[`id`,`organizationUUID`]},...i.error?{}:{apiHostRequestHeaders:i.headers},...process.env.USER_TYPE===`ant`?{log:(e,t)=>{M(`GrowthBook: ${e} ${k(t)}`)}}:{}});if(MO=o,!a)return{client:o,initialized:Promise.resolve()};let s=o.init({timeout:5e3}).then(async e=>{if(MO!==o){process.env.USER_TYPE===`ant`&&M(`GrowthBook: Skipping init callback for replaced client`);return}process.env.USER_TYPE===`ant`&&M(`GrowthBook initialized, source: ${e.source}, success: ${e.success}`);let t=await fO(o);if(MO===o){if(t){for(let e of RO)dO(e);RO.clear(),pO(),VO.emit()}if(process.env.USER_TYPE===`ant`){let e=o.getFeatures();if(e){let t=Object.keys(e);M(`GrowthBook loaded ${t.length} features: ${t.slice(0,10).join(`, `)}${t.length>10?`...`:``}`)}}}}).catch(e=>{process.env.USER_TYPE===`ant`&&I(Mn(e))});return NO=()=>MO?.destroy(),PO=()=>MO?.destroy(),process.on(`beforeExit`,NO),process.on(`exit`,PO),{client:o,initialized:s}}),KO=p(async()=>{let e=GO();return!e||!FO&&(yf()||lt()||Mt())&&!oT().error&&(process.env.USER_TYPE===`ant`&&M(`GrowthBook: Auth became available after client creation, reinitializing`),EO(),e=GO(),!e)?null:(await e.initialized,OO(),e.client)}),qO=process.env.USER_TYPE===`ant`?1200*1e3:360*60*1e3,JO=null,YO=null}));function ZO(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(g(e))return!1;if(ie(e))return!0;if(g(process.env.CLAUDE_CODE_SIMPLE)||g(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=A_();return t.autoMemoryEnabled===void 0?!0:t.autoMemoryEnabled}function QO(){return bO(`tengu_passport_quail`,!1)?!Mt()||bO(`tengu_slate_thimble`,!1):!1}function $O(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:ae()}function ek(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=Zi(e||`.`);if(t===`.`||t===`..`)return;n=R(Wi(),e)}let r=Zi(n).replace(/[/\\]+$/,``);if(!(!Xi(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+ea).normalize(`NFC`)}function tk(){return ek(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function nk(){return ek(U(`policySettings`)?.autoMemoryDirectory??U(`flagSettings`)?.autoMemoryDirectory??U(`localSettings`)?.autoMemoryDirectory??U(`userSettings`)?.autoMemoryDirectory,!0)}function rk(){return tk()!==void 0}function ik(){return Sr(xn())??xn()}function ak(){return R(lk(),ck)}function ok(e){return Zi(e).startsWith(lk())}var sk,ck,lk,uk=t((()=>{m(),O(),XO(),h(),wr(),$r(),B_(),sk=`memory`,ck=`MEMORY.md`,lk=p(()=>(tk()??nk())||(R(R($O(),`projects`),Zr(ik()),sk)+ea).normalize(`NFC`),()=>xn())}));export{GE as $,y_ as $a,Xd as $c,Ty as $i,zS as $n,gh as $o,ox as $r,up as $s,xw as $t,kO as A,xv as Aa,ff as Ac,tb as Ai,sl as Al,tw as An,Gh as Ao,Lx as Ar,Yp as As,Xw as At,FD as B,U_ as Ba,Jd as Bc,Gy as Bi,iC as Bn,Oh as Bo,Bx as Br,Op as Bs,kw as Bt,KO as C,jv as Ca,V as Cc,Ab as Ci,Pu as Cl,zC as Cn,ug as Co,Ax as Cr,Qp as Cs,aT as Ct,EO as D,Dv as Da,gf as Dc,Cb as Di,Su as Dl,VC as Dn,Xh as Do,Sx as Dr,$p as Ds,Qw as Dt,DO as E,Pv as Ea,mf as Ec,Pb as Ei,Cu as El,Lw as En,Vh as Eo,Ex as Er,nm as Es,eT as Et,HD as F,hv as Fa,Kd as Fc,Yy as Fi,hC as Fn,zh as Fo,Ux as Fr,Ip as Fs,KC as Ft,uD as G,I_ as Ga,ef as Gc,eb as Gi,MS as Gn,Th as Go,hx as Gr,Np as Gs,Hw as Gt,nD as H,Y_ as Ha,Hd as Hc,By as Hi,eC as Hn,Ch as Ho,zx as Hr,Tp as Hs,TC as Ht,WD as I,mv as Ia,Wd as Ic,Ry as Ii,vC as In,Nh as Io,bx as Ir,Fp as Is,RC as It,ED as J,O_ as Ja,zd as Jc,Ny as Ji,WS as Jn,xh as Jo,px as Jr,Sp as Js,Z as Jt,oD as K,A_ as Ka,af as Kc,Py as Ki,GS as Kn,Dh as Ko,_x as Kr,kp as Ks,NC as Kt,KD as L,sv as La,Gd as Lc,zy as Li,cC as Ln,jh as Lo,Fx as Lr,Rp as Ls,UC as Lt,tO as M,wv as Ma,lf as Mc,ib as Mi,rw as Mn,Lh as Mo,yx as Mr,Gp as Ms,yC as Mt,GD as N,W as Na,cf as Nc,rb as Ni,Aw as Nn,Ih as No,xx as Nr,Wp as Ns,MC as Nt,lO as O,Tv as Oa,_f as Oc,Sb as Oi,Hl as Ol,JC as On,Bh as Oo,Gx as Or,em as Os,nT as Ot,BD as P,pv as Pa,Qd as Pc,Zy as Pi,gC as Pn,Fh as Po,Jx as Pr,Kp as Ps,lw as Pt,YE as Q,U as Qa,$d as Qc,Sy as Qi,RS as Qn,Sh as Qo,ix as Qr,vp as Qs,Ew as Qt,LD as R,fv as Ra,Yd as Rc,Uy as Ri,mC as Rn,Ah as Ro,Wx as Rr,Ap as Rs,YC as Rt,XO as S,Av as Sa,Lf as Sc,db as Si,Fu as Sl,Cw as Sn,yg as So,Dx as Sr,am as Ss,rT as St,TO as T,Lv as Ta,hf as Tc,Mb as Ti,Mu as Tl,XC as Tn,dg as To,Tx as Tr,Xp as Ts,sT as Tt,rD as U,Z_ as Ua,uf as Uc,Wy as Ui,XS as Un,wh as Uo,Ix as Ur,Cp as Us,PC as Ut,ND as V,K_ as Va,Vd as Vc,qy as Vi,aC as Vn,kh as Vo,Nx as Vr,Ep as Vs,CC as Vt,aD as W,W_ as Wa,Zd as Wc,$y as Wi,VS as Wn,Eh as Wo,Vx as Wr,wp as Ws,LC as Wt,tD as X,S_ as Xa,Bd as Xc,Oy as Xi,LS as Xn,_h as Xo,fx as Xr,mp as Xs,EC as Xt,$E as Y,w_ as Ya,sf as Yc,ky as Yi,KS as Yn,bh as Yo,mx as Yr,yp as Ys,cw as Yt,QE as Z,x_ as Za,tf as Zc,Dy as Zi,IS as Zn,yh as Zo,dx as Zr,fp as Zs,pw as Zt,bO as _,Jv as _a,Of as _c,hb as _i,td as _l,Tw as _n,Jg as _o,tS as _r,um as _s,lT as _t,uk as a,ry as aa,yf as ac,Ub as ai,Od as al,dw as an,N_ as ao,_S as ar,Fm as as,RE as at,cO as b,Nv as ba,Rf as bc,yb as bi,Ju as bl,vw as bn,_g as bo,jx as br,rm as bs,oT as bt,QO as c,ay as ca,Vf as cc,tx as ci,Cd as cl,xC as cn,L_ as co,vS as cr,rh as cs,rE as ct,SO as d,iy as da,H as dc,lb as di,hd as dl,Y as dn,t_ as do,ES as dr,xm as ds,eE as dt,vy as ea,dp as ec,Zb as ei,Ud as el,Sw as en,M_ as eo,kS as er,Sm as es,JE as et,uO as f,Qv as fa,Sf as fc,fb as fi,md as fl,Ow as fn,e_ as fo,fS as fr,bm as fs,XT as ft,jO as g,cy as ga,ap as gc,vb as gi,nd as gl,gw as gn,Zg as go,Xx as gr,lm as gs,_T as gt,AO as h,Zv as ha,Hf as hc,ub as hi,sd as hl,GC as hn,n_ as ho,eS as hr,hm as hs,gT as ht,rk as i,$v as ia,Yf as ic,Wb as ii,Nd as il,hw as in,P_ as io,TS as ir,Jm as is,UE as it,ID as j,G as ja,pf as jc,nb as ji,el as jl,$C as jn,Ph as jo,Ox as jr,Up as js,Zw as jt,OO as k,kv as ka,df as kc,pb as ki,Ul as kl,Vw as kn,Wh as ko,Px as kr,Zp as ks,$w as kt,wO as l,oy as la,If as lc,wb as li,Sd as ll,kC as ln,T_ as lo,gS as lr,ih as ls,tE as lt,gO as m,ty as ma,Wf as mc,cb as mi,cd as ml,yw as mn,r_ as mo,sS as mr,ym as ms,HT as mt,lk as n,uy as na,cp as nc,qb as ni,Fd as nl,ow as nn,z_ as no,wS as nr,fh as ns,KE as nt,ok as o,ey as oa,Mf as oc,Kb as oi,Dd as ol,Q as on,B_ as oo,hS as or,ah as os,PE as ot,sO as p,sy as pa,Gf as pc,bb as pi,pd as pl,ew as pn,f_ as po,dS as pr,_m as ps,WT as pt,sD as q,h_ as qa,of as qc,Fy as qi,BS as qn,vh as qo,vx as qr,Dp as qs,SC as qt,$O as r,dy as ra,sp as rc,ex as ri,Pd as rl,wC as rn,F_ as ro,xS as rr,mh as rs,WE as rt,ZO as s,ny as sa,Bf as sc,zb as si,Ed as sl,fw as sn,__ as so,yS as sr,Qm as ss,zE as st,ak as t,yy as ta,lp as tc,Qb as ti,jd as tl,X as tn,j_ as to,AS as tr,lh as ts,ZE as tt,CO as u,ly as ua,kf as uc,mb as ui,gd as ul,jC as un,$g as uo,pS as ur,hh as us,nE as ut,xO as v,Yv as va,Kf as vc,Rb as vi,ed as vl,mw as vn,Ig as vo,J as vr,om as vs,vT as vt,rO as w,qv as wa,zf as wc,kb as wi,Nu as wl,ZC as wn,lg as wo,kx as wr,qp as ws,cT as wt,aO as x,Rv as xa,Uf as xc,ab as xi,qu as xl,_w as xn,vg as xo,Mx as xr,tm as xs,iT as xt,yO as y,Xv as ya,op as yc,ob as yi,$u as yl,bw as yn,Pg as yo,Cx as yr,sm as ys,uT as yt,zD as z,q_ as za,rf as zc,Ky as zi,sC as zn,Mh as zo,Kx as zr,jp as zs,iw as zt};