@readmagic/workmate 0.0.22 → 0.0.24

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 (395) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-DWgTWJ7R.js → AddWorkspaceDirectory-Ch8IcWXO.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-Cyia0s4g.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-s0Orgord.js → AgentsMdExternalIncludesDialog-LjI_H_Au.js} +1 -1
  4. package/dist/chunks/App-BOqh_1tN.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-CSEuuoq9.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-D2Gesf-u.js → BypassPermissionsModeDialog-CwfCwUr9.js} +1 -1
  7. package/dist/chunks/CustomSelect-wmZ9jz0W.js +1 -0
  8. package/dist/chunks/{DiffDialog-v2IiYyi3.js → DiffDialog-BpXIEWiE.js} +5 -5
  9. package/dist/chunks/Doctor-CMpr7tdf.js +1 -0
  10. package/dist/chunks/Doctor-DqW6j3_B.js +3 -0
  11. package/dist/chunks/{ExitFlow-BasHk1mk.js → ExitFlow-DacaBTlk.js} +2 -2
  12. package/dist/chunks/Grove-CNqYPWI6.js +11 -0
  13. package/dist/chunks/{InvalidConfigDialog-DYVQK5js.js → InvalidConfigDialog-0TMJItCC.js} +1 -1
  14. package/dist/chunks/{InvalidSettingsDialog-Dg6OiStR.js → InvalidSettingsDialog-iwh8H52b.js} +1 -1
  15. package/dist/chunks/{KeybindingProviderSetup-Bn1jzN5F.js → KeybindingProviderSetup-D49HHTXD.js} +1 -1
  16. package/dist/chunks/MCPConnectionManager-Cie77ZAK.js +1 -0
  17. package/dist/chunks/MCPToolListView-B4ehtkXd.js +1 -0
  18. package/dist/chunks/{McpParsingWarnings-DZejAh8b.js → McpParsingWarnings-Bff66RtJ.js} +1 -1
  19. package/dist/chunks/MessageSelector-Dpd6Iywp.js +3 -0
  20. package/dist/chunks/Messages-DN7M3oS_.js +10 -0
  21. package/dist/chunks/Onboarding-CQmE3rUf.js +1 -0
  22. package/dist/chunks/{PromptInputFooterSuggestions-lkr_A5jQ.js → PromptInputFooterSuggestions-HI6HH3TP.js} +1 -1
  23. package/dist/chunks/{PromptInputHelpMenu-DaQKKyM5.js → PromptInputHelpMenu-3QNUC2Cg.js} +1 -1
  24. package/dist/chunks/ProviderSetup-BCSPsvfv.js +1 -0
  25. package/dist/chunks/QueryEngine-DdLWvJv6.js +1 -0
  26. package/dist/chunks/REPL-BqO9KcK_.js +124 -0
  27. package/dist/chunks/REPL-CmZmypfF.js +1 -0
  28. package/dist/chunks/ResumeConversation-DBqX7gva.js +1 -0
  29. package/dist/chunks/SearchExtraToolsTool-BsSoILFj.js +1 -0
  30. package/dist/chunks/{SelectMulti-CNE06VAN.js → SelectMulti-BQRHed-d.js} +1 -1
  31. package/dist/chunks/Settings-B-7yBewS.js +3 -0
  32. package/dist/chunks/Spinner-ByQXTvAA.js +1 -0
  33. package/dist/chunks/{SpinnerGlyph-A6G-gloN.js → SpinnerGlyph-CmkRUvHe.js} +1 -1
  34. package/dist/chunks/{TextInput-7uqPhq9T.js → TextInput-B8ruWRf2.js} +5 -5
  35. package/dist/chunks/{ThemePicker-DT9zVy-0.js → ThemePicker-BQErFFW1.js} +1 -1
  36. package/dist/chunks/TrustDialog-BIhz6AZE.js +1 -0
  37. package/dist/chunks/{ValidationErrorsList-BLtP647v.js → ValidationErrorsList-DgNzJQUP.js} +1 -1
  38. package/dist/chunks/_baseEach-CsIRoaTH.js +1 -0
  39. package/dist/chunks/add-dir-CrUDs19x.js +1 -0
  40. package/dist/chunks/{agentDisplay-vLQHFrmq.js → agentDisplay-M4pfwbMC.js} +1 -1
  41. package/dist/chunks/agents-CGaCQeLw.js +101 -0
  42. package/dist/chunks/{agents-DLz0kfsr.js → agents-DddX7lLX.js} +1 -1
  43. package/dist/chunks/allErrors-BF73lon8.js +1 -0
  44. package/dist/chunks/{appleTerminalBackup-BYKdf3of.js → appleTerminalBackup-BArZWB21.js} +1 -1
  45. package/dist/chunks/backgroundHousekeeping-Bq3LMsVR.js +17 -0
  46. package/dist/chunks/backgroundHousekeeping-Cl3Ox7Qh.js +1 -0
  47. package/dist/chunks/banner-Cu2-XUek.js +2 -0
  48. package/dist/chunks/{bedrockClient-DxE_mHFI.js → bedrockClient-CfiDN-kF.js} +2 -2
  49. package/dist/chunks/branch-Yg_taNlT.js +2 -0
  50. package/dist/chunks/{break-cache-BL2gnDLX.js → break-cache-BMXqFTeS.js} +2 -2
  51. package/dist/chunks/btw-udbprVvu.js +1 -0
  52. package/dist/chunks/caches-ChjIEcdd.js +1 -0
  53. package/dist/chunks/caches-DLJ6urv-.js +1 -0
  54. package/dist/chunks/{claudeDesktop-D3PEgx3U.js → claudeDesktop-D8ml2767.js} +1 -1
  55. package/dist/chunks/{clear-CXfhVRp8.js → clear-B8ZtFPOK.js} +1 -1
  56. package/dist/chunks/{client-DdenNfkQ.js → client-4iqhC8xq.js} +1 -1
  57. package/dist/chunks/client-BiqbIkwr.js +1 -0
  58. package/dist/chunks/client-CZ8nyVh5.js +1 -0
  59. package/dist/chunks/{client-DvhWKIOx.js → client-CpTCeWba.js} +1 -1
  60. package/dist/chunks/commands-CVCpJo7M.js +1 -0
  61. package/dist/chunks/compact-izk6RKHQ.js +2 -0
  62. package/dist/chunks/config-C-Y2qtB2.js +3 -0
  63. package/dist/chunks/config-CFqpXMFX.js +1 -0
  64. package/dist/chunks/config-DD8fCYXn.js +1 -0
  65. package/dist/chunks/{context-3s9wtn4L.js → context-BbVm4SWK.js} +1 -1
  66. package/dist/chunks/{context-noninteractive-CJhUu_4y.js → context-noninteractive-C7wrRZnM.js} +5 -5
  67. package/dist/chunks/context-noninteractive-x0HAzWhc.js +1 -0
  68. package/dist/chunks/conversation-DouVzO0K.js +1 -0
  69. package/dist/chunks/conversation-DrVkifKy.js +1 -0
  70. package/dist/chunks/conversationRecovery-DliPBo_z.js +1 -0
  71. package/dist/chunks/crossProjectResume-DxMy05_P.js +40 -0
  72. package/dist/chunks/cwd-Dc3NV7s8.js +1 -0
  73. package/dist/chunks/cwd-Pa83R95t.js +1 -0
  74. package/dist/chunks/{datadog-v_mXWncN.js → datadog-Cu3s7P48.js} +1 -1
  75. package/dist/chunks/{debug-8DCufdSp.js → debug-Bglx1aTu.js} +5 -5
  76. package/dist/chunks/{detectRepository-DfX8xXw2.js → detectRepository-CfX8Lc0A.js} +1 -1
  77. package/dist/chunks/{diff-DJSt7QO6.js → diff-DdpHThJ7.js} +1 -1
  78. package/dist/chunks/{directoryCompletion-CT6YVeg7.js → directoryCompletion-D_Rtg-4j.js} +1 -1
  79. package/dist/chunks/dist-es-B3-7VFf2.js +1 -0
  80. package/dist/chunks/dist-es-B7j_mv242.js +1 -0
  81. package/dist/chunks/dist-es-BSKD_hOQ.js +1 -0
  82. package/dist/chunks/dist-es-BSRN-2nA.js +9 -0
  83. package/dist/chunks/{dist-es-yHGBqhBe.js → dist-es-BXXmyhQ2.js} +1 -1
  84. package/dist/chunks/{dist-es-C3reqy7X.js → dist-es-BaQndfvh2.js} +1 -1
  85. package/dist/chunks/dist-es-CzTYn7xo.js +1 -0
  86. package/dist/chunks/dist-es-DSkyibcN.js +1 -0
  87. package/dist/chunks/{dist-es-BOPBJQo3.js → dist-es-_UNJQniz.js} +1 -1
  88. package/dist/chunks/dist-es-hwK6468D.js +1 -0
  89. package/dist/chunks/dist-es-ovsdbtwh.js +1 -0
  90. package/dist/chunks/doctor-D_kV_D_l.js +1 -0
  91. package/dist/chunks/{entry-ex0-RyYV.js → entry-Bxseqbi_.js} +4 -4
  92. package/dist/chunks/{envUtils-DcaKZlRU.js → envUtils-DfkgIdYf.js} +1 -1
  93. package/dist/chunks/esm-BXTZz3av.js +1 -0
  94. package/dist/chunks/{execFileNoThrow-BsfuytkN.js → execFileNoThrow-BTachNBI.js} +1 -1
  95. package/dist/chunks/exit-C_R_FgzR.js +1 -0
  96. package/dist/chunks/extraUsage-xMuDiNKh.js +1 -0
  97. package/dist/chunks/extractMemories-D4Dl1itt.js +1 -0
  98. package/dist/chunks/fast-DH-C5IZs.js +1 -0
  99. package/dist/chunks/fast-bopOPrtf.js +1 -0
  100. package/dist/chunks/fetchModelList-DC4VQpqa.js +1 -0
  101. package/dist/chunks/fetchModelList-FE8tzTDc.js +1 -0
  102. package/dist/chunks/{fileSuggestions-B-SLfb-o.js → fileSuggestions-C-9unnoJ.js} +2 -2
  103. package/dist/chunks/firstPartyEventLogger-QmjjQmgt.js +3 -0
  104. package/dist/chunks/firstPartyEventLogger-lFeqhtfh.js +1 -0
  105. package/dist/chunks/{gemini-BC9kHhwe.js → gemini-C_ApXgwc.js} +2 -2
  106. package/dist/chunks/generateSessionName-CQ03xlYI.js +1 -0
  107. package/dist/chunks/{genericProcessUtils-BYi0OefF.js → genericProcessUtils-DwQFuna9.js} +1 -1
  108. package/dist/chunks/goal-CdL29Y8C.js +3 -0
  109. package/dist/chunks/grok-C6WAslUT.js +1 -0
  110. package/dist/chunks/grove-O6qp7ITR.js +1 -0
  111. package/dist/chunks/{help-CK90i4hE.js → help-DxanITNN.js} +1 -1
  112. package/dist/chunks/history-BMycjPTT.js +1 -0
  113. package/dist/chunks/hooks-D9ApLkBp.js +1 -0
  114. package/dist/chunks/{hooks-BRFDg9DV.js → hooks-DR3IYPJ3.js} +3 -3
  115. package/dist/chunks/{install-ZMll-dAa.js → install-0D9u2dZw.js} +1 -1
  116. package/dist/chunks/instrumentation-BFiGwntt.js +21 -0
  117. package/dist/chunks/{job-G_ukhLc4.js → job-YhJQWgE0.js} +1 -1
  118. package/dist/chunks/keybindings-DZrF9iNd.js +1 -0
  119. package/dist/chunks/{launchLocalMemory-BcRlXLm6.js → launchLocalMemory-DhJ56KDc.js} +2 -2
  120. package/dist/chunks/launchOnboarding-DmMoZwv5.js +8 -0
  121. package/dist/chunks/{loadAgentsDir-C1LkW7gl.js → loadAgentsDir-B0Anodo0.js} +540 -543
  122. package/dist/chunks/loadAgentsDir-BbUR6pqH.js +1 -0
  123. package/dist/chunks/loadPluginHooks-BSwCtQ6T.js +1 -0
  124. package/dist/chunks/{loader-C61fB6vU.js → loader-CICGtLp2.js} +1 -1
  125. package/dist/chunks/{localSearch-DFo_WTMm.js → localSearch-BxLYi6w_.js} +1 -1
  126. package/dist/chunks/localSearch-zfn7jgrh.js +1 -0
  127. package/dist/chunks/{log-DaILwWJa.js → log-D2TIwHBV.js} +1 -1
  128. package/dist/chunks/logoUtils-CRxTutvr.js +1 -0
  129. package/dist/chunks/{magicDocs-DYc9TFmI.js → magicDocs-Bkz7ZcmL.js} +3 -3
  130. package/dist/chunks/main-9ksgUUY_.js +345 -0
  131. package/dist/chunks/managedEnv-BEqrGqn1.js +1 -0
  132. package/dist/chunks/managedEnv-OPlzUPbJ.js +1 -0
  133. package/dist/chunks/mcp-ChF12reQ.js +1 -0
  134. package/dist/chunks/mcp-DoEl5uah.js +2 -0
  135. package/dist/chunks/mcp-hp9qqjAy.js +6 -0
  136. package/dist/chunks/memory-Qv-wGNQ5.js +1 -0
  137. package/dist/chunks/{mode-Pan-Q2c4.js → mode-bFXPCR2P.js} +2 -2
  138. package/dist/chunks/model-6lkW4o2c.js +1 -0
  139. package/dist/chunks/model-BvQFFOf8.js +1 -0
  140. package/dist/chunks/modelOptions-BBvF3wHK.js +1 -0
  141. package/dist/chunks/nativeInstaller-CdjmE9Zy.js +1 -0
  142. package/dist/chunks/notifications-Bc6k-Ozy.js +1 -0
  143. package/dist/chunks/onChangeAppState-DLjZ1x95.js +1 -0
  144. package/dist/chunks/openai-D46QvESE.js +2 -0
  145. package/dist/chunks/{overlayContext-CMV7nYR9.js → overlayContext-8--_fbvY.js} +1 -1
  146. package/dist/chunks/{panel-D9fGQgln.js → panel-CVS4SK_E.js} +1 -1
  147. package/dist/chunks/parser-CG5RuOCK.js +1 -0
  148. package/dist/chunks/{parser-D8slvrJP.js → parser-Cg6hSCmn.js} +1 -1
  149. package/dist/chunks/partition-DznN4XZH.js +1 -0
  150. package/dist/chunks/{pasteStore-DNV1M5Xd.js → pasteStore-P0zP-ch0.js} +1 -1
  151. package/dist/chunks/permissions-DmGFViHI.js +3 -0
  152. package/dist/chunks/pidLock-Cm4sW35f.js +3 -0
  153. package/dist/chunks/{plan-CQLnPLuE.js → plan-CzGBz_87.js} +1 -1
  154. package/dist/chunks/{platform-Dzff1WWw.js → platform-BacQ6ACS.js} +1 -1
  155. package/dist/chunks/plugin-CluR79xX.js +17 -0
  156. package/dist/chunks/{pluginAutoupdate-BJaAqwTH.js → pluginAutoupdate-ennb9k8_.js} +1 -1
  157. package/dist/chunks/pluginBlocklist-9OrNEh--.js +1 -0
  158. package/dist/chunks/pluginCliCommands-CJv5uhOG.js +1 -0
  159. package/dist/chunks/{pluginFlagging-DQP8tBi2.js → pluginFlagging-js_-WmYj.js} +1 -1
  160. package/dist/chunks/pluginOperations-CcUSHAIa.js +2 -0
  161. package/dist/chunks/pluginStartupCheck-CRBUO9gP.js +1 -0
  162. package/dist/chunks/{pluginStartupCheck-CfRvCrFg.js → pluginStartupCheck-SRXOyqr7.js} +1 -1
  163. package/dist/chunks/plugins-IwwaCDba.js +4 -0
  164. package/dist/chunks/{poorMode-J5SYJvoY.js → poorMode-B0QGV6Ci.js} +1 -1
  165. package/dist/chunks/poorMode-G-pnu6NM.js +1 -0
  166. package/dist/chunks/print-CgszM1ea.js +13 -0
  167. package/dist/chunks/processBashCommand-D098WsqY.js +1 -0
  168. package/dist/chunks/processSlashCommand-DOQFjJ88.js +5 -0
  169. package/dist/chunks/{projectContext-Bw3o5BrN.js → projectContext-5fmRr6Sd.js} +1 -1
  170. package/dist/chunks/{projectContext-BN2ZWzOG.js → projectContext-DhtjLv3k.js} +1 -1
  171. package/dist/chunks/{projectOnboardingState-CJycxw5P.js → projectOnboardingState-B5YATuc6.js} +1 -1
  172. package/dist/chunks/prompt-BKPmDAuL.js +1 -0
  173. package/dist/chunks/{prompt-BGqgPgCU.js → prompt-CJ1l3XXk.js} +1 -1
  174. package/dist/chunks/prompt-CgOklk7z.js +1 -0
  175. package/dist/chunks/{promptEditor-CmQ9p4oe.js → promptEditor-DoGHJN_W.js} +1 -1
  176. package/dist/chunks/{protocolHandler-CJo9-PfZ.js → protocolHandler-DjQALaU2.js} +1 -1
  177. package/dist/chunks/{proxy-CB17QimU.js → proxy-CDBfZjO7.js} +2 -2
  178. package/dist/chunks/reconciler-ykkSPR-i.js +1 -0
  179. package/dist/chunks/refresh-Dn_I1R4v.js +1 -0
  180. package/dist/chunks/{registerProtocol-CLIpzVwF.js → registerProtocol-CAsDme_E.js} +1 -1
  181. package/dist/chunks/reject-DtcCfuZV.js +1 -0
  182. package/dist/chunks/{reload-plugins-DjugL8jH.js → reload-plugins-CQZFQLWP.js} +1 -1
  183. package/dist/chunks/rename-DyEfsZiq.js +1 -0
  184. package/dist/chunks/{renderOptions-Zqfm2U1y.js → renderOptions-DV0dn0IW.js} +1 -1
  185. package/dist/chunks/resume-BcXEDUqZ.js +2 -0
  186. package/dist/chunks/ripgrep-DLs8MraF.js +1 -0
  187. package/dist/chunks/{ripgrep-BuzOTf1S.js → ripgrep-Dl3y5r4m.js} +1 -1
  188. package/dist/chunks/{runtimeObserver-CK_iZ6OB.js → runtimeObserver-DEuR8z0f.js} +1 -1
  189. package/dist/chunks/{runtimeObserver-CpP0L9T9.js → runtimeObserver-PJ1o8GRA.js} +4 -4
  190. package/dist/chunks/sandbox-adapter-DfB9kgQD.js +1 -0
  191. package/dist/chunks/{sandbox-toggle-KOHYvbQT.js → sandbox-toggle-D9GDUsTl.js} +1 -1
  192. package/dist/chunks/searchExtraTools-D4gMMQv0.js +1 -0
  193. package/dist/chunks/{select-C_KXmqbI.js → select-DIxfl_VN.js} +1 -1
  194. package/dist/chunks/sessionFileAccessHooks-lbgHnVvi.js +1 -0
  195. package/dist/chunks/{sessionObserver-WOYv2n7C.js → sessionObserver-BtKjvteq.js} +2 -2
  196. package/dist/chunks/sessionObserver-D6qzEdGJ.js +1 -0
  197. package/dist/chunks/sessionStorage-C_7gow_z.js +1 -0
  198. package/dist/chunks/sessionTracing-CtbeAD0s.js +11 -0
  199. package/dist/chunks/settings-B2jvL8Dp.js +24 -0
  200. package/dist/chunks/settings-CisDe8DB.js +1 -0
  201. package/dist/chunks/setup-qecdf-ES.js +3 -0
  202. package/dist/chunks/{shadowedRuleDetection-Df-kZ_pK.js → shadowedRuleDetection-Bg_aIc5Z.js} +1 -1
  203. package/dist/chunks/{sideQuestion-CMB8hfgX.js → sideQuestion-D49GsfH7.js} +3 -3
  204. package/dist/chunks/sinks-C-lP7uyO.js +1 -0
  205. package/dist/chunks/sinks-De-B1lPQ.js +1 -0
  206. package/dist/chunks/skillChangeDetector-DkOJoNhT.js +1 -0
  207. package/dist/chunks/{skillGapStore-CfmlO6pb.js → skillGapStore-CcFoHNLl.js} +2 -2
  208. package/dist/chunks/{skillLifecycle-BQ2LMfMx.js → skillLifecycle-Bnz_4wE5.js} +2 -2
  209. package/dist/chunks/{skillSearchPanel-BwYuwLFs.js → skillSearchPanel-C_5yUhqn.js} +2 -2
  210. package/dist/chunks/{skills-BVHPQma0.js → skills-BE5scC-g.js} +1 -1
  211. package/dist/chunks/startupProfiler-BH0FoI66.js +1 -0
  212. package/dist/chunks/{startupProfiler-DTs9w9EN.js → startupProfiler-CJdr3SxP.js} +2 -2
  213. package/dist/chunks/state-B4jiUise.js +1 -0
  214. package/dist/chunks/state-BhOKSFi5.js +1 -0
  215. package/dist/chunks/status-Dw09WZLd.js +1 -0
  216. package/dist/chunks/statusNoticeHelpers-BRQpUIlH.js +1 -0
  217. package/dist/chunks/{stringUtils-BQm3OfeJ.js → stringUtils-C718f5ey.js} +1 -1
  218. package/dist/chunks/sts-ei3CGBNu.js +1 -0
  219. package/dist/chunks/switcher-CgZVah7U.js +1 -0
  220. package/dist/chunks/{switcher-Bq1Ct_Sn.js → switcher-DZwUo5Ed.js} +1 -1
  221. package/dist/chunks/{tasks-0c8Uy04D.js → tasks-DdcUQEeD.js} +1 -1
  222. package/dist/chunks/{templateJobs-BdFzE9XG.js → templateJobs-C8qsPrLj.js} +1 -1
  223. package/dist/chunks/{terminalSetup-Cf_r6pwK.js → terminalSetup-B_10N_gE.js} +3 -3
  224. package/dist/chunks/{terminalSetup-D7J6bxcn.js → terminalSetup-qc2PlvOm.js} +1 -1
  225. package/dist/chunks/{theme-Bby4fssR.js → theme-f1h2QI8J.js} +1 -1
  226. package/dist/chunks/tipRegistry-B71o4qWr.js +2 -0
  227. package/dist/chunks/{toolEventObserver-CzFZUIsM.js → toolEventObserver-7QP38x4t.js} +1 -1
  228. package/dist/chunks/toolPool-V-7Yv0GA.js +1 -0
  229. package/dist/chunks/{types-zk5Ltv5q.js → types-Dx7P7JLQ.js} +2 -2
  230. package/dist/chunks/udsClient-cQz6nJ_T.js +1 -0
  231. package/dist/chunks/{use-select-navigation-DMaC_3iw.js → use-select-navigation-hWL5VHnL.js} +1 -1
  232. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-CjW3gUOt.js → useExitOnCtrlCDWithKeybindings-BKwzUpgb.js} +1 -1
  233. package/dist/chunks/useMainLoopModel-DxvV70Ru.js +1 -0
  234. package/dist/chunks/useManagePlugins-BXLXazrR.js +1 -0
  235. package/dist/chunks/useMergedTools-CCgnBJzO.js +1 -0
  236. package/dist/chunks/{useSearchInput-C2JuUW3g.js → useSearchInput-CzopttqC.js} +1 -1
  237. package/dist/chunks/useSettingsErrors-SFPWfxsA.js +1 -0
  238. package/dist/chunks/{util-Bq5l7FF5.js → util-Cbb3S6SX.js} +1 -1
  239. package/dist/chunks/validatePlugin-BMSoeb_b.js +1 -0
  240. package/dist/chunks/vim-CoRp9lY1.js +1 -0
  241. package/dist/chunks/worktree-Vm-SNY5x.js +1 -0
  242. package/dist/cli.js +1 -1
  243. package/package.json +1 -5
  244. package/dist/chunks/AgentsMdExternalIncludesDialog-DCvgQ6n3.js +0 -1
  245. package/dist/chunks/App-BcEI6U5j.js +0 -1
  246. package/dist/chunks/ApproveApiKey-DegdTXZl.js +0 -1
  247. package/dist/chunks/ApproveApiKey-_VXIMSwY.js +0 -1
  248. package/dist/chunks/BackgroundTasksDialog-CjBt1L0p.js +0 -2
  249. package/dist/chunks/CustomSelect-B46Eh0gU.js +0 -1
  250. package/dist/chunks/Doctor-BP0Rqraa.js +0 -1
  251. package/dist/chunks/Doctor-By_y3C2V.js +0 -3
  252. package/dist/chunks/Grove-C3mhgshv.js +0 -11
  253. package/dist/chunks/MCPConnectionManager-ChN4Ayjk.js +0 -1
  254. package/dist/chunks/MCPToolListView-DLSrQHDc.js +0 -1
  255. package/dist/chunks/MessageSelector-CdDlJE48.js +0 -3
  256. package/dist/chunks/Messages-DuL_r1Or.js +0 -10
  257. package/dist/chunks/Onboarding-CE2GNA-h.js +0 -1
  258. package/dist/chunks/QueryEngine-DNNy1UCD.js +0 -1
  259. package/dist/chunks/REPL-CEhW-C41.js +0 -1
  260. package/dist/chunks/REPL-CkSL4C_8.js +0 -124
  261. package/dist/chunks/ResumeConversation-BMCO_3X7.js +0 -1
  262. package/dist/chunks/SearchExtraToolsTool-DSy_jDhf.js +0 -1
  263. package/dist/chunks/Settings-mDykHLok.js +0 -2
  264. package/dist/chunks/Spinner-DwsJJUtn.js +0 -1
  265. package/dist/chunks/TrustDialog-G4jM9IfM.js +0 -1
  266. package/dist/chunks/add-dir-7RfQAC3h.js +0 -1
  267. package/dist/chunks/agents-BNg_skSm.js +0 -101
  268. package/dist/chunks/allErrors-DaztSMrw.js +0 -1
  269. package/dist/chunks/auth-BTB00dq5.js +0 -10
  270. package/dist/chunks/auth-Bbc0Ny8i.js +0 -1
  271. package/dist/chunks/backgroundHousekeeping-DYz83_8C.js +0 -1
  272. package/dist/chunks/backgroundHousekeeping-bEZtlJSf.js +0 -17
  273. package/dist/chunks/banner-mqZEluky.js +0 -2
  274. package/dist/chunks/branch-exFKkymg.js +0 -2
  275. package/dist/chunks/btw-3l78DYET.js +0 -1
  276. package/dist/chunks/caches-6Nx6tsk9.js +0 -1
  277. package/dist/chunks/caches-ouaWB9bY.js +0 -1
  278. package/dist/chunks/client-C01Bnxxv.js +0 -1
  279. package/dist/chunks/client-DYRgRQsr.js +0 -1
  280. package/dist/chunks/commands-BoxOw75F.js +0 -1
  281. package/dist/chunks/compact-BOYr105K.js +0 -2
  282. package/dist/chunks/config-BddEvZZl.js +0 -3
  283. package/dist/chunks/config-GEv9hUzz.js +0 -1
  284. package/dist/chunks/config-kw4xg7Nk.js +0 -1
  285. package/dist/chunks/context-noninteractive-DFvoZ2L9.js +0 -1
  286. package/dist/chunks/conversation-CoGharlH.js +0 -1
  287. package/dist/chunks/conversation-MxEVm54C.js +0 -1
  288. package/dist/chunks/conversationRecovery-Da_8uldZ.js +0 -1
  289. package/dist/chunks/crossProjectResume-CzPCHq_K.js +0 -40
  290. package/dist/chunks/cwd-BcO6WHKo.js +0 -1
  291. package/dist/chunks/cwd-CDUelriw.js +0 -1
  292. package/dist/chunks/dist-es-5t7v8oaj.js +0 -1
  293. package/dist/chunks/dist-es-BIjDeceU.js +0 -1
  294. package/dist/chunks/dist-es-C-OjW2Ao.js +0 -1
  295. package/dist/chunks/dist-es-CEk66gUu.js +0 -1
  296. package/dist/chunks/dist-es-CIULjvtA2.js +0 -1
  297. package/dist/chunks/dist-es-CMtO44xC.js +0 -1
  298. package/dist/chunks/dist-es-CYPVg66r.js +0 -9
  299. package/dist/chunks/dist-es-D1Y8zSMI.js +0 -1
  300. package/dist/chunks/dist-es-Gt_DpXlP.js +0 -1
  301. package/dist/chunks/dist-es-kj-F5A132.js +0 -1
  302. package/dist/chunks/doctor-DWvioSU9.js +0 -1
  303. package/dist/chunks/esm-BQY8jJNR.js +0 -1
  304. package/dist/chunks/exit-BxC_ZEtO.js +0 -1
  305. package/dist/chunks/extraUsage-DYm33Occ.js +0 -1
  306. package/dist/chunks/extractMemories-CzN3Ax2B.js +0 -1
  307. package/dist/chunks/fast-DqUpl_Lr.js +0 -1
  308. package/dist/chunks/fast-NUdUyAaM.js +0 -1
  309. package/dist/chunks/fetchModelList-CqsTAWEN.js +0 -1
  310. package/dist/chunks/fetchModelList-DBMHE6Ng.js +0 -1
  311. package/dist/chunks/firstPartyEventLogger-C0q45h_4.js +0 -3
  312. package/dist/chunks/firstPartyEventLogger-CP8hCBDj.js +0 -1
  313. package/dist/chunks/generateSessionName-ChvKBVxB.js +0 -1
  314. package/dist/chunks/goal-ByyimpVU.js +0 -3
  315. package/dist/chunks/grok-DenjixMl.js +0 -1
  316. package/dist/chunks/grove-Dq8QbQ9o.js +0 -7
  317. package/dist/chunks/history-CNQNd6hT.js +0 -1
  318. package/dist/chunks/hooks-BaYwmkxD.js +0 -1
  319. package/dist/chunks/instrumentation-BwVyvRfY.js +0 -21
  320. package/dist/chunks/keybindings-wNxBzDVQ.js +0 -1
  321. package/dist/chunks/launchOnboarding-CDjQ64RO.js +0 -8
  322. package/dist/chunks/loadAgentsDir-DKXap_Om.js +0 -1
  323. package/dist/chunks/loadPluginHooks-DtmHtEiS.js +0 -1
  324. package/dist/chunks/localSearch-BB9x5C2N.js +0 -1
  325. package/dist/chunks/logoUtils-Dj_2SWmO.js +0 -1
  326. package/dist/chunks/main-BRg8L_aw.js +0 -346
  327. package/dist/chunks/managedEnv-DsqAYOJ4.js +0 -1
  328. package/dist/chunks/managedEnv-lybrMred.js +0 -1
  329. package/dist/chunks/mcp-Bsw3cMiJ.js +0 -6
  330. package/dist/chunks/mcp-DDdud6Y7.js +0 -1
  331. package/dist/chunks/mcp-DbgTDUt7.js +0 -2
  332. package/dist/chunks/memory-CzwTzihf.js +0 -1
  333. package/dist/chunks/model-BYfmXKHf.js +0 -1
  334. package/dist/chunks/model-BwBE0Pt5.js +0 -1
  335. package/dist/chunks/modelOptions-DvNBapgG.js +0 -1
  336. package/dist/chunks/nativeInstaller-DnSNJWIi.js +0 -1
  337. package/dist/chunks/notifications-B0DTaYoy.js +0 -1
  338. package/dist/chunks/omit-Dl1Us_PY.js +0 -1
  339. package/dist/chunks/onChangeAppState-4KOJMN82.js +0 -1
  340. package/dist/chunks/openai-C_6C1_0N.js +0 -10
  341. package/dist/chunks/parser-BKAVMTyD.js +0 -1
  342. package/dist/chunks/partition-B504IgAa.js +0 -1
  343. package/dist/chunks/permissions-CLFMhdRk.js +0 -3
  344. package/dist/chunks/pidLock-D9do1Afy.js +0 -3
  345. package/dist/chunks/plugin-BYdF7uob.js +0 -17
  346. package/dist/chunks/pluginBlocklist-DKKmOnWM.js +0 -1
  347. package/dist/chunks/pluginCliCommands-z8TtJMKH.js +0 -1
  348. package/dist/chunks/pluginOperations-BcfJCDco.js +0 -2
  349. package/dist/chunks/pluginStartupCheck-Cq4PvULa.js +0 -1
  350. package/dist/chunks/plugins-CTM8jpOw.js +0 -4
  351. package/dist/chunks/policyLimits-a7ix6GnU.js +0 -1
  352. package/dist/chunks/poorMode-C11JEH3d.js +0 -1
  353. package/dist/chunks/print-u6MzL5Cr.js +0 -13
  354. package/dist/chunks/processBashCommand-DIwrI2QC.js +0 -1
  355. package/dist/chunks/processSlashCommand-B-Gujpxm.js +0 -5
  356. package/dist/chunks/prompt-BPJDGlx5.js +0 -1
  357. package/dist/chunks/prompt-DEdZzkEz.js +0 -1
  358. package/dist/chunks/reconciler-DSKLuOS7.js +0 -1
  359. package/dist/chunks/refresh-BbZFCNpn.js +0 -1
  360. package/dist/chunks/rename-DOtCOtEr.js +0 -1
  361. package/dist/chunks/resume-BB4T4WIV.js +0 -2
  362. package/dist/chunks/ripgrep-CZ2CqaHb.js +0 -1
  363. package/dist/chunks/sandbox-adapter-DhJJ6WOV.js +0 -1
  364. package/dist/chunks/searchExtraTools-CdJghGkj.js +0 -1
  365. package/dist/chunks/sessionFileAccessHooks-D7KbWFp7.js +0 -1
  366. package/dist/chunks/sessionObserver-DB-sLv-X.js +0 -1
  367. package/dist/chunks/sessionStorage-sgOAbDn7.js +0 -1
  368. package/dist/chunks/sessionTracing-yBre24PH.js +0 -11
  369. package/dist/chunks/settings-C-KNkvsM.js +0 -1
  370. package/dist/chunks/settings-DKN4xSpQ.js +0 -24
  371. package/dist/chunks/setup-CN_Pk7AR.js +0 -3
  372. package/dist/chunks/sinks-BS17vtN0.js +0 -1
  373. package/dist/chunks/sinks-D1EjkHb4.js +0 -1
  374. package/dist/chunks/skillChangeDetector-CBKuGuEi.js +0 -1
  375. package/dist/chunks/startupProfiler-B_U4QDtf.js +0 -1
  376. package/dist/chunks/state-BowF111d.js +0 -1
  377. package/dist/chunks/state-CGuyDES7.js +0 -1
  378. package/dist/chunks/status-BurdTfyz.js +0 -2
  379. package/dist/chunks/status-DMq1An5h.js +0 -1
  380. package/dist/chunks/statusNoticeHelpers-X75JNlx5.js +0 -1
  381. package/dist/chunks/sts-C2Gf2WYN.js +0 -1
  382. package/dist/chunks/switcher-DGD4ORVf.js +0 -1
  383. package/dist/chunks/tipRegistry-CyRXWWTz.js +0 -2
  384. package/dist/chunks/toolPool-CnrZcprA.js +0 -1
  385. package/dist/chunks/udsClient-ftP0yIpe.js +0 -1
  386. package/dist/chunks/useMainLoopModel-DWscpA9I.js +0 -1
  387. package/dist/chunks/useManagePlugins-CYXVcql2.js +0 -1
  388. package/dist/chunks/useMergedTools-DarmnCEw.js +0 -1
  389. package/dist/chunks/useSettingsErrors-DutJBiKZ.js +0 -1
  390. package/dist/chunks/validatePlugin-DIdEydz_.js +0 -1
  391. package/dist/chunks/vim-D8prM2IH.js +0 -1
  392. package/dist/chunks/worktree-Caqt2WRZ.js +0 -1
  393. /package/dist/chunks/{dist-es-Cgsa8pb82.js → dist-es-Cgsa8pb8.js} +0 -0
  394. /package/dist/chunks/{dist-es-Cwru7c2B2.js → dist-es-Cwru7c2B.js} +0 -0
  395. /package/dist/chunks/{dist-es-DXIR5NLi2.js → dist-es-DXIR5NLi.js} +0 -0
@@ -0,0 +1,101 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DfkgIdYf.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$y as o,Ad as s,Au as c,Cl as l,Dd as u,Ec as d,El as f,Fw as p,Gf as m,Ip as h,Iw as g,Kf as _,Lf as ee,Ll as v,Lp as te,Md as y,Mh as ne,Mu as re,Nd as ie,Nh as ae,Od as oe,Of as se,Pd as ce,Pw as le,Q as ue,Qy as de,RC as fe,Rd as pe,Rf as me,Rl as he,Tc as ge,Tl as _e,Uf as ve,Vd as ye,Wf as be,X as xe,Xf as Se,Yi as Ce,Zf as we,_v as Te,aC as Ee,ay as De,c as Oe,cd as ke,da as Ae,et as je,gv as Me,iy as Ne,jd as Pe,ju as Fe,kd as Ie,kf as Le,ku as Re,l as ze,mb as b,md as x,nt as Be,ny as Ve,o as He,oy as Ue,pS as We,pd as S,qg as Ge,r as Ke,ry as qe,s as Je,t as Ye,ty as Xe,ud as Ze,wl as Qe,zC as $e,zd as et,zp as tt}from"./loadAgentsDir-B0Anodo0.js";import{C as nt,D as C,I as w,P as T,T as E,Wt as D,ai as O,di as rt,fi as it,t as k,y as at}from"./src-DL3w8VPk.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{n as ot,t as st}from"./cwd-Pa83R95t.js";import{H as ct,I as lt,N as ut,S as dt,V as ft,Y as pt,x as mt}from"./debug-Bglx1aTu.js";import{Hn as ht,Qt as gt,Vn as _t,Xt as vt,Z as yt,it as bt,ln as xt,q as St,rt as Ct,sn as wt}from"./settings-B2jvL8Dp.js";import{A as Tt,O as Et}from"./config-C-Y2qtB2.js";import{o as Dt,s as Ot}from"./log-D2TIwHBV.js";import{l as kt,n as At,o as jt}from"./stringUtils-C718f5ey.js";import{n as Mt,r as Nt}from"./analytics-DJobLaWP.js";import{S as Pt,_ as Ft}from"./startupProfiler-CJdr3SxP.js";import{_n as It,vn as Lt}from"./prompt-CJ1l3XXk.js";import{a as Rt,i as zt,n as Bt,o as Vt,r as Ht,t as Ut}from"./agentDisplay-M4pfwbMC.js";import{n as Wt,t as Gt}from"./TextInput-B8ruWRf2.js";import{n as Kt,t as qt}from"./useExitOnCtrlCDWithKeybindings-BKwzUpgb.js";import{n as Jt,t as Yt}from"./select-DIxfl_VN.js";import{r as Xt,t as Zt}from"./Spinner-ByQXTvAA.js";import{n as Qt,t as $t}from"./useMergedTools-CCgnBJzO.js";import{n as en,r as tn,t as nn}from"./promptEditor-DoGHJN_W.js";import{n as rn,t as an}from"./useMainLoopModel-DxvV70Ru.js";import{join as j}from"path";import{mkdir as on,open as sn,unlink as cn}from"fs/promises";var M,ln=e((()=>{M={FOLDER_NAME:`.workmate`,AGENTS_DIR:`agents`}}));function un(e,t,n,r,i,a,o){return`---
2
+ name: ${e}
3
+ description: "${t.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\n/g,`\\\\n`)}"${n===void 0||n.length===1&&n[0]===`*`?``:`\ntools: ${n.join(`, `)}`}${a?`\nmodel: ${a}`:``}${i?`\ncolor: ${i}`:``}${o?`\nmemory: ${o}`:``}
4
+ ---
5
+
6
+ ${r}
7
+ `}function dn(e){switch(e){case`flagSettings`:throw Error(`Cannot get directory path for ${e} agents`);case`userSettings`:return j(n(),M.AGENTS_DIR);case`projectSettings`:return j(st(),M.FOLDER_NAME,M.AGENTS_DIR);case`policySettings`:return j(vt(),M.FOLDER_NAME,M.AGENTS_DIR);case`localSettings`:return j(st(),M.FOLDER_NAME,M.AGENTS_DIR)}}function fn(e){switch(e){case`projectSettings`:return j(`.`,M.FOLDER_NAME,M.AGENTS_DIR);default:return dn(e)}}function pn(e){return j(dn(e.source),`${e.agentType}.md`)}function mn(e){if(e.source===`built-in`)return`Built-in`;if(e.source===`plugin`)throw Error(`Cannot get file path for plugin agents`);return j(dn(e.source),`${e.filename||e.agentType}.md`)}function hn(e){return e.source===`built-in`?`Built-in`:j(fn(e.source),`${e.agentType}.md`)}function gn(e){return Je(e)?`Built-in`:ze(e)?`Plugin: ${e.plugin||`Unknown`}`:e.source===`flagSettings`?`CLI argument`:j(fn(e.source),`${e.filename||e.agentType}.md`)}async function _n(e){let t=dn(e);return await on(t,{recursive:!0}),t}async function vn(e,t,n,r,i,a=!0,o,s,c){if(e===`built-in`)throw Error(`Cannot save built-in agents`);await _n(e);let l=pn({source:e,agentType:t}),u=un(t,n,r,i,o,s,c);try{await xn(l,u,a?`wx`:`w`)}catch(e){throw ut(e)===`EEXIST`?Error(`Agent file already exists: ${l}`):e}}async function yn(e,t,n,r,i,a,o){if(e.source===`built-in`)throw Error(`Cannot update built-in agents`);await xn(mn(e),un(e.agentType,t,n,r,i,a,o))}async function bn(e){if(e.source===`built-in`)throw Error(`Cannot delete built-in agents`);let t=mn(e);try{await cn(t)}catch(e){if(ut(e)!==`ENOENT`)throw e}}async function xn(e,t,n=`w`){let r=await sn(e,n);try{await r.writeFile(t,{encoding:`utf-8`}),await r.datasync()}finally{await r.close()}}var Sn=e((()=>{gt(),He(),ot(),r(),lt(),ln()}));function Cn({agent:e,tools:t,onBack:n}){let r=Ie(e,t,!1),i=gn(e),o=y(e.agentType);D(`confirm:no`,n,{context:`Confirmation`});let s=e=>{e.key===`return`&&(e.preventDefault(),n())};function c(){return r.hasWildcard?(0,N.jsx)(T,{children:`All tools`}):!e.tools||e.tools.length===0?(0,N.jsx)(T,{children:`None`}):(0,N.jsxs)(N.Fragment,{children:[r.validTools.length>0&&(0,N.jsx)(T,{children:r.validTools.join(`, `)}),r.invalidTools.length>0&&(0,N.jsxs)(T,{color:`warning`,children:[a.warning,` Unrecognized: `,r.invalidTools.join(`, `)]})]})}return(0,N.jsxs)(w,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:s,children:[(0,N.jsx)(T,{dimColor:!0,children:i}),(0,N.jsxs)(w,{flexDirection:`column`,children:[(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Description`}),` (tells Work Mate when to use this agent):`]}),(0,N.jsx)(w,{marginLeft:2,children:(0,N.jsx)(T,{children:e.whenToUse})})]}),(0,N.jsxs)(w,{children:[(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Tools`}),`:`,` `]}),c()]}),(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Model`}),`: `,pe(e.model)]}),e.permissionMode&&(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Permission mode`}),`: `,e.permissionMode]}),e.memory&&(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Memory`}),`: `,le(e.memory)]}),e.hooks&&Object.keys(e.hooks).length>0&&(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Hooks`}),`: `,Object.keys(e.hooks).join(`, `)]}),e.skills&&e.skills.length>0&&(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Skills`}),`:`,` `,e.skills.length>10?`${e.skills.length} skills`:e.skills.join(`, `)]}),o&&(0,N.jsx)(w,{children:(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Color`}),`:`,` `,(0,N.jsxs)(T,{backgroundColor:o,color:`inverseText`,children:[` `,e.agentType,` `]})]})}),!Je(e)&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(w,{children:(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`System prompt`}),`:`]})}),(0,N.jsx)(w,{marginLeft:2,marginRight:2,children:(0,N.jsx)(ke,{children:e.getSystemPrompt()})})]})]})}var N,wn=e((()=>{i(),k(),b(),ie(),p(),oe(),He(),ye(),Ze(),Sn(),N=A()}));function Tn({agentName:e,currentColor:t=`automatic`,onConfirm:n}){let[r,i]=(0,En.useState)(Math.max(0,Dn.indexOf(t))),o=e=>{if(e.key===`up`)e.preventDefault(),i(e=>e>0?e-1:Dn.length-1);else if(e.key===`down`)e.preventDefault(),i(e=>e<Dn.length-1?e+1:0);else if(e.key===`return`){e.preventDefault();let t=Dn[r];n(t===`automatic`?void 0:t)}},s=Dn[r];return(0,P.jsxs)(w,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:o,children:[(0,P.jsx)(w,{flexDirection:`column`,children:Dn.map((e,t)=>{let n=t===r;return(0,P.jsxs)(w,{flexDirection:`row`,gap:1,children:[(0,P.jsx)(T,{color:n?`suggestion`:void 0,children:n?a.pointer:` `}),e===`automatic`?(0,P.jsx)(T,{bold:n,children:`Automatic color`}):(0,P.jsxs)(w,{gap:1,children:[(0,P.jsx)(T,{backgroundColor:Pe[e],color:`inverseText`,children:` `}),(0,P.jsx)(T,{bold:n,children:At(e)})]})]},e)})}),(0,P.jsxs)(w,{marginTop:1,children:[(0,P.jsx)(T,{children:`Preview: `}),s===void 0||s===`automatic`?(0,P.jsxs)(T,{inverse:!0,bold:!0,children:[` `,`@`,e,` `]}):(0,P.jsxs)(T,{backgroundColor:Pe[s],color:`inverseText`,bold:!0,children:[` `,`@`,e,` `]})]})]})}var En,P,Dn,On=e((()=>{i(),En=t(O(),1),k(),ie(),jt(),P=A(),Dn=[`automatic`,...s]}));function kn({initialModel:e,onComplete:t,onCancel:n}){let r=An.useMemo(()=>{let t=et();return e&&!t.some(t=>t.value===e)?[{value:e,label:e,description:`Current model (custom ID)`},...t]:t},[e]);return(0,jn.jsxs)(w,{flexDirection:`column`,children:[(0,jn.jsx)(w,{marginBottom:1,children:(0,jn.jsx)(T,{dimColor:!0,children:`Model determines the agent's reasoning capabilities and speed.`})}),(0,jn.jsx)(Yt,{options:r,defaultValue:e??`sonnet`,onChange:t,onCancel:()=>n?n():t(void 0)})]})}var An,jn,Mn=e((()=>{An=t(O(),1),k(),ye(),Jt(),jn=A()}));function Nn(){return{READ_ONLY:{name:`Read-only tools`,toolNames:new Set([ve.name,m.name,l.name,de.name,ee.name,v.name,_e.name,De.name,qe.name])},EDIT:{name:`Edit tools`,toolNames:new Set([Fe.name,Se.name,Re.name])},EXECUTION:{name:`Execution tools`,toolNames:new Set([se.name])},MCP:{name:`MCP tools`,toolNames:new Set,isMcp:!0},OTHER:{name:`Other tools`,toolNames:new Set}}}function Pn(e){let t=new Map;return e.forEach(e=>{if(Te(e)){let n=bt(e.name);if(n?.serverName){let r=t.get(n.serverName)||[];r.push(e),t.set(n.serverName,r)}}}),Array.from(t.entries()).map(([e,t])=>({serverName:e,tools:t})).sort((e,t)=>e.serverName.localeCompare(t.serverName))}function Fn({tools:e,initialTools:t,onComplete:n,onCancel:r}){let i=(0,F.useMemo)(()=>u({tools:e,isBuiltIn:!1,isAsync:!1}),[e]),[o,s]=(0,F.useState)(!t||t.includes(`*`)?i.map(e=>e.name):t),[c,l]=(0,F.useState)(0),[d,f]=(0,F.useState)(!1),p=(0,F.useMemo)(()=>{let e=new Set(i.map(e=>e.name));return o.filter(t=>e.has(t))},[o,i]),m=new Set(p),h=p.length===i.length&&i.length>0,g=e=>{e&&s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},_=(e,t)=>{s(n=>{if(t){let t=e.filter(e=>!n.includes(e));return[...n,...t]}else return n.filter(t=>!e.includes(t))})},ee=()=>{let e=i.map(e=>e.name);n(p.length===e.length&&e.every(e=>p.includes(e))?void 0:p)},v=(0,F.useMemo)(()=>{let e=Nn(),t={readOnly:[],edit:[],execution:[],mcp:[],other:[]};return i.forEach(n=>{Te(n)?t.mcp.push(n):e.READ_ONLY.toolNames.has(n.name)?t.readOnly.push(n):e.EDIT.toolNames.has(n.name)?t.edit.push(n):e.EXECUTION.toolNames.has(n.name)?t.execution.push(n):n.name!==`Agent`&&t.other.push(n)}),t},[i]),te=e=>{let t=_t(e,e=>m.has(e.name))<e.length;return()=>{let n=e.map(e=>e.name);_(n,t)}},y=[];y.push({id:`continue`,label:`Continue`,action:ee,isContinue:!0}),y.push({id:`bucket-all`,label:`${h?a.checkboxOn:a.checkboxOff} All tools`,action:()=>{let e=i.map(e=>e.name);_(e,!h)}});let ne=Nn();[{id:`bucket-readonly`,name:ne.READ_ONLY.name,tools:v.readOnly},{id:`bucket-edit`,name:ne.EDIT.name,tools:v.edit},{id:`bucket-execution`,name:ne.EXECUTION.name,tools:v.execution},{id:`bucket-mcp`,name:ne.MCP.name,tools:v.mcp},{id:`bucket-other`,name:ne.OTHER.name,tools:v.other}].forEach(({id:e,name:t,tools:n})=>{if(n.length===0)return;let r=_t(n,e=>m.has(e.name))===n.length;y.push({id:e,label:`${r?a.checkboxOn:a.checkboxOff} ${t}`,action:te(n)})});let re=y.length;y.push({id:`toggle-individual`,label:d?`Hide advanced options`:`Show advanced options`,action:()=>{f(!d),d&&c>re&&l(re)},isToggle:!0});let ie=(0,F.useMemo)(()=>Pn(i),[i]);return d&&(ie.length>0&&(y.push({id:`mcp-servers-header`,label:`MCP Servers:`,action:()=>{},isHeader:!0}),ie.forEach(({serverName:e,tools:t})=>{let n=_t(t,e=>m.has(e.name))===t.length;y.push({id:`mcp-server-${e}`,label:`${n?a.checkboxOn:a.checkboxOff} ${e} (${t.length} ${kt(t.length,`tool`)})`,action:()=>{let e=t.map(e=>e.name);_(e,!n)}})}),y.push({id:`tools-header`,label:`Individual Tools:`,action:()=>{},isHeader:!0})),i.forEach(e=>{let t=e.name;if(e.name.startsWith(`mcp__`)){let n=bt(e.name);t=n?`${n.toolName} (${n.serverName})`:e.name}y.push({id:`tool-${e.name}`,label:`${m.has(e.name)?a.checkboxOn:a.checkboxOff} ${t}`,action:()=>g(e.name)})})),D(`confirm:no`,(0,F.useCallback)(()=>{r?r():n(t)},[r,n,t]),{context:`Confirmation`}),(0,I.jsxs)(w,{flexDirection:`column`,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(e.key===`return`){e.preventDefault();let t=y[c];t&&!t.isHeader&&t.action()}else if(e.key===`up`){e.preventDefault();let t=c-1;for(;t>0&&y[t]?.isHeader;)t--;l(Math.max(0,t))}else if(e.key===`down`){e.preventDefault();let t=c+1;for(;t<y.length-1&&y[t]?.isHeader;)t++;l(Math.min(y.length-1,t))}},children:[(0,I.jsxs)(T,{color:c===0?`suggestion`:void 0,bold:c===0,children:[c===0?`${a.pointer} `:` `,`[ Continue ]`]}),(0,I.jsx)(nt,{width:40}),y.slice(1).map((e,t)=>{let n=t+1===c,r=e.isToggle,i=e.isHeader;return(0,I.jsxs)(F.Fragment,{children:[r&&(0,I.jsx)(nt,{width:40}),i&&t>0&&(0,I.jsx)(w,{marginTop:1}),(0,I.jsxs)(T,{color:i?void 0:n?`suggestion`:void 0,dimColor:i,bold:r&&n,children:[i?``:n?`${a.pointer} `:` `,r?`[ ${e.label} ]`:e.label]})]},e.id)}),(0,I.jsx)(w,{marginTop:1,flexDirection:`column`,children:(0,I.jsx)(T,{dimColor:!0,children:h?`All tools selected`:`${m.size} of ${i.length} tools selected`})})]})}var F,I,In=e((()=>{i(),F=t(O(),1),Ct(),Me(),oe(),yt(),Le(),Qe(),re(),o(),we(),be(),_(),Ue(),c(),Ne(),f(),he(),me(),k(),b(),ht(),jt(),I=A()}));function Ln(e){return e===`all`?`Agents`:e===`built-in`?`Built-in agents`:e===`plugin`?`Plugin agents`:fe(wt(e))}var Rn=e((()=>{$e(),xt()}));function zn({agent:e,tools:t,onSaved:n,onBack:r}){let i=tt(),[o,s]=(0,L.useState)(`menu`),[c,l]=(0,L.useState)(0),[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(e.color),m=(0,L.useCallback)(async()=>{let t=await nn(mn(e));t.error?d(t.error):n(`Opened ${e.agentType} in editor. If you made edits, restart to load the latest version.`)},[e,n]),h=(0,L.useCallback)(async(t={})=>{let{tools:r,color:a,model:o}=t,s=a??f,c=r!==void 0,l=o!==void 0,u=s!==e.color;if(!c&&!l&&!u)return!1;try{return!Oe(e)&&!ze(e)?!1:(await yn(e,e.whenToUse,r??e.tools,e.getSystemPrompt(),s,o??e.model),u&&s&&ce(e.agentType,s),i(t=>{let n=t.agentDefinitions.allAgents.map(t=>t.agentType===e.agentType?{...t,tools:r??t.tools,color:s,model:o??t.model}:t);return{...t,agentDefinitions:{...t.agentDefinitions,activeAgents:Ke(n),allAgents:n}}}),n(`Updated agent: ${rt.bold(e.agentType)}`),!0)}catch(e){return d(e instanceof Error?e.message:`Failed to save agent`),!1}},[e,f,n,i]),g=(0,L.useMemo)(()=>[{label:`Open in editor`,action:m},{label:`Edit tools`,action:()=>s(`edit-tools`)},{label:`Edit model`,action:()=>s(`edit-model`)},{label:`Edit color`,action:()=>s(`edit-color`)}],[m]),_=(0,L.useCallback)(()=>{d(null),o===`menu`?r():s(`menu`)},[o,r]),ee=(0,L.useCallback)(e=>{if(e.key===`up`)e.preventDefault(),l(e=>Math.max(0,e-1));else if(e.key===`down`)e.preventDefault(),l(e=>Math.min(g.length-1,e+1));else if(e.key===`return`){e.preventDefault();let t=g[c];t&&t.action()}},[g,c]);D(`confirm:no`,_,{context:`Confirmation`});let v=()=>(0,R.jsxs)(w,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:ee,children:[(0,R.jsxs)(T,{dimColor:!0,children:[`Source: `,Ln(e.source)]}),(0,R.jsx)(w,{marginTop:1,flexDirection:`column`,children:g.map((e,t)=>(0,R.jsxs)(T,{color:t===c?`suggestion`:void 0,children:[t===c?`${a.pointer} `:` `,e.label]},e.label))}),u&&(0,R.jsx)(w,{marginTop:1,children:(0,R.jsx)(T,{color:`error`,children:u})})]});switch(o){case`menu`:return v();case`edit-tools`:return(0,R.jsx)(Fn,{tools:t,initialTools:e.tools,onComplete:async e=>{s(`menu`),await h({tools:e})}});case`edit-color`:return(0,R.jsx)(Tn,{agentName:e.agentType,currentColor:f||e.color||`automatic`,onConfirm:async e=>{p(e),s(`menu`),await h({color:e})}});case`edit-model`:return(0,R.jsx)(kn,{initialModel:e.model,onComplete:async e=>{s(`menu`),await h({model:e})}});default:return null}}var L,R,Bn=e((()=>{it(),i(),L=t(O(),1),h(),k(),b(),ie(),He(),tn(),Sn(),On(),Mn(),In(),Rn(),R=A()}));function Vn({instructions:e=`Press ↑↓ to navigate · Enter to select · Esc to go back`}){let t=Kt();return(0,Hn.jsx)(w,{marginLeft:2,children:(0,Hn.jsx)(T,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var Hn,Un=e((()=>{qt(),k(),Hn=A()}));function Wn({source:e,agents:t,onBack:n,onSelect:r,onCreateNew:i,changes:o}){let[s,c]=Gn.useState(null),[l,u]=Gn.useState(!0),d=Gn.useMemo(()=>[...t].sort(Bt),[t]),f=e=>({isOverridden:!!e.overriddenBy,overriddenBy:e.overriddenBy||null}),p=()=>(0,z.jsxs)(w,{children:[(0,z.jsx)(T,{color:l?`suggestion`:void 0,children:l?`${a.pointer} `:` `}),(0,z.jsx)(T,{color:l?`suggestion`:void 0,children:`Create new agent`})]}),m=e=>{let t=e.source===`built-in`,n=!t&&!l&&s?.agentType===e.agentType&&s?.source===e.source,{isOverridden:r,overriddenBy:i}=f(e),o=t||r,c=!t&&n?`suggestion`:void 0,u=Rt(e);return(0,z.jsxs)(w,{children:[(0,z.jsx)(T,{dimColor:o&&!n,color:c,children:t?``:n?`${a.pointer} `:` `}),(0,z.jsx)(T,{dimColor:o&&!n,color:c,children:e.agentType}),u&&(0,z.jsxs)(T,{dimColor:!0,color:c,children:[` · `,u]}),e.memory&&(0,z.jsxs)(T,{dimColor:!0,color:c,children:[` · `,e.memory,` memory`]}),i&&(0,z.jsxs)(T,{dimColor:!n,color:n?`warning`:void 0,children:[` `,a.warning,` shadowed by `,Ht(i)]})]},`${e.agentType}-${e.source}`)},h=Gn.useMemo(()=>{let t=d.filter(e=>e.source!==`built-in`);return e===`all`?Ut.filter(e=>e.source!==`built-in`).flatMap(({source:e})=>t.filter(t=>t.source===e)):t},[d,e]);Gn.useEffect(()=>{!s&&!l&&h.length>0&&(i?u(!0):c(h[0]||null))},[h,s,l,i]);let g=e=>{if(e.key===`return`){e.preventDefault(),l&&i?i():s&&r(s);return}if(e.key!==`up`&&e.key!==`down`)return;e.preventDefault();let t=!!i,n=h.length+ +!!t;if(n===0)return;let a=0;if(!l&&s){let e=h.findIndex(e=>e.agentType===s.agentType&&e.source===s.source);e>=0&&(a=t?e+1:e)}let o=e.key===`up`?a===0?n-1:a-1:a===n-1?0:a+1;if(t&&o===0)u(!0),c(null);else{let e=t?o-1:o,n=h[e];n&&(u(!1),c(n))}},_=(e=`Built-in (always available):`)=>{let t=d.filter(e=>e.source===`built-in`);return(0,z.jsxs)(w,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,z.jsx)(T,{bold:!0,dimColor:!0,children:e}),t.map(m)]})},ee=(e,t)=>{if(!t.length)return null;let n=t[0]?.baseDir;return(0,z.jsxs)(w,{flexDirection:`column`,marginBottom:1,children:[(0,z.jsxs)(w,{paddingLeft:2,children:[(0,z.jsx)(T,{bold:!0,dimColor:!0,children:e}),n&&(0,z.jsxs)(T,{dimColor:!0,children:[` (`,n,`)`]})]}),t.map(e=>m(e))]})},v=Ln(e),te=d.filter(e=>e.source===`built-in`);return!d.length||e!==`built-in`&&!d.some(e=>e.source!==`built-in`)?(0,z.jsx)(at,{title:v,subtitle:`No agents found`,onCancel:n,hideInputGuide:!0,children:(0,z.jsxs)(w,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:g,children:[i&&(0,z.jsx)(w,{children:p()}),(0,z.jsx)(T,{dimColor:!0,children:`No agents found. Create specialized subagents that Work Mate can delegate to.`}),(0,z.jsx)(T,{dimColor:!0,children:`Each subagent has its own context window, custom system prompt, and specific tools.`}),(0,z.jsx)(T,{dimColor:!0,children:`Try creating: Code Reviewer, Code Simplifier, Security Reviewer, Tech Lead, or UX Reviewer.`}),e!==`built-in`&&d.some(e=>e.source===`built-in`)&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(nt,{}),_()]})]})}):(0,z.jsxs)(at,{title:v,subtitle:`${_t(d,e=>!e.overriddenBy)} agents`,onCancel:n,hideInputGuide:!0,children:[o&&o.length>0&&(0,z.jsx)(w,{marginTop:1,children:(0,z.jsx)(T,{dimColor:!0,children:o[o.length-1]})}),(0,z.jsxs)(w,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:g,children:[i&&(0,z.jsx)(w,{marginBottom:1,children:p()}),e===`all`?(0,z.jsxs)(z.Fragment,{children:[Ut.filter(e=>e.source!==`built-in`).map(({label:e,source:t})=>(0,z.jsx)(Gn.Fragment,{children:ee(e,d.filter(e=>e.source===t))},t)),te.length>0&&(0,z.jsxs)(w,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,z.jsxs)(T,{dimColor:!0,children:[(0,z.jsx)(T,{bold:!0,children:`Built-in agents`}),` (always available)`]}),te.map(m)]})]}):e===`built-in`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(T,{dimColor:!0,italic:!0,children:`Built-in agents are provided by default and cannot be modified.`}),(0,z.jsx)(w,{marginTop:1,flexDirection:`column`,children:d.map(e=>m(e))})]}):(0,z.jsxs)(z.Fragment,{children:[d.filter(e=>e.source!==`built-in`).map(e=>m(e)),d.some(e=>e.source===`built-in`)&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(nt,{}),_()]})]})]})]})}var Gn,z,Kn=e((()=>{i(),Gn=t(O(),1),k(),zt(),ht(),Rn(),z=A()}));function qn({steps:e,initialData:t={},onComplete:n,onCancel:r,children:i,title:a,showStepCounter:o=!0}){let[s,c]=(0,B.useState)(0),[l,u]=(0,B.useState)(t),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)([]);Kt(),(0,B.useEffect)(()=>{d&&(m([]),n(l))},[d,l,n]);let h=(0,B.useCallback)(()=>{s<e.length-1?(p.length>0&&m(e=>[...e,s]),c(e=>e+1)):f(!0)},[s,e.length,p]),g=(0,B.useCallback)(()=>{if(p.length>0){let e=p[p.length-1];e!==void 0&&(m(e=>e.slice(0,-1)),c(e))}else s>0?c(e=>e-1):r&&r()},[s,p,r]),_=(0,B.useCallback)(t=>{t>=0&&t<e.length&&(m(e=>[...e,s]),c(t))},[s,e.length]),ee=(0,B.useCallback)(()=>{m([]),r&&r()},[r]),v=(0,B.useCallback)(e=>{u(t=>({...t,...e}))},[]),te=(0,B.useMemo)(()=>({currentStepIndex:s,totalSteps:e.length,wizardData:l,setWizardData:u,updateWizardData:v,goNext:h,goBack:g,goToStep:_,cancel:ee,title:a,showStepCounter:o}),[s,e.length,l,v,h,g,_,ee,a,o]),y=e[s];return!y||d?null:(0,Jn.jsx)(Yn.Provider,{value:te,children:i||(0,Jn.jsx)(y,{})})}var B,Jn,Yn,Xn=e((()=>{B=t(O(),1),qt(),Jn=A(),Yn=(0,B.createContext)(null)}));function V(){let e=(0,Zn.useContext)(Yn);if(!e)throw Error(`useWizard must be used within a WizardProvider`);return e}var Zn,Qn=e((()=>{Zn=t(O(),1),Xn()}));function $n({instructions:e=(0,er.jsxs)(E,{children:[(0,er.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,er.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,er.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})}){let t=Kt();return(0,er.jsx)(w,{marginLeft:3,marginTop:1,children:(0,er.jsx)(T,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var er,tr=e((()=>{qt(),k(),x(),er=A()}));function H({title:e,color:t=`suggestion`,children:n,subtitle:r,footerText:i}){let{currentStepIndex:a,totalSteps:o,title:s,showStepCounter:c,goBack:l}=V();return(0,nr.jsxs)(nr.Fragment,{children:[(0,nr.jsx)(at,{title:`${e||s||`Wizard`}${c===!1?``:` (${a+1}/${o})`}`,subtitle:r,onCancel:l,color:t,hideInputGuide:!0,isCancelActive:!1,children:n}),(0,nr.jsx)($n,{instructions:i})]})}var nr,U=e((()=>{k(),Qn(),tr(),nr=A()})),W=e((()=>{Qn(),U(),tr(),Xn()}));function rr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=V();return D(`confirm:no`,t,{context:`Confirmation`}),(0,G.jsx)(H,{subtitle:`Choose background color`,footerText:(0,G.jsxs)(E,{children:[(0,G.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,G.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,G.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,G.jsx)(w,{children:(0,G.jsx)(Tn,{agentName:r.agentType||`agent`,currentColor:`automatic`,onConfirm:t=>{n({selectedColor:t,finalAgent:{agentType:r.agentType,whenToUse:r.whenToUse,getSystemPrompt:()=>r.systemPrompt,tools:r.selectedTools,...r.selectedModel?{model:r.selectedModel}:{},...t?{color:t}:{},source:r.location}}),e()}})})})}var G,ir=e((()=>{k(),b(),x(),W(),U(),On(),G=A()}));function ar(e){return e?/^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$/.test(e)?e.length<3?`Agent type must be at least 3 characters long`:e.length>50?`Agent type must be less than 50 characters`:null:`Agent type must start and end with alphanumeric characters and contain only letters, numbers, and hyphens`:`Agent type is required`}function or(e,t,n){let r=[],i=[];if(!e.agentType)r.push(`Agent type is required`);else{let t=ar(e.agentType);t&&r.push(t);let i=n.find(t=>t.agentType===e.agentType&&t.source!==e.source);i&&r.push(`Agent type "${e.agentType}" already exists in ${Ln(i.source)}`)}if(e.whenToUse?e.whenToUse.length<10?i.push(`Description should be more descriptive (at least 10 characters)`):e.whenToUse.length>5e3&&i.push(`Description is very long (over 5000 characters)`):r.push(`Description (description) is required`),e.tools!==void 0&&!Array.isArray(e.tools))r.push(`Tools must be an array`);else{e.tools===void 0?i.push(`Agent has access to all tools`):e.tools.length===0&&i.push(`No tools selected - agent will have very limited capabilities`);let n=Ie(e,t,!1);n.invalidTools.length>0&&r.push(`Invalid tools: ${n.invalidTools.join(`, `)}`)}let a=e.getSystemPrompt();return a?a.length<20?r.push(`System prompt is too short (minimum 20 characters)`):a.length>1e4&&i.push(`System prompt is very long (over 10,000 characters)`):r.push(`System prompt is required`),{isValid:r.length===0,errors:r,warnings:i}}var sr=e((()=>{oe(),Rn()}));function cr({tools:e,existingAgents:t,onSave:n,onSaveAndEdit:r,error:i}){let{goBack:a,wizardData:o}=V();D(`confirm:no`,a,{context:`Confirmation`});let s=e=>{e.key===`s`||e.key===`return`?(e.preventDefault(),n()):e.key===`e`&&(e.preventDefault(),r())},c=o.finalAgent,l=or(c,e,t),u=Pt(c.getSystemPrompt(),240),d=Pt(c.whenToUse,240),f=e=>e===void 0?`All tools`:e.length===0?`None`:e.length===1?e[0]||`None`:e.length===2?e.join(` and `):`${e.slice(0,-1).join(`, `)}, and ${e[e.length-1]}`,p=Tt()?(0,K.jsxs)(T,{children:[(0,K.jsx)(T,{bold:!0,children:`Memory`}),`: `,le(c.memory)]}):null;return(0,K.jsx)(H,{subtitle:`Confirm and save`,footerText:(0,K.jsxs)(E,{children:[(0,K.jsx)(C,{shortcut:`s/Enter`,action:`save`}),(0,K.jsx)(C,{shortcut:`e`,action:`edit in your editor`}),(0,K.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,K.jsxs)(w,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:s,children:[(0,K.jsxs)(T,{children:[(0,K.jsx)(T,{bold:!0,children:`Name`}),`: `,c.agentType]}),(0,K.jsxs)(T,{children:[(0,K.jsx)(T,{bold:!0,children:`Location`}),`:`,` `,hn({source:o.location,agentType:c.agentType})]}),(0,K.jsxs)(T,{children:[(0,K.jsx)(T,{bold:!0,children:`Tools`}),`: `,f(c.tools)]}),(0,K.jsxs)(T,{children:[(0,K.jsx)(T,{bold:!0,children:`Model`}),`: `,pe(c.model)]}),p,(0,K.jsx)(w,{marginTop:1,children:(0,K.jsxs)(T,{children:[(0,K.jsx)(T,{bold:!0,children:`Description`}),` (tells Work Mate when to use this agent):`]})}),(0,K.jsx)(w,{marginLeft:2,marginTop:1,children:(0,K.jsx)(T,{children:d})}),(0,K.jsx)(w,{marginTop:1,children:(0,K.jsxs)(T,{children:[(0,K.jsx)(T,{bold:!0,children:`System prompt`}),`:`]})}),(0,K.jsx)(w,{marginLeft:2,marginTop:1,children:(0,K.jsx)(T,{children:u})}),l.warnings.length>0&&(0,K.jsxs)(w,{marginTop:1,flexDirection:`column`,children:[(0,K.jsx)(T,{color:`warning`,children:`Warnings:`}),l.warnings.map((e,t)=>(0,K.jsxs)(T,{dimColor:!0,children:[` `,`• `,e]},t))]}),l.errors.length>0&&(0,K.jsxs)(w,{marginTop:1,flexDirection:`column`,children:[(0,K.jsx)(T,{color:`error`,children:`Errors:`}),l.errors.map((e,t)=>(0,K.jsxs)(T,{color:`error`,children:[` `,`• `,e]},t))]}),i&&(0,K.jsx)(w,{marginTop:1,children:(0,K.jsx)(T,{color:`error`,children:i})}),(0,K.jsx)(w,{marginTop:2,children:(0,K.jsxs)(T,{color:`success`,children:[`Press `,(0,K.jsx)(T,{bold:!0,children:`s`}),` or `,(0,K.jsx)(T,{bold:!0,children:`Enter`}),` to save, `,(0,K.jsx)(T,{bold:!0,children:`e`}),` to save and edit`]})})]})})}var K,lr=e((()=>{k(),b(),Et(),p(),Ft(),ye(),x(),W(),U(),Sn(),sr(),K=A()}));function ur({tools:e,existingAgents:t,onComplete:n}){let{wizardData:r}=V(),[i,a]=(0,dr.useState)(null),o=tt(),s=(0,dr.useCallback)(async e=>{if(r?.finalAgent)try{await vn(r.location,r.finalAgent.agentType,r.finalAgent.whenToUse,r.finalAgent.tools,r.finalAgent.getSystemPrompt(),!0,r.finalAgent.color,r.finalAgent.model,r.finalAgent.memory),o(e=>{if(!r.finalAgent)return e;let t=e.agentDefinitions.allAgents.concat(r.finalAgent);return{...e,agentDefinitions:{...e.agentDefinitions,activeAgents:Ke(t),allAgents:t}}}),Ye(),e&&await nn(pn({source:r.location,agentType:r.finalAgent.agentType})),Nt(`tengu_agent_created`,{agent_type:r.finalAgent.agentType,generation_method:r.wasGenerated?`generated`:`manual`,source:r.location,tool_count:r.finalAgent.tools?.length??`all`,has_custom_model:!!r.finalAgent.model,has_custom_color:!!r.finalAgent.color,has_memory:!!r.finalAgent.memory,memory_scope:r.finalAgent.memory??`none`,...e?{opened_in_editor:!0}:{}}),n(e?`Created agent: ${rt.bold(r.finalAgent.agentType)} and opened in editor. If you made edits, restart to load the latest version.`:`Created agent: ${rt.bold(r.finalAgent.agentType)}`)}catch(e){a(e instanceof Error?e.message:`Failed to save agent`)}},[r,n,o]);return(0,fr.jsx)(cr,{tools:e,existingAgents:t,onSave:(0,dr.useCallback)(()=>s(!1),[s]),onSaveAndEdit:(0,dr.useCallback)(()=>s(!0),[s]),error:i})}var dr,fr,pr=e((()=>{it(),dr=t(O(),1),Mt(),h(),He(),tn(),W(),Sn(),lr(),fr=A()}));function mr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=V(),[i,a]=(0,hr.useState)(r.whenToUse||``),[o,s]=(0,hr.useState)(i.length),[c,l]=(0,hr.useState)(null);return D(`confirm:no`,t,{context:`Settings`}),D(`chat:externalEditor`,(0,hr.useCallback)(async()=>{let e=await en(i);e.content!==null&&(a(e.content),s(e.content.length))},[i]),{context:`Chat`}),(0,q.jsx)(H,{subtitle:`Description (tell Work Mate when to use this agent)`,footerText:(0,q.jsxs)(E,{children:[(0,q.jsx)(C,{shortcut:`Type`,action:`enter text`}),(0,q.jsx)(C,{shortcut:`Enter`,action:`continue`}),(0,q.jsx)(S,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,q.jsx)(S,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,q.jsxs)(w,{flexDirection:`column`,children:[(0,q.jsx)(T,{children:`When should Work Mate use this agent?`}),(0,q.jsx)(w,{marginTop:1,children:(0,q.jsx)(Gt,{value:i,onChange:a,onSubmit:t=>{let r=t.trim();if(!r){l(`Description is required`);return}l(null),n({whenToUse:r}),e()},placeholder:`e.g., use this agent after you're done writing code...`,columns:80,cursorOffset:o,onChangeCursorOffset:s,focus:!0,showCursor:!0})}),c&&(0,q.jsx)(w,{marginTop:1,children:(0,q.jsx)(T,{color:`error`,children:c})})]})})}var hr,q,gr=e((()=>{hr=t(O(),1),k(),b(),tn(),x(),Wt(),W(),U(),q=A()}));async function _r(e,t,n,r){let i=We({content:`Create an agent configuration based on this request: "${e}".${n.length>0?`\n\nIMPORTANT: The following identifiers already exist and must NOT be used: ${n.join(`, `)}`:``}
8
+ Return ONLY the JSON object, no other text.`}),a=await ne(),o=Be([i],a),s=Tt()?vr+yr:vr,c=await ue({messages:Ae(o),systemPrompt:Ee([s]),thinkingConfig:{type:`disabled`},tools:[],signal:r,options:{getToolPermissionContext:async()=>It(),model:t,toolChoice:void 0,agents:[],isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,querySource:`agent_creation`,mcpTools:[]}}),l=(Array.isArray(c.message.content)?c.message.content:[]).filter(e=>e.type===`text`).map(e=>e.text).join(`
9
+ `),u;try{u=dt(l.trim())}catch{let e=l.match(/\{[\s\S]*\}/);if(!e)throw Error(`No JSON object found in response`);u=dt(e[0])}if(!u.identifier||!u.whenToUse||!u.systemPrompt)throw Error(`Invalid agent configuration generated`);return Nt(`tengu_agent_definition_generated`,{agent_identifier:u.identifier}),{identifier:u.identifier,whenToUse:u.whenToUse,systemPrompt:u.systemPrompt}}var vr,yr,br=e((()=>{ae(),xe(),Lt(),yt(),je(),Ce(),Et(),Mt(),mt(),Ge(),vr=`You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.
10
+
11
+ **Important Context**: You may have access to project-specific instructions from AGENTS.md files and other context that may include coding standards, project structure, and custom requirements. Consider this context when creating agents to ensure they align with the project's established patterns and practices.
12
+
13
+ When a user describes what they want an agent to do, you will:
14
+
15
+ 1. **Extract Core Intent**: Identify the fundamental purpose, key responsibilities, and success criteria for the agent. Look for both explicit requirements and implicit needs. Consider any project-specific context from AGENTS.md files. For agents that are meant to review code, you should assume that the user is asking to review recently written code and not the whole codebase, unless the user has explicitly instructed you otherwise.
16
+
17
+ 2. **Design Expert Persona**: Create a compelling expert identity that embodies deep domain knowledge relevant to the task. The persona should inspire confidence and guide the agent's decision-making approach.
18
+
19
+ 3. **Architect Comprehensive Instructions**: Develop a system prompt that:
20
+ - Establishes clear behavioral boundaries and operational parameters
21
+ - Provides specific methodologies and best practices for task execution
22
+ - Anticipates edge cases and provides guidance for handling them
23
+ - Incorporates any specific requirements or preferences mentioned by the user
24
+ - Defines output format expectations when relevant
25
+ - Aligns with project-specific coding standards and patterns from AGENTS.md
26
+
27
+ 4. **Optimize for Performance**: Include:
28
+ - Decision-making frameworks appropriate to the domain
29
+ - Quality control mechanisms and self-verification steps
30
+ - Efficient workflow patterns
31
+ - Clear escalation or fallback strategies
32
+
33
+ 5. **Create Identifier**: Design a concise, descriptive identifier that:
34
+ - Uses lowercase letters, numbers, and hyphens only
35
+ - Is typically 2-4 words joined by hyphens
36
+ - Clearly indicates the agent's primary function
37
+ - Is memorable and easy to type
38
+ - Avoids generic terms like "helper" or "assistant"
39
+
40
+ 6 **Example agent descriptions**:
41
+ - in the 'whenToUse' field of the JSON object, you should include examples of when this agent should be used.
42
+ - examples should be of the form:
43
+ - <example>
44
+ Context: The user is creating a test-runner agent that should be called after a logical chunk of code is written.
45
+ user: "Please write a function that checks if a number is prime"
46
+ assistant: "Here is the relevant function: "
47
+ <function call omitted for brevity only for this example>
48
+ <commentary>
49
+ Since a significant piece of code was written, use the ${St} tool to launch the test-runner agent to run the tests.
50
+ </commentary>
51
+ assistant: "Now let me use the test-runner agent to run the tests"
52
+ </example>
53
+ - <example>
54
+ Context: User is creating an agent to respond to the word "hello" with a friendly jok.
55
+ user: "Hello"
56
+ assistant: "I'm going to use the ${St} tool to launch the greeting-responder agent to respond with a friendly joke"
57
+ <commentary>
58
+ Since the user is greeting, use the greeting-responder agent to respond with a friendly joke.
59
+ </commentary>
60
+ </example>
61
+ - If the user mentioned or implied that the agent should be used proactively, you should include examples of this.
62
+ - NOTE: Ensure that in the examples, you are making the assistant use the Agent tool and not simply respond directly to the task.
63
+
64
+ Your output must be a valid JSON object with exactly these fields:
65
+ {
66
+ "identifier": "A unique, descriptive identifier using lowercase letters, numbers, and hyphens (e.g., 'test-runner', 'api-docs-writer', 'code-formatter')",
67
+ "whenToUse": "A precise, actionable description starting with 'Use this agent when...' that clearly defines the triggering conditions and use cases. Ensure you include examples as described above.",
68
+ "systemPrompt": "The complete system prompt that will govern the agent's behavior, written in second person ('You are...', 'You will...') and structured for maximum clarity and effectiveness"
69
+ }
70
+
71
+ Key principles for your system prompts:
72
+ - Be specific rather than generic - avoid vague instructions
73
+ - Include concrete examples when they would clarify behavior
74
+ - Balance comprehensiveness with clarity - every instruction should add value
75
+ - Ensure the agent has enough context to handle variations of the core task
76
+ - Make the agent proactive in seeking clarification when needed
77
+ - Build in quality assurance and self-correction mechanisms
78
+
79
+ Remember: The agents you create should be autonomous experts capable of handling their designated tasks with minimal additional guidance. Your system prompts are their complete operational manual.
80
+ `,yr=`
81
+
82
+ 7. **Agent Memory Instructions**: If the user mentions "memory", "remember", "learn", "persist", or similar concepts, OR if the agent would benefit from building up knowledge across conversations (e.g., code reviewers learning patterns, architects learning codebase structure, etc.), include domain-specific memory update instructions in the systemPrompt.
83
+
84
+ Add a section like this to the systemPrompt, tailored to the agent's specific domain:
85
+
86
+ "**Update your agent memory** as you discover [domain-specific items]. This builds up institutional knowledge across conversations. Write concise notes about what you found and where.
87
+
88
+ Examples of what to record:
89
+ - [domain-specific item 1]
90
+ - [domain-specific item 2]
91
+ - [domain-specific item 3]"
92
+
93
+ Examples of domain-specific memory instructions:
94
+ - For a code-reviewer: "Update your agent memory as you discover code patterns, style conventions, common issues, and architectural decisions in this codebase."
95
+ - For a test-runner: "Update your agent memory as you discover test patterns, common failure modes, flaky tests, and testing best practices."
96
+ - For an architect: "Update your agent memory as you discover codepaths, library locations, key architectural decisions, and component relationships."
97
+ - For a documentation writer: "Update your agent memory as you discover documentation patterns, API structures, and terminology conventions."
98
+
99
+ The memory instructions should be specific to what the agent would naturally learn while performing its core tasks.
100
+ `}));function xr(){let{updateWizardData:e,goBack:t,goToStep:n,wizardData:r}=V(),[i,a]=(0,J.useState)(r.generationPrompt||``),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(i.length),f=rn(),p=(0,J.useRef)(null);D(`confirm:no`,(0,J.useCallback)(()=>{p.current&&(p.current.abort(),p.current=null,s(!1),l(`Generation cancelled`))},[]),{context:`Settings`,isActive:o}),D(`chat:externalEditor`,(0,J.useCallback)(async()=>{let e=await en(i);e.content!==null&&(a(e.content),d(e.content.length))},[i]),{context:`Chat`,isActive:!o}),D(`confirm:no`,(0,J.useCallback)(()=>{e({generationPrompt:``,agentType:``,systemPrompt:``,whenToUse:``,generatedAgent:void 0,wasGenerated:!1}),a(``),l(null),t()},[e,t]),{context:`Settings`,isActive:!o});let m=async()=>{let t=i.trim();if(!t){l(`Please describe what the agent should do`);return}l(null),s(!0),e({generationPrompt:t,isGenerating:!0});let r=Xe();p.current=r;try{let i=await _r(t,f,[],r.signal);e({agentType:i.identifier,whenToUse:i.whenToUse,systemPrompt:i.systemPrompt,generatedAgent:i,isGenerating:!1,wasGenerated:!0}),n(6)}catch(t){t instanceof pt||t instanceof Error&&!t.message.includes(`No assistant message found`)&&l(t.message||`Failed to generate agent`),e({isGenerating:!1})}finally{s(!1),p.current=null}},h=`Describe what this agent should do and when it should be used (be comprehensive for best results)`;return o?(0,Y.jsx)(H,{subtitle:h,footerText:(0,Y.jsx)(S,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`}),children:(0,Y.jsxs)(w,{flexDirection:`row`,alignItems:`center`,children:[(0,Y.jsx)(Zt,{}),(0,Y.jsx)(T,{color:`suggestion`,children:` Generating agent from description...`})]})}):(0,Y.jsx)(H,{subtitle:h,footerText:(0,Y.jsxs)(E,{children:[(0,Y.jsx)(S,{action:`confirm:yes`,context:`Confirmation`,fallback:`Enter`,description:`submit`}),(0,Y.jsx)(S,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,Y.jsx)(S,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Y.jsxs)(w,{flexDirection:`column`,children:[c&&(0,Y.jsx)(w,{marginBottom:1,children:(0,Y.jsx)(T,{color:`error`,children:c})}),(0,Y.jsx)(Gt,{value:i,onChange:a,onSubmit:m,placeholder:`e.g., Help me write unit tests for my code...`,columns:80,cursorOffset:u,onChangeCursorOffset:d,focus:!0,showCursor:!0})]})})}var J,Y,Sr=e((()=>{ct(),J=t(O(),1),an(),k(),b(),Ve(),tn(),x(),Xt(),Wt(),W(),U(),br(),Y=A()}));function Cr(){let{goNext:e,updateWizardData:t,cancel:n}=V();return(0,X.jsx)(H,{subtitle:`Choose location`,footerText:(0,X.jsxs)(E,{children:[(0,X.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,X.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,X.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,X.jsx)(w,{children:(0,X.jsx)(Yt,{options:[{label:`Project (.workmate/agents/)`,value:`projectSettings`},{label:`Personal (~/.workmate/agents/)`,value:`userSettings`}],onChange:n=>{t({location:n}),e()},onCancel:()=>n()},`location-select`)})})}var X,wr=e((()=>{k(),x(),Jt(),W(),U(),X=A()}));function Tr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=V();D(`confirm:no`,t,{context:`Confirmation`});let i=r.location===`userSettings`?[{label:`User scope (~/.workmate/agent-memory/) (Recommended)`,value:`user`},{label:`None (no persistent memory)`,value:`none`},{label:`Project scope (.workmate/agent-memory/)`,value:`project`},{label:`Local scope (.workmate/agent-memory-local/)`,value:`local`}]:[{label:`Project scope (.workmate/agent-memory/) (Recommended)`,value:`project`},{label:`None (no persistent memory)`,value:`none`},{label:`User scope (~/.workmate/agent-memory/)`,value:`user`},{label:`Local scope (.workmate/agent-memory-local/)`,value:`local`}];return(0,Er.jsx)(H,{subtitle:`Configure agent memory`,footerText:(0,Er.jsxs)(E,{children:[(0,Er.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,Er.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,Er.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Er.jsx)(w,{children:(0,Er.jsx)(Yt,{options:i,onChange:t=>{let i=t===`none`?void 0:t,a=r.finalAgent?.agentType;n({selectedMemory:i,finalAgent:r.finalAgent?{...r.finalAgent,memory:i,getSystemPrompt:Tt()&&i&&a?()=>`${r.systemPrompt}\n\n${g(a,i)}`:()=>r.systemPrompt}:void 0}),e()},onCancel:t},`memory-select`)})})}var Er,Dr=e((()=>{k(),b(),Et(),p(),x(),Jt(),W(),U(),Er=A()}));function Or(){let{goNext:e,goBack:t,updateWizardData:n,goToStep:r}=V();return(0,kr.jsx)(H,{subtitle:`Creation method`,footerText:(0,kr.jsxs)(E,{children:[(0,kr.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,kr.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,kr.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,kr.jsx)(w,{children:(0,kr.jsx)(Yt,{options:[{label:`Generate with Work Mate (recommended)`,value:`generate`},{label:`Manual configuration`,value:`manual`}],onChange:t=>{let i=t;n({method:i,wasGenerated:i===`generate`}),i===`generate`?e():r(3)},onCancel:()=>t()},`method-select`)})})}var kr,Ar=e((()=>{k(),x(),Jt(),W(),U(),kr=A()}));function jr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=V();return(0,Mr.jsx)(H,{subtitle:`Select model`,footerText:(0,Mr.jsxs)(E,{children:[(0,Mr.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,Mr.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,Mr.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Mr.jsx)(kn,{initialModel:r.selectedModel,onComplete:t=>{n({selectedModel:t}),e()},onCancel:t})})}var Mr,Nr=e((()=>{x(),k(),W(),U(),Mn(),Mr=A()}));function Pr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=V(),[i,a]=(0,Fr.useState)(r.systemPrompt||``),[o,s]=(0,Fr.useState)(i.length),[c,l]=(0,Fr.useState)(null);return D(`confirm:no`,t,{context:`Settings`}),D(`chat:externalEditor`,(0,Fr.useCallback)(async()=>{let e=await en(i);e.content!==null&&(a(e.content),s(e.content.length))},[i]),{context:`Chat`}),(0,Z.jsx)(H,{subtitle:`System prompt`,footerText:(0,Z.jsxs)(E,{children:[(0,Z.jsx)(C,{shortcut:`Type`,action:`enter text`}),(0,Z.jsx)(C,{shortcut:`Enter`,action:`continue`}),(0,Z.jsx)(S,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,Z.jsx)(S,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Z.jsxs)(w,{flexDirection:`column`,children:[(0,Z.jsx)(T,{children:`Enter the system prompt for your agent:`}),(0,Z.jsx)(T,{dimColor:!0,children:`Be comprehensive for best results`}),(0,Z.jsx)(w,{marginTop:1,children:(0,Z.jsx)(Gt,{value:i,onChange:a,onSubmit:()=>{let t=i.trim();if(!t){l(`System prompt is required`);return}l(null),n({systemPrompt:t}),e()},placeholder:`You are a helpful code reviewer who...`,columns:80,cursorOffset:o,onChangeCursorOffset:s,focus:!0,showCursor:!0})}),c&&(0,Z.jsx)(w,{marginTop:1,children:(0,Z.jsx)(T,{color:`error`,children:c})})]})})}var Fr,Z,Ir=e((()=>{Fr=t(O(),1),k(),b(),tn(),x(),Wt(),W(),U(),Z=A()}));function Lr({tools:e}){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=V(),a=e=>{r({selectedTools:e}),t()},o=i.selectedTools;return(0,Rr.jsx)(H,{subtitle:`Select tools`,footerText:(0,Rr.jsxs)(E,{children:[(0,Rr.jsx)(C,{shortcut:`Enter`,action:`toggle selection`}),(0,Rr.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,Rr.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Rr.jsx)(Fn,{tools:e,initialTools:o,onComplete:a,onCancel:n})})}var Rr,zr=e((()=>{k(),x(),W(),U(),In(),Rr=A()}));function Br(e){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=V(),[a,o]=(0,Vr.useState)(i.agentType||``),[s,c]=(0,Vr.useState)(null),[l,u]=(0,Vr.useState)(a.length);return D(`confirm:no`,n,{context:`Settings`}),(0,Q.jsx)(H,{subtitle:`Agent type (identifier)`,footerText:(0,Q.jsxs)(E,{children:[(0,Q.jsx)(C,{shortcut:`Type`,action:`enter text`}),(0,Q.jsx)(C,{shortcut:`Enter`,action:`continue`}),(0,Q.jsx)(S,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Q.jsxs)(w,{flexDirection:`column`,children:[(0,Q.jsx)(T,{children:`Enter a unique identifier for your agent:`}),(0,Q.jsx)(w,{marginTop:1,children:(0,Q.jsx)(Gt,{value:a,onChange:o,onSubmit:e=>{let n=e.trim(),i=ar(n);if(i){c(i);return}c(null),r({agentType:n}),t()},placeholder:`e.g., test-runner, tech-lead, etc`,columns:60,cursorOffset:l,onChangeCursorOffset:u,focus:!0,showCursor:!0})}),s&&(0,Q.jsx)(w,{marginTop:1,children:(0,Q.jsx)(T,{color:`error`,children:s})})]})})}var Vr,Q,Hr=e((()=>{Vr=t(O(),1),k(),b(),x(),Wt(),W(),U(),sr(),Q=A()}));function Ur({tools:e,existingAgents:t,onComplete:n,onCancel:r}){return(0,Wr.jsx)(qn,{steps:[Cr,Or,xr,()=>(0,Wr.jsx)(Br,{existingAgents:t}),Pr,mr,()=>(0,Wr.jsx)(Lr,{tools:e}),jr,rr,...Tt()?[Tr]:[],()=>(0,Wr.jsx)(ur,{tools:e,existingAgents:t,onComplete:n})],initialData:{},onComplete:()=>{},onCancel:r,title:`Create new agent`,showStepCounter:!1})}var Wr,Gr=e((()=>{Et(),W(),ir(),pr(),gr(),Sr(),wr(),Dr(),Ar(),Nr(),Ir(),zr(),Hr(),Wr=A()}));function Kr({tools:e,onExit:t}){let[n,r]=(0,qr.useState)({mode:`list-agents`,source:`all`}),i=te(e=>e.agentDefinitions),a=te(e=>e.mcp.tools),o=te(e=>e.toolPermissionContext),s=tt(),{allAgents:c,activeAgents:l}=i,[u,d]=(0,qr.useState)([]),f=Qt(e,a,o);Kt();let p=(0,qr.useMemo)(()=>({"built-in":c.filter(e=>e.source===`built-in`),userSettings:c.filter(e=>e.source===`userSettings`),projectSettings:c.filter(e=>e.source===`projectSettings`),policySettings:c.filter(e=>e.source===`policySettings`),localSettings:c.filter(e=>e.source===`localSettings`),flagSettings:c.filter(e=>e.source===`flagSettings`),plugin:c.filter(e=>e.source===`plugin`),all:c}),[c]),m=(0,qr.useCallback)(e=>{d(t=>[...t,e]),r({mode:`list-agents`,source:`all`})},[]),h=(0,qr.useCallback)(async e=>{try{await bn(e),s(t=>{let n=t.agentDefinitions.allAgents.filter(t=>!(t.agentType===e.agentType&&t.source===e.source));return{...t,agentDefinitions:{...t.agentDefinitions,allAgents:n,activeAgents:Ke(n)}}}),d(t=>[...t,`Deleted agent: ${rt.bold(e.agentType)}`]),r({mode:`list-agents`,source:`all`})}catch(e){Ot(ft(e))}},[s]);switch(n.mode){case`list-agents`:{let e=Vt(n.source===`all`?[...p[`built-in`],...p.userSettings,...p.projectSettings,...p.localSettings,...p.policySettings,...p.flagSettings,...p.plugin]:p[n.source],l);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Wn,{source:n.source,agents:e,onBack:()=>{t((u.length>0?`Agent changes:\n${u.join(`
101
+ `)}`:void 0)??`Agents dialog dismissed`,{display:u.length===0?`system`:void 0})},onSelect:e=>r({mode:`agent-menu`,agent:e,previousMode:n}),onCreateNew:()=>r({mode:`create-agent`}),changes:u}),(0,$.jsx)(Vn,{})]})}case`create-agent`:return(0,$.jsx)(Ur,{tools:f,existingAgents:l,onComplete:m,onCancel:()=>r({mode:`list-agents`,source:`all`})});case`agent-menu`:{let e=c.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent,t=[{label:`View agent`,value:`view`},...e.source!==`built-in`&&e.source!==`plugin`&&e.source!==`flagSettings`?[{label:`Edit agent`,value:`edit`},{label:`Delete agent`,value:`delete`}]:[],{label:`Back`,value:`back`}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(at,{title:n.agent.agentType,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsxs)(w,{flexDirection:`column`,children:[(0,$.jsx)(Yt,{options:t,onChange:t=>{switch(t){case`view`:r({mode:`view-agent`,agent:e,previousMode:n.previousMode});break;case`edit`:r({mode:`edit-agent`,agent:e,previousMode:n});break;case`delete`:r({mode:`delete-confirm`,agent:e,previousMode:n});break;case`back`:r(n.previousMode);break}},onCancel:()=>r(n.previousMode)}),u.length>0&&(0,$.jsx)(w,{marginTop:1,children:(0,$.jsx)(T,{dimColor:!0,children:u[u.length-1]})})]})}),(0,$.jsx)(Vn,{})]})}case`view-agent`:{let e=c.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(at,{title:e.agentType,onCancel:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode}),hideInputGuide:!0,children:(0,$.jsx)(Cn,{agent:e,tools:f,allAgents:c,onBack:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode})})}),(0,$.jsx)(Vn,{instructions:`Press Enter or Esc to go back`})]})}case`delete-confirm`:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(at,{title:`Delete agent`,onCancel:()=>{`previousMode`in n&&r(n.previousMode)},color:`error`,children:[(0,$.jsxs)(T,{children:[`Are you sure you want to delete the agent `,(0,$.jsx)(T,{bold:!0,children:n.agent.agentType}),`?`]}),(0,$.jsx)(w,{marginTop:1,children:(0,$.jsxs)(T,{dimColor:!0,children:[`Source: `,n.agent.source]})}),(0,$.jsx)(w,{marginTop:1,children:(0,$.jsx)(Yt,{options:[{label:`Yes, delete`,value:`yes`},{label:`No, cancel`,value:`no`}],onChange:e=>{e===`yes`?h(n.agent):`previousMode`in n&&r(n.previousMode)},onCancel:()=>{`previousMode`in n&&r(n.previousMode)}})})]}),(0,$.jsx)(Vn,{instructions:`Press ↑↓ to navigate, Enter to select, Esc to cancel`})]});case`edit-agent`:{let e=c.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(at,{title:`Edit agent: ${e.agentType}`,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsx)(zn,{agent:e,tools:f,onSaved:e=>{m(e),r(n.previousMode)},onBack:()=>r(n.previousMode)})}),(0,$.jsx)(Vn,{})]})}default:return null}}var qr,$,Jr=e((()=>{it(),qr=t(O(),1),qt(),$t(),k(),h(),zt(),He(),lt(),Dt(),Jt(),wn(),Bn(),Un(),Kn(),Sn(),Gr(),$=A()}));async function Yr(e,t){let n=t.getAppState().toolPermissionContext;return(0,Xr.jsx)(Kr,{tools:ge(n),onExit:e})}var Xr;e((()=>{Jr(),d(),Xr=A()}))();export{Yr as call};
@@ -1,2 +1,2 @@
1
- import{i as e,o as t,r as n}from"./loadAgentsDir-C1LkW7gl.js";import{n as r,t as i}from"./cwd-BcO6WHKo.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./agentDisplay-vLQHFrmq.js";o(),t(),r();function d(e){let t=a(e),n=[e.agentType];return t&&n.push(t),e.memory&&n.push(`${e.memory} memory`),n.join(` · `)}async function f(){let{allAgents:t}=await e(i()),r=c(t,n(t)),a=[],o=0;for(let{label:e,source:t}of u){let n=r.filter(e=>e.source===t).sort(s);if(n.length!==0){a.push(`${e}:`);for(let e of n)if(e.overriddenBy){let t=l(e.overriddenBy);a.push(` (shadowed by ${t}) ${d(e)}`)}else a.push(` ${d(e)}`),o++;a.push(``)}}a.length===0?console.log(`No agents found.`):(console.log(`${o} active agents\n`),console.log(a.join(`
1
+ import{i as e,o as t,r as n}from"./loadAgentsDir-B0Anodo0.js";import{n as r,t as i}from"./cwd-Pa83R95t.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./agentDisplay-M4pfwbMC.js";o(),t(),r();function d(e){let t=a(e),n=[e.agentType];return t&&n.push(t),e.memory&&n.push(`${e.memory} memory`),n.join(` · `)}async function f(){let{allAgents:t}=await e(i()),r=c(t,n(t)),a=[],o=0;for(let{label:e,source:t}of u){let n=r.filter(e=>e.source===t).sort(s);if(n.length!==0){a.push(`${e}:`);for(let e of n)if(e.overriddenBy){let t=l(e.overriddenBy);a.push(` (shadowed by ${t}) ${d(e)}`)}else a.push(` ${d(e)}`),o++;a.push(``)}}a.length===0?console.log(`No agents found.`):(console.log(`${o} active agents\n`),console.log(a.join(`
2
2
  `).trimEnd()))}export{f as agentsHandler};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Dv as t,Tv as n}from"./loadAgentsDir-B0Anodo0.js";import{h as r,l as i}from"./settings-B2jvL8Dp.js";function a(){let e=i(),t=[`user`,`project`,`local`].flatMap(e=>n(e).errors);return{settings:e.settings,errors:[...e.errors,...t]}}var o=e((()=>{t(),r()}));export{o as n,a as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,m as n,v as r}from"./config-BddEvZZl.js";import{i,t as a}from"./execFileNoThrow-BsfuytkN.js";import{o,s}from"./log-DaILwWJa.js";import{homedir as c}from"os";import{join as l}from"path";import{stat as u}from"fs/promises";function d(e){r(t=>({...t,appleTerminalSetupInProgress:!0,appleTerminalBackupPath:e}))}function f(){r(e=>({...e,appleTerminalSetupInProgress:!1}))}function p(){let e=t();return{inProgress:e.appleTerminalSetupInProgress??!1,backupPath:e.appleTerminalBackupPath||null}}function m(){return l(c(),`Library`,`Preferences`,`com.apple.Terminal.plist`)}async function h(){let e=m(),t=`${e}.bak`;try{let{code:n}=await a(`defaults`,[`export`,`com.apple.Terminal`,e]);if(n!==0)return null;try{await u(e)}catch{return null}return await a(`defaults`,[`export`,`com.apple.Terminal`,t]),d(t),t}catch(e){return s(e),null}}async function g(){let{inProgress:e,backupPath:t}=p();if(!e)return{status:`no_backup`};if(!t)return f(),{status:`no_backup`};try{await u(t)}catch{return f(),{status:`no_backup`}}try{let{code:e}=await a(`defaults`,[`import`,`com.apple.Terminal`,t]);return e===0?(await a(`killall`,[`cfprefsd`]),f(),{status:`restored`}):{status:`failed`,backupPath:t}}catch(e){return s(Error(`Failed to restore Terminal.app settings with: ${e}`)),f(),{status:`failed`,backupPath:t}}}var _=e((()=>{n(),i(),o()}));export{f as a,_ as i,g as n,m as r,h as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{_ as t,p as n,s as r}from"./config-C-Y2qtB2.js";import{i,t as a}from"./execFileNoThrow-BTachNBI.js";import{o,s}from"./log-D2TIwHBV.js";import{homedir as c}from"os";import{join as l}from"path";import{stat as u}from"fs/promises";function d(e){t(t=>({...t,appleTerminalSetupInProgress:!0,appleTerminalBackupPath:e}))}function f(){t(e=>({...e,appleTerminalSetupInProgress:!1}))}function p(){let e=r();return{inProgress:e.appleTerminalSetupInProgress??!1,backupPath:e.appleTerminalBackupPath||null}}function m(){return l(c(),`Library`,`Preferences`,`com.apple.Terminal.plist`)}async function h(){let e=m(),t=`${e}.bak`;try{let{code:n}=await a(`defaults`,[`export`,`com.apple.Terminal`,e]);if(n!==0)return null;try{await u(e)}catch{return null}return await a(`defaults`,[`export`,`com.apple.Terminal`,t]),d(t),t}catch(e){return s(e),null}}async function g(){let{inProgress:e,backupPath:t}=p();if(!e)return{status:`no_backup`};if(!t)return f(),{status:`no_backup`};try{await u(t)}catch{return f(),{status:`no_backup`}}try{let{code:e}=await a(`defaults`,[`import`,`com.apple.Terminal`,t]);return e===0?(await a(`killall`,[`cfprefsd`]),f(),{status:`restored`}):{status:`failed`,backupPath:t}}catch(e){return s(Error(`Failed to restore Terminal.app settings with: ${e}`)),f(),{status:`failed`,backupPath:t}}}var _=e((()=>{n(),i(),o()}));export{f as a,_ as i,g as n,m as r,h as t};
@@ -0,0 +1,17 @@
1
+ import{i as e,o as t}from"./envUtils-DfkgIdYf.js";import{Eb as n,Jd as r,Jx as i,Lu as a,Pu as o,Q as s,X as c,Yi as l,Yx as ee,_r as u,aC as te,nc as d,ny as ne,pS as re,qg as f,rc as p,sr as m,ty as h,ut as g,wb as ie,xt as ae}from"./loadAgentsDir-B0Anodo0.js";import{B as _,F as v,It as y}from"./state-B4jiUise.js";import{n as oe,t as se}from"./cwd-Pa83R95t.js";import{I as b,V as x,c as S,f as C,i as w,u as T,x as E}from"./debug-Bglx1aTu.js";import{d as D,h as O,v as k}from"./settings-B2jvL8Dp.js";import{b as A}from"./config-C-Y2qtB2.js";import{_ as j,o as M,s as N,v as P}from"./log-D2TIwHBV.js";import{n as F,r as I}from"./analytics-DJobLaWP.js";import{d as L,l as R}from"./model-BvQFFOf8.js";import{_n as z,vn as B}from"./prompt-CJ1l3XXk.js";import{r as V,t as H}from"./pasteStore-P0zP-ch0.js";import{r as U}from"./magicDocs-Bkz7ZcmL.js";import{i as W,t as G}from"./nativeInstaller-CdjmE9Zy.js";import{n as K,t as ce}from"./allErrors-BF73lon8.js";import{n as le,t as ue}from"./pluginAutoupdate-ennb9k8_.js";import{n as de}from"./registerProtocol-CAsDme_E.js";import"os";import{join as q}from"path";import"crypto";t(),y(),oe(),E(),C(),w(),P(),O(),B(),L(),p(),u(),U(),c(),M(),b(),l(),f(),c(),ne(),b(),M(),l(),f(),r();async function fe(e,t){if(!e)return;let{join:n}=await import(`path`),r=await import(`fs/promises`),a=n(se(),`.workmate`,`skills`,e,`SKILL.md`),o;try{o=await r.readFile(a,`utf-8`)}catch{N(Error(`Failed to read skill file for improvement: ${a}`));return}let c=t.map(e=>`- ${e.section}: ${e.change}`).join(`
2
+ `),l=R(),u=await s({messages:[re({content:`You are editing a skill definition file. Apply the following improvements to the skill.
3
+
4
+ <current_skill_file>
5
+ ${o}
6
+ </current_skill_file>
7
+
8
+ <improvements>
9
+ ${c}
10
+ </improvements>
11
+
12
+ Rules:
13
+ - Integrate the improvements naturally into the existing structure
14
+ - Preserve frontmatter (--- block) exactly as-is
15
+ - Preserve the overall format and style
16
+ - Do not remove existing content unless an improvement explicitly replaces it
17
+ - Output the complete updated file inside <updated_file> tags`})],systemPrompt:te([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:h().signal,options:{getToolPermissionContext:async()=>z(),model:l,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[]}}),d=i(ee(Array.isArray(u.message.content)?u.message.content:[]).trim(),`updated_file`);if(!d){N(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(a,d,`utf-8`)}catch(e){N(x(e))}}F(),a(),A(),M(),G(),V(),K(),n(),ae();var pe=30;function J(){let e=((D()||{}).cleanupPeriodDays??pe)*24*60*60*1e3;return new Date(Date.now()-e)}function me(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function he(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function Y(e,t,n){let r={messages:0,errors:0};try{let i=await T().readdir(e);for(let a of i)try{he(a.name)<t&&(await T().unlink(q(e,a.name)),n?r.messages++:r.errors++)}catch(e){N(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&N(e)}return r}async function ge(){let e=T(),t=J(),n=j.errors(),r=j.baseLogs(),i=await Y(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>q(r,e.name));for(let n of a)i=me(i,await Y(n,t,!0)),await Z(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&N(e)}return i}async function X(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Z(e,t){try{await t.rmdir(e)}catch{}}async function _e(){let e=J(),t={messages:0,errors:0},n=m(),r=T(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=q(n,a.name),o;try{o=await r.readdir(i)}catch{t.errors++;continue}for(let n of o)if(n.isFile()){if(!n.name.endsWith(`.jsonl`)&&!n.name.endsWith(`.cast`))continue;try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=q(i,n.name),o=q(a,ie),s;try{s=await r.readdir(o)}catch{await Z(a,r);continue}for(let n of s)if(n.isFile())try{await X(q(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=q(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}await Z(i,r)}await Z(o,r),await Z(a,r)}await Z(i,r)}return t}async function Q(e,t,n=!0){let r=J(),i={messages:0,errors:0},a=T(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await X(q(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Z(e,a),i}function ve(){return Q(q(e(),`plans`),`.md`)}async function ye(){let t=J(),n={messages:0,errors:0},r=T();try{let i=q(e(),`file-history`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));await Promise.all(o.map(async e=>{try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}})),await Z(i,r)}catch(e){N(e)}return n}async function be(){let t=J(),n={messages:0,errors:0},r=T();try{let i=q(e(),`session-env`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));for(let e of o)try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}await Z(i,r)}catch(e){N(e)}return n}async function xe(){let t=J(),n={messages:0,errors:0},r=T(),i=q(e(),`debug`),a;try{a=await r.readdir(i)}catch{return n}for(let e of a)if(!(!e.isFile()||!e.name.endsWith(`.txt`)||e.name===`latest`))try{await X(q(i,e.name),t,r)&&n.messages++}catch{n.errors++}return n}async function Se(){let{errors:e}=ce();if(e.length>0&&k(`cleanupPeriodDays`)){S(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await ge(),await _e(),await ve(),await ye(),await be(),await xe(),await o(),await H(J());let t=await g(J());t>0&&I(`tengu_worktree_cleanup`,{removed:t})}y(),G(),le();var $=600*1e3;function Ce(){import(`./extractMemories-D4Dl1itt.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),d(),ue(),v()&&de();let e=!0;async function t(){if(v()&&_()>Date.now()-1e3*60){setTimeout(t,$).unref();return}if(e&&(e=!1,await Se()),v()&&_()>Date.now()-1e3*60){setTimeout(t,$).unref();return}await W()}setTimeout(t,$).unref()}export{fe as n,Ce as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./backgroundHousekeeping-Bq3LMsVR.js";export{e as startBackgroundHousekeeping};
@@ -0,0 +1,2 @@
1
+ import{It as e,J as t}from"./state-B4jiUise.js";import{c as n,i as r}from"./debug-Bglx1aTu.js";import{Br as i,Lr as a,Or as o,Ur as s,jr as c,kn as l,wn as u}from"./settings-B2jvL8Dp.js";import{_ as d,p as f,s as p}from"./config-C-Y2qtB2.js";import{_ as m,f as h,p as g}from"./startupProfiler-CJdr3SxP.js";import{n as _,r as v}from"./detectRepository-CfX8Lc0A.js";import{homedir as y}from"os";import{join as b,sep as x}from"path";import{realpath as S,stat as C}from"fs/promises";e(),f(),r(),v(),u(),s(),a();async function w(){try{let e=await _();if(!e){n(`Not in a GitHub repository, skipping path mapping update`);return}let r=t(),i=o(r)??r,a;try{a=(await S(i)).normalize(`NFC`)}catch{a=i}let s=e.toLowerCase(),c=p().githubRepoPaths?.[s]??[];if(c[0]===a){n(`Path ${a} already tracked for repo ${s}`);return}let l=c.filter(e=>e!==a),u=[a,...l];d(e=>({...e,githubRepoPaths:{...e.githubRepoPaths,[s]:u}})),n(`Added ${a} to tracked paths for repo ${s}`)}catch(e){n(`Error updating repo path mapping: ${e}`)}}function T(e){let t=p(),n=e.toLowerCase();return t.githubRepoPaths?.[n]??[]}async function E(e){let t=await Promise.all(e.map(l));return e.filter((e,n)=>t[n])}m(),s(),a();var D=10080*60*1e3,O=1e3;function k(e){let t=[`This session was opened by an external deep link in ${M(e.cwd)}`];if(e.repo){let n=e.lastFetch?g(e.lastFetch):`never`,r=!e.lastFetch||Date.now()-e.lastFetch.getTime()>D;t.push(`Resolved ${e.repo} from local clones · last fetched ${n}${r?` — AGENTS.md may be stale`:``}`)}return e.prefillLength&&t.push(e.prefillLength>O?`The prompt below (${h(e.prefillLength)} chars) was supplied by the link — scroll to review the entire prompt before pressing Enter.`:`The prompt below was supplied by the link — review carefully before pressing Enter.`),t.join(`
2
+ `)}async function A(e){let t=await c(e);if(!t)return;let n=await i(t),[r,a]=await Promise.all([j(b(t,`FETCH_HEAD`)),n?j(b(n,`FETCH_HEAD`)):Promise.resolve(void 0)]);return r&&a?r>a?r:a:r??a}async function j(e){try{let{mtime:t}=await C(e);return t}catch{return}}function M(e){let t=y();return e===t?`~`:e.startsWith(t+x)?`~${e.slice(t.length)}`:e}export{w as a,T as i,A as n,E as r,k as t};
@@ -1,4 +1,4 @@
1
- import{a as e,n as t,r as n,t as r}from"./rolldown-runtime-DaDcL9Zw.js";import{_ as i,a,d as o,f as s,h as c,i as l,l as u,m as d,n as f,p,r as m,s as h,v as g,y as ee}from"./client-DchQnIJD.js";import{n as te,t as ne}from"./defineProperty-C-QyHrDq.js";import{G as re,n as ie,t as ae}from"./protocols-CnYQjBlj.js";import{c as oe,r as se}from"./serde-f76bObzR.js";import{Ht as ce,Lt as le,Pt as ue,Ut as de,t as fe}from"./dist-es-BOPBJQo3.js";import{Readable as pe}from"stream";import{Buffer as _}from"buffer";import me from"assert";import"https";function he(e,t){return new Request(e,t)}var ge=t((()=>{}));function _e(e=0){return new Promise((t,n)=>{e&&setTimeout(()=>{let t=Error(`Request did not complete within ${e} ms`);t.name=`TimeoutError`,n(t)},e)})}var ve=t((()=>{}));function ye(e){let t=e&&typeof e==`object`&&`reason`in e?e.reason:void 0;if(t){if(t instanceof Error){let e=Error(`Request aborted`);return e.name=`AbortError`,e.cause=t,e}let e=Error(String(t));return e.name=`AbortError`,e}let n=Error(`Request aborted`);return n.name=`AbortError`,n}var v,be,xe=t((()=>{ae(),ge(),ve(),te(),v={supported:void 0},be=class e{static create(t){return typeof t?.handle==`function`?t:new e(t)}constructor(e){ne(this,`config`,void 0),ne(this,`configProvider`,void 0),typeof e==`function`?this.configProvider=e().then(e=>e||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),v.supported===void 0&&(v.supported=typeof Request<`u`&&`keepalive`in he(`https://[::1]`))}destroy(){}async handle(e,{abortSignal:t,requestTimeout:n}={}){this.config||(this.config=await this.configProvider);let r=n??this.config.requestTimeout,i=this.config.keepAlive===!0,a=this.config.credentials;if(t?.aborted){let e=ye(t);return Promise.reject(e)}let o=e.path,s=ie(e.query||{});s&&(o+=`?${s}`),e.fragment&&(o+=`#${e.fragment}`);let c=``;(e.username!=null||e.password!=null)&&(c=`${e.username??``}:${e.password??``}@`);let{port:l,method:u}=e,d=`${e.protocol}//${c}${e.hostname}${l?`:${l}`:``}${o}`,f=u===`GET`||u===`HEAD`?void 0:e.body,p={body:f,headers:new Headers(e.headers),method:u,credentials:a};this.config?.cache&&(p.cache=this.config.cache),f&&(p.duplex=`half`),typeof AbortController<`u`&&(p.signal=t),v.supported&&(p.keepalive=i),typeof this.config.requestInit==`function`&&Object.assign(p,this.config.requestInit(e));let m=()=>{},h=he(d,p),g=[fetch(h).then(e=>{let t=e.headers,n={};for(let e of t.entries())n[e[0]]=e[1];return e.body==null?e.blob().then(t=>({response:new re({headers:n,reason:e.statusText,statusCode:e.status,body:t})})):{response:new re({headers:n,reason:e.statusText,statusCode:e.status,body:e.body})}}),_e(r)];return t&&g.push(new Promise((e,n)=>{let r=()=>{n(ye(t))};if(typeof t.addEventListener==`function`){let e=t;e.addEventListener(`abort`,r,{once:!0}),m=()=>e.removeEventListener(`abort`,r)}else t.onabort=r})),Promise.race(g).finally(m)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=t,n))}httpHandlerConfigs(){return this.config??{}}}})),Se=t((()=>{xe(),se()})),y=n({__assign:()=>S,__asyncDelegator:()=>Le,__asyncGenerator:()=>Ie,__asyncValues:()=>Re,__await:()=>b,__awaiter:()=>Oe,__classPrivateFieldGet:()=>He,__classPrivateFieldSet:()=>Ue,__createBinding:()=>Ae,__decorate:()=>Te,__exportStar:()=>je,__extends:()=>Ce,__generator:()=>ke,__importDefault:()=>Ve,__importStar:()=>Be,__makeTemplateObject:()=>ze,__metadata:()=>De,__param:()=>Ee,__read:()=>Ne,__rest:()=>we,__spread:()=>Pe,__spreadArrays:()=>Fe,__values:()=>Me});function Ce(e,t){x(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function we(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Te(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function Ee(e,t){return function(n,r){t(n,r,e)}}function De(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function Oe(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function ke(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function Ae(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}function je(e,t){for(var n in e)n!=="default"&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function Me(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function Ne(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Pe(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Ne(arguments[t]));return e}function Fe(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function b(e){return this instanceof b?(this.v=e,this):new b(e)}function Ie(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},o(`next`),o(`throw`),o(`return`),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||s(e,t)})})}function s(e,t){try{c(r[e](t))}catch(e){d(a[0][3],e)}}function c(e){e.value instanceof b?Promise.resolve(e.value.v).then(l,u):d(a[0][2],e)}function l(e){s(`next`,e)}function u(e){s(`throw`,e)}function d(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}function Le(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:b(e[r](t)),done:r===`return`}:i?i(t):t}:i}}function Re(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Me==`function`?Me(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function ze(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function Be(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function Ve(e){return e&&e.__esModule?e:{default:e}}function He(e,t){if(!t.has(e))throw TypeError(`attempted to get private field on non-instance`);return t.get(e)}function Ue(e,t,n){if(!t.has(e))throw TypeError(`attempted to set private field on non-instance`);return t.set(e,n),n}var x,S,C=t((()=>{x=function(e,t){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},x(e,t)},S=function(){return S=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},S.apply(this,arguments)}})),We=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MAX_HASHABLE_LENGTH=e.INIT=e.KEY=e.DIGEST_LENGTH=e.BLOCK_SIZE=void 0,e.BLOCK_SIZE=64,e.DIGEST_LENGTH=32,e.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),e.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e.MAX_HASHABLE_LENGTH=2**53-1})),Ge=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RawSha256=void 0;var t=We();e.RawSha256=function(){function e(){this.state=Int32Array.from(t.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw Error(`Attempted to update an already finished hash.`);var n=0,r=e.byteLength;if(this.bytesHashed+=r,this.bytesHashed*8>t.MAX_HASHABLE_LENGTH)throw Error(`Cannot hash more than 2^53 - 1 bits`);for(;r>0;)this.buffer[this.bufferLength++]=e[n++],r--,this.bufferLength===t.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,n=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),r=this.bufferLength;if(n.setUint8(this.bufferLength++,128),r%t.BLOCK_SIZE>=t.BLOCK_SIZE-8){for(var i=this.bufferLength;i<t.BLOCK_SIZE;i++)n.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(var i=this.bufferLength;i<t.BLOCK_SIZE-8;i++)n.setUint8(i,0);n.setUint32(t.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),n.setUint32(t.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var a=new Uint8Array(t.DIGEST_LENGTH),i=0;i<8;i++)a[i*4]=this.state[i]>>>24&255,a[i*4+1]=this.state[i]>>>16&255,a[i*4+2]=this.state[i]>>>8&255,a[i*4+3]=this.state[i]>>>0&255;return a},e.prototype.hashBuffer=function(){for(var e=this,n=e.buffer,r=e.state,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=0;f<t.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(n[f*4]&255)<<24|(n[f*4+1]&255)<<16|(n[f*4+2]&255)<<8|n[f*4+3]&255;else{var p=this.temp[f-2],m=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var h=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(m+this.temp[f-7]|0)+(h+this.temp[f-16]|0)}var g=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&l^~c&u)|0)+(d+(t.KEY[f]+this.temp[f]|0)|0)|0,ee=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&a^i&o^a&o)|0;d=u,u=l,l=c,c=s+g|0,s=o,o=a,a=i,i=g+ee|0}r[0]+=i,r[1]+=a,r[2]+=o,r[3]+=s,r[4]+=c,r[5]+=l,r[6]+=u,r[7]+=d},e}()})),Ke,qe,Je=t((()=>{Ke=e=>{let t=[];for(let n=0,r=e.length;n<r;n++){let r=e.charCodeAt(n);if(r<128)t.push(r);else if(r<2048)t.push(r>>6|192,r&63|128);else if(n+1<e.length&&(r&64512)==55296&&(e.charCodeAt(n+1)&64512)==56320){let i=65536+((r&1023)<<10)+(e.charCodeAt(++n)&1023);t.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else t.push(r>>12|224,r>>6&63|128,r&63|128)}return Uint8Array.from(t)},qe=e=>{let t=``;for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r<128)t+=String.fromCharCode(r);else if(192<=r&&r<224){let i=e[++n];t+=String.fromCharCode((r&31)<<6|i&63)}else if(240<=r&&r<365){let i=`%`+[r,e[++n],e[++n],e[++n]].map(e=>e.toString(16)).join(`%`);t+=decodeURIComponent(i)}else t+=String.fromCharCode((r&15)<<12|(e[++n]&63)<<6|e[++n]&63)}return t}}));function Ye(e){return new TextEncoder().encode(e)}function Xe(e){return new TextDecoder(`utf-8`).decode(e)}var Ze=t((()=>{})),Qe=n({fromUtf8:()=>$e,toUtf8:()=>et}),$e,et,tt=t((()=>{Je(),Ze(),$e=e=>typeof TextEncoder==`function`?Ye(e):Ke(e),et=e=>typeof TextDecoder==`function`?Xe(e):qe(e)})),nt=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var n=(tt(),e(Qe)),r=typeof Buffer<`u`&&Buffer.from?function(e){return Buffer.from(e,`utf8`)}:n.fromUtf8;function i(e){return e instanceof Uint8Array?e:typeof e==`string`?r(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.convertToBuffer=i})),rt=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isEmptyData=void 0;function t(e){return typeof e==`string`?e.length===0:e.byteLength===0}e.isEmptyData=t})),it=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.numToUint8=void 0;function t(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}e.numToUint8=t})),at=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=void 0;function t(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),n=0;n<e.length;)t[n]=e[n],n+=1;return t}return Uint32Array.from(e)}e.uint32ArrayFrom=t})),ot=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=e.numToUint8=e.isEmptyData=e.convertToBuffer=void 0;var t=nt();Object.defineProperty(e,"convertToBuffer",{enumerable:!0,get:function(){return t.convertToBuffer}});var n=rt();Object.defineProperty(e,"isEmptyData",{enumerable:!0,get:function(){return n.isEmptyData}});var r=it();Object.defineProperty(e,"numToUint8",{enumerable:!0,get:function(){return r.numToUint8}});var i=at();Object.defineProperty(e,"uint32ArrayFrom",{enumerable:!0,get:function(){return i.uint32ArrayFrom}})})),st=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var n=(C(),e(y)),r=We(),i=Ge(),a=ot();t.Sha256=function(){function e(e){this.secret=e,this.hash=new i.RawSha256,this.reset()}return e.prototype.update=function(e){if(!((0,a.isEmptyData)(e)||this.error))try{this.hash.update((0,a.convertToBuffer)(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new i.RawSha256,this.secret){this.outer=new i.RawSha256;var e=o(this.secret),t=new Uint8Array(r.BLOCK_SIZE);t.set(e);for(var n=0;n<r.BLOCK_SIZE;n++)e[n]^=54,t[n]^=92;this.hash.update(e),this.outer.update(t);for(var n=0;n<e.byteLength;n++)e[n]=0}},e}();function o(e){var t=(0,a.convertToBuffer)(e);if(t.byteLength>r.BLOCK_SIZE){var n=new i.RawSha256;n.update(t),t=n.digest()}var o=new Uint8Array(r.BLOCK_SIZE);return o.set(t),o}})),ct=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),(C(),e(y)).__exportStar(st(),t)})),lt=t((()=>{})),ut=t((()=>{lt()})),dt=t((()=>{})),ft,pt=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(ft||(ft={}))})),mt,ht=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(mt||(mt={}))})),gt=t((()=>{})),_t=t((()=>{})),vt=t((()=>{})),yt=t((()=>{})),bt=t((()=>{pt(),ht(),gt(),_t(),vt(),yt()})),xt=t((()=>{})),St=t((()=>{})),Ct=t((()=>{})),wt=t((()=>{})),Tt=t((()=>{})),Et=t((()=>{})),Dt=t((()=>{})),Ot=t((()=>{Tt(),Et(),Dt()})),kt=t((()=>{})),At=t((()=>{})),jt,Mt=t((()=>{(function(e){e.HTTP=`http`,e.HTTPS=`https`})(jt||(jt={}))})),Nt=t((()=>{})),Pt=t((()=>{})),Ft=t((()=>{})),It=t((()=>{})),Lt=t((()=>{})),Rt=t((()=>{Nt(),Pt(),Ft(),It(),Lt()})),zt=t((()=>{})),Bt,Vt=t((()=>{(function(e){e.MD5=`md5`,e.CRC32=`crc32`,e.CRC32C=`crc32c`,e.SHA1=`sha1`,e.SHA256=`sha256`})(Bt||(Bt={}))})),Ht=t((()=>{Vt()})),Ut=t((()=>{})),Wt=t((()=>{Ht(),Ut(),Vt()})),Gt,Kt=t((()=>{(function(e){e[e.HEADER=0]=`HEADER`,e[e.TRAILER=1]=`TRAILER`})(Gt||(Gt={}))})),qt=t((()=>{})),Jt=t((()=>{})),Yt=t((()=>{})),Xt=t((()=>{})),Zt=t((()=>{})),Qt=t((()=>{Jt(),Yt(),Xt(),Zt()})),$t=t((()=>{})),en=t((()=>{})),tn=t((()=>{})),nn,rn=t((()=>{(function(e){e.PROFILE=`profile`,e.SSO_SESSION=`sso-session`,e.SERVICES=`services`})(nn||(nn={}))})),an=t((()=>{})),on=t((()=>{})),sn=t((()=>{})),cn=t((()=>{})),ln=t((()=>{})),un=t((()=>{})),dn=t((()=>{})),fn=t((()=>{})),pn=t((()=>{})),mn,hn=t((()=>{(function(e){e.HTTP_0_9=`http/0.9`,e.HTTP_1_0=`http/1.0`,e.TDS_8_0=`tds/8.0`})(mn||(mn={}))})),gn=t((()=>{})),_n=t((()=>{})),vn=t((()=>{})),yn=t((()=>{})),bn=t((()=>{})),xn=t((()=>{})),Sn=t((()=>{dt(),bt(),xt(),St(),Ct(),wt(),Ot(),kt(),At(),Mt(),Rt(),zt(),Wt(),Kt(),qt(),Qt(),$t(),en(),tn(),rn(),an(),on(),sn(),cn(),ln(),un(),dn(),fn(),pn(),hn(),gn(),_n(),vn(),yn(),bn(),xn()})),Cn=t((()=>{Sn()})),wn=t((()=>{})),Tn=t((()=>{}));function En(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return{...t,[n]:Array.isArray(r)?[...r]:r}},{})}var Dn,On=t((()=>{Dn=class e{constructor(e){this.method=e.method||`GET`,this.hostname=e.hostname||`localhost`,this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)===`:`?e.protocol:`${e.protocol}:`:`https:`,this.path=e.path?e.path.charAt(0)===`/`?e.path:`/${e.path}`:`/`,this.username=e.username,this.password=e.password,this.fragment=e.fragment}static isInstance(e){if(!e)return!1;let t=e;return`method`in t&&`protocol`in t&&`hostname`in t&&`path`in t&&typeof t.query==`object`&&typeof t.headers==`object`}clone(){let t=new e({...this,headers:{...this.headers}});return t.query&&(t.query=En(t.query)),t}}})),kn=t((()=>{})),An=t((()=>{})),jn=t((()=>{})),w=t((()=>{ut(),Cn(),wn(),Tn(),On(),kn(),An(),jn()}));function Mn(e){if(e.length%2!=0)throw Error(`Hex encoded strings must have an even number length`);let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){let r=e.slice(n,n+2).toLowerCase();if(r in E)t[n/2]=E[r];else throw Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`)}return t}function T(e){let t=``;for(let n=0;n<e.byteLength;n++)t+=Nn[e[n]];return t}var Nn,E,D=t((()=>{Nn={},E={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),Nn[e]=t,E[t]=e}})),Pn=t((()=>{})),Fn,In=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(Fn||(Fn={}))})),Ln,Rn=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(Ln||(Ln={}))})),zn=t((()=>{})),Bn=t((()=>{})),Vn=t((()=>{})),Hn=t((()=>{})),Un=t((()=>{In(),Rn(),zn(),Bn(),Vn(),Hn()})),Wn=t((()=>{})),Gn=t((()=>{})),Kn=t((()=>{})),qn=t((()=>{})),Jn=t((()=>{})),Yn=t((()=>{})),Xn=t((()=>{})),Zn=t((()=>{Jn(),Yn(),Xn()})),Qn=t((()=>{})),$n=t((()=>{})),er,tr=t((()=>{(function(e){e.HTTP=`http`,e.HTTPS=`https`})(er||(er={}))})),nr=t((()=>{})),rr=t((()=>{})),ir=t((()=>{})),ar=t((()=>{})),or=t((()=>{})),sr=t((()=>{nr(),rr(),ir(),ar(),or()})),cr=t((()=>{})),lr,ur=t((()=>{(function(e){e.MD5=`md5`,e.CRC32=`crc32`,e.CRC32C=`crc32c`,e.SHA1=`sha1`,e.SHA256=`sha256`})(lr||(lr={}))})),dr=t((()=>{ur()})),fr=t((()=>{})),pr=t((()=>{dr(),fr(),ur()})),mr=t((()=>{})),hr,gr=t((()=>{(function(e){e[e.HEADER=0]=`HEADER`,e[e.TRAILER=1]=`TRAILER`})(hr||(hr={}))})),_r=t((()=>{})),vr=t((()=>{})),yr=t((()=>{})),br=t((()=>{})),xr=t((()=>{})),Sr=t((()=>{vr(),yr(),br(),xr()})),Cr=t((()=>{})),wr=t((()=>{})),Tr=t((()=>{})),Er,Dr=t((()=>{(function(e){e.PROFILE=`profile`,e.SSO_SESSION=`sso-session`,e.SERVICES=`services`})(Er||(Er={}))})),Or=t((()=>{})),kr=t((()=>{})),Ar=t((()=>{})),jr=t((()=>{})),Mr=t((()=>{})),Nr=t((()=>{})),Pr=t((()=>{})),Fr=t((()=>{})),Ir=t((()=>{})),Lr,Rr=t((()=>{(function(e){e.HTTP_0_9=`http/0.9`,e.HTTP_1_0=`http/1.0`,e.TDS_8_0=`tds/8.0`})(Lr||(Lr={}))})),zr=t((()=>{})),Br=t((()=>{})),Vr=t((()=>{})),Hr=t((()=>{})),Ur=t((()=>{})),Wr=t((()=>{})),Gr=t((()=>{Pn(),Un(),Wn(),Gn(),Kn(),qn(),Zn(),Qn(),$n(),tr(),sr(),cr(),pr(),mr(),gr(),_r(),Sr(),Cr(),wr(),Tr(),Dr(),Or(),kr(),Ar(),jr(),Mr(),Nr(),Pr(),Fr(),Ir(),Rr(),zr(),Br(),Vr(),Hr(),Ur(),Wr()})),Kr=t((()=>{Gr()})),qr,Jr=t((()=>{qr=e=>{if(typeof e==`function`)return e;let t=Promise.resolve(e);return()=>t}})),Yr=t((()=>{Kr(),Jr()})),O,Xr,Zr=t((()=>{O=e=>encodeURIComponent(e).replace(/[!'()*]/g,Xr),Xr=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`})),Qr=t((()=>{})),$r=t((()=>{Zr(),Qr()})),ei,ti=t((()=>{ei=e=>typeof ArrayBuffer==`function`&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)===`[object ArrayBuffer]`})),ni,ri=t((()=>{ni=(e,t)=>{if(typeof e!=`string`)throw TypeError(`The "input" argument must be of type string. Received type ${typeof e} (${e})`);return t?_.from(e,t):_.from(e)}})),k,ii=t((()=>{ri(),k=e=>{let t=ni(e,`utf8`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}})),A,ai=t((()=>{ii(),A=e=>typeof e==`string`?k(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)})),oi=t((()=>{})),j=t((()=>{ii(),ai(),oi()})),si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,M,Ci,wi,Ti,N=t((()=>{si=`X-Amz-Algorithm`,ci=`X-Amz-Credential`,li=`X-Amz-Date`,ui=`X-Amz-SignedHeaders`,di=`X-Amz-Expires`,fi=`X-Amz-Signature`,pi=`X-Amz-Security-Token`,mi=`authorization`,hi=li.toLowerCase(),gi=`date`,_i=[mi,hi,gi],fi.toLowerCase(),vi=`x-amz-content-sha256`,yi=pi.toLowerCase(),bi={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},xi=/^proxy-/,Si=/^sec-/,M=`AWS4-HMAC-SHA256`,Ci=`AWS4-HMAC-SHA256-PAYLOAD`,wi=`UNSIGNED-PAYLOAD`,Ti=`aws4_request`})),P,F,I,Ei,Di,Oi=t((()=>{D(),j(),N(),P={},F=[],I=(e,t,n)=>`${e}/${t}/${n}/${Ti}`,Ei=async(e,t,n,r,i)=>{let a=`${n}:${r}:${i}:${T(await Di(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(a in P)return P[a];for(F.push(a);F.length>50;)delete P[F.shift()];let o=`AWS4${t.secretAccessKey}`;for(let t of[n,r,i,Ti])o=await Di(e,o,t);return P[a]=o},Di=(e,t,n)=>{let r=new e(t);return r.update(A(n)),r.digest()}})),ki,Ai=t((()=>{N(),ki=({headers:e},t,n)=>{let r={};for(let i of Object.keys(e).sort()){if(e[i]==null)continue;let a=i.toLowerCase();(a in bi||t?.has(a)||xi.test(a)||Si.test(a))&&(!n||n&&!n.has(a))||(r[a]=e[i].trim().replace(/\s+/g,` `))}return r}})),ji,Mi=t((()=>{$r(),N(),ji=({query:e={}})=>{let t=[],n={};for(let r of Object.keys(e).sort()){if(r.toLowerCase()===`x-amz-signature`)continue;t.push(r);let i=e[r];typeof i==`string`?n[r]=`${O(r)}=${O(i)}`:Array.isArray(i)&&(n[r]=i.slice(0).reduce((e,t)=>e.concat([`${O(r)}=${O(t)}`]),[]).sort().join(`&`))}return t.map(e=>n[e]).filter(e=>e).join(`&`)}})),L,Ni=t((()=>{ti(),D(),j(),N(),L=async({headers:e,body:t},n)=>{for(let t of Object.keys(e))if(t.toLowerCase()===`x-amz-content-sha256`)return e[t];if(t==null)return`e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`;if(typeof t==`string`||ArrayBuffer.isView(t)||ei(t)){let e=new n;return e.update(A(t)),T(await e.digest())}return wi}}));function Pi(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var Fi,Ii,Li,Ri,zi=t((()=>{D(),j(),Fi=class{format(e){let t=[];for(let n of Object.keys(e)){let r=k(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}let n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case`boolean`:return Uint8Array.from([+!e.value]);case`byte`:return Uint8Array.from([2,e.value]);case`short`:let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case`integer`:let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case`long`:let r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case`binary`:let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case`string`:let o=k(e.value),s=new DataView(new ArrayBuffer(3+o.byteLength));s.setUint8(0,7),s.setUint16(1,o.byteLength,!1);let c=new Uint8Array(s.buffer);return c.set(o,3),c;case`timestamp`:let l=new Uint8Array(9);return l[0]=8,l.set(Ri.fromNumber(e.value.valueOf()).bytes,1),l;case`uuid`:if(!Li.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(Mn(e.value.replace(/\-/g,``)),1),u}}},(function(e){e[e.boolTrue=0]=`boolTrue`,e[e.boolFalse=1]=`boolFalse`,e[e.byte=2]=`byte`,e[e.short=3]=`short`,e[e.integer=4]=`integer`,e[e.long=5]=`long`,e[e.byteArray=6]=`byteArray`,e[e.string=7]=`string`,e[e.timestamp=8]=`timestamp`,e[e.uuid=9]=`uuid`})(Ii||(Ii={})),Li=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,Ri=class e{constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error(`Int64 buffers must be exactly 8 bytes`)}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let n=new Uint8Array(8);for(let e=7,r=Math.abs(Math.round(t));e>-1&&r>0;e--,r/=256)n[e]=r;return t<0&&Pi(n),new e(n)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;return t&&Pi(e),parseInt(T(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}})),Bi,Vi=t((()=>{Bi=(e,t)=>{e=e.toLowerCase();for(let n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1}})),Hi,Ui,Wi=t((()=>{Hi=({headers:e,query:t,...n})=>({...n,headers:{...e},query:t?Ui(t):void 0}),Ui=e=>Object.keys(e).reduce((t,n)=>{let r=e[n];return{...t,[n]:Array.isArray(r)?[...r]:r}},{})})),Gi,Ki=t((()=>{Wi(),Gi=(e,t={})=>{let{headers:n,query:r={}}=typeof e.clone==`function`?e.clone():Hi(e);for(let e of Object.keys(n)){let i=e.toLowerCase();i.slice(0,6)===`x-amz-`&&!t.unhoistableHeaders?.has(i)&&(r[e]=n[e],delete n[e])}return{...e,headers:n,query:r}}})),qi,Ji=t((()=>{Wi(),N(),qi=e=>{e=typeof e.clone==`function`?e.clone():Hi(e);for(let t of Object.keys(e.headers))_i.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e}})),Yi,Xi,Zi=t((()=>{Yi=e=>Xi(e).toISOString().replace(/\.\d{3}Z$/,`Z`),Xi=e=>typeof e==`number`?new Date(e*1e3):typeof e==`string`?Number(e)?new Date(Number(e)*1e3):new Date(e):e})),Qi,R,$i,ea=t((()=>{D(),Yr(),$r(),j(),N(),Oi(),Ai(),Mi(),Ni(),zi(),Vi(),Ki(),Ji(),Zi(),Qi=class{constructor({applyChecksum:e,credentials:t,region:n,service:r,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new Fi,this.service=r,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e!=`boolean`||e,this.regionProvider=qr(n),this.credentialProvider=qr(t)}async presign(e,t={}){let{signingDate:n=new Date,expiresIn:r=3600,unsignableHeaders:i,unhoistableHeaders:a,signableHeaders:o,signingRegion:s,signingService:c}=t,l=await this.credentialProvider();this.validateResolvedCredentials(l);let u=s??await this.regionProvider(),{longDate:d,shortDate:f}=R(n);if(r>604800)return Promise.reject(`Signature version 4 presigned URLs must have an expiration date less than one week in the future`);let p=I(f,u,c??this.service),m=Gi(qi(e),{unhoistableHeaders:a});l.sessionToken&&(m.query[pi]=l.sessionToken),m.query[si]=M,m.query[ci]=`${l.accessKeyId}/${p}`,m.query[li]=d,m.query[di]=r.toString(10);let h=ki(m,i,o);return m.query[ui]=$i(h),m.query[fi]=await this.getSignature(d,p,this.getSigningKey(l,u,f,c),this.createCanonicalRequest(m,h,await L(e,this.sha256))),m}async sign(e,t){return typeof e==`string`?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:n=new Date,priorSignature:r,signingRegion:i,signingService:a}){let o=i??await this.regionProvider(),{shortDate:s,longDate:c}=R(n),l=I(s,o,a??this.service),u=await L({headers:{},body:t},this.sha256),d=new this.sha256;d.update(e);let f=[Ci,c,l,r,T(await d.digest()),u].join(`
1
+ import{a as e,n as t,r as n,t as r}from"./rolldown-runtime-DaDcL9Zw.js";import{_ as i,a,d as o,f as s,h as c,i as l,l as u,m as d,n as f,p,r as m,s as h,v as g,y as ee}from"./client-DchQnIJD.js";import{n as te,t as ne}from"./defineProperty-C-QyHrDq.js";import{G as re,n as ie,t as ae}from"./protocols-CnYQjBlj.js";import{c as oe,r as se}from"./serde-f76bObzR.js";import{Ht as ce,Lt as le,Pt as ue,Ut as de,t as fe}from"./dist-es-_UNJQniz.js";import{Readable as pe}from"stream";import{Buffer as _}from"buffer";import me from"assert";import"https";function he(e,t){return new Request(e,t)}var ge=t((()=>{}));function _e(e=0){return new Promise((t,n)=>{e&&setTimeout(()=>{let t=Error(`Request did not complete within ${e} ms`);t.name=`TimeoutError`,n(t)},e)})}var ve=t((()=>{}));function ye(e){let t=e&&typeof e==`object`&&`reason`in e?e.reason:void 0;if(t){if(t instanceof Error){let e=Error(`Request aborted`);return e.name=`AbortError`,e.cause=t,e}let e=Error(String(t));return e.name=`AbortError`,e}let n=Error(`Request aborted`);return n.name=`AbortError`,n}var v,be,xe=t((()=>{ae(),ge(),ve(),te(),v={supported:void 0},be=class e{static create(t){return typeof t?.handle==`function`?t:new e(t)}constructor(e){ne(this,`config`,void 0),ne(this,`configProvider`,void 0),typeof e==`function`?this.configProvider=e().then(e=>e||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),v.supported===void 0&&(v.supported=typeof Request<`u`&&`keepalive`in he(`https://[::1]`))}destroy(){}async handle(e,{abortSignal:t,requestTimeout:n}={}){this.config||(this.config=await this.configProvider);let r=n??this.config.requestTimeout,i=this.config.keepAlive===!0,a=this.config.credentials;if(t?.aborted){let e=ye(t);return Promise.reject(e)}let o=e.path,s=ie(e.query||{});s&&(o+=`?${s}`),e.fragment&&(o+=`#${e.fragment}`);let c=``;(e.username!=null||e.password!=null)&&(c=`${e.username??``}:${e.password??``}@`);let{port:l,method:u}=e,d=`${e.protocol}//${c}${e.hostname}${l?`:${l}`:``}${o}`,f=u===`GET`||u===`HEAD`?void 0:e.body,p={body:f,headers:new Headers(e.headers),method:u,credentials:a};this.config?.cache&&(p.cache=this.config.cache),f&&(p.duplex=`half`),typeof AbortController<`u`&&(p.signal=t),v.supported&&(p.keepalive=i),typeof this.config.requestInit==`function`&&Object.assign(p,this.config.requestInit(e));let m=()=>{},h=he(d,p),g=[fetch(h).then(e=>{let t=e.headers,n={};for(let e of t.entries())n[e[0]]=e[1];return e.body==null?e.blob().then(t=>({response:new re({headers:n,reason:e.statusText,statusCode:e.status,body:t})})):{response:new re({headers:n,reason:e.statusText,statusCode:e.status,body:e.body})}}),_e(r)];return t&&g.push(new Promise((e,n)=>{let r=()=>{n(ye(t))};if(typeof t.addEventListener==`function`){let e=t;e.addEventListener(`abort`,r,{once:!0}),m=()=>e.removeEventListener(`abort`,r)}else t.onabort=r})),Promise.race(g).finally(m)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=t,n))}httpHandlerConfigs(){return this.config??{}}}})),Se=t((()=>{xe(),se()})),y=n({__assign:()=>S,__asyncDelegator:()=>Le,__asyncGenerator:()=>Ie,__asyncValues:()=>Re,__await:()=>b,__awaiter:()=>Oe,__classPrivateFieldGet:()=>He,__classPrivateFieldSet:()=>Ue,__createBinding:()=>Ae,__decorate:()=>Te,__exportStar:()=>je,__extends:()=>Ce,__generator:()=>ke,__importDefault:()=>Ve,__importStar:()=>Be,__makeTemplateObject:()=>ze,__metadata:()=>De,__param:()=>Ee,__read:()=>Ne,__rest:()=>we,__spread:()=>Pe,__spreadArrays:()=>Fe,__values:()=>Me});function Ce(e,t){x(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function we(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Te(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function Ee(e,t){return function(n,r){t(n,r,e)}}function De(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function Oe(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function ke(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function Ae(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}function je(e,t){for(var n in e)n!=="default"&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function Me(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function Ne(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Pe(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Ne(arguments[t]));return e}function Fe(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function b(e){return this instanceof b?(this.v=e,this):new b(e)}function Ie(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},o(`next`),o(`throw`),o(`return`),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||s(e,t)})})}function s(e,t){try{c(r[e](t))}catch(e){d(a[0][3],e)}}function c(e){e.value instanceof b?Promise.resolve(e.value.v).then(l,u):d(a[0][2],e)}function l(e){s(`next`,e)}function u(e){s(`throw`,e)}function d(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}function Le(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:b(e[r](t)),done:r===`return`}:i?i(t):t}:i}}function Re(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Me==`function`?Me(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function ze(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function Be(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function Ve(e){return e&&e.__esModule?e:{default:e}}function He(e,t){if(!t.has(e))throw TypeError(`attempted to get private field on non-instance`);return t.get(e)}function Ue(e,t,n){if(!t.has(e))throw TypeError(`attempted to set private field on non-instance`);return t.set(e,n),n}var x,S,C=t((()=>{x=function(e,t){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},x(e,t)},S=function(){return S=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},S.apply(this,arguments)}})),We=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MAX_HASHABLE_LENGTH=e.INIT=e.KEY=e.DIGEST_LENGTH=e.BLOCK_SIZE=void 0,e.BLOCK_SIZE=64,e.DIGEST_LENGTH=32,e.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),e.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e.MAX_HASHABLE_LENGTH=2**53-1})),Ge=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RawSha256=void 0;var t=We();e.RawSha256=function(){function e(){this.state=Int32Array.from(t.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw Error(`Attempted to update an already finished hash.`);var n=0,r=e.byteLength;if(this.bytesHashed+=r,this.bytesHashed*8>t.MAX_HASHABLE_LENGTH)throw Error(`Cannot hash more than 2^53 - 1 bits`);for(;r>0;)this.buffer[this.bufferLength++]=e[n++],r--,this.bufferLength===t.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,n=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),r=this.bufferLength;if(n.setUint8(this.bufferLength++,128),r%t.BLOCK_SIZE>=t.BLOCK_SIZE-8){for(var i=this.bufferLength;i<t.BLOCK_SIZE;i++)n.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(var i=this.bufferLength;i<t.BLOCK_SIZE-8;i++)n.setUint8(i,0);n.setUint32(t.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),n.setUint32(t.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var a=new Uint8Array(t.DIGEST_LENGTH),i=0;i<8;i++)a[i*4]=this.state[i]>>>24&255,a[i*4+1]=this.state[i]>>>16&255,a[i*4+2]=this.state[i]>>>8&255,a[i*4+3]=this.state[i]>>>0&255;return a},e.prototype.hashBuffer=function(){for(var e=this,n=e.buffer,r=e.state,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=0;f<t.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(n[f*4]&255)<<24|(n[f*4+1]&255)<<16|(n[f*4+2]&255)<<8|n[f*4+3]&255;else{var p=this.temp[f-2],m=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var h=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(m+this.temp[f-7]|0)+(h+this.temp[f-16]|0)}var g=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&l^~c&u)|0)+(d+(t.KEY[f]+this.temp[f]|0)|0)|0,ee=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&a^i&o^a&o)|0;d=u,u=l,l=c,c=s+g|0,s=o,o=a,a=i,i=g+ee|0}r[0]+=i,r[1]+=a,r[2]+=o,r[3]+=s,r[4]+=c,r[5]+=l,r[6]+=u,r[7]+=d},e}()})),Ke,qe,Je=t((()=>{Ke=e=>{let t=[];for(let n=0,r=e.length;n<r;n++){let r=e.charCodeAt(n);if(r<128)t.push(r);else if(r<2048)t.push(r>>6|192,r&63|128);else if(n+1<e.length&&(r&64512)==55296&&(e.charCodeAt(n+1)&64512)==56320){let i=65536+((r&1023)<<10)+(e.charCodeAt(++n)&1023);t.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else t.push(r>>12|224,r>>6&63|128,r&63|128)}return Uint8Array.from(t)},qe=e=>{let t=``;for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r<128)t+=String.fromCharCode(r);else if(192<=r&&r<224){let i=e[++n];t+=String.fromCharCode((r&31)<<6|i&63)}else if(240<=r&&r<365){let i=`%`+[r,e[++n],e[++n],e[++n]].map(e=>e.toString(16)).join(`%`);t+=decodeURIComponent(i)}else t+=String.fromCharCode((r&15)<<12|(e[++n]&63)<<6|e[++n]&63)}return t}}));function Ye(e){return new TextEncoder().encode(e)}function Xe(e){return new TextDecoder(`utf-8`).decode(e)}var Ze=t((()=>{})),Qe=n({fromUtf8:()=>$e,toUtf8:()=>et}),$e,et,tt=t((()=>{Je(),Ze(),$e=e=>typeof TextEncoder==`function`?Ye(e):Ke(e),et=e=>typeof TextDecoder==`function`?Xe(e):qe(e)})),nt=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var n=(tt(),e(Qe)),r=typeof Buffer<`u`&&Buffer.from?function(e){return Buffer.from(e,`utf8`)}:n.fromUtf8;function i(e){return e instanceof Uint8Array?e:typeof e==`string`?r(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.convertToBuffer=i})),rt=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isEmptyData=void 0;function t(e){return typeof e==`string`?e.length===0:e.byteLength===0}e.isEmptyData=t})),it=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.numToUint8=void 0;function t(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}e.numToUint8=t})),at=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=void 0;function t(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),n=0;n<e.length;)t[n]=e[n],n+=1;return t}return Uint32Array.from(e)}e.uint32ArrayFrom=t})),ot=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=e.numToUint8=e.isEmptyData=e.convertToBuffer=void 0;var t=nt();Object.defineProperty(e,"convertToBuffer",{enumerable:!0,get:function(){return t.convertToBuffer}});var n=rt();Object.defineProperty(e,"isEmptyData",{enumerable:!0,get:function(){return n.isEmptyData}});var r=it();Object.defineProperty(e,"numToUint8",{enumerable:!0,get:function(){return r.numToUint8}});var i=at();Object.defineProperty(e,"uint32ArrayFrom",{enumerable:!0,get:function(){return i.uint32ArrayFrom}})})),st=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var n=(C(),e(y)),r=We(),i=Ge(),a=ot();t.Sha256=function(){function e(e){this.secret=e,this.hash=new i.RawSha256,this.reset()}return e.prototype.update=function(e){if(!((0,a.isEmptyData)(e)||this.error))try{this.hash.update((0,a.convertToBuffer)(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new i.RawSha256,this.secret){this.outer=new i.RawSha256;var e=o(this.secret),t=new Uint8Array(r.BLOCK_SIZE);t.set(e);for(var n=0;n<r.BLOCK_SIZE;n++)e[n]^=54,t[n]^=92;this.hash.update(e),this.outer.update(t);for(var n=0;n<e.byteLength;n++)e[n]=0}},e}();function o(e){var t=(0,a.convertToBuffer)(e);if(t.byteLength>r.BLOCK_SIZE){var n=new i.RawSha256;n.update(t),t=n.digest()}var o=new Uint8Array(r.BLOCK_SIZE);return o.set(t),o}})),ct=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),(C(),e(y)).__exportStar(st(),t)})),lt=t((()=>{})),ut=t((()=>{lt()})),dt=t((()=>{})),ft,pt=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(ft||(ft={}))})),mt,ht=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(mt||(mt={}))})),gt=t((()=>{})),_t=t((()=>{})),vt=t((()=>{})),yt=t((()=>{})),bt=t((()=>{pt(),ht(),gt(),_t(),vt(),yt()})),xt=t((()=>{})),St=t((()=>{})),Ct=t((()=>{})),wt=t((()=>{})),Tt=t((()=>{})),Et=t((()=>{})),Dt=t((()=>{})),Ot=t((()=>{Tt(),Et(),Dt()})),kt=t((()=>{})),At=t((()=>{})),jt,Mt=t((()=>{(function(e){e.HTTP=`http`,e.HTTPS=`https`})(jt||(jt={}))})),Nt=t((()=>{})),Pt=t((()=>{})),Ft=t((()=>{})),It=t((()=>{})),Lt=t((()=>{})),Rt=t((()=>{Nt(),Pt(),Ft(),It(),Lt()})),zt=t((()=>{})),Bt,Vt=t((()=>{(function(e){e.MD5=`md5`,e.CRC32=`crc32`,e.CRC32C=`crc32c`,e.SHA1=`sha1`,e.SHA256=`sha256`})(Bt||(Bt={}))})),Ht=t((()=>{Vt()})),Ut=t((()=>{})),Wt=t((()=>{Ht(),Ut(),Vt()})),Gt,Kt=t((()=>{(function(e){e[e.HEADER=0]=`HEADER`,e[e.TRAILER=1]=`TRAILER`})(Gt||(Gt={}))})),qt=t((()=>{})),Jt=t((()=>{})),Yt=t((()=>{})),Xt=t((()=>{})),Zt=t((()=>{})),Qt=t((()=>{Jt(),Yt(),Xt(),Zt()})),$t=t((()=>{})),en=t((()=>{})),tn=t((()=>{})),nn,rn=t((()=>{(function(e){e.PROFILE=`profile`,e.SSO_SESSION=`sso-session`,e.SERVICES=`services`})(nn||(nn={}))})),an=t((()=>{})),on=t((()=>{})),sn=t((()=>{})),cn=t((()=>{})),ln=t((()=>{})),un=t((()=>{})),dn=t((()=>{})),fn=t((()=>{})),pn=t((()=>{})),mn,hn=t((()=>{(function(e){e.HTTP_0_9=`http/0.9`,e.HTTP_1_0=`http/1.0`,e.TDS_8_0=`tds/8.0`})(mn||(mn={}))})),gn=t((()=>{})),_n=t((()=>{})),vn=t((()=>{})),yn=t((()=>{})),bn=t((()=>{})),xn=t((()=>{})),Sn=t((()=>{dt(),bt(),xt(),St(),Ct(),wt(),Ot(),kt(),At(),Mt(),Rt(),zt(),Wt(),Kt(),qt(),Qt(),$t(),en(),tn(),rn(),an(),on(),sn(),cn(),ln(),un(),dn(),fn(),pn(),hn(),gn(),_n(),vn(),yn(),bn(),xn()})),Cn=t((()=>{Sn()})),wn=t((()=>{})),Tn=t((()=>{}));function En(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return{...t,[n]:Array.isArray(r)?[...r]:r}},{})}var Dn,On=t((()=>{Dn=class e{constructor(e){this.method=e.method||`GET`,this.hostname=e.hostname||`localhost`,this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)===`:`?e.protocol:`${e.protocol}:`:`https:`,this.path=e.path?e.path.charAt(0)===`/`?e.path:`/${e.path}`:`/`,this.username=e.username,this.password=e.password,this.fragment=e.fragment}static isInstance(e){if(!e)return!1;let t=e;return`method`in t&&`protocol`in t&&`hostname`in t&&`path`in t&&typeof t.query==`object`&&typeof t.headers==`object`}clone(){let t=new e({...this,headers:{...this.headers}});return t.query&&(t.query=En(t.query)),t}}})),kn=t((()=>{})),An=t((()=>{})),jn=t((()=>{})),w=t((()=>{ut(),Cn(),wn(),Tn(),On(),kn(),An(),jn()}));function Mn(e){if(e.length%2!=0)throw Error(`Hex encoded strings must have an even number length`);let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){let r=e.slice(n,n+2).toLowerCase();if(r in E)t[n/2]=E[r];else throw Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`)}return t}function T(e){let t=``;for(let n=0;n<e.byteLength;n++)t+=Nn[e[n]];return t}var Nn,E,D=t((()=>{Nn={},E={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),Nn[e]=t,E[t]=e}})),Pn=t((()=>{})),Fn,In=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(Fn||(Fn={}))})),Ln,Rn=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(Ln||(Ln={}))})),zn=t((()=>{})),Bn=t((()=>{})),Vn=t((()=>{})),Hn=t((()=>{})),Un=t((()=>{In(),Rn(),zn(),Bn(),Vn(),Hn()})),Wn=t((()=>{})),Gn=t((()=>{})),Kn=t((()=>{})),qn=t((()=>{})),Jn=t((()=>{})),Yn=t((()=>{})),Xn=t((()=>{})),Zn=t((()=>{Jn(),Yn(),Xn()})),Qn=t((()=>{})),$n=t((()=>{})),er,tr=t((()=>{(function(e){e.HTTP=`http`,e.HTTPS=`https`})(er||(er={}))})),nr=t((()=>{})),rr=t((()=>{})),ir=t((()=>{})),ar=t((()=>{})),or=t((()=>{})),sr=t((()=>{nr(),rr(),ir(),ar(),or()})),cr=t((()=>{})),lr,ur=t((()=>{(function(e){e.MD5=`md5`,e.CRC32=`crc32`,e.CRC32C=`crc32c`,e.SHA1=`sha1`,e.SHA256=`sha256`})(lr||(lr={}))})),dr=t((()=>{ur()})),fr=t((()=>{})),pr=t((()=>{dr(),fr(),ur()})),mr=t((()=>{})),hr,gr=t((()=>{(function(e){e[e.HEADER=0]=`HEADER`,e[e.TRAILER=1]=`TRAILER`})(hr||(hr={}))})),_r=t((()=>{})),vr=t((()=>{})),yr=t((()=>{})),br=t((()=>{})),xr=t((()=>{})),Sr=t((()=>{vr(),yr(),br(),xr()})),Cr=t((()=>{})),wr=t((()=>{})),Tr=t((()=>{})),Er,Dr=t((()=>{(function(e){e.PROFILE=`profile`,e.SSO_SESSION=`sso-session`,e.SERVICES=`services`})(Er||(Er={}))})),Or=t((()=>{})),kr=t((()=>{})),Ar=t((()=>{})),jr=t((()=>{})),Mr=t((()=>{})),Nr=t((()=>{})),Pr=t((()=>{})),Fr=t((()=>{})),Ir=t((()=>{})),Lr,Rr=t((()=>{(function(e){e.HTTP_0_9=`http/0.9`,e.HTTP_1_0=`http/1.0`,e.TDS_8_0=`tds/8.0`})(Lr||(Lr={}))})),zr=t((()=>{})),Br=t((()=>{})),Vr=t((()=>{})),Hr=t((()=>{})),Ur=t((()=>{})),Wr=t((()=>{})),Gr=t((()=>{Pn(),Un(),Wn(),Gn(),Kn(),qn(),Zn(),Qn(),$n(),tr(),sr(),cr(),pr(),mr(),gr(),_r(),Sr(),Cr(),wr(),Tr(),Dr(),Or(),kr(),Ar(),jr(),Mr(),Nr(),Pr(),Fr(),Ir(),Rr(),zr(),Br(),Vr(),Hr(),Ur(),Wr()})),Kr=t((()=>{Gr()})),qr,Jr=t((()=>{qr=e=>{if(typeof e==`function`)return e;let t=Promise.resolve(e);return()=>t}})),Yr=t((()=>{Kr(),Jr()})),O,Xr,Zr=t((()=>{O=e=>encodeURIComponent(e).replace(/[!'()*]/g,Xr),Xr=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`})),Qr=t((()=>{})),$r=t((()=>{Zr(),Qr()})),ei,ti=t((()=>{ei=e=>typeof ArrayBuffer==`function`&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)===`[object ArrayBuffer]`})),ni,ri=t((()=>{ni=(e,t)=>{if(typeof e!=`string`)throw TypeError(`The "input" argument must be of type string. Received type ${typeof e} (${e})`);return t?_.from(e,t):_.from(e)}})),k,ii=t((()=>{ri(),k=e=>{let t=ni(e,`utf8`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}})),A,ai=t((()=>{ii(),A=e=>typeof e==`string`?k(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)})),oi=t((()=>{})),j=t((()=>{ii(),ai(),oi()})),si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,M,Ci,wi,Ti,N=t((()=>{si=`X-Amz-Algorithm`,ci=`X-Amz-Credential`,li=`X-Amz-Date`,ui=`X-Amz-SignedHeaders`,di=`X-Amz-Expires`,fi=`X-Amz-Signature`,pi=`X-Amz-Security-Token`,mi=`authorization`,hi=li.toLowerCase(),gi=`date`,_i=[mi,hi,gi],fi.toLowerCase(),vi=`x-amz-content-sha256`,yi=pi.toLowerCase(),bi={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},xi=/^proxy-/,Si=/^sec-/,M=`AWS4-HMAC-SHA256`,Ci=`AWS4-HMAC-SHA256-PAYLOAD`,wi=`UNSIGNED-PAYLOAD`,Ti=`aws4_request`})),P,F,I,Ei,Di,Oi=t((()=>{D(),j(),N(),P={},F=[],I=(e,t,n)=>`${e}/${t}/${n}/${Ti}`,Ei=async(e,t,n,r,i)=>{let a=`${n}:${r}:${i}:${T(await Di(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(a in P)return P[a];for(F.push(a);F.length>50;)delete P[F.shift()];let o=`AWS4${t.secretAccessKey}`;for(let t of[n,r,i,Ti])o=await Di(e,o,t);return P[a]=o},Di=(e,t,n)=>{let r=new e(t);return r.update(A(n)),r.digest()}})),ki,Ai=t((()=>{N(),ki=({headers:e},t,n)=>{let r={};for(let i of Object.keys(e).sort()){if(e[i]==null)continue;let a=i.toLowerCase();(a in bi||t?.has(a)||xi.test(a)||Si.test(a))&&(!n||n&&!n.has(a))||(r[a]=e[i].trim().replace(/\s+/g,` `))}return r}})),ji,Mi=t((()=>{$r(),N(),ji=({query:e={}})=>{let t=[],n={};for(let r of Object.keys(e).sort()){if(r.toLowerCase()===`x-amz-signature`)continue;t.push(r);let i=e[r];typeof i==`string`?n[r]=`${O(r)}=${O(i)}`:Array.isArray(i)&&(n[r]=i.slice(0).reduce((e,t)=>e.concat([`${O(r)}=${O(t)}`]),[]).sort().join(`&`))}return t.map(e=>n[e]).filter(e=>e).join(`&`)}})),L,Ni=t((()=>{ti(),D(),j(),N(),L=async({headers:e,body:t},n)=>{for(let t of Object.keys(e))if(t.toLowerCase()===`x-amz-content-sha256`)return e[t];if(t==null)return`e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`;if(typeof t==`string`||ArrayBuffer.isView(t)||ei(t)){let e=new n;return e.update(A(t)),T(await e.digest())}return wi}}));function Pi(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var Fi,Ii,Li,Ri,zi=t((()=>{D(),j(),Fi=class{format(e){let t=[];for(let n of Object.keys(e)){let r=k(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}let n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case`boolean`:return Uint8Array.from([+!e.value]);case`byte`:return Uint8Array.from([2,e.value]);case`short`:let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case`integer`:let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case`long`:let r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case`binary`:let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case`string`:let o=k(e.value),s=new DataView(new ArrayBuffer(3+o.byteLength));s.setUint8(0,7),s.setUint16(1,o.byteLength,!1);let c=new Uint8Array(s.buffer);return c.set(o,3),c;case`timestamp`:let l=new Uint8Array(9);return l[0]=8,l.set(Ri.fromNumber(e.value.valueOf()).bytes,1),l;case`uuid`:if(!Li.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(Mn(e.value.replace(/\-/g,``)),1),u}}},(function(e){e[e.boolTrue=0]=`boolTrue`,e[e.boolFalse=1]=`boolFalse`,e[e.byte=2]=`byte`,e[e.short=3]=`short`,e[e.integer=4]=`integer`,e[e.long=5]=`long`,e[e.byteArray=6]=`byteArray`,e[e.string=7]=`string`,e[e.timestamp=8]=`timestamp`,e[e.uuid=9]=`uuid`})(Ii||(Ii={})),Li=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,Ri=class e{constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error(`Int64 buffers must be exactly 8 bytes`)}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let n=new Uint8Array(8);for(let e=7,r=Math.abs(Math.round(t));e>-1&&r>0;e--,r/=256)n[e]=r;return t<0&&Pi(n),new e(n)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;return t&&Pi(e),parseInt(T(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}})),Bi,Vi=t((()=>{Bi=(e,t)=>{e=e.toLowerCase();for(let n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1}})),Hi,Ui,Wi=t((()=>{Hi=({headers:e,query:t,...n})=>({...n,headers:{...e},query:t?Ui(t):void 0}),Ui=e=>Object.keys(e).reduce((t,n)=>{let r=e[n];return{...t,[n]:Array.isArray(r)?[...r]:r}},{})})),Gi,Ki=t((()=>{Wi(),Gi=(e,t={})=>{let{headers:n,query:r={}}=typeof e.clone==`function`?e.clone():Hi(e);for(let e of Object.keys(n)){let i=e.toLowerCase();i.slice(0,6)===`x-amz-`&&!t.unhoistableHeaders?.has(i)&&(r[e]=n[e],delete n[e])}return{...e,headers:n,query:r}}})),qi,Ji=t((()=>{Wi(),N(),qi=e=>{e=typeof e.clone==`function`?e.clone():Hi(e);for(let t of Object.keys(e.headers))_i.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e}})),Yi,Xi,Zi=t((()=>{Yi=e=>Xi(e).toISOString().replace(/\.\d{3}Z$/,`Z`),Xi=e=>typeof e==`number`?new Date(e*1e3):typeof e==`string`?Number(e)?new Date(Number(e)*1e3):new Date(e):e})),Qi,R,$i,ea=t((()=>{D(),Yr(),$r(),j(),N(),Oi(),Ai(),Mi(),Ni(),zi(),Vi(),Ki(),Ji(),Zi(),Qi=class{constructor({applyChecksum:e,credentials:t,region:n,service:r,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new Fi,this.service=r,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e!=`boolean`||e,this.regionProvider=qr(n),this.credentialProvider=qr(t)}async presign(e,t={}){let{signingDate:n=new Date,expiresIn:r=3600,unsignableHeaders:i,unhoistableHeaders:a,signableHeaders:o,signingRegion:s,signingService:c}=t,l=await this.credentialProvider();this.validateResolvedCredentials(l);let u=s??await this.regionProvider(),{longDate:d,shortDate:f}=R(n);if(r>604800)return Promise.reject(`Signature version 4 presigned URLs must have an expiration date less than one week in the future`);let p=I(f,u,c??this.service),m=Gi(qi(e),{unhoistableHeaders:a});l.sessionToken&&(m.query[pi]=l.sessionToken),m.query[si]=M,m.query[ci]=`${l.accessKeyId}/${p}`,m.query[li]=d,m.query[di]=r.toString(10);let h=ki(m,i,o);return m.query[ui]=$i(h),m.query[fi]=await this.getSignature(d,p,this.getSigningKey(l,u,f,c),this.createCanonicalRequest(m,h,await L(e,this.sha256))),m}async sign(e,t){return typeof e==`string`?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:n=new Date,priorSignature:r,signingRegion:i,signingService:a}){let o=i??await this.regionProvider(),{shortDate:s,longDate:c}=R(n),l=I(s,o,a??this.service),u=await L({headers:{},body:t},this.sha256),d=new this.sha256;d.update(e);let f=[Ci,c,l,r,T(await d.digest()),u].join(`
2
2
  `);return this.signString(f,{signingDate:n,signingRegion:o,signingService:a})}async signMessage(e,{signingDate:t=new Date,signingRegion:n,signingService:r}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:n,signingService:r,priorSignature:e.priorSignature}).then(t=>({message:e.message,signature:t}))}async signString(e,{signingDate:t=new Date,signingRegion:n,signingService:r}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:o}=R(t),s=new this.sha256(await this.getSigningKey(i,a,o,r));return s.update(A(e)),T(await s.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:r,signingRegion:i,signingService:a}={}){let o=await this.credentialProvider();this.validateResolvedCredentials(o);let s=i??await this.regionProvider(),c=qi(e),{longDate:l,shortDate:u}=R(t),d=I(u,s,a??this.service);c.headers[hi]=l,o.sessionToken&&(c.headers[yi]=o.sessionToken);let f=await L(c,this.sha256);!Bi(`x-amz-content-sha256`,c.headers)&&this.applyChecksum&&(c.headers[vi]=f);let p=ki(c,r,n),m=await this.getSignature(l,d,this.getSigningKey(o,s,u,a),this.createCanonicalRequest(c,p,f));return c.headers[mi]=`${M} Credential=${o.accessKeyId}/${d}, SignedHeaders=${$i(p)}, Signature=${m}`,c}createCanonicalRequest(e,t,n){let r=Object.keys(t).sort();return`${e.method}
3
3
  ${this.getCanonicalPath(e)}
4
4
  ${ji(e)}
@@ -9,7 +9,7 @@ ${r.join(`;`)}
9
9
  ${n}`}async createStringToSign(e,t,n){let r=new this.sha256;return r.update(A(n)),`${M}
10
10
  ${e}
11
11
  ${t}
12
- ${T(await r.digest())}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let t=[];for(let n of e.split(`/`))n?.length!==0&&n!==`.`&&(n===`..`?t.pop():t.push(n));return O(`${e?.startsWith(`/`)?`/`:``}${t.join(`/`)}${t.length>0&&e?.endsWith(`/`)?`/`:``}`).replace(/%2F/g,`/`)}return e}async getSignature(e,t,n,r){let i=await this.createStringToSign(e,t,r),a=new this.sha256(await n);return a.update(A(i)),T(await a.digest())}getSigningKey(e,t,n,r){return Ei(this.sha256,e,n,t,r||this.service)}validateResolvedCredentials(e){if(typeof e!=`object`||typeof e.accessKeyId!=`string`||typeof e.secretAccessKey!=`string`)throw Error(`Resolved credential object is not valid`)}},R=e=>{let t=Yi(e).replace(/[\-:]/g,``);return{longDate:t,shortDate:t.slice(0,8)}},$i=e=>Object.keys(e).sort().join(`;`)})),ta=t((()=>{ea(),Ai(),Mi(),Ni(),Ki(),Ji(),Oi()})),na,ra,ia,aa=t((()=>{na=ct(),Se(),w(),ta(),ra=()=>import(`./dist-es-CIULjvtA2.js`).then(({fromNodeProviderChain:e})=>e({clientConfig:{requestHandler:new be({requestInit:e=>({...e})})}})).catch(e=>{throw Error(`Failed to import '@aws-sdk/credential-providers'.You can provide a custom \`providerChainResolver\` in the client options if your runtime does not have access to '@aws-sdk/credential-providers': \`new AnthropicBedrock({ providerChainResolver })\` Original error: ${e.message}`)}),ia=async(e,t)=>{me(e.method,`Expected request method property to be set`);let n;n=t.awsAccessKey&&t.awsSecretKey?{accessKeyId:t.awsAccessKey,secretAccessKey:t.awsSecretKey,...t.awsSessionToken!=null&&{sessionToken:t.awsSessionToken}}:await(await(t.providerChainResolver?t.providerChainResolver():ra()))();let r=new Qi({service:`bedrock`,region:t.regionName,credentials:n,sha256:na.Sha256}),i=new URL(t.url),a=e.headers?Symbol.iterator in e.headers?Object.fromEntries(Array.from(e.headers).map(e=>[...e])):{...e.headers}:{};delete a.connection,a.host=i.hostname;let o=new Dn({method:e.method.toUpperCase(),protocol:i.protocol,path:i.pathname,headers:a,body:e.body});return(await r.sign(o)).headers}})),oa=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var n=(tt(),e(Qe)),r=typeof Buffer<`u`&&Buffer.from?function(e){return Buffer.from(e,`utf8`)}:n.fromUtf8;function i(e){return e instanceof Uint8Array?e:typeof e==`string`?r(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.convertToBuffer=i})),sa=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isEmptyData=void 0;function t(e){return typeof e==`string`?e.length===0:e.byteLength===0}e.isEmptyData=t})),ca=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.numToUint8=void 0;function t(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}e.numToUint8=t})),la=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=void 0;function t(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),n=0;n<e.length;)t[n]=e[n],n+=1;return t}return Uint32Array.from(e)}e.uint32ArrayFrom=t})),ua=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=e.numToUint8=e.isEmptyData=e.convertToBuffer=void 0;var t=oa();Object.defineProperty(e,"convertToBuffer",{enumerable:!0,get:function(){return t.convertToBuffer}});var n=sa();Object.defineProperty(e,"isEmptyData",{enumerable:!0,get:function(){return n.isEmptyData}});var r=ca();Object.defineProperty(e,"numToUint8",{enumerable:!0,get:function(){return r.numToUint8}});var i=la();Object.defineProperty(e,"uint32ArrayFrom",{enumerable:!0,get:function(){return i.uint32ArrayFrom}})})),da=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AwsCrc32=void 0;var n=(C(),e(y)),r=ua(),i=fa();t.AwsCrc32=function(){function e(){this.crc32=new i.Crc32}return e.prototype.update=function(e){(0,r.isEmptyData)(e)||this.crc32.update((0,r.convertToBuffer)(e))},e.prototype.digest=function(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){return[2,(0,r.numToUint8)(this.crc32.digest())]})})},e.prototype.reset=function(){this.crc32=new i.Crc32},e}()})),fa=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AwsCrc32=t.Crc32=t.crc32=void 0;var n=(C(),e(y)),r=ua();function i(e){return new a().update(e).digest()}t.crc32=i;var a=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(e){var t,r;try{for(var i=n.__values(e),a=i.next();!a.done;a=i.next()){var s=a.value;this.checksum=this.checksum>>>8^o[(this.checksum^s)&255]}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return this},e.prototype.digest=function(){return(this.checksum^4294967295)>>>0},e}();t.Crc32=a;var o=(0,r.uint32ArrayFrom)([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]),s=da();Object.defineProperty(t,"AwsCrc32",{enumerable:!0,get:function(){return s.AwsCrc32}})}));function pa(e){if(e.length%2!=0)throw Error(`Hex encoded strings must have an even number length`);let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){let r=e.slice(n,n+2).toLowerCase();if(r in B)t[n/2]=B[r];else throw Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`)}return t}function z(e){let t=``;for(let n=0;n<e.byteLength;n++)t+=ma[e[n]];return t}var ma,B,ha=t((()=>{ma={},B={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),ma[e]=t,B[t]=e}}));function ga(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var V,_a=t((()=>{ha(),V=class e{constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error(`Int64 buffers must be exactly 8 bytes`)}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let n=new Uint8Array(8);for(let e=7,r=Math.abs(Math.round(t));e>-1&&r>0;e--,r/=256)n[e]=r;return t<0&&ga(n),new e(n)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;return t&&ga(e),parseInt(z(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}})),va,ya,ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa=t((()=>{ha(),_a(),va=class{constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){let t=[];for(let n of Object.keys(e)){let r=this.fromUtf8(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}let n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case`boolean`:return Uint8Array.from([+!e.value]);case`byte`:return Uint8Array.from([2,e.value]);case`short`:let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case`integer`:let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case`long`:let r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case`binary`:let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case`string`:let o=this.fromUtf8(e.value),s=new DataView(new ArrayBuffer(3+o.byteLength));s.setUint8(0,7),s.setUint16(1,o.byteLength,!1);let c=new Uint8Array(s.buffer);return c.set(o,3),c;case`timestamp`:let l=new Uint8Array(9);return l[0]=8,l.set(V.fromNumber(e.value.valueOf()).bytes,1),l;case`uuid`:if(!ka.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(pa(e.value.replace(/\-/g,``)),1),u}}parse(e){let t={},n=0;for(;n<e.byteLength;){let r=e.getUint8(n++),i=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,r));switch(n+=r,e.getUint8(n++)){case 0:t[i]={type:ba,value:!0};break;case 1:t[i]={type:ba,value:!1};break;case 2:t[i]={type:xa,value:e.getInt8(n++)};break;case 3:t[i]={type:Sa,value:e.getInt16(n,!1)},n+=2;break;case 4:t[i]={type:Ca,value:e.getInt32(n,!1)},n+=4;break;case 5:t[i]={type:wa,value:new V(new Uint8Array(e.buffer,e.byteOffset+n,8))},n+=8;break;case 6:let r=e.getUint16(n,!1);n+=2,t[i]={type:Ta,value:new Uint8Array(e.buffer,e.byteOffset+n,r)},n+=r;break;case 7:let a=e.getUint16(n,!1);n+=2,t[i]={type:Ea,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,a))},n+=a;break;case 8:t[i]={type:Da,value:new Date(new V(new Uint8Array(e.buffer,e.byteOffset+n,8)).valueOf())},n+=8;break;case 9:let o=new Uint8Array(e.buffer,e.byteOffset+n,16);n+=16,t[i]={type:Oa,value:`${z(o.subarray(0,4))}-${z(o.subarray(4,6))}-${z(o.subarray(6,8))}-${z(o.subarray(8,10))}-${z(o.subarray(10))}`};break;default:throw Error(`Unrecognized header type tag`)}}return t}},(function(e){e[e.boolTrue=0]=`boolTrue`,e[e.boolFalse=1]=`boolFalse`,e[e.byte=2]=`byte`,e[e.short=3]=`short`,e[e.integer=4]=`integer`,e[e.long=5]=`long`,e[e.byteArray=6]=`byteArray`,e[e.string=7]=`string`,e[e.timestamp=8]=`timestamp`,e[e.uuid=9]=`uuid`})(ya||(ya={})),ba=`boolean`,xa=`byte`,Sa=`short`,Ca=`integer`,wa=`long`,Ta=`binary`,Ea=`string`,Da=`timestamp`,Oa=`uuid`,ka=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/}));function ja({byteLength:e,byteOffset:t,buffer:n}){if(e<Pa)throw Error(`Provided message too short to accommodate event stream message overhead`);let r=new DataView(n,t,e),i=r.getUint32(0,!1);if(e!==i)throw Error(`Reported message length does not match received message length`);let a=r.getUint32(Na,!1),o=r.getUint32(H,!1),s=r.getUint32(e-U,!1),c=new Ma.Crc32().update(new Uint8Array(n,t,H));if(o!==c.digest())throw Error(`The prelude checksum specified in the message (${o}) does not match the calculated CRC32 checksum (${c.digest()})`);if(c.update(new Uint8Array(n,t+H,e-12)),s!==c.digest())throw Error(`The message checksum (${c.digest()}) did not match the expected value of ${s}`);return{headers:new DataView(n,t+H+U,a),body:new Uint8Array(n,t+H+U+a,i-a-16)}}var Ma,Na,H,U,Pa,Fa=t((()=>{Ma=fa(),Na=4,H=Na*2,U=4,Pa=16})),Ia,La,Ra=t((()=>{Ia=fa(),Aa(),Fa(),La=class{constructor(e,t){this.headerMarshaller=new va(e,t),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),t=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return t}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let t=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return t}}}encode({headers:e,body:t}){let n=this.headerMarshaller.format(e),r=n.byteLength+t.byteLength+16,i=new Uint8Array(r),a=new DataView(i.buffer,i.byteOffset,i.byteLength),o=new Ia.Crc32;return a.setUint32(0,r,!1),a.setUint32(4,n.byteLength,!1),a.setUint32(8,o.update(i.subarray(0,8)).digest(),!1),i.set(n,12),i.set(t,n.byteLength+12),a.setUint32(r-4,o.update(i.subarray(8,r-4)).digest(),!1),i}decode(e){let{headers:t,body:n}=ja(e);return{headers:this.headerMarshaller.parse(t),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}}})),za=t((()=>{})),Ba,Va=t((()=>{Ba=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}}})),Ha,Ua=t((()=>{Ha=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array)}}})),Wa,Ga=t((()=>{Wa=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let t=await this.options.deserializer(e);t!==void 0&&(yield t)}}}})),Ka,qa=t((()=>{Ka=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}}})),Ja=t((()=>{Ra(),Aa(),_a(),za(),Va(),Ua(),Ga(),qa()}));function Ya(e){let t=0,n=0,r=null,i=null,a=e=>{if(typeof e!=`number`)throw Error(`Attempted to allocate an event message where size was not a number: `+e);t=e,n=4,r=new Uint8Array(e),new DataView(r.buffer).setUint32(0,e,!1)},o=async function*(){let o=e[Symbol.asyncIterator]();for(;;){let{value:e,done:s}=await o.next();if(s){if(!t)return;if(t===n)yield r;else throw Error(`Truncated event message received.`);return}let c=e.length,l=0;for(;l<c;){if(!r){let t=c-l;i||(i=new Uint8Array(4));let r=Math.min(4-n,t);if(i.set(e.slice(l,l+r),n),n+=r,l+=r,n<4)break;a(new DataView(i.buffer).getUint32(0,!1)),i=null}let o=Math.min(t-n,c-l);r.set(e.slice(l,l+o),n),n+=o,l+=o,t&&t===n&&(yield r,r=null,t=0,n=0)}}};return{[Symbol.asyncIterator]:o}}var Xa=t((()=>{}));function Za(e,t){return async function(n){let{value:r}=n.headers[`:message-type`];if(r===`error`){let e=Error(n.headers[`:error-message`].value||`UnknownError`);throw e.name=n.headers[`:error-code`].value,e}else if(r===`exception`){let r=n.headers[`:exception-type`].value,i=await e({[r]:n});if(i.$unknown){let e=Error(t(n.body));throw e.name=r,e}throw i[r]}else if(r===`event`){let t=await e({[n.headers[`:event-type`].value]:n});return t.$unknown?void 0:t}else throw Error(`Unrecognizable event type: ${n.headers[`:event-type`].value}`)}}var Qa=t((()=>{})),$a,eo=t((()=>{Ja(),Xa(),Qa(),$a=class{constructor({utf8Encoder:e,utf8Decoder:t}){this.eventStreamCodec=new La(e,t),this.utfEncoder=e}deserialize(e,t){return new Wa({messageStream:new Ba({inputStream:Ya(e),decoder:this.eventStreamCodec}),deserializer:Za(t,this.utfEncoder)})}serialize(e,t){return new Ha({messageStream:new Ka({inputStream:e,serializer:t}),encoder:this.eventStreamCodec,includeEndFrame:!0})}}})),to=t((()=>{eo()})),no=t((()=>{eo(),to()}));async function*ro(e){let t=!1,n=!1,r=[];for(e.on(`error`,e=>{if(t||(t=!0),e)throw e}),e.on(`data`,e=>{r.push(e)}),e.on(`end`,()=>{t=!0});!n;){let e=await new Promise(e=>setTimeout(()=>e(r.shift()),0));e&&(yield e),n=t&&r.length===0}}var io=t((()=>{})),ao,oo=t((()=>{no(),io(),ao=class{constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new $a({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){let n=typeof e[Symbol.asyncIterator]==`function`?e:ro(e);return this.universalMarshaller.deserialize(n,t)}serialize(e,t){return pe.from(this.universalMarshaller.serialize(e,t))}}})),so=t((()=>{oo()})),co=t((()=>{oo(),so()})),lo,uo=t((()=>{lo=e=>typeof ArrayBuffer==`function`&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)===`[object ArrayBuffer]`})),fo,po,W=t((()=>{uo(),fo=(e,t=0,n=e.byteLength-t)=>{if(!lo(e))throw TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof e} (${e})`);return _.from(e,t,n)},po=(e,t)=>{if(typeof e!=`string`)throw TypeError(`The "input" argument must be of type string. Received type ${typeof e} (${e})`);return t?_.from(e,t):_.from(e)}})),mo,ho,go=t((()=>{W(),mo=/^[A-Za-z0-9+/]*={0,2}$/,ho=e=>{if(e.length*3%4!=0)throw TypeError(`Incorrect padding on base64 string.`);if(!mo.exec(e))throw TypeError(`Invalid base64 string.`);let t=po(e,`base64`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}})),_o,vo=t((()=>{W(),_o=e=>{let t=po(e,`utf8`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}})),yo=t((()=>{})),bo,xo=t((()=>{W(),bo=e=>{if(typeof e==`string`)return e;if(typeof e!=`object`||typeof e.byteOffset!=`number`||typeof e.byteLength!=`number`)throw Error(`@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.`);return fo(e.buffer,e.byteOffset,e.byteLength).toString(`utf8`)}})),So=t((()=>{vo(),yo(),xo()})),Co,wo=t((()=>{W(),So(),Co=e=>{let t;if(t=typeof e==`string`?_o(e):e,typeof t!=`object`||typeof t.byteOffset!=`number`||typeof t.byteLength!=`number`)throw Error(`@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.`);return fo(t.buffer,t.byteOffset,t.byteLength).toString(`base64`)}})),To=t((()=>{go(),wo()})),Eo=t((()=>{m(),d(),p(),ee()})),Do=t((()=>{})),Oo=t((()=>{})),ko=t((()=>{Oo()})),Ao=t((()=>{ko()}));function jo(e,t=`utf-8`){return t===`base64`?Co(e):bo(e)}function Mo(e,t){return t===`base64`?G.mutate(ho(e)):G.mutate(_o(e))}var No=t((()=>{To(),So(),Po()})),G,Po=t((()=>{No(),G=class e extends Uint8Array{static fromString(e,t=`utf-8`){switch(typeof e){case`string`:return Mo(e,t);default:throw Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(t){return Object.setPrototypeOf(t,e.prototype),t}transformToString(e=`utf-8`){return jo(this,e)}}})),Fo=t((()=>{})),Io=t((()=>{})),Lo=t((()=>{})),Ro=t((()=>{Io(),Lo()})),zo=t((()=>{Ro()})),Bo=t((()=>{w(),zo()})),Vo=t((()=>{w(),zo()})),Ho=t((()=>{})),Uo=t((()=>{Bo(),Vo(),Ho()})),Wo=t((()=>{Uo()})),Go=t((()=>{Po(),Fo(),Wo()})),Ko,qo=t((()=>{Go(),Ko=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return G.mutate(e);if(!e)return G.mutate(new Uint8Array);let n=t.streamCollector(e);return G.mutate(await n)}})),Jo=t((()=>{ko(),Sn()})),Yo=t((()=>{})),Xo=t((()=>{})),Zo,Qo,$o,es,K,ts,ns,rs=t((()=>{Zo=e=>{if(e!=null){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw TypeError(`Expected integer, got ${typeof e}: ${e}`)}},Qo=e=>$o(e,32),$o=(e,t)=>{let n=Zo(e);if(n!==void 0&&es(n,t)!==n)throw TypeError(`Expected ${t}-bit integer, got ${e}`);return n},es=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},K=e=>{if(e!=null){if(typeof e==`string`)return e;if([`boolean`,`number`,`bigint`].includes(typeof e))return ns.warn(ts(`Expected string, got ${typeof e}: ${e}`)),String(e);throw TypeError(`Expected string, got ${typeof e}: ${e}`)}},ts=e=>String(TypeError(e).stack||e).split(`
12
+ ${T(await r.digest())}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let t=[];for(let n of e.split(`/`))n?.length!==0&&n!==`.`&&(n===`..`?t.pop():t.push(n));return O(`${e?.startsWith(`/`)?`/`:``}${t.join(`/`)}${t.length>0&&e?.endsWith(`/`)?`/`:``}`).replace(/%2F/g,`/`)}return e}async getSignature(e,t,n,r){let i=await this.createStringToSign(e,t,r),a=new this.sha256(await n);return a.update(A(i)),T(await a.digest())}getSigningKey(e,t,n,r){return Ei(this.sha256,e,n,t,r||this.service)}validateResolvedCredentials(e){if(typeof e!=`object`||typeof e.accessKeyId!=`string`||typeof e.secretAccessKey!=`string`)throw Error(`Resolved credential object is not valid`)}},R=e=>{let t=Yi(e).replace(/[\-:]/g,``);return{longDate:t,shortDate:t.slice(0,8)}},$i=e=>Object.keys(e).sort().join(`;`)})),ta=t((()=>{ea(),Ai(),Mi(),Ni(),Ki(),Ji(),Oi()})),na,ra,ia,aa=t((()=>{na=ct(),Se(),w(),ta(),ra=()=>import(`./dist-es-hwK6468D.js`).then(({fromNodeProviderChain:e})=>e({clientConfig:{requestHandler:new be({requestInit:e=>({...e})})}})).catch(e=>{throw Error(`Failed to import '@aws-sdk/credential-providers'.You can provide a custom \`providerChainResolver\` in the client options if your runtime does not have access to '@aws-sdk/credential-providers': \`new AnthropicBedrock({ providerChainResolver })\` Original error: ${e.message}`)}),ia=async(e,t)=>{me(e.method,`Expected request method property to be set`);let n;n=t.awsAccessKey&&t.awsSecretKey?{accessKeyId:t.awsAccessKey,secretAccessKey:t.awsSecretKey,...t.awsSessionToken!=null&&{sessionToken:t.awsSessionToken}}:await(await(t.providerChainResolver?t.providerChainResolver():ra()))();let r=new Qi({service:`bedrock`,region:t.regionName,credentials:n,sha256:na.Sha256}),i=new URL(t.url),a=e.headers?Symbol.iterator in e.headers?Object.fromEntries(Array.from(e.headers).map(e=>[...e])):{...e.headers}:{};delete a.connection,a.host=i.hostname;let o=new Dn({method:e.method.toUpperCase(),protocol:i.protocol,path:i.pathname,headers:a,body:e.body});return(await r.sign(o)).headers}})),oa=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var n=(tt(),e(Qe)),r=typeof Buffer<`u`&&Buffer.from?function(e){return Buffer.from(e,`utf8`)}:n.fromUtf8;function i(e){return e instanceof Uint8Array?e:typeof e==`string`?r(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.convertToBuffer=i})),sa=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isEmptyData=void 0;function t(e){return typeof e==`string`?e.length===0:e.byteLength===0}e.isEmptyData=t})),ca=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.numToUint8=void 0;function t(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}e.numToUint8=t})),la=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=void 0;function t(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),n=0;n<e.length;)t[n]=e[n],n+=1;return t}return Uint32Array.from(e)}e.uint32ArrayFrom=t})),ua=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uint32ArrayFrom=e.numToUint8=e.isEmptyData=e.convertToBuffer=void 0;var t=oa();Object.defineProperty(e,"convertToBuffer",{enumerable:!0,get:function(){return t.convertToBuffer}});var n=sa();Object.defineProperty(e,"isEmptyData",{enumerable:!0,get:function(){return n.isEmptyData}});var r=ca();Object.defineProperty(e,"numToUint8",{enumerable:!0,get:function(){return r.numToUint8}});var i=la();Object.defineProperty(e,"uint32ArrayFrom",{enumerable:!0,get:function(){return i.uint32ArrayFrom}})})),da=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AwsCrc32=void 0;var n=(C(),e(y)),r=ua(),i=fa();t.AwsCrc32=function(){function e(){this.crc32=new i.Crc32}return e.prototype.update=function(e){(0,r.isEmptyData)(e)||this.crc32.update((0,r.convertToBuffer)(e))},e.prototype.digest=function(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){return[2,(0,r.numToUint8)(this.crc32.digest())]})})},e.prototype.reset=function(){this.crc32=new i.Crc32},e}()})),fa=r((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AwsCrc32=t.Crc32=t.crc32=void 0;var n=(C(),e(y)),r=ua();function i(e){return new a().update(e).digest()}t.crc32=i;var a=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(e){var t,r;try{for(var i=n.__values(e),a=i.next();!a.done;a=i.next()){var s=a.value;this.checksum=this.checksum>>>8^o[(this.checksum^s)&255]}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return this},e.prototype.digest=function(){return(this.checksum^4294967295)>>>0},e}();t.Crc32=a;var o=(0,r.uint32ArrayFrom)([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]),s=da();Object.defineProperty(t,"AwsCrc32",{enumerable:!0,get:function(){return s.AwsCrc32}})}));function pa(e){if(e.length%2!=0)throw Error(`Hex encoded strings must have an even number length`);let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){let r=e.slice(n,n+2).toLowerCase();if(r in B)t[n/2]=B[r];else throw Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`)}return t}function z(e){let t=``;for(let n=0;n<e.byteLength;n++)t+=ma[e[n]];return t}var ma,B,ha=t((()=>{ma={},B={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),ma[e]=t,B[t]=e}}));function ga(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var V,_a=t((()=>{ha(),V=class e{constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error(`Int64 buffers must be exactly 8 bytes`)}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let n=new Uint8Array(8);for(let e=7,r=Math.abs(Math.round(t));e>-1&&r>0;e--,r/=256)n[e]=r;return t<0&&ga(n),new e(n)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;return t&&ga(e),parseInt(z(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}})),va,ya,ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa=t((()=>{ha(),_a(),va=class{constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){let t=[];for(let n of Object.keys(e)){let r=this.fromUtf8(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}let n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case`boolean`:return Uint8Array.from([+!e.value]);case`byte`:return Uint8Array.from([2,e.value]);case`short`:let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case`integer`:let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case`long`:let r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case`binary`:let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case`string`:let o=this.fromUtf8(e.value),s=new DataView(new ArrayBuffer(3+o.byteLength));s.setUint8(0,7),s.setUint16(1,o.byteLength,!1);let c=new Uint8Array(s.buffer);return c.set(o,3),c;case`timestamp`:let l=new Uint8Array(9);return l[0]=8,l.set(V.fromNumber(e.value.valueOf()).bytes,1),l;case`uuid`:if(!ka.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(pa(e.value.replace(/\-/g,``)),1),u}}parse(e){let t={},n=0;for(;n<e.byteLength;){let r=e.getUint8(n++),i=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,r));switch(n+=r,e.getUint8(n++)){case 0:t[i]={type:ba,value:!0};break;case 1:t[i]={type:ba,value:!1};break;case 2:t[i]={type:xa,value:e.getInt8(n++)};break;case 3:t[i]={type:Sa,value:e.getInt16(n,!1)},n+=2;break;case 4:t[i]={type:Ca,value:e.getInt32(n,!1)},n+=4;break;case 5:t[i]={type:wa,value:new V(new Uint8Array(e.buffer,e.byteOffset+n,8))},n+=8;break;case 6:let r=e.getUint16(n,!1);n+=2,t[i]={type:Ta,value:new Uint8Array(e.buffer,e.byteOffset+n,r)},n+=r;break;case 7:let a=e.getUint16(n,!1);n+=2,t[i]={type:Ea,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,a))},n+=a;break;case 8:t[i]={type:Da,value:new Date(new V(new Uint8Array(e.buffer,e.byteOffset+n,8)).valueOf())},n+=8;break;case 9:let o=new Uint8Array(e.buffer,e.byteOffset+n,16);n+=16,t[i]={type:Oa,value:`${z(o.subarray(0,4))}-${z(o.subarray(4,6))}-${z(o.subarray(6,8))}-${z(o.subarray(8,10))}-${z(o.subarray(10))}`};break;default:throw Error(`Unrecognized header type tag`)}}return t}},(function(e){e[e.boolTrue=0]=`boolTrue`,e[e.boolFalse=1]=`boolFalse`,e[e.byte=2]=`byte`,e[e.short=3]=`short`,e[e.integer=4]=`integer`,e[e.long=5]=`long`,e[e.byteArray=6]=`byteArray`,e[e.string=7]=`string`,e[e.timestamp=8]=`timestamp`,e[e.uuid=9]=`uuid`})(ya||(ya={})),ba=`boolean`,xa=`byte`,Sa=`short`,Ca=`integer`,wa=`long`,Ta=`binary`,Ea=`string`,Da=`timestamp`,Oa=`uuid`,ka=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/}));function ja({byteLength:e,byteOffset:t,buffer:n}){if(e<Pa)throw Error(`Provided message too short to accommodate event stream message overhead`);let r=new DataView(n,t,e),i=r.getUint32(0,!1);if(e!==i)throw Error(`Reported message length does not match received message length`);let a=r.getUint32(Na,!1),o=r.getUint32(H,!1),s=r.getUint32(e-U,!1),c=new Ma.Crc32().update(new Uint8Array(n,t,H));if(o!==c.digest())throw Error(`The prelude checksum specified in the message (${o}) does not match the calculated CRC32 checksum (${c.digest()})`);if(c.update(new Uint8Array(n,t+H,e-12)),s!==c.digest())throw Error(`The message checksum (${c.digest()}) did not match the expected value of ${s}`);return{headers:new DataView(n,t+H+U,a),body:new Uint8Array(n,t+H+U+a,i-a-16)}}var Ma,Na,H,U,Pa,Fa=t((()=>{Ma=fa(),Na=4,H=Na*2,U=4,Pa=16})),Ia,La,Ra=t((()=>{Ia=fa(),Aa(),Fa(),La=class{constructor(e,t){this.headerMarshaller=new va(e,t),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),t=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return t}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let t=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return t}}}encode({headers:e,body:t}){let n=this.headerMarshaller.format(e),r=n.byteLength+t.byteLength+16,i=new Uint8Array(r),a=new DataView(i.buffer,i.byteOffset,i.byteLength),o=new Ia.Crc32;return a.setUint32(0,r,!1),a.setUint32(4,n.byteLength,!1),a.setUint32(8,o.update(i.subarray(0,8)).digest(),!1),i.set(n,12),i.set(t,n.byteLength+12),a.setUint32(r-4,o.update(i.subarray(8,r-4)).digest(),!1),i}decode(e){let{headers:t,body:n}=ja(e);return{headers:this.headerMarshaller.parse(t),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}}})),za=t((()=>{})),Ba,Va=t((()=>{Ba=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}}})),Ha,Ua=t((()=>{Ha=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array)}}})),Wa,Ga=t((()=>{Wa=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let t=await this.options.deserializer(e);t!==void 0&&(yield t)}}}})),Ka,qa=t((()=>{Ka=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}}})),Ja=t((()=>{Ra(),Aa(),_a(),za(),Va(),Ua(),Ga(),qa()}));function Ya(e){let t=0,n=0,r=null,i=null,a=e=>{if(typeof e!=`number`)throw Error(`Attempted to allocate an event message where size was not a number: `+e);t=e,n=4,r=new Uint8Array(e),new DataView(r.buffer).setUint32(0,e,!1)},o=async function*(){let o=e[Symbol.asyncIterator]();for(;;){let{value:e,done:s}=await o.next();if(s){if(!t)return;if(t===n)yield r;else throw Error(`Truncated event message received.`);return}let c=e.length,l=0;for(;l<c;){if(!r){let t=c-l;i||(i=new Uint8Array(4));let r=Math.min(4-n,t);if(i.set(e.slice(l,l+r),n),n+=r,l+=r,n<4)break;a(new DataView(i.buffer).getUint32(0,!1)),i=null}let o=Math.min(t-n,c-l);r.set(e.slice(l,l+o),n),n+=o,l+=o,t&&t===n&&(yield r,r=null,t=0,n=0)}}};return{[Symbol.asyncIterator]:o}}var Xa=t((()=>{}));function Za(e,t){return async function(n){let{value:r}=n.headers[`:message-type`];if(r===`error`){let e=Error(n.headers[`:error-message`].value||`UnknownError`);throw e.name=n.headers[`:error-code`].value,e}else if(r===`exception`){let r=n.headers[`:exception-type`].value,i=await e({[r]:n});if(i.$unknown){let e=Error(t(n.body));throw e.name=r,e}throw i[r]}else if(r===`event`){let t=await e({[n.headers[`:event-type`].value]:n});return t.$unknown?void 0:t}else throw Error(`Unrecognizable event type: ${n.headers[`:event-type`].value}`)}}var Qa=t((()=>{})),$a,eo=t((()=>{Ja(),Xa(),Qa(),$a=class{constructor({utf8Encoder:e,utf8Decoder:t}){this.eventStreamCodec=new La(e,t),this.utfEncoder=e}deserialize(e,t){return new Wa({messageStream:new Ba({inputStream:Ya(e),decoder:this.eventStreamCodec}),deserializer:Za(t,this.utfEncoder)})}serialize(e,t){return new Ha({messageStream:new Ka({inputStream:e,serializer:t}),encoder:this.eventStreamCodec,includeEndFrame:!0})}}})),to=t((()=>{eo()})),no=t((()=>{eo(),to()}));async function*ro(e){let t=!1,n=!1,r=[];for(e.on(`error`,e=>{if(t||(t=!0),e)throw e}),e.on(`data`,e=>{r.push(e)}),e.on(`end`,()=>{t=!0});!n;){let e=await new Promise(e=>setTimeout(()=>e(r.shift()),0));e&&(yield e),n=t&&r.length===0}}var io=t((()=>{})),ao,oo=t((()=>{no(),io(),ao=class{constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new $a({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){let n=typeof e[Symbol.asyncIterator]==`function`?e:ro(e);return this.universalMarshaller.deserialize(n,t)}serialize(e,t){return pe.from(this.universalMarshaller.serialize(e,t))}}})),so=t((()=>{oo()})),co=t((()=>{oo(),so()})),lo,uo=t((()=>{lo=e=>typeof ArrayBuffer==`function`&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)===`[object ArrayBuffer]`})),fo,po,W=t((()=>{uo(),fo=(e,t=0,n=e.byteLength-t)=>{if(!lo(e))throw TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof e} (${e})`);return _.from(e,t,n)},po=(e,t)=>{if(typeof e!=`string`)throw TypeError(`The "input" argument must be of type string. Received type ${typeof e} (${e})`);return t?_.from(e,t):_.from(e)}})),mo,ho,go=t((()=>{W(),mo=/^[A-Za-z0-9+/]*={0,2}$/,ho=e=>{if(e.length*3%4!=0)throw TypeError(`Incorrect padding on base64 string.`);if(!mo.exec(e))throw TypeError(`Invalid base64 string.`);let t=po(e,`base64`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}})),_o,vo=t((()=>{W(),_o=e=>{let t=po(e,`utf8`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}})),yo=t((()=>{})),bo,xo=t((()=>{W(),bo=e=>{if(typeof e==`string`)return e;if(typeof e!=`object`||typeof e.byteOffset!=`number`||typeof e.byteLength!=`number`)throw Error(`@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.`);return fo(e.buffer,e.byteOffset,e.byteLength).toString(`utf8`)}})),So=t((()=>{vo(),yo(),xo()})),Co,wo=t((()=>{W(),So(),Co=e=>{let t;if(t=typeof e==`string`?_o(e):e,typeof t!=`object`||typeof t.byteOffset!=`number`||typeof t.byteLength!=`number`)throw Error(`@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.`);return fo(t.buffer,t.byteOffset,t.byteLength).toString(`base64`)}})),To=t((()=>{go(),wo()})),Eo=t((()=>{m(),d(),p(),ee()})),Do=t((()=>{})),Oo=t((()=>{})),ko=t((()=>{Oo()})),Ao=t((()=>{ko()}));function jo(e,t=`utf-8`){return t===`base64`?Co(e):bo(e)}function Mo(e,t){return t===`base64`?G.mutate(ho(e)):G.mutate(_o(e))}var No=t((()=>{To(),So(),Po()})),G,Po=t((()=>{No(),G=class e extends Uint8Array{static fromString(e,t=`utf-8`){switch(typeof e){case`string`:return Mo(e,t);default:throw Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(t){return Object.setPrototypeOf(t,e.prototype),t}transformToString(e=`utf-8`){return jo(this,e)}}})),Fo=t((()=>{})),Io=t((()=>{})),Lo=t((()=>{})),Ro=t((()=>{Io(),Lo()})),zo=t((()=>{Ro()})),Bo=t((()=>{w(),zo()})),Vo=t((()=>{w(),zo()})),Ho=t((()=>{})),Uo=t((()=>{Bo(),Vo(),Ho()})),Wo=t((()=>{Uo()})),Go=t((()=>{Po(),Fo(),Wo()})),Ko,qo=t((()=>{Go(),Ko=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return G.mutate(e);if(!e)return G.mutate(new Uint8Array);let n=t.streamCollector(e);return G.mutate(await n)}})),Jo=t((()=>{ko(),Sn()})),Yo=t((()=>{})),Xo=t((()=>{})),Zo,Qo,$o,es,K,ts,ns,rs=t((()=>{Zo=e=>{if(e!=null){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw TypeError(`Expected integer, got ${typeof e}: ${e}`)}},Qo=e=>$o(e,32),$o=(e,t)=>{let n=Zo(e);if(n!==void 0&&es(n,t)!==n)throw TypeError(`Expected ${t}-bit integer, got ${e}`);return n},es=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},K=e=>{if(e!=null){if(typeof e==`string`)return e;if([`boolean`,`number`,`bigint`].includes(typeof e))return ns.warn(ts(`Expected string, got ${typeof e}: ${e}`)),String(e);throw TypeError(`Expected string, got ${typeof e}: ${e}`)}},ts=e=>String(TypeError(e).stack||e).split(`
13
13
  `).slice(0,5).filter(e=>!e.includes(`stackTraceWarning`)).join(`
14
14
  `),ns={warn:console.warn}})),is=t((()=>{})),q,as=t((()=>{q=(e,t={})=>(Object.entries(t).filter(([,e])=>e!==void 0).forEach(([t,n])=>{(e[t]==null||e[t]===``)&&(e[t]=n)}),e.message=e.message||e.Message||`UnknownError`,delete e.Message,e)})),os=t((()=>{})),ss=t((()=>{})),cs=t((()=>{})),ls=t((()=>{Sn()})),us=t((()=>{ls()})),ds=t((()=>{us()})),fs=t((()=>{})),ps=t((()=>{})),ms=t((()=>{})),J,hs=t((()=>{J=function(){let e=Object.getPrototypeOf(this).constructor,t=new(Function.bind.apply(String,[null,...arguments]));return Object.setPrototypeOf(t,e.prototype),t},J.prototype=Object.create(String.prototype,{constructor:{value:J,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(J,String)}));function Y(e,t,n){let r,i,a;if(t===void 0&&n===void 0)r={},a=e;else{if(r=e,typeof t==`function`)return i=t,a=n,gs(r,i,a);a=t}for(let e of Object.keys(a)){if(!Array.isArray(a[e])){r[e]=a[e];continue}_s(r,null,a,e)}return r}var X,gs,_s,vs,ys,bs=t((()=>{X=(e,t)=>{let n={};for(let r in t)_s(n,e,t,r);return n},gs=(e,t,n)=>Y(e,Object.entries(n).reduce((e,[n,r])=>(Array.isArray(r)?e[n]=r:typeof r==`function`?e[n]=[t,r()]:e[n]=[t,r],e),{})),_s=(e,t,n,r)=>{if(t!==null){let i=n[r];typeof i==`function`&&(i=[,i]);let[a=vs,o=ys,s=r]=i;(typeof a==`function`&&a(t[s])||typeof a!=`function`&&a)&&(e[r]=o(t[s]));return}let[i,a]=n[r];if(typeof a==`function`){let t,n=i===void 0&&(t=a())!=null,o=typeof i==`function`&&!!i(void 0)||typeof i!=`function`&&!!i;n?e[r]=t:o&&(e[r]=a())}else{let t=i===void 0&&a!=null,n=typeof i==`function`&&!!i(a)||typeof i!=`function`&&!!i;(t||n)&&(e[r]=a)}},vs=e=>e!=null,ys=e=>e})),xs=t((()=>{})),Ss=t((()=>{})),Cs=t((()=>{})),ws=t((()=>{})),Ts=t((()=>{Do(),Ao(),qo(),Jo(),Yo(),Xo(),is(),os(),ss(),cs(),ds(),as(),fs(),ps(),ms(),hs(),bs(),rs(),xs(),Ss(),Cs(),ws()})),Es,Ds,Os,ks,As,js,Ms,Ns,Ps,Fs,Is,Z,Ls,Q,Rs=t((()=>{Ts(),fe(),Es=async(e,t)=>{let n=Y({}),r=e.body,i=X(r,{message:K});return Object.assign(n,i),q(new ue({$metadata:Z(e),...n}),e.body)},Ds=async(e,t)=>{let n=Y({}),r=e.body,i=X(r,{message:K,originalMessage:K,originalStatusCode:Qo});return Object.assign(n,i),q(new le({$metadata:Z(e),...n}),e.body)},Os=async(e,t)=>{let n=Y({}),r=e.body,i=X(r,{message:K});return Object.assign(n,i),q(new ce({$metadata:Z(e),...n}),e.body)},ks=async(e,t)=>{let n=Y({}),r=e.body,i=X(r,{message:K});return Object.assign(n,i),q(new de({$metadata:Z(e),...n}),e.body)},As=(e,t)=>t.eventStreamMarshaller.deserialize(e,async n=>n.chunk==null?n.internalServerException==null?n.modelStreamErrorException==null?n.validationException==null?n.throttlingException==null?{$unknown:e}:{throttlingException:await Ps(n.throttlingException,t)}:{validationException:await Fs(n.validationException,t)}:{modelStreamErrorException:await Ms(n.modelStreamErrorException,t)}:{internalServerException:await js(n.internalServerException,t)}:{chunk:await Ns(n.chunk,t)}),js=async(e,t)=>{let n={...e,body:await Q(e.body,t)};return Es(n,t)},Ms=async(e,t)=>{let n={...e,body:await Q(e.body,t)};return Ds(n,t)},Ns=async(e,t)=>{let n={},r=await Q(e.body,t);return Object.assign(n,Is(r,t)),n},Ps=async(e,t)=>{let n={...e,body:await Q(e.body,t)};return Os(n,t)},Fs=async(e,t)=>{let n={...e,body:await Q(e.body,t)};return ks(n,t)},Is=(e,t)=>X(e,{bytes:t.base64Decoder}),Z=e=>({httpStatusCode:e.statusCode,requestId:e.headers[`x-amzn-requestid`]??e.headers[`x-amzn-request-id`]??e.headers[`x-amz-request-id`]??``,extendedRequestId:e.headers[`x-amz-id-2`]??``,cfId:e.headers[`x-amz-cf-id`]??``}),Ls=(e,t)=>Ko(e,t).then(e=>t.utf8Encoder(e)),Q=(e,t)=>Ls(e,t).then(e=>e.length?JSON.parse(e):{})}));function zs(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var Bs=t((()=>{})),Vs=t((()=>{ee()}));function Hs(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Us,Ws,Gs,Ks=t((()=>{Vs(),Us=e=>(Us=Array.isArray,Us(e)),Ws=Us,Gs=e=>{try{return JSON.parse(e)}catch{return}}}));function $(){}function qs(e,t,n){return!t||Ys[e]>Ys[n]?$:t[e].bind(t)}function Js(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return Xs;let r=Zs.get(t);if(r&&r[0]===n)return r[1];let i={error:qs(`error`,t,n),warn:qs(`warn`,t,n),info:qs(`info`,t,n),debug:qs(`debug`,t,n)};return Zs.set(t,[n,i]),i}var Ys,Xs,Zs,Qs=t((()=>{Ks(),Ys={off:0,error:200,warn:300,info:400,debug:500},Xs={error:$,warn:$,info:$,debug:$},Zs=new WeakMap}));function $s(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var ec,tc,nc,rc,ic=t((()=>{co(),To(),Se(),o(),s(),Eo(),Rs(),Bs(),Ks(),Qs(),ec=e=>new TextDecoder(`utf-8`).decode(e),tc=e=>new TextEncoder().encode(e),nc=()=>{let e=new ao({utf8Encoder:ec,utf8Decoder:tc});return{base64Decoder:ho,base64Encoder:Co,utf8Decoder:tc,utf8Encoder:ec,eventStreamMarshaller:e,streamCollector:oe}},rc=class e extends c{static fromSSEResponse(t,n,r){let a=!1,o=r?Js(r):console;async function*s(){if(!t.body)throw n.abort(),new g(`Attempted to iterate over a response with no body`);let e=As(zs(t.body),nc());for await(let t of e)t.chunk&&t.chunk.bytes?yield{event:`chunk`,data:ec(t.chunk.bytes),raw:[]}:t.internalServerException?yield{event:`error`,data:`InternalServerException`,raw:[]}:t.modelStreamErrorException?yield{event:`error`,data:`ModelStreamErrorException`,raw:[]}:t.validationException?yield{event:`error`,data:`ValidationException`,raw:[]}:t.throttlingException&&(yield{event:`error`,data:`ThrottlingException`,raw:[]})}async function*c(){if(a)throw Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");a=!0;let e=!1;try{for await(let e of s()){if(e.event===`chunk`){let n;try{n=JSON.parse(e.data)}catch(t){throw o.error(`Could not parse message into JSON:`,e.data),o.error(`From chunk:`,e.raw),t}if(n&&typeof n==`object`&&n.type===`error`)throw new i(void 0,n,void 0,t.headers,n.error?.type);yield n}if(e.event===`error`){let n=e.data,r=Gs(n),a=r?void 0:n;throw i.generate(void 0,r,a,t.headers)}}e=!0}catch(e){if($s(e))return;throw e}finally{e||n.abort()}}return new e(c,n)}}})),ac,oc=t((()=>{ac=e=>{if(globalThis.process!==void 0)return globalThis.process.env?.[e]?.trim()||void 0;if(globalThis.Deno!==void 0)return globalThis.Deno.env?.get?.(e)?.trim()||void 0}}));function*sc(e){if(!e)return;if(cc in e){let{values:t,nulls:n}=e;yield*t.entries();for(let e of n)yield[e,null];return}let t=!1,n;e instanceof Headers?n=e.entries():Ws(e)?n=e:(t=!0,n=Object.entries(e??{}));for(let e of n){let n=e[0];if(typeof n!=`string`)throw TypeError(`expected header name to be a string`);let r=Ws(e[1])?e[1]:[e[1]],i=!1;for(let e of r)e!==void 0&&(t&&!i&&(i=!0,yield[n,null]),yield[n,e])}}var cc,lc,uc=t((()=>{Ks(),cc=Symbol.for(`brand.privateNullableHeaders`),lc=e=>{let t=new Headers,n=new Set;for(let r of e){let e=new Set;for(let[i,a]of sc(r)){let r=i.toLowerCase();e.has(r)||(t.delete(i),e.add(r)),a===null?(t.delete(i),n.add(r)):(t.append(i,a),n.delete(r))}}return{[cc]:!0,values:t,nulls:n}}}));function dc(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var fc,pc,mc,hc=t((()=>{Vs(),fc=Object.freeze(Object.create(null)),pc=(e=dc)=>function(t,...n){if(t.length===1)return t[0];let r=!1,i=[],a=t.reduce((t,a,o)=>{/[?#]/.test(a)&&(r=!0);let s=n[o],c=(r?encodeURIComponent:e)(``+s);return o!==n.length&&(s==null||typeof s==`object`&&s.toString===Object.getPrototypeOf(Object.getPrototypeOf(s.hasOwnProperty??fc)??fc)?.toString)&&(c=s+``,i.push({start:t.length+a.length,length:c.length,error:`Value of type ${Object.prototype.toString.call(s).slice(8,-1)} is not a valid path parameter`})),t+a+(o===n.length?``:c)},``),o=a.split(/[?#]/,1)[0],s=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,c;for(;(c=s.exec(o))!==null;)i.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can\'t be safely passed as a path parameter`});if(i.sort((e,t)=>e.start-t.start),i.length>0){let e=0,t=i.reduce((t,n)=>{let r=` `.repeat(n.start-e),i=`^`.repeat(n.length);return e=n.start+n.length,t+r+i},``);throw new g(`Path parameters result in path with invalid segments:\n${i.map(e=>e.error).join(`
15
15
  `)}\n${a}\n${t}`)}return a},mc=pc(dc)}));function gc(e){let t=new a(e);return delete t.batches,delete t.countTokens,t}function _c(e){let t=new u(e);return delete t.promptCaching,delete t.messages.batches,delete t.messages.countTokens,t}var vc,yc,bc,xc=t((()=>{m(),l(),aa(),ic(),oc(),Ks(),uc(),hc(),Qs(),vc=`bedrock-2023-05-31`,yc=new Set([`/v1/complete`,`/v1/messages`,`/v1/messages?beta=true`]),bc=class extends f{constructor({awsRegion:e=ac(`AWS_REGION`)??`us-east-1`,baseURL:t=ac(`ANTHROPIC_BEDROCK_BASE_URL`)??`https://bedrock-runtime.${e}.amazonaws.com`,apiKey:n=ac(`AWS_BEARER_TOKEN_BEDROCK`),awsSecretKey:r=null,awsAccessKey:i=null,awsSessionToken:a=null,providerChainResolver:o=null,...s}={}){super({baseURL:t,authToken:n,...s}),this.skipAuth=!1,this.messages=gc(this),this.completions=new h(this),this.beta=_c(this),i!=null!=(r!=null)&&Js(this).warn("Warning: Passing only one of `awsAccessKey` or `awsSecretKey` is deprecated. Please provide both keys, or provide neither and rely on the AWS credential provider chain."),this.awsSecretKey=r,this.awsAccessKey=i,this.awsRegion=e,this.awsSessionToken=a,this.skipAuth=s.skipAuth??!1,this.providerChainResolver=o}validateHeaders(){}async prepareRequest(e,{url:t,options:n}){if(this.skipAuth){e.headers.delete(`Authorization`);return}if(this.authToken)return;let r=this.awsRegion;if(!r)throw Error("Expected `awsRegion` option to be passed to the client or the `AWS_REGION` environment variable to be present");e.headers=lc([await ia(e,{url:t,regionName:r,awsAccessKey:this.awsAccessKey,awsSecretKey:this.awsSecretKey,awsSessionToken:this.awsSessionToken,fetchOptions:this.fetchOptions,providerChainResolver:this.providerChainResolver}),e.headers]).values}async buildRequest(e){if(e.__streamClass=rc,Hs(e.body)&&(e.body={...e.body}),Hs(e.body)&&(e.body.anthropic_version||(e.body.anthropic_version=vc),e.headers&&!e.body.anthropic_beta)){let t=lc([e.headers]).values.get(`anthropic-beta`);t!=null&&(e.body.anthropic_beta=t.split(`,`))}if(yc.has(e.path)&&e.method===`post`){if(!Hs(e.body))throw Error(`Expected request body to be an object for post /v1/messages`);let t=e.body.model;e.body.model=void 0;let n=e.body.stream;e.body.stream=void 0,n?e.path=mc`/model/${t}/invoke-with-response-stream`:e.path=mc`/model/${t}/invoke`}return super.buildRequest(e)}}})),Sc=t((()=>{ct(),w(),ta()})),Cc=t((()=>{uc(),Vs(),m(),l(),Sc()})),wc=t((()=>{xc(),xc(),Cc()})),Tc;t((()=>{wc(),Tc=class extends bc{async buildRequest(e){let t=await super.buildRequest(e),n=t?.req;if(!n||typeof n.body!=`string`||n.body.length===0)return t;let r;try{r=JSON.parse(n.body)}catch{return t}if(!(`anthropic_beta`in r))return t;delete r.anthropic_beta;let i=JSON.stringify(r);n.body=i;let a=String(new TextEncoder().encode(i).length),o=n.headers;if(typeof Headers<`u`&&o instanceof Headers)o.has(`content-length`)&&o.set(`content-length`,a);else if(o&&typeof o==`object`){let e=o;`content-length`in e&&(e[`content-length`]=a)}return t}}}))();export{Tc as BedrockClient};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Cr as t,_r as n,mr as r,or as i,pr as a,si as o,ti as s}from"./loadAgentsDir-B0Anodo0.js";import{l as c,u as l}from"./types-Dx7P7JLQ.js";import{It as u,J as d,st as f}from"./state-B4jiUise.js";import{C as p,x as m}from"./debug-Bglx1aTu.js";import{i as h,o as g}from"./stringUtils-C718f5ey.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{randomUUID as y}from"crypto";import{mkdir as b,readFile as x,writeFile as S}from"fs/promises";function C(e){let t=e?.message?.content;if(!t)return`Branched conversation`;let n=typeof t==`string`?t:t.find(e=>e.type===`text`)?.text;return n&&n.replace(/\s+/g,` `).trim().slice(0,100)||`Branched conversation`}async function w(e){let n=y(),o=f(),s=i(d()),c=r(n),u=a();await b(s,{recursive:!0,mode:448});let m;try{m=await x(u)}catch{throw Error(`No conversation to branch`)}if(m.length===0)throw Error(`No conversation to branch`);let h=l(m),g=h.filter(e=>t(e)&&!e.isSidechain),_=h.filter(e=>e.type===`content-replacement`&&e.sessionId===o).flatMap(e=>e.replacements);if(g.length===0)throw Error(`No messages to branch`);let v=null,C=[],w=[];for(let e of g){let t={...e,sessionId:n,parentUuid:v,isSidechain:!1,forkedFrom:{sessionId:o,messageUuid:e.uuid}},r={...e,sessionId:n};w.push(r),C.push(p(t)),e.type!==`progress`&&(v=e.uuid)}if(_.length>0){let e={type:`content-replacement`,sessionId:n,replacements:_};C.push(p(e))}return await S(c,`${C.join(`
2
+ `)}\n`,{encoding:`utf8`,mode:384}),{sessionId:n,title:e,forkPath:c,serializedMessages:w,contentReplacementRecords:_}}async function T(e){let t=`${e} (Branch)`;if((await o(t,{exact:!0})).length===0)return t;let n=await o(`${e} (Branch`),r=new Set([1]),i=RegExp(`^${h(e)} \\(Branch(?: (\\d+))?\\)$`);for(let e of n){let t=e.customTitle?.match(i);t&&(t[1]?r.add(parseInt(t[1],10)):r.add(1))}let a=2;for(;r.has(a);)a++;return`${e} (Branch ${a})`}async function E(e,t,n){let r=n?.trim()||void 0,i=f();try{let{sessionId:n,title:a,forkPath:o,serializedMessages:c,contentReplacementRecords:l}=await w(r),u=new Date,d=C(c.find(e=>e.type===`user`)),f=await T(a??d);await s(n,f,o),v(`tengu_conversation_forked`,{message_count:c.length,has_custom_title:!!a});let p={date:u.toISOString().split(`T`)[0],messages:c,fullPath:o,value:u.getTime(),created:u,modified:u,firstPrompt:d,messageCount:c.length,isSidechain:!1,sessionId:n,customTitle:f,contentReplacements:l},m=a?` "${a}"`:``,h=`Branched conversation${m}. You are now in the branch.${`\nTo resume the original: claude -r ${i}`}`;return t.resume?(await t.resume(n,p,`fork`),e(h,{display:`system`})):e(`Branched conversation${m}. Resume with: /resume ${n}`),null}catch(t){return e(`Failed to branch conversation: ${t instanceof Error?t.message:`Unknown error occurred`}`),null}}e((()=>{u(),_(),c(),n(),m(),g()}))();export{E as call,C as deriveFirstPrompt};
@@ -1,7 +1,7 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DcaKZlRU.js";import{L as r,zt as i}from"./state-BowF111d.js";import{join as a}from"node:path";import{appendFileSync as o,existsSync as s,mkdirSync as c,readFileSync as l,unlinkSync as u,writeFileSync as d}from"node:fs";function f(){return a(t(),`.next-request-no-cache`)}function p(){return a(t(),`.break-cache-always`)}function m(){return a(t(),`break-cache-events.jsonl`)}function h(){try{let e=l(m(),`utf8`).trim().split(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DfkgIdYf.js";import{I as r,It as i}from"./state-B4jiUise.js";import{join as a}from"node:path";import{appendFileSync as o,existsSync as s,mkdirSync as c,readFileSync as l,unlinkSync as u,writeFileSync as d}from"node:fs";function f(){return a(t(),`.next-request-no-cache`)}function p(){return a(t(),`.break-cache-always`)}function m(){return a(t(),`break-cache-events.jsonl`)}function h(){try{let e=l(m(),`utf8`).trim().split(`
2
2
  `).filter(Boolean).map(e=>{try{return JSON.parse(e)}catch{return null}}).filter(e=>e!==null),t=e.filter(e=>e.kind===`once`),n=e[e.length-1],r=e.filter(e=>e.kind===`always_on`||e.kind===`always_off`),i=r[r.length-1];return{totalBreaks:t.length,lastBreakAt:n?.at??null,alwaysModeEnabled:i?.kind===`always_on`}}catch{return{totalBreaks:0,lastBreakAt:null,alwaysModeEnabled:!1}}}function g(e){let n=m();c(t(),{recursive:!0});let r={at:new Date().toISOString(),kind:e};o(n,`${JSON.stringify(r)}\n`,`utf8`)}function _(){g(`once`)}async function v(e){let t=e.trim().toLowerCase(),n=f(),r=p();if(t===`status`){let e=h(),t=s(n),i=s(r);return{type:`text`,value:[`## Break-Cache Status`,``,` Once marker: ${t?`ACTIVE (next call will bust cache)`:`not set`}`,` Always mode: ${i?`ON (every call busts cache)`:`off`}`,``,`## Stats`,` total_breaks: ${e.totalBreaks}`,` last_break_at: ${e.lastBreakAt??`never`}`].join(`
3
3
  `)}}if(t===`off`){let e=!1;return s(n)&&(u(n),e=!0),s(r)&&(u(r),e=!0),g(`always_off`),{type:`text`,value:e?`Break-cache disabled. Removed once marker and/or always flag.`:`Break-cache was not active.`}}if(t===`--clear`)return s(n)?(u(n),{type:`text`,value:`Cache-break marker cleared.\n \`${n}\``}):{type:`text`,value:`No cache-break marker was set.`};if(t===`always`)return d(r,new Date().toISOString(),`utf8`),g(`always_on`),{type:`text`,value:[`## Always-on cache break enabled`,``,`Flag written: \`${r}\``,``,`Every API call will now append a random nonce to the system prompt,`,`permanently preventing prompt-cache hits for this session.`,``,"To disable: `/break-cache off`"].join(`
4
4
  `)};if(t===``||t===`once`){let e=new Date().toISOString();d(n,e,`utf8`),_();let t=h();return{type:`text`,value:[`## Cache break scheduled`,``,`Marker written: \`${n}\``,`Timestamp: ${e}`,``,`The next API call will append a random nonce to the system prompt,`,`causing a cache miss. The marker is removed automatically after use.`,``,"To cancel before the next call: `/break-cache --clear`","For every call: `/break-cache always`",``,`Total breaks this session: ${t.totalBreaks}`,``,`_How it works: The prompt cache keys on the system-prompt prefix hash._`,`_A unique nonce invalidates the hash, forcing a fresh compute._`].join(`
5
5
  `)}}return{type:`text`,value:[`Unknown scope: "${t}"`,``,y].join(`
6
6
  `)}}var y,b,x,S=e((()=>{i(),n(),y=[`Usage: /break-cache [scope]`,``,` (no args) Schedule a one-time cache break for the next API call`,` once Same as no args`,` always Enable persistent cache-break mode (every request)`,` off Disable always mode and clear any pending marker`,` --clear Clear the pending once marker (cancel before next call)`,` status Show current break-cache status and stats`,``,`How it works:`,` The prompt cache keys on the system-prompt prefix hash.`,` A unique nonce invalidates the hash, forcing a fresh compute.`,` This is useful when you want to ensure a clean context window.`].join(`
7
- `),b={type:`local-jsx`,name:`break-cache`,description:`管理 prompt cache 的打断。打开操作面板,或运行:once、status、always、off`,isHidden:!1,isEnabled:()=>!r(),argumentHint:`[once|status|always|off|--clear]`,load:()=>import(`./panel-D9fGQgln.js`)},x={type:`local`,name:`break-cache`,description:`强制下一次(或所有)API 调用不命中 prompt cache。作用域:once、status、always、off`,isHidden:!1,isEnabled:()=>r(),supportsNonInteractive:!0,load:async()=>({call:v})}}));export{f as a,p as i,x as n,S as o,v as r,b as t};
7
+ `),b={type:`local-jsx`,name:`break-cache`,description:`管理 prompt cache 的打断。打开操作面板,或运行:once、status、always、off`,isHidden:!1,isEnabled:()=>!r(),argumentHint:`[once|status|always|off|--clear]`,load:()=>import(`./panel-CVS4SK_E.js`)},x={type:`local`,name:`break-cache`,description:`强制下一次(或所有)API 调用不命中 prompt cache。作用域:once、status、always、off`,isHidden:!1,isEnabled:()=>r(),supportsNonInteractive:!0,load:async()=>({call:v})}}));export{f as a,p as i,x as n,S as o,v as r,b as t};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Hs as n,Mh as r,Nh as i,Qx as a,Us as o,Yi as s,aC as c,at as l,bb as u,cd as d,it as f,jh as p,ny as m,qg as h,ty as g,ud as _}from"./loadAgentsDir-B0Anodo0.js";import{I as v,P as y,ai as b,bn as x,ot as S,t as C,vn as w,xt as T}from"./src-DL3w8VPk.js";import{t as E}from"./jsx-runtime-Bb4Xn-E0.js";import{I as D,M as O}from"./debug-Bglx1aTu.js";import{Ht as k}from"./settings-B2jvL8Dp.js";import{_ as A,p as j}from"./config-C-Y2qtB2.js";import{n as M,t as N}from"./SpinnerGlyph-CmkRUvHe.js";import{n as P,r as F}from"./sideQuestion-D49GsfH7.js";import{i as I,n as L}from"./modalContext-DDZdU1J8.js";function R({question:e,context:t,onDone:n}){let[r,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(0),l=(0,H.useRef)(null),{rows:u}=I(S());x(()=>c(e=>e+1),r||a?null:80);function f(e){if(e.key===`escape`||e.key===`return`||e.key===` `||e.ctrl&&(e.key===`c`||e.key===`d`)){e.preventDefault(),n(void 0,{display:`skip`});return}(e.key===`up`||e.ctrl&&e.key===`p`)&&(e.preventDefault(),l.current?.scrollBy(-3)),(e.key===`down`||e.ctrl&&e.key===`n`)&&(e.preventDefault(),l.current?.scrollBy(K))}(0,H.useEffect)(()=>{let n=g();async function r(){try{let r=await F({question:e,cacheSafeParams:await B(t)});n.signal.aborted||(r.response?i(r.response):o(`No response received`))}catch(e){n.signal.aborted||o(O(e)||`Failed to get response`)}}return r(),()=>{n.abort()}},[e,t]);let p=Math.max(5,u-W-G);return(0,U.jsxs)(v,{flexDirection:`column`,paddingLeft:2,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:f,children:[(0,U.jsxs)(v,{children:[(0,U.jsxs)(y,{color:`warning`,bold:!0,children:[`/btw`,` `]}),(0,U.jsx)(y,{dimColor:!0,children:e})]}),(0,U.jsx)(v,{marginTop:1,marginLeft:2,maxHeight:p,children:(0,U.jsx)(T,{ref:l,flexDirection:`column`,flexGrow:1,children:a?(0,U.jsx)(y,{color:`error`,children:a}):r?(0,U.jsx)(d,{children:r}):(0,U.jsxs)(v,{children:[(0,U.jsx)(N,{frame:s,messageColor:`warning`}),(0,U.jsx)(y,{color:`warning`,children:`Answering...`})]})})}),(r||a)&&(0,U.jsx)(v,{marginTop:1,children:(0,U.jsxs)(y,{dimColor:!0,children:[`↑`,`/`,`↓`,` to scroll · Space, Enter, or Escape to dismiss`]})})]})}function z(e){let t=e.at(-1);return t?.type===`assistant`&&t.message.stop_reason===null?e.slice(0,-1):e}async function B(e){let t=a(z(e.messages)),i=n();if(i)return{systemPrompt:i.systemPrompt,userContext:i.userContext,systemContext:i.systemContext,toolUseContext:e,forkContextMessages:t};let[o,s,l]=await Promise.all([f(e.options.tools,e.options.mainLoopModel,[],e.options.mcpClients),r(),p()]);return{systemPrompt:c(o),userContext:s,systemContext:l,toolUseContext:e,forkContextMessages:t}}async function V(e,t,n){let r=n?.trim();return r?(A(e=>({...e,btwUseCount:e.btwUseCount+1})),(0,U.jsx)(R,{question:r,context:t,onDone:e})):(e(`Usage: /btw <your question>`,{display:`system`}),null)}var H,U,W,G,K;e((()=>{H=t(b(),1),w(),_(),M(),k(),l(),L(),i(),u(),C(),m(),j(),D(),o(),s(),P(),h(),U=E(),W=5,G=6,K=3}))();export{V as call};