expandai 0.0.3 → 0.0.5

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 (320) hide show
  1. package/build/{esm/Install/Opencode → assets/opencode}/expandai-webfetch.js +22 -4
  2. package/build/dts/Mcp/RequestHeaders.d.ts +0 -1
  3. package/build/dts/Mcp/Server.d.ts +1 -2
  4. package/build/dts/index.d.ts +0 -1
  5. package/build/esm/index.js +180 -2
  6. package/build/esm/main.js +677 -200
  7. package/build/skills/expandai/SKILL.md +12 -6
  8. package/package.json +19 -11
  9. package/build/dts/ApiClient.d.ts +0 -165
  10. package/build/dts/ApiClient.d.ts.map +0 -1
  11. package/build/dts/Auth/Domain.d.ts +0 -95
  12. package/build/dts/Auth/Domain.d.ts.map +0 -1
  13. package/build/dts/Auth/ManualAuthorization.d.ts +0 -107
  14. package/build/dts/Auth/ManualAuthorization.d.ts.map +0 -1
  15. package/build/dts/Auth/PendingInit.d.ts +0 -35
  16. package/build/dts/Auth/PendingInit.d.ts.map +0 -1
  17. package/build/dts/Auth/Pkce.d.ts +0 -10
  18. package/build/dts/Auth/Pkce.d.ts.map +0 -1
  19. package/build/dts/Auth/SetupGrantAuthorization.d.ts +0 -34
  20. package/build/dts/Auth/SetupGrantAuthorization.d.ts.map +0 -1
  21. package/build/dts/Authentication.d.ts +0 -24
  22. package/build/dts/Authentication.d.ts.map +0 -1
  23. package/build/dts/BrowserOAuth.d.ts +0 -99
  24. package/build/dts/BrowserOAuth.d.ts.map +0 -1
  25. package/build/dts/CommandPath.d.ts +0 -2
  26. package/build/dts/CommandPath.d.ts.map +0 -1
  27. package/build/dts/Commands/Fetch.d.ts +0 -30
  28. package/build/dts/Commands/Fetch.d.ts.map +0 -1
  29. package/build/dts/Commands/Hook.d.ts +0 -17
  30. package/build/dts/Commands/Hook.d.ts.map +0 -1
  31. package/build/dts/Commands/Init.d.ts +0 -55
  32. package/build/dts/Commands/Init.d.ts.map +0 -1
  33. package/build/dts/Commands/Mcp.d.ts +0 -11
  34. package/build/dts/Commands/Mcp.d.ts.map +0 -1
  35. package/build/dts/Commands/McpRun.d.ts +0 -5
  36. package/build/dts/Commands/McpRun.d.ts.map +0 -1
  37. package/build/dts/Commands/Search.d.ts +0 -21
  38. package/build/dts/Commands/Search.d.ts.map +0 -1
  39. package/build/dts/Commands/Skill.d.ts +0 -12
  40. package/build/dts/Commands/Skill.d.ts.map +0 -1
  41. package/build/dts/Commands/Status.d.ts +0 -27
  42. package/build/dts/Commands/Status.d.ts.map +0 -1
  43. package/build/dts/Commands/Telemetry.d.ts +0 -7
  44. package/build/dts/Commands/Telemetry.d.ts.map +0 -1
  45. package/build/dts/Commands/Uninstall.d.ts +0 -9
  46. package/build/dts/Commands/Uninstall.d.ts.map +0 -1
  47. package/build/dts/Config.d.ts +0 -196
  48. package/build/dts/Config.d.ts.map +0 -1
  49. package/build/dts/Hook/Claude.d.ts +0 -13
  50. package/build/dts/Hook/Claude.d.ts.map +0 -1
  51. package/build/dts/Hook/Errors.d.ts +0 -20
  52. package/build/dts/Hook/Errors.d.ts.map +0 -1
  53. package/build/dts/Hook/Opencode.d.ts +0 -13
  54. package/build/dts/Hook/Opencode.d.ts.map +0 -1
  55. package/build/dts/Hook/SnapshotNote.d.ts +0 -12
  56. package/build/dts/Hook/SnapshotNote.d.ts.map +0 -1
  57. package/build/dts/Init/ClaudeAdapter.d.ts +0 -61
  58. package/build/dts/Init/ClaudeAdapter.d.ts.map +0 -1
  59. package/build/dts/Init/ClaudeProfile.d.ts +0 -78
  60. package/build/dts/Init/ClaudeProfile.d.ts.map +0 -1
  61. package/build/dts/Init/Domain.d.ts +0 -139
  62. package/build/dts/Init/Domain.d.ts.map +0 -1
  63. package/build/dts/Init/HarnessAdapter.d.ts +0 -33
  64. package/build/dts/Init/HarnessAdapter.d.ts.map +0 -1
  65. package/build/dts/Init/HarnessDetector.d.ts +0 -19
  66. package/build/dts/Init/HarnessDetector.d.ts.map +0 -1
  67. package/build/dts/Init/HarnessRegistry.d.ts +0 -50
  68. package/build/dts/Init/HarnessRegistry.d.ts.map +0 -1
  69. package/build/dts/Init/MutationTransaction.d.ts +0 -96
  70. package/build/dts/Init/MutationTransaction.d.ts.map +0 -1
  71. package/build/dts/Init/Service.d.ts +0 -72
  72. package/build/dts/Init/Service.d.ts.map +0 -1
  73. package/build/dts/Init/StandardAdapters.d.ts +0 -42
  74. package/build/dts/Init/StandardAdapters.d.ts.map +0 -1
  75. package/build/dts/Init/Status.d.ts +0 -149
  76. package/build/dts/Init/Status.d.ts.map +0 -1
  77. package/build/dts/Install/Claude/Hook.d.ts +0 -120
  78. package/build/dts/Install/Claude/Hook.d.ts.map +0 -1
  79. package/build/dts/Install/Claude/Mcp.d.ts +0 -48
  80. package/build/dts/Install/Claude/Mcp.d.ts.map +0 -1
  81. package/build/dts/Install/Claude/Skill.d.ts +0 -23
  82. package/build/dts/Install/Claude/Skill.d.ts.map +0 -1
  83. package/build/dts/Install/Codex/Mcp.d.ts +0 -45
  84. package/build/dts/Install/Codex/Mcp.d.ts.map +0 -1
  85. package/build/dts/Install/Codex/Skill.d.ts +0 -22
  86. package/build/dts/Install/Codex/Skill.d.ts.map +0 -1
  87. package/build/dts/Install/Cursor/Mcp.d.ts +0 -45
  88. package/build/dts/Install/Cursor/Mcp.d.ts.map +0 -1
  89. package/build/dts/Install/Cursor/Skill.d.ts +0 -29
  90. package/build/dts/Install/Cursor/Skill.d.ts.map +0 -1
  91. package/build/dts/Install/Domain.d.ts +0 -103
  92. package/build/dts/Install/Domain.d.ts.map +0 -1
  93. package/build/dts/Install/Hook.d.ts +0 -30
  94. package/build/dts/Install/Hook.d.ts.map +0 -1
  95. package/build/dts/Install/Mcp.d.ts +0 -28
  96. package/build/dts/Install/Mcp.d.ts.map +0 -1
  97. package/build/dts/Install/Opencode/Hook.d.ts +0 -24
  98. package/build/dts/Install/Opencode/Hook.d.ts.map +0 -1
  99. package/build/dts/Install/Opencode/Mcp.d.ts +0 -47
  100. package/build/dts/Install/Opencode/Mcp.d.ts.map +0 -1
  101. package/build/dts/Install/Opencode/Skill.d.ts +0 -26
  102. package/build/dts/Install/Opencode/Skill.d.ts.map +0 -1
  103. package/build/dts/Install/Skill.d.ts +0 -32
  104. package/build/dts/Install/Skill.d.ts.map +0 -1
  105. package/build/dts/Install/Uninstall.d.ts +0 -32
  106. package/build/dts/Install/Uninstall.d.ts.map +0 -1
  107. package/build/dts/MarkdownAnsi.d.ts +0 -29
  108. package/build/dts/MarkdownAnsi.d.ts.map +0 -1
  109. package/build/dts/Mcp/ExpandDocs.d.ts +0 -19
  110. package/build/dts/Mcp/ExpandDocs.d.ts.map +0 -1
  111. package/build/dts/Mcp/RequestHeaders.d.ts.map +0 -1
  112. package/build/dts/Mcp/Server.d.ts.map +0 -1
  113. package/build/dts/Mcp/Toolkit.d.ts +0 -3
  114. package/build/dts/Mcp/Toolkit.d.ts.map +0 -1
  115. package/build/dts/Mcp/tools/Citations.d.ts +0 -266
  116. package/build/dts/Mcp/tools/Citations.d.ts.map +0 -1
  117. package/build/dts/Mcp/tools/Fetch.d.ts +0 -168
  118. package/build/dts/Mcp/tools/Fetch.d.ts.map +0 -1
  119. package/build/dts/SecureFile.d.ts +0 -23
  120. package/build/dts/SecureFile.d.ts.map +0 -1
  121. package/build/dts/Snippets.d.ts +0 -18
  122. package/build/dts/Snippets.d.ts.map +0 -1
  123. package/build/dts/Telemetry.d.ts +0 -30
  124. package/build/dts/Telemetry.d.ts.map +0 -1
  125. package/build/dts/Version.d.ts +0 -2
  126. package/build/dts/Version.d.ts.map +0 -1
  127. package/build/dts/Xdg.d.ts +0 -11
  128. package/build/dts/Xdg.d.ts.map +0 -1
  129. package/build/dts/index.d.ts.map +0 -1
  130. package/build/dts/main.d.ts +0 -3
  131. package/build/dts/main.d.ts.map +0 -1
  132. package/build/esm/ApiClient.js +0 -305
  133. package/build/esm/ApiClient.js.map +0 -1
  134. package/build/esm/Auth/Domain.js +0 -56
  135. package/build/esm/Auth/Domain.js.map +0 -1
  136. package/build/esm/Auth/ManualAuthorization.js +0 -253
  137. package/build/esm/Auth/ManualAuthorization.js.map +0 -1
  138. package/build/esm/Auth/PendingInit.js +0 -267
  139. package/build/esm/Auth/PendingInit.js.map +0 -1
  140. package/build/esm/Auth/Pkce.js +0 -23
  141. package/build/esm/Auth/Pkce.js.map +0 -1
  142. package/build/esm/Auth/SetupGrantAuthorization.js +0 -91
  143. package/build/esm/Auth/SetupGrantAuthorization.js.map +0 -1
  144. package/build/esm/Authentication.js +0 -143
  145. package/build/esm/Authentication.js.map +0 -1
  146. package/build/esm/BrowserOAuth.js +0 -251
  147. package/build/esm/BrowserOAuth.js.map +0 -1
  148. package/build/esm/CommandPath.js +0 -31
  149. package/build/esm/CommandPath.js.map +0 -1
  150. package/build/esm/Commands/Fetch.js +0 -119
  151. package/build/esm/Commands/Fetch.js.map +0 -1
  152. package/build/esm/Commands/Hook.js +0 -20
  153. package/build/esm/Commands/Hook.js.map +0 -1
  154. package/build/esm/Commands/Init.js +0 -371
  155. package/build/esm/Commands/Init.js.map +0 -1
  156. package/build/esm/Commands/Mcp.js +0 -19
  157. package/build/esm/Commands/Mcp.js.map +0 -1
  158. package/build/esm/Commands/McpRun.js +0 -15
  159. package/build/esm/Commands/McpRun.js.map +0 -1
  160. package/build/esm/Commands/Search.js +0 -46
  161. package/build/esm/Commands/Search.js.map +0 -1
  162. package/build/esm/Commands/Skill.js +0 -17
  163. package/build/esm/Commands/Skill.js.map +0 -1
  164. package/build/esm/Commands/Status.js +0 -186
  165. package/build/esm/Commands/Status.js.map +0 -1
  166. package/build/esm/Commands/Telemetry.js +0 -23
  167. package/build/esm/Commands/Telemetry.js.map +0 -1
  168. package/build/esm/Commands/Uninstall.js +0 -28
  169. package/build/esm/Commands/Uninstall.js.map +0 -1
  170. package/build/esm/Config.js +0 -619
  171. package/build/esm/Config.js.map +0 -1
  172. package/build/esm/Hook/Claude.js +0 -74
  173. package/build/esm/Hook/Claude.js.map +0 -1
  174. package/build/esm/Hook/Errors.js +0 -18
  175. package/build/esm/Hook/Errors.js.map +0 -1
  176. package/build/esm/Hook/Opencode.js +0 -50
  177. package/build/esm/Hook/Opencode.js.map +0 -1
  178. package/build/esm/Hook/SnapshotNote.js +0 -65
  179. package/build/esm/Hook/SnapshotNote.js.map +0 -1
  180. package/build/esm/Init/ClaudeAdapter.js +0 -137
  181. package/build/esm/Init/ClaudeAdapter.js.map +0 -1
  182. package/build/esm/Init/ClaudeProfile.js +0 -380
  183. package/build/esm/Init/ClaudeProfile.js.map +0 -1
  184. package/build/esm/Init/Domain.js +0 -118
  185. package/build/esm/Init/Domain.js.map +0 -1
  186. package/build/esm/Init/HarnessAdapter.js +0 -21
  187. package/build/esm/Init/HarnessAdapter.js.map +0 -1
  188. package/build/esm/Init/HarnessDetector.js +0 -65
  189. package/build/esm/Init/HarnessDetector.js.map +0 -1
  190. package/build/esm/Init/HarnessRegistry.js +0 -58
  191. package/build/esm/Init/HarnessRegistry.js.map +0 -1
  192. package/build/esm/Init/MutationTransaction.js +0 -494
  193. package/build/esm/Init/MutationTransaction.js.map +0 -1
  194. package/build/esm/Init/Service.js +0 -319
  195. package/build/esm/Init/Service.js.map +0 -1
  196. package/build/esm/Init/StandardAdapters.js +0 -116
  197. package/build/esm/Init/StandardAdapters.js.map +0 -1
  198. package/build/esm/Init/Status.js +0 -215
  199. package/build/esm/Init/Status.js.map +0 -1
  200. package/build/esm/Install/Claude/Hook.js +0 -221
  201. package/build/esm/Install/Claude/Hook.js.map +0 -1
  202. package/build/esm/Install/Claude/Mcp.js +0 -101
  203. package/build/esm/Install/Claude/Mcp.js.map +0 -1
  204. package/build/esm/Install/Claude/Skill.js +0 -56
  205. package/build/esm/Install/Claude/Skill.js.map +0 -1
  206. package/build/esm/Install/Codex/Mcp.js +0 -97
  207. package/build/esm/Install/Codex/Mcp.js.map +0 -1
  208. package/build/esm/Install/Codex/Skill.js +0 -33
  209. package/build/esm/Install/Codex/Skill.js.map +0 -1
  210. package/build/esm/Install/Cursor/Mcp.js +0 -74
  211. package/build/esm/Install/Cursor/Mcp.js.map +0 -1
  212. package/build/esm/Install/Cursor/Skill.js +0 -40
  213. package/build/esm/Install/Cursor/Skill.js.map +0 -1
  214. package/build/esm/Install/Domain.js +0 -162
  215. package/build/esm/Install/Domain.js.map +0 -1
  216. package/build/esm/Install/Hook.js +0 -38
  217. package/build/esm/Install/Hook.js.map +0 -1
  218. package/build/esm/Install/Mcp.js +0 -40
  219. package/build/esm/Install/Mcp.js.map +0 -1
  220. package/build/esm/Install/Opencode/Hook.js +0 -44
  221. package/build/esm/Install/Opencode/Hook.js.map +0 -1
  222. package/build/esm/Install/Opencode/Mcp.js +0 -76
  223. package/build/esm/Install/Opencode/Mcp.js.map +0 -1
  224. package/build/esm/Install/Opencode/Skill.js +0 -37
  225. package/build/esm/Install/Opencode/Skill.js.map +0 -1
  226. package/build/esm/Install/Skill.js +0 -41
  227. package/build/esm/Install/Skill.js.map +0 -1
  228. package/build/esm/Install/Uninstall.js +0 -49
  229. package/build/esm/Install/Uninstall.js.map +0 -1
  230. package/build/esm/MarkdownAnsi.js +0 -142
  231. package/build/esm/MarkdownAnsi.js.map +0 -1
  232. package/build/esm/Mcp/ExpandDocs.js +0 -56
  233. package/build/esm/Mcp/ExpandDocs.js.map +0 -1
  234. package/build/esm/Mcp/RequestHeaders.js +0 -13
  235. package/build/esm/Mcp/RequestHeaders.js.map +0 -1
  236. package/build/esm/Mcp/Server.js +0 -12
  237. package/build/esm/Mcp/Server.js.map +0 -1
  238. package/build/esm/Mcp/Toolkit.js +0 -16
  239. package/build/esm/Mcp/Toolkit.js.map +0 -1
  240. package/build/esm/Mcp/tools/Citations.js +0 -193
  241. package/build/esm/Mcp/tools/Citations.js.map +0 -1
  242. package/build/esm/Mcp/tools/Fetch.js +0 -165
  243. package/build/esm/Mcp/tools/Fetch.js.map +0 -1
  244. package/build/esm/SecureFile.js +0 -36
  245. package/build/esm/SecureFile.js.map +0 -1
  246. package/build/esm/Snippets.js +0 -29
  247. package/build/esm/Snippets.js.map +0 -1
  248. package/build/esm/Telemetry.js +0 -157
  249. package/build/esm/Telemetry.js.map +0 -1
  250. package/build/esm/Version.js +0 -4
  251. package/build/esm/Version.js.map +0 -1
  252. package/build/esm/Xdg.js +0 -15
  253. package/build/esm/Xdg.js.map +0 -1
  254. package/build/esm/index.js.map +0 -1
  255. package/build/esm/main.js.map +0 -1
  256. package/src/ApiClient.ts +0 -450
  257. package/src/Auth/Domain.ts +0 -63
  258. package/src/Auth/ManualAuthorization.ts +0 -296
  259. package/src/Auth/PendingInit.ts +0 -338
  260. package/src/Auth/Pkce.ts +0 -26
  261. package/src/Auth/SetupGrantAuthorization.ts +0 -116
  262. package/src/Authentication.ts +0 -202
  263. package/src/BrowserOAuth.ts +0 -359
  264. package/src/CommandPath.ts +0 -30
  265. package/src/Commands/Fetch.ts +0 -188
  266. package/src/Commands/Hook.ts +0 -48
  267. package/src/Commands/Init.ts +0 -489
  268. package/src/Commands/Mcp.ts +0 -30
  269. package/src/Commands/McpRun.ts +0 -25
  270. package/src/Commands/Search.ts +0 -97
  271. package/src/Commands/Skill.ts +0 -30
  272. package/src/Commands/Status.ts +0 -228
  273. package/src/Commands/Telemetry.ts +0 -42
  274. package/src/Commands/Uninstall.ts +0 -38
  275. package/src/Config.ts +0 -840
  276. package/src/Hook/Claude.ts +0 -81
  277. package/src/Hook/Errors.ts +0 -19
  278. package/src/Hook/Opencode.ts +0 -58
  279. package/src/Hook/SnapshotNote.ts +0 -66
  280. package/src/Init/ClaudeAdapter.ts +0 -191
  281. package/src/Init/ClaudeProfile.ts +0 -496
  282. package/src/Init/Domain.ts +0 -153
  283. package/src/Init/HarnessAdapter.ts +0 -35
  284. package/src/Init/HarnessDetector.ts +0 -77
  285. package/src/Init/HarnessRegistry.ts +0 -87
  286. package/src/Init/MutationTransaction.ts +0 -747
  287. package/src/Init/Service.ts +0 -385
  288. package/src/Init/StandardAdapters.ts +0 -141
  289. package/src/Init/Status.ts +0 -253
  290. package/src/Install/Claude/Hook.ts +0 -286
  291. package/src/Install/Claude/Mcp.ts +0 -129
  292. package/src/Install/Claude/Skill.ts +0 -77
  293. package/src/Install/Codex/Mcp.ts +0 -114
  294. package/src/Install/Codex/Skill.ts +0 -44
  295. package/src/Install/Cursor/Mcp.ts +0 -85
  296. package/src/Install/Cursor/Skill.ts +0 -51
  297. package/src/Install/Domain.ts +0 -221
  298. package/src/Install/Hook.ts +0 -50
  299. package/src/Install/Mcp.ts +0 -71
  300. package/src/Install/Opencode/Hook.ts +0 -55
  301. package/src/Install/Opencode/Mcp.ts +0 -87
  302. package/src/Install/Opencode/Skill.ts +0 -48
  303. package/src/Install/Opencode/expandai-webfetch.d.ts +0 -23
  304. package/src/Install/Opencode/expandai-webfetch.js +0 -56
  305. package/src/Install/Skill.ts +0 -57
  306. package/src/Install/Uninstall.ts +0 -82
  307. package/src/MarkdownAnsi.ts +0 -162
  308. package/src/Mcp/ExpandDocs.ts +0 -62
  309. package/src/Mcp/RequestHeaders.ts +0 -16
  310. package/src/Mcp/Server.ts +0 -15
  311. package/src/Mcp/Toolkit.ts +0 -21
  312. package/src/Mcp/tools/Citations.ts +0 -219
  313. package/src/Mcp/tools/Fetch.ts +0 -203
  314. package/src/SecureFile.ts +0 -70
  315. package/src/Snippets.ts +0 -39
  316. package/src/Telemetry.ts +0 -186
  317. package/src/Version.ts +0 -3
  318. package/src/Xdg.ts +0 -18
  319. package/src/index.ts +0 -1
  320. package/src/main.ts +0 -305
package/build/esm/main.js CHANGED
@@ -1,205 +1,682 @@
1
1
  #!/usr/bin/env node
2
- import { CliConfig, Command, ValidationError } from '@effect/cli';
3
- import { Terminal } from '@effect/platform';
4
- import { NodeContext, NodeRuntime } from '@effect/platform-node';
5
- import { Cause, Config, Console, Effect, Layer, Logger, LogLevel, Option, Schema, String } from 'effect';
6
- import { ManualAuthorization } from './Auth/ManualAuthorization.js';
7
- import { PendingInitStore } from './Auth/PendingInit.js';
8
- import { SetupGrantAuthorization } from './Auth/SetupGrantAuthorization.js';
9
- import { Authentication, LoginCommand, LogoutCommand, WhoamiCommand } from './Authentication.js';
10
- import { commandFromArgv } from './CommandPath.js';
11
- import { FetchCommand } from './Commands/Fetch.js';
12
- import { AgentHookCommand, HumanHookCommand } from './Commands/Hook.js';
13
- import { AgentInitCommand, HumanInitCommand, InitTerminalInteraction, preflightAgentInitArgv, resolveInitExecutionMode, } from './Commands/Init.js';
14
- import { InstallSubCommand, UninstallSubCommand } from './Commands/Mcp.js';
15
- import { McpRunCommand } from './Commands/McpRun.js';
16
- import { SearchCommand } from './Commands/Search.js';
17
- import { SkillCommand } from './Commands/Skill.js';
18
- import { AgentStatusCommand, HumanStatusCommand, preflightAgentStatusArgv, resolveStatusExecutionMode, StatusTerminalInteraction, } from './Commands/Status.js';
19
- import { TelemetryCommand } from './Commands/Telemetry.js';
20
- import { UninstallCommand } from './Commands/Uninstall.js';
21
- import { ConfigManager, envFlag, envLiteral } from './Config.js';
22
- import { ClaudeHook } from './Hook/Claude.js';
23
- import { OpencodeHook } from './Hook/Opencode.js';
24
- import { HarnessDetector } from './Init/HarnessDetector.js';
25
- import { HarnessRegistry } from './Init/HarnessRegistry.js';
26
- import { InitService } from './Init/Service.js';
27
- import { StatusService } from './Init/Status.js';
28
- import { HookInstaller } from './Install/Hook.js';
29
- import { Mcp } from './Install/Mcp.js';
30
- import { Skill as SkillInstaller } from './Install/Skill.js';
31
- import { Uninstall } from './Install/Uninstall.js';
32
- import { Telemetry } from './Telemetry.js';
33
- import { CLI_VERSION } from './Version.js';
34
- /**
35
- * Where this process is running:
36
- * - 'human': interactive terminal use. Setup commands (`mcp install`, `skill install`) are visible.
37
- * - 'agent': an agent host (Claude Code / Cursor / Codex) or the expandai skill is invoking
38
- * the CLI. Setup commands are hidden because the integration is already wired up.
39
- * - 'mcp': the binary is serving as the MCP transport. MCP only runs in agents.
40
- */
41
- // envFlag / envLiteral read leniently: a malformed value (CLAUDECODE=banana,
42
- // EXPANDAI_CLI_CONTEXT=bogus) must degrade instead of crashing the CLI —
43
- // Config.option / Config.withDefault only absorb missing data, not invalid.
44
- const EnvironmentSignals = Config.all({
45
- override: envLiteral('EXPANDAI_CLI_CONTEXT', Schema.Literal('human', 'agent')),
46
- mcpTransport: Config.string('MCP_TRANSPORT').pipe(Config.option, Config.map(Option.isSome)),
47
- claudeCode: envFlag('CLAUDECODE'),
48
- cursor: Config.string('CURSOR_TRACE_ID').pipe(Config.option, Config.map(Option.isSome)),
49
- codex: Config.string('CODEX_RUN_ID').pipe(Config.option, Config.map(Option.isSome)),
50
- });
51
- const detectContext = Effect.fnUntraced(function* (command) {
52
- const initMode = resolveInitExecutionMode({
53
- argv: process.argv,
54
- environment: process.env,
55
- stdinIsTty: process.stdin.isTTY === true,
56
- stdoutIsTty: process.stdout.isTTY === true,
57
- });
58
- if (initMode !== undefined)
59
- return initMode === 'machine' ? 'agent' : 'human';
60
- const statusMode = resolveStatusExecutionMode({
61
- argv: process.argv,
62
- environment: process.env,
63
- stdinIsTty: process.stdin.isTTY === true,
64
- stdoutIsTty: process.stdout.isTTY === true,
65
- });
66
- if (statusMode !== undefined)
67
- return statusMode === 'machine' ? 'agent' : 'human';
68
- const signals = yield* EnvironmentSignals;
69
- // Installed MCP entries invoke `expandai mcp run` without any transport env
70
- // var, so the resolved command is the reliable signal; MCP_TRANSPORT stays
71
- // as a secondary hint for hand-written configs that set it.
72
- const mcp = command === 'mcp run' || signals.mcpTransport ? Option.some('mcp') : Option.none();
73
- // Authentication.logout uses both stdout and stdin TTY checks because Prompt
74
- // reads from stdin; for context detection a non-TTY stdout alone is enough
75
- // to identify a non-interactive caller.
76
- const agent = signals.claudeCode || signals.cursor || signals.codex || !process.stdout.isTTY
77
- ? Option.some('agent')
78
- : Option.none();
79
- return Option.firstSomeOf([mcp, signals.override, agent]).pipe(Option.getOrElse(() => 'human'));
80
- });
81
- const HumanMcp = Command.make('mcp').pipe(Command.withDescription('Run or install the expandai MCP server'), Command.withSubcommands([McpRunCommand, InstallSubCommand, UninstallSubCommand]));
82
- const AgentMcp = Command.make('mcp').pipe(Command.withDescription('Run the expandai MCP server'), Command.withSubcommands([McpRunCommand]));
83
- const InitServiceLive = InitService.DefaultWithoutDependencies.pipe(Layer.provide(Layer.mergeAll(Authentication.Default, ManualAuthorization.Default, SetupGrantAuthorization.Default, HarnessRegistry.Default)));
84
- const StatusServiceLive = StatusService.DefaultWithoutDependencies.pipe(Layer.provide(Layer.mergeAll(ConfigManager.Default, PendingInitStore.Default, HarnessRegistry.Default)));
85
- const HumanCli = Command.make('expandai').pipe(Command.withDescription('expand.ai CLI and MCP server'), Command.withSubcommands([
86
- FetchCommand,
87
- SearchCommand,
88
- LoginCommand,
89
- WhoamiCommand,
90
- LogoutCommand,
91
- HumanInitCommand,
92
- HumanStatusCommand,
93
- UninstallCommand,
94
- HumanMcp,
95
- SkillCommand,
96
- HumanHookCommand,
97
- TelemetryCommand,
98
- ]), Command.provide(Layer.mergeAll(ConfigManager.Default, Authentication.Default, Mcp.Default, HookInstaller.Default, SkillInstaller.Default, Uninstall.Default, ClaudeHook.Default, OpencodeHook.Default, InitServiceLive, HarnessDetector.Default, InitTerminalInteraction.Default, StatusServiceLive, StatusTerminalInteraction.Default)));
99
- const AgentCli = Command.make('expandai').pipe(Command.withDescription('expand.ai CLI and MCP server'), Command.withSubcommands([
100
- FetchCommand,
101
- SearchCommand,
102
- LoginCommand,
103
- WhoamiCommand,
104
- LogoutCommand,
105
- AgentInitCommand,
106
- AgentStatusCommand,
107
- // The consent step tells the user `expandai uninstall` is how to undo
108
- // setup — including removing the machine-wide `WebFetch` deny rule. That
109
- // text is read by an agent, so the command has to exist in this tree too;
110
- // it was human-only, and an agent running it got "Invalid subcommand".
111
- UninstallCommand,
112
- AgentMcp,
113
- AgentHookCommand,
114
- TelemetryCommand,
115
- ]), Command.provide(Layer.mergeAll(ConfigManager.Default, Authentication.Default, ClaudeHook.Default, OpencodeHook.Default, Mcp.Default, HookInstaller.Default, SkillInstaller.Default, Uninstall.Default, InitServiceLive, HarnessDetector.Default, StatusServiceLive)));
116
- const LoggerLive = Layer.unwrapEffect(Effect.gen(function* () {
117
- const isDebug = yield* Config.boolean('DEBUG').pipe(Config.withDefault(false));
118
- // stdout is a protocol/data surface (hook JSON payloads, fetched
119
- // markdown) — a log line ahead of the payload corrupts it for the
120
- // consumer, so diagnostics go to stderr.
121
- return Layer.mergeAll(Logger.replace(Logger.defaultLogger, Logger.prettyLogger({ stderr: true })), Logger.minimumLogLevel(isDebug ? LogLevel.All : LogLevel.Info));
122
- }));
123
- // Status is a read-only diagnostic contract, and `init --detect` documents itself
124
- // as changing nothing — the guide prints "This changes nothing:" directly above
125
- // it. Select the no-op service before layer acquisition so Telemetry.Default
126
- // cannot persist a distinct id, repair config permissions, display a notice, or
127
- // send a request. A brand-new HOME came back from `--detect` with a config.json
128
- // holding a telemetry id, which is a write however small. Other commands retain
129
- // the ordinary telemetry service unchanged.
130
- const writesNothing = commandFromArgv(process.argv) === 'status' ||
131
- (commandFromArgv(process.argv) === 'init' && process.argv.includes('--detect'));
132
- const TelemetryLive = writesNothing ? Telemetry.DISABLED : Telemetry.Default;
133
- const Env = Layer.mergeAll(NodeContext.layer, CliConfig.layer({ showBuiltIns: false }), LoggerLive, TelemetryLive);
134
- const errorTagFromCause = (cause) => Cause.failureOption(cause).pipe(Option.match({
135
- onNone: () => 'Defect',
136
- onSome: (error) => typeof error === 'object' && error !== null && '_tag' in error && typeof error._tag === 'string'
137
- ? error._tag
138
- : 'UnknownError',
139
- }));
140
- function startupOnboardingPreflightError() {
141
- const initMode = resolveInitExecutionMode({
142
- argv: process.argv,
143
- environment: process.env,
144
- stdinIsTty: process.stdin.isTTY === true,
145
- stdoutIsTty: process.stdout.isTTY === true,
146
- });
147
- if (initMode === 'machine')
148
- return preflightAgentInitArgv(process.argv);
149
- const statusMode = resolveStatusExecutionMode({
150
- argv: process.argv,
151
- environment: process.env,
152
- stdinIsTty: process.stdin.isTTY === true,
153
- stdoutIsTty: process.stdout.isTTY === true,
154
- });
155
- return statusMode === 'machine' ? preflightAgentStatusArgv(process.argv) : undefined;
156
- }
157
- const program = Effect.gen(function* () {
158
- const command = commandFromArgv(process.argv);
159
- const context = yield* detectContext(command);
160
- const telemetry = yield* Telemetry;
161
- if (context === 'human') {
162
- yield* telemetry.showNoticeIfNeeded();
2
+ import{createRequire as Bo0}from"node:module";var ti0=Object.create;var{getPrototypeOf:ei0,defineProperty:su,getOwnPropertyNames:Xo0}=Object;var Jo0=Object.prototype.hasOwnProperty;function Zo0(X){return this[X]}var Qo0,Yo0,EQ0=(X,J,Z)=>{var Q=X!=null&&typeof X==="object";if(Q){var Y=J?Qo0??=new WeakMap:Yo0??=new WeakMap,G=Y.get(X);if(G)return G}Z=X!=null?ti0(ei0(X)):{};let K=J||!X||!X.__esModule?su(Z,"default",{value:X,enumerable:!0}):Z;for(let B of Xo0(X))if(!Jo0.call(K,B))su(K,B,{get:Zo0.bind(X,B),enumerable:!0});if(Q)Y.set(X,K);return K};var G8=(X,J)=>()=>(J||X((J={exports:{}}).exports,J),J.exports);var Go0=(X)=>X;function Ko0(X,J){this[X]=Go0.bind(null,J)}var y8=(X,J)=>{for(var Z in J)su(X,Z,{get:J[Z],enumerable:!0,configurable:!0,set:Ko0.bind(J,Z)})};var GN=Bo0(import.meta.url);var kC0=G8((iJ9,vC0)=>{var{hasOwnProperty:s00}=Object.prototype,t00=(X,J={})=>{if(typeof J==="string")J={section:J};J.align=J.align===!0,J.newline=J.newline===!0,J.sort=J.sort===!0,J.whitespace=J.whitespace===!0||J.align===!0,J.platform=J.platform||typeof process<"u"&&process.platform,J.bracketedArray=J.bracketedArray!==!1;let Z=J.platform==="win32"?`\r
3
+ `:`
4
+ `,Q=J.whitespace?" = ":"=",Y=[],G=J.sort?Object.keys(X).sort():Object.keys(X),K=0;if(J.align)K=dH(G.filter((W)=>X[W]===null||Array.isArray(X[W])||typeof X[W]!=="object").map((W)=>Array.isArray(X[W])?`${W}[]`:W).concat([""]).reduce((W,V)=>dH(W).length>=dH(V).length?W:V)).length;let B="",H=J.bracketedArray?"[]":"";for(let W of G){let V=X[W];if(V&&Array.isArray(V))for(let U of V)B+=dH(`${W}${H}`).padEnd(K," ")+Q+dH(U)+Z;else if(V&&typeof V==="object")Y.push(W);else B+=dH(W).padEnd(K," ")+Q+dH(V)+Z}if(J.section&&B.length)B="["+dH(J.section)+"]"+(J.newline?Z+Z:Z)+B;for(let W of Y){let V=SC0(W,".").join("\\."),U=(J.section?J.section+".":"")+V,O=t00(X[W],{...J,section:U});if(B.length&&O.length)B+=Z;B+=O}return B};function SC0(X,J){var Z=0,Q=0,Y=0,G=[];do if(Y=X.indexOf(J,Z),Y!==-1){if(Z=Y+J.length,Y>0&&X[Y-1]==="\\")continue;G.push(X.slice(Q,Y)),Q=Y+J.length}while(Y!==-1);return G.push(X.slice(Q)),G}var EC0=(X,J={})=>{J.bracketedArray=J.bracketedArray!==!1;let Z=Object.create(null),Q=Z,Y=null,G=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,K=X.split(/[\r\n]+/g),B={};for(let W of K){if(!W||W.match(/^\s*[;#]/)||W.match(/^\s*$/))continue;let V=W.match(G);if(!V)continue;if(V[1]!==void 0){if(Y=tb(V[1]),Y==="__proto__"){Q=Object.create(null);continue}Q=Z[Y]=Z[Y]||Object.create(null);continue}let U=tb(V[2]),O;if(J.bracketedArray)O=U.length>2&&U.slice(-2)==="[]";else B[U]=(B?.[U]||0)+1,O=B[U]>1;let q=O&&U.endsWith("[]")?U.slice(0,-2):U;if(q==="__proto__")continue;let L=V[3]?tb(V[4]):!0,A=L==="true"||L==="false"||L==="null"?JSON.parse(L):L;if(O){if(!s00.call(Q,q))Q[q]=[];else if(!Array.isArray(Q[q]))Q[q]=[Q[q]]}if(Array.isArray(Q[q]))Q[q].push(A);else Q[q]=A}let H=[];for(let W of Object.keys(Z)){if(!s00.call(Z,W)||typeof Z[W]!=="object"||Array.isArray(Z[W]))continue;let V=SC0(W,".");Q=Z;let U=V.pop(),O=U.replace(/\\\./g,".");for(let q of V){if(q==="__proto__")continue;if(!s00.call(Q,q)||typeof Q[q]!=="object")Q[q]=Object.create(null);Q=Q[q]}if(Q===Z&&O===U)continue;Q[O]=Z[W],H.push(W)}for(let W of H)delete Z[W];return Z},xC0=(X)=>{return X.startsWith('"')&&X.endsWith('"')||X.startsWith("'")&&X.endsWith("'")},dH=(X)=>{if(typeof X!=="string"||X.match(/[=\r\n]/)||X.match(/^\[/)||X.length>1&&xC0(X)||X!==X.trim())return JSON.stringify(X);return X.split(";").join("\\;").split("#").join("\\#")},tb=(X)=>{if(X=(X||"").trim(),xC0(X)){if(X.charAt(0)==="'")X=X.slice(1,-1);try{X=JSON.parse(X)}catch{}}else{let J=!1,Z="";for(let Q=0,Y=X.length;Q<Y;Q++){let G=X.charAt(Q);if(J){if("\\;#".indexOf(G)!==-1)Z+=G;else Z+="\\"+G;J=!1}else if(";#".indexOf(G)!==-1)break;else if(G==="\\")J=!0;else Z+=G}if(J)Z+="\\";return Z.trim()}return X};vC0.exports={parse:EC0,decode:EC0,stringify:t00,encode:t00,safe:dH,unsafe:tb}});var yC0=G8((oJ9,bC0)=>{bC0.exports=function(){function X(Q,Y){function G(){this.constructor=Q}G.prototype=Y.prototype,Q.prototype=new G}function J(Q,Y,G,K,B,H){this.message=Q,this.expected=Y,this.found=G,this.offset=K,this.line=B,this.column=H,this.name="SyntaxError"}X(J,Error);function Z(Q){var Y=arguments.length>1?arguments[1]:{},G={},K={start:WQ0},B=WQ0,H=[],W=function(){return CQ0},V=G,U="#",O={type:"literal",value:"#",description:'"#"'},q=void 0,L={type:"any",description:"any character"},A="[",M={type:"literal",value:"[",description:'"["'},x="]",j={type:"literal",value:"]",description:'"]"'},T=function(_){ru(UZ("ObjectPath",_,VZ,$Z))},E=function(_){ru(UZ("ArrayPath",_,VZ,$Z))},k=function(_,F){return _.concat(F)},P=function(_){return[_]},C=function(_){return _},v=".",f={type:"literal",value:".",description:'"."'},s="=",l={type:"literal",value:"=",description:'"="'},W0=function(_,F){ru(UZ("Assign",F,VZ,$Z,_))},b=function(_){return _.join("")},a=function(_){return _.value},n='"""',r={type:"literal",value:'"""',description:'"\\"\\"\\""'},J0=null,F0=function(_){return UZ("String",_.join(""),VZ,$Z)},Z8='"',J8={type:"literal",value:'"',description:'"\\""'},S8="'''",b8={type:"literal",value:"'''",description:`"'''"`},j6="'",WZ={type:"literal",value:"'",description:`"'"`},GB=function(_){return _},Rn0=function(_){return _},jn0="\\",Cn0={type:"literal",value:"\\",description:'"\\\\"'},In0=function(){return""},En0="e",Sn0={type:"literal",value:"e",description:'"e"'},xn0="E",vn0={type:"literal",value:"E",description:'"E"'},kn0=function(_,F){return UZ("Float",parseFloat(_+"e"+F),VZ,$Z)},bn0=function(_){return UZ("Float",parseFloat(_),VZ,$Z)},uu="+",cu={type:"literal",value:"+",description:'"+"'},dZ0=function(_){return _.join("")},oD="-",rD={type:"literal",value:"-",description:'"-"'},uZ0=function(_){return"-"+_.join("")},yn0=function(_){return UZ("Integer",parseInt(_,10),VZ,$Z)},cZ0="true",gn0={type:"literal",value:"true",description:'"true"'},hn0=function(){return UZ("Boolean",!0,VZ,$Z)},fZ0="false",mn0={type:"literal",value:"false",description:'"false"'},dn0=function(){return UZ("Boolean",!1,VZ,$Z)},un0=function(){return UZ("Array",[],VZ,$Z)},cn0=function(_){return UZ("Array",_?[_]:[],VZ,$Z)},fn0=function(_){return UZ("Array",_,VZ,$Z)},pn0=function(_,F){return UZ("Array",_.concat(F),VZ,$Z)},pZ0=function(_){return _},lZ0=",",nZ0={type:"literal",value:",",description:'","'},ln0="{",nn0={type:"literal",value:"{",description:'"{"'},in0="}",on0={type:"literal",value:"}",description:'"}"'},rn0=function(_){return UZ("InlineTable",_,VZ,$Z)},iZ0=function(_,F){return UZ("InlineTableValue",F,VZ,$Z,_)},an0=function(_){return"."+_},sn0=function(_){return _.join("")},aD=":",sD={type:"literal",value:":",description:'":"'},oZ0=function(_){return _.join("")},rZ0="T",aZ0={type:"literal",value:"T",description:'"T"'},tn0="Z",en0={type:"literal",value:"Z",description:'"Z"'},Xi0=function(_,F){return UZ("Date",new Date(_+"T"+F+"Z"),VZ,$Z)},Ji0=function(_,F){return UZ("Date",new Date(_+"T"+F),VZ,$Z)},Zi0=/^[ \t]/,Qi0={type:"class",value:"[ \\t]",description:"[ \\t]"},sZ0=`
5
+ `,tZ0={type:"literal",value:`
6
+ `,description:'"\\n"'},Yi0="\r",Gi0={type:"literal",value:"\r",description:'"\\r"'},Ki0=/^[0-9a-f]/i,Bi0={type:"class",value:"[0-9a-f]i",description:"[0-9a-f]i"},Hi0=/^[0-9]/,Wi0={type:"class",value:"[0-9]",description:"[0-9]"},Vi0="_",$i0={type:"literal",value:"_",description:'"_"'},Ui0=function(){return""},zi0=/^[A-Za-z0-9_\-]/,Ni0={type:"class",value:"[A-Za-z0-9_\\-]",description:"[A-Za-z0-9_\\-]"},Oi0=function(_){return _.join("")},eZ0="\\\"",_i0={type:"literal",value:"\\\"",description:'"\\\\\\""'},qi0=function(){return'"'},XQ0="\\\\",Di0={type:"literal",value:"\\\\",description:'"\\\\\\\\"'},wi0=function(){return"\\"},JQ0="\\b",Li0={type:"literal",value:"\\b",description:'"\\\\b"'},Fi0=function(){return"\b"},ZQ0="\\t",Ai0={type:"literal",value:"\\t",description:'"\\\\t"'},Ti0=function(){return"\t"},QQ0="\\n",Mi0={type:"literal",value:"\\n",description:'"\\\\n"'},Pi0=function(){return`
7
+ `},YQ0="\\f",Ri0={type:"literal",value:"\\f",description:'"\\\\f"'},ji0=function(){return"\f"},GQ0="\\r",Ci0={type:"literal",value:"\\r",description:'"\\\\r"'},Ii0=function(){return"\r"},KQ0="\\U",Ei0={type:"literal",value:"\\U",description:'"\\\\U"'},BQ0=function(_){return ai0(_.join(""))},HQ0="\\u",Si0={type:"literal",value:"\\u",description:'"\\\\u"'},w=0,D8=0,tD=0,fu={line:1,column:1,seenCR:!1},aR=0,pu=[],S0=0,g0={},sR;if("startRule"in Y){if(!(Y.startRule in K))throw Error(`Can't start parsing from rule "`+Y.startRule+'".');B=K[Y.startRule]}function jl8(){return Q.substring(D8,w)}function Cl8(){return D8}function VZ(){return lu(D8).line}function $Z(){return lu(D8).column}function Il8(_){throw nu(null,[{type:"other",description:_}],D8)}function El8(_){throw nu(_,null,D8)}function lu(_){function F(R,g,c){var G0,T0;for(G0=g;G0<c;G0++)if(T0=Q.charAt(G0),T0===`
8
+ `){if(!R.seenCR)R.line++;R.column=1,R.seenCR=!1}else if(T0==="\r"||T0==="\u2028"||T0==="\u2029")R.line++,R.column=1,R.seenCR=!0;else R.column++,R.seenCR=!1}if(tD!==_){if(tD>_)tD=0,fu={line:1,column:1,seenCR:!1};F(fu,tD,_),tD=_}return fu}function p0(_){if(w<aR)return;if(w>aR)aR=w,pu=[];pu.push(_)}function nu(_,F,R){function g(V8){var Y9=1;V8.sort(function(vX,NX){if(vX.description<NX.description)return-1;else if(vX.description>NX.description)return 1;else return 0});while(Y9<V8.length)if(V8[Y9-1]===V8[Y9])V8.splice(Y9,1);else Y9++}function c(V8,Y9){function vX(YN){function S2(mY){return mY.charCodeAt(0).toString(16).toUpperCase()}return YN.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(mY){return"\\x0"+S2(mY)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(mY){return"\\x"+S2(mY)}).replace(/[\u0180-\u0FFF]/g,function(mY){return"\\u0"+S2(mY)}).replace(/[\u1080-\uFFFF]/g,function(mY){return"\\u"+S2(mY)})}var NX=Array(V8.length),Q7,h7,hY;for(hY=0;hY<V8.length;hY++)NX[hY]=V8[hY].description;return Q7=V8.length>1?NX.slice(0,-1).join(", ")+" or "+NX[V8.length-1]:NX[0],h7=Y9?'"'+vX(Y9)+'"':"end of input","Expected "+Q7+" but "+h7+" found."}var G0=lu(R),T0=R<Q.length?Q.charAt(R):null;if(F!==null)g(F);return new J(_!==null?_:c(F,T0),F,T0,R,G0.line,G0.column)}function WQ0(){var _,F,R,g=w*49+0,c=g0[g];if(c)return w=c.nextPos,c.result;_=w,F=[],R=VQ0();while(R!==G)F.push(R),R=VQ0();if(F!==G)D8=_,F=W();return _=F,g0[g]={nextPos:w,result:_},_}function VQ0(){var _,F,R,g,c,G0,T0,V8=w*49+1,Y9=g0[V8];if(Y9)return w=Y9.nextPos,Y9.result;_=w,F=[],R=w8();while(R!==G)F.push(R),R=w8();if(F!==G)if(R=xi0(),R!==G){g=[],c=w8();while(c!==G)g.push(c),c=w8();if(g!==G){c=[],G0=tR();while(G0!==G)c.push(G0),G0=tR();if(c!==G){if(G0=[],T0=u5(),T0!==G)while(T0!==G)G0.push(T0),T0=u5();else G0=V;if(G0===G)G0=Xj();if(G0!==G)F=[F,R,g,c,G0],_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V}else w=_,_=V;else w=_,_=V;if(_===G){if(_=w,F=[],R=w8(),R!==G)while(R!==G)F.push(R),R=w8();else F=V;if(F!==G){if(R=[],g=u5(),g!==G)while(g!==G)R.push(g),g=u5();else R=V;if(R===G)R=Xj();if(R!==G)F=[F,R],_=F;else w=_,_=V}else w=_,_=V;if(_===G)_=u5()}return g0[V8]={nextPos:w,result:_},_}function xi0(){var _,F=w*49+2,R=g0[F];if(R)return w=R.nextPos,R.result;if(_=tR(),_===G){if(_=vi0(),_===G){if(_=ki0(),_===G)_=bi0()}}return g0[F]={nextPos:w,result:_},_}function tR(){var _,F,R,g,c,G0,T0=w*49+3,V8=g0[T0];if(V8)return w=V8.nextPos,V8.result;if(_=w,Q.charCodeAt(w)===35)F=U,w++;else if(F=G,S0===0)p0(O);if(F!==G){if(R=[],g=w,c=w,S0++,G0=u5(),G0===G)G0=Xj();if(S0--,G0===G)c=q;else w=c,c=V;if(c!==G){if(Q.length>w)G0=Q.charAt(w),w++;else if(G0=G,S0===0)p0(L);if(G0!==G)c=[c,G0],g=c;else w=g,g=V}else w=g,g=V;while(g!==G){if(R.push(g),g=w,c=w,S0++,G0=u5(),G0===G)G0=Xj();if(S0--,G0===G)c=q;else w=c,c=V;if(c!==G){if(Q.length>w)G0=Q.charAt(w),w++;else if(G0=G,S0===0)p0(L);if(G0!==G)c=[c,G0],g=c;else w=g,g=V}else w=g,g=V}if(R!==G)F=[F,R],_=F;else w=_,_=V}else w=_,_=V;return g0[T0]={nextPos:w,result:_},_}function vi0(){var _,F,R,g,c,G0,T0=w*49+4,V8=g0[T0];if(V8)return w=V8.nextPos,V8.result;if(_=w,Q.charCodeAt(w)===91)F=A,w++;else if(F=G,S0===0)p0(M);if(F!==G){R=[],g=w8();while(g!==G)R.push(g),g=w8();if(R!==G)if(g=$Q0(),g!==G){c=[],G0=w8();while(G0!==G)c.push(G0),G0=w8();if(c!==G){if(Q.charCodeAt(w)===93)G0=x,w++;else if(G0=G,S0===0)p0(j);if(G0!==G)D8=_,F=T(g),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V;else w=_,_=V}else w=_,_=V;return g0[T0]={nextPos:w,result:_},_}function ki0(){var _,F,R,g,c,G0,T0,V8,Y9=w*49+5,vX=g0[Y9];if(vX)return w=vX.nextPos,vX.result;if(_=w,Q.charCodeAt(w)===91)F=A,w++;else if(F=G,S0===0)p0(M);if(F!==G){if(Q.charCodeAt(w)===91)R=A,w++;else if(R=G,S0===0)p0(M);if(R!==G){g=[],c=w8();while(c!==G)g.push(c),c=w8();if(g!==G)if(c=$Q0(),c!==G){G0=[],T0=w8();while(T0!==G)G0.push(T0),T0=w8();if(G0!==G){if(Q.charCodeAt(w)===93)T0=x,w++;else if(T0=G,S0===0)p0(j);if(T0!==G){if(Q.charCodeAt(w)===93)V8=x,w++;else if(V8=G,S0===0)p0(j);if(V8!==G)D8=_,F=E(c),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V}else w=_,_=V;else w=_,_=V}else w=_,_=V}else w=_,_=V;return g0[Y9]={nextPos:w,result:_},_}function $Q0(){var _,F,R,g=w*49+6,c=g0[g];if(c)return w=c.nextPos,c.result;if(_=w,F=[],R=zQ0(),R!==G)while(R!==G)F.push(R),R=zQ0();else F=V;if(F!==G)if(R=UQ0(),R!==G)D8=_,F=k(F,R),_=F;else w=_,_=V;else w=_,_=V;if(_===G){if(_=w,F=UQ0(),F!==G)D8=_,F=P(F);_=F}return g0[g]={nextPos:w,result:_},_}function UQ0(){var _,F,R,g,c,G0=w*49+7,T0=g0[G0];if(T0)return w=T0.nextPos,T0.result;_=w,F=[],R=w8();while(R!==G)F.push(R),R=w8();if(F!==G)if(R=eD(),R!==G){g=[],c=w8();while(c!==G)g.push(c),c=w8();if(g!==G)D8=_,F=C(R),_=F;else w=_,_=V}else w=_,_=V;else w=_,_=V;if(_===G){_=w,F=[],R=w8();while(R!==G)F.push(R),R=w8();if(F!==G)if(R=iu(),R!==G){g=[],c=w8();while(c!==G)g.push(c),c=w8();if(g!==G)D8=_,F=C(R),_=F;else w=_,_=V}else w=_,_=V;else w=_,_=V}return g0[G0]={nextPos:w,result:_},_}function zQ0(){var _,F,R,g,c,G0,T0,V8=w*49+8,Y9=g0[V8];if(Y9)return w=Y9.nextPos,Y9.result;_=w,F=[],R=w8();while(R!==G)F.push(R),R=w8();if(F!==G)if(R=eD(),R!==G){g=[],c=w8();while(c!==G)g.push(c),c=w8();if(g!==G){if(Q.charCodeAt(w)===46)c=v,w++;else if(c=G,S0===0)p0(f);if(c!==G){G0=[],T0=w8();while(T0!==G)G0.push(T0),T0=w8();if(G0!==G)D8=_,F=C(R),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V}else w=_,_=V;else w=_,_=V;if(_===G){_=w,F=[],R=w8();while(R!==G)F.push(R),R=w8();if(F!==G)if(R=iu(),R!==G){g=[],c=w8();while(c!==G)g.push(c),c=w8();if(g!==G){if(Q.charCodeAt(w)===46)c=v,w++;else if(c=G,S0===0)p0(f);if(c!==G){G0=[],T0=w8();while(T0!==G)G0.push(T0),T0=w8();if(G0!==G)D8=_,F=C(R),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V}else w=_,_=V;else w=_,_=V}return g0[V8]={nextPos:w,result:_},_}function bi0(){var _,F,R,g,c,G0,T0=w*49+9,V8=g0[T0];if(V8)return w=V8.nextPos,V8.result;if(_=w,F=eD(),F!==G){R=[],g=w8();while(g!==G)R.push(g),g=w8();if(R!==G){if(Q.charCodeAt(w)===61)g=s,w++;else if(g=G,S0===0)p0(l);if(g!==G){c=[],G0=w8();while(G0!==G)c.push(G0),G0=w8();if(c!==G)if(G0=QN(),G0!==G)D8=_,F=W0(F,G0),_=F;else w=_,_=V;else w=_,_=V}else w=_,_=V}else w=_,_=V}else w=_,_=V;if(_===G)if(_=w,F=iu(),F!==G){R=[],g=w8();while(g!==G)R.push(g),g=w8();if(R!==G){if(Q.charCodeAt(w)===61)g=s,w++;else if(g=G,S0===0)p0(l);if(g!==G){c=[],G0=w8();while(G0!==G)c.push(G0),G0=w8();if(c!==G)if(G0=QN(),G0!==G)D8=_,F=W0(F,G0),_=F;else w=_,_=V;else w=_,_=V}else w=_,_=V}else w=_,_=V}else w=_,_=V;return g0[T0]={nextPos:w,result:_},_}function eD(){var _,F,R,g=w*49+10,c=g0[g];if(c)return w=c.nextPos,c.result;if(_=w,F=[],R=RQ0(),R!==G)while(R!==G)F.push(R),R=RQ0();else F=V;if(F!==G)D8=_,F=b(F);return _=F,g0[g]={nextPos:w,result:_},_}function iu(){var _,F,R=w*49+11,g=g0[R];if(g)return w=g.nextPos,g.result;if(_=w,F=NQ0(),F!==G)D8=_,F=a(F);if(_=F,_===G){if(_=w,F=OQ0(),F!==G)D8=_,F=a(F);_=F}return g0[R]={nextPos:w,result:_},_}function QN(){var _,F=w*49+12,R=g0[F];if(R)return w=R.nextPos,R.result;if(_=yi0(),_===G){if(_=ii0(),_===G){if(_=di0(),_===G){if(_=ui0(),_===G){if(_=ci0(),_===G){if(_=fi0(),_===G)_=pi0()}}}}}return g0[F]={nextPos:w,result:_},_}function yi0(){var _,F=w*49+13,R=g0[F];if(R)return w=R.nextPos,R.result;if(_=gi0(),_===G){if(_=NQ0(),_===G){if(_=hi0(),_===G)_=OQ0()}}return g0[F]={nextPos:w,result:_},_}function gi0(){var _,F,R,g,c,G0=w*49+14,T0=g0[G0];if(T0)return w=T0.nextPos,T0.result;if(_=w,Q.substr(w,3)===n)F=n,w+=3;else if(F=G,S0===0)p0(r);if(F!==G){if(R=u5(),R===G)R=J0;if(R!==G){g=[],c=DQ0();while(c!==G)g.push(c),c=DQ0();if(g!==G){if(Q.substr(w,3)===n)c=n,w+=3;else if(c=G,S0===0)p0(r);if(c!==G)D8=_,F=F0(g),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V}else w=_,_=V;return g0[G0]={nextPos:w,result:_},_}function NQ0(){var _,F,R,g,c=w*49+15,G0=g0[c];if(G0)return w=G0.nextPos,G0.result;if(_=w,Q.charCodeAt(w)===34)F=Z8,w++;else if(F=G,S0===0)p0(J8);if(F!==G){R=[],g=_Q0();while(g!==G)R.push(g),g=_Q0();if(R!==G){if(Q.charCodeAt(w)===34)g=Z8,w++;else if(g=G,S0===0)p0(J8);if(g!==G)D8=_,F=F0(R),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V;return g0[c]={nextPos:w,result:_},_}function hi0(){var _,F,R,g,c,G0=w*49+16,T0=g0[G0];if(T0)return w=T0.nextPos,T0.result;if(_=w,Q.substr(w,3)===S8)F=S8,w+=3;else if(F=G,S0===0)p0(b8);if(F!==G){if(R=u5(),R===G)R=J0;if(R!==G){g=[],c=wQ0();while(c!==G)g.push(c),c=wQ0();if(g!==G){if(Q.substr(w,3)===S8)c=S8,w+=3;else if(c=G,S0===0)p0(b8);if(c!==G)D8=_,F=F0(g),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V}else w=_,_=V;return g0[G0]={nextPos:w,result:_},_}function OQ0(){var _,F,R,g,c=w*49+17,G0=g0[c];if(G0)return w=G0.nextPos,G0.result;if(_=w,Q.charCodeAt(w)===39)F=j6,w++;else if(F=G,S0===0)p0(WZ);if(F!==G){R=[],g=qQ0();while(g!==G)R.push(g),g=qQ0();if(R!==G){if(Q.charCodeAt(w)===39)g=j6,w++;else if(g=G,S0===0)p0(WZ);if(g!==G)D8=_,F=F0(R),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V;return g0[c]={nextPos:w,result:_},_}function _Q0(){var _,F,R,g=w*49+18,c=g0[g];if(c)return w=c.nextPos,c.result;if(_=jQ0(),_===G){if(_=w,F=w,S0++,Q.charCodeAt(w)===34)R=Z8,w++;else if(R=G,S0===0)p0(J8);if(S0--,R===G)F=q;else w=F,F=V;if(F!==G){if(Q.length>w)R=Q.charAt(w),w++;else if(R=G,S0===0)p0(L);if(R!==G)D8=_,F=GB(R),_=F;else w=_,_=V}else w=_,_=V}return g0[g]={nextPos:w,result:_},_}function qQ0(){var _,F,R,g=w*49+19,c=g0[g];if(c)return w=c.nextPos,c.result;if(_=w,F=w,S0++,Q.charCodeAt(w)===39)R=j6,w++;else if(R=G,S0===0)p0(WZ);if(S0--,R===G)F=q;else w=F,F=V;if(F!==G){if(Q.length>w)R=Q.charAt(w),w++;else if(R=G,S0===0)p0(L);if(R!==G)D8=_,F=GB(R),_=F;else w=_,_=V}else w=_,_=V;return g0[g]={nextPos:w,result:_},_}function DQ0(){var _,F,R,g=w*49+20,c=g0[g];if(c)return w=c.nextPos,c.result;if(_=jQ0(),_===G){if(_=mi0(),_===G){if(_=w,F=w,S0++,Q.substr(w,3)===n)R=n,w+=3;else if(R=G,S0===0)p0(r);if(S0--,R===G)F=q;else w=F,F=V;if(F!==G){if(Q.length>w)R=Q.charAt(w),w++;else if(R=G,S0===0)p0(L);if(R!==G)D8=_,F=Rn0(R),_=F;else w=_,_=V}else w=_,_=V}}return g0[g]={nextPos:w,result:_},_}function mi0(){var _,F,R,g,c,G0=w*49+21,T0=g0[G0];if(T0)return w=T0.nextPos,T0.result;if(_=w,Q.charCodeAt(w)===92)F=jn0,w++;else if(F=G,S0===0)p0(Cn0);if(F!==G)if(R=u5(),R!==G){g=[],c=PQ0();while(c!==G)g.push(c),c=PQ0();if(g!==G)D8=_,F=In0(),_=F;else w=_,_=V}else w=_,_=V;else w=_,_=V;return g0[G0]={nextPos:w,result:_},_}function wQ0(){var _,F,R,g=w*49+22,c=g0[g];if(c)return w=c.nextPos,c.result;if(_=w,F=w,S0++,Q.substr(w,3)===S8)R=S8,w+=3;else if(R=G,S0===0)p0(b8);if(S0--,R===G)F=q;else w=F,F=V;if(F!==G){if(Q.length>w)R=Q.charAt(w),w++;else if(R=G,S0===0)p0(L);if(R!==G)D8=_,F=GB(R),_=F;else w=_,_=V}else w=_,_=V;return g0[g]={nextPos:w,result:_},_}function di0(){var _,F,R,g,c=w*49+23,G0=g0[c];if(G0)return w=G0.nextPos,G0.result;if(_=w,F=LQ0(),F===G)F=ou();if(F!==G){if(Q.charCodeAt(w)===101)R=En0,w++;else if(R=G,S0===0)p0(Sn0);if(R===G){if(Q.charCodeAt(w)===69)R=xn0,w++;else if(R=G,S0===0)p0(vn0)}if(R!==G)if(g=ou(),g!==G)D8=_,F=kn0(F,g),_=F;else w=_,_=V;else w=_,_=V}else w=_,_=V;if(_===G){if(_=w,F=LQ0(),F!==G)D8=_,F=bn0(F);_=F}return g0[c]={nextPos:w,result:_},_}function LQ0(){var _,F,R,g,c,G0,T0=w*49+24,V8=g0[T0];if(V8)return w=V8.nextPos,V8.result;if(_=w,Q.charCodeAt(w)===43)F=uu,w++;else if(F=G,S0===0)p0(cu);if(F===G)F=J0;if(F!==G){if(R=w,g=Xw(),g!==G){if(Q.charCodeAt(w)===46)c=v,w++;else if(c=G,S0===0)p0(f);if(c!==G)if(G0=Xw(),G0!==G)g=[g,c,G0],R=g;else w=R,R=V;else w=R,R=V}else w=R,R=V;if(R!==G)D8=_,F=dZ0(R),_=F;else w=_,_=V}else w=_,_=V;if(_===G){if(_=w,Q.charCodeAt(w)===45)F=oD,w++;else if(F=G,S0===0)p0(rD);if(F!==G){if(R=w,g=Xw(),g!==G){if(Q.charCodeAt(w)===46)c=v,w++;else if(c=G,S0===0)p0(f);if(c!==G)if(G0=Xw(),G0!==G)g=[g,c,G0],R=g;else w=R,R=V;else w=R,R=V}else w=R,R=V;if(R!==G)D8=_,F=uZ0(R),_=F;else w=_,_=V}else w=_,_=V}return g0[T0]={nextPos:w,result:_},_}function ui0(){var _,F,R=w*49+25,g=g0[R];if(g)return w=g.nextPos,g.result;if(_=w,F=ou(),F!==G)D8=_,F=yn0(F);return _=F,g0[R]={nextPos:w,result:_},_}function ou(){var _,F,R,g,c,G0=w*49+26,T0=g0[G0];if(T0)return w=T0.nextPos,T0.result;if(_=w,Q.charCodeAt(w)===43)F=uu,w++;else if(F=G,S0===0)p0(cu);if(F===G)F=J0;if(F!==G){if(R=[],g=RX(),g!==G)while(g!==G)R.push(g),g=RX();else R=V;if(R!==G){if(g=w,S0++,Q.charCodeAt(w)===46)c=v,w++;else if(c=G,S0===0)p0(f);if(S0--,c===G)g=q;else w=g,g=V;if(g!==G)D8=_,F=dZ0(R),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V;if(_===G){if(_=w,Q.charCodeAt(w)===45)F=oD,w++;else if(F=G,S0===0)p0(rD);if(F!==G){if(R=[],g=RX(),g!==G)while(g!==G)R.push(g),g=RX();else R=V;if(R!==G){if(g=w,S0++,Q.charCodeAt(w)===46)c=v,w++;else if(c=G,S0===0)p0(f);if(S0--,c===G)g=q;else w=g,g=V;if(g!==G)D8=_,F=uZ0(R),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V}return g0[G0]={nextPos:w,result:_},_}function ci0(){var _,F,R=w*49+27,g=g0[R];if(g)return w=g.nextPos,g.result;if(_=w,Q.substr(w,4)===cZ0)F=cZ0,w+=4;else if(F=G,S0===0)p0(gn0);if(F!==G)D8=_,F=hn0();if(_=F,_===G){if(_=w,Q.substr(w,5)===fZ0)F=fZ0,w+=5;else if(F=G,S0===0)p0(mn0);if(F!==G)D8=_,F=dn0();_=F}return g0[R]={nextPos:w,result:_},_}function fi0(){var _,F,R,g,c,G0=w*49+28,T0=g0[G0];if(T0)return w=T0.nextPos,T0.result;if(_=w,Q.charCodeAt(w)===91)F=A,w++;else if(F=G,S0===0)p0(M);if(F!==G){R=[],g=d5();while(g!==G)R.push(g),g=d5();if(R!==G){if(Q.charCodeAt(w)===93)g=x,w++;else if(g=G,S0===0)p0(j);if(g!==G)D8=_,F=un0(),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V;if(_===G){if(_=w,Q.charCodeAt(w)===91)F=A,w++;else if(F=G,S0===0)p0(M);if(F!==G){if(R=FQ0(),R===G)R=J0;if(R!==G){if(Q.charCodeAt(w)===93)g=x,w++;else if(g=G,S0===0)p0(j);if(g!==G)D8=_,F=cn0(R),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V;if(_===G){if(_=w,Q.charCodeAt(w)===91)F=A,w++;else if(F=G,S0===0)p0(M);if(F!==G){if(R=[],g=eR(),g!==G)while(g!==G)R.push(g),g=eR();else R=V;if(R!==G){if(Q.charCodeAt(w)===93)g=x,w++;else if(g=G,S0===0)p0(j);if(g!==G)D8=_,F=fn0(R),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V;if(_===G){if(_=w,Q.charCodeAt(w)===91)F=A,w++;else if(F=G,S0===0)p0(M);if(F!==G){if(R=[],g=eR(),g!==G)while(g!==G)R.push(g),g=eR();else R=V;if(R!==G)if(g=FQ0(),g!==G){if(Q.charCodeAt(w)===93)c=x,w++;else if(c=G,S0===0)p0(j);if(c!==G)D8=_,F=pn0(R,g),_=F;else w=_,_=V}else w=_,_=V;else w=_,_=V}else w=_,_=V}}}return g0[G0]={nextPos:w,result:_},_}function FQ0(){var _,F,R,g,c,G0=w*49+29,T0=g0[G0];if(T0)return w=T0.nextPos,T0.result;_=w,F=[],R=d5();while(R!==G)F.push(R),R=d5();if(F!==G)if(R=QN(),R!==G){g=[],c=d5();while(c!==G)g.push(c),c=d5();if(g!==G)D8=_,F=pZ0(R),_=F;else w=_,_=V}else w=_,_=V;else w=_,_=V;return g0[G0]={nextPos:w,result:_},_}function eR(){var _,F,R,g,c,G0,T0,V8=w*49+30,Y9=g0[V8];if(Y9)return w=Y9.nextPos,Y9.result;_=w,F=[],R=d5();while(R!==G)F.push(R),R=d5();if(F!==G)if(R=QN(),R!==G){g=[],c=d5();while(c!==G)g.push(c),c=d5();if(g!==G){if(Q.charCodeAt(w)===44)c=lZ0,w++;else if(c=G,S0===0)p0(nZ0);if(c!==G){G0=[],T0=d5();while(T0!==G)G0.push(T0),T0=d5();if(G0!==G)D8=_,F=pZ0(R),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V}else w=_,_=V;else w=_,_=V;return g0[V8]={nextPos:w,result:_},_}function d5(){var _,F=w*49+31,R=g0[F];if(R)return w=R.nextPos,R.result;if(_=w8(),_===G){if(_=u5(),_===G)_=tR()}return g0[F]={nextPos:w,result:_},_}function pi0(){var _,F,R,g,c,G0,T0=w*49+32,V8=g0[T0];if(V8)return w=V8.nextPos,V8.result;if(_=w,Q.charCodeAt(w)===123)F=ln0,w++;else if(F=G,S0===0)p0(nn0);if(F!==G){R=[],g=w8();while(g!==G)R.push(g),g=w8();if(R!==G){g=[],c=AQ0();while(c!==G)g.push(c),c=AQ0();if(g!==G){c=[],G0=w8();while(G0!==G)c.push(G0),G0=w8();if(c!==G){if(Q.charCodeAt(w)===125)G0=in0,w++;else if(G0=G,S0===0)p0(on0);if(G0!==G)D8=_,F=rn0(g),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V}else w=_,_=V}else w=_,_=V;return g0[T0]={nextPos:w,result:_},_}function AQ0(){var _,F,R,g,c,G0,T0,V8,Y9,vX,NX,Q7=w*49+33,h7=g0[Q7];if(h7)return w=h7.nextPos,h7.result;_=w,F=[],R=w8();while(R!==G)F.push(R),R=w8();if(F!==G)if(R=eD(),R!==G){g=[],c=w8();while(c!==G)g.push(c),c=w8();if(g!==G){if(Q.charCodeAt(w)===61)c=s,w++;else if(c=G,S0===0)p0(l);if(c!==G){G0=[],T0=w8();while(T0!==G)G0.push(T0),T0=w8();if(G0!==G)if(T0=QN(),T0!==G){V8=[],Y9=w8();while(Y9!==G)V8.push(Y9),Y9=w8();if(V8!==G){if(Q.charCodeAt(w)===44)Y9=lZ0,w++;else if(Y9=G,S0===0)p0(nZ0);if(Y9!==G){vX=[],NX=w8();while(NX!==G)vX.push(NX),NX=w8();if(vX!==G)D8=_,F=iZ0(R,T0),_=F;else w=_,_=V}else w=_,_=V}else w=_,_=V}else w=_,_=V;else w=_,_=V}else w=_,_=V}else w=_,_=V}else w=_,_=V;else w=_,_=V;if(_===G){_=w,F=[],R=w8();while(R!==G)F.push(R),R=w8();if(F!==G)if(R=eD(),R!==G){g=[],c=w8();while(c!==G)g.push(c),c=w8();if(g!==G){if(Q.charCodeAt(w)===61)c=s,w++;else if(c=G,S0===0)p0(l);if(c!==G){G0=[],T0=w8();while(T0!==G)G0.push(T0),T0=w8();if(G0!==G)if(T0=QN(),T0!==G)D8=_,F=iZ0(R,T0),_=F;else w=_,_=V;else w=_,_=V}else w=_,_=V}else w=_,_=V}else w=_,_=V;else w=_,_=V}return g0[Q7]={nextPos:w,result:_},_}function TQ0(){var _,F,R,g=w*49+34,c=g0[g];if(c)return w=c.nextPos,c.result;if(_=w,Q.charCodeAt(w)===46)F=v,w++;else if(F=G,S0===0)p0(f);if(F!==G)if(R=Xw(),R!==G)D8=_,F=an0(R),_=F;else w=_,_=V;else w=_,_=V;return g0[g]={nextPos:w,result:_},_}function MQ0(){var _,F,R,g,c,G0,T0,V8,Y9,vX,NX,Q7,h7=w*49+35,hY=g0[h7];if(hY)return w=hY.nextPos,hY.result;if(_=w,F=w,R=RX(),R!==G)if(g=RX(),g!==G)if(c=RX(),c!==G)if(G0=RX(),G0!==G){if(Q.charCodeAt(w)===45)T0=oD,w++;else if(T0=G,S0===0)p0(rD);if(T0!==G)if(V8=RX(),V8!==G)if(Y9=RX(),Y9!==G){if(Q.charCodeAt(w)===45)vX=oD,w++;else if(vX=G,S0===0)p0(rD);if(vX!==G)if(NX=RX(),NX!==G)if(Q7=RX(),Q7!==G)R=[R,g,c,G0,T0,V8,Y9,vX,NX,Q7],F=R;else w=F,F=V;else w=F,F=V;else w=F,F=V}else w=F,F=V;else w=F,F=V;else w=F,F=V}else w=F,F=V;else w=F,F=V;else w=F,F=V;else w=F,F=V;if(F!==G)D8=_,F=sn0(F);return _=F,g0[h7]={nextPos:w,result:_},_}function li0(){var _,F,R,g,c,G0,T0,V8,Y9,vX,NX,Q7=w*49+36,h7=g0[Q7];if(h7)return w=h7.nextPos,h7.result;if(_=w,F=w,R=RX(),R!==G)if(g=RX(),g!==G){if(Q.charCodeAt(w)===58)c=aD,w++;else if(c=G,S0===0)p0(sD);if(c!==G)if(G0=RX(),G0!==G)if(T0=RX(),T0!==G){if(Q.charCodeAt(w)===58)V8=aD,w++;else if(V8=G,S0===0)p0(sD);if(V8!==G)if(Y9=RX(),Y9!==G)if(vX=RX(),vX!==G){if(NX=TQ0(),NX===G)NX=J0;if(NX!==G)R=[R,g,c,G0,T0,V8,Y9,vX,NX],F=R;else w=F,F=V}else w=F,F=V;else w=F,F=V;else w=F,F=V}else w=F,F=V;else w=F,F=V;else w=F,F=V}else w=F,F=V;else w=F,F=V;if(F!==G)D8=_,F=oZ0(F);return _=F,g0[Q7]={nextPos:w,result:_},_}function ni0(){var _,F,R,g,c,G0,T0,V8,Y9,vX,NX,Q7,h7,hY,YN,S2,mY,IQ0=w*49+37,au=g0[IQ0];if(au)return w=au.nextPos,au.result;if(_=w,F=w,R=RX(),R!==G)if(g=RX(),g!==G){if(Q.charCodeAt(w)===58)c=aD,w++;else if(c=G,S0===0)p0(sD);if(c!==G)if(G0=RX(),G0!==G)if(T0=RX(),T0!==G){if(Q.charCodeAt(w)===58)V8=aD,w++;else if(V8=G,S0===0)p0(sD);if(V8!==G)if(Y9=RX(),Y9!==G)if(vX=RX(),vX!==G){if(NX=TQ0(),NX===G)NX=J0;if(NX!==G){if(Q.charCodeAt(w)===45)Q7=oD,w++;else if(Q7=G,S0===0)p0(rD);if(Q7===G){if(Q.charCodeAt(w)===43)Q7=uu,w++;else if(Q7=G,S0===0)p0(cu)}if(Q7!==G)if(h7=RX(),h7!==G)if(hY=RX(),hY!==G){if(Q.charCodeAt(w)===58)YN=aD,w++;else if(YN=G,S0===0)p0(sD);if(YN!==G)if(S2=RX(),S2!==G)if(mY=RX(),mY!==G)R=[R,g,c,G0,T0,V8,Y9,vX,NX,Q7,h7,hY,YN,S2,mY],F=R;else w=F,F=V;else w=F,F=V;else w=F,F=V}else w=F,F=V;else w=F,F=V;else w=F,F=V}else w=F,F=V}else w=F,F=V;else w=F,F=V;else w=F,F=V}else w=F,F=V;else w=F,F=V;else w=F,F=V}else w=F,F=V;else w=F,F=V;if(F!==G)D8=_,F=oZ0(F);return _=F,g0[IQ0]={nextPos:w,result:_},_}function ii0(){var _,F,R,g,c,G0=w*49+38,T0=g0[G0];if(T0)return w=T0.nextPos,T0.result;if(_=w,F=MQ0(),F!==G){if(Q.charCodeAt(w)===84)R=rZ0,w++;else if(R=G,S0===0)p0(aZ0);if(R!==G)if(g=li0(),g!==G){if(Q.charCodeAt(w)===90)c=tn0,w++;else if(c=G,S0===0)p0(en0);if(c!==G)D8=_,F=Xi0(F,g),_=F;else w=_,_=V}else w=_,_=V;else w=_,_=V}else w=_,_=V;if(_===G)if(_=w,F=MQ0(),F!==G){if(Q.charCodeAt(w)===84)R=rZ0,w++;else if(R=G,S0===0)p0(aZ0);if(R!==G)if(g=ni0(),g!==G)D8=_,F=Ji0(F,g),_=F;else w=_,_=V;else w=_,_=V}else w=_,_=V;return g0[G0]={nextPos:w,result:_},_}function w8(){var _,F=w*49+39,R=g0[F];if(R)return w=R.nextPos,R.result;if(Zi0.test(Q.charAt(w)))_=Q.charAt(w),w++;else if(_=G,S0===0)p0(Qi0);return g0[F]={nextPos:w,result:_},_}function u5(){var _,F,R,g=w*49+40,c=g0[g];if(c)return w=c.nextPos,c.result;if(Q.charCodeAt(w)===10)_=sZ0,w++;else if(_=G,S0===0)p0(tZ0);if(_===G){if(_=w,Q.charCodeAt(w)===13)F=Yi0,w++;else if(F=G,S0===0)p0(Gi0);if(F!==G){if(Q.charCodeAt(w)===10)R=sZ0,w++;else if(R=G,S0===0)p0(tZ0);if(R!==G)F=[F,R],_=F;else w=_,_=V}else w=_,_=V}return g0[g]={nextPos:w,result:_},_}function PQ0(){var _,F=w*49+41,R=g0[F];if(R)return w=R.nextPos,R.result;if(_=u5(),_===G)_=w8();return g0[F]={nextPos:w,result:_},_}function Xj(){var _,F,R=w*49+42,g=g0[R];if(g)return w=g.nextPos,g.result;if(_=w,S0++,Q.length>w)F=Q.charAt(w),w++;else if(F=G,S0===0)p0(L);if(S0--,F===G)_=q;else w=_,_=V;return g0[R]={nextPos:w,result:_},_}function c5(){var _,F=w*49+43,R=g0[F];if(R)return w=R.nextPos,R.result;if(Ki0.test(Q.charAt(w)))_=Q.charAt(w),w++;else if(_=G,S0===0)p0(Bi0);return g0[F]={nextPos:w,result:_},_}function RX(){var _,F,R=w*49+44,g=g0[R];if(g)return w=g.nextPos,g.result;if(Hi0.test(Q.charAt(w)))_=Q.charAt(w),w++;else if(_=G,S0===0)p0(Wi0);if(_===G){if(_=w,Q.charCodeAt(w)===95)F=Vi0,w++;else if(F=G,S0===0)p0($i0);if(F!==G)D8=_,F=Ui0();_=F}return g0[R]={nextPos:w,result:_},_}function RQ0(){var _,F=w*49+45,R=g0[F];if(R)return w=R.nextPos,R.result;if(zi0.test(Q.charAt(w)))_=Q.charAt(w),w++;else if(_=G,S0===0)p0(Ni0);return g0[F]={nextPos:w,result:_},_}function Xw(){var _,F,R,g=w*49+46,c=g0[g];if(c)return w=c.nextPos,c.result;if(_=w,F=[],R=RX(),R!==G)while(R!==G)F.push(R),R=RX();else F=V;if(F!==G)D8=_,F=Oi0(F);return _=F,g0[g]={nextPos:w,result:_},_}function jQ0(){var _,F,R=w*49+47,g=g0[R];if(g)return w=g.nextPos,g.result;if(_=w,Q.substr(w,2)===eZ0)F=eZ0,w+=2;else if(F=G,S0===0)p0(_i0);if(F!==G)D8=_,F=qi0();if(_=F,_===G){if(_=w,Q.substr(w,2)===XQ0)F=XQ0,w+=2;else if(F=G,S0===0)p0(Di0);if(F!==G)D8=_,F=wi0();if(_=F,_===G){if(_=w,Q.substr(w,2)===JQ0)F=JQ0,w+=2;else if(F=G,S0===0)p0(Li0);if(F!==G)D8=_,F=Fi0();if(_=F,_===G){if(_=w,Q.substr(w,2)===ZQ0)F=ZQ0,w+=2;else if(F=G,S0===0)p0(Ai0);if(F!==G)D8=_,F=Ti0();if(_=F,_===G){if(_=w,Q.substr(w,2)===QQ0)F=QQ0,w+=2;else if(F=G,S0===0)p0(Mi0);if(F!==G)D8=_,F=Pi0();if(_=F,_===G){if(_=w,Q.substr(w,2)===YQ0)F=YQ0,w+=2;else if(F=G,S0===0)p0(Ri0);if(F!==G)D8=_,F=ji0();if(_=F,_===G){if(_=w,Q.substr(w,2)===GQ0)F=GQ0,w+=2;else if(F=G,S0===0)p0(Ci0);if(F!==G)D8=_,F=Ii0();if(_=F,_===G)_=oi0()}}}}}}return g0[R]={nextPos:w,result:_},_}function oi0(){var _,F,R,g,c,G0,T0,V8,Y9,vX,NX,Q7=w*49+48,h7=g0[Q7];if(h7)return w=h7.nextPos,h7.result;if(_=w,Q.substr(w,2)===KQ0)F=KQ0,w+=2;else if(F=G,S0===0)p0(Ei0);if(F!==G){if(R=w,g=c5(),g!==G)if(c=c5(),c!==G)if(G0=c5(),G0!==G)if(T0=c5(),T0!==G)if(V8=c5(),V8!==G)if(Y9=c5(),Y9!==G)if(vX=c5(),vX!==G)if(NX=c5(),NX!==G)g=[g,c,G0,T0,V8,Y9,vX,NX],R=g;else w=R,R=V;else w=R,R=V;else w=R,R=V;else w=R,R=V;else w=R,R=V;else w=R,R=V;else w=R,R=V;else w=R,R=V;if(R!==G)D8=_,F=BQ0(R),_=F;else w=_,_=V}else w=_,_=V;if(_===G){if(_=w,Q.substr(w,2)===HQ0)F=HQ0,w+=2;else if(F=G,S0===0)p0(Si0);if(F!==G){if(R=w,g=c5(),g!==G)if(c=c5(),c!==G)if(G0=c5(),G0!==G)if(T0=c5(),T0!==G)g=[g,c,G0,T0],R=g;else w=R,R=V;else w=R,R=V;else w=R,R=V;else w=R,R=V;if(R!==G)D8=_,F=BQ0(R),_=F;else w=_,_=V}else w=_,_=V}return g0[Q7]={nextPos:w,result:_},_}var CQ0=[];function ri0(_,F,R){var g=Error(_);throw g.line=F,g.column=R,g}function ru(_){CQ0.push(_)}function UZ(_,F,R,g,c){var G0={type:_,value:F,line:R(),column:g()};if(c)G0.key=c;return G0}function ai0(_,F,R){var g=parseInt("0x"+_);if(!isFinite(g)||Math.floor(g)!=g||g<0||g>1114111||g>55295&&g<57344)ri0("Invalid Unicode escape code: "+_,F,R);else return si0(g)}function si0(){var _=16384,F=[],R,g,c=-1,G0=arguments.length;if(!G0)return"";var T0="";while(++c<G0){var V8=Number(arguments[c]);if(V8<=65535)F.push(V8);else V8-=65536,R=(V8>>10)+55296,g=V8%1024+56320,F.push(R,g);if(c+1==G0||F.length>_)T0+=String.fromCharCode.apply(null,F),F.length=0}return T0}if(sR=B(),sR!==G&&w===Q.length)return sR;else{if(sR!==G&&w<Q.length)p0({type:"end",description:"end of input"});throw nu(null,pu,aR)}}return{SyntaxError:J,parse:Z}}()});var hC0=G8((rJ9,gC0)=>{function z_8(X){var J=[],Z=[],Q="",Y=Object.create(null),G=Y,K=!1;return B(X);function B(j){var T;for(var E=0;E<j.length;E++)switch(T=j[E],T.type){case"Assign":W(T);break;case"ObjectPath":q(T);break;case"ArrayPath":L(T);break}return Y}function H(j,T,E){var k=Error(j);throw k.line=T,k.column=E,k}function W(j){var{key:T,value:E,line:k,column:P}=j,C;if(Q)C=Q+"."+T;else C=T;if(typeof G[T]<"u")H("Cannot redefine existing key '"+C+"'.",k,P);if(G[T]=U(E),!V(C))J.push(C),Z.push(C)}function V(j){return J.indexOf(j)!==-1}function U(j){if(j.type==="Array")return M(j.value);else if(j.type==="InlineTable")return O(j.value);else return j.value}function O(j){var T=Object.create(null);for(var E=0;E<j.length;E++){var k=j[E];if(k.value.type==="InlineTable")T[k.key]=O(k.value.value);else if(k.type==="InlineTableValue")T[k.key]=U(k.value)}return T}function q(j){var T=j.value,E=T.map(x).join("."),k=j.line,P=j.column;if(V(E))H("Cannot redefine existing key '"+T+"'.",k,P);J.push(E),G=A(Y,T,Object.create(null),k,P),Q=T}function L(j){var T=j.value,E=T.map(x).join("."),k=j.line,P=j.column;if(!V(E))J.push(E);if(J=J.filter(function(v){return v.indexOf(E)!==0}),J.push(E),G=A(Y,T,[],k,P),Q=E,G instanceof Array){var C=Object.create(null);G.push(C),G=C}else H("Cannot redefine existing key '"+T+"'.",k,P)}function A(j,T,E,k,P){var C=[],v="",f=T.join("."),s=j;for(var l=0;l<T.length;l++){var W0=T[l];if(C.push(W0),v=C.join("."),typeof s[W0]>"u")if(l===T.length-1)s[W0]=E;else s[W0]=Object.create(null);else if(l!==T.length-1&&Z.indexOf(v)>-1)H("Cannot redefine existing key '"+v+"'.",k,P);if(s=s[W0],s instanceof Array&&s.length&&l<T.length-1)s=s[s.length-1]}return s}function M(j){var T=null;for(var E=0;E<j.length;E++){var k=j[E];if(T===null)T=k.type;else if(k.type!==T)H("Cannot add value of type "+k.type+" to array of type "+T+".",k.line,k.column)}return j.map(U)}function x(j){if(j.indexOf(".")>-1)return'"'+j+'"';else return j}}gC0.exports={compile:z_8}});var dC0=G8((aJ9,mC0)=>{var N_8=yC0(),O_8=hC0();mC0.exports={parse:function(X){var J=N_8.parse(X.toString());return O_8.compile(J)}}});var KX=G8((T_8)=>{var e00=Symbol.for("yaml.alias"),uC0=Symbol.for("yaml.document"),eb=Symbol.for("yaml.map"),cC0=Symbol.for("yaml.pair"),X80=Symbol.for("yaml.scalar"),Xy=Symbol.for("yaml.seq"),uH=Symbol.for("yaml.node.type"),__8=(X)=>!!X&&typeof X==="object"&&X[uH]===e00,q_8=(X)=>!!X&&typeof X==="object"&&X[uH]===uC0,D_8=(X)=>!!X&&typeof X==="object"&&X[uH]===eb,w_8=(X)=>!!X&&typeof X==="object"&&X[uH]===cC0,fC0=(X)=>!!X&&typeof X==="object"&&X[uH]===X80,L_8=(X)=>!!X&&typeof X==="object"&&X[uH]===Xy;function pC0(X){if(X&&typeof X==="object")switch(X[uH]){case eb:case Xy:return!0}return!1}function F_8(X){if(X&&typeof X==="object")switch(X[uH]){case e00:case eb:case X80:case Xy:return!0}return!1}var A_8=(X)=>(fC0(X)||pC0(X))&&!!X.anchor;T_8.ALIAS=e00;T_8.DOC=uC0;T_8.MAP=eb;T_8.NODE_TYPE=uH;T_8.PAIR=cC0;T_8.SCALAR=X80;T_8.SEQ=Xy;T_8.hasAnchor=A_8;T_8.isAlias=__8;T_8.isCollection=pC0;T_8.isDocument=q_8;T_8.isMap=D_8;T_8.isNode=F_8;T_8.isPair=w_8;T_8.isScalar=fC0;T_8.isSeq=L_8});var AM=G8((d_8)=>{var xJ=KX(),RY=Symbol("break visit"),lC0=Symbol("skip children"),v3=Symbol("remove node");function Jy(X,J){let Z=nC0(J);if(xJ.isDocument(X)){if(Nq(null,X.contents,Z,Object.freeze([X]))===v3)X.contents=null}else Nq(null,X,Z,Object.freeze([]))}Jy.BREAK=RY;Jy.SKIP=lC0;Jy.REMOVE=v3;function Nq(X,J,Z,Q){let Y=iC0(X,J,Z,Q);if(xJ.isNode(Y)||xJ.isPair(Y))return oC0(X,Q,Y),Nq(X,Y,Z,Q);if(typeof Y!=="symbol"){if(xJ.isCollection(J)){Q=Object.freeze(Q.concat(J));for(let G=0;G<J.items.length;++G){let K=Nq(G,J.items[G],Z,Q);if(typeof K==="number")G=K-1;else if(K===RY)return RY;else if(K===v3)J.items.splice(G,1),G-=1}}else if(xJ.isPair(J)){Q=Object.freeze(Q.concat(J));let G=Nq("key",J.key,Z,Q);if(G===RY)return RY;else if(G===v3)J.key=null;let K=Nq("value",J.value,Z,Q);if(K===RY)return RY;else if(K===v3)J.value=null}}return Y}async function Zy(X,J){let Z=nC0(J);if(xJ.isDocument(X)){if(await Oq(null,X.contents,Z,Object.freeze([X]))===v3)X.contents=null}else await Oq(null,X,Z,Object.freeze([]))}Zy.BREAK=RY;Zy.SKIP=lC0;Zy.REMOVE=v3;async function Oq(X,J,Z,Q){let Y=await iC0(X,J,Z,Q);if(xJ.isNode(Y)||xJ.isPair(Y))return oC0(X,Q,Y),Oq(X,Y,Z,Q);if(typeof Y!=="symbol"){if(xJ.isCollection(J)){Q=Object.freeze(Q.concat(J));for(let G=0;G<J.items.length;++G){let K=await Oq(G,J.items[G],Z,Q);if(typeof K==="number")G=K-1;else if(K===RY)return RY;else if(K===v3)J.items.splice(G,1),G-=1}}else if(xJ.isPair(J)){Q=Object.freeze(Q.concat(J));let G=await Oq("key",J.key,Z,Q);if(G===RY)return RY;else if(G===v3)J.key=null;let K=await Oq("value",J.value,Z,Q);if(K===RY)return RY;else if(K===v3)J.value=null}}return Y}function nC0(X){if(typeof X==="object"&&(X.Collection||X.Node||X.Value))return Object.assign({Alias:X.Node,Map:X.Node,Scalar:X.Node,Seq:X.Node},X.Value&&{Map:X.Value,Scalar:X.Value,Seq:X.Value},X.Collection&&{Map:X.Collection,Seq:X.Collection},X);return X}function iC0(X,J,Z,Q){if(typeof Z==="function")return Z(X,J,Q);if(xJ.isMap(J))return Z.Map?.(X,J,Q);if(xJ.isSeq(J))return Z.Seq?.(X,J,Q);if(xJ.isPair(J))return Z.Pair?.(X,J,Q);if(xJ.isScalar(J))return Z.Scalar?.(X,J,Q);if(xJ.isAlias(J))return Z.Alias?.(X,J,Q);return}function oC0(X,J,Z){let Q=J[J.length-1];if(xJ.isCollection(Q))Q.items[X]=Z;else if(xJ.isPair(Q))if(X==="key")Q.key=Z;else Q.value=Z;else if(xJ.isDocument(Q))Q.contents=Z;else{let Y=xJ.isAlias(Q)?"alias":"scalar";throw Error(`Cannot replace node with ${Y} parent`)}}d_8.visit=Jy;d_8.visitAsync=Zy});var J80=G8((n_8)=>{var rC0=KX(),f_8=AM(),p_8={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},l_8=(X)=>X.replace(/[!,[\]{}]/g,(J)=>p_8[J]);class y4{constructor(X,J){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},y4.defaultYaml,X),this.tags=Object.assign({},y4.defaultTags,J)}clone(){let X=new y4(this.yaml,this.tags);return X.docStart=this.docStart,X}atDocument(){let X=new y4(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:y4.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},y4.defaultTags);break}return X}add(X,J){if(this.atNextDocument)this.yaml={explicit:y4.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},y4.defaultTags),this.atNextDocument=!1;let Z=X.trim().split(/[ \t]+/),Q=Z.shift();switch(Q){case"%TAG":{if(Z.length!==2){if(J(0,"%TAG directive should contain exactly two parts"),Z.length<2)return!1}let[Y,G]=Z;return this.tags[Y]=G,!0}case"%YAML":{if(this.yaml.explicit=!0,Z.length!==1)return J(0,"%YAML directive should contain exactly one part"),!1;let[Y]=Z;if(Y==="1.1"||Y==="1.2")return this.yaml.version=Y,!0;else{let G=/^\d+\.\d+$/.test(Y);return J(6,`Unsupported YAML version ${Y}`,G),!1}}default:return J(0,`Unknown directive ${Q}`,!0),!1}}tagName(X,J){if(X==="!")return"!";if(X[0]!=="!")return J(`Not a valid tag: ${X}`),null;if(X[1]==="<"){let G=X.slice(2,-1);if(G==="!"||G==="!!")return J(`Verbatim tags aren't resolved, so ${X} is invalid.`),null;if(X[X.length-1]!==">")J("Verbatim tags must end with a >");return G}let[,Z,Q]=X.match(/^(.*!)([^!]*)$/s);if(!Q)J(`The ${X} tag has no suffix`);let Y=this.tags[Z];if(Y)try{return Y+decodeURIComponent(Q)}catch(G){return J(String(G)),null}if(Z==="!")return X;return J(`Could not resolve tag: ${X}`),null}tagString(X){for(let[J,Z]of Object.entries(this.tags))if(X.startsWith(Z))return J+l_8(X.substring(Z.length));return X[0]==="!"?X:`!<${X}>`}toString(X){let J=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],Z=Object.entries(this.tags),Q;if(X&&Z.length>0&&rC0.isNode(X.contents)){let Y={};f_8.visit(X.contents,(G,K)=>{if(rC0.isNode(K)&&K.tag)Y[K.tag]=!0}),Q=Object.keys(Y)}else Q=[];for(let[Y,G]of Z){if(Y==="!!"&&G==="tag:yaml.org,2002:")continue;if(!X||Q.some((K)=>K.startsWith(G)))J.push(`%TAG ${Y} ${G}`)}return J.join(`
9
+ `)}}y4.defaultYaml={explicit:!1,version:"1.2"};y4.defaultTags={"!!":"tag:yaml.org,2002:"};n_8.Directives=y4});var Qy=G8((s_8)=>{var aC0=KX(),o_8=AM();function r_8(X){if(/[\x00-\x19\s,[\]{}]/.test(X)){let Z=`Anchor must not contain whitespace or control characters: ${JSON.stringify(X)}`;throw Error(Z)}return!0}function sC0(X){let J=new Set;return o_8.visit(X,{Value(Z,Q){if(Q.anchor)J.add(Q.anchor)}}),J}function tC0(X,J){for(let Z=1;;++Z){let Q=`${X}${Z}`;if(!J.has(Q))return Q}}function a_8(X,J){let Z=[],Q=new Map,Y=null;return{onAnchor:(G)=>{Z.push(G),Y??(Y=sC0(X));let K=tC0(J,Y);return Y.add(K),K},setAnchors:()=>{for(let G of Z){let K=Q.get(G);if(typeof K==="object"&&K.anchor&&(aC0.isScalar(K.node)||aC0.isCollection(K.node)))K.node.anchor=K.anchor;else{let B=Error("Failed to resolve repeated object (this should not happen)");throw B.source=G,B}}},sourceObjects:Q}}s_8.anchorIsValid=r_8;s_8.anchorNames=sC0;s_8.createNodeAnchors=a_8;s_8.findNewAnchor=tC0});var Z80=G8((Zq8)=>{function TM(X,J,Z,Q){if(Q&&typeof Q==="object")if(Array.isArray(Q))for(let Y=0,G=Q.length;Y<G;++Y){let K=Q[Y],B=TM(X,Q,String(Y),K);if(B===void 0)delete Q[Y];else if(B!==K)Q[Y]=B}else if(Q instanceof Map)for(let Y of Array.from(Q.keys())){let G=Q.get(Y),K=TM(X,Q,Y,G);if(K===void 0)Q.delete(Y);else if(K!==G)Q.set(Y,K)}else if(Q instanceof Set)for(let Y of Array.from(Q)){let G=TM(X,Q,Y,Y);if(G===void 0)Q.delete(Y);else if(G!==Y)Q.delete(Y),Q.add(G)}else for(let[Y,G]of Object.entries(Q)){let K=TM(X,Q,Y,G);if(K===void 0)delete Q[Y];else if(K!==G)Q[Y]=K}return X.call(J,Z,Q)}Zq8.applyReviver=TM});var fW=G8((Gq8)=>{var Yq8=KX();function eC0(X,J,Z){if(Array.isArray(X))return X.map((Q,Y)=>eC0(Q,String(Y),Z));if(X&&typeof X.toJSON==="function"){if(!Z||!Yq8.hasAnchor(X))return X.toJSON(J,Z);let Q={aliasCount:0,count:1,res:void 0};Z.anchors.set(X,Q),Z.onCreate=(G)=>{Q.res=G,delete Z.onCreate};let Y=X.toJSON(J,Z);if(Z.onCreate)Z.onCreate(Y);return Y}if(typeof X==="bigint"&&!Z?.keep)return Number(X);return X}Gq8.toJS=eC0});var Yy=G8((Wq8)=>{var Bq8=Z80(),XI0=KX(),Hq8=fW();class JI0{constructor(X){Object.defineProperty(this,XI0.NODE_TYPE,{value:X})}clone(){let X=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)X.range=this.range.slice();return X}toJS(X,{mapAsMap:J,maxAliasCount:Z,onAnchor:Q,reviver:Y}={}){if(!XI0.isDocument(X))throw TypeError("A document argument is required");let G={anchors:new Map,doc:X,keep:!0,mapAsMap:J===!0,mapKeyWarned:!1,maxAliasCount:typeof Z==="number"?Z:100},K=Hq8.toJS(this,"",G);if(typeof Q==="function")for(let{count:B,res:H}of G.anchors.values())Q(H,B);return typeof Y==="function"?Bq8.applyReviver(Y,{"":K},"",K):K}}Wq8.NodeBase=JI0});var MM=G8((Oq8)=>{var $q8=Qy(),Uq8=AM(),_q=KX(),zq8=Yy(),Nq8=fW();class ZI0 extends zq8.NodeBase{constructor(X){super(_q.ALIAS);this.source=X,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(X,J){if(J?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let Z;if(J?.aliasResolveCache)Z=J.aliasResolveCache;else if(Z=[],Uq8.visit(X,{Node:(Y,G)=>{if(_q.isAlias(G)||_q.hasAnchor(G))Z.push(G)}}),J)J.aliasResolveCache=Z;let Q=void 0;for(let Y of Z){if(Y===this)break;if(Y.anchor===this.source)Q=Y}return Q}toJSON(X,J){if(!J)return{source:this.source};let{anchors:Z,doc:Q,maxAliasCount:Y}=J,G=this.resolve(Q,J);if(!G){let B=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(B)}let K=Z.get(G);if(!K)Nq8.toJS(G,null,J),K=Z.get(G);if(K?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(Y>=0){if(K.count+=1,K.aliasCount===0)K.aliasCount=Gy(Q,G,Z);if(K.count*K.aliasCount>Y)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return K.res}toString(X,J,Z){let Q=`*${this.source}`;if(X){if($q8.anchorIsValid(this.source),X.options.verifyAliasOrder&&!X.anchors.has(this.source)){let Y=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(Y)}if(X.implicitKey)return`${Q} `}return Q}}function Gy(X,J,Z){if(_q.isAlias(J)){let Q=J.resolve(X),Y=Z&&Q&&Z.get(Q);return Y?Y.count*Y.aliasCount:0}else if(_q.isCollection(J)){let Q=0;for(let Y of J.items){let G=Gy(X,Y,Z);if(G>Q)Q=G}return Q}else if(_q.isPair(J)){let Q=Gy(X,J.key,Z),Y=Gy(X,J.value,Z);return Math.max(Q,Y)}return 1}Oq8.Alias=ZI0});var VJ=G8((Fq8)=>{var qq8=KX(),Dq8=Yy(),wq8=fW(),Lq8=(X)=>!X||typeof X!=="function"&&typeof X!=="object";class tU extends Dq8.NodeBase{constructor(X){super(qq8.SCALAR);this.value=X}toJSON(X,J){return J?.keep?this.value:wq8.toJS(this.value,X,J)}toString(){return String(this.value)}}tU.BLOCK_FOLDED="BLOCK_FOLDED";tU.BLOCK_LITERAL="BLOCK_LITERAL";tU.PLAIN="PLAIN";tU.QUOTE_DOUBLE="QUOTE_DOUBLE";tU.QUOTE_SINGLE="QUOTE_SINGLE";Fq8.Scalar=tU;Fq8.isScalarValue=Lq8});var PM=G8((Cq8)=>{var Mq8=MM(),eU=KX(),QI0=VJ(),Pq8="tag:yaml.org,2002:";function Rq8(X,J,Z){if(J){let Q=Z.filter((G)=>G.tag===J),Y=Q.find((G)=>!G.format)??Q[0];if(!Y)throw Error(`Tag ${J} not found`);return Y}return Z.find((Q)=>Q.identify?.(X)&&!Q.format)}function jq8(X,J,Z){if(eU.isDocument(X))X=X.contents;if(eU.isNode(X))return X;if(eU.isPair(X)){let U=Z.schema[eU.MAP].createNode?.(Z.schema,null,Z);return U.items.push(X),U}if(X instanceof String||X instanceof Number||X instanceof Boolean||typeof BigInt<"u"&&X instanceof BigInt)X=X.valueOf();let{aliasDuplicateObjects:Q,onAnchor:Y,onTagObj:G,schema:K,sourceObjects:B}=Z,H=void 0;if(Q&&X&&typeof X==="object")if(H=B.get(X),H)return H.anchor??(H.anchor=Y(X)),new Mq8.Alias(H.anchor);else H={anchor:null,node:null},B.set(X,H);if(J?.startsWith("!!"))J=Pq8+J.slice(2);let W=Rq8(X,J,K.tags);if(!W){if(X&&typeof X.toJSON==="function")X=X.toJSON();if(!X||typeof X!=="object"){let U=new QI0.Scalar(X);if(H)H.node=U;return U}W=X instanceof Map?K[eU.MAP]:(Symbol.iterator in Object(X))?K[eU.SEQ]:K[eU.MAP]}if(G)G(W),delete Z.onTagObj;let V=W?.createNode?W.createNode(Z.schema,X,Z):typeof W?.nodeClass?.from==="function"?W.nodeClass.from(Z.schema,X,Z):new QI0.Scalar(X);if(J)V.tag=J;else if(!W.default)V.tag=W.tag;if(H)H.node=V;return V}Cq8.createNode=jq8});var Ky=G8((xq8)=>{var Eq8=PM(),k3=KX(),Sq8=Yy();function Q80(X,J,Z){let Q=Z;for(let Y=J.length-1;Y>=0;--Y){let G=J[Y];if(typeof G==="number"&&Number.isInteger(G)&&G>=0){let K=[];K[G]=Q,Q=K}else Q=new Map([[G,Q]])}return Eq8.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:X,sourceObjects:new Map})}var YI0=(X)=>X==null||typeof X==="object"&&!!X[Symbol.iterator]().next().done;class GI0 extends Sq8.NodeBase{constructor(X,J){super(X);Object.defineProperty(this,"schema",{value:J,configurable:!0,enumerable:!1,writable:!0})}clone(X){let J=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(X)J.schema=X;if(J.items=J.items.map((Z)=>k3.isNode(Z)||k3.isPair(Z)?Z.clone(X):Z),this.range)J.range=this.range.slice();return J}addIn(X,J){if(YI0(X))this.add(J);else{let[Z,...Q]=X,Y=this.get(Z,!0);if(k3.isCollection(Y))Y.addIn(Q,J);else if(Y===void 0&&this.schema)this.set(Z,Q80(this.schema,Q,J));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${Q}`)}}deleteIn(X){let[J,...Z]=X;if(Z.length===0)return this.delete(J);let Q=this.get(J,!0);if(k3.isCollection(Q))return Q.deleteIn(Z);else throw Error(`Expected YAML collection at ${J}. Remaining path: ${Z}`)}getIn(X,J){let[Z,...Q]=X,Y=this.get(Z,!0);if(Q.length===0)return!J&&k3.isScalar(Y)?Y.value:Y;else return k3.isCollection(Y)?Y.getIn(Q,J):void 0}hasAllNullValues(X){return this.items.every((J)=>{if(!k3.isPair(J))return!1;let Z=J.value;return Z==null||X&&k3.isScalar(Z)&&Z.value==null&&!Z.commentBefore&&!Z.comment&&!Z.tag})}hasIn(X){let[J,...Z]=X;if(Z.length===0)return this.has(J);let Q=this.get(J,!0);return k3.isCollection(Q)?Q.hasIn(Z):!1}setIn(X,J){let[Z,...Q]=X;if(Q.length===0)this.set(Z,J);else{let Y=this.get(Z,!0);if(k3.isCollection(Y))Y.setIn(Q,J);else if(Y===void 0&&this.schema)this.set(Z,Q80(this.schema,Q,J));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${Q}`)}}}xq8.Collection=GI0;xq8.collectionFromPath=Q80;xq8.isEmptyPath=YI0});var RM=G8((hq8)=>{var yq8=(X)=>X.replace(/^(?!$)(?: $)?/gm,"#");function Y80(X,J){if(/^\n+$/.test(X))return X.substring(1);return J?X.replace(/^(?! *$)/gm,J):X}var gq8=(X,J,Z)=>X.endsWith(`
10
+ `)?Y80(Z,J):Z.includes(`
11
+ `)?`
12
+ `+Y80(Z,J):(X.endsWith(" ")?"":" ")+Z;hq8.indentComment=Y80;hq8.lineComment=gq8;hq8.stringifyComment=yq8});var BI0=G8((fq8)=>{function cq8(X,J,Z="flow",{indentAtStart:Q,lineWidth:Y=80,minContentWidth:G=20,onFold:K,onOverflow:B}={}){if(!Y||Y<0)return X;if(Y<G)G=0;let H=Math.max(1+G,1+Y-J.length);if(X.length<=H)return X;let W=[],V={},U=Y-J.length;if(typeof Q==="number")if(Q>Y-Math.max(2,G))W.push(0);else U=Y-Q;let O=void 0,q=void 0,L=!1,A=-1,M=-1,x=-1;if(Z==="block"){if(A=KI0(X,A,J.length),A!==-1)U=A+H}for(let T;T=X[A+=1];){if(Z==="quoted"&&T==="\\"){switch(M=A,X[A+1]){case"x":A+=3;break;case"u":A+=5;break;case"U":A+=9;break;default:A+=1}x=A}if(T===`
13
+ `){if(Z==="block")A=KI0(X,A,J.length);U=A+J.length+H,O=void 0}else{if(T===" "&&q&&q!==" "&&q!==`
14
+ `&&q!=="\t"){let E=X[A+1];if(E&&E!==" "&&E!==`
15
+ `&&E!=="\t")O=A}if(A>=U)if(O)W.push(O),U=O+H,O=void 0;else if(Z==="quoted"){while(q===" "||q==="\t")q=T,T=X[A+=1],L=!0;let E=A>x+1?A-2:M-1;if(V[E])return X;W.push(E),V[E]=!0,U=E+H,O=void 0}else L=!0}q=T}if(L&&B)B();if(W.length===0)return X;if(K)K();let j=X.slice(0,W[0]);for(let T=0;T<W.length;++T){let E=W[T],k=W[T+1]||X.length;if(E===0)j=`
16
+ ${J}${X.slice(0,k)}`;else{if(Z==="quoted"&&V[E])j+=`${X[E]}\\`;j+=`
17
+ ${J}${X.slice(E+1,k)}`}}return j}function KI0(X,J,Z){let Q=J,Y=J+1,G=X[Y];while(G===" "||G==="\t")if(J<Y+Z)G=X[++J];else{do G=X[++J];while(G&&G!==`
18
+ `);Q=J,Y=J+1,G=X[Y]}return Q}fq8.FOLD_BLOCK="block";fq8.FOLD_FLOW="flow";fq8.FOLD_QUOTED="quoted";fq8.foldFlowLines=cq8});var CM=G8((sq8)=>{var sG=VJ(),pW=BI0(),Hy=(X,J)=>({indentAtStart:J?X.indent.length:X.indentAtStart,lineWidth:X.options.lineWidth,minContentWidth:X.options.minContentWidth}),Wy=(X)=>/^(%|---|\.\.\.)/m.test(X);function oq8(X,J,Z){if(!J||J<0)return!1;let Q=J-Z,Y=X.length;if(Y<=Q)return!1;for(let G=0,K=0;G<Y;++G)if(X[G]===`
19
+ `){if(G-K>Q)return!0;if(K=G+1,Y-K<=Q)return!1}return!0}function jM(X,J){let Z=JSON.stringify(X);if(J.options.doubleQuotedAsJSON)return Z;let{implicitKey:Q}=J,Y=J.options.doubleQuotedMinMultiLineLength,G=J.indent||(Wy(X)?" ":""),K="",B=0;for(let H=0,W=Z[H];W;W=Z[++H]){if(W===" "&&Z[H+1]==="\\"&&Z[H+2]==="n")K+=Z.slice(B,H)+"\\ ",H+=1,B=H,W="\\";if(W==="\\")switch(Z[H+1]){case"u":{K+=Z.slice(B,H);let V=Z.substr(H+2,4);switch(V){case"0000":K+="\\0";break;case"0007":K+="\\a";break;case"000b":K+="\\v";break;case"001b":K+="\\e";break;case"0085":K+="\\N";break;case"00a0":K+="\\_";break;case"2028":K+="\\L";break;case"2029":K+="\\P";break;default:if(V.substr(0,2)==="00")K+="\\x"+V.substr(2);else K+=Z.substr(H,6)}H+=5,B=H+1}break;case"n":if(Q||Z[H+2]==='"'||Z.length<Y)H+=1;else{K+=Z.slice(B,H)+`
20
+
21
+ `;while(Z[H+2]==="\\"&&Z[H+3]==="n"&&Z[H+4]!=='"')K+=`
22
+ `,H+=2;if(K+=G,Z[H+2]===" ")K+="\\";H+=1,B=H+1}break;default:H+=1}}return K=B?K+Z.slice(B):Z,Q?K:pW.foldFlowLines(K,G,pW.FOLD_QUOTED,Hy(J,!1))}function G80(X,J){if(J.options.singleQuote===!1||J.implicitKey&&X.includes(`
23
+ `)||/[ \t]\n|\n[ \t]/.test(X))return jM(X,J);let Z=J.indent||(Wy(X)?" ":""),Q="'"+X.replace(/'/g,"''").replace(/\n+/g,`$&
24
+ ${Z}`)+"'";return J.implicitKey?Q:pW.foldFlowLines(Q,Z,pW.FOLD_FLOW,Hy(J,!1))}function qq(X,J){let{singleQuote:Z}=J.options,Q;if(Z===!1)Q=jM;else{let Y=X.includes('"'),G=X.includes("'");if(Y&&!G)Q=G80;else if(G&&!Y)Q=jM;else Q=Z?G80:jM}return Q(X,J)}var K80;try{K80=new RegExp(`(^|(?<!
25
+ ))
26
+ +(?!
27
+ |$)`,"g")}catch{K80=/\n+(?!\n|$)/g}function By({comment:X,type:J,value:Z},Q,Y,G){let{blockQuote:K,commentString:B,lineWidth:H}=Q.options;if(!K||/\n[\t ]+$/.test(Z))return qq(Z,Q);let W=Q.indent||(Q.forceBlockIndent||Wy(Z)?" ":""),V=K==="literal"?!0:K==="folded"||J===sG.Scalar.BLOCK_FOLDED?!1:J===sG.Scalar.BLOCK_LITERAL?!0:!oq8(Z,H,W.length);if(!Z)return V?`|
28
+ `:`>
29
+ `;let U,O;for(O=Z.length;O>0;--O){let k=Z[O-1];if(k!==`
30
+ `&&k!=="\t"&&k!==" ")break}let q=Z.substring(O),L=q.indexOf(`
31
+ `);if(L===-1)U="-";else if(Z===q||L!==q.length-1){if(U="+",G)G()}else U="";if(q){if(Z=Z.slice(0,-q.length),q[q.length-1]===`
32
+ `)q=q.slice(0,-1);q=q.replace(K80,`$&${W}`)}let A=!1,M,x=-1;for(M=0;M<Z.length;++M){let k=Z[M];if(k===" ")A=!0;else if(k===`
33
+ `)x=M;else break}let j=Z.substring(0,x<M?x+1:M);if(j)Z=Z.substring(j.length),j=j.replace(/\n+/g,`$&${W}`);let E=(A?W?"2":"1":"")+U;if(X){if(E+=" "+B(X.replace(/ ?[\r\n]+/g," ")),Y)Y()}if(!V){let k=Z.replace(/\n+/g,`
34
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${W}`),P=!1,C=Hy(Q,!0);if(K!=="folded"&&J!==sG.Scalar.BLOCK_FOLDED)C.onOverflow=()=>{P=!0};let v=pW.foldFlowLines(`${j}${k}${q}`,W,pW.FOLD_BLOCK,C);if(!P)return`>${E}
35
+ ${W}${v}`}return Z=Z.replace(/\n+/g,`$&${W}`),`|${E}
36
+ ${W}${j}${Z}${q}`}function rq8(X,J,Z,Q){let{type:Y,value:G}=X,{actualString:K,implicitKey:B,indent:H,indentStep:W,inFlow:V}=J;if(B&&G.includes(`
37
+ `)||V&&/[[\]{},]/.test(G))return qq(G,J);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(G))return B||V||!G.includes(`
38
+ `)?qq(G,J):By(X,J,Z,Q);if(!B&&!V&&Y!==sG.Scalar.PLAIN&&G.includes(`
39
+ `))return By(X,J,Z,Q);if(Wy(G)){if(H==="")return J.forceBlockIndent=!0,By(X,J,Z,Q);else if(B&&H===W)return qq(G,J)}let U=G.replace(/\n+/g,`$&
40
+ ${H}`);if(K){let O=(A)=>A.default&&A.tag!=="tag:yaml.org,2002:str"&&A.test?.test(U),{compat:q,tags:L}=J.doc.schema;if(L.some(O)||q?.some(O))return qq(G,J)}return B?U:pW.foldFlowLines(U,H,pW.FOLD_FLOW,Hy(J,!1))}function aq8(X,J,Z,Q){let{implicitKey:Y,inFlow:G}=J,K=typeof X.value==="string"?X:Object.assign({},X,{value:String(X.value)}),{type:B}=X;if(B!==sG.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(K.value))B=sG.Scalar.QUOTE_DOUBLE}let H=(V)=>{switch(V){case sG.Scalar.BLOCK_FOLDED:case sG.Scalar.BLOCK_LITERAL:return Y||G?qq(K.value,J):By(K,J,Z,Q);case sG.Scalar.QUOTE_DOUBLE:return jM(K.value,J);case sG.Scalar.QUOTE_SINGLE:return G80(K.value,J);case sG.Scalar.PLAIN:return rq8(K,J,Z,Q);default:return null}},W=H(B);if(W===null){let{defaultKeyType:V,defaultStringType:U}=J.options,O=Y&&V||U;if(W=H(O),W===null)throw Error(`Unsupported default string type ${O}`)}return W}sq8.stringifyString=aq8});var IM=G8((KD8)=>{var eq8=Qy(),lW=KX(),XD8=RM(),JD8=CM();function ZD8(X,J){let Z=Object.assign({blockQuote:!0,commentString:XD8.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},X.schema.toStringOptions,J),Q;switch(Z.collectionStyle){case"block":Q=!1;break;case"flow":Q=!0;break;default:Q=null}return{anchors:new Set,doc:X,flowCollectionPadding:Z.flowCollectionPadding?" ":"",indent:"",indentStep:typeof Z.indent==="number"?" ".repeat(Z.indent):" ",inFlow:Q,options:Z}}function QD8(X,J){if(J.tag){let Y=X.filter((G)=>G.tag===J.tag);if(Y.length>0)return Y.find((G)=>G.format===J.format)??Y[0]}let Z=void 0,Q;if(lW.isScalar(J)){Q=J.value;let Y=X.filter((G)=>G.identify?.(Q));if(Y.length>1){let G=Y.filter((K)=>K.test);if(G.length>0)Y=G}Z=Y.find((G)=>G.format===J.format)??Y.find((G)=>!G.format)}else Q=J,Z=X.find((Y)=>Y.nodeClass&&Q instanceof Y.nodeClass);if(!Z){let Y=Q?.constructor?.name??(Q===null?"null":typeof Q);throw Error(`Tag not resolved for ${Y} value`)}return Z}function YD8(X,J,{anchors:Z,doc:Q}){if(!Q.directives)return"";let Y=[],G=(lW.isScalar(X)||lW.isCollection(X))&&X.anchor;if(G&&eq8.anchorIsValid(G))Z.add(G),Y.push(`&${G}`);let K=X.tag??(J.default?null:J.tag);if(K)Y.push(Q.directives.tagString(K));return Y.join(" ")}function GD8(X,J,Z,Q){if(lW.isPair(X))return X.toString(J,Z,Q);if(lW.isAlias(X)){if(J.doc.directives)return X.toString(J);if(J.resolvedAliases?.has(X))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(J.resolvedAliases)J.resolvedAliases.add(X);else J.resolvedAliases=new Set([X]);X=X.resolve(J.doc)}}let Y=void 0,G=lW.isNode(X)?X:J.doc.createNode(X,{onTagObj:(H)=>Y=H});Y??(Y=QD8(J.doc.schema.tags,G));let K=YD8(G,Y,J);if(K.length>0)J.indentAtStart=(J.indentAtStart??0)+K.length+1;let B=typeof Y.stringify==="function"?Y.stringify(G,J,Z,Q):lW.isScalar(G)?JD8.stringifyString(G,J,Z,Q):G.toString(J,Z,Q);if(!K)return B;return lW.isScalar(G)||B[0]==="{"||B[0]==="["?`${K} ${B}`:`${K}
41
+ ${J.indent}${B}`}KD8.createStringifyContext=ZD8;KD8.stringify=GD8});var VI0=G8((VD8)=>{var cH=KX(),HI0=VJ(),WI0=IM(),EM=RM();function WD8({key:X,value:J},Z,Q,Y){let{allNullValues:G,doc:K,indent:B,indentStep:H,options:{commentString:W,indentSeq:V,simpleKeys:U}}=Z,O=cH.isNode(X)&&X.comment||null;if(U){if(O)throw Error("With simple keys, key nodes cannot have comments");if(cH.isCollection(X)||!cH.isNode(X)&&typeof X==="object")throw Error("With simple keys, collection cannot be used as a key value")}let q=!U&&(!X||O&&J==null&&!Z.inFlow||cH.isCollection(X)||(cH.isScalar(X)?X.type===HI0.Scalar.BLOCK_FOLDED||X.type===HI0.Scalar.BLOCK_LITERAL:typeof X==="object"));Z=Object.assign({},Z,{allNullValues:!1,implicitKey:!q&&(U||!G),indent:B+H});let L=!1,A=!1,M=WI0.stringify(X,Z,()=>L=!0,()=>A=!0);if(!q&&!Z.inFlow&&M.length>1024){if(U)throw Error("With simple keys, single line scalar must not span more than 1024 characters");q=!0}if(Z.inFlow){if(G||J==null){if(L&&Q)Q();return M===""?"?":q?`? ${M}`:M}}else if(G&&!U||J==null&&q){if(M=`? ${M}`,O&&!L)M+=EM.lineComment(M,Z.indent,W(O));else if(A&&Y)Y();return M}if(L)O=null;if(q){if(O)M+=EM.lineComment(M,Z.indent,W(O));M=`? ${M}
42
+ ${B}:`}else if(M=`${M}:`,O)M+=EM.lineComment(M,Z.indent,W(O));let x,j,T;if(cH.isNode(J))x=!!J.spaceBefore,j=J.commentBefore,T=J.comment;else if(x=!1,j=null,T=null,J&&typeof J==="object")J=K.createNode(J);if(Z.implicitKey=!1,!q&&!O&&cH.isScalar(J))Z.indentAtStart=M.length+1;if(A=!1,!V&&H.length>=2&&!Z.inFlow&&!q&&cH.isSeq(J)&&!J.flow&&!J.tag&&!J.anchor)Z.indent=Z.indent.substring(2);let E=!1,k=WI0.stringify(J,Z,()=>E=!0,()=>A=!0),P=" ";if(O||x||j){if(P=x?`
43
+ `:"",j){let C=W(j);P+=`
44
+ ${EM.indentComment(C,Z.indent)}`}if(k===""&&!Z.inFlow){if(P===`
45
+ `&&T)P=`
46
+
47
+ `}else P+=`
48
+ ${Z.indent}`}else if(!q&&cH.isCollection(J)){let C=k[0],v=k.indexOf(`
49
+ `),f=v!==-1,s=Z.inFlow??J.flow??J.items.length===0;if(f||!s){let l=!1;if(f&&(C==="&"||C==="!")){let W0=k.indexOf(" ");if(C==="&"&&W0!==-1&&W0<v&&k[W0+1]==="!")W0=k.indexOf(" ",W0+1);if(W0===-1||v<W0)l=!0}if(!l)P=`
50
+ ${Z.indent}`}}else if(k===""||k[0]===`
51
+ `)P="";if(M+=P+k,Z.inFlow){if(E&&Q)Q()}else if(T&&!E)M+=EM.lineComment(M,Z.indent,W(T));else if(A&&Y)Y();return M}VD8.stringifyPair=WD8});var B80=G8((ND8)=>{var $I0=GN("process");function UD8(X,...J){if(X==="debug")console.log(...J)}function zD8(X,J){if(X==="debug"||X==="warn")if(typeof $I0.emitWarning==="function")$I0.emitWarning(J);else console.warn(J)}ND8.debug=UD8;ND8.warn=zD8});var zy=G8((DD8)=>{var Uy=KX(),UI0=VJ(),Vy="<<",$y={identify:(X)=>X===Vy||typeof X==="symbol"&&X.description===Vy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new UI0.Scalar(Symbol(Vy)),{addToJSMap:zI0}),stringify:()=>Vy},qD8=(X,J)=>($y.identify(J)||Uy.isScalar(J)&&(!J.type||J.type===UI0.Scalar.PLAIN)&&$y.identify(J.value))&&X?.doc.schema.tags.some((Z)=>Z.tag===$y.tag&&Z.default);function zI0(X,J,Z){let Q=NI0(X,Z);if(Uy.isSeq(Q))for(let Y of Q.items)H80(X,J,Y);else if(Array.isArray(Q))for(let Y of Q)H80(X,J,Y);else H80(X,J,Q)}function H80(X,J,Z){let Q=NI0(X,Z);if(!Uy.isMap(Q))throw Error("Merge sources must be maps or map aliases");let Y=Q.toJSON(null,X,Map);for(let[G,K]of Y)if(J instanceof Map){if(!J.has(G))J.set(G,K)}else if(J instanceof Set)J.add(G);else if(!Object.prototype.hasOwnProperty.call(J,G))Object.defineProperty(J,G,{value:K,writable:!0,enumerable:!0,configurable:!0});return J}function NI0(X,J){return X&&Uy.isAlias(J)?J.resolve(X.doc,X):J}DD8.addMergeToJSMap=zI0;DD8.isMergeKey=qD8;DD8.merge=$y});var V80=G8((RD8)=>{var AD8=B80(),OI0=zy(),TD8=IM(),_I0=KX(),W80=fW();function MD8(X,J,{key:Z,value:Q}){if(_I0.isNode(Z)&&Z.addToJSMap)Z.addToJSMap(X,J,Q);else if(OI0.isMergeKey(X,Z))OI0.addMergeToJSMap(X,J,Q);else{let Y=W80.toJS(Z,"",X);if(J instanceof Map)J.set(Y,W80.toJS(Q,Y,X));else if(J instanceof Set)J.add(Y);else{let G=PD8(Z,Y,X),K=W80.toJS(Q,G,X);if(G in J)Object.defineProperty(J,G,{value:K,writable:!0,enumerable:!0,configurable:!0});else J[G]=K}}return J}function PD8(X,J,Z){if(J===null)return"";if(typeof J!=="object")return String(J);if(_I0.isNode(X)&&Z?.doc){let Q=TD8.createStringifyContext(Z.doc,{});Q.anchors=new Set;for(let G of Z.anchors.keys())Q.anchors.add(G.anchor);Q.inFlow=!0,Q.inStringifyKey=!0;let Y=X.toString(Q);if(!Z.mapKeyWarned){let G=JSON.stringify(Y);if(G.length>40)G=G.substring(0,36)+'..."';AD8.warn(Z.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${G}. Set mapAsMap: true to use object keys.`),Z.mapKeyWarned=!0}return Y}return JSON.stringify(J)}RD8.addPairToJSMap=MD8});var nW=G8((SD8)=>{var qI0=PM(),CD8=VI0(),ID8=V80(),Ny=KX();function ED8(X,J,Z){let Q=qI0.createNode(X,void 0,Z),Y=qI0.createNode(J,void 0,Z);return new Oy(Q,Y)}class Oy{constructor(X,J=null){Object.defineProperty(this,Ny.NODE_TYPE,{value:Ny.PAIR}),this.key=X,this.value=J}clone(X){let{key:J,value:Z}=this;if(Ny.isNode(J))J=J.clone(X);if(Ny.isNode(Z))Z=Z.clone(X);return new Oy(J,Z)}toJSON(X,J){let Z=J?.mapAsMap?new Map:{};return ID8.addPairToJSMap(J,Z,this)}toString(X,J,Z){return X?.doc?CD8.stringifyPair(this,X,J,Z):JSON.stringify(this)}}SD8.Pair=Oy;SD8.createPair=ED8});var $80=G8((gD8)=>{var Xz=KX(),DI0=IM(),_y=RM();function kD8(X,J,Z){return(J.inFlow??X.flow?yD8:bD8)(X,J,Z)}function bD8({comment:X,items:J},Z,{blockItemPrefix:Q,flowChars:Y,itemIndent:G,onChompKeep:K,onComment:B}){let{indent:H,options:{commentString:W}}=Z,V=Object.assign({},Z,{indent:G,type:null}),U=!1,O=[];for(let L=0;L<J.length;++L){let A=J[L],M=null;if(Xz.isNode(A)){if(!U&&A.spaceBefore)O.push("");if(qy(Z,O,A.commentBefore,U),A.comment)M=A.comment}else if(Xz.isPair(A)){let j=Xz.isNode(A.key)?A.key:null;if(j){if(!U&&j.spaceBefore)O.push("");qy(Z,O,j.commentBefore,U)}}U=!1;let x=DI0.stringify(A,V,()=>M=null,()=>U=!0);if(M)x+=_y.lineComment(x,G,W(M));if(U&&M)U=!1;O.push(Q+x)}let q;if(O.length===0)q=Y.start+Y.end;else{q=O[0];for(let L=1;L<O.length;++L){let A=O[L];q+=A?`
52
+ ${H}${A}`:`
53
+ `}}if(X){if(q+=`
54
+ `+_y.indentComment(W(X),H),B)B()}else if(U&&K)K();return q}function yD8({items:X},J,{flowChars:Z,itemIndent:Q}){let{indent:Y,indentStep:G,flowCollectionPadding:K,options:{commentString:B}}=J;Q+=G;let H=Object.assign({},J,{indent:Q,inFlow:!0,type:null}),W=!1,V=0,U=[];for(let L=0;L<X.length;++L){let A=X[L],M=null;if(Xz.isNode(A)){if(A.spaceBefore)U.push("");if(qy(J,U,A.commentBefore,!1),A.comment)M=A.comment}else if(Xz.isPair(A)){let j=Xz.isNode(A.key)?A.key:null;if(j){if(j.spaceBefore)U.push("");if(qy(J,U,j.commentBefore,!1),j.comment)W=!0}let T=Xz.isNode(A.value)?A.value:null;if(T){if(T.comment)M=T.comment;if(T.commentBefore)W=!0}else if(A.value==null&&j?.comment)M=j.comment}if(M)W=!0;let x=DI0.stringify(A,H,()=>M=null);if(W||(W=U.length>V||x.includes(`
55
+ `)),L<X.length-1)x+=",";else if(J.options.trailingComma){if(J.options.lineWidth>0)W||(W=U.reduce((j,T)=>j+T.length+2,2)+(x.length+2)>J.options.lineWidth);if(W)x+=","}if(M)x+=_y.lineComment(x,Q,B(M));U.push(x),V=U.length}let{start:O,end:q}=Z;if(U.length===0)return O+q;else{if(!W){let L=U.reduce((A,M)=>A+M.length+2,2);W=J.options.lineWidth>0&&L>J.options.lineWidth}if(W){let L=O;for(let A of U)L+=A?`
56
+ ${G}${Y}${A}`:`
57
+ `;return`${L}
58
+ ${Y}${q}`}else return`${O}${K}${U.join(" ")}${K}${q}`}}function qy({indent:X,options:{commentString:J}},Z,Q,Y){if(Q&&Y)Q=Q.replace(/^\n+/,"");if(Q){let G=_y.indentComment(J(Q),X);Z.push(G.trimStart())}}gD8.stringifyCollection=kD8});var oW=G8((fD8)=>{var mD8=$80(),dD8=V80(),uD8=Ky(),iW=KX(),Dy=nW(),cD8=VJ();function SM(X,J){let Z=iW.isScalar(J)?J.value:J;for(let Q of X)if(iW.isPair(Q)){if(Q.key===J||Q.key===Z)return Q;if(iW.isScalar(Q.key)&&Q.key.value===Z)return Q}return}class wI0 extends uD8.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(X){super(iW.MAP,X);this.items=[]}static from(X,J,Z){let{keepUndefined:Q,replacer:Y}=Z,G=new this(X),K=(B,H)=>{if(typeof Y==="function")H=Y.call(J,B,H);else if(Array.isArray(Y)&&!Y.includes(B))return;if(H!==void 0||Q)G.items.push(Dy.createPair(B,H,Z))};if(J instanceof Map)for(let[B,H]of J)K(B,H);else if(J&&typeof J==="object")for(let B of Object.keys(J))K(B,J[B]);if(typeof X.sortMapEntries==="function")G.items.sort(X.sortMapEntries);return G}add(X,J){let Z;if(iW.isPair(X))Z=X;else if(!X||typeof X!=="object"||!("key"in X))Z=new Dy.Pair(X,X?.value);else Z=new Dy.Pair(X.key,X.value);let Q=SM(this.items,Z.key),Y=this.schema?.sortMapEntries;if(Q){if(!J)throw Error(`Key ${Z.key} already set`);if(iW.isScalar(Q.value)&&cD8.isScalarValue(Z.value))Q.value.value=Z.value;else Q.value=Z.value}else if(Y){let G=this.items.findIndex((K)=>Y(Z,K)<0);if(G===-1)this.items.push(Z);else this.items.splice(G,0,Z)}else this.items.push(Z)}delete(X){let J=SM(this.items,X);if(!J)return!1;return this.items.splice(this.items.indexOf(J),1).length>0}get(X,J){let Q=SM(this.items,X)?.value;return(!J&&iW.isScalar(Q)?Q.value:Q)??void 0}has(X){return!!SM(this.items,X)}set(X,J){this.add(new Dy.Pair(X,J),!0)}toJSON(X,J,Z){let Q=Z?new Z:J?.mapAsMap?new Map:{};if(J?.onCreate)J.onCreate(Q);for(let Y of this.items)dD8.addPairToJSMap(J,Q,Y);return Q}toString(X,J,Z){if(!X)return JSON.stringify(this);for(let Q of this.items)if(!iW.isPair(Q))throw Error(`Map items must all be pairs; found ${JSON.stringify(Q)} instead`);if(!X.allNullValues&&this.hasAllNullValues(!1))X=Object.assign({},X,{allNullValues:!0});return mD8.stringifyCollection(this,X,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:X.indent||"",onChompKeep:Z,onComment:J})}}fD8.YAMLMap=wI0;fD8.findPair=SM});var Dq=G8((oD8)=>{var nD8=KX(),LI0=oW(),iD8={collection:"map",default:!0,nodeClass:LI0.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(X,J){if(!nD8.isMap(X))J("Expected a mapping for this tag");return X},createNode:(X,J,Z)=>LI0.YAMLMap.from(X,J,Z)};oD8.map=iD8});var rW=G8((Jw8)=>{var aD8=PM(),sD8=$80(),tD8=Ky(),Ly=KX(),eD8=VJ(),Xw8=fW();class FI0 extends tD8.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(X){super(Ly.SEQ,X);this.items=[]}add(X){this.items.push(X)}delete(X){let J=wy(X);if(typeof J!=="number")return!1;return this.items.splice(J,1).length>0}get(X,J){let Z=wy(X);if(typeof Z!=="number")return;let Q=this.items[Z];return!J&&Ly.isScalar(Q)?Q.value:Q}has(X){let J=wy(X);return typeof J==="number"&&J<this.items.length}set(X,J){let Z=wy(X);if(typeof Z!=="number")throw Error(`Expected a valid index, not ${X}.`);let Q=this.items[Z];if(Ly.isScalar(Q)&&eD8.isScalarValue(J))Q.value=J;else this.items[Z]=J}toJSON(X,J){let Z=[];if(J?.onCreate)J.onCreate(Z);let Q=0;for(let Y of this.items)Z.push(Xw8.toJS(Y,String(Q++),J));return Z}toString(X,J,Z){if(!X)return JSON.stringify(this);return sD8.stringifyCollection(this,X,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(X.indent||"")+" ",onChompKeep:Z,onComment:J})}static from(X,J,Z){let{replacer:Q}=Z,Y=new this(X);if(J&&Symbol.iterator in Object(J)){let G=0;for(let K of J){if(typeof Q==="function"){let B=J instanceof Set?K:String(G++);K=Q.call(J,B,K)}Y.items.push(aD8.createNode(K,void 0,Z))}}return Y}}function wy(X){let J=Ly.isScalar(X)?X.value:X;if(J&&typeof J==="string")J=Number(J);return typeof J==="number"&&Number.isInteger(J)&&J>=0?J:null}Jw8.YAMLSeq=FI0});var wq=G8((Gw8)=>{var Qw8=KX(),AI0=rW(),Yw8={collection:"seq",default:!0,nodeClass:AI0.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(X,J){if(!Qw8.isSeq(X))J("Expected a sequence for this tag");return X},createNode:(X,J,Z)=>AI0.YAMLSeq.from(X,J,Z)};Gw8.seq=Yw8});var xM=G8((Ww8)=>{var Bw8=CM(),Hw8={identify:(X)=>typeof X==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(X)=>X,stringify(X,J,Z,Q){return J=Object.assign({actualString:!0},J),Bw8.stringifyString(X,J,Z,Q)}};Ww8.string=Hw8});var Fy=G8(($w8)=>{var TI0=VJ(),MI0={identify:(X)=>X==null,createNode:()=>new TI0.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new TI0.Scalar(null),stringify:({source:X},J)=>typeof X==="string"&&MI0.test.test(X)?X:J.options.nullStr};$w8.nullTag=MI0});var U80=G8((Nw8)=>{var zw8=VJ(),PI0={identify:(X)=>typeof X==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:(X)=>new zw8.Scalar(X[0]==="t"||X[0]==="T"),stringify({source:X,value:J},Z){if(X&&PI0.test.test(X)){let Q=X[0]==="t"||X[0]==="T";if(J===Q)return X}return J?Z.options.trueStr:Z.options.falseStr}};Nw8.boolTag=PI0});var Lq=G8((qw8)=>{function _w8({format:X,minFractionDigits:J,tag:Z,value:Q}){if(typeof Q==="bigint")return String(Q);let Y=typeof Q==="number"?Q:Number(Q);if(!isFinite(Y))return isNaN(Y)?".nan":Y<0?"-.inf":".inf";let G=Object.is(Q,-0)?"-0":JSON.stringify(Q);if(!X&&J&&(!Z||Z==="tag:yaml.org,2002:float")&&/^-?\d/.test(G)&&!G.includes("e")){let K=G.indexOf(".");if(K<0)K=G.length,G+=".";let B=J-(G.length-K-1);while(B-- >0)G+="0"}return G}qw8.stringifyNumber=_w8});var N80=G8((Tw8)=>{var ww8=VJ(),z80=Lq(),Lw8={identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(X)=>X.slice(-3).toLowerCase()==="nan"?NaN:X[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:z80.stringifyNumber},Fw8={identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:(X)=>parseFloat(X),stringify(X){let J=Number(X.value);return isFinite(J)?J.toExponential():z80.stringifyNumber(X)}},Aw8={identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(X){let J=new ww8.Scalar(parseFloat(X)),Z=X.indexOf(".");if(Z!==-1&&X[X.length-1]==="0")J.minFractionDigits=X.length-Z-1;return J},stringify:z80.stringifyNumber};Tw8.float=Aw8;Tw8.floatExp=Fw8;Tw8.floatNaN=Lw8});var _80=G8((Ew8)=>{var RI0=Lq(),Ay=(X)=>typeof X==="bigint"||Number.isInteger(X),O80=(X,J,Z,{intAsBigInt:Q})=>Q?BigInt(X):parseInt(X.substring(J),Z);function jI0(X,J,Z){let{value:Q}=X;if(Ay(Q)&&Q>=0)return Z+Q.toString(J);return RI0.stringifyNumber(X)}var jw8={identify:(X)=>Ay(X)&&X>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(X,J,Z)=>O80(X,2,8,Z),stringify:(X)=>jI0(X,8,"0o")},Cw8={identify:Ay,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(X,J,Z)=>O80(X,0,10,Z),stringify:RI0.stringifyNumber},Iw8={identify:(X)=>Ay(X)&&X>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(X,J,Z)=>O80(X,2,16,Z),stringify:(X)=>jI0(X,16,"0x")};Ew8.int=Cw8;Ew8.intHex=Iw8;Ew8.intOct=jw8});var CI0=G8((dw8)=>{var kw8=Dq(),bw8=Fy(),yw8=wq(),gw8=xM(),hw8=U80(),q80=N80(),D80=_80(),mw8=[kw8.map,yw8.seq,gw8.string,bw8.nullTag,hw8.boolTag,D80.intOct,D80.int,D80.intHex,q80.floatNaN,q80.floatExp,q80.float];dw8.schema=mw8});var EI0=G8((ow8)=>{var cw8=VJ(),fw8=Dq(),pw8=wq();function II0(X){return typeof X==="bigint"||Number.isInteger(X)}var Ty=({value:X})=>JSON.stringify(X),lw8=[{identify:(X)=>typeof X==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(X)=>X,stringify:Ty},{identify:(X)=>X==null,createNode:()=>new cw8.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ty},{identify:(X)=>typeof X==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:(X)=>X==="true",stringify:Ty},{identify:II0,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(X,J,{intAsBigInt:Z})=>Z?BigInt(X):parseInt(X,10),stringify:({value:X})=>II0(X)?X.toString():JSON.stringify(X)},{identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:(X)=>parseFloat(X),stringify:Ty}],nw8={default:!0,tag:"",test:/^/,resolve(X,J){return J(`Unresolved plain scalar ${JSON.stringify(X)}`),X}},iw8=[fw8.map,pw8.seq].concat(lw8,nw8);ow8.schema=iw8});var L80=G8((tw8)=>{var vM=GN("buffer"),w80=VJ(),aw8=CM(),sw8={identify:(X)=>X instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(X,J){if(typeof vM.Buffer==="function")return vM.Buffer.from(X,"base64");else if(typeof atob==="function"){let Z=atob(X.replace(/[\n\r]/g,"")),Q=new Uint8Array(Z.length);for(let Y=0;Y<Z.length;++Y)Q[Y]=Z.charCodeAt(Y);return Q}else return J("This environment does not support reading binary tags; either Buffer or atob is required"),X},stringify({comment:X,type:J,value:Z},Q,Y,G){if(!Z)return"";let K=Z,B;if(typeof vM.Buffer==="function")B=K instanceof vM.Buffer?K.toString("base64"):vM.Buffer.from(K.buffer).toString("base64");else if(typeof btoa==="function"){let H="";for(let W=0;W<K.length;++W)H+=String.fromCharCode(K[W]);B=btoa(H)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(J??(J=w80.Scalar.BLOCK_LITERAL),J!==w80.Scalar.QUOTE_DOUBLE){let H=Math.max(Q.options.lineWidth-Q.indent.length,Q.options.minContentWidth),W=Math.ceil(B.length/H),V=Array(W);for(let U=0,O=0;U<W;++U,O+=H)V[U]=B.substr(O,H);B=V.join(J===w80.Scalar.BLOCK_LITERAL?`
59
+ `:" ")}return aw8.stringifyString({comment:X,type:J,value:B},Q,Y,G)}};tw8.binary=sw8});var Py=G8((QL8)=>{var My=KX(),F80=nW(),XL8=VJ(),JL8=rW();function SI0(X,J){if(My.isSeq(X))for(let Z=0;Z<X.items.length;++Z){let Q=X.items[Z];if(My.isPair(Q))continue;else if(My.isMap(Q)){if(Q.items.length>1)J("Each pair must have its own sequence indicator");let Y=Q.items[0]||new F80.Pair(new XL8.Scalar(null));if(Q.commentBefore)Y.key.commentBefore=Y.key.commentBefore?`${Q.commentBefore}
60
+ ${Y.key.commentBefore}`:Q.commentBefore;if(Q.comment){let G=Y.value??Y.key;G.comment=G.comment?`${Q.comment}
61
+ ${G.comment}`:Q.comment}Q=Y}X.items[Z]=My.isPair(Q)?Q:new F80.Pair(Q)}else J("Expected a sequence for this tag");return X}function xI0(X,J,Z){let{replacer:Q}=Z,Y=new JL8.YAMLSeq(X);Y.tag="tag:yaml.org,2002:pairs";let G=0;if(J&&Symbol.iterator in Object(J))for(let K of J){if(typeof Q==="function")K=Q.call(J,String(G++),K);let B,H;if(Array.isArray(K))if(K.length===2)B=K[0],H=K[1];else throw TypeError(`Expected [key, value] tuple: ${K}`);else if(K&&K instanceof Object){let W=Object.keys(K);if(W.length===1)B=W[0],H=K[B];else throw TypeError(`Expected tuple with one key, not ${W.length} keys`)}else B=K;Y.items.push(F80.createPair(B,H,Z))}return Y}var ZL8={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:SI0,createNode:xI0};QL8.createPairs=xI0;QL8.pairs=ZL8;QL8.resolvePairs=SI0});var T80=G8((WL8)=>{var vI0=KX(),A80=fW(),kM=oW(),BL8=rW(),kI0=Py();class Jz extends BL8.YAMLSeq{constructor(){super();this.add=kM.YAMLMap.prototype.add.bind(this),this.delete=kM.YAMLMap.prototype.delete.bind(this),this.get=kM.YAMLMap.prototype.get.bind(this),this.has=kM.YAMLMap.prototype.has.bind(this),this.set=kM.YAMLMap.prototype.set.bind(this),this.tag=Jz.tag}toJSON(X,J){if(!J)return super.toJSON(X);let Z=new Map;if(J?.onCreate)J.onCreate(Z);for(let Q of this.items){let Y,G;if(vI0.isPair(Q))Y=A80.toJS(Q.key,"",J),G=A80.toJS(Q.value,Y,J);else Y=A80.toJS(Q,"",J);if(Z.has(Y))throw Error("Ordered maps must not include duplicate keys");Z.set(Y,G)}return Z}static from(X,J,Z){let Q=kI0.createPairs(X,J,Z),Y=new this;return Y.items=Q.items,Y}}Jz.tag="tag:yaml.org,2002:omap";var HL8={collection:"seq",identify:(X)=>X instanceof Map,nodeClass:Jz,default:!1,tag:"tag:yaml.org,2002:omap",resolve(X,J){let Z=kI0.resolvePairs(X,J),Q=[];for(let{key:Y}of Z.items)if(vI0.isScalar(Y))if(Q.includes(Y.value))J(`Ordered maps must not include duplicate keys: ${Y.value}`);else Q.push(Y.value);return Object.assign(new Jz,Z)},createNode:(X,J,Z)=>Jz.from(X,J,Z)};WL8.YAMLOMap=Jz;WL8.omap=HL8});var mI0=G8((UL8)=>{var bI0=VJ();function yI0({value:X,source:J},Z){if(J&&(X?gI0:hI0).test.test(J))return J;return X?Z.options.trueStr:Z.options.falseStr}var gI0={identify:(X)=>X===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new bI0.Scalar(!0),stringify:yI0},hI0={identify:(X)=>X===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new bI0.Scalar(!1),stringify:yI0};UL8.falseTag=hI0;UL8.trueTag=gI0});var dI0=G8((wL8)=>{var OL8=VJ(),M80=Lq(),_L8={identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(X)=>X.slice(-3).toLowerCase()==="nan"?NaN:X[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:M80.stringifyNumber},qL8={identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(X)=>parseFloat(X.replace(/_/g,"")),stringify(X){let J=Number(X.value);return isFinite(J)?J.toExponential():M80.stringifyNumber(X)}},DL8={identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(X){let J=new OL8.Scalar(parseFloat(X.replace(/_/g,""))),Z=X.indexOf(".");if(Z!==-1){let Q=X.substring(Z+1).replace(/_/g,"");if(Q[Q.length-1]==="0")J.minFractionDigits=Q.length}return J},stringify:M80.stringifyNumber};wL8.float=DL8;wL8.floatExp=qL8;wL8.floatNaN=_L8});var cI0=G8((jL8)=>{var uI0=Lq(),bM=(X)=>typeof X==="bigint"||Number.isInteger(X);function Ry(X,J,Z,{intAsBigInt:Q}){let Y=X[0];if(Y==="-"||Y==="+")J+=1;if(X=X.substring(J).replace(/_/g,""),Q){switch(Z){case 2:X=`0b${X}`;break;case 8:X=`0o${X}`;break;case 16:X=`0x${X}`;break}let K=BigInt(X);return Y==="-"?BigInt(-1)*K:K}let G=parseInt(X,Z);return Y==="-"?-1*G:G}function P80(X,J,Z){let{value:Q}=X;if(bM(Q)){let Y=Q.toString(J);return Q<0?"-"+Z+Y.substr(1):Z+Y}return uI0.stringifyNumber(X)}var TL8={identify:bM,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(X,J,Z)=>Ry(X,2,2,Z),stringify:(X)=>P80(X,2,"0b")},ML8={identify:bM,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(X,J,Z)=>Ry(X,1,8,Z),stringify:(X)=>P80(X,8,"0")},PL8={identify:bM,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(X,J,Z)=>Ry(X,0,10,Z),stringify:uI0.stringifyNumber},RL8={identify:bM,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(X,J,Z)=>Ry(X,2,16,Z),stringify:(X)=>P80(X,16,"0x")};jL8.int=PL8;jL8.intBin=TL8;jL8.intHex=RL8;jL8.intOct=ML8});var R80=G8((vL8)=>{var Iy=KX(),jy=nW(),Cy=oW();class Zz extends Cy.YAMLMap{constructor(X){super(X);this.tag=Zz.tag}add(X){let J;if(Iy.isPair(X))J=X;else if(X&&typeof X==="object"&&"key"in X&&"value"in X&&X.value===null)J=new jy.Pair(X.key,null);else J=new jy.Pair(X,null);if(!Cy.findPair(this.items,J.key))this.items.push(J)}get(X,J){let Z=Cy.findPair(this.items,X);return!J&&Iy.isPair(Z)?Iy.isScalar(Z.key)?Z.key.value:Z.key:Z}set(X,J){if(typeof J!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof J}`);let Z=Cy.findPair(this.items,X);if(Z&&!J)this.items.splice(this.items.indexOf(Z),1);else if(!Z&&J)this.items.push(new jy.Pair(X))}toJSON(X,J){return super.toJSON(X,J,Set)}toString(X,J,Z){if(!X)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},X,{allNullValues:!0}),J,Z);else throw Error("Set items must all have null values")}static from(X,J,Z){let{replacer:Q}=Z,Y=new this(X);if(J&&Symbol.iterator in Object(J))for(let G of J){if(typeof Q==="function")G=Q.call(J,G,G);Y.items.push(jy.createPair(G,null,Z))}return Y}}Zz.tag="tag:yaml.org,2002:set";var xL8={collection:"map",identify:(X)=>X instanceof Set,nodeClass:Zz,default:!1,tag:"tag:yaml.org,2002:set",createNode:(X,J,Z)=>Zz.from(X,J,Z),resolve(X,J){if(Iy.isMap(X))if(X.hasAllNullValues(!0))return Object.assign(new Zz,X);else J("Set items must all have null values");else J("Expected a mapping for this tag");return X}};vL8.YAMLSet=Zz;vL8.set=xL8});var C80=G8((mL8)=>{var yL8=Lq();function j80(X,J){let Z=X[0],Q=Z==="-"||Z==="+"?X.substring(1):X,Y=(K)=>J?BigInt(K):Number(K),G=Q.replace(/_/g,"").split(":").reduce((K,B)=>K*Y(60)+Y(B),Y(0));return Z==="-"?Y(-1)*G:G}function fI0(X){let{value:J}=X,Z=(K)=>K;if(typeof J==="bigint")Z=(K)=>BigInt(K);else if(isNaN(J)||!isFinite(J))return yL8.stringifyNumber(X);let Q="";if(J<0)Q="-",J*=Z(-1);let Y=Z(60),G=[J%Y];if(J<60)G.unshift(0);else if(J=(J-G[0])/Y,G.unshift(J%Y),J>=60)J=(J-G[0])/Y,G.unshift(J);return Q+G.map((K)=>String(K).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var gL8={identify:(X)=>typeof X==="bigint"||Number.isInteger(X),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(X,J,{intAsBigInt:Z})=>j80(X,Z),stringify:fI0},hL8={identify:(X)=>typeof X==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(X)=>j80(X,!1),stringify:fI0},pI0={identify:(X)=>X instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(X){let J=X.match(pI0.test);if(!J)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,Z,Q,Y,G,K,B]=J.map(Number),H=J[7]?Number((J[7]+"00").substr(1,3)):0,W=Date.UTC(Z,Q-1,Y,G||0,K||0,B||0,H),V=J[8];if(V&&V!=="Z"){let U=j80(V,!1);if(Math.abs(U)<30)U*=60;W-=60000*U}return new Date(W)},stringify:({value:X})=>X?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};mL8.floatTime=hL8;mL8.intTime=gL8;mL8.timestamp=pI0});var nI0=G8((eL8)=>{var fL8=Dq(),pL8=Fy(),lL8=wq(),nL8=xM(),iL8=L80(),lI0=mI0(),I80=dI0(),Ey=cI0(),oL8=zy(),rL8=T80(),aL8=Py(),sL8=R80(),E80=C80(),tL8=[fL8.map,lL8.seq,nL8.string,pL8.nullTag,lI0.trueTag,lI0.falseTag,Ey.intBin,Ey.intOct,Ey.int,Ey.intHex,I80.floatNaN,I80.floatExp,I80.float,iL8.binary,oL8.merge,rL8.omap,aL8.pairs,sL8.set,E80.intTime,E80.floatTime,E80.timestamp];eL8.schema=tL8});var ZE0=G8((HF8)=>{var aI0=Dq(),JF8=Fy(),sI0=wq(),ZF8=xM(),QF8=U80(),S80=N80(),x80=_80(),YF8=CI0(),GF8=EI0(),tI0=L80(),yM=zy(),eI0=T80(),XE0=Py(),iI0=nI0(),JE0=R80(),Sy=C80(),oI0=new Map([["core",YF8.schema],["failsafe",[aI0.map,sI0.seq,ZF8.string]],["json",GF8.schema],["yaml11",iI0.schema],["yaml-1.1",iI0.schema]]),rI0={binary:tI0.binary,bool:QF8.boolTag,float:S80.float,floatExp:S80.floatExp,floatNaN:S80.floatNaN,floatTime:Sy.floatTime,int:x80.int,intHex:x80.intHex,intOct:x80.intOct,intTime:Sy.intTime,map:aI0.map,merge:yM.merge,null:JF8.nullTag,omap:eI0.omap,pairs:XE0.pairs,seq:sI0.seq,set:JE0.set,timestamp:Sy.timestamp},KF8={"tag:yaml.org,2002:binary":tI0.binary,"tag:yaml.org,2002:merge":yM.merge,"tag:yaml.org,2002:omap":eI0.omap,"tag:yaml.org,2002:pairs":XE0.pairs,"tag:yaml.org,2002:set":JE0.set,"tag:yaml.org,2002:timestamp":Sy.timestamp};function BF8(X,J,Z){let Q=oI0.get(J);if(Q&&!X)return Z&&!Q.includes(yM.merge)?Q.concat(yM.merge):Q.slice();let Y=Q;if(!Y)if(Array.isArray(X))Y=[];else{let G=Array.from(oI0.keys()).filter((K)=>K!=="yaml11").map((K)=>JSON.stringify(K)).join(", ");throw Error(`Unknown schema "${J}"; use one of ${G} or define customTags array`)}if(Array.isArray(X))for(let G of X)Y=Y.concat(G);else if(typeof X==="function")Y=X(Y.slice());if(Z)Y=Y.concat(yM.merge);return Y.reduce((G,K)=>{let B=typeof K==="string"?rI0[K]:K;if(!B){let H=JSON.stringify(K),W=Object.keys(rI0).map((V)=>JSON.stringify(V)).join(", ");throw Error(`Unknown custom tag ${H}; use one of ${W}`)}if(!G.includes(B))G.push(B);return G},[])}HF8.coreKnownTags=KF8;HF8.getTags=BF8});var b80=G8((OF8)=>{var v80=KX(),$F8=Dq(),UF8=wq(),zF8=xM(),xy=ZE0(),NF8=(X,J)=>X.key<J.key?-1:X.key>J.key?1:0;class k80{constructor({compat:X,customTags:J,merge:Z,resolveKnownTags:Q,schema:Y,sortMapEntries:G,toStringDefaults:K}){this.compat=Array.isArray(X)?xy.getTags(X,"compat"):X?xy.getTags(null,X):null,this.name=typeof Y==="string"&&Y||"core",this.knownTags=Q?xy.coreKnownTags:{},this.tags=xy.getTags(J,this.name,Z),this.toStringOptions=K??null,Object.defineProperty(this,v80.MAP,{value:$F8.map}),Object.defineProperty(this,v80.SCALAR,{value:zF8.string}),Object.defineProperty(this,v80.SEQ,{value:UF8.seq}),this.sortMapEntries=typeof G==="function"?G:G===!0?NF8:null}clone(){let X=Object.create(k80.prototype,Object.getOwnPropertyDescriptors(this));return X.tags=this.tags.slice(),X}}OF8.Schema=k80});var QE0=G8((wF8)=>{var qF8=KX(),y80=IM(),gM=RM();function DF8(X,J){let Z=[],Q=J.directives===!0;if(J.directives!==!1&&X.directives){let H=X.directives.toString(X);if(H)Z.push(H),Q=!0;else if(X.directives.docStart)Q=!0}if(Q)Z.push("---");let Y=y80.createStringifyContext(X,J),{commentString:G}=Y.options;if(X.commentBefore){if(Z.length!==1)Z.unshift("");let H=G(X.commentBefore);Z.unshift(gM.indentComment(H,""))}let K=!1,B=null;if(X.contents){if(qF8.isNode(X.contents)){if(X.contents.spaceBefore&&Q)Z.push("");if(X.contents.commentBefore){let V=G(X.contents.commentBefore);Z.push(gM.indentComment(V,""))}Y.forceBlockIndent=!!X.comment,B=X.contents.comment}let H=B?void 0:()=>K=!0,W=y80.stringify(X.contents,Y,()=>B=null,H);if(B)W+=gM.lineComment(W,"",G(B));if((W[0]==="|"||W[0]===">")&&Z[Z.length-1]==="---")Z[Z.length-1]=`--- ${W}`;else Z.push(W)}else Z.push(y80.stringify(X.contents,Y));if(X.directives?.docEnd)if(X.comment){let H=G(X.comment);if(H.includes(`
62
+ `))Z.push("..."),Z.push(gM.indentComment(H,""));else Z.push(`... ${H}`)}else Z.push("...");else{let H=X.comment;if(H&&K)H=H.replace(/^\n+/,"");if(H){if((!K||B)&&Z[Z.length-1]!=="")Z.push("");Z.push(gM.indentComment(G(H),""))}}return Z.join(`
63
+ `)+`
64
+ `}wF8.stringifyDocument=DF8});var hM=G8((CF8)=>{var FF8=MM(),Fq=Ky(),g4=KX(),AF8=nW(),TF8=fW(),MF8=b80(),PF8=QE0(),g80=Qy(),RF8=Z80(),jF8=PM(),h80=J80();class m80{constructor(X,J,Z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,g4.NODE_TYPE,{value:g4.DOC});let Q=null;if(typeof J==="function"||Array.isArray(J))Q=J;else if(Z===void 0&&J)Z=J,J=void 0;let Y=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},Z);this.options=Y;let{version:G}=Y;if(Z?._directives){if(this.directives=Z._directives.atDocument(),this.directives.yaml.explicit)G=this.directives.yaml.version}else this.directives=new h80.Directives({version:G});this.setSchema(G,Z),this.contents=X===void 0?null:this.createNode(X,Q,Z)}clone(){let X=Object.create(m80.prototype,{[g4.NODE_TYPE]:{value:g4.DOC}});if(X.commentBefore=this.commentBefore,X.comment=this.comment,X.errors=this.errors.slice(),X.warnings=this.warnings.slice(),X.options=Object.assign({},this.options),this.directives)X.directives=this.directives.clone();if(X.schema=this.schema.clone(),X.contents=g4.isNode(this.contents)?this.contents.clone(X.schema):this.contents,this.range)X.range=this.range.slice();return X}add(X){if(Aq(this.contents))this.contents.add(X)}addIn(X,J){if(Aq(this.contents))this.contents.addIn(X,J)}createAlias(X,J){if(!X.anchor){let Z=g80.anchorNames(this);X.anchor=!J||Z.has(J)?g80.findNewAnchor(J||"a",Z):J}return new FF8.Alias(X.anchor)}createNode(X,J,Z){let Q=void 0;if(typeof J==="function")X=J.call({"":X},"",X),Q=J;else if(Array.isArray(J)){let A=(x)=>typeof x==="number"||x instanceof String||x instanceof Number,M=J.filter(A).map(String);if(M.length>0)J=J.concat(M);Q=J}else if(Z===void 0&&J)Z=J,J=void 0;let{aliasDuplicateObjects:Y,anchorPrefix:G,flow:K,keepUndefined:B,onTagObj:H,tag:W}=Z??{},{onAnchor:V,setAnchors:U,sourceObjects:O}=g80.createNodeAnchors(this,G||"a"),q={aliasDuplicateObjects:Y??!0,keepUndefined:B??!1,onAnchor:V,onTagObj:H,replacer:Q,schema:this.schema,sourceObjects:O},L=jF8.createNode(X,W,q);if(K&&g4.isCollection(L))L.flow=!0;return U(),L}createPair(X,J,Z={}){let Q=this.createNode(X,null,Z),Y=this.createNode(J,null,Z);return new AF8.Pair(Q,Y)}delete(X){return Aq(this.contents)?this.contents.delete(X):!1}deleteIn(X){if(Fq.isEmptyPath(X)){if(this.contents==null)return!1;return this.contents=null,!0}return Aq(this.contents)?this.contents.deleteIn(X):!1}get(X,J){return g4.isCollection(this.contents)?this.contents.get(X,J):void 0}getIn(X,J){if(Fq.isEmptyPath(X))return!J&&g4.isScalar(this.contents)?this.contents.value:this.contents;return g4.isCollection(this.contents)?this.contents.getIn(X,J):void 0}has(X){return g4.isCollection(this.contents)?this.contents.has(X):!1}hasIn(X){if(Fq.isEmptyPath(X))return this.contents!==void 0;return g4.isCollection(this.contents)?this.contents.hasIn(X):!1}set(X,J){if(this.contents==null)this.contents=Fq.collectionFromPath(this.schema,[X],J);else if(Aq(this.contents))this.contents.set(X,J)}setIn(X,J){if(Fq.isEmptyPath(X))this.contents=J;else if(this.contents==null)this.contents=Fq.collectionFromPath(this.schema,Array.from(X),J);else if(Aq(this.contents))this.contents.setIn(X,J)}setSchema(X,J={}){if(typeof X==="number")X=String(X);let Z;switch(X){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new h80.Directives({version:"1.1"});Z={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=X;else this.directives=new h80.Directives({version:X});Z={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;Z=null;break;default:{let Q=JSON.stringify(X);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${Q}`)}}if(J.schema instanceof Object)this.schema=J.schema;else if(Z)this.schema=new MF8.Schema(Object.assign(Z,J));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:X,jsonArg:J,mapAsMap:Z,maxAliasCount:Q,onAnchor:Y,reviver:G}={}){let K={anchors:new Map,doc:this,keep:!X,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof Q==="number"?Q:100},B=TF8.toJS(this.contents,J??"",K);if(typeof Y==="function")for(let{count:H,res:W}of K.anchors.values())Y(W,H);return typeof G==="function"?RF8.applyReviver(G,{"":B},"",B):B}toJSON(X,J){return this.toJS({json:!0,jsonArg:X,mapAsMap:!1,onAnchor:J})}toString(X={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in X&&(!Number.isInteger(X.indent)||Number(X.indent)<=0)){let J=JSON.stringify(X.indent);throw Error(`"indent" option must be a positive integer, not ${J}`)}return PF8.stringifyDocument(this,X)}}function Aq(X){if(g4.isCollection(X))return!0;throw Error("Expected a YAML collection as document contents")}CF8.Document=m80});var mM=G8((SF8)=>{class vy extends Error{constructor(X,J,Z,Q){super();this.name=X,this.code=Z,this.message=Q,this.pos=J}}class YE0 extends vy{constructor(X,J,Z){super("YAMLParseError",X,J,Z)}}class GE0 extends vy{constructor(X,J,Z){super("YAMLWarning",X,J,Z)}}var EF8=(X,J)=>(Z)=>{if(Z.pos[0]===-1)return;Z.linePos=Z.pos.map((B)=>J.linePos(B));let{line:Q,col:Y}=Z.linePos[0];Z.message+=` at line ${Q}, column ${Y}`;let G=Y-1,K=X.substring(J.lineStarts[Q-1],J.lineStarts[Q]).replace(/[\n\r]+$/,"");if(G>=60&&K.length>80){let B=Math.min(G-39,K.length-79);K="…"+K.substring(B),G-=B-1}if(K.length>80)K=K.substring(0,79)+"…";if(Q>1&&/^ *$/.test(K.substring(0,G))){let B=X.substring(J.lineStarts[Q-2],J.lineStarts[Q-1]);if(B.length>80)B=B.substring(0,79)+`…
65
+ `;K=B+K}if(/[^ ]/.test(K)){let B=1,H=Z.linePos[1];if(H?.line===Q&&H.col>Y)B=Math.max(1,Math.min(H.col-Y,80-G));let W=" ".repeat(G)+"^".repeat(B);Z.message+=`:
66
+
67
+ ${K}
68
+ ${W}
69
+ `}};SF8.YAMLError=vy;SF8.YAMLParseError=YE0;SF8.YAMLWarning=GE0;SF8.prettifyError=EF8});var dM=G8((gF8)=>{function yF8(X,{flow:J,indicator:Z,next:Q,offset:Y,onError:G,parentIndent:K,startOnNewline:B}){let H=!1,W=B,V=B,U="",O="",q=!1,L=!1,A=null,M=null,x=null,j=null,T=null,E=null,k=null;for(let v of X){if(L){if(v.type!=="space"&&v.type!=="newline"&&v.type!=="comma")G(v.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(A){if(W&&v.type!=="comment"&&v.type!=="newline")G(A,"TAB_AS_INDENT","Tabs are not allowed as indentation");A=null}switch(v.type){case"space":if(!J&&(Z!=="doc-start"||Q?.type!=="flow-collection")&&v.source.includes("\t"))A=v;V=!0;break;case"comment":{if(!V)G(v,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=v.source.substring(1)||" ";if(!U)U=f;else U+=O+f;O="",W=!1;break}case"newline":if(W){if(U)U+=v.source;else if(!E||Z!=="seq-item-ind")H=!0}else O+=v.source;if(W=!0,q=!0,M||x)j=v;V=!0;break;case"anchor":if(M)G(v,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(v.source.endsWith(":"))G(v.offset+v.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);M=v,k??(k=v.offset),W=!1,V=!1,L=!0;break;case"tag":{if(x)G(v,"MULTIPLE_TAGS","A node can have at most one tag");x=v,k??(k=v.offset),W=!1,V=!1,L=!0;break}case Z:if(M||x)G(v,"BAD_PROP_ORDER",`Anchors and tags must be after the ${v.source} indicator`);if(E)G(v,"UNEXPECTED_TOKEN",`Unexpected ${v.source} in ${J??"collection"}`);E=v,W=Z==="seq-item-ind"||Z==="explicit-key-ind",V=!1;break;case"comma":if(J){if(T)G(v,"UNEXPECTED_TOKEN",`Unexpected , in ${J}`);T=v,W=!1,V=!1;break}default:G(v,"UNEXPECTED_TOKEN",`Unexpected ${v.type} token`),W=!1,V=!1}}let P=X[X.length-1],C=P?P.offset+P.source.length:Y;if(L&&Q&&Q.type!=="space"&&Q.type!=="newline"&&Q.type!=="comma"&&(Q.type!=="scalar"||Q.source!==""))G(Q.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(A&&(W&&A.indent<=K||Q?.type==="block-map"||Q?.type==="block-seq"))G(A,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:T,found:E,spaceBefore:H,comment:U,hasNewline:q,anchor:M,tag:x,newlineAfterProp:j,end:C,start:k??C}}gF8.resolveProps=yF8});var ky=G8((mF8)=>{function d80(X){if(!X)return null;switch(X.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(X.source.includes(`
70
+ `))return!0;if(X.end){for(let J of X.end)if(J.type==="newline")return!0}return!1;case"flow-collection":for(let J of X.items){for(let Z of J.start)if(Z.type==="newline")return!0;if(J.sep){for(let Z of J.sep)if(Z.type==="newline")return!0}if(d80(J.key)||d80(J.value))return!0}return!1;default:return!0}}mF8.containsNewline=d80});var u80=G8((fF8)=>{var uF8=ky();function cF8(X,J,Z){if(J?.type==="flow-collection"){let Q=J.end[0];if(Q.indent===X&&(Q.source==="]"||Q.source==="}")&&uF8.containsNewline(J))Z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}fF8.flowIndentCheck=cF8});var c80=G8((nF8)=>{var KE0=KX();function lF8(X,J,Z){let{uniqueKeys:Q}=X.options;if(Q===!1)return!1;let Y=typeof Q==="function"?Q:(G,K)=>G===K||KE0.isScalar(G)&&KE0.isScalar(K)&&G.value===K.value;return J.some((G)=>Y(G.key,Z))}nF8.mapIncludes=lF8});var $E0=G8((tF8)=>{var BE0=nW(),oF8=oW(),HE0=dM(),rF8=ky(),WE0=u80(),aF8=c80(),VE0="All mapping items must start at the same column";function sF8({composeNode:X,composeEmptyNode:J},Z,Q,Y,G){let B=new(G?.nodeClass??oF8.YAMLMap)(Z.schema);if(Z.atRoot)Z.atRoot=!1;let H=Q.offset,W=null;for(let V of Q.items){let{start:U,key:O,sep:q,value:L}=V,A=HE0.resolveProps(U,{indicator:"explicit-key-ind",next:O??q?.[0],offset:H,onError:Y,parentIndent:Q.indent,startOnNewline:!0}),M=!A.found;if(M){if(O){if(O.type==="block-seq")Y(H,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in O&&O.indent!==Q.indent)Y(H,"BAD_INDENT",VE0)}if(!A.anchor&&!A.tag&&!q){if(W=A.end,A.comment)if(B.comment)B.comment+=`
71
+ `+A.comment;else B.comment=A.comment;continue}if(A.newlineAfterProp||rF8.containsNewline(O))Y(O??U[U.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(A.found?.indent!==Q.indent)Y(H,"BAD_INDENT",VE0);Z.atKey=!0;let x=A.end,j=O?X(Z,O,A,Y):J(Z,x,U,null,A,Y);if(Z.schema.compat)WE0.flowIndentCheck(Q.indent,O,Y);if(Z.atKey=!1,aF8.mapIncludes(Z,B.items,j))Y(x,"DUPLICATE_KEY","Map keys must be unique");let T=HE0.resolveProps(q??[],{indicator:"map-value-ind",next:L,offset:j.range[2],onError:Y,parentIndent:Q.indent,startOnNewline:!O||O.type==="block-scalar"});if(H=T.end,T.found){if(M){if(L?.type==="block-map"&&!T.hasNewline)Y(H,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(Z.options.strict&&A.start<T.found.offset-1024)Y(j.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let E=L?X(Z,L,T,Y):J(Z,H,q,null,T,Y);if(Z.schema.compat)WE0.flowIndentCheck(Q.indent,L,Y);H=E.range[2];let k=new BE0.Pair(j,E);if(Z.options.keepSourceTokens)k.srcToken=V;B.items.push(k)}else{if(M)Y(j.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(T.comment)if(j.comment)j.comment+=`
72
+ `+T.comment;else j.comment=T.comment;let E=new BE0.Pair(j);if(Z.options.keepSourceTokens)E.srcToken=V;B.items.push(E)}}if(W&&W<H)Y(W,"IMPOSSIBLE","Map comment with trailing content");return B.range=[Q.offset,H,W??H],B}tF8.resolveBlockMap=sF8});var UE0=G8((YA8)=>{var XA8=rW(),JA8=dM(),ZA8=u80();function QA8({composeNode:X,composeEmptyNode:J},Z,Q,Y,G){let B=new(G?.nodeClass??XA8.YAMLSeq)(Z.schema);if(Z.atRoot)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let H=Q.offset,W=null;for(let{start:V,value:U}of Q.items){let O=JA8.resolveProps(V,{indicator:"seq-item-ind",next:U,offset:H,onError:Y,parentIndent:Q.indent,startOnNewline:!0});if(!O.found)if(O.anchor||O.tag||U)if(U?.type==="block-seq")Y(O.end,"BAD_INDENT","All sequence items must start at the same column");else Y(H,"MISSING_CHAR","Sequence item without - indicator");else{if(W=O.end,O.comment)B.comment=O.comment;continue}let q=U?X(Z,U,O,Y):J(Z,O.end,V,null,O,Y);if(Z.schema.compat)ZA8.flowIndentCheck(Q.indent,U,Y);H=q.range[2],B.items.push(q)}return B.range=[Q.offset,H,W??H],B}YA8.resolveBlockSeq=QA8});var Tq=G8((BA8)=>{function KA8(X,J,Z,Q){let Y="";if(X){let G=!1,K="";for(let B of X){let{source:H,type:W}=B;switch(W){case"space":G=!0;break;case"comment":{if(Z&&!G)Q(B,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let V=H.substring(1)||" ";if(!Y)Y=V;else Y+=K+V;K="";break}case"newline":if(Y)K+=H;G=!0;break;default:Q(B,"UNEXPECTED_TOKEN",`Unexpected ${W} at node end`)}J+=H.length}}return{comment:Y,offset:J}}BA8.resolveEnd=KA8});var OE0=G8((_A8)=>{var WA8=KX(),VA8=nW(),zE0=oW(),$A8=rW(),UA8=Tq(),NE0=dM(),zA8=ky(),NA8=c80(),f80="Block collections are not allowed within flow collections",p80=(X)=>X&&(X.type==="block-map"||X.type==="block-seq");function OA8({composeNode:X,composeEmptyNode:J},Z,Q,Y,G){let K=Q.start.source==="{",B=K?"flow map":"flow sequence",W=new(G?.nodeClass??(K?zE0.YAMLMap:$A8.YAMLSeq))(Z.schema);W.flow=!0;let V=Z.atRoot;if(V)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let U=Q.offset+Q.start.source.length;for(let M=0;M<Q.items.length;++M){let x=Q.items[M],{start:j,key:T,sep:E,value:k}=x,P=NE0.resolveProps(j,{flow:B,indicator:"explicit-key-ind",next:T??E?.[0],offset:U,onError:Y,parentIndent:Q.indent,startOnNewline:!1});if(!P.found){if(!P.anchor&&!P.tag&&!E&&!k){if(M===0&&P.comma)Y(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${B}`);else if(M<Q.items.length-1)Y(P.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${B}`);if(P.comment)if(W.comment)W.comment+=`
73
+ `+P.comment;else W.comment=P.comment;U=P.end;continue}if(!K&&Z.options.strict&&zA8.containsNewline(T))Y(T,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(M===0){if(P.comma)Y(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${B}`)}else{if(!P.comma)Y(P.start,"MISSING_CHAR",`Missing , between ${B} items`);if(P.comment){let C="";X:for(let v of j)switch(v.type){case"comma":case"space":break;case"comment":C=v.source.substring(1);break X;default:break X}if(C){let v=W.items[W.items.length-1];if(WA8.isPair(v))v=v.value??v.key;if(v.comment)v.comment+=`
74
+ `+C;else v.comment=C;P.comment=P.comment.substring(C.length+1)}}}if(!K&&!E&&!P.found){let C=k?X(Z,k,P,Y):J(Z,P.end,E,null,P,Y);if(W.items.push(C),U=C.range[2],p80(k))Y(C.range,"BLOCK_IN_FLOW",f80)}else{Z.atKey=!0;let C=P.end,v=T?X(Z,T,P,Y):J(Z,C,j,null,P,Y);if(p80(T))Y(v.range,"BLOCK_IN_FLOW",f80);Z.atKey=!1;let f=NE0.resolveProps(E??[],{flow:B,indicator:"map-value-ind",next:k,offset:v.range[2],onError:Y,parentIndent:Q.indent,startOnNewline:!1});if(f.found){if(!K&&!P.found&&Z.options.strict){if(E)for(let W0 of E){if(W0===f.found)break;if(W0.type==="newline"){Y(W0,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(P.start<f.found.offset-1024)Y(f.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(k)if("source"in k&&k.source?.[0]===":")Y(k,"MISSING_CHAR",`Missing space after : in ${B}`);else Y(f.start,"MISSING_CHAR",`Missing , or : between ${B} items`);let s=k?X(Z,k,f,Y):f.found?J(Z,f.end,E,null,f,Y):null;if(s){if(p80(k))Y(s.range,"BLOCK_IN_FLOW",f80)}else if(f.comment)if(v.comment)v.comment+=`
75
+ `+f.comment;else v.comment=f.comment;let l=new VA8.Pair(v,s);if(Z.options.keepSourceTokens)l.srcToken=x;if(K){let W0=W;if(NA8.mapIncludes(Z,W0.items,v))Y(C,"DUPLICATE_KEY","Map keys must be unique");W0.items.push(l)}else{let W0=new zE0.YAMLMap(Z.schema);W0.flow=!0,W0.items.push(l);let b=(s??v).range;W0.range=[v.range[0],b[1],b[2]],W.items.push(W0)}U=s?s.range[2]:f.end}}let O=K?"}":"]",[q,...L]=Q.end,A=U;if(q?.source===O)A=q.offset+q.source.length;else{let M=B[0].toUpperCase()+B.substring(1),x=V?`${M} must end with a ${O}`:`${M} in block collection must be sufficiently indented and end with a ${O}`;if(Y(U,V?"MISSING_CHAR":"BAD_INDENT",x),q&&q.source.length!==1)L.unshift(q)}if(L.length>0){let M=UA8.resolveEnd(L,A,Z.options.strict,Y);if(M.comment)if(W.comment)W.comment+=`
76
+ `+M.comment;else W.comment=M.comment;W.range=[Q.offset,A,M.offset]}else W.range=[Q.offset,A,A];return W}_A8.resolveFlowCollection=OA8});var _E0=G8((RA8)=>{var DA8=KX(),wA8=VJ(),LA8=oW(),FA8=rW(),AA8=$E0(),TA8=UE0(),MA8=OE0();function l80(X,J,Z,Q,Y,G){let K=Z.type==="block-map"?AA8.resolveBlockMap(X,J,Z,Q,G):Z.type==="block-seq"?TA8.resolveBlockSeq(X,J,Z,Q,G):MA8.resolveFlowCollection(X,J,Z,Q,G),B=K.constructor;if(Y==="!"||Y===B.tagName)return K.tag=B.tagName,K;if(Y)K.tag=Y;return K}function PA8(X,J,Z,Q,Y){let G=Q.tag,K=!G?null:J.directives.tagName(G.source,(O)=>Y(G,"TAG_RESOLVE_FAILED",O));if(Z.type==="block-seq"){let{anchor:O,newlineAfterProp:q}=Q,L=O&&G?O.offset>G.offset?O:G:O??G;if(L&&(!q||q.offset<L.offset))Y(L,"MISSING_CHAR","Missing newline after block sequence props")}let B=Z.type==="block-map"?"map":Z.type==="block-seq"?"seq":Z.start.source==="{"?"map":"seq";if(!G||!K||K==="!"||K===LA8.YAMLMap.tagName&&B==="map"||K===FA8.YAMLSeq.tagName&&B==="seq")return l80(X,J,Z,Y,K);let H=J.schema.tags.find((O)=>O.tag===K&&O.collection===B);if(!H){let O=J.schema.knownTags[K];if(O?.collection===B)J.schema.tags.push(Object.assign({},O,{default:!1})),H=O;else{if(O)Y(G,"BAD_COLLECTION_TYPE",`${O.tag} used for ${B} collection, but expects ${O.collection??"scalar"}`,!0);else Y(G,"TAG_RESOLVE_FAILED",`Unresolved tag: ${K}`,!0);return l80(X,J,Z,Y,K)}}let W=l80(X,J,Z,Y,K,H),V=H.resolve?.(W,(O)=>Y(G,"TAG_RESOLVE_FAILED",O),J.options)??W,U=DA8.isNode(V)?V:new wA8.Scalar(V);if(U.range=W.range,U.tag=K,H?.format)U.format=H.format;return U}RA8.composeCollection=PA8});var i80=G8((SA8)=>{var n80=VJ();function CA8(X,J,Z){let Q=J.offset,Y=IA8(J,X.options.strict,Z);if(!Y)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let G=Y.mode===">"?n80.Scalar.BLOCK_FOLDED:n80.Scalar.BLOCK_LITERAL,K=J.source?EA8(J.source):[],B=K.length;for(let A=K.length-1;A>=0;--A){let M=K[A][1];if(M===""||M==="\r")B=A;else break}if(B===0){let A=Y.chomp==="+"&&K.length>0?`
77
+ `.repeat(Math.max(1,K.length-1)):"",M=Q+Y.length;if(J.source)M+=J.source.length;return{value:A,type:G,comment:Y.comment,range:[Q,M,M]}}let H=J.indent+Y.indent,W=J.offset+Y.length,V=0;for(let A=0;A<B;++A){let[M,x]=K[A];if(x===""||x==="\r"){if(Y.indent===0&&M.length>H)H=M.length}else{if(M.length<H)Z(W+M.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(Y.indent===0)H=M.length;if(V=A,H===0&&!X.atRoot)Z(W,"BAD_INDENT","Block scalar values in collections must be indented");break}W+=M.length+x.length+1}for(let A=K.length-1;A>=B;--A)if(K[A][0].length>H)B=A+1;let U="",O="",q=!1;for(let A=0;A<V;++A)U+=K[A][0].slice(H)+`
78
+ `;for(let A=V;A<B;++A){let[M,x]=K[A];W+=M.length+x.length+1;let j=x[x.length-1]==="\r";if(j)x=x.slice(0,-1);if(x&&M.length<H){let E=`Block scalar lines must not be less indented than their ${Y.indent?"explicit indentation indicator":"first line"}`;Z(W-x.length-(j?2:1),"BAD_INDENT",E),M=""}if(G===n80.Scalar.BLOCK_LITERAL)U+=O+M.slice(H)+x,O=`
79
+ `;else if(M.length>H||x[0]==="\t"){if(O===" ")O=`
80
+ `;else if(!q&&O===`
81
+ `)O=`
82
+
83
+ `;U+=O+M.slice(H)+x,O=`
84
+ `,q=!0}else if(x==="")if(O===`
85
+ `)U+=`
86
+ `;else O=`
87
+ `;else U+=O+x,O=" ",q=!1}switch(Y.chomp){case"-":break;case"+":for(let A=B;A<K.length;++A)U+=`
88
+ `+K[A][0].slice(H);if(U[U.length-1]!==`
89
+ `)U+=`
90
+ `;break;default:U+=`
91
+ `}let L=Q+Y.length+J.source.length;return{value:U,type:G,comment:Y.comment,range:[Q,L,L]}}function IA8({offset:X,props:J},Z,Q){if(J[0].type!=="block-scalar-header")return Q(J[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:Y}=J[0],G=Y[0],K=0,B="",H=-1;for(let O=1;O<Y.length;++O){let q=Y[O];if(!B&&(q==="-"||q==="+"))B=q;else{let L=Number(q);if(!K&&L)K=L;else if(H===-1)H=X+O}}if(H!==-1)Q(H,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${Y}`);let W=!1,V="",U=Y.length;for(let O=1;O<J.length;++O){let q=J[O];switch(q.type){case"space":W=!0;case"newline":U+=q.source.length;break;case"comment":if(Z&&!W)Q(q,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");U+=q.source.length,V=q.source.substring(1);break;case"error":Q(q,"UNEXPECTED_TOKEN",q.message),U+=q.source.length;break;default:{let L=`Unexpected token in block scalar header: ${q.type}`;Q(q,"UNEXPECTED_TOKEN",L);let A=q.source;if(A&&typeof A==="string")U+=A.length}}}return{mode:G,indent:K,chomp:B,comment:V,length:U}}function EA8(X){let J=X.split(/\n( *)/),Z=J[0],Q=Z.match(/^( *)/),G=[Q?.[1]?[Q[1],Z.slice(Q[1].length)]:["",Z]];for(let K=1;K<J.length;K+=2)G.push([J[K],J[K+1]]);return G}SA8.resolveBlockScalar=CA8});var r80=G8((uA8)=>{var o80=VJ(),vA8=Tq();function kA8(X,J,Z){let{offset:Q,type:Y,source:G,end:K}=X,B,H,W=(O,q,L)=>Z(Q+O,q,L);switch(Y){case"scalar":B=o80.Scalar.PLAIN,H=bA8(G,W);break;case"single-quoted-scalar":B=o80.Scalar.QUOTE_SINGLE,H=yA8(G,W);break;case"double-quoted-scalar":B=o80.Scalar.QUOTE_DOUBLE,H=gA8(G,W);break;default:return Z(X,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${Y}`),{value:"",type:null,comment:"",range:[Q,Q+G.length,Q+G.length]}}let V=Q+G.length,U=vA8.resolveEnd(K,V,J,Z);return{value:H,type:B,comment:U.comment,range:[Q,V,U.offset]}}function bA8(X,J){let Z="";switch(X[0]){case"\t":Z="a tab character";break;case",":Z="flow indicator character ,";break;case"%":Z="directive indicator character %";break;case"|":case">":{Z=`block scalar indicator ${X[0]}`;break}case"@":case"`":{Z=`reserved character ${X[0]}`;break}}if(Z)J(0,"BAD_SCALAR_START",`Plain value cannot start with ${Z}`);return qE0(X)}function yA8(X,J){if(X[X.length-1]!=="'"||X.length===1)J(X.length,"MISSING_CHAR","Missing closing 'quote");return qE0(X.slice(1,-1)).replace(/''/g,"'")}function qE0(X){let J,Z;try{J=new RegExp(`(.*?)(?<![ ])[ ]*\r?
92
+ `,"sy"),Z=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
93
+ `,"sy")}catch{J=/(.*?)[ \t]*\r?\n/sy,Z=/[ \t]*(.*?)[ \t]*\r?\n/sy}let Q=J.exec(X);if(!Q)return X;let Y=Q[1],G=" ",K=J.lastIndex;Z.lastIndex=K;while(Q=Z.exec(X)){if(Q[1]==="")if(G===`
94
+ `)Y+=G;else G=`
95
+ `;else Y+=G+Q[1],G=" ";K=Z.lastIndex}let B=/[ \t]*(.*)/sy;return B.lastIndex=K,Q=B.exec(X),Y+G+(Q?.[1]??"")}function gA8(X,J){let Z="";for(let Q=1;Q<X.length-1;++Q){let Y=X[Q];if(Y==="\r"&&X[Q+1]===`
96
+ `)continue;if(Y===`
97
+ `){let{fold:G,offset:K}=hA8(X,Q);Z+=G,Q=K}else if(Y==="\\"){let G=X[++Q],K=mA8[G];if(K)Z+=K;else if(G===`
98
+ `){G=X[Q+1];while(G===" "||G==="\t")G=X[++Q+1]}else if(G==="\r"&&X[Q+1]===`
99
+ `){G=X[++Q+1];while(G===" "||G==="\t")G=X[++Q+1]}else if(G==="x"||G==="u"||G==="U"){let B=G==="x"?2:G==="u"?4:8;Z+=dA8(X,Q+1,B,J),Q+=B}else{let B=X.substr(Q-1,2);J(Q-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${B}`),Z+=B}}else if(Y===" "||Y==="\t"){let G=Q,K=X[Q+1];while(K===" "||K==="\t")K=X[++Q+1];if(K!==`
100
+ `&&!(K==="\r"&&X[Q+2]===`
101
+ `))Z+=Q>G?X.slice(G,Q+1):Y}else Z+=Y}if(X[X.length-1]!=='"'||X.length===1)J(X.length,"MISSING_CHAR",'Missing closing "quote');return Z}function hA8(X,J){let Z="",Q=X[J+1];while(Q===" "||Q==="\t"||Q===`
102
+ `||Q==="\r"){if(Q==="\r"&&X[J+2]!==`
103
+ `)break;if(Q===`
104
+ `)Z+=`
105
+ `;J+=1,Q=X[J+1]}if(!Z)Z=" ";return{fold:Z,offset:J}}var mA8={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
106
+ `,r:"\r",t:"\t",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function dA8(X,J,Z,Q){let Y=X.substr(J,Z),K=Y.length===Z&&/^[0-9a-fA-F]+$/.test(Y)?parseInt(Y,16):NaN;try{return String.fromCodePoint(K)}catch{let B=X.substr(J-2,Z+2);return Q(J-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${B}`),B}}uA8.resolveFlowScalar=kA8});var wE0=G8((oA8)=>{var Qz=KX(),DE0=VJ(),fA8=i80(),pA8=r80();function lA8(X,J,Z,Q){let{value:Y,type:G,comment:K,range:B}=J.type==="block-scalar"?fA8.resolveBlockScalar(X,J,Q):pA8.resolveFlowScalar(J,X.options.strict,Q),H=Z?X.directives.tagName(Z.source,(U)=>Q(Z,"TAG_RESOLVE_FAILED",U)):null,W;if(X.options.stringKeys&&X.atKey)W=X.schema[Qz.SCALAR];else if(H)W=nA8(X.schema,Y,H,Z,Q);else if(J.type==="scalar")W=iA8(X,Y,J,Q);else W=X.schema[Qz.SCALAR];let V;try{let U=W.resolve(Y,(O)=>Q(Z??J,"TAG_RESOLVE_FAILED",O),X.options);V=Qz.isScalar(U)?U:new DE0.Scalar(U)}catch(U){let O=U instanceof Error?U.message:String(U);Q(Z??J,"TAG_RESOLVE_FAILED",O),V=new DE0.Scalar(Y)}if(V.range=B,V.source=Y,G)V.type=G;if(H)V.tag=H;if(W.format)V.format=W.format;if(K)V.comment=K;return V}function nA8(X,J,Z,Q,Y){if(Z==="!")return X[Qz.SCALAR];let G=[];for(let B of X.tags)if(!B.collection&&B.tag===Z)if(B.default&&B.test)G.push(B);else return B;for(let B of G)if(B.test?.test(J))return B;let K=X.knownTags[Z];if(K&&!K.collection)return X.tags.push(Object.assign({},K,{default:!1,test:void 0})),K;return Y(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Z}`,Z!=="tag:yaml.org,2002:str"),X[Qz.SCALAR]}function iA8({atKey:X,directives:J,schema:Z},Q,Y,G){let K=Z.tags.find((B)=>(B.default===!0||X&&B.default==="key")&&B.test?.test(Q))||Z[Qz.SCALAR];if(Z.compat){let B=Z.compat.find((H)=>H.default&&H.test?.test(Q))??Z[Qz.SCALAR];if(K.tag!==B.tag){let H=J.tagString(K.tag),W=J.tagString(B.tag),V=`Value may be parsed as either ${H} or ${W}`;G(Y,"TAG_RESOLVE_FAILED",V,!0)}}return K}oA8.composeScalar=lA8});var LE0=G8((sA8)=>{function aA8(X,J,Z){if(J){Z??(Z=J.length);for(let Q=Z-1;Q>=0;--Q){let Y=J[Q];switch(Y.type){case"space":case"comment":case"newline":X-=Y.source.length;continue}Y=J[++Q];while(Y?.type==="space")X+=Y.source.length,Y=J[++Q];break}}return X}sA8.emptyScalarPosition=aA8});var TE0=G8((KT8)=>{var eA8=MM(),XT8=KX(),JT8=_E0(),FE0=wE0(),ZT8=Tq(),QT8=LE0(),YT8={composeNode:AE0,composeEmptyNode:a80};function AE0(X,J,Z,Q){let Y=X.atKey,{spaceBefore:G,comment:K,anchor:B,tag:H}=Z,W,V=!0;switch(J.type){case"alias":if(W=GT8(X,J,Q),B||H)Q(J,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(W=FE0.composeScalar(X,J,H,Q),B)W.anchor=B.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(W=JT8.composeCollection(YT8,X,J,Z,Q),B)W.anchor=B.source.substring(1)}catch(U){let O=U instanceof Error?U.message:String(U);Q(J,"RESOURCE_EXHAUSTION",O)}break;default:{let U=J.type==="error"?J.message:`Unsupported token (type: ${J.type})`;Q(J,"UNEXPECTED_TOKEN",U),V=!1}}if(W??(W=a80(X,J.offset,void 0,null,Z,Q)),B&&W.anchor==="")Q(B,"BAD_ALIAS","Anchor cannot be an empty string");if(Y&&X.options.stringKeys&&(!XT8.isScalar(W)||typeof W.value!=="string"||W.tag&&W.tag!=="tag:yaml.org,2002:str"))Q(H??J,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(G)W.spaceBefore=!0;if(K)if(J.type==="scalar"&&J.source==="")W.comment=K;else W.commentBefore=K;if(X.options.keepSourceTokens&&V)W.srcToken=J;return W}function a80(X,J,Z,Q,{spaceBefore:Y,comment:G,anchor:K,tag:B,end:H},W){let V={type:"scalar",offset:QT8.emptyScalarPosition(J,Z,Q),indent:-1,source:""},U=FE0.composeScalar(X,V,B,W);if(K){if(U.anchor=K.source.substring(1),U.anchor==="")W(K,"BAD_ALIAS","Anchor cannot be an empty string")}if(Y)U.spaceBefore=!0;if(G)U.comment=G,U.range[2]=H;return U}function GT8({options:X},{offset:J,source:Z,end:Q},Y){let G=new eA8.Alias(Z.substring(1));if(G.source==="")Y(J,"BAD_ALIAS","Alias cannot be an empty string");if(G.source.endsWith(":"))Y(J+Z.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let K=J+Z.length,B=ZT8.resolveEnd(Q,K,X.strict,Y);if(G.range=[J,K,B.offset],B.comment)G.comment=B.comment;return G}KT8.composeEmptyNode=a80;KT8.composeNode=AE0});var PE0=G8((zT8)=>{var WT8=hM(),ME0=TE0(),VT8=Tq(),$T8=dM();function UT8(X,J,{offset:Z,start:Q,value:Y,end:G},K){let B=Object.assign({_directives:J},X),H=new WT8.Document(void 0,B),W={atKey:!1,atRoot:!0,directives:H.directives,options:H.options,schema:H.schema},V=$T8.resolveProps(Q,{indicator:"doc-start",next:Y??G?.[0],offset:Z,onError:K,parentIndent:0,startOnNewline:!0});if(V.found){if(H.directives.docStart=!0,Y&&(Y.type==="block-map"||Y.type==="block-seq")&&!V.hasNewline)K(V.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}H.contents=Y?ME0.composeNode(W,Y,V,K):ME0.composeEmptyNode(W,V.end,Q,null,V,K);let U=H.contents.range[2],O=VT8.resolveEnd(G,U,!1,K);if(O.comment)H.comment=O.comment;return H.range=[Z,U,O.offset],H}zT8.composeDoc=UT8});var s80=G8((LT8)=>{var OT8=GN("process"),_T8=J80(),qT8=hM(),uM=mM(),RE0=KX(),DT8=PE0(),wT8=Tq();function cM(X){if(typeof X==="number")return[X,X+1];if(Array.isArray(X))return X.length===2?X:[X[0],X[1]];let{offset:J,source:Z}=X;return[J,J+(typeof Z==="string"?Z.length:1)]}function jE0(X){let J="",Z=!1,Q=!1;for(let Y=0;Y<X.length;++Y){let G=X[Y];switch(G[0]){case"#":J+=(J===""?"":Q?`
107
+
108
+ `:`
109
+ `)+(G.substring(1)||" "),Z=!0,Q=!1;break;case"%":if(X[Y+1]?.[0]!=="#")Y+=1;Z=!1;break;default:if(!Z)Q=!0;Z=!1}}return{comment:J,afterEmptyLine:Q}}class CE0{constructor(X={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(J,Z,Q,Y)=>{let G=cM(J);if(Y)this.warnings.push(new uM.YAMLWarning(G,Z,Q));else this.errors.push(new uM.YAMLParseError(G,Z,Q))},this.directives=new _T8.Directives({version:X.version||"1.2"}),this.options=X}decorate(X,J){let{comment:Z,afterEmptyLine:Q}=jE0(this.prelude);if(Z){let Y=X.contents;if(J)X.comment=X.comment?`${X.comment}
110
+ ${Z}`:Z;else if(Q||X.directives.docStart||!Y)X.commentBefore=Z;else if(RE0.isCollection(Y)&&!Y.flow&&Y.items.length>0){let G=Y.items[0];if(RE0.isPair(G))G=G.key;let K=G.commentBefore;G.commentBefore=K?`${Z}
111
+ ${K}`:Z}else{let G=Y.commentBefore;Y.commentBefore=G?`${Z}
112
+ ${G}`:Z}}if(J){for(let Y=0;Y<this.errors.length;++Y)X.errors.push(this.errors[Y]);for(let Y=0;Y<this.warnings.length;++Y)X.warnings.push(this.warnings[Y])}else X.errors=this.errors,X.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:jE0(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(X,J=!1,Z=-1){for(let Q of X)yield*this.next(Q);yield*this.end(J,Z)}*next(X){if(OT8.env.LOG_STREAM)console.dir(X,{depth:null});switch(X.type){case"directive":this.directives.add(X.source,(J,Z,Q)=>{let Y=cM(X);Y[0]+=J,this.onError(Y,"BAD_DIRECTIVE",Z,Q)}),this.prelude.push(X.source),this.atDirectives=!0;break;case"document":{let J=DT8.composeDoc(this.options,this.directives,X,this.onError);if(this.atDirectives&&!J.directives.docStart)this.onError(X,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(J,!1),this.doc)yield this.doc;this.doc=J,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(X.source);break;case"error":{let J=X.source?`${X.message}: ${JSON.stringify(X.source)}`:X.message,Z=new uM.YAMLParseError(cM(X),"UNEXPECTED_TOKEN",J);if(this.atDirectives||!this.doc)this.errors.push(Z);else this.doc.errors.push(Z);break}case"doc-end":{if(!this.doc){this.errors.push(new uM.YAMLParseError(cM(X),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let J=wT8.resolveEnd(X.end,X.offset+X.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),J.comment){let Z=this.doc.comment;this.doc.comment=Z?`${Z}
113
+ ${J.comment}`:J.comment}this.doc.range[2]=J.offset;break}default:this.errors.push(new uM.YAMLParseError(cM(X),"UNEXPECTED_TOKEN",`Unsupported token ${X.type}`))}}*end(X=!1,J=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(X){let Z=Object.assign({_directives:this.directives},this.options),Q=new qT8.Document(void 0,Z);if(this.atDirectives)this.onError(J,"MISSING_CHAR","Missing directives-end indicator line");Q.range=[0,J,J],this.decorate(Q,!1),yield Q}}}LT8.Composer=CE0});var SE0=G8((IT8)=>{var AT8=i80(),TT8=r80(),MT8=mM(),IE0=CM();function PT8(X,J=!0,Z){if(X){let Q=(Y,G,K)=>{let B=typeof Y==="number"?Y:Array.isArray(Y)?Y[0]:Y.offset;if(Z)Z(B,G,K);else throw new MT8.YAMLParseError([B,B+1],G,K)};switch(X.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return TT8.resolveFlowScalar(X,J,Q);case"block-scalar":return AT8.resolveBlockScalar({options:{strict:J}},X,Q)}}return null}function RT8(X,J){let{implicitKey:Z=!1,indent:Q,inFlow:Y=!1,offset:G=-1,type:K="PLAIN"}=J,B=IE0.stringifyString({type:K,value:X},{implicitKey:Z,indent:Q>0?" ".repeat(Q):"",inFlow:Y,options:{blockQuote:!0,lineWidth:-1}}),H=J.end??[{type:"newline",offset:-1,indent:Q,source:`
114
+ `}];switch(B[0]){case"|":case">":{let W=B.indexOf(`
115
+ `),V=B.substring(0,W),U=B.substring(W+1)+`
116
+ `,O=[{type:"block-scalar-header",offset:G,indent:Q,source:V}];if(!EE0(O,H))O.push({type:"newline",offset:-1,indent:Q,source:`
117
+ `});return{type:"block-scalar",offset:G,indent:Q,props:O,source:U}}case'"':return{type:"double-quoted-scalar",offset:G,indent:Q,source:B,end:H};case"'":return{type:"single-quoted-scalar",offset:G,indent:Q,source:B,end:H};default:return{type:"scalar",offset:G,indent:Q,source:B,end:H}}}function jT8(X,J,Z={}){let{afterKey:Q=!1,implicitKey:Y=!1,inFlow:G=!1,type:K}=Z,B="indent"in X?X.indent:null;if(Q&&typeof B==="number")B+=2;if(!K)switch(X.type){case"single-quoted-scalar":K="QUOTE_SINGLE";break;case"double-quoted-scalar":K="QUOTE_DOUBLE";break;case"block-scalar":{let W=X.props[0];if(W.type!=="block-scalar-header")throw Error("Invalid block scalar header");K=W.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:K="PLAIN"}let H=IE0.stringifyString({type:K,value:J},{implicitKey:Y||B===null,indent:B!==null&&B>0?" ".repeat(B):"",inFlow:G,options:{blockQuote:!0,lineWidth:-1}});switch(H[0]){case"|":case">":CT8(X,H);break;case'"':t80(X,H,"double-quoted-scalar");break;case"'":t80(X,H,"single-quoted-scalar");break;default:t80(X,H,"scalar")}}function CT8(X,J){let Z=J.indexOf(`
118
+ `),Q=J.substring(0,Z),Y=J.substring(Z+1)+`
119
+ `;if(X.type==="block-scalar"){let G=X.props[0];if(G.type!=="block-scalar-header")throw Error("Invalid block scalar header");G.source=Q,X.source=Y}else{let{offset:G}=X,K="indent"in X?X.indent:-1,B=[{type:"block-scalar-header",offset:G,indent:K,source:Q}];if(!EE0(B,"end"in X?X.end:void 0))B.push({type:"newline",offset:-1,indent:K,source:`
120
+ `});for(let H of Object.keys(X))if(H!=="type"&&H!=="offset")delete X[H];Object.assign(X,{type:"block-scalar",indent:K,props:B,source:Y})}}function EE0(X,J){if(J)for(let Z of J)switch(Z.type){case"space":case"comment":X.push(Z);break;case"newline":return X.push(Z),!0}return!1}function t80(X,J,Z){switch(X.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":X.type=Z,X.source=J;break;case"block-scalar":{let Q=X.props.slice(1),Y=J.length;if(X.props[0].type==="block-scalar-header")Y-=X.props[0].source.length;for(let G of Q)G.offset+=Y;delete X.props,Object.assign(X,{type:Z,source:J,end:Q});break}case"block-map":case"block-seq":{let Y={type:"newline",offset:X.offset+J.length,indent:X.indent,source:`
121
+ `};delete X.items,Object.assign(X,{type:Z,source:J,end:[Y]});break}default:{let Q="indent"in X?X.indent:-1,Y="end"in X&&Array.isArray(X.end)?X.end.filter((G)=>G.type==="space"||G.type==="comment"||G.type==="newline"):[];for(let G of Object.keys(X))if(G!=="type"&&G!=="offset")delete X[G];Object.assign(X,{type:Z,indent:Q,source:J,end:Y})}}}IT8.createScalarToken=RT8;IT8.resolveAsScalar=PT8;IT8.setScalarValue=jT8});var xE0=G8((kT8)=>{var vT8=(X)=>("type"in X)?yy(X):by(X);function yy(X){switch(X.type){case"block-scalar":{let J="";for(let Z of X.props)J+=yy(Z);return J+X.source}case"block-map":case"block-seq":{let J="";for(let Z of X.items)J+=by(Z);return J}case"flow-collection":{let J=X.start.source;for(let Z of X.items)J+=by(Z);for(let Z of X.end)J+=Z.source;return J}case"document":{let J=by(X);if(X.end)for(let Z of X.end)J+=Z.source;return J}default:{let J=X.source;if("end"in X&&X.end)for(let Z of X.end)J+=Z.source;return J}}}function by({start:X,key:J,sep:Z,value:Q}){let Y="";for(let G of X)Y+=G.source;if(J)Y+=yy(J);if(Z)for(let G of Z)Y+=G.source;if(Q)Y+=yy(Q);return Y}kT8.stringify=vT8});var bE0=G8((gT8)=>{var e80=Symbol("break visit"),yT8=Symbol("skip children"),vE0=Symbol("remove item");function Yz(X,J){if("type"in X&&X.type==="document")X={start:X.start,value:X.value};kE0(Object.freeze([]),X,J)}Yz.BREAK=e80;Yz.SKIP=yT8;Yz.REMOVE=vE0;Yz.itemAtPath=(X,J)=>{let Z=X;for(let[Q,Y]of J){let G=Z?.[Q];if(G&&"items"in G)Z=G.items[Y];else return}return Z};Yz.parentCollection=(X,J)=>{let Z=Yz.itemAtPath(X,J.slice(0,-1)),Q=J[J.length-1][0],Y=Z?.[Q];if(Y&&"items"in Y)return Y;throw Error("Parent collection not found")};function kE0(X,J,Z){let Q=Z(J,X);if(typeof Q==="symbol")return Q;for(let Y of["key","value"]){let G=J[Y];if(G&&"items"in G){for(let K=0;K<G.items.length;++K){let B=kE0(Object.freeze(X.concat([[Y,K]])),G.items[K],Z);if(typeof B==="number")K=B-1;else if(B===e80)return e80;else if(B===vE0)G.items.splice(K,1),K-=1}if(typeof Q==="function"&&Y==="key")Q=Q(J,X)}}return typeof Q==="function"?Q(J,X):Q}gT8.visit=Yz});var gy=G8((lT8)=>{var X90=SE0(),mT8=xE0(),dT8=bE0(),J90="\uFEFF",Z90="\x02",Q90="\x18",Y90="\x1F",uT8=(X)=>!!X&&("items"in X),cT8=(X)=>!!X&&(X.type==="scalar"||X.type==="single-quoted-scalar"||X.type==="double-quoted-scalar"||X.type==="block-scalar");function fT8(X){switch(X){case J90:return"<BOM>";case Z90:return"<DOC>";case Q90:return"<FLOW_END>";case Y90:return"<SCALAR>";default:return JSON.stringify(X)}}function pT8(X){switch(X){case J90:return"byte-order-mark";case Z90:return"doc-mode";case Q90:return"flow-error-end";case Y90:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
122
+ `:case`\r
123
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(X[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}lT8.createScalarToken=X90.createScalarToken;lT8.resolveAsScalar=X90.resolveAsScalar;lT8.setScalarValue=X90.setScalarValue;lT8.stringify=mT8.stringify;lT8.visit=dT8.visit;lT8.BOM=J90;lT8.DOCUMENT=Z90;lT8.FLOW_END=Q90;lT8.SCALAR=Y90;lT8.isCollection=uT8;lT8.isScalar=cT8;lT8.prettyToken=fT8;lT8.tokenType=pT8});var K90=G8((BM8)=>{var fM=gy();function tG(X){switch(X){case void 0:case" ":case`
124
+ `:case"\r":case"\t":return!0;default:return!1}}var yE0=new Set("0123456789ABCDEFabcdef"),GM8=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),hy=new Set(",[]{}"),KM8=new Set(` ,[]{}
125
+ \r `),G90=(X)=>!X||KM8.has(X);class gE0{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(X,J=!1){if(X){if(typeof X!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+X:X,this.lineEndPos=null}this.atEnd=!J;let Z=this.next??"stream";while(Z&&(J||this.hasChars(1)))Z=yield*this.parseNext(Z)}atLineEnd(){let X=this.pos,J=this.buffer[X];while(J===" "||J==="\t")J=this.buffer[++X];if(!J||J==="#"||J===`
126
+ `)return!0;if(J==="\r")return this.buffer[X+1]===`
127
+ `;return!1}charAt(X){return this.buffer[this.pos+X]}continueScalar(X){let J=this.buffer[X];if(this.indentNext>0){let Z=0;while(J===" ")J=this.buffer[++Z+X];if(J==="\r"){let Q=this.buffer[Z+X+1];if(Q===`
128
+ `||!Q&&!this.atEnd)return X+Z+1}return J===`
129
+ `||Z>=this.indentNext||!J&&!this.atEnd?X+Z:-1}if(J==="-"||J==="."){let Z=this.buffer.substr(X,3);if((Z==="---"||Z==="...")&&tG(this.buffer[X+3]))return-1}return X}getLine(){let X=this.lineEndPos;if(typeof X!=="number"||X!==-1&&X<this.pos)X=this.buffer.indexOf(`
130
+ `,this.pos),this.lineEndPos=X;if(X===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[X-1]==="\r")X-=1;return this.buffer.substring(this.pos,X)}hasChars(X){return this.pos+X<=this.buffer.length}setNext(X){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=X,null}peek(X){return this.buffer.substr(this.pos,X)}*parseNext(X){switch(X){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let X=this.getLine();if(X===null)return this.setNext("stream");if(X[0]===fM.BOM)yield*this.pushCount(1),X=X.substring(1);if(X[0]==="%"){let J=X.length,Z=X.indexOf("#");while(Z!==-1){let Y=X[Z-1];if(Y===" "||Y==="\t"){J=Z-1;break}else Z=X.indexOf("#",Z+1)}while(!0){let Y=X[J-1];if(Y===" "||Y==="\t")J-=1;else break}let Q=(yield*this.pushCount(J))+(yield*this.pushSpaces(!0));return yield*this.pushCount(X.length-Q),this.pushNewline(),"stream"}if(this.atLineEnd()){let J=yield*this.pushSpaces(!0);return yield*this.pushCount(X.length-J),yield*this.pushNewline(),"stream"}return yield fM.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let X=this.charAt(0);if(!X&&!this.atEnd)return this.setNext("line-start");if(X==="-"||X==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let J=this.peek(3);if((J==="---"||J==="...")&&tG(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,J==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!tG(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[X,J]=this.peek(2);if(!J&&!this.atEnd)return this.setNext("block-start");if((X==="-"||X==="?"||X===":")&&tG(J)){let Z=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=Z,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let X=this.getLine();if(X===null)return this.setNext("doc");let J=yield*this.pushIndicators();switch(X[J]){case"#":yield*this.pushCount(X.length-J);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(G90),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return J+=yield*this.parseBlockScalarHeader(),J+=yield*this.pushSpaces(!0),yield*this.pushCount(X.length-J),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let X,J,Z=-1;do{if(X=yield*this.pushNewline(),X>0)J=yield*this.pushSpaces(!1),this.indentValue=Z=J;else J=0;J+=yield*this.pushSpaces(!0)}while(X+J>0);let Q=this.getLine();if(Q===null)return this.setNext("flow");if(Z!==-1&&Z<this.indentNext&&Q[0]!=="#"||Z===0&&(Q.startsWith("---")||Q.startsWith("..."))&&tG(Q[3])){if(!(Z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield fM.FLOW_END,yield*this.parseLineStart()}let Y=0;while(Q[Y]===",")Y+=yield*this.pushCount(1),Y+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(Y+=yield*this.pushIndicators(),Q[Y]){case void 0:return"flow";case"#":return yield*this.pushCount(Q.length-Y),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(G90),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let G=this.charAt(1);if(this.flowKey||tG(G)||G===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let X=this.charAt(0),J=this.buffer.indexOf(X,this.pos+1);if(X==="'")while(J!==-1&&this.buffer[J+1]==="'")J=this.buffer.indexOf("'",J+2);else while(J!==-1){let Y=0;while(this.buffer[J-1-Y]==="\\")Y+=1;if(Y%2===0)break;J=this.buffer.indexOf('"',J+1)}let Z=this.buffer.substring(0,J),Q=Z.indexOf(`
131
+ `,this.pos);if(Q!==-1){while(Q!==-1){let Y=this.continueScalar(Q+1);if(Y===-1)break;Q=Z.indexOf(`
132
+ `,Y)}if(Q!==-1)J=Q-(Z[Q-1]==="\r"?2:1)}if(J===-1){if(!this.atEnd)return this.setNext("quoted-scalar");J=this.buffer.length}return yield*this.pushToIndex(J+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let X=this.pos;while(!0){let J=this.buffer[++X];if(J==="+")this.blockScalarKeep=!0;else if(J>"0"&&J<="9")this.blockScalarIndent=Number(J)-1;else if(J!=="-")break}return yield*this.pushUntil((J)=>tG(J)||J==="#")}*parseBlockScalar(){let X=this.pos-1,J=0,Z;X:for(let Y=this.pos;Z=this.buffer[Y];++Y)switch(Z){case" ":J+=1;break;case`
133
+ `:X=Y,J=0;break;case"\r":{let G=this.buffer[Y+1];if(!G&&!this.atEnd)return this.setNext("block-scalar");if(G===`
134
+ `)break}default:break X}if(!Z&&!this.atEnd)return this.setNext("block-scalar");if(J>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=J;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let Y=this.continueScalar(X+1);if(Y===-1)break;X=this.buffer.indexOf(`
135
+ `,Y)}while(X!==-1);if(X===-1){if(!this.atEnd)return this.setNext("block-scalar");X=this.buffer.length}}let Q=X+1;Z=this.buffer[Q];while(Z===" ")Z=this.buffer[++Q];if(Z==="\t"){while(Z==="\t"||Z===" "||Z==="\r"||Z===`
136
+ `)Z=this.buffer[++Q];X=Q-1}else if(!this.blockScalarKeep)do{let Y=X-1,G=this.buffer[Y];if(G==="\r")G=this.buffer[--Y];let K=Y;while(G===" ")G=this.buffer[--Y];if(G===`
137
+ `&&Y>=this.pos&&Y+1+J>K)X=Y;else break}while(!0);return yield fM.SCALAR,yield*this.pushToIndex(X+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let X=this.flowLevel>0,J=this.pos-1,Z=this.pos-1,Q;while(Q=this.buffer[++Z])if(Q===":"){let Y=this.buffer[Z+1];if(tG(Y)||X&&hy.has(Y))break;J=Z}else if(tG(Q)){let Y=this.buffer[Z+1];if(Q==="\r")if(Y===`
138
+ `)Z+=1,Q=`
139
+ `,Y=this.buffer[Z+1];else J=Z;if(Y==="#"||X&&hy.has(Y))break;if(Q===`
140
+ `){let G=this.continueScalar(Z+1);if(G===-1)break;Z=Math.max(Z,G-2)}}else{if(X&&hy.has(Q))break;J=Z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield fM.SCALAR,yield*this.pushToIndex(J+1,!0),X?"flow":"doc"}*pushCount(X){if(X>0)return yield this.buffer.substr(this.pos,X),this.pos+=X,X;return 0}*pushToIndex(X,J){let Z=this.buffer.slice(this.pos,X);if(Z)return yield Z,this.pos+=Z.length,Z.length;else if(J)yield"";return 0}*pushIndicators(){let X=0;X:while(!0){switch(this.charAt(0)){case"!":X+=yield*this.pushTag(),X+=yield*this.pushSpaces(!0);continue X;case"&":X+=yield*this.pushUntil(G90),X+=yield*this.pushSpaces(!0);continue X;case"-":case"?":case":":{let J=this.flowLevel>0,Z=this.charAt(1);if(tG(Z)||J&&hy.has(Z)){if(!J)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;X+=yield*this.pushCount(1),X+=yield*this.pushSpaces(!0);continue X}}}break X}return X}*pushTag(){if(this.charAt(1)==="<"){let X=this.pos+2,J=this.buffer[X];while(!tG(J)&&J!==">")J=this.buffer[++X];return yield*this.pushToIndex(J===">"?X+1:X,!1)}else{let X=this.pos+1,J=this.buffer[X];while(J)if(GM8.has(J))J=this.buffer[++X];else if(J==="%"&&yE0.has(this.buffer[X+1])&&yE0.has(this.buffer[X+2]))J=this.buffer[X+=3];else break;return yield*this.pushToIndex(X,!1)}}*pushNewline(){let X=this.buffer[this.pos];if(X===`
141
+ `)return yield*this.pushCount(1);else if(X==="\r"&&this.charAt(1)===`
142
+ `)return yield*this.pushCount(2);else return 0}*pushSpaces(X){let J=this.pos-1,Z;do Z=this.buffer[++J];while(Z===" "||X&&Z==="\t");let Q=J-this.pos;if(Q>0)yield this.buffer.substr(this.pos,Q),this.pos=J;return Q}*pushUntil(X){let J=this.pos,Z=this.buffer[J];while(!X(Z))Z=this.buffer[++J];return yield*this.pushToIndex(J,!1)}}BM8.Lexer=gE0});var B90=G8((WM8)=>{class hE0{constructor(){this.lineStarts=[],this.addNewLine=(X)=>this.lineStarts.push(X),this.linePos=(X)=>{let J=0,Z=this.lineStarts.length;while(J<Z){let Y=J+Z>>1;if(this.lineStarts[Y]<X)J=Y+1;else Z=Y}if(this.lineStarts[J]===X)return{line:J+1,col:1};if(J===0)return{line:0,col:X};let Q=this.lineStarts[J-1];return{line:J,col:X-Q+1}}}}WM8.LineCounter=hE0});var H90=G8((zM8)=>{var $M8=GN("process"),mE0=gy(),UM8=K90();function aW(X,J){for(let Z=0;Z<X.length;++Z)if(X[Z].type===J)return!0;return!1}function dE0(X){for(let J=0;J<X.length;++J)switch(X[J].type){case"space":case"comment":case"newline":break;default:return J}return-1}function cE0(X){switch(X?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function my(X){switch(X.type){case"document":return X.start;case"block-map":{let J=X.items[X.items.length-1];return J.sep??J.start}case"block-seq":return X.items[X.items.length-1].start;default:return[]}}function Mq(X){if(X.length===0)return[];let J=X.length;X:while(--J>=0)switch(X[J].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break X}while(X[++J]?.type==="space");return X.splice(J,X.length)}function dy(X,J){if(J.length<1e5)Array.prototype.push.apply(X,J);else for(let Z=0;Z<J.length;++Z)X.push(J[Z])}function uE0(X){if(X.start.type==="flow-seq-start"){for(let J of X.items)if(J.sep&&!J.value&&!aW(J.start,"explicit-key-ind")&&!aW(J.sep,"map-value-ind")){if(J.key)J.value=J.key;if(delete J.key,cE0(J.value))if(J.value.end)dy(J.value.end,J.sep);else J.value.end=J.sep;else dy(J.start,J.sep);delete J.sep}}}class fE0{constructor(X){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new UM8.Lexer,this.onNewLine=X}*parse(X,J=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let Z of this.lexer.lex(X,J))yield*this.next(Z);if(!J)yield*this.end()}*next(X){if(this.source=X,$M8.env.LOG_TOKENS)console.log("|",mE0.prettyToken(X));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=X.length;return}let J=mE0.tokenType(X);if(!J){let Z=`Not a YAML token: ${X}`;yield*this.pop({type:"error",offset:this.offset,message:Z,source:X}),this.offset+=X.length}else if(J==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=J,yield*this.step(),J){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+X.length);break;case"space":if(this.atNewLine&&X[0]===" ")this.indent+=X.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=X.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=X.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let X=this.peek(1);if(this.type==="doc-end"&&X?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!X)return yield*this.stream();switch(X.type){case"document":return yield*this.document(X);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(X);case"block-scalar":return yield*this.blockScalar(X);case"block-map":return yield*this.blockMap(X);case"block-seq":return yield*this.blockSequence(X);case"flow-collection":return yield*this.flowCollection(X);case"doc-end":return yield*this.documentEnd(X)}yield*this.pop()}peek(X){return this.stack[this.stack.length-X]}*pop(X){let J=X??this.stack.pop();if(!J)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield J;else{let Z=this.peek(1);if(J.type==="block-scalar")J.indent="indent"in Z?Z.indent:0;else if(J.type==="flow-collection"&&Z.type==="document")J.indent=0;if(J.type==="flow-collection")uE0(J);switch(Z.type){case"document":Z.value=J;break;case"block-scalar":Z.props.push(J);break;case"block-map":{let Q=Z.items[Z.items.length-1];if(Q.value){Z.items.push({start:[],key:J,sep:[]}),this.onKeyLine=!0;return}else if(Q.sep)Q.value=J;else{Object.assign(Q,{key:J,sep:[]}),this.onKeyLine=!Q.explicitKey;return}break}case"block-seq":{let Q=Z.items[Z.items.length-1];if(Q.value)Z.items.push({start:[],value:J});else Q.value=J;break}case"flow-collection":{let Q=Z.items[Z.items.length-1];if(!Q||Q.value)Z.items.push({start:[],key:J,sep:[]});else if(Q.sep)Q.value=J;else Object.assign(Q,{key:J,sep:[]});return}default:yield*this.pop(),yield*this.pop(J)}if((Z.type==="document"||Z.type==="block-map"||Z.type==="block-seq")&&(J.type==="block-map"||J.type==="block-seq")){let Q=J.items[J.items.length-1];if(Q&&!Q.sep&&!Q.value&&Q.start.length>0&&dE0(Q.start)===-1&&(J.indent===0||Q.start.every((Y)=>Y.type!=="comment"||Y.indent<J.indent))){if(Z.type==="document")Z.end=Q.start;else Z.items.push({start:Q.start});J.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let X={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")X.start.push(this.sourceToken);this.stack.push(X);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(X){if(X.value)return yield*this.lineEnd(X);switch(this.type){case"doc-start":{if(dE0(X.start)!==-1)yield*this.pop(),yield*this.step();else X.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":X.start.push(this.sourceToken);return}let J=this.startBlockValue(X);if(J)this.stack.push(J);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(X){if(this.type==="map-value-ind"){let J=my(this.peek(2)),Z=Mq(J),Q;if(X.end)Q=X.end,Q.push(this.sourceToken),delete X.end;else Q=[this.sourceToken];let Y={type:"block-map",offset:X.offset,indent:X.indent,items:[{start:Z,key:X,sep:Q}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=Y}else yield*this.lineEnd(X)}*blockScalar(X){switch(this.type){case"space":case"comment":case"newline":X.props.push(this.sourceToken);return;case"scalar":if(X.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let J=this.source.indexOf(`
143
+ `)+1;while(J!==0)this.onNewLine(this.offset+J),J=this.source.indexOf(`
144
+ `,J)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(X){let J=X.items[X.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,J.value){let Z="end"in J.value?J.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else X.items.push({start:[this.sourceToken]})}else if(J.sep)J.sep.push(this.sourceToken);else J.start.push(this.sourceToken);return;case"space":case"comment":if(J.value)X.items.push({start:[this.sourceToken]});else if(J.sep)J.sep.push(this.sourceToken);else{if(this.atIndentedComment(J.start,X.indent)){let Q=X.items[X.items.length-2]?.value?.end;if(Array.isArray(Q)){dy(Q,J.start),Q.push(this.sourceToken),X.items.pop();return}}J.start.push(this.sourceToken)}return}if(this.indent>=X.indent){let Z=!this.onKeyLine&&this.indent===X.indent,Q=Z&&(J.sep||J.explicitKey)&&this.type!=="seq-item-ind",Y=[];if(Q&&J.sep&&!J.value){let G=[];for(let K=0;K<J.sep.length;++K){let B=J.sep[K];switch(B.type){case"newline":G.push(K);break;case"space":break;case"comment":if(B.indent>X.indent)G.length=0;break;default:G.length=0}}if(G.length>=2)Y=J.sep.splice(G[1])}switch(this.type){case"anchor":case"tag":if(Q||J.value)Y.push(this.sourceToken),X.items.push({start:Y}),this.onKeyLine=!0;else if(J.sep)J.sep.push(this.sourceToken);else J.start.push(this.sourceToken);return;case"explicit-key-ind":if(!J.sep&&!J.explicitKey)J.start.push(this.sourceToken),J.explicitKey=!0;else if(Q||J.value)Y.push(this.sourceToken),X.items.push({start:Y,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(J.explicitKey)if(!J.sep)if(aW(J.start,"newline"))Object.assign(J,{key:null,sep:[this.sourceToken]});else{let G=Mq(J.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:G,key:null,sep:[this.sourceToken]}]})}else if(J.value)X.items.push({start:[],key:null,sep:[this.sourceToken]});else if(aW(J.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Y,key:null,sep:[this.sourceToken]}]});else if(cE0(J.key)&&!aW(J.sep,"newline")){let G=Mq(J.start),K=J.key,B=J.sep;B.push(this.sourceToken),delete J.key,delete J.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:G,key:K,sep:B}]})}else if(Y.length>0)J.sep=J.sep.concat(Y,this.sourceToken);else J.sep.push(this.sourceToken);else if(!J.sep)Object.assign(J,{key:null,sep:[this.sourceToken]});else if(J.value||Q)X.items.push({start:Y,key:null,sep:[this.sourceToken]});else if(aW(J.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else J.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let G=this.flowScalar(this.type);if(Q||J.value)X.items.push({start:Y,key:G,sep:[]}),this.onKeyLine=!0;else if(J.sep)this.stack.push(G);else Object.assign(J,{key:G,sep:[]}),this.onKeyLine=!0;return}default:{let G=this.startBlockValue(X);if(G){if(G.type==="block-seq"){if(!J.explicitKey&&J.sep&&!aW(J.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(Z)X.items.push({start:Y});this.stack.push(G);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(X){let J=X.items[X.items.length-1];switch(this.type){case"newline":if(J.value){let Z="end"in J.value?J.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else X.items.push({start:[this.sourceToken]})}else J.start.push(this.sourceToken);return;case"space":case"comment":if(J.value)X.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(J.start,X.indent)){let Q=X.items[X.items.length-2]?.value?.end;if(Array.isArray(Q)){dy(Q,J.start),Q.push(this.sourceToken),X.items.pop();return}}J.start.push(this.sourceToken)}return;case"anchor":case"tag":if(J.value||this.indent<=X.indent)break;J.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==X.indent)break;if(J.value||aW(J.start,"seq-item-ind"))X.items.push({start:[this.sourceToken]});else J.start.push(this.sourceToken);return}if(this.indent>X.indent){let Z=this.startBlockValue(X);if(Z){this.stack.push(Z);return}}yield*this.pop(),yield*this.step()}*flowCollection(X){let J=X.items[X.items.length-1];if(this.type==="flow-error-end"){let Z;do yield*this.pop(),Z=this.peek(1);while(Z?.type==="flow-collection")}else if(X.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!J||J.sep)X.items.push({start:[this.sourceToken]});else J.start.push(this.sourceToken);return;case"map-value-ind":if(!J||J.value)X.items.push({start:[],key:null,sep:[this.sourceToken]});else if(J.sep)J.sep.push(this.sourceToken);else Object.assign(J,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!J||J.value)X.items.push({start:[this.sourceToken]});else if(J.sep)J.sep.push(this.sourceToken);else J.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let Q=this.flowScalar(this.type);if(!J||J.value)X.items.push({start:[],key:Q,sep:[]});else if(J.sep)this.stack.push(Q);else Object.assign(J,{key:Q,sep:[]});return}case"flow-map-end":case"flow-seq-end":X.end.push(this.sourceToken);return}let Z=this.startBlockValue(X);if(Z)this.stack.push(Z);else yield*this.pop(),yield*this.step()}else{let Z=this.peek(2);if(Z.type==="block-map"&&(this.type==="map-value-ind"&&Z.indent===X.indent||this.type==="newline"&&!Z.items[Z.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&Z.type!=="flow-collection"){let Q=my(Z),Y=Mq(Q);uE0(X);let G=X.end.splice(1,X.end.length);G.push(this.sourceToken);let K={type:"block-map",offset:X.offset,indent:X.indent,items:[{start:Y,key:X,sep:G}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=K}else yield*this.lineEnd(X)}}flowScalar(X){if(this.onNewLine){let J=this.source.indexOf(`
145
+ `)+1;while(J!==0)this.onNewLine(this.offset+J),J=this.source.indexOf(`
146
+ `,J)+1}return{type:X,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(X){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let J=my(X),Z=Mq(J);return Z.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Z,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let J=my(X),Z=Mq(J);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Z,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(X,J){if(this.type!=="comment")return!1;if(this.indent<=J)return!1;return X.every((Z)=>Z.type==="newline"||Z.type==="space")}*documentEnd(X){if(this.type!=="doc-mode"){if(X.end)X.end.push(this.sourceToken);else X.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(X){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if(X.end)X.end.push(this.sourceToken);else X.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}zM8.Parser=fE0});var oE0=G8((AM8)=>{var pE0=s80(),OM8=hM(),pM=mM(),_M8=B80(),qM8=KX(),DM8=B90(),lE0=H90();function nE0(X){let J=X.prettyErrors!==!1;return{lineCounter:X.lineCounter||J&&new DM8.LineCounter||null,prettyErrors:J}}function wM8(X,J={}){let{lineCounter:Z,prettyErrors:Q}=nE0(J),Y=new lE0.Parser(Z?.addNewLine),G=new pE0.Composer(J),K=Array.from(G.compose(Y.parse(X)));if(Q&&Z)for(let B of K)B.errors.forEach(pM.prettifyError(X,Z)),B.warnings.forEach(pM.prettifyError(X,Z));if(K.length>0)return K;return Object.assign([],{empty:!0},G.streamInfo())}function iE0(X,J={}){let{lineCounter:Z,prettyErrors:Q}=nE0(J),Y=new lE0.Parser(Z?.addNewLine),G=new pE0.Composer(J),K=null;for(let B of G.compose(Y.parse(X),!0,X.length))if(!K)K=B;else if(K.options.logLevel!=="silent"){K.errors.push(new pM.YAMLParseError(B.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&Z)K.errors.forEach(pM.prettifyError(X,Z)),K.warnings.forEach(pM.prettifyError(X,Z));return K}function LM8(X,J,Z){let Q=void 0;if(typeof J==="function")Q=J;else if(Z===void 0&&J&&typeof J==="object")Z=J;let Y=iE0(X,Z);if(!Y)return null;if(Y.warnings.forEach((G)=>_M8.warn(Y.options.logLevel,G)),Y.errors.length>0)if(Y.options.logLevel!=="silent")throw Y.errors[0];else Y.errors=[];return Y.toJS(Object.assign({reviver:Q},Z))}function FM8(X,J,Z){let Q=null;if(typeof J==="function"||Array.isArray(J))Q=J;else if(Z===void 0&&J)Z=J;if(typeof Z==="string")Z=Z.length;if(typeof Z==="number"){let Y=Math.round(Z);Z=Y<1?void 0:Y>8?{indent:8}:{indent:Y}}if(X===void 0){let{keepUndefined:Y}=Z??J??{};if(!Y)return}if(qM8.isDocument(X)&&!Q)return X.toString(Z);return new OM8.Document(X,Q,Z).toString(Z)}AM8.parse=LM8;AM8.parseAllDocuments=wM8;AM8.parseDocument=iE0;AM8.stringify=FM8});var P6={};y8(P6,{wizard:()=>EI8,withSchema:()=>II8,withFallbackConfig:()=>jI8,withDescription:()=>CI8,withDefault:()=>RI8,validate:()=>PI8,text:()=>MI8,secret:()=>TI8,repeated:()=>FI8,redacted:()=>AI8,path:()=>LI8,optional:()=>DI8,none:()=>wI8,mapTryCatch:()=>qI8,mapEffect:()=>_I8,map:()=>OI8,isArgs:()=>oC8,integer:()=>NI8,getUsage:()=>zI8,getMinSize:()=>$I8,getMaxSize:()=>UI8,getIdentifier:()=>VI8,getHelp:()=>WI8,float:()=>HI8,fileText:()=>BI8,fileSchema:()=>KI8,fileParse:()=>GI8,fileContent:()=>YI8,file:()=>QI8,directory:()=>ZI8,date:()=>JI8,choice:()=>XI8,boolean:()=>eC8,between:()=>tC8,atMost:()=>sC8,atLeast:()=>aC8,all:()=>rC8,ArgsTypeId:()=>iC8});var H8={};y8(H8,{zipWith:()=>qw,zip:()=>Cj,window:()=>xa0,unzip:()=>Ec,unsafeGet:()=>oV,unprepend:()=>Va0,unionWith:()=>yY0,union:()=>nY,unfold:()=>vj,unappend:()=>$a0,takeWhile:()=>Oa0,takeRight:()=>Na0,take:()=>Ow,tailNonEmpty:()=>n6,tail:()=>Ua0,splitWhere:()=>Ea0,splitNonEmptyAt:()=>Ej,splitAt:()=>AN,split:()=>Ia0,span:()=>DB,sortWith:()=>Ma0,sortBy:()=>Pa0,sort:()=>NZ,some:()=>gc,setNonEmptyLast:()=>Ca0,setNonEmptyHead:()=>ja0,separate:()=>bc,scanRight:()=>Ha0,scan:()=>Ba0,rotate:()=>vY0,reverse:()=>_w,replicate:()=>Ya0,replaceOption:()=>Aa0,replace:()=>Fa0,removeOption:()=>Ta0,remove:()=>jj,reduceRight:()=>JY,reduce:()=>OJ,range:()=>Qa0,prependAll:()=>Ka0,prepend:()=>zZ,partitionMap:()=>TN,partition:()=>kc,pad:()=>Sa0,of:()=>X8,modifyOption:()=>EY0,modifyNonEmptyLast:()=>xY0,modifyNonEmptyHead:()=>SY0,modify:()=>Rj,min:()=>fa0,max:()=>pa0,matchRight:()=>Cc,matchLeft:()=>hJ,match:()=>l6,mapAccum:()=>dc,map:()=>n0,makeBy:()=>qB,make:()=>p6,liftPredicate:()=>ga0,liftOption:()=>ha0,liftNullable:()=>ma0,liftEither:()=>ua0,let:()=>sa0,length:()=>Wa0,lastNonEmpty:()=>rV,last:()=>zw,join:()=>s8,isNonEmptyReadonlyArray:()=>B8,isNonEmptyArray:()=>i5,isEmptyReadonlyArray:()=>G7,isEmptyArray:()=>jY0,isArray:()=>IK,intersperse:()=>Ra0,intersectionWith:()=>Sj,intersection:()=>Dw,insertAt:()=>La0,initNonEmpty:()=>Nw,init:()=>za0,headNonEmpty:()=>c9,head:()=>mJ,groupWith:()=>bY0,groupBy:()=>ka0,group:()=>va0,getSomes:()=>SK,getRights:()=>ya0,getOrder:()=>la0,getLefts:()=>ba0,getEquivalence:()=>dJ,get:()=>CY0,fromRecord:()=>Ga0,fromOption:()=>RY0,fromNullable:()=>yc,fromIterable:()=>v0,forEach:()=>na0,flatten:()=>aV,flatMapNullable:()=>da0,flatMap:()=>S6,findLastIndex:()=>Ic,findLast:()=>LN,findFirstWithIndex:()=>Da0,findFirstIndex:()=>wN,findFirst:()=>EK,filterMapWhile:()=>vc,filterMap:()=>LQ,filter:()=>xK,extend:()=>ca0,every:()=>ww,ensure:()=>m2,empty:()=>l0,dropWhile:()=>qa0,dropRight:()=>_a0,drop:()=>VG,differenceWith:()=>xj,difference:()=>xc,dedupeWith:()=>hc,dedupeAdjacentWith:()=>gY0,dedupeAdjacent:()=>mc,dedupe:()=>Lw,countBy:()=>wa0,copy:()=>d2,containsWith:()=>FN,contains:()=>pZ,chunksOf:()=>kY0,chop:()=>Sc,cartesianWith:()=>hY0,cartesian:()=>ia0,bindTo:()=>aa0,bind:()=>ra0,appendAll:()=>z8,append:()=>lX,allocate:()=>CK,Do:()=>oa0});var F8={};y8(F8,{zipWith:()=>GY0,void:()=>vo0,try:()=>y2,transposeOption:()=>ao0,transposeMapOption:()=>so0,right:()=>O0,orElse:()=>mo0,merge:()=>nV,match:()=>w9,mapLeft:()=>eQ,mapBoth:()=>Uc,map:()=>fY,liftPredicate:()=>zc,let:()=>ro0,left:()=>M0,isRight:()=>NJ,isLeft:()=>U9,isEither:()=>TK,getRight:()=>Vc,getOrUndefined:()=>ho0,getOrThrowWith:()=>Vw,getOrThrow:()=>wj,getOrNull:()=>go0,getOrElse:()=>Nc,getLeft:()=>bo0,getEquivalence:()=>$c,gen:()=>lo0,fromOption:()=>Ww,fromNullable:()=>ko0,flip:()=>fo0,flatMap:()=>$w,filterOrLeft:()=>yo0,bindTo:()=>oo0,bind:()=>io0,ap:()=>uo0,andThen:()=>do0,all:()=>co0,TypeId:()=>xo0,Do:()=>no0});var Jj=(X)=>typeof X==="function",$=function(X,J){if(typeof X==="function")return function(){if(X(arguments))return J.apply(this,arguments);return(Z)=>J(Z,...arguments)};switch(X){case 0:case 1:throw RangeError(`Invalid arity ${X}`);case 2:return function(Z,Q){if(arguments.length>=2)return J(Z,Q);return function(Y){return J(Y,Z)}};case 3:return function(Z,Q,Y){if(arguments.length>=3)return J(Z,Q,Y);return function(G){return J(G,Z,Q)}};case 4:return function(Z,Q,Y,G){if(arguments.length>=4)return J(Z,Q,Y,G);return function(K){return J(K,Z,Q,Y)}};case 5:return function(Z,Q,Y,G,K){if(arguments.length>=5)return J(Z,Q,Y,G,K);return function(B){return J(B,Z,Q,Y,G)}};default:return function(){if(arguments.length>=X)return J.apply(this,arguments);let Z=arguments;return function(Q){return J(Q,...Z)}}}};var t=(X)=>X;var YG=(X)=>()=>X,G6=YG(!0),C6=YG(!1),Zj=YG(null),KB=YG(void 0),O6=KB;function z(X,J,Z,Q,Y,G,K,B,H){switch(arguments.length){case 1:return X;case 2:return J(X);case 3:return Z(J(X));case 4:return Q(Z(J(X)));case 5:return Y(Q(Z(J(X))));case 6:return G(Y(Q(Z(J(X)))));case 7:return K(G(Y(Q(Z(J(X))))));case 8:return B(K(G(Y(Q(Z(J(X)))))));case 9:return H(B(K(G(Y(Q(Z(J(X))))))));default:{let W=arguments[0];for(let V=1;V<arguments.length;V++)W=arguments[V](W);return W}}}function x2(X,J,Z,Q,Y,G,K,B,H){switch(arguments.length){case 1:return X;case 2:return function(){return J(X.apply(this,arguments))};case 3:return function(){return Z(J(X.apply(this,arguments)))};case 4:return function(){return Q(Z(J(X.apply(this,arguments))))};case 5:return function(){return Y(Q(Z(J(X.apply(this,arguments)))))};case 6:return function(){return G(Y(Q(Z(J(X.apply(this,arguments))))))};case 7:return function(){return K(G(Y(Q(Z(J(X.apply(this,arguments)))))))};case 8:return function(){return B(K(G(Y(Q(Z(J(X.apply(this,arguments))))))))};case 9:return function(){return H(B(K(G(Y(Q(Z(J(X.apply(this,arguments)))))))))}}return}var I6=(X)=>(J,Z)=>J===Z||X(J,Z),Ho0=(X,J)=>X===J,SQ0=()=>Ho0,xQ0=SQ0(),Wo0=SQ0();var tu=$(2,(X,J)=>I6((Z,Q)=>X(J(Z),J(Q)))),vQ0=tu(Wo0,(X)=>X.getTime());var kQ0=(X)=>I6((J,Z)=>{if(J.length!==Z.length)return!1;for(let Q=0;Q<J.length;Q++)if(!X(J[Q],Z[Q]))return!1;return!0});var _K=(X)=>$(3,(J,Z,Q)=>X(J,(Y)=>({...Y,[Z]:Q(Y)}))),qK=(X)=>$(2,(J,Z)=>X(J,(Q)=>({[Z]:Q}))),k2=(X,J)=>$(3,(Z,Q,Y)=>J(Z,(G)=>X(Y(G),(K)=>({...G,[Q]:K}))));var Zw,c0=(X,J)=>{if(!Zw)globalThis["effect/GlobalValue"]??=new Map,Zw=globalThis["effect/GlobalValue"];if(!Zw.has(X))Zw.set(X,J());return Zw.get(X)};var bQ0=(X)=>!!X,yQ0=(X)=>X instanceof Set,gQ0=(X)=>X instanceof Map,n9=(X)=>typeof X==="string",e7=(X)=>typeof X==="number",yJ=(X)=>typeof X==="boolean",DK=(X)=>typeof X==="bigint",f5=(X)=>typeof X==="symbol";var dY=Jj,gV=(X)=>X===void 0,Qj=(X)=>X!==void 0,hQ0=(X)=>X===null,Yj=(X)=>X!==null,mQ0=(X)=>!1;var KN=(X)=>typeof X==="object"&&X!==null,c6=(X)=>KN(X)||dY(X),V0=$(2,(X,J)=>c6(X)&&(J in X)),p5=$(2,(X,J)=>V0(X,"_tag")&&X._tag===J),hV=(X)=>X===null||X===void 0,dQ0=(X)=>X!==null&&X!==void 0;var uQ0=(X)=>X instanceof Uint8Array,BN=(X)=>X instanceof Date,oQ=(X)=>typeof X==="string"||V0(X,Symbol.iterator),l5=(X)=>KN(X)&&!Array.isArray(X);var eu=(X)=>V0(X,"then")&&dY(X.then);var cQ0=$(2,(X,J)=>(Z)=>X(Z)||J(Z));var mV=(X)=>`BUG: ${X} - please report an issue at https://github.com/Effect-TS/effect/issues`;var Xc=Symbol.for("effect/Gen/GenKind"),Gj=(X)=>c6(X)&&(Xc in X);class pQ0{value;constructor(X){this.value=X}get _F(){return t}get _R(){return(X)=>X}get _O(){return(X)=>X}get _E(){return(X)=>X}[Xc]=Xc;[Symbol.iterator](){return new dV(this)}}class dV{self;called=!1;constructor(X){this.self=X}next(X){return this.called?{value:X,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(X){return{value:X,done:!0}}throw(X){throw X}[Symbol.iterator](){return new dV(this.self)}}var Kj=()=>function(){let X=arguments[0];for(let J=1;J<arguments.length;J++)X=arguments[J](X);return new pQ0(X)},Vo0=335903614,$o0=4150755663,Uo0=1481765933,zo0=1284865837,No0=9007199254740992,Oo0=134217728;class Zc{_state;constructor(X,J,Z,Q){if(hV(J)&&hV(X))J=Math.random()*4294967295>>>0,X=0;else if(hV(J))J=X,X=0;if(hV(Q)&&hV(Z))Q=this._state?this._state[3]:$o0,Z=this._state?this._state[2]:Vo0;else if(hV(Q))Q=Z,Z=0;return this._state=new Int32Array([0,0,Z>>>0,((Q||0)|1)>>>0]),this._next(),fQ0(this._state,this._state[0],this._state[1],X>>>0,J>>>0),this._next(),this}getState(){return[this._state[0],this._state[1],this._state[2],this._state[3]]}setState(X){this._state[0]=X[0],this._state[1]=X[1],this._state[2]=X[2],this._state[3]=X[3]|1}integer(X){return Math.round(this.number()*Number.MAX_SAFE_INTEGER)%X}number(){let X=(this._next()&67108863)*1,J=(this._next()&134217727)*1;return(X*Oo0+J)/No0}_next(){let X=this._state[0]>>>0,J=this._state[1]>>>0;_o0(this._state,X,J,Uo0,zo0),fQ0(this._state,this._state[0],this._state[1],this._state[2],this._state[3]);let Z=X>>>18,Q=(J>>>18|X<<14)>>>0;Z=(Z^X)>>>0,Q=(Q^J)>>>0;let Y=(Q>>>27|Z<<5)>>>0,G=X>>>27,K=(-G>>>0&31)>>>0;return(Y>>>G|Y<<K)>>>0}}function _o0(X,J,Z,Q,Y){let G=(Z>>>16)*(Y&65535)>>>0,K=(Z&65535)*(Y>>>16)>>>0,B=(Z&65535)*(Y&65535)>>>0,H=(Z>>>16)*(Y>>>16)+((K>>>16)+(G>>>16))>>>0;if(K=K<<16>>>0,B=B+K>>>0,B>>>0<K>>>0)H=H+1>>>0;if(G=G<<16>>>0,B=B+G>>>0,B>>>0<G>>>0)H=H+1>>>0;H=H+Math.imul(Z,Q)>>>0,H=H+Math.imul(J,Y)>>>0,X[0]=H,X[1]=B}function fQ0(X,J,Z,Q,Y){let G=J+Q>>>0,K=Z+Y>>>0;if(K>>>0<Z>>>0)G=G+1|0;X[0]=G,X[1]=K}var Jc=Symbol.for("effect/Utils/YieldWrap");class GG{#J;constructor(X){this.#J=X}[Jc](){return this.#J}}function uV(X){if(typeof X==="object"&&X!==null&&Jc in X)return X[Jc]();throw Error(mV("yieldWrapGet"))}var rQ=c0("effect/Utils/isStructuralRegion",()=>({enabled:!1,tester:void 0}));var lQ0={effect_internal_function:(X)=>{return X()}},qo0={effect_internal_function:(X)=>{try{return X()}finally{}}},Do0=lQ0.effect_internal_function(()=>Error().stack)?.includes("effect_internal_function")===!0,JX=Do0?lQ0.effect_internal_function:qo0.effect_internal_function,wo0=function*(){}.constructor,nQ0=(X)=>c6(X)&&X.constructor===wo0;var Yc=c0(Symbol.for("effect/Hash/randomHashCache"),()=>new WeakMap),y0=Symbol.for("effect/Hash"),Z0=(X)=>{if(rQ.enabled===!0)return 0;switch(typeof X){case"number":return BB(X);case"bigint":return R8(X.toString(10));case"boolean":return R8(String(X));case"symbol":return R8(String(X));case"string":return R8(X);case"undefined":return R8("undefined");case"function":case"object":if(X===null)return R8("null");else if(X instanceof Date){if(Number.isNaN(X.getTime()))return R8("Invalid Date");return Z0(X.toISOString())}else if(X instanceof URL)return Z0(X.href);else if(Lo0(X))return X[y0]();else return cV(X);default:throw Error(`BUG: unhandled typeof ${typeof X} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},cV=(X)=>{if(!Yc.has(X))Yc.set(X,BB(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)));return Yc.get(X)},A0=(X)=>(J)=>J*53^X,Bj=(X)=>X&3221225471|X>>>1&1073741824,Lo0=(X)=>V0(X,y0),BB=(X)=>{if(X!==X||X===1/0)return 0;let J=X|0;if(J!==X)J^=X*4294967295;while(X>4294967295)J^=X/=4294967295;return Bj(J)},R8=(X)=>{let J=5381,Z=X.length;while(Z)J=J*33^X.charCodeAt(--Z);return Bj(J)},Fo0=(X,J)=>{let Z=12289;for(let Q=0;Q<J.length;Q++)Z^=z(R8(J[Q]),A0(Z0(X[J[Q]])));return Bj(Z)},Hj=(X)=>Fo0(X,Object.keys(X)),uY=(X)=>{let J=6151;for(let Z=0;Z<X.length;Z++)J=z(J,A0(Z0(X[Z])));return Bj(J)},W8=function(){if(arguments.length===1){let Z=arguments[0];return function(Q){return Object.defineProperty(Z,y0,{value(){return Q},enumerable:!1}),Q}}let X=arguments[0],J=arguments[1];return Object.defineProperty(X,y0,{value(){return J},enumerable:!1}),J};var b0=Symbol.for("effect/Equal");function _0(){if(arguments.length===1)return(X)=>Wj(X,arguments[0]);return Wj(arguments[0],arguments[1])}function Wj(X,J){if(X===J)return!0;let Z=typeof X;if(Z!==typeof J)return!1;if(Z==="object"||Z==="function"){if(X!==null&&J!==null){if(b2(X)&&b2(J))if(Z0(X)===Z0(J)&&X[b0](J))return!0;else return rQ.enabled&&rQ.tester?rQ.tester(X,J):!1;else if(X instanceof Date&&J instanceof Date){let Q=X.getTime(),Y=J.getTime();return Q===Y||Number.isNaN(Q)&&Number.isNaN(Y)}else if(X instanceof URL&&J instanceof URL)return X.href===J.href}if(rQ.enabled){if(X===null||J===null)return!1;if(Array.isArray(X)&&Array.isArray(J))return X.length===J.length&&X.every((Q,Y)=>Wj(Q,J[Y]));if(Object.getPrototypeOf(X)===Object.prototype&&Object.getPrototypeOf(J)===Object.prototype){let Q=Object.keys(X),Y=Object.keys(J);if(Q.length===Y.length){for(let G of Q)if(!((G in J)&&Wj(X[G],J[G])))return rQ.tester?rQ.tester(X,J):!1;return!0}}return rQ.tester?rQ.tester(X,J):!1}}return rQ.enabled&&rQ.tester?rQ.tester(X,J):!1}var b2=(X)=>V0(X,b0),HB=()=>_0;var T9={};y8(T9,{withRedactableContext:()=>Bc,toStringUnknown:()=>sQ,toJSON:()=>H9,symbolRedactable:()=>WN,stringifyCircular:()=>HN,redact:()=>cY,isRedactable:()=>Kc,formatUnknown:()=>E6,formatPropertyKey:()=>wK,formatDate:()=>cZ,format:()=>u8,NodeInspectSymbol:()=>$8,Class:()=>LK,BaseProto:()=>aQ});var $8=Symbol.for("nodejs.util.inspect.custom"),H9=(X)=>{try{if(V0(X,"toJSON")&&dY(X.toJSON)&&X.toJSON.length===0)return X.toJSON();else if(Array.isArray(X))return X.map(H9)}catch{return{}}return cY(X)},Gc="[Circular]";function cZ(X){try{return X.toISOString()}catch{return"Invalid Date"}}function Ao0(X){try{let J=X.toString();return typeof J==="string"?J:String(J)}catch{return"[toString threw]"}}function wK(X){return n9(X)?JSON.stringify(X):String(X)}function E6(X,J){let Z=J?.space??0,Q=new WeakSet,Y=!Z?"":e7(Z)?" ".repeat(Z):Z,G=(W)=>Y.repeat(W),K=(W,V)=>{let U=W?.constructor;return U&&U!==Object.prototype.constructor&&U.name?`${U.name}(${V})`:V},B=(W)=>{try{return Reflect.ownKeys(W)}catch{return["[ownKeys threw]"]}};function H(W,V=0){if(Array.isArray(W)){if(Q.has(W))return Gc;if(Q.add(W),!Y||W.length<=1)return`[${W.map((O)=>H(O,V)).join(",")}]`;let U=W.map((O)=>H(O,V+1)).join(`,
147
+ `+G(V+1));return`[
148
+ ${G(V+1)}${U}
149
+ ${G(V)}]`}if(BN(W))return cZ(W);if(!J?.ignoreToString&&V0(W,"toString")&&dY(W.toString)&&W.toString!==Object.prototype.toString&&W.toString!==Array.prototype.toString){let U=Ao0(W);if(W instanceof Error&&W.cause)return`${U} (cause: ${H(W.cause,V)})`;return U}if(n9(W))return JSON.stringify(W);if(e7(W)||W==null||yJ(W)||f5(W))return String(W);if(DK(W))return String(W)+"n";if(W instanceof Set||W instanceof Map){if(Q.has(W))return Gc;return Q.add(W),`${W.constructor.name}(${H(Array.from(W),V)})`}if(c6(W)){if(Q.has(W))return Gc;Q.add(W);let U=B(W);if(!Y||U.length<=1){let q=`{${U.map((L)=>`${wK(L)}:${H(W[L],V)}`).join(",")}}`;return K(W,q)}let O=`{
150
+ ${U.map((q)=>`${G(V+1)}${wK(q)}: ${H(W[q],V+1)}`).join(`,
151
+ `)}
152
+ ${G(V)}}`;return K(W,O)}return String(W)}return H(X,0)}var u8=(X)=>JSON.stringify(X,null,2),aQ={toJSON(){return H9(this)},[$8](){return this.toJSON()},toString(){return u8(this.toJSON())}};class LK{[$8](){return this.toJSON()}toString(){return u8(this.toJSON())}}var sQ=(X,J=2)=>{if(typeof X==="string")return X;try{return typeof X==="object"?HN(X,J):String(X)}catch{return String(X)}},HN=(X,J)=>{let Z=[],Q=JSON.stringify(X,(Y,G)=>typeof G==="object"&&G!==null?Z.includes(G)?void 0:Z.push(G)&&(fV.fiberRefs!==void 0&&Kc(G)?G[WN](fV.fiberRefs):G):G,J);return Z=void 0,Q},WN=Symbol.for("effect/Inspectable/Redactable"),Kc=(X)=>typeof X==="object"&&X!==null&&(WN in X),fV=c0("effect/Inspectable/redactableState",()=>({fiberRefs:void 0})),Bc=(X,J)=>{let Z=fV.fiberRefs;fV.fiberRefs=X;try{return J()}finally{fV.fiberRefs=Z}},cY=(X)=>{if(Kc(X)&&fV.fiberRefs!==void 0)return X[WN](fV.fiberRefs);return X};var K0=(X,J)=>{switch(J.length){case 0:return X;case 1:return J[0](X);case 2:return J[1](J[0](X));case 3:return J[2](J[1](J[0](X)));case 4:return J[3](J[2](J[1](J[0](X))));case 5:return J[4](J[3](J[2](J[1](J[0](X)))));case 6:return J[5](J[4](J[3](J[2](J[1](J[0](X))))));case 7:return J[6](J[5](J[4](J[3](J[2](J[1](J[0](X)))))));case 8:return J[7](J[6](J[5](J[4](J[3](J[2](J[1](J[0](X))))))));case 9:return J[8](J[7](J[6](J[5](J[4](J[3](J[2](J[1](J[0](X)))))))));default:{let Z=X;for(let Q=0,Y=J.length;Q<Y;Q++)Z=J[Q](Z);return Z}}};var pV="Async",WB="Commit",DX="Failure",VN="OnFailure",$N="OnSuccess",UN="OnSuccessAndFailure",wX="Success",Vj="Sync",iQ0="Tag",VB="UpdateRuntimeFlags",zN="While",lV="Iterator",$j="WithRuntime",NN="Yield",Qw="RevertFlags";var Mo0="3.21.2",Gw=()=>Mo0;var rQ0=Symbol.for("effect/Effect"),Kw=Symbol.for("effect/Stream"),aQ0=Symbol.for("effect/Sink"),sQ0=Symbol.for("effect/Channel"),FK={_R:(X)=>X,_E:(X)=>X,_A:(X)=>X,_V:Gw()},Po0={_A:(X)=>X,_In:(X)=>X,_L:(X)=>X,_E:(X)=>X,_R:(X)=>X},Ro0={_Env:(X)=>X,_InErr:(X)=>X,_InElem:(X)=>X,_InDone:(X)=>X,_OutErr:(X)=>X,_OutElem:(X)=>X,_OutDone:(X)=>X},$B={[rQ0]:FK,[Kw]:FK,[aQ0]:Po0,[sQ0]:Ro0,[b0](X){return this===X},[y0](){return W8(this,cV(this))},[Symbol.iterator](){return new dV(new GG(this))},pipe(){return K0(this,arguments)}},AK={[y0](){return W8(this,Hj(this))},[b0](X){let J=Object.keys(this),Z=Object.keys(X);if(J.length!==Z.length)return!1;for(let Q of J)if(!((Q in X)&&_0(this[Q],X[Q])))return!1;return!0}},KG={...$B,_op:WB},Uj={...KG,...AK},tQ0=function(){function X(){}return X.prototype=KG,X}(),eQ0=function(){function X(){}return X.prototype=Uj,X}();var XY0=Symbol.for("effect/Option"),JY0={...$B,[XY0]:{_A:(X)=>X},[$8](){return this.toJSON()},toString(){return u8(this.toJSON())}},jo0=Object.assign(Object.create(JY0),{_tag:"Some",_op:"Some",[b0](X){return zj(X)&&Wc(X)&&_0(this.value,X.value)},[y0](){return W8(this,A0(Z0(this._tag))(Z0(this.value)))},toJSON(){return{_id:"Option",_tag:this._tag,value:H9(this.value)}}}),Co0=Z0("None"),Io0=Object.assign(Object.create(JY0),{_tag:"None",_op:"None",[b0](X){return zj(X)&&BG(X)},[y0](){return Co0},toJSON(){return{_id:"Option",_tag:this._tag}}}),zj=(X)=>V0(X,XY0),BG=(X)=>X._tag==="None",Wc=(X)=>X._tag==="Some",tQ=Object.create(Io0),XJ=(X)=>{let J=Object.create(jo0);return J.value=X,J};var Nj=Symbol.for("effect/Either"),ZY0={...$B,[Nj]:{_R:(X)=>X},[$8](){return this.toJSON()},toString(){return u8(this.toJSON())}},Eo0=Object.assign(Object.create(ZY0),{_tag:"Right",_op:"Right",[b0](X){return Oj(X)&&_j(X)&&_0(this.right,X.right)},[y0](){return A0(Z0(this._tag))(Z0(this.right))},toJSON(){return{_id:"Either",_tag:this._tag,right:H9(this.right)}}}),So0=Object.assign(Object.create(ZY0),{_tag:"Left",_op:"Left",[b0](X){return Oj(X)&&_N(X)&&_0(this.left,X.left)},[y0](){return A0(Z0(this._tag))(Z0(this.left))},toJSON(){return{_id:"Either",_tag:this._tag,left:H9(this.left)}}}),Oj=(X)=>V0(X,Nj),_N=(X)=>X._tag==="Left",_j=(X)=>X._tag==="Right",Bw=(X)=>{let J=Object.create(So0);return J.left=X,J},Hw=(X)=>{let J=Object.create(Eo0);return J.right=X,J},qj=(X)=>_j(X)?tQ:XJ(X.left),Dj=(X)=>_N(X)?tQ:XJ(X.right),QY0=$(2,(X,J)=>BG(X)?Bw(J()):Hw(X.value));var xo0=Nj,O0=Hw,vo0=O0(void 0);var M0=Bw,ko0=$(2,(X,J)=>X==null?M0(J(X)):O0(X)),Ww=QY0,y2=(X)=>{if(dY(X))try{return O0(X())}catch(J){return M0(J)}else try{return O0(X.try())}catch(J){return M0(X.catch(J))}};var TK=Oj,U9=_N,NJ=_j,Vc=Dj,bo0=qj,$c=({left:X,right:J})=>I6((Z,Q)=>U9(Z)?U9(Q)&&X(Z.left,Q.left):NJ(Q)&&J(Z.right,Q.right)),Uc=$(2,(X,{onLeft:J,onRight:Z})=>U9(X)?M0(J(X.left)):O0(Z(X.right))),eQ=$(2,(X,J)=>U9(X)?M0(J(X.left)):O0(X.right)),fY=$(2,(X,J)=>NJ(X)?O0(J(X.right)):M0(X.left)),w9=$(2,(X,{onLeft:J,onRight:Z})=>U9(X)?J(X.left):Z(X.right)),zc=$(3,(X,J,Z)=>J(X)?O0(X):M0(Z(X))),yo0=$(3,(X,J,Z)=>$w(X,(Q)=>J(Q)?O0(Q):M0(Z(Q)))),nV=w9({onLeft:t,onRight:t}),Nc=$(2,(X,J)=>U9(X)?J(X.left):X.right),go0=Nc(Zj),ho0=Nc(KB),Vw=$(2,(X,J)=>{if(NJ(X))return X.right;throw J(X.left)}),wj=Vw(()=>Error("getOrThrow called on a Left")),mo0=$(2,(X,J)=>U9(X)?J(X.left):O0(X.right)),$w=$(2,(X,J)=>U9(X)?M0(X.left):J(X.right)),do0=$(2,(X,J)=>$w(X,(Z)=>{let Q=dY(J)?J(Z):J;return TK(Q)?Q:O0(Q)})),GY0=$(3,(X,J,Z)=>$w(X,(Q)=>fY(J,(Y)=>Z(Q,Y)))),uo0=$(2,(X,J)=>GY0(X,J,(Z,Q)=>Z(Q))),co0=(X)=>{if(Symbol.iterator in X){let Z=[];for(let Q of X){if(U9(Q))return Q;Z.push(Q.right)}return O0(Z)}let J={};for(let Z of Object.keys(X)){let Q=X[Z];if(U9(Q))return Q;J[Z]=Q.right}return O0(J)},fo0=(X)=>U9(X)?O0(X.left):M0(X.right),po0=Kj(),lo0=(...X)=>{let Z=(X.length===1?X[0]:X[1].bind(X[0]))(po0),Q=Z.next();while(!Q.done){let Y=Gj(Q.value)?Q.value.value:uV(Q.value);if(U9(Y))return Y;Q=Z.next(Y.right)}return O0(Q.value)},no0=O0({}),io0=k2(fY,$w),oo0=qK(fY),ro0=_K(fY);var ao0=(X)=>{return BG(X)?O0(tQ):fY(X.value,XJ)},so0=$(2,(X,J)=>BG(X)?O0(tQ):fY(J(X.value),XJ));var qN=(X)=>X.length>0;var m={};y8(m,{zipWith:()=>Dc,zipRight:()=>$r0,zipLeft:()=>Ur0,void:()=>Hr0,toRefinement:()=>Jr0,toArray:()=>wc,tap:()=>VY0,some:()=>I,reduceCompact:()=>_r0,productMany:()=>Nr0,product:()=>$Y0,partitionMap:()=>qr0,orElseSome:()=>_c,orElseEither:()=>Yr0,orElse:()=>JJ,none:()=>S,mergeWith:()=>jK,match:()=>w0,map:()=>r8,liftThrowable:()=>_B,liftPredicate:()=>Lr0,liftNullable:()=>Kr0,lift2:()=>wr0,let:()=>Tr0,isSome:()=>R0,isOption:()=>OB,isNone:()=>j8,getRight:()=>Fj,getOrder:()=>Dr0,getOrUndefined:()=>u9,getOrThrowWith:()=>Tj,getOrThrow:()=>lY,getOrNull:()=>Aj,getOrElse:()=>i0,getLeft:()=>Qr0,getEquivalence:()=>Lc,gen:()=>jr0,fromNullable:()=>x8,fromIterable:()=>Zr0,flatten:()=>Vr0,flatMapNullable:()=>qc,flatMap:()=>pX,firstSomeOf:()=>Gr0,filterMap:()=>zY0,filter:()=>gJ,exists:()=>Ac,containsWith:()=>NY0,contains:()=>Fc,composeK:()=>zr0,bindTo:()=>Ar0,bind:()=>Mr0,asVoid:()=>Br0,as:()=>WY0,ap:()=>Or0,andThen:()=>Wr0,all:()=>UY0,TypeId:()=>Xr0,Do:()=>Pr0});var fZ=(X)=>(J,Z)=>J===Z?0:X(J,Z),Lj=fZ((X,J)=>X<J?-1:1),Uw=fZ((X,J)=>X<J?-1:1),Oc=fZ((X,J)=>X<J?-1:1),DN=fZ((X,J)=>X<J?-1:1);var to0=$(2,(X,J)=>fZ((Z,Q)=>{let Y=X(Z,Q);if(Y!==0)return Y;for(let G of J)if(Y=G(Z,Q),Y!==0)return Y;return Y})),eo0=()=>fZ(()=>0),BY0=(X)=>to0(eo0(),X),HG=$(2,(X,J)=>fZ((Z,Q)=>X(J(Z),J(Q))));var HY0=(X)=>fZ((J,Z)=>{let Q=J.length,Y=Z.length,G=Math.min(Q,Y);for(let K=0;K<G;K++){let B=X(J[K],Z[K]);if(B!==0)return B}return Uw(Q,Y)});var UB=(X)=>$(2,(J,Z)=>X(J,Z)===-1),zB=(X)=>$(2,(J,Z)=>X(J,Z)===1),g2=(X)=>$(2,(J,Z)=>X(J,Z)!==1),NB=(X)=>$(2,(J,Z)=>X(J,Z)!==-1),MK=(X)=>$(2,(J,Z)=>J===Z||X(J,Z)<1?J:Z),PK=(X)=>$(2,(J,Z)=>J===Z||X(J,Z)>-1?J:Z),RK=(X)=>$(2,(J,Z)=>MK(X)(Z.maximum,PK(X)(Z.minimum,J))),h2=(X)=>$(2,(J,Z)=>!UB(X)(J,Z.minimum)&&!zB(X)(J,Z.maximum));var Xr0=Symbol.for("effect/Option"),S=()=>tQ,I=XJ,OB=zj,j8=BG,R0=Wc,w0=$(2,(X,{onNone:J,onSome:Z})=>j8(X)?J():Z(X.value)),Jr0=(X)=>(J)=>R0(X(J)),Zr0=(X)=>{for(let J of X)return I(J);return S()},Fj=Dj,Qr0=qj,i0=$(2,(X,J)=>j8(X)?J():X.value),JJ=$(2,(X,J)=>j8(X)?J():X),_c=$(2,(X,J)=>j8(X)?I(J()):X),Yr0=$(2,(X,J)=>j8(X)?r8(J(),Hw):r8(X,Bw)),Gr0=(X)=>{let J=S();for(J of X)if(R0(J))return J;return J},x8=(X)=>X==null?S():I(X),Kr0=(X)=>(...J)=>x8(X(...J)),Aj=i0(Zj),u9=i0(KB),_B=(X)=>(...J)=>{try{return I(X(...J))}catch{return S()}},Tj=$(2,(X,J)=>{if(R0(X))return X.value;throw J()}),lY=Tj(()=>Error("getOrThrow called on a None")),r8=$(2,(X,J)=>j8(X)?S():I(J(X.value))),WY0=$(2,(X,J)=>r8(X,()=>J)),Br0=WY0(void 0),Hr0=I(void 0);var pX=$(2,(X,J)=>j8(X)?S():J(X.value)),Wr0=$(2,(X,J)=>pX(X,(Z)=>{let Q=Jj(J)?J(Z):J;return OB(Q)?Q:I(Q)})),qc=$(2,(X,J)=>j8(X)?S():x8(J(X.value))),Vr0=pX(t),$r0=$(2,(X,J)=>pX(X,()=>J)),Ur0=$(2,(X,J)=>VY0(X,()=>J)),zr0=$(2,(X,J)=>(Z)=>pX(X(Z),J)),VY0=$(2,(X,J)=>pX(X,(Z)=>r8(J(Z),()=>Z))),$Y0=(X,J)=>R0(X)&&R0(J)?I([X.value,J.value]):S(),Nr0=(X,J)=>{if(j8(X))return S();let Z=[X.value];for(let Q of J){if(j8(Q))return S();Z.push(Q.value)}return I(Z)},UY0=(X)=>{if(Symbol.iterator in X){let Z=[];for(let Q of X){if(j8(Q))return S();Z.push(Q.value)}return I(Z)}let J={};for(let Z of Object.keys(X)){let Q=X[Z];if(j8(Q))return S();J[Z]=Q.value}return I(J)},Dc=$(3,(X,J,Z)=>r8($Y0(X,J),([Q,Y])=>Z(Q,Y))),Or0=$(2,(X,J)=>Dc(X,J,(Z,Q)=>Z(Q))),_r0=$(3,(X,J,Z)=>{let Q=J;for(let Y of X)if(R0(Y))Q=Z(Q,Y.value);return Q}),wc=(X)=>j8(X)?[]:[X.value],qr0=$(2,(X,J)=>{if(j8(X))return[S(),S()];let Z=J(X.value);return _N(Z)?[I(Z.left),S()]:[S(),I(Z.right)]}),zY0=pX,gJ=$(2,(X,J)=>zY0(X,(Z)=>J(Z)?XJ(Z):tQ)),Lc=(X)=>I6((J,Z)=>j8(J)?j8(Z):j8(Z)?!1:X(J.value,Z.value)),Dr0=(X)=>fZ((J,Z)=>R0(J)?R0(Z)?X(J.value,Z.value):1:-1),wr0=(X)=>$(2,(J,Z)=>Dc(J,Z,X)),Lr0=$(2,(X,J)=>J(X)?I(X):S()),NY0=(X)=>$(2,(J,Z)=>j8(J)?!1:X(J.value,Z)),Fr0=HB(),Fc=NY0(Fr0),Ac=$(2,(X,J)=>j8(X)?!1:J(X.value)),Ar0=qK(r8),Tr0=_K(r8);var Mr0=k2(r8,pX),Pr0=I({}),Rr0=Kj(),jr0=(...X)=>{let Z=(X.length===1?X[0]:X[1].bind(X[0]))(Rr0),Q=Z.next();while(!Q.done){let Y=Gj(Q.value)?Q.value.value:uV(Q.value);if(j8(Y))return Y;Q=Z.next(Y.value)}return I(Q.value)},jK=(X)=>(J,Z)=>{if(j8(J))return Z;else if(j8(Z))return J;return I(X(J.value,Z.value))};var Mj=(...X)=>X;var _Y0=(X)=>{let Z=X[Symbol.iterator]().next();if(Z.done)throw Error("unsafeHead: empty iterable");return Z.value};var qY0=$(2,(X,J)=>{let Z=0;for(let Q of X){let Y=J(Q,Z);if(yJ(Y)){if(Y)return I(Q)}else if(R0(Y))return Y;Z++}return S()});var Cr0={[Symbol.iterator](){return Ir0}},Ir0={next(){return{done:!0,value:void 0}}},DY0=()=>Cr0;var XY={};y8(XY,{values:()=>lr0,union:()=>sr0,toEntries:()=>Mc,some:()=>ar0,size:()=>vr0,singleton:()=>Ja0,set:()=>PY0,separate:()=>fr0,replaceOption:()=>br0,replace:()=>nr0,remove:()=>Pc,reduce:()=>or0,pop:()=>yr0,partitionMap:()=>MY0,partition:()=>pr0,modifyOption:()=>AY0,modify:()=>kr0,mapKeys:()=>gr0,mapEntries:()=>hr0,map:()=>Rc,keys:()=>Y7,isSubrecordBy:()=>jc,isSubrecord:()=>ir0,isEmptyRecord:()=>WG,isEmptyReadonlyRecord:()=>Er0,intersection:()=>tr0,has:()=>wQ,getSomes:()=>dr0,getRights:()=>cr0,getLefts:()=>ur0,getEquivalence:()=>Xa0,get:()=>FY0,fromIterableWith:()=>LY0,fromIterableBy:()=>Sr0,fromEntries:()=>xr0,findFirst:()=>Za0,filterMap:()=>TY0,filter:()=>mr0,every:()=>rr0,empty:()=>n5,difference:()=>er0,collect:()=>Tc});var n5=()=>({}),WG=(X)=>Y7(X).length===0,Er0=WG,LY0=$(2,(X,J)=>{let Z=n5();for(let Q of X){let[Y,G]=J(Q);Z[Y]=G}return Z}),Sr0=(X,J)=>LY0(X,(Z)=>[J(Z),Z]),xr0=Object.fromEntries,Tc=$(2,(X,J)=>{let Z=[];for(let Q of Y7(X))Z.push(J(Q,X[Q]));return Z}),Mc=Tc((X,J)=>[X,J]),vr0=(X)=>Y7(X).length,wQ=$(2,(X,J)=>Object.prototype.hasOwnProperty.call(X,J)),FY0=$(2,(X,J)=>wQ(X,J)?I(X[J]):S()),kr0=$(3,(X,J,Z)=>{if(!wQ(X,J))return{...X};return{...X,[J]:Z(X[J])}}),AY0=$(3,(X,J,Z)=>{if(!wQ(X,J))return S();return I({...X,[J]:Z(X[J])})}),br0=$(3,(X,J,Z)=>AY0(X,J,()=>Z)),Pc=$(2,(X,J)=>{if(!wQ(X,J))return{...X};let Z={...X};return delete Z[J],Z}),yr0=$(2,(X,J)=>wQ(X,J)?I([X[J],Pc(X,J)]):S()),Rc=$(2,(X,J)=>{let Z={...X};for(let Q of Y7(X))Z[Q]=J(X[Q],Q);return Z}),gr0=$(2,(X,J)=>{let Z={};for(let Q of Y7(X)){let Y=X[Q];Z[J(Q,Y)]=Y}return Z}),hr0=$(2,(X,J)=>{let Z={};for(let Q of Y7(X)){let[Y,G]=J(X[Q],Q);Z[Y]=G}return Z}),TY0=$(2,(X,J)=>{let Z=n5();for(let Q of Y7(X)){let Y=J(X[Q],Q);if(R0(Y))Z[Q]=Y.value}return Z}),mr0=$(2,(X,J)=>{let Z=n5();for(let Q of Y7(X))if(J(X[Q],Q))Z[Q]=X[Q];return Z}),dr0=TY0(t),ur0=(X)=>{let J=n5();for(let Z of Y7(X)){let Q=X[Z];if(U9(Q))J[Z]=Q.left}return J},cr0=(X)=>{let J=n5();for(let Z of Y7(X)){let Q=X[Z];if(NJ(Q))J[Z]=Q.right}return J},MY0=$(2,(X,J)=>{let Z=n5(),Q=n5();for(let Y of Y7(X)){let G=J(X[Y],Y);if(U9(G))Z[Y]=G.left;else Q[Y]=G.right}return[Z,Q]}),fr0=MY0(t),pr0=$(2,(X,J)=>{let Z=n5(),Q=n5();for(let Y of Y7(X))if(J(X[Y],Y))Q[Y]=X[Y];else Z[Y]=X[Y];return[Z,Q]}),Y7=(X)=>Object.keys(X),lr0=(X)=>Tc(X,(J,Z)=>Z),PY0=$(3,(X,J,Z)=>{return{...X,[J]:Z}}),nr0=$(3,(X,J,Z)=>{if(wQ(X,J))return{...X,[J]:Z};return{...X}}),jc=(X)=>$(2,(J,Z)=>{for(let Q of Y7(J))if(!wQ(Z,Q)||!X(J[Q],Z[Q]))return!1;return!0}),ir0=jc(HB()),or0=$(3,(X,J,Z)=>{let Q=J;for(let Y of Y7(X))Q=Z(Q,X[Y],Y);return Q}),rr0=$(2,(X,J)=>{for(let Z of Y7(X))if(!J(X[Z],Z))return!1;return!0}),ar0=$(2,(X,J)=>{for(let Z of Y7(X))if(J(X[Z],Z))return!0;return!1}),sr0=$(3,(X,J,Z)=>{if(WG(X))return{...J};if(WG(J))return{...X};let Q=n5();for(let Y of Y7(X))if(wQ(J,Y))Q[Y]=Z(X[Y],J[Y]);else Q[Y]=X[Y];for(let Y of Y7(J))if(!wQ(Q,Y))Q[Y]=J[Y];return Q}),tr0=$(3,(X,J,Z)=>{let Q=n5();if(WG(X)||WG(J))return Q;for(let Y of Y7(X))if(wQ(J,Y))Q[Y]=Z(X[Y],J[Y]);return Q}),er0=$(2,(X,J)=>{if(WG(X))return{...J};if(WG(J))return{...X};let Z={};for(let Q of Y7(X))if(!wQ(J,Q))Z[Q]=X[Q];for(let Q of Y7(J))if(!wQ(X,Q))Z[Q]=J[Q];return Z}),Xa0=(X)=>{let J=jc(X);return(Z,Q)=>J(Z,Q)&&J(Q,Z)},Ja0=(X,J)=>({[X]:J}),Za0=$(2,(X,J)=>{let Z=Y7(X);for(let Q=0;Q<Z.length;Q++){let Y=Z[Q];if(J(X[Y],Y))return I([Y,X[Y]])}return S()});var p6=(...X)=>X,CK=(X)=>Array(X),qB=$(2,(X,J)=>{let Z=Math.max(1,Math.floor(X)),Q=Array(Z);for(let Y=0;Y<Z;Y++)Q[Y]=J(Y);return Q}),Qa0=(X,J)=>X<=J?qB(J-X+1,(Z)=>X+Z):[X],Ya0=$(2,(X,J)=>qB(J,()=>X)),v0=(X)=>Array.isArray(X)?X:Array.from(X),m2=(X)=>Array.isArray(X)?X:[X],Ga0=Mc,RY0=wc,l6=$(2,(X,{onEmpty:J,onNonEmpty:Z})=>B8(X)?Z(X):J()),hJ=$(2,(X,{onEmpty:J,onNonEmpty:Z})=>B8(X)?Z(c9(X),n6(X)):J()),Cc=$(2,(X,{onEmpty:J,onNonEmpty:Z})=>B8(X)?Z(Nw(X),rV(X)):J()),zZ=$(2,(X,J)=>[J,...X]),Ka0=$(2,(X,J)=>v0(J).concat(v0(X))),lX=$(2,(X,J)=>[...X,J]),z8=$(2,(X,J)=>v0(X).concat(v0(J))),Ba0=$(3,(X,J,Z)=>{let Q=[J],Y=0;for(let G of X)Q[Y+1]=Z(Q[Y],G),Y++;return Q}),Ha0=$(3,(X,J,Z)=>{let Q=v0(X),Y=Array(Q.length+1);Y[Q.length]=J;for(let G=Q.length-1;G>=0;G--)Y[G]=Z(Y[G+1],Q[G]);return Y}),IK=Array.isArray,jY0=(X)=>X.length===0,G7=jY0,i5=qN,B8=qN,Wa0=(X)=>X.length,iV=(X,J)=>X<0||X>=J.length,Pj=(X,J)=>Math.floor(Math.min(Math.max(0,X),J.length)),CY0=$(2,(X,J)=>{let Z=Math.floor(J);return iV(Z,X)?S():I(X[Z])}),oV=$(2,(X,J)=>{let Z=Math.floor(J);if(iV(Z,X))throw Error(`Index ${Z} out of bounds`);return X[Z]}),Va0=(X)=>[c9(X),n6(X)],$a0=(X)=>[Nw(X),rV(X)],mJ=CY0(0),c9=oV(0),zw=(X)=>B8(X)?I(rV(X)):S(),rV=(X)=>X[X.length-1],Ua0=(X)=>{let J=v0(X);return B8(J)?I(n6(J)):S()},n6=(X)=>X.slice(1),za0=(X)=>{let J=v0(X);return B8(J)?I(Nw(J)):S()},Nw=(X)=>X.slice(0,-1),Ow=$(2,(X,J)=>{let Z=v0(X);return Z.slice(0,Pj(J,Z))}),Na0=$(2,(X,J)=>{let Z=v0(X),Q=Pj(J,Z);return Q===0?[]:Z.slice(-Q)}),Oa0=$(2,(X,J)=>{let Z=0,Q=[];for(let Y of X){if(!J(Y,Z))break;Q.push(Y),Z++}return Q}),IY0=(X,J)=>{let Z=0;for(let Q of X){if(!J(Q,Z))break;Z++}return Z},DB=$(2,(X,J)=>AN(X,IY0(X,J))),VG=$(2,(X,J)=>{let Z=v0(X);return Z.slice(Pj(J,Z),Z.length)}),_a0=$(2,(X,J)=>{let Z=v0(X);return Z.slice(0,Z.length-Pj(J,Z))}),qa0=$(2,(X,J)=>v0(X).slice(IY0(X,J))),wN=$(2,(X,J)=>{let Z=0;for(let Q of X){if(J(Q,Z))return I(Z);Z++}return S()}),Ic=$(2,(X,J)=>{let Z=v0(X);for(let Q=Z.length-1;Q>=0;Q--)if(J(Z[Q],Q))return I(Q);return S()}),EK=qY0,LN=$(2,(X,J)=>{let Z=v0(X);for(let Q=Z.length-1;Q>=0;Q--){let Y=Z[Q],G=J(Y,Q);if(yJ(G)){if(G)return I(Y)}else if(R0(G))return G}return S()}),Da0=$(2,(X,J)=>{let Z=0;for(let Q of X){let Y=J(Q,Z);if(yJ(Y)){if(Y)return I([Q,Z])}else if(R0(Y))return I([Y.value,Z]);Z++}return S()}),wa0=$(2,(X,J)=>{let Z=0,Q=v0(X);for(let Y=0;Y<Q.length;Y++){let G=Q[Y];if(J(G,Y))Z++}return Z}),La0=$(3,(X,J,Z)=>{let Q=Array.from(X);if(J<0||J>Q.length)return S();return Q.splice(J,0,Z),I(Q)}),Fa0=$(3,(X,J,Z)=>Rj(X,J,()=>Z)),Aa0=$(3,(X,J,Z)=>EY0(X,J,()=>Z)),Rj=$(3,(X,J,Z)=>{let Q=Array.from(X);if(iV(J,Q))return Q;let Y=Z(Q[J]);return Q[J]=Y,Q}),EY0=$(3,(X,J,Z)=>{let Q=v0(X);if(iV(J,Q))return S();let Y=Array.isArray(X)?X.slice():Q,G=Z(Q[J]);return Y[J]=G,I(Y)}),jj=$(2,(X,J)=>{let Z=Array.from(X);if(iV(J,Z))return Z;return Z.splice(J,1),Z}),Ta0=$(2,(X,J)=>{let Z=v0(X);if(iV(J,Z))return S();let Q=Array.isArray(X)?X.slice():Z;return Q.splice(J,1),I(Q)}),_w=(X)=>Array.from(X).reverse(),NZ=$(2,(X,J)=>{let Z=Array.from(X);return Z.sort(J),Z}),Ma0=$(3,(X,J,Z)=>Array.from(X).map((Q)=>[Q,J(Q)]).sort(([,Q],[,Y])=>Z(Q,Y)).map(([Q])=>Q)),Pa0=(...X)=>{let J=NZ(BY0(X));return(Z)=>{let Q=v0(Z);if(B8(Q))return J(Q);return[]}},Cj=$(2,(X,J)=>qw(X,J,Mj)),qw=$(3,(X,J,Z)=>{let Q=v0(X),Y=v0(J);if(B8(Q)&&B8(Y)){let G=[Z(c9(Q),c9(Y))],K=Math.min(Q.length,Y.length);for(let B=1;B<K;B++)G[B]=Z(Q[B],Y[B]);return G}return[]}),Ec=(X)=>{let J=v0(X);if(B8(J)){let Z=[J[0][0]],Q=[J[0][1]];for(let Y=1;Y<J.length;Y++)Z[Y]=J[Y][0],Q[Y]=J[Y][1];return[Z,Q]}return[[],[]]},Ra0=$(2,(X,J)=>{let Z=v0(X);if(B8(Z)){let Q=[c9(Z)],Y=n6(Z);for(let G=0;G<Y.length;G++){if(G<Y.length)Q.push(J);Q.push(Y[G])}return Q}return[]}),SY0=$(2,(X,J)=>[J(c9(X)),...n6(X)]),ja0=$(2,(X,J)=>SY0(X,()=>J)),xY0=$(2,(X,J)=>lX(Nw(X),J(rV(X)))),Ca0=$(2,(X,J)=>xY0(X,()=>J)),vY0=$(2,(X,J)=>{let Z=v0(X);if(B8(Z)){let Q=Z.length,Y=Math.round(J)%Q;if(iV(Math.abs(Y),Z)||Y===0)return d2(Z);if(Y<0){let[G,K]=Ej(Z,-Y);return z8(K,G)}else return vY0(X,Y-Q)}return[]}),FN=(X)=>$(2,(J,Z)=>{for(let Q of J)if(X(Z,Q))return!0;return!1}),Ij=HB(),pZ=FN(Ij),Sc=$(2,(X,J)=>{let Z=v0(X);if(B8(Z)){let[Q,Y]=J(Z),G=[Q],K=Y;while(qN(K)){let[B,H]=J(K);G.push(B),K=H}return G}return[]}),AN=$(2,(X,J)=>{let Z=Array.from(X),Q=Math.floor(J);if(B8(Z)){if(Q>=1)return Ej(Z,Q);return[[],Z]}return[Z,[]]}),Ej=$(2,(X,J)=>{let Z=Math.max(1,Math.floor(J));return Z>=X.length?[d2(X),[]]:[zZ(X.slice(1,Z),c9(X)),X.slice(Z)]}),Ia0=$(2,(X,J)=>{let Z=v0(X);return kY0(Z,Math.ceil(Z.length/Math.floor(J)))}),Ea0=$(2,(X,J)=>DB(X,(Z,Q)=>!J(Z,Q))),d2=(X)=>X.slice(),Sa0=$(3,(X,J,Z)=>{if(X.length>=J)return Ow(X,J);return z8(X,qB(J-X.length,()=>Z))}),kY0=$(2,(X,J)=>{let Z=v0(X);if(B8(Z))return Sc(Z,Ej(J));return[]}),xa0=$(2,(X,J)=>{let Z=v0(X);if(J>0&&B8(Z))return Array.from({length:Z.length-(J-1)},(Q,Y)=>Z.slice(Y,Y+J));return[]}),bY0=$(2,(X,J)=>Sc(X,(Z)=>{let Q=c9(Z),Y=[Q],G=1;for(;G<Z.length;G++){let K=Z[G];if(J(K,Q))Y.push(K);else break}return[Y,Z.slice(G)]})),va0=bY0(HB()),ka0=$(2,(X,J)=>{let Z={};for(let Q of X){let Y=J(Q);if(Object.prototype.hasOwnProperty.call(Z,Y))Z[Y].push(Q);else Z[Y]=[Q]}return Z}),yY0=$(3,(X,J,Z)=>{let Q=v0(X),Y=v0(J);if(B8(Q)){if(B8(Y))return hc(Z)(z8(Q,Y));return Q}return Y}),nY=$(2,(X,J)=>yY0(X,J,Ij)),Sj=(X)=>{let J=FN(X);return $(2,(Z,Q)=>{let Y=v0(Q);return v0(Z).filter((G)=>J(Y,G))})},Dw=Sj(Ij),xj=(X)=>{let J=FN(X);return $(2,(Z,Q)=>{let Y=v0(Q);return v0(Z).filter((G)=>!J(Y,G))})},xc=xj(Ij),l0=()=>[],X8=(X)=>[X],n0=$(2,(X,J)=>X.map(J)),S6=$(2,(X,J)=>{if(G7(X))return[];let Z=[];for(let Q=0;Q<X.length;Q++){let Y=J(X[Q],Q);for(let G=0;G<Y.length;G++)Z.push(Y[G])}return Z}),aV=S6(t),LQ=$(2,(X,J)=>{let Z=v0(X),Q=[];for(let Y=0;Y<Z.length;Y++){let G=J(Z[Y],Y);if(R0(G))Q.push(G.value)}return Q}),vc=$(2,(X,J)=>{let Z=0,Q=[];for(let Y of X){let G=J(Y,Z);if(R0(G))Q.push(G.value);else break;Z++}return Q}),TN=$(2,(X,J)=>{let Z=[],Q=[],Y=v0(X);for(let G=0;G<Y.length;G++){let K=J(Y[G],G);if(U9(K))Z.push(K.left);else Q.push(K.right)}return[Z,Q]}),SK=LQ(t),ba0=(X)=>{let J=[];for(let Z of X)if(U9(Z))J.push(Z.left);return J},ya0=(X)=>{let J=[];for(let Z of X)if(NJ(Z))J.push(Z.right);return J},xK=$(2,(X,J)=>{let Z=v0(X),Q=[];for(let Y=0;Y<Z.length;Y++)if(J(Z[Y],Y))Q.push(Z[Y]);return Q}),kc=$(2,(X,J)=>{let Z=[],Q=[],Y=v0(X);for(let G=0;G<Y.length;G++)if(J(Y[G],G))Q.push(Y[G]);else Z.push(Y[G]);return[Z,Q]}),bc=TN(t),OJ=$(3,(X,J,Z)=>v0(X).reduce((Q,Y,G)=>Z(Q,Y,G),J)),JY=$(3,(X,J,Z)=>v0(X).reduceRight((Q,Y,G)=>Z(Q,Y,G),J)),ga0=(X)=>(J)=>X(J)?[J]:[],ha0=(X)=>(...J)=>RY0(X(...J)),yc=(X)=>X==null?l0():[X],ma0=(X)=>(...J)=>yc(X(...J)),da0=$(2,(X,J)=>S6(X,(Z)=>yc(J(Z)))),ua0=(X)=>(...J)=>{let Z=X(...J);return U9(Z)?[]:[Z.right]},ww=$(2,(X,J)=>X.every(J)),gc=$(2,(X,J)=>X.some(J)),ca0=$(2,(X,J)=>X.map((Z,Q,Y)=>J(Y.slice(Q)))),fa0=$(2,(X,J)=>X.reduce(MK(J))),pa0=$(2,(X,J)=>X.reduce(PK(J))),vj=(X,J)=>{let Z=[],Q=X,Y;while(R0(Y=J(Q))){let[G,K]=Y.value;Z.push(G),Q=K}return Z},la0=HY0,dJ=kQ0,na0=$(2,(X,J)=>v0(X).forEach((Z,Q)=>J(Z,Q))),hc=$(2,(X,J)=>{let Z=v0(X);if(B8(Z)){let Q=[c9(Z)],Y=n6(Z);for(let G of Y)if(Q.every((K)=>!J(G,K)))Q.push(G);return Q}return[]}),Lw=(X)=>hc(X,HB()),gY0=$(2,(X,J)=>{let Z=[],Q=S();for(let Y of X)if(j8(Q)||!J(Y,Q.value))Z.push(Y),Q=I(Y);return Z}),mc=gY0(HB()),s8=$(2,(X,J)=>v0(X).join(J)),dc=$(3,(X,J,Z)=>{let Q=0,Y=J,G=[];for(let K of X){let B=Z(Y,K,Q);Y=B[0],G.push(B[1]),Q++}return[Y,G]}),hY0=$(3,(X,J,Z)=>S6(X,(Q)=>n0(J,(Y)=>Z(Q,Y)))),ia0=$(2,(X,J)=>hY0(X,J,(Z,Q)=>[Z,Q])),oa0=X8({}),ra0=k2(n0,S6),aa0=qK(n0),sa0=_K(n0);var kj="And",bj="Or",yj="InvalidData",gj="MissingData",hj="SourceUnavailable",mj="Unsupported";var ea0="effect/ConfigError",dj=Symbol.for(ea0),MN={_tag:"ConfigError",[dj]:dj},uj=(X,J)=>{let Z=Object.create(MN);return Z._op=kj,Z.left=X,Z.right=J,Object.defineProperty(Z,"toString",{enumerable:!1,value(){return`${this.left} and ${this.right}`}}),Object.defineProperty(Z,"message",{enumerable:!1,get(){return this.toString()}}),Z},cj=(X,J)=>{let Z=Object.create(MN);return Z._op=bj,Z.left=X,Z.right=J,Object.defineProperty(Z,"toString",{enumerable:!1,value(){return`${this.left} or ${this.right}`}}),Object.defineProperty(Z,"message",{enumerable:!1,get(){return this.toString()}}),Z},lZ=(X,J,Z={pathDelim:"."})=>{let Q=Object.create(MN);return Q._op=yj,Q.path=X,Q.message=J,Object.defineProperty(Q,"toString",{enumerable:!1,value(){return`(Invalid data at ${z(this.path,s8(Z.pathDelim))}: "${this.message}")`}}),Q},o5=(X,J,Z={pathDelim:"."})=>{let Q=Object.create(MN);return Q._op=gj,Q.path=X,Q.message=J,Object.defineProperty(Q,"toString",{enumerable:!1,value(){return`(Missing data at ${z(this.path,s8(Z.pathDelim))}: "${this.message}")`}}),Q},mY0=(X,J,Z,Q={pathDelim:"."})=>{let Y=Object.create(MN);return Y._op=hj,Y.path=X,Y.message=J,Y.cause=Z,Object.defineProperty(Y,"toString",{enumerable:!1,value(){return`(Source unavailable at ${z(this.path,s8(Q.pathDelim))}: "${this.message}")`}}),Y},fj=(X,J,Z={pathDelim:"."})=>{let Q=Object.create(MN);return Q._op=mj,Q.path=X,Q.message=J,Object.defineProperty(Q,"toString",{enumerable:!1,value(){return`(Unsupported operation at ${z(this.path,s8(Z.pathDelim))}: "${this.message}")`}}),Q},dY0=(X)=>V0(X,dj);var wB=$(2,(X,J)=>{switch(X._op){case kj:return uj(wB(X.left,J),wB(X.right,J));case bj:return cj(wB(X.left,J),wB(X.right,J));case yj:return lZ([...J,...X.path],X.message);case gj:return o5([...J,...X.path],X.message);case hj:return mY0([...J,...X.path],X.message,X.cause);case mj:return fj([...J,...X.path],X.message)}}),Xs0={andCase:(X,J,Z)=>J&&Z,orCase:(X,J,Z)=>J&&Z,invalidDataCase:C6,missingDataCase:G6,sourceUnavailableCase:C6,unsupportedCase:C6},uY0=$(3,(X,J,Z)=>{let Q=[X],Y=[];while(Q.length>0){let K=Q.pop();switch(K._op){case kj:{Q.push(K.right),Q.push(K.left),Y.push(M0({_op:"AndCase"}));break}case bj:{Q.push(K.right),Q.push(K.left),Y.push(M0({_op:"OrCase"}));break}case yj:{Y.push(O0(Z.invalidDataCase(J,K.path,K.message)));break}case gj:{Y.push(O0(Z.missingDataCase(J,K.path,K.message)));break}case hj:{Y.push(O0(Z.sourceUnavailableCase(J,K.path,K.message,K.cause)));break}case mj:{Y.push(O0(Z.unsupportedCase(J,K.path,K.message)));break}}}let G=[];while(Y.length>0){let K=Y.pop();switch(K._op){case"Left":{switch(K.left._op){case"AndCase":{let B=G.pop(),H=G.pop(),W=Z.andCase(J,B,H);G.push(W);break}case"OrCase":{let B=G.pop(),H=G.pop(),W=Z.orCase(J,B,H);G.push(W);break}}break}case"Right":{G.push(K.right);break}}}if(G.length===0)throw Error("BUG: ConfigError.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return G.pop()}),cY0=(X)=>uY0(X,void 0,Xs0);var fY0=lZ;var pY0=dY0;var sV=cY0;var _8={};y8(_8,{withTime:()=>t68,withGroup:()=>s68,withConsole:()=>k68,warn:()=>a68,trace:()=>r68,timeLog:()=>o68,time:()=>i68,table:()=>n68,setConsole:()=>b68,log:()=>q6,info:()=>l68,group:()=>p68,error:()=>fn,dirxml:()=>f68,dir:()=>c68,debug:()=>u68,countReset:()=>d68,count:()=>m68,consoleWith:()=>y68,clear:()=>h68,assert:()=>g68,TypeId:()=>x68,Console:()=>v68});var c8={};y8(c8,{unsafeMake:()=>nZ,unsafeGet:()=>x6,pick:()=>$s0,omit:()=>rj,mergeAll:()=>nc,merge:()=>CX,make:()=>OZ,isTag:()=>jN,isReference:()=>Ws0,isContext:()=>Fw,getOrElse:()=>Vs0,getOption:()=>_7,get:()=>z9,empty:()=>jX,add:()=>X9,TagTypeId:()=>Bs0,Tag:()=>m7,ReferenceTypeId:()=>Hs0,Reference:()=>ZJ,GenericTag:()=>g8});var nj=Symbol.for("effect/Context/Tag"),PN=Symbol.for("effect/Context/Reference"),Js0="effect/STM",Zs0=Symbol.for(Js0),RN={...$B,_op:"Tag",[Zs0]:FK,[nj]:{_Service:(X)=>X,_Identifier:(X)=>X},toString(){return u8(this.toJSON())},toJSON(){return{_id:"Tag",key:this.key,stack:this.stack}},[$8](){return this.toJSON()},of(X){return X},context(X){return pc(this,X)}},Qs0={...RN,[PN]:PN},lY0=(X)=>{let J=Error.stackTraceLimit;Error.stackTraceLimit=2;let Z=Error();Error.stackTraceLimit=J;let Q=Object.create(RN);return Object.defineProperty(Q,"stack",{get(){return Z.stack}}),Q.key=X,Q},nY0=(X)=>()=>{let J=Error.stackTraceLimit;Error.stackTraceLimit=2;let Z=Error();Error.stackTraceLimit=J;function Q(){}return Object.setPrototypeOf(Q,RN),Q.key=X,Object.defineProperty(Q,"stack",{get(){return Z.stack}}),Q},iY0=()=>(X,J)=>{let Z=Error.stackTraceLimit;Error.stackTraceLimit=2;let Q=Error();Error.stackTraceLimit=Z;function Y(){}return Object.setPrototypeOf(Y,Qs0),Y.key=X,Y.defaultValue=J.defaultValue,Object.defineProperty(Y,"stack",{get(){return Q.stack}}),Y},cc=Symbol.for("effect/Context"),Ys0={[cc]:{_Services:(X)=>X},[b0](X){if(fc(X)){if(this.unsafeMap.size===X.unsafeMap.size){for(let J of this.unsafeMap.keys())if(!X.unsafeMap.has(J)||!_0(this.unsafeMap.get(J),X.unsafeMap.get(J)))return!1;return!0}}return!1},[y0](){return W8(this,BB(this.unsafeMap.size))},pipe(){return K0(this,arguments)},toString(){return u8(this.toJSON())},toJSON(){return{_id:"Context",services:Array.from(this.unsafeMap).map(H9)}},[$8](){return this.toJSON()}},r5=(X)=>{let J=Object.create(Ys0);return J.unsafeMap=X,J},Gs0=(X)=>{let J=Error(`Service not found${X.key?`: ${String(X.key)}`:""}`);if(X.stack){let Z=X.stack.split(`
153
+ `);if(Z.length>2){let Q=Z[2].match(/at (.*)/);if(Q)J.message=J.message+` (defined at ${Q[1]})`}}if(J.stack){let Z=J.stack.split(`
154
+ `);Z.splice(1,3),J.stack=Z.join(`
155
+ `)}return J},fc=(X)=>V0(X,cc),oY0=(X)=>V0(X,nj),ij=(X)=>V0(X,PN),Ks0=r5(new Map),rY0=()=>Ks0,pc=(X,J)=>r5(new Map([[X.key,J]])),aY0=$(3,(X,J,Z)=>{let Q=new Map(X.unsafeMap);return Q.set(J.key,Z),r5(Q)}),uc=c0("effect/Context/defaultValueCache",()=>new Map),oj=(X)=>{if(uc.has(X.key))return uc.get(X.key);let J=X.defaultValue();return uc.set(X.key,J),J},sY0=(X,J)=>{return X.unsafeMap.has(J.key)?X.unsafeMap.get(J.key):oj(J)},lc=$(2,(X,J)=>{if(!X.unsafeMap.has(J.key)){if(PN in J)return oj(J);throw Gs0(J)}return X.unsafeMap.get(J.key)}),tY0=lc,eY0=$(3,(X,J,Z)=>{if(!X.unsafeMap.has(J.key))return ij(J)?oj(J):Z();return X.unsafeMap.get(J.key)}),X50=$(2,(X,J)=>{if(!X.unsafeMap.has(J.key))return ij(J)?XJ(oj(J)):tQ;return XJ(X.unsafeMap.get(J.key))}),J50=$(2,(X,J)=>{let Z=new Map(X.unsafeMap);for(let[Q,Y]of J.unsafeMap)Z.set(Q,Y);return r5(Z)}),Z50=(...X)=>{let J=new Map;for(let Z=0;Z<X.length;Z++)X[Z].unsafeMap.forEach((Q,Y)=>{J.set(Y,Q)});return r5(J)},Q50=(...X)=>(J)=>{let Z=new Set(X.map((Y)=>Y.key)),Q=new Map;for(let[Y,G]of J.unsafeMap.entries())if(Z.has(Y))Q.set(Y,G);return r5(Q)},Y50=(...X)=>(J)=>{let Z=new Map(J.unsafeMap);for(let Q of X)Z.delete(Q.key);return r5(Z)};var Bs0=nj,Hs0=PN,g8=lY0;var nZ=r5,Fw=fc,jN=oY0,Ws0=ij,jX=rY0,OZ=pc,X9=aY0,z9=tY0,Vs0=eY0,x6=lc,_7=X50,CX=J50,nc=Z50,$s0=Q50,rj=Y50,m7=nY0,ZJ=iY0;var k9={};y8(k9,{zipWith:()=>jw,zip:()=>bs0,unzip:()=>ks0,unsafeLast:()=>FB,unsafeHead:()=>kK,unsafeGet:()=>HX,unsafeFromNonEmptyArray:()=>CN,unsafeFromArray:()=>Q8,union:()=>Ss0,toReadonlyArray:()=>G9,toArray:()=>Tw,takeWhile:()=>XC,takeRight:()=>Rw,take:()=>_J,tailNonEmpty:()=>_Z,tail:()=>Es0,splitWhere:()=>ej,splitNonEmptyAt:()=>Cs0,splitAt:()=>c2,split:()=>Is0,sortWith:()=>js0,sort:()=>W50,some:()=>ns0,size:()=>Rs0,separate:()=>Ps0,reverse:()=>ZY,replaceOption:()=>ms0,replace:()=>hs0,removeOption:()=>gs0,remove:()=>ys0,reduceRight:()=>tc,reduce:()=>t5,range:()=>Cw,prependAll:()=>ws0,prepend:()=>LX,partitionMap:()=>Ms0,partition:()=>Ts0,of:()=>m0,modifyOption:()=>sc,modify:()=>V50,mapAccum:()=>tj,map:()=>p9,makeBy:()=>$50,make:()=>LB,lastNonEmpty:()=>As0,last:()=>Pw,join:()=>is0,isNonEmpty:()=>FX,isEmpty:()=>T8,isChunk:()=>vK,intersection:()=>Fs0,headNonEmpty:()=>qJ,head:()=>$G,getEquivalence:()=>Aw,get:()=>oc,fromIterable:()=>f9,forEach:()=>ac,flatten:()=>Mw,flatMap:()=>sj,findLastIndex:()=>ps0,findLast:()=>fs0,findFirstIndex:()=>cs0,findFirst:()=>JC,filterMapWhile:()=>rc,filterMap:()=>u2,filter:()=>s5,every:()=>ls0,empty:()=>a0,dropWhile:()=>aj,dropRight:()=>Ds0,drop:()=>o9,differenceWith:()=>os0,difference:()=>rs0,dedupeAdjacent:()=>vs0,dedupe:()=>xs0,containsWith:()=>us0,contains:()=>ds0,compact:()=>Ls0,chunksOf:()=>H50,appendAll:()=>f8,append:()=>D7});var K50=Symbol.for("effect/Chunk");function Us0(X,J,Z,Q,Y){for(let G=J;G<Math.min(X.length,J+Y);G++)Z[Q+G-J]=X[G];return Z}var B50=[],Aw=(X)=>I6((J,Z)=>J.length===Z.length&&G9(J).every((Q,Y)=>X(Q,HX(Z,Y)))),zs0=Aw(_0),Ns0={[K50]:{_A:(X)=>X},toString(){return u8(this.toJSON())},toJSON(){return{_id:"Chunk",values:G9(this).map(H9)}},[$8](){return this.toJSON()},[b0](X){return vK(X)&&zs0(this,X)},[y0](){return W8(this,uY(G9(this)))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return B50[Symbol.iterator]();default:return G9(this)[Symbol.iterator]()}},pipe(){return K0(this,arguments)}},q7=(X)=>{let J=Object.create(Ns0);switch(J.backing=X,X._tag){case"IEmpty":{J.length=0,J.depth=0,J.left=J,J.right=J;break}case"IConcat":{J.length=X.left.length+X.right.length,J.depth=1+Math.max(X.left.depth,X.right.depth),J.left=X.left,J.right=X.right;break}case"IArray":{J.length=X.array.length,J.depth=0,J.left=a5,J.right=a5;break}case"ISingleton":{J.length=1,J.depth=0,J.left=a5,J.right=a5;break}case"ISlice":{J.length=X.length,J.depth=X.chunk.depth+1,J.left=a5,J.right=a5;break}}return J},vK=(X)=>V0(X,K50),a5=q7({_tag:"IEmpty"}),a0=()=>a5,LB=(...X)=>CN(X),m0=(X)=>q7({_tag:"ISingleton",a:X}),f9=(X)=>vK(X)?X:Q8(v0(X)),ic=(X,J,Z)=>{switch(X.backing._tag){case"IArray":{Us0(X.backing.array,0,J,Z,X.length);break}case"IConcat":{ic(X.left,J,Z),ic(X.right,J,Z+X.left.length);break}case"ISingleton":{J[Z]=X.backing.a;break}case"ISlice":{let Q=0,Y=Z;while(Q<X.length)J[Y]=HX(X,Q),Q+=1,Y+=1;break}}},Os0=(X)=>G9(X).slice(),Tw=Os0,_s0=(X)=>{switch(X.backing._tag){case"IEmpty":return B50;case"IArray":return X.backing.array;default:{let J=Array(X.length);return ic(X,J,0),X.backing={_tag:"IArray",array:J},X.left=a5,X.right=a5,X.depth=0,J}}},G9=_s0,qs0=(X)=>{switch(X.backing._tag){case"IEmpty":case"ISingleton":return X;case"IArray":return q7({_tag:"IArray",array:_w(X.backing.array)});case"IConcat":return q7({_tag:"IConcat",left:ZY(X.backing.right),right:ZY(X.backing.left)});case"ISlice":return Q8(_w(G9(X)))}},ZY=qs0,oc=$(2,(X,J)=>J<0||J>=X.length?S():I(HX(X,J))),Q8=(X)=>X.length===0?a0():X.length===1?m0(X[0]):q7({_tag:"IArray",array:X}),CN=(X)=>Q8(X),HX=$(2,(X,J)=>{switch(X.backing._tag){case"IEmpty":throw Error("Index out of bounds");case"ISingleton":{if(J!==0)throw Error("Index out of bounds");return X.backing.a}case"IArray":{if(J>=X.length||J<0)throw Error("Index out of bounds");return X.backing.array[J]}case"IConcat":return J<X.left.length?HX(X.left,J):HX(X.right,J-X.left.length);case"ISlice":return HX(X.backing.chunk,J+X.backing.offset)}}),D7=$(2,(X,J)=>f8(X,m0(J))),LX=$(2,(X,J)=>f8(m0(J),X)),_J=$(2,(X,J)=>{if(J<=0)return a5;else if(J>=X.length)return X;else switch(X.backing._tag){case"ISlice":return q7({_tag:"ISlice",chunk:X.backing.chunk,length:J,offset:X.backing.offset});case"IConcat":{if(J>X.left.length)return q7({_tag:"IConcat",left:X.left,right:_J(X.right,J-X.left.length)});return _J(X.left,J)}default:return q7({_tag:"ISlice",chunk:X,offset:0,length:J})}}),o9=$(2,(X,J)=>{if(J<=0)return X;else if(J>=X.length)return a5;else switch(X.backing._tag){case"ISlice":return q7({_tag:"ISlice",chunk:X.backing.chunk,offset:X.backing.offset+J,length:X.backing.length-J});case"IConcat":{if(J>X.left.length)return o9(X.right,J-X.left.length);return q7({_tag:"IConcat",left:o9(X.left,J),right:X.right})}default:return q7({_tag:"ISlice",chunk:X,offset:J,length:X.length-J})}}),Ds0=$(2,(X,J)=>_J(X,Math.max(0,X.length-J))),aj=$(2,(X,J)=>{let Z=G9(X),Q=Z.length,Y=0;while(Y<Q&&J(Z[Y]))Y++;return o9(X,Y)}),ws0=$(2,(X,J)=>f8(J,X)),f8=$(2,(X,J)=>{if(X.backing._tag==="IEmpty")return J;if(J.backing._tag==="IEmpty")return X;let Z=J.depth-X.depth;if(Math.abs(Z)<=1)return q7({_tag:"IConcat",left:X,right:J});else if(Z<-1)if(X.left.depth>=X.right.depth){let Q=f8(X.right,J);return q7({_tag:"IConcat",left:X.left,right:Q})}else{let Q=f8(X.right.right,J);if(Q.depth===X.depth-3){let Y=q7({_tag:"IConcat",left:X.right.left,right:Q});return q7({_tag:"IConcat",left:X.left,right:Y})}else{let Y=q7({_tag:"IConcat",left:X.left,right:X.right.left});return q7({_tag:"IConcat",left:Y,right:Q})}}else if(J.right.depth>=J.left.depth){let Q=f8(X,J.left);return q7({_tag:"IConcat",left:Q,right:J.right})}else{let Q=f8(X,J.left.left);if(Q.depth===J.depth-3){let Y=q7({_tag:"IConcat",left:Q,right:J.left.right});return q7({_tag:"IConcat",left:Y,right:J.right})}else{let Y=q7({_tag:"IConcat",left:J.left.right,right:J.right});return q7({_tag:"IConcat",left:Q,right:Y})}}}),u2=$(2,(X,J)=>Q8(LQ(X,J))),s5=$(2,(X,J)=>Q8(xK(X,J))),rc=$(2,(X,J)=>Q8(vc(X,J))),Ls0=(X)=>u2(X,t),sj=$(2,(X,J)=>{if(X.backing._tag==="ISingleton")return J(X.backing.a,0);let Z=a5,Q=0;for(let Y of X)Z=f8(Z,J(Y,Q++));return Z}),ac=$(2,(X,J)=>G9(X).forEach(J)),Mw=sj(t),H50=$(2,(X,J)=>{let Z=[],Q=[];if(G9(X).forEach((Y)=>{if(Q.push(Y),Q.length>=J)Z.push(Q8(Q)),Q=[]}),Q.length>0)Z.push(Q8(Q));return Q8(Z)}),Fs0=$(2,(X,J)=>Q8(Dw(G9(X),G9(J)))),T8=(X)=>X.length===0,FX=(X)=>X.length>0,$G=oc(0),kK=(X)=>HX(X,0),qJ=kK,Pw=(X)=>oc(X,X.length-1),FB=(X)=>HX(X,X.length-1),As0=FB,p9=$(2,(X,J)=>X.backing._tag==="ISingleton"?m0(J(X.backing.a,0)):Q8(z(G9(X),n0((Z,Q)=>J(Z,Q))))),tj=$(3,(X,J,Z)=>{let[Q,Y]=dc(X,J,Z);return[Q,Q8(Y)]}),Ts0=$(2,(X,J)=>z(kc(G9(X),J),([Z,Q])=>[Q8(Z),Q8(Q)])),Ms0=$(2,(X,J)=>z(TN(G9(X),J),([Z,Q])=>[Q8(Z),Q8(Q)])),Ps0=(X)=>z(bc(G9(X)),([J,Z])=>[Q8(J),Q8(Z)]),Rs0=(X)=>X.length,W50=$(2,(X,J)=>Q8(NZ(G9(X),J))),js0=$(3,(X,J,Z)=>W50(X,HG(Z,J))),c2=$(2,(X,J)=>[_J(X,J),o9(X,J)]),Cs0=$(2,(X,J)=>{let Z=Math.max(1,Math.floor(J));return Z>=X.length?[X,a0()]:[_J(X,Z),o9(X,Z)]}),Is0=$(2,(X,J)=>H50(X,Math.ceil(X.length/Math.floor(J)))),ej=$(2,(X,J)=>{let Z=0;for(let Q of G9(X))if(J(Q))break;else Z++;return c2(X,Z)}),Es0=(X)=>X.length>0?I(o9(X,1)):S(),_Z=(X)=>o9(X,1),Rw=$(2,(X,J)=>o9(X,X.length-J)),XC=$(2,(X,J)=>{let Z=[];for(let Q of G9(X))if(J(Q))Z.push(Q);else break;return Q8(Z)}),Ss0=$(2,(X,J)=>Q8(nY(G9(X),G9(J)))),xs0=(X)=>Q8(Lw(G9(X))),vs0=(X)=>Q8(mc(X)),ks0=(X)=>{let[J,Z]=Ec(X);return[Q8(J),Q8(Z)]},jw=$(3,(X,J,Z)=>Q8(qw(X,J,Z))),bs0=$(2,(X,J)=>jw(X,J,(Z,Q)=>[Z,Q])),ys0=$(2,(X,J)=>{if(J<0||J>=X.length)return X;return Q8(jj(G9(X),J))}),gs0=$(2,(X,J)=>{if(J<0||J>=X.length)return S();return I(Q8(jj(G9(X),J)))}),sc=$(3,(X,J,Z)=>{if(J<0||J>=X.length)return S();return I(Q8(Rj(G9(X),J,Z)))}),V50=$(3,(X,J,Z)=>i0(sc(X,J,Z),()=>X)),hs0=$(3,(X,J,Z)=>V50(X,J,()=>Z)),ms0=$(3,(X,J,Z)=>sc(X,J,()=>Z)),$50=$(2,(X,J)=>f9(qB(X,J))),Cw=(X,J)=>X<=J?$50(J-X+1,(Z)=>X+Z):m0(X),ds0=pZ,us0=FN,JC=EK,cs0=wN,fs0=LN,ps0=Ic,ls0=$(2,(X,J)=>v0(X).every(J)),ns0=$(2,(X,J)=>v0(X).some(J)),is0=s8,t5=OJ,tc=JY,os0=(X)=>{return $(2,(J,Z)=>Q8(xj(X)(Z,J)))},rs0=$(2,(X,J)=>Q8(xc(J,X)));var r9={};y8(r9,{zero:()=>QY,weeks:()=>w50,unsafeToNanos:()=>F50,unsafeFormatIso:()=>P50,unsafeDivide:()=>Wt0,toWeeks:()=>Zt0,toSeconds:()=>L50,toNanos:()=>Yf,toMinutes:()=>es0,toMillis:()=>K7,toHrTime:()=>A50,toHours:()=>Xt0,toDays:()=>Jt0,times:()=>T50,sum:()=>Bf,subtract:()=>Vt0,seconds:()=>eV,parts:()=>Hf,nanos:()=>UG,minutes:()=>_50,min:()=>Yt0,millis:()=>v6,micros:()=>O50,max:()=>Kt0,matchWith:()=>AB,match:()=>yK,lessThanOrEqualTo:()=>Sw,lessThan:()=>GC,isZero:()=>QC,isFinite:()=>bK,isDuration:()=>Iw,infinity:()=>tV,hours:()=>q50,greaterThanOrEqualTo:()=>IN,greaterThan:()=>xw,fromIso:()=>Ut0,formatIso:()=>$t0,format:()=>KC,equals:()=>M50,divide:()=>Ht0,decodeUnknown:()=>Qf,decode:()=>K9,days:()=>D50,clamp:()=>Kf,between:()=>Gf,Order:()=>Ew,Equivalence:()=>YC});var ec=Symbol.for("effect/Duration"),N50=BigInt(0),U50=BigInt(24),ZC=BigInt(60),Xf=BigInt(1000),Jf=BigInt(1e6),Zf=BigInt(1e9),as0=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,K9=(X)=>{if(Iw(X))return X;else if(e7(X))return v6(X);else if(DK(X))return UG(X);else if(Array.isArray(X)&&X.length===2&&X.every(e7)){if(X[0]===-1/0||X[1]===-1/0||Number.isNaN(X[0])||Number.isNaN(X[1]))return QY;if(X[0]===1/0||X[1]===1/0)return tV;return UG(BigInt(Math.round(X[0]*1e9))+BigInt(Math.round(X[1])))}else if(n9(X)){let J=as0.exec(X);if(J){let[Z,Q,Y]=J,G=Number(Q);switch(Y){case"nano":case"nanos":return UG(BigInt(Q));case"micro":case"micros":return O50(BigInt(Q));case"milli":case"millis":return v6(G);case"second":case"seconds":return eV(G);case"minute":case"minutes":return _50(G);case"hour":case"hours":return q50(G);case"day":case"days":return D50(G);case"week":case"weeks":return w50(G)}}}throw Error("Invalid DurationInput")},Qf=_B(K9),z50={_tag:"Millis",millis:0},ss0={_tag:"Infinity"},ts0={[ec]:ec,[y0](){return W8(this,Hj(this.value))},[b0](X){return Iw(X)&&M50(this,X)},toString(){return`Duration(${KC(this)})`},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",hrtime:A50(this)};case"Infinity":return{_id:"Duration",_tag:"Infinity"}}},[$8](){return this.toJSON()},pipe(){return K0(this,arguments)}},QJ=(X)=>{let J=Object.create(ts0);if(e7(X))if(isNaN(X)||X<=0)J.value=z50;else if(!Number.isFinite(X))J.value=ss0;else if(!Number.isInteger(X))J.value={_tag:"Nanos",nanos:BigInt(Math.round(X*1e6))};else J.value={_tag:"Millis",millis:X};else if(X<=N50)J.value=z50;else J.value={_tag:"Nanos",nanos:X};return J},Iw=(X)=>V0(X,ec),bK=(X)=>X.value._tag!=="Infinity",QC=(X)=>{switch(X.value._tag){case"Millis":return X.value.millis===0;case"Nanos":return X.value.nanos===N50;case"Infinity":return!1}},QY=QJ(0),tV=QJ(1/0),UG=(X)=>QJ(X),O50=(X)=>QJ(X*Xf),v6=(X)=>QJ(X),eV=(X)=>QJ(X*1000),_50=(X)=>QJ(X*60000),q50=(X)=>QJ(X*3600000),D50=(X)=>QJ(X*86400000),w50=(X)=>QJ(X*604800000),K7=(X)=>yK(X,{onMillis:(J)=>J,onNanos:(J)=>Number(J)/1e6}),L50=(X)=>yK(X,{onMillis:(J)=>J/1000,onNanos:(J)=>Number(J)/1e9}),es0=(X)=>yK(X,{onMillis:(J)=>J/60000,onNanos:(J)=>Number(J)/60000000000}),Xt0=(X)=>yK(X,{onMillis:(J)=>J/3600000,onNanos:(J)=>Number(J)/3600000000000}),Jt0=(X)=>yK(X,{onMillis:(J)=>J/86400000,onNanos:(J)=>Number(J)/86400000000000}),Zt0=(X)=>yK(X,{onMillis:(J)=>J/604800000,onNanos:(J)=>Number(J)/604800000000000}),Yf=(X)=>{let J=K9(X);switch(J.value._tag){case"Infinity":return S();case"Nanos":return I(J.value.nanos);case"Millis":return I(BigInt(Math.round(J.value.millis*1e6)))}},F50=(X)=>{let J=K9(X);switch(J.value._tag){case"Infinity":throw Error("Cannot convert infinite duration to nanos");case"Nanos":return J.value.nanos;case"Millis":return BigInt(Math.round(J.value.millis*1e6))}},A50=(X)=>{let J=K9(X);switch(J.value._tag){case"Infinity":return[1/0,0];case"Nanos":return[Number(J.value.nanos/Zf),Number(J.value.nanos%Zf)];case"Millis":return[Math.floor(J.value.millis/1000),Math.round(J.value.millis%1000*1e6)]}},yK=$(2,(X,J)=>{let Z=K9(X);switch(Z.value._tag){case"Nanos":return J.onNanos(Z.value.nanos);case"Infinity":return J.onMillis(1/0);case"Millis":return J.onMillis(Z.value.millis)}}),AB=$(3,(X,J,Z)=>{let Q=K9(X),Y=K9(J);if(Q.value._tag==="Infinity"||Y.value._tag==="Infinity")return Z.onMillis(K7(Q),K7(Y));else if(Q.value._tag==="Nanos"||Y.value._tag==="Nanos"){let G=Q.value._tag==="Nanos"?Q.value.nanos:BigInt(Math.round(Q.value.millis*1e6)),K=Y.value._tag==="Nanos"?Y.value.nanos:BigInt(Math.round(Y.value.millis*1e6));return Z.onNanos(G,K)}return Z.onMillis(Q.value.millis,Y.value.millis)}),Ew=fZ((X,J)=>AB(X,J,{onMillis:(Z,Q)=>Z<Q?-1:Z>Q?1:0,onNanos:(Z,Q)=>Z<Q?-1:Z>Q?1:0})),Gf=h2(HG(Ew,K9)),YC=(X,J)=>AB(X,J,{onMillis:(Z,Q)=>Z===Q,onNanos:(Z,Q)=>Z===Q}),Qt0=MK(Ew),Yt0=$(2,(X,J)=>Qt0(K9(X),K9(J))),Gt0=PK(Ew),Kt0=$(2,(X,J)=>Gt0(K9(X),K9(J))),Bt0=RK(Ew),Kf=$(2,(X,J)=>Bt0(K9(X),{minimum:K9(J.minimum),maximum:K9(J.maximum)})),Ht0=$(2,(X,J)=>yK(X,{onMillis:(Z)=>{if(J===0||isNaN(J)||!Number.isFinite(J))return S();return I(QJ(Z/J))},onNanos:(Z)=>{if(isNaN(J)||J<=0||!Number.isFinite(J))return S();try{return I(QJ(Z/BigInt(J)))}catch{return S()}}})),Wt0=$(2,(X,J)=>yK(X,{onMillis:(Z)=>QJ(Z/J),onNanos:(Z)=>{if(isNaN(J)||J<0||Object.is(J,-0))return QY;else if(Object.is(J,0)||!Number.isFinite(J))return tV;return QJ(Z/BigInt(J))}})),T50=$(2,(X,J)=>yK(X,{onMillis:(Z)=>QJ(Z*J),onNanos:(Z)=>QJ(Z*BigInt(J))})),Vt0=$(2,(X,J)=>AB(X,J,{onMillis:(Z,Q)=>QJ(Z-Q),onNanos:(Z,Q)=>QJ(Z-Q)})),Bf=$(2,(X,J)=>AB(X,J,{onMillis:(Z,Q)=>QJ(Z+Q),onNanos:(Z,Q)=>QJ(Z+Q)})),GC=$(2,(X,J)=>AB(X,J,{onMillis:(Z,Q)=>Z<Q,onNanos:(Z,Q)=>Z<Q})),Sw=$(2,(X,J)=>AB(X,J,{onMillis:(Z,Q)=>Z<=Q,onNanos:(Z,Q)=>Z<=Q})),xw=$(2,(X,J)=>AB(X,J,{onMillis:(Z,Q)=>Z>Q,onNanos:(Z,Q)=>Z>Q})),IN=$(2,(X,J)=>AB(X,J,{onMillis:(Z,Q)=>Z>=Q,onNanos:(Z,Q)=>Z>=Q})),M50=$(2,(X,J)=>YC(K9(X),K9(J))),Hf=(X)=>{let J=K9(X);if(J.value._tag==="Infinity")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};let Z=F50(J),Q=Z/Jf,Y=Q/Xf,G=Y/ZC,K=G/ZC,B=K/U50;return{days:Number(B),hours:Number(K%U50),minutes:Number(G%ZC),seconds:Number(Y%ZC),millis:Number(Q%Xf),nanos:Number(Z%Jf)}},KC=(X)=>{let J=K9(X);if(J.value._tag==="Infinity")return"Infinity";if(QC(J))return"0";let Z=Hf(J),Q=[];if(Z.days!==0)Q.push(`${Z.days}d`);if(Z.hours!==0)Q.push(`${Z.hours}h`);if(Z.minutes!==0)Q.push(`${Z.minutes}m`);if(Z.seconds!==0)Q.push(`${Z.seconds}s`);if(Z.millis!==0)Q.push(`${Z.millis}ms`);if(Z.nanos!==0)Q.push(`${Z.nanos}ns`);return Q.join(" ")},P50=(X)=>{let J=K9(X);if(!bK(J))throw RangeError("Cannot format infinite duration");let Z=[],{days:Q,hours:Y,millis:G,minutes:K,nanos:B,seconds:H}=Hf(J),W=Q;if(W>=365){let V=Math.floor(W/365);W%=365,Z.push(`${V}Y`)}if(W>=30){let V=Math.floor(W/30);W%=30,Z.push(`${V}M`)}if(W>=7){let V=Math.floor(W/7);W%=7,Z.push(`${V}W`)}if(W>0)Z.push(`${W}D`);if(Y!==0||K!==0||H!==0||G!==0||B!==0){if(Z.push("T"),Y!==0)Z.push(`${Y}H`);if(K!==0)Z.push(`${K}M`);if(H!==0||G!==0||B!==0){let V=BigInt(H)*Zf+BigInt(G)*Jf+BigInt(B),U=(Number(V)/1e9).toFixed(9).replace(/\.?0+$/,"");Z.push(`${U}S`)}}return`P${Z.join("")||"T0S"}`},$t0=(X)=>{let J=K9(X);return bK(J)?I(P50(J)):S()},Ut0=(X)=>{let J=zt0.exec(X);if(J==null)return S();let[Z,Q,Y,G,K,B,H]=J.slice(1,8).map((V)=>V?Number(V):0),W=Z*365*24*60*60+Q*30*24*60*60+Y*7*24*60*60+G*24*60*60+K*60*60+B*60+H;return I(eV(W))},zt0=/^P(?!$)(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?!$)(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/;var f2=5,Wf=Math.pow(2,5),R50=Wf-1,j50=Wf/2,C50=Wf/4;function Nt0(X){return X-=X>>1&1431655765,X=(X&858993459)+(X>>2&858993459),X=X+(X>>4)&252645135,X+=X>>8,X+=X>>16,X&127}function p2(X,J){return J>>>X&R50}function l2(X){return 1<<X}function BC(X,J){return Nt0(X&J-1)}var I50=(X,J)=>({value:X,previous:J});function X$(X,J,Z,Q){let Y=Q;if(!X){let G=Q.length;Y=Array(G);for(let K=0;K<G;++K)Y[K]=Q[K]}return Y[J]=Z,Y}function Vf(X,J,Z){let Q=Z.length-1,Y=0,G=0,K=Z;if(X)Y=G=J;else{K=Array(Q);while(Y<J)K[G++]=Z[Y++]}++Y;while(Y<=Q)K[G++]=Z[Y++];if(X)K.length=Q;return K}function E50(X,J,Z,Q){let Y=Q.length;if(X){let H=Y;while(H>=J)Q[H--]=Q[H];return Q[J]=Z,Q}let G=0,K=0,B=Array(Y+1);while(G<J)B[K++]=Q[G++];B[J]=Z;while(G<Y)B[++K]=Q[G++];return B}class TB{_tag="EmptyNode";modify(X,J,Z,Q,Y,G){let K=Z(S());if(j8(K))return new TB;return++G.value,new J$(X,Q,Y,K)}}function e5(X){return p5(X,"EmptyNode")}function _t0(X){return e5(X)||X._tag==="LeafNode"||X._tag==="CollisionNode"}function HC(X,J){return e5(X)?!1:J===X.edit}class J${edit;hash;key;value;_tag="LeafNode";constructor(X,J,Z,Q){this.edit=X,this.hash=J,this.key=Z,this.value=Q}modify(X,J,Z,Q,Y,G){if(_0(Y,this.key)){let B=Z(this.value);if(B===this.value)return this;else if(j8(B))return--G.value,new TB;if(HC(this,X))return this.value=B,this;return new J$(X,Q,Y,B)}let K=Z(S());if(j8(K))return this;return++G.value,S50(X,J,this.hash,this,Q,new J$(X,Q,Y,K))}}class $f{edit;hash;children;_tag="CollisionNode";constructor(X,J,Z){this.edit=X,this.hash=J,this.children=Z}modify(X,J,Z,Q,Y,G){if(Q===this.hash){let B=HC(this,X),H=this.updateCollisionList(B,X,this.hash,this.children,Z,Y,G);if(H===this.children)return this;return H.length>1?new $f(X,this.hash,H):H[0]}let K=Z(S());if(j8(K))return this;return++G.value,S50(X,J,this.hash,this,Q,new J$(X,Q,Y,K))}updateCollisionList(X,J,Z,Q,Y,G,K){let B=Q.length;for(let W=0;W<B;++W){let V=Q[W];if("key"in V&&_0(G,V.key)){let U=V.value,O=Y(U);if(O===U)return Q;if(j8(O))return--K.value,Vf(X,W,Q);return X$(X,W,new J$(J,Z,G,O),Q)}}let H=Y(S());if(j8(H))return Q;return++K.value,X$(X,B,new J$(J,Z,G,H),Q)}}class EN{edit;mask;children;_tag="IndexedNode";constructor(X,J,Z){this.edit=X,this.mask=J,this.children=Z}modify(X,J,Z,Q,Y,G){let K=this.mask,B=this.children,H=p2(J,Q),W=l2(H),V=BC(K,W),U=K&W,O=HC(this,X);if(!U){let x=new TB().modify(X,J+f2,Z,Q,Y,G);if(!x)return this;return B.length>=j50?Dt0(X,H,x,K,B):new EN(X,K|W,E50(O,V,x,B))}let q=B[V],L=q.modify(X,J+f2,Z,Q,Y,G);if(q===L)return this;let A=K,M;if(e5(L)){if(A&=~W,!A)return new TB;if(B.length<=2&&_t0(B[V^1]))return B[V^1];M=Vf(O,V,B)}else M=X$(O,V,L,B);if(O)return this.mask=A,this.children=M,this;return new EN(X,A,M)}}class Uf{edit;size;children;_tag="ArrayNode";constructor(X,J,Z){this.edit=X,this.size=J,this.children=Z}modify(X,J,Z,Q,Y,G){let K=this.size,B=this.children,H=p2(J,Q),W=B[H],V=(W||new TB).modify(X,J+f2,Z,Q,Y,G);if(W===V)return this;let U=HC(this,X),O;if(e5(W)&&!e5(V))++K,O=X$(U,H,V,B);else if(!e5(W)&&e5(V)){if(--K,K<=C50)return qt0(X,K,H,B);O=X$(U,H,new TB,B)}else O=X$(U,H,V,B);if(U)return this.size=K,this.children=O,this;return new Uf(X,K,O)}}function qt0(X,J,Z,Q){let Y=Array(J-1),G=0,K=0;for(let B=0,H=Q.length;B<H;++B)if(B!==Z){let W=Q[B];if(W&&!e5(W))Y[G++]=W,K|=1<<B}return new EN(X,K,Y)}function Dt0(X,J,Z,Q,Y){let G=[],K=Q,B=0;for(let H=0;K;++H){if(K&1)G[H]=Y[B++];K>>>=1}return G[J]=Z,new Uf(X,B+1,G)}function wt0(X,J,Z,Q,Y,G){if(Z===Y)return new $f(X,Z,[G,Q]);let K=p2(J,Z),B=p2(J,Y);if(K===B)return(H)=>new EN(X,l2(K)|l2(B),[H]);else{let H=K<B?[Q,G]:[G,Q];return new EN(X,l2(K)|l2(B),H)}}function S50(X,J,Z,Q,Y,G){let K=void 0,B=J;while(!0){let H=wt0(X,B,Z,Q,Y,G);if(typeof H==="function")K=I50(H,K),B=B+f2;else{let W=H;while(K!=null)W=K.value(W),K=K.previous;return W}}}var x50="effect/HashMap",WC=Symbol.for(x50),Ft0={[WC]:WC,[Symbol.iterator](){return new $C(this,(X,J)=>[X,J])},[y0](){let X=Z0(x50);for(let J of this)X^=z(Z0(J[0]),A0(Z0(J[1])));return W8(this,X)},[b0](X){if(Of(X)){if(X._size!==this._size)return!1;for(let J of this){let Z=z(X,UC(J[0],Z0(J[0])));if(j8(Z))return!1;else if(!_0(J[1],Z.value))return!1}return!0}return!1},toString(){return u8(this.toJSON())},toJSON(){return{_id:"HashMap",values:Array.from(this).map(H9)}},[$8](){return this.toJSON()},pipe(){return K0(this,arguments)}},zf=(X,J,Z,Q)=>{let Y=Object.create(Ft0);return Y._editable=X,Y._edit=J,Y._root=Z,Y._size=Q,Y};class $C{map;f;v;constructor(X,J){this.map=X,this.f=J,this.v=v50(this.map._root,this.f,void 0)}next(){if(j8(this.v))return{done:!0,value:void 0};let X=this.v.value;return this.v=VC(X.cont),{done:!1,value:X.value}}[Symbol.iterator](){return new $C(this.map,this.f)}}var VC=(X)=>X?k50(X[0],X[1],X[2],X[3],X[4]):S(),v50=(X,J,Z=void 0)=>{switch(X._tag){case"LeafNode":{if(R0(X.value))return I({value:J(X.key,X.value.value),cont:Z});return VC(Z)}case"CollisionNode":case"ArrayNode":case"IndexedNode":{let Q=X.children;return k50(Q.length,Q,0,J,Z)}default:return VC(Z)}},k50=(X,J,Z,Q,Y)=>{while(Z<X){let G=J[Z++];if(G&&!e5(G))return v50(G,Q,[X,J,Z,Q,Y])}return VC(Y)},At0=zf(!1,0,new TB,0),SN=()=>At0,b50=(...X)=>Nf(X),Nf=(X)=>{let J=vN(SN());for(let Z of X)n2(J,Z[0],Z[1]);return OC(J)},Of=(X)=>V0(X,WC),y50=(X)=>X&&e5(X._root),g50=$(2,(X,J)=>UC(X,J,Z0(J))),UC=$(3,(X,J,Z)=>{let Q=X._root,Y=0;while(!0)switch(Q._tag){case"LeafNode":return _0(J,Q.key)?Q.value:S();case"CollisionNode":{if(Z===Q.hash){let G=Q.children;for(let K=0,B=G.length;K<B;++K){let H=G[K];if("key"in H&&_0(J,H.key))return H.value}}return S()}case"IndexedNode":{let G=p2(Y,Z),K=l2(G);if(Q.mask&K){Q=Q.children[BC(Q.mask,K)],Y+=f2;break}return S()}case"ArrayNode":{if(Q=Q.children[p2(Y,Z)],Q){Y+=f2;break}return S()}default:return S()}});var zC=$(2,(X,J)=>R0(UC(X,J,Z0(J))));var n2=$(3,(X,J,Z)=>_C(X,J,()=>I(Z))),Tt0=$(3,(X,J,Z)=>{if(X._editable)return X._root=J,X._size=Z,X;return J===X._root?X:zf(X._editable,X._edit,J,Z)}),NC=(X)=>new $C(X,(J)=>J);var xN=(X)=>X._size;var vN=(X)=>zf(!0,X._edit+1,X._root,X._size),OC=(X)=>{return X._editable=!1,X},h50=$(2,(X,J)=>{let Z=vN(X);return J(Z),OC(Z)}),_C=$(3,(X,J,Z)=>m50(X,J,Z0(J),Z)),m50=$(4,(X,J,Z,Q)=>{let Y={value:X._size},G=X._root.modify(X._editable?X._edit:NaN,0,Q,Z,J,Y);return z(X,Tt0(G,Y.value))});var d50=$(2,(X,J)=>{let Z=vN(X);return vw(J,(Q,Y)=>n2(Z,Y,Q)),OC(Z)}),qC=$(2,(X,J)=>_C(X,J,S));var u50=$(2,(X,J)=>kN(X,SN(),(Z,Q,Y)=>n2(Z,Y,J(Q,Y))));var vw=$(2,(X,J)=>kN(X,void 0,(Z,Q,Y)=>J(Q,Y))),kN=$(3,(X,J,Z)=>{let Q=X._root;if(Q._tag==="LeafNode")return R0(Q.value)?Z(J,Q.value.value,Q.key):J;if(Q._tag==="EmptyNode")return J;let Y=[Q.children],G;while(G=Y.pop())for(let K=0,B=G.length;K<B;){let H=G[K++];if(H&&!e5(H))if(H._tag==="LeafNode"){if(R0(H.value))J=Z(J,H.value.value,H.key)}else Y.push(H.children)}return J});var f50="effect/HashSet",DC=Symbol.for(f50),Mt0={[DC]:DC,[Symbol.iterator](){return NC(this._keyMap)},[y0](){return W8(this,A0(Z0(this._keyMap))(Z0(f50)))},[b0](X){if(_f(X))return xN(this._keyMap)===xN(X._keyMap)&&_0(this._keyMap,X._keyMap);return!1},toString(){return u8(this.toJSON())},toJSON(){return{_id:"HashSet",values:Array.from(this).map(H9)}},[$8](){return this.toJSON()},pipe(){return K0(this,arguments)}},wC=(X)=>{let J=Object.create(Mt0);return J._keyMap=X,J},_f=(X)=>V0(X,DC),Pt0=wC(SN()),Z$=()=>Pt0,p50=(X)=>{let J=FC(Z$());for(let Z of X)i2(J,Z);return AC(J)},l50=(...X)=>{let J=FC(Z$());for(let Z of X)i2(J,Z);return AC(J)},LC=$(2,(X,J)=>zC(X._keyMap,J));var n50=(X)=>xN(X._keyMap),FC=(X)=>wC(vN(X._keyMap)),AC=(X)=>{return X._keyMap._editable=!1,X},kw=$(2,(X,J)=>{let Z=FC(X);return J(Z),AC(Z)}),i2=$(2,(X,J)=>X._keyMap._editable?(n2(J,!0)(X._keyMap),X):wC(n2(J,!0)(X._keyMap))),qf=$(2,(X,J)=>X._keyMap._editable?(qC(J)(X._keyMap),X):wC(qC(J)(X._keyMap))),i50=$(2,(X,J)=>kw(X,(Z)=>{for(let Q of J)qf(Z,Q)}));var o50=$(2,(X,J)=>kw(Z$(),(Z)=>{bw(X,(Q)=>i2(Z,Q));for(let Q of J)i2(Z,Q)}));var r50=$(2,(X,J)=>kw(Z$(),(Z)=>{bw(X,(Q)=>{let Y=J(Q);if(!LC(Z,Y))i2(Z,Y)})})),a50=$(2,(X,J)=>kw(Z$(),(Z)=>{bw(X,(Q)=>{for(let Y of J(Q))if(!LC(Z,Y))i2(Z,Y)})})),bw=$(2,(X,J)=>vw(X._keyMap,(Z,Q)=>J(Q))),s50=$(3,(X,J,Z)=>kN(X._keyMap,J,(Q,Y,G)=>Z(Q,G)));var t50=_f,YY=Z$,X4=p50,zG=l50,bN=LC;var MB=n50;var iY=i2,PB=qf,Df=i50;var gK=o50;var wf=r50,Lf=a50,e50=bw,o2=s50;var X40=Symbol.for("effect/MutableRef"),jt0={[X40]:X40,toString(){return u8(this.toJSON())},toJSON(){return{_id:"MutableRef",current:H9(this.current)}},[$8](){return this.toJSON()},pipe(){return K0(this,arguments)}},uJ=(X)=>{let J=Object.create(jt0);return J.current=X,J},TC=$(3,(X,J,Z)=>{if(_0(J,X.current))return X.current=Z,!0;return!1});var O9=(X)=>X.current;var oZ=$(2,(X,J)=>{return X.current=J,X});var jC="effect/FiberId",a2=Symbol.for(jC),Q$="None",MC="Runtime",PC="Composite",Ct0=R8(`${jC}-${Q$}`);class Z40{[a2]=a2;_tag=Q$;id=-1;startTimeMillis=-1;[y0](){return Ct0}[b0](X){return gw(X)&&X._tag===Q$}toString(){return u8(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag}}[$8](){return this.toJSON()}}class CC{id;startTimeMillis;[a2]=a2;_tag=MC;constructor(X,J){this.id=X,this.startTimeMillis=J}[y0](){return W8(this,R8(`${jC}-${this._tag}-${this.id}-${this.startTimeMillis}`))}[b0](X){return gw(X)&&X._tag===MC&&this.id===X.id&&this.startTimeMillis===X.startTimeMillis}toString(){return u8(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,id:this.id,startTimeMillis:this.startTimeMillis}}[$8](){return this.toJSON()}}class Ff{left;right;[a2]=a2;_tag=PC;constructor(X,J){this.left=X,this.right=J}_hash;[y0](){return z(R8(`${jC}-${this._tag}`),A0(Z0(this.left)),A0(Z0(this.right)),W8(this))}[b0](X){return gw(X)&&X._tag===PC&&_0(this.left,X.left)&&_0(this.right,X.right)}toString(){return u8(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,left:H9(this.left),right:H9(this.right)}}[$8](){return this.toJSON()}}var Y$=new Z40,Q40=(X,J)=>{return new CC(X,J)},Y40=(X,J)=>{return new Ff(X,J)},gw=(X)=>V0(X,a2);var Af=$(2,(X,J)=>{if(X._tag===Q$)return J;if(J._tag===Q$)return X;return new Ff(X,J)}),G40=(X)=>{return z(X,o2(Y$,(J,Z)=>Af(Z)(J)))};var yw=(X)=>{switch(X._tag){case Q$:return YY();case MC:return zG(X.id);case PC:return z(yw(X.left),gK(yw(X.right)))}},J40=c0(Symbol.for("effect/Fiber/Id/_fiberCounter"),()=>uJ(0)),K40=(X,J)=>{return new CC(X,J)},G$=(X)=>{return Array.from(yw(X)).map((Z)=>`#${Z}`).join(",")};var RC=(X)=>{switch(X._tag){case Q$:return YY();case MC:return zG(X);case PC:return z(RC(X.left),gK(RC(X.right)))}},B40=()=>{let X=O9(J40);return z(J40,oZ(X+1)),new CC(X,Date.now())};var d7=Y$,H40=Q40,W40=Y40,V40=gw;var K$=Af,$40=G40;var hw=yw,B$=K40,U40=G$;var Mf=RC,IC=B40;var z40=Of,qZ=SN,mw=b50,J4=Nf,yN=y50,H$=g50;var N40=zC;var w7=n2,Pf=NC;var EC=xN;var O40=h50,_40=_C;var q40=d50;var D40=u50;var w40=vw,Rf=kN;var uw=Symbol.for("effect/List"),jf=(X)=>v0(X),Et0=(X)=>tu(dJ(X),jf),St0=Et0(_0),xt0={[uw]:uw,_tag:"Cons",toString(){return u8(this.toJSON())},toJSON(){return{_id:"List",_tag:"Cons",values:jf(this).map(H9)}},[$8](){return this.toJSON()},[b0](X){return SC(X)&&this._tag===X._tag&&St0(this,X)},[y0](){return W8(this,uY(jf(this)))},[Symbol.iterator](){let X=!1,J=this;return{next(){if(X)return this.return();if(J._tag==="Nil")return X=!0,this.return();let Z=J.head;return J=J.tail,{done:X,value:Z}},return(Z){if(!X)X=!0;return{done:!0,value:Z}}}},pipe(){return K0(this,arguments)}},gN=(X,J)=>{let Z=Object.create(xt0);return Z.head=X,Z.tail=J,Z},vt0=R8("Nil"),kt0={[uw]:uw,_tag:"Nil",toString(){return u8(this.toJSON())},toJSON(){return{_id:"List",_tag:"Nil"}},[$8](){return this.toJSON()},[y0](){return vt0},[b0](X){return SC(X)&&this._tag===X._tag},[Symbol.iterator](){return{next(){return{done:!0,value:void 0}}}},pipe(){return K0(this,arguments)}},dw=Object.create(kt0),SC=(X)=>V0(X,uw),FQ=(X)=>X._tag==="Nil",W$=(X)=>X._tag==="Cons";var bt0=()=>dw,u7=(X,J)=>gN(X,J),Z4=bt0,RB=(X)=>gN(X,dw),xC=(X)=>{let J=X[Symbol.iterator](),Z;if((Z=J.next())&&!Z.done){let Q=gN(Z.value,dw),Y=Q;while((Z=J.next())&&!Z.done){let G=gN(Z.value,dw);Y.tail=G,Y=G}return Q}else return dw};var L40=$(2,(X,J)=>yt0(J,X)),vC=$(2,(X,J)=>u7(J,X)),yt0=$(2,(X,J)=>{if(FQ(X))return J;else if(FQ(J))return X;else{let Z=gN(J.head,X),Q=Z,Y=J.tail;while(!FQ(Y)){let G=gN(Y.head,X);Q.tail=G,Q=G,Y=Y.tail}return Z}});var F40=$(3,(X,J,Z)=>{let Q=J,Y=X;while(!FQ(Y))Q=Z(Q,Y.head),Y=Y.tail;return Q});var A40=(X)=>{let J=Z4(),Z=X;while(!FQ(Z))J=vC(J,Z.head),Z=Z.tail;return J};var T40=Object.assign(Object.create(Array.prototype),{[y0](){return W8(this,uY(this))},[b0](X){if(Array.isArray(X)&&this.length===X.length)return this.every((J,Z)=>_0(J,X[Z]));else return!1}}),CB=function(){function X(J){if(J)Object.assign(this,J)}return X.prototype=AK,X}(),hN=(X)=>Object.assign(Object.create(AK),X);var gt0=Symbol.for("effect/DifferContextPatch");function M40(X){return X}var fw={...CB.prototype,[gt0]:{_Value:M40,_Patch:M40}},ht0=Object.assign(Object.create(fw),{_tag:"Empty"}),mt0=Object.create(ht0),If=()=>mt0,dt0=Object.assign(Object.create(fw),{_tag:"AndThen"}),ut0=(X,J)=>{let Z=Object.create(dt0);return Z.first=X,Z.second=J,Z},ct0=Object.assign(Object.create(fw),{_tag:"AddService"}),ft0=(X,J)=>{let Z=Object.create(ct0);return Z.key=X,Z.service=J,Z},pt0=Object.assign(Object.create(fw),{_tag:"RemoveService"}),lt0=(X)=>{let J=Object.create(pt0);return J.key=X,J},nt0=Object.assign(Object.create(fw),{_tag:"UpdateService"}),it0=(X,J)=>{let Z=Object.create(nt0);return Z.key=X,Z.update=J,Z},P40=(X,J)=>{let Z=new Map(X.unsafeMap),Q=If();for(let[Y,G]of J.unsafeMap.entries())if(Z.has(Y)){let K=Z.get(Y);if(Z.delete(Y),!_0(K,G))Q=cw(it0(Y,()=>G))(Q)}else Z.delete(Y),Q=cw(ft0(Y,G))(Q);for(let[Y]of Z.entries())Q=cw(lt0(Y))(Q);return Q},cw=$(2,(X,J)=>ut0(X,J)),R40=$(2,(X,J)=>{if(X._tag==="Empty")return J;let Z=!1,Q=m0(X),Y=new Map(J.unsafeMap);while(FX(Q)){let K=qJ(Q),B=_Z(Q);switch(K._tag){case"Empty":{Q=B;break}case"AddService":{Y.set(K.key,K.service),Q=B;break}case"AndThen":{Q=LX(LX(B,K.second),K.first);break}case"RemoveService":{Y.delete(K.key),Q=B;break}case"UpdateService":{Y.set(K.key,K.update(Y.get(K.key))),Z=!0,Q=B;break}}}if(!Z)return r5(Y);let G=new Map;for(let[K]of J.unsafeMap)if(Y.has(K))G.set(K,Y.get(K)),Y.delete(K);for(let[K,B]of Y)G.set(K,B);return r5(G)});var rt0=Symbol.for("effect/DifferHashSetPatch");function Ef(X){return X}var bC={...CB.prototype,[rt0]:{_Value:Ef,_Key:Ef,_Patch:Ef}},at0=Object.assign(Object.create(bC),{_tag:"Empty"}),st0=Object.create(at0),Sf=()=>st0,tt0=Object.assign(Object.create(bC),{_tag:"AndThen"}),et0=(X,J)=>{let Z=Object.create(tt0);return Z.first=X,Z.second=J,Z},Xe0=Object.assign(Object.create(bC),{_tag:"Add"}),Je0=(X)=>{let J=Object.create(Xe0);return J.value=X,J},Ze0=Object.assign(Object.create(bC),{_tag:"Remove"}),Qe0=(X)=>{let J=Object.create(Ze0);return J.value=X,J},j40=(X,J)=>{let[Z,Q]=o2([X,Sf()],([Y,G],K)=>{if(bN(K)(Y))return[PB(K)(Y),G];return[Y,kC(Je0(K))(G)]})(J);return o2(Q,(Y,G)=>kC(Qe0(G))(Y))(Z)},kC=$(2,(X,J)=>et0(X,J)),C40=$(2,(X,J)=>{if(X._tag==="Empty")return J;let Z=J,Q=m0(X);while(FX(Q)){let Y=qJ(Q),G=_Z(Q);switch(Y._tag){case"Empty":{Q=G;break}case"AndThen":{Q=LX(Y.first)(LX(Y.second)(G));break}case"Add":{Z=iY(Y.value)(Z),Q=G;break}case"Remove":Z=PB(Y.value)(Z),Q=G}}return Z});var Ge0=Symbol.for("effect/DifferReadonlyArrayPatch");function I40(X){return X}var lw={...CB.prototype,[Ge0]:{_Value:I40,_Patch:I40}},Ke0=Object.assign(Object.create(lw),{_tag:"Empty"}),Be0=Object.create(Ke0),xf=()=>Be0,He0=Object.assign(Object.create(lw),{_tag:"AndThen"}),We0=(X,J)=>{let Z=Object.create(He0);return Z.first=X,Z.second=J,Z},Ve0=Object.assign(Object.create(lw),{_tag:"Append"}),$e0=(X)=>{let J=Object.create(Ve0);return J.values=X,J},Ue0=Object.assign(Object.create(lw),{_tag:"Slice"}),ze0=(X,J)=>{let Z=Object.create(Ue0);return Z.from=X,Z.until=J,Z},Ne0=Object.assign(Object.create(lw),{_tag:"Update"}),Oe0=(X,J)=>{let Z=Object.create(Ne0);return Z.index=X,Z.patch=J,Z},E40=(X)=>{let J=0,Z=xf();while(J<X.oldValue.length&&J<X.newValue.length){let Q=X.oldValue[J],Y=X.newValue[J],G=X.differ.diff(Q,Y);if(!_0(G,X.differ.empty))Z=pw(Z,Oe0(J,G));J=J+1}if(J<X.oldValue.length)Z=pw(Z,ze0(0,J));if(J<X.newValue.length)Z=pw(Z,$e0(VG(J)(X.newValue)));return Z},pw=$(2,(X,J)=>We0(X,J)),S40=$(3,(X,J,Z)=>{if(X._tag==="Empty")return J;let Q=J.slice(),Y=X8(X);while(i5(Y)){let G=c9(Y),K=n6(Y);switch(G._tag){case"Empty":{Y=K;break}case"AndThen":{K.unshift(G.first,G.second),Y=K;break}case"Append":{for(let B of G.values)Q.push(B);Y=K;break}case"Slice":{Q=Q.slice(G.from,G.until),Y=K;break}case"Update":{Q[G.index]=Z.patch(G.patch,Q[G.index]),Y=K;break}}}return Q});var x40=Symbol.for("effect/Differ"),qe0={[x40]:{_P:t,_V:t},pipe(){return K0(this,arguments)}},s2=(X)=>{let J=Object.create(qe0);return J.empty=X.empty,J.diff=X.diff,J.combine=X.combine,J.patch=X.patch,J},vf=()=>s2({empty:If(),combine:(X,J)=>cw(J)(X),diff:(X,J)=>P40(X,J),patch:(X,J)=>R40(J)(X)});var kf=()=>s2({empty:Sf(),combine:(X,J)=>kC(J)(X),diff:(X,J)=>j40(X,J),patch:(X,J)=>C40(J)(X)});var bf=(X)=>s2({empty:xf(),combine:(J,Z)=>pw(J,Z),diff:(J,Z)=>E40({oldValue:J,newValue:Z,differ:X}),patch:(J,Z)=>S40(J,Z,X)});var yC=()=>v40((X,J)=>J),v40=(X)=>s2({empty:t,combine:(J,Z)=>{if(J===t)return Z;if(Z===t)return J;return(Q)=>Z(J(Q))},diff:(J,Z)=>{if(_0(J,Z))return t;return YG(Z)},patch:(J,Z)=>X(Z,J(Z))});var nw=255,k40=8,gC=(X)=>X&nw,hC=(X)=>X>>k40&nw,V$=(X,J)=>(X&nw)+((J&X&nw)<<k40),mC=V$(0,0),b40=(X)=>V$(X,X),y40=(X)=>V$(X,0);var g40=$(2,(X,J)=>V$(gC(X)&~J,hC(X)));var gf=$(2,(X,J)=>X|J);var h40=(X)=>~X>>>0&nw;var d40=0,rY=1,hf=2,dC=4,iw=16,uC=32;var mf=(X)=>rw(X,uC),ow=$(2,(X,J)=>X&~J);var cC=$(2,(X,J)=>X|J);var mK=(X)=>mN(X)&&!u40(X),mN=(X)=>rw(X,rY);var rw=$(2,(X,J)=>(X&J)!==0),fC=(...X)=>X.reduce((J,Z)=>J|Z,0),df=fC(d40);var pC=(X)=>rw(X,dC);var u40=(X)=>rw(X,iw);var aY=$(2,(X,J)=>V$(X^J,J)),dK=$(2,(X,J)=>X&(h40(gC(J))|hC(J))|gC(J)&hC(J));var lC=s2({empty:mC,diff:(X,J)=>aY(X,J),combine:(X,J)=>gf(J)(X),patch:(X,J)=>dK(J,X)});var c40=mC;var uf=b40,cf=y40;var ff=g40;var p40={_tag:"Empty"},lf=(X,J)=>({_tag:"Par",left:X,right:J}),nC=(X,J)=>({_tag:"Seq",left:X,right:J}),nf=(X,J)=>({_tag:"Single",dataSource:X,blockedRequest:J});var l40=(X)=>{let J=RB(X),Z=Z4();while(!0){let[Q,Y]=F40(J,[i40(),Z4()],([G,K],B)=>{let[H,W]=De0(B);return[Pe0(G,H),L40(K,W)]});if(Z=we0(Z,Q),FQ(Y))return A40(Z);J=Y}throw Error("BUG: BlockedRequests.flatten - please report an issue at https://github.com/Effect-TS/effect/issues")},De0=(X)=>{let J=X,Z=i40(),Q=Z4(),Y=Z4();while(!0)switch(J._tag){case"Empty":{if(FQ(Q))return[Z,Y];J=Q.head,Q=Q.tail;break}case"Par":{Q=u7(J.right,Q),J=J.left;break}case"Seq":{let{left:G,right:K}=J;switch(G._tag){case"Empty":{J=K;break}case"Par":{let{left:B,right:H}=G;J=lf(nC(B,K),nC(H,K));break}case"Seq":{let{left:B,right:H}=G;J=nC(B,nC(H,K));break}case"Single":{J=G,Y=u7(K,Y);break}}break}case"Single":{if(Z=Me0(Z,J),FQ(Q))return[Z,Y];J=Q.head,Q=Q.tail;break}}throw Error("BUG: BlockedRequests.step - please report an issue at https://github.com/Effect-TS/effect/issues")},we0=(X,J)=>{if(FQ(X))return RB(pf(J));if(Re0(J))return X;let Z=xe0(X.head),Q=je0(J);if(Z.length===1&&Q.length===1&&_0(Z[0],Q[0]))return u7(Se0(X.head,pf(J)),X.tail);return u7(pf(J),X)},Le0=Symbol.for("effect/RequestBlock/Entry");class n40{request;result;listeners;ownerId;state;[Le0]=Fe0;constructor(X,J,Z,Q,Y){this.request=X,this.result=J,this.listeners=Z,this.ownerId=Q,this.state=Y}}var Fe0={_R:(X)=>X};var of=(X)=>new n40(X.request,X.result,X.listeners,X.ownerId,X.state),Ae0=Symbol.for("effect/RequestBlock/RequestBlockParallel"),Te0={_R:(X)=>X};class iC{map;[Ae0]=Te0;constructor(X){this.map=X}}var i40=()=>new iC(qZ());var Me0=(X,J)=>new iC(_40(X.map,J.dataSource,(Z)=>_c(r8(Z,D7(J.blockedRequest)),()=>m0(J.blockedRequest)))),Pe0=(X,J)=>new iC(Rf(X.map,J.map,(Z,Q,Y)=>w7(Z,Y,w0(H$(Z,Y),{onNone:()=>Q,onSome:(G)=>f8(Q,G)})))),Re0=(X)=>yN(X.map),je0=(X)=>Array.from(Pf(X.map)),pf=(X)=>Ee0(D40(X.map,(J)=>m0(J))),Ce0=Symbol.for("effect/RequestBlock/RequestBlockSequential"),Ie0={_R:(X)=>X};class rf{map;[Ce0]=Ie0;constructor(X){this.map=X}}var Ee0=(X)=>new rf(X),Se0=(X,J)=>new rf(Rf(J.map,X.map,(Z,Q,Y)=>w7(Z,Y,w0(H$(Z,Y),{onNone:()=>a0(),onSome:(G)=>f8(G,Q)}))));var xe0=(X)=>Array.from(Pf(X.map)),o40=(X)=>Array.from(X.map);var t2="Die",IB="Empty",e2="Fail",X1="Interrupt",J1="Parallel",Z1="Sequential";var t40="effect/Cause",oC=Symbol.for(t40),ke0={_E:(X)=>X},cN={[oC]:ke0,[y0](){return z(Z0(t40),A0(Z0(be0(this))),W8(this))},[b0](X){return aw(X)&&NG0(this,X)},pipe(){return K0(this,arguments)},toJSON(){switch(this._tag){case"Empty":return{_id:"Cause",_tag:this._tag};case"Die":return{_id:"Cause",_tag:this._tag,defect:H9(this.defect)};case"Interrupt":return{_id:"Cause",_tag:this._tag,fiberId:this.fiberId.toJSON()};case"Fail":return{_id:"Cause",_tag:this._tag,failure:H9(this.error)};case"Sequential":case"Parallel":return{_id:"Cause",_tag:this._tag,left:H9(this.left),right:H9(this.right)}}},toString(){return sY(this)},[$8](){return this.toJSON()}},c7=(()=>{let X=Object.create(cN);return X._tag=IB,X})(),GY=(X)=>{let J=Object.create(cN);return J._tag=e2,J.error=X,J},k6=(X)=>{let J=Object.create(cN);return J._tag=t2,J.defect=X,J},cJ=(X)=>{let J=Object.create(cN);return J._tag=X1,J.fiberId=X,J},B7=(X,J)=>{let Z=Object.create(cN);return Z._tag=J1,Z.left=X,Z.right=J,Z},OX=(X,J)=>{let Z=Object.create(cN);return Z._tag=Z1,Z.left=X,Z.right=J,Z},aw=(X)=>V0(X,oC),rC=(X)=>X._tag===IB,e40=(X)=>X._tag===e2,U$=(X)=>X._tag===t2,XG0=(X)=>X._tag===X1,JG0=(X)=>X._tag===Z1,ZG0=(X)=>X._tag===J1,QG0=(X)=>O$(X,void 0,ge0),Q1=(X)=>{if(X._tag===IB)return!0;return EB(X,!0,(J,Z)=>{switch(Z._tag){case IB:return I(J);case t2:case e2:case X1:return I(!1);default:return S()}})},YG0=(X)=>R0(nN(X)),GG0=(X)=>R0(tf(X)),fN=(X)=>R0(ef(X)),z$=(X)=>O$(void 0,he0)(X),pN=(X)=>ZY(EB(X,a0(),(J,Z)=>Z._tag===e2?I(z(J,LX(Z.error))):S())),lN=(X)=>ZY(EB(X,a0(),(J,Z)=>Z._tag===t2?I(z(J,LX(Z.defect))):S())),N$=(X)=>EB(X,YY(),(J,Z)=>Z._tag===X1?I(z(J,iY(Z.fiberId))):S()),nN=(X)=>uK(X,(J)=>J._tag===e2?I(J.error):S()),NG=(X)=>{let J=nN(X);switch(J._tag){case"None":return O0(X);case"Some":return M0(J.value)}},tf=(X)=>uK(X,(J)=>J._tag===t2?I(J.defect):S()),KG0=(X)=>cK(X,{onEmpty:I(c7),onFail:r8(GY),onDie:(J)=>I(k6(J)),onInterrupt:(J)=>I(cJ(J)),onSequential:jK(OX),onParallel:jK(B7)}),ef=(X)=>uK(X,(J)=>J._tag===X1?I(J.fiberId):S()),aC=(X)=>cK(X,{onEmpty:S(),onFail:()=>S(),onDie:(J)=>I(k6(J)),onInterrupt:()=>S(),onSequential:jK(OX),onParallel:jK(B7)}),BG0=(X)=>cK(X,{onEmpty:S(),onFail:(J)=>I(k6(J)),onDie:(J)=>I(k6(J)),onInterrupt:()=>S(),onSequential:jK(OX),onParallel:jK(B7)}),HG0=(X)=>cK(X,{onEmpty:YY(),onFail:(J)=>zG(GY(J)),onDie:(J)=>zG(k6(J)),onInterrupt:(J)=>zG(cJ(J)),onSequential:(J,Z)=>Lf(J,(Q)=>wf(Z,(Y)=>OX(Q,Y))),onParallel:(J,Z)=>Lf(J,(Q)=>wf(Z,(Y)=>B7(Q,Y)))}),sw=(X)=>cK(X,{onEmpty:c7,onFail:()=>c7,onDie:k6,onInterrupt:cJ,onSequential:OX,onParallel:B7}),WG0=(X)=>cK(X,{onEmpty:c7,onFail:k6,onDie:k6,onInterrupt:cJ,onSequential:OX,onParallel:B7}),VG0=$(2,(X,J)=>cK(X,{onEmpty:I(c7),onFail:(Z)=>I(GY(Z)),onDie:(Z)=>{let Q=J(Z);return R0(Q)?S():I(k6(Z))},onInterrupt:(Z)=>I(cJ(Z)),onSequential:jK(OX),onParallel:jK(B7)})),$G0=$(2,(X,J)=>iN(X,()=>J)),iN=$(2,(X,J)=>uN(X,(Z)=>GY(J(Z)))),uN=$(2,(X,J)=>cK(X,{onEmpty:c7,onFail:(Z)=>J(Z),onDie:(Z)=>k6(Z),onInterrupt:(Z)=>cJ(Z),onSequential:(Z,Q)=>OX(Z,Q),onParallel:(Z,Q)=>B7(Z,Q)})),sC=(X)=>uN(X,t),UG0=$(2,(X,J)=>dY(J)?uN(X,J):uN(X,()=>J)),zG0=$(2,(X,J)=>{if(J._tag===IB||X===J)return!0;return EB(X,!1,(Z,Q)=>{return I(Z||NG0(Q,J))})}),NG0=(X,J)=>{let Z=m0(X),Q=m0(J);while(FX(Z)&&FX(Q)){let[Y,G]=z(qJ(Z),EB([YY(),a0()],([H,W],V)=>{let[U,O]=af(V);return I([z(H,gK(U)),z(W,f8(O))])})),[K,B]=z(qJ(Q),EB([YY(),a0()],([H,W],V)=>{let[U,O]=af(V);return I([z(H,gK(U)),z(W,f8(O))])}));if(!_0(Y,K))return!1;Z=G,Q=B}return!0},be0=(X)=>{return ye0(m0(X),a0())},ye0=(X,J)=>{while(!0){let[Z,Q]=z(X,OJ([YY(),a0()],([G,K],B)=>{let[H,W]=af(B);return[z(G,gK(H)),z(K,f8(W))]})),Y=MB(Z)>0?z(J,LX(Z)):J;if(T8(Q))return ZY(Y);X=Q,J=Y}throw Error(mV("Cause.flattenCauseLoop"))},uK=$(2,(X,J)=>{let Z=[X];while(Z.length>0){let Q=Z.pop(),Y=J(Q);switch(Y._tag){case"None":{switch(Q._tag){case Z1:case J1:{Z.push(Q.right),Z.push(Q.left);break}}break}case"Some":return Y}}return S()}),OG0=$(2,(X,J)=>O$(X,void 0,me0(J))),af=(X)=>{let J=X,Z=[],Q=YY(),Y=a0();while(J!==void 0)switch(J._tag){case IB:{if(Z.length===0)return[Q,Y];J=Z.pop();break}case e2:{if(Q=iY(Q,LB(J._tag,J.error)),Z.length===0)return[Q,Y];J=Z.pop();break}case t2:{if(Q=iY(Q,LB(J._tag,J.defect)),Z.length===0)return[Q,Y];J=Z.pop();break}case X1:{if(Q=iY(Q,LB(J._tag,J.fiberId)),Z.length===0)return[Q,Y];J=Z.pop();break}case Z1:{switch(J.left._tag){case IB:{J=J.right;break}case Z1:{J=OX(J.left.left,OX(J.left.right,J.right));break}case J1:{J=B7(OX(J.left.left,J.right),OX(J.left.right,J.right));break}default:{Y=LX(Y,J.right),J=J.left;break}}break}case J1:{Z.push(J.right),J=J.left;break}}throw Error(mV("Cause.evaluateCauseLoop"))},ge0={emptyCase:()=>0,failCase:()=>1,dieCase:()=>1,interruptCase:()=>1,sequentialCase:(X,J,Z)=>J+Z,parallelCase:(X,J,Z)=>J+Z},he0={emptyCase:G6,failCase:C6,dieCase:C6,interruptCase:G6,sequentialCase:(X,J,Z)=>J&&Z,parallelCase:(X,J,Z)=>J&&Z},me0=(X)=>({emptyCase:()=>c7,failCase:(J,Z)=>GY(Z),dieCase:(J,Z)=>k6(Z),interruptCase:(J,Z)=>cJ(Z),sequentialCase:(J,Z,Q)=>{if(X(Z)){if(X(Q))return OX(Z,Q);return Z}if(X(Q))return Q;return c7},parallelCase:(J,Z,Q)=>{if(X(Z)){if(X(Q))return B7(Z,Q);return Z}if(X(Q))return Q;return c7}}),a40="SequentialCase",s40="ParallelCase",cK=$(2,(X,{onDie:J,onEmpty:Z,onFail:Q,onInterrupt:Y,onParallel:G,onSequential:K})=>{return O$(X,void 0,{emptyCase:()=>Z,failCase:(B,H)=>Q(H),dieCase:(B,H)=>J(H),interruptCase:(B,H)=>Y(H),sequentialCase:(B,H,W)=>K(H,W),parallelCase:(B,H,W)=>G(H,W)})}),EB=$(3,(X,J,Z)=>{let Q=J,Y=X,G=[];while(Y!==void 0){let K=Z(Q,Y);switch(Q=R0(K)?K.value:Q,Y._tag){case Z1:{G.push(Y.right),Y=Y.left;break}case J1:{G.push(Y.right),Y=Y.left;break}default:{Y=void 0;break}}if(Y===void 0&&G.length>0)Y=G.pop()}return Q}),O$=$(3,(X,J,Z)=>{let Q=[X],Y=[];while(Q.length>0){let K=Q.pop();switch(K._tag){case IB:{Y.push(O0(Z.emptyCase(J)));break}case e2:{Y.push(O0(Z.failCase(J,K.error)));break}case t2:{Y.push(O0(Z.dieCase(J,K.defect)));break}case X1:{Y.push(O0(Z.interruptCase(J,K.fiberId)));break}case Z1:{Q.push(K.right),Q.push(K.left),Y.push(M0({_tag:a40}));break}case J1:{Q.push(K.right),Q.push(K.left),Y.push(M0({_tag:s40}));break}}}let G=[];while(Y.length>0){let K=Y.pop();switch(K._tag){case"Left":{switch(K.left._tag){case a40:{let B=G.pop(),H=G.pop(),W=Z.sequentialCase(J,B,H);G.push(W);break}case s40:{let B=G.pop(),H=G.pop(),W=Z.parallelCase(J,B,H);G.push(W);break}}break}case"Right":{G.push(K.right);break}}}if(G.length===0)throw Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return G.pop()}),sY=(X,J)=>{if(z$(X))return"All fibers interrupted without errors.";return _$(X).map(function(Z){if(J?.renderErrorCause!==!0||Z.cause===void 0)return Z.stack;return`${Z.stack} {
156
+ ${_G0(Z.cause," ")}
157
+ }`}).join(`
158
+ `)},_G0=(X,J)=>{let Z=X.stack.split(`
159
+ `),Q=`${J}[cause]: ${Z[0]}`;for(let Y=1,G=Z.length;Y<G;Y++)Q+=`
160
+ ${J}${Z[Y]}`;if(X.cause)Q+=` {
161
+ ${_G0(X.cause,`${J} `)}
162
+ ${J}}`;return Q},sf=(X)=>{let J=typeof X==="object"&&X!==null,Z=Error.stackTraceLimit;Error.stackTraceLimit=1;let Q=Error(tC(X),J&&"cause"in X&&typeof X.cause<"u"?{cause:sf(X.cause)}:void 0);if(Error.stackTraceLimit=Z,Q.message==="")Q.message="An error has occurred";if(Error.stackTraceLimit=Z,Q.name=X instanceof Error?X.name:"Error",J){if($$ in X)Q.span=X[$$];Object.keys(X).forEach((Y)=>{if(!(Y in Q))Q[Y]=X[Y]})}return Q.stack=ue0(`${Q.name}: ${Q.message}`,X instanceof Error&&X.stack?X.stack:"",Q.span),Q},tC=(X)=>{if(typeof X==="string")return X;if(typeof X==="object"&&X!==null&&X instanceof Error)return X.message;try{if(V0(X,"toString")&&dY(X.toString)&&X.toString!==Object.prototype.toString&&X.toString!==globalThis.Array.prototype.toString)return X.toString()}catch{}return HN(X)},de0=/\((.*)\)/g,tw=c0("effect/Tracer/spanToTrace",()=>new WeakMap),ue0=(X,J,Z)=>{let Q=[X],Y=J.startsWith(X)?J.slice(X.length).split(`
163
+ `):J.split(`
164
+ `);for(let G=1;G<Y.length;G++){if(Y[G].includes(" at new BaseEffectError")||Y[G].includes(" at new YieldableError")){G++;continue}if(Y[G].includes("Generator.next"))break;if(Y[G].includes("effect_internal_function"))break;Q.push(Y[G].replace(/at .*effect_instruction_i.*\((.*)\)/,"at $1").replace(/EffectPrimitive\.\w+/,"<anonymous>"))}if(Z){let G=Z,K=0;while(G&&G._tag==="Span"&&K<10){let B=tw.get(G);if(typeof B==="function"){let H=B();if(typeof H==="string"){let W=H.matchAll(de0),V=!1;for(let[,U]of W)V=!0,Q.push(` at ${G.name} (${U})`);if(!V)Q.push(` at ${G.name} (${H.replace(/^at /,"")})`)}else Q.push(` at ${G.name}`)}else Q.push(` at ${G.name}`);G=u9(G.parent),K++}}return Q.join(`
165
+ `)},$$=Symbol.for("effect/SpanAnnotation"),_$=(X)=>O$(X,void 0,{emptyCase:()=>[],dieCase:(J,Z)=>{return[sf(Z)]},failCase:(J,Z)=>{return[sf(Z)]},interruptCase:()=>[],parallelCase:(J,Z,Q)=>[...Z,...Q],sequentialCase:(J,Z,Q)=>[...Z,...Q]});var Y1="Pending",q$="Done";var ce0="effect/Deferred",eC=Symbol.for(ce0),DG0={_E:(X)=>X,_A:(X)=>X},wG0=(X)=>{return{_tag:Y1,joiners:X}},Xp=(X)=>{return{_tag:q$,effect:X}};class G1{self;called=!1;constructor(X){this.self=X}next(X){return this.called?{value:X,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(X){return{value:X,done:!0}}throw(X){throw X}[Symbol.iterator](){return new G1(this.self)}}var vB=(X,J)=>{let Z=new L7("Blocked");return Z.effect_instruction_i0=X,Z.effect_instruction_i1=J,Z},ZI=(X)=>{let J=new L7("RunBlocked");return J.effect_instruction_i0=X,J},kB=Symbol.for("effect/Effect");class Jp{patch;op;_op=Qw;constructor(X,J){this.patch=X,this.op=J}}class L7{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[kB]=FK;constructor(X){this._op=X}[b0](X){return this===X}[y0](){return W8(this,cV(this))}pipe(){return K0(this,arguments)}toJSON(){return{_id:"Effect",_op:this._op,effect_instruction_i0:H9(this.effect_instruction_i0),effect_instruction_i1:H9(this.effect_instruction_i1),effect_instruction_i2:H9(this.effect_instruction_i2)}}toString(){return u8(this.toJSON())}[$8](){return this.toJSON()}[Symbol.iterator](){return new G1(new GG(this))}}class Zp{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[kB]=FK;constructor(X){this._op=X,this._tag=X}[b0](X){return j$(X)&&X._op==="Failure"&&_0(this.effect_instruction_i0,X.effect_instruction_i0)}[y0](){return z(R8(this._tag),A0(Z0(this.effect_instruction_i0)),W8(this))}get cause(){return this.effect_instruction_i0}pipe(){return K0(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,cause:this.cause.toJSON()}}toString(){return u8(this.toJSON())}[$8](){return this.toJSON()}[Symbol.iterator](){return new G1(new GG(this))}}class Qp{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[kB]=FK;constructor(X){this._op=X,this._tag=X}[b0](X){return j$(X)&&X._op==="Success"&&_0(this.effect_instruction_i0,X.effect_instruction_i0)}[y0](){return z(R8(this._tag),A0(Z0(this.effect_instruction_i0)),W8(this))}get value(){return this.effect_instruction_i0}pipe(){return K0(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,value:H9(this.value)}}toString(){return u8(this.toJSON())}[$8](){return this.toJSON()}[Symbol.iterator](){return new G1(new GG(this))}}var b9=(X)=>V0(X,kB),M8=(X)=>{let J=new L7($j);return J.effect_instruction_i0=X,J},oN=$(3,(X,J,Z)=>kX((Q)=>p(X,(Y)=>p(B6(I0(()=>Q(J(Y)))),(G)=>{return I0(()=>Z(Y,G)).pipe(K6({onFailure:(K)=>{switch(G._tag){case DX:return W9(OX(G.effect_instruction_i0,K));case wX:return W9(K)}},onSuccess:()=>G}))})))),l9=$(2,(X,J)=>p(X,()=>o(J))),AX=(X)=>l9(X,void 0),WL=function(){let X=new L7(WB);switch(arguments.length){case 2:{X.effect_instruction_i0=arguments[0],X.commit=arguments[1];break}case 3:{X.effect_instruction_i0=arguments[0],X.effect_instruction_i1=arguments[1],X.commit=arguments[2];break}case 4:{X.effect_instruction_i0=arguments[0],X.effect_instruction_i1=arguments[1],X.effect_instruction_i2=arguments[2],X.commit=arguments[3];break}default:throw Error(mV("you're not supposed to end up here"))}return X},rN=(X,J=d7)=>{let Z=new L7(pV),Q=void 0;return Z.effect_instruction_i0=(Y)=>{Q=X(Y)},Z.effect_instruction_i1=J,sZ(Z,(Y)=>b9(Q)?Q:N8)},fK=(X,J=d7)=>I0(()=>rN(X,J)),rZ=(X,J=d7)=>{return WL(X,function(){let Z=void 0,Q=void 0;function Y(H){if(Z)Z(H);else if(Q===void 0)Q=H}let G=new L7(pV);G.effect_instruction_i0=(H)=>{if(Z=H,Q)H(Q)},G.effect_instruction_i1=J;let K=void 0,B=void 0;if(this.effect_instruction_i0.length!==1)B=new AbortController,K=JX(()=>this.effect_instruction_i0(Y,B.signal));else K=JX(()=>this.effect_instruction_i0(Y));return K||B?sZ(G,(H)=>{if(B)B.abort();return K??N8}):G})};var pK=$(2,(X,J)=>{let Z=new L7(VN);return Z.effect_instruction_i0=X,Z.effect_instruction_i1=J,Z}),tY=$(2,(X,J)=>YJ(X,{onFailure:J,onSuccess:o})),VL=$(3,(X,J,Z)=>pK(X,(Q)=>{let Y=NG(Q);switch(Y._tag){case"Left":return J(Y.left)?Z(Y.left):W9(Q);case"Right":return W9(Y.right)}})),FG0=$(2,(X,J)=>pK(X,(Z)=>{let Q=NG(Z);switch(Q._tag){case"Left":return z(J(Q.left),i0(()=>W9(Z)));case"Right":return W9(Q.right)}})),AG0=(X)=>M8((J,Z)=>X(mN(Z.runtimeFlags))),XI=Symbol.for("effect/OriginalAnnotation"),TG0=(X)=>{if(V0(X,XI))return X[XI];return X},QI=(X,J)=>{if(R0(J))return new Proxy(X,{has(Z,Q){return Q===$$||Q===XI||Q in Z},get(Z,Q){if(Q===$$)return J.value;if(Q===XI)return X;return Z[Q]}});return X},aZ=(X)=>c6(X)&&!($$ in X)?M8((J)=>W9(k6(QI(X,AI(J))))):W9(k6(X)),K1=(X)=>bB(()=>k6(new zp(X))),B1=(X)=>p(B0(X),aZ),Q4=(X)=>YJ(X,{onFailure:(J)=>o(M0(J)),onSuccess:(J)=>o(O0(J))}),B6=(X)=>$L(X,{onFailure:L9,onSuccess:M9}),p8=(X)=>c6(X)&&!($$ in X)?M8((J)=>W9(GY(QI(X,AI(J))))):W9(GY(X)),Y4=(X)=>p(B0(X),p8),W9=(X)=>{let J=new Zp(DX);return J.effect_instruction_i0=X,J},bB=(X)=>p(B0(X),W9),G4=M8((X)=>o(X.id())),KY=(X)=>M8((J)=>X(J.id())),p=$(2,(X,J)=>{let Z=new L7($N);return Z.effect_instruction_i0=X,Z.effect_instruction_i1=J,Z}),H1=$(2,(X,J)=>p(X,(Z)=>{let Q=typeof J==="function"?J(Z):J;if(b9(Q))return Q;else if(eu(Q))return rN((Y)=>{Q.then((G)=>Y(o(G)),(G)=>Y(p8(new R$(G,"An unknown error occurred in Effect.andThen"))))});return o(Q)})),YI=(X)=>{let J=new L7("OnStep");return J.effect_instruction_i0=X,J},BY=(X)=>p(X,t),W1=(X)=>YJ(X,{onFailure:o,onSuccess:p8}),$L=$(2,(X,J)=>K6(X,{onFailure:(Z)=>o(J.onFailure(Z)),onSuccess:(Z)=>o(J.onSuccess(Z))})),K6=$(2,(X,J)=>{let Z=new L7(UN);return Z.effect_instruction_i0=X,Z.effect_instruction_i1=J.onFailure,Z.effect_instruction_i2=J.onSuccess,Z}),YJ=$(2,(X,J)=>K6(X,{onFailure:(Z)=>{if(lN(Z).length>0)return W9(WG0(Z));let Y=pN(Z);if(Y.length>0)return J.onFailure(kK(Y));return W9(Z)},onSuccess:J.onSuccess})),DZ=$(2,(X,J)=>I0(()=>{let Z=v0(X),Q=CK(Z.length),Y=0;return l9(U1({while:()=>Y<Z.length,body:()=>J(Z[Y],Y),step:(G)=>{Q[Y++]=G}}),Q)})),AQ=$(2,(X,J)=>I0(()=>{let Z=v0(X),Q=0;return U1({while:()=>Q<Z.length,body:()=>J(Z[Q],Q),step:()=>{Q++}})})),GI=$((X)=>typeof X[0]==="boolean"||b9(X[0]),(X,J)=>b9(X)?p(X,(Z)=>Z?J.onTrue():J.onFalse()):X?J.onTrue():J.onFalse()),nX=p(G4,(X)=>UL(X)),UL=(X)=>W9(cJ(X)),OG=(X)=>{let J=new L7(VB);return J.effect_instruction_i0=uf(rY),J.effect_instruction_i1=()=>X,J},KI=(X)=>WL(X,function(){let J=new L7(VB);return J.effect_instruction_i0=uf(rY),J.effect_instruction_i1=(Z)=>mN(Z)?JX(()=>this.effect_instruction_i0(OG)):JX(()=>this.effect_instruction_i0(MQ)),J}),lK=$(2,(X,J)=>kX((Z)=>p(B6(Z(X)),(Q)=>ML(J,Q)))),N0=$(2,(X,J)=>p(X,(Z)=>B0(()=>J(Z)))),zL=$(2,(X,J)=>YJ(X,{onFailure:(Z)=>Y4(()=>J.onFailure(Z)),onSuccess:(Z)=>B0(()=>J.onSuccess(Z))})),V1=$(2,(X,J)=>K6(X,{onFailure:(Z)=>{let Q=NG(Z);switch(Q._tag){case"Left":return Y4(()=>J(Q.left));case"Right":return W9(Q.right)}},onSuccess:o})),BI=$(2,(X,J)=>TQ(X,(Z)=>TL(Z)?N8:J(Z.effect_instruction_i0))),TQ=$(2,(X,J)=>kX((Z)=>K6(Z(X),{onFailure:(Q)=>{let Y=L9(Q);return K6(J(Y),{onFailure:(G)=>L9(OX(Q,G)),onSuccess:()=>Y})},onSuccess:(Q)=>{let Y=M9(Q);return i8(J(Y),Y)}}))),sZ=$(2,(X,J)=>TQ(X,E$({onFailure:(Z)=>z$(Z)?AX(J(N$(Z))):N8,onSuccess:()=>N8}))),D$=$(2,(X,J)=>fe0(X,J,o)),w$=(X)=>Yp(X,t),Yp=$(2,(X,J)=>YJ(X,{onFailure:(Z)=>aZ(J(Z)),onSuccess:o})),MG0=TN,aN=M8((X,J)=>o(J.runtimeFlags)),o=(X)=>{let J=new Qp(wX);return J.effect_instruction_i0=X,J},I0=(X)=>{let J=new L7(WB);return J.commit=X,J},B0=(X)=>{let J=new L7(Vj);return J.effect_instruction_i0=X,J},i6=$((X)=>X.length===3||X.length===2&&!(c6(X[1])&&("onlyEffect"in X[1])),(X,J)=>p(X,(Z)=>{let Q=typeof J==="function"?J(Z):J;if(b9(Q))return l9(Q,Z);else if(eu(Q))return rN((Y)=>{Q.then((G)=>Y(o(Z)),(G)=>Y(p8(new R$(G,"An unknown error occurred in Effect.tap"))))});return o(Z)})),HI=(X)=>M8((J)=>{let Z=J.getFiberRef(JL),Q=z(Z,i0(()=>J.scope()));return X(iX(JL,I(Q)))}),fe0=$(3,(X,J,Z)=>K6(X,{onFailure:(Q)=>{if(lN(Q).length>0)return W9(lY(BG0(Q)));return J()},onSuccess:Z})),MQ=(X)=>{let J=new L7(VB);return J.effect_instruction_i0=cf(rY),J.effect_instruction_i1=()=>X,J},kX=(X)=>WL(X,function(){let J=new L7(VB);return J.effect_instruction_i0=cf(rY),J.effect_instruction_i1=(Z)=>mN(Z)?JX(()=>this.effect_instruction_i0(OG)):JX(()=>this.effect_instruction_i0(MQ)),J}),N8=o(void 0);var $1=(X)=>{let J=new L7(VB);return J.effect_instruction_i0=X,J.effect_instruction_i1=void 0,J},_G=$(2,(X,J)=>p(J,(Z)=>{if(Z)return z(X,N0(I));return o(S())})),U1=(X)=>{let J=new L7(zN);return J.effect_instruction_i0=X.while,J.effect_instruction_i1=X.body,J.effect_instruction_i2=X.step,J},XL=(X)=>I0(()=>{let J=new L7(lV);return J.effect_instruction_i0=X(),J}),WI=function(){let X=arguments.length===1?arguments[0]:arguments[1].bind(arguments[0]);return XL(()=>X(z))},yB=(X,...J)=>Object.defineProperty(J.length===0?function(...Z){return XL(()=>X.apply(this,Z))}:function(...Z){let Q=XL(()=>X.apply(this,Z));for(let Y of J)Q=Y(Q,...Z);return Q},"length",{value:X.length,configurable:!0}),PG0=$(2,(X,J)=>iX(X,DL,J)),RG0=$(2,(X,J)=>iX(X,tN,J)),VI=$(2,(X,J)=>{let Z=new L7(VB);return Z.effect_instruction_i0=J,Z.effect_instruction_i1=()=>X,Z}),jG0=$(2,(X,J)=>iX(X,A$,J)),CG0=$(2,(X,J)=>iX(X,aK,J)),nK=(X)=>{let J=new L7(NN);return typeof X?.priority<"u"?$p(J,X.priority):J},L$=$(2,(X,J)=>p(X,(Z)=>N0(J,(Q)=>[Z,Q])));var F$=$(2,(X,J)=>p(X,(Z)=>l9(J,Z))),i8=$(2,(X,J)=>p(X,()=>J)),iK=$(3,(X,J,Z)=>p(X,(Q)=>N0(J,(Y)=>Z(Q,Y)))),z1=fK(()=>{let X=setInterval(()=>{},2147483647);return B0(()=>clearInterval(X))}),qG=(X)=>p(G4,(J)=>z(X,HY(J))),HY=$(2,(X,J)=>p(X.interruptAsFork(J),()=>X.await)),Gp={_tag:"All",syslog:0,label:"ALL",ordinal:Number.MIN_SAFE_INTEGER,pipe(){return K0(this,arguments)}},Kp={_tag:"Fatal",syslog:2,label:"FATAL",ordinal:50000,pipe(){return K0(this,arguments)}},Bp={_tag:"Error",syslog:3,label:"ERROR",ordinal:40000,pipe(){return K0(this,arguments)}},$I={_tag:"Warning",syslog:4,label:"WARN",ordinal:30000,pipe(){return K0(this,arguments)}},sN={_tag:"Info",syslog:6,label:"INFO",ordinal:20000,pipe(){return K0(this,arguments)}},UI={_tag:"Debug",syslog:7,label:"DEBUG",ordinal:1e4,pipe(){return K0(this,arguments)}},Hp={_tag:"Trace",syslog:7,label:"TRACE",ordinal:0,pipe(){return K0(this,arguments)}},Wp={_tag:"None",syslog:7,label:"OFF",ordinal:Number.MAX_SAFE_INTEGER,pipe(){return K0(this,arguments)}},zI=[Gp,Hp,UI,sN,$I,Bp,Kp,Wp],pe0="effect/FiberRef",IG0=Symbol.for(pe0),le0={_A:(X)=>X},PQ=(X)=>M8((J)=>M9(J.getFiberRef(X)));var DJ=$(2,(X,J)=>p(PQ(X),J)),xB=$(2,(X,J)=>EG0(X,()=>[void 0,J]));var EG0=$(2,(X,J)=>M8((Z)=>{let[Q,Y]=J(Z.getFiberRef(X));return Z.setFiberRef(X,Y),o(Q)}));var iX=$(3,(X,J,Z)=>oN(F$(PQ(J),xB(J,Z)),()=>X,(Q)=>xB(J,Q))),GJ=$(3,(X,J,Z)=>DJ(J,(Q)=>iX(X,J,Z(Q)))),_6=(X,J)=>N1(X,{differ:yC(),fork:J?.fork??t,join:J?.join}),Vp=(X)=>{let J=kf();return N1(X,{differ:J,fork:J.empty})},ne0=(X)=>{let J=bf(yC());return N1(X,{differ:J,fork:J.empty})},NL=(X)=>{let J=vf();return N1(X,{differ:J,fork:J.empty})},N1=(X,J)=>{return{...KG,[IG0]:le0,initial:X,commit(){return PQ(this)},diff:(Q,Y)=>J.differ.diff(Q,Y),combine:(Q,Y)=>J.differ.combine(Q,Y),patch:(Q)=>(Y)=>J.differ.patch(Q,Y),fork:J.fork,join:J.join??((Q,Y)=>Y)}},SG0=(X)=>N1(X,{differ:lC,fork:lC.empty}),F7=c0(Symbol.for("effect/FiberRef/currentContext"),()=>NL(jX())),DG=c0(Symbol.for("effect/FiberRef/currentSchedulingPriority"),()=>_6(0)),OL=c0(Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"),()=>_6(2048)),oK=c0(Symbol.for("effect/FiberRef/currentLogAnnotation"),()=>_6(qZ())),_L=c0(Symbol.for("effect/FiberRef/currentLogLevel"),()=>_6(sN)),qL=c0(Symbol.for("effect/FiberRef/currentLogSpan"),()=>_6(Z4())),$p=$(2,(X,J)=>iX(X,DG,J)),xG0=$(2,(X,J)=>iX(X,OL,J)),DL=c0(Symbol.for("effect/FiberRef/currentConcurrency"),()=>_6("unbounded")),tN=c0(Symbol.for("effect/FiberRef/currentRequestBatching"),()=>_6(!0)),eN=c0(Symbol.for("effect/FiberRef/currentUnhandledErrorLogLevel"),()=>_6(I(UI))),wL=c0(Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"),()=>_6(I($I))),vG0=$(2,(X,J)=>iX(X,eN,J)),rK=c0(Symbol.for("effect/FiberRef/currentMetricLabels"),()=>ne0(l0())),kG0=PQ(rK),JL=c0(Symbol.for("effect/FiberRef/currentForkScopeOverride"),()=>_6(S(),{fork:()=>S(),join:(X,J)=>X})),O1=c0(Symbol.for("effect/FiberRef/currentInterruptedCause"),()=>_6(c7,{fork:()=>c7,join:(X,J)=>X})),A$=c0(Symbol.for("effect/FiberRef/currentTracerEnabled"),()=>_6(!0)),aK=c0(Symbol.for("effect/FiberRef/currentTracerTiming"),()=>_6(!0)),T$=c0(Symbol.for("effect/FiberRef/currentTracerSpanAnnotations"),()=>_6(qZ())),LL=c0(Symbol.for("effect/FiberRef/currentTracerSpanLinks"),()=>_6(a0())),FL=Symbol.for("effect/Scope"),AL=Symbol.for("effect/CloseableScope"),XO=(X,J)=>X.addFinalizer(()=>AX(J)),_1=(X,J)=>X.addFinalizer(J),RQ=(X,J)=>X.close(J),eY=(X,J)=>X.fork(J),bG0=(X)=>{return Up(t)(X)},Up=$(2,(X,J)=>{let Z=z(X,nN,r8(J));switch(Z._tag){case"None":return z(lN(X),$G,w0({onNone:()=>{let Q=v0(N$(X)).flatMap((Y)=>v0(hw(Y)).map((G)=>`#${G}`));return new Np(Q?`Interrupted by fibers: ${Q.join(", ")}`:void 0)},onSome:t}));case"Some":return Z.value}}),JO=function(){class X extends globalThis.Error{commit(){return p8(this)}toJSON(){let J={...this};if(this.message)J.message=this.message;if(this.cause)J.cause=this.cause;return J}[$8](){if(this.toString!==globalThis.Error.prototype.toString)return this.stack?`${this.toString()}
166
+ ${this.stack.split(`
167
+ `).slice(1).join(`
168
+ `)}`:this.toString();else if("Bun"in globalThis)return sY(GY(this),{renderErrorCause:!0});return this}}return Object.assign(X.prototype,Uj),X}(),M$=(X,J)=>{class Z extends JO{_tag=J}return Object.assign(Z.prototype,X),Z.prototype.name=J,Z},ZL=Symbol.for("effect/Cause/errors/RuntimeException"),zp=M$({[ZL]:ZL},"RuntimeException"),yG0=(X)=>V0(X,ZL),QL=Symbol.for("effect/Cause/errors/InterruptedException"),Np=M$({[QL]:QL},"InterruptedException"),NI=(X)=>V0(X,QL),YL=Symbol.for("effect/Cause/errors/IllegalArgument"),P$=M$({[YL]:YL},"IllegalArgumentException"),gG0=(X)=>V0(X,YL),GL=Symbol.for("effect/Cause/errors/NoSuchElement"),wZ=M$({[GL]:GL},"NoSuchElementException"),OI=(X)=>V0(X,GL),JI=Symbol.for("effect/Cause/errors/InvalidPubSubCapacityException"),hG0=M$({[JI]:JI},"InvalidPubSubCapacityException"),KL=Symbol.for("effect/Cause/errors/ExceededCapacityException"),_I=M$({[KL]:KL},"ExceededCapacityException"),mG0=(X)=>V0(X,KL);var BL=Symbol.for("effect/Cause/errors/Timeout"),Op=M$({[BL]:BL},"TimeoutException"),dG0=(X)=>new Op(`Operation timed out after '${KC(X)}'`),uG0=(X)=>V0(X,BL),HL=Symbol.for("effect/Cause/errors/UnknownException"),R$=function(){class X extends JO{_tag="UnknownException";error;constructor(J,Z){super(Z??"An unknown error occurred",{cause:J});this.error=J}}return Object.assign(X.prototype,{[HL]:HL,name:"UnknownException"}),X}(),cG0=(X)=>V0(X,HL),j$=(X)=>b9(X)&&("_tag"in X)&&(X._tag==="Success"||X._tag==="Failure"),qI=(X)=>X._tag==="Failure",TL=(X)=>X._tag==="Success",fG0=(X)=>{switch(X._tag){case DX:return fN(X.effect_instruction_i0);case wX:return!1}},C$=$(2,(X,J)=>{switch(X._tag){case DX:return L9(X.effect_instruction_i0);case wX:return M9(J)}}),ZO=(X)=>C$(X,void 0),pG0=(X)=>{switch(X._tag){case DX:return I(X.effect_instruction_i0);case wX:return S()}},q1=(X,J)=>ie0(X,J?.parallel?B7:OX),DI=(X)=>L9(k6(X)),lG0=$(2,(X,J)=>{switch(X._tag){case DX:return!1;case wX:return J(X.effect_instruction_i0)}}),wG=(X)=>L9(GY(X)),L9=(X)=>{let J=new Zp(DX);return J.effect_instruction_i0=X,J},_p=$(2,(X,J)=>{switch(X._tag){case DX:return L9(X.effect_instruction_i0);case wX:return J(X.effect_instruction_i0)}}),nG0=$(2,(X,J)=>{switch(X._tag){case DX:return o(L9(X.effect_instruction_i0));case wX:return J(X.effect_instruction_i0)}}),iG0=(X)=>z(X,_p(t)),oG0=$(2,(X,J)=>{switch(X._tag){case DX:return o(L9(X.effect_instruction_i0));case wX:return B6(J(X.effect_instruction_i0))}}),rG0=(X)=>{switch(X._tag){case"Left":return wG(X.left);case"Right":return M9(X.right)}},aG0=(X)=>{switch(X._tag){case"None":return wG(void 0);case"Some":return M9(X.value)}},sG0=$(2,(X,J)=>{switch(X._tag){case DX:return J(X.effect_instruction_i0);case wX:return X.effect_instruction_i0}}),I$=(X)=>L9(cJ(X)),ew=$(2,(X,J)=>{switch(X._tag){case DX:return L9(X.effect_instruction_i0);case wX:return M9(J(X.effect_instruction_i0))}}),tG0=$(2,(X,{onFailure:J,onSuccess:Z})=>{switch(X._tag){case DX:return L9(z(X.effect_instruction_i0,iN(J)));case wX:return M9(Z(X.effect_instruction_i0))}}),eG0=$(2,(X,J)=>{switch(X._tag){case DX:return L9(z(X.effect_instruction_i0,iN(J)));case wX:return M9(X.effect_instruction_i0)}}),XK0=$(2,(X,J)=>{switch(X._tag){case DX:return L9(J(X.effect_instruction_i0));case wX:return M9(X.effect_instruction_i0)}}),E$=$(2,(X,{onFailure:J,onSuccess:Z})=>{switch(X._tag){case DX:return J(X.effect_instruction_i0);case wX:return Z(X.effect_instruction_i0)}}),S$=$(2,(X,{onFailure:J,onSuccess:Z})=>{switch(X._tag){case DX:return J(X.effect_instruction_i0);case wX:return Z(X.effect_instruction_i0)}}),M9=(X)=>{let J=new Qp(wX);return J.effect_instruction_i0=X,J},oX=M9(void 0),JK0=$(2,(X,J)=>K4(X,J,{onSuccess:(Z,Q)=>[Z,Q],onFailure:OX})),ZK0=$(2,(X,J)=>K4(X,J,{onSuccess:(Z,Q)=>Z,onFailure:OX})),wI=$(2,(X,J)=>K4(X,J,{onSuccess:(Z,Q)=>Q,onFailure:OX})),QK0=$(2,(X,J)=>K4(X,J,{onSuccess:(Z,Q)=>[Z,Q],onFailure:B7})),YK0=$(2,(X,J)=>K4(X,J,{onSuccess:(Z,Q)=>Z,onFailure:B7})),GK0=$(2,(X,J)=>K4(X,J,{onSuccess:(Z,Q)=>Q,onFailure:B7})),K4=$(3,(X,J,{onFailure:Z,onSuccess:Q})=>{switch(X._tag){case DX:switch(J._tag){case wX:return L9(X.effect_instruction_i0);case DX:return L9(Z(X.effect_instruction_i0,J.effect_instruction_i0))}case wX:switch(J._tag){case wX:return M9(Q(X.effect_instruction_i0,J.effect_instruction_i0));case DX:return L9(J.effect_instruction_i0)}}}),ie0=(X,J)=>{let Z=f9(X);if(!FX(Z))return S();return z(_Z(Z),OJ(z(qJ(Z),ew(m0)),(Q,Y)=>z(Q,K4(Y,{onSuccess:(G,K)=>z(G,LX(K)),onFailure:J}))),ew(ZY),ew((Q)=>G9(Q)),I)},LG=(X)=>{return{...KG,[eC]:DG0,state:uJ(wG0([])),commit(){return IX(this)},blockingOn:X}},f7=()=>p(G4,(X)=>KK0(X)),KK0=(X)=>B0(()=>LG(X)),IX=(X)=>fK((J)=>{let Z=O9(X.state);switch(Z._tag){case q$:return J(Z.effect);case Y1:return Z.joiners.push(J),oe0(X,J)}},X.blockingOn),LI=$(2,(X,J)=>lK(J,X)),x$=$(2,(X,J)=>B0(()=>{let Z=O9(X.state);switch(Z._tag){case q$:return!1;case Y1:{oZ(X.state,Xp(J));for(let Q=0,Y=Z.joiners.length;Q<Y;Q++)Z.joiners[Q](J);return!0}}})),ML=$(2,(X,J)=>x$(X,J)),BK0=$(2,(X,J)=>x$(X,p8(J)));var QO=$(2,(X,J)=>x$(X,W9(J)));var HK0=(X)=>p(G4,(J)=>x$(X,UL(J))),v$=$(2,(X,J)=>x$(X,UL(J))),WK0=(X)=>B0(()=>O9(X.state)._tag===q$),VK0=(X)=>B0(()=>{let J=O9(X.state);switch(J._tag){case q$:return I(J.effect);case Y1:return S()}}),gB=$(2,(X,J)=>x$(X,o(J)));var sK=(X,J)=>{let Z=O9(X.state);if(Z._tag===Y1){oZ(X.state,Xp(J));for(let Q=0,Y=Z.joiners.length;Q<Y;Q++)Z.joiners[Q](J)}},oe0=(X,J)=>B0(()=>{let Z=O9(X.state);if(Z._tag===Y1){let Q=Z.joiners.indexOf(J);if(Q>=0)Z.joiners.splice(Q,1)}}),re0=M8((X)=>M9(X.currentContext)),WY=()=>re0;var B4=(X)=>p(WY(),X),X5=$(2,(X,J)=>iX(F7,J)(X)),FI=$(2,(X,J)=>GJ(F7,(Z)=>CX(Z,J))(X)),hB=$(2,(X,J)=>B4((Z)=>X5(X,J(Z)))),qp=$(2,(X,J)=>p(X,(Z)=>p(J.predicate(Z),(Q)=>Q?o(Z):J.orElse(Z)))),$K0=$(2,(X,J)=>qp(X,{predicate:J.predicate,orElse:(Z)=>p8(J.orFailWith(Z))})),AI=(X)=>{let J=X.currentSpan;return J!==void 0&&J._tag==="Span"?I(J):S()},ae0={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:BigInt(0),endTime:BigInt(0),exit:oX},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},UK0=(X)=>Object.assign(Object.create(ae0),X);var se0="effect/Clock",Dp=Symbol.for(se0),jQ=g8("effect/Clock"),te0=2147483647,zK0={unsafeSchedule(X,J){let Z=K7(J);if(Z>te0)return C6;let Q=!1,Y=setTimeout(()=>{Q=!0,X()},Z);return()=>{return clearTimeout(Y),!Q}}},NK0=function(){let X=BigInt(1e6);if(typeof performance>"u"||typeof performance.now!=="function")return()=>BigInt(Date.now())*X;let J;return()=>{if(J===void 0)J=BigInt(Date.now())*X-BigInt(Math.round(performance.now()*1e6));return J+BigInt(Math.round(performance.now()*1e6))}}(),ee0=function(){let X=typeof process==="object"&&"hrtime"in process&&typeof process.hrtime.bigint==="function"?process.hrtime:void 0;if(!X)return NK0;let J=NK0()-X.bigint();return()=>J+X.bigint()}();class OK0{[Dp]=Dp;unsafeCurrentTimeMillis(){return Date.now()}unsafeCurrentTimeNanos(){return ee0()}currentTimeMillis=B0(()=>this.unsafeCurrentTimeMillis());currentTimeNanos=B0(()=>this.unsafeCurrentTimeNanos());scheduler(){return o(zK0)}sleep(X){return rZ((J)=>{let Z=zK0.unsafeSchedule(()=>J(N8),X);return AX(B0(Z))})}}var wp=()=>new OK0;var tZ=Uw;var TI=NB(tZ);var _K0=RK(tZ);var qK0=(X)=>tZ(X,0),DK0=$(2,(X,J)=>{let Z=(X.toString().split(".")[1]||"").length,Q=(J.toString().split(".")[1]||"").length,Y=Z>Q?Z:Q,G=parseInt(X.toFixed(Y).replace(".","")),K=parseInt(J.toFixed(Y).replace(".",""));return G%K/Math.pow(10,Y)}),wK0=(X)=>{let J=Math.ceil(Math.log(X)/Math.log(2));return Math.max(Math.pow(2,J),2)},LK0=(X)=>{if(X==="NaN")return XJ(NaN);if(X==="Infinity")return XJ(1/0);if(X==="-Infinity")return XJ(-1/0);if(X.trim()==="")return tQ;let J=Number(X);return Number.isNaN(J)?tQ:XJ(J)},FK0=$(2,(X,J)=>{let Z=Math.pow(10,J);return Math.round(X*Z)/Z});var YO=(X)=>X.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");var TK0={_tag:"Empty"};var MI=$(2,(X,J)=>{let Z=RB(J),Q=X;while(W$(Z)){let Y=Z.head;switch(Y._tag){case"Empty":{Z=Z.tail;break}case"AndThen":{Z=u7(Y.first,u7(Y.second,Z.tail));break}case"MapName":{Q=n0(Q,Y.f),Z=Z.tail;break}case"Nested":{Q=zZ(Q,Y.name),Z=Z.tail;break}case"Unnested":{if(z(mJ(Q),Fc(Y.name)))Q=n6(Q),Z=Z.tail;else return M0(o5(Q,`Expected ${Y.name} to be in path in ConfigProvider#unnested`));break}}}return O0(Q)});var PI="Constant",RI="Fail",PL="Fallback",jI="Described",CI="Lazy",II="MapOrFail",EI="Nested",SI="Primitive",xI="Sequence",vI="HashMap",kI="ZipWith";var bI=(X,J)=>[...X,...J],J08="effect/ConfigProvider",PK0=Symbol.for(J08),GO=g8("effect/ConfigProvider"),Z08="effect/ConfigProviderFlat",RK0=Symbol.for(Z08),Q08=(X)=>({[PK0]:PK0,pipe(){return K0(this,arguments)},...X}),Y08=(X)=>({[RK0]:RK0,patch:X.patch,load:(J,Z,Q=!0)=>X.load(J,Z,Q),enumerateChildren:X.enumerateChildren}),G08=(X)=>Q08({load:(J)=>p(H4(X,l0(),J,!1),(Z)=>w0(mJ(Z),{onNone:()=>p8(o5(l0(),`Expected a single value having structure: ${J}`)),onSome:o})),flattened:X}),jK0=(X)=>{let{pathDelim:J,seqDelim:Z}=Object.assign({},{pathDelim:"_",seqDelim:","},X),Q=(H)=>z(H,s8(J)),Y=(H)=>H.split(J),G=()=>typeof process<"u"&&("env"in process)&&typeof process.env==="object"?process.env:{};return G08(Y08({load:(H,W,V=!0)=>{let U=Q(H),O=G(),q=U in O?I(O[U]):S();return z(q,V1(()=>o5(H,`Expected ${U} to exist in the process context`)),p((L)=>V08(L,H,W,Z,V)))},enumerateChildren:(H)=>B0(()=>{let W=G(),O=Object.keys(W).map((q)=>Y(q.toUpperCase())).filter((q)=>{for(let L=0;L<H.length;L++){let A=z(H,oV(L)),M=q[L];if(M===void 0||A!==M)return!1}return!0}).flatMap((q)=>q.slice(H.length,H.length+1));return X4(O)}),patch:TK0}))};var K08=(X,J,Z,Q)=>{let Y=vj(Z.length,(H)=>H>=Q.length?S():I([X(H),H+1])),G=vj(Q.length,(H)=>H>=Z.length?S():I([J(H),H+1])),K=bI(Z,Y),B=bI(Q,G);return[K,B]},B08=(X,J)=>{let Z=J;if(Z._tag==="Nested"){let Q=X.slice();while(Z._tag==="Nested")Q.push(Z.name),Z=Z.config;return Q}return X},H4=(X,J,Z,Q)=>{let Y=Z;switch(Y._tag){case PI:return o(X8(Y.value));case jI:return I0(()=>H4(X,J,Y.config,Q));case RI:return p8(o5(J,Y.message));case PL:return z(I0(()=>H4(X,J,Y.first,Q)),tY((G)=>{if(Y.condition(G))return z(H4(X,J,Y.second,Q),tY((K)=>p8(cj(G,K))));return p8(G)}));case CI:return I0(()=>H4(X,J,Y.config(),Q));case II:return I0(()=>z(H4(X,J,Y.original,Q),p(DZ((G)=>z(Y.mapOrFail(G),V1(wB(B08(J,Y.original))))))));case EI:return I0(()=>H4(X,bI(J,X8(Y.name)),Y.config,Q));case SI:return z(MI(J,X.patch),p((G)=>z(X.load(G,Y,Q),p((K)=>{if(K.length===0){let B=z(zw(G),i0(()=>"<n/a>"));return p8(o5([],`Expected ${Y.description} with name ${B}`))}return o(K)}))));case xI:return z(MI(J,X.patch),p((G)=>z(X.enumerateChildren(G),p(U08),p((K)=>{if(K.length===0)return I0(()=>N0(H4(X,J,Y.config,!0),X8));return z(DZ(K,(B)=>H4(X,lX(J,`[${B}]`),Y.config,!0)),N0((B)=>{let H=aV(B);if(H.length===0)return X8(l0());return X8(H)}))}))));case vI:return I0(()=>z(MI(J,X.patch),p((G)=>z(X.enumerateChildren(G),p((K)=>{return z(K,DZ((B)=>H4(X,bI(G,X8(B)),Y.valueConfig,Q)),N0((B)=>{if(B.length===0)return X8(qZ());return z($08(B),n0((H)=>J4(Cj(v0(K),H))))}))})))));case kI:return I0(()=>z(H4(X,J,Y.left,Q),Q4,p((G)=>z(H4(X,J,Y.right,Q),Q4,p((K)=>{if(U9(G)&&U9(K))return p8(uj(G.left,K.left));if(U9(G)&&NJ(K))return p8(G.left);if(NJ(G)&&U9(K))return p8(K.left);if(NJ(G)&&NJ(K)){let B=z(J,s8(".")),H=H08(J,B),[W,V]=K08(H,H,z(G.right,n0(O0)),z(K.right,n0(O0)));return z(W,Cj(V),DZ(([U,O])=>z(L$(U,O),N0(([q,L])=>Y.zip(q,L)))))}throw Error("BUG: ConfigProvider.fromFlatLoop - please report an issue at https://github.com/Effect-TS/effect/issues")})))))}},H08=(X,J)=>(Z)=>M0(o5(X,`The element at index ${Z} in a sequence at path "${J}" was missing`));var W08=(X,J)=>{return X.split(new RegExp(`\\s*${YO(J)}\\s*`))},V08=(X,J,Z,Q,Y)=>{if(!Y)return z(Z.parse(X),zL({onFailure:wB(J),onSuccess:X8}));return z(W08(X,Q),DZ((G)=>Z.parse(G.trim())),V1(wB(J)))},$08=(X)=>{return Object.keys(X[0]).map((J)=>X.map((Z)=>Z[J]))},U08=(X)=>z(DZ(X,N08),zL({onFailure:()=>l0(),onSuccess:NZ(tZ)}),Q4,N0(nV));var z08=/^(\[(\d+)\])$/,N08=(X)=>{let J=X.match(z08);if(J!==null){let Z=J[2];return z(Z!==void 0&&Z.length>0?I(Z):S(),pX(O08))}return S()};var O08=(X)=>{let J=Number.parseInt(X);return Number.isNaN(J)?S():I(J)};var yI=Symbol.for("effect/Console"),LZ=g8("effect/Console"),CK0={[yI]:yI,assert(X,...J){return B0(()=>{console.assert(X,...J)})},clear:B0(()=>{console.clear()}),count(X){return B0(()=>{console.count(X)})},countReset(X){return B0(()=>{console.countReset(X)})},debug(...X){return B0(()=>{console.debug(...X)})},dir(X,J){return B0(()=>{console.dir(X,J)})},dirxml(...X){return B0(()=>{console.dirxml(...X)})},error(...X){return B0(()=>{console.error(...X)})},group(X){return X?.collapsed?B0(()=>console.groupCollapsed(X?.label)):B0(()=>console.group(X?.label))},groupEnd:B0(()=>{console.groupEnd()}),info(...X){return B0(()=>{console.info(...X)})},log(...X){return B0(()=>{console.log(...X)})},table(X,J){return B0(()=>{console.table(X,J)})},time(X){return B0(()=>console.time(X))},timeEnd(X){return B0(()=>console.timeEnd(X))},timeLog(X,...J){return B0(()=>{console.timeLog(X,...J)})},trace(...X){return B0(()=>{console.trace(...X)})},warn(...X){return B0(()=>{console.warn(...X)})},unsafe:console};var q08="effect/Random",KO=Symbol.for(q08),tK=g8("effect/Random");class IK0{seed;[KO]=KO;PRNG;constructor(X){this.seed=X,this.PRNG=new Zc(X)}get next(){return B0(()=>this.PRNG.number())}get nextBoolean(){return N0(this.next,(X)=>X>0.5)}get nextInt(){return B0(()=>this.PRNG.integer(Number.MAX_SAFE_INTEGER))}nextRange(X,J){return N0(this.next,(Z)=>(J-X)*Z+X)}nextIntBetween(X,J){return B0(()=>this.PRNG.integer(J-X)+X)}shuffle(X){return EK0(X,(J)=>this.nextIntBetween(0,J))}}var EK0=(X,J)=>{return I0(()=>z(B0(()=>Array.from(X)),p((Z)=>{let Q=[];for(let Y=Z.length;Y>=2;Y=Y-1)Q.push(Y);return z(Q,AQ((Y)=>z(J(Y),N0((G)=>D08(Z,Y-1,G)))),l9(f9(Z)))})))},D08=(X,J,Z)=>{let Q=X[J];return X[J]=X[Z],X[Z]=Q,X},gI=(X)=>new IK0(Z0(X));class SK0{values;[KO]=KO;index=0;constructor(X){if(this.values=X,X.length===0)throw Error("Requires at least one value")}getNextValue(){let X=this.values[this.index];return this.index=(this.index+1)%this.values.length,X}get next(){return B0(()=>{let X=this.getNextValue();if(typeof X==="number")return Math.max(0,Math.min(1,X));return Z0(X)/2147483647})}get nextBoolean(){return B0(()=>{let X=this.getNextValue();if(typeof X==="boolean")return X;return Z0(X)%2===0})}get nextInt(){return B0(()=>{let X=this.getNextValue();if(typeof X==="number"&&Number.isFinite(X))return Math.round(X);return Math.abs(Z0(X))})}nextRange(X,J){return N0(this.next,(Z)=>(J-X)*Z+X)}nextIntBetween(X,J){return B0(()=>{let Z=this.getNextValue();if(typeof Z==="number"&&Number.isFinite(Z))return Math.max(X,Math.min(J-1,Math.round(Z)));let Q=Math.abs(Z0(Z));return X+Q%(J-X)})}shuffle(X){return EK0(X,(J)=>this.nextIntBetween(0,J))}}var xK0=(X)=>new SK0(X);var Ap=Symbol.for("effect/Tracer"),bK0=(X)=>({[Ap]:Ap,...X}),eK=g8("effect/Tracer"),A7=g8("effect/ParentSpan"),kK0=function(){return function(Z){let Q="";for(let Y=0;Y<Z;Y++)Q+="abcdef0123456789".charAt(Math.floor(Math.random()*16));return Q}}();class yK0{name;parent;context;startTime;kind;_tag="Span";spanId;traceId="native";sampled=!0;status;attributes;events=[];links;constructor(X,J,Z,Q,Y,G){this.name=X,this.parent=J,this.context=Z,this.startTime=Y,this.kind=G,this.status={_tag:"Started",startTime:Y},this.attributes=new Map,this.traceId=J._tag==="Some"?J.value.traceId:kK0(32),this.spanId=kK0(16),this.links=Array.from(Q)}end(X,J){this.status={_tag:"Ended",endTime:X,exit:J,startTime:this.status.startTime}}attribute(X,J){this.attributes.set(X,J)}event(X,J,Z){this.events.push([X,J,Z??{}])}addLinks(X){this.links.push(...X)}}var gK0=bK0({span:(X,J,Z,Q,Y,G)=>new yK0(X,J,Z,Q,Y,G),context:(X)=>X()});var FZ=(X)=>{if(X?.captureStackTrace===!1)return X;else if(X?.captureStackTrace!==void 0&&typeof X.captureStackTrace!=="boolean")return X;let J=Error.stackTraceLimit;Error.stackTraceLimit=3;let Z=Error();Error.stackTraceLimit=J;let Q=!1;return{...X,captureStackTrace:()=>{if(Q!==!1)return Q;if(Z.stack!==void 0){let Y=Z.stack.split(`
169
+ `);if(Y[3]!==void 0)return Q=Y[3].trim(),Q}}}},k$=ZJ()("effect/Tracer/DisablePropagation",{defaultValue:C6});var w08=z(jX(),X9(jQ,wp()),X9(LZ,CK0),X9(tK,gI(Math.random())),X9(GO,jK0()),X9(eK,gK0)),TX=c0(Symbol.for("effect/DefaultServices/currentServices"),()=>NL(w08)),hK0=(X)=>{let J=K9(X);return RL((Z)=>Z.sleep(J))},hI=(X)=>M8((J)=>X(J.currentDefaultServices)),RL=(X)=>hI((J)=>X(J.unsafeMap.get(jQ.key))),mK0=RL((X)=>X.currentTimeMillis),dK0=RL((X)=>X.currentTimeNanos),uK0=$(2,(X,J)=>GJ(TX,X9(jQ,J))(X)),cK0=$(2,(X,J)=>GJ(TX,X9(GO,J))(X)),Tp=(X)=>hI((J)=>X(J.unsafeMap.get(GO.key))),fK0=(X)=>Tp((J)=>J.load(X));var J5=(X)=>hI((J)=>X(J.unsafeMap.get(tK.key))),pK0=$(2,(X,J)=>GJ(TX,X9(tK,J))(X)),lK0=J5((X)=>X.next),nK0=J5((X)=>X.nextInt),iK0=J5((X)=>X.nextBoolean),oK0=(X,J)=>J5((Z)=>Z.nextRange(X,J)),rK0=(X,J)=>J5((Z)=>Z.nextIntBetween(X,J)),aK0=(X)=>J5((J)=>J.shuffle(X)),sK0=(X)=>{let J=v0(X);return N0(J.length===0?p8(new wZ("Cannot select a random element from an empty array")):J5((Z)=>Z.nextIntBetween(0,J.length)),(Z)=>J[Z])},mI=(X)=>hI((J)=>X(J.unsafeMap.get(eK.key))),tK0=$(2,(X,J)=>GJ(TX,X9(eK,J))(X));var jL=(X)=>!X;var X30=$B,dB=KG;var L08=tQ0,F08=eQ0;class fJ extends L08{}class CL extends F08{}var J30="Sequential",Z30="Parallel",A08="ParallelN",VY={_tag:J30},IL={_tag:Z30},Q30=(X)=>({_tag:A08,parallelism:X}),Mp=(X)=>X._tag===J30,Pp=(X)=>X._tag===Z30;var BO=VY,dI=IL,uI=Q30;function G30(X){return new uB(X)}function cI(){return G30(new Map)}var Rp=Symbol.for("effect/FiberRefs");class uB{locals;[Rp]=Rp;constructor(X){this.locals=X}pipe(){return K0(this,arguments)}}var T08=(X,J,Z,Q=!1)=>{let Y=X,G=J,K=Z,B=Q,H=void 0;while(H===void 0)if(B8(G)&&B8(K)){let W=c9(G)[0],V=n6(G),U=c9(K)[0],O=c9(K)[1],q=n6(K);if(W.startTimeMillis<U.startTimeMillis)K=q,B=!0;else if(W.startTimeMillis>U.startTimeMillis)G=V;else if(W.id<U.id)K=q,B=!0;else if(W.id>U.id)G=V;else H=[O,B]}else H=[Y.initial,!0];return H},fI=$(3,(X,J,Z)=>{let Q=new Map(X.locals);return Z.locals.forEach((Y,G)=>{let K=Y[0][1];if(!Y[0][0][b0](J)){if(!Q.has(G)){if(_0(K,G.initial))return;Q.set(G,[[J,G.join(G.initial,K)]]);return}let B=Q.get(G),[H,W]=T08(G,B,Y);if(W){let V=G.diff(H,K),U=B[0][1],O=G.join(U,G.patch(V)(U));if(!_0(U,O)){let q,L=B[0][0];if(L[b0](J))q=[[L,O],...B.slice(1)];else q=[[J,O],...B];Q.set(G,q)}}}}),new uB(Q)}),Cp=$(2,(X,J)=>{let Z=new Map;return K30(X,Z,J),new uB(Z)}),K30=(X,J,Z)=>{X.locals.forEach((Q,Y)=>{let G=Q[0][1],K=Y.patch(Y.fork)(G);if(_0(G,K))J.set(Y,Q);else J.set(Y,[[Z,K],...Q])})},B30=(X)=>X4(X.locals.keys()),H30=(X)=>AQ(B30(X),(J)=>xB(J,cB(X,J))),SL=$(2,(X,J)=>{let Z=new Map(X.locals);return Z.delete(J),new uB(Z)}),xL=$(2,(X,J)=>{if(!X.locals.has(J))return S();return I(c9(X.locals.get(J))[1])}),cB=$(2,(X,J)=>z(xL(X,J),i0(()=>J.initial))),b$=$(2,(X,{fiberId:J,fiberRef:Z,value:Q})=>{if(X.locals.size===0)return new uB(new Map([[Z,[[J,Q]]]]));let Y=new Map(X.locals);return jp(Y,J,Z,Q),new uB(Y)}),jp=(X,J,Z,Q)=>{let Y=X.get(Z)??[],G;if(B8(Y)){let[K,B]=c9(Y);if(K[b0](J))if(_0(B,Q))return;else G=[[J,Q],...Y.slice(1)];else G=[[J,Q],...Y]}else G=[[J,Q]];X.set(Z,G)},W30=$(2,(X,{entries:J,forkAs:Z})=>{if(X.locals.size===0)return new uB(new Map(J));let Q=new Map(X.locals);if(Z!==void 0)K30(X,Q,Z);return J.forEach(([Y,G])=>{if(G.length===1)jp(Q,G[0][0],Y,G[0][1]);else G.forEach(([K,B])=>{jp(Q,K,Y,B)})}),new uB(Q)});var Ip=xL,FG=cB,V30=fI,$30=H30,Ep=b$,U30=W30;var z30=cI;var N30="Empty",O30="Add",_30="Remove",q30="Update",D30="AndThen",w30={_tag:N30},vL=(X,J)=>{let Z=new Map(X.locals),Q=w30;for(let[Y,G]of J.locals.entries()){let K=c9(G)[1],B=Z.get(Y);if(B!==void 0){let H=c9(B)[1];if(!_0(H,K))Q=lI({_tag:q30,fiberRef:Y,patch:Y.diff(H,K)})(Q)}else Q=lI({_tag:O30,fiberRef:Y,value:K})(Q);Z.delete(Y)}for(let[Y]of Z.entries())Q=lI({_tag:_30,fiberRef:Y})(Q);return Q},lI=$(2,(X,J)=>({_tag:D30,first:X,second:J})),nI=$(3,(X,J,Z)=>{let Q=Z,Y=X8(X);while(B8(Y)){let G=c9(Y),K=n6(Y);switch(G._tag){case N30:{Y=K;break}case O30:{Q=b$(Q,{fiberId:J,fiberRef:G.fiberRef,value:G.value}),Y=K;break}case _30:{Q=SL(Q,G.fiberRef),Y=K;break}case q30:{let B=cB(Q,G.fiberRef);Q=b$(Q,{fiberId:J,fiberRef:G.fiberRef,value:G.fiberRef.patch(G.patch)(B)}),Y=K;break}case D30:{Y=zZ(G.first)(zZ(G.second)(K));break}}}return Q});var y$=vL;var g$=nI;var oI="effect/FiberStatus",w1=Symbol.for(oI),iI="Done",A30="Running",T30="Suspended",M08=R8(`${oI}-${iI}`);class M30{[w1]=w1;_tag=iI;[y0](){return M08}[b0](X){return rI(X)&&X._tag===iI}}class P30{runtimeFlags;[w1]=w1;_tag=A30;constructor(X){this.runtimeFlags=X}[y0](){return z(Z0(oI),A0(Z0(this._tag)),A0(Z0(this.runtimeFlags)),W8(this))}[b0](X){return rI(X)&&X._tag===A30&&this.runtimeFlags===X.runtimeFlags}}class R30{runtimeFlags;blockingOn;[w1]=w1;_tag=T30;constructor(X,J){this.runtimeFlags=X,this.blockingOn=J}[y0](){return z(Z0(oI),A0(Z0(this._tag)),A0(Z0(this.runtimeFlags)),A0(Z0(this.blockingOn)),W8(this))}[b0](X){return rI(X)&&X._tag===T30&&this.runtimeFlags===X.runtimeFlags&&_0(this.blockingOn,X.blockingOn)}}var j30=new M30,C30=(X)=>new P30(X),I30=(X,J)=>new R30(X,J),rI=(X)=>V0(X,w1),E30=(X)=>X._tag===iI;var S30=j30,Sp=C30,x30=I30;var v30=E30;var J3={};y8(J3,{locally:()=>j08,lessThanEqual:()=>I08,lessThan:()=>C08,greaterThanEqual:()=>E08,greaterThan:()=>ZE,fromLiteral:()=>QE,allLevels:()=>xp,Warning:()=>tI,Trace:()=>JE,Order:()=>kL,None:()=>b30,Info:()=>eI,Fatal:()=>aI,Error:()=>sI,Debug:()=>XE,All:()=>k30});var k30=Gp,aI=Kp,sI=Bp,tI=$I,eI=sN,XE=UI,JE=Hp,b30=Wp,xp=zI,j08=$(2,(X,J)=>iX(X,_L,J)),kL=z(tZ,HG((X)=>X.ordinal)),C08=UB(kL),I08=g2(kL),ZE=zB(kL),E08=NB(kL),QE=(X)=>{switch(X){case"All":return k30;case"Debug":return XE;case"Error":return sI;case"Fatal":return aI;case"Info":return eI;case"Trace":return JE;case"None":return b30;case"Warning":return tI}};var S08=Symbol.for("effect/Micro"),GE=Symbol.for("effect/Micro/MicroExit");var y30=Symbol.for("effect/Micro/MicroCause");var x08={_E:t};class bp extends globalThis.Error{_tag;traces;[y30];constructor(X,J,Z){let Q=`MicroCause.${X}`,Y,G,K;if(J instanceof globalThis.Error){Y=`(${Q}) ${J.name}`,G=J.message;let B=G.split(`
170
+ `).length;K=J.stack?`(${Q}) ${J.stack.split(`
171
+ `).slice(0,B+3).join(`
172
+ `)}`:`${Y}: ${G}`}else Y=Q,G=sQ(J,0),K=`${Y}: ${G}`;if(Z.length>0)K+=`
173
+ ${Z.join(`
174
+ `)}`;super(G);this._tag=X,this.traces=Z,this[y30]=x08,this.name=Y,this.stack=K}pipe(){return K0(this,arguments)}toString(){return this.stack}[$8](){return this.stack}}class m30 extends bp{defect;constructor(X,J=[]){super("Die",X,J);this.defect=X}}var v08=(X,J=[])=>new m30(X,J);class d30 extends bp{constructor(X=[]){super("Interrupt","interrupted",X)}}var k08=(X=[])=>new d30(X);var b08=(X)=>X._tag==="Interrupt";var g30=Symbol.for("effect/Micro/MicroFiber"),y08={_A:t,_E:t};class u30{context;interruptible;[g30];_stack=[];_observers=[];_exit;_children;currentOpCount=0;constructor(X,J=!0){this.context=X,this.interruptible=J,this[g30]=y08}getRef(X){return sY0(this.context,X)}addObserver(X){if(this._exit)return X(this._exit),O6;return this._observers.push(X),()=>{let J=this._observers.indexOf(X);if(J>=0)this._observers.splice(J,1)}}_interrupted=!1;unsafeInterrupt(){if(this._exit)return;if(this._interrupted=!0,this.interruptible)this.evaluate(dp)}unsafePoll(){return this._exit}evaluate(X){if(this._exit)return;else if(this._yielded!==void 0){let Q=this._yielded;this._yielded=void 0,Q()}let J=this.runLoop(X);if(J===YE)return;let Z=h30.interruptChildren&&h30.interruptChildren(this);if(Z!==void 0)return this.evaluate(BE(Z,()=>J));this._exit=J;for(let Q=0;Q<this._observers.length;Q++)this._observers[Q](J);this._observers.length=0}runLoop(X){let J=!1,Z=X;this.currentOpCount=0;try{while(!0){if(this.currentOpCount++,!J&&this.getRef(WE).shouldYield(this)){J=!0;let Q=Z;Z=BE(u08,()=>Q)}if(Z=Z[vp](this),Z===YE){let Q=this._yielded;if(GE in Q)return this._yielded=void 0,Q;return YE}}}catch(Q){if(!V0(Z,vp))return kp(`MicroFiber.runLoop: Not a valid effect: ${String(Z)}`);return kp(Q)}}getCont(X){while(!0){let J=this._stack.pop();if(!J)return;let Z=J[KE]&&J[KE](this);if(Z)return{[X]:Z};if(J[X])return J}}_yielded=void 0;yieldWith(X){return this._yielded=X,YE}children(){return this._children??=new Set}}var h30=c0("effect/Micro/fiberMiddleware",()=>({interruptChildren:void 0}));var c30=Symbol.for("effect/Micro/identifier"),wJ=Symbol.for("effect/Micro/args"),vp=Symbol.for("effect/Micro/evaluate"),VO=Symbol.for("effect/Micro/successCont"),WO=Symbol.for("effect/Micro/failureCont"),KE=Symbol.for("effect/Micro/ensureCont"),YE=Symbol.for("effect/Micro/Yield"),g08={_A:t,_E:t,_R:t},h08={...X30,_op:"Micro",[S08]:g08,pipe(){return K0(this,arguments)},[Symbol.iterator](){return new dV(new GG(this))},toJSON(){return{_id:"Micro",op:this[c30],...wJ in this?{args:this[wJ]}:void 0}},toString(){return u8(this)},[$8](){return u8(this)}};function m08(X){return kp("Micro.evaluate: Not implemented")}var HE=(X)=>({...h08,[c30]:X.op,[vp]:X.eval??m08,[VO]:X.contA,[WO]:X.contE,[KE]:X.ensure}),yp=(X)=>{let J=HE(X);return function(){let Z=Object.create(J);return Z[wJ]=X.single===!1?arguments:arguments[0],Z}},f30=(X)=>{let J={...HE(X),[GE]:GE,_tag:X.op,get[X.prop](){return this[wJ]},toJSON(){return{_id:"MicroExit",_tag:X.op,[X.prop]:this[wJ]}},[b0](Z){return p08(Z)&&Z._tag===X.op&&_0(this[wJ],Z[wJ])},[y0](){return W8(this,A0(R8(X.op))(Z0(this[wJ])))}};return function(Z){let Q=Object.create(J);return Q[wJ]=Z,Q[VO]=void 0,Q[WO]=void 0,Q[KE]=void 0,Q}},gp=f30({op:"Success",prop:"value",eval(X){let J=X.getCont(VO);return J?J[VO](this[wJ],X):X.yieldWith(this)}}),p30=f30({op:"Failure",prop:"cause",eval(X){let J=X.getCont(WO);while(b08(this[wJ])&&J&&X.interruptible)J=X.getCont(WO);return J?J[WO](this[wJ],X):X.yieldWith(this)}});var d08=yp({op:"Yield",eval(X){let J=!1;return X.getRef(WE).scheduleTask(()=>{if(J)return;X.evaluate(l08)},this[wJ]??0),X.yieldWith(()=>{J=!0})}}),u08=d08(0);var c08=gp(void 0);var hp=yp({op:"WithMicroFiber",eval(X){return this[wJ](X)}});var BE=$(2,(X,J)=>{let Z=Object.create(f08);return Z[wJ]=X,Z[VO]=J,Z}),f08=HE({op:"OnSuccess",eval(X){return X._stack.push(this),this[wJ]}});var p08=(X)=>V0(X,GE),l30=gp,mp=p30,dp=mp(k08());var kp=(X)=>mp(v08(X));var l08=l30(void 0);var n08="setImmediate"in globalThis?globalThis.setImmediate:(X)=>setTimeout(X,0);class up{tasks=[];running=!1;scheduleTask(X,J){if(this.tasks.push(X),!this.running)this.running=!0,n08(this.afterScheduled)}afterScheduled=()=>{this.running=!1,this.runTasks()};runTasks(){let X=this.tasks;this.tasks=[];for(let J=0,Z=X.length;J<Z;J++)X[J]()}shouldYield(X){return X.currentOpCount>=X.getRef(i30)}flush(){while(this.tasks.length>0)this.runTasks()}}var i08=$(2,(X,J)=>hp((Z)=>{let Q=Z.context;return Z.context=J(Q),a08(X,()=>{return Z.context=Q,c08})}));var n30=$(2,(X,J)=>i08(X,CX(J)));class i30 extends ZJ()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048}){}class WE extends ZJ()("effect/Micro/currentScheduler",{defaultValue:()=>new up}){}var o08=$(2,(X,J)=>{let Z=Object.create(r08);return Z[wJ]=X,Z[VO]=J.onSuccess,Z[WO]=J.onFailure,Z}),r08=HE({op:"OnSuccessAndFailure",eval(X){return X._stack.push(this),this[wJ]}});var a08=$(2,(X,J)=>t08((Z)=>o08(Z(X),{onFailure:(Q)=>BE(J(mp(Q)),()=>p30(Q)),onSuccess:(Q)=>BE(J(l30(Q)),()=>gp(Q))})));var o30=yp({op:"SetInterruptible",ensure(X){if(X.interruptible=this[wJ],X._interrupted&&X.interruptible)return()=>dp}}),s08=(X)=>hp((J)=>{if(J.interruptible)return X;if(J.interruptible=!0,J._stack.push(o30(!1)),J._interrupted)return dp;return X}),t08=(X)=>hp((J)=>{if(!J.interruptible)return X(t);return J.interruptible=!1,J._stack.push(o30(!0)),X(s08)});var r30=(X,J)=>{let Z=new u30(WE.context(J?.scheduler??new up));if(Z.evaluate(X),J?.signal)if(J.signal.aborted)Z.unsafeInterrupt();else{let Q=()=>Z.unsafeInterrupt();J.signal.addEventListener("abort",Q,{once:!0}),Z.addObserver(()=>J.signal.removeEventListener("abort",Q))}return Z};var AG=Symbol.for("effect/Readable");var io8={[AG]:AG,pipe(){return K0(this,arguments)}};var VE=Symbol.for("effect/Ref"),fp={_A:(X)=>X};class a30 extends fJ{ref;commit(){return this.get}[VE]=fp;[AG]=AG;constructor(X){super();this.ref=X,this.get=B0(()=>O9(this.ref))}get;modify(X){return B0(()=>{let J=O9(this.ref),[Z,Q]=X(J);if(J!==Q)oZ(Q)(this.ref);return Z})}}var $O=(X)=>new a30(uJ(X)),h$=(X)=>B0(()=>$O(X)),LJ=(X)=>X.get,W4=$(2,(X,J)=>X.modify(()=>[void 0,J])),pp=$(2,(X,J)=>X.modify((Z)=>[Z,J]));var $E=$(2,(X,J)=>X.modify(J));var L1=$(2,(X,J)=>X.modify((Z)=>[void 0,J(Z)])),lp=$(2,(X,J)=>X.modify((Z)=>{let Q=J(Z);return[Q,Q]}));var bX=h$,ZX=LJ,UE=pp;var Q5=$E;var pJ=W4;var lJ=L1,np=lp;class zE{scheduleDrain;running=!1;tasks=new ip;constructor(X){this.scheduleDrain=X}starveInternal=(X)=>{let J=this.tasks.buckets;this.tasks.buckets=[];for(let[Z,Q]of J)for(let Y=0;Y<Q.length;Y++)Q[Y]();if(this.tasks.buckets.length===0)this.running=!1;else this.starve(X)};starve(X=0){this.scheduleDrain(X,this.starveInternal)}scheduleTask(X,J){if(this.tasks.scheduleTask(X,J),!this.running)this.running=!0,this.starve()}static cached(X){let J=new zE(X),Z=new WeakMap;return(Q)=>{if(Q===void 0)return J;let Y=Z.get(Q);if(Y===void 0)Y=new zE(X),Z.set(Q,Y);return Y}}}class ip{buckets=[];scheduleTask(X,J){let Z=this.buckets.length,Q=void 0,Y=0;for(;Y<Z;Y++)if(this.buckets[Y][0]<=J)Q=this.buckets[Y];else break;if(Q&&Q[0]===J)Q[1].push(X);else if(Y===Z)this.buckets.push([J,[X]]);else this.buckets.splice(Y,0,[J,[X]])}}class s30{maxNextTickBeforeTimer;getRunner=zE.cached((X,J)=>{if(X>=this.maxNextTickBeforeTimer)setTimeout(()=>J(0),0);else Promise.resolve(void 0).then(()=>J(X+1))});constructor(X){this.maxNextTickBeforeTimer=X}shouldYield(X){return X.currentOpCount>X.getFiberRef(OL)?X.getFiberRef(DG):!1}scheduleTask(X,J,Z){this.getRunner(Z).scheduleTask(X,J)}}var t30=c0(Symbol.for("effect/Scheduler/defaultScheduler"),()=>new s30(2048));class m${tasks=new ip;deferred=!1;scheduleTask(X,J,Z){if(this.deferred)t30.scheduleTask(X,J,Z);else this.tasks.scheduleTask(X,J)}shouldYield(X){return X.currentOpCount>X.getFiberRef(OL)?X.getFiberRef(DG):!1}flush(){while(this.tasks.buckets.length>0){let X=this.tasks.buckets;this.tasks.buckets=[];for(let[J,Z]of X)for(let Q=0;Q<Z.length;Q++)Z[Q]()}this.deferred=!0}}var MG=c0(Symbol.for("effect/FiberRef/currentScheduler"),()=>_6(t30)),e30=$(2,(X,J)=>iX(X,MG,J));var NE=c0(Symbol.for("effect/FiberRef/currentRequestMap"),()=>_6(new Map));var op=(X,J,Z,Q)=>{switch(X){case void 0:return J();case"unbounded":return Z();case"inherit":return DJ(DL,(Y)=>Y==="unbounded"?Z():Y>1?Q(Y):J());default:return X>1?Q(X):J()}},yL=(X,J,Z)=>{switch(X){case void 0:return J();case"unbounded":return Z();case"inherit":return DJ(DL,(Q)=>Q==="unbounded"||Q>1?Z():J());default:return X>1?Z():J()}};var Z3=hK0,$Y=mK0,XB0=dK0,JB0=RL,ZB0=jQ;var QB0=(X,J)=>({label:X,startTime:J}),rp=(X)=>X.replace(/[\s="]/g,"_"),hL=(X)=>(J)=>{return`${rp(J.label)}=${X-J.startTime}ms`};var GB0=QB0;var zO=A7;var KB0=mI;var BB0="effect/MetricLabel",ap=Symbol.for(BB0);class HB0{key;value;[ap]=ap;_hash;constructor(X,J){this.key=X,this.value=J,this._hash=R8(BB0+this.key+this.value)}[y0](){return this._hash}[b0](X){return W88(X)&&this.key===X.key&&this.value===X.value}pipe(){return K0(this,arguments)}}var d$=(X,J)=>{return new HB0(X,J)},W88=(X)=>V0(X,ap);var WB0=$((X)=>b9(X[0]),function(){let X=arguments;return GJ(X[0],oK,typeof X[1]==="string"?w7(X[1],X[2]):(J)=>Object.entries(X[1]).reduce((Z,[Q,Y])=>w7(Z,Q,Y),J))}),NO=(X)=>N0(X,I),VB0=(X)=>V1(X,I),mL=(X)=>{let J,Z=void 0;if(typeof X==="function")J=X;else J=X.try,Z=X.catch;return I0(()=>{try{return o(JX(J))}catch(Q){return p8(Z?JX(()=>Z(Q)):new R$(Q,"An unknown error occurred in Effect.try"))}})},$B0=$(3,(X,J,Z)=>tY(X,(Q)=>{if(V0(Q,J)&&Q[J]===Z.failure)return Z.onFailure(Q);return p8(Q)})),UB0=$(2,(X,J)=>pK(X,(Z)=>{let Q=uK(Z,(Y)=>U$(Y)?I(Y):S());switch(Q._tag){case"None":return W9(Z);case"Some":return J(Q.value.defect)}})),zB0=$(2,(X,J)=>K6(X,{onFailure:(Z)=>{let Q=J(Z);switch(Q._tag){case"None":return W9(Z);case"Some":return Q.value}},onSuccess:o})),NB0=$(2,(X,J)=>pK(X,(Z)=>{let Q=uK(Z,(Y)=>U$(Y)?I(Y):S());switch(Q._tag){case"None":return W9(Z);case"Some":{let Y=J(Q.value.defect);return Y._tag==="Some"?Y.value:W9(Z)}}})),OB0=$((X)=>b9(X[0]),(X,...J)=>{let Z=J[J.length-1],Q;if(J.length===2)Q=p5(J[0]);else Q=(Y)=>{let G=V0(Y,"_tag")?Y._tag:void 0;if(!G)return!1;for(let K=0;K<J.length-1;K++)if(J[K]===G)return!0;return!1};return VL(X,Q,Z)}),_B0=$(2,(X,J)=>{let Z;return VL(X,(Q)=>{return Z??=Object.keys(J),V0(Q,"_tag")&&n9(Q._tag)&&Z.includes(Q._tag)},(Q)=>J[Q._tag](Q))}),qB0=(X)=>$L(X,{onFailure:t,onSuccess:()=>c7}),V4=JB0,DB0=V4(o),wB0=$(2,(X,J)=>i8(Z3(J),X)),DE=(X)=>M8((J,Z)=>X({id:J.id(),status:Z,interruptors:N$(J.getFiberRef(O1))})),LB0=DE((X)=>MB(X.interruptors)>0?nX:N8),FB0=DE(o),OO=(X)=>pL(X,LE,vL),V88=(X)=>pL(X,L$(LE,aN),([J,Z],[Q,Y])=>[vL(J,Q),aY(Z,Y)]),AB0=o({}),dL=k2(N0,p),uL=qK(N0),TB0=_K(N0),MB0=$(2,(X,J)=>I0(()=>{let Z=X[Symbol.iterator](),Q=[],Y,G=o(!1),K=0;while((Y=Z.next())&&!Y.done){let B=Y.value,H=K++;G=p(G,(W)=>{if(W)return Q.push(B),o(!0);return J(B,H)})}return N0(G,()=>Q)})),PB0=$(2,(X,J)=>I0(()=>{let Z=X[Symbol.iterator](),Q=[],Y,G=o(!0),K=0;while((Y=Z.next())&&!Y.done){let B=Y.value,H=K++;G=p(G,(W)=>N0(W?J(B,H):o(!1),(V)=>{if(!V)Q.push(B);return V}))}return N0(G,()=>Q)})),RB0=(X)=>N0(WY(),X),tp=(X)=>D$(X,()=>p(nK(),()=>tp(X))),jB0=$(2,(X,J)=>N0(DZ(X,t),LQ(J))),CB0=$(3,(X,J,Z)=>cL(X,J,(Q)=>B1(()=>Z(Q)))),IB0=$(3,(X,J,Z)=>cL(X,J,()=>K1(Z))),cL=$(3,(X,J,Z)=>p(X,(Q)=>J(Q)?o(Q):Z(Q))),EB0=$(3,(X,J,Z)=>I0(()=>J(X)?o(X):p8(Z(X)))),SB0=$((X)=>b9(X[0]),(X,J,Z)=>cL(X,J,(Q)=>Z===void 0?p8(new wZ):Y4(()=>Z(Q)))),xB0=$(2,(X,J)=>I0(()=>{let Z=X[Symbol.iterator](),Q=Z.next();if(!Q.done)return vB0(Z,0,J,Q.value);return o(S())})),vB0=(X,J,Z,Q)=>p(Z(Q,J),(Y)=>{if(Y)return o(I(Q));let G=X.next();if(!G.done)return vB0(X,J+1,Z,G.value);return o(S())}),kB0=(X)=>I0(()=>{let J=f9(X);if(!FX(J))return B1(()=>new P$("Received an empty collection of effects"));return z(_Z(J),OJ(qJ(J),(Z,Q)=>D$(Z,()=>Q)))}),bB0=$(2,(X,J)=>W1(J(W1(X)))),fL=$(2,(X,J)=>YJ(X,{onFailure:(Z)=>o(J.onFailure(Z)),onSuccess:(Z)=>o(J.onSuccess(Z))})),yB0=$(2,(X,J)=>I0(()=>gB0(X[Symbol.iterator](),0,J))),gB0=(X,J,Z)=>{let Q=X.next();return Q.done?o(!0):p(Z(Q.value,J),(Y)=>Y?gB0(X,J+1,Z):o(Y))},wE=(X)=>{let J=p(p(X,()=>nK()),()=>J);return J},LE=M8((X)=>o(X.getFiberRefs())),hB0=(X)=>p(X,(J)=>{let Q=J[Symbol.iterator]().next();if(Q.done)return p8(new wZ);return o(Q.value)}),FE=(X)=>fL(X,{onFailure:O6,onSuccess:O6}),mB0=(X)=>K6(X,{onFailure:(J)=>Xl(J,"An error was silently ignored because it is not anticipated to be useful"),onSuccess:()=>N8}),dB0=(X)=>ME((J,Z)=>V30(Z,J,X)),uB0=(X)=>fL(X,{onFailure:G6,onSuccess:C6}),cB0=(X)=>fL(X,{onFailure:C6,onSuccess:G6}),ep=(X,J)=>I0(()=>{if(J.while(X))return p(J.body(X),(Z)=>ep(Z,J));return o(X)}),fB=(X)=>(...J)=>{let Z=x8(X),Q=void 0;for(let Y=0,G=J.length;Y<G;Y++){let K=J[Y];if(aw(K)){if(Q!==void 0)Q=OX(Q,K);else Q=K;J=[...J.slice(0,Y),...J.slice(Y+1)],Y--}}if(Q===void 0)Q=c7;return M8((Y)=>{return Y.log(J,Q,Z),N8})},fB0=fB(),pB0=fB(JE),Xl=fB(XE),lB0=fB(eI),nB0=fB(tI),iB0=fB(sI),oB0=fB(aI),rB0=$(2,(X,J)=>p($Y,(Z)=>GJ(X,qL,vC(GB0(J,Z))))),aB0=PQ(oK),sB0=(X,J)=>J.discard?eB0(X,J.while,J.step,J.body):N0(tB0(X,J.while,J.step,J.body),v0),tB0=(X,J,Z,Q)=>I0(()=>J(X)?p(Q(X),(Y)=>N0(tB0(Z(X),J,Z,Q),vC(Y))):B0(()=>Z4())),eB0=(X,J,Z,Q)=>I0(()=>J(X)?p(Q(X),()=>eB0(Z(X),J,Z,Q)):N8),XH0=$(3,(X,J,Z)=>I0(()=>{let Q=X[Symbol.iterator](),Y=[],G=o(J),K,B=0;while(!(K=Q.next()).done){let H=B++,W=K.value;G=p(G,(V)=>N0(Z(V,W,H),([U,O])=>{return Y.push(O),U}))}return N0(G,(H)=>[H,Y])})),_O=$(2,(X,J)=>K6(X,{onFailure:(Z)=>bB(()=>J(Z)),onSuccess:o})),AE=(X)=>z(f7(),p((J)=>z(V88(X),lK(J),Jl,N0((Z)=>i8(Z,z(IX(J),p(([Q,Y])=>l9(L$(u$(Q[0]),$1(Q[1])),Y)))))))),JH0=(X)=>YJ(X,{onFailure:(J)=>o(J),onSuccess:o}),TE=(X)=>N0(X,(J)=>!J),ZH0=(X)=>p(X,(J)=>{switch(J._tag){case"None":return N8;case"Some":return p8(new wZ)}}),Jl=(X)=>N0(bX(!0),(J)=>AX(_G(X,UE(J,!1)))),QH0=(X)=>YJ(X,{onFailure:()=>o(S()),onSuccess:(J)=>o(I(J))}),YH0=$(2,(X,J)=>D$(X,()=>Y4(J))),GH0=$(2,(X,J)=>D$(X,()=>B0(J))),KH0=(X)=>K6(X,{onFailure:(J)=>{let Z=v0(pN(J));return Z.length===0?W9(J):p8(Z)},onSuccess:o}),u$=(X)=>ME((J,Z)=>z(X,nI(J,Z))),BH0=(X)=>X.length>=1?rZ((J,Z)=>{try{X(Z).then((Q)=>J(o(Q)),(Q)=>J(aZ(Q)))}catch(Q){J(aZ(Q))}}):rZ((J)=>{try{X().then((Z)=>J(o(Z)),(Z)=>J(aZ(Z)))}catch(Z){J(aZ(Z))}}),F1=$(3,(X,J,Z)=>B4((Q)=>X5(X,X9(Q,J,Z)))),A1=$(3,(X,J,Z)=>B4((Q)=>p(Z,(Y)=>X5(X,z(Q,X9(J,Y)))))),HH0=J5(o),WH0=$(3,(X,J,Z)=>v0(X).reduce((Q,Y,G)=>p(Q,(K)=>Z(K,Y,G)),o(J))),VH0=$(3,(X,J,Z)=>v0(X).reduceRight((Q,Y,G)=>p(Q,(K)=>Z(Y,K,G)),o(J))),$H0=$(3,(X,J,Z)=>p(B0(()=>X[Symbol.iterator]()),(Q)=>UH0(Q,0,J,Z.while,Z.body))),UH0=(X,J,Z,Q,Y)=>{let G=X.next();if(!G.done&&Q(Z))return p(Y(Z,G.value,J),(K)=>UH0(X,J+1,K,Q,Y));return o(Z)},zH0=$(2,(X,J)=>I0(()=>NH0(X,J))),NH0=(X,J)=>p(X,(Z)=>J<=0?o(Z):i8(nK(),NH0(X,J-1))),OH0=(X)=>K6(X,{onFailure:p8,onSuccess:o}),_H0=(X)=>I0(()=>$30(X)),Q3=Z3,c$=o(S()),qH0=(X)=>o(I(X)),pL=$(3,(X,J,Z)=>p(J,(Q)=>p(X,(Y)=>N0(J,(G)=>[Z(Q,G),Y])))),DH0=$((X)=>b9(X[0]),function(){return Zl(arguments[0],typeof arguments[1]==="string"?[d$(arguments[1],arguments[2])]:Object.entries(arguments[1]).map(([X,J])=>d$(X,J)))}),Zl=$(2,(X,J)=>GJ(X,rK,(Z)=>nY(Z,J))),wH0=$(2,(X,J)=>I0(()=>{let Z=X[Symbol.iterator](),Q=[],Y,G=o(!1),K=0;while((Y=Z.next())&&!Y.done){let B=Y.value,H=K++;G=p(G,(W)=>{if(W)return o(!0);return Q.push(B),J(B,H)})}return N0(G,()=>Q)})),LH0=$(2,(X,J)=>I0(()=>{let Z=X[Symbol.iterator](),Q=[],Y,G=o(!0),K=0;while((Y=Z.next())&&!Y.done){let B=Y.value,H=K++;G=p(G,(W)=>z(W?J(B,H):o(!1),N0((V)=>{if(V)Q.push(B);return V})))}return N0(G,()=>Q)})),FH0=$(2,(X,{onFailure:J,onSuccess:Z})=>K6(X,{onFailure:(Q)=>{let Y=NG(Q);switch(Y._tag){case"Left":return i8(J(Y.left),W9(Q));case"Right":return W9(Q)}},onSuccess:(Q)=>l9(Z(Q),Q)})),AH0=$(2,(X,J)=>pK(X,(Z)=>w0(aC(Z),{onNone:()=>W9(Z),onSome:(Q)=>i8(J(Q),W9(Z))}))),Ql=$(2,(X,J)=>K6(X,{onFailure:(Z)=>{let Q=NG(Z);switch(Q._tag){case"Left":return i8(J(Q.left),W9(Z));case"Right":return W9(Z)}},onSuccess:o})),TH0=$(3,(X,J,Z)=>Ql(X,(Q)=>{if(p5(Q,J))return Z(Q);return N8})),MH0=$(2,(X,J)=>K6(X,{onFailure:(Z)=>i8(J(Z),W9(Z)),onSuccess:o})),PH0=(X)=>Yl(X,XB0),Yl=$(2,(X,J)=>pL(X,J,(Z,Q)=>UG(Q-Z))),$88=KB0,RH0=$88(o),Gl=(X)=>{let J,Z=void 0;if(typeof X==="function")J=X;else J=X.try,Z=X.catch;let Q=(Y)=>Z?Y4(()=>Z(Y)):p8(new R$(Y,"An unknown error occurred in Effect.tryPromise"));if(J.length>=1)return rZ((Y,G)=>{try{J(G).then((K)=>Y(o(K)),(K)=>Y(Q(K)))}catch(K){Y(Q(K))}});return rZ((Y)=>{try{J().then((G)=>Y(o(G)),(G)=>Y(Q(G)))}catch(G){Y(Q(G))}})},jH0=$(2,(X,J)=>p(X,(Z)=>mL({try:()=>J.try(Z),catch:J.catch}))),CH0=$(2,(X,J)=>p(X,(Z)=>Gl({try:J.try.length>=1?(Q)=>J.try(Z,Q):()=>J.try(Z),catch:J.catch}))),IH0=$(2,(X,J)=>I0(()=>J()?c$:NO(X))),EH0=$(2,(X,J)=>p(J,(Z)=>Z?c$:NO(X))),SH0=(X)=>_O(X,sC),ME=(X)=>M8((J)=>{return J.setFiberRefs(X(J.id(),J.getFiberRefs())),N8}),xH0=$(3,(X,J,Z)=>hB(X,(Q)=>X9(Q,J,Z(x6(Q,J))))),PE=$(2,(X,J)=>I0(()=>J()?N0(X,I):o(S()))),vH0=$(3,(X,J,Z)=>p(PQ(J),(Q)=>Z(Q)?N0(X,(Y)=>[Q,I(Y)]):o([Q,S()]))),kH0=$(3,(X,J,Z)=>p(ZX(J),(Q)=>Z(Q)?N0(X,(Y)=>[Q,I(Y)]):o([Q,S()]))),bH0=$(2,(X,J)=>J(X)),yH0=(X,J)=>(...Z)=>p(X,(Q)=>J(Q)(...Z)),gH0=(X,J)=>(...Z)=>N0(X,(Q)=>J(Q)(...Z)),Kl=(X)=>new Proxy({},{get(J,Z,Q){return(...Y)=>p(X,(G)=>G[Z](...Y))}}),Bl=(X)=>new Proxy({},{get(J,Z,Q){return p(X,(Y)=>b9(Y[Z])?Y[Z]:o(Y[Z]))}}),hH0=(X)=>({functions:Kl(X),constants:Bl(X)}),mH0=(X)=>N0(WY(),_7(X)),Hl=(X)=>p(WY(),_7(X)),dH0=function(){let X=arguments;return FE(p(Vl,(J)=>B0(()=>{if(typeof X[0]==="string")J.attribute(X[0],X[1]);else for(let Z in X[0])J.attribute(Z,X[0][Z])})))},uH0=function(){let X=arguments,J=Array.isArray(X[0])?X[0]:[{_tag:"SpanLink",span:X[0],attributes:X[1]??{}}];return FE(p(Wl,(Z)=>B0(()=>Z.addLinks(J))))},cH0=$((X)=>b9(X[0]),function(){let X=arguments;return GJ(X[0],T$,typeof X[1]==="string"?w7(X[1],X[2]):(J)=>Object.entries(X[1]).reduce((Z,[Q,Y])=>w7(Z,Q,Y),J))}),fH0=Hl(A7),Wl=p(WY(),(X)=>{let J=X.unsafeMap.get(A7.key);return J!==void 0&&J._tag==="Span"?o(J):p8(new wZ)}),Vl=p(WY(),(X)=>{let J=lL(_7(X,A7));return J._tag==="Some"&&J.value._tag==="Span"?o(J.value):p8(new wZ)}),pH0=$((X)=>b9(X[0]),(X,J,Z)=>GJ(X,LL,D7({_tag:"SpanLink",span:J,attributes:Z??{}}))),lH0=BigInt(0),lL=pX((X)=>z9(X.context,k$)?X._tag==="Span"?lL(X.parent):S():I(X)),RE=(X,J,Z)=>{let Q=!X.getFiberRef(A$)||Z.context&&z9(Z.context,k$),Y=X.getFiberRef(F7),G=Z.parent?I(Z.parent):Z.root?S():lL(_7(Y,A7)),K;if(Q)K=UK0({name:J,parent:G,context:X9(Z.context??jX(),k$,!0)});else{let B=X.getFiberRef(TX),H=z9(B,eK),W=z9(B,ZB0),V=X.getFiberRef(aK),U=X.getFiberRefs(),O=Ip(U,T$),q=Ip(U,LL),L=q._tag==="Some"?Z.links!==void 0?[...G9(q.value),...Z.links??[]]:G9(q.value):Z.links??l0();if(K=H.span(J,G,Z.context??jX(),L,V?W.unsafeCurrentTimeNanos():lH0,Z.kind??"internal",Z),O._tag==="Some")w40(O.value,(A,M)=>K.attribute(M,A));if(Z.attributes!==void 0)Object.entries(Z.attributes).forEach(([A,M])=>K.attribute(A,M))}if(typeof Z.captureStackTrace==="function")tw.set(K,Z.captureStackTrace);return K},nH0=(X,J)=>{return J=FZ(J),M8((Z)=>o(RE(Z,X,J)))},iH0=PQ(T$),oH0=PQ(LL),qO=(X,J,Z,Q)=>B0(()=>{if(X.status._tag==="Ended")return;if(qI(J)&&tw.has(X))X.attribute("code.stacktrace",tw.get(X)());X.end(Q?Z.unsafeCurrentTimeNanos():lH0,J)}),_E=(X,...J)=>{let Z=FZ(J.length===1?void 0:J[0]),Q=J[J.length-1];return M8((Y)=>{let G=RE(Y,X,Z),K=Y.getFiberRef(aK),B=z9(Y.getFiberRef(TX),jQ);return TQ(Q(G),(H)=>qO(G,H,B,K))})},qE=$(2,(X,J)=>F1(X,A7,J)),$l=function(){let X=typeof arguments[0]!=="string",J=X?arguments[1]:arguments[0],Z=FZ(X?arguments[2]:arguments[1]);if(X){let Q=arguments[0];return _E(J,Z,(Y)=>qE(Q,Y))}return(Q)=>_E(J,Z,(Y)=>qE(Q,Y))},rH0=(X)=>function(){let J=X.captureStackTrace??!1;if(X.captureStackTrace!==!1){let Z=Error.stackTraceLimit;Error.stackTraceLimit=2;let Q=Error();Error.stackTraceLimit=Z;let Y=!1;J=()=>{if(Y!==!1)return Y;if(Q.stack)return Y=Q.stack.trim().split(`
175
+ `).slice(2).join(`
176
+ `).trim(),Y}}return I0(()=>{let Z=typeof X.options==="function"?X.options.apply(null,arguments):X.options;return $l(I0(()=>JX(()=>X.body.apply(this,arguments))),Z.name,{...Z,captureStackTrace:J})})},aH0=(X)=>X==null?p8(new wZ):o(X),sH0=(X)=>tY(N0(X,I),(J)=>OI(J)?c$:p8(J));var I9={};y8(I9,{zipWith:()=>j88,zipRight:()=>M1,zipParRight:()=>R88,zipParLeft:()=>P88,zipPar:()=>M88,zipLeft:()=>T88,zip:()=>CE,void:()=>eZ,succeed:()=>v8,matchEffect:()=>eH0,match:()=>rX,mapErrorCause:()=>A88,mapError:()=>F88,mapBoth:()=>jE,map:()=>DO,isSuccess:()=>CQ,isInterrupted:()=>U88,isFailure:()=>AZ,isExit:()=>nL,interrupt:()=>T1,getOrElse:()=>L88,fromOption:()=>w88,fromEither:()=>D88,forEachEffect:()=>tH0,flatten:()=>Nl,flatMapEffect:()=>q88,flatMap:()=>_88,failCause:()=>_9,fail:()=>WX,exists:()=>O88,die:()=>Y5,causeOption:()=>N88,asVoid:()=>Ul,as:()=>z88,all:()=>zl});var nL=j$,AZ=qI,CQ=TL,U88=fG0,z88=C$,Ul=ZO,N88=pG0,zl=q1,Y5=DI,O88=lG0,WX=wG,_9=L9,_88=_p,q88=nG0,Nl=iG0,tH0=oG0,D88=rG0,w88=aG0,L88=sG0,T1=I$,DO=ew,jE=tG0,F88=eG0,A88=XK0,rX=E$,eH0=S$,v8=M9,eZ=oX;var CE=JK0,T88=ZK0,M1=wI,M88=QK0,P88=YK0,R88=GK0,j88=K4;var Ol="InterruptSignal",_l="Stateful",ql="Resume",Dl="YieldNow",IE=(X)=>({_tag:"InterruptSignal",cause:X}),wO=(X)=>({_tag:"Stateful",onFiber:X}),f$=(X)=>({_tag:"Resume",effect:X}),X20=()=>({_tag:"YieldNow"});var C88="effect/FiberScope",EE=Symbol.for(C88);class Z20{[EE]=EE;fiberId=d7;roots=new Set;add(X,J){this.roots.add(J),J.addObserver(()=>{this.roots.delete(J)})}}class Q20{fiberId;parent;[EE]=EE;constructor(X,J){this.fiberId=X,this.parent=J}add(X,J){this.parent.tell(wO((Z)=>{Z.addChild(J),J.addObserver(()=>{Z.removeChild(J)})}))}}var Y20=(X)=>{return new Q20(X.id(),X)},pB=c0(Symbol.for("effect/FiberScope/Global"),()=>new Z20);var I88="effect/Fiber",LO=Symbol.for(I88),iL={_E:(X)=>X,_A:(X)=>X},E88={[LO]:iL,pipe(){return K0(this,arguments)}},S88="effect/Fiber",SE=Symbol.for(S88);var wl=(X)=>(SE in X),xE=(X)=>X.await;var vE=(X)=>X.inheritAll;var kE=$(2,yB(function*(X,J){for(let Z of X){if(wl(Z)){Z.unsafeInterruptAsFork(J);continue}yield*Z.interruptAsFork(J)}for(let Z of X){if(wl(Z)&&Z.unsafePoll())continue;yield*Z.await}})),bE=$(2,(X,J)=>X.interruptAsFork(J)),G5=(X)=>F$(BY(X.await),X.inheritAll);var Wr8={...KG,commit(){return G5(this)},...E88,id:()=>d7,await:z1,children:o([]),inheritAll:z1,poll:o(S()),interruptAsFork:()=>z1};var K20=(X)=>X.poll;var lB="effect/FiberCurrent",B20=()=>x8(globalThis[lB]);var x88="effect/Logger",FO=Symbol.for(x88),Fl={_Message:(X)=>X,_Output:(X)=>X},nJ=(X)=>({[FO]:Fl,log:X,pipe(){return K0(this,arguments)}}),H20=$(2,(X,J)=>nJ((Z)=>X.log({...Z,message:J(Z.message)}))),yE=$(2,(X,J)=>nJ((Z)=>X.log(J(Z)))),W20=$(2,(X,J)=>nJ((Z)=>J(Z.logLevel)?I(X.log(Z)):S())),rL=$(2,(X,J)=>nJ((Z)=>J(X.log(Z)))),V20={[FO]:Fl,log:O6,pipe(){return K0(this,arguments)}},gE=(X)=>({[FO]:Fl,log:({message:J})=>X(J),pipe(){return K0(this,arguments)}}),$20=(X)=>{return gE(()=>X)},U20=(X)=>{return gE(X)},hE=$(2,(X,J)=>nJ((Z)=>[X.log(Z),J.log(Z)])),z20=$(2,(X,J)=>rL(hE(X,J),(Z)=>Z[0])),N20=$(2,(X,J)=>rL(hE(X,J),(Z)=>Z[1])),v88=/^[^\s"=]*$/,O20=(X,J)=>({annotations:Z,cause:Q,date:Y,fiberId:G,logLevel:K,message:B,spans:H})=>{let W=(L)=>L.match(v88)?L:X(L),V=(L,A)=>`${rp(L)}=${W(A)}`,U=(L,A)=>" "+V(L,A),O=V("timestamp",Y.toISOString());O+=U("level",K.label),O+=U("fiber",G$(G));let q=m2(B);for(let L=0;L<q.length;L++)O+=U("message",sQ(q[L],J));if(!rC(Q))O+=U("cause",sY(Q,{renderErrorCause:!0}));for(let L of H)O+=" "+hL(Y.getTime())(L);for(let[L,A]of Z)O+=U(L,sQ(A,J));return O},k88=(X)=>`"${X.replace(/\\([\s\S])|(")/g,"\\$1$2")}"`,mE=nJ(O20(k88)),dE=nJ(O20(JSON.stringify,0)),aL=nJ(({annotations:X,cause:J,date:Z,fiberId:Q,logLevel:Y,message:G,spans:K})=>{let B=Z.getTime(),H={},W={};if(EC(X)>0)for(let[U,O]of X)H[U]=oL(O);if(W$(K))for(let U of K)W[U.label]=B-U.startTime;let V=m2(G);return{message:V.length===1?oL(V[0]):V.map(oL),logLevel:Y.label,timestamp:Z.toISOString(),cause:Q1(J)?void 0:sY(J,{renderErrorCause:!0}),annotations:H,spans:W,fiberId:G$(Q)}}),oL=(X)=>{switch(typeof X){case"bigint":case"function":case"symbol":return String(X);default:return H9(X)}},uE=rL(aL,HN),_20=(X)=>{return typeof X==="object"&&X!=null&&FO in X},b88=(X,...J)=>{let Z="";for(let Q=0;Q<J.length;Q++)Z+=`\x1B[${J[Q]}m`;return Z+X+"\x1B[0m"},y88=(X,...J)=>X,$4={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},g88={None:[],All:[],Trace:[$4.gray],Debug:[$4.blue],Info:[$4.green],Warning:[$4.yellow],Error:[$4.red],Fatal:[$4.bgBrightRed,$4.black]},h88={None:"",All:"",Trace:"color:gray",Debug:"color:blue",Info:"color:green",Warning:"color:orange",Error:"color:red",Fatal:"background-color:red;color:white"},m88=(X)=>`${X.getHours().toString().padStart(2,"0")}:${X.getMinutes().toString().padStart(2,"0")}:${X.getSeconds().toString().padStart(2,"0")}.${X.getMilliseconds().toString().padStart(3,"0")}`,q20=typeof process==="object"&&process!==null&&typeof process.stdout==="object"&&process.stdout!==null,d88=q20&&process.stdout.isTTY===!0,u88=q20||"Deno"in globalThis,Al=(X)=>{let J=X?.mode??"auto",Q=(J==="auto"?u88?"tty":"browser":J)==="browser",Y=typeof X?.colors==="boolean"?X.colors:d88||Q,G=X?.formatDate??m88;return Q?f88({colors:Y,formatDate:G}):c88({colors:Y,formatDate:G,stderr:X?.stderr===!0})},c88=(X)=>{let J=X.colors?b88:y88;return nJ(({annotations:Z,cause:Q,context:Y,date:G,fiberId:K,logLevel:B,message:H,spans:W})=>{let V=FG(Y,TX),U=z9(V,LZ).unsafe,O=X.stderr===!0?U.error:U.log,q=m2(H),L=J(`[${X.formatDate(G)}]`,$4.white)+` ${J(B.label,...g88[B._tag])} (${G$(K)})`;if(W$(W)){let M=G.getTime(),x=hL(M);for(let j of W)L+=" "+x(j)}L+=":";let A=0;if(q.length>0){let M=oL(q[0]);if(typeof M==="string")L+=" "+J(M,$4.bold,$4.cyan),A++}if(O(L),U.group(),!Q1(Q))O(sY(Q,{renderErrorCause:!0}));if(A<q.length)for(;A<q.length;A++)O(cY(q[A]));if(EC(Z)>0)for(let[M,x]of Z)O(J(`${M}:`,$4.bold,$4.white),cY(x));U.groupEnd()})},f88=(X)=>{let J=X.colors?"%c":"";return nJ(({annotations:Z,cause:Q,context:Y,date:G,fiberId:K,logLevel:B,message:H,spans:W})=>{let V=FG(Y,TX),U=z9(V,LZ).unsafe,O=m2(H),q=`${J}[${X.formatDate(G)}]`,L=[];if(X.colors)L.push("color:gray");if(q+=` ${J}${B.label}${J} (${G$(K)})`,X.colors)L.push(h88[B._tag],"");if(W$(W)){let M=G.getTime(),x=hL(M);for(let j of W)q+=" "+x(j)}q+=":";let A=0;if(O.length>0){let M=oL(O[0]);if(typeof M==="string"){if(q+=` ${J}${M}`,X.colors)L.push("color:deepskyblue");A++}}if(U.groupCollapsed(q,...L),!Q1(Q))U.error(..._$(Q));if(A<O.length)for(;A<O.length;A++)U.log(cY(O[A]));if(EC(Z)>0)for(let[M,x]of Z){let j=cY(x);if(X.colors)U.log(`%c${M}:`,"color:gray",j);else U.log(`${M}:`,j)}U.groupEnd()})},cE=c0("effect/Logger/prettyLoggerDefault",()=>Al());var w20="effect/MetricBoundaries",Tl=Symbol.for(w20);class L20{values;[Tl]=Tl;constructor(X){this.values=X,this._hash=z(R8(w20),A0(uY(this.values)))}_hash;[y0](){return this._hash}[b0](X){return p88(X)&&_0(this.values,X.values)}pipe(){return K0(this,arguments)}}var p88=(X)=>V0(X,Tl),l88=(X)=>{let J=z(X,z8(m0(Number.POSITIVE_INFINITY)),Lw);return new L20(J)};var F20=(X)=>z(qB(X.count-1,(J)=>X.start*Math.pow(X.factor,J)),Q8,l88);var i88="effect/MetricKeyType",A20=Symbol.for(i88),T20="effect/MetricKeyType/Counter",Ml=Symbol.for(T20),o88="effect/MetricKeyType/Frequency",r88=Symbol.for(o88),a88="effect/MetricKeyType/Gauge",s88=Symbol.for(a88),M20="effect/MetricKeyType/Histogram",Pl=Symbol.for(M20),t88="effect/MetricKeyType/Summary",e88=Symbol.for(t88),P20={_In:(X)=>X,_Out:(X)=>X};class R20{incremental;bigint;[A20]=P20;[Ml]=Ml;constructor(X,J){this.incremental=X,this.bigint=J,this._hash=R8(T20)}_hash;[y0](){return this._hash}[b0](X){return Rl(X)}pipe(){return K0(this,arguments)}}class j20{boundaries;[A20]=P20;[Pl]=Pl;constructor(X){this.boundaries=X,this._hash=z(R8(M20),A0(Z0(this.boundaries)))}_hash;[y0](){return this._hash}[b0](X){return jl(X)&&_0(this.boundaries,X.boundaries)}pipe(){return K0(this,arguments)}}var C20=(X)=>new R20(X?.incremental??!1,X?.bigint??!1);var I20=(X)=>{return new j20(X)};var Rl=(X)=>V0(X,Ml),E20=(X)=>V0(X,r88),S20=(X)=>V0(X,s88),jl=(X)=>V0(X,Pl),x20=(X)=>V0(X,e88);var X98="effect/MetricKey",k20=Symbol.for(X98),J98={_Type:(X)=>X},Z98=dJ(_0);class fE{name;keyType;description;tags;[k20]=J98;constructor(X,J,Z,Q=[]){this.name=X,this.keyType=J,this.description=Z,this.tags=Q,this._hash=z(R8(this.name+this.description),A0(Z0(this.keyType)),A0(uY(this.tags)))}_hash;[y0](){return this._hash}[b0](X){return Q98(X)&&this.name===X.name&&_0(this.keyType,X.keyType)&&_0(this.description,X.description)&&Z98(this.tags,X.tags)}pipe(){return K0(this,arguments)}}var Q98=(X)=>V0(X,k20),b20=(X,J)=>new fE(X,C20(J),x8(J?.description));var y20=(X,J,Z)=>new fE(X,I20(J),x8(Z));var g20=$(2,(X,J)=>J.length===0?X:new fE(X.name,X.keyType,X.description,nY(X.tags,J)));var h20=Symbol.for("effect/MutableHashMap"),G98={[h20]:h20,[Symbol.iterator](){return new Cl(this)},toString(){return u8(this.toJSON())},toJSON(){return{_id:"MutableHashMap",values:Array.from(this).map(H9)}},[$8](){return this.toJSON()},pipe(){return K0(this,arguments)}};class Cl{self;referentialIterator;bucketIterator;constructor(X){this.self=X,this.referentialIterator=X.referential[Symbol.iterator]()}next(){if(this.bucketIterator!==void 0)return this.bucketIterator.next();let X=this.referentialIterator.next();if(X.done)return this.bucketIterator=new m20(this.self.buckets.values()),this.next();return X}[Symbol.iterator](){return new Cl(this.self)}}class m20{backing;constructor(X){this.backing=X}currentBucket;next(){if(this.currentBucket===void 0){let J=this.backing.next();if(J.done)return J;this.currentBucket=J.value[Symbol.iterator]()}let X=this.currentBucket.next();if(X.done)return this.currentBucket=void 0,this.next();return X}}var nB=()=>{let X=Object.create(G98);return X.referential=new Map,X.buckets=new Map,X.bucketsSize=0,X};var H7=$(2,(X,J)=>{if(b2(J)===!1)return X.referential.has(J)?I(X.referential.get(J)):S();let Z=J[y0](),Q=X.buckets.get(Z);if(Q===void 0)return S();return K98(X,Q,J)});var K98=(X,J,Z,Q=!1)=>{for(let Y=0,G=J.length;Y<G;Y++)if(Z[b0](J[Y][0])){let K=J[Y][1];if(Q)J.splice(Y,1),X.bucketsSize--;return I(K)}return S()},K5=$(2,(X,J)=>R0(H7(X,J))),XQ=$(3,(X,J,Z)=>{if(b2(J)===!1)return X.referential.set(J,Z),X;let Q=J[y0](),Y=X.buckets.get(Q);if(Y===void 0)return X.buckets.set(Q,[[J,Z]]),X.bucketsSize++,X;return d20(X,Y,J),Y.push([J,Z]),X.bucketsSize++,X}),d20=(X,J,Z)=>{for(let Q=0,Y=J.length;Q<Y;Q++)if(Z[b0](J[Q][0])){J.splice(Q,1),X.bucketsSize--;return}};var G3=$(2,(X,J)=>{if(b2(J)===!1)return X.referential.delete(J),X;let Z=J[y0](),Q=X.buckets.get(Z);if(Q===void 0)return X;if(d20(X,Q,J),Q.length===0)X.buckets.delete(Z);return X}),u20=(X)=>{return X.referential.clear(),X.buckets.clear(),X.bucketsSize=0,X},AO=(X)=>{return X.referential.size+X.bucketsSize};var B98="effect/MetricState",sL=Symbol.for(B98),c20="effect/MetricState/Counter",Il=Symbol.for(c20),f20="effect/MetricState/Frequency",El=Symbol.for(f20),p20="effect/MetricState/Gauge",Sl=Symbol.for(p20),l20="effect/MetricState/Histogram",xl=Symbol.for(l20),n20="effect/MetricState/Summary",vl=Symbol.for(n20),tL={_A:(X)=>X};class i20{count;[sL]=tL;[Il]=Il;constructor(X){this.count=X}[y0](){return z(Z0(c20),A0(Z0(this.count)),W8(this))}[b0](X){return W98(X)&&this.count===X.count}pipe(){return K0(this,arguments)}}var H98=dJ(_0);class o20{occurrences;[sL]=tL;[El]=El;constructor(X){this.occurrences=X}_hash;[y0](){return z(R8(f20),A0(uY(v0(this.occurrences.entries()))),W8(this))}[b0](X){return V98(X)&&H98(v0(this.occurrences.entries()),v0(X.occurrences.entries()))}pipe(){return K0(this,arguments)}}class r20{value;[sL]=tL;[Sl]=Sl;constructor(X){this.value=X}[y0](){return z(Z0(p20),A0(Z0(this.value)),W8(this))}[b0](X){return $98(X)&&this.value===X.value}pipe(){return K0(this,arguments)}}class a20{buckets;count;min;max;sum;[sL]=tL;[xl]=xl;constructor(X,J,Z,Q,Y){this.buckets=X,this.count=J,this.min=Z,this.max=Q,this.sum=Y}[y0](){return z(Z0(l20),A0(Z0(this.buckets)),A0(Z0(this.count)),A0(Z0(this.min)),A0(Z0(this.max)),A0(Z0(this.sum)),W8(this))}[b0](X){return U98(X)&&_0(this.buckets,X.buckets)&&this.count===X.count&&this.min===X.min&&this.max===X.max&&this.sum===X.sum}pipe(){return K0(this,arguments)}}class s20{error;quantiles;count;min;max;sum;[sL]=tL;[vl]=vl;constructor(X,J,Z,Q,Y,G){this.error=X,this.quantiles=J,this.count=Z,this.min=Q,this.max=Y,this.sum=G}[y0](){return z(Z0(n20),A0(Z0(this.error)),A0(Z0(this.quantiles)),A0(Z0(this.count)),A0(Z0(this.min)),A0(Z0(this.max)),A0(Z0(this.sum)),W8(this))}[b0](X){return z98(X)&&this.error===X.error&&_0(this.quantiles,X.quantiles)&&this.count===X.count&&this.min===X.min&&this.max===X.max&&this.sum===X.sum}pipe(){return K0(this,arguments)}}var t20=(X)=>new i20(X),e20=(X)=>{return new o20(X)},X10=(X)=>new r20(X),J10=(X)=>new a20(X.buckets,X.count,X.min,X.max,X.sum),Z10=(X)=>new s20(X.error,X.quantiles,X.count,X.min,X.max,X.sum);var W98=(X)=>V0(X,Il),V98=(X)=>V0(X,El),$98=(X)=>V0(X,Sl),U98=(X)=>V0(X,xl),z98=(X)=>V0(X,vl);var O98="effect/MetricHook",_98=Symbol.for(O98),q98={_In:(X)=>X,_Out:(X)=>X},eL=(X)=>({[_98]:q98,pipe(){return K0(this,arguments)},...X});var Q10=BigInt(0),G10=(X)=>{let J=X.keyType.bigint?Q10:0,Z=X.keyType.incremental?X.keyType.bigint?(Y)=>Y>=Q10:(Y)=>Y>=0:(Y)=>!0,Q=(Y)=>{if(Z(Y))J=J+Y};return eL({get:()=>t20(J),update:Q,modify:Q})},K10=(X)=>{let J=new Map;for(let Q of X.keyType.preregisteredWords)J.set(Q,0);let Z=(Q)=>{let Y=J.get(Q)??0;J.set(Q,Y+1)};return eL({get:()=>e20(J),update:Z,modify:Z})},B10=(X,J)=>{let Z=J;return eL({get:()=>X10(Z),update:(Q)=>{Z=Q},modify:(Q)=>{Z=Z+Q}})},H10=(X)=>{let J=X.keyType.boundaries.values,Z=J.length,Q=new Uint32Array(Z+1),Y=new Float64Array(Z),G=0,K=0,B=Number.MAX_VALUE,H=Number.MIN_VALUE;z(J,NZ(tZ),n0((U,O)=>{Y[O]=U}));let W=(U)=>{let O=0,q=Z;while(O!==q){let L=Math.floor(O+(q-O)/2),A=Y[L];if(U<=A)q=L;else O=L;if(q===O+1)if(U<=Y[O])q=O;else O=q}if(Q[O]=Q[O]+1,G=G+1,K=K+U,U<B)B=U;if(U>H)H=U},V=()=>{let U=CK(Z),O=0;for(let q=0;q<Z;q++){let L=Y[q],A=Q[q];O=O+A,U[q]=[L,O]}return U};return eL({get:()=>J10({buckets:V(),count:G,min:B,max:H,sum:K}),update:W,modify:W})},W10=(X)=>{let{error:J,maxAge:Z,maxSize:Q,quantiles:Y}=X.keyType,G=z(Y,NZ(tZ)),K=CK(Q),B=0,H=0,W=0,V=0,U=0,O=(L)=>{let A=[],M=0;while(M!==Q-1){let x=K[M];if(x!=null){let[j,T]=x,E=v6(L-j);if(IN(E,QY)&&Sw(E,Z))A.push(T)}M=M+1}return D98(J,G,NZ(A,tZ))},q=(L,A)=>{if(Q>0){B=B+1;let M=B%Q;K[M]=[A,L]}V=H===0?L:Math.min(V,L),U=H===0?L:Math.max(U,L),H=H+1,W=W+L};return eL({get:()=>Z10({error:J,quantiles:O(Date.now()),count:H,min:V,max:U,sum:W}),update:([L,A])=>q(L,A),modify:([L,A])=>q(L,A)})},D98=(X,J,Z)=>{let Q=Z.length;if(!B8(J))return l0();let Y=J[0],G=J.slice(1),K=Y10(X,Q,S(),0,Y,Z),B=X8(K);return G.forEach((H)=>{B.push(Y10(X,Q,K.value,K.consumed,H,K.rest))}),n0(B,(H)=>[H.quantile,H.value])},Y10=(X,J,Z,Q,Y,G)=>{let K=X,B=J,H=Z,W=Q,V=Y,U=G,O=X,q=J,L=Z,A=Q,M=Y,x=G;while(!0){if(!B8(U))return{quantile:V,value:S(),consumed:W,rest:[]};if(V===1)return{quantile:V,value:I(rV(U)),consumed:W+U.length,rest:[]};let j=c9(U),T=DB(U,(v)=>v===j),E=V*B,k=K/2*E,P=W+T[0].length,C=Math.abs(P-E);if(P<E-k){O=K,q=B,L=mJ(U),A=P,M=V,x=T[1],K=O,B=q,H=L,W=A,V=M,U=x;continue}if(P>E+k){let v=j8(H)?I(j):H;return{quantile:V,value:v,consumed:W,rest:U}}switch(H._tag){case"None":{O=K,q=B,L=mJ(U),A=P,M=V,x=T[1],K=O,B=q,H=L,W=A,V=M,U=x;continue}case"Some":{let v=Math.abs(E-H.value);if(C<v){O=K,q=B,L=mJ(U),A=P,M=V,x=T[1],K=O,B=q,H=L,W=A,V=M,U=x;continue}return{quantile:V,value:I(H.value),consumed:W,rest:U}}}}throw Error("BUG: MetricHook.resolveQuantiles - please report an issue at https://github.com/Effect-TS/effect/issues")};var L98="effect/MetricPair",F98=Symbol.for(L98),A98={_Type:(X)=>X};var V10=(X,J)=>{return{[F98]:A98,metricKey:X,metricState:J,pipe(){return K0(this,arguments)}}};var M98="effect/MetricRegistry",$10=Symbol.for(M98);class U10{[$10]=$10;map=nB();snapshot(){let X=[];for(let[J,Z]of this.map)X.push(V10(J,Z.get()));return X}get(X){let J=z(this.map,H7(X),u9);if(J==null){if(Rl(X.keyType))return this.getCounter(X);if(S20(X.keyType))return this.getGauge(X);if(E20(X.keyType))return this.getFrequency(X);if(jl(X.keyType))return this.getHistogram(X);if(x20(X.keyType))return this.getSummary(X);throw Error("BUG: MetricRegistry.get - unknown MetricKeyType - please report an issue at https://github.com/Effect-TS/effect/issues")}else return J}getCounter(X){let J=z(this.map,H7(X),u9);if(J==null){let Z=G10(X);if(!z(this.map,K5(X)))z(this.map,XQ(X,Z));J=Z}return J}getFrequency(X){let J=z(this.map,H7(X),u9);if(J==null){let Z=K10(X);if(!z(this.map,K5(X)))z(this.map,XQ(X,Z));J=Z}return J}getGauge(X){let J=z(this.map,H7(X),u9);if(J==null){let Z=B10(X,X.keyType.bigint?BigInt(0):0);if(!z(this.map,K5(X)))z(this.map,XQ(X,Z));J=Z}return J}getHistogram(X){let J=z(this.map,H7(X),u9);if(J==null){let Z=H10(X);if(!z(this.map,K5(X)))z(this.map,XQ(X,Z));J=Z}return J}getSummary(X){let J=z(this.map,H7(X),u9);if(J==null){let Z=W10(X);if(!z(this.map,K5(X)))z(this.map,XQ(X,Z));J=Z}return J}}var z10=()=>{return new U10};var R98="effect/Metric",j98=Symbol.for(R98),C98={_Type:(X)=>X,_In:(X)=>X,_Out:(X)=>X},N10=c0(Symbol.for("effect/Metric/globalMetricRegistry"),()=>z10()),O10=function(X,J,Z,Q){let Y=Object.assign((G)=>i6(G,(K)=>E98(Y,K)),{[j98]:C98,keyType:X,unsafeUpdate:J,unsafeValue:Z,unsafeModify:Q,register(){return this.unsafeValue([]),this},pipe(){return K0(this,arguments)}});return Y};var XF=(X,J)=>_10(b20(X,J));var _10=(X)=>{let J,Z=new WeakMap,Q=(Y)=>{if(Y.length===0){if(J!==void 0)return J;return J=N10.get(X),J}let G=Z.get(Y);if(G!==void 0)return G;return G=N10.get(g20(X,Y)),Z.set(Y,G),G};return O10(X.keyType,(Y,G)=>Q(G).update(Y),(Y)=>Q(Y).get(),(Y,G)=>Q(G).modify(Y))};var q10=(X,J,Z)=>_10(y20(X,J,Z));var D10=$(3,(X,J,Z)=>I98(X,[d$(J,Z)]));var I98=$(2,(X,J)=>{return O10(X.keyType,(Z,Q)=>X.unsafeUpdate(Z,nY(J,Q)),(Z)=>X.unsafeValue(nY(J,Z)),(Z,Q)=>X.unsafeModify(Z,nY(J,Q)))});var E98=$(2,(X,J)=>DJ(rK,(Z)=>B0(()=>X.unsafeUpdate(J,Z))));var x98="effect/Request",kl=Symbol.for(x98),v98={_E:(X)=>X,_A:(X)=>X},k98={...AK,[kl]:v98},w10=(X)=>V0(X,kl);var L10=function(){function X(J){if(J)Object.assign(this,J)}return X.prototype=k98,X}();var bl=$(2,(X,J)=>DJ(NE,(Z)=>B0(()=>{if(Z.has(X)){let Q=Z.get(X);if(!Q.state.completed)Q.state.completed=!0,sK(Q.result,J)}})));class JF{count=0;observers=new Set;interrupted=!1;addObserver(X){this.observers.add(X)}removeObserver(X){this.observers.delete(X)}increment(){this.count++,this.observers.forEach((X)=>X(this.count))}decrement(){this.count--,this.observers.forEach((X)=>X(this.count))}}var P1={Forward:0,Backward:1};class ZF{self;stack;direction;count=0;constructor(X,J,Z){this.self=X,this.stack=J,this.direction=Z}clone(){return new ZF(this.self,this.stack.slice(),this.direction)}reversed(){return new ZF(this.self,this.stack.slice(),this.direction===P1.Forward?P1.Backward:P1.Forward)}next(){let X=this.entry;if(this.count++,this.direction===P1.Forward)this.moveNext();else this.movePrev();switch(X._tag){case"None":return{done:!0,value:this.count};case"Some":return{done:!1,value:X.value}}}get key(){if(this.stack.length>0)return I(this.stack[this.stack.length-1].key);return S()}get value(){if(this.stack.length>0)return I(this.stack[this.stack.length-1].value);return S()}get entry(){return r8(zw(this.stack),(X)=>[X.key,X.value])}get index(){let X=0,J=this.stack;if(J.length===0){let Z=this.self._root;if(Z!=null)return Z.count;return 0}else if(J[J.length-1].left!=null)X=J[J.length-1].left.count;for(let Z=J.length-2;Z>=0;--Z)if(J[Z+1]===J[Z].right){if(++X,J[Z].left!=null)X+=J[Z].left.count}return X}moveNext(){let X=this.stack;if(X.length===0)return;let J=X[X.length-1];if(J.right!=null){J=J.right;while(J!=null)X.push(J),J=J.left}else{X.pop();while(X.length>0&&X[X.length-1].right===J)J=X[X.length-1],X.pop()}}get hasNext(){let X=this.stack;if(X.length===0)return!1;if(X[X.length-1].right!=null)return!0;for(let J=X.length-1;J>0;--J)if(X[J-1].left===X[J])return!0;return!1}movePrev(){let X=this.stack;if(X.length===0)return;let J=X[X.length-1];if(J!=null&&J.left!=null){J=J.left;while(J!=null)X.push(J),J=J.right}else{X.pop();while(X.length>0&&X[X.length-1].left===J)J=X[X.length-1],X.pop()}}get hasPrev(){let X=this.stack;if(X.length===0)return!1;if(X[X.length-1].left!=null)return!0;for(let J=X.length-1;J>0;--J)if(X[J-1].right===X[J])return!0;return!1}}var yX={Red:0,Black:1};var QF=({count:X,key:J,left:Z,right:Q,value:Y},G)=>({color:G,key:J,value:Y,left:Z,right:Q,count:X}),PG=(X)=>{X.count=1+(X.left?.count??0)+(X.right?.count??0)};var F10="effect/RedBlackTree",yl=Symbol.for(F10),g98={_Key:(X)=>X,_Value:(X)=>X},h98={[yl]:g98,[y0](){let X=Z0(F10);for(let J of this)X^=z(Z0(J[0]),A0(Z0(J[1])));return W8(this,X)},[b0](X){if(T10(X)){if((this._root?.count??0)!==(X._root?.count??0))return!1;let J=Array.from(X);return Array.from(this).every((Z,Q)=>{let Y=J[Q];return _0(Z[0],Y[0])&&_0(Z[1],Y[1])})}return!1},[Symbol.iterator](){let X=[],J=this._root;while(J!=null)X.push(J),J=J.left;return new ZF(this,X,P1.Forward)},toString(){return u8(this.toJSON())},toJSON(){return{_id:"RedBlackTree",values:Array.from(this).map(H9)}},[$8](){return this.toJSON()},pipe(){return K0(this,arguments)}},A10=(X,J)=>{let Z=Object.create(h98);return Z._ord=X,Z._root=J,Z},T10=(X)=>V0(X,yl),M10=(X)=>A10(X,void 0),P10=$(2,(X,J)=>{let Z=M10(J);for(let[Q,Y]of X)Z=C10(Z,Q,Y);return Z});var R10=$(2,(X,J)=>{let{_ord:Z,_root:Q}=X;while(Q!==void 0){let Y=Z(J,Q.key);if(_0(J,Q.key))return I(Q.value);if(Y<=0)Q=Q.left;else Q=Q.right}return S()});var j10=$(2,(X,J)=>R0(R10(X,J))),C10=$(3,(X,J,Z)=>{let{_ord:Q,_root:Y}=X,G=[],K=[];while(Y!=null){let B=Q(J,Y.key);if(G.push(Y),K.push(B),B<=0)Y=Y.left;else Y=Y.right}G.push({color:yX.Red,key:J,value:Z,left:void 0,right:void 0,count:1});for(let B=G.length-2;B>=0;--B){let H=G[B];if(K[B]<=0)G[B]={color:H.color,key:H.key,value:H.value,left:G[B+1],right:H.right,count:H.count+1};else G[B]={color:H.color,key:H.key,value:H.value,left:H.left,right:G[B+1],count:H.count+1}}for(let B=G.length-1;B>1;--B){let H=G[B-1],W=G[B];if(H.color===yX.Black||W.color===yX.Black)break;let V=G[B-2];if(V.left===H)if(H.left===W){let U=V.right;if(U&&U.color===yX.Red)H.color=yX.Black,V.right=QF(U,yX.Black),V.color=yX.Red,B-=1;else{if(V.color=yX.Red,V.left=H.right,H.color=yX.Black,H.right=V,G[B-2]=H,G[B-1]=W,PG(V),PG(H),B>=3){let O=G[B-3];if(O.left===V)O.left=H;else O.right=H}break}}else{let U=V.right;if(U&&U.color===yX.Red)H.color=yX.Black,V.right=QF(U,yX.Black),V.color=yX.Red,B-=1;else{if(H.right=W.left,V.color=yX.Red,V.left=W.right,W.color=yX.Black,W.left=H,W.right=V,G[B-2]=W,G[B-1]=H,PG(V),PG(H),PG(W),B>=3){let O=G[B-3];if(O.left===V)O.left=W;else O.right=W}break}}else if(H.right===W){let U=V.left;if(U&&U.color===yX.Red)H.color=yX.Black,V.left=QF(U,yX.Black),V.color=yX.Red,B-=1;else{if(V.color=yX.Red,V.right=H.left,H.color=yX.Black,H.left=V,G[B-2]=H,G[B-1]=W,PG(V),PG(H),B>=3){let O=G[B-3];if(O.right===V)O.right=H;else O.left=H}break}}else{let U=V.left;if(U&&U.color===yX.Red)H.color=yX.Black,V.left=QF(U,yX.Black),V.color=yX.Red,B-=1;else{if(H.left=W.right,V.color=yX.Red,V.right=W.left,W.color=yX.Black,W.right=H,W.left=V,G[B-2]=W,G[B-1]=H,PG(V),PG(H),PG(W),B>=3){let O=G[B-3];if(O.right===V)O.right=W;else O.left=W}break}}}return G[0].color=yX.Black,A10(X._ord,G[0])}),I10=(X)=>E10(X,P1.Forward);var E10=(X,J)=>{let Z=X[Symbol.iterator](),Q=0;return{[Symbol.iterator]:()=>E10(X,J),next:()=>{Q++;let Y=Z.key;if(J===P1.Forward)Z.moveNext();else Z.movePrev();switch(Y._tag){case"None":return{done:!0,value:Q};case"Some":return{done:!1,value:Y.value}}}}};var S10=P10;var x10=j10;var gl=I10;var hl=Symbol.for("effect/SortedSet"),u98={[hl]:{_A:(X)=>X},[y0](){return z(Z0(this.keyTree),A0(Z0(hl)),W8(this))},[b0](X){return ml(X)&&_0(this.keyTree,X.keyTree)},[Symbol.iterator](){return gl(this.keyTree)},toString(){return u8(this.toJSON())},toJSON(){return{_id:"SortedSet",values:Array.from(this).map(H9)}},[$8](){return this.toJSON()},pipe(){return K0(this,arguments)}},c98=(X)=>{let J=Object.create(u98);return J.keyTree=X,J},ml=(X)=>V0(X,hl);var lE=$(2,(X,J)=>c98(S10(Array.from(X).map((Z)=>[Z,!0]),J)));var f98=$(2,(X,J)=>{for(let Z of X)if(!J(Z))return!1;return!0});var p98=$(2,(X,J)=>x10(X.keyTree,J));var v10=$(2,(X,J)=>f98(X,(Z)=>p98(J,Z)));var nE=(X)=>gl(X.keyTree),k10=()=>(X,J)=>v10(X,J)&&v10(J,X);var n98="effect/Supervisor",YF=Symbol.for(n98),iE={_T:(X)=>X};class GF{underlying;value0;[YF]=iE;constructor(X,J){this.underlying=X,this.value0=J}get value(){return this.value0}onStart(X,J,Z,Q){this.underlying.onStart(X,J,Z,Q)}onEnd(X,J){this.underlying.onEnd(X,J)}onEffect(X,J){this.underlying.onEffect(X,J)}onSuspend(X){this.underlying.onSuspend(X)}onResume(X){this.underlying.onResume(X)}map(X){return new GF(this,z(this.value,N0(X)))}zip(X){return new KF(this,X)}}class KF{left;right;_tag="Zip";[YF]=iE;constructor(X,J){this.left=X,this.right=J}get value(){return L$(this.left.value,this.right.value)}onStart(X,J,Z,Q){this.left.onStart(X,J,Z,Q),this.right.onStart(X,J,Z,Q)}onEnd(X,J){this.left.onEnd(X,J),this.right.onEnd(X,J)}onEffect(X,J){this.left.onEffect(X,J),this.right.onEffect(X,J)}onSuspend(X){this.left.onSuspend(X),this.right.onSuspend(X)}onResume(X){this.left.onResume(X),this.right.onResume(X)}map(X){return new GF(this,z(this.value,N0(X)))}zip(X){return new KF(this,X)}}var dl=(X)=>V0(X,YF)&&p5(X,"Zip");class b10{[YF]=iE;fibers=new Set;get value(){return B0(()=>Array.from(this.fibers))}onStart(X,J,Z,Q){this.fibers.add(Q)}onEnd(X,J){this.fibers.delete(J)}onEffect(X,J){}onSuspend(X){}onResume(X){}map(X){return new GF(this,z(this.value,N0(X)))}zip(X){return new KF(this,X)}onRun(X,J){return X()}}class y10{effect;[YF]=iE;constructor(X){this.effect=X}get value(){return this.effect}onStart(X,J,Z,Q){}onEnd(X,J){}onEffect(X,J){}onSuspend(X){}onResume(X){}map(X){return new GF(this,z(this.value,N0(X)))}zip(X){return new KF(this,X)}onRun(X,J){return X()}}var i98=()=>{return new b10},g10=B0(i98),o98=(X)=>{return new y10(X)},p$=c0("effect/Supervisor/none",()=>o98(N8));var h10=s2;var m10="Empty",d10="AddSupervisor",u10="RemoveSupervisor",c10="AndThen",TO={_tag:m10},rE=(X,J)=>{return{_tag:c10,first:X,second:J}},a98=(X,J)=>{return s98(J,m0(X))},s98=(X,J)=>{let Z=X,Q=J;while(FX(Q)){let Y=qJ(Q);switch(Y._tag){case m10:{Q=_Z(Q);break}case d10:{Z=Z.zip(Y.supervisor),Q=_Z(Q);break}case u10:{Z=ul(Z,Y.supervisor),Q=_Z(Q);break}case c10:{Q=LX(Y.first)(LX(Y.second)(_Z(Q)));break}}}return Z},ul=(X,J)=>{if(_0(X,J))return p$;else if(dl(X))return ul(X.left,J).zip(ul(X.right,J));else return X},aE=(X)=>{if(_0(X,p$))return YY();else if(dl(X))return z(aE(X.left),gK(aE(X.right)));else return zG(X)},t98=(X,J)=>{if(_0(X,J))return TO;let Z=aE(X),Q=aE(J),Y=z(Q,Df(Z),o2(TO,(K,B)=>rE(K,{_tag:d10,supervisor:B}))),G=z(Z,Df(Q),o2(TO,(K,B)=>rE(K,{_tag:u10,supervisor:B})));return rE(Y,G)},f10=h10({empty:TO,patch:a98,combine:rE,diff:t98});var ZX8=XF("effect_fiber_started",{incremental:!0}),p10=XF("effect_fiber_active"),QX8=XF("effect_fiber_successes",{incremental:!0}),YX8=XF("effect_fiber_failures",{incremental:!0}),GX8=D10(q10("effect_fiber_lifetimes",F20({start:0.5,factor:2,count:35})),"time_unit","milliseconds"),BF="Continue",KX8="Done",l10="Yield",BX8={_E:(X)=>X,_A:(X)=>X},sE=(X)=>{throw Error(`BUG: FiberRuntime - ${sQ(X)} - please report an issue at https://github.com/Effect-TS/effect/issues`)},iB=Symbol.for("effect/internal/fiberRuntime/YieldedOp"),oB=c0("effect/internal/fiberRuntime/yieldedOpChannel",()=>({currentOp:null})),HF={[$N]:(X,J,Z)=>{return JX(()=>J.effect_instruction_i1(Z))},["OnStep"]:(X,J,Z)=>{return M9(M9(Z))},[UN]:(X,J,Z)=>{return JX(()=>J.effect_instruction_i2(Z))},[Qw]:(X,J,Z)=>{if(X.patchRuntimeFlags(X.currentRuntimeFlags,J.patch),mK(X.currentRuntimeFlags)&&X.isInterrupted())return L9(X.getInterruptedCause());else return M9(Z)},[zN]:(X,J,Z)=>{if(JX(()=>J.effect_instruction_i2(Z)),JX(()=>J.effect_instruction_i0()))return X.pushStack(J),JX(()=>J.effect_instruction_i1());else return N8},[lV]:(X,J,Z)=>{while(!0){let Q=JX(()=>J.effect_instruction_i0.next(Z));if(Q.done)return M9(Q.value);let Y=uV(Q.value);if(!j$(Y))return X.pushStack(J),Y;else if(Y._tag==="Failure")return Y;Z=Y.value}}},HX8={[Ol]:(X,J,Z,Q)=>{return X.processNewInterruptSignal(Q.cause),mK(J)?L9(Q.cause):Z},[ql]:(X,J,Z,Q)=>{throw Error("It is illegal to have multiple concurrent run loops in a single fiber")},[_l]:(X,J,Z,Q)=>{return Q.onFiber(X,Sp(J)),Z},[Dl]:(X,J,Z,Q)=>{return p(nK(),()=>Z)}},WX8=(X)=>AQ(l40(X),(J)=>UY(o40(J),([Z,Q])=>{let Y=new Map,G=[];for(let B of Q){G.push(G9(B));for(let H of B)Y.set(H.request,H)}let K=G.flat();return iX(DX8(Z.runAll(G),K,()=>K.forEach((B)=>{B.listeners.interrupted=!0})),NE,Y)},!1,!1)),VX8=Gw();class JS extends fJ{[LO]=iL;[SE]=BX8;_fiberRefs;_fiberId;_queue=[];_children=null;_observers=[];_running=!1;_stack=[];_asyncInterruptor=null;_asyncBlockingOn=null;_exitValue=null;_steps=[];_isYielding=!1;currentRuntimeFlags;currentOpCount=0;currentSupervisor;currentScheduler;currentTracer;currentSpan;currentContext;currentDefaultServices;constructor(X,J,Z){super();if(this.currentRuntimeFlags=Z,this._fiberId=X,this._fiberRefs=J,pC(Z)){let Q=this.getFiberRef(rK);ZX8.unsafeUpdate(1,Q),p10.unsafeUpdate(1,Q)}this.refreshRefCache()}commit(){return G5(this)}id(){return this._fiberId}resume(X){this.tell(f$(X))}get status(){return this.ask((X,J)=>J)}get runtimeFlags(){return this.ask((X,J)=>{if(v30(J))return X.currentRuntimeFlags;return J.runtimeFlags})}scope(){return Y20(this)}get children(){return this.ask((X)=>Array.from(X.getChildren()))}getChildren(){if(this._children===null)this._children=new Set;return this._children}getInterruptedCause(){return this.getFiberRef(O1)}fiberRefs(){return this.ask((X)=>X.getFiberRefs())}ask(X){return I0(()=>{let J=LG(this._fiberId);return this.tell(wO((Z,Q)=>{sK(J,B0(()=>X(Z,Q)))})),IX(J)})}tell(X){if(this._queue.push(X),!this._running)this._running=!0,this.drainQueueLaterOnExecutor()}get await(){return rZ((X)=>{let J=(Z)=>X(o(Z));if(this._exitValue!==null){J(this._exitValue);return}return this.tell(wO((Z,Q)=>{if(Z._exitValue!==null)J(this._exitValue);else Z.addObserver(J)})),B0(()=>this.tell(wO((Z,Q)=>{Z.removeObserver(J)})))},this.id())}get inheritAll(){return M8((X,J)=>{let Z=X.id(),Q=X.getFiberRefs(),Y=J.runtimeFlags,G=this.getFiberRefs(),K=fI(Q,Z,G);X.setFiberRefs(K);let B=X.getFiberRef(fl),H=z(aY(Y,B),ff(rY),ff(iw));return $1(H)})}get poll(){return B0(()=>x8(this._exitValue))}unsafePoll(){return this._exitValue}interruptAsFork(X){return B0(()=>this.tell(IE(cJ(X))))}unsafeInterruptAsFork(X){this.tell(IE(cJ(X)))}addObserver(X){if(this._exitValue!==null)X(this._exitValue);else this._observers.push(X)}removeObserver(X){this._observers=this._observers.filter((J)=>J!==X)}getFiberRefs(){return this.setFiberRef(fl,this.currentRuntimeFlags),this._fiberRefs}unsafeDeleteFiberRef(X){this._fiberRefs=SL(this._fiberRefs,X)}getFiberRef(X){if(this._fiberRefs.locals.has(X))return this._fiberRefs.locals.get(X)[0][1];return X.initial}setFiberRef(X,J){this._fiberRefs=b$(this._fiberRefs,{fiberId:this._fiberId,fiberRef:X,value:J}),this.refreshRefCache()}refreshRefCache(){this.currentDefaultServices=this.getFiberRef(TX),this.currentTracer=this.currentDefaultServices.unsafeMap.get(eK.key),this.currentSupervisor=this.getFiberRef($F),this.currentScheduler=this.getFiberRef(MG),this.currentContext=this.getFiberRef(F7),this.currentSpan=this.currentContext.unsafeMap.get(A7.key)}setFiberRefs(X){this._fiberRefs=X,this.refreshRefCache()}addChild(X){this.getChildren().add(X)}removeChild(X){this.getChildren().delete(X)}transferChildren(X){let J=this._children;if(this._children=null,J!==null&&J.size>0){for(let Z of J)if(Z._exitValue===null)X.add(this.currentRuntimeFlags,Z)}}drainQueueOnCurrentThread(){let X=!0;while(X){let J=BF,Z=globalThis[lB];globalThis[lB]=this;try{while(J===BF)J=this._queue.length===0?KX8:this.evaluateMessageWhileSuspended(this._queue.splice(0,1)[0])}finally{this._running=!1,globalThis[lB]=Z}if(this._queue.length>0&&!this._running)if(this._running=!0,J===l10)this.drainQueueLaterOnExecutor(),X=!1;else X=!0;else X=!1}}drainQueueLaterOnExecutor(){this.currentScheduler.scheduleTask(this.run,this.getFiberRef(DG),this)}drainQueueWhileRunning(X,J){let Z=J;while(this._queue.length>0){let Q=this._queue.splice(0,1)[0];Z=HX8[Q._tag](this,X,Z,Q)}return Z}isInterrupted(){return!Q1(this.getFiberRef(O1))}addInterruptedCause(X){let J=this.getFiberRef(O1);this.setFiberRef(O1,OX(J,X))}processNewInterruptSignal(X){this.addInterruptedCause(X),this.sendInterruptSignalToAllChildren()}sendInterruptSignalToAllChildren(){if(this._children===null||this._children.size===0)return!1;let X=!1;for(let J of this._children)J.tell(IE(cJ(this.id()))),X=!0;return X}interruptAllChildren(){if(this.sendInterruptSignalToAllChildren()){let X=this._children.values();this._children=null;let J=!1;return U1({while:()=>!J,body:()=>{let Q=X.next();if(!Q.done)return AX(Q.value.await);else return B0(()=>{J=!0})},step:()=>{}})}return null}reportExitValue(X){if(pC(this.currentRuntimeFlags)){let J=this.getFiberRef(rK),Z=this.id().startTimeMillis,Q=Date.now();switch(GX8.unsafeUpdate(Q-Z,J),p10.unsafeUpdate(-1,J),X._tag){case wX:{QX8.unsafeUpdate(1,J);break}case DX:{YX8.unsafeUpdate(1,J);break}}}if(X._tag==="Failure"){let J=this.getFiberRef(eN);if(!z$(X.cause)&&J._tag==="Some")this.log("Fiber terminated with an unhandled error",X.cause,J)}}setExitValue(X){this._exitValue=X,this.reportExitValue(X);for(let J=this._observers.length-1;J>=0;J--)this._observers[J](X);this._observers=[]}getLoggers(){return this.getFiberRef(jO)}log(X,J,Z){let Q=R0(Z)?Z.value:this.getFiberRef(_L),Y=this.getFiberRef(PO);if(ZE(Y,Q))return;let G=this.getFiberRef(qL),K=this.getFiberRef(oK),B=this.getLoggers(),H=this.getFiberRefs();if(MB(B)>0){let W=z9(this.getFiberRef(TX),jQ),V=new Date(W.unsafeCurrentTimeMillis());Bc(H,()=>{for(let U of B)U.log({fiberId:this.id(),logLevel:Q,message:X,cause:J,context:H,spans:G,annotations:K,date:V})})}}evaluateMessageWhileSuspended(X){switch(X._tag){case Dl:return l10;case Ol:{if(this.processNewInterruptSignal(X.cause),this._asyncInterruptor!==null)this._asyncInterruptor(L9(X.cause)),this._asyncInterruptor=null;return BF}case ql:return this._asyncInterruptor=null,this._asyncBlockingOn=null,this.evaluateEffect(X.effect),BF;case _l:return X.onFiber(this,this._exitValue!==null?S30:x30(this.currentRuntimeFlags,this._asyncBlockingOn)),BF;default:return sE(X)}}evaluateEffect(X){this.currentSupervisor.onResume(this);try{let J=mK(this.currentRuntimeFlags)&&this.isInterrupted()?L9(this.getInterruptedCause()):X;while(J!==null){let Z=J,Q=this.runLoop(Z);if(Q===iB){let Y=oB.currentOp;if(oB.currentOp=null,Y._op===NN)if(mf(this.currentRuntimeFlags))this.tell(X20()),this.tell(f$(oX)),J=null;else J=oX;else if(Y._op===pV)J=null}else{this.currentRuntimeFlags=z(this.currentRuntimeFlags,cC(iw));let Y=this.interruptAllChildren();if(Y!==null)J=p(Y,()=>Q);else{if(this._queue.length===0)this.setExitValue(Q);else this.tell(f$(Q));J=null}}}}finally{this.currentSupervisor.onSuspend(this)}}start(X){if(!this._running){this._running=!0;let J=globalThis[lB];globalThis[lB]=this;try{this.evaluateEffect(X)}finally{if(this._running=!1,globalThis[lB]=J,this._queue.length>0)this.drainQueueLaterOnExecutor()}}else this.tell(f$(X))}startFork(X){this.tell(f$(X))}patchRuntimeFlags(X,J){let Z=dK(X,J);return globalThis[lB]=this,this.currentRuntimeFlags=Z,Z}initiateAsync(X,J){let Z=!1,Q=(Y)=>{if(!Z)Z=!0,this.tell(f$(Y))};if(mK(X))this._asyncInterruptor=Q;try{J(Q)}catch(Y){Q(W9(k6(Y)))}}pushStack(X){if(this._stack.push(X),X._op==="OnStep")this._steps.push({refs:this.getFiberRefs(),flags:this.currentRuntimeFlags})}popStack(){let X=this._stack.pop();if(X){if(X._op==="OnStep")this._steps.pop();return X}return}getNextSuccessCont(){let X=this.popStack();while(X){if(X._op!==VN)return X;X=this.popStack()}}getNextFailCont(){let X=this.popStack();while(X){if(X._op!==$N&&X._op!==zN&&X._op!==lV)return X;X=this.popStack()}}[iQ0](X){return B0(()=>x6(this.currentContext,X))}["Left"](X){return p8(X.left)}["None"](X){return p8(new wZ)}["Right"](X){return M9(X.right)}["Some"](X){return M9(X.value)}["Micro"](X){return rN((J)=>{let Z=J,Q=r30(n30(X,this.currentContext));return Q.addObserver((Y)=>{if(Y._tag==="Success")return Z(M9(Y.value));switch(Y.cause._tag){case"Interrupt":return Z(L9(cJ(d7)));case"Fail":return Z(p8(Y.cause.error));case"Die":return Z(aZ(Y.cause.defect))}}),rN((Y)=>{Z=(G)=>{Y(N8)},Q.unsafeInterrupt()})})}[Vj](X){let J=JX(()=>X.effect_instruction_i0()),Z=this.getNextSuccessCont();if(Z!==void 0){if(!(Z._op in HF))sE(Z);return HF[Z._op](this,Z,J)}else return oB.currentOp=M9(J),iB}[wX](X){let J=X,Z=this.getNextSuccessCont();if(Z!==void 0){if(!(Z._op in HF))sE(Z);return HF[Z._op](this,Z,J.effect_instruction_i0)}else return oB.currentOp=J,iB}[DX](X){let J=X.effect_instruction_i0,Z=this.getNextFailCont();if(Z!==void 0)switch(Z._op){case VN:case UN:if(!(mK(this.currentRuntimeFlags)&&this.isInterrupted()))return JX(()=>Z.effect_instruction_i1(J));else return L9(sw(J));case"OnStep":if(!(mK(this.currentRuntimeFlags)&&this.isInterrupted()))return M9(L9(J));else return L9(sw(J));case Qw:if(this.patchRuntimeFlags(this.currentRuntimeFlags,Z.patch),mK(this.currentRuntimeFlags)&&this.isInterrupted())return L9(OX(J,this.getInterruptedCause()));else return L9(J);default:sE(Z)}else return oB.currentOp=L9(J),iB}[$j](X){return JX(()=>X.effect_instruction_i0(this,Sp(this.currentRuntimeFlags)))}["Blocked"](X){let J=this.getFiberRefs(),Z=this.currentRuntimeFlags;if(this._steps.length>0){let Q=[],Y=this._steps[this._steps.length-1],G=this.popStack();while(G&&G._op!=="OnStep")Q.push(G),G=this.popStack();this.setFiberRefs(Y.refs),this.currentRuntimeFlags=Y.flags;let K=y$(Y.refs,J),B=aY(Y.flags,Z);return M9(vB(X.effect_instruction_i0,M8((H)=>{while(Q.length>0)H.pushStack(Q.pop());return H.setFiberRefs(g$(H.id(),H.getFiberRefs())(K)),H.currentRuntimeFlags=dK(B)(H.currentRuntimeFlags),X.effect_instruction_i1})))}return kX((Q)=>p(i$(ZI(X.effect_instruction_i0)),()=>Q(X.effect_instruction_i1)))}["RunBlocked"](X){return WX8(X.effect_instruction_i0)}[VB](X){let J=X.effect_instruction_i0,Z=this.currentRuntimeFlags,Q=dK(Z,J);if(mK(Q)&&this.isInterrupted())return L9(this.getInterruptedCause());else if(this.patchRuntimeFlags(this.currentRuntimeFlags,J),X.effect_instruction_i1){let Y=aY(Q,Z);return this.pushStack(new Jp(Y,X)),JX(()=>X.effect_instruction_i1(Z))}else return oX}[$N](X){return this.pushStack(X),X.effect_instruction_i0}["OnStep"](X){return this.pushStack(X),X.effect_instruction_i0}[VN](X){return this.pushStack(X),X.effect_instruction_i0}[UN](X){return this.pushStack(X),X.effect_instruction_i0}[pV](X){return this._asyncBlockingOn=X.effect_instruction_i1,this.initiateAsync(this.currentRuntimeFlags,X.effect_instruction_i0),oB.currentOp=X,iB}[NN](X){return this._isYielding=!1,oB.currentOp=X,iB}[zN](X){let{effect_instruction_i0:J,effect_instruction_i1:Z}=X;if(J())return this.pushStack(X),Z();else return oX}[lV](X){return HF[lV](this,X,void 0)}[WB](X){return JX(()=>X.commit())}runLoop(X){let J=X;this.currentOpCount=0;while(!0){if((this.currentRuntimeFlags&hf)!==0)this.currentSupervisor.onEffect(this,J);if(this._queue.length>0)J=this.drainQueueWhileRunning(this.currentRuntimeFlags,J);if(!this._isYielding){this.currentOpCount+=1;let Z=this.currentScheduler.shouldYield(this);if(Z!==!1){this._isYielding=!0,this.currentOpCount=0;let Q=J;J=p(nK({priority:Z}),()=>Q)}}try{if(J=this.currentTracer.context(()=>{if(VX8!==J[kB]._V){let Z=this.getFiberRef(wL);if(Z._tag==="Some"){let Q=J[kB]._V;this.log(`Executing an Effect versioned ${Q} with a Runtime of version ${Gw()}, you may want to dedupe the effect dependencies, you can use the language service plugin to detect this at compile time: https://github.com/Effect-TS/language-service`,c7,Z)}}return this[J._op](J)},this),J===iB){let Z=oB.currentOp;if(Z._op===NN||Z._op===pV)return iB;return oB.currentOp=null,Z._op===wX||Z._op===DX?Z:L9(k6(Z))}}catch(Z){if(J!==iB&&!V0(J,"_op")||!(J._op in this))J=K1(`Not a valid effect: ${sQ(J)}`);else if(NI(Z))J=L9(OX(k6(Z),cJ(d7)));else J=aZ(Z)}}}run=()=>{this.drainQueueOnCurrentThread()}}var PO=c0("effect/FiberRef/currentMinimumLogLevel",()=>_6(QE("Info"))),RO=(X)=>nJ((J)=>{let Z=FG(J.context,TX);z9(Z,LZ).unsafe.log(X.log(J))}),r10=(X)=>nJ((J)=>{let Z=FG(J.context,TX),Q=z9(Z,LZ).unsafe;switch(J.logLevel._tag){case"Debug":return Q.debug(X.log(J));case"Info":return Q.info(X.log(J));case"Trace":return Q.trace(X.log(J));case"Warning":return Q.warn(X.log(J));case"Error":case"Fatal":return Q.error(X.log(J));default:return Q.log(X.log(J))}}),a10=(X)=>nJ((J)=>{let Z=FG(J.context,TX);z9(Z,LZ).unsafe.error(X.log(J))}),n$=c0(Symbol.for("effect/Logger/defaultLogger"),()=>RO(mE)),s10=c0(Symbol.for("effect/Logger/jsonLogger"),()=>RO(uE)),t10=c0(Symbol.for("effect/Logger/logFmtLogger"),()=>RO(dE)),e10=c0(Symbol.for("effect/Logger/prettyLogger"),()=>cE),XW0=c0(Symbol.for("effect/Logger/structuredLogger"),()=>RO(aL)),pl=c0(Symbol.for("effect/Logger/tracerLogger"),()=>nJ(({annotations:X,cause:J,context:Z,fiberId:Q,logLevel:Y,message:G})=>{let K=lL(_7(cB(Z,F7),A7));if(K._tag==="None"||K.value._tag==="ExternalSpan")return;let B=x6(cB(Z,TX),jQ),H={};for(let[W,V]of X)H[W]=V;if(H["effect.fiberId"]=U40(Q),H["effect.logLevel"]=Y.label,J!==null&&J._tag!=="Empty")H["effect.cause"]=sY(J,{renderErrorCause:!0});K.value.event(sQ(Array.isArray(G)&&G.length===1?G[0]:G),B.unsafeCurrentTimeNanos(),H)})),JW0=(X)=>yE(X,(J)=>{let Z=pX(xL(J.context,F7),_7(A7));if(Z._tag==="None")return J;return{...J,annotations:z(J.annotations,w7("effect.traceId",Z.value.traceId),w7("effect.spanId",Z.value.spanId),Z.value._tag==="Span"?w7("effect.spanName",Z.value.name):t)}}),jO=c0(Symbol.for("effect/FiberRef/currentLoggers"),()=>Vp(zG(n$,pl))),ZW0=$(3,(X,J,Z)=>p(YS,(Q)=>{let Y=[],G=I0(()=>{if(Y.length===0)return N8;let K=Y;return Y=[],Z(K)});return kX((K)=>z(Q3(J),i8(G),wE,K,i$,p((B)=>XO(Q,qG(B))),i8(RG(()=>G)),l9(nJ((B)=>{Y.push(X.log(B))}))))})),QW0=function(){if(typeof arguments[0]==="string")return KJ(oK,w7(arguments[0],arguments[1]));let X=Object.entries(arguments[0]);return KJ(oK,O40((J)=>{for(let Z=0;Z<X.length;Z++){let[Q,Y]=X[Z];w7(J,Q,Y)}return J}))},YW0=$(2,(X,J)=>{let Z=typeof J==="string"?QE(J):J;return M8((Q)=>{let Y=Q.getFiberRef(PO);if(ZE(Y,Z))return o(S());return N0(X,I)})}),K3=$((X)=>b9(X[0]),(X,J)=>MQ(i6(X,(Z)=>RG((Q)=>J(Z,Q))))),GW0=$((X)=>b9(X[0]),(X,J)=>MZ(X,RG((Z)=>J(Z)))),RG=(X)=>M8((J)=>{let Z=J.getFiberRefs(),Q=ow(J.currentRuntimeFlags,rY);return p(YS,(Y)=>_1(Y,(G)=>M8((K)=>{let B=K.getFiberRefs(),H=K.currentRuntimeFlags,W=y$(B,Z),V=aY(H,Q),U=y$(Z,B);return K.setFiberRefs(g$(W,K.id(),Z)),MZ(VI(X(G),V),B0(()=>{K.setFiberRefs(g$(U,K.id(),K.getFiberRefs()))}))})))}),KW0=(X)=>{return iX(JL,I(pB))(X)},n10=Symbol.for("effect/Effect/existsPar/found"),BW0=$((X)=>oQ(X[0])&&!b9(X[0]),(X,J,Z)=>yL(Z?.concurrency,()=>I0(()=>HW0(X[Symbol.iterator](),0,J)),()=>YJ(B5(X,(Q,Y)=>GI(J(Q,Y),{onTrue:()=>p8(n10),onFalse:()=>N8}),Z),{onFailure:(Q)=>Q===n10?o(!0):p8(Q),onSuccess:()=>o(!1)}))),HW0=(X,J,Z)=>{let Q=X.next();if(Q.done)return o(!1);return p(Z(Q.value,J),(Y)=>Y?o(Y):HW0(X,J+1,Z))},WW0=$((X)=>oQ(X[0])&&!b9(X[0]),(X,J,Z)=>{let Q=Z?.negate?(Y,G)=>N0(J(Y,G),jL):J;return yL(Z?.concurrency,()=>I0(()=>v0(X).reduceRight((Y,G,K)=>iK(Y,I0(()=>Q(G,K)),(B,H)=>H?[G,...B]:B),B0(()=>[]))),()=>N0(B5(X,(Y,G)=>N0(Q(Y,G),(K)=>K?I(Y):S()),Z),SK))}),$X8=(X)=>{if(Array.isArray(X)||oQ(X))return[X,S()];let J=Object.keys(X),Z=J.length;return[J.map((Q)=>X[Q]),I((Q)=>{let Y={};for(let G=0;G<Z;G++)Y[J[G]]=Q[G];return Y})]},UX8=(X,J,Z)=>{let Q=[];for(let Y of X)Q.push(Q4(Y));return p(B5(Q,t,{concurrency:Z?.concurrency,batching:Z?.batching,concurrentFinalizers:Z?.concurrentFinalizers}),(Y)=>{let G=S(),K=Y.length,B=Array(K),H=Array(K),W=!1;for(let V=0;V<K;V++){let U=Y[V];if(U._tag==="Left")B[V]=I(U.left),W=!0;else H[V]=U.right,B[V]=G}if(W)return J._tag==="Some"?p8(J.value(B)):p8(B);else if(Z?.discard)return N8;return J._tag==="Some"?o(J.value(H)):o(H)})},zX8=(X,J,Z)=>{let Q=[];for(let Y of X)Q.push(Q4(Y));if(Z?.discard)return B5(Q,t,{concurrency:Z?.concurrency,batching:Z?.batching,discard:!0,concurrentFinalizers:Z?.concurrentFinalizers});return N0(B5(Q,t,{concurrency:Z?.concurrency,batching:Z?.batching,concurrentFinalizers:Z?.concurrentFinalizers}),(Y)=>J._tag==="Some"?J.value(Y):Y)},B3=(X,J)=>{let[Z,Q]=$X8(X);if(J?.mode==="validate")return UX8(Z,Q,J);else if(J?.mode==="either")return zX8(Z,Q,J);return J?.discard!==!0&&Q._tag==="Some"?N0(B5(Z,t,J),Q.value):B5(Z,t,J)},VW0=(X)=>(J)=>B3(J,X),$W0=(X,J)=>N0(B3(v0(X).map(B6),J),LQ((Z)=>TL(Z)?I(Z.effect_instruction_i0):S())),ll=$(2,(X,J)=>Array.from({length:J},()=>X)),UW0=$((X)=>b9(X[0]),(X,J,Z)=>B3(ll(X,J),Z)),B5=$((X)=>oQ(X[0]),(X,J,Z)=>M8((Q)=>{let Y=Z?.batching===!0||Z?.batching==="inherit"&&Q.getFiberRef(tN);if(Z?.discard)return op(Z.concurrency,()=>l$(BO,Z?.concurrentFinalizers)((G)=>Y?UY(X,(K,B)=>G(J(K,B)),!0,!1,1):AQ(X,(K,B)=>G(J(K,B)))),()=>l$(dI,Z?.concurrentFinalizers)((G)=>UY(X,(K,B)=>G(J(K,B)),Y,!1)),(G)=>l$(uI(G),Z?.concurrentFinalizers)((K)=>UY(X,(B,H)=>K(J(B,H)),Y,!1,G)));return op(Z?.concurrency,()=>l$(BO,Z?.concurrentFinalizers)((G)=>Y?cl(X,1,(K,B)=>G(J(K,B)),!0):DZ(X,(K,B)=>G(J(K,B)))),()=>l$(dI,Z?.concurrentFinalizers)((G)=>MO(X,(K,B)=>G(J(K,B)),Y)),(G)=>l$(uI(G),Z?.concurrentFinalizers)((K)=>cl(X,G,(B,H)=>K(J(B,H)),Y)))})),MO=(X,J,Z)=>I0(()=>{let Q=v0(X),Y=Array(Q.length);return i8(UY(Q,(K,B)=>p(J(K,B),(H)=>B0(()=>Y[B]=H)),Z,!1),o(Y))}),UY=(X,J,Z,Q,Y)=>kX((G)=>HI((K)=>M8((B)=>{let H=Array.from(X).reverse(),W=H.length;if(W===0)return N8;let V=0,U=!1,O=Y?Math.min(H.length,Y):H.length,q=new Set,L=[],A=()=>q.forEach((v)=>{v.currentScheduler.scheduleTask(()=>{v.unsafeInterruptAsFork(B.id())},0,v)}),M=[],x=[],j=[],T=()=>{let v=L.filter(({exit:f})=>f._tag==="Failure").sort((f,s)=>f.index<s.index?-1:f.index===s.index?0:1).map(({exit:f})=>f);if(v.length===0)v.push(oX);return v},E=(v,f=!1)=>{let s=MQ(K(v)),l=NX8(s,B,B.currentRuntimeFlags,pB);return B.currentScheduler.scheduleTask(()=>{if(f)l.unsafeInterruptAsFork(B.id());l.resume(s)},0,l),l},k=()=>{if(!Q)W-=H.length,H=[];U=!0,A()},P=Z?YI:B6,C=E(rZ((v)=>{let f=(l,W0)=>{if(l._op==="Blocked")j.push(l);else if(L.push({index:W0,exit:l}),l._op==="Failure"&&!U)k()},s=()=>{if(H.length>0){let l=H.pop(),W0=V++,b=()=>{let J0=H.pop();return W0=V++,p(nK(),()=>p(P(G(J(J0,W0))),a))},a=(J0)=>{if(H.length>0){if(f(J0,W0),H.length>0)return b()}return o(J0)},n=p(P(G(J(l,W0))),a),r=E(n);if(M.push(r),q.add(r),U)r.currentScheduler.scheduleTask(()=>{r.unsafeInterruptAsFork(B.id())},0,r);r.addObserver((J0)=>{let F0;if(J0._op==="Failure")F0=J0;else F0=J0.effect_instruction_i0;if(x.push(r),q.delete(r),f(F0,W0),L.length===W)v(o(i0(q1(T(),{parallel:!0}),()=>oX)));else if(j.length+L.length===W){let Z8=T(),J8=j.map((S8)=>S8.effect_instruction_i0).reduce(lf);v(o(vB(J8,UY([i0(q1(Z8,{parallel:!0}),()=>oX),...j.map((S8)=>S8.effect_instruction_i1)],(S8)=>S8,Z,!0,Y))))}else s()})}};for(let l=0;l<O;l++)s()}));return AX(TQ(BY(G(G5(C))),E$({onFailure:(v)=>{k();let f=j.length+1,s=Math.min(typeof Y==="number"?Y:j.length,j.length),l=Array.from(j);return rZ((W0)=>{let b=[],a=0,n=0,r=(F0,Z8)=>(J8)=>{if(b[F0]=J8,a++,a===f)W0(M9(L9(v)));if(l.length>0&&Z8)J0()},J0=()=>{E(l.pop(),!0).addObserver(r(n,!0)),n++};C.addObserver(r(n,!1)),n++;for(let F0=0;F0<s;F0++)J0()})},onSuccess:()=>DZ(x,(v)=>v.inheritAll)})))}))),cl=(X,J,Z,Q)=>I0(()=>{let Y=v0(X),G=Array(Y.length);return i8(UY(Y,(B,H)=>N0(Z(B,H),(W)=>G[H]=W),Q,!1,J),o(G))}),rB=(X)=>M8((J,Z)=>o(WF(X,J,Z.runtimeFlags))),i$=(X)=>OX8(X,pB),zW0=$(2,(X,J)=>rB(BI(X,(Z)=>{let Q=NG(Z);switch(Q._tag){case"Left":return J(Q.left);case"Right":return W9(Q.right)}}))),WF=(X,J,Z,Q=null)=>{let Y=tE(X,J,Z,Q);return Y.resume(X),Y},NX8=(X,J,Z,Q=null)=>{return tE(X,J,Z,Q)},tE=(X,J,Z,Q=null)=>{let Y=IC(),G=J.getFiberRefs(),K=Cp(G,Y),B=new JS(Y,K,Z),H=cB(K,F7),W=B.currentSupervisor;return W.onStart(H,X,I(J),B),B.addObserver((U)=>W.onEnd(U,B)),(Q!==null?Q:z(J.getFiberRef(JL),i0(()=>J.scope()))).add(Z,B),B},OX8=(X,J)=>M8((Z,Q)=>o(WF(X,Z,Q.runtimeFlags,J))),nl=$((X)=>dY(X[2]),(X,J,Z,Q)=>yL(Q?.concurrency,()=>v0(X).reduce((Y,G,K)=>iK(Y,G,(B,H)=>Z(B,H,K)),o(J)),()=>p(bX(J),(Y)=>p(B5(X,(G,K)=>p(G,(B)=>lJ(Y,(H)=>Z(H,B,K))),Q),()=>ZX(Y))))),il=$((X)=>oQ(X[0]),(X,J,Z)=>z(B5(X,(Q,Y)=>Q4(J(Q,Y)),Z),N0((Q)=>MG0(Q,t)))),NW0=$((X)=>oQ(X[0]),(X,J,Z)=>p(il(X,J,{concurrency:Z?.concurrency,batching:Z?.batching,concurrentFinalizers:Z?.concurrentFinalizers}),([Q,Y])=>i5(Q)?p8(Q):Z?.discard?N8:o(Y))),OW0=(X)=>M8((J,Z)=>rZ((Q)=>{let Y=new Set,G,K=c7,B=()=>{for(let V of Y)V.unsafeInterruptAsFork(J.id())},H=!1,W=!0;for(let V of X){W=!1;let U=WF(OG(V),J,Z.runtimeFlags);if(Y.add(U),U.addObserver((O)=>{if(Y.delete(U),!G)if(O._tag==="Success")H=!0,G=U,K=c7,B();else K=B7(O.cause,K);if(H&&Y.size===0)Q(G?i8(vE(G),G.unsafePoll()):W9(K))}),G)break}if(W)return Q(B1(()=>new P$("Received an empty collection of effects")));return H=!0,kE(Y,J.id())})),_W0=$((X)=>oQ(X[0])&&!b9(X[0]),(X,J,Z,Q)=>yL(Q?.concurrency,()=>v0(X).reduce((Y,G,K)=>iK(Y,G,(B,H)=>Z(B,H,K)),J),()=>I0(()=>z(nl([J,...X],S(),(Y,G,K)=>{switch(Y._tag){case"None":return I(G);case"Some":return I(Z(Y.value,G,K))}},Q),N0((Y)=>{switch(Y._tag){case"None":throw Error("BUG: Effect.reduceEffect - please report an issue at https://github.com/Effect-TS/effect/issues");case"Some":return Y.value}}))))),eE=(X)=>B4((J)=>w0(_7(J,iJ),{onNone:()=>X,onSome:(Z)=>{switch(Z.strategy._tag){case"Parallel":return X;case"Sequential":case"ParallelN":return p(eY(Z,dI),(Q)=>H3(X,Q))}}})),i10=(X)=>(J)=>B4((Z)=>w0(_7(Z,iJ),{onNone:()=>J,onSome:(Q)=>{if(Q.strategy._tag==="ParallelN"&&Q.strategy.parallelism===X)return J;return p(eY(Q,uI(X)),(Y)=>H3(J,Y))}})),qW0=(X)=>(J)=>l$(X,!0)(J),l$=(X,J)=>(Z)=>B4((Q)=>w0(_7(Q,iJ),{onNone:()=>Z(t),onSome:(Y)=>{if(J===!0){let G=X._tag==="Parallel"?eE:X._tag==="Sequential"?XS:i10(X.parallelism);switch(Y.strategy._tag){case"Parallel":return G(Z(eE));case"Sequential":return G(Z(XS));case"ParallelN":return G(Z(i10(Y.strategy.parallelism)))}}else return Z(t)}})),z4=(X)=>p(iJ,X),VF=(X)=>p(H5(),(J)=>TQ(X(J),(Z)=>J.close(Z))),ZS=(X)=>p(H5(),(J)=>sl(X,J)),XS=(X)=>B4((J)=>w0(_7(J,iJ),{onNone:()=>X,onSome:(Z)=>{switch(Z.strategy._tag){case"Sequential":return X;case"Parallel":case"ParallelN":return p(eY(Z,BO),(Q)=>H3(X,Q))}}})),DW0=(X,J)=>ol([d$(X,J)]),ol=(X)=>KJ(rK,(J)=>nY(J,X)),wW0=$(2,(X,J)=>VF((Z)=>p(H3(X,Z),J))),LW0=$((X)=>b9(X[1]),(X,J,Z)=>rl(X,J,(Q,Y)=>[Q,Y],Z)),rl=$((X)=>b9(X[1]),(X,J,Z,Q)=>BY(aB(B6(X),B6(J),(Y,G)=>K4(Y,G,{onSuccess:Z,onFailure:(K,B)=>Q?.concurrent?B7(K,B):OX(K,B)}),Q)));var FW0=$((X)=>oQ(X[0]),(X,J,Z)=>W1(B5(X,(Q,Y)=>W1(J(Q,Y)),Z))),AW0=(X)=>KJ(TX,X9(jQ,X)),TW0=(X)=>KJ(TX,X9(tK,X)),QS=(X)=>KJ(TX,X9(GO,X)),MW0=(X)=>z4((J)=>p(eY(J,VY),(Z)=>z(X,H3(Z),N0((Q)=>[KY((Y)=>RQ(Z,I$(Y))),Q])))),PW0=$((X)=>b9(X[1]),(X,J,Z)=>aB(X,J,(Q,Y)=>[Q,Y],Z)),RW0=$((X)=>b9(X[1]),(X,J,Z)=>{if(Z?.concurrent!==!0&&(Z?.batching===void 0||Z.batching===!1))return F$(X,J);return aB(X,J,(Q,Y)=>Q,Z)}),jW0=$((X)=>b9(X[1]),(X,J,Z)=>{if(Z?.concurrent!==!0&&(Z?.batching===void 0||Z.batching===!1))return i8(X,J);return aB(X,J,(Q,Y)=>Y,Z)}),aB=$((X)=>b9(X[1]),(X,J,Z,Q)=>N0(B3([X,J],{concurrency:Q?.concurrent?2:1,batching:Q?.batching,concurrentFinalizers:Q?.concurrentFinalizers}),([Y,G])=>Z(Y,G))),al=(X)=>{if(X===c40)return N8;return z(aN,p((J)=>{let Z=dK(J,X),Q=aY(Z,J);return z($1(X),i8(RG(()=>$1(Q))),AX)}),MQ)},iJ=g8("effect/Scope"),YS=iJ,_X8=(X,J)=>{if(X.state._tag==="Open")X.state.finalizers.set({},J)},qX8={[FL]:FL,[AL]:AL,pipe(){return K0(this,arguments)},fork(X){return B0(()=>{let J=CW0(X);if(this.state._tag==="Closed")return J.state=this.state,J;let Z={},Q=(Y)=>J.close(Y);return this.state.finalizers.set(Z,Q),_X8(J,(Y)=>B0(()=>{if(this.state._tag==="Open")this.state.finalizers.delete(Z)})),J})},close(X){return I0(()=>{if(this.state._tag==="Closed")return N8;let J=Array.from(this.state.finalizers.values()).reverse();if(this.state={_tag:"Closed",exit:X},J.length===0)return N8;return Mp(this.strategy)?z(DZ(J,(Z)=>B6(Z(X))),p((Z)=>z(q1(Z),r8(ZO),i0(()=>oX)))):Pp(this.strategy)?z(MO(J,(Z)=>B6(Z(X)),!1),p((Z)=>z(q1(Z,{parallel:!0}),r8(ZO),i0(()=>oX)))):z(cl(J,this.strategy.parallelism,(Z)=>B6(Z(X)),!1),p((Z)=>z(q1(Z,{parallel:!0}),r8(ZO),i0(()=>oX))))})},addFinalizer(X){return I0(()=>{if(this.state._tag==="Closed")return X(this.state.exit);return this.state.finalizers.set({},X),N8})}},CW0=(X=VY)=>{let J=Object.create(qX8);return J.strategy=X,J.state={_tag:"Open",finalizers:new Map},J},H5=(X=VY)=>B0(()=>CW0(X)),H3=$(2,(X,J)=>hB(X,CX(OZ(iJ,J)))),sl=$(2,(X,J)=>z(X,H3(J),TQ((Z)=>J.close(Z)))),IW0=(X)=>N1(X,{differ:f10,fork:TO}),TZ=$(2,(X,J)=>AX(K3(p(PQ(X),(Z)=>l9(xB(X,J),Z)),(Z)=>xB(X,Z)))),KJ=$(2,(X,J)=>DJ(X,(Z)=>TZ(X,J(Z))));var fl=SG0(df),$F=IW0(p$),tl=(X)=>B5(X,xE),GS=(X)=>{return{...dB,commit(){return G5(this)},[LO]:iL,id:()=>v0(X).reduce((Z,Q)=>K$(Z,Q.id()),d7),await:B6(MO(X,(Z)=>BY(Z.await),!1)),children:N0(MO(X,(Z)=>Z.children,!1),aV),inheritAll:AQ(X,(Z)=>Z.inheritAll),poll:N0(DZ(X,(Z)=>Z.poll),JY(I(M9([])),(Z,Q)=>{switch(Q._tag){case"None":return S();case"Some":switch(Z._tag){case"None":return S();case"Some":return I(K4(Q.value,Z.value,{onSuccess:(Y,G)=>[Y,...G],onFailure:B7}))}}})),interruptAsFork:(Z)=>AQ(X,(Q)=>Q.interruptAsFork(Z))}},EW0=(X)=>AX(i$(qG(X)));var el=$(3,(X,J,Z)=>Xn(X,J,{onSelfWin:(Q,Y)=>p(Q.await,(G)=>{switch(G._tag){case wX:return p(Q.inheritAll,()=>Z.onSelfDone(G,Y));case DX:return Z.onSelfDone(G,Y)}}),onOtherWin:(Q,Y)=>p(Q.await,(G)=>{switch(G._tag){case wX:return p(Q.inheritAll,()=>Z.onOtherDone(G,Y));case DX:return Z.onOtherDone(G,Y)}})})),SW0=(X)=>kX((J)=>KY((Z)=>p(i$(J(X)),(Q)=>z(J(G5(Q)),sZ(()=>z(Q,bE(Z))))))),KS=$(2,(X,J)=>KY((Z)=>el(X,J,{onSelfDone:(Q,Y)=>S$(Q,{onFailure:(G)=>z(G5(Y),_O((K)=>B7(G,K))),onSuccess:(G)=>z(Y,HY(Z),l9(G))}),onOtherDone:(Q,Y)=>S$(Q,{onFailure:(G)=>z(G5(Y),_O((K)=>B7(K,G))),onSuccess:(G)=>z(Y,HY(Z),l9(G))})}))),Xn=$(3,(X,J,Z)=>M8((Q,Y)=>{let G=Y.runtimeFlags,K=uJ(!0),B=tE(X,Q,G,Z.selfScope),H=tE(J,Q,G,Z.otherScope);return rZ((W)=>{B.addObserver(()=>o10(B,H,Z.onSelfWin,K,W)),H.addObserver(()=>o10(H,B,Z.onOtherWin,K,W)),B.startFork(X),H.startFork(J)},K$(B.id(),H.id()))})),o10=(X,J,Z,Q,Y)=>{if(TC(!0,!1)(Q))Y(Z(X,J))},MZ=$(2,(X,J)=>kX((Z)=>K6(Z(X),{onFailure:(Q)=>K6(J,{onFailure:(Y)=>W9(OX(Q,Y)),onSuccess:()=>W9(Q)}),onSuccess:(Q)=>l9(J,Q)}))),DX8=(X,J,Z)=>KY((Q)=>MZ(p(i$(OG(X)),(Y)=>rZ((G)=>{let K=J.map((W)=>W.listeners.count),B=()=>{if(K.every((W)=>W===0)){if(J.every((W)=>{if(W.result.state.current._tag==="Pending")return!0;else if(W.result.state.current._tag==="Done"&&j$(W.result.state.current.effect)&&W.result.state.current.effect._tag==="Failure"&&fN(W.result.state.current.effect.cause))return!0;else return!1}))H.forEach((W)=>W()),Z?.(),G(qG(Y))}};Y.addObserver((W)=>{H.forEach((V)=>V()),G(W)});let H=J.map((W,V)=>{let U=(O)=>{K[V]=O,B()};return W.listeners.addObserver(U),()=>W.listeners.removeObserver(U)});return B(),B0(()=>{H.forEach((W)=>W())})})),I0(()=>{let Y=J.flatMap((G)=>{if(!G.state.completed)return[G];return[]});return AQ(Y,(G)=>bl(G.request,I$(Q)))})));var U4=(X,J)=>{return J=FZ(J),MQ(M8((Z)=>{let Q=x6(Z.getFiberRef(F7),iJ),Y=RE(Z,X,J),G=Z.getFiberRef(aK),K=z9(Z.getFiberRef(TX),jQ);return l9(_1(Q,(B)=>qO(Y,B,K,G)),Y)}))},BS=(X)=>KJ(TX,X9(eK,X)),xW0=function(){let X=typeof arguments[0]!=="string",J=X?arguments[1]:arguments[0],Z=FZ(X?arguments[2]:arguments[1]);if(X){let Q=arguments[0];return p(U4(J,FZ(Z)),(Y)=>F1(Q,A7,Y))}return(Q)=>p(U4(J,FZ(Z)),(Y)=>F1(Q,A7,Y))};var P9={};y8(P9,{stripSomeDefects:()=>cX8,stripFailures:()=>uX8,squashWith:()=>oX8,squash:()=>BJ,size:()=>xX8,sequential:()=>Qn,reduceWithContext:()=>Bn,reduce:()=>tX8,prettyErrors:()=>r$,pretty:()=>CO,parallel:()=>Zn,originalError:()=>W68,match:()=>sX8,map:()=>JQ,linearize:()=>dX8,keepDefects:()=>mX8,isUnknownException:()=>K68,isTimeoutException:()=>Y68,isSequentialType:()=>EX8,isRuntimeException:()=>Hn,isParallelType:()=>SX8,isNoSuchElementException:()=>Z68,isInterruptedOnly:()=>W3,isInterruptedException:()=>X68,isInterrupted:()=>PZ,isInterruptType:()=>IX8,isIllegalArgumentException:()=>J68,isFailure:()=>kX8,isFailType:()=>Gn,isExceededCapacityException:()=>H68,isEmptyType:()=>CX8,isEmpty:()=>vX8,isDieType:()=>zF,isDie:()=>Kn,isCause:()=>Yn,interruptors:()=>NF,interruptOption:()=>hX8,interrupt:()=>R1,flipCauseOption:()=>o$,flatten:()=>nX8,flatMap:()=>pX8,find:()=>rX8,filter:()=>aX8,failures:()=>bX8,failureOrCause:()=>jG,failureOption:()=>vW0,fail:()=>N4,empty:()=>UF,dieOption:()=>gX8,die:()=>oJ,defects:()=>yX8,contains:()=>iX8,as:()=>fX8,andThen:()=>lX8,YieldableError:()=>jX8,UnknownExceptionTypeId:()=>RX8,UnknownException:()=>G68,TimeoutExceptionTypeId:()=>Jn,TimeoutException:()=>Q68,RuntimeExceptionTypeId:()=>LX8,RuntimeException:()=>_F,NoSuchElementExceptionTypeId:()=>TX8,NoSuchElementException:()=>OF,InvalidPubSubCapacityExceptionTypeId:()=>MX8,InterruptedExceptionTypeId:()=>FX8,InterruptedException:()=>eX8,IllegalArgumentExceptionTypeId:()=>AX8,IllegalArgumentException:()=>j1,ExceededCapacityExceptionTypeId:()=>PX8,ExceededCapacityException:()=>B68,CauseTypeId:()=>wX8});var wX8=oC,LX8=ZL,FX8=QL,AX8=YL,TX8=GL,MX8=JI,PX8=KL,Jn=BL,RX8=HL,jX8=JO,UF=c7,N4=GY,oJ=k6,R1=cJ,Zn=B7,Qn=OX,Yn=aw,CX8=rC,Gn=e40,zF=U$,IX8=XG0,EX8=JG0,SX8=ZG0,xX8=QG0,vX8=Q1,kX8=YG0,Kn=GG0,PZ=fN,W3=z$,bX8=pN,yX8=lN,NF=N$,vW0=nN,jG=NG,o$=KG0,gX8=tf,hX8=ef,mX8=aC,dX8=HG0,uX8=sw,cX8=VG0,fX8=$G0,JQ=iN,pX8=uN,lX8=UG0,nX8=sC,iX8=zG0,BJ=bG0,oX8=Up,rX8=uK,aX8=OG0,sX8=cK,tX8=EB,Bn=O$,eX8=Np,X68=NI,j1=P$,J68=gG0,OF=wZ,Z68=OI,_F=zp,Hn=yG0,Q68=Op,Y68=uG0,G68=R$,K68=cG0,B68=_I,H68=mG0,CO=sY,r$=_$,W68=TG0;var V68="effect/ScheduleInterval",qF=Symbol.for(V68),Wn={[qF]:qF,startMillis:0,endMillis:0},HS=(X,J)=>{if(X>J)return Wn;return{[qF]:qF,startMillis:X,endMillis:J}},kW0=$(2,(X,J)=>bW0(X,J)===X),bW0=$(2,(X,J)=>{if(X.endMillis<=J.startMillis)return X;if(J.endMillis<=X.startMillis)return J;if(X.startMillis<J.startMillis)return X;if(J.startMillis<X.startMillis)return J;if(X.endMillis<=J.endMillis)return X;return J});var yW0=(X)=>{return X.startMillis>=X.endMillis};var gW0=$(2,(X,J)=>{let Z=Math.max(X.startMillis,J.startMillis),Q=Math.min(X.endMillis,J.endMillis);return HS(Z,Q)}),hW0=(X)=>{return v6(X.endMillis-X.startMillis)};var mW0=(X)=>{return HS(X,Number.POSITIVE_INFINITY)};var WS=HS,Vn=Wn,dW0=kW0;var uW0=yW0;var cW0=gW0,fW0=hW0;var pW0=mW0;var U68="effect/ScheduleIntervals",$n=Symbol.for(U68),Un=(X)=>{return{[$n]:$n,intervals:X}};var nW0=$(2,(X,J)=>z68(X.intervals,J.intervals,a0())),z68=(X,J,Z)=>{let Q=X,Y=J,G=Z;while(FX(Q)&&FX(Y)){let K=z(qJ(Q),cW0(qJ(Y))),B=uW0(K)?G:z(G,LX(K));if(z(qJ(Q),dW0(qJ(Y))))Q=_Z(Q);else Y=_Z(Y);G=B}return Un(ZY(G))},VS=(X)=>{return z(X.intervals,$G,i0(()=>Vn)).startMillis},iW0=(X)=>{return z(X.intervals,$G,i0(()=>Vn)).endMillis},oW0=$(2,(X,J)=>VS(X)<VS(J)),rW0=(X)=>{return FX(X.intervals)};var aW0=Un;var sW0=nW0,IO=VS,$S=iW0,tW0=oW0,eW0=rW0;var Nn="Continue",XV0="Done",JV0=(X)=>{return{_tag:Nn,intervals:X}},ZV0=(X)=>{return{_tag:Nn,intervals:aW0(m0(X))}},QV0={_tag:XV0},YV0=(X)=>{return X._tag===Nn},GV0=(X)=>{return X._tag===XV0};var KV0=JV0;var On=ZV0,EO=QV0,_n=YV0,C1=GV0;var rJ={};y8(rJ,{use:()=>D68,make:()=>wF,fork:()=>DF,extend:()=>E1,close:()=>I1,addFinalizerExit:()=>a$,addFinalizer:()=>FJ,ScopeTypeId:()=>_68,Scope:()=>O4,CloseableScopeTypeId:()=>q68});var _68=FL,q68=AL,O4=iJ,FJ=XO,a$=_1,I1=RQ,E1=H3,DF=eY,D68=sl,wF=H5;class WV0{permits;waiters=new Set;taken=0;constructor(X){this.permits=X}get free(){return this.permits-this.taken}take=(X)=>fK((J)=>{if(this.free<X){let Z=()=>{if(this.free<X)return;this.waiters.delete(Z),J(I0(()=>{if(this.free<X)return this.take(X);return this.taken+=X,o(X)}))};return this.waiters.add(Z),B0(()=>{this.waiters.delete(Z)})}J(I0(()=>{if(this.free<X)return this.take(X);return this.taken+=X,o(X)}))});updateTakenUnsafe(X,J){if(this.taken=J(this.taken),this.waiters.size>0)X.getFiberRef(MG).scheduleTask(()=>{let Z=this.waiters.values(),Q=Z.next();while(Q.done===!1&&this.free>0)Q.value(),Q=Z.next()},X.getFiberRef(DG),X);return o(this.free)}updateTaken(X){return M8((J)=>this.updateTakenUnsafe(J,X))}resize=(X)=>AX(M8((J)=>{if(this.permits=X,this.free<0)return N8;return this.updateTakenUnsafe(J,(Z)=>Z)}));release=(X)=>this.updateTaken((J)=>J-X);releaseAll=this.updateTaken((X)=>0);withPermits=(X)=>(J)=>kX((Z)=>p(Z(this.take(X)),(Q)=>MZ(Z(J),this.release(Q))));withPermitsIfAvailable=(X)=>(J)=>kX((Z)=>I0(()=>{if(this.free<X)return c$;return this.taken+=X,MZ(Z(NO(J)),this.release(X))}))}var S1=(X)=>new WV0(X),VV0=(X)=>B0(()=>S1(X));class $V0 extends fJ{isOpen;waiters=[];scheduled=!1;constructor(X){super();this.isOpen=X}commit(){return this.await}unsafeSchedule(X){if(this.scheduled||this.waiters.length===0)return N8;return this.scheduled=!0,X.currentScheduler.scheduleTask(this.flushWaiters,X.getFiberRef(DG),X),N8}flushWaiters=()=>{this.scheduled=!1;let X=this.waiters;this.waiters=[];for(let J=0;J<X.length;J++)X[J](oX)};open=M8((X)=>{if(this.isOpen)return N8;return this.isOpen=!0,this.unsafeSchedule(X)});unsafeOpen(){if(this.isOpen)return;this.isOpen=!0,this.flushWaiters()}release=M8((X)=>{if(this.isOpen)return N8;return this.unsafeSchedule(X)});await=fK((X)=>{if(this.isOpen)return X(N8);return this.waiters.push(X),B0(()=>{let J=this.waiters.indexOf(X);if(J!==-1)this.waiters.splice(J,1)})});unsafeClose(){this.isOpen=!1}close=B0(()=>{this.isOpen=!1});whenOpen=(X)=>{return i8(this.await,X)}}var wn=(X)=>new $V0(X??!1),UV0=(X)=>B0(()=>wn(X)),zV0=(X)=>US(X,tl),NV0=$(2,(X,J)=>N0(Ln(X,J),(Z)=>Z[0])),Ln=$(2,(X,J)=>{let Z=K9(J);return p(WY(),(Q)=>N0(SO(S()),(Y)=>[X5(w68(X,Z,Y),Q),L68(Y)]))}),HV0=(X,J,Z)=>{let Q=K7(K9(J));return z(f7(),i6((Y)=>lK(X,Y)),N0((Y)=>I([Z+Q,Y])))},w68=(X,J,Z)=>kX((Q)=>z(V4((Y)=>Y.currentTimeMillis),p((Y)=>RV0(Z,(G)=>{switch(G._tag){case"None":return I(HV0(X,J,Y));case"Some":{let[K]=G.value;return K-Y<=0?I(HV0(X,J,Y)):S()}}})),p((Y)=>j8(Y)?K1("BUG: Effect.cachedInvalidate - please report an issue at https://github.com/Effect-TS/effect/issues"):Q(IX(Y.value[1]))))),L68=(X)=>W4(X,S()),OV0=$(2,(X,J)=>US(X,(Z)=>J(GS(Z)))),US=$(2,(X,J)=>p(g10,(Z)=>z(Fn(X,Z),MZ(p(Z.value,J))))),_V0=$((X)=>oQ(X[0]),(X,J)=>J?.discard?AQ(X,rB):N0(DZ(X,rB),GS)),x1=$(2,(X,J)=>M8((Z,Q)=>{let Y=J,G=WF(X,Z,Q.runtimeFlags,pB);if(Y.state._tag==="Open"){let K=()=>KY((H)=>_0(H,G.id())?N8:AX(qG(G))),B={};Y.state.finalizers.set(B,K),G.addObserver(()=>{if(Y.state._tag==="Closed")return;Y.state.finalizers.delete(B)})}else G.unsafeInterruptAsFork(Z.id());return o(G)})),zS=(X)=>z4((J)=>x1(X,J)),qV0=(X)=>G5(X),DV0=(X)=>I0(()=>p(X,G5)),qn=Symbol.for("effect/Effect/memoizeFunction.key");class Dn{a;eq;[qn]=qn;constructor(X,J){this.a=X,this.eq=J}[b0](X){if(V0(X,qn))if(this.eq)return this.eq(this.a,X.a);else return _0(this.a,X.a);return!1}[y0](){return this.eq?0:W8(this,Z0(this.a))}}var wV0=(X,J)=>{return z(B0(()=>nB()),p(SO),N0((Z)=>(Q)=>z(Z.modifyEffect((Y)=>{let G=z(Y,H7(new Dn(Q,J)));if(j8(G))return z(f7(),i6((K)=>z(OO(X(Q)),lK(K),rB)),N0((K)=>[K,z(Y,XQ(new Dn(Q,J),K))]));return o([G.value,Y])}),p(IX),p(([Y,G])=>z(u$(Y),l9(G))))))},LV0=$(2,(X,J)=>z(B6(X),KS(B6(J)),(Z)=>BY(Z))),Fn=$(2,(X,J)=>{return GJ($F,(Q)=>Q.zip(J))(X)}),FV0=$(2,(X,J)=>An(X,{onTimeout:()=>dG0(J),duration:J})),An=$(2,(X,{duration:J,onTimeout:Z})=>BY(LF(X,{onTimeout:()=>Y4(Z),onSuccess:o,duration:J}))),AV0=$(2,(X,{duration:J,onTimeout:Z})=>BY(LF(X,{onTimeout:()=>bB(Z),onSuccess:o,duration:J}))),TV0=$(2,(X,J)=>LF(X,{duration:J,onSuccess:I,onTimeout:S})),LF=$(2,(X,{duration:J,onSuccess:Z,onTimeout:Q})=>KY((Y)=>kX((G)=>Xn(G(X),OG(Q3(J)),{onSelfWin:(K,B)=>p(K.await,(H)=>{if(H._tag==="Success")return p(K.inheritAll,()=>l9(HY(B,Y),Z(H.value)));else return p(HY(B,Y),()=>L9(H.cause))}),onOtherWin:(K,B)=>p(K.await,(H)=>{if(H._tag==="Success")return p(K.inheritAll,()=>l9(HY(B,Y),Q()));else return p(HY(B,Y),()=>L9(H.cause))}),otherScope:pB})))),F68="effect/Ref/SynchronizedRef",MV0=Symbol.for(F68),A68={_A:(X)=>X};class PV0 extends fJ{ref;withLock;[MV0]=A68;[VE]=fp;[AG]=AG;constructor(X,J){super();this.ref=X,this.withLock=J,this.get=LJ(this.ref)}get;commit(){return this.get}modify(X){return this.modifyEffect((J)=>o(X(J)))}modifyEffect(X){return this.withLock(z(p(LJ(this.ref),X),p(([J,Z])=>l9(W4(this.ref,Z),J))))}}var SO=(X)=>B0(()=>NS(X)),NS=(X)=>{let J=$O(X),Z=S1(1);return new PV0(J,Z.withPermits(1))},RV0=$(2,(X,J)=>X.modifyEffect((Z)=>{let Q=J(Z);switch(Q._tag){case"None":return o([Z,Z]);case"Some":return N0(Q.value,(Y)=>[Y,Y])}}));var jV0=$((X)=>b9(X[0]),(X,J,Z)=>p(X,(Q)=>B3(J(Q),Z).pipe(N0((Y)=>Object.assign({},Q,Y)))));var CV0=Symbol.for("effect/ManagedRuntime");var IV0="ExtendScope",EV0="Fold",Tn="Fresh",SV0="FromEffect",xV0="Scoped",vV0="Suspend",kV0="Provide",Mn="ProvideMerge",bV0="MergeAll",yV0="ZipWith";var v1=xE;var xO=B20,Pn=vE,T7=qG;var vO=HY,gV0=bE;var hV0=kE,mV0=EW0,EQ=G5;var dV0=K20;var kO=(X)=>function(){if(arguments.length===1){let J=arguments[0];return(Z,...Q)=>X(J,Z,...Q)}return X.apply(this,arguments)},bO=kO((X,J,Z)=>{let Q=IC(),Y=[[F7,[[Q,X.context]]]];if(Z?.scheduler)Y.push([MG,[[Q,Z.scheduler]]]);let G=U30(X.fiberRefs,{entries:Y,forkAs:Q});if(Z?.updateRefs)G=Z.updateRefs(G,Q);let K=new JS(Q,G,X.runtimeFlags),B=J;if(Z?.scope)B=p(DF(Z.scope,VY),(W)=>i8(XO(W,KY((V)=>_0(V,K.id())?N8:HY(K,V))),TQ(J,(V)=>I1(W,V))));let H=K.currentSupervisor;if(H!==p$)H.onStart(X.context,B,S(),K),K.addObserver((W)=>H.onEnd(W,K));if(pB.add(X.runtimeFlags,K),Z?.immediate===!1)K.resume(B);else K.start(B);return K}),OS=kO((X,J,Z={})=>{let Q=bO(X,J,Z);if(Z.onExit)Q.addObserver((Y)=>{Z.onExit(Y)});return(Y,G)=>OS(X)(z(Q,vO(Y??d7)),{...G,onExit:G?.onExit?(K)=>G.onExit(Nl(K)):void 0})}),uV0=kO((X,J)=>{let Z=Cn(X)(J);if(Z._tag==="Failure")throw jn(Z.effect_instruction_i0);return Z.effect_instruction_i0});class cV0 extends Error{fiber;_tag="AsyncFiberException";constructor(X){super(`Fiber #${X.id().id} cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work`);this.fiber=X,this.name=this._tag,this.stack=this.message}}var P68=(X)=>{let J=Error.stackTraceLimit;Error.stackTraceLimit=0;let Z=new cV0(X);return Error.stackTraceLimit=J,Z};var Rn=Symbol.for("effect/Runtime/FiberFailure"),AF=Symbol.for("effect/Runtime/FiberFailure/Cause");class fV0 extends Error{[Rn];[AF];constructor(X){let J=_$(X)[0];super(J?.message||"An error has occurred");if(this[Rn]=Rn,this[AF]=X,this.name=J?`(FiberFailure) ${J.name}`:"FiberFailure",J?.stack)this.stack=J.stack}toJSON(){return{_id:"FiberFailure",cause:this[AF].toJSON()}}toString(){return"(FiberFailure) "+sY(this[AF],{renderErrorCause:!0})}[$8](){return this.toString()}}var jn=(X)=>{let J=Error.stackTraceLimit;Error.stackTraceLimit=0;let Z=new fV0(X);return Error.stackTraceLimit=J,Z};var pV0=(X)=>{let J=X;switch(J._op){case"Failure":case"Success":return J;case"Left":return wG(J.left);case"Right":return M9(J.right);case"Some":return M9(J.value);case"None":return wG(new wZ)}},Cn=kO((X,J)=>{let Z=pV0(J);if(Z)return Z;let Q=new m$,Y=bO(X)(J,{scheduler:Q});Q.flush();let G=Y.unsafePoll();if(G)return G;return DI(QI(P68(Y),AI(Y)))}),lV0=kO((X,J,Z)=>_S(X,J,Z).then((Q)=>{switch(Q._tag){case wX:return Q.effect_instruction_i0;case DX:throw jn(Q.effect_instruction_i0)}})),_S=kO((X,J,Z)=>new Promise((Q)=>{let Y=pV0(J);if(Y)Q(Y);let G=bO(X)(J);if(G.addObserver((K)=>{Q(K)}),Z?.signal!==void 0)if(Z.signal.aborted)G.unsafeInterruptAsFork(G.id());else Z.signal.addEventListener("abort",()=>{G.unsafeInterruptAsFork(G.id())},{once:!0})}));class In{context;runtimeFlags;fiberRefs;constructor(X,J,Z){this.context=X,this.runtimeFlags=J,this.fiberRefs=Z}pipe(){return K0(this,arguments)}}var qS=(X)=>new In(X.context,X.runtimeFlags,X.fiberRefs),yO=()=>M8((X,J)=>o(new In(X.getFiberRef(F7),J.runtimeFlags,X.getFiberRefs()))),nV0=fC(rY,uC,dC),CG=qS({context:jX(),runtimeFlags:nV0,fiberRefs:z30()});var iV0=$(2,(X,J)=>qS({context:J(X.context),runtimeFlags:X.runtimeFlags,fiberRefs:X.fiberRefs}));var oV0=OS(CG),rV0=bO(CG),aV0=lV0(CG),sV0=_S(CG),tV0=uV0(CG),eV0=Cn(CG),X$0=(X)=>I0(()=>{let J=void 0;return p(f7(),(Z)=>p(yO(),(Q)=>kX((Y)=>i8(rB(Y(K6(X((G)=>OS(Q)(lK(G,Z))),{onFailure:(G)=>QO(Z,G),onSuccess:(G)=>{return J=G,N8}}))),Y(sZ(IX(Z),()=>J??N8))))))});var Sn=$(2,(X,J)=>X.modifyEffect(J));var J$0=$(2,(X,J)=>X.modifyEffect((Z)=>N0(J(Z),(Q)=>[void 0,Q])));var R68="effect/Layer",wS=Symbol.for(R68),j68={_RIn:(X)=>X,_E:(X)=>X,_ROut:(X)=>X},_4={[wS]:j68,pipe(){return K0(this,arguments)}},C68="effect/Layer/MemoMap",TF=Symbol.for(C68),xn=ZJ()("effect/Layer/CurrentMemoMap",{defaultValue:()=>I68()}),MF=(X)=>V0(X,wS),vn=(X)=>{return X._op_layer===Tn};class kn{ref;[TF];constructor(X){this.ref=X,this[TF]=TF}getOrElseMemoize(X,J){return z(Sn(this.ref,(Z)=>{let Q=Z.get(X);if(Q!==void 0){let[Y,G]=Q,K=z(Y,p(([B,H])=>z(u$(B),l9(H))),TQ(E$({onFailure:()=>N8,onSuccess:()=>_1(J,G)})));return o([K,Z])}return z(h$(0),p((Y)=>z(f7(),p((G)=>z(h$(()=>N8),N0((K)=>{let B=kX((W)=>z(H5(),p((V)=>z(W(p(B$0(X,V,!0),(U)=>OO(U(this)))),B6,p((U)=>{switch(U._tag){case DX:return z(QO(G,U.effect_instruction_i0),i8(RQ(V,U)),i8(W9(U.effect_instruction_i0)));case wX:return z(W4(K,(O)=>z(RQ(V,O),_G($E(Y,(q)=>[q===1,q-1])),AX)),i8(L1(Y,(O)=>O+1)),i8(_1(J,(O)=>z(B0(()=>Z.delete(X)),i8(LJ(K)),p((q)=>q(O))))),i8(gB(G,U.effect_instruction_i0)),l9(U.effect_instruction_i0[1]))}}))))),H=[z(IX(G),TQ(S$({onFailure:()=>N8,onSuccess:()=>L1(Y,(W)=>W+1)}))),(W)=>z(LJ(K),p((V)=>V(W)))];return[B,vn(X)?Z:Z.set(X,H)]}))))))}),BY)}}var bn=I0(()=>N0(SO(new Map),(X)=>new kn(X))),I68=()=>new kn(NS(new Map)),K$0=(X)=>z4((J)=>b1(X,J)),b1=$(2,(X,J)=>p(bn,(Z)=>LS(X,Z,J))),LS=$(3,(X,J,Z)=>p(B$0(X,Z),(Q)=>F1(Q(J),xn,J))),B$0=(X,J,Z=!1)=>{let Q=X;switch(Q._op_layer){case"Locally":return B0(()=>(Y)=>Q.f(Y.getOrElseMemoize(Q.self,J)));case"ExtendScope":return B0(()=>(Y)=>z4((G)=>Y.getOrElseMemoize(Q.layer,G)));case"Fold":return B0(()=>(Y)=>z(Y.getOrElseMemoize(Q.layer,J),K6({onFailure:(G)=>Y.getOrElseMemoize(Q.failureK(G),J),onSuccess:(G)=>Y.getOrElseMemoize(Q.successK(G),J)})));case"Fresh":return B0(()=>(Y)=>z(Q.layer,b1(J)));case"FromEffect":return Z?B0(()=>(Y)=>Q.effect):B0(()=>(Y)=>Y.getOrElseMemoize(X,J));case"Provide":return B0(()=>(Y)=>z(Y.getOrElseMemoize(Q.first,J),p((G)=>z(Y.getOrElseMemoize(Q.second,J),X5(G)))));case"Scoped":return Z?B0(()=>(Y)=>H3(Q.effect,J)):B0(()=>(Y)=>Y.getOrElseMemoize(X,J));case"Suspend":return B0(()=>(Y)=>Y.getOrElseMemoize(Q.evaluate(),J));case"ProvideMerge":return B0(()=>(Y)=>z(Y.getOrElseMemoize(Q.first,J),iK(Y.getOrElseMemoize(Q.second,J),Q.zipK)));case"ZipWith":return WI(function*(){let Y=yield*eY(J,IL),G=yield*eY(Y,VY),K=yield*eY(Y,VY);return(B)=>z(B.getOrElseMemoize(Q.first,G),aB(B.getOrElseMemoize(Q.second,K),Q.zipK,{concurrent:!0}))});case"MergeAll":{let Y=Q.layers;return N0(eY(J,IL),(G)=>(K)=>{let B=Array(Y.length);return N0(UY(Y,yB(function*(H,W){let V=yield*eY(G,VY),U=yield*K.getOrElseMemoize(H,V);B[W]=U}),!1,!1),()=>nc(...B))})}}},s$=$(2,(X,J)=>jS(X,{onFailure:J,onSuccess:sB})),yn=$(2,(X,J)=>RS(X,{onFailure:J,onSuccess:sB})),gn=(X)=>PF(oJ(X)),H$0=(X)=>AS(()=>oJ(X())),W$0=(X)=>PS(X,()=>jX()),FS=()=>ZQ(WY()),V$0=(X)=>{let J=Object.create(_4);return J._op_layer=IV0,J.layer=X,J},hn=(X)=>PF(N4(X)),mn=(X)=>AS(()=>N4(X())),PF=(X)=>ZQ(W9(X)),AS=(X)=>ZQ(bB(X)),W5=$(2,(X,J)=>jS(X,{onFailure:hn,onSuccess:J})),$$0=$(2,(X,J)=>W5(X,z9(J))),dn=(X)=>{let J=Object.create(_4);return J._op_layer=Tn,J.layer=X,J},y1=$(2,(X,J)=>{let Z=jN(X),Q=Z?X:J;return ZQ(N0(Z?J:X,(G)=>OZ(Q,G)))}),U$0=(X)=>ZQ(N0(X,()=>jX()));function ZQ(X){let J=Object.create(_4);return J._op_layer=SV0,J.effect=X,J}var z$0=$(3,(X,J,Z)=>TS(X,iX(J,Z))),TS=$(2,(X,J)=>{let Z=Object.create(_4);return Z._op_layer="Locally",Z.self=X,Z.f=J,Z}),MS=$(3,(X,J,Z)=>TS(X,GJ(J,Z))),N$0=(X,J)=>q4(TZ(X,J)),O$0=(X,J)=>q4(KJ(X,J)),_$0=(X,J,Z)=>ZQ(N0(X,(Q)=>OZ(J,Z(Q)))),q$0=(X)=>ZS(i8(z4((J)=>z(X,b1(J))),z1)),D$0=function(){if(arguments.length===1)return(X)=>Q$0(arguments[0],X);return Q$0(arguments[0],arguments[1])},Q$0=(X,J)=>hO(X,new Proxy({...J},{get(Z,Q,Y){if(Q in Z)return Z[Q];let G=Error.stackTraceLimit;Error.stackTraceLimit=2;let K=Error(`${X.key}: Unimplemented method "${Q.toString()}"`);return Error.stackTraceLimit=G,K.name="UnimplementedError",E68(K)},has:G6})),E68=(X)=>{let J=aZ(X);function Z(){return J}return Object.assign(Z,J),Object.setPrototypeOf(Z,Object.getPrototypeOf(J)),Z},PS=$(2,(X,J)=>W5(X,(Z)=>sB(J(Z)))),w$0=$(2,(X,J)=>s$(X,(Z)=>mn(()=>J(Z)))),RS=$(2,(X,{onFailure:J,onSuccess:Z})=>{let Q=Object.create(_4);return Q._op_layer=EV0,Q.layer=X,Q.failureK=J,Q.successK=Z,Q}),jS=$(2,(X,{onFailure:J,onSuccess:Z})=>RS(X,{onFailure:(Q)=>{let Y=jG(Q);switch(Y._tag){case"Left":return J(Y.left);case"Right":return PF(Y.right)}},onSuccess:Z})),L$0=(X)=>z4((J)=>N0(AE(b1(X,J)),ZQ)),un=$(2,(X,J)=>cn(X,J,(Z,Q)=>CX(Z,Q))),CS=(...X)=>{let J=Object.create(_4);return J._op_layer=bV0,J.layers=X,J},F$0=(X)=>s$(X,(J)=>gn(J)),A$0=$(2,(X,J)=>s$(X,J)),T$0=(X)=>un(FS(),X),M$0=$(4,(X,J,Z,Q)=>PS(X,(Y)=>OZ(Z,Q(x6(Y,J))))),P$0=$(2,(X,J)=>jF(()=>{let Z=g8("effect/Layer/retry/{ state: unknown }");return z(hO(Z,{state:J.initial}),W5((Q)=>R$0(X,J,Z,z(Q,z9(Z)).state)))})),R$0=(X,J,Z,Q)=>{return z(X,s$((Y)=>z(S68(J,Z,Y,Q),W5((G)=>dn(R$0(X,J,Z,z(G,z9(Z)).state))))))},S68=(X,J,Z,Q)=>{return y1(J,z($Y,p((Y)=>z(X.step(Y,Z,Q),p(([G,K,B])=>C1(B)?p8(Z):z(Z3(v6(IO(B.intervals)-Y)),l9({state:G})))))))},g1=$(2,(X,J)=>{let Z=jN(X),Q=Z?X:J;return RF(N0(Z?J:X,(G)=>OZ(Q,G)))}),q4=(X)=>RF(z(X,l9(jX()))),RF=(X)=>{let J=Object.create(_4);return J._op_layer=xV0,J.effect=X,J},j$0=RF(N0(K3(H5(),(X,J)=>X.close(J)),(X)=>OZ(O4,X))),C$0=(X)=>y1(X,X),hO=$(2,(X,J)=>{let Z=jN(X);return ZQ(o(OZ(Z?X:J,Z?J:X)))}),sB=(X)=>{return ZQ(o(X))},I$0=sB(jX()),jF=(X)=>{let J=Object.create(_4);return J._op_layer=vV0,J.evaluate=X,J},IS=$(2,(X,J)=>{let Z=jN(X),Q=Z?X:J,Y=Z?J:X;return ZQ(B0(()=>OZ(Q,Y())))}),E$0=(X)=>{return ZQ(B0(X))},S$0=$(2,(X,J)=>W5(X,(Z)=>ZQ(l9(J(Z),Z)))),x$0=$(2,(X,J)=>s$(X,(Z)=>ZQ(p(J(Z),()=>p8(Z))))),v$0=$(2,(X,J)=>yn(X,(Z)=>ZQ(p(J(Z),()=>W9(Z))))),k$0=(X)=>z(z4((J)=>b1(X,J)),p((J)=>z(yO(),X5(J)))),b$0=$(2,(X,J)=>p(z4((Z)=>LS(X,J,Z)),(Z)=>z(yO(),X5(Z)))),t$=$(2,(X,J)=>jF(()=>{let Z=Object.create(_4);return Z._op_layer=kV0,Z.first=Object.create(_4,{_op_layer:{value:Mn,enumerable:!0},first:{value:FS(),enumerable:!0},second:{value:Array.isArray(J)?CS(...J):J},zipK:{value:(Q,Y)=>z(Q,CX(Y))}}),Z.second=X,Z})),y$0=$(2,(X,J)=>{let Z=Object.create(_4);return Z._op_layer=Mn,Z.first=J,Z.second=t$(X,J),Z.zipK=(Q,Y)=>{return z(Q,CX(Y))},Z}),cn=$(3,(X,J,Z)=>jF(()=>{let Q=Object.create(_4);return Q._op_layer=yV0,Q.first=X,Q.second=J,Q.zipK=Z,Q})),ES=(X)=>{let J=g8("effect/Layer/unwrapEffect/Layer.Layer<R1, E1, A>");return W5(y1(J,X),(Z)=>z9(Z,J))},gO=(X)=>{let J=g8("effect/Layer/unwrapScoped/Layer.Layer<R1, E1, A>");return W5(g1(J,X),(Z)=>z9(Z,J))},g$0=$((X)=>MF(X[0]),function(){let X=arguments;return MS(X[0],oK,typeof X[1]==="string"?w7(X[1],X[2]):(J)=>Object.entries(X[1]).reduce((Z,[Q,Y])=>w7(Z,Q,Y),J))}),h$0=$((X)=>MF(X[0]),function(){let X=arguments;return MS(X[0],T$,typeof X[1]==="string"?w7(X[1],X[2]):(J)=>Object.entries(X[1]).reduce((Z,[Q,Y])=>w7(Z,Q,Y),J))}),m$0=function(){let X=typeof arguments[0]!=="string",J=X?arguments[1]:arguments[0],Z=FZ(X?arguments[2]:arguments[1]);if(X){let Q=arguments[0];return gO(N0(Z?.onEnd?i6(U4(J,Z),(Y)=>RG((G)=>Z.onEnd(Y,G))):U4(J,Z),(Y)=>DS(Q,Y)))}return(Q)=>gO(N0(Z?.onEnd?i6(U4(J,Z),(Y)=>RG((G)=>Z.onEnd(Y,G))):U4(J,Z),(Y)=>DS(Q,Y)))},DS=$(2,(X,J)=>t$(X,sB(OZ(A7,J)))),Y$0=$(2,(X,J)=>VF((Z)=>p(b1(J,Z),(Q)=>FI(X,Q)))),G$0=$(2,(X,J)=>{let Z=y$(CG.fiberRefs,J.fiberRefs),Q=aY(CG.runtimeFlags,J.runtimeFlags);return kX((Y)=>M8((G)=>{let K=G.getFiberRef(F7),B=G.getFiberRefs(),H=g$(G.id(),B)(Z),W=G.currentRuntimeFlags,V=dK(Q)(W),U=y$(H,B),O=aY(V,W);return G.setFiberRefs(H),G.currentRuntimeFlags=V,MZ(FI(Y(X),CX(K,J.context)),M8((q)=>{return q.setFiberRefs(g$(q.id(),q.getFiberRefs())(U)),q.currentRuntimeFlags=dK(O)(q.currentRuntimeFlags),N8}))}))}),SS=$(2,(X,J)=>{if(Array.isArray(J))return Y$0(X,CS(...J));else if(MF(J))return Y$0(X,J);else if(Fw(J))return FI(X,J);else if(CV0 in J)return p(J.runtimeEffect,(Z)=>G$0(X,Z));else return G$0(X,J)});var d$0=N0(PQ(TX),z9(LZ)),M7=(X)=>DJ(TX,(J)=>X(z9(J,LZ))),xS=$(2,(X,J)=>GJ(X,TX,X9(LZ,J))),u$0=(X)=>KJ(TX,X9(LZ,X)),c$0=(X)=>q4(KJ(TX,X9(LZ,X))),f$0=(X,...J)=>M7((Z)=>Z.assert(X,...J)),p$0=M7((X)=>X.clear),l$0=(X)=>M7((J)=>J.count(X)),n$0=(X)=>M7((J)=>J.countReset(X)),i$0=(...X)=>M7((J)=>J.debug(...X)),o$0=(X,J)=>M7((Z)=>Z.dir(X,J)),r$0=(...X)=>M7((J)=>J.dirxml(...X)),a$0=(...X)=>M7((J)=>J.error(...X)),s$0=(X)=>M7((J)=>K3(J.group(X),()=>J.groupEnd)),t$0=(...X)=>M7((J)=>J.info(...X)),e$0=(...X)=>M7((J)=>J.log(...X)),XU0=(X,J)=>M7((Z)=>Z.table(X,J)),JU0=(X)=>M7((J)=>K3(J.time(X),()=>J.timeEnd(X))),ZU0=(X,...J)=>M7((Z)=>Z.timeLog(X,...J)),QU0=(...X)=>M7((J)=>J.trace(...X)),YU0=(...X)=>M7((J)=>J.warn(...X)),GU0=$((X)=>b9(X[0]),(X,J)=>M7((Z)=>oN(Z.group(J),()=>X,()=>Z.groupEnd))),KU0=$((X)=>b9(X[0]),(X,J)=>M7((Z)=>oN(Z.time(J),()=>X,()=>Z.timeEnd(J))));var x68=yI,v68=LZ,k68=xS,b68=c$0,y68=M7,g68=f$0,h68=p$0,m68=l$0,d68=n$0,u68=i$0,c68=o$0,f68=r$0,fn=a$0,p68=s$0,l68=t$0,q6=e$0,n68=XU0,i68=JU0,o68=ZU0,r68=QU0,a68=YU0,s68=GU0,t68=KU0;var N={};y8(N,{zipWith:()=>tJ,zipRight:()=>C0,zipLeft:()=>jZ,zip:()=>j7,yieldNow:()=>UZ8,withUnhandledErrorLogLevel:()=>GA,withTracerTiming:()=>iY8,withTracerScoped:()=>lY8,withTracerEnabled:()=>nY8,withTracer:()=>pY8,withSpanScoped:()=>Q58,withSpan:()=>_x,withSchedulingPriority:()=>QQ8,withScheduler:()=>ZQ8,withRuntimeFlagsPatchScoped:()=>FY8,withRuntimeFlagsPatch:()=>LY8,withRequestCaching:()=>dY8,withRequestCache:()=>uY8,withRequestBatching:()=>mY8,withRandomScoped:()=>qY8,withRandomFixed:()=>_Y8,withRandom:()=>zN0,withParentSpan:()=>_U,withMetric:()=>jY8,withMaxOpsBeforeYield:()=>YQ8,withLogSpan:()=>UN0,withFiberRuntime:()=>AJ,withExecutionPlan:()=>wZ8,withEarlyRelease:()=>dZ8,withConsoleScoped:()=>VQ8,withConsole:()=>$Q8,withConfigProviderScoped:()=>wQ8,withConfigProvider:()=>DQ8,withConcurrency:()=>JQ8,withClockScoped:()=>KQ8,withClock:()=>BQ8,whileLoop:()=>ZH,whenRef:()=>hQ8,whenLogLevel:()=>$Y8,whenFiberRef:()=>gQ8,whenEffect:()=>yQ8,when:()=>A4,void:()=>U0,validateWith:()=>xY8,validateFirst:()=>BZ8,validateAll:()=>KZ8,validate:()=>SY8,using:()=>mZ8,useSpan:()=>eO,updateService:()=>VN0,updateFiberRefs:()=>QY8,unsandbox:()=>AZ8,unsafeMakeSemaphore:()=>OU,unsafeMakeLatch:()=>kG,unlessEffect:()=>Nx,unless:()=>bQ8,uninterruptibleMask:()=>U5,uninterruptible:()=>xG,tryPromise:()=>TJ,tryMapPromise:()=>FZ8,tryMap:()=>JH,try:()=>HJ,transposeOption:()=>K58,transposeMapOption:()=>B58,transplant:()=>XQ8,tracerWith:()=>fY8,tracer:()=>cY8,timeoutTo:()=>_Q8,timeoutOption:()=>OQ8,timeoutFailCause:()=>yi,timeoutFail:()=>bi,timeout:()=>XA,timedWith:()=>NQ8,timed:()=>zQ8,tapErrorTag:()=>pQ8,tapErrorCause:()=>N5,tapError:()=>QA,tapDefect:()=>fQ8,tapBoth:()=>cQ8,tap:()=>J9,takeWhile:()=>HN0,takeUntil:()=>oJ8,tagMetricsScoped:()=>MY8,tagMetrics:()=>AY8,sync:()=>L0,suspend:()=>o0,supervised:()=>eZ8,summarized:()=>uQ8,succeedSome:()=>$Z8,succeedNone:()=>f1,succeed:()=>y,step:()=>yY8,spanLinks:()=>eY8,spanAnnotations:()=>tY8,sleep:()=>UQ8,setFiberRefs:()=>ZY8,serviceOptional:()=>MQ8,serviceOption:()=>JA,serviceMembers:()=>TQ8,serviceFunctions:()=>hi,serviceFunctionEffect:()=>FQ8,serviceFunction:()=>LQ8,serviceConstants:()=>AQ8,sequentialFinalizers:()=>gZ8,scopedWith:()=>eF,scoped:()=>l7,scopeWith:()=>tF,scope:()=>N3,scheduleFrom:()=>aQ8,scheduleForked:()=>rQ8,schedule:()=>oQ8,sandbox:()=>Si,runtime:()=>xQ,runSyncExit:()=>EY8,runSync:()=>j9,runRequestBlock:()=>bY8,runPromiseExit:()=>IY8,runPromise:()=>YH,runFork:()=>NY,runCallback:()=>CY8,retryOrElse:()=>LZ8,retry:()=>z3,request:()=>gY8,replicateEffect:()=>GZ8,replicate:()=>YZ8,repeatOrElse:()=>iQ8,repeatN:()=>YA,repeat:()=>sO,reduceWhile:()=>JZ8,reduceRight:()=>ZZ8,reduceEffect:()=>QZ8,reduce:()=>oF,randomWith:()=>OY8,random:()=>NY8,raceWith:()=>n1,raceFirst:()=>Ox,raceAll:()=>dQ8,race:()=>ZA,provideServiceEffect:()=>z5,provideService:()=>PJ,provide:()=>o6,promise:()=>KU,patchRuntimeFlags:()=>wY8,patchFiberRefs:()=>JY8,partition:()=>XZ8,parallelFinalizers:()=>yZ8,parallelErrors:()=>DZ8,orElseSucceed:()=>ni,orElseFail:()=>NU,orElse:()=>O3,orDieWith:()=>UY8,orDie:()=>R9,optionFromOptional:()=>G58,option:()=>EQ8,once:()=>lJ8,onInterrupt:()=>rF,onExit:()=>sF,onError:()=>WU,none:()=>VZ8,never:()=>c1,negate:()=>xi,metricLabels:()=>RY8,mergeAll:()=>eJ8,merge:()=>kZ8,matchEffect:()=>q9,matchCauseEffect:()=>a6,matchCause:()=>QH,match:()=>R7,mapInputContext:()=>rO,mapErrorCause:()=>vZ8,mapError:()=>E9,mapBoth:()=>vG,mapAccum:()=>xZ8,map:()=>u,makeSpanScoped:()=>ri,makeSpan:()=>oi,makeSemaphore:()=>tO,makeLatch:()=>NN0,loop:()=>nQ8,logWithLevel:()=>KY8,logWarning:()=>pi,logTrace:()=>BY8,logInfo:()=>HY8,logFatal:()=>li,logError:()=>UU,logDebug:()=>fi,logAnnotations:()=>VY8,log:()=>ci,locallyWith:()=>$N0,locallyScopedWith:()=>XY8,locallyScoped:()=>eQ8,locally:()=>O5,linkSpans:()=>X58,linkSpanCurrent:()=>J58,liftPredicate:()=>CZ8,let:()=>IQ8,labelMetricsScoped:()=>PY8,labelMetrics:()=>TY8,iterate:()=>lQ8,isSuccess:()=>GY8,isFailure:()=>YY8,isEffect:()=>VX,intoDeferred:()=>$U,interruptibleMask:()=>jZ8,interruptible:()=>QX,interruptWith:()=>RZ8,interrupt:()=>aJ,inheritFiberRefs:()=>tQ8,ignoreLogged:()=>qZ8,ignore:()=>HU,if:()=>SQ8,head:()=>tJ8,getRuntimeFlags:()=>DY8,getFiberRefs:()=>sQ8,gen:()=>f0,functionWithSpan:()=>Z58,fromNullable:()=>Y58,fromFiberEffect:()=>tZ8,fromFiber:()=>sZ8,forkWithErrorHandler:()=>aZ8,forkScoped:()=>MJ,forkIn:()=>$X,forkDaemon:()=>F4,forkAll:()=>rZ8,fork:()=>vi,forever:()=>aO,forEach:()=>a9,fnUntraced:()=>hX,fn:()=>ai,flipWith:()=>SZ8,flip:()=>EZ8,flatten:()=>sJ,flatMap:()=>h,firstSuccessOf:()=>zY8,findFirst:()=>Ci,finalizersMask:()=>hZ8,filterOrFail:()=>ui,filterOrElse:()=>di,filterOrDieMessage:()=>mi,filterOrDie:()=>xQ8,filterMap:()=>sJ8,filterEffectOrFail:()=>kQ8,filterEffectOrElse:()=>vQ8,filter:()=>Vx,fiberIdWith:()=>oO,fiberId:()=>oZ8,failSync:()=>nO,failCauseSync:()=>Ii,failCause:()=>MX,fail:()=>Y0,exit:()=>r6,exists:()=>aJ8,every:()=>rJ8,eventually:()=>_Z8,ensuringChildren:()=>iZ8,ensuringChild:()=>nZ8,ensuring:()=>RZ,ensureSuccessType:()=>V58,ensureRequirementsType:()=>U58,ensureErrorType:()=>$58,either:()=>l1,dropWhile:()=>Wx,dropUntil:()=>Hx,disconnect:()=>PZ8,diffFiberRefs:()=>lZ8,dieSync:()=>Ei,dieMessage:()=>SG,die:()=>P7,descriptorWith:()=>pZ8,descriptor:()=>fZ8,delay:()=>WN0,daemonChildren:()=>cZ8,custom:()=>WZ8,currentSpan:()=>rY8,currentPropagatedSpan:()=>aY8,currentParentSpan:()=>sY8,contextWithEffect:()=>gi,contextWith:()=>VU,context:()=>EX,consoleWith:()=>WQ8,console:()=>HQ8,configProviderWith:()=>qQ8,clockWith:()=>GQ8,clock:()=>ki,checkInterruptible:()=>MZ8,cause:()=>OZ8,catchTags:()=>iO,catchTag:()=>QQ,catchSomeDefect:()=>NZ8,catchSomeCause:()=>BU,catchSome:()=>U3,catchIf:()=>Ux,catchAllDefect:()=>$x,catchAllCause:()=>s9,catchAll:()=>y6,catch:()=>zZ8,cachedWithTTL:()=>cJ8,cachedInvalidateWithTTL:()=>fJ8,cachedFunction:()=>pJ8,cached:()=>EG,cacheRequestResult:()=>hY8,blocked:()=>kY8,bindTo:()=>CQ8,bindAll:()=>jQ8,bind:()=>RQ8,awaitAllChildren:()=>uZ8,asyncEffect:()=>HZ8,async:()=>b6,asVoid:()=>p7,asSomeError:()=>IZ8,asSome:()=>zx,as:()=>y9,ap:()=>vY8,annotateSpans:()=>oY8,annotateLogsScoped:()=>WY8,annotateLogs:()=>zU,annotateCurrentSpan:()=>ii,andThen:()=>mQ8,allowInterrupt:()=>TZ8,allWith:()=>nJ8,allSuccesses:()=>iJ8,all:()=>SQ,addFinalizer:()=>aF,acquireUseRelease:()=>p1,acquireReleaseInterruptible:()=>bZ8,acquireRelease:()=>A9,Tag:()=>H58,Service:()=>W58,EffectTypeId:()=>Bx,Do:()=>PQ8});var V3={};y8(V3,{unsafeStruct:()=>e68,unsafeArray:()=>ln,tuple:()=>X78,taggedEnum:()=>SF,tagged:()=>h1,struct:()=>IF,case:()=>J78,array:()=>pn,TaggedError:()=>xF,TaggedClass:()=>Z78,Structural:()=>Q78,Error:()=>mO,Class:()=>EF});var IF=hN,e68=(X)=>Object.setPrototypeOf(X,AK),X78=(...X)=>ln(X),pn=(X)=>ln(X.slice(0)),ln=(X)=>Object.setPrototypeOf(X,T40),J78=()=>(X)=>X===void 0?Object.create(AK):IF(X);var h1=(X)=>(J)=>{let Z=J===void 0?Object.create(AK):IF(J);return Z._tag=X,Z},EF=CB,Z78=(X)=>{class J extends EF{_tag=X}return J},Q78=CB,SF=()=>new Proxy({},{get(X,J,Z){if(J==="$is")return p5;else if(J==="$match")return Y78;return h1(J)}});function Y78(){if(arguments.length===1){let Z=arguments[0];return function(Q){return Z[Q._tag](Q)}}let X=arguments[0];return arguments[1][X._tag](X)}var mO=function(){let X=Symbol.for("effect/Data/Error/plainArgs");return{BaseEffectError:class extends JO{constructor(Z){super(Z?.message,Z?.cause?{cause:Z.cause}:void 0);if(Z)Object.assign(this,Z),Object.defineProperty(this,X,{value:Z,enumerable:!1})}toJSON(){return{...this[X],...this}}}}.BaseEffectError}(),xF=(X)=>{let J={BaseEffectError:class extends mO{_tag=X}};return J.BaseEffectError.prototype.name=X,J.BaseEffectError};var bF=Symbol.for("effect/DateTime"),yF=Symbol.for("effect/DateTime/TimeZone"),WU0={[bF]:bF,pipe(){return K0(this,arguments)},[$8](){return this.toString()},toJSON(){return m1(this).toJSON()}},G78={...WU0,_tag:"Utc",[y0](){return W8(this,BB(this.epochMillis))},[b0](X){return XU(X)&&X._tag==="Utc"&&this.epochMillis===X.epochMillis},toString(){return`DateTime.Utc(${m1(this).toJSON()})`}},K78={...WU0,_tag:"Zoned",[y0](){return z(BB(this.epochMillis),A0(Z0(this.zone)),W8(this))},[b0](X){return XU(X)&&X._tag==="Zoned"&&this.epochMillis===X.epochMillis&&_0(this.zone,X.zone)},toString(){return`DateTime.Zoned(${Gi(this)})`}},VU0={[yF]:yF,[$8](){return this.toString()}},B78={...VU0,_tag:"Named",[y0](){return W8(this,R8(`Named:${this.id}`))},[b0](X){return JU(X)&&X._tag==="Named"&&this.id===X.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},H78={...VU0,_tag:"Offset",[y0](){return W8(this,R8(`Offset:${this.offset}`))},[b0](X){return JU(X)&&X._tag==="Offset"&&this.offset===X.offset},toString(){return`TimeZone.Offset(${pS(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},D4=(X,J,Z)=>{let Q=Object.create(K78);return Q.epochMillis=X,Q.zone=J,Object.defineProperty(Q,"partsUtc",{value:Z,enumerable:!1,writable:!0}),Object.defineProperty(Q,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(Q,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),Q},XU=(X)=>V0(X,bF),IG=(X)=>XU(X[0]),JU=(X)=>V0(X,yF),$U0=(X)=>JU(X)&&X._tag==="Offset",UU0=(X)=>JU(X)&&X._tag==="Named",zU0=(X)=>X._tag==="Utc",nn=(X)=>X._tag==="Zoned",NU0=I6((X,J)=>X.epochMillis===J.epochMillis),$3=fZ((X,J)=>X.epochMillis<J.epochMillis?-1:X.epochMillis>J.epochMillis?1:0),OU0=RK($3),ZU=(X)=>{let J=Object.create(G78);return J.epochMillis=X,Object.defineProperty(J,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),J},dO=(X)=>{let J=X.getTime();if(Number.isNaN(J))throw new j1("Invalid date");return ZU(J)},yS=(X)=>{if(XU(X))return X;else if(X instanceof Date)return dO(X);else if(typeof X==="object"){let J=new Date(0);return en(J,X),dO(J)}else if(typeof X==="string"&&!W78(X))return dO(new Date(X+"Z"));return dO(new Date(X))},W78=(X)=>/Z|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(X),V78=-8639999956800000,$78=8639999949600000,on=(X,J)=>{if(J?.timeZone===void 0&&XU(X)&&nn(X))return X;let Z=yS(X);if(Z.epochMillis<V78||Z.epochMillis>$78)throw RangeError(`Epoch millis out of range: ${Z.epochMillis}`);let Q;if(J?.timeZone===void 0){let Y=new Date(Z.epochMillis).getTimezoneOffset()*-60*1000;Q=e$(Y)}else if(JU(J?.timeZone))Q=J.timeZone;else if(typeof J?.timeZone==="number")Q=e$(J.timeZone);else{let Y=an(J.timeZone);if(j8(Y))throw new j1(`Invalid time zone: ${J.timeZone}`);Q=Y.value}if(J?.adjustForTimeZone!==!0)return D4(Z.epochMillis,Q,Z.partsUtc);return Xi(Z.epochMillis,Q,J?.disambiguation??"compatible")},kS=_B(on),_U0=_B(yS),U78=/^(.{17,35})\[(.+)\]$/,qU0=(X)=>{let J=U78.exec(X);if(J===null){let Y=Ji(X);return Y!==null?kS(X,{timeZone:Y}):S()}let[,Z,Q]=J;return kS(Z,{timeZone:Q})},gS=N0($Y,ZU),DU0=N0($Y,(X)=>new Date(X)),hS=()=>ZU(Date.now()),wU0=(X)=>ZU(X.epochMillis),gF=$(IG,(X,J,Z)=>Z?.adjustForTimeZone===!0?Xi(X.epochMillis,J,Z?.disambiguation??"compatible"):D4(X.epochMillis,J,X.partsUtc)),LU0=$(IG,(X,J,Z)=>gF(X,e$(J),Z)),kF=c0("effect/DateTime/validZoneCache",()=>new Map),FU0={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},AU0=(X)=>{let J=X.resolvedOptions().timeZone;if(kF.has(J))return kF.get(J);let Z=Object.create(B78);return Z.id=J,Z.format=X,kF.set(J,Z),Z},hF=(X)=>{if(kF.has(X))return kF.get(X);try{return AU0(new Intl.DateTimeFormat("en-US",{...FU0,timeZone:X}))}catch{throw new j1(`Invalid time zone: ${X}`)}},e$=(X)=>{let J=Object.create(H78);return J.offset=X,J},mS=_B(hF),rn=(X)=>mL({try:()=>hF(X),catch:(J)=>J}),TU0=()=>AU0(new Intl.DateTimeFormat("en-US",FU0)),z78=/^(?:GMT|[+-])/,an=(X)=>{if(z78.test(X)){let J=Ji(X);return J===null?S():I(e$(J))}return mS(X)},MU0=(X)=>{if(X._tag==="Offset")return pS(X.offset);return X.id},PU0=$(IG,(X,J,Z)=>r8(mS(J),(Q)=>gF(X,Q,Z))),RU0=$(IG,(X,J,Z)=>gF(X,hF(J),Z)),dS=$(2,(X,J)=>uO(J)-uO(X)),jU0=$(2,(X,J)=>{let Z=dS(X,J);return Z>0?O0(v6(Z)):M0(v6(-Z))}),CU0=$(2,(X,J)=>v6(Math.abs(dS(X,J)))),IU0=MK($3),EU0=PK($3),uS=zB($3),SU0=NB($3),cS=UB($3),xU0=g2($3),vU0=h2($3),kU0=(X)=>N0(gS,cS(X)),bU0=(X)=>cS(hS(),X),yU0=(X)=>N0(gS,uS(X)),gU0=(X)=>uS(hS(),X),m1=(X)=>new Date(X.epochMillis),tB=(X)=>{if(X._tag==="Utc")return new Date(X.epochMillis);else if(X.zone._tag==="Offset")return new Date(X.epochMillis+X.zone.offset);else if(X.adjustedEpochMillis!==void 0)return new Date(X.adjustedEpochMillis);let J=X.zone.format.formatToParts(X.epochMillis).filter((Q)=>Q.type!=="literal"),Z=new Date(0);return Z.setUTCFullYear(Number(J[2].value),Number(J[0].value)-1,Number(J[1].value)),Z.setUTCHours(Number(J[3].value),Number(J[4].value),Number(J[5].value),Number(J[6].value)),X.adjustedEpochMillis=Z.getTime(),Z},fS=(X)=>{return tB(X).getTime()-uO(X)},pS=(X)=>{let J=Math.abs(X),Z=Math.floor(J/3600000),Q=Math.round(J%3600000/60000);if(Q===60)Z+=1,Q=0;return`${X<0?"-":"+"}${String(Z).padStart(2,"0")}:${String(Q).padStart(2,"0")}`},sn=(X)=>pS(fS(X)),uO=(X)=>X.epochMillis,hU0=(X)=>nS(X,(J)=>{return J.setUTCHours(0,0,0,0),ZU(J.getTime())}),mU0=(X)=>({millis:X.getUTCMilliseconds(),seconds:X.getUTCSeconds(),minutes:X.getUTCMinutes(),hours:X.getUTCHours(),day:X.getUTCDate(),weekDay:X.getUTCDay(),month:X.getUTCMonth()+1,year:X.getUTCFullYear()}),tn=(X)=>{if(X._tag==="Utc")return lS(X);else if(X.partsAdjusted!==void 0)return X.partsAdjusted;return X.partsAdjusted=nS(X,mU0),X.partsAdjusted},lS=(X)=>{if(X.partsUtc!==void 0)return X.partsUtc;return X.partsUtc=Qi(X,mU0),X.partsUtc},dU0=$(2,(X,J)=>lS(X)[J]),uU0=$(2,(X,J)=>tn(X)[J]),en=(X,J)=>{if(J.year!==void 0)X.setUTCFullYear(J.year);if(J.month!==void 0)X.setUTCMonth(J.month-1);if(J.day!==void 0)X.setUTCDate(J.day);if(J.weekDay!==void 0){let Z=J.weekDay-X.getUTCDay();X.setUTCDate(X.getUTCDate()+Z)}if(J.hours!==void 0)X.setUTCHours(J.hours);if(J.minutes!==void 0)X.setUTCMinutes(J.minutes);if(J.seconds!==void 0)X.setUTCSeconds(J.seconds);if(J.millis!==void 0)X.setUTCMilliseconds(J.millis)},cU0=$(2,(X,J)=>QU(X,(Z)=>en(Z,J))),fU0=$(2,(X,J)=>Zi(X,(Z)=>en(Z,J))),HU0=86400000,Xi=(X,J,Z)=>{if(J._tag==="Offset")return D4(X-J.offset,J);let Q=vF(X-HU0,X,J),Y=vF(X+HU0,X,J);if(Q===Y)return D4(X-Q,J);let G=Q<Y,K=Q-Y;if(G){if(vF(X-Y,X,J)===Y)return D4(X-Y,J);let W=D4(X-Q,J),V=tB(W).getTime();if(X!==V)switch(Z){case"reject":{let U=new Date(X).toISOString();throw RangeError(`Gap time: ${U} does not exist in time zone ${J.id}`)}case"earlier":return D4(X-Y,J);case"compatible":case"later":return W}return W}if(vF(X-Q,X,J)===Q){if(Z==="earlier"||Z==="compatible")return D4(X-Q,J);if(vF(X-Q+K,X+K,J)===Q)return D4(X-Q,J);if(Z==="reject"){let W=new Date(X).toISOString();throw RangeError(`Ambiguous time: ${W} occurs twice in time zone ${J.id}`)}}return D4(X-Y,J)},N78=/([+-])(\d{2}):(\d{2})$/,Ji=(X)=>{let J=N78.exec(X);if(J===null)return null;let[,Z,Q,Y]=J;return(Z==="+"?1:-1)*(Number(Q)*60+Number(Y))*60*1000},vF=(X,J,Z)=>{let Q=Z.format.formatToParts(X).find((G)=>G.type==="timeZoneName")?.value??"";if(Q==="GMT")return 0;let Y=Ji(Q);if(Y===null)return fS(D4(J,Z));return Y},QU=$(IG,(X,J,Z)=>{if(X._tag==="Utc"){let G=m1(X);return J(G),ZU(G.getTime())}let Q=tB(X),Y=new Date(Q.getTime());return J(Y),Xi(Y.getTime(),X.zone,Z?.disambiguation??"compatible")}),Zi=$(2,(X,J)=>mF(X,(Z)=>{let Q=new Date(Z);return J(Q),Q.getTime()})),mF=$(2,(X,J)=>{let Z=J(uO(X));return X._tag==="Utc"?ZU(Z):D4(Z,X.zone)}),nS=$(2,(X,J)=>J(tB(X))),Qi=$(2,(X,J)=>J(m1(X))),pU0=$(2,(X,J)=>X._tag==="Utc"?J.onUtc(X):J.onZoned(X)),lU0=$(2,(X,J)=>mF(X,(Z)=>Z+K7(J))),nU0=$(2,(X,J)=>mF(X,(Z)=>Z-K7(J))),vS=(X,J)=>{X.setTime(X.getTime()+J)},Yi=$(2,(X,J)=>QU(X,(Z)=>{if(J.millis)vS(Z,J.millis);if(J.seconds)vS(Z,J.seconds*1000);if(J.minutes)vS(Z,J.minutes*60*1000);if(J.hours)vS(Z,J.hours*60*60*1000);if(J.days)Z.setUTCDate(Z.getUTCDate()+J.days);if(J.weeks)Z.setUTCDate(Z.getUTCDate()+J.weeks*7);if(J.months){let Q=Z.getUTCDate();if(Z.setUTCMonth(Z.getUTCMonth()+J.months+1,0),Q<Z.getUTCDate())Z.setUTCDate(Q)}if(J.years){let Q=Z.getUTCDate(),Y=Z.getUTCMonth();if(Z.setUTCFullYear(Z.getUTCFullYear()+J.years,Y+1,0),Q<Z.getUTCDate())Z.setUTCDate(Q)}})),iU0=$(2,(X,J)=>{let Z={};for(let Q in J)Z[Q]=-1*J[Q];return Yi(X,Z)}),oU0=(X,J,Z)=>{switch(J){case"second":{X.setUTCMilliseconds(0);break}case"minute":{X.setUTCSeconds(0,0);break}case"hour":{X.setUTCMinutes(0,0,0);break}case"day":{X.setUTCHours(0,0,0,0);break}case"week":{let Q=Z?.weekStartsOn??0,G=(X.getUTCDay()-Q+7)%7;X.setUTCDate(X.getUTCDate()-G),X.setUTCHours(0,0,0,0);break}case"month":{X.setUTCDate(1),X.setUTCHours(0,0,0,0);break}case"year":{X.setUTCMonth(0,1),X.setUTCHours(0,0,0,0);break}}},rU0=$(IG,(X,J,Z)=>QU(X,(Q)=>oU0(Q,J,Z))),aU0=(X,J,Z)=>{switch(J){case"second":{X.setUTCMilliseconds(999);break}case"minute":{X.setUTCSeconds(59,999);break}case"hour":{X.setUTCMinutes(59,59,999);break}case"day":{X.setUTCHours(23,59,59,999);break}case"week":{let Q=Z?.weekStartsOn??0,G=(X.getUTCDay()-Q+7)%7;X.setUTCDate(X.getUTCDate()-G+6),X.setUTCHours(23,59,59,999);break}case"month":{X.setUTCMonth(X.getUTCMonth()+1,0),X.setUTCHours(23,59,59,999);break}case"year":{X.setUTCMonth(11,31),X.setUTCHours(23,59,59,999);break}}},sU0=$(IG,(X,J,Z)=>QU(X,(Q)=>aU0(Q,J,Z))),tU0=$(IG,(X,J,Z)=>QU(X,(Q)=>{if(J==="milli")return;let Y=Q.getTime(),G=new Date(Y);oU0(G,J,Z);let K=G.getTime(),B=new Date(Y);aU0(B,J,Z);let H=B.getTime()+1,W=Y-K,V=H-Y;if(W<V)Q.setTime(K);else Q.setTime(H)})),O78=(X)=>{if(X._tag==="Named")return X.id;return pS(X.offset)},eU0=$(IG,(X,J)=>{try{return new Intl.DateTimeFormat(J?.locale,{timeZone:X._tag==="Utc"?"UTC":O78(X.zone),...J}).format(X.epochMillis)}catch{return new Intl.DateTimeFormat(J?.locale,{timeZone:"UTC",...J}).format(tB(X))}}),Xz0=$(IG,(X,J)=>new Intl.DateTimeFormat(J?.locale,J).format(X.epochMillis)),Jz0=$(IG,(X,J)=>new Intl.DateTimeFormat(J?.locale,{...J,timeZone:"UTC"}).format(X.epochMillis)),Zz0=$(2,(X,J)=>J.format(X.epochMillis)),Qz0=(X)=>m1(X).toISOString(),Yz0=(X)=>tB(X).toISOString().slice(0,10),Gz0=(X)=>m1(X).toISOString().slice(0,10),bS=(X)=>{let J=tB(X);return X._tag==="Utc"?J.toISOString():`${J.toISOString().slice(0,-1)}${sn(X)}`},Gi=(X)=>X.zone._tag==="Offset"?bS(X):`${bS(X)}[${X.zone.id}]`;var _X={};y8(_X,{uncapitalize:()=>Bi,trimStart:()=>M78,trimEnd:()=>P78,trim:()=>T78,toUpperCase:()=>Kz0,toLowerCase:()=>Bz0,toLocaleUpperCase:()=>a78,toLocaleLowerCase:()=>r78,takeRight:()=>t78,takeLeft:()=>s78,substring:()=>k78,stripMarginWith:()=>$z0,stripMargin:()=>XJ8,startsWith:()=>S78,split:()=>I78,snakeToPascal:()=>ZJ8,snakeToKebab:()=>QJ8,snakeToCamel:()=>JJ8,slice:()=>R78,search:()=>o78,replaceAll:()=>i78,replace:()=>A78,repeat:()=>n78,pascalToSnake:()=>GJ8,padStart:()=>l78,padEnd:()=>p78,normalize:()=>f78,matchAll:()=>c78,match:()=>u78,localeCompare:()=>d78,linesWithSeparators:()=>Vz0,linesIterator:()=>e78,length:()=>C78,lastIndexOf:()=>m78,kebabToSnake:()=>KJ8,isString:()=>q78,isNonEmpty:()=>iS,isEmpty:()=>j78,indexOf:()=>h78,includes:()=>E78,endsWith:()=>x78,empty:()=>L78,concat:()=>F78,codePointAt:()=>g78,charCodeAt:()=>v78,charAt:()=>y78,capitalize:()=>Ki,camelToSnake:()=>YJ8,at:()=>b78,Order:()=>w78,Equivalence:()=>D78});var q78=n9,D78=xQ0,w78=Lj,L78="",F78=$(2,(X,J)=>X+J),Kz0=(X)=>X.toUpperCase(),Bz0=(X)=>X.toLowerCase(),Ki=(X)=>{if(X.length===0)return X;return Kz0(X[0])+X.slice(1)},Bi=(X)=>{if(X.length===0)return X;return Bz0(X[0])+X.slice(1)},A78=(X,J)=>(Z)=>Z.replace(X,J),T78=(X)=>X.trim(),M78=(X)=>X.trimStart(),P78=(X)=>X.trimEnd(),R78=(X,J)=>(Z)=>Z.slice(X,J),j78=(X)=>X.length===0,iS=(X)=>X.length>0,C78=(X)=>X.length,I78=$(2,(X,J)=>{let Z=X.split(J);return qN(Z)?Z:[X]}),E78=(X,J)=>(Z)=>Z.includes(X,J),S78=(X,J)=>(Z)=>Z.startsWith(X,J),x78=(X,J)=>(Z)=>Z.endsWith(X,J),v78=$(2,(X,J)=>gJ(I(X.charCodeAt(J)),(Z)=>!isNaN(Z))),k78=(X,J)=>(Z)=>Z.substring(X,J),b78=$(2,(X,J)=>x8(X.at(J))),y78=$(2,(X,J)=>gJ(I(X.charAt(J)),iS)),g78=$(2,(X,J)=>x8(X.codePointAt(J))),h78=(X)=>(J)=>gJ(I(J.indexOf(X)),TI(0)),m78=(X)=>(J)=>gJ(I(J.lastIndexOf(X)),TI(0)),d78=(X,J,Z)=>(Q)=>qK0(Q.localeCompare(X,J,Z)),u78=(X)=>(J)=>x8(J.match(X)),c78=(X)=>(J)=>J.matchAll(X),f78=(X)=>(J)=>J.normalize(X),p78=(X,J)=>(Z)=>Z.padEnd(X,J),l78=(X,J)=>(Z)=>Z.padStart(X,J),n78=(X)=>(J)=>J.repeat(X),i78=(X,J)=>(Z)=>Z.replaceAll(X,J),o78=$(2,(X,J)=>gJ(I(X.search(J)),TI(0))),r78=(X)=>(J)=>J.toLocaleLowerCase(X),a78=(X)=>(J)=>J.toLocaleUpperCase(X),s78=$(2,(X,J)=>X.slice(0,Math.max(J,0))),t78=$(2,(X,J)=>X.slice(Math.max(0,X.length-Math.floor(J)),1/0)),Hz0=13,Wz0=10,e78=(X)=>Uz0(X,!0),Vz0=(X)=>Uz0(X,!1),$z0=$(2,(X,J)=>{let Z="";for(let Q of Vz0(X)){let Y=0;while(Y<Q.length&&Q.charAt(Y)<=" ")Y=Y+1;let G=Y<Q.length&&Q.charAt(Y)===J?Q.substring(Y+1):Q;Z=Z+G}return Z}),XJ8=(X)=>$z0(X,"|"),JJ8=(X)=>{let J=X[0];for(let Z=1;Z<X.length;Z++)J+=X[Z]==="_"?X[++Z].toUpperCase():X[Z];return J},ZJ8=(X)=>{let J=X[0].toUpperCase();for(let Z=1;Z<X.length;Z++)J+=X[Z]==="_"?X[++Z].toUpperCase():X[Z];return J},QJ8=(X)=>X.replace(/_/g,"-"),YJ8=(X)=>X.replace(/([A-Z])/g,"_$1").toLowerCase(),GJ8=(X)=>(X.slice(0,1)+X.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),KJ8=(X)=>X.replace(/-/g,"_");class Hi{s;stripped;index;length;constructor(X,J=!1){this.s=X,this.stripped=J,this.index=0,this.length=X.length}next(){if(this.done)return{done:!0,value:void 0};let X=this.index;while(!this.done&&!BJ8(this.s[this.index]))this.index=this.index+1;let J=this.index;if(!this.done){let Z=this.s[this.index];if(this.index=this.index+1,!this.done&&HJ8(Z,this.s[this.index]))this.index=this.index+1;if(!this.stripped)J=this.index}return{done:!1,value:this.s.substring(X,J)}}[Symbol.iterator](){return new Hi(this.s,this.stripped)}get done(){return this.index>=this.length}}var BJ8=(X)=>{let J=X.charCodeAt(0);return J===Hz0||J===Wz0},HJ8=(X,J)=>X.charCodeAt(0)===Hz0&&J.charCodeAt(0)===Wz0,Uz0=(X,J)=>new Hi(X,J);var dF={};y8(dF,{shuffle:()=>OJ8,randomWith:()=>qJ8,nextRange:()=>zJ8,nextIntBetween:()=>NJ8,nextInt:()=>$J8,nextBoolean:()=>UJ8,next:()=>VJ8,make:()=>wJ8,fixed:()=>Wi,choice:()=>_J8,RandomTypeId:()=>WJ8,Random:()=>DJ8});var WJ8=KO,VJ8=lK0,$J8=nK0,UJ8=iK0,zJ8=oK0,NJ8=rK0,OJ8=aK0,_J8=sK0,qJ8=J5,DJ8=tK,wJ8=gI,Wi=xK0;var LJ8="effect/Schedule",aS=Symbol.for(LJ8),Ui=(X)=>V0(X,aS),FJ8="effect/ScheduleDriver",Oz0=Symbol.for(FJ8),Vi={start:0,now:0,input:void 0,output:void 0,elapsed:QY,elapsedSincePrevious:QY,recurrence:0},YU=ZJ()("effect/Schedule/CurrentIterationMetadata",{defaultValue:()=>Vi}),AJ8={_Out:(X)=>X,_In:(X)=>X,_R:(X)=>X},TJ8={_Out:(X)=>X,_In:(X)=>X,_R:(X)=>X};class _z0{initial;step;[aS]=AJ8;constructor(X,J){this.initial=X,this.step=J}pipe(){return K0(this,arguments)}}var zz0=(X,J,Z,Q)=>L1(X,(Y)=>Y.recurrence===0?{now:J,input:Z,output:Q,recurrence:Y.recurrence+1,elapsed:QY,elapsedSincePrevious:QY,start:J}:{now:J,input:Z,output:Q,recurrence:Y.recurrence+1,elapsed:v6(J-Y.start),elapsedSincePrevious:v6(J-Y.now),start:Y.start});class qz0{schedule;ref;[Oz0]=TJ8;constructor(X,J){this.schedule=X,this.ref=J}get state(){return N0(LJ(this.ref),(X)=>X[1])}get last(){return p(LJ(this.ref),([X,J])=>{switch(X._tag){case"None":return Y4(()=>new wZ);case"Some":return o(X.value)}})}iterationMeta=$O(Vi);get reset(){return W4(this.ref,[S(),this.schedule.initial]).pipe(F$(W4(this.iterationMeta,Vi)))}next(X){return z(N0(LJ(this.ref),(J)=>J[1]),p((J)=>z($Y,p((Z)=>z(I0(()=>this.schedule.step(Z,X,J)),p(([Q,Y,G])=>{let K=W4(this.ref,[I(Y),Q]);if(C1(G))return K.pipe(i8(p8(S())));let B=IO(G.intervals)-Z;if(B<=0)return K.pipe(i8(zz0(this.iterationMeta,Z,X,Y)),l9(Y));let H=v6(B);return z(K,i8(zz0(this.iterationMeta,Z,X,Y)),i8(Q3(H)),l9(Y))}))))))}}var GU=(X,J)=>new _z0(X,J),Dz0=$(2,(X,J)=>wz0(X,(Z)=>B0(()=>J(Z)))),wz0=$(2,(X,J)=>Mz0(X,(Z,Q)=>N0(J(Z),(Y)=>Bf(Q,K9(Y)))));var Lz0=(X)=>Ni(X,O6);var Fz0=$(2,(X,J)=>sS(X,(Z,Q)=>B0(()=>J(Z,Q)))),sS=$(2,(X,J)=>GU(X.initial,(Z,Q,Y)=>p(X.step(Z,Q,Y),([G,K,B])=>{if(C1(B))return o([G,K,EO]);return N0(J(Q,K),(H)=>H?[G,K,B]:[G,K,EO])})));var cF=(X)=>z(h$([S(),X.initial]),N0((J)=>new qz0(X,J)));var zi=$(2,(X,J)=>Az0(X,J,sW0)),Az0=$(3,(X,J,Z)=>GU([X.initial,J.initial],(Q,Y,G)=>z(iK(X.step(Q,Y,G[0]),J.step(Q,Y,G[1]),(K,B)=>[K,B]),p(([[K,B,H],[W,V,U]])=>{if(_n(H)&&_n(U))return $i(X,J,Y,K,B,H.intervals,W,V,U.intervals,Z);return o([[K,W],[B,V],EO])})))),$i=(X,J,Z,Q,Y,G,K,B,H,W)=>{let V=W(G,H);if(eW0(V))return o([[Q,K],[Y,B],KV0(V)]);if(z(G,tW0(H)))return p(X.step($S(G),Z,Q),([U,O,q])=>{if(C1(q))return o([[U,K],[O,B],EO]);return $i(X,J,Z,U,O,q.intervals,K,B,H,W)});return p(J.step($S(H),Z,K),([U,O,q])=>{if(C1(q))return o([[Q,U],[Y,O],EO]);return $i(X,J,Z,Q,Y,G,U,O,q.intervals,W)})};var Ni=$(2,(X,J)=>Tz0(X,(Z)=>B0(()=>J(Z)))),Tz0=$(2,(X,J)=>GU(X.initial,(Z,Q,Y)=>p(X.step(Z,Q,Y),([G,K,B])=>N0(J(K),(H)=>[G,H,B]))));var Mz0=$(2,(X,J)=>GU(X.initial,(Z,Q,Y)=>p(X.step(Z,Q,Y),([G,K,B])=>{if(C1(B))return o([G,K,B]);let H=B.intervals,W=fW0(WS(Z,IO(H)));return N0(J(K,W),(V)=>{let U=K9(V),O=IO(H),q=Z+K7(U),L=q-O,A=Math.max(0,$S(H)+L),M=WS(q,A);return[G,K,On(M)]})})));var Oi=(X)=>GU(X.initial,(J,Z,Q)=>z(X.step(J,Z,Q),N0(([Y,G,K])=>[Y,Z,K])));var tS=(X)=>jz0(cO,(J)=>J<X);var Pz0=(X)=>Dz0(cO,()=>X);var Rz0=(X,J)=>GU(X,(Z,Q,Y)=>B0(()=>[J(Y),Y,On(pW0(Z))]));var _i=$(2,(X,J)=>sS(X,(Z,Q)=>TE(J(Z))));var qi=$(2,(X,J)=>sS(X,(Z,Q)=>J(Z))),jz0=$(2,(X,J)=>Fz0(X,(Z,Q)=>J(Q)));var oS=Symbol.for("effect/Schedule/ScheduleDefect");class Cz0{error;[oS];constructor(X){this.error=X,this[oS]=oS}}var MJ8=(X)=>V0(X,oS),rS=(X)=>tY(X,(J)=>aZ(new Cz0(J))),Di=(X)=>w0(uK(X,(J)=>U$(J)&&MJ8(J.defect)?I(J.defect):S()),{onNone:()=>X,onSome:(J)=>GY(J.error)}),fF=(X)=>pK(X,(J)=>W9(Di(J))),Nz0=$(2,(X,J)=>wi(X,J,(Z,Q)=>p8(Z))),Iz0=$(2,(X,J)=>{if(Ui(J))return Nz0(X,J);let Z=J.schedule??Oi(cO),Q=J.while?qi(Z,(K)=>{let B=J.while(K);if(typeof B==="boolean")return o(B);return rS(B)}):Z,Y=J.until?_i(Q,(K)=>{let B=J.until(K);if(typeof B==="boolean")return o(B);return rS(B)}):Q,G=J.times?zi(Y,tS(J.times)).pipe(Ni((K)=>K[0])):Y;return fF(Nz0(X,G))}),wi=$(3,(X,J,Z)=>p(cF(J),(Q)=>YJ(X,{onFailure:(Y)=>Z(Y,S()),onSuccess:(Y)=>Ez0(A1(X,YU,LJ(Q.iterationMeta)),Q,(G,K)=>A1(Z(G,K),YU,LJ(Q.iterationMeta)),Y)}))),Ez0=(X,J,Z,Q)=>YJ(J.next(Q),{onFailure:()=>w$(J.last),onSuccess:(Y)=>YJ(X,{onFailure:(G)=>Z(G,I(Y)),onSuccess:(G)=>Ez0(X,J,Z,G)})}),uF=$(2,(X,J)=>Li(X,J,(Z,Q)=>p8(Z))),Sz0=$(2,(X,J)=>{if(Ui(J))return uF(X,J);return fF(uF(X,eS(J)))}),eS=(X)=>{let J=X.schedule??cO,Z=X.while?qi(J,(Y)=>{let G=X.while(Y);if(typeof G==="boolean")return o(G);return rS(G)}):J,Q=X.until?_i(Z,(Y)=>{let G=X.until(Y);if(typeof G==="boolean")return o(G);return rS(G)}):Z;return X.times!==void 0?zi(Q,tS(X.times)):Q},Li=$(3,(X,J,Z)=>p(cF(J),(Q)=>xz0(A1(X,YU,LJ(Q.iterationMeta)),Q,(Y,G)=>A1(Z(Y,G),YU,LJ(Q.iterationMeta))))),xz0=(X,J,Z)=>{return tY(X,(Q)=>YJ(J.next(Q),{onFailure:()=>z(J.last,w$,p((Y)=>Z(Q,Y))),onSuccess:()=>xz0(X,J,Z)}))},Fi=$(2,(X,J)=>Ai(X,void 0,J)),Ai=$(3,(X,J,Z)=>p(cF(Z),(Q)=>vz0(A1(X,YU,LJ(Q.iterationMeta)),J,Q))),vz0=(X,J,Z)=>YJ(Z.next(J),{onFailure:()=>w$(Z.last),onSuccess:()=>p(X,(Q)=>vz0(X,Q,Z))});var cO=Rz0(0,(X)=>X+1),Ti=Lz0(tS(1));var kz0=$(2,(X,J)=>zS(Fi(X,J)));var bz0=$(2,(X,J)=>I0(()=>{let Z=0,Q;return p(U1({while:()=>Z<J.steps.length&&(Q===void 0||U9(Q)),body:()=>{let Y=J.steps[Z],G=SS(X,Y.provide);if(Q){let K=!1,B=G;G=I0(()=>{if(K)return B;return K=!0,Q}),G=fF(uF(G,pF(Y,!1)))}else{let K=pF(Y,!0);G=K?fF(uF(G,K)):G}return Q4(G)},step:(Y)=>{Q=Y,Z++}}),()=>Q)})),pF=(X,J)=>{if(!J)return eS({schedule:X.schedule?X.schedule:X.attempts?void 0:Ti,times:X.attempts,while:X.while});else if(X.attempts===1||!(X.schedule||X.attempts))return;return eS({schedule:X.schedule,while:X.while,times:X.attempts?X.attempts-1:void 0})};var d1=eC,F9=f7;var h8=IX;var Jx=LI;var gz0=ML,Zx=BK0;var V5=QO;var lF=HK0;var u1=WK0,hz0=VK0,H6=gB;var Mi=LG,$5=sK;var mz0=Symbol.for("effect/MutableList"),PJ8={[mz0]:mz0,[Symbol.iterator](){let X=!1,J=this.head;return{next(){if(X)return this.return();if(J==null)return X=!0,this.return();let Z=J.value;return J=J.next,{done:X,value:Z}},return(Z){if(!X)X=!0;return{done:!0,value:Z}}}},toString(){return u8(this.toJSON())},toJSON(){return{_id:"MutableList",values:Array.from(this).map(H9)}},[$8](){return this.toJSON()},pipe(){return K0(this,arguments)}},RJ8=(X)=>({value:X,removed:!1,prev:void 0,next:void 0}),dz0=()=>{let X=Object.create(PJ8);return X.head=void 0,X.tail=void 0,X._length=0,X};var Pi=(X)=>Qx(X)===0,Qx=(X)=>X._length;var uz0=$(2,(X,J)=>{let Z=RJ8(J);if(X.head===void 0)X.head=Z;if(X.tail===void 0)X.tail=Z;else X.tail.next=Z,Z.prev=X.tail,X.tail=Z;return X._length+=1,X}),cz0=(X)=>{let J=X.head;if(J!==void 0)return jJ8(X,J),J.value;return};var jJ8=(X,J)=>{if(J.removed)return;if(J.removed=!0,J.prev!==void 0&&J.next!==void 0)J.prev.next=J.next,J.next.prev=J.prev;else if(J.prev!==void 0)X.tail=J.prev,J.prev.next=void 0;else if(J.next!==void 0)X.head=J.next,J.next.prev=void 0;else X.tail=void 0,X.head=void 0;if(X._length>0)X._length-=1};var fz0=Symbol.for("effect/MutableQueue"),gX=Symbol.for("effect/mutable/MutableQueue/Empty"),IJ8={[fz0]:fz0,[Symbol.iterator](){return Array.from(this.queue)[Symbol.iterator]()},toString(){return u8(this.toJSON())},toJSON(){return{_id:"MutableQueue",values:Array.from(this).map(H9)}},[$8](){return this.toJSON()},pipe(){return K0(this,arguments)}},pz0=(X)=>{let J=Object.create(IJ8);return J.queue=dz0(),J.capacity=X,J},Yx=(X)=>pz0(X),eB=()=>pz0(void 0),Gx=(X)=>Qx(X.queue),XH=(X)=>Pi(X.queue);var lz0=(X)=>X.capacity===void 0?1/0:X.capacity,L4=$(2,(X,J)=>{let Z=Qx(X.queue);if(X.capacity!==void 0&&Z===X.capacity)return!1;return uz0(J)(X.queue),!0}),nF=$(2,(X,J)=>{let Z=J[Symbol.iterator](),Q,Y=a0(),G=!0;while(G&&(Q=Z.next())&&!Q.done)G=L4(Q.value)(X);while(Q!=null&&!Q.done)Y=LX(Q.value)(Y),Q=Z.next();return ZY(Y)}),zY=$(2,(X,J)=>{if(Pi(X.queue))return J;return cz0(X.queue)}),fO=$(2,(X,J)=>{let Z=a0(),Q=0;while(Q<J){let Y=zY(gX)(X);if(Y===gX)break;Z=LX(Y)(Z),Q+=1}return ZY(Z)});var nz0=(X,J,Z,Q)=>hN({_tag:"Complete",key:X,exit:J,entryStats:Z,timeToLiveMillis:Q}),iz0=(X,J)=>hN({_tag:"Pending",key:X,deferred:J}),EJ8=(X,J)=>hN({_tag:"Refreshing",deferred:X,complete:J}),ji=Symbol.for("effect/Cache/MapKey");class oz0{current;[ji]=ji;previous=void 0;next=void 0;constructor(X){this.current=X}[y0](){return z(Z0(this.current),A0(Z0(this.previous)),A0(Z0(this.next)),W8(this))}[b0](X){if(this===X)return!0;return SJ8(X)&&_0(this.current,X.current)&&_0(this.previous,X.previous)&&_0(this.next,X.next)}}var pO=(X)=>new oz0(X),SJ8=(X)=>V0(X,ji);class rz0{head=void 0;tail=void 0;add(X){if(X!==this.tail)if(this.tail===void 0)this.head=X,this.tail=X;else{let{previous:J,next:Z}=X;if(Z!==void 0)if(X.next=void 0,J!==void 0)J.next=Z,Z.previous=J;else this.head=Z,this.head.previous=void 0;this.tail.next=X,X.previous=this.tail,this.tail=X}}remove(){let X=this.head;if(X!==void 0){let J=X.next;if(J!==void 0)X.next=void 0,this.head=J,this.head.previous=void 0;else this.head=void 0,this.tail=void 0}return X}}var xJ8=()=>new rz0,vJ8=(X,J,Z,Q,Y,G)=>({map:X,keys:J,accesses:Z,updating:Q,hits:Y,misses:G}),kJ8=()=>vJ8(nB(),xJ8(),eB(),uJ(!1),0,0),bJ8="effect/Cache",yJ8=Symbol.for(bJ8),gJ8={_Key:(X)=>X,_Error:(X)=>X,_Value:(X)=>X},hJ8="effect/ConsumerCache",mJ8=Symbol.for(hJ8),dJ8={_Key:(X)=>X,_Error:(X)=>X,_Value:(X)=>X},uJ8=(X)=>X,Kx=(X)=>({loadedMillis:X});class az0{capacity;context;fiberId;lookup;timeToLive;[yJ8]=gJ8;[mJ8]=dJ8;cacheState;constructor(X,J,Z,Q,Y){this.capacity=X,this.context=J,this.fiberId=Z,this.lookup=Q,this.timeToLive=Y,this.cacheState=kJ8()}get(X){return N0(this.getEither(X),nV)}get cacheStats(){return B0(()=>uJ8({hits:this.cacheState.hits,misses:this.cacheState.misses,size:AO(this.cacheState.map)}))}getOption(X){return I0(()=>w0(H7(this.cacheState.map,X),{onNone:()=>{let J=pO(X);return this.trackAccess(J),this.trackMiss(),o(S())},onSome:(J)=>this.resolveMapValue(J)}))}getOptionComplete(X){return I0(()=>w0(H7(this.cacheState.map,X),{onNone:()=>{let J=pO(X);return this.trackAccess(J),this.trackMiss(),o(S())},onSome:(J)=>this.resolveMapValue(J,!0)}))}contains(X){return B0(()=>K5(this.cacheState.map,X))}entryStats(X){return B0(()=>{let J=H7(this.cacheState.map,X);if(R0(J))switch(J.value._tag){case"Complete":{let Z=J.value.entryStats.loadedMillis;return I(Kx(Z))}case"Pending":return S();case"Refreshing":{let Z=J.value.complete.entryStats.loadedMillis;return I(Kx(Z))}}return S()})}getEither(X){return I0(()=>{let J=X,Z=void 0,Q=void 0,Y=u9(H7(this.cacheState.map,J));if(Y===void 0)if(Q=Mi(this.fiberId),Z=pO(J),K5(this.cacheState.map,J))Y=u9(H7(this.cacheState.map,J));else XQ(this.cacheState.map,J,iz0(Z,Q));if(Y===void 0)return this.trackAccess(Z),this.trackMiss(),N0(this.lookupValueOf(X,Q),O0);else return p(this.resolveMapValue(Y),w0({onNone:()=>this.getEither(X),onSome:(G)=>o(M0(G))}))})}invalidate(X){return B0(()=>{G3(this.cacheState.map,X)})}invalidateWhen(X,J){return B0(()=>{let Z=H7(this.cacheState.map,X);if(R0(Z)&&Z.value._tag==="Complete"){if(Z.value.exit._tag==="Success"){if(J(Z.value.exit.value))G3(this.cacheState.map,X)}}})}get invalidateAll(){return B0(()=>{this.cacheState.map=nB()})}refresh(X){return V4((J)=>I0(()=>{let Z=X,Q=Mi(this.fiberId),Y=u9(H7(this.cacheState.map,Z));if(Y===void 0)if(K5(this.cacheState.map,Z))Y=u9(H7(this.cacheState.map,Z));else XQ(this.cacheState.map,Z,iz0(pO(Z),Q));if(Y===void 0)return AX(this.lookupValueOf(X,Q));else switch(Y._tag){case"Complete":{if(this.hasExpired(J,Y.timeToLiveMillis)){let G=u9(H7(this.cacheState.map,Z));if(_0(G,Y))G3(this.cacheState.map,Z);return AX(this.get(X))}return z(this.lookupValueOf(X,Q),PE(()=>{let G=u9(H7(this.cacheState.map,Z));if(_0(G,Y)){let K=EJ8(Q,Y);return XQ(this.cacheState.map,Z,K),!0}return!1}),AX)}case"Pending":return h8(Y.deferred);case"Refreshing":return h8(Y.deferred)}}))}set(X,J){return V4((Z)=>B0(()=>{let Q=Z.unsafeCurrentTimeMillis(),Y=X,G=v8(J),K=nz0(pO(Y),G,Kx(Q),Q+K7(K9(this.timeToLive(G))));XQ(this.cacheState.map,Y,K)}))}get size(){return B0(()=>{return AO(this.cacheState.map)})}get values(){return B0(()=>{let X=[];for(let J of this.cacheState.map)if(J[1]._tag==="Complete"&&J[1].exit._tag==="Success")X.push(J[1].exit.value);return X})}get entries(){return B0(()=>{let X=[];for(let J of this.cacheState.map)if(J[1]._tag==="Complete"&&J[1].exit._tag==="Success")X.push([J[0],J[1].exit.value]);return X})}get keys(){return B0(()=>{let X=[];for(let J of this.cacheState.map)if(J[1]._tag==="Complete"&&J[1].exit._tag==="Success")X.push(J[0]);return X})}resolveMapValue(X,J=!1){return V4((Z)=>{switch(X._tag){case"Complete":{if(this.trackAccess(X.key),this.hasExpired(Z,X.timeToLiveMillis))return G3(this.cacheState.map,X.key.current),o(S());return this.trackHit(),N0(X.exit,I)}case"Pending":{if(this.trackAccess(X.key),this.trackHit(),J)return o(S());return N0(h8(X.deferred),I)}case"Refreshing":{if(this.trackAccess(X.complete.key),this.trackHit(),this.hasExpired(Z,X.complete.timeToLiveMillis)){if(J)return o(S());return N0(h8(X.deferred),I)}return N0(X.complete.exit,I)}}})}trackHit(){this.cacheState.hits=this.cacheState.hits+1}trackMiss(){this.cacheState.misses=this.cacheState.misses+1}trackAccess(X){if(L4(this.cacheState.accesses,X),TC(this.cacheState.updating,!1,!0)){let J=!0;while(J){let Q=zY(this.cacheState.accesses,gX);if(Q===gX)J=!1;else this.cacheState.keys.add(Q)}let Z=AO(this.cacheState.map);J=Z>this.capacity;while(J){let Q=this.cacheState.keys.remove();if(Q!==void 0){if(K5(this.cacheState.map,Q.current))G3(this.cacheState.map,Q.current),Z=Z-1,J=Z>this.capacity}else J=!1}oZ(this.cacheState.updating,!1)}}hasExpired(X,J){return X.unsafeCurrentTimeMillis()>J}lookupValueOf(X,J){return V4((Z)=>I0(()=>{let Q=X;return z(this.lookup(X),X5(this.context),B6,p((Y)=>{let G=Z.unsafeCurrentTimeMillis(),K=Kx(G),B=nz0(pO(Q),Y,K,G+K7(K9(this.timeToLive(Y))));return XQ(this.cacheState.map,Q,B),i8(gz0(J,Y),Y)}),sZ(()=>i8(lF(J),B0(()=>{G3(this.cacheState.map,Q)}))))}))}}var sz0=(X,J,Z)=>new az0(X,jX(),Y$,J,(Q)=>K9(Z(Q)));var lO=c0(Symbol.for("effect/FiberRef/currentCache"),()=>_6(sz0(65536,()=>N0(f7(),(X)=>({listeners:new JF,handle:X})),()=>eV(60)))),iF=c0(Symbol.for("effect/FiberRef/currentCacheEnabled"),()=>_6(!1)),tz0=(X,J)=>p(b9(J)?J:o(J),(Z)=>KY((Q)=>{let Y=new Proxy(X,{});return DJ(iF,(G)=>{if(G){let B=DJ(lO,(H)=>p(H.getEither(Y),(W)=>{switch(W._tag){case"Left":{if(W.left.listeners.interrupted)return p(H.invalidateWhen(Y,(V)=>V.handle===W.left.handle),()=>B);return W.left.listeners.increment(),kX((V)=>p(B6(vB(p40,V(IX(W.left.handle)))),(U)=>{return W.left.listeners.decrement(),U}))}case"Right":return W.right.listeners.increment(),kX((V)=>p(B6(vB(nf(Z,of({request:Y,result:W.right.handle,listeners:W.right.listeners,ownerId:Q,state:{completed:!1}})),V(IX(W.right.handle)))),()=>{return W.right.listeners.decrement(),IX(W.right.handle)}))}}));return B}let K=new JF;return K.increment(),p(f7(),(B)=>MZ(vB(nf(Z,of({request:Y,result:B,listeners:K,ownerId:Q,state:{completed:!1}})),IX(B)),B0(()=>K.decrement())))})})),ez0=(X,J)=>{return DJ(iF,(Z)=>{if(Z)return DJ(lO,(Q)=>p(Q.getEither(X),(Y)=>{switch(Y._tag){case"Left":return N8;case"Right":return LI(Y.right.handle,J)}}));return N8})},XN0=$(2,(X,J)=>iX(X,iF,J)),JN0=$(2,(X,J)=>iX(X,lO,J));var QN0=w10;var YN0=L10;var Bx=kB,VX=b9,cJ8=NV0,fJ8=Ln,EG=AE,pJ8=wV0,lJ8=Jl,SQ=B3,nJ8=VW0,iJ8=$W0,Hx=MB0,Wx=PB0,oJ8=wH0,HN0=LH0,rJ8=yB0,aJ8=BW0,Vx=WW0,sJ8=jB0,Ci=xB0,a9=B5,tJ8=hB0,eJ8=nl,XZ8=il,oF=WH0,JZ8=$H0,ZZ8=VH0,QZ8=_W0,YZ8=ll,GZ8=UW0,KZ8=NW0,BZ8=FW0,b6=rZ,HZ8=X$0,WZ8=WL,AJ=M8,Y0=p8,nO=Y4,MX=W9,Ii=bB,P7=aZ,SG=K1,Ei=B1,f0=WI,c1=z1,VZ8=ZH0,KU=BH0,y=o,f1=c$,$Z8=qH0,o0=I0,L0=B0,U0=N8;var UZ8=nK,zZ8=$B0;var y6=tY,s9=pK,$x=UB0,Ux=VL,U3=FG0,BU=zB0,NZ8=NB0,QQ=OB0,iO=_B0,OZ8=qB0,_Z8=tp,HU=FE,qZ8=mB0,DZ8=KH0,Si=OH0,z3=Sz0,wZ8=bz0,LZ8=Li,HJ=mL;var JH=jH0,FZ8=CH0,TJ=Gl,AZ8=SH0,TZ8=LB0,MZ8=AG0,PZ8=SW0,aJ=nX,RZ8=UL,QX=OG,jZ8=KI,rF=sZ,xG=MQ,U5=kX,CZ8=EB0,y9=l9,zx=NO,IZ8=VB0,p7=AX,EZ8=W1,SZ8=bB0,u=N0,xZ8=XH0,vG=zL,E9=V1,vZ8=_O,kZ8=JH0,xi=TE,A9=K3,bZ8=GW0,p1=oN,aF=RG,RZ=MZ,WU=BI,sF=TQ,yZ8=eE,gZ8=XS,hZ8=qW0,N3=YS,tF=z4,eF=VF,l7=ZS,mZ8=wW0,dZ8=MW0,uZ8=zV0,cZ8=KW0,fZ8=FB0,pZ8=DE,lZ8=OO,nZ8=OV0,iZ8=US,oZ8=G4,oO=KY,vi=rB,F4=i$,rZ8=_V0,$X=x1,MJ=zS,aZ8=zW0,sZ8=qV0,tZ8=DV0,eZ8=Fn,XQ8=HI,JQ8=PG0,ZQ8=e30,QQ8=$p,YQ8=xG0,ki=DB0,GQ8=V4,KQ8=AW0,BQ8=uK0,HQ8=d$0,WQ8=M7,VQ8=u$0,$Q8=xS,WN0=wB0,UQ8=Q3,zQ8=PH0,NQ8=Yl,XA=FV0,OQ8=TV0,bi=An,yi=AV0,_Q8=LF,qQ8=Tp,DQ8=cK0,wQ8=QS,EX=WY,VU=RB0,gi=B4,rO=hB,o6=SS,PJ=F1,z5=A1,LQ8=gH0,FQ8=yH0,hi=Kl,AQ8=Bl,TQ8=hH0,JA=mH0,MQ8=Hl,VN0=xH0,PQ8=AB0,RQ8=dL,jQ8=jV0,CQ8=uL,IQ8=TB0;var EQ8=QH0,l1=Q4,r6=B6,$U=lK,SQ8=GI;var xQ8=CB0,mi=IB0,di=cL,ui=SB0,vQ8=qp,kQ8=$K0,bQ8=IH0,Nx=EH0,A4=PE,yQ8=_G,gQ8=vH0,hQ8=kH0,h=p,mQ8=H1,sJ=BY,ZA=KS,dQ8=OW0,Ox=LV0,n1=el,uQ8=pL,J9=i6,cQ8=FH0,fQ8=AH0,QA=Ql,pQ8=TH0,N5=MH0,aO=wE,lQ8=ep,nQ8=sB0,sO=Iz0,YA=zH0,iQ8=wi,oQ8=Fi,rQ8=kz0,aQ8=Ai,ZH=U1,sQ8=LE,tQ8=dB0,O5=iX,$N0=GJ,eQ8=TZ,XY8=KJ,JY8=u$,ZY8=_H0,QY8=ME,YY8=uB0,GY8=cB0,R7=fL,QH=$L,a6=K6,q9=YJ,ci=fB0,KY8=(X,...J)=>fB(X)(...J),BY8=pB0,fi=Xl,HY8=lB0,pi=nB0,UU=iB0,li=oB0,UN0=rB0,zU=WB0,WY8=QW0,VY8=aB0,GA=vG0,$Y8=YW0,R9=w$,UY8=Yp,O3=D$,NU=YH0,ni=GH0,zY8=kB0,NY8=HH0,OY8=J5,zN0=pK0,_Y8=$(2,(X,J)=>zN0(X,Wi(J))),qY8=TW0,xQ=yO,DY8=aN,wY8=$1,LY8=VI,FY8=al,AY8=DH0,TY8=Zl,MY8=DW0,PY8=ol,RY8=kG0,jY8=bH0,OU=S1,tO=VV0,kG=wn,NN0=UV0,NY=rV0,CY8=oV0,YH=aV0,IY8=sV0,j9=tV0,EY8=eV0,SY8=LW0,xY8=rl,j7=PW0,jZ=RW0,C0=jW0,tJ=aB,vY8=$(2,(X,J)=>tJ(X,J,(Z,Q)=>Z(Q))),kY8=vB,bY8=ZI,yY8=YI,gY8=$((X)=>QN0(X[0]),tz0),hY8=ez0,mY8=RG0,dY8=XN0,uY8=JN0,cY8=RH0,fY8=mI,pY8=tK0,lY8=BS,nY8=jG0,iY8=CG0,oY8=cH0,ii=dH0,rY8=Wl,aY8=Vl,sY8=fH0,tY8=iH0,eY8=oH0,X58=pH0,J58=uH0,oi=nH0,ri=U4,eO=_E,_x=$l,Z58=rH0,Q58=xW0,_U=qE,Y58=aH0,G58=sH0,K58=(X)=>{return BG(X)?f1:u(X.value,XJ)},B58=$(2,(X,J)=>BG(X)?f1:u(J(X.value),XJ)),ON0=(X)=>{let J=new Map;return new Proxy(X,{get(Z,Q,Y){if(Q in Z)return Reflect.get(Z,Q,Y);if(J.has(Q))return J.get(Q);let G=(...U)=>H1(Z,(O)=>{if(typeof O[Q]==="function")return J.set(Q,(...q)=>H1(Z,(L)=>L[Q](...q))),O[Q](...U);return J.set(Q,H1(Z,(q)=>q[Q])),O[Q]}),K=H1(Z,(U)=>U[Q]);Object.assign(G,K);let{apply:B,bind:H,call:W}=G,V=Object.setPrototypeOf({},Object.getPrototypeOf(K));return V.apply=B,V.bind=H,V.call=W,Object.setPrototypeOf(G,V),J.set(Q,G),G}})},H58=(X)=>()=>{let J=Error.stackTraceLimit;Error.stackTraceLimit=2;let Z=Error();Error.stackTraceLimit=J;function Q(){}return Object.setPrototypeOf(Q,RN),Q.key=X,Object.defineProperty(Q,"use",{get(){return(Y)=>H1(this,Y)}}),Object.defineProperty(Q,"stack",{get(){return Z.stack}}),ON0(Q)},W58=function(){return function(){let[X,J]=arguments,Z="accessors"in J?J.accessors:!1,Q=Error.stackTraceLimit;Error.stackTraceLimit=2;let Y=Error();Error.stackTraceLimit=Q;let G="unchecked",K=function(U){if(G==="unchecked"){let O=Object.getPrototypeOf(U);if(O===Object.prototype||O===null)G="plain";else{let q=Object.getPrototypeOf(this);Object.setPrototypeOf(q,O),G="patched"}}if(G==="plain")Object.assign(this,U);else if(G==="patched")return Object.setPrototypeOf(U,Object.getPrototypeOf(this)),U};K.prototype._tag=X,Object.defineProperty(K,"make",{get(){return(U)=>new this(U)}}),Object.defineProperty(K,"use",{get(){return(U)=>H1(this,U)}}),K.key=X,Object.assign(K,RN),Object.defineProperty(K,"stack",{get(){return Y.stack}});let B="dependencies"in J&&J.dependencies.length>0,H=B?"DefaultWithoutDependencies":"Default",W,V=!1;if("effect"in J)V=typeof J.effect==="function",Object.defineProperty(K,H,{get(){if(V)return function(){return y1(K,u(J.effect.apply(null,arguments),(U)=>new this(U)))}.bind(this);return W??=y1(K,u(J.effect,(U)=>new this(U)))}});else if("scoped"in J)V=typeof J.scoped==="function",Object.defineProperty(K,H,{get(){if(V)return function(){return g1(K,u(J.scoped.apply(null,arguments),(U)=>new this(U)))}.bind(this);return W??=g1(K,u(J.scoped,(U)=>new this(U)))}});else if("sync"in J)Object.defineProperty(K,H,{get(){return W??=IS(K,()=>new this(J.sync()))}});else Object.defineProperty(K,H,{get(){return W??=hO(K,new this(J.succeed))}});if(B){let U;Object.defineProperty(K,"Default",{get(){if(V)return function(){return t$(this.DefaultWithoutDependencies.apply(null,arguments),J.dependencies)};return U??=t$(this.DefaultWithoutDependencies,J.dependencies)}})}return Z===!0?ON0(K):K}},ai=function(X,...J){let Z=Error.stackTraceLimit;Error.stackTraceLimit=2;let Q=Error();if(Error.stackTraceLimit=Z,typeof X!=="string")return KN0(X.length,function(...K){let B=Error.stackTraceLimit;Error.stackTraceLimit=2;let H=Error();return Error.stackTraceLimit=B,BN0({self:this,body:X,args:K,pipeables:J,spanName:"<anonymous>",spanOptions:{context:k$.context(!0)},errorDef:Q,errorCall:H})});let Y=X,G=J[0];return(K,...B)=>KN0(K.length,{[Y](...H){let W=Error.stackTraceLimit;Error.stackTraceLimit=2;let V=Error();return Error.stackTraceLimit=W,BN0({self:this,body:K,args:H,pipeables:B,spanName:Y,spanOptions:G,errorDef:Q,errorCall:V})}}[Y])};function KN0(X,J){return Object.defineProperty(J,"length",{value:X,configurable:!0})}function BN0(X){let J,Z=void 0;if(nQ0(X.body))J=XL(()=>X.body.apply(X.self,X.args));else try{J=X.body.apply(X.self,X.args)}catch(K){Z=K,J=P7(K)}if(X.pipeables.length>0)try{for(let K of X.pipeables)J=K(J,...X.args)}catch(K){J=Z?MX(OX(k6(Z),k6(K))):P7(K)}let Q=!1,Y=()=>{if(Q!==!1)return Q;if(X.errorCall.stack){let K=X.errorDef.stack.trim().split(`
177
+ `),B=X.errorCall.stack.trim().split(`
178
+ `),H=K.slice(2).join(`
179
+ `).trim();if(!H.includes("("))H=H.replace(/at (.*)/,"at ($1)");let W=B.slice(2).join(`
180
+ `).trim();if(!W.includes("("))W=W.replace(/at (.*)/,"at ($1)");return Q=`${H}
181
+ ${W}`,Q}},G=X.spanOptions&&"captureStackTrace"in X.spanOptions?X.spanOptions:{captureStackTrace:Y,...X.spanOptions};return _x(J,X.spanName,G)}var hX=yB,V58=()=>(X)=>X,$58=()=>(X)=>X,U58=()=>(X)=>X;var si=(X,J)=>{switch(J._tag){case"StringKeyword":case"TemplateLiteral":return Object.keys(X);case"SymbolKeyword":return Object.getOwnPropertySymbols(X);case"Refinement":return si(X,J.from)}},X_=(X)=>{let J=!1,Z;return()=>{if(J)return Z;return Z=X(),J=!0,Z}},qx=(X)=>Array.isArray(X),qN0=(X)=>!Array.isArray(X),_N0=(X)=>`[${wK(X)}]`,Dx=(X)=>qx(X)?X.map(_N0).join(""):_N0(X);var OY=(X,J,Z,Q)=>{let Y=X;if(Z&&B8(Z))Y+=`
182
+ at path: ${Dx(Z)}`;if(J!==void 0)Y+=`
183
+ details: ${J}`;if(Q)Y+=`
184
+ schema (${Q._tag}): ${Q}`;return Y},Lx=(X)=>OY("Invalid Argument",X),ti=(X,J,Z)=>OY("Unsupported schema",X,J,Z),DN0=(X,J,Z)=>OY("Missing annotation",X,J,Z);var wN0=(X,J)=>ti("Cannot build an Equivalence",J,X),ei=(X,J)=>DN0('Generating a JSON Schema for this schema requires a "jsonSchema" annotation',X,J),LN0=(X,J)=>DN0('Generating a JSON Schema for this schema requires an "identifier" annotation',X,J),FN0=(X)=>OY("Generating a JSON Schema for post-rest elements is not currently supported. You're welcome to contribute by submitting a Pull Request",void 0,X),AN0=(X,J)=>OY("Unsupported key",`Cannot encode ${wK(X)} key to JSON Schema`,J);var Xo=(X,J,Z)=>OY("Unsupported schema or overlapping types",`cannot extend ${X} with ${J}`,Z),TN0=(X)=>OY("Unsupported template literal span",void 0,void 0,X),GH=(X)=>ti(void 0,void 0,X),MN0=(X)=>OY("Unsupported key schema",void 0,void 0,X),PN0=(X)=>OY("Unsupported literal",`literal value: ${E6(X)}`),Jo=(X)=>OY("Duplicate index signature",`${X} index signature`),RN0=OY("Unsupported index signature parameter","An index signature parameter type must be `string`, `symbol`, a template literal type or a refinement of the previous types"),jN0=OY("Invalid element","A required element cannot follow an optional element. ts(1257)"),Zo=(X)=>OY("Duplicate property signature transformation",`Duplicate key ${E6(X)}`),CN0=(X)=>ti(void 0,void 0,X),Fx=(X)=>OY("Duplicate property signature",`Duplicate key ${E6(X)}`);var EN0=Symbol.for("effect/annotation/TypeConstructor"),Go=Symbol.for("effect/annotation/Brand"),wU=Symbol.for("effect/annotation/SchemaId"),Ko=Symbol.for("effect/annotation/Message"),Ax=Symbol.for("effect/annotation/MissingMessage"),$A=Symbol.for("effect/annotation/Identifier"),IZ=Symbol.for("effect/annotation/Title"),o1=Symbol.for("effect/annotation/AutoTitle"),_Y=Symbol.for("effect/annotation/Description"),Tx=Symbol.for("effect/annotation/Examples"),Mx=Symbol.for("effect/annotation/Default"),Px=Symbol.for("effect/annotation/JSONSchema"),Bo=Symbol.for("effect/annotation/Arbitrary"),Ho=Symbol.for("effect/annotation/Pretty"),Rx=Symbol.for("effect/annotation/Equivalence"),SN0=Symbol.for("effect/annotation/Documentation"),Wo=Symbol.for("effect/annotation/Concurrency"),Vo=Symbol.for("effect/annotation/Batching"),$o=Symbol.for("effect/annotation/ParseIssueTitle"),Uo=Symbol.for("effect/annotation/ParseOptions"),zo=Symbol.for("effect/annotation/DecodingFallback"),UA=Symbol.for("effect/annotation/Surrogate"),zA=Symbol.for("effect/annotation/StableFilter"),C7=$(2,(X,J)=>Object.prototype.hasOwnProperty.call(X.annotations,J)?I(X.annotations[J]):S());var No=C7(Go);var xN0=C7(Ko),vN0=C7(Ax),NA=C7(IZ),Oo=C7(o1),OA=C7($A),HH=C7(_Y),kN0=C7(Tx),bN0=C7(Mx),_o=C7(Px);var yN0=C7(Wo),gN0=C7(Vo),hN0=C7($o),mN0=C7(Uo),dN0=C7(zo),M4=C7(UA),z58=C7(zA),qo=(X)=>Ac(z58(X),(J)=>J===!0),jx=Symbol.for("effect/annotation/JSONIdentifier"),N58=C7(jx),Do=(X)=>JJ(N58(X),()=>OA(X)),Cx=Symbol.for("effect/schema/ParseJson");class Y_{typeParameters;decodeUnknown;encodeUnknown;annotations;_tag="Declaration";constructor(X,J,Z,Q={}){this.typeParameters=X,this.decodeUnknown=J,this.encodeUnknown=Z,this.annotations=Q}toString(){return i0(T4(this),()=>"<declaration schema>")}toJSON(){return{_tag:this._tag,typeParameters:this.typeParameters.map((X)=>X.toJSON()),annotations:g6(this.annotations)}}}var kQ=(X)=>(J)=>J._tag===X,uN0=kQ("Declaration");class _3{literal;annotations;_tag="Literal";constructor(X,J={}){this.literal=X,this.annotations=J}toString(){return i0(T4(this),()=>E6(this.literal))}toJSON(){return{_tag:this._tag,literal:DK(this.literal)?String(this.literal):this.literal,annotations:g6(this.annotations)}}}var q3=kQ("Literal"),cN0=new _3(null);class G_{symbol;annotations;_tag="UniqueSymbol";constructor(X,J={}){this.symbol=X,this.annotations=J}toString(){return i0(T4(this),()=>E6(this.symbol))}toJSON(){return{_tag:this._tag,symbol:String(this.symbol),annotations:g6(this.annotations)}}}var O58=kQ("UniqueSymbol");class fN0{annotations;_tag="UndefinedKeyword";constructor(X={}){this.annotations=X}toString(){return hG(this)}toJSON(){return{_tag:this._tag,annotations:g6(this.annotations)}}}var LU=new fN0({[IZ]:"undefined"});class pN0{annotations;_tag="VoidKeyword";constructor(X={}){this.annotations=X}toString(){return hG(this)}toJSON(){return{_tag:this._tag,annotations:g6(this.annotations)}}}var lN0=new pN0({[IZ]:"void"});class nN0{annotations;_tag="NeverKeyword";constructor(X={}){this.annotations=X}toString(){return hG(this)}toJSON(){return{_tag:this._tag,annotations:g6(this.annotations)}}}var FU=new nN0({[IZ]:"never"}),_58=kQ("NeverKeyword");class iN0{annotations;_tag="UnknownKeyword";constructor(X={}){this.annotations=X}toString(){return hG(this)}toJSON(){return{_tag:this._tag,annotations:g6(this.annotations)}}}var wo=new iN0({[IZ]:"unknown"});class oN0{annotations;_tag="AnyKeyword";constructor(X={}){this.annotations=X}toString(){return hG(this)}toJSON(){return{_tag:this._tag,annotations:g6(this.annotations)}}}var Lo=new oN0({[IZ]:"any"});class rN0{annotations;_tag="StringKeyword";constructor(X={}){this.annotations=X}toString(){return hG(this)}toJSON(){return{_tag:this._tag,annotations:g6(this.annotations)}}}var K_=new rN0({[IZ]:"string",[_Y]:"a string"}),_A=kQ("StringKeyword");class aN0{annotations;_tag="NumberKeyword";constructor(X={}){this.annotations=X}toString(){return hG(this)}toJSON(){return{_tag:this._tag,annotations:g6(this.annotations)}}}var B_=new aN0({[IZ]:"number",[_Y]:"a number"}),Fo=kQ("NumberKeyword");class sN0{annotations;_tag="BooleanKeyword";constructor(X={}){this.annotations=X}toString(){return hG(this)}toJSON(){return{_tag:this._tag,annotations:g6(this.annotations)}}}var H_=new sN0({[IZ]:"boolean",[_Y]:"a boolean"}),Ao=kQ("BooleanKeyword");class tN0{annotations;_tag="BigIntKeyword";constructor(X={}){this.annotations=X}toString(){return hG(this)}toJSON(){return{_tag:this._tag,annotations:g6(this.annotations)}}}var eN0=new tN0({[IZ]:"bigint",[_Y]:"a bigint"});class XO0{annotations;_tag="SymbolKeyword";constructor(X={}){this.annotations=X}toString(){return hG(this)}toJSON(){return{_tag:this._tag,annotations:g6(this.annotations)}}}var JO0=new XO0({[IZ]:"symbol",[_Y]:"a symbol"}),Ix=kQ("SymbolKeyword");class ZO0{annotations;_tag="ObjectKeyword";constructor(X={}){this.annotations=X}toString(){return hG(this)}toJSON(){return{_tag:this._tag,annotations:g6(this.annotations)}}}var QO0=new ZO0({[IZ]:"object",[_Y]:"an object in the TypeScript meaning, i.e. the `object` type"});class To{enums;annotations;_tag="Enums";constructor(X,J={}){this.enums=X,this.annotations=J}toString(){return i0(T4(this),()=>`<enum ${this.enums.length} value(s): ${this.enums.map(([X,J])=>JSON.stringify(J)).join(" | ")}>`)}toJSON(){return{_tag:this._tag,enums:this.enums,annotations:g6(this.annotations)}}}var q58=kQ("Enums"),YO0=(X)=>{switch(X._tag){case"Literal":case"NumberKeyword":case"StringKeyword":case"TemplateLiteral":return!0;case"Union":return X.types.every(YO0)}return!1},GO0=(X)=>{switch(X._tag){case"Literal":return JSON.stringify(String(X.literal));case"StringKeyword":return"string";case"NumberKeyword":return"number";case"TemplateLiteral":return String(X);case"Union":return X.types.map(GO0).join(" | ")}},D58=(X)=>{switch(X._tag){case"Literal":return String(X.literal);case"StringKeyword":return"${string}";case"NumberKeyword":return"${number}";case"TemplateLiteral":return"${"+String(X)+"}";case"Union":return"${"+X.types.map(GO0).join(" | ")+"}"}};class AU{literal;type;constructor(X,J){if(this.literal=J,YO0(X))this.type=X;else throw Error(TN0(X))}toString(){return D58(this.type)+this.literal}toJSON(){return{type:this.type.toJSON(),literal:this.literal}}}class Ex{head;spans;annotations;_tag="TemplateLiteral";constructor(X,J,Z={}){this.head=X,this.spans=J,this.annotations=Z}toString(){return i0(T4(this),()=>w58(this))}toJSON(){return{_tag:this._tag,head:this.head,spans:this.spans.map((X)=>X.toJSON()),annotations:g6(this.annotations)}}}var w58=(X)=>"`"+X.head+X.spans.map(String).join("")+"`",KO0=kQ("TemplateLiteral");class TU{type;annotations;constructor(X,J={}){this.type=X,this.annotations=J}toJSON(){return{type:this.type.toJSON(),annotations:g6(this.annotations)}}toString(){return String(this.type)}}class qY extends TU{isOptional;constructor(X,J,Z={}){super(X,Z);this.isOptional=J}toJSON(){return{type:this.type.toJSON(),isOptional:this.isOptional,annotations:g6(this.annotations)}}toString(){return String(this.type)+(this.isOptional?"?":"")}}var Sx=(X)=>X.map((J)=>J.type);class r1{elements;rest;isReadonly;annotations;_tag="TupleType";constructor(X,J,Z,Q={}){this.elements=X,this.rest=J,this.isReadonly=Z,this.annotations=Q;let Y=!1,G=!1;for(let K of X)if(K.isOptional)Y=!0;else if(Y){G=!0;break}if(G||Y&&J.length>1)throw Error(jN0)}toString(){return i0(T4(this),()=>L58(this))}toJSON(){return{_tag:this._tag,elements:this.elements.map((X)=>X.toJSON()),rest:this.rest.map((X)=>X.toJSON()),isReadonly:this.isReadonly,annotations:g6(this.annotations)}}}var L58=(X)=>{let J=X.elements.map(String).join(", ");return hJ(X.rest,{onEmpty:()=>`readonly [${J}]`,onNonEmpty:(Z,Q)=>{let Y=String(Z),G=Y.includes(" | ")?`(${Y})`:Y;if(Q.length>0){let K=Q.map(String).join(", ");if(X.elements.length>0)return`readonly [${J}, ...${G}[], ${K}]`;else return`readonly [...${G}[], ${K}]`}else if(X.elements.length>0)return`readonly [${J}, ...${G}[]]`;else return`ReadonlyArray<${Y}>`}})};class aX extends qY{name;isReadonly;constructor(X,J,Z,Q,Y){super(J,Z,Y);this.name=X,this.isReadonly=Q}toString(){return(this.isReadonly?"readonly ":"")+String(this.name)+(this.isOptional?"?":"")+": "+this.type}toJSON(){return{name:String(this.name),type:this.type.toJSON(),isOptional:this.isOptional,isReadonly:this.isReadonly,annotations:g6(this.annotations)}}}var BO0=(X)=>{switch(X._tag){case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":return!0;case"Refinement":return BO0(X.from)}return!1};class a1{type;isReadonly;parameter;constructor(X,J,Z){if(this.type=J,this.isReadonly=Z,BO0(X))this.parameter=X;else throw Error(RN0)}toString(){return(this.isReadonly?"readonly ":"")+`[x: ${this.parameter}]: ${this.type}`}toJSON(){return{parameter:this.parameter.toJSON(),type:this.type.toJSON(),isReadonly:this.isReadonly}}}class eJ{annotations;_tag="TypeLiteral";propertySignatures;indexSignatures;constructor(X,J,Z={}){this.annotations=Z;let Q={};for(let G=0;G<X.length;G++){let K=X[G].name;if(Object.prototype.hasOwnProperty.call(Q,K))throw Error(Fx(K));Q[K]=null}let Y={string:!1,symbol:!1};for(let G=0;G<J.length;G++){let K=BH(J[G].parameter);if(_A(K)){if(Y.string)throw Error(Jo("string"));Y.string=!0}else if(Ix(K)){if(Y.symbol)throw Error(Jo("symbol"));Y.symbol=!0}}this.propertySignatures=X,this.indexSignatures=J}toString(){return i0(T4(this),()=>F58(this))}toJSON(){return{_tag:this._tag,propertySignatures:this.propertySignatures.map((X)=>X.toJSON()),indexSignatures:this.indexSignatures.map((X)=>X.toJSON()),annotations:g6(this.annotations)}}}var IN0=(X)=>X.map(String).join("; "),F58=(X)=>{if(X.propertySignatures.length>0){let J=X.propertySignatures.map(String).join("; ");if(X.indexSignatures.length>0)return`{ ${J}; ${IN0(X.indexSignatures)} }`;else return`{ ${J} }`}else if(X.indexSignatures.length>0)return`{ ${IN0(X.indexSignatures)} }`;else return"{}"},qA=kQ("TypeLiteral"),A58=NZ(HG(tZ,(X)=>{switch(X._tag){case"AnyKeyword":return 0;case"UnknownKeyword":return 1;case"ObjectKeyword":return 2;case"StringKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"SymbolKeyword":return 3}return 4})),T58={string:"StringKeyword",number:"NumberKeyword",boolean:"BooleanKeyword",bigint:"BigIntKeyword"},HO0=(X)=>S6(X,(J)=>DA(J)?HO0(J.types):[J]),M58=(X)=>{let J=A58(X),Z=[],Q={},Y=[];for(let G of J)switch(G._tag){case"NeverKeyword":break;case"AnyKeyword":return[Lo];case"UnknownKeyword":return[wo];case"ObjectKeyword":case"UndefinedKeyword":case"VoidKeyword":case"StringKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"SymbolKeyword":{if(!Q[G._tag])Q[G._tag]=G,Z.push(G);break}case"Literal":{let K=typeof G.literal;switch(K){case"string":case"number":case"bigint":case"boolean":{let B=T58[K];if(!Q[B]&&!Y.includes(G.literal))Y.push(G.literal),Z.push(G);break}case"object":{if(!Y.includes(G.literal))Y.push(G.literal),Z.push(G);break}}break}case"UniqueSymbol":{if(!Q.SymbolKeyword&&!Y.includes(G.symbol))Y.push(G.symbol),Z.push(G);break}case"TupleType":{if(!Q.ObjectKeyword)Z.push(G);break}case"TypeLiteral":{if(G.propertySignatures.length===0&&G.indexSignatures.length===0){if(!Q["{}"])Q["{}"]=G,Z.push(G)}else if(!Q.ObjectKeyword)Z.push(G);break}default:Z.push(G)}return Z};class W6{types;annotations;static make=(X,J)=>{return xx(X)?new W6(X,J):X.length===1?X[0]:FU};static unify=(X,J)=>{return W6.make(M58(HO0(X)),J)};_tag="Union";constructor(X,J={}){this.types=X,this.annotations=J}toString(){return i0(T4(this),()=>this.types.map(String).join(" | "))}toJSON(){return{_tag:this._tag,types:this.types.map((X)=>X.toJSON()),annotations:g6(this.annotations)}}}var WO0=(X,J)=>X.map(J),xx=(X)=>X.length>1,DA=kQ("Union"),Yo=c0(Symbol.for("effect/Schema/AST/toJSONMemoMap"),()=>new WeakMap);class gG{f;annotations;_tag="Suspend";constructor(X,J={}){this.f=X,this.annotations=J,this.f=X_(X)}toString(){return T4(this).pipe(JJ(()=>pX(_B(this.f)(),(X)=>T4(X))),i0(()=>"<suspended schema>"))}toJSON(){let X=this.f(),J=Yo.get(X);if(J)return J;return Yo.set(X,{_tag:this._tag}),J={_tag:this._tag,ast:X.toJSON(),annotations:g6(this.annotations)},Yo.set(X,J),J}}var Mo=kQ("Suspend");class s1{from;filter;annotations;_tag="Refinement";constructor(X,J,Z={}){this.from=X,this.filter=J,this.annotations=Z}toString(){return OA(this).pipe(i0(()=>w0(wO0(this),{onNone:()=>`{ ${this.from} | filter }`,onSome:(X)=>D3(this.from)?String(this.from)+" & "+X:X})))}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),annotations:g6(this.annotations)}}}var D3=kQ("Refinement"),vx={};class CZ{from;to;transformation;annotations;_tag="Transformation";constructor(X,J,Z,Q={}){this.from=X,this.to=J,this.transformation=Z,this.annotations=Q}toString(){return i0(T4(this),()=>`(${String(this.from)} <-> ${String(this.to)})`)}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),to:this.to.toJSON(),annotations:g6(this.annotations)}}}var kx=kQ("Transformation");class bx{decode;encode;_tag="FinalTransformation";constructor(X,J){this.decode=X,this.encode=J}}var P58=(X)=>(J)=>J._tag===X;class VO0{_tag="ComposeTransformation"}var yx=new VO0;class wA{from;to;decode;encode;constructor(X,J,Z,Q){this.from=X,this.to=J,this.decode=Z,this.encode=Q}}var $O0=(X)=>X.decode===t&&X.encode===t;class t1{propertySignatureTransformations;_tag="TypeLiteralTransformation";constructor(X){this.propertySignatureTransformations=X;let J={},Z={};for(let Q of X){let Y=Q.from;if(J[Y])throw Error(Zo(Y));J[Y]=!0;let G=Q.to;if(Z[G])throw Error(Zo(G));Z[G]=!0}}}var LA=P58("TypeLiteralTransformation"),FA=(X,J)=>{let Z=Object.getOwnPropertyDescriptors(X),Q={...X.annotations};delete Q[$A];let Y={...Q,...J},G=M4(X);if(R0(G))Y[UA]=FA(G.value,J);return Z.annotations.value=Y,Object.create(Object.getPrototypeOf(X),Z)},UO0=(X)=>W6.unify(J_(X)),R58="[\\s\\S]*?",j58="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?",zO0=(X,J)=>{switch(X._tag){case"Literal":return YO(String(X.literal));case"StringKeyword":return R58;case"NumberKeyword":return j58;case"TemplateLiteral":return Po(X,J,!1);case"Union":return X.types.map((Z)=>zO0(Z,J)).join("|")}},C58=(X,J,Z,Q)=>{if(DA(X)){if(Z&&!Q)return`(?:${J})`}else if(!Z||!Q)return J;return`(${J})`},Po=(X,J,Z)=>{let Q="";if(X.head!==""){let Y=YO(X.head);Q+=J&&Z?`(${Y})`:Y}for(let Y of X.spans){let G=zO0(Y.type,J);if(Q+=C58(Y.type,G,J,Z),Y.literal!==""){let K=YO(Y.literal);Q+=J&&Z?`(${K})`:K}}return Q},W_=(X)=>new RegExp(`^${Po(X,!1,!0)}$`),NO0=(X)=>new RegExp(`^${Po(X,!0,!0)}$`),Q_=(X)=>{let J=M4(X);if(R0(J))return Q_(J.value);switch(X._tag){case"TypeLiteral":return X.propertySignatures.slice();case"Suspend":return Q_(X.f());case"Refinement":return Q_(X.from)}return i1(X).map((Z)=>KH(X,Z))},KA=(X)=>{let J=M4(X);if(R0(J))return KA(J.value);switch(X._tag){case"TypeLiteral":return X.indexSignatures.slice();case"Suspend":return KA(X.f());case"Refinement":return KA(X.from);case"Transformation":return KA(X.to)}return[]},BA=(X)=>{switch(X._tag){case"TupleType":{let J=!1,Z=[];for(let Q of X.elements){if(Q.isOptional)J=!0;Z.push(Q.type)}if(J)Z.push(LU);return Z=Z.concat(Sx(X.rest)),W6.make(Z)}case"Refinement":return BA(X.from);case"Union":return W6.make(X.types.map(BA));case"Suspend":return BA(X.f())}throw Error(GH(X))},OO0=(X,J)=>{let Z=EK(X.propertySignatures,(Q)=>Q.name===J);if(R0(Z))return Z.value;if(n9(J)){let Q=void 0;for(let Y of X.indexSignatures){let G=BH(Y.parameter);switch(G._tag){case"TemplateLiteral":{if(W_(G).test(J))return new aX(J,Y.type,!1,!0);break}case"StringKeyword":if(Q===void 0)Q=new aX(J,Y.type,!1,!0)}}if(Q)return Q}else if(f5(J))for(let Q of X.indexSignatures){let Y=BH(Q.parameter);if(Ix(Y))return new aX(J,Q.type,!1,!0)}},KH=(X,J)=>{let Z=M4(X);if(R0(Z))return KH(Z.value,J);switch(X._tag){case"TypeLiteral":{let Q=OO0(X,J);if(Q)return Q;break}case"Union":return new aX(J,W6.make(X.types.map((Q)=>KH(Q,J).type)),!1,!0);case"Suspend":return KH(X.f(),J);case"Refinement":return KH(X.from,J);case"Transformation":return KH(X.to,J)}throw Error(GH(X))},i1=(X)=>{let J=M4(X);if(R0(J))return i1(J.value);switch(X._tag){case"TypeLiteral":return X.propertySignatures.map((Z)=>Z.name);case"Union":return X.types.slice(1).reduce((Z,Q)=>Dw(Z,i1(Q)),i1(X.types[0]));case"Suspend":return i1(X.f());case"Refinement":return i1(X.from);case"Transformation":return i1(X.to)}return[]},Ro=(X,J)=>{let Z=[],Q=[],Y=(G)=>{switch(G._tag){case"NeverKeyword":break;case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":case"Refinement":Q.push(new a1(G,J,!0));break;case"Literal":if(n9(G.literal)||e7(G.literal))Z.push(new aX(G.literal,J,!1,!0));else throw Error(PN0(G.literal));break;case"Enums":{for(let[K,B]of G.enums)Z.push(new aX(B,J,!1,!0));break}case"UniqueSymbol":Z.push(new aX(G.symbol,J,!1,!0));break;case"Union":G.types.forEach(Y);break;default:throw Error(MN0(G))}};return Y(X),{propertySignatures:Z,indexSignatures:Q}},yG=(X,J)=>{let Z=M4(X);if(R0(Z))return yG(Z.value,J);switch(X._tag){case"TypeLiteral":{let Q=[],Y={};for(let G of X.propertySignatures)if(Y[G.name]=null,J.includes(G.name))Q.push(G);for(let G of J)if(!(G in Y)){let K=OO0(X,G);if(K)Q.push(K)}return new eJ(Q,[])}case"Union":return new eJ(J.map((Q)=>KH(X,Q)),[]);case"Suspend":return yG(X.f(),J);case"Refinement":return yG(X.from,J);case"Transformation":switch(X.transformation._tag){case"ComposeTransformation":return new CZ(yG(X.from,J),yG(X.to,J),yx);case"TypeLiteralTransformation":{let Q=[],Y=[];for(let G of J){let K=X.transformation.propertySignatureTransformations.find((B)=>B.to===G);if(K)Q.push(K),Y.push(K.from);else Y.push(G)}return B8(Q)?new CZ(yG(X.from,Y),yG(X.to,J),new t1(Q)):yG(X.from,Y)}}}throw Error(GH(X))},_O0=(X,J)=>{let Z=KA(X);if(Z.length>0){if(Z.some((Q)=>_A(BH(Q.parameter))))Z=Z.filter((Q)=>!KO0(BH(Q.parameter)));return new eJ([],Z)}return yG(X,i1(X).filter((Q)=>!J.includes(Q)))},HA=(X)=>W6.make([X,LU]),DU=(X,J)=>{let Z=J?.exact===!0;switch(X._tag){case"TupleType":return new r1(X.elements.map((Q)=>new qY(Z?Q.type:HA(Q.type),!0)),l6(X.rest,{onEmpty:()=>X.rest,onNonEmpty:(Q)=>[new TU(W6.make([...Sx(Q),LU]))]}),X.isReadonly);case"TypeLiteral":return new eJ(X.propertySignatures.map((Q)=>new aX(Q.name,Z?Q.type:HA(Q.type),!0,Q.isReadonly,Q.annotations)),X.indexSignatures.map((Q)=>new a1(Q.parameter,HA(Q.type),Q.isReadonly)));case"Union":return W6.make(X.types.map((Q)=>DU(Q,J)));case"Suspend":return new gG(()=>DU(X.f(),J));case"Declaration":case"Refinement":throw Error(GH(X));case"Transformation":{if(LA(X.transformation)&&X.transformation.propertySignatureTransformations.every($O0))return new CZ(DU(X.from,J),DU(X.to,J),X.transformation);throw Error(GH(X))}}return X},Z_=(X)=>{switch(X._tag){case"TupleType":return new r1(X.elements.map((J)=>new qY(J.type,!1)),X.rest,X.isReadonly);case"TypeLiteral":return new eJ(X.propertySignatures.map((J)=>new aX(J.name,J.type,!1,J.isReadonly,J.annotations)),X.indexSignatures);case"Union":return W6.make(X.types.map((J)=>Z_(J)));case"Suspend":return new gG(()=>Z_(X.f()));case"Declaration":case"Refinement":throw Error(GH(X));case"Transformation":{if(LA(X.transformation)&&X.transformation.propertySignatureTransformations.every($O0))return new CZ(Z_(X.from),Z_(X.to),X.transformation);throw Error(GH(X))}}return X},qU=(X)=>{switch(X._tag){case"TupleType":return X.isReadonly===!1?X:new r1(X.elements,X.rest,!1,X.annotations);case"TypeLiteral":{let J=vQ(X.propertySignatures,(Q)=>Q.isReadonly===!1?Q:new aX(Q.name,Q.type,Q.isOptional,!1,Q.annotations)),Z=vQ(X.indexSignatures,(Q)=>Q.isReadonly===!1?Q:new a1(Q.parameter,Q.type,!1));return J===X.propertySignatures&&Z===X.indexSignatures?X:new eJ(J,Z,X.annotations)}case"Union":{let J=vQ(X.types,qU);return J===X.types?X:W6.make(J,X.annotations)}case"Suspend":return new gG(()=>qU(X.f()),X.annotations);case"Refinement":{let J=qU(X.from);return J===X.from?X:new s1(J,X.filter,X.annotations)}case"Transformation":{let J=qU(X.from),Z=qU(X.to);return J===X.from&&Z===X.to?X:new CZ(J,Z,X.transformation,X.annotations)}}return X};var jo=(X)=>(J)=>{let Z=void 0;for(let Q of X)if(Object.prototype.hasOwnProperty.call(J.annotations,Q)){if(Z===void 0)Z={};Z[Q]=J.annotations[Q]}return Z},qO0=(X)=>(J)=>{let Z={...J.annotations};for(let Q of X)delete Z[Q];return Z},I58=jo([Tx,Mx,Px,Bo,Ho,Rx]),PX=(X)=>{switch(X._tag){case"Declaration":{let J=vQ(X.typeParameters,PX);return J===X.typeParameters?X:new Y_(J,X.decodeUnknown,X.encodeUnknown,X.annotations)}case"TupleType":{let J=vQ(X.elements,(Y)=>{let G=PX(Y.type);return G===Y.type?Y:new qY(G,Y.isOptional)}),Z=Sx(X.rest),Q=vQ(Z,PX);return J===X.elements&&Q===Z?X:new r1(J,Q.map((Y)=>new TU(Y)),X.isReadonly,X.annotations)}case"TypeLiteral":{let J=vQ(X.propertySignatures,(Q)=>{let Y=PX(Q.type);return Y===Q.type?Q:new aX(Q.name,Y,Q.isOptional,Q.isReadonly)}),Z=vQ(X.indexSignatures,(Q)=>{let Y=PX(Q.type);return Y===Q.type?Q:new a1(Q.parameter,Y,Q.isReadonly)});return J===X.propertySignatures&&Z===X.indexSignatures?X:new eJ(J,Z,X.annotations)}case"Union":{let J=vQ(X.types,PX);return J===X.types?X:W6.make(J,X.annotations)}case"Suspend":return new gG(()=>PX(X.f()),X.annotations);case"Refinement":{let J=PX(X.from);return J===X.from?X:new s1(J,X.filter,X.annotations)}case"Transformation":{let J=I58(X);return PX(J!==void 0?FA(X.to,J):X.to)}}return X};function vQ(X,J){let Z=!1,Q=CK(X.length);for(let Y=0;Y<X.length;Y++){let G=X[Y],K=J(G);if(K!==G)Z=!0;Q[Y]=K}return Z?Q:X}var VA=(X)=>{switch(X._tag){case"Transformation":return X.from;case"Refinement":return VA(X.from);case"Suspend":return VA(X.f())}},bG=(X,J)=>{switch(X._tag){case"Declaration":{let Z=vQ(X.typeParameters,(Q)=>bG(Q,J));return Z===X.typeParameters?X:new Y_(Z,X.decodeUnknown,X.encodeUnknown)}case"TupleType":{let Z=vQ(X.elements,(G)=>{let K=bG(G.type,J);return K===G.type?G:new qY(K,G.isOptional)}),Q=Sx(X.rest),Y=vQ(Q,(G)=>bG(G,J));return Z===X.elements&&Y===Q?X:new r1(Z,Y.map((G)=>new TU(G)),X.isReadonly)}case"TypeLiteral":{let Z=vQ(X.propertySignatures,(Y)=>{let G=bG(Y.type,J);return G===Y.type?Y:new aX(Y.name,G,Y.isOptional,Y.isReadonly)}),Q=vQ(X.indexSignatures,(Y)=>{let G=bG(Y.type,J);return G===Y.type?Y:new a1(Y.parameter,G,Y.isReadonly)});return Z===X.propertySignatures&&Q===X.indexSignatures?X:new eJ(Z,Q)}case"Union":{let Z=vQ(X.types,(Q)=>bG(Q,J));return Z===X.types?X:W6.make(Z)}case"Suspend":{let Z=void 0,Q=Do(X);if(R0(Q)){let Y=J?"Bound":"";Z={[jx]:`${Q.value}Encoded${Y}`}}return new gG(()=>bG(X.f(),J),Z)}case"Refinement":{let Z=bG(X.from,J);if(J){if(Z===X.from)return X;if(VA(X.from)===void 0&&qo(X))return new s1(Z,X.filter,X.annotations);return Z}else return Z}case"Transformation":return bG(X.from,J)}return X},AA=(X)=>bG(X,!1),DO0=(X)=>bG(X,!0),g6=(X)=>{let J={};for(let Z of Object.getOwnPropertySymbols(X))J[String(Z)]=X[Z];return J},BH=(X)=>{switch(X._tag){case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":return X;case"Refinement":return BH(X.from)}},Co=(X,J)=>{switch(X._tag){case"Literal":return q3(J)&&J.literal===X.literal;case"UniqueSymbol":return O58(J)&&J.symbol===X.symbol;case"UndefinedKeyword":case"VoidKeyword":case"NeverKeyword":case"UnknownKeyword":case"AnyKeyword":case"StringKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"SymbolKeyword":case"ObjectKeyword":return J._tag===X._tag;case"TemplateLiteral":return KO0(J)&&J.head===X.head&&E58(J.spans,X.spans);case"Enums":return q58(J)&&S58(J.enums,X.enums);case"Union":return DA(J)&&x58(X.types,J.types);case"Refinement":case"TupleType":case"TypeLiteral":case"Suspend":case"Transformation":case"Declaration":return X===J}},E58=dJ((X,J)=>{return X.literal===J.literal&&Co(X.type,J.type)}),S58=dJ((X,J)=>J[0]===X[0]&&J[1]===X[1]),x58=dJ(Co),v58=Sj(Co),J_=(X)=>{switch(X._tag){case"Declaration":{let J=M4(X);if(R0(J))return J_(J.value);break}case"TypeLiteral":return X.propertySignatures.map((J)=>f5(J.name)?new G_(J.name):new _3(J.name)).concat(X.indexSignatures.map((J)=>BH(J.parameter)));case"Suspend":return J_(X.f());case"Union":return X.types.slice(1).reduce((J,Z)=>v58(J,J_(Z)),J_(X.types[0]));case"Transformation":return J_(X.to)}throw Error(GH(X))},Io=(X,J)=>new CZ(X,J,yx),WA=(X,J)=>{switch(X._tag){case"TypeLiteral":{let Z=[];for(let Q of Reflect.ownKeys(J)){let Y=J[Q];if(Y!==void 0)Z.push(new wA(Q,Y,t,t))}if(Z.length===0)return X;return new CZ(X,new eJ(X.propertySignatures.map((Q)=>{let Y=J[Q.name];return new aX(Y===void 0?Q.name:Y,PX(Q.type),Q.isOptional,Q.isReadonly,Q.annotations)}),X.indexSignatures),new t1(Z))}case"Union":return W6.make(X.types.map((Z)=>WA(Z,J)));case"Suspend":return new gG(()=>WA(X.f(),J));case"Transformation":return Io(X,WA(PX(X),J))}throw Error(CN0(X))},hG=(X)=>i0(T4(X),()=>X._tag);function k58(X){return w0(No(X),{onNone:()=>"",onSome:(J)=>J.map((Z)=>` & Brand<${E6(Z)}>`).join("")})}var wO0=(X)=>NA(X).pipe(JJ(()=>HH(X)),JJ(()=>Oo(X)),r8((J)=>J+k58(X))),T4=(X)=>JJ(OA(X),()=>wO0(X)),gx=(X,J,Z)=>{switch(X._tag){case"UndefinedKeyword":return FU;case"Union":{let Q=[],Y=!1;for(let G of X.types){let K=J(G);if(K){if(Y=!0,!_58(K))Q.push(K)}else Q.push(G)}if(Y)return W6.make(Q);break}case"Suspend":return J(X.f());case"Transformation":return Z(X)}};class RJ{path;actual;issue;_tag="Pointer";constructor(X,J,Z){this.path=X,this.actual=J,this.issue=Z}}class xo{actual;message;_tag="Unexpected";constructor(X,J){this.actual=X,this.message=J}}class $_{ast;message;_tag="Missing";actual=void 0;constructor(X,J){this.ast=X,this.message=J}}class s6{ast;actual;issues;output;_tag="Composite";constructor(X,J,Z,Q){this.ast=X,this.actual=J,this.issues=Z,this.output=Q}}class mx{ast;actual;kind;issue;_tag="Refinement";constructor(X,J,Z,Q){this.ast=X,this.actual=J,this.kind=Z,this.issue=Q}}class dx{ast;actual;kind;issue;_tag="Transformation";constructor(X,J,Z,Q){this.ast=X,this.actual=J,this.kind=Z,this.issue=Q}}class a8{ast;actual;message;_tag="Type";constructor(X,J,Z){this.ast=X,this.actual=J,this.message=Z}}class vo{ast;actual;message;_tag="Forbidden";constructor(X,J,Z){this.ast=X,this.actual=J,this.message=Z}}var ko=Symbol.for("effect/Schema/ParseErrorTypeId"),ux=(X)=>V0(X,ko);class AO0 extends xF("ParseError"){[ko]=ko;get message(){return this.toString()}toString(){return D5.formatIssueSync(this.issue)}toJSON(){return{_id:"ParseError",message:this.toString()}}[$8](){return this.toJSON()}}var WH=(X)=>new AO0({issue:X}),YX=O0,h6=M0,N_=y2;var RA=Ww,YQ=TK,q5=$(2,(X,J)=>{return YQ(X)?w9(X,{onLeft:M0,onRight:J}):h(X,J)}),XZ=$(2,(X,J)=>{return YQ(X)?fY(X,J):u(X,J)}),PU=$(2,(X,J)=>{return YQ(X)?eQ(X,J):E9(X,J)});var TO0=$(2,(X,J)=>{return YQ(X)?Uc(X,{onLeft:J.onFailure,onRight:J.onSuccess}):vG(X,J)}),MO0=$(2,(X,J)=>{return YQ(X)?w9(X,{onLeft:J,onRight:O0}):y6(X,J)}),jA=(X,J)=>{if(J===void 0||e7(J))return X;if(X===void 0)return J;return{...X,...J}},CA=(X,J,Z)=>{let Q=jJ(X,J);return(Y,G)=>Q(Y,jA(Z,G))},yo=(X,J,Z)=>{let Q=CA(X,J,Z);return(Y,G)=>Vw(Q(Y,G),WH)},O_=(X,J,Z)=>{let Q=CA(X,J,Z);return(Y,G)=>Fj(Q(Y,G))},go=(X,J,Z)=>{let Q=jJ(X,J);return(Y,G)=>Q(Y,{...jA(Z,G),isEffectAllowed:!0})},ho=(X,J)=>yo(X.ast,!0,J),mo=(X,J)=>O_(X.ast,!0,J),uo=(X,J)=>CA(X.ast,!0,J);var W7=(X,J)=>go(X.ast,!0,J),co=(X,J)=>yo(X.ast,!1,J),fo=(X,J)=>O_(X.ast,!1,J),PO0=(X,J)=>CA(X.ast,!1,J);var I7=(X,J)=>go(X.ast,!1,J),__=ho,RO0=mo;var cx=W7,RU=(X,J)=>yo(PX(X.ast),!0,J),jO0=(X,J)=>O_(PX(X.ast),!0,J),CO0=(X,J)=>CA(PX(X.ast),!0,J);var IO0=(X,J)=>go(PX(X.ast),!0,J),XW=(X,J)=>{let Z=jJ(PX(X.ast),!0);return(Q,Y)=>NJ(Z(Q,{exact:!0,...jA(J,Y)}))},EO0=(X,J)=>{let Z=jJ(PX(X.ast),!0);return(Q,Y)=>{let G=Z(Q,{exact:!0,...jA(J,Y)});if(U9(G))throw WH(G.left)}},JW=co,SO0=fo;var b58=c0(Symbol.for("effect/ParseResult/decodeMemoMap"),()=>new WeakMap),y58=c0(Symbol.for("effect/ParseResult/encodeMemoMap"),()=>new WeakMap),jJ=(X,J)=>{let Z=J?b58:y58,Q=Z.get(X);if(Q)return Q;let Y=g58(X,J),G=mN0(X),K=R0(G)?(W,V)=>Y(W,jA(V,G.value)):Y,B=dN0(X),H=J&&R0(B)?(W,V)=>MA(MO0(K(W,V),B.value),X,W,V):K;return Z.set(X,H),H},Eo=(X)=>u9(yN0(X)),So=(X)=>u9(gN0(X)),g58=(X,J)=>{switch(X._tag){case"Refinement":if(J){let Z=jJ(X.from,!0);return(Q,Y)=>{Y=Y??vx;let G=Y?.errors==="all",K=q5(MO0(Z(Q,Y),(B)=>{let H=new mx(X,Q,"From",B);if(G&&qo(X)&&bO0(B))return w0(X.filter(Q,Y,X),{onNone:()=>M0(H),onSome:(W)=>M0(new s6(X,Q,[H,new mx(X,Q,"Predicate",W)]))});return M0(H)}),(B)=>w0(X.filter(B,Y,X),{onNone:()=>O0(B),onSome:(H)=>M0(new mx(X,Q,"Predicate",H))}));return MA(K,X,Q,Y)}}else{let Z=jJ(PX(X),!0),Q=jJ(xO0(X.from),!1);return(Y,G)=>MA(q5(Z(Y,G),(K)=>Q(K,G)),X,Y,G)}case"Transformation":{let Z=m58(X.transformation,J),Q=J?jJ(X.from,!0):jJ(X.to,!1),Y=J?jJ(X.to,!0):jJ(X.from,!1);return(G,K)=>MA(q5(PU(Q(G,K),(B)=>new dx(X,G,J?"Encoded":"Type",B)),(B)=>q5(PU(Z(B,K??vx,X,G),(H)=>new dx(X,G,"Transformation",H)),(H)=>PU(Y(H,K),(W)=>new dx(X,G,J?"Type":"Encoded",W)))),X,G,K)}case"Declaration":{let Z=J?X.decodeUnknown(...X.typeParameters):X.encodeUnknown(...X.typeParameters);return(Q,Y)=>MA(Z(Q,Y??vx,X),X,Q,Y)}case"Literal":return _5(X,(Z)=>Z===X.literal);case"UniqueSymbol":return _5(X,(Z)=>Z===X.symbol);case"UndefinedKeyword":return _5(X,gV);case"NeverKeyword":return _5(X,mQ0);case"UnknownKeyword":case"AnyKeyword":case"VoidKeyword":return O0;case"StringKeyword":return _5(X,n9);case"NumberKeyword":return _5(X,e7);case"BooleanKeyword":return _5(X,yJ);case"BigIntKeyword":return _5(X,DK);case"SymbolKeyword":return _5(X,f5);case"ObjectKeyword":return _5(X,c6);case"Enums":return _5(X,(Z)=>X.enums.some(([Q,Y])=>Y===Z));case"TemplateLiteral":{let Z=W_(X);return _5(X,(Q)=>n9(Q)&&Z.test(Q))}case"TupleType":{let Z=X.elements.map((W)=>jJ(W.type,J)),Q=X.rest.map((W)=>jJ(W.type,J)),Y=X.elements.filter((W)=>!W.isOptional);if(X.rest.length>0)Y=Y.concat(X.rest.slice(1));let G=Y.length,K=X.elements.length>0?X.elements.map((W,V)=>V).join(" | "):"never",B=Eo(X),H=So(X);return(W,V)=>{if(!IK(W))return M0(new a8(X,W));let U=V?.errors==="all",O=[],q=0,L=[],A=W.length;for(let T=A;T<=G-1;T++){let E=new RJ(T,W,new $_(Y[T-A]));if(U){O.push([q++,E]);continue}else return M0(new s6(X,W,E,L))}if(X.rest.length===0)for(let T=X.elements.length;T<=A-1;T++){let E=new RJ(T,W,new xo(W[T],`is unexpected, expected: ${K}`));if(U){O.push([q++,E]);continue}else return M0(new s6(X,W,E,L))}let M=0,x=void 0;for(;M<Z.length;M++)if(A<M+1){if(X.elements[M].isOptional)continue}else{let T=Z[M],E=T(W[M],V);if(YQ(E)){if(U9(E)){let k=new RJ(M,W,E.left);if(U){O.push([q++,k]);continue}else return M0(new s6(X,W,k,mG(L)))}L.push([q++,E.right])}else{let k=q++,P=M;if(!x)x=[];x.push(({es:C,output:v})=>h(l1(E),(f)=>{if(U9(f)){let s=new RJ(P,W,f.left);if(U)return C.push([k,s]),U0;else return M0(new s6(X,W,s,mG(v)))}return v.push([k,f.right]),U0}))}}if(B8(Q)){let[T,...E]=Q;for(;M<A-E.length;M++){let k=T(W[M],V);if(YQ(k))if(U9(k)){let P=new RJ(M,W,k.left);if(U){O.push([q++,P]);continue}else return M0(new s6(X,W,P,mG(L)))}else L.push([q++,k.right]);else{let P=q++,C=M;if(!x)x=[];x.push(({es:v,output:f})=>h(l1(k),(s)=>{if(U9(s)){let l=new RJ(C,W,s.left);if(U)return v.push([P,l]),U0;else return M0(new s6(X,W,l,mG(f)))}else return f.push([P,s.right]),U0}))}}for(let k=0;k<E.length;k++){let P=M+k;if(A<P+1)continue;else{let C=E[k](W[P],V);if(YQ(C)){if(U9(C)){let v=new RJ(P,W,C.left);if(U){O.push([q++,v]);continue}else return M0(new s6(X,W,v,mG(L)))}L.push([q++,C.right])}else{let v=q++;if(!x)x=[];x.push(({es:f,output:s})=>h(l1(C),(l)=>{if(U9(l)){let W0=new RJ(P,W,l.left);if(U)return f.push([v,W0]),U0;else return M0(new s6(X,W,W0,mG(s)))}return s.push([v,l.right]),U0}))}}}}let j=({es:T,output:E})=>i5(T)?M0(new s6(X,W,mG(T),mG(E))):O0(mG(E));if(x&&x.length>0){let T=x;return o0(()=>{let E={es:d2(O),output:d2(L)};return h(a9(T,(k)=>k(E),{concurrency:B,batching:H,discard:!0}),()=>j(E))})}return j({output:L,es:O})}}case"TypeLiteral":{if(X.propertySignatures.length===0&&X.indexSignatures.length===0)return _5(X,dQ0);let Z=[],Q={},Y=[];for(let V of X.propertySignatures)Z.push([jJ(V.type,J),V]),Q[V.name]=null,Y.push(V.name);let G=X.indexSignatures.map((V)=>[jJ(V.parameter,J),jJ(V.type,J),V.parameter]),K=W6.make(X.indexSignatures.map((V)=>V.parameter).concat(Y.map((V)=>f5(V)?new G_(V):new _3(V)))),B=jJ(K,J),H=Eo(X),W=So(X);return(V,U)=>{if(!l5(V))return M0(new a8(X,V));let O=U?.errors==="all",q=[],L=0,A=U?.onExcessProperty==="error",M=U?.onExcessProperty==="preserve",x={},j;if(A||M){j=Reflect.ownKeys(V);for(let P of j){let C=B(P,U);if(YQ(C)&&U9(C))if(A){let v=new RJ(P,V,new xo(V[P],`is unexpected, expected: ${String(K)}`));if(O){q.push([L++,v]);continue}else return M0(new s6(X,V,v,x))}else x[P]=V[P]}}let T=void 0,E=U?.exact===!0;for(let P=0;P<Z.length;P++){let C=Z[P][1],v=C.name,f=Object.prototype.hasOwnProperty.call(V,v);if(!f){if(C.isOptional)continue;else if(E){let W0=new RJ(v,V,new $_(C));if(O){q.push([L++,W0]);continue}else return M0(new s6(X,V,W0,x))}}let s=Z[P][0],l=s(V[v],U);if(YQ(l)){if(U9(l)){let W0=new RJ(v,V,f?l.left:new $_(C));if(O){q.push([L++,W0]);continue}else return M0(new s6(X,V,W0,x))}x[v]=l.right}else{let W0=L++,b=v;if(!T)T=[];T.push(({es:a,output:n})=>h(l1(l),(r)=>{if(U9(r)){let J0=new RJ(b,V,f?r.left:new $_(C));if(O)return a.push([W0,J0]),U0;else return M0(new s6(X,V,J0,n))}return n[b]=r.right,U0}))}}for(let P=0;P<G.length;P++){let C=G[P],v=C[0],f=C[1],s=si(V,C[2]);for(let l of s){let W0=v(l,U);if(YQ(W0)&&NJ(W0)){let b=f(V[l],U);if(YQ(b)){if(U9(b)){let a=new RJ(l,V,b.left);if(O){q.push([L++,a]);continue}else return M0(new s6(X,V,a,x))}else if(!Object.prototype.hasOwnProperty.call(Q,l))x[l]=b.right}else{let a=L++,n=l;if(!T)T=[];T.push(({es:r,output:J0})=>h(l1(b),(F0)=>{if(U9(F0)){let Z8=new RJ(n,V,F0.left);if(O)return r.push([a,Z8]),U0;else return M0(new s6(X,V,Z8,J0))}else{if(!Object.prototype.hasOwnProperty.call(Q,l))J0[l]=F0.right;return U0}}))}}}}let k=({es:P,output:C})=>{if(i5(P))return M0(new s6(X,V,mG(P),C));if(U?.propertyOrder==="original"){let v=j||Reflect.ownKeys(V);for(let s of Y)if(v.indexOf(s)===-1)v.push(s);let f={};for(let s of v)if(Object.prototype.hasOwnProperty.call(C,s))f[s]=C[s];return O0(f)}return O0(C)};if(T&&T.length>0){let P=T;return o0(()=>{let C={es:d2(q),output:Object.assign({},x)};return h(a9(P,(v)=>v(C),{concurrency:H,batching:W,discard:!0}),()=>k(C))})}return k({es:q,output:x})}}case"Union":{let Z=po(X.types,J),Q=Reflect.ownKeys(Z.keys),Y=Q.length,G=X.types.length,K=new Map;for(let W=0;W<G;W++)K.set(X.types[W],jJ(X.types[W],J));let B=Eo(X)??1,H=So(X);return(W,V)=>{let U=[],O=0,q=[];if(Y>0)if(KN(W))for(let M=0;M<Y;M++){let x=Q[M],j=Z.keys[x].buckets;if(Object.prototype.hasOwnProperty.call(W,x)){let T=String(W[x]);if(Object.prototype.hasOwnProperty.call(j,T))q=q.concat(j[T]);else{let{candidates:E,literals:k}=Z.keys[x],P=W6.make(k),C=E.length===G?new eJ([new aX(x,P,!1,!0)],[]):W6.make(E);U.push([O++,new s6(C,W,new RJ(x,W,new a8(P,W[x])))])}}else{let{candidates:T,literals:E}=Z.keys[x],k=new aX(x,W6.make(E),!1,!0),P=T.length===G?new eJ([k],[]):W6.make(T);U.push([O++,new s6(P,W,new RJ(x,W,new $_(k)))])}}else{let M=Z.candidates.length===G?X:W6.make(Z.candidates);U.push([O++,new a8(M,W)])}if(Z.otherwise.length>0)q=q.concat(Z.otherwise);let L=void 0;for(let M=0;M<q.length;M++){let x=q[M],j=K.get(x)(W,V);if(YQ(j)&&(!L||L.length===0))if(NJ(j))return j;else U.push([O++,j.left]);else{let T=O++;if(!L)L=[];L.push((E)=>o0(()=>{if("finalResult"in E)return U0;else return h(l1(j),(k)=>{if(NJ(k))E.finalResult=k;else E.es.push([T,k.left]);return U0})}))}}let A=(M)=>i5(M)?M.length===1&&M[0][1]._tag==="Type"?M0(M[0][1]):M0(new s6(X,W,mG(M))):M0(new a8(X,W));if(L&&L.length>0){let M=L;return o0(()=>{let x={es:d2(U)};return h(a9(M,(j)=>j(x),{concurrency:B,batching:H,discard:!0}),()=>{if("finalResult"in x)return x.finalResult;return A(x.es)})})}return A(U)}}case"Suspend":{let Z=X_(()=>jJ(X.f(),J));return(Q,Y)=>Z()(Q,Y)}}},_5=(X,J)=>(Z)=>J(Z)?O0(Z):M0(new a8(X,Z)),TA=(X,J)=>{switch(X._tag){case"Declaration":{let Z=M4(X);if(R0(Z))return TA(Z.value,J);break}case"TypeLiteral":{let Z=[];for(let Q=0;Q<X.propertySignatures.length;Q++){let Y=X.propertySignatures[Q],G=J?AA(Y.type):PX(Y.type);if(q3(G)&&!Y.isOptional)Z.push([Y.name,G])}return Z}case"TupleType":{let Z=[];for(let Q=0;Q<X.elements.length;Q++){let Y=X.elements[Q],G=J?AA(Y.type):PX(Y.type);if(q3(G)&&!Y.isOptional)Z.push([Q,G])}return Z}case"Refinement":return TA(X.from,J);case"Suspend":return TA(X.f(),J);case"Transformation":return TA(J?X.from:X.to,J)}return[]},po=(X,J)=>{let Z={},Q=[],Y=[];for(let G=0;G<X.length;G++){let K=X[G],B=TA(K,J);if(B.length>0){Y.push(K);for(let H=0;H<B.length;H++){let[W,V]=B[H],U=String(V.literal);Z[W]=Z[W]||{buckets:{},literals:[],candidates:[]};let O=Z[W].buckets;if(Object.prototype.hasOwnProperty.call(O,U)){if(H<B.length-1)continue;O[U].push(K),Z[W].literals.push(V),Z[W].candidates.push(K)}else{O[U]=[K],Z[W].literals.push(V),Z[W].candidates.push(K);break}}}else Q.push(K)}return{keys:Z,otherwise:Q,candidates:Y}},xO0=(X)=>D3(X)?xO0(X.from):X,MA=(X,J,Z,Q)=>{if(Q?.isEffectAllowed===!0)return X;if(YQ(X))return X;let Y=new m$,G=NY(X,{scheduler:Y});Y.flush();let K=G.unsafePoll();if(K){if(CQ(K))return O0(K.value);let B=K.cause;if(Gn(B))return M0(B.error);return M0(new vo(J,Z,CO(B)))}return M0(new vo(J,Z,"cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work"))},h58=([X],[J])=>X>J?1:X<J?-1:0;function mG(X){return X.sort(h58).map((J)=>J[1])}var m58=(X,J)=>{switch(X._tag){case"FinalTransformation":return J?X.decode:X.encode;case"ComposeTransformation":return O0;case"TypeLiteralTransformation":return(Z)=>{let Q=O0(Z);for(let Y of X.propertySignatureTransformations){let[G,K]=J?[Y.from,Y.to]:[Y.to,Y.from],B=J?Y.decode:Y.encode;Q=XZ(Q,(W)=>{let V=B(Object.prototype.hasOwnProperty.call(W,G)?I(W[G]):S());if(delete W[G],R0(V))W[K]=V.value;return W})}return Q}}},bQ=(X,J=[])=>({value:X,forest:J}),D5={formatIssue:(X)=>XZ(U_(X),d58),formatIssueSync:(X)=>{let J=D5.formatIssue(X);return YQ(J)?wj(J):j9(J)},formatError:(X)=>D5.formatIssue(X.issue),formatErrorSync:(X)=>D5.formatIssueSync(X.issue)},d58=(X)=>X.value+vO0(`
185
+ `,X.forest),vO0=(X,J)=>{let Z="",Q=J.length,Y;for(let G=0;G<Q;G++){Y=J[G];let K=G===Q-1;Z+=X+(K?"└":"├")+"─ "+Y.value,Z+=vO0(X+(Q>1&&!K?"│ ":" "),Y.forest)}return Z},u58=(X)=>{switch(X){case"Encoded":return"Encoded side transformation failure";case"Transformation":return"Transformation process failure";case"Type":return"Type side transformation failure"}},c58=(X)=>{switch(X){case"From":return"From side refinement failure";case"Predicate":return"Predicate refinement failure"}},kO0=(X)=>("ast"in X)?I(X.ast):S(),bo=O0(void 0),f58=(X)=>kO0(X).pipe(pX(xN0),w0({onNone:()=>bo,onSome:(J)=>{let Z=J(X);if(n9(Z))return O0({message:Z,override:!1});if(VX(Z))return u(Z,(Q)=>({message:Q,override:!1}));if(n9(Z.message))return O0({message:Z.message,override:Z.override});return u(Z.message,(Q)=>({message:Q,override:Z.override}))}})),lo=(X)=>(J)=>J._tag===X,bO0=lo("Composite"),LO0=lo("Refinement"),FO0=lo("Transformation"),e1=(X)=>q5(f58(X),(J)=>{if(J!==void 0)return!J.override&&(bO0(X)||LO0(X)&&X.kind==="From"||FO0(X)&&X.kind!=="Transformation")?FO0(X)||LO0(X)?e1(X.issue):bo:O0(J.message);return bo}),yO0=(X)=>kO0(X).pipe(pX(hN0),qc((J)=>J(X)),u9);function p58(X){return HH(X).pipe(JJ(()=>NA(X)),JJ(()=>Oo(X)),JJ(()=>OA(X)),i0(()=>`{ ${X.from} | filter }`))}function l58(X){if(X.message!==void 0)return X.message;return`Expected ${D3(X.ast)?p58(X.ast):String(X.ast)}, actual ${E6(X.actual)}`}var gO0=(X)=>XZ(e1(X),(J)=>J??yO0(X)??l58(X)),hx=(X)=>yO0(X)??String(X.ast),hO0=(X)=>X.message??"is forbidden",mO0=(X)=>X.message??"is unexpected",dO0=(X)=>{let J=vN0(X.ast);if(R0(J)){let Z=J.value();return n9(Z)?O0(Z):Z}return O0(X.message??"is missing")},U_=(X)=>{switch(X._tag){case"Type":return XZ(gO0(X),bQ);case"Forbidden":return O0(bQ(hx(X),[bQ(hO0(X))]));case"Unexpected":return O0(bQ(mO0(X)));case"Missing":return XZ(dO0(X),bQ);case"Transformation":return q5(e1(X),(J)=>{if(J!==void 0)return O0(bQ(J));return XZ(U_(X.issue),(Z)=>bQ(hx(X),[bQ(u58(X.kind),[Z])]))});case"Refinement":return q5(e1(X),(J)=>{if(J!==void 0)return O0(bQ(J));return XZ(U_(X.issue),(Z)=>bQ(hx(X),[bQ(c58(X.kind),[Z])]))});case"Pointer":return XZ(U_(X.issue),(J)=>bQ(Dx(X.path),[J]));case"Composite":return q5(e1(X),(J)=>{if(J!==void 0)return O0(bQ(J));let Z=hx(X);return qx(X.issues)?XZ(a9(X.issues,U_),(Q)=>bQ(Z,Q)):XZ(U_(X.issues),(Q)=>bQ(Z,[Q]))})}},MU=(X,J,Z)=>({_tag:X,path:J,message:Z}),PA={formatIssue:(X)=>z_(X,void 0,[]),formatIssueSync:(X)=>{let J=PA.formatIssue(X);return YQ(J)?wj(J):j9(J)},formatError:(X)=>PA.formatIssue(X.issue),formatErrorSync:(X)=>PA.formatIssueSync(X.issue)},z_=(X,J,Z)=>{let Q=X._tag;switch(Q){case"Type":return XZ(gO0(X),(Y)=>[MU(J??Q,Z,Y)]);case"Forbidden":return O0([MU(Q,Z,hO0(X))]);case"Unexpected":return O0([MU(Q,Z,mO0(X))]);case"Missing":return XZ(dO0(X),(Y)=>[MU(Q,Z,Y)]);case"Pointer":return z_(X.issue,void 0,Z.concat(X.path));case"Composite":return q5(e1(X),(Y)=>{if(Y!==void 0)return O0([MU(Q,Z,Y)]);return qx(X.issues)?XZ(a9(X.issues,(G)=>z_(G,void 0,Z)),aV):z_(X.issues,void 0,Z)});case"Refinement":return q5(e1(X),(Y)=>{if(Y!==void 0)return O0([MU(Q,Z,Y)]);return z_(X.issue,X.kind==="Predicate"?Q:void 0,Z)});case"Transformation":return q5(e1(X),(Y)=>{if(Y!==void 0)return O0([MU(Q,Z,Y)]);return z_(X.issue,X.kind==="Transformation"?Q:void 0,Z)})}};var zX={};y8(zX,{makeNoop:()=>V_8,make:()=>n00,layerNoop:()=>$_8,isFile:()=>U_8,WatchEventUpdate:()=>r00,WatchEventRemove:()=>a00,WatchEventCreate:()=>o00,WatchBackend:()=>sb,TiB:()=>H_8,Size:()=>sU,PiB:()=>W_8,MiB:()=>K_8,KiB:()=>G_8,GiB:()=>B_8,FileTypeId:()=>zq,FileSystem:()=>$Q,FileDescriptor:()=>i00});var uO0=Symbol.for("effect/Brand/Refined");var IA=()=>{return Object.assign((X)=>X,{[uO0]:uO0,option:(X)=>I(X),either:(X)=>O0(X),is:(X)=>!0})};var dG=_6;var fx=PQ;var fO0=DJ,pO0=xB;var yQ=F7,lO0=DG;var no=jO;var px=MG;var nO0=A$,iO0=aK;var C8={};y8(C8,{zipWith:()=>g48,withSpan:()=>t48,withParentSpan:()=>e48,updateService:()=>JG8,unwrapScoped:()=>B_0,unwrapEffect:()=>eo,toRuntimeWithMemoMap:()=>y48,toRuntime:()=>b48,tapErrorCause:()=>k48,tapError:()=>v48,tap:()=>x48,syncContext:()=>S48,sync:()=>jU,suspend:()=>E48,succeedContext:()=>to,succeed:()=>E7,span:()=>n48,setVersionMismatchErrorLogLevel:()=>s48,setUnhandledErrorLogLevel:()=>a48,setTracerTiming:()=>r48,setTracerEnabled:()=>o48,setTracer:()=>i48,setScheduler:()=>l48,setRequestCaching:()=>f48,setRequestCache:()=>p48,setRequestBatching:()=>c48,setRandom:()=>u48,setConfigProvider:()=>m48,setClock:()=>h48,service:()=>I48,scopedDiscard:()=>WJ,scopedContext:()=>VH,scoped:()=>P4,scope:()=>K_0,retry:()=>C48,provideMerge:()=>w3,provide:()=>D6,project:()=>T48,passthrough:()=>A48,parentSpan:()=>d48,orElse:()=>F48,orDie:()=>L48,mock:()=>z48,mergeAll:()=>xA,merge:()=>nx,memoize:()=>w48,matchCause:()=>D48,match:()=>q48,mapError:()=>_48,map:()=>Y_0,makeMemoMap:()=>XG8,locallyWith:()=>R48,locallyScoped:()=>G_0,locallyEffect:()=>M48,locally:()=>P48,launch:()=>O48,isLayer:()=>o58,isFresh:()=>r58,function:()=>N48,fresh:()=>U48,flatten:()=>$48,flatMap:()=>V48,fiberRefLocallyScopedWith:()=>j48,failSync:()=>B48,failCauseSync:()=>W48,failCause:()=>H48,fail:()=>K48,extendScope:()=>G48,ensureSuccessType:()=>ZG8,ensureRequirementsType:()=>YG8,ensureErrorType:()=>QG8,empty:()=>Y48,effectDiscard:()=>ZW,effectContext:()=>Q48,effect:()=>GQ,discard:()=>Z48,dieSync:()=>J48,die:()=>X48,context:()=>lx,catchAllCause:()=>e58,catchAll:()=>t58,buildWithScope:()=>so,buildWithMemoMap:()=>Xr,build:()=>ao,annotateSpans:()=>s58,annotateLogs:()=>a58,MemoMapTypeId:()=>i58,LayerTypeId:()=>n58,CurrentMemoMap:()=>ro});var oO0=(X)=>q4(TZ(PO,X)),rO0=$(2,(X,J)=>iX(PO,J)(X)),EA=(X)=>q4(KJ(jO,iY(X))),io=(X)=>ES(N0(X,EA)),oo=(X)=>gO(N0(X,EA)),SA=(X)=>q4(KJ(jO,PB(X))),aO0=$(2,(X,J)=>W5(SA(X),()=>EA(J))),sO0=$(2,(X,J)=>W5(SA(X),()=>io(J))),tO0=$(2,(X,J)=>W5(SA(X),()=>oo(J)));var eO0=(X)=>q4(QS(X)),X_0=(X)=>sB(OZ(A7,X)),J_0=(X,J)=>{return J=FZ(J),g1(A7,J?.onEnd?i6(U4(X,J),(Z)=>RG((Q)=>J.onEnd(Z,Q))):U4(X,J))},Z_0=(X)=>q4(BS(X));var n58=wS,i58=TF,ro=xn,o58=MF,r58=vn,a58=g$0,s58=h$0,ao=K$0,so=b1,t58=s$,e58=yn,lx=FS,X48=gn,J48=H$0,Z48=W$0,GQ=y1,ZW=U$0,Q48=ZQ,Y48=I$0,G48=V$0,K48=hn,B48=mn,H48=PF,W48=AS,V48=W5,$48=$$0,U48=dn,z48=D$0,N48=_$0;var O48=q$0,Y_0=PS,_48=w$0,q48=jS,D48=RS,w48=L$0,nx=un,xA=CS,L48=F$0,F48=A$0,A48=T$0,T48=M$0,M48=TS,P48=z$0,R48=MS,G_0=N$0,j48=O$0,C48=P$0,K_0=j$0,P4=g1,WJ=q4,VH=RF,I48=C$0,E7=hO,to=sB,E48=jF,jU=IS,S48=E$0,x48=S$0,v48=x$0,k48=v$0,b48=k$0,y48=b$0,D6=t$,w3=y$0,g48=cn,eo=ES,B_0=gO,h48=(X)=>WJ(KJ(TX,X9(jQ,X))),m48=eO0,d48=X_0,u48=(X)=>WJ(KJ(TX,X9(tK,X))),c48=(X)=>WJ(TZ(tN,X)),f48=(X)=>WJ(TZ(iF,X)),p48=(X)=>WJ(b9(X)?p(X,(J)=>TZ(lO,J)):TZ(lO,X)),l48=(X)=>WJ(TZ(MG,X)),n48=J_0,i48=Z_0,o48=(X)=>WJ(TZ(A$,X)),r48=(X)=>WJ(TZ(aK,X)),a48=(X)=>WJ(TZ(eN,X)),s48=(X)=>WJ(TZ(wL,X)),t48=m$0,e48=DS,XG8=bn,Xr=LS,JG8=$(3,(X,J,Z)=>D6(X,Y_0(lx(),(Q)=>X9(Q,J,Z(x6(Q,J)))))),ZG8=()=>(X)=>X,QG8=()=>(X)=>X,YG8=()=>(X)=>X;var GG8="effect/QueueEnqueue",rx=Symbol.for(GG8),KG8="effect/QueueDequeue",w_=Symbol.for(KG8),BG8="effect/QueueStrategy",ax=Symbol.for(BG8),HG8="effect/BackingQueue",H_0=Symbol.for(HG8),Jr={_A:(X)=>X},WG8={_A:(X)=>X},Zr={_In:(X)=>X},sx={_Out:(X)=>X};class W_0 extends fJ{queue;takers;shutdownHook;shutdownFlag;strategy;[rx]=Zr;[w_]=sx;constructor(X,J,Z,Q,Y){super();this.queue=X,this.takers=J,this.shutdownHook=Z,this.shutdownFlag=Q,this.strategy=Y}pipe(){return K0(this,arguments)}commit(){return this.take}capacity(){return this.queue.capacity()}get size(){return I0(()=>tY(this.unsafeSize(),()=>nX))}unsafeSize(){if(O9(this.shutdownFlag))return S();return I(this.queue.length()-Gx(this.takers)+this.strategy.surplusSize())}get isEmpty(){return N0(this.size,(X)=>X<=0)}get isFull(){return N0(this.size,(X)=>X>=this.capacity())}get shutdown(){return MQ(M8((X)=>{return z(this.shutdownFlag,oZ(!0)),z(UY(D_(this.takers),(J)=>v$(J,X.id()),!1,!1),i8(this.strategy.shutdown),_G(gB(this.shutdownHook,void 0)),AX)}))}get isShutdown(){return B0(()=>O9(this.shutdownFlag))}get awaitShutdown(){return IX(this.shutdownHook)}isActive(){return!O9(this.shutdownFlag)}unsafeOffer(X){if(O9(this.shutdownFlag))return!1;let J;if(this.queue.length()===0){let Q=z(this.takers,zY(gX));if(Q!==gX)IU(Q,X),J=!0;else J=!1}else J=!1;if(J)return!0;let Z=this.queue.offer(X);return CU(this.strategy,this.queue,this.takers),Z}offer(X){return I0(()=>{if(O9(this.shutdownFlag))return nX;let J;if(this.queue.length()===0){let Q=z(this.takers,zY(gX));if(Q!==gX)IU(Q,X),J=!0;else J=!1}else J=!1;if(J)return o(!0);let Z=this.queue.offer(X);return CU(this.strategy,this.queue,this.takers),Z?o(!0):this.strategy.handleSurplus([X],this.queue,this.takers,this.shutdownFlag)})}offerAll(X){return I0(()=>{if(O9(this.shutdownFlag))return nX;let J=v0(X),Z=this.queue.length()===0?v0($G8(this.takers,J.length)):l0,[Q,Y]=z(J,AN(Z.length));for(let K=0;K<Z.length;K++){let B=Z[K],H=Q[K];IU(B,H)}if(Y.length===0)return o(!0);let G=this.queue.offerAll(Y);return CU(this.strategy,this.queue,this.takers),T8(G)?o(!0):this.strategy.handleSurplus(G,this.queue,this.takers,this.shutdownFlag)})}get take(){return M8((X)=>{if(O9(this.shutdownFlag))return nX;let J=this.queue.poll(gX);if(J!==gX)return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),o(J);else{let Z=LG(X.id());return z(I0(()=>{return z(this.takers,L4(Z)),CU(this.strategy,this.queue,this.takers),O9(this.shutdownFlag)?nX:IX(Z)}),sZ(()=>{return B0(()=>UG8(this.takers,Z))}))}})}get takeAll(){return I0(()=>{return O9(this.shutdownFlag)?nX:B0(()=>{let X=this.queue.pollUpTo(Number.POSITIVE_INFINITY);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),f9(X)})})}takeUpTo(X){return I0(()=>O9(this.shutdownFlag)?nX:B0(()=>{let J=this.queue.pollUpTo(X);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),f9(J)}))}takeBetween(X,J){return I0(()=>V_0(this,X,J,a0()))}}var V_0=(X,J,Z,Q)=>{if(Z<J)return o(Q);return z(Qr(X,Z),p((Y)=>{let G=J-Y.length;if(G===1)return z(ix(X),N0((K)=>z(Q,f8(Y),D7(K))));if(G>1)return z(ix(X),p((K)=>V_0(X,G-1,Z-Y.length-1,z(Q,f8(Y),D7(K)))));return o(z(Q,f8(Y)))}))};var $_0=(X)=>z(B0(()=>Yx(X)),p((J)=>vA(tx(J),I_0()))),U_0=(X)=>z(B0(()=>Yx(X)),p((J)=>vA(tx(J),Yr()))),z_0=(X)=>z(B0(()=>Yx(X)),p((J)=>vA(tx(J),E_0()))),N_0=()=>z(B0(()=>eB()),p((X)=>vA(tx(X),Yr()))),VG8=(X,J,Z,Q,Y)=>{return new W_0(X,J,Z,Q,Y)},vA=(X,J)=>z(f7(),N0((Z)=>VG8(X,eB(),Z,uJ(!1),J)));class O_0{mutable;[H_0]=WG8;constructor(X){this.mutable=X}poll(X){return zY(this.mutable,X)}pollUpTo(X){return fO(this.mutable,X)}offerAll(X){return nF(this.mutable,X)}offer(X){return L4(this.mutable,X)}capacity(){return lz0(this.mutable)}length(){return Gx(this.mutable)}}var tx=(X)=>new O_0(X),__0=(X)=>X.capacity(),q_0=(X)=>X.size,D_0=(X)=>X.isFull,w_0=(X)=>X.isEmpty,L_0=(X)=>X.isShutdown,F_0=(X)=>X.awaitShutdown,A_0=(X)=>X.shutdown,T_0=$(2,(X,J)=>X.offer(J));var M_0=$(2,(X,J)=>X.offerAll(J)),P_0=(X)=>N0(X.takeUpTo(1),$G),ix=(X)=>X.take,R_0=(X)=>X.takeAll,Qr=$(2,(X,J)=>X.takeUpTo(J)),j_0=$(3,(X,J,Z)=>X.takeBetween(J,Z)),C_0=$(2,(X,J)=>X.takeBetween(J,J)),I_0=()=>new S_0,Yr=()=>new x_0,E_0=()=>new v_0;class S_0{[ax]=Jr;putters=eB();surplusSize(){return Gx(this.putters)}onCompleteTakersWithEmptyQueue(X){while(!XH(this.putters)&&!XH(X)){let J=zY(X,void 0),Z=zY(this.putters,void 0);if(Z[2])IU(Z[1],!0);IU(J,Z[0])}}get shutdown(){return z(G4,p((X)=>z(B0(()=>D_(this.putters)),p((J)=>UY(J,([Z,Q,Y])=>Y?z(v$(Q,X),AX):N8,!1,!1)))))}handleSurplus(X,J,Z,Q){return M8((Y)=>{let G=LG(Y.id());return z(I0(()=>{return this.unsafeOffer(X,G),this.unsafeOnQueueEmptySpace(J,Z),CU(this,J,Z),O9(Q)?nX:IX(G)}),sZ(()=>B0(()=>this.unsafeRemove(G))))})}unsafeOnQueueEmptySpace(X,J){let Z=!0;while(Z&&(X.capacity()===Number.POSITIVE_INFINITY||X.length()<X.capacity())){let Q=z(this.putters,zY(gX));if(Q===gX)Z=!1;else{let Y=X.offer(Q[0]);if(Y&&Q[2])IU(Q[1],!0);else if(!Y)ox(this.putters,z(D_(this.putters),LX(Q)));CU(this,X,J)}}}unsafeOffer(X,J){let Z=v0(X);for(let Q=0;Q<Z.length;Q++){let Y=Z[Q];if(Q===Z.length-1)z(this.putters,L4([Y,J,!0]));else z(this.putters,L4([Y,J,!1]))}}unsafeRemove(X){ox(this.putters,z(D_(this.putters),s5(([,J])=>J!==X)))}}class x_0{[ax]=Jr;surplusSize(){return 0}get shutdown(){return N8}onCompleteTakersWithEmptyQueue(){}handleSurplus(X,J,Z,Q){return o(!1)}unsafeOnQueueEmptySpace(X,J){}}class v_0{[ax]=Jr;surplusSize(){return 0}get shutdown(){return N8}onCompleteTakersWithEmptyQueue(){}handleSurplus(X,J,Z,Q){return B0(()=>{return this.unsafeOffer(J,X),CU(this,J,Z),!0})}unsafeOnQueueEmptySpace(X,J){}unsafeOffer(X,J){let Z=J[Symbol.iterator](),Q,Y=!0;while(!(Q=Z.next()).done&&Y){if(X.capacity()===0)return;X.poll(gX),Y=X.offer(Q.value)}}}var IU=(X,J)=>{return sK(X,o(J))},ox=(X,J)=>{return z(X,nF(J))},D_=(X)=>{return z(X,fO(Number.POSITIVE_INFINITY))},$G8=(X,J)=>{return z(X,fO(J))},UG8=(X,J)=>{ox(X,z(D_(X),s5((Z)=>J!==Z)))},CU=(X,J,Z)=>{let Q=!0;while(Q&&J.length()!==0){let Y=z(Z,zY(gX));if(Y!==gX){let G=J.poll(gX);if(G!==gX)IU(Y,G),X.unsafeOnQueueEmptySpace(J,Z);else ox(Z,z(D_(Z),LX(Y)));Q=!0}else Q=!1}if(Q&&J.length()===0&&!XH(Z))X.onCompleteTakersWithEmptyQueue(Z)};var V7=Symbol.for("effect/PubSub/AbsentValue"),b_0=(X,J)=>(Z)=>{if(!Z.has(X))Z.set(X,new Set);Z.get(X).add(J)},zG8=(X,J)=>(Z)=>{if(!Z.has(X))return;let Q=Z.get(X);if(Q.delete(J),Q.size===0)Z.delete(X)},y_0=(X)=>I0(()=>{let J=Gr(X);return Xv(J,new Xq0)}),g_0=(X)=>I0(()=>{let J=Gr(X);return Xv(J,new Kr)}),h_0=(X)=>I0(()=>{let J=Gr(X);return Xv(J,new Jq0)}),m_0=(X)=>I0(()=>{let J=NG8(X);return Xv(J,new Kr)});var d_0=(X)=>X.shutdown;var u_0=(X)=>X.subscribe,Gr=(X)=>{let J=typeof X==="number"?{capacity:X}:X;DG8(J.capacity);let Z=J.replay&&J.replay>0?new Wr(Math.ceil(J.replay)):void 0;if(J.capacity===1)return new n_0(Z);else if(wK0(J.capacity)===J.capacity)return new p_0(J.capacity,Z);else return new c_0(J.capacity,Z)},NG8=(X)=>new o_0(X?.replay?new Wr(X.replay):void 0),OG8=(X,J,Z)=>N0(f7(),(Q)=>_G8(X,J,X.subscribe(),eB(),Q,uJ(!1),Z)),_G8=(X,J,Z,Q,Y,G,K)=>new a_0(X,J,Z,Q,Y,G,K,X.replayWindow());class c_0{capacity;replayBuffer;array;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;constructor(X,J){this.capacity=X,this.replayBuffer=J,this.array=Array.from({length:X}),this.subscribers=Array.from({length:X})}replayWindow(){return this.replayBuffer?new kA(this.replayBuffer):Jv}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(X){if(this.isFull())return!1;if(this.subscriberCount!==0){let J=this.publisherIndex%this.capacity;this.array[J]=X,this.subscribers[J]=this.subscriberCount,this.publisherIndex+=1}if(this.replayBuffer)this.replayBuffer.offer(X);return!0}publishAll(X){if(this.subscriberCount===0){if(this.replayBuffer)this.replayBuffer.offerAll(X);return a0()}let J=f9(X),Z=J.length,Q=this.publisherIndex-this.subscribersIndex,Y=this.capacity-Q,G=Math.min(Z,Y);if(G===0)return J;let K=0,B=this.publisherIndex+G;while(this.publisherIndex!==B){let H=HX(J,K++),W=this.publisherIndex%this.capacity;if(this.array[W]=H,this.subscribers[W]=this.subscriberCount,this.publisherIndex+=1,this.replayBuffer)this.replayBuffer.offer(H)}return o9(J,K)}slide(){if(this.subscribersIndex!==this.publisherIndex){let X=this.subscribersIndex%this.capacity;this.array[X]=V7,this.subscribers[X]=0,this.subscribersIndex+=1}if(this.replayBuffer)this.replayBuffer.slide()}subscribe(){return this.subscriberCount+=1,new f_0(this,this.publisherIndex,!1)}}class f_0{self;subscriberIndex;unsubscribed;constructor(X,J,Z){this.self=X,this.subscriberIndex=J,this.unsubscribed=Z}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){if(this.unsubscribed)return 0;return this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(X){if(this.unsubscribed)return X;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let J=this.subscriberIndex%this.self.capacity,Z=this.self.array[J];if(this.self.subscribers[J]-=1,this.self.subscribers[J]===0)this.self.array[J]=V7,this.self.subscribersIndex+=1;return this.subscriberIndex+=1,Z}return X}pollUpTo(X){if(this.unsubscribed)return a0();this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let J=this.self.publisherIndex-this.subscriberIndex,Z=Math.min(X,J);if(Z<=0)return a0();let Q=[],Y=this.subscriberIndex+Z;while(this.subscriberIndex!==Y){let G=this.subscriberIndex%this.self.capacity,K=this.self.array[G];if(this.self.subscribers[G]-=1,this.self.subscribers[G]===0)this.self.array[G]=V7,this.self.subscribersIndex+=1;Q.push(K),this.subscriberIndex+=1}return f9(Q)}unsubscribe(){if(!this.unsubscribed){this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);while(this.subscriberIndex!==this.self.publisherIndex){let X=this.subscriberIndex%this.self.capacity;if(this.self.subscribers[X]-=1,this.self.subscribers[X]===0)this.self.array[X]=V7,this.self.subscribersIndex+=1;this.subscriberIndex+=1}}}}class p_0{capacity;replayBuffer;array;mask;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;constructor(X,J){this.capacity=X,this.replayBuffer=J,this.array=Array.from({length:X}),this.mask=X-1,this.subscribers=Array.from({length:X})}replayWindow(){return this.replayBuffer?new kA(this.replayBuffer):Jv}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(X){if(this.isFull())return!1;if(this.subscriberCount!==0){let J=this.publisherIndex&this.mask;this.array[J]=X,this.subscribers[J]=this.subscriberCount,this.publisherIndex+=1}if(this.replayBuffer)this.replayBuffer.offer(X);return!0}publishAll(X){if(this.subscriberCount===0){if(this.replayBuffer)this.replayBuffer.offerAll(X);return a0()}let J=f9(X),Z=J.length,Q=this.publisherIndex-this.subscribersIndex,Y=this.capacity-Q,G=Math.min(Z,Y);if(G===0)return J;let K=0,B=this.publisherIndex+G;while(this.publisherIndex!==B){let H=HX(J,K++),W=this.publisherIndex&this.mask;if(this.array[W]=H,this.subscribers[W]=this.subscriberCount,this.publisherIndex+=1,this.replayBuffer)this.replayBuffer.offer(H)}return o9(J,K)}slide(){if(this.subscribersIndex!==this.publisherIndex){let X=this.subscribersIndex&this.mask;this.array[X]=V7,this.subscribers[X]=0,this.subscribersIndex+=1}if(this.replayBuffer)this.replayBuffer.slide()}subscribe(){return this.subscriberCount+=1,new l_0(this,this.publisherIndex,!1)}}class l_0{self;subscriberIndex;unsubscribed;constructor(X,J,Z){this.self=X,this.subscriberIndex=J,this.unsubscribed=Z}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){if(this.unsubscribed)return 0;return this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(X){if(this.unsubscribed)return X;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let J=this.subscriberIndex&this.self.mask,Z=this.self.array[J];if(this.self.subscribers[J]-=1,this.self.subscribers[J]===0)this.self.array[J]=V7,this.self.subscribersIndex+=1;return this.subscriberIndex+=1,Z}return X}pollUpTo(X){if(this.unsubscribed)return a0();this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let J=this.self.publisherIndex-this.subscriberIndex,Z=Math.min(X,J);if(Z<=0)return a0();let Q=[],Y=this.subscriberIndex+Z;while(this.subscriberIndex!==Y){let G=this.subscriberIndex&this.self.mask,K=this.self.array[G];if(this.self.subscribers[G]-=1,this.self.subscribers[G]===0)this.self.array[G]=V7,this.self.subscribersIndex+=1;Q.push(K),this.subscriberIndex+=1}return f9(Q)}unsubscribe(){if(!this.unsubscribed){this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);while(this.subscriberIndex!==this.self.publisherIndex){let X=this.subscriberIndex&this.self.mask;if(this.self.subscribers[X]-=1,this.self.subscribers[X]===0)this.self.array[X]=V7,this.self.subscribersIndex+=1;this.subscriberIndex+=1}}}}class n_0{replayBuffer;publisherIndex=0;subscriberCount=0;subscribers=0;value=V7;capacity=1;constructor(X){this.replayBuffer=X}replayWindow(){return this.replayBuffer?new kA(this.replayBuffer):Jv}pipe(){return K0(this,arguments)}isEmpty(){return this.subscribers===0}isFull(){return!this.isEmpty()}size(){return this.isEmpty()?0:1}publish(X){if(this.isFull())return!1;if(this.subscriberCount!==0)this.value=X,this.subscribers=this.subscriberCount,this.publisherIndex+=1;if(this.replayBuffer)this.replayBuffer.offer(X);return!0}publishAll(X){if(this.subscriberCount===0){if(this.replayBuffer)this.replayBuffer.offerAll(X);return a0()}let J=f9(X);if(T8(J))return J;if(this.publish(kK(J)))return o9(J,1);else return J}slide(){if(this.isFull())this.subscribers=0,this.value=V7;if(this.replayBuffer)this.replayBuffer.slide()}subscribe(){return this.subscriberCount+=1,new i_0(this,this.publisherIndex,!1)}}class i_0{self;subscriberIndex;unsubscribed;constructor(X,J,Z){this.self=X,this.subscriberIndex=J,this.unsubscribed=Z}isEmpty(){return this.unsubscribed||this.self.subscribers===0||this.subscriberIndex===this.self.publisherIndex}size(){return this.isEmpty()?0:1}poll(X){if(this.isEmpty())return X;let J=this.self.value;if(this.self.subscribers-=1,this.self.subscribers===0)this.self.value=V7;return this.subscriberIndex+=1,J}pollUpTo(X){if(this.isEmpty()||X<1)return a0();let J=this.self.value;if(this.self.subscribers-=1,this.self.subscribers===0)this.self.value=V7;return this.subscriberIndex+=1,m0(J)}unsubscribe(){if(!this.unsubscribed){if(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex!==this.self.publisherIndex){if(this.self.subscribers-=1,this.self.subscribers===0)this.self.value=V7}}}}class o_0{replayBuffer;publisherHead={value:V7,subscribers:0,next:null};publisherTail=this.publisherHead;publisherIndex=0;subscribersIndex=0;capacity=Number.MAX_SAFE_INTEGER;constructor(X){this.replayBuffer=X}replayWindow(){return this.replayBuffer?new kA(this.replayBuffer):Jv}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(X){let J=this.publisherTail.subscribers;if(J!==0)this.publisherTail.next={value:X,subscribers:J,next:null},this.publisherTail=this.publisherTail.next,this.publisherIndex+=1;if(this.replayBuffer)this.replayBuffer.offer(X);return!0}publishAll(X){if(this.publisherTail.subscribers!==0)for(let J of X)this.publish(J);else if(this.replayBuffer)this.replayBuffer.offerAll(X);return a0()}slide(){if(this.publisherHead!==this.publisherTail)this.publisherHead=this.publisherHead.next,this.publisherHead.value=V7,this.subscribersIndex+=1;if(this.replayBuffer)this.replayBuffer.slide()}subscribe(){return this.publisherTail.subscribers+=1,new r_0(this,this.publisherTail,this.publisherIndex,!1)}}class r_0{self;subscriberHead;subscriberIndex;unsubscribed;constructor(X,J,Z,Q){this.self=X,this.subscriberHead=J,this.subscriberIndex=Z,this.unsubscribed=Q}isEmpty(){if(this.unsubscribed)return!0;let X=!0,J=!0;while(J)if(this.subscriberHead===this.self.publisherTail)J=!1;else if(this.subscriberHead.next.value!==V7)X=!1,J=!1;else this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1;return X}size(){if(this.unsubscribed)return 0;return this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(X){if(this.unsubscribed)return X;let J=!0,Z=X;while(J)if(this.subscriberHead===this.self.publisherTail)J=!1;else{let Q=this.subscriberHead.next.value;if(Q!==V7){if(Z=Q,this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0)this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=V7,this.self.subscribersIndex+=1;J=!1}this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return Z}pollUpTo(X){let J=[],Z=V7,Q=0;while(Q!==X){let Y=this.poll(Z);if(Y===Z)Q=X;else J.push(Y),Q+=1}return f9(J)}unsubscribe(){if(!this.unsubscribed){this.unsubscribed=!0,this.self.publisherTail.subscribers-=1;while(this.subscriberHead!==this.self.publisherTail){if(this.subscriberHead.next.value!==V7){if(this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0)this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=V7,this.self.subscribersIndex+=1}this.subscriberHead=this.subscriberHead.next}}}}class a_0 extends fJ{pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;[w_]=sx;constructor(X,J,Z,Q,Y,G,K,B){super();this.pubsub=X,this.subscribers=J,this.subscription=Z,this.pollers=Q,this.shutdownHook=Y,this.shutdownFlag=G,this.strategy=K,this.replayWindow=B}commit(){return this.take}pipe(){return K0(this,arguments)}capacity(){return this.pubsub.capacity}isActive(){return!O9(this.shutdownFlag)}get size(){return I0(()=>O9(this.shutdownFlag)?nX:o(this.subscription.size()+this.replayWindow.remaining))}unsafeSize(){if(O9(this.shutdownFlag))return S();return I(this.subscription.size()+this.replayWindow.remaining)}get isFull(){return I0(()=>O9(this.shutdownFlag)?nX:o(this.subscription.size()===this.capacity()))}get isEmpty(){return N0(this.size,(X)=>X===0)}get shutdown(){return MQ(M8((X)=>{return oZ(this.shutdownFlag,!0),z(MO(L_(this.pollers),(J)=>v$(J,X.id()),!1),i8(B0(()=>{this.subscribers.delete(this.subscription),this.subscription.unsubscribe(),this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers)})),_G(gB(this.shutdownHook,void 0)),AX)}))}get isShutdown(){return B0(()=>O9(this.shutdownFlag))}get awaitShutdown(){return IX(this.shutdownHook)}get take(){return M8((X)=>{if(O9(this.shutdownFlag))return nX;if(this.replayWindow.remaining>0){let Z=this.replayWindow.take();return o(Z)}let J=XH(this.pollers)?this.subscription.poll(gX):gX;if(J===gX){let Z=LG(X.id());return z(I0(()=>{return z(this.pollers,L4(Z)),z(this.subscribers,b_0(this.subscription,this.pollers)),this.strategy.unsafeCompletePollers(this.pubsub,this.subscribers,this.subscription,this.pollers),O9(this.shutdownFlag)?nX:IX(Z)}),sZ(()=>B0(()=>AG8(this.pollers,Z))))}else return this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers),o(J)})}get takeAll(){return I0(()=>{if(O9(this.shutdownFlag))return nX;let X=XH(this.pollers)?wG8(this.subscription):a0();if(this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers),this.replayWindow.remaining>0)return o(f8(this.replayWindow.takeAll(),X));return o(X)})}takeUpTo(X){return I0(()=>{if(O9(this.shutdownFlag))return nX;let J=void 0;if(this.replayWindow.remaining>=X){let Q=this.replayWindow.takeN(X);return o(Q)}else if(this.replayWindow.remaining>0)J=this.replayWindow.takeAll(),X=X-J.length;let Z=XH(this.pollers)?LG8(this.subscription,X):a0();return this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers),J?o(f8(J,Z)):o(Z)})}takeBetween(X,J){return I0(()=>s_0(this,X,J,a0()))}}var s_0=(X,J,Z,Q)=>{if(Z<J)return o(Q);return z(X.takeUpTo(Z),p((Y)=>{let G=J-Y.length;if(G===1)return z(X.take,N0((K)=>z(Q,f8(Y),D7(K))));if(G>1)return z(X.take,p((K)=>s_0(X,G-1,Z-Y.length-1,z(Q,f8(Y),D7(K)))));return o(z(Q,f8(Y)))}))};class t_0{pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;[rx]=Zr;[w_]=sx;constructor(X,J,Z,Q,Y,G){this.pubsub=X,this.subscribers=J,this.scope=Z,this.shutdownHook=Q,this.shutdownFlag=Y,this.strategy=G}capacity(){return this.pubsub.capacity}get size(){return I0(()=>O9(this.shutdownFlag)?nX:B0(()=>this.pubsub.size()))}unsafeSize(){if(O9(this.shutdownFlag))return S();return I(this.pubsub.size())}get isFull(){return N0(this.size,(X)=>X===this.capacity())}get isEmpty(){return N0(this.size,(X)=>X===0)}get awaitShutdown(){return IX(this.shutdownHook)}get isShutdown(){return B0(()=>O9(this.shutdownFlag))}get shutdown(){return MQ(M8((X)=>{return z(this.shutdownFlag,oZ(!0)),z(this.scope.close(I$(X.id())),i8(this.strategy.shutdown),_G(gB(this.shutdownHook,void 0)),AX)}))}publish(X){return I0(()=>{if(O9(this.shutdownFlag))return nX;if(this.pubsub.publish(X))return this.strategy.unsafeCompleteSubscribers(this.pubsub,this.subscribers),o(!0);return this.strategy.handleSurplus(this.pubsub,this.subscribers,m0(X),this.shutdownFlag)})}isActive(){return!O9(this.shutdownFlag)}unsafeOffer(X){if(O9(this.shutdownFlag))return!1;if(this.pubsub.publish(X))return this.strategy.unsafeCompleteSubscribers(this.pubsub,this.subscribers),!0;return!1}publishAll(X){return I0(()=>{if(O9(this.shutdownFlag))return nX;let J=FG8(this.pubsub,X);if(this.strategy.unsafeCompleteSubscribers(this.pubsub,this.subscribers),T8(J))return o(!0);return this.strategy.handleSurplus(this.pubsub,this.subscribers,J,this.shutdownFlag)})}get subscribe(){let X=i6(B3([this.scope.fork(VY),OG8(this.pubsub,this.subscribers,this.strategy)]),(J)=>J[0].addFinalizer(()=>J[1].shutdown));return N0(K3(X,(J,Z)=>J[0].close(Z)),(J)=>J[1])}offer(X){return this.publish(X)}offerAll(X){return this.publishAll(X)}pipe(){return K0(this,arguments)}}var Xv=(X,J)=>p(H5(),(Z)=>N0(f7(),(Q)=>qG8(X,new Map,Z,Q,uJ(!1),J))),qG8=(X,J,Z,Q,Y,G)=>new t_0(X,J,Z,Q,Y,G),DG8=(X)=>{if(X<=0)throw new hG0(`Cannot construct PubSub with capacity of ${X}`)},e_0=(X,J)=>{sK(X,o(J))},ex=(X,J)=>{return z(X,nF(J))},L_=(X)=>{return z(X,fO(Number.POSITIVE_INFINITY))},wG8=(X)=>{return X.pollUpTo(Number.POSITIVE_INFINITY)},LG8=(X,J)=>{return X.pollUpTo(J)},FG8=(X,J)=>{return X.publishAll(J)},AG8=(X,J)=>{ex(X,z(L_(X),s5((Z)=>Z!==J)))};class Xq0{publishers=eB();get shutdown(){return p(G4,(X)=>p(B0(()=>L_(this.publishers)),(J)=>UY(J,([Z,Q,Y])=>Y?z(v$(Q,X),AX):N8,!1,!1)))}handleSurplus(X,J,Z,Q){return M8((Y)=>{let G=LG(Y.id());return z(I0(()=>{return this.unsafeOffer(Z,G),this.unsafeOnPubSubEmptySpace(X,J),this.unsafeCompleteSubscribers(X,J),O9(Q)?nX:IX(G)}),sZ(()=>B0(()=>this.unsafeRemove(G))))})}unsafeOnPubSubEmptySpace(X,J){let Z=!0;while(Z&&!X.isFull()){let Q=z(this.publishers,zY(gX));if(Q===gX)Z=!1;else{let Y=X.publish(Q[0]);if(Y&&Q[2])e_0(Q[1],!0);else if(!Y)ex(this.publishers,z(L_(this.publishers),LX(Q)));this.unsafeCompleteSubscribers(X,J)}}}unsafeCompletePollers(X,J,Z,Q){return Br(this,X,J,Z,Q)}unsafeCompleteSubscribers(X,J){return Hr(this,X,J)}unsafeOffer(X,J){let Z=X[Symbol.iterator](),Q=Z.next();if(!Q.done)while(!0){let Y=Q.value;if(Q=Z.next(),Q.done){z(this.publishers,L4([Y,J,!0]));break}z(this.publishers,L4([Y,J,!1]))}}unsafeRemove(X){ex(this.publishers,z(L_(this.publishers),s5(([J,Z])=>Z!==X)))}}class Kr{get shutdown(){return N8}handleSurplus(X,J,Z,Q){return o(!1)}unsafeOnPubSubEmptySpace(X,J){}unsafeCompletePollers(X,J,Z,Q){return Br(this,X,J,Z,Q)}unsafeCompleteSubscribers(X,J){return Hr(this,X,J)}}class Jq0{get shutdown(){return N8}handleSurplus(X,J,Z,Q){return B0(()=>{return this.unsafeSlidingPublish(X,Z),this.unsafeCompleteSubscribers(X,J),!0})}unsafeOnPubSubEmptySpace(X,J){}unsafeCompletePollers(X,J,Z,Q){return Br(this,X,J,Z,Q)}unsafeCompleteSubscribers(X,J){return Hr(this,X,J)}unsafeSlidingPublish(X,J){let Z=J[Symbol.iterator](),Q=Z.next();if(!Q.done&&X.capacity>0){let Y=Q.value,G=!0;while(G){X.slide();let K=X.publish(Y);if(K&&(Q=Z.next())&&!Q.done)Y=Q.value;else if(K)G=!1}}}}var Br=(X,J,Z,Q,Y)=>{let G=!0;while(G&&!Q.isEmpty()){let K=z(Y,zY(gX));if(K===gX)if(z(Z,zG8(Q,Y)),XH(Y))G=!1;else z(Z,b_0(Q,Y));else{let B=Q.poll(gX);if(B===gX)ex(Y,z(L_(Y),LX(K)));else e_0(K,B),X.unsafeOnPubSubEmptySpace(J,Z)}}},Hr=(X,J,Z)=>{for(let[Q,Y]of Z)for(let G of Y)X.unsafeCompletePollers(J,Z,Q,G)};class Wr{capacity;constructor(X){this.capacity=X}head={value:V7,next:null};tail=this.head;size=0;index=0;slide(){this.index++}offer(X){if(this.tail.value=X,this.tail.next={value:V7,next:null},this.tail=this.tail.next,this.size===this.capacity)this.head=this.head.next;else this.size+=1}offerAll(X){for(let J of X)this.offer(J)}}class kA{buffer;head;index;remaining;constructor(X){this.buffer=X,this.index=X.index,this.remaining=X.size,this.head=X.head}fastForward(){while(this.index<this.buffer.index)this.head=this.head.next,this.index++}take(){if(this.remaining===0)return;else if(this.index<this.buffer.index)this.fastForward();this.remaining--;let X=this.head.value;return this.head=this.head.next,X}takeN(X){if(this.remaining===0)return a0();else if(this.index<this.buffer.index)this.fastForward();let J=Math.min(X,this.remaining),Z=Array(J);for(let Q=0;Q<J;Q++){let Y=this.head.value;this.head=this.head.next,Z[Q]=Y}return this.remaining-=J,Q8(Z)}takeAll(){return this.takeN(this.remaining)}}var Jv={remaining:0,take:()=>{return},takeN:()=>a0(),takeAll:()=>a0()};var bA=y_0,Zq0=g_0,Qq0=h_0,Yq0=m_0;var F_=d_0;var L3=u_0;var Kq0=w_;var DY=$_0,A_=U_0,T_=z_0,QW=N_0,Bq0=__0,Zv=q_0,Hq0=w_0,Wq0=D_0,yA=L_0,Vq0=F_0,mX=A_0,g9=T_0;var Vr=M_0,$q0=P_0,EZ=ix,Uq0=R_0,zq0=Qr,Qv=j_0,Nq0=C_0;var Gv="Continue",$r="Close",Ur="Yield";var MG8="effect/ChannelChildExecutorDecision",_q0=Symbol.for(MG8),PG8={[_q0]:_q0},zr=(X)=>{let J=Object.create(PG8);return J._tag=Gv,J};var M_="ContinuationK",qq0="ContinuationFinalizer";var wq0=Symbol.for("effect/ChannelContinuation"),Lq0={_Env:(X)=>X,_InErr:(X)=>X,_InElem:(X)=>X,_InDone:(X)=>X,_OutErr:(X)=>X,_OutDone:(X)=>X,_OutErr2:(X)=>X,_OutElem:(X)=>X,_OutDone2:(X)=>X};class P_{onSuccess;onHalt;_tag=M_;[wq0]=Lq0;constructor(X,J){this.onSuccess=X,this.onHalt=J}onExit(X){return AZ(X)?this.onHalt(X.cause):this.onSuccess(X.value)}}class Nr{finalizer;_tag=qq0;[wq0]=Lq0;constructor(X){this.finalizer=X}}var Kv="PullAfterNext",Or="PullAfterAllEnqueued";var CG8="effect/ChannelUpstreamPullStrategy",IG8=Symbol.for(CG8),EG8={_A:(X)=>X},SG8={[IG8]:EG8},_r=(X)=>{let J=Object.create(SG8);return J._tag=Kv,J.emitSeparator=X,J};var Bv="BracketOut",Hv="Bridge",gA="ConcatAll",Wv="Emit",Vv="Ensuring",$v="Fail",R_="Fold",Uv="FromEffect",zv="PipeTo",Nv="Provide",Ov="Read",_v="Succeed",qv="SucceedNow",Dv="Suspend";var vG8="effect/Channel",j_=Symbol.for(vG8),kG8={_Env:(X)=>X,_InErr:(X)=>X,_InElem:(X)=>X,_InDone:(X)=>X,_OutErr:(X)=>X,_OutElem:(X)=>X,_OutDone:(X)=>X},SZ={[j_]:kG8,pipe(){return K0(this,arguments)}},hA=(X)=>V0(X,j_)||VX(X),qr=$(2,(X,J)=>{let Z=Object.create(SZ);return Z._tag=Bv,Z.acquire=()=>X,Z.finalizer=J,Z}),C_=$(2,(X,J)=>{let Z=Object.create(SZ);return Z._tag=R_,Z.channel=X,Z.k=new P_(w6,J),Z}),$H=(X)=>{return sX(()=>{let J=[];return z0(A8(X,Tq0(J)),(Z)=>F3(()=>[f9(J),Z]))})},Tq0=(X)=>GX({onInput:(J)=>z0(F3(()=>{X.push(J)}),()=>Tq0(X)),onFailure:$9,onDone:L6});var wv=(X,J,Z)=>{let Q=Object.create(SZ);return Q._tag=gA,Q.combineInners=J,Q.combineAll=Z,Q.onPull=()=>_r(S()),Q.onEmit=()=>zr,Q.value=()=>X,Q.k=t,Q},Dr=$(4,(X,J,Z,Q)=>{let Y=Object.create(SZ);return Y._tag=gA,Y.combineInners=Z,Y.combineAll=Q,Y.onPull=()=>_r(S()),Y.onEmit=()=>zr,Y.value=()=>X,Y.k=J,Y});var I_=$(2,(X,J)=>{let Z=Object.create(SZ);return Z._tag=Hv,Z.input=J,Z.channel=X,Z}),YW=$(2,(X,J)=>{let Z=Object.create(SZ);return Z._tag=Vv,Z.channel=X,Z.finalizer=J,Z}),$9=(X)=>O8(N4(X));var O8=(X)=>mA(()=>X),mA=(X)=>{let J=Object.create(SZ);return J._tag=$v,J.error=X,J},z0=$(2,(X,J)=>{let Z=Object.create(SZ);return Z._tag=R_,Z.channel=X,Z.k=new P_(J,O8),Z}),EU=$(2,(X,J)=>{let Z=Object.create(SZ);return Z._tag=R_,Z.channel=X,Z.k=new P_(J.onSuccess,J.onFailure),Z}),r0=(X)=>{let J=Object.create(SZ);return J._tag=Uv,J.effect=()=>X,J},A8=$(2,(X,J)=>{let Z=Object.create(SZ);return Z._tag=zv,Z.left=()=>X,Z.right=()=>J,Z}),GW=$(2,(X,J)=>{let Z=Object.create(SZ);return Z._tag=Nv,Z.context=()=>J,Z.inner=X,Z});var GX=(X)=>Z9({onInput:X.onInput,onFailure:(J)=>w9(jG(J),{onLeft:X.onFailure,onRight:O8}),onDone:X.onDone}),Z9=(X)=>{let J=Object.create(SZ);return J._tag=Ov,J.more=X.onInput,J.done=new P_(X.onDone,X.onFailure),J},w6=(X)=>F3(()=>X),L6=(X)=>{let J=Object.create(SZ);return J._tag=qv,J.terminal=X,J},sX=(X)=>{let J=Object.create(SZ);return J._tag=Dv,J.channel=X,J},F3=(X)=>{let J=Object.create(SZ);return J._tag=_v,J.evaluate=X,J},Y8=L6(void 0);var q0=(X)=>{let J=Object.create(SZ);return J._tag=Wv,J.out=X,J};var KW="Done",BW="Emit",UH="FromEffect",HW="Read";var bG8=Symbol.for("effect/ChannelState"),yG8={_E:(X)=>X,_R:(X)=>X},Lv={[bG8]:yG8},xU=()=>{let X=Object.create(Lv);return X._tag=KW,X},Fv=()=>{let X=Object.create(Lv);return X._tag=BW,X},E_=(X)=>{let J=Object.create(Lv);return J._tag=UH,J.effect=X,J},Av=(X,J,Z,Q)=>{let Y=Object.create(Lv);return Y._tag=HW,Y.upstream=X,Y.onEffect=J,Y.onEmit=Z,Y.onDone=Q,Y};var dA=(X)=>X._tag===UH;var Mq0=(X)=>dA(X)?X.effect:U0,Lr=(X)=>dA(X)?HU(X.effect):void 0;var Fr="PullFromChild",Tv="PullFromUpstream",Mv="DrainChildExecutors",Ar="Emit";class S_{childExecutor;parentSubexecutor;onEmit;_tag=Fr;constructor(X,J,Z){this.childExecutor=X,this.parentSubexecutor=J,this.onEmit=Z}close(X){let J=this.childExecutor.close(X),Z=this.parentSubexecutor.close(X);if(J!==void 0&&Z!==void 0)return tJ(r6(J),r6(Z),(Q,Y)=>z(Q,M1(Y)));else if(J!==void 0)return J;else if(Z!==void 0)return Z;else return}enqueuePullFromChild(X){return this}}class WW{upstreamExecutor;createChild;lastDone;activeChildExecutors;combineChildResults;combineWithChildResult;onPull;onEmit;_tag=Tv;constructor(X,J,Z,Q,Y,G,K,B){this.upstreamExecutor=X,this.createChild=J,this.lastDone=Z,this.activeChildExecutors=Q,this.combineChildResults=Y,this.combineWithChildResult=G,this.onPull=K,this.onEmit=B}close(X){let J=this.upstreamExecutor.close(X),Q=[...this.activeChildExecutors.map((Y)=>Y!==void 0?Y.childExecutor.close(X):void 0),J].reduce((Y,G)=>{if(Y!==void 0&&G!==void 0)return tJ(Y,r6(G),(K,B)=>M1(K,B));else if(Y!==void 0)return Y;else if(G!==void 0)return r6(G);else return},void 0);return Q===void 0?Q:Q}enqueuePullFromChild(X){return new WW(this.upstreamExecutor,this.createChild,this.lastDone,[...this.activeChildExecutors,X],this.combineChildResults,this.combineWithChildResult,this.onPull,this.onEmit)}}class vU{upstreamExecutor;lastDone;activeChildExecutors;upstreamDone;combineChildResults;combineWithChildResult;onPull;_tag=Mv;constructor(X,J,Z,Q,Y,G,K){this.upstreamExecutor=X,this.lastDone=J,this.activeChildExecutors=Z,this.upstreamDone=Q,this.combineChildResults=Y,this.combineWithChildResult=G,this.onPull=K}close(X){let J=this.upstreamExecutor.close(X),Q=[...this.activeChildExecutors.map((Y)=>Y!==void 0?Y.childExecutor.close(X):void 0),J].reduce((Y,G)=>{if(Y!==void 0&&G!==void 0)return tJ(Y,r6(G),(K,B)=>M1(K,B));else if(Y!==void 0)return Y;else if(G!==void 0)return r6(G);else return},void 0);return Q===void 0?Q:Q}enqueuePullFromChild(X){return new vU(this.upstreamExecutor,this.lastDone,[...this.activeChildExecutors,X],this.upstreamDone,this.combineChildResults,this.combineWithChildResult,this.onPull)}}class uA{value;next;_tag=Ar;constructor(X,J){this.value=X,this.next=J}close(X){let J=this.next.close(X);return J===void 0?J:J}enqueuePullFromChild(X){return this}}var Pq0="Pulled",Rq0="NoUpstream";var dG8="effect/ChannelUpstreamPullRequest",uG8=Symbol.for(dG8),cG8={_A:(X)=>X},jq0={[uG8]:cG8},Tr=(X)=>{let J=Object.create(jq0);return J._tag=Pq0,J.value=X,J},Cq0=(X)=>{let J=Object.create(jq0);return J._tag=Rq0,J.activeDownstreamCount=X,J};class VW{_activeSubexecutor=void 0;_cancelled=void 0;_closeLastSubstream=void 0;_currentChannel;_done=void 0;_doneStack=[];_emitted=void 0;_executeCloseLastSubstream;_input=void 0;_inProgressFinalizer=void 0;_providedEnv;constructor(X,J,Z){this._currentChannel=X,this._executeCloseLastSubstream=Z,this._providedEnv=J}run(){let X=void 0;while(X===void 0)if(this._cancelled!==void 0)X=this.processCancellation();else if(this._activeSubexecutor!==void 0)X=this.runSubexecutor();else try{if(this._currentChannel===void 0)X=xU();else{if(VX(this._currentChannel))this._currentChannel=r0(this._currentChannel);switch(this._currentChannel._tag){case Bv:{X=this.runBracketOut(this._currentChannel);break}case Hv:{let J=this._currentChannel.input;if(this._currentChannel=this._currentChannel.channel,this._input!==void 0){let Z=this._input;this._input=void 0;let Q=()=>h(J.awaitRead(),()=>o0(()=>{let Y=Z.run();switch(Y._tag){case KW:return rX(Z.getDone(),{onFailure:(G)=>J.error(G),onSuccess:(G)=>J.done(G)});case BW:return h(J.emit(Z.getEmit()),()=>Q());case UH:return a6(Y.effect,{onFailure:(G)=>J.error(G),onSuccess:()=>Q()});case HW:return Rv(Y,()=>Q(),(G)=>J.error(G))}}));X=E_(h(F4(QX(Q())),(Y)=>L0(()=>this.addFinalizer((G)=>h(T7(Y),()=>o0(()=>{let K=this.restorePipe(G,Z);return K!==void 0?K:U0}))))))}break}case gA:{let J=new VW(this._currentChannel.value(),this._providedEnv,(Q)=>L0(()=>{let Y=this._closeLastSubstream===void 0?U0:this._closeLastSubstream;this._closeLastSubstream=z(Y,C0(Q))}));J._input=this._input;let Z=this._currentChannel;this._activeSubexecutor=new WW(J,(Q)=>Z.k(Q),void 0,[],(Q,Y)=>Z.combineInners(Q,Y),(Q,Y)=>Z.combineAll(Q,Y),(Q)=>Z.onPull(Q),(Q)=>Z.onEmit(Q)),this._closeLastSubstream=void 0,this._currentChannel=void 0;break}case Wv:{this._emitted=this._currentChannel.out,this._currentChannel=this._activeSubexecutor!==void 0?void 0:Y8,X=Fv();break}case Vv:{this.runEnsuring(this._currentChannel);break}case $v:{X=this.doneHalt(this._currentChannel.error());break}case R_:{this._doneStack.push(this._currentChannel.k),this._currentChannel=this._currentChannel.channel;break}case Uv:{let J=this._providedEnv===void 0?this._currentChannel.effect():z(this._currentChannel.effect(),o6(this._providedEnv));X=E_(a6(J,{onFailure:(Z)=>{let Q=this.doneHalt(Z);return Q!==void 0&&dA(Q)?Q.effect:U0},onSuccess:(Z)=>{let Q=this.doneSucceed(Z);return Q!==void 0&&dA(Q)?Q.effect:U0}}));break}case zv:{let J=this._input,Z=new VW(this._currentChannel.left(),this._providedEnv,(Q)=>this._executeCloseLastSubstream(Q));Z._input=J,this._input=Z,this.addFinalizer((Q)=>{let Y=this.restorePipe(Q,J);return Y!==void 0?Y:U0}),this._currentChannel=this._currentChannel.right();break}case Nv:{let J=this._providedEnv;this._providedEnv=this._currentChannel.context(),this._currentChannel=this._currentChannel.inner,this.addFinalizer(()=>L0(()=>{this._providedEnv=J}));break}case Ov:{let J=this._currentChannel;X=Av(this._input,t,(Z)=>{try{this._currentChannel=J.more(Z)}catch(Q){this._currentChannel=J.done.onExit(Y5(Q))}return},(Z)=>{let Q=(Y)=>{return J.done.onExit(Y)};this._currentChannel=Q(Z);return});break}case _v:{X=this.doneSucceed(this._currentChannel.evaluate());break}case qv:{X=this.doneSucceed(this._currentChannel.terminal);break}case Dv:{this._currentChannel=this._currentChannel.channel();break}}}}catch(J){this._currentChannel=O8(oJ(J))}return X}getDone(){return this._done}getEmit(){return this._emitted}cancelWith(X){this._cancelled=X}clearInProgressFinalizer(){this._inProgressFinalizer=void 0}storeInProgressFinalizer(X){this._inProgressFinalizer=X}popAllFinalizers(X){let J=[],Z=this._doneStack.pop();while(Z){if(Z._tag==="ContinuationFinalizer")J.push(Z.finalizer);Z=this._doneStack.pop()}let Q=J.length===0?U0:Pr(J,X);return this.storeInProgressFinalizer(Q),Q}popNextFinalizers(){let X=[];while(this._doneStack.length!==0){let J=this._doneStack[this._doneStack.length-1];if(J._tag===M_)return X;X.push(J),this._doneStack.pop()}return X}restorePipe(X,J){let Z=this._input;if(this._input=J,Z!==void 0)return Z.close(X);return U0}close(X){let J=void 0,Z=this._inProgressFinalizer;if(Z!==void 0)J=z(Z,RZ(L0(()=>this.clearInProgressFinalizer())));let Q=void 0,Y=this.popAllFinalizers(X);if(Y!==void 0)Q=z(Y,RZ(L0(()=>this.clearInProgressFinalizer())));let G=this._activeSubexecutor===void 0?void 0:this._activeSubexecutor.close(X);if(G===void 0&&J===void 0&&Q===void 0)return;return z(r6(Mr(G)),j7(r6(Mr(J))),j7(r6(Mr(Q))),u(([[K,B],H])=>z(K,M1(B),M1(H))),xG,h((K)=>o0(()=>K)))}doneSucceed(X){if(this._doneStack.length===0)return this._done=v8(X),this._currentChannel=void 0,xU();let J=this._doneStack[this._doneStack.length-1];if(J._tag===M_){this._doneStack.pop(),this._currentChannel=J.onSuccess(X);return}let Z=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=Z.reverse(),this._done=v8(X),this._currentChannel=void 0,xU();let Q=Pr(Z.map((G)=>G.finalizer),v8(X));this.storeInProgressFinalizer(Q);let Y=z(Q,RZ(L0(()=>this.clearInProgressFinalizer())),xG,h(()=>L0(()=>this.doneSucceed(X))));return E_(Y)}doneHalt(X){if(this._doneStack.length===0)return this._done=_9(X),this._currentChannel=void 0,xU();let J=this._doneStack[this._doneStack.length-1];if(J._tag===M_){this._doneStack.pop();try{this._currentChannel=J.onHalt(X)}catch(G){this._currentChannel=O8(oJ(G))}return}let Z=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=Z.reverse(),this._done=_9(X),this._currentChannel=void 0,xU();let Q=Pr(Z.map((G)=>G.finalizer),_9(X));this.storeInProgressFinalizer(Q);let Y=z(Q,RZ(L0(()=>this.clearInProgressFinalizer())),xG,h(()=>L0(()=>this.doneHalt(X))));return E_(Y)}processCancellation(){return this._currentChannel=void 0,this._done=this._cancelled,this._cancelled=void 0,xU()}runBracketOut(X){let J=xG(a6(this.provide(X.acquire()),{onFailure:(Z)=>L0(()=>{this._currentChannel=O8(Z)}),onSuccess:(Z)=>L0(()=>{this.addFinalizer((Q)=>this.provide(X.finalizer(Z,Q))),this._currentChannel=q0(Z)})}));return E_(J)}provide(X){if(this._providedEnv===void 0)return X;return z(X,o6(this._providedEnv))}runEnsuring(X){this.addFinalizer(X.finalizer),this._currentChannel=X.channel}addFinalizer(X){this._doneStack.push(new Nr(X))}runSubexecutor(){let X=this._activeSubexecutor;switch(X._tag){case Fr:return this.pullFromChild(X.childExecutor,X.parentSubexecutor,X.onEmit,X);case Tv:return this.pullFromUpstream(X);case Mv:return this.drainChildExecutors(X);case Ar:return this._emitted=X.value,this._activeSubexecutor=X.next,Fv()}}replaceSubexecutor(X){this._currentChannel=void 0,this._activeSubexecutor=X}finishWithExit(X){let J=rX(X,{onFailure:(Z)=>this.doneHalt(Z),onSuccess:(Z)=>this.doneSucceed(Z)});return this._activeSubexecutor=void 0,J===void 0?U0:Mq0(J)}finishSubexecutorWithCloseEffect(X,...J){this.addFinalizer(()=>z(J,a9((Q)=>z(L0(()=>Q(X)),h((Y)=>Y!==void 0?Y:U0)),{discard:!0})));let Z=z(X,rX({onFailure:(Q)=>this.doneHalt(Q),onSuccess:(Q)=>this.doneSucceed(Q)}));return this._activeSubexecutor=void 0,Z}applyUpstreamPullStrategy(X,J,Z){switch(Z._tag){case Kv:{let Q=!X||J.some((Y)=>Y!==void 0);return[Z.emitSeparator,Q?[void 0,...J]:J]}case Or:{let Q=!X||J.some((Y)=>Y!==void 0);return[Z.emitSeparator,Q?[...J,void 0]:J]}}}pullFromChild(X,J,Z,Q){return Av(X,t,(Y)=>{let G=Z(Y);switch(G._tag){case Gv:break;case $r:{this.finishWithDoneValue(X,J,G.value);break}case Ur:{let K=J.enqueuePullFromChild(Q);this.replaceSubexecutor(K);break}}this._activeSubexecutor=new uA(Y,this._activeSubexecutor);return},rX({onFailure:(Y)=>{let G=this.handleSubexecutorFailure(X,J,Y);return G===void 0?void 0:Lr(G)},onSuccess:(Y)=>{this.finishWithDoneValue(X,J,Y);return}}))}finishWithDoneValue(X,J,Z){let Q=J;switch(Q._tag){case Tv:{let Y=new WW(Q.upstreamExecutor,Q.createChild,Q.lastDone!==void 0?Q.combineChildResults(Q.lastDone,Z):Z,Q.activeChildExecutors,Q.combineChildResults,Q.combineWithChildResult,Q.onPull,Q.onEmit);this._closeLastSubstream=X.close(v8(Z)),this.replaceSubexecutor(Y);break}case Mv:{let Y=new vU(Q.upstreamExecutor,Q.lastDone!==void 0?Q.combineChildResults(Q.lastDone,Z):Z,Q.activeChildExecutors,Q.upstreamDone,Q.combineChildResults,Q.combineWithChildResult,Q.onPull);this._closeLastSubstream=X.close(v8(Z)),this.replaceSubexecutor(Y);break}default:break}}handleSubexecutorFailure(X,J,Z){return this.finishSubexecutorWithCloseEffect(_9(Z),(Q)=>J.close(Q),(Q)=>X.close(Q))}pullFromUpstream(X){if(X.activeChildExecutors.length===0)return this.performPullFromUpstream(X);let J=X.activeChildExecutors[0],Z=new WW(X.upstreamExecutor,X.createChild,X.lastDone,X.activeChildExecutors.slice(1),X.combineChildResults,X.combineWithChildResult,X.onPull,X.onEmit);if(J===void 0)return this.performPullFromUpstream(Z);this.replaceSubexecutor(new S_(J.childExecutor,Z,J.onEmit));return}performPullFromUpstream(X){return Av(X.upstreamExecutor,(J)=>{let Z=this._closeLastSubstream===void 0?U0:this._closeLastSubstream;return this._closeLastSubstream=void 0,z(this._executeCloseLastSubstream(Z),C0(J))},(J)=>{if(this._closeLastSubstream!==void 0){let G=this._closeLastSubstream;return this._closeLastSubstream=void 0,z(this._executeCloseLastSubstream(G),u(()=>{let K=new VW(X.createChild(J),this._providedEnv,this._executeCloseLastSubstream);K._input=this._input;let[B,H]=this.applyUpstreamPullStrategy(!1,X.activeChildExecutors,X.onPull(Tr(J)));if(this._activeSubexecutor=new S_(K,new WW(X.upstreamExecutor,X.createChild,X.lastDone,H,X.combineChildResults,X.combineWithChildResult,X.onPull,X.onEmit),X.onEmit),R0(B))this._activeSubexecutor=new uA(B.value,this._activeSubexecutor);return}))}let Z=new VW(X.createChild(J),this._providedEnv,this._executeCloseLastSubstream);Z._input=this._input;let[Q,Y]=this.applyUpstreamPullStrategy(!1,X.activeChildExecutors,X.onPull(Tr(J)));if(this._activeSubexecutor=new S_(Z,new WW(X.upstreamExecutor,X.createChild,X.lastDone,Y,X.combineChildResults,X.combineWithChildResult,X.onPull,X.onEmit),X.onEmit),R0(Q))this._activeSubexecutor=new uA(Q.value,this._activeSubexecutor);return},(J)=>{if(X.activeChildExecutors.some((Y)=>Y!==void 0)){let Y=new vU(X.upstreamExecutor,X.lastDone,[void 0,...X.activeChildExecutors],X.upstreamExecutor.getDone(),X.combineChildResults,X.combineWithChildResult,X.onPull);if(this._closeLastSubstream!==void 0){let G=this._closeLastSubstream;return this._closeLastSubstream=void 0,z(this._executeCloseLastSubstream(G),u(()=>this.replaceSubexecutor(Y)))}this.replaceSubexecutor(Y);return}let Z=this._closeLastSubstream,Q=this.finishSubexecutorWithCloseEffect(z(J,DO((Y)=>X.combineWithChildResult(X.lastDone,Y))),()=>Z,(Y)=>X.upstreamExecutor.close(Y));return Q===void 0?void 0:Lr(Q)})}drainChildExecutors(X){if(X.activeChildExecutors.length===0){let Y=this._closeLastSubstream;if(Y!==void 0)this.addFinalizer(()=>y(Y));return this.finishSubexecutorWithCloseEffect(X.upstreamDone,()=>Y,(G)=>X.upstreamExecutor.close(G))}let J=X.activeChildExecutors[0],Z=X.activeChildExecutors.slice(1);if(J===void 0){let[Y,G]=this.applyUpstreamPullStrategy(!0,Z,X.onPull(Cq0(Z.reduce((K,B)=>B!==void 0?K+1:K,0))));if(this.replaceSubexecutor(new vU(X.upstreamExecutor,X.lastDone,G,X.upstreamDone,X.combineChildResults,X.combineWithChildResult,X.onPull)),R0(Y))return this._emitted=Y.value,Fv();return}let Q=new vU(X.upstreamExecutor,X.lastDone,Z,X.upstreamDone,X.combineChildResults,X.combineWithChildResult,X.onPull);this.replaceSubexecutor(new S_(J.childExecutor,Q,J.onEmit));return}}var Mr=(X)=>X!==void 0?X:U0,Pr=(X,J)=>{return z(a9(X,(Z)=>r6(Z(J))),u((Z)=>z(zl(Z),i0(()=>eZ))),h((Z)=>o0(()=>Z)))},Rv=(X,J,Z)=>{let Q=[X],Y=()=>{let G=Q.pop();if(G===void 0||G.upstream===void 0)return SG("Unexpected end of input for channel execution");let K=G.upstream.run();switch(K._tag){case BW:{let B=G.onEmit(G.upstream.getEmit());if(Q.length===0){if(B===void 0)return o0(J);return z(B,a6({onFailure:Z,onSuccess:J}))}if(B===void 0)return o0(()=>Y());return z(B,a6({onFailure:Z,onSuccess:()=>Y()}))}case KW:{let B=G.onDone(G.upstream.getDone());if(Q.length===0){if(B===void 0)return o0(J);return z(B,a6({onFailure:Z,onSuccess:J}))}if(B===void 0)return o0(()=>Y());return z(B,a6({onFailure:Z,onSuccess:()=>Y()}))}case UH:return Q.push(G),z(G.onEffect(K.effect),s9((B)=>o0(()=>{let H=G.onDone(_9(B));return H===void 0?U0:H})),a6({onFailure:Z,onSuccess:()=>Y()}));case HW:return Q.push(G),Q.push(K),o0(()=>Y())}};return Y()},wY=$(2,(X,J)=>{let Z=(Q,Y,G)=>p1(L0(()=>new VW(X,void 0,t)),(K)=>o0(()=>Pv(K.run(),K).pipe($U(Q),C0(h8(Q)),jZ(h8(Y)))),(K,B)=>{let H=K.close(B);if(H===void 0)return U0;return N5(H,(W)=>FJ(G,MX(W)))});return U5((Q)=>SQ([DF(J,BO),F9(),F9()]).pipe(h(([Y,G,K])=>Q(Z(G,K,Y)).pipe($X(J),h((B)=>J.addFinalizer((H)=>{let W=AZ(H)?NF(H.cause):void 0;return u1(G).pipe(h((V)=>V?H6(K,void 0).pipe(C0(v1(B)),C0(Pn(B))):H6(K,void 0).pipe(C0(W&&MB(W)>0?vO(B,$40(W)):T7(B)),C0(Pn(B)))))}).pipe(C0(Q(h8(G)))))))))}),Pv=(X,J)=>{let Z=X;switch(Z._tag){case UH:return z(Z.effect,h(()=>Pv(J.run(),J)));case BW:return Pv(J.run(),J);case KW:return o0(()=>J.getDone());case HW:return Rv(Z,()=>Pv(J.run(),J),MX)}};var jv="Done",Iq0="Await";var pG8="effect/ChannelMergeDecision",Sq0=Symbol.for(pG8),xq0={[Sq0]:{_R:(X)=>X,_E0:(X)=>X,_Z0:(X)=>X,_E:(X)=>X,_Z:(X)=>X}},zH=(X)=>{let J=Object.create(xq0);return J._tag=jv,J.effect=X,J},NH=(X)=>{let J=Object.create(xq0);return J._tag=Iq0,J.f=X,J};var Cv="BothRunning",Iv="LeftDone",Ev="RightDone";var lG8="effect/ChannelMergeState",kq0=Symbol.for(lG8),Cr={[kq0]:kq0},Sv=(X,J)=>{let Z=Object.create(Cr);return Z._tag=Cv,Z.left=X,Z.right=J,Z},Ir=(X)=>{let J=Object.create(Cr);return J._tag=Iv,J.f=X,J},Er=(X)=>{let J=Object.create(Cr);return J._tag=Ev,J.f=X,J};var Sr="BackPressure",xr="BufferSliding";var oG8="effect/ChannelMergeStrategy",bq0=Symbol.for(oG8),yq0={[bq0]:bq0},gq0=(X)=>{let J=Object.create(yq0);return J._tag=Sr,J},hq0=(X)=>{let J=Object.create(yq0);return J._tag=xr,J};var mq0=$(2,(X,{onBackPressure:J,onBufferSliding:Z})=>{switch(X._tag){case Sr:return J();case xr:return Z()}});var x_="Empty",cA="Emit",fA="Error",pA="Done",uq0=(X)=>({_tag:x_,notifyProducer:X}),vr=(X)=>({_tag:cA,notifyConsumers:X}),rG8=(X)=>({_tag:fA,cause:X}),aG8=(X)=>({_tag:pA,done:X});class cq0{ref;constructor(X){this.ref=X}awaitRead(){return sJ(Q5(this.ref,(X)=>X._tag===x_?[h8(X.notifyProducer),X]:[U0,X]))}get close(){return oO((X)=>this.error(R1(X)))}done(X){return sJ(Q5(this.ref,(J)=>{switch(J._tag){case x_:return[h8(J.notifyProducer),J];case cA:return[a9(J.notifyConsumers,(Z)=>H6(Z,M0(X)),{discard:!0}),aG8(X)];case fA:return[aJ,J];case pA:return[aJ,J]}}))}emit(X){return h(F9(),(J)=>sJ(Q5(this.ref,(Z)=>{switch(Z._tag){case x_:return[h8(Z.notifyProducer),Z];case cA:{let Q=Z.notifyConsumers[0],Y=Z.notifyConsumers.slice(1);if(Q!==void 0)return[H6(Q,O0(X)),Y.length===0?uq0(J):vr(Y)];throw Error("Bug: Channel.SingleProducerAsyncInput.emit - Queue was empty! please report an issue at https://github.com/Effect-TS/effect/issues")}case fA:return[aJ,Z];case pA:return[aJ,Z]}})))}error(X){return sJ(Q5(this.ref,(J)=>{switch(J._tag){case x_:return[h8(J.notifyProducer),J];case cA:return[a9(J.notifyConsumers,(Z)=>V5(Z,X),{discard:!0}),rG8(X)];case fA:return[aJ,J];case pA:return[aJ,J]}}))}get take(){return this.takeWith((X)=>_9(JQ(X,M0)),(X)=>v8(X),(X)=>WX(O0(X)))}takeWith(X,J,Z){return h(F9(),(Q)=>sJ(Q5(this.ref,(Y)=>{switch(Y._tag){case x_:return[C0(H6(Y.notifyProducer,void 0),QH(h8(Q),{onFailure:X,onSuccess:w9({onLeft:Z,onRight:J})})),vr([Q])];case cA:return[QH(h8(Q),{onFailure:X,onSuccess:w9({onLeft:Z,onRight:J})}),vr([...Y.notifyConsumers,Q])];case fA:return[y(X(Y.cause)),Y];case pA:return[y(Z(Y.done)),Y]}})))}}var xv=()=>z(F9(),h((X)=>bX(uq0(X))),u((X)=>new cq0(X)));var vv=(X,J,Z)=>z0(r0(bX(()=>U0)),(Q)=>z(r0(xG(J9(X,(Y)=>pJ(Q,(G)=>Z(Y,G))))),z0(J),YW((Y)=>h(ZX(Q),(G)=>G(Y))))),v_=$(2,(X,J)=>zW(X,()=>J));var UW=$(2,(X,J)=>C_(X,(Z)=>w9(jG(Z),{onLeft:J,onRight:O8}))),R4=$(2,(X,J)=>Dr(X,J,()=>{return},()=>{return}));var j4=(X)=>{let J=Z9({onInput:()=>J,onFailure:O8,onDone:w6});return A8(X,J)};var kU=$(2,(X,J)=>YW(X,()=>J));var fq0=(X)=>z0(X,t),br=$(2,(X,J)=>EU(X,{onFailure:(Z)=>{let Q=jG(Z);switch(Q._tag){case"Left":return J.onFailure(Q.left);case"Right":return O8(Q.right)}},onSuccess:J.onSuccess}));var lA=(X)=>o8(X.takeWith(O8,(J)=>z0(q0(J),()=>lA(X)),w6));var bv=(X)=>sX(()=>pq0(X)),pq0=(X)=>z(r0(EZ(X)),z0(w9({onLeft:rX({onFailure:O8,onSuccess:L6}),onRight:(J)=>z0(q0(J),()=>pq0(X))}))),LY=()=>GX({onInput:(X)=>z0(q0(X),()=>LY()),onFailure:$9,onDone:L6}),yv=$(2,(X,J)=>OW(X,{other:r0(J),onSelfDone:(Z)=>zH(o0(()=>Z)),onOtherDone:(Z)=>zH(o0(()=>Z))})),yr=$(2,(X,J)=>yv(X,h8(J))),zW=$(2,(X,J)=>z0(X,(Z)=>F3(()=>J(Z))));var gv=$(2,(X,J)=>hv(X,JQ(J))),hv=$(2,(X,J)=>C_(X,(Z)=>O8(J(Z)))),NW=$(2,(X,J)=>{let Z=GX({onInput:(Q)=>z0(q0(J(Q)),()=>Z),onFailure:$9,onDone:L6});return A8(X,Z)}),nA=$(2,(X,J)=>{let Z=Z9({onInput:(Q)=>z(r0(J(Q)),z0(q0),z0(()=>Z)),onFailure:O8,onDone:L6});return A8(X,Z)}),mv=$(3,(X,J,Z)=>C4((Q)=>f0(function*(){let Y=yield*xv(),G=lA(Y),K=yield*DY(Z);yield*FJ(Q,mX(K));let B=yield*F9(),H=Z===Number.POSITIVE_INFINITY?(U)=>t:(yield*tO(Z)).withPermits;yield*(yield*G.pipe(A8(X),$W(Q))).pipe(a6({onFailure:(U)=>g9(K,MX(U)),onSuccess:w9({onLeft:(U)=>C0(QX(H(Z)(U0)),p7(g9(K,y(M0(U))))),onRight:(U)=>f0(function*(){let O=yield*F9(),q=yield*F9();yield*g9(K,u(h8(O),O0)),yield*H6(q,void 0).pipe(C0(U5((L)=>r6(L(h8(B))).pipe(Ox(r6(L(J(U)))),h(t))).pipe(N5((L)=>V5(B,L)),$U(O))),H(1),$X(Q)),yield*h8(q)})})}),aO,QX,$X(Q));let V=o8(QH(sJ(EZ(K)),{onFailure:O8,onSuccess:w9({onLeft:L6,onRight:(U)=>z0(q0(U),()=>V)})}));return I_(V,Y)}))),lq0=(X)=>{return(J)=>nq0(X)(J,O6)};var nq0=({bufferSize:X=16,concurrency:J,mergeStrategy:Z=gq0()})=>(Q,Y)=>C4((G)=>f0(function*(){let K=J==="unbounded"?Number.MAX_SAFE_INTEGER:J,B=yield*xv(),H=lA(B),W=yield*DY(X);yield*FJ(G,mX(W));let V=yield*QW();yield*FJ(G,mX(V));let U=yield*bX(S()),O=yield*F9(),q=(yield*tO(K)).withPermits,L=yield*$W(A8(H,Q),G);function A(x){return x.pipe(h(w9({onLeft:(j)=>y(I(j)),onRight:(j)=>y9(g9(W,y(O0(j))),S())})),sO({until:(j)=>R0(j)}),h((j)=>lJ(U,w0({onNone:()=>I(j.value),onSome:(T)=>I(Y(T,j.value))}))),s9((j)=>PZ(j)?MX(j):g9(W,MX(j)).pipe(C0(H6(O,void 0)),p7)))}yield*L.pipe(a6({onFailure:(x)=>g9(W,MX(x)).pipe(C0(y(!1))),onSuccess:w9({onLeft:(x)=>n1(QX(h8(O)),QX(q(K)(U0)),{onSelfDone:(j,T)=>y9(T7(T),!1),onOtherDone:(j,T)=>C0(T7(T),ZX(U).pipe(h(w0({onNone:()=>g9(W,y(M0(x))),onSome:(E)=>g9(W,y(M0(Y(E,x))))})),y9(!1)))}),onRight:(x)=>mq0(Z,{onBackPressure:()=>f0(function*(){let j=yield*F9(),T=eF((k)=>$W(A8(H,x),k).pipe(h((P)=>ZA(r6(A(P)),r6(QX(h8(O))))),h(t)));return yield*H6(j,void 0).pipe(C0(T),q(1),$X(G)),yield*h8(j),!(yield*u1(O))}),onBufferSliding:()=>f0(function*(){let j=yield*F9(),T=yield*F9(),E=yield*Zv(V);yield*EZ(V).pipe(h((C)=>H6(C,void 0)),A4(()=>E>=K)),yield*g9(V,j);let k=eF((C)=>$W(A8(H,x),C).pipe(h((v)=>r6(A(v)).pipe(ZA(r6(QX(h8(O)))),ZA(r6(QX(h8(j)))))),h(t)));return yield*H6(T,void 0).pipe(C0(k),q(1),$X(G)),yield*h8(T),!(yield*u1(O))})})})}),sO({while:(x)=>x}),$X(G));let M=z(EZ(W),sJ,QH({onFailure:O8,onSuccess:w9({onLeft:L6,onRight:(x)=>z0(q0(x),()=>M)})}),o8);return I_(M,B)})),dv=$(3,(X,J,Z)=>lq0(Z)(NW(X,J)));var OW=$(2,(X,J)=>{function Z(Q){return f0(function*(){let Y=yield*xv(),G=lA(Y),K=yield*$W(A8(G,X),Q),B=yield*$W(A8(G,J.other),Q);function H(V,U,O){return(q,L,A)=>{function M(x){let j=x;if(j._tag===jv)return y(r0(C0(T7(U),j.effect)));return u(v1(U),rX({onFailure:(T)=>r0(j.f(_9(T))),onSuccess:w9({onLeft:(T)=>r0(j.f(v8(T))),onRight:(T)=>B9(q0(T),W(A(j.f)))})}))}return rX(V,{onFailure:(x)=>M(q(_9(x))),onSuccess:w9({onLeft:(x)=>M(q(v8(x))),onRight:(x)=>y(z0(q0(x),()=>z0(r0($X(QX(O),Q)),(j)=>W(L(j,U)))))})})}}function W(V){switch(V._tag){case Cv:{let U=QX(EQ(V.left)),O=QX(EQ(V.right));return o8(n1(U,O,{onSelfDone:(q,L)=>C0(T7(L),H(q,V.right,K)(J.onSelfDone,Sv,(A)=>Ir(A))),onOtherDone:(q,L)=>C0(T7(L),H(q,V.left,B)(J.onOtherDone,(A,M)=>Sv(M,A),(A)=>Er(A)))}))}case Iv:return o8(u(r6(B),rX({onFailure:(U)=>r0(V.f(_9(U))),onSuccess:w9({onLeft:(U)=>r0(V.f(v8(U))),onRight:(U)=>z0(q0(U),()=>W(Ir(V.f)))})})));case Ev:return o8(u(r6(K),rX({onFailure:(U)=>r0(V.f(_9(U))),onSuccess:w9({onLeft:(U)=>r0(V.f(v8(U))),onRight:(U)=>z0(q0(U),()=>W(Er(V.f)))})})))}}return r0(AJ((V)=>{let U=AJ((L)=>{return L.transferChildren(V.scope()),U0}),O=QX(K).pipe(RZ(U),$X(Q)),q=QX(B).pipe(RZ(U),$X(Q));return tJ(O,q,(L,A)=>Sv(L,A))})).pipe(z0(W),I_(Y))})}return C4(Z)});var gr=$(2,(X,J)=>UW(X,(Z)=>mA(()=>oJ(J(Z))))),uv=$(2,(X,J)=>UW(X,J)),V6=$(2,(X,J)=>sX(()=>{let Z=void 0,Q=GX({onInput:(G)=>z0(q0(G),()=>Q),onFailure:(G)=>{return Z=aq0(G),O8(oJ(Z))},onDone:L6}),Y=Z9({onInput:(G)=>z(q0(G),z0(()=>Y)),onFailure:(G)=>zF(G)&&sq0(G.defect)&&_0(G.defect,Z)?$9(G.defect.error):O8(G),onDone:L6});return A8(A8(A8(X,Q),J),Y)}));var iA=(X)=>z0(X,()=>iA(X)),k_=(X)=>eF((J)=>wY(X,J));var hr=(X)=>k_(j4(X)),b_=(X)=>tF((J)=>wY(X,J)),cv=(X)=>o8(U5((J)=>u(wF(),(Z)=>qr(N5(J(E1(X,Z)),(Q)=>I1(Z,_9(Q))),(Q,Y)=>I1(Z,Y))))),fv=(X)=>cG(u(N3,(J)=>z0(r0(X(J)),q0)));var mr=()=>sX(()=>{let X="",J=!1,Z=(Y)=>{let G=[];return p9(Y,(K)=>{if(K.length!==0){let B=0,H=K.indexOf("\r"),W=K.indexOf(`
186
+ `);if(J){if(W===0)G.push(X),X="",B=1,W=K.indexOf(`
187
+ `,B);else X=X+"\r";J=!1}while(H!==-1||W!==-1)if(H===-1||W!==-1&&W<H){if(X.length===0)G.push(K.substring(B,W));else G.push(X+K.substring(B,W)),X="";B=W+1,W=K.indexOf(`
188
+ `,B)}else if(K.length===H+1)J=!0,H=-1;else if(W===H+1){if(X.length===0)G.push(K.substring(B,H));else X=X+K.substring(B,H),G.push(X),X="";B=H+2,H=K.indexOf("\r",B),W=K.indexOf(`
189
+ `,B)}else H=K.indexOf("\r",H+1);if(J)X=X+K.substring(B,K.length-1);else X=X+K.substring(B,K.length)}}),Q8(G)},Q=Z9({onInput:(Y)=>{let G=Z(Y);return T8(G)?Q:z0(q0(G),()=>Q)},onFailure:(Y)=>X.length===0?O8(Y):z0(q0(m0(X)),()=>O8(Y)),onDone:(Y)=>X.length===0?w6(Y):z0(q0(m0(X)),()=>w6(Y))});return Q}),dr=(X)=>iq0(X),ur=(X)=>h(N3,(J)=>$W(X,J)),$W=$(2,(X,J)=>j7(L0(()=>new VW(X,void 0,t)),xQ()).pipe(J9(([Z,Q])=>a$(J,(Y)=>{let G=Z.close(Y);return G!==void 0?o6(G,Q):U0})),xG,u(([Z])=>o0(()=>kr(Z.run(),Z))))),kr=(X,J)=>{let Z=X;switch(Z._tag){case KW:return rX(J.getDone(),{onFailure:MX,onSuccess:(Q)=>y(M0(Q))});case BW:return y(O0(J.getEmit()));case UH:return z(Z.effect,h(()=>kr(J.run(),J)));case HW:return Rv(Z,()=>kr(J.run(),J),(Q)=>MX(Q))}},iq0=(X)=>sX(()=>oq0(X)),oq0=(X)=>{return Z9({onInput:(J)=>z0(r0(g9(X,O0(J))),()=>oq0(X)),onFailure:(J)=>r0(g9(X,M0(_9(J)))),onDone:(J)=>r0(g9(X,M0(v8(J))))})},o8=(X)=>fq0(r0(X)),cG=(X)=>wv(cv(X),(J,Z)=>J,(J,Z)=>J),C4=(X)=>wv(fv(X),(J,Z)=>J,(J,Z)=>J);var pv=function(){let X=typeof arguments[0]!=="string",J=X?arguments[1]:arguments[0],Z=FZ(X?arguments[2]:arguments[1]),Q=SQ([oi(J,Z),EX(),ki,fx(iO0)]);if(X){let Y=arguments[0];return vv(Q,([G,K])=>GW(Y,X9(K,A7,G)),([G,,K,B],H)=>qO(G,H,K,B))}return(Y)=>vv(Q,([G,K])=>GW(Y,X9(K,A7,G)),([G,,K,B],H)=>qO(G,H,K,B))},cr=(...X)=>JZ(f9(X)),JZ=(X)=>rq0(0,X.length,X),rq0=(X,J,Z)=>{return X===J?Y8:z(q0(z(Z,HX(X))),z0(()=>rq0(X+1,J,Z)))},fr=$((X)=>hA(X[1]),(X,J,Z)=>Z?.concurrent?OW(X,{other:J,onSelfDone:(Q)=>NH((Y)=>o0(()=>CE(Q,Y))),onOtherDone:(Q)=>NH((Y)=>o0(()=>CE(Y,Q)))}):z0(X,(Q)=>zW(J,(Y)=>[Q,Y]))),lv=$((X)=>hA(X[1]),(X,J,Z)=>Z?.concurrent?zW(fr(X,J,{concurrent:!0}),(Q)=>Q[0]):z0(X,(Q)=>v_(J,Q))),B9=$((X)=>hA(X[1]),(X,J,Z)=>Z?.concurrent?zW(fr(X,J,{concurrent:!0}),(Q)=>Q[1]):z0(X,()=>J)),kv=Symbol.for("effect/Channel/ChannelException"),aq0=(X)=>({_tag:"ChannelException",[kv]:kv,error:X}),sq0=(X)=>V0(X,kv);var y_=Symbol.for("effect/Sink"),YK8={_A:(X)=>X,_In:(X)=>X,_L:(X)=>X,_E:(X)=>X,_R:(X)=>X};class IJ{channel;[y_]=YK8;constructor(X){this.channel=X}pipe(){return K0(this,arguments)}}var tq0=(X)=>V0(X,y_),g_=(X)=>new IJ(sX(()=>CJ(X())));var pr=()=>new IJ(eq0(a0())),eq0=(X)=>Z9({onInput:(J)=>eq0(z(X,f8(J))),onFailure:O8,onDone:()=>w6(X)}),lr=(X)=>g_(()=>tA(XD0(X,a0()))),XD0=(X,J)=>Z9({onInput:(Z)=>{let[Q,Y]=c2(Z,X);if(Q.length<X)return XD0(X-Q.length,f8(J,Q));if(T8(Y))return w6(f8(J,Q));return z0(q0(Y),()=>w6(f8(J,Q)))},onFailure:O8,onDone:()=>w6(J)});var nr=(X)=>new IJ(z($H(CJ(X)),zW(([J,Z])=>[Z,Mw(J)])));var nv=new IJ(j4(LY()));var rA=(X)=>new IJ($9(X));var aA=(X,J,Z)=>g_(()=>new IJ(JD0(X,J,Z))),JD0=(X,J,Z)=>{if(!J(X))return L6(X);return GX({onInput:(Q)=>{let[Y,G]=ZD0(X,Q,J,Z,0,Q.length);if(FX(G))return z(q0(G),v_(Y));return JD0(Y,J,Z)},onFailure:$9,onDone:()=>L6(X)})},ZD0=(X,J,Z,Q,Y,G)=>{if(Y===G)return[X,a0()];let K=Q(X,z(J,HX(Y)));if(Z(K))return ZD0(K,J,Z,Q,Y+1,G);return[K,z(J,o9(Y+1))]},iv=$(2,(X,J)=>{let Z=z(CJ(X),$H,br({onFailure:(Q)=>CJ(J.onFailure(Q)),onSuccess:([Q,Y])=>sX(()=>{let G={ref:z(Q,s5(FX))},K=z(F3(()=>{let W=G.ref;return G.ref=a0(),W}),z0((W)=>JZ(W))),B=LY(),H=z(K,B9(B),A8(CJ(J.onSuccess(Y))));return z0($H(H),([W,V])=>z(w6(G.ref),z0(JZ),B9(JZ(W)),v_(V)))})}));return new IJ(Z)}),QD0=(X,J,Z)=>g_(()=>new IJ(YD0(X,J,Z))),YD0=(X,J,Z)=>{if(!J(X))return L6(X);return GX({onInput:(Q)=>YD0(Z(X,Q),J,Z),onFailure:$9,onDone:()=>L6(X)})};var ov=(X,J,Z)=>g_(()=>new IJ(GD0(X,J,Z))),GD0=(X,J,Z)=>{if(!J(X))return L6(X);return GX({onInput:(Q)=>z(r0(GK8(X,Q,J,Z)),z0(([Y,G])=>z(G,w0({onNone:()=>GD0(Y,J,Z),onSome:(K)=>z(q0(K),v_(Y))})))),onFailure:$9,onDone:()=>L6(X)})},GK8=(X,J,Z,Q)=>KD0(X,J,0,J.length,Z,Q),KD0=(X,J,Z,Q,Y,G)=>{if(Z===Q)return y([X,S()]);return z(G(X,z(J,HX(Z))),h((K)=>Y(K)?KD0(K,J,Z+1,Q,Y,G):y([K,I(z(J,o9(Z+1)))])))};var h_=(X,J)=>QD0(X,G6,J);var BD0=$(2,(X,J)=>iv(X,{onFailure:rA,onSuccess:J})),sA=(X)=>{let J=Z9({onInput:(Z)=>z(r0(a9(Z,(Q)=>X(Q),{discard:!0})),z0(()=>J)),onFailure:O8,onDone:()=>Y8});return new IJ(J)},rv=(X)=>{let J=Z9({onInput:(Z)=>z(r0(X(Z)),z0(()=>J)),onFailure:O8,onDone:()=>Y8});return new IJ(J)},av=(X)=>{let J=Z9({onInput:(Z)=>HD0(X,Z,0,Z.length,J),onFailure:O8,onDone:()=>Y8});return new IJ(J)},HD0=(X,J,Z,Q,Y)=>{if(Z===Q)return Y;return z(r0(X(z(J,HX(Z)))),z0((G)=>G?HD0(X,J,Z+1,Q,Y):q0(z(J,o9(Z)))),UW((G)=>z(q0(z(J,o9(Z))),B9($9(G)))))};var tA=(X)=>new IJ(X),sv=(X)=>new IJ(r0(X));var ir=()=>aA(S(),j8,(X,J)=>w0(X,{onNone:()=>I(J),onSome:()=>X}));var or=()=>h_(S(),(X,J)=>JJ(Pw(J),()=>X));var rr=$(2,(X,J)=>{return new IJ(z(CJ(X),zW(J)))});var WD0=$(2,(X,J)=>{function Z(Q){return f0(function*(){let Y=yield*bA(J?.capacity??16),G=yield*E1(L3(Y),Q),K=yield*E1(L3(Y),Q),B=dr(Y),H=bv(G).pipe(A8(CJ(X)),lv(r0(mX(G))),OW({other:bv(K).pipe(A8(CJ(J.other)),lv(r0(mX(K)))),onSelfDone:J.onSelfDone,onOtherDone:J.onOtherDone})),W=OW(B,{other:H,onSelfDone:()=>NH(t),onOtherDone:(V)=>zH(V)});return new IJ(W)})}return $D0(Z)});var ar=h_(0,(X,J)=>X+t5(J,0,(Z,Q)=>Z+Q));var CJ=(X)=>VX(X)?CJ(sv(X)):X.channel;var VD0=(X)=>new IJ(cG(X.pipe(u((J)=>CJ(J))))),$D0=(X)=>new IJ(C4((J)=>X(J).pipe(u((Z)=>CJ(Z)))));var sr=$((X)=>tq0(X[1]),(X,J,Z)=>UD0(X,J,(Q,Y)=>Y,Z)),UD0=$((X)=>tq0(X[1]),(X,J,Z,Q)=>Q?.concurrent?WD0(X,{other:J,onSelfDone:rX({onFailure:(Y)=>zH(MX(Y)),onSuccess:(Y)=>NH(rX({onFailure:MX,onSuccess:(G)=>y(Z(Y,G))}))}),onOtherDone:rX({onFailure:(Y)=>zH(MX(Y)),onSuccess:(Y)=>NH(rX({onFailure:MX,onSuccess:(G)=>y(Z(G,Y))}))})}):BD0(X,(Y)=>rr(J,(G)=>Z(Y,G))));var tr=h_(0,(X,J)=>X+J.length),er=g_(()=>{let X=[];return z(h_(void 0,(J,Z)=>p9(Z,(Q)=>{X.push(String(Q))})),rr(()=>X.join("")))});var ND0=zH,OD0=NH;var _D0=Symbol.for("effect/RcRef"),Xa={_tag:"Empty"},BK8={_tag:"Closed"},HK8={_A:t,_E:t};class qD0 extends fJ{acquire;context;scope;idleTimeToLive;[_D0]=HK8;[AG]=AG;state=Xa;semaphore=S1(1);constructor(X,J,Z,Q){super();this.acquire=X,this.context=J,this.scope=Z,this.idleTimeToLive=Q,this.get=Ja(this)}get;commit(){return this.get}}var DD0=(X)=>M8((J)=>{let Z=J.getFiberRef(F7),Q=z9(Z,iJ),Y=new qD0(X.acquire,Z,Q,X.idleTimeToLive?K9(X.idleTimeToLive):void 0);return l9(Q.addFinalizer(()=>Y.semaphore.withPermits(1)(I0(()=>{let G=Y.state._tag==="Acquired"?RQ(Y.state.scope,oX):N8;return Y.state=BK8,G}))),Y)}),Ja=(X)=>{let J=X,Z=J.idleTimeToLive&&!bK(J.idleTimeToLive);return kX((Q)=>I0(()=>{switch(J.state._tag){case"Closed":return nX;case"Acquired":return J.state.refCount++,J.state.fiber?l9(qG(J.state.fiber),J.state):o(J.state);case"Empty":return H5().pipe(uL("scope"),dL("value",({scope:Y})=>Q(iX(J.acquire,F7,X9(J.context,iJ,Y)))),N0(({scope:Y,value:G})=>{let K={_tag:"Acquired",value:G,scope:Y,fiber:void 0,refCount:1};return J.state=K,K}))}})).pipe(J.semaphore.withPermits(1),uL("state"),dL("scope",()=>iJ),i6(({scope:Q,state:Y})=>Q.addFinalizer(()=>I0(()=>{if(Y.refCount--,Y.refCount>0||Z)return N8;if(J.idleTimeToLive===void 0)return J.state=Xa,RQ(Y.scope,oX);return Q3(J.idleTimeToLive).pipe(OG,i8(I0(()=>{if(J.state._tag==="Acquired"&&J.state.refCount===0)return J.state=Xa,RQ(Y.scope,oX);return N8})),MZ(B0(()=>{Y.fiber=void 0})),x1(J.scope),i6((G)=>{Y.fiber=G}),J.semaphore.withPermits(1))}))),N0(({state:Q})=>Q.value))};var tv=DD0,eA=Ja;var KQ=bO;var ev=_S,A3=CG;var XT=qS;var LD0=iV0;var FD0=aS;var _W=cF;var AD0=cO;var TD0=Oi;var qW=Pz0;var Xk=YU;var MD0="Left",PD0="Right",RD0="Both",jD0="Either";var CD0={_tag:MD0},ID0={_tag:PD0},Za={_tag:RD0},ED0={_tag:jD0},Qa=(X)=>{switch(X){case"left":return CD0;case"right":return ID0;case"both":return Za;case"either":return ED0;default:return X}};var xD0=Za;class JT{value;constructor(X){this.value=X}}var Ya=(X,J)=>({ref:X,isNew:J,isChanged:!1,expected:X.versioned,newValue:X.versioned.value}),Ga=(X)=>{return X.newValue},Ka=(X,J)=>{X.isChanged=!0,X.newValue=J},kD0=(X)=>{X.ref.versioned=new JT(X.newValue)};var bD0=(X)=>{return X.ref.versioned!==X.expected},yD0=(X)=>{return X.isChanged};var ZT="Invalid",Zk="ReadWrite",UK8="ReadOnly",Ba=(X)=>{for(let J of X)kD0(J[1])},Ha=(X)=>{let J=UK8;for(let[,Z]of X)if(J=bD0(Z)?ZT:yD0(Z)?Zk:J,J===ZT)return J;return J};var hD0=(X)=>{let J=new Map;for(let[,Z]of X){for(let Q of Z.ref.todos)J.set(Q[0],Q[1]);Z.ref.todos=new Map}return J},mD0=(X)=>{let J=Array.from(X.entries()).sort((Z,Q)=>Z[0]-Q[0]);for(let[Z,Q]of J)Q()},dD0=(X,J,Z)=>{let Q=!1;for(let[,Y]of J)if(!Y.ref.todos.has(X))Y.ref.todos.set(X,Z),Q=!0;return Q};var Wa="WithSTMRuntime",Qk="OnFailure",Va="OnRetry",Yk="OnSuccess",uD0="Provide",$a="Sync",Ua="Succeed",za="Retry",Na="Fail",Oa="Die",_a="Interrupt";var OH="Fail",_H="Die",qH="Interrupt",T3="Succeed",DH="Retry";var QT="Done",YT="Suspend";var GT="Done",Gk="Interrupted",KT="Running";var Bk="effect/STM/State",bU=Symbol.for(Bk),Da=(X)=>V0(X,bU),wa=(X)=>{return X._tag===KT},fD0=(X)=>{return X._tag===GT};var Kk=(X)=>{return{[bU]:bU,_tag:GT,exit:X,[y0](){return z(Z0(Bk),A0(Z0(GT)),A0(Z0(X)),W8(this))},[b0](J){return Da(J)&&J._tag===GT&&_0(X,J.exit)}}},_K8=z(Z0(Bk),A0(Z0(Gk)),A0(Z0("interrupted"))),pD0={[bU]:bU,_tag:Gk,[y0](){return _K8},[b0](X){return Da(X)&&X._tag===Gk}},qK8=z(Z0(Bk),A0(Z0(KT)),A0(Z0("running"))),lD0={[bU]:bU,_tag:KT,[y0](){return qK8},[b0](X){return Da(X)&&X._tag===KT}},BT=(X)=>{switch(X._tag){case OH:return Kk(WX(X.error));case _H:return Kk(Y5(X.defect));case qH:return Kk(T1(X.fiberId));case T3:return Kk(v8(X.value));case DH:throw Error("BUG: STM.STMState.fromTExit - please report an issue at https://github.com/Effect-TS/effect/issues")}};var d_="effect/TExit",u_=Symbol.for(d_),HT={_A:(X)=>X,_E:(X)=>X},WT=(X)=>V0(X,u_);var nD0=(X)=>{return X._tag===T3},wK8=(X)=>{return X._tag===DH},iD0=(X)=>({[u_]:HT,_tag:OH,error:X,[y0](){return z(Z0(d_),A0(Z0(OH)),A0(Z0(X)),W8(this))},[b0](J){return WT(J)&&J._tag===OH&&_0(X,J.error)}}),oD0=(X)=>({[u_]:HT,_tag:_H,defect:X,[y0](){return z(Z0(d_),A0(Z0(_H)),A0(Z0(X)),W8(this))},[b0](J){return WT(J)&&J._tag===_H&&_0(X,J.defect)}}),rD0=(X)=>({[u_]:HT,_tag:qH,fiberId:X,[y0](){return z(Z0(d_),A0(Z0(qH)),A0(Z0(X)),W8(this))},[b0](J){return WT(J)&&J._tag===qH&&_0(X,J.fiberId)}}),La=(X)=>({[u_]:HT,_tag:T3,value:X,[y0](){return z(Z0(d_),A0(Z0(T3)),A0(Z0(X)),W8(this))},[b0](J){return WT(J)&&J._tag===T3&&_0(X,J.value)}}),LK8=z(Z0(d_),A0(Z0(DH)),A0(Z0("retry"))),aD0={[u_]:HT,_tag:DH,[y0](){return LK8},[b0](X){return WT(X)&&wK8(X)}};var sD0=(X)=>{return{_tag:QT,exit:X}},Fa=(X)=>{return{_tag:YT,journal:X}};var tD0={ref:0},eD0=()=>{let X=tD0.ref+1;return tD0.ref=X,X};var MK8="effect/STM",PK8=Symbol.for(MK8),Hk={_R:(X)=>X,_E:(X)=>X,_A:(X)=>X};class M3{effect_instruction_i0;_op=WB;effect_instruction_i1=void 0;effect_instruction_i2=void 0;[Bx];[Kw];[y_];[j_];get[PK8](){return Hk}constructor(X){this.effect_instruction_i0=X,this[Bx]=FK,this[Kw]=Hk,this[y_]=Hk,this[j_]=Hk}[b0](X){return this===X}[y0](){return W8(this,cV(this))}[Symbol.iterator](){return new G1(new GG(this))}commit(){return Xw0(this,O6,O6)}pipe(){return K0(this,arguments)}}var Xw0=(X,J,Z)=>M8((Q)=>{let Y=Q.id(),G=Q.getFiberRef(yQ),K=Q.getFiberRef(px),B=Q.getFiberRef(lO0),H=jK8(Y,X,G,K,B);switch(H._tag){case QT:return J(H.exit),H.exit;case YT:{let W=eD0(),V={value:lD0},U=b6((O)=>Jw0(Y,X,W,V,G,K,B,O));return U5((O)=>z(O(U),s9((q)=>{let L=V.value;if(wa(L))V.value=pD0;if(L=V.value,fD0(L))return J(L.exit),L.exit;return Z(),MX(q)})))}}}),RK8=(X,J,Z,Q,Y,G)=>{let K=new Map,B=new Ta(J,K,X,Q).run(),H=Ha(K);if(H===Zk)Ba(K);else if(H===ZT)throw Error("BUG: STM.TryCommit.tryCommit - please report an issue at https://github.com/Effect-TS/effect/issues");switch(B._tag){case T3:return Z.value=BT(B),DW(v8(B.value),K,Y,G);case OH:{Z.value=BT(B);let W=N4(B.error);return DW(_9(W),K,Y,G)}case _H:{Z.value=BT(B);let W=oJ(B.defect);return DW(_9(W),K,Y,G)}case qH:{Z.value=BT(B);let W=R1(X);return DW(_9(W),K,Y,G)}case DH:return Fa(K)}},jK8=(X,J,Z,Q,Y)=>{let G=new Map,K=new Ta(J,G,X,Z).run(),B=Ha(G);if(B===Zk&&nD0(K))Ba(G);else if(B===ZT)throw Error("BUG: STM.TryCommit.tryCommitSync - please report an issue at https://github.com/Effect-TS/effect/issues");switch(K._tag){case T3:return DW(v8(K.value),G,Q,Y);case OH:{let H=N4(K.error);return DW(_9(H),G,Q,Y)}case _H:{let H=oJ(K.defect);return DW(_9(H),G,Q,Y)}case qH:{let H=R1(X);return DW(_9(H),G,Q,Y)}case DH:return Fa(G)}},Jw0=(X,J,Z,Q,Y,G,K,B)=>{if(wa(Q.value)){let H=RK8(X,J,Q,Y,G,K);switch(H._tag){case QT:{CK8(H.exit,B);break}case YT:{dD0(Z,H.journal,()=>Jw0(X,J,Z,Q,Y,G,K,B));break}}}},DW=(X,J,Z,Q)=>{let Y=hD0(J);if(Y.size>0)Z.scheduleTask(()=>mD0(Y),Q);return sD0(X)},CK8=(X,J)=>{J(X)};class Ta{self;journal;fiberId;contStack=[];env;constructor(X,J,Z,Q){this.self=X,this.journal=J,this.fiberId=Z,this.env=Q}getEnv(){return this.env}pushStack(X){this.contStack.push(X)}popStack(){return this.contStack.pop()}nextSuccess(){let X=this.popStack();while(X!==void 0&&X.effect_instruction_i0!==Yk)X=this.popStack();return X}nextFailure(){let X=this.popStack();while(X!==void 0&&X.effect_instruction_i0!==Qk)X=this.popStack();return X}nextRetry(){let X=this.popStack();while(X!==void 0&&X.effect_instruction_i0!==Va)X=this.popStack();return X}run(){let X=this.self,J=void 0;while(J===void 0&&X!==void 0)try{let Z=X;if(Z)switch(Z._op){case"Tag":{X=I4((Q,Y,G)=>x6(G,Z));break}case"Left":{X=Wk(Z.left);break}case"None":{X=Wk(new OF);break}case"Right":{X=UX(Z.right);break}case"Some":{X=UX(Z.value);break}case"Commit":{switch(Z.effect_instruction_i0){case Oa:{J=oD0(JX(()=>Z.effect_instruction_i1()));break}case Na:{let Q=this.nextFailure();if(Q===void 0)J=iD0(JX(()=>Z.effect_instruction_i1()));else X=JX(()=>Q.effect_instruction_i2(JX(()=>Z.effect_instruction_i1())));break}case za:{let Q=this.nextRetry();if(Q===void 0)J=aD0;else X=JX(()=>Q.effect_instruction_i2());break}case _a:{J=rD0(this.fiberId);break}case Wa:{X=JX(()=>Z.effect_instruction_i1(this));break}case Yk:case Qk:case Va:{this.pushStack(Z),X=Z.effect_instruction_i1;break}case uD0:{let Q=this.env;this.env=JX(()=>Z.effect_instruction_i2(Q)),X=z(Z.effect_instruction_i1,IK8(VT(()=>this.env=Q)));break}case Ua:{let Q=Z.effect_instruction_i1,Y=this.nextSuccess();if(Y===void 0)J=La(Q);else X=JX(()=>Y.effect_instruction_i2(Q));break}case $a:{let Q=JX(()=>Z.effect_instruction_i1()),Y=this.nextSuccess();if(Y===void 0)J=La(Q);else X=JX(()=>Y.effect_instruction_i2(Q));break}}break}}}catch(Z){X=Qw0(Z)}return J}}var Zw0=$(2,(X,J)=>{let Z=new M3(Qk);return Z.effect_instruction_i1=X,Z.effect_instruction_i2=J,Z});var Qw0=(X)=>Yw0(()=>X);var Yw0=(X)=>{let J=new M3(Oa);return J.effect_instruction_i1=X,J},I4=(X)=>EJ((J)=>UX(X(J.journal,J.fiberId,J.getEnv()))),IK8=$(2,(X,J)=>Kw0(X,{onFailure:(Z)=>Aa(J,Wk(Z)),onSuccess:(Z)=>Aa(J,UX(Z))})),Wk=(X)=>Gw0(()=>X),Gw0=(X)=>{let J=new M3(Na);return J.effect_instruction_i1=X,J},gQ=$(2,(X,J)=>{let Z=new M3(Yk);return Z.effect_instruction_i1=X,Z.effect_instruction_i2=J,Z}),Kw0=$(2,(X,{onFailure:J,onSuccess:Z})=>z(X,xZ(O0),Zw0((Q)=>z(J(Q),xZ(M0))),gQ((Q)=>{switch(Q._tag){case"Left":return UX(Q.left);case"Right":return Z(Q.right)}}))),EJ=(X)=>{let J=new M3(Wa);return J.effect_instruction_i1=X,J};var vZ=(X)=>{let J=new M3(_a);return J.effect_instruction_i1=X,J},xZ=$(2,(X,J)=>z(X,gQ((Z)=>VT(()=>J(Z)))));var FY=new M3(za),UX=(X)=>{let J=new M3(Ua);return J.effect_instruction_i1=X,J},VT=(X)=>{let J=new M3($a);return J.effect_instruction_i1=X,J};var Aa=$(2,(X,J)=>z(X,gQ(()=>J))),Bw0=$(3,(X,J,Z)=>z(X,gQ((Q)=>z(J,xZ((Y)=>Z(Q,Y))))));var $T="BackPressure",UT="Dropping",zT="Sliding";var EK8=$(2,(X,J)=>z(X,xZ(()=>J)));var SK8=(X)=>gQ(X,t);var NT=$((X)=>oQ(X[0]),(X,J,Z)=>{if(Z?.discard)return z(VT(()=>X[Symbol.iterator]()),gQ((Q)=>{let Y=Ma(()=>{let G=Q.next();if(G.done)return yU;return z(J(G.value),gQ(()=>Y))});return Y}));return Ma(()=>v0(X).reduce((Q,Y)=>Bw0(Q,J(Y),(G,K)=>{return G.push(K),G}),UX([])))});var Ww0=(X,J)=>{if(Symbol.iterator in X)return NT(X,t,J);else if(J?.discard)return NT(Object.values(X),t,J);return xZ(NT(Object.entries(X),([Z,Q])=>xZ(Q,(Y)=>[Z,Y])),(Z)=>{let Q={};for(let[Y,G]of Z)Q[Y]=G;return Q})};var Ma=(X)=>SK8(VT(X)),Pa=$(2,(X,J)=>gQ(X,(Z)=>EK8(J(Z),Z)));var yU=UX(void 0);var xK8="effect/TRef",vK8=Symbol.for(xK8),kK8={_A:(X)=>X};class OT{[vK8]=kK8;todos;versioned;constructor(X){this.versioned=new JT(X),this.todos=new Map}modify(X){return I4((J)=>{let Z=Ca(this,J),[Q,Y]=X(Ga(Z));return Ka(Z,Y),Q})}pipe(){return K0(this,arguments)}}var Ra=(X)=>I4((J)=>{let Z=new OT(X);return J.set(Z,Ya(Z,!0)),Z}),$k=(X)=>X.modify((J)=>[J,J]),ja=$(2,(X,J)=>X.modify(()=>[void 0,J]));var Ca=(X,J)=>{if(J.has(X))return J.get(X);let Z=Ya(X,!1);return J.set(X,Z),Z},S9=$(2,(X,J)=>Ga(Ca(X,J))),h9=$(3,(X,J,Z)=>{let Q=Ca(X,Z);Ka(Q,J);return});var bK8="effect/TQueue/TEnqueue",Uk=Symbol.for(bK8),yK8="effect/TQueue/TDequeue",zk=Symbol.for(yK8);var Ia={_Out:(X)=>X},Ea={_In:(X)=>X};class gK8{ref;requestedCapacity;strategy;[zk]=Ia;[Uk]=Ea;constructor(X,J,Z){this.ref=X,this.requestedCapacity=J,this.strategy=Z}capacity(){return this.requestedCapacity}size=EJ((X)=>{let J=S9(this.ref,X.journal);if(J===void 0)return vZ(X.fiberId);return UX(J.length)});isFull=xZ(this.size,(X)=>X===this.requestedCapacity);isEmpty=xZ(this.size,(X)=>X===0);shutdown=EJ((X)=>{return h9(this.ref,void 0,X.journal),yU});isShutdown=I4((X)=>{return S9(this.ref,X)===void 0});awaitShutdown=gQ(this.isShutdown,(X)=>X?yU:FY);offer(X){return EJ((J)=>{let Z=z(this.ref,S9(J.journal));if(Z===void 0)return vZ(J.fiberId);if(Z.length<this.requestedCapacity)return Z.push(X),h9(this.ref,Z,J.journal),UX(!0);switch(this.strategy._tag){case $T:return FY;case UT:return UX(!1);case zT:{if(Z.length===0)return UX(!0);return Z.shift(),Z.push(X),h9(this.ref,Z,J.journal),UX(!0)}}})}offerAll(X){return EJ((J)=>{let Z=Array.from(X),Q=S9(this.ref,J.journal);if(Q===void 0)return vZ(J.fiberId);if(Q.length+Z.length<=this.requestedCapacity)return h9(this.ref,[...Q,...Z],J.journal),UX(!0);switch(this.strategy._tag){case $T:return FY;case UT:{let Y=Z.slice(0,this.requestedCapacity-Q.length);return h9(this.ref,[...Q,...Y],J.journal),UX(!1)}case zT:{let Y=Z.slice(0,this.requestedCapacity-Q.length),G=Q.length+Y.length-this.requestedCapacity,K=Q.slice(G);return h9(this.ref,[...K,...Y],J.journal),UX(!0)}}})}peek=EJ((X)=>{let J=S9(this.ref,X.journal);if(J===void 0)return vZ(X.fiberId);if(J.length===0)return FY;return UX(J[0])});peekOption=EJ((X)=>{let J=S9(this.ref,X.journal);if(J===void 0)return vZ(X.fiberId);return UX(x8(J[0]))});take=EJ((X)=>{let J=S9(this.ref,X.journal);if(J===void 0)return vZ(X.fiberId);if(J.length===0)return FY;let Z=J.shift();return h9(this.ref,J,X.journal),UX(Z)});takeAll=EJ((X)=>{let J=S9(this.ref,X.journal);if(J===void 0)return vZ(X.fiberId);return h9(this.ref,[],X.journal),UX(J)});takeUpTo(X){return EJ((J)=>{let Z=S9(this.ref,J.journal);if(Z===void 0)return vZ(J.fiberId);let[Q,Y]=c2(Q8(Z),X);return h9(this.ref,Array.from(Y),J.journal),UX(Array.from(Q))})}}var Uw0=(X)=>X.isShutdown;var Sa=(X)=>X.shutdown;var zw0=(X)=>X.take;var hK8="effect/TPubSub",Nk=Symbol.for(hK8),w5=Symbol.for("effect/TPubSub/AbsentValue"),wH=(X,J,Z)=>({head:X,subscribers:J,tail:Z});class mK8{pubsubSize;publisherHead;publisherTail;requestedCapacity;strategy;subscriberCount;subscribers;[Nk]={_A:(X)=>X};[Uk]=Ea;constructor(X,J,Z,Q,Y,G,K){this.pubsubSize=X,this.publisherHead=J,this.publisherTail=Z,this.requestedCapacity=Q,this.strategy=Y,this.subscriberCount=G,this.subscribers=K}isShutdown=I4((X)=>{return S9(this.publisherTail,X)===void 0});awaitShutdown=gQ(this.isShutdown,(X)=>X?yU:FY);capacity(){return this.requestedCapacity}size=EJ((X)=>{if(S9(this.publisherTail,X.journal)===void 0)return vZ(X.fiberId);return UX(S9(this.pubsubSize,X.journal))});isEmpty=xZ(this.size,(X)=>X===0);isFull=xZ(this.size,(X)=>X===this.capacity());offer(X){return EJ((J)=>{let Z=S9(this.publisherTail,J.journal);if(Z===void 0)return vZ(J.fiberId);let Q=S9(this.subscriberCount,J.journal);if(Q===0)return UX(!0);let Y=S9(this.pubsubSize,J.journal);if(Y<this.requestedCapacity){let G=new OT(void 0),K=wH(X,Q,G);return h9(Z,K,J.journal),h9(this.publisherTail,G,J.journal),h9(this.pubsubSize,Y+1,J.journal),UX(!0)}switch(this.strategy._tag){case $T:return FY;case UT:return UX(!1);case zT:{if(this.requestedCapacity>0){let B=S9(this.publisherHead,J.journal),H=!0;while(H){let W=S9(B,J.journal);if(W===void 0)return FY;let{head:V,tail:U}=W;if(V!==w5){let O=wH(w5,W.subscribers,W.tail);h9(B,O,J.journal),h9(this.publisherHead,U,J.journal),H=!1}else B=U}}let G=new OT(void 0),K=wH(X,Q,G);return h9(Z,K,J.journal),h9(this.publisherTail,G,J.journal),UX(!0)}}})}offerAll(X){return xZ(NT(X,(J)=>this.offer(J)),ww(t))}shutdown=I4((X)=>{if(S9(this.publisherTail,X)!==void 0){h9(this.publisherTail,void 0,X);let Z=S9(this.subscribers,X);e50(Z,(Q)=>{h9(Q,void 0,X)}),h9(this.subscribers,YY(),X)}})}class Ow0{pubsubSize;publisherHead;requestedCapacity;subscriberHead;subscriberCount;subscribers;[Nk]=Nk;[zk]=Ia;constructor(X,J,Z,Q,Y,G){this.pubsubSize=X,this.publisherHead=J,this.requestedCapacity=Z,this.subscriberHead=Q,this.subscriberCount=Y,this.subscribers=G}isShutdown=I4((X)=>{return S9(this.subscriberHead,X)===void 0});awaitShutdown=gQ(this.isShutdown,(X)=>X?yU:FY);capacity(){return this.requestedCapacity}size=EJ((X)=>{let J=S9(this.subscriberHead,X.journal);if(J===void 0)return vZ(X.fiberId);let Z=!0,Q=0;while(Z){let Y=S9(J,X.journal);if(Y===void 0)Z=!1;else{let{head:G,tail:K}=Y;if(G!==w5){if(Q=Q+1,Q>=Number.MAX_SAFE_INTEGER)Z=!1}J=K}}return UX(Q)});isEmpty=xZ(this.size,(X)=>X===0);isFull=xZ(this.size,(X)=>X===this.capacity());peek=EJ((X)=>{let J=S9(this.subscriberHead,X.journal);if(J===void 0)return vZ(X.fiberId);let Z=w5,Q=!0;while(Q){let Y=S9(J,X.journal);if(Y===void 0)return FY;let{head:G,tail:K}=Y;if(G!==w5)Z=G,Q=!1;else J=K}return UX(Z)});peekOption=EJ((X)=>{let J=S9(this.subscriberHead,X.journal);if(J===void 0)return vZ(X.fiberId);let Z=S(),Q=!0;while(Q){let Y=S9(J,X.journal);if(Y===void 0)Z=S(),Q=!1;else{let{head:G,tail:K}=Y;if(G!==w5)Z=I(G),Q=!1;else J=K}}return UX(Z)});shutdown=I4((X)=>{let J=S9(this.subscriberHead,X);if(J!==void 0){h9(this.subscriberHead,void 0,X);let Z=!0;while(Z){let Y=S9(J,X);if(Y===void 0)Z=!1;else{let{head:G,tail:K}=Y;if(G!==w5){let B=Y.subscribers;if(B===1){let H=S9(this.pubsubSize,X),W=wH(w5,0,K);h9(J,W,X),h9(this.publisherHead,K,X),h9(this.pubsubSize,H-1,X)}else{let H=wH(G,B-1,K);h9(J,H,X)}}J=K}}let Q=S9(this.subscriberCount,X);h9(this.subscriberCount,Q-1,X),h9(this.subscribers,PB(S9(this.subscribers,X),this.subscriberHead),X)}});take=EJ((X)=>{let J=S9(this.subscriberHead,X.journal);if(J===void 0)return vZ(X.fiberId);let Z=w5,Q=!0;while(Q){let Y=S9(J,X.journal);if(Y===void 0)return FY;let{head:G,tail:K}=Y;if(G!==w5){let B=Y.subscribers;if(B===1){let H=S9(this.pubsubSize,X.journal),W=wH(w5,0,K);h9(J,W,X.journal),h9(this.publisherHead,K,X.journal),h9(this.pubsubSize,H-1,X.journal)}else{let H=wH(G,B-1,K);h9(J,H,X.journal)}h9(this.subscriberHead,K,X.journal),Z=G,Q=!1}else J=K}return UX(Z)});takeAll=this.takeUpTo(Number.POSITIVE_INFINITY);takeUpTo(X){return EJ((J)=>{let Z=S9(this.subscriberHead,J.journal);if(Z===void 0)return vZ(J.fiberId);let Q=[],Y=0;while(Y!==X){let G=S9(Z,J.journal);if(G===void 0)Y=X;else{let{head:K,tail:B}=G;if(K!==w5){let H=G.subscribers;if(H===1){let W=S9(this.pubsubSize,J.journal),V=wH(w5,0,B);h9(Z,V,J.journal),h9(this.publisherHead,B,J.journal),h9(this.pubsubSize,W-1,J.journal)}else{let W=wH(K,H-1,B);h9(Z,W,J.journal)}Q.push(K),Y=Y+1}Z=B}}return h9(this.subscriberHead,Z,J.journal),UX(Q)})}}var dK8=(X,J,Z,Q,Y,G)=>z($k(Z),gQ((K)=>z(Ww0([Ra(K),$k(Y),$k(G)]),Pa(([B,H])=>z(Y,ja(H+1))),Pa(([B,H,W])=>z(G,ja(z(W,iY(B))))),xZ(([B])=>new Ow0(X,J,Q,B,Y,G)))));var _w0=(X)=>dK8(X.pubsubSize,X.publisherHead,X.publisherTail,X.requestedCapacity,X.subscriberCount,X.subscribers),qw0=(X)=>A9(_w0(X),(J)=>Sa(J));var Dw0=qw0;var ww0=Uw0;var Lw0=zw0;class _T{capacity;array;size=0;current=0;constructor(X){this.capacity=X,this.array=Array.from({length:X},KB)}head(){return x8(this.array[this.current])}lastOrNull(){if(this.size===0)return;let X=this.current===0?this.array.length-1:this.current-1;return this.array[X]??void 0}put(X){this.array[this.current]=X,this.increment()}dropLast(){if(this.size>0)this.decrement(),this.array[this.current]=void 0}toChunk(){let X=this.current-this.size,J=X<0?[...this.array.slice(this.capacity+X,this.capacity),...this.array.slice(0,this.current)]:this.array.slice(X,this.current);return f9(J)}increment(){if(this.size<this.capacity)this.size+=1;this.current=(this.current+1)%this.capacity}decrement(){if(this.size-=1,this.current>0)this.current-=1;else this.current=this.capacity-1}}var Fw0="NotStarted",Aw0="Previous",Tw0="Current",Mw0={_tag:"NotStarted"},Pw0=(X)=>({_tag:"Previous",fiber:X}),Rw0=(X)=>({_tag:"Current",fiber:X});var Ok=(X)=>{return Object.assign(X,{chunk(Z){return this(y(Z))},die(Z){return this(P7(Z))},dieMessage(Z){return this(SG(Z))},done(Z){return this(o0(()=>jE(Z,{onFailure:I,onSuccess:m0})))},end(){return this(Y0(S()))},fail(Z){return this(Y0(I(Z)))},fromEffect(Z){return this(vG(Z,{onFailure:I,onSuccess:m0}))},fromEffectChunk(Z){return this(z(Z,E9(I)))},halt(Z){return this(MX(z(Z,JQ(I))))},single(Z){return this(y(m0(Z)))}})},jw0=(X,J)=>{let Z=!1,Q=[],Y=!1;function G(H){if(Z)return!1;if(H.length<=50000)Q.push.apply(Q,H);else for(let W=0;W<H.length;W++)Q.push(H[0]);if(!Y)Y=!0,J.scheduleTask(K,0);return!0}function K(){if(Y=!1,Q.length>0)X.unsafeOffer(Q),Q=[]}function B(H){if(Z)return;if(Z=!0,H._tag==="Success")Q.push(H.value);K(),X.unsafeOffer(H._tag==="Success"?eZ:H)}return{single(H){if(Z)return!1;if(Q.push(H),!Y)Y=!0,J.scheduleTask(K,0);return!0},array:G,chunk(H){return G(G9(H))},done:B,end(){if(Z)return;Z=!0,K(),X.unsafeOffer(eZ)},halt(H){return B(_9(H))},fail(H){return B(WX(H))},die(H){return B(Y5(H))},dieMessage(H){return B(Y5(Error(H)))}}};var nK8=Symbol.for("effect/Stream/Handoff"),Cw0="Empty",Iw0="Full",Ew0=(X)=>({_tag:Cw0,notifyConsumer:X}),iK8=(X,J)=>({_tag:Iw0,value:X,notifyProducer:J}),Sw0=(X,J)=>{return(Z)=>{switch(Z._tag){case Cw0:return X(Z.notifyConsumer);case Iw0:return J(Z.value,Z.notifyProducer)}}},oK8={_A:(X)=>X},AY=()=>z(F9(),h((X)=>bX(Ew0(X))),u((X)=>({[nK8]:oK8,ref:X}))),tX=$(2,(X,J)=>{return h(F9(),(Z)=>sJ(Q5(X.ref,(Q)=>z(Q,Sw0((Y)=>[C0(H6(Y,void 0),h8(Z)),iK8(J,Z)],(Y,G)=>[h(h8(G),()=>z(X,tX(J))),Q])))))}),TY=(X)=>h(F9(),(J)=>sJ(Q5(X.ref,(Z)=>z(Z,Sw0((Q)=>[h(h8(Q),()=>TY(X)),Z],(Q,Y)=>[y9(H6(Y,void 0),Q),Ew0(J)])))));var qT="Emit",DT="Halt",wT="End",xa=(X)=>({_tag:"Emit",elements:X}),_k=(X)=>({_tag:"Halt",cause:X}),LT=(X)=>({_tag:"End",reason:X});var sK8="effect/Take",tK8=Symbol.for(sK8),eK8={_A:(X)=>X,_E:(X)=>X};class gU{exit;[tK8]=eK8;constructor(X){this.exit=X}pipe(){return K0(this,arguments)}}var LH=(X)=>new gU(v8(X));var c_=(X)=>o0(()=>X.exit),fG=new gU(WX(S()));var FH=(X)=>new gU(_9(z(X,JQ(I))));var qk=(X)=>QH(X,{onFailure:(J)=>w0(o$(J),{onNone:()=>fG,onSome:FH}),onSuccess:LH});var f_=$(2,(X,{onEnd:J,onFailure:Z,onSuccess:Q})=>rX(X.exit,{onFailure:(Y)=>w0(o$(Y),{onNone:J,onSome:Z}),onSuccess:Q}));var Dk=(X)=>new gU(v8(m0(X)));var FT=()=>Y0(S());var wk=(X)=>E9(MX(X),I);var va="ScheduleEnd",vw0="UpstreamEnd",p_={_tag:"ScheduleEnd"},ka={_tag:"UpstreamEnd"};var ba="DrainLeft",ya="DrainRight",ga="PullBoth",ha="PullLeft",ma="PullRight",wW={_tag:"DrainLeft"},LW={_tag:"DrainRight"},FW={_tag:"PullBoth"},AH=(X)=>({_tag:"PullLeft",rightChunk:X}),TH=(X)=>({_tag:"PullRight",leftChunk:X});var kw0="PullBoth",bw0="PullLet",yw0="PullRight",AT={_tag:"PullBoth"},TT=(X)=>({_tag:"PullLet",rightChunk:X}),MT=(X)=>({_tag:"PullRight",leftChunk:X});var Y38="effect/Stream",Tk=Symbol.for(Y38),G38={_R:(X)=>X,_E:(X)=>X,_A:(X)=>X};class x0{channel;[Tk]=G38;constructor(X){this.channel=X}pipe(){return K0(this,arguments)}}var hQ=(X)=>V0(X,Tk)||VX(X),n_=4096,uw0=(X)=>RT(da(X)),da=(X)=>{let J=(Z)=>GX({onInput:(Q)=>{let Y=f8(Z,Q);return z0(q0(Y),()=>J(Y))},onFailure:$9,onDone:()=>Y8});return new x0(A8(j0(X),J(a0())))},ua=(X,J)=>cU(A9(X,J)),cw0=$(2,(X,J)=>Mk(X,J,AD0)),Mk=$(3,(X,J,Z)=>MW(ca(X,J,Z),(Q)=>w9(Q,{onLeft:S,onRight:I}))),ca=$(3,(X,J,Z)=>{let Q=SQ([AY(),bX(p_),bX(a0()),_W(Z),bX(!1),bX(!1)]);return F6(Q).pipe(m6(([Y,G,K,B,H,W])=>{let V=Z9({onInput:(L)=>z0(r0(z(Y,tX(xa(L)),A4(()=>FX(L)))),()=>V),onFailure:(L)=>r0(tX(Y,_k(L))),onDone:()=>r0(tX(Y,LT(ka)))}),U=z(UE(K,a0()),h((L)=>{if(FX(L))return z(pJ(H,!0),C0(y(z(q0(L),z0(()=>U)))));return z(TY(Y),u((A)=>{switch(A._tag){case qT:return z(r0(pJ(H,!0)),B9(q0(A.elements)),B9(r0(ZX(W))),z0((M)=>M?Y8:U));case DT:return O8(A.cause);case wT:{if(A.reason._tag===va)return z(ZX(H),u((M)=>M?r0(z(pJ(G,p_),C0(pJ(W,!0)))):z(r0(z(pJ(G,p_),C0(pJ(W,!0)))),z0(()=>U))),o8);return z(pJ(G,A.reason),C0(pJ(W,!0)),r0)}}}))}),o8),O=(L)=>B.next(L),q=(L,A,M)=>{let x=z(pJ(H,!1),C0(pJ(W,!1)),C0(z(U,V6(CJ(J)),$H,k_,$X(M)))),j=(T,E,k)=>z(pJ(K,Mw(T)),C0(u(ZX(G),(P)=>{switch(P._tag){case va:return z(SQ([ZX(H),x,z(O(I(E)),$X(M))]),u(([C,v,f])=>{let s=z(k,w0({onNone:()=>m0(O0(E)),onSome:(l)=>LB(O0(E),M0(l))}));if(C)return z(q0(s),z0(()=>q(v,f,M)));return q(v,f,M)}),o8);case vw0:return z(ZX(H),u((C)=>C?q0(m0(O0(E))):Y8),o8)}})),o8);return o8(n1(EQ(L),EQ(A),{onSelfDone:(T,E)=>z(T7(A),C0(z(o0(()=>T),u(([k,P])=>j(k,P,S()))))),onOtherDone:(T,E)=>a6(o0(()=>T),{onFailure:(k)=>w9(jG(k),{onLeft:()=>z(Y,tX(LT(p_)),F4,C0(z(EQ(L),u(([P,C])=>j(P,C,S()))))),onRight:(P)=>z(Y,tX(_k(P)),F4,C0(z(EQ(L),u(([C,v])=>j(C,v,S())))))}),onSuccess:(k)=>z(Y,tX(LT(p_)),F4,C0(z(EQ(L),u(([P,C])=>j(P,C,I(k))))))})}))};return t_((L)=>A8(j0(X),V).pipe(k_,$X(L),C0(V6(U,CJ(J)).pipe($H,k_,$X(L),h((A)=>O(S()).pipe($X(L),u((M)=>new x0(q(A,M,L)))))))))}))}),fw0=$(2,(X,J)=>t6(X,()=>J)),fa=(X)=>{if(X==="unbounded")return QW();else if(typeof X==="number"||X===void 0)return DY(X??16);switch(X.strategy){case"dropping":return A_(X.bufferSize??16);case"sliding":return T_(X.bufferSize??16);default:return DY(X.bufferSize??16)}},pw0=(X,J)=>A9(fa(J),(Z)=>mX(Z)).pipe(h((Z)=>xQ().pipe(h((Q)=>L0(()=>{let Y=ev(Q);return X(Ok((K)=>qk(K).pipe(h((B)=>g9(Z,B)),p7,Y).then((B)=>{if(AZ(B)){if(!PZ(B.cause))throw BJ(B.cause)}})))})),u((Q)=>{let Y=EZ(Z).pipe(h((G)=>c_(G)),R7({onFailure:(G)=>r0(mX(Z)).pipe(B9(w0(G,{onNone:()=>Y8,onSome:(K)=>$9(K)}))),onSuccess:(G)=>q0(G).pipe(z0(()=>Y))}),o8);return CW(Y).pipe(PH(Q??U0))}))),pG),lw0=(X,J)=>z(A9(fa(J),(Z)=>mX(Z)),h((Z)=>z(xQ(),h((Q)=>z(X(Ok((Y)=>z(qk(Y),h((G)=>g9(Z,G)),p7,ev(Q)).then((G)=>{if(AZ(G)){if(!PZ(G.cause))throw BJ(G.cause)}}))),u(()=>{let Y=z(EZ(Z),h(c_),R7({onFailure:(G)=>z(r0(mX(Z)),B9(w0(G,{onNone:()=>Y8,onSome:$9}))),onSuccess:(G)=>z(q0(G),z0(()=>Y))}),o8);return Y}))))),cG,CW),K38=(X)=>{if(X?.bufferSize==="unbounded"||X?.bufferSize===void 0&&X?.strategy===void 0)return QW();switch(X?.strategy){case"sliding":return T_(X.bufferSize??16);default:return A_(X?.bufferSize??16)}},pa=(X,J)=>A9(K38(J),mX).pipe(J9((Z)=>fO0(px,(Q)=>X(jw0(Z,Q)))),u((Z)=>{let Q=z0(EZ(Z),(Y)=>nL(Y)?CQ(Y)?Y8:O8(Y.cause):B9(q0(Q8(Y)),Q));return Q}),cG,CW),nw0=(X,J)=>z(A9(fa(J),(Z)=>mX(Z)),h((Z)=>z(xQ(),h((Q)=>z(X(Ok((Y)=>z(qk(Y),h((G)=>g9(Z,G)),p7,ev(Q)).then((G)=>{if(AZ(G)){if(!PZ(G.cause))throw BJ(G.cause)}}))),C0(bX(!1)),h((Y)=>z(ZX(Y),u((G)=>G?FT():z(EZ(Z),h(c_),WU(()=>z(pJ(Y,!0),C0(mX(Z)))))))))))),cU,m6(CH)),iw0=$(3,(X,J,Z)=>ZZ(()=>{let Q=(G)=>GX({onInput:(K)=>{if(G.length+K.length>=J){let[H,W]=z(K,c2(J-G.length));return Y(z(G,f8(H)),W)}return Q(z(G,f8(K)))},onFailure:$9,onDone:()=>Y(G,a0())}),Y=(G,K)=>A8(B9(q0(K),LY()),j0(Z(G)));return new x0(z(j0(X),V6(Q(a0()))))})),ow0=$(3,(X,J,Z)=>z(X,na(J,Z),u((Q)=>Q.map((Y)=>jW(E4(Y,{shutdown:!0})))))),la=$(2,(X,J)=>u(uk(X,J),(Z)=>jW(Zs(Z)))),rw0=$(2,(X,J)=>u(tv({acquire:la(X,J),idleTimeToLive:J.idleTimeToLive}),(Z)=>pG(eA(Z)))),na=$(3,(X,J,Z)=>h(UA0(Z),(Q)=>z(SQ(Array.from({length:J},()=>L3(Q))),J9(()=>MJ(dk(X,Q)))))),aw0=$(2,(X,J)=>u(uk(X,J),L3)),sw0=$(2,(X,J)=>{if(J.capacity==="unbounded")return $38(X);else if(J.strategy==="dropping")return W38(X,J.capacity);else if(J.strategy==="sliding")return V38(X,J.capacity);let Z=ss(X,J);return new x0(cG(u(Z,(Q)=>{let Y=z(r0(EZ(Q)),z0(rX({onFailure:(G)=>z(o$(G),w0({onNone:()=>Y8,onSome:O8})),onSuccess:(G)=>z0(q0(m0(G)),()=>Y)})));return Y})))}),tw0=$(2,(X,J)=>{if(J.strategy==="dropping")return B38(X,J.capacity);else if(J.strategy==="sliding")return H38(X,J.capacity);let Z=ck(X,J);return new x0(cG(u(Z,(Q)=>{let Y=z(r0(EZ(Q)),z0(f_({onEnd:()=>Y8,onFailure:O8,onSuccess:(G)=>z(q0(G),z0(()=>Y))})));return Y})))}),B38=$(2,(X,J)=>{let Z=A9(A_(J),(Q)=>mX(Q));return new x0(Pk(Z,j0(X)))}),H38=$(2,(X,J)=>{let Z=A9(T_(J),(Q)=>mX(Q));return new x0(Pk(Z,j0(X)))}),W38=$(2,(X,J)=>{let Z=A9(A_(J),(Q)=>mX(Q));return new x0(Pk(Z,j0(yT(1)(X))))}),V38=$(2,(X,J)=>{let Z=A9(T_(J),(Q)=>mX(Q));return new x0(Pk(Z,j0(z(X,yT(1)))))}),$38=(X)=>{let J=ck(X,{strategy:"unbounded"});return new x0(cG(u(J,(Z)=>{let Q=z(r0(EZ(Z)),z0(f_({onEnd:()=>Y8,onFailure:O8,onSuccess:(Y)=>z0(q0(Y),()=>Q)})));return Q})))},Pk=(X,J)=>{let Z=(Y,G)=>{let K=(B)=>z(ZX(G),J9(h8),C0(F9()),h((H)=>z(g9(Y,[B,H]),C0(pJ(G,H)),C0(h8(H)))),p7,r0);return Z9({onInput:(B)=>z(F9(),h((H)=>z(g9(Y,[LH(B),H]),h((W)=>z(pJ(G,H),A4(()=>W))))),p7,r0,z0(()=>Z(Y,G))),onFailure:(B)=>K(FH(B)),onDone:()=>K(fG)})},Q=(Y)=>{let G=z(r0(EZ(Y)),z0(([K,B])=>B9(r0(H6(B,void 0)),f_(K,{onEnd:()=>Y8,onFailure:O8,onSuccess:(H)=>z(q0(H),z0(()=>G))}))));return G};return cG(z(X,h((Y)=>z(F9(),J9((G)=>H6(G,void 0)),h((G)=>z(bX(G),h((K)=>z(J,A8(Z(Y,K)),b_,MJ)),y9(Q(Y))))))))},RH=$(2,(X,J)=>i_(X,(Z)=>w9(jG(Z),{onLeft:J,onRight:IT}))),i_=$(2,(X,J)=>new x0(z(j0(X),C_((Z)=>j0(J(Z)))))),ew0=$(2,(X,J)=>z(X,RH((Z)=>z(J(Z),i0(()=>MH(Z)))))),ia=$(2,(X,J)=>z(X,i_((Z)=>z(J(Z),i0(()=>IT(Z)))))),XL0=$(3,(X,J,Z)=>RH(X,(Q)=>{if("_tag"in Q&&Q._tag===J)return Z(Q);return MH(Q)})),JL0=$(2,(X,J)=>RH(X,(Z)=>{let Q=Object.keys(J);if("_tag"in Z&&Q.includes(Z._tag))return J[Z._tag](Z);return MH(Z)})),ZL0=(X)=>z(X,oa((J,Z)=>_0(Z)(J))),oa=$(2,(X,J)=>{let Z=(Q)=>Z9({onInput:(Y)=>{let[G,K]=t5(Y,[Q,a0()],([B,H],W)=>{if(R0(B)&&J(B.value,W))return[I(W),H];return[I(W),z(H,D7(W))]});if(T8(K))return Z(G);return z0(q0(K),()=>Z(G))},onFailure:O8,onDone:()=>Y8});return new x0(z(j0(X),A8(Z(S()))))}),QL0=$(2,(X,J)=>{let Z=(Q)=>Z9({onInput:(Y)=>z(Y,oF([Q,a0()],([G,K],B)=>{if(R0(G))return z(J(G.value,B),u((H)=>H?[I(B),K]:[I(B),z(K,D7(B))]));return y([I(B),z(K,D7(B))])}),r0,z0(([G,K])=>z(q0(K),z0(()=>Z(G))))),onFailure:O8,onDone:()=>Y8});return new x0(z(j0(X),A8(Z(S()))))}),RT=(X)=>z(X,dU(m0)),YL0=$(2,(X,J)=>ET(J(RT(X)))),AW=(X)=>y6(zx(X),(J)=>J._tag==="None"?f1:Y0(J.value)),GL0=$(4,(X,J,Z,Q)=>{function Y(G,K){return r0(TY(K)).pipe(B9(Z9({onInput:(B)=>z0(r0(tX(G,v8(B))),()=>Y(G,K)),onFailure:(B)=>r0(tX(G,_9(z(B,JQ(I))))),onDone:()=>z0(r0(tX(G,WX(S()))),()=>Y(G,K))})))}return new x0(C4((G)=>SQ([AY(),AY(),AY(),AY()]).pipe(J9(([K,B,H])=>j0(X).pipe(R4(JZ),A8(Y(K,H)),wY(G),$X(G))),J9(([,K,B,H])=>j0(J).pipe(R4(JZ),A8(Y(K,H)),wY(G),$X(G))),u(([K,B,H,W])=>{let V=tX(H,void 0).pipe(C0(TY(K).pipe(h(t)))),U=tX(W,void 0).pipe(C0(TY(B).pipe(h(t))));return j0(lk(Z,(O)=>h(Q(O,V,U),AW)))}))))}),jT=$(4,(X,J,Z,Q)=>{let Y=(G,K)=>B9(r0(TY(K)),Z9({onInput:(B)=>z0(r0(z(G,tX(LH(B)))),()=>Y(G,K)),onFailure:(B)=>r0(tX(G,FH(B))),onDone:()=>r0(tX(G,fG))}));return new x0(C4((G)=>SQ([AY(),AY(),AY(),AY()]).pipe(J9(([K,B,H])=>A8(j0(X),Y(K,H)).pipe(wY(G),$X(G))),J9(([K,B,H,W])=>A8(j0(J),Y(B,W)).pipe(wY(G),$X(G))),u(([K,B,H,W])=>{let V=tX(H,void 0).pipe(C0(TY(K).pipe(h(c_)))),U=tX(W,void 0).pipe(C0(TY(B).pipe(h(c_))));return j0(dT(Z,(O)=>h(Q(O,V,U),AW)))}))))}),TW=$(2,(X,J)=>new x0(z(j0(X),B9(j0(J))))),KL0=(X)=>ZZ(()=>z(X,t5(jH,(J,Z)=>TW(Z)(J)))),BL0=$(2,(X,J)=>z(X,jk(J,(Z,Q)=>[Z,Q]))),HL0=$(2,(X,J)=>z(X,jk(J,(Z,Q)=>Z))),Rk=$(2,(X,J)=>m6(X,()=>J)),jk=$(3,(X,J,Z)=>z(X,m6((Q)=>z(J,t6((Y)=>Z(Q,Y)))))),WL0=$(2,(X,J)=>t_((Z)=>f0(function*(){let Q=yield*AY();function Y(B){return Z3(J).pipe(y9(B),$X(Z),u((H)=>K(Pw0(H))))}let G=Z9({onInput:(B)=>w0(Pw(B),{onNone:()=>G,onSome:(H)=>r0(tX(Q,xa(m0(H)))).pipe(z0(()=>G))}),onFailure:(B)=>r0(tX(Q,_k(B))),onDone:()=>r0(tX(Q,LT(ka)))});function K(B){switch(B._tag){case Fw0:return o8(TY(Q).pipe(u((H)=>{switch(H._tag){case qT:return o8(Y(H.elements));case DT:return O8(H.cause);case wT:return Y8}})));case Aw0:return o8(TY(Q).pipe($X(Z),h((H)=>n1(EQ(B.fiber),EQ(H),{onSelfDone:(W,V)=>rX(W,{onFailure:(U)=>T7(V).pipe(y9(O8(U))),onSuccess:(U)=>T7(V).pipe(C0(y(q0(U).pipe(z0(()=>K(Rw0(H)))))))}),onOtherDone:(W,V)=>rX(W,{onFailure:(U)=>T7(V).pipe(y9(O8(U))),onSuccess:(U)=>{switch(U._tag){case qT:return T7(V).pipe(C0(Y(U.elements)));case DT:return T7(V).pipe(y9(O8(U.cause)));case wT:return EQ(V).pipe(u((O)=>q0(O).pipe(B9(Y8))))}}})}))));case Tw0:return o8(EQ(B.fiber).pipe(u((H)=>{switch(H._tag){case qT:return o8(Y(H.elements));case DT:return O8(H.cause);case wT:return Y8}})))}}return hT((B)=>A8(j0(X),G).pipe(wY(B),$X(B))).pipe(Rk(new x0(K(Mw0))))}))),Ck=(X)=>F6(P7(X)),VL0=(X)=>F6(Ei(X)),$L0=(X)=>F6(SG(X)),ra=$(2,(X,J)=>z(F9(),h((Z)=>z(X,aa({maximumLag:J.maximumLag,decide:(Q)=>h(h8(Z),(Y)=>Y(Q))}),h((Q)=>z(SQ(p9(Cw(0,J.size-1),(Y)=>u(Q,([G,K])=>[[G,Y],K]))),u(Q8),h((Y)=>{let[G,K]=tc(Y,[new Map,a0()],([B,H],[W,V])=>[B.set(W[0],W[1]),z(H,LX(V))]);return z(H6(Z,(B)=>u(J.decide(B),(H)=>(W)=>H(G.get(W)))),y9(Array.from(K)))}))))))),gw0={ref:0},hw0=()=>{let X=gw0.ref;return gw0.ref=X+1,X},aa=$(2,(X,J)=>sa(X,J.maximumLag,J.decide,()=>U0)),sa=$(4,(X,J,Z,Q)=>z(A9(bX(new Map),(Y,G)=>z(ZX(Y),h((K)=>z(K.values(),a9(mX))))),h((Y)=>f0(function*(){let G=(W)=>z(Z(W),h((V)=>z(ZX(Y),h((U)=>z(U.entries(),oF(a0(),(O,[q,L])=>{if(V(q))return z(g9(L,v8(W)),a6({onFailure:(A)=>PZ(A)?y(z(O,LX(q))):MX(A),onSuccess:()=>y(O)}));return y(O)}),h((O)=>{if(FX(O))return lJ(Y,(q)=>{for(let L of O)q.delete(L);return q});return U0}))))),p7),K=yield*tO(1),B=yield*bX(z(DY(J),h((W)=>{let V=hw0();return z(lJ(Y,(U)=>U.set(V,W)),y9([V,W]))}))),H=(W)=>K.withPermits(1)(z(pJ(B,z(DY(1),J9((V)=>g9(V,W)),h((V)=>{let U=hw0();return z(lJ(Y,(O)=>O.set(U,V)),y9(Mj(U,V)))}))),C0(z(ZX(Y),h((V)=>z(f9(V.values()),a9((U)=>z(g9(U,W),BU((O)=>PZ(O)?I(U0):S()))))))),C0(Q(W)),p7));return yield*z(X,bs(G),a6({onFailure:(W)=>H(_9(z(W,JQ(I)))),onSuccess:()=>H(WX(S()))}),MJ),K.withPermits(1)(sJ(ZX(B)))})))),o_=(X)=>new x0(j4(j0(X))),UL0=$(2,(X,J)=>F6(F9()).pipe(m6((Z)=>hT((Q)=>j0(J).pipe(j4,wY(Q),s9((Y)=>V5(Z,Y)),$X(Q))).pipe(Rk(Ws(X,Z)))))),ta=$(2,(X,J)=>{let Z=(Q)=>GX({onInput:(Y)=>{let G=z(Y,o9(Q)),K=Math.max(0,Q-Y.length);if(T8(Y)||K>0)return Z(K);return z(q0(G),B9(LY()))},onFailure:$9,onDone:()=>Y8});return new x0(z(j0(X),V6(Z(J))))}),zL0=$(2,(X,J)=>{if(J<=0)return Ks();return ZZ(()=>{let Z=new _T(J),Q=GX({onInput:(Y)=>{let G=z(Y,u2((K)=>{let B=Z.head();return Z.put(K),B}));return z(q0(G),z0(()=>Q))},onFailure:$9,onDone:()=>Y8});return new x0(z(j0(X),V6(Q)))})}),NL0=$(2,(X,J)=>ta(ea(X,(Z)=>!J(Z)),1)),OL0=$(2,(X,J)=>{let Z=GX({onInput:(Q)=>z(Hx(Q,J),u(Q8),u((Y)=>{if(T8(Y))return sX(()=>Z);return z(q0(Y),B9(LY()))}),o8),onFailure:$9,onDone:()=>Y8});return new x0(z(j0(X),V6(Z)))}),ea=$(2,(X,J)=>{let Z=GX({onInput:(Q)=>{let Y=aj(Q,J);if(T8(Y))return sX(()=>Z);return B9(q0(Y),LY())},onFailure:$9,onDone:L6});return new x0(V6(j0(X),Z))}),_L0=$(2,(X,J)=>{let Z=GX({onInput:(Q)=>z(Wx(Q,J),u(Q8),u((Y)=>{if(T8(Y))return sX(()=>Z);return B9(q0(Y),LY())}),o8),onFailure:$9,onDone:()=>Y8});return new x0(V6(j0(X),Z))}),qL0=(X)=>z(X,t6(O0),RH((J)=>l_(M0(J)))),jH=new x0(Y8),PH=$(2,(X,J)=>new x0(z(j0(X),kU(J)))),DL0=$(2,(X,J)=>new x0(YW(j0(X),J))),CT=()=>F6(EX()),wL0=(X)=>z(CT(),t6(X)),LL0=(X)=>z(CT(),S4(X)),Ik=(X)=>z(CT(),m6(X)),Xs=(X)=>o_(F6(X)),MH=(X)=>a_(Y0(I(X))),Ek=(X)=>a_(nO(()=>I(X()))),IT=(X)=>F6(MX(X)),FL0=(X)=>F6(Ii(X)),AL0=$(2,(X,J)=>dU(X,s5(J))),Js=$(2,(X,J)=>{let Z=(Q)=>{let Y=Q.next();if(Y.done)return Z9({onInput:(G)=>Z(G[Symbol.iterator]()),onFailure:O8,onDone:w6});else return z(J(Y.value),u((G)=>G?z(q0(m0(Y.value)),z0(()=>Z(Q))):Z(Q)),o8)};return new x0(sX(()=>z(j0(X),A8(Z(a0()[Symbol.iterator]())))))}),MW=$(2,(X,J)=>dU(X,u2(J))),TL0=$(2,(X,J)=>ZZ(()=>{let Z=(Q)=>{let Y=Q.next();if(Y.done)return Z9({onInput:(G)=>Z(G[Symbol.iterator]()),onFailure:O8,onDone:w6});else return z(J(Y.value),w0({onNone:()=>L0(()=>Z(Q)),onSome:u((G)=>z0(q0(m0(G)),()=>Z(Q)))}),o8)};return new x0(z(j0(X),A8(Z(a0()[Symbol.iterator]()))))})),ML0=$(2,(X,J)=>{let Z=GX({onInput:(Q)=>{let Y=rc(Q,J);if(Y.length===Q.length)return z(q0(Y),z0(()=>Z));return q0(Y)},onFailure:$9,onDone:w6});return new x0(z(j0(X),V6(Z)))}),PL0=$(2,(X,J)=>ZZ(()=>{let Z=(Q)=>{let Y=Q.next();if(Y.done)return Z9({onInput:(G)=>Z(G[Symbol.iterator]()),onFailure:O8,onDone:w6});else return o8(w0(J(Y.value),{onNone:()=>y(Y8),onSome:u((G)=>z0(q0(m0(G)),()=>Z(Q)))}))};return new x0(z(j0(X),V6(Z(a0()[Symbol.iterator]()))))})),RL0=(X)=>ua(U0,()=>X),jL0=$(2,(X,J)=>{let Z=GX({onInput:(Q)=>w0(JC(Q,J),{onNone:()=>Z,onSome:(Y)=>q0(m0(Y))}),onFailure:$9,onDone:()=>Y8});return new x0(z(j0(X),A8(Z)))}),CL0=$(2,(X,J)=>{let Z=GX({onInput:(Q)=>z(Ci(Q,J),u(w0({onNone:()=>Z,onSome:(Y)=>q0(m0(Y))})),o8),onFailure:$9,onDone:()=>Y8});return new x0(z(j0(X),A8(Z)))}),m6=$((X)=>hQ(X[0]),(X,J,Z)=>{let Q=Z?.bufferSize??16;if(Z?.switch)return PT(Z?.concurrency,()=>mw0(X,1,Q,J),(Y)=>mw0(X,Y,Q,J));return PT(Z?.concurrency,()=>new x0(R4(j0(X),(Y)=>z(Y,p9((G)=>j0(J(G))),t5(Y8,(G,K)=>z(G,B9(K)))))),(Y)=>new x0(z(j0(X),R4(JZ),dv((G)=>j0(J(G)),Z))))}),PT=(X,J,Z)=>{switch(X){case void 0:return J();case"unbounded":return Z(Number.MAX_SAFE_INTEGER);default:return X>1?Z(X):J()}},mw0=$(4,(X,J,Z,Q)=>new x0(z(j0(X),R4(JZ),dv((Y)=>j0(Q(Y)),{concurrency:J,mergeStrategy:hq0(),bufferSize:Z})))),r_=$((X)=>hQ(X[0]),(X,J)=>m6(X,t,J)),ET=(X)=>{let J=Z9({onInput:(Z)=>z0(JZ(Z),()=>J),onFailure:O8,onDone:()=>Y8});return new x0(z(j0(X),A8(J)))},IL0=$((X)=>hQ(X[0]),(X,J)=>J?.unordered?m6(X,(Z)=>F6(Z),{concurrency:J.concurrency}):PT(J?.concurrency,()=>S4(X,t),(Z)=>new x0(z(j0(X),R4(JZ),mv(t,Z),NW(m0))))),mU=(X)=>{let J=(Q,Y)=>{let[G,K]=z(Q,ej((H)=>!CQ(H))),B=z($G(K),w0({onNone:()=>Y,onSome:rX({onFailure:(H)=>w0(o$(H),{onNone:()=>Y8,onSome:O8}),onSuccess:()=>Y8})}));return z(q0(z(G,u2((H)=>CQ(H)?I(H.value):S()))),z0(()=>B))},Z=Z9({onInput:(Q)=>J(Q,Z),onFailure:(Q)=>O8(Q),onDone:()=>Y8});return new x0(z(j0(X),A8(Z)))},EL0=(X)=>z(X,t6(f9),ET),jW=(X)=>ET(mU(z(X,t6((J)=>J.exit)))),Sk=(X)=>new x0(iA(j0(X))),SL0=(X,J)=>z(A9(L0(()=>X[Symbol.asyncIterator]()),(Z)=>Z.return?KU(async()=>Z.return()):U0),u((Z)=>RW(z(TJ({try:async()=>Z.next(),catch:(Q)=>I(J(Q))}),h((Q)=>Q.done?Y0(S()):y(Q.value))))),pG),CW=(X)=>new x0(X),j0=(X)=>{if("channel"in X)return X.channel;else if(VX(X))return j0(F6(X));else throw TypeError("Expected a Stream.")},PW=(X)=>new x0(T8(X)?Y8:q0(X)),xL0=(X,J)=>{if(J?.scoped){let Q=u(L3(X),Fk);return J.shutdown?u(Q,PH(F_(X))):Q}let Z=m6(cU(L3(X)),Fk);return J?.shutdown?PH(Z,F_(X)):Z},Fk=(X,J)=>z(EZ(X),s9((Z)=>z(yA(X),h((Q)=>Q&&PZ(Z)?FT():wk(Z)))),CH,J?.shutdown?PH(mX(X)):t),vL0=(...X)=>z(s_(X),m6(PW)),F6=(X)=>z(X,E9(I),a_),a_=(X)=>new x0(o8(R7(X,{onFailure:w0({onNone:()=>Y8,onSome:$9}),onSuccess:(J)=>q0(m0(J))}))),Zs=(X,J)=>{let Z=J?.maxChunkSize??n_;if(J?.scoped){let Y=u(L3(X),(G)=>E4(G,{maxChunkSize:Z,shutdown:!0}));return J.shutdown?u(Y,PH(F_(X))):Y}let Q=m6(cU(L3(X)),(Y)=>E4(Y,{maxChunkSize:Z}));return J?.shutdown?PH(Q,F_(X)):Q},kL0=(X)=>{return pG(u(Dw0(X),(J)=>Ys(J)))},s_=(X)=>ZZ(()=>vK(X)?PW(X):Qs(X[Symbol.iterator]())),bL0=(X)=>z(X,u(s_),IW),Qs=(X,J=n_)=>{return z(L0(()=>{let Z=[],Q=(Y)=>z(L0(()=>{let G=Y.next();if(J===1){if(G.done)return Y8;return z(q0(m0(G.value)),z0(()=>Q(Y)))}Z=[];let K=0;while(G.done===!1){if(Z.push(G.value),K=K+1,K>=J)break;G=Y.next()}if(K>0)return z(q0(Q8(Z)),z0(()=>Q(Y)));return Y8}),o8);return new x0(Q(X))}),IW)},ST=(X)=>z(X,u(CH),pG),E4=(X,J)=>z(Qv(X,1,J?.maxChunkSize??n_),s9((Z)=>z(yA(X),h((Q)=>Q&&PZ(Z)?FT():wk(Z)))),CH,J?.shutdown?PH(mX(X)):t),Ys=(X)=>z(Lw0(X),u(m0),s9((J)=>z(ww0(X),h((Z)=>Z&&PZ(J)?FT():wk(J)))),CH),yL0=(X)=>z(_W(X),u((J)=>RW(J.next(void 0))),IW),gL0=(...X)=>{let J=X.length===1?X[0].evaluate:X[0],Z=X.length===1?X[0].onError:X[1],Q=X.length===1?X[0].releaseLockOnEnd===!0:!1;return pG(u(A9(L0(()=>J().getReader()),(Y)=>Q?L0(()=>Y.releaseLock()):KU(()=>Y.cancel())),(Y)=>RW(h(TJ({try:()=>Y.read(),catch:(G)=>I(Z(G))}),({done:G,value:K})=>G?Y0(S()):y(K)))))},hL0=(...X)=>{let J=X.length===1?X[0].evaluate:X[0],Z=X.length===1?X[0].onError:X[1],Q=(X.length===1?X[0].bufferSize:X[2])??4096,Y=X.length===1?X[0].releaseLockOnEnd===!0:!1;return pG(u(A9(L0(()=>J().getReader({mode:"byob"})),(G)=>Y?L0(()=>G.releaseLock()):KU(()=>G.cancel())),(G)=>RH(Sk(U38(G,Z,Q)),(K)=>K===mL0?jH:MH(K))))},mL0=Symbol.for("effect/Stream/EOF"),U38=(X,J,Z)=>{let Q=new ArrayBuffer(Z);return _s(0,(Y)=>h(TJ({try:()=>X.read(new Uint8Array(Q,Y,Q.byteLength-Y)),catch:(G)=>J(G)}),({done:G,value:K})=>{if(G)return Y0(mL0);let B=Y+K.byteLength;return y([K,B>=Q.byteLength?S():I(B)])}))},dL0=$(2,(X,J)=>{let Z=(Y,G)=>{if(T8(G))return[Y,a0()];let K=[],B=0,H=0,W=void 0,V=a0();switch(Y._tag){case"Some":{let q=Y.value;W=q[0];let L=!0;while(L&&H<G.length){let A=HX(G,H),M=J(A);if(!_0(W,M)){let x=q[1],j=Q8(Array.from(G).slice(B,H)),T=f8(x,j);K.push([W,T]),W=M,B=H,L=!1}H=H+1}if(L)V=q[1];break}case"None":{W=J(HX(G,H)),H=H+1;break}}while(H<G.length){let q=HX(G,H),L=J(q);if(!_0(W,L))K.push([W,Q8(Array.from(G).slice(B,H))]),W=L,B=H;H=H+1}let U=f8(V,Q8(Array.from(G).slice(B,H))),O=Q8(K);return[I([W,U]),O]},Q=(Y)=>Z9({onInput:(G)=>{let[K,B]=Z(Y,G);return T8(B)?Q(K):z0(q0(B),()=>Q(K))},onFailure:(G)=>w0(Y,{onNone:()=>O8(G),onSome:(K)=>z0(q0(m0(K)),()=>O8(G))}),onDone:(G)=>w0(Y,{onNone:()=>L6(G),onSome:(K)=>z0(q0(m0(K)),()=>L6(G))})});return new x0(V6(j0(X),Q(S())))}),uL0=$(2,(X,J)=>z(X,yT(J),RT)),cL0=$(3,(X,J,Z)=>Mk(X,lr(J),qW(Z))),Gs=$(2,(X,J)=>{let Z=(Q)=>z(dV0(Q),u(w0({onNone:()=>GX({onInput:(Y)=>z0(q0(Y),()=>Z(Q)),onFailure:$9,onDone:()=>Y8}),onSome:rX({onFailure:O8,onSuccess:()=>Y8})})),o8);return new x0(C4((Q)=>J.pipe($X(Q),u((Y)=>j0(X).pipe(A8(Z(Y)))))))}),fL0=$(2,(X,J)=>z(X,Gs(Z3(J)))),pL0=$(2,(X,J)=>{let Z=z(hz0(J),u(w0({onNone:()=>GX({onInput:(Q)=>z(q0(Q),z0(()=>Z)),onFailure:$9,onDone:()=>Y8}),onSome:(Q)=>o8(R7(Q,{onFailure:$9,onSuccess:()=>Y8}))})),o8);return new x0(z(j0(X),A8(Z)))}),Ks=()=>new x0(LY()),lL0=$(2,(X,J)=>z(X,Bs(J,Sk(l_(!0,!1))))),Bs=$(3,(X,J,Z)=>{let Q=(Y)=>Z9({onInput:(G)=>z0(r0(tX(Y,Dk(G))),()=>Q(Y)),onFailure:(G)=>r0(tX(Y,FH(G))),onDone:()=>r0(tX(Y,fG))});return new x0(C4((Y)=>z(AY(),j7(AY()),J9(([G])=>j0(X).pipe(R4(JZ),A8(Q(G)),wY(Y),$X(Y))),J9(([G,K])=>j0(J).pipe(R4(JZ),A8(Q(K)),wY(Y),$X(Y))),u(([G,K])=>{let B=(H,W)=>Z9({onInput:(V)=>{if(V&&!H)return z(r0(TY(G)),z0(f_({onEnd:()=>W?Y8:B(!0,W),onFailure:O8,onSuccess:(U)=>z(q0(U),z0(()=>B(H,W)))})));if(!V&&!W)return z(r0(TY(K)),z0(f_({onEnd:()=>H?Y8:B(H,!0),onFailure:O8,onSuccess:(U)=>z(q0(U),z0(()=>B(H,W)))})));return B(H,W)},onFailure:O8,onDone:()=>Y8});return z(j0(Z),R4(JZ),A8(B(!1,!1)))}))))}),Hs=$(2,(X,J)=>new x0(z(j0(X),V6(sX(()=>{let Z=(Q)=>Z9({onInput:(Y)=>{let G=[],K=Q;for(let B of Y)if(K)K=!1,G.push(B);else G.push(J),G.push(B);return z(q0(Q8(G)),z0(()=>Z(K)))},onFailure:O8,onDone:()=>Y8});return Z(!0)}))))),nL0=$(2,(X,{end:J,middle:Z,start:Q})=>z(l_(Q),TW(z(X,Hs(Z))),TW(l_(J)))),iL0=$(2,(X,J)=>z(X,xk(Z3(J)))),xk=$(2,(X,J)=>new x0(z(j0(X),yv(J)))),Ws=$(2,(X,J)=>new x0(z(j0(X),yr(J)))),oL0=(X,J)=>ts(X,(Z)=>I([Z,J(Z)])),l_=(...X)=>s_(X),t6=$(2,(X,J)=>new x0(z(j0(X),NW(p9(J))))),vk=$(3,(X,J,Z)=>{let Q=(Y)=>GX({onInput:(G)=>{let[K,B]=tj(G,Y,Z);return z0(q0(B),()=>Q(K))},onFailure:$9,onDone:()=>Y8});return new x0(z(j0(X),A8(Q(J))))}),kk=$(3,(X,J,Z)=>ZZ(()=>{let Q=(Y)=>GX({onInput:(G)=>z(o0(()=>{let K=[],B=(H)=>L0(()=>{K.push(H)});return z(G,oF(Y,(H,W)=>z(Z(H,W),h(([V,U])=>z(B(U),y9(V))))),R7({onFailure:(H)=>{if(K.length!==0)return B9(q0(Q8(K)),$9(H));return $9(H)},onSuccess:(H)=>z0(q0(Q8(K)),()=>Q(H))}))}),o8),onFailure:$9,onDone:()=>Y8});return new x0(z(j0(X),V6(Q(J))))})),rL0=$(2,(X,J)=>z(X,bk(J.onFailure),t6(J.onSuccess))),dU=$(2,(X,J)=>new x0(z(j0(X),NW(J)))),aL0=$(2,(X,J)=>new x0(z(j0(X),nA(J)))),sL0=$(2,(X,J)=>z(X,xT((Z)=>f9(J(Z))))),xT=$(2,(X,J)=>z(X,dU(sj(J)))),tL0=$(2,(X,J)=>z(X,S4(J),xT(t))),eL0=$(2,(X,J)=>z(X,S4((Z)=>z(J(Z),u(f9))),xT(t))),S4=$(2,(X,J)=>{let Z=(Q)=>{let Y=Q.next();if(Y.done)return Z9({onInput:(G)=>Z(G[Symbol.iterator]()),onFailure:O8,onDone:w6});else{let G=Y.value;return o8(u(J(G),(K)=>z0(q0(m0(K)),()=>Z(Q))))}};return new x0(z(j0(X),A8(sX(()=>Z(a0()[Symbol.iterator]())))))}),XF0=$(3,(X,J,Z)=>new x0(z(j0(X),R4(JZ),mv(Z,J),NW(m0)))),bk=$(2,(X,J)=>new x0(z(j0(X),gv(J)))),JF0=$(2,(X,J)=>new x0(z(j0(X),hv(J)))),vT=$((X)=>hQ(X[1]),(X,J,Z)=>gk(X,J,{onSelf:t,onOther:t,haltStrategy:Z?.haltStrategy})),yk=$((X)=>(Symbol.iterator in X[0]),(X,J)=>r_(s_(X),J)),ZF0=$(2,(X,J)=>{let Q=Object.keys(X).map((Y)=>X[Y].pipe(t6((G)=>({_tag:Y,value:G}))));return yk(Q,J)}),Vs=$(2,(X,J)=>gk(X,J,{onSelf:M0,onOther:O0})),QF0=$(2,(X,J)=>z(X,vT(o_(J)))),YF0=$(2,(X,J)=>z(o_(X),vT(J))),gk=$(3,(X,J,Z)=>{let Q=Z.haltStrategy?Qa(Z.haltStrategy):xD0,Y=(G)=>(K)=>G||!CQ(K)?ND0(o0(()=>K)):OD0((B)=>o0(()=>B));return new x0(OW(j0(t6(X,Z.onSelf)),{other:j0(t6(J,Z.onOther)),onSelfDone:Y(Q._tag==="Either"||Q._tag==="Left"),onOtherDone:Y(Q._tag==="Either"||Q._tag==="Right")}))}),GF0=(X)=>BQ(X,er),KF0=F6(c1),BF0=$(2,(X,J)=>TW(X,o_(F6(J)))),HF0=$(2,(X,J)=>z(X,i_((Z)=>F6(z(J(Z),C0(MX(Z))))))),WF0=$(2,(X,J)=>new x0(z(j0(X),YW((Z)=>CQ(Z)?J():U0)))),VF0=$(2,(X,J)=>IW(y9(J,X))),$F0=(X)=>z(X,$s(t)),$s=$(2,(X,J)=>new x0(z(j0(X),gr(J)))),kT=$(2,(X,J)=>new x0(z(j0(X),uv(()=>j0(J()))))),UF0=$(2,(X,J)=>z(X,t6(M0),kT(()=>z(J(),t6(O0))))),zF0=$(2,(X,J)=>z(X,kT(()=>Ek(J)))),NF0=$(2,(X,J)=>z(X,Us(()=>m0(J())))),Us=$(2,(X,J)=>z(X,zs(()=>new x0(q0(J()))))),zs=$(2,(X,J)=>{let Z=GX({onInput:(Q)=>{if(T8(Q))return sX(()=>Z);return z(q0(Q),B9(LY()))},onFailure:$9,onDone:()=>sX(()=>j0(J()))});return new x0(z(j0(X),A8(Z)))}),OF0=$(2,(X,J)=>z(X,kT(()=>fs(J)))),_F0=(X,J)=>Ns(X,(Z)=>{let Q=J(Z);return[m0(Q[0]),Q[1]]}),Ns=(X,J)=>{let Z=(Q)=>{let Y=J(Q);return w0(Y[1],{onNone:()=>B9(q0(Y[0]),Y8),onSome:(G)=>z0(q0(Y[0]),()=>Z(G))})};return new x0(sX(()=>Z(X)))},Os=(X,J)=>{let Z=(Q)=>o8(u(J(Q),([Y,G])=>w0(G,{onNone:()=>B9(q0(Y),Y8),onSome:(K)=>z0(q0(Y),()=>Z(K))})));return new x0(sX(()=>Z(X)))},_s=(X,J)=>Os(X,(Z)=>z(J(Z),u(([Q,Y])=>[m0(Q),Y]))),qF0=$(2,(X,J)=>{return z(F9(),h((G)=>z(AY(),u((K)=>{let B=iv(nr(J),{onFailure:(W)=>sr(sv(Zx(G,W)),rA(W)),onSuccess:([W,V])=>{let U=Z9({onInput:(O)=>z0(r0(tX(K,{_tag:"Emit",elements:O})),()=>U),onFailure:(O)=>B9(r0(tX(K,{_tag:"Halt",cause:O})),O8(O)),onDone:(O)=>B9(r0(tX(K,{_tag:"End"})),Y8)});return tA(z(r0(H6(G,W)),B9(r0(z(K,tX({_tag:"Emit",elements:V})))),B9(U)))}}),H=z(TY(K),u((W)=>{switch(W._tag){case"Emit":return z(q0(W.elements),z0(()=>H));case"Halt":return O8(W.cause);case"End":return Y8}}),o8);return z(X,is((W)=>V5(G,W)),BQ(B),MJ,C0(h8(G)),u((W)=>[W,new x0(H)]))}))),sJ)}),DF0=$((X)=>typeof X[1]==="function",(X,J,Z)=>qs(X,(Q)=>y(J(Q)?O0(Q):M0(Q)),Z)),qs=$((X)=>typeof X[1]==="function",(X,J,Z)=>z(S4(X,J),ra({size:2,maximumLag:Z?.bufferSize??16,decide:w9({onLeft:()=>y((Q)=>Q===0),onRight:()=>y((Q)=>Q===1)})}),h(([Q,Y])=>y([MW(mU(E4(Q,{shutdown:!0})),(G)=>w9(G,{onLeft:I,onRight:S})),MW(mU(E4(Y,{shutdown:!0})),(G)=>w9(G,{onLeft:S,onRight:I}))])))),wF0=$(2,(X,J)=>new x0(z(j0(X),V6(CJ(J))))),Ds=$(2,(X,J)=>new x0(A8(j0(X),J))),LF0=$(2,(X,J)=>new x0(z(j0(X),V6(J)))),FF0=$(2,(X,J)=>new x0(B9(q0(J),j0(X)))),hk=$(2,(X,J)=>new x0(z(j0(X),GW(J)))),ws=$(2,(X,J)=>mk(X,CX(J))),Ls=$(2,(X,J)=>new x0(C4((Z)=>so(J,Z).pipe(u((Q)=>z(j0(X),GW(Q))))))),AF0=$(3,(X,J,Z)=>bT(X,J,y(Z))),bT=$(3,(X,J,Z)=>Fs(X,J,F6(Z))),Fs=$(3,(X,J,Z)=>Ik((Q)=>m6(Z,(Y)=>z(X,hk(X9(Q,J,Y)))))),mk=$(2,(X,J)=>Ik((Z)=>z(X,hk(J(Z))))),As=$(2,(X,J)=>z(X,Ls(z(lx(),nx(J))))),TF0=(X,J,Z=n_)=>ZZ(()=>{if(X>J)return jH;let Q=(Y,G,K)=>{let B=G-Y+1;if(B>K)return z(q0(Cw(Y,Y+K-1)),z0(()=>Q(Y+K,G,K)));return q0(Cw(Y,Y+B-1))};return new x0(Q(X,J,Z))}),MF0=$(2,(X,J)=>Ts(X,J)),Ts=(...X)=>F9().pipe(u((J)=>{let Z=null;return yk(X.map((Q,Y)=>Q.pipe(ps(()=>{if(Z===null)return Z=Y,$5(J,eZ),!0;return Z===Y}),xk(h8(J).pipe(h(()=>Z===Y?c1:U0))))),{concurrency:X.length})}),IW),yT=$(2,(X,J)=>ZZ(()=>{let Z=Math.max(J,1),Q=Lk(new PF0(Z),Z);return new x0(z(j0(X),A8(Q)))})),Lk=(X,J)=>Z9({onInput:(Z)=>{if(Z.length===J&&X.isEmpty())return z0(q0(Z),()=>Lk(X,J));if(Z.length>0){let Q=[],Y=void 0,G=0;while(G<Z.length){while(G<Z.length&&Y===void 0)Y=X.write(z(Z,HX(G))),G=G+1;if(Y!==void 0)Q.push(Y),Y=void 0}return z0(cr(...Q),()=>Lk(X,J))}return sX(()=>Lk(X,J))},onFailure:(Z)=>B9(X.emitIfNotEmpty(),O8(Z)),onDone:()=>X.emitIfNotEmpty()});class PF0{n;builder=[];pos=0;constructor(X){this.n=X}isEmpty(){return this.pos===0}write(X){if(this.builder.push(X),this.pos+=1,this.pos===this.n){let J=Q8(this.builder);return this.builder=[],this.pos=0,J}return}emitIfNotEmpty(){if(this.pos!==0)return q0(Q8(this.builder));return Y8}}var RF0=$(2,(X,J)=>z(X,Ms(J,t))),Ms=$(3,(X,J,Z)=>new x0(UW(j0(X),(Q)=>w0(J(Q),{onNone:()=>O8(oJ(Z(Q))),onSome:$9})))),jF0=$(2,(X,J)=>MW(Ps(X,J),(Z)=>w9(Z,{onLeft:S,onRight:I}))),CF0=(X)=>RW(z(X,E9(I))),IF0=(X)=>CH(z(X,E9(I))),CH=(X)=>dT(X,(J)=>z(u(J,(Z)=>I([Z,J])),y6(w0({onNone:()=>y(S()),onSome:Y0})))),RW=(X)=>CH(z(X,u(m0))),Ps=$(2,(X,J)=>js(X,J,{onElement:(Z)=>O0(Z),onSchedule:M0})),EF0=$(2,(X,J)=>MW(Rs(X,J,{onElement:(Z)=>I(Z),onSchedule:S}),t)),Rs=$(3,(X,J,Z)=>{let Q=z(_W(J),u((Y)=>{let G=(H)=>w0($G(H),{onNone:()=>B,onSome:(W)=>B9(q0(m0(Z.onElement(W))),K(z(H,o9(1)),W))}),K=(H,W)=>{let V=z(Y.next(W),y9(z(q0(m0(Z.onElement(W))),z0(()=>K(H,W))))),U=z(Y.last,R9,h((O)=>z(Y.reset,u(()=>z(q0(m0(Z.onSchedule(O))),B9(G(H)))))));return z(V,O3(()=>U),o8)},B=GX({onInput:G,onFailure:$9,onDone:()=>Y8});return B}),o8);return new x0(z(j0(X),A8(Q)))}),SF0=(X)=>new x0(iA(q0(m0(X)))),js=$(3,(X,J,Z)=>{return z(_W(J),u((Q)=>{let Y=bT(Xk,ZX(Q.iterationMeta)),G=z(X,Y,t6(Z.onElement),j0),K=o8(R7(Q.next(void 0),{onFailure:()=>Y8,onSuccess:(B)=>z0(G,()=>B9(q0(m0(Z.onSchedule(B))),K))}));return new x0(B9(G,K))}),IW)}),z38=(X,J)=>Cs(y(X),J),Cs=(X,J)=>m6(F6(j7(X,_W(J))),([Z,Q])=>{let Y=z5(Xk,ZX(Q.iterationMeta));return TW(mT(Z),lk(Z,(G)=>q9(Q.next(G),{onFailure:y,onSuccess:()=>u(Y(X),(K)=>I([K,K]))})))}),Ak=$(2,(X,J)=>_W(J).pipe(u((Z)=>{let Q=bT(Xk,ZX(Z.iterationMeta)),Y=j0(Q(X)).pipe(nA((G)=>y9(Z.reset,G)),UW((G)=>Z.next(G).pipe(R7({onFailure:()=>$9(G),onSuccess:()=>Y}),o8)));return Y}),o8,CW)),xF0=$((X)=>hQ(X[0]),(X,J,Z)=>ZZ(()=>{let Q=Z?.preventFallbackOnPartialStream??!1,Y=0,G=S(),K=ZZ(()=>{let B=J.steps[Y++];if(!B)return MH(lY(G));let H=Fw(B.provide)?ws(X,B.provide):As(X,B.provide),W=!1;if(R0(G)){let V=G.value,U=!1,O=H;H=ZZ(()=>{if(U)return O;return U=!0,MH(V)}),H=dw0(Ak(H,pF(B,!1)))}else{let V=pF(B,!0);H=V?dw0(Ak(H,V)):H}return RH(Q?dU(H,(V)=>{return W=!0,V}):H,(V)=>{if(Q&&W)return MH(V);return G=I(V),K})});return K})),dw0=(X)=>i_(X,(J)=>IT(Di(J))),BQ=$(2,(X,J)=>j0(X).pipe(V6(CJ(J)),hr)),vF0=(X)=>BQ(X,pr()),kF0=(X)=>BQ(X,tr),bF0=(X)=>BQ(X,nv),yF0=$(3,(X,J,Z)=>Is(X,J,G6,Z)),gF0=$(3,(X,J,Z)=>Es(X,J,G6,Z)),hF0=$(3,(X,J,Z)=>z(X,Ss(J,G6,Z))),mF0=$(3,(X,J,Z)=>z(X,xs(J,G6,Z))),Is=$(4,(X,J,Z,Q)=>BQ(X,aA(J,Z,Q))),Es=$(4,(X,J,Z,Q)=>BQ(X,ov(J,Z,Q))),Ss=$(4,(X,J,Z,Q)=>z(X,uU(aA(J,Z,Q)))),xs=$(4,(X,J,Z,Q)=>z(X,uU(ov(J,Z,Q)))),vs=$(2,(X,J)=>BQ(X,sA(J))),ks=$(2,(X,J)=>BQ(X,rv(J))),dF0=$(2,(X,J)=>z(X,uU(rv(J)))),bs=$(2,(X,J)=>z(X,uU(sA(J)))),uF0=$(2,(X,J)=>BQ(X,av(J))),cF0=$(2,(X,J)=>z(X,uU(av(J)))),fF0=(X)=>BQ(X,ir()),pF0=$(2,(X,J)=>z(X,ys(J))),dk=$(2,(X,J)=>z(X,gT(J))),ys=$(2,(X,J)=>z(X,gT(J),l7)),gs=$(2,(X,J)=>{let Z=Z9({onInput:(Q)=>z0(r0(Vr(J,p9(Q,v8))),()=>Z),onFailure:(Q)=>r0(g9(J,_9(JQ(Q,I)))),onDone:()=>r0(g9(J,WX(S())))});return z(A8(j0(X),Z),j4,b_,p7)}),gT=$(2,(X,J)=>{let Z=Z9({onInput:(Q)=>z0(q0(LH(Q)),()=>Z),onFailure:(Q)=>q0(FH(Q)),onDone:()=>q0(fG)});return z(A8(j0(X),Z),nA((Q)=>g9(J,Q)),j4,b_,p7)}),lF0=(X)=>BQ(X,or()),uU=$(2,(X,J)=>z(j0(X),V6(CJ(J)),j4,b_)),nF0=(X)=>BQ(X,ar),iF0=$(3,(X,J,Z)=>z(X,ds(J,(Q,Y)=>y(Z(Q,Y))))),oF0=$(2,(X,J)=>z(X,hs((Z,Q)=>y(J(Z,Q))))),hs=$(2,(X,J)=>z(X,kk(S(),(Z,Q)=>{switch(Z._tag){case"None":return y([I(Q),Q]);case"Some":return z(J(Z.value,Q),u((Y)=>[I(Y),Y]))}}))),rF0=$(2,(X,J)=>MW(ms(X,J,{onElement:I,onSchedule:S}),t)),ms=$(3,(X,J,Z)=>{let Q=(Y,G)=>{let K=G.next();if(K.done)return Z9({onInput:(B)=>Q(Y,B[Symbol.iterator]()),onFailure:O8,onDone:L6});return o8(q9(Y.next(K.value),{onFailure:()=>z(Y.last,R9,u((B)=>z(q0(LB(Z.onElement(K.value),Z.onSchedule(B))),z0(()=>Q(Y,G)))),jZ(Y.reset)),onSuccess:()=>y(z(q0(m0(Z.onElement(K.value))),z0(()=>Q(Y,G))))}))};return new x0(z(r0(_W(J)),z0((Y)=>z(j0(X),A8(Q(Y,a0()[Symbol.iterator]()))))))}),ds=$(3,(X,J,Z)=>new x0(z(q0(m0(J)),z0(()=>j0(z(X,kk(J,(Q,Y)=>z(Z(Q,Y),u((G)=>[G,G]))))))))),cU=(X)=>new x0(kU(cv(z(X,u(m0))),U0)),hT=(X)=>new x0(fv((J)=>X(J).pipe(u(m0)))),aF0=(X)=>z(X,bk(I),us(()=>S())),sF0=$(2,(X,J)=>z(X,t6(i0(J)))),us=$(2,(X,J)=>S4(X,w0({onNone:()=>nO(J),onSome:y}))),tF0=$(2,(X,J)=>cs(X,J,1)),cs=$(3,(X,J,Z)=>{if(J<=0||Z<=0)return Ck(new j1("Invalid bounds - `chunkSize` and `stepSize` must be greater than zero"));return new x0(sX(()=>{let Q=new _T(J),Y=(K,B)=>{if(K<J){let O=Q.toChunk(),q=T8(O)?a0():m0(O);return z(q0(q),z0(()=>B))}let H=K-(K-J)%Z;if(H===K)return B;let W=K-(H-J+Z),V=z(Q.toChunk(),Rw(W)),U=T8(V)?a0():m0(V);return z(q0(U),z0(()=>B))},G=(K)=>Z9({onInput:(B)=>z0(q0(u2(B,(H,W)=>{Q.put(H);let V=K+W+1;if(V<J||(V-J)%Z>0)return S();return I(Q.toChunk())})),()=>G(K+B.length)),onFailure:(B)=>Y(K,O8(B)),onDone:()=>Y(K,Y8)});return z(j0(X),A8(G(0)))}))}),eF0=$(2,(X,J)=>{let Z=(Y,G)=>{let[K,B]=z(Y,f8(G),ej(J));if(T8(K)||T8(B))return Q(z(K,f8(z(B,o9(1)))));return z(q0(m0(K)),z0(()=>Z(a0(),z(B,o9(1)))))},Q=(Y)=>GX({onInput:(G)=>Z(Y,G),onFailure:$9,onDone:()=>{if(T8(Y))return Y8;if(j8(z(Y,JC(J))))return B9(q0(m0(Y)),Y8);return B9(Z(a0(),Y),Y8)}});return new x0(z(j0(X),A8(Q(a0()))))}),XA0=$(2,(X,J)=>{let Z=(Q,Y)=>Z9({onInput:(G)=>{let K,[B,H]=z(G,t5([z(Q,i0(()=>a0())),Y],([V,U],O)=>{let q=z(V,D7(O));if(U<J.length&&_0(O,z(J,HX(U)))){if(U+1===J.length){if(K===void 0)K=[];return K.push(z(q,_J(q.length-J.length))),[a0(),0]}return[q,U+1]}return[q,_0(O,z(J,HX(0)))?1:0]})),W=K===void 0?a0():Q8(K);return z0(q0(W),()=>Z(FX(B)?I(B):S(),H))},onFailure:(G)=>w0(Q,{onNone:()=>O8(G),onSome:(K)=>B9(q0(m0(K)),O8(G))}),onDone:(G)=>w0(Q,{onNone:()=>w6(G),onSome:(K)=>B9(q0(m0(K)),w6(G))})});return new x0(z(j0(X),A8(Z(S(),0))))}),JA0=(X)=>Ds(X,mr()),mT=(X)=>PW(m0(X)),fs=(X)=>ZZ(()=>PW(m0(X()))),ZZ=(X)=>new x0(sX(()=>j0(X()))),ZA0=$(2,(X,J)=>{if(!Number.isInteger(J))return Ck(new j1(`${J} must be an integer`));let Z=(Q)=>GX({onInput:(Y)=>{let G=z(Y,_J(Math.min(Q,Number.POSITIVE_INFINITY))),K=Math.max(0,Q-G.length);if(K>0)return z(q0(G),z0(()=>Z(K)));return q0(G)},onFailure:$9,onDone:w6});return new x0(z(j0(X),V6(0<J?Z(J):Y8)))}),QA0=$(2,(X,J)=>{if(J<=0)return jH;return new x0(z(y(new _T(J)),u((Z)=>{let Q=GX({onInput:(Y)=>{for(let G of Y)Z.put(G);return Q},onFailure:$9,onDone:()=>z(q0(Z.toChunk()),B9(Y8))});return z(j0(X),A8(Q))}),o8))}),YA0=$(2,(X,J)=>{let Z=GX({onInput:(Q)=>{let Y=z(Q,XC((K)=>!J(K))),G=z(Q,o9(Y.length),_J(1));if(T8(G))return z(q0(Y),z0(()=>Z));return q0(z(Y,f8(G)))},onFailure:$9,onDone:w6});return new x0(z(j0(X),V6(Z)))}),GA0=$(2,(X,J)=>{let Z=(Q)=>{let Y=Q.next();if(Y.done)return Z9({onInput:(G)=>Z(G[Symbol.iterator]()),onFailure:O8,onDone:w6});return z(J(Y.value),u((G)=>G?q0(m0(Y.value)):z(q0(m0(Y.value)),z0(()=>Z(Q)))),o8)};return new x0(z(j0(X),A8(Z(a0()[Symbol.iterator]()))))}),ps=$(2,(X,J)=>{let Z=GX({onInput:(Q)=>{let Y=z(Q,XC(J));if(Y.length===Q.length)return z(q0(Y),z0(()=>Z));return q0(Y)},onFailure:$9,onDone:w6});return new x0(z(j0(X),V6(Z)))}),ls=$(2,(X,J)=>S4(X,(Z)=>y9(J(Z),Z))),KA0=$(2,(X,J)=>z(X,ns(J.onFailure),ls(J.onSuccess))),ns=$(2,(X,J)=>RH(X,(Z)=>F6(C0(J(Z),Y0(Z))))),is=$(2,(X,J)=>{let Z=Z9({onInput:(Q)=>z0(q0(Q),()=>Z),onFailure:(Q)=>r0(C0(J(Q),MX(Q))),onDone:L6});return new x0(z(j0(X),A8(Z)))}),BA0=$(2,(X,J)=>z(F6(SQ([DY(1),F9()])),m6(([Z,Q])=>{let Y=jW(E4(Z,{maxChunkSize:1})),G=Z9({onInput:(K)=>z(r0(g9(Z,LH(K))),EU({onFailure:()=>z0(q0(K),()=>LY()),onSuccess:()=>z0(q0(K),()=>G)})),onFailure:(K)=>z(r0(g9(Z,FH(K))),EU({onFailure:()=>O8(K),onSuccess:()=>O8(K)})),onDone:()=>z(r0(g9(Z,fG)),EU({onFailure:()=>Y8,onSuccess:()=>Y8}))});return z(new x0(z(A8(j0(X),G),kU(C0(F4(g9(Z,fG)),h8(Q))))),vT(Xs(z(BQ(Y,J),RZ(C0(mX(Z),H6(Q,void 0)))))))}))),HA0=$(2,(X,J)=>os(X,{...J,cost:(Z)=>y(J.cost(Z))})),os=$(2,(X,J)=>{if(J.strategy==="enforce")return N38(X,J.cost,J.units,J.duration,J.burst??0);return O38(X,J.cost,J.units,J.duration,J.burst??0)}),N38=(X,J,Z,Q,Y)=>{let G=(B,H)=>Z9({onInput:(W)=>z(J(W),j7($Y),u(([V,U])=>{let q=(U-H)/K7(Q),L=B+q*Z,A=Z+Y<0?Number.POSITIVE_INFINITY:Z+Y,M=L<0?A:Math.min(L,A);if(V<=M)return z(q0(W),z0(()=>G(M-V,U)));return G(B,H)}),o8),onFailure:O8,onDone:()=>Y8}),K=z($Y,u((B)=>G(Z,B)),o8);return new x0(z(j0(X),V6(K)))},O38=(X,J,Z,Q,Y)=>{let G=(B,H)=>Z9({onInput:(W)=>z(J(W),j7($Y),u(([V,U])=>{let q=(U-H)/K7(Q),L=B+q*Z,A=Z+Y<0?Number.POSITIVE_INFINITY:Z+Y,x=(L<0?A:Math.min(L,A))-V,j=x>=0?0:-x/Z,T=v6(Math.max(0,j*K7(Q)));if(xw(T,QY))return z(r0(Z3(T)),B9(q0(W)),z0(()=>G(x,U)));return z0(q0(W),()=>G(x,U))}),o8),onFailure:O8,onDone:()=>Y8}),K=z($Y,u((B)=>G(Z,B)),o8);return new x0(z(j0(X),V6(K)))},WA0=(X)=>z38(void 0,qW(X)),VA0=$(2,(X,J)=>z(hU(X),u(bi({onTimeout:()=>S(),duration:J})),ST)),$A0=$(3,(X,J,Z)=>z(X,as(Z,Ek(J)))),rs=$(3,(X,J,Z)=>z(hU(X),u(yi({onTimeout:()=>JQ(J(),I),duration:Z})),ST)),as=$(3,(X,J,Z)=>{let Q=new _F("Stream Timeout");return z(X,rs(()=>oJ(Q),J),ia((Y)=>zF(Y)&&Hn(Y.defect)&&Y.defect.message!==void 0&&Y.defect.message==="Stream Timeout"?I(Z):S()))}),UA0=(X)=>{if(typeof X==="number")return bA(X);else if(X.capacity==="unbounded")return Yq0({replay:X.replay});switch(X.strategy){case"dropping":return Zq0(X);case"sliding":return Qq0(X);default:return bA(X)}},uk=$(2,(X,J)=>z(A9(UA0(J),(Z)=>F_(Z)),J9((Z)=>z(X,dk(Z),MJ)))),hU=(X)=>u(ur(j0(X)),(J)=>z(J,E9(I),h(w9({onLeft:()=>Y0(S()),onRight:y})))),ck=$((X)=>hQ(X[0]),(X,J)=>J9(A9(J?.strategy==="unbounded"?QW():J?.strategy==="dropping"?A_(J.capacity??2):J?.strategy==="sliding"?T_(J.capacity??2):DY(J?.capacity??2),(Z)=>mX(Z)),(Z)=>MJ(gT(X,Z)))),ss=$((X)=>hQ(X[0]),(X,J)=>J9(A9(DY(J?.capacity??2),(Z)=>mX(Z)),(Z)=>MJ(gs(X,Z)))),zA0=$((X)=>hQ(X[0]),(X,J)=>fk(X,A3,J)),NA0=$((X)=>hQ(X[0]),(X,J)=>u(xQ(),(Z)=>fk(X,Z,J))),fk=$((X)=>hQ(X[0]),(X,J,Z)=>{let Q=KQ(J),Y=void 0,G=void 0,K=kG(!1);return new ReadableStream({start(B){G=Q(ks(X,(H)=>{if(H.length===0)return U0;return K.whenOpen(L0(()=>{K.unsafeClose();for(let W of H)B.enqueue(W);Y(),Y=void 0}))})),G.addObserver((H)=>{try{if(H._tag==="Failure")B.error(BJ(H.cause));else B.close()}catch{}})},pull(){return new Promise((B)=>{Y=B,j9(K.open)})},cancel(){if(!G)return;return YH(p7(T7(G)))}},Z?.strategy)}),OA0=$(2,(X,J)=>{let Z=sX(()=>{let Q={ref:a0()},Y={ref:!1},G=sX(()=>{let W=Q.ref;if(T8(W))return GX({onInput:(V)=>z(q0(V),z0(()=>G)),onFailure:$9,onDone:L6});return Q.ref=a0(),z(JZ(W),z0(()=>G))}),K=(W)=>{let V=Q.ref,U=f8(V,s5(W,(O)=>O.length!==0));return Q.ref=U,U},B=GX({onInput:(W)=>z0(q0(W),()=>B),onFailure:$9,onDone:(W)=>B9(F3(()=>{Y.ref=!0}),L6(W))}),H=z(J,CJ,$H,z0(([W,V])=>z(w6([Y.ref,K(W)]),z0(([U,O])=>{let q=U&&T8(O)?Y8:H;return z(q0(m0(V)),z0(()=>q))}))));return z(j0(X),A8(B),A8(G),V6(H))});return new x0(Z)}),pk=$((X)=>hQ(X[0]),(X,J)=>{let Z=KQ(J);return{[Symbol.asyncIterator](){let Q=void 0,Y=void 0,G=void 0,K=kG(!1),B=!1;return{next(){if(!G)G=Z(vs(X,(H)=>K.whenOpen(L0(()=>{K.unsafeClose(),Q({done:!1,value:H}),Q=Y=void 0})))),G.addObserver((H)=>{if(B)return;G=NY(K.whenOpen(L0(()=>{if(H._tag==="Failure")Y(BJ(H.cause));else Q({done:!0,value:void 0});Q=Y=void 0})))});return new Promise((H,W)=>{Q=H,Y=W,K.unsafeOpen()})},return(){if(B=!0,!G)return Promise.resolve({done:!0,value:void 0});return YH(y9(T7(G),{done:!0,value:void 0}))}}}}}),_A0=(X)=>pk(X,A3),qA0=(X)=>u(xQ(),(J)=>pk(X,J)),ts=(X,J)=>es(X,(Z)=>z(J(Z),r8(([Q,Y])=>[m0(Q),Y]))),es=(X,J)=>{let Z=(Q)=>w0(J(Q),{onNone:()=>Y8,onSome:([Y,G])=>z0(q0(Y),()=>Z(G))});return new x0(sX(()=>Z(X)))},dT=(X,J)=>ZZ(()=>{let Z=(Q)=>o8(u(J(Q),w0({onNone:()=>Y8,onSome:([Y,G])=>z0(q0(Y),()=>Z(G))})));return new x0(Z(X))}),lk=(X,J)=>dT(X,(Z)=>z(J(Z),u(r8(([Q,Y])=>[m0(Q),Y])))),DA0=mT(void 0);var IW=(X)=>r_(F6(X)),pG=(X)=>r_(cU(X)),t_=(X)=>r_(hT((J)=>X(J))),wA0=$(3,(X,J,Z)=>z(X,mk((Q)=>z(Q,X9(J,Z(z(Q,x6(J)))))))),LA0=$(2,(X,J)=>z(X,Jt(L0(J)))),FA0=(X,J)=>Xt(J)(L0(X)),Xt=$(2,(X,J)=>z(F6(X),m6((Z)=>z(J(Z),i0(()=>jH))))),Jt=$(2,(X,J)=>z(F6(J),m6((Z)=>Z?X:jH))),AA0=function(){let X=typeof arguments[0]!=="string",J=X?arguments[1]:arguments[0],Z=FZ(X?arguments[2]:arguments[1]);if(X){let Q=arguments[0];return new x0(pv(j0(Q),J,Z))}return(Q)=>new x0(pv(j0(Q),J,Z))},TA0=$(2,(X,J)=>z(X,ik(J,(Z,Q)=>[Z,Q]))),MA0=$(2,(X,J)=>z(X,ik(J,(Z,Q)=>[...Z,Q]))),PA0=$(2,(X,J)=>cT(X,{other:J.other,onSelf:(Z)=>[Z,J.defaultOther],onOther:(Z)=>[J.defaultSelf,Z],onBoth:(Z,Q)=>[Z,Q]})),RA0=$(3,(X,J,Z)=>cT(X,{other:J,onSelf:t,onOther:()=>Z,onBoth:(Q)=>Q})),jA0=$(3,(X,J,Z)=>cT(X,{other:J,onSelf:()=>Z,onOther:t,onBoth:(Q,Y)=>Y})),CA0=$(2,(X,J)=>uT(X,{other:J.other,onSelf:(Z)=>[Z,J.defaultOther],onOther:(Z)=>[J.defaultSelf,Z],onBoth:(Z,Q)=>[Z,Q],order:J.order})),IA0=$(2,(X,J)=>uT(X,{other:J.other,onSelf:t,onOther:()=>J.defaultSelf,onBoth:(Z)=>Z,order:J.order})),EA0=$(2,(X,J)=>uT(X,{other:J.other,onSelf:()=>J.defaultOther,onOther:t,onBoth:(Z,Q)=>Q,order:J.order})),uT=$(2,(X,J)=>{let Z=(Y,G,K)=>{switch(Y._tag){case ba:return z(G,R7({onFailure:WX,onSuccess:(B)=>v8([p9(B,([H,W])=>[H,J.onSelf(W)]),wW])}));case ya:return z(K,R7({onFailure:WX,onSuccess:(B)=>v8([p9(B,([H,W])=>[H,J.onOther(W)]),LW])}));case ga:return z(AW(G),j7(AW(K),{concurrent:!0}),q9({onFailure:(B)=>y(WX(I(B))),onSuccess:([B,H])=>{if(R0(B)&&R0(H)){if(T8(B.value)&&T8(H.value))return Z(FW,G,K);if(T8(B.value))return Z(AH(H.value),G,K);if(T8(H.value))return Z(TH(B.value),G,K);return y(v8(Q(B.value,H.value)))}if(R0(B)&&j8(H)){if(T8(B.value))return Z(wW,G,K);return y(v8([z(B.value,p9(([W,V])=>[W,J.onSelf(V)])),wW]))}if(j8(B)&&R0(H)){if(T8(H.value))return Z(LW,G,K);return y(v8([z(H.value,p9(([W,V])=>[W,J.onOther(V)])),LW]))}return y(WX(S()))}}));case ha:return q9(G,{onFailure:w0({onNone:()=>y(v8([z(Y.rightChunk,p9(([B,H])=>[B,J.onOther(H)])),LW])),onSome:(B)=>y(WX(I(B)))}),onSuccess:(B)=>T8(B)?Z(AH(Y.rightChunk),G,K):y(v8(Q(B,Y.rightChunk)))});case ma:return q9(K,{onFailure:w0({onNone:()=>y(v8([p9(Y.leftChunk,([B,H])=>[B,J.onSelf(H)]),wW])),onSome:(B)=>y(WX(I(B)))}),onSuccess:(B)=>T8(B)?Z(TH(Y.leftChunk),G,K):y(v8(Q(Y.leftChunk,B)))})}},Q=(Y,G)=>{let K=(j,T)=>T<j.length-1,B=[],H=void 0,W=0,V=0,U=z(Y,HX(W)),O=z(G,HX(V)),q=U[0],L=U[1],A=O[0],M=O[1],x=!0;while(x){let j=J.order(q,A);if(j===0)if(B.push([q,J.onBoth(L,M)]),K(Y,W)&&K(G,V))W=W+1,V=V+1,U=z(Y,HX(W)),O=z(G,HX(V)),q=U[0],L=U[1],A=O[0],M=O[1];else if(K(Y,W))H=TH(z(Y,o9(W+1))),x=!1;else if(K(G,V))H=AH(z(G,o9(V+1))),x=!1;else H=FW,x=!1;else if(j<0)if(B.push([q,J.onSelf(L)]),K(Y,W))W=W+1,U=z(Y,HX(W)),q=U[0],L=U[1];else{let T=[];T.push(O);while(K(G,V))V=V+1,O=z(G,HX(V)),T.push(O);H=AH(Q8(T)),x=!1}else if(B.push([A,J.onOther(M)]),K(G,V))V=V+1,O=z(G,HX(V)),A=O[0],M=O[1];else{let T=[];T.push(U);while(K(Y,W))W=W+1,U=z(Y,HX(W)),T.push(U);H=TH(Q8(T)),x=!1}}return[Q8(B),H]};return jT(X,J.other,FW,Z)}),cT=$(2,(X,J)=>{let Z=(Y,G,K)=>{switch(Y._tag){case ba:return q9(G,{onFailure:(B)=>y(WX(B)),onSuccess:(B)=>y(v8([p9(B,J.onSelf),wW]))});case ya:return q9(K,{onFailure:(B)=>y(WX(B)),onSuccess:(B)=>y(v8([p9(B,J.onOther),LW]))});case ga:return z(AW(G),j7(AW(K),{concurrent:!0}),q9({onFailure:(B)=>y(WX(I(B))),onSuccess:([B,H])=>{if(R0(B)&&R0(H)){if(T8(B.value)&&T8(H.value))return Z(FW,G,K);if(T8(B.value))return Z(AH(H.value),G,K);if(T8(H.value))return Z(TH(B.value),G,K);return y(v8(Q(B.value,H.value,J.onBoth)))}if(R0(B)&&j8(H))return y(v8([p9(B.value,J.onSelf),wW]));if(j8(B)&&R0(H))return y(v8([p9(H.value,J.onOther),LW]));return y(WX(S()))}}));case ha:return q9(G,{onFailure:w0({onNone:()=>y(v8([p9(Y.rightChunk,J.onOther),LW])),onSome:(B)=>y(WX(I(B)))}),onSuccess:(B)=>{if(T8(B))return Z(AH(Y.rightChunk),G,K);if(T8(Y.rightChunk))return Z(TH(B),G,K);return y(v8(Q(B,Y.rightChunk,J.onBoth)))}});case ma:return q9(K,{onFailure:w0({onNone:()=>y(v8([p9(Y.leftChunk,J.onSelf),wW])),onSome:(B)=>y(WX(I(B)))}),onSuccess:(B)=>{if(T8(B))return Z(TH(Y.leftChunk),G,K);if(T8(Y.leftChunk))return Z(AH(B),G,K);return y(v8(Q(Y.leftChunk,B,J.onBoth)))}})}},Q=(Y,G,K)=>{let[B,H]=bA0(Y,G,K);switch(H._tag){case"Left":{if(T8(H.left))return[B,FW];return[B,TH(H.left)]}case"Right":{if(T8(H.right))return[B,FW];return[B,AH(H.right)]}}};return jT(X,J.other,FW,Z)}),SA0=$(2,(X,J)=>z(X,nk(J,(Z,Q)=>[Z,Q]))),Zt=(...X)=>{if(X.length===0)return jH;else if(X.length===1)return t6(X[0],(Q)=>[Q]);let[J,...Z]=X;return nk(J,Zt(...Z),(Q,Y)=>[Q,...Y])},nk=$(3,(X,J,Z)=>{let Q=(Y)=>z(Y,h((G)=>T8(G)?Q(Y):y(G)));return z(hU(X),u(Q),j7(z(hU(J),u(Q))),h(([Y,G])=>z(a_(n1(Y,G,{onSelfDone:(K,B)=>z(o0(()=>K),tJ(EQ(B),(H,W)=>[H,W,!0])),onOtherDone:(K,B)=>z(o0(()=>K),tJ(EQ(B),(H,W)=>[W,H,!1]))})),m6(([K,B,H])=>z(F6(bX([FB(K),FB(B)])),m6((W)=>z(PW(H?z(B,p9((V)=>Z(FB(K),V))):z(K,p9((V)=>Z(V,FB(B))))),TW(z(RW(Y),Vs(RW(G)),S4(w9({onLeft:(V)=>Q5(W,([U,O])=>[z(V,p9((q)=>Z(q,O))),[FB(V),O]]),onRight:(V)=>Q5(W,([U,O])=>[z(V,p9((q)=>Z(U,q))),[U,FB(V)]])})),m6(PW))))))),hU)),ST)}),xA0=$(2,(X,J)=>z(X,fT(J,(Z,Q)=>{if(Z.length>Q.length)return[z(Z,_J(Q.length)),M0(z(Z,_J(Q.length)))];return[Z,O0(z(Q,o9(Z.length)))]}))),vA0=$(2,(X,J)=>z(X,fT(J,(Z,Q)=>{if(Z.length>Q.length)return[Q,M0(z(Z,_J(Q.length)))];return[z(Q,_J(Z.length)),O0(z(Q,o9(Z.length)))]}))),ik=$(3,(X,J,Z)=>z(X,fT(J,(Q,Y)=>bA0(Q,Y,Z)))),fT=$(3,(X,J,Z)=>{let Q=(G,K,B)=>{switch(G._tag){case kw0:return z(AW(K),j7(AW(B),{concurrent:!0}),q9({onFailure:(H)=>y(WX(I(H))),onSuccess:([H,W])=>{if(R0(H)&&R0(W)){if(T8(H.value)&&T8(W.value))return Q(AT,K,B);if(T8(H.value))return Q(TT(W.value),K,B);if(T8(W.value))return Q(MT(H.value),K,B);return y(v8(Y(H.value,W.value)))}return y(WX(S()))}}));case bw0:return q9(K,{onFailure:(H)=>y(WX(H)),onSuccess:(H)=>{if(T8(H))return Q(TT(G.rightChunk),K,B);if(T8(G.rightChunk))return Q(MT(H),K,B);return y(v8(Y(H,G.rightChunk)))}});case yw0:return q9(B,{onFailure:(H)=>y(WX(H)),onSuccess:(H)=>{if(T8(H))return Q(MT(G.leftChunk),K,B);if(T8(G.leftChunk))return Q(TT(H),K,B);return y(v8(Y(G.leftChunk,H)))}})}},Y=(G,K)=>{let[B,H]=Z(G,K);switch(H._tag){case"Left":{if(T8(H.left))return[B,AT];return[B,MT(H.left)]}case"Right":{if(T8(H.right))return[B,AT];return[B,TT(H.right)]}}};return z(X,jT(J,AT,Q))}),Qt=(X)=>z(X,vk(0,(J,Z)=>[J+1,[Z,J]])),Yt=(X)=>{let J=(Z)=>Z9({onInput:(Q)=>{let[Y,G]=tj(Q,Z,(B,H)=>[I(H),z(B,r8((W)=>[W,H]))]),K=u2(G,(B)=>R0(B)?I([B.value[0],I(B.value[1])]):S());return z0(q0(K),()=>J(Y))},onFailure:O8,onDone:()=>w0(Z,{onNone:()=>Y8,onSome:(Q)=>B9(q0(m0([Q,S()])),Y8)})});return new x0(z(j0(X),V6(J(S()))))},Gt=(X)=>z(X,vk(S(),(J,Z)=>[I(Z),[J,Z]])),kA0=(X)=>z(Yt(Gt(X)),t6(([[J,Z],Q])=>[J,Z,z(Q,r8((Y)=>Y[1]))])),bA0=(X,J,Z)=>{if(X.length>J.length)return[z(X,_J(J.length),jw(J,Z)),M0(z(X,o9(J.length)))];return[z(X,jw(z(J,_J(X.length)),Z)),O0(z(J,o9(X.length)))]},yA0=mT({}),gA0=$((X)=>typeof X[0]!=="string",(X,J,Z,Q)=>m6(X,(Y)=>t6(Z(Y),(G)=>({...Y,[J]:G})),Q)),hA0=qK(t6),mA0=_K(t6);var dA0=$((X)=>hQ(X[0]),(X,J="utf-8")=>ZZ(()=>{let Z=new TextDecoder(J);return t6(X,(Q)=>Z.decode(Q,{stream:!0}))})),uA0=(X)=>ZZ(()=>{let J=new TextEncoder;return t6(X,(Z)=>J.encode(Z))}),cA0=(X,J,Z)=>pa((Q)=>A9(L0(()=>X.addEventListener(J,Q.single,Z)),()=>L0(()=>X.removeEventListener(J,Q.single,Z))),{bufferSize:typeof Z==="object"?Z.bufferSize:void 0});var fA0=vv;var ok=I_;var pA0=kU;var EW=z0;var lA0=r0;var rk=sX;var e_=Y8;var ak=q0;var nA0=nv;var iA0=rA;var oA0=h_;var rA0=sA;var aA0=tA;var sA0=VD0;var S7={};y8(S7,{zipWithPreviousAndNext:()=>jW8,zipWithPrevious:()=>RW8,zipWithNext:()=>PW8,zipWithIndex:()=>CW8,zipWithChunks:()=>MW8,zipWith:()=>TW8,zipRight:()=>AW8,zipLeft:()=>FW8,zipLatestWith:()=>LW8,zipLatestAll:()=>wW8,zipLatest:()=>DW8,zipFlatten:()=>WW8,zipAllWith:()=>qW8,zipAllSortedByKeyWith:()=>_W8,zipAllSortedByKeyRight:()=>OW8,zipAllSortedByKeyLeft:()=>NW8,zipAllSortedByKey:()=>zW8,zipAllRight:()=>UW8,zipAllLeft:()=>$W8,zipAll:()=>VW8,zip:()=>HW8,withSpan:()=>BW8,withExecutionPlan:()=>y28,whenEffect:()=>KW8,whenCaseEffect:()=>GW8,whenCase:()=>YW8,when:()=>QW8,void:()=>XW8,updateService:()=>ZW8,unwrapScopedWith:()=>JW8,unwrapScoped:()=>lG,unwrap:()=>rT,unfoldEffect:()=>e18,unfoldChunkEffect:()=>t18,unfoldChunk:()=>s18,unfold:()=>a18,transduce:()=>Ft,toReadableStreamRuntime:()=>n18,toReadableStreamEffect:()=>l18,toReadableStream:()=>p18,toQueueOfElements:()=>f18,toQueue:()=>c18,toPull:()=>u18,toPubSub:()=>d18,toChannel:()=>lB8,toAsyncIterableRuntime:()=>i18,toAsyncIterableEffect:()=>o18,toAsyncIterable:()=>r18,timeoutTo:()=>m18,timeoutFailCause:()=>h18,timeoutFail:()=>g18,timeout:()=>y18,tick:()=>b18,throttleEffect:()=>k18,throttle:()=>v18,tapSink:()=>x18,tapErrorCause:()=>S18,tapError:()=>E18,tapBoth:()=>I18,tap:()=>C18,takeWhile:()=>j18,takeUntilEffect:()=>R18,takeUntil:()=>P18,takeRight:()=>M18,take:()=>T18,sync:()=>A18,suspend:()=>Lt,succeed:()=>F18,splitOnChunk:()=>L18,splitLines:()=>wt,split:()=>w18,someOrFail:()=>D18,someOrElse:()=>q18,some:()=>_18,slidingSize:()=>O18,sliding:()=>N18,share:()=>y38,scopedWith:()=>z18,scoped:()=>U18,scheduleWith:()=>$18,schedule:()=>V18,scanReduceEffect:()=>W18,scanReduce:()=>H18,scanEffect:()=>B18,scan:()=>K18,runSum:()=>G18,runScoped:()=>Y18,runLast:()=>Q18,runIntoQueueScoped:()=>Z18,runIntoQueueElementsScoped:()=>J18,runIntoQueue:()=>X18,runIntoPubSubScoped:()=>e28,runIntoPubSub:()=>t28,runHead:()=>s28,runForEachWhileScoped:()=>a28,runForEachWhile:()=>r28,runForEachScoped:()=>o28,runForEachChunkScoped:()=>i28,runForEachChunk:()=>Jq,runForEach:()=>Dt,runFoldWhileScopedEffect:()=>n28,runFoldWhileScoped:()=>l28,runFoldWhileEffect:()=>p28,runFoldWhile:()=>f28,runFoldScopedEffect:()=>c28,runFoldScoped:()=>u28,runFoldEffect:()=>d28,runFold:()=>m28,runDrain:()=>h28,runCount:()=>g28,runCollect:()=>qt,run:()=>IH,retry:()=>b28,repeatWith:()=>k28,repeatValue:()=>v28,repeatElementsWith:()=>x28,repeatElements:()=>S28,repeatEither:()=>E28,repeatEffectWithSchedule:()=>I28,repeatEffectOption:()=>C28,repeatEffectChunkOption:()=>j28,repeatEffectChunk:()=>R28,repeatEffect:()=>P28,repeat:()=>M28,refineOrDieWith:()=>T28,refineOrDie:()=>A28,rechunk:()=>F28,range:()=>L28,raceAll:()=>w28,race:()=>D28,provideSomeLayer:()=>q28,provideSomeContext:()=>$28,provideServiceStream:()=>O28,provideServiceEffect:()=>N28,provideService:()=>z28,provideLayer:()=>U28,provideContext:()=>oT,prepend:()=>V28,pipeThroughChannelOrFail:()=>Jb,pipeThroughChannel:()=>W28,pipeThrough:()=>H28,peel:()=>B28,partitionEither:()=>K28,partition:()=>G28,paginateEffect:()=>Y28,paginateChunkEffect:()=>Q28,paginateChunk:()=>Z28,paginate:()=>J28,orElseSucceed:()=>X28,orElseIfEmptyStream:()=>eH8,orElseIfEmptyChunk:()=>tH8,orElseIfEmpty:()=>sH8,orElseFail:()=>aH8,orElseEither:()=>rH8,orElse:()=>oH8,orDieWith:()=>iH8,orDie:()=>iT,onStart:()=>nH8,onError:()=>pH8,onEnd:()=>fH8,onDone:()=>lH8,never:()=>cH8,mkString:()=>uH8,mergeWithTag:()=>yH8,mergeWith:()=>gH8,mergeRight:()=>dH8,mergeLeft:()=>mH8,mergeEither:()=>hH8,mergeAll:()=>bH8,merge:()=>kH8,mapInputContext:()=>_28,mapErrorCause:()=>vH8,mapError:()=>_t,mapEffect:()=>QT0,mapConcatEffect:()=>xH8,mapConcatChunkEffect:()=>SH8,mapConcatChunk:()=>EH8,mapConcat:()=>IH8,mapChunksEffect:()=>Ot,mapChunks:()=>Nt,mapBoth:()=>CH8,mapAccumEffect:()=>jH8,mapAccum:()=>RH8,map:()=>PH8,make:()=>MH8,let:()=>vW8,iterate:()=>TH8,intersperseAffixes:()=>wH8,intersperse:()=>DH8,interruptWhenDeferred:()=>AH8,interruptWhen:()=>FH8,interruptAfter:()=>LH8,interleaveWith:()=>qH8,interleave:()=>_H8,identity:()=>OH8,haltWhenDeferred:()=>NH8,haltWhen:()=>zH8,haltAfter:()=>UH8,groupedWithin:()=>$H8,grouped:()=>VH8,groupByKey:()=>WH8,groupBy:()=>HH8,groupAdjacentBy:()=>BH8,fromTQueue:()=>YH8,fromTPubSub:()=>tB8,fromSchedule:()=>KH8,fromReadableStreamByob:()=>GH8,fromReadableStream:()=>nT,fromQueue:()=>QH8,fromPull:()=>ZH8,fromPubSub:()=>sB8,fromIteratorSucceed:()=>JH8,fromIterableEffect:()=>XH8,fromIterable:()=>eB8,fromEventListener:()=>yW8,fromEffectOption:()=>aB8,fromEffect:()=>rB8,fromChunks:()=>oB8,fromChunkQueue:()=>iB8,fromChunkPubSub:()=>nB8,fromChunk:()=>lT,fromChannel:()=>fU,fromAsyncIterable:()=>pB8,forever:()=>fB8,flattenTake:()=>cB8,flattenIterables:()=>uB8,flattenExitOption:()=>dB8,flattenEffect:()=>mB8,flattenChunks:()=>hB8,flatten:()=>gB8,flatMap:()=>Xb,findEffect:()=>yB8,find:()=>bB8,finalizer:()=>kB8,filterMapWhileEffect:()=>vB8,filterMapWhile:()=>xB8,filterMapEffect:()=>SB8,filterMap:()=>EB8,filterEffect:()=>IB8,filter:()=>CB8,failSync:()=>PB8,failCauseSync:()=>jB8,failCause:()=>RB8,fail:()=>Xq,execute:()=>MB8,ensuringWith:()=>wB8,ensuring:()=>zt,encodeText:()=>bW8,empty:()=>DB8,either:()=>qB8,dropWhileEffect:()=>_B8,dropWhile:()=>OB8,dropUntilEffect:()=>NB8,dropUntil:()=>zB8,dropRight:()=>UB8,drop:()=>$B8,drainFork:()=>VB8,drain:()=>WB8,distributedWithDynamic:()=>HB8,distributedWith:()=>BB8,dieSync:()=>GB8,dieMessage:()=>KB8,die:()=>Ut,decodeText:()=>kW8,debounce:()=>YB8,crossWith:()=>QB8,crossRight:()=>ZB8,crossLeft:()=>JB8,cross:()=>XB8,contextWithStream:()=>TB8,contextWithEffect:()=>AB8,contextWith:()=>FB8,context:()=>LB8,concatAll:()=>e38,concat:()=>$t,combineChunks:()=>t38,combine:()=>s38,chunksWith:()=>a38,chunks:()=>r38,changesWithEffect:()=>o38,changesWith:()=>i38,changes:()=>n38,catchTags:()=>p38,catchTag:()=>f38,catchSomeCause:()=>l38,catchSome:()=>c38,catchAllCause:()=>u38,catchAll:()=>ek,bufferChunks:()=>Vt,buffer:()=>d38,broadcastedQueuesDynamic:()=>m38,broadcastedQueues:()=>h38,broadcastDynamic:()=>g38,broadcast:()=>b38,branchAfter:()=>k38,bindTo:()=>xW8,bindEffect:()=>SW8,bind:()=>EW8,asyncScoped:()=>Wt,asyncPush:()=>v38,asyncEffect:()=>x38,async:()=>S38,as:()=>E38,aggregateWithinEither:()=>I38,aggregateWithin:()=>C38,aggregate:()=>j38,acquireRelease:()=>R38,accumulateChunks:()=>P38,accumulate:()=>M38,StreamTypeId:()=>pT,Do:()=>IW8,DefaultChunkSize:()=>T38});var _38="effect/GroupBy",tA0=Symbol.for(_38),q38={_R:(X)=>X,_E:(X)=>X,_K:(X)=>X,_V:(X)=>X},D38=(X)=>V0(X,tA0),w38=$((X)=>D38(X[0]),(X,J,Z)=>m6(X.grouped,([Q,Y])=>J(Q,jW(E4(Y,{shutdown:!0}))),{concurrency:"unbounded",bufferSize:Z?.bufferSize??16}));var eA0=(X)=>({[tA0]:q38,pipe(){return K0(this,arguments)},grouped:X}),XT0=$((X)=>hQ(X[0]),(X,J,Z)=>eA0(pG(f0(function*(){let Q=yield*F9(),Y=yield*A9(DY(Z?.bufferSize??16),(B)=>mX(B)),G=yield*bX(new Map),K=yield*z(S4(X,J),sa(Z?.bufferSize??16,([B,H])=>h(h8(Q),(W)=>W(B,H)),(B)=>g9(Y,B)));return yield*H6(Q,(B,H)=>z(ZX(G),u((W)=>x8(W.get(B))),h(w0({onNone:()=>h(K,([W,V])=>C0(lJ(G,(U)=>U.set(B,W)),z(g9(Y,v8([B,L38(V,(U)=>new gU(z(U,DO((O)=>m0(O[1])))))])),y9((U)=>U===W)))),onSome:(W)=>y((V)=>V===W)})))),mU(E4(Y,{shutdown:!0}))})))),Bt=$((X)=>typeof X[0]!=="function",(X,J,Z)=>{if(Z?.key)return w38(Ht(X,Z.key,{bufferSize:Z.bufferSize}),(Q,Y)=>S4(Y,J));return PT(Z?.concurrency,()=>S4(X,J),(Q)=>Z?.unordered?m6(X,(Y)=>F6(J(Y)),{concurrency:Q}):XF0(X,Q,J))}),JT0=$((X)=>typeof X[0]!=="string",(X,J,Z,Q)=>Bt(X,(Y)=>u(Z(Y),(G)=>({...Y,[J]:G})),Q)),L38=(X,J)=>new ZT0(X,J);class ZT0 extends fJ{dequeue;f;[Kq0]={_Out:(X)=>X};constructor(X,J){super();this.dequeue=X,this.f=J}capacity(){return Bq0(this.dequeue)}get size(){return Zv(this.dequeue)}unsafeSize(){return this.dequeue.unsafeSize()}get awaitShutdown(){return Vq0(this.dequeue)}isActive(){return this.dequeue.isActive()}get isShutdown(){return yA(this.dequeue)}get shutdown(){return mX(this.dequeue)}get isFull(){return Wq0(this.dequeue)}get isEmpty(){return Hq0(this.dequeue)}get take(){return z(EZ(this.dequeue),u((X)=>this.f(X)))}get takeAll(){return z(Uq0(this.dequeue),u(p9((X)=>this.f(X))))}takeUpTo(X){return z(zq0(this.dequeue,X),u(p9((J)=>this.f(J))))}takeBetween(X,J){return z(Qv(this.dequeue,X,J),u(p9((Z)=>this.f(Z))))}takeN(X){return z(Nq0(this.dequeue,X),u(p9((J)=>this.f(J))))}poll(){return z($q0(this.dequeue),u(r8((X)=>this.f(X))))}pipe(){return K0(this,arguments)}commit(){return this.take}}var Ht=$((X)=>typeof X[0]!=="function",(X,J,Z)=>{let Q=(Y,G)=>Z9({onInput:(K)=>z0(r0(a9(F38(K,J),([B,H])=>{let W=Y.get(B);if(W===void 0)return z(DY(Z?.bufferSize??16),h((V)=>z(L0(()=>{Y.set(B,V)}),C0(g9(G,Dk([B,V]))),C0(z(g9(V,LH(H)),BU((U)=>W3(U)?I(U0):S()))))));return BU(g9(W,LH(H)),(V)=>W3(V)?I(U0):S())},{discard:!0})),()=>Q(Y,G)),onFailure:(K)=>r0(g9(G,FH(K))),onDone:()=>r0(z(a9(Y.entries(),([K,B])=>z(g9(B,fG),BU((H)=>W3(H)?I(U0):S())),{discard:!0}),C0(g9(G,fG))))});return eA0(t_((Y)=>f0(function*(){let G=new Map,K=yield*QW();return yield*FJ(Y,mX(K)),yield*j0(X).pipe(A8(Q(G,K)),j4,wY(Y),$X(Y),y9(jW(E4(K,{shutdown:!0}))))})))}),F38=$(2,(X,J)=>{let Z=[],Q=X[Symbol.iterator](),Y=new Map,G;while((G=Q.next())&&!G.done){let K=G.value,B=J(K);if(Y.has(B))Y.get(B).push(K);else{let H=[K];Z.push([B,H]),Y.set(B,H)}}return Q8(Z.map((K)=>[K[0],Q8(K[1])]))});var pT=Tk,T38=n_,M38=uw0,P38=da,R38=ua,j38=cw0,C38=Mk,I38=ca,E38=fw0,S38=pw0;var x38=lw0,v38=pa,Wt=nw0,k38=iw0,b38=ow0,y38=rw0,g38=la,h38=na,m38=aw0,d38=sw0,Vt=tw0,ek=RH,u38=i_,c38=ew0,f38=XL0,p38=JL0,l38=ia,n38=ZL0,i38=oa,o38=QL0,r38=RT,a38=YL0,s38=GL0,t38=jT,$t=TW,e38=KL0,XB8=BL0,JB8=HL0,ZB8=Rk,QB8=jk,YB8=WL0,Ut=Ck,GB8=VL0,KB8=$L0,BB8=ra,HB8=aa,WB8=o_,VB8=UL0,$B8=ta,UB8=zL0,zB8=NL0,NB8=OL0,OB8=ea,_B8=_L0,qB8=qL0,DB8=jH,zt=PH,wB8=DL0,LB8=CT,FB8=wL0,AB8=LL0,TB8=Ik,MB8=Xs,Xq=MH,PB8=Ek,RB8=IT,jB8=FL0,CB8=AL0,IB8=Js,EB8=MW,SB8=TL0,xB8=ML0,vB8=PL0,kB8=RL0,bB8=jL0,yB8=CL0,Xb=m6,gB8=r_,hB8=ET,mB8=IL0,dB8=mU,uB8=EL0,cB8=jW,fB8=Sk,pB8=SL0,fU=CW,lB8=j0,lT=PW,nB8=xL0,iB8=Fk,oB8=vL0,rB8=F6,aB8=a_,sB8=Zs,tB8=kL0,eB8=s_,XH8=bL0,JH8=Qs,ZH8=ST,QH8=E4,YH8=Ys,nT=gL0,GH8=hL0,KH8=yL0,BH8=dL0,HH8=XT0,WH8=Ht,VH8=uL0,$H8=cL0,UH8=fL0,zH8=Gs,NH8=pL0,OH8=Ks,_H8=lL0,qH8=Bs,DH8=Hs,wH8=nL0,LH8=iL0,FH8=xk,AH8=Ws,TH8=oL0,MH8=l_,PH8=t6,RH8=vk,jH8=kk,CH8=rL0,Nt=dU,Ot=aL0,IH8=sL0,EH8=xT,SH8=tL0,xH8=eL0,QT0=Bt,_t=bk,vH8=JF0,kH8=vT,bH8=yk,yH8=ZF0,gH8=gk,hH8=Vs,mH8=QF0,dH8=YF0,uH8=GF0,cH8=KF0,fH8=BF0,pH8=HF0,lH8=WF0,nH8=VF0,iT=$F0,iH8=$s,oH8=kT,rH8=UF0,aH8=zF0,sH8=NF0,tH8=Us,eH8=zs,X28=OF0,J28=_F0,Z28=Ns,Q28=Os,Y28=_s,G28=DF0,K28=qs,B28=qF0,H28=wF0,W28=Ds,Jb=LF0,V28=FF0,oT=hk,$28=ws,U28=Ls,z28=AF0,N28=bT,O28=Fs,_28=mk,q28=As,D28=MF0,w28=Ts,L28=TF0,F28=yT,A28=RF0,T28=Ms,M28=jF0,P28=CF0,R28=IF0,j28=CH,C28=RW,I28=Cs,E28=Ps,S28=EF0,x28=Rs,v28=SF0,k28=js,b28=Ak,y28=xF0,IH=BQ,qt=vF0,g28=kF0,h28=bF0,m28=yF0,d28=gF0,u28=hF0,c28=mF0,f28=Is,p28=Es,l28=Ss,n28=xs,Dt=vs,Jq=ks,i28=dF0,o28=bs,r28=uF0,a28=cF0,s28=fF0,t28=pF0,e28=dk,X18=ys,J18=gs,Z18=gT,Q18=lF0,Y18=uU,G18=nF0,K18=iF0,B18=ds,H18=oF0,W18=hs,V18=rF0,$18=ms,U18=cU,z18=hT,N18=tF0,O18=cs,_18=aF0,q18=sF0,D18=us,w18=eF0,L18=XA0,wt=JA0,F18=mT,A18=fs,Lt=ZZ,T18=ZA0,M18=QA0,P18=YA0,R18=GA0,j18=ps,C18=ls,I18=KA0,E18=ns,S18=is,x18=BA0,v18=HA0,k18=os,b18=WA0,y18=VA0,g18=$A0,h18=rs,m18=as,d18=uk,u18=hU,c18=ck,f18=ss,p18=zA0,l18=NA0,n18=fk,i18=pk,o18=qA0,r18=_A0,Ft=OA0,a18=ts,s18=es,t18=dT,e18=lk,XW8=DA0;var rT=IW,lG=pG,JW8=t_,ZW8=wA0,QW8=LA0,YW8=FA0,GW8=Xt,KW8=Jt,BW8=AA0,HW8=TA0,WW8=MA0,VW8=PA0,$W8=RA0,UW8=jA0,zW8=CA0,NW8=IA0,OW8=EA0,_W8=uT,qW8=cT,DW8=SA0,wW8=Zt,LW8=nk,FW8=xA0,AW8=vA0,TW8=ik,MW8=fT,PW8=Yt,RW8=Gt,jW8=kA0,CW8=Qt,IW8=yA0,EW8=gA0,SW8=JT0,xW8=hA0,vW8=mA0;var kW8=dA0,bW8=uA0,yW8=cA0;var PY={};y8(PY,{isPlatformError:()=>X_8,TypeIdError:()=>Uq,TypeId:()=>$q,SystemErrorReason:()=>AC0,SystemError:()=>VQ,PlatformError:()=>J_8,Module:()=>p00,BadArgument:()=>yZ});var D={};y8(D,{withDefaults:()=>Xz8,withDecodingDefault:()=>YR0,withConstructorDefault:()=>bW,validateSync:()=>RU,validatePromise:()=>hU8,validateOption:()=>jO0,validateEither:()=>gU8,validate:()=>xb,validDate:()=>E00,uppercased:()=>wR0,uncapitalized:()=>TR0,typeSchema:()=>l8,trimmed:()=>UR0,transformOrFail:()=>d6,transformLiterals:()=>Oz8,transformLiteral:()=>VR0,transform:()=>k8,tag:()=>mQ,symbolWithResult:()=>mH,symbolSerializable:()=>LM,suspend:()=>Mb,successSchema:()=>Eb,startsWith:()=>wz8,standardSchemaV1:()=>xU8,split:()=>Az8,serializeSuccess:()=>lO8,serializeFailure:()=>fO8,serializeExit:()=>iO8,serialize:()=>dO8,serializableSchema:()=>mO8,requiredToOptional:()=>Zz8,required:()=>$z8,rename:()=>Dz8,propertySignature:()=>Hq,positiveBigInt:()=>T00,positiveBigDecimal:()=>tj0,positive:()=>oR0,pluck:()=>Bz8,pickLiteral:()=>dU8,pick:()=>BR0,pattern:()=>U00,partialWith:()=>Vz8,partial:()=>Wz8,parseNumber:()=>tR0,parseJson:()=>w00,optionalWith:()=>X0,optionalToRequired:()=>vH,optionalToOptional:()=>Pe,optionalElement:()=>rU8,optional:()=>u0,omit:()=>Kz8,nonPositiveBigInt:()=>R00,nonPositiveBigDecimal:()=>YC0,nonPositive:()=>aR0,nonNegativeBigInt:()=>P00,nonNegativeBigDecimal:()=>XC0,nonNegative:()=>sR0,nonNaN:()=>iR0,nonEmptyString:()=>q00,negativeBigInt:()=>M00,negativeBigDecimal:()=>ZC0,negative:()=>rR0,mutable:()=>Uz8,multipleOf:()=>Pz8,minLength:()=>$6,minItems:()=>JN8,maxLength:()=>$00,maxItems:()=>ZN8,makePropertySignature:()=>I3,make:()=>t8,lowercased:()=>qR0,lessThanOrEqualToDuration:()=>nz8,lessThanOrEqualToDate:()=>HN8,lessThanOrEqualToBigInt:()=>zj0,lessThanOrEqualToBigDecimal:()=>lN8,lessThanOrEqualTo:()=>S3,lessThanDuration:()=>pz8,lessThanDate:()=>BN8,lessThanBigInt:()=>Uj0,lessThanBigDecimal:()=>pN8,lessThan:()=>fR0,length:()=>OR0,keyof:()=>oU8,itemsCount:()=>QN8,isSchema:()=>eX,isPropertySignature:()=>gb,is:()=>XW,int:()=>OM,instanceOf:()=>tP0,includes:()=>Fz8,headOrElse:()=>KN8,headNonEmpty:()=>GN8,head:()=>YN8,greaterThanOrEqualToDuration:()=>oz8,greaterThanOrEqualToDate:()=>VN8,greaterThanOrEqualToBigInt:()=>$j0,greaterThanOrEqualToBigDecimal:()=>fN8,greaterThanOrEqualTo:()=>dQ,greaterThanDuration:()=>iz8,greaterThanDate:()=>WN8,greaterThanBigInt:()=>Vj0,greaterThanBigDecimal:()=>cN8,greaterThan:()=>hR0,getNumberIndexedAccess:()=>cb,getClassTag:()=>ob,fromKey:()=>Jz8,fromBrand:()=>nU8,format:()=>dX,finite:()=>F00,filterEffect:()=>Nz8,filter:()=>n8,failureSchema:()=>Z00,extend:()=>NM,exitSchema:()=>c00,equivalence:()=>sO8,endsWith:()=>Lz8,encodedSchema:()=>Sb,encodedBoundSchema:()=>Q00,encodeUnknownSync:()=>co,encodeUnknownPromise:()=>pP0,encodeUnknownOption:()=>fo,encodeUnknownEither:()=>fP0,encodeUnknown:()=>A5,encodeSync:()=>JW,encodePromise:()=>kU8,encodeOption:()=>SO0,encodeEither:()=>vU8,encode:()=>E3,element:()=>Te,deserializeSuccess:()=>nO8,deserializeFailure:()=>pO8,deserializeExit:()=>oO8,deserialize:()=>uO8,decodeUnknownSync:()=>ho,decodeUnknownPromise:()=>nP0,decodeUnknownOption:()=>mo,decodeUnknownEither:()=>lP0,decodeUnknown:()=>t9,decodeSync:()=>__,decodePromise:()=>yU8,decodeOption:()=>RO0,decodeEither:()=>bU8,decode:()=>Y00,declare:()=>X6,compose:()=>oU,clampDuration:()=>fz8,clampBigInt:()=>jz8,clampBigDecimal:()=>aN8,clamp:()=>Rz8,capitalized:()=>FR0,brand:()=>Hz8,betweenDuration:()=>Tj0,betweenDate:()=>$N8,betweenBigInt:()=>A00,betweenBigDecimal:()=>GC0,between:()=>uW,attachPropertySignature:()=>_z8,asserts:()=>EO0,asWithResult:()=>cO8,asSerializableWithResult:()=>rO8,asSerializable:()=>hO8,asSchema:()=>qX,annotations:()=>qz8,Void:()=>yH,ValidDateSchemaId:()=>de,ValidDateFromSelf:()=>Cj0,UppercasedSchemaId:()=>DR0,Uppercased:()=>N00,Uppercase:()=>RR0,Unknown:()=>A6,UniqueSymbolFromSelf:()=>oP0,Union:()=>U8,UndefinedOr:()=>SJ,Undefined:()=>vb,UncapitalizedSchemaId:()=>AR0,Uncapitalized:()=>_00,Uncapitalize:()=>CR0,Uint8ArrayFromSelf:()=>ub,Uint8ArrayFromHex:()=>az8,Uint8ArrayFromBase64Url:()=>rz8,Uint8ArrayFromBase64:()=>qM,Uint8Array:()=>Mj0,Uint8:()=>j00,UUIDSchemaId:()=>SR0,UUID:()=>xR0,URLFromSelf:()=>L00,URL:()=>bR0,ULIDSchemaId:()=>vR0,ULID:()=>kR0,TypeId:()=>gW,Tuple:()=>bZ,TrimmedSchemaId:()=>$R0,Trimmed:()=>mb,Trim:()=>IR0,ToPropertySignature:()=>C3,TimeZoneOffsetFromSelf:()=>pb,TimeZoneOffset:()=>kj0,TimeZoneNamedFromSelf:()=>lb,TimeZoneNamed:()=>yj0,TimeZoneFromSelf:()=>v00,TimeZone:()=>gj0,TemplateLiteralParser:()=>fU8,TemplateLiteral:()=>aP0,TaggedStruct:()=>zM,TaggedRequest:()=>aO8,TaggedError:()=>WQ,TaggedClass:()=>BO8,SymbolFromSelf:()=>bb,Symbol:()=>Wj0,Struct:()=>$0,StringFromUriComponent:()=>XN8,StringFromHex:()=>ez8,StringFromBase64Url:()=>tz8,StringFromBase64:()=>sz8,String:()=>d,StartsWithSchemaId:()=>Ce,SortedSetFromSelf:()=>DC0,SortedSet:()=>yO8,SetFromSelf:()=>oj0,Set:()=>mN8,RefineSchemaId:()=>W00,RedactedFromSelf:()=>_j0,Redacted:()=>yz8,Record:()=>i7,ReadonlySetFromSelf:()=>ij0,ReadonlySet:()=>hN8,ReadonlyMapFromSelf:()=>y00,ReadonlyMapFromRecord:()=>vN8,ReadonlyMap:()=>SN8,PropertySignatureTypeId:()=>K00,PropertySignatureTransformation:()=>aG,PropertySignatureDeclaration:()=>hW,PropertyKey:()=>f00,PositiveBigIntFromSelf:()=>Cz8,PositiveBigInt:()=>Iz8,PositiveBigDecimalSchemaId:()=>sj0,PositiveBigDecimalFromSelf:()=>nN8,Positive:()=>Jj0,PatternSchemaId:()=>je,OptionFromUndefinedOr:()=>AN8,OptionFromSelf:()=>aU,OptionFromNullishOr:()=>FN8,OptionFromNullOr:()=>LN8,OptionFromNonEmptyTrimmedString:()=>uj0,Option:()=>dj0,Object:()=>eP0,NumberFromString:()=>hH,Number:()=>L8,NullishOr:()=>BM,NullOr:()=>KM,Null:()=>gH,Not:()=>Kj0,NonPositiveBigIntFromSelf:()=>xz8,NonPositiveBigInt:()=>vz8,NonPositiveBigDecimalSchemaId:()=>QC0,NonPositiveBigDecimalFromSelf:()=>rN8,NonPositive:()=>Qj0,NonNegativeInt:()=>Pb,NonNegativeBigIntFromSelf:()=>Nj0,NonNegativeBigInt:()=>kz8,NonNegativeBigDecimalSchemaId:()=>ej0,NonNegativeBigDecimalFromSelf:()=>iN8,NonNegative:()=>db,NonNaNSchemaId:()=>nR0,NonNaN:()=>Xj0,NonEmptyTrimmedString:()=>D00,NonEmptyString:()=>ER0,NonEmptyChunkFromSelf:()=>KC0,NonEmptyChunk:()=>ZO8,NonEmptyArrayEnsure:()=>tU8,NonEmptyArray:()=>j3,Never:()=>b4,NegativeBigIntFromSelf:()=>Ez8,NegativeBigInt:()=>Sz8,NegativeBigDecimalSchemaId:()=>JC0,NegativeBigDecimalFromSelf:()=>oN8,Negative:()=>Zj0,MultipleOfSchemaId:()=>dR0,MinLengthSchemaId:()=>NR0,MinItemsSchemaId:()=>Pj0,MaxLengthSchemaId:()=>zR0,MaxItemsSchemaId:()=>Rj0,MapFromSelf:()=>g00,MapFromRecord:()=>kN8,Map:()=>xN8,LowercasedSchemaId:()=>_R0,Lowercased:()=>z00,Lowercase:()=>PR0,Literal:()=>s0,ListFromSelf:()=>qC0,List:()=>vO8,LessThanSchemaId:()=>cR0,LessThanOrEqualToSchemaId:()=>pR0,LessThanOrEqualToDurationSchemaId:()=>lz8,LessThanOrEqualToDateSchemaId:()=>ce,LessThanOrEqualToBigIntSchemaId:()=>be,LessThanOrEqualToBigDecimalSchemaId:()=>ee,LessThanDurationSchemaId:()=>WM,LessThanDateSchemaId:()=>ue,LessThanBigIntSchemaId:()=>ke,LessThanBigDecimalSchemaId:()=>te,LengthSchemaId:()=>Re,JsonNumberSchemaId:()=>Yj0,JsonNumber:()=>Gj0,ItemsCountSchemaId:()=>jj0,IntSchemaId:()=>uR0,Int:()=>F5,InstanceOfSchemaId:()=>Ae,IncludesSchemaId:()=>Ee,HashSetFromSelf:()=>OC0,HashSet:()=>PO8,HashMapFromSelf:()=>_C0,HashMap:()=>IO8,GreaterThanSchemaId:()=>gR0,GreaterThanOrEqualToSchemaId:()=>mR0,GreaterThanOrEqualToDurationSchemaId:()=>he,GreaterThanOrEqualToDateSchemaId:()=>pe,GreaterThanOrEqualToBigIntSchemaId:()=>ve,GreaterThanOrEqualToBigDecimalSchemaId:()=>se,GreaterThanDurationSchemaId:()=>ge,GreaterThanDateSchemaId:()=>fe,GreaterThanBigIntSchemaId:()=>xe,GreaterThanBigDecimalSchemaId:()=>ae,FromPropertySignature:()=>mW,FiniteSchemaId:()=>yR0,Finite:()=>eR0,FiberIdFromSelf:()=>d00,FiberId:()=>VC0,ExitFromSelf:()=>NC0,Exit:()=>$M,Enums:()=>cU8,EndsWithSchemaId:()=>Ie,EitherFromUnion:()=>jN8,EitherFromSelf:()=>b00,Either:()=>RN8,DurationFromSelf:()=>_M,DurationFromNanos:()=>qj0,DurationFromMillis:()=>Dj0,Duration:()=>Aj0,Defect:()=>e6,DateTimeZonedFromSelf:()=>k00,DateTimeZoned:()=>hj0,DateTimeUtcFromSelf:()=>DM,DateTimeUtcFromNumber:()=>Ej0,DateTimeUtcFromDate:()=>Sj0,DateTimeUtc:()=>xj0,DateFromString:()=>S00,DateFromSelfSchemaId:()=>ne,DateFromSelf:()=>Vq,DateFromNumber:()=>Ij0,Date:()=>fb,DataFromSelf:()=>BC0,Data:()=>GO8,Config:()=>gO8,Class:()=>D9,ChunkFromSelf:()=>wM,Chunk:()=>eN8,Char:()=>MR0,CauseFromSelf:()=>Ib,Cause:()=>u00,CapitalizedSchemaId:()=>LR0,Capitalized:()=>O00,Capitalize:()=>jR0,BrandSchemaId:()=>Fe,BooleanFromUnknown:()=>wC0,BooleanFromString:()=>LC0,Boolean:()=>q8,BigIntFromSelf:()=>dW,BigIntFromNumber:()=>Oj0,BigInt:()=>rU,BigDecimalFromSelf:()=>cW,BigDecimalFromNumber:()=>aj0,BigDecimal:()=>rj0,BetweenSchemaId:()=>lR0,BetweenDurationSchemaId:()=>me,BetweenDateSchemaId:()=>le,BetweenBigIntSchemaId:()=>ye,BetweenBigDecimalSchemaId:()=>X00,ArrayFormatterIssue:()=>FC0,ArrayEnsure:()=>sU8,Array:()=>K8,Any:()=>kb});var YT0=/^[+-]?\d+$/,At=Symbol.for("effect/BigDecimal"),gW8={[At]:At,[y0](){let X=pU(this);return z(Z0(X.value),A0(BB(X.scale)),W8(this))},[b0](X){return Mt(X)&&mW8(this,X)},toString(){return`BigDecimal(${iG(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[$8](){return this.toJSON()},pipe(){return K0(this,arguments)}},Mt=(X)=>V0(X,At),SW=(X,J)=>{let Z=Object.create(gW8);return Z.value=X,Z.scale=J,Z},KT0=(X,J)=>{if(X!==nG&&X%Tt===nG)throw RangeError("Value must be normalized");let Z=SW(X,J);return Z.normalized=Z,Z},nG=BigInt(0);var Tt=BigInt(10),BT0=KT0(nG,0),pU=(X)=>{if(X.normalized===void 0)if(X.value===nG)X.normalized=BT0;else{let J=`${X.value}`,Z=0;for(let G=J.length-1;G>=0;G--)if(J[G]==="0")Z++;else break;if(Z===0)X.normalized=X;let Q=BigInt(J.substring(0,J.length-Z)),Y=X.scale-Z;X.normalized=KT0(Q,Y)}return X.normalized},Zb=$(2,(X,J)=>{if(J>X.scale)return SW(X.value*Tt**BigInt(J-X.scale),J);if(J<X.scale)return SW(X.value/Tt**BigInt(X.scale-J),J);return X});var Zq=fZ((X,J)=>{let Z=Uw(GT0(X),GT0(J));if(Z!==0)return Z;if(X.scale>J.scale)return DN(X.value,Zb(J,X.scale).value);if(X.scale<J.scale)return DN(Zb(X,J.scale).value,J.value);return DN(X.value,J.value)}),HT0=UB(Zq),WT0=g2(Zq),VT0=zB(Zq),$T0=NB(Zq),UT0=h2(Zq),zT0=RK(Zq);var GT0=(X)=>X.value===nG?0:X.value<nG?-1:1,hW8=(X)=>X.value<nG?SW(-X.value,X.scale):X;var Pt=I6((X,J)=>{if(X.scale>J.scale)return Zb(J,X.scale).value===X.value;if(X.scale<J.scale)return Zb(X,J.scale).value===J.value;return X.value===J.value}),mW8=$(2,(X,J)=>Pt(X,J));var NT0=(X)=>Tj(dW8(X),()=>RangeError(`Number must be finite, got ${X}`));var dW8=(X)=>{if(!Number.isFinite(X))return S();let J=`${X}`;if(J.includes("e"))return Rt(J);let[Z,Q=""]=J.split(".");return I(SW(BigInt(`${Z}${Q}`),Q.length))},Rt=(X)=>{if(X==="")return I(BT0);let J,Z,Q=X.search(/[eE]/);if(Q!==-1){let H=X.slice(Q+1);if(J=X.slice(0,Q),Z=Number(H),J===""||!Number.isSafeInteger(Z)||!YT0.test(H))return S()}else J=X,Z=0;let Y,G,K=J.search(/\./);if(K!==-1){let H=J.slice(0,K),W=J.slice(K+1);Y=`${H}${W}`,G=W.length}else Y=J,G=0;if(!YT0.test(Y))return S();let B=G-Z;if(!Number.isSafeInteger(B))return S();return I(SW(BigInt(Y),B))};var iG=(X)=>{let J=pU(X);if(Math.abs(J.scale)>=16)return uW8(J);let Z=J.value<nG,Q=Z?`${J.value}`.substring(1):`${J.value}`,Y,G;if(J.scale>=Q.length)Y="0",G="0".repeat(J.scale-Q.length)+Q;else{let B=Q.length-J.scale;if(B>Q.length){let H=B-Q.length;Y=`${Q}${"0".repeat(H)}`,G=""}else G=Q.slice(B),Y=Q.slice(0,B)}let K=G===""?Y:`${Y}.${G}`;return Z?`-${K}`:K},uW8=(X)=>{if(cW8(X))return"0e+0";let J=pU(X),Z=`${hW8(J).value}`,Q=Z.slice(0,1),Y=Z.slice(1),G=`${jt(J)?"-":""}${Q}`;if(Y!=="")G+=`.${Y}`;let K=Y.length-J.scale;return`${G}e${K>=0?"+":""}${K}`},OT0=(X)=>Number(iG(X));var cW8=(X)=>X.value===nG,jt=(X)=>X.value<nG,_T0=(X)=>X.value>nG;var pW8=DN;var qT0=RK(pW8);var DT0=(X)=>{if(X>BigInt(Number.MAX_SAFE_INTEGER)||X<BigInt(Number.MIN_SAFE_INTEGER))return S();return I(Number(X))},wT0=(X)=>{try{return X.trim()===""?S():I(BigInt(X))}catch{return S()}},LT0=(X)=>{if(X>Number.MAX_SAFE_INTEGER||X<Number.MIN_SAFE_INTEGER)return S();try{return I(BigInt(X))}catch{return S()}};var P0={};y8(P0,{zipWith:()=>vV8,zip:()=>xV8,withDescription:()=>SV8,withDefault:()=>EV8,validate:()=>IV8,url:()=>ZV8,unwrap:()=>CV8,sync:()=>RV8,suspend:()=>PV8,succeed:()=>MV8,string:()=>bt,secret:()=>wV8,repeat:()=>DV8,redacted:()=>LV8,primitive:()=>qV8,port:()=>JV8,orElseIf:()=>OV8,orElse:()=>NV8,option:()=>_V8,number:()=>KV8,nonEmptyString:()=>TV8,nested:()=>zV8,mapOrFail:()=>kt,mapAttempt:()=>UV8,map:()=>$V8,logLevel:()=>WV8,literal:()=>HV8,isConfig:()=>vt,integer:()=>BV8,hashSet:()=>AV8,hashMap:()=>jV8,fail:()=>GV8,duration:()=>VV8,date:()=>YV8,chunk:()=>QV8,branded:()=>FV8,boolean:()=>XV8,array:()=>eW8,all:()=>tW8,ConfigTypeId:()=>sW8});var FT0="effect/Redacted",EH=c0("effect/Redacted/redactedRegistry",()=>new WeakMap),Qb=Symbol.for(FT0),Ct={[Qb]:{_A:(X)=>X},pipe(){return K0(this,arguments)},toString(){return"<redacted>"},toJSON(){return"<redacted>"},[$8](){return"<redacted>"},[y0](){return z(Z0(FT0),A0(Z0(EH.get(this))),W8(this))},[b0](X){return It(X)&&_0(EH.get(this),EH.get(X))}},It=(X)=>V0(X,Qb),Yb=(X)=>{let J=Object.create(Ct);return EH.set(J,X),J},AT0=(X)=>{if(EH.has(X))return EH.get(X);else throw Error("Unable to get redacted value")},TT0=(X)=>EH.delete(X);var nW8="effect/Secret",St=Symbol.for(nW8);var iW8={...Ct,[St]:St},MT0=(X)=>{let J=Object.create(iW8);return Object.defineProperty(J,"toString",{enumerable:!1,value(){return"Secret(<redacted>)"}}),Object.defineProperty(J,"toJSON",{enumerable:!1,value(){return"<redacted>"}}),Object.defineProperty(J,"raw",{enumerable:!1,value:X}),EH.set(J,X.map((Z)=>String.fromCharCode(Z)).join("")),J};var Gb=(X)=>{return MT0(X.split("").map((J)=>J.charCodeAt(0)))};var oW8="effect/Config",Bb=Symbol.for(oW8),rW8={_A:(X)=>X},x4={...KG,[Bb]:rW8,commit(){return fK0(this)}},jT0=(X)=>{let J=v4("a boolean property",(Z)=>{switch(Z){case"true":case"yes":case"on":case"1":return O0(!0);case"false":case"no":case"off":case"0":return O0(!1);default:{let Q=lZ([],`Expected a boolean value but received ${E6(Z)}`);return M0(Q)}}});return X===void 0?J:kZ(J,X)},CT0=(X)=>{let J=v4("an URL property",(Z)=>y2({try:()=>new URL(Z),catch:(Q)=>lZ([],`Expected an URL value but received ${E6(Z)}`)}));return X===void 0?J:kZ(J,X)},IT0=(X)=>{let J=v4("a network port property",(Z)=>{let Q=Number(Z);if(Number.isNaN(Q)||Q.toString()!==Z.toString()||!Number.isInteger(Q)||Q<1||Q>65535)return M0(lZ([],`Expected a network port value but received ${E6(Z)}`));return O0(Q)});return X===void 0?J:kZ(J,X)},ET0=(X,J)=>{return z(Hb(X,J),P3(Tw))},Hb=(X,J)=>{return P3(J===void 0?Kb(X):kZ(Kb(X),J),Q8)},ST0=(X)=>{let J=v4("a date property",(Z)=>{let Q=Date.parse(Z);if(Number.isNaN(Q))return M0(lZ([],`Expected a Date value but received ${E6(Z)}`));return O0(new Date(Q))});return X===void 0?J:kZ(J,X)},xT0=(X)=>{let J=Object.create(x4);return J._tag=RI,J.message=X,J.parse=()=>M0(fj([],X)),J},vT0=(X)=>{let J=v4("a number property",(Z)=>{let Q=Number(Z);if(Number.isNaN(Q))return M0(lZ([],`Expected a number value but received ${E6(Z)}`));return O0(Q)});return X===void 0?J:kZ(J,X)},kT0=(X)=>{let J=v4("an integer property",(Z)=>{let Q=Number(Z);if(!Number.isInteger(Q))return M0(lZ([],`Expected an integer value but received ${E6(Z)}`));return O0(Q)});return X===void 0?J:kZ(J,X)},bT0=(...X)=>(J)=>{let Z=X.map(String).join(", "),Q=v4(`one of (${Z})`,(Y)=>{let G=X.find((K)=>String(K)===Y);if(G===void 0)return M0(lZ([],`Expected one of (${Z}) but received ${E6(Y)}`));return O0(G)});return J===void 0?Q:kZ(Q,J)},yT0=(X)=>{let J=xW(Qq(),(Z)=>{let Q=Z.toUpperCase(),Y=zI.find((G)=>G.label===Q);return Y===void 0?M0(lZ([],`Expected a log level but received ${E6(Z)}`)):O0(Y)});return X===void 0?J:kZ(J,X)},gT0=(X)=>{let J=xW(Qq(),(Z)=>{let Q=Qf(Z);return Ww(Q,()=>lZ([],`Expected a duration but received ${E6(Z)}`))});return X===void 0?J:kZ(J,X)},P3=$(2,(X,J)=>xW(X,(Z)=>O0(J(Z)))),hT0=$(2,(X,J)=>xW(X,(Z)=>{try{return O0(J(Z))}catch(Q){return M0(lZ([],Q instanceof Error?Q.message:`${Q}`))}})),xW=$(2,(X,J)=>{let Z=Object.create(x4);return Z._tag=II,Z.original=X,Z.mapOrFail=J,Z}),kZ=$(2,(X,J)=>{let Z=Object.create(x4);return Z._tag=EI,Z.name=J,Z.config=X,Z}),mT0=$(2,(X,J)=>{let Z=Object.create(x4);return Z._tag=PL,Z.first=X,Z.second=aT(J),Z.condition=G6,Z}),Wb=$(2,(X,J)=>{let Z=Object.create(x4);return Z._tag=PL,Z.first=X,Z.second=aT(J.orElse),Z.condition=J.if,Z}),dT0=(X)=>{return z(X,P3(I),Wb({orElse:()=>Yq(S()),if:sV}))},v4=(X,J)=>{let Z=Object.create(x4);return Z._tag=SI,Z.description=X,Z.parse=J,Z},Kb=(X)=>{let J=Object.create(x4);return J._tag=xI,J.config=X,J},uT0=(X)=>{let J=v4("a secret property",(Z)=>O0(Gb(Z)));return X===void 0?J:kZ(J,X)},cT0=(X)=>{let J=sT(X)?X:Qq(X);return P3(J,Yb)},fT0=$(2,(X,J)=>{let Z=sT(X)?X:Qq(X);return xW(Z,(Q)=>J.either(Q).pipe(eQ((Y)=>lZ([],Y.map((G)=>G.message).join(`
190
+ `)))))}),pT0=(X,J)=>{let Z=P3(Hb(X),X4);return J===void 0?Z:kZ(Z,J)},Qq=(X)=>{let J=v4("a text property",O0);return X===void 0?J:kZ(J,X)},lT0=(X)=>{let J=v4("a non-empty text property",zc((Z)=>Z.length>0,()=>o5([],"Expected a non-empty string")));return X===void 0?J:kZ(J,X)},nT0=(X)=>{if(Array.isArray(X))return RT0(X);else if(Symbol.iterator in X)return RT0([...X]);return iT0(X)},iT0=(X)=>{let J=Object.entries(X),Z=z(J[0][1],P3((Y)=>({[J[0][0]]:Y})));if(J.length===1)return Z;let Q=J.slice(1);for(let[Y,G]of Q)Z=z(Z,tT(G,(K,B)=>({...K,[Y]:B})));return Z},Yq=(X)=>{let J=Object.create(x4);return J._tag=PI,J.value=X,J.parse=()=>O0(X),J},aT=(X)=>{let J=Object.create(x4);return J._tag=CI,J.config=X,J},oT0=(X)=>{return aT(()=>Yq(X()))},rT0=(X,J)=>{let Z=Object.create(x4);return Z._tag=vI,Z.valueConfig=X,J===void 0?Z:kZ(Z,J)},sT=(X)=>V0(X,Bb),RT0=(X)=>{if(X.length===0)return Yq([]);if(X.length===1)return P3(X[0],(Z)=>[Z]);let J=P3(X[0],(Z)=>[Z]);for(let Z=1;Z<X.length;Z++){let Q=X[Z];J=z(J,tT(Q,(Y,G)=>[...Y,G]))}return J},xt=(X)=>{if(sT(X))return X;return iT0(Object.fromEntries(Object.entries(X).map(([J,Z])=>[J,xt(Z)])))},aT0=$(2,(X,{message:J,validation:Z})=>xW(X,(Q)=>{if(Z(Q))return O0(Q);return M0(lZ([],J))})),sT0=$(2,(X,J)=>Wb(X,{orElse:()=>Yq(J),if:sV})),tT0=$(2,(X,J)=>{let Z=Object.create(x4);return Z._tag=jI,Z.config=X,Z.description=J,Z}),eT0=$(2,(X,J)=>tT(X,J,(Z,Q)=>[Z,Q])),tT=$(3,(X,J,Z)=>{let Q=Object.create(x4);return Q._tag=kI,Q.left=X,Q.right=J,Q.zip=Z,Q});var sW8=Bb,tW8=nT0,eW8=ET0,XV8=jT0,JV8=IT0,ZV8=CT0,QV8=Hb,YV8=ST0,GV8=xT0,KV8=vT0,BV8=kT0,HV8=bT0,WV8=yT0,VV8=gT0,vt=sT,$V8=P3,UV8=hT0,kt=xW,zV8=kZ,NV8=mT0,OV8=Wb,_V8=dT0,qV8=v4,DV8=Kb,wV8=uT0,LV8=cT0,FV8=fT0,AV8=pT0,bt=Qq,TV8=lT0,MV8=Yq,PV8=aT,RV8=oT0,jV8=rT0,CV8=xt,IV8=aT0,EV8=sT0,SV8=tT0,xV8=eT0,vV8=tT;var Q9={};y8(Q9,{zonedOffsetIso:()=>V$8,zonedOffset:()=>W$8,zoneUnsafeMakeNamed:()=>Ub,zoneToString:()=>nt,zoneMakeOffset:()=>eT,zoneMakeNamedEffect:()=>ZM0,zoneMakeNamed:()=>lV8,zoneMakeLocal:()=>pt,zoneFromString:()=>lt,withDateUtc:()=>j$8,withDate:()=>R$8,withCurrentZoneOffset:()=>L$8,withCurrentZoneNamed:()=>F$8,withCurrentZoneLocal:()=>w$8,withCurrentZone:()=>D$8,unsafeSetZoneNamed:()=>iV8,unsafeNow:()=>cV8,unsafeMakeZoned:()=>ct,unsafeMake:()=>ut,unsafeIsPast:()=>B$8,unsafeIsFuture:()=>G$8,unsafeFromDate:()=>dt,toUtc:()=>fV8,toPartsUtc:()=>z$8,toParts:()=>U$8,toEpochMillis:()=>ot,toDateUtc:()=>it,toDate:()=>H$8,subtractDuration:()=>E$8,subtract:()=>x$8,startOf:()=>v$8,setZoneOffset:()=>pV8,setZoneNamed:()=>nV8,setZoneCurrent:()=>QM0,setZone:()=>JM0,setPartsUtc:()=>q$8,setParts:()=>_$8,removeTime:()=>$$8,nowInCurrentZone:()=>A$8,nowAsDate:()=>uV8,now:()=>XM0,nearest:()=>b$8,mutateUtc:()=>M$8,mutate:()=>T$8,min:()=>sV8,max:()=>tV8,match:()=>C$8,mapEpochMillis:()=>P$8,makeZonedFromString:()=>ft,makeZoned:()=>mV8,make:()=>dV8,lessThanOrEqualTo:()=>Z$8,lessThan:()=>J$8,layerCurrentZoneOffset:()=>p$8,layerCurrentZoneNamed:()=>l$8,layerCurrentZoneLocal:()=>n$8,layerCurrentZone:()=>f$8,isZoned:()=>mt,isUtc:()=>ht,isTimeZoneOffset:()=>yt,isTimeZoneNamed:()=>gt,isTimeZone:()=>yV8,isPast:()=>K$8,isFuture:()=>Y$8,isDateTime:()=>Vb,greaterThanOrEqualTo:()=>X$8,greaterThan:()=>eV8,getPartUtc:()=>N$8,getPart:()=>O$8,formatUtc:()=>h$8,formatLocal:()=>g$8,formatIsoZoned:()=>at,formatIsoOffset:()=>c$8,formatIsoDateUtc:()=>u$8,formatIsoDate:()=>d$8,formatIso:()=>rt,formatIntl:()=>m$8,format:()=>y$8,endOf:()=>k$8,distanceDurationEither:()=>rV8,distanceDuration:()=>aV8,distance:()=>oV8,clamp:()=>hV8,between:()=>Q$8,addDuration:()=>I$8,add:()=>S$8,TypeId:()=>kV8,TimeZoneTypeId:()=>bV8,Order:()=>gV8,Equivalence:()=>$b,CurrentTimeZone:()=>oG});var kV8=bF,bV8=yF,Vb=XU,yV8=JU,yt=$U0,gt=UU0,ht=zU0,mt=nn,$b=NU0,gV8=$3,hV8=OU0,dt=dO,ut=yS,ct=on,mV8=kS,dV8=_U0,ft=qU0,XM0=gS,uV8=DU0,cV8=hS,fV8=wU0,JM0=gF,pV8=LU0,Ub=hF,eT=e$,lV8=mS,ZM0=rn,pt=TU0,lt=an,nt=MU0,nV8=PU0,iV8=RU0,oV8=dS,rV8=jU0,aV8=CU0,sV8=IU0,tV8=EU0,eV8=uS,X$8=SU0,J$8=cS,Z$8=xU0,Q$8=vU0,Y$8=kU0,G$8=bU0,K$8=yU0,B$8=gU0,it=m1,H$8=tB,W$8=fS,V$8=sn,ot=uO,$$8=hU0,U$8=tn,z$8=lS,N$8=dU0,O$8=uU0,_$8=cU0,q$8=fU0;class oG extends m7("effect/DateTime/CurrentTimeZone")(){}var QM0=(X)=>u(oG,(J)=>JM0(X,J)),D$8=$(2,(X,J)=>PJ(X,oG,J)),w$8=(X)=>z5(X,oG,L0(pt)),L$8=$(2,(X,J)=>PJ(X,oG,eT(J))),F$8=$(2,(X,J)=>z5(X,oG,ZM0(J))),A$8=h(XM0,QM0),T$8=QU,M$8=Zi,P$8=mF,R$8=nS,j$8=Qi,C$8=pU0,I$8=lU0,E$8=nU0,S$8=Yi,x$8=iU0,v$8=rU0,k$8=sU0,b$8=tU0,y$8=eU0,g$8=Xz0,h$8=Jz0,m$8=Zz0,rt=Qz0,d$8=Yz0,u$8=Gz0,c$8=bS,at=Gi,f$8=(X)=>E7(oG,X),p$8=(X)=>E7(oG,e$(X)),l$8=(X)=>GQ(oG,rn(X)),n$8=jU(oG,pt);var st=Symbol.for("effect/Encoding/errors/Decode"),k4=(X,J)=>{let Z={_tag:"DecodeException",[st]:st,input:X};if(n9(J))Z.message=J;return Z};var tt=Symbol.for("effect/Encoding/errors/Encode"),YM0=(X,J)=>{let Z={_tag:"EncodeException",[tt]:tt,input:X};if(n9(J))Z.message=J;return Z};var zb=new TextEncoder,Nb=new TextDecoder;var XM=(X)=>{let J=X.length,Z="",Q;for(Q=2;Q<J;Q+=3)Z+=SH[X[Q-2]>>2],Z+=SH[(X[Q-2]&3)<<4|X[Q-1]>>4],Z+=SH[(X[Q-1]&15)<<2|X[Q]>>6],Z+=SH[X[Q]&63];if(Q===J+1)Z+=SH[X[Q-2]>>2],Z+=SH[(X[Q-2]&3)<<4],Z+="==";if(Q===J)Z+=SH[X[Q-2]>>2],Z+=SH[(X[Q-2]&3)<<4|X[Q-1]>>4],Z+=SH[(X[Q-1]&15)<<2],Z+="=";return Z},_b=(X)=>{let J=et(X),Z=J.length;if(Z%4!==0)return M0(k4(J,`Length must be a multiple of 4, but is ${Z}`));let Q=J.indexOf("=");if(Q!==-1&&(Q<Z-2||Q===Z-2&&J[Z-1]!=="="))return M0(k4(J,"Found a '=' character, but it is not at the end"));try{let Y=J.endsWith("==")?2:J.endsWith("=")?1:0,G=new Uint8Array(3*(Z/4)-Y);for(let K=0,B=0;K<Z;K+=4,B+=3){let H=Ob(J.charCodeAt(K))<<18|Ob(J.charCodeAt(K+1))<<12|Ob(J.charCodeAt(K+2))<<6|Ob(J.charCodeAt(K+3));G[B]=H>>16,G[B+1]=H>>8&255,G[B+2]=H&255}return O0(G)}catch(Y){return M0(k4(J,Y instanceof Error?Y.message:"Invalid input"))}},et=(X)=>X.replace(/[\n\r]/g,"");function Ob(X){if(X>=GM0.length)throw TypeError(`Invalid character ${String.fromCharCode(X)}`);let J=GM0[X];if(J===255)throw TypeError(`Invalid character ${String.fromCharCode(X)}`);return J}var SH=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],GM0=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];var Xe=(X)=>XM(X).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),BM0=(X)=>{let J=et(X),Z=J.length;if(Z%4===1)return M0(k4(J,`Length should be a multiple of 4, but is ${Z}`));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(J))return M0(k4(J,"Invalid input"));let Q=Z%4===2?`${J}==`:Z%4===3?`${J}=`:J;return Q=Q.replace(/-/g,"+").replace(/_/g,"/"),_b(Q)};var Je=(X)=>{let J="";for(let Z=0;Z<X.length;++Z)J+=r$8[X[Z]];return J},WM0=(X)=>{let J=new TextEncoder().encode(X);if(J.length%2!==0)return M0(k4(X,`Length must be a multiple of 2, but is ${J.length}`));try{let Z=J.length/2,Q=new Uint8Array(Z);for(let Y=0;Y<Z;Y++){let G=HM0(J[Y*2]),K=HM0(J[Y*2+1]);Q[Y]=G<<4|K}return O0(Q)}catch(Z){return M0(k4(X,Z instanceof Error?Z.message:"Invalid input"))}},r$8=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],HM0=(X)=>{if(48<=X&&X<=57)return X-48;if(97<=X&&X<=102)return X-97+10;if(65<=X&&X<=70)return X-65+10;throw TypeError("Invalid input")};var Ze=(X)=>typeof X==="string"?XM(zb.encode(X)):XM(X),Qe=(X)=>_b(X),VM0=(X)=>fY(Qe(X),(J)=>Nb.decode(J)),Ye=(X)=>typeof X==="string"?Xe(zb.encode(X)):Xe(X),Ge=(X)=>BM0(X),$M0=(X)=>fY(Ge(X),(J)=>Nb.decode(J)),Ke=(X)=>typeof X==="string"?Je(zb.encode(X)):Je(X),Be=(X)=>WM0(X),UM0=(X)=>fY(Be(X),(J)=>Nb.decode(J)),zM0=(X)=>y2({try:()=>encodeURIComponent(X),catch:(J)=>t$8(X,J instanceof Error?J.message:"Invalid input")}),NM0=(X)=>y2({try:()=>decodeURIComponent(X),catch:(J)=>s$8(X,J instanceof Error?J.message:"Invalid input")});var s$8=k4;var t$8=YM0;class qb{[Symbol.iterator](){return this}next(X){return{value:X,done:!0}}}qb.nil=new qb;function OM0(){return qb.nil}function*_M0(X,J){for(let Z of X)yield J(Z)}function*qM0(X,J){for(let Z of X)yield*J(Z)}function*DM0(X,J){for(let Z of X)if(J(Z))yield Z}function*wM0(X,J){for(let Z=0;Z<J;++Z){let Q=X.next();if(Q.done)break;yield Q.value}}function*LM0(X,J){let Z=X.next();while(!Z.done&&J(Z.value))yield Z.value,Z=X.next()}function*FM0(X,J){for(let Z=X.next();!Z.done;Z=X.next())yield Z.value;for(let Z of J)for(let Q=Z.next();!Q.done;Q=Z.next())yield Q.value}var XU8=Symbol.iterator;class n7{static nil(){return new n7(OM0())}static of(...X){return new n7(X[XU8]())}constructor(X){this.g=X}next(){return this.g.next()}[Symbol.iterator](){return this.g}map(X){return new n7(_M0(this.g,X))}flatMap(X){return new n7(qM0(this.g,X))}dropWhile(X){let J=!1;function*Z(Q){if(J||!X(Q))J=!0,yield Q}return this.flatMap(Z)}drop(X){if(X<=0)return this;let J=0;function Z(){return J++<X}return this.dropWhile(Z)}takeWhile(X){return new n7(LM0(this.g,X))}take(X){return new n7(wM0(this.g,X))}filter(X){return new n7(DM0(this.g,X))}every(X){for(let J of this.g)if(!X(J))return!1;return!0}has(X){for(let J of this.g)if(X(J))return[!0,J];return[!1,null]}join(...X){return new n7(FM0(this.g,X))}getNthOrLast(X){let J=X,Z=null;for(let Q of this.g){if(J--===0)return Q;Z=Q}return Z}}function He(X){return new n7(X)}var xH=Symbol.for("fast-check/cloneMethod");function JM(X){return X!==null&&(typeof X==="object"||typeof X==="function")&&xH in X&&typeof X[xH]==="function"}function ZM(X){return JM(X)?X[xH]():X}var JU8=Object.defineProperty;class x7{constructor(X,J,Z=void 0){if(this.value_=X,this.context=J,this.hasToBeCloned=Z!==void 0||JM(X),this.readOnce=!1,this.hasToBeCloned)JU8(this,"value",{get:Z!==void 0?Z:this.getValue});else this.value=X}getValue(){if(this.hasToBeCloned){if(!this.readOnce)return this.readOnce=!0,this.value_;return this.value_[xH]()}return this.value_}}var AM0=Object.assign;class R3{filter(X){return new PM0(this,X)}map(X,J){return new MM0(this,X,J)}chain(X){return new TM0(this,X)}noShrink(){return new RM0(this)}noBias(){return new jM0(this)}}class TM0 extends R3{constructor(X,J){super();this.arb=X,this.chainer=J}generate(X,J){let Z=X.clone(),Q=this.arb.generate(X,J);return this.valueChainer(Q,X,Z,J)}canShrinkWithoutContext(X){return!1}shrink(X,J){if(this.isSafeContext(J))return(!J.stoppedForOriginal?this.arb.shrink(J.originalValue,J.originalContext).map((Z)=>this.valueChainer(Z,J.clonedMrng.clone(),J.clonedMrng,J.originalBias)):n7.nil()).join(J.chainedArbitrary.shrink(X,J.chainedContext).map((Z)=>{let Q=AM0(AM0({},J),{chainedContext:Z.context,stoppedForOriginal:!0});return new x7(Z.value_,Q)}));return n7.nil()}valueChainer(X,J,Z,Q){let Y=this.chainer(X.value_),G=Y.generate(J,Q),K={originalBias:Q,originalValue:X.value_,originalContext:X.context,stoppedForOriginal:!1,chainedArbitrary:Y,chainedContext:G.context,clonedMrng:Z};return new x7(G.value_,K)}isSafeContext(X){return X!=null&&typeof X==="object"&&"originalBias"in X&&"originalValue"in X&&"originalContext"in X&&"stoppedForOriginal"in X&&"chainedArbitrary"in X&&"chainedContext"in X&&"clonedMrng"in X}}class MM0 extends R3{constructor(X,J,Z){super();this.arb=X,this.mapper=J,this.unmapper=Z,this.bindValueMapper=(Q)=>this.valueMapper(Q)}generate(X,J){let Z=this.arb.generate(X,J);return this.valueMapper(Z)}canShrinkWithoutContext(X){if(this.unmapper!==void 0)try{let J=this.unmapper(X);return this.arb.canShrinkWithoutContext(J)}catch(J){return!1}return!1}shrink(X,J){if(this.isSafeContext(J))return this.arb.shrink(J.originalValue,J.originalContext).map(this.bindValueMapper);if(this.unmapper!==void 0){let Z=this.unmapper(X);return this.arb.shrink(Z,void 0).map(this.bindValueMapper)}return n7.nil()}mapperWithCloneIfNeeded(X){let J=X.value,Z=this.mapper(J);if(X.hasToBeCloned&&(typeof Z==="object"&&Z!==null||typeof Z==="function")&&Object.isExtensible(Z)&&!JM(Z))Object.defineProperty(Z,xH,{get:()=>()=>this.mapperWithCloneIfNeeded(X)[0]});return[Z,J]}valueMapper(X){let[J,Z]=this.mapperWithCloneIfNeeded(X),Q={originalValue:Z,originalContext:X.context};return new x7(J,Q)}isSafeContext(X){return X!=null&&typeof X==="object"&&"originalValue"in X&&"originalContext"in X}}class PM0 extends R3{constructor(X,J){super();this.arb=X,this.refinement=J,this.bindRefinementOnValue=(Z)=>this.refinementOnValue(Z)}generate(X,J){while(!0){let Z=this.arb.generate(X,J);if(this.refinementOnValue(Z))return Z}}canShrinkWithoutContext(X){return this.arb.canShrinkWithoutContext(X)&&this.refinement(X)}shrink(X,J){return this.arb.shrink(X,J).filter(this.bindRefinementOnValue)}refinementOnValue(X){return this.refinement(X.value)}}class RM0 extends R3{constructor(X){super();this.arb=X}generate(X,J){return this.arb.generate(X,J)}canShrinkWithoutContext(X){return this.arb.canShrinkWithoutContext(X)}shrink(X,J){return n7.nil()}noShrink(){return this}}class jM0 extends R3{constructor(X){super();this.arb=X}generate(X,J){return this.arb.generate(X,void 0)}canShrinkWithoutContext(X){return this.arb.canShrinkWithoutContext(X)}shrink(X,J){return this.arb.shrink(X,J)}noBias(){return this}}var CM0=Function.prototype.apply,We=Symbol("apply");function ZU8(X){try{return X.apply}catch(J){return}}function QU8(X,J,Z){let Q=X;Q[We]=CM0;let Y=Q[We](J,Z);return delete Q[We],Y}function lU(X,J,Z){if(ZU8(X)===CM0)return X.apply(J,Z);return QU8(X,J,Z)}var R79=Array.prototype.forEach,IM0=Array.prototype.indexOf,j79=Array.prototype.join,EM0=Array.prototype.map,C79=Array.prototype.filter,SM0=Array.prototype.push,I79=Array.prototype.pop,E79=Array.prototype.splice,xM0=Array.prototype.slice,S79=Array.prototype.sort,x79=Array.prototype.every;function YU8(X){try{return X.indexOf}catch(J){return}}function GU8(X){try{return X.map}catch(J){return}}function KU8(X){try{return X.push}catch(J){return}}function BU8(X){try{return X.slice}catch(J){return}}function Ve(X,...J){if(YU8(X)===IM0)return X.indexOf(...J);return lU(IM0,X,J)}function QM(X,J){if(GU8(X)===EM0)return X.map(J);return lU(EM0,X,[J])}function vW(X,...J){if(KU8(X)===SM0)return X.push(...J);return lU(SM0,X,J)}function Gq(X,...J){if(BU8(X)===xM0)return X.slice(...J);return lU(xM0,X,J)}var v79=Date.prototype.getTime,k79=Date.prototype.toISOString;var b79=Set.prototype.add,y79=Set.prototype.has;var g79=WeakMap.prototype.set,h79=WeakMap.prototype.get;var vM0=Map.prototype.set,kM0=Map.prototype.get;function HU8(X){try{return X.set}catch(J){return}}function WU8(X){try{return X.get}catch(J){return}}function bM0(X,J,Z){if(HU8(X)===vM0)return X.set(J,Z);return lU(vM0,X,[J,Z])}function yM0(X,J){if(WU8(X)===kM0)return X.get(J);return lU(kM0,X,[J])}var m79=String.prototype.split,d79=String.prototype.startsWith,u79=String.prototype.endsWith,c79=String.prototype.substring,f79=String.prototype.toLowerCase,p79=String.prototype.toUpperCase,l79=String.prototype.padStart,n79=String.prototype.charCodeAt,i79=String.prototype.normalize,o79=String.prototype.replace;var r79=Number.prototype.toString;class gM0{constructor(X){this.producer=X}[Symbol.iterator](){if(this.it===void 0)this.it=this.producer();return this.it}next(){if(this.it===void 0)this.it=this.producer();return this.it.next()}}function Db(X){return new gM0(X)}var VU8={};function hM0(){return VU8}var{floor:$U8,log:mM0}=Math;function dM0(X){return $U8(mM0(X)/mM0(2))}function uM0(X,J,Z){if(X===J)return[{min:X,max:J}];if(X<0&&J>0){let K=Z(-X),B=Z(J);return[{min:-K,max:B},{min:J-B,max:J},{min:X,max:X+K}]}let Q=Z(J-X),Y={min:X,max:X+Q},G={min:J-Q,max:J};return X<0?[G,Y]:[Y,G]}var{ceil:UU8,floor:zU8}=Math;function cM0(X){return zU8(X/2)}function fM0(X){return UU8(X/2)}function $e(X,J,Z){let Q=X-J;function*Y(){let K=Z?void 0:J,B=Z?Q:cM0(Q);for(let H=B;H>0;H=cM0(H)){let W=H===Q?J:X-H;yield new x7(W,K),K=W}}function*G(){let K=Z?void 0:J,B=Z?Q:fM0(Q);for(let H=B;H<0;H=fM0(H)){let W=H===Q?J:X-H;yield new x7(W,K),K=W}}return Q>0?He(Y()):He(G())}var pM0=Math.sign,NU8=Number.isInteger,OU8=Object.is;class wb extends R3{constructor(X,J){super();this.min=X,this.max=J}generate(X,J){let Z=this.computeGenerateRange(X,J);return new x7(X.nextInt(Z.min,Z.max),void 0)}canShrinkWithoutContext(X){return typeof X==="number"&&NU8(X)&&!OU8(X,-0)&&this.min<=X&&X<=this.max}shrink(X,J){if(!wb.isValidContext(X,J)){let Z=this.defaultTarget();return $e(X,Z,!0)}if(this.isLastChanceTry(X,J))return n7.of(new x7(J,void 0));return $e(X,J,!1)}defaultTarget(){if(this.min<=0&&this.max>=0)return 0;return this.min<0?this.max:this.min}computeGenerateRange(X,J){if(J===void 0||X.nextInt(1,J)!==1)return{min:this.min,max:this.max};let Z=uM0(this.min,this.max,dM0);if(Z.length===1)return Z[0];let Q=X.nextInt(-2*(Z.length-1),Z.length-2);return Q<0?Z[0]:Z[Q+1]}isLastChanceTry(X,J){if(X>0)return X===J+1&&X>this.min;if(X<0)return X===J-1&&X<this.max;return!1}static isValidContext(X,J){if(J===void 0)return!1;if(typeof J!=="number")throw Error("Invalid context type passed to IntegerArbitrary (#1)");if(J!==0&&pM0(X)!==pM0(J))throw Error("Invalid context value passed to IntegerArbitrary (#2)");return!0}}var lM0=Number.isInteger;function _U8(X){let J=X.min!==void 0?X.min:-2147483648,Z=X.max!==void 0?X.max:2147483647;return{min:J,max:Z}}function Ue(X={}){let J=_U8(X);if(J.min>J.max)throw Error("fc.integer maximum value should be equal or greater than the minimum one");if(!lM0(J.min))throw Error("fc.integer minimum value should be an integer");if(!lM0(J.max))throw Error("fc.integer maximum value should be an integer");return new wb(J.min,J.max)}var nM0=new Map;function iM0(X){if(X===void 0)return{depth:0};if(typeof X!=="string")return X;let J=yM0(nM0,X);if(J!==void 0)return J;let Z={depth:0};return bM0(nM0,X,Z),Z}class ze{constructor(X,J,Z){this.arb=X,this.mrng=J,this.biasFactor=Z}attemptExact(){return}next(){return this.arb.generate(this.mrng,this.biasFactor)}}var{min:qU8,max:DU8}=Math;class Ne{constructor(X,J,Z,Q){this.arb=X,this.mrng=J,this.slices=Z,this.biasFactor=Q,this.activeSliceIndex=0,this.nextIndexInSlice=0,this.lastIndexInSlice=-1}attemptExact(X){if(X!==0&&this.mrng.nextInt(1,this.biasFactor)===1){let J=[];for(let Z=0;Z!==this.slices.length;++Z)if(this.slices[Z].length===X)vW(J,Z);if(J.length===0)return;this.activeSliceIndex=J[this.mrng.nextInt(0,J.length-1)],this.nextIndexInSlice=0,this.lastIndexInSlice=X-1}}next(){if(this.nextIndexInSlice<=this.lastIndexInSlice)return new x7(this.slices[this.activeSliceIndex][this.nextIndexInSlice++],void 0);if(this.mrng.nextInt(1,this.biasFactor)!==1)return this.arb.generate(this.mrng,this.biasFactor);this.activeSliceIndex=this.mrng.nextInt(0,this.slices.length-1);let X=this.slices[this.activeSliceIndex];if(this.mrng.nextInt(1,this.biasFactor)!==1)return this.nextIndexInSlice=1,this.lastIndexInSlice=X.length-1,new x7(X[0],void 0);let J=this.mrng.nextInt(0,X.length-1),Z=this.mrng.nextInt(0,X.length-1);return this.nextIndexInSlice=qU8(J,Z),this.lastIndexInSlice=DU8(J,Z),new x7(X[this.nextIndexInSlice++],void 0)}}function Oe(X,J,Z,Q){if(Q===void 0||Z.length===0||J.nextInt(1,Q)!==1)return new ze(X,J,Q);return new Ne(X,J,Z,Q)}var{floor:wU8,log:oM0,max:rM0}=Math,LU8=Array.isArray;function _e(X,J){if(X===J)return X;return X+wU8(oM0(J-X)/oM0(2))}class Lb extends R3{constructor(X,J,Z,Q,Y,G,K){super();this.arb=X,this.minLength=J,this.maxGeneratedLength=Z,this.maxLength=Q,this.setBuilder=G,this.customSlices=K,this.lengthArb=Ue({min:J,max:Z}),this.depthContext=iM0(Y)}preFilter(X){if(this.setBuilder===void 0)return X;let J=this.setBuilder();for(let Z=0;Z!==X.length;++Z)J.tryAdd(X[Z]);return J.getData()}static makeItCloneable(X,J){return X[xH]=()=>{let Z=[];for(let Q=0;Q!==J.length;++Q)vW(Z,J[Q].value);return this.makeItCloneable(Z,J),Z},X}generateNItemsNoDuplicates(X,J,Z,Q){let Y=0,G=X(),K=Oe(this.arb,Z,this.customSlices,Q);while(G.size()<J&&Y<this.maxGeneratedLength){let B=K.next();if(G.tryAdd(B))Y=0;else Y+=1}return G.getData()}safeGenerateNItemsNoDuplicates(X,J,Z,Q){let Y=rM0(0,J-_e(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=Y;try{return this.generateNItemsNoDuplicates(X,J,Z,Q)}finally{this.depthContext.depth-=Y}}generateNItems(X,J,Z){let Q=[],Y=Oe(this.arb,J,this.customSlices,Z);Y.attemptExact(X);for(let G=0;G!==X;++G){let K=Y.next();vW(Q,K)}return Q}safeGenerateNItems(X,J,Z){let Q=rM0(0,X-_e(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=Q;try{return this.generateNItems(X,J,Z)}finally{this.depthContext.depth-=Q}}wrapper(X,J,Z,Q){let Y=J?this.preFilter(X):X,G=!1,K=[],B=[];for(let W=0;W!==Y.length;++W){let V=Y[W];G=G||V.hasToBeCloned,vW(K,V.value),vW(B,V.context)}if(G)Lb.makeItCloneable(K,Y);let H={shrunkOnce:J,lengthContext:X.length===Y.length&&Z!==void 0?Z:void 0,itemsContexts:B,startIndex:Q};return new x7(K,H)}generate(X,J){let Z=this.applyBias(X,J),Q=Z.size,Y=this.setBuilder!==void 0?this.safeGenerateNItemsNoDuplicates(this.setBuilder,Q,X,Z.biasFactorItems):this.safeGenerateNItems(Q,X,Z.biasFactorItems);return this.wrapper(Y,!1,void 0,0)}applyBias(X,J){if(J===void 0)return{size:this.lengthArb.generate(X,void 0).value};if(this.minLength===this.maxGeneratedLength)return{size:this.lengthArb.generate(X,void 0).value,biasFactorItems:J};if(X.nextInt(1,J)!==1)return{size:this.lengthArb.generate(X,void 0).value};if(X.nextInt(1,J)!==1||this.minLength===this.maxGeneratedLength)return{size:this.lengthArb.generate(X,void 0).value,biasFactorItems:J};let Z=_e(this.minLength,this.maxGeneratedLength);return{size:Ue({min:this.minLength,max:Z}).generate(X,void 0).value,biasFactorItems:J}}canShrinkWithoutContext(X){if(!LU8(X)||this.minLength>X.length||X.length>this.maxLength)return!1;for(let Z=0;Z!==X.length;++Z){if(!(Z in X))return!1;if(!this.arb.canShrinkWithoutContext(X[Z]))return!1}return this.preFilter(QM(X,(Z)=>new x7(Z,void 0))).length===X.length}shrinkItemByItem(X,J,Z){let Q=[];for(let Y=J.startIndex;Y<Z;++Y)vW(Q,Db(()=>this.arb.shrink(X[Y],J.itemsContexts[Y]).map((G)=>{let K=QM(Gq(X,0,Y),(H,W)=>new x7(ZM(H),J.itemsContexts[W])),B=QM(Gq(X,Y+1),(H,W)=>new x7(ZM(H),J.itemsContexts[W+Y+1]));return[[...K,G,...B],void 0,Y]})));return n7.nil().join(...Q)}shrinkImpl(X,J){if(X.length===0)return n7.nil();let Z=J!==void 0?J:{shrunkOnce:!1,lengthContext:void 0,itemsContexts:[],startIndex:0};return this.lengthArb.shrink(X.length,Z.lengthContext).drop(Z.shrunkOnce&&Z.lengthContext===void 0&&X.length>this.minLength+1?1:0).map((Q)=>{let Y=X.length-Q.value;return[QM(Gq(X,Y),(G,K)=>new x7(ZM(G),Z.itemsContexts[K+Y])),Q.context,0]}).join(Db(()=>X.length>this.minLength?this.shrinkItemByItem(X,Z,1):this.shrinkItemByItem(X,Z,X.length))).join(X.length>this.minLength?Db(()=>{let Q={shrunkOnce:!1,lengthContext:void 0,itemsContexts:Gq(Z.itemsContexts,1),startIndex:0};return this.shrinkImpl(Gq(X,1),Q).filter((Y)=>this.minLength<=Y[0].length+1).map((Y)=>{return[[new x7(ZM(X[0]),Z.itemsContexts[0]),...Y[0]],void 0,0]})}):n7.nil())}shrink(X,J){return this.shrinkImpl(X,J).map((Z)=>this.wrapper(Z[0],!0,Z[1],Z[2]))}}var{floor:FU8,min:AU8}=Math,aM0=2147483647,Kq=["xsmall","small","medium","large","xlarge"],TU8=["-4","-3","-2","-1","=","+1","+2","+3","+4"],MU8="small";function PU8(X,J){switch(J){case"xsmall":return FU8(1.1*X)+1;case"small":return 2*X+10;case"medium":return 11*X+100;case"large":return 101*X+1000;case"xlarge":return 1001*X+1e4;default:throw Error(`Unable to compute lengths based on received size: ${J}`)}}function RU8(X,J){let Z=Ve(TU8,X);if(Z===-1)return X;let Q=Ve(Kq,J);if(Q===-1)throw Error(`Unable to offset size based on the unknown defaulted one: ${J}`);let Y=Q+Z-4;return Y<0?Kq[0]:Y>=Kq.length?Kq[Kq.length-1]:Kq[Y]}function sM0(X,J,Z,Q){let{baseSize:Y=MU8,defaultSizeToMaxWhenMaxSpecified:G}=hM0()||{},K=X!==void 0?X:Q&&G?"max":Y;if(K==="max")return Z;let B=RU8(K,Y);return AU8(PU8(J,B),Z)}function qe(X,J={}){let Z=J.size,Q=J.minLength||0,Y=J.maxLength,G=J.depthIdentifier,K=Y!==void 0?Y:aM0,H=sM0(Z,Q,K,Y!==void 0),W=J.experimentalCustomSlices||[];return new Lb(X,Q,H,K,G,void 0,W)}var tM0=Symbol.for("effect/SchemaId/DateFromSelf"),eM0=Symbol.for("effect/SchemaId/GreaterThan"),XP0=Symbol.for("effect/SchemaId/GreaterThanOrEqualTo"),JP0=Symbol.for("effect/SchemaId/LessThan"),ZP0=Symbol.for("effect/SchemaId/LessThanOrEqualTo"),Fb=Symbol.for("effect/SchemaId/Int"),QP0=Symbol.for("effect/SchemaId/NonNaN"),YP0=Symbol.for("effect/SchemaId/Finite"),GP0=Symbol.for("effect/SchemaId/JsonNumber"),KP0=Symbol.for("effect/SchemaId/Between"),BP0=Symbol.for("effect/SchemaId/GreaterThanBigint"),HP0=Symbol.for("effect/SchemaId/GreaterThanOrEqualToBigint"),WP0=Symbol.for("effect/SchemaId/LessThanBigint"),VP0=Symbol.for("effect/SchemaId/LessThanOrEqualToBigint"),$P0=Symbol.for("effect/SchemaId/BetweenBigint"),UP0=Symbol.for("effect/SchemaId/MinLength"),zP0=Symbol.for("effect/SchemaId/MaxLength"),NP0=Symbol.for("effect/SchemaId/Length"),OP0=Symbol.for("effect/SchemaId/MinItems"),_P0=Symbol.for("effect/SchemaId/MaxItems"),qP0=Symbol.for("effect/SchemaId/ItemsCount");var $7={};y8($7,{value:()=>kW,unsafeWipe:()=>CU8,make:()=>L5,isRedacted:()=>De,getEquivalence:()=>we,RedactedTypeId:()=>jU8});var jU8=Qb,De=It,L5=Yb,kW=AT0,CU8=TT0,we=(X)=>I6((J,Z)=>X(kW(J),kW(Z)));var wP0=$((X)=>c6(X[0]),(X,...J)=>{let Z={};for(let Q of J)if(Q in X)Z[Q]=X[Q];return Z}),LP0=$((X)=>c6(X[0]),(X,...J)=>{let Z={...X};for(let Q of J)delete Z[Q];return Z});var gW=Symbol.for("effect/Schema");function t8(X){return class{[gW]=Le;static ast=X;static annotations(Z){return t8(MY(this.ast,Z))}static pipe(){return K0(this,arguments)}static toString(){return String(X)}static Type;static Encoded;static Context;static[gW]=Le}}var Le={_A:(X)=>X,_I:(X)=>X,_R:(X)=>X},FP0=(X)=>CQ(X)?X.value:EU8(CO(X.cause)),EU8=(X)=>({issues:[{message:X}]}),SU8=(X)=>u(PA.formatIssue(X),(J)=>({issues:J.map((Z)=>({path:Z.path,message:Z.message}))})),xU8=(X,J)=>{let Z=W7(X,{errors:"all"});return class extends t8(X.ast){static "~standard"={version:1,vendor:"effect",validate(Y){let G=new m$,K=NY(q9(Z(Y,J),{onFailure:SU8,onSuccess:(H)=>y({value:H})}),{scheduler:G});G.flush();let B=K.unsafePoll();if(B)return FP0(B);return new Promise((H)=>{K.addObserver((W)=>{H(FP0(W))})})}}}},AP0={typeConstructor:EN0,schemaId:wU,message:Ko,missingMessage:Ax,identifier:$A,title:IZ,description:_Y,examples:Tx,default:Mx,documentation:SN0,jsonSchema:Px,arbitrary:Bo,pretty:Ho,equivalence:Rx,concurrency:Wo,batching:Vo,parseIssueTitle:$o,parseOptions:Uo,decodingFallback:zo},bH=(X)=>{if(!X)return{};let J={...X};for(let Z in AP0)if(Z in X){let Q=AP0[Z];J[Q]=X[Z],delete J[Z]}return J},MY=(X,J)=>FA(X,bH(J));function qX(X){return X}var dX=(X)=>String(X.ast),Sb=(X)=>t8(AA(X.ast)),Q00=(X)=>t8(DO0(X.ast)),l8=(X)=>t8(PX(X.ast)),A5=(X,J)=>{let Z=I7(X,J);return(Q,Y)=>PU(Z(Q,Y),WH)},fP0=(X,J)=>{let Z=PO0(X,J);return(Q,Y)=>eQ(Z(Q,Y),WH)},pP0=(X,J)=>{let Z=A5(X,J);return(Q,Y)=>YH(Z(Q,Y))},E3=A5,vU8=fP0,kU8=pP0,t9=(X,J)=>{let Z=W7(X,J);return(Q,Y)=>PU(Z(Q,Y),WH)},lP0=(X,J)=>{let Z=uo(X,J);return(Q,Y)=>eQ(Z(Q,Y),WH)},nP0=(X,J)=>{let Z=t9(X,J);return(Q,Y)=>YH(Z(Q,Y))},Y00=t9,bU8=lP0,yU8=nP0,xb=(X,J)=>{let Z=IO0(X,J);return(Q,Y)=>PU(Z(Q,Y),WH)},gU8=(X,J)=>{let Z=CO0(X,J);return(Q,Y)=>eQ(Z(Q,Y),WH)},hU8=(X,J)=>{let Z=xb(X,J);return(Q,Y)=>YH(Z(Q,Y))},eX=(X)=>V0(X,gW)&&c6(X[gW]);function mU8(X){return xx(X)?W6.make(WO0(X,(J)=>new _3(J))):new _3(X[0])}function iP0(X,J=mU8(X)){return class extends t8(J){static annotations(Q){return iP0(this.literals,MY(this.ast,Q))}static literals=[...X]}}function s0(...X){return B8(X)?iP0(X):b4}var dU8=(...X)=>(J)=>s0(...X),oP0=(X)=>t8(new G_(X)),uU8=(X)=>new To(Object.keys(X).filter((J)=>typeof X[X[J]]!=="number").map((J)=>[J,X[J]])),rP0=(X,J=uU8(X))=>class extends t8(J){static annotations(Q){return rP0(this.enums,MY(this.ast,Q))}static enums={...X}},cU8=(X)=>rP0(X),aP0=(...[X,...J])=>{let Z=[],Q="",Y=J;if(eX(X))if(q3(X.ast))Q=String(X.ast.literal);else Y=[X,...Y];else Q=String(X);for(let G=0;G<Y.length;G++){let K=Y[G];if(eX(K)){if(G<Y.length-1){let B=Y[G+1];if(eX(B)){if(q3(B.ast)){Z.push(new AU(K.ast,String(B.ast.literal))),G++;continue}}else{Z.push(new AU(K.ast,String(B))),G++;continue}}Z.push(new AU(K.ast,""))}else Z.push(new AU(new _3(K),""))}if(i5(Z))return t8(new Ex(Q,Z));else return t8(new Ex("",[new AU(new _3(Q),"")]))};function sP0(X,J){let Z=X.ast;switch(Z._tag){case"Literal":{let Q=Z.literal;if(!n9(Q)){let Y=String(Q);return k8(s0(Y),J,{strict:!0,decode:()=>Q,encode:()=>Y})}break}case"NumberKeyword":return oU(hH,J);case"Union":{let Q=[],Y=!1;for(let G of Z.types){let K=t8(G),B=Sb(K),H=sP0(B,K);if(H)Y=!0;Q.push(H??K)}return Y?oU(U8(...Q),J):J}}}var fU8=(...X)=>{let J=[],Z=[],Q=[],Y=!1;for(let H=0;H<X.length;H++){let W=X[H],V=eX(W)?W:s0(W);Q.push(V);let U=Sb(V);J.push(U);let O=sP0(U,V);if(O)Z.push(O),Y=!0;else Z.push(V)}let G=aP0(...J),K=NO0(G.ast),B=bZ(...Z);if(Y)B=B.annotations({[o1]:dX(bZ(...Q))});return class extends d6(G,B,{strict:!1,decode:(W,V,U)=>{let O=K.exec(W);return O?YX(O.slice(1,X.length+1)):h6(new a8(U,W,`${K.source}: no match for ${JSON.stringify(W)}`))},encode:(W)=>YX(W.join(""))}){static params=X.slice()}},pU8=(X,J,Z)=>G00(X,new Y_(X.map((Q)=>Q.ast),(...Q)=>J.decode(...Q.map(t8)),(...Q)=>J.encode(...Q.map(t8)),bH(Z))),lU8=(X,J)=>{let Z=()=>(Y,G,K)=>X(Y)?YX(Y):h6(new a8(K,Y));return G00([],new Y_([],Z,Z,bH(J)))};function G00(X,J){return class extends t8(J){static annotations(Q){return G00(this.typeParameters,MY(this.ast,Q))}static typeParameters=[...X]}}var X6=function(){if(Array.isArray(arguments[0])){let Z=arguments[0],Q=arguments[1],Y=arguments[2];return pU8(Z,Q,Y)}let X=arguments[0],J=arguments[1];return lU8(X,J)},Fe=Symbol.for("effect/SchemaId/Brand"),nU8=(X,J)=>(Z)=>{return H00(Z,new s1(Z.ast,function(G,K,B){let H=X.either(G);return U9(H)?I(new a8(B,G,H.left.map((W)=>W.message).join(", "))):S()},bH({schemaId:Fe,[Fe]:{constructor:X},...J})))},Ae=Symbol.for("effect/SchemaId/InstanceOf"),tP0=(X,J)=>X6((Z)=>Z instanceof X,{title:X.name,description:`an instance of ${X.name}`,pretty:()=>String,schemaId:Ae,[Ae]:{constructor:X},...J});class vb extends t8(LU){}class yH extends t8(lN0){}class gH extends t8(cN0){}class b4 extends t8(FU){}class A6 extends t8(wo){}class kb extends t8(Lo){}class dW extends t8(eN0){}class bb extends t8(JO0){}class d extends t8(K_){}class L8 extends t8(B_){}class q8 extends t8(H_){}class eP0 extends t8(QO0){}var iU8=(X)=>W6.make(X.map((J)=>J.ast));function XR0(X,J=iU8(X)){return class extends t8(J){static annotations(Q){return XR0(this.members,MY(this.ast,Q))}static members=[...X]}}function U8(...X){return xx(X)?XR0(X):B8(X)?X[0]:b4}var KM=(X)=>U8(X,gH),SJ=(X)=>U8(X,vb),BM=(X)=>U8(X,gH,vb),oU8=(X)=>t8(UO0(X.ast)),Te=(X)=>new yb(new qY(X.ast,!1),X),rU8=(X)=>new yb(new qY(X.ast,!0),X);class yb{ast;from;[gW];_Token;constructor(X,J){this.ast=X,this.from=J}annotations(X){return new yb(new qY(this.ast.type,this.ast.isOptional,{...this.ast.annotations,...bH(X)}),this.from)}toString(){return`${this.ast.type}${this.ast.isOptional?"?":""}`}}var aU8=(X,J)=>new r1(X.map((Z)=>eX(Z)?new qY(Z.ast,!1):Z.ast),J.map((Z)=>eX(Z)?new TU(Z.ast):Z.ast),!0);function HM(X,J,Z=aU8(X,J)){return class extends t8(Z){static annotations(Y){return HM(this.elements,this.rest,MY(this.ast,Y))}static elements=[...X];static rest=[...J]}}function bZ(...X){return Array.isArray(X[0])?HM(X[0],X.slice(1)):HM(X,[])}function JR0(X,J){return class extends HM([],[X],J){static annotations(Q){return JR0(this.value,MY(this.ast,Q))}static value=X}}var K8=(X)=>JR0(X);function ZR0(X,J){return class extends HM([X],[X],J){static annotations(Q){return ZR0(this.value,MY(this.ast,Q))}static value=X}}var j3=(X)=>ZR0(X);function sU8(X){return k8(U8(X,K8(X)),K8(l8(qX(X))),{strict:!0,decode:(J)=>m2(J),encode:(J)=>J.length===1?J[0]:J})}function tU8(X){return k8(U8(X,j3(X)),j3(l8(qX(X))),{strict:!0,decode:(J)=>B8(J)?J:X8(J),encode:(J)=>J.length===1?J[0]:J})}var Me=(X)=>X?'"?:"':'":"';class hW extends qY{isReadonly;defaultValue;_tag="PropertySignatureDeclaration";constructor(X,J,Z,Q,Y){super(X,J,Q);this.isReadonly=Z,this.defaultValue=Y}toString(){let X=Me(this.isOptional),J=String(this.type);return`PropertySignature<${X}, ${J}, never, ${X}, ${J}>`}}class mW extends qY{isReadonly;fromKey;constructor(X,J,Z,Q,Y){super(X,J,Q);this.isReadonly=Z,this.fromKey=Y}}class C3 extends qY{isReadonly;defaultValue;constructor(X,J,Z,Q,Y){super(X,J,Q);this.isReadonly=Z,this.defaultValue=Y}}var eU8=(X)=>{if(X===void 0)return"never";if(n9(X))return JSON.stringify(X);return String(X)};class aG{from;to;decode;encode;_tag="PropertySignatureTransformation";constructor(X,J,Z,Q){this.from=X,this.to=J,this.decode=Z,this.encode=Q}toString(){return`PropertySignature<${Me(this.to.isOptional)}, ${this.to.type}, ${eU8(this.from.fromKey)}, ${Me(this.from.isOptional)}, ${this.from.type}>`}}var QR0=(X,J)=>{switch(X._tag){case"PropertySignatureDeclaration":return new hW(X.type,X.isOptional,X.isReadonly,{...X.annotations,...J},X.defaultValue);case"PropertySignatureTransformation":return new aG(X.from,new C3(X.to.type,X.to.isOptional,X.to.isReadonly,{...X.to.annotations,...J},X.to.defaultValue),X.decode,X.encode)}},K00=Symbol.for("effect/PropertySignature"),gb=(X)=>V0(X,K00);class hb{ast;[gW];[K00]=null;_TypeToken;_Key;_EncodedToken;_HasDefault;constructor(X){this.ast=X}pipe(){return K0(this,arguments)}annotations(X){return new hb(QR0(this.ast,bH(X)))}toString(){return String(this.ast)}}var I3=(X)=>new hb(X);class UM extends hb{from;constructor(X,J){super(X);this.from=J}annotations(X){return new UM(QR0(this.ast,bH(X)),this.from)}}var Hq=(X)=>new UM(new hW(X.ast,!1,!0,{},void 0),X),bW=$(2,(X,J)=>{let Z=X.ast;switch(Z._tag){case"PropertySignatureDeclaration":return I3(new hW(Z.type,Z.isOptional,Z.isReadonly,Z.annotations,J));case"PropertySignatureTransformation":return I3(new aG(Z.from,new C3(Z.to.type,Z.to.isOptional,Z.to.isReadonly,Z.to.annotations,J),Z.decode,Z.encode))}}),TP0=(X,J)=>w0(X,{onNone:()=>I(J()),onSome:(Z)=>I(Z===void 0?J():Z)}),Ab=(X)=>gx(X,Ab,(J)=>{let Z=Ab(J.to);if(Z)return new CZ(J.from,Z,J.transformation)}),YR0=$(2,(X,J)=>{let Z=X.ast;switch(Z._tag){case"PropertySignatureDeclaration":{let Q=PX(Z.type);return I3(new aG(new mW(Z.type,Z.isOptional,Z.isReadonly,Z.annotations),new C3(Ab(Q)??Q,!1,!0,{},Z.defaultValue),(Y)=>TP0(Y,J),t))}case"PropertySignatureTransformation":{let Q=Z.to.type;return I3(new aG(Z.from,new C3(Ab(Q)??Q,!1,Z.to.isReadonly,Z.to.annotations,Z.to.defaultValue),(Y)=>TP0(Z.decode(Y),J),Z.encode))}}}),Xz8=$(2,(X,J)=>X.pipe(YR0(J.decoding),bW(J.constructor))),Jz8=$(2,(X,J)=>{let Z=X.ast;switch(Z._tag){case"PropertySignatureDeclaration":return I3(new aG(new mW(Z.type,Z.isOptional,Z.isReadonly,Z.annotations,J),new C3(PX(Z.type),Z.isOptional,Z.isReadonly,{},Z.defaultValue),t,t));case"PropertySignatureTransformation":return I3(new aG(new mW(Z.from.type,Z.from.isOptional,Z.from.isReadonly,Z.from.annotations,J),Z.to,Z.decode,Z.encode))}}),vH=(X,J,Z)=>I3(new aG(new mW(X.ast,!0,!0,{},void 0),new C3(J.ast,!1,!0,{},void 0),(Q)=>I(Z.decode(Q)),pX(Z.encode))),Zz8=(X,J,Z)=>I3(new aG(new mW(X.ast,!1,!0,{},void 0),new C3(J.ast,!0,!0,{},void 0),pX(Z.decode),(Q)=>I(Z.encode(Q)))),Pe=(X,J,Z)=>I3(new aG(new mW(X.ast,!0,!0,{},void 0),new C3(J.ast,!0,!0,{},void 0),Z.decode,Z.encode)),Qz8=(X,J)=>{let Z=J?.exact,Q=J?.default,Y=J?.nullable,G=J?.as=="Option",K=J?.onNoneEncoding?JJ(J.onNoneEncoding):t;if(Z)if(Q)if(Y)return bW(vH(KM(X),l8(X),{decode:w0({onNone:Q,onSome:(B)=>B===null?Q():B}),encode:I}),Q).ast;else return bW(vH(X,l8(X),{decode:w0({onNone:Q,onSome:t}),encode:I}),Q).ast;else if(G){let B=ie(l8(X));if(Y)return vH(KM(X),B,{decode:gJ(Yj),encode:K}).ast;else return vH(X,B,{decode:t,encode:t}).ast}else if(Y)return Pe(KM(X),l8(X),{decode:gJ(Yj),encode:t}).ast;else return new hW(X.ast,!0,!0,{},void 0);else if(Q)if(Y)return bW(vH(BM(X),l8(X),{decode:w0({onNone:Q,onSome:(B)=>B==null?Q():B}),encode:I}),Q).ast;else return bW(vH(SJ(X),l8(X),{decode:w0({onNone:Q,onSome:(B)=>B===void 0?Q():B}),encode:I}),Q).ast;else if(G){let B=ie(l8(X));if(Y)return vH(BM(X),B,{decode:gJ((H)=>H!=null),encode:K}).ast;else return vH(SJ(X),B,{decode:gJ(Qj),encode:K}).ast}else if(Y)return Pe(BM(X),SJ(l8(X)),{decode:gJ(Yj),encode:t}).ast;else return new hW(SJ(X).ast,!0,!0,{},void 0)},u0=(X)=>{let J=X.ast===LU||X.ast===FU?LU:SJ(X).ast;return new UM(new hW(J,!0,!0,{},void 0),X)},X0=$((X)=>eX(X[0]),(X,J)=>{return new UM(Qz8(X,J),X)}),Yz8=jo([Ax]),Gz8=(X,J)=>{let Z=Reflect.ownKeys(X),Q=[];if(Z.length>0){let G=[],K=[],B=[];for(let H=0;H<Z.length;H++){let W=Z[H],V=X[W];if(gb(V)){let U=V.ast;switch(U._tag){case"PropertySignatureDeclaration":{let{type:O,isOptional:q,annotations:L}=U;G.push(new aX(W,O,q,!0,Yz8(U))),K.push(new aX(W,PX(O),q,!0,L)),Q.push(new aX(W,O,q,!0,L));break}case"PropertySignatureTransformation":{let O=U.from.fromKey??W;G.push(new aX(O,U.from.type,U.from.isOptional,!0,U.from.annotations)),K.push(new aX(W,U.to.type,U.to.isOptional,!0,U.to.annotations)),B.push(new wA(O,W,U.decode,U.encode));break}}}else G.push(new aX(W,V.ast,!1,!0)),K.push(new aX(W,PX(V.ast),!1,!0)),Q.push(new aX(W,V.ast,!1,!0))}if(B8(B)){let H=[],W=[];for(let V of J){let{indexSignatures:U,propertySignatures:O}=Ro(V.key.ast,V.value.ast);O.forEach((q)=>{G.push(q),K.push(new aX(q.name,PX(q.type),q.isOptional,q.isReadonly,q.annotations))}),U.forEach((q)=>{H.push(q),W.push(new a1(q.parameter,PX(q.type),q.isReadonly))})}return new CZ(new eJ(G,H,{[o1]:"Struct (Encoded side)"}),new eJ(K,W,{[o1]:"Struct (Type side)"}),new t1(B))}}let Y=[];for(let G of J){let{indexSignatures:K,propertySignatures:B}=Ro(G.key.ast,G.value.ast);B.forEach((H)=>Q.push(H)),K.forEach((H)=>Y.push(H))}return new eJ(Q,Y)},GR0=(X,J)=>{let Z=Reflect.ownKeys(X);for(let Q of Z){let Y=X[Q];if(J[Q]===void 0&&gb(Y)){let G=Y.ast,K=G._tag==="PropertySignatureDeclaration"?G.defaultValue:G.to.defaultValue;if(K!==void 0)J[Q]=K()}}return J};function B00(X,J,Z=Gz8(X,J)){return class extends t8(Z){static annotations(Y){return B00(this.fields,this.records,MY(this.ast,Y))}static fields={...X};static records=[...J];static make=(Y,G)=>{let K=GR0(X,{...Y});return rb(G)?K:RU(this)(K)};static pick(...Y){return $0(wP0(X,...Y))}static omit(...Y){return $0(LP0(X,...Y))}}}function $0(X,...J){return B00(X,J)}var mQ=(X)=>s0(X).pipe(Hq,bW(()=>X)),zM=(X,J)=>$0({_tag:mQ(X),...J});function KR0(X,J,Z){return class extends B00({},[{key:X,value:J}],Z){static annotations(Y){return KR0(X,J,MY(this.ast,Y))}static key=X;static value=J}}var i7=(X)=>KR0(X.key,X.value),BR0=(...X)=>(J)=>t8(yG(J.ast,X)),Kz8=(...X)=>(J)=>t8(_O0(J.ast,X)),Bz8=$(2,(X,J)=>{let Z=KH(PX(X.ast),J),Q=t8(Z.isOptional?HA(Z.type):Z.type);return k8(X.pipe(BR0(J)),Q,{strict:!0,decode:(G)=>G[J],encode:(G)=>Z.isOptional&&G===void 0?{}:{[J]:G}})});function H00(X,J){return class extends t8(J){static annotations(Q){return H00(this.from,MY(this.ast,Q))}static make=(Q,Y)=>{return rb(Y)?Q:RU(this)(Q)};static from=X}}var Hz8=(X,J)=>(Z)=>{let Q=w0(No(Z.ast),{onNone:()=>[X],onSome:(G)=>[...G,X]}),Y=FA(Z.ast,bH({[Go]:Q,...J}));return H00(Z,Y)},Wz8=(X)=>t8(DU(X.ast)),Vz8=$((X)=>eX(X[0]),(X,J)=>t8(DU(X.ast,J))),$z8=(X)=>t8(Z_(X.ast)),Uz8=(X)=>t8(qU(X.ast)),YM=(X,J,Z)=>{if(qA(X)&&qA(J)){let Q=[...X.propertySignatures];for(let Y of J.propertySignatures){let G=Y.name,K=Q.findIndex((B)=>B.name===G);if(K===-1)Q.push(Y);else{let{isOptional:B,type:H}=Q[K];Q[K]=new aX(G,Tb(H,Y.type,Z.concat(G)),B,!0)}}return new eJ(Q,X.indexSignatures.concat(J.indexSignatures))}throw Error(Xo(X,J,Z))},zz8=qO0([$A]),GM=(X,J)=>J.map((Z)=>new s1(Z,X.filter,zz8(X))),Tb=(X,J,Z)=>W6.make(kH([X],[J],Z)),nU=(X)=>DA(X)?X.types:[X],kH=(X,J,Z)=>S6(X,(Q)=>S6(J,(Y)=>{switch(Y._tag){case"Literal":{if(n9(Y.literal)&&_A(Q)||e7(Y.literal)&&Fo(Q)||yJ(Y.literal)&&Ao(Q))return[Y];break}case"StringKeyword":{if(Y===K_){if(_A(Q)||q3(Q)&&n9(Q.literal))return[Q];else if(D3(Q))return GM(Q,kH(nU(Q.from),[Y],Z))}else if(Q===K_)return[Y];break}case"NumberKeyword":{if(Y===B_){if(Fo(Q)||q3(Q)&&e7(Q.literal))return[Q];else if(D3(Q))return GM(Q,kH(nU(Q.from),[Y],Z))}else if(Q===B_)return[Y];break}case"BooleanKeyword":{if(Y===H_){if(Ao(Q)||q3(Q)&&yJ(Q.literal))return[Q];else if(D3(Q))return GM(Q,kH(nU(Q.from),[Y],Z))}else if(Q===H_)return[Y];break}case"Union":return kH(nU(Q),Y.types,Z);case"Suspend":return[new gG(()=>Tb(Q,Y.f(),Z))];case"Refinement":return GM(Y,kH(nU(Q),nU(Y.from),Z));case"TypeLiteral":{switch(Q._tag){case"Union":return kH(Q.types,[Y],Z);case"Suspend":return[new gG(()=>Tb(Q.f(),Y,Z))];case"Refinement":return GM(Q,kH(nU(Q.from),[Y],Z));case"TypeLiteral":return[YM(Q,Y,Z)];case"Transformation":{let G=Q.transformation,K=YM(Q.from,Y,Z),B=YM(Q.to,PX(Y),Z);switch(G._tag){case"TypeLiteralTransformation":return[new CZ(K,B,new t1(G.propertySignatureTransformations))];case"ComposeTransformation":return[new CZ(K,B,yx)];case"FinalTransformation":return[new CZ(K,B,new bx((H,W,V,U)=>XZ(G.decode(H,W,V,U),(O)=>({...H,...O})),(H,W,V,U)=>XZ(G.encode(H,W,V,U),(O)=>({...H,...O}))))]}}}break}case"Transformation":{if(kx(Q)){if(LA(Y.transformation)&&LA(Q.transformation))return[new CZ(YM(Q.from,Y.from,Z),YM(Q.to,Y.to,Z),new t1(Y.transformation.propertySignatureTransformations.concat(Q.transformation.propertySignatureTransformations)))]}else return kH([Y],[Q],Z);break}}throw Error(Xo(Q,Y,Z))})),NM=$(2,(X,J)=>t8(Tb(X.ast,J.ast,[]))),oU=$((X)=>eX(X[1]),(X,J)=>V00(X,J,Io(X.ast,J.ast))),Mb=(X)=>t8(new gG(()=>X().ast)),W00=Symbol.for("effect/SchemaId/Refine");function HR0(X,J,Z){return class extends t8(Z){static annotations(Y){return HR0(this.from,this.filter,MY(this.ast,Y))}static[W00]=X;static from=X;static filter=J;static make=(Y,G)=>{return rb(G)?Y:RU(this)(Y)}}}var MP0=(X,J,Z)=>{if(yJ(X))return X?S():I(new a8(J,Z));if(n9(X))return I(new a8(J,Z,X));if(X!==void 0){if("_tag"in X)return I(X);let Q=new a8(J,Z,X.message);return I(B8(X.path)?new RJ(X.path,Z,Q):Q)}return S()},WR0=(X,J,Z)=>{if(qN0(X))return MP0(X,J,Z);if(B8(X)){let Q=LQ(X,(Y)=>MP0(Y,J,Z));if(B8(Q))return I(Q.length===1?Q[0]:new s6(J,Z,Q))}return S()};function n8(X,J){return(Z)=>{function Q(G,K,B){return WR0(X(G,K,B),B,G)}let Y=new s1(Z.ast,Q,bH(J));return HR0(Z,Q,Y)}}var Nz8=$(2,(X,J)=>d6(X,l8(X),{strict:!0,decode:(Z,Q,Y)=>q5(J(Z,Q,Y),(G)=>w0(WR0(G,Y,Z),{onNone:()=>YX(Z),onSome:h6})),encode:(Z)=>YX(Z)}));function V00(X,J,Z){return class extends t8(Z){static annotations(Y){return V00(this.from,this.to,MY(this.ast,Y))}static from=X;static to=J}}var d6=$((X)=>eX(X[0])&&eX(X[1]),(X,J,Z)=>V00(X,J,new CZ(X.ast,J.ast,new bx(Z.decode,Z.encode)))),k8=$((X)=>eX(X[0])&&eX(X[1]),(X,J,Z)=>d6(X,J,{strict:!0,decode:(Q,Y,G,K)=>YX(Z.decode(Q,K)),encode:(Q,Y,G,K)=>YX(Z.encode(Q,K))}));function VR0(X,J){return k8(s0(X),s0(J),{strict:!0,decode:()=>J,encode:()=>X})}function Oz8(...X){return U8(...X.map(([J,Z])=>VR0(J,Z)))}var _z8=$((X)=>eX(X[0]),(X,J,Z,Q)=>{let Y=NM(l8(X),$0({[J]:f5(Z)?oP0(Z):s0(Z)})).ast;return t8(new CZ(X.ast,Q?MY(Y,Q):Y,new t1([new wA(J,J,()=>I(Z),()=>S())])))}),qz8=$(2,(X,J)=>X.annotations(J)),Dz8=$(2,(X,J)=>t8(WA(X.ast,J))),$R0=Symbol.for("effect/SchemaId/Trimmed"),UR0=(X)=>(J)=>J.pipe(n8((Z)=>Z===Z.trim(),{schemaId:$R0,title:"trimmed",description:"a string with no leading or trailing whitespace",jsonSchema:{pattern:"^\\S[\\s\\S]*\\S$|^\\S$|^$"},...X})),zR0=zP0,$00=(X,J)=>(Z)=>Z.pipe(n8((Q)=>Q.length<=X,{schemaId:zR0,title:`maxLength(${X})`,description:`a string at most ${X} character(s) long`,jsonSchema:{maxLength:X},...J})),NR0=UP0,$6=(X,J)=>(Z)=>Z.pipe(n8((Q)=>Q.length>=X,{schemaId:NR0,title:`minLength(${X})`,description:`a string at least ${X} character(s) long`,jsonSchema:{minLength:X},...J})),Re=NP0,OR0=(X,J)=>(Z)=>{let Q=c6(X)?Math.max(0,Math.floor(X.min)):Math.max(0,Math.floor(X)),Y=c6(X)?Math.max(Q,Math.floor(X.max)):Q;if(Q!==Y)return Z.pipe(n8((G)=>G.length>=Q&&G.length<=Y,{schemaId:Re,title:`length({ min: ${Q}, max: ${Y})`,description:`a string at least ${Q} character(s) and at most ${Y} character(s) long`,jsonSchema:{minLength:Q,maxLength:Y},...J}));return Z.pipe(n8((G)=>G.length===Q,{schemaId:Re,title:`length(${Q})`,description:Q===1?"a single character":`a string ${Q} character(s) long`,jsonSchema:{minLength:Q,maxLength:Q},...J}))},je=Symbol.for("effect/SchemaId/Pattern"),U00=(X,J)=>(Z)=>{let Q=X.source;return Z.pipe(n8((Y)=>{return X.lastIndex=0,X.test(Y)},{schemaId:je,[je]:{regex:X},description:`a string matching the pattern ${Q}`,jsonSchema:{pattern:Q},...J}))},Ce=Symbol.for("effect/SchemaId/StartsWith"),wz8=(X,J)=>(Z)=>{let Q=JSON.stringify(X);return Z.pipe(n8((Y)=>Y.startsWith(X),{schemaId:Ce,[Ce]:{startsWith:X},title:`startsWith(${Q})`,description:`a string starting with ${Q}`,jsonSchema:{pattern:`^${X}`},...J}))},Ie=Symbol.for("effect/SchemaId/EndsWith"),Lz8=(X,J)=>(Z)=>{let Q=JSON.stringify(X);return Z.pipe(n8((Y)=>Y.endsWith(X),{schemaId:Ie,[Ie]:{endsWith:X},title:`endsWith(${Q})`,description:`a string ending with ${Q}`,jsonSchema:{pattern:`^.*${X}$`},...J}))},Ee=Symbol.for("effect/SchemaId/Includes"),Fz8=(X,J)=>(Z)=>{let Q=JSON.stringify(X);return Z.pipe(n8((Y)=>Y.includes(X),{schemaId:Ee,[Ee]:{includes:X},title:`includes(${Q})`,description:`a string including ${Q}`,jsonSchema:{pattern:`.*${X}.*`},...J}))},_R0=Symbol.for("effect/SchemaId/Lowercased"),qR0=(X)=>(J)=>J.pipe(n8((Z)=>Z===Z.toLowerCase(),{schemaId:_R0,title:"lowercased",description:"a lowercase string",jsonSchema:{pattern:"^[^A-Z]*$"},...X}));class z00 extends d.pipe(qR0({identifier:"Lowercased"})){}var DR0=Symbol.for("effect/SchemaId/Uppercased"),wR0=(X)=>(J)=>J.pipe(n8((Z)=>Z===Z.toUpperCase(),{schemaId:DR0,title:"uppercased",description:"an uppercase string",jsonSchema:{pattern:"^[^a-z]*$"},...X}));class N00 extends d.pipe(wR0({identifier:"Uppercased"})){}var LR0=Symbol.for("effect/SchemaId/Capitalized"),FR0=(X)=>(J)=>J.pipe(n8((Z)=>Z[0]?.toUpperCase()===Z[0],{schemaId:LR0,title:"capitalized",description:"a capitalized string",jsonSchema:{pattern:"^[^a-z]?.*$"},...X}));class O00 extends d.pipe(FR0({identifier:"Capitalized"})){}var AR0=Symbol.for("effect/SchemaId/Uncapitalized"),TR0=(X)=>(J)=>J.pipe(n8((Z)=>Z[0]?.toLowerCase()===Z[0],{schemaId:AR0,title:"uncapitalized",description:"a uncapitalized string",jsonSchema:{pattern:"^[^A-Z]?.*$"},...X}));class _00 extends d.pipe(TR0({identifier:"Uncapitalized"})){}class MR0 extends d.pipe(OR0(1,{identifier:"Char"})){}var q00=(X)=>$6(1,{title:"nonEmptyString",description:"a non empty string",...X});class PR0 extends k8(d.annotations({description:"a string that will be converted to lowercase"}),z00,{strict:!0,decode:(X)=>X.toLowerCase(),encode:t}).annotations({identifier:"Lowercase"}){}class RR0 extends k8(d.annotations({description:"a string that will be converted to uppercase"}),N00,{strict:!0,decode:(X)=>X.toUpperCase(),encode:t}).annotations({identifier:"Uppercase"}){}class jR0 extends k8(d.annotations({description:"a string that will be converted to a capitalized format"}),O00,{strict:!0,decode:(X)=>Ki(X),encode:t}).annotations({identifier:"Capitalize"}){}class CR0 extends k8(d.annotations({description:"a string that will be converted to an uncapitalized format"}),_00,{strict:!0,decode:(X)=>Bi(X),encode:t}).annotations({identifier:"Uncapitalize"}){}class mb extends d.pipe(UR0({identifier:"Trimmed"})){}class D00 extends mb.pipe(q00({identifier:"NonEmptyTrimmedString"})){}class IR0 extends k8(d.annotations({description:"a string that will be trimmed"}),mb,{strict:!0,decode:(X)=>X.trim(),encode:t}).annotations({identifier:"Trim"}){}var Az8=(X)=>k8(d.annotations({description:"a string that will be split"}),K8(d),{strict:!0,decode:(J)=>J.split(X),encode:(J)=>J.join(X)}),Se=(X)=>X instanceof Error?X.message:String(X),Tz8=(X)=>d6(d.annotations({description:"a string to be decoded into JSON"}),A6,{strict:!0,decode:(J,Z,Q)=>N_({try:()=>JSON.parse(J,X?.reviver),catch:(Y)=>new a8(Q,J,Se(Y))}),encode:(J,Z,Q)=>N_({try:()=>JSON.stringify(J,X?.replacer,X?.space),catch:(Y)=>new a8(Q,J,Se(Y))})}).annotations({title:"parseJson",schemaId:Cx}),w00=(X,J)=>eX(X)?oU(w00(J),X):Tz8(X);class ER0 extends d.pipe(q00({identifier:"NonEmptyString"})){}var SR0=Symbol.for("effect/SchemaId/UUID"),PP0=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;class xR0 extends d.pipe(U00(PP0,{schemaId:SR0,identifier:"UUID",jsonSchema:{format:"uuid",pattern:PP0.source},description:"a Universally Unique Identifier",arbitrary:()=>(X)=>X.uuid()})){}var vR0=Symbol.for("effect/SchemaId/ULID"),Mz8=/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i;class kR0 extends d.pipe(U00(Mz8,{schemaId:vR0,identifier:"ULID",description:"a Universally Unique Lexicographically Sortable Identifier",arbitrary:()=>(X)=>X.ulid()})){}class L00 extends tP0(URL,{typeConstructor:{_tag:"URL"},identifier:"URLFromSelf",arbitrary:()=>(X)=>X.webUrl().map((J)=>new URL(J)),pretty:()=>(X)=>X.toString()}){}class bR0 extends d6(d.annotations({description:"a string to be decoded into a URL"}),L00,{strict:!0,decode:(X,J,Z)=>N_({try:()=>new URL(X),catch:(Q)=>new a8(Z,X,`Unable to decode ${JSON.stringify(X)} into a URL. ${Se(Q)}`)}),encode:(X)=>YX(X.toString())}).annotations({identifier:"URL",pretty:()=>(X)=>X.toString()}){}var yR0=YP0,F00=(X)=>(J)=>J.pipe(n8(Number.isFinite,{schemaId:yR0,title:"finite",description:"a finite number",jsonSchema:{},...X})),gR0=eM0,hR0=(X,J)=>(Z)=>Z.pipe(n8((Q)=>Q>X,{schemaId:gR0,title:`greaterThan(${X})`,description:X===0?"a positive number":`a number greater than ${X}`,jsonSchema:{exclusiveMinimum:X},...J})),mR0=XP0,dQ=(X,J)=>(Z)=>Z.pipe(n8((Q)=>Q>=X,{schemaId:mR0,title:`greaterThanOrEqualTo(${X})`,description:X===0?"a non-negative number":`a number greater than or equal to ${X}`,jsonSchema:{minimum:X},...J})),dR0=Symbol.for("effect/SchemaId/MultipleOf"),Pz8=(X,J)=>(Z)=>{let Q=Math.abs(X);return Z.pipe(n8((Y)=>DK0(Y,X)===0,{schemaId:dR0,title:`multipleOf(${Q})`,description:`a number divisible by ${Q}`,jsonSchema:{multipleOf:Q},...J}))},uR0=Fb,OM=(X)=>(J)=>J.pipe(n8((Z)=>Number.isSafeInteger(Z),{schemaId:uR0,title:"int",description:"an integer",jsonSchema:{type:"integer"},...X})),cR0=JP0,fR0=(X,J)=>(Z)=>Z.pipe(n8((Q)=>Q<X,{schemaId:cR0,title:`lessThan(${X})`,description:X===0?"a negative number":`a number less than ${X}`,jsonSchema:{exclusiveMaximum:X},...J})),pR0=ZP0,S3=(X,J)=>(Z)=>Z.pipe(n8((Q)=>Q<=X,{schemaId:pR0,title:`lessThanOrEqualTo(${X})`,description:X===0?"a non-positive number":`a number less than or equal to ${X}`,jsonSchema:{maximum:X},...J})),lR0=KP0,uW=(X,J,Z)=>(Q)=>Q.pipe(n8((Y)=>Y>=X&&Y<=J,{schemaId:lR0,title:`between(${X}, ${J})`,description:`a number between ${X} and ${J}`,jsonSchema:{minimum:X,maximum:J},...Z})),nR0=QP0,iR0=(X)=>(J)=>J.pipe(n8((Z)=>!Number.isNaN(Z),{schemaId:nR0,title:"nonNaN",description:"a number excluding NaN",...X})),oR0=(X)=>hR0(0,{title:"positive",...X}),rR0=(X)=>fR0(0,{title:"negative",...X}),aR0=(X)=>S3(0,{title:"nonPositive",...X}),sR0=(X)=>dQ(0,{title:"nonNegative",...X}),Rz8=(X,J)=>(Z)=>{return k8(Z,l8(Z).pipe(uW(X,J)),{strict:!1,decode:(Q)=>_K0(Q,{minimum:X,maximum:J}),encode:t})};function tR0(X){return d6(X,L8,{strict:!1,decode:(J,Z,Q)=>RA(LK0(J),()=>new a8(Q,J,`Unable to decode ${JSON.stringify(J)} into a number`)),encode:(J)=>YX(String(J))})}class hH extends tR0(d.annotations({description:"a string to be decoded into a number"})).annotations({identifier:"NumberFromString"}){}class eR0 extends L8.pipe(F00({identifier:"Finite"})){}class F5 extends L8.pipe(OM({identifier:"Int"})){}class Xj0 extends L8.pipe(iR0({identifier:"NonNaN"})){}class Jj0 extends L8.pipe(oR0({identifier:"Positive"})){}class Zj0 extends L8.pipe(rR0({identifier:"Negative"})){}class Qj0 extends L8.pipe(aR0({identifier:"NonPositive"})){}class db extends L8.pipe(sR0({identifier:"NonNegative"})){}var Yj0=GP0;class Gj0 extends L8.pipe(F00({schemaId:Yj0,identifier:"JsonNumber"})){}class Kj0 extends k8(q8.annotations({description:"a boolean that will be negated"}),q8,{strict:!0,decode:(X)=>jL(X),encode:(X)=>jL(X)}){}var Bj0=(X,J)=>{let Z=Symbol.keyFor(X);return Z===void 0?h6(new a8(J,X,`Unable to encode a unique symbol ${String(X)} into a string`)):YX(Z)},Hj0=(X)=>YX(Symbol.for(X));class Wj0 extends d6(d.annotations({description:"a string to be decoded into a globally shared symbol"}),bb,{strict:!1,decode:(X)=>Hj0(X),encode:(X,J,Z)=>Bj0(X,Z)}).annotations({identifier:"Symbol"}){}var xe=BP0,Vj0=(X,J)=>(Z)=>Z.pipe(n8((Q)=>Q>X,{schemaId:xe,[xe]:{min:X},title:`greaterThanBigInt(${X})`,description:X===0n?"a positive bigint":`a bigint greater than ${X}n`,...J})),ve=HP0,$j0=(X,J)=>(Z)=>Z.pipe(n8((Q)=>Q>=X,{schemaId:ve,[ve]:{min:X},title:`greaterThanOrEqualToBigInt(${X})`,description:X===0n?"a non-negative bigint":`a bigint greater than or equal to ${X}n`,...J})),ke=WP0,Uj0=(X,J)=>(Z)=>Z.pipe(n8((Q)=>Q<X,{schemaId:ke,[ke]:{max:X},title:`lessThanBigInt(${X})`,description:X===0n?"a negative bigint":`a bigint less than ${X}n`,...J})),be=VP0,zj0=(X,J)=>(Z)=>Z.pipe(n8((Q)=>Q<=X,{schemaId:be,[be]:{max:X},title:`lessThanOrEqualToBigInt(${X})`,description:X===0n?"a non-positive bigint":`a bigint less than or equal to ${X}n`,...J})),ye=$P0,A00=(X,J,Z)=>(Q)=>Q.pipe(n8((Y)=>Y>=X&&Y<=J,{schemaId:ye,[ye]:{min:X,max:J},title:`betweenBigInt(${X}, ${J})`,description:`a bigint between ${X}n and ${J}n`,...Z})),T00=(X)=>Vj0(0n,{title:"positiveBigInt",...X}),M00=(X)=>Uj0(0n,{title:"negativeBigInt",...X}),P00=(X)=>$j0(0n,{title:"nonNegativeBigInt",...X}),R00=(X)=>zj0(0n,{title:"nonPositiveBigInt",...X}),jz8=(X,J)=>(Z)=>k8(Z,Z.pipe(l8,A00(X,J)),{strict:!1,decode:(Q)=>qT0(Q,{minimum:X,maximum:J}),encode:t});class rU extends d6(d.annotations({description:"a string to be decoded into a bigint"}),dW,{strict:!0,decode:(X,J,Z)=>RA(wT0(X),()=>new a8(Z,X,`Unable to decode ${JSON.stringify(X)} into a bigint`)),encode:(X)=>YX(String(X))}).annotations({identifier:"BigInt"}){}var Cz8=dW.pipe(T00({identifier:"PositiveBigintFromSelf"})),Iz8=rU.pipe(T00({identifier:"PositiveBigint"})),Ez8=dW.pipe(M00({identifier:"NegativeBigintFromSelf"})),Sz8=rU.pipe(M00({identifier:"NegativeBigint"})),xz8=dW.pipe(R00({identifier:"NonPositiveBigintFromSelf"})),vz8=rU.pipe(R00({identifier:"NonPositiveBigint"})),Nj0=dW.pipe(P00({identifier:"NonNegativeBigintFromSelf"})),kz8=rU.pipe(P00({identifier:"NonNegativeBigint"}));class Oj0 extends d6(L8.annotations({description:"a number to be decoded into a bigint"}),dW.pipe(A00(BigInt(Number.MIN_SAFE_INTEGER),BigInt(Number.MAX_SAFE_INTEGER))),{strict:!0,decode:(X,J,Z)=>RA(LT0(X),()=>new a8(Z,X,`Unable to decode ${X} into a bigint`)),encode:(X,J,Z)=>RA(DT0(X),()=>new a8(Z,X,`Unable to encode ${X}n into a number`))}).annotations({identifier:"BigIntFromNumber"}){}var bz8=(X)=>(J)=>X(J).map(L5),HQ=(X,J,Z,Q)=>TO0(X,{onFailure:(Y)=>new s6(Z,Q,Y),onSuccess:J}),RP0=(X)=>(J,Z,Q)=>De(J)?HQ(X(kW(J),Z),L5,Q,J):h6(new a8(Q,J)),_j0=(X)=>X6([X],{decode:(J)=>RP0(W7(J)),encode:(J)=>RP0(I7(J))},{typeConstructor:{_tag:"effect/Redacted"},description:"Redacted(<redacted>)",pretty:()=>()=>"Redacted(<redacted>)",arbitrary:bz8,equivalence:we});function yz8(X){return k8(X,_j0(l8(qX(X))),{strict:!0,decode:(J)=>L5(J),encode:(J)=>kW(J)})}class _M extends X6(Iw,{typeConstructor:{_tag:"effect/Duration"},identifier:"DurationFromSelf",pretty:()=>String,arbitrary:()=>(X)=>X.oneof(X.constant(tV),X.bigInt({min:0n}).map((J)=>UG(J)),X.maxSafeNat().map((J)=>v6(J))),equivalence:()=>YC}){}class qj0 extends d6(Nj0.annotations({description:"a bigint to be decoded into a Duration"}),_M.pipe(n8((X)=>bK(X),{description:"a finite duration"})),{strict:!0,decode:(X)=>YX(UG(X)),encode:(X,J,Z)=>w0(Yf(X),{onNone:()=>h6(new a8(Z,X,`Unable to encode ${X} into a bigint`)),onSome:(Q)=>YX(Q)})}).annotations({identifier:"DurationFromNanos"}){}var Pb=db.pipe(OM()).annotations({identifier:"NonNegativeInt"});class Dj0 extends k8(db.annotations({description:"a non-negative number to be decoded into a Duration"}),_M,{strict:!0,decode:(X)=>v6(X),encode:(X)=>K7(X)}).annotations({identifier:"DurationFromMillis"}){}var wj0=zM("Millis",{millis:Pb}),Lj0=zM("Nanos",{nanos:rU}),Fj0=zM("Infinity",{}),gz8=Fj0.make({}),hz8=U8(wj0,Lj0,Fj0).annotations({identifier:"DurationValue",description:"an JSON-compatible tagged union to be decoded into a Duration"}),mz8=bZ(Te(Pb).annotations({title:"seconds"}),Te(Pb).annotations({title:"nanos"})).annotations({identifier:"FiniteHRTime"}),dz8=bZ(s0(-1),s0(0)).annotations({identifier:"InfiniteHRTime"}),uz8=U8(mz8,dz8).annotations({identifier:"HRTime",description:"a tuple of seconds and nanos to be decoded into a Duration"}),cz8=(X)=>typeof X==="object";class Aj0 extends k8(U8(hz8,uz8),_M,{strict:!0,decode:(X)=>{if(cz8(X))switch(X._tag){case"Millis":return v6(X.millis);case"Nanos":return UG(X.nanos);case"Infinity":return tV}let[J,Z]=X;return J===-1?tV:UG(BigInt(J)*BigInt(1e9)+BigInt(Z))},encode:(X)=>{switch(X.value._tag){case"Millis":return wj0.make({millis:X.value.millis});case"Nanos":return Lj0.make({nanos:X.value.nanos});case"Infinity":return gz8}}}).annotations({identifier:"Duration"}){}var fz8=(X,J)=>(Z)=>k8(Z,Z.pipe(l8,Tj0(X,J)),{strict:!1,decode:(Q)=>Kf(Q,{minimum:X,maximum:J}),encode:t}),WM=Symbol.for("effect/SchemaId/LessThanDuration"),pz8=(X,J)=>(Z)=>Z.pipe(n8((Q)=>GC(Q,X),{schemaId:WM,[WM]:{max:X},title:`lessThanDuration(${X})`,description:`a Duration less than ${K9(X)}`,...J})),lz8=Symbol.for("effect/schema/LessThanOrEqualToDuration"),nz8=(X,J)=>(Z)=>Z.pipe(n8((Q)=>Sw(Q,X),{schemaId:WM,[WM]:{max:X},title:`lessThanOrEqualToDuration(${X})`,description:`a Duration less than or equal to ${K9(X)}`,...J})),ge=Symbol.for("effect/SchemaId/GreaterThanDuration"),iz8=(X,J)=>(Z)=>Z.pipe(n8((Q)=>xw(Q,X),{schemaId:ge,[ge]:{min:X},title:`greaterThanDuration(${X})`,description:`a Duration greater than ${K9(X)}`,...J})),he=Symbol.for("effect/schema/GreaterThanOrEqualToDuration"),oz8=(X,J)=>(Z)=>Z.pipe(n8((Q)=>IN(Q,X),{schemaId:he,[he]:{min:X},title:`greaterThanOrEqualToDuration(${X})`,description:`a Duration greater than or equal to ${K9(X)}`,...J})),me=Symbol.for("effect/SchemaId/BetweenDuration"),Tj0=(X,J,Z)=>(Q)=>Q.pipe(n8((Y)=>Gf(Y,{minimum:X,maximum:J}),{schemaId:me,[me]:{maximum:J,minimum:X},title:`betweenDuration(${X}, ${J})`,description:`a Duration between ${K9(X)} and ${K9(J)}`,...Z}));class ub extends X6(uQ0,{typeConstructor:{_tag:"Uint8Array"},identifier:"Uint8ArrayFromSelf",pretty:()=>(X)=>`new Uint8Array(${JSON.stringify(Array.from(X))})`,arbitrary:()=>(X)=>X.uint8Array(),equivalence:()=>dJ(_0)}){}class j00 extends L8.pipe(uW(0,255,{identifier:"Uint8",description:"a 8-bit unsigned integer"})){}class Mj0 extends k8(K8(j00).annotations({description:"an array of 8-bit unsigned integers to be decoded into a Uint8Array"}),ub,{strict:!0,decode:(X)=>Uint8Array.from(X),encode:(X)=>Array.from(X)}).annotations({identifier:"Uint8Array"}){}var C00=(X,J,Z)=>d6(d.annotations({description:"a string to be decoded into a Uint8Array"}),ub,{strict:!0,decode:(Q,Y,G)=>eQ(J(Q),(K)=>new a8(G,Q,K.message)),encode:(Q)=>YX(Z(Q))}).annotations({identifier:X}),qM=C00("Uint8ArrayFromBase64",Qe,Ze),rz8=C00("Uint8ArrayFromBase64Url",Ge,Ye),az8=C00("Uint8ArrayFromHex",Be,Ke),I00=(X,J,Z)=>d6(d.annotations({description:`A string that is interpreted as being ${X}-encoded and will be decoded into a UTF-8 string`}),d,{strict:!0,decode:(Q,Y,G)=>eQ(J(Q),(K)=>new a8(G,Q,K.message)),encode:(Q)=>YX(Z(Q))}).annotations({identifier:`StringFrom${X}`}),sz8=I00("Base64",VM0,Ze),tz8=I00("Base64Url",$M0,Ye),ez8=I00("Hex",UM0,Ke),XN8=d6(d.annotations({description:"A string that is interpreted as being UriComponent-encoded and will be decoded into a UTF-8 string"}),d,{strict:!0,decode:(X,J,Z)=>eQ(NM0(X),(Q)=>new a8(Z,X,Q.message)),encode:(X,J,Z)=>eQ(zM0(X),(Q)=>new a8(Z,X,Q.message))}).annotations({identifier:"StringFromUriComponent"}),Pj0=OP0,JN8=(X,J)=>(Z)=>{let Q=Math.floor(X);if(Q<1)throw Error(Lx(`Expected an integer greater than or equal to 1, actual ${X}`));return Z.pipe(n8((Y)=>Y.length>=Q,{schemaId:Pj0,title:`minItems(${Q})`,description:`an array of at least ${Q} item(s)`,jsonSchema:{minItems:Q},[zA]:!0,...J}))},Rj0=_P0,ZN8=(X,J)=>(Z)=>{let Q=Math.floor(X);if(Q<1)throw Error(Lx(`Expected an integer greater than or equal to 1, actual ${X}`));return Z.pipe(n8((Y)=>Y.length<=Q,{schemaId:Rj0,title:`maxItems(${Q})`,description:`an array of at most ${Q} item(s)`,jsonSchema:{maxItems:Q},[zA]:!0,...J}))},jj0=qP0,QN8=(X,J)=>(Z)=>{let Q=Math.floor(X);if(Q<0)throw Error(Lx(`Expected an integer greater than or equal to 0, actual ${X}`));return Z.pipe(n8((Y)=>Y.length===Q,{schemaId:jj0,title:`itemsCount(${Q})`,description:`an array of exactly ${Q} item(s)`,jsonSchema:{minItems:Q,maxItems:Q},[zA]:!0,...J}))},cb=(X)=>t8(BA(X.ast));function YN8(X){return k8(X,aU(cb(l8(X))),{strict:!1,decode:(J)=>mJ(J),encode:(J)=>w0(J,{onNone:()=>[],onSome:X8})})}function GN8(X){return k8(X,cb(l8(X)),{strict:!1,decode:(J)=>c9(J),encode:(J)=>X8(J)})}var KN8=$((X)=>eX(X[0]),(X,J)=>d6(X,cb(l8(X)),{strict:!0,decode:(Z,Q,Y)=>Z.length>0?YX(Z[0]):J?YX(J()):h6(new a8(Y,Z,"Unable to retrieve the first element of an empty array")),encode:(Z)=>YX(X8(Z))})),de=Symbol.for("effect/SchemaId/ValidDate"),E00=(X)=>(J)=>J.pipe(n8((Z)=>!Number.isNaN(Z.getTime()),{schemaId:de,[de]:{noInvalidDate:!0},title:"validDate",description:"a valid Date",...X})),ue=Symbol.for("effect/SchemaId/LessThanDate"),BN8=(X,J)=>(Z)=>Z.pipe(n8((Q)=>Q<X,{schemaId:ue,[ue]:{max:X},title:`lessThanDate(${cZ(X)})`,description:`a date before ${cZ(X)}`,...J})),ce=Symbol.for("effect/schema/LessThanOrEqualToDate"),HN8=(X,J)=>(Z)=>Z.pipe(n8((Q)=>Q<=X,{schemaId:ce,[ce]:{max:X},title:`lessThanOrEqualToDate(${cZ(X)})`,description:`a date before or equal to ${cZ(X)}`,...J})),fe=Symbol.for("effect/SchemaId/GreaterThanDate"),WN8=(X,J)=>(Z)=>Z.pipe(n8((Q)=>Q>X,{schemaId:fe,[fe]:{min:X},title:`greaterThanDate(${cZ(X)})`,description:`a date after ${cZ(X)}`,...J})),pe=Symbol.for("effect/schema/GreaterThanOrEqualToDate"),VN8=(X,J)=>(Z)=>Z.pipe(n8((Q)=>Q>=X,{schemaId:pe,[pe]:{min:X},title:`greaterThanOrEqualToDate(${cZ(X)})`,description:`a date after or equal to ${cZ(X)}`,...J})),le=Symbol.for("effect/SchemaId/BetweenDate"),$N8=(X,J,Z)=>(Q)=>Q.pipe(n8((Y)=>Y<=J&&Y>=X,{schemaId:le,[le]:{max:J,min:X},title:`betweenDate(${cZ(X)}, ${cZ(J)})`,description:`a date between ${cZ(X)} and ${cZ(J)}`,...Z})),ne=tM0;class Vq extends X6(BN,{typeConstructor:{_tag:"Date"},identifier:"DateFromSelf",schemaId:ne,[ne]:{noInvalidDate:!1},description:"a potentially invalid Date instance",pretty:()=>(X)=>`new Date(${JSON.stringify(X)})`,arbitrary:()=>(X)=>X.date({noInvalidDate:!1}),equivalence:()=>vQ0}){}class Cj0 extends Vq.pipe(E00({identifier:"ValidDateFromSelf",description:"a valid Date instance"})){}class S00 extends k8(d.annotations({description:"a string to be decoded into a Date"}),Vq,{strict:!0,decode:(X)=>new Date(X),encode:(X)=>cZ(X)}).annotations({identifier:"DateFromString"}){}class fb extends S00.pipe(E00({identifier:"Date"})){}class Ij0 extends k8(L8.annotations({description:"a number to be decoded into a Date"}),Vq,{strict:!0,decode:(X)=>new Date(X),encode:(X)=>X.getTime()}).annotations({identifier:"DateFromNumber"}){}class DM extends X6((X)=>Vb(X)&&ht(X),{typeConstructor:{_tag:"effect/DateTime.Utc"},identifier:"DateTimeUtcFromSelf",description:"a DateTime.Utc instance",pretty:()=>(X)=>X.toString(),arbitrary:()=>(X)=>X.date({noInvalidDate:!0}).map((J)=>dt(J)),equivalence:()=>$b}){}var x00=(X,J)=>N_({try:()=>ut(X),catch:()=>new a8(J,X,`Unable to decode ${E6(X)} into a DateTime.Utc`)});class Ej0 extends d6(L8.annotations({description:"a number to be decoded into a DateTime.Utc"}),DM,{strict:!0,decode:(X,J,Z)=>x00(X,Z),encode:(X)=>YX(ot(X))}).annotations({identifier:"DateTimeUtcFromNumber"}){}class Sj0 extends d6(Vq.annotations({description:"a Date to be decoded into a DateTime.Utc"}),DM,{strict:!0,decode:(X,J,Z)=>x00(X,Z),encode:(X)=>YX(it(X))}).annotations({identifier:"DateTimeUtcFromDate"}){}class xj0 extends d6(d.annotations({description:"a string to be decoded into a DateTime.Utc"}),DM,{strict:!0,decode:(X,J,Z)=>x00(X,Z),encode:(X)=>YX(rt(X))}).annotations({identifier:"DateTimeUtc"}){}var vj0=()=>(X)=>X.integer({min:-43200000,max:50400000}).map(eT);class pb extends X6(yt,{typeConstructor:{_tag:"effect/DateTime.TimeZone.Offset"},identifier:"TimeZoneOffsetFromSelf",description:"a TimeZone.Offset instance",pretty:()=>(X)=>X.toString(),arbitrary:vj0}){}class kj0 extends k8(L8.annotations({description:"a number to be decoded into a TimeZone.Offset"}),pb,{strict:!0,decode:(X)=>eT(X),encode:(X)=>X.offset}).annotations({identifier:"TimeZoneOffset"}){}var bj0=()=>(X)=>X.constantFrom(...Intl.supportedValuesOf("timeZone")).map(Ub);class lb extends X6(gt,{typeConstructor:{_tag:"effect/DateTime.TimeZone.Named"},identifier:"TimeZoneNamedFromSelf",description:"a TimeZone.Named instance",pretty:()=>(X)=>X.toString(),arbitrary:bj0}){}class yj0 extends d6(d.annotations({description:"a string to be decoded into a TimeZone.Named"}),lb,{strict:!0,decode:(X,J,Z)=>N_({try:()=>Ub(X),catch:()=>new a8(Z,X,`Unable to decode ${JSON.stringify(X)} into a TimeZone.Named`)}),encode:(X)=>YX(X.id)}).annotations({identifier:"TimeZoneNamed"}){}class v00 extends U8(pb,lb){}class gj0 extends d6(d.annotations({description:"a string to be decoded into a TimeZone"}),v00,{strict:!0,decode:(X,J,Z)=>w0(lt(X),{onNone:()=>h6(new a8(Z,X,`Unable to decode ${JSON.stringify(X)} into a TimeZone`)),onSome:YX}),encode:(X)=>YX(nt(X))}).annotations({identifier:"TimeZone"}){}var UN8=(X)=>X.oneof(vj0()(X),bj0()(X));class k00 extends X6((X)=>Vb(X)&&mt(X),{typeConstructor:{_tag:"effect/DateTime.Zoned"},identifier:"DateTimeZonedFromSelf",description:"a DateTime.Zoned instance",pretty:()=>(X)=>X.toString(),arbitrary:()=>(X)=>X.tuple(X.integer({min:-31536000000000,max:31536000000000}),UN8(X)).map(([J,Z])=>ct(J,{timeZone:Z})),equivalence:()=>$b}){}class hj0 extends d6(d.annotations({description:"a string to be decoded into a DateTime.Zoned"}),k00,{strict:!0,decode:(X,J,Z)=>w0(ft(X),{onNone:()=>h6(new a8(Z,X,`Unable to decode ${JSON.stringify(X)} into a DateTime.Zoned`)),onSome:YX}),encode:(X)=>YX(at(X))}).annotations({identifier:"DateTimeZoned"}){}var zN8=$0({_tag:s0("None")}).annotations({description:"NoneEncoded"}),NN8=(X)=>$0({_tag:s0("Some"),value:X}).annotations({description:`SomeEncoded<${dX(X)}>`}),ON8=(X)=>U8(zN8,NN8(X)).annotations({description:`OptionEncoded<${dX(X)}>`}),mj0=(X)=>X._tag==="None"?S():I(X.value),_N8=(X,J)=>(Z)=>Z.oneof(J,Z.record({_tag:Z.constant("None")}),Z.record({_tag:Z.constant("Some"),value:X(Z)})).map(mj0),qN8=(X)=>w0({onNone:()=>"none()",onSome:(J)=>`some(${X(J)})`}),jP0=(X)=>(J,Z,Q)=>OB(J)?j8(J)?YX(S()):HQ(X(J.value,Z),I,Q,J):h6(new a8(Q,J)),ie=(X)=>{return X6([X],{decode:(J)=>jP0(W7(J)),encode:(J)=>jP0(I7(J))},{typeConstructor:{_tag:"effect/Option"},pretty:qN8,arbitrary:_N8,equivalence:Lc})},aU=(X)=>{return ie(X).annotations({description:`Option<${dX(X)}>`})},DN8={_tag:"None"},wN8=(X)=>({_tag:"Some",value:X});function dj0(X){let J=qX(X);return k8(ON8(J),aU(l8(J)),{strict:!0,decode:(Q)=>mj0(Q),encode:(Q)=>w0(Q,{onNone:()=>DN8,onSome:wN8})})}function LN8(X){return k8(KM(X),aU(l8(qX(X))),{strict:!0,decode:(J)=>x8(J),encode:(J)=>Aj(J)})}function FN8(X,J){return k8(BM(X),aU(l8(qX(X))),{strict:!0,decode:(Z)=>x8(Z),encode:J===null?(Z)=>Aj(Z):(Z)=>u9(Z)})}function AN8(X){return k8(SJ(X),aU(l8(qX(X))),{strict:!0,decode:(J)=>x8(J),encode:(J)=>u9(J)})}class uj0 extends k8(d,aU(D00),{strict:!0,decode:(X)=>gJ(I(X.trim()),iS),encode:(X)=>i0(X,()=>"")}){}var cj0=(X)=>$0({_tag:s0("Right"),right:X}).annotations({description:`RightEncoded<${dX(X)}>`}),fj0=(X)=>$0({_tag:s0("Left"),left:X}).annotations({description:`LeftEncoded<${dX(X)}>`}),TN8=(X,J)=>U8(cj0(X),fj0(J)).annotations({description:`EitherEncoded<${dX(J)}, ${dX(X)}>`}),pj0=(X)=>X._tag==="Left"?M0(X.left):O0(X.right),MN8=(X,J)=>(Z)=>Z.oneof(Z.record({_tag:Z.constant("Left"),left:J(Z)}),Z.record({_tag:Z.constant("Right"),right:X(Z)})).map(pj0),PN8=(X,J)=>w9({onLeft:(Z)=>`left(${J(Z)})`,onRight:(Z)=>`right(${X(Z)})`}),CP0=(X,J)=>(Z,Q,Y)=>TK(Z)?w9(Z,{onLeft:(G)=>HQ(J(G,Q),M0,Y,Z),onRight:(G)=>HQ(X(G,Q),O0,Y,Z)}):h6(new a8(Y,Z)),b00=({left:X,right:J})=>{return X6([J,X],{decode:(Z,Q)=>CP0(W7(Z),W7(Q)),encode:(Z,Q)=>CP0(I7(Z),I7(Q))},{typeConstructor:{_tag:"effect/Either"},description:`Either<${dX(J)}, ${dX(X)}>`,pretty:PN8,arbitrary:MN8,equivalence:(Z,Q)=>$c({left:Q,right:Z})})},oe=(X)=>({_tag:"Left",left:X}),re=(X)=>({_tag:"Right",right:X}),RN8=({left:X,right:J})=>{let Z=qX(J),Q=qX(X);return k8(TN8(Z,Q),b00({left:l8(Q),right:l8(Z)}),{strict:!0,decode:(G)=>pj0(G),encode:(G)=>w9(G,{onLeft:oe,onRight:re})})},jN8=({left:X,right:J})=>{let Z=qX(J),Q=qX(X),Y=l8(Z),G=l8(Q),K=k8(Z,cj0(Y),{strict:!0,decode:(W)=>re(W),encode:(W)=>W.right}),B=k8(Q,fj0(G),{strict:!0,decode:(W)=>oe(W),encode:(W)=>W.left});return k8(U8(K,B),b00({left:G,right:Y}),{strict:!0,decode:(W)=>W._tag==="Left"?M0(W.left):O0(W.right),encode:(W)=>w9(W,{onLeft:oe,onRight:re})})},CN8=(X,J,Z)=>{return(Q)=>{let Y=Q.array(Q.tuple(X(Q),J(Q)));return(Z.depthIdentifier!==void 0?Q.oneof(Z,Q.constant([]),Y):Y).map((G)=>new Map(G))}},IN8=(X,J)=>(Z)=>`new Map([${Array.from(Z.entries()).map(([Q,Y])=>`[${X(Q)}, ${J(Y)}]`).join(", ")}])`,EN8=(X,J)=>{let Z=dJ(I6(([Q,Y],[G,K])=>X(Q,G)&&J(Y,K)));return I6((Q,Y)=>Z(Array.from(Q.entries()),Array.from(Y.entries())))},IP0=(X)=>(J,Z,Q)=>gQ0(J)?HQ(X(Array.from(J.entries()),Z),(Y)=>new Map(Y),Q,J):h6(new a8(Q,J)),lj0=(X,J,Z)=>X6([X,J],{decode:(Q,Y)=>IP0(W7(K8(bZ(Q,Y)))),encode:(Q,Y)=>IP0(I7(K8(bZ(Q,Y))))},{typeConstructor:{_tag:"ReadonlyMap"},description:Z,pretty:IN8,arbitrary:CN8,equivalence:EN8}),y00=({key:X,value:J})=>lj0(X,J,`ReadonlyMap<${dX(X)}, ${dX(J)}>`),g00=({key:X,value:J})=>lj0(X,J,`Map<${dX(X)}, ${dX(J)}>`);function SN8({key:X,value:J}){return k8(K8(bZ(X,J)),y00({key:l8(qX(X)),value:l8(qX(J))}),{strict:!0,decode:(Z)=>new Map(Z),encode:(Z)=>Array.from(Z.entries())})}function xN8({key:X,value:J}){return k8(K8(bZ(X,J)),g00({key:l8(qX(X)),value:l8(qX(J))}),{strict:!0,decode:(Z)=>new Map(Z),encode:(Z)=>Array.from(Z.entries())})}var vN8=({key:X,value:J})=>k8(i7({key:Q00(X),value:J}).annotations({description:"a record to be decoded into a ReadonlyMap"}),y00({key:X,value:l8(J)}),{strict:!0,decode:(Z)=>new Map(Object.entries(Z)),encode:(Z)=>Object.fromEntries(Z)}),kN8=({key:X,value:J})=>k8(i7({key:Q00(X),value:J}).annotations({description:"a record to be decoded into a Map"}),g00({key:X,value:l8(J)}),{strict:!0,decode:(Z)=>new Map(Object.entries(Z)),encode:(Z)=>Object.fromEntries(Z)}),bN8=(X,J)=>(Z)=>{let Q=Z.array(X(Z));return(J.depthIdentifier!==void 0?Z.oneof(J,Z.constant([]),Q):Q).map((Y)=>new Set(Y))},yN8=(X)=>(J)=>`new Set([${Array.from(J.values()).map((Z)=>X(Z)).join(", ")}])`,gN8=(X)=>{let J=dJ(X);return I6((Z,Q)=>J(Array.from(Z.values()),Array.from(Q.values())))},EP0=(X)=>(J,Z,Q)=>yQ0(J)?HQ(X(Array.from(J.values()),Z),(Y)=>new Set(Y),Q,J):h6(new a8(Q,J)),nj0=(X,J)=>X6([X],{decode:(Z)=>EP0(W7(K8(Z))),encode:(Z)=>EP0(I7(K8(Z)))},{typeConstructor:{_tag:"ReadonlySet"},description:J,pretty:yN8,arbitrary:bN8,equivalence:gN8}),ij0=(X)=>nj0(X,`ReadonlySet<${dX(X)}>`),oj0=(X)=>nj0(X,`Set<${dX(X)}>`);function hN8(X){return k8(K8(X),ij0(l8(qX(X))),{strict:!0,decode:(J)=>new Set(J),encode:(J)=>Array.from(J)})}function mN8(X){return k8(K8(X),oj0(l8(qX(X))),{strict:!0,decode:(J)=>new Set(J),encode:(J)=>Array.from(J)})}var dN8=()=>(X)=>`BigDecimal(${iG(pU(X))})`,uN8=()=>(X)=>X.tuple(X.bigInt(),X.integer({min:-18,max:18})).map(([J,Z])=>SW(J,Z));class cW extends X6(Mt,{typeConstructor:{_tag:"effect/BigDecimal"},identifier:"BigDecimalFromSelf",pretty:dN8,arbitrary:uN8,equivalence:()=>Pt}){}class rj0 extends d6(d.annotations({description:"a string to be decoded into a BigDecimal"}),cW,{strict:!0,decode:(X,J,Z)=>Rt(X).pipe(w0({onNone:()=>h6(new a8(Z,X,`Unable to decode ${JSON.stringify(X)} into a BigDecimal`)),onSome:(Q)=>YX(pU(Q))})),encode:(X)=>YX(iG(pU(X)))}).annotations({identifier:"BigDecimal"}){}class aj0 extends k8(L8.annotations({description:"a number to be decoded into a BigDecimal"}),cW,{strict:!0,decode:(X)=>NT0(X),encode:(X)=>OT0(X)}).annotations({identifier:"BigDecimalFromNumber"}){}var ae=Symbol.for("effect/SchemaId/GreaterThanBigDecimal"),cN8=(X,J)=>(Z)=>{let Q=iG(X);return Z.pipe(n8((Y)=>VT0(Y,X),{schemaId:ae,[ae]:{min:X},title:`greaterThanBigDecimal(${Q})`,description:`a BigDecimal greater than ${Q}`,...J}))},se=Symbol.for("effect/schema/GreaterThanOrEqualToBigDecimal"),fN8=(X,J)=>(Z)=>{let Q=iG(X);return Z.pipe(n8((Y)=>$T0(Y,X),{schemaId:se,[se]:{min:X},title:`greaterThanOrEqualToBigDecimal(${Q})`,description:`a BigDecimal greater than or equal to ${Q}`,...J}))},te=Symbol.for("effect/SchemaId/LessThanBigDecimal"),pN8=(X,J)=>(Z)=>{let Q=iG(X);return Z.pipe(n8((Y)=>HT0(Y,X),{schemaId:te,[te]:{max:X},title:`lessThanBigDecimal(${Q})`,description:`a BigDecimal less than ${Q}`,...J}))},ee=Symbol.for("effect/schema/LessThanOrEqualToBigDecimal"),lN8=(X,J)=>(Z)=>{let Q=iG(X);return Z.pipe(n8((Y)=>WT0(Y,X),{schemaId:ee,[ee]:{max:X},title:`lessThanOrEqualToBigDecimal(${Q})`,description:`a BigDecimal less than or equal to ${Q}`,...J}))},sj0=Symbol.for("effect/schema/PositiveBigDecimal"),tj0=(X)=>(J)=>J.pipe(n8((Z)=>_T0(Z),{schemaId:sj0,title:"positiveBigDecimal",description:"a positive BigDecimal",...X})),nN8=cW.pipe(tj0({identifier:"PositiveBigDecimalFromSelf"})),ej0=Symbol.for("effect/schema/NonNegativeBigDecimal"),XC0=(X)=>(J)=>J.pipe(n8((Z)=>Z.value>=0n,{schemaId:ej0,title:"nonNegativeBigDecimal",description:"a non-negative BigDecimal",...X})),iN8=cW.pipe(XC0({identifier:"NonNegativeBigDecimalFromSelf"})),JC0=Symbol.for("effect/schema/NegativeBigDecimal"),ZC0=(X)=>(J)=>J.pipe(n8((Z)=>jt(Z),{schemaId:JC0,title:"negativeBigDecimal",description:"a negative BigDecimal",...X})),oN8=cW.pipe(ZC0({identifier:"NegativeBigDecimalFromSelf"})),QC0=Symbol.for("effect/schema/NonPositiveBigDecimal"),YC0=(X)=>(J)=>J.pipe(n8((Z)=>Z.value<=0n,{schemaId:QC0,title:"nonPositiveBigDecimal",description:"a non-positive BigDecimal",...X})),rN8=cW.pipe(YC0({identifier:"NonPositiveBigDecimalFromSelf"})),X00=Symbol.for("effect/SchemaId/BetweenBigDecimal"),GC0=(X,J,Z)=>(Q)=>{let Y=iG(X),G=iG(J);return Q.pipe(n8((K)=>UT0(K,{minimum:X,maximum:J}),{schemaId:X00,[X00]:{maximum:J,minimum:X},title:`betweenBigDecimal(${Y}, ${G})`,description:`a BigDecimal between ${Y} and ${G}`,...Z}))},aN8=(X,J)=>(Z)=>k8(Z,Z.pipe(l8,GC0(X,J)),{strict:!1,decode:(Q)=>zT0(Q,{minimum:X,maximum:J}),encode:t}),sN8=(X,J)=>(Z)=>{let Q=Z.array(X(Z));return(J.depthIdentifier!==void 0?Z.oneof(J,Z.constant([]),Q):Q).map(f9)},tN8=(X)=>(J)=>`Chunk(${G9(J).map(X).join(", ")})`,SP0=(X)=>(J,Z,Q)=>vK(J)?T8(J)?YX(a0()):HQ(X(G9(J),Z),f9,Q,J):h6(new a8(Q,J)),wM=(X)=>{return X6([X],{decode:(J)=>SP0(W7(K8(J))),encode:(J)=>SP0(I7(K8(J)))},{typeConstructor:{_tag:"effect/Chunk"},description:`Chunk<${dX(X)}>`,pretty:tN8,arbitrary:sN8,equivalence:Aw})};function eN8(X){return k8(K8(X),wM(l8(qX(X))),{strict:!0,decode:(J)=>J.length===0?a0():f9(J),encode:(J)=>G9(J)})}var XO8=(X)=>(J)=>qe(X(J),{minLength:1}).map((Z)=>CN(Z)),JO8=(X)=>(J)=>`NonEmptyChunk(${G9(J).map(X).join(", ")})`,xP0=(X)=>(J,Z,Q)=>vK(J)&&FX(J)?HQ(X(G9(J),Z),CN,Q,J):h6(new a8(Q,J)),KC0=(X)=>{return X6([X],{decode:(J)=>xP0(W7(j3(J))),encode:(J)=>xP0(I7(j3(J)))},{typeConstructor:{_tag:"effect/Chunk.NonEmptyChunk"},description:`NonEmptyChunk<${dX(X)}>`,pretty:JO8,arbitrary:XO8,equivalence:Aw})};function ZO8(X){return k8(j3(X),KC0(l8(qX(X))),{strict:!0,decode:(J)=>CN(J),encode:(J)=>G9(J)})}var h00=(X)=>Array.isArray(X)?pn(X):IF(X),QO8=(X)=>(J)=>X(J).map(h00),YO8=(X)=>(J)=>`Data(${X(J)})`,vP0=(X)=>(J,Z,Q)=>b2(J)?HQ(X(J,Z),h00,Q,J):h6(new a8(Q,J)),BC0=(X)=>{return X6([X],{decode:(J)=>vP0(W7(J)),encode:(J)=>vP0(I7(J))},{description:`Data<${dX(X)}>`,pretty:YO8,arbitrary:QO8})},GO8=(X)=>{return k8(X,BC0(l8(X)),{strict:!1,decode:(J)=>h00(J),encode:(J)=>Array.isArray(J)?Array.from(J):Object.assign({},J)})},KO8=(X)=>eX(X)||gb(X),HC0=(X)=>Reflect.ownKeys(X).every((J)=>KO8(X[J])),m00=(X)=>("fields"in X)?X.fields:m00(X[W00]),nb=(X)=>HC0(X)?$0(X):eX(X)?X:$0(m00(X)),ib=(X)=>HC0(X)?X:m00(X),D9=(X)=>(J,Z)=>iU({kind:"Class",identifier:X,schema:nb(J),fields:ib(J),Base:EF,annotations:Z}),ob=(X)=>bW(Hq(s0(X)),()=>X),BO8=(X)=>(J,Z,Q)=>{let Y=ib(Z),G=nb(Z),K={_tag:ob(J)},B=Wq(K,Y);return class extends iU({kind:"TaggedClass",identifier:X??J,schema:NM(G,$0(K)),fields:B,Base:EF,annotations:Q}){static _tag=J}},WQ=(X)=>(J,Z,Q)=>{class Y extends mO{}Y.prototype.name=J;let G=ib(Z),K=nb(Z),B={_tag:ob(J)},H=Wq(B,G),W="message"in H;class V extends iU({kind:"TaggedError",identifier:X??J,schema:NM(K,$0(B)),fields:H,Base:Y,annotations:Q,disableToString:!0}){static _tag=J}if(!W)Object.defineProperty(V.prototype,"message",{get(){return`{ ${Reflect.ownKeys(G).map((U)=>`${wK(U)}: ${E6(this[U])}`).join(", ")} }`},enumerable:!1,configurable:!0});return V},Wq=(X,J)=>{let Z={...X};for(let Q of Reflect.ownKeys(J)){if(Q in X)throw Error(Fx(Q));Z[Q]=J[Q]}return Z};function rb(X){return yJ(X)?X:X?.disableValidation??!1}var kP0=c0("effect/Schema/astCache",()=>new WeakMap),HO8=(X)=>{if(X===void 0)return[];else if(Array.isArray(X))return X;else return[X]},iU=({Base:X,annotations:J,disableToString:Z,fields:Q,identifier:Y,kind:G,schema:K})=>{let B=Symbol.for(`effect/Schema/${G}/${Y}`),[H,W,V]=HO8(J),U=l8(K),O=U.annotations({identifier:Y,...H}),q=U.annotations({[o1]:`${Y} (Type side)`,...H}),L=K.annotations({[o1]:`${Y} (Constructor)`,...H}),A=K.annotations({[o1]:`${Y} (Encoded side)`,...V}),M=K.annotations({...V,...H,...W}),x=(T)=>V0(T,B)&&XW(q)(T),j=class extends X{constructor(T={},E=!1){if(T={...T},G!=="Class")delete T._tag;if(T=GR0(Q,T),!rb(E))T=RU(L)(T);super(T,!0)}static[gW]=Le;static get ast(){let T=kP0.get(this);if(T)return T;let E=X6([K],{decode:()=>(k,P,C)=>k instanceof this||x(k)?YX(k):h6(new a8(C,k)),encode:()=>(k,P)=>k instanceof this?YX(k):XZ(I7(q)(k,P),(C)=>new this(C,!0))},{identifier:Y,pretty:(k)=>(P)=>`${Y}(${k(P)})`,arbitrary:(k)=>(P)=>k(P).map((C)=>new this(C)),equivalence:t,[UA]:O.ast,...H});return T=k8(A,E,{strict:!0,decode:(k)=>new this(k,!0),encode:t}).annotations({[UA]:M.ast,...W}).ast,kP0.set(this,T),T}static pipe(){return K0(this,arguments)}static annotations(T){return t8(this.ast).annotations(T)}static toString(){return`(${String(A)} <-> ${Y})`}static make(...T){return new this(...T)}static fields={...Q};static identifier=Y;static extend(T){return(E,k)=>{let P=ib(E),C=nb(E),v=Wq(Q,P);return iU({kind:G,identifier:T,schema:NM(K,C),fields:v,Base:this,annotations:k})}}static transformOrFail(T){return(E,k,P)=>{let C=Wq(Q,E);return iU({kind:G,identifier:T,schema:d6(K,l8($0(C)),k),fields:C,Base:this,annotations:P})}}static transformOrFailFrom(T){return(E,k,P)=>{let C=Wq(Q,E);return iU({kind:G,identifier:T,schema:d6(Sb(K),$0(C),k),fields:C,Base:this,annotations:P})}}get[B](){return B}};if(Z!==!0)Object.defineProperty(j.prototype,"toString",{value(){return`${Y}({ ${Reflect.ownKeys(Q).map((T)=>`${wK(T)}: ${E6(this[T])}`).join(", ")} })`},configurable:!0,writable:!0});return j},WO8=$0({_tag:s0("None")}).annotations({identifier:"FiberIdNoneEncoded"}),VO8=$0({_tag:s0("Runtime"),id:F5,startTimeMillis:F5}).annotations({identifier:"FiberIdRuntimeEncoded"}),$O8=$0({_tag:s0("Composite"),left:Mb(()=>Rb),right:Mb(()=>Rb)}).annotations({identifier:"FiberIdCompositeEncoded"}),Rb=U8(WO8,VO8,$O8).annotations({identifier:"FiberIdEncoded"}),WC0=(X)=>X.letrec((J)=>({None:X.record({_tag:X.constant("None")}),Runtime:X.record({_tag:X.constant("Runtime"),id:X.integer(),startTimeMillis:X.integer()}),Composite:X.record({_tag:X.constant("Composite"),left:J("FiberId"),right:J("FiberId")}),FiberId:X.oneof(J("None"),J("Runtime"),J("Composite"))})).FiberId.map(VM),jb=(X)=>{switch(X._tag){case"None":return"FiberId.none";case"Runtime":return`FiberId.runtime(${X.id}, ${X.startTimeMillis})`;case"Composite":return`FiberId.composite(${jb(X.right)}, ${jb(X.left)})`}};class d00 extends X6(V40,{typeConstructor:{_tag:"effect/FiberId"},identifier:"FiberIdFromSelf",pretty:()=>jb,arbitrary:()=>WC0}){}var VM=(X)=>{switch(X._tag){case"None":return d7;case"Runtime":return H40(X.id,X.startTimeMillis);case"Composite":return W40(VM(X.left),VM(X.right))}},J00=(X)=>{switch(X._tag){case"None":return{_tag:"None"};case"Runtime":return{_tag:"Runtime",id:X.id,startTimeMillis:X.startTimeMillis};case"Composite":return{_tag:"Composite",left:J00(X.left),right:J00(X.right)}}};class VC0 extends k8(Rb,d00,{strict:!0,decode:(X)=>VM(X),encode:(X)=>J00(X)}).annotations({identifier:"FiberId"}){}var UO8=(X)=>$0({_tag:s0("Die"),defect:X}),zO8=$0({_tag:s0("Empty")}),NO8=(X)=>$0({_tag:s0("Fail"),error:X}),OO8=$0({_tag:s0("Interrupt"),fiberId:Rb}),_O8=0,Cb=(X,J)=>{let Z=qX(X),Q=qX(J),Y=Mb(()=>G),G=U8(zO8,NO8(Z),UO8(Q),OO8,$0({_tag:s0("Sequential"),left:Y,right:Y}),$0({_tag:s0("Parallel"),left:Y,right:Y})).annotations({title:`CauseEncoded<${dX(X)}>`,[jx]:`CauseEncoded${_O8++}`});return G},$C0=(X,J)=>(Z)=>Z.letrec((Q)=>({Empty:Z.record({_tag:Z.constant("Empty")}),Fail:Z.record({_tag:Z.constant("Fail"),error:X(Z)}),Die:Z.record({_tag:Z.constant("Die"),defect:J(Z)}),Interrupt:Z.record({_tag:Z.constant("Interrupt"),fiberId:WC0(Z)}),Sequential:Z.record({_tag:Z.constant("Sequential"),left:Q("Cause"),right:Q("Cause")}),Parallel:Z.record({_tag:Z.constant("Parallel"),left:Q("Cause"),right:Q("Cause")}),Cause:Z.oneof(Q("Empty"),Q("Fail"),Q("Die"),Q("Interrupt"),Q("Sequential"),Q("Parallel"))})).Cause.map(yW),UC0=(X)=>(J)=>{let Z=(Q)=>{switch(Q._tag){case"Empty":return"Cause.empty";case"Fail":return`Cause.fail(${X(Q.error)})`;case"Die":return`Cause.die(${CO(Q)})`;case"Interrupt":return`Cause.interrupt(${jb(Q.fiberId)})`;case"Sequential":return`Cause.sequential(${Z(Q.left)}, ${Z(Q.right)})`;case"Parallel":return`Cause.parallel(${Z(Q.left)}, ${Z(Q.right)})`}};return Z(J)},bP0=(X)=>(J,Z,Q)=>Yn(J)?HQ(X(Bq(J),Z),yW,Q,J):h6(new a8(Q,J)),Ib=({defect:X,error:J})=>{return X6([J,X],{decode:(Z,Q)=>bP0(W7(Cb(Z,Q))),encode:(Z,Q)=>bP0(I7(Cb(Z,Q)))},{typeConstructor:{_tag:"effect/Cause"},title:`Cause<${J.ast}>`,pretty:UC0,arbitrary:$C0})};function yW(X){switch(X._tag){case"Empty":return UF;case"Fail":return N4(X.error);case"Die":return oJ(X.defect);case"Interrupt":return R1(VM(X.fiberId));case"Sequential":return Qn(yW(X.left),yW(X.right));case"Parallel":return Zn(yW(X.left),yW(X.right))}}function Bq(X){switch(X._tag){case"Empty":return{_tag:"Empty"};case"Fail":return{_tag:"Fail",error:X.error};case"Die":return{_tag:"Die",defect:X.defect};case"Interrupt":return{_tag:"Interrupt",fiberId:X.fiberId};case"Sequential":return{_tag:"Sequential",left:Bq(X.left),right:Bq(X.right)};case"Parallel":return{_tag:"Parallel",left:Bq(X.left),right:Bq(X.right)}}}var u00=({defect:X,error:J})=>{let Z=qX(J),Q=qX(X);return k8(Cb(Z,Q),Ib({error:l8(Z),defect:l8(Q)}),{strict:!1,decode:(G)=>yW(G),encode:(G)=>Bq(G)})};class e6 extends k8(A6,A6,{strict:!0,decode:(X)=>{if(c6(X)&&"message"in X&&typeof X.message==="string"){let J=Error(X.message,{cause:X});if("name"in X&&typeof X.name==="string")J.name=X.name;return J.stack="stack"in X&&typeof X.stack==="string"?X.stack:"",J}return tC(X)},encode:(X)=>{if(X instanceof Error)return{name:X.name,message:X.message};return tC(X)}}).annotations({identifier:"Defect"}){}var qO8=(X,J)=>$0({_tag:s0("Failure"),cause:Cb(X,J)}),DO8=(X)=>$0({_tag:s0("Success"),value:X}),wO8=(X,J,Z)=>{return U8(qO8(J,Z),DO8(X)).annotations({title:`ExitEncoded<${dX(X)}, ${dX(J)}, ${dX(Z)}>`})},zC0=(X)=>{switch(X._tag){case"Failure":return _9(yW(X.cause));case"Success":return v8(X.value)}},LO8=(X,J,Z)=>(Q)=>Q.oneof(Q.record({_tag:Q.constant("Failure"),cause:$C0(J,Z)(Q)}),Q.record({_tag:Q.constant("Success"),value:X(Q)})).map(zC0),FO8=(X,J)=>(Z)=>Z._tag==="Failure"?`Exit.failCause(${UC0(J)(Z.cause)})`:`Exit.succeed(${X(Z.value)})`,yP0=(X,J)=>(Z,Q,Y)=>nL(Z)?rX(Z,{onFailure:(G)=>HQ(J(G,Q),_9,Y,Z),onSuccess:(G)=>HQ(X(G,Q),v8,Y,Z)}):h6(new a8(Y,Z)),NC0=({defect:X,failure:J,success:Z})=>X6([Z,J,X],{decode:(Q,Y,G)=>yP0(W7(Q),W7(Ib({error:Y,defect:G}))),encode:(Q,Y,G)=>yP0(I7(Q),I7(Ib({error:Y,defect:G})))},{typeConstructor:{_tag:"effect/Exit"},title:`Exit<${Z.ast}, ${J.ast}>`,pretty:FO8,arbitrary:LO8}),$M=({defect:X,failure:J,success:Z})=>{let Q=qX(Z),Y=qX(J),G=qX(X);return k8(wO8(Q,Y,G),NC0({failure:l8(Y),success:l8(Q),defect:l8(G)}),{strict:!1,decode:(B)=>zC0(B),encode:(B)=>B._tag==="Failure"?{_tag:"Failure",cause:B.cause}:{_tag:"Success",value:B.value}})},AO8=(X,J)=>(Z)=>{let Q=Z.array(X(Z));return(J.depthIdentifier!==void 0?Z.oneof(J,Z.constant([]),Q):Q).map(X4)},TO8=(X)=>(J)=>`HashSet(${Array.from(J).map((Z)=>X(Z)).join(", ")})`,MO8=(X)=>{let J=dJ(X);return I6((Z,Q)=>J(Array.from(Z),Array.from(Q)))},gP0=(X)=>(J,Z,Q)=>t50(J)?HQ(X(Array.from(J),Z),X4,Q,J):h6(new a8(Q,J)),OC0=(X)=>{return X6([X],{decode:(J)=>gP0(W7(K8(J))),encode:(J)=>gP0(I7(K8(J)))},{typeConstructor:{_tag:"effect/HashSet"},description:`HashSet<${dX(X)}>`,pretty:TO8,arbitrary:AO8,equivalence:MO8})};function PO8(X){return k8(K8(X),OC0(l8(qX(X))),{strict:!0,decode:(J)=>X4(J),encode:(J)=>Array.from(J)})}var RO8=(X,J,Z)=>(Q)=>{let Y=Q.array(Q.tuple(X(Q),J(Q)));return(Z.depthIdentifier!==void 0?Q.oneof(Z,Q.constant([]),Y):Y).map(J4)},jO8=(X,J)=>(Z)=>`HashMap([${Array.from(Z).map(([Q,Y])=>`[${X(Q)}, ${J(Y)}]`).join(", ")}])`,CO8=(X,J)=>{let Z=dJ(I6(([Q,Y],[G,K])=>X(Q,G)&&J(Y,K)));return I6((Q,Y)=>Z(Array.from(Q),Array.from(Y)))},hP0=(X)=>(J,Z,Q)=>z40(J)?HQ(X(Array.from(J),Z),J4,Q,J):h6(new a8(Q,J)),_C0=({key:X,value:J})=>{return X6([X,J],{decode:(Z,Q)=>hP0(W7(K8(bZ(Z,Q)))),encode:(Z,Q)=>hP0(I7(K8(bZ(Z,Q))))},{typeConstructor:{_tag:"effect/HashMap"},description:`HashMap<${dX(X)}, ${dX(J)}>`,pretty:jO8,arbitrary:RO8,equivalence:CO8})},IO8=({key:X,value:J})=>{return k8(K8(bZ(X,J)),_C0({key:l8(qX(X)),value:l8(qX(J))}),{strict:!0,decode:(Z)=>J4(Z),encode:(Z)=>Array.from(Z)})},EO8=(X,J)=>(Z)=>{let Q=Z.array(X(Z));return(J.depthIdentifier!==void 0?Z.oneof(J,Z.constant([]),Q):Q).map(xC)},SO8=(X)=>(J)=>`List(${Array.from(J).map((Z)=>X(Z)).join(", ")})`,xO8=(X)=>{let J=dJ(X);return I6((Z,Q)=>J(Array.from(Z),Array.from(Q)))},mP0=(X)=>(J,Z,Q)=>SC(J)?HQ(X(Array.from(J),Z),xC,Q,J):h6(new a8(Q,J)),qC0=(X)=>{return X6([X],{decode:(J)=>mP0(W7(K8(J))),encode:(J)=>mP0(I7(K8(J)))},{typeConstructor:{_tag:"effect/List"},description:`List<${dX(X)}>`,pretty:SO8,arbitrary:EO8,equivalence:xO8})};function vO8(X){return k8(K8(X),qC0(l8(qX(X))),{strict:!0,decode:(J)=>xC(J),encode:(J)=>Array.from(J)})}var kO8=(X,J,Z)=>(Q)=>{let Y=Q.array(X(Q));return(Z.depthIdentifier!==void 0?Q.oneof(Z,Q.constant([]),Y):Y).map((G)=>lE(G,J))},bO8=(X)=>(J)=>`new SortedSet([${Array.from(nE(J)).map((Z)=>X(Z)).join(", ")}])`,dP0=(X,J)=>(Z,Q,Y)=>ml(Z)?HQ(X(Array.from(nE(Z)),Q),(G)=>lE(G,J),Y,Z):h6(new a8(Y,Z)),DC0=(X,J,Z)=>{return X6([X],{decode:(Q)=>dP0(W7(K8(Q)),J),encode:(Q)=>dP0(I7(K8(Q)),Z)},{typeConstructor:{_tag:"effect/SortedSet"},description:`SortedSet<${dX(X)}>`,pretty:bO8,arbitrary:(Q,Y)=>kO8(Q,J,Y),equivalence:()=>k10()})};function yO8(X,J){let Z=l8(qX(X));return k8(K8(X),DC0(Z,J,J),{strict:!0,decode:(Q)=>lE(Q,J),encode:(Q)=>Array.from(nE(Q))})}class wC0 extends k8(A6,q8,{strict:!0,decode:(X)=>bQ0(X),encode:t}).annotations({identifier:"BooleanFromUnknown"}){}class LC0 extends k8(s0("true","false").annotations({description:"a string to be decoded into a boolean"}),q8,{strict:!0,decode:(X)=>X==="true",encode:(X)=>X?"true":"false"}).annotations({identifier:"BooleanFromString"}){}var gO8=(X,J)=>{let Z=uo(J);return bt(X).pipe(kt((Q)=>Z(Q).pipe(eQ((Y)=>fY0([],D5.formatIssueSync(Y))))))},LM=Symbol.for("effect/Schema/Serializable/symbol"),hO8=(X)=>X,mO8=(X)=>X[LM],dO8=(X)=>A5(X[LM])(X),uO8=$(2,(X,J)=>t9(X[LM])(J)),mH=Symbol.for("effect/Schema/Serializable/symbolResult"),cO8=(X)=>X,Z00=(X)=>X[mH].failure,Eb=(X)=>X[mH].success,uP0=c0("effect/Schema/Serializable/exitSchemaCache",()=>new WeakMap),c00=(X)=>{let J=Object.getPrototypeOf(X);if(!(mH in J))return $M({failure:Z00(X),success:Eb(X),defect:e6});let Z=uP0.get(J);if(Z===void 0)Z=$M({failure:Z00(X),success:Eb(X),defect:e6}),uP0.set(J,Z);return Z},fO8=$(2,(X,J)=>E3(X[mH].failure)(J)),pO8=$(2,(X,J)=>t9(X[mH].failure)(J)),lO8=$(2,(X,J)=>E3(X[mH].success)(J)),nO8=$(2,(X,J)=>t9(X[mH].success)(J)),iO8=$(2,(X,J)=>E3(c00(X))(J)),oO8=$(2,(X,J)=>t9(c00(X))(J)),rO8=(X)=>X,aO8=(X)=>(J,Z,Q)=>{let Y=Wq({_tag:ob(J)},Z.payload);return class extends iU({kind:"TaggedRequest",identifier:X??J,schema:$0(Y),fields:Y,Base:YN0,annotations:Q}){static _tag=J;static success=Z.success;static failure=Z.failure;get[LM](){return this.constructor}get[mH](){return{failure:Z.failure,success:Z.success}}}},sO8=(X)=>rG(X.ast,[]),tO8=C7(Rx),rG=(X,J)=>{let Z=tO8(X);if(R0(Z))switch(X._tag){case"Declaration":return Z.value(...X.typeParameters.map((Q)=>rG(Q,J)));case"Refinement":return Z.value(rG(X.from,J));default:return Z.value()}switch(X._tag){case"NeverKeyword":throw Error(wN0(X,J));case"Transformation":return rG(X.to,J);case"Declaration":case"Literal":case"StringKeyword":case"TemplateLiteral":case"UniqueSymbol":case"SymbolKeyword":case"UnknownKeyword":case"AnyKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"UndefinedKeyword":case"VoidKeyword":case"Enums":case"ObjectKeyword":return _0;case"Refinement":return rG(X.from,J);case"Suspend":{let Q=X_(()=>rG(X.f(),J));return(Y,G)=>Q()(Y,G)}case"TupleType":{let Q=X.elements.map((G,K)=>rG(G.type,J.concat(K))),Y=X.rest.map((G)=>rG(G.type,J));return I6((G,K)=>{if(!Array.isArray(G)||!Array.isArray(K))return!1;let B=G.length;if(B!==K.length)return!1;let H=0;for(;H<Math.min(B,X.elements.length);H++)if(!Q[H](G[H],K[H]))return!1;if(B8(Y)){let[W,...V]=Y;for(;H<B-V.length;H++)if(!W(G[H],K[H]))return!1;for(let U=0;U<V.length;U++)if(H+=U,!V[U](G[H],K[H]))return!1}return!0})}case"TypeLiteral":{if(X.propertySignatures.length===0&&X.indexSignatures.length===0)return _0;let Q=X.propertySignatures.map((G)=>rG(G.type,J.concat(G.name))),Y=X.indexSignatures.map((G)=>rG(G.type,J));return I6((G,K)=>{if(!l5(G)||!l5(K))return!1;let B=Object.keys(G),H=Object.getOwnPropertySymbols(G);for(let U=0;U<Q.length;U++){let O=X.propertySignatures[U],q=O.name,L=Object.prototype.hasOwnProperty.call(G,q),A=Object.prototype.hasOwnProperty.call(K,q);if(O.isOptional){if(L!==A)return!1}if(L&&A&&!Q[U](G[q],K[q]))return!1}let W,V;for(let U=0;U<Y.length;U++){let O=X.indexSignatures[U],q=BH(O.parameter),L=Ix(q);if(L){if(W=W||Object.getOwnPropertySymbols(K),H.length!==W.length)return!1}else if(V=V||Object.keys(K),B.length!==V.length)return!1;let A=L?H:B;for(let M=0;M<A.length;M++){let x=A[M];if(!Object.prototype.hasOwnProperty.call(K,x)||!Y[U](G[x],K[x]))return!1}}return!0})}case"Union":{let Q=po(X.types,!0),Y=Reflect.ownKeys(Q.keys),G=Y.length;return I6((K,B)=>{let H=[];if(G>0&&KN(K))for(let V=0;V<G;V++){let U=Y[V],O=Q.keys[U].buckets;if(Object.prototype.hasOwnProperty.call(K,U)){let q=String(K[U]);if(Object.prototype.hasOwnProperty.call(O,q))H=H.concat(O[q])}}if(Q.otherwise.length>0)H=H.concat(Q.otherwise);let W=H.map((V)=>[rG(V,J),XW({ast:V})]);for(let V=0;V<W.length;V++){let[U,O]=W[V];if(O(K)&&O(B)){if(U(K,B))return!0}}return!1})}}},cP0=zM("symbol",{key:d}).annotations({description:"an object to be decoded into a globally shared symbol"}),eO8=d6(cP0,bb,{strict:!0,decode:(X)=>Hj0(X.key),encode:(X,J,Z)=>XZ(Bj0(X,Z),(Q)=>cP0.make({key:Q}))});class f00 extends U8(d,L8,eO8).annotations({identifier:"PropertyKey"}){}class FC0 extends $0({_tag:Hq(s0("Pointer","Unexpected","Missing","Composite","Refinement","Transformation","Type","Forbidden")).annotations({description:"The tag identifying the type of parse issue"}),path:Hq(K8(f00)).annotations({description:"The path to the property where the issue occurred"}),message:Hq(d).annotations({description:"A descriptive message explaining the issue"})}).annotations({identifier:"ArrayFormatterIssue",description:"Represents an issue returned by the ArrayFormatter formatter"}){}var $q=Symbol.for("@effect/platform/Error"),X_8=(X)=>V0(X,$q),Uq=(X,J)=>{class Z extends mO{_tag=J}return Z.prototype[X]=X,Z.prototype.name=J,Z},p00=s0("Clipboard","Command","FileSystem","KeyValueStore","Path","Stream","Terminal");class yZ extends WQ("@effect/platform/Error/BadArgument")("BadArgument",{module:p00,method:d,description:u0(d),cause:u0(e6)}){[$q]=$q;get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:""}`}}var AC0=s0("AlreadyExists","BadResource","Busy","InvalidData","NotFound","PermissionDenied","TimedOut","UnexpectedEof","Unknown","WouldBlock","WriteZero");class VQ extends WQ("@effect/platform/Error/SystemError")("SystemError",{reason:AC0,module:p00,method:d,description:u0(d),syscall:u0(d),pathOrDescriptor:u0(U8(d,L8)),cause:u0(e6)}){[$q]=$q;get message(){return`${this.reason}: ${this.module}.${this.method}${this.pathOrDescriptor!==void 0?` (${this.pathOrDescriptor})`:""}${this.description?`: ${this.description}`:""}`}}var J_8=U8(yZ,VQ);var ab=g8("@effect/platform/FileSystem"),x3=(X)=>typeof X==="bigint"?X:BigInt(X),TC0=(X)=>x3(X*1024),MC0=(X)=>x3(X*1024*1024),PC0=(X)=>x3(X*1024*1024*1024),RC0=(X)=>x3(X*1024*1024*1024*1024),FM=BigInt(1024),Z_8=FM*FM*FM*FM*FM,jC0=(X)=>x3(BigInt(X)*Z_8),CC0=(X)=>{return ab.of({...X,exists:(J)=>z(X.access(J),y9(!0),QQ("SystemError",(Z)=>Z.reason==="NotFound"?y(!1):Y0(Z))),readFileString:(J,Z)=>JH(X.readFile(J),{try:(Q)=>new TextDecoder(Z).decode(Q),catch:(Q)=>new yZ({module:"FileSystem",method:"readFileString",description:"invalid encoding",cause:Q})}),stream:(J,Z)=>z(X.open(J,{flag:"r"}),Z?.offset?J9((Q)=>Q.seek(Z.offset,"start")):t,u((Q)=>Q_8(Q,Z)),lG),sink:(J,Z)=>z(X.open(J,{flag:"w",...Z}),u((Q)=>rA0((Y)=>Q.writeAll(Y))),sA0),writeFileString:(J,Z,Q)=>h(HJ({try:()=>new TextEncoder().encode(Z),catch:(Y)=>new yZ({module:"FileSystem",method:"writeFileString",description:"could not encode string",cause:Y})}),(Y)=>X.writeFile(J,Y,Q))})},v7=(X,J)=>new VQ({module:"FileSystem",method:X,reason:"NotFound",description:"No such file or directory",pathOrDescriptor:J}),l00=(X)=>{return{access(J){return Y0(v7("access",J))},chmod(J){return Y0(v7("chmod",J))},chown(J){return Y0(v7("chown",J))},copy(J){return Y0(v7("copy",J))},copyFile(J){return Y0(v7("copyFile",J))},exists(){return y(!1)},link(J){return Y0(v7("link",J))},makeDirectory(){return P7("not implemented")},makeTempDirectory(){return P7("not implemented")},makeTempDirectoryScoped(){return P7("not implemented")},makeTempFile(){return P7("not implemented")},makeTempFileScoped(){return P7("not implemented")},open(J){return Y0(v7("open",J))},readDirectory(J){return Y0(v7("readDirectory",J))},readFile(J){return Y0(v7("readFile",J))},readFileString(J){return Y0(v7("readFileString",J))},readLink(J){return Y0(v7("readLink",J))},realPath(J){return Y0(v7("realPath",J))},remove(){return U0},rename(J){return Y0(v7("rename",J))},sink(J){return iA0(v7("sink",J))},stat(J){return Y0(v7("stat",J))},stream(J){return Xq(v7("stream",J))},symlink(J){return Y0(v7("symlink",J))},truncate(J){return Y0(v7("truncate",J))},utimes(J){return Y0(v7("utimes",J))},watch(J){return Xq(v7("watch",J))},writeFile(J){return Y0(v7("writeFile",J))},writeFileString(J){return Y0(v7("writeFileString",J))},...X}},IC0=(X)=>E7(ab,l00(X)),Q_8=(X,{bufferSize:J=16,bytesToRead:Z,chunkSize:Q=x3(65536)}={})=>{let Y=Z!==void 0?x3(Z):void 0,G=x3(Q);function K(B){if(Y!==void 0&&Y<=B)return e_;let H=Y!==void 0&&Y-B<G?Y-B:G;return EW(X.readAlloc(H),w0({onNone:()=>e_,onSome:(W)=>EW(ak(m0(W)),(V)=>K(B+BigInt(W.length)))}))}return Vt(fU(K(BigInt(0))),{capacity:J})};var sU=x3,G_8=TC0,K_8=MC0,B_8=PC0,H_8=RC0,W_8=jC0,$Q=ab,n00=CC0,V_8=l00,$_8=IC0,zq=Symbol.for("@effect/platform/FileSystem/File"),U_8=(X)=>typeof X==="object"&&X!==null&&(zq in X),i00=IA(),o00=h1("Create"),r00=h1("Update"),a00=h1("Remove");class sb extends m7("@effect/platform/FileSystem/WatchBackend")(){}var aE0=EQ0(kC0(),1),V90=EQ0(dC0(),1);var jM8=s80(),CM8=hM(),IM8=b80(),W90=mM(),EM8=MM(),sW=KX(),SM8=nW(),xM8=VJ(),vM8=oW(),kM8=rW(),NQ9=gy(),bM8=K90(),yM8=B90(),gM8=H90(),uy=oE0(),rE0=AM();var mM8=jM8.Composer,dM8=CM8.Document,uM8=IM8.Schema,cM8=W90.YAMLError,fM8=W90.YAMLParseError,pM8=W90.YAMLWarning,lM8=EM8.Alias,nM8=sW.isAlias,iM8=sW.isCollection,oM8=sW.isDocument,rM8=sW.isMap,aM8=sW.isNode,sM8=sW.isPair,tM8=sW.isScalar,eM8=sW.isSeq,XP8=SM8.Pair,JP8=xM8.Scalar,ZP8=vM8.YAMLMap,QP8=kM8.YAMLSeq;var YP8=bM8.Lexer,GP8=yM8.LineCounter,KP8=gM8.Parser,cy=uy.parse,BP8=uy.parseAllDocuments,HP8=uy.parseDocument,WP8=uy.stringify,VP8=rE0.visit,$P8=rE0.visitAsync;var UP8={json:(X)=>JSON.parse(X),yaml:(X)=>cy(X),yml:(X)=>cy(X),ini:(X)=>aE0.parse(X),toml:(X)=>V90.parse(X),tml:(X)=>V90.parse(X)},fy=(X)=>h($Q,(J)=>q9(J.readFile(X),{onFailure:(Z)=>Y0(`Could not read file (${X}): ${Z}`),onSuccess:(Z)=>y([X,Z])})),py=(X)=>h($Q,(J)=>q9(J.readFileString(X),{onFailure:(Z)=>Y0(`Could not read file (${X}): ${Z}`),onSuccess:(Z)=>y([X,Z])})),ly=(X,J,Z)=>{let Q=UP8[Z??X.split(".").pop()];if(Q===void 0)return Y0(`Unsupported file format: ${Z}`);return HJ({try:()=>Q(J),catch:(Y)=>`Could not parse ${Z} file (${X}): ${Y}`})};function tE0(X,J){return function(Z){if(Array.isArray(Z))return Z.reduce(J,X);let Q=X;for(let Y of Z)Q=J(Q,Y);return Q}}function eE0(X){return function(J){if(Array.isArray(J))return J.map(X);return function*(){for(let Z of J)yield X(Z)}()}}var XS0=(X)=>(J)=>{let Z=Object.keys(J);return X.imap(X.productAll(Z.map((Q)=>J[Q])),(Q)=>{let Y={};for(let G=0;G<Q.length;G++)Y[Z[G]]=Q[G];return Y},(Q)=>Z.map((Y)=>Q[Y]))};var fH=(X,J=(Z,Q)=>tE0(Z,X)(Q))=>({combine:X,combineMany:J});var NP8=(X)=>fH(()=>X,()=>X);var JS0=()=>fH((X)=>X,(X)=>X);var OP8=$(3,(X,J,Z)=>fH((Q,Y)=>J(X.combine(Z(Q),Z(Y))),(Q,Y)=>J(X.combineMany(Z(Q),eE0(Z)(Y)))));var _P8=(X,J)=>fH(([Z,Q],[Y,G])=>[X.combine(Z,Y),J.combine(Q,G)]),ZS0=(X)=>{return fH((J,Z)=>{let Q=Math.min(J.length,Z.length),Y=[],G=0;for(let K of X){if(G>=Q)break;Y.push(K.combine(J[G],Z[G])),G++}return Y})},qP8=(X,J)=>{let Z=ZS0(J);return fH((Q,Y)=>[X.combine(Q[0],Y[0]),...Z.combine(Q.slice(1),Y.slice(1))])};var DP8=NP8,wP8={of:DP8,imap:OP8,product:_P8,productMany:qP8,productAll:ZS0};var ny=()=>fH((X,J)=>X.concat(J)),iy=XS0(wP8);var lM=(X,J)=>({combine:X.combine,combineMany:X.combineMany,empty:J,combineAll:(Z)=>X.combineMany(J,Z)});var YS0=()=>lM(ny(),[]),GS0=(X)=>{let J={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))J[Z]=X[Z].empty;return lM(iy(X),J)};var oy={_tag:"Black"},ry={_tag:"Red"},$90={_tag:"Green"};var U90={_tag:"Magenta"},ay={_tag:"Cyan"},sy={_tag:"White"},Pq=(X)=>{switch(X._tag){case"Black":return 0;case"Red":return 1;case"Green":return 2;case"Yellow":return 3;case"Blue":return 4;case"Magenta":return 5;case"Cyan":return 6;case"White":return 7}};var KS0={_tag:"Reset"},BS0=(X)=>({_tag:"SetBold",bold:X}),N90=(X,J,Z)=>({_tag:"SetColor",color:X,vivid:J,layer:Z}),HS0=(X)=>({_tag:"SetItalicized",italicized:X}),WS0=(X)=>({_tag:"SetStrikethrough",strikethrough:X}),VS0=(X)=>({_tag:"SetUnderlined",underlined:X}),FP8=(X)=>{switch(X._tag){case"Reset":return 0;case"SetBold":return X.bold?1:22;case"SetColor":switch(X.layer){case"foreground":return X.vivid?90+Pq(X.color):30+Pq(X.color);case"background":return X.vivid?100+Pq(X.color):40+Pq(X.color)}case"SetItalicized":return X.italicized?3:23;case"SetStrikethrough":return X.strikethrough?9:29;case"SetUnderlined":return X.underlined?4:24}},$S0=(X)=>AP8("m",X),AP8=(X,J)=>{return`\x1B[${Array.from(J).map((Q)=>`${FP8(Q)}`).join(";")}${X}`};var RP8="@effect/printer-ansi/Ansi",ty=Symbol.for(RP8),U7=(X)=>({...zS0.empty,...X}),US0=JS0(),Gz=fH((X,J)=>R0(X)?X:J),jP8=iy({[ty]:US0,commands:ny(),foreground:Gz,background:Gz,bold:Gz,italicized:Gz,strikethrough:Gz,underlined:Gz}),CP8=lM(US0,ty),Rq=lM(Gz,S()),zS0=GS0({[ty]:CP8,commands:YS0(),foreground:Rq,background:Rq,bold:Rq,italicized:Rq,strikethrough:Rq,underlined:Rq}),NS0=zS0.empty,o7="\x1B[",IP8="\x07",EP8=";",OS0=U7({bold:I(BS0(!0))}),_S0=U7({italicized:I(HS0(!0))}),qS0=U7({strikethrough:I(WS0(!0))}),DS0=U7({underlined:I(VS0(!0))}),O90=(X)=>U7({foreground:I(N90(X,!0,"foreground"))}),jq=(X)=>U7({foreground:I(N90(X,!1,"foreground"))});var wS0=jq(oy),LS0=jq(ry),FS0=jq($90);var AS0=jq(sy),TS0=O90(oy);var MS0=O90(ay);var _90=U7({commands:X8(IP8)}),q90=(X,J)=>{if(J===void 0){let Q=`${o7}${Math.max(X+1,0)}G`;return U7({commands:X8(Q)})}let Z=`${o7}${J+1}${EP8}${Math.max(X+1,0)}H`;return U7({commands:X8(Z)})},D90=(X,J=0)=>{let Z="";if(J<0)Z+=`${o7}${-J}A`;if(J>0)Z+=`${o7}${J}B`;if(X>0)Z+=`${o7}${X}C`;if(X<0)Z+=`${o7}${-X}D`;return U7({commands:X8(Z)})};var w90=(X=1)=>{let J=`${o7}${X}B`;return U7({commands:X8(J)})};var L90=U7({commands:X8(`${o7}G`)}),F90=U7({commands:X8(`${o7}s`)}),A90=U7({commands:X8(`${o7}u`)});var T90=U7({commands:X8(`${o7}?25l`)}),M90=U7({commands:X8(`${o7}?25h`)}),P90=(X)=>{let J="";for(let Z=0;Z<X;Z++)J+=`${o7}2K`+(Z<X-1?`${o7}1A`:"");if(X>0)J+=`${o7}G`;return U7({commands:X8(J)})},PS0=U7({commands:X8(`${o7}K`)}),RS0=U7({commands:X8(`${o7}1K`)}),R90=U7({commands:X8(`${o7}2K`)}),jS0=U7({commands:X8(`${o7}J`)}),CS0=U7({commands:X8(`${o7}1J`)}),IS0=U7({commands:X8(`${o7}2J`)}),ey=(X)=>xP8(X),Xg=$(2,(X,J)=>SP8(X,J)),SP8=(X,J)=>jP8.combine(X,J),xP8=(X)=>{let J=$S0(SK([I(KS0),X.foreground,X.background,X.bold,X.italicized,X.strikethrough,X.underlined])),Z=s8(X.commands,"");return`${J}${Z}`};var k7=OS0,tW=_S0,ES0=qS0,uQ=DS0,SS0=jq;var xS0=wS0,jY=LS0,gZ=FS0;var b3=AS0,e9=TS0;var T6=MS0;var $J=Xg;var Jg="@effect/printer/Flatten",vS0=Symbol.for(Jg),hP8={Flattened:(X)=>A0(Z0(X.value))(R8(Jg)),AlreadyFlat:(X)=>A0(R8("@effect/printer/Flattened/AlreadyFlat"))(R8(Jg)),NeverFlat:(X)=>A0(R8("@effect/printer/Flattened/NeverFlat"))(R8(Jg))},mP8={Flattened:(X,J)=>C90(J)&&J._tag==="Flattened"&&_0(X.value,J.value),AlreadyFlat:(X,J)=>C90(J)&&J._tag==="AlreadyFlat",NeverFlat:(X,J)=>C90(J)&&J._tag==="NeverFlat"},I90={[vS0]:{_A:(X)=>X},[y0](){return W8(this,hP8[this._tag](this))},[b0](X){return mP8[this._tag](this,X)}},C90=(X)=>typeof X==="object"&&X!=null&&(vS0 in X),Cq=(X)=>X._tag==="Flattened",nM=(X)=>X._tag==="AlreadyFlat",E90=(X)=>X._tag==="NeverFlat",g3=(X)=>(()=>{let J=Object.create(I90);return J._tag="Flattened",J.value=X,J})(),Zg=(()=>{let X=Object.create(I90);return X._tag="AlreadyFlat",X})(),Qg=(()=>{let X=Object.create(I90);return X._tag="NeverFlat",X})(),S90=$(2,(X,J)=>{switch(X._tag){case"Flattened":return g3(J(X.value));case"AlreadyFlat":return Zg;case"NeverFlat":return Qg}});var CY="@effect/printer/Doc",v90=Symbol.for(CY),uP8={Fail:(X)=>A0(Z0(CY))(Z0("@effect/printer/Doc/Fail")),Empty:(X)=>A0(Z0(CY))(Z0("@effect/printer/Doc/Empty")),Char:(X)=>A0(Z0(CY))(R8(X.char)),Text:(X)=>A0(Z0(CY))(R8(X.text)),Line:(X)=>A0(Z0(CY))(Z0("@effect/printer/Doc/Line")),FlatAlt:(X)=>A0(Z0(CY))(A0(Z0(X.left))(Z0(X.right))),Cat:(X)=>A0(Z0(CY))(A0(Z0(X.left))(Z0(X.right))),Nest:(X)=>A0(Z0(CY))(A0(Z0(X.indent))(Z0(X.doc))),Union:(X)=>A0(Z0(CY))(A0(Z0(X.left))(Z0(X.right))),Column:(X)=>A0(Z0(CY))(Z0(X.react)),WithPageWidth:(X)=>A0(Z0(CY))(Z0(X.react)),Nesting:(X)=>A0(Z0(CY))(Z0(X.react)),Annotated:(X)=>A0(Z0(CY))(A0(Z0(X.annotation))(Z0(X.doc)))},cP8={Fail:(X,J)=>IY(J)&&J._tag==="Fail",Empty:(X,J)=>IY(J)&&J._tag==="Empty",Char:(X,J)=>IY(J)&&J._tag==="Char"&&X.char===J.char,Text:(X,J)=>IY(J)&&J._tag==="Text"&&X.text===J.text,Line:(X,J)=>IY(J)&&J._tag==="Line",FlatAlt:(X,J)=>IY(J)&&J._tag==="FlatAlt"&&_0(J.left)(X.left)&&_0(J.right)(X.right),Cat:(X,J)=>IY(J)&&J._tag==="Cat"&&_0(J.left)(X.left)&&_0(J.right)(X.right),Nest:(X,J)=>IY(J)&&J._tag==="Nest"&&X.indent===J.indent&&_0(J.doc)(X.doc),Union:(X,J)=>IY(J)&&J._tag==="Union"&&_0(J.left)(X.left)&&_0(J.right)(X.right),Column:(X,J)=>IY(J)&&J._tag==="Column"&&_0(J.react)(X.react),WithPageWidth:(X,J)=>IY(J)&&J._tag==="WithPageWidth"&&_0(J.react)(X.react),Nesting:(X,J)=>IY(J)&&J._tag==="Nesting"&&_0(J.react)(X.react),Annotated:(X,J)=>IY(J)&&J._tag==="Annotated"&&_0(J.annotation)(X.annotation)&&_0(J.doc)(X.doc)},T5={[v90]:{_A:(X)=>X},[y0](){return W8(this,uP8[this._tag](this))},[b0](X){return cP8[this._tag](this,X)},pipe(){return K0(this,arguments)}},IY=(X)=>typeof X==="object"&&X!=null&&(v90 in X);var oM=(X)=>X._tag==="Empty",h4=(X)=>X._tag==="Char",m4=(X)=>X._tag==="Text";var eW=(X)=>X._tag==="Cat",k90=(X)=>X._tag==="Nest";var rM=(X)=>{let J=Object.create(T5);return J._tag="Char",J.char=X,J},XV=(X)=>{let J=Object.create(T5);return J._tag="Text",J.text=X,J},aM=$(2,(X,J)=>{let Z=Object.create(T5);return Z._tag="FlatAlt",Z.left=X,Z.right=J,Z}),Iq=$(2,(X,J)=>{let Z=Object.create(T5);return Z._tag="Union",Z.left=X,Z.right=J,Z}),vJ=$(2,(X,J)=>{let Z=Object.create(T5);return Z._tag="Cat",Z.left=X,Z.right=J,Z}),sM=(()=>{let X=Object.create(T5);return X._tag="Empty",X})(),kS0=(()=>{let X=Object.create(T5);return X._tag="Fail",X})(),Gg=(()=>{let X=Object.create(T5);return X._tag="Line",X})(),bS0=aM(Gg,rM(" ")),yS0=aM(Gg,sM);var b90=rM(" ");var gS0=(X)=>pS0(uS0(X)),hS0=$(2,(X,J)=>vJ(X,vJ(bS0,J))),mS0=$(2,(X,J)=>vJ(X,vJ(yS0,J)));var dS0=$(2,(X,J)=>vJ(X,vJ(b90,J))),Kg=$(2,(X,J)=>Cc(v0(X),{onEmpty:()=>sM,onNonEmpty:(Z,Q)=>JY(Z,Q,(Y,G)=>J(G,Y))})),uS0=(X)=>Kg(X,(J,Z)=>mS0(J,Z));var cS0=(X)=>Kg(X,(J,Z)=>dS0(J,Z)),fS0=(X)=>Kg(X,(J,Z)=>hS0(J,Z));var pS0=(X)=>{switch(X._tag){case"FlatAlt":{let J=x90(X.right);switch(J._tag){case"Flattened":return Iq(J.value,X.left);case"AlreadyFlat":return Iq(X.right,X.left);case"NeverFlat":return X.left}}case"Union":return X;default:{let J=x90(X);return Cq(J)?Iq(J.value,X):X}}},Eq=(X)=>{let J=Object.create(T5);return J._tag="Column",J.react=X,J},Sq=(X)=>{let J=Object.create(T5);return J._tag="Nesting",J.react=X,J};var tM=(X)=>{let J=Object.create(T5);return J._tag="WithPageWidth",J.react=X,J},pH=$(2,(X,J)=>J===0?X:(()=>{let Z=Object.create(T5);return Z._tag="Nest",Z.indent=J,Z.doc=X,Z})()),y90=(X)=>Eq((J)=>Sq((Z)=>pH(X,J-Z))),lS0=$(2,(X,J)=>y90(pH(X,J))),nS0=$(2,(X,J)=>lS0(vJ(iS0(J),X),J));var Yg=(X)=>j9(eG(X)),eG=(X)=>f0(function*(){switch(X._tag){case"Fail":return X;case"Empty":return X;case"Char":return X;case"Text":return X;case"Line":return kS0;case"FlatAlt":return yield*eG(X.right);case"Cat":{let J=yield*eG(X.left),Z=yield*eG(X.right);return vJ(J,Z)}case"Nest":{let J=yield*eG(X.doc);return pH(J,X.indent)}case"Union":return yield*eG(X.left);case"Column":return Eq((J)=>Yg(X.react(J)));case"WithPageWidth":return tM((J)=>Yg(X.react(J)));case"Nesting":return Sq((J)=>Yg(X.react(J)));case"Annotated":{let J=yield*eG(X.doc);return xq(J,X.annotation)}}}),x90=(X)=>j9(iM(X)),iM=(X)=>f0(function*(){switch(X._tag){case"Fail":case"Line":return Qg;case"Empty":case"Char":case"Text":return Zg;case"FlatAlt":{let J=yield*eG(X.right);return g3(J)}case"Cat":{let J=yield*iM(X.left),Z=yield*iM(X.right);if(E90(J)||E90(Z))return Qg;if(Cq(J)&&Cq(Z))return g3(vJ(J.value,Z.value));if(Cq(J)&&nM(Z))return g3(vJ(J.value,X.right));if(nM(J)&&Cq(Z))return g3(vJ(X.left,Z.value));if(nM(J)&&nM(Z))return Zg;throw Error("[BUG]: Doc.changesUponFlattening - unable to flatten a Cat document - please open an issue at https://github.com/IMax153/contentlayer/issues/new")}case"Nest":return yield*z(iM(X.doc),u(S90((J)=>pH(J,X.indent))));case"Union":return g3(X.left);case"Column":{let J=Eq((Z)=>j9(eG(X.react(Z))));return g3(J)}case"WithPageWidth":{let J=tM((Z)=>j9(eG(X.react(Z))));return g3(J)}case"Nesting":{let J=Sq((Z)=>j9(eG(X.react(Z))));return g3(J)}case"Annotated":return yield*z(iM(X.doc),u(S90((J)=>xq(J,X.annotation))))}}),xq=$(2,(X,J)=>{let Z=Object.create(T5);return Z._tag="Annotated",Z.doc=X,Z.annotation=J,Z});var iS0=(X)=>{if(X<=0)return sM;if(X===1)return rM(" ");return XV(oS0(X))};var oS0=(X)=>{let J="";for(let Z=0;Z<X;Z++)J=J+=" ";return J};var JV="@effect/printer/DocStream",aS0=Symbol.for(JV),fP8={FailedStream:(X)=>z(R8("@effect/printer/DocStream/FailedStream"),A0(R8(JV))),EmptyStream:(X)=>z(R8("@effect/printer/DocStream/EmptyStream"),A0(R8(JV))),CharStream:(X)=>z(Z0("@effect/printer/DocStream/CharStream"),A0(R8(JV)),A0(R8(X.char)),A0(Z0(X.stream))),TextStream:(X)=>z(R8("@effect/printer/DocStream/TextStream"),A0(R8(JV)),A0(R8(X.text)),A0(Z0(X.stream))),LineStream:(X)=>z(R8("@effect/printer/DocStream/LineStream"),A0(R8(JV)),A0(Z0(X.stream))),PushAnnotationStream:(X)=>z(R8("@effect/printer/DocStream/PopAnnotationStream"),A0(R8(JV)),A0(Z0(X.annotation)),A0(Z0(X.stream))),PopAnnotationStream:(X)=>z(R8("@effect/printer/DocStream/PopAnnotationStream"),A0(R8(JV)),A0(Z0(X.stream)))},pP8={FailedStream:(X,J)=>Kz(J)&&J._tag==="FailedStream",EmptyStream:(X,J)=>Kz(J)&&J._tag==="EmptyStream",CharStream:(X,J)=>Kz(J)&&J._tag==="CharStream"&&X.char===J.char&&_0(X.stream,J.stream),TextStream:(X,J)=>Kz(J)&&J._tag==="TextStream"&&X.text===J.text&&_0(X.stream,J.stream),LineStream:(X,J)=>Kz(J)&&J._tag==="LineStream"&&_0(X.stream,J.stream),PushAnnotationStream:(X,J)=>Kz(J)&&J._tag==="PushAnnotationStream"&&_0(X.annotation,J.annotation)&&_0(X.stream,J.stream),PopAnnotationStream:(X,J)=>Kz(J)&&J._tag==="PopAnnotationStream"&&_0(X.stream,J.stream)},Bz={[aS0]:{_A:(X)=>X},[y0](){return W8(this,fP8[this._tag](this))},[b0](X){return pP8[this._tag](this,X)}},Kz=(X)=>typeof X==="object"&&X!=null&&(aS0 in X);var sS0=(X)=>X._tag==="EmptyStream";var tS0=(X)=>X._tag==="LineStream";var g90=(()=>{let X=Object.create(Bz);return X._tag="FailedStream",X})(),h90=(()=>{let X=Object.create(Bz);return X._tag="EmptyStream",X})(),m90=$(2,(X,J)=>{let Z=Object.create(Bz);return Z._tag="CharStream",Z.char=J,Z.stream=X,Z}),d90=$(2,(X,J)=>{let Z=Object.create(Bz);return Z._tag="TextStream",Z.text=J,Z.stream=X,Z}),u90=$(2,(X,J)=>{let Z=Object.create(Bz);return Z._tag="LineStream",Z.indentation=J,Z.stream=X,Z}),eS0=$(2,(X,J)=>{let Z=Object.create(Bz);return Z._tag="PushAnnotationStream",Z.annotation=J,Z.stream=X,Z}),Xx0=(X)=>{let J=Object.create(Bz);return J._tag="PopAnnotationStream",J.stream=X,J};var Jx0={_tag:"Nil"},d4=(X,J,Z)=>({_tag:"Cons",indent:X,document:J,pipeline:Z}),Zx0=(X)=>({_tag:"UndoAnnotation",pipeline:X});var c90="@effect/printer/PageWidth",Bg=Symbol.for(c90),iP8={AvailablePerLine:(X)=>z(Z0("@effect/printer/PageWidth/AvailablePerLine"),A0(Z0(c90)),A0(Z0(X.lineWidth)),A0(Z0(X.ribbonFraction))),Unbounded:(X)=>z(Z0("@effect/printer/PageWidth/Unbounded"),A0(Z0(c90)))},oP8={AvailablePerLine:(X,J)=>f90(J)&&J._tag==="AvailablePerLine"&&X.lineWidth===J.lineWidth&&X.ribbonFraction===J.ribbonFraction,Unbounded:(X,J)=>f90(J)&&J._tag==="Unbounded"},Qx0={[Bg]:Bg,[y0](){return W8(this,iP8[this._tag](this))},[b0](X){return oP8[this._tag](this,X)}},f90=(X)=>typeof X==="object"&&X!=null&&(Bg in X);var Yx0=(X,J)=>{let Z=Object.create(Qx0);return Z._tag="AvailablePerLine",Z.lineWidth=X,Z.ribbonFraction=J,Z},Hg=(()=>{let X=Object.create(Qx0);return X._tag="Unbounded",X})(),p90=Yx0(80,1),Wg=(X,J,Z,Q)=>{let Y=X-Q,G=Math.max(0,Math.min(X,Math.floor(X*J))),K=Z+G-Q;return Math.min(Y,K)};var Kx0=(X)=>({pageWidth:X});var Vg=$(3,(X,J,Z)=>j9(rP8(d4(0,X,Jx0),0,0,J,Z))),rP8=(X,J,Z,Q,Y)=>{let G=(K,B,H)=>f0(function*(){switch(K._tag){case"Nil":return h90;case"Cons":switch(K.document._tag){case"Fail":return g90;case"Empty":return yield*G(K.pipeline,B,H);case"Char":{let W=yield*G(K.pipeline,B,H+1);return m90(W,K.document.char)}case"Text":{let W=K.document.text.length,V=yield*G(K.pipeline,B,H+W);return d90(V,K.document.text)}case"Line":{let W=yield*G(K.pipeline,K.indent,K.indent),V=sS0(W)||tS0(W)?0:K.indent;return u90(W,V)}case"FlatAlt":{let W=d4(K.indent,K.document.left,K.pipeline);return yield*G(W,B,H)}case"Cat":{let W=d4(K.indent,K.document.right,K.pipeline),V=d4(K.indent,K.document.left,W);return yield*G(V,B,H)}case"Nest":{let W=K.indent+K.document.indent,V=d4(W,K.document.doc,K.pipeline);return yield*G(V,B,H)}case"Union":{let W=d4(K.indent,K.document.left,K.pipeline),V=d4(K.indent,K.document.right,K.pipeline),U=G(W,B,H),O=G(V,B,H);return aP8(Q,B,H,U,O)}case"Column":{let W=K.document.react(H),V=d4(K.indent,W,K.pipeline);return yield*G(V,B,H)}case"WithPageWidth":{let W=K.document.react(Y.pageWidth),V=d4(K.indent,W,K.pipeline);return yield*G(V,B,H)}case"Nesting":{let W=K.document.react(K.indent),V=d4(K.indent,W,K.pipeline);return yield*G(V,B,H)}case"Annotated":{let W=Zx0(K.pipeline),V=d4(K.indent,K.document.doc,W),U=yield*G(V,B,H);return eS0(U,K.document.annotation)}}case"UndoAnnotation":{let W=yield*G(K.pipeline,J,Z);return Xx0(W)}}});return G(X,J,Z)},aP8=(X,J,Z,Q,Y)=>{let G=j9(Q),K=void 0;return X(G,J,Z,()=>K??(K=j9(Y),K))?G:K??j9(Y)},Bx0=(X)=>j9(M5(RB(X),0)),M5=(X,J)=>f0(function*(){if(FQ(X))return h90;let{head:Z,tail:Q}=X;switch(Z._tag){case"Fail":return g90;case"Empty":return yield*M5(Q,J);case"Char":{let Y=yield*M5(Q,J+1);return m90(Y,Z.char)}case"Text":{let Y=yield*M5(Q,J+Z.text.length);return d90(Y,Z.text)}case"Line":{let Y=yield*M5(Q,0);return u90(Y,0)}case"FlatAlt":return yield*M5(u7(Z.left,Q),J);case"Cat":{let Y=u7(Z.left,u7(Z.right,Q));return yield*M5(Y,J)}case"Nest":return yield*M5(u7(Z.doc,Q),J);case"Union":return yield*M5(u7(Z.right,Q),J);case"Column":return yield*M5(u7(Z.react(J),Q),J);case"WithPageWidth":return yield*M5(u7(Z.react(Hg),Q),J);case"Nesting":return yield*M5(u7(Z.react(0),Q),J);case"Annotated":return yield*M5(u7(Z.doc,Q),J)}}),Hx0=$(2,(X,J)=>{let Z=J.pageWidth;if(Z._tag==="AvailablePerLine")return Vg(X,(Q,Y,G)=>{let K=Wg(Z.lineWidth,Z.ribbonFraction,Y,G);return sP8(Q,K)},J);return l90(X)}),sP8=(X,J)=>{let Z=J,Q=X;while(Z>=0)switch(Q._tag){case"FailedStream":return!1;case"EmptyStream":return!0;case"CharStream":{Z=Z-1,Q=Q.stream;break}case"TextStream":{Z=Z-Q.text.length,Q=Q.stream;break}case"LineStream":return!0;case"PushAnnotationStream":{Q=Q.stream;break}case"PopAnnotationStream":{Q=Q.stream;break}}return!1},Wx0=$(2,(X,J)=>{let Z=J.pageWidth;if(Z._tag==="AvailablePerLine")return Vg(X,tP8(Z.lineWidth,Z.ribbonFraction),J);return l90(X)}),tP8=(X,J)=>{return(Z,Q,Y,G)=>{let K=Wg(X,J,Q,Y);return eP8(Z,G,X,Y,K)}},eP8=(X,J,Z,Q,Y)=>{let G,K=X,B=Y;while(B>=0)switch(K._tag){case"FailedStream":return!1;case"EmptyStream":return!0;case"CharStream":{B=B-1,K=K.stream;break}case"TextStream":{B=B-K.text.length,K=K.stream;break}case"LineStream":{if(!G)G=w0(XR8(J()),{onNone:()=>Q,onSome:(H)=>Math.min(H,Q)});if(G<K.indentation)return!1;B=Z-K.indentation,K=K.stream;break}case"PushAnnotationStream":{K=K.stream;break}case"PopAnnotationStream":{K=K.stream;break}}return!1},XR8=(X)=>{let J=X;while(J._tag==="LineStream"||J._tag==="PushAnnotationStream"||J._tag==="PopAnnotationStream"){if(J._tag==="LineStream")return I(J.indentation);J=J.stream}return S()},l90=(X)=>Vg(X,(J)=>!JR8(J),{pageWidth:Hg}),JR8=(X)=>{let J=X;while(!0)switch(J._tag){case"FailedStream":return!0;case"EmptyStream":return!1;case"CharStream":{J=J.stream;break}case"TextStream":{J=J.stream;break}case"LineStream":return!1;case"PushAnnotationStream":{J=J.stream;break}case"PopAnnotationStream":{J=J.stream;break}}throw Error("bug")};var Hz=rM,e0=XV;var C9=sM;var uX=Gg;var m8=b90;var Q0=vJ,n90=gS0;var QZ=cS0,J6=fS0;var hZ=pH,lH=y90;var $g=nS0;var k0=xq;var Vx0=k0(C9,_90),$x0=(X,J)=>k0(C9,q90(X,J)),Ux0=(X,J)=>k0(C9,D90(X,J));var zx0=(X=1)=>k0(C9,w90(X));var Nx0=k0(C9,L90),Ox0=k0(C9,F90),_x0=k0(C9,A90);var qx0=k0(C9,T90),Dx0=k0(C9,M90),wx0=(X)=>k0(C9,P90(X));var Lx0=k0(C9,R90);var i90=p90;var o90=Kx0;var Fx0=Bx0,Ax0=Hx0,Tx0=Wx0;var Px0=$(2,(X,J)=>{switch(J.style){case"compact":return r90(Fx0(X));case"pretty":{let Z=Object.assign({},i90,J.options);return r90(Ax0(X,o90(Z)))}case"smart":{let Z=Object.assign({},i90,J.options);return r90(Tx0(X,o90(Z)))}}}),r90=(X)=>j9(vq(X,RB(NS0))),Mx0=(X)=>{if(FQ(X))throw Error("BUG: AnsiRender.unsafePeek - peeked at an empty stack - please report an issue at https://github.com/Effect-TS/printer/issues");return X.head},BR8=(X)=>{if(FQ(X))throw Error("BUG: AnsiRender.unsafePop - popped from an empty stack - please report an issue at https://github.com/Effect-TS/printer/issues");return[X.head,X.tail]},vq=(X,J)=>{switch(X._tag){case"FailedStream":return SG("BUG: AnsiRender.renderSafe - attempted to render a failed doc stream - please report an issue at https://github.com/Effect-TS/printer/issues");case"EmptyStream":return y("");case"CharStream":return u(o0(()=>vq(X.stream,J)),(Z)=>X.char+Z);case"TextStream":return u(o0(()=>vq(X.stream,J)),(Z)=>X.text+Z);case"LineStream":{let Z=`
191
+ `;for(let Q=0;Q<X.indentation;Q++)Z=Z+=" ";return u(o0(()=>vq(X.stream,J)),(Q)=>Z+Q)}case"PushAnnotationStream":{let Z=Mx0(J),Q=Xg(X.annotation,Z);return u(o0(()=>vq(X.stream,u7(X.annotation,J))),(Y)=>ey(Q)+Y)}case"PopAnnotationStream":{let[,Z]=BR8(J),Q=Mx0(Z);return u(o0(()=>vq(X.stream,Z)),(Y)=>ey(Q)+Y)}}};var UQ=Vx0,Rx0=$x0,jx0=Ux0;var kq=zx0;var EY=Nx0,ZV=Ox0,QV=_x0;var P5=qx0,Cx0=Dx0,Ix0=wx0;var zQ=Lx0;var V9=Px0;var Ex0=$(2,(X,J)=>j9(Ug(X,J))),Ug=(X,J)=>{let Z=(Q)=>f0(function*(){switch(Q._tag){case"Fail":case"Empty":case"Char":case"Text":case"Line":return Q;case"FlatAlt":{let Y=yield*Z(Q.left),G=yield*Z(Q.right);return aM(Y,G)}case"Cat":{if(oM(Q.left))return yield*Z(Q.right);if(oM(Q.right))return yield*Z(Q.left);if(h4(Q.left)&&h4(Q.right))return XV(Q.left.char+Q.right.char);if(m4(Q.left)&&h4(Q.right))return XV(Q.left.text+Q.right.char);if(h4(Q.left)&&m4(Q.right))return XV(Q.left.char+Q.right.text);if(m4(Q.left)&&m4(Q.right))return XV(Q.left.text+Q.right.text);if(h4(Q.left)&&eW(Q.right)&&h4(Q.right.left)||h4(Q.left)&&eW(Q.right)&&m4(Q.right.left)||m4(Q.left)&&eW(Q.right)&&h4(Q.right.left)||m4(Q.left)&&eW(Q.right)&&m4(Q.right.left)){let K=yield*Z(vJ(Q.left,Q.right.left));return yield*Z(vJ(K,Q.right.right))}if(eW(Q.left)&&h4(Q.left.right)||eW(Q.left)&&m4(Q.left.right)){let K=yield*Z(vJ(Q.left.right,Q.right));return yield*Z(vJ(Q.left.left,K))}let Y=yield*Z(Q.left),G=yield*Z(Q.right);return vJ(Y,G)}case"Nest":{if(Q.indent===0)return yield*Z(Q.doc);if(oM(Q.doc)||h4(Q.doc)||m4(Q.doc))return Q.doc;if(k90(Q.doc)){let Y=Q.indent+Q.doc.indent;return yield*Z(pH(Q.doc.doc,Y))}return pH(yield*Z(Q.doc),Q.indent)}case"Union":{let Y=yield*Z(Q.left),G=yield*Z(Q.right);return Iq(Y,G)}case"Column":return J._tag==="Shallow"?Q:Eq((Y)=>j9(Ug(Q.react(Y),J)));case"WithPageWidth":return J._tag==="Shallow"?Q:tM((Y)=>j9(Ug(Q.react(Y),J)));case"Nesting":return J._tag==="Shallow"?Q:Sq((Y)=>j9(Ug(Q.react(Y),J)));case"Annotated":return xq(yield*Z(Q.doc),Q.annotation)}});return Z(X)};var SX={_tag:"Deep"},xX=Ex0;var Sx0=ry;var a90=U90,zg=ay,xx0=sy;var d8=(X)=>({_tag:"Text",value:X}),R5=d8(""),SY=d8(" "),m3=(X)=>YV(X,xx0),vx0=(X)=>YV(X,Sx0),YV=(X,J)=>({_tag:"Highlight",value:typeof X==="string"?d8(X):X,color:J}),Ng=(X)=>({_tag:"Strong",value:typeof X==="string"?d8(X):X});var kx0=(X)=>({_tag:"Weak",value:typeof X==="string"?d8(X):X});var t90=(X)=>X._tag==="Text";var mZ=$(2,(X,J)=>({_tag:"Sequence",left:X,right:J})),h3=(X)=>{switch(X._tag){case"Text":case"URI":return X.value;case"Highlight":case"Weak":case"Strong":return h3(X.value);case"Sequence":return h3(X.left)+h3(X.right)}},xY=(X)=>{let J=v0(X);if(B8(J))return J.slice(1).reduce(mZ,J[0]);return R5},e90=(X)=>Wz(X)===0,Wz=(X)=>{switch(X._tag){case"Text":case"URI":return X.value.length;case"Highlight":case"Strong":case"Weak":return Wz(X.value);case"Sequence":return Wz(X.left)+Wz(X.right)}},iH=(X)=>{switch(X._tag){case"Highlight":return k0(iH(X.value),SS0(X.color));case"Sequence":return Q0(iH(X.left),iH(X.right));case"Strong":return k0(iH(X.value),k7);case"Text":return e0(X.value);case"URI":return k0(e0(X.value),uQ);case"Weak":return k0(iH(X.value),xS0)}};var d3=(X)=>X._tag==="Empty",XX0=(X)=>X._tag==="Header",JX0=(X)=>X._tag==="Paragraph",ZX0=(X)=>X._tag==="DescriptionList",bx0=(X)=>X._tag==="Enumeration",yx0=(X)=>X._tag==="Sequence",cX={_tag:"Empty"},I8=$(2,(X,J)=>{if(d3(X))return J;if(d3(J))return X;return{_tag:"Sequence",left:X,right:J}}),gx0=$(2,(X,J)=>d3(X)?J:X),Og=(X)=>{let J=v0(X);if(B8(J))return J.slice(1).reduce(I8,J[0]);return cX},c4=(X)=>XX0(X)||JX0(X)?X.value:R5,oH=(X)=>({_tag:"DescriptionList",definitions:X}),bq=(X)=>({_tag:"Enumeration",elements:X}),f4=(X)=>({_tag:"Header",value:typeof X==="string"?d8(X):X,level:1}),hx0=(X)=>({_tag:"Header",value:typeof X==="string"?d8(X):X,level:2}),mx0=(X)=>({_tag:"Header",value:typeof X==="string"?d8(X):X,level:3}),h0=(X)=>({_tag:"Paragraph",value:typeof X==="string"?d8(X):X}),XK=$(2,(X,J)=>ZX0(X)?oH(n0(X.definitions,([Z,Q])=>J(Z,Q))):X),QX0=(X)=>xX(eM(X),SX),BX=(X)=>V9(QX0(X),{style:"pretty"}),eM=(X)=>{switch(X._tag){case"Empty":return C9;case"Header":return z(k0(iH(X.value),k7),Q0(uX));case"Paragraph":return z(iH(X.value),Q0(uX));case"DescriptionList":{let J=X.definitions.map(([Z,Q])=>n90([k0(iH(Z),k7),C9,$g(eM(Q),2)]));return J6(J)}case"Enumeration":{let J=X.elements.map((Z)=>Q0(e0("- "),eM(Z)));return $g(J6(J),2)}case"Sequence":return J6([eM(X.left),eM(X.right)])}};var dx0=Gb;var YX0=(X)=>({...GV,...X}),yq=g8("@effect/cli/CliConfig"),GV={isCaseSensitive:!1,autoCorrectLimit:2,finalCheckBuiltIn:!1,showAllNames:!0,showBuiltIns:!0,showTypes:!0},ux0=E7(yq,GV),cx0=(X)=>E7(yq,YX0(X)),UJ=$(2,(X,J)=>X.isCaseSensitive?J:J.toLowerCase());var z7={};y8(z7,{isQuitException:()=>GX0,Terminal:()=>m9,QuitException:()=>_g});var fx0=g8("@effect/platform/Terminal");class _g extends xF("QuitException"){}var GX0=(X)=>typeof X==="object"&&X!=null&&("_tag"in X)&&X._tag==="QuitException",m9=fx0;var d0=SF();var UR8="@effect/cli/Prompt",qg=Symbol.for(UR8),BX0={...dB,[qg]:{_Output:(X)=>X},commit(){return JP(this)},pipe(){return K0(this,arguments)}},Dg=(X)=>typeof X==="object"&&X!=null&&(qg in X),px0=(X)=>{if(X.length===0)return wg([]);if(X.length===1)return YZ(X[0],(Z)=>[Z]);let J=YZ(X[0],(Z)=>[Z]);for(let Z=1;Z<X.length;Z++){let Q=X[Z];J=XP(J,(Y)=>YZ(Q,(G)=>[...Y,G]))}return J},lx0=function(){if(arguments.length===1)if(Dg(arguments[0]))return YZ(arguments[0],(X)=>[X]);else if(Array.isArray(arguments[0]))return px0(arguments[0]);else{let X=Object.entries(arguments[0]),J=YZ(X[0][1],(Q)=>({[X[0][0]]:Q}));if(X.length===1)return J;let Z=X.slice(1);for(let[Q,Y]of Z)J=J.pipe(XP((G)=>Y.pipe(YZ((K)=>({...G,[Q]:K})))));return J}return px0(arguments[0])},kJ=(X,J)=>{let Z=Object.create(BX0);return Z._tag="Loop",Z.initialState=X,Z.render=J.render,Z.process=J.process,Z.clear=J.clear,Z},YZ=$(2,(X,J)=>XP(X,(Z)=>wg(J(Z)))),XP=$(2,(X,J)=>{let Z=Object.create(BX0);return Z._tag="OnSuccess",Z.prompt=X,Z.onSuccess=J,Z}),JP=hX(function*(X){let J=yield*m9,Z=yield*J.readInput;return yield*KX0(X,J,Z)},E9(()=>new _g),l7),KX0=(X,J,Z)=>o0(()=>{let Q=X;switch(Q._tag){case"Loop":return zR8(Q,J,Z);case"OnSuccess":return h(KX0(Q.prompt,J,Z),(Y)=>KX0(Q.onSuccess(Y),J,Z));case"Succeed":return y(Q.value)}}),zR8=hX(function*(X,J,Z){let Q=VX(X.initialState)?yield*X.initialState:X.initialState,Y=d0.NextFrame({state:Q});while(!0){let G=yield*X.render(Q,Y);yield*R9(J.display(G));let K=yield*Z.take;switch(Y=yield*X.process(K,Q),Y._tag){case"Beep":continue;case"NextFrame":{yield*R9(J.display(yield*X.clear(Q,Y))),Q=Y.state;continue}case"Submit":{yield*R9(J.display(yield*X.clear(Q,Y)));let B=yield*X.render(Q,Y);return yield*R9(J.display(B)),Y.value}}}},(X,J,Z)=>RZ(X,R9(Z.display(V9(Cx0,{style:"pretty"}))))),wg=(X)=>{let J=Object.create(BX0);return J._tag="Succeed",J.value=X,J};var D0={};y8(D0,{withReturnType:()=>MR8,whenOr:()=>PR8,whenAnd:()=>RR8,when:()=>C5,valueTags:()=>AR8,value:()=>QP,undefined:()=>fR8,typeTags:()=>TR8,type:()=>FR8,tagsExhaustive:()=>kR8,tags:()=>vR8,tagStartsWith:()=>xR8,tag:()=>SR8,symbol:()=>nR8,string:()=>hR8,record:()=>oR8,orElseAbsurd:()=>sR8,orElse:()=>YP,option:()=>eR8,number:()=>mR8,null:()=>pR8,not:()=>bR8,nonEmptyString:()=>yR8,is:()=>gR8,instanceOfUnsafe:()=>aR8,instanceOf:()=>rR8,exhaustive:()=>Xj8,either:()=>tR8,discriminatorsExhaustive:()=>ER8,discriminators:()=>IR8,discriminatorStartsWith:()=>CR8,discriminator:()=>jR8,defined:()=>uR8,date:()=>iR8,boolean:()=>cR8,bigint:()=>lR8,any:()=>dR8,SafeRefinementId:()=>Jj8,MatcherTypeId:()=>LR8});var Lg=Symbol.for("@effect/matcher/Matcher"),NR8={[Lg]:{_input:t,_filters:t,_remaining:t,_result:t,_return:t},_tag:"TypeMatcher",add(X){return Fg([...this.cases,X])},pipe(){return K0(this,arguments)}};function Fg(X){let J=Object.create(NR8);return J.cases=X,J}var OR8={[Lg]:{_input:t,_filters:t,_remaining:t,_result:t,_provided:t,_return:t},_tag:"ValueMatcher",add(X){if(this.value._tag==="Right")return this;if(X._tag==="When"&&X.guard(this.provided)===!0)return HX0(this.provided,O0(X.evaluate(this.provided)));else if(X._tag==="Not"&&X.guard(this.provided)===!1)return HX0(this.provided,O0(X.evaluate(this.provided)));return this},pipe(){return K0(this,arguments)}};function HX0(X,J){let Z=Object.create(OR8);return Z.provided=X,Z.value=J,Z}var hq=(X,J)=>({_tag:"When",guard:X,evaluate:J}),_R8=(X,J)=>({_tag:"Not",guard:X,evaluate:J}),gq=(X)=>{if(typeof X==="function")return X;else if(Array.isArray(X)){let J=X.map(gq),Z=J.length;return(Q)=>{if(!Array.isArray(Q))return!1;for(let Y=0;Y<Z;Y++)if(J[Y](Q[Y])===!1)return!1;return!0}}else if(X!==null&&typeof X==="object"){let J=Object.entries(X).map(([Q,Y])=>[Q,gq(Y)]),Z=J.length;return(Q)=>{if(typeof Q!=="object"||Q===null)return!1;for(let Y=0;Y<Z;Y++){let[G,K]=J[Y];if(!(G in Q)||K(Q[G])===!1)return!1}return!0}}return(J)=>J===X},qR8=(X)=>{let J=X.map(gq),Z=J.length;return(Q)=>{for(let Y=0;Y<Z;Y++)if(J[Y](Q)===!0)return!0;return!1}},DR8=(X)=>{let J=X.map(gq),Z=J.length;return(Q)=>{for(let Y=0;Y<Z;Y++)if(J[Y](Q)===!1)return!1;return!0}},ix0=()=>Fg([]),ox0=(X)=>HX0(X,M0(X)),rx0=$(2,(X,J)=>{return Tg(J)(Fg([]))(X)}),ax0=()=>(X)=>{let J=Tg(X)(Fg([]));return(Z)=>J(Z)},sx0=()=>(X)=>X,tx0=(X,J)=>(Z)=>Z.add(hq(gq(X),J)),ex0=(...X)=>(J)=>{let Z=X[X.length-1],Q=X.slice(0,-1);return J.add(hq(qR8(Q),Z))},Xv0=(...X)=>(J)=>{let Z=X[X.length-1],Q=X.slice(0,-1);return J.add(hq(DR8(Q),Z))},WX0=(X)=>(...J)=>{let Z=J[J.length-1],Q=J.slice(0,-1),Y=Q.length===1?(G)=>G!=null&&G[X]===Q[0]:(G)=>G!=null&&Q.includes(G[X]);return(G)=>G.add(hq(Y,Z))},VX0=(X)=>(J,Z)=>{let Q=(Y)=>Y!=null&&typeof Y[X]==="string"&&Y[X].startsWith(J);return(Y)=>Y.add(hq(Q,Z))},Ag=(X)=>(J)=>{let Z=hq((Q)=>Q!=null&&(Q[X]in J),(Q)=>J[Q[X]](Q));return(Q)=>Q.add(Z)},$X0=(X)=>(J)=>{let Z=Ag(X)(J);return(Q)=>NX0(Z(Q))},Jv0=WX0("_tag"),Zv0=VX0("_tag"),Qv0=Ag("_tag"),Tg=$X0("_tag"),Yv0=(X,J)=>(Z)=>Z.add(_R8(gq(X),J)),Gv0=(X)=>typeof X==="string"&&X.length>0,Kv0=(...X)=>{let J=X.length;return(Z)=>{for(let Q=0;Q<J;Q++)if(Z===X[Q])return!0;return!1}},Bv0=()=>!0,Hv0=(X)=>X!==void 0&&X!==null,UX0=(X)=>(J)=>J instanceof X;var zX0=(X)=>(J)=>{let Z=ZP(J);if(TK(Z))return Z._tag==="Right"?Z.right:X(Z.left);return(Q)=>{let Y=Z(Q);return Y._tag==="Right"?Y.right:X(Y.left)}},Wv0=(X)=>zX0(()=>{throw Error("effect/Match/orElseAbsurd: absurd")})(X),ZP=(X)=>{if(X._tag==="ValueMatcher")return X.value;let J=X.cases.length;if(J===1){let Z=X.cases[0];return(Q)=>{if(Z._tag==="When"&&Z.guard(Q)===!0)return O0(Z.evaluate(Q));else if(Z._tag==="Not"&&Z.guard(Q)===!1)return O0(Z.evaluate(Q));return M0(Q)}}return(Z)=>{for(let Q=0;Q<J;Q++){let Y=X.cases[Q];if(Y._tag==="When"&&Y.guard(Z)===!0)return O0(Y.evaluate(Z));else if(Y._tag==="Not"&&Y.guard(Z)===!1)return O0(Y.evaluate(Z))}return M0(Z)}},Vv0=(X)=>{let J=ZP(X);if(TK(J))return w9(J,{onLeft:()=>S(),onRight:I});return(Z)=>w9(J(Z),{onLeft:()=>S(),onRight:I})},nx0="effect/Match/exhaustive: absurd",NX0=(X)=>{let J=ZP(X);if(TK(J)){if(J._tag==="Right")return J.right;throw Error(nx0)}return(Z)=>{let Q=J(Z);if(Q._tag==="Right")return Q.right;throw Error(nx0)}};var LR8=Lg,FR8=ix0,QP=ox0,AR8=rx0,TR8=ax0,MR8=sx0,C5=tx0,PR8=ex0,RR8=Xv0,jR8=WX0,CR8=VX0,IR8=Ag,ER8=$X0,SR8=Jv0,xR8=Zv0,vR8=Qv0,kR8=Tg,bR8=Yv0,yR8=Gv0,gR8=Kv0,hR8=n9,mR8=e7,dR8=Bv0,uR8=Hv0,cR8=yJ,fR8=gV;var pR8=hQ0;var lR8=DK,nR8=f5,iR8=BN,oR8=l5,rR8=UX0,aR8=UX0,YP=zX0,sR8=Wv0,tR8=ZP,eR8=Vv0,Xj8=NX0,Jj8=Symbol.for("effect/SafeRefinement");var GP={arrowUp:e0("↑"),arrowDown:e0("↓"),arrowLeft:e0("←"),arrowRight:e0("→"),radioOn:e0("◉"),radioOff:e0("◯"),checkboxOn:e0("☒"),checkboxOff:e0("☐"),tick:e0("✔"),cross:e0("✖"),ellipsis:e0("…"),pointerSmall:e0("›"),line:e0("─"),pointer:e0("❯")},Zj8={arrowUp:GP.arrowUp,arrowDown:GP.arrowDown,arrowLeft:GP.arrowLeft,arrowRight:GP.arrowRight,radioOn:e0("(*)"),radioOff:e0("( )"),checkboxOn:e0("[*]"),checkboxOff:e0("[ ]"),tick:e0("√"),cross:e0("×"),ellipsis:e0("..."),pointerSmall:e0("»"),line:e0("─"),pointer:e0(">")},X7=u(L0(()=>process.platform==="win32"),(X)=>X?Zj8:GP);function r7(X,J){if(J===0)return Q0(zQ,Rx0(0));let Z=0,Q=X.split(/\r?\n/);for(let Y of Q)Z+=1+Math.floor(Math.max(Y.length-1,0)/J);return Ix0(Z)}function mq(X,J){let Z=X.split(/\r?\n/);return J===0?Z.length:z(n0(Z,(Q)=>Math.ceil(Q.length/J)),OJ(0,(Q,Y)=>Q+Y))}var Qj8=V9(UQ,{style:"pretty"});function Yj8(X){return(J,Z)=>{return f0(function*(){let Y=yield*(yield*m9).columns,G=Q0(zQ,EY),K=w0(J.error,{onNone:()=>C9,onSome:(H)=>kq(mq(H,Y)).pipe(Q0(r7(`
192
+ ${H}`,Y)))}),B=r7(X.message,Y);return K.pipe(Q0(B),Q0(G),xX(SX),V9({style:"pretty",options:{lineWidth:Y}}))})}}var Gj8=/\r?\n/;function Kj8(X,J){return w0(X.error,{onNone:()=>C9,onSome:(Z)=>{let Q=Z.split(Gj8);if(B8(Q)){let Y=(B)=>k0(e0(B),$J(tW,jY)),G=Q0(k0(J,jY),m8),K=n0(Q,(B)=>Y(B));return ZV.pipe(Q0(uX),Q0(G),Q0(lH(J6(K))),Q0(QV))}return C9}})}function Uv0(X,J=!1){return OJ(X.dateParts,C9,(Z,Q,Y)=>{let G=e0(Q.toString());if(Y===X.cursor&&!J){let K=$J(uQ,T6);return Q0(Z,k0(G,K))}return Q0(Z,G)})}function zv0(X,J,Z,Q){let Y=(K)=>k0(e0(K),k7),G=Q0(X,m8);return l6(Q.message.split(/\r?\n/),{onEmpty:()=>QZ([G,J,Z]),onNonEmpty:(K)=>{let B=n0(K,(H)=>Y(H));return G.pipe(Q0(hZ(J6(B),2)),Q0(m8),Q0(J),Q0(m8),Q0(Z))}})}function Bj8(X,J){return f0(function*(){let Q=yield*(yield*m9).columns,Y=yield*X7,G=k0(e0("?"),T6),K=k0(Y.pointerSmall,e9),B=Uv0(X),H=zv0(G,K,B,J),W=Kj8(X,Y.pointerSmall);return P5.pipe(Q0(H),Q0(W),xX(SX),V9({style:"pretty",options:{lineWidth:Q}}))})}function Hj8(X,J){return f0(function*(){let Q=yield*(yield*m9).columns,Y=yield*X7,G=k0(Y.tick,gZ),K=k0(Y.ellipsis,e9),B=Uv0(X,!0);return zv0(G,K,B,J).pipe(Q0(uX),xX(SX),V9({style:"pretty",options:{lineWidth:Q}}))})}function Wj8(X){return X.dateParts[X.cursor].increment(),d0.NextFrame({state:{...X,typed:""}})}function Vj8(X){return X.dateParts[X.cursor].decrement(),d0.NextFrame({state:{...X,typed:""}})}function $j8(X){let J=X.dateParts[X.cursor].previousPart();return w0(J,{onNone:()=>d0.Beep(),onSome:(Z)=>d0.NextFrame({state:{...X,typed:"",cursor:X.dateParts.indexOf(Z)}})})}function Uj8(X){let J=X.dateParts[X.cursor].nextPart();return w0(J,{onNone:()=>d0.Beep(),onSome:(Z)=>d0.NextFrame({state:{...X,typed:"",cursor:X.dateParts.indexOf(Z)}})})}function zj8(X){let J=X.dateParts[X.cursor].nextPart(),Z=w0(J,{onNone:()=>X.dateParts.findIndex((Q)=>!Q.isToken()),onSome:(Q)=>X.dateParts.indexOf(Q)});return d0.NextFrame({state:{...X,cursor:Z}})}function Nj8(X,J){if(/\d/.test(X)){let Z=J.typed+X;return J.dateParts[J.cursor].setValue(Z),d0.NextFrame({state:{...J,typed:Z}})}return d0.Beep()}var Oj8={months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]};function _j8(X){return(J,Z)=>{return d0.$match(Z,{Beep:()=>y(Qj8),NextFrame:({state:Q})=>Bj8(Q,X),Submit:()=>Hj8(J,X)})}}function qj8(X){return(J,Z)=>{switch(J.key.name){case"left":return y($j8(Z));case"right":return y(Uj8(Z));case"k":case"up":return y(Wj8(Z));case"j":case"down":return y(Vj8(Z));case"tab":return y(zj8(Z));case"enter":case"return":return R7(X.validate(Z.value),{onFailure:(Q)=>d0.NextFrame({state:{...Z,error:I(Q)}}),onSuccess:(Q)=>d0.Submit({value:Q})});default:{let Q=i0(J.input,()=>"");return y(Nj8(Q,Z))}}}}var Mg=(X)=>{let J={initial:new Date,dateMask:"YYYY-MM-DD HH:mm:ss",validate:y,...X,locales:{...Oj8,...X.locales}},Z=wj8(J.dateMask,J.initial,J.locales),Q=Z.findIndex((G)=>!G.isToken()),Y={dateParts:Z,typed:"",cursor:Q,value:J.initial,error:S()};return kJ(Y,{render:_j8(J),process:qj8(J),clear:Yj8(J)})},Dj8=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,$v0={1:({token:X,...J})=>new OX0({token:X.replace(/\\(.)/g,"$1"),...J}),2:(X)=>new Dv0(X),3:(X)=>new wv0(X),4:(X)=>new Lv0(X),5:(X)=>new Fv0(X),6:(X)=>new qv0(X),7:(X)=>new _v0(X),8:(X)=>new Ov0(X),9:(X)=>new Nv0(X)},wj8=(X,J,Z)=>{let Q=[],Y=null;while(Y=Dj8.exec(X)){let K=Y.shift(),B=Y.findIndex((H)=>H!==void 0);if(B in $v0){let H=Y[B]||K;Q.push($v0[B]({token:H,date:J,parts:Q,locales:Z}))}else Q.push(new OX0({token:Y[B]||K,date:J,parts:Q,locales:Z}))}let G=Q.reduce((K,B)=>{let H=K[K.length-1];if(B.isToken()&&H!==void 0&&H.isToken())H.setValue(B.token);else K.push(B);return K},l0());return Q.splice(0,Q.length,...G),Q};class u3{token;date;parts;locales;constructor(X){this.token=X.token,this.locales=X.locales,this.date=X.date||new Date,this.parts=X.parts||[this]}isToken(){return!1}nextPart(){return wN(this.parts,(X)=>X===this).pipe(pX((X)=>EK(this.parts.slice(X+1),(J)=>!J.isToken())))}previousPart(){return wN(this.parts,(X)=>X===this).pipe(pX((X)=>LN(this.parts.slice(0,X),(J)=>!J.isToken())))}toString(){return String(this.date)}}class OX0 extends u3{increment(){}decrement(){}setValue(X){this.token=this.token+X}isToken(){return!0}toString(){return this.token}}class Nv0 extends u3{increment(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}decrement(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setValue(X){this.date.setMilliseconds(Number.parseInt(X.slice(-this.token.length)))}toString(){return`${this.date.getMilliseconds()}`.padStart(4,"0").substring(0,this.token.length)}}class Ov0 extends u3{increment(){this.date.setSeconds(this.date.getSeconds()+1)}decrement(){this.date.setSeconds(this.date.getSeconds()-1)}setValue(X){this.date.setSeconds(Number.parseInt(X.slice(-2)))}toString(){let X=`${this.date.getSeconds()}`;return this.token.length>1?X.padStart(2,"0"):X}}class _v0 extends u3{increment(){this.date.setMinutes(this.date.getMinutes()+1)}decrement(){this.date.setMinutes(this.date.getMinutes()-1)}setValue(X){this.date.setMinutes(Number.parseInt(X.slice(-2)))}toString(){let X=`${this.date.getMinutes()}`;return this.token.length>1?X.padStart(2,"0"):X}}class qv0 extends u3{increment(){this.date.setHours(this.date.getHours()+1)}decrement(){this.date.setHours(this.date.getHours()-1)}setValue(X){this.date.setHours(Number.parseInt(X.slice(-2)))}toString(){let X=/h/.test(this.token)?this.date.getHours()%12||12:this.date.getHours();return this.token.length>1?`${X}`.padStart(2,"0"):`${X}`}}class Dv0 extends u3{increment(){this.date.setDate(this.date.getDate()+1)}decrement(){this.date.setDate(this.date.getDate()-1)}setValue(X){this.date.setDate(Number.parseInt(X.slice(-2)))}toString(){let X=this.date.getDate(),J=this.date.getDay();return QP(this.token).pipe(C5("DD",()=>`${X}`.padStart(2,"0")),C5("Do",()=>`${X}${this.ordinalIndicator(X)}`),C5("d",()=>`${J+1}`),C5("ddd",()=>this.locales.weekdaysShort[J]),C5("dddd",()=>this.locales.weekdays[J]),YP(()=>`${X}`))}ordinalIndicator(X){return QP(X%10).pipe(C5(1,()=>"st"),C5(2,()=>"nd"),C5(3,()=>"rd"),YP(()=>"th"))}}class wv0 extends u3{increment(){this.date.setMonth(this.date.getMonth()+1)}decrement(){this.date.setMonth(this.date.getMonth()-1)}setValue(X){let J=Number.parseInt(X.slice(-2))-1;this.date.setMonth(J<0?0:J)}toString(){let X=this.date.getMonth();return QP(this.token.length).pipe(C5(2,()=>`${X+1}`.padStart(2,"0")),C5(3,()=>this.locales.monthsShort[X]),C5(4,()=>this.locales.months[X]),YP(()=>`${X+1}`))}}class Lv0 extends u3{increment(){this.date.setFullYear(this.date.getFullYear()+1)}decrement(){this.date.setFullYear(this.date.getFullYear()-1)}setValue(X){this.date.setFullYear(Number.parseInt(X.slice(-4)))}toString(){let X=`${this.date.getFullYear()}`.padStart(4,"0");return this.token.length===2?X.substring(-2):X}}class Fv0 extends u3{increment(){this.date.setHours((this.date.getHours()+12)%24)}decrement(){this.increment()}setValue(X){}toString(){let X=this.date.getHours()>12?"pm":"am";return/A/.test(this.token)?X.toUpperCase():X}}var M6={};y8(M6,{layer:()=>Sj8,TypeId:()=>BV,Path:()=>vY});var Rg=Symbol.for("@effect/platform/Path"),jg=g8("@effect/platform/Path");function Tv0(X,J){let Z="",Q=0,Y=-1,G=0,K;for(let B=0;B<=X.length;++B){if(B<X.length)K=X.charCodeAt(B);else if(K===47)break;else K=47;if(K===47){if(Y===B-1||G===1);else if(Y!==B-1&&G===2){if(Z.length<2||Q!==2||Z.charCodeAt(Z.length-1)!==46||Z.charCodeAt(Z.length-2)!==46){if(Z.length>2){let H=Z.lastIndexOf("/");if(H!==Z.length-1){if(H===-1)Z="",Q=0;else Z=Z.slice(0,H),Q=Z.length-1-Z.lastIndexOf("/");Y=B,G=0;continue}}else if(Z.length===2||Z.length===1){Z="",Q=0,Y=B,G=0;continue}}if(J){if(Z.length>0)Z+="/..";else Z="..";Q=2}}else{if(Z.length>0)Z+="/"+X.slice(Y+1,B);else Z=X.slice(Y+1,B);Q=B-Y-1}Y=B,G=0}else if(K===46&&G!==-1)++G;else G=-1}return Z}function Lj8(X,J){let Z=J.dir||J.root,Q=J.base||(J.name||"")+(J.ext||"");if(!Z)return Q;if(Z===J.root)return Z+Q;return Z+X+Q}function Fj8(X){if(X.protocol!=="file:")return Y0(new yZ({module:"Path",method:"fromFileUrl",description:"URL must be of scheme file"}));else if(X.hostname!=="")return Y0(new yZ({module:"Path",method:"fromFileUrl",description:"Invalid file URL host"}));let J=X.pathname;for(let Z=0;Z<J.length;Z++)if(J[Z]==="%"){let Q=J.codePointAt(Z+2)|32;if(J[Z+1]==="2"&&Q===102)return Y0(new yZ({module:"Path",method:"fromFileUrl",description:"must not include encoded / characters"}))}return y(decodeURIComponent(J))}var Mv0=function(){let J="",Z=!1,Q=void 0;for(let Y=arguments.length-1;Y>=-1&&!Z;Y--){let G;if(Y>=0)G=arguments[Y];else{let K=globalThis.process;if(Q===void 0&&"process"in globalThis&&typeof K==="object"&&K!==null&&typeof K.cwd==="function")Q=K.cwd();G=Q}if(G.length===0)continue;J=G+"/"+J,Z=G.charCodeAt(0)===47}if(J=Tv0(J,!Z),Z)if(J.length>0)return"/"+J;else return"/";else if(J.length>0)return J;else return"."},Aj8=47;function Tj8(X){let J=new URL("file://"),Z=Mv0(X);if(X.charCodeAt(X.length-1)===Aj8&&Z[Z.length-1]!=="/")Z+="/";return J.pathname=Ij8(Z),y(J)}var Mj8=/%/g,Pj8=/\\/g,Rj8=/\n/g,jj8=/\r/g,Cj8=/\t/g;function Ij8(X){if(X.includes("%"))X=X.replace(Mj8,"%25");if(X.includes("\\"))X=X.replace(Pj8,"%5C");if(X.includes(`
193
+ `))X=X.replace(Rj8,"%0A");if(X.includes("\r"))X=X.replace(jj8,"%0D");if(X.includes("\t"))X=X.replace(Cj8,"%09");return X}var Pg=jg.of({[Rg]:Rg,resolve:Mv0,normalize(X){if(X.length===0)return".";let J=X.charCodeAt(0)===47,Z=X.charCodeAt(X.length-1)===47;if(X=Tv0(X,!J),X.length===0&&!J)X=".";if(X.length>0&&Z)X+="/";if(J)return"/"+X;return X},isAbsolute(X){return X.length>0&&X.charCodeAt(0)===47},join(){if(arguments.length===0)return".";let X;for(let J=0;J<arguments.length;++J){let Z=arguments[J];if(Z.length>0)if(X===void 0)X=Z;else X+="/"+Z}if(X===void 0)return".";return Pg.normalize(X)},relative(X,J){if(X===J)return"";if(X=Pg.resolve(X),J=Pg.resolve(J),X===J)return"";let Z=1;for(;Z<X.length;++Z)if(X.charCodeAt(Z)!==47)break;let Q=X.length,Y=Q-Z,G=1;for(;G<J.length;++G)if(J.charCodeAt(G)!==47)break;let B=J.length-G,H=Y<B?Y:B,W=-1,V=0;for(;V<=H;++V){if(V===H){if(B>H){if(J.charCodeAt(G+V)===47)return J.slice(G+V+1);else if(V===0)return J.slice(G+V)}else if(Y>H){if(X.charCodeAt(Z+V)===47)W=V;else if(V===0)W=0}break}let O=X.charCodeAt(Z+V),q=J.charCodeAt(G+V);if(O!==q)break;else if(O===47)W=V}let U="";for(V=Z+W+1;V<=Q;++V)if(V===Q||X.charCodeAt(V)===47)if(U.length===0)U+="..";else U+="/..";if(U.length>0)return U+J.slice(G+W);else{if(G+=W,J.charCodeAt(G)===47)++G;return J.slice(G)}},dirname(X){if(X.length===0)return".";let J=X.charCodeAt(0),Z=J===47,Q=-1,Y=!0;for(let G=X.length-1;G>=1;--G)if(J=X.charCodeAt(G),J===47){if(!Y){Q=G;break}}else Y=!1;if(Q===-1)return Z?"/":".";if(Z&&Q===1)return"//";return X.slice(0,Q)},basename(X,J){let Z=0,Q=-1,Y=!0,G;if(J!==void 0&&J.length>0&&J.length<=X.length){if(J.length===X.length&&J===X)return"";let K=J.length-1,B=-1;for(G=X.length-1;G>=0;--G){let H=X.charCodeAt(G);if(H===47){if(!Y){Z=G+1;break}}else{if(B===-1)Y=!1,B=G+1;if(K>=0)if(H===J.charCodeAt(K)){if(--K===-1)Q=G}else K=-1,Q=B}}if(Z===Q)Q=B;else if(Q===-1)Q=X.length;return X.slice(Z,Q)}else{for(G=X.length-1;G>=0;--G)if(X.charCodeAt(G)===47){if(!Y){Z=G+1;break}}else if(Q===-1)Y=!1,Q=G+1;if(Q===-1)return"";return X.slice(Z,Q)}},extname(X){let J=-1,Z=0,Q=-1,Y=!0,G=0;for(let K=X.length-1;K>=0;--K){let B=X.charCodeAt(K);if(B===47){if(!Y){Z=K+1;break}continue}if(Q===-1)Y=!1,Q=K+1;if(B===46){if(J===-1)J=K;else if(G!==1)G=1}else if(J!==-1)G=-1}if(J===-1||Q===-1||G===0||G===1&&J===Q-1&&J===Z+1)return"";return X.slice(J,Q)},format:function(J){if(J===null||typeof J!=="object")throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof J);return Lj8("/",J)},parse(X){let J={root:"",dir:"",base:"",ext:"",name:""};if(X.length===0)return J;let Z=X.charCodeAt(0),Q=Z===47,Y;if(Q)J.root="/",Y=1;else Y=0;let G=-1,K=0,B=-1,H=!0,W=X.length-1,V=0;for(;W>=Y;--W){if(Z=X.charCodeAt(W),Z===47){if(!H){K=W+1;break}continue}if(B===-1)H=!1,B=W+1;if(Z===46){if(G===-1)G=W;else if(V!==1)V=1}else if(G!==-1)V=-1}if(G===-1||B===-1||V===0||V===1&&G===B-1&&G===K+1){if(B!==-1)if(K===0&&Q)J.base=J.name=X.slice(1,B);else J.base=J.name=X.slice(K,B)}else{if(K===0&&Q)J.name=X.slice(1,G),J.base=X.slice(1,B);else J.name=X.slice(K,G),J.base=X.slice(K,B);J.ext=X.slice(G,B)}if(K>0)J.dir=X.slice(0,K-1);else if(Q)J.dir="/";return J},sep:"/",fromFileUrl:Fj8,toFileUrl:Tj8,toNamespacedPath:t}),Pv0=E7(jg,Pg);var BV=Rg,vY=jg,Sj8=Pv0;var dq=(X,J,Z)=>{let Q=Z===void 0?J:Z,Y=Math.min(J-Q,X-Math.floor(Q/2));if(Y<0)Y=0;let G=Math.min(Y+Q,J);return{startIndex:Y,endIndex:G}};var Rv0="The selected directory contains files. Would you like to traverse the selected directory?",KP=SF(),Cg=KP.$is("Show"),xj8=V9(UQ,{style:"pretty"});function uq(X,J){return w0(X,{onNone:()=>w0(J.startingPath,{onNone:()=>L0(()=>process.cwd()),onSome:(Z)=>h($Q,(Q)=>R9(Q.exists(Z)).pipe(mi(t,`The provided starting path '${Z}' does not exist`),y9(Z)))}),onSome:(Z)=>y(Z)})}function qX0(X,J){return f0(function*(){let Z=yield*$Q,Q=yield*vY,Y=yield*R9(Z.readDirectory(X)).pipe(u((G)=>["..",...G]));return yield*Vx(Y,(G)=>{let K=J.filter(G),B=VX(K)?K:y(K),H=J.type==="directory"?u(R9(Z.stat(Q.join(X,G))),(W)=>W.type==="Directory"):y(!0);return tJ(B,H,(W,V)=>W&&V)},{concurrency:Y.length})})}function vj8(X){return(J,Z)=>{return f0(function*(){let Y=yield*(yield*m9).columns,G=yield*uq(J.path,X),K=`
194
+ `.repeat(Math.min(J.files.length,X.maxPerPage)),B=r7(G,Y),H=Cg(J.confirm)?Rv0:X.message,W=r7(`
195
+ ${H}`,Y);return r7(K,Y).pipe(Q0(B),Q0(W),xX(SX),V9({style:"pretty",options:{lineWidth:Y}}))})}}var kj8=/\r?\n/;function _X0(X,J,Z,Q){let Y=(K)=>k0(e0(K),k7),G=Q0(Z,m8);return l6(J.split(kj8),{onEmpty:()=>QZ([G,Q,X]),onNonEmpty:(K)=>{let B=n0(K,(H)=>Y(H));return G.pipe(Q0(hZ(J6(B),2)),Q0(m8),Q0(Q),Q0(m8),Q0(X))}})}function bj8(X,J,Z,Q,Y){let G=m8;if(Z===J.startIndex&&J.startIndex>0)G=Y.arrowUp;else if(Z===J.endIndex-1&&J.endIndex<Q)G=Y.arrowDown;return X.cursor===Z?Y.pointer.pipe(k0(T6),Q0(G)):G.pipe(Q0(m8))}function yj8(X,J){return J?k0(e0(X),$J(uQ,T6)):e0(X)}function gj8(X,J,Z,Q){let Y=J.length,G=dq(X.cursor,Y,Q.maxPerPage),K=[];for(let B=G.startIndex;B<G.endIndex;B++){let H=X.cursor===B,W=bj8(X,G,B,Y,Z),V=yj8(J[B],H);K.push(Q0(W,V))}return J6(K)}function hj8(X,J){return f0(function*(){let Z=yield*vY,Y=yield*(yield*m9).columns,G=yield*X7,K=yield*uq(X.path,J),B=X.files[X.cursor],H=Z.resolve(K,B),W=G.pointerSmall.pipe(Q0(m8),Q0(e0(H)),k0(e9));if(Cg(X.confirm)){let L=k0(e0("?"),T6),A=k0(G.pointerSmall,e9),M=k0(e0("(Y/n)"),e9),x=_X0(M,Rv0,L,A);return P5.pipe(Q0(x),Q0(uX),Q0(W),xX(SX),V9({style:"pretty",options:{lineWidth:Y}}))}let V=k0(G.tick,gZ),U=k0(G.ellipsis,e9),O=_X0(C9,J.message,V,U),q=gj8(X,X.files,G,J);return P5.pipe(Q0(O),Q0(uX),Q0(W),Q0(uX),Q0(q),xX(SX),V9({style:"pretty",options:{lineWidth:Y}}))})}function mj8(X,J){return f0(function*(){let Q=yield*(yield*m9).columns,Y=yield*X7,G=k0(Y.tick,gZ),K=k0(Y.ellipsis,e9);return _X0(C9,J.message,G,K).pipe(Q0(m8),Q0(k0(e0(X),b3)),Q0(uX),V9({style:"pretty",options:{lineWidth:Q}}))})}function dj8(X){return(J,Z)=>{return d0.$match(Z,{Beep:()=>y(xj8),NextFrame:({state:Q})=>hj8(Q,X),Submit:({value:Q})=>mj8(Q,X)})}}function uj8(X){let J=X.cursor-1;return y(d0.NextFrame({state:{...X,cursor:J<0?X.files.length-1:J}}))}function cj8(X){return y(d0.NextFrame({state:{...X,cursor:(X.cursor+1)%X.files.length}}))}function fj8(X,J){return f0(function*(){let Z=yield*$Q,Q=yield*vY,Y=yield*uq(X.path,J),G=X.files[X.cursor],K=Q.resolve(Y,G);if((yield*R9(Z.stat(K))).type==="Directory"){let H=yield*qX0(K,J),W=H.filter((V)=>V!=="..");if(J.type==="directory"||J.type==="either")return W.length===0?d0.Submit({value:K}):d0.NextFrame({state:{...X,confirm:KP.Show()}});return d0.NextFrame({state:{cursor:0,files:H,path:I(K),confirm:KP.Hide()}})}return d0.Submit({value:K})})}function pj8(X){return(J,Z)=>f0(function*(){switch(J.key.name){case"k":case"up":return yield*uj8(Z);case"j":case"down":case"tab":return yield*cj8(Z);case"enter":case"return":return yield*fj8(Z,X);case"y":case"t":{if(Cg(Z.confirm)){let Q=yield*vY,Y=yield*uq(Z.path,X),G=Z.files[Z.cursor],K=Q.resolve(Y,G),B=yield*qX0(K,X);return d0.NextFrame({state:{cursor:0,files:B,path:I(K),confirm:KP.Hide()}})}return d0.Beep()}case"n":case"f":{if(Cg(Z.confirm)){let Q=yield*vY,Y=yield*uq(Z.path,X),G=Z.files[Z.cursor],K=Q.resolve(Y,G);return d0.Submit({value:K})}return d0.Beep()}default:return d0.Beep()}})}var Ig=(X={})=>{let J={type:X.type??"file",message:X.message??"Choose a file",startingPath:x8(X.startingPath),maxPerPage:X.maxPerPage??10,filter:X.filter??(()=>y(!0))},Z=f0(function*(){let Q=S(),Y=yield*uq(Q,J),G=yield*qX0(Y,J),K=KP.Hide();return{cursor:0,files:G,path:Q,confirm:K}});return kJ(Z,{render:dj8(J),process:pj8(J),clear:vj8(J)})};var Iv0=hH.pipe(OM(),t9),Ev0=t9(hH),Sv0=V9(UQ,{style:"pretty"});function xv0(X){return(J,Z)=>{return f0(function*(){let Y=yield*(yield*m9).columns,G=Q0(zQ,EY),K=w0(J.error,{onNone:()=>C9,onSome:(H)=>kq(mq(H,Y)).pipe(Q0(r7(`
196
+ ${H}`,Y)))}),B=r7(X.message,Y);return K.pipe(Q0(B),Q0(G),xX(SX),V9({style:"pretty",options:{lineWidth:Y}}))})}}function Cv0(X,J){let Z=w0(X.error,{onNone:()=>$J(uQ,T6),onSome:()=>jY}),Q=X.value===""?C9:e0(`${X.value}`);return J?Q:k0(Q,Z)}var lj8=/\r?\n/;function nj8(X,J){return w0(X.error,{onNone:()=>C9,onSome:(Z)=>l6(Z.split(lj8),{onEmpty:()=>C9,onNonEmpty:(Q)=>{let Y=(B)=>k0(e0(B),$J(tW,jY)),G=Q0(k0(J,jY),m8),K=n0(Q,(B)=>Y(B));return ZV.pipe(Q0(uX),Q0(G),Q0(lH(J6(K))),Q0(QV))}})})}function vv0(X,J,Z,Q,Y=!1){let G=(B)=>k0(e0(B),k7),K=Q0(J,m8);return l6(Q.message.split(/\r?\n/),{onEmpty:()=>QZ([K,Z,Cv0(X,Y)]),onNonEmpty:(B)=>{let H=n0(B,(W)=>G(W));return K.pipe(Q0(hZ(J6(H),2)),Q0(m8),Q0(Z),Q0(m8),Q0(Cv0(X,Y)))}})}function kv0(X,J){return f0(function*(){let Q=yield*(yield*m9).columns,Y=yield*X7,G=k0(e0("?"),T6),K=k0(Y.pointerSmall,e9),B=nj8(X,Y.pointerSmall);return vv0(X,G,K,J).pipe(Q0(B),xX(SX),V9({style:"pretty",options:{lineWidth:Q}}))})}function bv0(X,J){return f0(function*(){let Q=yield*(yield*m9).columns,Y=yield*X7,G=k0(Y.tick,gZ),K=k0(Y.ellipsis,e9);return vv0(X,G,K,J,!0).pipe(Q0(uX),xX(SX),V9({style:"pretty",options:{lineWidth:Q}}))})}function yv0(X){if(X.value.length<=0)return y(d0.Beep());let J=X.value.slice(0,X.value.length-1);return y(d0.NextFrame({state:{...X,value:J,error:S()}}))}function ij8(X,J){if(X.value.length===0&&J==="-")return y(d0.NextFrame({state:{...X,value:"-",error:S()}}));return R7(Iv0(X.value+J),{onFailure:()=>d0.Beep(),onSuccess:(Z)=>d0.NextFrame({state:{...X,value:`${Z}`,error:S()}})})}function oj8(X,J){if(J==="."&&X.value.includes("."))return y(d0.Beep());if(X.value.length===0&&J==="-")return y(d0.NextFrame({state:{...X,value:"-",error:S()}}));return R7(Ev0(X.value+J),{onFailure:()=>d0.Beep(),onSuccess:(Z)=>d0.NextFrame({state:{...X,value:J==="."?`${Z}.`:`${Z}`,error:S()}})})}var gv0={cursor:0,value:"",error:S()};function rj8(X){return(J,Z)=>{return d0.$match(Z,{Beep:()=>y(Sv0),NextFrame:({state:Q})=>kv0(Q,X),Submit:()=>bv0(J,X)})}}function aj8(X){return(J,Z)=>{switch(J.key.name){case"backspace":return yv0(Z);case"k":case"up":return y(d0.NextFrame({state:{...Z,value:Z.value===""||Z.value==="-"?`${X.incrementBy}`:`${Number.parseInt(Z.value)+X.incrementBy}`,error:S()}}));case"j":case"down":return y(d0.NextFrame({state:{...Z,value:Z.value===""||Z.value==="-"?`-${X.decrementBy}`:`${Number.parseInt(Z.value)-X.decrementBy}`,error:S()}}));case"enter":case"return":return q9(Iv0(Z.value),{onFailure:()=>y(d0.NextFrame({state:{...Z,error:I("Must provide an integer value")}})),onSuccess:(Q)=>R7(X.validate(Q),{onFailure:(Y)=>d0.NextFrame({state:{...Z,error:I(Y)}}),onSuccess:(Y)=>d0.Submit({value:Y})})});default:{let Q=i0(J.input,()=>"");return ij8(Z,Q)}}}}var HV=(X)=>{let J={min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,incrementBy:1,decrementBy:1,validate:(Z)=>{if(Z<J.min)return Y0(`${Z} must be greater than or equal to ${J.min}`);if(Z>J.max)return Y0(`${Z} must be less than or equal to ${J.max}`);return y(Z)},...X};return kJ(gv0,{render:rj8(J),process:aj8(J),clear:xv0(J)})};function sj8(X){return(J,Z)=>{return d0.$match(Z,{Beep:()=>y(Sv0),NextFrame:({state:Q})=>kv0(Q,X),Submit:()=>bv0(J,X)})}}function tj8(X){return(J,Z)=>{switch(J.key.name){case"backspace":return yv0(Z);case"k":case"up":return y(d0.NextFrame({state:{...Z,value:Z.value===""||Z.value==="-"?`${X.incrementBy}`:`${Number.parseFloat(Z.value)+X.incrementBy}`,error:S()}}));case"j":case"down":return y(d0.NextFrame({state:{...Z,value:Z.value===""||Z.value==="-"?`-${X.decrementBy}`:`${Number.parseFloat(Z.value)-X.decrementBy}`,error:S()}}));case"enter":case"return":return q9(Ev0(Z.value),{onFailure:()=>y(d0.NextFrame({state:{...Z,error:I("Must provide a floating point value")}})),onSuccess:(Q)=>h(L0(()=>FK0(Q,X.precision)),(Y)=>R7(X.validate(Y),{onFailure:(G)=>d0.NextFrame({state:{...Z,error:I(G)}}),onSuccess:(G)=>d0.Submit({value:G})}))});default:{let Q=i0(J.input,()=>"");return oj8(Z,Q)}}}}var Eg=(X)=>{let J={min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,incrementBy:1,decrementBy:1,precision:2,validate:(Z)=>{if(Z<J.min)return Y0(`${Z} must be greater than or equal to ${J.min}`);if(Z>J.max)return Y0(`${Z} must be less than or equal to ${J.max}`);return y(Z)},...X};return kJ(gv0,{render:sj8(J),process:tj8(J),clear:xv0(J)})};var ej8=V9(UQ,{style:"pretty"}),XC8=/\r?\n/;function hv0(X,J,Z){let Q=(G)=>k0(e0(G),k7),Y=Q0(X,m8);return l6(Z.message.split(XC8),{onEmpty:()=>QZ([Y,J]),onNonEmpty:(G)=>{let K=n0(G,(B)=>Q(B));return Y.pipe(Q0(hZ(J6(K),2)),Q0(m8),Q0(J),Q0(m8))}})}function JC8(X,J,Z,Q,Y){let G=m8;if(Q===Z.startIndex&&Z.startIndex>0)G=Y.arrowUp;else if(Q===Z.endIndex-1&&Z.endIndex<J.length)G=Y.arrowDown;if(J[Q].disabled){let K=$J(k7,e9);return X===Q?Y.pointer.pipe(k0(K),Q0(G)):G.pipe(Q0(m8))}return X===Q?Y.pointer.pipe(k0(T6),Q0(G)):G.pipe(Q0(m8))}function ZC8(X,J){let Z=e0(X.title);if(J)return X.disabled?k0(Z,$J(uQ,e9)):k0(Z,$J(uQ,T6));return X.disabled?k0(Z,$J(ES0,e9)):Z}function QC8(X,J){if(!X.disabled&&X.description&&J)return Hz("-").pipe(Q0(m8),Q0(e0(X.description)),k0(e9));return C9}function YC8(X,J,Z){let Q=J.choices,Y=dq(X,Q.length,J.maxPerPage),G=[];for(let K=Y.startIndex;K<Y.endIndex;K++){let B=Q[K],H=X===K,W=JC8(X,Q,Y,K,Z),V=ZC8(B,H),U=QC8(B,H);G.push(W.pipe(Q0(V),Q0(m8),Q0(U)))}return J6(G)}function GC8(X,J){return f0(function*(){let Q=yield*(yield*m9).columns,Y=yield*X7,G=YC8(X,J,Y),K=k0(e0("?"),T6),B=k0(Y.pointerSmall,e9),H=hv0(K,B,J);return P5.pipe(Q0(H),Q0(uX),Q0(G),V9({style:"pretty",options:{lineWidth:Q}}))})}function KC8(X,J){return f0(function*(){let Q=yield*(yield*m9).columns,Y=yield*X7,G=e0(J.choices[X].title),K=k0(Y.tick,gZ),B=k0(Y.ellipsis,e9);return hv0(K,B,J).pipe(Q0(m8),Q0(k0(G,b3)),Q0(uX),V9({style:"pretty",options:{lineWidth:Q}}))})}function BC8(X,J){if(X===0)return y(d0.NextFrame({state:J.length-1}));return y(d0.NextFrame({state:X-1}))}function HC8(X,J){if(X===J.length-1)return y(d0.NextFrame({state:0}));return y(d0.NextFrame({state:X+1}))}function WC8(X,J){return y(d0.NextFrame({state:(X+1)%J.length}))}function VC8(X){return(J,Z)=>{return d0.$match(Z,{Beep:()=>y(ej8),NextFrame:({state:Q})=>GC8(Q,X),Submit:()=>KC8(J,X)})}}function $C8(X){return f0(function*(){let Z=yield*(yield*m9).columns,Q=Q0(zQ,EY),Y=`
197
+ `.repeat(Math.min(X.choices.length,X.maxPerPage))+X.message;return r7(Y,Z).pipe(Q0(Q),xX(SX),V9({style:"pretty",options:{lineWidth:Z}}))})}function UC8(X){return(J,Z)=>{switch(J.key.name){case"k":case"up":return BC8(Z,X.choices);case"j":case"down":return HC8(Z,X.choices);case"tab":return WC8(Z,X.choices);case"enter":case"return":{let Q=X.choices[Z];if(Q.disabled)return y(d0.Beep());return y(d0.Submit({value:Q.value}))}default:return y(d0.Beep())}}}var I5=(X)=>{let J={maxPerPage:10,...X},Z=0,Q=-1;for(let Y=0;Y<J.choices.length;Y++)if(J.choices[Y].selected===!0){if(Q!==-1)throw Error("InvalidArgumentException: only a single choice can be selected by default for Prompt.select");Q=Y}if(Q!==-1)Z=Q;return kJ(Z,{render:VC8(J),process:UC8(J),clear:()=>$C8(J)})};function DX0(X,J){return X.value.length>0?X.value:J.default}var zC8=V9(UQ,{style:"pretty"});function NC8(X,J){return f0(function*(){let Q=yield*(yield*m9).columns,Y=Q0(zQ,EY),G=w0(X.error,{onNone:()=>C9,onSome:(W)=>kq(mq(W,Q)).pipe(Q0(r7(`
198
+ ${W}`,Q)))}),K=X.value.length>0?X.value:J.default,B=`? ${J.message} › ${K}`,H=r7(B,Q);return G.pipe(Q0(H),Q0(Y),xX(SX),V9({style:"pretty",options:{lineWidth:Q}}))})}function mv0(X,J,Z){let Q=DX0(X,J),Y=w0(X.error,{onNone:()=>{if(Z)return b3;if(X.value.length===0)return e9;return $J(uQ,T6)},onSome:()=>jY});switch(J.type){case"hidden":return C9;case"password":return k0(e0("*".repeat(Q.length)),Y);case"text":return k0(e0(Q),Y)}}function OC8(X,J){return w0(X.error,{onNone:()=>C9,onSome:(Z)=>l6(Z.split(/\r?\n/),{onEmpty:()=>C9,onNonEmpty:(Q)=>{let Y=(B)=>e0(B).pipe(k0($J(tW,jY))),G=Q0(k0(J,jY),m8),K=n0(Q,(B)=>Y(B));return ZV.pipe(Q0(uX),Q0(G),Q0(lH(J6(K))),Q0(QV))}})})}function dv0(X,J,Z,Q,Y=!1){let G=(H)=>k0(e0(H),k7),K=Q.message.split(/\r?\n/),B=Q0(J,m8);if(B8(K)){let H=n0(K,(W)=>G(W));return B.pipe(Q0(hZ(J6(H),2)),Q0(m8),Q0(Z),Q0(m8),Q0(mv0(X,Q,Y)))}return QZ([B,Z,mv0(X,Q,Y)])}function _C8(X,J){return f0(function*(){let Q=yield*(yield*m9).columns,Y=yield*X7,G=k0(e0("?"),T6),K=k0(Y.pointerSmall,e9),B=dv0(X,G,K,J),H=OC8(X,Y.pointerSmall),W=X.cursor-X.value.length;return B.pipe(Q0(H),Q0(jx0(W)),xX(SX),V9({style:"pretty",options:{lineWidth:Q}}))})}function qC8(X,J){return f0(function*(){let Q=yield*(yield*m9).columns,Y=yield*X7,G=k0(Y.tick,gZ),K=k0(Y.ellipsis,e9);return dv0(X,G,K,J,!0).pipe(Q0(uX),xX(SX),V9({style:"pretty",options:{lineWidth:Q}}))})}function DC8(X){if(X.cursor<=0)return y(d0.Beep());let J=X.value.slice(0,X.cursor-1),Z=X.value.slice(X.cursor),Q=X.cursor-1,Y=`${J}${Z}`;return y(d0.NextFrame({state:{...X,cursor:Q,value:Y,error:S()}}))}function wC8(X){if(X.cursor<=0)return y(d0.Beep());let J=X.cursor-1;return y(d0.NextFrame({state:{...X,cursor:J,error:S()}}))}function LC8(X){if(X.cursor>=X.value.length)return y(d0.Beep());let J=Math.min(X.cursor+1,X.value.length);return y(d0.NextFrame({state:{...X,cursor:J,error:S()}}))}function FC8(X,J){if(X.value===J.default)return y(d0.Beep());let Z=DX0(X,J),Q=Z.length;return y(d0.NextFrame({state:{...X,value:Z,cursor:Q,error:S()}}))}function AC8(X,J){let Z=J.value.slice(0,J.cursor),Q=J.value.slice(J.cursor),Y=`${Z}${X}${Q}`,G=J.cursor+X.length;return y(d0.NextFrame({state:{...J,cursor:G,value:Y,error:S()}}))}var TC8={cursor:0,value:"",error:S()};function MC8(X){return(J,Z)=>{return d0.$match(Z,{Beep:()=>y(zC8),NextFrame:({state:Q})=>_C8(Q,X),Submit:()=>qC8(J,X)})}}function PC8(X){return(J,Z)=>{switch(J.key.name){case"backspace":return DC8(Z);case"left":return wC8(Z);case"right":return LC8(Z);case"enter":case"return":{let Q=DX0(Z,X);return R7(X.validate(Q),{onFailure:(Y)=>d0.NextFrame({state:{...Z,value:Q,error:I(Y)}}),onSuccess:(Y)=>d0.Submit({value:Y})})}case"tab":return FC8(Z,X);default:{let Q=i0(J.input,()=>"");return AC8(Q,Z)}}}}function RC8(X){return(J,Z)=>{return NC8(J,X)}}function wX0(X,J){let Z={default:"",type:J,validate:y,...X};return kJ(TC8,{render:MC8(Z),process:PC8(Z),clear:RC8(Z)})}var HP=(X)=>wX0(X,"hidden").pipe(YZ(L5)),uv0=(X)=>wX0(X,"password").pipe(YZ(L5)),cq=(X)=>wX0(X,"text");var jC8=V9(UQ,{style:"pretty"});function CC8(X){return f0(function*(){let Z=yield*(yield*m9).columns,Q=Q0(zQ,EY);return r7(X.message,Z).pipe(Q0(Q),xX(SX),V9({style:"pretty",options:{lineWidth:Z}}))})}function pv0(X,J,Z=!1){let Q=k0(Hz("/"),e9),Y=$J(uQ,Z?b3:T6),G=X?e0(J.inactive):k0(e0(J.inactive),Y),K=X?k0(e0(J.active),Y):e0(J.active);return QZ([K,Q,G])}function lv0(X,J,Z,Q){let Y=(B)=>k0(e0(B),k7),G=Q.message.split(/\r?\n/),K=Q0(J,m8);if(B8(G)){let B=n0(G,(H)=>Y(H));return K.pipe(Q0(hZ(J6(B),2)),Q0(m8),Q0(Z),Q0(m8),Q0(X))}return QZ([K,Z,X])}function IC8(X,J){return f0(function*(){let Z=yield*m9,Q=yield*X7,Y=yield*Z.columns,G=k0(e0("?"),T6),K=k0(Q.pointerSmall,e9),B=pv0(X,J),H=lv0(B,G,K,J);return P5.pipe(Q0(H),xX(SX),V9({style:"pretty",options:{lineWidth:Y}}))})}function EC8(X,J){return f0(function*(){let Z=yield*m9,Q=yield*X7,Y=yield*Z.columns,G=k0(Q.tick,gZ),K=k0(Q.ellipsis,e9),B=pv0(X,J,!0);return lv0(B,G,K,J).pipe(Q0(uX),xX(SX),V9({style:"pretty",options:{lineWidth:Y}}))})}var cv0=y(d0.NextFrame({state:!0})),fv0=y(d0.NextFrame({state:!1}));function SC8(X){return(J,Z)=>{switch(Z._tag){case"Beep":return y(jC8);case"NextFrame":return IC8(J,X);case"Submit":return EC8(J,X)}}}function xC8(X,J){switch(X.key.name){case"0":case"j":case"delete":case"right":case"down":return fv0;case"1":case"k":case"left":case"up":return cv0;case" ":case"tab":return J?fv0:cv0;case"enter":case"return":return y(d0.Submit({value:J}));default:return y(d0.Beep())}}var fq=(X)=>{let J={initial:!1,active:"on",inactive:"off",...X};return kJ(J.initial,{render:SC8(J),process:xC8,clear:()=>CC8(J)})};var vC8="@effect/cli/Primitive",nv0=Symbol.for(vC8),rH={[nv0]:{_A:(X)=>X},pipe(){return K0(this,arguments)}},kC8=(X)=>typeof X==="object"&&X!=null&&(nv0 in X),WP=(X)=>kC8(X)&&bC8(X),bC8=(X)=>X._tag==="Bool";var yC8=s0("true","1","y","yes","on"),VP=XW(yC8),gC8=s0("false","0","n","no","off"),$P=XW(gC8),UP=(X)=>{let J=Object.create(rH);return J._tag="Bool",J.defaultValue=X,J},zP=(X)=>{let J=Object.create(rH);return J._tag="Choice",J.alternatives=X,J},xg=(()=>{let X=Object.create(rH);return X._tag="DateTime",X})(),vg=(()=>{let X=Object.create(rH);return X._tag="Float",X})(),kg=(()=>{let X=Object.create(rH);return X._tag="Integer",X})(),Nz=(X,J)=>{let Z=Object.create(rH);return Z._tag="Path",Z.pathType=X,Z.pathExists=J,Z},bg=(()=>{let X=Object.create(rH);return X._tag="Redacted",X})(),yg=(()=>{let X=Object.create(rH);return X._tag="Secret",X})(),NP=(()=>{let X=Object.create(rH);return X._tag="Text",X})(),OP=(X)=>hC8(X),gg=(X)=>mC8(X),lq=(X)=>zz(X),nq=$(3,(X,J,Z)=>dC8(X,J,Z)),hg=$(2,(X,J)=>fC8(X,J)),hC8=(X)=>{switch(X._tag){case"Bool":return I("true | false");case"Choice":{let J=z(n0(X.alternatives,([Z])=>Z),s8(" | "));return I(J)}case"DateTime":return I("date");case"Float":case"Integer":case"Path":case"Redacted":case"Secret":case"Text":return S()}},mC8=(X)=>{switch(X._tag){case"Bool":return d8("A true or false value.");case"Choice":{let J=z(n0(X.alternatives,([Z])=>Z),s8(", "));return d8(`One of the following: ${J}`)}case"DateTime":return d8("A date without a time-zone in the ISO-8601 format, such as 2007-12-03T10:15:30.");case"Float":return d8("A floating point number.");case"Integer":return d8("An integer.");case"Path":{if(X.pathType==="either"&&X.pathExists==="yes")return d8("An existing file or directory.");if(X.pathType==="file"&&X.pathExists==="yes")return d8("An existing file.");if(X.pathType==="directory"&&X.pathExists==="yes")return d8("An existing directory.");if(X.pathType==="either"&&X.pathExists==="no")return d8("A file or directory that must not exist.");if(X.pathType==="file"&&X.pathExists==="no")return d8("A file that must not exist.");if(X.pathType==="directory"&&X.pathExists==="no")return d8("A directory that must not exist.");if(X.pathType==="either"&&X.pathExists==="either")return d8("A file or directory.");if(X.pathType==="file"&&X.pathExists==="either")return d8("A file.");if(X.pathType==="directory"&&X.pathExists==="either")return d8("A directory.");throw Error(`[BUG]: Path.help - encountered invalid combination of path type ('${X.pathType}') and path existence ('${X.pathExists}')`)}case"Secret":case"Redacted":return d8("A user-defined piece of text that is confidential.");case"Text":return d8("A user-defined piece of text.")}},zz=(X)=>{switch(X._tag){case"Bool":return"boolean";case"Choice":return"choice";case"DateTime":return"date";case"Float":return"float";case"Integer":return"integer";case"Path":{if(X.pathType==="either")return"path";return X.pathType}case"Redacted":return"redacted";case"Secret":return"secret";case"Text":return"text"}},dC8=(X,J,Z)=>{switch(X._tag){case"Bool":return r8(J,(Q)=>UJ(Z,Q)).pipe(w0({onNone:()=>NU(X.defaultValue,()=>"Missing default value for boolean parameter"),onSome:(Q)=>VP(Q)?y(!0):$P(Q)?y(!1):Y0(`Unable to recognize '${Q}' as a valid boolean`)}));case"Choice":return NU(J,()=>"Choice options to not have a default value").pipe(h((Q)=>EK(X.alternatives,([Y])=>Y===Q)),vG({onFailure:()=>{return`Expected one of the following cases: ${z(n0(X.alternatives,([Y])=>Y),s8(", "))}`},onSuccess:([,Q])=>Q}));case"DateTime":return pq(J,zz(X),t9(fb));case"Float":return pq(J,zz(X),t9(hH));case"Integer":{let Q=oU(hH,F5);return pq(J,zz(X),t9(Q))}case"Path":return h($Q,(Q)=>{return NU(J,()=>"Path options do not have a default value").pipe(J9((G)=>R9(Q.exists(G)).pipe(J9((K)=>uC8(G,X.pathExists,K).pipe(C0(cC8(G,X.pathType,Q).pipe(A4(()=>X.pathExists!=="no"&&K))))))))});case"Redacted":return pq(J,zz(X),t9(d)).pipe(u((Q)=>L5(Q)));case"Secret":return pq(J,zz(X),t9(d)).pipe(u((Q)=>dx0(Q)));case"Text":return pq(J,zz(X),t9(d))}},pq=(X,J,Z)=>NU(X,()=>`${J} options do not have a default value`).pipe(h((Q)=>NU(Z(Q),()=>`'${Q}' is not a ${J}`))),uC8=(X,J,Z)=>{if(J==="no"&&Z)return Y0(`Path '${X}' must not exist`);if(J==="yes"&&!Z)return Y0(`Path '${X}' must exist`);return U0},cC8=(X,J,Z)=>{switch(J){case"file":{let Q=Z.stat(X).pipe(u((Y)=>Y.type==="File"),R9);return Y0(`Expected path '${X}' to be a regular file`).pipe(Nx(Q),p7)}case"directory":{let Q=Z.stat(X).pipe(u((Y)=>Y.type==="Directory"),R9);return Y0(`Expected path '${X}' to be a directory`).pipe(Nx(Q),p7)}case"either":return U0}},fC8=(X,J)=>{switch(X._tag){case"Bool":{let Z=h0("Select true or false"),Q=I8(J,Z),Y=i0(X.defaultValue,()=>!1);return fq({message:BX(Q).trimEnd(),initial:Y,active:"true",inactive:"false"}).pipe(YZ((G)=>`${G}`))}case"Choice":{let Z=h0("Select one of the following choices"),Q=I8(J,Z);return I5({message:BX(Q).trimEnd(),choices:n0(X.alternatives,([Y])=>({title:Y,value:Y}))})}case"DateTime":{let Z=h0("Enter a date"),Q=I8(J,Z);return Mg({message:BX(Q).trimEnd()}).pipe(YZ((Y)=>Y.toISOString()))}case"Float":{let Z=h0("Enter a floating point value"),Q=I8(J,Z);return Eg({message:BX(Q).trimEnd()}).pipe(YZ((Y)=>`${Y}`))}case"Integer":{let Z=h0("Enter an integer"),Q=I8(J,Z);return HV({message:BX(Q).trimEnd()}).pipe(YZ((Y)=>`${Y}`))}case"Path":{let Z=h0("Select a file system path"),Q=I8(J,Z);return Ig({type:X.pathType,message:BX(Q).trimEnd()})}case"Redacted":{let Z=h0("Enter some text (value will be redacted)"),Q=I8(J,Z);return HP({message:BX(Q).trimEnd()})}case"Secret":{let Z=h0("Enter some text (value will be redacted)"),Q=I8(J,Z);return HP({message:BX(Q).trimEnd()})}case"Text":{let Z=h0("Enter some text"),Q=I8(J,Z);return cq({message:BX(Q).trimEnd()})}}},iv0=(X)=>{switch(X._tag){case"Bool":return'"${cur}"';case"DateTime":case"Float":case"Integer":case"Secret":case"Redacted":case"Text":return'$(compgen -f "${cur}")';case"Path":switch(X.pathType){case"file":return X.pathExists==="yes"||X.pathExists==="either"?'$(compgen -f "${cur}")':"";case"directory":return X.pathExists==="yes"||X.pathExists==="either"?'$(compgen -d "${cur}")':"";case"either":return X.pathExists==="yes"||X.pathExists==="either"?'$(compgen -f "${cur}")':""}case"Choice":return`$(compgen -W "${z(n0(X.alternatives,([Z])=>Z),s8(","))}" -- "\${cur}")`}},mg=(X)=>{switch(X._tag){case"Bool":return l0();case"DateTime":case"Float":case"Integer":case"Redacted":case"Secret":case"Text":return p6("-r","-f");case"Path":switch(X.pathType){case"file":return X.pathExists==="yes"||X.pathExists==="either"?p6("-r","-F"):p6("-r");case"directory":return X.pathExists==="yes"||X.pathExists==="either"?p6("-r","-f","-a",'"(__fish_complete_directories (commandline -ct))"'):p6("-r");case"either":return X.pathExists==="yes"||X.pathExists==="either"?p6("-r","-F"):p6("-r")}case"Choice":{let J=z(n0(X.alternatives,([Z])=>`${Z}''`),s8(","));return p6("-r","-f","-a",`"{${J}}"`)}}},dg=(X)=>{switch(X._tag){case"Bool":return"";case"Choice":return`:CHOICE:(${z(n0(X.alternatives,([Z])=>Z),s8(" "))})`;case"DateTime":return"";case"Float":return"";case"Integer":return"";case"Path":switch(X.pathType){case"file":return X.pathExists==="yes"||X.pathExists==="either"?":PATH:_files":"";case"directory":return X.pathExists==="yes"||X.pathExists==="either"?":PATH:_files -/":"";case"either":return X.pathExists==="yes"||X.pathExists==="either"?":PATH:_files":""}case"Redacted":case"Secret":case"Text":return""}};var aH={_tag:"Empty"},AX0={_tag:"Empty"},WV=(X,J)=>({_tag:"Named",names:X,acceptedValues:J}),_P=(X)=>({_tag:"Optional",usage:X}),qP=(X)=>({_tag:"Repeated",usage:X}),TX0=$(2,(X,J)=>({_tag:"Alternation",left:X,right:J})),f3=$(2,(X,J)=>({_tag:"Concat",left:X,right:J})),ug=(X)=>{let J=MX0(X,GV);if(B8(J)){let Z=c9(J),Q=n6(J);if(B8(Q))return z(n0(J,(Y)=>h0(Y)),JY(cX,(Y,G)=>I8(Y,G)));return h0(Z)}return cX},MX0=$(2,(X,J)=>c3(Oz(X,J),J)),Oz=(X,J)=>{switch(X._tag){case"Empty":return aH;case"Mixed":return AX0;case"Named":{if(j8(mJ(c3(X,J))))return aH;return X}case"Optional":{if(X.usage._tag==="Empty")return aH;let Z=Oz(X.usage,J);return Z._tag==="Empty"?aH:Z._tag==="Optional"?Z:_P(Z)}case"Repeated":{let Z=Oz(X.usage,J);return Z._tag==="Empty"?aH:qP(Z)}case"Alternation":{let Z=Oz(X.left,J),Q=Oz(X.right,J);return Z._tag==="Empty"?Q:Q._tag==="Empty"?Z:TX0(Z,Q)}case"Concat":{let Z=Oz(X.left,J),Q=Oz(X.right,J);return Z._tag==="Empty"?Q:Q._tag==="Empty"?Z:f3(Z,Q)}}},c3=(X,J)=>{switch(X._tag){case"Empty":return X8(d8(""));case"Mixed":return X8(d8("<command>"));case"Named":{let Z=J.showTypes?w0(X.acceptedValues,{onNone:()=>R5,onSome:(G)=>mZ(SY,d8(G))}):R5,Q=J.showAllNames?X.names:X.names.length>1?z(xK(X.names,(G)=>G.startsWith("--")),mJ,r8(X8),i0(()=>X.names)):X.names,Y=d8(s8(Q,", "));return J.showAllNames&&X.names.length>1?X8(xY([d8("("),Y,Z,d8(")")])):X8(mZ(Y,Z))}case"Optional":return n0(c3(X.usage,J),(Z)=>xY([d8("["),Z,d8("]")]));case"Repeated":return n0(c3(X.usage,J),(Z)=>mZ(Z,d8("...")));case"Alternation":{if(X.left._tag==="Repeated"||X.right._tag==="Repeated"||X.left._tag==="Concat"||X.right._tag==="Concat")return z8(c3(X.left,J),c3(X.right,J));return S6(c3(X.left,J),(Z)=>n0(c3(X.right,J),(Q)=>xY([Z,d8("|"),Q])))}case"Concat":{let Z=c3(X.left,J),Q=c3(X.right,J),Y=B8(Z)&&B8(Q)?SY:R5;return S6(Z,(G)=>n0(Q,(K)=>xY([G,Y,K])))}}};var DP=Symbol.for("@effect/cli/ValidationError"),p4={[DP]:DP},VV=(X)=>typeof X==="object"&&X!=null&&(DP in X),wP=(X)=>X._tag==="CommandMismatch",rv0=(X)=>X._tag==="CorrectedFlag",fg=(X)=>X._tag==="HelpRequested",av0=(X)=>X._tag==="InvalidArgument",sv0=(X)=>X._tag==="InvalidValue",LP=(X)=>X._tag==="MultipleValuesDetected",tv0=(X)=>X._tag==="MissingFlag",FP=(X)=>X._tag==="MissingValue",ev0=(X)=>X._tag==="MissingSubcommand",Xk0=(X)=>X._tag==="NoBuiltInMatch",Jk0=(X)=>X._tag==="UnclusteredFlag",sH=(X)=>{let J=Object.create(p4);return J._tag="CommandMismatch",J.error=X,J},pg=(X)=>{let J=Object.create(p4);return J._tag="CorrectedFlag",J.error=X,J},p3=(X)=>{let J=Object.create(p4);return J._tag="InvalidArgument",J.error=X,J},b7=(X)=>{let J=Object.create(p4);return J._tag="InvalidValue",J.error=X,J},iq=(X)=>{let J=Object.create(p4);return J._tag="MissingFlag",J.error=X,J},E5=(X)=>{let J=Object.create(p4);return J._tag="MissingValue",J.error=X,J},Zk0=(X)=>{let J=Object.create(p4);return J._tag="MissingSubcommand",J.error=X,J},lg=(X,J)=>{let Z=Object.create(p4);return Z._tag="MultipleValuesDetected",Z.error=X,Z.values=J,Z},ng=(X)=>{let J=Object.create(p4);return J._tag="NoBuiltInMatch",J.error=X,J},AP=(X,J,Z)=>{let Q=Object.create(p4);return Q._tag="UnclusteredFlag",Q.error=X,Q.unclustered=J,Q.rest=Z,Q};var pC8="@effect/cli/Args",og=Symbol.for(pC8),Lz={[og]:{_A:(X)=>X},pipe(){return K0(this,arguments)}},PP=(X)=>typeof X==="object"&&X!=null&&(og in X),lC8=(X)=>X,Yk0=(X)=>X._tag==="Empty";var nC8=(X)=>X._tag==="WithDefault";var rg=function(){if(arguments.length===1)if(PP(arguments[0]))return tH(arguments[0],(X)=>[X]);else if(IK(arguments[0]))return Qk0(arguments[0]);else{let X=Object.entries(arguments[0]),J=tH(X[0][1],(Q)=>({[X[0][0]]:Q}));if(X.length===1)return J;let Z=X.slice(1);for(let[Q,Y]of Z)J=tH(IX0(J,Y),([G,K])=>({...G,[Q]:K}));return J}return Qk0(arguments[0])},Gk0=(X)=>l4(x8(X?.name),UP(S())),Kk0=(X,J)=>l4(x8(J?.name),zP(X)),Bk0=(X)=>l4(x8(X?.name),xg),Hk0=(X)=>l4(x8(X?.name),Nz("directory",X?.exists||"either")),ag=(X)=>l4(x8(X?.name),Nz("file",X?.exists||"either")),Wk0=(X)=>UV(ag({...X,exists:"yes"}),(J)=>E9(fy(J),(Z)=>h0(Z))),PX0=(X)=>UV(RX0(X),([J,Z])=>E9(ly(J,Z,X?.format),(Q)=>h0(Q))),Vk0=(X,J)=>CX0(PX0(J),X),RX0=(X)=>UV(ag({...X,exists:"yes"}),(J)=>E9(py(J),(Z)=>h0(Z))),$k0=(X)=>l4(x8(X?.name),vg),Uk0=(X)=>l4(x8(X?.name),kg),Fz=(()=>{let X=Object.create(Lz);return X._tag="Empty",X})(),zk0=(X)=>l4(x8(X?.name),Nz("either",X?.exists||"either")),Nk0=(X)=>l4(x8(X?.name),bg),Ok0=(X)=>l4(x8(X?.name),yg),_k0=(X)=>l4(x8(X?.name),NP),qk0=$(2,(X,J)=>RP(X,I(J),S())),Dk0=$(2,(X,J)=>RP(X,S(),I(J))),wk0=$(3,(X,J,Z)=>RP(X,I(J),I(Z))),sg=(X)=>JK(X),Lk0=(X)=>ig(X),Fk0=(X)=>Dz(X),Ak0=(X)=>wz(X),tg=(X)=>oq(X),tH=$(2,(X,J)=>UV(X,(Z)=>y(J(Z)))),UV=$(2,(X,J)=>Ck0(X,J)),Tk0=$(3,(X,J,Z)=>UV(X,(Q)=>{try{return O0(J(Q))}catch(Y){return M0(Z(Y))}})),Mk0=(X)=>Jh(tH(X,I),S()),Pk0=(X)=>RP(X,S(),S()),eg=$(3,(X,J,Z)=>ZK(X,J,Z)),Rk0=$(2,(X,J)=>Jh(X,J)),jX0=$(2,(X,J)=>{if(lC8(X)&&nC8(X))return Jh(jX0(X.args,J),X.fallback);return Ik0(X,J)}),CX0=$(2,(X,J)=>{let Z=cx(J);return UV(X,(Q)=>E9(Z(Q),(Y)=>h0(D5.formatIssueSync(Y))))}),jk0=$(2,(X,J)=>_z(X,J)),Xh=$(2,(X,J)=>qz(X,J)),Qk0=(X)=>{if(X.length===0)return Fz;if(X.length===1)return tH(X[0],(Z)=>[Z]);let J=tH(X[0],(Z)=>[Z]);for(let Z=1;Z<X.length;Z++){let Q=X[Z];J=tH(IX0(J,Q),([Y,G])=>[...Y,G])}return J},JK=(X)=>{switch(X._tag){case"Empty":return cX;case"Single":return oH([[kx0(X.name),I8(h0(gg(X.primitiveType)),X.description)]]);case"Map":return JK(X.args);case"Both":return I8(JK(X.left),JK(X.right));case"Variadic":{let J=JK(X.args);return XK(J,(Z,Q)=>{let Y=Dz(X),G=wz(X),K=d8(R0(X.max)?` ${Y} - ${G}`:Y===0?"...":` ${Y}+`),B=h0(R0(X.max)?`This argument must be repeated at least ${Y} times and may be repeated up to ${G} times.`:Y===0?"This argument may be repeated zero or more times.":`This argument must be repeated at least ${Y} times.`);return[mZ(Z,K),I8(Q,B)]})}case"WithDefault":return XK(JK(X.args),(J,Z)=>{let Q=OB(X.fallback)?w0(X.fallback,{onNone:()=>h0("This setting is optional."),onSome:(Y)=>{let G=c6(Y)?Y:String(Y),K=sQ(G,0);return h0(`This setting is optional. Defaults to: ${K}`)}}):h0("This setting is optional.");return[J,I8(Z,Q)]});case"WithFallbackConfig":return XK(JK(X.args),(J,Z)=>[J,I8(Z,h0("This argument can be set from environment variables."))])}},ig=(X)=>{switch(X._tag){case"Empty":return S();case"Single":return I(X.name);case"Map":case"Variadic":case"WithDefault":case"WithFallbackConfig":return ig(X.args);case"Both":{let J=SK([ig(X.left),ig(X.right)]);return l6(J,{onEmpty:()=>S(),onNonEmpty:(Z)=>I(s8(Z,", "))})}}},Dz=(X)=>{switch(X._tag){case"Empty":case"WithDefault":case"WithFallbackConfig":return 0;case"Single":return 1;case"Map":return Dz(X.args);case"Both":{let J=Dz(X.left),Z=Dz(X.right);return J+Z}case"Variadic":{let J=Dz(X.args);return Math.floor(i0(X.min,()=>0)*J)}}},wz=(X)=>{switch(X._tag){case"Empty":return 0;case"Single":return 1;case"Map":case"WithDefault":case"WithFallbackConfig":return wz(X.args);case"Both":{let J=wz(X.left),Z=wz(X.right);return J+Z}case"Variadic":{let J=wz(X.args);return Math.floor(i0(X.max,()=>Number.MAX_SAFE_INTEGER/2)*J)}}},oq=(X)=>{switch(X._tag){case"Empty":return aH;case"Single":return WV(X8(X.name),OP(X.primitiveType));case"Map":return oq(X.args);case"Both":return f3(oq(X.left),oq(X.right));case"Variadic":return qP(oq(X.args));case"WithDefault":case"WithFallbackConfig":return _P(oq(X.args))}},l4=(X,J,Z=cX)=>{let Q=Object.create(Lz);return Q._tag="Single",Q.name=`<${i0(X,()=>lq(J))}>`,Q.pseudoName=X,Q.primitiveType=J,Q.description=Z,Q},Ck0=(X,J)=>{let Z=Object.create(Lz);return Z._tag="Map",Z.args=X,Z.f=J,Z},IX0=(X,J)=>{let Z=Object.create(Lz);return Z._tag="Both",Z.left=X,Z.right=J,Z},Jh=(X,J)=>{let Z=Object.create(Lz);return Z._tag="WithDefault",Z.args=X,Z.fallback=J,Z},Ik0=(X,J)=>{let Z=Object.create(Lz);return Z._tag="WithFallbackConfig",Z.args=X,Z.config=J,Z},RP=(X,J,Z)=>{let Q=Object.create(Lz);return Q._tag="Variadic",Q.args=X,Q.min=J,Q.max=Z,Q},ZK=(X,J,Z)=>{switch(X._tag){case"Empty":return y([J,void 0]);case"Single":return o0(()=>{return hJ(J,{onEmpty:()=>{let Q=OP(X.primitiveType);if(R0(X.pseudoName)&&R0(Q))return Y0(E5(h0(`Missing argument <${X.pseudoName.value}> with choices ${Q.value}`)));if(R0(X.pseudoName))return Y0(E5(h0(`Missing argument <${X.pseudoName.value}>`)));if(R0(Q))return Y0(E5(h0(`Missing argument ${lq(X.primitiveType)} with choices ${Q.value}`)));return Y0(E5(h0(`Missing argument ${lq(X.primitiveType)}`)))},onNonEmpty:(Q,Y)=>nq(X.primitiveType,I(Q),Z).pipe(vG({onFailure:(G)=>p3(h0(G)),onSuccess:(G)=>[Y,G]}))})});case"Map":return ZK(X.args,J,Z).pipe(h(([Q,Y])=>q9(X.f(Y),{onFailure:(G)=>Y0(p3(G)),onSuccess:(G)=>y([Q,G])})));case"Both":return ZK(X.left,J,Z).pipe(h(([Q,Y])=>ZK(X.right,Q,Z).pipe(u(([G,K])=>[G,[Y,K]]))));case"Variadic":{let Q=i0(X.min,()=>0),Y=i0(X.max,()=>Number.MAX_SAFE_INTEGER),G=(K,B)=>{if(B.length>=Y)return y([K,B]);return ZK(X.args,K,Z).pipe(q9({onFailure:(H)=>B.length>=Q&&G7(K)?y([K,B]):Y0(H),onSuccess:([H,W])=>G(H,lX(B,W))}))};return G(J,l0()).pipe(u(([K,B])=>[K,B]))}case"WithDefault":return ZK(X.args,J,Z).pipe(QQ("MissingValue",()=>y([J,X.fallback])));case"WithFallbackConfig":return ZK(X.args,J,Z).pipe(QQ("MissingValue",(Q)=>u(y6(X.config,(Y)=>{if(sV(Y)){let G=h0(String(Y)),K=b7(G);return Y0(K)}return Y0(Q)}),(Y)=>[J,Y])))}},_z=(X,J)=>{switch(X._tag){case"Empty":return Fz;case"Single":{let Z=I8(X.description,h0(J));return l4(X.pseudoName,X.primitiveType,Z)}case"Map":return Ck0(_z(X.args,J),X.f);case"Both":return IX0(_z(X.left,J),_z(X.right,J));case"Variadic":return RP(_z(X.args,J),X.min,X.max);case"WithDefault":return Jh(_z(X.args,J),X.fallback);case"WithFallbackConfig":return Ik0(_z(X.args,J),X.config)}},qz=(X,J)=>{switch(X._tag){case"Empty":return y(l0());case"Single":{let Z=JK(X);return hg(X.primitiveType,Z).pipe(jZ(q6()),h((Q)=>{let Y=X8(Q);return ZK(X,Y,J).pipe(y9(Y))}))}case"Map":return qz(X.args,J).pipe(J9((Z)=>ZK(X.args,Z,J)));case"Both":return tJ(qz(X.left,J),qz(X.right,J),(Z,Q)=>z8(Z,Q)).pipe(J9((Z)=>ZK(X,Z,J)));case"Variadic":{let Z=h0("How many times should this argument should be repeated?"),Q=z(JK(X),I8(Z));return HV({message:BX(Q).trimEnd(),min:Dz(X),max:wz(X)}).pipe(jZ(q6()),h((Y)=>Y<=0?y(l0()):bX(l0()).pipe(h((G)=>qz(X.args,J).pipe(h((K)=>lJ(G,z8(K))),YA(Y-1),C0(ZX(G)),J9((K)=>ZK(X,K,J)))))))}case"WithDefault":{let Z=h0("This argument is optional - use the default?"),Q=z(JK(X.args),I8(Z));return I5({message:BX(Q).trimEnd(),choices:[{title:`Default ['${JSON.stringify(X.fallback)}']`,value:!0},{title:"Custom",value:!1}]}).pipe(jZ(q6()),h((Y)=>Y?y(l0()):qz(X.args,J)))}case"WithFallbackConfig":{let Z=h0("Try load this option from the environment?"),Q=z(JK(X.args),I8(Z));return I5({message:BX(Q).trimEnd(),choices:[{title:"Use environment variables",value:!0},{title:"Custom",value:!1}]}).pipe(jZ(q6()),h((Y)=>Y?y(l0()):qz(X.args,J)))}}},EX0=(X)=>{switch(X._tag){case"Empty":case"Both":return"";case"Single":return h3(c4(X.description));case"Map":case"Variadic":case"WithDefault":case"WithFallbackConfig":return EX0(X.args)}},MP=(X)=>{switch(X._tag){case"Empty":return l0();case"Single":{let J=EX0(X);return z(mg(X.primitiveType),z8(J.length===0?l0():X8(`-d '${J}'`)),s8(" "),X8)}case"Both":return z(MP(X.left),z8(MP(X.right)));case"Map":case"Variadic":case"WithDefault":case"WithFallbackConfig":return MP(X.args)}},$V=(X,J={multiple:!1,optional:!1})=>{switch(X._tag){case"Empty":return l0();case"Single":{let Z=J.multiple?"*":"",Q=J.optional?"::":":",Y=EX0(X),G=Y.length>0?` -- ${Y}`:"",K=dg(X.primitiveType);return K.length===0?l0():X8(`${Z}${Q}${X.name}${G}${K}`)}case"Map":return $V(X.args,J);case"Both":{let Z=$V(X.left,J),Q=$V(X.right,J);return z8(Z,Q)}case"Variadic":return R0(X.max)&&X.max.value>1?$V(X.args,{...J,multiple:!0}):$V(X.args,J);case"WithDefault":case"WithFallbackConfig":return $V(X.args,{...J,optional:!0})}};var iC8=og,oC8=PP,rC8=rg,aC8=qk0,sC8=Dk0,tC8=wk0,eC8=Gk0,XI8=Kk0,JI8=Bk0,ZI8=Hk0,QI8=ag,YI8=Wk0,GI8=PX0,KI8=Vk0,BI8=RX0,HI8=$k0,WI8=sg,VI8=Lk0,$I8=Fk0,UI8=Ak0,zI8=tg,NI8=Uk0,OI8=tH,_I8=UV,qI8=Tk0,DI8=Mk0,wI8=Fz,LI8=zk0,FI8=Pk0,AI8=Nk0,TI8=Ok0,MI8=_k0,PI8=eg,RI8=Rk0,jI8=jX0,CI8=jk0,II8=CX0,EI8=Xh;var Zh={};y8(Zh,{normalizeCase:()=>yI8,make:()=>bI8,layer:()=>kI8,defaultLayer:()=>vI8,defaultConfig:()=>xI8,CliConfig:()=>SI8});var SI8=yq,xI8=GV,vI8=ux0,kI8=cx0,bI8=YX0,yI8=UJ;var E0={};y8(E0,{wizard:()=>Zv8,withSubcommands:()=>Jv8,withHandler:()=>Xv8,withDescription:()=>ex8,transformHandler:()=>tx8,run:()=>Qv8,provideSync:()=>sx8,provideEffectDiscard:()=>ax8,provideEffect:()=>rx8,provide:()=>ox8,prompt:()=>ix8,make:()=>nx8,getZshCompletions:()=>fx8,getUsage:()=>lx8,getSubcommands:()=>px8,getNames:()=>dx8,getHelp:()=>mx8,getFishCompletions:()=>cx8,getBashCompletions:()=>ux8,fromDescriptor:()=>hx8,TypeId:()=>gx8});var mP={};y8(mP,{unclusteredFlag:()=>mS8,noBuiltInMatch:()=>hS8,missingValue:()=>yS8,missingSubcommand:()=>gS8,missingFlag:()=>bS8,keyValuesDetected:()=>kS8,isValidationError:()=>DS8,isUnclusteredFlag:()=>IS8,isNoBuiltInMatch:()=>CS8,isMultipleValuesDetected:()=>MS8,isMissingValue:()=>RS8,isMissingSubcommand:()=>jS8,isMissingFlag:()=>PS8,isInvalidValue:()=>TS8,isInvalidArgument:()=>AS8,isHelpRequested:()=>FS8,isCorrectedFlag:()=>LS8,isCommandMismatch:()=>wS8,invalidValue:()=>vS8,invalidArgument:()=>xS8,helpRequested:()=>eX0,correctedFlag:()=>SS8,commandMismatch:()=>ES8,ValidationErrorTypeId:()=>qS8});var Ek0=SO,Sk0=LJ;var xX0=J$0;var Az={};y8(Az,{toAnsiText:()=>ZE8,toAnsiDoc:()=>JE8,sequence:()=>tI8,p:()=>Qh,orElse:()=>eI8,mapDescriptionList:()=>XE8,isSequence:()=>fI8,isParagraph:()=>dI8,isHeader:()=>mI8,isEnumeration:()=>cI8,isEmpty:()=>hI8,isDescriptionList:()=>uI8,h3:()=>oI8,h2:()=>iI8,h1:()=>nI8,getSpan:()=>sI8,enumeration:()=>aI8,empty:()=>pI8,descriptionList:()=>rI8,blocks:()=>lI8});var hI8=d3,mI8=XX0,dI8=JX0,uI8=ZX0,cI8=bx0,fI8=yx0,pI8=cX,lI8=Og,nI8=f4,iI8=hx0,oI8=mx0,Qh=h0,rI8=oH,aI8=bq,sI8=c4,tI8=I8,eI8=gx0,XE8=XK,JE8=QX0,ZE8=BX;var P8={};y8(P8,{wizard:()=>eE8,withSchema:()=>tE8,withPseudoName:()=>sE8,withFallbackPrompt:()=>rE8,withFallbackConfig:()=>oE8,withDescription:()=>aE8,withDefault:()=>iE8,withAlias:()=>nE8,text:()=>SE8,secret:()=>EE8,repeated:()=>pE8,redacted:()=>IE8,processCommandLine:()=>lE8,parse:()=>fE8,orElseEither:()=>cE8,orElse:()=>uE8,optional:()=>dE8,none:()=>CE8,mapTryCatch:()=>mE8,mapEffect:()=>hE8,map:()=>gE8,keyValueMap:()=>jE8,isOptions:()=>$E8,isBool:()=>yE8,integer:()=>RE8,getUsage:()=>PE8,getIdentifier:()=>ME8,getHelp:()=>TE8,float:()=>AE8,filterMap:()=>bE8,fileText:()=>FE8,fileSchema:()=>LE8,fileParse:()=>wE8,fileContent:()=>DE8,file:()=>qE8,directory:()=>_E8,date:()=>OE8,choiceWithValue:()=>NE8,choice:()=>zE8,boolean:()=>UE8,between:()=>kE8,atMost:()=>xE8,atLeast:()=>vE8,all:()=>_h,OptionsTypeId:()=>VE8});var xk0=(X,J,Z)=>{if(X.length===0&&J.length===0)return 0;if(X.length===0)return J.length;if(J.length===0)return X.length;let Q=X.length,Y=J.length,G=Array(Q),K=UJ(Z,X),B=UJ(Z,J);for(let H=0;H<=Q;H++)G[H]=Array(Y),G[H][0]=H;for(let H=0;H<=Y;H++)G[0][H]=H;for(let H=1;H<=Q;H++)for(let W=1;W<=Y;W++){let V=K.charAt(H-1)===B.charAt(W-1)?0:1;G[H][W]=Math.min(G[H][W-1]+1,Math.min(G[H-1][W]+1,G[H-1][W-1]+V))}return G[Q][Y]};var Yh=(X)=>cq(X).pipe(YZ((J)=>J.split(X.delimiter||",")));var YE8="@effect/cli/Options",Hh=Symbol.for(YE8),eH={[Hh]:{_A:(X)=>X},pipe(){return K0(this,arguments)}},EP=(X)=>typeof X==="object"&&X!=null&&(Hh in X),bk0=(X)=>X,yk0=(X)=>X._tag==="Empty",gk0=(X)=>X._tag==="Single";var hk0=(X)=>X._tag==="WithDefault";var X2=function(){if(arguments.length===1)if(EP(arguments[0]))return n4(arguments[0],(X)=>[X]);else if(IK(arguments[0]))return kk0(arguments[0]);else{let X=Object.entries(arguments[0]),J=n4(X[0][1],(Q)=>({[X[0][0]]:Q}));if(X.length===1)return J;let Z=X.slice(1);for(let[Q,Y]of Z)J=n4(uX0(J,Y),([G,K])=>({...G,[Q]:K}));return J}return kk0(arguments[0])},GE8={ifPresent:!0,negationNames:[],aliases:[]},sq=(X,J)=>{let{aliases:Z,ifPresent:Q,negationNames:Y}={...GE8,...J},G=NQ(X,Z,UP(I(Q)));if(B8(Y)){let K=c9(Y),B=n6(Y),H=NQ(K,B,UP(I(!Q)));return CP(yX0(G,H),!Q)}return CP(G,!Q)},mk0=(X,J)=>{let Z=zP(n0(J,(Q)=>[Q,Q]));return NQ(X,l0(),Z)},SP=(X,J)=>NQ(X,l0(),zP(J)),dk0=(X)=>NQ(X,l0(),xg),uk0=(X,J)=>NQ(X,l0(),Nz("directory",J?.exists??"either")),Wh=(X,J)=>NQ(X,l0(),Nz("file",J?.exists??"either")),ck0=(X)=>OV(Wh(X,{exists:"yes"}),(J)=>E9(fy(J),(Z)=>b7(h0(Z)))),kX0=(X,J)=>OV(bX0(X),([Z,Q])=>E9(ly(Z,Q,J),(Y)=>b7(h0(Y)))),fk0=(X,J,Z)=>dX0(kX0(X,Z),J),bX0=(X)=>OV(Wh(X,{exists:"yes"}),(J)=>E9(py(J),(Z)=>b7(h0(Z)))),pk0=$(3,(X,J,Z)=>OV(X,(Q)=>w0(J(Q),{onNone:()=>M0(b7(h0(Z))),onSome:O0}))),lk0=(X)=>NQ(X,l0(),vg),nk0=(X)=>NQ(X,l0(),kg),ik0=(X)=>{if(typeof X==="string"){let J=NQ(X,l0(),NP);return vX0(J)}if(!gk0(X))throw Error("InvalidArgumentException: only single options can be key/value maps");else return vX0(X)},tq=(()=>{let X=Object.create(eH);return X._tag="Empty",X})(),ok0=(X)=>NQ(X,l0(),bg),rk0=(X)=>NQ(X,l0(),yg),ak0=(X)=>NQ(X,l0(),NP),sk0=$(2,(X,J)=>kP(X,I(J),S())),tk0=$(2,(X,J)=>kP(X,S(),I(J))),ek0=$(3,(X,J,Z)=>kP(X,I(J),I(Z))),Xb0=(X)=>IP(X),Vh=(X)=>S5(X),Jb0=(X)=>YK(X);var $h=(X)=>l3(X),n4=$(2,(X,J)=>cX0(X,(Z)=>O0(J(Z)))),OV=$(2,(X,J)=>cX0(X,J)),Zb0=$(3,(X,J,Z)=>OV(X,(Q)=>{try{return O0(J(Q))}catch(Y){return M0(b7(Z(Y)))}})),xP=(X)=>CP(n4(X,I),S()),yX0=$(2,(X,J)=>gX0(X,J).pipe(n4(nV))),gX0=$(2,(X,J)=>Bb0(X,J)),Qb0=$(3,(X,J,Z)=>kY(X,J,Z)),vP=$(3,(X,J,Z)=>Hb0(J,Gh(X),Z).pipe(h(([Q,Y,G])=>kY(X,G,Z).pipe(y6((K)=>w0(Q,{onNone:()=>Y0(K),onSome:(B)=>Y0(B)})),u((K)=>[Q,Y,K]))))),Yb0=(X)=>kP(X,S(),S()),Uh=$(2,(X,J)=>i3(X,(Z)=>{let Q=lX(Z.aliases,J);return NQ(Z.name,Q,Z.primitiveType,Z.description,Z.pseudoName)})),CP=$(2,(X,J)=>Nh(X,J)),hX0=$(2,(X,J)=>{if(bk0(X)&&hk0(X))return Nh(hX0(X.options,J),X.fallback);return fX0(X,J)}),mX0=$(2,(X,J)=>{if(bk0(X)&&hk0(X))return Nh(mX0(X.options,J),X.fallback);return fX0(X,J)}),_V=$(2,(X,J)=>i3(X,(Z)=>{let Q=I8(Z.description,h0(J));return NQ(Z.name,Z.aliases,Z.primitiveType,Q,Z.pseudoName)})),Gb0=$(2,(X,J)=>i3(X,(Z)=>NQ(Z.name,Z.aliases,Z.primitiveType,Z.description,I(J)))),dX0=$(2,(X,J)=>{let Z=cx(J);return OV(X,(Q)=>E9(Z(Q),(Y)=>b7(h0(D5.formatIssueSync(Y)))))}),zh=$(2,(X,J)=>QK(X,J)),kk0=(X)=>{if(X.length===0)return tq;if(X.length===1)return n4(X[0],(Z)=>[Z]);let J=n4(X[0],(Z)=>[Z]);for(let Z=1;Z<X.length;Z++){let Q=X[Z];J=n4(uX0(J,Q),([Y,G])=>[...Y,G])}return J},S5=(X)=>{switch(X._tag){case"Empty":return cX;case"Single":return oH(X8([c4(ug(l3(X))),I8(h0(gg(X.primitiveType)),X.description)]));case"KeyValueMap":{let J=lY(YK(X.argumentOption));return XK(S5(X.argumentOption),(Z,Q)=>{let Y=h0("This setting is a property argument which:"),G=`${J} key1=value key2=value2`,K=`${J} key1=value ${J} key2=value2`,B=bq([h0(`May be specified a single time: '${G}'`),h0(`May be specified multiple times: '${K}'`)]),H=z(Q,I8(Y),I8(B));return[Z,H]})}case"Map":return S5(X.options);case"Both":case"OrElse":return I8(S5(X.left),S5(X.right));case"Variadic":{let J=S5(X.argumentOption);return XK(J,(Z,Q)=>{let Y=zV(X),G=NV(X),K=d8(R0(X.max)?` ${Y} - ${G}`:Y===0?"...":` ${Y}+`),B=h0(R0(X.max)?`This option must be repeated at least ${Y} times and may be repeated up to ${G} times.`:Y===0?"This option may be repeated zero or more times.":`This option must be repeated at least ${Y} times.`);return[mZ(Z,K),I8(Q,B)]})}case"WithDefault":return XK(S5(X.options),(J,Z)=>{let Q=OB(X.fallback)?w0(X.fallback,{onNone:()=>h0("This setting is optional."),onSome:(Y)=>{let G=c6(Y)?Y:String(Y),K=sQ(G,0);return h0(`This setting is optional. Defaults to: ${K}`)}}):h0("This setting is optional.");return[J,I8(Z,Q)]});case"WithFallback":{let J=vt(X.effect)?h0("This option can be set from environment variables."):Dg(X.effect)?h0("Will prompt the user for input if this option is not provided."):cX;return XK(S5(X.options),(Z,Q)=>[Z,I8(Q,J)])}}},YK=(X)=>{switch(X._tag){case"Empty":return S();case"Single":return I(X.fullName);case"Both":case"OrElse":{let J=SK([YK(X.left),YK(X.right)]);return l6(J,{onEmpty:()=>S(),onNonEmpty:(Z)=>I(s8(Z,", "))})}case"KeyValueMap":case"Variadic":return YK(X.argumentOption);case"Map":case"WithFallback":case"WithDefault":return YK(X.options)}},zV=(X)=>{switch(X._tag){case"Empty":case"WithDefault":case"WithFallback":return 0;case"Single":case"KeyValueMap":return 1;case"Map":return zV(X.options);case"Both":{let J=zV(X.left),Z=zV(X.right);return J+Z}case"OrElse":{let J=zV(X.left),Z=zV(X.right);return Math.min(J,Z)}case"Variadic":{let J=i0(X.min,()=>0),Z=zV(X.argumentOption);return J*Z}}},NV=(X)=>{switch(X._tag){case"Empty":return 0;case"Single":return 1;case"KeyValueMap":return Number.MAX_SAFE_INTEGER;case"Map":case"WithDefault":case"WithFallback":return NV(X.options);case"Both":{let J=NV(X.left),Z=NV(X.right);return J+Z}case"OrElse":{let J=NV(X.left),Z=NV(X.right);return Math.min(J,Z)}case"Variadic":{let J=i0(X.max,()=>Number.MAX_SAFE_INTEGER/2),Z=NV(X.argumentOption);return Math.floor(J*Z)}}},l3=(X)=>{switch(X._tag){case"Empty":return aH;case"Single":{let J=WP(X.primitiveType)?S():JJ(OP(X.primitiveType),()=>I(X.placeholder));return WV(x5(X),J)}case"KeyValueMap":return l3(X.argumentOption);case"Map":return l3(X.options);case"Both":return f3(l3(X.left),l3(X.right));case"OrElse":return TX0(l3(X.left),l3(X.right));case"Variadic":return qP(l3(X.argumentOption));case"WithDefault":case"WithFallback":return _P(l3(X.options))}},IP=(X)=>{switch(X._tag){case"Single":return WP(X.primitiveType);case"Map":return IP(X.options);case"WithDefault":return IP(X.options);default:return!1}},uX0=(X,J)=>{let Z=Object.create(eH);return Z._tag="Both",Z.left=X,Z.right=J,Z},Kb0=(X)=>X.length===1?[!0,`-${X}`]:[!1,`--${X}`],vX0=(X)=>{let J=Object.create(eH);return J._tag="KeyValueMap",J.argumentOption=X,J},cX0=(X,J)=>{let Z=Object.create(eH);return Z._tag="Map",Z.options=X,Z.f=J,Z},Bb0=(X,J)=>{let Z=Object.create(eH);return Z._tag="OrElse",Z.left=X,Z.right=J,Z},NQ=(X,J,Z,Q=cX,Y=S())=>{let G=Object.create(eH);return G._tag="Single",G.name=X,G.fullName=Kb0(X)[1],G.placeholder=`${i0(Y,()=>lq(Z))}`,G.aliases=J,G.primitiveType=Z,G.description=Q,G.pseudoName=Y,G},kP=(X,J,Z)=>{if(!gk0(X))throw Error("InvalidArgumentException: only single options can be variadic");let Q=Object.create(eH);return Q._tag="Variadic",Q.argumentOption=X,Q.min=J,Q.max=Z,Q},Nh=(X,J)=>{let Z=Object.create(eH);return Z._tag="WithDefault",Z.options=X,Z.fallback=J,Z},fX0=(X,J)=>{let Z=Object.create(eH);return Z._tag="WithFallback",Z.options=X,Z.effect=J,Z},i3=(X,J)=>{switch(X._tag){case"Empty":return tq;case"Single":return J(X);case"KeyValueMap":return vX0(J(X.argumentOption));case"Map":return cX0(i3(X.options,J),X.f);case"Both":return uX0(i3(X.left,J),i3(X.right,J));case"OrElse":return Bb0(i3(X.left,J),i3(X.right,J));case"Variadic":return kP(J(X.argumentOption),X.min,X.max);case"WithDefault":return Nh(i3(X.options,J),X.fallback);case"WithFallback":return fX0(i3(X.options,J),X.effect)}},x5=(X)=>{let J=(Q)=>{switch(Q._tag){case"Empty":return l0();case"Single":return zZ(Q.aliases,Q.name);case"KeyValueMap":case"Variadic":return J(Q.argumentOption);case"Map":case"WithDefault":case"WithFallback":return J(Q.options);case"Both":case"OrElse":{let Y=J(Q.left),G=J(Q.right);return z8(Y,G)}}},Z=HG(Oc,(Q)=>!Q[0]);return z(J(X),n0((Q)=>Kb0(Q)),NZ(Z),n0((Q)=>Q[1]))},Gh=(X)=>{switch(X._tag){case"Empty":return l0();case"Single":case"KeyValueMap":case"Variadic":return X8(X);case"Map":case"WithDefault":case"WithFallback":return Gh(X.options);case"Both":case"OrElse":return z8(Gh(X.left),Gh(X.right))}},KE8=/=(.*)/,kY=(X,J,Z)=>{switch(X._tag){case"Empty":return U0;case"Single":{let Q=LQ(x5(X),(G)=>H$(J,G));if(B8(Q)){let G=c9(Q),K=n6(Q);if(G7(K)){if(G7(G))return nq(X.primitiveType,S(),Z).pipe(E9((H)=>b7(h0(H))));if(B8(G)&&G7(n6(G))){let H=c9(G);return nq(X.primitiveType,I(H),Z).pipe(E9((W)=>b7(h0(W))))}return Y0(lg(cX,G))}let B=h0(`More than one reference to option '${X.fullName}' detected`);return Y0(b7(B))}let Y=h0(`Expected to find option: '${X.fullName}'`);return Y0(E5(Y))}case"KeyValueMap":{let Q=(Y)=>{let G=Y.trim().split(KE8,2);if(B8(G)&&G.length===2&&G[1]!=="")return y(G);let K=h0(`Expected a key/value pair but received '${Y}'`);return Y0(p3(K))};return kY(X.argumentOption,J,Z).pipe(q9({onFailure:(Y)=>LP(Y)?a9(Y.values,(G)=>Q(G)).pipe(u(J4)):Y0(Y),onSuccess:(Y)=>Q(Y).pipe(u(mw))}))}case"Map":return kY(X.options,J,Z).pipe(h((Q)=>X.f(Q)));case"Both":return kY(X.left,J,Z).pipe(y6((Q)=>kY(X.right,J,Z).pipe(q9({onFailure:(Y)=>{let G=I8(Q.error,Y.error);return Y0(E5(G))},onSuccess:()=>Y0(Q)}))),j7(kY(X.right,J,Z)));case"OrElse":return kY(X.left,J,Z).pipe(q9({onFailure:(Q)=>kY(X.right,J,Z).pipe(vG({onFailure:(Y)=>FP(Q)&&FP(Y)?E5(I8(Q.error,Y.error)):b7(I8(Q.error,Y.error)),onSuccess:(Y)=>O0(Y)})),onSuccess:(Q)=>kY(X.right,J,Z).pipe(q9({onFailure:()=>y(M0(Q)),onSuccess:()=>{let Y=i0(YK(X.left),()=>"???"),G=i0(YK(X.right),()=>"???"),K=h0(`Collision between two options detected - you can only specify one of either: ['${Y}', '${G}']`);return Y0(b7(K))}}))}));case"Variadic":{let Q=i0(X.min,()=>0),Y=i0(X.max,()=>Number.MAX_SAFE_INTEGER),G=LQ(x5(X),(B)=>H$(J,B)),K=(B)=>{if(B.length<Q){let V=X.argumentOption.fullName,U=`Expected at least ${Q} value(s) for option: '${V}'`;return Y0(b7(h0(U)))}if(B.length>Y){let V=X.argumentOption.fullName,U=`Expected at most ${Y} value(s) for option: '${V}'`;return Y0(b7(h0(U)))}let H=X.argumentOption.primitiveType,W=(V)=>nq(H,I(V),Z).pipe(E9((U)=>b7(h0(U))));return a9(B,(V)=>W(V))};if(ww(G,G7))return K(l0());return kY(X.argumentOption,J,Z).pipe(q9({onFailure:(B)=>LP(B)?K(B.values):Y0(B),onSuccess:(B)=>K(X8(B))}))}case"WithDefault":return kY(X.options,J,Z).pipe(QQ("MissingValue",()=>y(X.fallback)));case"WithFallback":return kY(X.options,J,Z).pipe(QQ("MissingValue",(Q)=>X.effect.pipe(y6((Y)=>{if(p5(Y,"QuitException"))return P7(Y);if(pY0(Y)&&!sV(Y)){let G=h0(String(Y)),K=b7(G);return Y0(K)}return Y0(Q)}))))}},QK=(X,J)=>{switch(X._tag){case"Empty":return y(l0());case"Single":{let Z=S5(X);return hg(X.primitiveType,Z).pipe(h((Q)=>{let Y=p6(x5(X)[0],Q);return Wb0(X,Y,J).pipe(y9(Y))}),jZ(q6()))}case"KeyValueMap":{let Z=h0("Enter `key=value` pairs separated by spaces");return Yh({message:BX(Z).trim(),delimiter:" "}).pipe(h((Q)=>{let Y=i0(YK(X),()=>"");return kY(X,mw([Y,Q]),J).pipe(y9(zZ(Q,Y)))}),jZ(q6()))}case"Map":return QK(X.options,J);case"Both":return tJ(QK(X.left,J),QK(X.right,J),(Z,Q)=>z8(Z,Q));case"OrElse":{let Z=h0("Select which option you would like to use"),Q=z(S5(X),I8(Z)),Y=(K,B)=>({title:K,value:B}),G=SK([r8(YK(X.left),(K)=>Y(K,X.left)),r8(YK(X.right),(K)=>Y(K,X.right))]);return I5({message:BX(Q).trimEnd(),choices:G}).pipe(h((K)=>QK(K,J)))}case"Variadic":{let Z=h0("How many times should this argument be repeated?"),Q=z(S5(X),I8(Z));return HV({message:BX(Q).trimEnd(),min:zV(X),max:NV(X)}).pipe(h((Y)=>Y<=0?y(l0()):bX(l0()).pipe(h((G)=>QK(X.argumentOption,J).pipe(h((K)=>lJ(G,z8(K))),YA(Y-1),C0(ZX(G)))))))}case"WithDefault":{if(IP(X.options))return QK(X.options,J);let Z=h0("This option is optional - use the default?"),Q=z(S5(X.options),I8(Z));return I5({message:BX(Q).trimEnd(),choices:[{title:"Yes",value:!0,description:`use the default ${OB(X.fallback)?w0(X.fallback,{onNone:()=>"",onSome:(Y)=>`(${JSON.stringify(Y)})`}):`(${JSON.stringify(X.fallback)})`}`},{title:"No",value:!1,description:"use a custom value"}]}).pipe(jZ(q6()),h((Y)=>Y?y(l0()):QK(X.options,J)))}case"WithFallback":{if(IP(X.options))return QK(X.options,J);if(Dg(X.effect))return QK(X.options,J);let Z=h0("Try load this option from the environment?"),Q=z(S5(X.options),I8(Z));return I5({message:BX(Q).trimEnd(),choices:[{title:"Use environment variables",value:!0},{title:"Custom",value:!1}]}).pipe(jZ(q6()),h((Y)=>Y?y(l0()):QK(X.options,J)))}}},Hb0=(X,J,Z)=>{if(B8(J))return jP(X,J,Z).pipe(h(([Q,Y,G])=>{if(yN(G))return y([S(),X,G]);return Hb0(Q,Y,Z).pipe(u(([K,B,H])=>[K,B,pX0(G,v0(H))]))}),y6((Q)=>y([I(Q),X,qZ()])));return G7(X)?y([S(),l0(),qZ()]):y([S(),X,qZ()])},jP=(X,J,Z)=>hJ(J,{onEmpty:()=>y([X,l0(),qZ()]),onNonEmpty:(Q,Y)=>Wb0(Q,X,Z).pipe(h(({leftover:G,parsed:K})=>w0(K,{onNone:()=>jP(G,Y,Z).pipe(u(([B,H,W])=>[B,zZ(H,Q),W])),onSome:({name:B,values:H})=>y([G,Y,mw([B,H])])})),iO({CorrectedFlag:(G)=>jP(X,Y,Z).pipe(U3(()=>I(Y0(G))),h(([K,B,H])=>Y0(G).pipe(A4(()=>yN(H)),y9([K,zZ(B,Q),H])))),MissingFlag:()=>jP(X,Y,Z).pipe(u(([G,K,B])=>[G,zZ(K,Q),B])),UnclusteredFlag:(G)=>Vb0(G.unclustered,G.rest,J,Z).pipe(y6(()=>Y0(G)))}))}),BE8=/^-{1}([^-]{2,}$)/,Kh=/^(--[^=]+)(?:=(.+))?$/,HE8=(X)=>hJ(X,{onEmpty:()=>y(l0()),onNonEmpty:(J,Z)=>{let Q=J.trim();if(BE8.test(Q)){let Y=Q.substring(1).split("").map((G)=>`-${G}`);return Y0(AP(cX,Y,Z))}if(Kh.test(Q)){let Y=Kh.exec(Q);if(Y!==null&&Y[2]!==void 0)return y(z8([Y[1],Y[2]],Z))}return y(X)}}),Wb0=(X,J,Z)=>{switch(X._tag){case"Single":return HE8(J).pipe(h((Q)=>hJ(Q,{onEmpty:()=>{let Y=h0(`Expected to find option: '${X.fullName}'`);return Y0(iq(Y))},onNonEmpty:(Y,G)=>{let K=(j)=>UJ(Z,j),B=K(Y),H=n0(x5(X),(j)=>K(j));if(pZ(H,B)){if(WP(X.primitiveType))return hJ(G,{onEmpty:()=>{let j=I({name:Y,values:l0()});return y({parsed:j,leftover:G})},onNonEmpty:(j,T)=>{if(VP(j)){let k=I({name:Y,values:X8("true")});return y({parsed:k,leftover:T})}if($P(j)){let k=I({name:Y,values:X8("false")});return y({parsed:k,leftover:T})}let E=I({name:Y,values:l0()});return y({parsed:E,leftover:G})}});return hJ(G,{onEmpty:()=>{let j=h0(`Expected a value following option: '${X.fullName}'`);return Y0(E5(j))},onNonEmpty:(j,T)=>{let E=I({name:Y,values:X8(j)});return y({parsed:E,leftover:T})}})}if(Y.startsWith("-")){if(X.name.length>Z.autoCorrectLimit+1&&xk0(Y,X.fullName,Z)<=Z.autoCorrectLimit){let T=h0(`The flag '${Y}' is not recognized. Did you mean '${X.fullName}'?`);return Y0(pg(T))}let j=h0(`Expected to find option: '${X.fullName}'`);return Y0(iq(j))}let W=-1,V=void 0;for(let j=0;j<G.length;j++){let T=G[j],E=K(T);if(pZ(H,E)){W=j;break}let k=Kh.exec(T);if(k!==null){let P=K(k[1]);if(pZ(H,P)){W=j,V=k[2];break}}}if(W===-1){let j=h0(`Expected to find option: '${X.fullName}'`);return Y0(iq(j))}let U=G[W],O=V!==void 0?Kh.exec(U)[1]:U,q=zZ(G.slice(0,W),Y),L=G.slice(W+1);if(WP(X.primitiveType)){if(V!==void 0){if(VP(V)){let E=I({name:O,values:X8("true")}),k=z8(q,L);return y({parsed:E,leftover:k})}if($P(V)){let E=I({name:O,values:X8("false")}),k=z8(q,L);return y({parsed:E,leftover:k})}}if(L.length>0){let E=L[0];if(VP(E)){let k=I({name:O,values:X8("true")}),P=z8(q,L.slice(1));return y({parsed:k,leftover:P})}if($P(E)){let k=I({name:O,values:X8("false")}),P=z8(q,L.slice(1));return y({parsed:k,leftover:P})}}let j=I({name:O,values:l0()}),T=z8(q,L);return y({parsed:j,leftover:T})}if(V!==void 0){let j=I({name:O,values:X8(V)}),T=z8(q,L);return y({parsed:j,leftover:T})}if(L.length===0){let j=h0(`Expected a value following option: '${X.fullName}'`);return Y0(E5(j))}let A=L[0],M=I({name:O,values:X8(A)}),x=z8(q,L.slice(1));return y({parsed:M,leftover:x})}})));case"KeyValueMap":{let Q=n0(x5(X.argumentOption),(Y)=>UJ(Z,Y));return hJ(J,{onEmpty:()=>y({parsed:S(),leftover:J}),onNonEmpty:(Y,G)=>{let K=(A)=>{let M=l0(),x=A;while(B8(x)){let j=c9(x).trim(),T=UJ(Z,j);if(x.length>=2&&pZ(Q,T)){let E=x[1].trim(),[k,P]=E.split("=");if(k!==void 0&&P!==void 0&&P.length>0){M=lX(M,E),x=x.slice(2);continue}}if(j.includes("=")){let[E,k]=j.split("=");if(E!==void 0&&k!==void 0&&k.length>0){M=lX(M,j),x=x.slice(1);continue}}break}return[M,x]},B=UJ(Z,Y);if(pZ(Q,B)){let[A,M]=K(G);return y({parsed:I({name:Y,values:A}),leftover:M})}if(Y.startsWith("-"))return y({parsed:S(),leftover:J});let H=-1;for(let A=0;A<G.length;A++){let M=G[A],x=UJ(Z,M);if(pZ(Q,x)){H=A;break}}if(H===-1)return y({parsed:S(),leftover:J});let W=G[H],V=zZ(G.slice(0,H),Y),U=G.slice(H+1),[O,q]=K(U),L=z8(V,q);return y({parsed:I({name:W,values:O}),leftover:L})}})}case"Variadic":{let Q=n0(x5(X.argumentOption),(W)=>UJ(Z,W)),Y=void 0,G=l0(),K=J,B=l0();while(B8(K)){let W=c9(K),V=UJ(Z,W);if(pZ(Q,V)){if(Y===void 0)Y=W;let U=K[1];if(U!==void 0&&U.length>0)G=lX(G,U.trim());K=K.slice(2)}else B=lX(B,c9(K)),K=K.slice(1)}let H=x8(Y).pipe(JJ(()=>I(X.argumentOption.fullName)),r8((W)=>({name:W,values:G})));return y({parsed:H,leftover:B})}}},Vb0=(X,J,Z,Q)=>{if(B8(X)){let Y=c9(X),G=n6(X);return jP(X8(Y),Z,Q).pipe(h(([K,B,H])=>{if(yN(H))return Y0(AP(cX,l0(),J));return Vb0(G,J,B,Q).pipe(u(([W,V,U])=>[J,V,pX0(H,v0(U))]))}))}return y([J,Z,qZ()])},pX0=(X,J)=>{if(B8(J)){let Z=c9(J),Q=n6(J),Y=w0(H$(X,Z[0]),{onNone:()=>w7(X,Z[0],Z[1]),onSome:(G)=>w7(X,Z[0],z8(G,Z[1]))});return pX0(Y,Q)}return X},WE8=(X)=>X.replaceAll("\\","\\\\").replaceAll("'","'\\''").replaceAll("[","\\[").replaceAll("]","\\]").replaceAll(":","\\:").replaceAll("$","\\$").replaceAll("`","\\`").replaceAll("(","\\(").replaceAll(")","\\)"),Bh=(X)=>{switch(X._tag){case"Empty":case"Both":case"OrElse":return"";case"Single":return h3(c4(X.description));case"KeyValueMap":case"Variadic":return Bh(X.argumentOption);case"Map":case"WithDefault":case"WithFallback":return Bh(X.options)}},rq=(X)=>{switch(X._tag){case"Empty":return l0();case"Single":{let J=x5(X),Z=s8(J,"|"),Q=iv0(X.primitiveType);return p6(`${Z})`,` COMPREPLY=( ${Q} )`," return 0"," ;;")}case"KeyValueMap":case"Variadic":return rq(X.argumentOption);case"Map":case"WithDefault":case"WithFallback":return rq(X.options);case"Both":case"OrElse":{let J=rq(X.left),Z=rq(X.right);return z8(J,Z)}}},aq=(X)=>{switch(X._tag){case"Empty":return l0();case"Single":{let J=Bh(X),Z=HG(Oc,(Q)=>!Q[0]);return z(zZ(X.aliases,X.name),n0((Q)=>[Q.length===1,Q]),NZ(Z),S6(([Q,Y])=>p6(Q?"-s":"-l",Y)),z8(mg(X.primitiveType)),z8(J.length===0?l0():X8(`-d '${J}'`)),s8(" "),X8)}case"KeyValueMap":case"Variadic":return aq(X.argumentOption);case"Map":case"WithDefault":case"WithFallback":return aq(X.options);case"Both":case"OrElse":return z(aq(X.left),z8(aq(X.right)))}},n3=(X,J={conflicts:l0(),multiple:!1})=>{switch(X._tag){case"Empty":return l0();case"Single":{let Z=x5(X),Q=Bh(X),Y=dg(X.primitiveType),G=J.multiple?"*":"",K=B8(J.conflicts)?`(${s8(J.conflicts," ")})`:"";return n0(Z,(B)=>`${K}${G}${B}[${WE8(Q)}]${Y}`)}case"KeyValueMap":return n3(X.argumentOption,{...J,multiple:!0});case"Map":case"WithDefault":case"WithFallback":return n3(X.options,J);case"Both":{let Z=n3(X.left,J),Q=n3(X.right,J);return z8(Z,Q)}case"OrElse":{let Z=x5(X.left),Q=x5(X.right),Y=n3(X.left,{...J,conflicts:z8(J.conflicts,Q)}),G=n3(X.right,{...J,conflicts:z8(J.conflicts,Z)});return z8(Y,G)}case"Variadic":return R0(X.max)&&X.max.value>1?n3(X.argumentOption,{...J,multiple:!0}):n3(X.argumentOption,J)}};var VE8=Hh,$E8=EP,_h=X2,UE8=sq,zE8=mk0,NE8=SP,OE8=dk0,_E8=uk0,qE8=Wh,DE8=ck0,wE8=kX0,LE8=fk0,FE8=bX0,AE8=lk0,TE8=Vh,ME8=Jb0,PE8=$h,RE8=nk0,jE8=ik0,CE8=tq,IE8=ok0,EE8=rk0,SE8=ak0,xE8=tk0,vE8=sk0,kE8=ek0,bE8=pk0,yE8=Xb0,gE8=n4,hE8=OV,mE8=Zb0,dE8=xP,uE8=yX0,cE8=gX0,fE8=Qb0,pE8=Yb0,lE8=vP,nE8=Uh,iE8=CP,oE8=hX0,rE8=mX0,aE8=_V,sE8=Gb0,tE8=dX0,eE8=zh;var XS8=(X)=>({_tag:"SetLogLevel",level:X}),JS8=(X)=>({_tag:"ShowCompletions",shellType:X}),eq=(X,J)=>({_tag:"ShowHelp",usage:X,helpDoc:J}),lX0=(X)=>({_tag:"ShowWizard",command:X}),ZS8={_tag:"ShowVersion"};var nX0=(X)=>X._tag==="ShowHelp",iX0=(X)=>X._tag==="ShowWizard";var QS8=SP("completions",[["sh","bash"],["bash","bash"],["fish","fish"],["zsh","zsh"]]).pipe(xP,_V("Generate a completion script for a specific shell.")),YS8=SP("log-level",xp.map((X)=>[X._tag.toLowerCase(),X])).pipe(xP,_V("Sets the minimum log level for a command.")),GS8=sq("help").pipe(Uh("h"),_V("Show the help documentation for a command.")),KS8=sq("version").pipe(_V("Show the version of the application.")),BS8=sq("wizard").pipe(_V("Start wizard mode for a command.")),J2=X2({completions:QS8,logLevel:YS8,help:GS8,wizard:BS8,version:KS8}),$b0=(X,J,Z)=>n4(J2,(Q)=>{if(R0(Q.completions))return I(JS8(Q.completions.value));if(R0(Q.logLevel))return I(XS8(Q.logLevel.value));if(Q.help)return I(eq(J,Z));if(Q.wizard)return I(lX0(X));if(Q.version)return I(ZS8);return S()});var bP=(X)=>({_tag:"BuiltIn",option:X}),Z2=(X,J)=>({_tag:"UserDefined",leftover:X,value:J}),oX0=(X)=>X._tag==="BuiltIn",qh=(X)=>X._tag==="UserDefined";var WS8="@effect/cli/CommandDescriptor",zb0=Symbol.for(WS8),Tz={[zb0]:{_A:(X)=>X},pipe(){return K0(this,arguments)}},Nb0=(X)=>typeof X==="object"&&X!=null&&(zb0 in X),Mz=(X)=>X._tag==="Standard";var Ob0=(X,J=tq,Z=Fz)=>{let Q=Object.create(Tz);return Q._tag="Standard",Q.name=X,Q.description=cX,Q.options=J,Q.args=Z,Q},_b0=(X,J)=>{let Z=Object.create(Tz);return Z._tag="GetUserInput",Z.name=X,Z.description=cX,Z.prompt=J,Z},wh=(X,J)=>gP(X,J),JD=(X)=>X4(qV(X)),Lh=(X,J)=>NS8(X,J),Fh=(X,J)=>OS8(X,J),Ah=(X,J)=>_S8(X,J),Th=(X)=>J4(hP(X)),Mh=(X)=>XD(X),Ph=$(2,(X,J)=>qb0(X,(Z)=>O0(J(Z)))),qb0=$(2,(X,J)=>{let Z=Object.create(Tz);return Z._tag="Map",Z.command=X,Z.f=J,Z}),Db0=$(3,(X,J,Z)=>yP(X,J,Z)),wb0=$(2,(X,J)=>rX0(X,J)),Lb0=$(2,(X,J)=>{let Z=Object.create(Tz);return Z._tag="Subcommands",Z.parent=X,Z.children=n0(J,([Q,Y])=>Ph(Y,(G)=>[Q,G])),Z}),Rh=$(3,(X,J,Z)=>zS8(X,J,Z)),gP=(X,J)=>{switch(X._tag){case"Standard":{let Z=d3(X.description)?cX:I8(f4("DESCRIPTION"),X.description),Q=sg(X.args),Y=d3(Q)?cX:I8(f4("ARGUMENTS"),Q),G=J.showBuiltIns?_h([X.options,J2]):X.options,K=Vh(G),B=d3(K)?cX:I8(f4("OPTIONS"),K);return I8(Z,I8(Y,B))}case"GetUserInput":return d3(X.description)?cX:I8(f4("DESCRIPTION"),X.description);case"Map":return gP(X.command,J);case"Subcommands":{let Z=(Y,G)=>{switch(Y._tag){case"Standard":case"GetUserInput":{let K=c4(ug(XD(Y))),B=lX(G,K),H=OJ(B,R5,(V,U)=>t90(V)&&V.value===""?U:t90(U)&&U.value===""?V:xY([V,SY,U])),W=c4(Y.description);return X8([H,W])}case"Map":return Z(Y.command,G);case"Subcommands":{let K=Z(Y.parent,G);return w0(mJ(K),{onNone:()=>S6(Y.children,(B)=>Z(B,G)),onSome:([B])=>{let H=S6(Y.children,(W)=>Z(W,lX(G,B)));return z8(K,H)}})}}},Q=(Y)=>{let G=JY(Y,0,(B,[H])=>Math.max(Wz(H),B)),K=n0(Y,([B,H])=>h0(xY([B,d8(" ".repeat(G-Wz(B)+2)),H])));if(B8(K))return bq(K);throw Error("[BUG]: Subcommands.usage - received empty list of subcommands to print")};return I8(gP(X.parent,J),I8(f4("COMMANDS"),Q(S6(X.children,(Y)=>Z(Y,l0())))))}}},qV=(X)=>{switch(X._tag){case"Standard":case"GetUserInput":return X8(X.name);case"Map":return qV(X.command);case"Subcommands":return qV(X.parent)}},hP=(X)=>{let J=(Z,Q)=>{switch(Z._tag){case"Standard":case"GetUserInput":return X8([Z.name,Z]);case"Map":return J(Z.command,Q);case"Subcommands":return Q?J(Z.parent,!1):S6(Z.children,(Y)=>J(Y,!0))}};return J(X,!1)},XD=(X)=>{switch(X._tag){case"Standard":return f3(WV(X8(X.name),S()),f3($h(X.options),tg(X.args)));case"GetUserInput":return WV(X8(X.name),S());case"Map":return XD(X.command);case"Subcommands":return f3(XD(X.parent),AX0)}},yP=(X,J,Z)=>{let Q=(Y,G)=>hJ(G,{onEmpty:()=>{let K=h0(`Missing command name: '${Y.name}'`);return Y0(sH(K))},onNonEmpty:(K,B)=>{let H=UJ(Z,K),W=UJ(Z,Y.name);return y(B).pipe(A4(()=>H===W),sJ,QQ("NoSuchElementException",()=>{let V=h0(`Missing command name: '${Y.name}'`);return Y0(sH(V))}))}});switch(X._tag){case"Standard":{let Y=(B)=>hJ(B,{onEmpty:()=>{let H=h0(`Missing command name: '${X.name}'`);return Y0(sH(H))},onNonEmpty:(H)=>{let W=UJ(Z,H),V=UJ(Z,X.name);if(W===V){let O=gP(X,Z),q=XD(X),L=$b0(X,q,O),A=VG(B,1);return vP(L,A,Z).pipe(h((M)=>M[2]),QQ("NoSuchElementException",()=>{let M=h0("No built-in option was matched");return Y0(ng(M))}),u(bP))}let U=h0(`Missing command name: '${X.name}'`);return Y0(sH(U))}}),G=(B)=>Q(X,B).pipe(h((H)=>{let[W,V]=VS8(H);return vP(X.options,W,Z).pipe(h(([U,O,q])=>eg(X.args,z8(O,V),Z).pipe(y6((L)=>w0(U,{onNone:()=>Y0(L),onSome:(A)=>Y0(A)})),u(([L,A])=>Z2(L,{name:X.name,options:q,args:A})))))})),K=(B)=>{if(pZ(B,"--help")||pZ(B,"-h"))return Y(p6(X.name,"--help"));if(pZ(B,"--wizard"))return Y(p6(X.name,"--wizard"));if(pZ(B,"--version"))return Y(p6(X.name,"--version"));let H=h0(`Missing command name: '${X.name}'`);return Y0(sH(H))};return Y(J).pipe(O3(()=>G(J)),U3((B)=>{if(VV(B)){if(Z.finalCheckBuiltIn)return I(K(J).pipe(U3((H)=>VV(H)?I(Y0(B)):S())));return I(Y0(B))}return S()}))}case"GetUserInput":return Q(X,J).pipe(C0(JP(X.prompt)),QQ("QuitException",(Y)=>P7(Y)),u((Y)=>Z2(VG(J,1),{name:X.name,value:Y})));case"Map":return yP(X.command,J,Z).pipe(h((Y)=>{if(qh(Y))return X.f(Y.value).pipe(u((G)=>Z2(Y.leftover,G)));return y(Y)}));case"Subcommands":{let Y=qV(X),G=hP(X),[K,B]=DB(J,(L)=>!gc(G,([A])=>A===L)),H=(L)=>o0(()=>{let A=X.children[Symbol.iterator](),M=(x)=>{return yP(x,L,Z).pipe(Ux(wP,(j)=>{let T=A.next();return T.done?Y0(j):M(T.value)}))};return M(A.next().value)}),W=H(B),V=L0(()=>{return bP(eq(XD(X),gP(X,Z)))}),U=W.pipe(h((L)=>{if(oX0(L)&&nX0(L.option)){let A=i0(mJ(Y),()=>""),M=bP(eq(f3(WV(X8(A),S()),L.option.usage),L.option.helpDoc));return y(M)}return Y0(p3(cX))})),O=L0(()=>bP(lX0(X))),q=W.pipe(h((L)=>{if(oX0(L)&&iX0(L.option))return y(L);return Y0(p3(cX))}));return o0(()=>yP(X.parent,K,Z).pipe(h((L)=>{switch(L._tag){case"BuiltIn":{if(nX0(L.option))return B8(B)?O3(U,()=>V):V;if(iX0(L.option))return O3(q,()=>O);return y(L)}case"UserDefined":{let A=z8(L.leftover,B);if(B8(A))return H(A).pipe(h((M)=>{if(!qh(M))return y(M);let x=M.leftover;if(G7(x))return y(Z2(x,{...L.value,subcommand:I(M.value)}));let j=z8(K,x);return yP(X.parent,j,Z).pipe(h((T)=>{if(!qh(T))return y(Z2(x,{...L.value,subcommand:I(M.value)}));return y(Z2(T.leftover,{...T.value,subcommand:I(M.value)}))}),y6(()=>y(Z2(x,{...L.value,subcommand:I(M.value)}))))}),y6((M)=>{if(wP(M)){let x=i0(mJ(Y),()=>""),j=n0(G,([k])=>`'${k}'`),T=j.length===1?"":" one of",E=h0(`Invalid subcommand for ${x} - use${T} ${s8(j,", ")}`);return Y0(sH(E))}return Y0(M)}));return y(Z2(L.leftover,{...L.value,subcommand:S()}))}}}),U3(()=>G7(J)?I(V):S())))}}},VS8=(X)=>{let[J,Z]=DB(X,(Q)=>Q!=="--");return[J,VG(Z,1)]},rX0=(X,J)=>{switch(X._tag){case"Standard":{let Z=typeof J==="string"?Qh(J):J,Q=Object.create(Tz);return Q._tag="Standard",Q.name=X.name,Q.description=Z,Q.options=X.options,Q.args=X.args,Q}case"GetUserInput":{let Z=typeof J==="string"?Qh(J):J,Q=Object.create(Tz);return Q._tag="GetUserInput",Q.name=X.name,Q.description=Z,Q.prompt=X.prompt,Q}case"Map":return qb0(rX0(X.command,J),X.f);case"Subcommands":{let Z=Object.create(Tz);return Z._tag="Subcommands",Z.parent=rX0(X.parent,J),Z.children=X.children.slice(),Z}}},$S8=m3("Args Wizard - "),US8=m3("Options Wizard - "),zS8=(X,J,Z)=>{let Q=(Y,G)=>{switch(Y._tag){case"GetUserInput":case"Standard":return f0(function*(){let K=ZX(G).pipe(h((B)=>{let H=h0(z(Ng(YV("COMMAND:",zg)),mZ(SY),mZ(YV(s8(B," "),a90))));return q6(BX(H))}));if(Mz(Y)){yield*K;let B=YV(Y.name,a90);if(!yk0(Y.options)){let H=h0(mZ(US8,B));yield*q6(BX(H));let W=yield*zh(Y.options,Z);yield*np(G,z8(W)),yield*K}if(!Yk0(Y.args)){let H=h0(mZ($S8,B));yield*q6(BX(H));let W=yield*Xh(Y.args,Z);yield*np(G,z8(W)),yield*K}}return yield*ZX(G)});case"Map":return Q(Y.command,G);case"Subcommands":{let K=h0("Select which command you would like to execute"),B=BX(K).trimEnd(),H=(V,U)=>({title:V,value:[V,U]}),W=z(hP(Y),n0(([V],U)=>H(V,U)));return Q(Y.parent,G).pipe(C0(I5({message:B,choices:W}).pipe(J9(([V])=>lJ(G,lX(V))),jZ(q6()),h(([,V])=>Q(Y.children[V],G)))))}}};return bX(J).pipe(h((Y)=>Q(X,Y).pipe(C0(ZX(Y)))))},aX0=(X)=>{switch(X._tag){case"Standard":return h3(c4(X.description));case"GetUserInput":return h3(c4(X.description));case"Map":return aX0(X.command);case"Subcommands":return""}},sX0=(X,J,Z)=>Ek0(J).pipe(h((Q)=>{let Y=(G,K,B,H)=>{switch(G._tag){case"Standard":{let W={command:G,parentCommands:K,subcommands:B,level:H};return xX0(Q,(V)=>Z(V,W))}case"GetUserInput":{let W={command:G,parentCommands:K,subcommands:B,level:H};return xX0(Q,(V)=>Z(V,W))}case"Map":return Y(G.command,K,B,H);case"Subcommands":{let W=qV(G.parent),V=hP(G),U=z8(K,W);return Y(G.parent,K,V,H).pipe(C0(a9(G.children,(O)=>Y(O,U,B,H+1))))}}};return o0(()=>Y(X,l0(),l0(),0)).pipe(C0(Sk0(Q)))})),i4=$(2,(X,J)=>{let Z=CK(J+1).join(" ");return n0(X,(Q)=>`${Z}${Q}`)}),NS8=(X,J)=>sX0(X,l0(),(Z,Q)=>{let Y=Mz(Q.command)?_h([Q.command.options,J2]):J2,G=x5(Y),K=Mz(Q.command)?rq(Q.command.options):l0(),B=z(Q.subcommands,n0(([A])=>A),NZ(Lj)),H=z8(G,B),W=G7(Q.parentCommands)?X8(Q.command.name):z(Q.parentCommands,lX(Q.command.name),n0((A)=>A.replace("-","__"))),V=s8(W,","),U=s8(W,"__"),O=G7(Q.parentCommands)?l0():[`${V})`,` cmd="${U}"`," ;;"],q=[`${U})`,` opts="${s8(H," ")}"`,` if [[ \${cur} == -* || \${COMP_CWORD} -eq ${Q.level+1} ]] ; then`,' COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )'," return 0"," fi",' case "${prev}" in',...i4(K,8)," *)"," COMPREPLY=()"," ;;"," esac",' COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )'," return 0"," ;;"],L=lX(Z,[O,q]);return y(L)}).pipe(u((Z)=>{let Q=oV(qV(X),0),Y=`_${Q}_bash_completions`,G=S6(Z,([B])=>B),K=S6(Z,([,B])=>B);return[`function ${Y}() {`," local i cur prev opts cmd"," COMPREPLY=()",' cur="${COMP_WORDS[COMP_CWORD]}"',' prev="${COMP_WORDS[COMP_CWORD-1]}"',' cmd=""',' opts=""',' for i in "${COMP_WORDS[@]}"; do',' case "${cmd},${i}" in',' ",$1")',` cmd="${J}"`," ;;",...i4(G,12)," *)"," ;;"," esac"," done",' case "${cmd}" in',...i4(K,8)," esac","}",`complete -F ${Y} -o nosort -o bashdefault -o default ${Q}`]})),OS8=(X,J)=>sX0(X,l0(),(Z,Q)=>{let Y=p6("complete","-c",J),G=Mz(Q.command)?X2([J2,Q.command.options]):J2,K=aq(G),B=Mz(Q.command)?MP(Q.command.args):l0(),H=(L)=>z(n0(K,(A)=>z(Y,z8(L),lX(A),s8(" "))),z8(n0(B,(A)=>z(Y,z8(L),lX(A),s8(" "))))),W=(L)=>n0(Q.subcommands,([A,M])=>{let x=aX0(M);return z(Y,z8(L),z8(p6("-f","-a",`"${A}"`)),z8(x.length===0?l0():p6("-d",`'${x}'`)),s8(" "))});if(G7(Q.parentCommands)){let L=p6("-n",'"__fish_use_subcommand"');return y(z(Z,z8(H(L)),z8(W(L))))}let V=z(Q.parentCommands,VG(1),lX(Q.command.name),n0((L)=>`__fish_seen_subcommand_from ${L}`)),U=n0(Q.subcommands,([L])=>`not __fish_seen_subcommand_from ${L}`),O=z(z8(V,U),s8("; and ")),q=p6("-n",`"${O}"`);return y(z(Z,z8(H(q)),z8(W(q))))}),_S8=(X,J)=>sX0(X,l0(),(Z,Q)=>{let Y=G7(Q.parentCommands)?X8(Q.command.name):z(Q.parentCommands,lX(Q.command.name),n0((V)=>V.replace("-","__"))),G=s8(Y,"__"),K=s8(Y," "),B=z(Q.subcommands,n0(([V,U])=>{let O=aX0(U);return`'${V}:${O}' \\`})),H=G7(B)?"commands=()":`commands=(
199
+ ${s8(i4(B,8),`
200
+ `)}
201
+ )`,W=[`(( $+functions[_${G}_commands] )) ||`,`_${G}_commands() {`,` local commands; ${H}`,` _describe -t commands '${K} commands' commands "$@"`,"}"];return y(z8(Z,W))}).pipe(u((Z)=>{let Q=oV(qV(X),0),Y=Dh(X,l0(),l0()),G=`_${Q}_zsh_completions`;return[`#compdef ${J}`,"","autoload -U is-at-least","",`function ${G}() {`," typeset -A opt_args"," typeset -a _arguments_options"," local ret=1",""," if is-at-least 5.2; then"," _arguments_options=(-s -S -C)"," else"," _arguments_options=(-s -C)"," fi","",' local context curcontext="$curcontext" state line',...i4(Y,4),"}","",...Z,"",`if [ "$funcstack[1]" = "${G}" ]; then`,` ${G} "$@"`,"else",` compdef ${G} ${Q}`,"fi"]})),Dh=(X,J,Z)=>{switch(X._tag){case"Standard":case"GetUserInput":{let Q=Mz(X)?X2([J2,X.options]):J2,Y=Mz(X)?X.args:Fz,G=z(n3(Q),n0((B)=>`'${B}' \\`)),K=z($V(Y),n0((B)=>`'${B}' \\`));if(G7(J))return['_arguments "${_arguments_options[@]}" \\',...i4(G,4),...i4(K,4),` ":: :_${X.name}_commands" \\`,` "*::: :->${X.name}" \\`," && ret=0"];if(G7(Z))return[`(${X.name})`,'_arguments "${_arguments_options[@]}" \\',...i4(G,4),...i4(K,4)," && ret=0",";;"];return[`(${X.name})`,'_arguments "${_arguments_options[@]}" \\',...i4(G,4),...i4(K,4),` ":: :_${lX(J,X.name).join("__")}_commands" \\`,` "*::: :->${X.name}" \\`," && ret=0"]}case"Map":return Dh(X.command,J,Z);case"Subcommands":{let Q=hP(X),Y=qV(X.parent),G=Dh(X.parent,J,z8(Z,Q)),K=z(X.children,S6((W)=>Dh(W,z8(J,Y),Z))),B=z(z8(J,Y),s8("-")),H=z(Y,S6((W)=>["case $state in",` (${W})`,' words=($line[1] "${words[@]}")'," (( CURRENT += 1 ))",` curcontext="\${curcontext%:*:*}:${B}-command-$line[1]:"`," case $line[1] in",...i4(K,8)," esac"," ;;","esac"]),z8(G7(J)?l0():X8(";;")));return z8(G,H)}}},Fb0=(X)=>{let J=Object.create(p4);return J._tag="HelpRequested",J.error=cX,J.command=X,J};var qS8=DP,DS8=VV,wS8=wP,LS8=rv0,FS8=fg,AS8=av0,TS8=sv0,MS8=LP,PS8=tv0,RS8=FP,jS8=ev0,CS8=Xk0,IS8=Jk0,ES8=sH,SS8=pg,eX0=Fb0,xS8=p3,vS8=b7,kS8=lg,bS8=iq,yS8=E5,gS8=Zk0,hS8=ng,mS8=AP;var o4={};y8(o4,{zipRight:()=>Vx8,zipLeft:()=>Wx8,zip:()=>Hx8,withSpanAnnotations:()=>Bx8,withMinimumLogLevel:()=>X60,withLeveledConsole:()=>tS8,withConsoleLog:()=>sS8,withConsoleError:()=>eS8,tracerLogger:()=>_x8,test:()=>Kx8,sync:()=>Gx8,succeed:()=>Yx8,structuredLogger:()=>Ox8,structured:()=>Lx8,stringLogger:()=>zx8,simple:()=>Qx8,replaceScoped:()=>Zx8,replaceEffect:()=>Jx8,replace:()=>dP,remove:()=>jh,prettyLoggerDefault:()=>uP,prettyLogger:()=>Nx8,pretty:()=>wx8,none:()=>Xx8,minimumLogLevel:()=>Fx8,mapInputOptions:()=>iS8,mapInput:()=>nS8,map:()=>rS8,make:()=>cS8,logfmtLogger:()=>Ux8,logFmt:()=>Dx8,jsonLogger:()=>$x8,json:()=>qx8,isLogger:()=>Ax8,filterLogLevel:()=>oS8,defaultLogger:()=>ZD,batched:()=>aS8,addScoped:()=>lS8,addEffect:()=>pS8,add:()=>fS8,LoggerTypeId:()=>uS8});var Ab0=$(2,(X,J)=>X.log({fiberId:Y$,logLevel:sN,message:J,cause:UF,context:cI(),spans:Z4(),annotations:qZ(),date:new Date}));var uS8=FO,cS8=nJ,fS8=EA,pS8=io,lS8=oo,nS8=H20,iS8=yE,oS8=W20,rS8=rL,aS8=ZW0,sS8=RO,tS8=r10,eS8=a10,Xx8=V20,jh=SA,dP=aO0,Jx8=sO0,Zx8=tO0,Qx8=gE,Yx8=$20,Gx8=U20,Kx8=Ab0,X60=rO0,Bx8=JW0,Hx8=hE,Wx8=z20,Vx8=N20,ZD=n$,$x8=uE,Ux8=dE,zx8=mE,Nx8=Al,uP=cE,Ox8=aL,_x8=pl,qx8=dP(n$,s10),Dx8=dP(n$,t10),wx8=dP(n$,e10),Lx8=dP(n$,XW0),Fx8=oO0,Ax8=_20;var Tb0=t;var Mx8={pipe(){return K0(this,arguments)}},Pb0=(X)=>{let J=Object.create(Mx8);return J.name=X.name,J.version=X.version,J.executable=X.executable,J.command=X.command,J.summary=X.summary||R5,J.footer=X.footer||cX,J},Ch=$(3,(X,J,Z)=>gi((Q)=>{let Y=i0(_7(Q,yq),()=>GV),[G,K]=Px8(X,J),B=z8(Rx8(X.command),K);return q9(Db0(X.command,B,Y),{onFailure:(H)=>C0(J60(H.error),Y0(H)),onSuccess:Tb0((H)=>{switch(H._tag){case"UserDefined":return hJ(H.leftover,{onEmpty:()=>Z(H.value).pipe(U3((W)=>VV(W)&&fg(W)?I(Mb0(X,G,K,eq(Mh(W.command),wh(W.command,Y)),Z,Y,J)):S())),onNonEmpty:(W)=>{let V=h0(`Received unknown argument: '${W}'`);return C0(J60(V),Y0(b7(V)))}});case"BuiltIn":return Mb0(X,G,K,H.option,Z,Y,J).pipe(U3((W)=>VV(W)?I(C0(J60(W.error),Y0(W))):S()))}})})})),Px8=(X,J)=>{if(X.executable!==void 0)return[X.executable,VG(J,2)];let[[Z,Q],Y]=AN(J,2);return[`${Z} ${Q}`,Y]},J60=(X)=>fn(BX(X)),Mb0=(X,J,Z,Q,Y,G,K)=>{switch(Q._tag){case"SetLogLevel":{let B=Ow(K,2),H=[];for(let V=0;V<Z.length;V++){if(Ix8(Z[V])||Z[V-1]==="--log-level")continue;H.push(Z[V])}let W=z8(B,H);return Ch(X,W,Y).pipe(X60(Q.level))}case"ShowHelp":{let B=f4(m3(X.name)),H=h0(xY([d8(`${X.name} ${X.version}`),e90(X.summary)?R5:xY([SY,d8("--"),SY,X.summary])])),W=I8(f4("USAGE"),z(MX0(Q.usage,G),n0((U)=>h0(mZ(d8("$ "),U))),JY(cX,(U,O)=>I8(U,O)))),V=z(B,I8(H),I8(W),I8(Q.helpDoc),I8(X.footer));return q6(BX(V))}case"ShowCompletions":{let B=v0(JD(X.command))[0];switch(Q.shellType){case"bash":return Lh(X.command,B).pipe(h((H)=>q6(s8(H,`
202
+ `))));case"fish":return Fh(X.command,B).pipe(h((H)=>q6(s8(H,`
203
+ `))));case"zsh":return Ah(X.command,B).pipe(h((H)=>q6(s8(H,`
204
+ `))))}}case"ShowWizard":{let B=e90(X.summary)?R5:xY([SY,d8("--"),SY,X.summary]),H=I8(h0(xY([d8("The wizard mode will assist you with constructing commands for"),SY,m3(`${X.name} (${X.version})`),d8(".")])),h0("Please answer all prompts provided by the wizard.")),W=oH([[d8("Instructions"),H]]),V=f4(xY([m3("Wizard Mode for CLI Application:"),SY,m3(X.name),SY,m3(`(${X.version})`),B])),U=I8(V,W),O=BX(U),q=v0(JD(X.command))[0],L=jx8(Q,q,Z);return q6(O).pipe(C0(Rh(Q.command,L,G)),J9((A)=>q6(BX(Cx8(A)))),h((A)=>fq({message:"Would you like to run the command?",initial:!0,active:"yes",inactive:"no"}).pipe(h((M)=>{let x=Ow(K,2),j=VG(A,1),T=z8(x,j);return M?q6().pipe(C0(Ch(X,T,Y))):U0}))),y6((A)=>{if(GX0(A)){let M=h0(vx0(`
205
+
206
+ Quitting wizard mode...`));return q6(BX(M))}return Y0(A)}))}case"ShowVersion":{let B=h0(X.version);return q6(BX(B))}}},Rx8=(X)=>{let J=X,Z=l0();while(J!==void 0)switch(J._tag){case"Standard":{Z=X8(J.name),J=void 0;break}case"GetUserInput":{Z=X8(J.name),J=void 0;break}case"Map":{J=J.command;break}case"Subcommands":{J=J.parent;break}}return Z},jx8=(X,J,Z)=>{let Q=Th(X.command),[Y,G]=DB(Z,(B)=>!N40(Q,B)),K=hJ(G,{onEmpty:()=>xK(Y,(B)=>B!=="--wizard"),onNonEmpty:(B)=>lX(Y,B)});return z8(J.split(/\s+/),K)},Cx8=(X)=>{let J=z(xK(X,(Q)=>Q.length>0),s8(" ")),Z=d8("You may now execute your command directly with the following options and arguments:");return Og([h0(Ng(m3("Wizard Mode Complete!"))),h0(Z),h0(mZ(d8(" "),YV(J,zg)))])},Ix8=(X)=>{return X&&(X==="--log-level"||X.startsWith("--log-level="))};var Sx8="@effect/cli/Command",Ih=Symbol.for(Sx8),xx8=(X)=>{let J=[],Z=0,Q=[],Y=0;function G(B){let H={};for(let W in B)H[W]=K(B[W]);return H}function K(B){if(IK(B))return{_tag:"Array",children:n0(B,K)};else if(PP(B))return J.push(B),{_tag:"Args",index:Z++};else if(EP(B))return Q.push(B),{_tag:"Options",index:Y++};else return{_tag:"ParsedConfig",tree:G(B)}}return{args:J,options:Q,tree:G(X)}},Rb0=(X,J,Z)=>{let Q={};for(let G in X)Q[G]=Y(X[G]);return Q;function Y(G){if(G._tag==="Args")return J[G.index];else if(G._tag==="Options")return Z[G.index];else if(G._tag==="Array")return n0(G.children,Y);else return Rb0(G.tree,J,Z)}},jb0={...dB,[Ih]:Ih,commit(){return this.tag},pipe(){return K0(this,arguments)}},Z60=c0("@effect/cli/Command/registeredDescriptors",()=>new WeakMap),vx8=(X)=>Z60.get(X.tag)??X.descriptor,Cb0=(X,J,Z,Q=t)=>{let Y=Object.create(jb0);return Y.descriptor=X,Y.handler=J,Y.transform=Q,Y.tag=Z,Y},DV=(X,J)=>{let Z=Object.create(jb0);return Z.descriptor=J.descriptor??X.descriptor,Z.handler=J.handler??X.handler,Z.transform=J.transform?(Q,Y)=>J.transform(X.transform(Q,Y),Y):X.transform,Z.tag=X.tag,Z},Q60=$((X)=>Nb0(X[0]),(X,J)=>{let Z=Cb0(X,J??((Q)=>nO(()=>eX0(vx8(Z)))),g8(`@effect/cli/Command/(${v0(JD(X)).join("|")})`));return Z}),kx8=(X,J)=>{let{args:Z,options:Q,tree:Y}=xx8(J);return Ph(Ob0(X,X2(Q),rg(Z)),({args:G,options:K})=>Rb0(Y,G,K))},Ib0=(X,J={},Z)=>Q60(kx8(X,J),Z),Eb0=(X,J)=>wh(X.descriptor,J),Sb0=(X)=>JD(X.descriptor),xb0=(X,J)=>Lh(X.descriptor,J),vb0=(X,J)=>Fh(X.descriptor,J),kb0=(X,J)=>Ah(X.descriptor,J),bb0=(X)=>Th(X.descriptor),yb0=(X)=>Mh(X.descriptor),bx8=$(2,(X,J)=>DV(X,{descriptor:J(X.descriptor)})),gb0=(X,J,Z)=>Cb0(Ph(_b0(X,J),(Q)=>Q.value),Z,g8(`@effect/cli/Prompt/${X}`)),hb0=$(2,(X,J)=>DV(X,{handler:J,transform:t})),mb0=$(2,(X,J)=>DV(X,{transform:J})),db0=$(2,(X,J)=>DV(X,{transform:(Z,Q)=>o6(Z,typeof J==="function"?J(Q):J)})),ub0=$(3,(X,J,Z)=>DV(X,{transform:(Q,Y)=>{let G=typeof Z==="function"?Z(Y):Z;return z5(Q,J,G)}})),cb0=$(2,(X,J)=>DV(X,{transform:(Z,Q)=>{let Y=typeof J==="function"?J(Q):J;return C0(Y,Z)}})),fb0=$(3,(X,J,Z)=>DV(X,{transform:(Q,Y)=>{let G=typeof Z==="function"?Z(Y):Z;return PJ(Q,J,G)}})),pb0=$(2,(X,J)=>bx8(X,wb0(J))),lb0=$(2,(X,J)=>{let Z=Lb0(X.descriptor,n0(J,(G)=>[G.tag,G.descriptor])),Q=OJ(J,new Map,(G,K)=>{return G.set(K.tag,K),Z60.set(K.tag,K.descriptor),G});function Y(G){if(G.subcommand._tag==="Some"){let[K,B]=G.subcommand.value,H=Q.get(K),W=H.transform(H.handler(B),B);return PJ(W,X.tag,G)}return X.handler(G)}return DV(X,{descriptor:Z,handler:Y})}),nb0=$(3,(X,J,Z)=>Rh(X.descriptor,J,Z)),ib0=$(2,(X,J)=>{let Z=Pb0({...J,command:X.descriptor});Z60.set(X.tag,X.descriptor);let Q=(Y)=>X.transform(X.handler(Y),Y);return(Y)=>Ch(Z,Y,Q)});var gx8=Ih,hx8=Q60,mx8=Eb0,dx8=Sb0,ux8=xb0,cx8=vb0,fx8=kb0,px8=bb0,lx8=yb0,nx8=Ib0,ix8=gb0,ox8=db0,rx8=ub0,ax8=cb0,sx8=fb0,tx8=mb0,ex8=pb0,Xv8=hb0,Jv8=lb0,Zv8=nb0,Qv8=ib0;var cQ={};y8(cQ,{toggle:()=>lv8,text:()=>pv8,succeed:()=>fv8,select:()=>uv8,run:()=>dv8,password:()=>mv8,multiSelect:()=>cv8,map:()=>hv8,list:()=>gv8,integer:()=>yv8,hidden:()=>bv8,float:()=>kv8,flatMap:()=>vv8,file:()=>xv8,date:()=>Sv8,custom:()=>Ev8,confirm:()=>Iv8,all:()=>Cv8,PromptTypeId:()=>jv8});var Yv8=V9(UQ,{style:"pretty"});function Gv8(X){return f0(function*(){let Z=yield*(yield*m9).columns,Q=r7(X.message,Z),Y=Q0(zQ,EY);return Q.pipe(Q0(Y),xX(SX),V9({style:"pretty",options:{lineWidth:Z}}))})}var Kv8=/\r?\n/;function ob0(X,J,Z,Q){let Y=(K)=>k0(e0(K),k7),G=Q0(J,m8);return l6(Q.message.split(Kv8),{onEmpty:()=>QZ([G,Z,X]),onNonEmpty:(K)=>{let B=n0(K,(H)=>Y(H));return G.pipe(Q0(hZ(J6(B),2)),Q0(m8),Q0(Z),Q0(m8),Q0(X))}})}function Bv8(X,J){return f0(function*(){let Q=yield*(yield*m9).columns,Y=yield*X7,G=k0(e0("?"),T6),K=k0(Y.pointerSmall,e9),B=X.value?J.placeholder.defaultConfirm:J.placeholder.defaultDeny,H=k0(e0(B),e9),W=ob0(H,G,K,J);return P5.pipe(Q0(W),xX(SX),V9({style:"pretty",options:{lineWidth:Q}}))})}function Hv8(X,J){return f0(function*(){let Q=yield*(yield*m9).columns,Y=yield*X7,G=k0(Y.tick,gZ),K=k0(Y.ellipsis,e9),B=X?J.label.confirm:J.label.deny,H=e0(B);return ob0(H,G,K,J).pipe(Q0(uX),xX(SX),V9({style:"pretty",options:{lineWidth:Q}}))})}function Wv8(X){return(J,Z)=>{return d0.$match(Z,{Beep:()=>y(Yv8),NextFrame:({state:Q})=>Bv8(Q,X),Submit:({value:Q})=>Hv8(Q,X)})}}var Vv8=/^y|t$/,$v8=/^n|f$/;function Uv8(X,J){let Z=i0(X.input,()=>"");if(X.key.name==="enter"||X.key.name==="return")return y(d0.Submit({value:J}));if(Vv8.test(Z.toLowerCase()))return y(d0.Submit({value:!0}));if($v8.test(Z.toLowerCase()))return y(d0.Submit({value:!1}));return y(d0.Beep())}var rb0=(X)=>{let J={initial:!1,...X,label:{confirm:"yes",deny:"no",...X.label},placeholder:{defaultConfirm:"(Y/n)",defaultDeny:"(y/N)",...X.placeholder}},Z={value:J.initial};return kJ(Z,{render:Wv8(J),process:(Q)=>Uv8(Q,J.initial),clear:()=>Gv8(J)})};var Nv8=V9(UQ,{style:"pretty"}),ab0=/\r?\n/;function sb0(X,J,Z){let Q=(G)=>k0(e0(G),k7),Y=Q0(X,m8);return l6(Z.message.split(ab0),{onEmpty:()=>QZ([Y,J]),onNonEmpty:(G)=>{let K=n0(G,(B)=>Q(B));return Y.pipe(Q0(hZ(J6(K),2)),Q0(m8),Q0(J),Q0(m8))}})}function Ov8(X,J){return w0(X.error,{onNone:()=>C9,onSome:(Z)=>l6(Z.split(ab0),{onEmpty:()=>C9,onNonEmpty:(Q)=>{let Y=(B)=>k0(e0(B),$J(tW,jY)),G=Q0(k0(J,jY),m8),K=n0(Q,(B)=>Y(B));return ZV.pipe(Q0(uX),Q0(G),Q0(lH(J6(K))),Q0(QV))}})})}function _v8(X,J){if(!X.disabled&&X.description&&J)return Hz("-").pipe(Q0(m8),Q0(e0(X.description)),k0(e9));return C9}var tb0=2;function qv8(X,J,Z){let Q=J.choices,Y=Q.length,B=X.selectedIndices.size===Y?J?.selectNone??"Select None":J?.selectAll??"Select All",H=J?.inverseSelection??"Inverse Selection",W=[{title:B},{title:H}],V=[...W,...Q],U=dq(X.index,V.length,J.maxPerPage),O=[];for(let q=U.startIndex;q<U.endIndex;q++){let L=V[q],A=X.index===q,M=m8;if(q===U.startIndex&&U.startIndex>0)M=Z.arrowUp;else if(q===U.endIndex-1&&U.endIndex<V.length)M=Z.arrowDown;if(q<W.length){let x=A?k0(e0(L.title),T6):e0(L.title);O.push(M.pipe(Q0(m8),Q0(x)))}else{let x=q-W.length,T=X.selectedIndices.has(x)?Z.checkboxOn:Z.checkboxOff,E=A?k0(T,T6):T,k=e0(L.title),P=_v8(L,A);O.push(M.pipe(Q0(m8),Q0(E),Q0(m8),Q0(k),Q0(m8),Q0(P)))}}return J6(O)}function Dv8(X,J){return f0(function*(){let Q=yield*(yield*m9).columns,Y=yield*X7,G=qv8(X,J,Y),K=k0(e0("?"),T6),B=k0(Y.pointerSmall,e9),H=sb0(K,B,J),W=Ov8(X,Y.pointer);return P5.pipe(Q0(H),Q0(uX),Q0(G),Q0(W),V9({style:"pretty",options:{lineWidth:Q}}))})}function wv8(X,J){return f0(function*(){let Q=yield*(yield*m9).columns,Y=yield*X7,K=Array.from(X.selectedIndices).sort(tZ).map((U)=>J.choices[U].title).join(", "),B=e0(K),H=k0(Y.tick,gZ),W=k0(Y.ellipsis,e9);return sb0(H,W,J).pipe(Q0(m8),Q0(k0(B,b3)),Q0(uX),V9({style:"pretty",options:{lineWidth:Q}}))})}function Lv8(X,J){let Z=X.index===0?J-1:X.index-1;return y(d0.NextFrame({state:{...X,index:Z}}))}function Fv8(X,J){let Z=(X.index+1)%J;return y(d0.NextFrame({state:{...X,index:Z}}))}function Av8(X,J){let Z=new Set(X.selectedIndices);if(X.index===0)if(X.selectedIndices.size===J.choices.length)Z.clear();else for(let Q=0;Q<J.choices.length;Q++)Z.add(Q);else if(X.index===1)for(let Q=0;Q<J.choices.length;Q++)if(X.selectedIndices.has(Q))Z.delete(Q);else Z.add(Q);else{let Q=X.index-tb0;if(Z.has(Q))Z.delete(Q);else Z.add(Q)}return y(d0.NextFrame({state:{...X,selectedIndices:Z}}))}function Tv8(X){return f0(function*(){let Z=yield*(yield*m9).columns,Q=Q0(zQ,EY),Y=`
207
+ `.repeat(Math.min(X.choices.length+2,X.maxPerPage))+X.message+1;return r7(Y,Z).pipe(Q0(Q),xX(SX),V9({style:"pretty",options:{lineWidth:Z}}))})}function Mv8(X){return(J,Z)=>{let Q=X.choices.length+tb0;switch(J.key.name){case"k":case"up":return Lv8({...Z,error:S()},Q);case"j":case"down":case"tab":return Fv8({...Z,error:S()},Q);case"space":return Av8(Z,X);case"enter":case"return":{let Y=Z.selectedIndices.size;if(X.min!==void 0&&Y<X.min)return y(d0.NextFrame({state:{...Z,error:I(`At least ${X.min} are required`)}}));if(X.max!==void 0&&Y>X.max)return y(d0.NextFrame({state:{...Z,error:I(`At most ${X.max} choices are allowed`)}}));let G=Array.from(Z.selectedIndices).sort(tZ).map((K)=>X.choices[K].value);return y(d0.Submit({value:G}))}default:return y(d0.Beep())}}}function Pv8(X){return(J,Z)=>{return d0.$match(Z,{Beep:()=>y(Nv8),NextFrame:({state:Q})=>Dv8(Q,X),Submit:()=>wv8(J,X)})}}var eb0=(X)=>{let J={maxPerPage:10,...X},Z=new Set;for(let Q=0;Q<J.choices.length;Q++)if(J.choices[Q].selected===!0)Z.add(Q);return kJ({index:0,selectedIndices:Z,error:S()},{render:Pv8(J),process:Mv8(J),clear:()=>Tv8(J)})};var jv8=qg,Cv8=lx0,Iv8=rb0,Ev8=kJ,Sv8=Mg,xv8=Ig,vv8=XP,kv8=Eg,bv8=HP,yv8=HV,gv8=Yh,hv8=YZ,mv8=uv0,dv8=JP,uv8=I5,cv8=eb0,fv8=wg,pv8=cq,lv8=fq;var fQ={};y8(fQ,{workingDirectory:()=>$k8,string:()=>Hk8,streamLines:()=>Bk8,stream:()=>Kk8,stdout:()=>Vk8,stdin:()=>gh,stderr:()=>Wk8,start:()=>Gk8,runInShell:()=>Yk8,pipeTo:()=>Qk8,make:()=>Zk8,lines:()=>Jk8,isCommand:()=>sv8,flatten:()=>yh,feed:()=>Xk8,exitCode:()=>ev8,env:()=>tv8,CommandTypeId:()=>av8});var Eh=Symbol.for("@effect/platform/CommandExecutor"),Xy0=Symbol.for("@effect/platform/Process"),Jy0=IA(),Zy0=IA(),Q2=g8("@effect/platform/CommandExecutor"),Qy0=(X)=>{let J=(Q)=>lG(u(X(Q),(Y)=>Y.stdout)),Z=(Q,Y)=>{let G=new TextDecoder(Y);return wt(Nt(J(Q),p9((K)=>G.decode(K))))};return{[Eh]:Eh,start:X,exitCode:(Q)=>l7(h(X(Q),(Y)=>Y.exitCode)),stream:J,string:(Q,Y="utf-8")=>{let G=new TextDecoder(Y);return z(X(Q),h((K)=>IH(K.stdout,nv8)),u((K)=>G.decode(K)),l7)},lines:(Q,Y="utf-8")=>{return z(Z(Q,Y),qt,u(Tw))},streamLines:Z}},nv8=oA0(new Uint8Array,(X,J)=>t5(J,X,(Z,Q)=>{let Y=new Uint8Array(Z.length+Q.length);return Y.set(Z),Y.set(Q,Z.length),Y}));var cP=Symbol.for("@effect/platform/Command"),G60=(X)=>typeof X==="object"&&X!=null&&(cP in X),Sh=$(2,(X,J)=>{switch(X._tag){case"StandardCommand":return Pz({...X,env:q40(X.env,J4(Object.entries(J).filter(([Z])=>Z!==void 0)))});case"PipedCommand":return fP(Sh(X.left,J),Sh(X.right,J))}}),Gy0=(X)=>h(Q2,(J)=>J.exitCode(X)),Ky0=$(2,(X,J)=>bh(X,lT(m0(new TextEncoder().encode(J))))),By0=(X)=>Array.from(Y60(X)),Y60=(X)=>{switch(X._tag){case"StandardCommand":return m0(X);case"PipedCommand":return f8(Y60(X.left),Y60(X.right))}},xh=$(2,(X,J)=>{switch(X._tag){case"StandardCommand":return Pz({...X,shell:J});case"PipedCommand":return fP(xh(X.left,J),xh(X.right,J))}}),Hy0=(X,J="utf-8")=>h(Q2,(Z)=>Z.lines(X,J)),Wy0={[cP]:cP,pipe(){return K0(this,arguments)},...aQ},iv8={...Wy0,_tag:"StandardCommand",toJSON(){return{_id:"@effect/platform/Command",_tag:this._tag,command:this.command,args:this.args,env:Object.fromEntries(this.env),cwd:this.cwd.toJSON(),shell:this.shell,gid:this.gid.toJSON(),uid:this.uid.toJSON()}}},Pz=(X)=>Object.assign(Object.create(iv8),X),ov8={...Wy0,_tag:"PipedCommand",toJSON(){return{_id:"@effect/platform/Command",_tag:this._tag,left:this.left.toJSON(),right:this.right.toJSON()}}},kh=(X)=>Object.assign(Object.create(ov8),X),Vy0=(X,...J)=>Pz({command:X,args:J,env:qZ(),cwd:S(),shell:!1,stdin:"pipe",stdout:"pipe",stderr:"pipe",gid:S(),uid:S()}),fP=$(2,(X,J)=>kh({left:X,right:J})),K60=$(2,(X,J)=>{switch(X._tag){case"StandardCommand":return Pz({...X,stderr:J});case"PipedCommand":return kh({...X,right:K60(X.right,J)})}}),bh=$(2,(X,J)=>{switch(X._tag){case"StandardCommand":return Pz({...X,stdin:J});case"PipedCommand":return kh({...X,left:bh(X.left,J)})}}),B60=$(2,(X,J)=>{switch(X._tag){case"StandardCommand":return Pz({...X,stdout:J});case"PipedCommand":return kh({...X,right:B60(X.right,J)})}}),$y0=(X)=>h(Q2,(J)=>J.start(X)),Uy0=(X)=>Xb(Q2,(J)=>J.stream(X)),zy0=(X,J)=>Xb(Q2,(Z)=>Z.streamLines(X,J)),Ny0=$((X)=>G60(X[0]),(X,J)=>h(Q2,(Z)=>Z.string(X,J))),vh=$(2,(X,J)=>{switch(X._tag){case"StandardCommand":return Pz({...X,cwd:I(J)});case"PipedCommand":return fP(vh(X.left,J),vh(X.right,J))}});var av8=cP,sv8=G60,tv8=Sh,ev8=Gy0,Xk8=Ky0,yh=By0,Jk8=Hy0,Zk8=Vy0,Qk8=fP,Yk8=xh,Gk8=$y0,Kk8=Uy0,Bk8=zy0,Hk8=Ny0,Wk8=K60,gh=bh,Vk8=B60,$k8=vh;var Y2={};y8(Y2,{makeExecutor:()=>$60,TypeId:()=>Uk8,ProcessTypeId:()=>hh,ProcessId:()=>V60,ExitCode:()=>W60,CommandExecutor:()=>H60});var Uk8=Eh,H60=Q2,hh=Xy0,W60=Jy0,V60=Zy0,$60=Qy0;var v5={};y8(v5,{withTracerPropagation:()=>wb8,withTracerDisabledWhen:()=>qb8,withSpanNameGenerator:()=>Fb8,withScope:()=>Ab8,withCookiesRef:()=>Nb8,transformResponse:()=>Yb8,transform:()=>Qb8,tapRequest:()=>zb8,tapError:()=>Ub8,tap:()=>$b8,retryTransient:()=>Vb8,retry:()=>Wb8,put:()=>nk8,post:()=>pk8,patch:()=>lk8,options:()=>ok8,mapRequestInputEffect:()=>Hb8,mapRequestInput:()=>Bb8,mapRequestEffect:()=>Kb8,mapRequest:()=>Gb8,makeWith:()=>Zb8,make:()=>eP,layerMergedContext:()=>XR,head:()=>fk8,get:()=>ck8,followRedirects:()=>Ob8,filterStatusOk:()=>Jb8,filterStatus:()=>Xb8,filterOrFail:()=>ek8,filterOrElse:()=>tk8,execute:()=>uk8,del:()=>ik8,currentTracerPropagation:()=>Db8,currentTracerDisabledWhen:()=>_b8,catchTags:()=>sk8,catchTag:()=>ak8,catchAll:()=>rk8,TypeId:()=>mk8,SpanNameGenerator:()=>Lb8,HttpClient:()=>dk8});var Oy0=Symbol.for("@effect/platform/Cookies");var _y0=Symbol.for("@effect/platform/Cookies/Cookie");var zk8={[Oy0]:Oy0,...aQ,toJSON(){return{_id:"@effect/platform/Cookies",cookies:Rc(this.cookies,(X)=>X.toJSON())}},pipe(){return K0(this,arguments)}},Dy0=(X)=>{let J=Object.create(zk8);return J.cookies=X,J},wy0=(X)=>{let J={};for(let Z of X)J[Z.name]=Z;return Dy0(J)},QD=(X)=>{let J=typeof X==="string"?[X]:X,Z=[];for(let Q of J){let Y=Nk8(Q.trim());if(R0(Y))Z.push(Y.value)}return wy0(Z)};function Nk8(X){let J=X.split(";").map((B)=>B.trim()).filter((B)=>B!=="");if(J.length===0)return S();let Z=J[0].indexOf("=");if(Z===-1)return S();let Q=J[0].slice(0,Z);if(!Ok8.test(Q))return S();let Y=J[0].slice(Z+1),G=_k8(Y);if(J.length===1)return I(Object.assign(Object.create(qy0),{name:Q,value:G,valueEncoded:Y}));let K={};for(let B=1;B<J.length;B++){let H=J[B],W=H.indexOf("="),V=W===-1?H:H.slice(0,W).trim(),U=W===-1?void 0:H.slice(W+1).trim();switch(V.toLowerCase()){case"domain":{if(U===void 0)break;let O=U.trim().replace(/^\./,"");if(O)K.domain=O;break}case"expires":{if(U===void 0)break;let O=new Date(U);if(!isNaN(O.getTime()))K.expires=O;break}case"max-age":{if(U===void 0)break;let O=parseInt(U,10);if(!isNaN(O))K.maxAge=eV(O);break}case"path":{if(U===void 0)break;if(U[0]==="/")K.path=U;break}case"priority":{if(U===void 0)break;switch(U.toLowerCase()){case"low":K.priority="low";break;case"medium":K.priority="medium";break;case"high":K.priority="high";break}break}case"httponly":{K.httpOnly=!0;break}case"secure":{K.secure=!0;break}case"partitioned":{K.partitioned=!0;break}case"samesite":{if(U===void 0)break;switch(U.toLowerCase()){case"lax":K.sameSite="lax";break;case"strict":K.sameSite="strict";break;case"none":K.sameSite="none";break}break}}}return I(Object.assign(Object.create(qy0),{name:Q,value:G,valueEncoded:Y,options:Object.keys(K).length>0?K:void 0}))}var G2=wy0([]),U60=(X)=>WG(X.cookies),Ok8=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,qy0={[_y0]:_y0,...aQ,toJSON(){return{_id:"@effect/platform/Cookies/Cookie",name:this.name,value:this.value,options:this.options}}};var z60=$(2,(X,J)=>Dy0({...X.cookies,...J.cookies}));var Ly0=(X)=>Object.values(X.cookies).map((J)=>`${J.name}=${J.valueEncoded}`).join("; ");var _k8=(X)=>{try{return decodeURIComponent(X)}catch{return X}};var Fy0=Symbol.for("@effect/platform/Headers");var lP=Object.assign(Object.create(null),{[Fy0]:Fy0,[WN](X){return uh(this,FG(X,q60))}}),mh=(X)=>Object.assign(Object.create(lP),X);var GK=Object.create(lP),GZ=(X)=>{if(X===void 0)return GK;else if(Symbol.iterator in X){let Z=Object.create(lP);for(let[Q,Y]of X)Z[Q.toLowerCase()]=Y;return Z}let J=Object.create(lP);for(let[Z,Q]of Object.entries(X))if(Array.isArray(Q))J[Z.toLowerCase()]=Q.join(", ");else if(Q!==void 0)J[Z.toLowerCase()]=Q;return J},N60=(X)=>Object.setPrototypeOf(X,lP);var nP=$(3,(X,J,Z)=>{let Q=mh(X);return Q[J.toLowerCase()]=Z,Q}),O60=$(2,(X,J)=>mh({...X,...GZ(J)})),dh=$(2,(X,J)=>{let Z=mh(X);return Object.assign(Z,J),Z}),_60=$(2,(X,J)=>{let Z=mh(X),Q=(Y)=>{if(typeof Y==="string"){let G=Y.toLowerCase();if(G in X)delete Z[G]}else for(let G in X)if(Y.test(G))delete Z[G]};if(Array.isArray(J))for(let Y=0;Y<J.length;Y++)Q(J[Y]);else Q(J);return Z}),uh=$(2,(X,J)=>{let Z={...X},Q=(Y)=>{if(typeof Y==="string"){let G=Y.toLowerCase();if(G in X)Z[G]=L5(X[G])}else for(let G in X)if(Y.test(G))Z[G]=L5(X[G])};if(Array.isArray(J))for(let Y=0;Y<J.length;Y++)Q(J[Y]);else Q(J);return Z}),q60=c0("@effect/platform/Headers/currentRedactedNames",()=>dG(["authorization","cookie","set-cookie","x-api-key"]));var K2={};y8(K2,{isHttpClientError:()=>D60,TypeId:()=>ch,ResponseError:()=>N7,RequestError:()=>r4});var Ay0=Symbol.for("@effect/platform/HttpClientError");var ch=Ay0,D60=(X)=>V0(X,ch);class r4 extends Uq(ch,"RequestError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return this.description?`${this.reason}: ${this.description} (${this.methodAndUrl})`:`${this.reason} error (${this.methodAndUrl})`}}class N7 extends Uq(ch,"ResponseError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let X=`${this.response.status} ${this.methodAndUrl}`;return this.description?`${this.reason}: ${this.description} (${X})`:`${this.reason} error (${X})`}}var KK=(X)=>{let J=Ty0(X),Z=[];for(let Q=0;Q<J.length;Q++)if(Array.isArray(J[Q][0])){let[Y,G]=J[Q];Z.push([`${Y[0]}[${Y.slice(1).join("][")}]`,G])}else Z.push(J[Q]);return Z},Ty0=(X)=>{let J=Symbol.iterator in X?v0(X):Object.entries(X),Z=[];for(let[Q,Y]of J)if(Array.isArray(Y)){for(let G=0;G<Y.length;G++)if(Y[G]!==void 0)Z.push([Q,String(Y[G])])}else if(typeof Y==="object"){let G=Ty0(Y);for(let[K,B]of G)Z.push([[Q,...typeof K==="string"?[K]:K],B])}else if(Y!==void 0)Z.push([Q,String(Y)]);return Z};var My0=[];var Py0=$(3,(X,J,Z)=>lX(xK(X,([Q])=>Q!==J),[J,String(Z)])),Ry0=$(2,(X,J)=>{let Z=KK(J),Q=new Set;for(let Y=0;Y<Z.length;Y++)Q.add(Z[Y][0]);for(let Y=0;Y<X.length;Y++){if(Q.has(X[Y][0]))continue;Z.push(X[Y])}return Z}),jy0=$(3,(X,J,Z)=>lX(X,[J,String(Z)])),Cy0=$(2,(X,J)=>z8(X,KK(J)));var fh=(X,J,Z)=>{try{let Q=new URL(X,Dk8());for(let Y=0;Y<J.length;Y++){let[G,K]=J[Y];if(K!==void 0)Q.searchParams.append(G,K)}if(Z._tag==="Some")Q.hash=Z.value;return O0(Q)}catch(Q){return M0(Q)}},Iy0=(X)=>new URLSearchParams(X).toString(),Dk8=()=>{if("location"in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname;return},wk8=(X)=>{let J=Object.create(null);for(let[Z,Q]of X){let Y=J[Z];if(Y===void 0)J[Z]=Q;else if(typeof Y==="string")J[Z]=[Y,Q];else Y.push(Q)}return{...J}};var Ey0=(X,J)=>(Z)=>{return t9(X,J)(wk8(Z))};var pQ=Symbol.for("@effect/platform/HttpIncomingMessage"),B2=(X,J)=>{let Z=t9(X,J);return(Q)=>h(Q.json,Z)},Sy0=(X,J)=>{let Z=Ey0(X,J);return(Q)=>h(Q.urlParamsBody,Z)},xy0=(X,J)=>{let Z=t9(X,J);return(Q)=>Z(Q.headers)};class ph extends ZJ()("@effect/platform/HttpIncomingMessage/MaxBodySize",{defaultValue:S}){}var GD=(X,J)=>{let Z=X.headers["content-type"]??"",Q;if(Z.includes("application/json"))try{Q=j9(X.json)}catch{}else if(Z.includes("text/")||Z.includes("urlencoded"))try{Q=j9(X.text)}catch{}let Y={...J,headers:cY(X.headers),remoteAddress:X.remoteAddress.toJSON()};if(Q!==void 0)Y.body=Q;return Y};var vy0=(X)=>N60({b3:`${X.traceId}-${X.spanId}-${X.sampled?"1":"0"}${X.parent._tag==="Some"?`-${X.parent.value.spanId}`:""}`,traceparent:`00-${X.traceId}-${X.spanId}-${X.sampled?"01":"00"}`});var w60=Symbol.for("@effect/platform/HttpBody"),ky0=Symbol.for("@effect/platform/HttpBody/HttpBodyError"),Fk8=h1("HttpBodyError"),by0=(X)=>Fk8({[ky0]:ky0,reason:X});class oP{[w60];constructor(){this[w60]=w60}[$8](){return this.toJSON()}toString(){return u8(this)}}class yy0 extends oP{_tag="Empty";toJSON(){return{_id:"@effect/platform/HttpBody",_tag:"Empty"}}}var lh=new yy0;class gy0 extends oP{body;contentType;_tag="Uint8Array";constructor(X,J){super();this.body=X,this.contentType=J}get contentLength(){return this.body.length}toJSON(){return{_id:"@effect/platform/HttpBody",_tag:"Uint8Array",body:this.contentType.startsWith("text/")||this.contentType.endsWith("json")?new TextDecoder().decode(this.body):`Uint8Array(${this.body.length})`,contentType:this.contentType,contentLength:this.contentLength}}}var rP=(X,J)=>new gy0(X,J??"application/octet-stream"),Ak8=new TextEncoder,KD=(X,J)=>rP(Ak8.encode(X),J??"text/plain"),nh=(X,J)=>KD(JSON.stringify(X),J??"application/json"),ih=(X,J)=>HJ({try:()=>nh(X,J),catch:(Z)=>by0({_tag:"JsonError",error:Z})});var L60=(X,J)=>{let Z=E3(X,J);return(Q,Y)=>h(E9(Z(Q),(G)=>by0({_tag:"SchemaError",error:G})),(G)=>ih(G,Y))},hy0=(X,J)=>h($Q,(Z)=>u(Z.stat(X),(Q)=>BD(Z.stream(X,J),J?.contentType,Number(Q.size))));var my0=(X)=>BD(nT(()=>X.stream(),t),X.type,X.size);class F60 extends oP{formData;_tag="FormData";constructor(X){super();this.formData=X}toJSON(){return{_id:"@effect/platform/HttpBody",_tag:"FormData",formData:this.formData}}}var A60=(X)=>new F60(X),dy0=(X)=>{let J=new FormData;for(let[Z,Q]of Object.entries(X))if(Array.isArray(Q))for(let Y of Q){if(Y==null)continue;J.append(Z,typeof Q==="object"?Y:String(Y))}else if(Q!=null)J.append(Z,typeof Q==="object"?Q:String(Q));return new F60(J)};class uy0 extends oP{stream;contentType;contentLength;_tag="Stream";constructor(X,J,Z){super();this.stream=X,this.contentType=J,this.contentLength=Z}toJSON(){return{_id:"@effect/platform/HttpBody",_tag:"Stream",contentType:this.contentType,contentLength:this.contentLength}}}var BD=(X,J,Z)=>new uy0(X,J??"application/octet-stream",Z);var T60=Symbol.for("@effect/platform/HttpClientRequest"),Tk8={[T60]:T60,...aQ,toJSON(){return{_id:"@effect/platform/HttpClientRequest",method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:cY(this.headers),body:this.body.toJSON()}},pipe(){return K0(this,arguments)}};function OQ(X,J,Z,Q,Y,G){let K=Object.create(Tk8);return K.method=X,K.url=J,K.urlParams=Z,K.hash=Q,K.headers=Y,K.body=G,K}var oh=(X)=>typeof X==="object"&&X!==null&&(T60 in X),Mk8=OQ("GET","",My0,S(),GK,lh),H2=(X)=>(J,Z)=>P60(Mk8,{method:X,url:J,...Z??void 0}),rh=H2("GET"),ah=H2("POST"),sh=H2("PUT"),th=H2("PATCH"),eh=H2("DELETE"),Xm=H2("HEAD"),Jm=H2("OPTIONS"),P60=$(2,(X,J)=>{let Z=X;if(J.method)Z=j60(Z,J.method);if(J.url)Z=sP(Z,J.url);if(J.headers)Z=aP(Z,J.headers);if(J.urlParams)Z=C60(Z,J.urlParams);if(J.hash)Z=I60(Z,J.hash);if(J.body)Z=bY(Z,J.body);if(J.accept)Z=Zm(Z,J.accept);if(J.acceptJson)Z=R60(Z);return Z}),Rz=$(3,(X,J,Z)=>OQ(X.method,X.url,X.urlParams,X.hash,nP(X.headers,J,Z),X.body)),aP=$(2,(X,J)=>OQ(X.method,X.url,X.urlParams,X.hash,O60(X.headers,J),X.body)),M60=(X)=>typeof X==="string"?X:kW(X),fy0=$(3,(X,J,Z)=>Rz(X,"Authorization",`Basic ${btoa(`${M60(J)}:${M60(Z)}`)}`)),py0=$(2,(X,J)=>Rz(X,"Authorization",`Bearer ${M60(J)}`)),Zm=$(2,(X,J)=>Rz(X,"Accept",J)),R60=Zm("application/json"),j60=$(2,(X,J)=>OQ(J,X.url,X.urlParams,X.hash,X.headers,X.body)),sP=$(2,(X,J)=>{if(typeof J==="string")return OQ(X.method,J,X.urlParams,X.hash,X.headers,X.body);let Z=new URL(J.toString()),Q=KK(Z.searchParams),Y=Z.hash?I(Z.hash.slice(1)):S();return Z.search="",Z.hash="",OQ(X.method,Z.toString(),Q,Y,X.headers,X.body)}),ly0=$(2,(X,J)=>{if(J==="")return X;let Z=X.url.endsWith("/")?X.url:X.url+"/",Q=J.startsWith("/")?J.slice(1):J;return OQ(X.method,Z+Q,X.urlParams,X.hash,X.headers,X.body)}),ny0=$(2,(X,J)=>OQ(X.method,J.endsWith("/")&&X.url.startsWith("/")?J+X.url.slice(1):J+X.url,X.urlParams,X.hash,X.headers,X.body)),iy0=$(2,(X,J)=>OQ(X.method,J(X.url),X.urlParams,X.hash,X.headers,X.body)),oy0=$(3,(X,J,Z)=>OQ(X.method,X.url,jy0(X.urlParams,J,Z),X.hash,X.headers,X.body)),ry0=$(2,(X,J)=>OQ(X.method,X.url,Cy0(X.urlParams,J),X.hash,X.headers,X.body)),ay0=$(3,(X,J,Z)=>OQ(X.method,X.url,Py0(X.urlParams,J,Z),X.hash,X.headers,X.body)),C60=$(2,(X,J)=>OQ(X.method,X.url,Ry0(X.urlParams,J),X.hash,X.headers,X.body)),I60=$(2,(X,J)=>OQ(X.method,X.url,X.urlParams,I(J),X.headers,X.body)),sy0=(X)=>OQ(X.method,X.url,X.urlParams,S(),X.headers,X.body),ty0=(X)=>Vc(fh(X.url,X.urlParams,X.hash)),bY=$(2,(X,J)=>{let Z=X.headers;if(J._tag==="Empty"||J._tag==="FormData")Z=_60(Z,["Content-type","Content-length"]);else{let Q=J.contentType;if(Q)Z=nP(Z,"content-type",Q);let Y=J.contentLength;if(Y)Z=nP(Z,"content-length",Y.toString())}return OQ(X.method,X.url,X.urlParams,X.hash,Z,J)}),ey0=$((X)=>oh(X[0]),(X,J,Z="application/octet-stream")=>bY(X,rP(J,Z))),Xg0=$((X)=>oh(X[0]),(X,J,Z="text/plain")=>bY(X,KD(J,Z))),Jg0=$(2,(X,J)=>u(ih(J),(Z)=>bY(X,Z))),Zg0=$(2,(X,J)=>bY(X,nh(J))),Qg0=$((X)=>oh(X[0]),(X,J,Z)=>u(hy0(J,Z),(Q)=>bY(X,Q))),Yg0=$(2,(X,J)=>bY(X,my0(J))),Gg0=(X,J)=>{let Z=L60(X,J);return $(2,(Q,Y)=>u(Z(Y),(G)=>bY(Q,G)))},Kg0=$(2,(X,J)=>bY(X,KD(Iy0(KK(J)),"application/x-www-form-urlencoded"))),Bg0=$(2,(X,J)=>bY(X,A60(J))),Hg0=$(2,(X,J)=>bY(X,dy0(J))),Wg0=$((X)=>oh(X[0]),(X,J,{contentLength:Z,contentType:Q="application/octet-stream"}={})=>bY(X,BD(J,Q,Z)));var wV=Symbol.for("@effect/platform/HttpClientResponse"),$g0=(X,J)=>new Ug0(X,J);class Ug0 extends LK{request;source;[pQ];[wV];constructor(X,J){super();this.request=X,this.source=J,this[pQ]=pQ,this[wV]=wV}toJSON(){return GD(this,{_id:"@effect/platform/HttpClientResponse",request:this.request.toJSON(),status:this.status})}get status(){return this.source.status}get headers(){return GZ(this.source.headers)}cachedCookies;get cookies(){if(this.cachedCookies)return this.cachedCookies;return this.cachedCookies=QD(this.source.headers.getSetCookie())}get remoteAddress(){return S()}get stream(){return this.source.body?nT(()=>this.source.body,(X)=>new N7({request:this.request,response:this,reason:"Decode",cause:X})):Xq(new N7({request:this.request,response:this,reason:"EmptyBody",description:"can not create stream from empty body"}))}get json(){return JH(this.text,{try:(X)=>X===""?null:JSON.parse(X),catch:(X)=>new N7({request:this.request,response:this,reason:"Decode",cause:X})})}textBody;get text(){return this.textBody??=TJ({try:()=>this.source.text(),catch:(X)=>new N7({request:this.request,response:this,reason:"Decode",cause:X})}).pipe(EG,j9)}get urlParamsBody(){return h(this.text,(X)=>HJ({try:()=>KK(new URLSearchParams(X)),catch:(J)=>new N7({request:this.request,response:this,reason:"Decode",cause:J})}))}formDataBody;get formData(){return this.formDataBody??=TJ({try:()=>this.source.formData(),catch:(X)=>new N7({request:this.request,response:this,reason:"Decode",cause:X})}).pipe(EG,j9)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody??=TJ({try:()=>this.source.arrayBuffer(),catch:(X)=>new N7({request:this.request,response:this,reason:"Decode",cause:X})}).pipe(EG,j9)}}var zg0=(X,J)=>{let Z=t9(X,J);return(Q)=>h(Q.json,(Y)=>Z({status:Q.status,headers:Q.headers,body:Y}))},Ng0=(X,J)=>{let Z=t9(X,J);return(Q)=>Z({status:Q.status,headers:Q.headers})},Og0=(X)=>rT(u(X,(J)=>J.stream)),_g0=$(2,(X,J)=>{let Z=X.status;if(J[Z])return J[Z](X);else if(Z>=200&&Z<300&&J["2xx"])return J["2xx"](X);else if(Z>=300&&Z<400&&J["3xx"])return J["3xx"](X);else if(Z>=400&&Z<500&&J["4xx"])return J["4xx"](X);else if(Z>=500&&Z<600&&J["5xx"])return J["5xx"](X);return J.orElse(X)}),Qm=$(2,(X,J)=>o0(()=>J(X.status)?y(X):Y0(new N7({response:X,request:X.request,reason:"StatusCode",description:"invalid status code"})))),Ym=(X)=>X.status>=200&&X.status<300?y(X):Y0(new N7({response:X,request:X.request,reason:"StatusCode",description:"non 2xx status code"}));var Pk8=(X)=>`http.request.header.${X}`,Rk8="http.request.method",jk8=(X)=>`http.response.header.${X}`,Ck8="http.response.status_code",Ik8="server.address",Ek8="server.port",Sk8="url.full",xk8="url.path",vk8="url.scheme",kk8="url.query",tP=Symbol.for("@effect/platform/HttpClient"),Km=g8("@effect/platform/HttpClient"),Bm=c0(Symbol.for("@effect/platform/HttpClient/tracerDisabledWhen"),()=>dG(C6)),wg0=$(2,(X,J)=>dZ(X,O5(Bm,J))),Hm=c0(Symbol.for("@effect/platform/HttpClient/currentTracerPropagation"),()=>dG(!0)),Lg0=$(2,(X,J)=>dZ(X,O5(Hm,J))),Wm=ZJ()("@effect/platform/HttpClient/SpanNameGenerator",{defaultValue:()=>(X)=>`http.client ${X.method}`}),Fg0=$(2,(X,J)=>dZ(X,PJ(Wm,J))),bk8={[tP]:tP,pipe(){return K0(this,arguments)},...aQ,toJSON(){return{_id:"@effect/platform/HttpClient"}},get(X,J){return this.execute(rh(X,J))},head(X,J){return this.execute(Xm(X,J))},post(X,J){return this.execute(ah(X,J))},put(X,J){return this.execute(sh(X,J))},patch(X,J){return this.execute(th(X,J))},del(X,J){return this.execute(eh(X,J))},options(X,J){return this.execute(Jm(X,J))}},yk8=(X)=>V0(X,tP),a4=(X,J)=>{let Z=Object.create(bk8);return Z.preprocess=J,Z.postprocess=X,Z.execute=function(Q){return X(J(Q))},Z},Gm=c0("@effect/platform/HttpClient/responseRegistry",()=>{if("FinalizationRegistry"in globalThis&&globalThis.FinalizationRegistry){let J=new FinalizationRegistry((Z)=>{Z.abort()});return{register(Z,Q){J.register(Z,Q,Z)},unregister(Z){J.unregister(Z)}}}let X=new Map;return{register(J,Z){X.set(J,setTimeout(()=>Z.abort(),5000))},unregister(J){let Z=X.get(J);if(Z===void 0)return;clearTimeout(Z),X.delete(J)}}}),Ag0=c0("@effect/platform/HttpClient/scopedRequests",()=>new WeakMap),Tg0=(X)=>a4((J)=>h(J,(Z)=>AJ((Q)=>{let Y=Ag0.get(Z),G=Y??new AbortController,K=fh(Z.url,Z.urlParams,Z.hash);if(K._tag==="Left")return Y0(new r4({request:Z,reason:"InvalidUrl",cause:K.left}));let B=K.right;if(!Q.getFiberRef(nO0)||Q.getFiberRef(Bm)(Z)){let V=X(Z,B,G.signal,Q);if(Y)return V;return U5((U)=>a6(U(V),{onSuccess(O){return Gm.register(O,G),y(new E60(O,G))},onFailure(O){if(PZ(O))G.abort();return MX(O)}}))}let W=z9(Q.currentContext,Wm);return eO(W(Z),{kind:"client",captureStackTrace:!1},(V)=>{if(V.attribute(Rk8,Z.method),V.attribute(Ik8,B.origin),B.port!=="")V.attribute(Ek8,+B.port);V.attribute(Sk8,B.toString()),V.attribute(xk8,B.pathname),V.attribute(vk8,B.protocol.slice(0,-1));let U=B.search.slice(1);if(U!=="")V.attribute(kk8,U);let O=Q.getFiberRef(q60),q=uh(Z.headers,O);for(let L in q)V.attribute(Pk8(L),String(q[L]));return Z=Q.getFiberRef(Hm)?aP(Z,vy0(V)):Z,U5((L)=>L(X(Z,B,G.signal,Q)).pipe(_U(V),a6({onSuccess:(A)=>{V.attribute(Ck8,A.status);let M=uh(A.headers,O);for(let x in M)V.attribute(jk8(x),String(M[x]));if(Y)return y(A);return Gm.register(A,G),y(new E60(A,G))},onFailure(A){if(!Y&&PZ(A))G.abort();return MX(A)}})))})})),y);class E60{original;controller;constructor(X,J){this.original=X,this.controller=J}[wV]=wV;[pQ]=pQ;applyInterrupt(X){return o0(()=>{return Gm.unregister(this.original),rF(X,()=>L0(()=>{this.controller.abort()}))})}get request(){return this.original.request}get status(){return this.original.status}get headers(){return this.original.headers}get cookies(){return this.original.cookies}get remoteAddress(){return this.original.remoteAddress}get formData(){return this.applyInterrupt(this.original.formData)}get text(){return this.applyInterrupt(this.original.text)}get json(){return this.applyInterrupt(this.original.json)}get urlParamsBody(){return this.applyInterrupt(this.original.urlParamsBody)}get arrayBuffer(){return this.applyInterrupt(this.original.arrayBuffer)}get stream(){return Lt(()=>{return Gm.unregister(this.original),zt(this.original.stream,L0(()=>{this.controller.abort()}))})}toJSON(){return this.original.toJSON()}[$8](){return this.original[$8]()}}var Mg0=(X)=>S60(X,(J,Z)=>{let Q=new AbortController;return Ag0.set(Z,Q),C0(tF((Y)=>FJ(Y,L0(()=>Q.abort()))),J)}),{del:Pg0,execute:Rg0,get:jg0,head:Cg0,options:Ig0,patch:Eg0,post:Sg0,put:xg0}=hi(Km),S60=$(2,(X,J)=>{let Z=X;return a4(h((Q)=>J(Z.postprocess(y(Q)),Q)),Z.preprocess)}),vg0=$(2,(X,J)=>dZ(X,h(Qm(J)))),kg0=(X)=>dZ(X,h(Ym)),dZ=$(2,(X,J)=>{let Z=X;return a4((Q)=>J(Z.postprocess(Q)),Z.preprocess)}),bg0=$(3,(X,J,Z)=>dZ(X,QQ(J,Z))),yg0=$(2,(X,J)=>dZ(X,iO(J))),gg0=$(2,(X,J)=>dZ(X,y6(J))),hg0=$(3,(X,J,Z)=>dZ(X,di(J,Z))),mg0=$(3,(X,J,Z)=>dZ(X,ui(J,Z))),dg0=$(2,(X,J)=>{let Z=X;return a4(Z.postprocess,(Q)=>u(Z.preprocess(Q),J))}),ug0=$(2,(X,J)=>{let Z=X;return a4(Z.postprocess,(Q)=>h(Z.preprocess(Q),J))}),cg0=$(2,(X,J)=>{let Z=X;return a4(Z.postprocess,(Q)=>Z.preprocess(J(Q)))}),fg0=$(2,(X,J)=>{let Z=X;return a4(Z.postprocess,(Q)=>h(J(Q),Z.preprocess))}),pg0=$(2,(X,J)=>dZ(X,z3(J))),lg0=$(2,(X,J)=>{let Z=FD0 in J,Q=Z?"both":J.mode??"both",Y=Z?J:J.schedule,G=Y&&TD0(Y),K=Z?void 0:J.times;return dZ(X,x2(Q==="errors-only"?t:sO({schedule:G,times:K,while:ng0}),Q==="response-only"?t:z3({while:Z||J.while===void 0?Dg0:cQ0(Dg0,J.while),schedule:Y,times:K})))}),Dg0=(X)=>V0(X,Jn)||gk8(X),gk8=(X)=>D60(X)&&(X._tag==="RequestError"&&X.reason==="Transport"||X._tag==="ResponseError"&&ng0(X.response)),ng0=(X)=>X.status===408||X.status===429||X.status===500||X.status===502||X.status===503||X.status===504,ig0=$(2,(X,J)=>dZ(X,J9(J))),og0=$(2,(X,J)=>dZ(X,QA(J))),rg0=$(2,(X,J)=>{let Z=X;return a4(Z.postprocess,(Q)=>J9(Z.preprocess(Q),J))}),ag0=$(2,(X,J)=>{let Z=X;return a4((Q)=>J9(Z.postprocess(Q),(Y)=>lJ(J,(G)=>z60(G,Y.cookies))),(Q)=>h(Z.preprocess(Q),(Y)=>u(ZX(J),(G)=>U60(G)?Y:Rz(Y,"cookie",Ly0(G)))))}),sg0=$((X)=>yk8(X[0]),(X,J)=>{let Z=X;return a4((Q)=>{let Y=(G,K)=>h(Z.postprocess(y(G)),(B)=>B.status>=300&&B.status<400&&B.headers.location&&K<(J??10)?Y(sP(G,new URL(B.headers.location,B.request.url)),K+1):y(B));return h(Q,(G)=>Y(G,0))},Z.preprocess)}),tg0=(X)=>GQ(Km,h(EX(),(J)=>u(X,(Z)=>dZ(Z,rO((Q)=>CX(J,Q))))));var mk8=tP,dk8=Km,uk8=Rg0,ck8=jg0,fk8=Cg0,pk8=Sg0,lk8=Eg0,nk8=xg0,ik8=Pg0,ok8=Ig0,rk8=gg0,ak8=bg0,sk8=yg0,tk8=hg0,ek8=mg0,Xb8=vg0,Jb8=kg0,Zb8=a4,eP=Tg0,Qb8=S60,Yb8=dZ,Gb8=dg0,Kb8=ug0,Bb8=cg0,Hb8=fg0,Wb8=pg0,Vb8=lg0,$b8=ig0,Ub8=og0,zb8=rg0,Nb8=ag0,Ob8=sg0,_b8=Bm,qb8=wg0,Db8=Hm,wb8=Lg0,XR=tg0,Lb8=Wm,Fb8=Fg0,Ab8=Mg0;var Z6={};y8(Z6,{updateUrl:()=>ub8,toUrl:()=>ib8,setUrlParams:()=>JR,setUrlParam:()=>cb8,setUrl:()=>hb8,setMethod:()=>xb8,setHeaders:()=>x60,setHeader:()=>vb8,setHash:()=>lb8,setBody:()=>ob8,schemaBodyJson:()=>tb8,removeHash:()=>nb8,put:()=>jb8,prependUrl:()=>mb8,post:()=>Pb8,patch:()=>Rb8,options:()=>Eb8,modify:()=>Sb8,make:()=>LV,head:()=>Ib8,get:()=>Mb8,del:()=>Cb8,bodyUrlParams:()=>eb8,bodyUnsafeJson:()=>sb8,bodyUint8Array:()=>rb8,bodyText:()=>ab8,bodyStream:()=>Zy8,bodyJson:()=>HD,bodyFormDataRecord:()=>Jy8,bodyFormData:()=>Xy8,bodyFileWeb:()=>Yy8,bodyFile:()=>Qy8,bearerToken:()=>bb8,basicAuth:()=>kb8,appendUrlParams:()=>pb8,appendUrlParam:()=>fb8,appendUrl:()=>db8,acceptJson:()=>gb8,accept:()=>yb8,TypeId:()=>Tb8});var Tb8=Symbol.for("@effect/platform/HttpClientRequest"),LV=H2,Mb8=rh,Pb8=ah,Rb8=th,jb8=sh,Cb8=eh,Ib8=Xm,Eb8=Jm,Sb8=P60,xb8=j60,vb8=Rz,x60=aP,kb8=fy0,bb8=py0,yb8=Zm,gb8=R60,hb8=sP,mb8=ny0,db8=ly0,ub8=iy0,cb8=ay0,JR=C60,fb8=oy0,pb8=ry0,lb8=I60,nb8=sy0,ib8=ty0,ob8=bY,rb8=ey0,ab8=Xg0,HD=Jg0,sb8=Zg0,tb8=Gg0,eb8=Kg0,Xy8=Bg0,Jy8=Hg0,Zy8=Wg0,Qy8=Qg0,Yy8=Yg0;var zJ={};y8(zJ,{stream:()=>Hy8,schemaNoBody:()=>By8,schemaJson:()=>Ky8,schemaHeaders:()=>xy0,schemaBodyUrlParams:()=>Sy0,schemaBodyJson:()=>B2,matchStatus:()=>FV,fromWeb:()=>Gy8,filterStatusOk:()=>Vy8,filterStatus:()=>Wy8,TypeId:()=>W2});var W2=wV,Gy8=$g0,Ky8=zg0,By8=Ng0,Hy8=Og0,FV=_g0,Wy8=Qm,Vy8=Ym;var Nm={};y8(Nm,{layer:()=>wy8});import*as Um from"node:child_process";var fX=(X,J)=>(Z,[Q])=>{let Y="Unknown";switch(Z.code){case"ENOENT":Y="NotFound";break;case"EACCES":Y="PermissionDenied";break;case"EEXIST":Y="AlreadyExists";break;case"EISDIR":Y="BadResource";break;case"ENOTDIR":Y="BadResource";break;case"EBUSY":Y="Busy";break;case"ELOOP":Y="BadResource";break}return new VQ({reason:Y,module:X,method:J,pathOrDescriptor:Q,syscall:Z.syscall,description:Z.message,cause:Z})};import{Readable as $y8}from"node:stream";var AV=(X,J,Z)=>fU(v60(X,J,Z)),eg0=(X,J)=>{let Z=J.maxBytes?Number(J.maxBytes):void 0;return p1(L0(()=>{let Q=X();return Q.setEncoding(J.encoding??"utf8"),Q}),(Q)=>b6((Y)=>{let G="",K=0;Q.once("error",(B)=>{Y(Y0(J.onFailure(B)))}),Q.once("end",()=>{Y(y(G))}),Q.on("data",(B)=>{if(G+=B,K+=Buffer.byteLength(B),Z&&K>Z)Y(Y0(J.onFailure(Error("maxBytes exceeded"))))})}),(Q)=>L0(()=>{if("closed"in Q&&!Q.closed)Q.destroy()}))},Xh0=(X,J)=>{let Z=J.maxBytes?Number(J.maxBytes):void 0;return p1(L0(X),(Q)=>b6((Y)=>{let G=Buffer.alloc(0),K=0;Q.once("error",(B)=>{Y(Y0(J.onFailure(B)))}),Q.once("end",()=>{Y(y(G))}),Q.on("data",(B)=>{if(G=Buffer.concat([G,B]),K+=B.length,Z&&K>Z)Y(Y0(J.onFailure(Error("maxBytes exceeded"))))})}),(Q)=>L0(()=>{if("closed"in Q&&!Q.closed)Q.destroy()}))},Vm=(X,J,Z)=>rk(()=>{let Q=X();if(!Q.readable)return e_;let Y=uJ(void 0);return ok(Qh0(Q,J,Y,Z),k60(Q,(G)=>L0(()=>oZ(Y,_9(G))),Z))}),Jh0=$((X)=>(pT in X[0]),(X,J,Z,Q)=>Jb(X,Vm(J,Z,Q))),Zh0=$(2,(X,J)=>Jb(X,Vm(J,(Z)=>new VQ({module:"Stream",method:"pipeThroughSimple",reason:"Unknown",cause:Z})))),v60=(X,J,Z)=>rk(()=>Qh0(X(),J,uJ(void 0),Z)),k60=(X,J,{encoding:Z,endOnDone:Q=!0}={},Y=U0)=>{let G=Uy8(X,Z),K=Q?b6((B)=>{if("closed"in X&&X.closed)B(U0);else X.once("finish",()=>B(U0)),X.end()}):U0;return{awaitRead:()=>U0,emit:G,error:(B)=>C0(K,J(B)),done:(B)=>C0(K,Y)}},Uy8=(X,J)=>(Z)=>Z.length===0?U0:b6((Q)=>{let Y=Z[Symbol.iterator](),G=Y.next();function K(){let B=G;G=Y.next();let H=X.write(B.value,J);if(G.done)Q(U0);else if(H)K();else X.once("drain",K)}K()}),Qh0=(X,J,Z,Q)=>{if(!X.readable)return e_;let Y=kG(!1);function G(){Y.unsafeOpen()}function K(V){Z.current=WX(J(V)),Y.unsafeOpen()}function B(){Z.current=eZ,Y.unsafeOpen()}X.on("readable",G),X.on("error",K),X.on("end",B);let H=Q?.chunkSize?Number(Q.chunkSize):void 0,W=rk(function V(){let U=X.read(H);if(U===null){if(Z.current)return lA0(Z.current);return Y.unsafeClose(),EW(Y.await,V)}let O=[U];while(!0){if(U=X.read(H),U===null)return EW(ak(Q8(O)),V);O.push(U)}});return pA0(W,L0(()=>{if(X.off("readable",G),X.off("error",K),X.off("end",B),Q?.closeOnDone!==!1&&"closed"in X&&!X.closed)X.destroy()}))};class b60 extends $y8{readLatch;fiber=void 0;constructor(X,J){super({});this.readLatch=kG(!1),this.fiber=KQ(X)(this.readLatch.whenOpen(Jq(J,(Z)=>this.readLatch.whenOpen(L0(()=>{if(Z.length===0)return;this.readLatch.unsafeClose();for(let Q of Z)if(typeof Q==="string")this.push(Q,"utf8");else this.push(Q)}))))),this.fiber.addObserver((Z)=>{if(this.fiber=void 0,CQ(Z))this.push(null);else this.destroy(BJ(Z.cause))})}_read(X){this.readLatch.unsafeOpen()}_destroy(X,J){if(!this.fiber)return J(X);NY(T7(this.fiber)).addObserver((Z)=>{J(Z._tag==="Failure"?BJ(Z.cause):X)})}}var Yh0=(X)=>u(xQ(),(J)=>new b60(J,X)),Gh0=(X)=>new b60(A3,X);var $m=(X,J,Z)=>aA0(y60(X,J,Z)),y60=(X,J,Z)=>EW(j7(L0(()=>X()),F9()),([Q,Y])=>ok(Ny8(Q,Y,J),k60(Q,(G)=>V5(Y,G),Z,Jx(Y,U0)))),Ny8=(X,J,Z)=>o0(()=>{function Q(Y){$5(J,Y0(Z(Y)))}return X.on("error",Q),RZ(h8(J),L0(()=>{X.removeListener("error",Q)}))});var _y8=(X)=>typeof X==="string"?X:"pipe",Kh0=(X)=>typeof X==="string"?X:"pipe",ZR=(X)=>X instanceof globalThis.Error?X:new globalThis.Error(String(X)),TV=(X,J,Z)=>{let Q=yh(Z).reduce((Y,G)=>{let K=`${G.command} ${G.args.join(" ")}`;return Y.length===0?K:`${Y} | ${K}`},"");return fX("Command",X)(J,[Q])},qy8={[hh]:hh,...aQ,toJSON(){return{_id:"@effect/platform/CommandExecutor/Process",pid:this.pid}}},QR=(X)=>(J)=>{switch(J._tag){case"StandardCommand":{let Z=h(F9(),(G)=>b6((K)=>{let B=Um.spawn(J.command,J.args,{stdio:[_y8(J.stdin),Kh0(J.stdout),Kh0(J.stderr)],cwd:i0(J.cwd,KB),shell:J.shell,env:{...process.env,...Object.fromEntries(J.env)},detached:process.platform!=="win32"});return B.on("error",(H)=>{K(Y0(TV("spawn",H,J)))}),B.on("exit",(...H)=>{$5(G,y(H))}),B.on("spawn",()=>{K(y([B,G]))}),L0(()=>{B.kill("SIGTERM")})})),Q=process.platform==="win32"?(G,K)=>b6((B)=>{Um.exec(`taskkill /pid ${G.pid} /T /F`,(H)=>{if(H)B(Y0(TV("kill",ZR(H),J)));else B(U0)})}):(G,K)=>HJ({try:()=>process.kill(-G.pid,K),catch:(B)=>TV("kill",ZR(B),J)}),Y=(G,K)=>o0(()=>G.kill(K)?U0:Y0(TV("kill",new globalThis.Error("Failed to kill process"),J)));return z(w0(J.cwd,{onNone:()=>U0,onSome:(G)=>X.access(G)}),C0(A9(Z,([G,K])=>h(u1(K),(B)=>{if(!B)return Q(G,"SIGTERM").pipe(O3(()=>Y(G,"SIGTERM")),C0(h8(K)),HU);return h(h8(K),([H])=>{if(H!==0&&H!==null)return Q(G,"SIGTERM").pipe(HU);return U0})}))),u(([G,K])=>{let B=nA0;if(G.stdin!==null)B=$m(()=>G.stdin,(L)=>TV("toWritable",ZR(L),J));let H=h(h8(K),([L,A])=>{if(L!==null)return y(W60(L));return Y0(TV("exitCode",new globalThis.Error(`Process interrupted due to receipt of signal: ${A}`),J))}),W=xi(u1(K)),V=(L="SIGTERM")=>Q(G,L).pipe(O3(()=>Y(G,L)),C0(p7(h8(K)))),U=V60(G.pid),O=AV(()=>G.stderr,(L)=>TV("fromReadable(stderr)",ZR(L),J)),q=AV(()=>G.stdout,(L)=>TV("fromReadable(stdout)",ZR(L),J));if(typeof J.stdout!=="string")q=Ft(q,J.stdout);return Object.assign(Object.create(qy8),{pid:U,exitCode:H,isRunning:W,kill:V,stdin:B,stderr:O,stdout:q})}),typeof J.stdin==="string"?t:J9((G)=>F4(IH(J.stdin,G.stdin))))}case"PipedCommand":{let Z=yh(J);if(Z.length===1)return z(Z[0],QR(X));let Q=Z[0],Y=Z.slice(1),G=Y.slice(0,Y.length-1),K=Y[Y.length-1],B=G.reduce((H,W)=>z(gh(W,H),QR(X),u((V)=>V.stdout),lG),z(QR(X)(Q),u((H)=>H.stdout),lG));return z(gh(K,B),QR(X))}}},Bh0=GQ(H60,z($Q,u((X)=>$60(QR(X)))));var zm=Bh0;var wy8=zm;var RV={};y8(RV,{layer:()=>Og8});var Wh0=(X,J,Z)=>(...Q)=>b6((Y)=>{try{X(...Q,(G,K)=>{if(G)Y(Y0(J?J(G,Q):G));else Y(y(K))})}catch(G){Y(Z?Y0(Z(G,Q)):P7(G))}});var J7=Wh0;import*as Vh0 from"node:crypto";import*as E8 from"node:fs";import*as $h0 from"node:os";import*as WD from"node:path";var u6=(X)=>(J)=>new yZ({module:"FileSystem",method:X,cause:J}),Fy8=(()=>{let X=J7(E8.access,fX("FileSystem","access"),u6("access"));return(J,Z)=>{let Q=E8.constants.F_OK;if(Z?.readable)Q|=E8.constants.R_OK;if(Z?.writable)Q|=E8.constants.W_OK;return X(J,Q)}})(),Ay8=(()=>{let X=J7(E8.cp,fX("FileSystem","copy"),u6("copy"));return(J,Z,Q)=>X(J,Z,{force:Q?.overwrite??!1,preserveTimestamps:Q?.preserveTimestamps??!1,recursive:!0})})(),Ty8=(()=>{let X=J7(E8.copyFile,fX("FileSystem","copyFile"),u6("copyFile"));return(J,Z)=>X(J,Z)})(),My8=(()=>{let X=J7(E8.chmod,fX("FileSystem","chmod"),u6("chmod"));return(J,Z)=>X(J,Z)})(),Py8=(()=>{let X=J7(E8.chown,fX("FileSystem","chown"),u6("chown"));return(J,Z,Q)=>X(J,Z,Q)})(),Ry8=(()=>{let X=J7(E8.link,fX("FileSystem","link"),u6("link"));return(J,Z)=>X(J,Z)})(),jy8=(()=>{let X=J7(E8.mkdir,fX("FileSystem","makeDirectory"),u6("makeDirectory"));return(J,Z)=>X(J,{recursive:Z?.recursive??!1,mode:Z?.mode})})(),g60=(X)=>{let J=J7(E8.mkdtemp,fX("FileSystem",X),u6(X));return(Z)=>o0(()=>{let Q=Z?.prefix??"",Y=typeof Z?.directory==="string"?WD.join(Z.directory,"."):$h0.tmpdir();return J(Q?WD.join(Y,Q):Y+"/")})},Cy8=g60("makeTempDirectory"),h60=(X)=>{let J=J7(E8.rm,fX("FileSystem",X),u6(X));return(Z,Q)=>J(Z,{recursive:Q?.recursive??!1,force:Q?.force??!1})},Iy8=h60("remove"),Ey8=(()=>{let X=g60("makeTempDirectoryScoped"),J=h60("makeTempDirectoryScoped");return(Z)=>A9(X(Z),(Q)=>R9(J(Q,{recursive:!0})))})(),Uh0=(X)=>{let J=J7(E8.open,fX("FileSystem",X),u6(X)),Z=J7(E8.close,fX("FileSystem",X),u6(X));return(Q,Y)=>z(A9(J(Q,Y?.flag??"r",Y?.mode),(G)=>R9(Z(G))),u((G)=>xy8(i00(G),Y?.flag?.startsWith("a")??!1)))},Sy8=Uh0("open"),xy8=(()=>{let X=(V)=>J7(E8.read,fX("FileSystem",V),u6(V)),J=X("read"),Z=X("readAlloc"),Q=J7(E8.fstat,fX("FileSystem","stat"),u6("stat")),Y=J7(E8.ftruncate,fX("FileSystem","truncate"),u6("truncate")),G=J7(E8.fsync,fX("FileSystem","sync"),u6("sync")),K=(V)=>J7(E8.write,fX("FileSystem",V),u6(V)),B=K("write"),H=K("writeAll");class W{fd;append;[zq];semaphore=OU(1);position=0n;constructor(V,U){this.fd=V,this.append=U,this[zq]=zq}get stat(){return u(Q(this.fd),Nh0)}get sync(){return G(this.fd)}seek(V,U){let O=sU(V);return this.semaphore.withPermits(1)(L0(()=>{if(U==="start")this.position=O;else if(U==="current")this.position=this.position+O;return this.position}))}read(V){return this.semaphore.withPermits(1)(u(o0(()=>J(this.fd,{buffer:V,position:this.position})),(U)=>{let O=sU(U);return this.position=this.position+O,O}))}readAlloc(V){let U=Number(V);return this.semaphore.withPermits(1)(h(L0(()=>Buffer.allocUnsafeSlow(U)),(O)=>u(Z(this.fd,{buffer:O,position:this.position}),(q)=>{if(q===0)return S();if(this.position=this.position+BigInt(q),q===U)return I(O);let L=Buffer.allocUnsafeSlow(q);return O.copy(L,0,0,q),I(L)})))}truncate(V){return this.semaphore.withPermits(1)(u(Y(this.fd,V?Number(V):void 0),()=>{if(!this.append){let U=BigInt(V??0);if(this.position>U)this.position=U}}))}write(V){return this.semaphore.withPermits(1)(u(o0(()=>B(this.fd,V,void 0,void 0,this.append?void 0:Number(this.position))),(U)=>{let O=sU(U);if(!this.append)this.position=this.position+O;return O}))}writeAllChunk(V){return h(o0(()=>H(this.fd,V,void 0,void 0,this.append?void 0:Number(this.position))),(U)=>{if(U===0)return Y0(new VQ({module:"FileSystem",method:"writeAll",reason:"WriteZero",pathOrDescriptor:this.fd,description:"write returned 0 bytes written"}));if(!this.append)this.position=this.position+BigInt(U);return U<V.length?this.writeAllChunk(V.subarray(U)):U0})}writeAll(V){return this.semaphore.withPermits(1)(this.writeAllChunk(V))}}return(V,U)=>new W(V,U)})(),zh0=(X)=>{let J=g60(X),Z=Uh0(X),Q=(Y)=>L0(()=>Vh0.randomBytes(Y).toString("hex"));return(Y)=>z(j7(J(Y),Q(6)),u(([G,K])=>WD.join(G,K+(Y?.suffix??""))),J9((G)=>l7(Z(G,{flag:"w+"}))))},vy8=zh0("makeTempFile"),ky8=(()=>{let X=zh0("makeTempFileScoped"),J=h60("makeTempFileScoped");return(Z)=>A9(X(Z),(Q)=>R9(J(WD.dirname(Q),{recursive:!0})))})(),by8=(X,J)=>TJ({try:()=>E8.promises.readdir(X,J),catch:(Z)=>fX("FileSystem","readDirectory")(Z,[X])}),yy8=(X)=>b6((J,Z)=>{try{E8.readFile(X,{signal:Z},(Q,Y)=>{if(Q)J(Y0(fX("FileSystem","readFile")(Q,[X])));else J(y(Y))})}catch(Q){J(Y0(u6("readFile")(Q)))}}),gy8=(()=>{let X=J7(E8.readlink,fX("FileSystem","readLink"),u6("readLink"));return(J)=>X(J)})(),hy8=(()=>{let X=J7(E8.realpath,fX("FileSystem","realPath"),u6("realPath"));return(J)=>X(J)})(),my8=(()=>{let X=J7(E8.rename,fX("FileSystem","rename"),u6("rename"));return(J,Z)=>X(J,Z)})(),Nh0=(X)=>({type:X.isFile()?"File":X.isDirectory()?"Directory":X.isSymbolicLink()?"SymbolicLink":X.isBlockDevice()?"BlockDevice":X.isCharacterDevice()?"CharacterDevice":X.isFIFO()?"FIFO":X.isSocket()?"Socket":"Unknown",mtime:x8(X.mtime),atime:x8(X.atime),birthtime:x8(X.birthtime),dev:X.dev,rdev:x8(X.rdev),ino:x8(X.ino),mode:X.mode,nlink:x8(X.nlink),uid:x8(X.uid),gid:x8(X.gid),size:sU(X.size),blksize:r8(x8(X.blksize),sU),blocks:x8(X.blocks)}),m60=(()=>{let X=J7(E8.stat,fX("FileSystem","stat"),u6("stat"));return(J)=>u(X(J),Nh0)})(),dy8=(()=>{let X=J7(E8.symlink,fX("FileSystem","symlink"),u6("symlink"));return(J,Z)=>X(J,Z)})(),uy8=(()=>{let X=J7(E8.truncate,fX("FileSystem","truncate"),u6("truncate"));return(J,Z)=>X(J,Z!==void 0?Number(Z):void 0)})(),cy8=(()=>{let X=J7(E8.utimes,fX("FileSystem","utime"),u6("utime"));return(J,Z,Q)=>X(J,Z,Q)})(),fy8=(X,J)=>Wt((Z)=>A9(L0(()=>{let Q=E8.watch(X,{recursive:J?.recursive},(Y,G)=>{if(!G)return;switch(Y){case"rename":{Z.fromEffect(q9(m60(G),{onSuccess:(K)=>y(o00({path:G})),onFailure:(K)=>K._tag==="SystemError"&&K.reason==="NotFound"?y(a00({path:G})):Y0(K)}));return}case"change":{Z.single(r00({path:G}));return}}});return Q.on("error",(Y)=>{Z.fail(new VQ({module:"FileSystem",reason:"Unknown",method:"watch",pathOrDescriptor:X,cause:Y}))}),Q.on("close",()=>{Z.end()}),Q}),(Q)=>L0(()=>Q.close()))),py8=(X,J,Z)=>m60(J).pipe(u((Q)=>X.pipe(pX((Y)=>Y.register(J,Q,Z)),i0(()=>fy8(J,Z)))),rT),ly8=(X,J,Z)=>b6((Q,Y)=>{try{E8.writeFile(X,J,{signal:Y,flag:Z?.flag,mode:Z?.mode},(G)=>{if(G)Q(Y0(fX("FileSystem","writeFile")(G,[X])));else Q(U0)})}catch(G){Q(Y0(u6("writeFile")(G)))}}),ny8=u(JA(sb),(X)=>n00({access:Fy8,chmod:My8,chown:Py8,copy:Ay8,copyFile:Ty8,link:Ry8,makeDirectory:jy8,makeTempDirectory:Cy8,makeTempDirectoryScoped:Ey8,makeTempFile:vy8,makeTempFileScoped:ky8,open:Sy8,readDirectory:by8,readFile:yy8,readLink:gy8,realPath:hy8,remove:Iy8,rename:my8,stat:m60,symlink:dy8,truncate:uy8,utimes:cy8,watch(J,Z){return py8(X,J,Z)},writeFile:ly8})),Oh0=GQ($Q,ny8);var Om=Oh0;import*as YR from"node:path";import*as _m from"node:url";var d60=(X)=>HJ({try:()=>_m.fileURLToPath(X),catch:(J)=>new yZ({module:"Path",method:"fromFileUrl",description:`Invalid file URL: ${X}`,cause:J})}),u60=(X)=>HJ({try:()=>_m.pathToFileURL(X),catch:(J)=>new yZ({module:"Path",method:"toFileUrl",description:`Invalid path: ${X}`,cause:J})}),qh0=E7(vY,vY.of({[BV]:BV,...YR.posix,fromFileUrl:d60,toFileUrl:u60})),Dh0=E7(vY,vY.of({[BV]:BV,...YR.win32,fromFileUrl:d60,toFileUrl:u60})),wh0=E7(vY,vY.of({[BV]:BV,...YR,fromFileUrl:d60,toFileUrl:u60}));var qm=wh0,Lh0=qh0,Fh0=Dh0;var Lm=Symbol.for("effect/Mailbox"),c60=Symbol.for("effect/Mailbox/ReadonlyMailbox");var jz=a0(),Th0=M9(jz),Dm=M9(!1),wm=M9(!0),Mh0=[jz,!0];class Ph0 extends fJ{scheduler;capacity;strategy;[Lm]=Lm;[c60]=c60;state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set};messages=[];messagesChunk=a0();constructor(X,J,Z){super();this.scheduler=X,this.capacity=J,this.strategy=Z}offer(X){return I0(()=>{if(this.state._tag!=="Open")return Dm;else if(this.messages.length+this.messagesChunk.length>=this.capacity)switch(this.strategy){case"dropping":return Dm;case"suspend":if(this.capacity<=0&&this.state.takers.size>0)return this.messages.push(X),this.releaseTaker(),wm;return this.offerRemainingSingle(X);case"sliding":return this.unsafeTake(),this.messages.push(X),wm}return this.messages.push(X),this.scheduleReleaseTaker(),wm})}unsafeOffer(X){if(this.state._tag!=="Open")return!1;else if(this.messages.length+this.messagesChunk.length>=this.capacity){if(this.strategy==="sliding")return this.unsafeTake(),this.messages.push(X),!0;else if(this.capacity<=0&&this.state.takers.size>0)return this.messages.push(X),this.releaseTaker(),!0;return!1}return this.messages.push(X),this.scheduleReleaseTaker(),!0}offerAll(X){return I0(()=>{if(this.state._tag!=="Open")return o(f9(X));let J=this.unsafeOfferAllArray(X);if(J.length===0)return Th0;else if(this.strategy==="dropping")return o(Q8(J));return this.offerRemainingArray(J)})}unsafeOfferAll(X){return Q8(this.unsafeOfferAllArray(X))}unsafeOfferAllArray(X){if(this.state._tag!=="Open")return v0(X);else if(this.capacity===Number.POSITIVE_INFINITY||this.strategy==="sliding"){if(this.messages.length>0)this.messagesChunk=f8(this.messagesChunk,Q8(this.messages));if(this.strategy==="sliding")this.messagesChunk=this.messagesChunk.pipe(f8(f9(X)),Rw(this.capacity));else if(vK(X))this.messagesChunk=f8(this.messagesChunk,X);else this.messages=v0(X);return this.scheduleReleaseTaker(),[]}let J=this.capacity<=0?this.state.takers.size:this.capacity-this.messages.length-this.messagesChunk.length;if(J===0)return v0(X);let Z=[],Q=0;for(let Y of X){if(Q<J)this.messages.push(Y);else Z.push(Y);Q++}return this.scheduleReleaseTaker(),Z}fail(X){return this.done(wG(X))}failCause(X){return this.done(L9(X))}unsafeDone(X){if(this.state._tag!=="Open")return!1;else if(this.state.offers.size===0&&this.messages.length===0&&this.messagesChunk.length===0)return this.finalize(X),!0;return this.state={...this.state,_tag:"Closing",exit:X},!0}shutdown=B0(()=>{if(this.state._tag==="Done")return!0;this.messages=[],this.messagesChunk=jz;let X=this.state.offers;if(this.finalize(this.state._tag==="Open"?oX:this.state.exit),X.size>0){for(let J of X)if(J._tag==="Single")J.resume(Dm);else J.resume(M9(Q8(J.remaining.slice(J.offset))));X.clear()}return!0});done(X){return B0(()=>this.unsafeDone(X))}end=this.done(oX);clear=I0(()=>{if(this.state._tag==="Done")return C$(this.state.exit,jz);let X=this.unsafeTakeAll();return this.releaseCapacity(),o(X)});takeAll=I0(()=>{if(this.state._tag==="Done")return C$(this.state.exit,Mh0);let X=this.unsafeTakeAll();if(X.length===0)return i8(this.awaitTake,this.takeAll);return o([X,this.releaseCapacity()])});takeN(X){return I0(()=>{if(this.state._tag==="Done")return C$(this.state.exit,Mh0);else if(X<=0)return o([jz,!1]);X=Math.min(X,this.capacity);let J;if(X<=this.messagesChunk.length)J=_J(this.messagesChunk,X),this.messagesChunk=o9(this.messagesChunk,X);else if(X<=this.messages.length+this.messagesChunk.length)this.messagesChunk=f8(this.messagesChunk,Q8(this.messages)),this.messages=[],J=_J(this.messagesChunk,X),this.messagesChunk=o9(this.messagesChunk,X);else return i8(this.awaitTake,this.takeN(X));return o([J,this.releaseCapacity()])})}unsafeTake(){if(this.state._tag==="Done")return wI(this.state.exit,wG(new OF));let X;if(this.messagesChunk.length>0)X=kK(this.messagesChunk),this.messagesChunk=o9(this.messagesChunk,1);else if(this.messages.length>0)X=this.messages[0],this.messagesChunk=o9(Q8(this.messages),1),this.messages=[];else if(this.capacity<=0&&this.state.offers.size>0)return this.capacity=1,this.releaseCapacity(),this.capacity=0,this.messages.length>0?M9(this.messages.pop()):void 0;else return;return this.releaseCapacity(),M9(X)}take=I0(()=>this.unsafeTake()??i8(this.awaitTake,this.take));await=fK((X)=>{if(this.state._tag==="Done")return X(this.state.exit);return this.state.awaiters.add(X),B0(()=>{if(this.state._tag!=="Done")this.state.awaiters.delete(X)})});unsafeSize(){let X=this.messages.length+this.messagesChunk.length;return this.state._tag==="Done"?S():I(X)}size=B0(()=>this.unsafeSize());commit(){return this.takeAll}pipe(){return K0(this,arguments)}toJSON(){return{_id:"effect/Mailbox",state:this.state._tag,size:this.unsafeSize().toJSON()}}toString(){return u8(this)}[$8](){return u8(this)}offerRemainingSingle(X){return fK((J)=>{if(this.state._tag!=="Open")return J(Dm);let Z={_tag:"Single",message:X,resume:J};return this.state.offers.add(Z),B0(()=>{if(this.state._tag==="Open")this.state.offers.delete(Z)})})}offerRemainingArray(X){return fK((J)=>{if(this.state._tag!=="Open")return J(M9(Q8(X)));let Z={_tag:"Array",remaining:X,offset:0,resume:J};return this.state.offers.add(Z),B0(()=>{if(this.state._tag==="Open")this.state.offers.delete(Z)})})}releaseCapacity(){if(this.state._tag==="Done")return this.state.exit._tag==="Success";else if(this.state.offers.size===0){if(this.state._tag==="Closing"&&this.messages.length===0&&this.messagesChunk.length===0)return this.finalize(this.state.exit),this.state.exit._tag==="Success";return!1}let X=this.capacity-this.messages.length-this.messagesChunk.length;for(let J of this.state.offers)if(X===0)return!1;else if(J._tag==="Single")this.messages.push(J.message),X--,J.resume(wm),this.state.offers.delete(J);else{for(;J.offset<J.remaining.length;J.offset++){if(X===0)return!1;this.messages.push(J.remaining[J.offset]),X--}J.resume(Th0),this.state.offers.delete(J)}return!1}awaitTake=fK((X)=>{if(this.state._tag==="Done")return X(this.state.exit);return this.state.takers.add(X),B0(()=>{if(this.state._tag!=="Done")this.state.takers.delete(X)})});scheduleRunning=!1;scheduleReleaseTaker(){if(this.scheduleRunning)return;this.scheduleRunning=!0,this.scheduler.scheduleTask(this.releaseTaker,0)}releaseTaker=()=>{if(this.scheduleRunning=!1,this.state._tag==="Done")return;else if(this.state.takers.size===0)return;for(let X of this.state.takers)if(this.state.takers.delete(X),X(oX),this.messages.length+this.messagesChunk.length===0)break};unsafeTakeAll(){if(this.messagesChunk.length>0){let X=this.messages.length>0?f8(this.messagesChunk,Q8(this.messages)):this.messagesChunk;return this.messagesChunk=jz,this.messages=[],X}else if(this.messages.length>0){let X=Q8(this.messages);return this.messages=[],X}else if(this.state._tag!=="Done"&&this.state.offers.size>0)return this.capacity=1,this.releaseCapacity(),this.capacity=0,m0(this.messages.pop());return jz}finalize(X){if(this.state._tag==="Done")return;let J=this.state;this.state={_tag:"Done",exit:X};for(let Z of J.takers)Z(X);J.takers.clear();for(let Z of J.awaiters)Z(X);J.awaiters.clear()}}var Rh0=(X)=>M8((J)=>o(new Ph0(J.currentScheduler,typeof X==="number"?X:X?.capacity??Number.POSITIVE_INFINITY,typeof X==="number"?"suspend":X?.strategy??"suspend")));var f60=(X)=>{let J=z0(X.takeAll,([Z,Q])=>Q?Z.length===0?Y8:q0(Z):B9(q0(Z),J));return J},jh0=(X)=>CW(f60(X));var ay8=Lm;var Ch0=(X)=>V0(X,ay8);var k5=Rh0;var Ih0=f60,GR=jh0;import*as Fm from"node:readline";var Eh0=(X)=>X.key.ctrl&&(X.key.name==="c"||X.key.name==="d"),Sh0=hX(function*(X=Eh0){let{stdin:J,stdout:Z}=process,Q=yield*tv({acquire:A9(L0(()=>{let V=Fm.createInterface({input:J,escapeCodeTimeout:50});if(Fm.emitKeypressEvents(J,V),J.isTTY)J.setRawMode(!0);return V}),(V)=>L0(()=>{if(J.isTTY)J.setRawMode(!1);V.close()}))}),Y=L0(()=>Z.columns??0),G=L0(()=>Z.rows??0),K=L0(()=>Boolean(Z.isTTY)),B=f0(function*(){yield*eA(Q);let V=yield*k5(),U=(O,q)=>{let L={input:x8(O),key:{name:q.name??"",ctrl:!!q.ctrl,meta:!!q.meta,shift:!!q.shift}};if(V.unsafeOffer(L),X(L))V.unsafeDone(eZ)};return yield*aF(()=>L0(()=>J.off("keypress",U))),J.on("keypress",U),V}),H=eA(Q).pipe(h((V)=>b6((U)=>{let O=(q)=>U(y(q));return V.once("line",O),L0(()=>V.off("line",O))})),l7),W=(V)=>xG(b6((U)=>{Z.write(V,(O)=>O?U(Y0(new yZ({module:"Terminal",method:"display",description:"Failed to write prompt to stdout",cause:O}))):U(U0))}));return m9.of({columns:Y,rows:G,isTTY:K,readInput:B,readLine:H,display:W})}),xh0=P4(m9,Sh0(Eh0));var vh0=xh0;var MV={};y8(MV,{unsafeAdd:()=>V2,size:()=>Bg8,runtimePromise:()=>gh0,runtime:()=>BR,run:()=>Kg8,makeRuntimePromise:()=>Zg8,makeRuntime:()=>Jg8,make:()=>Cz,join:()=>n60,isFiberSet:()=>p60,clear:()=>Gg8,awaitEmpty:()=>Hg8,add:()=>Yg8,TypeId:()=>Am});var Am=Symbol.for("effect/FiberSet"),p60=(X)=>V0(X,Am),ey8={[Am]:Am,[Symbol.iterator](){if(this.state._tag==="Closed")return DY0();return this.state.backing[Symbol.iterator]()},toString(){return u8(this.toJSON())},toJSON(){return{_id:"FiberMap",state:this.state}},[$8](){return this.toJSON()},pipe(){return K0(this,arguments)}},Xg8=(X,J)=>{let Z=Object.create(ey8);return Z.state={_tag:"Open",backing:X},Z.deferred=J,Z},Cz=()=>A9(u(F9(),(X)=>Xg8(new Set,X)),(X)=>AJ((J)=>{let Z=X.state;if(Z._tag==="Closed")return U0;X.state={_tag:"Closed"};let Q=Z.backing;return hV0(Q,K$(J.id(),l60)).pipe($U(X.deferred))})),Jg8=()=>h(Cz(),(X)=>BR(X)()),Zg8=()=>h(Cz(),(X)=>gh0(X)()),bh0=-1,l60=B$(bh0,0),Qg8=Bn(void 0,{emptyCase:C6,failCase:C6,dieCase:C6,interruptCase:(X,J)=>bN(hw(J),bh0),sequentialCase:(X,J,Z)=>J||Z,parallelCase:(X,J,Z)=>J||Z}),V2=$((X)=>p60(X[0]),(X,J,Z)=>{if(X.state._tag==="Closed"){J.unsafeInterruptAsFork(K$(Z?.interruptAs??d7,l60));return}else if(X.state.backing.has(J))return;X.state.backing.add(J),J.addObserver((Q)=>{if(X.state._tag==="Closed")return;if(X.state.backing.delete(J),AZ(Q)&&(Z?.propagateInterruption===!0?!Qg8(Q.cause):!W3(Q.cause)))$5(X.deferred,Q)})}),Yg8=$((X)=>p60(X[0]),(X,J,Z)=>oO((Q)=>L0(()=>V2(X,J,{...Z,interruptAs:Q})))),Gg8=(X)=>AJ((J)=>{if(X.state._tag==="Closed")return U0;return a9(X.state.backing,(Z)=>vO(Z,K$(J.id(),l60)))}),yh0=function(){let X=void 0;return()=>{if(X===void 0)X=NY(aJ);return X}}(),Kg8=function(){let X=arguments[0];if(!VX(arguments[1])){let J=arguments[1];return(Z)=>kh0(X,Z,J)}return kh0(X,arguments[1],arguments[2])},kh0=(X,J,Z)=>oO((Q)=>{if(X.state._tag==="Closed")return L0(yh0);return J9(F4(J),(Y)=>V2(X,Y,{...Z,interruptAs:Q}))}),BR=(X)=>()=>u(xQ(),(J)=>{let Z=KQ(J);return(Q,Y)=>{if(X.state._tag==="Closed")return yh0();let G=Z(Q,Y);return V2(X,G),G}}),gh0=(X)=>()=>u(BR(X)(),(J)=>(Z,Q)=>new Promise((Y,G)=>J(Z,Q).addObserver((K)=>{if(CQ(K))Y(K.value);else G(BJ(K.cause))}))),Bg8=(X)=>L0(()=>X.state._tag==="Closed"?0:X.state.backing.size),n60=(X)=>h8(X.deferred),Hg8=(X)=>ZH({while:()=>X.state._tag==="Open"&&X.state.backing.size>0,body:()=>v1(_Y0(X)),step:O6});class PV extends m7("@effect/platform/Transferable/Collector")(){}var VD=()=>{let X=[],J=(Y)=>{X.push(...Y)},Z=()=>X,Q=()=>{let Y=X;return X=[],Y};return PV.of({unsafeAddAll:J,addAll:(Y)=>L0(()=>J(Y)),unsafeRead:Z,read:L0(Z),unsafeClear:Q,clear:L0(Q)})};var hh0=Symbol.for("@effect/platform/WorkerError");var mh0=hh0;class $2 extends WQ()("WorkerError",{reason:s0("spawn","decode","send","unknown","encode"),cause:e6}){[mh0]=mh0;static Cause=u00({error:this,defect:e6});static encodeCause=JW(this.Cause);static decodeCause=__(this.Cause);get message(){switch(this.reason){case"send":return"An error occurred calling .postMessage";case"spawn":return"An error occurred while spawning a worker";case"decode":return"An error occurred during decoding";case"encode":return"An error occurred during encoding";case"unknown":return"An unexpected error occurred"}}}var o60=Symbol.for("@effect/platform/Worker/PlatformWorker"),Tm=g8("@effect/platform/Worker/PlatformWorker"),r60=Symbol.for("@effect/platform/Worker/WorkerManager"),a60=g8("@effect/platform/Worker/WorkerManager"),dh0=g8("@effect/platform/Worker/Spawner"),uh0=f0(function*(){let X=yield*Tm,J=0;return a60.of({[r60]:r60,spawn({encode:Z,initialMessage:Q}){return f0(function*(){let Y=J++,G=0,K=new Map,B=VD(),H=Z?(M)=>C0(B.clear,PJ(Z(M),PV,B)):y,W=yield*F9(),V=yield*X.spawn(Y);yield*V.run((M)=>{if(M[0]===0)return Jx(W,U0);return U(M[1])}).pipe(WU((M)=>a9(K.values(),(x)=>(d1 in x)?V5(x,M):x.failCause(M))),N5(pi),z3(qW(1000)),zU({package:"@effect/platform",module:"Worker"}),QX,MJ),yield*aF(()=>C0(a9(K.values(),(M)=>(d1 in M)?lF(M):M.end,{discard:!0}),L0(()=>K.clear())));let U=(M)=>o0(()=>{let x=K.get(M[0]);if(!x)return U0;switch(M[1]){case 0:return d1 in x?H6(x,M[2][0]):x.offerAll(M[2]);case 1:{if(M.length===2)return d1 in x?lF(x):x.end;return d1 in x?H6(x,M[2][0]):C0(x.offerAll(M[2]),x.end)}case 2:case 3:{if(M[1]===2)return d1 in x?Zx(x,M[2]):x.fail(M[2]);let j=$2.decodeCause(M[2]);return d1 in x?V5(x,j):x.failCause(j)}}}),O=(M,x)=>AJ((j)=>{let T=j.getFiberRef(yQ),E=_7(T,zO).pipe(gJ((P)=>P._tag==="Span")),k=G++;return x.pipe(J9((P)=>{return K.set(k,P),H(M).pipe(J9((C)=>V.send([k,0,C,E._tag==="Some"?[E.value.traceId,E.value.spanId,E.value.sampled]:void 0],B.unsafeRead())),s9((C)=>Ch0(P)?P.failCause(C):V5(P,C)))}),u((P)=>({id:k,mailbox:P})))}),q=({id:M},x)=>{let j=L0(()=>K.delete(M));return AZ(x)?C0(R9(V.send([M,1])),j):j},L=(M)=>fU(fA0(O(M,k5()),({mailbox:x})=>Ih0(x),q)),A=(M)=>p1(O(M,F9()),({mailbox:x})=>h8(x),q);if(yield*h8(W),Q)yield*L0(Q).pipe(h(A),E9((M)=>new $2({reason:"spawn",cause:M})));return{id:Y,execute:L,executeEffect:A}})}})}),ch0=GQ(a60,uh0);var fh0=()=>(X)=>Tm.of({[o60]:o60,spawn(J){return f0(function*(){let Z=yield*dh0,Q,Y=[];return{run:(B)=>U5((H)=>f0(function*(){let W=yield*N3,V=yield*X.setup({worker:Z(J),scope:W});Q=V,yield*FJ(W,L0(()=>{Q=void 0}));let U=(yield*xQ()).pipe(LD0(rj(O4))),O=yield*Cz(),q=KQ(U);if(yield*X.listen({port:V,scope:W,emit(L){V2(O,q(B(L)))},deferred:O.deferred}),Y.length>0){for(let[L,A]of Y)V.postMessage([0,L],A);Y.length=0}return yield*H(n60(O))}).pipe(l7)),send:(B,H)=>HJ({try:()=>{if(Q===void 0)Y.push([B,H]);else Q.postMessage([0,B],H)},catch:(W)=>new $2({reason:"send",cause:W})})}})}});var ph0=fh0,lh0=Tm;var nh0=ch0;var Ug8=ph0()({setup({scope:X,worker:J}){return h(F9(),(Z)=>{let Q="postMessage"in J?{postMessage(Y,G){J.postMessage(Y,G)},kill:()=>J.terminate(),worker:J}:{postMessage(Y,G){J.send(Y)},kill:()=>J.kill("SIGKILL"),worker:J};return J.on("exit",()=>{$5(Z,eZ)}),y9(FJ(X,o0(()=>{return Q.postMessage([1]),h8(Z)}).pipe(QX,XA(5000),s9(()=>L0(()=>Q.kill())))),Q)})},listen({deferred:X,emit:J,port:Z}){return Z.worker.on("message",(Q)=>{J(Q)}),Z.worker.on("messageerror",(Q)=>{$5(X,new $2({reason:"decode",cause:Q}))}),Z.worker.on("error",(Q)=>{$5(X,new $2({reason:"unknown",cause:Q}))}),Z.worker.on("exit",(Q)=>{$5(X,new $2({reason:"unknown",cause:Error(`exited with code ${Q}`)}))}),U0}}),ih0=E7(lh0,Ug8),oh0=D6(nh0,ih0);var rh0=oh0;var Og8=z(xA(qm,zm,vh0,rh0),w3(Om));var KZ={};y8(KZ,{layer:()=>_g8});var _g8=Om;var U2={};y8(U2,{makeUndici:()=>rg8,makeDispatcher:()=>ng8,makeAgentLayer:()=>ug8,makeAgent:()=>mg8,make:()=>cg8,layerWithoutAgent:()=>pg8,layerUndiciWithoutDispatcher:()=>sg8,layerUndici:()=>ag8,layer:()=>fg8,dispatcherLayerGlobal:()=>og8,dispatcherLayer:()=>ig8,agentLayer:()=>dg8,UndiciRequestOptions:()=>Qm0,HttpAgentTypeId:()=>gg8,HttpAgent:()=>hg8,Dispatcher:()=>lg8});import*as Pm from"node:http";import*as Rm from"node:https";import{Readable as sh0}from"node:stream";import{pipeline as Ig8}from"node:stream/promises";var HR={};y8(HR,{stdout:()=>Dg8,stdin:()=>Lg8,stderr:()=>wg8,fromWritableChannel:()=>qg8,fromWritable:()=>$D});var $D=$m,qg8=y60,Dg8=$D(()=>process.stdout,(X)=>new VQ({module:"Stream",method:"stdout",reason:"Unknown",cause:X})),wg8=$D(()=>process.stderr,(X)=>new VQ({module:"Stream",method:"stderr",reason:"Unknown",cause:X})),Lg8=$D(()=>process.stdin,(X)=>new VQ({module:"Stream",method:"stdin",reason:"Unknown",cause:X}));var r3={};y8(r3,{toUint8Array:()=>e60,toString:()=>t60,toReadableNever:()=>Pg8,toReadable:()=>s60,stdout:()=>jg8,stdin:()=>Rg8,stderr:()=>Cg8,pipeThroughSimple:()=>Mg8,pipeThroughDuplex:()=>Tg8,fromReadableChannel:()=>Fg8,fromReadable:()=>WR,fromDuplex:()=>Ag8});var WR=AV,Fg8=v60,Ag8=Vm,Tg8=Jh0,Mg8=Zh0,s60=Yh0,Pg8=Gh0,t60=eg0,e60=Xh0,Rg8=AV(()=>process.stdin,(X)=>X,{closeOnDone:!1}).pipe(iT),jg8=AV(()=>process.stdout,(X)=>X,{closeOnDone:!1}).pipe(iT),Cg8=AV(()=>process.stderr,(X)=>X,{closeOnDone:!1}).pipe(iT);class X70 extends LK{source;onError;remoteAddressOverride;[pQ];constructor(X,J,Z){super();this.source=X,this.onError=J,this.remoteAddressOverride=Z,this[pQ]=pQ}get headers(){return GZ(this.source.headers)}get remoteAddress(){return x8(this.remoteAddressOverride??this.source.socket.remoteAddress)}textEffect;get text(){if(this.textEffect)return this.textEffect;return this.textEffect=j9(EG(h(ph,(X)=>t60(()=>this.source,{onFailure:this.onError,maxBytes:u9(X)})))),this.textEffect}get unsafeText(){return j9(this.text)}get json(){return JH(this.text,{try:(X)=>X===""?null:JSON.parse(X),catch:this.onError})}get unsafeJson(){return j9(this.json)}get urlParamsBody(){return h(this.text,(X)=>HJ({try:()=>KK(new URLSearchParams(X)),catch:this.onError}))}get stream(){return WR(()=>this.source,this.onError)}get arrayBuffer(){return h(ph,(X)=>e60(()=>this.source,{onFailure:this.onError,maxBytes:u9(X)}))}}var Mm=Symbol.for("@effect/platform-node/Http/NodeClient/HttpAgent"),jm=g8("@effect/platform-node/Http/NodeClient/HttpAgent"),J70=(X)=>u(SQ([A9(L0(()=>new Pm.Agent(X)),(J)=>L0(()=>J.destroy())),A9(L0(()=>new Rm.Agent(X)),(J)=>L0(()=>J.destroy()))]),([J,Z])=>({[Mm]:Mm,http:J,https:Z})),Z70=(X)=>P4(jm,J70(X)),Q70=Z70(),Eg8=(X)=>eP((J,Z,Q)=>{let Y=Z.protocol==="https:"?Rm.request(Z,{agent:X.https,method:J.method,headers:J.headers,signal:Q}):Pm.request(Z,{agent:X.http,method:J.method,headers:J.headers,signal:Q});return z(C0(Sg8(Y,J,J.body),xg8(Y,J),{concurrent:!0}),u((G)=>new th0(J,G)))}),Sg8=(X,J,Z)=>o0(()=>{switch(Z._tag){case"Empty":return X.end(),ah0(X,J);case"Uint8Array":case"Raw":return X.end(Z.body),ah0(X,J);case"FormData":{let Q=new Response(Z.formData);return Q.headers.forEach((Y,G)=>{X.setHeader(G,Y)}),TJ({try:()=>Ig8(sh0.fromWeb(Q.body),X),catch:(Y)=>new r4({request:J,reason:"Transport",cause:Y})})}case"Stream":return IH(_t(Z.stream,(Q)=>new r4({request:J,reason:"Encode",cause:Q})),$D(()=>X,(Q)=>new r4({request:J,reason:"Transport",cause:Q})))}}),xg8=(X,J)=>b6((Z)=>{function Q(G){Z(Y0(new r4({request:J,reason:"Transport",cause:G})))}X.on("error",Q);function Y(G){X.off("error",Q),Z(y(G))}return X.on("upgrade",Y),X.on("response",Y),L0(()=>{X.off("error",Q),X.off("upgrade",Y),X.off("response",Y)})}),ah0=(X,J)=>b6((Z)=>{function Q(G){Z(Y0(new r4({request:J,reason:"Transport",cause:G})))}X.once("error",Q);function Y(){X.off("error",Q),Z(U0)}return X.once("finish",Y),L0(()=>{X.off("error",Q),X.off("finish",Y)})});class th0 extends X70{request;[W2];constructor(X,J){super(J,(Z)=>new N7({request:X,response:this,reason:"Decode",cause:Z}));this.request=X,this[W2]=W2}get status(){return this.source.statusCode}cachedCookies;get cookies(){if(this.cachedCookies!==void 0)return this.cachedCookies;let X=this.source.headers["set-cookie"];if(Array.isArray(X))return this.cachedCookies=QD(X);return this.cachedCookies=G2}get formData(){return TJ({try:()=>{let X={headers:new globalThis.Headers(this.source.headers)};if(this.source.statusCode)X.status=this.source.statusCode;if(this.source.statusMessage)X.statusText=this.source.statusMessage;return new Response(sh0.toWeb(this.source),X).formData()},catch:this.onError})}toJSON(){return GD(this,{_id:"@effect/platform/HttpClientResponse",request:this.request.toJSON(),status:this.status})}}var Y70=u(jm,Eg8),G70=XR(Y70),eh0=D6(G70,Q70);var VR=g8("@effect/platform-node/NodeHttpClient/Dispatcher"),K70=A9(L0(()=>new Cm.Agent),(X)=>KU(()=>X.destroy())),B70=P4(VR,K70),Xm0=jU(VR,()=>Cm.getGlobalDispatcher()),H70="@effect/platform-node/NodeHttpClient/undiciOptions",W70=(X)=>eP((J,Z,Q,Y)=>{let K=Y.getFiberRef(yQ).unsafeMap.get(H70)??{};return kg8(J.body).pipe(h((B)=>TJ({try:()=>X.request({...K,signal:Q,method:J.method,headers:J.headers,origin:Z.origin,path:Z.pathname+Z.search+Z.hash,body:B,headersTimeout:3600000,bodyTimeout:0}),catch:(H)=>new r4({request:J,reason:"Transport",cause:H})})),u((B)=>new Jm0(J,B)))});function kg8(X){switch(X._tag){case"Empty":return y(null);case"Uint8Array":case"Raw":return y(X.body);case"FormData":return y(X.formData);case"Stream":return s60(X.stream)}}function bg8(X){}class Jm0 extends LK{request;source;[pQ];[W2];constructor(X,J){super();this.request=X,this.source=J,this[pQ]=pQ,this[W2]=W2,J.body.on("error",bg8)}get status(){return this.source.statusCode}get statusText(){return}cachedCookies;get cookies(){if(this.cachedCookies!==void 0)return this.cachedCookies;let X=this.source.headers["set-cookie"];if(X!==void 0)return this.cachedCookies=QD(Array.isArray(X)?X:[X]);return this.cachedCookies=G2}get headers(){return GZ(this.source.headers)}get remoteAddress(){return S()}get stream(){return WR(()=>this.source.body,(X)=>new N7({request:this.request,response:this,reason:"Decode",cause:X}))}get json(){return JH(this.text,{try:(X)=>X===""?null:JSON.parse(X),catch:(X)=>new N7({request:this.request,response:this,reason:"Decode",cause:X})})}textBody;get text(){return this.textBody??=TJ({try:()=>this.source.body.text(),catch:(X)=>new N7({request:this.request,response:this,reason:"Decode",cause:X})}).pipe(EG,j9)}get urlParamsBody(){return h(this.text,(X)=>HJ({try:()=>KK(new URLSearchParams(X)),catch:(J)=>new N7({request:this.request,response:this,reason:"Decode",cause:J})}))}formDataBody;get formData(){return this.formDataBody??=TJ({try:()=>this.source.body.formData(),catch:(X)=>new N7({request:this.request,response:this,reason:"Decode",cause:X})}).pipe(EG,j9)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody??=TJ({try:()=>this.source.body.arrayBuffer(),catch:(X)=>new N7({request:this.request,response:this,reason:"Decode",cause:X})}).pipe(EG,j9)}toJSON(){return GD(this,{_id:"@effect/platform/HttpClientResponse",request:this.request.toJSON(),status:this.status})}}var V70=XR(u(VR,W70)),Zm0=D6(V70,B70);var gg8=Mm,hg8=jm,mg8=J70,dg8=Q70,ug8=Z70,cg8=Y70,fg8=eh0,pg8=G70,lg8=VR,ng8=K70,ig8=B70,og8=Xm0;class Qm0 extends m7(H70)(){}var rg8=W70,ag8=Zm0,sg8=V70;var _Q={};y8(_Q,{layerWin32:()=>Xh8,layerPosix:()=>eg8,layer:()=>tg8});var tg8=qm,eg8=Lh0,Xh8=Fh0;var Im={};y8(Im,{runMain:()=>Yh8});var Jh8=(X,J)=>{J(AZ(X)&&!W3(X.cause)?1:0)},Ym0=(X,J)=>{let Z=FG(X,no);if(!bN(Z,ZD))return X;return Ep(X,{fiberId:J,fiberRef:no,value:Z.pipe(PB(ZD),iY(uP))})},Gm0=(X)=>$((J)=>VX(J[0]),(J,Z)=>{let Q=Z?.disableErrorReporting===!0?NY(J,{updateRefs:Z?.disablePrettyLogger===!0?void 0:Ym0}):NY(N5(J,(G)=>{if(W3(G))return U0;return UU(G)}),{updateRefs:Z?.disablePrettyLogger===!0?void 0:Ym0}),Y=Z?.teardown??Jh8;return X({fiber:Q,teardown:Y})});var Km0=Gm0(({fiber:X,teardown:J})=>{let Z=setInterval(O6,2147483647),Q=!1;X.addObserver((G)=>{if(!Q)process.removeListener("SIGINT",Y),process.removeListener("SIGTERM",Y);clearInterval(Z),J(G,(K)=>{if(Q||K!==0)process.exit(K)})});function Y(){Q=!0,process.removeListener("SIGINT",Y),process.removeListener("SIGTERM",Y),X.unsafeInterruptAsFork(X.id())}process.on("SIGINT",Y),process.on("SIGTERM",Y)});var Bm0=Km0;var Yh8=Bm0;class Gh8 extends $0({include:X0(d,{nullable:!0})}){}class Kh8 extends D9("FetchFetchRequest")({url:d,include:X0($0({html:X0(U8(q8,i7({key:d,value:A6})),{nullable:!0}),markdown:X0(U8(q8,i7({key:d,value:A6})),{nullable:!0}),screenshot:X0(U8(q8,$0({fullPage:X0(q8,{nullable:!0})})),{nullable:!0}),links:X0(U8(q8,$0({sameDomainOnly:X0(q8,{nullable:!0,default:()=>!0}),includePatterns:X0(K8(d),{nullable:!0}),excludePatterns:X0(K8(d),{nullable:!0})})),{nullable:!0}),meta:X0(q8,{nullable:!0,default:()=>!0}),response:X0($0({includeHeaders:X0(q8,{nullable:!0,default:()=>!1})}),{nullable:!0}),json:X0(q8,{nullable:!0,default:()=>!1}),appendix:X0(q8,{nullable:!0})}),{nullable:!0}),search:X0($0({query:d,maxResults:X0(F5.pipe(dQ(1),S3(50)),{nullable:!0,default:()=>5}),minScore:X0(L8.pipe(dQ(0),S3(1)),{nullable:!0,default:()=>0.6})}),{nullable:!0}),browserConfig:X0($0({scrollFullPage:X0(q8,{nullable:!0,default:()=>!1})}),{nullable:!0})}){}class Hm0 extends s0("Pointer","Unexpected","Missing","Composite","Refinement","Transformation","Type","Forbidden"){}class Wm0 extends s0("symbol"){}class Vm0 extends U8(d,L8,$0({_tag:Wm0,key:d})){}class $m0 extends $0({_tag:Hm0,path:K8(Vm0),message:d}){}class Um0 extends s0("HttpApiDecodeError"){}class Iz extends $0({issues:K8($m0),message:d,_tag:Um0}){}class zm0 extends s0("BadRequest"){}class $R extends $0({message:d,_tag:zm0}){}class Em extends U8(Iz,$R){}class Nm0 extends s0("InvalidApiKey","InvalidToken","InvalidSession","InvalidTenant"){}class Om0 extends s0("AuthFailed"){}class s4 extends D9("AuthFailed")({reason:Nm0,description:X0(U8(d,$0({message:d})),{nullable:!0}),_tag:Om0}){}class UR extends d{}class _m0 extends s0("FetchBlocked"){}class Sm extends $0({url:d,blockedType:X0(d,{nullable:!0}),_tag:_m0}){}class xm extends U8($0({organizationId:d.pipe($6(1)),blockedUntil:X0(U8(UR,gH),{nullable:!0}),_tag:s0("AccessBlocked")}),Sm){}class qm0 extends s0("PayloadTooLarge"){}class JG extends $0({_tag:qm0}){}class Dm0 extends s0("transfer_bytes","domsnapshot_bytes","ast_bytes"){}class wm0 extends s0("FetchPageTooLarge"){}class vm extends $0({url:d,limitKind:X0(Dm0,{nullable:!0}),limitBytes:X0(L8,{nullable:!0}),measuredBytes:X0(L8,{nullable:!0}),_tag:wm0}){}class Lm0 extends U8(JG,vm){}class Fm0 extends s0("TooManyRequests"){}class t4 extends D9("TooManyRequests")({_tag:Fm0}){}class Am0 extends s0("InternalError"){}class e4 extends D9("InternalError")({_tag:Am0}){}class Tm0 extends s0("ServiceUnavailable"){}class XG extends D9("ServiceUnavailable")({message:X0(d,{nullable:!0}),requestId:X0(d,{nullable:!0}),_tag:Tm0}){}class Bh8 extends $0({include:X0(d,{nullable:!0})}){}class Hh8 extends D9("FetchFetchJsonRequest")({url:d,include:X0($0({html:X0(U8(q8,i7({key:d,value:A6})),{nullable:!0}),markdown:X0(U8(q8,i7({key:d,value:A6})),{nullable:!0}),screenshot:X0(U8(q8,$0({fullPage:X0(q8,{nullable:!0})})),{nullable:!0}),links:X0(U8(q8,$0({sameDomainOnly:X0(q8,{nullable:!0,default:()=>!0}),includePatterns:X0(K8(d),{nullable:!0}),excludePatterns:X0(K8(d),{nullable:!0})})),{nullable:!0}),meta:X0(q8,{nullable:!0,default:()=>!0}),response:X0($0({includeHeaders:X0(q8,{nullable:!0,default:()=>!1})}),{nullable:!0}),json:X0(q8,{nullable:!0,default:()=>!1}),appendix:X0(q8,{nullable:!0})}),{nullable:!0}),search:X0($0({query:d,maxResults:X0(F5.pipe(dQ(1),S3(50)),{nullable:!0,default:()=>5}),minScore:X0(L8.pipe(dQ(0),S3(1)),{nullable:!0,default:()=>0.6})}),{nullable:!0}),browserConfig:X0($0({scrollFullPage:X0(q8,{nullable:!0,default:()=>!1})}),{nullable:!0})}){}class Mm0 extends s0(1){}class Pm0 extends $0({sameDomain:L8,external:L8}){}class Rm0 extends $0({url:d,links:Pm0}){}class jm0 extends $0({moreTokens:L8}){}class Cm0 extends $0({url:d,moreTokens:L8}){}class UD extends $0({version:Mm0,url:d,capturedAt:d,snapshotId:d,lang:d,pageType:d,playground:d,title:X0(d,{nullable:!0}),finalUrl:X0(d,{nullable:!0}),canonical:X0(d,{nullable:!0}),description:X0(d,{nullable:!0}),author:X0(d,{nullable:!0}),createdAt:X0(d,{nullable:!0}),updatedAt:X0(d,{nullable:!0}),image:X0(d,{nullable:!0}),paginationNext:X0(d,{nullable:!0}),appendix:X0(Rm0,{nullable:!0}),stateJson:X0(jm0,{nullable:!0}),markdown:X0(Cm0,{nullable:!0}),blocked:X0(d,{nullable:!0}),loadingStatus:X0(d,{nullable:!0})}){}class Im0 extends s0("inline","network"){}class Em0 extends s0("ld+json","next-data","nuxt","apollo-state","initial-state","application-json","script-tag","data-attribute","network-json","network-response","other"){}class zD extends $0({id:L8,kind:Im0,role:Em0,score:L8,url:X0(d,{nullable:!0}),method:X0(d,{nullable:!0}),moreTokens:X0(L8,{nullable:!0}),keys:X0(K8(d),{nullable:!0})}){}class Sm0 extends s0("data-url"){}class Ez extends $0({id:d,kind:Sm0,placeholder:d,archiveKey:d,mimeType:d,sha256:d,bytes:L8}){}class xm0 extends F5{}class ND extends $0({evidenceId:X0(xm0,{nullable:!0}),markdownBlockId:X0(d,{nullable:!0}),nodeIds:X0(K8(L8),{nullable:!0}),stateJsonSourceId:X0(L8,{nullable:!0}),jsonPath:X0(d,{nullable:!0})}){}class vm0 extends s0("markdown","appendix","statejson"){}class km0 extends s0("zeroentropy","local_lexical"){}class bm0 extends s0("timeout","error"){}class ym0 extends $0({source:vm0,chunkCount:F5.pipe(dQ(0)),batchCount:F5.pipe(dQ(0)),ranker:km0,fallback:q8,fallbackReason:X0(bm0,{nullable:!0}),durationMs:L8.pipe(dQ(0))}){}class OD extends $0({durationMs:L8.pipe(dQ(0)),sources:K8(ym0)}){}class km extends $0({query:d,snippets:K8($0({type:X0(s0("text"),{nullable:!0,default:()=>"text"}),source:s0("markdown","appendix","statejson"),text:d,score:L8.pipe(dQ(0),S3(1)),location:X0(ND,{nullable:!0})})),meta:X0(OD,{nullable:!0})}){}class gm0 extends D9("FetchObjectModeResult")({meta:UD,markdown:d,json:K8(zD),data:X0($0({assets:X0(K8(Ez),{nullable:!0}),search:X0(km,{nullable:!0}),screenshot:X0($0({url:d,fullPage:q8}),{nullable:!0})}),{nullable:!0})}){}class bm extends U8(Iz,$R){}class ym extends U8($0({organizationId:d.pipe($6(1)),blockedUntil:X0(U8(UR,gH),{nullable:!0}),_tag:s0("AccessBlocked")}),Sm){}class hm0 extends U8(JG,vm){}class Wh8 extends D9("FetchFetchSearchRequest")({snapshotId:d.pipe($6(1)),search:$0({query:d,maxResults:X0(F5.pipe(dQ(1),S3(50)),{nullable:!0,default:()=>5}),minScore:X0(L8.pipe(dQ(0),S3(1)),{nullable:!0,default:()=>0.6})}),include:X0($0({html:X0(U8(q8,i7({key:d,value:A6})),{nullable:!0}),markdown:X0(U8(q8,i7({key:d,value:A6})),{nullable:!0}),screenshot:X0(U8(q8,$0({fullPage:X0(q8,{nullable:!0})})),{nullable:!0}),links:X0(U8(q8,$0({sameDomainOnly:X0(q8,{nullable:!0,default:()=>!0}),includePatterns:X0(K8(d),{nullable:!0}),excludePatterns:X0(K8(d),{nullable:!0})})),{nullable:!0}),meta:X0(q8,{nullable:!0,default:()=>!0}),response:X0($0({includeHeaders:X0(q8,{nullable:!0,default:()=>!1})}),{nullable:!0}),json:X0(q8,{nullable:!0,default:()=>!1}),appendix:X0(q8,{nullable:!0})}),{nullable:!0})}){}class mm0 extends d{}class Sz extends $0({url:d,requestedUrl:X0(mm0,{nullable:!0}),originStatusCode:X0(L8,{nullable:!0}),redirectStatusCode:X0(L8,{nullable:!0}),headers:X0($0({}),{nullable:!0})}){}class dm0 extends D9("FetchSnapshotSearchResult")({snapshotId:d.pipe($6(1)),response:Sz,search:km,durationMs:L8.pipe(dQ(0)),playground:d}){}class gm extends U8(Iz,$R){}class um0 extends s0("AccessBlocked"){}class hm extends $0({organizationId:d.pipe($6(1)),blockedUntil:X0(U8(UR,gH),{nullable:!0}),_tag:um0}){}class $70 extends d.pipe($6(1)){}class cm0 extends s0("FetchSnapshotSearchNotFound"){}class mm extends D9("FetchSnapshotSearchNotFound")({snapshotId:$70,_tag:cm0}){}class Vh8 extends $0({"x-idempotency-key":X0(d.pipe($6(1),$00(255)),{nullable:!0})}){}class $h8 extends D9("FetchBatchedRequest")({urls:j3(d),include:X0($0({html:X0(U8(q8,i7({key:d,value:A6})),{nullable:!0}),markdown:X0(U8(q8,i7({key:d,value:A6})),{nullable:!0}),screenshot:X0(U8(q8,$0({fullPage:X0(q8,{nullable:!0})})),{nullable:!0}),links:X0(U8(q8,$0({sameDomainOnly:X0(q8,{nullable:!0,default:()=>!0}),includePatterns:X0(K8(d),{nullable:!0}),excludePatterns:X0(K8(d),{nullable:!0})})),{nullable:!0}),meta:X0(q8,{nullable:!0,default:()=>!0}),response:X0($0({includeHeaders:X0(q8,{nullable:!0,default:()=>!1})}),{nullable:!0}),json:X0(q8,{nullable:!0,default:()=>!1}),appendix:X0(q8,{nullable:!0})}),{nullable:!0}),browserConfig:X0($0({scrollFullPage:X0(q8,{nullable:!0,default:()=>!1})}),{nullable:!0})}){}class fm0 extends D9("BatchedRun")({id:d}){}class pm0 extends U8(Iz,$R){}class lm0 extends s0("AccessBlocked"){}class nm0 extends $0({organizationId:d.pipe($6(1)),blockedUntil:X0(U8(UR,gH),{nullable:!0}),_tag:lm0}){}class im0 extends s0("payload_mismatch"){}class om0 extends s0("BatchedIdempotencyConflict"){}class rm0 extends D9("BatchedIdempotencyConflict")({existingRunId:d,reason:im0,_tag:om0}){}class Uh8 extends $0({limit:X0(d,{nullable:!0}),offset:X0(d,{nullable:!0}),include:X0(d,{nullable:!0})}){}class am0 extends s0("QUEUED","RUNNING","CANCELLING","COMPLETED","FAILED","CANCELLED"){}class sm0 extends s0("QUEUED","RUNNING","CANCELLING","COMPLETED","FAILED","CANCELLED"){}class tm0 extends s0("QUEUED","RUNNING","SUCCEEDED","FAILED","CANCELLED"){}class em0 extends $0({href:d.pipe($6(1)),rel:d.pipe($6(1)),type:X0(d.pipe($6(1)),{nullable:!0}),sizes:X0(d.pipe($6(1)),{nullable:!0})}){}class Xd0 extends $0({url:d.pipe($6(1)),width:X0(L8,{nullable:!0}),height:X0(L8,{nullable:!0}),alt:X0(d,{nullable:!0})}){}class Jd0 extends $0({title:X0(d,{nullable:!0}),description:X0(d,{nullable:!0}),type:X0(d.pipe($6(1)),{nullable:!0}),url:X0(d.pipe($6(1)),{nullable:!0}),siteName:X0(d,{nullable:!0}),locale:X0(d,{nullable:!0}),images:X0(K8(Xd0),{nullable:!0})}){}class Zd0 extends $0({card:X0(d.pipe($6(1)),{nullable:!0}),site:X0(d,{nullable:!0}),creator:X0(d,{nullable:!0}),title:X0(d,{nullable:!0}),description:X0(d,{nullable:!0}),image:X0(d.pipe($6(1)),{nullable:!0})}){}class Qd0 extends $0({title:X0(d,{nullable:!0}),description:X0(d,{nullable:!0}),canonicalUrl:X0(d.pipe($6(1)),{nullable:!0}),language:X0(d.pipe($6(1)),{nullable:!0}),charset:X0(d.pipe($6(1)),{nullable:!0}),favicon:X0(d.pipe($6(1)),{nullable:!0}),icons:X0(K8(em0),{nullable:!0}),openGraph:X0(Jd0,{nullable:!0}),twitter:X0(Zd0,{nullable:!0})}){}class Yd0 extends $0({url:d,text:X0(d,{nullable:!0})}){}class Gd0 extends s0("rust"){}class Kd0 extends s0("rust"){}class Bd0 extends s0("rust"){}class Hd0 extends $0({capture:X0(Gd0,{nullable:!0}),markdown:X0(Kd0,{nullable:!0}),tree:X0(Bd0,{nullable:!0})}){}class Wd0 extends $0({status:tm0,data:X0($0({response:Sz,meta:X0(Qd0,{nullable:!0}),json:X0(K8($0({})),{nullable:!0}),snapshotId:X0($70,{nullable:!0}),html:X0(d.pipe($6(1)),{nullable:!0}),markdown:X0(d.pipe($6(1)),{nullable:!0}),screenshot:X0($0({url:d,fullPage:q8}),{nullable:!0}),search:X0(km,{nullable:!0}),links:X0(K8(Yd0),{nullable:!0}),appendix:X0(d.pipe($6(1)),{nullable:!0}),renderEngines:X0(Hd0,{nullable:!0}),assets:X0(K8(Ez),{nullable:!0})}),{nullable:!0}),error:X0(U8(Sm,vm),{nullable:!0})}){}class Vd0 extends $0({total:L8,limit:L8,offset:L8,hasMore:q8}){}class $d0 extends D9("BatchedStatus")({id:d,status:am0,batchedStatus:sm0,totalUrls:L8,results:K8(Wd0),pagination:Vd0}){}class Ud0 extends s0("BatchedIncludeUnsupported"){}class zd0 extends $0({unsupportedFields:K8(d),_tag:Ud0}){}class Nd0 extends U8(Iz,zd0){}class Od0 extends s0("CANCELLING","CANCELLED"){}class _d0 extends D9("BatchedCancellation")({id:d,status:Od0}){}class qd0 extends s0("COMPLETED","FAILED"){}class Dd0 extends s0("BatchedCancellationConflict"){}class wd0 extends D9("BatchedCancellationConflict")({id:d,status:qd0,_tag:Dd0}){}var Ld0=(X,J={})=>{let Z=(G,K)=>h(ni(K.text,()=>"Unexpected status code"),(B)=>Y0(new N7({request:G,response:K,reason:"StatusCode",description:B}))),Q=(G)=>J.transformClient?J.transformClient(G):y(G),Y=(G,K)=>h(B2(K)(G),Y0);return{fetchFetch:(G)=>LV("POST")("/v1/fetch").pipe(JR({include:G.params.include}),(K)=>R9(HD(K,G.payload)),h((K)=>h(Q(X),(B)=>h(B.execute(K),FV({"400":(H)=>Y(H,Em),"401":(H)=>Y(H,s4),"403":(H)=>Y(H,xm),"413":(H)=>Y(H,Lm0),"429":(H)=>Y(H,t4),"500":(H)=>Y(H,e4),"503":(H)=>Y(H,XG),orElse:(H)=>Z(K,H)}))))),fetchFetchJson:(G)=>LV("POST")("/v1/fetch/json").pipe(JR({include:G.params.include}),(K)=>R9(HD(K,G.payload)),h((K)=>h(Q(X),(B)=>h(B.execute(K),FV({"200":(H)=>B2(gm0)(H),"400":(H)=>Y(H,bm),"401":(H)=>Y(H,s4),"403":(H)=>Y(H,ym),"413":(H)=>Y(H,hm0),"429":(H)=>Y(H,t4),"500":(H)=>Y(H,e4),"503":(H)=>Y(H,XG),orElse:(H)=>Z(K,H)}))))),fetchFetchSearch:(G)=>LV("POST")("/v1/fetch/search").pipe((K)=>R9(HD(K,G)),h((K)=>h(Q(X),(B)=>h(B.execute(K),FV({"200":(H)=>B2(dm0)(H),"400":(H)=>Y(H,gm),"401":(H)=>Y(H,s4),"403":(H)=>Y(H,hm),"404":(H)=>Y(H,mm),"413":(H)=>Y(H,JG),"429":(H)=>Y(H,t4),"500":(H)=>Y(H,e4),"503":(H)=>Y(H,XG),orElse:(H)=>Z(K,H)}))))),fetchBatched:(G)=>LV("POST")("/v1/fetch/batched").pipe(x60({"x-idempotency-key":G.params["x-idempotency-key"]??void 0}),(K)=>R9(HD(K,G.payload)),h((K)=>h(Q(X),(B)=>h(B.execute(K),FV({"200":(H)=>B2(fm0)(H),"400":(H)=>Y(H,pm0),"401":(H)=>Y(H,s4),"403":(H)=>Y(H,nm0),"409":(H)=>Y(H,rm0),"413":(H)=>Y(H,JG),"429":(H)=>Y(H,t4),"500":(H)=>Y(H,e4),"503":(H)=>Y(H,XG),orElse:(H)=>Z(K,H)}))))),fetchGetBatched:(G,K)=>LV("GET")(`/v1/fetch/batched/${G}`).pipe(JR({limit:K.limit,offset:K.offset,include:K.include}),y,h((B)=>h(Q(X),(H)=>h(H.execute(B),FV({"200":(W)=>B2($d0)(W),"400":(W)=>Y(W,Nd0),"401":(W)=>Y(W,s4),"413":(W)=>Y(W,JG),"429":(W)=>Y(W,t4),"500":(W)=>Y(W,e4),"503":(W)=>Y(W,XG),orElse:(W)=>Z(B,W)}))))),fetchCancelBatched:(G)=>LV("POST")(`/v1/fetch/batched/${G}/cancel`).pipe(y,h((K)=>h(Q(X),(B)=>h(B.execute(K),FV({"200":(H)=>B2(_d0)(H),"400":(H)=>Y(H,Iz),"401":(H)=>Y(H,s4),"409":(H)=>Y(H,wd0),"413":(H)=>Y(H,JG),"429":(H)=>Y(H,t4),"500":(H)=>Y(H,e4),"503":(H)=>Y(H,XG),orElse:(H)=>Z(K,H)})))))}};function zR(X,J){return N.flatMap(N.orElseSucceed(J.text,()=>"Unexpected status code"),(Z)=>N.fail(new K2.ResponseError({request:X,response:J,reason:"StatusCode",description:Z})))}function Z7(X,J){return N.flatMap(zJ.schemaBodyJson(J)(X),N.fail)}var zh8=D.Struct({type:D.optionalWith(D.Literal("text"),{nullable:!0,default:()=>"text"}),source:D.Literal("markdown","appendix","statejson"),text:D.String,json:D.optionalWith(D.Unknown,{nullable:!0}),score:D.Number.pipe(D.greaterThanOrEqualTo(0),D.lessThanOrEqualTo(1)),location:D.optionalWith(ND,{nullable:!0})}),Fd0=D.Struct({query:D.String,snippets:D.Array(zh8),meta:D.optionalWith(OD,{nullable:!0})});class Ad0 extends D.Class("FetchObjectModeResultWithJson")({meta:UD,markdown:D.String,json:D.Array(zD),data:D.optionalWith(D.Struct({assets:D.optionalWith(D.Array(Ez),{nullable:!0}),search:D.optionalWith(Fd0,{nullable:!0})}),{nullable:!0})}){}class Td0 extends D.Class("FetchSnapshotSearchResultWithJson")({snapshotId:D.String.pipe(D.minLength(1)),response:Sz,search:Fd0,durationMs:D.Number.pipe(D.greaterThanOrEqualTo(0)),playground:D.String}){}var z70=(X,J)=>Z6.make("POST")("/v1/fetch/json").pipe(Z6.setUrlParams(J.params.include!==void 0?{include:J.params.include}:{}),(Z)=>N.orDie(Z6.bodyJson(Z,J.payload)),N.flatMap((Z)=>N.flatMap(X.execute(Z),zJ.matchStatus({"200":(Q)=>zJ.schemaBodyJson(Ad0)(Q),"400":(Q)=>Z7(Q,bm),"401":(Q)=>Z7(Q,s4),"403":(Q)=>Z7(Q,ym),"413":(Q)=>Z7(Q,JG),"429":(Q)=>Z7(Q,t4),"500":(Q)=>Z7(Q,e4),"503":(Q)=>Z7(Q,XG),orElse:(Q)=>zR(Z,Q)})))),Md0=(X,J)=>Z6.make("POST")("/v1/fetch/search").pipe((Z)=>N.orDie(Z6.bodyJson(Z,J)),N.flatMap((Z)=>N.flatMap(X.execute(Z),zJ.matchStatus({"200":(Q)=>zJ.schemaBodyJson(Td0)(Q),"400":(Q)=>Z7(Q,gm),"401":(Q)=>Z7(Q,s4),"403":(Q)=>Z7(Q,hm),"404":(Q)=>Z7(Q,mm),"413":(Q)=>Z7(Q,JG),"429":(Q)=>Z7(Q,t4),"500":(Q)=>Z7(Q,e4),"503":(Q)=>Z7(Q,XG),orElse:(Q)=>zR(Z,Q)}))));var z2="expandai-cli-browser",Nh8=D.Struct({apiOrigin:D.String,clientId:D.Literal(z2),harness:D.Literal("agent-harnesses"),scope:D.Literal("project","global"),canonicalScopeRoot:D.String});class _D extends D.Class("PendingInitRecord")({key:Nh8,deviceCode:D.Redacted(D.String),userCode:D.String,verificationUri:D.String,intervalSeconds:D.Number,nextPollAt:D.DateTimeUtc,approvalExpiresAt:D.DateTimeUtc}){}class qD extends D.TaggedError()("PendingInitCorrupt",{path:D.String,error:D.Defect}){recoverable=!0;get message(){return`Pending authorization state at ${this.path} is corrupt and was left unchanged.`}}class N70 extends D.TaggedError()("PendingInitStorageError",{path:D.String,error:D.Defect}){recoverable=!0;get message(){return`Could not access pending authorization state at ${this.path}.`}}import{createServer as Ch8}from"node:http";import{createHash as Oh8,randomBytes as _h8}from"node:crypto";var qh8=32;function Pd0(X){return Oh8("sha256").update($7.value(X)).digest("base64url")}function O70(){return _h8(qh8).toString("base64url")}var NR="https://expand.land";function Dh8(X){return X.replace(/\/+$/,"")}function wh8(X){return X!==null&&X!==void 0&&Number.isInteger(X)&&X>0&&X<=2147483647?X:void 0}function Rd0(X){return X!==null&&X!==void 0&&Number.isInteger(X)&&X>=0&&X<=4294967295?X:void 0}function _70(X,J="https://expand.land"){return`${Dh8(J)}/s/${encodeURIComponent(X)}`}function Lh8(X){return new URL(X).origin}function jV(X,J){if(X==null)return J;try{return Lh8(X)}catch{return J}}function DD(X,J,Z,Q="https://expand.land"){let Y=typeof J==="string",G=Y?J:void 0,K=Y?typeof Z==="string"?void 0:Z:J,H=_70(X,Y?Q:typeof Z==="string"?Z:"https://expand.land"),W=wh8(K?.evidenceId);if(W!==void 0)return`${H}?id=${W}`;if(G==="statejson"){let V=Rd0(K?.stateJsonSourceId);return V===void 0?H:`${H}?id=${V}`}if(G==="markdown"||G==="appendix"){let V=Rd0(K?.nodeIds?.[0]);return V===void 0?H:`${H}/playground#focus=${V}`}return H}function jd0(X,J,Z,Q){return N.scoped(N.gen(function*(){let Y=yield*X.open(J,{flag:"wx",mode:Q}),G=yield*Y.stat,K={dev:G.dev,ino:m.getOrUndefined(G.ino),mode:G.mode,type:G.type},B=yield*N.exit(Y.writeAll(new TextEncoder().encode(Z)).pipe(N.zipRight(Y.sync)));if(I9.isFailure(B))return{identity:K,writeExit:B,pathMatchesHandle:!1};let H=yield*X.stat(J),W=wD(K,{exists:!0,dev:H.dev,ino:m.getOrUndefined(H.ino),type:H.type});return{identity:K,writeExit:B,pathMatchesHandle:W}}))}function wD(X,J){return J.exists&&J.dev===X.dev&&J.ino===X.ino&&J.type===X.type}import{homedir as Fh8}from"node:os";var dm=N.gen(function*(){let X=yield*M6.Path;return yield*P0.string("XDG_CONFIG_HOME").pipe(P0.withDefault(""),P0.map((J)=>J.trim()===""?X.join(Fh8(),".config"):J))});var cm="https://api.expand.ai",Ah8="https://expand.ai",AD=(X)=>P0.string(X).pipe(P0.option,P0.map(m.match({onNone:()=>!1,onSome:(J)=>J!==""&&J!=="0"&&J!=="false"}))),fm=(X,J)=>P0.string(X).pipe(P0.option,P0.map(m.flatMap(D.decodeUnknownOption(J)))),pm=D.Redacted(D.NonEmptyTrimmedString.pipe(D.brand("ApiKey"))),q70=D.TaggedStruct("ApiKey",{apiKey:pm}),xz=D.TaggedStruct("OAuth",{accessToken:D.Redacted(D.String),refreshToken:D.optional(D.Redacted(D.String)),expiresAt:D.DateTimeUtc,clientId:D.optional(D.String)}),Th8=D.Struct({enabled:D.optional(D.Boolean),distinctId:D.optional(D.String),noticeShown:D.optional(D.Boolean)});class N2 extends D.Class("ExpandCliConfig")({apiUrl:D.optional(D.URL),authMethod:D.optional(D.Union(q70,xz)),telemetry:D.optional(Th8)}){static Json=D.parseJson(N2)}function lm(X,J){if(X._tag==="ApiKey")return"healthy";if(Q9.lessThan(J,X.expiresAt))return $7.value(X.accessToken).trim().length>0?"healthy":"unusable";let Z=X.refreshToken;return Z!==void 0&&$7.value(Z).trim().length>0?"refresh_required":"unusable"}function nm(X,J){return lm(X,J)!=="unusable"}var Mh8=D.Record({key:D.String,value:D.Unknown}),um=D.parseJson(Mh8);function Ph8(X,J){return{...X,...J}}function Rh8(X,J){return typeof X==="object"&&X!==null&&"code"in X&&X.code===J}function jh8(X){return`'${X.replaceAll("'","''")}'`}function Cd0(X,J){return`$targetPaths = @(${J.map((Z)=>jh8(Z)).join(", ")})
208
+ try {
209
+ Import-Module (Join-Path $PSHOME 'Modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1') -ErrorAction Stop
210
+ $null = & {
211
+ ${X}
212
+ }
213
+ exit 0
214
+ } catch {
215
+ [Console]::Error.WriteLine($_.Exception.Message)
216
+ exit 1
217
+ }`}function Id0(X,J){return X.exists===J.exists&&X.dev===J.dev&&X.ino===J.ino&&X.realPath===J.realPath&&X.type===J.type}class LD extends D.TaggedError()("ConfigNotWritable",{path:D.String}){get message(){return`Cannot write to ${this.path}. Check filesystem permissions on the config directory.`}}class OR extends D.TaggedError()("ConfigCleanupError",{path:D.String,temporaryPath:D.String,error:D.Defect,operationError:D.Defect}){get message(){return`Could not safely clean up config temporary state at ${this.temporaryPath}; it was left unchanged.`}}class FD extends D.TaggedError()("ConfigParseError",{path:D.String,error:D.Defect}){get message(){return`Could not parse ${this.path}. Delete the file and run \`expandai login\` to recreate it.`}}class O2 extends D.TaggedError()("CredentialStoreInsecure",{path:D.String,reason:D.String,error:D.Defect}){get message(){return`Credential storage at ${this.path} is insecure: ${this.reason}`}}class im extends D.TaggedError()("NotAuthenticated",{}){get message(){return"Not authenticated. Run `expandai login` to authenticate."}}class om extends D.TaggedError()("OAuthTokenExpired",{expiredAt:D.DateTimeUtc}){get message(){return`Your OAuth token expired at ${Q9.formatIso(this.expiredAt)}. Run \`expandai login\` to re-authenticate.`}}var Ed0=N.gen(function*(){let X=yield*D.Config("EXPAND_API_KEY",pm).pipe(P0.option),J=yield*P0.url("EXPAND_API_URL").pipe(P0.option);return N2.make({apiUrl:m.getOrUndefined(J),authMethod:m.getOrUndefined(m.map(X,(Z)=>({_tag:"ApiKey",apiKey:Z})))})});class x9 extends N.Service()("@expandai/cli/Config/ConfigManager",{dependencies:[RV.layer],effect:N.gen(function*(){let X=yield*Y2.CommandExecutor,J=yield*zX.FileSystem,Z=yield*M6.Path,Q=Z.join(yield*dm,"expandai","config.json"),Y=Z.dirname(Q),G=(b,a,n)=>new O2({path:b,reason:a,error:n}),K=N.fnUntraced(function*(b){let a=yield*N.either(J.readLink(b));if(F8.isRight(a))return yield*G(b,"symbolic links are not allowed for credential storage",Error(a.right));let n=a.left;if(n instanceof PY.SystemError&&(n.reason==="InvalidData"||n.reason==="NotFound"||n.method==="readLink"&&Rh8(n.cause,"EINVAL")))return;return yield*G(b,"could not inspect the credential path without following links",n)}),B=N.fnUntraced(function*(b){if(yield*K(b),!(yield*J.exists(b).pipe(N.mapError((F0)=>G(b,"could not inspect the credential path",F0)))))return{exists:!1};let n=yield*J.stat(b).pipe(N.mapError((F0)=>G(b,"could not inspect the credential path",F0))),r=yield*J.realPath(b).pipe(N.mapError((F0)=>G(b,"could not resolve the credential path",F0)));return{exists:!0,dev:n.dev,ino:m.getOrUndefined(n.ino),realPath:r,type:n.type}}),H=(b,a,n)=>Id0(a,n)?N.void:N.fail(G(b,"credential path identity changed during the operation",Error("Path swap detected"))),W=N.fnUntraced(function*(b){let a=Z.dirname(b),n=yield*B(a);if(!n.exists||n.type!=="Directory")return yield*G(a,"credential parent is not a directory",Error("Invalid parent"));return{parentPath:a,parent:n,file:yield*B(b)}}),V=N.fnUntraced(function*(b){let a=yield*W(b);if(!a.file.exists||a.file.type!=="File")return yield*G(b,"credential path is not a regular file",Error("Invalid file"));let n=yield*J.readFileString(b).pipe(N.mapError((J0)=>G(b,"could not read the credential file",J0))),r=yield*W(b);return yield*H(a.parentPath,a.parent,r.parent),yield*H(b,a.file,r.file),n}),U=N.fnUntraced(function*(b,a,n){let r=yield*B(b);if(!r.exists||r.type!==n)return yield*G(b,`expected a ${n.toLowerCase()}`,Error("Invalid path type"));yield*J.chmod(b,a).pipe(N.mapError((J8)=>G(b,`could not set mode ${a.toString(8)}`,J8)));let J0=yield*J.stat(b).pipe(N.mapError((J8)=>G(b,"could not verify permissions",J8))),F0=J0.mode&4095;if(J0.type!==n||F0!==a)return yield*G(b,`expected ${n.toLowerCase()} mode ${a.toString(8)}, found ${J0.type.toLowerCase()} mode ${F0.toString(8)}`,Error("Permission verification failed"));let Z8=yield*B(b);yield*H(b,r,Z8)}),O=String.raw`
218
+ $ErrorActionPreference = 'Stop'
219
+ $currentSid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value
220
+ $allowedSids = @($currentSid, 'S-1-5-18', 'S-1-5-32-544')
221
+ foreach ($targetPath in $targetPaths) {
222
+ if (-not (Test-Path -LiteralPath $targetPath)) { throw "Missing credential path: $targetPath" }
223
+ $item = Get-Item -LiteralPath $targetPath -Force
224
+ $acl = Get-Acl -LiteralPath $targetPath
225
+ $acl.SetAccessRuleProtection($true, $false)
226
+ foreach ($rule in @($acl.Access)) { [void]$acl.RemoveAccessRuleSpecific($rule) }
227
+ $inheritance = if ($item.PSIsContainer) {
228
+ [System.Security.AccessControl.InheritanceFlags]'ContainerInherit, ObjectInherit'
229
+ } else {
230
+ [System.Security.AccessControl.InheritanceFlags]::None
231
+ }
232
+ foreach ($sidValue in $allowedSids) {
233
+ $sid = [System.Security.Principal.SecurityIdentifier]::new($sidValue)
234
+ $rule = [System.Security.AccessControl.FileSystemAccessRule]::new(
235
+ $sid,
236
+ [System.Security.AccessControl.FileSystemRights]::FullControl,
237
+ $inheritance,
238
+ [System.Security.AccessControl.PropagationFlags]::None,
239
+ [System.Security.AccessControl.AccessControlType]::Allow
240
+ )
241
+ [void]$acl.AddAccessRule($rule)
242
+ }
243
+ Set-Acl -LiteralPath $targetPath -AclObject $acl
244
+
245
+ $verified = Get-Acl -LiteralPath $targetPath
246
+ if (-not $verified.AreAccessRulesProtected) { throw "Inherited ACL remains enabled: $targetPath" }
247
+ $seenSids = @{}
248
+ foreach ($rule in @($verified.Access)) {
249
+ $sid = $rule.IdentityReference.Translate([System.Security.Principal.SecurityIdentifier]).Value
250
+ if ($allowedSids -notcontains $sid) { throw "Unexpected ACL principal $sid on $targetPath" }
251
+ if ($rule.AccessControlType -ne [System.Security.AccessControl.AccessControlType]::Allow) {
252
+ throw "Unexpected deny ACL for $sid on $targetPath"
163
253
  }
164
- yield* telemetry.capture('cli_command_run', { command, context });
165
- const cli = context === 'human' ? HumanCli : AgentCli;
166
- return yield* Command.run(cli, { name: 'expand.ai CLI', version: CLI_VERSION })(process.argv);
167
- }).pipe(Effect.catchAllCause((cause) => {
168
- const failure = Cause.failureOption(cause);
169
- // Ctrl-C during a `Prompt` surfaces as a `QuitException` failure rather
170
- // than a pure interrupt; treat it the same as an interrupt so we exit
171
- // cleanly instead of printing a blank "Error: " (QuitException has no message).
172
- if (Cause.isInterruptedOnly(cause) || (Option.isSome(failure) && Terminal.isQuitException(failure.value))) {
173
- return Effect.void;
254
+ $requiredRights = [System.Security.AccessControl.FileSystemRights]::FullControl
255
+ if (($rule.FileSystemRights -band $requiredRights) -ne $requiredRights) {
256
+ throw "ACL principal $sid lacks FullControl on $targetPath"
174
257
  }
175
- // `@effect/cli` already printed a help/usage message before failing with
176
- // a `ValidationError`; we only need to propagate the non-zero exit.
177
- const print = Option.match(failure, {
178
- onSome: (error) => ValidationError.isValidationError(error) ? Effect.void : Console.error(`Error: ${error.message}`),
179
- onNone: () => Console.error(String.stripMargin(`
180
- |Unexpected failure:
181
- |${Cause.pretty(cause)}`)),
182
- });
183
- const debug = Effect.logDebug('Error cause').pipe(Effect.annotateLogs({ cause: Cause.pretty(cause) }));
184
- const trackFailure = Effect.flatMap(Telemetry, (telemetry) => telemetry.capture('cli_command_failed', {
185
- command: commandFromArgv(process.argv),
186
- error_tag: errorTagFromCause(cause),
187
- }));
188
- return print.pipe(Effect.zipRight(debug), Effect.zipRight(trackFailure), Effect.zipRight(Effect.failCause(cause)));
189
- }),
190
- // Deliver any pending telemetry before the process exits; capped at 1s by
191
- // Telemetry.flush so it can never hold a short-lived invocation open.
192
- Effect.ensuring(Effect.flatMap(Telemetry, (telemetry) => telemetry.flush)), Effect.provide(Env));
193
- // disablePrettyLogger: runMain's own pretty logger writes to stdout, which
194
- // would put diagnostics back on the protocol/data stream LoggerLive keeps clean.
195
- const preflightError = startupOnboardingPreflightError();
196
- if (preflightError !== undefined) {
197
- // This validation must finish before the Effect runtime acquires Telemetry,
198
- // otherwise an invalid machine command could still create local state.
199
- process.stderr.write(`${preflightError}\n`);
200
- process.exitCode = 2;
258
+ $seenSids[$sid] = $true
259
+ }
260
+ foreach ($allowedSid in $allowedSids) {
261
+ if (-not $seenSids.ContainsKey($allowedSid)) { throw "Missing ACL principal $allowedSid on $targetPath" }
262
+ }
201
263
  }
202
- else {
203
- NodeRuntime.runMain(program, { disableErrorReporting: true, disablePrettyLogger: true });
264
+ 'SECURE'
265
+ `,q=String.raw`
266
+ $ErrorActionPreference = 'Stop'
267
+ $currentSid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value
268
+ $allowedSids = @($currentSid, 'S-1-5-18', 'S-1-5-32-544')
269
+ foreach ($targetPath in $targetPaths) {
270
+ if (-not (Test-Path -LiteralPath $targetPath)) { throw "Missing credential path: $targetPath" }
271
+ $acl = Get-Acl -LiteralPath $targetPath
272
+ if (-not $acl.AreAccessRulesProtected) { throw "Inherited ACL remains enabled: $targetPath" }
273
+ $seenSids = @{}
274
+ foreach ($rule in @($acl.Access)) {
275
+ $sid = $rule.IdentityReference.Translate([System.Security.Principal.SecurityIdentifier]).Value
276
+ if ($allowedSids -notcontains $sid) { throw "Unexpected ACL principal $sid on $targetPath" }
277
+ if ($rule.AccessControlType -ne [System.Security.AccessControl.AccessControlType]::Allow) {
278
+ throw "Unexpected deny ACL for $sid on $targetPath"
279
+ }
280
+ $requiredRights = [System.Security.AccessControl.FileSystemRights]::FullControl
281
+ if (($rule.FileSystemRights -band $requiredRights) -ne $requiredRights) {
282
+ throw "ACL principal $sid lacks FullControl on $targetPath"
283
+ }
284
+ $seenSids[$sid] = $true
285
+ }
286
+ foreach ($allowedSid in $allowedSids) {
287
+ if (-not $seenSids.ContainsKey($allowedSid)) { throw "Missing ACL principal $allowedSid on $targetPath" }
288
+ }
204
289
  }
205
- //# sourceMappingURL=main.js.map
290
+ 'SECURE'
291
+ `,L=N.fnUntraced(function*(b){let a=yield*fQ.make("powershell.exe","-NoLogo","-NoProfile","-NonInteractive","-Command",Cd0(O,b)).pipe(fQ.stderr("inherit"),fQ.exitCode,N.provideService(Y2.CommandExecutor,X),N.mapError((n)=>G(Y,"could not apply or verify the Windows ACL allowlist",n)));if(a!==0)return yield*G(Y,"Windows ACL verification failed",Error(`PowerShell exited with status ${a}`))}),A=N.fnUntraced(function*(b){let a=yield*fQ.make("powershell.exe","-NoLogo","-NoProfile","-NonInteractive","-Command",Cd0(q,b)).pipe(fQ.stderr("inherit"),fQ.exitCode,N.provideService(Y2.CommandExecutor,X),N.mapError((n)=>G(Y,"could not inspect the Windows ACL allowlist",n)));if(a!==0)return yield*G(Y,"Windows ACL inspection failed",Error(`PowerShell exited with status ${a}`))}),M=N.fn("ConfigManager.inspectSecureStorage")(function*(){let b=yield*B(Y);if(!b.exists)return yield*N.void;if(b.type!=="Directory")return yield*G(Y,"config directory is not a regular directory",Error("Invalid config directory"));let a=yield*B(Q);if(a.exists&&a.type!=="File")return yield*G(Q,"credential path is not a regular file",Error("Invalid file"));if(process.platform==="win32"){let r=a.exists?[Y,Q]:[Y],J0=yield*N.forEach(r,B);yield*A(r);let F0=yield*N.forEach(r,B);return yield*N.forEach(r,(Z8,J8)=>H(Z8,J0[J8]??{exists:!1},F0[J8]??{exists:!1}),{discard:!0}),yield*N.void}if(((yield*J.stat(Y).pipe(N.mapError((r)=>G(Y,"could not inspect directory mode",r)))).mode&4095)!==448)return yield*G(Y,"config directory mode is not 700",Error("Invalid directory mode"));if(a.exists){if(((yield*J.stat(Q).pipe(N.mapError((J0)=>G(Q,"could not inspect credential file mode",J0)))).mode&4095)!==384)return yield*G(Q,"credential file mode is not 600",Error("Invalid file mode"))}return yield*N.void}),x=N.fn("ConfigManager.ensureSecureStorage")(function*(){yield*J.makeDirectory(Y,{recursive:!0,mode:448}).pipe(N.mapError((n)=>G(Y,"could not create the config directory",n)));let b=yield*B(Y);if(!b.exists||b.type!=="Directory")return yield*G(Y,"config directory is not a regular directory",Error("Invalid config directory"));if(!(yield*J.exists(Q).pipe(N.mapError((n)=>G(Q,"could not inspect the credential file",n))))){let n=yield*N.either(J.writeFileString(Q,"{}",{flag:"wx",mode:384}));if(F8.isLeft(n)&&(!(n.left instanceof PY.SystemError)||n.left.reason!=="AlreadyExists"))return yield*G(Q,"could not create the credential file",n.left)}if(yield*W(Q),process.platform==="win32"){let n=[Y,Q],r=yield*N.forEach(n,(F0)=>B(F0));yield*L(n);let J0=yield*N.forEach(n,(F0)=>B(F0));yield*N.forEach(n,(F0,Z8)=>H(F0,r[Z8]??{exists:!1},J0[Z8]??{exists:!1}),{discard:!0})}else yield*U(Y,448,"Directory"),yield*U(Q,384,"File");return yield*N.void}),j=N.fnUntraced(function*(b){yield*x();let a=yield*W(Q),n=yield*dF.nextIntBetween(0,2147483647),r=Z.join(Y,`.config.json.${process.pid}.${n.toString(16)}.tmp`),J0=N.fnUntraced(function*(S8,b8){let j6=yield*N.either(W(r));if(F8.isLeft(j6))return yield*new OR({path:Q,temporaryPath:r,error:j6.left,operationError:b8});if(!Id0(a.parent,j6.right.parent))return yield*new OR({path:Q,temporaryPath:r,error:Error("Config temp parent identity changed; refusing cleanup"),operationError:b8});if(!wD(S8,j6.right.file))return yield*new OR({path:Q,temporaryPath:r,error:Error("Config temp identity changed or disappeared; refusing cleanup"),operationError:b8});let WZ=yield*N.either(J.remove(r));if(F8.isLeft(WZ))return yield*new OR({path:Q,temporaryPath:r,error:WZ.left,operationError:b8})}),F0=yield*jd0(J,r,b,384).pipe(N.mapError(()=>new LD({path:r})));if(I9.isFailure(F0.writeExit)){let S8=new LD({path:r});return yield*J0(F0.identity,S8),yield*S8}if(!F0.pathMatchesHandle){let S8=new LD({path:r});return yield*J0(F0.identity,S8),yield*S8}let Z8=yield*N.either(N.gen(function*(){let S8=yield*W(r);if(yield*H(a.parentPath,a.parent,S8.parent),!wD(F0.identity,S8.file))return yield*G(r,"config temp identity differs from its creating handle",Error("Config temp replacement detected"));if(process.platform==="win32"){yield*L([r]);let j6=yield*W(r);if(yield*H(a.parentPath,a.parent,j6.parent),!wD(F0.identity,j6.file))return yield*G(r,"config temp changed while applying its ACL",Error("Config temp replacement detected"))}else if(((yield*J.stat(r).pipe(N.mapError((WZ)=>G(r,"could not verify config temp mode",WZ)))).mode&4095)!==384)return yield*G(r,"config temp mode is not 600",Error("Invalid config temp mode"));let b8=yield*W(Q);yield*H(a.parentPath,a.parent,b8.parent),yield*H(Q,a.file,b8.file),yield*J.rename(r,Q).pipe(N.mapError(()=>new LD({path:Q})))}));if(F8.isLeft(Z8))return yield*J0(F0.identity,Z8.left),yield*Z8.left;let J8=yield*W(Q);if(yield*H(a.parentPath,a.parent,J8.parent),!wD(F0.identity,J8.file))return yield*G(Q,"atomic credential installation identity could not be verified",Error("Installed file identity mismatch"))}),T=N.gen(function*(){if(!(yield*J.exists(Q)))return{config:N2.make({}),raw:{}};let a=yield*V(Q),n=yield*D.decode(um)(a).pipe(N.mapError((F0)=>new FD({path:Q,error:F0})));return{config:yield*D.decodeUnknown(N2)(n).pipe(N.mapError((F0)=>new FD({path:Q,error:F0}))),raw:n}}),E=T.pipe(N.map(({config:b})=>b)),k=N.fn("loadConfig")(function*(){let b=yield*Ed0,a=yield*E,n={env:m.fromNullable(b.apiUrl),file:m.fromNullable(a.apiUrl)},r={env:m.fromNullable(b.authMethod),file:m.fromNullable(a.authMethod)};yield*N.logWarning(`EXPAND_API_URL overrides apiUrl from ${Q}`).pipe(N.when(()=>m.zipWith(n.env,n.file,(J8,S8)=>J8.toString()!==S8.toString()).pipe(m.getOrElse(()=>!1))));let J0=yield*Q9.now,F0=r.file.pipe(m.filter((J8)=>J8._tag==="OAuth"&&nm(J8,J0))),Z8=m.firstSomeOf([F0,r.env,r.file]);return yield*N.logWarning(`EXPAND_API_KEY is set but ${Q} holds credentials from \`expandai login\` or agent setup, which take precedence. Unset EXPAND_API_KEY to silence this, or run \`expandai logout\` to use the API key.`).pipe(N.when(()=>m.isSome(r.env)&&m.isSome(F0))),yield*N.logWarning(`EXPAND_API_KEY overrides the API key stored in ${Q}`).pipe(N.when(()=>m.isSome(r.env)&&m.isSome(r.file)&&m.isNone(F0))),yield*m.match(Z8,{onNone:()=>N.fail(new im),onSome:(J8)=>N.succeed({apiUrl:m.firstSomeOf([n.env,n.file]).pipe(m.getOrElse(()=>new URL(cm))),authMethod:J8})})}),P=N.fn("saveConfig")(function*(b){let a=yield*D.encode(N2.Json)(b);yield*j(a)}),C=N.fn("updateConfig")(function*(b){let a=yield*T,n=N2.make({...a.config,...b}),r=yield*D.encode(N2.Json)(n).pipe(N.flatMap(D.decode(um))),J0=yield*D.encode(um)(Ph8(a.raw,r));yield*j(J0)}),v=N.fn("readConfigFile")(function*(){return yield*T.pipe(N.map(({config:b})=>({config:b,parseFailed:!1})),N.orElseSucceed(()=>({config:N2.make({}),parseFailed:!0})))}),f=N.fn("clearConfig")(function*(){let b=yield*N.either(T);if(F8.isLeft(b)){if(!(b.left instanceof FD))return yield*b.left;yield*N.logWarning(`Could not parse ${Q}; removing it. Telemetry preferences and apiUrl were not preserved.`),yield*J.remove(Q).pipe(N.mapError(()=>new LD({path:Q})));return}let a={...b.right.raw};delete a.authMethod;let n=yield*D.encode(um)(a);yield*j(n)}),s=N.fn("getApiUrl")(function*(){let b=yield*Ed0,a=yield*E,n={env:m.fromNullable(b.apiUrl),file:m.fromNullable(a.apiUrl)};return m.firstSomeOf([n.env,n.file]).pipe(m.getOrElse(()=>new URL(cm)))}),l=N.fn("getAppUrl")(function*(){return yield*P0.string("EXPAND_APP_URL").pipe(P0.withDefault(Ah8))}),W0=N.fn("getPlaygroundHost")(function*(){return yield*P0.string("EXPAND_PLAYGROUND_HOST").pipe(P0.withDefault(NR))});return{configPath:Q,inspectSecureStorage:M,ensureSecureStorage:x,loadConfig:k,saveConfig:P,updateConfig:C,clearConfig:f,readConfigFile:v,getApiUrl:s,getAppUrl:l,getPlaygroundHost:W0}})}){}var am="expandai-cli",Ih8="/api/auth/oauth2/authorize",TD="/api/auth/oauth2/token",Eh8="openid profile email offline_access",sm="127.0.0.1",Sh8=r9.minutes(5),xh8=D.transform(D.Number,D.DurationFromSelf,{strict:!0,decode:r9.seconds,encode:r9.toSeconds});class xd0 extends D.Class("BrowserOAuthTokenResponse")({access_token:D.String,refresh_token:D.optional(D.String),expires_in:xh8,token_type:D.String,scope:D.optional(D.String)}){}class MD extends D.TaggedError()("BrowserOAuthRequestFailed",{endpoint:D.String,error:D.Defect,status:D.optional(D.Number)}){get message(){return`OAuth request to ${this.endpoint} failed${this.status?` (${this.status})`:""}: ${T9.format(this.error)}`}}class tm extends D.TaggedError()("BrowserOAuthCallbackError",{error:D.String,errorDescription:D.optional(D.String)}){get message(){return this.errorDescription?`${this.error}: ${this.errorDescription}`:this.error}}class w70 extends D.TaggedError()("BrowserOAuthMissingCode",{}){get message(){return"OAuth callback did not include an authorization code."}}class L70 extends D.TaggedError()("BrowserOAuthStateMismatch",{}){get message(){return"OAuth callback state did not match the login request."}}class D70 extends D.TaggedError()("BrowserOAuthLoopbackFailed",{error:D.Defect}){get message(){return`Could not start OAuth loopback server: ${T9.format(this.error)}`}}class vd0 extends D.TaggedError()("BrowserOAuthTimedOut",{}){get message(){return"OAuth browser login timed out before the local callback completed."}}var vh8=N.fn("BrowserOAuth.createCodeChallenge")(function*(X){return Pd0($7.make(X))}),kh8=N.fn("BrowserOAuth.buildAuthorizeUrl")(function*({apiUrl:X,redirectUri:J,state:Z,codeChallenge:Q}){let Y=new URL(Ih8,X);return Y.searchParams.set("response_type","code"),Y.searchParams.set("client_id",am),Y.searchParams.set("redirect_uri",J.toString()),Y.searchParams.set("scope",Eh8),Y.searchParams.set("code_challenge",Q),Y.searchParams.set("code_challenge_method","S256"),Y.searchParams.set("state",Z),Y});function rm(X,J,Z){X.writeHead(J,{"content-type":"text/html; charset=utf-8"}),X.end(Z)}function bh8(X,J){let Z=new URL(X.url??"/",`http://${sm}`),Q=Z.searchParams.get("error");if(Q!==null)throw new tm({error:Q,errorDescription:Z.searchParams.get("error_description")??void 0});if(Z.searchParams.get("state")!==J)throw new L70;let Y=Z.searchParams.get("code");if(Y===null||Y.length===0)throw new w70;return Y}function Sd0(X){if(X instanceof tm||X instanceof w70||X instanceof L70)return X;return new tm({error:"server_error",errorDescription:T9.format(X)})}function yh8(X){return N.async((J)=>{X.close((Z)=>{if(Z){J(N.void);return}J(N.void)})})}var gh8=N.fn("BrowserOAuth.startLoopbackServer")(function*(X){return yield*N.async((J)=>{let Z=!1,Q=()=>{return},Y=()=>{return},G=new Promise((B,H)=>{Q=B,Y=(W)=>H(W)}),K=Ch8((B,H)=>{if(new URL(B.url??"/",`http://${sm}`).pathname!=="/callback"){rm(H,404,"Not found");return}if(Z){rm(H,409,"OAuth callback already handled.");return}Z=!0;try{let V=bh8(B,X);rm(H,200,"Authentication complete. You can close this tab."),Q(V)}catch(V){rm(H,400,"Authentication failed. Return to the terminal and try again."),Y(Sd0(V))}});K.once("error",(B)=>{J(N.fail(new D70({error:B})))}),K.listen(0,sm,()=>{let B=K.address();if(B===null||typeof B==="string"){J(N.fail(new D70({error:"loopback server did not report a port"})));return}J(N.succeed({redirectUri:new URL(`http://${sm}:${B.port}/callback`),waitForCode:N.tryPromise({try:()=>G,catch:Sd0}),close:yh8(K)}))})})});class vz extends N.Service()("@expandai/cli/BrowserOAuthService",{dependencies:[U2.layer,x9.Default],effect:N.gen(function*(){let X=yield*v5.HttpClient,J=yield*x9,Z=N.fn("BrowserOAuthService.exchangeToken")(function*(B){yield*J.ensureSecureStorage();let H=yield*J.getApiUrl(),W=H.toString(),V=Z6.post(new URL(TD,H)).pipe(Z6.bodyUrlParams([...B,["resource",W]]));return yield*X.execute(V).pipe(N.flatMap(zJ.matchStatus({"200":(U)=>zJ.schemaBodyJson(xd0)(U),orElse:(U)=>U.text.pipe(N.flatMap((O)=>N.fail(new MD({endpoint:TD,status:U.status,error:O}))))})),N.catchTags({RequestError:(U)=>N.fail(new MD({endpoint:TD,error:U})),ResponseError:(U)=>N.fail(new MD({endpoint:TD,error:U})),ParseError:(U)=>N.fail(new MD({endpoint:TD,error:U}))}))}),Q=N.fn("BrowserOAuthService.exchangeCode")(function*({code:B,redirectUri:H,codeVerifier:W}){return yield*Z([["grant_type","authorization_code"],["client_id",am],["code",B],["redirect_uri",H.toString()],["code_verifier",W]])}),Y=N.fn("BrowserOAuthService.refreshToken")(function*(B,H=am){return yield*Z([["grant_type","refresh_token"],["client_id",H],["refresh_token",B]])}),G=N.fn("BrowserOAuthService.saveToken")(function*(B){let H=yield*Q9.now,W=Q9.addDuration(H,B.expires_in);yield*J.updateConfig({authMethod:xz.make({accessToken:$7.make(B.access_token),refreshToken:B.refresh_token===void 0?void 0:$7.make(B.refresh_token),expiresAt:W,clientId:am})})}),K=N.fn("BrowserOAuthService.login")(function*(B){yield*J.ensureSecureStorage();let H=O70(),W=O70(),V=yield*vh8(H),U=yield*gh8(W),O=yield*J.getApiUrl(),q=yield*kh8({apiUrl:O,redirectUri:U.redirectUri,state:W,codeChallenge:V}),L=yield*B(q).pipe(N.zipRight(U.waitForCode),N.timeoutFail({duration:Sh8,onTimeout:()=>new vd0}),N.ensuring(U.close)),A=yield*Q({code:L,redirectUri:U.redirectUri,codeVerifier:H});if(A===void 0)return yield*new MD({endpoint:TD,error:"OAuth token endpoint returned an empty response body"});yield*G(A)});return{exchangeCode:Q,refreshToken:Y,saveToken:G,login:K}})}){}class em extends c8.Tag("@expandai/cli/Mcp/RequestHeaders/CurrentRequestHeaders")(){static Default=C8.succeed(this,{})}class kd0 extends D.Class("DeviceAuthorizationCreated")({deviceCode:D.Redacted(D.NonEmptyString),userCode:D.NonEmptyString,verificationUri:D.URL,expiresIn:D.Int.pipe(D.positive()),interval:D.Int.pipe(D.nonNegative())}){}var hh8=D.Struct({access_token:D.Redacted(D.NonEmptyString),refresh_token:D.Redacted(D.NonEmptyString),token_type:D.NonEmptyString,expires_in:D.Number.pipe(D.positive()),scope:D.optional(D.String)}),mh8=D.Literal("create","poll");class CV extends D.TaggedError()("ManualAuthorizationApiError",{operation:mh8,kind:D.Literal("request_failed","rejected","invalid_response"),status:D.optional(D.Number),recoverable:D.Boolean}){get message(){return this.kind==="rejected"?`Manual authorization ${this.operation} was rejected. Restart authorization if the problem persists.`:`Manual authorization ${this.operation} could not be completed safely. Try again.`}}class bd0 extends D.TaggedError()("ApiRequestFailed",{detail:D.String}){get message(){return this.detail}}var dh8=r9.minutes(1);class yd0 extends V3.TaggedError("OAuthAuthMethodChanged"){}function F70(X,J){return typeof X==="object"&&X!==null&&J in X?X[J]:void 0}function Xd(X,J){let Z=F70(X,J);return typeof Z==="string"?Z:void 0}function uh8(X){let J=F70(X,"issues");return Array.isArray(J)?J:[]}function ch8(X){let J=F70(X,"unsupportedFields");return Array.isArray(J)?J.filter((Z)=>typeof Z==="string"):[]}function fh8({path:X,message:J}){let Z=X.map((Q)=>typeof Q==="object"?Q.key:String(Q)).join(".");return Z?`${Z}: ${J}`:J}function ph8(X){switch(Xd(X,"_tag")){case"HttpApiDecodeError":{let J=uh8(X);return J.length===0?Xd(X,"message")??"Invalid request":J.map(fh8).join("; ")}case"AuthFailed":return`Authentication failed (${Xd(X,"reason")??"unknown"}). Run \`expandai login\` to re-authenticate.`;case"AccessBlocked":return"Access blocked. Check your billing status or contact support.";case"BatchedIncludeUnsupported":return`Unsupported batched include fields: ${ch8(X).join(", ")}.`;case"FetchSnapshotSearchNotFound":return"Fetch snapshot not found.";case"PayloadTooLarge":return"Request payload is too large.";case"TooManyRequests":return"Rate limit exceeded — try again in a moment.";case"InternalError":return"The expand.ai API returned an internal error. Try again or contact support.";case"ServiceUnavailable":return"The expand.ai API is temporarily unavailable. Try again shortly.";default:return X instanceof Error?X.message:Xd(X,"message")??"Expand API request failed."}}var PD=(X)=>X.pipe(N.catchAll((J)=>new bd0({detail:ph8(J)})));class Jd extends N.Service()("@expandai/cli/ManualAuthorizationApiClient",{dependencies:[U2.layer,x9.Default],effect:N.gen(function*(){let X=yield*v5.HttpClient,J=yield*x9,Z=(B,H,W)=>new CV({operation:B,kind:H,status:W,recoverable:H!=="invalid_response"}),Q=N.fn("ManualAuthorizationApiClient.create")(function*(B){let H=yield*J.getApiUrl(),W=yield*Z6.post(new URL("/v1/cli-authorization/device",H)).pipe(Z6.bodyJson(B),N.mapError(()=>Z("create","request_failed")));return yield*X.execute(W).pipe(N.flatMap((V)=>V.status>=200&&V.status<300?zJ.schemaBodyJson(kd0)(V).pipe(N.mapError(()=>Z("create","invalid_response"))):N.fail(Z("create","rejected",V.status))),N.catchAll((V)=>V instanceof CV?N.fail(V):N.fail(Z("create","request_failed"))))}),Y=D.Struct({error:D.String,error_description:D.optional(D.String)}),G=new Set(["invalid_target","invalid_client","invalid_scope","unsupported_grant_type","unauthorized_client","invalid_request"]),K=N.fn("ManualAuthorizationApiClient.poll")(function*(B){let H=yield*J.getApiUrl(),W=Z6.post(new URL("/api/auth/oauth2/token",H)).pipe(Z6.bodyUrlParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:$7.value(B),client_id:z2}));return yield*X.execute(W).pipe(N.flatMap(N.fnUntraced(function*(V){if(V.status>=200&&V.status<300)return{_tag:"Tokens",token:yield*zJ.schemaBodyJson(hh8)(V).pipe(N.mapError(()=>Z("poll","invalid_response")))};if(V.status>=500)return yield*Z("poll","rejected",V.status);let U=yield*zJ.schemaBodyJson(Y)(V).pipe(N.mapError(()=>Z("poll","invalid_response")));switch(U.error){case"authorization_pending":return{_tag:"Pending"};case"slow_down":return{_tag:"SlowDown"};case"access_denied":return{_tag:"Denied"};case"expired_token":return{_tag:"Expired"};default:return G.has(U.error)?{_tag:"Refused",error:U.error,...U.error_description===void 0?{}:{description:U.error_description}}:{_tag:"Invalid"}}})),N.catchAll((V)=>V instanceof CV?N.fail(V):N.fail(Z("poll","request_failed"))))});return{create:Q,poll:K}})}){}class BZ extends N.Service()("@expandai/cli/ApiClient",{dependencies:[U2.layer,x9.Default,vz.Default],scoped:N.gen(function*(){let X=yield*x9,J=yield*vz,Z=yield*v5.HttpClient,Q=yield*N.makeSemaphore(1),Y=N.fn("ApiClient.freshOAuthAccessToken")(function*({accessToken:U,expiresAt:O,refreshToken:q}){let L=yield*Q9.now,A=q===void 0?L:Q9.addDuration(L,dh8);if(Q9.lessThan(A,O))return m.some($7.value(U));return m.none()}),G=N.fn("ApiClient.refreshOAuthToken")(function*({refreshToken:U,expiresAt:O,clientId:q}){if(U===void 0)return yield*new om({expiredAt:O});let L=yield*Q9.now,A=yield*J.refreshToken($7.value(U),q);if(A===void 0)return yield*new om({expiredAt:O});let M=Q9.addDuration(L,A.expires_in),x=A.refresh_token===void 0?U:$7.make(A.refresh_token);return yield*X.updateConfig({authMethod:xz.make({accessToken:$7.make(A.access_token),refreshToken:x,expiresAt:M,clientId:q})}),A.access_token}),K=N.fn("ApiClient.oauthBearerToken")(function*(U){let O=yield*Y(U);if(m.isSome(O))return O.value;return yield*Q.withPermits(1)(N.gen(function*(){let{authMethod:q}=yield*X.loadConfig();if(q._tag!=="OAuth")return yield*new yd0({});let L=yield*Y(q);if(m.isSome(L))return L.value;return yield*G(q)}))}),B=()=>N.gen(function*(){let U=yield*N.serviceOption(em).pipe(N.map(m.getOrElse(()=>({})))),O=m.fromNullable(U.authorization);if(m.isSome(O)){let x=yield*X.getApiUrl(),j=x2(Z6.prependUrl(x.toString()),Z6.setHeader("authorization",O.value));return Z.pipe(v5.mapRequest(j))}let{authMethod:q,apiUrl:L}=yield*X.loadConfig(),A=yield*D0.value(q).pipe(D0.tag("ApiKey",({apiKey:x})=>N.succeed(Z6.setHeader("x-expand-api-key",$7.value(x)))),D0.tag("OAuth",(x)=>K(x).pipe(N.map((j)=>Z6.bearerToken(j)))),D0.exhaustive),M=x2(Z6.prependUrl(L.toString()),A);return Z.pipe(v5.mapRequest(M))}),H=()=>B().pipe(N.catchTag("OAuthAuthMethodChanged",()=>B())),W=()=>H().pipe(N.map(Ld0)),V=(U,O)=>Z6.make("POST")("/v1/fetch").pipe(Z6.setUrlParams(O.params.include!==void 0?{include:O.params.include}:{}),(q)=>N.orDie(Z6.bodyJson(q,O.payload)),N.flatMap((q)=>N.flatMap(U.execute(q),zJ.matchStatus({"200":(L)=>L.text,"400":(L)=>Z7(L,Em),"401":(L)=>Z7(L,s4),"403":(L)=>Z7(L,xm),"413":(L)=>Z7(L,JG),"429":(L)=>Z7(L,t4),"500":(L)=>Z7(L,e4),"503":(L)=>Z7(L,XG),orElse:(L)=>zR(q,L)}))));return{fetchFetch:(...U)=>H().pipe(N.flatMap((O)=>V(O,...U).pipe(PD))),fetchFetchResult:(...U)=>H().pipe(N.flatMap((O)=>z70(O,...U).pipe(PD))),fetchFetchJson:(...U)=>H().pipe(N.flatMap((O)=>z70(O,...U).pipe(PD))),fetchFetchSearch:(...U)=>H().pipe(N.flatMap((O)=>Md0(O,...U).pipe(PD))),fetchBatched:(...U)=>W().pipe(N.flatMap((O)=>O.fetchBatched(...U).pipe(PD))),fetchGetBatched:(...U)=>W().pipe(N.flatMap((O)=>O.fetchGetBatched(...U).pipe(PD)))}})}){}var Zd="Open the approval page in your browser, type in the code shown here, and approve. Only enter this code on the Expand approval page your terminal named — never a code someone sent you, and never on a page from a link you did not expect. When you have approved, say so, and the same command will pick the authorization up.",Qd="Authorization complete. That setup code has been consumed and cannot be reused.",Yd="Expand is already authorized. Agent setup is complete.",A70="Expand is authorized, but not every harness could be configured. The harnesses that failed are listed under `failures`; the ones under `installations` are ready to use.",T70="Show these harnesses to the user and ask which to configure. Pass the chosen ones to `expandai init --harnesses`. Harnesses that are not chosen are left untouched.",M70="No supported agent harness was found on this machine. Do not ask the user to choose from an empty list. Tell them Expand supports claude-code, cursor, opencode, and codex, and that setup cannot continue until one of them is installed.",y7=D.Literal("claude-code","cursor","opencode","codex");class Gd extends D.Class("InitDetectionResult")({schemaVersion:D.Literal(1),status:D.Literal("detected"),harnesses:D.Array(y7),current:D.optional(y7),userMessage:D.Literal(T70,M70)}){}var P70=D.NonEmptyArray(y7),lQ=D.Literal("project","global"),lh8=D.Literal("webfetch-hook","runtime-skill","mcp"),nh8=D.Literal("unverified","observed","reload_required","blocked"),qW9=D.Literal("authorization_required","completed"),ih8=D.String.pipe(D.minLength(20),D.maxLength(256)),oh8=D.transform(ih8,D.Redacted(D.String),{strict:!0,decode:(X)=>X,encode:()=>"<redacted-redacted-setup-token>"});class Kd extends D.Class("InitRequest")({harnesses:P70,scope:lQ,setupToken:D.optional(oh8)}){}var rh8=D.Struct({schemaVersion:D.Literal(1),status:D.Literal("authorization_required"),harnesses:P70,scope:lQ,userMessage:D.Literal(Zd),authorization:D.Struct({url:D.URL,userCode:D.String,approvalExpiresAt:D.DateTimeUtc})}),ah8=D.Struct({runtimeState:nh8,nextAction:D.String}),sh8=D.Struct({harness:y7,configured:D.Boolean,changed:D.Boolean,components:D.Array(lh8),version:D.String,verification:ah8}),th8=D.Struct({harness:y7,code:D.String,recoverable:D.Boolean}),eh8=D.Struct({schemaVersion:D.Literal(1),status:D.Literal("completed"),harnesses:P70,scope:lQ,userMessage:D.Literal(Qd,Yd,A70),auth:D.Struct({healthy:D.Boolean}),projectPath:D.optional(D.String),installations:D.NonEmptyArray(sh8),failures:D.optional(D.Array(th8))}),_R=D.Union(rh8,eh8);class IV extends D.Class("InitErrorEnvelope")({schemaVersion:D.Literal(1),status:D.Literal("error"),code:D.String,message:D.String,recoverable:D.Boolean}){}var a7="0.0.5";import{createHash as Xm8}from"node:crypto";var R70=D.parseJson(_D),Jm8=300000,Zm8=D.parseJson(D.Tuple(D.String,D.Literal(z2),D.Literal("agent-harnesses"),D.Literal("project","global"),D.String));function gd0(X,J){return typeof X==="object"&&X!==null&&"code"in X&&X.code===J}function Qm8(X){return X instanceof PY.SystemError&&(X.reason==="AlreadyExists"||gd0(X.cause,"EEXIST"))}function Ym8(X){return D.encodeSync(Zm8)([X.apiOrigin,X.clientId,X.harness,X.scope,X.canonicalScopeRoot])}function hd0(X,J){let Z=X.dirname(J);return Z===J?[J]:[J,...hd0(X,Z)]}class _2 extends N.Service()("@expandai/cli/Auth/PendingInitStore",{dependencies:[RV.layer],effect:N.gen(function*(){let X=yield*zX.FileSystem,J=yield*M6.Path,Z=J.join(yield*dm,"expandai"),Q=J.join(Z,"pending-init"),Y=(P,C)=>new N70({path:P,error:C}),G=(P,C)=>C.pipe(N.mapError((v)=>Y(P,v))),K=N.fnUntraced(function*(P){let C=yield*N.either(X.readLink(P));if(F8.isRight(C))return yield*Y(P,Error("Symbolic links are not allowed for pending authorization"));let v=C.left;if(v instanceof PY.SystemError&&(v.reason==="InvalidData"||v.reason==="NotFound"||v.method==="readLink"&&gd0(v.cause,"EINVAL")))return;return yield*Y(P,v)}),B=N.fnUntraced(function*(){if(yield*K(Z),yield*K(Q),yield*G(Q,X.makeDirectory(Q,{recursive:!0,mode:448})),yield*K(Z),yield*K(Q),(yield*G(Q,X.stat(Q))).type!=="Directory")return yield*Y(Q,Error("Pending authorization path is not a directory"));if(process.platform!=="win32")yield*G(Z,X.chmod(Z,448)),yield*G(Q,X.chmod(Q,448))}),H=(P)=>{let C=Xm8("sha256").update(Ym8(P)).digest("hex");return J.join(Q,`${C}.json`)},W=N.fnUntraced(function*(P,C){let v=yield*D.decode(R70)(C).pipe(N.mapError(()=>new qD({path:P,error:Error("Stored pending authorization did not match the expected schema")})));if(H(v.key)!==P)return yield*new qD({path:P,error:Error("Stored pending authorization key did not match its file")});return v}),V=N.fnUntraced(function*(P){if(yield*K(P),!(yield*G(P,X.exists(P))))return m.none();let v=yield*G(P,X.stat(P));if(v.type!=="File")return yield*Y(P,Error("Pending state is not a regular file"));if(process.platform!=="win32"&&(v.mode&511)!==384)return yield*Y(P,Error("Pending state file mode is not 600"));let f=yield*G(P,X.readFileString(P));return m.some(yield*W(P,f))}),U=(P)=>V(H(P)),O=N.fnUntraced(function*(P){let C=Q9.toEpochMillis(yield*Q9.now);return Q9.toEpochMillis(P.approvalExpiresAt)+Jm8<=C}),q=N.fnUntraced(function*(P){yield*B();let C=H(P.key),v=yield*D.encode(R70)(P).pipe(N.mapError((s)=>Y(C,s))),f=yield*N.either(N.scoped(N.gen(function*(){let s=yield*X.open(C,{flag:"wx",mode:384});yield*s.writeAll(new TextEncoder().encode(v)),yield*s.sync})));if(F8.isLeft(f)){if(Qm8(f.left))return!1;return yield*X.remove(C).pipe(N.ignore),yield*Y(C,f.left)}if(process.platform!=="win32"){let s=yield*N.either(X.chmod(C,384));if(F8.isLeft(s))return yield*X.remove(C).pipe(N.ignore),yield*Y(C,s.left)}return!0}),L=N.fn("PendingInitStore.replaceIfMatch")(function*(P,C){yield*B();let v=H(C.key);if(H(P.key)!==v)return yield*Y(v,Error("Pending authorization replacement changed its key"));let f=yield*V(v);if(m.isNone(f)||f.value.userCode!==P.userCode)return!1;let s=yield*D.encode(R70)(C).pipe(N.mapError((b)=>Y(v,b))),l=`${v}.${process.pid}.${Math.random().toString(36).slice(2,10)}.tmp`,W0=yield*N.scoped(N.acquireRelease(N.succeed(l),()=>X.remove(l).pipe(N.ignore)).pipe(N.zipRight(N.gen(function*(){yield*K(l),yield*N.scoped(N.gen(function*(){let b=yield*X.open(l,{flag:"wx",mode:384});yield*b.writeAll(new TextEncoder().encode(s)),yield*b.sync})),yield*X.rename(l,v)})))).pipe(N.either);if(F8.isLeft(W0))return yield*Y(v,W0.left);return!0}),A=N.fnUntraced(function*(P){let C=H(P.key),v=yield*V(C);if(m.isNone(v)||v.value.userCode!==P.userCode)return!1;return yield*G(C,X.remove(C)),!0}),M=N.fn("PendingInitStore.get")(function*(P){let C=yield*U(P);if(m.isNone(C)||!(yield*O(C.value)))return C;return yield*A(C.value),m.none()}),x=N.fn("PendingInitStore.peek")(function*(P){return yield*U(P)}),j=N.fn("PendingInitStore.putIfAbsent")(function*(P){let C=yield*U(P.key);if(m.isSome(C)&&!(yield*O(C.value)))return C.value;if(m.isSome(C))yield*A(C.value);if(yield*q(P))return P;let v=yield*U(P.key);return yield*m.match(v,{onNone:()=>Y(H(P.key),Error("Pending record creation lost without a winner")),onSome:N.succeed})}),T=N.fn("PendingInitStore.removeIfMatch")((P)=>A(P)),E=N.fn("PendingInitStore.pruneExpired")(function*(){if(yield*K(Q),!(yield*G(Q,X.exists(Q))))return 0;let C=yield*G(Q,X.readDirectory(Q));return(yield*N.forEach(C.filter((f)=>f.endsWith(".json")),(f)=>N.gen(function*(){let s=yield*V(J.join(Q,f));if(m.isNone(s)||!(yield*O(s.value)))return 0;return(yield*A(s.value))?1:0}).pipe(N.orElseSucceed(()=>0)))).reduce((f,s)=>f+s,0)}),k=N.fn("PendingInitStore.canonicalScopeRoot")(function*(P,C=process.cwd()){if(P==="global")return"global";let v=yield*G(C,X.realPath(C)),s=(yield*N.forEach(hd0(J,v),(l)=>G(l,X.exists(J.join(l,".git"))).pipe(N.map((W0)=>({candidate:l,exists:W0}))))).find(({exists:l})=>l)?.candidate;return s===void 0?v:yield*G(s,X.realPath(s))});return{pendingPath:Q,get:M,peek:x,putIfAbsent:j,replaceIfMatch:L,removeIfMatch:T,pruneExpired:E,canonicalScopeRoot:k}})}){}var md0=z2,Gm8=5;class j70 extends D.Class("ManualAuthorizationInput")({harness:D.Literal("agent-harnesses"),scope:lQ,cwd:D.optional(D.String),platform:D.optional(D.String)}){}class C70 extends D.Class("ManualAuthorizationRequired")({verificationUri:D.String,userCode:D.NonEmptyString,approvalExpiresAt:D.DateTimeUtc}){}class I70 extends D.TaggedClass()("TokensSaved",{}){}class EV extends D.TaggedClass()("AuthorizationPending",{pending:C70}){}var kW9=D.Union(I70,EV);class kz extends D.TaggedError()("ManualAuthorizationDenied",{recoverable:D.Literal(!0)}){get message(){return"The authorization request was denied in the browser. Run the same command again to start a new one."}}class bz extends D.TaggedError()("ManualAuthorizationRefused",{error:D.String,description:D.optional(D.String),recoverable:D.Literal(!1)}){get message(){let X=this.description===void 0?"":` — ${this.description}`;return`Expand refused to complete this authorization: ${this.error}${X}. This is a server-side configuration problem, not something a new code can fix. Do not start setup again; report this error.`}}class jD extends D.TaggedError()("ManualAuthorizationCredentialSaveFailed",{recoverable:D.Literal(!1)}){get message(){return"Authorization succeeded, but credentials could not be saved. Start authorization again."}}function dd0(X){return X.platform??process.platform}function RD(X){return new C70({verificationUri:X.verificationUri,userCode:X.userCode,approvalExpiresAt:X.approvalExpiresAt})}class q2 extends N.Service()("@expandai/cli/Auth/ManualAuthorization",{dependencies:[x9.Default,_2.Default,Jd.Default],effect:N.gen(function*(){let X=yield*x9,J=yield*_2,Z=yield*Jd,Q=N.fnUntraced(function*(W){yield*X.ensureSecureStorage(),yield*J.pruneExpired();let V=yield*X.getApiUrl(),U=yield*J.canonicalScopeRoot(W.scope,W.cwd);return{apiOrigin:V.origin,clientId:md0,harness:W.harness,scope:W.scope,canonicalScopeRoot:U}}),Y=N.fnUntraced(function*(W,V){let U=yield*Z.create({harness:W.harness,scope:W.scope,platform:dd0(W),machineLabel:`${dd0(W)}-${process.arch}`,cliVersion:a7}),O=yield*Q9.now,q=new _D({key:V,deviceCode:U.deviceCode,userCode:U.userCode,verificationUri:U.verificationUri.toString(),intervalSeconds:U.interval,nextPollAt:Q9.addDuration(O,r9.seconds(U.interval)),approvalExpiresAt:Q9.addDuration(O,r9.seconds(U.expiresIn))}),L=yield*N.either(J.putIfAbsent(q));if(F8.isLeft(L))return yield*L.left;return L.right}),G=N.fnUntraced(function*(W){let V=yield*Q9.now,U=yield*N.either(X.updateConfig({authMethod:xz.make({accessToken:W.access_token,refreshToken:W.refresh_token,expiresAt:Q9.addDuration(V,r9.seconds(W.expires_in)),clientId:md0})}));if(F8.isLeft(U))return yield*new jD({recoverable:!1})}),K=N.fnUntraced(function*(W,V){let U=yield*Q9.now,O=W.intervalSeconds+(V?Gm8:0),q=new _D({...W,intervalSeconds:O,nextPollAt:Q9.addDuration(U,r9.seconds(O))}),L=yield*N.either(J.replaceIfMatch(W,q));if(F8.isLeft(L))return W;return L.right?q:W}),B=N.fn("ManualAuthorization.advance")(function*(W){let V=yield*Q(W),U=yield*J.get(V);if(m.isNone(U)){let A=yield*Y(W,V);return new EV({pending:RD(A)})}let O=U.value,q=yield*Q9.now;if(Q9.greaterThan(q,O.approvalExpiresAt)){yield*J.removeIfMatch(O);let A=yield*Y(W,V);return new EV({pending:RD(A)})}if(Q9.lessThan(q,O.nextPollAt))return new EV({pending:RD(O)});let L=yield*Z.poll(O.deviceCode);switch(L._tag){case"Tokens":return yield*G(L.token),yield*J.removeIfMatch(O),new I70;case"Pending":{let A=yield*K(O,!1);return new EV({pending:RD(A)})}case"SlowDown":{let A=yield*K(O,!0);return new EV({pending:RD(A)})}case"Denied":return yield*J.removeIfMatch(O),yield*new kz({recoverable:!0});case"Refused":return yield*new bz({error:L.error,...L.description===void 0?{}:{description:L.description},recoverable:!1});case"Expired":case"Invalid":{yield*J.removeIfMatch(O);let A=yield*Y(W,V);return new EV({pending:RD(A)})}}}),H=N.fn("ManualAuthorization.redeemPreApproved")(function*(W){let V=yield*Z.poll(W);switch(V._tag){case"Tokens":return yield*G(V.token);case"Denied":return yield*new kz({recoverable:!0});case"Refused":return yield*new bz({error:V.error,...V.description===void 0?{}:{description:V.description},recoverable:!1});case"Pending":case"SlowDown":case"Expired":case"Invalid":return yield*new CV({operation:"poll",kind:"rejected",status:400,recoverable:!1})}});return{advance:B,redeemPreApproved:H}})}){}class Bd extends D.TaggedError()("SetupGrantAuthorizationError",{code:D.Literal("invalid_or_expired","stored_credential_conflict","request_failed","denied","credential_save_failed","refused","config_unreadable"),recoverable:D.Boolean}){get message(){switch(this.code){case"stored_credential_conflict":return"An Expand API key is already stored on this machine, and completing this setup would replace it with no way to recover it. Nothing was changed and your setup prompt is still valid. Run `expandai logout` to clear the stored key, then run this setup command again.";case"request_failed":return"Could not reach Expand to redeem the setup token. Nothing was sent, so the same token is still good — check the network and try again.";case"denied":return"This setup authorization was denied. Copy a fresh setup prompt from the Expand dashboard.";case"config_unreadable":return"The Expand config file on this machine could not be read, so setup cannot tell whether completing it would overwrite an existing API key. Nothing was redeemed and your setup prompt is still valid. Run `expandai whoami` to see which file it is, fix or delete it, then run this setup command again.";case"refused":return"Expand refused to redeem this setup token for a reason a fresh prompt cannot fix — most likely an OAuth client, resource, or scope misconfiguration on the server. Do not request another prompt; report this.";case"credential_save_failed":return"The setup token was redeemed, but the credentials could not be saved on this machine. Fix credential storage — run `expandai whoami` to see the path it uses, and check its permissions — then copy a fresh setup prompt from the Expand dashboard.";default:return"The setup token is invalid, expired, or already used. Copy a fresh setup prompt from the Expand dashboard."}}}function yz(X){return new Bd({code:X,recoverable:X!=="denied"&&X!=="credential_save_failed"&&X!=="refused"})}class CD extends N.Service()("@expandai/cli/Auth/SetupGrantAuthorization",{dependencies:[x9.Default,q2.Default],effect:N.gen(function*(){let X=yield*x9,J=yield*q2;return{authorize:N.fn("SetupGrantAuthorization.authorize")(function*(Q){let Y=yield*X.readConfigFile();if(Y.parseFailed)return yield*yz("config_unreadable");if(Y.config.authMethod?._tag==="ApiKey")return yield*yz("stored_credential_conflict");yield*N.annotateCurrentSpan({harness:Q.harness,scope:Q.scope}),yield*J.redeemPreApproved(Q.setupToken).pipe(N.mapError((G)=>{if(G instanceof kz)return yz("denied");if(G instanceof jD)return yz("credential_save_failed");if(G instanceof bz)return yz("refused");if(G._tag==="ManualAuthorizationApiError"&&G.kind==="request_failed")return yz("request_failed");return yz("invalid_or_expired")}))})}})}){}import c70 from"node:process";import Yu0 from"node:path";import{fileURLToPath as ym8}from"node:url";import gm8 from"node:child_process";import hm8,{constants as mm8}from"node:fs/promises";import{promisify as Om8}from"node:util";import _m8 from"node:child_process";import b70,{constants as id0}from"node:fs/promises";import fd0 from"node:process";import Vm8 from"node:os";import v70 from"node:fs";import Hm8 from"node:fs";import ud0 from"node:fs";var E70;function Km8(){try{return ud0.statSync("/.dockerenv"),!0}catch{return!1}}function Bm8(){try{return ud0.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function S70(){if(E70===void 0)E70=Km8()||Bm8();return E70}var x70,Wm8=()=>{try{return Hm8.statSync("/run/.containerenv"),!0}catch{return!1}};function gz(){if(x70===void 0)x70=Wm8()||S70();return x70}var cd0=()=>{if(fd0.platform!=="linux")return!1;if(Vm8.release().toLowerCase().includes("microsoft")){if(gz())return!1;return!0}try{if(v70.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft"))return!gz()}catch{}if(v70.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")||v70.existsSync("/run/WSL"))return!gz();return!1},D2=fd0.env.__IS_WSL_TEST__?cd0:cd0();import pd0 from"node:process";import{Buffer as $m8}from"node:buffer";import{promisify as Um8}from"node:util";import zm8 from"node:child_process";var Nm8=Um8(zm8.execFile),k70=()=>`${pd0.env.SYSTEMROOT||pd0.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;var b5=async(X,J={})=>{let{powerShellPath:Z,...Q}=J,Y=b5.encodeCommand(X);return Nm8(Z??k70(),[...b5.argumentsPrefix,Y],{encoding:"utf8",...Q})};b5.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];b5.encodeCommand=(X)=>$m8.from(X,"utf16le").toString("base64");b5.escapeArgument=(X)=>`'${String(X).replaceAll("'","''")}'`;function ld0(X){for(let J of X.split(`
292
+ `)){if(/^\s*#/.test(J))continue;let Z=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(J);if(!Z)continue;return Z.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}var qm8=Om8(_m8.execFile),Dm8=(()=>{let J;return async function(){if(J)return J;let Z="/etc/wsl.conf",Q=!1;try{await b70.access(Z,id0.F_OK),Q=!0}catch{}if(!Q)return"/mnt/";let Y=await b70.readFile(Z,{encoding:"utf8"}),G=ld0(Y);if(G===void 0)return"/mnt/";return J=G,J=J.endsWith("/")?J:`${J}/`,J}})(),wm8=async()=>{return`${await Dm8()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`},Hd=D2?wm8:k70,nd0,od0=async()=>{return nd0??=(async()=>{try{let X=await Hd();return await b70.access(X,id0.X_OK),!0}catch{return!1}})(),nd0},rd0=async()=>{let X=await Hd(),J=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:Z}=await b5(J,{powerShellPath:X});return Z.trim()},ad0=async(X)=>{if(/^[a-z]+:\/\//i.test(X))return X;try{let{stdout:J}=await qm8("wslpath",["-aw",X],{encoding:"utf8"});return J.trim()}catch{return X}};function hz(X,J,Z){let Q=(Y)=>Object.defineProperty(X,J,{value:Y,enumerable:!0,writable:!0});return Object.defineProperty(X,J,{configurable:!0,enumerable:!0,get(){let Y=Z();return Q(Y),Y},set(Y){Q(Y)}}),X}import{promisify as Sm8}from"node:util";import m70 from"node:process";import{execFile as xm8}from"node:child_process";import{promisify as Lm8}from"node:util";import Fm8 from"node:process";import{execFile as Am8}from"node:child_process";var Tm8=Lm8(Am8);async function y70(){if(Fm8.platform!=="darwin")throw Error("macOS only");let{stdout:X}=await Tm8("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),Z=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(X)?.groups.id??"com.apple.Safari";if(Z==="com.apple.safari")return"com.apple.Safari";return Z}import Mm8 from"node:process";import{promisify as Pm8}from"node:util";import{execFile as Rm8,execFileSync as LV9}from"node:child_process";var jm8=Pm8(Rm8);async function sd0(X,{humanReadableOutput:J=!0,signal:Z}={}){if(Mm8.platform!=="darwin")throw Error("macOS only");let Q=J?[]:["-ss"],Y={};if(Z)Y.signal=Z;let{stdout:G}=await jm8("osascript",["-e",X,Q],Y);return G.trim()}async function g70(X){return sd0(`tell application "Finder" to set app_path to application file id "${X}" as string
293
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as Cm8}from"node:util";import{execFile as Im8}from"node:child_process";var Em8=Cm8(Im8),Wd={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},Vd=new Map(Object.entries(Wd));class td0 extends Error{}async function h70(X=Em8){let{stdout:J}=await X("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),Z=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(J);if(!Z)throw new td0(`Cannot find Windows browser in stdout: ${JSON.stringify(J)}`);let{id:Q}=Z.groups,Y=Q.lastIndexOf("."),G=Q.lastIndexOf("-"),K=Y===-1?void 0:Q.slice(0,Y),B=G===-1?void 0:Q.slice(0,G);return Wd[Q]??Wd[K]??Wd[B]??{name:Q,id:Q}}var vm8=Sm8(xm8),km8=(X)=>X.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,(J)=>J.toUpperCase());async function d70(){if(m70.platform==="darwin"){let X=await y70();return{name:await g70(X),id:X}}if(m70.platform==="linux"){let{stdout:X}=await vm8("xdg-mime",["query","default","x-scheme-handler/http"]),J=X.trim();return{name:km8(J.replace(/.desktop$/,"").replace("-"," ")),id:J}}if(m70.platform==="win32")return h70();throw Error("Only macOS, Linux, and Windows are supported")}import u70 from"node:process";var bm8=Boolean(u70.env.SSH_CONNECTION||u70.env.SSH_CLIENT||u70.env.SSH_TTY),ed0=bm8;var $d=Symbol("fallbackAttempt"),f70=import.meta.url?Yu0.dirname(ym8(import.meta.url)):"",Xu0=Yu0.join(f70,"xdg-open"),{platform:ID,arch:Ju0}=c70,Zu0=async(X,J)=>{if(X.length===0)return;let Z=[];for(let Q of X)try{return await J(Q)}catch(Y){Z.push(Y)}throw AggregateError(Z,"Failed to open in all supported apps")},Ud=async(X)=>{X={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...X};let J=X[$d]===!0;if(delete X[$d],Array.isArray(X.app))return Zu0(X.app,(W)=>Ud({...X,app:W,[$d]:!0}));let{name:Z,arguments:Q=[]}=X.app??{};if(Q=[...Q],Array.isArray(Z))return Zu0(Z,(W)=>Ud({...X,app:{name:W,arguments:Q},[$d]:!0}));if(Z==="browser"||Z==="browserPrivate"){let W={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},V={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},U;if(D2){let O=await rd0();U=Vd.get(O)??{}}else U=await d70();if(U.id in W){let O=W[U.id.toLowerCase()];if(Z==="browserPrivate"){if(O==="safari")throw Error("Safari doesn't support opening in private mode via command line");Q.push(V[O])}return Ud({...X,app:{name:ED[O],arguments:Q}})}throw Error(`${U.name} is not supported as a default browser`)}let Y,G=[],K={},B=!1;if(D2&&!gz()&&!ed0&&!Z)B=await od0();if(ID==="darwin"){if(Y="open",X.wait)G.push("--wait-apps");if(X.background)G.push("--background");if(X.newInstance)G.push("--new");if(Z)G.push("-a",Z)}else if(ID==="win32"||B){if(Y=await Hd(),G.push(...b5.argumentsPrefix),!D2)K.windowsVerbatimArguments=!0;if(D2&&X.target)X.target=await ad0(X.target);let W=["$ProgressPreference = 'SilentlyContinue';","Start"];if(X.wait)W.push("-Wait");if(Z){if(W.push(b5.escapeArgument(Z)),X.target)Q.push(X.target)}else if(X.target)W.push(b5.escapeArgument(X.target));if(Q.length>0)Q=Q.map((V)=>b5.escapeArgument(V)),W.push("-ArgumentList",Q.join(","));if(X.target=b5.encodeCommand(W.join(" ")),!X.wait)K.stdio="ignore"}else{if(Z)Y=Z;else{let W=!f70||f70==="/",V=!1;try{await hm8.access(Xu0,mm8.X_OK),V=!0}catch{}Y=c70.versions.electron??(ID==="android"||W||!V)?"xdg-open":Xu0}if(Q.length>0)G.push(...Q);if(!X.wait)K.stdio="ignore",K.detached=!0}if(ID==="darwin"&&Q.length>0)G.push("--args",...Q);if(X.target)G.push(X.target);let H=gm8.spawn(Y,G,K);if(X.wait)return new Promise((W,V)=>{H.once("error",V),H.once("close",(U)=>{if(!X.allowNonzeroExitCode&&U!==0){V(Error(`Exited with code ${U}`));return}W(H)})});if(J)return new Promise((W,V)=>{H.once("error",V),H.once("spawn",()=>{H.once("close",(U)=>{if(H.off("error",V),U!==0){V(Error(`Exited with code ${U}`));return}H.unref(),W(H)})})});return H.unref(),new Promise((W,V)=>{H.once("error",V),H.once("spawn",()=>{H.off("error",V),W(H)})})},dm8=(X,J)=>{if(typeof X!=="string")throw TypeError("Expected a `target`");return Ud({...J,target:X})};function Qu0(X){if(typeof X==="string"||Array.isArray(X))return X;let{[Ju0]:J}=X;if(!J)throw Error(`${Ju0} is not supported`);return J}function qR({[ID]:X},{wsl:J}={}){if(J&&D2)return Qu0(J);if(!X)throw Error(`${ID} is not supported`);return Qu0(X)}var ED={browser:"browser",browserPrivate:"browserPrivate"};hz(ED,"chrome",()=>qR({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));hz(ED,"brave",()=>qR({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));hz(ED,"firefox",()=>qR({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));hz(ED,"edge",()=>qR({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));hz(ED,"safari",()=>qR({darwin:"Safari"}));var Gu0=dm8;import{homedir as fm8}from"node:os";var Ku0=new URL("../",import.meta.url),SD=new URL("skills/expandai/",Ku0),Bu0=new URL("assets/opencode/expandai-webfetch.js",Ku0);class a3 extends D.TaggedError()("McpParseError",{path:D.String,error:D.Defect}){get message(){return`Failed to parse MCP config at ${this.path}: ${T9.format(this.error)}`}}class BK extends D.TaggedError()("McpWriteError",{path:D.String,error:D.Defect}){get message(){return`Failed to write MCP config at ${this.path}: ${T9.format(this.error)}`}}var Nd=D.Literal("claude-code","cursor","opencode","codex"),Vu0=D.Literal(...Nd.literals,"unknown"),p70=D.Literal("project","global"),zd=D.Record({key:D.String,value:D.Unknown}),w2=D.parseJson(D.Struct({mcpServers:D.optionalWith(zd,{default:()=>({})})},zd),{space:2}),l70=D.parseJson(D.Struct({mcp:D.optionalWith(zd,{default:()=>({})})},zd),{space:2}),Q6="expandai",DR={command:"expandai",args:[]},um8={command:"npx",args:["-y","expandai"]};var Hu0=N.gen(function*(){let X=yield*zX.FileSystem,J=yield*M6.Path,Z=yield*P0.string("PATH").pipe(P0.withDefault(""));return{resolve:N.fn("CliInvocation.resolve")(function*(){return(yield*N.exists(H8.filter(Z.split(":"),_X.isNonEmpty),(G)=>X.exists(J.join(G,"expandai")).pipe(N.orElseSucceed(()=>!1))))?DR:um8})}});class nQ extends N.Service()("@expandai/cli/Install/CliInvocation",{dependencies:[KZ.layer,_Q.layer],effect:Hu0}){static layer=C8.effect(nQ,Hu0.pipe(N.map(nQ.make)))}var cm8=N.fn(function*(X){let J=yield*zX.FileSystem;if(!(yield*J.exists(X)))return"{}";return yield*J.readFileString(X)}),Wu0=N.fn(function*(X,J){let Z=yield*zX.FileSystem,Q=yield*M6.Path;yield*Z.makeDirectory(Q.dirname(X),{recursive:!0}),yield*Z.writeFileString(X,`${J}
294
+ `)});class iQ extends N.Service()("@expandai/cli/Install/ConfigIo",{dependencies:[KZ.layer,_Q.layer],effect:N.gen(function*(){let X=yield*zX.FileSystem,J=yield*M6.Path,Z=N.fn("ConfigIo.read")(function*(B,H){let W=yield*cm8(B).pipe(N.provideService(zX.FileSystem,X));return yield*D.decode(H)(W)}),Q=N.fn("ConfigIo.write")(function*(B,H,W){let V=yield*D.encodeUnknown(W)(H);yield*Wu0(B,V).pipe(N.provideService(zX.FileSystem,X),N.provideService(M6.Path,J))}),Y=N.fn("ConfigIo.exists")(function*(B){return yield*X.exists(B)}),G=N.fn("ConfigIo.readText")(function*(B){return(yield*X.exists(B))?yield*X.readFileString(B):""}),K=N.fn("ConfigIo.writeText")(function*(B,H){yield*Wu0(B,H).pipe(N.provideService(zX.FileSystem,X),N.provideService(M6.Path,J))});return{read:Z,write:Q,exists:Y,readText:G,writeText:K}})}){}class s3 extends N.Service()("@expandai/cli/Install/SkillIo",{dependencies:[KZ.layer,_Q.layer],effect:N.gen(function*(){let X=yield*zX.FileSystem,J=yield*M6.Path,Z=yield*J.fromFileUrl(SD),Q=N.fn("SkillIo.install")(function*(K){return yield*X.makeDirectory(J.dirname(K),{recursive:!0}),yield*X.copy(Z,K,{overwrite:!0}),K}),Y=N.fn("SkillIo.uninstall")(function*(K){if(yield*X.exists(K))yield*X.remove(K,{recursive:!0});return K}),G=N.fn("SkillIo.isCurrent")(function*(K){let B=J.join(K,"SKILL.md");if(!(yield*X.exists(B)))return!1;let[H,W]=yield*N.all([X.readFileString(B),X.readFileString(J.join(Z,"SKILL.md"))]);return H===W});return{install:Q,uninstall:Y,isCurrent:G}})}){}var pm8=D.Struct({type:D.Literal("command"),command:D.String,expandaiProfileVersion:D.optional(D.String),expandaiManagedDeny:D.optional(D.Boolean)},D.Record({key:D.String,value:D.Unknown})),lm8=D.Struct({matcher:D.optional(D.String),hooks:D.Array(pm8)},D.Record({key:D.String,value:D.Unknown})),nm8=D.Struct({PreToolUse:D.optional(D.Array(lm8))},D.Record({key:D.String,value:D.Unknown})),im8=D.Struct({deny:D.optional(D.Array(D.String))},D.Record({key:D.String,value:D.Unknown})),$u0=D.parseJson(D.Struct({hooks:D.optionalWith(nm8,{default:()=>({})}),permissions:D.optional(im8)},D.Record({key:D.String,value:D.Unknown})),{space:2});class Od extends N.Service()("@expandai/cli/Install/Claude/Hook",{dependencies:[iQ.Default],effect:N.gen(function*(){let X=yield*P0.string("HOME").pipe(P0.withDefault(fm8())),J=yield*P0.string("PWD").pipe(P0.withDefault(process.cwd())),Z=N.fn(function*(K){return yield*D0.value(K).pipe(D0.when("global",()=>N.succeed(`${X}/.claude/settings.json`)),D0.when("project",()=>N.succeed(`${J}/.claude/settings.json`)),D0.exhaustive)}),Q="expandai does not install a WebFetch hook for Claude Code — the MCP server and runtime skill replace it, and neither can disable a built-in tool.",Y=N.fn("ClaudeHook.install")(function*(K){yield*_8.log("expandai does not install a WebFetch hook for Claude Code — the MCP server and runtime skill replace it, and neither can disable a built-in tool.")}),G=N.fn("ClaudeHook.uninstall")(function*(K){yield*_8.log("expandai does not install a WebFetch hook for Claude Code — the MCP server and runtime skill replace it, and neither can disable a built-in tool.")});return{install:Y,uninstall:G,pathFor:Z}})}){}import{homedir as om8}from"node:os";class zu0 extends D.Class("ClaudeMcpEntry")({type:D.Literal("stdio"),command:D.NonEmptyTrimmedString,args:D.Array(D.String),env:D.optional(D.Record({key:D.String,value:D.String}))}){}var rm8=["mcp","run"];function Nu0(X=DR){return new zu0({type:"stdio",command:X.command,args:[...X.args,...rm8],env:{EXPANDAI_HARNESS:"claude-code"}})}var W$9=Nu0();function Uu0(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}function am8(X,J){if(!Uu0(X))return!1;let{args:Z,env:Q}=X;return X.type===J.type&&X.command===J.command&&Array.isArray(Z)&&Z.length===J.args.length&&Z.every((Y,G)=>Y===J.args[G])&&Uu0(Q)&&Q.EXPANDAI_HARNESS==="claude-code"}function _d(X,J=DR){let Z=Nu0(J);if(am8(X.mcpServers[Q6],Z))return{changed:!1,config:X};return{changed:!0,config:{...X,mcpServers:{...X.mcpServers,[Q6]:Z}}}}function sm8(X){if(!(Q6 in X.mcpServers))return{changed:!1,config:X};return{changed:!0,config:{...X,mcpServers:XY.remove(X.mcpServers,Q6)}}}class qd extends N.Service()("@expandai/cli/Install/Claude/Mcp",{dependencies:[iQ.Default],effect:N.gen(function*(){let X=yield*iQ,J=yield*P0.string("HOME").pipe(P0.withDefault(om8())),Z=yield*P0.string("PWD").pipe(P0.withDefault(process.cwd())),Q=N.fn(function*(W){return yield*D0.value(W).pipe(D0.when("global",()=>N.succeed(`${J}/.claude.json`)),D0.when("project",()=>N.succeed(`${Z}/.mcp.json`)),D0.exhaustive)}),Y=N.fn(function*(W){return yield*X.read(W,w2).pipe(N.mapError((V)=>new a3({path:W,error:V})))}),G=N.fn(function*(W,V){yield*X.write(W,V,w2).pipe(N.mapError((U)=>new BK({path:W,error:U})))}),K=N.fn(function*(W){let V=yield*Q(W),U=_d(yield*Y(V));if(U.changed)yield*G(V,U.config);yield*_8.log(`Installed expandai MCP server into ${V}`)}),B=N.fn(function*(W){let V=yield*Q(W),U=sm8(yield*Y(V));if(!U.changed)return;yield*G(V,U.config),yield*_8.log(`Removed expandai MCP server from ${V}`)}),H=N.fn(function*(W){let V=yield*Q(W);return Q6 in(yield*Y(V)).mcpServers});return{install:K,uninstall:B,isInstalled:H,pathFor:Q}})}){}import{homedir as Vd8}from"node:os";/*!
295
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
296
+ * SPDX-License-Identifier: BSD-3-Clause
297
+ *
298
+ * Redistribution and use in source and binary forms, with or without
299
+ * modification, are permitted provided that the following conditions are met:
300
+ *
301
+ * 1. Redistributions of source code must retain the above copyright notice, this
302
+ * list of conditions and the following disclaimer.
303
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
304
+ * this list of conditions and the following disclaimer in the
305
+ * documentation and/or other materials provided with the distribution.
306
+ * 3. Neither the name of the copyright holder nor the names of its contributors
307
+ * may be used to endorse or promote products derived from this software without
308
+ * specific prior written permission.
309
+ *
310
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
311
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
312
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
313
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
314
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
315
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
316
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
317
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
318
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
319
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
320
+ */var tm8=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class SV extends Date{#J=!1;#Z=!1;#X=null;constructor(X){let J=!0,Z=!0,Q="Z";if(typeof X==="string"){let Y=X.match(tm8);if(Y){if(!Y[1])J=!1,X=`0000-01-01T${X}`;if(Z=!!Y[2],Z&&X[10]===" "&&(X=X.replace(" ","T")),Y[2]&&+Y[2]>23)X="";else if(Q=Y[3]||null,X=X.toUpperCase(),!Q&&Z)X+="Z"}else X=""}super(X);if(!isNaN(this.getTime()))this.#J=J,this.#Z=Z,this.#X=Q}isDateTime(){return this.#J&&this.#Z}isLocal(){return!this.#J||!this.#Z||!this.#X}isDate(){return this.#J&&!this.#Z}isTime(){return this.#Z&&!this.#J}isValid(){return this.#J||this.#Z}toISOString(){let X=super.toISOString();if(this.isDate())return X.slice(0,10);if(this.isTime())return X.slice(11,23);if(this.#X===null)return X.slice(0,-1);if(this.#X==="Z")return X;let J=+this.#X.slice(1,3)*60+ +this.#X.slice(4,6);return J=this.#X[0]==="-"?J:-J,new Date(this.getTime()-J*60000).toISOString().slice(0,-1)+this.#X}static wrapAsOffsetDateTime(X,J="Z"){let Z=new SV(X);return Z.#X=J,Z}static wrapAsLocalDateTime(X){let J=new SV(X);return J.#X=null,J}static wrapAsLocalDate(X){let J=new SV(X);return J.#Z=!1,J.#X=null,J}static wrapAsLocalTime(X){let J=new SV(X);return J.#J=!1,J.#X=null,J}}/*!
321
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
322
+ * SPDX-License-Identifier: BSD-3-Clause
323
+ *
324
+ * Redistribution and use in source and binary forms, with or without
325
+ * modification, are permitted provided that the following conditions are met:
326
+ *
327
+ * 1. Redistributions of source code must retain the above copyright notice, this
328
+ * list of conditions and the following disclaimer.
329
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
330
+ * this list of conditions and the following disclaimer in the
331
+ * documentation and/or other materials provided with the distribution.
332
+ * 3. Neither the name of the copyright holder nor the names of its contributors
333
+ * may be used to endorse or promote products derived from this software without
334
+ * specific prior written permission.
335
+ *
336
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
337
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
338
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
339
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
340
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
341
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
342
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
343
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
344
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
345
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
346
+ */function em8(X,J){let Z=X.slice(0,J).split(/\r\n|\n|\r/g);return[Z.length,Z.pop().length+1]}function Xd8(X,J,Z){let Q=X.split(/\r\n|\n|\r/g),Y="",G=(Math.log10(J+1)|0)+1;for(let K=J-1;K<=J+1;K++){let B=Q[K-1];if(!B)continue;if(Y+=K.toString().padEnd(G," "),Y+=": ",Y+=B,Y+=`
347
+ `,K===J)Y+=" ".repeat(G+Z+2),Y+=`^
348
+ `}return Y}class v9 extends Error{line;column;codeblock;constructor(X,J){let[Z,Q]=em8(J.toml,J.ptr),Y=Xd8(J.toml,Z,Q);super(`Invalid TOML document: ${X}
349
+
350
+ ${Y}`,J);this.line=Z,this.column=Q,this.codeblock=Y}}/*!
351
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
352
+ * SPDX-License-Identifier: BSD-3-Clause
353
+ *
354
+ * Redistribution and use in source and binary forms, with or without
355
+ * modification, are permitted provided that the following conditions are met:
356
+ *
357
+ * 1. Redistributions of source code must retain the above copyright notice, this
358
+ * list of conditions and the following disclaimer.
359
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
360
+ * this list of conditions and the following disclaimer in the
361
+ * documentation and/or other materials provided with the distribution.
362
+ * 3. Neither the name of the copyright holder nor the names of its contributors
363
+ * may be used to endorse or promote products derived from this software without
364
+ * specific prior written permission.
365
+ *
366
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
367
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
368
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
369
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
370
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
371
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
372
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
373
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
374
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
375
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
376
+ */var Jd8=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,Zd8=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,Qd8=/^[+-]?0[0-9_]/;function Dd(X,J){let Z=X[J++],Q=Z,Y=Z==="'",G=Z===X[J]&&Z===X[J+1];if(G){if(X[J+=2]===`
377
+ `)J++;else if(X[J]==="\r"&&X[J+1]===`
378
+ `)J+=2}let K="",B=J,H=0;for(let W=J;W<X.length;W++)if(Z=X[W],G&&(Z===`
379
+ `||Z==="\r"&&X[W+1]===`
380
+ `))H=H&&3;else if(Z<" "&&Z!=="\t"||Z==="")throw new v9("control characters are not allowed in strings",{toml:X,ptr:W});else if((!H||H===3)&&Z===Q&&(!G||X[W+1]===Q&&X[W+2]===Q)){if(G){if(X[W+3]===Q)W++;if(X[W+3]===Q)W++}return[H?K:K+X.slice(B,W),W+(G?3:1)]}else if(!H){if(!Y&&Z==="\\")K+=X.slice(B,B=W),H=1}else if(H===1)if(Z==="x"||Z==="u"||Z==="U"){let V=0,U=Z==="x"?2:Z==="u"?4:8;for(let O=0;O<U;O++,W++){let q=X.charCodeAt(W+1),L=q>=48&&q<=57?q-48:q>=65&&q<=70?q-65+10:q>=97&&q<=102?q-97+10:-1;if(L<0)throw new v9("invalid non-hex character in unicode escape",{toml:X,ptr:W+1});V=V<<4|L}if(V<0||V>1114111||V>=55296&&V<=57343)throw new v9("invalid unicode escape",{toml:X,ptr:W});K+=String.fromCodePoint(V),B=W+1,H=0}else if(Z===" "||Z==="\t")H=2;else{if(Z==="b")K+="\b";else if(Z==="t")K+="\t";else if(Z==="n")K+=`
381
+ `;else if(Z==="f")K+="\f";else if(Z==="r")K+="\r";else if(Z==="e")K+="\x1B";else if(Z==='"')K+='"';else if(Z==="\\")K+="\\";else throw new v9("unrecognized escape sequence",{toml:X,ptr:W});B=W+1,H=0}else if(Z!==" "&&Z!=="\t"){if(H===2)throw new v9("invalid escape: only line-ending whitespace may be escaped",{toml:X,ptr:B});H=!Y&&Z==="\\"?1:0,B=W}throw new v9("unfinished string",{toml:X,ptr:J})}function Ou0(X,J,Z,Q){if(X==="true")return!0;if(X==="false")return!1;if(X==="-inf")return-1/0;if(X==="inf"||X==="+inf")return 1/0;if(X==="nan"||X==="+nan"||X==="-nan")return NaN;if(X==="-0")return Q?0n:0;let Y=Jd8.test(X);if(Y||Zd8.test(X)){if(Qd8.test(X))throw new v9("leading zeroes are not allowed",{toml:J,ptr:Z});X=X.replace(/_/g,"");let K=+X;if(isNaN(K))throw new v9("invalid number",{toml:J,ptr:Z});if(Y){if((Y=!Number.isSafeInteger(K))&&!Q)throw new v9("integer value cannot be represented losslessly",{toml:J,ptr:Z});if(Y||Q===!0)K=BigInt(X)}return K}let G=new SV(X);if(!G.isValid())throw new v9("invalid value",{toml:J,ptr:Z});return G}/*!
382
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
383
+ * SPDX-License-Identifier: BSD-3-Clause
384
+ *
385
+ * Redistribution and use in source and binary forms, with or without
386
+ * modification, are permitted provided that the following conditions are met:
387
+ *
388
+ * 1. Redistributions of source code must retain the above copyright notice, this
389
+ * list of conditions and the following disclaimer.
390
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
391
+ * this list of conditions and the following disclaimer in the
392
+ * documentation and/or other materials provided with the distribution.
393
+ * 3. Neither the name of the copyright holder nor the names of its contributors
394
+ * may be used to endorse or promote products derived from this software without
395
+ * specific prior written permission.
396
+ *
397
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
398
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
399
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
400
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
401
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
402
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
403
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
404
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
405
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
406
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
407
+ */function wd(X,J=0,Z=X.length){let Q=X.indexOf(`
408
+ `,J);if(X[Q-1]==="\r")Q--;return Q<=Z?Q:-1}function xD(X,J){for(let Z=J;Z<X.length;Z++){let Q=X[Z];if(Q===`
409
+ `)return Z;if(Q==="\r"&&X[Z+1]===`
410
+ `)return Z+1;if(Q<" "&&Q!=="\t"||Q==="")throw new v9("control characters are not allowed in comments",{toml:X,ptr:J})}return X.length}function t3(X,J,Z,Q){let Y;while(!0){while((Y=X[J])===" "||Y==="\t"||!Z&&(Y===`
411
+ `||Y==="\r"&&X[J+1]===`
412
+ `))J++;if(Q||Y!=="#")break;J=xD(X,J)}return J}function _u0(X,J,Z,Q,Y=!1){if(!Q)return J=wd(X,J),J<0?X.length:J;for(let G=J;G<X.length;G++){let K=X[G];if(K==="#"){if(G=wd(X,G),G<0)break}else if(K===Z)return G+1;else if(K===Q||Y&&(K===`
413
+ `||K==="\r"&&X[G+1]===`
414
+ `))return G}throw new v9("cannot find end of structure",{toml:X,ptr:J})}/*!
415
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
416
+ * SPDX-License-Identifier: BSD-3-Clause
417
+ *
418
+ * Redistribution and use in source and binary forms, with or without
419
+ * modification, are permitted provided that the following conditions are met:
420
+ *
421
+ * 1. Redistributions of source code must retain the above copyright notice, this
422
+ * list of conditions and the following disclaimer.
423
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
424
+ * this list of conditions and the following disclaimer in the
425
+ * documentation and/or other materials provided with the distribution.
426
+ * 3. Neither the name of the copyright holder nor the names of its contributors
427
+ * may be used to endorse or promote products derived from this software without
428
+ * specific prior written permission.
429
+ *
430
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
431
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
432
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
433
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
434
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
435
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
436
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
437
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
438
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
439
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
440
+ */function Yd8(X,J,Z){let Q=X.slice(J,Z),Y=Q.indexOf("#");if(Y>-1)xD(X,Y),Q=Q.slice(0,Y);return[Q.trimEnd(),Y]}function wR(X,J,Z,Q,Y){if(Q===0)throw new v9("document contains excessively nested structures. aborting.",{toml:X,ptr:J});let G=X[J];if(G==="["||G==="{"){let[H,W]=G==="["?Du0(X,J,Q,Y):qu0(X,J,Q,Y);if(Z){if(W=t3(X,W),X[W]===",")W++;else if(X[W]!==Z)throw new v9("expected comma or end of structure",{toml:X,ptr:W})}return[H,W]}if(G==='"'||G==="'"){let[H,W]=Dd(X,J);if(Z){if(W=t3(X,W),X[W]&&X[W]!==","&&X[W]!==Z&&X[W]!==`
441
+ `&&X[W]!=="\r")throw new v9("unexpected character encountered",{toml:X,ptr:W});if(X[W]===",")W++}return[H,W]}let K=_u0(X,J,",",Z),B=Yd8(X,J,K-(X[K-1]===","?1:0));if(!B[0])throw new v9("incomplete key-value declaration: no value specified",{toml:X,ptr:J});if(Z&&B[1]>-1){if(K=t3(X,J+B[1]),X[K]===",")K++}return[Ou0(B[0],X,J,Y),K]}/*!
442
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
443
+ * SPDX-License-Identifier: BSD-3-Clause
444
+ *
445
+ * Redistribution and use in source and binary forms, with or without
446
+ * modification, are permitted provided that the following conditions are met:
447
+ *
448
+ * 1. Redistributions of source code must retain the above copyright notice, this
449
+ * list of conditions and the following disclaimer.
450
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
451
+ * this list of conditions and the following disclaimer in the
452
+ * documentation and/or other materials provided with the distribution.
453
+ * 3. Neither the name of the copyright holder nor the names of its contributors
454
+ * may be used to endorse or promote products derived from this software without
455
+ * specific prior written permission.
456
+ *
457
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
458
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
459
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
460
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
461
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
462
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
463
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
464
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
465
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
466
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
467
+ */var Gd8=/^[a-zA-Z0-9-_]+[ \t]*$/;function Ld(X,J,Z="="){let Q=J-1,Y=[],G=X.indexOf(Z,J);if(G<0)throw new v9("incomplete key-value: cannot find end of key",{toml:X,ptr:J});do{let K=X[J=++Q];if(K!==" "&&K!=="\t")if(K==='"'||K==="'"){if(K===X[J+1]&&K===X[J+2])throw new v9("multiline strings are not allowed in keys",{toml:X,ptr:J});let[B,H]=Dd(X,J);Q=X.indexOf(".",H);let W=X.slice(H,Q<0||Q>G?G:Q),V=wd(W);if(V>-1)throw new v9("newlines are not allowed in keys",{toml:X,ptr:J+Q+V});if(W.trimStart())throw new v9("found extra tokens after the string part",{toml:X,ptr:H});if(G<H){if(G=X.indexOf(Z,H),G<0)throw new v9("incomplete key-value: cannot find end of key",{toml:X,ptr:J})}Y.push(B)}else{Q=X.indexOf(".",J);let B=X.slice(J,Q<0||Q>G?G:Q);if(!Gd8.test(B))throw new v9("only letter, numbers, dashes and underscores are allowed in keys",{toml:X,ptr:J});Y.push(B.trimEnd())}}while(Q+1&&Q<G);return[Y,t3(X,G+1,!0,!0)]}function qu0(X,J,Z,Q){let Y={},G=new Set,K;J++;while((K=X[J++])!=="}"&&K)if(K===",")throw new v9("expected value, found comma",{toml:X,ptr:J-1});else if(K==="#")J=xD(X,J);else if(K!==" "&&K!=="\t"&&K!==`
468
+ `&&K!=="\r"){let B,H=Y,W=!1,[V,U]=Ld(X,J-1);for(let L=0;L<V.length;L++){if(L)H=W?H[B]:H[B]={};if(B=V[L],(W=Object.hasOwn(H,B))&&(typeof H[B]!=="object"||G.has(H[B])))throw new v9("trying to redefine an already defined value",{toml:X,ptr:J});if(!W&&B==="__proto__")Object.defineProperty(H,B,{enumerable:!0,configurable:!0,writable:!0})}if(W)throw new v9("trying to redefine an already defined value",{toml:X,ptr:J});let[O,q]=wR(X,U,"}",Z-1,Q);G.add(O),H[B]=O,J=q}if(!K)throw new v9("unfinished table encountered",{toml:X,ptr:J});return[Y,J]}function Du0(X,J,Z,Q){let Y=[],G;J++;while((G=X[J++])!=="]"&&G)if(G===",")throw new v9("expected value, found comma",{toml:X,ptr:J-1});else if(G==="#")J=xD(X,J);else if(G!==" "&&G!=="\t"&&G!==`
469
+ `&&G!=="\r"){let K=wR(X,J-1,"]",Z-1,Q);Y.push(K[0]),J=K[1]}if(!G)throw new v9("unfinished array encountered",{toml:X,ptr:J});return[Y,J]}/*!
470
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
471
+ * SPDX-License-Identifier: BSD-3-Clause
472
+ *
473
+ * Redistribution and use in source and binary forms, with or without
474
+ * modification, are permitted provided that the following conditions are met:
475
+ *
476
+ * 1. Redistributions of source code must retain the above copyright notice, this
477
+ * list of conditions and the following disclaimer.
478
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
479
+ * this list of conditions and the following disclaimer in the
480
+ * documentation and/or other materials provided with the distribution.
481
+ * 3. Neither the name of the copyright holder nor the names of its contributors
482
+ * may be used to endorse or promote products derived from this software without
483
+ * specific prior written permission.
484
+ *
485
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
486
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
487
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
488
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
489
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
490
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
491
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
492
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
493
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
494
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
495
+ */function wu0(X,J,Z,Q){let Y=J,G=Z,K,B=!1,H;for(let W=0;W<X.length;W++){if(W){if(Y=B?Y[K]:Y[K]={},G=(H=G[K]).c,Q===0&&(H.t===1||H.t===2))return null;if(H.t===2){let V=Y.length-1;Y=Y[V],G=G[V].c}}if(K=X[W],(B=Object.hasOwn(Y,K))&&G[K]?.t===0&&G[K]?.d)return null;if(!B){if(K==="__proto__")Object.defineProperty(Y,K,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(G,K,{enumerable:!0,configurable:!0,writable:!0});G[K]={t:W<X.length-1&&Q===2?3:Q,d:!1,i:0,c:{}}}}if(H=G[K],H.t!==Q&&!(Q===1&&H.t===3))return null;if(Q===2){if(!H.d)H.d=!0,Y[K]=[];Y[K].push(Y={}),H.c[H.i++]=H={t:1,d:!1,i:0,c:{}}}if(H.d)return null;if(H.d=!0,Q===1)Y=B?Y[K]:Y[K]={};else if(Q===0&&B)return null;return[K,Y,H.c]}function n70(X,{maxDepth:J=1000,integersAsBigInt:Z}={}){let Q={},Y={},G=Q,K=Y;for(let B=t3(X,0);B<X.length;){if(X[B]==="["){let H=X[++B]==="[",W=Ld(X,B+=+H,"]");if(H){if(X[W[1]-1]!=="]")throw new v9("expected end of table declaration",{toml:X,ptr:W[1]-1});W[1]++}let V=wu0(W[0],Q,Y,H?2:1);if(!V)throw new v9("trying to redefine an already defined table or value",{toml:X,ptr:B});K=V[2],G=V[1],B=W[1]}else{let H=Ld(X,B),W=wu0(H[0],G,K,0);if(!W)throw new v9("trying to redefine an already defined table or value",{toml:X,ptr:B});let V=wR(X,H[1],void 0,J,Z);W[1][W[0]]=V[0],B=V[1]}if(B=t3(X,B,!0),X[B]&&X[B]!==`
496
+ `&&X[B]!=="\r")throw new v9("each key-value declaration must be followed by an end-of-line",{toml:X,ptr:B});B=t3(X,B)}return Q}/*!
497
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
498
+ * SPDX-License-Identifier: BSD-3-Clause
499
+ *
500
+ * Redistribution and use in source and binary forms, with or without
501
+ * modification, are permitted provided that the following conditions are met:
502
+ *
503
+ * 1. Redistributions of source code must retain the above copyright notice, this
504
+ * list of conditions and the following disclaimer.
505
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
506
+ * this list of conditions and the following disclaimer in the
507
+ * documentation and/or other materials provided with the distribution.
508
+ * 3. Neither the name of the copyright holder nor the names of its contributors
509
+ * may be used to endorse or promote products derived from this software without
510
+ * specific prior written permission.
511
+ *
512
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
513
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
514
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
515
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
516
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
517
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
518
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
519
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
520
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
521
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
522
+ */var Lu0=/^[a-z0-9-_]+$/i;function LR(X){let J=typeof X;if(J==="object"){if(Array.isArray(X))return"array";if(X instanceof Date)return"date"}return J}function Kd8(X){for(let J=0;J<X.length;J++)if(LR(X[J])!=="object")return!1;return X.length!=0}function i70(X){return JSON.stringify(X).replace(/\x7f/g,"\\u007f")}function o70(X,J,Z,Q){if(Z===0)throw Error("Could not stringify the object: maximum object depth exceeded");if(J==="number"){if(isNaN(X))return"nan";if(X===1/0)return"inf";if(X===-1/0)return"-inf";if(Number.isInteger(X)&&(Q||!Number.isSafeInteger(X)))return X.toFixed(1);return X.toString()}if(J==="bigint"||J==="boolean")return X.toString();if(J==="string")return i70(X);if(J==="date"){if(isNaN(X.getTime()))throw TypeError("cannot serialize invalid date");return X.toISOString()}if(J==="object")return Bd8(X,Z,Q);if(J==="array")return Hd8(X,Z,Q)}function Bd8(X,J,Z){let Q=Object.keys(X);if(Q.length===0)return"{}";let Y="{ ";for(let G=0;G<Q.length;G++){let K=Q[G];if(G)Y+=", ";Y+=Lu0.test(K)?K:i70(K),Y+=" = ",Y+=o70(X[K],LR(X[K]),J-1,Z)}return Y+" }"}function Hd8(X,J,Z){if(X.length===0)return"[]";let Q="[ ";for(let Y=0;Y<X.length;Y++){if(Y)Q+=", ";if(X[Y]===null||X[Y]===void 0)throw TypeError("arrays cannot contain null or undefined values");Q+=o70(X[Y],LR(X[Y]),J-1,Z)}return Q+" ]"}function Wd8(X,J,Z,Q){if(Z===0)throw Error("Could not stringify the object: maximum object depth exceeded");let Y="";for(let G=0;G<X.length;G++)Y+=`${Y&&`
523
+ `}[[${J}]]
524
+ `,Y+=r70(0,X[G],J,Z,Q);return Y}function r70(X,J,Z,Q,Y){if(Q===0)throw Error("Could not stringify the object: maximum object depth exceeded");let G="",K="",B=Object.keys(J);for(let H=0;H<B.length;H++){let W=B[H];if(J[W]!==null&&J[W]!==void 0){let V=LR(J[W]);if(V==="symbol"||V==="function")throw TypeError(`cannot serialize values of type '${V}'`);let U=Lu0.test(W)?W:i70(W);if(V==="array"&&Kd8(J[W]))K+=(K&&`
525
+ `)+Wd8(J[W],Z?`${Z}.${U}`:U,Q-1,Y);else if(V==="object"){let O=Z?`${Z}.${U}`:U;K+=(K&&`
526
+ `)+r70(O,J[W],O,Q-1,Y)}else G+=U,G+=" = ",G+=o70(J[W],V,Q,Y),G+=`
527
+ `}}if(X&&(G||!K))G=G?`[${X}]
528
+ ${G}`:`[${X}]`;return G&&K?`${G}
529
+ ${K}`:G||K}function a70(X,{maxDepth:J=1000,numbersAsFloat:Z=!1}={}){if(LR(X)!=="object")throw TypeError("stringify can only be called with an object");let Q=r70(0,X,"",J,Z);if(Q[Q.length-1]!==`
530
+ `)return Q+`
531
+ `;return Q}/*!
532
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
533
+ * SPDX-License-Identifier: BSD-3-Clause
534
+ *
535
+ * Redistribution and use in source and binary forms, with or without
536
+ * modification, are permitted provided that the following conditions are met:
537
+ *
538
+ * 1. Redistributions of source code must retain the above copyright notice, this
539
+ * list of conditions and the following disclaimer.
540
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
541
+ * this list of conditions and the following disclaimer in the
542
+ * documentation and/or other materials provided with the distribution.
543
+ * 3. Neither the name of the copyright holder nor the names of its contributors
544
+ * may be used to endorse or promote products derived from this software without
545
+ * specific prior written permission.
546
+ *
547
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
548
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
549
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
550
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
551
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
552
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
553
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
554
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
555
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
556
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
557
+ */class Fu0 extends D.Class("CodexMcpEntry")({command:D.NonEmptyTrimmedString,args:D.Array(D.String),env:D.optional(D.Record({key:D.String,value:D.String})),enabled:D.Boolean}){}function $d8(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}var s70=N.fn(function*(X){let J=X.mcp_servers;return $d8(J)?J:{}});function Ud8(X){return X}class mz extends N.Service()("@expandai/cli/Install/Codex/Mcp",{dependencies:[iQ.Default,nQ.Default],effect:N.gen(function*(){let X=yield*iQ,J=yield*nQ,Z=yield*P0.string("HOME").pipe(P0.withDefault(Vd8())),Q=yield*P0.string("PWD").pipe(P0.withDefault(process.cwd())),Y=N.fn(function*(V){return yield*D0.value(V).pipe(D0.when("global",()=>N.succeed(`${Z}/.codex/config.toml`)),D0.when("project",()=>N.succeed(`${Q}/.codex/config.toml`)),D0.exhaustive)}),G=N.fn(function*(V){let U=yield*X.readText(V);return yield*N.try({try:()=>n70(U,{integersAsBigInt:!1}),catch:(O)=>new a3({path:V,error:O})})}),K=N.fn(function*(V,U){let O=yield*N.try({try:()=>a70(Ud8(U)),catch:(q)=>new BK({path:V,error:q})});yield*X.writeText(V,O).pipe(N.mapError((q)=>new BK({path:V,error:q})))}),B=N.fn(function*(V){let U=yield*Y(V),O=yield*G(U),q=yield*s70(O),L=yield*J.resolve(),A=new Fu0({command:L.command,args:[...L.args,"mcp","run"],env:{EXPANDAI_HARNESS:"codex"},enabled:!0}),M={command:A.command,args:[...A.args],env:{...A.env},enabled:A.enabled};yield*K(U,{...O,mcp_servers:XY.set(q,Q6,M)}),yield*_8.log(`Installed expandai MCP server into ${U}`)}),H=N.fn(function*(V){let U=yield*Y(V),O=yield*G(U),q=yield*s70(O);if(!(Q6 in q))return;yield*K(U,{...O,mcp_servers:XY.remove(q,Q6)}),yield*_8.log(`Removed expandai MCP server from ${U}`)}),W=N.fn(function*(V){let U=yield*Y(V),O=yield*G(U),q=yield*s70(O);return Q6 in q});return{install:B,uninstall:H,isInstalled:W,pathFor:Y}})}){}import{homedir as zd8}from"node:os";class Au0 extends D.Class("CursorMcpEntry")({type:D.Literal("stdio"),command:D.NonEmptyTrimmedString,args:D.Array(D.String),env:D.optional(D.Record({key:D.String,value:D.String}))}){}class dz extends N.Service()("@expandai/cli/Install/Cursor/Mcp",{dependencies:[iQ.Default,nQ.Default],effect:N.gen(function*(){let X=yield*iQ,J=yield*nQ,Z=yield*P0.string("HOME").pipe(P0.withDefault(zd8())),Q=yield*P0.string("PWD").pipe(P0.withDefault(process.cwd())),Y=N.fn(function*(V){return yield*D0.value(V).pipe(D0.when("global",()=>N.succeed(`${Z}/.cursor/mcp.json`)),D0.when("project",()=>N.succeed(`${Q}/.cursor/mcp.json`)),D0.exhaustive)}),G=N.fn(function*(V){return yield*X.read(V,w2).pipe(N.mapError((U)=>new a3({path:V,error:U})))}),K=N.fn(function*(V,U){yield*X.write(V,U,w2).pipe(N.mapError((O)=>new BK({path:V,error:O})))}),B=N.fn(function*(V){let U=yield*Y(V),O=yield*G(U),q=yield*J.resolve();yield*K(U,{...O,mcpServers:{...O.mcpServers,[Q6]:new Au0({type:"stdio",command:q.command,args:[...q.args,"mcp","run"],env:{EXPANDAI_HARNESS:"cursor"}})}}),yield*_8.log(`Installed expandai MCP server into ${U}`)}),H=N.fn(function*(V){let U=yield*Y(V),O=yield*G(U);if(!(Q6 in O.mcpServers))return;yield*K(U,{...O,mcpServers:XY.remove(O.mcpServers,Q6)}),yield*_8.log(`Removed expandai MCP server from ${U}`)}),W=N.fn(function*(V){let U=yield*Y(V),O=yield*G(U);return Q6 in O.mcpServers});return{install:B,uninstall:H,isInstalled:W,pathFor:Y}})}){}import{homedir as Nd8}from"node:os";class Tu0 extends D.Class("OpencodeMcpEntry")({type:D.Literal("local"),command:D.Array(D.String),environment:D.optional(D.Record({key:D.String,value:D.String})),enabled:D.optional(D.Boolean)}){}class uz extends N.Service()("@expandai/cli/Install/Opencode/Mcp",{dependencies:[iQ.Default,nQ.Default],effect:N.gen(function*(){let X=yield*iQ,J=yield*nQ,Z=yield*P0.string("HOME").pipe(P0.withDefault(Nd8())),Q=yield*P0.string("PWD").pipe(P0.withDefault(process.cwd())),Y=N.fn(function*(V){return yield*D0.value(V).pipe(D0.when("global",()=>N.succeed(`${Z}/.config/opencode/opencode.json`)),D0.when("project",()=>N.succeed(`${Q}/opencode.json`)),D0.exhaustive)}),G=N.fn(function*(V){return yield*X.read(V,l70).pipe(N.mapError((U)=>new a3({path:V,error:U})))}),K=N.fn(function*(V,U){yield*X.write(V,U,l70).pipe(N.mapError((O)=>new BK({path:V,error:O})))}),B=N.fn(function*(V){let U=yield*Y(V),O=yield*G(U),q=yield*J.resolve();yield*K(U,{...O,mcp:{...O.mcp,[Q6]:new Tu0({type:"local",command:[q.command,...q.args,"mcp","run"],environment:{EXPANDAI_HARNESS:"opencode"},enabled:!0})}}),yield*_8.log(`Installed expandai MCP server into ${U}`)}),H=N.fn(function*(V){let U=yield*Y(V),O=yield*G(U);if(!(Q6 in O.mcp))return;yield*K(U,{...O,mcp:XY.remove(O.mcp,Q6)}),yield*_8.log(`Removed expandai MCP server from ${U}`)}),W=N.fn(function*(V){let U=yield*Y(V),O=yield*G(U);return Q6 in O.mcp});return{install:B,uninstall:H,isInstalled:W,pathFor:Y}})}){}class y5 extends N.Service()("@expandai/cli/Install/Mcp",{dependencies:[qd.Default,dz.Default,uz.Default,mz.Default],effect:N.gen(function*(){let X=yield*qd,J=yield*dz,Z=yield*uz,Q=yield*mz,Y=N.fn("Mcp.pathFor")(function*(H,W){return yield*D0.value(H).pipe(D0.when("claude-code",()=>X.pathFor(W)),D0.when("cursor",()=>J.pathFor(W)),D0.when("opencode",()=>Z.pathFor(W)),D0.when("codex",()=>Q.pathFor(W)),D0.exhaustive)}),G=N.fn("Mcp.install")(function*(H,W){yield*D0.value(H).pipe(D0.when("claude-code",()=>X.install(W)),D0.when("cursor",()=>J.install(W)),D0.when("opencode",()=>Z.install(W)),D0.when("codex",()=>Q.install(W)),D0.exhaustive)}),K=N.fn("Mcp.uninstall")(function*(H,W){yield*D0.value(H).pipe(D0.when("claude-code",()=>X.uninstall(W)),D0.when("cursor",()=>J.uninstall(W)),D0.when("opencode",()=>Z.uninstall(W)),D0.when("codex",()=>Q.uninstall(W)),D0.exhaustive)}),B=N.fn("Mcp.isInstalled")(function*(H,W){return yield*D0.value(H).pipe(D0.when("claude-code",()=>X.isInstalled(W)),D0.when("cursor",()=>J.isInstalled(W)),D0.when("opencode",()=>Z.isInstalled(W)),D0.when("codex",()=>Q.isInstalled(W)),D0.exhaustive)});return{install:G,uninstall:K,isInstalled:B,pathFor:Y}})}){}import{homedir as Od8}from"node:os";var Mu0="expandai-webfetch.js";class cz extends N.Service()("@expandai/cli/Install/Opencode/Hook",{dependencies:[KZ.layer,_Q.layer],effect:N.gen(function*(){let X=yield*zX.FileSystem,J=yield*M6.Path,Z=yield*J.fromFileUrl(Bu0),Q=yield*P0.string("HOME").pipe(P0.withDefault(Od8())),Y=yield*P0.string("PWD").pipe(P0.withDefault(process.cwd())),G=N.fn(function*(H){return yield*D0.value(H).pipe(D0.when("global",()=>N.succeed(`${Q}/.config/opencode/plugins/${Mu0}`)),D0.when("project",()=>N.succeed(`${Y}/.opencode/plugins/${Mu0}`)),D0.exhaustive)}),K=N.fn("OpencodeHook.install")(function*(H){let W=yield*G(H);yield*X.makeDirectory(J.dirname(W),{recursive:!0}),yield*X.copyFile(Z,W),yield*_8.log(`Installed expandai webfetch plugin at ${W}`)}),B=N.fn("OpencodeHook.uninstall")(function*(H){let W=yield*G(H);if(yield*X.exists(W))yield*X.remove(W),yield*_8.log(`Removed expandai webfetch plugin from ${W}`)});return{install:K,uninstall:B,pathFor:G}})}){}var OU9=D.Literal("claude-code","opencode");class e3 extends N.Service()("@expandai/cli/Install/Hook",{dependencies:[y5.Default,Od.Default,cz.Default],effect:N.gen(function*(){let X=yield*y5,J=yield*Od,Z=yield*cz,Q=N.fn("HookInstaller.install")(function*(G,K){yield*X.install(G,K),yield*D0.value(G).pipe(D0.when("claude-code",()=>J.install(K)),D0.when("opencode",()=>Z.install(K)),D0.exhaustive)}),Y=N.fn("HookInstaller.uninstall")(function*(G,K){yield*D0.value(G).pipe(D0.when("claude-code",()=>J.uninstall(K)),D0.when("opencode",()=>Z.uninstall(K)),D0.exhaustive),yield*X.uninstall(G,K)});return{install:Q,uninstall:Y}})}){}import{homedir as _d8}from"node:os";var Fd="expandai",FR="SKILL.md",Pu0=/^(\s*expandai-profile-version:\s*).+$/mu;function qd8(X,J=a7){if(!Pu0.test(X))throw Error("Bundled Expand skill is missing expandai-profile-version metadata");return X.replace(Pu0,`$1${J}`)}function Ad(X,J,Z=a7){let Q=qd8(J,Z);return{changed:X!==Q,text:Q}}var Dd8=N.gen(function*(){let X=yield*zX.FileSystem,J=yield*M6.Path,Z=yield*P0.string("HOME").pipe(P0.withDefault(_d8())),Q=yield*P0.string("PWD").pipe(P0.withDefault(process.cwd())),Y=J.join(yield*J.fromFileUrl(SD),FR),G=N.fn(function*(W){return yield*D0.value(W).pipe(D0.when("global",()=>N.succeed(J.join(Z,".claude","skills",Fd))),D0.when("project",()=>N.succeed(J.join(Q,".claude","skills",Fd))),D0.exhaustive)}),K=N.fn("ClaudeSkill.source")(function*(){return yield*X.readFileString(Y)}),B=N.fn("ClaudeSkill.install")(function*(W){let V=yield*G(W),U=J.join(V,FR),O=(yield*X.exists(U))?yield*X.readFileString(U):void 0,q=Ad(O,yield*K());if(q.changed)yield*X.makeDirectory(V,{recursive:!0}),yield*X.writeFileString(U,q.text);return V}),H=N.fn("ClaudeSkill.uninstall")(function*(W){let V=yield*G(W);if(yield*X.exists(V))yield*X.remove(V,{recursive:!0});return V});return{install:B,uninstall:H,pathFor:G,source:K}});class Td extends N.Service()("@expandai/cli/Install/Claude/Skill",{dependencies:[KZ.layer,_Q.layer],effect:Dd8}){}import{homedir as wd8}from"node:os";var Ru0="expandai";class fz extends N.Service()("@expandai/cli/Install/Codex/Skill",{dependencies:[s3.Default],effect:N.gen(function*(){let X=yield*s3,J=yield*P0.string("HOME").pipe(P0.withDefault(wd8())),Z=yield*P0.string("PWD").pipe(P0.withDefault(process.cwd())),Q=N.fn(function*(B){return yield*D0.value(B).pipe(D0.when("global",()=>N.succeed(`${J}/.agents/skills/${Ru0}`)),D0.when("project",()=>N.succeed(`${Z}/.agents/skills/${Ru0}`)),D0.exhaustive)}),Y=N.fn(function*(B){return yield*X.install(yield*Q(B))}),G=N.fn(function*(B){return yield*X.uninstall(yield*Q(B))}),K=N.fn(function*(B){return yield*X.isCurrent(yield*Q(B))});return{install:Y,uninstall:G,isCurrent:K,pathFor:Q}})}){}import{homedir as Ld8}from"node:os";var ju0="expandai";class pz extends N.Service()("@expandai/cli/Install/Cursor/Skill",{dependencies:[s3.Default],effect:N.gen(function*(){let X=yield*s3,J=yield*P0.string("HOME").pipe(P0.withDefault(Ld8())),Z=yield*P0.string("PWD").pipe(P0.withDefault(process.cwd())),Q=N.fn(function*(B){return yield*D0.value(B).pipe(D0.when("global",()=>N.succeed(`${J}/.cursor/skills/${ju0}`)),D0.when("project",()=>N.succeed(`${Z}/.cursor/skills/${ju0}`)),D0.exhaustive)}),Y=N.fn(function*(B){return yield*X.install(yield*Q(B))}),G=N.fn(function*(B){return yield*X.uninstall(yield*Q(B))}),K=N.fn(function*(B){return yield*X.isCurrent(yield*Q(B))});return{install:Y,uninstall:G,isCurrent:K,pathFor:Q}})}){}import{homedir as Fd8}from"node:os";var Cu0="expandai";class lz extends N.Service()("@expandai/cli/Install/Opencode/Skill",{dependencies:[s3.Default],effect:N.gen(function*(){let X=yield*s3,J=yield*P0.string("HOME").pipe(P0.withDefault(Fd8())),Z=yield*P0.string("PWD").pipe(P0.withDefault(process.cwd())),Q=N.fn(function*(B){return yield*D0.value(B).pipe(D0.when("global",()=>N.succeed(`${J}/.config/opencode/skills/${Cu0}`)),D0.when("project",()=>N.succeed(`${Z}/.opencode/skills/${Cu0}`)),D0.exhaustive)}),Y=N.fn(function*(B){return yield*X.install(yield*Q(B))}),G=N.fn(function*(B){return yield*X.uninstall(yield*Q(B))}),K=N.fn(function*(B){return yield*X.isCurrent(yield*Q(B))});return{install:Y,uninstall:G,isCurrent:K,pathFor:Q}})}){}class XB extends N.Service()("@expandai/cli/Install/Skill",{dependencies:[Td.Default,pz.Default,lz.Default,fz.Default],effect:N.gen(function*(){let X=yield*Td,J=yield*pz,Z=yield*lz,Q=yield*fz,Y=N.fn("Skill.install")(function*(K,B){let H=yield*D0.value(K).pipe(D0.when("claude-code",()=>X.install(B)),D0.when("cursor",()=>J.install(B)),D0.when("opencode",()=>Z.install(B)),D0.when("codex",()=>Q.install(B)),D0.exhaustive);yield*_8.log(`Installed expandai skill into ${H}`)}),G=N.fn("Skill.uninstall")(function*(K,B){let H=yield*D0.value(K).pipe(D0.when("claude-code",()=>X.uninstall(B)),D0.when("cursor",()=>J.uninstall(B)),D0.when("opencode",()=>Z.uninstall(B)),D0.when("codex",()=>Q.uninstall(B)),D0.exhaustive);yield*_8.log(`Removed expandai skill from ${H}`)});return{install:Y,uninstall:G}})}){}var Ad8=D.Literal("all","hook","skill","mcp");class Eu0 extends D.Class("UninstallOptions")({target:D.optional(Ad8),host:D.optional(Nd),scope:D.optional(p70)}){}var Td8=["global","project"],Md8=["claude-code","cursor","opencode","codex"],Iu0=(X)=>X==="claude-code"||X==="opencode";class L2 extends N.Service()("@expandai/cli/Install/Uninstall",{dependencies:[e3.Default,y5.Default,XB.Default],effect:N.gen(function*(){let X=yield*e3,J=yield*y5,Z=yield*XB;return{uninstall:N.fn(function*(Y=new Eu0({})){let G=Y.target??"all",K=Y.host?[Y.host]:Md8,B=Y.scope?[Y.scope]:Td8,H=N.fnUntraced(function*(){let O=H8.filter(K,Iu0);yield*N.forEach(O,(q)=>N.forEach(B,(L)=>X.uninstall(q,L),{discard:!0}),{discard:!0})}),W=N.fnUntraced(function*(){yield*N.forEach(K,(O)=>N.forEach(B,(q)=>Z.uninstall(O,q),{discard:!0}),{discard:!0})}),V=N.fnUntraced(function*(){yield*N.forEach(K,(O)=>N.forEach(B,(q)=>J.uninstall(O,q),{discard:!0}),{discard:!0})}),U=N.fnUntraced(function*(){let O=H8.filter(K,(q)=>!Iu0(q));yield*N.forEach(O,(q)=>N.forEach(B,(L)=>J.uninstall(q,L),{discard:!0}),{discard:!0})});yield*D0.value(G).pipe(D0.when("all",()=>H().pipe(N.zipRight(U()),N.zipRight(W()))),D0.when("hook",()=>H()),D0.when("skill",()=>W()),D0.when("mcp",()=>V()),D0.exhaustive)})}})}){}var Su0=N.fn("Authentication.formatAuthStatus")(function*(X){return yield*D0.value(X).pipe(D0.tag("ApiKey",()=>N.succeed("Authenticated via API key.")),D0.tag("OAuth",({expiresAt:J})=>N.gen(function*(){let Z=yield*Q9.now;return`Authenticated via OAuth (${Q9.lessThan(J,Z)?`expired ${r9.format(Q9.distanceDuration(J,Z))} ago — run \`expandai login\``:`expires in ${r9.format(Q9.distanceDuration(Z,J))}`}).`})),D0.exhaustive)});class g5 extends N.Service()("@expandai/cli/Authentication",{dependencies:[x9.Default,vz.Default,L2.Default],effect:N.gen(function*(){let X=yield*x9,J=yield*vz,Z=yield*L2,Q=N.fn("Authentication.hasLocallyUsableCredentials")(function*(){yield*X.ensureSecureStorage();let O=yield*N.either(X.loadConfig());if(F8.isLeft(O)){if(O.left._tag==="NotAuthenticated")return!1;return yield*N.fail(O.left)}let q=yield*Q9.now;return nm(O.right.authMethod,q)}),Y=N.fn("Authentication.apiKeyLogin")(function*(){let O=yield*cQ.password({message:"Enter your API Key"});yield*X.updateConfig({authMethod:q70.make({apiKey:yield*D.validate(pm)(O)})}),yield*_8.log("API key saved successfully!")}),G=N.fnUntraced(function*(O){yield*_8.log(_X.stripMargin(`
558
+ |
559
+ |Starting browser authorization...`)),yield*J.login(O),yield*_8.log(_X.stripMargin(`
560
+ |
561
+ |Successfully authenticated!`))}),K=N.fnUntraced(function*(O){yield*_8.log(_X.stripMargin(`
562
+ |
563
+ |Open this URL in a browser:
564
+ | ${O.toString()}
565
+ |
566
+ |Waiting for browser authorization...`))}),B=N.fn("Authentication.loginWithBrowser")(function*(){yield*G(K)}),H=N.fn("Authentication.oauthLogin")(function*(){yield*G((O)=>N.gen(function*(){if(yield*_8.log(_X.stripMargin(`
567
+ |
568
+ |Open this URL in a browser:
569
+ | ${O.toString()}
570
+ |`)),yield*cQ.confirm({message:"Open browser now?",initial:!0}))yield*N.tryPromise(()=>Gu0(O.toString())).pipe(N.catchAll(()=>_8.log("Could not open browser automatically — use the URL above.")));yield*_8.log(_X.stripMargin(`
571
+ |
572
+ |Waiting for browser authorization...`))}))}),W=N.fn("Authentication.login")(function*(){yield*X.ensureSecureStorage();let O=yield*N.either(X.loadConfig());if(F8.isRight(O)){let L=yield*Su0(O.right.authMethod);if(!(yield*cQ.confirm({message:_X.stripMargin(`
573
+ |${L}
574
+ |Do you want to re-authenticate?`)})))return}let q=yield*cQ.select({message:"How would you like to authenticate?",choices:[{title:"Browser Login",value:"oauth",description:"Authenticate via browser"},{title:"API Key",value:"api-key",description:"Paste your API key"}]});yield*D0.value(q).pipe(D0.when("api-key",()=>Y()),D0.when("oauth",()=>H()),D0.exhaustive)}),V=N.fn("Authentication.whoami")(function*(){let{authMethod:O}=yield*X.loadConfig(),q=yield*Su0(O);yield*_8.log(q)}),U=N.fn("Authentication.logout")(function*(){if(yield*X.clearConfig(),!process.stdout.isTTY||!process.stdin.isTTY){yield*N.logInfo(_X.stripMargin("\n\t\t\t\t\t\t|Skipping install cleanup — `expandai logout` is not interactive in this context.\n\t\t\t\t\t\t|Run `expandai uninstall` to remove hooks, skills, and MCP entries.")),yield*_8.log("Logged out.");return}let O=yield*cQ.multiSelect({message:"Remove installed expandai integrations?",choices:[{title:"Global hooks",value:{target:"hook",scope:"global"}},{title:"Project hooks",value:{target:"hook",scope:"project"}},{title:"Global skills",value:{target:"skill",scope:"global"}},{title:"Project skills",value:{target:"skill",scope:"project"}},{title:"Global MCP entries",value:{target:"mcp",scope:"global"}},{title:"Project MCP entries",value:{target:"mcp",scope:"project"}}]});if(O.length>0)yield*N.forEach(O,(q)=>Z.uninstall(q),{discard:!0});yield*_8.log("Logged out.")});return{hasLocallyUsableCredentials:Q,loginWithBrowser:B,login:W,whoami:V,logout:U}})}){}var t70=E0.make("login").pipe(E0.withDescription("Authenticate with ExpandAI"),E0.withHandler(()=>N.flatMap(g5,(X)=>X.login()))),e70=E0.make("whoami").pipe(E0.withDescription("Show current authentication status"),E0.withHandler(()=>N.flatMap(g5,(X)=>X.whoami()))),XJ0=E0.make("logout").pipe(E0.withDescription("Clear stored credentials and optionally remove installed integrations"),E0.withHandler(()=>N.flatMap(g5,(X)=>X.logout())));var Pd8=new Map([["fetch",new Set],["search",new Set],["login",new Set],["whoami",new Set],["logout",new Set],["init",new Set],["status",new Set],["uninstall",new Set],["mcp",new Set(["run","install","uninstall"])],["skill",new Set(["install","uninstall"])],["hook",new Set(["claude-code","opencode","install","uninstall"])],["telemetry",new Set(["status","enable","disable"])]]);function AR(X){let[J,Z]=X.slice(2),Q=J===void 0?void 0:Pd8.get(J);if(J===void 0||Q===void 0)return"(none)";return Z!==void 0&&Q.has(Z)?`${J} ${Z}`:J}var Rd8=/^playground:\s*"?([^"\n]+)"?\s*$/mu;function xu0(X){let J=Rd8.exec(X)?.[1]?.trim();if(J===void 0||J.length===0)return X;let Z=_X.stripMargin(`
575
+ |---
576
+ |
577
+ |> Cite what you take from this page. Evidence ids are stamped next to the text they
578
+ |> belong to, written as \`{1199}\`. End your answer with:
579
+ |>
580
+ |> **Sources**
581
+ |> [1] [<page title>](${J}?id=<evidence id>)
582
+ |>
583
+ |> One marker per sentence, numbered in order. Never invent an evidence id, and never
584
+ |> reuse an id from different text. A link without \`?id=\` is not a citation, so if the
585
+ |> sentence you want carries no id, quote one that does or say the capture has none —
586
+ |> never fall back to linking the original page.`);return`${X.trimEnd()}
587
+
588
+ ${Z}
589
+ `}function Md(X,J,Z){return`${_X.stripMargin(`
590
+ |> Fetched via expand.ai (snapshot \`${J}\`). Capture: ${Z}
591
+ |>
592
+ |> Cite every claim you take from this page. The body below stamps an evidence id next
593
+ |> to the text it belongs to, written as \`{1199}\`. For each sentence you use, take the
594
+ |> id nearest that text and end your answer with:
595
+ |>
596
+ |> **Sources**
597
+ |> [1] [<page title>](${Z}?id=<evidence id>)
598
+ |>
599
+ |> Number the markers \`[1]\`, \`[2]\`, … in the order they appear, one per sentence.
600
+ |> Never invent an evidence id, and never reuse an id from different text.
601
+ |> A bare capture link without \`?id=\` is not a citation — the reader cannot
602
+ |> check the sentence against the page. If the sentence you want carries no id, quote
603
+ |> one that does, or say the capture has none. Never fall back to the original page URL.
604
+ |>
605
+ |> To extract specific passages, search the snapshot by handle — call the \`fetch_search\`
606
+ |> tool with \`snapshotId: "${J}"\`, or run \`expandai search ${J} "<query>"\`.
607
+ |> Each snippet returns a \`citationUrl\` that already carries the right \`?id=\`.
608
+ |> Do not fetch this URL again.`)}
609
+
610
+ ---
611
+
612
+ ${X}`}function ku0(X={isTty:process.stdout.isTTY===!0,env:process.env}){let{env:J,isTty:Z}=X,Q=J.FORCE_COLOR?.trim();if(Q!==void 0&&Q!=="")return Q!=="0";if(J.NO_COLOR!==void 0&&J.NO_COLOR!=="")return!1;if(J.TERM==="dumb")return!1;return Z}function F2(X,J){return J===""?J:`${X}${J}\x1B[0m`}function JJ0(X,J){let Z=[],Q=X.replace(/`[^`\n]+`/g,(Y)=>{return Z.push(`\x1B[36m${Y}\x1B[0m`),`\x00${Z.length-1}\x00`});if(J?.dimPipes)Q=Q.replaceAll("|","\x1B[2m|\x1B[0m");return Q=Q.replace(/\[([^\]\n]*)\]\(([^)\n]*)\)/g,(Y,G,K)=>`\x1B[2m[\x1B[0m\x1B[34;4m${G}\x1B[0m\x1B[2m](${K})\x1B[0m`),Q=Q.replace(/\*\*([^*\n]+)\*\*/g,(Y,G)=>`\x1B[1m**${G}**\x1B[0m`),Q.replace(/\x00(\d+)\x00/g,(Y,G)=>Z[Number(G)]??"")}var vu0=/^(\s*)(`{3,}|~{3,})(.*)$/,jd8=/^#{1,6}\s/,Cd8=/^ {0,3}(-{3,}|\*{3,}|_{3,})\s*$/,Id8=/^(\s*)([-*+]|\d{1,9}[.)])(\s+)(.*)$/,Ed8=/^(\s*)([\w.-]+):(.*)$/;function bu0(X){let J=X.split(`
613
+ `),Z=[],Q=!1,Y;return J.forEach((G,K)=>{if(Y){if(vu0.test(G)&&Y.test(G))Y=void 0,Z.push(F2("\x1B[2m",G));else Z.push(F2("\x1B[33m",G));return}if(K===0&&G==="---"){Q=!0,Z.push(F2("\x1B[2m",G));return}if(Q){if(G==="---"){Q=!1,Z.push(F2("\x1B[2m",G));return}let W=G.match(Ed8);Z.push(W?`${W[1]}\x1B[36m${W[2]}\x1B[0m\x1B[2m:${W[3]}\x1B[0m`:F2("\x1B[2m",G));return}let B=G.match(vu0);if(B){let W=B[2]??"```";Y=new RegExp(`^\\s*${W[0]==="`"?"`":"~"}{${W.length},}\\s*$`),Z.push(F2("\x1B[2m",G));return}if(jd8.test(G)){Z.push(F2("\x1B[1;36m",G));return}if(Cd8.test(G)){Z.push(F2("\x1B[2m",G));return}if(G.trimStart().startsWith(">")){Z.push(F2("\x1B[32m",G));return}if(G.trimStart().startsWith("|")){Z.push(JJ0(G,{dimPipes:!0}));return}let H=G.match(Id8);if(H){Z.push(`${H[1]}\x1B[33m${H[2]}\x1B[0m${H[3]}${JJ0(H[4]??"")}`);return}Z.push(JJ0(G))}),Z.join(`
614
+ `)}var Sd8=D.encodeSync(D.parseJson(D.Unknown,{space:2}));function yu0(X,J,Z){return Z.map((Q)=>({...Q,citationUrl:DD(X,Q.location,J)}))}function Pd(X,J,Z){return Z.map((Q)=>{let Y=DD(X,Q.location,J),G=`[${Q.source} · score ${Q.score.toFixed(2)}] ${Y}`,K=Q.json==null?"":`
615
+
616
+ ${Sd8(Q.json)}`;return`${G}
617
+
618
+ ${Q.text}${K}`}).join(`
619
+
620
+ ---
621
+
622
+ `)}class vD extends D.TaggedError()("MarkdownUnavailable",{url:D.String}){get message(){return`No markdown content was returned for ${this.url}`}}class gu0 extends D.TaggedError()("SnippetsUnavailable",{url:D.String,query:D.String}){get message(){return`No snippets were returned for ${this.url} matching '${this.query}'`}}var xd8=N.fn("Fetch.parseUrlArg")(function*(X){if(X.startsWith("-"))return yield*N.fail(Az.p(`Missing argument <url> (received '${X}')`));let J=X.startsWith("http://")||X.startsWith("https://")?X:`https://${X}`,Z=yield*N.try({try:()=>new URL(J),catch:()=>Az.p(`Invalid URL '${X}'`)});if(!Z.hostname.includes(".")&&Z.hostname!=="localhost")return yield*N.fail(Az.p(`URL must contain a valid domain (got '${X}')`));return Z}),vd8=P6.text({name:"url"}).pipe(P6.mapEffect(xd8)),kd8=P8.text("format").pipe(P8.withDefault("text"),P8.withDescription("Output format (text or json)"),P8.withSchema(D.Literal("text","json"))),bd8=P8.text("search").pipe(P8.optional,P8.withDescription("Semantic search query. Returns relevant snippets instead of markdown.")),yd8=P8.integer("max-results").pipe(P8.withDefault(5),P8.withDescription("Maximum snippets to return when using --search (default: 5)"),P8.withSchema(D.Int.pipe(D.greaterThanOrEqualTo(1),D.lessThanOrEqualTo(50)))),gd8=P8.float("min-score").pipe(P8.withDefault(0.6),P8.withDescription("Minimum snippet relevance score from 0 to 1 when using --search (default: 0.6)"),P8.withSchema(D.Number.pipe(D.greaterThanOrEqualTo(0),D.lessThanOrEqualTo(1)))),hd8={url:vd8,format:kd8,search:bd8,maxResults:yd8,minScore:gd8},ZJ0=E0.make("fetch",hd8).pipe(E0.withDescription("Fetch content from a URL as markdown or snippets"),E0.withHandler(N.fnUntraced(function*({format:X,maxResults:J,minScore:Z,search:Q,url:Y}){let G=yield*BZ,K=m.getOrUndefined(Q),B=K===void 0?{params:{},payload:{url:Y.toString(),include:{markdown:!0}}}:{params:{},payload:{url:Y.toString(),include:{markdown:!0,json:!0},search:{query:K,maxResults:J,minScore:Z}}},H=X==="text"&&K===void 0?yield*G.fetchFetch(B).pipe(N.flatMap((W)=>_X.isNonEmpty(W)?N.succeed(W):N.fail(new vD({url:Y.toString()}))),N.map((W)=>ku0()?bu0(W):xu0(W))):yield*G.fetchFetchResult(B).pipe(N.flatMap((W)=>D0.value(X).pipe(D0.when("text",()=>{let V=W.data?.search?.snippets??[];return V.length===0?N.fail(new gu0({url:Y.toString(),query:K??""})):N.succeed(Pd(W.meta.snapshotId,jV(W.meta.playground,NR),V))}),D0.when("json",()=>{let V=W.data?.search,U=V==null?W:{...W,data:{...W.data,search:{...V,snippets:yu0(W.meta.snapshotId,jV(W.meta.playground,NR),V.snippets)}}};return D.encode(D.parseJson(D.Unknown,{space:2}))(U)}),D0.exhaustive)));yield*_8.log(H)},N.provide(BZ.Default))));class TR extends D.TaggedError()("StdinReadError",{error:D.Defect}){get message(){return"Failed to read hook payload from stdin."}}class A2 extends D.TaggedError()("HookProtocolFailed",{error:D.Defect,url:D.optional(D.String)}){get message(){let X=this.error instanceof Error?this.error.message:"Hook protocol failed.";return this.url?`${X} (url: ${this.url})`:X}}var md8="WebFetch";class hu0 extends D.Class("WebFetchToolInput")({url:D.String,prompt:D.optional(D.String)}){}class mu0 extends D.Class("PreToolUseHookPayload")({hook_event_name:D.Literal("PreToolUse"),tool_name:D.String,tool_input:hu0}){}var dd8=D.decode(D.parseJson(mu0)),ud8=D.encode(D.parseJson(D.Unknown)),cd8=r3.toString(()=>process.stdin,{onFailure:(X)=>new TR({error:X}),encoding:"utf8"});class kD extends N.Service()("@expandai/cli/Hook/Claude",{dependencies:[BZ.Default],effect:N.gen(function*(){let X=yield*BZ;return{runProtocol:N.fn("ClaudeHook.runProtocol")(function*(){let Z=yield*cd8.pipe(N.mapError((G)=>new A2({error:G}))),Q=yield*dd8(Z).pipe(N.mapError((G)=>new A2({error:G})));if(Q.tool_name!==md8)return;let Y=Q.tool_input.url;yield*N.gen(function*(){let G=yield*X.fetchFetchResult({params:{},payload:{url:Y,include:{markdown:!0}}});if(_X.isEmpty(G.markdown))return yield*new vD({url:Y});let K={hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:"Fetched by expand.ai instead — the captured page follows, with evidence ids for citing it. Do not retry this URL.",additionalContext:Md(G.markdown,G.meta.snapshotId,G.meta.playground)}};yield*_8.log(yield*ud8(K))}).pipe(N.mapError((G)=>new A2({error:G,url:Y})))})}})}){}class du0 extends D.Class("OpencodeWebfetchInput")({url:D.String}){}var fd8=D.decode(D.parseJson(du0)),pd8=D.encode(D.parseJson(D.Unknown)),ld8=r3.toString(()=>process.stdin,{onFailure:(X)=>new TR({error:X}),encoding:"utf8"});class bD extends N.Service()("@expandai/cli/Hook/Opencode",{dependencies:[BZ.Default],effect:N.gen(function*(){let X=yield*BZ;return{runProtocol:N.fn("OpencodeHook.runProtocol")(function*(){let Z=yield*ld8.pipe(N.mapError((G)=>new A2({error:G}))),Y=(yield*fd8(Z).pipe(N.mapError((G)=>new A2({error:G})))).url;yield*N.gen(function*(){let G=yield*X.fetchFetchResult({params:{},payload:{url:Y,include:{markdown:!0}}});if(_X.isEmpty(G.markdown))return yield*new vD({url:Y});let K=Md(G.markdown,G.meta.snapshotId,G.meta.playground);yield*_8.log(yield*pd8({markdown:K}))}).pipe(N.mapError((G)=>new A2({error:G,url:Y})))})}})}){}var uu0=E0.make("claude-code").pipe(E0.withDescription("Run the Claude Code WebFetch hook protocol over stdio"),E0.withHandler(()=>N.flatMap(kD,(X)=>X.runProtocol()))),cu0=E0.make("opencode").pipe(E0.withDescription("Run the OpenCode webfetch plugin protocol over stdio"),E0.withHandler(()=>N.flatMap(bD,(X)=>X.runProtocol()))),fu0=P6.choice([["claude-code","claude-code"],["opencode","opencode"]]),pu0=P6.choice([["global","global"],["project","project"]]),nd8=E0.make("install",{host:fu0,scope:pu0}).pipe(E0.withDescription("Install the expandai MCP server + webfetch hook for the chosen host + scope"),E0.withHandler(({host:X,scope:J})=>N.flatMap(e3,(Z)=>Z.install(X,J)))),id8=E0.make("uninstall",{host:fu0,scope:pu0}).pipe(E0.withDescription("Remove the expandai MCP server + webfetch hook for the chosen host + scope"),E0.withHandler(({host:X,scope:J})=>N.flatMap(e3,(Z)=>Z.uninstall(X,J)))),lu0=E0.make("hook").pipe(E0.withDescription("expandai hooks for AI coding assistants"),E0.withSubcommands([uu0,cu0,nd8,id8])),nu0=E0.make("hook").pipe(E0.withDescription("expandai hooks for AI coding assistants"),E0.withSubcommands([uu0,cu0]));import{homedir as od8}from"node:os";var iu0=["claude-code","cursor","opencode","codex"];function rd8(X){return X!==void 0&&X!==""&&X!=="0"&&X!=="false"}function ou0(X){let J=D.decodeUnknownOption(y7)(X.EXPANDAI_HARNESS);if(m.isSome(J))return J;if(rd8(X.CLAUDECODE))return m.some("claude-code");if(X.CURSOR_TRACE_ID!==void 0)return m.some("cursor");if(X.CODEX_RUN_ID!==void 0)return m.some("codex");return m.none()}class T2 extends N.Service()("@expandai/cli/Init/HarnessDetector",{dependencies:[KZ.layer,_Q.layer],effect:N.gen(function*(){let X=yield*zX.FileSystem,J=yield*M6.Path,Z=N.fn("HarnessDetector.detect")(function*(Y={}){let G=Y.environment??process.env,K=Y.cwd??G.PWD??process.cwd(),B=G.HOME??od8(),H=new Map([["claude-code",[J.join(B,".claude"),J.join(K,".claude")]],["cursor",[J.join(B,".cursor"),J.join(K,".cursor")]],["opencode",[J.join(B,".config","opencode"),J.join(K,".opencode"),J.join(K,"opencode.json")]],["codex",[J.join(B,".codex"),J.join(K,".codex")]]]),W=new Set,V=ou0(G);if(m.isSome(V))W.add(V.value);if(Y.hint!==void 0)W.add(Y.hint);let U=yield*N.forEach(iu0,(O)=>N.exists(H.get(O)??[],(q)=>X.exists(q).pipe(N.orElseSucceed(()=>!1))).pipe(N.map((q)=>({harness:O,exists:q}))),{concurrency:"unbounded"});for(let{harness:O,exists:q}of U)if(q)W.add(O);return iu0.filter((O)=>W.has(O))}),Q=N.fnUntraced(function*(Y={}){return ou0(Y.environment??process.env)});return{detect:Z,detectCurrent:Q}})}){}import{homedir as ad8}from"node:os";var nz=a7,sd8="managed_mcp_only",td8="managed_mcp_denied",ed8="managed_mcp_not_allowed",YJ0="target_read_only",Xu8=D.parseJson(D.Record({key:D.String,value:D.Unknown})),Ju8=/^\s*expandai-profile-version:\s*([^\s]+)\s*$/mu,ru0=new TextEncoder,Zu8=new TextDecoder,au0=4095;function tu0(X){return typeof X==="object"&&X!==null&&!H8.isArray(X)}function Qu8(){if(process.platform==="darwin")return{files:["/Library/Application Support/ClaudeCode/managed-settings.json","/Library/Application Support/ClaudeCode/managed-mcp.json"],directories:["/Library/Application Support/ClaudeCode/managed-settings.d"]};if(process.platform==="win32")return{files:["C:\\Program Files\\ClaudeCode\\managed-settings.json","C:\\Program Files\\ClaudeCode\\managed-mcp.json"],directories:["C:\\Program Files\\ClaudeCode\\managed-settings.d"]};return{files:["/etc/claude-code/managed-settings.json","/etc/claude-code/managed-mcp.json"],directories:["/etc/claude-code/managed-settings.d"]}}class MR extends N.Service()("@expandai/cli/Init/ClaudeManagedSettingsLocations",{sync:Qu8}){static testLayer(X){return C8.succeed(MR,MR.make(X))}}function su0(X){if(!H8.isArray(X))return!1;return X.some((J)=>{if(J===Q6)return!0;if(!tu0(J))return!1;return J.name===Q6||J.serverName===Q6})}function Yu8(X){let J=new Set,Z=X.some((G)=>G.allowManagedMcpServersOnly===!0),Q=X.some((G)=>H8.isArray(G.allowedMcpServers)),Y=X.some((G)=>su0(G.allowedMcpServers));for(let G of X)if(su0(G.deniedMcpServers))J.add(td8);if(Z&&!Y)J.add(sd8);if(Q&&!Y)J.add(ed8);return[...J].sort()}function Gu8(X){if(X===void 0)return;return Ju8.exec(X)?.[1]}function Ku8(X){if(!tu0(X))return X===void 0?[]:["owned-entry"];let{command:J,args:Z}=X;if(J==="npx"&&H8.isArray(Z)&&Z[0]==="-y")return["npx-y"];if(typeof J==="string"&&J!=="expandai"&&/(?:^|[\\/])expandai(?:\.exe)?$/u.test(J))return["absolute-path"];return["owned-entry"]}function QJ0(X,J,Z){let Q=Ad(J.skillText,J.bundledSkillText,nz),Y=Gu8(J.skillText),G=J.skillText!==void 0&&!Q.changed,K=J.mcp.mcpServers[Q6],B=!_d(J.mcp,Z).changed,H=[];if(G)H.push("runtime-skill");if(B)H.push("mcp");let W=Yu8(J.managedSettings);if(J.readOnlyTargets.length>0)W.push(YJ0);return{scope:X,targets:J.targets,hook:{current:!0,installed:!1,legacyVariants:[]},skill:{current:G,installed:J.skillText!==void 0,legacyVariants:J.skillText===void 0||G?[]:["outdated-runtime-skill"],...Y===void 0?{}:{version:Y}},mcp:{current:B,installed:K!==void 0,legacyVariants:B?[]:Ku8(K)},components:H,configured:H.length===2,profileVersion:nz,componentVersions:{...Y===void 0?{}:{skill:Y},...B?{mcp:nz}:{}},policyBlocks:[...new Set(W)].sort(),remotePolicyMayApply:!0,reloadMayBeRequired:!B,consentMayBeRequired:X==="project"}}var Bu8=N.gen(function*(){let X=yield*zX.FileSystem,J=yield*M6.Path,Z=yield*MR,Q=yield*(yield*nQ).resolve(),Y=yield*P0.string("HOME").pipe(P0.withDefault(ad8())),G=yield*P0.string("PWD").pipe(P0.withDefault(process.cwd())),K=J.join(yield*J.fromFileUrl(SD),FR),B=N.fnUntraced(function*(A){return(yield*X.exists(A))?yield*X.readFileString(A):void 0}),H=N.fnUntraced(function*(A){if(!(yield*X.exists(A)))return{expected:{exists:!1}};let M=yield*X.stat(A),x=yield*X.readFile(A);return{expected:{exists:!0,type:"File",bytes:x,mode:M.mode&au0},text:Zu8.decode(x)}}),W=N.fnUntraced(function*(A){if(!(yield*X.exists(A)))return{exists:!1};let M=yield*X.stat(A);if(M.type!=="Directory")throw Error("Planned directory target is not a directory");return{exists:!0,type:"Directory",mode:M.mode&au0}}),V=N.fnUntraced(function*(A){function M(k){let P=J.dirname(k);return P===k?[k]:[k,...M(P)]}let x=M(A),T=(yield*N.forEach(x,(k)=>X.exists(k).pipe(N.map((P)=>({candidate:k,exists:P}))))).find((k)=>k.exists)?.candidate??x[x.length-1];if(T===void 0)return!1;return((yield*X.stat(T)).mode&146)!==0}),U=N.fnUntraced(function*(A){if(A.type==="write"&&A.expected?.exists===!0&&A.expected.type==="File"&&!(yield*N.either(X.access(A.path,{writable:!0}))).pipe(F8.isRight))return!1;if(A.type==="mkdir"&&A.expected?.exists===!0)return!0;let M=J.dirname(A.path);function x(C){let v=J.dirname(C);return v===C?[C]:[C,...x(v)]}let j=x(M),T=yield*N.forEach(j,(C)=>X.exists(C).pipe(N.map((v)=>({candidate:C,exists:v})))),E=T.find((C)=>C.exists)?.candidate;if(E===void 0)return!1;let k=T.filter((C)=>C.exists);if(!(yield*N.forEach(k,({candidate:C})=>X.stat(C).pipe(N.map((v)=>v.type==="Directory"&&(process.platform==="win32"||(v.mode&73)!==0)),N.orElseSucceed(()=>!1)))).every(Boolean))return!1;return(yield*N.either(X.access(E,{writable:!0}))).pipe(F8.isRight)}),O=N.fn("ClaudeProfile.load")(function*(A){let M=A==="global"?Y:G,x=J.join(M,".claude","skills",Fd),j=Z,T=yield*N.flatMap(N.forEach(j.directories,(r)=>X.exists(r).pipe(N.flatMap((J0)=>J0?X.readDirectory(r):N.succeed([])),N.map((J0)=>J0.filter((F0)=>!F0.startsWith(".")&&F0.endsWith(".json")).sort().map((F0)=>J.join(r,F0))))),(r)=>N.succeed(r.flat())),E={settingsFile:J.join(M,".claude","settings.json"),skillDirectory:x,skillFile:J.join(x,FR),mcpFile:A==="global"?J.join(Y,".claude.json"):J.join(G,".mcp.json"),managedSettingsFiles:[...j.files,...T],managedSettingsDirectories:j.directories},k=yield*H(E.settingsFile),P=yield*H(E.skillFile),C=yield*H(E.mcpFile),v=k.text,f=P.text,s=C.text,l=yield*X.readFileString(K),W0=yield*D.decode($u0)(v??"{}"),b=yield*D.decode(w2)(s??"{}"),a=yield*N.forEach(E.managedSettingsFiles,(r)=>B(r).pipe(N.flatMap((J0)=>J0===void 0?N.succeed(m.none()):D.decode(Xu8)(J0).pipe(N.map(m.some))))),n=yield*N.filter([E.skillFile,E.mcpFile],(r)=>V(r).pipe(N.map((J0)=>!J0)));return{targets:E,settings:W0,settingsExpected:k.expected,...v===void 0?{}:{settingsText:v},skillExpected:P.expected,...f===void 0?{}:{skillText:f},bundledSkillText:l,mcp:b,mcpExpected:C.expected,...s===void 0?{}:{mcpText:s},managedSettings:H8.getSomes(a),readOnlyTargets:n}}),q=N.fn("ClaudeProfile.inspect")(function*(A){return QJ0(A,yield*O(A),Q)}),L=N.fn("ClaudeProfile.plan")(function*(A){let M=yield*O(A),x=Ad(M.skillText,M.bundledSkillText,nz),j=_d(M.mcp,Q),T=`${yield*D.encode(w2)(j.config)}
623
+ `,E=J.dirname(M.targets.settingsFile),k=J.dirname(M.targets.skillDirectory),P=[];if(x.changed)P.push({type:"mkdir",path:E,expected:yield*W(E)});if(x.changed)P.push({type:"mkdir",path:k,expected:yield*W(k)}),P.push({type:"mkdir",path:M.targets.skillDirectory,expected:yield*W(M.targets.skillDirectory)}),P.push({type:"write",path:M.targets.skillFile,bytes:ru0.encode(x.text),expected:M.skillExpected});if(j.changed)P.push({type:"write",path:M.targets.mcpFile,bytes:ru0.encode(T),expected:M.mcpExpected});let v=(yield*N.forEach(P,U)).every(Boolean)?M:{...M,readOnlyTargets:[...M.readOnlyTargets,"mutation-requirement"]},f=QJ0(A,v,Q),s=QJ0(A,{...v,skillText:x.text,mcp:j.config,mcpText:T},Q);return{changed:x.changed||j.changed,inspection:f,resultInspection:s,operations:P}});return{inspect:q,plan:L}});class Rd extends N.Service()("@expandai/cli/Init/ClaudeProfile",{dependencies:[KZ.layer,_Q.layer,MR.Default,nQ.Default],effect:Bu8}){}class PR extends D.TaggedError()("HarnessInspectionError",{harness:y7,scope:lQ,error:D.Defect}){get message(){return`Failed to inspect ${this.harness} (${this.scope}): ${T9.format(this.error)}`}}class RR extends D.TaggedError()("HarnessConfigurationError",{harness:y7,scope:lQ,error:D.Defect}){get message(){return`Failed to configure ${this.harness} (${this.scope}): ${T9.format(this.error)}`}}var Cd=D.Struct({path:D.String,operation:D.Literal("write","remove","mkdir"),error:D.Defect});class BJ0 extends D.TaggedError()("MutationSymlinkError",{path:D.String}){get message(){return`Refusing to mutate through symbolic link ${this.path}`}}class ZG extends D.TaggedError()("MutationPathChangedError",{path:D.String}){get message(){return`Path lineage changed while the mutation transaction was using ${this.path}`}}class HJ0 extends D.TaggedError()("MutationRollbackConflictError",{path:D.String}){get message(){return`Rollback preserved concurrent state at ${this.path}`}}class Id extends D.TaggedError()("MutationValidationError",Cd.fields){get message(){return`Mutation validation failed for ${this.path}: ${T9.format(this.error)}`}}class yD extends D.TaggedError()("MutationApplicationError",{...Cd.fields,rollbackFailures:D.Array(Cd)}){get message(){let X=this.rollbackFailures.length===0?"":`; ${this.rollbackFailures.length} rollback operation(s) also failed`;return`Mutation failed for ${this.path}: ${T9.format(this.error)}${X}`}}class eu0 extends D.TaggedError()("MutationRollbackError",{rollbackFailures:D.Array(Cd)}){get message(){return`${this.rollbackFailures.length} rollback operation(s) failed after a defect or interruption`}}var GJ0=4095;function KJ0(X,J){let Z=X.resolve(J),Q=X.parse(Z).root;function Y(G){if(G===Q)return[Q];return[...Y(X.dirname(G)),G]}return Y(Z)}function VJ0(X,J){if(X===void 0||J===void 0)return X===J;if(X.byteLength!==J.byteLength)return!1;return X.every((Z,Q)=>Z===J[Q])}function Hu8(X,J){if(X===void 0||J===void 0)return X===J;return X.length===J.length&&X.every((Z,Q)=>Z===J[Q])}function jd(X,J){return X.exists===J.exists&&X.type===J.type&&X.mode===J.mode&&VJ0(X.bytes,J.bytes)&&Hu8(X.entries,J.entries)}function iz(X,J){return jd(X,J)&&(!X.exists||X.dev===J.dev&&X.ino===J.ino&&X.realPath===J.realPath)}function Wu8(X,J){if(X.exists!==J.exists)return!1;if(!J.exists)return!0;if(X.type!==J.type||X.mode!==J.mode)return!1;return J.type==="Directory"||VJ0(X.bytes,J.bytes)}function Vu8(X,J){return typeof X==="object"&&X!==null&&"code"in X&&X.code===J}function $u8(X,J){return X.length===J.length&&X.every((Z,Q)=>{let Y=J[Q];return Y!==void 0&&Z.path===Y.path&&Z.exists===Y.exists&&Z.dev===Y.dev&&Z.ino===Y.ino&&Z.realPath===Y.realPath&&Z.type===Y.type})}function WJ0(X,J){return new Id({path:X.path,operation:X.type,error:J})}function oz(X,J){return WJ0(X,Error(J))}function Uu8(X,J){return new yD({path:X.path,operation:X.type,error:J,rollbackFailures:[]})}var zu8=N.gen(function*(){let X=yield*zX.FileSystem,J=yield*M6.Path,Z=N.fnUntraced(function*(T){let E=yield*N.either(X.readLink(T));if(F8.isRight(E))return yield*new BJ0({path:T});let k=E.left;if(k instanceof PY.SystemError&&(k.reason==="InvalidData"||k.reason==="NotFound"||k.method==="readLink"&&Vu8(k.cause,"EINVAL")))return;return yield*k}),Q=N.fnUntraced(function*(T){return yield*N.forEach(KJ0(J,T),(E)=>N.gen(function*(){if(yield*Z(E),!(yield*X.exists(E)))return{path:E,exists:!1};let P=yield*X.stat(E);return{path:E,exists:!0,dev:P.dev,ino:m.getOrUndefined(P.ino),realPath:yield*X.realPath(E),type:P.type}}))}),Y=N.fnUntraced(function*(T,E){let k=yield*Q(T),P=yield*N.exit(E),C=yield*N.exit(Q(T));if(I9.isFailure(C))return yield*I9.isFailure(P)?N.failCause(P9.sequential(P.cause,C.cause)):N.failCause(C.cause);if(!$u8(k,C.value)){let v=new ZG({path:T});return yield*I9.isFailure(P)?N.failCause(P9.sequential(P.cause,P9.fail(v))):v}return yield*I9.isFailure(P)?N.failCause(P.cause):N.succeed(P.value)}),G=N.fnUntraced(function*(T,E){if(!(yield*X.exists(T)))return{exists:!1};let P=yield*X.stat(T);if(P.type==="File")return{exists:!0,bytes:yield*X.readFile(T),dev:P.dev,ino:m.getOrUndefined(P.ino),mode:P.mode&GJ0,realPath:yield*X.realPath(T),type:"File"};if(P.type==="Directory"){let C=E?[...yield*X.readDirectory(T)].sort():void 0;return{exists:!0,dev:P.dev,...C===void 0?{}:{entries:C},ino:m.getOrUndefined(P.ino),mode:P.mode&GJ0,realPath:yield*X.realPath(T),type:"Directory"}}return yield*new ZG({path:T})}),K=N.fnUntraced(function*(T,E=!0){return yield*Y(T,G(T,E).pipe(N.flatMap((k)=>G(T,E).pipe(N.flatMap((P)=>jd(k,P)?N.succeed(P):new ZG({path:T}))))))}),B=N.fnUntraced(function*(T){if("mode"in T&&T.mode!==void 0){if(!(Number.isInteger(T.mode)&&T.mode>=0&&T.mode<=GJ0))return yield*oz(T,`Invalid file mode ${T.mode}`)}}),H=N.fnUntraced(function*(T){let E=new Set,k=new Set;return yield*N.forEach(T,(P)=>{let C=J.resolve(P.path);return N.gen(function*(){if(E.has(C))return yield*oz(P,`Multiple mutations target ${C}`);E.add(C),yield*B(P);let v=yield*Q(C);if(yield*N.forEach(v,(f,s)=>{let l=s===v.length-1;if(!f.exists)return P.type==="mkdir"||l||k.has(f.path)?N.void:oz(P,`Parent directory does not exist: ${f.path}`);if(!l&&f.type!=="Directory")return oz(P,`Parent path is not a directory: ${f.path}`);if(l&&P.type==="mkdir"&&f.type!=="Directory")return oz(P,`Directory mutation targets ${f.type}: ${f.path}`);if(l&&P.type!=="mkdir"&&f.type!=="File")return oz(P,`File mutation targets ${f.type}: ${f.path}`);return N.void},{discard:!0}),P.validate!==void 0)yield*P.validate;if(P.type==="mkdir")H8.forEach(KJ0(J,C),(f)=>k.add(f));return{operation:P,absolutePath:C}}).pipe(N.mapError((v)=>v instanceof Id||v instanceof BJ0?v:WJ0(P,v)))})}),W=N.fnUntraced(function*(T,E,k,P,C){let v=J.dirname(T),f=yield*N.acquireRelease(Y(v,X.makeTempFile({directory:v,prefix:".expandai-init-"})),(b)=>{let a=J.dirname(b),n=J.resolve(a)!==J.resolve(v);return Y(v,n?X.remove(a,{force:!0,recursive:!0}):X.remove(b,{force:!0})).pipe(N.ignore)});if(yield*Y(f,X.writeFile(f,E)),P!==void 0)yield*Y(f,X.chmod(f,P));let l={...yield*K(f),realPath:J.resolve(T)};yield*Y(v,N.gen(function*(){let b=yield*K(T);if(!iz(b,k))return yield*new ZG({path:T});yield*N.uninterruptible(X.rename(f,T).pipe(N.zipRight(C===void 0?N.void:C(l))))}));let W0=yield*K(T);if(!iz(W0,l))return yield*new ZG({path:T});return W0},N.scoped),V=N.fnUntraced(function*(T,E,k){let P={exists:!1},C=E.type==="Directory"?X.remove(T,{recursive:!0}):X.remove(T);yield*Y(J.dirname(T),N.gen(function*(){let f=yield*K(T);if(!iz(f,E))return yield*new ZG({path:T});yield*N.uninterruptible(C.pipe(N.zipRight(k===void 0?N.void:k(P))))}));let v=yield*K(T);if(!jd(v,P))return yield*new ZG({path:T});return P}),U=N.fnUntraced(function*(T,E,k,P){let C=J.dirname(T),v=yield*N.acquireRelease(Y(C,X.makeTempDirectory({directory:C,prefix:".expandai-init-directory-"})),(W0)=>Y(C,X.remove(W0,{force:!0,recursive:!0})).pipe(N.ignore));if(k!==void 0)yield*Y(v,X.chmod(v,k));let s={...yield*K(v),realPath:J.resolve(T)};yield*Y(C,N.gen(function*(){let W0=yield*K(T);if(!iz(W0,E))return yield*new ZG({path:T});yield*N.uninterruptible(X.rename(v,T).pipe(N.zipRight(P===void 0?N.void:P(s))))}));let l=yield*K(T);if(!iz(l,s))return yield*new ZG({path:T});return l},N.scoped),O=(T,E,k,P)=>N.exit(P).pipe(N.flatMap((C)=>I9.isSuccess(C)?N.void:N.sync(()=>{T.push({path:E,operation:k,error:C.cause})}).pipe(N.zipRight(N.logError(`Rollback failed for ${E} (${k})`,P9.pretty(C.cause)))))),q=N.fnUntraced(function*(T,E,k,P){let C=yield*K(T);if(!iz(C,E))return yield*new HJ0({path:T});yield*P(C);let v=yield*K(T);if(!jd(v,k))return yield*new HJ0({path:T})}),L=(T,E,k)=>q(T,E,k,(P)=>V(T,P)),A=(T,E,k,P)=>q(T,E,k,(C)=>W(T,P,C,k.mode)),M=N.fnUntraced(function*(T,E,k){let{operation:P,path:C,snapshot:v}=T,f=yield*K(C);if(!iz(f,v))return yield*new ZG({path:C});let s=(l,W0)=>(b)=>rJ.addFinalizerExit(E,(a)=>I9.isSuccess(a)?N.void:O(k,l,P.type,W0(b)));if(P.type==="write"){let l=P.mode??v.mode;if(v.type==="File"&&VJ0(v.bytes,P.bytes)&&v.mode===l)return;let W0=v.exists?v.bytes:void 0;yield*W(C,P.bytes,v,l,s(C,(b)=>W0===void 0?L(C,b,v):A(C,b,v,W0)));return}if(P.type==="remove"){if(!v.exists)return;let l=v.bytes;if(l===void 0)return yield*new ZG({path:C});yield*V(C,v,s(C,(W0)=>A(C,W0,v,l)));return}if(v.exists)return;yield*N.forEach(KJ0(J,C),(l)=>N.gen(function*(){let W0=yield*K(l,!1);if(W0.exists)return;yield*U(l,W0,P.mode,s(l,(b)=>L(l,b,W0)))}),{discard:!0})}),x=N.fnUntraced(function*(T,E){if(E.length===0)return T;let k=P9.map(T,(C)=>C instanceof yD?new yD({path:C.path,operation:C.operation,error:C.error,rollbackFailures:[...E]}):C);return k9.some(P9.failures(T),(C)=>C instanceof yD)?k:P9.sequential(k,P9.fail(new eu0({rollbackFailures:[...E]})))});return{run:N.fn("MutationTransaction.run")(function*(T){let E=yield*H(T),k=yield*N.forEach(E,({operation:l,absolutePath:W0})=>N.gen(function*(){let b=yield*K(W0);if(l.expected!==void 0&&!Wu8(b,l.expected))return yield*oz(l,"Expected mutation state no longer matches");return{operation:l,path:W0,snapshot:b}}).pipe(N.mapError((b)=>b instanceof Id?b:WJ0(l,b)))),P=yield*rJ.make(),C=[],v=N.forEach(k,(l)=>M(l,P,C).pipe(N.mapError((W0)=>W0 instanceof yD?W0:Uu8(l.operation,W0))),{discard:!0}),f=yield*N.exit(v.pipe(N.onExit((l)=>rJ.close(P,l))));if(I9.isSuccess(f))return;let s=yield*x(f.cause,C);return yield*N.failCause(s)})}});class Ed extends N.Service()("@expandai/cli/Init/MutationTransaction",{dependencies:[KZ.layer,_Q.layer],effect:zu8}){}class $J0 extends D.TaggedError()("IncompatibleClaudeProfileVersionError",{executingVersion:D.String,requiredVersion:D.String}){get message(){return`Executing CLI ${this.executingVersion} is incompatible with Claude profile ${this.requiredVersion}`}}class UJ0 extends D.TaggedError()("ClaudeProfilePolicyBlockedError",{policyBlock:D.String}){get message(){return`Claude Code policy blocks profile configuration: ${this.policyBlock}`}}class jR extends D.TaggedError()("ClaudeAdapterOperationError",{code:D.Literal("inspection_failed","configuration_failed")}){get message(){return this.code==="inspection_failed"?"Claude Code profile inspection failed":"Claude Code profile configuration failed"}}var Nu8="5 seconds",Ou8=N.gen(function*(){let X=yield*Y2.CommandExecutor,J=yield*P0.string("PATH").pipe(P0.withDefault("")),Z=N.scoped(N.gen(function*(){let Q=fQ.make("expandai","--version").pipe(fQ.env({...process.env,EXPANDAI_NO_TELEMETRY:"1",PATH:J}),fQ.stdout("pipe"),fQ.stderr("pipe")),Y=yield*X.start(Q),[G,,K]=yield*N.all([Y.stdout.pipe(S7.decodeText(),S7.mkString),Y.stderr.pipe(S7.runDrain),Y.exitCode],{concurrency:"unbounded"});return K===0&&G.trim()===a7})).pipe(N.timeoutFail({duration:Nu8,onTimeout:()=>Error("expandai --version timed out")}),N.orElseSucceed(()=>!1));return{executingVersion:a7,portableCommandAvailable:Z}});class CR extends N.Service()("@expandai/cli/Init/ClaudeRuntimeProbe",{dependencies:[Nm.layer],effect:Ou8}){static testLayer(X){return C8.succeed(CR,CR.make({executingVersion:X.executingVersion,portableCommandAvailable:N.succeed(X.portableCommandAvailable)}))}}function Xc0(X,J,Z){let Q=X.policyBlocks[0],Y=Q!==void 0,G=X.configured&&!J;return{configured:X.configured,changed:Z,components:X.components,integrationVersion:X.profileVersion,...Q===void 0?{}:{policyBlock:Q},runtimeState:Y?"blocked":G?"reload_required":"unverified",nextAction:Y?"resolve-claude-policy-block":G?"restart-claude-code-current-path-unavailable":X.configured?"invoke-native-webfetch":"configure-claude-code"}}var _u8=N.gen(function*(){let X=yield*Rd,J=yield*Ed,Z=yield*CR,Q=N.fn("ClaudeAdapter.inspect")(function*(G){return yield*N.gen(function*(){let K=yield*X.inspect(G),B=yield*Z.portableCommandAvailable;return Xc0(K,B,!1)}).pipe(N.catchAllDefect(()=>new jR({code:"inspection_failed"})),N.mapError(()=>new PR({harness:"claude-code",scope:G,error:new jR({code:"inspection_failed"})})))}),Y=N.fn("ClaudeAdapter.configure")(function*(G){return yield*N.gen(function*(){if(Z.executingVersion!==nz)return yield*new $J0({executingVersion:Z.executingVersion,requiredVersion:nz});let K=yield*Z.portableCommandAvailable,B=yield*X.plan(G),H=B.inspection.policyBlocks[0];if(H!==void 0)return yield*new UJ0({policyBlock:H});return yield*J.run(B.operations),Xc0(B.resultInspection,K,B.changed)}).pipe(N.catchAllDefect(()=>new jR({code:"configuration_failed"})),N.mapError((K)=>new RR({harness:"claude-code",scope:G,error:K instanceof $J0||K instanceof UJ0?K:new jR({code:"configuration_failed"})})))});return{harness:"claude-code",inspect:Q,configure:Y}});class Sd extends N.Service()("@expandai/cli/Init/ClaudeAdapter",{dependencies:[Rd.Default,Ed.Default,CR.Default],effect:_u8}){}function Jc0(X,J,Z){let Q=X.components.every((Y)=>J.includes(Y));return{configured:Q,changed:Z,components:[...J],integrationVersion:Q?a7:void 0,runtimeState:Q?"reload_required":"unverified",nextAction:Q?"restart-or-reload-harness-then-use-expand":"configure-harness"}}function zJ0(X){let J=N.fn(`${X.harness}.inspect`)(function*(Q){return yield*X.inspectComponents(Q).pipe(N.map((Y)=>Jc0(X,Y,!1)),N.mapError((Y)=>new PR({harness:X.harness,scope:Q,error:Y})))}),Z=N.fn(`${X.harness}.configure`)(function*(Q){return yield*N.gen(function*(){let Y=yield*X.inspectComponents(Q),G=X.components.every((B)=>Y.includes(B));if(!G)yield*X.install(Q);let K=yield*X.inspectComponents(Q);return Jc0(X,K,!G)}).pipe(N.mapError((Y)=>new RR({harness:X.harness,scope:Q,error:Y})))});return{harness:X.harness,inspect:J,configure:Z}}class xd extends N.Service()("@expandai/cli/Init/CursorAdapter",{dependencies:[dz.Default,pz.Default],effect:N.gen(function*(){let X=yield*dz,J=yield*pz;return zJ0({harness:"cursor",components:["runtime-skill","mcp"],inspectComponents:(Z)=>N.all([X.isInstalled(Z),J.isCurrent(Z)]).pipe(N.map(([Q,Y])=>[...Y?["runtime-skill"]:[],...Q?["mcp"]:[]])),install:(Z)=>N.all([X.install(Z),J.install(Z)])})})}){}class vd extends N.Service()("@expandai/cli/Init/CodexAdapter",{dependencies:[mz.Default,fz.Default],effect:N.gen(function*(){let X=yield*mz,J=yield*fz;return zJ0({harness:"codex",components:["runtime-skill","mcp"],inspectComponents:(Z)=>N.all([X.isInstalled(Z),J.isCurrent(Z)]).pipe(N.map(([Q,Y])=>[...Y?["runtime-skill"]:[],...Q?["mcp"]:[]])),install:(Z)=>N.all([X.install(Z),J.install(Z)])})})}){}class kd extends N.Service()("@expandai/cli/Init/OpencodeAdapter",{dependencies:[KZ.layer,cz.Default,uz.Default,lz.Default],effect:N.gen(function*(){let X=yield*zX.FileSystem,J=yield*cz,Z=yield*uz,Q=yield*lz;return zJ0({harness:"opencode",components:["webfetch-hook","runtime-skill","mcp"],inspectComponents:(Y)=>N.all([Z.isInstalled(Y),J.pathFor(Y).pipe(N.flatMap(X.exists)),Q.isCurrent(Y)]).pipe(N.map(([G,K,B])=>[...K?["webfetch-hook"]:[],...B?["runtime-skill"]:[],...G?["mcp"]:[]])),install:(Y)=>N.all([Z.install(Y),J.install(Y),Q.install(Y)])})})}){}class bd extends D.TaggedError()("UnsupportedInitHarnessError",{harness:D.String}){get message(){return`No init adapter is registered for ${this.harness}`}}function Zc0(X){let J=new Map(X.map((G)=>[G.harness,G])),Z=N.fn("HarnessRegistry.find")(function*(G){let K=J.get(G);if(K===void 0)return yield*new bd({harness:G});return K}),Q=N.fn("HarnessRegistry.inspect")(function*(G,K){return yield*(yield*Z(G)).inspect(K)}),Y=N.fn("HarnessRegistry.configure")(function*(G,K){return yield*(yield*Z(G)).configure(K)});return{inspect:Q,configure:Y}}class HK extends N.Service()("@expandai/cli/Init/HarnessRegistry",{dependencies:[Sd.Default,xd.Default,kd.Default,vd.Default],effect:N.gen(function*(){let X=yield*N.all([Sd,xd,kd,vd]);return Zc0(X)})}){static fromAdapters=(X)=>HK.make(Zc0(X))}var qu8=D.Literal("authorization_failed","setup_token_rejected","setup_unreachable","stored_credential_conflict","authorization_unreachable","authorization_denied","authorization_refused","credential_health_failed","credential_save_failed","credential_storage_insecure","unsupported_harness","inspection_failed","configuration_failed","policy_blocked","invalid_adapter_result");class yd extends D.TaggedError()("InitServiceError",{code:qu8,recoverable:D.Boolean}){get message(){switch(this.code){case"authorization_failed":return"Authorization could not be completed. Start authorization again.";case"setup_token_rejected":return"That setup token was rejected and is now spent. Do not retry it. Ask the user for a fresh setup prompt from the Expand dashboard, or continue without one to authorize in a browser.";case"setup_unreachable":return"Could not reach Expand to redeem the setup token. Nothing was sent, so the same token is still good — check the network and run the same command again.";case"stored_credential_conflict":return"An Expand API key is already stored on this machine, and completing setup would replace it with no way to recover it. Nothing was changed and the setup prompt is still valid. Tell the user to run `expandai logout` to clear the stored key, then run the same setup command again.";case"authorization_unreachable":return"Could not reach the Expand API. Nothing was changed: any pending authorization is still pending, and if none existed, none was started. Do not retry the same command until the connection is fixed. Check that this machine can reach the API — if you are running inside an agent sandbox, its shell may have network access disabled — and check `EXPAND_API_URL` if it is set. Then run the same command again.";case"authorization_refused":return"Expand refused to complete the authorization for a reason a new code cannot fix — most likely an OAuth client, resource, or scope misconfiguration on the server. Do not run setup again; each retry asks the user to approve and then fails the same way. Report the error under `code`.";case"authorization_denied":return"The authorization was denied in the browser. If that was unintended, run the same command again for a fresh approval code.";case"credential_health_failed":return"Stored credentials could not be validated safely.";case"credential_save_failed":return"Authorization completed, but credentials could not be saved. Start authorization again.";case"credential_storage_insecure":return"Credential storage is not secure enough to continue.";case"unsupported_harness":return"This harness is not supported by init.";case"inspection_failed":return"The harness configuration could not be inspected safely.";case"configuration_failed":return"The harness configuration could not be updated safely.";case"policy_blocked":return"A managed harness policy blocks this configuration.";case"invalid_adapter_result":return"The harness adapter returned an invalid configuration result."}}}function Y6(X,J){return new yd({code:X,recoverable:J})}function Du8(X){return _8.consoleWith((J)=>X.pipe(_8.withConsole({...J,log:()=>N.void})))}function OJ0(X,J){if(typeof X!=="object"||X===null||!(J in X))return;return Object.getOwnPropertyDescriptor(X,J)?.value}function Qc0(X,J){let Z=OJ0(X,J);return typeof Z==="string"?Z:void 0}function Yc0(X,J){let Z=OJ0(X,J);return typeof Z==="boolean"?Z:void 0}function NJ0(X){return X instanceof O2?Y6("credential_storage_insecure",!1):Y6("credential_health_failed",!1)}function wu8(X){if(X instanceof O2)return Y6("credential_storage_insecure",!1);if(X instanceof kz)return Y6("authorization_denied",!0);if(X instanceof bz)return Y6("authorization_refused",!1);if(X instanceof jD)return Y6("credential_save_failed",!1);if(X instanceof CV&&X.kind==="request_failed")return Y6("authorization_unreachable",!0);return Y6("authorization_failed",Yc0(X,"recoverable")??!0)}function Lu8(X){if(X instanceof O2)return Y6("credential_storage_insecure",!1);if(X instanceof Bd){if(X.code==="stored_credential_conflict")return Y6("stored_credential_conflict",!0);if(X.code==="request_failed")return Y6("setup_unreachable",!0);if(X.code==="denied")return Y6("authorization_denied",!0);if(X.code==="credential_save_failed")return Y6("credential_save_failed",!1);if(X.code==="refused")return Y6("authorization_refused",!1);if(X.code==="config_unreadable")return Y6("credential_storage_insecure",!0);return Y6("setup_token_rejected",!0)}return Y6("authorization_failed",Yc0(X,"recoverable")??!0)}function Fu8(X){if(X instanceof bd)return Y6("unsupported_harness",!1);let J=OJ0(X,"error")??X,Z=Qc0(J,"_tag");if(Z==="ClaudeProfilePolicyBlockedError")return Y6("policy_blocked",!1);if(Z==="ClaudeAdapterOperationError"&&Qc0(J,"code")==="inspection_failed")return Y6("inspection_failed",!0);return Y6("configuration_failed",!0)}function Au8(X){return new j70({harness:"agent-harnesses",scope:X.scope})}function Tu8(X){return X.runtimeState==="reload_required"?"reload_required":"unverified"}function Mu8(X,J){if(!J.configured||typeof J.changed!=="boolean")return!1;if(J.integrationVersion===void 0||J.integrationVersion.trim().length===0)return!1;if(J.nextAction.trim().length===0)return!1;let Z=new Set(J.components),Q=X==="opencode";return Z.size===J.components.length&&Z.has("runtime-skill")&&Z.has("mcp")&&(Q?Z.has("webfetch-hook")&&Z.size===3:Z.size===2)}class IR extends N.Service()("@expandai/cli/Init/Service",{dependencies:[g5.Default,q2.Default,CD.Default,HK.Default],effect:N.gen(function*(){let X=yield*g5,J=yield*q2,Z=yield*CD,Q=yield*HK,Y=N.fnUntraced(function*(K,B){let H=yield*N.forEach(K.harnesses,(A)=>Du8(Q.configure(A,K.scope)).pipe(N.withTracerEnabled(!1),N.mapError(Fu8),N.flatMap((M)=>{if(M.policyBlock!==void 0||M.runtimeState==="blocked")return Y6("policy_blocked",!1);if(!Mu8(A,M))return Y6("invalid_adapter_result",!1);return N.succeed({harness:A,configured:M.configured,changed:M.changed,components:M.components,version:M.integrationVersion,verification:{runtimeState:Tu8(M),nextAction:M.nextAction}})}),N.either,N.map((M)=>({harness:A,outcome:M}))),{concurrency:"unbounded"}),W=H8.getRights(H.map(({outcome:A})=>A)),V=H.flatMap(({harness:A,outcome:M})=>F8.isLeft(M)?[{harness:A,code:M.left.code,recoverable:M.left.recoverable}]:[]),U=V[0];if(W.length===0&&U!==void 0)return yield*Y6(U.code,U.recoverable);let O=yield*P0.string("PWD").pipe(P0.withDefault(process.cwd()),N.orElseSucceed(()=>process.cwd())),q={schemaVersion:1,status:"completed",harnesses:K.harnesses,scope:K.scope,userMessage:V.length>0?A70:B?Qd:Yd,auth:{healthy:!0},...K.scope==="project"?{projectPath:O}:{},installations:W,...V.length>0?{failures:V}:{}},L=yield*D.decodeUnknown(_R)(q).pipe(N.mapError(()=>Y6("invalid_adapter_result",!1)));return yield*N.annotateCurrentSpan({status:L.status,harnessCount:W.length,componentCount:W.reduce((A,M)=>A+M.components.length,0)}),L});return{run:N.fn("InitService.run")(function*(K){return yield*N.annotateCurrentSpan({harnessCount:K.harnesses.length,scope:K.scope}),yield*N.gen(function*(){let B=yield*X.hasLocallyUsableCredentials().pipe(N.withTracerEnabled(!1),N.mapError(NJ0));if(K.setupToken!==void 0){if(yield*Z.authorize({setupToken:K.setupToken,harness:"agent-harnesses",scope:K.scope}).pipe(N.withTracerEnabled(!1),N.mapError(Lu8)),!(yield*X.hasLocallyUsableCredentials().pipe(N.withTracerEnabled(!1),N.mapError(NJ0))))return yield*Y6("authorization_failed",!0);return yield*Y(K,!0)}if(B)return yield*Y(K,!1);let H=yield*J.advance(Au8(K)).pipe(N.withTracerEnabled(!1),N.mapError(wu8));if(H._tag==="TokensSaved"){if(!(yield*X.hasLocallyUsableCredentials().pipe(N.withTracerEnabled(!1),N.mapError(NJ0))))return yield*Y6("authorization_failed",!0);return yield*Y(K,!0)}let W={schemaVersion:1,status:"authorization_required",harnesses:K.harnesses,scope:K.scope,userMessage:Zd,authorization:{url:H.pending.verificationUri,userCode:H.pending.userCode,approvalExpiresAt:Q9.formatIso(H.pending.approvalExpiresAt)}},V=yield*D.decodeUnknown(_R)(W).pipe(N.mapError(()=>Y6("authorization_failed",!1)));return yield*N.annotateCurrentSpan({status:V.status,componentCount:0}),V})})}})}){}var Pu8=P8.text("harness").pipe(P8.optional,P8.withDescription("Agent harness running this setup, used as a detection hint")),Ru8=P8.text("harnesses").pipe(P8.optional,P8.withDescription("Comma-separated harnesses to configure. Omit to configure every detected harness.")),ju8=P8.boolean("detect").pipe(P8.withDescription("Report the harnesses setup would configure, and change nothing")),Cu8=P8.text("scope").pipe(P8.optional,P8.withDescription("Configuration scope")),Iu8=P8.text("setup-token").pipe(P8.optional,P8.withDescription("Short-lived, single-use setup token from the Expand dashboard")),Eu8=P8.boolean("json").pipe(P8.withDescription("Emit one machine-readable JSON result")),Gc0={harness:Pu8,harnesses:Ru8,detect:ju8,scope:Cu8,setupToken:Iu8,json:Eu8},Kc0=D.parseJson(IV),Su8=D.parseJson(_R),xu8=D.parseJson(Gd),xV="Agent init requires --scope project|global and --json, or --detect --json to only report detected harnesses. Optional: --harnesses claude-code,cursor,opencode,codex to configure an explicit subset, --harness <name> as a current-harness hint, and --setup-token <token> from a dashboard setup prompt. After the user approves in the browser, run the same command again — there is no code to pass back.",Bc0="claude-code, cursor, opencode, codex",Hc0=`Expand does not support that agent harness. Supported harnesses are ${Bc0}. Do not substitute a different harness: tell the user their agent is not supported yet.`,vu8="That setup token is malformed. Copy it exactly as the dashboard issued it, or create a new one; do not retype or truncate it.",Wc0=`--harnesses takes a comma-separated list drawn from ${Bc0}, for example --harnesses claude-code,cursor. Every entry must be one of those names.`,ku8=/^[A-Za-z0-9._~-]{20,256}$/u;function gd(X,J){return D.encodeSync(Kc0)(new IV({schemaVersion:1,status:"error",code:X,message:J,recoverable:!0}))}function _J0(){return gd("invalid_arguments",xV)}function bu8(X,J,Z){return D.encodeSync(Kc0)(new IV({schemaVersion:1,status:"error",code:X,message:J,recoverable:Z}))}function uZ(X,J,Z,Q){return _8.error(bu8(X,J,Z)).pipe(N.zipRight(N.sync(()=>void(process.exitCode=Q))))}function qJ0(X){let J=X.split(",").map((Q)=>Q.trim()),Z=[];for(let Q of J){let Y=D.decodeUnknownOption(y7)(Q);if(m.isNone(Y))return;if(!Z.includes(Y.value))Z.push(Y.value)}return H8.isNonEmptyArray(Z)?Z:void 0}function yu8(X){return X!==void 0&&X!==""&&X!=="0"&&X!=="false"}function DJ0(X,J){if(X.argv[2]!==J)return;let Z=X.argv.slice(3),Q=X.environment.EXPANDAI_CLI_CONTEXT==="agent"||yu8(X.environment.CLAUDECODE)||X.environment.CURSOR_TRACE_ID!==void 0||X.environment.CODEX_RUN_ID!==void 0;return!X.stdinIsTty||!X.stdoutIsTty||Z.includes("--json")||Q?"machine":"human"}function wJ0(X){return DJ0(X,"init")}function gu8(X){function J(Z,Q){if(Z>=X.length)return Q;let Y=X[Z];if(Y==="--json"&&!Q.json)return J(Z+1,{...Q,json:!0});if(Y==="--detect"&&!Q.detect)return J(Z+1,{...Q,detect:!0});if(Y!=="--setup-token"&&Y!=="--harness"&&Y!=="--harnesses"&&Y!=="--scope")return;let G=X[Z+1];if(G===void 0||G.startsWith("-"))return;if(Y==="--setup-token"&&m.isNone(Q.setupToken))return J(Z+2,{...Q,setupToken:m.some(G)});if(Y==="--harness"&&m.isNone(Q.harness))return J(Z+2,{...Q,harness:m.some(G)});if(Y==="--harnesses"&&m.isNone(Q.harnesses))return J(Z+2,{...Q,harnesses:m.some(G)});if(Y==="--scope"&&m.isNone(Q.scope))return J(Z+2,{...Q,scope:m.some(G)});return}return J(0,{detect:!1,harness:m.none(),harnesses:m.none(),json:!1,scope:m.none(),setupToken:m.none()})}function Vc0(X){if(X[2]!=="init")return;let J=X.slice(3);if(J.length===1&&(J[0]==="--help"||J[0]==="-h"))return;let Z=gu8(J);if(Z===void 0)return _J0();if(!Z.json)return _J0();if(m.isSome(Z.harness)&&m.isNone(D.decodeUnknownOption(y7)(Z.harness.value)))return gd("unsupported_harness",Hc0);if(m.isSome(Z.harnesses)&&qJ0(Z.harnesses.value)===void 0)return gd("invalid_harness_selection",Wc0);if(Z.detect)return;if(!m.contains(Z.scope,"project")&&!m.contains(Z.scope,"global"))return _J0();if(m.isSome(Z.setupToken)&&!ku8.test(Z.setupToken.value))return gd("invalid_setup_token",vu8);return}function hu8(X){if(X.status==="authorization_required")return`Expand authorization required
624
+ ${X.userMessage}
625
+ Open: ${X.authorization.url.toString()}
626
+ Enter code: ${X.authorization.userCode}`;let J=X.installations.map((G)=>G.harness).join(", "),Z=X.failures??[],Q=Z.length>0?"Expand setup incomplete":"Expand setup complete",Y=Z.map((G)=>`${G.harness} (${G.code})`).join(", ");return[Q,X.userMessage,`Configured: ${J}`,...Z.length>0?[`Failed: ${Y}`]:[]].join(`
627
+ `)}var $c0=N.fnUntraced(function*(X,J){let Z=yield*IR,Q=yield*N.either(Z.run(X));if(F8.isLeft(Q)){let G=Q.left;if(G instanceof yd){yield*uZ(G.code,G.message,G.recoverable,1);return}yield*uZ("init_failed","Expand init could not be completed safely.",!0,1);return}if(!J){yield*_8.log(hu8(Q.right));return}let Y=yield*D.encode(Su8)(Q.right).pipe(N.catchAll(()=>uZ("invalid_result","Expand init returned an invalid result.",!1,1)));if(typeof Y==="string")yield*_8.log(Y)}),mu8=N.fnUntraced(function*(X){let J=yield*T2,Z=yield*J.detect({...m.isSome(X)?{hint:X.value}:{}}),Q=yield*J.detectCurrent(),Y=yield*D.encode(xu8)(new Gd({schemaVersion:1,status:"detected",harnesses:Z,...m.isSome(Q)?{current:Q.value}:{},userMessage:Z.length===0?M70:T70})).pipe(N.catchAll(()=>uZ("invalid_result","Expand init returned an invalid result.",!1,1)));if(typeof Y==="string")yield*_8.log(Y)}),Uc0=N.fnUntraced(function*({detect:X,harness:J,harnesses:Z,json:Q,scope:Y,setupToken:G}){if(!Q){yield*uZ("invalid_arguments",xV,!0,2);return}let K=m.flatMap(J,(U)=>D.decodeUnknownOption(y7)(U));if(m.isSome(J)&&m.isNone(K)){yield*uZ("unsupported_harness",Hc0,!0,2);return}if(X){yield*mu8(K);return}if(!m.contains(Y,"project")&&!m.contains(Y,"global")){yield*uZ("invalid_arguments",xV,!0,2);return}let B=m.map(Z,qJ0);if(m.isSome(B)&&B.value===void 0){yield*uZ("invalid_harness_selection",Wc0,!0,2);return}let H=yield*T2,W=m.isSome(B)&&B.value!==void 0?B.value:yield*H.detect({...m.isSome(K)?{hint:K.value}:{}});if(W.length===0){yield*uZ("no_harness_detected","No supported agent harness was detected. Pass --harness with the agent currently running setup.",!0,2);return}let V=yield*D.decodeUnknown(Kd)({harnesses:W,scope:m.getOrUndefined(Y),...m.isSome(G)?{setupToken:G.value}:{}}).pipe(N.catchAll(()=>uZ("invalid_arguments",xV,!0,2).pipe(N.as(void 0))));if(V===void 0)return;yield*$c0(V,!0)});class hd extends N.Service()("@expandai/cli/Commands/InitTerminalInteraction",{effect:N.gen(function*(){let X=yield*z7.Terminal,J=N.fnUntraced(function*(){return yield*cQ.select({message:"Where should Expand be available?",choices:[{title:"All projects for this user",value:"global"},{title:"This project",value:"project"}]}).pipe(N.provideService(z7.Terminal,X))}),Z=N.fnUntraced(function*(Q){return yield*cQ.multiSelect({message:"Which harnesses should Expand configure?",choices:Q.map((Y)=>({title:Y,value:Y,selected:!0}))}).pipe(N.provideService(z7.Terminal,X))});return{chooseScope:J,chooseHarnesses:Z}})}){}var du8=N.fnUntraced(function*(X){let J=yield*T2,Z=yield*J.detect({...m.isSome(X)?{hint:X.value}:{}}),Q=yield*J.detectCurrent();if(Z.length===0){yield*_8.log("No supported agent harness was detected. Nothing was changed.");return}yield*_8.log(["Detected harnesses. Nothing was changed.",...Z.map((Y)=>` ${Y}${m.isSome(Q)&&Q.value===Y?" (this one)":""}`),"","Run `expandai init` to configure them."].join(`
628
+ `))}),uu8=N.fnUntraced(function*(X){if(X.json){yield*Uc0(X);return}let J=m.flatMap(X.harness,(W)=>D.decodeUnknownOption(y7)(W));if(m.isSome(X.harness)&&m.isNone(J)){yield*uZ("invalid_arguments",xV,!0,2);return}if(X.detect){yield*du8(J);return}let Z=yield*hd,Q=m.isSome(X.scope)?X.scope.value:yield*Z.chooseScope(),Y=D.decodeUnknownOption(lQ)(Q);if(m.isNone(Y)){yield*uZ("invalid_arguments",xV,!0,2);return}let G=m.map(X.harnesses,qJ0);if(m.isSome(G)&&G.value===void 0){yield*uZ("invalid_arguments",xV,!0,2);return}let B=(m.isSome(G)?G.value:void 0)??(yield*N.gen(function*(){let V=yield*(yield*T2).detect({...m.isSome(J)?{hint:J.value}:{}});return V.length===0?void 0:yield*Z.chooseHarnesses(V)}));if(B===void 0){yield*uZ("no_harness_detected","No supported agent harness was detected. Re-run with --harness for the agent you want to configure.",!0,2);return}if(!H8.isNonEmptyReadonlyArray(B)){yield*_8.log("No harnesses selected. Nothing was changed.");return}let H=yield*D.decodeUnknown(Kd)({harnesses:B,scope:Y.value,...m.isSome(X.setupToken)?{setupToken:X.setupToken.value}:{}}).pipe(N.catchAll(()=>uZ("invalid_arguments",xV,!0,2).pipe(N.as(void 0))));if(H===void 0)return;if(m.isNone(X.setupToken)){let W=yield*g5,V=yield*N.either(W.hasLocallyUsableCredentials());if(F8.isLeft(V)){yield*uZ("credential_health_failed","Stored credentials could not be validated safely.",!1,1);return}if(!V.right){let U=yield*N.either(W.loginWithBrowser());if(F8.isLeft(U)){yield*uZ("authorization_failed","Browser authorization could not be completed.",!0,1);return}}}yield*$c0(H,X.json)}),zc0="Authorize Expand and configure the complete supported harness profile",Nc0=E0.make("init",Gc0).pipe(E0.withDescription(zc0),E0.withHandler(uu8)),Oc0=E0.make("init",Gc0).pipe(E0.withDescription(zc0),E0.withHandler(Uc0));var _c0=P6.choice([["claude-code","claude-code"],["cursor","cursor"],["opencode","opencode"],["codex","codex"]]),qc0=P6.choice([["global","global"],["project","project"]]),Dc0=E0.make("install",{host:_c0,scope:qc0}).pipe(E0.withDescription("Install the expandai MCP server into the chosen host + scope (e.g. `claude-code global`)"),E0.withHandler(N.fnUntraced(function*({host:X,scope:J}){yield*(yield*y5).install(X,J)}))),wc0=E0.make("uninstall",{host:_c0,scope:qc0}).pipe(E0.withDescription("Remove the expandai MCP server from the chosen host + scope"),E0.withHandler(({host:X,scope:J})=>N.flatMap(y5,(Z)=>Z.uninstall(X,J))));var I2={};y8(I2,{toolkit:()=>Kp8,run:()=>ul0,resource:()=>Bp8,registerToolkit:()=>cl0,registerResource:()=>RZ0,registerPrompt:()=>fl0,prompt:()=>Hp8,layerStdio:()=>Qp8,layerHttpRouter:()=>Gp8,layerHttp:()=>Yp8,layer:()=>Cu,elicit:()=>Wp8,McpServer:()=>DQ});var md=()=>(X)=>o0(()=>{let J=OU(1),Z=[],Q=(...Y)=>VU((G)=>{Z.push([Y,G])});return u(X((...Y)=>Q(...Y)),(Y)=>({...Y,run(G){return J.withPermits(1)(f0(function*(){let K=Q;Q=G;for(let[B,H]of Z)yield*o6(Q(...B),H);return Z=[],yield*sF(c1,()=>{return Q=K,U0})}))}}))});var Lc0=Symbol.for("effect/PrimaryKey");var ER=Symbol.for("@effect/rpc/RpcSchema/Stream"),dd=(X)=>X.ast.annotations[wU]===ER;var gD=(X)=>X.annotations[ER]?I(X.annotations[ER]):S(),Ac0=({failure:X,success:J})=>Object.assign(X6([J,X],{decode:(Z,Q)=>Fc0(W7(wM(Z)),W7(Q)),encode:(Z,Q)=>Fc0(I7(wM(Z)),I7(Q))},{schemaId:ER,[ER]:{success:J,failure:X}}),{success:J,failure:X}),fu8=(X)=>V0(X,pT),Fc0=(X,J)=>(Z,Q,Y)=>h(EX(),(G)=>{if(!fu8(Z))return Y0(new a8(Y,Z));return y(Z.pipe(Ot((K)=>X(K,Q)),ek((K)=>{if(ux(K))return Ut(K);return q9(J(K,Q),{onFailure:P7,onSuccess:Y0})}),oT(G)))});var Tc0=Symbol.for("@effect/rpc/Rpc");var pu8={[Tc0]:Tc0,pipe(){return K0(this,arguments)},setSuccess(X){return M2({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:X,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(X){return M2({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:X,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(X){return M2({_tag:this._tag,payloadSchema:eX(X)?X:$0(X),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(X){return M2({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:new Set([...this.middlewares,X])})},prefix(X){return M2({_tag:`${X}${this._tag}`,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},annotate(X,J){return M2({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:X9(this.annotations,X,J)})},annotateContext(X){return M2({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:CX(this.annotations,X)})}},M2=(X)=>{function J(){}return Object.setPrototypeOf(J,pu8),Object.assign(J,X),J.key=`@effect/rpc/Rpc/${X._tag}`,J},R6=(X,J)=>{let Z=J?.success??yH,Q=J?.error??b4,Y;if(J?.primaryKey)Y=class extends D9(`@effect/rpc/Rpc/${X}`)(J.payload){[Lc0](){return J.primaryKey(this)}};else Y=eX(J?.payload)?J?.payload:J?.payload?$0(J?.payload):yH;return M2({_tag:X,payloadSchema:Y,successSchema:J?.stream?Ac0({success:Z,failure:Q}):Z,errorSchema:J?.stream?b4:Q,defectSchema:J?.defect??e6,annotations:jX(),middlewares:new Set})},Mc0=(X)=>M2({_tag:X._tag,payloadSchema:X,successSchema:X.success,errorSchema:X.failure,defectSchema:e6,annotations:jX(),middlewares:new Set}),FJ0=c0("@effect/rpc/Rpc/exitSchemaCache",()=>new WeakMap),ud=(X)=>{if(FJ0.has(X))return FJ0.get(X);let J=X,Z=new Set([J.errorSchema]),Q=gD(J.successSchema.ast);if(R0(Q))Z.add(Q.value.failure);for(let G of J.middlewares)Z.add(G.failure);let Y=$M({success:R0(Q)?yH:J.successSchema,failure:U8(...Z),defect:J.defectSchema});return FJ0.set(X,Y),Y},lu8=Symbol.for("@effect/rpc/Rpc/Wrapper"),cd=(X)=>(lu8 in X);var JB=(X)=>typeof X==="bigint"?X:BigInt(X),Pc0={_tag:"Eof"};var nu8=JW(e6),AJ0=(X)=>({_tag:"Defect",defect:nu8(X)}),Rc0={_tag:"Pong"};var MJ0;try{MJ0=new TextDecoder}catch(X){}var t0,m5,i=0;var CJ0=[],az=CJ0,SR=0,U6={},XX,P2,h5=0,QG=0,bJ,R2,yY=[],i9,jc0={useRecords:!1,mapsAsObjects:!0};class id{}var IJ0=new id;IJ0.name="MessagePack 0xC1";var vV=!1,Cc0=2,PJ0,RJ0,jJ0;class ZB{constructor(X){if(X){if(X.useRecords===!1&&X.mapsAsObjects===void 0)X.mapsAsObjects=!0;if(X.sequential&&X.trusted!==!1){if(X.trusted=!0,!X.structures&&X.useRecords!=!1){if(X.structures=[],!X.maxSharedStructures)X.maxSharedStructures=0}}if(X.structures)X.structures.sharedLength=X.structures.length;else if(X.getStructures)(X.structures=[]).uninitialized=!0,X.structures.sharedLength=0;if(X.int64AsNumber)X.int64AsType="number"}Object.assign(this,X)}unpack(X,J){if(t0)return ic0(()=>{return nd(),this?this.unpack(X,J):ZB.prototype.unpack.call(jc0,X,J)});if(!X.buffer&&X.constructor===ArrayBuffer)X=typeof Buffer<"u"?Buffer.from(X):new Uint8Array(X);if(typeof J==="object")m5=J.end||X.length,i=J.start||0;else i=0,m5=J>-1?J:X.length;SR=0,QG=0,P2=null,az=CJ0,bJ=null,t0=X;try{i9=X.dataView||(X.dataView=new DataView(X.buffer,X.byteOffset,X.byteLength))}catch(Z){if(t0=null,X instanceof Uint8Array)throw Z;throw Error("Source must be a Uint8Array or Buffer but was a "+(X&&typeof X=="object"?X.constructor.name:typeof X))}if(this instanceof ZB){if(U6=this,this.structures)return XX=this.structures,pd(J);else if(!XX||XX.length>0)XX=[]}else if(U6=jc0,!XX||XX.length>0)XX=[];return pd(J)}unpackMultiple(X,J){let Z,Q=0;try{vV=!0;let Y=X.length,G=this?this.unpack(X,Y):od.unpack(X,Y);if(J){if(J(G,Q,i)===!1)return;while(i<Y)if(Q=i,J(pd(),Q,i)===!1)return}else{Z=[G];while(i<Y)Q=i,Z.push(pd());return Z}}catch(Y){throw Y.lastPosition=Q,Y.values=Z,Y}finally{vV=!1,nd()}}_mergeStructures(X,J){if(RJ0)X=RJ0.call(this,X);if(X=X||[],Object.isFrozen(X))X=X.map((Z)=>Z.slice(0));for(let Z=0,Q=X.length;Z<Q;Z++){let Y=X[Z];if(Y){if(Y.isShared=!0,Z>=32)Y.highByte=Z-32>>5}}X.sharedLength=X.length;for(let Z in J||[])if(Z>=0){let Q=X[Z],Y=J[Z];if(Y){if(Q)(X.restoreStructures||(X.restoreStructures=[]))[Z]=Q;X[Z]=Y}}return this.structures=X}decode(X,J){return this.unpack(X,J)}}function pd(X){try{if(!U6.trusted&&!vV){let Z=XX.sharedLength||0;if(Z<XX.length)XX.length=Z}let J;if(U6.randomAccessStructure&&t0[i]<64&&t0[i]>=32&&PJ0){if(J=PJ0(t0,i,m5,U6),t0=null,!(X&&X.lazy)&&J)J=J.toJSON();i=m5}else J=s7();if(bJ)i=bJ.postBundlePosition,bJ=null;if(vV)XX.restoreStructures=null;if(i==m5){if(XX&&XX.restoreStructures)Ic0();if(XX=null,t0=null,R2)R2=null}else if(i>m5)throw Error("Unexpected end of MessagePack data");else if(!vV){let Z;try{Z=JSON.stringify(J,(Q,Y)=>typeof Y==="bigint"?`${Y}n`:Y).slice(0,100)}catch(Q){Z="(JSON view not available "+Q+")"}throw Error("Data read, but end of buffer not reached "+Z)}return J}catch(J){if(XX&&XX.restoreStructures)Ic0();if(nd(),J instanceof RangeError||J.message.startsWith("Unexpected end of buffer")||i>m5)J.incomplete=!0;throw J}}function Ic0(){for(let X in XX.restoreStructures)XX[X]=XX.restoreStructures[X];XX.restoreStructures=null}function s7(){let X=t0[i++];if(X<160)if(X<128)if(X<64)return X;else{let J=XX[X&63]||U6.getStructures&&gc0()[X&63];if(J){if(!J.read)J.read=EJ0(J,X&63);return J.read()}else return X}else if(X<144)if(X-=128,U6.mapsAsObjects){let J={};for(let Z=0;Z<X;Z++){let Q=lc0();if(Q==="__proto__")Q="__proto_";J[Q]=s7()}return J}else{let J=new Map;for(let Z=0;Z<X;Z++)J.set(s7(),s7());return J}else{X-=144;let J=Array(X);for(let Z=0;Z<X;Z++)J[Z]=s7();if(U6.freezeData)return Object.freeze(J);return J}else if(X<192){let J=X-160;if(QG>=i)return P2.slice(i-h5,(i+=J)-h5);if(QG==0&&m5<140){let Z=J<16?SJ0(J):pc0(J);if(Z!=null)return Z}return ld(J)}else{let J;switch(X){case 192:return null;case 193:if(bJ)if(J=s7(),J>0)return bJ[1].slice(bJ.position1,bJ.position1+=J);else return bJ[0].slice(bJ.position0,bJ.position0-=J);return IJ0;case 194:return!1;case 195:return!0;case 196:if(J=t0[i++],J===void 0)throw Error("Unexpected end of buffer");return TJ0(J);case 197:return J=i9.getUint16(i),i+=2,TJ0(J);case 198:return J=i9.getUint32(i),i+=4,TJ0(J);case 199:return rz(t0[i++]);case 200:return J=i9.getUint16(i),i+=2,rz(J);case 201:return J=i9.getUint32(i),i+=4,rz(J);case 202:if(J=i9.getFloat32(i),U6.useFloat32>2){let Z=tz[(t0[i]&127)<<1|t0[i+1]>>7];return i+=4,(Z*J+(J>0?0.5:-0.5)>>0)/Z}return i+=4,J;case 203:return J=i9.getFloat64(i),i+=8,J;case 204:return t0[i++];case 205:return J=i9.getUint16(i),i+=2,J;case 206:return J=i9.getUint32(i),i+=4,J;case 207:if(U6.int64AsType==="number")J=i9.getUint32(i)*4294967296,J+=i9.getUint32(i+4);else if(U6.int64AsType==="string")J=i9.getBigUint64(i).toString();else if(U6.int64AsType==="auto"){if(J=i9.getBigUint64(i),J<=BigInt(2)<<BigInt(52))J=Number(J)}else J=i9.getBigUint64(i);return i+=8,J;case 208:return i9.getInt8(i++);case 209:return J=i9.getInt16(i),i+=2,J;case 210:return J=i9.getInt32(i),i+=4,J;case 211:if(U6.int64AsType==="number")J=i9.getInt32(i)*4294967296,J+=i9.getUint32(i+4);else if(U6.int64AsType==="string")J=i9.getBigInt64(i).toString();else if(U6.int64AsType==="auto"){if(J=i9.getBigInt64(i),J>=BigInt(-2)<<BigInt(52)&&J<=BigInt(2)<<BigInt(52))J=Number(J)}else J=i9.getBigInt64(i);return i+=8,J;case 212:if(J=t0[i++],J==114)return bc0(t0[i++]&63);else{let Z=yY[J];if(Z)if(Z.read)return i++,Z.read(s7());else if(Z.noBuffer)return i++,Z();else return Z(t0.subarray(i,++i));else throw Error("Unknown extension "+J)}case 213:if(J=t0[i],J==114)return i++,bc0(t0[i++]&63,t0[i++]);else return rz(2);case 214:return rz(4);case 215:return rz(8);case 216:return rz(16);case 217:if(J=t0[i++],QG>=i)return P2.slice(i-h5,(i+=J)-h5);return hc0(J);case 218:if(J=i9.getUint16(i),i+=2,QG>=i)return P2.slice(i-h5,(i+=J)-h5);return mc0(J);case 219:if(J=i9.getUint32(i),i+=4,QG>=i)return P2.slice(i-h5,(i+=J)-h5);return dc0(J);case 220:return J=i9.getUint16(i),i+=2,Sc0(J);case 221:return J=i9.getUint32(i),i+=4,Sc0(J);case 222:return J=i9.getUint16(i),i+=2,xc0(J);case 223:return J=i9.getUint32(i),i+=4,xc0(J);default:if(X>=224)return X-256;if(X===void 0){let Z=Error("Unexpected end of MessagePack data");throw Z.incomplete=!0,Z}throw Error("Unknown MessagePack token "+X)}}}var iu8=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function EJ0(X,J){function Z(){if(Z.count++>Cc0){let Y;try{Y=X.read=Function("r","return function(){return "+(U6.freezeData?"Object.freeze":"")+"({"+X.map((G)=>G==="__proto__"?"__proto_:r()":iu8.test(G)?G+":r()":"["+JSON.stringify(G)+"]:r()").join(",")+"})}")(s7)}catch(G){return Cc0=1/0,Z()}if(X.read0=Y,X.highByte===0)X.read=Ec0(J,X.read);return Y()}let Q={};for(let Y=0,G=X.length;Y<G;Y++){let K=X[Y];if(K==="__proto__")K="__proto_";Q[K]=s7()}if(U6.freezeData)return Object.freeze(Q);return Q}if(Z.count=0,X.read0=Z,X.highByte===0)return Ec0(J,Z);return Z}var Ec0=(X,J)=>{return function(){let Z=t0[i++];if(Z===0)return J();let Q=X<32?-(X+(Z<<5)):X+(Z<<5),Y=XX[Q]||gc0()[Q];if(!Y)throw Error("Record id is not defined for "+Q);if(!Y.read)Y.read=EJ0(Y,X);return Y.read()}};function gc0(){let X=ic0(()=>{return t0=null,U6.getStructures()});return XX=U6._mergeStructures(X,XX)}var ld=sz,hc0=sz,mc0=sz,dc0=sz,uc0=!1;function cc0(X){uc0=!0,ld=J(1),hc0=J(2),mc0=J(3),dc0=J(5);function J(Z){return function(Y){let G=az[SR++];if(G==null){if(bJ)return sz(Y);let B=t0.byteOffset,H=X(i-Z+B,m5+B,t0.buffer);if(typeof H=="string")G=H,az=CJ0;else if(az=H,SR=1,QG=1,G=az[0],G===void 0)throw Error("Unexpected end of buffer")}let K=G.length;if(K<=Y)return i+=Y,G;return P2=G,h5=i,QG=i+K,i+=Y,G.slice(0,Y)}}}function sz(X){let J;if(X<16){if(J=SJ0(X))return J}if(X>64&&MJ0)return MJ0.decode(t0.subarray(i,i+=X));let Z=i+X,Q=[];J="";while(i<Z){let Y=t0[i++];if((Y&128)===0)Q.push(Y);else if((Y&224)===192){let G=t0[i++]&63,K=(Y&31)<<6|G;if(K<128)Q.push(65533);else Q.push(K)}else if((Y&240)===224){let G=t0[i++]&63,K=t0[i++]&63,B=(Y&31)<<12|G<<6|K;if(B<2048||B>=55296&&B<=57343)Q.push(65533);else Q.push(B)}else if((Y&248)===240){let G=t0[i++]&63,K=t0[i++]&63,B=t0[i++]&63,H=(Y&7)<<18|G<<12|K<<6|B;if(H<65536||H>1114111)Q.push(65533);else if(H>65535)H-=65536,Q.push(H>>>10&1023|55296),H=56320|H&1023,Q.push(H);else Q.push(H)}else Q.push(65533);if(Q.length>=4096)J+=HZ.apply(String,Q),Q.length=0}if(Q.length>0)J+=HZ.apply(String,Q);return J}function fc0(X,J,Z){let Q=t0;t0=X,i=J;try{return sz(Z)}finally{t0=Q}}function Sc0(X){let J=Array(X);for(let Z=0;Z<X;Z++)J[Z]=s7();if(U6.freezeData)return Object.freeze(J);return J}function xc0(X){if(U6.mapsAsObjects){let J={};for(let Z=0;Z<X;Z++){let Q=lc0();if(Q==="__proto__")Q="__proto_";J[Q]=s7()}return J}else{let J=new Map;for(let Z=0;Z<X;Z++)J.set(s7(),s7());return J}}var HZ=String.fromCharCode;function pc0(X){let J=i,Z=Array(X);for(let Q=0;Q<X;Q++){let Y=t0[i++];if((Y&128)>0){i=J;return}Z[Q]=Y}return HZ.apply(String,Z)}function SJ0(X){if(X<4)if(X<2)if(X===0)return"";else{let J=t0[i++];if((J&128)>1){i-=1;return}return HZ(J)}else{let J=t0[i++],Z=t0[i++];if((J&128)>0||(Z&128)>0){i-=2;return}if(X<3)return HZ(J,Z);let Q=t0[i++];if((Q&128)>0){i-=3;return}return HZ(J,Z,Q)}else{let J=t0[i++],Z=t0[i++],Q=t0[i++],Y=t0[i++];if((J&128)>0||(Z&128)>0||(Q&128)>0||(Y&128)>0){i-=4;return}if(X<6)if(X===4)return HZ(J,Z,Q,Y);else{let G=t0[i++];if((G&128)>0){i-=5;return}return HZ(J,Z,Q,Y,G)}else if(X<8){let G=t0[i++],K=t0[i++];if((G&128)>0||(K&128)>0){i-=6;return}if(X<7)return HZ(J,Z,Q,Y,G,K);let B=t0[i++];if((B&128)>0){i-=7;return}return HZ(J,Z,Q,Y,G,K,B)}else{let G=t0[i++],K=t0[i++],B=t0[i++],H=t0[i++];if((G&128)>0||(K&128)>0||(B&128)>0||(H&128)>0){i-=8;return}if(X<10)if(X===8)return HZ(J,Z,Q,Y,G,K,B,H);else{let W=t0[i++];if((W&128)>0){i-=9;return}return HZ(J,Z,Q,Y,G,K,B,H,W)}else if(X<12){let W=t0[i++],V=t0[i++];if((W&128)>0||(V&128)>0){i-=10;return}if(X<11)return HZ(J,Z,Q,Y,G,K,B,H,W,V);let U=t0[i++];if((U&128)>0){i-=11;return}return HZ(J,Z,Q,Y,G,K,B,H,W,V,U)}else{let W=t0[i++],V=t0[i++],U=t0[i++],O=t0[i++];if((W&128)>0||(V&128)>0||(U&128)>0||(O&128)>0){i-=12;return}if(X<14)if(X===12)return HZ(J,Z,Q,Y,G,K,B,H,W,V,U,O);else{let q=t0[i++];if((q&128)>0){i-=13;return}return HZ(J,Z,Q,Y,G,K,B,H,W,V,U,O,q)}else{let q=t0[i++],L=t0[i++];if((q&128)>0||(L&128)>0){i-=14;return}if(X<15)return HZ(J,Z,Q,Y,G,K,B,H,W,V,U,O,q,L);let A=t0[i++];if((A&128)>0){i-=15;return}return HZ(J,Z,Q,Y,G,K,B,H,W,V,U,O,q,L,A)}}}}}function vc0(){let X=t0[i++],J;if(X<192)J=X-160;else switch(X){case 217:J=t0[i++];break;case 218:J=i9.getUint16(i),i+=2;break;case 219:J=i9.getUint32(i),i+=4;break;default:throw Error("Expected string")}return sz(J)}function TJ0(X){return U6.copyBuffers?Uint8Array.prototype.slice.call(t0,i,i+=X):t0.subarray(i,i+=X)}function rz(X){let J=t0[i++];if(yY[J]){let Z;return yY[J](t0.subarray(i,Z=i+=X),(Q)=>{i=Q;try{return s7()}finally{i=Z}})}else throw Error("Unknown extension type "+J)}var kc0=Array(4096);function lc0(){let X=t0[i++];if(X>=160&&X<192){if(X=X-160,QG>=i)return P2.slice(i-h5,(i+=X)-h5);else if(!(QG==0&&m5<180))return ld(X)}else return i--,nc0(s7());let J=(X<<5^(X>1?i9.getUint16(i):X>0?t0[i]:0))&4095,Z=kc0[J],Q=i,Y=i+X-3,G,K=0;if(Z&&Z.bytes==X){while(Q<Y){if(G=i9.getUint32(Q),G!=Z[K++]){Q=1879048192;break}Q+=4}Y+=3;while(Q<Y)if(G=t0[Q++],G!=Z[K++]){Q=1879048192;break}if(Q===Y)return i=Q,Z.string;Y-=3,Q=i}Z=[],kc0[J]=Z,Z.bytes=X;while(Q<Y)G=i9.getUint32(Q),Z.push(G),Q+=4;Y+=3;while(Q<Y)G=t0[Q++],Z.push(G);let B=X<16?SJ0(X):pc0(X);if(B!=null)return Z.string=B;return Z.string=ld(X)}function nc0(X){if(typeof X==="string")return X;if(typeof X==="number"||typeof X==="boolean"||typeof X==="bigint")return X.toString();if(X==null)return X+"";if(U6.allowArraysInMapKeys&&Array.isArray(X)&&X.flat().every((J)=>["string","number","boolean","bigint"].includes(typeof J)))return X.flat().toString();throw Error(`Invalid property type for record: ${typeof X}`)}var bc0=(X,J)=>{let Z=s7().map(nc0),Q=X;if(J!==void 0)X=X<32?-((J<<5)+X):(J<<5)+X,Z.highByte=J;let Y=XX[X];if(Y&&(Y.isShared||vV))(XX.restoreStructures||(XX.restoreStructures=[]))[X]=Y;return XX[X]=Z,Z.read=EJ0(Z,Q),(Z.read0||Z.read)()};yY[0]=()=>{};yY[0].noBuffer=!0;yY[66]=(X)=>{let J=X.byteLength%8||8,Z=BigInt(X[0]&128?X[0]-256:X[0]);for(let Q=1;Q<J;Q++)Z<<=BigInt(8),Z+=BigInt(X[Q]);if(X.byteLength!==J){let Q=new DataView(X.buffer,X.byteOffset,X.byteLength),Y=(G,K)=>{let B=K-G;if(B<=40){let U=Q.getBigUint64(G);for(let O=G+8;O<K;O+=8)U<<=BigInt(64),U|=Q.getBigUint64(O);return U}let H=G+(B>>4<<3),W=Y(G,H),V=Y(H,K);return W<<BigInt((K-H)*8)|V};Z=Z<<BigInt((Q.byteLength-J)*8)|Y(J,Q.byteLength)}return Z};var yc0={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError==="function"?AggregateError:null};yY[101]=()=>{let X=s7();if(!yc0[X[0]]){let J=Error(X[1],{cause:X[2]});return J.name=X[0],J}return yc0[X[0]](X[1],{cause:X[2]})};yY[105]=(X)=>{if(U6.structuredClone===!1)throw Error("Structured clone extension is disabled");let J=i9.getUint32(i-4);if(!R2)R2=new Map;let Z=t0[i],Q;if(Z>=144&&Z<160||Z==220||Z==221)Q=[];else if(Z>=128&&Z<144||Z==222||Z==223)Q=new Map;else if((Z>=199&&Z<=201||Z>=212&&Z<=216)&&t0[i+1]===115)Q=new Set;else Q={};let Y={target:Q};R2.set(J,Y);let G=s7();if(!Y.used)return Y.target=G;else Object.assign(Q,G);if(Q instanceof Map)for(let[K,B]of G.entries())Q.set(K,B);if(Q instanceof Set)for(let K of Array.from(G))Q.add(K);return Q};yY[112]=(X)=>{if(U6.structuredClone===!1)throw Error("Structured clone extension is disabled");let J=i9.getUint32(i-4),Z=R2.get(J);return Z.used=!0,Z.target};yY[115]=()=>new Set(s7());var xJ0=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map((X)=>X+"Array"),ou8=typeof globalThis==="object"?globalThis:window;yY[116]=(X)=>{let J=X[0],Z=Uint8Array.prototype.slice.call(X,1).buffer,Q=xJ0[J];if(!Q){if(J===16)return Z;if(J===17)return new DataView(Z);throw Error("Could not find typed array for code "+J)}return new ou8[Q](Z)};yY[120]=()=>{let X=s7();return new RegExp(X[0],X[1])};var ru8=[];yY[98]=(X)=>{let J=(X[0]<<24)+(X[1]<<16)+(X[2]<<8)+X[3],Z=i;return i+=J-X.length,bJ=ru8,bJ=[vc0(),vc0()],bJ.position0=0,bJ.position1=0,bJ.postBundlePosition=i,i=Z,s7()};yY[255]=(X)=>{if(X.length==4)return new Date((X[0]*16777216+(X[1]<<16)+(X[2]<<8)+X[3])*1000);else if(X.length==8)return new Date(((X[0]<<22)+(X[1]<<14)+(X[2]<<6)+(X[3]>>2))/1e6+((X[3]&3)*4294967296+X[4]*16777216+(X[5]<<16)+(X[6]<<8)+X[7])*1000);else if(X.length==12)return new Date(((X[0]<<24)+(X[1]<<16)+(X[2]<<8)+X[3])/1e6+((X[4]&128?-281474976710656:0)+X[6]*1099511627776+X[7]*4294967296+X[8]*16777216+(X[9]<<16)+(X[10]<<8)+X[11])*1000);else return new Date("invalid")};function ic0(X){if(jJ0)jJ0();let J=m5,Z=i,Q=SR,Y=h5,G=QG,K=P2,B=az,H=R2,W=bJ,V=new Uint8Array(t0.slice(0,m5)),U=XX,O=XX.slice(0,XX.length),q=U6,L=vV,A=X();return m5=J,i=Z,SR=Q,h5=Y,QG=G,P2=K,az=B,R2=H,bJ=W,t0=V,vV=L,XX=U,XX.splice(0,XX.length,...O),U6=q,i9=new DataView(t0.buffer,t0.byteOffset,t0.byteLength),A}function nd(){t0=null,R2=null,XX=null}var tz=Array(147);for(let X=0;X<256;X++)tz[X]=+("1e"+Math.floor(45.15-X*0.30103));var od=new ZB({useRecords:!1}),au8=od.unpack,su8=od.unpackMultiple,tu8=od.unpack;var eu8=new Float32Array(1),GO9=new Uint8Array(eu8.buffer,0,4);function oc0(X,J,Z){PJ0=X,RJ0=J,jJ0=Z}var ad;try{ad=new TextEncoder}catch(X){}var bJ0,yJ0,hD=typeof Buffer<"u",rd=hD?function(X){return Buffer.allocUnsafeSlow(X)}:Uint8Array,ec0=hD?Buffer:Uint8Array,rc0=hD?4294967296:2144337920,H0,xR,z6,e=0,qQ,O7=null,Xf0,Xc8=21760,Jc8=/[\u0080-\uFFFF]/,WK=Symbol("record-id");class mD extends ZB{constructor(X){super(X);this.offset=0;let J,Z,Q,Y,G,K=ec0.prototype.utf8Write?function(b,a){return H0.utf8Write(b,a,H0.byteLength-a)}:ad&&ad.encodeInto?function(b,a){return ad.encodeInto(b,H0.subarray(a)).written}:!1,B=this;if(!X)X={};let H=X&&X.sequential,W=X.structures||X.saveStructures,V=X.maxSharedStructures;if(V==null)V=W?32:0;if(V>8160)throw Error("Maximum maxSharedStructure is 8160");if(X.structuredClone&&X.moreTypes==null)this.moreTypes=!0;let U=X.maxOwnStructures;if(U==null)U=W?32:64;if(!this.structures&&X.useRecords!=!1)this.structures=[];let O=V>32||U+V>64,q=V+64,L=V+U+64;if(L>8256)throw Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let A=[],M=0,x=0;this.pack=this.encode=function(b,a){if(!H0)H0=new rd(8192),z6=H0.dataView||(H0.dataView=new DataView(H0.buffer,0,8192)),e=0;if(qQ=H0.length-10,qQ-e<2048)H0=new rd(H0.length),z6=H0.dataView||(H0.dataView=new DataView(H0.buffer,0,H0.length)),qQ=H0.length-10,e=0;else e=e+7&2147483640;if(Z=e,a&Kf0)e+=a&255;if(G=B.structuredClone?new Map:null,B.bundleStrings&&typeof b!=="string")O7=[],O7.size=1/0;else O7=null;if(Y=B.structures,Y){if(Y.uninitialized)Y=B._mergeStructures(B.getStructures());let r=Y.sharedLength||0;if(r>V)throw Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+Y.sharedLength);if(!Y.transitions){Y.transitions=Object.create(null);for(let J0=0;J0<r;J0++){let F0=Y[J0];if(!F0)continue;let Z8,J8=Y.transitions;for(let S8=0,b8=F0.length;S8<b8;S8++){let j6=F0[S8];if(Z8=J8[j6],!Z8)Z8=J8[j6]=Object.create(null);J8=Z8}J8[WK]=J0+64}this.lastNamedStructuresLength=r}if(!H)Y.nextId=r+64}if(Q)Q=!1;let n;try{if(B.randomAccessStructure&&!B.readOnlyStructures&&b&&typeof b==="object")if(b.constructor===Object)W0(b);else if(b.constructor!==Map&&!Array.isArray(b)&&!yJ0.some((J0)=>b instanceof J0))W0(b.toJSON?b.toJSON():b);else E(b);else E(b);let r=O7;if(O7)sc0(Z,E,0);if(G&&G.idsToInsert){let J0=G.idsToInsert.sort((S8,b8)=>S8.offset>b8.offset?1:-1),F0=J0.length,Z8=-1;while(r&&F0>0){let S8=J0[--F0].offset+Z;if(S8<r.stringsPosition+Z&&Z8===-1)Z8=0;if(S8>r.position+Z){if(Z8>=0)Z8+=6}else{if(Z8>=0)z6.setUint32(r.position+Z,z6.getUint32(r.position+Z)+Z8),Z8=-1;r=r.previous,F0++}}if(Z8>=0&&r)z6.setUint32(r.position+Z,z6.getUint32(r.position+Z)+Z8);if(e+=J0.length*6,e>qQ)f(e);B.offset=e;let J8=Zc8(H0.subarray(Z,e),J0);return G=null,J8}if(B.offset=e,a&Yf0)return H0.start=Z,H0.end=e,H0;return H0.subarray(Z,e)}catch(r){throw n=r,r}finally{if(Y){if(j(),Q&&B.saveStructures){let r=Y.sharedLength||0,J0=H0.subarray(Z,e),F0=Jf0(Y,B);if(!n){if(B.saveStructures(F0,F0.isCompatible)===!1)return Y.uninitialized=!0,B.pack(b,a);if(B.lastNamedStructuresLength=r,H0.length>1073741824)H0=null;return J0}}}if(H0.length>1073741824)H0=null;if(a&Gf0)e=Z}};let j=()=>{if(x<10)x++;let b=Y.sharedLength||0;if(Y.length>b&&!H)Y.length=b;if(M>1e4){if(Y.transitions=null,x=0,M=0,A.length>0)A=[]}else if(A.length>0&&!H){for(let a=0,n=A.length;a<n;a++)A[a][WK]=0;A=[]}},T=(b)=>{var a=b.length;if(a<16)H0[e++]=144|a;else if(a<65536)H0[e++]=220,H0[e++]=a>>8,H0[e++]=a&255;else H0[e++]=221,z6.setUint32(e,a),e+=4;for(let n=0;n<a;n++)E(b[n])},E=(b)=>{if(e>qQ)H0=f(e);var a=typeof b,n;if(a==="string"){let r=b.length;if(O7&&r>=4&&r<4096){if((O7.size+=r)>Xc8){let J8,S8=(O7[0]?O7[0].length*3+O7[1].length:0)+10;if(e+S8>qQ)H0=f(e+S8);let b8;if(O7.position)b8=O7,H0[e]=200,e+=3,H0[e++]=98,J8=e-Z,e+=4,sc0(Z,E,0),z6.setUint16(J8+Z-3,e-Z-J8);else H0[e++]=214,H0[e++]=98,J8=e-Z,e+=4;O7=["",""],O7.previous=b8,O7.size=0,O7.position=J8}let Z8=Jc8.test(b);O7[Z8?0:1]+=b,H0[e++]=193,E(Z8?-r:r);return}let J0;if(r<32)J0=1;else if(r<256)J0=2;else if(r<65536)J0=3;else J0=5;let F0=r*3;if(e+F0>qQ)H0=f(e+F0);if(r<64||!K){let Z8,J8,S8,b8=e+J0;for(Z8=0;Z8<r;Z8++)if(J8=b.charCodeAt(Z8),J8<128)H0[b8++]=J8;else if(J8<2048)H0[b8++]=J8>>6|192,H0[b8++]=J8&63|128;else if((J8&64512)===55296&&((S8=b.charCodeAt(Z8+1))&64512)===56320)J8=65536+((J8&1023)<<10)+(S8&1023),Z8++,H0[b8++]=J8>>18|240,H0[b8++]=J8>>12&63|128,H0[b8++]=J8>>6&63|128,H0[b8++]=J8&63|128;else H0[b8++]=J8>>12|224,H0[b8++]=J8>>6&63|128,H0[b8++]=J8&63|128;n=b8-e-J0}else n=K(b,e+J0);if(n<32)H0[e++]=160|n;else if(n<256){if(J0<2)H0.copyWithin(e+2,e+1,e+1+n);H0[e++]=217,H0[e++]=n}else if(n<65536){if(J0<3)H0.copyWithin(e+3,e+2,e+2+n);H0[e++]=218,H0[e++]=n>>8,H0[e++]=n&255}else{if(J0<5)H0.copyWithin(e+5,e+3,e+3+n);H0[e++]=219,z6.setUint32(e,n),e+=4}e+=n}else if(a==="number")if(b>>>0===b)if(b<32||b<128&&this.useRecords===!1||b<64&&!this.randomAccessStructure)H0[e++]=b;else if(b<256)H0[e++]=204,H0[e++]=b;else if(b<65536)H0[e++]=205,H0[e++]=b>>8,H0[e++]=b&255;else H0[e++]=206,z6.setUint32(e,b),e+=4;else if(b>>0===b)if(b>=-32)H0[e++]=256+b;else if(b>=-128)H0[e++]=208,H0[e++]=b+256;else if(b>=-32768)H0[e++]=209,z6.setInt16(e,b),e+=2;else H0[e++]=210,z6.setInt32(e,b),e+=4;else{let r;if((r=this.useFloat32)>0&&b<4294967296&&b>=-2147483648){H0[e++]=202,z6.setFloat32(e,b);let J0;if(r<4||(J0=b*tz[(H0[e]&127)<<1|H0[e+1]>>7])>>0===J0){e+=4;return}else e--}H0[e++]=203,z6.setFloat64(e,b),e+=8}else if(a==="object"||a==="function")if(!b)H0[e++]=192;else{if(G){let J0=G.get(b);if(J0){if(!J0.id){let F0=G.idsToInsert||(G.idsToInsert=[]);J0.id=F0.push(J0)}H0[e++]=214,H0[e++]=112,z6.setUint32(e,J0.id),e+=4;return}else G.set(b,{offset:e-Z})}let r=b.constructor;if(r===Object)v(b);else if(r===Array)T(b);else if(r===Map)if(this.mapAsEmptyObject)H0[e++]=128;else{if(n=b.size,n<16)H0[e++]=128|n;else if(n<65536)H0[e++]=222,H0[e++]=n>>8,H0[e++]=n&255;else H0[e++]=223,z6.setUint32(e,n),e+=4;for(let[J0,F0]of b)E(J0),E(F0)}else{for(let J0=0,F0=bJ0.length;J0<F0;J0++){let Z8=yJ0[J0];if(b instanceof Z8){let J8=bJ0[J0];if(J8.write){if(J8.type)H0[e++]=212,H0[e++]=J8.type,H0[e++]=0;let GB=J8.write.call(this,b);if(GB===b)if(Array.isArray(b))T(b);else v(b);else E(GB);return}let S8=H0,b8=z6,j6=e;H0=null;let WZ;try{WZ=J8.pack.call(this,b,(GB)=>{if(H0=S8,S8=null,e+=GB,e>qQ)f(e);return{target:H0,targetView:z6,position:e-GB}},E)}finally{if(S8)H0=S8,z6=b8,e=j6,qQ=H0.length-10}if(WZ){if(WZ.length+e>qQ)f(WZ.length+e);e=ac0(WZ,H0,e,J8.type)}return}}if(Array.isArray(b))T(b);else{if(b.toJSON){let J0=b.toJSON();if(J0!==b)return E(J0)}if(a==="function")return E(this.writeFunction&&this.writeFunction(b));v(b)}}}else if(a==="boolean")H0[e++]=b?195:194;else if(a==="bigint"){if(b<9223372036854776000&&b>=-9223372036854776000)H0[e++]=211,z6.setBigInt64(e,b);else if(b<18446744073709552000&&b>0)H0[e++]=207,z6.setBigUint64(e,b);else if(this.largeBigIntToFloat)H0[e++]=203,z6.setFloat64(e,Number(b));else if(this.largeBigIntToString)return E(b.toString());else if(this.useBigIntExtension||this.moreTypes){let r=b<0?BigInt(-1):BigInt(0),J0;if(b>>BigInt(65536)===r){let F0=BigInt(18446744073709552000)-BigInt(1),Z8=[];while(!0){if(Z8.push(b&F0),b>>BigInt(63)===r)break;b>>=BigInt(64)}J0=new Uint8Array(new BigUint64Array(Z8).buffer),J0.reverse()}else{let F0=b<0,Z8=(F0?~b:b).toString(16);if(Z8.length%2)Z8="0"+Z8;else if(parseInt(Z8.charAt(0),16)>=8)Z8="00"+Z8;if(hD)J0=Buffer.from(Z8,"hex");else{J0=new Uint8Array(Z8.length/2);for(let J8=0;J8<J0.length;J8++)J0[J8]=parseInt(Z8.slice(J8*2,J8*2+2),16)}if(F0)for(let J8=0;J8<J0.length;J8++)J0[J8]=~J0[J8]}if(J0.length+e>qQ)f(J0.length+e);e=ac0(J0,H0,e,66);return}else throw RangeError(b+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string");e+=8}else if(a==="undefined")if(this.encodeUndefinedAsNil)H0[e++]=192;else H0[e++]=212,H0[e++]=0,H0[e++]=0;else throw Error("Unknown type: "+a)},k=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?(b)=>{let a;if(this.skipValues){a=[];for(let J0 in b)if((typeof b.hasOwnProperty!=="function"||b.hasOwnProperty(J0))&&!this.skipValues.includes(b[J0]))a.push(J0)}else a=Object.keys(b);let n=a.length;if(n<16)H0[e++]=128|n;else if(n<65536)H0[e++]=222,H0[e++]=n>>8,H0[e++]=n&255;else H0[e++]=223,z6.setUint32(e,n),e+=4;let r;if(this.coercibleKeyAsNumber)for(let J0=0;J0<n;J0++){r=a[J0];let F0=Number(r);E(isNaN(F0)?r:F0),E(b[r])}else for(let J0=0;J0<n;J0++)E(r=a[J0]),E(b[r])}:(b)=>{H0[e++]=222;let a=e-Z;e+=2;let n=0;for(let r in b)if(typeof b.hasOwnProperty!=="function"||b.hasOwnProperty(r))E(r),E(b[r]),n++;if(n>65535)throw Error('Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object');H0[a+++Z]=n>>8,H0[a+Z]=n&255},P=this.useRecords===!1?k:X.progressiveRecords&&!O?(b)=>{let a,n=Y.transitions||(Y.transitions=Object.create(null)),r=e++-Z,J0;for(let F0 in b)if(typeof b.hasOwnProperty!=="function"||b.hasOwnProperty(F0)){if(a=n[F0],a)n=a;else{let Z8=Object.keys(b),J8=n;n=Y.transitions;let S8=0;for(let b8=0,j6=Z8.length;b8<j6;b8++){let WZ=Z8[b8];if(a=n[WZ],!a)a=n[WZ]=Object.create(null),S8++;n=a}if(r+Z+1==e)e--,s(n,Z8,S8);else l(n,Z8,r,S8);J0=!0,n=J8[F0]}E(b[F0])}if(!J0){let F0=n[WK];if(F0)H0[r+Z]=F0;else l(n,Object.keys(b),r,0)}}:(b)=>{let a,n=Y.transitions||(Y.transitions=Object.create(null)),r=0;for(let F0 in b)if(typeof b.hasOwnProperty!=="function"||b.hasOwnProperty(F0)){if(a=n[F0],!a)a=n[F0]=Object.create(null),r++;n=a}let J0=n[WK];if(J0)if(J0>=96&&O)H0[e++]=((J0-=96)&31)+96,H0[e++]=J0>>5;else H0[e++]=J0;else s(n,n.__keys__||Object.keys(b),r);for(let F0 in b)if(typeof b.hasOwnProperty!=="function"||b.hasOwnProperty(F0))E(b[F0])},C=typeof this.useRecords=="function"&&this.useRecords,v=C?(b)=>{C(b)?P(b):k(b)}:P,f=(b)=>{let a;if(b>16777216){if(b-Z>rc0)throw Error("Packed buffer would be larger than maximum buffer size");a=Math.min(rc0,Math.round(Math.max((b-Z)*(b>67108864?1.25:2),4194304)/4096)*4096)}else a=(Math.max(b-Z<<2,H0.length-1)>>12)+1<<12;let n=new rd(a);if(z6=n.dataView||(n.dataView=new DataView(n.buffer,0,a)),b=Math.min(b,H0.length),H0.copy)H0.copy(n,0,Z,b);else n.set(H0.slice(Z,b));return e-=Z,Z=0,qQ=n.length-10,H0=n},s=(b,a,n)=>{let r=Y.nextId;if(!r)r=64;if(r<q&&this.shouldShareStructure&&!this.shouldShareStructure(a)){if(r=Y.nextOwnId,!(r<L))r=q;Y.nextOwnId=r+1}else{if(r>=L)r=q;Y.nextId=r+1}let J0=a.highByte=r>=96&&O?r-96>>5:-1;if(b[WK]=r,b.__keys__=a,Y[r-64]=a,r<q)if(a.isShared=!0,Y.sharedLength=r-63,Q=!0,J0>=0)H0[e++]=(r&31)+96,H0[e++]=J0;else H0[e++]=r;else{if(J0>=0)H0[e++]=213,H0[e++]=114,H0[e++]=(r&31)+96,H0[e++]=J0;else H0[e++]=212,H0[e++]=114,H0[e++]=r;if(n)M+=x*n;if(A.length>=U)A.shift()[WK]=0;A.push(b),E(a)}},l=(b,a,n,r)=>{let J0=H0,F0=e,Z8=qQ,J8=Z;if(H0=xR,e=0,Z=0,!H0)xR=H0=new rd(8192);qQ=H0.length-10,s(b,a,r),xR=H0;let S8=e;if(H0=J0,e=F0,qQ=Z8,Z=J8,S8>1){let b8=e+S8-1;if(b8>qQ)f(b8);let j6=n+Z;H0.copyWithin(j6+S8,j6+1,e),H0.set(xR.slice(0,S8),j6),e=b8}else H0[n+Z]=xR[0]},W0=(b)=>{let a=Xf0(b,H0,Z,e,Y,f,(n,r,J0)=>{if(J0)return Q=!0;e=r;let F0=H0;if(E(n),j(),F0!==H0)return{position:e,targetView:z6,target:H0};return e},this);if(a===0)return v(b);e=a}}useBuffer(X){H0=X,H0.dataView||(H0.dataView=new DataView(H0.buffer,H0.byteOffset,H0.byteLength)),z6=H0.dataView,e=0}set position(X){e=X}get position(){return e}clearSharedData(){if(this.structures)this.structures=[];if(this.typedStructs)this.typedStructs=[]}}yJ0=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,id];bJ0=[{pack(X,J,Z){let Q=X.getTime()/1000;if((this.useTimestamp32||X.getMilliseconds()===0)&&Q>=0&&Q<4294967296){let{target:Y,targetView:G,position:K}=J(6);Y[K++]=214,Y[K++]=255,G.setUint32(K,Q)}else if(Q>0&&Q<4294967296){let{target:Y,targetView:G,position:K}=J(10);Y[K++]=215,Y[K++]=255,G.setUint32(K,X.getMilliseconds()*4000000+(Q/1000/4294967296>>0)),G.setUint32(K+4,Q)}else if(isNaN(Q)){if(this.onInvalidDate)return J(0),Z(this.onInvalidDate());let{target:Y,targetView:G,position:K}=J(3);Y[K++]=212,Y[K++]=255,Y[K++]=255}else{let{target:Y,targetView:G,position:K}=J(15);Y[K++]=199,Y[K++]=12,Y[K++]=255,G.setUint32(K,X.getMilliseconds()*1e6),G.setBigInt64(K+4,BigInt(Math.floor(Q)))}}},{pack(X,J,Z){if(this.setAsEmptyObject)return J(0),Z({});let Q=Array.from(X),{target:Y,position:G}=J(this.moreTypes?3:0);if(this.moreTypes)Y[G++]=212,Y[G++]=115,Y[G++]=0;Z(Q)}},{pack(X,J,Z){let{target:Q,position:Y}=J(this.moreTypes?3:0);if(this.moreTypes)Q[Y++]=212,Q[Y++]=101,Q[Y++]=0;Z([X.name,X.message,X.cause])}},{pack(X,J,Z){let{target:Q,position:Y}=J(this.moreTypes?3:0);if(this.moreTypes)Q[Y++]=212,Q[Y++]=120,Q[Y++]=0;Z([X.source,X.flags])}},{pack(X,J){if(this.moreTypes)vJ0(X,16,J);else kJ0(hD?Buffer.from(X):new Uint8Array(X),J)}},{pack(X,J){let Z=X.constructor;if(Z!==ec0&&this.moreTypes)vJ0(X,xJ0.indexOf(Z.name),J);else kJ0(X,J)}},{pack(X,J){if(this.moreTypes)vJ0(X,17,J);else kJ0(hD?Buffer.from(X):new Uint8Array(X),J)}},{pack(X,J){let{target:Z,position:Q}=J(1);Z[Q]=193}}];function vJ0(X,J,Z,Q){let Y=X.byteLength;if(Y+1<256){var{target:G,position:K}=Z(4+Y);G[K++]=199,G[K++]=Y+1}else if(Y+1<65536){var{target:G,position:K}=Z(5+Y);G[K++]=200,G[K++]=Y+1>>8,G[K++]=Y+1&255}else{var{target:G,position:K,targetView:B}=Z(7+Y);G[K++]=201,B.setUint32(K,Y+1),K+=4}if(G[K++]=116,G[K++]=J,!X.buffer)X=new Uint8Array(X);G.set(new Uint8Array(X.buffer,X.byteOffset,X.byteLength),K)}function kJ0(X,J){let Z=X.byteLength;var Q,Y;if(Z<256){var{target:Q,position:Y}=J(Z+2);Q[Y++]=196,Q[Y++]=Z}else if(Z<65536){var{target:Q,position:Y}=J(Z+3);Q[Y++]=197,Q[Y++]=Z>>8,Q[Y++]=Z&255}else{var{target:Q,position:Y,targetView:G}=J(Z+5);Q[Y++]=198,G.setUint32(Y,Z),Y+=4}Q.set(X,Y)}function ac0(X,J,Z,Q){let Y=X.length;switch(Y){case 1:J[Z++]=212;break;case 2:J[Z++]=213;break;case 4:J[Z++]=214;break;case 8:J[Z++]=215;break;case 16:J[Z++]=216;break;default:if(Y<256)J[Z++]=199,J[Z++]=Y;else if(Y<65536)J[Z++]=200,J[Z++]=Y>>8,J[Z++]=Y&255;else J[Z++]=201,J[Z++]=Y>>24,J[Z++]=Y>>16&255,J[Z++]=Y>>8&255,J[Z++]=Y&255}return J[Z++]=Q,J.set(X,Z),Z+=Y,Z}function Zc8(X,J){let Z,Q=J.length*6,Y=X.length-Q;while(Z=J.pop()){let{offset:G,id:K}=Z;X.copyWithin(G+Q,G,Y),Q-=6;let B=G+Q;X[B++]=214,X[B++]=105,X[B++]=K>>24,X[B++]=K>>16&255,X[B++]=K>>8&255,X[B++]=K&255,Y=G}return X}function sc0(X,J,Z){if(O7.length>0){z6.setUint32(O7.position+X,e+Z-O7.position-X),O7.stringsPosition=e-X;let Q=O7;O7=null,J(Q[0]),J(Q[1])}}function Jf0(X,J){return X.isCompatible=(Z)=>{let Q=!Z||(J.lastNamedStructuresLength||0)===Z.length;if(!Q)J._mergeStructures(Z);return Q},X}function Zf0(X,J){Xf0=X,Jf0=J}var Qf0=new mD({useRecords:!1}),Qc8=Qf0.pack,Yc8=Qf0.pack;var Yf0=512,Gf0=1024,Kf0=2048;var hJ0=3,uD=0,vR=2,sd=1,dJ0=16,uJ0=["num","object","string","ascii"];uJ0[dJ0]="date";var Kc8=[!1,!0,!0,!1,!1,!0,!0,!1],Hf0;try{Function(""),Hf0=!0}catch(X){}var ez,Bc8=typeof Buffer<"u",td,QB;try{td=new TextEncoder}catch(X){}var Hc8=Bc8?function(X,J,Z){return X.utf8Write(J,Z,X.byteLength-Z)}:td&&td.encodeInto?function(X,J,Z){return td.encodeInto(J,X.subarray(Z)).written}:!1,NO9=Symbol("type"),OO9=Symbol("parent");Zf0(Wf0,zc8);function Wf0(X,J,Z,Q,Y,G,K,B,H){let W=B.typedStructs||(B.typedStructs=[]),V=B.maxOwnStructures??1/0,U=!H&&W.length>=V,O=J.dataView,q=(W.lastStringStart||100)+Q,L=J.length-10,A=Q;if(Q>L)J=G(Q),O=J.dataView,Q-=Z,A-=Z,q-=Z,Z=0,L=J.length-10;let M,x=q,j=W.transitions||(W.transitions=Object.create(null)),T=W.nextId||W.length,E=T<15?1:T<240?2:T<61440?3:T<15728640?4:0;if(E===0)return 0;Q+=E;let k=[],P,C=0;for(let s in X){let l=j[s];if(!l){if(U)return 0;j[s]=l={key:s,parent:j,enumerationOffset:0,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null,date64:null}}let W0=X[s];if(Q>L)J=G(Q),O=J.dataView,Q-=Z,A-=Z,q-=Z,x-=Z,Z=0,L=J.length-10;switch(typeof W0){case"number":let b=W0;if(T<200||!l.num64){if(b>>0===b&&b<536870912&&b>-520093696){if(b<246&&b>=0&&(l.num8&&!(T>200&&l.num32)||b<32&&!l.num32))j=l.num8||VK(l,uD,1,U),J[Q++]=b;else j=l.num32||VK(l,uD,4,U),O.setUint32(Q,b,!0),Q+=4;break}else if(b<4294967296&&b>=-2147483648){if(O.setFloat32(Q,b,!0),Kc8[J[Q+3]>>>5]){let J0;if((J0=b*tz[(J[Q+3]&127)<<1|J[Q+2]>>7])>>0===J0){j=l.num32||VK(l,uD,4,U),Q+=4;break}}}}j=l.num64||VK(l,uD,8,U),O.setFloat64(Q,b,!0),Q+=8;break;case"string":let a=W0.length;if(M=x-q,(a<<2)+x>L)J=G((a<<2)+x),O=J.dataView,Q-=Z,A-=Z,q-=Z,x-=Z,Z=0,L=J.length-10;if(a>65280+M>>2){k.push(s,W0,Q-A);break}let n,r=x;if(a<64){let J0,F0,Z8;for(J0=0;J0<a;J0++)if(F0=W0.charCodeAt(J0),F0<128)J[x++]=F0;else if(F0<2048)n=!0,J[x++]=F0>>6|192,J[x++]=F0&63|128;else if((F0&64512)===55296&&((Z8=W0.charCodeAt(J0+1))&64512)===56320)n=!0,F0=65536+((F0&1023)<<10)+(Z8&1023),J0++,J[x++]=F0>>18|240,J[x++]=F0>>12&63|128,J[x++]=F0>>6&63|128,J[x++]=F0&63|128;else n=!0,J[x++]=F0>>12|224,J[x++]=F0>>6&63|128,J[x++]=F0&63|128}else x+=Hc8(J,W0,x),n=x-r>a;if(M<160||M<246&&(l.ascii8||l.string8)){if(n){if(!(j=l.string8))if(W.length>10&&(j=l.ascii8))j.__type=vR,l.ascii8=null,l.string8=j,K(null,0,!0);else j=VK(l,vR,1,U)}else if(M===0&&!P){P=!0,j=l.ascii0||VK(l,hJ0,0,U);break}else if(!(j=l.ascii8)&&!(W.length>10&&(j=l.string8)))j=VK(l,hJ0,1,U);J[Q++]=M}else j=l.string16||VK(l,vR,2,U),O.setUint16(Q,M,!0),Q+=2;break;case"object":if(W0){if(W0.constructor===Date)j=l.date64||VK(l,dJ0,8,U),O.setFloat64(Q,W0.getTime(),!0),Q+=8;else k.push(s,W0,C);break}else if(l=Bf0(l,Q,O,-10),l)j=l,Q=ez;else k.push(s,W0,C);break;case"boolean":j=l.num8||l.ascii8||VK(l,uD,1,U),J[Q++]=W0?249:248;break;case"undefined":if(l=Bf0(l,Q,O,-9),l)j=l,Q=ez;else k.push(s,W0,C);break;default:k.push(s,W0,C)}if(j===void 0)return 0;C++}if(!H&&k.length>0&&W.length>=V){let s=j;for(let l=0,W0=k.length;l<W0;l+=3){if(k[l+1]!=null)return 0;let b=s[k[l]];if(!b)return 0;let a=b.object16;if(!a)return 0;s=a}if(s[WK]==null)return 0}let v=!1;for(let s=0,l=k.length;s<l;){let W0=k[s++],b=k[s++],a=k[s++],n=j[W0];if(!n)j[W0]=n={key:W0,parent:j,enumerationOffset:a-C,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null};let r;if(b){let J0;if(M=x-q,M<65280)if(j=n.object16,j)J0=2;else if(j=n.object32)J0=4;else j=gJ0(n,sd,2),J0=2;else j=n.object32||gJ0(n,sd,4),J0=4;if(r=K(b,x),v=!0,typeof r==="object")x=r.position,O=r.targetView,J=r.target,q-=Z,Q-=Z,A-=Z,Z=0;else x=r;if(J0===2)O.setUint16(Q,M,!0),Q+=2;else O.setUint32(Q,M,!0),Q+=4}else j=n.object16||gJ0(n,sd,2),O.setInt16(Q,b===null?-10:-9,!0),Q+=2;C++}let f=j[WK];if(f==null){if(!v&&W.length>=V)return 0;f=B.typedStructs.length;let s=[],l=j,W0,b;while((b=l.__type)!==void 0){let a=l.__size;l=l.__parent,W0=l.key;let n=[b,a,W0];if(l.enumerationOffset)n.push(l.enumerationOffset);s.push(n),l=l.parent}s.reverse(),j[WK]=f,B.typedStructs[f]=s,K(null,0,!0)}switch(E){case 1:if(f>=16)return 0;J[A]=f+32;break;case 2:if(f>=256)return 0;J[A]=56,J[A+1]=f;break;case 3:if(f>=65536)return 0;J[A]=57,O.setUint16(A+1,f,!0);break;case 4:if(f>=16777216)return 0;O.setUint32(A,(f<<8)+58,!0);break}if(Q<q){if(q===x)return Q;J.copyWithin(Q,q,x),x+=Q-q,W.lastStringStart=Q-A}else if(Q>q){if(q===x)return Q;return W.lastStringStart=Q-A,Wf0(X,J,Z,A,Y,G,K,B,!0)}return x}function Bf0(X,J,Z,Q){let Y;if(Y=X.ascii8||X.num8)return Z.setInt8(J,Q,!0),ez=J+1,Y;if(Y=X.string16||X.object16)return Z.setInt16(J,Q,!0),ez=J+2,Y;if(Y=X.num32)return Z.setUint32(J,3758096640+Q,!0),ez=J+4,Y;if(Y=X.num64)return Z.setFloat64(J,NaN,!0),Z.setInt8(J,Q),ez=J+8,Y;ez=J;return}function VK(X,J,Z,Q){let Y=uJ0[J]+(Z<<3),G=X[Y];if(G)return G;if(Q)return;return G=X[Y]=Object.create(null),G.__type=J,G.__size=Z,G.__parent=X,G}function gJ0(X,J,Z){let Q=uJ0[J]+(Z<<3),Y=X[Q];if(Y)return Y;return Y=X[Q]=Object.create(null),Y.__type=J,Y.__size=Z,Y.__parent=X,Y}function Wc8(X){if(!(X instanceof Map))return X;let J=X.get("typed")||[];if(Object.isFrozen(J))J=J.map((Y)=>Y.slice(0));let Z=X.get("named"),Q=Object.create(null);for(let Y=0,G=J.length;Y<G;Y++){let K=J[Y],B=Q;for(let[H,W,V]of K){let U=B[V];if(!U)B[V]=U={key:V,parent:B,enumerationOffset:0,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null,date64:null};B=VK(U,H,W,!1)}B[WK]=Y}return J.transitions=Q,this.typedStructs=J,this.lastTypedStructuresLength=J.length,Z}var mJ0=Symbol.for("source");function Vc8(X,J,Z,Q){let Y=X[J++]-32;if(Y>=24)switch(Y){case 24:Y=X[J++];break;case 25:Y=X[J++]+(X[J++]<<8);break;case 26:Y=X[J++]+(X[J++]<<8)+(X[J++]<<16);break;case 27:Y=X[J++]+(X[J++]<<8)+(X[J++]<<16)+(X[J++]<<24);break}let G=Q.typedStructs&&Q.typedStructs[Y];if(!G){if(X=Uint8Array.prototype.slice.call(X,J,Z),Z-=J,J=0,!Q.getStructures)throw Error(`Reference to shared structure ${Y} without getStructures method`);if(Q._mergeStructures(Q.getStructures()),!Q.typedStructs)throw Error("Could not find any shared typed structures");if(Q.lastTypedStructuresLength=Q.typedStructs.length,G=Q.typedStructs[Y],!G)throw Error("Could not find typed structure "+Y)}var{construct:K,fullConstruct:B}=G;if(!K){K=G.construct=function(){},B=G.fullConstruct=function(){},B.prototype=Q.structPrototype||{};var H=K.prototype=Q.structPrototype?Object.create(Q.structPrototype):{};let V=[],U=0,O;for(let q=0,L=G.length;q<L;q++){let A=G[q],[M,x,j,T]=A;if(j==="__proto__")j="__proto_";let E={key:j,offset:U};if(T)V.splice(q+T,0,E);else V.push(E);let k;switch(x){case 0:k=()=>0;break;case 1:k=(C,v)=>{let f=C.bytes[v+E.offset];return f>=246?dD(f):f};break;case 2:k=(C,v)=>{let f=C.bytes,l=(f.dataView||(f.dataView=new DataView(f.buffer,f.byteOffset,f.byteLength))).getUint16(v+E.offset,!0);return l>=65280?dD(l&255):l};break;case 4:k=(C,v)=>{let f=C.bytes,l=(f.dataView||(f.dataView=new DataView(f.buffer,f.byteOffset,f.byteLength))).getUint32(v+E.offset,!0);return l>=4294967040?dD(l&255):l};break}E.getRef=k,U+=x;let P;switch(M){case hJ0:if(O&&!O.next)O.next=E;O=E,E.multiGetCount=0,P=function(C){let{bytes:v,position:f}=C,s=U+f,l=k(C,f);if(typeof l!=="number")return l;let W0,b=E.next;while(b){if(W0=b.getRef(C,f),typeof W0==="number")break;else W0=null;b=b.next}if(W0==null)W0=C.bytesEnd-s;if(C.srcString)return C.srcString.slice(l,W0);return fc0(v,l+s,W0-l)};break;case vR:case sd:if(O&&!O.next)O.next=E;O=E,P=function(C){let v=C.position,f=U+v,s=k(C,v);if(typeof s!=="number")return s;let l=C.bytes,W0,b=E.next;while(b){if(W0=b.getRef(C,v),typeof W0==="number")break;else W0=null;b=b.next}if(W0==null)W0=C.bytesEnd-f;if(M===vR)return l.toString("utf8",s+f,W0+f);else{QB=C;try{return Q.unpack(l,{start:s+f,end:W0+f})}finally{QB=null}}};break;case uD:switch(x){case 4:P=function(C){let v=C.bytes,f=v.dataView||(v.dataView=new DataView(v.buffer,v.byteOffset,v.byteLength)),s=C.position+E.offset,l=f.getInt32(s,!0);if(l<536870912){if(l>-520093696)return l;if(l>-536870912)return dD(l&255)}let W0=f.getFloat32(s,!0),b=tz[(v[s+3]&127)<<1|v[s+2]>>7];return(b*W0+(W0>0?0.5:-0.5)>>0)/b};break;case 8:P=function(C){let v=C.bytes,s=(v.dataView||(v.dataView=new DataView(v.buffer,v.byteOffset,v.byteLength))).getFloat64(C.position+E.offset,!0);if(isNaN(s)){let l=v[C.position+E.offset];if(l>=246)return dD(l)}return s};break;case 1:P=function(C){let f=C.bytes[C.position+E.offset];return f<246?f:dD(f)};break}break;case dJ0:P=function(C){let v=C.bytes,f=v.dataView||(v.dataView=new DataView(v.buffer,v.byteOffset,v.byteLength));return new Date(f.getFloat64(C.position+E.offset,!0))};break}E.get=P}if(Hf0){let q=[],L=[],A=0,M;for(let j of V){if(Q.alwaysLazyProperty&&Q.alwaysLazyProperty(j.key)){M=!0;continue}Object.defineProperty(H,j.key,{get:$c8(j.get),enumerable:!0});let T="v"+A++;L.push(T),q.push("o["+JSON.stringify(j.key)+"]="+T+"(s)")}if(M)q.push("__proto__:this");let x=Function(...L,"var c=this;return function(s){var o=new c();"+q.join(";")+";return o;}").apply(B,V.map((j)=>j.get));Object.defineProperty(H,"toJSON",{value(j){return x.call(this,this[mJ0])}})}else Object.defineProperty(H,"toJSON",{value(q){let L={};for(let A=0,M=V.length;A<M;A++){let x=V[A].key;L[x]=this[x]}return L}})}var W=new K;return W[mJ0]={bytes:X,position:J,srcString:"",bytesEnd:Z},W}function dD(X){switch(X){case 246:return null;case 247:return;case 248:return!1;case 249:return!0}throw Error("Unknown constant")}function $c8(X){return function(){return X(this[mJ0])}}function Uc8(){if(QB)QB.bytes=Uint8Array.prototype.slice.call(QB.bytes,QB.position,QB.bytesEnd),QB.position=0,QB.bytesEnd=QB.bytes.length}function zc8(X,J){if(J.typedStructs){let Q=new Map;Q.set("named",X),Q.set("typed",J.typedStructs),X=Q}let Z=J.lastTypedStructuresLength||0;return X.isCompatible=(Q)=>{let Y=!0;if(Q instanceof Map){if((Q.get("named")||[]).length!==(J.lastNamedStructuresLength||0))Y=!1;if((Q.get("typed")||[]).length!==Z)Y=!1}else if(Q instanceof Array||Array.isArray(Q)){if(Q.length!==(J.lastNamedStructuresLength||0))Y=!1}if(!Y)J._mergeStructures(Q);return Y},J.lastTypedStructuresLength=J.typedStructs&&J.typedStructs.length,X}oc0(Vc8,Wc8,Uc8);var _c8=process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED!==void 0&&process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED.toLowerCase()==="true";if(!_c8){let X;try{if(X=GN("msgpackr-extract"),X)cc0(X.extractStrings)}catch(J){}}class j2 extends m7("@effect/rpc/RpcSerialization")(){}var Dc8=j2.of({contentType:"application/ndjson",includesFraming:!0,unsafeMake:()=>{let X=new TextDecoder,J="";return{decode:(Z)=>{J+=typeof Z==="string"?Z:X.decode(Z);let Q=0,Y=J.indexOf(`
629
+ `,Q),G=[];while(Y!==-1){let K=JSON.parse(J.slice(Q,Y));G.push(K),Q=Y+1,Y=J.indexOf(`
630
+ `,Q)}return J=J.slice(Q),G},encode:(Z)=>{if(Array.isArray(Z)){if(Z.length===0)return;let Q="";for(let Y=0;Y<Z.length;Y++)Q+=JSON.stringify(Z[Y])+`
631
+ `;return Q}return JSON.stringify(Z)+`
632
+ `}}}}),wc8=(X)=>j2.of({contentType:X?.contentType??"application/json",includesFraming:!1,unsafeMake:()=>{let J=new TextDecoder,Z=new Map;return{decode:(Q)=>{let Y=JSON.parse(typeof Q==="string"?Q:J.decode(Q));return Vf0(Y,Z)},encode:(Q)=>{if(Array.isArray(Q)){if(Q.length===0)return;return JSON.stringify(Q.map(kR))}let Y=$f0(Q,Z);return Y&&JSON.stringify(Y)}}}}),Lc8=(X)=>j2.of({contentType:X?.contentType??"application/json-rpc",includesFraming:!0,unsafeMake:()=>{let J=Dc8.unsafeMake(),Z=new Map;return{decode:(Q)=>{let Y=J.decode(Q);if(Y.length===0)return[];let G=[];for(let K=0;K<Y.length;K++){let B=Y[K];G.push(...Vf0(B,Z))}return G},encode:(Q)=>{if(Array.isArray(Q))return J.encode(Q.map(kR));let Y=$f0(Q,Z);return Y&&J.encode(Y)}}}});function Vf0(X,J){if(Array.isArray(X)){let Z={size:0,responses:new Map},Q=[];for(let Y=0;Y<X.length;Y++){let G=cJ0(X[Y]);if(G._tag==="Request")Z.size++,J.set(G.id,Z)}return Q}return Array.isArray(X)?X.map(cJ0):[cJ0(X)]}function cJ0(X){if("method"in X){if(!X.id&&X.method.startsWith("@effect/rpc/")){let J=X.method.slice(12),Z=X.params?.requestId;return Z?{_tag:J,requestId:String(Z)}:{_tag:J}}return{_tag:"Request",id:X.id?String(X.id):"",tag:X.method,payload:X.params,headers:X.headers??[],traceId:X.traceId,spanId:X.spanId,sampled:X.sampled}}else if(X.error&&X.error._tag==="Defect")return{_tag:"Defect",defect:X.error.data};else if(X.chunk===!0)return{_tag:"Chunk",requestId:String(X.id),values:X.result};return{_tag:"Exit",requestId:String(X.id),exit:X.error!=null?{_tag:"Failure",cause:X.error._tag==="Cause"?X.error.data:{_tag:"Die",defect:X.error}}:{_tag:"Success",value:X.result}}}function $f0(X,J){if(!("requestId"in X))return kR(X);let Z=J.get(X.requestId);if(Z){if(J.delete(X.requestId),Z.responses.set(X.requestId,X),Z.size===Z.responses.size)return Array.from(Z.responses.values(),kR);return}return kR(X)}function kR(X){switch(X._tag){case"Request":return{jsonrpc:"2.0",method:X.tag,params:X.payload,id:X.id&&Number(X.id),headers:X.headers,traceId:X.traceId,spanId:X.spanId,sampled:X.sampled};case"Ping":case"Pong":case"Interrupt":case"Ack":case"Eof":return{jsonrpc:"2.0",method:`@effect/rpc/${X._tag}`,params:"requestId"in X?{requestId:X.requestId}:void 0};case"Chunk":return{jsonrpc:"2.0",chunk:!0,id:Number(X.requestId),result:X.values};case"Exit":return{jsonrpc:"2.0",id:X.requestId?Number(X.requestId):void 0,result:X.exit._tag==="Success"?X.exit.value:void 0,error:X.exit._tag==="Failure"?{_tag:"Cause",code:X.exit.cause._tag==="Fail"&&V0(X.exit.cause.error,"code")?Number(X.exit.cause.error.code):0,message:X.exit.cause._tag==="Fail"&&V0(X.exit.cause.error,"message")?X.exit.cause.error.message:JSON.stringify(X.exit.cause),data:X.exit.cause}:void 0};case"Defect":return{jsonrpc:"2.0",id:Fc8,error:{_tag:"Defect",code:1,message:"A defect occurred",data:X.defect}};case"ClientProtocolError":return{}}}var Fc8=-32603;var fJ0=(X)=>E7(j2,wc8(X)),Uf0=(X)=>E7(j2,Lc8(X));var Ac8=BigInt(0),pJ0=hX(function*(X,J){let Z=J?.spanPrefix??"RpcClient",Q=J?.supportsAck??!0,Y=J?.disableTracing??!1,G=J?.generateRequestId??(()=>Ac8++),K=yield*EX(),B=z9(K,O4),H=new Map,W=!1;yield*FJ(B,o0(()=>{return W=!0,V(T1(Tc8))}));let V=hX(function*(j){for(let[T,E]of H)if(H.delete(T),E._tag==="Mailbox")yield*E.mailbox.done(j);else E.resume(j)}),U=(j)=>{let T=dd(j.successSchema),E=L(j);return(k,P)=>{let C=P?.headers?GZ(P.headers):GK,v=P?.context??jX();if(!T){let s=(l)=>O(j,E,l,j.payloadSchema.make?j.payloadSchema.make(k):k,C,v,P?.discard??!1);return Y?s(void 0):eO(`${Z}.${j._tag}`,{captureStackTrace:!1,attributes:J.spanAttributes},s)}let f=q(j,E,j.payloadSchema.make?j.payloadSchema.make(k):k,C,P?.streamBufferSize??16,v);if(P?.asMailbox)return f;return lG(u(f,GR))}},O=(j,T,E,k,P,C,v)=>AJ((f)=>{if(W)return aJ;let s=G(),l=T({_tag:"Request",id:s,tag:j._tag,payload:k,traceId:E?.traceId,spanId:E?.spanId,sampled:E?.sampled,headers:dh(f.getFiberRef(Nf0),P)});if(v)return h(l,(n)=>J.onFromClient({message:n,context:C,discard:v}));let W0=XT({context:f.currentContext,fiberRefs:f.getFiberRefs(),runtimeFlags:A3.runtimeFlags}),b,a=!1;return rF(b6((n)=>{let r={_tag:"Effect",rpc:j,context:C,resume(J0){if(a=!0,n(J0),b&&!b.unsafePoll())f.currentScheduler.scheduleTask(()=>{b.unsafeInterruptAsFork(f.id())},0,b)}};H.set(s,r),b=l.pipe(h((J0)=>J.onFromClient({message:J0,context:C,discard:v})),E?_U(E):t,KQ(W0)),b.addObserver((J0)=>{if(J0._tag==="Failure")return n(J0)})}),(n)=>{if(a)return U0;H.delete(s);let r=Array.from(n).flatMap((J0)=>Array.from(Mf(J0)));return C0(T7(b),A(s,r,C))})}),q=hX(function*(j,T,E,k,P,C){if(W)return yield*aJ;let v=Y?void 0:yield*ri(`${Z}.${j._tag}`,{captureStackTrace:!1,attributes:J.spanAttributes}),f=lY(xO()),s=G(),l=x6(f.currentContext,O4);yield*a$(l,(b)=>{if(!H.has(s))return U0;return H.delete(s),A(s,AZ(b)?Array.from(NF(b.cause)).flatMap((a)=>Array.from(Mf(a))):[],C)});let W0=yield*k5(P);return H.set(s,{_tag:"Mailbox",rpc:j,mailbox:W0,scope:l,context:C}),yield*T({_tag:"Request",id:s,tag:j._tag,traceId:v?.traceId,payload:E,spanId:v?.spanId,sampled:v?.sampled,headers:dh(f.getFiberRef(Nf0),k)}).pipe(h((b)=>J.onFromClient({message:b,context:C,discard:!1})),v?_U(v):t,s9((b)=>W0.failCause(b)),QX,$X(l)),W0}),L=(j)=>{let T=[];for(let E of j.middlewares.values()){let k=K.unsafeMap.get(`${E.key}/Client`);if(!k)continue;T.push(k)}return T.length===0?y:function(E){let k=0;return u(ZH({while:()=>k<T.length,body:()=>T[k]({rpc:j,request:E}),step(P){E=P,k++}}),()=>E)}},A=(j,T,E)=>b6((k)=>{let P=lY(xO()),C=XT({context:P.currentContext,fiberRefs:P.getFiberRefs(),runtimeFlags:A3.runtimeFlags});J.onFromClient({message:{_tag:"Interrupt",requestId:j,interruptors:T},context:E,discard:!1}).pipe(XA(1000),KQ(C)).addObserver(()=>{k(U0)})}),M=(j)=>{switch(j._tag){case"Chunk":{let T=j.requestId,E=H.get(T);if(!E||E._tag!=="Mailbox")return U0;return E.mailbox.offerAll(j.values).pipe(Q?C0(J.onFromClient({message:{_tag:"Ack",requestId:j.requestId},context:E.context,discard:!1})):t,s9((k)=>E.mailbox.done(_9(k))))}case"Exit":{let T=j.requestId,E=H.get(T);if(!E)return U0;if(H.delete(T),E._tag==="Effect")return E.resume(j.exit),U0;return E.mailbox.done(Ul(j.exit))}case"Defect":return V(Y5(j.defect));case"ClientEnd":return U0}},x;if(J.flatten){let j=new Map;x=function(E,k,P){let C=j.get(E);if(!C)C=U(X.requests.get(E)),j.set(E,C);return C(k,P)}}else{x={};for(let j of X.requests.values()){let T=j._tag.indexOf("."),E=T===-1?void 0:j._tag.slice(0,T);if(E!==void 0&&!(E in x))x[E]={};let k=E!==void 0?x[E]:x,P=E!==void 0?j._tag.slice(T+1):j._tag;k[P]=U(j)}}return{client:x,write:M}}),Tc8=B$(-503,0),Of0=hX(function*(X,J){let{run:Z,send:Q,supportsAck:Y,supportsTransferables:G}=yield*bR,K=new Map,{client:B,write:H}=yield*pJ0(X,{...J,supportsAck:Y,onFromClient({message:W}){switch(W._tag){case"Request":{let V=X.requests.get(W.tag),U=gD(V.successSchema.ast),O=G?VD():void 0,q=lY(xO()),L={rpc:V,context:O?X9(q.currentContext,PV,O):q.currentContext,decodeChunk:R0(U)?t9(j3(U.value.success)):void 0};return K.set(W.id,L),E3(V.payloadSchema)(W.payload).pipe(O5(yQ,L.context),R9,h((A)=>Q({...W,id:String(W.id),payload:A,headers:Object.entries(W.headers)},O&&O.unsafeClear())))}case"Ack":{if(!K.get(W.requestId))return U0;return Q({_tag:"Ack",requestId:String(W.requestId)})}case"Interrupt":{if(!K.get(W.requestId))return U0;return K.delete(W.requestId),Q({_tag:"Interrupt",requestId:String(W.requestId)})}case"Eof":return U0}}});return yield*Z((W)=>{switch(W._tag){case"Chunk":{let V=JB(W.requestId),U=K.get(V);if(!U||!U.decodeChunk)return U0;return U.decodeChunk(W.values).pipe(O5(yQ,U.context),R9,h((O)=>H({_tag:"Chunk",clientId:0,requestId:JB(W.requestId),values:O})),WU((O)=>H({_tag:"Exit",clientId:0,requestId:JB(W.requestId),exit:_9(O)})))}case"Exit":{let V=JB(W.requestId),U=K.get(V);if(!U)return U0;return K.delete(V),Y00(ud(U.rpc))(W.exit).pipe(O5(yQ,U.context),R9,a6({onSuccess:(O)=>H({_tag:"Exit",clientId:0,requestId:V,exit:O}),onFailure:(O)=>H({_tag:"Exit",clientId:0,requestId:V,exit:_9(O)})}))}case"Defect":return K.clear(),H({_tag:"Defect",clientId:0,defect:Mc8(W.defect)});case"ClientProtocolError":{let V=WX(W.error);return a9(K.keys(),(U)=>{return K.delete(U),H({_tag:"Exit",clientId:0,requestId:U,exit:V})})}default:return U0}}).pipe(s9(UU),QX,MJ),B}),Nf0=c0("@effect/rpc/RpcClient/currentHeaders",()=>dG(GK));class bR extends m7("@effect/rpc/RpcClient/Protocol")(){static make=md()}var Mc8=__(e6);var ed=Symbol.for("@effect/platform/HttpServerResponse"),Rc8=Symbol.for("@effect/platform/HttpServerRespondable");class yR extends CL{status;statusText;cookies;body;[ed];headers;constructor(X,J,Z,Q,Y){super();if(this.status=X,this.statusText=J,this.cookies=Q,this.body=Y,this[ed]=ed,Y.contentType||Y.contentLength){let G={...Z};if(Y.contentType)G["content-type"]=Y.contentType;if(Y.contentLength)G["content-length"]=Y.contentLength.toString();this.headers=G}else this.headers=Z}commit(){return y(this)}[Rc8](){return y(this)}[$8](){return this.toJSON()}toString(){return u8(this)}toJSON(){return{_id:"@effect/platform/HttpServerResponse",status:this.status,statusText:this.statusText,headers:cY(this.headers),cookies:this.cookies.toJSON(),body:this.body.toJSON()}}}var _f0=(X)=>typeof X==="object"&&X!==null&&(ed in X),qf0=(X)=>new yR(X?.status??204,X?.statusText,X?.headers?GZ(X.headers):GK,X?.cookies??G2,lh);var Df0=(X,J)=>{let Z=J?.headers?GZ(J.headers):GK;return new yR(J?.status??200,J?.statusText,Z,J?.cookies??G2,rP(X,lJ0(J,Z)))},wf0=(X,J)=>{let Z=J?.headers?GZ(J.headers):GK;return new yR(J?.status??200,J?.statusText,Z,J?.cookies??G2,KD(X,lJ0(J,Z)))};var Lf0=(X,J)=>{let Z=J?.headers?GZ(J.headers):GK;return new yR(J?.status??200,J?.statusText,Z,J?.cookies??G2,BD(X,lJ0(J,Z),J?.contentLength))},lJ0=(X,J)=>{if(X?.contentType)return X.contentType;else if(X?.headers)return J["content-type"];else return};var Ff0=_f0,Xu=qf0;var Af0=Df0,Tf0=wf0;var Mf0=Lf0;var iJ0=Symbol.for("@effect/platform/HttpServerRespondable");var oJ0=(X)=>{if(Ff0(X))return y(X);return R9(X[iJ0]())};var Rf0=Symbol.for("@effect/platform/HttpServerError");var Ic8=Rf0;class rJ0 extends Uq(Ic8,"RouteNotFound"){constructor(X){super(X);this.stack=`${this.name}: ${this.message}`}[iJ0](){return Xu({status:404})}get message(){return`${this.request.method} ${this.request.url} not found`}}var jf0=g8("@effect/platform/HttpServerRequest"),Cf0=g8("@effect/platform/HttpServerRequest/ParsedSearchParams");var cD=jf0,If0=Cf0;var Sf0=c0(Symbol.for("@effect/platform/HttpMiddleware/loggerDisabled"),()=>dG(!1)),xf0=(X)=>C0(pO0(Sf0,!0),X);var vf0=/\+/g,kf0=function(){};kf0.prototype=Object.create(null);function bf0(X){let J=new kf0;if(typeof X!=="string")return J;let Z=X.length,Q="",Y="",G=-1,K=-1,B=!1,H=!1,W=!1,V=!1,U=!1,O=0;for(let q=0;q<Z+1;q++)if(O=q!==Z?X.charCodeAt(q):38,O===38){if(U=K>G,!U)K=q;if(Q=X.slice(G+1,K),U||Q.length>0){if(W)Q=Q.replace(vf0," ");if(B)try{Q=decodeURIComponent(Q)||Q}catch{}if(U){if(Y=X.slice(K+1,q),V)Y=Y.replace(vf0," ");if(H)try{Y=decodeURIComponent(Y)||Y}catch{}}let L=J[Q];if(L===void 0)J[Q]=Y;else if(L.pop)L.push(Y);else J[Q]=[L,Y]}Y="",G=q,K=q,B=!1,H=!1,W=!1,V=!1}else if(O===61)if(K<=G)K=q;else H=!0;else if(O===43)if(K>G)V=!0;else W=!0;else if(O===37)if(K>G)H=!0;else B=!0;return J}var kc8=/^https?:\/\/.*?\//,aJ0=/(\/:[^/()]*?)\?(\/?)/,mf0=(X={})=>new df0(X);class df0{constructor(X={}){this.options={ignoreTrailingSlash:!0,ignoreDuplicateSlashes:!0,caseSensitive:!1,maxParamLength:100,...X}}options;routes=[];trees={};on(X,J,Z){let Q=J.match(aJ0);if(Q&&Q.index!==void 0){bc8(J.length===Q.index+Q[0].length,"Optional Parameter needs to be the last parameter of the path");let G=J.replace(aJ0,"$1$2"),K=J.replace(aJ0,"$2");this.on(X,G,Z),this.on(X,K,Z);return}if(this.options.ignoreDuplicateSlashes)J=yf0(J);if(this.options.ignoreTrailingSlash)J=gf0(J);let Y=typeof X==="string"?[X]:X;for(let G of Y)this._on(G,J,Z)}all(X,J){this.on(uc8,X,J)}_on(X,J,Z){if(this.trees[X]===void 0)this.trees[X]=new gR("/");let Q=J;if(Q==="*"&&this.trees[X].prefix.length!==0){let H=this.trees[X];this.trees[X]=new gR(""),this.trees[X].staticChildren["/"]=H}let Y=this.trees[X].prefix.length,G=this.trees[X],K=[];for(let H=0;H<=Q.length;H++){if(Q.charCodeAt(H)===58&&Q.charCodeAt(H+1)===58){H++;continue}let W=Q.charCodeAt(H)===58&&Q.charCodeAt(H+1)!==58,V=Q.charCodeAt(H)===42;if(W||V||H===Q.length&&H!==Y){let U=Q.slice(Y,H);if(!this.options.caseSensitive)U=U.toLowerCase();U=U.split("::").join(":"),U=U.split("%").join("%25"),G=G.createStaticChild(U)}if(W){let U=!1,O=[],q=H+1;for(let L=q;;L++){let A=Q.charCodeAt(L),M=A===40,x=A===45||A===46,j=A===47||L===Q.length;if(M||x||j){let T=Q.slice(q,L);if(K.push(T),U=U||M||x,M){let P=gc8(Q,L),C=Q.slice(L,P+1);O.push(hc8(C)),L=P+1}else O.push("(.*?)");let E=L;for(;L<Q.length;L++){let P=Q.charCodeAt(L);if(P===47)break;if(P===58)if(Q.charCodeAt(L+1)===58)L++;else break}let k=Q.slice(E,L);if(k)k=k.split("::").join(":"),k=k.split("%").join("%25"),O.push(mc8(k));if(q=L+1,j||Q.charCodeAt(L)===47||L===Q.length){let P=U?"()"+k:k,C=Q.slice(H,L);Q=Q.slice(0,H+1)+P+Q.slice(L),H+=P.length;let v=U?new RegExp("^"+O.join("")+"$"):void 0;G=G.createParametricChild(v,k,C),Y=H+1;break}}}}else if(V){if(K.push("*"),G=G.createWildcardChild(),Y=H+1,H!==Q.length-1)throw Error("Wildcard must be the last character in the route")}}if(!this.options.caseSensitive)Q=Q.toLowerCase();if(Q==="*")Q="/*";for(let H of this.routes)if(H.method===X&&H.pattern===Q)throw Error(`Method '${X}' already declared for route '${Q}'`);let B={method:X,path:J,pattern:Q,params:K,handler:Z};this.routes.push(B),G.addRoute(B)}has(X,J){let Z=this.trees[X];if(Z===void 0)return!1;let Q=Z.getStaticChild(J);if(Q===void 0)return!1;return Q.isLeafNode}find(X,J){let Z=this.trees[X];if(Z===void 0)return;if(J.charCodeAt(0)!==47)J=J.replace(kc8,"/");if(this.options.ignoreDuplicateSlashes)J=yf0(J);let Q,Y,G;try{Q=dc8(J),J=Q.path,Y=Q.querystring,G=Q.shouldDecodeParam}catch(O){return}if(this.options.ignoreTrailingSlash)J=gf0(J);let K=J;if(this.options.caseSensitive===!1)J=J.toLowerCase();let B=this.options.maxParamLength,H=Z.prefix.length,W=[],V=J.length,U=[];while(!0){if(H===V&&Z.isLeafNode){let q=Z.handlerStorage?.find();if(q!==void 0)return{handler:q.handler,params:q.createParams(W),searchParams:bf0(Y)}}let O=Z.getNextNode(J,H,U,W.length);if(O===void 0){if(U.length===0)return;let q=U.pop();H=q.brotherPathIndex,W.splice(q.paramsCount),O=q.brotherNode}if(Z=O,Z._tag==="StaticNode"){H+=Z.prefix.length;continue}if(Z._tag==="WildcardNode"){let q=K.slice(H);if(G)q=hf0(q);W.push(q),H=V;continue}if(Z._tag==="ParametricNode"){let q=K.indexOf("/",H);if(q===-1)q=V;let L=K.slice(H,q);if(G)L=hf0(L);if(Z.regex!==void 0){let A=Z.regex.exec(L);if(A===null)continue;for(let M=1;M<A.length;M++){let x=A[M];if(x.length>B)return;W.push(x)}}else{if(L.length>B)return;W.push(L)}H=q}}}}class uf0{handlers=[];unconstrainedHandler;find(){return this.unconstrainedHandler}add(X){let J={params:X.params,handler:X.handler,createParams:yc8(X.params)};this.handlers.push(J),this.unconstrainedHandler=this.handlers[0]}}class sJ0{isLeafNode=!1;routes;handlerStorage;addRoute(X){if(this.routes===void 0)this.routes=[X];else this.routes.push(X);if(this.handlerStorage===void 0)this.handlerStorage=new uf0;this.isLeafNode=!0,this.handlerStorage.add(X)}}class tJ0 extends sJ0{staticChildren={};findStaticMatchingChild(X,J){let Z=this.staticChildren[X.charAt(J)];if(Z===void 0||!Z.matchPrefix(X,J))return;return Z}getStaticChild(X,J=0){if(X.length===J)return this;let Z=this.findStaticMatchingChild(X,J);if(Z===void 0)return;return Z.getStaticChild(X,J+Z.prefix.length)}createStaticChild(X){if(X.length===0)return this;let J=this.staticChildren[X.charAt(0)];if(J){let Q=1;for(;Q<J.prefix.length;Q++)if(X.charCodeAt(Q)!==J.prefix.charCodeAt(Q)){J=J.split(this,Q);break}return J.createStaticChild(X.slice(Q))}let Z=X.charAt(0);return this.staticChildren[Z]=new gR(X),this.staticChildren[Z]}}class gR extends tJ0{_tag="StaticNode";constructor(X){super();this.setPrefix(X)}prefix;matchPrefix;parametricChildren=[];wildcardChild;setPrefix(X){if(this.prefix=X,X.length===1)this.matchPrefix=(J,Z)=>!0;else{let J=X.length;this.matchPrefix=function(Z,Q){for(let Y=1;Y<J;Y++)if(Z.charCodeAt(Q+Y)!==this.prefix.charCodeAt(Y))return!1;return!0}}}getParametricChild(X){if(X===void 0)return this.parametricChildren.find((Z)=>Z.isRegex===!1);let J=X.source;return this.parametricChildren.find((Z)=>{if(Z.regex===void 0)return!1;return Z.regex.source===J})}createParametricChild(X,J,Z){let Q=this.getParametricChild(X);if(Q!==void 0)return Q.nodePaths.add(Z),Q;return Q=new cf0(X,J,Z),this.parametricChildren.push(Q),this.parametricChildren.sort((Y,G)=>{if(!Y.isRegex)return 1;if(!G.isRegex)return-1;if(Y.staticSuffix===void 0)return 1;if(G.staticSuffix===void 0)return-1;if(G.staticSuffix.endsWith(Y.staticSuffix))return 1;if(Y.staticSuffix.endsWith(G.staticSuffix))return-1;return 0}),Q}createWildcardChild(){if(this.wildcardChild===void 0)this.wildcardChild=new ff0;return this.wildcardChild}split(X,J){let Z=this.prefix.slice(0,J),Q=this.prefix.slice(J);this.setPrefix(Q);let Y=new gR(Z);return Y.staticChildren[Q.charAt(0)]=this,X.staticChildren[Z.charAt(0)]=Y,Y}getNextNode(X,J,Z,Q){let Y=this.findStaticMatchingChild(X,J),G=0;if(Y===void 0){if(this.parametricChildren.length===0)return this.wildcardChild;Y=this.parametricChildren[0],G=1}if(this.wildcardChild!==void 0)Z.push({paramsCount:Q,brotherPathIndex:J,brotherNode:this.wildcardChild});for(let K=this.parametricChildren.length-1;K>=G;K--)Z.push({paramsCount:Q,brotherPathIndex:J,brotherNode:this.parametricChildren[K]});return Y}}class cf0 extends tJ0{regex;staticSuffix;_tag="ParametricNode";constructor(X,J,Z){super();this.regex=X,this.staticSuffix=J,this.isRegex=!!X,this.nodePaths=new Set([Z])}isRegex;nodePaths;getNextNode(X,J){return this.findStaticMatchingChild(X,J)}}class ff0 extends sJ0{_tag="WildcardNode";getNextNode(X,J,Z,Q){return}}var bc8=(X,J)=>{if(!X)throw Error(J)};function yf0(X){return X.replace(/\/\/+/g,"/")}function gf0(X){if(X.length>1&&X.charCodeAt(X.length-1)===47)return X.slice(0,-1);return X}function yc8(X){let J=X.length;return function(Z){let Q={};for(let Y=0;Y<J;Y++)Q[X[Y]]=Z[Y];return Q}}function gc8(X,J){let Z=1;while(J<X.length){if(J++,X[J]==="\\"){J++;continue}if(X[J]===")")Z--;else if(X[J]==="(")Z++;if(!Z)return J}throw TypeError('Invalid regexp expression in "'+X+'"')}function hc8(X){if(X.charCodeAt(1)===94)X=X.slice(0,1)+X.slice(2);if(X.charCodeAt(X.length-2)===36)X=X.slice(0,X.length-2)+X.slice(X.length-1);return X}function mc8(X){return X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pf0(X,J){if(X===50){if(J===53)return"%";if(J===51)return"#";if(J===52)return"$";if(J===54)return"&";if(J===66)return"+";if(J===98)return"+";if(J===67)return",";if(J===99)return",";if(J===70)return"/";if(J===102)return"/";return}if(X===51){if(J===65)return":";if(J===97)return":";if(J===66)return";";if(J===98)return";";if(J===68)return"=";if(J===100)return"=";if(J===70)return"?";if(J===102)return"?";return}if(X===52&&J===48)return"@";return}function dc8(X){let J=!1,Z=!1,Q="";for(let G=1;G<X.length;G++){let K=X.charCodeAt(G);if(K===37){let B=X.charCodeAt(G+1),H=X.charCodeAt(G+2);if(pf0(B,H)===void 0)J=!0;else{if(Z=!0,B===50&&H===53)J=!0,X=X.slice(0,G+1)+"25"+X.slice(G+1),G+=2;G+=2}}else if(K===63||K===59||K===35){Q=X.slice(G+1),X=X.slice(0,G);break}}return{path:J?decodeURI(X):X,querystring:Q,shouldDecodeParam:Z}}function hf0(X){let J=X.indexOf("%");if(J===-1)return X;let Z="",Q=J;for(let Y=J;Y<X.length;Y++)if(X.charCodeAt(Y)===37){let G=X.charCodeAt(Y+1),K=X.charCodeAt(Y+2),B=pf0(G,K);Z+=X.slice(Q,Y)+B,Q=Y+3}return X.slice(0,J)+Z+X.slice(Q)}var uc8=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"];var Ju=mf0;var lf0=xf0;var XZ0=Symbol.for("@effect/platform/HttpServer"),nf0=g8("@effect/platform/HttpServer"),Qq9={[XZ0]:XZ0};var if0=$((X)=>VX(X[0]),(X,J)=>WJ(h(nf0,(Z)=>Z.serve(X,J))));var of0=if0;var fD=Symbol.for("@effect/platform/HttpRouter"),Zu=Symbol.for("@effect/platform/HttpRouter/Route"),Qu=Symbol.for("@effect/platform/HttpRouter/RouteContext"),JZ0=g8("@effect/platform/HttpRouter/RouteContext"),nc8=(X)=>V0(X,fD);var af0=c0("@effect/platform/HttpRouter/currentRouterConfig",()=>dG({}));class XN extends CL{routes;mounts;[fD];constructor(X,J){super();this.routes=X,this.mounts=J,this[fD]=fD,this.httpApp=sf0(this).pipe(h((Z)=>this.httpApp=Z))}httpApp;commit(){return this.httpApp}toJSON(){return{_id:"Router",routes:this.routes.toJSON(),mounts:this.mounts.toJSON()}}toString(){return u8(this)}[$8](){return this.toJSON()}}var sf0=(X)=>u(fx(af0),(J)=>{let Z=Ju(J),Q=G9(X.mounts).map(([G,K,B])=>[G,new ZZ0(new Yu("*",B?.includePrefix?`${G}/*`:"/*",K,B?.includePrefix?S():I(G),!1),{}),B]),Y=Q.length;return ac(X.routes,(G)=>{if(G.method==="*")Z.all(G.path,G);else Z.on(G.method,G.path,G)}),AJ((G)=>{let K=nZ(new Map(G.getFiberRef(yQ).unsafeMap)),B=x6(K,cD);if(Y>0){let O=B.url.indexOf("?"),q=O===-1?B.url:B.url.slice(0,O);for(let L=0;L<Y;L++){let[A,M,x]=Q[L];if(q===A||q.startsWith(A+"/")){if(K.unsafeMap.set(JZ0.key,M),x?.includePrefix!==!0)K.unsafeMap.set(cD.key,rf0(B,A));return O5(h(M.route.handler,oJ0),yQ,K)}}}let H=Z.find(B.method,B.url);if(H===void 0&&B.method==="HEAD")H=Z.find("GET",B.url);if(H===void 0)return Y0(new rJ0({request:B}));let W=H.handler;if(W.prefix._tag==="Some")K.unsafeMap.set(cD.key,rf0(B,W.prefix.value));K.unsafeMap.set(If0.key,H.searchParams),K.unsafeMap.set(JZ0.key,new ZZ0(W,H.params));let V=_7(K,zO);if(V._tag==="Some"&&V.value._tag==="Span")V.value.attribute("http.route",W.path);let U=h(W.handler,oJ0);return O5(W.uninterruptible?U:QX(U),yQ,K)})});function rf0(X,J){let Z=J.length;return X.modify({url:X.url.length<=Z?"/":X.url.slice(Z)})}class Yu extends LK{method;path;handler;prefix;uninterruptible;[Zu];constructor(X,J,Z,Q=S(),Y=!1){super();this.method=X,this.path=J,this.handler=Z,this.prefix=Q,this.uninterruptible=Y,this[Zu]=Zu}toJSON(){return{_id:"@effect/platform/HttpRouter/Route",method:this.method,path:this.path,prefix:this.prefix.toJSON()}}}class ZZ0{route;params;[Qu];constructor(X,J){this.route=X,this.params=J,this[Qu]=Qu}}var tf0=new XN(a0(),a0());var ef0=$(2,(X,J)=>new XN(D7(X.routes,J),X.mounts)),QZ0=$(2,(X,J)=>Xp0(X,J)),Xp0=(...X)=>new XN(X.reduce((J,Z)=>f8(J,Z.routes),a0()),X.reduce((J,Z)=>f8(J,Z.mounts),a0())),Jp0=(X)=>X.endsWith("/")?X.slice(0,-1):X;var Zp0=$(2,(X,J)=>{return J=Jp0(J),new XN(p9(X.routes,(Z)=>new Yu(Z.method,Z.path==="/"?J:J+Z.path,Z.handler,JJ(r8(Z.prefix,(Q)=>J+Q),()=>I(J)),Z.uninterruptible)),p9(X.mounts,([Z,Q])=>[Z==="/"?J:J+Z,Q]))}),Qp0=$(3,(X,J,Z)=>QZ0(X,Zp0(Z,J))),Yp0=$((X)=>V0(X[0],fD),(X,J,Z,Q)=>new XN(X.routes,D7(X.mounts,[Jp0(J),Z,Q]))),C2=(X)=>$((J)=>nc8(J[0]),(J,Z,Q,Y)=>new XN(D7(J.routes,new Yu(X,Z,Q,S(),Y?.uninterruptible??!1)),J.mounts)),Gp0=C2("*"),Kp0=C2("GET"),Bp0=C2("POST"),Hp0=C2("PUT"),Wp0=C2("PATCH"),Vp0=C2("DELETE"),$p0=C2("HEAD"),Up0=C2("OPTIONS");var ic8=()=>{let X=tf0;return{addRoute(J){return L0(()=>{X=ef0(X,J)})},all(J,Z,Q){return L0(()=>{X=Gp0(X,J,Z,Q)})},get(J,Z,Q){return L0(()=>{X=Kp0(X,J,Z,Q)})},post(J,Z,Q){return L0(()=>{X=Bp0(X,J,Z,Q)})},put(J,Z,Q){return L0(()=>{X=Hp0(X,J,Z,Q)})},patch(J,Z,Q){return L0(()=>{X=Wp0(X,J,Z,Q)})},del(J,Z,Q){return L0(()=>{X=Vp0(X,J,Z,Q)})},head(J,Z,Q){return L0(()=>{X=$p0(X,J,Z,Q)})},options(J,Z,Q){return L0(()=>{X=Up0(X,J,Z,Q)})},router:L0(()=>X),mount(J,Z){return L0(()=>{X=Qp0(X,J,Z)})},mountApp(J,Z,Q){return L0(()=>{X=Yp0(X,J,Z,Q)})},concat(J){return L0(()=>{X=QZ0(X,J)})}}},zp0=(X)=>()=>{let J=globalThis.Error,Z=J.stackTraceLimit;J.stackTraceLimit=2;let Q=new J;J.stackTraceLimit=Z;function Y(){}let G=Y;return Object.setPrototypeOf(Y,Object.getPrototypeOf(g8(X))),Y.key=X,Object.defineProperty(Y,"stack",{get(){return Q.stack}}),G.Live=jU(G,ic8),G.router=h(G,(K)=>K.router),G.use=(K)=>G.pipe(h(K),WJ,D6(G.Live)),G.unwrap=(K)=>G.pipe(h((B)=>B.router),u(K),eo,D6(G.Live)),G.serve=(K)=>G.unwrap(of0(K)),Y};var rc8=zp0;class Gu extends rc8("@effect/platform/HttpRouter/Default")(){}var Hu=(X,J)=>{let Z=J.definitionPath??"#/$defs/",Q=(B)=>Z+B,Y=J.target??"jsonSchema7",G=J.topLevelReferenceStrategy??"keep",K=J.additionalPropertiesStrategy??"strict";return t7(X,J.definitions,"handle-identifier",[],{getRef:Q,target:Y,topLevelReferenceStrategy:G,additionalPropertiesStrategy:K},"handle-annotation","handle-errors")},hR={$id:"/schemas/never",not:{}},JN={$id:"/schemas/any"},qp0={$id:"/schemas/unknown"},Dp0={$id:"/schemas/void"},sc8={$id:"/schemas/object",anyOf:[{type:"object"},{type:"array"}]},tc8={$id:"/schemas/%7B%7D",anyOf:[{type:"object"},{type:"array"}]};function wp0(X){if(X!==void 0)return u9(HH(X))}function Lp0(X){if(X!==void 0)return u9(NA(X))}function Fp0(X){if(X!==void 0)return bN0(X);return S()}function ec8(X,J){return O_(X,!1)(J)}function Ap0(X){if(X!==void 0)return u9(kN0(X))}function Xf8(X,J){let Z=O_(X,!1),Q=LQ(J,(Y)=>Z(Y).pipe(gJ(Ku)));return Q.length>0?Q:void 0}function Np0(X,J,Z){if(J!==void 0)switch(X._tag){case"StringKeyword":return J!==K_.annotations[Z]?J:void 0;case"NumberKeyword":return J!==B_.annotations[Z]?J:void 0;case"BooleanKeyword":return J!==H_.annotations[Z]?J:void 0}return J}function Ku(X,J=new Set){if(X===null||typeof X==="string"||typeof X==="number"||typeof X==="boolean")return!0;if(Array.isArray(X)||typeof X==="object"){if(J.has(X))return!1;J.add(X);try{if(Array.isArray(X))return X.every((Q)=>Ku(Q,J));let Z=Object.getPrototypeOf(X);if(Z!==null&&Z!==Object.prototype)return!1;if(Object.getOwnPropertySymbols(X).length>0)return!1;return Object.values(X).every((Q)=>Ku(Q,J))}finally{J.delete(X)}}return!1}function Tp0(X,J,Z,Q,Y){let G={};if(J!==void 0)G.description=J;if(Z!==void 0)G.title=Z;if(R0(Q)){let K=ec8(X,Q.value);if(R0(K)&&Ku(K.value))G.default=K.value}if(Y!==void 0){let K=Xf8(X,Y);if(K!==void 0)G.examples=K}if(Object.keys(G).length===0)return;return G}function YZ0(X,J){return Tp0(X,wp0(J),Lp0(J),Fp0(J),Ap0(J))}function Mp0(X){return Tp0(X,Np0(X,wp0(X),_Y),Np0(X,Lp0(X),IZ),Fp0(X),Ap0(X))}function GZ0(X,J){if(J){if("$ref"in X)return{allOf:[X],...J};return{...X,...J}}return X}var Bu=(X)=>{if(j8(_o(X)))return gx(X,Bu,(J)=>Bu(J.from))},Jf8=(X)=>X.annotations[wU]===Cx,Zf8=(X,J)=>{if(D3(X)){if(X.annotations[wU]===Fb)return"type"in J&&J.type!=="integer"}return"type"in J||"oneOf"in J||"anyOf"in J||"$ref"in J},Qf8=(X,J,Z)=>{let Q={...X,...Mp0(Z),...J};Q.allOf??=[];let Y=(G,K)=>{if(G in J&&G in X)Q.allOf.unshift({[G]:X[G]}),Q.allOf=Q.allOf.filter(K)};if(Y("minLength",(G)=>G.minLength>J.minLength),Y("maxLength",(G)=>G.maxLength<J.maxLength),Y("pattern",(G)=>G.pattern!==J.pattern),Y("minItems",(G)=>G.minItems>J.minItems),Y("maxItems",(G)=>G.maxItems<J.maxItems),Y("minimum",(G)=>G.minimum>J.minimum),Y("maximum",(G)=>G.maximum<J.maximum),Y("exclusiveMinimum",(G)=>G.exclusiveMinimum>J.exclusiveMinimum),Y("exclusiveMaximum",(G)=>G.exclusiveMaximum<J.exclusiveMaximum),Y("multipleOf",(G)=>G.multipleOf!==J.multipleOf),Q.allOf.length===0)delete Q.allOf;return Q};function Yf8(X){switch(X.target){case"jsonSchema7":return!1;case"jsonSchema2019-09":case"jsonSchema2020-12":case"openApi3.1":return!0}}function Gf8(X){switch(X.additionalPropertiesStrategy){case"allow":return!0;case"strict":return!1}}function N6(X,J){return Pp0(X,Mp0(J))}function Pp0(X,J){if(J===void 0||Object.keys(J).length===0)return X;if("$ref"in X)return{allOf:[X],...J};return{...X,...J}}function KZ0(X){let J=u9(Do(X));if(J===void 0){if(Mo(X))return KZ0(X.f());if(kx(X)&&qA(X.from)&&uN0(X.to)){let Z=X.to,Q=M4(Z);if(R0(Q))return KZ0(Z)}}return J}function t7(X,J,Z,Q,Y,G,K){if(Z==="handle-identifier"&&(Y.topLevelReferenceStrategy!=="skip"||Mo(X))){let H=KZ0(X);if(H!==void 0){let W=H.replace(/~/ig,"~0").replace(/\//ig,"~1"),V={$ref:Y.getRef(W)};if(!wQ(J,H))J[H]=V,J[H]=t7(X,J,"ignore-identifier",Q,Y,"handle-annotation",K);return V}}if(G==="handle-annotation"){let H=_o(X);if(R0(H)){let W=H.value;if(Zf8(X,W))switch(X._tag){case"Declaration":return N6(W,X);default:return W}else switch(X._tag){case"Refinement":{let V=VA(X);if(V===void 0)return Qf8(t7(X.from,J,Z,Q,Y,"handle-annotation",K),W,X);else return t7(V,J,Z,Q,Y,"handle-annotation",K)}default:return{...t7(X,J,Z,Q,Y,"ignore-annotation",K),...W}}}}let B=M4(X);if(R0(B))return t7(B.value,J,Z,Q,Y,"handle-annotation",K);switch(X._tag){case"Declaration":case"UndefinedKeyword":case"BigIntKeyword":case"UniqueSymbol":case"SymbolKeyword":{if(K==="ignore-errors")return N6(JN,X);throw Error(ei(Q,X))}case"Suspend":{if(Z==="handle-identifier"){if(K==="ignore-errors")return N6(JN,X);throw Error(LN0(Q,X))}return t7(X.f(),J,"ignore-identifier",Q,Y,"handle-annotation",K)}case"NeverKeyword":return N6(hR,X);case"VoidKeyword":return N6(Dp0,X);case"UnknownKeyword":return N6(qp0,X);case"AnyKeyword":return N6(JN,X);case"ObjectKeyword":return N6(sc8,X);case"StringKeyword":return N6({type:"string"},X);case"NumberKeyword":return N6({type:"number"},X);case"BooleanKeyword":return N6({type:"boolean"},X);case"Literal":{let H=X.literal;if(H===null)return N6({type:"null"},X);else if(n9(H))return N6({type:"string",enum:[H]},X);else if(e7(H))return N6({type:"number",enum:[H]},X);else if(yJ(H))return N6({type:"boolean",enum:[H]},X);if(K==="ignore-errors")return N6(JN,X);throw Error(ei(Q,X))}case"Enums":{let H=X.enums.map((W)=>{return{type:e7(W[1])?"number":"string",title:W[0],enum:[W[1]]}});return H.length>=1?N6({$comment:"/schemas/enums",anyOf:H},X):N6(hR,X)}case"TupleType":{let H=X.elements.map((q,L)=>GZ0(t7(q.type,J,"handle-identifier",Q.concat(L),Y,"handle-annotation",K),YZ0(q.type,q))),W=X.rest.map((q)=>GZ0(t7(q.type,J,"handle-identifier",Q,Y,"handle-annotation",K),YZ0(q.type,q))),V={type:"array"},U=X.elements.length;if(U>0)if(V.minItems=U-X.elements.filter((q)=>q.isOptional).length,Y.target==="jsonSchema7")V.items=H;else V.prefixItems=H;let O=W.length;if(O>0){let q=W[0];if(O===1&&X.elements.every((A)=>A.type===X.rest[0].type))if(Y.target==="jsonSchema7")V.items=q;else V.items=q,delete V.prefixItems;else if(Y.target==="jsonSchema7")V.additionalItems=q;else V.items=q;if(O>1){if(K==="ignore-errors")return N6(JN,X);throw Error(FN0(Q))}}else if(U>0)if(Y.target==="jsonSchema7")V.additionalItems=!1;else V.items=!1;else V.maxItems=0;return N6(V,X)}case"TypeLiteral":{if(X.propertySignatures.length===0&&X.indexSignatures.length===0)return N6(tc8,X);let H={type:"object",required:[],properties:{},additionalProperties:Gf8(Y)},W=void 0,V=void 0;for(let U of X.indexSignatures){let O=Bu(U.type)??U.type,q=U.parameter;switch(q._tag){case"StringKeyword":{H.additionalProperties=t7(O,J,"handle-identifier",Q,Y,"handle-annotation",K);break}case"TemplateLiteral":{W=t7(O,J,"handle-identifier",Q,Y,"handle-annotation",K),V={type:"string",pattern:W_(q).source};break}case"Refinement":{W=t7(O,J,"handle-identifier",Q,Y,"handle-annotation",K),V=t7(q,J,"handle-identifier",Q,Y,"handle-annotation",K);break}case"SymbolKeyword":{let L=Q.concat("[symbol]");H.additionalProperties=t7(O,J,"handle-identifier",L,Y,"handle-annotation",K),V=t7(q,J,"handle-identifier",L,Y,"handle-annotation",K);break}}}for(let U=0;U<X.propertySignatures.length;U++){let O=X.propertySignatures[U],q=O.name;if(n9(q)){let L=Bu(O.type),A=L??O.type;if(H.properties[q]=GZ0(t7(A,J,"handle-identifier",Q.concat(O.name),Y,"handle-annotation",K),YZ0(A,O)),!O.isOptional&&L===void 0)H.required.push(q)}else{if(K==="ignore-errors")return N6(JN,X);throw Error(AN0(q,Q))}}if(W!==void 0)delete H.additionalProperties,H.patternProperties={"":W};if(V!==void 0)H.propertyNames=V;return N6(H,X)}case"Union":{let H=X.types.map((V)=>t7(V,J,"handle-identifier",Q,Y,"handle-annotation",K)),W=Vf8(H);switch(W.length){case 0:return hR;case 1:return N6(W[0],X);default:return N6({anyOf:W},X)}}case"Refinement":return t7(X.from,J,Z,Q,Y,"handle-annotation",K);case"TemplateLiteral":{let H=W_(X);return N6({type:"string",title:String(X),description:"a template literal",pattern:H.source},X)}case"Transformation":{if(Jf8(X.from)){let W={type:"string",contentMediaType:"application/json"};if(Yf8(Y))W.contentSchema=t7(X.to,J,Z,Q,Y,"handle-annotation",K);return W}let H=t7(X.from,J,Z,Q,Y,"handle-annotation",K);if(X.transformation._tag==="TypeLiteralTransformation"&&Op0(H)){let W=t7(X.to,{},"ignore-identifier",Q,Y,"handle-annotation","ignore-errors");if(Op0(W))for(let V of X.transformation.propertySignatureTransformations){let{to:U,from:O}=V;if(n9(U)&&n9(O)){let q=W.properties[U];if(l5(q)){let L=H.properties[O];if(l5(L)){let A={};if(n9(q.title))A.title=q.title;if(n9(q.description))A.description=q.description;if(Array.isArray(q.examples))A.examples=q.examples;if(Object.hasOwn(q,"default")&&q.default!==void 0)A.default=q.default;H.properties[O]=Pp0(L,A)}}}}}return N6(H,X)}}}function Op0(X){return l5(X)&&X.type==="object"&&l5(X.properties)}function Kf8(X){return X===hR||V0(X,"$id")&&X.$id===hR.$id&&Object.keys(X).length===3&&X.title===FU.annotations[IZ]}function Bf8(X){return"$id"in X&&X.$id===JN.$id}function Hf8(X){return"$id"in X&&X.$id===qp0.$id}function Wf8(X){return"$id"in X&&X.$id===Dp0.$id}function _p0(X){return V0(X,"enum")&&"type"in X&&Object.keys(X).length===2}function Vf8(X){let J=[];for(let Z of X){if(Kf8(Z))continue;if(Bf8(Z)||Hf8(Z)||Wf8(Z))return[Z];if(_p0(Z)&&J.length>0){let Q=J[J.length-1];if(_p0(Q)&&Q.type===Z.type){J[J.length-1]={type:Q.type,enum:[...Q.enum,...Z.enum]};continue}}J.push(Z)}return J}var HZ0=g8("@effect/platform/HttpLayerRouter");var $f8=Symbol.for("@effect/platform/HttpLayerRouter/Middleware"),Uf8=function(){if(arguments.length===0)return jp0;return jp0(arguments[0],arguments[1])},jp0=(X,J)=>J?.global?WJ(f0(function*(){let Z=yield*HZ0,Q=VX(X)?yield*X:X;yield*Z.addGlobalMiddleware(Q)})):new WZ0(VX(X)?VH(u(X,(Z)=>nZ(new Map([[BZ0,Z]])))):to(nZ(new Map([[BZ0,X]])))),zf8=0,BZ0="@effect/platform/HttpLayerRouter/MiddlewareFn";class WZ0{layerFn;dependencies;[$f8]={};constructor(X,J){this.layerFn=X,this.dependencies=J;let Z=`@effect/platform/HttpLayerRouter/Middleware-${++zf8}`;this.layer=VH(f0(this,function*(){let Q=yield*EX(),Y=[Q.unsafeMap.get(BZ0)];if(this.dependencies){let G=yield*ro,K=z9(Q,O4),B=yield*Xr(this.dependencies,G,K);Y.push(...Nf8(B))}return nZ(new Map([[Z,Y]]))})).pipe(D6(this.layerFn))}layer;combine(X){return new WZ0(this.layerFn,this.dependencies?w3(this.dependencies,X.layer):X.layer)}}var Cp0=new WeakMap,Nf8=(X)=>{let J=Cp0.get(X);if(J)return J;let Z=l0(),Q=0;for(let[Y,G]of X.unsafeMap)if(Y.startsWith("@effect/platform/HttpLayerRouter/Middleware-")){if(Z.push(G),G.length>Q)Q=G.length}if(Z.length===0)J=[];else{let Y=new Set;for(let G=Q-1;G>=0;G--)for(let K of Z)if(G<K.length)Y.add(K[G]);J=v0(Y).reverse()}return Cp0.set(X,J),J};var bq9=Uf8(lf0).layer;var Ip0=rY;var Ep0=ow;var qf8=hX(function*(X,J){let Z=J.disableTracing!==!0,Q=J.disableSpanPropagation!==!0,Y=J.disableClientAcks!==!0,G=J.spanPrefix??"RpcServer",K=J.concurrency??"unbounded",B=J.disableFatalDefects??!1,H=yield*EX(),W=z9(H,O4),V=yield*Cz(),U=yield*BR(V)().pipe(QX),O=K==="unbounded"?void 0:OU(K).withPermits(1),q=new Map,L=!1,A=kG(!1);yield*FJ(W,o0(()=>{L=!0;for(let P of q.values()){if(P.ended=!0,P.fibers.size===0){U(j(P));continue}for(let C of P.fibers.values())C.unsafeInterruptAsFork(Sp0)}if(q.size===0)return U0;return A.await}));let M=(P)=>o0(()=>{let C=q.get(P);if(!C)return U0;for(let v of C.fibers.values())v.unsafeInterruptAsFork(Sp0);return q.delete(P),U0}),x=(P,C)=>$x(AJ((v)=>{if(L)return aJ;let f=q.get(P);if(!f)f={id:P,latches:new Map,fibers:new Map,ended:!1},q.set(P,f);else if(f.ended)return aJ;switch(C._tag){case"Request":return T(v,f,C);case"Ack":{let s=f.latches.get(C.requestId);return s?s.open:U0}case"Interrupt":{let s=f.fibers.get(C.requestId);return s?gV0(s,Tf8):J.onFromServer({_tag:"Exit",clientId:P,requestId:C.requestId,exit:T1(d7)})}case"Eof":{if(f.ended=!0,f.fibers.size>0)return U0;return j(f)}default:return k(f,`Unknown request tag: ${C._tag}`)}}),(v)=>k(q.get(P),v)),j=(P)=>{q.delete(P.id);let C=J.onFromServer({_tag:"ClientEnd",clientId:P.id});if(L&&q.size===0)return C0(C,A.open);return C},T=(P,C,v)=>{if(C.fibers.has(v.id))return h(v1(C.fibers.get(v.id)),()=>T(P,C,v));let f=X.requests.get(v.tag),s=H.unsafeMap.get(f?.key);if(!f||!s){let b8=$x(J.onFromServer({_tag:"Exit",clientId:C.id,requestId:v.id,exit:Y5(`Unknown request tag: ${v.tag}`)}),(j6)=>k(C,j6));if(!C.ended||C.fibers.size>0)return b8;return C0(b8,j(C))}let l=dd(f.successSchema),W0=s.handler(v.payload,{clientId:C.id,headers:v.headers}),b=cd(W0),a=b&&W0.fork,n=b&&W0.uninterruptible,r=b?W0.value:W0,J0=Df8(f,H,C.id,v.payload,v.headers,l?E(C,v,r):r),F0=!1,Z8=a6(n?J0:QX(J0),{onSuccess:(b8)=>{return F0=!0,J.onFromServer({_tag:"Exit",clientId:C.id,requestId:v.id,exit:v8(b8)})},onFailure:(b8)=>{if(F0=!0,!B&&Kn(b8)&&!PZ(b8))return k(C,BJ(b8));return J.onFromServer({_tag:"Exit",clientId:C.id,requestId:v.id,exit:_9(b8)})}});if(Z){let b8=P.currentContext.unsafeMap.get(zO.key);Z8=_x(Z8,`${G}.${v.tag}`,{captureStackTrace:!1,attributes:{requestId:String(v.id),...J.spanAttributes},parent:Q&&v.spanId?{_tag:"ExternalSpan",traceId:v.traceId,spanId:v.spanId,sampled:v.sampled,context:jX()}:void 0,links:Q&&b8?[{_tag:"SpanLink",span:b8,attributes:{}}]:void 0})}if(!a&&O)Z8=O(Z8);let J8=XT({context:CX(s.context,P.currentContext),fiberRefs:P.getFiberRefs(),runtimeFlags:Ep0(A3.runtimeFlags,Ip0)}),S8=KQ(J8,Z8);return C.fibers.set(v.id,S8),S8.addObserver((b8)=>{if(!F0&&b8._tag==="Failure")V2(V,KQ(J8,J.onFromServer({_tag:"Exit",clientId:C.id,requestId:v.id,exit:T1(d7)})));if(C.fibers.delete(v.id),C.latches.delete(v.id),C.ended&&C.fibers.size===0)V2(V,KQ(J8,j(C)))}),U0},E=(P,C,v)=>{let f=P.latches.get(C.id);if(Y&&!f)f=kG(!1),P.latches.set(C.id,f);if(VX(v)){let s=!1;return v.pipe(h((l)=>ZH({while:()=>!s,body:YG(h(l.takeAll,([W0,b])=>{if(s=b,!FX(W0))return U0;let a=J.onFromServer({_tag:"Chunk",clientId:P.id,requestId:C.id,values:G9(W0)});if(!f)return a;return f.unsafeClose(),C0(a,f.await)})),step:O6})),l7)}return Jq(v,(s)=>{if(!FX(s))return U0;let l=J.onFromServer({_tag:"Chunk",clientId:P.id,requestId:C.id,values:G9(s)});if(!f)return l;return f.unsafeClose(),C0(l,f.await)})},k=(P,C)=>o0(()=>{let v=P.ended&&P.fibers.size===0,f=J.onFromServer({_tag:"Defect",clientId:P.id,defect:C});if(!v)return f;return C0(f,j(P))});return t({write:x,disconnect:M})}),Df8=(X,J,Z,Q,Y,G)=>{if(X.middlewares.size===0)return G;let K={rpc:X,payload:Q,headers:Y,clientId:Z};for(let B of X.middlewares)if(B.wrap)G=x6(J,B)({...K,next:G});else if(B.optional){let H=x6(J,B),W=G;G=q9(H(K),{onFailure:()=>W,onSuccess:B.provides!==void 0?(V)=>PJ(W,B.provides,V):(V)=>W})}else{let H=x6(J,B);G=B.provides!==void 0?z5(G,B.provides,H(K)):C0(H(K),G)}return G},xp0=hX(function*(X,J){let{disconnects:Z,end:Q,run:Y,send:G,supportsAck:K,supportsSpanPropagation:B,supportsTransferables:H}=yield*$K,W=yield*EX(),V=yield*wF(),U=yield*qf8(X,{...J,disableClientAcks:!K,disableSpanPropagation:!B,onFromServer(T){let E=L.get(T.clientId);if(!E)return U0;switch(T._tag){case"Chunk":{let k=E.schemas.get(T.requestId);if(!k)return U0;return A(E,T.requestId,k.encodeDefect,k.collector,o6(k.encodeChunk(T.values),k.context),(P)=>({_tag:"Chunk",requestId:String(T.requestId),values:P}))}case"Exit":{let k=E.schemas.get(T.requestId);if(!k)return U0;return E.schemas.delete(T.requestId),A(E,T.requestId,k.encodeDefect,k.collector,o6(k.encodeExit(T.exit),k.context),(P)=>({_tag:"Exit",requestId:String(T.requestId),exit:P}))}case"Defect":return j(E,T.defect);case"ClientEnd":return L.delete(T.clientId),Q(T.clientId)}}}).pipe(E1(V));yield*vi(QX(ZH({while:G6,body:YG(h(Z.take,(T)=>{return L.delete(T),U.disconnect(T)})),step:O6})));let O=new WeakMap,q=(T)=>{let E=O.get(T);if(!E){let k=W.unsafeMap.get(T.key),P=gD(T.successSchema.ast);E={decode:t9(T.payloadSchema),encodeChunk:A5(K8(R0(P)?P.value.success:kb)),encodeExit:A5(ud(T)),encodeDefect:A5(T.defectSchema),context:k.context},O.set(T,E)}return E},L=new Map,A=(T,E,k,P,C,v)=>(P?PJ(C,PV,P):C).pipe(h((f)=>G(T.id,v(f),P&&P.unsafeClear())),s9((f)=>{T.schemas.delete(E);let s=BJ(JQ(f,D5.formatErrorSync));return C0(x(T,E,k,s),U.write(T.id,{_tag:"Interrupt",requestId:E,interruptors:[]}))})),M=JW(e6),x=(T,E,k,P)=>s9(k(P).pipe(h((C)=>G(T.id,{_tag:"Exit",requestId:String(E),exit:{_tag:"Failure",cause:{_tag:"Die",defect:C}}}))),(C)=>j(T,BJ(C))),j=(T,E)=>s9(G(T.id,{_tag:"Defect",defect:M(E)}),(k)=>zU(fi(k),{module:"RpcServer",method:"sendDefect"}));return yield*Y((T,E)=>{let k=L.get(T);if(!k)k={id:T,schemas:new Map},L.set(T,k);switch(E._tag){case"Request":{let P=V0(E,"tag")?E.tag:"",C=X.requests.get(P);if(!C)return j(k,`Unknown request tag: ${P}`);let v;switch(typeof E.id){case"bigint":case"string":{v=JB(E.id);break}default:return j(k,`Invalid request id: ${E.id}`)}let f=q(C);return q9(o6(f.decode(E.payload),f.context),{onFailure:(s)=>x(k,v,f.encodeDefect,D5.formatErrorSync(s)),onSuccess:(s)=>{return k.schemas.set(v,H?{...f,collector:VD()}:f),U.write(T,{...E,id:v,payload:s,headers:GZ(E.headers)})}})}case"Ping":return s9(G(k.id,Rc0),(P)=>j(k,BJ(P)));case"Eof":return U.write(T,E);case"Ack":return U.write(T,{...E,requestId:JB(E.requestId)});case"Interrupt":return U.write(T,{...E,requestId:JB(E.requestId),interruptors:[]});default:return j(k,`Unknown request tag: ${E._tag}`)}}).pipe(QX,N5((T)=>li("BUG: RpcServer protocol crashed",T)),sF((T)=>I1(V,T)),GA(S()))});class $K extends m7("@effect/rpc/RpcServer/Protocol")(){static make=md()}var vp0=f0(function*(){let X=yield*j2,J=X.includesFraming,Z=!X.contentType.includes("json"),Q=yield*k5(),Y,G=0,K=new Map,B=new Set,H=new TextEncoder,W=f0(function*(){let U=yield*cD,O=yield*N3,q=Object.entries(U.headers),L=yield*R9(Z?u(U.arrayBuffer,(C)=>new Uint8Array(C)):U.text),A=G++,M=yield*k5(),x=X.unsafeMake(),j=(C)=>typeof C==="string"?M.offer(H.encode(C)):M.offer(C);B.add(A);let T={write:!J?(C)=>M.offer(C):(C)=>{try{let v=x.encode(C);if(v===void 0)return U0;return j(v)}catch(v){return j(x.encode(AJ0(v)))}},end:M.end};K.set(A,T),yield*a$(O,()=>{if(B.delete(A),K.delete(A),Q.unsafeOffer(A),M.unsafeSize()._tag==="None")return U0;return a9(E,(C)=>Y(A,{_tag:"Interrupt",requestId:String(C)}),{discard:!0})});let E=[];try{let C=x.decode(L);for(let v of C){if(v._tag==="Request")E.push(JB(v.id)),v.headers=q.concat(v.headers);yield*Y(A,v)}}catch(C){yield*T.write(AJ0(C))}if(yield*Y(A,Pc0),!J){let C=l0();while(!0){let[v,f]=yield*M.takeAll;if(C.push(...v),f)break}return Tf0(x.encode(C),{contentType:X.contentType})}let[k,P]=yield*M.takeAll;if(P)return Af0(wf8(k),{contentType:X.contentType});return Mf0(lT(k).pipe($t(GR(M))),{contentType:X.contentType})}).pipe(QX,GA(S()));return{protocol:yield*$K.make((U)=>{return Y=U,y({disconnects:Q,send(O,q){let L=K.get(O);if(!L)return U0;return L.write(q)},end(O){let q=K.get(O);if(!q)return U0;return q.end},clientIds:L0(()=>B),initialMessage:f1,supportsAck:!1,supportsTransferables:!1,supportsSpanPropagation:!1})}),httpApp:W}}),wf8=(X)=>{if(X.length===0)return new Uint8Array(0);if(X.length===1)return kK(X);let J=t5(X,0,(Y,G)=>Y+G.length),Z=new Uint8Array(J),Q=0;for(let Y of X)Z.set(Y,Q),Q+=Y.length;return Z},Lf8=hX(function*(X){let{httpApp:J,protocol:Z}=yield*vp0;return yield*(yield*X.routerTag??Gu).post(X.path,J),Z}),Ff8=hX(function*(X){let J=yield*HZ0,{httpApp:Z,protocol:Q}=yield*vp0;return yield*J.add("POST",X.path,Z),Q});var kp0=(X)=>{let J=X.routerTag??Gu;return GQ($K,Lf8(X)).pipe(D6(J.Live))},bp0=(X)=>GQ($K,Ff8(X));var Af8=hX(function*(X){let J=lY(xO()),Z=yield*j2;return yield*$K.make(hX(function*(Q){let Y=yield*k5(),G=Z.unsafeMake();return yield*X.stdin.pipe(Dt((K)=>{let B=G.decode(K);if(B.length===0)return U0;let H=0;return ZH({while:()=>H<B.length,body:()=>Q(0,B[H++]),step:O6})}),Si,QA(UU),z3(qW(500)),RZ(mV0(J)),MJ,QX,GA(S())),yield*GR(Y).pipe(IH(X.stdout),z3(qW(500)),MJ,QX),{disconnects:yield*k5(),send(K,B){let H=G.encode(B);if(H===void 0)return U0;return Y.offer(H)},end(K){return Y.end},clientIds:y(new Set([0])),initialMessage:f1,supportsAck:!0,supportsTransferables:!1,supportsSpanPropagation:!0}}))}),yp0=(X)=>P4($K,Af8(X)),Tf8=B$(-499,0),Sp0=B$(-503,0);var VZ0=Symbol.for("effect/RcMap"),Pf8={_K:t,_A:t,_E:t};class gp0{lookup;context;scope;idleTimeToLive;capacity;[VZ0];state={_tag:"Open",map:nB()};semaphore=S1(1);constructor(X,J,Z,Q,Y){this.lookup=X,this.context=J,this.scope=Z,this.idleTimeToLive=Q,this.capacity=Y,this[VZ0]=Pf8}pipe(){return K0(this,arguments)}}var hp0=(X)=>M8((J)=>{let Z=J.getFiberRef(F7),Q=z9(Z,iJ),Y=X.idleTimeToLive===void 0?void 0:typeof X.idleTimeToLive==="function"?x2(X.idleTimeToLive,K9):YG(K9(X.idleTimeToLive)),G=new gp0(X.lookup,Z,Q,Y,Math.max(X.capacity??Number.POSITIVE_INFINITY,0));return l9(Q.addFinalizer(()=>I0(()=>{if(G.state._tag==="Closed")return N8;let K=G.state.map;return G.state={_tag:"Closed"},AQ(K,([,B])=>RQ(B.scope,oX)).pipe(i6(()=>{u20(K)}),G.semaphore.withPermits(1))})),G)}),mp0=$(2,(X,J)=>{let Z=X;return kX((Q)=>Rf8(Z,J,Q))}),Rf8=yB(function*(X,J,Z){if(X.state._tag==="Closed")return yield*nX;let Q=X.state,Y=H7(Q.map,J),G;if(Y._tag==="Some")G=Y.value,G.refCount++;else if(Number.isFinite(X.capacity)&&AO(X.state.map)>=X.capacity)return yield*p8(new _I(`RcMap attempted to exceed capacity of ${X.capacity}`));else G=yield*X.semaphore.withPermits(1)(jf8(X,J,Z));return yield*(yield*iJ).addFinalizer(()=>G.finalizer),yield*Z(IX(G.deferred))}),jf8=yB(function*(X,J,Z){let Q=yield*H5(),Y=yield*f7(),G=X.lookup(J),K=new Map(X.context.unsafeMap);yield*Z(hB(G,(W)=>{return W.unsafeMap.forEach((V,U)=>{K.set(U,V)}),K.set(iJ.key,Q),nZ(K)})).pipe(B6,p((W)=>ML(Y,W)),x1(Q));let B=X.idleTimeToLive?X.idleTimeToLive(J):QY,H={deferred:Y,scope:Q,finalizer:void 0,idleTimeToLive:B,fiber:void 0,expiresAt:0,refCount:1};if(H.finalizer=Cf8(X,J,H),X.state._tag==="Open")XQ(X.state.map,J,H);return H}),Cf8=(X,J,Z)=>V4((Q)=>{if(Z.refCount--,Z.refCount>0)return N8;else if(X.state._tag==="Closed"||!K5(X.state.map,J)||QC(Z.idleTimeToLive)){if(X.state._tag==="Open")G3(X.state.map,J);return RQ(Z.scope,oX)}if(!bK(Z.idleTimeToLive))return N8;if(Z.expiresAt=Q.unsafeCurrentTimeMillis()+K7(Z.idleTimeToLive),Z.fiber)return N8;return KI(function Y(G){let K=Q.unsafeCurrentTimeMillis(),B=Z.expiresAt-K;if(B<=0){if(X.state._tag==="Closed"||Z.refCount>0)return N8;return G3(X.state.map,J),G(RQ(Z.scope,oX))}return p(Q.sleep(v6(B)),()=>Y(G))}).pipe(MZ(B0(()=>{Z.fiber=void 0})),x1(X.scope),i6((Y)=>{Z.fiber=Y}),X.semaphore.withPermits(1))});var dp0=hp0,$Z0=mp0;var Sf8={add(...X){return kV({requests:up0(...this.requests.values(),...X),annotations:this.annotations})},merge(...X){let J=new Map(this.requests),Z=new Map(this.annotations.unsafeMap);for(let Q of X){for(let[Y,G]of Q.requests)J.set(Y,G);for(let[Y,G]of Q.annotations.unsafeMap)Z.set(Y,G)}return kV({requests:J,annotations:nZ(Z)})},middleware(X){let J=new Map;for(let[Z,Q]of this.requests)J.set(Z,Q.middleware(X));return kV({requests:J,annotations:this.annotations})},toHandlersContext(X){return f0(this,function*(){let J=yield*EX(),Z=VX(X)?yield*X:X,Q=new Map;for(let[Y,G]of Object.entries(Z)){let K=this.requests.get(Y);Q.set(K.key,{handler:G,context:J})}return nZ(Q)})},prefix(X){let J=new Map;for(let Z of this.requests.values()){let Q=Z.prefix(X);J.set(Q._tag,Q)}return kV({requests:J,annotations:this.annotations})},toLayer(X){return VH(this.toHandlersContext(X))},of:t,toLayerHandler(X,J){return VH(f0(this,function*(){let Z=yield*EX(),Q=VX(J)?yield*J:J,Y=new Map,G=this.requests.get(X);return Y.set(G.key,{handler:Q,context:Z}),nZ(Y)}))},accessHandler(X){return VU((J)=>{let Z=this.requests.get(X),{context:Q,handler:Y}=J.unsafeMap.get(Z.key);return(G,K)=>{let B=Y(G,K),H=cd(B)?B.value:B;return VX(H)?o6(H,Q):oT(H,Q)}})},annotate(X,J){return kV({requests:this.requests,annotations:X9(this.annotations,X,J)})},annotateRpcs(X,J){return this.annotateRpcsContext(OZ(X,J))},annotateContext(X){return kV({requests:this.requests,annotations:CX(this.annotations,X)})},annotateRpcsContext(X){let J=new Map;for(let[Z,Q]of this.requests)J.set(Z,Q.annotateContext(CX(X,Q.annotations)));return kV({requests:J,annotations:this.annotations})}},kV=(X)=>Object.assign(function(){},Sf8,{requests:X.requests,annotations:X.annotations}),up0=(...X)=>{let J=new Map;for(let Z of X)J.set(Z._tag,eX(Z)?Mc0(Z):Z);return J},mR=(...X)=>kV({requests:up0(...X),annotations:jX()});var cp0=Symbol.for("@effect/rpc/RpcMiddleware"),fp0=()=>(X,J)=>{let Z=globalThis.Error,Q=Z.stackTraceLimit;Z.stackTraceLimit=2;let Y=new Z;Z.stackTraceLimit=Q;function G(){}let K=G;if(Object.setPrototypeOf(G,Object.getPrototypeOf(g8(X))),G.key=X,Object.defineProperty(G,"stack",{get(){return Y.stack}}),K[cp0]=cp0,K.failure=J?.optional===!0||J?.failure===void 0?b4:J.failure,J?.provides)K.provides=J.provides;return K.optional=J?.optional??!1,K.requiredForClient=J?.requiredForClient??!1,K.wrap=J?.wrap??!1,G};var kf8=U8(d,L8),pp0=U8(d,L8);class UK extends $0({_meta:u0($0({progressToken:u0(pp0)}))}){}class bV extends $0({_meta:u0(i7({key:d,value:A6}))}){}class YB extends $0({_meta:u0(i7({key:d,value:A6}))}){}var lp0=d;class dR extends $0({...UK.fields,cursor:u0(lp0)}){}class uR extends $0({...bV.fields,nextCursor:u0(lp0)}){}var UZ0=s0("user","assistant");class ZN extends $0({audience:u0(K8(UZ0)),priority:u0(L8.pipe(uW(0,1)))}){}class zZ0 extends $0({name:d,title:u0(d),version:d}){}class np0 extends D9("@effect/ai/McpSchema/ClientCapabilities")({experimental:u0(i7({key:d,value:$0({})})),roots:u0($0({listChanged:u0(q8)})),sampling:u0($0({})),elicitation:u0($0({}))}){}class ip0 extends $0({experimental:u0(i7({key:d,value:$0({})})),logging:u0($0({})),completions:u0($0({})),prompts:u0($0({listChanged:u0(q8)})),resources:u0($0({subscribe:u0(q8),listChanged:u0(q8)})),tools:u0($0({listChanged:u0(q8)}))}){}class g7 extends D9("@effect/ai/McpSchema/McpError")({code:L8,message:d,data:u0(A6)}){}var bf8=-32600,yf8=-32601,gf8=-32602,hf8=-32603,mf8=-32700;class df8 extends WQ()("ParseError",{...g7.fields,code:mQ(mf8)}){}class uf8 extends WQ()("InvalidRequest",{...g7.fields,code:mQ(bf8)}){}class cf8 extends WQ()("MethodNotFound",{...g7.fields,code:mQ(yf8)}){}class pD extends WQ()("InvalidParams",{...g7.fields,code:mQ(gf8)}){}class zK extends WQ()("InternalError",{...g7.fields,code:mQ(hf8)}){static notImplemented=new zK({message:"Not implemented"})}class NZ0 extends R6("ping",{success:$0({}),error:g7,payload:SJ(UK)}){}class op0 extends D9("@effect/ai/McpSchema/InitializeResult")({...bV.fields,protocolVersion:d,capabilities:ip0,serverInfo:zZ0,instructions:u0(d)}){}class rp0 extends R6("initialize",{success:op0,error:g7,payload:{...UK.fields,protocolVersion:d,capabilities:np0,clientInfo:zZ0}}){}class ap0 extends R6("notifications/initialized",{payload:SJ(YB)}){}class OZ0 extends R6("notifications/cancelled",{payload:{...YB.fields,requestId:kf8,reason:u0(d)}}){}class _Z0 extends R6("notifications/progress",{payload:{...YB.fields,progressToken:pp0,progress:u0(L8),total:u0(L8),message:u0(d)}}){}class cR extends D9("@effect/ai/McpSchema/Resource")({uri:d,name:d,title:u0(d),description:u0(d),mimeType:u0(d),annotations:u0(ZN),size:u0(L8)}){}class Wu extends D9("@effect/ai/McpSchema/ResourceTemplate")({uriTemplate:d,name:d,title:u0(d),description:u0(d),mimeType:u0(d),annotations:u0(ZN)}){}class qZ0 extends $0({uri:d,mimeType:u0(d)}){}class DZ0 extends $0({...qZ0.fields,text:d}){}class wZ0 extends $0({...qZ0.fields,blob:qM}){}class Vu extends D9("@effect/ai/McpSchema/ListResourcesResult")({...uR.fields,resources:K8(cR)}){}class sp0 extends R6("resources/list",{success:Vu,error:g7,payload:SJ(dR)}){}class $u extends D9("@effect/ai/McpSchema/ListResourceTemplatesResult")({...uR.fields,resourceTemplates:K8(Wu)}){}class tp0 extends R6("resources/templates/list",{success:$u,error:g7,payload:SJ(dR)}){}class ep0 extends $0({...bV.fields,contents:K8(U8(DZ0,wZ0))}){}class Xl0 extends R6("resources/read",{success:ep0,error:g7,payload:{...UK.fields,uri:d}}){}class Jl0 extends R6("notifications/resources/list_changed",{payload:SJ(YB)}){}class Zl0 extends R6("resources/subscribe",{error:g7,payload:{...UK.fields,uri:d}}){}class Ql0 extends R6("resources/unsubscribe",{error:g7,payload:{...UK.fields,uri:d}}){}class Yl0 extends R6("notifications/resources/updated",{payload:{...YB.fields,uri:d}}){}class Gl0 extends $0({name:d,title:u0(d),description:u0(d),required:u0(q8)}){}class Uu extends D9("@effect/ai/McpSchema/Prompt")({name:d,title:u0(d),description:u0(d),arguments:u0(K8(Gl0))}){}class fR extends $0({type:mQ("text"),text:d,annotations:u0(ZN)}){}class LZ0 extends $0({type:mQ("image"),data:qM,mimeType:d,annotations:u0(ZN)}){}class FZ0 extends $0({type:mQ("audio"),data:qM,mimeType:d,annotations:u0(ZN)}){}class Kl0 extends $0({type:mQ("resource"),resource:U8(DZ0,wZ0),annotations:u0(ZN)}){}class Bl0 extends $0({...cR.fields,type:mQ("resource_link")}){}class AZ0 extends U8(fR,LZ0,FZ0,Kl0,Bl0){}class Hl0 extends $0({role:UZ0,content:AZ0}){}class zu extends D9("@effect/ai/McpSchema/ListPromptsResult")({...uR.fields,prompts:K8(Uu)}){}class Wl0 extends R6("prompts/list",{success:zu,error:g7,payload:SJ(dR)}){}class Nu extends D9("@effect/ai/McpSchema/GetPromptResult")({...bV.fields,messages:K8(Hl0),description:u0(d)}){}class Vl0 extends R6("prompts/get",{success:Nu,error:g7,payload:{...UK.fields,name:d,title:u0(d),arguments:u0(i7({key:d,value:d}))}}){}class $l0 extends R6("notifications/prompts/list_changed",{payload:SJ(YB)}){}class Ou extends D9("@effect/ai/McpSchema/ToolAnnotations")({title:u0(d),readOnlyHint:X0(q8,{default:()=>!1}),destructiveHint:X0(q8,{default:()=>!0}),idempotentHint:X0(q8,{default:()=>!1}),openWorldHint:X0(q8,{default:()=>!0})}){}class _u extends D9("@effect/ai/McpSchema/Tool")({name:d,title:u0(d),description:u0(d),inputSchema:A6,annotations:u0(Ou)}){}class qu extends D9("@effect/ai/McpSchema/ListToolsResult")({...uR.fields,tools:K8(_u)}){}class Ul0 extends R6("tools/list",{success:qu,error:g7,payload:SJ(dR)}){}class pR extends D9("@effect/ai/McpSchema/CallToolResult")({...bV.fields,content:K8(AZ0),structuredContent:u0(A6),isError:u0(q8)}){}class zl0 extends R6("tools/call",{success:pR,error:g7,payload:{...UK.fields,name:d,arguments:i7({key:d,value:A6})}}){}class Nl0 extends R6("notifications/tools/list_changed",{payload:SJ(YB)}){}var Ol0=s0("debug","info","notice","warning","error","critical","alert","emergency");class _l0 extends R6("logging/setLevel",{payload:{...UK.fields,level:Ol0},error:g7}){}class ql0 extends R6("notifications/message",{payload:$0({...YB.fields,level:Ol0,logger:u0(d),data:A6})}){}class Dl0 extends $0({role:UZ0,content:U8(fR,LZ0,FZ0)}){}class wl0 extends $0({name:u0(d)}){}class Ll0 extends D9("@effect/ai/McpSchema/ModelPreferences")({hints:u0(K8(wl0)),costPriority:u0(L8.pipe(uW(0,1))),speedPriority:u0(L8.pipe(uW(0,1))),intelligencePriority:u0(L8.pipe(uW(0,1)))}){}class Fl0 extends D9("@effect/ai/McpSchema/CreateMessageResult")({model:d,stopReason:u0(d)}){}class Al0 extends R6("sampling/createMessage",{success:Fl0,error:g7,payload:{messages:K8(Dl0),modelPreferences:u0(Ll0),systemPrompt:u0(d),includeContext:u0(s0("none","thisServer","allServers")),temperature:u0(L8),maxTokens:L8,stopSequences:u0(K8(d)),metadata:A6}}){}class Tl0 extends $0({type:mQ("ref/resource"),uri:d}){}class Ml0 extends $0({type:mQ("ref/prompt"),name:d,title:u0(d)}){}class lD extends D9("@effect/ai/McpSchema/CompleteResult")({completion:$0({values:K8(d),total:u0(L8),hasMore:u0(q8)})}){static empty=lD.make({completion:{values:[],total:0,hasMore:!1}})}class Pl0 extends R6("completion/complete",{success:lD,error:g7,payload:$0({ref:U8(Ml0,Tl0),argument:$0({name:d,value:d}),context:X0($0({arguments:X0(i7({key:d,value:d}),{default:()=>({})})}),{default:()=>({arguments:{}})})})}){}class Rl0 extends D9("@effect/ai/McpSchema/Root")({uri:d,name:u0(d)}){}class jl0 extends D9("@effect/ai/McpSchema/ListRootsResult")({roots:K8(Rl0)}){}class Cl0 extends R6("roots/list",{success:jl0,error:g7,payload:SJ(UK)}){}class Il0 extends R6("notifications/roots/list_changed",{payload:SJ(YB)}){}class El0 extends D9("@effect/ai/McpSchema/ElicitAcceptResult")({...bV.fields,action:s0("accept"),content:A6}){}class Sl0 extends D9("@effect/ai/McpSchema/ElicitDeclineResult")({...bV.fields,action:s0("cancel","decline")}){}var ff8=U8(El0,Sl0);class lR extends R6("elicitation/create",{success:ff8,error:g7,payload:{message:d,requestedSchema:A6}}){}class Du extends WQ("@effect/ai/McpSchema/ElicitationDeclined")("ElicitationDeclined",{request:lR.payloadSchema,cause:u0(e6)}){}class nR extends m7("@effect/ai/McpSchema/McpServerClient")(){}class iR extends fp0()("@effect/ai/McpSchema/McpServerClientMiddleware",{provides:nR}){}class xl0 extends mR(NZ0,rp0,Pl0,_l0,Vl0,Wl0,sp0,tp0,Xl0,Zl0,Ql0,zl0,Ul0).middleware(iR){}class wu extends mR(OZ0,_Z0,ap0,Il0){}class Lu extends xl0.merge(wu){}class TZ0 extends mR(NZ0,Al0,Cl0,lR){}class Fu extends mR(OZ0,_Z0,ql0,Yl0,Jl0,Nl0,$l0){}var vl0=Symbol.for("@effect/ai/McpSchema/ParamNameId");var NK={};y8(NK,{unsafeSecureJsonParse:()=>Jp8,providerDefined:()=>of8,make:()=>if8,isUserDefined:()=>pf8,isProviderDefined:()=>kl0,getJsonSchemaFromSchemaAst:()=>hl0,getJsonSchema:()=>af8,getDescriptionFromSchemaAst:()=>gl0,getDescription:()=>rf8,fromTaggedRequest:()=>PZ0,TypeId:()=>MZ0,Title:()=>Tu,Readonly:()=>Mu,ProviderDefinedTypeId:()=>Au,OpenWorld:()=>ju,Idempotent:()=>Ru,Destructive:()=>Pu});var MZ0="~@effect/ai/Tool",Au="~@effect/ai/Tool/ProviderDefined",pf8=(X)=>V0(X,MZ0)&&!kl0(X),kl0=(X)=>V0(X,Au),bl0={[MZ0]:{_Requirements:t},pipe(){return K0(this,arguments)},addDependency(){return yV({...this})},setParameters(X){return yV({...this,parametersSchema:eX(X)?X:$0(X)})},setSuccess(X){return yV({...this,successSchema:X})},setFailure(X){return yV({...this,failureSchema:X})},annotate(X,J){return yV({...this,annotations:X9(this.annotations,X,J)})},annotateContext(X){return yV({...this,annotations:CX(this.annotations,X)})}},lf8={...bl0,[Au]:Au},yV=(X)=>{let J=Object.assign(Object.create(bl0),X);return J.id=`@effect/ai/Tool/${X.name}`,J},nf8=(X)=>Object.assign(Object.create(lf8),X),yl0=$0({}),if8=(X,J)=>{let Z=J?.success??yH,Q=J?.failure??b4;return yV({name:X,description:J?.description,parametersSchema:J?.parameters?$0(J?.parameters):yl0,successSchema:Z,failureSchema:Q,failureMode:J?.failureMode??"error",annotations:jX()})},of8=(X)=>(J)=>{let Z="failureMode"in J?J.failureMode:void 0,Q=X?.success??yH,Y=X?.failure??b4;return nf8({id:X.id,name:X.toolkitName,providerName:X.providerName,args:J,argsSchema:$0(X.args),requiresHandler:X.requiresHandler??!1,parametersSchema:X?.parameters?$0(X?.parameters):yl0,successSchema:Q,failureSchema:Y,failureMode:Z??"error"})},PZ0=(X)=>yV({name:X._tag,description:u9(HH(X.ast.to)),parametersSchema:X,successSchema:X.success,failureSchema:X.failure,failureMode:"error",annotations:jX()}),rf8=(X)=>{if(Qj(X.description))return X.description;return gl0(X.parametersSchema.ast)},gl0=(X)=>{let J=X._tag==="Transformation"?{...X.to.annotations,...X.annotations}:X.annotations;return _Y in J?J[_Y]:void 0},af8=(X)=>hl0(X.parametersSchema.ast),hl0=(X)=>{let J={},Z=Hu(X,{definitions:J,topLevelReferenceStrategy:"skip"});if(Object.keys(J).length===0)return Z;return Z.$defs=J,Z};class Tu extends m7("@effect/ai/Tool/Title")(){}class Mu extends ZJ()("@effect/ai/Tool/Readonly",{defaultValue:C6}){}class Pu extends ZJ()("@effect/ai/Tool/Destructive",{defaultValue:G6}){}class Ru extends ZJ()("@effect/ai/Tool/Idempotent",{defaultValue:C6}){}class ju extends ZJ()("@effect/ai/Tool/OpenWorld",{defaultValue:G6}){}var sf8=/"__proto__"\s*:/,tf8=/"constructor"\s*:/;function ef8(X){let J=JSON.parse(X);if(J===null||typeof J!=="object")return J;if(sf8.test(X)===!1&&tf8.test(X)===!1)return J;return Xp8(J)}function Xp8(X){let J=[X];while(J.length){let Z=J;J=[];for(let Q of Z){if(Object.prototype.hasOwnProperty.call(Q,"__proto__"))throw SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(Q,"constructor")&&Object.prototype.hasOwnProperty.call(Q.constructor,"prototype"))throw SyntaxError("Object contains forbidden prototype property");for(let Y in Q){let G=Q[Y];if(G&&typeof G==="object")J.push(G)}}}return X}var Jp8=(X)=>{let{stackTraceLimit:J}=Error;Error.stackTraceLimit=0;try{return ef8(X)}finally{Error.stackTraceLimit=J}};class DQ extends m7("@effect/ai/McpServer")(){static make=f0(function*(){let X=Vp8(),J=l0(),Z=new Map,Q=[],Y=[],G=[],K=new Map,B=new Map,H=yield*k5(),W=new Map,V=yield*pJ0(Fu,{spanPrefix:"McpServer/Notifications",onFromClient(U){let O=U.message;if(O._tag!=="Request")return U0;if(O.tag.includes("list_changed")){if(!W.has(O.tag))W.set(O.tag,setTimeout(()=>{H.unsafeOffer(O),W.delete(O.tag)},0))}else H.unsafeOffer(O);return V.write({clientId:0,requestId:O.id,_tag:"Exit",exit:eZ})}});return DQ.of({notifications:V.client,notificationsMailbox:H,initializedClients:new Set,get tools(){return J},addTool:(U)=>o0(()=>{return J.push(U.tool),Z.set(U.tool.name,U.handle),V.client["notifications/tools/list_changed"]({})}),callTool:(U)=>o0(()=>{let O=Z.get(U.name);if(!O)return Y0(new pD({message:`Tool '${U.name}' not found`}));return O(U.arguments)}),get resources(){return Q},get resourceTemplates(){return Y},addResource:(U,O)=>o0(()=>{return Q.push(U),X.add(U.uri,{_tag:"Resource",effect:O}),V.client["notifications/resources/list_changed"]({})}),addResourceTemplate:({completions:U,handle:O,routerPath:q,template:L})=>o0(()=>{Y.push(L),X.add(q,{_tag:"ResourceTemplate",handle:O});for(let[A,M]of Object.entries(U))B.set(`ref/resource/${L.uriTemplate}/${A}`,M);return V.client["notifications/resources/list_changed"]({})}),findResource:(U)=>o0(()=>{let O=X.find(U);if(!O)return y({contents:[]});else if(O.handler._tag==="Resource")return O.handler.effect;let q=[];for(let L of Object.keys(O.params))q[Number(L)]=O.params[L];return O.handler.handle(U,q)}),get prompts(){return G},addPrompt:(U)=>o0(()=>{G.push(U.prompt),K.set(U.prompt.name,U.handle);for(let[O,q]of Object.entries(U.completions))B.set(`ref/prompt/${U.prompt.name}/${O}`,q);return V.client["notifications/prompts/list_changed"]({})}),getPromptResult:hX(function*({arguments:U,name:O}){let q=K.get(O);if(!q)return yield*new pD({message:`Prompt '${O}' not found`});return yield*q(U??{})}),completion:hX(function*(U){let O=U.ref,q=O.type==="ref/resource"?`ref/resource/${O.uri}/${U.argument.name}`:`ref/prompt/${O.name}/${U.argument.name}`,L=B.get(q);return L?yield*L(U.argument.value):lD.empty})})});static layer=P4(DQ,DQ.make)}var dl0="2025-06-18",Zp8=[dl0,"2025-03-26","2024-11-05","2024-10-07"],ul0=hX(function*(X){let J=yield*$K,Z=yield*ao(Up8(X)),Q=yield*DQ,Y=yield*dp0({lookup:hX(function*(H){let W;return{client:yield*Of0(TZ0,{spanPrefix:"McpServer/Client"}).pipe(z5(bR,bR.make(hX(function*(U){return W=U,{send(O,q){return J.send(H,{...O,headers:void 0,traceId:void 0,spanId:void 0,sampled:void 0})},supportsAck:!0,supportsTransferables:!1}})))),write:W}}),idleTimeToLive:1e4}),G=iR.of(({clientId:H})=>L0(()=>nR.of({clientId:H,getClient:$Z0(Y,H).pipe(u(({client:W})=>W))}))),K=$K.of({...J,run:(H)=>J.run((W,V)=>{let U=V;switch(U._tag){case"Request":{if(wu.requests.has(U.tag)){if(U.tag==="notifications/cancelled")return H(W,{_tag:"Interrupt",requestId:String(U.payload.requestId)});let O=Z.unsafeMap.get(U.tag);return O?O.handler(U.payload,{clientId:W,headers:GZ(U.headers)}):U0}return H(W,U)}case"Ping":case"Ack":case"Interrupt":case"Eof":return H(W,U);case"Pong":case"Exit":case"Chunk":case"ClientProtocolError":case"Defect":return $Z0(Y,W).pipe(h(({write:O})=>O(U)),l7)}})}),B=E3(U8(...Array.from(Fu.requests.values(),(H)=>H.payloadSchema)));return yield*Q.notificationsMailbox.take.pipe(h(hX(function*(H){let W=yield*B(H.payload),V={_tag:"Request",tag:H.tag,payload:W},U=yield*K.clientIds;for(let O of Q.initializedClients){if(!U.has(O)){Q.initializedClients.delete(O);continue}yield*K.send(O,V)}})),s9(()=>U0),aO,MJ),yield*xp0(Lu,{spanPrefix:"McpServer",disableFatalDefects:!0}).pipe(PJ($K,K),PJ(iR,G),o6(Z))},l7),Cu=(X)=>WJ(MJ(ul0(X))).pipe(w3(DQ.layer)),Qp8=(X)=>Cu(X).pipe(D6(yp0({stdin:X.stdin,stdout:X.stdout})),D6(Uf0()),w3(jh(ZD)),w3(jh(uP))),Yp8=(X)=>Cu(X).pipe(D6(kp0(X)),D6(fJ0())),Gp8=(X)=>Cu(X).pipe(D6(bp0(X)),D6(fJ0())),cl0=hX(function*(X){let J=yield*DQ,Z=yield*X,Q=yield*EX();for(let Y of Object.values(Z.tools)){let G=new _u({name:Y.name,description:Y.description,inputSchema:pl0(Y.parametersSchema.ast),annotations:new Ou({..._7(Y.annotations,Tu).pipe(r8((K)=>({title:K})),u9),readOnlyHint:z9(Y.annotations,Mu),destructiveHint:z9(Y.annotations,Pu),idempotentHint:z9(Y.annotations,Ru),openWorldHint:z9(Y.annotations,ju)})});yield*J.addTool({tool:G,handle(K){return Z.handle(Y.name,K).pipe(o6(Q),R7({onFailure:(B)=>new pR({isError:!0,structuredContent:typeof B==="object"?B:void 0,content:[{type:"text",text:JSON.stringify(B)}]}),onSuccess:(B)=>new pR({isError:!1,structuredContent:typeof B.encodedResult==="object"?B.encodedResult:void 0,content:[{type:"text",text:JSON.stringify(B.encodedResult)}]})}))}})}}),Kp8=(X)=>ZW(cl0(X)).pipe(D6(DQ.layer)),RZ0=function(){if(arguments.length===1){let Y=arguments[0];return f0(function*(){let G=yield*EX();yield*(yield*DQ).addResource(new cR({...Y,annotations:Y}),Y.content.pipe(o6(G),u((B)=>ml0(Y.uri,B)),s9((B)=>{let H=r$(B)[0];return new zK({message:H.message})})))})}let{params:X,routerPath:J,schema:Z,uriPath:Q}=$p8(...arguments);return hX(function*(Y){let G=yield*EX(),K=yield*DQ,B=t9(Z),H=new Wu({...Y,uriTemplate:Q,annotations:Y}),W={};for(let[V,U]of Object.entries(Y.completion??{})){let O=A5(K8(X[V])),q=(L)=>U(L).pipe(h(O),u((A)=>new lD({completion:{values:A,total:A.length,hasMore:!1}})),s9((A)=>{let M=r$(A)[0];return new zK({message:M.message})}),o6(G));W[V]=q}yield*K.addResourceTemplate({template:H,routerPath:J,completions:W,handle:(V,U)=>B(U).pipe(E9((O)=>new pD({message:O.message})),h((O)=>Y.content(V,...O).pipe(u((q)=>ml0(V,q)),s9((q)=>{let L=r$(q)[0];return new zK({message:L.message})}))),o6(G))})})},Bp8=function(){if(arguments.length===1)return ZW(RZ0(arguments[0])).pipe(D6(DQ.layer));let X=RZ0(...arguments);return(J)=>ZW(X(J)).pipe(D6(DQ.layer))},fl0=(X)=>{let J=l0(),Z={},Q=X.parameters?Q_(X.parameters.ast):[];for(let B of Q)J.push({name:B.name,description:u9(HH(B)),required:!B.isOptional}),Z[B.name]=t8(B.type);let Y=new Uu({name:X.name,description:X.description,arguments:J}),G=X.parameters?t9(X.parameters):()=>y({}),K=X.completion??{};return f0(function*(){let B=yield*DQ,H=yield*EX(),W={};for(let[V,U]of Object.entries(K)){let O=A5(K8(Z[V])),q=(L)=>U(L).pipe(h(O),u((A)=>({completion:{values:A,total:A.length,hasMore:!1}})),s9((A)=>{let M=r$(A)[0];return new zK({message:M.message})}),o6(H));W[V]=q}yield*B.addPrompt({prompt:Y,completions:W,handle:(V)=>G(V).pipe(E9((U)=>new pD({message:U.message})),h((U)=>X.content(U)),u((U)=>{return U=typeof U==="string"?[{role:"user",content:fR.make({text:U})}]:U,new Nu({messages:U,description:Y.description})}),s9((U)=>{let O=r$(U)[0];return new zK({message:O.message})}),o6(H))})})},Hp8=(X)=>ZW(fl0(X)).pipe(D6(DQ.layer)),Wp8=hX(function*(X){let{getClient:J}=yield*nR,Z=yield*J,Q=lR.payloadSchema.make({message:X.message,requestedSchema:pl0(X.schema.ast)}),Y=yield*Z["elicitation/create"](Q).pipe(s9((G)=>Y0(new Du({cause:BJ(G),request:Q}))));switch(Y.action){case"accept":return yield*R9(t9(X.schema)(Y.content));case"cancel":return yield*aJ;case"decline":return yield*Y0(new Du({request:Q}))}},l7),Vp8=()=>{let X=Ju({ignoreTrailingSlash:!0,ignoreDuplicateSlashes:!0,caseSensitive:!0});return{add:(Q,Y)=>{X.on("GET",Q,Y)},find:(Q)=>X.find("GET",Q)}},$p8=(X,...J)=>{let Z=X[0].replace(":","::"),Q=X[0],Y={},G=bZ();if(J.length>0){let K=[];for(let B=0;B<J.length;B++){let H=J[B],W=X[B+1],V=String(B);K.push(H),Z+=`:${V}${W.replace(":","::")}`;let U=C7(vl0)(H.ast).pipe(i0(()=>`param${V}`));Y[U]=H,Q+=`{${U}}${W}`}G=bZ(...K)}return{routerPath:Z,uriPath:Q,schema:G,params:Y}},Up8=(X)=>Lu.toLayer(f0(function*(){let J=yield*DQ;return{ping:()=>y({}),initialize(Z,{clientId:Q}){let Y=Z.protocolVersion,G={completions:{}};if(J.tools.length>0)G.tools={listChanged:!0};if(J.resources.length>0||J.resourceTemplates.length>0)G.resources={listChanged:!0,subscribe:!1};if(J.prompts.length>0)G.prompts={listChanged:!0};return J.initializedClients.add(Q),y({capabilities:G,serverInfo:X,protocolVersion:Zp8.includes(Y)?Y:dl0})},"completion/complete":J.completion,"logging/setLevel":()=>zK.notImplemented,"prompts/get":J.getPromptResult,"prompts/list":()=>L0(()=>new zu({prompts:J.prompts})),"resources/list":()=>L0(()=>new Vu({resources:J.resources})),"resources/read":({uri:Z})=>J.findResource(Z),"resources/subscribe":()=>zK.notImplemented,"resources/unsubscribe":()=>zK.notImplemented,"resources/templates/list":()=>L0(()=>new $u({resourceTemplates:J.resourceTemplates})),"tools/call":J.callTool,"tools/list":()=>L0(()=>new qu({tools:J.tools})),"notifications/cancelled":(Z)=>U0,"notifications/initialized":(Z)=>U0,"notifications/progress":(Z)=>U0,"notifications/roots/list_changed":(Z)=>U0}})),pl0=(X)=>{if(Q_(X).length===0)return{type:"object",properties:{},required:[],additionalProperties:!1};let Z={},Q=Hu(X,{definitions:Z,topLevelReferenceStrategy:"skip"});if(Object.keys(Z).length===0)return Q;return Q.$defs=Z,Q},ml0=(X,J)=>{if(typeof J==="string")return{contents:[{uri:X,text:J}]};else if(J instanceof Uint8Array)return{contents:[{uri:X,blob:J}]};return J};var Su={};y8(Su,{merge:()=>wp8,make:()=>Dp8,empty:()=>qp8,TypeId:()=>Np8});var Iu="~@effect/ai/AiError";class Eu extends WQ("@effect/ai/AiError/MalformedInput")("MalformedInput",{module:d,method:d,description:u0(d),cause:u0(e6)}){[Iu]=Iu}class oR extends WQ("@effect/ai/AiError/MalformedOutput")("MalformedOutput",{module:d,method:d,description:u0(d),cause:u0(e6)}){[Iu]=Iu;static fromParseError({error:X,...J}){return new oR({...J,cause:X})}}var Np8="~@effect/ai/Toolkit",Op8={...dB,...aQ,of:t,toContext(X){return f0(this,function*(){let J=yield*EX(),Z=VX(X)?yield*X:X,Q=new Map;for(let[Y,G]of Object.entries(Z)){let K=this.tools[Y];Q.set(K.id,{handler:G,context:J})}return nZ(Q)})},toLayer(X){return VH(this.toContext(X))},commit(){return f0(this,function*(){let X=this.tools,J=yield*EX(),Z=new WeakMap,Q=(G)=>{let K=Z.get(G);if(gV(K)){let B=J.unsafeMap.get(G.id),H=t9(G.parametersSchema),W=U8(G.successSchema,G.failureSchema),V=xb(W),U=A5(W);K={context:B.context,handler:B.handler,decodeParameters:H,validateResult:V,encodeResult:U},Z.set(G,K)}return K},Y=ai("Toolkit.handle",{captureStackTrace:!1})(function*(G,K){yield*ii({tool:G,parameters:K});let B=X[G];if(gV(B)){let q=Object.keys(X).join(",");return yield*new oR({module:"Toolkit",method:`${G}.handle`,description:`Failed to find tool with name '${G}' in toolkit - available tools: ${q}`})}let H=Q(B),W=yield*E9(H.decodeParameters(K),(q)=>new oR({module:"Toolkit",method:`${G}.handle`,description:`Failed to decode tool call parameters for tool '${G}' from:
633
+ '${JSON.stringify(K,void 0,2)}'`,cause:q})),{isFailure:V,result:U}=yield*H.handler(W).pipe(u((q)=>({result:q,isFailure:!1})),y6((q)=>B.failureMode==="error"?Y0(q):y({result:q,isFailure:!0})),J9(({result:q})=>H.validateResult(q)),rO((q)=>CX(H.context,q)),E9((q)=>ux(q)?new Eu({module:"Toolkit",method:`${G}.handle`,description:`Failed to validate tool call result for tool '${G}'`,cause:q}):q)),O=yield*E9(H.encodeResult(U),(q)=>new Eu({module:"Toolkit",method:`${G}.handle`,description:`Failed to encode tool call result for tool '${G}'`,cause:q}));return{isFailure:V,result:U,encodedResult:O}});return{tools:X,handle:Y}})},toJSON(){return{_id:"@effect/ai/Toolkit",tools:Array.from(Object.values(this.tools)).map((X)=>X.name)}},pipe(){return K0(this,arguments)}},jZ0=(X)=>Object.assign(function(){},Op8,{tools:X}),_p8=(...X)=>{let J={};for(let Z of X){let Q=eX(Z)?PZ0(Z):Z;J[Z.name]=Q}return J},qp8=jZ0({}),Dp8=(...X)=>jZ0(_p8(...X)),wp8=(...X)=>{let J={};for(let Z of X)for(let[Q,Y]of Object.entries(Z.tools))J[Q]=Y;return jZ0(J)};function Lp8(X){return`Read ${new URL("/start.md",X).toString()} and set up Expand. Fetch it as raw text with curl — a summarizing web-fetch tool drops the exact commands.`}function Fp8(X){return _X.stripMargin(`
634
+ |# Expand Start Guide
635
+ |
636
+ |The setup procedure is served as a single document. Fetch it and follow it:
637
+ |
638
+ |${new URL("/start.md",X).toString()}
639
+ |
640
+ |## Agent Setup Prompt
641
+ |
642
+ |${Lp8(X)}
643
+ |`)}function Ap8(X){return _X.stripMargin(`
644
+ |# expand.ai
645
+ |
646
+ |- Website: ${X}
647
+ |- Quickstart: ${new URL("/docs",X).toString()}
648
+ |- Dashboard: ${new URL("/dashboard",X).toString()}
649
+ |`)}var ll0=N.gen(function*(){return yield*(yield*x9).getAppUrl()}),Tp8=I2.resource({uri:"expand://about",name:"About expand.ai",description:"Key links for the expand.ai platform",content:N.map(ll0,Ap8)}),Mp8=I2.resource({uri:"expand://start",name:"Expand Start Guide",description:"Where to find the Expand agent setup guide, and the prompt that runs it",content:N.map(ll0,Fp8)}),nl0=C8.mergeAll(Tp8,Mp8).pipe(C8.provide(x9.Default));import{randomUUID as Pp8}from"node:crypto";var Rp8=P0.all({apiKey:P0.string("POSTHOG_API_KEY").pipe(P0.withDefault("phc_sffcV4skT33mMKmo0BenNoE7t7AghUrOugyW9qSx43B")),host:P0.string("POSTHOG_HOST").pipe(P0.withDefault("https://us.i.posthog.com")),doNotTrack:AD("DO_NOT_TRACK"),noTelemetry:AD("EXPANDAI_NO_TELEMETRY"),apiUrl:P0.string("EXPAND_API_URL").pipe(P0.option),harnessOverride:fm("EXPANDAI_HARNESS",Vu0),claudeCode:AD("CLAUDECODE"),cursor:P0.string("CURSOR_TRACE_ID").pipe(P0.option,P0.map(m.isSome)),codex:P0.string("CODEX_RUN_ID").pipe(P0.option,P0.map(m.isSome))});function jp8(X){if(m.isSome(X.harnessOverride))return X.harnessOverride.value;if(X.claudeCode)return"claude-code";if(X.cursor)return"cursor";if(X.codex)return"codex";return"unknown"}var il0=N.sync(()=>Pp8());function ol0(X){try{return new URL(X).toString()}catch{return`unparseable:${X}`}}class gY extends N.Service()("@expandai/cli/Telemetry",{dependencies:[x9.Default,U2.layer],scoped:N.gen(function*(){let X=yield*x9,J=yield*v5.HttpClient,Z=yield*MV.make(),Q=yield*Rp8,Y=yield*P0.string("EXPAND_API_KEY").pipe(P0.option,P0.map(m.isSome)),{config:G,parseFailed:K}=yield*X.readConfigFile(),B=G.telemetry,H=m.firstSomeOf([Q.apiUrl,m.map(m.fromNullable(G.apiUrl),(j)=>j.toString())]),W=m.match(H,{onNone:()=>!1,onSome:(j)=>ol0(j)!==ol0(cm)}),V=!Q.doNotTrack&&!Q.noTelemetry&&!W&&!K&&B?.enabled!==!1,U=jp8(Q),O=Y?"api-key":G.authMethod?._tag==="ApiKey"?"api-key":G.authMethod?._tag==="OAuth"?"oauth":"none",q=N.fnUntraced(function*(){let j=yield*il0;return yield*X.updateConfig({telemetry:{...B,distinctId:j}}).pipe(N.ignore),j}),L=B?.distinctId??(V?yield*q():yield*il0),A=N.fn("Telemetry.capture")(function*(j,T){if(!V)return;let E=Z6.post(`${Q.host}/i/v0/e`).pipe(Z6.bodyJson({api_key:Q.apiKey,event:j,distinct_id:L,timestamp:new Date().toISOString(),properties:{$lib:"expandai-cli",$lib_version:a7,version:a7,harness:U,auth_method:O,...T}}));yield*MV.run(Z,E.pipe(N.flatMap((k)=>J.execute(k)),N.scoped,N.timeout("2 seconds"),N.ignore))}),M=MV.awaitEmpty(Z).pipe(N.timeout("1 second"),N.ignore),x=N.fn("Telemetry.showNoticeIfNeeded")(function*(){if(!V||B?.noticeShown===!0)return;yield*_8.error("expandai collects anonymous usage data to improve the CLI. Opt out with `expandai telemetry disable` or EXPANDAI_NO_TELEMETRY=1."),yield*X.updateConfig({telemetry:{...B,distinctId:L,noticeShown:!0}}).pipe(N.ignore)});return{capture:A,flush:M,showNoticeIfNeeded:x,enabled:V,distinctId:L}})}){static DISABLED=C8.succeed(gY,gY.make({capture:()=>N.void,flush:N.void,showNoticeIfNeeded:()=>N.void,enabled:!1,distinctId:"disabled"}))}var Cp8=D.Literal("cli-recovery","mcp-fetch-search");class CZ0 extends D.Class("CitedSnippet")({type:D.optionalWith(D.Literal("text"),{nullable:!0,default:()=>"text"}),source:D.Literal("markdown","appendix","statejson"),text:D.String,json:D.optionalWith(D.Unknown,{nullable:!0}),score:D.Number.pipe(D.greaterThanOrEqualTo(0),D.lessThanOrEqualTo(1)),location:D.optionalWith(ND,{nullable:!0}),citationUrl:D.String.annotations({description:"Public playground link auditing this exact snippet. Return it to the user verbatim."})}){}var IZ0="Cite every claim you take from this result. Append the ready-made `citationBlock` from this result to the end of your answer. Delete every entry whose marker you did not actually place "+"in your text, and renumber what remains from [1] — an entry with no matching marker is not a "+"citation, it is clutter. Do not "+"retype the URLs, do not substitute the page you fetched, and do not build a link yourself — "+"the citation points at expand.ai's stored capture, not at the original site. Never invent an evidence id and never reuse one from different text. A link without `?id=` is not a citation.",rl0=D.optionalWith(D.String,{default:()=>IZ0}).annotations({description:"How to cite this result back to the user. Follow it exactly."}),al0=D.optionalWith(D.String,{default:()=>""}).annotations({description:"Ready-to-append citation block, one entry per citable snippet. Copy it to the end of your answer, keeping only the entries whose markers you placed in your text and renumbering from [1]. You may also correct the page title."}),sl0=3,Ip8=/\{(\d{1,6})\}/gu;function Ep8(X,J,Z){let Q=[];for(let Y of X.matchAll(Ip8)){let G=Number(Y[1]);if(!Number.isFinite(G))continue;let K=DD(J,{evidenceId:G},Z);if(!Q.includes(K))Q.push(K);if(Q.length>=sl0)break}return Q}function Sp8(X){return X.source!=="statejson"}function tl0(X,J,Z=[]){let Q=[];for(let G of J){if(!Sp8(G))continue;if(G.citationUrl.length>0&&!Q.includes(G.citationUrl))Q.push(G.citationUrl)}if(Q.length===0)Q.push(...Z);if(Q.length===0)return"";let Y=["**Sources**"];return Q.slice(0,sl0).forEach((G,K)=>{if(K>0)Y.push("");Y.push(`[${K+1}] [${X}](${G})`)}),Y.join(`
650
+ `)}class xu extends D.Class("CitedSearchResult")({query:D.String,snippets:D.Array(CZ0),meta:D.optionalWith(OD,{nullable:!0})}){}class vu extends D.Class("CitedObjectModeResult")({invocationPath:D.Literal("mcp-fetch-search"),citationInstructions:rl0,citationBlock:al0,meta:UD,markdown:D.String,json:D.Array(zD),data:D.optionalWith(D.Struct({assets:D.optionalWith(D.Array(Ez),{nullable:!0}),search:D.optionalWith(xu,{nullable:!0})}),{nullable:!0})}){}class nD extends D.Class("CitedSnapshotSearchResult")({invocationPath:Cp8,citationInstructions:rl0,citationBlock:al0,snapshotId:D.String.pipe(D.minLength(1)),response:Sz,search:xu,durationMs:D.Number.pipe(D.greaterThanOrEqualTo(0)),playground:D.String.annotations({description:"Public playground link for the whole snapshot."})}){}function xp8(X,J,Z){return new CZ0({type:Z.type,source:Z.source,text:Z.text,json:Z.json,score:Z.score,location:Z.location,citationUrl:DD(X,Z.location,J)})}function el0(X,J,Z){return new xu({query:Z.query,snippets:Z.snippets.map((Q)=>xp8(X,J,Q)),meta:Z.meta})}function Xn0(X,J){let Z=jV(X.meta.playground,J),Q=X.data,Y=Q?.search==null?void 0:el0(X.meta.snapshotId,Z,Q.search),G=tl0(X.meta.url,Y?.snippets??[],Ep8(X.markdown,X.meta.snapshotId,Z));return new vu({invocationPath:"mcp-fetch-search",citationInstructions:IZ0,citationBlock:G,meta:X.meta,markdown:G.length===0?X.markdown:`${X.markdown.trimEnd()}
651
+
652
+ ---
653
+
654
+ ${G}
655
+ `,json:X.json,data:Q==null?Q:{assets:Q.assets,search:Y}})}function ku(X,J,Z="mcp-fetch-search"){let Q=jV(X.playground,J),Y=el0(X.snapshotId,Q,X.search);return new nD({invocationPath:Z,citationInstructions:IZ0,citationBlock:tl0(X.response.url,Y.snippets),snapshotId:X.snapshotId,response:X.response,search:Y,durationMs:X.durationMs,playground:_70(X.snapshotId,Q)})}class EZ0 extends D.Class("FetchSearchParams")({query:D.NonEmptyTrimmedString.annotations({description:"Search query. When provided, fetch returns search results only."}),maxResults:D.optionalWith(D.Int.pipe(D.between(1,50)),{default:()=>5}).annotations({description:"Maximum snippets to return.",default:5}),minScore:D.optionalWith(D.Number.pipe(D.between(0,1)),{default:()=>0}).annotations({description:"Minimum snippet relevance score from 0 to 1.",default:0})}){}class Jn0 extends D.Class("FetchParams")({url:D.String.annotations({description:"The URL to fetch content from"}),search:D.optional(EZ0).annotations({description:"Semantic search configuration. When provided, the API returns snippets under data.search.snippets."}),includeMeta:D.optionalWith(D.Boolean,{default:()=>!1}).annotations({description:"Include page meta tags (title, description, Open Graph)",default:!1}),includeAppendix:D.optionalWith(D.Boolean,{default:()=>!1}).annotations({description:"Include extracted links and sidebar content",default:!1}),includeJson:D.optionalWith(D.Boolean,{default:()=>!0}).annotations({description:"Include JSON extracted from network responses and DOM",default:!0})}){}class Zn0 extends D.Class("FetchSnapshotSearchParams")({snapshotId:D.NonEmptyString.annotations({description:"Snapshot ID returned by a previous fetch response."}),search:EZ0.annotations({description:"Semantic search configuration. Returns snippets from stored fetch artifacts."}),includeMarkdown:D.optionalWith(D.Boolean,{default:()=>!0}).annotations({description:"Search the stored markdown corpus.",default:!0}),includeAppendix:D.optionalWith(D.Boolean,{default:()=>!1}).annotations({description:"Search extracted appendix content.",default:!1}),includeJson:D.optionalWith(D.Boolean,{default:()=>!0}).annotations({description:"Search stored State JSON.",default:!0})}){}var Qn0=NK.make("fetch",{description:_X.stripMargin(`
656
+ |Fetch and extract content from any URL.
657
+ |
658
+ |You MUST cite what you take from the result. The result carries a ready-made
659
+ |'citationBlock' — append it verbatim to the end of your answer. Do not retype it, do not
660
+ |substitute the URL you fetched, and do not build a link yourself: the citation points at
661
+ |expand.ai's stored capture, not at the original site. Drop only the markers you did not use.
662
+ |A 'Verify it' link without '?id=' is not a citation. Never invent or reuse an evidence id.
663
+ |
664
+ |Returns object-mode output with markdown, front-matter metadata, and optional extracted JSON.
665
+ |When 'search' is set, the response also carries ranked snippets under data.search.snippets.
666
+ |For State JSON sources each snippet also carries the extracted 'json' value.`),parameters:Jn0.fields,success:vu,failure:D.Defect,failureMode:"return"}).annotate(NK.Readonly,!0).annotate(NK.Destructive,!1),Yn0=NK.make("fetch_search",{description:_X.stripMargin(`
667
+ |Search a previous fetch by snapshotId without starting a new capture.
668
+ |
669
+ |You MUST cite what you take from the result. The result carries a ready-made
670
+ |'citationBlock' — append it verbatim to the end of your answer. Do not retype it, do not
671
+ |substitute the URL you fetched, and do not build a link yourself: the citation points at
672
+ |expand.ai's stored capture, not at the original site. Drop only the markers you did not use.
673
+ |A 'Verify it' link without '?id=' is not a citation. Never invent or reuse an evidence id.
674
+ |
675
+ |Returns ranked snippets from stored markdown, appendix, or State JSON artifacts. For State JSON
676
+ |sources each snippet also carries the extracted 'json' value. The result also includes a
677
+ |whole-snapshot 'playground' link.`),parameters:Zn0.fields,success:nD,failure:D.Defect,failureMode:"return"}).annotate(NK.Readonly,!0).annotate(NK.Destructive,!1);class bu extends N.Service()("@expandai/cli/Mcp/Fetch",{dependencies:[BZ.Default,x9.Default,gY.Default],scoped:N.gen(function*(){let X=yield*BZ,J=yield*x9,Z=yield*gY,Q=yield*J.getPlaygroundHost(),Y=N.fn("Fetch.fetch")(function*({url:K,search:B,includeMeta:H,includeAppendix:W,includeJson:V}){yield*N.logDebug("MCP fetch started").pipe(N.annotateLogs({operation:"fetch",hasSearch:B!==void 0,includeMeta:H,includeAppendix:W,includeJson:V})),yield*Z.capture("mcp_tool_called",{tool:"fetch",has_search:B!==void 0});let U=W&&V?"appendix,statejson":W?"appendix":V?void 0:"",O=yield*X.fetchFetchJson({params:{include:U},payload:{url:K,include:{markdown:!0,meta:H,json:V,appendix:W},search:B}});return yield*N.logDebug("MCP fetch completed").pipe(N.annotateLogs({operation:"fetch",hasSearch:B!==void 0,searchResultCount:O.data?.search?.snippets.length??0,jsonEvidenceCount:O.json.length})),Xn0(O,Q)}),G=N.fn("Fetch.fetchSearch")(function*({snapshotId:K,search:B,includeMarkdown:H,includeAppendix:W,includeJson:V}){yield*N.logDebug("MCP snapshot search started").pipe(N.annotateLogs({operation:"fetch_search",includeMarkdown:H,includeAppendix:W,includeJson:V})),yield*Z.capture("mcp_tool_called",{tool:"fetch_search",has_search:!0});let U=yield*X.fetchFetchSearch({snapshotId:K,search:B,include:{markdown:H,json:V,appendix:W}});return ku(U,Q,"mcp-fetch-search")});return{fetch:Y,fetchSearch:G}})}){}var SZ0=Su.make(Qn0,Yn0),vp8=SZ0.toLayer(N.gen(function*(){let X=yield*bu;return SZ0.of({fetch:X.fetch,fetch_search:X.fetchSearch})})).pipe(C8.provide(bu.Default),C8.provide(BZ.Default)),xZ0=I2.toolkit(SZ0).pipe(C8.provide(vp8));var Gn0={name:Q6,version:a7},Kn0=(X={})=>X.includeDocs?C8.mergeAll(xZ0,nl0):xZ0;var kp8=P8.boolean("docs").pipe(P8.withDefault(!1),P8.withDescription("Expose documentation resources alongside tools")),vZ0=E0.make("run",{includeDocs:kp8}).pipe(E0.withDescription("Run the expandai MCP server over stdio"),E0.withHandler(N.fnUntraced(function*({includeDocs:X}){let J=I2.layerStdio({...Gn0,stdin:r3.stdin,stdout:HR.stdout}).pipe(C8.provide(Kn0({includeDocs:X})));return yield*C8.launch(J)})));class Bn0 extends D.TaggedError()("SnapshotSnippetsUnavailable",{snapshotId:D.String,query:D.String}){get message(){return`No snippets in snapshot ${this.snapshotId} matched '${this.query}'`}}var bp8=P6.text({name:"snapshotId"}).pipe(P6.withDescription("Snapshot handle from a previous fetch (meta.snapshotId, or the WebFetch hook note)")),yp8=P6.text({name:"query"}).pipe(P6.withDescription("Semantic search query")),gp8=P8.text("format").pipe(P8.withDefault("text"),P8.withDescription("Output format (text or json)"),P8.withSchema(D.Literal("text","json"))),hp8=P8.integer("max-results").pipe(P8.withDefault(5),P8.withDescription("Maximum snippets to return (default: 5)"),P8.withSchema(D.Int.pipe(D.greaterThanOrEqualTo(1),D.lessThanOrEqualTo(50)))),mp8=P8.float("min-score").pipe(P8.withDefault(0.6),P8.withDescription("Minimum snippet relevance score from 0 to 1 (default: 0.6)"),P8.withSchema(D.Number.pipe(D.greaterThanOrEqualTo(0),D.lessThanOrEqualTo(1)))),dp8={snapshotId:bp8,query:yp8,format:gp8,maxResults:hp8,minScore:mp8},kZ0=E0.make("search",dp8).pipe(E0.withDescription("Search a previously fetched page by its snapshot handle — no new capture"),E0.withHandler(N.fnUntraced(function*({format:X,maxResults:J,minScore:Z,query:Q,snapshotId:Y}){let G=yield*BZ,B=yield*(yield*x9).getPlaygroundHost(),H=yield*G.fetchFetchSearch({snapshotId:Y,search:{query:Q,maxResults:J,minScore:Z},include:{markdown:!0,json:!0}}),W=ku(H,B,"cli-recovery"),V=yield*D0.value(X).pipe(D0.when("text",()=>{let U=W.search.snippets;return U.length===0?N.fail(new Bn0({snapshotId:Y,query:Q})):N.succeed(`[invocation: cli-recovery]
678
+ ${Pd(Y,jV(H.playground,B),U)}`)}),D0.when("json",()=>D.encode(D.parseJson(nD,{space:2}))(W)),D0.exhaustive);yield*_8.log(V)},N.provide(C8.mergeAll(BZ.Default,x9.Default)))));var Hn0=P6.choice([["claude-code","claude-code"],["cursor","cursor"],["opencode","opencode"],["codex","codex"]]),Wn0=P6.choice([["global","global"],["project","project"]]),up8=E0.make("install",{host:Hn0,scope:Wn0}).pipe(E0.withDescription("Install the expandai skill into the chosen host + scope"),E0.withHandler(({host:X,scope:J})=>N.flatMap(XB,(Z)=>Z.install(X,J)))),cp8=E0.make("uninstall",{host:Hn0,scope:Wn0}).pipe(E0.withDescription("Remove the expandai skill from the chosen host + scope"),E0.withHandler(({host:X,scope:J})=>N.flatMap(XB,(Z)=>Z.uninstall(X,J)))),Vn0=E0.make("skill").pipe(E0.withDescription("Manage the expandai agent skill"),E0.withSubcommands([up8,cp8]));var Un0=/^[0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u,zn0=D.String.pipe(D.minLength(1),D.maxLength(64),D.pattern(Un0));class yu extends D.Class("StatusRequest")({harness:y7,scope:lQ}){}var fp8=D.Struct({state:D.Literal("absent","unusable","refresh_required","healthy"),healthy:D.Boolean}),pp8=D.Union(D.Struct({state:D.Literal("none"),count:D.Literal(0)}),D.Struct({state:D.Literal("approval_pending"),count:D.Literal(1),approvalExpiresAt:D.DateTimeUtc})),lp8=D.Struct({configured:D.Boolean,integrationVersion:D.optional(zn0),components:D.Struct({webfetchHook:D.Boolean,runtimeSkill:D.Boolean,mcp:D.Boolean}),runtimeState:D.Literal("unverified","reload_required","blocked"),reloadState:D.Literal("not_required","required"),consentState:D.Literal("not_required","may_be_required"),policyState:D.Literal("unverified","blocked"),policyCodes:D.Array(D.Literal("managed_policy_blocked","target_read_only")).pipe(D.maxItems(1))});class gu extends D.Class("StatusResult")({schemaVersion:D.Literal(1),status:D.Literal("ok"),harness:y7,scope:lQ,cli:D.Struct({version:zn0}),auth:fp8,pendingAuthorization:pp8,installation:lp8}){}var np8=D.Literal("credential_config_malformed","credential_storage_insecure","credential_health_failed","pending_state_malformed","pending_state_unavailable","harness_inspection_failed","invalid_status_result");class hu extends D.TaggedError()("StatusServiceError",{code:np8,recoverable:D.Boolean}){get message(){switch(this.code){case"credential_config_malformed":return"Stored credential configuration is malformed.";case"credential_storage_insecure":return"Credential storage is not secure enough to inspect.";case"credential_health_failed":return"Stored credentials could not be inspected safely.";case"pending_state_malformed":return"Pending authorization state is malformed.";case"pending_state_unavailable":return"Pending authorization state could not be inspected safely.";case"harness_inspection_failed":return"The harness configuration could not be inspected safely.";case"invalid_status_result":return"Local diagnostics returned an invalid result."}}}function E2(X,J){return new hu({code:X,recoverable:J})}function bZ0(X){if(X instanceof FD)return E2("credential_config_malformed",!1);if(X instanceof O2)return E2("credential_storage_insecure",!1);return E2("credential_health_failed",!1)}function $n0(X){if(X instanceof O2)return E2("credential_storage_insecure",!1);return X instanceof qD?E2("pending_state_malformed",!0):E2("pending_state_unavailable",!0)}function ip8(X){return N.gen(function*(){let J=yield*N.either(X.loadConfig());if(J._tag==="Left"){if(J.left instanceof im)return{state:"absent",healthy:!1};return yield*bZ0(J.left)}let Z=yield*Q9.now,Q=lm(J.right.authMethod,Z);return{state:Q,healthy:Q==="healthy"}})}function op8(X){return N.gen(function*(){if(m.isNone(X))return{state:"none",count:0};let J=Q9.toEpochMillis(yield*Q9.now);if(Q9.toEpochMillis(X.value.approvalExpiresAt)<=J)return{state:"none",count:0};return{state:"approval_pending",count:1,approvalExpiresAt:Q9.formatIso(X.value.approvalExpiresAt)}})}function rp8(X,J){let Z=new Set(J.components),Q=X==="opencode",Y=Z.has("runtime-skill")&&Z.has("mcp")&&(Q?Z.has("webfetch-hook")&&Z.size===3:Z.size===2),G=J.integrationVersion===void 0||J.integrationVersion.length<=64&&Un0.test(J.integrationVersion),K=J.configured===Y,B=J.runtimeState!=="observed";return Z.size===J.components.length&&G&&K&&B?N.succeed(J):E2("invalid_status_result",!1)}function ap8(X,J){let Z=new Set(X.components),Q=X.policyBlock!==void 0||X.runtimeState==="blocked",Y=X.policyBlock===YJ0?["target_read_only"]:Q?["managed_policy_blocked"]:[],G=!Q&&X.runtimeState==="reload_required";return{configured:X.configured,...X.integrationVersion===void 0?{}:{integrationVersion:X.integrationVersion},components:{webfetchHook:Z.has("webfetch-hook"),runtimeSkill:Z.has("runtime-skill"),mcp:Z.has("mcp")},runtimeState:Q?"blocked":G?"reload_required":"unverified",reloadState:G?"required":"not_required",consentState:J==="project"?"may_be_required":"not_required",policyState:Q?"blocked":"unverified",policyCodes:Y}}class rR extends N.Service()("@expandai/cli/Init/StatusService",{dependencies:[x9.Default,_2.Default,HK.Default],effect:N.gen(function*(){let X=yield*x9,J=yield*_2,Z=yield*HK;return{run:N.fn("StatusService.run")(function*(Y){return yield*N.annotateCurrentSpan({harness:Y.harness,scope:Y.scope}),yield*N.gen(function*(){yield*X.inspectSecureStorage().pipe(N.withTracerEnabled(!1),N.mapError(bZ0));let G=yield*ip8(X).pipe(N.withTracerEnabled(!1)),K=yield*X.getApiUrl().pipe(N.withTracerEnabled(!1),N.mapError(bZ0)),B=yield*J.canonicalScopeRoot(Y.scope).pipe(N.withTracerEnabled(!1),N.mapError($n0)),H={apiOrigin:K.origin,clientId:z2,harness:"agent-harnesses",scope:Y.scope,canonicalScopeRoot:B},W=yield*J.peek(H).pipe(N.withTracerEnabled(!1),N.mapError($n0)),V=yield*Z.inspect(Y.harness,Y.scope).pipe(N.withTracerEnabled(!1),N.mapError(()=>E2("harness_inspection_failed",!0)),N.flatMap((O)=>rp8(Y.harness,O))),U={schemaVersion:1,status:"ok",harness:Y.harness,scope:Y.scope,cli:{version:a7},auth:G,pendingAuthorization:yield*op8(W),installation:ap8(V,Y.scope)};return yield*D.decodeUnknown(gu)(U).pipe(N.mapError(()=>E2("invalid_status_result",!1)))})})}})}){}var sp8=P8.text("harness").pipe(P8.optional,P8.withDescription("Agent harness to inspect")),tp8=P8.text("scope").pipe(P8.optional,P8.withDescription("Configuration scope")),ep8=P8.boolean("json").pipe(P8.withDescription("Emit one machine-readable JSON result")),Nn0={harness:sp8,scope:tp8,json:ep8},Xl8=D.parseJson(IV),Jl8=D.parseJson(gu),mu="Agent status requires --harness claude-code|cursor|opencode|codex, --scope project|global, and --json.";function On0(X,J,Z){return D.encodeSync(Xl8)(new IV({schemaVersion:1,status:"error",code:X,message:J,recoverable:Z}))}function yZ0(){return On0("invalid_arguments",mu,!0)}function iD(X,J,Z,Q){return _8.error(On0(X,J,Z)).pipe(N.zipRight(N.sync(()=>void(process.exitCode=Q))))}function gZ0(X){return DJ0(X,"status")}function Zl8(X){function J(Z,Q){if(Z>=X.length)return Q;let Y=X[Z];if(Y==="--json"&&!Q.json)return J(Z+1,{...Q,json:!0});if(Y!=="--harness"&&Y!=="--scope")return;let G=X[Z+1];if(G===void 0||G.startsWith("-"))return;if(Y==="--harness"&&m.isNone(Q.harness))return J(Z+2,{...Q,harness:m.some(G)});if(Y==="--scope"&&m.isNone(Q.scope))return J(Z+2,{...Q,scope:m.some(G)});return}return J(0,{harness:m.none(),json:!1,scope:m.none()})}function _n0(X){if(X[2]!=="status")return;let J=X.slice(3);if(J.length===1&&(J[0]==="--help"||J[0]==="-h"))return;let Z=Zl8(J);if(Z===void 0||!Z.json)return yZ0();if(m.isNone(m.flatMap(Z.harness,(Q)=>D.decodeUnknownOption(y7)(Q))))return yZ0();if(!m.contains(Z.scope,"project")&&!m.contains(Z.scope,"global"))return yZ0();return}var Ql8={"claude-code":"Claude Code",cursor:"Cursor",codex:"Codex",opencode:"OpenCode"},Yl8=["claude-code","opencode"];function Gl8(X){let J=X.pendingAuthorization.count===1?"approval pending":"none",Z=X.installation.configured?"configured":"partial or not configured",Q=(Y)=>Y?"configured":"not configured";return["Expand status",`Auth: ${X.auth.state}`,`Pending authorization: ${J}`,`${Ql8[X.harness]}: ${Z}`,...Yl8.includes(X.harness)?[`WebFetch hook: ${Q(X.installation.components.webfetchHook)}`]:[],`Runtime skill: ${Q(X.installation.components.runtimeSkill)}`,`MCP: ${Q(X.installation.components.mcp)}`,`Runtime: ${X.installation.runtimeState}`].join(`
679
+ `)}var qn0=N.fnUntraced(function*(X,J){let Z=yield*rR,Q=yield*N.either(J?Z.run(X).pipe(o4.withMinimumLogLevel(J3.None)):Z.run(X));if(F8.isLeft(Q)){let G=Q.left;if(G instanceof hu){yield*iD(G.code,G.message,G.recoverable,1);return}yield*iD("status_failed","Expand status could not be inspected safely.",!0,1);return}if(!J){yield*_8.log(Gl8(Q.right));return}let Y=yield*D.encode(Jl8)(Q.right).pipe(N.catchAll(()=>iD("invalid_status_result","Expand status returned an invalid result.",!1,1).pipe(N.as(void 0))));if(typeof Y==="string")yield*_8.log(Y)}),Dn0=N.fnUntraced(function*({harness:X,json:J,scope:Z}){if(!J||m.isNone(m.flatMap(X,(Y)=>D.decodeUnknownOption(y7)(Y)))||!m.contains(Z,"project")&&!m.contains(Z,"global")){yield*iD("invalid_arguments",mu,!0,2);return}let Q=yield*D.decodeUnknown(yu)({harness:m.getOrUndefined(X),scope:m.getOrUndefined(Z)}).pipe(N.catchAll(()=>iD("invalid_arguments",mu,!0,2).pipe(N.as(void 0))));if(Q!==void 0)yield*qn0(Q,!0)});class du extends N.Service()("@expandai/cli/Commands/StatusTerminalInteraction",{effect:N.gen(function*(){let X=yield*z7.Terminal,J=N.fnUntraced(function*(){return yield*cQ.select({message:"Which agent harness should Expand inspect?",choices:[{title:"Claude Code",value:"claude-code"},{title:"Cursor",value:"cursor"},{title:"opencode",value:"opencode"},{title:"Codex",value:"codex"}]}).pipe(N.provideService(z7.Terminal,X))}),Z=N.fnUntraced(function*(){return yield*cQ.select({message:"Which configuration scope should Expand inspect?",choices:[{title:"This project",value:"project"},{title:"All projects for this user",value:"global"}]}).pipe(N.provideService(z7.Terminal,X))});return{chooseHarness:J,chooseScope:Z}})}){}var Kl8=N.fnUntraced(function*(X){if(X.json){yield*Dn0(X);return}let J=yield*du,Z=m.isSome(X.harness)?X.harness.value:yield*J.chooseHarness(),Q=m.isSome(X.scope)?X.scope.value:yield*J.chooseScope(),Y=D.decodeUnknownOption(y7)(Z),G=D.decodeUnknownOption(lQ)(Q);if(m.isNone(Y)||m.isNone(G)){yield*iD("invalid_arguments",mu,!0,2);return}let K=new yu({harness:Y.value,scope:G.value});yield*qn0(K,!1)}),wn0="Inspect redacted local Expand onboarding status",Ln0=E0.make("status",Nn0).pipe(E0.withDescription(wn0),E0.withHandler(Kl8)),Fn0=E0.make("status",Nn0).pipe(E0.withDescription(wn0),E0.withHandler(Dn0));var An0=N.fnUntraced(function*(X){let J=yield*x9,{config:Z}=yield*J.readConfigFile();yield*J.updateConfig({telemetry:{...Z.telemetry,enabled:X}}),yield*_8.log(`Telemetry ${X?"enabled":"disabled"}.`)}),Bl8=N.fnUntraced(function*(){let X=yield*gY;yield*_8.log(X.enabled?"Telemetry is enabled. Disable with `expandai telemetry disable` or EXPANDAI_NO_TELEMETRY=1.":"Telemetry is disabled.")}),Hl8=E0.make("status").pipe(E0.withDescription("Show whether anonymous usage telemetry is enabled"),E0.withHandler(()=>Bl8())),Wl8=E0.make("enable").pipe(E0.withDescription("Enable anonymous usage telemetry"),E0.withHandler(()=>An0(!0))),Vl8=E0.make("disable").pipe(E0.withDescription("Disable anonymous usage telemetry"),E0.withHandler(()=>An0(!1))),hZ0=E0.make("telemetry").pipe(E0.withDescription("Manage anonymous usage telemetry"),E0.withSubcommands([Hl8,Wl8,Vl8]));var $l8=P6.choice([["all","all"],["hook","hook"],["skill","skill"],["mcp","mcp"]]).pipe(P6.optional),Ul8=P6.choice([["claude-code","claude-code"],["cursor","cursor"],["opencode","opencode"],["codex","codex"]]).pipe(P6.optional),zl8=P6.choice([["global","global"],["project","project"]]).pipe(P6.optional),mZ0=E0.make("uninstall",{target:$l8,host:Ul8,scope:zl8}).pipe(E0.withDescription("Remove expandai hooks, skills, and MCP server entries. Defaults to `all` across every host and scope when target/host/scope are omitted."),E0.withHandler(N.fnUntraced(function*({target:X,host:J,scope:Z}){yield*(yield*L2).uninstall({target:m.getOrUndefined(X),host:m.getOrUndefined(J),scope:m.getOrUndefined(Z)})})));var Nl8=P0.all({override:fm("EXPANDAI_CLI_CONTEXT",D.Literal("human","agent")),mcpTransport:P0.string("MCP_TRANSPORT").pipe(P0.option,P0.map(m.isSome)),claudeCode:AD("CLAUDECODE"),cursor:P0.string("CURSOR_TRACE_ID").pipe(P0.option,P0.map(m.isSome)),codex:P0.string("CODEX_RUN_ID").pipe(P0.option,P0.map(m.isSome))}),Ol8=N.fnUntraced(function*(X){let J=wJ0({argv:process.argv,environment:process.env,stdinIsTty:process.stdin.isTTY===!0,stdoutIsTty:process.stdout.isTTY===!0});if(J!==void 0)return J==="machine"?"agent":"human";let Z=gZ0({argv:process.argv,environment:process.env,stdinIsTty:process.stdin.isTTY===!0,stdoutIsTty:process.stdout.isTTY===!0});if(Z!==void 0)return Z==="machine"?"agent":"human";let Q=yield*Nl8,Y=X==="mcp run"||Q.mcpTransport?m.some("mcp"):m.none(),G=Q.claudeCode||Q.cursor||Q.codex||!process.stdout.isTTY?m.some("agent"):m.none();return m.firstSomeOf([Y,Q.override,G]).pipe(m.getOrElse(()=>"human"))}),_l8=E0.make("mcp").pipe(E0.withDescription("Run or install the expandai MCP server"),E0.withSubcommands([vZ0,Dc0,wc0])),ql8=E0.make("mcp").pipe(E0.withDescription("Run the expandai MCP server"),E0.withSubcommands([vZ0])),Mn0=IR.DefaultWithoutDependencies.pipe(C8.provide(C8.mergeAll(g5.Default,q2.Default,CD.Default,HK.Default))),Pn0=rR.DefaultWithoutDependencies.pipe(C8.provide(C8.mergeAll(x9.Default,_2.Default,HK.Default))),Dl8=E0.make("expandai").pipe(E0.withDescription("expand.ai CLI and MCP server"),E0.withSubcommands([ZJ0,kZ0,t70,e70,XJ0,Nc0,Ln0,mZ0,_l8,Vn0,lu0,hZ0]),E0.provide(C8.mergeAll(x9.Default,g5.Default,y5.Default,e3.Default,XB.Default,L2.Default,kD.Default,bD.Default,Mn0,T2.Default,hd.Default,Pn0,du.Default))),wl8=E0.make("expandai").pipe(E0.withDescription("expand.ai CLI and MCP server"),E0.withSubcommands([ZJ0,kZ0,t70,e70,XJ0,Oc0,Fn0,mZ0,ql8,nu0,hZ0]),E0.provide(C8.mergeAll(x9.Default,g5.Default,kD.Default,bD.Default,y5.Default,e3.Default,XB.Default,L2.Default,Mn0,T2.Default,Pn0))),Ll8=C8.unwrapEffect(N.gen(function*(){let X=yield*P0.boolean("DEBUG").pipe(P0.withDefault(!1));return C8.mergeAll(o4.replace(o4.defaultLogger,o4.prettyLogger({stderr:!0})),o4.minimumLogLevel(X?J3.All:J3.Info))})),Fl8=AR(process.argv)==="status"||AR(process.argv)==="init"&&process.argv.includes("--detect"),Al8=Fl8?gY.DISABLED:gY.Default,Tl8=C8.mergeAll(RV.layer,Zh.layer({showBuiltIns:!1}),Ll8,Al8),Ml8=(X)=>P9.failureOption(X).pipe(m.match({onNone:()=>"Defect",onSome:(J)=>typeof J==="object"&&J!==null&&("_tag"in J)&&typeof J._tag==="string"?J._tag:"UnknownError"}));function Pl8(){if(wJ0({argv:process.argv,environment:process.env,stdinIsTty:process.stdin.isTTY===!0,stdoutIsTty:process.stdout.isTTY===!0})==="machine")return Vc0(process.argv);return gZ0({argv:process.argv,environment:process.env,stdinIsTty:process.stdin.isTTY===!0,stdoutIsTty:process.stdout.isTTY===!0})==="machine"?_n0(process.argv):void 0}var Rl8=N.gen(function*(){let X=AR(process.argv),J=yield*Ol8(X),Z=yield*gY;if(J==="human")yield*Z.showNoticeIfNeeded();yield*Z.capture("cli_command_run",{command:X,context:J});let Q=J==="human"?Dl8:wl8;return yield*E0.run(Q,{name:"expand.ai CLI",version:a7})(process.argv)}).pipe(N.catchAllCause((X)=>{let J=P9.failureOption(X);if(P9.isInterruptedOnly(X)||m.isSome(J)&&z7.isQuitException(J.value))return N.void;let Z=m.match(J,{onSome:(G)=>mP.isValidationError(G)?N.void:_8.error(`Error: ${G.message}`),onNone:()=>_8.error(_X.stripMargin(`
680
+ |Unexpected failure:
681
+ |${P9.pretty(X)}`))}),Q=N.logDebug("Error cause").pipe(N.annotateLogs({cause:P9.pretty(X)})),Y=N.flatMap(gY,(G)=>G.capture("cli_command_failed",{command:AR(process.argv),error_tag:Ml8(X)}));return Z.pipe(N.zipRight(Q),N.zipRight(Y),N.zipRight(N.failCause(X)))}),N.ensuring(N.flatMap(gY,(X)=>X.flush)),N.provide(Tl8)),Tn0=Pl8();if(Tn0!==void 0)process.stderr.write(`${Tn0}
682
+ `),process.exitCode=2;else Im.runMain(Rl8,{disableErrorReporting:!0,disablePrettyLogger:!0});