clawmini 0.0.1

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 (469) hide show
  1. package/.gemini/settings.json +46 -0
  2. package/.prettierrc +7 -0
  3. package/GEMINI.md +11 -0
  4. package/README.md +137 -0
  5. package/dist/adapter-discord/index.d.mts +5 -0
  6. package/dist/adapter-discord/index.d.mts.map +1 -0
  7. package/dist/adapter-discord/index.mjs +456 -0
  8. package/dist/adapter-discord/index.mjs.map +1 -0
  9. package/dist/chats-DKgTeU7i.mjs +91 -0
  10. package/dist/chats-DKgTeU7i.mjs.map +1 -0
  11. package/dist/chats-Zd_HXDHx.mjs +29 -0
  12. package/dist/chats-Zd_HXDHx.mjs.map +1 -0
  13. package/dist/cli/index.d.mts +1 -0
  14. package/dist/cli/index.mjs +850 -0
  15. package/dist/cli/index.mjs.map +1 -0
  16. package/dist/cli/lite.d.mts +1 -0
  17. package/dist/cli/lite.mjs +4434 -0
  18. package/dist/cli/lite.mjs.map +1 -0
  19. package/dist/daemon/index.d.mts +5 -0
  20. package/dist/daemon/index.d.mts.map +1 -0
  21. package/dist/daemon/index.mjs +1222 -0
  22. package/dist/daemon/index.mjs.map +1 -0
  23. package/dist/fetch-BjZVyU3Z.mjs +37 -0
  24. package/dist/fetch-BjZVyU3Z.mjs.map +1 -0
  25. package/dist/fs-B5wW0oaH.mjs +14 -0
  26. package/dist/fs-B5wW0oaH.mjs.map +1 -0
  27. package/dist/lite-Dl7WXyaH.mjs +80 -0
  28. package/dist/lite-Dl7WXyaH.mjs.map +1 -0
  29. package/dist/rolldown-runtime-95iHPtFO.mjs +18 -0
  30. package/dist/web/_app/env.js +1 -0
  31. package/dist/web/_app/immutable/assets/0.GI4C4dpV.css +1 -0
  32. package/dist/web/_app/immutable/chunks/B5abRDXp.js +1 -0
  33. package/dist/web/_app/immutable/chunks/B8yYFADm.js +1 -0
  34. package/dist/web/_app/immutable/chunks/BPy8HLo7.js +5 -0
  35. package/dist/web/_app/immutable/chunks/Bi0jeV7Q.js +1 -0
  36. package/dist/web/_app/immutable/chunks/BmUXQ3wy.js +2 -0
  37. package/dist/web/_app/immutable/chunks/C3k55nDF.js +1 -0
  38. package/dist/web/_app/immutable/chunks/COekwvP2.js +1 -0
  39. package/dist/web/_app/immutable/chunks/CSvS_NwK.js +1 -0
  40. package/dist/web/_app/immutable/chunks/CpaGRn9L.js +1 -0
  41. package/dist/web/_app/immutable/chunks/CyNaE55B.js +1 -0
  42. package/dist/web/_app/immutable/chunks/DG5RZBw-.js +2 -0
  43. package/dist/web/_app/immutable/chunks/Dc-UOHw9.js +1 -0
  44. package/dist/web/_app/immutable/chunks/DcrmIfTj.js +1 -0
  45. package/dist/web/_app/immutable/chunks/ZkLyk0mE.js +1 -0
  46. package/dist/web/_app/immutable/entry/app.B-vZe7PN.js +2 -0
  47. package/dist/web/_app/immutable/entry/start.oP1AgKhs.js +1 -0
  48. package/dist/web/_app/immutable/nodes/0.B5WFN0zw.js +1 -0
  49. package/dist/web/_app/immutable/nodes/1.D1wtJb2k.js +1 -0
  50. package/dist/web/_app/immutable/nodes/2.CK3CLC0f.js +1 -0
  51. package/dist/web/_app/immutable/nodes/3.BB5wCoBf.js +4 -0
  52. package/dist/web/_app/immutable/nodes/4.Dr2jvAXK.js +1 -0
  53. package/dist/web/_app/immutable/nodes/5.BJl7oM3b.js +1 -0
  54. package/dist/web/_app/version.json +1 -0
  55. package/dist/web/index.html +37 -0
  56. package/dist/web/robots.txt +3 -0
  57. package/dist/workspace-CSgfo_2J.mjs +383 -0
  58. package/dist/workspace-CSgfo_2J.mjs.map +1 -0
  59. package/docs/01_chats/development_log.md +36 -0
  60. package/docs/01_chats/notes.md +27 -0
  61. package/docs/01_chats/prd.md +47 -0
  62. package/docs/01_chats/questions.md +19 -0
  63. package/docs/01_chats/tickets.md +67 -0
  64. package/docs/02_sessions/development_log.md +79 -0
  65. package/docs/02_sessions/notes.md +40 -0
  66. package/docs/02_sessions/prd.md +75 -0
  67. package/docs/02_sessions/questions.md +7 -0
  68. package/docs/02_sessions/tickets.md +68 -0
  69. package/docs/03_web_interface/development_log.md +60 -0
  70. package/docs/03_web_interface/notes.md +29 -0
  71. package/docs/03_web_interface/prd.md +42 -0
  72. package/docs/03_web_interface/questions.md +8 -0
  73. package/docs/03_web_interface/tickets.md +59 -0
  74. package/docs/04_agents/development_log.md +54 -0
  75. package/docs/04_agents/notes.md +45 -0
  76. package/docs/04_agents/prd.md +47 -0
  77. package/docs/04_agents/questions.md +13 -0
  78. package/docs/04_agents/tickets.md +107 -0
  79. package/docs/05_routers/development_log.md +13 -0
  80. package/docs/05_routers/notes.md +40 -0
  81. package/docs/05_routers/prd.md +55 -0
  82. package/docs/05_routers/questions.md +21 -0
  83. package/docs/05_routers/tickets.md +109 -0
  84. package/docs/06_agent_templates/development_log.md +38 -0
  85. package/docs/06_agent_templates/notes.md +25 -0
  86. package/docs/06_agent_templates/prd.md +34 -0
  87. package/docs/06_agent_templates/questions.md +11 -0
  88. package/docs/06_agent_templates/tickets.md +49 -0
  89. package/docs/06_cron/development_log.md +51 -0
  90. package/docs/06_cron/notes.md +14 -0
  91. package/docs/06_cron/prd.md +92 -0
  92. package/docs/06_cron/questions.md +15 -0
  93. package/docs/06_cron/tickets.md +75 -0
  94. package/docs/07_web_chat_ux/development_log.md +30 -0
  95. package/docs/07_web_chat_ux/notes.md +25 -0
  96. package/docs/07_web_chat_ux/prd.md +46 -0
  97. package/docs/07_web_chat_ux/questions.md +7 -0
  98. package/docs/07_web_chat_ux/tickets.md +48 -0
  99. package/docs/08_agent_api/development_log.md +52 -0
  100. package/docs/08_agent_api/notes.md +31 -0
  101. package/docs/08_agent_api/prd.md +56 -0
  102. package/docs/08_agent_api/questions.md +14 -0
  103. package/docs/08_agent_api/tickets.md +104 -0
  104. package/docs/09_agent_fallbacks/development_log.md +52 -0
  105. package/docs/09_agent_fallbacks/notes.md +40 -0
  106. package/docs/09_agent_fallbacks/prd.md +55 -0
  107. package/docs/09_agent_fallbacks/questions.md +10 -0
  108. package/docs/09_agent_fallbacks/tickets.md +88 -0
  109. package/docs/09_discord_adapter/development_log.md +95 -0
  110. package/docs/09_discord_adapter/notes.md +18 -0
  111. package/docs/09_discord_adapter/prd.md +57 -0
  112. package/docs/09_discord_adapter/questions.md +16 -0
  113. package/docs/09_discord_adapter/tickets.md +116 -0
  114. package/docs/10_file_attachments/development_log.md +55 -0
  115. package/docs/10_file_attachments/notes.md +59 -0
  116. package/docs/10_file_attachments/prd.md +73 -0
  117. package/docs/10_file_attachments/questions.md +15 -0
  118. package/docs/10_file_attachments/tickets.md +88 -0
  119. package/docs/11_message_verbosity/development_log.md +43 -0
  120. package/docs/11_message_verbosity/notes.md +26 -0
  121. package/docs/11_message_verbosity/prd.md +44 -0
  122. package/docs/11_message_verbosity/questions.md +8 -0
  123. package/docs/11_message_verbosity/tickets.md +33 -0
  124. package/docs/12_environments/development_log.md +43 -0
  125. package/docs/12_environments/notes.md +45 -0
  126. package/docs/12_environments/prd.md +113 -0
  127. package/docs/12_environments/questions.md +17 -0
  128. package/docs/12_environments/tickets.md +87 -0
  129. package/docs/12_setup_flow_improvements/development_log.md +40 -0
  130. package/docs/12_setup_flow_improvements/notes.md +34 -0
  131. package/docs/12_setup_flow_improvements/prd.md +35 -0
  132. package/docs/12_setup_flow_improvements/questions.md +8 -0
  133. package/docs/12_setup_flow_improvements/tickets.md +122 -0
  134. package/docs/13_discord_typing_indicators/development_log.md +38 -0
  135. package/docs/13_discord_typing_indicators/notes.md +18 -0
  136. package/docs/13_discord_typing_indicators/prd.md +41 -0
  137. package/docs/13_discord_typing_indicators/questions.md +6 -0
  138. package/docs/13_discord_typing_indicators/tickets.md +60 -0
  139. package/docs/14_interruptions/development_log.md +50 -0
  140. package/docs/14_interruptions/notes.md +38 -0
  141. package/docs/14_interruptions/prd.md +46 -0
  142. package/docs/14_interruptions/questions.md +12 -0
  143. package/docs/14_interruptions/tickets.md +69 -0
  144. package/docs/15_sandbox_policies/development_log.md +95 -0
  145. package/docs/15_sandbox_policies/notes.md +33 -0
  146. package/docs/15_sandbox_policies/prd.md +163 -0
  147. package/docs/15_sandbox_policies/questions.md +10 -0
  148. package/docs/15_sandbox_policies/tickets.md +196 -0
  149. package/docs/CHECKS.md +9 -0
  150. package/docs/guides/discord_adapter_setup.md +69 -0
  151. package/docs/guides/sandbox_policies.md +76 -0
  152. package/eslint.config.js +47 -0
  153. package/napkin.md +21 -0
  154. package/package.json +50 -0
  155. package/scripts/create_worktree.sh +49 -0
  156. package/scripts/get_pr_comments.sh +36 -0
  157. package/src/adapter-discord/client.test.ts +65 -0
  158. package/src/adapter-discord/client.ts +41 -0
  159. package/src/adapter-discord/config.test.ts +156 -0
  160. package/src/adapter-discord/config.ts +61 -0
  161. package/src/adapter-discord/forwarder.test.ts +493 -0
  162. package/src/adapter-discord/forwarder.ts +246 -0
  163. package/src/adapter-discord/index.test.ts +399 -0
  164. package/src/adapter-discord/index.ts +147 -0
  165. package/src/adapter-discord/state.test.ts +65 -0
  166. package/src/adapter-discord/state.ts +44 -0
  167. package/src/cli/client.ts +46 -0
  168. package/src/cli/commands/agents.ts +138 -0
  169. package/src/cli/commands/chats.ts +79 -0
  170. package/src/cli/commands/down.ts +32 -0
  171. package/src/cli/commands/environments.ts +39 -0
  172. package/src/cli/commands/export-lite.ts +62 -0
  173. package/src/cli/commands/init.ts +79 -0
  174. package/src/cli/commands/jobs.ts +141 -0
  175. package/src/cli/commands/messages.ts +103 -0
  176. package/src/cli/commands/up.ts +26 -0
  177. package/src/cli/commands/web-api/agents.ts +138 -0
  178. package/src/cli/commands/web-api/chats.ts +213 -0
  179. package/src/cli/commands/web-api/utils.ts +27 -0
  180. package/src/cli/commands/web.ts +105 -0
  181. package/src/cli/e2e/adapter-discord.test.ts +76 -0
  182. package/src/cli/e2e/agents.test.ts +140 -0
  183. package/src/cli/e2e/basic.test.ts +43 -0
  184. package/src/cli/e2e/cron.test.ts +132 -0
  185. package/src/cli/e2e/daemon.test.ts +293 -0
  186. package/src/cli/e2e/environments.test.ts +66 -0
  187. package/src/cli/e2e/export-lite-func.test.ts +155 -0
  188. package/src/cli/e2e/export-lite.test.ts +51 -0
  189. package/src/cli/e2e/fallbacks.test.ts +169 -0
  190. package/src/cli/e2e/global-setup.ts +15 -0
  191. package/src/cli/e2e/init.test.ts +70 -0
  192. package/src/cli/e2e/messages.test.ts +294 -0
  193. package/src/cli/e2e/requests.test.ts +165 -0
  194. package/src/cli/e2e/utils.ts +66 -0
  195. package/src/cli/index.test.ts +7 -0
  196. package/src/cli/index.ts +29 -0
  197. package/src/cli/lite.ts +247 -0
  198. package/src/cli/utils.ts +4 -0
  199. package/src/daemon/auth.test.ts +50 -0
  200. package/src/daemon/auth.ts +69 -0
  201. package/src/daemon/chats.ts +26 -0
  202. package/src/daemon/cron.test.ts +28 -0
  203. package/src/daemon/cron.ts +159 -0
  204. package/src/daemon/events.ts +15 -0
  205. package/src/daemon/index.ts +212 -0
  206. package/src/daemon/message-agent.test.ts +132 -0
  207. package/src/daemon/message-extraction.test.ts +166 -0
  208. package/src/daemon/message-fallbacks.test.ts +313 -0
  209. package/src/daemon/message-interruption.test.ts +125 -0
  210. package/src/daemon/message-queue.test.ts +143 -0
  211. package/src/daemon/message-router.test.ts +106 -0
  212. package/src/daemon/message-session.test.ts +127 -0
  213. package/src/daemon/message-test-utils.ts +41 -0
  214. package/src/daemon/message-typing.test.ts +93 -0
  215. package/src/daemon/message-verbosity.test.ts +127 -0
  216. package/src/daemon/message.ts +600 -0
  217. package/src/daemon/observation.test.ts +118 -0
  218. package/src/daemon/policy-request-service.test.ts +87 -0
  219. package/src/daemon/policy-request-service.ts +62 -0
  220. package/src/daemon/policy-utils.test.ts +138 -0
  221. package/src/daemon/policy-utils.ts +152 -0
  222. package/src/daemon/queue.test.ts +89 -0
  223. package/src/daemon/queue.ts +87 -0
  224. package/src/daemon/request-store.test.ts +103 -0
  225. package/src/daemon/request-store.ts +96 -0
  226. package/src/daemon/router-policy-request.test.ts +99 -0
  227. package/src/daemon/router.test.ts +380 -0
  228. package/src/daemon/router.ts +510 -0
  229. package/src/daemon/routers/slash-command.test.ts +145 -0
  230. package/src/daemon/routers/slash-command.ts +58 -0
  231. package/src/daemon/routers/slash-interrupt.test.ts +30 -0
  232. package/src/daemon/routers/slash-interrupt.ts +7 -0
  233. package/src/daemon/routers/slash-new.test.ts +59 -0
  234. package/src/daemon/routers/slash-new.ts +14 -0
  235. package/src/daemon/routers/slash-policies.test.ts +167 -0
  236. package/src/daemon/routers/slash-policies.ts +131 -0
  237. package/src/daemon/routers/slash-stop.test.ts +30 -0
  238. package/src/daemon/routers/slash-stop.ts +3 -0
  239. package/src/daemon/routers/types.ts +10 -0
  240. package/src/daemon/routers/utils.ts +22 -0
  241. package/src/daemon/routers.test.ts +141 -0
  242. package/src/daemon/routers.ts +115 -0
  243. package/src/daemon/utils/spawn.ts +61 -0
  244. package/src/shared/agent-utils.ts +30 -0
  245. package/src/shared/chats.test.ts +112 -0
  246. package/src/shared/chats.ts +164 -0
  247. package/src/shared/config.test.ts +90 -0
  248. package/src/shared/config.ts +100 -0
  249. package/src/shared/event-source.ts +121 -0
  250. package/src/shared/fetch.ts +45 -0
  251. package/src/shared/lite.ts +129 -0
  252. package/src/shared/policies.ts +24 -0
  253. package/src/shared/utils/env.ts +27 -0
  254. package/src/shared/utils/fs.ts +13 -0
  255. package/src/shared/workspace.test.ts +345 -0
  256. package/src/shared/workspace.ts +500 -0
  257. package/templates/environments/cladding/env.json +7 -0
  258. package/templates/environments/macos/env.json +8 -0
  259. package/templates/environments/macos/sandbox.sb +21 -0
  260. package/templates/environments/macos-proxy/allowlist.txt +1 -0
  261. package/templates/environments/macos-proxy/env.json +14 -0
  262. package/templates/environments/macos-proxy/proxy.mjs +86 -0
  263. package/templates/environments/macos-proxy/sandbox.sb +34 -0
  264. package/templates/gemini/settings.json +11 -0
  265. package/templates/gemini-claw/.gemini/hooks/clawmini-logging.sh +17 -0
  266. package/templates/gemini-claw/.gemini/settings.json +24 -0
  267. package/templates/gemini-claw/.gemini/skills/clawmini-jobs/SKILL.md +40 -0
  268. package/templates/gemini-claw/.gemini/system.md +98 -0
  269. package/templates/gemini-claw/BOOTSTRAP.md +54 -0
  270. package/templates/gemini-claw/GEMINI.md +107 -0
  271. package/templates/gemini-claw/HEARTBEAT.md +3 -0
  272. package/templates/gemini-claw/MEMORY.md +2 -0
  273. package/templates/gemini-claw/SOUL.md +42 -0
  274. package/templates/gemini-claw/TOOLS.md +38 -0
  275. package/templates/gemini-claw/USER.md +15 -0
  276. package/templates/gemini-claw/memory/.gitkeep +0 -0
  277. package/templates/gemini-claw/settings.json +24 -0
  278. package/templates/opencode/settings.json +11 -0
  279. package/tsconfig.json +42 -0
  280. package/tsdown.config.ts +19 -0
  281. package/vitest.config.ts +9 -0
  282. package/web/.svelte-kit/ambient.d.ts +382 -0
  283. package/web/.svelte-kit/generated/client/app.js +35 -0
  284. package/web/.svelte-kit/generated/client/matchers.js +1 -0
  285. package/web/.svelte-kit/generated/client/nodes/0.js +3 -0
  286. package/web/.svelte-kit/generated/client/nodes/1.js +1 -0
  287. package/web/.svelte-kit/generated/client/nodes/2.js +1 -0
  288. package/web/.svelte-kit/generated/client/nodes/3.js +1 -0
  289. package/web/.svelte-kit/generated/client/nodes/4.js +3 -0
  290. package/web/.svelte-kit/generated/client/nodes/5.js +3 -0
  291. package/web/.svelte-kit/generated/client-optimized/app.js +35 -0
  292. package/web/.svelte-kit/generated/client-optimized/matchers.js +1 -0
  293. package/web/.svelte-kit/generated/client-optimized/nodes/0.js +3 -0
  294. package/web/.svelte-kit/generated/client-optimized/nodes/1.js +1 -0
  295. package/web/.svelte-kit/generated/client-optimized/nodes/2.js +1 -0
  296. package/web/.svelte-kit/generated/client-optimized/nodes/3.js +1 -0
  297. package/web/.svelte-kit/generated/client-optimized/nodes/4.js +3 -0
  298. package/web/.svelte-kit/generated/client-optimized/nodes/5.js +3 -0
  299. package/web/.svelte-kit/generated/root.js +3 -0
  300. package/web/.svelte-kit/generated/root.svelte +68 -0
  301. package/web/.svelte-kit/generated/server/internal.js +53 -0
  302. package/web/.svelte-kit/non-ambient.d.ts +46 -0
  303. package/web/.svelte-kit/output/client/.vite/manifest.json +251 -0
  304. package/web/.svelte-kit/output/client/_app/immutable/assets/0.GI4C4dpV.css +1 -0
  305. package/web/.svelte-kit/output/client/_app/immutable/chunks/B5abRDXp.js +1 -0
  306. package/web/.svelte-kit/output/client/_app/immutable/chunks/B8yYFADm.js +1 -0
  307. package/web/.svelte-kit/output/client/_app/immutable/chunks/BPy8HLo7.js +5 -0
  308. package/web/.svelte-kit/output/client/_app/immutable/chunks/Bi0jeV7Q.js +1 -0
  309. package/web/.svelte-kit/output/client/_app/immutable/chunks/BmUXQ3wy.js +2 -0
  310. package/web/.svelte-kit/output/client/_app/immutable/chunks/C3k55nDF.js +1 -0
  311. package/web/.svelte-kit/output/client/_app/immutable/chunks/COekwvP2.js +1 -0
  312. package/web/.svelte-kit/output/client/_app/immutable/chunks/CSvS_NwK.js +1 -0
  313. package/web/.svelte-kit/output/client/_app/immutable/chunks/CpaGRn9L.js +1 -0
  314. package/web/.svelte-kit/output/client/_app/immutable/chunks/CyNaE55B.js +1 -0
  315. package/web/.svelte-kit/output/client/_app/immutable/chunks/DG5RZBw-.js +2 -0
  316. package/web/.svelte-kit/output/client/_app/immutable/chunks/Dc-UOHw9.js +1 -0
  317. package/web/.svelte-kit/output/client/_app/immutable/chunks/DcrmIfTj.js +1 -0
  318. package/web/.svelte-kit/output/client/_app/immutable/chunks/ZkLyk0mE.js +1 -0
  319. package/web/.svelte-kit/output/client/_app/immutable/entry/app.B-vZe7PN.js +2 -0
  320. package/web/.svelte-kit/output/client/_app/immutable/entry/start.oP1AgKhs.js +1 -0
  321. package/web/.svelte-kit/output/client/_app/immutable/nodes/0.B5WFN0zw.js +1 -0
  322. package/web/.svelte-kit/output/client/_app/immutable/nodes/1.D1wtJb2k.js +1 -0
  323. package/web/.svelte-kit/output/client/_app/immutable/nodes/2.CK3CLC0f.js +1 -0
  324. package/web/.svelte-kit/output/client/_app/immutable/nodes/3.BB5wCoBf.js +4 -0
  325. package/web/.svelte-kit/output/client/_app/immutable/nodes/4.Dr2jvAXK.js +1 -0
  326. package/web/.svelte-kit/output/client/_app/immutable/nodes/5.BJl7oM3b.js +1 -0
  327. package/web/.svelte-kit/output/client/_app/version.json +1 -0
  328. package/web/.svelte-kit/output/client/robots.txt +3 -0
  329. package/web/.svelte-kit/output/prerendered/dependencies/_app/env.js +1 -0
  330. package/web/.svelte-kit/output/server/.vite/manifest.json +215 -0
  331. package/web/.svelte-kit/output/server/_app/immutable/assets/_layout.GI4C4dpV.css +1 -0
  332. package/web/.svelte-kit/output/server/chunks/Icon.js +153 -0
  333. package/web/.svelte-kit/output/server/chunks/bot.js +2753 -0
  334. package/web/.svelte-kit/output/server/chunks/client.js +47 -0
  335. package/web/.svelte-kit/output/server/chunks/environment.js +34 -0
  336. package/web/.svelte-kit/output/server/chunks/exports.js +231 -0
  337. package/web/.svelte-kit/output/server/chunks/false.js +4 -0
  338. package/web/.svelte-kit/output/server/chunks/index-server.js +20 -0
  339. package/web/.svelte-kit/output/server/chunks/index.js +24 -0
  340. package/web/.svelte-kit/output/server/chunks/internal.js +133 -0
  341. package/web/.svelte-kit/output/server/chunks/plus.js +81 -0
  342. package/web/.svelte-kit/output/server/chunks/root.js +4076 -0
  343. package/web/.svelte-kit/output/server/chunks/shared.js +789 -0
  344. package/web/.svelte-kit/output/server/chunks/utils.js +43 -0
  345. package/web/.svelte-kit/output/server/entries/fallbacks/error.svelte.js +11 -0
  346. package/web/.svelte-kit/output/server/entries/pages/_layout.svelte.js +3944 -0
  347. package/web/.svelte-kit/output/server/entries/pages/_layout.ts.js +28 -0
  348. package/web/.svelte-kit/output/server/entries/pages/_page.svelte.js +7 -0
  349. package/web/.svelte-kit/output/server/entries/pages/agents/_page.svelte.js +379 -0
  350. package/web/.svelte-kit/output/server/entries/pages/chats/_id_/_page.svelte.js +292 -0
  351. package/web/.svelte-kit/output/server/entries/pages/chats/_id_/_page.ts.js +17 -0
  352. package/web/.svelte-kit/output/server/entries/pages/chats/_id_/settings/_page.svelte.js +259 -0
  353. package/web/.svelte-kit/output/server/entries/pages/chats/_id_/settings/_page.ts.js +17 -0
  354. package/web/.svelte-kit/output/server/index.js +3748 -0
  355. package/web/.svelte-kit/output/server/internal.js +14 -0
  356. package/web/.svelte-kit/output/server/manifest-full.js +63 -0
  357. package/web/.svelte-kit/output/server/manifest.js +63 -0
  358. package/web/.svelte-kit/output/server/nodes/0.js +13 -0
  359. package/web/.svelte-kit/output/server/nodes/1.js +8 -0
  360. package/web/.svelte-kit/output/server/nodes/2.js +8 -0
  361. package/web/.svelte-kit/output/server/nodes/3.js +8 -0
  362. package/web/.svelte-kit/output/server/nodes/4.js +13 -0
  363. package/web/.svelte-kit/output/server/nodes/5.js +13 -0
  364. package/web/.svelte-kit/output/server/remote-entry.js +557 -0
  365. package/web/.svelte-kit/tsconfig.json +67 -0
  366. package/web/.svelte-kit/types/route_meta_data.json +17 -0
  367. package/web/.svelte-kit/types/src/routes/$types.d.ts +26 -0
  368. package/web/.svelte-kit/types/src/routes/agents/$types.d.ts +18 -0
  369. package/web/.svelte-kit/types/src/routes/chats/[id]/$types.d.ts +21 -0
  370. package/web/.svelte-kit/types/src/routes/chats/[id]/proxy+page.ts +20 -0
  371. package/web/.svelte-kit/types/src/routes/chats/[id]/settings/$types.d.ts +21 -0
  372. package/web/.svelte-kit/types/src/routes/chats/[id]/settings/proxy+page.ts +19 -0
  373. package/web/.svelte-kit/types/src/routes/proxy+layout.ts +35 -0
  374. package/web/README.md +42 -0
  375. package/web/components.json +16 -0
  376. package/web/package.json +41 -0
  377. package/web/src/app.css +121 -0
  378. package/web/src/app.d.ts +13 -0
  379. package/web/src/app.html +11 -0
  380. package/web/src/demo.spec.ts +7 -0
  381. package/web/src/lib/app-state.svelte.ts +3 -0
  382. package/web/src/lib/assets/favicon.svg +1 -0
  383. package/web/src/lib/components/app/app-sidebar-test-wrapper.svelte +10 -0
  384. package/web/src/lib/components/app/app-sidebar.svelte +171 -0
  385. package/web/src/lib/components/app/app-sidebar.svelte.spec.ts +13 -0
  386. package/web/src/lib/components/ui/button/button.svelte +82 -0
  387. package/web/src/lib/components/ui/button/index.ts +17 -0
  388. package/web/src/lib/components/ui/dialog/dialog-close.svelte +7 -0
  389. package/web/src/lib/components/ui/dialog/dialog-content.svelte +45 -0
  390. package/web/src/lib/components/ui/dialog/dialog-description.svelte +17 -0
  391. package/web/src/lib/components/ui/dialog/dialog-footer.svelte +20 -0
  392. package/web/src/lib/components/ui/dialog/dialog-header.svelte +20 -0
  393. package/web/src/lib/components/ui/dialog/dialog-overlay.svelte +20 -0
  394. package/web/src/lib/components/ui/dialog/dialog-portal.svelte +7 -0
  395. package/web/src/lib/components/ui/dialog/dialog-title.svelte +17 -0
  396. package/web/src/lib/components/ui/dialog/dialog-trigger.svelte +7 -0
  397. package/web/src/lib/components/ui/dialog/dialog.svelte +7 -0
  398. package/web/src/lib/components/ui/dialog/index.ts +34 -0
  399. package/web/src/lib/components/ui/input/index.ts +7 -0
  400. package/web/src/lib/components/ui/input/input.svelte +52 -0
  401. package/web/src/lib/components/ui/separator/index.ts +7 -0
  402. package/web/src/lib/components/ui/separator/separator.svelte +21 -0
  403. package/web/src/lib/components/ui/sheet/index.ts +34 -0
  404. package/web/src/lib/components/ui/sheet/sheet-close.svelte +7 -0
  405. package/web/src/lib/components/ui/sheet/sheet-content.svelte +60 -0
  406. package/web/src/lib/components/ui/sheet/sheet-description.svelte +17 -0
  407. package/web/src/lib/components/ui/sheet/sheet-footer.svelte +20 -0
  408. package/web/src/lib/components/ui/sheet/sheet-header.svelte +20 -0
  409. package/web/src/lib/components/ui/sheet/sheet-overlay.svelte +20 -0
  410. package/web/src/lib/components/ui/sheet/sheet-portal.svelte +7 -0
  411. package/web/src/lib/components/ui/sheet/sheet-title.svelte +17 -0
  412. package/web/src/lib/components/ui/sheet/sheet-trigger.svelte +7 -0
  413. package/web/src/lib/components/ui/sheet/sheet.svelte +7 -0
  414. package/web/src/lib/components/ui/sidebar/constants.ts +6 -0
  415. package/web/src/lib/components/ui/sidebar/context.svelte.ts +79 -0
  416. package/web/src/lib/components/ui/sidebar/index.ts +75 -0
  417. package/web/src/lib/components/ui/sidebar/sidebar-content.svelte +24 -0
  418. package/web/src/lib/components/ui/sidebar/sidebar-footer.svelte +21 -0
  419. package/web/src/lib/components/ui/sidebar/sidebar-group-action.svelte +36 -0
  420. package/web/src/lib/components/ui/sidebar/sidebar-group-content.svelte +21 -0
  421. package/web/src/lib/components/ui/sidebar/sidebar-group-label.svelte +34 -0
  422. package/web/src/lib/components/ui/sidebar/sidebar-group.svelte +21 -0
  423. package/web/src/lib/components/ui/sidebar/sidebar-header.svelte +21 -0
  424. package/web/src/lib/components/ui/sidebar/sidebar-input.svelte +21 -0
  425. package/web/src/lib/components/ui/sidebar/sidebar-inset.svelte +24 -0
  426. package/web/src/lib/components/ui/sidebar/sidebar-menu-action.svelte +43 -0
  427. package/web/src/lib/components/ui/sidebar/sidebar-menu-badge.svelte +29 -0
  428. package/web/src/lib/components/ui/sidebar/sidebar-menu-button.svelte +103 -0
  429. package/web/src/lib/components/ui/sidebar/sidebar-menu-item.svelte +21 -0
  430. package/web/src/lib/components/ui/sidebar/sidebar-menu-skeleton.svelte +36 -0
  431. package/web/src/lib/components/ui/sidebar/sidebar-menu-sub-button.svelte +43 -0
  432. package/web/src/lib/components/ui/sidebar/sidebar-menu-sub-item.svelte +21 -0
  433. package/web/src/lib/components/ui/sidebar/sidebar-menu-sub.svelte +25 -0
  434. package/web/src/lib/components/ui/sidebar/sidebar-menu.svelte +21 -0
  435. package/web/src/lib/components/ui/sidebar/sidebar-provider.svelte +53 -0
  436. package/web/src/lib/components/ui/sidebar/sidebar-rail.svelte +36 -0
  437. package/web/src/lib/components/ui/sidebar/sidebar-separator.svelte +19 -0
  438. package/web/src/lib/components/ui/sidebar/sidebar-trigger.svelte +35 -0
  439. package/web/src/lib/components/ui/sidebar/sidebar.svelte +104 -0
  440. package/web/src/lib/components/ui/skeleton/index.ts +7 -0
  441. package/web/src/lib/components/ui/skeleton/skeleton.svelte +17 -0
  442. package/web/src/lib/components/ui/switch/index.ts +7 -0
  443. package/web/src/lib/components/ui/switch/switch.svelte +29 -0
  444. package/web/src/lib/components/ui/textarea/index.ts +7 -0
  445. package/web/src/lib/components/ui/textarea/textarea.svelte +23 -0
  446. package/web/src/lib/components/ui/tooltip/index.ts +19 -0
  447. package/web/src/lib/components/ui/tooltip/tooltip-content.svelte +52 -0
  448. package/web/src/lib/components/ui/tooltip/tooltip-portal.svelte +7 -0
  449. package/web/src/lib/components/ui/tooltip/tooltip-provider.svelte +7 -0
  450. package/web/src/lib/components/ui/tooltip/tooltip-trigger.svelte +7 -0
  451. package/web/src/lib/components/ui/tooltip/tooltip.svelte +7 -0
  452. package/web/src/lib/hooks/is-mobile.svelte.ts +9 -0
  453. package/web/src/lib/index.ts +1 -0
  454. package/web/src/lib/types.ts +23 -0
  455. package/web/src/lib/utils.ts +13 -0
  456. package/web/src/routes/+layout.svelte +67 -0
  457. package/web/src/routes/+layout.ts +34 -0
  458. package/web/src/routes/+page.svelte +7 -0
  459. package/web/src/routes/agents/+page.svelte +206 -0
  460. package/web/src/routes/chats/[id]/+page.svelte +406 -0
  461. package/web/src/routes/chats/[id]/+page.ts +19 -0
  462. package/web/src/routes/chats/[id]/page.svelte.spec.ts +102 -0
  463. package/web/src/routes/chats/[id]/settings/+page.svelte +165 -0
  464. package/web/src/routes/chats/[id]/settings/+page.ts +18 -0
  465. package/web/src/routes/page.svelte.spec.ts +13 -0
  466. package/web/static/robots.txt +3 -0
  467. package/web/svelte.config.js +21 -0
  468. package/web/tsconfig.json +20 -0
  469. package/web/vite.config.ts +41 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lite.mjs","names":["process","commander","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__commonJS","__copyProps","__toESM","require_typeof","require_toPrimitive","require_toPropertyKey","require_defineProperty","require_objectSpread2","import_objectSpread2","import_defineProperty","import_objectSpread2$1","import_objectSpread2","import_defineProperty","__toESM","require_defineProperty","import_objectSpread2","require_objectSpread2","import_objectSpread2","__toESM","require_objectSpread2","import_objectSpread2","__toESM","require_objectSpread2","import_objectSpread2","__toESM","require_objectSpread2","import_objectSpread2","__toESM","require_objectSpread2","__toESM","require_defineProperty","import_defineProperty","import_objectSpread2","require_objectSpread2","__toESM","require_defineProperty","require_objectSpread2","__commonJS"],"sources":["../../node_modules/commander/lib/error.js","../../node_modules/commander/lib/argument.js","../../node_modules/commander/lib/help.js","../../node_modules/commander/lib/option.js","../../node_modules/commander/lib/suggestSimilar.js","../../node_modules/commander/lib/command.js","../../node_modules/commander/index.js","../../node_modules/commander/esm.mjs","../../node_modules/@trpc/client/dist/objectSpread2-BvkFp-_Y.mjs","../../node_modules/@trpc/server/dist/observable-UMO3vUa_.mjs","../../node_modules/@trpc/server/dist/observable-CUiPknO-.mjs","../../node_modules/@trpc/client/dist/splitLink-B7Cuf2c_.mjs","../../node_modules/@trpc/server/dist/codes-DagpWZLc.mjs","../../node_modules/@trpc/server/dist/getErrorShape-vC8mUXJD.mjs","../../node_modules/@trpc/server/dist/tracked-Bjtgv3wJ.mjs","../../node_modules/@trpc/client/dist/TRPCClientError-apv8gw59.mjs","../../node_modules/@trpc/client/dist/unstable-internals-Bg7n9BBj.mjs","../../node_modules/@trpc/client/dist/httpUtils-Dv57hbOd.mjs","../../node_modules/@trpc/client/dist/httpLink-Cz9h1Qgh.mjs","../../node_modules/@trpc/client/dist/httpBatchLink-fQ1NAi-e.mjs","../../node_modules/@trpc/client/dist/loggerLink-ineCN1PO.mjs","../../node_modules/@trpc/client/dist/wsLink-DSf4KOdW.mjs","../../node_modules/@trpc/client/dist/index.mjs","../../src/cli/lite.ts"],"sourcesContent":["/**\n * CommanderError class\n */\nclass CommanderError extends Error {\n /**\n * Constructs the CommanderError class\n * @param {number} exitCode suggested exit code which could be used with process.exit\n * @param {string} code an id string representing the error\n * @param {string} message human-readable description of the error\n */\n constructor(exitCode, code, message) {\n super(message);\n // properly capture stack trace in Node.js\n Error.captureStackTrace(this, this.constructor);\n this.name = this.constructor.name;\n this.code = code;\n this.exitCode = exitCode;\n this.nestedError = undefined;\n }\n}\n\n/**\n * InvalidArgumentError class\n */\nclass InvalidArgumentError extends CommanderError {\n /**\n * Constructs the InvalidArgumentError class\n * @param {string} [message] explanation of why argument is invalid\n */\n constructor(message) {\n super(1, 'commander.invalidArgument', message);\n // properly capture stack trace in Node.js\n Error.captureStackTrace(this, this.constructor);\n this.name = this.constructor.name;\n }\n}\n\nexports.CommanderError = CommanderError;\nexports.InvalidArgumentError = InvalidArgumentError;\n","const { InvalidArgumentError } = require('./error.js');\n\nclass Argument {\n /**\n * Initialize a new command argument with the given name and description.\n * The default is that the argument is required, and you can explicitly\n * indicate this with <> around the name. Put [] around the name for an optional argument.\n *\n * @param {string} name\n * @param {string} [description]\n */\n\n constructor(name, description) {\n this.description = description || '';\n this.variadic = false;\n this.parseArg = undefined;\n this.defaultValue = undefined;\n this.defaultValueDescription = undefined;\n this.argChoices = undefined;\n\n switch (name[0]) {\n case '<': // e.g. <required>\n this.required = true;\n this._name = name.slice(1, -1);\n break;\n case '[': // e.g. [optional]\n this.required = false;\n this._name = name.slice(1, -1);\n break;\n default:\n this.required = true;\n this._name = name;\n break;\n }\n\n if (this._name.endsWith('...')) {\n this.variadic = true;\n this._name = this._name.slice(0, -3);\n }\n }\n\n /**\n * Return argument name.\n *\n * @return {string}\n */\n\n name() {\n return this._name;\n }\n\n /**\n * @package\n */\n\n _collectValue(value, previous) {\n if (previous === this.defaultValue || !Array.isArray(previous)) {\n return [value];\n }\n\n previous.push(value);\n return previous;\n }\n\n /**\n * Set the default value, and optionally supply the description to be displayed in the help.\n *\n * @param {*} value\n * @param {string} [description]\n * @return {Argument}\n */\n\n default(value, description) {\n this.defaultValue = value;\n this.defaultValueDescription = description;\n return this;\n }\n\n /**\n * Set the custom handler for processing CLI command arguments into argument values.\n *\n * @param {Function} [fn]\n * @return {Argument}\n */\n\n argParser(fn) {\n this.parseArg = fn;\n return this;\n }\n\n /**\n * Only allow argument value to be one of choices.\n *\n * @param {string[]} values\n * @return {Argument}\n */\n\n choices(values) {\n this.argChoices = values.slice();\n this.parseArg = (arg, previous) => {\n if (!this.argChoices.includes(arg)) {\n throw new InvalidArgumentError(\n `Allowed choices are ${this.argChoices.join(', ')}.`,\n );\n }\n if (this.variadic) {\n return this._collectValue(arg, previous);\n }\n return arg;\n };\n return this;\n }\n\n /**\n * Make argument required.\n *\n * @returns {Argument}\n */\n argRequired() {\n this.required = true;\n return this;\n }\n\n /**\n * Make argument optional.\n *\n * @returns {Argument}\n */\n argOptional() {\n this.required = false;\n return this;\n }\n}\n\n/**\n * Takes an argument and returns its human readable equivalent for help usage.\n *\n * @param {Argument} arg\n * @return {string}\n * @private\n */\n\nfunction humanReadableArgName(arg) {\n const nameOutput = arg.name() + (arg.variadic === true ? '...' : '');\n\n return arg.required ? '<' + nameOutput + '>' : '[' + nameOutput + ']';\n}\n\nexports.Argument = Argument;\nexports.humanReadableArgName = humanReadableArgName;\n","const { humanReadableArgName } = require('./argument.js');\n\n/**\n * TypeScript import types for JSDoc, used by Visual Studio Code IntelliSense and `npm run typescript-checkJS`\n * https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#import-types\n * @typedef { import(\"./argument.js\").Argument } Argument\n * @typedef { import(\"./command.js\").Command } Command\n * @typedef { import(\"./option.js\").Option } Option\n */\n\n// Although this is a class, methods are static in style to allow override using subclass or just functions.\nclass Help {\n constructor() {\n this.helpWidth = undefined;\n this.minWidthToWrap = 40;\n this.sortSubcommands = false;\n this.sortOptions = false;\n this.showGlobalOptions = false;\n }\n\n /**\n * prepareContext is called by Commander after applying overrides from `Command.configureHelp()`\n * and just before calling `formatHelp()`.\n *\n * Commander just uses the helpWidth and the rest is provided for optional use by more complex subclasses.\n *\n * @param {{ error?: boolean, helpWidth?: number, outputHasColors?: boolean }} contextOptions\n */\n prepareContext(contextOptions) {\n this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;\n }\n\n /**\n * Get an array of the visible subcommands. Includes a placeholder for the implicit help command, if there is one.\n *\n * @param {Command} cmd\n * @returns {Command[]}\n */\n\n visibleCommands(cmd) {\n const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden);\n const helpCommand = cmd._getHelpCommand();\n if (helpCommand && !helpCommand._hidden) {\n visibleCommands.push(helpCommand);\n }\n if (this.sortSubcommands) {\n visibleCommands.sort((a, b) => {\n // @ts-ignore: because overloaded return type\n return a.name().localeCompare(b.name());\n });\n }\n return visibleCommands;\n }\n\n /**\n * Compare options for sort.\n *\n * @param {Option} a\n * @param {Option} b\n * @returns {number}\n */\n compareOptions(a, b) {\n const getSortKey = (option) => {\n // WYSIWYG for order displayed in help. Short used for comparison if present. No special handling for negated.\n return option.short\n ? option.short.replace(/^-/, '')\n : option.long.replace(/^--/, '');\n };\n return getSortKey(a).localeCompare(getSortKey(b));\n }\n\n /**\n * Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one.\n *\n * @param {Command} cmd\n * @returns {Option[]}\n */\n\n visibleOptions(cmd) {\n const visibleOptions = cmd.options.filter((option) => !option.hidden);\n // Built-in help option.\n const helpOption = cmd._getHelpOption();\n if (helpOption && !helpOption.hidden) {\n // Automatically hide conflicting flags. Bit dubious but a historical behaviour that is convenient for single-command programs.\n const removeShort = helpOption.short && cmd._findOption(helpOption.short);\n const removeLong = helpOption.long && cmd._findOption(helpOption.long);\n if (!removeShort && !removeLong) {\n visibleOptions.push(helpOption); // no changes needed\n } else if (helpOption.long && !removeLong) {\n visibleOptions.push(\n cmd.createOption(helpOption.long, helpOption.description),\n );\n } else if (helpOption.short && !removeShort) {\n visibleOptions.push(\n cmd.createOption(helpOption.short, helpOption.description),\n );\n }\n }\n if (this.sortOptions) {\n visibleOptions.sort(this.compareOptions);\n }\n return visibleOptions;\n }\n\n /**\n * Get an array of the visible global options. (Not including help.)\n *\n * @param {Command} cmd\n * @returns {Option[]}\n */\n\n visibleGlobalOptions(cmd) {\n if (!this.showGlobalOptions) return [];\n\n const globalOptions = [];\n for (\n let ancestorCmd = cmd.parent;\n ancestorCmd;\n ancestorCmd = ancestorCmd.parent\n ) {\n const visibleOptions = ancestorCmd.options.filter(\n (option) => !option.hidden,\n );\n globalOptions.push(...visibleOptions);\n }\n if (this.sortOptions) {\n globalOptions.sort(this.compareOptions);\n }\n return globalOptions;\n }\n\n /**\n * Get an array of the arguments if any have a description.\n *\n * @param {Command} cmd\n * @returns {Argument[]}\n */\n\n visibleArguments(cmd) {\n // Side effect! Apply the legacy descriptions before the arguments are displayed.\n if (cmd._argsDescription) {\n cmd.registeredArguments.forEach((argument) => {\n argument.description =\n argument.description || cmd._argsDescription[argument.name()] || '';\n });\n }\n\n // If there are any arguments with a description then return all the arguments.\n if (cmd.registeredArguments.find((argument) => argument.description)) {\n return cmd.registeredArguments;\n }\n return [];\n }\n\n /**\n * Get the command term to show in the list of subcommands.\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n subcommandTerm(cmd) {\n // Legacy. Ignores custom usage string, and nested commands.\n const args = cmd.registeredArguments\n .map((arg) => humanReadableArgName(arg))\n .join(' ');\n return (\n cmd._name +\n (cmd._aliases[0] ? '|' + cmd._aliases[0] : '') +\n (cmd.options.length ? ' [options]' : '') + // simplistic check for non-help option\n (args ? ' ' + args : '')\n );\n }\n\n /**\n * Get the option term to show in the list of options.\n *\n * @param {Option} option\n * @returns {string}\n */\n\n optionTerm(option) {\n return option.flags;\n }\n\n /**\n * Get the argument term to show in the list of arguments.\n *\n * @param {Argument} argument\n * @returns {string}\n */\n\n argumentTerm(argument) {\n return argument.name();\n }\n\n /**\n * Get the longest command term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestSubcommandTermLength(cmd, helper) {\n return helper.visibleCommands(cmd).reduce((max, command) => {\n return Math.max(\n max,\n this.displayWidth(\n helper.styleSubcommandTerm(helper.subcommandTerm(command)),\n ),\n );\n }, 0);\n }\n\n /**\n * Get the longest option term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestOptionTermLength(cmd, helper) {\n return helper.visibleOptions(cmd).reduce((max, option) => {\n return Math.max(\n max,\n this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))),\n );\n }, 0);\n }\n\n /**\n * Get the longest global option term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestGlobalOptionTermLength(cmd, helper) {\n return helper.visibleGlobalOptions(cmd).reduce((max, option) => {\n return Math.max(\n max,\n this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))),\n );\n }, 0);\n }\n\n /**\n * Get the longest argument term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestArgumentTermLength(cmd, helper) {\n return helper.visibleArguments(cmd).reduce((max, argument) => {\n return Math.max(\n max,\n this.displayWidth(\n helper.styleArgumentTerm(helper.argumentTerm(argument)),\n ),\n );\n }, 0);\n }\n\n /**\n * Get the command usage to be displayed at the top of the built-in help.\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n commandUsage(cmd) {\n // Usage\n let cmdName = cmd._name;\n if (cmd._aliases[0]) {\n cmdName = cmdName + '|' + cmd._aliases[0];\n }\n let ancestorCmdNames = '';\n for (\n let ancestorCmd = cmd.parent;\n ancestorCmd;\n ancestorCmd = ancestorCmd.parent\n ) {\n ancestorCmdNames = ancestorCmd.name() + ' ' + ancestorCmdNames;\n }\n return ancestorCmdNames + cmdName + ' ' + cmd.usage();\n }\n\n /**\n * Get the description for the command.\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n commandDescription(cmd) {\n // @ts-ignore: because overloaded return type\n return cmd.description();\n }\n\n /**\n * Get the subcommand summary to show in the list of subcommands.\n * (Fallback to description for backwards compatibility.)\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n subcommandDescription(cmd) {\n // @ts-ignore: because overloaded return type\n return cmd.summary() || cmd.description();\n }\n\n /**\n * Get the option description to show in the list of options.\n *\n * @param {Option} option\n * @return {string}\n */\n\n optionDescription(option) {\n const extraInfo = [];\n\n if (option.argChoices) {\n extraInfo.push(\n // use stringify to match the display of the default value\n `choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`,\n );\n }\n if (option.defaultValue !== undefined) {\n // default for boolean and negated more for programmer than end user,\n // but show true/false for boolean option as may be for hand-rolled env or config processing.\n const showDefault =\n option.required ||\n option.optional ||\n (option.isBoolean() && typeof option.defaultValue === 'boolean');\n if (showDefault) {\n extraInfo.push(\n `default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}`,\n );\n }\n }\n // preset for boolean and negated are more for programmer than end user\n if (option.presetArg !== undefined && option.optional) {\n extraInfo.push(`preset: ${JSON.stringify(option.presetArg)}`);\n }\n if (option.envVar !== undefined) {\n extraInfo.push(`env: ${option.envVar}`);\n }\n if (extraInfo.length > 0) {\n const extraDescription = `(${extraInfo.join(', ')})`;\n if (option.description) {\n return `${option.description} ${extraDescription}`;\n }\n return extraDescription;\n }\n\n return option.description;\n }\n\n /**\n * Get the argument description to show in the list of arguments.\n *\n * @param {Argument} argument\n * @return {string}\n */\n\n argumentDescription(argument) {\n const extraInfo = [];\n if (argument.argChoices) {\n extraInfo.push(\n // use stringify to match the display of the default value\n `choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`,\n );\n }\n if (argument.defaultValue !== undefined) {\n extraInfo.push(\n `default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`,\n );\n }\n if (extraInfo.length > 0) {\n const extraDescription = `(${extraInfo.join(', ')})`;\n if (argument.description) {\n return `${argument.description} ${extraDescription}`;\n }\n return extraDescription;\n }\n return argument.description;\n }\n\n /**\n * Format a list of items, given a heading and an array of formatted items.\n *\n * @param {string} heading\n * @param {string[]} items\n * @param {Help} helper\n * @returns string[]\n */\n formatItemList(heading, items, helper) {\n if (items.length === 0) return [];\n\n return [helper.styleTitle(heading), ...items, ''];\n }\n\n /**\n * Group items by their help group heading.\n *\n * @param {Command[] | Option[]} unsortedItems\n * @param {Command[] | Option[]} visibleItems\n * @param {Function} getGroup\n * @returns {Map<string, Command[] | Option[]>}\n */\n groupItems(unsortedItems, visibleItems, getGroup) {\n const result = new Map();\n // Add groups in order of appearance in unsortedItems.\n unsortedItems.forEach((item) => {\n const group = getGroup(item);\n if (!result.has(group)) result.set(group, []);\n });\n // Add items in order of appearance in visibleItems.\n visibleItems.forEach((item) => {\n const group = getGroup(item);\n if (!result.has(group)) {\n result.set(group, []);\n }\n result.get(group).push(item);\n });\n return result;\n }\n\n /**\n * Generate the built-in help text.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {string}\n */\n\n formatHelp(cmd, helper) {\n const termWidth = helper.padWidth(cmd, helper);\n const helpWidth = helper.helpWidth ?? 80; // in case prepareContext() was not called\n\n function callFormatItem(term, description) {\n return helper.formatItem(term, termWidth, description, helper);\n }\n\n // Usage\n let output = [\n `${helper.styleTitle('Usage:')} ${helper.styleUsage(helper.commandUsage(cmd))}`,\n '',\n ];\n\n // Description\n const commandDescription = helper.commandDescription(cmd);\n if (commandDescription.length > 0) {\n output = output.concat([\n helper.boxWrap(\n helper.styleCommandDescription(commandDescription),\n helpWidth,\n ),\n '',\n ]);\n }\n\n // Arguments\n const argumentList = helper.visibleArguments(cmd).map((argument) => {\n return callFormatItem(\n helper.styleArgumentTerm(helper.argumentTerm(argument)),\n helper.styleArgumentDescription(helper.argumentDescription(argument)),\n );\n });\n output = output.concat(\n this.formatItemList('Arguments:', argumentList, helper),\n );\n\n // Options\n const optionGroups = this.groupItems(\n cmd.options,\n helper.visibleOptions(cmd),\n (option) => option.helpGroupHeading ?? 'Options:',\n );\n optionGroups.forEach((options, group) => {\n const optionList = options.map((option) => {\n return callFormatItem(\n helper.styleOptionTerm(helper.optionTerm(option)),\n helper.styleOptionDescription(helper.optionDescription(option)),\n );\n });\n output = output.concat(this.formatItemList(group, optionList, helper));\n });\n\n if (helper.showGlobalOptions) {\n const globalOptionList = helper\n .visibleGlobalOptions(cmd)\n .map((option) => {\n return callFormatItem(\n helper.styleOptionTerm(helper.optionTerm(option)),\n helper.styleOptionDescription(helper.optionDescription(option)),\n );\n });\n output = output.concat(\n this.formatItemList('Global Options:', globalOptionList, helper),\n );\n }\n\n // Commands\n const commandGroups = this.groupItems(\n cmd.commands,\n helper.visibleCommands(cmd),\n (sub) => sub.helpGroup() || 'Commands:',\n );\n commandGroups.forEach((commands, group) => {\n const commandList = commands.map((sub) => {\n return callFormatItem(\n helper.styleSubcommandTerm(helper.subcommandTerm(sub)),\n helper.styleSubcommandDescription(helper.subcommandDescription(sub)),\n );\n });\n output = output.concat(this.formatItemList(group, commandList, helper));\n });\n\n return output.join('\\n');\n }\n\n /**\n * Return display width of string, ignoring ANSI escape sequences. Used in padding and wrapping calculations.\n *\n * @param {string} str\n * @returns {number}\n */\n displayWidth(str) {\n return stripColor(str).length;\n }\n\n /**\n * Style the title for displaying in the help. Called with 'Usage:', 'Options:', etc.\n *\n * @param {string} str\n * @returns {string}\n */\n styleTitle(str) {\n return str;\n }\n\n styleUsage(str) {\n // Usage has lots of parts the user might like to color separately! Assume default usage string which is formed like:\n // command subcommand [options] [command] <foo> [bar]\n return str\n .split(' ')\n .map((word) => {\n if (word === '[options]') return this.styleOptionText(word);\n if (word === '[command]') return this.styleSubcommandText(word);\n if (word[0] === '[' || word[0] === '<')\n return this.styleArgumentText(word);\n return this.styleCommandText(word); // Restrict to initial words?\n })\n .join(' ');\n }\n styleCommandDescription(str) {\n return this.styleDescriptionText(str);\n }\n styleOptionDescription(str) {\n return this.styleDescriptionText(str);\n }\n styleSubcommandDescription(str) {\n return this.styleDescriptionText(str);\n }\n styleArgumentDescription(str) {\n return this.styleDescriptionText(str);\n }\n styleDescriptionText(str) {\n return str;\n }\n styleOptionTerm(str) {\n return this.styleOptionText(str);\n }\n styleSubcommandTerm(str) {\n // This is very like usage with lots of parts! Assume default string which is formed like:\n // subcommand [options] <foo> [bar]\n return str\n .split(' ')\n .map((word) => {\n if (word === '[options]') return this.styleOptionText(word);\n if (word[0] === '[' || word[0] === '<')\n return this.styleArgumentText(word);\n return this.styleSubcommandText(word); // Restrict to initial words?\n })\n .join(' ');\n }\n styleArgumentTerm(str) {\n return this.styleArgumentText(str);\n }\n styleOptionText(str) {\n return str;\n }\n styleArgumentText(str) {\n return str;\n }\n styleSubcommandText(str) {\n return str;\n }\n styleCommandText(str) {\n return str;\n }\n\n /**\n * Calculate the pad width from the maximum term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n padWidth(cmd, helper) {\n return Math.max(\n helper.longestOptionTermLength(cmd, helper),\n helper.longestGlobalOptionTermLength(cmd, helper),\n helper.longestSubcommandTermLength(cmd, helper),\n helper.longestArgumentTermLength(cmd, helper),\n );\n }\n\n /**\n * Detect manually wrapped and indented strings by checking for line break followed by whitespace.\n *\n * @param {string} str\n * @returns {boolean}\n */\n preformatted(str) {\n return /\\n[^\\S\\r\\n]/.test(str);\n }\n\n /**\n * Format the \"item\", which consists of a term and description. Pad the term and wrap the description, indenting the following lines.\n *\n * So \"TTT\", 5, \"DDD DDDD DD DDD\" might be formatted for this.helpWidth=17 like so:\n * TTT DDD DDDD\n * DD DDD\n *\n * @param {string} term\n * @param {number} termWidth\n * @param {string} description\n * @param {Help} helper\n * @returns {string}\n */\n formatItem(term, termWidth, description, helper) {\n const itemIndent = 2;\n const itemIndentStr = ' '.repeat(itemIndent);\n if (!description) return itemIndentStr + term;\n\n // Pad the term out to a consistent width, so descriptions are aligned.\n const paddedTerm = term.padEnd(\n termWidth + term.length - helper.displayWidth(term),\n );\n\n // Format the description.\n const spacerWidth = 2; // between term and description\n const helpWidth = this.helpWidth ?? 80; // in case prepareContext() was not called\n const remainingWidth = helpWidth - termWidth - spacerWidth - itemIndent;\n let formattedDescription;\n if (\n remainingWidth < this.minWidthToWrap ||\n helper.preformatted(description)\n ) {\n formattedDescription = description;\n } else {\n const wrappedDescription = helper.boxWrap(description, remainingWidth);\n formattedDescription = wrappedDescription.replace(\n /\\n/g,\n '\\n' + ' '.repeat(termWidth + spacerWidth),\n );\n }\n\n // Construct and overall indent.\n return (\n itemIndentStr +\n paddedTerm +\n ' '.repeat(spacerWidth) +\n formattedDescription.replace(/\\n/g, `\\n${itemIndentStr}`)\n );\n }\n\n /**\n * Wrap a string at whitespace, preserving existing line breaks.\n * Wrapping is skipped if the width is less than `minWidthToWrap`.\n *\n * @param {string} str\n * @param {number} width\n * @returns {string}\n */\n boxWrap(str, width) {\n if (width < this.minWidthToWrap) return str;\n\n const rawLines = str.split(/\\r\\n|\\n/);\n // split up text by whitespace\n const chunkPattern = /[\\s]*[^\\s]+/g;\n const wrappedLines = [];\n rawLines.forEach((line) => {\n const chunks = line.match(chunkPattern);\n if (chunks === null) {\n wrappedLines.push('');\n return;\n }\n\n let sumChunks = [chunks.shift()];\n let sumWidth = this.displayWidth(sumChunks[0]);\n chunks.forEach((chunk) => {\n const visibleWidth = this.displayWidth(chunk);\n // Accumulate chunks while they fit into width.\n if (sumWidth + visibleWidth <= width) {\n sumChunks.push(chunk);\n sumWidth += visibleWidth;\n return;\n }\n wrappedLines.push(sumChunks.join(''));\n\n const nextChunk = chunk.trimStart(); // trim space at line break\n sumChunks = [nextChunk];\n sumWidth = this.displayWidth(nextChunk);\n });\n wrappedLines.push(sumChunks.join(''));\n });\n\n return wrappedLines.join('\\n');\n }\n}\n\n/**\n * Strip style ANSI escape sequences from the string. In particular, SGR (Select Graphic Rendition) codes.\n *\n * @param {string} str\n * @returns {string}\n * @package\n */\n\nfunction stripColor(str) {\n // eslint-disable-next-line no-control-regex\n const sgrPattern = /\\x1b\\[\\d*(;\\d*)*m/g;\n return str.replace(sgrPattern, '');\n}\n\nexports.Help = Help;\nexports.stripColor = stripColor;\n","const { InvalidArgumentError } = require('./error.js');\n\nclass Option {\n /**\n * Initialize a new `Option` with the given `flags` and `description`.\n *\n * @param {string} flags\n * @param {string} [description]\n */\n\n constructor(flags, description) {\n this.flags = flags;\n this.description = description || '';\n\n this.required = flags.includes('<'); // A value must be supplied when the option is specified.\n this.optional = flags.includes('['); // A value is optional when the option is specified.\n // variadic test ignores <value,...> et al which might be used to describe custom splitting of single argument\n this.variadic = /\\w\\.\\.\\.[>\\]]$/.test(flags); // The option can take multiple values.\n this.mandatory = false; // The option must have a value after parsing, which usually means it must be specified on command line.\n const optionFlags = splitOptionFlags(flags);\n this.short = optionFlags.shortFlag; // May be a short flag, undefined, or even a long flag (if option has two long flags).\n this.long = optionFlags.longFlag;\n this.negate = false;\n if (this.long) {\n this.negate = this.long.startsWith('--no-');\n }\n this.defaultValue = undefined;\n this.defaultValueDescription = undefined;\n this.presetArg = undefined;\n this.envVar = undefined;\n this.parseArg = undefined;\n this.hidden = false;\n this.argChoices = undefined;\n this.conflictsWith = [];\n this.implied = undefined;\n this.helpGroupHeading = undefined; // soft initialised when option added to command\n }\n\n /**\n * Set the default value, and optionally supply the description to be displayed in the help.\n *\n * @param {*} value\n * @param {string} [description]\n * @return {Option}\n */\n\n default(value, description) {\n this.defaultValue = value;\n this.defaultValueDescription = description;\n return this;\n }\n\n /**\n * Preset to use when option used without option-argument, especially optional but also boolean and negated.\n * The custom processing (parseArg) is called.\n *\n * @example\n * new Option('--color').default('GREYSCALE').preset('RGB');\n * new Option('--donate [amount]').preset('20').argParser(parseFloat);\n *\n * @param {*} arg\n * @return {Option}\n */\n\n preset(arg) {\n this.presetArg = arg;\n return this;\n }\n\n /**\n * Add option name(s) that conflict with this option.\n * An error will be displayed if conflicting options are found during parsing.\n *\n * @example\n * new Option('--rgb').conflicts('cmyk');\n * new Option('--js').conflicts(['ts', 'jsx']);\n *\n * @param {(string | string[])} names\n * @return {Option}\n */\n\n conflicts(names) {\n this.conflictsWith = this.conflictsWith.concat(names);\n return this;\n }\n\n /**\n * Specify implied option values for when this option is set and the implied options are not.\n *\n * The custom processing (parseArg) is not called on the implied values.\n *\n * @example\n * program\n * .addOption(new Option('--log', 'write logging information to file'))\n * .addOption(new Option('--trace', 'log extra details').implies({ log: 'trace.txt' }));\n *\n * @param {object} impliedOptionValues\n * @return {Option}\n */\n implies(impliedOptionValues) {\n let newImplied = impliedOptionValues;\n if (typeof impliedOptionValues === 'string') {\n // string is not documented, but easy mistake and we can do what user probably intended.\n newImplied = { [impliedOptionValues]: true };\n }\n this.implied = Object.assign(this.implied || {}, newImplied);\n return this;\n }\n\n /**\n * Set environment variable to check for option value.\n *\n * An environment variable is only used if when processed the current option value is\n * undefined, or the source of the current value is 'default' or 'config' or 'env'.\n *\n * @param {string} name\n * @return {Option}\n */\n\n env(name) {\n this.envVar = name;\n return this;\n }\n\n /**\n * Set the custom handler for processing CLI option arguments into option values.\n *\n * @param {Function} [fn]\n * @return {Option}\n */\n\n argParser(fn) {\n this.parseArg = fn;\n return this;\n }\n\n /**\n * Whether the option is mandatory and must have a value after parsing.\n *\n * @param {boolean} [mandatory=true]\n * @return {Option}\n */\n\n makeOptionMandatory(mandatory = true) {\n this.mandatory = !!mandatory;\n return this;\n }\n\n /**\n * Hide option in help.\n *\n * @param {boolean} [hide=true]\n * @return {Option}\n */\n\n hideHelp(hide = true) {\n this.hidden = !!hide;\n return this;\n }\n\n /**\n * @package\n */\n\n _collectValue(value, previous) {\n if (previous === this.defaultValue || !Array.isArray(previous)) {\n return [value];\n }\n\n previous.push(value);\n return previous;\n }\n\n /**\n * Only allow option value to be one of choices.\n *\n * @param {string[]} values\n * @return {Option}\n */\n\n choices(values) {\n this.argChoices = values.slice();\n this.parseArg = (arg, previous) => {\n if (!this.argChoices.includes(arg)) {\n throw new InvalidArgumentError(\n `Allowed choices are ${this.argChoices.join(', ')}.`,\n );\n }\n if (this.variadic) {\n return this._collectValue(arg, previous);\n }\n return arg;\n };\n return this;\n }\n\n /**\n * Return option name.\n *\n * @return {string}\n */\n\n name() {\n if (this.long) {\n return this.long.replace(/^--/, '');\n }\n return this.short.replace(/^-/, '');\n }\n\n /**\n * Return option name, in a camelcase format that can be used\n * as an object attribute key.\n *\n * @return {string}\n */\n\n attributeName() {\n if (this.negate) {\n return camelcase(this.name().replace(/^no-/, ''));\n }\n return camelcase(this.name());\n }\n\n /**\n * Set the help group heading.\n *\n * @param {string} heading\n * @return {Option}\n */\n helpGroup(heading) {\n this.helpGroupHeading = heading;\n return this;\n }\n\n /**\n * Check if `arg` matches the short or long flag.\n *\n * @param {string} arg\n * @return {boolean}\n * @package\n */\n\n is(arg) {\n return this.short === arg || this.long === arg;\n }\n\n /**\n * Return whether a boolean option.\n *\n * Options are one of boolean, negated, required argument, or optional argument.\n *\n * @return {boolean}\n * @package\n */\n\n isBoolean() {\n return !this.required && !this.optional && !this.negate;\n }\n}\n\n/**\n * This class is to make it easier to work with dual options, without changing the existing\n * implementation. We support separate dual options for separate positive and negative options,\n * like `--build` and `--no-build`, which share a single option value. This works nicely for some\n * use cases, but is tricky for others where we want separate behaviours despite\n * the single shared option value.\n */\nclass DualOptions {\n /**\n * @param {Option[]} options\n */\n constructor(options) {\n this.positiveOptions = new Map();\n this.negativeOptions = new Map();\n this.dualOptions = new Set();\n options.forEach((option) => {\n if (option.negate) {\n this.negativeOptions.set(option.attributeName(), option);\n } else {\n this.positiveOptions.set(option.attributeName(), option);\n }\n });\n this.negativeOptions.forEach((value, key) => {\n if (this.positiveOptions.has(key)) {\n this.dualOptions.add(key);\n }\n });\n }\n\n /**\n * Did the value come from the option, and not from possible matching dual option?\n *\n * @param {*} value\n * @param {Option} option\n * @returns {boolean}\n */\n valueFromOption(value, option) {\n const optionKey = option.attributeName();\n if (!this.dualOptions.has(optionKey)) return true;\n\n // Use the value to deduce if (probably) came from the option.\n const preset = this.negativeOptions.get(optionKey).presetArg;\n const negativeValue = preset !== undefined ? preset : false;\n return option.negate === (negativeValue === value);\n }\n}\n\n/**\n * Convert string from kebab-case to camelCase.\n *\n * @param {string} str\n * @return {string}\n * @private\n */\n\nfunction camelcase(str) {\n return str.split('-').reduce((str, word) => {\n return str + word[0].toUpperCase() + word.slice(1);\n });\n}\n\n/**\n * Split the short and long flag out of something like '-m,--mixed <value>'\n *\n * @private\n */\n\nfunction splitOptionFlags(flags) {\n let shortFlag;\n let longFlag;\n // short flag, single dash and single character\n const shortFlagExp = /^-[^-]$/;\n // long flag, double dash and at least one character\n const longFlagExp = /^--[^-]/;\n\n const flagParts = flags.split(/[ |,]+/).concat('guard');\n // Normal is short and/or long.\n if (shortFlagExp.test(flagParts[0])) shortFlag = flagParts.shift();\n if (longFlagExp.test(flagParts[0])) longFlag = flagParts.shift();\n // Long then short. Rarely used but fine.\n if (!shortFlag && shortFlagExp.test(flagParts[0]))\n shortFlag = flagParts.shift();\n // Allow two long flags, like '--ws, --workspace'\n // This is the supported way to have a shortish option flag.\n if (!shortFlag && longFlagExp.test(flagParts[0])) {\n shortFlag = longFlag;\n longFlag = flagParts.shift();\n }\n\n // Check for unprocessed flag. Fail noisily rather than silently ignore.\n if (flagParts[0].startsWith('-')) {\n const unsupportedFlag = flagParts[0];\n const baseError = `option creation failed due to '${unsupportedFlag}' in option flags '${flags}'`;\n if (/^-[^-][^-]/.test(unsupportedFlag))\n throw new Error(\n `${baseError}\n- a short flag is a single dash and a single character\n - either use a single dash and a single character (for a short flag)\n - or use a double dash for a long option (and can have two, like '--ws, --workspace')`,\n );\n if (shortFlagExp.test(unsupportedFlag))\n throw new Error(`${baseError}\n- too many short flags`);\n if (longFlagExp.test(unsupportedFlag))\n throw new Error(`${baseError}\n- too many long flags`);\n\n throw new Error(`${baseError}\n- unrecognised flag format`);\n }\n if (shortFlag === undefined && longFlag === undefined)\n throw new Error(\n `option creation failed due to no flags found in '${flags}'.`,\n );\n\n return { shortFlag, longFlag };\n}\n\nexports.Option = Option;\nexports.DualOptions = DualOptions;\n","const maxDistance = 3;\n\nfunction editDistance(a, b) {\n // https://en.wikipedia.org/wiki/Damerau–Levenshtein_distance\n // Calculating optimal string alignment distance, no substring is edited more than once.\n // (Simple implementation.)\n\n // Quick early exit, return worst case.\n if (Math.abs(a.length - b.length) > maxDistance)\n return Math.max(a.length, b.length);\n\n // distance between prefix substrings of a and b\n const d = [];\n\n // pure deletions turn a into empty string\n for (let i = 0; i <= a.length; i++) {\n d[i] = [i];\n }\n // pure insertions turn empty string into b\n for (let j = 0; j <= b.length; j++) {\n d[0][j] = j;\n }\n\n // fill matrix\n for (let j = 1; j <= b.length; j++) {\n for (let i = 1; i <= a.length; i++) {\n let cost = 1;\n if (a[i - 1] === b[j - 1]) {\n cost = 0;\n } else {\n cost = 1;\n }\n d[i][j] = Math.min(\n d[i - 1][j] + 1, // deletion\n d[i][j - 1] + 1, // insertion\n d[i - 1][j - 1] + cost, // substitution\n );\n // transposition\n if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {\n d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);\n }\n }\n }\n\n return d[a.length][b.length];\n}\n\n/**\n * Find close matches, restricted to same number of edits.\n *\n * @param {string} word\n * @param {string[]} candidates\n * @returns {string}\n */\n\nfunction suggestSimilar(word, candidates) {\n if (!candidates || candidates.length === 0) return '';\n // remove possible duplicates\n candidates = Array.from(new Set(candidates));\n\n const searchingOptions = word.startsWith('--');\n if (searchingOptions) {\n word = word.slice(2);\n candidates = candidates.map((candidate) => candidate.slice(2));\n }\n\n let similar = [];\n let bestDistance = maxDistance;\n const minSimilarity = 0.4;\n candidates.forEach((candidate) => {\n if (candidate.length <= 1) return; // no one character guesses\n\n const distance = editDistance(word, candidate);\n const length = Math.max(word.length, candidate.length);\n const similarity = (length - distance) / length;\n if (similarity > minSimilarity) {\n if (distance < bestDistance) {\n // better edit distance, throw away previous worse matches\n bestDistance = distance;\n similar = [candidate];\n } else if (distance === bestDistance) {\n similar.push(candidate);\n }\n }\n });\n\n similar.sort((a, b) => a.localeCompare(b));\n if (searchingOptions) {\n similar = similar.map((candidate) => `--${candidate}`);\n }\n\n if (similar.length > 1) {\n return `\\n(Did you mean one of ${similar.join(', ')}?)`;\n }\n if (similar.length === 1) {\n return `\\n(Did you mean ${similar[0]}?)`;\n }\n return '';\n}\n\nexports.suggestSimilar = suggestSimilar;\n","const EventEmitter = require('node:events').EventEmitter;\nconst childProcess = require('node:child_process');\nconst path = require('node:path');\nconst fs = require('node:fs');\nconst process = require('node:process');\n\nconst { Argument, humanReadableArgName } = require('./argument.js');\nconst { CommanderError } = require('./error.js');\nconst { Help, stripColor } = require('./help.js');\nconst { Option, DualOptions } = require('./option.js');\nconst { suggestSimilar } = require('./suggestSimilar');\n\nclass Command extends EventEmitter {\n /**\n * Initialize a new `Command`.\n *\n * @param {string} [name]\n */\n\n constructor(name) {\n super();\n /** @type {Command[]} */\n this.commands = [];\n /** @type {Option[]} */\n this.options = [];\n this.parent = null;\n this._allowUnknownOption = false;\n this._allowExcessArguments = false;\n /** @type {Argument[]} */\n this.registeredArguments = [];\n this._args = this.registeredArguments; // deprecated old name\n /** @type {string[]} */\n this.args = []; // cli args with options removed\n this.rawArgs = [];\n this.processedArgs = []; // like .args but after custom processing and collecting variadic\n this._scriptPath = null;\n this._name = name || '';\n this._optionValues = {};\n this._optionValueSources = {}; // default, env, cli etc\n this._storeOptionsAsProperties = false;\n this._actionHandler = null;\n this._executableHandler = false;\n this._executableFile = null; // custom name for executable\n this._executableDir = null; // custom search directory for subcommands\n this._defaultCommandName = null;\n this._exitCallback = null;\n this._aliases = [];\n this._combineFlagAndOptionalValue = true;\n this._description = '';\n this._summary = '';\n this._argsDescription = undefined; // legacy\n this._enablePositionalOptions = false;\n this._passThroughOptions = false;\n this._lifeCycleHooks = {}; // a hash of arrays\n /** @type {(boolean | string)} */\n this._showHelpAfterError = false;\n this._showSuggestionAfterError = true;\n this._savedState = null; // used in save/restoreStateBeforeParse\n\n // see configureOutput() for docs\n this._outputConfiguration = {\n writeOut: (str) => process.stdout.write(str),\n writeErr: (str) => process.stderr.write(str),\n outputError: (str, write) => write(str),\n getOutHelpWidth: () =>\n process.stdout.isTTY ? process.stdout.columns : undefined,\n getErrHelpWidth: () =>\n process.stderr.isTTY ? process.stderr.columns : undefined,\n getOutHasColors: () =>\n useColor() ?? (process.stdout.isTTY && process.stdout.hasColors?.()),\n getErrHasColors: () =>\n useColor() ?? (process.stderr.isTTY && process.stderr.hasColors?.()),\n stripColor: (str) => stripColor(str),\n };\n\n this._hidden = false;\n /** @type {(Option | null | undefined)} */\n this._helpOption = undefined; // Lazy created on demand. May be null if help option is disabled.\n this._addImplicitHelpCommand = undefined; // undecided whether true or false yet, not inherited\n /** @type {Command} */\n this._helpCommand = undefined; // lazy initialised, inherited\n this._helpConfiguration = {};\n /** @type {string | undefined} */\n this._helpGroupHeading = undefined; // soft initialised when added to parent\n /** @type {string | undefined} */\n this._defaultCommandGroup = undefined;\n /** @type {string | undefined} */\n this._defaultOptionGroup = undefined;\n }\n\n /**\n * Copy settings that are useful to have in common across root command and subcommands.\n *\n * (Used internally when adding a command using `.command()` so subcommands inherit parent settings.)\n *\n * @param {Command} sourceCommand\n * @return {Command} `this` command for chaining\n */\n copyInheritedSettings(sourceCommand) {\n this._outputConfiguration = sourceCommand._outputConfiguration;\n this._helpOption = sourceCommand._helpOption;\n this._helpCommand = sourceCommand._helpCommand;\n this._helpConfiguration = sourceCommand._helpConfiguration;\n this._exitCallback = sourceCommand._exitCallback;\n this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties;\n this._combineFlagAndOptionalValue =\n sourceCommand._combineFlagAndOptionalValue;\n this._allowExcessArguments = sourceCommand._allowExcessArguments;\n this._enablePositionalOptions = sourceCommand._enablePositionalOptions;\n this._showHelpAfterError = sourceCommand._showHelpAfterError;\n this._showSuggestionAfterError = sourceCommand._showSuggestionAfterError;\n\n return this;\n }\n\n /**\n * @returns {Command[]}\n * @private\n */\n\n _getCommandAndAncestors() {\n const result = [];\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n for (let command = this; command; command = command.parent) {\n result.push(command);\n }\n return result;\n }\n\n /**\n * Define a command.\n *\n * There are two styles of command: pay attention to where to put the description.\n *\n * @example\n * // Command implemented using action handler (description is supplied separately to `.command`)\n * program\n * .command('clone <source> [destination]')\n * .description('clone a repository into a newly created directory')\n * .action((source, destination) => {\n * console.log('clone command called');\n * });\n *\n * // Command implemented using separate executable file (description is second parameter to `.command`)\n * program\n * .command('start <service>', 'start named service')\n * .command('stop [service]', 'stop named service, or all if no name supplied');\n *\n * @param {string} nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`\n * @param {(object | string)} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable)\n * @param {object} [execOpts] - configuration options (for executable)\n * @return {Command} returns new command for action handler, or `this` for executable command\n */\n\n command(nameAndArgs, actionOptsOrExecDesc, execOpts) {\n let desc = actionOptsOrExecDesc;\n let opts = execOpts;\n if (typeof desc === 'object' && desc !== null) {\n opts = desc;\n desc = null;\n }\n opts = opts || {};\n const [, name, args] = nameAndArgs.match(/([^ ]+) *(.*)/);\n\n const cmd = this.createCommand(name);\n if (desc) {\n cmd.description(desc);\n cmd._executableHandler = true;\n }\n if (opts.isDefault) this._defaultCommandName = cmd._name;\n cmd._hidden = !!(opts.noHelp || opts.hidden); // noHelp is deprecated old name for hidden\n cmd._executableFile = opts.executableFile || null; // Custom name for executable file, set missing to null to match constructor\n if (args) cmd.arguments(args);\n this._registerCommand(cmd);\n cmd.parent = this;\n cmd.copyInheritedSettings(this);\n\n if (desc) return this;\n return cmd;\n }\n\n /**\n * Factory routine to create a new unattached command.\n *\n * See .command() for creating an attached subcommand, which uses this routine to\n * create the command. You can override createCommand to customise subcommands.\n *\n * @param {string} [name]\n * @return {Command} new command\n */\n\n createCommand(name) {\n return new Command(name);\n }\n\n /**\n * You can customise the help with a subclass of Help by overriding createHelp,\n * or by overriding Help properties using configureHelp().\n *\n * @return {Help}\n */\n\n createHelp() {\n return Object.assign(new Help(), this.configureHelp());\n }\n\n /**\n * You can customise the help by overriding Help properties using configureHelp(),\n * or with a subclass of Help by overriding createHelp().\n *\n * @param {object} [configuration] - configuration options\n * @return {(Command | object)} `this` command for chaining, or stored configuration\n */\n\n configureHelp(configuration) {\n if (configuration === undefined) return this._helpConfiguration;\n\n this._helpConfiguration = configuration;\n return this;\n }\n\n /**\n * The default output goes to stdout and stderr. You can customise this for special\n * applications. You can also customise the display of errors by overriding outputError.\n *\n * The configuration properties are all functions:\n *\n * // change how output being written, defaults to stdout and stderr\n * writeOut(str)\n * writeErr(str)\n * // change how output being written for errors, defaults to writeErr\n * outputError(str, write) // used for displaying errors and not used for displaying help\n * // specify width for wrapping help\n * getOutHelpWidth()\n * getErrHelpWidth()\n * // color support, currently only used with Help\n * getOutHasColors()\n * getErrHasColors()\n * stripColor() // used to remove ANSI escape codes if output does not have colors\n *\n * @param {object} [configuration] - configuration options\n * @return {(Command | object)} `this` command for chaining, or stored configuration\n */\n\n configureOutput(configuration) {\n if (configuration === undefined) return this._outputConfiguration;\n\n this._outputConfiguration = {\n ...this._outputConfiguration,\n ...configuration,\n };\n return this;\n }\n\n /**\n * Display the help or a custom message after an error occurs.\n *\n * @param {(boolean|string)} [displayHelp]\n * @return {Command} `this` command for chaining\n */\n showHelpAfterError(displayHelp = true) {\n if (typeof displayHelp !== 'string') displayHelp = !!displayHelp;\n this._showHelpAfterError = displayHelp;\n return this;\n }\n\n /**\n * Display suggestion of similar commands for unknown commands, or options for unknown options.\n *\n * @param {boolean} [displaySuggestion]\n * @return {Command} `this` command for chaining\n */\n showSuggestionAfterError(displaySuggestion = true) {\n this._showSuggestionAfterError = !!displaySuggestion;\n return this;\n }\n\n /**\n * Add a prepared subcommand.\n *\n * See .command() for creating an attached subcommand which inherits settings from its parent.\n *\n * @param {Command} cmd - new subcommand\n * @param {object} [opts] - configuration options\n * @return {Command} `this` command for chaining\n */\n\n addCommand(cmd, opts) {\n if (!cmd._name) {\n throw new Error(`Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()`);\n }\n\n opts = opts || {};\n if (opts.isDefault) this._defaultCommandName = cmd._name;\n if (opts.noHelp || opts.hidden) cmd._hidden = true; // modifying passed command due to existing implementation\n\n this._registerCommand(cmd);\n cmd.parent = this;\n cmd._checkForBrokenPassThrough();\n\n return this;\n }\n\n /**\n * Factory routine to create a new unattached argument.\n *\n * See .argument() for creating an attached argument, which uses this routine to\n * create the argument. You can override createArgument to return a custom argument.\n *\n * @param {string} name\n * @param {string} [description]\n * @return {Argument} new argument\n */\n\n createArgument(name, description) {\n return new Argument(name, description);\n }\n\n /**\n * Define argument syntax for command.\n *\n * The default is that the argument is required, and you can explicitly\n * indicate this with <> around the name. Put [] around the name for an optional argument.\n *\n * @example\n * program.argument('<input-file>');\n * program.argument('[output-file]');\n *\n * @param {string} name\n * @param {string} [description]\n * @param {(Function|*)} [parseArg] - custom argument processing function or default value\n * @param {*} [defaultValue]\n * @return {Command} `this` command for chaining\n */\n argument(name, description, parseArg, defaultValue) {\n const argument = this.createArgument(name, description);\n if (typeof parseArg === 'function') {\n argument.default(defaultValue).argParser(parseArg);\n } else {\n argument.default(parseArg);\n }\n this.addArgument(argument);\n return this;\n }\n\n /**\n * Define argument syntax for command, adding multiple at once (without descriptions).\n *\n * See also .argument().\n *\n * @example\n * program.arguments('<cmd> [env]');\n *\n * @param {string} names\n * @return {Command} `this` command for chaining\n */\n\n arguments(names) {\n names\n .trim()\n .split(/ +/)\n .forEach((detail) => {\n this.argument(detail);\n });\n return this;\n }\n\n /**\n * Define argument syntax for command, adding a prepared argument.\n *\n * @param {Argument} argument\n * @return {Command} `this` command for chaining\n */\n addArgument(argument) {\n const previousArgument = this.registeredArguments.slice(-1)[0];\n if (previousArgument?.variadic) {\n throw new Error(\n `only the last argument can be variadic '${previousArgument.name()}'`,\n );\n }\n if (\n argument.required &&\n argument.defaultValue !== undefined &&\n argument.parseArg === undefined\n ) {\n throw new Error(\n `a default value for a required argument is never used: '${argument.name()}'`,\n );\n }\n this.registeredArguments.push(argument);\n return this;\n }\n\n /**\n * Customise or override default help command. By default a help command is automatically added if your command has subcommands.\n *\n * @example\n * program.helpCommand('help [cmd]');\n * program.helpCommand('help [cmd]', 'show help');\n * program.helpCommand(false); // suppress default help command\n * program.helpCommand(true); // add help command even if no subcommands\n *\n * @param {string|boolean} enableOrNameAndArgs - enable with custom name and/or arguments, or boolean to override whether added\n * @param {string} [description] - custom description\n * @return {Command} `this` command for chaining\n */\n\n helpCommand(enableOrNameAndArgs, description) {\n if (typeof enableOrNameAndArgs === 'boolean') {\n this._addImplicitHelpCommand = enableOrNameAndArgs;\n if (enableOrNameAndArgs && this._defaultCommandGroup) {\n // make the command to store the group\n this._initCommandGroup(this._getHelpCommand());\n }\n return this;\n }\n\n const nameAndArgs = enableOrNameAndArgs ?? 'help [command]';\n const [, helpName, helpArgs] = nameAndArgs.match(/([^ ]+) *(.*)/);\n const helpDescription = description ?? 'display help for command';\n\n const helpCommand = this.createCommand(helpName);\n helpCommand.helpOption(false);\n if (helpArgs) helpCommand.arguments(helpArgs);\n if (helpDescription) helpCommand.description(helpDescription);\n\n this._addImplicitHelpCommand = true;\n this._helpCommand = helpCommand;\n // init group unless lazy create\n if (enableOrNameAndArgs || description) this._initCommandGroup(helpCommand);\n\n return this;\n }\n\n /**\n * Add prepared custom help command.\n *\n * @param {(Command|string|boolean)} helpCommand - custom help command, or deprecated enableOrNameAndArgs as for `.helpCommand()`\n * @param {string} [deprecatedDescription] - deprecated custom description used with custom name only\n * @return {Command} `this` command for chaining\n */\n addHelpCommand(helpCommand, deprecatedDescription) {\n // If not passed an object, call through to helpCommand for backwards compatibility,\n // as addHelpCommand was originally used like helpCommand is now.\n if (typeof helpCommand !== 'object') {\n this.helpCommand(helpCommand, deprecatedDescription);\n return this;\n }\n\n this._addImplicitHelpCommand = true;\n this._helpCommand = helpCommand;\n this._initCommandGroup(helpCommand);\n return this;\n }\n\n /**\n * Lazy create help command.\n *\n * @return {(Command|null)}\n * @package\n */\n _getHelpCommand() {\n const hasImplicitHelpCommand =\n this._addImplicitHelpCommand ??\n (this.commands.length &&\n !this._actionHandler &&\n !this._findCommand('help'));\n\n if (hasImplicitHelpCommand) {\n if (this._helpCommand === undefined) {\n this.helpCommand(undefined, undefined); // use default name and description\n }\n return this._helpCommand;\n }\n return null;\n }\n\n /**\n * Add hook for life cycle event.\n *\n * @param {string} event\n * @param {Function} listener\n * @return {Command} `this` command for chaining\n */\n\n hook(event, listener) {\n const allowedValues = ['preSubcommand', 'preAction', 'postAction'];\n if (!allowedValues.includes(event)) {\n throw new Error(`Unexpected value for event passed to hook : '${event}'.\nExpecting one of '${allowedValues.join(\"', '\")}'`);\n }\n if (this._lifeCycleHooks[event]) {\n this._lifeCycleHooks[event].push(listener);\n } else {\n this._lifeCycleHooks[event] = [listener];\n }\n return this;\n }\n\n /**\n * Register callback to use as replacement for calling process.exit.\n *\n * @param {Function} [fn] optional callback which will be passed a CommanderError, defaults to throwing\n * @return {Command} `this` command for chaining\n */\n\n exitOverride(fn) {\n if (fn) {\n this._exitCallback = fn;\n } else {\n this._exitCallback = (err) => {\n if (err.code !== 'commander.executeSubCommandAsync') {\n throw err;\n } else {\n // Async callback from spawn events, not useful to throw.\n }\n };\n }\n return this;\n }\n\n /**\n * Call process.exit, and _exitCallback if defined.\n *\n * @param {number} exitCode exit code for using with process.exit\n * @param {string} code an id string representing the error\n * @param {string} message human-readable description of the error\n * @return never\n * @private\n */\n\n _exit(exitCode, code, message) {\n if (this._exitCallback) {\n this._exitCallback(new CommanderError(exitCode, code, message));\n // Expecting this line is not reached.\n }\n process.exit(exitCode);\n }\n\n /**\n * Register callback `fn` for the command.\n *\n * @example\n * program\n * .command('serve')\n * .description('start service')\n * .action(function() {\n * // do work here\n * });\n *\n * @param {Function} fn\n * @return {Command} `this` command for chaining\n */\n\n action(fn) {\n const listener = (args) => {\n // The .action callback takes an extra parameter which is the command or options.\n const expectedArgsCount = this.registeredArguments.length;\n const actionArgs = args.slice(0, expectedArgsCount);\n if (this._storeOptionsAsProperties) {\n actionArgs[expectedArgsCount] = this; // backwards compatible \"options\"\n } else {\n actionArgs[expectedArgsCount] = this.opts();\n }\n actionArgs.push(this);\n\n return fn.apply(this, actionArgs);\n };\n this._actionHandler = listener;\n return this;\n }\n\n /**\n * Factory routine to create a new unattached option.\n *\n * See .option() for creating an attached option, which uses this routine to\n * create the option. You can override createOption to return a custom option.\n *\n * @param {string} flags\n * @param {string} [description]\n * @return {Option} new option\n */\n\n createOption(flags, description) {\n return new Option(flags, description);\n }\n\n /**\n * Wrap parseArgs to catch 'commander.invalidArgument'.\n *\n * @param {(Option | Argument)} target\n * @param {string} value\n * @param {*} previous\n * @param {string} invalidArgumentMessage\n * @private\n */\n\n _callParseArg(target, value, previous, invalidArgumentMessage) {\n try {\n return target.parseArg(value, previous);\n } catch (err) {\n if (err.code === 'commander.invalidArgument') {\n const message = `${invalidArgumentMessage} ${err.message}`;\n this.error(message, { exitCode: err.exitCode, code: err.code });\n }\n throw err;\n }\n }\n\n /**\n * Check for option flag conflicts.\n * Register option if no conflicts found, or throw on conflict.\n *\n * @param {Option} option\n * @private\n */\n\n _registerOption(option) {\n const matchingOption =\n (option.short && this._findOption(option.short)) ||\n (option.long && this._findOption(option.long));\n if (matchingOption) {\n const matchingFlag =\n option.long && this._findOption(option.long)\n ? option.long\n : option.short;\n throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}'\n- already used by option '${matchingOption.flags}'`);\n }\n\n this._initOptionGroup(option);\n this.options.push(option);\n }\n\n /**\n * Check for command name and alias conflicts with existing commands.\n * Register command if no conflicts found, or throw on conflict.\n *\n * @param {Command} command\n * @private\n */\n\n _registerCommand(command) {\n const knownBy = (cmd) => {\n return [cmd.name()].concat(cmd.aliases());\n };\n\n const alreadyUsed = knownBy(command).find((name) =>\n this._findCommand(name),\n );\n if (alreadyUsed) {\n const existingCmd = knownBy(this._findCommand(alreadyUsed)).join('|');\n const newCmd = knownBy(command).join('|');\n throw new Error(\n `cannot add command '${newCmd}' as already have command '${existingCmd}'`,\n );\n }\n\n this._initCommandGroup(command);\n this.commands.push(command);\n }\n\n /**\n * Add an option.\n *\n * @param {Option} option\n * @return {Command} `this` command for chaining\n */\n addOption(option) {\n this._registerOption(option);\n\n const oname = option.name();\n const name = option.attributeName();\n\n // store default value\n if (option.negate) {\n // --no-foo is special and defaults foo to true, unless a --foo option is already defined\n const positiveLongFlag = option.long.replace(/^--no-/, '--');\n if (!this._findOption(positiveLongFlag)) {\n this.setOptionValueWithSource(\n name,\n option.defaultValue === undefined ? true : option.defaultValue,\n 'default',\n );\n }\n } else if (option.defaultValue !== undefined) {\n this.setOptionValueWithSource(name, option.defaultValue, 'default');\n }\n\n // handler for cli and env supplied values\n const handleOptionValue = (val, invalidValueMessage, valueSource) => {\n // val is null for optional option used without an optional-argument.\n // val is undefined for boolean and negated option.\n if (val == null && option.presetArg !== undefined) {\n val = option.presetArg;\n }\n\n // custom processing\n const oldValue = this.getOptionValue(name);\n if (val !== null && option.parseArg) {\n val = this._callParseArg(option, val, oldValue, invalidValueMessage);\n } else if (val !== null && option.variadic) {\n val = option._collectValue(val, oldValue);\n }\n\n // Fill-in appropriate missing values. Long winded but easy to follow.\n if (val == null) {\n if (option.negate) {\n val = false;\n } else if (option.isBoolean() || option.optional) {\n val = true;\n } else {\n val = ''; // not normal, parseArg might have failed or be a mock function for testing\n }\n }\n this.setOptionValueWithSource(name, val, valueSource);\n };\n\n this.on('option:' + oname, (val) => {\n const invalidValueMessage = `error: option '${option.flags}' argument '${val}' is invalid.`;\n handleOptionValue(val, invalidValueMessage, 'cli');\n });\n\n if (option.envVar) {\n this.on('optionEnv:' + oname, (val) => {\n const invalidValueMessage = `error: option '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`;\n handleOptionValue(val, invalidValueMessage, 'env');\n });\n }\n\n return this;\n }\n\n /**\n * Internal implementation shared by .option() and .requiredOption()\n *\n * @return {Command} `this` command for chaining\n * @private\n */\n _optionEx(config, flags, description, fn, defaultValue) {\n if (typeof flags === 'object' && flags instanceof Option) {\n throw new Error(\n 'To add an Option object use addOption() instead of option() or requiredOption()',\n );\n }\n const option = this.createOption(flags, description);\n option.makeOptionMandatory(!!config.mandatory);\n if (typeof fn === 'function') {\n option.default(defaultValue).argParser(fn);\n } else if (fn instanceof RegExp) {\n // deprecated\n const regex = fn;\n fn = (val, def) => {\n const m = regex.exec(val);\n return m ? m[0] : def;\n };\n option.default(defaultValue).argParser(fn);\n } else {\n option.default(fn);\n }\n\n return this.addOption(option);\n }\n\n /**\n * Define option with `flags`, `description`, and optional argument parsing function or `defaultValue` or both.\n *\n * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space. A required\n * option-argument is indicated by `<>` and an optional option-argument by `[]`.\n *\n * See the README for more details, and see also addOption() and requiredOption().\n *\n * @example\n * program\n * .option('-p, --pepper', 'add pepper')\n * .option('--pt, --pizza-type <TYPE>', 'type of pizza') // required option-argument\n * .option('-c, --cheese [CHEESE]', 'add extra cheese', 'mozzarella') // optional option-argument with default\n * .option('-t, --tip <VALUE>', 'add tip to purchase cost', parseFloat) // custom parse function\n *\n * @param {string} flags\n * @param {string} [description]\n * @param {(Function|*)} [parseArg] - custom option processing function or default value\n * @param {*} [defaultValue]\n * @return {Command} `this` command for chaining\n */\n\n option(flags, description, parseArg, defaultValue) {\n return this._optionEx({}, flags, description, parseArg, defaultValue);\n }\n\n /**\n * Add a required option which must have a value after parsing. This usually means\n * the option must be specified on the command line. (Otherwise the same as .option().)\n *\n * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space.\n *\n * @param {string} flags\n * @param {string} [description]\n * @param {(Function|*)} [parseArg] - custom option processing function or default value\n * @param {*} [defaultValue]\n * @return {Command} `this` command for chaining\n */\n\n requiredOption(flags, description, parseArg, defaultValue) {\n return this._optionEx(\n { mandatory: true },\n flags,\n description,\n parseArg,\n defaultValue,\n );\n }\n\n /**\n * Alter parsing of short flags with optional values.\n *\n * @example\n * // for `.option('-f,--flag [value]'):\n * program.combineFlagAndOptionalValue(true); // `-f80` is treated like `--flag=80`, this is the default behaviour\n * program.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b`\n *\n * @param {boolean} [combine] - if `true` or omitted, an optional value can be specified directly after the flag.\n * @return {Command} `this` command for chaining\n */\n combineFlagAndOptionalValue(combine = true) {\n this._combineFlagAndOptionalValue = !!combine;\n return this;\n }\n\n /**\n * Allow unknown options on the command line.\n *\n * @param {boolean} [allowUnknown] - if `true` or omitted, no error will be thrown for unknown options.\n * @return {Command} `this` command for chaining\n */\n allowUnknownOption(allowUnknown = true) {\n this._allowUnknownOption = !!allowUnknown;\n return this;\n }\n\n /**\n * Allow excess command-arguments on the command line. Pass false to make excess arguments an error.\n *\n * @param {boolean} [allowExcess] - if `true` or omitted, no error will be thrown for excess arguments.\n * @return {Command} `this` command for chaining\n */\n allowExcessArguments(allowExcess = true) {\n this._allowExcessArguments = !!allowExcess;\n return this;\n }\n\n /**\n * Enable positional options. Positional means global options are specified before subcommands which lets\n * subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions.\n * The default behaviour is non-positional and global options may appear anywhere on the command line.\n *\n * @param {boolean} [positional]\n * @return {Command} `this` command for chaining\n */\n enablePositionalOptions(positional = true) {\n this._enablePositionalOptions = !!positional;\n return this;\n }\n\n /**\n * Pass through options that come after command-arguments rather than treat them as command-options,\n * so actual command-options come before command-arguments. Turning this on for a subcommand requires\n * positional options to have been enabled on the program (parent commands).\n * The default behaviour is non-positional and options may appear before or after command-arguments.\n *\n * @param {boolean} [passThrough] for unknown options.\n * @return {Command} `this` command for chaining\n */\n passThroughOptions(passThrough = true) {\n this._passThroughOptions = !!passThrough;\n this._checkForBrokenPassThrough();\n return this;\n }\n\n /**\n * @private\n */\n\n _checkForBrokenPassThrough() {\n if (\n this.parent &&\n this._passThroughOptions &&\n !this.parent._enablePositionalOptions\n ) {\n throw new Error(\n `passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`,\n );\n }\n }\n\n /**\n * Whether to store option values as properties on command object,\n * or store separately (specify false). In both cases the option values can be accessed using .opts().\n *\n * @param {boolean} [storeAsProperties=true]\n * @return {Command} `this` command for chaining\n */\n\n storeOptionsAsProperties(storeAsProperties = true) {\n if (this.options.length) {\n throw new Error('call .storeOptionsAsProperties() before adding options');\n }\n if (Object.keys(this._optionValues).length) {\n throw new Error(\n 'call .storeOptionsAsProperties() before setting option values',\n );\n }\n this._storeOptionsAsProperties = !!storeAsProperties;\n return this;\n }\n\n /**\n * Retrieve option value.\n *\n * @param {string} key\n * @return {object} value\n */\n\n getOptionValue(key) {\n if (this._storeOptionsAsProperties) {\n return this[key];\n }\n return this._optionValues[key];\n }\n\n /**\n * Store option value.\n *\n * @param {string} key\n * @param {object} value\n * @return {Command} `this` command for chaining\n */\n\n setOptionValue(key, value) {\n return this.setOptionValueWithSource(key, value, undefined);\n }\n\n /**\n * Store option value and where the value came from.\n *\n * @param {string} key\n * @param {object} value\n * @param {string} source - expected values are default/config/env/cli/implied\n * @return {Command} `this` command for chaining\n */\n\n setOptionValueWithSource(key, value, source) {\n if (this._storeOptionsAsProperties) {\n this[key] = value;\n } else {\n this._optionValues[key] = value;\n }\n this._optionValueSources[key] = source;\n return this;\n }\n\n /**\n * Get source of option value.\n * Expected values are default | config | env | cli | implied\n *\n * @param {string} key\n * @return {string}\n */\n\n getOptionValueSource(key) {\n return this._optionValueSources[key];\n }\n\n /**\n * Get source of option value. See also .optsWithGlobals().\n * Expected values are default | config | env | cli | implied\n *\n * @param {string} key\n * @return {string}\n */\n\n getOptionValueSourceWithGlobals(key) {\n // global overwrites local, like optsWithGlobals\n let source;\n this._getCommandAndAncestors().forEach((cmd) => {\n if (cmd.getOptionValueSource(key) !== undefined) {\n source = cmd.getOptionValueSource(key);\n }\n });\n return source;\n }\n\n /**\n * Get user arguments from implied or explicit arguments.\n * Side-effects: set _scriptPath if args included script. Used for default program name, and subcommand searches.\n *\n * @private\n */\n\n _prepareUserArgs(argv, parseOptions) {\n if (argv !== undefined && !Array.isArray(argv)) {\n throw new Error('first parameter to parse must be array or undefined');\n }\n parseOptions = parseOptions || {};\n\n // auto-detect argument conventions if nothing supplied\n if (argv === undefined && parseOptions.from === undefined) {\n if (process.versions?.electron) {\n parseOptions.from = 'electron';\n }\n // check node specific options for scenarios where user CLI args follow executable without scriptname\n const execArgv = process.execArgv ?? [];\n if (\n execArgv.includes('-e') ||\n execArgv.includes('--eval') ||\n execArgv.includes('-p') ||\n execArgv.includes('--print')\n ) {\n parseOptions.from = 'eval'; // internal usage, not documented\n }\n }\n\n // default to using process.argv\n if (argv === undefined) {\n argv = process.argv;\n }\n this.rawArgs = argv.slice();\n\n // extract the user args and scriptPath\n let userArgs;\n switch (parseOptions.from) {\n case undefined:\n case 'node':\n this._scriptPath = argv[1];\n userArgs = argv.slice(2);\n break;\n case 'electron':\n // @ts-ignore: because defaultApp is an unknown property\n if (process.defaultApp) {\n this._scriptPath = argv[1];\n userArgs = argv.slice(2);\n } else {\n userArgs = argv.slice(1);\n }\n break;\n case 'user':\n userArgs = argv.slice(0);\n break;\n case 'eval':\n userArgs = argv.slice(1);\n break;\n default:\n throw new Error(\n `unexpected parse option { from: '${parseOptions.from}' }`,\n );\n }\n\n // Find default name for program from arguments.\n if (!this._name && this._scriptPath)\n this.nameFromFilename(this._scriptPath);\n this._name = this._name || 'program';\n\n return userArgs;\n }\n\n /**\n * Parse `argv`, setting options and invoking commands when defined.\n *\n * Use parseAsync instead of parse if any of your action handlers are async.\n *\n * Call with no parameters to parse `process.argv`. Detects Electron and special node options like `node --eval`. Easy mode!\n *\n * Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are `from`:\n * - `'node'`: default, `argv[0]` is the application and `argv[1]` is the script being run, with user arguments after that\n * - `'electron'`: `argv[0]` is the application and `argv[1]` varies depending on whether the electron application is packaged\n * - `'user'`: just user arguments\n *\n * @example\n * program.parse(); // parse process.argv and auto-detect electron and special node flags\n * program.parse(process.argv); // assume argv[0] is app and argv[1] is script\n * program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]\n *\n * @param {string[]} [argv] - optional, defaults to process.argv\n * @param {object} [parseOptions] - optionally specify style of options with from: node/user/electron\n * @param {string} [parseOptions.from] - where the args are from: 'node', 'user', 'electron'\n * @return {Command} `this` command for chaining\n */\n\n parse(argv, parseOptions) {\n this._prepareForParse();\n const userArgs = this._prepareUserArgs(argv, parseOptions);\n this._parseCommand([], userArgs);\n\n return this;\n }\n\n /**\n * Parse `argv`, setting options and invoking commands when defined.\n *\n * Call with no parameters to parse `process.argv`. Detects Electron and special node options like `node --eval`. Easy mode!\n *\n * Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are `from`:\n * - `'node'`: default, `argv[0]` is the application and `argv[1]` is the script being run, with user arguments after that\n * - `'electron'`: `argv[0]` is the application and `argv[1]` varies depending on whether the electron application is packaged\n * - `'user'`: just user arguments\n *\n * @example\n * await program.parseAsync(); // parse process.argv and auto-detect electron and special node flags\n * await program.parseAsync(process.argv); // assume argv[0] is app and argv[1] is script\n * await program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]\n *\n * @param {string[]} [argv]\n * @param {object} [parseOptions]\n * @param {string} parseOptions.from - where the args are from: 'node', 'user', 'electron'\n * @return {Promise}\n */\n\n async parseAsync(argv, parseOptions) {\n this._prepareForParse();\n const userArgs = this._prepareUserArgs(argv, parseOptions);\n await this._parseCommand([], userArgs);\n\n return this;\n }\n\n _prepareForParse() {\n if (this._savedState === null) {\n this.saveStateBeforeParse();\n } else {\n this.restoreStateBeforeParse();\n }\n }\n\n /**\n * Called the first time parse is called to save state and allow a restore before subsequent calls to parse.\n * Not usually called directly, but available for subclasses to save their custom state.\n *\n * This is called in a lazy way. Only commands used in parsing chain will have state saved.\n */\n saveStateBeforeParse() {\n this._savedState = {\n // name is stable if supplied by author, but may be unspecified for root command and deduced during parsing\n _name: this._name,\n // option values before parse have default values (including false for negated options)\n // shallow clones\n _optionValues: { ...this._optionValues },\n _optionValueSources: { ...this._optionValueSources },\n };\n }\n\n /**\n * Restore state before parse for calls after the first.\n * Not usually called directly, but available for subclasses to save their custom state.\n *\n * This is called in a lazy way. Only commands used in parsing chain will have state restored.\n */\n restoreStateBeforeParse() {\n if (this._storeOptionsAsProperties)\n throw new Error(`Can not call parse again when storeOptionsAsProperties is true.\n- either make a new Command for each call to parse, or stop storing options as properties`);\n\n // clear state from _prepareUserArgs\n this._name = this._savedState._name;\n this._scriptPath = null;\n this.rawArgs = [];\n // clear state from setOptionValueWithSource\n this._optionValues = { ...this._savedState._optionValues };\n this._optionValueSources = { ...this._savedState._optionValueSources };\n // clear state from _parseCommand\n this.args = [];\n // clear state from _processArguments\n this.processedArgs = [];\n }\n\n /**\n * Throw if expected executable is missing. Add lots of help for author.\n *\n * @param {string} executableFile\n * @param {string} executableDir\n * @param {string} subcommandName\n */\n _checkForMissingExecutable(executableFile, executableDir, subcommandName) {\n if (fs.existsSync(executableFile)) return;\n\n const executableDirMessage = executableDir\n ? `searched for local subcommand relative to directory '${executableDir}'`\n : 'no directory for search for local subcommand, use .executableDir() to supply a custom directory';\n const executableMissing = `'${executableFile}' does not exist\n - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${executableDirMessage}`;\n throw new Error(executableMissing);\n }\n\n /**\n * Execute a sub-command executable.\n *\n * @private\n */\n\n _executeSubCommand(subcommand, args) {\n args = args.slice();\n let launchWithNode = false; // Use node for source targets so do not need to get permissions correct, and on Windows.\n const sourceExt = ['.js', '.ts', '.tsx', '.mjs', '.cjs'];\n\n function findFile(baseDir, baseName) {\n // Look for specified file\n const localBin = path.resolve(baseDir, baseName);\n if (fs.existsSync(localBin)) return localBin;\n\n // Stop looking if candidate already has an expected extension.\n if (sourceExt.includes(path.extname(baseName))) return undefined;\n\n // Try all the extensions.\n const foundExt = sourceExt.find((ext) =>\n fs.existsSync(`${localBin}${ext}`),\n );\n if (foundExt) return `${localBin}${foundExt}`;\n\n return undefined;\n }\n\n // Not checking for help first. Unlikely to have mandatory and executable, and can't robustly test for help flags in external command.\n this._checkForMissingMandatoryOptions();\n this._checkForConflictingOptions();\n\n // executableFile and executableDir might be full path, or just a name\n let executableFile =\n subcommand._executableFile || `${this._name}-${subcommand._name}`;\n let executableDir = this._executableDir || '';\n if (this._scriptPath) {\n let resolvedScriptPath; // resolve possible symlink for installed npm binary\n try {\n resolvedScriptPath = fs.realpathSync(this._scriptPath);\n } catch {\n resolvedScriptPath = this._scriptPath;\n }\n executableDir = path.resolve(\n path.dirname(resolvedScriptPath),\n executableDir,\n );\n }\n\n // Look for a local file in preference to a command in PATH.\n if (executableDir) {\n let localFile = findFile(executableDir, executableFile);\n\n // Legacy search using prefix of script name instead of command name\n if (!localFile && !subcommand._executableFile && this._scriptPath) {\n const legacyName = path.basename(\n this._scriptPath,\n path.extname(this._scriptPath),\n );\n if (legacyName !== this._name) {\n localFile = findFile(\n executableDir,\n `${legacyName}-${subcommand._name}`,\n );\n }\n }\n executableFile = localFile || executableFile;\n }\n\n launchWithNode = sourceExt.includes(path.extname(executableFile));\n\n let proc;\n if (process.platform !== 'win32') {\n if (launchWithNode) {\n args.unshift(executableFile);\n // add executable arguments to spawn\n args = incrementNodeInspectorPort(process.execArgv).concat(args);\n\n proc = childProcess.spawn(process.argv[0], args, { stdio: 'inherit' });\n } else {\n proc = childProcess.spawn(executableFile, args, { stdio: 'inherit' });\n }\n } else {\n this._checkForMissingExecutable(\n executableFile,\n executableDir,\n subcommand._name,\n );\n args.unshift(executableFile);\n // add executable arguments to spawn\n args = incrementNodeInspectorPort(process.execArgv).concat(args);\n proc = childProcess.spawn(process.execPath, args, { stdio: 'inherit' });\n }\n\n if (!proc.killed) {\n // testing mainly to avoid leak warnings during unit tests with mocked spawn\n const signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP'];\n signals.forEach((signal) => {\n process.on(signal, () => {\n if (proc.killed === false && proc.exitCode === null) {\n // @ts-ignore because signals not typed to known strings\n proc.kill(signal);\n }\n });\n });\n }\n\n // By default terminate process when spawned process terminates.\n const exitCallback = this._exitCallback;\n proc.on('close', (code) => {\n code = code ?? 1; // code is null if spawned process terminated due to a signal\n if (!exitCallback) {\n process.exit(code);\n } else {\n exitCallback(\n new CommanderError(\n code,\n 'commander.executeSubCommandAsync',\n '(close)',\n ),\n );\n }\n });\n proc.on('error', (err) => {\n // @ts-ignore: because err.code is an unknown property\n if (err.code === 'ENOENT') {\n this._checkForMissingExecutable(\n executableFile,\n executableDir,\n subcommand._name,\n );\n // @ts-ignore: because err.code is an unknown property\n } else if (err.code === 'EACCES') {\n throw new Error(`'${executableFile}' not executable`);\n }\n if (!exitCallback) {\n process.exit(1);\n } else {\n const wrappedError = new CommanderError(\n 1,\n 'commander.executeSubCommandAsync',\n '(error)',\n );\n wrappedError.nestedError = err;\n exitCallback(wrappedError);\n }\n });\n\n // Store the reference to the child process\n this.runningCommand = proc;\n }\n\n /**\n * @private\n */\n\n _dispatchSubcommand(commandName, operands, unknown) {\n const subCommand = this._findCommand(commandName);\n if (!subCommand) this.help({ error: true });\n\n subCommand._prepareForParse();\n let promiseChain;\n promiseChain = this._chainOrCallSubCommandHook(\n promiseChain,\n subCommand,\n 'preSubcommand',\n );\n promiseChain = this._chainOrCall(promiseChain, () => {\n if (subCommand._executableHandler) {\n this._executeSubCommand(subCommand, operands.concat(unknown));\n } else {\n return subCommand._parseCommand(operands, unknown);\n }\n });\n return promiseChain;\n }\n\n /**\n * Invoke help directly if possible, or dispatch if necessary.\n * e.g. help foo\n *\n * @private\n */\n\n _dispatchHelpCommand(subcommandName) {\n if (!subcommandName) {\n this.help();\n }\n const subCommand = this._findCommand(subcommandName);\n if (subCommand && !subCommand._executableHandler) {\n subCommand.help();\n }\n\n // Fallback to parsing the help flag to invoke the help.\n return this._dispatchSubcommand(\n subcommandName,\n [],\n [this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? '--help'],\n );\n }\n\n /**\n * Check this.args against expected this.registeredArguments.\n *\n * @private\n */\n\n _checkNumberOfArguments() {\n // too few\n this.registeredArguments.forEach((arg, i) => {\n if (arg.required && this.args[i] == null) {\n this.missingArgument(arg.name());\n }\n });\n // too many\n if (\n this.registeredArguments.length > 0 &&\n this.registeredArguments[this.registeredArguments.length - 1].variadic\n ) {\n return;\n }\n if (this.args.length > this.registeredArguments.length) {\n this._excessArguments(this.args);\n }\n }\n\n /**\n * Process this.args using this.registeredArguments and save as this.processedArgs!\n *\n * @private\n */\n\n _processArguments() {\n const myParseArg = (argument, value, previous) => {\n // Extra processing for nice error message on parsing failure.\n let parsedValue = value;\n if (value !== null && argument.parseArg) {\n const invalidValueMessage = `error: command-argument value '${value}' is invalid for argument '${argument.name()}'.`;\n parsedValue = this._callParseArg(\n argument,\n value,\n previous,\n invalidValueMessage,\n );\n }\n return parsedValue;\n };\n\n this._checkNumberOfArguments();\n\n const processedArgs = [];\n this.registeredArguments.forEach((declaredArg, index) => {\n let value = declaredArg.defaultValue;\n if (declaredArg.variadic) {\n // Collect together remaining arguments for passing together as an array.\n if (index < this.args.length) {\n value = this.args.slice(index);\n if (declaredArg.parseArg) {\n value = value.reduce((processed, v) => {\n return myParseArg(declaredArg, v, processed);\n }, declaredArg.defaultValue);\n }\n } else if (value === undefined) {\n value = [];\n }\n } else if (index < this.args.length) {\n value = this.args[index];\n if (declaredArg.parseArg) {\n value = myParseArg(declaredArg, value, declaredArg.defaultValue);\n }\n }\n processedArgs[index] = value;\n });\n this.processedArgs = processedArgs;\n }\n\n /**\n * Once we have a promise we chain, but call synchronously until then.\n *\n * @param {(Promise|undefined)} promise\n * @param {Function} fn\n * @return {(Promise|undefined)}\n * @private\n */\n\n _chainOrCall(promise, fn) {\n // thenable\n if (promise?.then && typeof promise.then === 'function') {\n // already have a promise, chain callback\n return promise.then(() => fn());\n }\n // callback might return a promise\n return fn();\n }\n\n /**\n *\n * @param {(Promise|undefined)} promise\n * @param {string} event\n * @return {(Promise|undefined)}\n * @private\n */\n\n _chainOrCallHooks(promise, event) {\n let result = promise;\n const hooks = [];\n this._getCommandAndAncestors()\n .reverse()\n .filter((cmd) => cmd._lifeCycleHooks[event] !== undefined)\n .forEach((hookedCommand) => {\n hookedCommand._lifeCycleHooks[event].forEach((callback) => {\n hooks.push({ hookedCommand, callback });\n });\n });\n if (event === 'postAction') {\n hooks.reverse();\n }\n\n hooks.forEach((hookDetail) => {\n result = this._chainOrCall(result, () => {\n return hookDetail.callback(hookDetail.hookedCommand, this);\n });\n });\n return result;\n }\n\n /**\n *\n * @param {(Promise|undefined)} promise\n * @param {Command} subCommand\n * @param {string} event\n * @return {(Promise|undefined)}\n * @private\n */\n\n _chainOrCallSubCommandHook(promise, subCommand, event) {\n let result = promise;\n if (this._lifeCycleHooks[event] !== undefined) {\n this._lifeCycleHooks[event].forEach((hook) => {\n result = this._chainOrCall(result, () => {\n return hook(this, subCommand);\n });\n });\n }\n return result;\n }\n\n /**\n * Process arguments in context of this command.\n * Returns action result, in case it is a promise.\n *\n * @private\n */\n\n _parseCommand(operands, unknown) {\n const parsed = this.parseOptions(unknown);\n this._parseOptionsEnv(); // after cli, so parseArg not called on both cli and env\n this._parseOptionsImplied();\n operands = operands.concat(parsed.operands);\n unknown = parsed.unknown;\n this.args = operands.concat(unknown);\n\n if (operands && this._findCommand(operands[0])) {\n return this._dispatchSubcommand(operands[0], operands.slice(1), unknown);\n }\n if (\n this._getHelpCommand() &&\n operands[0] === this._getHelpCommand().name()\n ) {\n return this._dispatchHelpCommand(operands[1]);\n }\n if (this._defaultCommandName) {\n this._outputHelpIfRequested(unknown); // Run the help for default command from parent rather than passing to default command\n return this._dispatchSubcommand(\n this._defaultCommandName,\n operands,\n unknown,\n );\n }\n if (\n this.commands.length &&\n this.args.length === 0 &&\n !this._actionHandler &&\n !this._defaultCommandName\n ) {\n // probably missing subcommand and no handler, user needs help (and exit)\n this.help({ error: true });\n }\n\n this._outputHelpIfRequested(parsed.unknown);\n this._checkForMissingMandatoryOptions();\n this._checkForConflictingOptions();\n\n // We do not always call this check to avoid masking a \"better\" error, like unknown command.\n const checkForUnknownOptions = () => {\n if (parsed.unknown.length > 0) {\n this.unknownOption(parsed.unknown[0]);\n }\n };\n\n const commandEvent = `command:${this.name()}`;\n if (this._actionHandler) {\n checkForUnknownOptions();\n this._processArguments();\n\n let promiseChain;\n promiseChain = this._chainOrCallHooks(promiseChain, 'preAction');\n promiseChain = this._chainOrCall(promiseChain, () =>\n this._actionHandler(this.processedArgs),\n );\n if (this.parent) {\n promiseChain = this._chainOrCall(promiseChain, () => {\n this.parent.emit(commandEvent, operands, unknown); // legacy\n });\n }\n promiseChain = this._chainOrCallHooks(promiseChain, 'postAction');\n return promiseChain;\n }\n if (this.parent?.listenerCount(commandEvent)) {\n checkForUnknownOptions();\n this._processArguments();\n this.parent.emit(commandEvent, operands, unknown); // legacy\n } else if (operands.length) {\n if (this._findCommand('*')) {\n // legacy default command\n return this._dispatchSubcommand('*', operands, unknown);\n }\n if (this.listenerCount('command:*')) {\n // skip option check, emit event for possible misspelling suggestion\n this.emit('command:*', operands, unknown);\n } else if (this.commands.length) {\n this.unknownCommand();\n } else {\n checkForUnknownOptions();\n this._processArguments();\n }\n } else if (this.commands.length) {\n checkForUnknownOptions();\n // This command has subcommands and nothing hooked up at this level, so display help (and exit).\n this.help({ error: true });\n } else {\n checkForUnknownOptions();\n this._processArguments();\n // fall through for caller to handle after calling .parse()\n }\n }\n\n /**\n * Find matching command.\n *\n * @private\n * @return {Command | undefined}\n */\n _findCommand(name) {\n if (!name) return undefined;\n return this.commands.find(\n (cmd) => cmd._name === name || cmd._aliases.includes(name),\n );\n }\n\n /**\n * Return an option matching `arg` if any.\n *\n * @param {string} arg\n * @return {Option}\n * @package\n */\n\n _findOption(arg) {\n return this.options.find((option) => option.is(arg));\n }\n\n /**\n * Display an error message if a mandatory option does not have a value.\n * Called after checking for help flags in leaf subcommand.\n *\n * @private\n */\n\n _checkForMissingMandatoryOptions() {\n // Walk up hierarchy so can call in subcommand after checking for displaying help.\n this._getCommandAndAncestors().forEach((cmd) => {\n cmd.options.forEach((anOption) => {\n if (\n anOption.mandatory &&\n cmd.getOptionValue(anOption.attributeName()) === undefined\n ) {\n cmd.missingMandatoryOptionValue(anOption);\n }\n });\n });\n }\n\n /**\n * Display an error message if conflicting options are used together in this.\n *\n * @private\n */\n _checkForConflictingLocalOptions() {\n const definedNonDefaultOptions = this.options.filter((option) => {\n const optionKey = option.attributeName();\n if (this.getOptionValue(optionKey) === undefined) {\n return false;\n }\n return this.getOptionValueSource(optionKey) !== 'default';\n });\n\n const optionsWithConflicting = definedNonDefaultOptions.filter(\n (option) => option.conflictsWith.length > 0,\n );\n\n optionsWithConflicting.forEach((option) => {\n const conflictingAndDefined = definedNonDefaultOptions.find((defined) =>\n option.conflictsWith.includes(defined.attributeName()),\n );\n if (conflictingAndDefined) {\n this._conflictingOption(option, conflictingAndDefined);\n }\n });\n }\n\n /**\n * Display an error message if conflicting options are used together.\n * Called after checking for help flags in leaf subcommand.\n *\n * @private\n */\n _checkForConflictingOptions() {\n // Walk up hierarchy so can call in subcommand after checking for displaying help.\n this._getCommandAndAncestors().forEach((cmd) => {\n cmd._checkForConflictingLocalOptions();\n });\n }\n\n /**\n * Parse options from `argv` removing known options,\n * and return argv split into operands and unknown arguments.\n *\n * Side effects: modifies command by storing options. Does not reset state if called again.\n *\n * Examples:\n *\n * argv => operands, unknown\n * --known kkk op => [op], []\n * op --known kkk => [op], []\n * sub --unknown uuu op => [sub], [--unknown uuu op]\n * sub -- --unknown uuu op => [sub --unknown uuu op], []\n *\n * @param {string[]} args\n * @return {{operands: string[], unknown: string[]}}\n */\n\n parseOptions(args) {\n const operands = []; // operands, not options or values\n const unknown = []; // first unknown option and remaining unknown args\n let dest = operands;\n\n function maybeOption(arg) {\n return arg.length > 1 && arg[0] === '-';\n }\n\n const negativeNumberArg = (arg) => {\n // return false if not a negative number\n if (!/^-(\\d+|\\d*\\.\\d+)(e[+-]?\\d+)?$/.test(arg)) return false;\n // negative number is ok unless digit used as an option in command hierarchy\n return !this._getCommandAndAncestors().some((cmd) =>\n cmd.options\n .map((opt) => opt.short)\n .some((short) => /^-\\d$/.test(short)),\n );\n };\n\n // parse options\n let activeVariadicOption = null;\n let activeGroup = null; // working through group of short options, like -abc\n let i = 0;\n while (i < args.length || activeGroup) {\n const arg = activeGroup ?? args[i++];\n activeGroup = null;\n\n // literal\n if (arg === '--') {\n if (dest === unknown) dest.push(arg);\n dest.push(...args.slice(i));\n break;\n }\n\n if (\n activeVariadicOption &&\n (!maybeOption(arg) || negativeNumberArg(arg))\n ) {\n this.emit(`option:${activeVariadicOption.name()}`, arg);\n continue;\n }\n activeVariadicOption = null;\n\n if (maybeOption(arg)) {\n const option = this._findOption(arg);\n // recognised option, call listener to assign value with possible custom processing\n if (option) {\n if (option.required) {\n const value = args[i++];\n if (value === undefined) this.optionMissingArgument(option);\n this.emit(`option:${option.name()}`, value);\n } else if (option.optional) {\n let value = null;\n // historical behaviour is optional value is following arg unless an option\n if (\n i < args.length &&\n (!maybeOption(args[i]) || negativeNumberArg(args[i]))\n ) {\n value = args[i++];\n }\n this.emit(`option:${option.name()}`, value);\n } else {\n // boolean flag\n this.emit(`option:${option.name()}`);\n }\n activeVariadicOption = option.variadic ? option : null;\n continue;\n }\n }\n\n // Look for combo options following single dash, eat first one if known.\n if (arg.length > 2 && arg[0] === '-' && arg[1] !== '-') {\n const option = this._findOption(`-${arg[1]}`);\n if (option) {\n if (\n option.required ||\n (option.optional && this._combineFlagAndOptionalValue)\n ) {\n // option with value following in same argument\n this.emit(`option:${option.name()}`, arg.slice(2));\n } else {\n // boolean option\n this.emit(`option:${option.name()}`);\n // remove the processed option and keep processing group\n activeGroup = `-${arg.slice(2)}`;\n }\n continue;\n }\n }\n\n // Look for known long flag with value, like --foo=bar\n if (/^--[^=]+=/.test(arg)) {\n const index = arg.indexOf('=');\n const option = this._findOption(arg.slice(0, index));\n if (option && (option.required || option.optional)) {\n this.emit(`option:${option.name()}`, arg.slice(index + 1));\n continue;\n }\n }\n\n // Not a recognised option by this command.\n // Might be a command-argument, or subcommand option, or unknown option, or help command or option.\n\n // An unknown option means further arguments also classified as unknown so can be reprocessed by subcommands.\n // A negative number in a leaf command is not an unknown option.\n if (\n dest === operands &&\n maybeOption(arg) &&\n !(this.commands.length === 0 && negativeNumberArg(arg))\n ) {\n dest = unknown;\n }\n\n // If using positionalOptions, stop processing our options at subcommand.\n if (\n (this._enablePositionalOptions || this._passThroughOptions) &&\n operands.length === 0 &&\n unknown.length === 0\n ) {\n if (this._findCommand(arg)) {\n operands.push(arg);\n unknown.push(...args.slice(i));\n break;\n } else if (\n this._getHelpCommand() &&\n arg === this._getHelpCommand().name()\n ) {\n operands.push(arg, ...args.slice(i));\n break;\n } else if (this._defaultCommandName) {\n unknown.push(arg, ...args.slice(i));\n break;\n }\n }\n\n // If using passThroughOptions, stop processing options at first command-argument.\n if (this._passThroughOptions) {\n dest.push(arg, ...args.slice(i));\n break;\n }\n\n // add arg\n dest.push(arg);\n }\n\n return { operands, unknown };\n }\n\n /**\n * Return an object containing local option values as key-value pairs.\n *\n * @return {object}\n */\n opts() {\n if (this._storeOptionsAsProperties) {\n // Preserve original behaviour so backwards compatible when still using properties\n const result = {};\n const len = this.options.length;\n\n for (let i = 0; i < len; i++) {\n const key = this.options[i].attributeName();\n result[key] =\n key === this._versionOptionName ? this._version : this[key];\n }\n return result;\n }\n\n return this._optionValues;\n }\n\n /**\n * Return an object containing merged local and global option values as key-value pairs.\n *\n * @return {object}\n */\n optsWithGlobals() {\n // globals overwrite locals\n return this._getCommandAndAncestors().reduce(\n (combinedOptions, cmd) => Object.assign(combinedOptions, cmd.opts()),\n {},\n );\n }\n\n /**\n * Display error message and exit (or call exitOverride).\n *\n * @param {string} message\n * @param {object} [errorOptions]\n * @param {string} [errorOptions.code] - an id string representing the error\n * @param {number} [errorOptions.exitCode] - used with process.exit\n */\n error(message, errorOptions) {\n // output handling\n this._outputConfiguration.outputError(\n `${message}\\n`,\n this._outputConfiguration.writeErr,\n );\n if (typeof this._showHelpAfterError === 'string') {\n this._outputConfiguration.writeErr(`${this._showHelpAfterError}\\n`);\n } else if (this._showHelpAfterError) {\n this._outputConfiguration.writeErr('\\n');\n this.outputHelp({ error: true });\n }\n\n // exit handling\n const config = errorOptions || {};\n const exitCode = config.exitCode || 1;\n const code = config.code || 'commander.error';\n this._exit(exitCode, code, message);\n }\n\n /**\n * Apply any option related environment variables, if option does\n * not have a value from cli or client code.\n *\n * @private\n */\n _parseOptionsEnv() {\n this.options.forEach((option) => {\n if (option.envVar && option.envVar in process.env) {\n const optionKey = option.attributeName();\n // Priority check. Do not overwrite cli or options from unknown source (client-code).\n if (\n this.getOptionValue(optionKey) === undefined ||\n ['default', 'config', 'env'].includes(\n this.getOptionValueSource(optionKey),\n )\n ) {\n if (option.required || option.optional) {\n // option can take a value\n // keep very simple, optional always takes value\n this.emit(`optionEnv:${option.name()}`, process.env[option.envVar]);\n } else {\n // boolean\n // keep very simple, only care that envVar defined and not the value\n this.emit(`optionEnv:${option.name()}`);\n }\n }\n }\n });\n }\n\n /**\n * Apply any implied option values, if option is undefined or default value.\n *\n * @private\n */\n _parseOptionsImplied() {\n const dualHelper = new DualOptions(this.options);\n const hasCustomOptionValue = (optionKey) => {\n return (\n this.getOptionValue(optionKey) !== undefined &&\n !['default', 'implied'].includes(this.getOptionValueSource(optionKey))\n );\n };\n this.options\n .filter(\n (option) =>\n option.implied !== undefined &&\n hasCustomOptionValue(option.attributeName()) &&\n dualHelper.valueFromOption(\n this.getOptionValue(option.attributeName()),\n option,\n ),\n )\n .forEach((option) => {\n Object.keys(option.implied)\n .filter((impliedKey) => !hasCustomOptionValue(impliedKey))\n .forEach((impliedKey) => {\n this.setOptionValueWithSource(\n impliedKey,\n option.implied[impliedKey],\n 'implied',\n );\n });\n });\n }\n\n /**\n * Argument `name` is missing.\n *\n * @param {string} name\n * @private\n */\n\n missingArgument(name) {\n const message = `error: missing required argument '${name}'`;\n this.error(message, { code: 'commander.missingArgument' });\n }\n\n /**\n * `Option` is missing an argument.\n *\n * @param {Option} option\n * @private\n */\n\n optionMissingArgument(option) {\n const message = `error: option '${option.flags}' argument missing`;\n this.error(message, { code: 'commander.optionMissingArgument' });\n }\n\n /**\n * `Option` does not have a value, and is a mandatory option.\n *\n * @param {Option} option\n * @private\n */\n\n missingMandatoryOptionValue(option) {\n const message = `error: required option '${option.flags}' not specified`;\n this.error(message, { code: 'commander.missingMandatoryOptionValue' });\n }\n\n /**\n * `Option` conflicts with another option.\n *\n * @param {Option} option\n * @param {Option} conflictingOption\n * @private\n */\n _conflictingOption(option, conflictingOption) {\n // The calling code does not know whether a negated option is the source of the\n // value, so do some work to take an educated guess.\n const findBestOptionFromValue = (option) => {\n const optionKey = option.attributeName();\n const optionValue = this.getOptionValue(optionKey);\n const negativeOption = this.options.find(\n (target) => target.negate && optionKey === target.attributeName(),\n );\n const positiveOption = this.options.find(\n (target) => !target.negate && optionKey === target.attributeName(),\n );\n if (\n negativeOption &&\n ((negativeOption.presetArg === undefined && optionValue === false) ||\n (negativeOption.presetArg !== undefined &&\n optionValue === negativeOption.presetArg))\n ) {\n return negativeOption;\n }\n return positiveOption || option;\n };\n\n const getErrorMessage = (option) => {\n const bestOption = findBestOptionFromValue(option);\n const optionKey = bestOption.attributeName();\n const source = this.getOptionValueSource(optionKey);\n if (source === 'env') {\n return `environment variable '${bestOption.envVar}'`;\n }\n return `option '${bestOption.flags}'`;\n };\n\n const message = `error: ${getErrorMessage(option)} cannot be used with ${getErrorMessage(conflictingOption)}`;\n this.error(message, { code: 'commander.conflictingOption' });\n }\n\n /**\n * Unknown option `flag`.\n *\n * @param {string} flag\n * @private\n */\n\n unknownOption(flag) {\n if (this._allowUnknownOption) return;\n let suggestion = '';\n\n if (flag.startsWith('--') && this._showSuggestionAfterError) {\n // Looping to pick up the global options too\n let candidateFlags = [];\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let command = this;\n do {\n const moreFlags = command\n .createHelp()\n .visibleOptions(command)\n .filter((option) => option.long)\n .map((option) => option.long);\n candidateFlags = candidateFlags.concat(moreFlags);\n command = command.parent;\n } while (command && !command._enablePositionalOptions);\n suggestion = suggestSimilar(flag, candidateFlags);\n }\n\n const message = `error: unknown option '${flag}'${suggestion}`;\n this.error(message, { code: 'commander.unknownOption' });\n }\n\n /**\n * Excess arguments, more than expected.\n *\n * @param {string[]} receivedArgs\n * @private\n */\n\n _excessArguments(receivedArgs) {\n if (this._allowExcessArguments) return;\n\n const expected = this.registeredArguments.length;\n const s = expected === 1 ? '' : 's';\n const forSubcommand = this.parent ? ` for '${this.name()}'` : '';\n const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${receivedArgs.length}.`;\n this.error(message, { code: 'commander.excessArguments' });\n }\n\n /**\n * Unknown command.\n *\n * @private\n */\n\n unknownCommand() {\n const unknownName = this.args[0];\n let suggestion = '';\n\n if (this._showSuggestionAfterError) {\n const candidateNames = [];\n this.createHelp()\n .visibleCommands(this)\n .forEach((command) => {\n candidateNames.push(command.name());\n // just visible alias\n if (command.alias()) candidateNames.push(command.alias());\n });\n suggestion = suggestSimilar(unknownName, candidateNames);\n }\n\n const message = `error: unknown command '${unknownName}'${suggestion}`;\n this.error(message, { code: 'commander.unknownCommand' });\n }\n\n /**\n * Get or set the program version.\n *\n * This method auto-registers the \"-V, --version\" option which will print the version number.\n *\n * You can optionally supply the flags and description to override the defaults.\n *\n * @param {string} [str]\n * @param {string} [flags]\n * @param {string} [description]\n * @return {(this | string | undefined)} `this` command for chaining, or version string if no arguments\n */\n\n version(str, flags, description) {\n if (str === undefined) return this._version;\n this._version = str;\n flags = flags || '-V, --version';\n description = description || 'output the version number';\n const versionOption = this.createOption(flags, description);\n this._versionOptionName = versionOption.attributeName();\n this._registerOption(versionOption);\n\n this.on('option:' + versionOption.name(), () => {\n this._outputConfiguration.writeOut(`${str}\\n`);\n this._exit(0, 'commander.version', str);\n });\n return this;\n }\n\n /**\n * Set the description.\n *\n * @param {string} [str]\n * @param {object} [argsDescription]\n * @return {(string|Command)}\n */\n description(str, argsDescription) {\n if (str === undefined && argsDescription === undefined)\n return this._description;\n this._description = str;\n if (argsDescription) {\n this._argsDescription = argsDescription;\n }\n return this;\n }\n\n /**\n * Set the summary. Used when listed as subcommand of parent.\n *\n * @param {string} [str]\n * @return {(string|Command)}\n */\n summary(str) {\n if (str === undefined) return this._summary;\n this._summary = str;\n return this;\n }\n\n /**\n * Set an alias for the command.\n *\n * You may call more than once to add multiple aliases. Only the first alias is shown in the auto-generated help.\n *\n * @param {string} [alias]\n * @return {(string|Command)}\n */\n\n alias(alias) {\n if (alias === undefined) return this._aliases[0]; // just return first, for backwards compatibility\n\n /** @type {Command} */\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let command = this;\n if (\n this.commands.length !== 0 &&\n this.commands[this.commands.length - 1]._executableHandler\n ) {\n // assume adding alias for last added executable subcommand, rather than this\n command = this.commands[this.commands.length - 1];\n }\n\n if (alias === command._name)\n throw new Error(\"Command alias can't be the same as its name\");\n const matchingCommand = this.parent?._findCommand(alias);\n if (matchingCommand) {\n // c.f. _registerCommand\n const existingCmd = [matchingCommand.name()]\n .concat(matchingCommand.aliases())\n .join('|');\n throw new Error(\n `cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`,\n );\n }\n\n command._aliases.push(alias);\n return this;\n }\n\n /**\n * Set aliases for the command.\n *\n * Only the first alias is shown in the auto-generated help.\n *\n * @param {string[]} [aliases]\n * @return {(string[]|Command)}\n */\n\n aliases(aliases) {\n // Getter for the array of aliases is the main reason for having aliases() in addition to alias().\n if (aliases === undefined) return this._aliases;\n\n aliases.forEach((alias) => this.alias(alias));\n return this;\n }\n\n /**\n * Set / get the command usage `str`.\n *\n * @param {string} [str]\n * @return {(string|Command)}\n */\n\n usage(str) {\n if (str === undefined) {\n if (this._usage) return this._usage;\n\n const args = this.registeredArguments.map((arg) => {\n return humanReadableArgName(arg);\n });\n return []\n .concat(\n this.options.length || this._helpOption !== null ? '[options]' : [],\n this.commands.length ? '[command]' : [],\n this.registeredArguments.length ? args : [],\n )\n .join(' ');\n }\n\n this._usage = str;\n return this;\n }\n\n /**\n * Get or set the name of the command.\n *\n * @param {string} [str]\n * @return {(string|Command)}\n */\n\n name(str) {\n if (str === undefined) return this._name;\n this._name = str;\n return this;\n }\n\n /**\n * Set/get the help group heading for this subcommand in parent command's help.\n *\n * @param {string} [heading]\n * @return {Command | string}\n */\n\n helpGroup(heading) {\n if (heading === undefined) return this._helpGroupHeading ?? '';\n this._helpGroupHeading = heading;\n return this;\n }\n\n /**\n * Set/get the default help group heading for subcommands added to this command.\n * (This does not override a group set directly on the subcommand using .helpGroup().)\n *\n * @example\n * program.commandsGroup('Development Commands:);\n * program.command('watch')...\n * program.command('lint')...\n * ...\n *\n * @param {string} [heading]\n * @returns {Command | string}\n */\n commandsGroup(heading) {\n if (heading === undefined) return this._defaultCommandGroup ?? '';\n this._defaultCommandGroup = heading;\n return this;\n }\n\n /**\n * Set/get the default help group heading for options added to this command.\n * (This does not override a group set directly on the option using .helpGroup().)\n *\n * @example\n * program\n * .optionsGroup('Development Options:')\n * .option('-d, --debug', 'output extra debugging')\n * .option('-p, --profile', 'output profiling information')\n *\n * @param {string} [heading]\n * @returns {Command | string}\n */\n optionsGroup(heading) {\n if (heading === undefined) return this._defaultOptionGroup ?? '';\n this._defaultOptionGroup = heading;\n return this;\n }\n\n /**\n * @param {Option} option\n * @private\n */\n _initOptionGroup(option) {\n if (this._defaultOptionGroup && !option.helpGroupHeading)\n option.helpGroup(this._defaultOptionGroup);\n }\n\n /**\n * @param {Command} cmd\n * @private\n */\n _initCommandGroup(cmd) {\n if (this._defaultCommandGroup && !cmd.helpGroup())\n cmd.helpGroup(this._defaultCommandGroup);\n }\n\n /**\n * Set the name of the command from script filename, such as process.argv[1],\n * or require.main.filename, or __filename.\n *\n * (Used internally and public although not documented in README.)\n *\n * @example\n * program.nameFromFilename(require.main.filename);\n *\n * @param {string} filename\n * @return {Command}\n */\n\n nameFromFilename(filename) {\n this._name = path.basename(filename, path.extname(filename));\n\n return this;\n }\n\n /**\n * Get or set the directory for searching for executable subcommands of this command.\n *\n * @example\n * program.executableDir(__dirname);\n * // or\n * program.executableDir('subcommands');\n *\n * @param {string} [path]\n * @return {(string|null|Command)}\n */\n\n executableDir(path) {\n if (path === undefined) return this._executableDir;\n this._executableDir = path;\n return this;\n }\n\n /**\n * Return program help documentation.\n *\n * @param {{ error: boolean }} [contextOptions] - pass {error:true} to wrap for stderr instead of stdout\n * @return {string}\n */\n\n helpInformation(contextOptions) {\n const helper = this.createHelp();\n const context = this._getOutputContext(contextOptions);\n helper.prepareContext({\n error: context.error,\n helpWidth: context.helpWidth,\n outputHasColors: context.hasColors,\n });\n const text = helper.formatHelp(this, helper);\n if (context.hasColors) return text;\n return this._outputConfiguration.stripColor(text);\n }\n\n /**\n * @typedef HelpContext\n * @type {object}\n * @property {boolean} error\n * @property {number} helpWidth\n * @property {boolean} hasColors\n * @property {function} write - includes stripColor if needed\n *\n * @returns {HelpContext}\n * @private\n */\n\n _getOutputContext(contextOptions) {\n contextOptions = contextOptions || {};\n const error = !!contextOptions.error;\n let baseWrite;\n let hasColors;\n let helpWidth;\n if (error) {\n baseWrite = (str) => this._outputConfiguration.writeErr(str);\n hasColors = this._outputConfiguration.getErrHasColors();\n helpWidth = this._outputConfiguration.getErrHelpWidth();\n } else {\n baseWrite = (str) => this._outputConfiguration.writeOut(str);\n hasColors = this._outputConfiguration.getOutHasColors();\n helpWidth = this._outputConfiguration.getOutHelpWidth();\n }\n const write = (str) => {\n if (!hasColors) str = this._outputConfiguration.stripColor(str);\n return baseWrite(str);\n };\n return { error, write, hasColors, helpWidth };\n }\n\n /**\n * Output help information for this command.\n *\n * Outputs built-in help, and custom text added using `.addHelpText()`.\n *\n * @param {{ error: boolean } | Function} [contextOptions] - pass {error:true} to write to stderr instead of stdout\n */\n\n outputHelp(contextOptions) {\n let deprecatedCallback;\n if (typeof contextOptions === 'function') {\n deprecatedCallback = contextOptions;\n contextOptions = undefined;\n }\n\n const outputContext = this._getOutputContext(contextOptions);\n /** @type {HelpTextEventContext} */\n const eventContext = {\n error: outputContext.error,\n write: outputContext.write,\n command: this,\n };\n\n this._getCommandAndAncestors()\n .reverse()\n .forEach((command) => command.emit('beforeAllHelp', eventContext));\n this.emit('beforeHelp', eventContext);\n\n let helpInformation = this.helpInformation({ error: outputContext.error });\n if (deprecatedCallback) {\n helpInformation = deprecatedCallback(helpInformation);\n if (\n typeof helpInformation !== 'string' &&\n !Buffer.isBuffer(helpInformation)\n ) {\n throw new Error('outputHelp callback must return a string or a Buffer');\n }\n }\n outputContext.write(helpInformation);\n\n if (this._getHelpOption()?.long) {\n this.emit(this._getHelpOption().long); // deprecated\n }\n this.emit('afterHelp', eventContext);\n this._getCommandAndAncestors().forEach((command) =>\n command.emit('afterAllHelp', eventContext),\n );\n }\n\n /**\n * You can pass in flags and a description to customise the built-in help option.\n * Pass in false to disable the built-in help option.\n *\n * @example\n * program.helpOption('-?, --help' 'show help'); // customise\n * program.helpOption(false); // disable\n *\n * @param {(string | boolean)} flags\n * @param {string} [description]\n * @return {Command} `this` command for chaining\n */\n\n helpOption(flags, description) {\n // Support enabling/disabling built-in help option.\n if (typeof flags === 'boolean') {\n if (flags) {\n if (this._helpOption === null) this._helpOption = undefined; // reenable\n if (this._defaultOptionGroup) {\n // make the option to store the group\n this._initOptionGroup(this._getHelpOption());\n }\n } else {\n this._helpOption = null; // disable\n }\n return this;\n }\n\n // Customise flags and description.\n this._helpOption = this.createOption(\n flags ?? '-h, --help',\n description ?? 'display help for command',\n );\n // init group unless lazy create\n if (flags || description) this._initOptionGroup(this._helpOption);\n\n return this;\n }\n\n /**\n * Lazy create help option.\n * Returns null if has been disabled with .helpOption(false).\n *\n * @returns {(Option | null)} the help option\n * @package\n */\n _getHelpOption() {\n // Lazy create help option on demand.\n if (this._helpOption === undefined) {\n this.helpOption(undefined, undefined);\n }\n return this._helpOption;\n }\n\n /**\n * Supply your own option to use for the built-in help option.\n * This is an alternative to using helpOption() to customise the flags and description etc.\n *\n * @param {Option} option\n * @return {Command} `this` command for chaining\n */\n addHelpOption(option) {\n this._helpOption = option;\n this._initOptionGroup(option);\n return this;\n }\n\n /**\n * Output help information and exit.\n *\n * Outputs built-in help, and custom text added using `.addHelpText()`.\n *\n * @param {{ error: boolean }} [contextOptions] - pass {error:true} to write to stderr instead of stdout\n */\n\n help(contextOptions) {\n this.outputHelp(contextOptions);\n let exitCode = Number(process.exitCode ?? 0); // process.exitCode does allow a string or an integer, but we prefer just a number\n if (\n exitCode === 0 &&\n contextOptions &&\n typeof contextOptions !== 'function' &&\n contextOptions.error\n ) {\n exitCode = 1;\n }\n // message: do not have all displayed text available so only passing placeholder.\n this._exit(exitCode, 'commander.help', '(outputHelp)');\n }\n\n /**\n * // Do a little typing to coordinate emit and listener for the help text events.\n * @typedef HelpTextEventContext\n * @type {object}\n * @property {boolean} error\n * @property {Command} command\n * @property {function} write\n */\n\n /**\n * Add additional text to be displayed with the built-in help.\n *\n * Position is 'before' or 'after' to affect just this command,\n * and 'beforeAll' or 'afterAll' to affect this command and all its subcommands.\n *\n * @param {string} position - before or after built-in help\n * @param {(string | Function)} text - string to add, or a function returning a string\n * @return {Command} `this` command for chaining\n */\n\n addHelpText(position, text) {\n const allowedValues = ['beforeAll', 'before', 'after', 'afterAll'];\n if (!allowedValues.includes(position)) {\n throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${allowedValues.join(\"', '\")}'`);\n }\n\n const helpEvent = `${position}Help`;\n this.on(helpEvent, (/** @type {HelpTextEventContext} */ context) => {\n let helpStr;\n if (typeof text === 'function') {\n helpStr = text({ error: context.error, command: context.command });\n } else {\n helpStr = text;\n }\n // Ignore falsy value when nothing to output.\n if (helpStr) {\n context.write(`${helpStr}\\n`);\n }\n });\n return this;\n }\n\n /**\n * Output help information if help flags specified\n *\n * @param {Array} args - array of options to search for help flags\n * @private\n */\n\n _outputHelpIfRequested(args) {\n const helpOption = this._getHelpOption();\n const helpRequested = helpOption && args.find((arg) => helpOption.is(arg));\n if (helpRequested) {\n this.outputHelp();\n // (Do not have all displayed text available so only passing placeholder.)\n this._exit(0, 'commander.helpDisplayed', '(outputHelp)');\n }\n }\n}\n\n/**\n * Scan arguments and increment port number for inspect calls (to avoid conflicts when spawning new command).\n *\n * @param {string[]} args - array of arguments from node.execArgv\n * @returns {string[]}\n * @private\n */\n\nfunction incrementNodeInspectorPort(args) {\n // Testing for these options:\n // --inspect[=[host:]port]\n // --inspect-brk[=[host:]port]\n // --inspect-port=[host:]port\n return args.map((arg) => {\n if (!arg.startsWith('--inspect')) {\n return arg;\n }\n let debugOption;\n let debugHost = '127.0.0.1';\n let debugPort = '9229';\n let match;\n if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {\n // e.g. --inspect\n debugOption = match[1];\n } else if (\n (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null\n ) {\n debugOption = match[1];\n if (/^\\d+$/.test(match[3])) {\n // e.g. --inspect=1234\n debugPort = match[3];\n } else {\n // e.g. --inspect=localhost\n debugHost = match[3];\n }\n } else if (\n (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\\d+)$/)) !== null\n ) {\n // e.g. --inspect=localhost:1234\n debugOption = match[1];\n debugHost = match[3];\n debugPort = match[4];\n }\n\n if (debugOption && debugPort !== '0') {\n return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;\n }\n return arg;\n });\n}\n\n/**\n * @returns {boolean | undefined}\n * @package\n */\nfunction useColor() {\n // Test for common conventions.\n // NB: the observed behaviour is in combination with how author adds color! For example:\n // - we do not test NODE_DISABLE_COLORS, but util:styletext does\n // - we do test NO_COLOR, but Chalk does not\n //\n // References:\n // https://no-color.org\n // https://bixense.com/clicolors/\n // https://github.com/nodejs/node/blob/0a00217a5f67ef4a22384cfc80eb6dd9a917fdc1/lib/internal/tty.js#L109\n // https://github.com/chalk/supports-color/blob/c214314a14bcb174b12b3014b2b0a8de375029ae/index.js#L33\n // (https://force-color.org recent web page from 2023, does not match major javascript implementations)\n\n if (\n process.env.NO_COLOR ||\n process.env.FORCE_COLOR === '0' ||\n process.env.FORCE_COLOR === 'false'\n )\n return false;\n if (process.env.FORCE_COLOR || process.env.CLICOLOR_FORCE !== undefined)\n return true;\n return undefined;\n}\n\nexports.Command = Command;\nexports.useColor = useColor; // exporting for tests\n","const { Argument } = require('./lib/argument.js');\nconst { Command } = require('./lib/command.js');\nconst { CommanderError, InvalidArgumentError } = require('./lib/error.js');\nconst { Help } = require('./lib/help.js');\nconst { Option } = require('./lib/option.js');\n\nexports.program = new Command();\n\nexports.createCommand = (name) => new Command(name);\nexports.createOption = (flags, description) => new Option(flags, description);\nexports.createArgument = (name, description) => new Argument(name, description);\n\n/**\n * Expose classes\n */\n\nexports.Command = Command;\nexports.Option = Option;\nexports.Argument = Argument;\nexports.Help = Help;\n\nexports.CommanderError = CommanderError;\nexports.InvalidArgumentError = InvalidArgumentError;\nexports.InvalidOptionArgumentError = InvalidArgumentError; // Deprecated\n","import commander from './index.js';\n\n// wrapper to provide named exports for ESM.\nexport const {\n program,\n createCommand,\n createArgument,\n createOption,\n CommanderError,\n InvalidArgumentError,\n InvalidOptionArgumentError, // deprecated old name\n Command,\n Argument,\n Option,\n Help,\n} = commander;\n","//#region rolldown:runtime\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __commonJS = (cb, mod) => function() {\n\treturn mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {\n\t\tkey = keys[i];\n\t\tif (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: ((k) => from[k]).bind(null, key),\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", {\n\tvalue: mod,\n\tenumerable: true\n}) : target, mod));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js\nvar require_typeof = __commonJS({ \"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js\"(exports, module) {\n\tfunction _typeof$2(o) {\n\t\t\"@babel/helpers - typeof\";\n\t\treturn module.exports = _typeof$2 = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(o$1) {\n\t\t\treturn typeof o$1;\n\t\t} : function(o$1) {\n\t\t\treturn o$1 && \"function\" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? \"symbol\" : typeof o$1;\n\t\t}, module.exports.__esModule = true, module.exports[\"default\"] = module.exports, _typeof$2(o);\n\t}\n\tmodule.exports = _typeof$2, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n} });\n\n//#endregion\n//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js\nvar require_toPrimitive = __commonJS({ \"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js\"(exports, module) {\n\tvar _typeof$1 = require_typeof()[\"default\"];\n\tfunction toPrimitive$1(t, r) {\n\t\tif (\"object\" != _typeof$1(t) || !t) return t;\n\t\tvar e = t[Symbol.toPrimitive];\n\t\tif (void 0 !== e) {\n\t\t\tvar i = e.call(t, r || \"default\");\n\t\t\tif (\"object\" != _typeof$1(i)) return i;\n\t\t\tthrow new TypeError(\"@@toPrimitive must return a primitive value.\");\n\t\t}\n\t\treturn (\"string\" === r ? String : Number)(t);\n\t}\n\tmodule.exports = toPrimitive$1, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n} });\n\n//#endregion\n//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js\nvar require_toPropertyKey = __commonJS({ \"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js\"(exports, module) {\n\tvar _typeof = require_typeof()[\"default\"];\n\tvar toPrimitive = require_toPrimitive();\n\tfunction toPropertyKey$1(t) {\n\t\tvar i = toPrimitive(t, \"string\");\n\t\treturn \"symbol\" == _typeof(i) ? i : i + \"\";\n\t}\n\tmodule.exports = toPropertyKey$1, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n} });\n\n//#endregion\n//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js\nvar require_defineProperty = __commonJS({ \"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js\"(exports, module) {\n\tvar toPropertyKey = require_toPropertyKey();\n\tfunction _defineProperty(e, r, t) {\n\t\treturn (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n\t\t\tvalue: t,\n\t\t\tenumerable: !0,\n\t\t\tconfigurable: !0,\n\t\t\twritable: !0\n\t\t}) : e[r] = t, e;\n\t}\n\tmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n} });\n\n//#endregion\n//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js\nvar require_objectSpread2 = __commonJS({ \"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js\"(exports, module) {\n\tvar defineProperty = require_defineProperty();\n\tfunction ownKeys(e, r) {\n\t\tvar t = Object.keys(e);\n\t\tif (Object.getOwnPropertySymbols) {\n\t\t\tvar o = Object.getOwnPropertySymbols(e);\n\t\t\tr && (o = o.filter(function(r$1) {\n\t\t\t\treturn Object.getOwnPropertyDescriptor(e, r$1).enumerable;\n\t\t\t})), t.push.apply(t, o);\n\t\t}\n\t\treturn t;\n\t}\n\tfunction _objectSpread2(e) {\n\t\tfor (var r = 1; r < arguments.length; r++) {\n\t\t\tvar t = null != arguments[r] ? arguments[r] : {};\n\t\t\tr % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {\n\t\t\t\tdefineProperty(e, r$1, t[r$1]);\n\t\t\t}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {\n\t\t\t\tObject.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));\n\t\t\t});\n\t\t}\n\t\treturn e;\n\t}\n\tmodule.exports = _objectSpread2, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n} });\n\n//#endregion\nexport { __commonJS, __toESM, require_defineProperty, require_objectSpread2 };\n//# sourceMappingURL=objectSpread2-BvkFp-_Y.mjs.map","//#region src/observable/observable.ts\n/** @public */\nfunction isObservable(x) {\n\treturn typeof x === \"object\" && x !== null && \"subscribe\" in x;\n}\n/** @public */\nfunction observable(subscribe) {\n\tconst self = {\n\t\tsubscribe(observer) {\n\t\t\tlet teardownRef = null;\n\t\t\tlet isDone = false;\n\t\t\tlet unsubscribed = false;\n\t\t\tlet teardownImmediately = false;\n\t\t\tfunction unsubscribe() {\n\t\t\t\tif (teardownRef === null) {\n\t\t\t\t\tteardownImmediately = true;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (unsubscribed) return;\n\t\t\t\tunsubscribed = true;\n\t\t\t\tif (typeof teardownRef === \"function\") teardownRef();\n\t\t\t\telse if (teardownRef) teardownRef.unsubscribe();\n\t\t\t}\n\t\t\tteardownRef = subscribe({\n\t\t\t\tnext(value) {\n\t\t\t\t\tvar _observer$next;\n\t\t\t\t\tif (isDone) return;\n\t\t\t\t\t(_observer$next = observer.next) === null || _observer$next === void 0 || _observer$next.call(observer, value);\n\t\t\t\t},\n\t\t\t\terror(err) {\n\t\t\t\t\tvar _observer$error;\n\t\t\t\t\tif (isDone) return;\n\t\t\t\t\tisDone = true;\n\t\t\t\t\t(_observer$error = observer.error) === null || _observer$error === void 0 || _observer$error.call(observer, err);\n\t\t\t\t\tunsubscribe();\n\t\t\t\t},\n\t\t\t\tcomplete() {\n\t\t\t\t\tvar _observer$complete;\n\t\t\t\t\tif (isDone) return;\n\t\t\t\t\tisDone = true;\n\t\t\t\t\t(_observer$complete = observer.complete) === null || _observer$complete === void 0 || _observer$complete.call(observer);\n\t\t\t\t\tunsubscribe();\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (teardownImmediately) unsubscribe();\n\t\t\treturn { unsubscribe };\n\t\t},\n\t\tpipe(...operations) {\n\t\t\treturn operations.reduce(pipeReducer, self);\n\t\t}\n\t};\n\treturn self;\n}\nfunction pipeReducer(prev, fn) {\n\treturn fn(prev);\n}\n/** @internal */\nfunction observableToPromise(observable$1) {\n\tconst ac = new AbortController();\n\tconst promise = new Promise((resolve, reject) => {\n\t\tlet isDone = false;\n\t\tfunction onDone() {\n\t\t\tif (isDone) return;\n\t\t\tisDone = true;\n\t\t\tobs$.unsubscribe();\n\t\t}\n\t\tac.signal.addEventListener(\"abort\", () => {\n\t\t\treject(ac.signal.reason);\n\t\t});\n\t\tconst obs$ = observable$1.subscribe({\n\t\t\tnext(data) {\n\t\t\t\tisDone = true;\n\t\t\t\tresolve(data);\n\t\t\t\tonDone();\n\t\t\t},\n\t\t\terror(data) {\n\t\t\t\treject(data);\n\t\t\t},\n\t\t\tcomplete() {\n\t\t\t\tac.abort();\n\t\t\t\tonDone();\n\t\t\t}\n\t\t});\n\t});\n\treturn promise;\n}\n/**\n* @internal\n*/\nfunction observableToReadableStream(observable$1, signal) {\n\tlet unsub = null;\n\tconst onAbort = () => {\n\t\tunsub === null || unsub === void 0 || unsub.unsubscribe();\n\t\tunsub = null;\n\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t};\n\treturn new ReadableStream({\n\t\tstart(controller) {\n\t\t\tunsub = observable$1.subscribe({\n\t\t\t\tnext(data) {\n\t\t\t\t\tcontroller.enqueue({\n\t\t\t\t\t\tok: true,\n\t\t\t\t\t\tvalue: data\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\terror(error) {\n\t\t\t\t\tcontroller.enqueue({\n\t\t\t\t\t\tok: false,\n\t\t\t\t\t\terror\n\t\t\t\t\t});\n\t\t\t\t\tcontroller.close();\n\t\t\t\t},\n\t\t\t\tcomplete() {\n\t\t\t\t\tcontroller.close();\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (signal.aborted) onAbort();\n\t\t\telse signal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t},\n\t\tcancel() {\n\t\t\tonAbort();\n\t\t}\n\t});\n}\n/** @internal */\nfunction observableToAsyncIterable(observable$1, signal) {\n\tconst stream = observableToReadableStream(observable$1, signal);\n\tconst reader = stream.getReader();\n\tconst iterator = {\n\t\tasync next() {\n\t\t\tconst value = await reader.read();\n\t\t\tif (value.done) return {\n\t\t\t\tvalue: void 0,\n\t\t\t\tdone: true\n\t\t\t};\n\t\t\tconst { value: result } = value;\n\t\t\tif (!result.ok) throw result.error;\n\t\t\treturn {\n\t\t\t\tvalue: result.value,\n\t\t\t\tdone: false\n\t\t\t};\n\t\t},\n\t\tasync return() {\n\t\t\tawait reader.cancel();\n\t\t\treturn {\n\t\t\t\tvalue: void 0,\n\t\t\t\tdone: true\n\t\t\t};\n\t\t}\n\t};\n\treturn { [Symbol.asyncIterator]() {\n\t\treturn iterator;\n\t} };\n}\n\n//#endregion\nexport { isObservable, observable, observableToAsyncIterable, observableToPromise };\n//# sourceMappingURL=observable-UMO3vUa_.mjs.map","import { observable } from \"./observable-UMO3vUa_.mjs\";\n\n//#region src/observable/operators.ts\nfunction map(project) {\n\treturn (source) => {\n\t\treturn observable((destination) => {\n\t\t\tlet index = 0;\n\t\t\tconst subscription = source.subscribe({\n\t\t\t\tnext(value) {\n\t\t\t\t\tdestination.next(project(value, index++));\n\t\t\t\t},\n\t\t\t\terror(error) {\n\t\t\t\t\tdestination.error(error);\n\t\t\t\t},\n\t\t\t\tcomplete() {\n\t\t\t\t\tdestination.complete();\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn subscription;\n\t\t});\n\t};\n}\nfunction share(_opts) {\n\treturn (source) => {\n\t\tlet refCount = 0;\n\t\tlet subscription = null;\n\t\tconst observers = [];\n\t\tfunction startIfNeeded() {\n\t\t\tif (subscription) return;\n\t\t\tsubscription = source.subscribe({\n\t\t\t\tnext(value) {\n\t\t\t\t\tfor (const observer of observers) {\n\t\t\t\t\t\tvar _observer$next;\n\t\t\t\t\t\t(_observer$next = observer.next) === null || _observer$next === void 0 || _observer$next.call(observer, value);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\terror(error) {\n\t\t\t\t\tfor (const observer of observers) {\n\t\t\t\t\t\tvar _observer$error;\n\t\t\t\t\t\t(_observer$error = observer.error) === null || _observer$error === void 0 || _observer$error.call(observer, error);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tcomplete() {\n\t\t\t\t\tfor (const observer of observers) {\n\t\t\t\t\t\tvar _observer$complete;\n\t\t\t\t\t\t(_observer$complete = observer.complete) === null || _observer$complete === void 0 || _observer$complete.call(observer);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tfunction resetIfNeeded() {\n\t\t\tif (refCount === 0 && subscription) {\n\t\t\t\tconst _sub = subscription;\n\t\t\t\tsubscription = null;\n\t\t\t\t_sub.unsubscribe();\n\t\t\t}\n\t\t}\n\t\treturn observable((subscriber) => {\n\t\t\trefCount++;\n\t\t\tobservers.push(subscriber);\n\t\t\tstartIfNeeded();\n\t\t\treturn { unsubscribe() {\n\t\t\t\trefCount--;\n\t\t\t\tresetIfNeeded();\n\t\t\t\tconst index = observers.findIndex((v) => v === subscriber);\n\t\t\t\tif (index > -1) observers.splice(index, 1);\n\t\t\t} };\n\t\t});\n\t};\n}\nfunction tap(observer) {\n\treturn (source) => {\n\t\treturn observable((destination) => {\n\t\t\treturn source.subscribe({\n\t\t\t\tnext(value) {\n\t\t\t\t\tvar _observer$next2;\n\t\t\t\t\t(_observer$next2 = observer.next) === null || _observer$next2 === void 0 || _observer$next2.call(observer, value);\n\t\t\t\t\tdestination.next(value);\n\t\t\t\t},\n\t\t\t\terror(error) {\n\t\t\t\t\tvar _observer$error2;\n\t\t\t\t\t(_observer$error2 = observer.error) === null || _observer$error2 === void 0 || _observer$error2.call(observer, error);\n\t\t\t\t\tdestination.error(error);\n\t\t\t\t},\n\t\t\t\tcomplete() {\n\t\t\t\t\tvar _observer$complete2;\n\t\t\t\t\t(_observer$complete2 = observer.complete) === null || _observer$complete2 === void 0 || _observer$complete2.call(observer);\n\t\t\t\t\tdestination.complete();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t};\n}\nconst distinctUnsetMarker = Symbol();\nfunction distinctUntilChanged(compare = (a, b) => a === b) {\n\treturn (source) => {\n\t\treturn observable((destination) => {\n\t\t\tlet lastValue = distinctUnsetMarker;\n\t\t\treturn source.subscribe({\n\t\t\t\tnext(value) {\n\t\t\t\t\tif (lastValue !== distinctUnsetMarker && compare(lastValue, value)) return;\n\t\t\t\t\tlastValue = value;\n\t\t\t\t\tdestination.next(value);\n\t\t\t\t},\n\t\t\t\terror(error) {\n\t\t\t\t\tdestination.error(error);\n\t\t\t\t},\n\t\t\t\tcomplete() {\n\t\t\t\t\tdestination.complete();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t};\n}\nconst isDeepEqual = (a, b) => {\n\tif (a === b) return true;\n\tconst bothAreObjects = a && b && typeof a === \"object\" && typeof b === \"object\";\n\treturn !!bothAreObjects && Object.keys(a).length === Object.keys(b).length && Object.entries(a).every(([k, v]) => isDeepEqual(v, b[k]));\n};\nfunction distinctUntilDeepChanged() {\n\treturn distinctUntilChanged(isDeepEqual);\n}\n\n//#endregion\n//#region src/observable/behaviorSubject.ts\n/**\n* @internal\n* An observable that maintains and provides a \"current value\" to subscribers\n* @see https://www.learnrxjs.io/learn-rxjs/subjects/behaviorsubject\n*/\nfunction behaviorSubject(initialValue) {\n\tlet value = initialValue;\n\tconst observerList = [];\n\tconst addObserver = (observer) => {\n\t\tif (value !== void 0) observer.next(value);\n\t\tobserverList.push(observer);\n\t};\n\tconst removeObserver = (observer) => {\n\t\tobserverList.splice(observerList.indexOf(observer), 1);\n\t};\n\tconst obs = observable((observer) => {\n\t\taddObserver(observer);\n\t\treturn () => {\n\t\t\tremoveObserver(observer);\n\t\t};\n\t});\n\tobs.next = (nextValue) => {\n\t\tif (value === nextValue) return;\n\t\tvalue = nextValue;\n\t\tfor (const observer of observerList) observer.next(nextValue);\n\t};\n\tobs.get = () => value;\n\treturn obs;\n}\n\n//#endregion\nexport { behaviorSubject, distinctUntilChanged, distinctUntilDeepChanged, map, share, tap };\n//# sourceMappingURL=observable-CUiPknO-.mjs.map","import { observable } from \"@trpc/server/observable\";\n\n//#region src/links/internals/createChain.ts\n/** @internal */\nfunction createChain(opts) {\n\treturn observable((observer) => {\n\t\tfunction execute(index = 0, op = opts.op) {\n\t\t\tconst next = opts.links[index];\n\t\t\tif (!next) throw new Error(\"No more links to execute - did you forget to add an ending link?\");\n\t\t\tconst subscription = next({\n\t\t\t\top,\n\t\t\t\tnext(nextOp) {\n\t\t\t\t\tconst nextObserver = execute(index + 1, nextOp);\n\t\t\t\t\treturn nextObserver;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn subscription;\n\t\t}\n\t\tconst obs$ = execute();\n\t\treturn obs$.subscribe(observer);\n\t});\n}\n\n//#endregion\n//#region src/links/splitLink.ts\nfunction asArray(value) {\n\treturn Array.isArray(value) ? value : [value];\n}\nfunction splitLink(opts) {\n\treturn (runtime) => {\n\t\tconst yes = asArray(opts.true).map((link) => link(runtime));\n\t\tconst no = asArray(opts.false).map((link) => link(runtime));\n\t\treturn (props) => {\n\t\t\treturn observable((observer) => {\n\t\t\t\tconst links = opts.condition(props.op) ? yes : no;\n\t\t\t\treturn createChain({\n\t\t\t\t\top: props.op,\n\t\t\t\t\tlinks\n\t\t\t\t}).subscribe(observer);\n\t\t\t});\n\t\t};\n\t};\n}\n\n//#endregion\nexport { createChain, splitLink };\n//# sourceMappingURL=splitLink-B7Cuf2c_.mjs.map","//#region src/unstable-core-do-not-import/utils.ts\n/**\n* Ensures there are no duplicate keys when building a procedure.\n* @internal\n*/\nfunction mergeWithoutOverrides(obj1, ...objs) {\n\tconst newObj = Object.assign(emptyObject(), obj1);\n\tfor (const overrides of objs) for (const key in overrides) {\n\t\tif (key in newObj && newObj[key] !== overrides[key]) throw new Error(`Duplicate key ${key}`);\n\t\tnewObj[key] = overrides[key];\n\t}\n\treturn newObj;\n}\n/**\n* Check that value is object\n* @internal\n*/\nfunction isObject(value) {\n\treturn !!value && !Array.isArray(value) && typeof value === \"object\";\n}\nfunction isFunction(fn) {\n\treturn typeof fn === \"function\";\n}\n/**\n* Create an object without inheriting anything from `Object.prototype`\n* @internal\n*/\nfunction emptyObject() {\n\treturn Object.create(null);\n}\nconst asyncIteratorsSupported = typeof Symbol === \"function\" && !!Symbol.asyncIterator;\nfunction isAsyncIterable(value) {\n\treturn asyncIteratorsSupported && isObject(value) && Symbol.asyncIterator in value;\n}\n/**\n* Run an IIFE\n*/\nconst run = (fn) => fn();\nfunction noop() {}\nfunction identity(it) {\n\treturn it;\n}\n/**\n* Generic runtime assertion function. Throws, if the condition is not `true`.\n*\n* Can be used as a slightly less dangerous variant of type assertions. Code\n* mistakes would be revealed at runtime then (hopefully during testing).\n*/\nfunction assert(condition, msg = \"no additional info\") {\n\tif (!condition) throw new Error(`AssertionError: ${msg}`);\n}\nfunction sleep(ms = 0) {\n\treturn new Promise((res) => setTimeout(res, ms));\n}\n/**\n* Ponyfill for\n* [`AbortSignal.any`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/any_static).\n*/\nfunction abortSignalsAnyPonyfill(signals) {\n\tif (typeof AbortSignal.any === \"function\") return AbortSignal.any(signals);\n\tconst ac = new AbortController();\n\tfor (const signal of signals) {\n\t\tif (signal.aborted) {\n\t\t\ttrigger();\n\t\t\tbreak;\n\t\t}\n\t\tsignal.addEventListener(\"abort\", trigger, { once: true });\n\t}\n\treturn ac.signal;\n\tfunction trigger() {\n\t\tac.abort();\n\t\tfor (const signal of signals) signal.removeEventListener(\"abort\", trigger);\n\t}\n}\n\n//#endregion\n//#region src/unstable-core-do-not-import/rpc/codes.ts\n/**\n* JSON-RPC 2.0 Error codes\n*\n* `-32000` to `-32099` are reserved for implementation-defined server-errors.\n* For tRPC we're copying the last digits of HTTP 4XX errors.\n*/\nconst TRPC_ERROR_CODES_BY_KEY = {\n\tPARSE_ERROR: -32700,\n\tBAD_REQUEST: -32600,\n\tINTERNAL_SERVER_ERROR: -32603,\n\tNOT_IMPLEMENTED: -32603,\n\tBAD_GATEWAY: -32603,\n\tSERVICE_UNAVAILABLE: -32603,\n\tGATEWAY_TIMEOUT: -32603,\n\tUNAUTHORIZED: -32001,\n\tPAYMENT_REQUIRED: -32002,\n\tFORBIDDEN: -32003,\n\tNOT_FOUND: -32004,\n\tMETHOD_NOT_SUPPORTED: -32005,\n\tTIMEOUT: -32008,\n\tCONFLICT: -32009,\n\tPRECONDITION_FAILED: -32012,\n\tPAYLOAD_TOO_LARGE: -32013,\n\tUNSUPPORTED_MEDIA_TYPE: -32015,\n\tUNPROCESSABLE_CONTENT: -32022,\n\tPRECONDITION_REQUIRED: -32028,\n\tTOO_MANY_REQUESTS: -32029,\n\tCLIENT_CLOSED_REQUEST: -32099\n};\nconst TRPC_ERROR_CODES_BY_NUMBER = {\n\t[-32700]: \"PARSE_ERROR\",\n\t[-32600]: \"BAD_REQUEST\",\n\t[-32603]: \"INTERNAL_SERVER_ERROR\",\n\t[-32001]: \"UNAUTHORIZED\",\n\t[-32002]: \"PAYMENT_REQUIRED\",\n\t[-32003]: \"FORBIDDEN\",\n\t[-32004]: \"NOT_FOUND\",\n\t[-32005]: \"METHOD_NOT_SUPPORTED\",\n\t[-32008]: \"TIMEOUT\",\n\t[-32009]: \"CONFLICT\",\n\t[-32012]: \"PRECONDITION_FAILED\",\n\t[-32013]: \"PAYLOAD_TOO_LARGE\",\n\t[-32015]: \"UNSUPPORTED_MEDIA_TYPE\",\n\t[-32022]: \"UNPROCESSABLE_CONTENT\",\n\t[-32028]: \"PRECONDITION_REQUIRED\",\n\t[-32029]: \"TOO_MANY_REQUESTS\",\n\t[-32099]: \"CLIENT_CLOSED_REQUEST\"\n};\n/**\n* tRPC error codes that are considered retryable\n* With out of the box SSE, the client will reconnect when these errors are encountered\n*/\nconst retryableRpcCodes = [\n\tTRPC_ERROR_CODES_BY_KEY.BAD_GATEWAY,\n\tTRPC_ERROR_CODES_BY_KEY.SERVICE_UNAVAILABLE,\n\tTRPC_ERROR_CODES_BY_KEY.GATEWAY_TIMEOUT,\n\tTRPC_ERROR_CODES_BY_KEY.INTERNAL_SERVER_ERROR\n];\n\n//#endregion\nexport { TRPC_ERROR_CODES_BY_KEY, TRPC_ERROR_CODES_BY_NUMBER, abortSignalsAnyPonyfill, assert, emptyObject, identity, isAsyncIterable, isFunction, isObject, mergeWithoutOverrides, noop, retryableRpcCodes, run, sleep };\n//# sourceMappingURL=codes-DagpWZLc.mjs.map","import { TRPC_ERROR_CODES_BY_KEY, TRPC_ERROR_CODES_BY_NUMBER, emptyObject, isObject } from \"./codes-DagpWZLc.mjs\";\n\n//#region rolldown:runtime\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __commonJS = (cb, mod) => function() {\n\treturn mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {\n\t\tkey = keys[i];\n\t\tif (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: ((k) => from[k]).bind(null, key),\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", {\n\tvalue: mod,\n\tenumerable: true\n}) : target, mod));\n\n//#endregion\n//#region src/unstable-core-do-not-import/createProxy.ts\nconst noop = () => {};\nconst freezeIfAvailable = (obj) => {\n\tif (Object.freeze) Object.freeze(obj);\n};\nfunction createInnerProxy(callback, path, memo) {\n\tvar _memo$cacheKey;\n\tconst cacheKey = path.join(\".\");\n\t(_memo$cacheKey = memo[cacheKey]) !== null && _memo$cacheKey !== void 0 || (memo[cacheKey] = new Proxy(noop, {\n\t\tget(_obj, key) {\n\t\t\tif (typeof key !== \"string\" || key === \"then\") return void 0;\n\t\t\treturn createInnerProxy(callback, [...path, key], memo);\n\t\t},\n\t\tapply(_1, _2, args) {\n\t\t\tconst lastOfPath = path[path.length - 1];\n\t\t\tlet opts = {\n\t\t\t\targs,\n\t\t\t\tpath\n\t\t\t};\n\t\t\tif (lastOfPath === \"call\") opts = {\n\t\t\t\targs: args.length >= 2 ? [args[1]] : [],\n\t\t\t\tpath: path.slice(0, -1)\n\t\t\t};\n\t\t\telse if (lastOfPath === \"apply\") opts = {\n\t\t\t\targs: args.length >= 2 ? args[1] : [],\n\t\t\t\tpath: path.slice(0, -1)\n\t\t\t};\n\t\t\tfreezeIfAvailable(opts.args);\n\t\t\tfreezeIfAvailable(opts.path);\n\t\t\treturn callback(opts);\n\t\t}\n\t}));\n\treturn memo[cacheKey];\n}\n/**\n* Creates a proxy that calls the callback with the path and arguments\n*\n* @internal\n*/\nconst createRecursiveProxy = (callback) => createInnerProxy(callback, [], emptyObject());\n/**\n* Used in place of `new Proxy` where each handler will map 1 level deep to another value.\n*\n* @internal\n*/\nconst createFlatProxy = (callback) => {\n\treturn new Proxy(noop, { get(_obj, name) {\n\t\tif (name === \"then\") return void 0;\n\t\treturn callback(name);\n\t} });\n};\n\n//#endregion\n//#region src/unstable-core-do-not-import/http/getHTTPStatusCode.ts\nconst JSONRPC2_TO_HTTP_CODE = {\n\tPARSE_ERROR: 400,\n\tBAD_REQUEST: 400,\n\tUNAUTHORIZED: 401,\n\tPAYMENT_REQUIRED: 402,\n\tFORBIDDEN: 403,\n\tNOT_FOUND: 404,\n\tMETHOD_NOT_SUPPORTED: 405,\n\tTIMEOUT: 408,\n\tCONFLICT: 409,\n\tPRECONDITION_FAILED: 412,\n\tPAYLOAD_TOO_LARGE: 413,\n\tUNSUPPORTED_MEDIA_TYPE: 415,\n\tUNPROCESSABLE_CONTENT: 422,\n\tPRECONDITION_REQUIRED: 428,\n\tTOO_MANY_REQUESTS: 429,\n\tCLIENT_CLOSED_REQUEST: 499,\n\tINTERNAL_SERVER_ERROR: 500,\n\tNOT_IMPLEMENTED: 501,\n\tBAD_GATEWAY: 502,\n\tSERVICE_UNAVAILABLE: 503,\n\tGATEWAY_TIMEOUT: 504\n};\nconst HTTP_CODE_TO_JSONRPC2 = {\n\t400: \"BAD_REQUEST\",\n\t401: \"UNAUTHORIZED\",\n\t402: \"PAYMENT_REQUIRED\",\n\t403: \"FORBIDDEN\",\n\t404: \"NOT_FOUND\",\n\t405: \"METHOD_NOT_SUPPORTED\",\n\t408: \"TIMEOUT\",\n\t409: \"CONFLICT\",\n\t412: \"PRECONDITION_FAILED\",\n\t413: \"PAYLOAD_TOO_LARGE\",\n\t415: \"UNSUPPORTED_MEDIA_TYPE\",\n\t422: \"UNPROCESSABLE_CONTENT\",\n\t428: \"PRECONDITION_REQUIRED\",\n\t429: \"TOO_MANY_REQUESTS\",\n\t499: \"CLIENT_CLOSED_REQUEST\",\n\t500: \"INTERNAL_SERVER_ERROR\",\n\t501: \"NOT_IMPLEMENTED\",\n\t502: \"BAD_GATEWAY\",\n\t503: \"SERVICE_UNAVAILABLE\",\n\t504: \"GATEWAY_TIMEOUT\"\n};\nfunction getStatusCodeFromKey(code) {\n\tvar _JSONRPC2_TO_HTTP_COD;\n\treturn (_JSONRPC2_TO_HTTP_COD = JSONRPC2_TO_HTTP_CODE[code]) !== null && _JSONRPC2_TO_HTTP_COD !== void 0 ? _JSONRPC2_TO_HTTP_COD : 500;\n}\nfunction getStatusKeyFromCode(code) {\n\tvar _HTTP_CODE_TO_JSONRPC;\n\treturn (_HTTP_CODE_TO_JSONRPC = HTTP_CODE_TO_JSONRPC2[code]) !== null && _HTTP_CODE_TO_JSONRPC !== void 0 ? _HTTP_CODE_TO_JSONRPC : \"INTERNAL_SERVER_ERROR\";\n}\nfunction getHTTPStatusCode(json) {\n\tconst arr = Array.isArray(json) ? json : [json];\n\tconst httpStatuses = new Set(arr.map((res) => {\n\t\tif (\"error\" in res && isObject(res.error.data)) {\n\t\t\tvar _res$error$data;\n\t\t\tif (typeof ((_res$error$data = res.error.data) === null || _res$error$data === void 0 ? void 0 : _res$error$data[\"httpStatus\"]) === \"number\") return res.error.data[\"httpStatus\"];\n\t\t\tconst code = TRPC_ERROR_CODES_BY_NUMBER[res.error.code];\n\t\t\treturn getStatusCodeFromKey(code);\n\t\t}\n\t\treturn 200;\n\t}));\n\tif (httpStatuses.size !== 1) return 207;\n\tconst httpStatus = httpStatuses.values().next().value;\n\treturn httpStatus;\n}\nfunction getHTTPStatusCodeFromError(error) {\n\treturn getStatusCodeFromKey(error.code);\n}\n\n//#endregion\n//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js\nvar require_typeof = __commonJS({ \"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js\"(exports, module) {\n\tfunction _typeof$2(o) {\n\t\t\"@babel/helpers - typeof\";\n\t\treturn module.exports = _typeof$2 = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(o$1) {\n\t\t\treturn typeof o$1;\n\t\t} : function(o$1) {\n\t\t\treturn o$1 && \"function\" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? \"symbol\" : typeof o$1;\n\t\t}, module.exports.__esModule = true, module.exports[\"default\"] = module.exports, _typeof$2(o);\n\t}\n\tmodule.exports = _typeof$2, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n} });\n\n//#endregion\n//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js\nvar require_toPrimitive = __commonJS({ \"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js\"(exports, module) {\n\tvar _typeof$1 = require_typeof()[\"default\"];\n\tfunction toPrimitive$1(t, r) {\n\t\tif (\"object\" != _typeof$1(t) || !t) return t;\n\t\tvar e = t[Symbol.toPrimitive];\n\t\tif (void 0 !== e) {\n\t\t\tvar i = e.call(t, r || \"default\");\n\t\t\tif (\"object\" != _typeof$1(i)) return i;\n\t\t\tthrow new TypeError(\"@@toPrimitive must return a primitive value.\");\n\t\t}\n\t\treturn (\"string\" === r ? String : Number)(t);\n\t}\n\tmodule.exports = toPrimitive$1, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n} });\n\n//#endregion\n//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js\nvar require_toPropertyKey = __commonJS({ \"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js\"(exports, module) {\n\tvar _typeof = require_typeof()[\"default\"];\n\tvar toPrimitive = require_toPrimitive();\n\tfunction toPropertyKey$1(t) {\n\t\tvar i = toPrimitive(t, \"string\");\n\t\treturn \"symbol\" == _typeof(i) ? i : i + \"\";\n\t}\n\tmodule.exports = toPropertyKey$1, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n} });\n\n//#endregion\n//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js\nvar require_defineProperty = __commonJS({ \"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js\"(exports, module) {\n\tvar toPropertyKey = require_toPropertyKey();\n\tfunction _defineProperty(e, r, t) {\n\t\treturn (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n\t\t\tvalue: t,\n\t\t\tenumerable: !0,\n\t\t\tconfigurable: !0,\n\t\t\twritable: !0\n\t\t}) : e[r] = t, e;\n\t}\n\tmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n} });\n\n//#endregion\n//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js\nvar require_objectSpread2 = __commonJS({ \"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js\"(exports, module) {\n\tvar defineProperty = require_defineProperty();\n\tfunction ownKeys(e, r) {\n\t\tvar t = Object.keys(e);\n\t\tif (Object.getOwnPropertySymbols) {\n\t\t\tvar o = Object.getOwnPropertySymbols(e);\n\t\t\tr && (o = o.filter(function(r$1) {\n\t\t\t\treturn Object.getOwnPropertyDescriptor(e, r$1).enumerable;\n\t\t\t})), t.push.apply(t, o);\n\t\t}\n\t\treturn t;\n\t}\n\tfunction _objectSpread2(e) {\n\t\tfor (var r = 1; r < arguments.length; r++) {\n\t\t\tvar t = null != arguments[r] ? arguments[r] : {};\n\t\t\tr % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {\n\t\t\t\tdefineProperty(e, r$1, t[r$1]);\n\t\t\t}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {\n\t\t\t\tObject.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));\n\t\t\t});\n\t\t}\n\t\treturn e;\n\t}\n\tmodule.exports = _objectSpread2, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n} });\n\n//#endregion\n//#region src/unstable-core-do-not-import/error/getErrorShape.ts\nvar import_objectSpread2 = __toESM(require_objectSpread2(), 1);\n/**\n* @internal\n*/\nfunction getErrorShape(opts) {\n\tconst { path, error, config } = opts;\n\tconst { code } = opts.error;\n\tconst shape = {\n\t\tmessage: error.message,\n\t\tcode: TRPC_ERROR_CODES_BY_KEY[code],\n\t\tdata: {\n\t\t\tcode,\n\t\t\thttpStatus: getHTTPStatusCodeFromError(error)\n\t\t}\n\t};\n\tif (config.isDev && typeof opts.error.stack === \"string\") shape.data.stack = opts.error.stack;\n\tif (typeof path === \"string\") shape.data.path = path;\n\treturn config.errorFormatter((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, { shape }));\n}\n\n//#endregion\nexport { HTTP_CODE_TO_JSONRPC2, JSONRPC2_TO_HTTP_CODE, __commonJS, __toESM, createFlatProxy, createRecursiveProxy, getErrorShape, getHTTPStatusCode, getHTTPStatusCodeFromError, getStatusCodeFromKey, getStatusKeyFromCode, require_defineProperty, require_objectSpread2 };\n//# sourceMappingURL=getErrorShape-vC8mUXJD.mjs.map","import { __toESM, createRecursiveProxy, require_defineProperty, require_objectSpread2 } from \"./getErrorShape-vC8mUXJD.mjs\";\nimport { emptyObject, isFunction, isObject, mergeWithoutOverrides } from \"./codes-DagpWZLc.mjs\";\n\n//#region src/unstable-core-do-not-import/error/formatter.ts\nconst defaultFormatter = ({ shape }) => {\n\treturn shape;\n};\n\n//#endregion\n//#region src/unstable-core-do-not-import/error/TRPCError.ts\nvar import_defineProperty = __toESM(require_defineProperty(), 1);\nvar UnknownCauseError = class extends Error {};\nfunction getCauseFromUnknown(cause) {\n\tif (cause instanceof Error) return cause;\n\tconst type = typeof cause;\n\tif (type === \"undefined\" || type === \"function\" || cause === null) return void 0;\n\tif (type !== \"object\") return new Error(String(cause));\n\tif (isObject(cause)) return Object.assign(new UnknownCauseError(), cause);\n\treturn void 0;\n}\nfunction getTRPCErrorFromUnknown(cause) {\n\tif (cause instanceof TRPCError) return cause;\n\tif (cause instanceof Error && cause.name === \"TRPCError\") return cause;\n\tconst trpcError = new TRPCError({\n\t\tcode: \"INTERNAL_SERVER_ERROR\",\n\t\tcause\n\t});\n\tif (cause instanceof Error && cause.stack) trpcError.stack = cause.stack;\n\treturn trpcError;\n}\nvar TRPCError = class extends Error {\n\tconstructor(opts) {\n\t\tvar _ref, _opts$message, _this$cause;\n\t\tconst cause = getCauseFromUnknown(opts.cause);\n\t\tconst message = (_ref = (_opts$message = opts.message) !== null && _opts$message !== void 0 ? _opts$message : cause === null || cause === void 0 ? void 0 : cause.message) !== null && _ref !== void 0 ? _ref : opts.code;\n\t\tsuper(message, { cause });\n\t\t(0, import_defineProperty.default)(this, \"cause\", void 0);\n\t\t(0, import_defineProperty.default)(this, \"code\", void 0);\n\t\tthis.code = opts.code;\n\t\tthis.name = \"TRPCError\";\n\t\t(_this$cause = this.cause) !== null && _this$cause !== void 0 || (this.cause = cause);\n\t}\n};\n\n//#endregion\n//#region src/unstable-core-do-not-import/transformer.ts\nvar import_objectSpread2$1 = __toESM(require_objectSpread2(), 1);\n/**\n* @internal\n*/\nfunction getDataTransformer(transformer) {\n\tif (\"input\" in transformer) return transformer;\n\treturn {\n\t\tinput: transformer,\n\t\toutput: transformer\n\t};\n}\n/**\n* @internal\n*/\nconst defaultTransformer = {\n\tinput: {\n\t\tserialize: (obj) => obj,\n\t\tdeserialize: (obj) => obj\n\t},\n\toutput: {\n\t\tserialize: (obj) => obj,\n\t\tdeserialize: (obj) => obj\n\t}\n};\nfunction transformTRPCResponseItem(config, item) {\n\tif (\"error\" in item) return (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, item), {}, { error: config.transformer.output.serialize(item.error) });\n\tif (\"data\" in item.result) return (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, item), {}, { result: (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, item.result), {}, { data: config.transformer.output.serialize(item.result.data) }) });\n\treturn item;\n}\n/**\n* Takes a unserialized `TRPCResponse` and serializes it with the router's transformers\n**/\nfunction transformTRPCResponse(config, itemOrItems) {\n\treturn Array.isArray(itemOrItems) ? itemOrItems.map((item) => transformTRPCResponseItem(config, item)) : transformTRPCResponseItem(config, itemOrItems);\n}\n/** @internal */\nfunction transformResultInner(response, transformer) {\n\tif (\"error\" in response) {\n\t\tconst error = transformer.deserialize(response.error);\n\t\treturn {\n\t\t\tok: false,\n\t\t\terror: (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, response), {}, { error })\n\t\t};\n\t}\n\tconst result = (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, response.result), (!response.result.type || response.result.type === \"data\") && {\n\t\ttype: \"data\",\n\t\tdata: transformer.deserialize(response.result.data)\n\t});\n\treturn {\n\t\tok: true,\n\t\tresult\n\t};\n}\nvar TransformResultError = class extends Error {\n\tconstructor() {\n\t\tsuper(\"Unable to transform response from server\");\n\t}\n};\n/**\n* Transforms and validates that the result is a valid TRPCResponse\n* @internal\n*/\nfunction transformResult(response, transformer) {\n\tlet result;\n\ttry {\n\t\tresult = transformResultInner(response, transformer);\n\t} catch (_unused) {\n\t\tthrow new TransformResultError();\n\t}\n\tif (!result.ok && (!isObject(result.error.error) || typeof result.error.error[\"code\"] !== \"number\")) throw new TransformResultError();\n\tif (result.ok && !isObject(result.result)) throw new TransformResultError();\n\treturn result;\n}\n\n//#endregion\n//#region src/unstable-core-do-not-import/router.ts\nvar import_objectSpread2 = __toESM(require_objectSpread2(), 1);\n/**\n* @internal\n*/\nconst lazyMarker = \"lazyMarker\";\nfunction once(fn) {\n\tconst uncalled = Symbol();\n\tlet result = uncalled;\n\treturn () => {\n\t\tif (result === uncalled) result = fn();\n\t\treturn result;\n\t};\n}\n/**\n* Lazy load a router\n* @see https://trpc.io/docs/server/merging-routers#lazy-load\n*/\nfunction lazy(importRouter) {\n\tasync function resolve() {\n\t\tconst mod = await importRouter();\n\t\tif (isRouter(mod)) return mod;\n\t\tconst routers = Object.values(mod);\n\t\tif (routers.length !== 1 || !isRouter(routers[0])) throw new Error(\"Invalid router module - either define exactly 1 export or return the router directly.\\nExample: `lazy(() => import('./slow.js').then((m) => m.slowRouter))`\");\n\t\treturn routers[0];\n\t}\n\tresolve[lazyMarker] = true;\n\treturn resolve;\n}\nfunction isLazy(input) {\n\treturn typeof input === \"function\" && lazyMarker in input;\n}\nfunction isRouter(value) {\n\treturn isObject(value) && isObject(value[\"_def\"]) && \"router\" in value[\"_def\"];\n}\nconst emptyRouter = {\n\t_ctx: null,\n\t_errorShape: null,\n\t_meta: null,\n\tqueries: {},\n\tmutations: {},\n\tsubscriptions: {},\n\terrorFormatter: defaultFormatter,\n\ttransformer: defaultTransformer\n};\n/**\n* Reserved words that can't be used as router or procedure names\n*/\nconst reservedWords = [\n\t\"then\",\n\t\"call\",\n\t\"apply\"\n];\n/**\n* @internal\n*/\nfunction createRouterFactory(config) {\n\tfunction createRouterInner(input) {\n\t\tconst reservedWordsUsed = new Set(Object.keys(input).filter((v) => reservedWords.includes(v)));\n\t\tif (reservedWordsUsed.size > 0) throw new Error(\"Reserved words used in `router({})` call: \" + Array.from(reservedWordsUsed).join(\", \"));\n\t\tconst procedures = emptyObject();\n\t\tconst lazy$1 = emptyObject();\n\t\tfunction createLazyLoader(opts) {\n\t\t\treturn {\n\t\t\t\tref: opts.ref,\n\t\t\t\tload: once(async () => {\n\t\t\t\t\tconst router$1 = await opts.ref();\n\t\t\t\t\tconst lazyPath = [...opts.path, opts.key];\n\t\t\t\t\tconst lazyKey = lazyPath.join(\".\");\n\t\t\t\t\topts.aggregate[opts.key] = step(router$1._def.record, lazyPath);\n\t\t\t\t\tdelete lazy$1[lazyKey];\n\t\t\t\t\tfor (const [nestedKey, nestedItem] of Object.entries(router$1._def.lazy)) {\n\t\t\t\t\t\tconst nestedRouterKey = [...lazyPath, nestedKey].join(\".\");\n\t\t\t\t\t\tlazy$1[nestedRouterKey] = createLazyLoader({\n\t\t\t\t\t\t\tref: nestedItem.ref,\n\t\t\t\t\t\t\tpath: lazyPath,\n\t\t\t\t\t\t\tkey: nestedKey,\n\t\t\t\t\t\t\taggregate: opts.aggregate[opts.key]\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t};\n\t\t}\n\t\tfunction step(from, path = []) {\n\t\t\tconst aggregate = emptyObject();\n\t\t\tfor (const [key, item] of Object.entries(from !== null && from !== void 0 ? from : {})) {\n\t\t\t\tif (isLazy(item)) {\n\t\t\t\t\tlazy$1[[...path, key].join(\".\")] = createLazyLoader({\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\tref: item,\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\taggregate\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (isRouter(item)) {\n\t\t\t\t\taggregate[key] = step(item._def.record, [...path, key]);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (!isProcedure(item)) {\n\t\t\t\t\taggregate[key] = step(item, [...path, key]);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst newPath = [...path, key].join(\".\");\n\t\t\t\tif (procedures[newPath]) throw new Error(`Duplicate key: ${newPath}`);\n\t\t\t\tprocedures[newPath] = item;\n\t\t\t\taggregate[key] = item;\n\t\t\t}\n\t\t\treturn aggregate;\n\t\t}\n\t\tconst record = step(input);\n\t\tconst _def = (0, import_objectSpread2.default)((0, import_objectSpread2.default)({\n\t\t\t_config: config,\n\t\t\trouter: true,\n\t\t\tprocedures,\n\t\t\tlazy: lazy$1\n\t\t}, emptyRouter), {}, { record });\n\t\tconst router = (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, record), {}, {\n\t\t\t_def,\n\t\t\tcreateCaller: createCallerFactory()({ _def })\n\t\t});\n\t\treturn router;\n\t}\n\treturn createRouterInner;\n}\nfunction isProcedure(procedureOrRouter) {\n\treturn typeof procedureOrRouter === \"function\";\n}\n/**\n* @internal\n*/\nasync function getProcedureAtPath(router, path) {\n\tconst { _def } = router;\n\tlet procedure = _def.procedures[path];\n\twhile (!procedure) {\n\t\tconst key = Object.keys(_def.lazy).find((key$1) => path.startsWith(key$1));\n\t\tif (!key) return null;\n\t\tconst lazyRouter = _def.lazy[key];\n\t\tawait lazyRouter.load();\n\t\tprocedure = _def.procedures[path];\n\t}\n\treturn procedure;\n}\n/**\n* @internal\n*/\nasync function callProcedure(opts) {\n\tconst { type, path } = opts;\n\tconst proc = await getProcedureAtPath(opts.router, path);\n\tif (!proc || !isProcedure(proc) || proc._def.type !== type && !opts.allowMethodOverride) throw new TRPCError({\n\t\tcode: \"NOT_FOUND\",\n\t\tmessage: `No \"${type}\"-procedure on path \"${path}\"`\n\t});\n\t/* istanbul ignore if -- @preserve */\n\tif (proc._def.type !== type && opts.allowMethodOverride && proc._def.type === \"subscription\") throw new TRPCError({\n\t\tcode: \"METHOD_NOT_SUPPORTED\",\n\t\tmessage: `Method override is not supported for subscriptions`\n\t});\n\treturn proc(opts);\n}\nfunction createCallerFactory() {\n\treturn function createCallerInner(router) {\n\t\tconst { _def } = router;\n\t\treturn function createCaller(ctxOrCallback, opts) {\n\t\t\treturn createRecursiveProxy(async (innerOpts) => {\n\t\t\t\tconst { path, args } = innerOpts;\n\t\t\t\tconst fullPath = path.join(\".\");\n\t\t\t\tif (path.length === 1 && path[0] === \"_def\") return _def;\n\t\t\t\tconst procedure = await getProcedureAtPath(router, fullPath);\n\t\t\t\tlet ctx = void 0;\n\t\t\t\ttry {\n\t\t\t\t\tif (!procedure) throw new TRPCError({\n\t\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\t\tmessage: `No procedure found on path \"${path}\"`\n\t\t\t\t\t});\n\t\t\t\t\tctx = isFunction(ctxOrCallback) ? await Promise.resolve(ctxOrCallback()) : ctxOrCallback;\n\t\t\t\t\treturn await procedure({\n\t\t\t\t\t\tpath: fullPath,\n\t\t\t\t\t\tgetRawInput: async () => args[0],\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\ttype: procedure._def.type,\n\t\t\t\t\t\tsignal: opts === null || opts === void 0 ? void 0 : opts.signal,\n\t\t\t\t\t\tbatchIndex: 0\n\t\t\t\t\t});\n\t\t\t\t} catch (cause) {\n\t\t\t\t\tvar _opts$onError, _procedure$_def$type;\n\t\t\t\t\topts === null || opts === void 0 || (_opts$onError = opts.onError) === null || _opts$onError === void 0 || _opts$onError.call(opts, {\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\terror: getTRPCErrorFromUnknown(cause),\n\t\t\t\t\t\tinput: args[0],\n\t\t\t\t\t\tpath: fullPath,\n\t\t\t\t\t\ttype: (_procedure$_def$type = procedure === null || procedure === void 0 ? void 0 : procedure._def.type) !== null && _procedure$_def$type !== void 0 ? _procedure$_def$type : \"unknown\"\n\t\t\t\t\t});\n\t\t\t\t\tthrow cause;\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\t};\n}\nfunction mergeRouters(...routerList) {\n\tvar _routerList$, _routerList$2;\n\tconst record = mergeWithoutOverrides({}, ...routerList.map((r) => r._def.record));\n\tconst errorFormatter = routerList.reduce((currentErrorFormatter, nextRouter) => {\n\t\tif (nextRouter._def._config.errorFormatter && nextRouter._def._config.errorFormatter !== defaultFormatter) {\n\t\t\tif (currentErrorFormatter !== defaultFormatter && currentErrorFormatter !== nextRouter._def._config.errorFormatter) throw new Error(\"You seem to have several error formatters\");\n\t\t\treturn nextRouter._def._config.errorFormatter;\n\t\t}\n\t\treturn currentErrorFormatter;\n\t}, defaultFormatter);\n\tconst transformer = routerList.reduce((prev, current) => {\n\t\tif (current._def._config.transformer && current._def._config.transformer !== defaultTransformer) {\n\t\t\tif (prev !== defaultTransformer && prev !== current._def._config.transformer) throw new Error(\"You seem to have several transformers\");\n\t\t\treturn current._def._config.transformer;\n\t\t}\n\t\treturn prev;\n\t}, defaultTransformer);\n\tconst router = createRouterFactory({\n\t\terrorFormatter,\n\t\ttransformer,\n\t\tisDev: routerList.every((r) => r._def._config.isDev),\n\t\tallowOutsideOfServer: routerList.every((r) => r._def._config.allowOutsideOfServer),\n\t\tisServer: routerList.every((r) => r._def._config.isServer),\n\t\t$types: (_routerList$ = routerList[0]) === null || _routerList$ === void 0 ? void 0 : _routerList$._def._config.$types,\n\t\tsse: (_routerList$2 = routerList[0]) === null || _routerList$2 === void 0 ? void 0 : _routerList$2._def._config.sse\n\t})(record);\n\treturn router;\n}\n\n//#endregion\n//#region src/unstable-core-do-not-import/stream/tracked.ts\nconst trackedSymbol = Symbol();\n/**\n* Produce a typed server-sent event message\n* @deprecated use `tracked(id, data)` instead\n*/\nfunction sse(event) {\n\treturn tracked(event.id, event.data);\n}\nfunction isTrackedEnvelope(value) {\n\treturn Array.isArray(value) && value[2] === trackedSymbol;\n}\n/**\n* Automatically track an event so that it can be resumed from a given id if the connection is lost\n*/\nfunction tracked(id, data) {\n\tif (id === \"\") throw new Error(\"`id` must not be an empty string as empty string is the same as not setting the id at all\");\n\treturn [\n\t\tid,\n\t\tdata,\n\t\ttrackedSymbol\n\t];\n}\n\n//#endregion\nexport { TRPCError, callProcedure, createCallerFactory, createRouterFactory, defaultFormatter, defaultTransformer, getCauseFromUnknown, getDataTransformer, getProcedureAtPath, getTRPCErrorFromUnknown, isTrackedEnvelope, lazy, mergeRouters, sse, tracked, transformResult, transformTRPCResponse };\n//# sourceMappingURL=tracked-Bjtgv3wJ.mjs.map","import { __toESM, require_defineProperty, require_objectSpread2 } from \"./objectSpread2-BvkFp-_Y.mjs\";\nimport { isObject } from \"@trpc/server/unstable-core-do-not-import\";\n\n//#region src/TRPCClientError.ts\nvar import_defineProperty = __toESM(require_defineProperty(), 1);\nvar import_objectSpread2 = __toESM(require_objectSpread2(), 1);\nfunction isTRPCClientError(cause) {\n\treturn cause instanceof TRPCClientError;\n}\nfunction isTRPCErrorResponse(obj) {\n\treturn isObject(obj) && isObject(obj[\"error\"]) && typeof obj[\"error\"][\"code\"] === \"number\" && typeof obj[\"error\"][\"message\"] === \"string\";\n}\nfunction getMessageFromUnknownError(err, fallback) {\n\tif (typeof err === \"string\") return err;\n\tif (isObject(err) && typeof err[\"message\"] === \"string\") return err[\"message\"];\n\treturn fallback;\n}\nvar TRPCClientError = class TRPCClientError extends Error {\n\tconstructor(message, opts) {\n\t\tvar _opts$result, _opts$result2;\n\t\tconst cause = opts === null || opts === void 0 ? void 0 : opts.cause;\n\t\tsuper(message, { cause });\n\t\t(0, import_defineProperty.default)(this, \"cause\", void 0);\n\t\t(0, import_defineProperty.default)(this, \"shape\", void 0);\n\t\t(0, import_defineProperty.default)(this, \"data\", void 0);\n\t\t(0, import_defineProperty.default)(this, \"meta\", void 0);\n\t\tthis.meta = opts === null || opts === void 0 ? void 0 : opts.meta;\n\t\tthis.cause = cause;\n\t\tthis.shape = opts === null || opts === void 0 || (_opts$result = opts.result) === null || _opts$result === void 0 ? void 0 : _opts$result.error;\n\t\tthis.data = opts === null || opts === void 0 || (_opts$result2 = opts.result) === null || _opts$result2 === void 0 ? void 0 : _opts$result2.error.data;\n\t\tthis.name = \"TRPCClientError\";\n\t\tObject.setPrototypeOf(this, TRPCClientError.prototype);\n\t}\n\tstatic from(_cause, opts = {}) {\n\t\tconst cause = _cause;\n\t\tif (isTRPCClientError(cause)) {\n\t\t\tif (opts.meta) cause.meta = (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, cause.meta), opts.meta);\n\t\t\treturn cause;\n\t\t}\n\t\tif (isTRPCErrorResponse(cause)) return new TRPCClientError(cause.error.message, (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, {\n\t\t\tresult: cause,\n\t\t\tcause: opts.cause\n\t\t}));\n\t\treturn new TRPCClientError(getMessageFromUnknownError(cause, \"Unknown error\"), (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, { cause }));\n\t}\n};\n\n//#endregion\nexport { TRPCClientError, isTRPCClientError };\n//# sourceMappingURL=TRPCClientError-apv8gw59.mjs.map","//#region src/internals/transformer.ts\n/**\n* @internal\n*/\n/**\n* @internal\n*/\nfunction getTransformer(transformer) {\n\tconst _transformer = transformer;\n\tif (!_transformer) return {\n\t\tinput: {\n\t\t\tserialize: (data) => data,\n\t\t\tdeserialize: (data) => data\n\t\t},\n\t\toutput: {\n\t\t\tserialize: (data) => data,\n\t\t\tdeserialize: (data) => data\n\t\t}\n\t};\n\tif (\"input\" in _transformer) return _transformer;\n\treturn {\n\t\tinput: _transformer,\n\t\toutput: _transformer\n\t};\n}\n\n//#endregion\nexport { getTransformer };\n//# sourceMappingURL=unstable-internals-Bg7n9BBj.mjs.map","import { __toESM, require_objectSpread2 } from \"./objectSpread2-BvkFp-_Y.mjs\";\nimport { getTransformer } from \"./unstable-internals-Bg7n9BBj.mjs\";\n\n//#region src/getFetch.ts\nconst isFunction = (fn) => typeof fn === \"function\";\nfunction getFetch(customFetchImpl) {\n\tif (customFetchImpl) return customFetchImpl;\n\tif (typeof window !== \"undefined\" && isFunction(window.fetch)) return window.fetch;\n\tif (typeof globalThis !== \"undefined\" && isFunction(globalThis.fetch)) return globalThis.fetch;\n\tthrow new Error(\"No fetch implementation found\");\n}\n\n//#endregion\n//#region src/links/internals/httpUtils.ts\nvar import_objectSpread2 = __toESM(require_objectSpread2(), 1);\nfunction resolveHTTPLinkOptions(opts) {\n\treturn {\n\t\turl: opts.url.toString(),\n\t\tfetch: opts.fetch,\n\t\ttransformer: getTransformer(opts.transformer),\n\t\tmethodOverride: opts.methodOverride\n\t};\n}\nfunction arrayToDict(array) {\n\tconst dict = {};\n\tfor (let index = 0; index < array.length; index++) {\n\t\tconst element = array[index];\n\t\tdict[index] = element;\n\t}\n\treturn dict;\n}\nconst METHOD = {\n\tquery: \"GET\",\n\tmutation: \"POST\",\n\tsubscription: \"PATCH\"\n};\nfunction getInput(opts) {\n\treturn \"input\" in opts ? opts.transformer.input.serialize(opts.input) : arrayToDict(opts.inputs.map((_input) => opts.transformer.input.serialize(_input)));\n}\nconst getUrl = (opts) => {\n\tconst parts = opts.url.split(\"?\");\n\tconst base = parts[0].replace(/\\/$/, \"\");\n\tlet url = base + \"/\" + opts.path;\n\tconst queryParts = [];\n\tif (parts[1]) queryParts.push(parts[1]);\n\tif (\"inputs\" in opts) queryParts.push(\"batch=1\");\n\tif (opts.type === \"query\" || opts.type === \"subscription\") {\n\t\tconst input = getInput(opts);\n\t\tif (input !== void 0 && opts.methodOverride !== \"POST\") queryParts.push(`input=${encodeURIComponent(JSON.stringify(input))}`);\n\t}\n\tif (queryParts.length) url += \"?\" + queryParts.join(\"&\");\n\treturn url;\n};\nconst getBody = (opts) => {\n\tif (opts.type === \"query\" && opts.methodOverride !== \"POST\") return void 0;\n\tconst input = getInput(opts);\n\treturn input !== void 0 ? JSON.stringify(input) : void 0;\n};\nconst jsonHttpRequester = (opts) => {\n\treturn httpRequest((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, {\n\t\tcontentTypeHeader: \"application/json\",\n\t\tgetUrl,\n\t\tgetBody\n\t}));\n};\n/**\n* Polyfill for DOMException with AbortError name\n*/\nvar AbortError = class extends Error {\n\tconstructor() {\n\t\tconst name = \"AbortError\";\n\t\tsuper(name);\n\t\tthis.name = name;\n\t\tthis.message = name;\n\t}\n};\n/**\n* Polyfill for `signal.throwIfAborted()`\n*\n* @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/throwIfAborted\n*/\nconst throwIfAborted = (signal) => {\n\tvar _signal$throwIfAborte;\n\tif (!(signal === null || signal === void 0 ? void 0 : signal.aborted)) return;\n\t(_signal$throwIfAborte = signal.throwIfAborted) === null || _signal$throwIfAborte === void 0 || _signal$throwIfAborte.call(signal);\n\tif (typeof DOMException !== \"undefined\") throw new DOMException(\"AbortError\", \"AbortError\");\n\tthrow new AbortError();\n};\nasync function fetchHTTPResponse(opts) {\n\tvar _opts$methodOverride;\n\tthrowIfAborted(opts.signal);\n\tconst url = opts.getUrl(opts);\n\tconst body = opts.getBody(opts);\n\tconst method = (_opts$methodOverride = opts.methodOverride) !== null && _opts$methodOverride !== void 0 ? _opts$methodOverride : METHOD[opts.type];\n\tconst resolvedHeaders = await (async () => {\n\t\tconst heads = await opts.headers();\n\t\tif (Symbol.iterator in heads) return Object.fromEntries(heads);\n\t\treturn heads;\n\t})();\n\tconst headers = (0, import_objectSpread2.default)((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts.contentTypeHeader && method !== \"GET\" ? { \"content-type\": opts.contentTypeHeader } : {}), opts.trpcAcceptHeader ? { \"trpc-accept\": opts.trpcAcceptHeader } : void 0), resolvedHeaders);\n\treturn getFetch(opts.fetch)(url, {\n\t\tmethod,\n\t\tsignal: opts.signal,\n\t\tbody,\n\t\theaders\n\t});\n}\nasync function httpRequest(opts) {\n\tconst meta = {};\n\tconst res = await fetchHTTPResponse(opts);\n\tmeta.response = res;\n\tconst json = await res.json();\n\tmeta.responseJSON = json;\n\treturn {\n\t\tjson,\n\t\tmeta\n\t};\n}\n\n//#endregion\nexport { fetchHTTPResponse, getBody, getFetch, getUrl, httpRequest, jsonHttpRequester, resolveHTTPLinkOptions };\n//# sourceMappingURL=httpUtils-Dv57hbOd.mjs.map","import { __toESM, require_objectSpread2 } from \"./objectSpread2-BvkFp-_Y.mjs\";\nimport { TRPCClientError } from \"./TRPCClientError-apv8gw59.mjs\";\nimport { getUrl, httpRequest, jsonHttpRequester, resolveHTTPLinkOptions } from \"./httpUtils-Dv57hbOd.mjs\";\nimport { observable } from \"@trpc/server/observable\";\nimport { transformResult } from \"@trpc/server/unstable-core-do-not-import\";\n\n//#region src/links/internals/contentTypes.ts\nfunction isOctetType(input) {\n\treturn input instanceof Uint8Array || input instanceof Blob;\n}\nfunction isFormData(input) {\n\treturn input instanceof FormData;\n}\nfunction isNonJsonSerializable(input) {\n\treturn isOctetType(input) || isFormData(input);\n}\n\n//#endregion\n//#region src/links/httpLink.ts\nvar import_objectSpread2 = __toESM(require_objectSpread2(), 1);\nconst universalRequester = (opts) => {\n\tif (\"input\" in opts) {\n\t\tconst { input } = opts;\n\t\tif (isFormData(input)) {\n\t\t\tif (opts.type !== \"mutation\" && opts.methodOverride !== \"POST\") throw new Error(\"FormData is only supported for mutations\");\n\t\t\treturn httpRequest((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, {\n\t\t\t\tcontentTypeHeader: void 0,\n\t\t\t\tgetUrl,\n\t\t\t\tgetBody: () => input\n\t\t\t}));\n\t\t}\n\t\tif (isOctetType(input)) {\n\t\t\tif (opts.type !== \"mutation\" && opts.methodOverride !== \"POST\") throw new Error(\"Octet type input is only supported for mutations\");\n\t\t\treturn httpRequest((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, {\n\t\t\t\tcontentTypeHeader: \"application/octet-stream\",\n\t\t\t\tgetUrl,\n\t\t\t\tgetBody: () => input\n\t\t\t}));\n\t\t}\n\t}\n\treturn jsonHttpRequester(opts);\n};\n/**\n* @see https://trpc.io/docs/client/links/httpLink\n*/\nfunction httpLink(opts) {\n\tconst resolvedOpts = resolveHTTPLinkOptions(opts);\n\treturn () => {\n\t\treturn (operationOpts) => {\n\t\t\tconst { op } = operationOpts;\n\t\t\treturn observable((observer) => {\n\t\t\t\tconst { path, input, type } = op;\n\t\t\t\t/* istanbul ignore if -- @preserve */\n\t\t\t\tif (type === \"subscription\") throw new Error(\"Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`\");\n\t\t\t\tconst request = universalRequester((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, resolvedOpts), {}, {\n\t\t\t\t\ttype,\n\t\t\t\t\tpath,\n\t\t\t\t\tinput,\n\t\t\t\t\tsignal: op.signal,\n\t\t\t\t\theaders() {\n\t\t\t\t\t\tif (!opts.headers) return {};\n\t\t\t\t\t\tif (typeof opts.headers === \"function\") return opts.headers({ op });\n\t\t\t\t\t\treturn opts.headers;\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t\tlet meta = void 0;\n\t\t\t\trequest.then((res) => {\n\t\t\t\t\tmeta = res.meta;\n\t\t\t\t\tconst transformed = transformResult(res.json, resolvedOpts.transformer.output);\n\t\t\t\t\tif (!transformed.ok) {\n\t\t\t\t\t\tobserver.error(TRPCClientError.from(transformed.error, { meta }));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tobserver.next({\n\t\t\t\t\t\tcontext: res.meta,\n\t\t\t\t\t\tresult: transformed.result\n\t\t\t\t\t});\n\t\t\t\t\tobserver.complete();\n\t\t\t\t}).catch((cause) => {\n\t\t\t\t\tobserver.error(TRPCClientError.from(cause, { meta }));\n\t\t\t\t});\n\t\t\t\treturn () => {};\n\t\t\t});\n\t\t};\n\t};\n}\n\n//#endregion\nexport { httpLink, isFormData, isNonJsonSerializable, isOctetType };\n//# sourceMappingURL=httpLink-Cz9h1Qgh.mjs.map","import { __toESM, require_objectSpread2 } from \"./objectSpread2-BvkFp-_Y.mjs\";\nimport { TRPCClientError } from \"./TRPCClientError-apv8gw59.mjs\";\nimport { getUrl, jsonHttpRequester, resolveHTTPLinkOptions } from \"./httpUtils-Dv57hbOd.mjs\";\nimport { observable } from \"@trpc/server/observable\";\nimport { transformResult } from \"@trpc/server/unstable-core-do-not-import\";\n\n//#region src/internals/dataLoader.ts\n/**\n* A function that should never be called unless we messed something up.\n*/\nconst throwFatalError = () => {\n\tthrow new Error(\"Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new\");\n};\n/**\n* Dataloader that's very inspired by https://github.com/graphql/dataloader\n* Less configuration, no caching, and allows you to cancel requests\n* When cancelling a single fetch the whole batch will be cancelled only when _all_ items are cancelled\n*/\nfunction dataLoader(batchLoader) {\n\tlet pendingItems = null;\n\tlet dispatchTimer = null;\n\tconst destroyTimerAndPendingItems = () => {\n\t\tclearTimeout(dispatchTimer);\n\t\tdispatchTimer = null;\n\t\tpendingItems = null;\n\t};\n\t/**\n\t* Iterate through the items and split them into groups based on the `batchLoader`'s validate function\n\t*/\n\tfunction groupItems(items) {\n\t\tconst groupedItems = [[]];\n\t\tlet index = 0;\n\t\twhile (true) {\n\t\t\tconst item = items[index];\n\t\t\tif (!item) break;\n\t\t\tconst lastGroup = groupedItems[groupedItems.length - 1];\n\t\t\tif (item.aborted) {\n\t\t\t\tvar _item$reject;\n\t\t\t\t(_item$reject = item.reject) === null || _item$reject === void 0 || _item$reject.call(item, new Error(\"Aborted\"));\n\t\t\t\tindex++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst isValid = batchLoader.validate(lastGroup.concat(item).map((it) => it.key));\n\t\t\tif (isValid) {\n\t\t\t\tlastGroup.push(item);\n\t\t\t\tindex++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (lastGroup.length === 0) {\n\t\t\t\tvar _item$reject2;\n\t\t\t\t(_item$reject2 = item.reject) === null || _item$reject2 === void 0 || _item$reject2.call(item, new Error(\"Input is too big for a single dispatch\"));\n\t\t\t\tindex++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tgroupedItems.push([]);\n\t\t}\n\t\treturn groupedItems;\n\t}\n\tfunction dispatch() {\n\t\tconst groupedItems = groupItems(pendingItems);\n\t\tdestroyTimerAndPendingItems();\n\t\tfor (const items of groupedItems) {\n\t\t\tif (!items.length) continue;\n\t\t\tconst batch = { items };\n\t\t\tfor (const item of items) item.batch = batch;\n\t\t\tconst promise = batchLoader.fetch(batch.items.map((_item) => _item.key));\n\t\t\tpromise.then(async (result) => {\n\t\t\t\tawait Promise.all(result.map(async (valueOrPromise, index) => {\n\t\t\t\t\tconst item = batch.items[index];\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar _item$resolve;\n\t\t\t\t\t\tconst value = await Promise.resolve(valueOrPromise);\n\t\t\t\t\t\t(_item$resolve = item.resolve) === null || _item$resolve === void 0 || _item$resolve.call(item, value);\n\t\t\t\t\t} catch (cause) {\n\t\t\t\t\t\tvar _item$reject3;\n\t\t\t\t\t\t(_item$reject3 = item.reject) === null || _item$reject3 === void 0 || _item$reject3.call(item, cause);\n\t\t\t\t\t}\n\t\t\t\t\titem.batch = null;\n\t\t\t\t\titem.reject = null;\n\t\t\t\t\titem.resolve = null;\n\t\t\t\t}));\n\t\t\t\tfor (const item of batch.items) {\n\t\t\t\t\tvar _item$reject4;\n\t\t\t\t\t(_item$reject4 = item.reject) === null || _item$reject4 === void 0 || _item$reject4.call(item, new Error(\"Missing result\"));\n\t\t\t\t\titem.batch = null;\n\t\t\t\t}\n\t\t\t}).catch((cause) => {\n\t\t\t\tfor (const item of batch.items) {\n\t\t\t\t\tvar _item$reject5;\n\t\t\t\t\t(_item$reject5 = item.reject) === null || _item$reject5 === void 0 || _item$reject5.call(item, cause);\n\t\t\t\t\titem.batch = null;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tfunction load(key) {\n\t\tvar _dispatchTimer;\n\t\tconst item = {\n\t\t\taborted: false,\n\t\t\tkey,\n\t\t\tbatch: null,\n\t\t\tresolve: throwFatalError,\n\t\t\treject: throwFatalError\n\t\t};\n\t\tconst promise = new Promise((resolve, reject) => {\n\t\t\tvar _pendingItems;\n\t\t\titem.reject = reject;\n\t\t\titem.resolve = resolve;\n\t\t\t(_pendingItems = pendingItems) !== null && _pendingItems !== void 0 || (pendingItems = []);\n\t\t\tpendingItems.push(item);\n\t\t});\n\t\t(_dispatchTimer = dispatchTimer) !== null && _dispatchTimer !== void 0 || (dispatchTimer = setTimeout(dispatch));\n\t\treturn promise;\n\t}\n\treturn { load };\n}\n\n//#endregion\n//#region src/internals/signals.ts\n/**\n* Like `Promise.all()` but for abort signals\n* - When all signals have been aborted, the merged signal will be aborted\n* - If one signal is `null`, no signal will be aborted\n*/\nfunction allAbortSignals(...signals) {\n\tconst ac = new AbortController();\n\tconst count = signals.length;\n\tlet abortedCount = 0;\n\tconst onAbort = () => {\n\t\tif (++abortedCount === count) ac.abort();\n\t};\n\tfor (const signal of signals) if (signal === null || signal === void 0 ? void 0 : signal.aborted) onAbort();\n\telse signal === null || signal === void 0 || signal.addEventListener(\"abort\", onAbort, { once: true });\n\treturn ac.signal;\n}\n/**\n* Like `Promise.race` but for abort signals\n*\n* Basically, a ponyfill for\n* [`AbortSignal.any`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/any_static).\n*/\nfunction raceAbortSignals(...signals) {\n\tconst ac = new AbortController();\n\tfor (const signal of signals) if (signal === null || signal === void 0 ? void 0 : signal.aborted) ac.abort();\n\telse signal === null || signal === void 0 || signal.addEventListener(\"abort\", () => ac.abort(), { once: true });\n\treturn ac.signal;\n}\nfunction abortSignalToPromise(signal) {\n\treturn new Promise((_, reject) => {\n\t\tif (signal.aborted) {\n\t\t\treject(signal.reason);\n\t\t\treturn;\n\t\t}\n\t\tsignal.addEventListener(\"abort\", () => {\n\t\t\treject(signal.reason);\n\t\t}, { once: true });\n\t});\n}\n\n//#endregion\n//#region src/links/httpBatchLink.ts\nvar import_objectSpread2 = __toESM(require_objectSpread2(), 1);\n/**\n* @see https://trpc.io/docs/client/links/httpBatchLink\n*/\nfunction httpBatchLink(opts) {\n\tvar _opts$maxURLLength, _opts$maxItems;\n\tconst resolvedOpts = resolveHTTPLinkOptions(opts);\n\tconst maxURLLength = (_opts$maxURLLength = opts.maxURLLength) !== null && _opts$maxURLLength !== void 0 ? _opts$maxURLLength : Infinity;\n\tconst maxItems = (_opts$maxItems = opts.maxItems) !== null && _opts$maxItems !== void 0 ? _opts$maxItems : Infinity;\n\treturn () => {\n\t\tconst batchLoader = (type) => {\n\t\t\treturn {\n\t\t\t\tvalidate(batchOps) {\n\t\t\t\t\tif (maxURLLength === Infinity && maxItems === Infinity) return true;\n\t\t\t\t\tif (batchOps.length > maxItems) return false;\n\t\t\t\t\tconst path = batchOps.map((op) => op.path).join(\",\");\n\t\t\t\t\tconst inputs = batchOps.map((op) => op.input);\n\t\t\t\t\tconst url = getUrl((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, resolvedOpts), {}, {\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\tinputs,\n\t\t\t\t\t\tsignal: null\n\t\t\t\t\t}));\n\t\t\t\t\treturn url.length <= maxURLLength;\n\t\t\t\t},\n\t\t\t\tasync fetch(batchOps) {\n\t\t\t\t\tconst path = batchOps.map((op) => op.path).join(\",\");\n\t\t\t\t\tconst inputs = batchOps.map((op) => op.input);\n\t\t\t\t\tconst signal = allAbortSignals(...batchOps.map((op) => op.signal));\n\t\t\t\t\tconst res = await jsonHttpRequester((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, resolvedOpts), {}, {\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\tinputs,\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\theaders() {\n\t\t\t\t\t\t\tif (!opts.headers) return {};\n\t\t\t\t\t\t\tif (typeof opts.headers === \"function\") return opts.headers({ opList: batchOps });\n\t\t\t\t\t\t\treturn opts.headers;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsignal\n\t\t\t\t\t}));\n\t\t\t\t\tconst resJSON = Array.isArray(res.json) ? res.json : batchOps.map(() => res.json);\n\t\t\t\t\tconst result = resJSON.map((item) => ({\n\t\t\t\t\t\tmeta: res.meta,\n\t\t\t\t\t\tjson: item\n\t\t\t\t\t}));\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\t\tconst query = dataLoader(batchLoader(\"query\"));\n\t\tconst mutation = dataLoader(batchLoader(\"mutation\"));\n\t\tconst loaders = {\n\t\t\tquery,\n\t\t\tmutation\n\t\t};\n\t\treturn ({ op }) => {\n\t\t\treturn observable((observer) => {\n\t\t\t\t/* istanbul ignore if -- @preserve */\n\t\t\t\tif (op.type === \"subscription\") throw new Error(\"Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`\");\n\t\t\t\tconst loader = loaders[op.type];\n\t\t\t\tconst promise = loader.load(op);\n\t\t\t\tlet _res = void 0;\n\t\t\t\tpromise.then((res) => {\n\t\t\t\t\t_res = res;\n\t\t\t\t\tconst transformed = transformResult(res.json, resolvedOpts.transformer.output);\n\t\t\t\t\tif (!transformed.ok) {\n\t\t\t\t\t\tobserver.error(TRPCClientError.from(transformed.error, { meta: res.meta }));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tobserver.next({\n\t\t\t\t\t\tcontext: res.meta,\n\t\t\t\t\t\tresult: transformed.result\n\t\t\t\t\t});\n\t\t\t\t\tobserver.complete();\n\t\t\t\t}).catch((err) => {\n\t\t\t\t\tobserver.error(TRPCClientError.from(err, { meta: _res === null || _res === void 0 ? void 0 : _res.meta }));\n\t\t\t\t});\n\t\t\t\treturn () => {};\n\t\t\t});\n\t\t};\n\t};\n}\n\n//#endregion\nexport { abortSignalToPromise, allAbortSignals, dataLoader, httpBatchLink, raceAbortSignals };\n//# sourceMappingURL=httpBatchLink-fQ1NAi-e.mjs.map","import { __toESM, require_objectSpread2 } from \"./objectSpread2-BvkFp-_Y.mjs\";\nimport { observable, tap } from \"@trpc/server/observable\";\n\n//#region src/links/loggerLink.ts\nvar import_objectSpread2 = __toESM(require_objectSpread2(), 1);\nfunction isFormData(value) {\n\tif (typeof FormData === \"undefined\") return false;\n\treturn value instanceof FormData;\n}\nconst palettes = {\n\tcss: {\n\t\tquery: [\"72e3ff\", \"3fb0d8\"],\n\t\tmutation: [\"c5a3fc\", \"904dfc\"],\n\t\tsubscription: [\"ff49e1\", \"d83fbe\"]\n\t},\n\tansi: {\n\t\tregular: {\n\t\t\tquery: [\"\\x1B[30;46m\", \"\\x1B[97;46m\"],\n\t\t\tmutation: [\"\\x1B[30;45m\", \"\\x1B[97;45m\"],\n\t\t\tsubscription: [\"\\x1B[30;42m\", \"\\x1B[97;42m\"]\n\t\t},\n\t\tbold: {\n\t\t\tquery: [\"\\x1B[1;30;46m\", \"\\x1B[1;97;46m\"],\n\t\t\tmutation: [\"\\x1B[1;30;45m\", \"\\x1B[1;97;45m\"],\n\t\t\tsubscription: [\"\\x1B[1;30;42m\", \"\\x1B[1;97;42m\"]\n\t\t}\n\t}\n};\nfunction constructPartsAndArgs(opts) {\n\tconst { direction, type, withContext, path, id, input } = opts;\n\tconst parts = [];\n\tconst args = [];\n\tif (opts.colorMode === \"none\") parts.push(direction === \"up\" ? \">>\" : \"<<\", type, `#${id}`, path);\n\telse if (opts.colorMode === \"ansi\") {\n\t\tconst [lightRegular, darkRegular] = palettes.ansi.regular[type];\n\t\tconst [lightBold, darkBold] = palettes.ansi.bold[type];\n\t\tconst reset = \"\\x1B[0m\";\n\t\tparts.push(direction === \"up\" ? lightRegular : darkRegular, direction === \"up\" ? \">>\" : \"<<\", type, direction === \"up\" ? lightBold : darkBold, `#${id}`, path, reset);\n\t} else {\n\t\tconst [light, dark] = palettes.css[type];\n\t\tconst css = `\n background-color: #${direction === \"up\" ? light : dark};\n color: ${direction === \"up\" ? \"black\" : \"white\"};\n padding: 2px;\n `;\n\t\tparts.push(\"%c\", direction === \"up\" ? \">>\" : \"<<\", type, `#${id}`, `%c${path}%c`, \"%O\");\n\t\targs.push(css, `${css}; font-weight: bold;`, `${css}; font-weight: normal;`);\n\t}\n\tif (direction === \"up\") args.push(withContext ? {\n\t\tinput,\n\t\tcontext: opts.context\n\t} : { input });\n\telse args.push((0, import_objectSpread2.default)({\n\t\tinput,\n\t\tresult: opts.result,\n\t\telapsedMs: opts.elapsedMs\n\t}, withContext && { context: opts.context }));\n\treturn {\n\t\tparts,\n\t\targs\n\t};\n}\nconst defaultLogger = ({ c = console, colorMode = \"css\", withContext }) => (props) => {\n\tconst rawInput = props.input;\n\tconst input = isFormData(rawInput) ? Object.fromEntries(rawInput) : rawInput;\n\tconst { parts, args } = constructPartsAndArgs((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, props), {}, {\n\t\tcolorMode,\n\t\tinput,\n\t\twithContext\n\t}));\n\tconst fn = props.direction === \"down\" && props.result && (props.result instanceof Error || \"error\" in props.result.result && props.result.result.error) ? \"error\" : \"log\";\n\tc[fn].apply(null, [parts.join(\" \")].concat(args));\n};\n/**\n* @see https://trpc.io/docs/v11/client/links/loggerLink\n*/\nfunction loggerLink(opts = {}) {\n\tvar _opts$colorMode, _opts$withContext;\n\tconst { enabled = () => true } = opts;\n\tconst colorMode = (_opts$colorMode = opts.colorMode) !== null && _opts$colorMode !== void 0 ? _opts$colorMode : typeof window === \"undefined\" ? \"ansi\" : \"css\";\n\tconst withContext = (_opts$withContext = opts.withContext) !== null && _opts$withContext !== void 0 ? _opts$withContext : colorMode === \"css\";\n\tconst { logger = defaultLogger({\n\t\tc: opts.console,\n\t\tcolorMode,\n\t\twithContext\n\t}) } = opts;\n\treturn () => {\n\t\treturn ({ op, next }) => {\n\t\t\treturn observable((observer) => {\n\t\t\t\tif (enabled((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, op), {}, { direction: \"up\" }))) logger((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, op), {}, { direction: \"up\" }));\n\t\t\t\tconst requestStartTime = Date.now();\n\t\t\t\tfunction logResult(result) {\n\t\t\t\t\tconst elapsedMs = Date.now() - requestStartTime;\n\t\t\t\t\tif (enabled((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, op), {}, {\n\t\t\t\t\t\tdirection: \"down\",\n\t\t\t\t\t\tresult\n\t\t\t\t\t}))) logger((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, op), {}, {\n\t\t\t\t\t\tdirection: \"down\",\n\t\t\t\t\t\telapsedMs,\n\t\t\t\t\t\tresult\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t\treturn next(op).pipe(tap({\n\t\t\t\t\tnext(result) {\n\t\t\t\t\t\tlogResult(result);\n\t\t\t\t\t},\n\t\t\t\t\terror(result) {\n\t\t\t\t\t\tlogResult(result);\n\t\t\t\t\t}\n\t\t\t\t})).subscribe(observer);\n\t\t\t});\n\t\t};\n\t};\n}\n\n//#endregion\nexport { loggerLink };\n//# sourceMappingURL=loggerLink-ineCN1PO.mjs.map","import { __toESM, require_defineProperty, require_objectSpread2 } from \"./objectSpread2-BvkFp-_Y.mjs\";\nimport { TRPCClientError } from \"./TRPCClientError-apv8gw59.mjs\";\nimport { getTransformer } from \"./unstable-internals-Bg7n9BBj.mjs\";\nimport { behaviorSubject, observable } from \"@trpc/server/observable\";\nimport { run, sleep, transformResult } from \"@trpc/server/unstable-core-do-not-import\";\n\n//#region src/links/wsLink/wsClient/encoder.ts\nconst jsonEncoder = {\n\tencode: (data) => JSON.stringify(data),\n\tdecode: (data) => {\n\t\tif (typeof data !== \"string\") throw new Error(\"jsonEncoder received binary data. JSON uses text frames. Use a binary encoder for binary data.\");\n\t\treturn JSON.parse(data);\n\t}\n};\n\n//#endregion\n//#region src/links/wsLink/wsClient/options.ts\nconst lazyDefaults = {\n\tenabled: false,\n\tcloseMs: 0\n};\nconst keepAliveDefaults = {\n\tenabled: false,\n\tpongTimeoutMs: 1e3,\n\tintervalMs: 5e3\n};\n/**\n* Calculates a delay for exponential backoff based on the retry attempt index.\n* The delay starts at 0 for the first attempt and doubles for each subsequent attempt,\n* capped at 30 seconds.\n*/\nconst exponentialBackoff = (attemptIndex) => {\n\treturn attemptIndex === 0 ? 0 : Math.min(1e3 * 2 ** attemptIndex, 3e4);\n};\n\n//#endregion\n//#region src/links/internals/urlWithConnectionParams.ts\n/**\n* Get the result of a value or function that returns a value\n* It also optionally accepts typesafe arguments for the function\n*/\nconst resultOf = (value, ...args) => {\n\treturn typeof value === \"function\" ? value(...args) : value;\n};\n\n//#endregion\n//#region src/links/wsLink/wsClient/utils.ts\nvar import_defineProperty$3 = __toESM(require_defineProperty(), 1);\nvar TRPCWebSocketClosedError = class TRPCWebSocketClosedError extends Error {\n\tconstructor(opts) {\n\t\tsuper(opts.message, { cause: opts.cause });\n\t\tthis.name = \"TRPCWebSocketClosedError\";\n\t\tObject.setPrototypeOf(this, TRPCWebSocketClosedError.prototype);\n\t}\n};\n/**\n* Utility class for managing a timeout that can be started, stopped, and reset.\n* Useful for scenarios where the timeout duration is reset dynamically based on events.\n*/\nvar ResettableTimeout = class {\n\tconstructor(onTimeout, timeoutMs) {\n\t\tthis.onTimeout = onTimeout;\n\t\tthis.timeoutMs = timeoutMs;\n\t\t(0, import_defineProperty$3.default)(this, \"timeout\", void 0);\n\t}\n\t/**\n\t* Resets the current timeout, restarting it with the same duration.\n\t* Does nothing if no timeout is active.\n\t*/\n\treset() {\n\t\tif (!this.timeout) return;\n\t\tclearTimeout(this.timeout);\n\t\tthis.timeout = setTimeout(this.onTimeout, this.timeoutMs);\n\t}\n\tstart() {\n\t\tclearTimeout(this.timeout);\n\t\tthis.timeout = setTimeout(this.onTimeout, this.timeoutMs);\n\t}\n\tstop() {\n\t\tclearTimeout(this.timeout);\n\t\tthis.timeout = void 0;\n\t}\n};\nfunction withResolvers() {\n\tlet resolve;\n\tlet reject;\n\tconst promise = new Promise((res, rej) => {\n\t\tresolve = res;\n\t\treject = rej;\n\t});\n\treturn {\n\t\tpromise,\n\t\tresolve,\n\t\treject\n\t};\n}\n/**\n* Resolves a WebSocket URL and optionally appends connection parameters.\n*\n* If connectionParams are provided, appends 'connectionParams=1' query parameter.\n*/\nasync function prepareUrl(urlOptions) {\n\tconst url = await resultOf(urlOptions.url);\n\tif (!urlOptions.connectionParams) return url;\n\tconst prefix = url.includes(\"?\") ? \"&\" : \"?\";\n\tconst connectionParams = `${prefix}connectionParams=1`;\n\treturn url + connectionParams;\n}\nasync function buildConnectionMessage(connectionParams, encoder) {\n\tconst message = {\n\t\tmethod: \"connectionParams\",\n\t\tdata: await resultOf(connectionParams)\n\t};\n\treturn encoder.encode(message);\n}\n\n//#endregion\n//#region src/links/wsLink/wsClient/requestManager.ts\nvar import_defineProperty$2 = __toESM(require_defineProperty(), 1);\n/**\n* Manages WebSocket requests, tracking their lifecycle and providing utility methods\n* for handling outgoing and pending requests.\n*\n* - **Outgoing requests**: Requests that are queued and waiting to be sent.\n* - **Pending requests**: Requests that have been sent and are in flight awaiting a response.\n* For subscriptions, multiple responses may be received until the subscription is closed.\n*/\nvar RequestManager = class {\n\tconstructor() {\n\t\t(0, import_defineProperty$2.default)(this, \"outgoingRequests\", new Array());\n\t\t(0, import_defineProperty$2.default)(this, \"pendingRequests\", {});\n\t}\n\t/**\n\t* Registers a new request by adding it to the outgoing queue and setting up\n\t* callbacks for lifecycle events such as completion or error.\n\t*\n\t* @param message - The outgoing message to be sent.\n\t* @param callbacks - Callback functions to observe the request's state.\n\t* @returns A cleanup function to manually remove the request.\n\t*/\n\tregister(message, callbacks) {\n\t\tconst { promise: end, resolve } = withResolvers();\n\t\tthis.outgoingRequests.push({\n\t\t\tid: String(message.id),\n\t\t\tmessage,\n\t\t\tend,\n\t\t\tcallbacks: {\n\t\t\t\tnext: callbacks.next,\n\t\t\t\tcomplete: () => {\n\t\t\t\t\tcallbacks.complete();\n\t\t\t\t\tresolve();\n\t\t\t\t},\n\t\t\t\terror: (e) => {\n\t\t\t\t\tcallbacks.error(e);\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn () => {\n\t\t\tthis.delete(message.id);\n\t\t\tcallbacks.complete();\n\t\t\tresolve();\n\t\t};\n\t}\n\t/**\n\t* Deletes a request from both the outgoing and pending collections, if it exists.\n\t*/\n\tdelete(messageId) {\n\t\tif (messageId === null) return;\n\t\tthis.outgoingRequests = this.outgoingRequests.filter(({ id }) => id !== String(messageId));\n\t\tdelete this.pendingRequests[String(messageId)];\n\t}\n\t/**\n\t* Moves all outgoing requests to the pending state and clears the outgoing queue.\n\t*\n\t* The caller is expected to handle the actual sending of the requests\n\t* (e.g., sending them over the network) after this method is called.\n\t*\n\t* @returns The list of requests that were transitioned to the pending state.\n\t*/\n\tflush() {\n\t\tconst requests = this.outgoingRequests;\n\t\tthis.outgoingRequests = [];\n\t\tfor (const request of requests) this.pendingRequests[request.id] = request;\n\t\treturn requests;\n\t}\n\t/**\n\t* Retrieves all currently pending requests, which are in flight awaiting responses\n\t* or handling ongoing subscriptions.\n\t*/\n\tgetPendingRequests() {\n\t\treturn Object.values(this.pendingRequests);\n\t}\n\t/**\n\t* Retrieves a specific pending request by its message ID.\n\t*/\n\tgetPendingRequest(messageId) {\n\t\tif (messageId === null) return null;\n\t\treturn this.pendingRequests[String(messageId)];\n\t}\n\t/**\n\t* Retrieves all outgoing requests, which are waiting to be sent.\n\t*/\n\tgetOutgoingRequests() {\n\t\treturn this.outgoingRequests;\n\t}\n\t/**\n\t* Retrieves all requests, both outgoing and pending, with their respective states.\n\t*\n\t* @returns An array of all requests with their state (\"outgoing\" or \"pending\").\n\t*/\n\tgetRequests() {\n\t\treturn [...this.getOutgoingRequests().map((request) => ({\n\t\t\tstate: \"outgoing\",\n\t\t\tmessage: request.message,\n\t\t\tend: request.end,\n\t\t\tcallbacks: request.callbacks\n\t\t})), ...this.getPendingRequests().map((request) => ({\n\t\t\tstate: \"pending\",\n\t\t\tmessage: request.message,\n\t\t\tend: request.end,\n\t\t\tcallbacks: request.callbacks\n\t\t}))];\n\t}\n\t/**\n\t* Checks if there are any pending requests, including ongoing subscriptions.\n\t*/\n\thasPendingRequests() {\n\t\treturn this.getPendingRequests().length > 0;\n\t}\n\t/**\n\t* Checks if there are any pending subscriptions\n\t*/\n\thasPendingSubscriptions() {\n\t\treturn this.getPendingRequests().some((request) => request.message.method === \"subscription\");\n\t}\n\t/**\n\t* Checks if there are any outgoing requests waiting to be sent.\n\t*/\n\thasOutgoingRequests() {\n\t\treturn this.outgoingRequests.length > 0;\n\t}\n};\n\n//#endregion\n//#region src/links/wsLink/wsClient/wsConnection.ts\nvar import_defineProperty$1 = __toESM(require_defineProperty(), 1);\n/**\n* Opens a WebSocket connection asynchronously and returns a promise\n* that resolves when the connection is successfully established.\n* The promise rejects if an error occurs during the connection attempt.\n*/\nfunction asyncWsOpen(ws) {\n\tconst { promise, resolve, reject } = withResolvers();\n\tws.addEventListener(\"open\", () => {\n\t\tws.removeEventListener(\"error\", reject);\n\t\tresolve();\n\t});\n\tws.addEventListener(\"error\", reject);\n\treturn promise;\n}\n/**\n* Sets up a periodic ping-pong mechanism to keep the WebSocket connection alive.\n*\n* - Sends \"PING\" messages at regular intervals defined by `intervalMs`.\n* - If a \"PONG\" response is not received within the `pongTimeoutMs`, the WebSocket is closed.\n* - The ping timer resets upon receiving any message to maintain activity.\n* - Automatically starts the ping process when the WebSocket connection is opened.\n* - Cleans up timers when the WebSocket is closed.\n*\n* @param ws - The WebSocket instance to manage.\n* @param options - Configuration options for ping-pong intervals and timeouts.\n*/\nfunction setupPingInterval(ws, { intervalMs, pongTimeoutMs }) {\n\tlet pingTimeout;\n\tlet pongTimeout;\n\tfunction start() {\n\t\tpingTimeout = setTimeout(() => {\n\t\t\tws.send(\"PING\");\n\t\t\tpongTimeout = setTimeout(() => {\n\t\t\t\tws.close();\n\t\t\t}, pongTimeoutMs);\n\t\t}, intervalMs);\n\t}\n\tfunction reset() {\n\t\tclearTimeout(pingTimeout);\n\t\tstart();\n\t}\n\tfunction pong() {\n\t\tclearTimeout(pongTimeout);\n\t\treset();\n\t}\n\tws.addEventListener(\"open\", start);\n\tws.addEventListener(\"message\", ({ data }) => {\n\t\tclearTimeout(pingTimeout);\n\t\tstart();\n\t\tif (data === \"PONG\") pong();\n\t});\n\tws.addEventListener(\"close\", () => {\n\t\tclearTimeout(pingTimeout);\n\t\tclearTimeout(pongTimeout);\n\t});\n}\n/**\n* Manages a WebSocket connection with support for reconnection, keep-alive mechanisms,\n* and observable state tracking.\n*/\nvar WsConnection = class WsConnection {\n\tconstructor(opts) {\n\t\tvar _opts$WebSocketPonyfi;\n\t\t(0, import_defineProperty$1.default)(this, \"id\", ++WsConnection.connectCount);\n\t\t(0, import_defineProperty$1.default)(this, \"WebSocketPonyfill\", void 0);\n\t\t(0, import_defineProperty$1.default)(this, \"urlOptions\", void 0);\n\t\t(0, import_defineProperty$1.default)(this, \"keepAliveOpts\", void 0);\n\t\t(0, import_defineProperty$1.default)(this, \"encoder\", void 0);\n\t\t(0, import_defineProperty$1.default)(this, \"wsObservable\", behaviorSubject(null));\n\t\t(0, import_defineProperty$1.default)(this, \"openPromise\", null);\n\t\tthis.WebSocketPonyfill = (_opts$WebSocketPonyfi = opts.WebSocketPonyfill) !== null && _opts$WebSocketPonyfi !== void 0 ? _opts$WebSocketPonyfi : WebSocket;\n\t\tif (!this.WebSocketPonyfill) throw new Error(\"No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill\");\n\t\tthis.urlOptions = opts.urlOptions;\n\t\tthis.keepAliveOpts = opts.keepAlive;\n\t\tthis.encoder = opts.encoder;\n\t}\n\tget ws() {\n\t\treturn this.wsObservable.get();\n\t}\n\tset ws(ws) {\n\t\tthis.wsObservable.next(ws);\n\t}\n\t/**\n\t* Checks if the WebSocket connection is open and ready to communicate.\n\t*/\n\tisOpen() {\n\t\treturn !!this.ws && this.ws.readyState === this.WebSocketPonyfill.OPEN && !this.openPromise;\n\t}\n\t/**\n\t* Checks if the WebSocket connection is closed or in the process of closing.\n\t*/\n\tisClosed() {\n\t\treturn !!this.ws && (this.ws.readyState === this.WebSocketPonyfill.CLOSING || this.ws.readyState === this.WebSocketPonyfill.CLOSED);\n\t}\n\tasync open() {\n\t\tvar _this = this;\n\t\tif (_this.openPromise) return _this.openPromise;\n\t\t_this.id = ++WsConnection.connectCount;\n\t\tconst wsPromise = prepareUrl(_this.urlOptions).then((url) => new _this.WebSocketPonyfill(url));\n\t\t_this.openPromise = wsPromise.then(async (ws) => {\n\t\t\t_this.ws = ws;\n\t\t\tws.binaryType = \"arraybuffer\";\n\t\t\tws.addEventListener(\"message\", function({ data }) {\n\t\t\t\tif (data === \"PING\") this.send(\"PONG\");\n\t\t\t});\n\t\t\tif (_this.keepAliveOpts.enabled) setupPingInterval(ws, _this.keepAliveOpts);\n\t\t\tws.addEventListener(\"close\", () => {\n\t\t\t\tif (_this.ws === ws) _this.ws = null;\n\t\t\t});\n\t\t\tawait asyncWsOpen(ws);\n\t\t\tif (_this.urlOptions.connectionParams) ws.send(await buildConnectionMessage(_this.urlOptions.connectionParams, _this.encoder));\n\t\t});\n\t\ttry {\n\t\t\tawait _this.openPromise;\n\t\t} finally {\n\t\t\t_this.openPromise = null;\n\t\t}\n\t}\n\t/**\n\t* Closes the WebSocket connection gracefully.\n\t* Waits for any ongoing open operation to complete before closing.\n\t*/\n\tasync close() {\n\t\tvar _this2 = this;\n\t\ttry {\n\t\t\tawait _this2.openPromise;\n\t\t} finally {\n\t\t\tvar _this$ws;\n\t\t\t(_this$ws = _this2.ws) === null || _this$ws === void 0 || _this$ws.close();\n\t\t}\n\t}\n};\n(0, import_defineProperty$1.default)(WsConnection, \"connectCount\", 0);\n/**\n* Provides a backward-compatible representation of the connection state.\n*/\nfunction backwardCompatibility(connection) {\n\tif (connection.isOpen()) return {\n\t\tid: connection.id,\n\t\tstate: \"open\",\n\t\tws: connection.ws\n\t};\n\tif (connection.isClosed()) return {\n\t\tid: connection.id,\n\t\tstate: \"closed\",\n\t\tws: connection.ws\n\t};\n\tif (!connection.ws) return null;\n\treturn {\n\t\tid: connection.id,\n\t\tstate: \"connecting\",\n\t\tws: connection.ws\n\t};\n}\n\n//#endregion\n//#region src/links/wsLink/wsClient/wsClient.ts\nvar import_defineProperty = __toESM(require_defineProperty(), 1);\nvar import_objectSpread2 = __toESM(require_objectSpread2(), 1);\n/**\n* A WebSocket client for managing TRPC operations, supporting lazy initialization,\n* reconnection, keep-alive, and request management.\n*/\nvar WsClient = class {\n\tconstructor(opts) {\n\t\tvar _opts$experimental_en, _opts$retryDelayMs;\n\t\t(0, import_defineProperty.default)(this, \"connectionState\", void 0);\n\t\t(0, import_defineProperty.default)(this, \"allowReconnect\", false);\n\t\t(0, import_defineProperty.default)(this, \"requestManager\", new RequestManager());\n\t\t(0, import_defineProperty.default)(this, \"activeConnection\", void 0);\n\t\t(0, import_defineProperty.default)(this, \"reconnectRetryDelay\", void 0);\n\t\t(0, import_defineProperty.default)(this, \"inactivityTimeout\", void 0);\n\t\t(0, import_defineProperty.default)(this, \"callbacks\", void 0);\n\t\t(0, import_defineProperty.default)(this, \"lazyMode\", void 0);\n\t\t(0, import_defineProperty.default)(this, \"encoder\", void 0);\n\t\t(0, import_defineProperty.default)(this, \"reconnecting\", null);\n\t\tthis.encoder = (_opts$experimental_en = opts.experimental_encoder) !== null && _opts$experimental_en !== void 0 ? _opts$experimental_en : jsonEncoder;\n\t\tthis.callbacks = {\n\t\t\tonOpen: opts.onOpen,\n\t\t\tonClose: opts.onClose,\n\t\t\tonError: opts.onError\n\t\t};\n\t\tconst lazyOptions = (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, lazyDefaults), opts.lazy);\n\t\tthis.inactivityTimeout = new ResettableTimeout(() => {\n\t\t\tif (this.requestManager.hasOutgoingRequests() || this.requestManager.hasPendingRequests()) {\n\t\t\t\tthis.inactivityTimeout.reset();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.close().catch(() => null);\n\t\t}, lazyOptions.closeMs);\n\t\tthis.activeConnection = new WsConnection({\n\t\t\tWebSocketPonyfill: opts.WebSocket,\n\t\t\turlOptions: opts,\n\t\t\tkeepAlive: (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, keepAliveDefaults), opts.keepAlive),\n\t\t\tencoder: this.encoder\n\t\t});\n\t\tthis.activeConnection.wsObservable.subscribe({ next: (ws) => {\n\t\t\tif (!ws) return;\n\t\t\tthis.setupWebSocketListeners(ws);\n\t\t} });\n\t\tthis.reconnectRetryDelay = (_opts$retryDelayMs = opts.retryDelayMs) !== null && _opts$retryDelayMs !== void 0 ? _opts$retryDelayMs : exponentialBackoff;\n\t\tthis.lazyMode = lazyOptions.enabled;\n\t\tthis.connectionState = behaviorSubject({\n\t\t\ttype: \"state\",\n\t\t\tstate: lazyOptions.enabled ? \"idle\" : \"connecting\",\n\t\t\terror: null\n\t\t});\n\t\tif (!this.lazyMode) this.open().catch(() => null);\n\t}\n\t/**\n\t* Opens the WebSocket connection. Handles reconnection attempts and updates\n\t* the connection state accordingly.\n\t*/\n\tasync open() {\n\t\tvar _this = this;\n\t\t_this.allowReconnect = true;\n\t\tif (_this.connectionState.get().state === \"idle\") _this.connectionState.next({\n\t\t\ttype: \"state\",\n\t\t\tstate: \"connecting\",\n\t\t\terror: null\n\t\t});\n\t\ttry {\n\t\t\tawait _this.activeConnection.open();\n\t\t} catch (error) {\n\t\t\t_this.reconnect(new TRPCWebSocketClosedError({\n\t\t\t\tmessage: \"Initialization error\",\n\t\t\t\tcause: error\n\t\t\t}));\n\t\t\treturn _this.reconnecting;\n\t\t}\n\t}\n\t/**\n\t* Closes the WebSocket connection and stops managing requests.\n\t* Ensures all outgoing and pending requests are properly finalized.\n\t*/\n\tasync close() {\n\t\tvar _this2 = this;\n\t\t_this2.allowReconnect = false;\n\t\t_this2.inactivityTimeout.stop();\n\t\tconst requestsToAwait = [];\n\t\tfor (const request of _this2.requestManager.getRequests()) if (request.message.method === \"subscription\") request.callbacks.complete();\n\t\telse if (request.state === \"outgoing\") request.callbacks.error(TRPCClientError.from(new TRPCWebSocketClosedError({ message: \"Closed before connection was established\" })));\n\t\telse requestsToAwait.push(request.end);\n\t\tawait Promise.all(requestsToAwait).catch(() => null);\n\t\tawait _this2.activeConnection.close().catch(() => null);\n\t\t_this2.connectionState.next({\n\t\t\ttype: \"state\",\n\t\t\tstate: \"idle\",\n\t\t\terror: null\n\t\t});\n\t}\n\t/**\n\t* Method to request the server.\n\t* Handles data transformation, batching of requests, and subscription lifecycle.\n\t*\n\t* @param op - The operation details including id, type, path, input and signal\n\t* @param transformer - Data transformer for serializing requests and deserializing responses\n\t* @param lastEventId - Optional ID of the last received event for subscriptions\n\t*\n\t* @returns An observable that emits operation results and handles cleanup\n\t*/\n\trequest({ op: { id, type, path, input, signal }, transformer, lastEventId }) {\n\t\treturn observable((observer) => {\n\t\t\tconst abort = this.batchSend({\n\t\t\t\tid,\n\t\t\t\tmethod: type,\n\t\t\t\tparams: {\n\t\t\t\t\tinput: transformer.input.serialize(input),\n\t\t\t\t\tpath,\n\t\t\t\t\tlastEventId\n\t\t\t\t}\n\t\t\t}, (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, observer), {}, { next(event) {\n\t\t\t\tconst transformed = transformResult(event, transformer.output);\n\t\t\t\tif (!transformed.ok) {\n\t\t\t\t\tobserver.error(TRPCClientError.from(transformed.error));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tobserver.next({ result: transformed.result });\n\t\t\t} }));\n\t\t\treturn () => {\n\t\t\t\tabort();\n\t\t\t\tif (type === \"subscription\" && this.activeConnection.isOpen()) this.send({\n\t\t\t\t\tid,\n\t\t\t\t\tmethod: \"subscription.stop\"\n\t\t\t\t});\n\t\t\t\tsignal === null || signal === void 0 || signal.removeEventListener(\"abort\", abort);\n\t\t\t};\n\t\t});\n\t}\n\tget connection() {\n\t\treturn backwardCompatibility(this.activeConnection);\n\t}\n\treconnect(closedError) {\n\t\tvar _this3 = this;\n\t\tthis.connectionState.next({\n\t\t\ttype: \"state\",\n\t\t\tstate: \"connecting\",\n\t\t\terror: TRPCClientError.from(closedError)\n\t\t});\n\t\tif (this.reconnecting) return;\n\t\tconst tryReconnect = async (attemptIndex) => {\n\t\t\ttry {\n\t\t\t\tawait sleep(_this3.reconnectRetryDelay(attemptIndex));\n\t\t\t\tif (_this3.allowReconnect) {\n\t\t\t\t\tawait _this3.activeConnection.close();\n\t\t\t\t\tawait _this3.activeConnection.open();\n\t\t\t\t\tif (_this3.requestManager.hasPendingRequests()) _this3.send(_this3.requestManager.getPendingRequests().map(({ message }) => message));\n\t\t\t\t}\n\t\t\t\t_this3.reconnecting = null;\n\t\t\t} catch (_unused) {\n\t\t\t\tawait tryReconnect(attemptIndex + 1);\n\t\t\t}\n\t\t};\n\t\tthis.reconnecting = tryReconnect(0);\n\t}\n\tsetupWebSocketListeners(ws) {\n\t\tvar _this4 = this;\n\t\tconst handleCloseOrError = (cause) => {\n\t\t\tconst reqs = this.requestManager.getPendingRequests();\n\t\t\tfor (const { message, callbacks } of reqs) {\n\t\t\t\tif (message.method === \"subscription\") continue;\n\t\t\t\tcallbacks.error(TRPCClientError.from(cause !== null && cause !== void 0 ? cause : new TRPCWebSocketClosedError({\n\t\t\t\t\tmessage: \"WebSocket closed\",\n\t\t\t\t\tcause\n\t\t\t\t})));\n\t\t\t\tthis.requestManager.delete(message.id);\n\t\t\t}\n\t\t};\n\t\tws.addEventListener(\"open\", () => {\n\t\t\trun(async () => {\n\t\t\t\tvar _this$callbacks$onOpe, _this$callbacks;\n\t\t\t\tif (_this4.lazyMode) _this4.inactivityTimeout.start();\n\t\t\t\t(_this$callbacks$onOpe = (_this$callbacks = _this4.callbacks).onOpen) === null || _this$callbacks$onOpe === void 0 || _this$callbacks$onOpe.call(_this$callbacks);\n\t\t\t\t_this4.connectionState.next({\n\t\t\t\t\ttype: \"state\",\n\t\t\t\t\tstate: \"pending\",\n\t\t\t\t\terror: null\n\t\t\t\t});\n\t\t\t}).catch((error) => {\n\t\t\t\tws.close(3e3);\n\t\t\t\thandleCloseOrError(error);\n\t\t\t});\n\t\t});\n\t\tws.addEventListener(\"message\", ({ data }) => {\n\t\t\tthis.inactivityTimeout.reset();\n\t\t\tif ([\"PING\", \"PONG\"].includes(data)) return;\n\t\t\tconst incomingMessage = this.encoder.decode(data);\n\t\t\tif (\"method\" in incomingMessage) {\n\t\t\t\tthis.handleIncomingRequest(incomingMessage);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.handleResponseMessage(incomingMessage);\n\t\t});\n\t\tws.addEventListener(\"close\", (event) => {\n\t\t\tvar _this$callbacks$onClo, _this$callbacks2;\n\t\t\thandleCloseOrError(event);\n\t\t\t(_this$callbacks$onClo = (_this$callbacks2 = this.callbacks).onClose) === null || _this$callbacks$onClo === void 0 || _this$callbacks$onClo.call(_this$callbacks2, event);\n\t\t\tif (!this.lazyMode || this.requestManager.hasPendingSubscriptions()) this.reconnect(new TRPCWebSocketClosedError({\n\t\t\t\tmessage: \"WebSocket closed\",\n\t\t\t\tcause: event\n\t\t\t}));\n\t\t});\n\t\tws.addEventListener(\"error\", (event) => {\n\t\t\tvar _this$callbacks$onErr, _this$callbacks3;\n\t\t\thandleCloseOrError(event);\n\t\t\t(_this$callbacks$onErr = (_this$callbacks3 = this.callbacks).onError) === null || _this$callbacks$onErr === void 0 || _this$callbacks$onErr.call(_this$callbacks3, event);\n\t\t\tthis.reconnect(new TRPCWebSocketClosedError({\n\t\t\t\tmessage: \"WebSocket closed\",\n\t\t\t\tcause: event\n\t\t\t}));\n\t\t});\n\t}\n\thandleResponseMessage(message) {\n\t\tconst request = this.requestManager.getPendingRequest(message.id);\n\t\tif (!request) return;\n\t\trequest.callbacks.next(message);\n\t\tlet completed = true;\n\t\tif (\"result\" in message && request.message.method === \"subscription\") {\n\t\t\tif (message.result.type === \"data\") request.message.params.lastEventId = message.result.id;\n\t\t\tif (message.result.type !== \"stopped\") completed = false;\n\t\t}\n\t\tif (completed) {\n\t\t\trequest.callbacks.complete();\n\t\t\tthis.requestManager.delete(message.id);\n\t\t}\n\t}\n\thandleIncomingRequest(message) {\n\t\tif (message.method === \"reconnect\") this.reconnect(new TRPCWebSocketClosedError({ message: \"Server requested reconnect\" }));\n\t}\n\t/**\n\t* Sends a message or batch of messages directly to the server.\n\t*/\n\tsend(messageOrMessages) {\n\t\tif (!this.activeConnection.isOpen()) throw new Error(\"Active connection is not open\");\n\t\tconst messages = messageOrMessages instanceof Array ? messageOrMessages : [messageOrMessages];\n\t\tthis.activeConnection.ws.send(this.encoder.encode(messages.length === 1 ? messages[0] : messages));\n\t}\n\t/**\n\t* Groups requests for batch sending.\n\t*\n\t* @returns A function to abort the batched request.\n\t*/\n\tbatchSend(message, callbacks) {\n\t\tvar _this5 = this;\n\t\tthis.inactivityTimeout.reset();\n\t\trun(async () => {\n\t\t\tif (!_this5.activeConnection.isOpen()) await _this5.open();\n\t\t\tawait sleep(0);\n\t\t\tif (!_this5.requestManager.hasOutgoingRequests()) return;\n\t\t\t_this5.send(_this5.requestManager.flush().map(({ message: message$1 }) => message$1));\n\t\t}).catch((err) => {\n\t\t\tthis.requestManager.delete(message.id);\n\t\t\tcallbacks.error(TRPCClientError.from(err));\n\t\t});\n\t\treturn this.requestManager.register(message, callbacks);\n\t}\n};\n\n//#endregion\n//#region src/links/wsLink/createWsClient.ts\nfunction createWSClient(opts) {\n\treturn new WsClient(opts);\n}\n\n//#endregion\n//#region src/links/wsLink/wsLink.ts\nfunction wsLink(opts) {\n\tconst { client } = opts;\n\tconst transformer = getTransformer(opts.transformer);\n\treturn () => {\n\t\treturn ({ op }) => {\n\t\t\treturn observable((observer) => {\n\t\t\t\tconst connStateSubscription = op.type === \"subscription\" ? client.connectionState.subscribe({ next(result) {\n\t\t\t\t\tobserver.next({\n\t\t\t\t\t\tresult,\n\t\t\t\t\t\tcontext: op.context\n\t\t\t\t\t});\n\t\t\t\t} }) : null;\n\t\t\t\tconst requestSubscription = client.request({\n\t\t\t\t\top,\n\t\t\t\t\ttransformer\n\t\t\t\t}).subscribe(observer);\n\t\t\t\treturn () => {\n\t\t\t\t\trequestSubscription.unsubscribe();\n\t\t\t\t\tconnStateSubscription === null || connStateSubscription === void 0 || connStateSubscription.unsubscribe();\n\t\t\t\t};\n\t\t\t});\n\t\t};\n\t};\n}\n\n//#endregion\nexport { createWSClient, jsonEncoder, resultOf, wsLink };\n//# sourceMappingURL=wsLink-DSf4KOdW.mjs.map","import { __commonJS, __toESM, require_defineProperty, require_objectSpread2 } from \"./objectSpread2-BvkFp-_Y.mjs\";\nimport { createChain, splitLink } from \"./splitLink-B7Cuf2c_.mjs\";\nimport { TRPCClientError, isTRPCClientError } from \"./TRPCClientError-apv8gw59.mjs\";\nimport { fetchHTTPResponse, getBody, getFetch, getUrl, resolveHTTPLinkOptions } from \"./httpUtils-Dv57hbOd.mjs\";\nimport { httpLink, isFormData, isNonJsonSerializable, isOctetType } from \"./httpLink-Cz9h1Qgh.mjs\";\nimport { abortSignalToPromise, allAbortSignals, dataLoader, httpBatchLink, raceAbortSignals } from \"./httpBatchLink-fQ1NAi-e.mjs\";\nimport { getTransformer } from \"./unstable-internals-Bg7n9BBj.mjs\";\nimport { loggerLink } from \"./loggerLink-ineCN1PO.mjs\";\nimport { createWSClient, jsonEncoder, resultOf, wsLink } from \"./wsLink-DSf4KOdW.mjs\";\nimport { behaviorSubject, observable, observableToPromise, share } from \"@trpc/server/observable\";\nimport { callProcedure, createFlatProxy, createRecursiveProxy, isAbortError, isAsyncIterable, iteratorResource, jsonlStreamConsumer, makeResource, retryableRpcCodes, run, sseStreamConsumer } from \"@trpc/server/unstable-core-do-not-import\";\nimport { getTRPCErrorFromUnknown, getTRPCErrorShape, isTrackedEnvelope } from \"@trpc/server\";\nimport { TRPC_ERROR_CODES_BY_KEY } from \"@trpc/server/rpc\";\n\n//#region src/internals/TRPCUntypedClient.ts\nvar import_defineProperty = __toESM(require_defineProperty(), 1);\nvar import_objectSpread2$4 = __toESM(require_objectSpread2(), 1);\nvar TRPCUntypedClient = class {\n\tconstructor(opts) {\n\t\t(0, import_defineProperty.default)(this, \"links\", void 0);\n\t\t(0, import_defineProperty.default)(this, \"runtime\", void 0);\n\t\t(0, import_defineProperty.default)(this, \"requestId\", void 0);\n\t\tthis.requestId = 0;\n\t\tthis.runtime = {};\n\t\tthis.links = opts.links.map((link) => link(this.runtime));\n\t}\n\t$request(opts) {\n\t\tvar _opts$context;\n\t\tconst chain$ = createChain({\n\t\t\tlinks: this.links,\n\t\t\top: (0, import_objectSpread2$4.default)((0, import_objectSpread2$4.default)({}, opts), {}, {\n\t\t\t\tcontext: (_opts$context = opts.context) !== null && _opts$context !== void 0 ? _opts$context : {},\n\t\t\t\tid: ++this.requestId\n\t\t\t})\n\t\t});\n\t\treturn chain$.pipe(share());\n\t}\n\tasync requestAsPromise(opts) {\n\t\tvar _this = this;\n\t\ttry {\n\t\t\tconst req$ = _this.$request(opts);\n\t\t\tconst envelope = await observableToPromise(req$);\n\t\t\tconst data = envelope.result.data;\n\t\t\treturn data;\n\t\t} catch (err) {\n\t\t\tthrow TRPCClientError.from(err);\n\t\t}\n\t}\n\tquery(path, input, opts) {\n\t\treturn this.requestAsPromise({\n\t\t\ttype: \"query\",\n\t\t\tpath,\n\t\t\tinput,\n\t\t\tcontext: opts === null || opts === void 0 ? void 0 : opts.context,\n\t\t\tsignal: opts === null || opts === void 0 ? void 0 : opts.signal\n\t\t});\n\t}\n\tmutation(path, input, opts) {\n\t\treturn this.requestAsPromise({\n\t\t\ttype: \"mutation\",\n\t\t\tpath,\n\t\t\tinput,\n\t\t\tcontext: opts === null || opts === void 0 ? void 0 : opts.context,\n\t\t\tsignal: opts === null || opts === void 0 ? void 0 : opts.signal\n\t\t});\n\t}\n\tsubscription(path, input, opts) {\n\t\tconst observable$ = this.$request({\n\t\t\ttype: \"subscription\",\n\t\t\tpath,\n\t\t\tinput,\n\t\t\tcontext: opts.context,\n\t\t\tsignal: opts.signal\n\t\t});\n\t\treturn observable$.subscribe({\n\t\t\tnext(envelope) {\n\t\t\t\tswitch (envelope.result.type) {\n\t\t\t\t\tcase \"state\": {\n\t\t\t\t\t\tvar _opts$onConnectionSta;\n\t\t\t\t\t\t(_opts$onConnectionSta = opts.onConnectionStateChange) === null || _opts$onConnectionSta === void 0 || _opts$onConnectionSta.call(opts, envelope.result);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"started\": {\n\t\t\t\t\t\tvar _opts$onStarted;\n\t\t\t\t\t\t(_opts$onStarted = opts.onStarted) === null || _opts$onStarted === void 0 || _opts$onStarted.call(opts, { context: envelope.context });\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"stopped\": {\n\t\t\t\t\t\tvar _opts$onStopped;\n\t\t\t\t\t\t(_opts$onStopped = opts.onStopped) === null || _opts$onStopped === void 0 || _opts$onStopped.call(opts);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"data\":\n\t\t\t\t\tcase void 0: {\n\t\t\t\t\t\tvar _opts$onData;\n\t\t\t\t\t\t(_opts$onData = opts.onData) === null || _opts$onData === void 0 || _opts$onData.call(opts, envelope.result.data);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\terror(err) {\n\t\t\t\tvar _opts$onError;\n\t\t\t\t(_opts$onError = opts.onError) === null || _opts$onError === void 0 || _opts$onError.call(opts, err);\n\t\t\t},\n\t\t\tcomplete() {\n\t\t\t\tvar _opts$onComplete;\n\t\t\t\t(_opts$onComplete = opts.onComplete) === null || _opts$onComplete === void 0 || _opts$onComplete.call(opts);\n\t\t\t}\n\t\t});\n\t}\n};\n\n//#endregion\n//#region src/createTRPCUntypedClient.ts\nfunction createTRPCUntypedClient(opts) {\n\treturn new TRPCUntypedClient(opts);\n}\n\n//#endregion\n//#region src/createTRPCClient.ts\nconst untypedClientSymbol = Symbol.for(\"trpc_untypedClient\");\nconst clientCallTypeMap = {\n\tquery: \"query\",\n\tmutate: \"mutation\",\n\tsubscribe: \"subscription\"\n};\n/** @internal */\nconst clientCallTypeToProcedureType = (clientCallType) => {\n\treturn clientCallTypeMap[clientCallType];\n};\n/**\n* @internal\n*/\nfunction createTRPCClientProxy(client) {\n\tconst proxy = createRecursiveProxy(({ path, args }) => {\n\t\tconst pathCopy = [...path];\n\t\tconst procedureType = clientCallTypeToProcedureType(pathCopy.pop());\n\t\tconst fullPath = pathCopy.join(\".\");\n\t\treturn client[procedureType](fullPath, ...args);\n\t});\n\treturn createFlatProxy((key) => {\n\t\tif (key === untypedClientSymbol) return client;\n\t\treturn proxy[key];\n\t});\n}\nfunction createTRPCClient(opts) {\n\tconst client = new TRPCUntypedClient(opts);\n\tconst proxy = createTRPCClientProxy(client);\n\treturn proxy;\n}\n/**\n* Get an untyped client from a proxy client\n* @internal\n*/\nfunction getUntypedClient(client) {\n\treturn client[untypedClientSymbol];\n}\n\n//#endregion\n//#region src/links/httpBatchStreamLink.ts\nvar import_objectSpread2$3 = __toESM(require_objectSpread2(), 1);\n/**\n* @see https://trpc.io/docs/client/links/httpBatchStreamLink\n*/\nfunction httpBatchStreamLink(opts) {\n\tvar _opts$maxURLLength, _opts$maxItems;\n\tconst resolvedOpts = resolveHTTPLinkOptions(opts);\n\tconst maxURLLength = (_opts$maxURLLength = opts.maxURLLength) !== null && _opts$maxURLLength !== void 0 ? _opts$maxURLLength : Infinity;\n\tconst maxItems = (_opts$maxItems = opts.maxItems) !== null && _opts$maxItems !== void 0 ? _opts$maxItems : Infinity;\n\treturn () => {\n\t\tconst batchLoader = (type) => {\n\t\t\treturn {\n\t\t\t\tvalidate(batchOps) {\n\t\t\t\t\tif (maxURLLength === Infinity && maxItems === Infinity) return true;\n\t\t\t\t\tif (batchOps.length > maxItems) return false;\n\t\t\t\t\tconst path = batchOps.map((op) => op.path).join(\",\");\n\t\t\t\t\tconst inputs = batchOps.map((op) => op.input);\n\t\t\t\t\tconst url = getUrl((0, import_objectSpread2$3.default)((0, import_objectSpread2$3.default)({}, resolvedOpts), {}, {\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\tinputs,\n\t\t\t\t\t\tsignal: null\n\t\t\t\t\t}));\n\t\t\t\t\treturn url.length <= maxURLLength;\n\t\t\t\t},\n\t\t\t\tasync fetch(batchOps) {\n\t\t\t\t\tconst path = batchOps.map((op) => op.path).join(\",\");\n\t\t\t\t\tconst inputs = batchOps.map((op) => op.input);\n\t\t\t\t\tconst batchSignals = allAbortSignals(...batchOps.map((op) => op.signal));\n\t\t\t\t\tconst abortController = new AbortController();\n\t\t\t\t\tconst responsePromise = fetchHTTPResponse((0, import_objectSpread2$3.default)((0, import_objectSpread2$3.default)({}, resolvedOpts), {}, {\n\t\t\t\t\t\tsignal: raceAbortSignals(batchSignals, abortController.signal),\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\tcontentTypeHeader: \"application/json\",\n\t\t\t\t\t\ttrpcAcceptHeader: \"application/jsonl\",\n\t\t\t\t\t\tgetUrl,\n\t\t\t\t\t\tgetBody,\n\t\t\t\t\t\tinputs,\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\theaders() {\n\t\t\t\t\t\t\tif (!opts.headers) return {};\n\t\t\t\t\t\t\tif (typeof opts.headers === \"function\") return opts.headers({ opList: batchOps });\n\t\t\t\t\t\t\treturn opts.headers;\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t\tconst res = await responsePromise;\n\t\t\t\t\tconst [head] = await jsonlStreamConsumer({\n\t\t\t\t\t\tfrom: res.body,\n\t\t\t\t\t\tdeserialize: (data) => resolvedOpts.transformer.output.deserialize(data),\n\t\t\t\t\t\tformatError(opts$1) {\n\t\t\t\t\t\t\tconst error = opts$1.error;\n\t\t\t\t\t\t\treturn TRPCClientError.from({ error });\n\t\t\t\t\t\t},\n\t\t\t\t\t\tabortController\n\t\t\t\t\t});\n\t\t\t\t\tconst promises = Object.keys(batchOps).map(async (key) => {\n\t\t\t\t\t\tlet json = await Promise.resolve(head[key]);\n\t\t\t\t\t\tif (\"result\" in json) {\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t* Not very pretty, but we need to unwrap nested data as promises\n\t\t\t\t\t\t\t* Our stream producer will only resolve top-level async values or async values that are directly nested in another async value\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\tconst result = await Promise.resolve(json.result);\n\t\t\t\t\t\t\tjson = { result: { data: await Promise.resolve(result.data) } };\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tjson,\n\t\t\t\t\t\t\tmeta: { response: res }\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t\treturn promises;\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\t\tconst query = dataLoader(batchLoader(\"query\"));\n\t\tconst mutation = dataLoader(batchLoader(\"mutation\"));\n\t\tconst loaders = {\n\t\t\tquery,\n\t\t\tmutation\n\t\t};\n\t\treturn ({ op }) => {\n\t\t\treturn observable((observer) => {\n\t\t\t\t/* istanbul ignore if -- @preserve */\n\t\t\t\tif (op.type === \"subscription\") throw new Error(\"Subscriptions are unsupported by `httpBatchStreamLink` - use `httpSubscriptionLink` or `wsLink`\");\n\t\t\t\tconst loader = loaders[op.type];\n\t\t\t\tconst promise = loader.load(op);\n\t\t\t\tlet _res = void 0;\n\t\t\t\tpromise.then((res) => {\n\t\t\t\t\t_res = res;\n\t\t\t\t\tif (\"error\" in res.json) {\n\t\t\t\t\t\tobserver.error(TRPCClientError.from(res.json, { meta: res.meta }));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t} else if (\"result\" in res.json) {\n\t\t\t\t\t\tobserver.next({\n\t\t\t\t\t\t\tcontext: res.meta,\n\t\t\t\t\t\t\tresult: res.json.result\n\t\t\t\t\t\t});\n\t\t\t\t\t\tobserver.complete();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tobserver.complete();\n\t\t\t\t}).catch((err) => {\n\t\t\t\t\tobserver.error(TRPCClientError.from(err, { meta: _res === null || _res === void 0 ? void 0 : _res.meta }));\n\t\t\t\t});\n\t\t\t\treturn () => {};\n\t\t\t});\n\t\t};\n\t};\n}\n/**\n* @deprecated use {@link httpBatchStreamLink} instead\n*/\nconst unstable_httpBatchStreamLink = httpBatchStreamLink;\n\n//#endregion\n//#region src/internals/inputWithTrackedEventId.ts\nvar import_objectSpread2$2 = __toESM(require_objectSpread2(), 1);\nfunction inputWithTrackedEventId(input, lastEventId) {\n\tif (!lastEventId) return input;\n\tif (input != null && typeof input !== \"object\") return input;\n\treturn (0, import_objectSpread2$2.default)((0, import_objectSpread2$2.default)({}, input !== null && input !== void 0 ? input : {}), {}, { lastEventId });\n}\n\n//#endregion\n//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js\nvar require_asyncIterator = __commonJS({ \"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js\"(exports, module) {\n\tfunction _asyncIterator$1(r) {\n\t\tvar n, t, o, e = 2;\n\t\tfor (\"undefined\" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {\n\t\t\tif (t && null != (n = r[t])) return n.call(r);\n\t\t\tif (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r));\n\t\t\tt = \"@@asyncIterator\", o = \"@@iterator\";\n\t\t}\n\t\tthrow new TypeError(\"Object is not async iterable\");\n\t}\n\tfunction AsyncFromSyncIterator(r) {\n\t\tfunction AsyncFromSyncIteratorContinuation(r$1) {\n\t\t\tif (Object(r$1) !== r$1) return Promise.reject(new TypeError(r$1 + \" is not an object.\"));\n\t\t\tvar n = r$1.done;\n\t\t\treturn Promise.resolve(r$1.value).then(function(r$2) {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: r$2,\n\t\t\t\t\tdone: n\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t\treturn AsyncFromSyncIterator = function AsyncFromSyncIterator$1(r$1) {\n\t\t\tthis.s = r$1, this.n = r$1.next;\n\t\t}, AsyncFromSyncIterator.prototype = {\n\t\t\ts: null,\n\t\t\tn: null,\n\t\t\tnext: function next() {\n\t\t\t\treturn AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));\n\t\t\t},\n\t\t\t\"return\": function _return(r$1) {\n\t\t\t\tvar n = this.s[\"return\"];\n\t\t\t\treturn void 0 === n ? Promise.resolve({\n\t\t\t\t\tvalue: r$1,\n\t\t\t\t\tdone: !0\n\t\t\t\t}) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));\n\t\t\t},\n\t\t\t\"throw\": function _throw(r$1) {\n\t\t\t\tvar n = this.s[\"return\"];\n\t\t\t\treturn void 0 === n ? Promise.reject(r$1) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));\n\t\t\t}\n\t\t}, new AsyncFromSyncIterator(r);\n\t}\n\tmodule.exports = _asyncIterator$1, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n} });\n\n//#endregion\n//#region src/links/httpSubscriptionLink.ts\nvar import_asyncIterator = __toESM(require_asyncIterator(), 1);\nasync function urlWithConnectionParams(opts) {\n\tlet url = await resultOf(opts.url);\n\tif (opts.connectionParams) {\n\t\tconst params = await resultOf(opts.connectionParams);\n\t\tconst prefix = url.includes(\"?\") ? \"&\" : \"?\";\n\t\turl += prefix + \"connectionParams=\" + encodeURIComponent(JSON.stringify(params));\n\t}\n\treturn url;\n}\n/**\n* @see https://trpc.io/docs/client/links/httpSubscriptionLink\n*/\nfunction httpSubscriptionLink(opts) {\n\tconst transformer = getTransformer(opts.transformer);\n\treturn () => {\n\t\treturn ({ op }) => {\n\t\t\treturn observable((observer) => {\n\t\t\t\tvar _opts$EventSource;\n\t\t\t\tconst { type, path, input } = op;\n\t\t\t\t/* istanbul ignore if -- @preserve */\n\t\t\t\tif (type !== \"subscription\") throw new Error(\"httpSubscriptionLink only supports subscriptions\");\n\t\t\t\tlet lastEventId = void 0;\n\t\t\t\tconst ac = new AbortController();\n\t\t\t\tconst signal = raceAbortSignals(op.signal, ac.signal);\n\t\t\t\tconst eventSourceStream = sseStreamConsumer({\n\t\t\t\t\turl: async () => getUrl({\n\t\t\t\t\t\ttransformer,\n\t\t\t\t\t\turl: await urlWithConnectionParams(opts),\n\t\t\t\t\t\tinput: inputWithTrackedEventId(input, lastEventId),\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\tsignal: null\n\t\t\t\t\t}),\n\t\t\t\t\tinit: () => resultOf(opts.eventSourceOptions, { op }),\n\t\t\t\t\tsignal,\n\t\t\t\t\tdeserialize: (data) => transformer.output.deserialize(data),\n\t\t\t\t\tEventSource: (_opts$EventSource = opts.EventSource) !== null && _opts$EventSource !== void 0 ? _opts$EventSource : globalThis.EventSource\n\t\t\t\t});\n\t\t\t\tconst connectionState = behaviorSubject({\n\t\t\t\t\ttype: \"state\",\n\t\t\t\t\tstate: \"connecting\",\n\t\t\t\t\terror: null\n\t\t\t\t});\n\t\t\t\tconst connectionSub = connectionState.subscribe({ next(state) {\n\t\t\t\t\tobserver.next({ result: state });\n\t\t\t\t} });\n\t\t\t\trun(async () => {\n\t\t\t\t\tvar _iteratorAbruptCompletion = false;\n\t\t\t\t\tvar _didIteratorError = false;\n\t\t\t\t\tvar _iteratorError;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfor (var _iterator = (0, import_asyncIterator.default)(eventSourceStream), _step; _iteratorAbruptCompletion = !(_step = await _iterator.next()).done; _iteratorAbruptCompletion = false) {\n\t\t\t\t\t\t\tconst chunk = _step.value;\n\t\t\t\t\t\t\tswitch (chunk.type) {\n\t\t\t\t\t\t\t\tcase \"ping\": break;\n\t\t\t\t\t\t\t\tcase \"data\":\n\t\t\t\t\t\t\t\t\tconst chunkData = chunk.data;\n\t\t\t\t\t\t\t\t\tlet result;\n\t\t\t\t\t\t\t\t\tif (chunkData.id) {\n\t\t\t\t\t\t\t\t\t\tlastEventId = chunkData.id;\n\t\t\t\t\t\t\t\t\t\tresult = {\n\t\t\t\t\t\t\t\t\t\t\tid: chunkData.id,\n\t\t\t\t\t\t\t\t\t\t\tdata: chunkData\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t} else result = { data: chunkData.data };\n\t\t\t\t\t\t\t\t\tobserver.next({\n\t\t\t\t\t\t\t\t\t\tresult,\n\t\t\t\t\t\t\t\t\t\tcontext: { eventSource: chunk.eventSource }\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"connected\": {\n\t\t\t\t\t\t\t\t\tobserver.next({\n\t\t\t\t\t\t\t\t\t\tresult: { type: \"started\" },\n\t\t\t\t\t\t\t\t\t\tcontext: { eventSource: chunk.eventSource }\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tconnectionState.next({\n\t\t\t\t\t\t\t\t\t\ttype: \"state\",\n\t\t\t\t\t\t\t\t\t\tstate: \"pending\",\n\t\t\t\t\t\t\t\t\t\terror: null\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"serialized-error\": {\n\t\t\t\t\t\t\t\t\tconst error = TRPCClientError.from({ error: chunk.error });\n\t\t\t\t\t\t\t\t\tif (retryableRpcCodes.includes(chunk.error.code)) {\n\t\t\t\t\t\t\t\t\t\tconnectionState.next({\n\t\t\t\t\t\t\t\t\t\t\ttype: \"state\",\n\t\t\t\t\t\t\t\t\t\t\tstate: \"connecting\",\n\t\t\t\t\t\t\t\t\t\t\terror\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"connecting\": {\n\t\t\t\t\t\t\t\t\tconst lastState = connectionState.get();\n\t\t\t\t\t\t\t\t\tconst error = chunk.event && TRPCClientError.from(chunk.event);\n\t\t\t\t\t\t\t\t\tif (!error && lastState.state === \"connecting\") break;\n\t\t\t\t\t\t\t\t\tconnectionState.next({\n\t\t\t\t\t\t\t\t\t\ttype: \"state\",\n\t\t\t\t\t\t\t\t\t\tstate: \"connecting\",\n\t\t\t\t\t\t\t\t\t\terror\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase \"timeout\": connectionState.next({\n\t\t\t\t\t\t\t\t\ttype: \"state\",\n\t\t\t\t\t\t\t\t\tstate: \"connecting\",\n\t\t\t\t\t\t\t\t\terror: new TRPCClientError(`Timeout of ${chunk.ms}ms reached while waiting for a response`)\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t_didIteratorError = true;\n\t\t\t\t\t\t_iteratorError = err;\n\t\t\t\t\t} finally {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif (_iteratorAbruptCompletion && _iterator.return != null) await _iterator.return();\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tobserver.next({ result: { type: \"stopped\" } });\n\t\t\t\t\tconnectionState.next({\n\t\t\t\t\t\ttype: \"state\",\n\t\t\t\t\t\tstate: \"idle\",\n\t\t\t\t\t\terror: null\n\t\t\t\t\t});\n\t\t\t\t\tobserver.complete();\n\t\t\t\t}).catch((error) => {\n\t\t\t\t\tobserver.error(TRPCClientError.from(error));\n\t\t\t\t});\n\t\t\t\treturn () => {\n\t\t\t\t\tobserver.complete();\n\t\t\t\t\tac.abort();\n\t\t\t\t\tconnectionSub.unsubscribe();\n\t\t\t\t};\n\t\t\t});\n\t\t};\n\t};\n}\n/**\n* @deprecated use {@link httpSubscriptionLink} instead\n*/\nconst unstable_httpSubscriptionLink = httpSubscriptionLink;\n\n//#endregion\n//#region src/links/retryLink.ts\nvar import_objectSpread2$1 = __toESM(require_objectSpread2(), 1);\n/**\n* @see https://trpc.io/docs/v11/client/links/retryLink\n*/\nfunction retryLink(opts) {\n\treturn () => {\n\t\treturn (callOpts) => {\n\t\t\treturn observable((observer) => {\n\t\t\t\tlet next$;\n\t\t\t\tlet callNextTimeout = void 0;\n\t\t\t\tlet lastEventId = void 0;\n\t\t\t\tattempt(1);\n\t\t\t\tfunction opWithLastEventId() {\n\t\t\t\t\tconst op = callOpts.op;\n\t\t\t\t\tif (!lastEventId) return op;\n\t\t\t\t\treturn (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, op), {}, { input: inputWithTrackedEventId(op.input, lastEventId) });\n\t\t\t\t}\n\t\t\t\tfunction attempt(attempts) {\n\t\t\t\t\tconst op = opWithLastEventId();\n\t\t\t\t\tnext$ = callOpts.next(op).subscribe({\n\t\t\t\t\t\terror(error) {\n\t\t\t\t\t\t\tvar _opts$retryDelayMs, _opts$retryDelayMs2;\n\t\t\t\t\t\t\tconst shouldRetry = opts.retry({\n\t\t\t\t\t\t\t\top,\n\t\t\t\t\t\t\t\tattempts,\n\t\t\t\t\t\t\t\terror\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (!shouldRetry) {\n\t\t\t\t\t\t\t\tobserver.error(error);\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst delayMs = (_opts$retryDelayMs = (_opts$retryDelayMs2 = opts.retryDelayMs) === null || _opts$retryDelayMs2 === void 0 ? void 0 : _opts$retryDelayMs2.call(opts, attempts)) !== null && _opts$retryDelayMs !== void 0 ? _opts$retryDelayMs : 0;\n\t\t\t\t\t\t\tif (delayMs <= 0) {\n\t\t\t\t\t\t\t\tattempt(attempts + 1);\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcallNextTimeout = setTimeout(() => attempt(attempts + 1), delayMs);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnext(envelope) {\n\t\t\t\t\t\t\tif ((!envelope.result.type || envelope.result.type === \"data\") && envelope.result.id) lastEventId = envelope.result.id;\n\t\t\t\t\t\t\tobserver.next(envelope);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcomplete() {\n\t\t\t\t\t\t\tobserver.complete();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn () => {\n\t\t\t\t\tnext$.unsubscribe();\n\t\t\t\t\tclearTimeout(callNextTimeout);\n\t\t\t\t};\n\t\t\t});\n\t\t};\n\t};\n}\n\n//#endregion\n//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js\nvar require_usingCtx = __commonJS({ \"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js\"(exports, module) {\n\tfunction _usingCtx() {\n\t\tvar r = \"function\" == typeof SuppressedError ? SuppressedError : function(r$1, e$1) {\n\t\t\tvar n$1 = Error();\n\t\t\treturn n$1.name = \"SuppressedError\", n$1.error = r$1, n$1.suppressed = e$1, n$1;\n\t\t}, e = {}, n = [];\n\t\tfunction using(r$1, e$1) {\n\t\t\tif (null != e$1) {\n\t\t\t\tif (Object(e$1) !== e$1) throw new TypeError(\"using declarations can only be used with objects, functions, null, or undefined.\");\n\t\t\t\tif (r$1) var o = e$1[Symbol.asyncDispose || Symbol[\"for\"](\"Symbol.asyncDispose\")];\n\t\t\t\tif (void 0 === o && (o = e$1[Symbol.dispose || Symbol[\"for\"](\"Symbol.dispose\")], r$1)) var t = o;\n\t\t\t\tif (\"function\" != typeof o) throw new TypeError(\"Object is not disposable.\");\n\t\t\t\tt && (o = function o$1() {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tt.call(e$1);\n\t\t\t\t\t} catch (r$2) {\n\t\t\t\t\t\treturn Promise.reject(r$2);\n\t\t\t\t\t}\n\t\t\t\t}), n.push({\n\t\t\t\t\tv: e$1,\n\t\t\t\t\td: o,\n\t\t\t\t\ta: r$1\n\t\t\t\t});\n\t\t\t} else r$1 && n.push({\n\t\t\t\td: e$1,\n\t\t\t\ta: r$1\n\t\t\t});\n\t\t\treturn e$1;\n\t\t}\n\t\treturn {\n\t\t\te,\n\t\t\tu: using.bind(null, !1),\n\t\t\ta: using.bind(null, !0),\n\t\t\td: function d() {\n\t\t\t\tvar o, t = this.e, s = 0;\n\t\t\t\tfunction next() {\n\t\t\t\t\tfor (; o = n.pop();) try {\n\t\t\t\t\t\tif (!o.a && 1 === s) return s = 0, n.push(o), Promise.resolve().then(next);\n\t\t\t\t\t\tif (o.d) {\n\t\t\t\t\t\t\tvar r$1 = o.d.call(o.v);\n\t\t\t\t\t\t\tif (o.a) return s |= 2, Promise.resolve(r$1).then(next, err);\n\t\t\t\t\t\t} else s |= 1;\n\t\t\t\t\t} catch (r$2) {\n\t\t\t\t\t\treturn err(r$2);\n\t\t\t\t\t}\n\t\t\t\t\tif (1 === s) return t !== e ? Promise.reject(t) : Promise.resolve();\n\t\t\t\t\tif (t !== e) throw t;\n\t\t\t\t}\n\t\t\t\tfunction err(n$1) {\n\t\t\t\t\treturn t = t !== e ? new r(n$1, t) : n$1, next();\n\t\t\t\t}\n\t\t\t\treturn next();\n\t\t\t}\n\t\t};\n\t}\n\tmodule.exports = _usingCtx, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n} });\n\n//#endregion\n//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js\nvar require_OverloadYield = __commonJS({ \"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js\"(exports, module) {\n\tfunction _OverloadYield(e, d) {\n\t\tthis.v = e, this.k = d;\n\t}\n\tmodule.exports = _OverloadYield, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n} });\n\n//#endregion\n//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js\nvar require_awaitAsyncGenerator = __commonJS({ \"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js\"(exports, module) {\n\tvar OverloadYield$1 = require_OverloadYield();\n\tfunction _awaitAsyncGenerator$1(e) {\n\t\treturn new OverloadYield$1(e, 0);\n\t}\n\tmodule.exports = _awaitAsyncGenerator$1, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n} });\n\n//#endregion\n//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js\nvar require_wrapAsyncGenerator = __commonJS({ \"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js\"(exports, module) {\n\tvar OverloadYield = require_OverloadYield();\n\tfunction _wrapAsyncGenerator$1(e) {\n\t\treturn function() {\n\t\t\treturn new AsyncGenerator(e.apply(this, arguments));\n\t\t};\n\t}\n\tfunction AsyncGenerator(e) {\n\t\tvar r, t;\n\t\tfunction resume(r$1, t$1) {\n\t\t\ttry {\n\t\t\t\tvar n = e[r$1](t$1), o = n.value, u = o instanceof OverloadYield;\n\t\t\t\tPromise.resolve(u ? o.v : o).then(function(t$2) {\n\t\t\t\t\tif (u) {\n\t\t\t\t\t\tvar i = \"return\" === r$1 ? \"return\" : \"next\";\n\t\t\t\t\t\tif (!o.k || t$2.done) return resume(i, t$2);\n\t\t\t\t\t\tt$2 = e[i](t$2).value;\n\t\t\t\t\t}\n\t\t\t\t\tsettle(n.done ? \"return\" : \"normal\", t$2);\n\t\t\t\t}, function(e$1) {\n\t\t\t\t\tresume(\"throw\", e$1);\n\t\t\t\t});\n\t\t\t} catch (e$1) {\n\t\t\t\tsettle(\"throw\", e$1);\n\t\t\t}\n\t\t}\n\t\tfunction settle(e$1, n) {\n\t\t\tswitch (e$1) {\n\t\t\t\tcase \"return\":\n\t\t\t\t\tr.resolve({\n\t\t\t\t\t\tvalue: n,\n\t\t\t\t\t\tdone: !0\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"throw\":\n\t\t\t\t\tr.reject(n);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: r.resolve({\n\t\t\t\t\tvalue: n,\n\t\t\t\t\tdone: !1\n\t\t\t\t});\n\t\t\t}\n\t\t\t(r = r.next) ? resume(r.key, r.arg) : t = null;\n\t\t}\n\t\tthis._invoke = function(e$1, n) {\n\t\t\treturn new Promise(function(o, u) {\n\t\t\t\tvar i = {\n\t\t\t\t\tkey: e$1,\n\t\t\t\t\targ: n,\n\t\t\t\t\tresolve: o,\n\t\t\t\t\treject: u,\n\t\t\t\t\tnext: null\n\t\t\t\t};\n\t\t\t\tt ? t = t.next = i : (r = t = i, resume(e$1, n));\n\t\t\t});\n\t\t}, \"function\" != typeof e[\"return\"] && (this[\"return\"] = void 0);\n\t}\n\tAsyncGenerator.prototype[\"function\" == typeof Symbol && Symbol.asyncIterator || \"@@asyncIterator\"] = function() {\n\t\treturn this;\n\t}, AsyncGenerator.prototype.next = function(e) {\n\t\treturn this._invoke(\"next\", e);\n\t}, AsyncGenerator.prototype[\"throw\"] = function(e) {\n\t\treturn this._invoke(\"throw\", e);\n\t}, AsyncGenerator.prototype[\"return\"] = function(e) {\n\t\treturn this._invoke(\"return\", e);\n\t};\n\tmodule.exports = _wrapAsyncGenerator$1, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n} });\n\n//#endregion\n//#region src/links/localLink.ts\nvar import_usingCtx = __toESM(require_usingCtx(), 1);\nvar import_awaitAsyncGenerator = __toESM(require_awaitAsyncGenerator(), 1);\nvar import_wrapAsyncGenerator = __toESM(require_wrapAsyncGenerator(), 1);\nvar import_objectSpread2 = __toESM(require_objectSpread2(), 1);\n/**\n* localLink is a terminating link that allows you to make tRPC procedure calls directly in your application without going through HTTP.\n*\n* @see https://trpc.io/docs/links/localLink\n*/\nfunction unstable_localLink(opts) {\n\tconst transformer = getTransformer(opts.transformer);\n\tconst transformChunk = (chunk) => {\n\t\tif (opts.transformer) return chunk;\n\t\tif (chunk === void 0) return chunk;\n\t\tconst serialized = JSON.stringify(transformer.input.serialize(chunk));\n\t\tconst deserialized = JSON.parse(transformer.output.deserialize(serialized));\n\t\treturn deserialized;\n\t};\n\treturn () => ({ op }) => observable((observer) => {\n\t\tlet ctx = void 0;\n\t\tconst ac = new AbortController();\n\t\tconst signal = raceAbortSignals(op.signal, ac.signal);\n\t\tconst signalPromise = abortSignalToPromise(signal);\n\t\tsignalPromise.catch(() => {});\n\t\tlet input = op.input;\n\t\tasync function runProcedure(newInput) {\n\t\t\tinput = newInput;\n\t\t\tctx = await opts.createContext();\n\t\t\treturn callProcedure({\n\t\t\t\trouter: opts.router,\n\t\t\t\tpath: op.path,\n\t\t\t\tgetRawInput: async () => newInput,\n\t\t\t\tctx,\n\t\t\t\ttype: op.type,\n\t\t\t\tsignal,\n\t\t\t\tbatchIndex: 0\n\t\t\t});\n\t\t}\n\t\tfunction onErrorCallback(cause) {\n\t\t\tvar _opts$onError;\n\t\t\tif (isAbortError(cause)) return;\n\t\t\t(_opts$onError = opts.onError) === null || _opts$onError === void 0 || _opts$onError.call(opts, {\n\t\t\t\terror: getTRPCErrorFromUnknown(cause),\n\t\t\t\ttype: op.type,\n\t\t\t\tpath: op.path,\n\t\t\t\tinput,\n\t\t\t\tctx\n\t\t\t});\n\t\t}\n\t\tfunction coerceToTRPCClientError(cause) {\n\t\t\tif (isTRPCClientError(cause)) return cause;\n\t\t\tconst error = getTRPCErrorFromUnknown(cause);\n\t\t\tconst shape = getTRPCErrorShape({\n\t\t\t\tconfig: opts.router._def._config,\n\t\t\t\tctx,\n\t\t\t\terror,\n\t\t\t\tinput,\n\t\t\t\tpath: op.path,\n\t\t\t\ttype: op.type\n\t\t\t});\n\t\t\treturn TRPCClientError.from({ error: transformChunk(shape) }, { cause: cause instanceof Error ? cause : void 0 });\n\t\t}\n\t\trun(async () => {\n\t\t\tswitch (op.type) {\n\t\t\t\tcase \"query\":\n\t\t\t\tcase \"mutation\": {\n\t\t\t\t\tconst result = await runProcedure(op.input);\n\t\t\t\t\tif (!isAsyncIterable(result)) {\n\t\t\t\t\t\tobserver.next({ result: { data: transformChunk(result) } });\n\t\t\t\t\t\tobserver.complete();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tobserver.next({ result: { data: (0, import_wrapAsyncGenerator.default)(function* () {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tvar _usingCtx$1 = (0, import_usingCtx.default)();\n\t\t\t\t\t\t\tconst iterator = _usingCtx$1.a(iteratorResource(result));\n\t\t\t\t\t\t\tconst _finally = _usingCtx$1.u(makeResource({}, () => {\n\t\t\t\t\t\t\t\tobserver.complete();\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\twhile (true) {\n\t\t\t\t\t\t\t\t\tconst res = yield (0, import_awaitAsyncGenerator.default)(Promise.race([iterator.next(), signalPromise]));\n\t\t\t\t\t\t\t\t\tif (res.done) return transformChunk(res.value);\n\t\t\t\t\t\t\t\t\tyield transformChunk(res.value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} catch (cause) {\n\t\t\t\t\t\t\t\tonErrorCallback(cause);\n\t\t\t\t\t\t\t\tthrow coerceToTRPCClientError(cause);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (_) {\n\t\t\t\t\t\t\t_usingCtx$1.e = _;\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tyield (0, import_awaitAsyncGenerator.default)(_usingCtx$1.d());\n\t\t\t\t\t\t}\n\t\t\t\t\t})() } });\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"subscription\": try {\n\t\t\t\t\tvar _usingCtx3 = (0, import_usingCtx.default)();\n\t\t\t\t\tconst connectionState = behaviorSubject({\n\t\t\t\t\t\ttype: \"state\",\n\t\t\t\t\t\tstate: \"connecting\",\n\t\t\t\t\t\terror: null\n\t\t\t\t\t});\n\t\t\t\t\tconst connectionSub = connectionState.subscribe({ next(state) {\n\t\t\t\t\t\tobserver.next({ result: state });\n\t\t\t\t\t} });\n\t\t\t\t\tlet lastEventId = void 0;\n\t\t\t\t\tconst _finally = _usingCtx3.u(makeResource({}, async () => {\n\t\t\t\t\t\tobserver.complete();\n\t\t\t\t\t\tconnectionState.next({\n\t\t\t\t\t\t\ttype: \"state\",\n\t\t\t\t\t\t\tstate: \"idle\",\n\t\t\t\t\t\t\terror: null\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconnectionSub.unsubscribe();\n\t\t\t\t\t}));\n\t\t\t\t\twhile (true) try {\n\t\t\t\t\t\tvar _usingCtx4 = (0, import_usingCtx.default)();\n\t\t\t\t\t\tconst result = await runProcedure(inputWithTrackedEventId(op.input, lastEventId));\n\t\t\t\t\t\tif (!isAsyncIterable(result)) throw new Error(\"Expected an async iterable\");\n\t\t\t\t\t\tconst iterator = _usingCtx4.a(iteratorResource(result));\n\t\t\t\t\t\tobserver.next({ result: { type: \"started\" } });\n\t\t\t\t\t\tconnectionState.next({\n\t\t\t\t\t\t\ttype: \"state\",\n\t\t\t\t\t\t\tstate: \"pending\",\n\t\t\t\t\t\t\terror: null\n\t\t\t\t\t\t});\n\t\t\t\t\t\twhile (true) {\n\t\t\t\t\t\t\tlet res;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tres = await Promise.race([iterator.next(), signalPromise]);\n\t\t\t\t\t\t\t} catch (cause) {\n\t\t\t\t\t\t\t\tif (isAbortError(cause)) return;\n\t\t\t\t\t\t\t\tconst error = getTRPCErrorFromUnknown(cause);\n\t\t\t\t\t\t\t\tif (!retryableRpcCodes.includes(TRPC_ERROR_CODES_BY_KEY[error.code])) throw coerceToTRPCClientError(error);\n\t\t\t\t\t\t\t\tonErrorCallback(error);\n\t\t\t\t\t\t\t\tconnectionState.next({\n\t\t\t\t\t\t\t\t\ttype: \"state\",\n\t\t\t\t\t\t\t\t\tstate: \"connecting\",\n\t\t\t\t\t\t\t\t\terror: coerceToTRPCClientError(error)\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (res.done) return;\n\t\t\t\t\t\t\tlet chunk;\n\t\t\t\t\t\t\tif (isTrackedEnvelope(res.value)) {\n\t\t\t\t\t\t\t\tlastEventId = res.value[0];\n\t\t\t\t\t\t\t\tchunk = {\n\t\t\t\t\t\t\t\t\tid: res.value[0],\n\t\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t\tid: res.value[0],\n\t\t\t\t\t\t\t\t\t\tdata: res.value[1]\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t} else chunk = { data: res.value };\n\t\t\t\t\t\t\tobserver.next({ result: (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, chunk), {}, { data: transformChunk(chunk.data) }) });\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (_) {\n\t\t\t\t\t\t_usingCtx4.e = _;\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tawait _usingCtx4.d();\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t} catch (_) {\n\t\t\t\t\t_usingCtx3.e = _;\n\t\t\t\t} finally {\n\t\t\t\t\t_usingCtx3.d();\n\t\t\t\t}\n\t\t\t}\n\t\t}).catch((cause) => {\n\t\t\tonErrorCallback(cause);\n\t\t\tobserver.error(coerceToTRPCClientError(cause));\n\t\t});\n\t\treturn () => {\n\t\t\tac.abort();\n\t\t};\n\t});\n}\n/**\n* @deprecated Renamed to `unstable_localLink`. This alias will be removed in a future major release.\n*/\nconst experimental_localLink = unstable_localLink;\n\n//#endregion\nexport { TRPCClientError, TRPCUntypedClient, clientCallTypeToProcedureType, createTRPCClient, createTRPCClientProxy, createTRPCClient as createTRPCProxyClient, createTRPCUntypedClient, createWSClient, experimental_localLink, getFetch, getUntypedClient, httpBatchLink, httpBatchStreamLink, httpLink, httpSubscriptionLink, isFormData, isNonJsonSerializable, isOctetType, isTRPCClientError, jsonEncoder, loggerLink, retryLink, splitLink, unstable_httpBatchStreamLink, unstable_httpSubscriptionLink, unstable_localLink, wsLink };\n//# sourceMappingURL=index.mjs.map","#!/usr/bin/env node\n\nimport { Command } from 'commander';\nimport { createTRPCClient, httpLink } from '@trpc/client';\nimport type { AppRouter } from '../daemon/router.js';\nimport type { CronJob } from '../shared/config.js';\n\n/**\n * clawmini-lite - A standalone client\n */\nconst API_URL = process.env.CLAW_API_URL;\nconst API_TOKEN = process.env.CLAW_API_TOKEN;\n\nfunction getClient() {\n return createTRPCClient<AppRouter>({\n links: [\n httpLink({\n url: API_URL as string,\n headers() {\n return {\n Authorization: `Bearer ${API_TOKEN}`,\n 'Content-Type': 'application/json',\n };\n },\n }),\n ],\n });\n}\n\nconst program = new Command();\n\nprogram\n .name('clawmini-lite')\n .description('A standalone client for clawmini')\n .hook('preAction', () => {\n if (!API_URL || !API_TOKEN) {\n console.error('CLAW_API_URL and CLAW_API_TOKEN must be set in the environment.');\n process.exit(1);\n }\n });\n\nprogram\n .command('log [message]')\n .description('Log a message')\n .option(\n '-f, --file <path>',\n 'File path(s) to attach (can specify multiple)',\n (val: string, prev: string[]) => prev.concat([val]),\n []\n )\n .action(async (message, options) => {\n try {\n const files = options.file.length > 0 ? options.file : undefined;\n const payload: { message?: string; files?: string[] } = {};\n if (message !== undefined) payload.message = message;\n if (files !== undefined) payload.files = files;\n\n const client = getClient();\n await client.logMessage.mutate(payload);\n console.log('Log message appended.');\n } catch (err) {\n console.error('Error:', err instanceof Error ? err.message : err);\n process.exit(1);\n }\n });\n\nconst jobs = program.command('jobs').description('Manage cron jobs');\n\njobs\n .command('list')\n .description('List cron jobs')\n .action(async () => {\n try {\n const client = getClient();\n const jobsList = await client.listCronJobs.query({});\n console.log(JSON.stringify(jobsList, null, 2));\n } catch (err) {\n console.error('Error:', err instanceof Error ? err.message : err);\n process.exit(1);\n }\n });\n\njobs\n .command('add <name>')\n .description('Add a cron job')\n .option('--at <time>', 'Schedule at specific time')\n .option('--every <interval>', 'Schedule at interval')\n .option('--cron <cron>', 'Schedule via cron expression')\n .option('-m, --message <msg>', 'Message to send')\n .option('-r, --reply <reply>', 'Reply text')\n .option('-a, --agent <agentId>', 'Agent ID')\n .option('-s, --session <type>', 'Session type (must be \"new\")')\n .option(\n '-e, --env <env>',\n 'Environment variables in key=value format',\n (val: string, prev: string[]) => prev.concat([val]),\n []\n )\n .option('-c, --chat <chatId>', 'Chat ID')\n .action(async (name, options) => {\n try {\n let schedule;\n if (options.at) schedule = { at: options.at };\n else if (options.every) schedule = { every: options.every };\n else if (options.cron) schedule = { cron: options.cron };\n else throw new Error('A schedule must be specified (--at, --every, or --cron).');\n\n const job: CronJob = {\n id: name,\n createdAt: new Date().toISOString(),\n message: options.message || '',\n schedule,\n };\n\n if (options.reply) job.reply = options.reply;\n if (options.agent) job.agentId = options.agent;\n if (options.session) {\n if (options.session !== 'new') throw new Error('Only \"new\" session type is supported.');\n job.session = { type: 'new' };\n }\n\n if (options.env && options.env.length > 0) {\n const jobEnv: Record<string, string> = {};\n for (const e of options.env) {\n const [k, ...v] = e.split('=');\n if (k) jobEnv[k] = v.join('=');\n }\n job.env = jobEnv;\n }\n\n const client = getClient();\n await client.addCronJob.mutate({ chatId: options.chat, job });\n console.log(`Job '${name}' created successfully.`);\n } catch (err) {\n console.error('Error:', err instanceof Error ? err.message : err);\n process.exit(1);\n }\n });\n\njobs\n .command('delete <name>')\n .description('Delete a cron job')\n .option('-c, --chat <chatId>', 'Chat ID')\n .action(async (name, options) => {\n try {\n const client = getClient();\n const result = await client.deleteCronJob.mutate({ chatId: options.chat, id: name });\n if (result && result.deleted) {\n console.log(`Job '${name}' deleted successfully.`);\n } else {\n console.log(`Job '${name}' not found.`);\n }\n } catch (err) {\n console.error('Error:', err instanceof Error ? err.message : err);\n process.exit(1);\n }\n });\n\nprogram.parse(process.argv);\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGA,IAAM,iBAAN,cAA6B,MAAM;;;;;;;EAOjC,YAAY,UAAU,MAAM,SAAS;AACnC,SAAM,QAAQ;AAEd,SAAM,kBAAkB,MAAM,KAAK,YAAY;AAC/C,QAAK,OAAO,KAAK,YAAY;AAC7B,QAAK,OAAO;AACZ,QAAK,WAAW;AAChB,QAAK,cAAc;;;;;;CAOvB,IAAM,uBAAN,cAAmC,eAAe;;;;;EAKhD,YAAY,SAAS;AACnB,SAAM,GAAG,6BAA6B,QAAQ;AAE9C,SAAM,kBAAkB,MAAM,KAAK,YAAY;AAC/C,QAAK,OAAO,KAAK,YAAY;;;AAIjC,SAAQ,iBAAiB;AACzB,SAAQ,uBAAuB;;;;;;CCtC/B,MAAM,EAAE;CAER,IAAM,WAAN,MAAe;;;;;;;;;EAUb,YAAY,MAAM,aAAa;AAC7B,QAAK,cAAc,eAAe;AAClC,QAAK,WAAW;AAChB,QAAK,WAAW;AAChB,QAAK,eAAe;AACpB,QAAK,0BAA0B;AAC/B,QAAK,aAAa;AAElB,WAAQ,KAAK,IAAb;IACE,KAAK;AACH,UAAK,WAAW;AAChB,UAAK,QAAQ,KAAK,MAAM,GAAG,GAAG;AAC9B;IACF,KAAK;AACH,UAAK,WAAW;AAChB,UAAK,QAAQ,KAAK,MAAM,GAAG,GAAG;AAC9B;IACF;AACE,UAAK,WAAW;AAChB,UAAK,QAAQ;AACb;;AAGJ,OAAI,KAAK,MAAM,SAAS,MAAM,EAAE;AAC9B,SAAK,WAAW;AAChB,SAAK,QA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