expandai 0.0.4 → 0.0.6
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.
- package/README.md +2 -2
- package/build/{esm/Install/Opencode → assets/opencode}/expandai-webfetch.js +22 -4
- package/build/dts/Mcp/RequestHeaders.d.ts +0 -1
- package/build/dts/Mcp/Server.d.ts +1 -2
- package/build/dts/index.d.ts +0 -1
- package/build/esm/index.js +193 -2
- package/build/esm/main.js +691 -200
- package/build/skills/expandai/SKILL.md +100 -8
- package/package.json +20 -12
- package/build/dts/ApiClient.d.ts +0 -165
- package/build/dts/ApiClient.d.ts.map +0 -1
- package/build/dts/Auth/Domain.d.ts +0 -95
- package/build/dts/Auth/Domain.d.ts.map +0 -1
- package/build/dts/Auth/ManualAuthorization.d.ts +0 -107
- package/build/dts/Auth/ManualAuthorization.d.ts.map +0 -1
- package/build/dts/Auth/PendingInit.d.ts +0 -35
- package/build/dts/Auth/PendingInit.d.ts.map +0 -1
- package/build/dts/Auth/Pkce.d.ts +0 -10
- package/build/dts/Auth/Pkce.d.ts.map +0 -1
- package/build/dts/Auth/SetupGrantAuthorization.d.ts +0 -34
- package/build/dts/Auth/SetupGrantAuthorization.d.ts.map +0 -1
- package/build/dts/Authentication.d.ts +0 -24
- package/build/dts/Authentication.d.ts.map +0 -1
- package/build/dts/BrowserOAuth.d.ts +0 -99
- package/build/dts/BrowserOAuth.d.ts.map +0 -1
- package/build/dts/CommandPath.d.ts +0 -2
- package/build/dts/CommandPath.d.ts.map +0 -1
- package/build/dts/Commands/Fetch.d.ts +0 -30
- package/build/dts/Commands/Fetch.d.ts.map +0 -1
- package/build/dts/Commands/Hook.d.ts +0 -17
- package/build/dts/Commands/Hook.d.ts.map +0 -1
- package/build/dts/Commands/Init.d.ts +0 -55
- package/build/dts/Commands/Init.d.ts.map +0 -1
- package/build/dts/Commands/Mcp.d.ts +0 -11
- package/build/dts/Commands/Mcp.d.ts.map +0 -1
- package/build/dts/Commands/McpRun.d.ts +0 -5
- package/build/dts/Commands/McpRun.d.ts.map +0 -1
- package/build/dts/Commands/Search.d.ts +0 -21
- package/build/dts/Commands/Search.d.ts.map +0 -1
- package/build/dts/Commands/Skill.d.ts +0 -12
- package/build/dts/Commands/Skill.d.ts.map +0 -1
- package/build/dts/Commands/Status.d.ts +0 -27
- package/build/dts/Commands/Status.d.ts.map +0 -1
- package/build/dts/Commands/Telemetry.d.ts +0 -7
- package/build/dts/Commands/Telemetry.d.ts.map +0 -1
- package/build/dts/Commands/Uninstall.d.ts +0 -9
- package/build/dts/Commands/Uninstall.d.ts.map +0 -1
- package/build/dts/Config.d.ts +0 -196
- package/build/dts/Config.d.ts.map +0 -1
- package/build/dts/Hook/Claude.d.ts +0 -13
- package/build/dts/Hook/Claude.d.ts.map +0 -1
- package/build/dts/Hook/Errors.d.ts +0 -20
- package/build/dts/Hook/Errors.d.ts.map +0 -1
- package/build/dts/Hook/Opencode.d.ts +0 -13
- package/build/dts/Hook/Opencode.d.ts.map +0 -1
- package/build/dts/Hook/SnapshotNote.d.ts +0 -12
- package/build/dts/Hook/SnapshotNote.d.ts.map +0 -1
- package/build/dts/Init/ClaudeAdapter.d.ts +0 -61
- package/build/dts/Init/ClaudeAdapter.d.ts.map +0 -1
- package/build/dts/Init/ClaudeProfile.d.ts +0 -77
- package/build/dts/Init/ClaudeProfile.d.ts.map +0 -1
- package/build/dts/Init/Domain.d.ts +0 -139
- package/build/dts/Init/Domain.d.ts.map +0 -1
- package/build/dts/Init/HarnessAdapter.d.ts +0 -33
- package/build/dts/Init/HarnessAdapter.d.ts.map +0 -1
- package/build/dts/Init/HarnessDetector.d.ts +0 -19
- package/build/dts/Init/HarnessDetector.d.ts.map +0 -1
- package/build/dts/Init/HarnessRegistry.d.ts +0 -50
- package/build/dts/Init/HarnessRegistry.d.ts.map +0 -1
- package/build/dts/Init/MutationTransaction.d.ts +0 -96
- package/build/dts/Init/MutationTransaction.d.ts.map +0 -1
- package/build/dts/Init/Service.d.ts +0 -72
- package/build/dts/Init/Service.d.ts.map +0 -1
- package/build/dts/Init/StandardAdapters.d.ts +0 -42
- package/build/dts/Init/StandardAdapters.d.ts.map +0 -1
- package/build/dts/Init/Status.d.ts +0 -149
- package/build/dts/Init/Status.d.ts.map +0 -1
- package/build/dts/Install/Claude/Hook.d.ts +0 -88
- package/build/dts/Install/Claude/Hook.d.ts.map +0 -1
- package/build/dts/Install/Claude/Mcp.d.ts +0 -48
- package/build/dts/Install/Claude/Mcp.d.ts.map +0 -1
- package/build/dts/Install/Claude/Skill.d.ts +0 -23
- package/build/dts/Install/Claude/Skill.d.ts.map +0 -1
- package/build/dts/Install/Codex/Mcp.d.ts +0 -45
- package/build/dts/Install/Codex/Mcp.d.ts.map +0 -1
- package/build/dts/Install/Codex/Skill.d.ts +0 -22
- package/build/dts/Install/Codex/Skill.d.ts.map +0 -1
- package/build/dts/Install/Cursor/Mcp.d.ts +0 -45
- package/build/dts/Install/Cursor/Mcp.d.ts.map +0 -1
- package/build/dts/Install/Cursor/Skill.d.ts +0 -29
- package/build/dts/Install/Cursor/Skill.d.ts.map +0 -1
- package/build/dts/Install/Domain.d.ts +0 -103
- package/build/dts/Install/Domain.d.ts.map +0 -1
- package/build/dts/Install/Hook.d.ts +0 -30
- package/build/dts/Install/Hook.d.ts.map +0 -1
- package/build/dts/Install/Mcp.d.ts +0 -28
- package/build/dts/Install/Mcp.d.ts.map +0 -1
- package/build/dts/Install/Opencode/Hook.d.ts +0 -24
- package/build/dts/Install/Opencode/Hook.d.ts.map +0 -1
- package/build/dts/Install/Opencode/Mcp.d.ts +0 -47
- package/build/dts/Install/Opencode/Mcp.d.ts.map +0 -1
- package/build/dts/Install/Opencode/Skill.d.ts +0 -26
- package/build/dts/Install/Opencode/Skill.d.ts.map +0 -1
- package/build/dts/Install/Skill.d.ts +0 -32
- package/build/dts/Install/Skill.d.ts.map +0 -1
- package/build/dts/Install/Uninstall.d.ts +0 -32
- package/build/dts/Install/Uninstall.d.ts.map +0 -1
- package/build/dts/MarkdownAnsi.d.ts +0 -29
- package/build/dts/MarkdownAnsi.d.ts.map +0 -1
- package/build/dts/Mcp/ExpandDocs.d.ts +0 -19
- package/build/dts/Mcp/ExpandDocs.d.ts.map +0 -1
- package/build/dts/Mcp/RequestHeaders.d.ts.map +0 -1
- package/build/dts/Mcp/Server.d.ts.map +0 -1
- package/build/dts/Mcp/Toolkit.d.ts +0 -3
- package/build/dts/Mcp/Toolkit.d.ts.map +0 -1
- package/build/dts/Mcp/tools/Citations.d.ts +0 -266
- package/build/dts/Mcp/tools/Citations.d.ts.map +0 -1
- package/build/dts/Mcp/tools/Fetch.d.ts +0 -168
- package/build/dts/Mcp/tools/Fetch.d.ts.map +0 -1
- package/build/dts/SecureFile.d.ts +0 -23
- package/build/dts/SecureFile.d.ts.map +0 -1
- package/build/dts/Snippets.d.ts +0 -18
- package/build/dts/Snippets.d.ts.map +0 -1
- package/build/dts/Telemetry.d.ts +0 -30
- package/build/dts/Telemetry.d.ts.map +0 -1
- package/build/dts/Version.d.ts +0 -2
- package/build/dts/Version.d.ts.map +0 -1
- package/build/dts/Xdg.d.ts +0 -11
- package/build/dts/Xdg.d.ts.map +0 -1
- package/build/dts/index.d.ts.map +0 -1
- package/build/dts/main.d.ts +0 -3
- package/build/dts/main.d.ts.map +0 -1
- package/build/esm/ApiClient.js +0 -305
- package/build/esm/ApiClient.js.map +0 -1
- package/build/esm/Auth/Domain.js +0 -56
- package/build/esm/Auth/Domain.js.map +0 -1
- package/build/esm/Auth/ManualAuthorization.js +0 -253
- package/build/esm/Auth/ManualAuthorization.js.map +0 -1
- package/build/esm/Auth/PendingInit.js +0 -267
- package/build/esm/Auth/PendingInit.js.map +0 -1
- package/build/esm/Auth/Pkce.js +0 -23
- package/build/esm/Auth/Pkce.js.map +0 -1
- package/build/esm/Auth/SetupGrantAuthorization.js +0 -91
- package/build/esm/Auth/SetupGrantAuthorization.js.map +0 -1
- package/build/esm/Authentication.js +0 -143
- package/build/esm/Authentication.js.map +0 -1
- package/build/esm/BrowserOAuth.js +0 -251
- package/build/esm/BrowserOAuth.js.map +0 -1
- package/build/esm/CommandPath.js +0 -31
- package/build/esm/CommandPath.js.map +0 -1
- package/build/esm/Commands/Fetch.js +0 -119
- package/build/esm/Commands/Fetch.js.map +0 -1
- package/build/esm/Commands/Hook.js +0 -20
- package/build/esm/Commands/Hook.js.map +0 -1
- package/build/esm/Commands/Init.js +0 -371
- package/build/esm/Commands/Init.js.map +0 -1
- package/build/esm/Commands/Mcp.js +0 -19
- package/build/esm/Commands/Mcp.js.map +0 -1
- package/build/esm/Commands/McpRun.js +0 -15
- package/build/esm/Commands/McpRun.js.map +0 -1
- package/build/esm/Commands/Search.js +0 -46
- package/build/esm/Commands/Search.js.map +0 -1
- package/build/esm/Commands/Skill.js +0 -17
- package/build/esm/Commands/Skill.js.map +0 -1
- package/build/esm/Commands/Status.js +0 -186
- package/build/esm/Commands/Status.js.map +0 -1
- package/build/esm/Commands/Telemetry.js +0 -23
- package/build/esm/Commands/Telemetry.js.map +0 -1
- package/build/esm/Commands/Uninstall.js +0 -28
- package/build/esm/Commands/Uninstall.js.map +0 -1
- package/build/esm/Config.js +0 -619
- package/build/esm/Config.js.map +0 -1
- package/build/esm/Hook/Claude.js +0 -74
- package/build/esm/Hook/Claude.js.map +0 -1
- package/build/esm/Hook/Errors.js +0 -18
- package/build/esm/Hook/Errors.js.map +0 -1
- package/build/esm/Hook/Opencode.js +0 -50
- package/build/esm/Hook/Opencode.js.map +0 -1
- package/build/esm/Hook/SnapshotNote.js +0 -65
- package/build/esm/Hook/SnapshotNote.js.map +0 -1
- package/build/esm/Init/ClaudeAdapter.js +0 -137
- package/build/esm/Init/ClaudeAdapter.js.map +0 -1
- package/build/esm/Init/ClaudeProfile.js +0 -344
- package/build/esm/Init/ClaudeProfile.js.map +0 -1
- package/build/esm/Init/Domain.js +0 -118
- package/build/esm/Init/Domain.js.map +0 -1
- package/build/esm/Init/HarnessAdapter.js +0 -21
- package/build/esm/Init/HarnessAdapter.js.map +0 -1
- package/build/esm/Init/HarnessDetector.js +0 -65
- package/build/esm/Init/HarnessDetector.js.map +0 -1
- package/build/esm/Init/HarnessRegistry.js +0 -58
- package/build/esm/Init/HarnessRegistry.js.map +0 -1
- package/build/esm/Init/MutationTransaction.js +0 -494
- package/build/esm/Init/MutationTransaction.js.map +0 -1
- package/build/esm/Init/Service.js +0 -319
- package/build/esm/Init/Service.js.map +0 -1
- package/build/esm/Init/StandardAdapters.js +0 -116
- package/build/esm/Init/StandardAdapters.js.map +0 -1
- package/build/esm/Init/Status.js +0 -215
- package/build/esm/Init/Status.js.map +0 -1
- package/build/esm/Install/Claude/Hook.js +0 -77
- package/build/esm/Install/Claude/Hook.js.map +0 -1
- package/build/esm/Install/Claude/Mcp.js +0 -101
- package/build/esm/Install/Claude/Mcp.js.map +0 -1
- package/build/esm/Install/Claude/Skill.js +0 -56
- package/build/esm/Install/Claude/Skill.js.map +0 -1
- package/build/esm/Install/Codex/Mcp.js +0 -97
- package/build/esm/Install/Codex/Mcp.js.map +0 -1
- package/build/esm/Install/Codex/Skill.js +0 -33
- package/build/esm/Install/Codex/Skill.js.map +0 -1
- package/build/esm/Install/Cursor/Mcp.js +0 -74
- package/build/esm/Install/Cursor/Mcp.js.map +0 -1
- package/build/esm/Install/Cursor/Skill.js +0 -40
- package/build/esm/Install/Cursor/Skill.js.map +0 -1
- package/build/esm/Install/Domain.js +0 -162
- package/build/esm/Install/Domain.js.map +0 -1
- package/build/esm/Install/Hook.js +0 -38
- package/build/esm/Install/Hook.js.map +0 -1
- package/build/esm/Install/Mcp.js +0 -40
- package/build/esm/Install/Mcp.js.map +0 -1
- package/build/esm/Install/Opencode/Hook.js +0 -44
- package/build/esm/Install/Opencode/Hook.js.map +0 -1
- package/build/esm/Install/Opencode/Mcp.js +0 -76
- package/build/esm/Install/Opencode/Mcp.js.map +0 -1
- package/build/esm/Install/Opencode/Skill.js +0 -37
- package/build/esm/Install/Opencode/Skill.js.map +0 -1
- package/build/esm/Install/Skill.js +0 -41
- package/build/esm/Install/Skill.js.map +0 -1
- package/build/esm/Install/Uninstall.js +0 -49
- package/build/esm/Install/Uninstall.js.map +0 -1
- package/build/esm/MarkdownAnsi.js +0 -142
- package/build/esm/MarkdownAnsi.js.map +0 -1
- package/build/esm/Mcp/ExpandDocs.js +0 -56
- package/build/esm/Mcp/ExpandDocs.js.map +0 -1
- package/build/esm/Mcp/RequestHeaders.js +0 -13
- package/build/esm/Mcp/RequestHeaders.js.map +0 -1
- package/build/esm/Mcp/Server.js +0 -12
- package/build/esm/Mcp/Server.js.map +0 -1
- package/build/esm/Mcp/Toolkit.js +0 -16
- package/build/esm/Mcp/Toolkit.js.map +0 -1
- package/build/esm/Mcp/tools/Citations.js +0 -193
- package/build/esm/Mcp/tools/Citations.js.map +0 -1
- package/build/esm/Mcp/tools/Fetch.js +0 -165
- package/build/esm/Mcp/tools/Fetch.js.map +0 -1
- package/build/esm/SecureFile.js +0 -36
- package/build/esm/SecureFile.js.map +0 -1
- package/build/esm/Snippets.js +0 -29
- package/build/esm/Snippets.js.map +0 -1
- package/build/esm/Telemetry.js +0 -157
- package/build/esm/Telemetry.js.map +0 -1
- package/build/esm/Version.js +0 -4
- package/build/esm/Version.js.map +0 -1
- package/build/esm/Xdg.js +0 -15
- package/build/esm/Xdg.js.map +0 -1
- package/build/esm/index.js.map +0 -1
- package/build/esm/main.js.map +0 -1
- package/src/ApiClient.ts +0 -450
- package/src/Auth/Domain.ts +0 -63
- package/src/Auth/ManualAuthorization.ts +0 -296
- package/src/Auth/PendingInit.ts +0 -338
- package/src/Auth/Pkce.ts +0 -26
- package/src/Auth/SetupGrantAuthorization.ts +0 -116
- package/src/Authentication.ts +0 -202
- package/src/BrowserOAuth.ts +0 -359
- package/src/CommandPath.ts +0 -30
- package/src/Commands/Fetch.ts +0 -188
- package/src/Commands/Hook.ts +0 -48
- package/src/Commands/Init.ts +0 -489
- package/src/Commands/Mcp.ts +0 -30
- package/src/Commands/McpRun.ts +0 -25
- package/src/Commands/Search.ts +0 -97
- package/src/Commands/Skill.ts +0 -30
- package/src/Commands/Status.ts +0 -228
- package/src/Commands/Telemetry.ts +0 -42
- package/src/Commands/Uninstall.ts +0 -38
- package/src/Config.ts +0 -840
- package/src/Hook/Claude.ts +0 -81
- package/src/Hook/Errors.ts +0 -19
- package/src/Hook/Opencode.ts +0 -58
- package/src/Hook/SnapshotNote.ts +0 -66
- package/src/Init/ClaudeAdapter.ts +0 -191
- package/src/Init/ClaudeProfile.ts +0 -453
- package/src/Init/Domain.ts +0 -153
- package/src/Init/HarnessAdapter.ts +0 -35
- package/src/Init/HarnessDetector.ts +0 -77
- package/src/Init/HarnessRegistry.ts +0 -87
- package/src/Init/MutationTransaction.ts +0 -747
- package/src/Init/Service.ts +0 -385
- package/src/Init/StandardAdapters.ts +0 -141
- package/src/Init/Status.ts +0 -253
- package/src/Install/Claude/Hook.ts +0 -123
- package/src/Install/Claude/Mcp.ts +0 -129
- package/src/Install/Claude/Skill.ts +0 -77
- package/src/Install/Codex/Mcp.ts +0 -114
- package/src/Install/Codex/Skill.ts +0 -44
- package/src/Install/Cursor/Mcp.ts +0 -85
- package/src/Install/Cursor/Skill.ts +0 -51
- package/src/Install/Domain.ts +0 -221
- package/src/Install/Hook.ts +0 -50
- package/src/Install/Mcp.ts +0 -71
- package/src/Install/Opencode/Hook.ts +0 -55
- package/src/Install/Opencode/Mcp.ts +0 -87
- package/src/Install/Opencode/Skill.ts +0 -48
- package/src/Install/Opencode/expandai-webfetch.d.ts +0 -23
- package/src/Install/Opencode/expandai-webfetch.js +0 -56
- package/src/Install/Skill.ts +0 -57
- package/src/Install/Uninstall.ts +0 -82
- package/src/MarkdownAnsi.ts +0 -162
- package/src/Mcp/ExpandDocs.ts +0 -62
- package/src/Mcp/RequestHeaders.ts +0 -16
- package/src/Mcp/Server.ts +0 -15
- package/src/Mcp/Toolkit.ts +0 -21
- package/src/Mcp/tools/Citations.ts +0 -219
- package/src/Mcp/tools/Fetch.ts +0 -203
- package/src/SecureFile.ts +0 -70
- package/src/Snippets.ts +0 -39
- package/src/Telemetry.ts +0 -186
- package/src/Version.ts +0 -3
- package/src/Xdg.ts +0 -18
- package/src/index.ts +0 -1
- package/src/main.ts +0 -305
package/build/esm/main.js
CHANGED
|
@@ -1,205 +1,696 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { SetupGrantAuthorization } from './Auth/SetupGrantAuthorization.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
argv: process.argv,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
])
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
stdinIsTty: process.stdin.isTTY === true,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return statusMode === 'machine' ? preflightAgentStatusArgv(process.argv) : undefined;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
2
|
+
import{createRequire as g9e}from"node:module";var a9e=Object.create;var{getPrototypeOf:c9e,defineProperty:$K,getOwnPropertyNames:l9e}=Object;var u9e=Object.prototype.hasOwnProperty;function p9e(e){return this[e]}var f9e,d9e,Dle=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?f9e??=new WeakMap:d9e??=new WeakMap,s=o.get(e);if(s)return s}r=e!=null?a9e(c9e(e)):{};let i=t||!e||!e.__esModule?$K(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of l9e(e))if(!u9e.call(i,a))$K(i,a,{get:p9e.bind(e,a),enumerable:!0})}if(n)o.set(e,i);return i};var at=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var m9e=(e)=>e;function h9e(e,t){this[e]=m9e.bind(null,t)}var Ht=(e,t)=>{for(var r in t)$K(e,r,{get:t[r],enumerable:!0,configurable:!0,set:h9e.bind(t,r)})};var Uk=g9e(import.meta.url);var V1e=at(function(qlr,j1e){var{hasOwnProperty:Yte}=Object.prototype,Zte=(e,t={})=>{if(typeof t==="string")t={section:t};t.align=t.align===!0,t.newline=t.newline===!0,t.sort=t.sort===!0,t.whitespace=t.whitespace===!0||t.align===!0,t.platform=t.platform||typeof process<"u"&&process.platform,t.bracketedArray=t.bracketedArray!==!1;let r=t.platform==="win32"?`\r
|
|
3
|
+
`:`
|
|
4
|
+
`,n=t.whitespace?" = ":"=",o=[],s=t.sort?Object.keys(e).sort():Object.keys(e),i=0;if(t.align)i=ux(s.filter((l)=>e[l]===null||Array.isArray(e[l])||typeof e[l]!=="object").map((l)=>Array.isArray(e[l])?`${l}[]`:l).concat([""]).reduce((l,u)=>ux(l).length>=ux(u).length?l:u)).length;let a="",c=t.bracketedArray?"[]":"";for(let l of s){let u=e[l];if(u&&Array.isArray(u))for(let f of u)a+=ux(`${l}${c}`).padEnd(i," ")+n+ux(f)+r;else if(u&&typeof u==="object")o.push(l);else a+=ux(l).padEnd(i," ")+n+ux(u)+r}if(t.section&&a.length)a="["+ux(t.section)+"]"+(t.newline?r+r:r)+a;for(let l of o){let u=z1e(l,".").join("\\."),f=(t.section?t.section+".":"")+u,h=Zte(e[l],{...t,section:f});if(a.length&&h.length)a+=r;a+=h}return a};function z1e(e,t){var r=0,n=0,o=0,s=[];do if(o=e.indexOf(t,r),o!==-1){if(r=o+t.length,o>0&&e[o-1]==="\\")continue;s.push(e.slice(n,o)),n=o+t.length}while(o!==-1);return s.push(e.slice(n)),s}var W1e=(e,t={})=>{t.bracketedArray=t.bracketedArray!==!1;let r=Object.create(null),n=r,o=null,s=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,i=e.split(/[\r\n]+/g),a={};for(let l of i){if(!l||l.match(/^\s*[;#]/)||l.match(/^\s*$/))continue;let u=l.match(s);if(!u)continue;if(u[1]!==void 0){if(o=Wz(u[1]),o==="__proto__"){n=Object.create(null);continue}n=r[o]=r[o]||Object.create(null);continue}let f=Wz(u[2]),h;if(t.bracketedArray)h=f.length>2&&f.slice(-2)==="[]";else a[f]=(a?.[f]||0)+1,h=a[f]>1;let y=h&&f.endsWith("[]")?f.slice(0,-2):f;if(y==="__proto__")continue;let E=u[3]?Wz(u[4]):!0,b=E==="true"||E==="false"||E==="null"?JSON.parse(E):E;if(h){if(!Yte.call(n,y))n[y]=[];else if(!Array.isArray(n[y]))n[y]=[n[y]]}if(Array.isArray(n[y]))n[y].push(b);else n[y]=b}let c=[];for(let l of Object.keys(r)){if(!Yte.call(r,l)||typeof r[l]!=="object"||Array.isArray(r[l]))continue;let u=z1e(l,".");n=r;let f=u.pop(),h=f.replace(/\\\./g,".");for(let y of u){if(y==="__proto__")continue;if(!Yte.call(n,y)||typeof n[y]!=="object")n[y]=Object.create(null);n=n[y]}if(n===r&&h===f)continue;n[h]=r[l],c.push(l)}for(let l of c)delete r[l];return r},$1e=(e)=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),ux=(e)=>{if(typeof e!=="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&$1e(e)||e!==e.trim())return JSON.stringify(e);return e.split(";").join("\\;").split("#").join("\\#")},Wz=(e)=>{if(e=(e||"").trim(),$1e(e)){if(e.charAt(0)==="'")e=e.slice(1,-1);try{e=JSON.parse(e)}catch{}}else{let t=!1,r="";for(let n=0,o=e.length;n<o;n++){let s=e.charAt(n);if(t){if("\\;#".indexOf(s)!==-1)r+=s;else r+="\\"+s;t=!1}else if(";#".indexOf(s)!==-1)break;else if(s==="\\")t=!0;else r+=s}if(t)r+="\\";return r.trim()}return e};j1e.exports={parse:W1e,decode:W1e,stringify:Zte,encode:Zte,safe:ux,unsafe:Wz}});var K1e=at(function(Blr,G1e){G1e.exports=function(){function e(n,o){function s(){this.constructor=n}s.prototype=o.prototype,n.prototype=new s}function t(n,o,s,i,a,c){this.message=n,this.expected=o,this.found=s,this.offset=i,this.line=a,this.column=c,this.name="SyntaxError"}e(t,Error);function r(n){var o=arguments.length>1?arguments[1]:{},s={},i={start:dle},a=dle,c=[],l=function(){return Mle},u=s,f="#",h={type:"literal",value:"#",description:'"#"'},y=void 0,E={type:"any",description:"any character"},b="[",w={type:"literal",value:"[",description:'"["'},T="]",A={type:"literal",value:"]",description:'"]"'},k=function(g){WK(wa("ObjectPath",g,ba,Ca))},O=function(g){WK(wa("ArrayPath",g,ba,Ca))},P=function(g,C){return g.concat(C)},D=function(g){return[g]},I=function(g){return g},M=".",B={type:"literal",value:".",description:'"."'},ee="=",j={type:"literal",value:"=",description:'"="'},ae=function(g,C){WK(wa("Assign",C,ba,Ca,g))},F=function(g){return g.join("")},J=function(g){return g.value},G='"""',Z={type:"literal",value:'"""',description:'"\\"\\"\\""'},ne=null,we=function(g){return wa("String",g.join(""),ba,Ca)},ot='"',rt={type:"literal",value:'"',description:'"\\""'},Dt="'''",Lt={type:"literal",value:"'''",description:`"'''"`},Do="'",Ea={type:"literal",value:"'",description:`"'"`},Ah=function(g){return g},FQe=function(g){return g},NQe="\\",LQe={type:"literal",value:"\\",description:'"\\\\"'},UQe=function(){return""},HQe="e",qQe={type:"literal",value:"e",description:'"e"'},BQe="E",WQe={type:"literal",value:"E",description:'"E"'},zQe=function(g,C){return wa("Float",parseFloat(g+"e"+C),ba,Ca)},$Qe=function(g){return wa("Float",parseFloat(g),ba,Ca)},DK="+",FK={type:"literal",value:"+",description:'"+"'},$ce=function(g){return g.join("")},Ov="-",_v={type:"literal",value:"-",description:'"-"'},jce=function(g){return"-"+g.join("")},jQe=function(g){return wa("Integer",parseInt(g,10),ba,Ca)},Vce="true",VQe={type:"literal",value:"true",description:'"true"'},GQe=function(){return wa("Boolean",!0,ba,Ca)},Gce="false",KQe={type:"literal",value:"false",description:'"false"'},JQe=function(){return wa("Boolean",!1,ba,Ca)},QQe=function(){return wa("Array",[],ba,Ca)},YQe=function(g){return wa("Array",g?[g]:[],ba,Ca)},ZQe=function(g){return wa("Array",g,ba,Ca)},XQe=function(g,C){return wa("Array",g.concat(C),ba,Ca)},Kce=function(g){return g},Jce=",",Qce={type:"literal",value:",",description:'","'},eYe="{",tYe={type:"literal",value:"{",description:'"{"'},rYe="}",nYe={type:"literal",value:"}",description:'"}"'},oYe=function(g){return wa("InlineTable",g,ba,Ca)},Yce=function(g,C){return wa("InlineTableValue",C,ba,Ca,g)},sYe=function(g){return"."+g},iYe=function(g){return g.join("")},vv=":",Tv={type:"literal",value:":",description:'":"'},Zce=function(g){return g.join("")},Xce="T",ele={type:"literal",value:"T",description:'"T"'},aYe="Z",cYe={type:"literal",value:"Z",description:'"Z"'},lYe=function(g,C){return wa("Date",new Date(g+"T"+C+"Z"),ba,Ca)},uYe=function(g,C){return wa("Date",new Date(g+"T"+C),ba,Ca)},pYe=/^[ \t]/,fYe={type:"class",value:"[ \\t]",description:"[ \\t]"},tle=`
|
|
5
|
+
`,rle={type:"literal",value:`
|
|
6
|
+
`,description:'"\\n"'},dYe="\r",mYe={type:"literal",value:"\r",description:'"\\r"'},hYe=/^[0-9a-f]/i,gYe={type:"class",value:"[0-9a-f]i",description:"[0-9a-f]i"},xYe=/^[0-9]/,yYe={type:"class",value:"[0-9]",description:"[0-9]"},SYe="_",EYe={type:"literal",value:"_",description:'"_"'},bYe=function(){return""},CYe=/^[A-Za-z0-9_\-]/,wYe={type:"class",value:"[A-Za-z0-9_\\-]",description:"[A-Za-z0-9_\\-]"},kYe=function(g){return g.join("")},nle="\\\"",IYe={type:"literal",value:"\\\"",description:'"\\\\\\""'},AYe=function(){return'"'},ole="\\\\",OYe={type:"literal",value:"\\\\",description:'"\\\\\\\\"'},_Ye=function(){return"\\"},sle="\\b",vYe={type:"literal",value:"\\b",description:'"\\\\b"'},TYe=function(){return"\b"},ile="\\t",RYe={type:"literal",value:"\\t",description:'"\\\\t"'},MYe=function(){return"\t"},ale="\\n",PYe={type:"literal",value:"\\n",description:'"\\\\n"'},DYe=function(){return`
|
|
7
|
+
`},cle="\\f",FYe={type:"literal",value:"\\f",description:'"\\\\f"'},NYe=function(){return"\f"},lle="\\r",LYe={type:"literal",value:"\\r",description:'"\\\\r"'},UYe=function(){return"\r"},ule="\\U",HYe={type:"literal",value:"\\U",description:'"\\\\U"'},ple=function(g){return s9e(g.join(""))},fle="\\u",qYe={type:"literal",value:"\\u",description:'"\\\\u"'},S=0,Ct=0,Rv=0,NK={line:1,column:1,seenCR:!1},qN=0,LK=[],Me=0,Ue={},BN;if("startRule"in o){if(!(o.startRule in i))throw Error(`Can't start parsing from rule "`+o.startRule+'".');a=i[o.startRule]}function wQt(){return n.substring(Ct,S)}function kQt(){return Ct}function ba(){return UK(Ct).line}function Ca(){return UK(Ct).column}function IQt(g){throw HK(null,[{type:"other",description:g}],Ct)}function AQt(g){throw HK(g,null,Ct)}function UK(g){function C(v,U,z){var le,ke;for(le=U;le<z;le++)if(ke=n.charAt(le),ke===`
|
|
8
|
+
`){if(!v.seenCR)v.line++;v.column=1,v.seenCR=!1}else if(ke==="\r"||ke==="\u2028"||ke==="\u2029")v.line++,v.column=1,v.seenCR=!0;else v.column++,v.seenCR=!1}if(Rv!==g){if(Rv>g)Rv=0,NK={line:1,column:1,seenCR:!1};C(NK,Rv,g),Rv=g}return NK}function Ve(g){if(S<qN)return;if(S>qN)qN=S,LK=[];LK.push(g)}function HK(g,C,v){function U(pt){var cr=1;pt.sort(function(Ln,xn){if(Ln.description<xn.description)return-1;else if(Ln.description>xn.description)return 1;else return 0});while(cr<pt.length)if(pt[cr-1]===pt[cr])pt.splice(cr,1);else cr++}function z(pt,cr){function Ln(Lk){function ty(Zl){return Zl.charCodeAt(0).toString(16).toUpperCase()}return Lk.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(Zl){return"\\x0"+ty(Zl)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(Zl){return"\\x"+ty(Zl)}).replace(/[\u0180-\u0FFF]/g,function(Zl){return"\\u0"+ty(Zl)}).replace(/[\u1080-\uFFFF]/g,function(Zl){return"\\u"+ty(Zl)})}var xn=Array(pt.length),us,Vs,Yl;for(Yl=0;Yl<pt.length;Yl++)xn[Yl]=pt[Yl].description;return us=pt.length>1?xn.slice(0,-1).join(", ")+" or "+xn[pt.length-1]:xn[0],Vs=cr?'"'+Ln(cr)+'"':"end of input","Expected "+us+" but "+Vs+" found."}var le=UK(v),ke=v<n.length?n.charAt(v):null;if(C!==null)U(C);return new t(g!==null?g:z(C,ke),C,ke,v,le.line,le.column)}function dle(){var g,C,v,U=S*49+0,z=Ue[U];if(z)return S=z.nextPos,z.result;g=S,C=[],v=mle();while(v!==s)C.push(v),v=mle();if(C!==s)Ct=g,C=l();return g=C,Ue[U]={nextPos:S,result:g},g}function mle(){var g,C,v,U,z,le,ke,pt=S*49+1,cr=Ue[pt];if(cr)return S=cr.nextPos,cr.result;g=S,C=[],v=wt();while(v!==s)C.push(v),v=wt();if(C!==s)if(v=BYe(),v!==s){U=[],z=wt();while(z!==s)U.push(z),z=wt();if(U!==s){z=[],le=WN();while(le!==s)z.push(le),le=WN();if(z!==s){if(le=[],ke=Ju(),ke!==s)while(ke!==s)le.push(ke),ke=Ju();else le=u;if(le===s)le=$N();if(le!==s)C=[C,v,U,z,le],g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u}else S=g,g=u;else S=g,g=u;if(g===s){if(g=S,C=[],v=wt(),v!==s)while(v!==s)C.push(v),v=wt();else C=u;if(C!==s){if(v=[],U=Ju(),U!==s)while(U!==s)v.push(U),U=Ju();else v=u;if(v===s)v=$N();if(v!==s)C=[C,v],g=C;else S=g,g=u}else S=g,g=u;if(g===s)g=Ju()}return Ue[pt]={nextPos:S,result:g},g}function BYe(){var g,C=S*49+2,v=Ue[C];if(v)return S=v.nextPos,v.result;if(g=WN(),g===s){if(g=WYe(),g===s){if(g=zYe(),g===s)g=$Ye()}}return Ue[C]={nextPos:S,result:g},g}function WN(){var g,C,v,U,z,le,ke=S*49+3,pt=Ue[ke];if(pt)return S=pt.nextPos,pt.result;if(g=S,n.charCodeAt(S)===35)C=f,S++;else if(C=s,Me===0)Ve(h);if(C!==s){if(v=[],U=S,z=S,Me++,le=Ju(),le===s)le=$N();if(Me--,le===s)z=y;else S=z,z=u;if(z!==s){if(n.length>S)le=n.charAt(S),S++;else if(le=s,Me===0)Ve(E);if(le!==s)z=[z,le],U=z;else S=U,U=u}else S=U,U=u;while(U!==s){if(v.push(U),U=S,z=S,Me++,le=Ju(),le===s)le=$N();if(Me--,le===s)z=y;else S=z,z=u;if(z!==s){if(n.length>S)le=n.charAt(S),S++;else if(le=s,Me===0)Ve(E);if(le!==s)z=[z,le],U=z;else S=U,U=u}else S=U,U=u}if(v!==s)C=[C,v],g=C;else S=g,g=u}else S=g,g=u;return Ue[ke]={nextPos:S,result:g},g}function WYe(){var g,C,v,U,z,le,ke=S*49+4,pt=Ue[ke];if(pt)return S=pt.nextPos,pt.result;if(g=S,n.charCodeAt(S)===91)C=b,S++;else if(C=s,Me===0)Ve(w);if(C!==s){v=[],U=wt();while(U!==s)v.push(U),U=wt();if(v!==s)if(U=hle(),U!==s){z=[],le=wt();while(le!==s)z.push(le),le=wt();if(z!==s){if(n.charCodeAt(S)===93)le=T,S++;else if(le=s,Me===0)Ve(A);if(le!==s)Ct=g,C=k(U),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u;else S=g,g=u}else S=g,g=u;return Ue[ke]={nextPos:S,result:g},g}function zYe(){var g,C,v,U,z,le,ke,pt,cr=S*49+5,Ln=Ue[cr];if(Ln)return S=Ln.nextPos,Ln.result;if(g=S,n.charCodeAt(S)===91)C=b,S++;else if(C=s,Me===0)Ve(w);if(C!==s){if(n.charCodeAt(S)===91)v=b,S++;else if(v=s,Me===0)Ve(w);if(v!==s){U=[],z=wt();while(z!==s)U.push(z),z=wt();if(U!==s)if(z=hle(),z!==s){le=[],ke=wt();while(ke!==s)le.push(ke),ke=wt();if(le!==s){if(n.charCodeAt(S)===93)ke=T,S++;else if(ke=s,Me===0)Ve(A);if(ke!==s){if(n.charCodeAt(S)===93)pt=T,S++;else if(pt=s,Me===0)Ve(A);if(pt!==s)Ct=g,C=O(z),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u}else S=g,g=u;else S=g,g=u}else S=g,g=u}else S=g,g=u;return Ue[cr]={nextPos:S,result:g},g}function hle(){var g,C,v,U=S*49+6,z=Ue[U];if(z)return S=z.nextPos,z.result;if(g=S,C=[],v=xle(),v!==s)while(v!==s)C.push(v),v=xle();else C=u;if(C!==s)if(v=gle(),v!==s)Ct=g,C=P(C,v),g=C;else S=g,g=u;else S=g,g=u;if(g===s){if(g=S,C=gle(),C!==s)Ct=g,C=D(C);g=C}return Ue[U]={nextPos:S,result:g},g}function gle(){var g,C,v,U,z,le=S*49+7,ke=Ue[le];if(ke)return S=ke.nextPos,ke.result;g=S,C=[],v=wt();while(v!==s)C.push(v),v=wt();if(C!==s)if(v=Mv(),v!==s){U=[],z=wt();while(z!==s)U.push(z),z=wt();if(U!==s)Ct=g,C=I(v),g=C;else S=g,g=u}else S=g,g=u;else S=g,g=u;if(g===s){g=S,C=[],v=wt();while(v!==s)C.push(v),v=wt();if(C!==s)if(v=qK(),v!==s){U=[],z=wt();while(z!==s)U.push(z),z=wt();if(U!==s)Ct=g,C=I(v),g=C;else S=g,g=u}else S=g,g=u;else S=g,g=u}return Ue[le]={nextPos:S,result:g},g}function xle(){var g,C,v,U,z,le,ke,pt=S*49+8,cr=Ue[pt];if(cr)return S=cr.nextPos,cr.result;g=S,C=[],v=wt();while(v!==s)C.push(v),v=wt();if(C!==s)if(v=Mv(),v!==s){U=[],z=wt();while(z!==s)U.push(z),z=wt();if(U!==s){if(n.charCodeAt(S)===46)z=M,S++;else if(z=s,Me===0)Ve(B);if(z!==s){le=[],ke=wt();while(ke!==s)le.push(ke),ke=wt();if(le!==s)Ct=g,C=I(v),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u}else S=g,g=u;else S=g,g=u;if(g===s){g=S,C=[],v=wt();while(v!==s)C.push(v),v=wt();if(C!==s)if(v=qK(),v!==s){U=[],z=wt();while(z!==s)U.push(z),z=wt();if(U!==s){if(n.charCodeAt(S)===46)z=M,S++;else if(z=s,Me===0)Ve(B);if(z!==s){le=[],ke=wt();while(ke!==s)le.push(ke),ke=wt();if(le!==s)Ct=g,C=I(v),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u}else S=g,g=u;else S=g,g=u}return Ue[pt]={nextPos:S,result:g},g}function $Ye(){var g,C,v,U,z,le,ke=S*49+9,pt=Ue[ke];if(pt)return S=pt.nextPos,pt.result;if(g=S,C=Mv(),C!==s){v=[],U=wt();while(U!==s)v.push(U),U=wt();if(v!==s){if(n.charCodeAt(S)===61)U=ee,S++;else if(U=s,Me===0)Ve(j);if(U!==s){z=[],le=wt();while(le!==s)z.push(le),le=wt();if(z!==s)if(le=Nk(),le!==s)Ct=g,C=ae(C,le),g=C;else S=g,g=u;else S=g,g=u}else S=g,g=u}else S=g,g=u}else S=g,g=u;if(g===s)if(g=S,C=qK(),C!==s){v=[],U=wt();while(U!==s)v.push(U),U=wt();if(v!==s){if(n.charCodeAt(S)===61)U=ee,S++;else if(U=s,Me===0)Ve(j);if(U!==s){z=[],le=wt();while(le!==s)z.push(le),le=wt();if(z!==s)if(le=Nk(),le!==s)Ct=g,C=ae(C,le),g=C;else S=g,g=u;else S=g,g=u}else S=g,g=u}else S=g,g=u}else S=g,g=u;return Ue[ke]={nextPos:S,result:g},g}function Mv(){var g,C,v,U=S*49+10,z=Ue[U];if(z)return S=z.nextPos,z.result;if(g=S,C=[],v=Tle(),v!==s)while(v!==s)C.push(v),v=Tle();else C=u;if(C!==s)Ct=g,C=F(C);return g=C,Ue[U]={nextPos:S,result:g},g}function qK(){var g,C,v=S*49+11,U=Ue[v];if(U)return S=U.nextPos,U.result;if(g=S,C=yle(),C!==s)Ct=g,C=J(C);if(g=C,g===s){if(g=S,C=Sle(),C!==s)Ct=g,C=J(C);g=C}return Ue[v]={nextPos:S,result:g},g}function Nk(){var g,C=S*49+12,v=Ue[C];if(v)return S=v.nextPos,v.result;if(g=jYe(),g===s){if(g=r9e(),g===s){if(g=JYe(),g===s){if(g=QYe(),g===s){if(g=YYe(),g===s){if(g=ZYe(),g===s)g=XYe()}}}}}return Ue[C]={nextPos:S,result:g},g}function jYe(){var g,C=S*49+13,v=Ue[C];if(v)return S=v.nextPos,v.result;if(g=VYe(),g===s){if(g=yle(),g===s){if(g=GYe(),g===s)g=Sle()}}return Ue[C]={nextPos:S,result:g},g}function VYe(){var g,C,v,U,z,le=S*49+14,ke=Ue[le];if(ke)return S=ke.nextPos,ke.result;if(g=S,n.substr(S,3)===G)C=G,S+=3;else if(C=s,Me===0)Ve(Z);if(C!==s){if(v=Ju(),v===s)v=ne;if(v!==s){U=[],z=Cle();while(z!==s)U.push(z),z=Cle();if(U!==s){if(n.substr(S,3)===G)z=G,S+=3;else if(z=s,Me===0)Ve(Z);if(z!==s)Ct=g,C=we(U),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u}else S=g,g=u;return Ue[le]={nextPos:S,result:g},g}function yle(){var g,C,v,U,z=S*49+15,le=Ue[z];if(le)return S=le.nextPos,le.result;if(g=S,n.charCodeAt(S)===34)C=ot,S++;else if(C=s,Me===0)Ve(rt);if(C!==s){v=[],U=Ele();while(U!==s)v.push(U),U=Ele();if(v!==s){if(n.charCodeAt(S)===34)U=ot,S++;else if(U=s,Me===0)Ve(rt);if(U!==s)Ct=g,C=we(v),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u;return Ue[z]={nextPos:S,result:g},g}function GYe(){var g,C,v,U,z,le=S*49+16,ke=Ue[le];if(ke)return S=ke.nextPos,ke.result;if(g=S,n.substr(S,3)===Dt)C=Dt,S+=3;else if(C=s,Me===0)Ve(Lt);if(C!==s){if(v=Ju(),v===s)v=ne;if(v!==s){U=[],z=wle();while(z!==s)U.push(z),z=wle();if(U!==s){if(n.substr(S,3)===Dt)z=Dt,S+=3;else if(z=s,Me===0)Ve(Lt);if(z!==s)Ct=g,C=we(U),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u}else S=g,g=u;return Ue[le]={nextPos:S,result:g},g}function Sle(){var g,C,v,U,z=S*49+17,le=Ue[z];if(le)return S=le.nextPos,le.result;if(g=S,n.charCodeAt(S)===39)C=Do,S++;else if(C=s,Me===0)Ve(Ea);if(C!==s){v=[],U=ble();while(U!==s)v.push(U),U=ble();if(v!==s){if(n.charCodeAt(S)===39)U=Do,S++;else if(U=s,Me===0)Ve(Ea);if(U!==s)Ct=g,C=we(v),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u;return Ue[z]={nextPos:S,result:g},g}function Ele(){var g,C,v,U=S*49+18,z=Ue[U];if(z)return S=z.nextPos,z.result;if(g=Rle(),g===s){if(g=S,C=S,Me++,n.charCodeAt(S)===34)v=ot,S++;else if(v=s,Me===0)Ve(rt);if(Me--,v===s)C=y;else S=C,C=u;if(C!==s){if(n.length>S)v=n.charAt(S),S++;else if(v=s,Me===0)Ve(E);if(v!==s)Ct=g,C=Ah(v),g=C;else S=g,g=u}else S=g,g=u}return Ue[U]={nextPos:S,result:g},g}function ble(){var g,C,v,U=S*49+19,z=Ue[U];if(z)return S=z.nextPos,z.result;if(g=S,C=S,Me++,n.charCodeAt(S)===39)v=Do,S++;else if(v=s,Me===0)Ve(Ea);if(Me--,v===s)C=y;else S=C,C=u;if(C!==s){if(n.length>S)v=n.charAt(S),S++;else if(v=s,Me===0)Ve(E);if(v!==s)Ct=g,C=Ah(v),g=C;else S=g,g=u}else S=g,g=u;return Ue[U]={nextPos:S,result:g},g}function Cle(){var g,C,v,U=S*49+20,z=Ue[U];if(z)return S=z.nextPos,z.result;if(g=Rle(),g===s){if(g=KYe(),g===s){if(g=S,C=S,Me++,n.substr(S,3)===G)v=G,S+=3;else if(v=s,Me===0)Ve(Z);if(Me--,v===s)C=y;else S=C,C=u;if(C!==s){if(n.length>S)v=n.charAt(S),S++;else if(v=s,Me===0)Ve(E);if(v!==s)Ct=g,C=FQe(v),g=C;else S=g,g=u}else S=g,g=u}}return Ue[U]={nextPos:S,result:g},g}function KYe(){var g,C,v,U,z,le=S*49+21,ke=Ue[le];if(ke)return S=ke.nextPos,ke.result;if(g=S,n.charCodeAt(S)===92)C=NQe,S++;else if(C=s,Me===0)Ve(LQe);if(C!==s)if(v=Ju(),v!==s){U=[],z=vle();while(z!==s)U.push(z),z=vle();if(U!==s)Ct=g,C=UQe(),g=C;else S=g,g=u}else S=g,g=u;else S=g,g=u;return Ue[le]={nextPos:S,result:g},g}function wle(){var g,C,v,U=S*49+22,z=Ue[U];if(z)return S=z.nextPos,z.result;if(g=S,C=S,Me++,n.substr(S,3)===Dt)v=Dt,S+=3;else if(v=s,Me===0)Ve(Lt);if(Me--,v===s)C=y;else S=C,C=u;if(C!==s){if(n.length>S)v=n.charAt(S),S++;else if(v=s,Me===0)Ve(E);if(v!==s)Ct=g,C=Ah(v),g=C;else S=g,g=u}else S=g,g=u;return Ue[U]={nextPos:S,result:g},g}function JYe(){var g,C,v,U,z=S*49+23,le=Ue[z];if(le)return S=le.nextPos,le.result;if(g=S,C=kle(),C===s)C=BK();if(C!==s){if(n.charCodeAt(S)===101)v=HQe,S++;else if(v=s,Me===0)Ve(qQe);if(v===s){if(n.charCodeAt(S)===69)v=BQe,S++;else if(v=s,Me===0)Ve(WQe)}if(v!==s)if(U=BK(),U!==s)Ct=g,C=zQe(C,U),g=C;else S=g,g=u;else S=g,g=u}else S=g,g=u;if(g===s){if(g=S,C=kle(),C!==s)Ct=g,C=$Qe(C);g=C}return Ue[z]={nextPos:S,result:g},g}function kle(){var g,C,v,U,z,le,ke=S*49+24,pt=Ue[ke];if(pt)return S=pt.nextPos,pt.result;if(g=S,n.charCodeAt(S)===43)C=DK,S++;else if(C=s,Me===0)Ve(FK);if(C===s)C=ne;if(C!==s){if(v=S,U=Pv(),U!==s){if(n.charCodeAt(S)===46)z=M,S++;else if(z=s,Me===0)Ve(B);if(z!==s)if(le=Pv(),le!==s)U=[U,z,le],v=U;else S=v,v=u;else S=v,v=u}else S=v,v=u;if(v!==s)Ct=g,C=$ce(v),g=C;else S=g,g=u}else S=g,g=u;if(g===s){if(g=S,n.charCodeAt(S)===45)C=Ov,S++;else if(C=s,Me===0)Ve(_v);if(C!==s){if(v=S,U=Pv(),U!==s){if(n.charCodeAt(S)===46)z=M,S++;else if(z=s,Me===0)Ve(B);if(z!==s)if(le=Pv(),le!==s)U=[U,z,le],v=U;else S=v,v=u;else S=v,v=u}else S=v,v=u;if(v!==s)Ct=g,C=jce(v),g=C;else S=g,g=u}else S=g,g=u}return Ue[ke]={nextPos:S,result:g},g}function QYe(){var g,C,v=S*49+25,U=Ue[v];if(U)return S=U.nextPos,U.result;if(g=S,C=BK(),C!==s)Ct=g,C=jQe(C);return g=C,Ue[v]={nextPos:S,result:g},g}function BK(){var g,C,v,U,z,le=S*49+26,ke=Ue[le];if(ke)return S=ke.nextPos,ke.result;if(g=S,n.charCodeAt(S)===43)C=DK,S++;else if(C=s,Me===0)Ve(FK);if(C===s)C=ne;if(C!==s){if(v=[],U=vn(),U!==s)while(U!==s)v.push(U),U=vn();else v=u;if(v!==s){if(U=S,Me++,n.charCodeAt(S)===46)z=M,S++;else if(z=s,Me===0)Ve(B);if(Me--,z===s)U=y;else S=U,U=u;if(U!==s)Ct=g,C=$ce(v),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u;if(g===s){if(g=S,n.charCodeAt(S)===45)C=Ov,S++;else if(C=s,Me===0)Ve(_v);if(C!==s){if(v=[],U=vn(),U!==s)while(U!==s)v.push(U),U=vn();else v=u;if(v!==s){if(U=S,Me++,n.charCodeAt(S)===46)z=M,S++;else if(z=s,Me===0)Ve(B);if(Me--,z===s)U=y;else S=U,U=u;if(U!==s)Ct=g,C=jce(v),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u}return Ue[le]={nextPos:S,result:g},g}function YYe(){var g,C,v=S*49+27,U=Ue[v];if(U)return S=U.nextPos,U.result;if(g=S,n.substr(S,4)===Vce)C=Vce,S+=4;else if(C=s,Me===0)Ve(VQe);if(C!==s)Ct=g,C=GQe();if(g=C,g===s){if(g=S,n.substr(S,5)===Gce)C=Gce,S+=5;else if(C=s,Me===0)Ve(KQe);if(C!==s)Ct=g,C=JQe();g=C}return Ue[v]={nextPos:S,result:g},g}function ZYe(){var g,C,v,U,z,le=S*49+28,ke=Ue[le];if(ke)return S=ke.nextPos,ke.result;if(g=S,n.charCodeAt(S)===91)C=b,S++;else if(C=s,Me===0)Ve(w);if(C!==s){v=[],U=Ku();while(U!==s)v.push(U),U=Ku();if(v!==s){if(n.charCodeAt(S)===93)U=T,S++;else if(U=s,Me===0)Ve(A);if(U!==s)Ct=g,C=QQe(),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u;if(g===s){if(g=S,n.charCodeAt(S)===91)C=b,S++;else if(C=s,Me===0)Ve(w);if(C!==s){if(v=Ile(),v===s)v=ne;if(v!==s){if(n.charCodeAt(S)===93)U=T,S++;else if(U=s,Me===0)Ve(A);if(U!==s)Ct=g,C=YQe(v),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u;if(g===s){if(g=S,n.charCodeAt(S)===91)C=b,S++;else if(C=s,Me===0)Ve(w);if(C!==s){if(v=[],U=zN(),U!==s)while(U!==s)v.push(U),U=zN();else v=u;if(v!==s){if(n.charCodeAt(S)===93)U=T,S++;else if(U=s,Me===0)Ve(A);if(U!==s)Ct=g,C=ZQe(v),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u;if(g===s){if(g=S,n.charCodeAt(S)===91)C=b,S++;else if(C=s,Me===0)Ve(w);if(C!==s){if(v=[],U=zN(),U!==s)while(U!==s)v.push(U),U=zN();else v=u;if(v!==s)if(U=Ile(),U!==s){if(n.charCodeAt(S)===93)z=T,S++;else if(z=s,Me===0)Ve(A);if(z!==s)Ct=g,C=XQe(v,U),g=C;else S=g,g=u}else S=g,g=u;else S=g,g=u}else S=g,g=u}}}return Ue[le]={nextPos:S,result:g},g}function Ile(){var g,C,v,U,z,le=S*49+29,ke=Ue[le];if(ke)return S=ke.nextPos,ke.result;g=S,C=[],v=Ku();while(v!==s)C.push(v),v=Ku();if(C!==s)if(v=Nk(),v!==s){U=[],z=Ku();while(z!==s)U.push(z),z=Ku();if(U!==s)Ct=g,C=Kce(v),g=C;else S=g,g=u}else S=g,g=u;else S=g,g=u;return Ue[le]={nextPos:S,result:g},g}function zN(){var g,C,v,U,z,le,ke,pt=S*49+30,cr=Ue[pt];if(cr)return S=cr.nextPos,cr.result;g=S,C=[],v=Ku();while(v!==s)C.push(v),v=Ku();if(C!==s)if(v=Nk(),v!==s){U=[],z=Ku();while(z!==s)U.push(z),z=Ku();if(U!==s){if(n.charCodeAt(S)===44)z=Jce,S++;else if(z=s,Me===0)Ve(Qce);if(z!==s){le=[],ke=Ku();while(ke!==s)le.push(ke),ke=Ku();if(le!==s)Ct=g,C=Kce(v),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u}else S=g,g=u;else S=g,g=u;return Ue[pt]={nextPos:S,result:g},g}function Ku(){var g,C=S*49+31,v=Ue[C];if(v)return S=v.nextPos,v.result;if(g=wt(),g===s){if(g=Ju(),g===s)g=WN()}return Ue[C]={nextPos:S,result:g},g}function XYe(){var g,C,v,U,z,le,ke=S*49+32,pt=Ue[ke];if(pt)return S=pt.nextPos,pt.result;if(g=S,n.charCodeAt(S)===123)C=eYe,S++;else if(C=s,Me===0)Ve(tYe);if(C!==s){v=[],U=wt();while(U!==s)v.push(U),U=wt();if(v!==s){U=[],z=Ale();while(z!==s)U.push(z),z=Ale();if(U!==s){z=[],le=wt();while(le!==s)z.push(le),le=wt();if(z!==s){if(n.charCodeAt(S)===125)le=rYe,S++;else if(le=s,Me===0)Ve(nYe);if(le!==s)Ct=g,C=oYe(U),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u}else S=g,g=u}else S=g,g=u;return Ue[ke]={nextPos:S,result:g},g}function Ale(){var g,C,v,U,z,le,ke,pt,cr,Ln,xn,us=S*49+33,Vs=Ue[us];if(Vs)return S=Vs.nextPos,Vs.result;g=S,C=[],v=wt();while(v!==s)C.push(v),v=wt();if(C!==s)if(v=Mv(),v!==s){U=[],z=wt();while(z!==s)U.push(z),z=wt();if(U!==s){if(n.charCodeAt(S)===61)z=ee,S++;else if(z=s,Me===0)Ve(j);if(z!==s){le=[],ke=wt();while(ke!==s)le.push(ke),ke=wt();if(le!==s)if(ke=Nk(),ke!==s){pt=[],cr=wt();while(cr!==s)pt.push(cr),cr=wt();if(pt!==s){if(n.charCodeAt(S)===44)cr=Jce,S++;else if(cr=s,Me===0)Ve(Qce);if(cr!==s){Ln=[],xn=wt();while(xn!==s)Ln.push(xn),xn=wt();if(Ln!==s)Ct=g,C=Yce(v,ke),g=C;else S=g,g=u}else S=g,g=u}else S=g,g=u}else S=g,g=u;else S=g,g=u}else S=g,g=u}else S=g,g=u}else S=g,g=u;else S=g,g=u;if(g===s){g=S,C=[],v=wt();while(v!==s)C.push(v),v=wt();if(C!==s)if(v=Mv(),v!==s){U=[],z=wt();while(z!==s)U.push(z),z=wt();if(U!==s){if(n.charCodeAt(S)===61)z=ee,S++;else if(z=s,Me===0)Ve(j);if(z!==s){le=[],ke=wt();while(ke!==s)le.push(ke),ke=wt();if(le!==s)if(ke=Nk(),ke!==s)Ct=g,C=Yce(v,ke),g=C;else S=g,g=u;else S=g,g=u}else S=g,g=u}else S=g,g=u}else S=g,g=u;else S=g,g=u}return Ue[us]={nextPos:S,result:g},g}function Ole(){var g,C,v,U=S*49+34,z=Ue[U];if(z)return S=z.nextPos,z.result;if(g=S,n.charCodeAt(S)===46)C=M,S++;else if(C=s,Me===0)Ve(B);if(C!==s)if(v=Pv(),v!==s)Ct=g,C=sYe(v),g=C;else S=g,g=u;else S=g,g=u;return Ue[U]={nextPos:S,result:g},g}function _le(){var g,C,v,U,z,le,ke,pt,cr,Ln,xn,us,Vs=S*49+35,Yl=Ue[Vs];if(Yl)return S=Yl.nextPos,Yl.result;if(g=S,C=S,v=vn(),v!==s)if(U=vn(),U!==s)if(z=vn(),z!==s)if(le=vn(),le!==s){if(n.charCodeAt(S)===45)ke=Ov,S++;else if(ke=s,Me===0)Ve(_v);if(ke!==s)if(pt=vn(),pt!==s)if(cr=vn(),cr!==s){if(n.charCodeAt(S)===45)Ln=Ov,S++;else if(Ln=s,Me===0)Ve(_v);if(Ln!==s)if(xn=vn(),xn!==s)if(us=vn(),us!==s)v=[v,U,z,le,ke,pt,cr,Ln,xn,us],C=v;else S=C,C=u;else S=C,C=u;else S=C,C=u}else S=C,C=u;else S=C,C=u;else S=C,C=u}else S=C,C=u;else S=C,C=u;else S=C,C=u;else S=C,C=u;if(C!==s)Ct=g,C=iYe(C);return g=C,Ue[Vs]={nextPos:S,result:g},g}function e9e(){var g,C,v,U,z,le,ke,pt,cr,Ln,xn,us=S*49+36,Vs=Ue[us];if(Vs)return S=Vs.nextPos,Vs.result;if(g=S,C=S,v=vn(),v!==s)if(U=vn(),U!==s){if(n.charCodeAt(S)===58)z=vv,S++;else if(z=s,Me===0)Ve(Tv);if(z!==s)if(le=vn(),le!==s)if(ke=vn(),ke!==s){if(n.charCodeAt(S)===58)pt=vv,S++;else if(pt=s,Me===0)Ve(Tv);if(pt!==s)if(cr=vn(),cr!==s)if(Ln=vn(),Ln!==s){if(xn=Ole(),xn===s)xn=ne;if(xn!==s)v=[v,U,z,le,ke,pt,cr,Ln,xn],C=v;else S=C,C=u}else S=C,C=u;else S=C,C=u;else S=C,C=u}else S=C,C=u;else S=C,C=u;else S=C,C=u}else S=C,C=u;else S=C,C=u;if(C!==s)Ct=g,C=Zce(C);return g=C,Ue[us]={nextPos:S,result:g},g}function t9e(){var g,C,v,U,z,le,ke,pt,cr,Ln,xn,us,Vs,Yl,Lk,ty,Zl,Ple=S*49+37,zK=Ue[Ple];if(zK)return S=zK.nextPos,zK.result;if(g=S,C=S,v=vn(),v!==s)if(U=vn(),U!==s){if(n.charCodeAt(S)===58)z=vv,S++;else if(z=s,Me===0)Ve(Tv);if(z!==s)if(le=vn(),le!==s)if(ke=vn(),ke!==s){if(n.charCodeAt(S)===58)pt=vv,S++;else if(pt=s,Me===0)Ve(Tv);if(pt!==s)if(cr=vn(),cr!==s)if(Ln=vn(),Ln!==s){if(xn=Ole(),xn===s)xn=ne;if(xn!==s){if(n.charCodeAt(S)===45)us=Ov,S++;else if(us=s,Me===0)Ve(_v);if(us===s){if(n.charCodeAt(S)===43)us=DK,S++;else if(us=s,Me===0)Ve(FK)}if(us!==s)if(Vs=vn(),Vs!==s)if(Yl=vn(),Yl!==s){if(n.charCodeAt(S)===58)Lk=vv,S++;else if(Lk=s,Me===0)Ve(Tv);if(Lk!==s)if(ty=vn(),ty!==s)if(Zl=vn(),Zl!==s)v=[v,U,z,le,ke,pt,cr,Ln,xn,us,Vs,Yl,Lk,ty,Zl],C=v;else S=C,C=u;else S=C,C=u;else S=C,C=u}else S=C,C=u;else S=C,C=u;else S=C,C=u}else S=C,C=u}else S=C,C=u;else S=C,C=u;else S=C,C=u}else S=C,C=u;else S=C,C=u;else S=C,C=u}else S=C,C=u;else S=C,C=u;if(C!==s)Ct=g,C=Zce(C);return g=C,Ue[Ple]={nextPos:S,result:g},g}function r9e(){var g,C,v,U,z,le=S*49+38,ke=Ue[le];if(ke)return S=ke.nextPos,ke.result;if(g=S,C=_le(),C!==s){if(n.charCodeAt(S)===84)v=Xce,S++;else if(v=s,Me===0)Ve(ele);if(v!==s)if(U=e9e(),U!==s){if(n.charCodeAt(S)===90)z=aYe,S++;else if(z=s,Me===0)Ve(cYe);if(z!==s)Ct=g,C=lYe(C,U),g=C;else S=g,g=u}else S=g,g=u;else S=g,g=u}else S=g,g=u;if(g===s)if(g=S,C=_le(),C!==s){if(n.charCodeAt(S)===84)v=Xce,S++;else if(v=s,Me===0)Ve(ele);if(v!==s)if(U=t9e(),U!==s)Ct=g,C=uYe(C,U),g=C;else S=g,g=u;else S=g,g=u}else S=g,g=u;return Ue[le]={nextPos:S,result:g},g}function wt(){var g,C=S*49+39,v=Ue[C];if(v)return S=v.nextPos,v.result;if(pYe.test(n.charAt(S)))g=n.charAt(S),S++;else if(g=s,Me===0)Ve(fYe);return Ue[C]={nextPos:S,result:g},g}function Ju(){var g,C,v,U=S*49+40,z=Ue[U];if(z)return S=z.nextPos,z.result;if(n.charCodeAt(S)===10)g=tle,S++;else if(g=s,Me===0)Ve(rle);if(g===s){if(g=S,n.charCodeAt(S)===13)C=dYe,S++;else if(C=s,Me===0)Ve(mYe);if(C!==s){if(n.charCodeAt(S)===10)v=tle,S++;else if(v=s,Me===0)Ve(rle);if(v!==s)C=[C,v],g=C;else S=g,g=u}else S=g,g=u}return Ue[U]={nextPos:S,result:g},g}function vle(){var g,C=S*49+41,v=Ue[C];if(v)return S=v.nextPos,v.result;if(g=Ju(),g===s)g=wt();return Ue[C]={nextPos:S,result:g},g}function $N(){var g,C,v=S*49+42,U=Ue[v];if(U)return S=U.nextPos,U.result;if(g=S,Me++,n.length>S)C=n.charAt(S),S++;else if(C=s,Me===0)Ve(E);if(Me--,C===s)g=y;else S=g,g=u;return Ue[v]={nextPos:S,result:g},g}function Qu(){var g,C=S*49+43,v=Ue[C];if(v)return S=v.nextPos,v.result;if(hYe.test(n.charAt(S)))g=n.charAt(S),S++;else if(g=s,Me===0)Ve(gYe);return Ue[C]={nextPos:S,result:g},g}function vn(){var g,C,v=S*49+44,U=Ue[v];if(U)return S=U.nextPos,U.result;if(xYe.test(n.charAt(S)))g=n.charAt(S),S++;else if(g=s,Me===0)Ve(yYe);if(g===s){if(g=S,n.charCodeAt(S)===95)C=SYe,S++;else if(C=s,Me===0)Ve(EYe);if(C!==s)Ct=g,C=bYe();g=C}return Ue[v]={nextPos:S,result:g},g}function Tle(){var g,C=S*49+45,v=Ue[C];if(v)return S=v.nextPos,v.result;if(CYe.test(n.charAt(S)))g=n.charAt(S),S++;else if(g=s,Me===0)Ve(wYe);return Ue[C]={nextPos:S,result:g},g}function Pv(){var g,C,v,U=S*49+46,z=Ue[U];if(z)return S=z.nextPos,z.result;if(g=S,C=[],v=vn(),v!==s)while(v!==s)C.push(v),v=vn();else C=u;if(C!==s)Ct=g,C=kYe(C);return g=C,Ue[U]={nextPos:S,result:g},g}function Rle(){var g,C,v=S*49+47,U=Ue[v];if(U)return S=U.nextPos,U.result;if(g=S,n.substr(S,2)===nle)C=nle,S+=2;else if(C=s,Me===0)Ve(IYe);if(C!==s)Ct=g,C=AYe();if(g=C,g===s){if(g=S,n.substr(S,2)===ole)C=ole,S+=2;else if(C=s,Me===0)Ve(OYe);if(C!==s)Ct=g,C=_Ye();if(g=C,g===s){if(g=S,n.substr(S,2)===sle)C=sle,S+=2;else if(C=s,Me===0)Ve(vYe);if(C!==s)Ct=g,C=TYe();if(g=C,g===s){if(g=S,n.substr(S,2)===ile)C=ile,S+=2;else if(C=s,Me===0)Ve(RYe);if(C!==s)Ct=g,C=MYe();if(g=C,g===s){if(g=S,n.substr(S,2)===ale)C=ale,S+=2;else if(C=s,Me===0)Ve(PYe);if(C!==s)Ct=g,C=DYe();if(g=C,g===s){if(g=S,n.substr(S,2)===cle)C=cle,S+=2;else if(C=s,Me===0)Ve(FYe);if(C!==s)Ct=g,C=NYe();if(g=C,g===s){if(g=S,n.substr(S,2)===lle)C=lle,S+=2;else if(C=s,Me===0)Ve(LYe);if(C!==s)Ct=g,C=UYe();if(g=C,g===s)g=n9e()}}}}}}return Ue[v]={nextPos:S,result:g},g}function n9e(){var g,C,v,U,z,le,ke,pt,cr,Ln,xn,us=S*49+48,Vs=Ue[us];if(Vs)return S=Vs.nextPos,Vs.result;if(g=S,n.substr(S,2)===ule)C=ule,S+=2;else if(C=s,Me===0)Ve(HYe);if(C!==s){if(v=S,U=Qu(),U!==s)if(z=Qu(),z!==s)if(le=Qu(),le!==s)if(ke=Qu(),ke!==s)if(pt=Qu(),pt!==s)if(cr=Qu(),cr!==s)if(Ln=Qu(),Ln!==s)if(xn=Qu(),xn!==s)U=[U,z,le,ke,pt,cr,Ln,xn],v=U;else S=v,v=u;else S=v,v=u;else S=v,v=u;else S=v,v=u;else S=v,v=u;else S=v,v=u;else S=v,v=u;else S=v,v=u;if(v!==s)Ct=g,C=ple(v),g=C;else S=g,g=u}else S=g,g=u;if(g===s){if(g=S,n.substr(S,2)===fle)C=fle,S+=2;else if(C=s,Me===0)Ve(qYe);if(C!==s){if(v=S,U=Qu(),U!==s)if(z=Qu(),z!==s)if(le=Qu(),le!==s)if(ke=Qu(),ke!==s)U=[U,z,le,ke],v=U;else S=v,v=u;else S=v,v=u;else S=v,v=u;else S=v,v=u;if(v!==s)Ct=g,C=ple(v),g=C;else S=g,g=u}else S=g,g=u}return Ue[us]={nextPos:S,result:g},g}var Mle=[];function o9e(g,C,v){var U=Error(g);throw U.line=C,U.column=v,U}function WK(g){Mle.push(g)}function wa(g,C,v,U,z){var le={type:g,value:C,line:v(),column:U()};if(z)le.key=z;return le}function s9e(g,C,v){var U=parseInt("0x"+g);if(!isFinite(U)||Math.floor(U)!=U||U<0||U>1114111||U>55295&&U<57344)o9e("Invalid Unicode escape code: "+g,C,v);else return i9e(U)}function i9e(){var g=16384,C=[],v,U,z=-1,le=arguments.length;if(!le)return"";var ke="";while(++z<le){var pt=Number(arguments[z]);if(pt<=65535)C.push(pt);else pt-=65536,v=(pt>>10)+55296,U=pt%1024+56320,C.push(v,U);if(z+1==le||C.length>g)ke+=String.fromCharCode.apply(null,C),C.length=0}return ke}if(BN=a(),BN!==s&&S===n.length)return BN;else{if(BN!==s&&S<n.length)Ve({type:"end",description:"end of input"});throw HK(null,LK,qN)}}return{SyntaxError:t,parse:r}}()});var Q1e=at(function(Wlr,J1e){function __t(e){var t=[],r=[],n="",o=Object.create(null),s=o,i=!1;return a(e);function a(A){var k;for(var O=0;O<A.length;O++)switch(k=A[O],k.type){case"Assign":l(k);break;case"ObjectPath":y(k);break;case"ArrayPath":E(k);break}return o}function c(A,k,O){var P=Error(A);throw P.line=k,P.column=O,P}function l(A){var{key:k,value:O,line:P,column:D}=A,I;if(n)I=n+"."+k;else I=k;if(typeof s[k]<"u")c("Cannot redefine existing key '"+I+"'.",P,D);if(s[k]=f(O),!u(I))t.push(I),r.push(I)}function u(A){return t.indexOf(A)!==-1}function f(A){if(A.type==="Array")return w(A.value);else if(A.type==="InlineTable")return h(A.value);else return A.value}function h(A){var k=Object.create(null);for(var O=0;O<A.length;O++){var P=A[O];if(P.value.type==="InlineTable")k[P.key]=h(P.value.value);else if(P.type==="InlineTableValue")k[P.key]=f(P.value)}return k}function y(A){var k=A.value,O=k.map(T).join("."),P=A.line,D=A.column;if(u(O))c("Cannot redefine existing key '"+k+"'.",P,D);t.push(O),s=b(o,k,Object.create(null),P,D),n=k}function E(A){var k=A.value,O=k.map(T).join("."),P=A.line,D=A.column;if(!u(O))t.push(O);if(t=t.filter(function(M){return M.indexOf(O)!==0}),t.push(O),s=b(o,k,[],P,D),n=O,s instanceof Array){var I=Object.create(null);s.push(I),s=I}else c("Cannot redefine existing key '"+k+"'.",P,D)}function b(A,k,O,P,D){var I=[],M="",B=k.join("."),ee=A;for(var j=0;j<k.length;j++){var ae=k[j];if(I.push(ae),M=I.join("."),typeof ee[ae]>"u")if(j===k.length-1)ee[ae]=O;else ee[ae]=Object.create(null);else if(j!==k.length-1&&r.indexOf(M)>-1)c("Cannot redefine existing key '"+M+"'.",P,D);if(ee=ee[ae],ee instanceof Array&&ee.length&&j<k.length-1)ee=ee[ee.length-1]}return ee}function w(A){var k=null;for(var O=0;O<A.length;O++){var P=A[O];if(k===null)k=P.type;else if(P.type!==k)c("Cannot add value of type "+P.type+" to array of type "+k+".",P.line,P.column)}return A.map(f)}function T(A){if(A.indexOf(".")>-1)return'"'+A+'"';else return A}}J1e.exports={compile:__t}});var Z1e=at(function(zlr,Y1e){var v_t=K1e(),T_t=Q1e();Y1e.exports={parse:function(e){var t=v_t.parse(e.toString());return T_t.compile(t)}}});var pn=at(function(U_t){var Xte=Symbol.for("yaml.alias"),X1e=Symbol.for("yaml.document"),zz=Symbol.for("yaml.map"),e2e=Symbol.for("yaml.pair"),ere=Symbol.for("yaml.scalar"),$z=Symbol.for("yaml.seq"),px=Symbol.for("yaml.node.type"),R_t=(e)=>!!e&&typeof e==="object"&&e[px]===Xte,M_t=(e)=>!!e&&typeof e==="object"&&e[px]===X1e,P_t=(e)=>!!e&&typeof e==="object"&&e[px]===zz,D_t=(e)=>!!e&&typeof e==="object"&&e[px]===e2e,t2e=(e)=>!!e&&typeof e==="object"&&e[px]===ere,F_t=(e)=>!!e&&typeof e==="object"&&e[px]===$z;function r2e(e){if(e&&typeof e==="object")switch(e[px]){case zz:case $z:return!0}return!1}function N_t(e){if(e&&typeof e==="object")switch(e[px]){case Xte:case zz:case ere:case $z:return!0}return!1}var L_t=(e)=>(t2e(e)||r2e(e))&&!!e.anchor;U_t.ALIAS=Xte;U_t.DOC=X1e;U_t.MAP=zz;U_t.NODE_TYPE=px;U_t.PAIR=e2e;U_t.SCALAR=ere;U_t.SEQ=$z;U_t.hasAnchor=L_t;U_t.isAlias=R_t;U_t.isCollection=r2e;U_t.isDocument=M_t;U_t.isMap=P_t;U_t.isNode=N_t;U_t.isPair=D_t;U_t.isScalar=t2e;U_t.isSeq=F_t});var sD=at(function(tvt){var qi=pn(),Ll=Symbol("break visit"),n2e=Symbol("skip children"),Qm=Symbol("remove node");function jz(e,t){let r=o2e(t);if(qi.isDocument(e)){if(YO(null,e.contents,r,Object.freeze([e]))===Qm)e.contents=null}else YO(null,e,r,Object.freeze([]))}jz.BREAK=Ll;jz.SKIP=n2e;jz.REMOVE=Qm;function YO(e,t,r,n){let o=s2e(e,t,r,n);if(qi.isNode(o)||qi.isPair(o))return i2e(e,n,o),YO(e,o,r,n);if(typeof o!=="symbol"){if(qi.isCollection(t)){n=Object.freeze(n.concat(t));for(let s=0;s<t.items.length;++s){let i=YO(s,t.items[s],r,n);if(typeof i==="number")s=i-1;else if(i===Ll)return Ll;else if(i===Qm)t.items.splice(s,1),s-=1}}else if(qi.isPair(t)){n=Object.freeze(n.concat(t));let s=YO("key",t.key,r,n);if(s===Ll)return Ll;else if(s===Qm)t.key=null;let i=YO("value",t.value,r,n);if(i===Ll)return Ll;else if(i===Qm)t.value=null}}return o}async function Vz(e,t){let r=o2e(t);if(qi.isDocument(e)){if(await ZO(null,e.contents,r,Object.freeze([e]))===Qm)e.contents=null}else await ZO(null,e,r,Object.freeze([]))}Vz.BREAK=Ll;Vz.SKIP=n2e;Vz.REMOVE=Qm;async function ZO(e,t,r,n){let o=await s2e(e,t,r,n);if(qi.isNode(o)||qi.isPair(o))return i2e(e,n,o),ZO(e,o,r,n);if(typeof o!=="symbol"){if(qi.isCollection(t)){n=Object.freeze(n.concat(t));for(let s=0;s<t.items.length;++s){let i=await ZO(s,t.items[s],r,n);if(typeof i==="number")s=i-1;else if(i===Ll)return Ll;else if(i===Qm)t.items.splice(s,1),s-=1}}else if(qi.isPair(t)){n=Object.freeze(n.concat(t));let s=await ZO("key",t.key,r,n);if(s===Ll)return Ll;else if(s===Qm)t.key=null;let i=await ZO("value",t.value,r,n);if(i===Ll)return Ll;else if(i===Qm)t.value=null}}return o}function o2e(e){if(typeof e==="object"&&(e.Collection||e.Node||e.Value))return Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e);return e}function s2e(e,t,r,n){if(typeof r==="function")return r(e,t,n);if(qi.isMap(t))return r.Map?.(e,t,n);if(qi.isSeq(t))return r.Seq?.(e,t,n);if(qi.isPair(t))return r.Pair?.(e,t,n);if(qi.isScalar(t))return r.Scalar?.(e,t,n);if(qi.isAlias(t))return r.Alias?.(e,t,n);return}function i2e(e,t,r){let n=t[t.length-1];if(qi.isCollection(n))n.items[e]=r;else if(qi.isPair(n))if(e==="key")n.key=r;else n.value=r;else if(qi.isDocument(n))n.contents=r;else{let o=qi.isAlias(n)?"alias":"scalar";throw Error(`Cannot replace node with ${o} parent`)}}tvt.visit=jz;tvt.visitAsync=Vz});var tre=at(function(avt){var a2e=pn(),ovt=sD(),svt={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ivt=(e)=>e.replace(/[!,[\]{}]/g,(t)=>svt[t]);class $p{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},$p.defaultYaml,e),this.tags=Object.assign({},$p.defaultTags,t)}clone(){let e=new $p(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new $p(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:$p.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},$p.defaultTags);break}return e}add(e,t){if(this.atNextDocument)this.yaml={explicit:$p.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},$p.defaultTags),this.atNextDocument=!1;let r=e.trim().split(/[ \t]+/),n=r.shift();switch(n){case"%TAG":{if(r.length!==2){if(t(0,"%TAG directive should contain exactly two parts"),r.length<2)return!1}let[o,s]=r;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;else{let s=/^\d+\.\d+$/.test(o);return t(6,`Unsupported YAML version ${o}`,s),!1}}default:return t(0,`Unknown directive ${n}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);if(s==="!"||s==="!!")return t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null;if(e[e.length-1]!==">")t("Verbatim tags must end with a >");return s}let[,r,n]=e.match(/^(.*!)([^!]*)$/s);if(!n)t(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(n)}catch(s){return t(String(s)),null}if(r==="!")return e;return t(`Could not resolve tag: ${e}`),null}tagString(e){for(let[t,r]of Object.entries(this.tags))if(e.startsWith(r))return t+ivt(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),n;if(e&&r.length>0&&a2e.isNode(e.contents)){let o={};ovt.visit(e.contents,(s,i)=>{if(a2e.isNode(i)&&i.tag)o[i.tag]=!0}),n=Object.keys(o)}else n=[];for(let[o,s]of r){if(o==="!!"&&s==="tag:yaml.org,2002:")continue;if(!e||n.some((i)=>i.startsWith(s)))t.push(`%TAG ${o} ${s}`)}return t.join(`
|
|
9
|
+
`)}}$p.defaultYaml={explicit:!1,version:"1.2"};$p.defaultTags={"!!":"tag:yaml.org,2002:"};avt.Directives=$p});var Gz=at(function(fvt){var c2e=pn(),lvt=sD();function uvt(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(r)}return!0}function l2e(e){let t=new Set;return lvt.visit(e,{Value(r,n){if(n.anchor)t.add(n.anchor)}}),t}function u2e(e,t){for(let r=1;;++r){let n=`${e}${r}`;if(!t.has(n))return n}}function pvt(e,t){let r=[],n=new Map,o=null;return{onAnchor:(s)=>{r.push(s),o??(o=l2e(e));let i=u2e(t,o);return o.add(i),i},setAnchors:()=>{for(let s of r){let i=n.get(s);if(typeof i==="object"&&i.anchor&&(c2e.isScalar(i.node)||c2e.isCollection(i.node)))i.node.anchor=i.anchor;else{let a=Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:n}}fvt.anchorIsValid=uvt;fvt.anchorNames=l2e;fvt.createNodeAnchors=pvt;fvt.findNewAnchor=u2e});var rre=at(function(xvt){function iD(e,t,r,n){if(n&&typeof n==="object")if(Array.isArray(n))for(let o=0,s=n.length;o<s;++o){let i=n[o],a=iD(e,n,String(o),i);if(a===void 0)delete n[o];else if(a!==i)n[o]=a}else if(n instanceof Map)for(let o of Array.from(n.keys())){let s=n.get(o),i=iD(e,n,o,s);if(i===void 0)n.delete(o);else if(i!==s)n.set(o,i)}else if(n instanceof Set)for(let o of Array.from(n)){let s=iD(e,n,o,o);if(s===void 0)n.delete(o);else if(s!==o)n.delete(o),n.add(s)}else for(let[o,s]of Object.entries(n)){let i=iD(e,n,o,s);if(i===void 0)delete n[o];else if(i!==s)n[o]=i}return e.call(t,r,n)}xvt.applyReviver=iD});var yE=at(function(Evt){var Svt=pn();function p2e(e,t,r){if(Array.isArray(e))return e.map((n,o)=>p2e(n,String(o),r));if(e&&typeof e.toJSON==="function"){if(!r||!Svt.hasAnchor(e))return e.toJSON(t,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(e,n),r.onCreate=(s)=>{n.res=s,delete r.onCreate};let o=e.toJSON(t,r);if(r.onCreate)r.onCreate(o);return o}if(typeof e==="bigint"&&!r?.keep)return Number(e);return e}Evt.toJS=p2e});var Kz=at(function(kvt){var Cvt=rre(),f2e=pn(),wvt=yE();class d2e{constructor(e){Object.defineProperty(this,f2e.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)e.range=this.range.slice();return e}toJS(e,{mapAsMap:t,maxAliasCount:r,onAnchor:n,reviver:o}={}){if(!f2e.isDocument(e))throw TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof r==="number"?r:100},i=wvt.toJS(this,"",s);if(typeof n==="function")for(let{count:a,res:c}of s.anchors.values())n(c,a);return typeof o==="function"?Cvt.applyReviver(o,{"":i},"",i):i}}kvt.NodeBase=d2e});var aD=at(function(Tvt){var Avt=Gz(),Ovt=sD(),XO=pn(),_vt=Kz(),vvt=yE();class m2e extends _vt.NodeBase{constructor(e){super(XO.ALIAS);this.source=e,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let r;if(t?.aliasResolveCache)r=t.aliasResolveCache;else if(r=[],Ovt.visit(e,{Node:(o,s)=>{if(XO.isAlias(s)||XO.hasAnchor(s))r.push(s)}}),t)t.aliasResolveCache=r;let n=void 0;for(let o of r){if(o===this)break;if(o.anchor===this.source)n=o}return n}toJSON(e,t){if(!t)return{source:this.source};let{anchors:r,doc:n,maxAliasCount:o}=t,s=this.resolve(n,t);if(!s){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(a)}let i=r.get(s);if(!i)vvt.toJS(s,null,t),i=r.get(s);if(i?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(o>=0){if(i.count+=1,i.aliasCount===0)i.aliasCount=Jz(n,s,r);if(i.count*i.aliasCount>o)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return i.res}toString(e,t,r){let n=`*${this.source}`;if(e){if(Avt.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(o)}if(e.implicitKey)return`${n} `}return n}}function Jz(e,t,r){if(XO.isAlias(t)){let n=t.resolve(e),o=r&&n&&r.get(n);return o?o.count*o.aliasCount:0}else if(XO.isCollection(t)){let n=0;for(let o of t.items){let s=Jz(e,o,r);if(s>n)n=s}return n}else if(XO.isPair(t)){let n=Jz(e,t.key,r),o=Jz(e,t.value,r);return Math.max(n,o)}return 1}Tvt.Alias=m2e});var Si=at(function(Nvt){var Mvt=pn(),Pvt=Kz(),Dvt=yE(),Fvt=(e)=>!e||typeof e!=="function"&&typeof e!=="object";class Tw extends Pvt.NodeBase{constructor(e){super(Mvt.SCALAR);this.value=e}toJSON(e,t){return t?.keep?this.value:Dvt.toJS(this.value,e,t)}toString(){return String(this.value)}}Tw.BLOCK_FOLDED="BLOCK_FOLDED";Tw.BLOCK_LITERAL="BLOCK_LITERAL";Tw.PLAIN="PLAIN";Tw.QUOTE_DOUBLE="QUOTE_DOUBLE";Tw.QUOTE_SINGLE="QUOTE_SINGLE";Nvt.Scalar=Tw;Nvt.isScalarValue=Fvt});var cD=at(function(zvt){var Hvt=aD(),Rw=pn(),h2e=Si(),qvt="tag:yaml.org,2002:";function Bvt(e,t,r){if(t){let n=r.filter((s)=>s.tag===t),o=n.find((s)=>!s.format)??n[0];if(!o)throw Error(`Tag ${t} not found`);return o}return r.find((n)=>n.identify?.(e)&&!n.format)}function Wvt(e,t,r){if(Rw.isDocument(e))e=e.contents;if(Rw.isNode(e))return e;if(Rw.isPair(e)){let f=r.schema[Rw.MAP].createNode?.(r.schema,null,r);return f.items.push(e),f}if(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)e=e.valueOf();let{aliasDuplicateObjects:n,onAnchor:o,onTagObj:s,schema:i,sourceObjects:a}=r,c=void 0;if(n&&e&&typeof e==="object")if(c=a.get(e),c)return c.anchor??(c.anchor=o(e)),new Hvt.Alias(c.anchor);else c={anchor:null,node:null},a.set(e,c);if(t?.startsWith("!!"))t=qvt+t.slice(2);let l=Bvt(e,t,i.tags);if(!l){if(e&&typeof e.toJSON==="function")e=e.toJSON();if(!e||typeof e!=="object"){let f=new h2e.Scalar(e);if(c)c.node=f;return f}l=e instanceof Map?i[Rw.MAP]:(Symbol.iterator in Object(e))?i[Rw.SEQ]:i[Rw.MAP]}if(s)s(l),delete r.onTagObj;let u=l?.createNode?l.createNode(r.schema,e,r):typeof l?.nodeClass?.from==="function"?l.nodeClass.from(r.schema,e,r):new h2e.Scalar(e);if(t)u.tag=t;else if(!l.default)u.tag=l.tag;if(c)c.node=u;return u}zvt.createNode=Wvt});var Qz=at(function(Gvt){var jvt=cD(),Ym=pn(),Vvt=Kz();function nre(e,t,r){let n=r;for(let o=t.length-1;o>=0;--o){let s=t[o];if(typeof s==="number"&&Number.isInteger(s)&&s>=0){let i=[];i[s]=n,n=i}else n=new Map([[s,n]])}return jvt.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var g2e=(e)=>e==null||typeof e==="object"&&!!e[Symbol.iterator]().next().done;class x2e extends Vvt.NodeBase{constructor(e,t){super(e);Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(e)t.schema=e;if(t.items=t.items.map((r)=>Ym.isNode(r)||Ym.isPair(r)?r.clone(e):r),this.range)t.range=this.range.slice();return t}addIn(e,t){if(g2e(e))this.add(t);else{let[r,...n]=e,o=this.get(r,!0);if(Ym.isCollection(o))o.addIn(n,t);else if(o===void 0&&this.schema)this.set(r,nre(this.schema,n,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let n=this.get(t,!0);if(Ym.isCollection(n))return n.deleteIn(r);else throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...n]=e,o=this.get(r,!0);if(n.length===0)return!t&&Ym.isScalar(o)?o.value:o;else return Ym.isCollection(o)?o.getIn(n,t):void 0}hasAllNullValues(e){return this.items.every((t)=>{if(!Ym.isPair(t))return!1;let r=t.value;return r==null||e&&Ym.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let n=this.get(t,!0);return Ym.isCollection(n)?n.hasIn(r):!1}setIn(e,t){let[r,...n]=e;if(n.length===0)this.set(r,t);else{let o=this.get(r,!0);if(Ym.isCollection(o))o.setIn(n,t);else if(o===void 0&&this.schema)this.set(r,nre(this.schema,n,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}}Gvt.Collection=x2e;Gvt.collectionFromPath=nre;Gvt.isEmptyPath=g2e});var lD=at(function(Xvt){var Yvt=(e)=>e.replace(/^(?!$)(?: $)?/gm,"#");function ore(e,t){if(/^\n+$/.test(e))return e.substring(1);return t?e.replace(/^(?! *$)/gm,t):e}var Zvt=(e,t,r)=>e.endsWith(`
|
|
10
|
+
`)?ore(r,t):r.includes(`
|
|
11
|
+
`)?`
|
|
12
|
+
`+ore(r,t):(e.endsWith(" ")?"":" ")+r;Xvt.indentComment=ore;Xvt.lineComment=Zvt;Xvt.stringifyComment=Yvt});var S2e=at(function(oTt){function nTt(e,t,r="flow",{indentAtStart:n,lineWidth:o=80,minContentWidth:s=20,onFold:i,onOverflow:a}={}){if(!o||o<0)return e;if(o<s)s=0;let c=Math.max(1+s,1+o-t.length);if(e.length<=c)return e;let l=[],u={},f=o-t.length;if(typeof n==="number")if(n>o-Math.max(2,s))l.push(0);else f=o-n;let h=void 0,y=void 0,E=!1,b=-1,w=-1,T=-1;if(r==="block"){if(b=y2e(e,b,t.length),b!==-1)f=b+c}for(let k;k=e[b+=1];){if(r==="quoted"&&k==="\\"){switch(w=b,e[b+1]){case"x":b+=3;break;case"u":b+=5;break;case"U":b+=9;break;default:b+=1}T=b}if(k===`
|
|
13
|
+
`){if(r==="block")b=y2e(e,b,t.length);f=b+t.length+c,h=void 0}else{if(k===" "&&y&&y!==" "&&y!==`
|
|
14
|
+
`&&y!=="\t"){let O=e[b+1];if(O&&O!==" "&&O!==`
|
|
15
|
+
`&&O!=="\t")h=b}if(b>=f)if(h)l.push(h),f=h+c,h=void 0;else if(r==="quoted"){while(y===" "||y==="\t")y=k,k=e[b+=1],E=!0;let O=b>T+1?b-2:w-1;if(u[O])return e;l.push(O),u[O]=!0,f=O+c,h=void 0}else E=!0}y=k}if(E&&a)a();if(l.length===0)return e;if(i)i();let A=e.slice(0,l[0]);for(let k=0;k<l.length;++k){let O=l[k],P=l[k+1]||e.length;if(O===0)A=`
|
|
16
|
+
${t}${e.slice(0,P)}`;else{if(r==="quoted"&&u[O])A+=`${e[O]}\\`;A+=`
|
|
17
|
+
${t}${e.slice(O+1,P)}`}}return A}function y2e(e,t,r){let n=t,o=t+1,s=e[o];while(s===" "||s==="\t")if(t<o+r)s=e[++t];else{do s=e[++t];while(s&&s!==`
|
|
18
|
+
`);n=t,o=t+1,s=e[o]}return n}oTt.FOLD_BLOCK="block";oTt.FOLD_FLOW="flow";oTt.FOLD_QUOTED="quoted";oTt.foldFlowLines=nTt});var pD=at(function(fTt){var md=Si(),SE=S2e(),Zz=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Xz=(e)=>/^(%|---|\.\.\.)/m.test(e);function lTt(e,t,r){if(!t||t<0)return!1;let n=t-r,o=e.length;if(o<=n)return!1;for(let s=0,i=0;s<o;++s)if(e[s]===`
|
|
19
|
+
`){if(s-i>n)return!0;if(i=s+1,o-i<=n)return!1}return!0}function uD(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=t,o=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(Xz(e)?" ":""),i="",a=0;for(let c=0,l=r[c];l;l=r[++c]){if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n")i+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\";if(l==="\\")switch(r[c+1]){case"u":{i+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":i+="\\0";break;case"0007":i+="\\a";break;case"000b":i+="\\v";break;case"001b":i+="\\e";break;case"0085":i+="\\N";break;case"00a0":i+="\\_";break;case"2028":i+="\\L";break;case"2029":i+="\\P";break;default:if(u.substr(0,2)==="00")i+="\\x"+u.substr(2);else i+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length<o)c+=1;else{i+=r.slice(a,c)+`
|
|
20
|
+
|
|
21
|
+
`;while(r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"')i+=`
|
|
22
|
+
`,c+=2;if(i+=s,r[c+2]===" ")i+="\\";c+=1,a=c+1}break;default:c+=1}}return i=a?i+r.slice(a):r,n?i:SE.foldFlowLines(i,s,SE.FOLD_QUOTED,Zz(t,!1))}function sre(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
23
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return uD(e,t);let r=t.indent||(Xz(e)?" ":""),n="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
24
|
+
${r}`)+"'";return t.implicitKey?n:SE.foldFlowLines(n,r,SE.FOLD_FLOW,Zz(t,!1))}function e_(e,t){let{singleQuote:r}=t.options,n;if(r===!1)n=uD;else{let o=e.includes('"'),s=e.includes("'");if(o&&!s)n=sre;else if(s&&!o)n=uD;else n=r?sre:uD}return n(e,t)}var ire;try{ire=new RegExp(`(^|(?<!
|
|
25
|
+
))
|
|
26
|
+
+(?!
|
|
27
|
+
|$)`,"g")}catch{ire=/\n+(?!\n|$)/g}function Yz({comment:e,type:t,value:r},n,o,s){let{blockQuote:i,commentString:a,lineWidth:c}=n.options;if(!i||/\n[\t ]+$/.test(r))return e_(r,n);let l=n.indent||(n.forceBlockIndent||Xz(r)?" ":""),u=i==="literal"?!0:i==="folded"||t===md.Scalar.BLOCK_FOLDED?!1:t===md.Scalar.BLOCK_LITERAL?!0:!lTt(r,c,l.length);if(!r)return u?`|
|
|
28
|
+
`:`>
|
|
29
|
+
`;let f,h;for(h=r.length;h>0;--h){let P=r[h-1];if(P!==`
|
|
30
|
+
`&&P!=="\t"&&P!==" ")break}let y=r.substring(h),E=y.indexOf(`
|
|
31
|
+
`);if(E===-1)f="-";else if(r===y||E!==y.length-1){if(f="+",s)s()}else f="";if(y){if(r=r.slice(0,-y.length),y[y.length-1]===`
|
|
32
|
+
`)y=y.slice(0,-1);y=y.replace(ire,`$&${l}`)}let b=!1,w,T=-1;for(w=0;w<r.length;++w){let P=r[w];if(P===" ")b=!0;else if(P===`
|
|
33
|
+
`)T=w;else break}let A=r.substring(0,T<w?T+1:w);if(A)r=r.substring(A.length),A=A.replace(/\n+/g,`$&${l}`);let O=(b?l?"2":"1":"")+f;if(e){if(O+=" "+a(e.replace(/ ?[\r\n]+/g," ")),o)o()}if(!u){let P=r.replace(/\n+/g,`
|
|
34
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),D=!1,I=Zz(n,!0);if(i!=="folded"&&t!==md.Scalar.BLOCK_FOLDED)I.onOverflow=()=>{D=!0};let M=SE.foldFlowLines(`${A}${P}${y}`,l,SE.FOLD_BLOCK,I);if(!D)return`>${O}
|
|
35
|
+
${l}${M}`}return r=r.replace(/\n+/g,`$&${l}`),`|${O}
|
|
36
|
+
${l}${A}${r}${y}`}function uTt(e,t,r,n){let{type:o,value:s}=e,{actualString:i,implicitKey:a,indent:c,indentStep:l,inFlow:u}=t;if(a&&s.includes(`
|
|
37
|
+
`)||u&&/[[\]{},]/.test(s))return e_(s,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||u||!s.includes(`
|
|
38
|
+
`)?e_(s,t):Yz(e,t,r,n);if(!a&&!u&&o!==md.Scalar.PLAIN&&s.includes(`
|
|
39
|
+
`))return Yz(e,t,r,n);if(Xz(s)){if(c==="")return t.forceBlockIndent=!0,Yz(e,t,r,n);else if(a&&c===l)return e_(s,t)}let f=s.replace(/\n+/g,`$&
|
|
40
|
+
${c}`);if(i){let h=(b)=>b.default&&b.tag!=="tag:yaml.org,2002:str"&&b.test?.test(f),{compat:y,tags:E}=t.doc.schema;if(E.some(h)||y?.some(h))return e_(s,t)}return a?f:SE.foldFlowLines(f,c,SE.FOLD_FLOW,Zz(t,!1))}function pTt(e,t,r,n){let{implicitKey:o,inFlow:s}=t,i=typeof e.value==="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;if(a!==md.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(i.value))a=md.Scalar.QUOTE_DOUBLE}let c=(u)=>{switch(u){case md.Scalar.BLOCK_FOLDED:case md.Scalar.BLOCK_LITERAL:return o||s?e_(i.value,t):Yz(i,t,r,n);case md.Scalar.QUOTE_DOUBLE:return uD(i.value,t);case md.Scalar.QUOTE_SINGLE:return sre(i.value,t);case md.Scalar.PLAIN:return uTt(i,t,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:f}=t.options,h=o&&u||f;if(l=c(h),l===null)throw Error(`Unsupported default string type ${h}`)}return l}fTt.stringifyString=pTt});var fD=at(function(bTt){var mTt=Gz(),EE=pn(),hTt=lD(),gTt=pD();function xTt(e,t){let r=Object.assign({blockQuote:!0,commentString:hTt.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},e.schema.toStringOptions,t),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:e,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent==="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function yTt(e,t){if(t.tag){let o=e.filter((s)=>s.tag===t.tag);if(o.length>0)return o.find((s)=>s.format===t.format)??o[0]}let r=void 0,n;if(EE.isScalar(t)){n=t.value;let o=e.filter((s)=>s.identify?.(n));if(o.length>1){let s=o.filter((i)=>i.test);if(s.length>0)o=s}r=o.find((s)=>s.format===t.format)??o.find((s)=>!s.format)}else n=t,r=e.find((o)=>o.nodeClass&&n instanceof o.nodeClass);if(!r){let o=n?.constructor?.name??(n===null?"null":typeof n);throw Error(`Tag not resolved for ${o} value`)}return r}function STt(e,t,{anchors:r,doc:n}){if(!n.directives)return"";let o=[],s=(EE.isScalar(e)||EE.isCollection(e))&&e.anchor;if(s&&mTt.anchorIsValid(s))r.add(s),o.push(`&${s}`);let i=e.tag??(t.default?null:t.tag);if(i)o.push(n.directives.tagString(i));return o.join(" ")}function ETt(e,t,r,n){if(EE.isPair(e))return e.toString(t,r,n);if(EE.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(t.resolvedAliases)t.resolvedAliases.add(e);else t.resolvedAliases=new Set([e]);e=e.resolve(t.doc)}}let o=void 0,s=EE.isNode(e)?e:t.doc.createNode(e,{onTagObj:(c)=>o=c});o??(o=yTt(t.doc.schema.tags,s));let i=STt(s,o,t);if(i.length>0)t.indentAtStart=(t.indentAtStart??0)+i.length+1;let a=typeof o.stringify==="function"?o.stringify(s,t,r,n):EE.isScalar(s)?gTt.stringifyString(s,t,r,n):s.toString(t,r,n);if(!i)return a;return EE.isScalar(s)||a[0]==="{"||a[0]==="["?`${i} ${a}`:`${i}
|
|
41
|
+
${t.indent}${a}`}bTt.createStringifyContext=xTt;bTt.stringify=ETt});var C2e=at(function(ITt){var fx=pn(),E2e=Si(),b2e=fD(),dD=lD();function kTt({key:e,value:t},r,n,o){let{allNullValues:s,doc:i,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:f}}=r,h=fx.isNode(e)&&e.comment||null;if(f){if(h)throw Error("With simple keys, key nodes cannot have comments");if(fx.isCollection(e)||!fx.isNode(e)&&typeof e==="object")throw Error("With simple keys, collection cannot be used as a key value")}let y=!f&&(!e||h&&t==null&&!r.inFlow||fx.isCollection(e)||(fx.isScalar(e)?e.type===E2e.Scalar.BLOCK_FOLDED||e.type===E2e.Scalar.BLOCK_LITERAL:typeof e==="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!y&&(f||!s),indent:a+c});let E=!1,b=!1,w=b2e.stringify(e,r,()=>E=!0,()=>b=!0);if(!y&&!r.inFlow&&w.length>1024){if(f)throw Error("With simple keys, single line scalar must not span more than 1024 characters");y=!0}if(r.inFlow){if(s||t==null){if(E&&n)n();return w===""?"?":y?`? ${w}`:w}}else if(s&&!f||t==null&&y){if(w=`? ${w}`,h&&!E)w+=dD.lineComment(w,r.indent,l(h));else if(b&&o)o();return w}if(E)h=null;if(y){if(h)w+=dD.lineComment(w,r.indent,l(h));w=`? ${w}
|
|
42
|
+
${a}:`}else if(w=`${w}:`,h)w+=dD.lineComment(w,r.indent,l(h));let T,A,k;if(fx.isNode(t))T=!!t.spaceBefore,A=t.commentBefore,k=t.comment;else if(T=!1,A=null,k=null,t&&typeof t==="object")t=i.createNode(t);if(r.implicitKey=!1,!y&&!h&&fx.isScalar(t))r.indentAtStart=w.length+1;if(b=!1,!u&&c.length>=2&&!r.inFlow&&!y&&fx.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor)r.indent=r.indent.substring(2);let O=!1,P=b2e.stringify(t,r,()=>O=!0,()=>b=!0),D=" ";if(h||T||A){if(D=T?`
|
|
43
|
+
`:"",A){let I=l(A);D+=`
|
|
44
|
+
${dD.indentComment(I,r.indent)}`}if(P===""&&!r.inFlow){if(D===`
|
|
45
|
+
`&&k)D=`
|
|
46
|
+
|
|
47
|
+
`}else D+=`
|
|
48
|
+
${r.indent}`}else if(!y&&fx.isCollection(t)){let I=P[0],M=P.indexOf(`
|
|
49
|
+
`),B=M!==-1,ee=r.inFlow??t.flow??t.items.length===0;if(B||!ee){let j=!1;if(B&&(I==="&"||I==="!")){let ae=P.indexOf(" ");if(I==="&"&&ae!==-1&&ae<M&&P[ae+1]==="!")ae=P.indexOf(" ",ae+1);if(ae===-1||M<ae)j=!0}if(!j)D=`
|
|
50
|
+
${r.indent}`}}else if(P===""||P[0]===`
|
|
51
|
+
`)D="";if(w+=D+P,r.inFlow){if(O&&n)n()}else if(k&&!O)w+=dD.lineComment(w,r.indent,l(k));else if(b&&o)o();return w}ITt.stringifyPair=kTt});var are=at(function(vTt){var w2e=Uk("process");function OTt(e,...t){if(e==="debug")console.log(...t)}function _Tt(e,t){if(e==="debug"||e==="warn")if(typeof w2e.emitWarning==="function")w2e.emitWarning(t);else console.warn(t)}vTt.debug=OTt;vTt.warn=_Tt});var n$=at(function(PTt){var r$=pn(),k2e=Si(),e$="<<",t$={identify:(e)=>e===e$||typeof e==="symbol"&&e.description===e$,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new k2e.Scalar(Symbol(e$)),{addToJSMap:I2e}),stringify:()=>e$},MTt=(e,t)=>(t$.identify(t)||r$.isScalar(t)&&(!t.type||t.type===k2e.Scalar.PLAIN)&&t$.identify(t.value))&&e?.doc.schema.tags.some((r)=>r.tag===t$.tag&&r.default);function I2e(e,t,r){let n=A2e(e,r);if(r$.isSeq(n))for(let o of n.items)cre(e,t,o);else if(Array.isArray(n))for(let o of n)cre(e,t,o);else cre(e,t,n)}function cre(e,t,r){let n=A2e(e,r);if(!r$.isMap(n))throw Error("Merge sources must be maps or map aliases");let o=n.toJSON(null,e,Map);for(let[s,i]of o)if(t instanceof Map){if(!t.has(s))t.set(s,i)}else if(t instanceof Set)t.add(s);else if(!Object.prototype.hasOwnProperty.call(t,s))Object.defineProperty(t,s,{value:i,writable:!0,enumerable:!0,configurable:!0});return t}function A2e(e,t){return e&&r$.isAlias(t)?t.resolve(e.doc,e):t}PTt.addMergeToJSMap=I2e;PTt.isMergeKey=MTt;PTt.merge=t$});var ure=at(function(BTt){var LTt=are(),O2e=n$(),UTt=fD(),_2e=pn(),lre=yE();function HTt(e,t,{key:r,value:n}){if(_2e.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,n);else if(O2e.isMergeKey(e,r))O2e.addMergeToJSMap(e,t,n);else{let o=lre.toJS(r,"",e);if(t instanceof Map)t.set(o,lre.toJS(n,o,e));else if(t instanceof Set)t.add(o);else{let s=qTt(r,o,e),i=lre.toJS(n,s,e);if(s in t)Object.defineProperty(t,s,{value:i,writable:!0,enumerable:!0,configurable:!0});else t[s]=i}}return t}function qTt(e,t,r){if(t===null)return"";if(typeof t!=="object")return String(t);if(_2e.isNode(e)&&r?.doc){let n=UTt.createStringifyContext(r.doc,{});n.anchors=new Set;for(let s of r.anchors.keys())n.anchors.add(s.anchor);n.inFlow=!0,n.inStringifyKey=!0;let o=e.toString(n);if(!r.mapKeyWarned){let s=JSON.stringify(o);if(s.length>40)s=s.substring(0,36)+'..."';LTt.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return o}return JSON.stringify(t)}BTt.addPairToJSMap=HTt});var bE=at(function(VTt){var v2e=cD(),zTt=C2e(),$Tt=ure(),o$=pn();function jTt(e,t,r){let n=v2e.createNode(e,void 0,r),o=v2e.createNode(t,void 0,r);return new s$(n,o)}class s${constructor(e,t=null){Object.defineProperty(this,o$.NODE_TYPE,{value:o$.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:r}=this;if(o$.isNode(t))t=t.clone(e);if(o$.isNode(r))r=r.clone(e);return new s$(t,r)}toJSON(e,t){let r=t?.mapAsMap?new Map:{};return $Tt.addPairToJSMap(t,r,this)}toString(e,t,r){return e?.doc?zTt.stringifyPair(this,e,t,r):JSON.stringify(this)}}VTt.Pair=s$;VTt.createPair=jTt});var pre=at(function(ZTt){var Mw=pn(),T2e=fD(),i$=lD();function JTt(e,t,r){return(t.inFlow??e.flow?YTt:QTt)(e,t,r)}function QTt({comment:e,items:t},r,{blockItemPrefix:n,flowChars:o,itemIndent:s,onChompKeep:i,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:s,type:null}),f=!1,h=[];for(let E=0;E<t.length;++E){let b=t[E],w=null;if(Mw.isNode(b)){if(!f&&b.spaceBefore)h.push("");if(a$(r,h,b.commentBefore,f),b.comment)w=b.comment}else if(Mw.isPair(b)){let A=Mw.isNode(b.key)?b.key:null;if(A){if(!f&&A.spaceBefore)h.push("");a$(r,h,A.commentBefore,f)}}f=!1;let T=T2e.stringify(b,u,()=>w=null,()=>f=!0);if(w)T+=i$.lineComment(T,s,l(w));if(f&&w)f=!1;h.push(n+T)}let y;if(h.length===0)y=o.start+o.end;else{y=h[0];for(let E=1;E<h.length;++E){let b=h[E];y+=b?`
|
|
52
|
+
${c}${b}`:`
|
|
53
|
+
`}}if(e){if(y+=`
|
|
54
|
+
`+i$.indentComment(l(e),c),a)a()}else if(f&&i)i();return y}function YTt({items:e},t,{flowChars:r,itemIndent:n}){let{indent:o,indentStep:s,flowCollectionPadding:i,options:{commentString:a}}=t;n+=s;let c=Object.assign({},t,{indent:n,inFlow:!0,type:null}),l=!1,u=0,f=[];for(let E=0;E<e.length;++E){let b=e[E],w=null;if(Mw.isNode(b)){if(b.spaceBefore)f.push("");if(a$(t,f,b.commentBefore,!1),b.comment)w=b.comment}else if(Mw.isPair(b)){let A=Mw.isNode(b.key)?b.key:null;if(A){if(A.spaceBefore)f.push("");if(a$(t,f,A.commentBefore,!1),A.comment)l=!0}let k=Mw.isNode(b.value)?b.value:null;if(k){if(k.comment)w=k.comment;if(k.commentBefore)l=!0}else if(b.value==null&&A?.comment)w=A.comment}if(w)l=!0;let T=T2e.stringify(b,c,()=>w=null);if(l||(l=f.length>u||T.includes(`
|
|
55
|
+
`)),E<e.length-1)T+=",";else if(t.options.trailingComma){if(t.options.lineWidth>0)l||(l=f.reduce((A,k)=>A+k.length+2,2)+(T.length+2)>t.options.lineWidth);if(l)T+=","}if(w)T+=i$.lineComment(T,n,a(w));f.push(T),u=f.length}let{start:h,end:y}=r;if(f.length===0)return h+y;else{if(!l){let E=f.reduce((b,w)=>b+w.length+2,2);l=t.options.lineWidth>0&&E>t.options.lineWidth}if(l){let E=h;for(let b of f)E+=b?`
|
|
56
|
+
${s}${o}${b}`:`
|
|
57
|
+
`;return`${E}
|
|
58
|
+
${o}${y}`}else return`${h}${i}${f.join(" ")}${i}${y}`}}function a$({indent:e,options:{commentString:t}},r,n,o){if(n&&o)n=n.replace(/^\n+/,"");if(n){let s=i$.indentComment(t(n),e);r.push(s.trimStart())}}ZTt.stringifyCollection=JTt});var wE=at(function(o0t){var e0t=pre(),t0t=ure(),r0t=Qz(),CE=pn(),c$=bE(),n0t=Si();function mD(e,t){let r=CE.isScalar(t)?t.value:t;for(let n of e)if(CE.isPair(n)){if(n.key===t||n.key===r)return n;if(CE.isScalar(n.key)&&n.key.value===r)return n}return}class R2e extends r0t.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(CE.MAP,e);this.items=[]}static from(e,t,r){let{keepUndefined:n,replacer:o}=r,s=new this(e),i=(a,c)=>{if(typeof o==="function")c=o.call(t,a,c);else if(Array.isArray(o)&&!o.includes(a))return;if(c!==void 0||n)s.items.push(c$.createPair(a,c,r))};if(t instanceof Map)for(let[a,c]of t)i(a,c);else if(t&&typeof t==="object")for(let a of Object.keys(t))i(a,t[a]);if(typeof e.sortMapEntries==="function")s.items.sort(e.sortMapEntries);return s}add(e,t){let r;if(CE.isPair(e))r=e;else if(!e||typeof e!=="object"||!("key"in e))r=new c$.Pair(e,e?.value);else r=new c$.Pair(e.key,e.value);let n=mD(this.items,r.key),o=this.schema?.sortMapEntries;if(n){if(!t)throw Error(`Key ${r.key} already set`);if(CE.isScalar(n.value)&&n0t.isScalarValue(r.value))n.value.value=r.value;else n.value=r.value}else if(o){let s=this.items.findIndex((i)=>o(r,i)<0);if(s===-1)this.items.push(r);else this.items.splice(s,0,r)}else this.items.push(r)}delete(e){let t=mD(this.items,e);if(!t)return!1;return this.items.splice(this.items.indexOf(t),1).length>0}get(e,t){let n=mD(this.items,e)?.value;return(!t&&CE.isScalar(n)?n.value:n)??void 0}has(e){return!!mD(this.items,e)}set(e,t){this.add(new c$.Pair(e,t),!0)}toJSON(e,t,r){let n=r?new r:t?.mapAsMap?new Map:{};if(t?.onCreate)t.onCreate(n);for(let o of this.items)t0t.addPairToJSMap(t,n,o);return n}toString(e,t,r){if(!e)return JSON.stringify(this);for(let n of this.items)if(!CE.isPair(n))throw Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);if(!e.allNullValues&&this.hasAllNullValues(!1))e=Object.assign({},e,{allNullValues:!0});return e0t.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:t})}}o0t.YAMLMap=R2e;o0t.findPair=mD});var t_=at(function(l0t){var a0t=pn(),M2e=wE(),c0t={collection:"map",default:!0,nodeClass:M2e.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){if(!a0t.isMap(e))t("Expected a mapping for this tag");return e},createNode:(e,t,r)=>M2e.YAMLMap.from(e,t,r)};l0t.map=c0t});var kE=at(function(g0t){var p0t=cD(),f0t=pre(),d0t=Qz(),u$=pn(),m0t=Si(),h0t=yE();class P2e extends d0t.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(u$.SEQ,e);this.items=[]}add(e){this.items.push(e)}delete(e){let t=l$(e);if(typeof t!=="number")return!1;return this.items.splice(t,1).length>0}get(e,t){let r=l$(e);if(typeof r!=="number")return;let n=this.items[r];return!t&&u$.isScalar(n)?n.value:n}has(e){let t=l$(e);return typeof t==="number"&&t<this.items.length}set(e,t){let r=l$(e);if(typeof r!=="number")throw Error(`Expected a valid index, not ${e}.`);let n=this.items[r];if(u$.isScalar(n)&&m0t.isScalarValue(t))n.value=t;else this.items[r]=t}toJSON(e,t){let r=[];if(t?.onCreate)t.onCreate(r);let n=0;for(let o of this.items)r.push(h0t.toJS(o,String(n++),t));return r}toString(e,t,r){if(!e)return JSON.stringify(this);return f0t.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:t})}static from(e,t,r){let{replacer:n}=r,o=new this(e);if(t&&Symbol.iterator in Object(t)){let s=0;for(let i of t){if(typeof n==="function"){let a=t instanceof Set?i:String(s++);i=n.call(t,a,i)}o.items.push(p0t.createNode(i,void 0,r))}}return o}}function l$(e){let t=u$.isScalar(e)?e.value:e;if(t&&typeof t==="string")t=Number(t);return typeof t==="number"&&Number.isInteger(t)&&t>=0?t:null}g0t.YAMLSeq=P2e});var r_=at(function(E0t){var y0t=pn(),D2e=kE(),S0t={collection:"seq",default:!0,nodeClass:D2e.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){if(!y0t.isSeq(e))t("Expected a sequence for this tag");return e},createNode:(e,t,r)=>D2e.YAMLSeq.from(e,t,r)};E0t.seq=S0t});var hD=at(function(k0t){var C0t=pD(),w0t={identify:(e)=>typeof e==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(e)=>e,stringify(e,t,r,n){return t=Object.assign({actualString:!0},t),C0t.stringifyString(e,t,r,n)}};k0t.string=w0t});var p$=at(function(A0t){var F2e=Si(),N2e={identify:(e)=>e==null,createNode:()=>new F2e.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new F2e.Scalar(null),stringify:({source:e},t)=>typeof e==="string"&&N2e.test.test(e)?e:t.options.nullStr};A0t.nullTag=N2e});var fre=at(function(v0t){var _0t=Si(),L2e={identify:(e)=>typeof e==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:(e)=>new _0t.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},r){if(e&&L2e.test.test(e)){let n=e[0]==="t"||e[0]==="T";if(t===n)return e}return t?r.options.trueStr:r.options.falseStr}};v0t.boolTag=L2e});var n_=at(function(M0t){function R0t({format:e,minFractionDigits:t,tag:r,value:n}){if(typeof n==="bigint")return String(n);let o=typeof n==="number"?n:Number(n);if(!isFinite(o))return isNaN(o)?".nan":o<0?"-.inf":".inf";let s=Object.is(n,-0)?"-0":JSON.stringify(n);if(!e&&t&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let i=s.indexOf(".");if(i<0)i=s.length,s+=".";let a=t-(s.length-i-1);while(a-- >0)s+="0"}return s}M0t.stringifyNumber=R0t});var mre=at(function(U0t){var D0t=Si(),dre=n_(),F0t={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(e)=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:dre.stringifyNumber},N0t={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:(e)=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():dre.stringifyNumber(e)}},L0t={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new D0t.Scalar(parseFloat(e)),r=e.indexOf(".");if(r!==-1&&e[e.length-1]==="0")t.minFractionDigits=e.length-r-1;return t},stringify:dre.stringifyNumber};U0t.float=L0t;U0t.floatExp=N0t;U0t.floatNaN=F0t});var gre=at(function(j0t){var U2e=n_(),f$=(e)=>typeof e==="bigint"||Number.isInteger(e),hre=(e,t,r,{intAsBigInt:n})=>n?BigInt(e):parseInt(e.substring(t),r);function H2e(e,t,r){let{value:n}=e;if(f$(n)&&n>=0)return r+n.toString(t);return U2e.stringifyNumber(e)}var W0t={identify:(e)=>f$(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,r)=>hre(e,2,8,r),stringify:(e)=>H2e(e,8,"0o")},z0t={identify:f$,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,r)=>hre(e,0,10,r),stringify:U2e.stringifyNumber},$0t={identify:(e)=>f$(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,r)=>hre(e,2,16,r),stringify:(e)=>H2e(e,16,"0x")};j0t.int=z0t;j0t.intHex=$0t;j0t.intOct=W0t});var q2e=at(function(tRt){var J0t=t_(),Q0t=p$(),Y0t=r_(),Z0t=hD(),X0t=fre(),xre=mre(),yre=gre(),eRt=[J0t.map,Y0t.seq,Z0t.string,Q0t.nullTag,X0t.boolTag,yre.intOct,yre.int,yre.intHex,xre.floatNaN,xre.floatExp,xre.float];tRt.schema=eRt});var W2e=at(function(lRt){var nRt=Si(),oRt=t_(),sRt=r_();function B2e(e){return typeof e==="bigint"||Number.isInteger(e)}var d$=({value:e})=>JSON.stringify(e),iRt=[{identify:(e)=>typeof e==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(e)=>e,stringify:d$},{identify:(e)=>e==null,createNode:()=>new nRt.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:d$},{identify:(e)=>typeof e==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:(e)=>e==="true",stringify:d$},{identify:B2e,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:r})=>r?BigInt(e):parseInt(e,10),stringify:({value:e})=>B2e(e)?e.toString():JSON.stringify(e)},{identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:(e)=>parseFloat(e),stringify:d$}],aRt={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},cRt=[oRt.map,sRt.seq].concat(iRt,aRt);lRt.schema=cRt});var Ere=at(function(dRt){var gD=Uk("buffer"),Sre=Si(),pRt=pD(),fRt={identify:(e)=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof gD.Buffer==="function")return gD.Buffer.from(e,"base64");else if(typeof atob==="function"){let r=atob(e.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let o=0;o<r.length;++o)n[o]=r.charCodeAt(o);return n}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:r},n,o,s){if(!r)return"";let i=r,a;if(typeof gD.Buffer==="function")a=i instanceof gD.Buffer?i.toString("base64"):gD.Buffer.from(i.buffer).toString("base64");else if(typeof btoa==="function"){let c="";for(let l=0;l<i.length;++l)c+=String.fromCharCode(i[l]);a=btoa(c)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Sre.Scalar.BLOCK_LITERAL),t!==Sre.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),l=Math.ceil(a.length/c),u=Array(l);for(let f=0,h=0;f<l;++f,h+=c)u[f]=a.substr(h,c);a=u.join(t===Sre.Scalar.BLOCK_LITERAL?`
|
|
59
|
+
`:" ")}return pRt.stringifyString({comment:e,type:t,value:a},n,o,s)}};dRt.binary=fRt});var h$=at(function(yRt){var m$=pn(),bre=bE(),hRt=Si(),gRt=kE();function z2e(e,t){if(m$.isSeq(e))for(let r=0;r<e.items.length;++r){let n=e.items[r];if(m$.isPair(n))continue;else if(m$.isMap(n)){if(n.items.length>1)t("Each pair must have its own sequence indicator");let o=n.items[0]||new bre.Pair(new hRt.Scalar(null));if(n.commentBefore)o.key.commentBefore=o.key.commentBefore?`${n.commentBefore}
|
|
60
|
+
${o.key.commentBefore}`:n.commentBefore;if(n.comment){let s=o.value??o.key;s.comment=s.comment?`${n.comment}
|
|
61
|
+
${s.comment}`:n.comment}n=o}e.items[r]=m$.isPair(n)?n:new bre.Pair(n)}else t("Expected a sequence for this tag");return e}function $2e(e,t,r){let{replacer:n}=r,o=new gRt.YAMLSeq(e);o.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let i of t){if(typeof n==="function")i=n.call(t,String(s++),i);let a,c;if(Array.isArray(i))if(i.length===2)a=i[0],c=i[1];else throw TypeError(`Expected [key, value] tuple: ${i}`);else if(i&&i instanceof Object){let l=Object.keys(i);if(l.length===1)a=l[0],c=i[a];else throw TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=i;o.items.push(bre.createPair(a,c,r))}return o}var xRt={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:z2e,createNode:$2e};yRt.createPairs=$2e;yRt.pairs=xRt;yRt.resolvePairs=z2e});var wre=at(function(kRt){var j2e=pn(),Cre=yE(),xD=wE(),CRt=kE(),V2e=h$();class Pw extends CRt.YAMLSeq{constructor(){super();this.add=xD.YAMLMap.prototype.add.bind(this),this.delete=xD.YAMLMap.prototype.delete.bind(this),this.get=xD.YAMLMap.prototype.get.bind(this),this.has=xD.YAMLMap.prototype.has.bind(this),this.set=xD.YAMLMap.prototype.set.bind(this),this.tag=Pw.tag}toJSON(e,t){if(!t)return super.toJSON(e);let r=new Map;if(t?.onCreate)t.onCreate(r);for(let n of this.items){let o,s;if(j2e.isPair(n))o=Cre.toJS(n.key,"",t),s=Cre.toJS(n.value,o,t);else o=Cre.toJS(n,"",t);if(r.has(o))throw Error("Ordered maps must not include duplicate keys");r.set(o,s)}return r}static from(e,t,r){let n=V2e.createPairs(e,t,r),o=new this;return o.items=n.items,o}}Pw.tag="tag:yaml.org,2002:omap";var wRt={collection:"seq",identify:(e)=>e instanceof Map,nodeClass:Pw,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let r=V2e.resolvePairs(e,t),n=[];for(let{key:o}of r.items)if(j2e.isScalar(o))if(n.includes(o.value))t(`Ordered maps must not include duplicate keys: ${o.value}`);else n.push(o.value);return Object.assign(new Pw,r)},createNode:(e,t,r)=>Pw.from(e,t,r)};kRt.YAMLOMap=Pw;kRt.omap=wRt});var Y2e=at(function(ORt){var G2e=Si();function K2e({value:e,source:t},r){if(t&&(e?J2e:Q2e).test.test(t))return t;return e?r.options.trueStr:r.options.falseStr}var J2e={identify:(e)=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new G2e.Scalar(!0),stringify:K2e},Q2e={identify:(e)=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new G2e.Scalar(!1),stringify:K2e};ORt.falseTag=Q2e;ORt.trueTag=J2e});var Z2e=at(function(DRt){var TRt=Si(),kre=n_(),RRt={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(e)=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:kre.stringifyNumber},MRt={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(e)=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():kre.stringifyNumber(e)}},PRt={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new TRt.Scalar(parseFloat(e.replace(/_/g,""))),r=e.indexOf(".");if(r!==-1){let n=e.substring(r+1).replace(/_/g,"");if(n[n.length-1]==="0")t.minFractionDigits=n.length}return t},stringify:kre.stringifyNumber};DRt.float=PRt;DRt.floatExp=MRt;DRt.floatNaN=RRt});var eUe=at(function(WRt){var X2e=n_(),yD=(e)=>typeof e==="bigint"||Number.isInteger(e);function g$(e,t,r,{intAsBigInt:n}){let o=e[0];if(o==="-"||o==="+")t+=1;if(e=e.substring(t).replace(/_/g,""),n){switch(r){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let i=BigInt(e);return o==="-"?BigInt(-1)*i:i}let s=parseInt(e,r);return o==="-"?-1*s:s}function Ire(e,t,r){let{value:n}=e;if(yD(n)){let o=n.toString(t);return n<0?"-"+r+o.substr(1):r+o}return X2e.stringifyNumber(e)}var URt={identify:yD,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,r)=>g$(e,2,2,r),stringify:(e)=>Ire(e,2,"0b")},HRt={identify:yD,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,r)=>g$(e,1,8,r),stringify:(e)=>Ire(e,8,"0")},qRt={identify:yD,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,r)=>g$(e,0,10,r),stringify:X2e.stringifyNumber},BRt={identify:yD,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,r)=>g$(e,2,16,r),stringify:(e)=>Ire(e,16,"0x")};WRt.int=qRt;WRt.intBin=URt;WRt.intHex=BRt;WRt.intOct=HRt});var Are=at(function(KRt){var S$=pn(),x$=bE(),y$=wE();class Dw extends y$.YAMLMap{constructor(e){super(e);this.tag=Dw.tag}add(e){let t;if(S$.isPair(e))t=e;else if(e&&typeof e==="object"&&"key"in e&&"value"in e&&e.value===null)t=new x$.Pair(e.key,null);else t=new x$.Pair(e,null);if(!y$.findPair(this.items,t.key))this.items.push(t)}get(e,t){let r=y$.findPair(this.items,e);return!t&&S$.isPair(r)?S$.isScalar(r.key)?r.key.value:r.key:r}set(e,t){if(typeof t!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let r=y$.findPair(this.items,e);if(r&&!t)this.items.splice(this.items.indexOf(r),1);else if(!r&&t)this.items.push(new x$.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,r);else throw Error("Set items must all have null values")}static from(e,t,r){let{replacer:n}=r,o=new this(e);if(t&&Symbol.iterator in Object(t))for(let s of t){if(typeof n==="function")s=n.call(t,s,s);o.items.push(x$.createPair(s,null,r))}return o}}Dw.tag="tag:yaml.org,2002:set";var GRt={collection:"map",identify:(e)=>e instanceof Set,nodeClass:Dw,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,r)=>Dw.from(e,t,r),resolve(e,t){if(S$.isMap(e))if(e.hasAllNullValues(!0))return Object.assign(new Dw,e);else t("Set items must all have null values");else t("Expected a mapping for this tag");return e}};KRt.YAMLSet=Dw;KRt.set=GRt});var _re=at(function(eMt){var YRt=n_();function Ore(e,t){let r=e[0],n=r==="-"||r==="+"?e.substring(1):e,o=(i)=>t?BigInt(i):Number(i),s=n.replace(/_/g,"").split(":").reduce((i,a)=>i*o(60)+o(a),o(0));return r==="-"?o(-1)*s:s}function tUe(e){let{value:t}=e,r=(i)=>i;if(typeof t==="bigint")r=(i)=>BigInt(i);else if(isNaN(t)||!isFinite(t))return YRt.stringifyNumber(e);let n="";if(t<0)n="-",t*=r(-1);let o=r(60),s=[t%o];if(t<60)s.unshift(0);else if(t=(t-s[0])/o,s.unshift(t%o),t>=60)t=(t-s[0])/o,s.unshift(t);return n+s.map((i)=>String(i).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var ZRt={identify:(e)=>typeof e==="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:r})=>Ore(e,r),stringify:tUe},XRt={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(e)=>Ore(e,!1),stringify:tUe},rUe={identify:(e)=>e 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(e){let t=e.match(rUe.test);if(!t)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,o,s,i,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,o,s||0,i||0,a||0,c),u=t[8];if(u&&u!=="Z"){let f=Ore(u,!1);if(Math.abs(f)<30)f*=60;l-=60000*f}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};eMt.floatTime=XRt;eMt.intTime=ZRt;eMt.timestamp=rUe});var oUe=at(function(mMt){var oMt=t_(),sMt=p$(),iMt=r_(),aMt=hD(),cMt=Ere(),nUe=Y2e(),vre=Z2e(),E$=eUe(),lMt=n$(),uMt=wre(),pMt=h$(),fMt=Are(),Tre=_re(),dMt=[oMt.map,iMt.seq,aMt.string,sMt.nullTag,nUe.trueTag,nUe.falseTag,E$.intBin,E$.intOct,E$.int,E$.intHex,vre.floatNaN,vre.floatExp,vre.float,cMt.binary,lMt.merge,uMt.omap,pMt.pairs,fMt.set,Tre.intTime,Tre.floatTime,Tre.timestamp];mMt.schema=dMt});var mUe=at(function(wMt){var cUe=t_(),gMt=p$(),lUe=r_(),xMt=hD(),yMt=fre(),Rre=mre(),Mre=gre(),SMt=q2e(),EMt=W2e(),uUe=Ere(),SD=n$(),pUe=wre(),fUe=h$(),sUe=oUe(),dUe=Are(),b$=_re(),iUe=new Map([["core",SMt.schema],["failsafe",[cUe.map,lUe.seq,xMt.string]],["json",EMt.schema],["yaml11",sUe.schema],["yaml-1.1",sUe.schema]]),aUe={binary:uUe.binary,bool:yMt.boolTag,float:Rre.float,floatExp:Rre.floatExp,floatNaN:Rre.floatNaN,floatTime:b$.floatTime,int:Mre.int,intHex:Mre.intHex,intOct:Mre.intOct,intTime:b$.intTime,map:cUe.map,merge:SD.merge,null:gMt.nullTag,omap:pUe.omap,pairs:fUe.pairs,seq:lUe.seq,set:dUe.set,timestamp:b$.timestamp},bMt={"tag:yaml.org,2002:binary":uUe.binary,"tag:yaml.org,2002:merge":SD.merge,"tag:yaml.org,2002:omap":pUe.omap,"tag:yaml.org,2002:pairs":fUe.pairs,"tag:yaml.org,2002:set":dUe.set,"tag:yaml.org,2002:timestamp":b$.timestamp};function CMt(e,t,r){let n=iUe.get(t);if(n&&!e)return r&&!n.includes(SD.merge)?n.concat(SD.merge):n.slice();let o=n;if(!o)if(Array.isArray(e))o=[];else{let s=Array.from(iUe.keys()).filter((i)=>i!=="yaml11").map((i)=>JSON.stringify(i)).join(", ");throw Error(`Unknown schema "${t}"; use one of ${s} or define customTags array`)}if(Array.isArray(e))for(let s of e)o=o.concat(s);else if(typeof e==="function")o=e(o.slice());if(r)o=o.concat(SD.merge);return o.reduce((s,i)=>{let a=typeof i==="string"?aUe[i]:i;if(!a){let c=JSON.stringify(i),l=Object.keys(aUe).map((u)=>JSON.stringify(u)).join(", ");throw Error(`Unknown custom tag ${c}; use one of ${l}`)}if(!s.includes(a))s.push(a);return s},[])}wMt.coreKnownTags=bMt;wMt.getTags=CMt});var Fre=at(function(TMt){var Pre=pn(),AMt=t_(),OMt=r_(),_Mt=hD(),C$=mUe(),vMt=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0;class Dre{constructor({compat:e,customTags:t,merge:r,resolveKnownTags:n,schema:o,sortMapEntries:s,toStringDefaults:i}){this.compat=Array.isArray(e)?C$.getTags(e,"compat"):e?C$.getTags(null,e):null,this.name=typeof o==="string"&&o||"core",this.knownTags=n?C$.coreKnownTags:{},this.tags=C$.getTags(t,this.name,r),this.toStringOptions=i??null,Object.defineProperty(this,Pre.MAP,{value:AMt.map}),Object.defineProperty(this,Pre.SCALAR,{value:_Mt.string}),Object.defineProperty(this,Pre.SEQ,{value:OMt.seq}),this.sortMapEntries=typeof s==="function"?s:s===!0?vMt:null}clone(){let e=Object.create(Dre.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}TMt.Schema=Dre});var hUe=at(function(DMt){var MMt=pn(),Nre=fD(),ED=lD();function PMt(e,t){let r=[],n=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);if(c)r.push(c),n=!0;else if(e.directives.docStart)n=!0}if(n)r.push("---");let o=Nre.createStringifyContext(e,t),{commentString:s}=o.options;if(e.commentBefore){if(r.length!==1)r.unshift("");let c=s(e.commentBefore);r.unshift(ED.indentComment(c,""))}let i=!1,a=null;if(e.contents){if(MMt.isNode(e.contents)){if(e.contents.spaceBefore&&n)r.push("");if(e.contents.commentBefore){let u=s(e.contents.commentBefore);r.push(ED.indentComment(u,""))}o.forceBlockIndent=!!e.comment,a=e.contents.comment}let c=a?void 0:()=>i=!0,l=Nre.stringify(e.contents,o,()=>a=null,c);if(a)l+=ED.lineComment(l,"",s(a));if((l[0]==="|"||l[0]===">")&&r[r.length-1]==="---")r[r.length-1]=`--- ${l}`;else r.push(l)}else r.push(Nre.stringify(e.contents,o));if(e.directives?.docEnd)if(e.comment){let c=s(e.comment);if(c.includes(`
|
|
62
|
+
`))r.push("..."),r.push(ED.indentComment(c,""));else r.push(`... ${c}`)}else r.push("...");else{let c=e.comment;if(c&&i)c=c.replace(/^\n+/,"");if(c){if((!i||a)&&r[r.length-1]!=="")r.push("");r.push(ED.indentComment(s(c),""))}}return r.join(`
|
|
63
|
+
`)+`
|
|
64
|
+
`}DMt.stringifyDocument=PMt});var bD=at(function(zMt){var NMt=aD(),o_=Qz(),jp=pn(),LMt=bE(),UMt=yE(),HMt=Fre(),qMt=hUe(),Lre=Gz(),BMt=rre(),WMt=cD(),Ure=tre();class Hre{constructor(e,t,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,jp.NODE_TYPE,{value:jp.DOC});let n=null;if(typeof t==="function"||Array.isArray(t))n=t;else if(r===void 0&&t)r=t,t=void 0;let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=o;let{version:s}=o;if(r?._directives){if(this.directives=r._directives.atDocument(),this.directives.yaml.explicit)s=this.directives.yaml.version}else this.directives=new Ure.Directives({version:s});this.setSchema(s,r),this.contents=e===void 0?null:this.createNode(e,n,r)}clone(){let e=Object.create(Hre.prototype,{[jp.NODE_TYPE]:{value:jp.DOC}});if(e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives)e.directives=this.directives.clone();if(e.schema=this.schema.clone(),e.contents=jp.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range)e.range=this.range.slice();return e}add(e){if(s_(this.contents))this.contents.add(e)}addIn(e,t){if(s_(this.contents))this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let r=Lre.anchorNames(this);e.anchor=!t||r.has(t)?Lre.findNewAnchor(t||"a",r):t}return new NMt.Alias(e.anchor)}createNode(e,t,r){let n=void 0;if(typeof t==="function")e=t.call({"":e},"",e),n=t;else if(Array.isArray(t)){let b=(T)=>typeof T==="number"||T instanceof String||T instanceof Number,w=t.filter(b).map(String);if(w.length>0)t=t.concat(w);n=t}else if(r===void 0&&t)r=t,t=void 0;let{aliasDuplicateObjects:o,anchorPrefix:s,flow:i,keepUndefined:a,onTagObj:c,tag:l}=r??{},{onAnchor:u,setAnchors:f,sourceObjects:h}=Lre.createNodeAnchors(this,s||"a"),y={aliasDuplicateObjects:o??!0,keepUndefined:a??!1,onAnchor:u,onTagObj:c,replacer:n,schema:this.schema,sourceObjects:h},E=WMt.createNode(e,l,y);if(i&&jp.isCollection(E))E.flow=!0;return f(),E}createPair(e,t,r={}){let n=this.createNode(e,null,r),o=this.createNode(t,null,r);return new LMt.Pair(n,o)}delete(e){return s_(this.contents)?this.contents.delete(e):!1}deleteIn(e){if(o_.isEmptyPath(e)){if(this.contents==null)return!1;return this.contents=null,!0}return s_(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return jp.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){if(o_.isEmptyPath(e))return!t&&jp.isScalar(this.contents)?this.contents.value:this.contents;return jp.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return jp.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){if(o_.isEmptyPath(e))return this.contents!==void 0;return jp.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){if(this.contents==null)this.contents=o_.collectionFromPath(this.schema,[e],t);else if(s_(this.contents))this.contents.set(e,t)}setIn(e,t){if(o_.isEmptyPath(e))this.contents=t;else if(this.contents==null)this.contents=o_.collectionFromPath(this.schema,Array.from(e),t);else if(s_(this.contents))this.contents.setIn(e,t)}setSchema(e,t={}){if(typeof e==="number")e=String(e);let r;switch(e){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new Ure.Directives({version:"1.1"});r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=e;else this.directives=new Ure.Directives({version:e});r={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;r=null;break;default:{let n=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(r)this.schema=new HMt.Schema(Object.assign(r,t));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:r,maxAliasCount:n,onAnchor:o,reviver:s}={}){let i={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n==="number"?n:100},a=UMt.toJS(this.contents,t??"",i);if(typeof o==="function")for(let{count:c,res:l}of i.anchors.values())o(l,c);return typeof s==="function"?BMt.applyReviver(s,{"":a},"",a):a}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return qMt.stringifyDocument(this,e)}}function s_(e){if(jp.isCollection(e))return!0;throw Error("Expected a YAML collection as document contents")}zMt.Document=Hre});var CD=at(function(VMt){class w$ extends Error{constructor(e,t,r,n){super();this.name=e,this.code=r,this.message=n,this.pos=t}}class gUe extends w${constructor(e,t,r){super("YAMLParseError",e,t,r)}}class xUe extends w${constructor(e,t,r){super("YAMLWarning",e,t,r)}}var jMt=(e,t)=>(r)=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map((a)=>t.linePos(a));let{line:n,col:o}=r.linePos[0];r.message+=` at line ${n}, column ${o}`;let s=o-1,i=e.substring(t.lineStarts[n-1],t.lineStarts[n]).replace(/[\n\r]+$/,"");if(s>=60&&i.length>80){let a=Math.min(s-39,i.length-79);i="…"+i.substring(a),s-=a-1}if(i.length>80)i=i.substring(0,79)+"…";if(n>1&&/^ *$/.test(i.substring(0,s))){let a=e.substring(t.lineStarts[n-2],t.lineStarts[n-1]);if(a.length>80)a=a.substring(0,79)+`…
|
|
65
|
+
`;i=a+i}if(/[^ ]/.test(i)){let a=1,c=r.linePos[1];if(c?.line===n&&c.col>o)a=Math.max(1,Math.min(c.col-o,80-s));let l=" ".repeat(s)+"^".repeat(a);r.message+=`:
|
|
66
|
+
|
|
67
|
+
${i}
|
|
68
|
+
${l}
|
|
69
|
+
`}};VMt.YAMLError=w$;VMt.YAMLParseError=gUe;VMt.YAMLWarning=xUe;VMt.prettifyError=jMt});var wD=at(function(ZMt){function YMt(e,{flow:t,indicator:r,next:n,offset:o,onError:s,parentIndent:i,startOnNewline:a}){let c=!1,l=a,u=a,f="",h="",y=!1,E=!1,b=null,w=null,T=null,A=null,k=null,O=null,P=null;for(let M of e){if(E){if(M.type!=="space"&&M.type!=="newline"&&M.type!=="comma")s(M.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");E=!1}if(b){if(l&&M.type!=="comment"&&M.type!=="newline")s(b,"TAB_AS_INDENT","Tabs are not allowed as indentation");b=null}switch(M.type){case"space":if(!t&&(r!=="doc-start"||n?.type!=="flow-collection")&&M.source.includes("\t"))b=M;u=!0;break;case"comment":{if(!u)s(M,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let B=M.source.substring(1)||" ";if(!f)f=B;else f+=h+B;h="",l=!1;break}case"newline":if(l){if(f)f+=M.source;else if(!O||r!=="seq-item-ind")c=!0}else h+=M.source;if(l=!0,y=!0,w||T)A=M;u=!0;break;case"anchor":if(w)s(M,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(M.source.endsWith(":"))s(M.offset+M.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);w=M,P??(P=M.offset),l=!1,u=!1,E=!0;break;case"tag":{if(T)s(M,"MULTIPLE_TAGS","A node can have at most one tag");T=M,P??(P=M.offset),l=!1,u=!1,E=!0;break}case r:if(w||T)s(M,"BAD_PROP_ORDER",`Anchors and tags must be after the ${M.source} indicator`);if(O)s(M,"UNEXPECTED_TOKEN",`Unexpected ${M.source} in ${t??"collection"}`);O=M,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(t){if(k)s(M,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`);k=M,l=!1,u=!1;break}default:s(M,"UNEXPECTED_TOKEN",`Unexpected ${M.type} token`),l=!1,u=!1}}let D=e[e.length-1],I=D?D.offset+D.source.length:o;if(E&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!==""))s(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(b&&(l&&b.indent<=i||n?.type==="block-map"||n?.type==="block-seq"))s(b,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:k,found:O,spaceBefore:c,comment:f,hasNewline:y,anchor:w,tag:T,newlineAfterProp:A,end:I,start:P??I}}ZMt.resolveProps=YMt});var k$=at(function(ePt){function qre(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
|
70
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let r of t.start)if(r.type==="newline")return!0;if(t.sep){for(let r of t.sep)if(r.type==="newline")return!0}if(qre(t.key)||qre(t.value))return!0}return!1;default:return!0}}ePt.containsNewline=qre});var Bre=at(function(oPt){var rPt=k$();function nPt(e,t,r){if(t?.type==="flow-collection"){let n=t.end[0];if(n.indent===e&&(n.source==="]"||n.source==="}")&&rPt.containsNewline(t))r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}oPt.flowIndentCheck=nPt});var Wre=at(function(aPt){var yUe=pn();function iPt(e,t,r){let{uniqueKeys:n}=e.options;if(n===!1)return!1;let o=typeof n==="function"?n:(s,i)=>s===i||yUe.isScalar(s)&&yUe.isScalar(i)&&s.value===i.value;return t.some((s)=>o(s.key,r))}aPt.mapIncludes=iPt});var wUe=at(function(dPt){var SUe=bE(),lPt=wE(),EUe=wD(),uPt=k$(),bUe=Bre(),pPt=Wre(),CUe="All mapping items must start at the same column";function fPt({composeNode:e,composeEmptyNode:t},r,n,o,s){let a=new(s?.nodeClass??lPt.YAMLMap)(r.schema);if(r.atRoot)r.atRoot=!1;let c=n.offset,l=null;for(let u of n.items){let{start:f,key:h,sep:y,value:E}=u,b=EUe.resolveProps(f,{indicator:"explicit-key-ind",next:h??y?.[0],offset:c,onError:o,parentIndent:n.indent,startOnNewline:!0}),w=!b.found;if(w){if(h){if(h.type==="block-seq")o(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in h&&h.indent!==n.indent)o(c,"BAD_INDENT",CUe)}if(!b.anchor&&!b.tag&&!y){if(l=b.end,b.comment)if(a.comment)a.comment+=`
|
|
71
|
+
`+b.comment;else a.comment=b.comment;continue}if(b.newlineAfterProp||uPt.containsNewline(h))o(h??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(b.found?.indent!==n.indent)o(c,"BAD_INDENT",CUe);r.atKey=!0;let T=b.end,A=h?e(r,h,b,o):t(r,T,f,null,b,o);if(r.schema.compat)bUe.flowIndentCheck(n.indent,h,o);if(r.atKey=!1,pPt.mapIncludes(r,a.items,A))o(T,"DUPLICATE_KEY","Map keys must be unique");let k=EUe.resolveProps(y??[],{indicator:"map-value-ind",next:E,offset:A.range[2],onError:o,parentIndent:n.indent,startOnNewline:!h||h.type==="block-scalar"});if(c=k.end,k.found){if(w){if(E?.type==="block-map"&&!k.hasNewline)o(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(r.options.strict&&b.start<k.found.offset-1024)o(A.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let O=E?e(r,E,k,o):t(r,c,y,null,k,o);if(r.schema.compat)bUe.flowIndentCheck(n.indent,E,o);c=O.range[2];let P=new SUe.Pair(A,O);if(r.options.keepSourceTokens)P.srcToken=u;a.items.push(P)}else{if(w)o(A.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(k.comment)if(A.comment)A.comment+=`
|
|
72
|
+
`+k.comment;else A.comment=k.comment;let O=new SUe.Pair(A);if(r.options.keepSourceTokens)O.srcToken=u;a.items.push(O)}}if(l&&l<c)o(l,"IMPOSSIBLE","Map comment with trailing content");return a.range=[n.offset,c,l??c],a}dPt.resolveBlockMap=fPt});var kUe=at(function(SPt){var hPt=kE(),gPt=wD(),xPt=Bre();function yPt({composeNode:e,composeEmptyNode:t},r,n,o,s){let a=new(s?.nodeClass??hPt.YAMLSeq)(r.schema);if(r.atRoot)r.atRoot=!1;if(r.atKey)r.atKey=!1;let c=n.offset,l=null;for(let{start:u,value:f}of n.items){let h=gPt.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:c,onError:o,parentIndent:n.indent,startOnNewline:!0});if(!h.found)if(h.anchor||h.tag||f)if(f?.type==="block-seq")o(h.end,"BAD_INDENT","All sequence items must start at the same column");else o(c,"MISSING_CHAR","Sequence item without - indicator");else{if(l=h.end,h.comment)a.comment=h.comment;continue}let y=f?e(r,f,h,o):t(r,h.end,u,null,h,o);if(r.schema.compat)xPt.flowIndentCheck(n.indent,f,o);c=y.range[2],a.items.push(y)}return a.range=[n.offset,c,l??c],a}SPt.resolveBlockSeq=yPt});var i_=at(function(CPt){function bPt(e,t,r,n){let o="";if(e){let s=!1,i="";for(let a of e){let{source:c,type:l}=a;switch(l){case"space":s=!0;break;case"comment":{if(r&&!s)n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";if(!o)o=u;else o+=i+u;i="";break}case"newline":if(o)i+=c;s=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:o,offset:t}}CPt.resolveEnd=bPt});var OUe=at(function(RPt){var kPt=pn(),IPt=bE(),IUe=wE(),APt=kE(),OPt=i_(),AUe=wD(),_Pt=k$(),vPt=Wre(),zre="Block collections are not allowed within flow collections",$re=(e)=>e&&(e.type==="block-map"||e.type==="block-seq");function TPt({composeNode:e,composeEmptyNode:t},r,n,o,s){let i=n.start.source==="{",a=i?"flow map":"flow sequence",l=new(s?.nodeClass??(i?IUe.YAMLMap:APt.YAMLSeq))(r.schema);l.flow=!0;let u=r.atRoot;if(u)r.atRoot=!1;if(r.atKey)r.atKey=!1;let f=n.offset+n.start.source.length;for(let w=0;w<n.items.length;++w){let T=n.items[w],{start:A,key:k,sep:O,value:P}=T,D=AUe.resolveProps(A,{flow:a,indicator:"explicit-key-ind",next:k??O?.[0],offset:f,onError:o,parentIndent:n.indent,startOnNewline:!1});if(!D.found){if(!D.anchor&&!D.tag&&!O&&!P){if(w===0&&D.comma)o(D.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(w<n.items.length-1)o(D.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`);if(D.comment)if(l.comment)l.comment+=`
|
|
73
|
+
`+D.comment;else l.comment=D.comment;f=D.end;continue}if(!i&&r.options.strict&&_Pt.containsNewline(k))o(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(w===0){if(D.comma)o(D.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`)}else{if(!D.comma)o(D.start,"MISSING_CHAR",`Missing , between ${a} items`);if(D.comment){let I="";e:for(let M of A)switch(M.type){case"comma":case"space":break;case"comment":I=M.source.substring(1);break e;default:break e}if(I){let M=l.items[l.items.length-1];if(kPt.isPair(M))M=M.value??M.key;if(M.comment)M.comment+=`
|
|
74
|
+
`+I;else M.comment=I;D.comment=D.comment.substring(I.length+1)}}}if(!i&&!O&&!D.found){let I=P?e(r,P,D,o):t(r,D.end,O,null,D,o);if(l.items.push(I),f=I.range[2],$re(P))o(I.range,"BLOCK_IN_FLOW",zre)}else{r.atKey=!0;let I=D.end,M=k?e(r,k,D,o):t(r,I,A,null,D,o);if($re(k))o(M.range,"BLOCK_IN_FLOW",zre);r.atKey=!1;let B=AUe.resolveProps(O??[],{flow:a,indicator:"map-value-ind",next:P,offset:M.range[2],onError:o,parentIndent:n.indent,startOnNewline:!1});if(B.found){if(!i&&!D.found&&r.options.strict){if(O)for(let ae of O){if(ae===B.found)break;if(ae.type==="newline"){o(ae,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(D.start<B.found.offset-1024)o(B.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(P)if("source"in P&&P.source?.[0]===":")o(P,"MISSING_CHAR",`Missing space after : in ${a}`);else o(B.start,"MISSING_CHAR",`Missing , or : between ${a} items`);let ee=P?e(r,P,B,o):B.found?t(r,B.end,O,null,B,o):null;if(ee){if($re(P))o(ee.range,"BLOCK_IN_FLOW",zre)}else if(B.comment)if(M.comment)M.comment+=`
|
|
75
|
+
`+B.comment;else M.comment=B.comment;let j=new IPt.Pair(M,ee);if(r.options.keepSourceTokens)j.srcToken=T;if(i){let ae=l;if(vPt.mapIncludes(r,ae.items,M))o(I,"DUPLICATE_KEY","Map keys must be unique");ae.items.push(j)}else{let ae=new IUe.YAMLMap(r.schema);ae.flow=!0,ae.items.push(j);let F=(ee??M).range;ae.range=[M.range[0],F[1],F[2]],l.items.push(ae)}f=ee?ee.range[2]:B.end}}let h=i?"}":"]",[y,...E]=n.end,b=f;if(y?.source===h)b=y.offset+y.source.length;else{let w=a[0].toUpperCase()+a.substring(1),T=u?`${w} must end with a ${h}`:`${w} in block collection must be sufficiently indented and end with a ${h}`;if(o(f,u?"MISSING_CHAR":"BAD_INDENT",T),y&&y.source.length!==1)E.unshift(y)}if(E.length>0){let w=OPt.resolveEnd(E,b,r.options.strict,o);if(w.comment)if(l.comment)l.comment+=`
|
|
76
|
+
`+w.comment;else l.comment=w.comment;l.range=[n.offset,b,w.offset]}else l.range=[n.offset,b,b];return l}RPt.resolveFlowCollection=TPt});var _Ue=at(function(BPt){var PPt=pn(),DPt=Si(),FPt=wE(),NPt=kE(),LPt=wUe(),UPt=kUe(),HPt=OUe();function jre(e,t,r,n,o,s){let i=r.type==="block-map"?LPt.resolveBlockMap(e,t,r,n,s):r.type==="block-seq"?UPt.resolveBlockSeq(e,t,r,n,s):HPt.resolveFlowCollection(e,t,r,n,s),a=i.constructor;if(o==="!"||o===a.tagName)return i.tag=a.tagName,i;if(o)i.tag=o;return i}function qPt(e,t,r,n,o){let s=n.tag,i=!s?null:t.directives.tagName(s.source,(h)=>o(s,"TAG_RESOLVE_FAILED",h));if(r.type==="block-seq"){let{anchor:h,newlineAfterProp:y}=n,E=h&&s?h.offset>s.offset?h:s:h??s;if(E&&(!y||y.offset<E.offset))o(E,"MISSING_CHAR","Missing newline after block sequence props")}let a=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!s||!i||i==="!"||i===FPt.YAMLMap.tagName&&a==="map"||i===NPt.YAMLSeq.tagName&&a==="seq")return jre(e,t,r,o,i);let c=t.schema.tags.find((h)=>h.tag===i&&h.collection===a);if(!c){let h=t.schema.knownTags[i];if(h?.collection===a)t.schema.tags.push(Object.assign({},h,{default:!1})),c=h;else{if(h)o(s,"BAD_COLLECTION_TYPE",`${h.tag} used for ${a} collection, but expects ${h.collection??"scalar"}`,!0);else o(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,!0);return jre(e,t,r,o,i)}}let l=jre(e,t,r,o,i,c),u=c.resolve?.(l,(h)=>o(s,"TAG_RESOLVE_FAILED",h),t.options)??l,f=PPt.isNode(u)?u:new DPt.Scalar(u);if(f.range=l.range,f.tag=i,c?.format)f.format=c.format;return f}BPt.composeCollection=qPt});var Gre=at(function(VPt){var Vre=Si();function zPt(e,t,r){let n=t.offset,o=$Pt(t,e.options.strict,r);if(!o)return{value:"",type:null,comment:"",range:[n,n,n]};let s=o.mode===">"?Vre.Scalar.BLOCK_FOLDED:Vre.Scalar.BLOCK_LITERAL,i=t.source?jPt(t.source):[],a=i.length;for(let b=i.length-1;b>=0;--b){let w=i[b][1];if(w===""||w==="\r")a=b;else break}if(a===0){let b=o.chomp==="+"&&i.length>0?`
|
|
77
|
+
`.repeat(Math.max(1,i.length-1)):"",w=n+o.length;if(t.source)w+=t.source.length;return{value:b,type:s,comment:o.comment,range:[n,w,w]}}let c=t.indent+o.indent,l=t.offset+o.length,u=0;for(let b=0;b<a;++b){let[w,T]=i[b];if(T===""||T==="\r"){if(o.indent===0&&w.length>c)c=w.length}else{if(w.length<c)r(l+w.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(o.indent===0)c=w.length;if(u=b,c===0&&!e.atRoot)r(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=w.length+T.length+1}for(let b=i.length-1;b>=a;--b)if(i[b][0].length>c)a=b+1;let f="",h="",y=!1;for(let b=0;b<u;++b)f+=i[b][0].slice(c)+`
|
|
78
|
+
`;for(let b=u;b<a;++b){let[w,T]=i[b];l+=w.length+T.length+1;let A=T[T.length-1]==="\r";if(A)T=T.slice(0,-1);if(T&&w.length<c){let O=`Block scalar lines must not be less indented than their ${o.indent?"explicit indentation indicator":"first line"}`;r(l-T.length-(A?2:1),"BAD_INDENT",O),w=""}if(s===Vre.Scalar.BLOCK_LITERAL)f+=h+w.slice(c)+T,h=`
|
|
79
|
+
`;else if(w.length>c||T[0]==="\t"){if(h===" ")h=`
|
|
80
|
+
`;else if(!y&&h===`
|
|
81
|
+
`)h=`
|
|
82
|
+
|
|
83
|
+
`;f+=h+w.slice(c)+T,h=`
|
|
84
|
+
`,y=!0}else if(T==="")if(h===`
|
|
85
|
+
`)f+=`
|
|
86
|
+
`;else h=`
|
|
87
|
+
`;else f+=h+T,h=" ",y=!1}switch(o.chomp){case"-":break;case"+":for(let b=a;b<i.length;++b)f+=`
|
|
88
|
+
`+i[b][0].slice(c);if(f[f.length-1]!==`
|
|
89
|
+
`)f+=`
|
|
90
|
+
`;break;default:f+=`
|
|
91
|
+
`}let E=n+o.length+t.source.length;return{value:f,type:s,comment:o.comment,range:[n,E,E]}}function $Pt({offset:e,props:t},r,n){if(t[0].type!=="block-scalar-header")return n(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:o}=t[0],s=o[0],i=0,a="",c=-1;for(let h=1;h<o.length;++h){let y=o[h];if(!a&&(y==="-"||y==="+"))a=y;else{let E=Number(y);if(!i&&E)i=E;else if(c===-1)c=e+h}}if(c!==-1)n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${o}`);let l=!1,u="",f=o.length;for(let h=1;h<t.length;++h){let y=t[h];switch(y.type){case"space":l=!0;case"newline":f+=y.source.length;break;case"comment":if(r&&!l)n(y,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");f+=y.source.length,u=y.source.substring(1);break;case"error":n(y,"UNEXPECTED_TOKEN",y.message),f+=y.source.length;break;default:{let E=`Unexpected token in block scalar header: ${y.type}`;n(y,"UNEXPECTED_TOKEN",E);let b=y.source;if(b&&typeof b==="string")f+=b.length}}}return{mode:s,indent:i,chomp:a,comment:u,length:f}}function jPt(e){let t=e.split(/\n( *)/),r=t[0],n=r.match(/^( *)/),s=[n?.[1]?[n[1],r.slice(n[1].length)]:["",r]];for(let i=1;i<t.length;i+=2)s.push([t[i],t[i+1]]);return s}VPt.resolveBlockScalar=zPt});var Jre=at(function(rDt){var Kre=Si(),KPt=i_();function JPt(e,t,r){let{offset:n,type:o,source:s,end:i}=e,a,c,l=(h,y,E)=>r(n+h,y,E);switch(o){case"scalar":a=Kre.Scalar.PLAIN,c=QPt(s,l);break;case"single-quoted-scalar":a=Kre.Scalar.QUOTE_SINGLE,c=YPt(s,l);break;case"double-quoted-scalar":a=Kre.Scalar.QUOTE_DOUBLE,c=ZPt(s,l);break;default:return r(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${o}`),{value:"",type:null,comment:"",range:[n,n+s.length,n+s.length]}}let u=n+s.length,f=KPt.resolveEnd(i,u,t,r);return{value:c,type:a,comment:f.comment,range:[n,u,f.offset]}}function QPt(e,t){let r="";switch(e[0]){case"\t":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${e[0]}`;break}case"@":case"`":{r=`reserved character ${e[0]}`;break}}if(r)t(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`);return vUe(e)}function YPt(e,t){if(e[e.length-1]!=="'"||e.length===1)t(e.length,"MISSING_CHAR","Missing closing 'quote");return vUe(e.slice(1,-1)).replace(/''/g,"'")}function vUe(e){let t,r;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
92
|
+
`,"sy"),r=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
93
|
+
`,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,r=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=t.exec(e);if(!n)return e;let o=n[1],s=" ",i=t.lastIndex;r.lastIndex=i;while(n=r.exec(e)){if(n[1]==="")if(s===`
|
|
94
|
+
`)o+=s;else s=`
|
|
95
|
+
`;else o+=s+n[1],s=" ";i=r.lastIndex}let a=/[ \t]*(.*)/sy;return a.lastIndex=i,n=a.exec(e),o+s+(n?.[1]??"")}function ZPt(e,t){let r="";for(let n=1;n<e.length-1;++n){let o=e[n];if(o==="\r"&&e[n+1]===`
|
|
96
|
+
`)continue;if(o===`
|
|
97
|
+
`){let{fold:s,offset:i}=XPt(e,n);r+=s,n=i}else if(o==="\\"){let s=e[++n],i=eDt[s];if(i)r+=i;else if(s===`
|
|
98
|
+
`){s=e[n+1];while(s===" "||s==="\t")s=e[++n+1]}else if(s==="\r"&&e[n+1]===`
|
|
99
|
+
`){s=e[++n+1];while(s===" "||s==="\t")s=e[++n+1]}else if(s==="x"||s==="u"||s==="U"){let a=s==="x"?2:s==="u"?4:8;r+=tDt(e,n+1,a,t),n+=a}else{let a=e.substr(n-1,2);t(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),r+=a}}else if(o===" "||o==="\t"){let s=n,i=e[n+1];while(i===" "||i==="\t")i=e[++n+1];if(i!==`
|
|
100
|
+
`&&!(i==="\r"&&e[n+2]===`
|
|
101
|
+
`))r+=n>s?e.slice(s,n+1):o}else r+=o}if(e[e.length-1]!=='"'||e.length===1)t(e.length,"MISSING_CHAR",'Missing closing "quote');return r}function XPt(e,t){let r="",n=e[t+1];while(n===" "||n==="\t"||n===`
|
|
102
|
+
`||n==="\r"){if(n==="\r"&&e[t+2]!==`
|
|
103
|
+
`)break;if(n===`
|
|
104
|
+
`)r+=`
|
|
105
|
+
`;t+=1,n=e[t+1]}if(!r)r=" ";return{fold:r,offset:t}}var eDt={"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 tDt(e,t,r,n){let o=e.substr(t,r),i=o.length===r&&/^[0-9a-fA-F]+$/.test(o)?parseInt(o,16):NaN;try{return String.fromCodePoint(i)}catch{let a=e.substr(t-2,r+2);return n(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}rDt.resolveFlowScalar=JPt});var RUe=at(function(lDt){var Fw=pn(),TUe=Si(),oDt=Gre(),sDt=Jre();function iDt(e,t,r,n){let{value:o,type:s,comment:i,range:a}=t.type==="block-scalar"?oDt.resolveBlockScalar(e,t,n):sDt.resolveFlowScalar(t,e.options.strict,n),c=r?e.directives.tagName(r.source,(f)=>n(r,"TAG_RESOLVE_FAILED",f)):null,l;if(e.options.stringKeys&&e.atKey)l=e.schema[Fw.SCALAR];else if(c)l=aDt(e.schema,o,c,r,n);else if(t.type==="scalar")l=cDt(e,o,t,n);else l=e.schema[Fw.SCALAR];let u;try{let f=l.resolve(o,(h)=>n(r??t,"TAG_RESOLVE_FAILED",h),e.options);u=Fw.isScalar(f)?f:new TUe.Scalar(f)}catch(f){let h=f instanceof Error?f.message:String(f);n(r??t,"TAG_RESOLVE_FAILED",h),u=new TUe.Scalar(o)}if(u.range=a,u.source=o,s)u.type=s;if(c)u.tag=c;if(l.format)u.format=l.format;if(i)u.comment=i;return u}function aDt(e,t,r,n,o){if(r==="!")return e[Fw.SCALAR];let s=[];for(let a of e.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)s.push(a);else return a;for(let a of s)if(a.test?.test(t))return a;let i=e.knownTags[r];if(i&&!i.collection)return e.tags.push(Object.assign({},i,{default:!1,test:void 0})),i;return o(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),e[Fw.SCALAR]}function cDt({atKey:e,directives:t,schema:r},n,o,s){let i=r.tags.find((a)=>(a.default===!0||e&&a.default==="key")&&a.test?.test(n))||r[Fw.SCALAR];if(r.compat){let a=r.compat.find((c)=>c.default&&c.test?.test(n))??r[Fw.SCALAR];if(i.tag!==a.tag){let c=t.tagString(i.tag),l=t.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;s(o,"TAG_RESOLVE_FAILED",u,!0)}}return i}lDt.composeScalar=iDt});var MUe=at(function(fDt){function pDt(e,t,r){if(t){r??(r=t.length);for(let n=r-1;n>=0;--n){let o=t[n];switch(o.type){case"space":case"comment":case"newline":e-=o.source.length;continue}o=t[++n];while(o?.type==="space")e+=o.source.length,o=t[++n];break}}return e}fDt.emptyScalarPosition=pDt});var FUe=at(function(bDt){var mDt=aD(),hDt=pn(),gDt=_Ue(),PUe=RUe(),xDt=i_(),yDt=MUe(),SDt={composeNode:DUe,composeEmptyNode:Qre};function DUe(e,t,r,n){let o=e.atKey,{spaceBefore:s,comment:i,anchor:a,tag:c}=r,l,u=!0;switch(t.type){case"alias":if(l=EDt(e,t,n),a||c)n(t,"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(l=PUe.composeScalar(e,t,c,n),a)l.anchor=a.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(l=gDt.composeCollection(SDt,e,t,r,n),a)l.anchor=a.source.substring(1)}catch(f){let h=f instanceof Error?f.message:String(f);n(t,"RESOURCE_EXHAUSTION",h)}break;default:{let f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;n(t,"UNEXPECTED_TOKEN",f),u=!1}}if(l??(l=Qre(e,t.offset,void 0,null,r,n)),a&&l.anchor==="")n(a,"BAD_ALIAS","Anchor cannot be an empty string");if(o&&e.options.stringKeys&&(!hDt.isScalar(l)||typeof l.value!=="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str"))n(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(s)l.spaceBefore=!0;if(i)if(t.type==="scalar"&&t.source==="")l.comment=i;else l.commentBefore=i;if(e.options.keepSourceTokens&&u)l.srcToken=t;return l}function Qre(e,t,r,n,{spaceBefore:o,comment:s,anchor:i,tag:a,end:c},l){let u={type:"scalar",offset:yDt.emptyScalarPosition(t,r,n),indent:-1,source:""},f=PUe.composeScalar(e,u,a,l);if(i){if(f.anchor=i.source.substring(1),f.anchor==="")l(i,"BAD_ALIAS","Anchor cannot be an empty string")}if(o)f.spaceBefore=!0;if(s)f.comment=s,f.range[2]=c;return f}function EDt({options:e},{offset:t,source:r,end:n},o){let s=new mDt.Alias(r.substring(1));if(s.source==="")o(t,"BAD_ALIAS","Alias cannot be an empty string");if(s.source.endsWith(":"))o(t+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let i=t+r.length,a=xDt.resolveEnd(n,i,e.strict,o);if(s.range=[t,i,a.offset],a.comment)s.comment=a.comment;return s}bDt.composeEmptyNode=Qre;bDt.composeNode=DUe});var LUe=at(function(_Dt){var kDt=bD(),NUe=FUe(),IDt=i_(),ADt=wD();function ODt(e,t,{offset:r,start:n,value:o,end:s},i){let a=Object.assign({_directives:t},e),c=new kDt.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=ADt.resolveProps(n,{indicator:"doc-start",next:o??s?.[0],offset:r,onError:i,parentIndent:0,startOnNewline:!0});if(u.found){if(c.directives.docStart=!0,o&&(o.type==="block-map"||o.type==="block-seq")&&!u.hasNewline)i(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}c.contents=o?NUe.composeNode(l,o,u,i):NUe.composeEmptyNode(l,u.end,n,null,u,i);let f=c.contents.range[2],h=IDt.resolveEnd(s,f,!1,i);if(h.comment)c.comment=h.comment;return c.range=[r,f,h.offset],c}_Dt.composeDoc=ODt});var Yre=at(function(FDt){var TDt=Uk("process"),RDt=tre(),MDt=bD(),kD=CD(),UUe=pn(),PDt=LUe(),DDt=i_();function ID(e){if(typeof e==="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:r}=e;return[t,t+(typeof r==="string"?r.length:1)]}function HUe(e){let t="",r=!1,n=!1;for(let o=0;o<e.length;++o){let s=e[o];switch(s[0]){case"#":t+=(t===""?"":n?`
|
|
107
|
+
|
|
108
|
+
`:`
|
|
109
|
+
`)+(s.substring(1)||" "),r=!0,n=!1;break;case"%":if(e[o+1]?.[0]!=="#")o+=1;r=!1;break;default:if(!r)n=!0;r=!1}}return{comment:t,afterEmptyLine:n}}class qUe{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,r,n,o)=>{let s=ID(t);if(o)this.warnings.push(new kD.YAMLWarning(s,r,n));else this.errors.push(new kD.YAMLParseError(s,r,n))},this.directives=new RDt.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:r,afterEmptyLine:n}=HUe(this.prelude);if(r){let o=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
110
|
+
${r}`:r;else if(n||e.directives.docStart||!o)e.commentBefore=r;else if(UUe.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];if(UUe.isPair(s))s=s.key;let i=s.commentBefore;s.commentBefore=i?`${r}
|
|
111
|
+
${i}`:r}else{let s=o.commentBefore;o.commentBefore=s?`${r}
|
|
112
|
+
${s}`:r}}if(t){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:HUe(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,r=-1){for(let n of e)yield*this.next(n);yield*this.end(t,r)}*next(e){if(TDt.env.LOG_STREAM)console.dir(e,{depth:null});switch(e.type){case"directive":this.directives.add(e.source,(t,r,n)=>{let o=ID(e);o[0]+=t,this.onError(o,"BAD_DIRECTIVE",r,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=PDt.composeDoc(this.options,this.directives,e,this.onError);if(this.atDirectives&&!t.directives.docStart)this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(t,!1),this.doc)yield this.doc;this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new kD.YAMLParseError(ID(e),"UNEXPECTED_TOKEN",t);if(this.atDirectives||!this.doc)this.errors.push(r);else this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){this.errors.push(new kD.YAMLParseError(ID(e),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let t=DDt.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
|
113
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new kD.YAMLParseError(ID(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),n=new MDt.Document(void 0,r);if(this.atDirectives)this.onError(t,"MISSING_CHAR","Missing directives-end indicator line");n.range=[0,t,t],this.decorate(n,!1),yield n}}}FDt.Composer=qUe});var zUe=at(function($Dt){var LDt=Gre(),UDt=Jre(),HDt=CD(),BUe=pD();function qDt(e,t=!0,r){if(e){let n=(o,s,i)=>{let a=typeof o==="number"?o:Array.isArray(o)?o[0]:o.offset;if(r)r(a,s,i);else throw new HDt.YAMLParseError([a,a+1],s,i)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return UDt.resolveFlowScalar(e,t,n);case"block-scalar":return LDt.resolveBlockScalar({options:{strict:t}},e,n)}}return null}function BDt(e,t){let{implicitKey:r=!1,indent:n,inFlow:o=!1,offset:s=-1,type:i="PLAIN"}=t,a=BUe.stringifyString({type:i,value:e},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:n,source:`
|
|
114
|
+
`}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
|
|
115
|
+
`),u=a.substring(0,l),f=a.substring(l+1)+`
|
|
116
|
+
`,h=[{type:"block-scalar-header",offset:s,indent:n,source:u}];if(!WUe(h,c))h.push({type:"newline",offset:-1,indent:n,source:`
|
|
117
|
+
`});return{type:"block-scalar",offset:s,indent:n,props:h,source:f}}case'"':return{type:"double-quoted-scalar",offset:s,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:s,indent:n,source:a,end:c};default:return{type:"scalar",offset:s,indent:n,source:a,end:c}}}function WDt(e,t,r={}){let{afterKey:n=!1,implicitKey:o=!1,inFlow:s=!1,type:i}=r,a="indent"in e?e.indent:null;if(n&&typeof a==="number")a+=2;if(!i)switch(e.type){case"single-quoted-scalar":i="QUOTE_SINGLE";break;case"double-quoted-scalar":i="QUOTE_DOUBLE";break;case"block-scalar":{let l=e.props[0];if(l.type!=="block-scalar-header")throw Error("Invalid block scalar header");i=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:i="PLAIN"}let c=BUe.stringifyString({type:i,value:t},{implicitKey:o||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":zDt(e,c);break;case'"':Zre(e,c,"double-quoted-scalar");break;case"'":Zre(e,c,"single-quoted-scalar");break;default:Zre(e,c,"scalar")}}function zDt(e,t){let r=t.indexOf(`
|
|
118
|
+
`),n=t.substring(0,r),o=t.substring(r+1)+`
|
|
119
|
+
`;if(e.type==="block-scalar"){let s=e.props[0];if(s.type!=="block-scalar-header")throw Error("Invalid block scalar header");s.source=n,e.source=o}else{let{offset:s}=e,i="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:s,indent:i,source:n}];if(!WUe(a,"end"in e?e.end:void 0))a.push({type:"newline",offset:-1,indent:i,source:`
|
|
120
|
+
`});for(let c of Object.keys(e))if(c!=="type"&&c!=="offset")delete e[c];Object.assign(e,{type:"block-scalar",indent:i,props:a,source:o})}}function WUe(e,t){if(t)for(let r of t)switch(r.type){case"space":case"comment":e.push(r);break;case"newline":return e.push(r),!0}return!1}function Zre(e,t,r){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=r,e.source=t;break;case"block-scalar":{let n=e.props.slice(1),o=t.length;if(e.props[0].type==="block-scalar-header")o-=e.props[0].source.length;for(let s of n)s.offset+=o;delete e.props,Object.assign(e,{type:r,source:t,end:n});break}case"block-map":case"block-seq":{let o={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
|
|
121
|
+
`};delete e.items,Object.assign(e,{type:r,source:t,end:[o]});break}default:{let n="indent"in e?e.indent:-1,o="end"in e&&Array.isArray(e.end)?e.end.filter((s)=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(e))if(s!=="type"&&s!=="offset")delete e[s];Object.assign(e,{type:r,indent:n,source:t,end:o})}}}$Dt.createScalarToken=BDt;$Dt.resolveAsScalar=qDt;$Dt.setScalarValue=WDt});var $Ue=at(function(JDt){var KDt=(e)=>("type"in e)?A$(e):I$(e);function A$(e){switch(e.type){case"block-scalar":{let t="";for(let r of e.props)t+=A$(r);return t+e.source}case"block-map":case"block-seq":{let t="";for(let r of e.items)t+=I$(r);return t}case"flow-collection":{let t=e.start.source;for(let r of e.items)t+=I$(r);for(let r of e.end)t+=r.source;return t}case"document":{let t=I$(e);if(e.end)for(let r of e.end)t+=r.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let r of e.end)t+=r.source;return t}}}function I$({start:e,key:t,sep:r,value:n}){let o="";for(let s of e)o+=s.source;if(t)o+=A$(t);if(r)for(let s of r)o+=s.source;if(n)o+=A$(n);return o}JDt.stringify=KDt});var GUe=at(function(ZDt){var Xre=Symbol("break visit"),YDt=Symbol("skip children"),jUe=Symbol("remove item");function Nw(e,t){if("type"in e&&e.type==="document")e={start:e.start,value:e.value};VUe(Object.freeze([]),e,t)}Nw.BREAK=Xre;Nw.SKIP=YDt;Nw.REMOVE=jUe;Nw.itemAtPath=(e,t)=>{let r=e;for(let[n,o]of t){let s=r?.[n];if(s&&"items"in s)r=s.items[o];else return}return r};Nw.parentCollection=(e,t)=>{let r=Nw.itemAtPath(e,t.slice(0,-1)),n=t[t.length-1][0],o=r?.[n];if(o&&"items"in o)return o;throw Error("Parent collection not found")};function VUe(e,t,r){let n=r(t,e);if(typeof n==="symbol")return n;for(let o of["key","value"]){let s=t[o];if(s&&"items"in s){for(let i=0;i<s.items.length;++i){let a=VUe(Object.freeze(e.concat([[o,i]])),s.items[i],r);if(typeof a==="number")i=a-1;else if(a===Xre)return Xre;else if(a===jUe)s.items.splice(i,1),i-=1}if(typeof n==="function"&&o==="key")n=n(t,e)}}return typeof n==="function"?n(t,e):n}ZDt.visit=Nw});var O$=at(function(iFt){var ene=zUe(),eFt=$Ue(),tFt=GUe(),tne="\uFEFF",rne="\x02",nne="\x18",one="\x1F",rFt=(e)=>!!e&&("items"in e),nFt=(e)=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function oFt(e){switch(e){case tne:return"<BOM>";case rne:return"<DOC>";case nne:return"<FLOW_END>";case one:return"<SCALAR>";default:return JSON.stringify(e)}}function sFt(e){switch(e){case tne:return"byte-order-mark";case rne:return"doc-mode";case nne:return"flow-error-end";case one: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(e[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}iFt.createScalarToken=ene.createScalarToken;iFt.resolveAsScalar=ene.resolveAsScalar;iFt.setScalarValue=ene.setScalarValue;iFt.stringify=eFt.stringify;iFt.visit=tFt.visit;iFt.BOM=tne;iFt.DOCUMENT=rne;iFt.FLOW_END=nne;iFt.SCALAR=one;iFt.isCollection=rFt;iFt.isScalar=nFt;iFt.prettyToken=oFt;iFt.tokenType=sFt});var ine=at(function(CFt){var AD=O$();function hd(e){switch(e){case void 0:case" ":case`
|
|
124
|
+
`:case"\r":case"\t":return!0;default:return!1}}var KUe=new Set("0123456789ABCDEFabcdef"),EFt=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),_$=new Set(",[]{}"),bFt=new Set(` ,[]{}
|
|
125
|
+
\r `),sne=(e)=>!e||bFt.has(e);class JUe{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(e,t=!1){if(e){if(typeof e!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let r=this.next??"stream";while(r&&(t||this.hasChars(1)))r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,t=this.buffer[e];while(t===" "||t==="\t")t=this.buffer[++e];if(!t||t==="#"||t===`
|
|
126
|
+
`)return!0;if(t==="\r")return this.buffer[e+1]===`
|
|
127
|
+
`;return!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let r=0;while(t===" ")t=this.buffer[++r+e];if(t==="\r"){let n=this.buffer[r+e+1];if(n===`
|
|
128
|
+
`||!n&&!this.atEnd)return e+r+1}return t===`
|
|
129
|
+
`||r>=this.indentNext||!t&&!this.atEnd?e+r:-1}if(t==="-"||t==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&hd(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;if(typeof e!=="number"||e!==-1&&e<this.pos)e=this.buffer.indexOf(`
|
|
130
|
+
`,this.pos),this.lineEndPos=e;if(e===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[e-1]==="\r")e-=1;return this.buffer.substring(this.pos,e)}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){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 e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===AD.BOM)yield*this.pushCount(1),e=e.substring(1);if(e[0]==="%"){let t=e.length,r=e.indexOf("#");while(r!==-1){let o=e[r-1];if(o===" "||o==="\t"){t=r-1;break}else r=e.indexOf("#",r+1)}while(!0){let o=e[t-1];if(o===" "||o==="\t")t-=1;else break}let n=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield AD.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&hd(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!hd(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&hd(t)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);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(sne),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,r=-1;do{if(e=yield*this.pushNewline(),e>0)t=yield*this.pushSpaces(!1),this.indentValue=r=t;else t=0;t+=yield*this.pushSpaces(!0)}while(e+t>0);let n=this.getLine();if(n===null)return this.setNext("flow");if(r!==-1&&r<this.indentNext&&n[0]!=="#"||r===0&&(n.startsWith("---")||n.startsWith("..."))&&hd(n[3])){if(!(r===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield AD.FLOW_END,yield*this.parseLineStart()}let o=0;while(n[o]===",")o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),n[o]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-o),"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(sne),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||hd(s)||s===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")while(t!==-1&&this.buffer[t+1]==="'")t=this.buffer.indexOf("'",t+2);else while(t!==-1){let o=0;while(this.buffer[t-1-o]==="\\")o+=1;if(o%2===0)break;t=this.buffer.indexOf('"',t+1)}let r=this.buffer.substring(0,t),n=r.indexOf(`
|
|
131
|
+
`,this.pos);if(n!==-1){while(n!==-1){let o=this.continueScalar(n+1);if(o===-1)break;n=r.indexOf(`
|
|
132
|
+
`,o)}if(n!==-1)t=n-(r[n-1]==="\r"?2:1)}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;while(!0){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil((t)=>hd(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){case" ":t+=1;break;case`
|
|
133
|
+
`:e=o,t=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
|
|
134
|
+
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=t;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(`
|
|
135
|
+
`,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let n=e+1;r=this.buffer[n];while(r===" ")r=this.buffer[++n];if(r==="\t"){while(r==="\t"||r===" "||r==="\r"||r===`
|
|
136
|
+
`)r=this.buffer[++n];e=n-1}else if(!this.blockScalarKeep)do{let o=e-1,s=this.buffer[o];if(s==="\r")s=this.buffer[--o];let i=o;while(s===" ")s=this.buffer[--o];if(s===`
|
|
137
|
+
`&&o>=this.pos&&o+1+t>i)e=o;else break}while(!0);return yield AD.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,r=this.pos-1,n;while(n=this.buffer[++r])if(n===":"){let o=this.buffer[r+1];if(hd(o)||e&&_$.has(o))break;t=r}else if(hd(n)){let o=this.buffer[r+1];if(n==="\r")if(o===`
|
|
138
|
+
`)r+=1,n=`
|
|
139
|
+
`,o=this.buffer[r+1];else t=r;if(o==="#"||e&&_$.has(o))break;if(n===`
|
|
140
|
+
`){let s=this.continueScalar(r+1);if(s===-1)break;r=Math.max(r,s-2)}}else{if(e&&_$.has(n))break;t=r}if(!n&&!this.atEnd)return this.setNext("plain-scalar");return yield AD.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc"}*pushCount(e){if(e>0)return yield this.buffer.substr(this.pos,e),this.pos+=e,e;return 0}*pushToIndex(e,t){let r=this.buffer.slice(this.pos,e);if(r)return yield r,this.pos+=r.length,r.length;else if(t)yield"";return 0}*pushIndicators(){let e=0;e:while(!0){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(sne),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let t=this.flowLevel>0,r=this.charAt(1);if(hd(r)||t&&_$.has(r)){if(!t)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];while(!hd(t)&&t!==">")t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];while(t)if(EFt.has(t))t=this.buffer[++e];else if(t==="%"&&KUe.has(this.buffer[e+1])&&KUe.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];if(e===`
|
|
141
|
+
`)return yield*this.pushCount(1);else if(e==="\r"&&this.charAt(1)===`
|
|
142
|
+
`)return yield*this.pushCount(2);else return 0}*pushSpaces(e){let t=this.pos-1,r;do r=this.buffer[++t];while(r===" "||e&&r==="\t");let n=t-this.pos;if(n>0)yield this.buffer.substr(this.pos,n),this.pos=t;return n}*pushUntil(e){let t=this.pos,r=this.buffer[t];while(!e(r))r=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}CFt.Lexer=JUe});var ane=at(function(kFt){class QUe{constructor(){this.lineStarts=[],this.addNewLine=(e)=>this.lineStarts.push(e),this.linePos=(e)=>{let t=0,r=this.lineStarts.length;while(t<r){let o=t+r>>1;if(this.lineStarts[o]<e)t=o+1;else r=o}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let n=this.lineStarts[t-1];return{line:t,col:e-n+1}}}}kFt.LineCounter=QUe});var cne=at(function(_Ft){var AFt=Uk("process"),YUe=O$(),OFt=ine();function IE(e,t){for(let r=0;r<e.length;++r)if(e[r].type===t)return!0;return!1}function ZUe(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function eHe(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function v$(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function a_(e){if(e.length===0)return[];let t=e.length;e:while(--t>=0)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}while(e[++t]?.type==="space");return e.splice(t,e.length)}function T$(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let r=0;r<t.length;++r)e.push(t[r])}function XUe(e){if(e.start.type==="flow-seq-start"){for(let t of e.items)if(t.sep&&!t.value&&!IE(t.start,"explicit-key-ind")&&!IE(t.sep,"map-value-ind")){if(t.key)t.value=t.key;if(delete t.key,eHe(t.value))if(t.value.end)T$(t.value.end,t.sep);else t.value.end=t.sep;else T$(t.start,t.sep);delete t.sep}}}class tHe{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new OFt.Lexer,this.onNewLine=e}*parse(e,t=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let r of this.lexer.lex(e,t))yield*this.next(r);if(!t)yield*this.end()}*next(e){if(this.source=e,AFt.env.LOG_TOKENS)console.log("|",YUe.prettyToken(e));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=YUe.tokenType(e);if(!t){let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}else if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+e.length);break;case"space":if(this.atNewLine&&e[0]===" ")this.indent+=e.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=e.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.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 e=this.peek(1);if(this.type==="doc-end"&&e?.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(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let r=this.peek(1);if(t.type==="block-scalar")t.indent="indent"in r?r.indent:0;else if(t.type==="flow-collection"&&r.type==="document")t.indent=0;if(t.type==="flow-collection")XUe(t);switch(r.type){case"document":r.value=t;break;case"block-scalar":r.props.push(t);break;case"block-map":{let n=r.items[r.items.length-1];if(n.value){r.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=r.items[r.items.length-1];if(n.value)r.items.push({start:[],value:t});else n.value=t;break}case"flow-collection":{let n=r.items[r.items.length-1];if(!n||n.value)r.items.push({start:[],key:t,sep:[]});else if(n.sep)n.value=t;else Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let n=t.items[t.items.length-1];if(n&&!n.sep&&!n.value&&n.start.length>0&&ZUe(n.start)===-1&&(t.indent===0||n.start.every((o)=>o.type!=="comment"||o.indent<t.indent))){if(r.type==="document")r.end=n.start;else r.items.push({start:n.start});t.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 e={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")e.start.push(this.sourceToken);this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{if(ZUe(e.start)!==-1)yield*this.pop(),yield*this.step();else e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);if(t)this.stack.push(t);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=v$(this.peek(2)),r=a_(t),n;if(e.end)n=e.end,n.push(this.sourceToken),delete e.end;else n=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
|
|
143
|
+
`)+1;while(t!==0)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
144
|
+
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let r="end"in t.value?t.value.end:void 0;if((Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment")r?.push(this.sourceToken);else e.items.push({start:[this.sourceToken]})}else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){T$(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,n=r&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",o=[];if(n&&t.sep&&!t.value){let s=[];for(let i=0;i<t.sep.length;++i){let a=t.sep[i];switch(a.type){case"newline":s.push(i);break;case"space":break;case"comment":if(a.indent>e.indent)s.length=0;break;default:s.length=0}}if(s.length>=2)o=t.sep.splice(s[1])}switch(this.type){case"anchor":case"tag":if(n||t.value)o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0;else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"explicit-key-ind":if(!t.sep&&!t.explicitKey)t.start.push(this.sourceToken),t.explicitKey=!0;else if(n||t.value)o.push(this.sourceToken),e.items.push({start:o,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(t.explicitKey)if(!t.sep)if(IE(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let s=a_(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(IE(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(eHe(t.key)&&!IE(t.sep,"newline")){let s=a_(t.start),i=t.key,a=t.sep;a.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:i,sep:a}]})}else if(o.length>0)t.sep=t.sep.concat(o,this.sourceToken);else t.sep.push(this.sourceToken);else if(!t.sep)Object.assign(t,{key:null,sep:[this.sourceToken]});else if(t.value||n)e.items.push({start:o,key:null,sep:[this.sourceToken]});else if(IE(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else t.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);if(n||t.value)e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0;else if(t.sep)this.stack.push(s);else Object.assign(t,{key:s,sep:[]}),this.onKeyLine=!0;return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!t.explicitKey&&t.sep&&!IE(t.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(r)e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let r="end"in t.value?t.value.end:void 0;if((Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment")r?.push(this.sourceToken);else e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){T$(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;if(t.value||IE(t.start,"seq-item-ind"))e.items.push({start:[this.sourceToken]});else t.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!t||t.sep)e.items.push({start:[this.sourceToken]});else t.start.push(this.sourceToken);return;case"map-value-ind":if(!t||t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!t||t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);if(!t||t.value)e.items.push({start:[],key:n,sep:[]});else if(t.sep)this.stack.push(n);else Object.assign(t,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);if(r)this.stack.push(r);else yield*this.pop(),yield*this.step()}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let n=v$(r),o=a_(n);XUe(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
145
|
+
`)+1;while(t!==0)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
146
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){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 t=v$(e),r=a_(t);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=v$(e),r=a_(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){if(this.type!=="comment")return!1;if(this.indent<=t)return!1;return e.every((r)=>r.type==="newline"||r.type==="space")}*documentEnd(e){if(this.type!=="doc-mode"){if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(e){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(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}_Ft.Parser=tHe});var iHe=at(function(LFt){var rHe=Yre(),TFt=bD(),OD=CD(),RFt=are(),MFt=pn(),PFt=ane(),nHe=cne();function oHe(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new PFt.LineCounter||null,prettyErrors:t}}function DFt(e,t={}){let{lineCounter:r,prettyErrors:n}=oHe(t),o=new nHe.Parser(r?.addNewLine),s=new rHe.Composer(t),i=Array.from(s.compose(o.parse(e)));if(n&&r)for(let a of i)a.errors.forEach(OD.prettifyError(e,r)),a.warnings.forEach(OD.prettifyError(e,r));if(i.length>0)return i;return Object.assign([],{empty:!0},s.streamInfo())}function sHe(e,t={}){let{lineCounter:r,prettyErrors:n}=oHe(t),o=new nHe.Parser(r?.addNewLine),s=new rHe.Composer(t),i=null;for(let a of s.compose(o.parse(e),!0,e.length))if(!i)i=a;else if(i.options.logLevel!=="silent"){i.errors.push(new OD.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(n&&r)i.errors.forEach(OD.prettifyError(e,r)),i.warnings.forEach(OD.prettifyError(e,r));return i}function FFt(e,t,r){let n=void 0;if(typeof t==="function")n=t;else if(r===void 0&&t&&typeof t==="object")r=t;let o=sHe(e,r);if(!o)return null;if(o.warnings.forEach((s)=>RFt.warn(o.options.logLevel,s)),o.errors.length>0)if(o.options.logLevel!=="silent")throw o.errors[0];else o.errors=[];return o.toJS(Object.assign({reviver:n},r))}function NFt(e,t,r){let n=null;if(typeof t==="function"||Array.isArray(t))n=t;else if(r===void 0&&t)r=t;if(typeof r==="string")r=r.length;if(typeof r==="number"){let o=Math.round(r);r=o<1?void 0:o>8?{indent:8}:{indent:o}}if(e===void 0){let{keepUndefined:o}=r??t??{};if(!o)return}if(MFt.isDocument(e)&&!n)return e.toString(r);return new TFt.Document(e,n,r).toString(r)}LFt.parse=FFt;LFt.parseAllDocuments=DFt;LFt.parseDocument=sHe;LFt.stringify=NFt});var Mo={};Ht(Mo,{ArgsTypeId:()=>cUt,all:()=>uUt,atLeast:()=>pUt,atMost:()=>fUt,between:()=>dUt,boolean:()=>mUt,choice:()=>hUt,date:()=>gUt,directory:()=>xUt,file:()=>yUt,fileContent:()=>SUt,fileParse:()=>EUt,fileSchema:()=>bUt,fileText:()=>CUt,float:()=>wUt,getHelp:()=>kUt,getIdentifier:()=>IUt,getMaxSize:()=>OUt,getMinSize:()=>AUt,getUsage:()=>_Ut,integer:()=>vUt,isArgs:()=>lUt,map:()=>TUt,mapEffect:()=>RUt,mapTryCatch:()=>MUt,none:()=>DUt,optional:()=>PUt,path:()=>FUt,redacted:()=>LUt,repeated:()=>NUt,secret:()=>UUt,text:()=>HUt,validate:()=>qUt,withDefault:()=>BUt,withDescription:()=>zUt,withFallbackConfig:()=>WUt,withSchema:()=>$Ut,wizard:()=>jUt});var ct={};Ht(ct,{Do:()=>nXe,allocate:()=>Vd,append:()=>Yn,appendAll:()=>xt,bind:()=>oXe,bindTo:()=>sXe,cartesian:()=>rXe,cartesianWith:()=>Wue,chop:()=>k4,chunksOf:()=>Uue,contains:()=>oc,containsWith:()=>tI,copy:()=>py,countBy:()=>_Ze,dedupe:()=>Xv,dedupeAdjacent:()=>M4,dedupeAdjacentWith:()=>Bue,dedupeWith:()=>R4,difference:()=>I4,differenceWith:()=>bL,drop:()=>wf,dropRight:()=>IZe,dropWhile:()=>AZe,empty:()=>Ge,ensure:()=>uy,every:()=>Zv,extend:()=>YZe,filter:()=>Qd,filterMap:()=>Tc,filterMapWhile:()=>A4,findFirst:()=>Kd,findFirstIndex:()=>Xk,findFirstWithIndex:()=>OZe,findLast:()=>eI,findLastIndex:()=>C4,flatMap:()=>Ho,flatMapNullable:()=>JZe,flatten:()=>Ab,forEach:()=>tXe,fromIterable:()=>De,fromNullable:()=>v4,fromOption:()=>Tue,fromRecord:()=>mZe,get:()=>Mue,getEquivalence:()=>Ji,getLefts:()=>$Ze,getOrder:()=>eXe,getRights:()=>jZe,getSomes:()=>Jd,group:()=>WZe,groupBy:()=>zZe,groupWith:()=>Hue,head:()=>Ki,headNonEmpty:()=>jr,init:()=>CZe,initNonEmpty:()=>Gv,insertAt:()=>vZe,intersection:()=>Yv,intersectionWith:()=>EL,intersperse:()=>FZe,isArray:()=>Gd,isEmptyArray:()=>Rue,isEmptyReadonlyArray:()=>fs,isNonEmptyArray:()=>tp,isNonEmptyReadonlyArray:()=>ut,join:()=>Xt,last:()=>Vv,lastNonEmpty:()=>Ib,length:()=>yZe,let:()=>iXe,liftEither:()=>QZe,liftNullable:()=>KZe,liftOption:()=>GZe,liftPredicate:()=>VZe,make:()=>Xo,makeBy:()=>Hh,map:()=>Ke,mapAccum:()=>P4,match:()=>es,matchLeft:()=>Gi,matchRight:()=>b4,max:()=>XZe,min:()=>ZZe,modify:()=>hL,modifyNonEmptyHead:()=>Fue,modifyNonEmptyLast:()=>Nue,modifyOption:()=>Due,of:()=>tt,pad:()=>qZe,partition:()=>O4,partitionMap:()=>nI,prepend:()=>Ia,prependAll:()=>hZe,range:()=>fZe,reduce:()=>ki,reduceRight:()=>dl,remove:()=>gL,removeOption:()=>MZe,replace:()=>TZe,replaceOption:()=>RZe,replicate:()=>dZe,reverse:()=>Jv,rotate:()=>Lue,scan:()=>gZe,scanRight:()=>xZe,separate:()=>_4,setNonEmptyHead:()=>NZe,setNonEmptyLast:()=>LZe,some:()=>T4,sort:()=>Aa,sortBy:()=>DZe,sortWith:()=>PZe,span:()=>qh,split:()=>UZe,splitAt:()=>rI,splitNonEmptyAt:()=>SL,splitWhere:()=>HZe,tail:()=>bZe,tailNonEmpty:()=>ts,take:()=>Kv,takeRight:()=>wZe,takeWhile:()=>kZe,unappend:()=>EZe,unfold:()=>CL,union:()=>nu,unionWith:()=>que,unprepend:()=>SZe,unsafeGet:()=>kb,unzip:()=>w4,window:()=>BZe,zip:()=>xL,zipWith:()=>Qv});var mt={};Ht(mt,{Do:()=>t7e,TypeId:()=>B9e,all:()=>Y9e,andThen:()=>J9e,ap:()=>Q9e,bind:()=>r7e,bindTo:()=>n7e,filterOrLeft:()=>j9e,flatMap:()=>$v,flip:()=>Z9e,fromNullable:()=>z9e,fromOption:()=>Wv,gen:()=>e7e,getEquivalence:()=>o4,getLeft:()=>$9e,getOrElse:()=>a4,getOrNull:()=>V9e,getOrThrow:()=>cL,getOrThrowWith:()=>zv,getOrUndefined:()=>G9e,getRight:()=>n4,isEither:()=>Bd,isLeft:()=>Sr,isRight:()=>wi,left:()=>Ie,let:()=>o7e,liftPredicate:()=>i4,map:()=>eu,mapBoth:()=>s4,mapLeft:()=>pl,match:()=>Ir,merge:()=>Cb,orElse:()=>K9e,right:()=>ye,transposeMapOption:()=>i7e,transposeOption:()=>s7e,try:()=>ay,void:()=>W9e,zipWith:()=>lue});var jN=(e)=>typeof e==="function",p=function(e,t){if(typeof e==="function")return function(){if(e(arguments))return t.apply(this,arguments);return(r)=>t(r,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(r,n){if(arguments.length>=2)return t(r,n);return function(o){return t(o,r)}};case 3:return function(r,n,o){if(arguments.length>=3)return t(r,n,o);return function(s){return t(s,r,n)}};case 4:return function(r,n,o,s){if(arguments.length>=4)return t(r,n,o,s);return function(i){return t(i,r,n,o)}};case 5:return function(r,n,o,s,i){if(arguments.length>=5)return t(r,n,o,s,i);return function(a){return t(a,r,n,o,s)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let r=arguments;return function(n){return t(n,...r)}}}};var te=(e)=>e;var nl=(e)=>()=>e,uo=nl(!0),Fo=nl(!1),VN=nl(null),Oh=nl(void 0),wo=Oh;function d(e,t,r,n,o,s,i,a,c){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return r(t(e));case 4:return n(r(t(e)));case 5:return o(n(r(t(e))));case 6:return s(o(n(r(t(e)))));case 7:return i(s(o(n(r(t(e))))));case 8:return a(i(s(o(n(r(t(e)))))));case 9:return c(a(i(s(o(n(r(t(e))))))));default:{let l=arguments[0];for(let u=1;u<arguments.length;u++)l=arguments[u](l);return l}}}function ry(e,t,r,n,o,s,i,a,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return r(t(e.apply(this,arguments)))};case 4:return function(){return n(r(t(e.apply(this,arguments))))};case 5:return function(){return o(n(r(t(e.apply(this,arguments)))))};case 6:return function(){return s(o(n(r(t(e.apply(this,arguments))))))};case 7:return function(){return i(s(o(n(r(t(e.apply(this,arguments)))))))};case 8:return function(){return a(i(s(o(n(r(t(e.apply(this,arguments))))))))};case 9:return function(){return c(a(i(s(o(n(r(t(e.apply(this,arguments)))))))))}}return}var No=(e)=>(t,r)=>t===r||e(t,r),x9e=(e,t)=>e===t,Fle=()=>x9e,Nle=Fle(),y9e=Fle();var jK=p(2,(e,t)=>No((r,n)=>e(t(r),t(n)))),Lle=jK(y9e,(e)=>e.getTime());var Ule=(e)=>No((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],r[n]))return!1;return!0});var Fd=(e)=>p(3,(t,r,n)=>e(t,(o)=>({...o,[r]:n(o)}))),Nd=(e)=>p(2,(t,r)=>e(t,(n)=>({[r]:n}))),oy=(e,t)=>p(3,(r,n,o)=>t(r,(s)=>e(o(s),(i)=>({...s,[n]:i}))));var Fv,je=(e,t)=>{if(!Fv)globalThis["effect/GlobalValue"]??=new Map,Fv=globalThis["effect/GlobalValue"];if(!Fv.has(e))Fv.set(e,t());return Fv.get(e)};var Hle=(e)=>!!e,qle=(e)=>e instanceof Set,Ble=(e)=>e instanceof Map,Jr=(e)=>typeof e==="string",li=(e)=>typeof e==="number",ji=(e)=>typeof e==="boolean",Ld=(e)=>typeof e==="bigint",Yu=(e)=>typeof e==="symbol";var Xl=jN,_h=(e)=>e===void 0,Hk=(e)=>e!==void 0,Wle=(e)=>e===null,GN=(e)=>e!==null,zle=(e)=>!1;var qk=(e)=>typeof e==="object"&&e!==null,Zo=(e)=>qk(e)||Xl(e),de=p(2,(e,t)=>Zo(e)&&(t in e)),Zu=p(2,(e,t)=>de(e,"_tag")&&e._tag===t),hb=(e)=>e===null||e===void 0,$le=(e)=>e!==null&&e!==void 0;var jle=(e)=>e instanceof Uint8Array,Bk=(e)=>e instanceof Date,ol=(e)=>typeof e==="string"||de(e,Symbol.iterator),Xu=(e)=>qk(e)&&!Array.isArray(e);var VK=(e)=>de(e,"then")&&Xl(e.then);var Vle=p(2,(e,t)=>(r)=>e(r)||t(r));var gb=(e)=>`BUG: ${e} - please report an issue at https://github.com/Effect-TS/effect/issues`;var GK=Symbol.for("effect/Gen/GenKind"),KN=(e)=>Zo(e)&&(GK in e);class Kle{value;constructor(e){this.value=e}get _F(){return te}get _R(){return(e)=>e}get _O(){return(e)=>e}get _E(){return(e)=>e}[GK]=GK;[Symbol.iterator](){return new xb(this)}}class xb{self;called=!1;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(e){return{value:e,done:!0}}throw(e){throw e}[Symbol.iterator](){return new xb(this.self)}}var JN=()=>function(){let e=arguments[0];for(let t=1;t<arguments.length;t++)e=arguments[t](e);return new Kle(e)},S9e=335903614,E9e=4150755663,b9e=1481765933,C9e=1284865837,w9e=9007199254740992,k9e=134217728;class JK{_state;constructor(e,t,r,n){if(hb(t)&&hb(e))t=Math.random()*4294967295>>>0,e=0;else if(hb(t))t=e,e=0;if(hb(n)&&hb(r))n=this._state?this._state[3]:E9e,r=this._state?this._state[2]:S9e;else if(hb(n))n=r,r=0;return this._state=new Int32Array([0,0,r>>>0,((n||0)|1)>>>0]),this._next(),Gle(this._state,this._state[0],this._state[1],e>>>0,t>>>0),this._next(),this}getState(){return[this._state[0],this._state[1],this._state[2],this._state[3]]}setState(e){this._state[0]=e[0],this._state[1]=e[1],this._state[2]=e[2],this._state[3]=e[3]|1}integer(e){return Math.round(this.number()*Number.MAX_SAFE_INTEGER)%e}number(){let e=(this._next()&67108863)*1,t=(this._next()&134217727)*1;return(e*k9e+t)/w9e}_next(){let e=this._state[0]>>>0,t=this._state[1]>>>0;I9e(this._state,e,t,b9e,C9e),Gle(this._state,this._state[0],this._state[1],this._state[2],this._state[3]);let r=e>>>18,n=(t>>>18|e<<14)>>>0;r=(r^e)>>>0,n=(n^t)>>>0;let o=(n>>>27|r<<5)>>>0,s=e>>>27,i=(-s>>>0&31)>>>0;return(o>>>s|o<<i)>>>0}}function I9e(e,t,r,n,o){let s=(r>>>16)*(o&65535)>>>0,i=(r&65535)*(o>>>16)>>>0,a=(r&65535)*(o&65535)>>>0,c=(r>>>16)*(o>>>16)+((i>>>16)+(s>>>16))>>>0;if(i=i<<16>>>0,a=a+i>>>0,a>>>0<i>>>0)c=c+1>>>0;if(s=s<<16>>>0,a=a+s>>>0,a>>>0<s>>>0)c=c+1>>>0;c=c+Math.imul(r,n)>>>0,c=c+Math.imul(t,o)>>>0,e[0]=c,e[1]=a}function Gle(e,t,r,n,o){let s=t+n>>>0,i=r+o>>>0;if(i>>>0<r>>>0)s=s+1|0;e[0]=s,e[1]=i}var KK=Symbol.for("effect/Utils/YieldWrap");class yf{#t;constructor(e){this.#t=e}[KK](){return this.#t}}function yb(e){if(typeof e==="object"&&e!==null&&KK in e)return e[KK]();throw Error(gb("yieldWrapGet"))}var sl=je("effect/Utils/isStructuralRegion",()=>({enabled:!1,tester:void 0}));var Jle={effect_internal_function:(e)=>e()},A9e={effect_internal_function:(e)=>{try{return e()}finally{}}},O9e=Jle.effect_internal_function(()=>Error().stack)?.includes("effect_internal_function")===!0,on=O9e?Jle.effect_internal_function:A9e.effect_internal_function,_9e=function*(){}.constructor,Qle=(e)=>Zo(e)&&e.constructor===_9e;var YK=je(Symbol.for("effect/Hash/randomHashCache"),()=>new WeakMap),Ne=Symbol.for("effect/Hash"),oe=(e)=>{if(sl.enabled===!0)return 0;switch(typeof e){case"number":return vh(e);case"bigint":return It(e.toString(10));case"boolean":return It(String(e));case"symbol":return It(String(e));case"string":return It(e);case"undefined":return It("undefined");case"function":case"object":if(e===null)return It("null");else if(e instanceof Date){if(Number.isNaN(e.getTime()))return It("Invalid Date");return oe(e.toISOString())}else if(e instanceof URL)return oe(e.href);else if(v9e(e))return e[Ne]();else return sy(e);default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},sy=(e)=>{if(!YK.has(e))YK.set(e,vh(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)));return YK.get(e)},Ee=(e)=>(t)=>t*53^e,QN=(e)=>e&3221225471|e>>>1&1073741824,v9e=(e)=>de(e,Ne),vh=(e)=>{if(e!==e||e===1/0)return 0;let t=e|0;if(t!==e)t^=e*4294967295;while(e>4294967295)t^=e/=4294967295;return QN(t)},It=(e)=>{let t=5381,r=e.length;while(r)t=t*33^e.charCodeAt(--r);return QN(t)},T9e=(e,t)=>{let r=12289;for(let n=0;n<t.length;n++)r^=d(It(t[n]),Ee(oe(e[t[n]])));return QN(r)},YN=(e)=>T9e(e,Object.keys(e)),il=(e)=>{let t=6151;for(let r=0;r<e.length;r++)t=d(t,Ee(oe(e[r])));return QN(t)},lt=function(){if(arguments.length===1){let r=arguments[0];return function(n){return Object.defineProperty(r,Ne,{value(){return n},enumerable:!1}),n}}let e=arguments[0],t=arguments[1];return Object.defineProperty(e,Ne,{value(){return t},enumerable:!1}),t};var Pe=Symbol.for("effect/Equal");function ge(){if(arguments.length===1)return(e)=>ZN(e,arguments[0]);return ZN(arguments[0],arguments[1])}function ZN(e,t){if(e===t)return!0;let r=typeof e;if(r!==typeof t)return!1;if(r==="object"||r==="function"){if(e!==null&&t!==null){if(iy(e)&&iy(t))if(oe(e)===oe(t)&&e[Pe](t))return!0;else return sl.enabled&&sl.tester?sl.tester(e,t):!1;else if(e instanceof Date&&t instanceof Date){let n=e.getTime(),o=t.getTime();return n===o||Number.isNaN(n)&&Number.isNaN(o)}else if(e instanceof URL&&t instanceof URL)return e.href===t.href}if(sl.enabled){if(e===null||t===null)return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((n,o)=>ZN(n,t[o]));if(Object.getPrototypeOf(e)===Object.prototype&&Object.getPrototypeOf(t)===Object.prototype){let n=Object.keys(e),o=Object.keys(t);if(n.length===o.length){for(let s of n)if(!((s in t)&&ZN(e[s],t[s])))return sl.tester?sl.tester(e,t):!1;return!0}}return sl.tester?sl.tester(e,t):!1}}return sl.enabled&&sl.tester?sl.tester(e,t):!1}var iy=(e)=>de(e,Pe),Th=()=>ge;var kr={};Ht(kr,{BaseProto:()=>al,Class:()=>cl,NodeInspectSymbol:()=>dt,format:()=>Ut,formatDate:()=>rc,formatPropertyKey:()=>Ud,formatUnknown:()=>Uo,isRedactable:()=>XK,redact:()=>ka,stringifyCircular:()=>Wk,symbolRedactable:()=>zk,toJSON:()=>fr,toStringUnknown:()=>ll,withRedactableContext:()=>e4});var dt=Symbol.for("nodejs.util.inspect.custom"),fr=(e)=>{try{if(de(e,"toJSON")&&Xl(e.toJSON)&&e.toJSON.length===0)return e.toJSON();else if(Array.isArray(e))return e.map(fr)}catch{return{}}return ka(e)},ZK="[Circular]";function rc(e){try{return e.toISOString()}catch{return"Invalid Date"}}function R9e(e){try{let t=e.toString();return typeof t==="string"?t:String(t)}catch{return"[toString threw]"}}function Ud(e){return Jr(e)?JSON.stringify(e):String(e)}function Uo(e,t){let r=t?.space??0,n=new WeakSet,o=!r?"":li(r)?" ".repeat(r):r,s=(l)=>o.repeat(l),i=(l,u)=>{let f=l?.constructor;return f&&f!==Object.prototype.constructor&&f.name?`${f.name}(${u})`:u},a=(l)=>{try{return Reflect.ownKeys(l)}catch{return["[ownKeys threw]"]}};function c(l,u=0){if(Array.isArray(l)){if(n.has(l))return ZK;if(n.add(l),!o||l.length<=1)return`[${l.map((h)=>c(h,u)).join(",")}]`;let f=l.map((h)=>c(h,u+1)).join(`,
|
|
147
|
+
`+s(u+1));return`[
|
|
148
|
+
${s(u+1)}${f}
|
|
149
|
+
${s(u)}]`}if(Bk(l))return rc(l);if(!t?.ignoreToString&&de(l,"toString")&&Xl(l.toString)&&l.toString!==Object.prototype.toString&&l.toString!==Array.prototype.toString){let f=R9e(l);if(l instanceof Error&&l.cause)return`${f} (cause: ${c(l.cause,u)})`;return f}if(Jr(l))return JSON.stringify(l);if(li(l)||l==null||ji(l)||Yu(l))return String(l);if(Ld(l))return String(l)+"n";if(l instanceof Set||l instanceof Map){if(n.has(l))return ZK;return n.add(l),`${l.constructor.name}(${c(Array.from(l),u)})`}if(Zo(l)){if(n.has(l))return ZK;n.add(l);let f=a(l);if(!o||f.length<=1){let y=`{${f.map((E)=>`${Ud(E)}:${c(l[E],u)}`).join(",")}}`;return i(l,y)}let h=`{
|
|
150
|
+
${f.map((y)=>`${s(u+1)}${Ud(y)}: ${c(l[y],u+1)}`).join(`,
|
|
151
|
+
`)}
|
|
152
|
+
${s(u)}}`;return i(l,h)}return String(l)}return c(e,0)}var Ut=(e)=>JSON.stringify(e,null,2),al={toJSON(){return fr(this)},[dt](){return this.toJSON()},toString(){return Ut(this.toJSON())}};class cl{[dt](){return this.toJSON()}toString(){return Ut(this.toJSON())}}var ll=(e,t=2)=>{if(typeof e==="string")return e;try{return typeof e==="object"?Wk(e,t):String(e)}catch{return String(e)}},Wk=(e,t)=>{let r=[],n=JSON.stringify(e,(o,s)=>typeof s==="object"&&s!==null?r.includes(s)?void 0:r.push(s)&&(Sb.fiberRefs!==void 0&&XK(s)?s[zk](Sb.fiberRefs):s):s,t);return r=void 0,n},zk=Symbol.for("effect/Inspectable/Redactable"),XK=(e)=>typeof e==="object"&&e!==null&&(zk in e),Sb=je("effect/Inspectable/redactableState",()=>({fiberRefs:void 0})),e4=(e,t)=>{let r=Sb.fiberRefs;Sb.fiberRefs=e;try{return t()}finally{Sb.fiberRefs=r}},ka=(e)=>{if(XK(e)&&Sb.fiberRefs!==void 0)return e[zk](Sb.fiberRefs);return e};var ce=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let r=e;for(let n=0,o=t.length;n<o;n++)r=t[n](r);return r}}};var Eb="Async",Rh="Commit",bn="Failure",$k="OnFailure",jk="OnSuccess",Vk="OnSuccessAndFailure",Cn="Success",XN="Sync",Yle="Tag",Mh="UpdateRuntimeFlags",Gk="While",bb="Iterator",eL="WithRuntime",Kk="Yield",Nv="RevertFlags";var P9e="3.21.2",Uv=()=>P9e;var Xle=Symbol.for("effect/Effect"),Hv=Symbol.for("effect/Stream"),eue=Symbol.for("effect/Sink"),tue=Symbol.for("effect/Channel"),Hd={_R:(e)=>e,_E:(e)=>e,_A:(e)=>e,_V:Uv()},D9e={_A:(e)=>e,_In:(e)=>e,_L:(e)=>e,_E:(e)=>e,_R:(e)=>e},F9e={_Env:(e)=>e,_InErr:(e)=>e,_InElem:(e)=>e,_InDone:(e)=>e,_OutErr:(e)=>e,_OutElem:(e)=>e,_OutDone:(e)=>e},Ph={[Xle]:Hd,[Hv]:Hd,[eue]:D9e,[tue]:F9e,[Pe](e){return this===e},[Ne](){return lt(this,sy(this))},[Symbol.iterator](){return new xb(new yf(this))},pipe(){return ce(this,arguments)}},qd={[Ne](){return lt(this,YN(this))},[Pe](e){let t=Object.keys(this),r=Object.keys(e);if(t.length!==r.length)return!1;for(let n of t)if(!((n in e)&&ge(this[n],e[n])))return!1;return!0}},Sf={...Ph,_op:Rh},tL={...Sf,...qd},rue=function(){function e(){}return e.prototype=Sf,e}(),nue=function(){function e(){}return e.prototype=tL,e}();var oue=Symbol.for("effect/Option"),sue={...Ph,[oue]:{_A:(e)=>e},[dt](){return this.toJSON()},toString(){return Ut(this.toJSON())}},N9e=Object.assign(Object.create(sue),{_tag:"Some",_op:"Some",[Pe](e){return rL(e)&&r4(e)&&ge(this.value,e.value)},[Ne](){return lt(this,Ee(oe(this._tag))(oe(this.value)))},toJSON(){return{_id:"Option",_tag:this._tag,value:fr(this.value)}}}),L9e=oe("None"),U9e=Object.assign(Object.create(sue),{_tag:"None",_op:"None",[Pe](e){return rL(e)&&Ef(e)},[Ne](){return L9e},toJSON(){return{_id:"Option",_tag:this._tag}}}),rL=(e)=>de(e,oue),Ef=(e)=>e._tag==="None",r4=(e)=>e._tag==="Some",ul=Object.create(U9e),ui=(e)=>{let t=Object.create(N9e);return t.value=e,t};var nL=Symbol.for("effect/Either"),iue={...Ph,[nL]:{_R:(e)=>e},[dt](){return this.toJSON()},toString(){return Ut(this.toJSON())}},H9e=Object.assign(Object.create(iue),{_tag:"Right",_op:"Right",[Pe](e){return oL(e)&&sL(e)&&ge(this.right,e.right)},[Ne](){return Ee(oe(this._tag))(oe(this.right))},toJSON(){return{_id:"Either",_tag:this._tag,right:fr(this.right)}}}),q9e=Object.assign(Object.create(iue),{_tag:"Left",_op:"Left",[Pe](e){return oL(e)&&Qk(e)&&ge(this.left,e.left)},[Ne](){return Ee(oe(this._tag))(oe(this.left))},toJSON(){return{_id:"Either",_tag:this._tag,left:fr(this.left)}}}),oL=(e)=>de(e,nL),Qk=(e)=>e._tag==="Left",sL=(e)=>e._tag==="Right",qv=(e)=>{let t=Object.create(q9e);return t.left=e,t},Bv=(e)=>{let t=Object.create(H9e);return t.right=e,t},iL=(e)=>sL(e)?ul:ui(e.left),aL=(e)=>Qk(e)?ul:ui(e.right),aue=p(2,(e,t)=>Ef(e)?qv(t()):Bv(e.value));var B9e=nL,ye=Bv,W9e=ye(void 0);var Ie=qv,z9e=p(2,(e,t)=>e==null?Ie(t(e)):ye(e)),Wv=aue,ay=(e)=>{if(Xl(e))try{return ye(e())}catch(t){return Ie(t)}else try{return ye(e.try())}catch(t){return Ie(e.catch(t))}};var Bd=oL,Sr=Qk,wi=sL,n4=aL,$9e=iL,o4=({left:e,right:t})=>No((r,n)=>Sr(r)?Sr(n)&&e(r.left,n.left):wi(n)&&t(r.right,n.right)),s4=p(2,(e,{onLeft:t,onRight:r})=>Sr(e)?Ie(t(e.left)):ye(r(e.right))),pl=p(2,(e,t)=>Sr(e)?Ie(t(e.left)):ye(e.right)),eu=p(2,(e,t)=>wi(e)?ye(t(e.right)):Ie(e.left)),Ir=p(2,(e,{onLeft:t,onRight:r})=>Sr(e)?t(e.left):r(e.right)),i4=p(3,(e,t,r)=>t(e)?ye(e):Ie(r(e))),j9e=p(3,(e,t,r)=>$v(e,(n)=>t(n)?ye(n):Ie(r(n)))),Cb=Ir({onLeft:te,onRight:te}),a4=p(2,(e,t)=>Sr(e)?t(e.left):e.right),V9e=a4(VN),G9e=a4(Oh),zv=p(2,(e,t)=>{if(wi(e))return e.right;throw t(e.left)}),cL=zv(()=>Error("getOrThrow called on a Left")),K9e=p(2,(e,t)=>Sr(e)?t(e.left):ye(e.right)),$v=p(2,(e,t)=>Sr(e)?Ie(e.left):t(e.right)),J9e=p(2,(e,t)=>$v(e,(r)=>{let n=Xl(t)?t(r):t;return Bd(n)?n:ye(n)})),lue=p(3,(e,t,r)=>$v(e,(n)=>eu(t,(o)=>r(n,o)))),Q9e=p(2,(e,t)=>lue(e,t,(r,n)=>r(n))),Y9e=(e)=>{if(Symbol.iterator in e){let r=[];for(let n of e){if(Sr(n))return n;r.push(n.right)}return ye(r)}let t={};for(let r of Object.keys(e)){let n=e[r];if(Sr(n))return n;t[r]=n.right}return ye(t)},Z9e=(e)=>Sr(e)?ye(e.left):Ie(e.right),X9e=JN(),e7e=(...e)=>{let r=(e.length===1?e[0]:e[1].bind(e[0]))(X9e),n=r.next();while(!n.done){let o=KN(n.value)?n.value.value:yb(n.value);if(Sr(o))return o;n=r.next(o.right)}return ye(n.value)},t7e=ye({}),r7e=oy(eu,$v),n7e=Nd(eu),o7e=Fd(eu);var s7e=(e)=>Ef(e)?ye(ul):eu(e.value,ui),i7e=p(2,(e,t)=>Ef(e)?ye(ul):eu(t(e.value),ui));var Yk=(e)=>e.length>0;var q={};Ht(q,{Do:()=>D7e,TypeId:()=>l7e,all:()=>gue,andThen:()=>y7e,ap:()=>k7e,as:()=>due,asVoid:()=>g7e,bind:()=>P7e,bindTo:()=>R7e,composeK:()=>C7e,contains:()=>m4,containsWith:()=>yue,exists:()=>h4,filter:()=>Vi,filterMap:()=>xue,firstSomeOf:()=>m7e,flatMap:()=>Qn,flatMapNullable:()=>u4,flatten:()=>S7e,fromIterable:()=>p7e,fromNullable:()=>Ft,gen:()=>N7e,getEquivalence:()=>d4,getLeft:()=>f7e,getOrElse:()=>Je,getOrNull:()=>pL,getOrThrow:()=>ru,getOrThrowWith:()=>fL,getOrUndefined:()=>Ar,getOrder:()=>O7e,getRight:()=>uL,isNone:()=>vt,isOption:()=>Lh,isSome:()=>Oe,let:()=>M7e,lift2:()=>_7e,liftNullable:()=>h7e,liftPredicate:()=>v7e,liftThrowable:()=>Uh,map:()=>jt,match:()=>be,mergeWith:()=>jd,none:()=>R,orElse:()=>pi,orElseEither:()=>d7e,orElseSome:()=>l4,partitionMap:()=>A7e,product:()=>hue,productMany:()=>w7e,reduceCompact:()=>I7e,some:()=>_,tap:()=>mue,toArray:()=>f4,toRefinement:()=>u7e,void:()=>x7e,zipLeft:()=>b7e,zipRight:()=>E7e,zipWith:()=>p4});var nc=(e)=>(t,r)=>t===r?0:e(t,r),lL=nc((e,t)=>e<t?-1:1),jv=nc((e,t)=>e<t?-1:1),c4=nc((e,t)=>e<t?-1:1),Zk=nc((e,t)=>e<t?-1:1);var a7e=p(2,(e,t)=>nc((r,n)=>{let o=e(r,n);if(o!==0)return o;for(let s of t)if(o=s(r,n),o!==0)return o;return o})),c7e=()=>nc(()=>0),pue=(e)=>a7e(c7e(),e),bf=p(2,(e,t)=>nc((r,n)=>e(t(r),t(n))));var fue=(e)=>nc((t,r)=>{let n=t.length,o=r.length,s=Math.min(n,o);for(let i=0;i<s;i++){let a=e(t[i],r[i]);if(a!==0)return a}return jv(n,o)});var Dh=(e)=>p(2,(t,r)=>e(t,r)===-1),Fh=(e)=>p(2,(t,r)=>e(t,r)===1),cy=(e)=>p(2,(t,r)=>e(t,r)!==1),Nh=(e)=>p(2,(t,r)=>e(t,r)!==-1),Wd=(e)=>p(2,(t,r)=>t===r||e(t,r)<1?t:r),zd=(e)=>p(2,(t,r)=>t===r||e(t,r)>-1?t:r),$d=(e)=>p(2,(t,r)=>Wd(e)(r.maximum,zd(e)(r.minimum,t))),ly=(e)=>p(2,(t,r)=>!Dh(e)(t,r.minimum)&&!Fh(e)(t,r.maximum));var l7e=Symbol.for("effect/Option"),R=()=>ul,_=ui,Lh=rL,vt=Ef,Oe=r4,be=p(2,(e,{onNone:t,onSome:r})=>vt(e)?t():r(e.value)),u7e=(e)=>(t)=>Oe(e(t)),p7e=(e)=>{for(let t of e)return _(t);return R()},uL=aL,f7e=iL,Je=p(2,(e,t)=>vt(e)?t():e.value),pi=p(2,(e,t)=>vt(e)?t():e),l4=p(2,(e,t)=>vt(e)?_(t()):e),d7e=p(2,(e,t)=>vt(e)?jt(t(),Bv):jt(e,qv)),m7e=(e)=>{let t=R();for(t of e)if(Oe(t))return t;return t},Ft=(e)=>e==null?R():_(e),h7e=(e)=>(...t)=>Ft(e(...t)),pL=Je(VN),Ar=Je(Oh),Uh=(e)=>(...t)=>{try{return _(e(...t))}catch{return R()}},fL=p(2,(e,t)=>{if(Oe(e))return e.value;throw t()}),ru=fL(()=>Error("getOrThrow called on a None")),jt=p(2,(e,t)=>vt(e)?R():_(t(e.value))),due=p(2,(e,t)=>jt(e,()=>t)),g7e=due(void 0),x7e=_(void 0);var Qn=p(2,(e,t)=>vt(e)?R():t(e.value)),y7e=p(2,(e,t)=>Qn(e,(r)=>{let n=jN(t)?t(r):t;return Lh(n)?n:_(n)})),u4=p(2,(e,t)=>vt(e)?R():Ft(t(e.value))),S7e=Qn(te),E7e=p(2,(e,t)=>Qn(e,()=>t)),b7e=p(2,(e,t)=>mue(e,()=>t)),C7e=p(2,(e,t)=>(r)=>Qn(e(r),t)),mue=p(2,(e,t)=>Qn(e,(r)=>jt(t(r),()=>r))),hue=(e,t)=>Oe(e)&&Oe(t)?_([e.value,t.value]):R(),w7e=(e,t)=>{if(vt(e))return R();let r=[e.value];for(let n of t){if(vt(n))return R();r.push(n.value)}return _(r)},gue=(e)=>{if(Symbol.iterator in e){let r=[];for(let n of e){if(vt(n))return R();r.push(n.value)}return _(r)}let t={};for(let r of Object.keys(e)){let n=e[r];if(vt(n))return R();t[r]=n.value}return _(t)},p4=p(3,(e,t,r)=>jt(hue(e,t),([n,o])=>r(n,o))),k7e=p(2,(e,t)=>p4(e,t,(r,n)=>r(n))),I7e=p(3,(e,t,r)=>{let n=t;for(let o of e)if(Oe(o))n=r(n,o.value);return n}),f4=(e)=>vt(e)?[]:[e.value],A7e=p(2,(e,t)=>{if(vt(e))return[R(),R()];let r=t(e.value);return Qk(r)?[_(r.left),R()]:[R(),_(r.right)]}),xue=Qn,Vi=p(2,(e,t)=>xue(e,(r)=>t(r)?ui(r):ul)),d4=(e)=>No((t,r)=>vt(t)?vt(r):vt(r)?!1:e(t.value,r.value)),O7e=(e)=>nc((t,r)=>Oe(t)?Oe(r)?e(t.value,r.value):1:-1),_7e=(e)=>p(2,(t,r)=>p4(t,r,e)),v7e=p(2,(e,t)=>t(e)?_(e):R()),yue=(e)=>p(2,(t,r)=>vt(t)?!1:e(t.value,r)),T7e=Th(),m4=yue(T7e),h4=p(2,(e,t)=>vt(e)?!1:t(e.value)),R7e=Nd(jt),M7e=Fd(jt);var P7e=oy(jt,Qn),D7e=_({}),F7e=JN(),N7e=(...e)=>{let r=(e.length===1?e[0]:e[1].bind(e[0]))(F7e),n=r.next();while(!n.done){let o=KN(n.value)?n.value.value:yb(n.value);if(vt(o))return o;n=r.next(o.value)}return _(n.value)},jd=(e)=>(t,r)=>{if(vt(t))return r;else if(vt(r))return t;return _(e(t.value,r.value))};var dL=(...e)=>e;var Eue=(e)=>{let r=e[Symbol.iterator]().next();if(r.done)throw Error("unsafeHead: empty iterable");return r.value};var bue=p(2,(e,t)=>{let r=0;for(let n of e){let o=t(n,r);if(ji(o)){if(o)return _(n)}else if(Oe(o))return o;r++}return R()});var L7e={[Symbol.iterator](){return U7e}},U7e={next(){return{done:!0,value:void 0}}},Cue=()=>L7e;var fl={};Ht(fl,{collect:()=>g4,difference:()=>cZe,empty:()=>ep,every:()=>oZe,filter:()=>K7e,filterMap:()=>Oue,findFirst:()=>pZe,fromEntries:()=>B7e,fromIterableBy:()=>q7e,fromIterableWith:()=>kue,get:()=>Iue,getEquivalence:()=>lZe,getLefts:()=>Q7e,getRights:()=>Y7e,getSomes:()=>J7e,has:()=>vc,intersection:()=>aZe,isEmptyReadonlyRecord:()=>H7e,isEmptyRecord:()=>Cf,isSubrecord:()=>rZe,isSubrecordBy:()=>E4,keys:()=>ps,map:()=>S4,mapEntries:()=>G7e,mapKeys:()=>V7e,modify:()=>z7e,modifyOption:()=>Aue,partition:()=>X7e,partitionMap:()=>_ue,pop:()=>j7e,reduce:()=>nZe,remove:()=>y4,replace:()=>tZe,replaceOption:()=>$7e,separate:()=>Z7e,set:()=>vue,singleton:()=>uZe,size:()=>W7e,some:()=>sZe,toEntries:()=>x4,union:()=>iZe,values:()=>eZe});var ep=()=>({}),Cf=(e)=>ps(e).length===0,H7e=Cf,kue=p(2,(e,t)=>{let r=ep();for(let n of e){let[o,s]=t(n);r[o]=s}return r}),q7e=(e,t)=>kue(e,(r)=>[t(r),r]),B7e=Object.fromEntries,g4=p(2,(e,t)=>{let r=[];for(let n of ps(e))r.push(t(n,e[n]));return r}),x4=g4((e,t)=>[e,t]),W7e=(e)=>ps(e).length,vc=p(2,(e,t)=>Object.prototype.hasOwnProperty.call(e,t)),Iue=p(2,(e,t)=>vc(e,t)?_(e[t]):R()),z7e=p(3,(e,t,r)=>{if(!vc(e,t))return{...e};return{...e,[t]:r(e[t])}}),Aue=p(3,(e,t,r)=>{if(!vc(e,t))return R();return _({...e,[t]:r(e[t])})}),$7e=p(3,(e,t,r)=>Aue(e,t,()=>r)),y4=p(2,(e,t)=>{if(!vc(e,t))return{...e};let r={...e};return delete r[t],r}),j7e=p(2,(e,t)=>vc(e,t)?_([e[t],y4(e,t)]):R()),S4=p(2,(e,t)=>{let r={...e};for(let n of ps(e))r[n]=t(e[n],n);return r}),V7e=p(2,(e,t)=>{let r={};for(let n of ps(e)){let o=e[n];r[t(n,o)]=o}return r}),G7e=p(2,(e,t)=>{let r={};for(let n of ps(e)){let[o,s]=t(e[n],n);r[o]=s}return r}),Oue=p(2,(e,t)=>{let r=ep();for(let n of ps(e)){let o=t(e[n],n);if(Oe(o))r[n]=o.value}return r}),K7e=p(2,(e,t)=>{let r=ep();for(let n of ps(e))if(t(e[n],n))r[n]=e[n];return r}),J7e=Oue(te),Q7e=(e)=>{let t=ep();for(let r of ps(e)){let n=e[r];if(Sr(n))t[r]=n.left}return t},Y7e=(e)=>{let t=ep();for(let r of ps(e)){let n=e[r];if(wi(n))t[r]=n.right}return t},_ue=p(2,(e,t)=>{let r=ep(),n=ep();for(let o of ps(e)){let s=t(e[o],o);if(Sr(s))r[o]=s.left;else n[o]=s.right}return[r,n]}),Z7e=_ue(te),X7e=p(2,(e,t)=>{let r=ep(),n=ep();for(let o of ps(e))if(t(e[o],o))n[o]=e[o];else r[o]=e[o];return[r,n]}),ps=(e)=>Object.keys(e),eZe=(e)=>g4(e,(t,r)=>r),vue=p(3,(e,t,r)=>({...e,[t]:r})),tZe=p(3,(e,t,r)=>{if(vc(e,t))return{...e,[t]:r};return{...e}}),E4=(e)=>p(2,(t,r)=>{for(let n of ps(t))if(!vc(r,n)||!e(t[n],r[n]))return!1;return!0}),rZe=E4(Th()),nZe=p(3,(e,t,r)=>{let n=t;for(let o of ps(e))n=r(n,e[o],o);return n}),oZe=p(2,(e,t)=>{for(let r of ps(e))if(!t(e[r],r))return!1;return!0}),sZe=p(2,(e,t)=>{for(let r of ps(e))if(t(e[r],r))return!0;return!1}),iZe=p(3,(e,t,r)=>{if(Cf(e))return{...t};if(Cf(t))return{...e};let n=ep();for(let o of ps(e))if(vc(t,o))n[o]=r(e[o],t[o]);else n[o]=e[o];for(let o of ps(t))if(!vc(n,o))n[o]=t[o];return n}),aZe=p(3,(e,t,r)=>{let n=ep();if(Cf(e)||Cf(t))return n;for(let o of ps(e))if(vc(t,o))n[o]=r(e[o],t[o]);return n}),cZe=p(2,(e,t)=>{if(Cf(e))return{...t};if(Cf(t))return{...e};let r={};for(let n of ps(e))if(!vc(t,n))r[n]=e[n];for(let n of ps(t))if(!vc(e,n))r[n]=t[n];return r}),lZe=(e)=>{let t=E4(e);return(r,n)=>t(r,n)&&t(n,r)},uZe=(e,t)=>({[e]:t}),pZe=p(2,(e,t)=>{let r=ps(e);for(let n=0;n<r.length;n++){let o=r[n];if(t(e[o],o))return _([o,e[o]])}return R()});var Xo=(...e)=>e,Vd=(e)=>Array(e),Hh=p(2,(e,t)=>{let r=Math.max(1,Math.floor(e)),n=Array(r);for(let o=0;o<r;o++)n[o]=t(o);return n}),fZe=(e,t)=>e<=t?Hh(t-e+1,(r)=>e+r):[e],dZe=p(2,(e,t)=>Hh(t,()=>e)),De=(e)=>Array.isArray(e)?e:Array.from(e),uy=(e)=>Array.isArray(e)?e:[e],mZe=x4,Tue=f4,es=p(2,(e,{onEmpty:t,onNonEmpty:r})=>ut(e)?r(e):t()),Gi=p(2,(e,{onEmpty:t,onNonEmpty:r})=>ut(e)?r(jr(e),ts(e)):t()),b4=p(2,(e,{onEmpty:t,onNonEmpty:r})=>ut(e)?r(Gv(e),Ib(e)):t()),Ia=p(2,(e,t)=>[t,...e]),hZe=p(2,(e,t)=>De(t).concat(De(e))),Yn=p(2,(e,t)=>[...e,t]),xt=p(2,(e,t)=>De(e).concat(De(t))),gZe=p(3,(e,t,r)=>{let n=[t],o=0;for(let s of e)n[o+1]=r(n[o],s),o++;return n}),xZe=p(3,(e,t,r)=>{let n=De(e),o=Array(n.length+1);o[n.length]=t;for(let s=n.length-1;s>=0;s--)o[s]=r(o[s+1],n[s]);return o}),Gd=Array.isArray,Rue=(e)=>e.length===0,fs=Rue,tp=Yk,ut=Yk,yZe=(e)=>e.length,wb=(e,t)=>e<0||e>=t.length,mL=(e,t)=>Math.floor(Math.min(Math.max(0,e),t.length)),Mue=p(2,(e,t)=>{let r=Math.floor(t);return wb(r,e)?R():_(e[r])}),kb=p(2,(e,t)=>{let r=Math.floor(t);if(wb(r,e))throw Error(`Index ${r} out of bounds`);return e[r]}),SZe=(e)=>[jr(e),ts(e)],EZe=(e)=>[Gv(e),Ib(e)],Ki=Mue(0),jr=kb(0),Vv=(e)=>ut(e)?_(Ib(e)):R(),Ib=(e)=>e[e.length-1],bZe=(e)=>{let t=De(e);return ut(t)?_(ts(t)):R()},ts=(e)=>e.slice(1),CZe=(e)=>{let t=De(e);return ut(t)?_(Gv(t)):R()},Gv=(e)=>e.slice(0,-1),Kv=p(2,(e,t)=>{let r=De(e);return r.slice(0,mL(t,r))}),wZe=p(2,(e,t)=>{let r=De(e),n=mL(t,r);return n===0?[]:r.slice(-n)}),kZe=p(2,(e,t)=>{let r=0,n=[];for(let o of e){if(!t(o,r))break;n.push(o),r++}return n}),Pue=(e,t)=>{let r=0;for(let n of e){if(!t(n,r))break;r++}return r},qh=p(2,(e,t)=>rI(e,Pue(e,t))),wf=p(2,(e,t)=>{let r=De(e);return r.slice(mL(t,r),r.length)}),IZe=p(2,(e,t)=>{let r=De(e);return r.slice(0,r.length-mL(t,r))}),AZe=p(2,(e,t)=>De(e).slice(Pue(e,t))),Xk=p(2,(e,t)=>{let r=0;for(let n of e){if(t(n,r))return _(r);r++}return R()}),C4=p(2,(e,t)=>{let r=De(e);for(let n=r.length-1;n>=0;n--)if(t(r[n],n))return _(n);return R()}),Kd=bue,eI=p(2,(e,t)=>{let r=De(e);for(let n=r.length-1;n>=0;n--){let o=r[n],s=t(o,n);if(ji(s)){if(s)return _(o)}else if(Oe(s))return s}return R()}),OZe=p(2,(e,t)=>{let r=0;for(let n of e){let o=t(n,r);if(ji(o)){if(o)return _([n,r])}else if(Oe(o))return _([o.value,r]);r++}return R()}),_Ze=p(2,(e,t)=>{let r=0,n=De(e);for(let o=0;o<n.length;o++){let s=n[o];if(t(s,o))r++}return r}),vZe=p(3,(e,t,r)=>{let n=Array.from(e);if(t<0||t>n.length)return R();return n.splice(t,0,r),_(n)}),TZe=p(3,(e,t,r)=>hL(e,t,()=>r)),RZe=p(3,(e,t,r)=>Due(e,t,()=>r)),hL=p(3,(e,t,r)=>{let n=Array.from(e);if(wb(t,n))return n;let o=r(n[t]);return n[t]=o,n}),Due=p(3,(e,t,r)=>{let n=De(e);if(wb(t,n))return R();let o=Array.isArray(e)?e.slice():n,s=r(n[t]);return o[t]=s,_(o)}),gL=p(2,(e,t)=>{let r=Array.from(e);if(wb(t,r))return r;return r.splice(t,1),r}),MZe=p(2,(e,t)=>{let r=De(e);if(wb(t,r))return R();let n=Array.isArray(e)?e.slice():r;return n.splice(t,1),_(n)}),Jv=(e)=>Array.from(e).reverse(),Aa=p(2,(e,t)=>{let r=Array.from(e);return r.sort(t),r}),PZe=p(3,(e,t,r)=>Array.from(e).map((n)=>[n,t(n)]).sort(([,n],[,o])=>r(n,o)).map(([n])=>n)),DZe=(...e)=>{let t=Aa(pue(e));return(r)=>{let n=De(r);if(ut(n))return t(n);return[]}},xL=p(2,(e,t)=>Qv(e,t,dL)),Qv=p(3,(e,t,r)=>{let n=De(e),o=De(t);if(ut(n)&&ut(o)){let s=[r(jr(n),jr(o))],i=Math.min(n.length,o.length);for(let a=1;a<i;a++)s[a]=r(n[a],o[a]);return s}return[]}),w4=(e)=>{let t=De(e);if(ut(t)){let r=[t[0][0]],n=[t[0][1]];for(let o=1;o<t.length;o++)r[o]=t[o][0],n[o]=t[o][1];return[r,n]}return[[],[]]},FZe=p(2,(e,t)=>{let r=De(e);if(ut(r)){let n=[jr(r)],o=ts(r);for(let s=0;s<o.length;s++){if(s<o.length)n.push(t);n.push(o[s])}return n}return[]}),Fue=p(2,(e,t)=>[t(jr(e)),...ts(e)]),NZe=p(2,(e,t)=>Fue(e,()=>t)),Nue=p(2,(e,t)=>Yn(Gv(e),t(Ib(e)))),LZe=p(2,(e,t)=>Nue(e,()=>t)),Lue=p(2,(e,t)=>{let r=De(e);if(ut(r)){let n=r.length,o=Math.round(t)%n;if(wb(Math.abs(o),r)||o===0)return py(r);if(o<0){let[s,i]=SL(r,-o);return xt(i,s)}else return Lue(e,o-n)}return[]}),tI=(e)=>p(2,(t,r)=>{for(let n of t)if(e(r,n))return!0;return!1}),yL=Th(),oc=tI(yL),k4=p(2,(e,t)=>{let r=De(e);if(ut(r)){let[n,o]=t(r),s=[n],i=o;while(Yk(i)){let[a,c]=t(i);s.push(a),i=c}return s}return[]}),rI=p(2,(e,t)=>{let r=Array.from(e),n=Math.floor(t);if(ut(r)){if(n>=1)return SL(r,n);return[[],r]}return[r,[]]}),SL=p(2,(e,t)=>{let r=Math.max(1,Math.floor(t));return r>=e.length?[py(e),[]]:[Ia(e.slice(1,r),jr(e)),e.slice(r)]}),UZe=p(2,(e,t)=>{let r=De(e);return Uue(r,Math.ceil(r.length/Math.floor(t)))}),HZe=p(2,(e,t)=>qh(e,(r,n)=>!t(r,n))),py=(e)=>e.slice(),qZe=p(3,(e,t,r)=>{if(e.length>=t)return Kv(e,t);return xt(e,Hh(t-e.length,()=>r))}),Uue=p(2,(e,t)=>{let r=De(e);if(ut(r))return k4(r,SL(t));return[]}),BZe=p(2,(e,t)=>{let r=De(e);if(t>0&&ut(r))return Array.from({length:r.length-(t-1)},(n,o)=>r.slice(o,o+t));return[]}),Hue=p(2,(e,t)=>k4(e,(r)=>{let n=jr(r),o=[n],s=1;for(;s<r.length;s++){let i=r[s];if(t(i,n))o.push(i);else break}return[o,r.slice(s)]})),WZe=Hue(Th()),zZe=p(2,(e,t)=>{let r={};for(let n of e){let o=t(n);if(Object.prototype.hasOwnProperty.call(r,o))r[o].push(n);else r[o]=[n]}return r}),que=p(3,(e,t,r)=>{let n=De(e),o=De(t);if(ut(n)){if(ut(o))return R4(r)(xt(n,o));return n}return o}),nu=p(2,(e,t)=>que(e,t,yL)),EL=(e)=>{let t=tI(e);return p(2,(r,n)=>{let o=De(n);return De(r).filter((s)=>t(o,s))})},Yv=EL(yL),bL=(e)=>{let t=tI(e);return p(2,(r,n)=>{let o=De(n);return De(r).filter((s)=>!t(o,s))})},I4=bL(yL),Ge=()=>[],tt=(e)=>[e],Ke=p(2,(e,t)=>e.map(t)),Ho=p(2,(e,t)=>{if(fs(e))return[];let r=[];for(let n=0;n<e.length;n++){let o=t(e[n],n);for(let s=0;s<o.length;s++)r.push(o[s])}return r}),Ab=Ho(te),Tc=p(2,(e,t)=>{let r=De(e),n=[];for(let o=0;o<r.length;o++){let s=t(r[o],o);if(Oe(s))n.push(s.value)}return n}),A4=p(2,(e,t)=>{let r=0,n=[];for(let o of e){let s=t(o,r);if(Oe(s))n.push(s.value);else break;r++}return n}),nI=p(2,(e,t)=>{let r=[],n=[],o=De(e);for(let s=0;s<o.length;s++){let i=t(o[s],s);if(Sr(i))r.push(i.left);else n.push(i.right)}return[r,n]}),Jd=Tc(te),$Ze=(e)=>{let t=[];for(let r of e)if(Sr(r))t.push(r.left);return t},jZe=(e)=>{let t=[];for(let r of e)if(wi(r))t.push(r.right);return t},Qd=p(2,(e,t)=>{let r=De(e),n=[];for(let o=0;o<r.length;o++)if(t(r[o],o))n.push(r[o]);return n}),O4=p(2,(e,t)=>{let r=[],n=[],o=De(e);for(let s=0;s<o.length;s++)if(t(o[s],s))n.push(o[s]);else r.push(o[s]);return[r,n]}),_4=nI(te),ki=p(3,(e,t,r)=>De(e).reduce((n,o,s)=>r(n,o,s),t)),dl=p(3,(e,t,r)=>De(e).reduceRight((n,o,s)=>r(n,o,s),t)),VZe=(e)=>(t)=>e(t)?[t]:[],GZe=(e)=>(...t)=>Tue(e(...t)),v4=(e)=>e==null?Ge():[e],KZe=(e)=>(...t)=>v4(e(...t)),JZe=p(2,(e,t)=>Ho(e,(r)=>v4(t(r)))),QZe=(e)=>(...t)=>{let r=e(...t);return Sr(r)?[]:[r.right]},Zv=p(2,(e,t)=>e.every(t)),T4=p(2,(e,t)=>e.some(t)),YZe=p(2,(e,t)=>e.map((r,n,o)=>t(o.slice(n)))),ZZe=p(2,(e,t)=>e.reduce(Wd(t))),XZe=p(2,(e,t)=>e.reduce(zd(t))),CL=(e,t)=>{let r=[],n=e,o;while(Oe(o=t(n))){let[s,i]=o.value;r.push(s),n=i}return r},eXe=fue,Ji=Ule,tXe=p(2,(e,t)=>De(e).forEach((r,n)=>t(r,n))),R4=p(2,(e,t)=>{let r=De(e);if(ut(r)){let n=[jr(r)],o=ts(r);for(let s of o)if(n.every((i)=>!t(s,i)))n.push(s);return n}return[]}),Xv=(e)=>R4(e,Th()),Bue=p(2,(e,t)=>{let r=[],n=R();for(let o of e)if(vt(n)||!t(o,n.value))r.push(o),n=_(o);return r}),M4=Bue(Th()),Xt=p(2,(e,t)=>De(e).join(t)),P4=p(3,(e,t,r)=>{let n=0,o=t,s=[];for(let i of e){let a=r(o,i,n);o=a[0],s.push(a[1]),n++}return[o,s]}),Wue=p(3,(e,t,r)=>Ho(e,(n)=>Ke(t,(o)=>r(n,o)))),rXe=p(2,(e,t)=>Wue(e,t,(r,n)=>[r,n])),nXe=tt({}),oXe=oy(Ke,Ho),sXe=Nd(Ke),iXe=Fd(Ke);var wL="And",kL="Or",IL="InvalidData",AL="MissingData",OL="SourceUnavailable",_L="Unsupported";var cXe="effect/ConfigError",vL=Symbol.for(cXe),oI={_tag:"ConfigError",[vL]:vL},TL=(e,t)=>{let r=Object.create(oI);return r._op=wL,r.left=e,r.right=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`${this.left} and ${this.right}`}}),Object.defineProperty(r,"message",{enumerable:!1,get(){return this.toString()}}),r},RL=(e,t)=>{let r=Object.create(oI);return r._op=kL,r.left=e,r.right=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`${this.left} or ${this.right}`}}),Object.defineProperty(r,"message",{enumerable:!1,get(){return this.toString()}}),r},sc=(e,t,r={pathDelim:"."})=>{let n=Object.create(oI);return n._op=IL,n.path=e,n.message=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`(Invalid data at ${d(this.path,Xt(r.pathDelim))}: "${this.message}")`}}),n},rp=(e,t,r={pathDelim:"."})=>{let n=Object.create(oI);return n._op=AL,n.path=e,n.message=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`(Missing data at ${d(this.path,Xt(r.pathDelim))}: "${this.message}")`}}),n},zue=(e,t,r,n={pathDelim:"."})=>{let o=Object.create(oI);return o._op=OL,o.path=e,o.message=t,o.cause=r,Object.defineProperty(o,"toString",{enumerable:!1,value(){return`(Source unavailable at ${d(this.path,Xt(n.pathDelim))}: "${this.message}")`}}),o},ML=(e,t,r={pathDelim:"."})=>{let n=Object.create(oI);return n._op=_L,n.path=e,n.message=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`(Unsupported operation at ${d(this.path,Xt(r.pathDelim))}: "${this.message}")`}}),n},$ue=(e)=>de(e,vL);var Bh=p(2,(e,t)=>{switch(e._op){case wL:return TL(Bh(e.left,t),Bh(e.right,t));case kL:return RL(Bh(e.left,t),Bh(e.right,t));case IL:return sc([...t,...e.path],e.message);case AL:return rp([...t,...e.path],e.message);case OL:return zue([...t,...e.path],e.message,e.cause);case _L:return ML([...t,...e.path],e.message)}}),lXe={andCase:(e,t,r)=>t&&r,orCase:(e,t,r)=>t&&r,invalidDataCase:Fo,missingDataCase:uo,sourceUnavailableCase:Fo,unsupportedCase:Fo},jue=p(3,(e,t,r)=>{let n=[e],o=[];while(n.length>0){let i=n.pop();switch(i._op){case wL:{n.push(i.right),n.push(i.left),o.push(Ie({_op:"AndCase"}));break}case kL:{n.push(i.right),n.push(i.left),o.push(Ie({_op:"OrCase"}));break}case IL:{o.push(ye(r.invalidDataCase(t,i.path,i.message)));break}case AL:{o.push(ye(r.missingDataCase(t,i.path,i.message)));break}case OL:{o.push(ye(r.sourceUnavailableCase(t,i.path,i.message,i.cause)));break}case _L:{o.push(ye(r.unsupportedCase(t,i.path,i.message)));break}}}let s=[];while(o.length>0){let i=o.pop();switch(i._op){case"Left":{switch(i.left._op){case"AndCase":{let a=s.pop(),c=s.pop(),l=r.andCase(t,a,c);s.push(l);break}case"OrCase":{let a=s.pop(),c=s.pop(),l=r.orCase(t,a,c);s.push(l);break}}break}case"Right":{s.push(i.right);break}}}if(s.length===0)throw Error("BUG: ConfigError.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return s.pop()}),Vue=(e)=>jue(e,void 0,lXe);var Gue=sc;var Kue=$ue;var Ob=Vue;var ft={};Ht(ft,{Console:()=>Zit,TypeId:()=>Yit,assert:()=>rat,clear:()=>nat,consoleWith:()=>tat,count:()=>oat,countReset:()=>sat,debug:()=>iat,dir:()=>aat,dirxml:()=>cat,error:()=>$5,group:()=>lat,info:()=>uat,log:()=>Ao,setConsole:()=>eat,table:()=>pat,time:()=>fat,timeLog:()=>dat,trace:()=>mat,warn:()=>hat,withConsole:()=>Xit,withGroup:()=>gat,withTime:()=>xat});var Bt={};Ht(Bt,{GenericTag:()=>qt,Reference:()=>ko,ReferenceTypeId:()=>xXe,Tag:()=>Gs,TagTypeId:()=>gXe,add:()=>or,empty:()=>Tn,get:()=>er,getOption:()=>ws,getOrElse:()=>SXe,isContext:()=>eT,isReference:()=>yXe,isTag:()=>aI,make:()=>_a,merge:()=>Rn,mergeAll:()=>H4,omit:()=>UL,pick:()=>EXe,unsafeGet:()=>qo,unsafeMake:()=>Oa});var FL=Symbol.for("effect/Context/Tag"),sI=Symbol.for("effect/Context/Reference"),uXe="effect/STM",pXe=Symbol.for(uXe),iI={...Ph,_op:"Tag",[pXe]:Hd,[FL]:{_Service:(e)=>e,_Identifier:(e)=>e},toString(){return Ut(this.toJSON())},toJSON(){return{_id:"Tag",key:this.key,stack:this.stack}},[dt](){return this.toJSON()},of(e){return e},context(e){return L4(this,e)}},fXe={...iI,[sI]:sI},Jue=(e)=>{let t=Error.stackTraceLimit;Error.stackTraceLimit=2;let r=Error();Error.stackTraceLimit=t;let n=Object.create(iI);return Object.defineProperty(n,"stack",{get(){return r.stack}}),n.key=e,n},Que=(e)=>()=>{let t=Error.stackTraceLimit;Error.stackTraceLimit=2;let r=Error();Error.stackTraceLimit=t;function n(){}return Object.setPrototypeOf(n,iI),n.key=e,Object.defineProperty(n,"stack",{get(){return r.stack}}),n},Yue=()=>(e,t)=>{let r=Error.stackTraceLimit;Error.stackTraceLimit=2;let n=Error();Error.stackTraceLimit=r;function o(){}return Object.setPrototypeOf(o,fXe),o.key=e,o.defaultValue=t.defaultValue,Object.defineProperty(o,"stack",{get(){return n.stack}}),o},F4=Symbol.for("effect/Context"),dXe={[F4]:{_Services:(e)=>e},[Pe](e){if(N4(e)){if(this.unsafeMap.size===e.unsafeMap.size){for(let t of this.unsafeMap.keys())if(!e.unsafeMap.has(t)||!ge(this.unsafeMap.get(t),e.unsafeMap.get(t)))return!1;return!0}}return!1},[Ne](){return lt(this,vh(this.unsafeMap.size))},pipe(){return ce(this,arguments)},toString(){return Ut(this.toJSON())},toJSON(){return{_id:"Context",services:Array.from(this.unsafeMap).map(fr)}},[dt](){return this.toJSON()}},np=(e)=>{let t=Object.create(dXe);return t.unsafeMap=e,t},mXe=(e)=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(e.stack){let r=e.stack.split(`
|
|
153
|
+
`);if(r.length>2){let n=r[2].match(/at (.*)/);if(n)t.message=t.message+` (defined at ${n[1]})`}}if(t.stack){let r=t.stack.split(`
|
|
154
|
+
`);r.splice(1,3),t.stack=r.join(`
|
|
155
|
+
`)}return t},N4=(e)=>de(e,F4),Zue=(e)=>de(e,FL),NL=(e)=>de(e,sI),hXe=np(new Map),Xue=()=>hXe,L4=(e,t)=>np(new Map([[e.key,t]])),epe=p(3,(e,t,r)=>{let n=new Map(e.unsafeMap);return n.set(t.key,r),np(n)}),D4=je("effect/Context/defaultValueCache",()=>new Map),LL=(e)=>{if(D4.has(e.key))return D4.get(e.key);let t=e.defaultValue();return D4.set(e.key,t),t},tpe=(e,t)=>e.unsafeMap.has(t.key)?e.unsafeMap.get(t.key):LL(t),U4=p(2,(e,t)=>{if(!e.unsafeMap.has(t.key)){if(sI in t)return LL(t);throw mXe(t)}return e.unsafeMap.get(t.key)}),rpe=U4,npe=p(3,(e,t,r)=>{if(!e.unsafeMap.has(t.key))return NL(t)?LL(t):r();return e.unsafeMap.get(t.key)}),ope=p(2,(e,t)=>{if(!e.unsafeMap.has(t.key))return NL(t)?ui(LL(t)):ul;return ui(e.unsafeMap.get(t.key))}),spe=p(2,(e,t)=>{let r=new Map(e.unsafeMap);for(let[n,o]of t.unsafeMap)r.set(n,o);return np(r)}),ipe=(...e)=>{let t=new Map;for(let r=0;r<e.length;r++)e[r].unsafeMap.forEach((n,o)=>{t.set(o,n)});return np(t)},ape=(...e)=>(t)=>{let r=new Set(e.map((o)=>o.key)),n=new Map;for(let[o,s]of t.unsafeMap.entries())if(r.has(o))n.set(o,s);return np(n)},cpe=(...e)=>(t)=>{let r=new Map(t.unsafeMap);for(let n of e)r.delete(n.key);return np(r)};var gXe=FL,xXe=sI,qt=Jue;var Oa=np,eT=N4,aI=Zue,yXe=NL,Tn=Xue,_a=L4,or=epe,er=rpe,SXe=npe,qo=U4,ws=ope,Rn=spe,H4=ipe,EXe=ape,UL=cpe,Gs=Que,ko=Yue;var Nr={};Ht(Nr,{append:()=>Is,appendAll:()=>Vt,chunksOf:()=>fpe,compact:()=>vXe,contains:()=>JXe,containsWith:()=>QXe,dedupe:()=>BXe,dedupeAdjacent:()=>WXe,difference:()=>net,differenceWith:()=>ret,drop:()=>Zr,dropRight:()=>OXe,dropWhile:()=>HL,empty:()=>Ze,every:()=>eet,filter:()=>sp,filterMap:()=>fy,filterMapWhile:()=>W4,findFirst:()=>$L,findFirstIndex:()=>YXe,findLast:()=>ZXe,findLastIndex:()=>XXe,flatMap:()=>qL,flatten:()=>nT,forEach:()=>lI,fromIterable:()=>Fr,get:()=>B4,getEquivalence:()=>tT,head:()=>If,headNonEmpty:()=>Ai,intersection:()=>TXe,isChunk:()=>Yd,isEmpty:()=>At,isNonEmpty:()=>kn,join:()=>tet,last:()=>oT,lastNonEmpty:()=>RXe,make:()=>kf,makeBy:()=>hpe,map:()=>Vr,mapAccum:()=>BL,modify:()=>mpe,modifyOption:()=>z4,of:()=>We,partition:()=>MXe,partitionMap:()=>PXe,prepend:()=>wn,prependAll:()=>_Xe,range:()=>aT,reduce:()=>ip,reduceRight:()=>j4,remove:()=>jXe,removeOption:()=>VXe,replace:()=>GXe,replaceOption:()=>KXe,reverse:()=>ml,separate:()=>DXe,size:()=>FXe,some:()=>$4,sort:()=>dpe,sortWith:()=>NXe,split:()=>UXe,splitAt:()=>dy,splitNonEmptyAt:()=>LXe,splitWhere:()=>WL,tail:()=>HXe,tailNonEmpty:()=>va,take:()=>Ii,takeRight:()=>sT,takeWhile:()=>zL,toArray:()=>rT,toReadonlyArray:()=>lr,union:()=>qXe,unsafeFromArray:()=>nt,unsafeFromNonEmptyArray:()=>cI,unsafeGet:()=>dn,unsafeHead:()=>Zd,unsafeLast:()=>Wh,unzip:()=>zXe,zip:()=>$Xe,zipWith:()=>iT});var upe=Symbol.for("effect/Chunk");function bXe(e,t,r,n,o){for(let s=t;s<Math.min(e.length,t+o);s++)r[n+s-t]=e[s];return r}var ppe=[],tT=(e)=>No((t,r)=>t.length===r.length&&lr(t).every((n,o)=>e(n,dn(r,o)))),CXe=tT(ge),wXe={[upe]:{_A:(e)=>e},toString(){return Ut(this.toJSON())},toJSON(){return{_id:"Chunk",values:lr(this).map(fr)}},[dt](){return this.toJSON()},[Pe](e){return Yd(e)&&CXe(this,e)},[Ne](){return lt(this,il(lr(this)))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return ppe[Symbol.iterator]();default:return lr(this)[Symbol.iterator]()}},pipe(){return ce(this,arguments)}},ks=(e)=>{let t=Object.create(wXe);switch(t.backing=e,e._tag){case"IEmpty":{t.length=0,t.depth=0,t.left=t,t.right=t;break}case"IConcat":{t.length=e.left.length+e.right.length,t.depth=1+Math.max(e.left.depth,e.right.depth),t.left=e.left,t.right=e.right;break}case"IArray":{t.length=e.array.length,t.depth=0,t.left=op,t.right=op;break}case"ISingleton":{t.length=1,t.depth=0,t.left=op,t.right=op;break}case"ISlice":{t.length=e.length,t.depth=e.chunk.depth+1,t.left=op,t.right=op;break}}return t},Yd=(e)=>de(e,upe),op=ks({_tag:"IEmpty"}),Ze=()=>op,kf=(...e)=>cI(e),We=(e)=>ks({_tag:"ISingleton",a:e}),Fr=(e)=>Yd(e)?e:nt(De(e)),q4=(e,t,r)=>{switch(e.backing._tag){case"IArray":{bXe(e.backing.array,0,t,r,e.length);break}case"IConcat":{q4(e.left,t,r),q4(e.right,t,r+e.left.length);break}case"ISingleton":{t[r]=e.backing.a;break}case"ISlice":{let n=0,o=r;while(n<e.length)t[o]=dn(e,n),n+=1,o+=1;break}}},kXe=(e)=>lr(e).slice(),rT=kXe,IXe=(e)=>{switch(e.backing._tag){case"IEmpty":return ppe;case"IArray":return e.backing.array;default:{let t=Array(e.length);return q4(e,t,0),e.backing={_tag:"IArray",array:t},e.left=op,e.right=op,e.depth=0,t}}},lr=IXe,AXe=(e)=>{switch(e.backing._tag){case"IEmpty":case"ISingleton":return e;case"IArray":return ks({_tag:"IArray",array:Jv(e.backing.array)});case"IConcat":return ks({_tag:"IConcat",left:ml(e.backing.right),right:ml(e.backing.left)});case"ISlice":return nt(Jv(lr(e)))}},ml=AXe,B4=p(2,(e,t)=>t<0||t>=e.length?R():_(dn(e,t))),nt=(e)=>e.length===0?Ze():e.length===1?We(e[0]):ks({_tag:"IArray",array:e}),cI=(e)=>nt(e),dn=p(2,(e,t)=>{switch(e.backing._tag){case"IEmpty":throw Error("Index out of bounds");case"ISingleton":{if(t!==0)throw Error("Index out of bounds");return e.backing.a}case"IArray":{if(t>=e.length||t<0)throw Error("Index out of bounds");return e.backing.array[t]}case"IConcat":return t<e.left.length?dn(e.left,t):dn(e.right,t-e.left.length);case"ISlice":return dn(e.backing.chunk,t+e.backing.offset)}}),Is=p(2,(e,t)=>Vt(e,We(t))),wn=p(2,(e,t)=>Vt(We(t),e)),Ii=p(2,(e,t)=>{if(t<=0)return op;else if(t>=e.length)return e;else switch(e.backing._tag){case"ISlice":return ks({_tag:"ISlice",chunk:e.backing.chunk,length:t,offset:e.backing.offset});case"IConcat":{if(t>e.left.length)return ks({_tag:"IConcat",left:e.left,right:Ii(e.right,t-e.left.length)});return Ii(e.left,t)}default:return ks({_tag:"ISlice",chunk:e,offset:0,length:t})}}),Zr=p(2,(e,t)=>{if(t<=0)return e;else if(t>=e.length)return op;else switch(e.backing._tag){case"ISlice":return ks({_tag:"ISlice",chunk:e.backing.chunk,offset:e.backing.offset+t,length:e.backing.length-t});case"IConcat":{if(t>e.left.length)return Zr(e.right,t-e.left.length);return ks({_tag:"IConcat",left:Zr(e.left,t),right:e.right})}default:return ks({_tag:"ISlice",chunk:e,offset:t,length:e.length-t})}}),OXe=p(2,(e,t)=>Ii(e,Math.max(0,e.length-t))),HL=p(2,(e,t)=>{let r=lr(e),n=r.length,o=0;while(o<n&&t(r[o]))o++;return Zr(e,o)}),_Xe=p(2,(e,t)=>Vt(t,e)),Vt=p(2,(e,t)=>{if(e.backing._tag==="IEmpty")return t;if(t.backing._tag==="IEmpty")return e;let r=t.depth-e.depth;if(Math.abs(r)<=1)return ks({_tag:"IConcat",left:e,right:t});else if(r<-1)if(e.left.depth>=e.right.depth){let n=Vt(e.right,t);return ks({_tag:"IConcat",left:e.left,right:n})}else{let n=Vt(e.right.right,t);if(n.depth===e.depth-3){let o=ks({_tag:"IConcat",left:e.right.left,right:n});return ks({_tag:"IConcat",left:e.left,right:o})}else{let o=ks({_tag:"IConcat",left:e.left,right:e.right.left});return ks({_tag:"IConcat",left:o,right:n})}}else if(t.right.depth>=t.left.depth){let n=Vt(e,t.left);return ks({_tag:"IConcat",left:n,right:t.right})}else{let n=Vt(e,t.left.left);if(n.depth===t.depth-3){let o=ks({_tag:"IConcat",left:n,right:t.left.right});return ks({_tag:"IConcat",left:o,right:t.right})}else{let o=ks({_tag:"IConcat",left:t.left.right,right:t.right});return ks({_tag:"IConcat",left:n,right:o})}}}),fy=p(2,(e,t)=>nt(Tc(e,t))),sp=p(2,(e,t)=>nt(Qd(e,t))),W4=p(2,(e,t)=>nt(A4(e,t))),vXe=(e)=>fy(e,te),qL=p(2,(e,t)=>{if(e.backing._tag==="ISingleton")return t(e.backing.a,0);let r=op,n=0;for(let o of e)r=Vt(r,t(o,n++));return r}),lI=p(2,(e,t)=>lr(e).forEach(t)),nT=qL(te),fpe=p(2,(e,t)=>{let r=[],n=[];if(lr(e).forEach((o)=>{if(n.push(o),n.length>=t)r.push(nt(n)),n=[]}),n.length>0)r.push(nt(n));return nt(r)}),TXe=p(2,(e,t)=>nt(Yv(lr(e),lr(t)))),At=(e)=>e.length===0,kn=(e)=>e.length>0,If=B4(0),Zd=(e)=>dn(e,0),Ai=Zd,oT=(e)=>B4(e,e.length-1),Wh=(e)=>dn(e,e.length-1),RXe=Wh,Vr=p(2,(e,t)=>e.backing._tag==="ISingleton"?We(t(e.backing.a,0)):nt(d(lr(e),Ke((r,n)=>t(r,n))))),BL=p(3,(e,t,r)=>{let[n,o]=P4(e,t,r);return[n,nt(o)]}),MXe=p(2,(e,t)=>d(O4(lr(e),t),([r,n])=>[nt(r),nt(n)])),PXe=p(2,(e,t)=>d(nI(lr(e),t),([r,n])=>[nt(r),nt(n)])),DXe=(e)=>d(_4(lr(e)),([t,r])=>[nt(t),nt(r)]),FXe=(e)=>e.length,dpe=p(2,(e,t)=>nt(Aa(lr(e),t))),NXe=p(3,(e,t,r)=>dpe(e,bf(r,t))),dy=p(2,(e,t)=>[Ii(e,t),Zr(e,t)]),LXe=p(2,(e,t)=>{let r=Math.max(1,Math.floor(t));return r>=e.length?[e,Ze()]:[Ii(e,r),Zr(e,r)]}),UXe=p(2,(e,t)=>fpe(e,Math.ceil(e.length/Math.floor(t)))),WL=p(2,(e,t)=>{let r=0;for(let n of lr(e))if(t(n))break;else r++;return dy(e,r)}),HXe=(e)=>e.length>0?_(Zr(e,1)):R(),va=(e)=>Zr(e,1),sT=p(2,(e,t)=>Zr(e,e.length-t)),zL=p(2,(e,t)=>{let r=[];for(let n of lr(e))if(t(n))r.push(n);else break;return nt(r)}),qXe=p(2,(e,t)=>nt(nu(lr(e),lr(t)))),BXe=(e)=>nt(Xv(lr(e))),WXe=(e)=>nt(M4(e)),zXe=(e)=>{let[t,r]=w4(e);return[nt(t),nt(r)]},iT=p(3,(e,t,r)=>nt(Qv(e,t,r))),$Xe=p(2,(e,t)=>iT(e,t,(r,n)=>[r,n])),jXe=p(2,(e,t)=>{if(t<0||t>=e.length)return e;return nt(gL(lr(e),t))}),VXe=p(2,(e,t)=>{if(t<0||t>=e.length)return R();return _(nt(gL(lr(e),t)))}),z4=p(3,(e,t,r)=>{if(t<0||t>=e.length)return R();return _(nt(hL(lr(e),t,r)))}),mpe=p(3,(e,t,r)=>Je(z4(e,t,r),()=>e)),GXe=p(3,(e,t,r)=>mpe(e,t,()=>r)),KXe=p(3,(e,t,r)=>z4(e,t,()=>r)),hpe=p(2,(e,t)=>Fr(Hh(e,t))),aT=(e,t)=>e<=t?hpe(t-e+1,(r)=>e+r):We(e),JXe=oc,QXe=tI,$L=Kd,YXe=Xk,ZXe=eI,XXe=C4,eet=p(2,(e,t)=>De(e).every(t)),$4=p(2,(e,t)=>De(e).some(t)),tet=Xt,ip=ki,j4=dl,ret=(e)=>p(2,(t,r)=>nt(bL(e)(r,t))),net=p(2,(e,t)=>nt(I4(t,e)));var Gr={};Ht(Gr,{Equivalence:()=>GL,Order:()=>lT,between:()=>Z4,clamp:()=>X4,days:()=>Cpe,decode:()=>ur,decodeUnknown:()=>Q4,divide:()=>xet,equals:()=>_pe,format:()=>JL,formatIso:()=>bet,fromIso:()=>Cet,greaterThan:()=>pT,greaterThanOrEqualTo:()=>uI,hours:()=>bpe,infinity:()=>_b,isDuration:()=>cT,isFinite:()=>Xd,isZero:()=>VL,lessThan:()=>KL,lessThanOrEqualTo:()=>uT,match:()=>em,matchWith:()=>zh,max:()=>het,micros:()=>Spe,millis:()=>Bo,min:()=>det,minutes:()=>Epe,nanos:()=>Af,parts:()=>tJ,seconds:()=>vb,subtract:()=>Eet,sum:()=>eJ,times:()=>Ope,toDays:()=>uet,toHours:()=>cet,toHrTime:()=>Ape,toMillis:()=>ds,toMinutes:()=>aet,toNanos:()=>Y4,toSeconds:()=>kpe,toWeeks:()=>pet,unsafeDivide:()=>yet,unsafeFormatIso:()=>vpe,unsafeToNanos:()=>Ipe,weeks:()=>wpe,zero:()=>hl});var V4=Symbol.for("effect/Duration"),ype=BigInt(0),gpe=BigInt(24),jL=BigInt(60),G4=BigInt(1000),K4=BigInt(1e6),J4=BigInt(1e9),oet=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,ur=(e)=>{if(cT(e))return e;else if(li(e))return Bo(e);else if(Ld(e))return Af(e);else if(Array.isArray(e)&&e.length===2&&e.every(li)){if(e[0]===-1/0||e[1]===-1/0||Number.isNaN(e[0])||Number.isNaN(e[1]))return hl;if(e[0]===1/0||e[1]===1/0)return _b;return Af(BigInt(Math.round(e[0]*1e9))+BigInt(Math.round(e[1])))}else if(Jr(e)){let t=oet.exec(e);if(t){let[r,n,o]=t,s=Number(n);switch(o){case"nano":case"nanos":return Af(BigInt(n));case"micro":case"micros":return Spe(BigInt(n));case"milli":case"millis":return Bo(s);case"second":case"seconds":return vb(s);case"minute":case"minutes":return Epe(s);case"hour":case"hours":return bpe(s);case"day":case"days":return Cpe(s);case"week":case"weeks":return wpe(s)}}}throw Error("Invalid DurationInput")},Q4=Uh(ur),xpe={_tag:"Millis",millis:0},set={_tag:"Infinity"},iet={[V4]:V4,[Ne](){return lt(this,YN(this.value))},[Pe](e){return cT(e)&&_pe(this,e)},toString(){return`Duration(${JL(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:Ape(this)};case"Infinity":return{_id:"Duration",_tag:"Infinity"}}},[dt](){return this.toJSON()},pipe(){return ce(this,arguments)}},fi=(e)=>{let t=Object.create(iet);if(li(e))if(isNaN(e)||e<=0)t.value=xpe;else if(!Number.isFinite(e))t.value=set;else if(!Number.isInteger(e))t.value={_tag:"Nanos",nanos:BigInt(Math.round(e*1e6))};else t.value={_tag:"Millis",millis:e};else if(e<=ype)t.value=xpe;else t.value={_tag:"Nanos",nanos:e};return t},cT=(e)=>de(e,V4),Xd=(e)=>e.value._tag!=="Infinity",VL=(e)=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===ype;case"Infinity":return!1}},hl=fi(0),_b=fi(1/0),Af=(e)=>fi(e),Spe=(e)=>fi(e*G4),Bo=(e)=>fi(e),vb=(e)=>fi(e*1000),Epe=(e)=>fi(e*60000),bpe=(e)=>fi(e*3600000),Cpe=(e)=>fi(e*86400000),wpe=(e)=>fi(e*604800000),ds=(e)=>em(e,{onMillis:(t)=>t,onNanos:(t)=>Number(t)/1e6}),kpe=(e)=>em(e,{onMillis:(t)=>t/1000,onNanos:(t)=>Number(t)/1e9}),aet=(e)=>em(e,{onMillis:(t)=>t/60000,onNanos:(t)=>Number(t)/60000000000}),cet=(e)=>em(e,{onMillis:(t)=>t/3600000,onNanos:(t)=>Number(t)/3600000000000}),uet=(e)=>em(e,{onMillis:(t)=>t/86400000,onNanos:(t)=>Number(t)/86400000000000}),pet=(e)=>em(e,{onMillis:(t)=>t/604800000,onNanos:(t)=>Number(t)/604800000000000}),Y4=(e)=>{let t=ur(e);switch(t.value._tag){case"Infinity":return R();case"Nanos":return _(t.value.nanos);case"Millis":return _(BigInt(Math.round(t.value.millis*1e6)))}},Ipe=(e)=>{let t=ur(e);switch(t.value._tag){case"Infinity":throw Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return BigInt(Math.round(t.value.millis*1e6))}},Ape=(e)=>{let t=ur(e);switch(t.value._tag){case"Infinity":return[1/0,0];case"Nanos":return[Number(t.value.nanos/J4),Number(t.value.nanos%J4)];case"Millis":return[Math.floor(t.value.millis/1000),Math.round(t.value.millis%1000*1e6)]}},em=p(2,(e,t)=>{let r=ur(e);switch(r.value._tag){case"Nanos":return t.onNanos(r.value.nanos);case"Infinity":return t.onMillis(1/0);case"Millis":return t.onMillis(r.value.millis)}}),zh=p(3,(e,t,r)=>{let n=ur(e),o=ur(t);if(n.value._tag==="Infinity"||o.value._tag==="Infinity")return r.onMillis(ds(n),ds(o));else if(n.value._tag==="Nanos"||o.value._tag==="Nanos"){let s=n.value._tag==="Nanos"?n.value.nanos:BigInt(Math.round(n.value.millis*1e6)),i=o.value._tag==="Nanos"?o.value.nanos:BigInt(Math.round(o.value.millis*1e6));return r.onNanos(s,i)}return r.onMillis(n.value.millis,o.value.millis)}),lT=nc((e,t)=>zh(e,t,{onMillis:(r,n)=>r<n?-1:r>n?1:0,onNanos:(r,n)=>r<n?-1:r>n?1:0})),Z4=ly(bf(lT,ur)),GL=(e,t)=>zh(e,t,{onMillis:(r,n)=>r===n,onNanos:(r,n)=>r===n}),fet=Wd(lT),det=p(2,(e,t)=>fet(ur(e),ur(t))),met=zd(lT),het=p(2,(e,t)=>met(ur(e),ur(t))),get=$d(lT),X4=p(2,(e,t)=>get(ur(e),{minimum:ur(t.minimum),maximum:ur(t.maximum)})),xet=p(2,(e,t)=>em(e,{onMillis:(r)=>{if(t===0||isNaN(t)||!Number.isFinite(t))return R();return _(fi(r/t))},onNanos:(r)=>{if(isNaN(t)||t<=0||!Number.isFinite(t))return R();try{return _(fi(r/BigInt(t)))}catch{return R()}}})),yet=p(2,(e,t)=>em(e,{onMillis:(r)=>fi(r/t),onNanos:(r)=>{if(isNaN(t)||t<0||Object.is(t,-0))return hl;else if(Object.is(t,0)||!Number.isFinite(t))return _b;return fi(r/BigInt(t))}})),Ope=p(2,(e,t)=>em(e,{onMillis:(r)=>fi(r*t),onNanos:(r)=>fi(r*BigInt(t))})),Eet=p(2,(e,t)=>zh(e,t,{onMillis:(r,n)=>fi(r-n),onNanos:(r,n)=>fi(r-n)})),eJ=p(2,(e,t)=>zh(e,t,{onMillis:(r,n)=>fi(r+n),onNanos:(r,n)=>fi(r+n)})),KL=p(2,(e,t)=>zh(e,t,{onMillis:(r,n)=>r<n,onNanos:(r,n)=>r<n})),uT=p(2,(e,t)=>zh(e,t,{onMillis:(r,n)=>r<=n,onNanos:(r,n)=>r<=n})),pT=p(2,(e,t)=>zh(e,t,{onMillis:(r,n)=>r>n,onNanos:(r,n)=>r>n})),uI=p(2,(e,t)=>zh(e,t,{onMillis:(r,n)=>r>=n,onNanos:(r,n)=>r>=n})),_pe=p(2,(e,t)=>GL(ur(e),ur(t))),tJ=(e)=>{let t=ur(e);if(t.value._tag==="Infinity")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};let r=Ipe(t),n=r/K4,o=n/G4,s=o/jL,i=s/jL,a=i/gpe;return{days:Number(a),hours:Number(i%gpe),minutes:Number(s%jL),seconds:Number(o%jL),millis:Number(n%G4),nanos:Number(r%K4)}},JL=(e)=>{let t=ur(e);if(t.value._tag==="Infinity")return"Infinity";if(VL(t))return"0";let r=tJ(t),n=[];if(r.days!==0)n.push(`${r.days}d`);if(r.hours!==0)n.push(`${r.hours}h`);if(r.minutes!==0)n.push(`${r.minutes}m`);if(r.seconds!==0)n.push(`${r.seconds}s`);if(r.millis!==0)n.push(`${r.millis}ms`);if(r.nanos!==0)n.push(`${r.nanos}ns`);return n.join(" ")},vpe=(e)=>{let t=ur(e);if(!Xd(t))throw RangeError("Cannot format infinite duration");let r=[],{days:n,hours:o,millis:s,minutes:i,nanos:a,seconds:c}=tJ(t),l=n;if(l>=365){let u=Math.floor(l/365);l%=365,r.push(`${u}Y`)}if(l>=30){let u=Math.floor(l/30);l%=30,r.push(`${u}M`)}if(l>=7){let u=Math.floor(l/7);l%=7,r.push(`${u}W`)}if(l>0)r.push(`${l}D`);if(o!==0||i!==0||c!==0||s!==0||a!==0){if(r.push("T"),o!==0)r.push(`${o}H`);if(i!==0)r.push(`${i}M`);if(c!==0||s!==0||a!==0){let u=BigInt(c)*J4+BigInt(s)*K4+BigInt(a),f=(Number(u)/1e9).toFixed(9).replace(/\.?0+$/,"");r.push(`${f}S`)}}return`P${r.join("")||"T0S"}`},bet=(e)=>{let t=ur(e);return Xd(t)?_(vpe(t)):R()},Cet=(e)=>{let t=wet.exec(e);if(t==null)return R();let[r,n,o,s,i,a,c]=t.slice(1,8).map((u)=>u?Number(u):0),l=r*365*24*60*60+n*30*24*60*60+o*7*24*60*60+s*24*60*60+i*60*60+a*60+c;return _(vb(l))},wet=/^P(?!$)(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?!$)(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/;var my=5,rJ=Math.pow(2,5),Tpe=rJ-1,Rpe=rJ/2,Mpe=rJ/4;function ket(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,e+=e>>16,e&127}function hy(e,t){return t>>>e&Tpe}function gy(e){return 1<<e}function QL(e,t){return ket(e&t-1)}var Ppe=(e,t)=>({value:e,previous:t});function Tb(e,t,r,n){let o=n;if(!e){let s=n.length;o=Array(s);for(let i=0;i<s;++i)o[i]=n[i]}return o[t]=r,o}function nJ(e,t,r){let n=r.length-1,o=0,s=0,i=r;if(e)o=s=t;else{i=Array(n);while(o<t)i[s++]=r[o++]}++o;while(o<=n)i[s++]=r[o++];if(e)i.length=n;return i}function Dpe(e,t,r,n){let o=n.length;if(e){let c=o;while(c>=t)n[c--]=n[c];return n[t]=r,n}let s=0,i=0,a=Array(o+1);while(s<t)a[i++]=n[s++];a[t]=r;while(s<o)a[++i]=n[s++];return a}class $h{_tag="EmptyNode";modify(e,t,r,n,o,s){let i=r(R());if(vt(i))return new $h;return++s.value,new Rb(e,n,o,i)}}function ap(e){return Zu(e,"EmptyNode")}function Aet(e){return ap(e)||e._tag==="LeafNode"||e._tag==="CollisionNode"}function YL(e,t){return ap(e)?!1:t===e.edit}class Rb{edit;hash;key;value;_tag="LeafNode";constructor(e,t,r,n){this.edit=e,this.hash=t,this.key=r,this.value=n}modify(e,t,r,n,o,s){if(ge(o,this.key)){let a=r(this.value);if(a===this.value)return this;else if(vt(a))return--s.value,new $h;if(YL(this,e))return this.value=a,this;return new Rb(e,n,o,a)}let i=r(R());if(vt(i))return this;return++s.value,Fpe(e,t,this.hash,this,n,new Rb(e,n,o,i))}}class oJ{edit;hash;children;_tag="CollisionNode";constructor(e,t,r){this.edit=e,this.hash=t,this.children=r}modify(e,t,r,n,o,s){if(n===this.hash){let a=YL(this,e),c=this.updateCollisionList(a,e,this.hash,this.children,r,o,s);if(c===this.children)return this;return c.length>1?new oJ(e,this.hash,c):c[0]}let i=r(R());if(vt(i))return this;return++s.value,Fpe(e,t,this.hash,this,n,new Rb(e,n,o,i))}updateCollisionList(e,t,r,n,o,s,i){let a=n.length;for(let l=0;l<a;++l){let u=n[l];if("key"in u&&ge(s,u.key)){let f=u.value,h=o(f);if(h===f)return n;if(vt(h))return--i.value,nJ(e,l,n);return Tb(e,l,new Rb(t,r,s,h),n)}}let c=o(R());if(vt(c))return n;return++i.value,Tb(e,a,new Rb(t,r,s,c),n)}}class pI{edit;mask;children;_tag="IndexedNode";constructor(e,t,r){this.edit=e,this.mask=t,this.children=r}modify(e,t,r,n,o,s){let i=this.mask,a=this.children,c=hy(t,n),l=gy(c),u=QL(i,l),f=i&l,h=YL(this,e);if(!f){let T=new $h().modify(e,t+my,r,n,o,s);if(!T)return this;return a.length>=Rpe?_et(e,c,T,i,a):new pI(e,i|l,Dpe(h,u,T,a))}let y=a[u],E=y.modify(e,t+my,r,n,o,s);if(y===E)return this;let b=i,w;if(ap(E)){if(b&=~l,!b)return new $h;if(a.length<=2&&Aet(a[u^1]))return a[u^1];w=nJ(h,u,a)}else w=Tb(h,u,E,a);if(h)return this.mask=b,this.children=w,this;return new pI(e,b,w)}}class sJ{edit;size;children;_tag="ArrayNode";constructor(e,t,r){this.edit=e,this.size=t,this.children=r}modify(e,t,r,n,o,s){let i=this.size,a=this.children,c=hy(t,n),l=a[c],u=(l||new $h).modify(e,t+my,r,n,o,s);if(l===u)return this;let f=YL(this,e),h;if(ap(l)&&!ap(u))++i,h=Tb(f,c,u,a);else if(!ap(l)&&ap(u)){if(--i,i<=Mpe)return Oet(e,i,c,a);h=Tb(f,c,new $h,a)}else h=Tb(f,c,u,a);if(f)return this.size=i,this.children=h,this;return new sJ(e,i,h)}}function Oet(e,t,r,n){let o=Array(t-1),s=0,i=0;for(let a=0,c=n.length;a<c;++a)if(a!==r){let l=n[a];if(l&&!ap(l))o[s++]=l,i|=1<<a}return new pI(e,i,o)}function _et(e,t,r,n,o){let s=[],i=n,a=0;for(let c=0;i;++c){if(i&1)s[c]=o[a++];i>>>=1}return s[t]=r,new sJ(e,a+1,s)}function vet(e,t,r,n,o,s){if(r===o)return new oJ(e,r,[s,n]);let i=hy(t,r),a=hy(t,o);if(i===a)return(c)=>new pI(e,gy(i)|gy(a),[c]);else{let c=i<a?[n,s]:[s,n];return new pI(e,gy(i)|gy(a),c)}}function Fpe(e,t,r,n,o,s){let i=void 0,a=t;while(!0){let c=vet(e,a,r,n,o,s);if(typeof c==="function")i=Ppe(c,i),a=a+my;else{let l=c;while(i!=null)l=i.value(l),i=i.previous;return l}}}var Npe="effect/HashMap",ZL=Symbol.for(Npe),Ret={[ZL]:ZL,[Symbol.iterator](){return new e1(this,(e,t)=>[e,t])},[Ne](){let e=oe(Npe);for(let t of this)e^=d(oe(t[0]),Ee(oe(t[1])));return lt(this,e)},[Pe](e){if(cJ(e)){if(e._size!==this._size)return!1;for(let t of this){let r=d(e,t1(t[0],oe(t[0])));if(vt(r))return!1;else if(!ge(t[1],r.value))return!1}return!0}return!1},toString(){return Ut(this.toJSON())},toJSON(){return{_id:"HashMap",values:Array.from(this).map(fr)}},[dt](){return this.toJSON()},pipe(){return ce(this,arguments)}},iJ=(e,t,r,n)=>{let o=Object.create(Ret);return o._editable=e,o._edit=t,o._root=r,o._size=n,o};class e1{map;f;v;constructor(e,t){this.map=e,this.f=t,this.v=Lpe(this.map._root,this.f,void 0)}next(){if(vt(this.v))return{done:!0,value:void 0};let e=this.v.value;return this.v=XL(e.cont),{done:!1,value:e.value}}[Symbol.iterator](){return new e1(this.map,this.f)}}var XL=(e)=>e?Upe(e[0],e[1],e[2],e[3],e[4]):R(),Lpe=(e,t,r=void 0)=>{switch(e._tag){case"LeafNode":{if(Oe(e.value))return _({value:t(e.key,e.value.value),cont:r});return XL(r)}case"CollisionNode":case"ArrayNode":case"IndexedNode":{let n=e.children;return Upe(n.length,n,0,t,r)}default:return XL(r)}},Upe=(e,t,r,n,o)=>{while(r<e){let s=t[r++];if(s&&!ap(s))return Lpe(s,n,[e,t,r,n,o])}return XL(o)},Met=iJ(!1,0,new $h,0),fI=()=>Met,Hpe=(...e)=>aJ(e),aJ=(e)=>{let t=mI(fI());for(let r of e)xy(t,r[0],r[1]);return o1(t)},cJ=(e)=>de(e,ZL),qpe=(e)=>e&&ap(e._root),Bpe=p(2,(e,t)=>t1(e,t,oe(t))),t1=p(3,(e,t,r)=>{let n=e._root,o=0;while(!0)switch(n._tag){case"LeafNode":return ge(t,n.key)?n.value:R();case"CollisionNode":{if(r===n.hash){let s=n.children;for(let i=0,a=s.length;i<a;++i){let c=s[i];if("key"in c&&ge(t,c.key))return c.value}}return R()}case"IndexedNode":{let s=hy(o,r),i=gy(s);if(n.mask&i){n=n.children[QL(n.mask,i)],o+=my;break}return R()}case"ArrayNode":{if(n=n.children[hy(o,r)],n){o+=my;break}return R()}default:return R()}});var r1=p(2,(e,t)=>Oe(t1(e,t,oe(t))));var xy=p(3,(e,t,r)=>s1(e,t,()=>_(r))),Pet=p(3,(e,t,r)=>{if(e._editable)return e._root=t,e._size=r,e;return t===e._root?e:iJ(e._editable,e._edit,t,r)}),n1=(e)=>new e1(e,(t)=>t);var dI=(e)=>e._size;var mI=(e)=>iJ(!0,e._edit+1,e._root,e._size),o1=(e)=>(e._editable=!1,e),Wpe=p(2,(e,t)=>{let r=mI(e);return t(r),o1(r)}),s1=p(3,(e,t,r)=>zpe(e,t,oe(t),r)),zpe=p(4,(e,t,r,n)=>{let o={value:e._size},s=e._root.modify(e._editable?e._edit:NaN,0,n,r,t,o);return d(e,Pet(s,o.value))});var $pe=p(2,(e,t)=>{let r=mI(e);return fT(t,(n,o)=>xy(r,o,n)),o1(r)}),i1=p(2,(e,t)=>s1(e,t,R));var jpe=p(2,(e,t)=>hI(e,fI(),(r,n,o)=>xy(r,o,t(n,o))));var fT=p(2,(e,t)=>hI(e,void 0,(r,n,o)=>t(n,o))),hI=p(3,(e,t,r)=>{let n=e._root;if(n._tag==="LeafNode")return Oe(n.value)?r(t,n.value.value,n.key):t;if(n._tag==="EmptyNode")return t;let o=[n.children],s;while(s=o.pop())for(let i=0,a=s.length;i<a;){let c=s[i++];if(c&&!ap(c))if(c._tag==="LeafNode"){if(Oe(c.value))t=r(t,c.value.value,c.key)}else o.push(c.children)}return t});var Gpe="effect/HashSet",a1=Symbol.for(Gpe),Det={[a1]:a1,[Symbol.iterator](){return n1(this._keyMap)},[Ne](){return lt(this,Ee(oe(this._keyMap))(oe(Gpe)))},[Pe](e){if(lJ(e))return dI(this._keyMap)===dI(e._keyMap)&&ge(this._keyMap,e._keyMap);return!1},toString(){return Ut(this.toJSON())},toJSON(){return{_id:"HashSet",values:Array.from(this).map(fr)}},[dt](){return this.toJSON()},pipe(){return ce(this,arguments)}},c1=(e)=>{let t=Object.create(Det);return t._keyMap=e,t},lJ=(e)=>de(e,a1),Fet=c1(fI()),Mb=()=>Fet,Kpe=(e)=>{let t=u1(Mb());for(let r of e)yy(t,r);return p1(t)},Jpe=(...e)=>{let t=u1(Mb());for(let r of e)yy(t,r);return p1(t)},l1=p(2,(e,t)=>r1(e._keyMap,t));var Qpe=(e)=>dI(e._keyMap),u1=(e)=>c1(mI(e._keyMap)),p1=(e)=>(e._keyMap._editable=!1,e),dT=p(2,(e,t)=>{let r=u1(e);return t(r),p1(r)}),yy=p(2,(e,t)=>e._keyMap._editable?(xy(t,!0)(e._keyMap),e):c1(xy(t,!0)(e._keyMap))),uJ=p(2,(e,t)=>e._keyMap._editable?(i1(t)(e._keyMap),e):c1(i1(t)(e._keyMap))),Ype=p(2,(e,t)=>dT(e,(r)=>{for(let n of t)uJ(r,n)}));var Zpe=p(2,(e,t)=>dT(Mb(),(r)=>{mT(e,(n)=>yy(r,n));for(let n of t)yy(r,n)}));var Xpe=p(2,(e,t)=>dT(Mb(),(r)=>{mT(e,(n)=>{let o=t(n);if(!l1(r,o))yy(r,o)})})),efe=p(2,(e,t)=>dT(Mb(),(r)=>{mT(e,(n)=>{for(let o of t(n))if(!l1(r,o))yy(r,o)})})),mT=p(2,(e,t)=>fT(e._keyMap,(r,n)=>t(n))),tfe=p(3,(e,t,r)=>hI(e._keyMap,t,(n,o,s)=>r(n,s)));var rfe=lJ,gl=Mb,cp=Kpe,Of=Jpe,gI=l1;var jh=Qpe;var ou=yy,Vh=uJ,pJ=Ype;var tm=Zpe;var fJ=Xpe,dJ=efe,nfe=mT,Sy=tfe;var ofe=Symbol.for("effect/MutableRef"),Let={[ofe]:ofe,toString(){return Ut(this.toJSON())},toJSON(){return{_id:"MutableRef",current:fr(this.current)}},[dt](){return this.toJSON()},pipe(){return ce(this,arguments)}},Qi=(e)=>{let t=Object.create(Let);return t.current=e,t},f1=p(3,(e,t,r)=>{if(ge(t,e.current))return e.current=r,!0;return!1});var pr=(e)=>e.current;var Oi=p(2,(e,t)=>(e.current=t,e));var g1="effect/FiberId",Ey=Symbol.for(g1),Pb="None",d1="Runtime",m1="Composite",Uet=It(`${g1}-${Pb}`);class ife{[Ey]=Ey;_tag=Pb;id=-1;startTimeMillis=-1;[Ne](){return Uet}[Pe](e){return gT(e)&&e._tag===Pb}toString(){return Ut(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag}}[dt](){return this.toJSON()}}class x1{id;startTimeMillis;[Ey]=Ey;_tag=d1;constructor(e,t){this.id=e,this.startTimeMillis=t}[Ne](){return lt(this,It(`${g1}-${this._tag}-${this.id}-${this.startTimeMillis}`))}[Pe](e){return gT(e)&&e._tag===d1&&this.id===e.id&&this.startTimeMillis===e.startTimeMillis}toString(){return Ut(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,id:this.id,startTimeMillis:this.startTimeMillis}}[dt](){return this.toJSON()}}class mJ{left;right;[Ey]=Ey;_tag=m1;constructor(e,t){this.left=e,this.right=t}_hash;[Ne](){return d(It(`${g1}-${this._tag}`),Ee(oe(this.left)),Ee(oe(this.right)),lt(this))}[Pe](e){return gT(e)&&e._tag===m1&&ge(this.left,e.left)&&ge(this.right,e.right)}toString(){return Ut(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,left:fr(this.left),right:fr(this.right)}}[dt](){return this.toJSON()}}var Db=new ife,afe=(e,t)=>new x1(e,t),cfe=(e,t)=>new mJ(e,t),gT=(e)=>de(e,Ey);var hJ=p(2,(e,t)=>{if(e._tag===Pb)return t;if(t._tag===Pb)return e;return new mJ(e,t)}),lfe=(e)=>d(e,Sy(Db,(t,r)=>hJ(r)(t)));var hT=(e)=>{switch(e._tag){case Pb:return gl();case d1:return Of(e.id);case m1:return d(hT(e.left),tm(hT(e.right)))}},sfe=je(Symbol.for("effect/Fiber/Id/_fiberCounter"),()=>Qi(0)),ufe=(e,t)=>new x1(e,t),Fb=(e)=>Array.from(hT(e)).map((r)=>`#${r}`).join(",");var h1=(e)=>{switch(e._tag){case Pb:return gl();case d1:return Of(e);case m1:return d(h1(e.left),tm(h1(e.right)))}},pfe=()=>{let e=pr(sfe);return d(sfe,Oi(e+1)),new x1(e,Date.now())};var Ks=Db,ffe=afe,dfe=cfe,mfe=gT;var Nb=hJ,hfe=lfe;var xT=hT,Lb=ufe,gfe=Fb;var xJ=h1,y1=pfe;var xfe=cJ,Ta=fI,yT=Hpe,lp=aJ,xI=qpe,Ub=Bpe;var yfe=r1;var As=xy,yJ=n1;var S1=dI;var Sfe=Wpe,Efe=s1;var bfe=$pe;var Cfe=jpe;var wfe=fT,SJ=hI;var ET=Symbol.for("effect/List"),EJ=(e)=>De(e),qet=(e)=>jK(Ji(e),EJ),Bet=qet(ge),Wet={[ET]:ET,_tag:"Cons",toString(){return Ut(this.toJSON())},toJSON(){return{_id:"List",_tag:"Cons",values:EJ(this).map(fr)}},[dt](){return this.toJSON()},[Pe](e){return E1(e)&&this._tag===e._tag&&Bet(this,e)},[Ne](){return lt(this,il(EJ(this)))},[Symbol.iterator](){let e=!1,t=this;return{next(){if(e)return this.return();if(t._tag==="Nil")return e=!0,this.return();let r=t.head;return t=t.tail,{done:e,value:r}},return(r){if(!e)e=!0;return{done:!0,value:r}}}},pipe(){return ce(this,arguments)}},yI=(e,t)=>{let r=Object.create(Wet);return r.head=e,r.tail=t,r},zet=It("Nil"),$et={[ET]:ET,_tag:"Nil",toString(){return Ut(this.toJSON())},toJSON(){return{_id:"List",_tag:"Nil"}},[dt](){return this.toJSON()},[Ne](){return zet},[Pe](e){return E1(e)&&this._tag===e._tag},[Symbol.iterator](){return{next(){return{done:!0,value:void 0}}}},pipe(){return ce(this,arguments)}},ST=Object.create($et),E1=(e)=>de(e,ET),Rc=(e)=>e._tag==="Nil",Hb=(e)=>e._tag==="Cons";var jet=()=>ST,Js=(e,t)=>yI(e,t),up=jet,Kh=(e)=>yI(e,ST),b1=(e)=>{let t=e[Symbol.iterator](),r;if((r=t.next())&&!r.done){let n=yI(r.value,ST),o=n;while((r=t.next())&&!r.done){let s=yI(r.value,ST);o.tail=s,o=s}return n}else return ST};var kfe=p(2,(e,t)=>Vet(t,e)),C1=p(2,(e,t)=>Js(t,e)),Vet=p(2,(e,t)=>{if(Rc(e))return t;else if(Rc(t))return e;else{let r=yI(t.head,e),n=r,o=t.tail;while(!Rc(o)){let s=yI(o.head,e);n.tail=s,n=s,o=o.tail}return r}});var Ife=p(3,(e,t,r)=>{let n=t,o=e;while(!Rc(o))n=r(n,o.head),o=o.tail;return n});var Afe=(e)=>{let t=up(),r=e;while(!Rc(r))t=C1(t,r.head),r=r.tail;return t};var Ofe=Object.assign(Object.create(Array.prototype),{[Ne](){return lt(this,il(this))},[Pe](e){if(Array.isArray(e)&&this.length===e.length)return this.every((t,r)=>ge(t,e[r]));else return!1}}),Qh=function(){function e(t){if(t)Object.assign(this,t)}return e.prototype=qd,e}(),SI=(e)=>Object.assign(Object.create(qd),e);var Get=Symbol.for("effect/DifferContextPatch");function _fe(e){return e}var CT={...Qh.prototype,[Get]:{_Value:_fe,_Patch:_fe}},Ket=Object.assign(Object.create(CT),{_tag:"Empty"}),Jet=Object.create(Ket),CJ=()=>Jet,Qet=Object.assign(Object.create(CT),{_tag:"AndThen"}),Yet=(e,t)=>{let r=Object.create(Qet);return r.first=e,r.second=t,r},Zet=Object.assign(Object.create(CT),{_tag:"AddService"}),Xet=(e,t)=>{let r=Object.create(Zet);return r.key=e,r.service=t,r},ett=Object.assign(Object.create(CT),{_tag:"RemoveService"}),ttt=(e)=>{let t=Object.create(ett);return t.key=e,t},rtt=Object.assign(Object.create(CT),{_tag:"UpdateService"}),ntt=(e,t)=>{let r=Object.create(rtt);return r.key=e,r.update=t,r},vfe=(e,t)=>{let r=new Map(e.unsafeMap),n=CJ();for(let[o,s]of t.unsafeMap.entries())if(r.has(o)){let i=r.get(o);if(r.delete(o),!ge(i,s))n=bT(ntt(o,()=>s))(n)}else r.delete(o),n=bT(Xet(o,s))(n);for(let[o]of r.entries())n=bT(ttt(o))(n);return n},bT=p(2,(e,t)=>Yet(e,t)),Tfe=p(2,(e,t)=>{if(e._tag==="Empty")return t;let r=!1,n=We(e),o=new Map(t.unsafeMap);while(kn(n)){let i=Ai(n),a=va(n);switch(i._tag){case"Empty":{n=a;break}case"AddService":{o.set(i.key,i.service),n=a;break}case"AndThen":{n=wn(wn(a,i.second),i.first);break}case"RemoveService":{o.delete(i.key),n=a;break}case"UpdateService":{o.set(i.key,i.update(o.get(i.key))),r=!0,n=a;break}}}if(!r)return np(o);let s=new Map;for(let[i]of t.unsafeMap)if(o.has(i))s.set(i,o.get(i)),o.delete(i);for(let[i,a]of o)s.set(i,a);return np(s)});var stt=Symbol.for("effect/DifferHashSetPatch");function wJ(e){return e}var k1={...Qh.prototype,[stt]:{_Value:wJ,_Key:wJ,_Patch:wJ}},itt=Object.assign(Object.create(k1),{_tag:"Empty"}),att=Object.create(itt),kJ=()=>att,ctt=Object.assign(Object.create(k1),{_tag:"AndThen"}),ltt=(e,t)=>{let r=Object.create(ctt);return r.first=e,r.second=t,r},utt=Object.assign(Object.create(k1),{_tag:"Add"}),ptt=(e)=>{let t=Object.create(utt);return t.value=e,t},ftt=Object.assign(Object.create(k1),{_tag:"Remove"}),dtt=(e)=>{let t=Object.create(ftt);return t.value=e,t},Rfe=(e,t)=>{let[r,n]=Sy([e,kJ()],([o,s],i)=>{if(gI(i)(o))return[Vh(i)(o),s];return[o,w1(ptt(i))(s)]})(t);return Sy(n,(o,s)=>w1(dtt(s))(o))(r)},w1=p(2,(e,t)=>ltt(e,t)),Mfe=p(2,(e,t)=>{if(e._tag==="Empty")return t;let r=t,n=We(e);while(kn(n)){let o=Ai(n),s=va(n);switch(o._tag){case"Empty":{n=s;break}case"AndThen":{n=wn(o.first)(wn(o.second)(s));break}case"Add":{r=ou(o.value)(r),n=s;break}case"Remove":r=Vh(o.value)(r),n=s}}return r});var htt=Symbol.for("effect/DifferReadonlyArrayPatch");function Pfe(e){return e}var kT={...Qh.prototype,[htt]:{_Value:Pfe,_Patch:Pfe}},gtt=Object.assign(Object.create(kT),{_tag:"Empty"}),xtt=Object.create(gtt),IJ=()=>xtt,ytt=Object.assign(Object.create(kT),{_tag:"AndThen"}),Stt=(e,t)=>{let r=Object.create(ytt);return r.first=e,r.second=t,r},Ett=Object.assign(Object.create(kT),{_tag:"Append"}),btt=(e)=>{let t=Object.create(Ett);return t.values=e,t},Ctt=Object.assign(Object.create(kT),{_tag:"Slice"}),wtt=(e,t)=>{let r=Object.create(Ctt);return r.from=e,r.until=t,r},ktt=Object.assign(Object.create(kT),{_tag:"Update"}),Itt=(e,t)=>{let r=Object.create(ktt);return r.index=e,r.patch=t,r},Dfe=(e)=>{let t=0,r=IJ();while(t<e.oldValue.length&&t<e.newValue.length){let n=e.oldValue[t],o=e.newValue[t],s=e.differ.diff(n,o);if(!ge(s,e.differ.empty))r=wT(r,Itt(t,s));t=t+1}if(t<e.oldValue.length)r=wT(r,wtt(0,t));if(t<e.newValue.length)r=wT(r,btt(wf(t)(e.newValue)));return r},wT=p(2,(e,t)=>Stt(e,t)),Ffe=p(3,(e,t,r)=>{if(e._tag==="Empty")return t;let n=t.slice(),o=tt(e);while(tp(o)){let s=jr(o),i=ts(o);switch(s._tag){case"Empty":{o=i;break}case"AndThen":{i.unshift(s.first,s.second),o=i;break}case"Append":{for(let a of s.values)n.push(a);o=i;break}case"Slice":{n=n.slice(s.from,s.until),o=i;break}case"Update":{n[s.index]=r.patch(s.patch,n[s.index]),o=i;break}}}return n});var Nfe=Symbol.for("effect/Differ"),Ott={[Nfe]:{_P:te,_V:te},pipe(){return ce(this,arguments)}},by=(e)=>{let t=Object.create(Ott);return t.empty=e.empty,t.diff=e.diff,t.combine=e.combine,t.patch=e.patch,t},AJ=()=>by({empty:CJ(),combine:(e,t)=>bT(t)(e),diff:(e,t)=>vfe(e,t),patch:(e,t)=>Tfe(t)(e)});var OJ=()=>by({empty:kJ(),combine:(e,t)=>w1(t)(e),diff:(e,t)=>Rfe(e,t),patch:(e,t)=>Mfe(t)(e)});var _J=(e)=>by({empty:IJ(),combine:(t,r)=>wT(t,r),diff:(t,r)=>Dfe({oldValue:t,newValue:r,differ:e}),patch:(t,r)=>Ffe(t,r,e)});var I1=()=>Lfe((e,t)=>t),Lfe=(e)=>by({empty:te,combine:(t,r)=>{if(t===te)return r;if(r===te)return t;return(n)=>r(t(n))},diff:(t,r)=>{if(ge(t,r))return te;return nl(r)},patch:(t,r)=>e(r,t(r))});var IT=255,Ufe=8,A1=(e)=>e&IT,O1=(e)=>e>>Ufe&IT,qb=(e,t)=>(e&IT)+((t&e&IT)<<Ufe),_1=qb(0,0),Hfe=(e)=>qb(e,e),qfe=(e)=>qb(e,0);var Bfe=p(2,(e,t)=>qb(A1(e)&~t,O1(e)));var TJ=p(2,(e,t)=>e|t);var Wfe=(e)=>~e>>>0&IT;var $fe=0,iu=1,RJ=2,v1=4,AT=16,T1=32;var MJ=(e)=>_T(e,T1),OT=p(2,(e,t)=>e&~t);var R1=p(2,(e,t)=>e|t);var nm=(e)=>EI(e)&&!jfe(e),EI=(e)=>_T(e,iu);var _T=p(2,(e,t)=>(e&t)!==0),M1=(...e)=>e.reduce((t,r)=>t|r,0),PJ=M1($fe);var P1=(e)=>_T(e,v1);var jfe=(e)=>_T(e,AT);var au=p(2,(e,t)=>qb(e^t,t)),om=p(2,(e,t)=>e&(Wfe(A1(t))|O1(t))|A1(t)&O1(t));var D1=by({empty:_1,diff:(e,t)=>au(e,t),combine:(e,t)=>TJ(t)(e),patch:(e,t)=>om(t,e)});var Vfe=_1;var DJ=Hfe,FJ=qfe;var NJ=Bfe;var Kfe={_tag:"Empty"},UJ=(e,t)=>({_tag:"Par",left:e,right:t}),F1=(e,t)=>({_tag:"Seq",left:e,right:t}),HJ=(e,t)=>({_tag:"Single",dataSource:e,blockedRequest:t});var Jfe=(e)=>{let t=Kh(e),r=up();while(!0){let[n,o]=Ife(t,[Yfe(),up()],([s,i],a)=>{let[c,l]=_tt(a);return[Ftt(s,c),kfe(i,l)]});if(r=vtt(r,n),Rc(o))return Afe(r);t=o}throw Error("BUG: BlockedRequests.flatten - please report an issue at https://github.com/Effect-TS/effect/issues")},_tt=(e)=>{let t=e,r=Yfe(),n=up(),o=up();while(!0)switch(t._tag){case"Empty":{if(Rc(n))return[r,o];t=n.head,n=n.tail;break}case"Par":{n=Js(t.right,n),t=t.left;break}case"Seq":{let{left:s,right:i}=t;switch(s._tag){case"Empty":{t=i;break}case"Par":{let{left:a,right:c}=s;t=UJ(F1(a,i),F1(c,i));break}case"Seq":{let{left:a,right:c}=s;t=F1(a,F1(c,i));break}case"Single":{t=s,o=Js(i,o);break}}break}case"Single":{if(r=Dtt(r,t),Rc(n))return[r,o];t=n.head,n=n.tail;break}}throw Error("BUG: BlockedRequests.step - please report an issue at https://github.com/Effect-TS/effect/issues")},vtt=(e,t)=>{if(Rc(e))return Kh(LJ(t));if(Ntt(t))return e;let r=Wtt(e.head),n=Ltt(t);if(r.length===1&&n.length===1&&ge(r[0],n[0]))return Js(Btt(e.head,LJ(t)),e.tail);return Js(LJ(t),e)},Ttt=Symbol.for("effect/RequestBlock/Entry");class Qfe{request;result;listeners;ownerId;state;[Ttt]=Rtt;constructor(e,t,r,n,o){this.request=e,this.result=t,this.listeners=r,this.ownerId=n,this.state=o}}var Rtt={_R:(e)=>e};var qJ=(e)=>new Qfe(e.request,e.result,e.listeners,e.ownerId,e.state),Mtt=Symbol.for("effect/RequestBlock/RequestBlockParallel"),Ptt={_R:(e)=>e};class N1{map;[Mtt]=Ptt;constructor(e){this.map=e}}var Yfe=()=>new N1(Ta());var Dtt=(e,t)=>new N1(Efe(e.map,t.dataSource,(r)=>l4(jt(r,Is(t.blockedRequest)),()=>We(t.blockedRequest)))),Ftt=(e,t)=>new N1(SJ(e.map,t.map,(r,n,o)=>As(r,o,be(Ub(r,o),{onNone:()=>n,onSome:(s)=>Vt(n,s)})))),Ntt=(e)=>xI(e.map),Ltt=(e)=>Array.from(yJ(e.map)),LJ=(e)=>qtt(Cfe(e.map,(t)=>We(t))),Utt=Symbol.for("effect/RequestBlock/RequestBlockSequential"),Htt={_R:(e)=>e};class BJ{map;[Utt]=Htt;constructor(e){this.map=e}}var qtt=(e)=>new BJ(e),Btt=(e,t)=>new BJ(SJ(t.map,e.map,(r,n,o)=>As(r,o,be(Ub(r,o),{onNone:()=>Ze(),onSome:(s)=>Vt(s,n)}))));var Wtt=(e)=>Array.from(yJ(e.map)),Zfe=(e)=>Array.from(e.map);var Cy="Die",Yh="Empty",wy="Fail",ky="Interrupt",Iy="Parallel",Ay="Sequential";var rde="effect/Cause",L1=Symbol.for(rde),$tt={_E:(e)=>e},wI={[L1]:$tt,[Ne](){return d(oe(rde),Ee(oe(jtt(this))),lt(this))},[Pe](e){return vT(e)&&yde(this,e)},pipe(){return ce(this,arguments)},toJSON(){switch(this._tag){case"Empty":return{_id:"Cause",_tag:this._tag};case"Die":return{_id:"Cause",_tag:this._tag,defect:fr(this.defect)};case"Interrupt":return{_id:"Cause",_tag:this._tag,fiberId:this.fiberId.toJSON()};case"Fail":return{_id:"Cause",_tag:this._tag,failure:fr(this.error)};case"Sequential":case"Parallel":return{_id:"Cause",_tag:this._tag,left:fr(this.left),right:fr(this.right)}}},toString(){return cu(this)},[dt](){return this.toJSON()}},Qs=(()=>{let e=Object.create(wI);return e._tag=Yh,e})(),xl=(e)=>{let t=Object.create(wI);return t._tag=wy,t.error=e,t},Wo=(e)=>{let t=Object.create(wI);return t._tag=Cy,t.defect=e,t},Yi=(e)=>{let t=Object.create(wI);return t._tag=ky,t.fiberId=e,t},ms=(e,t)=>{let r=Object.create(wI);return r._tag=Iy,r.left=e,r.right=t,r},yn=(e,t)=>{let r=Object.create(wI);return r._tag=Ay,r.left=e,r.right=t,r},vT=(e)=>de(e,L1),U1=(e)=>e._tag===Yh,nde=(e)=>e._tag===wy,Wb=(e)=>e._tag===Cy,ode=(e)=>e._tag===ky,sde=(e)=>e._tag===Ay,ide=(e)=>e._tag===Iy,ade=(e)=>jb(e,void 0,Gtt),Oy=(e)=>{if(e._tag===Yh)return!0;return Zh(e,!0,(t,r)=>{switch(r._tag){case Yh:return _(t);case Cy:case wy:case ky:return _(!1);default:return R()}})},cde=(e)=>Oe(OI(e)),lde=(e)=>Oe($J(e)),kI=(e)=>Oe(jJ(e)),zb=(e)=>jb(void 0,Ktt)(e),II=(e)=>ml(Zh(e,Ze(),(t,r)=>r._tag===wy?_(d(t,wn(r.error))):R())),AI=(e)=>ml(Zh(e,Ze(),(t,r)=>r._tag===Cy?_(d(t,wn(r.defect))):R())),$b=(e)=>Zh(e,gl(),(t,r)=>r._tag===ky?_(d(t,ou(r.fiberId))):R()),OI=(e)=>sm(e,(t)=>t._tag===wy?_(t.error):R()),_f=(e)=>{let t=OI(e);switch(t._tag){case"None":return ye(e);case"Some":return Ie(t.value)}},$J=(e)=>sm(e,(t)=>t._tag===Cy?_(t.defect):R()),ude=(e)=>im(e,{onEmpty:_(Qs),onFail:jt(xl),onDie:(t)=>_(Wo(t)),onInterrupt:(t)=>_(Yi(t)),onSequential:jd(yn),onParallel:jd(ms)}),jJ=(e)=>sm(e,(t)=>t._tag===ky?_(t.fiberId):R()),H1=(e)=>im(e,{onEmpty:R(),onFail:()=>R(),onDie:(t)=>_(Wo(t)),onInterrupt:()=>R(),onSequential:jd(yn),onParallel:jd(ms)}),pde=(e)=>im(e,{onEmpty:R(),onFail:(t)=>_(Wo(t)),onDie:(t)=>_(Wo(t)),onInterrupt:()=>R(),onSequential:jd(yn),onParallel:jd(ms)}),fde=(e)=>im(e,{onEmpty:gl(),onFail:(t)=>Of(xl(t)),onDie:(t)=>Of(Wo(t)),onInterrupt:(t)=>Of(Yi(t)),onSequential:(t,r)=>dJ(t,(n)=>fJ(r,(o)=>yn(n,o))),onParallel:(t,r)=>dJ(t,(n)=>fJ(r,(o)=>ms(n,o)))}),TT=(e)=>im(e,{onEmpty:Qs,onFail:()=>Qs,onDie:Wo,onInterrupt:Yi,onSequential:yn,onParallel:ms}),dde=(e)=>im(e,{onEmpty:Qs,onFail:Wo,onDie:Wo,onInterrupt:Yi,onSequential:yn,onParallel:ms}),mde=p(2,(e,t)=>im(e,{onEmpty:_(Qs),onFail:(r)=>_(xl(r)),onDie:(r)=>{let n=t(r);return Oe(n)?R():_(Wo(r))},onInterrupt:(r)=>_(Yi(r)),onSequential:jd(yn),onParallel:jd(ms)})),hde=p(2,(e,t)=>_I(e,()=>t)),_I=p(2,(e,t)=>CI(e,(r)=>xl(t(r)))),CI=p(2,(e,t)=>im(e,{onEmpty:Qs,onFail:(r)=>t(r),onDie:(r)=>Wo(r),onInterrupt:(r)=>Yi(r),onSequential:(r,n)=>yn(r,n),onParallel:(r,n)=>ms(r,n)})),q1=(e)=>CI(e,te),gde=p(2,(e,t)=>Xl(t)?CI(e,t):CI(e,()=>t)),xde=p(2,(e,t)=>{if(t._tag===Yh||e===t)return!0;return Zh(e,!1,(r,n)=>_(r||yde(n,t)))}),yde=(e,t)=>{let r=We(e),n=We(t);while(kn(r)&&kn(n)){let[o,s]=d(Ai(r),Zh([gl(),Ze()],([c,l],u)=>{let[f,h]=WJ(u);return _([d(c,tm(f)),d(l,Vt(h))])})),[i,a]=d(Ai(n),Zh([gl(),Ze()],([c,l],u)=>{let[f,h]=WJ(u);return _([d(c,tm(f)),d(l,Vt(h))])}));if(!ge(o,i))return!1;r=s,n=a}return!0},jtt=(e)=>Vtt(We(e),Ze()),Vtt=(e,t)=>{while(!0){let[r,n]=d(e,ki([gl(),Ze()],([s,i],a)=>{let[c,l]=WJ(a);return[d(s,tm(c)),d(i,Vt(l))]})),o=jh(r)>0?d(t,wn(r)):t;if(At(n))return ml(o);e=n,t=o}throw Error(gb("Cause.flattenCauseLoop"))},sm=p(2,(e,t)=>{let r=[e];while(r.length>0){let n=r.pop(),o=t(n);switch(o._tag){case"None":{switch(n._tag){case Ay:case Iy:{r.push(n.right),r.push(n.left);break}}break}case"Some":return o}}return R()}),Sde=p(2,(e,t)=>jb(e,void 0,Jtt(t))),WJ=(e)=>{let t=e,r=[],n=gl(),o=Ze();while(t!==void 0)switch(t._tag){case Yh:{if(r.length===0)return[n,o];t=r.pop();break}case wy:{if(n=ou(n,kf(t._tag,t.error)),r.length===0)return[n,o];t=r.pop();break}case Cy:{if(n=ou(n,kf(t._tag,t.defect)),r.length===0)return[n,o];t=r.pop();break}case ky:{if(n=ou(n,kf(t._tag,t.fiberId)),r.length===0)return[n,o];t=r.pop();break}case Ay:{switch(t.left._tag){case Yh:{t=t.right;break}case Ay:{t=yn(t.left.left,yn(t.left.right,t.right));break}case Iy:{t=ms(yn(t.left.left,t.right),yn(t.left.right,t.right));break}default:{o=wn(o,t.right),t=t.left;break}}break}case Iy:{r.push(t.right),t=t.left;break}}throw Error(gb("Cause.evaluateCauseLoop"))},Gtt={emptyCase:()=>0,failCase:()=>1,dieCase:()=>1,interruptCase:()=>1,sequentialCase:(e,t,r)=>t+r,parallelCase:(e,t,r)=>t+r},Ktt={emptyCase:uo,failCase:Fo,dieCase:Fo,interruptCase:uo,sequentialCase:(e,t,r)=>t&&r,parallelCase:(e,t,r)=>t&&r},Jtt=(e)=>({emptyCase:()=>Qs,failCase:(t,r)=>xl(r),dieCase:(t,r)=>Wo(r),interruptCase:(t,r)=>Yi(r),sequentialCase:(t,r,n)=>{if(e(r)){if(e(n))return yn(r,n);return r}if(e(n))return n;return Qs},parallelCase:(t,r,n)=>{if(e(r)){if(e(n))return ms(r,n);return r}if(e(n))return n;return Qs}}),ede="SequentialCase",tde="ParallelCase",im=p(2,(e,{onDie:t,onEmpty:r,onFail:n,onInterrupt:o,onParallel:s,onSequential:i})=>jb(e,void 0,{emptyCase:()=>r,failCase:(a,c)=>n(c),dieCase:(a,c)=>t(c),interruptCase:(a,c)=>o(c),sequentialCase:(a,c,l)=>i(c,l),parallelCase:(a,c,l)=>s(c,l)})),Zh=p(3,(e,t,r)=>{let n=t,o=e,s=[];while(o!==void 0){let i=r(n,o);switch(n=Oe(i)?i.value:n,o._tag){case Ay:{s.push(o.right),o=o.left;break}case Iy:{s.push(o.right),o=o.left;break}default:{o=void 0;break}}if(o===void 0&&s.length>0)o=s.pop()}return n}),jb=p(3,(e,t,r)=>{let n=[e],o=[];while(n.length>0){let i=n.pop();switch(i._tag){case Yh:{o.push(ye(r.emptyCase(t)));break}case wy:{o.push(ye(r.failCase(t,i.error)));break}case Cy:{o.push(ye(r.dieCase(t,i.defect)));break}case ky:{o.push(ye(r.interruptCase(t,i.fiberId)));break}case Ay:{n.push(i.right),n.push(i.left),o.push(Ie({_tag:ede}));break}case Iy:{n.push(i.right),n.push(i.left),o.push(Ie({_tag:tde}));break}}}let s=[];while(o.length>0){let i=o.pop();switch(i._tag){case"Left":{switch(i.left._tag){case ede:{let a=s.pop(),c=s.pop(),l=r.sequentialCase(t,a,c);s.push(l);break}case tde:{let a=s.pop(),c=s.pop(),l=r.parallelCase(t,a,c);s.push(l);break}}break}case"Right":{s.push(i.right);break}}}if(s.length===0)throw Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return s.pop()}),cu=(e,t)=>{if(zb(e))return"All fibers interrupted without errors.";return Vb(e).map(function(r){if(t?.renderErrorCause!==!0||r.cause===void 0)return r.stack;return`${r.stack} {
|
|
156
|
+
${Ede(r.cause," ")}
|
|
157
|
+
}`}).join(`
|
|
158
|
+
`)},Ede=(e,t)=>{let r=e.stack.split(`
|
|
159
|
+
`),n=`${t}[cause]: ${r[0]}`;for(let o=1,s=r.length;o<s;o++)n+=`
|
|
160
|
+
${t}${r[o]}`;if(e.cause)n+=` {
|
|
161
|
+
${Ede(e.cause,`${t} `)}
|
|
162
|
+
${t}}`;return n},zJ=(e)=>{let t=typeof e==="object"&&e!==null,r=Error.stackTraceLimit;Error.stackTraceLimit=1;let n=Error(B1(e),t&&"cause"in e&&typeof e.cause<"u"?{cause:zJ(e.cause)}:void 0);if(Error.stackTraceLimit=r,n.message==="")n.message="An error has occurred";if(Error.stackTraceLimit=r,n.name=e instanceof Error?e.name:"Error",t){if(Bb in e)n.span=e[Bb];Object.keys(e).forEach((o)=>{if(!(o in n))n[o]=e[o]})}return n.stack=Ytt(`${n.name}: ${n.message}`,e instanceof Error&&e.stack?e.stack:"",n.span),n},B1=(e)=>{if(typeof e==="string")return e;if(typeof e==="object"&&e!==null&&e instanceof Error)return e.message;try{if(de(e,"toString")&&Xl(e.toString)&&e.toString!==Object.prototype.toString&&e.toString!==globalThis.Array.prototype.toString)return e.toString()}catch{}return Wk(e)},Qtt=/\((.*)\)/g,RT=je("effect/Tracer/spanToTrace",()=>new WeakMap),Ytt=(e,t,r)=>{let n=[e],o=t.startsWith(e)?t.slice(e.length).split(`
|
|
163
|
+
`):t.split(`
|
|
164
|
+
`);for(let s=1;s<o.length;s++){if(o[s].includes(" at new BaseEffectError")||o[s].includes(" at new YieldableError")){s++;continue}if(o[s].includes("Generator.next"))break;if(o[s].includes("effect_internal_function"))break;n.push(o[s].replace(/at .*effect_instruction_i.*\((.*)\)/,"at $1").replace(/EffectPrimitive\.\w+/,"<anonymous>"))}if(r){let s=r,i=0;while(s&&s._tag==="Span"&&i<10){let a=RT.get(s);if(typeof a==="function"){let c=a();if(typeof c==="string"){let l=c.matchAll(Qtt),u=!1;for(let[,f]of l)u=!0,n.push(` at ${s.name} (${f})`);if(!u)n.push(` at ${s.name} (${c.replace(/^at /,"")})`)}else n.push(` at ${s.name}`)}else n.push(` at ${s.name}`);s=Ar(s.parent),i++}}return n.join(`
|
|
165
|
+
`)},Bb=Symbol.for("effect/SpanAnnotation"),Vb=(e)=>jb(e,void 0,{emptyCase:()=>[],dieCase:(t,r)=>[zJ(r)],failCase:(t,r)=>[zJ(r)],interruptCase:()=>[],parallelCase:(t,r,n)=>[...r,...n],sequentialCase:(t,r,n)=>[...r,...n]});var _y="Pending",Gb="Done";var Ztt="effect/Deferred",W1=Symbol.for(Ztt),Cde={_E:(e)=>e,_A:(e)=>e},wde=(e)=>({_tag:_y,joiners:e}),VJ=(e)=>({_tag:Gb,effect:e});class vy{self;called=!1;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(e){return{value:e,done:!0}}throw(e){throw e}[Symbol.iterator](){return new vy(this.self)}}var tg=(e,t)=>{let r=new Os("Blocked");return r.effect_instruction_i0=e,r.effect_instruction_i1=t,r},j1=(e)=>{let t=new Os("RunBlocked");return t.effect_instruction_i0=e,t},rg=Symbol.for("effect/Effect");class GJ{patch;op;_op=Nv;constructor(e,t){this.patch=e,this.op=t}}class Os{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[rg]=Hd;constructor(e){this._op=e}[Pe](e){return this===e}[Ne](){return lt(this,sy(this))}pipe(){return ce(this,arguments)}toJSON(){return{_id:"Effect",_op:this._op,effect_instruction_i0:fr(this.effect_instruction_i0),effect_instruction_i1:fr(this.effect_instruction_i1),effect_instruction_i2:fr(this.effect_instruction_i2)}}toString(){return Ut(this.toJSON())}[dt](){return this.toJSON()}[Symbol.iterator](){return new vy(new yf(this))}}class KJ{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[rg]=Hd;constructor(e){this._op=e,this._tag=e}[Pe](e){return nC(e)&&e._op==="Failure"&&ge(this.effect_instruction_i0,e.effect_instruction_i0)}[Ne](){return d(It(this._tag),Ee(oe(this.effect_instruction_i0)),lt(this))}get cause(){return this.effect_instruction_i0}pipe(){return ce(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,cause:this.cause.toJSON()}}toString(){return Ut(this.toJSON())}[dt](){return this.toJSON()}[Symbol.iterator](){return new vy(new yf(this))}}class JJ{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[rg]=Hd;constructor(e){this._op=e,this._tag=e}[Pe](e){return nC(e)&&e._op==="Success"&&ge(this.effect_instruction_i0,e.effect_instruction_i0)}[Ne](){return d(It(this._tag),Ee(oe(this.effect_instruction_i0)),lt(this))}get value(){return this.effect_instruction_i0}pipe(){return ce(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,value:fr(this.value)}}toString(){return Ut(this.toJSON())}[dt](){return this.toJSON()}[Symbol.iterator](){return new vy(new yf(this))}}var Hr=(e)=>de(e,rg),Ot=(e)=>{let t=new Os(eL);return t.effect_instruction_i0=e,t},vI=p(3,(e,t,r)=>Un((n)=>V(e,(o)=>V(fo(Re(()=>n(t(o)))),(s)=>Re(()=>r(o,s)).pipe(po({onFailure:(i)=>{switch(s._tag){case bn:return dr(yn(s.effect_instruction_i0,i));case Cn:return dr(i)}},onSuccess:()=>s})))))),Kr=p(2,(e,t)=>V(e,()=>X(t))),In=(e)=>Kr(e,void 0),WT=function(){let e=new Os(Rh);switch(arguments.length){case 2:{e.effect_instruction_i0=arguments[0],e.commit=arguments[1];break}case 3:{e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.commit=arguments[2];break}case 4:{e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.effect_instruction_i2=arguments[2],e.commit=arguments[3];break}default:throw Error(gb("you're not supposed to end up here"))}return e},TI=(e,t=Ks)=>{let r=new Os(Eb),n=void 0;return r.effect_instruction_i0=(o)=>{n=e(o)},r.effect_instruction_i1=t,lc(r,(o)=>Hr(n)?n:yt)},am=(e,t=Ks)=>Re(()=>TI(e,t)),ac=(e,t=Ks)=>WT(e,function(){let r=void 0,n=void 0;function o(c){if(r)r(c);else if(n===void 0)n=c}let s=new Os(Eb);s.effect_instruction_i0=(c)=>{if(r=c,n)c(n)},s.effect_instruction_i1=t;let i=void 0,a=void 0;if(this.effect_instruction_i0.length!==1)a=new AbortController,i=on(()=>this.effect_instruction_i0(o,a.signal));else i=on(()=>this.effect_instruction_i0(o));return i||a?lc(s,(c)=>{if(a)a.abort();return i??yt}):s});var cm=p(2,(e,t)=>{let r=new Os($k);return r.effect_instruction_i0=e,r.effect_instruction_i1=t,r}),lu=p(2,(e,t)=>di(e,{onFailure:t,onSuccess:X})),zT=p(3,(e,t,r)=>cm(e,(n)=>{let o=_f(n);switch(o._tag){case"Left":return t(o.left)?r(o.left):dr(n);case"Right":return dr(o.right)}})),Ide=p(2,(e,t)=>cm(e,(r)=>{let n=_f(r);switch(n._tag){case"Left":return d(t(n.left),Je(()=>dr(r)));case"Right":return dr(n.right)}})),Ade=(e)=>Ot((t,r)=>e(EI(r.runtimeFlags))),z1=Symbol.for("effect/OriginalAnnotation"),Ode=(e)=>{if(de(e,z1))return e[z1];return e},V1=(e,t)=>{if(Oe(t))return new Proxy(e,{has(r,n){return n===Bb||n===z1||n in r},get(r,n){if(n===Bb)return t.value;if(n===z1)return e;return r[n]}});return e},cc=(e)=>Zo(e)&&!(Bb in e)?Ot((t)=>dr(Wo(V1(e,p2(t))))):dr(Wo(e)),Ty=(e)=>ng(()=>Wo(new s6(e))),Ry=(e)=>V(ue(e),cc),pp=(e)=>di(e,{onFailure:(t)=>X(Ie(t)),onSuccess:(t)=>X(ye(t))}),fo=(e)=>$T(e,{onFailure:Or,onSuccess:Tr}),Gt=(e)=>Zo(e)&&!(Bb in e)?Ot((t)=>dr(xl(V1(e,p2(t))))):dr(xl(e)),fp=(e)=>V(ue(e),Gt),dr=(e)=>{let t=new KJ(bn);return t.effect_instruction_i0=e,t},ng=(e)=>V(ue(e),dr),dp=Ot((e)=>X(e.id())),yl=(e)=>Ot((t)=>e(t.id())),V=p(2,(e,t)=>{let r=new Os(jk);return r.effect_instruction_i0=e,r.effect_instruction_i1=t,r}),My=p(2,(e,t)=>V(e,(r)=>{let n=typeof t==="function"?t(r):t;if(Hr(n))return n;else if(VK(n))return TI((o)=>{n.then((s)=>o(X(s)),(s)=>o(Gt(new rC(s,"An unknown error occurred in Effect.andThen"))))});return X(n)})),G1=(e)=>{let t=new Os("OnStep");return t.effect_instruction_i0=e,t},Sl=(e)=>V(e,te),Py=(e)=>di(e,{onFailure:X,onSuccess:Gt}),$T=p(2,(e,t)=>po(e,{onFailure:(r)=>X(t.onFailure(r)),onSuccess:(r)=>X(t.onSuccess(r))})),po=p(2,(e,t)=>{let r=new Os(Vk);return r.effect_instruction_i0=e,r.effect_instruction_i1=t.onFailure,r.effect_instruction_i2=t.onSuccess,r}),di=p(2,(e,t)=>po(e,{onFailure:(r)=>{if(AI(r).length>0)return dr(dde(r));let o=II(r);if(o.length>0)return t.onFailure(Zd(o));return dr(r)},onSuccess:t.onSuccess})),Ra=p(2,(e,t)=>Re(()=>{let r=De(e),n=Vd(r.length),o=0;return Kr(Ny({while:()=>o<r.length,body:()=>t(r[o],o),step:(s)=>{n[o++]=s}}),n)})),Mc=p(2,(e,t)=>Re(()=>{let r=De(e),n=0;return Ny({while:()=>n<r.length,body:()=>t(r[n],n),step:()=>{n++}})})),K1=p((e)=>typeof e[0]==="boolean"||Hr(e[0]),(e,t)=>Hr(e)?V(e,(r)=>r?t.onTrue():t.onFalse()):e?t.onTrue():t.onFalse()),Zn=V(dp,(e)=>jT(e)),jT=(e)=>dr(Yi(e)),vf=(e)=>{let t=new Os(Mh);return t.effect_instruction_i0=DJ(iu),t.effect_instruction_i1=()=>e,t},J1=(e)=>WT(e,function(){let t=new Os(Mh);return t.effect_instruction_i0=DJ(iu),t.effect_instruction_i1=(r)=>EI(r)?on(()=>this.effect_instruction_i0(vf)):on(()=>this.effect_instruction_i0(Dc)),t}),lm=p(2,(e,t)=>Un((r)=>V(fo(r(e)),(n)=>n0(t,n)))),xe=p(2,(e,t)=>V(e,(r)=>ue(()=>t(r)))),VT=p(2,(e,t)=>di(e,{onFailure:(r)=>fp(()=>t.onFailure(r)),onSuccess:(r)=>ue(()=>t.onSuccess(r))})),Dy=p(2,(e,t)=>po(e,{onFailure:(r)=>{let n=_f(r);switch(n._tag){case"Left":return fp(()=>t(n.left));case"Right":return dr(n.right)}},onSuccess:X})),Q1=p(2,(e,t)=>Pc(e,(r)=>r0(r)?yt:t(r.effect_instruction_i0))),Pc=p(2,(e,t)=>Un((r)=>po(r(e),{onFailure:(n)=>{let o=Or(n);return po(t(o),{onFailure:(s)=>Or(yn(n,s)),onSuccess:()=>o})},onSuccess:(n)=>{let o=Tr(n);return Qt(t(o),o)}}))),lc=p(2,(e,t)=>Pc(e,iC({onFailure:(r)=>zb(r)?In(t($b(r))):yt,onSuccess:()=>yt}))),Kb=p(2,(e,t)=>Xtt(e,t,X)),Jb=(e)=>QJ(e,te),QJ=p(2,(e,t)=>di(e,{onFailure:(r)=>cc(t(r)),onSuccess:X})),_de=nI,RI=Ot((e,t)=>X(t.runtimeFlags)),X=(e)=>{let t=new JJ(Cn);return t.effect_instruction_i0=e,t},Re=(e)=>{let t=new Os(Rh);return t.commit=e,t},ue=(e)=>{let t=new Os(XN);return t.effect_instruction_i0=e,t},rs=p((e)=>e.length===3||e.length===2&&!(Zo(e[1])&&("onlyEffect"in e[1])),(e,t)=>V(e,(r)=>{let n=typeof t==="function"?t(r):t;if(Hr(n))return Kr(n,r);else if(VK(n))return TI((o)=>{n.then((s)=>o(X(r)),(s)=>o(Gt(new rC(s,"An unknown error occurred in Effect.tap"))))});return X(r)})),Y1=(e)=>Ot((t)=>{let r=t.getFiberRef(DT),n=d(r,Je(()=>t.scope()));return e(Xn(DT,_(n)))}),Xtt=p(3,(e,t,r)=>po(e,{onFailure:(n)=>{if(AI(n).length>0)return dr(ru(pde(n)));return t()},onSuccess:r})),Dc=(e)=>{let t=new Os(Mh);return t.effect_instruction_i0=FJ(iu),t.effect_instruction_i1=()=>e,t},Un=(e)=>WT(e,function(){let t=new Os(Mh);return t.effect_instruction_i0=FJ(iu),t.effect_instruction_i1=(r)=>EI(r)?on(()=>this.effect_instruction_i0(vf)):on(()=>this.effect_instruction_i0(Dc)),t}),yt=X(void 0);var Fy=(e)=>{let t=new Os(Mh);return t.effect_instruction_i0=e,t.effect_instruction_i1=void 0,t},Tf=p(2,(e,t)=>V(t,(r)=>{if(r)return d(e,xe(_));return X(R())})),Ny=(e)=>{let t=new Os(Gk);return t.effect_instruction_i0=e.while,t.effect_instruction_i1=e.body,t.effect_instruction_i2=e.step,t},PT=(e)=>Re(()=>{let t=new Os(bb);return t.effect_instruction_i0=e(),t}),Z1=function(){let e=arguments.length===1?arguments[0]:arguments[1].bind(arguments[0]);return PT(()=>e(d))},og=(e,...t)=>Object.defineProperty(t.length===0?function(...r){return PT(()=>e.apply(this,r))}:function(...r){let n=PT(()=>e.apply(this,r));for(let o of t)n=o(n,...r);return n},"length",{value:e.length,configurable:!0}),vde=p(2,(e,t)=>Xn(e,YT,t)),Tde=p(2,(e,t)=>Xn(e,PI,t)),X1=p(2,(e,t)=>{let r=new Os(Mh);return r.effect_instruction_i0=t,r.effect_instruction_i1=()=>e,r}),Rde=p(2,(e,t)=>Xn(e,Zb,t)),Mde=p(2,(e,t)=>Xn(e,mm,t)),um=(e)=>{let t=new Os(Kk);return typeof e?.priority<"u"?n6(t,e.priority):t},Qb=p(2,(e,t)=>V(e,(r)=>xe(t,(n)=>[r,n])));var Yb=p(2,(e,t)=>V(e,(r)=>Kr(t,r))),Qt=p(2,(e,t)=>V(e,()=>t)),pm=p(3,(e,t,r)=>V(e,(n)=>xe(t,(o)=>r(n,o)))),Ly=am(()=>{let e=setInterval(()=>{},2147483647);return ue(()=>clearInterval(e))}),Rf=(e)=>V(dp,(t)=>d(e,El(t))),El=p(2,(e,t)=>V(e.interruptAsFork(t),()=>e.await)),YJ={_tag:"All",syslog:0,label:"ALL",ordinal:Number.MIN_SAFE_INTEGER,pipe(){return ce(this,arguments)}},ZJ={_tag:"Fatal",syslog:2,label:"FATAL",ordinal:50000,pipe(){return ce(this,arguments)}},XJ={_tag:"Error",syslog:3,label:"ERROR",ordinal:40000,pipe(){return ce(this,arguments)}},e2={_tag:"Warning",syslog:4,label:"WARN",ordinal:30000,pipe(){return ce(this,arguments)}},MI={_tag:"Info",syslog:6,label:"INFO",ordinal:20000,pipe(){return ce(this,arguments)}},t2={_tag:"Debug",syslog:7,label:"DEBUG",ordinal:1e4,pipe(){return ce(this,arguments)}},e6={_tag:"Trace",syslog:7,label:"TRACE",ordinal:0,pipe(){return ce(this,arguments)}},t6={_tag:"None",syslog:7,label:"OFF",ordinal:Number.MAX_SAFE_INTEGER,pipe(){return ce(this,arguments)}},r2=[YJ,e6,t2,MI,e2,XJ,ZJ,t6],ert="effect/FiberRef",Pde=Symbol.for(ert),trt={_A:(e)=>e},Fc=(e)=>Ot((t)=>Tr(t.getFiberRef(e)));var _i=p(2,(e,t)=>V(Fc(e),t)),eg=p(2,(e,t)=>Dde(e,()=>[void 0,t]));var Dde=p(2,(e,t)=>Ot((r)=>{let[n,o]=t(r.getFiberRef(e));return r.setFiberRef(e,o),X(n)}));var rrt="effect/RequestResolver",Fde=Symbol.for(rrt),nrt={_A:(e)=>e,_R:(e)=>e};class Nde{runAll;target;[Fde]=nrt;constructor(e,t){this.runAll=e,this.target=t}[Ne](){return lt(this,this.target?oe(this.target):sy(this))}[Pe](e){return this.target?ort(e)&&ge(this.target,e.target):this===e}identified(...e){return new Nde(this.runAll,Fr(e))}pipe(){return ce(this,arguments)}}var ort=(e)=>de(e,Fde);var Xn=p(3,(e,t,r)=>vI(Yb(Fc(t),eg(t,r)),()=>e,(n)=>eg(t,n))),mi=p(3,(e,t,r)=>_i(t,(n)=>Xn(e,t,r(n)))),Io=(e,t)=>Uy(e,{differ:I1(),fork:t?.fork??te,join:t?.join}),r6=(e)=>{let t=OJ();return Uy(e,{differ:t,fork:t.empty})},srt=(e)=>{let t=_J(I1());return Uy(e,{differ:t,fork:t.empty})},GT=(e)=>{let t=AJ();return Uy(e,{differ:t,fork:t.empty})},Uy=(e,t)=>({...Sf,[Pde]:trt,initial:e,commit(){return Fc(this)},diff:(n,o)=>t.differ.diff(n,o),combine:(n,o)=>t.differ.combine(n,o),patch:(n)=>(o)=>t.differ.patch(n,o),fork:t.fork,join:t.join??((n,o)=>o)}),Lde=(e)=>Uy(e,{differ:D1,fork:D1.empty}),_s=je(Symbol.for("effect/FiberRef/currentContext"),()=>GT(Tn())),Mf=je(Symbol.for("effect/FiberRef/currentSchedulingPriority"),()=>Io(0)),KT=je(Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"),()=>Io(2048)),fm=je(Symbol.for("effect/FiberRef/currentLogAnnotation"),()=>Io(Ta())),JT=je(Symbol.for("effect/FiberRef/currentLogLevel"),()=>Io(MI)),QT=je(Symbol.for("effect/FiberRef/currentLogSpan"),()=>Io(up())),n6=p(2,(e,t)=>Xn(e,Mf,t)),Ude=p(2,(e,t)=>Xn(e,KT,t)),YT=je(Symbol.for("effect/FiberRef/currentConcurrency"),()=>Io("unbounded")),PI=je(Symbol.for("effect/FiberRef/currentRequestBatching"),()=>Io(!0)),DI=je(Symbol.for("effect/FiberRef/currentUnhandledErrorLogLevel"),()=>Io(_(t2))),ZT=je(Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"),()=>Io(_(e2))),Hde=p(2,(e,t)=>Xn(e,DI,t)),dm=je(Symbol.for("effect/FiberRef/currentMetricLabels"),()=>srt(Ge())),qde=Fc(dm),DT=je(Symbol.for("effect/FiberRef/currentForkScopeOverride"),()=>Io(R(),{fork:()=>R(),join:(e,t)=>e})),Hy=je(Symbol.for("effect/FiberRef/currentInterruptedCause"),()=>Io(Qs,{fork:()=>Qs,join:(e,t)=>e})),Zb=je(Symbol.for("effect/FiberRef/currentTracerEnabled"),()=>Io(!0)),mm=je(Symbol.for("effect/FiberRef/currentTracerTiming"),()=>Io(!0)),Xb=je(Symbol.for("effect/FiberRef/currentTracerSpanAnnotations"),()=>Io(Ta())),XT=je(Symbol.for("effect/FiberRef/currentTracerSpanLinks"),()=>Io(Ze())),e0=Symbol.for("effect/Scope"),t0=Symbol.for("effect/CloseableScope"),FI=(e,t)=>e.addFinalizer(()=>In(t)),qy=(e,t)=>e.addFinalizer(t),Nc=(e,t)=>e.close(t),uu=(e,t)=>e.fork(t),Bde=(e)=>o6(te)(e),o6=p(2,(e,t)=>{let r=d(e,OI,jt(t));switch(r._tag){case"None":return d(AI(e),If,be({onNone:()=>{let n=De($b(e)).flatMap((o)=>De(xT(o)).map((s)=>`#${s}`));return new i6(n?`Interrupted by fibers: ${n.join(", ")}`:void 0)},onSome:te}));case"Some":return r.value}}),NI=function(){class e extends globalThis.Error{commit(){return Gt(this)}toJSON(){let t={...this};if(this.message)t.message=this.message;if(this.cause)t.cause=this.cause;return t}[dt](){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 cu(xl(this),{renderErrorCause:!0});return this}}return Object.assign(e.prototype,tL),e}(),eC=(e,t)=>{class r extends NI{_tag=t}return Object.assign(r.prototype,e),r.prototype.name=t,r},FT=Symbol.for("effect/Cause/errors/RuntimeException"),s6=eC({[FT]:FT},"RuntimeException"),Wde=(e)=>de(e,FT),NT=Symbol.for("effect/Cause/errors/InterruptedException"),i6=eC({[NT]:NT},"InterruptedException"),n2=(e)=>de(e,NT),LT=Symbol.for("effect/Cause/errors/IllegalArgument"),tC=eC({[LT]:LT},"IllegalArgumentException"),zde=(e)=>de(e,LT),UT=Symbol.for("effect/Cause/errors/NoSuchElement"),Ma=eC({[UT]:UT},"NoSuchElementException"),o2=(e)=>de(e,UT),$1=Symbol.for("effect/Cause/errors/InvalidPubSubCapacityException"),$de=eC({[$1]:$1},"InvalidPubSubCapacityException"),HT=Symbol.for("effect/Cause/errors/ExceededCapacityException"),s2=eC({[HT]:HT},"ExceededCapacityException"),jde=(e)=>de(e,HT);var qT=Symbol.for("effect/Cause/errors/Timeout"),a6=eC({[qT]:qT},"TimeoutException"),Vde=(e)=>new a6(`Operation timed out after '${JL(e)}'`),Gde=(e)=>de(e,qT),BT=Symbol.for("effect/Cause/errors/UnknownException"),rC=function(){class e extends NI{_tag="UnknownException";error;constructor(t,r){super(r??"An unknown error occurred",{cause:t});this.error=t}}return Object.assign(e.prototype,{[BT]:BT,name:"UnknownException"}),e}(),Kde=(e)=>de(e,BT),nC=(e)=>Hr(e)&&("_tag"in e)&&(e._tag==="Success"||e._tag==="Failure"),i2=(e)=>e._tag==="Failure",r0=(e)=>e._tag==="Success",Jde=(e)=>{switch(e._tag){case bn:return kI(e.effect_instruction_i0);case Cn:return!1}},oC=p(2,(e,t)=>{switch(e._tag){case bn:return Or(e.effect_instruction_i0);case Cn:return Tr(t)}}),LI=(e)=>oC(e,void 0),Qde=(e)=>{switch(e._tag){case bn:return _(e.effect_instruction_i0);case Cn:return R()}},By=(e,t)=>irt(e,t?.parallel?ms:yn),a2=(e)=>Or(Wo(e)),Yde=p(2,(e,t)=>{switch(e._tag){case bn:return!1;case Cn:return t(e.effect_instruction_i0)}}),Pf=(e)=>Or(xl(e)),Or=(e)=>{let t=new KJ(bn);return t.effect_instruction_i0=e,t},c6=p(2,(e,t)=>{switch(e._tag){case bn:return Or(e.effect_instruction_i0);case Cn:return t(e.effect_instruction_i0)}}),Zde=p(2,(e,t)=>{switch(e._tag){case bn:return X(Or(e.effect_instruction_i0));case Cn:return t(e.effect_instruction_i0)}}),Xde=(e)=>d(e,c6(te)),eme=p(2,(e,t)=>{switch(e._tag){case bn:return X(Or(e.effect_instruction_i0));case Cn:return fo(t(e.effect_instruction_i0))}}),tme=(e)=>{switch(e._tag){case"Left":return Pf(e.left);case"Right":return Tr(e.right)}},rme=(e)=>{switch(e._tag){case"None":return Pf(void 0);case"Some":return Tr(e.value)}},nme=p(2,(e,t)=>{switch(e._tag){case bn:return t(e.effect_instruction_i0);case Cn:return e.effect_instruction_i0}}),sC=(e)=>Or(Yi(e)),MT=p(2,(e,t)=>{switch(e._tag){case bn:return Or(e.effect_instruction_i0);case Cn:return Tr(t(e.effect_instruction_i0))}}),ome=p(2,(e,{onFailure:t,onSuccess:r})=>{switch(e._tag){case bn:return Or(d(e.effect_instruction_i0,_I(t)));case Cn:return Tr(r(e.effect_instruction_i0))}}),sme=p(2,(e,t)=>{switch(e._tag){case bn:return Or(d(e.effect_instruction_i0,_I(t)));case Cn:return Tr(e.effect_instruction_i0)}}),ime=p(2,(e,t)=>{switch(e._tag){case bn:return Or(t(e.effect_instruction_i0));case Cn:return Tr(e.effect_instruction_i0)}}),iC=p(2,(e,{onFailure:t,onSuccess:r})=>{switch(e._tag){case bn:return t(e.effect_instruction_i0);case Cn:return r(e.effect_instruction_i0)}}),aC=p(2,(e,{onFailure:t,onSuccess:r})=>{switch(e._tag){case bn:return t(e.effect_instruction_i0);case Cn:return r(e.effect_instruction_i0)}}),Tr=(e)=>{let t=new JJ(Cn);return t.effect_instruction_i0=e,t},eo=Tr(void 0),ame=p(2,(e,t)=>mp(e,t,{onSuccess:(r,n)=>[r,n],onFailure:yn})),cme=p(2,(e,t)=>mp(e,t,{onSuccess:(r,n)=>r,onFailure:yn})),c2=p(2,(e,t)=>mp(e,t,{onSuccess:(r,n)=>n,onFailure:yn})),lme=p(2,(e,t)=>mp(e,t,{onSuccess:(r,n)=>[r,n],onFailure:ms})),ume=p(2,(e,t)=>mp(e,t,{onSuccess:(r,n)=>r,onFailure:ms})),pme=p(2,(e,t)=>mp(e,t,{onSuccess:(r,n)=>n,onFailure:ms})),mp=p(3,(e,t,{onFailure:r,onSuccess:n})=>{switch(e._tag){case bn:switch(t._tag){case Cn:return Or(e.effect_instruction_i0);case bn:return Or(r(e.effect_instruction_i0,t.effect_instruction_i0))}case Cn:switch(t._tag){case Cn:return Tr(n(e.effect_instruction_i0,t.effect_instruction_i0));case bn:return Or(t.effect_instruction_i0)}}}),irt=(e,t)=>{let r=Fr(e);if(!kn(r))return R();return d(va(r),ki(d(Ai(r),MT(We)),(n,o)=>d(n,mp(o,{onSuccess:(s,i)=>d(s,wn(i)),onFailure:t}))),MT(ml),MT((n)=>lr(n)),_)},Df=(e)=>({...Sf,[W1]:Cde,state:Qi(wde([])),commit(){return Mn(this)},blockingOn:e}),Ys=()=>V(dp,(e)=>fme(e)),fme=(e)=>ue(()=>Df(e)),Mn=(e)=>am((t)=>{let r=pr(e.state);switch(r._tag){case Gb:return t(r.effect);case _y:return r.joiners.push(t),art(e,t)}},e.blockingOn),l2=p(2,(e,t)=>lm(t,e)),cC=p(2,(e,t)=>ue(()=>{let r=pr(e.state);switch(r._tag){case Gb:return!1;case _y:{Oi(e.state,VJ(t));for(let n=0,o=r.joiners.length;n<o;n++)r.joiners[n](t);return!0}}})),n0=p(2,(e,t)=>cC(e,t)),dme=p(2,(e,t)=>cC(e,Gt(t)));var UI=p(2,(e,t)=>cC(e,dr(t)));var mme=(e)=>V(dp,(t)=>cC(e,jT(t))),lC=p(2,(e,t)=>cC(e,jT(t))),hme=(e)=>ue(()=>pr(e.state)._tag===Gb),gme=(e)=>ue(()=>{let t=pr(e.state);switch(t._tag){case Gb:return _(t.effect);case _y:return R()}}),sg=p(2,(e,t)=>cC(e,X(t)));var hm=(e,t)=>{let r=pr(e.state);if(r._tag===_y){Oi(e.state,VJ(t));for(let n=0,o=r.joiners.length;n<o;n++)r.joiners[n](t)}},art=(e,t)=>ue(()=>{let r=pr(e.state);if(r._tag===_y){let n=r.joiners.indexOf(t);if(n>=0)r.joiners.splice(n,1)}}),crt=Ot((e)=>Tr(e.currentContext)),bl=()=>crt;var hp=(e)=>V(bl(),e),pu=p(2,(e,t)=>Xn(_s,t)(e)),u2=p(2,(e,t)=>mi(_s,(r)=>Rn(r,t))(e)),ig=p(2,(e,t)=>hp((r)=>pu(e,t(r)))),l6=p(2,(e,t)=>V(e,(r)=>V(t.predicate(r),(n)=>n?X(r):t.orElse(r)))),xme=p(2,(e,t)=>l6(e,{predicate:t.predicate,orElse:(r)=>Gt(t.orFailWith(r))})),p2=(e)=>{let t=e.currentSpan;return t!==void 0&&t._tag==="Span"?_(t):R()},lrt={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:BigInt(0),endTime:BigInt(0),exit:eo},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},yme=(e)=>Object.assign(Object.create(lrt),e);var urt="effect/Clock",u6=Symbol.for(urt),Lc=qt("effect/Clock"),prt=2147483647,Sme={unsafeSchedule(e,t){let r=ds(t);if(r>prt)return Fo;let n=!1,o=setTimeout(()=>{n=!0,e()},r);return()=>(clearTimeout(o),!n)}},Eme=function(){let e=BigInt(1e6);if(typeof performance>"u"||typeof performance.now!=="function")return()=>BigInt(Date.now())*e;let t;return()=>{if(t===void 0)t=BigInt(Date.now())*e-BigInt(Math.round(performance.now()*1e6));return t+BigInt(Math.round(performance.now()*1e6))}}(),frt=function(){let e=typeof process==="object"&&"hrtime"in process&&typeof process.hrtime.bigint==="function"?process.hrtime:void 0;if(!e)return Eme;let t=Eme()-e.bigint();return()=>t+e.bigint()}();class bme{[u6]=u6;unsafeCurrentTimeMillis(){return Date.now()}unsafeCurrentTimeNanos(){return frt()}currentTimeMillis=ue(()=>this.unsafeCurrentTimeMillis());currentTimeNanos=ue(()=>this.unsafeCurrentTimeNanos());scheduler(){return X(Sme)}sleep(e){return ac((t)=>{let r=Sme.unsafeSchedule(()=>t(yt),e);return In(ue(r))})}}var p6=()=>new bme;var uc=jv;var f2=Nh(uc);var Cme=$d(uc);var wme=(e)=>uc(e,0),kme=p(2,(e,t)=>{let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,s=parseInt(e.toFixed(o).replace(".","")),i=parseInt(t.toFixed(o).replace(".",""));return s%i/Math.pow(10,o)}),Ime=(e)=>{let t=Math.ceil(Math.log(e)/Math.log(2));return Math.max(Math.pow(2,t),2)},Ame=(e)=>{if(e==="NaN")return ui(NaN);if(e==="Infinity")return ui(1/0);if(e==="-Infinity")return ui(-1/0);if(e.trim()==="")return ul;let t=Number(e);return Number.isNaN(t)?ul:ui(t)},Ome=p(2,(e,t)=>{let r=Math.pow(10,t);return Math.round(e*r)/r});var HI=(e)=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");var vme={_tag:"Empty"};var d2=p(2,(e,t)=>{let r=Kh(t),n=e;while(Hb(r)){let o=r.head;switch(o._tag){case"Empty":{r=r.tail;break}case"AndThen":{r=Js(o.first,Js(o.second,r.tail));break}case"MapName":{n=Ke(n,o.f),r=r.tail;break}case"Nested":{n=Ia(n,o.name),r=r.tail;break}case"Unnested":{if(d(Ki(n),m4(o.name)))n=ts(n),r=r.tail;else return Ie(rp(n,`Expected ${o.name} to be in path in ConfigProvider#unnested`));break}}}return ye(n)});var m2="Constant",h2="Fail",o0="Fallback",g2="Described",x2="Lazy",y2="MapOrFail",S2="Nested",E2="Primitive",b2="Sequence",C2="HashMap",w2="ZipWith";var k2=(e,t)=>[...e,...t],mrt="effect/ConfigProvider",Rme=Symbol.for(mrt),qI=qt("effect/ConfigProvider"),hrt="effect/ConfigProviderFlat",Mme=Symbol.for(hrt),grt=(e)=>({[Rme]:Rme,pipe(){return ce(this,arguments)},...e}),xrt=(e)=>({[Mme]:Mme,patch:e.patch,load:(t,r,n=!0)=>e.load(t,r,n),enumerateChildren:e.enumerateChildren}),yrt=(e)=>grt({load:(t)=>V(gp(e,Ge(),t,!1),(r)=>be(Ki(r),{onNone:()=>Gt(rp(Ge(),`Expected a single value having structure: ${t}`)),onSome:X})),flattened:e}),Pme=(e)=>{let{pathDelim:t,seqDelim:r}=Object.assign({},{pathDelim:"_",seqDelim:","},e),n=(c)=>d(c,Xt(t)),o=(c)=>c.split(t),s=()=>typeof process<"u"&&("env"in process)&&typeof process.env==="object"?process.env:{};return yrt(xrt({load:(c,l,u=!0)=>{let f=n(c),h=s(),y=f in h?_(h[f]):R();return d(y,Dy(()=>rp(c,`Expected ${f} to exist in the process context`)),V((E)=>wrt(E,c,l,r,u)))},enumerateChildren:(c)=>ue(()=>{let l=s(),h=Object.keys(l).map((y)=>o(y.toUpperCase())).filter((y)=>{for(let E=0;E<c.length;E++){let b=d(c,kb(E)),w=y[E];if(w===void 0||b!==w)return!1}return!0}).flatMap((y)=>y.slice(c.length,c.length+1));return cp(h)}),patch:vme}))};var Srt=(e,t,r,n)=>{let o=CL(r.length,(c)=>c>=n.length?R():_([e(c),c+1])),s=CL(n.length,(c)=>c>=r.length?R():_([t(c),c+1])),i=k2(r,o),a=k2(n,s);return[i,a]},Ert=(e,t)=>{let r=t;if(r._tag==="Nested"){let n=e.slice();while(r._tag==="Nested")n.push(r.name),r=r.config;return n}return e},gp=(e,t,r,n)=>{let o=r;switch(o._tag){case m2:return X(tt(o.value));case g2:return Re(()=>gp(e,t,o.config,n));case h2:return Gt(rp(t,o.message));case o0:return d(Re(()=>gp(e,t,o.first,n)),lu((s)=>{if(o.condition(s))return d(gp(e,t,o.second,n),lu((i)=>Gt(RL(s,i))));return Gt(s)}));case x2:return Re(()=>gp(e,t,o.config(),n));case y2:return Re(()=>d(gp(e,t,o.original,n),V(Ra((s)=>d(o.mapOrFail(s),Dy(Bh(Ert(t,o.original))))))));case S2:return Re(()=>gp(e,k2(t,tt(o.name)),o.config,n));case E2:return d(d2(t,e.patch),V((s)=>d(e.load(s,o,n),V((i)=>{if(i.length===0){let a=d(Vv(s),Je(()=>"<n/a>"));return Gt(rp([],`Expected ${o.description} with name ${a}`))}return X(i)}))));case b2:return d(d2(t,e.patch),V((s)=>d(e.enumerateChildren(s),V(Irt),V((i)=>{if(i.length===0)return Re(()=>xe(gp(e,t,o.config,!0),tt));return d(Ra(i,(a)=>gp(e,Yn(t,`[${a}]`),o.config,!0)),xe((a)=>{let c=Ab(a);if(c.length===0)return tt(Ge());return tt(c)}))}))));case C2:return Re(()=>d(d2(t,e.patch),V((s)=>d(e.enumerateChildren(s),V((i)=>d(i,Ra((a)=>gp(e,k2(s,tt(a)),o.valueConfig,n)),xe((a)=>{if(a.length===0)return tt(Ta());return d(krt(a),Ke((c)=>lp(xL(De(i),c))))})))))));case w2:return Re(()=>d(gp(e,t,o.left,n),pp,V((s)=>d(gp(e,t,o.right,n),pp,V((i)=>{if(Sr(s)&&Sr(i))return Gt(TL(s.left,i.left));if(Sr(s)&&wi(i))return Gt(s.left);if(wi(s)&&Sr(i))return Gt(i.left);if(wi(s)&&wi(i)){let a=d(t,Xt(".")),c=brt(t,a),[l,u]=Srt(c,c,d(s.right,Ke(ye)),d(i.right,Ke(ye)));return d(l,xL(u),Ra(([f,h])=>d(Qb(f,h),xe(([y,E])=>o.zip(y,E)))))}throw Error("BUG: ConfigProvider.fromFlatLoop - please report an issue at https://github.com/Effect-TS/effect/issues")})))))}},brt=(e,t)=>(r)=>Ie(rp(e,`The element at index ${r} in a sequence at path "${t}" was missing`));var Crt=(e,t)=>e.split(new RegExp(`\\s*${HI(t)}\\s*`)),wrt=(e,t,r,n,o)=>{if(!o)return d(r.parse(e),VT({onFailure:Bh(t),onSuccess:tt}));return d(Crt(e,n),Ra((s)=>r.parse(s.trim())),Dy(Bh(t)))},krt=(e)=>Object.keys(e[0]).map((t)=>e.map((r)=>r[t])),Irt=(e)=>d(Ra(e,Ort),VT({onFailure:()=>Ge(),onSuccess:Aa(uc)}),pp,xe(Cb));var Art=/^(\[(\d+)\])$/,Ort=(e)=>{let t=e.match(Art);if(t!==null){let r=t[2];return d(r!==void 0&&r.length>0?_(r):R(),Qn(_rt))}return R()};var _rt=(e)=>{let t=Number.parseInt(e);return Number.isNaN(t)?R():_(t)};var I2=Symbol.for("effect/Console"),Pa=qt("effect/Console"),Dme={[I2]:I2,assert(e,...t){return ue(()=>{console.assert(e,...t)})},clear:ue(()=>{console.clear()}),count(e){return ue(()=>{console.count(e)})},countReset(e){return ue(()=>{console.countReset(e)})},debug(...e){return ue(()=>{console.debug(...e)})},dir(e,t){return ue(()=>{console.dir(e,t)})},dirxml(...e){return ue(()=>{console.dirxml(...e)})},error(...e){return ue(()=>{console.error(...e)})},group(e){return e?.collapsed?ue(()=>console.groupCollapsed(e?.label)):ue(()=>console.group(e?.label))},groupEnd:ue(()=>{console.groupEnd()}),info(...e){return ue(()=>{console.info(...e)})},log(...e){return ue(()=>{console.log(...e)})},table(e,t){return ue(()=>{console.table(e,t)})},time(e){return ue(()=>console.time(e))},timeEnd(e){return ue(()=>console.timeEnd(e))},timeLog(e,...t){return ue(()=>{console.timeLog(e,...t)})},trace(...e){return ue(()=>{console.trace(...e)})},warn(...e){return ue(()=>{console.warn(...e)})},unsafe:console};var Trt="effect/Random",BI=Symbol.for(Trt),gm=qt("effect/Random");class Fme{seed;[BI]=BI;PRNG;constructor(e){this.seed=e,this.PRNG=new JK(e)}get next(){return ue(()=>this.PRNG.number())}get nextBoolean(){return xe(this.next,(e)=>e>0.5)}get nextInt(){return ue(()=>this.PRNG.integer(Number.MAX_SAFE_INTEGER))}nextRange(e,t){return xe(this.next,(r)=>(t-e)*r+e)}nextIntBetween(e,t){return ue(()=>this.PRNG.integer(t-e)+e)}shuffle(e){return Nme(e,(t)=>this.nextIntBetween(0,t))}}var Nme=(e,t)=>Re(()=>d(ue(()=>Array.from(e)),V((r)=>{let n=[];for(let o=r.length;o>=2;o=o-1)n.push(o);return d(n,Mc((o)=>d(t(o),xe((s)=>Rrt(r,o-1,s)))),Kr(Fr(r)))}))),Rrt=(e,t,r)=>{let n=e[t];return e[t]=e[r],e[r]=n,e},A2=(e)=>new Fme(oe(e));class Lme{values;[BI]=BI;index=0;constructor(e){if(this.values=e,e.length===0)throw Error("Requires at least one value")}getNextValue(){let e=this.values[this.index];return this.index=(this.index+1)%this.values.length,e}get next(){return ue(()=>{let e=this.getNextValue();if(typeof e==="number")return Math.max(0,Math.min(1,e));return oe(e)/2147483647})}get nextBoolean(){return ue(()=>{let e=this.getNextValue();if(typeof e==="boolean")return e;return oe(e)%2===0})}get nextInt(){return ue(()=>{let e=this.getNextValue();if(typeof e==="number"&&Number.isFinite(e))return Math.round(e);return Math.abs(oe(e))})}nextRange(e,t){return xe(this.next,(r)=>(t-e)*r+e)}nextIntBetween(e,t){return ue(()=>{let r=this.getNextValue();if(typeof r==="number"&&Number.isFinite(r))return Math.max(e,Math.min(t-1,Math.round(r)));let n=Math.abs(oe(r));return e+n%(t-e)})}shuffle(e){return Nme(e,(t)=>this.nextIntBetween(0,t))}}var Ume=(e)=>new Lme(e);var m6=Symbol.for("effect/Tracer"),Bme=(e)=>({[m6]:m6,...e}),xm=qt("effect/Tracer"),vs=qt("effect/ParentSpan"),qme=function(){return function(r){let n="";for(let o=0;o<r;o++)n+="abcdef0123456789".charAt(Math.floor(Math.random()*16));return n}}();class Wme{name;parent;context;startTime;kind;_tag="Span";spanId;traceId="native";sampled=!0;status;attributes;events=[];links;constructor(e,t,r,n,o,s){this.name=e,this.parent=t,this.context=r,this.startTime=o,this.kind=s,this.status={_tag:"Started",startTime:o},this.attributes=new Map,this.traceId=t._tag==="Some"?t.value.traceId:qme(32),this.spanId=qme(16),this.links=Array.from(n)}end(e,t){this.status={_tag:"Ended",endTime:e,exit:t,startTime:this.status.startTime}}attribute(e,t){this.attributes.set(e,t)}event(e,t,r){this.events.push([e,t,r??{}])}addLinks(e){this.links.push(...e)}}var zme=Bme({span:(e,t,r,n,o,s)=>new Wme(e,t,r,n,o,s),context:(e)=>e()});var Da=(e)=>{if(e?.captureStackTrace===!1)return e;else if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!=="boolean")return e;let t=Error.stackTraceLimit;Error.stackTraceLimit=3;let r=Error();Error.stackTraceLimit=t;let n=!1;return{...e,captureStackTrace:()=>{if(n!==!1)return n;if(r.stack!==void 0){let o=r.stack.split(`
|
|
169
|
+
`);if(o[3]!==void 0)return n=o[3].trim(),n}}}},uC=ko()("effect/Tracer/DisablePropagation",{defaultValue:Fo});var Mrt=d(Tn(),or(Lc,p6()),or(Pa,Dme),or(gm,A2(Math.random())),or(qI,Pme()),or(xm,zme)),An=je(Symbol.for("effect/DefaultServices/currentServices"),()=>GT(Mrt)),$me=(e)=>{let t=ur(e);return s0((r)=>r.sleep(t))},O2=(e)=>Ot((t)=>e(t.currentDefaultServices)),s0=(e)=>O2((t)=>e(t.unsafeMap.get(Lc.key))),jme=s0((e)=>e.currentTimeMillis),Vme=s0((e)=>e.currentTimeNanos),Gme=p(2,(e,t)=>mi(An,or(Lc,t))(e)),Kme=p(2,(e,t)=>mi(An,or(qI,t))(e)),h6=(e)=>O2((t)=>e(t.unsafeMap.get(qI.key))),Jme=(e)=>h6((t)=>t.load(e));var fu=(e)=>O2((t)=>e(t.unsafeMap.get(gm.key))),Qme=p(2,(e,t)=>mi(An,or(gm,t))(e)),Yme=fu((e)=>e.next),Zme=fu((e)=>e.nextInt),Xme=fu((e)=>e.nextBoolean),ehe=(e,t)=>fu((r)=>r.nextRange(e,t)),the=(e,t)=>fu((r)=>r.nextIntBetween(e,t)),rhe=(e)=>fu((t)=>t.shuffle(e)),nhe=(e)=>{let t=De(e);return xe(t.length===0?Gt(new Ma("Cannot select a random element from an empty array")):fu((r)=>r.nextIntBetween(0,t.length)),(r)=>t[r])},_2=(e)=>O2((t)=>e(t.unsafeMap.get(xm.key))),ohe=p(2,(e,t)=>mi(An,or(xm,t))(e));var i0=(e)=>!e;var ihe=Ph,cg=Sf;var Prt=rue,Drt=nue;class Zi extends Prt{}class a0 extends Drt{}var ahe="Sequential",che="Parallel",Frt="ParallelN",Cl={_tag:ahe},c0={_tag:che},lhe=(e)=>({_tag:Frt,parallelism:e}),g6=(e)=>e._tag===ahe,x6=(e)=>e._tag===che;var WI=Cl,v2=c0,T2=lhe;function phe(e){return new lg(e)}function R2(){return phe(new Map)}var y6=Symbol.for("effect/FiberRefs");class lg{locals;[y6]=y6;constructor(e){this.locals=e}pipe(){return ce(this,arguments)}}var Nrt=(e,t,r,n=!1)=>{let o=e,s=t,i=r,a=n,c=void 0;while(c===void 0)if(ut(s)&&ut(i)){let l=jr(s)[0],u=ts(s),f=jr(i)[0],h=jr(i)[1],y=ts(i);if(l.startTimeMillis<f.startTimeMillis)i=y,a=!0;else if(l.startTimeMillis>f.startTimeMillis)s=u;else if(l.id<f.id)i=y,a=!0;else if(l.id>f.id)s=u;else c=[h,a]}else c=[o.initial,!0];return c},M2=p(3,(e,t,r)=>{let n=new Map(e.locals);return r.locals.forEach((o,s)=>{let i=o[0][1];if(!o[0][0][Pe](t)){if(!n.has(s)){if(ge(i,s.initial))return;n.set(s,[[t,s.join(s.initial,i)]]);return}let a=n.get(s),[c,l]=Nrt(s,a,o);if(l){let u=s.diff(c,i),f=a[0][1],h=s.join(f,s.patch(u)(f));if(!ge(f,h)){let y,E=a[0][0];if(E[Pe](t))y=[[E,h],...a.slice(1)];else y=[[t,h],...a];n.set(s,y)}}}}),new lg(n)}),E6=p(2,(e,t)=>{let r=new Map;return fhe(e,r,t),new lg(r)}),fhe=(e,t,r)=>{e.locals.forEach((n,o)=>{let s=n[0][1],i=o.patch(o.fork)(s);if(ge(s,i))t.set(o,n);else t.set(o,[[r,i],...n])})},dhe=(e)=>cp(e.locals.keys()),mhe=(e)=>Mc(dhe(e),(t)=>eg(t,ug(e,t))),u0=p(2,(e,t)=>{let r=new Map(e.locals);return r.delete(t),new lg(r)}),p0=p(2,(e,t)=>{if(!e.locals.has(t))return R();return _(jr(e.locals.get(t))[1])}),ug=p(2,(e,t)=>d(p0(e,t),Je(()=>t.initial))),pC=p(2,(e,{fiberId:t,fiberRef:r,value:n})=>{if(e.locals.size===0)return new lg(new Map([[r,[[t,n]]]]));let o=new Map(e.locals);return S6(o,t,r,n),new lg(o)}),S6=(e,t,r,n)=>{let o=e.get(r)??[],s;if(ut(o)){let[i,a]=jr(o);if(i[Pe](t))if(ge(a,n))return;else s=[[t,n],...o.slice(1)];else s=[[t,n],...o]}else s=[[t,n]];e.set(r,s)},hhe=p(2,(e,{entries:t,forkAs:r})=>{if(e.locals.size===0)return new lg(new Map(t));let n=new Map(e.locals);if(r!==void 0)fhe(e,n,r);return t.forEach(([o,s])=>{if(s.length===1)S6(n,s[0][0],o,s[0][1]);else s.forEach(([i,a])=>{S6(n,i,o,a)})}),new lg(n)});var b6=p0,Ff=ug,ghe=M2,xhe=mhe,C6=pC,yhe=hhe;var She=R2;var Ehe="Empty",bhe="Add",Che="Remove",whe="Update",khe="AndThen",Ihe={_tag:Ehe},f0=(e,t)=>{let r=new Map(e.locals),n=Ihe;for(let[o,s]of t.locals.entries()){let i=jr(s)[1],a=r.get(o);if(a!==void 0){let c=jr(a)[1];if(!ge(c,i))n=D2({_tag:whe,fiberRef:o,patch:o.diff(c,i)})(n)}else n=D2({_tag:bhe,fiberRef:o,value:i})(n);r.delete(o)}for(let[o]of r.entries())n=D2({_tag:Che,fiberRef:o})(n);return n},D2=p(2,(e,t)=>({_tag:khe,first:e,second:t})),F2=p(3,(e,t,r)=>{let n=r,o=tt(e);while(ut(o)){let s=jr(o),i=ts(o);switch(s._tag){case Ehe:{o=i;break}case bhe:{n=pC(n,{fiberId:t,fiberRef:s.fiberRef,value:s.value}),o=i;break}case Che:{n=u0(n,s.fiberRef),o=i;break}case whe:{let a=ug(n,s.fiberRef);n=pC(n,{fiberId:t,fiberRef:s.fiberRef,value:s.fiberRef.patch(s.patch)(a)}),o=i;break}case khe:{o=Ia(s.first)(Ia(s.second)(i));break}}}return n});var fC=f0;var dC=F2;var L2="effect/FiberStatus",zy=Symbol.for(L2),N2="Done",_he="Running",vhe="Suspended",Lrt=It(`${L2}-${N2}`);class The{[zy]=zy;_tag=N2;[Ne](){return Lrt}[Pe](e){return U2(e)&&e._tag===N2}}class Rhe{runtimeFlags;[zy]=zy;_tag=_he;constructor(e){this.runtimeFlags=e}[Ne](){return d(oe(L2),Ee(oe(this._tag)),Ee(oe(this.runtimeFlags)),lt(this))}[Pe](e){return U2(e)&&e._tag===_he&&this.runtimeFlags===e.runtimeFlags}}class Mhe{runtimeFlags;blockingOn;[zy]=zy;_tag=vhe;constructor(e,t){this.runtimeFlags=e,this.blockingOn=t}[Ne](){return d(oe(L2),Ee(oe(this._tag)),Ee(oe(this.runtimeFlags)),Ee(oe(this.blockingOn)),lt(this))}[Pe](e){return U2(e)&&e._tag===vhe&&this.runtimeFlags===e.runtimeFlags&&ge(this.blockingOn,e.blockingOn)}}var Phe=new The,Dhe=(e)=>new Rhe(e),Fhe=(e,t)=>new Mhe(e,t),U2=(e)=>de(e,zy),Nhe=(e)=>e._tag===N2;var Lhe=Phe,w6=Dhe,Uhe=Fhe;var Hhe=Nhe;var Sm={};Ht(Sm,{All:()=>qhe,Debug:()=>z2,Error:()=>q2,Fatal:()=>H2,Info:()=>W2,None:()=>Bhe,Order:()=>d0,Trace:()=>$2,Warning:()=>B2,allLevels:()=>k6,fromLiteral:()=>V2,greaterThan:()=>j2,greaterThanEqual:()=>zrt,lessThan:()=>Brt,lessThanEqual:()=>Wrt,locally:()=>qrt});var qhe=YJ,H2=ZJ,q2=XJ,B2=e2,W2=MI,z2=t2,$2=e6,Bhe=t6,k6=r2,qrt=p(2,(e,t)=>Xn(e,JT,t)),d0=d(uc,bf((e)=>e.ordinal)),Brt=Dh(d0),Wrt=cy(d0),j2=Fh(d0),zrt=Nh(d0),V2=(e)=>{switch(e){case"All":return qhe;case"Debug":return z2;case"Error":return q2;case"Fatal":return H2;case"Info":return W2;case"Trace":return $2;case"None":return Bhe;case"Warning":return B2}};var $rt=Symbol.for("effect/Micro"),G2=Symbol.for("effect/Micro/MicroExit");var Whe=Symbol.for("effect/Micro/MicroCause");var jrt={_E:te};class O6 extends globalThis.Error{_tag;traces;[Whe];constructor(e,t,r){let n=`MicroCause.${e}`,o,s,i;if(t instanceof globalThis.Error){o=`(${n}) ${t.name}`,s=t.message;let a=s.split(`
|
|
170
|
+
`).length;i=t.stack?`(${n}) ${t.stack.split(`
|
|
171
|
+
`).slice(0,a+3).join(`
|
|
172
|
+
`)}`:`${o}: ${s}`}else o=n,s=ll(t,0),i=`${o}: ${s}`;if(r.length>0)i+=`
|
|
173
|
+
${r.join(`
|
|
174
|
+
`)}`;super(s);this._tag=e,this.traces=r,this[Whe]=jrt,this.name=o,this.stack=i}pipe(){return ce(this,arguments)}toString(){return this.stack}[dt](){return this.stack}}class jhe extends O6{defect;constructor(e,t=[]){super("Die",e,t);this.defect=e}}var Vrt=(e,t=[])=>new jhe(e,t);class Vhe extends O6{constructor(e=[]){super("Interrupt","interrupted",e)}}var Grt=(e=[])=>new Vhe(e);var Ghe=(e)=>e._tag==="Interrupt";var zhe=Symbol.for("effect/Micro/MicroFiber"),Krt={_A:te,_E:te};class _6{context;interruptible;[zhe];_stack=[];_observers=[];_exit;_children;currentOpCount=0;constructor(e,t=!0){this.context=e,this.interruptible=t,this[zhe]=Krt}getRef(e){return tpe(this.context,e)}addObserver(e){if(this._exit)return e(this._exit),wo;return this._observers.push(e),()=>{let t=this._observers.indexOf(e);if(t>=0)this._observers.splice(t,1)}}_interrupted=!1;unsafeInterrupt(){if(this._exit)return;if(this._interrupted=!0,this.interruptible)this.evaluate(v6)}unsafePoll(){return this._exit}evaluate(e){if(this._exit)return;else if(this._yielded!==void 0){let n=this._yielded;this._yielded=void 0,n()}let t=this.runLoop(e);if(t===$I)return;let r=$he.interruptChildren&&$he.interruptChildren(this);if(r!==void 0)return this.evaluate(mC(r,()=>t));this._exit=t;for(let n=0;n<this._observers.length;n++)this._observers[n](t);this._observers.length=0}runLoop(e){let t=!1,r=e;this.currentOpCount=0;try{while(!0){if(this.currentOpCount++,!t&&this.getRef(h0).shouldYield(this)){t=!0;let n=r;r=mC(ent,()=>n)}if(r=r[A6](this),r===$I){let n=this._yielded;if(G2 in n)return this._yielded=void 0,n;return $I}}}catch(n){if(!de(r,A6))return Z2(`MicroFiber.runLoop: Not a valid effect: ${String(r)}`);return Z2(n)}}getCont(e){while(!0){let t=this._stack.pop();if(!t)return;let r=t[K2]&&t[K2](this);if(r)return{[e]:r};if(t[e])return t}}_yielded=void 0;yieldWith(e){return this._yielded=e,$I}children(){return this._children??=new Set}}var $he=je("effect/Micro/fiberMiddleware",()=>({interruptChildren:void 0}));var Jrt=(e)=>m0(()=>{for(let n of e)n.unsafeInterrupt();let t=e[Symbol.iterator](),r=m0(()=>{let n=t.next();while(!n.done){if(n.value.unsafePoll()){n=t.next();continue}let o=n.value;return Qhe((s)=>{o.addObserver((i)=>{s(r)})})}return GI});return r}),Khe=Symbol.for("effect/Micro/identifier"),Hn=Symbol.for("effect/Micro/args"),A6=Symbol.for("effect/Micro/evaluate"),$y=Symbol.for("effect/Micro/successCont"),jI=Symbol.for("effect/Micro/failureCont"),K2=Symbol.for("effect/Micro/ensureCont"),$I=Symbol.for("effect/Micro/Yield"),Qrt={_A:te,_E:te,_R:te},Yrt={...ihe,_op:"Micro",[$rt]:Qrt,pipe(){return ce(this,arguments)},[Symbol.iterator](){return new xb(new yf(this))},toJSON(){return{_id:"Micro",op:this[Khe],...Hn in this?{args:this[Hn]}:void 0}},toString(){return Ut(this)},[dt](){return Ut(this)}};function Zrt(e){return Z2("Micro.evaluate: Not implemented")}var X2=(e)=>({...Yrt,[Khe]:e.op,[A6]:e.eval??Zrt,[$y]:e.contA,[jI]:e.contE,[K2]:e.ensure}),jy=(e)=>{let t=X2(e);return function(){let r=Object.create(t);return r[Hn]=e.single===!1?arguments:arguments[0],r}},Jhe=(e)=>{let t={...X2(e),[G2]:G2,_tag:e.op,get[e.prop](){return this[Hn]},toJSON(){return{_id:"MicroExit",_tag:e.op,[e.prop]:this[Hn]}},[Pe](r){return ant(r)&&r._tag===e.op&&ge(this[Hn],r[Hn])},[Ne](){return lt(this,Ee(It(e.op))(oe(this[Hn])))}};return function(r){let n=Object.create(t);return n[Hn]=r,n[$y]=void 0,n[jI]=void 0,n[K2]=void 0,n}},VI=Jhe({op:"Success",prop:"value",eval(e){let t=e.getCont($y);return t?t[$y](this[Hn],e):e.yieldWith(this)}}),J2=Jhe({op:"Failure",prop:"cause",eval(e){let t=e.getCont(jI);while(Ghe(this[Hn])&&t&&e.interruptible)t=e.getCont(jI);return t?t[jI](this[Hn],e):e.yieldWith(this)}});var Q2=jy({op:"Sync",eval(e){let t=this[Hn](),r=e.getCont($y);return r?r[$y](t,e):e.yieldWith(tU(t))}}),m0=jy({op:"Suspend",eval(e){return this[Hn]()}}),Xrt=jy({op:"Yield",eval(e){let t=!1;return e.getRef(h0).scheduleTask(()=>{if(t)return;e.evaluate(GI)},this[Hn]??0),e.yieldWith(()=>{t=!0})}}),ent=Xrt(0);var Y2=VI(void 0);var eU=jy({op:"WithMicroFiber",eval(e){return this[Hn](e)}});var tnt=jy({op:"Async",single:!1,eval(e){let t=this[Hn][0],r=!1,n=!1,o=this[Hn][1]?new AbortController:void 0,s=t((i)=>{if(r)return;if(r=!0,n)e.evaluate(i);else n=i},o?.signal);if(n!==!1)return n;if(n=!0,e._yielded=()=>{r=!0},o===void 0&&s===void 0)return $I;return e._stack.push(rnt(()=>(r=!0,o?.abort(),s??GI))),$I}}),rnt=jy({op:"AsyncFinalizer",ensure(e){if(e.interruptible)e.interruptible=!1,e._stack.push(R6(!0))},contE(e,t){return Ghe(e)?mC(this[Hn](),()=>J2(e)):J2(e)}}),Qhe=(e)=>tnt(e,e.length>=2);var nnt=p(2,(e,t)=>int(e,(r)=>t));var ont=(e)=>fnt(e,{onFailure:rU,onSuccess:tU});var mC=p(2,(e,t)=>{let r=Object.create(snt);return r[Hn]=e,r[$y]=t,r}),snt=X2({op:"OnSuccess",eval(e){return e._stack.push(this),this[Hn]}});var int=p(2,(e,t)=>mC(e,(r)=>VI(t(r)))),ant=(e)=>de(e,G2),tU=VI,rU=J2,v6=rU(Grt());var Z2=(e)=>rU(Vrt(e));var GI=tU(void 0),cnt=(e)=>{for(let t of e)if(t._tag==="Failure")return t;return GI},lnt="setImmediate"in globalThis?globalThis.setImmediate:(e)=>setTimeout(e,0);class T6{tasks=[];running=!1;scheduleTask(e,t){if(this.tasks.push(e),!this.running)this.running=!0,lnt(this.afterScheduled)}afterScheduled=()=>{this.running=!1,this.runTasks()};runTasks(){let e=this.tasks;this.tasks=[];for(let t=0,r=e.length;t<r;t++)e[t]()}shouldYield(e){return e.currentOpCount>=e.getRef(Zhe)}flush(){while(this.tasks.length>0)this.runTasks()}}var unt=p(2,(e,t)=>eU((r)=>{let n=r.context;return r.context=t(n),dnt(e,()=>(r.context=n,Y2))}));var Yhe=p(2,(e,t)=>unt(e,Rn(t)));class Zhe extends ko()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048}){}class Xhe extends ko()("effect/Micro/currentConcurrency",{defaultValue:()=>"unbounded"}){}class h0 extends ko()("effect/Micro/currentScheduler",{defaultValue:()=>new T6}){}var ege=p(2,(e,t)=>{let r=Object.create(pnt);return r[Hn]=e,r[$y]=t.onSuccess,r[jI]=t.onFailure,r}),pnt=X2({op:"OnSuccessAndFailure",eval(e){return e._stack.push(this),this[Hn]}}),fnt=p(2,(e,t)=>ege(e,{onFailure:(r)=>Q2(()=>t.onFailure(r)),onSuccess:(r)=>Q2(()=>t.onSuccess(r))}));var I6=Symbol.for("effect/Micro/MicroScope");class tge{[I6];state={_tag:"Open",finalizers:new Set};constructor(){this[I6]=I6}unsafeAddFinalizer(e){if(this.state._tag==="Open")this.state.finalizers.add(e)}addFinalizer(e){return m0(()=>{if(this.state._tag==="Open")return this.state.finalizers.add(e),Y2;return e(this.state.exit)})}unsafeRemoveFinalizer(e){if(this.state._tag==="Open")this.state.finalizers.delete(e)}close(e){return m0(()=>{if(this.state._tag==="Open"){let t=Array.from(this.state.finalizers).reverse();return this.state={_tag:"Closed",exit:e},mC(xnt(t,(r)=>ont(r(e))),cnt)}return Y2})}get fork(){return Q2(()=>{let e=new tge;if(this.state._tag==="Closed")return e.state=this.state,e;function t(r){return e.close(r)}return this.state.finalizers.add(t),e.unsafeAddFinalizer((r)=>Q2(()=>this.unsafeRemoveFinalizer(t))),e})}}var dnt=p(2,(e,t)=>hnt((r)=>ege(r(e),{onFailure:(n)=>mC(t(rU(n)),()=>J2(n)),onSuccess:(n)=>mC(t(tU(n)),()=>VI(n))})));var R6=jy({op:"SetInterruptible",ensure(e){if(e.interruptible=this[Hn],e._interrupted&&e.interruptible)return()=>v6}}),mnt=(e)=>eU((t)=>{if(t.interruptible)return e;if(t.interruptible=!0,t._stack.push(R6(!1)),t._interrupted)return v6;return e}),hnt=(e)=>eU((t)=>{if(!t.interruptible)return e(te);return t.interruptible=!1,t._stack.push(R6(!0)),e(mnt)});var gnt=jy({op:"While",contA(e,t){if(this[Hn].step(e),this[Hn].while())return t._stack.push(this),this[Hn].body();return GI},eval(e){if(this[Hn].while())return e._stack.push(this),this[Hn].body();return GI}}),xnt=(e,t,r)=>eU((n)=>{let o=r?.concurrency==="inherit"?n.getRef(Xhe):r?.concurrency??1,s=o==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,o),i=De(e),a=i.length;if(a===0)return r?.discard?Y2:VI([]);let c=r?.discard?void 0:Array(a),l=0;if(s===1)return nnt(gnt({while:()=>l<i.length,body:()=>t(i[l],l),step:c?(u)=>c[l++]=u:(u)=>l++}),c);return Qhe((u)=>{let f=new Set,h=void 0,y=0,E=0,b=!1,w=!1;function T(){b=!0;while(y<s&&l<a){let A=l,k=i[A];l++,y++;try{let O=ynt(n,t(k,A),!0,!0);f.add(O),O.addObserver((P)=>{if(f.delete(O),w)return;else if(P._tag==="Failure"){if(h===void 0)h=P,a=l,f.forEach((D)=>D.unsafeInterrupt())}else if(c!==void 0)c[A]=P.value;if(E++,y--,E===a)u(h??VI(c));else if(!b&&y<s)T()})}catch(O){h=Z2(O),a=l,f.forEach((P)=>P.unsafeInterrupt())}}b=!1}return T(),m0(()=>(w=!0,l=a,Jrt(f)))})});var ynt=(e,t,r=!1,n=!1)=>{let o=new _6(e.context,e.interruptible);if(!n)e.children().add(o),o.addObserver(()=>e.children().delete(o));if(r)o.evaluate(t);else e.getRef(h0).scheduleTask(()=>o.evaluate(t),0);return o};var rge=(e,t)=>{let r=new _6(h0.context(t?.scheduler??new T6));if(r.evaluate(e),t?.signal)if(t.signal.aborted)r.unsafeInterrupt();else{let n=()=>r.unsafeInterrupt();t.signal.addEventListener("abort",n,{once:!0}),r.addObserver(()=>t.signal.removeEventListener("abort",n))}return r};var Nf=Symbol.for("effect/Readable");var z7t={[Nf]:Nf,pipe(){return ce(this,arguments)}};var nU=Symbol.for("effect/Ref"),P6={_A:(e)=>e};class nge extends Zi{ref;commit(){return this.get}[nU]=P6;[Nf]=Nf;constructor(e){super();this.ref=e,this.get=ue(()=>pr(this.ref))}get;modify(e){return ue(()=>{let t=pr(this.ref),[r,n]=e(t);if(t!==n)Oi(n)(this.ref);return r})}}var KI=(e)=>new nge(Qi(e)),hC=(e)=>ue(()=>KI(e)),vi=(e)=>e.get,xp=p(2,(e,t)=>e.modify(()=>[void 0,t])),D6=p(2,(e,t)=>e.modify((r)=>[r,t]));var oU=p(2,(e,t)=>e.modify(t));var Vy=p(2,(e,t)=>e.modify((r)=>[void 0,t(r)])),F6=p(2,(e,t)=>e.modify((r)=>{let n=t(r);return[n,n]}));var qn=hC,sn=vi,sU=D6;var mu=oU;var Xi=xp;var ea=Vy,N6=F6;class iU{scheduleDrain;running=!1;tasks=new L6;constructor(e){this.scheduleDrain=e}starveInternal=(e)=>{let t=this.tasks.buckets;this.tasks.buckets=[];for(let[r,n]of t)for(let o=0;o<n.length;o++)n[o]();if(this.tasks.buckets.length===0)this.running=!1;else this.starve(e)};starve(e=0){this.scheduleDrain(e,this.starveInternal)}scheduleTask(e,t){if(this.tasks.scheduleTask(e,t),!this.running)this.running=!0,this.starve()}static cached(e){let t=new iU(e),r=new WeakMap;return(n)=>{if(n===void 0)return t;let o=r.get(n);if(o===void 0)o=new iU(e),r.set(n,o);return o}}}class L6{buckets=[];scheduleTask(e,t){let r=this.buckets.length,n=void 0,o=0;for(;o<r;o++)if(this.buckets[o][0]<=t)n=this.buckets[o];else break;if(n&&n[0]===t)n[1].push(e);else if(o===r)this.buckets.push([t,[e]]);else this.buckets.splice(o,0,[t,[e]])}}class oge{maxNextTickBeforeTimer;getRunner=iU.cached((e,t)=>{if(e>=this.maxNextTickBeforeTimer)setTimeout(()=>t(0),0);else Promise.resolve(void 0).then(()=>t(e+1))});constructor(e){this.maxNextTickBeforeTimer=e}shouldYield(e){return e.currentOpCount>e.getFiberRef(KT)?e.getFiberRef(Mf):!1}scheduleTask(e,t,r){this.getRunner(r).scheduleTask(e,t)}}var sge=je(Symbol.for("effect/Scheduler/defaultScheduler"),()=>new oge(2048));class gC{tasks=new L6;deferred=!1;scheduleTask(e,t,r){if(this.deferred)sge.scheduleTask(e,t,r);else this.tasks.scheduleTask(e,t)}shouldYield(e){return e.currentOpCount>e.getFiberRef(KT)?e.getFiberRef(Mf):!1}flush(){while(this.tasks.buckets.length>0){let e=this.tasks.buckets;this.tasks.buckets=[];for(let[t,r]of e)for(let n=0;n<r.length;n++)r[n]()}this.deferred=!0}}var Uf=je(Symbol.for("effect/FiberRef/currentScheduler"),()=>Io(sge)),ige=p(2,(e,t)=>Xn(e,Uf,t));var aU=je(Symbol.for("effect/FiberRef/currentRequestMap"),()=>Io(new Map));var U6=(e,t,r,n)=>{switch(e){case void 0:return t();case"unbounded":return r();case"inherit":return _i(YT,(o)=>o==="unbounded"?r():o>1?n(o):t());default:return e>1?n(e):t()}},x0=(e,t,r)=>{switch(e){case void 0:return t();case"unbounded":return r();case"inherit":return _i(YT,(n)=>n==="unbounded"||n>1?r():t());default:return e>1?r():t()}};var Em=$me,wl=jme,age=Vme,cge=s0,lge=Lc;var uge=(e,t)=>({label:e,startTime:t}),H6=(e)=>e.replace(/[\s="]/g,"_"),S0=(e)=>(t)=>`${H6(t.label)}=${e-t.startTime}ms`;var fge=uge;var QI=vs;var dge=_2;var mge="effect/MetricLabel",q6=Symbol.for(mge);class hge{key;value;[q6]=q6;_hash;constructor(e,t){this.key=e,this.value=t,this._hash=It(mge+this.key+this.value)}[Ne](){return this._hash}[Pe](e){return vnt(e)&&this.key===e.key&&this.value===e.value}pipe(){return ce(this,arguments)}}var xC=(e,t)=>new hge(e,t),vnt=(e)=>de(e,q6);var gge=p((e)=>Hr(e[0]),function(){let e=arguments;return mi(e[0],fm,typeof e[1]==="string"?As(e[1],e[2]):(t)=>Object.entries(e[1]).reduce((r,[n,o])=>As(r,n,o),t))}),YI=(e)=>xe(e,_),xge=(e)=>Dy(e,_),E0=(e)=>{let t,r=void 0;if(typeof e==="function")t=e;else t=e.try,r=e.catch;return Re(()=>{try{return X(on(t))}catch(n){return Gt(r?on(()=>r(n)):new rC(n,"An unknown error occurred in Effect.try"))}})},yge=p(3,(e,t,r)=>lu(e,(n)=>{if(de(n,t)&&n[t]===r.failure)return r.onFailure(n);return Gt(n)})),Sge=p(2,(e,t)=>cm(e,(r)=>{let n=sm(r,(o)=>Wb(o)?_(o):R());switch(n._tag){case"None":return dr(r);case"Some":return t(n.value.defect)}})),Ege=p(2,(e,t)=>po(e,{onFailure:(r)=>{let n=t(r);switch(n._tag){case"None":return dr(r);case"Some":return n.value}},onSuccess:X})),bge=p(2,(e,t)=>cm(e,(r)=>{let n=sm(r,(o)=>Wb(o)?_(o):R());switch(n._tag){case"None":return dr(r);case"Some":{let o=t(n.value.defect);return o._tag==="Some"?o.value:dr(r)}}})),Cge=p((e)=>Hr(e[0]),(e,...t)=>{let r=t[t.length-1],n;if(t.length===2)n=Zu(t[0]);else n=(o)=>{let s=de(o,"_tag")?o._tag:void 0;if(!s)return!1;for(let i=0;i<t.length-1;i++)if(t[i]===s)return!0;return!1};return zT(e,n,r)}),wge=p(2,(e,t)=>{let r;return zT(e,(n)=>(r??=Object.keys(t),de(n,"_tag")&&Jr(n._tag)&&r.includes(n._tag)),(n)=>t[n._tag](n))}),kge=(e)=>$T(e,{onFailure:te,onSuccess:()=>Qs}),yp=cge,Ige=yp(X),Age=p(2,(e,t)=>Qt(Em(t),e)),pU=(e)=>Ot((t,r)=>e({id:t.id(),status:r,interruptors:$b(t.getFiberRef(Hy))})),Oge=pU((e)=>jh(e.interruptors)>0?Zn:yt),_ge=pU(X),ZI=(e)=>I0(e,dU,f0),Tnt=(e)=>I0(e,Qb(dU,RI),([t,r],[n,o])=>[f0(t,n),au(r,o)]),vge=X({}),b0=oy(xe,V),C0=Nd(xe),Tge=Fd(xe),Rge=p(2,(e,t)=>Re(()=>{let r=e[Symbol.iterator](),n=[],o,s=X(!1),i=0;while((o=r.next())&&!o.done){let a=o.value,c=i++;s=V(s,(l)=>{if(l)return n.push(a),X(!0);return t(a,c)})}return xe(s,()=>n)})),Mge=p(2,(e,t)=>Re(()=>{let r=e[Symbol.iterator](),n=[],o,s=X(!0),i=0;while((o=r.next())&&!o.done){let a=o.value,c=i++;s=V(s,(l)=>xe(l?t(a,c):X(!1),(u)=>{if(!u)n.push(a);return u}))}return xe(s,()=>n)})),Pge=(e)=>xe(bl(),e),W6=(e)=>Kb(e,()=>V(um(),()=>W6(e))),Dge=p(2,(e,t)=>xe(Ra(e,te),Tc(t))),Fge=p(3,(e,t,r)=>w0(e,t,(n)=>Ry(()=>r(n)))),Nge=p(3,(e,t,r)=>w0(e,t,()=>Ty(r))),w0=p(3,(e,t,r)=>V(e,(n)=>t(n)?X(n):r(n))),Lge=p(3,(e,t,r)=>Re(()=>t(e)?X(e):Gt(r(e)))),Uge=p((e)=>Hr(e[0]),(e,t,r)=>w0(e,t,(n)=>r===void 0?Gt(new Ma):fp(()=>r(n)))),Hge=p(2,(e,t)=>Re(()=>{let r=e[Symbol.iterator](),n=r.next();if(!n.done)return qge(r,0,t,n.value);return X(R())})),qge=(e,t,r,n)=>V(r(n,t),(o)=>{if(o)return X(_(n));let s=e.next();if(!s.done)return qge(e,t+1,r,s.value);return X(R())}),Bge=(e)=>Re(()=>{let t=Fr(e);if(!kn(t))return Ry(()=>new tC("Received an empty collection of effects"));return d(va(t),ki(Ai(t),(r,n)=>Kb(r,()=>n)))}),Wge=p(2,(e,t)=>Py(t(Py(e)))),k0=p(2,(e,t)=>di(e,{onFailure:(r)=>X(t.onFailure(r)),onSuccess:(r)=>X(t.onSuccess(r))})),zge=p(2,(e,t)=>Re(()=>$ge(e[Symbol.iterator](),0,t))),$ge=(e,t,r)=>{let n=e.next();return n.done?X(!0):V(r(n.value,t),(o)=>o?$ge(e,t+1,r):X(o))},fU=(e)=>{let t=V(V(e,()=>um()),()=>t);return t},dU=Ot((e)=>X(e.getFiberRefs())),jge=(e)=>V(e,(t)=>{let n=t[Symbol.iterator]().next();if(n.done)return Gt(new Ma);return X(n.value)}),mU=(e)=>k0(e,{onFailure:wo,onSuccess:wo}),Vge=(e)=>po(e,{onFailure:(t)=>$6(t,"An error was silently ignored because it is not anticipated to be useful"),onSuccess:()=>yt}),Gge=(e)=>xU((t,r)=>ghe(r,t,e)),Kge=(e)=>k0(e,{onFailure:uo,onSuccess:Fo}),Jge=(e)=>k0(e,{onFailure:Fo,onSuccess:uo}),z6=(e,t)=>Re(()=>{if(t.while(e))return V(t.body(e),(r)=>z6(r,t));return X(e)}),pg=(e)=>(...t)=>{let r=Ft(e),n=void 0;for(let o=0,s=t.length;o<s;o++){let i=t[o];if(vT(i)){if(n!==void 0)n=yn(n,i);else n=i;t=[...t.slice(0,o),...t.slice(o+1)],o--}}if(n===void 0)n=Qs;return Ot((o)=>(o.log(t,n,r),yt))},Qge=pg(),Yge=pg($2),$6=pg(z2),Zge=pg(W2),Xge=pg(B2),exe=pg(q2),txe=pg(H2),rxe=p(2,(e,t)=>V(wl,(r)=>mi(e,QT,C1(fge(t,r))))),nxe=Fc(fm),oxe=(e,t)=>t.discard?ixe(e,t.while,t.step,t.body):xe(sxe(e,t.while,t.step,t.body),De),sxe=(e,t,r,n)=>Re(()=>t(e)?V(n(e),(o)=>xe(sxe(r(e),t,r,n),C1(o))):ue(()=>up())),ixe=(e,t,r,n)=>Re(()=>t(e)?V(n(e),()=>ixe(r(e),t,r,n)):yt),axe=p(3,(e,t,r)=>Re(()=>{let n=e[Symbol.iterator](),o=[],s=X(t),i,a=0;while(!(i=n.next()).done){let c=a++,l=i.value;s=V(s,(u)=>xe(r(u,l,c),([f,h])=>(o.push(h),f)))}return xe(s,(c)=>[c,o])})),XI=p(2,(e,t)=>po(e,{onFailure:(r)=>ng(()=>t(r)),onSuccess:X})),hU=(e)=>d(Ys(),V((t)=>d(Tnt(e),lm(t),j6,xe((r)=>Qt(r,d(Mn(t),V(([n,o])=>Kr(Qb(yC(n[0]),Fy(n[1])),o)))))))),cxe=(e)=>di(e,{onFailure:(t)=>X(t),onSuccess:X}),gU=(e)=>xe(e,(t)=>!t),lxe=(e)=>V(e,(t)=>{switch(t._tag){case"None":return yt;case"Some":return Gt(new Ma)}}),j6=(e)=>xe(qn(!0),(t)=>In(Tf(e,sU(t,!1)))),uxe=(e)=>di(e,{onFailure:()=>X(R()),onSuccess:(t)=>X(_(t))}),pxe=p(2,(e,t)=>Kb(e,()=>fp(t))),fxe=p(2,(e,t)=>Kb(e,()=>ue(t))),dxe=(e)=>po(e,{onFailure:(t)=>{let r=De(II(t));return r.length===0?dr(t):Gt(r)},onSuccess:X}),yC=(e)=>xU((t,r)=>d(e,F2(t,r))),mxe=(e)=>e.length>=1?ac((t,r)=>{try{e(r).then((n)=>t(X(n)),(n)=>t(cc(n)))}catch(n){t(cc(n))}}):ac((t)=>{try{e().then((r)=>t(X(r)),(r)=>t(cc(r)))}catch(r){t(cc(r))}}),Gy=p(3,(e,t,r)=>hp((n)=>pu(e,or(n,t,r)))),Ky=p(3,(e,t,r)=>hp((n)=>V(r,(o)=>pu(e,d(n,or(t,o)))))),hxe=fu(X),gxe=p(3,(e,t,r)=>De(e).reduce((n,o,s)=>V(n,(i)=>r(i,o,s)),X(t))),xxe=p(3,(e,t,r)=>De(e).reduceRight((n,o,s)=>V(n,(i)=>r(o,i,s)),X(t))),yxe=p(3,(e,t,r)=>V(ue(()=>e[Symbol.iterator]()),(n)=>Sxe(n,0,t,r.while,r.body))),Sxe=(e,t,r,n,o)=>{let s=e.next();if(!s.done&&n(r))return V(o(r,s.value,t),(i)=>Sxe(e,t+1,i,n,o));return X(r)},Exe=p(2,(e,t)=>Re(()=>bxe(e,t))),bxe=(e,t)=>V(e,(r)=>t<=0?X(r):Qt(um(),bxe(e,t-1))),Cxe=(e)=>po(e,{onFailure:Gt,onSuccess:X}),wxe=(e)=>Re(()=>xhe(e)),bm=Em,SC=X(R()),kxe=(e)=>X(_(e)),I0=p(3,(e,t,r)=>V(t,(n)=>V(e,(o)=>xe(t,(s)=>[r(n,s),o])))),Ixe=p((e)=>Hr(e[0]),function(){return V6(arguments[0],typeof arguments[1]==="string"?[xC(arguments[1],arguments[2])]:Object.entries(arguments[1]).map(([e,t])=>xC(e,t)))}),V6=p(2,(e,t)=>mi(e,dm,(r)=>nu(r,t))),Axe=p(2,(e,t)=>Re(()=>{let r=e[Symbol.iterator](),n=[],o,s=X(!1),i=0;while((o=r.next())&&!o.done){let a=o.value,c=i++;s=V(s,(l)=>{if(l)return X(!0);return n.push(a),t(a,c)})}return xe(s,()=>n)})),Oxe=p(2,(e,t)=>Re(()=>{let r=e[Symbol.iterator](),n=[],o,s=X(!0),i=0;while((o=r.next())&&!o.done){let a=o.value,c=i++;s=V(s,(l)=>d(l?t(a,c):X(!1),xe((u)=>{if(u)n.push(a);return u})))}return xe(s,()=>n)})),_xe=p(2,(e,{onFailure:t,onSuccess:r})=>po(e,{onFailure:(n)=>{let o=_f(n);switch(o._tag){case"Left":return Qt(t(o.left),dr(n));case"Right":return dr(n)}},onSuccess:(n)=>Kr(r(n),n)})),vxe=p(2,(e,t)=>cm(e,(r)=>be(H1(r),{onNone:()=>dr(r),onSome:(n)=>Qt(t(n),dr(r))}))),G6=p(2,(e,t)=>po(e,{onFailure:(r)=>{let n=_f(r);switch(n._tag){case"Left":return Qt(t(n.left),dr(r));case"Right":return dr(r)}},onSuccess:X})),Txe=p(3,(e,t,r)=>G6(e,(n)=>{if(Zu(n,t))return r(n);return yt})),Rxe=p(2,(e,t)=>po(e,{onFailure:(r)=>Qt(t(r),dr(r)),onSuccess:X})),Mxe=(e)=>K6(e,age),K6=p(2,(e,t)=>I0(e,t,(r,n)=>Af(n-r))),Rnt=dge,Pxe=Rnt(X),J6=(e)=>{let t,r=void 0;if(typeof e==="function")t=e;else t=e.try,r=e.catch;let n=(o)=>r?fp(()=>r(o)):Gt(new rC(o,"An unknown error occurred in Effect.tryPromise"));if(t.length>=1)return ac((o,s)=>{try{t(s).then((i)=>o(X(i)),(i)=>o(n(i)))}catch(i){o(n(i))}});return ac((o)=>{try{t().then((s)=>o(X(s)),(s)=>o(n(s)))}catch(s){o(n(s))}})},Dxe=p(2,(e,t)=>V(e,(r)=>E0({try:()=>t.try(r),catch:t.catch}))),Fxe=p(2,(e,t)=>V(e,(r)=>J6({try:t.try.length>=1?(n)=>t.try(r,n):()=>t.try(r),catch:t.catch}))),Nxe=p(2,(e,t)=>Re(()=>t()?SC:YI(e))),Lxe=p(2,(e,t)=>V(t,(r)=>r?SC:YI(e))),Uxe=(e)=>XI(e,q1),xU=(e)=>Ot((t)=>(t.setFiberRefs(e(t.id(),t.getFiberRefs())),yt)),Hxe=p(3,(e,t,r)=>ig(e,(n)=>or(n,t,r(qo(n,t))))),yU=p(2,(e,t)=>Re(()=>t()?xe(e,_):X(R()))),qxe=p(3,(e,t,r)=>V(Fc(t),(n)=>r(n)?xe(e,(o)=>[n,_(o)]):X([n,R()]))),Bxe=p(3,(e,t,r)=>V(sn(t),(n)=>r(n)?xe(e,(o)=>[n,_(o)]):X([n,R()]))),Wxe=p(2,(e,t)=>t(e)),zxe=(e,t)=>(...r)=>V(e,(n)=>t(n)(...r)),$xe=(e,t)=>(...r)=>xe(e,(n)=>t(n)(...r)),Q6=(e)=>new Proxy({},{get(t,r,n){return(...o)=>V(e,(s)=>s[r](...o))}}),Y6=(e)=>new Proxy({},{get(t,r,n){return V(e,(o)=>Hr(o[r])?o[r]:X(o[r]))}}),jxe=(e)=>({functions:Q6(e),constants:Y6(e)}),Vxe=(e)=>xe(bl(),ws(e)),Z6=(e)=>V(bl(),ws(e)),Gxe=function(){let e=arguments;return mU(V(e8,(t)=>ue(()=>{if(typeof e[0]==="string")t.attribute(e[0],e[1]);else for(let r in e[0])t.attribute(r,e[0][r])})))},Kxe=function(){let e=arguments,t=Array.isArray(e[0])?e[0]:[{_tag:"SpanLink",span:e[0],attributes:e[1]??{}}];return mU(V(X6,(r)=>ue(()=>r.addLinks(t))))},Jxe=p((e)=>Hr(e[0]),function(){let e=arguments;return mi(e[0],Xb,typeof e[1]==="string"?As(e[1],e[2]):(t)=>Object.entries(e[1]).reduce((r,[n,o])=>As(r,n,o),t))}),Qxe=Z6(vs),X6=V(bl(),(e)=>{let t=e.unsafeMap.get(vs.key);return t!==void 0&&t._tag==="Span"?X(t):Gt(new Ma)}),e8=V(bl(),(e)=>{let t=A0(ws(e,vs));return t._tag==="Some"&&t.value._tag==="Span"?X(t.value):Gt(new Ma)}),Yxe=p((e)=>Hr(e[0]),(e,t,r)=>mi(e,XT,Is({_tag:"SpanLink",span:t,attributes:r??{}}))),Zxe=BigInt(0),A0=Qn((e)=>er(e.context,uC)?e._tag==="Span"?A0(e.parent):R():_(e)),SU=(e,t,r)=>{let n=!e.getFiberRef(Zb)||r.context&&er(r.context,uC),o=e.getFiberRef(_s),s=r.parent?_(r.parent):r.root?R():A0(ws(o,vs)),i;if(n)i=yme({name:t,parent:s,context:or(r.context??Tn(),uC,!0)});else{let a=e.getFiberRef(An),c=er(a,xm),l=er(a,lge),u=e.getFiberRef(mm),f=e.getFiberRefs(),h=b6(f,Xb),y=b6(f,XT),E=y._tag==="Some"?r.links!==void 0?[...lr(y.value),...r.links??[]]:lr(y.value):r.links??Ge();if(i=c.span(t,s,r.context??Tn(),E,u?l.unsafeCurrentTimeNanos():Zxe,r.kind??"internal",r),h._tag==="Some")wfe(h.value,(b,w)=>i.attribute(w,b));if(r.attributes!==void 0)Object.entries(r.attributes).forEach(([b,w])=>i.attribute(b,w))}if(typeof r.captureStackTrace==="function")RT.set(i,r.captureStackTrace);return i},Xxe=(e,t)=>(t=Da(t),Ot((r)=>X(SU(r,e,t)))),eye=Fc(Xb),tye=Fc(XT),eA=(e,t,r,n)=>ue(()=>{if(e.status._tag==="Ended")return;if(i2(t)&&RT.has(e))e.attribute("code.stacktrace",RT.get(e)());e.end(n?r.unsafeCurrentTimeNanos():Zxe,t)}),lU=(e,...t)=>{let r=Da(t.length===1?void 0:t[0]),n=t[t.length-1];return Ot((o)=>{let s=SU(o,e,r),i=o.getFiberRef(mm),a=er(o.getFiberRef(An),Lc);return Pc(n(s),(c)=>eA(s,c,a,i))})},uU=p(2,(e,t)=>Gy(e,vs,t)),t8=function(){let e=typeof arguments[0]!=="string",t=e?arguments[1]:arguments[0],r=Da(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return lU(t,r,(o)=>uU(n,o))}return(n)=>lU(t,r,(o)=>uU(n,o))},rye=(e)=>function(){let t=e.captureStackTrace??!1;if(e.captureStackTrace!==!1){let r=Error.stackTraceLimit;Error.stackTraceLimit=2;let n=Error();Error.stackTraceLimit=r;let o=!1;t=()=>{if(o!==!1)return o;if(n.stack)return o=n.stack.trim().split(`
|
|
175
|
+
`).slice(2).join(`
|
|
176
|
+
`).trim(),o}}return Re(()=>{let r=typeof e.options==="function"?e.options.apply(null,arguments):e.options;return t8(Re(()=>on(()=>e.body.apply(this,arguments))),r.name,{...r,captureStackTrace:t})})},nye=(e)=>e==null?Gt(new Ma):X(e),oye=(e)=>lu(xe(e,_),(t)=>o2(t)?SC:Gt(t));var Rr={};Ht(Rr,{all:()=>n8,as:()=>Pnt,asVoid:()=>r8,causeOption:()=>Dnt,die:()=>hu,exists:()=>Fnt,fail:()=>Xr,failCause:()=>gr,flatMap:()=>Nnt,flatMapEffect:()=>Lnt,flatten:()=>o8,forEachEffect:()=>sye,fromEither:()=>Unt,fromOption:()=>Hnt,getOrElse:()=>qnt,interrupt:()=>Jy,isExit:()=>O0,isFailure:()=>Fa,isInterrupted:()=>Mnt,isSuccess:()=>Uc,map:()=>tA,mapBoth:()=>EU,mapError:()=>Bnt,mapErrorCause:()=>Wnt,match:()=>to,matchEffect:()=>iye,succeed:()=>Nt,void:()=>ta,zip:()=>bU,zipLeft:()=>znt,zipPar:()=>$nt,zipParLeft:()=>jnt,zipParRight:()=>Vnt,zipRight:()=>Qy,zipWith:()=>Gnt});var O0=nC,Fa=i2,Uc=r0,Mnt=Jde,Pnt=oC,r8=LI,Dnt=Qde,n8=By,hu=a2,Fnt=Yde,Xr=Pf,gr=Or,Nnt=c6,Lnt=Zde,o8=Xde,sye=eme,Unt=tme,Hnt=rme,qnt=nme,Jy=sC,tA=MT,EU=ome,Bnt=sme,Wnt=ime,to=iC,iye=aC,Nt=Tr,ta=eo;var bU=ame,znt=cme,Qy=c2,$nt=lme,jnt=ume,Vnt=pme,Gnt=mp;var s8="InterruptSignal",i8="Stateful",a8="Resume",c8="YieldNow",CU=(e)=>({_tag:"InterruptSignal",cause:e}),rA=(e)=>({_tag:"Stateful",onFiber:e}),EC=(e)=>({_tag:"Resume",effect:e}),aye=()=>({_tag:"YieldNow"});var Knt="effect/FiberScope",wU=Symbol.for(Knt);class lye{[wU]=wU;fiberId=Ks;roots=new Set;add(e,t){this.roots.add(t),t.addObserver(()=>{this.roots.delete(t)})}}class uye{fiberId;parent;[wU]=wU;constructor(e,t){this.fiberId=e,this.parent=t}add(e,t){this.parent.tell(rA((r)=>{r.addChild(t),t.addObserver(()=>{r.removeChild(t)})}))}}var pye=(e)=>new uye(e.id(),e),fg=je(Symbol.for("effect/FiberScope/Global"),()=>new lye);var Jnt="effect/Fiber",nA=Symbol.for(Jnt),_0={_E:(e)=>e,_A:(e)=>e},Qnt={[nA]:_0,pipe(){return ce(this,arguments)}},Ynt="effect/Fiber",kU=Symbol.for(Ynt);var l8=(e)=>(kU in e),IU=(e)=>e.await;var AU=(e)=>e.inheritAll;var OU=p(2,og(function*(e,t){for(let r of e){if(l8(r)){r.unsafeInterruptAsFork(t);continue}yield*r.interruptAsFork(t)}for(let r of e){if(l8(r)&&r.unsafePoll())continue;yield*r.await}})),_U=p(2,(e,t)=>e.interruptAsFork(t)),gu=(e)=>Yb(Sl(e.await),e.inheritAll);var sZt={...Sf,commit(){return gu(this)},...Qnt,id:()=>Ks,await:Ly,children:X([]),inheritAll:Ly,poll:X(R()),interruptAsFork:()=>Ly};var dye=(e)=>e.poll;var dg="effect/FiberCurrent",mye=()=>Ft(globalThis[dg]);var Znt="effect/Logger",oA=Symbol.for(Znt),p8={_Message:(e)=>e,_Output:(e)=>e},ra=(e)=>({[oA]:p8,log:e,pipe(){return ce(this,arguments)}}),hye=p(2,(e,t)=>ra((r)=>e.log({...r,message:t(r.message)}))),vU=p(2,(e,t)=>ra((r)=>e.log(t(r)))),gye=p(2,(e,t)=>ra((r)=>t(r.logLevel)?_(e.log(r)):R())),T0=p(2,(e,t)=>ra((r)=>t(e.log(r)))),xye={[oA]:p8,log:wo,pipe(){return ce(this,arguments)}},TU=(e)=>({[oA]:p8,log:({message:t})=>e(t),pipe(){return ce(this,arguments)}}),yye=(e)=>TU(()=>e),Sye=(e)=>TU(e),RU=p(2,(e,t)=>ra((r)=>[e.log(r),t.log(r)])),Eye=p(2,(e,t)=>T0(RU(e,t),(r)=>r[0])),bye=p(2,(e,t)=>T0(RU(e,t),(r)=>r[1])),Xnt=/^[^\s"=]*$/,Cye=(e,t)=>({annotations:r,cause:n,date:o,fiberId:s,logLevel:i,message:a,spans:c})=>{let l=(E)=>E.match(Xnt)?E:e(E),u=(E,b)=>`${H6(E)}=${l(b)}`,f=(E,b)=>" "+u(E,b),h=u("timestamp",o.toISOString());h+=f("level",i.label),h+=f("fiber",Fb(s));let y=uy(a);for(let E=0;E<y.length;E++)h+=f("message",ll(y[E],t));if(!U1(n))h+=f("cause",cu(n,{renderErrorCause:!0}));for(let E of c)h+=" "+S0(o.getTime())(E);for(let[E,b]of r)h+=f(E,ll(b,t));return h},eot=(e)=>`"${e.replace(/\\([\s\S])|(")/g,"\\$1$2")}"`,MU=ra(Cye(eot)),PU=ra(Cye(JSON.stringify,0)),R0=ra(({annotations:e,cause:t,date:r,fiberId:n,logLevel:o,message:s,spans:i})=>{let a=r.getTime(),c={},l={};if(S1(e)>0)for(let[f,h]of e)c[f]=v0(h);if(Hb(i))for(let f of i)l[f.label]=a-f.startTime;let u=uy(s);return{message:u.length===1?v0(u[0]):u.map(v0),logLevel:o.label,timestamp:r.toISOString(),cause:Oy(t)?void 0:cu(t,{renderErrorCause:!0}),annotations:c,spans:l,fiberId:Fb(n)}}),v0=(e)=>{switch(typeof e){case"bigint":case"function":case"symbol":return String(e);default:return fr(e)}},DU=T0(R0,Wk),wye=(e)=>typeof e==="object"&&e!=null&&(oA in e),tot=(e,...t)=>{let r="";for(let n=0;n<t.length;n++)r+=`\x1B[${t[n]}m`;return r+e+"\x1B[0m"},rot=(e,...t)=>e,Sp={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},not={None:[],All:[],Trace:[Sp.gray],Debug:[Sp.blue],Info:[Sp.green],Warning:[Sp.yellow],Error:[Sp.red],Fatal:[Sp.bgBrightRed,Sp.black]},oot={None:"",All:"",Trace:"color:gray",Debug:"color:blue",Info:"color:green",Warning:"color:orange",Error:"color:red",Fatal:"background-color:red;color:white"},sot=(e)=>`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}.${e.getMilliseconds().toString().padStart(3,"0")}`,kye=typeof process==="object"&&process!==null&&typeof process.stdout==="object"&&process.stdout!==null,iot=kye&&process.stdout.isTTY===!0,aot=kye||"Deno"in globalThis,f8=(e)=>{let t=e?.mode??"auto",n=(t==="auto"?aot?"tty":"browser":t)==="browser",o=typeof e?.colors==="boolean"?e.colors:iot||n,s=e?.formatDate??sot;return n?lot({colors:o,formatDate:s}):cot({colors:o,formatDate:s,stderr:e?.stderr===!0})},cot=(e)=>{let t=e.colors?tot:rot;return ra(({annotations:r,cause:n,context:o,date:s,fiberId:i,logLevel:a,message:c,spans:l})=>{let u=Ff(o,An),f=er(u,Pa).unsafe,h=e.stderr===!0?f.error:f.log,y=uy(c),E=t(`[${e.formatDate(s)}]`,Sp.white)+` ${t(a.label,...not[a._tag])} (${Fb(i)})`;if(Hb(l)){let w=s.getTime(),T=S0(w);for(let A of l)E+=" "+T(A)}E+=":";let b=0;if(y.length>0){let w=v0(y[0]);if(typeof w==="string")E+=" "+t(w,Sp.bold,Sp.cyan),b++}if(h(E),f.group(),!Oy(n))h(cu(n,{renderErrorCause:!0}));if(b<y.length)for(;b<y.length;b++)h(ka(y[b]));if(S1(r)>0)for(let[w,T]of r)h(t(`${w}:`,Sp.bold,Sp.white),ka(T));f.groupEnd()})},lot=(e)=>{let t=e.colors?"%c":"";return ra(({annotations:r,cause:n,context:o,date:s,fiberId:i,logLevel:a,message:c,spans:l})=>{let u=Ff(o,An),f=er(u,Pa).unsafe,h=uy(c),y=`${t}[${e.formatDate(s)}]`,E=[];if(e.colors)E.push("color:gray");if(y+=` ${t}${a.label}${t} (${Fb(i)})`,e.colors)E.push(oot[a._tag],"");if(Hb(l)){let w=s.getTime(),T=S0(w);for(let A of l)y+=" "+T(A)}y+=":";let b=0;if(h.length>0){let w=v0(h[0]);if(typeof w==="string"){if(y+=` ${t}${w}`,e.colors)E.push("color:deepskyblue");b++}}if(f.groupCollapsed(y,...E),!Oy(n))f.error(...Vb(n));if(b<h.length)for(;b<h.length;b++)f.log(ka(h[b]));if(S1(r)>0)for(let[w,T]of r){let A=ka(T);if(e.colors)f.log(`%c${w}:`,"color:gray",A);else f.log(`${w}:`,A)}f.groupEnd()})},FU=je("effect/Logger/prettyLoggerDefault",()=>f8());var Aye="effect/MetricBoundaries",d8=Symbol.for(Aye);class Oye{values;[d8]=d8;constructor(e){this.values=e,this._hash=d(It(Aye),Ee(il(this.values)))}_hash;[Ne](){return this._hash}[Pe](e){return uot(e)&&ge(this.values,e.values)}pipe(){return ce(this,arguments)}}var uot=(e)=>de(e,d8),pot=(e)=>{let t=d(e,xt(We(Number.POSITIVE_INFINITY)),Xv);return new Oye(t)};var _ye=(e)=>d(Hh(e.count-1,(t)=>e.start*Math.pow(e.factor,t)),nt,pot);var dot="effect/MetricKeyType",M0=Symbol.for(dot),vye="effect/MetricKeyType/Counter",m8=Symbol.for(vye),Tye="effect/MetricKeyType/Frequency",h8=Symbol.for(Tye),Rye="effect/MetricKeyType/Gauge",g8=Symbol.for(Rye),Mye="effect/MetricKeyType/Histogram",x8=Symbol.for(Mye),Pye="effect/MetricKeyType/Summary",y8=Symbol.for(Pye),P0={_In:(e)=>e,_Out:(e)=>e};class Dye{incremental;bigint;[M0]=P0;[m8]=m8;constructor(e,t){this.incremental=e,this.bigint=t,this._hash=It(vye)}_hash;[Ne](){return this._hash}[Pe](e){return S8(e)}pipe(){return ce(this,arguments)}}var mot=It(Tye);class hot{preregisteredWords;[M0]=P0;[h8]=h8;constructor(e){this.preregisteredWords=e}[Ne](){return mot}[Pe](e){return E8(e)}pipe(){return ce(this,arguments)}}var got=It(Rye);class xot{bigint;[M0]=P0;[g8]=g8;constructor(e){this.bigint=e}[Ne](){return got}[Pe](e){return b8(e)}pipe(){return ce(this,arguments)}}class Fye{boundaries;[M0]=P0;[x8]=x8;constructor(e){this.boundaries=e,this._hash=d(It(Mye),Ee(oe(this.boundaries)))}_hash;[Ne](){return this._hash}[Pe](e){return C8(e)&&ge(this.boundaries,e.boundaries)}pipe(){return ce(this,arguments)}}class yot{maxAge;maxSize;error;quantiles;[M0]=P0;[y8]=y8;constructor(e,t,r,n){this.maxAge=e,this.maxSize=t,this.error=r,this.quantiles=n,this._hash=d(It(Pye),Ee(oe(this.maxAge)),Ee(oe(this.maxSize)),Ee(oe(this.error)),Ee(il(this.quantiles)))}_hash;[Ne](){return this._hash}[Pe](e){return w8(e)&&ge(this.maxAge,e.maxAge)&&this.maxSize===e.maxSize&&this.error===e.error&&ge(this.quantiles,e.quantiles)}pipe(){return ce(this,arguments)}}var Nye=(e)=>new Dye(e?.incremental??!1,e?.bigint??!1);var Lye=(e)=>new Fye(e);var S8=(e)=>de(e,m8),E8=(e)=>de(e,h8),b8=(e)=>de(e,g8),C8=(e)=>de(e,x8),w8=(e)=>de(e,y8);var Sot="effect/MetricKey",Hye=Symbol.for(Sot),Eot={_Type:(e)=>e},bot=Ji(ge);class NU{name;keyType;description;tags;[Hye]=Eot;constructor(e,t,r,n=[]){this.name=e,this.keyType=t,this.description=r,this.tags=n,this._hash=d(It(this.name+this.description),Ee(oe(this.keyType)),Ee(il(this.tags)))}_hash;[Ne](){return this._hash}[Pe](e){return Cot(e)&&this.name===e.name&&ge(this.keyType,e.keyType)&&ge(this.description,e.description)&&bot(this.tags,e.tags)}pipe(){return ce(this,arguments)}}var Cot=(e)=>de(e,Hye),qye=(e,t)=>new NU(e,Nye(t),Ft(t?.description));var Bye=(e,t,r)=>new NU(e,Lye(t),Ft(r));var Wye=p(2,(e,t)=>t.length===0?e:new NU(e.name,e.keyType,e.description,nu(e.tags,t)));var zye=Symbol.for("effect/MutableHashMap"),kot={[zye]:zye,[Symbol.iterator](){return new k8(this)},toString(){return Ut(this.toJSON())},toJSON(){return{_id:"MutableHashMap",values:Array.from(this).map(fr)}},[dt](){return this.toJSON()},pipe(){return ce(this,arguments)}};class k8{self;referentialIterator;bucketIterator;constructor(e){this.self=e,this.referentialIterator=e.referential[Symbol.iterator]()}next(){if(this.bucketIterator!==void 0)return this.bucketIterator.next();let e=this.referentialIterator.next();if(e.done)return this.bucketIterator=new $ye(this.self.buckets.values()),this.next();return e}[Symbol.iterator](){return new k8(this.self)}}class $ye{backing;constructor(e){this.backing=e}currentBucket;next(){if(this.currentBucket===void 0){let t=this.backing.next();if(t.done)return t;this.currentBucket=t.value[Symbol.iterator]()}let e=this.currentBucket.next();if(e.done)return this.currentBucket=void 0,this.next();return e}}var mg=()=>{let e=Object.create(kot);return e.referential=new Map,e.buckets=new Map,e.bucketsSize=0,e};var hs=p(2,(e,t)=>{if(iy(t)===!1)return e.referential.has(t)?_(e.referential.get(t)):R();let r=t[Ne](),n=e.buckets.get(r);if(n===void 0)return R();return Iot(e,n,t)});var Iot=(e,t,r,n=!1)=>{for(let o=0,s=t.length;o<s;o++)if(r[Pe](t[o][0])){let i=t[o][1];if(n)t.splice(o,1),e.bucketsSize--;return _(i)}return R()},xu=p(2,(e,t)=>Oe(hs(e,t))),pc=p(3,(e,t,r)=>{if(iy(t)===!1)return e.referential.set(t,r),e;let n=t[Ne](),o=e.buckets.get(n);if(o===void 0)return e.buckets.set(n,[[t,r]]),e.bucketsSize++,e;return jye(e,o,t),o.push([t,r]),e.bucketsSize++,e}),jye=(e,t,r)=>{for(let n=0,o=t.length;n<o;n++)if(r[Pe](t[n][0])){t.splice(n,1),e.bucketsSize--;return}};var wm=p(2,(e,t)=>{if(iy(t)===!1)return e.referential.delete(t),e;let r=t[Ne](),n=e.buckets.get(r);if(n===void 0)return e;if(jye(e,n,t),n.length===0)e.buckets.delete(r);return e}),Vye=(e)=>(e.referential.clear(),e.buckets.clear(),e.bucketsSize=0,e),sA=(e)=>e.referential.size+e.bucketsSize;var Aot="effect/MetricState",D0=Symbol.for(Aot),Gye="effect/MetricState/Counter",I8=Symbol.for(Gye),Kye="effect/MetricState/Frequency",A8=Symbol.for(Kye),Jye="effect/MetricState/Gauge",O8=Symbol.for(Jye),Qye="effect/MetricState/Histogram",_8=Symbol.for(Qye),Yye="effect/MetricState/Summary",v8=Symbol.for(Yye),F0={_A:(e)=>e};class Zye{count;[D0]=F0;[I8]=I8;constructor(e){this.count=e}[Ne](){return d(oe(Gye),Ee(oe(this.count)),lt(this))}[Pe](e){return _ot(e)&&this.count===e.count}pipe(){return ce(this,arguments)}}var Oot=Ji(ge);class Xye{occurrences;[D0]=F0;[A8]=A8;constructor(e){this.occurrences=e}_hash;[Ne](){return d(It(Kye),Ee(il(De(this.occurrences.entries()))),lt(this))}[Pe](e){return vot(e)&&Oot(De(this.occurrences.entries()),De(e.occurrences.entries()))}pipe(){return ce(this,arguments)}}class eSe{value;[D0]=F0;[O8]=O8;constructor(e){this.value=e}[Ne](){return d(oe(Jye),Ee(oe(this.value)),lt(this))}[Pe](e){return Tot(e)&&this.value===e.value}pipe(){return ce(this,arguments)}}class tSe{buckets;count;min;max;sum;[D0]=F0;[_8]=_8;constructor(e,t,r,n,o){this.buckets=e,this.count=t,this.min=r,this.max=n,this.sum=o}[Ne](){return d(oe(Qye),Ee(oe(this.buckets)),Ee(oe(this.count)),Ee(oe(this.min)),Ee(oe(this.max)),Ee(oe(this.sum)),lt(this))}[Pe](e){return Rot(e)&&ge(this.buckets,e.buckets)&&this.count===e.count&&this.min===e.min&&this.max===e.max&&this.sum===e.sum}pipe(){return ce(this,arguments)}}class rSe{error;quantiles;count;min;max;sum;[D0]=F0;[v8]=v8;constructor(e,t,r,n,o,s){this.error=e,this.quantiles=t,this.count=r,this.min=n,this.max=o,this.sum=s}[Ne](){return d(oe(Yye),Ee(oe(this.error)),Ee(oe(this.quantiles)),Ee(oe(this.count)),Ee(oe(this.min)),Ee(oe(this.max)),Ee(oe(this.sum)),lt(this))}[Pe](e){return Mot(e)&&this.error===e.error&&ge(this.quantiles,e.quantiles)&&this.count===e.count&&this.min===e.min&&this.max===e.max&&this.sum===e.sum}pipe(){return ce(this,arguments)}}var nSe=(e)=>new Zye(e),oSe=(e)=>new Xye(e),sSe=(e)=>new eSe(e),iSe=(e)=>new tSe(e.buckets,e.count,e.min,e.max,e.sum),aSe=(e)=>new rSe(e.error,e.quantiles,e.count,e.min,e.max,e.sum);var _ot=(e)=>de(e,I8),vot=(e)=>de(e,A8),Tot=(e)=>de(e,O8),Rot=(e)=>de(e,_8),Mot=(e)=>de(e,v8);var Dot="effect/MetricHook",Fot=Symbol.for(Dot),Not={_In:(e)=>e,_Out:(e)=>e},N0=(e)=>({[Fot]:Not,pipe(){return ce(this,arguments)},...e});var cSe=BigInt(0),uSe=(e)=>{let t=e.keyType.bigint?cSe:0,r=e.keyType.incremental?e.keyType.bigint?(o)=>o>=cSe:(o)=>o>=0:(o)=>!0,n=(o)=>{if(r(o))t=t+o};return N0({get:()=>nSe(t),update:n,modify:n})},pSe=(e)=>{let t=new Map;for(let n of e.keyType.preregisteredWords)t.set(n,0);let r=(n)=>{let o=t.get(n)??0;t.set(n,o+1)};return N0({get:()=>oSe(t),update:r,modify:r})},fSe=(e,t)=>{let r=t;return N0({get:()=>sSe(r),update:(n)=>{r=n},modify:(n)=>{r=r+n}})},dSe=(e)=>{let t=e.keyType.boundaries.values,r=t.length,n=new Uint32Array(r+1),o=new Float64Array(r),s=0,i=0,a=Number.MAX_VALUE,c=Number.MIN_VALUE;d(t,Aa(uc),Ke((f,h)=>{o[h]=f}));let l=(f)=>{let h=0,y=r;while(h!==y){let E=Math.floor(h+(y-h)/2),b=o[E];if(f<=b)y=E;else h=E;if(y===h+1)if(f<=o[h])y=h;else h=y}if(n[h]=n[h]+1,s=s+1,i=i+f,f<a)a=f;if(f>c)c=f},u=()=>{let f=Vd(r),h=0;for(let y=0;y<r;y++){let E=o[y],b=n[y];h=h+b,f[y]=[E,h]}return f};return N0({get:()=>iSe({buckets:u(),count:s,min:a,max:c,sum:i}),update:l,modify:l})},mSe=(e)=>{let{error:t,maxAge:r,maxSize:n,quantiles:o}=e.keyType,s=d(o,Aa(uc)),i=Vd(n),a=0,c=0,l=0,u=0,f=0,h=(E)=>{let b=[],w=0;while(w!==n-1){let T=i[w];if(T!=null){let[A,k]=T,O=Bo(E-A);if(uI(O,hl)&&uT(O,r))b.push(k)}w=w+1}return Lot(t,s,Aa(b,uc))},y=(E,b)=>{if(n>0){a=a+1;let w=a%n;i[w]=[b,E]}u=c===0?E:Math.min(u,E),f=c===0?E:Math.max(f,E),c=c+1,l=l+E};return N0({get:()=>aSe({error:t,quantiles:h(Date.now()),count:c,min:u,max:f,sum:l}),update:([E,b])=>y(E,b),modify:([E,b])=>y(E,b)})},Lot=(e,t,r)=>{let n=r.length;if(!ut(t))return Ge();let o=t[0],s=t.slice(1),i=lSe(e,n,R(),0,o,r),a=tt(i);return s.forEach((c)=>{a.push(lSe(e,n,i.value,i.consumed,c,i.rest))}),Ke(a,(c)=>[c.quantile,c.value])},lSe=(e,t,r,n,o,s)=>{let i=e,a=t,c=r,l=n,u=o,f=s,h=e,y=t,E=r,b=n,w=o,T=s;while(!0){if(!ut(f))return{quantile:u,value:R(),consumed:l,rest:[]};if(u===1)return{quantile:u,value:_(Ib(f)),consumed:l+f.length,rest:[]};let A=jr(f),k=qh(f,(M)=>M===A),O=u*a,P=i/2*O,D=l+k[0].length,I=Math.abs(D-O);if(D<O-P){h=i,y=a,E=Ki(f),b=D,w=u,T=k[1],i=h,a=y,c=E,l=b,u=w,f=T;continue}if(D>O+P){let M=vt(c)?_(A):c;return{quantile:u,value:M,consumed:l,rest:f}}switch(c._tag){case"None":{h=i,y=a,E=Ki(f),b=D,w=u,T=k[1],i=h,a=y,c=E,l=b,u=w,f=T;continue}case"Some":{let M=Math.abs(O-c.value);if(I<M){h=i,y=a,E=Ki(f),b=D,w=u,T=k[1],i=h,a=y,c=E,l=b,u=w,f=T;continue}return{quantile:u,value:_(c.value),consumed:l,rest:f}}}}throw Error("BUG: MetricHook.resolveQuantiles - please report an issue at https://github.com/Effect-TS/effect/issues")};var Hot="effect/MetricPair",qot=Symbol.for(Hot),Bot={_Type:(e)=>e};var hSe=(e,t)=>({[qot]:Bot,metricKey:e,metricState:t,pipe(){return ce(this,arguments)}});var zot="effect/MetricRegistry",gSe=Symbol.for(zot);class xSe{[gSe]=gSe;map=mg();snapshot(){let e=[];for(let[t,r]of this.map)e.push(hSe(t,r.get()));return e}get(e){let t=d(this.map,hs(e),Ar);if(t==null){if(S8(e.keyType))return this.getCounter(e);if(b8(e.keyType))return this.getGauge(e);if(E8(e.keyType))return this.getFrequency(e);if(C8(e.keyType))return this.getHistogram(e);if(w8(e.keyType))return this.getSummary(e);throw Error("BUG: MetricRegistry.get - unknown MetricKeyType - please report an issue at https://github.com/Effect-TS/effect/issues")}else return t}getCounter(e){let t=d(this.map,hs(e),Ar);if(t==null){let r=uSe(e);if(!d(this.map,xu(e)))d(this.map,pc(e,r));t=r}return t}getFrequency(e){let t=d(this.map,hs(e),Ar);if(t==null){let r=pSe(e);if(!d(this.map,xu(e)))d(this.map,pc(e,r));t=r}return t}getGauge(e){let t=d(this.map,hs(e),Ar);if(t==null){let r=fSe(e,e.keyType.bigint?BigInt(0):0);if(!d(this.map,xu(e)))d(this.map,pc(e,r));t=r}return t}getHistogram(e){let t=d(this.map,hs(e),Ar);if(t==null){let r=dSe(e);if(!d(this.map,xu(e)))d(this.map,pc(e,r));t=r}return t}getSummary(e){let t=d(this.map,hs(e),Ar);if(t==null){let r=mSe(e);if(!d(this.map,xu(e)))d(this.map,pc(e,r));t=r}return t}}var ySe=()=>new xSe;var jot="effect/Metric",Vot=Symbol.for(jot),Got={_Type:(e)=>e,_In:(e)=>e,_Out:(e)=>e},SSe=je(Symbol.for("effect/Metric/globalMetricRegistry"),()=>ySe()),ESe=function(e,t,r,n){let o=Object.assign((s)=>rs(s,(i)=>Jot(o,i)),{[Vot]:Got,keyType:e,unsafeUpdate:t,unsafeValue:r,unsafeModify:n,register(){return this.unsafeValue([]),this},pipe(){return ce(this,arguments)}});return o};var L0=(e,t)=>bSe(qye(e,t));var bSe=(e)=>{let t,r=new WeakMap,n=(o)=>{if(o.length===0){if(t!==void 0)return t;return t=SSe.get(e),t}let s=r.get(o);if(s!==void 0)return s;return s=SSe.get(Wye(e,o)),r.set(o,s),s};return ESe(e.keyType,(o,s)=>n(s).update(o),(o)=>n(o).get(),(o,s)=>n(s).modify(o))};var CSe=(e,t,r)=>bSe(Bye(e,t,r));var wSe=p(3,(e,t,r)=>Kot(e,[xC(t,r)]));var Kot=p(2,(e,t)=>ESe(e.keyType,(r,n)=>e.unsafeUpdate(r,nu(t,n)),(r)=>e.unsafeValue(nu(t,r)),(r,n)=>e.unsafeModify(r,nu(t,n))));var Jot=p(2,(e,t)=>_i(dm,(r)=>ue(()=>e.unsafeUpdate(t,r))));var Yot="effect/Request",T8=Symbol.for(Yot),Zot={_E:(e)=>e,_A:(e)=>e},Xot={...qd,[T8]:Zot},kSe=(e)=>de(e,T8);var ISe=function(){function e(t){if(t)Object.assign(this,t)}return e.prototype=Xot,e}();var R8=p(2,(e,t)=>_i(aU,(r)=>ue(()=>{if(r.has(e)){let n=r.get(e);if(!n.state.completed)n.state.completed=!0,hm(n.result,t)}})));class U0{count=0;observers=new Set;interrupted=!1;addObserver(e){this.observers.add(e)}removeObserver(e){this.observers.delete(e)}increment(){this.count++,this.observers.forEach((e)=>e(this.count))}decrement(){this.count--,this.observers.forEach((e)=>e(this.count))}}var Yy={Forward:0,Backward:1};class H0{self;stack;direction;count=0;constructor(e,t,r){this.self=e,this.stack=t,this.direction=r}clone(){return new H0(this.self,this.stack.slice(),this.direction)}reversed(){return new H0(this.self,this.stack.slice(),this.direction===Yy.Forward?Yy.Backward:Yy.Forward)}next(){let e=this.entry;if(this.count++,this.direction===Yy.Forward)this.moveNext();else this.movePrev();switch(e._tag){case"None":return{done:!0,value:this.count};case"Some":return{done:!1,value:e.value}}}get key(){if(this.stack.length>0)return _(this.stack[this.stack.length-1].key);return R()}get value(){if(this.stack.length>0)return _(this.stack[this.stack.length-1].value);return R()}get entry(){return jt(Vv(this.stack),(e)=>[e.key,e.value])}get index(){let e=0,t=this.stack;if(t.length===0){let r=this.self._root;if(r!=null)return r.count;return 0}else if(t[t.length-1].left!=null)e=t[t.length-1].left.count;for(let r=t.length-2;r>=0;--r)if(t[r+1]===t[r].right){if(++e,t[r].left!=null)e+=t[r].left.count}return e}moveNext(){let e=this.stack;if(e.length===0)return;let t=e[e.length-1];if(t.right!=null){t=t.right;while(t!=null)e.push(t),t=t.left}else{e.pop();while(e.length>0&&e[e.length-1].right===t)t=e[e.length-1],e.pop()}}get hasNext(){let e=this.stack;if(e.length===0)return!1;if(e[e.length-1].right!=null)return!0;for(let t=e.length-1;t>0;--t)if(e[t-1].left===e[t])return!0;return!1}movePrev(){let e=this.stack;if(e.length===0)return;let t=e[e.length-1];if(t!=null&&t.left!=null){t=t.left;while(t!=null)e.push(t),t=t.right}else{e.pop();while(e.length>0&&e[e.length-1].left===t)t=e[e.length-1],e.pop()}}get hasPrev(){let e=this.stack;if(e.length===0)return!1;if(e[e.length-1].left!=null)return!0;for(let t=e.length-1;t>0;--t)if(e[t-1].right===e[t])return!0;return!1}}var _t={Red:0,Black:1},Hf=({color:e,count:t,key:r,left:n,right:o,value:s})=>({color:e,key:r,value:s,left:n,right:o,count:t});function M8(e,t){e.key=t.key,e.value=t.value,e.left=t.left,e.right=t.right,e.color=t.color,e.count=t.count}var hg=({count:e,key:t,left:r,right:n,value:o},s)=>({color:s,key:t,value:o,left:r,right:n,count:e}),zo=(e)=>{e.count=1+(e.left?.count??0)+(e.right?.count??0)};var ASe="effect/RedBlackTree",P8=Symbol.for(ASe),rst={_Key:(e)=>e,_Value:(e)=>e},nst={[P8]:rst,[Ne](){let e=oe(ASe);for(let t of this)e^=d(oe(t[0]),Ee(oe(t[1])));return lt(this,e)},[Pe](e){if(OSe(e)){if((this._root?.count??0)!==(e._root?.count??0))return!1;let t=Array.from(e);return Array.from(this).every((r,n)=>{let o=t[n];return ge(r[0],o[0])&&ge(r[1],o[1])})}return!1},[Symbol.iterator](){let e=[],t=this._root;while(t!=null)e.push(t),t=t.left;return new H0(this,e,Yy.Forward)},toString(){return Ut(this.toJSON())},toJSON(){return{_id:"RedBlackTree",values:Array.from(this).map(fr)}},[dt](){return this.toJSON()},pipe(){return ce(this,arguments)}},iA=(e,t)=>{let r=Object.create(nst);return r._ord=e,r._root=t,r},OSe=(e)=>de(e,P8),_Se=(e)=>iA(e,void 0),vSe=p(2,(e,t)=>{let r=_Se(t);for(let[n,o]of e)r=F8(r,n,o);return r});var TSe=p(2,(e,t)=>{let{_ord:r,_root:n}=e;while(n!==void 0){let o=r(t,n.key);if(ge(t,n.key))return _(n.value);if(o<=0)n=n.left;else n=n.right}return R()});var D8=p(2,(e,t)=>Oe(TSe(e,t))),F8=p(3,(e,t,r)=>{let{_ord:n,_root:o}=e,s=[],i=[];while(o!=null){let a=n(t,o.key);if(s.push(o),i.push(a),a<=0)o=o.left;else o=o.right}s.push({color:_t.Red,key:t,value:r,left:void 0,right:void 0,count:1});for(let a=s.length-2;a>=0;--a){let c=s[a];if(i[a]<=0)s[a]={color:c.color,key:c.key,value:c.value,left:s[a+1],right:c.right,count:c.count+1};else s[a]={color:c.color,key:c.key,value:c.value,left:c.left,right:s[a+1],count:c.count+1}}for(let a=s.length-1;a>1;--a){let c=s[a-1],l=s[a];if(c.color===_t.Black||l.color===_t.Black)break;let u=s[a-2];if(u.left===c)if(c.left===l){let f=u.right;if(f&&f.color===_t.Red)c.color=_t.Black,u.right=hg(f,_t.Black),u.color=_t.Red,a-=1;else{if(u.color=_t.Red,u.left=c.right,c.color=_t.Black,c.right=u,s[a-2]=c,s[a-1]=l,zo(u),zo(c),a>=3){let h=s[a-3];if(h.left===u)h.left=c;else h.right=c}break}}else{let f=u.right;if(f&&f.color===_t.Red)c.color=_t.Black,u.right=hg(f,_t.Black),u.color=_t.Red,a-=1;else{if(c.right=l.left,u.color=_t.Red,u.left=l.right,l.color=_t.Black,l.left=c,l.right=u,s[a-2]=l,s[a-1]=c,zo(u),zo(c),zo(l),a>=3){let h=s[a-3];if(h.left===u)h.left=l;else h.right=l}break}}else if(c.right===l){let f=u.left;if(f&&f.color===_t.Red)c.color=_t.Black,u.left=hg(f,_t.Black),u.color=_t.Red,a-=1;else{if(u.color=_t.Red,u.right=c.left,c.color=_t.Black,c.left=u,s[a-2]=c,s[a-1]=l,zo(u),zo(c),a>=3){let h=s[a-3];if(h.right===u)h.right=c;else h.left=c}break}}else{let f=u.left;if(f&&f.color===_t.Red)c.color=_t.Black,u.left=hg(f,_t.Black),u.color=_t.Red,a-=1;else{if(c.left=l.right,u.color=_t.Red,u.right=l.left,l.color=_t.Black,l.right=c,l.left=u,s[a-2]=l,s[a-1]=c,zo(u),zo(c),zo(l),a>=3){let h=s[a-3];if(h.right===u)h.right=l;else h.left=l}break}}}return s[0].color=_t.Black,iA(e._ord,s[0])}),RSe=(e)=>MSe(e,Yy.Forward);var MSe=(e,t)=>{let r=e[Symbol.iterator](),n=0;return{[Symbol.iterator]:()=>MSe(e,t),next:()=>{n++;let o=r.key;if(t===Yy.Forward)r.moveNext();else r.movePrev();switch(o._tag){case"None":return{done:!0,value:n};case"Some":return{done:!1,value:o.value}}}}};var PSe=p(2,(e,t)=>{if(!D8(e,t))return e;let r=e._ord,n=r,o=e._root,s=[];while(o!==void 0){let c=n(t,o.key);if(s.push(o),ge(t,o.key))o=void 0;else if(c<=0)o=o.left;else o=o.right}if(s.length===0)return e;let i=Array(s.length),a=s[s.length-1];i[i.length-1]={color:a.color,key:a.key,value:a.value,left:a.left,right:a.right,count:a.count};for(let c=s.length-2;c>=0;--c)if(a=s[c],a.left===s[c+1])i[c]={color:a.color,key:a.key,value:a.value,left:i[c+1],right:a.right,count:a.count};else i[c]={color:a.color,key:a.key,value:a.value,left:a.left,right:i[c+1],count:a.count};if(a=i[i.length-1],a.left!==void 0&&a.right!==void 0){let c=i.length;a=a.left;while(a.right!=null)i.push(a),a=a.right;let l=i[c-1];i.push({color:a.color,key:l.key,value:l.value,left:a.left,right:a.right,count:a.count}),i[c-1].key=a.key,i[c-1].value=a.value;for(let u=i.length-2;u>=c;--u)a=i[u],i[u]={color:a.color,key:a.key,value:a.value,left:a.left,right:i[u+1],count:a.count};i[c-1].left=i[c]}if(a=i[i.length-1],a.color===_t.Red){let c=i[i.length-2];if(c.left===a)c.left=void 0;else if(c.right===a)c.right=void 0;i.pop();for(let l=0;l<i.length;++l)i[l].count--;return iA(r,i[0])}else if(a.left!==void 0||a.right!==void 0){if(a.left!==void 0)M8(a,a.left);else if(a.right!==void 0)M8(a,a.right);a.color=_t.Black;for(let c=0;c<i.length-1;++c)i[c].count--;return iA(r,i[0])}else if(i.length===1)return iA(r,void 0);else{for(let l=0;l<i.length;++l)i[l].count--;let c=i[i.length-2];if(ost(i),c.left===a)c.left=void 0;else c.right=void 0}return iA(r,i[0])});var ost=(e)=>{let t,r,n,o;for(let s=e.length-1;s>=0;--s){if(t=e[s],s===0){t.color=_t.Black;return}if(r=e[s-1],r.left===t){if(n=r.right,n!==void 0&&n.right!==void 0&&n.right.color===_t.Red){if(n=r.right=Hf(n),o=n.right=Hf(n.right),r.right=n.left,n.left=r,n.right=o,n.color=r.color,t.color=_t.Black,r.color=_t.Black,o.color=_t.Black,zo(r),zo(n),s>1){let i=e[s-2];if(i.left===r)i.left=n;else i.right=n}e[s-1]=n;return}else if(n!==void 0&&n.left!==void 0&&n.left.color===_t.Red){if(n=r.right=Hf(n),o=n.left=Hf(n.left),r.right=o.left,n.left=o.right,o.left=r,o.right=n,o.color=r.color,r.color=_t.Black,n.color=_t.Black,t.color=_t.Black,zo(r),zo(n),zo(o),s>1){let i=e[s-2];if(i.left===r)i.left=o;else i.right=o}e[s-1]=o;return}if(n!==void 0&&n.color===_t.Black)if(r.color===_t.Red){r.color=_t.Black,r.right=hg(n,_t.Red);return}else{r.right=hg(n,_t.Red);continue}else if(n!==void 0){if(n=Hf(n),r.right=n.left,n.left=r,n.color=r.color,r.color=_t.Red,zo(r),zo(n),s>1){let i=e[s-2];if(i.left===r)i.left=n;else i.right=n}if(e[s-1]=n,e[s]=r,s+1<e.length)e[s+1]=t;else e.push(t);s=s+2}}else{if(n=r.left,n!==void 0&&n.left!==void 0&&n.left.color===_t.Red){if(n=r.left=Hf(n),o=n.left=Hf(n.left),r.left=n.right,n.right=r,n.left=o,n.color=r.color,t.color=_t.Black,r.color=_t.Black,o.color=_t.Black,zo(r),zo(n),s>1){let i=e[s-2];if(i.right===r)i.right=n;else i.left=n}e[s-1]=n;return}else if(n!==void 0&&n.right!==void 0&&n.right.color===_t.Red){if(n=r.left=Hf(n),o=n.right=Hf(n.right),r.left=o.right,n.right=o.left,o.right=r,o.left=n,o.color=r.color,r.color=_t.Black,n.color=_t.Black,t.color=_t.Black,zo(r),zo(n),zo(o),s>1){let i=e[s-2];if(i.right===r)i.right=o;else i.left=o}e[s-1]=o;return}if(n!==void 0&&n.color===_t.Black)if(r.color===_t.Red){r.color=_t.Black,r.left=hg(n,_t.Red);return}else{r.left=hg(n,_t.Red);continue}else if(n!==void 0){if(n=Hf(n),r.left=n.right,n.right=r,n.color=r.color,r.color=_t.Red,zo(r),zo(n),s>1){let i=e[s-2];if(i.right===r)i.right=n;else i.left=n}if(e[s-1]=n,e[s]=r,s+1<e.length)e[s+1]=t;else e.push(t);s=s+2}}}};var DSe=vSe;var N8=D8,FSe=F8,L8=RSe;var NSe=PSe;var U8=Symbol.for("effect/SortedSet"),ast={[U8]:{_A:(e)=>e},[Ne](){return d(oe(this.keyTree),Ee(oe(U8)),lt(this))},[Pe](e){return q8(e)&&ge(this.keyTree,e.keyTree)},[Symbol.iterator](){return L8(this.keyTree)},toString(){return Ut(this.toJSON())},toJSON(){return{_id:"SortedSet",values:Array.from(this).map(fr)}},[dt](){return this.toJSON()},pipe(){return ce(this,arguments)}},H8=(e)=>{let t=Object.create(ast);return t.keyTree=e,t},q8=(e)=>de(e,U8);var UU=p(2,(e,t)=>H8(DSe(Array.from(e).map((r)=>[r,!0]),t)));var USe=p(2,(e,t)=>N8(e.keyTree,t)?e:H8(FSe(e.keyTree,t,!0)));var cst=p(2,(e,t)=>{for(let r of e)if(!t(r))return!1;return!0});var lst=p(2,(e,t)=>N8(e.keyTree,t));var LSe=p(2,(e,t)=>cst(e,(r)=>lst(t,r)));var HSe=p(2,(e,t)=>H8(NSe(e.keyTree,t)));var HU=(e)=>L8(e.keyTree),qSe=()=>(e,t)=>LSe(e,t)&&LSe(t,e);var ust="effect/Supervisor",aA=Symbol.for(ust),q0={_T:(e)=>e};class cA{underlying;value0;[aA]=q0;constructor(e,t){this.underlying=e,this.value0=t}get value(){return this.value0}onStart(e,t,r,n){this.underlying.onStart(e,t,r,n)}onEnd(e,t){this.underlying.onEnd(e,t)}onEffect(e,t){this.underlying.onEffect(e,t)}onSuspend(e){this.underlying.onSuspend(e)}onResume(e){this.underlying.onResume(e)}map(e){return new cA(this,d(this.value,xe(e)))}zip(e){return new lA(this,e)}}class lA{left;right;_tag="Zip";[aA]=q0;constructor(e,t){this.left=e,this.right=t}get value(){return Qb(this.left.value,this.right.value)}onStart(e,t,r,n){this.left.onStart(e,t,r,n),this.right.onStart(e,t,r,n)}onEnd(e,t){this.left.onEnd(e,t),this.right.onEnd(e,t)}onEffect(e,t){this.left.onEffect(e,t),this.right.onEffect(e,t)}onSuspend(e){this.left.onSuspend(e),this.right.onSuspend(e)}onResume(e){this.left.onResume(e),this.right.onResume(e)}map(e){return new cA(this,d(this.value,xe(e)))}zip(e){return new lA(this,e)}}var B8=(e)=>de(e,aA)&&Zu(e,"Zip");class WSe{[aA]=q0;fibers=new Set;get value(){return ue(()=>Array.from(this.fibers))}onStart(e,t,r,n){this.fibers.add(n)}onEnd(e,t){this.fibers.delete(t)}onEffect(e,t){}onSuspend(e){}onResume(e){}map(e){return new cA(this,d(this.value,xe(e)))}zip(e){return new lA(this,e)}onRun(e,t){return e()}}class zSe{effect;[aA]=q0;constructor(e){this.effect=e}get value(){return this.effect}onStart(e,t,r,n){}onEnd(e,t){}onEffect(e,t){}onSuspend(e){}onResume(e){}map(e){return new cA(this,d(this.value,xe(e)))}zip(e){return new lA(this,e)}onRun(e,t){return e()}}class pst{ref;[aA]=q0;constructor(e){this.ref=e}get value(){return ue(()=>pr(this.ref))}onStart(e,t,r,n){d(this.ref,Oi(d(pr(this.ref),USe(n))))}onEnd(e,t){d(this.ref,Oi(d(pr(this.ref),HSe(t))))}onEffect(e,t){}onSuspend(e){}onResume(e){}map(e){return new cA(this,d(this.value,xe(e)))}zip(e){return new lA(this,e)}onRun(e,t){return e()}}var fst=()=>new WSe,$Se=ue(fst),dst=(e)=>new zSe(e),bC=je("effect/Supervisor/none",()=>dst(yt));var jSe=by;var VSe="Empty",GSe="AddSupervisor",KSe="RemoveSupervisor",JSe="AndThen",uA={_tag:VSe},BU=(e,t)=>({_tag:JSe,first:e,second:t}),hst=(e,t)=>gst(t,We(e)),gst=(e,t)=>{let r=e,n=t;while(kn(n)){let o=Ai(n);switch(o._tag){case VSe:{n=va(n);break}case GSe:{r=r.zip(o.supervisor),n=va(n);break}case KSe:{r=W8(r,o.supervisor),n=va(n);break}case JSe:{n=wn(o.first)(wn(o.second)(va(n)));break}}}return r},W8=(e,t)=>{if(ge(e,t))return bC;else if(B8(e))return W8(e.left,t).zip(W8(e.right,t));else return e},WU=(e)=>{if(ge(e,bC))return gl();else if(B8(e))return d(WU(e.left),tm(WU(e.right)));else return Of(e)},xst=(e,t)=>{if(ge(e,t))return uA;let r=WU(e),n=WU(t),o=d(n,pJ(r),Sy(uA,(i,a)=>BU(i,{_tag:GSe,supervisor:a}))),s=d(r,pJ(n),Sy(uA,(i,a)=>BU(i,{_tag:KSe,supervisor:a})));return BU(o,s)},QSe=jSe({empty:uA,patch:hst,combine:BU,diff:xst});var bst=L0("effect_fiber_started",{incremental:!0}),YSe=L0("effect_fiber_active"),Cst=L0("effect_fiber_successes",{incremental:!0}),wst=L0("effect_fiber_failures",{incremental:!0}),kst=wSe(CSe("effect_fiber_lifetimes",_ye({start:0.5,factor:2,count:35})),"time_unit","milliseconds"),B0="Continue",Ist="Done",ZSe="Yield",Ast={_E:(e)=>e,_A:(e)=>e},zU=(e)=>{throw Error(`BUG: FiberRuntime - ${ll(e)} - please report an issue at https://github.com/Effect-TS/effect/issues`)},gg=Symbol.for("effect/internal/fiberRuntime/YieldedOp"),xg=je("effect/internal/fiberRuntime/yieldedOpChannel",()=>({currentOp:null})),W0={[jk]:(e,t,r)=>on(()=>t.effect_instruction_i1(r)),["OnStep"]:(e,t,r)=>Tr(Tr(r)),[Vk]:(e,t,r)=>on(()=>t.effect_instruction_i2(r)),[Nv]:(e,t,r)=>{if(e.patchRuntimeFlags(e.currentRuntimeFlags,t.patch),nm(e.currentRuntimeFlags)&&e.isInterrupted())return Or(e.getInterruptedCause());else return Tr(r)},[Gk]:(e,t,r)=>{if(on(()=>t.effect_instruction_i2(r)),on(()=>t.effect_instruction_i0()))return e.pushStack(t),on(()=>t.effect_instruction_i1());else return yt},[bb]:(e,t,r)=>{while(!0){let n=on(()=>t.effect_instruction_i0.next(r));if(n.done)return Tr(n.value);let o=yb(n.value);if(!nC(o))return e.pushStack(t),o;else if(o._tag==="Failure")return o;r=o.value}}},Ost={[s8]:(e,t,r,n)=>(e.processNewInterruptSignal(n.cause),nm(t)?Or(n.cause):r),[a8]:(e,t,r,n)=>{throw Error("It is illegal to have multiple concurrent run loops in a single fiber")},[i8]:(e,t,r,n)=>(n.onFiber(e,w6(t)),r),[c8]:(e,t,r,n)=>V(um(),()=>r)},_st=(e)=>Mc(Jfe(e),(t)=>kl(Zfe(t),([r,n])=>{let o=new Map,s=[];for(let a of n){s.push(lr(a));for(let c of a)o.set(c.request,c)}let i=s.flat();return Xn(Lst(r.runAll(s),i,()=>i.forEach((a)=>{a.listeners.interrupted=!0})),aU,o)},!1,!1)),vst=Uv();class GU extends Zi{[nA]=_0;[kU]=Ast;_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(e,t,r){super();if(this.currentRuntimeFlags=r,this._fiberId=e,this._fiberRefs=t,P1(r)){let n=this.getFiberRef(dm);bst.unsafeUpdate(1,n),YSe.unsafeUpdate(1,n)}this.refreshRefCache()}commit(){return gu(this)}id(){return this._fiberId}resume(e){this.tell(EC(e))}get status(){return this.ask((e,t)=>t)}get runtimeFlags(){return this.ask((e,t)=>{if(Hhe(t))return e.currentRuntimeFlags;return t.runtimeFlags})}scope(){return pye(this)}get children(){return this.ask((e)=>Array.from(e.getChildren()))}getChildren(){if(this._children===null)this._children=new Set;return this._children}getInterruptedCause(){return this.getFiberRef(Hy)}fiberRefs(){return this.ask((e)=>e.getFiberRefs())}ask(e){return Re(()=>{let t=Df(this._fiberId);return this.tell(rA((r,n)=>{hm(t,ue(()=>e(r,n)))})),Mn(t)})}tell(e){if(this._queue.push(e),!this._running)this._running=!0,this.drainQueueLaterOnExecutor()}get await(){return ac((e)=>{let t=(r)=>e(X(r));if(this._exitValue!==null){t(this._exitValue);return}return this.tell(rA((r,n)=>{if(r._exitValue!==null)t(this._exitValue);else r.addObserver(t)})),ue(()=>this.tell(rA((r,n)=>{r.removeObserver(t)})))},this.id())}get inheritAll(){return Ot((e,t)=>{let r=e.id(),n=e.getFiberRefs(),o=t.runtimeFlags,s=this.getFiberRefs(),i=M2(n,r,s);e.setFiberRefs(i);let a=e.getFiberRef($8),c=d(au(o,a),NJ(iu),NJ(AT));return Fy(c)})}get poll(){return ue(()=>Ft(this._exitValue))}unsafePoll(){return this._exitValue}interruptAsFork(e){return ue(()=>this.tell(CU(Yi(e))))}unsafeInterruptAsFork(e){this.tell(CU(Yi(e)))}addObserver(e){if(this._exitValue!==null)e(this._exitValue);else this._observers.push(e)}removeObserver(e){this._observers=this._observers.filter((t)=>t!==e)}getFiberRefs(){return this.setFiberRef($8,this.currentRuntimeFlags),this._fiberRefs}unsafeDeleteFiberRef(e){this._fiberRefs=u0(this._fiberRefs,e)}getFiberRef(e){if(this._fiberRefs.locals.has(e))return this._fiberRefs.locals.get(e)[0][1];return e.initial}setFiberRef(e,t){this._fiberRefs=pC(this._fiberRefs,{fiberId:this._fiberId,fiberRef:e,value:t}),this.refreshRefCache()}refreshRefCache(){this.currentDefaultServices=this.getFiberRef(An),this.currentTracer=this.currentDefaultServices.unsafeMap.get(xm.key),this.currentSupervisor=this.getFiberRef(j0),this.currentScheduler=this.getFiberRef(Uf),this.currentContext=this.getFiberRef(_s),this.currentSpan=this.currentContext.unsafeMap.get(vs.key)}setFiberRefs(e){this._fiberRefs=e,this.refreshRefCache()}addChild(e){this.getChildren().add(e)}removeChild(e){this.getChildren().delete(e)}transferChildren(e){let t=this._children;if(this._children=null,t!==null&&t.size>0){for(let r of t)if(r._exitValue===null)e.add(this.currentRuntimeFlags,r)}}drainQueueOnCurrentThread(){let e=!0;while(e){let t=B0,r=globalThis[dg];globalThis[dg]=this;try{while(t===B0)t=this._queue.length===0?Ist:this.evaluateMessageWhileSuspended(this._queue.splice(0,1)[0])}finally{this._running=!1,globalThis[dg]=r}if(this._queue.length>0&&!this._running)if(this._running=!0,t===ZSe)this.drainQueueLaterOnExecutor(),e=!1;else e=!0;else e=!1}}drainQueueLaterOnExecutor(){this.currentScheduler.scheduleTask(this.run,this.getFiberRef(Mf),this)}drainQueueWhileRunning(e,t){let r=t;while(this._queue.length>0){let n=this._queue.splice(0,1)[0];r=Ost[n._tag](this,e,r,n)}return r}isInterrupted(){return!Oy(this.getFiberRef(Hy))}addInterruptedCause(e){let t=this.getFiberRef(Hy);this.setFiberRef(Hy,yn(t,e))}processNewInterruptSignal(e){this.addInterruptedCause(e),this.sendInterruptSignalToAllChildren()}sendInterruptSignalToAllChildren(){if(this._children===null||this._children.size===0)return!1;let e=!1;for(let t of this._children)t.tell(CU(Yi(this.id()))),e=!0;return e}interruptAllChildren(){if(this.sendInterruptSignalToAllChildren()){let e=this._children.values();this._children=null;let t=!1;return Ny({while:()=>!t,body:()=>{let n=e.next();if(!n.done)return In(n.value.await);else return ue(()=>{t=!0})},step:()=>{}})}return null}reportExitValue(e){if(P1(this.currentRuntimeFlags)){let t=this.getFiberRef(dm),r=this.id().startTimeMillis,n=Date.now();switch(kst.unsafeUpdate(n-r,t),YSe.unsafeUpdate(-1,t),e._tag){case Cn:{Cst.unsafeUpdate(1,t);break}case bn:{wst.unsafeUpdate(1,t);break}}}if(e._tag==="Failure"){let t=this.getFiberRef(DI);if(!zb(e.cause)&&t._tag==="Some")this.log("Fiber terminated with an unhandled error",e.cause,t)}}setExitValue(e){this._exitValue=e,this.reportExitValue(e);for(let t=this._observers.length-1;t>=0;t--)this._observers[t](e);this._observers=[]}getLoggers(){return this.getFiberRef(mA)}log(e,t,r){let n=Oe(r)?r.value:this.getFiberRef(JT),o=this.getFiberRef(fA);if(j2(o,n))return;let s=this.getFiberRef(QT),i=this.getFiberRef(fm),a=this.getLoggers(),c=this.getFiberRefs();if(jh(a)>0){let l=er(this.getFiberRef(An),Lc),u=new Date(l.unsafeCurrentTimeMillis());e4(c,()=>{for(let f of a)f.log({fiberId:this.id(),logLevel:n,message:e,cause:t,context:c,spans:s,annotations:i,date:u})})}}evaluateMessageWhileSuspended(e){switch(e._tag){case c8:return ZSe;case s8:{if(this.processNewInterruptSignal(e.cause),this._asyncInterruptor!==null)this._asyncInterruptor(Or(e.cause)),this._asyncInterruptor=null;return B0}case a8:return this._asyncInterruptor=null,this._asyncBlockingOn=null,this.evaluateEffect(e.effect),B0;case i8:return e.onFiber(this,this._exitValue!==null?Lhe:Uhe(this.currentRuntimeFlags,this._asyncBlockingOn)),B0;default:return zU(e)}}evaluateEffect(e){this.currentSupervisor.onResume(this);try{let t=nm(this.currentRuntimeFlags)&&this.isInterrupted()?Or(this.getInterruptedCause()):e;while(t!==null){let r=t,n=this.runLoop(r);if(n===gg){let o=xg.currentOp;if(xg.currentOp=null,o._op===Kk)if(MJ(this.currentRuntimeFlags))this.tell(aye()),this.tell(EC(eo)),t=null;else t=eo;else if(o._op===Eb)t=null}else{this.currentRuntimeFlags=d(this.currentRuntimeFlags,R1(AT));let o=this.interruptAllChildren();if(o!==null)t=V(o,()=>n);else{if(this._queue.length===0)this.setExitValue(n);else this.tell(EC(n));t=null}}}}finally{this.currentSupervisor.onSuspend(this)}}start(e){if(!this._running){this._running=!0;let t=globalThis[dg];globalThis[dg]=this;try{this.evaluateEffect(e)}finally{if(this._running=!1,globalThis[dg]=t,this._queue.length>0)this.drainQueueLaterOnExecutor()}}else this.tell(EC(e))}startFork(e){this.tell(EC(e))}patchRuntimeFlags(e,t){let r=om(e,t);return globalThis[dg]=this,this.currentRuntimeFlags=r,r}initiateAsync(e,t){let r=!1,n=(o)=>{if(!r)r=!0,this.tell(EC(o))};if(nm(e))this._asyncInterruptor=n;try{t(n)}catch(o){n(dr(Wo(o)))}}pushStack(e){if(this._stack.push(e),e._op==="OnStep")this._steps.push({refs:this.getFiberRefs(),flags:this.currentRuntimeFlags})}popStack(){let e=this._stack.pop();if(e){if(e._op==="OnStep")this._steps.pop();return e}return}getNextSuccessCont(){let e=this.popStack();while(e){if(e._op!==$k)return e;e=this.popStack()}}getNextFailCont(){let e=this.popStack();while(e){if(e._op!==jk&&e._op!==Gk&&e._op!==bb)return e;e=this.popStack()}}[Yle](e){return ue(()=>qo(this.currentContext,e))}["Left"](e){return Gt(e.left)}["None"](e){return Gt(new Ma)}["Right"](e){return Tr(e.right)}["Some"](e){return Tr(e.value)}["Micro"](e){return TI((t)=>{let r=t,n=rge(Yhe(e,this.currentContext));return n.addObserver((o)=>{if(o._tag==="Success")return r(Tr(o.value));switch(o.cause._tag){case"Interrupt":return r(Or(Yi(Ks)));case"Fail":return r(Gt(o.cause.error));case"Die":return r(cc(o.cause.defect))}}),TI((o)=>{r=(s)=>{o(yt)},n.unsafeInterrupt()})})}[XN](e){let t=on(()=>e.effect_instruction_i0()),r=this.getNextSuccessCont();if(r!==void 0){if(!(r._op in W0))zU(r);return W0[r._op](this,r,t)}else return xg.currentOp=Tr(t),gg}[Cn](e){let t=e,r=this.getNextSuccessCont();if(r!==void 0){if(!(r._op in W0))zU(r);return W0[r._op](this,r,t.effect_instruction_i0)}else return xg.currentOp=t,gg}[bn](e){let t=e.effect_instruction_i0,r=this.getNextFailCont();if(r!==void 0)switch(r._op){case $k:case Vk:if(!(nm(this.currentRuntimeFlags)&&this.isInterrupted()))return on(()=>r.effect_instruction_i1(t));else return Or(TT(t));case"OnStep":if(!(nm(this.currentRuntimeFlags)&&this.isInterrupted()))return Tr(Or(t));else return Or(TT(t));case Nv:if(this.patchRuntimeFlags(this.currentRuntimeFlags,r.patch),nm(this.currentRuntimeFlags)&&this.isInterrupted())return Or(yn(t,this.getInterruptedCause()));else return Or(t);default:zU(r)}else return xg.currentOp=Or(t),gg}[eL](e){return on(()=>e.effect_instruction_i0(this,w6(this.currentRuntimeFlags)))}["Blocked"](e){let t=this.getFiberRefs(),r=this.currentRuntimeFlags;if(this._steps.length>0){let n=[],o=this._steps[this._steps.length-1],s=this.popStack();while(s&&s._op!=="OnStep")n.push(s),s=this.popStack();this.setFiberRefs(o.refs),this.currentRuntimeFlags=o.flags;let i=fC(o.refs,t),a=au(o.flags,r);return Tr(tg(e.effect_instruction_i0,Ot((c)=>{while(n.length>0)c.pushStack(n.pop());return c.setFiberRefs(dC(c.id(),c.getFiberRefs())(i)),c.currentRuntimeFlags=om(a)(c.currentRuntimeFlags),e.effect_instruction_i1})))}return Un((n)=>V(kC(j1(e.effect_instruction_i0)),()=>n(e.effect_instruction_i1)))}["RunBlocked"](e){return _st(e.effect_instruction_i0)}[Mh](e){let t=e.effect_instruction_i0,r=this.currentRuntimeFlags,n=om(r,t);if(nm(n)&&this.isInterrupted())return Or(this.getInterruptedCause());else if(this.patchRuntimeFlags(this.currentRuntimeFlags,t),e.effect_instruction_i1){let o=au(n,r);return this.pushStack(new GJ(o,e)),on(()=>e.effect_instruction_i1(r))}else return eo}[jk](e){return this.pushStack(e),e.effect_instruction_i0}["OnStep"](e){return this.pushStack(e),e.effect_instruction_i0}[$k](e){return this.pushStack(e),e.effect_instruction_i0}[Vk](e){return this.pushStack(e),e.effect_instruction_i0}[Eb](e){return this._asyncBlockingOn=e.effect_instruction_i1,this.initiateAsync(this.currentRuntimeFlags,e.effect_instruction_i0),xg.currentOp=e,gg}[Kk](e){return this._isYielding=!1,xg.currentOp=e,gg}[Gk](e){let{effect_instruction_i0:t,effect_instruction_i1:r}=e;if(t())return this.pushStack(e),r();else return eo}[bb](e){return W0[bb](this,e,void 0)}[Rh](e){return on(()=>e.commit())}runLoop(e){let t=e;this.currentOpCount=0;while(!0){if((this.currentRuntimeFlags&RJ)!==0)this.currentSupervisor.onEffect(this,t);if(this._queue.length>0)t=this.drainQueueWhileRunning(this.currentRuntimeFlags,t);if(!this._isYielding){this.currentOpCount+=1;let r=this.currentScheduler.shouldYield(this);if(r!==!1){this._isYielding=!0,this.currentOpCount=0;let n=t;t=V(um({priority:r}),()=>n)}}try{if(t=this.currentTracer.context(()=>{if(vst!==t[rg]._V){let r=this.getFiberRef(ZT);if(r._tag==="Some"){let n=t[rg]._V;this.log(`Executing an Effect versioned ${n} with a Runtime of version ${Uv()}, 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`,Qs,r)}}return this[t._op](t)},this),t===gg){let r=xg.currentOp;if(r._op===Kk||r._op===Eb)return gg;return xg.currentOp=null,r._op===Cn||r._op===bn?r:Or(Wo(r))}}catch(r){if(t!==gg&&!de(t,"_op")||!(t._op in this))t=Ty(`Not a valid effect: ${ll(t)}`);else if(n2(r))t=Or(yn(Wo(r),Yi(Ks)));else t=cc(r)}}}run=()=>{this.drainQueueOnCurrentThread()}}var fA=je("effect/FiberRef/currentMinimumLogLevel",()=>Io(V2("Info"))),dA=(e)=>ra((t)=>{let r=Ff(t.context,An);er(r,Pa).unsafe.log(e.log(t))}),rEe=(e)=>ra((t)=>{let r=Ff(t.context,An),n=er(r,Pa).unsafe;switch(t.logLevel._tag){case"Debug":return n.debug(e.log(t));case"Info":return n.info(e.log(t));case"Trace":return n.trace(e.log(t));case"Warning":return n.warn(e.log(t));case"Error":case"Fatal":return n.error(e.log(t));default:return n.log(e.log(t))}}),nEe=(e)=>ra((t)=>{let r=Ff(t.context,An);er(r,Pa).unsafe.error(e.log(t))}),wC=je(Symbol.for("effect/Logger/defaultLogger"),()=>dA(MU)),oEe=je(Symbol.for("effect/Logger/jsonLogger"),()=>dA(DU)),sEe=je(Symbol.for("effect/Logger/logFmtLogger"),()=>dA(PU)),iEe=je(Symbol.for("effect/Logger/prettyLogger"),()=>FU),aEe=je(Symbol.for("effect/Logger/structuredLogger"),()=>dA(R0)),j8=je(Symbol.for("effect/Logger/tracerLogger"),()=>ra(({annotations:e,cause:t,context:r,fiberId:n,logLevel:o,message:s})=>{let i=A0(ws(ug(r,_s),vs));if(i._tag==="None"||i.value._tag==="ExternalSpan")return;let a=qo(ug(r,An),Lc),c={};for(let[l,u]of e)c[l]=u;if(c["effect.fiberId"]=gfe(n),c["effect.logLevel"]=o.label,t!==null&&t._tag!=="Empty")c["effect.cause"]=cu(t,{renderErrorCause:!0});i.value.event(ll(Array.isArray(s)&&s.length===1?s[0]:s),a.unsafeCurrentTimeNanos(),c)})),cEe=(e)=>vU(e,(t)=>{let r=Qn(p0(t.context,_s),ws(vs));if(r._tag==="None")return t;return{...t,annotations:d(t.annotations,As("effect.traceId",r.value.traceId),As("effect.spanId",r.value.spanId),r.value._tag==="Span"?As("effect.spanName",r.value.name):te)}}),mA=je(Symbol.for("effect/FiberRef/currentLoggers"),()=>r6(Of(wC,j8))),lEe=p(3,(e,t,r)=>V(QU,(n)=>{let o=[],s=Re(()=>{if(o.length===0)return yt;let i=o;return o=[],r(i)});return Un((i)=>d(bm(t),Qt(s),fU,i,kC,V((a)=>FI(n,Rf(a))),Qt(qf(()=>s)),Kr(ra((a)=>{o.push(e.log(a))}))))})),uEe=function(){if(typeof arguments[0]==="string")return hi(fm,As(arguments[0],arguments[1]));let e=Object.entries(arguments[0]);return hi(fm,Sfe((t)=>{for(let r=0;r<e.length;r++){let[n,o]=e[r];As(t,n,o)}return t}))},pEe=p(2,(e,t)=>{let r=typeof t==="string"?V2(t):t;return Ot((n)=>{let o=n.getFiberRef(fA);if(j2(o,r))return X(R());return xe(e,_)})}),km=p((e)=>Hr(e[0]),(e,t)=>Dc(rs(e,(r)=>qf((n)=>t(r,n))))),fEe=p((e)=>Hr(e[0]),(e,t)=>La(e,qf((r)=>t(r)))),qf=(e)=>Ot((t)=>{let r=t.getFiberRefs(),n=OT(t.currentRuntimeFlags,iu);return V(QU,(o)=>qy(o,(s)=>Ot((i)=>{let a=i.getFiberRefs(),c=i.currentRuntimeFlags,l=fC(a,r),u=au(c,n),f=fC(r,a);return i.setFiberRefs(dC(l,i.id(),r)),La(X1(e(s),u),ue(()=>{i.setFiberRefs(dC(f,i.id(),i.getFiberRefs()))}))})))}),dEe=(e)=>Xn(DT,_(fg))(e),XSe=Symbol.for("effect/Effect/existsPar/found"),mEe=p((e)=>ol(e[0])&&!Hr(e[0]),(e,t,r)=>x0(r?.concurrency,()=>Re(()=>hEe(e[Symbol.iterator](),0,t)),()=>di(yu(e,(n,o)=>K1(t(n,o),{onTrue:()=>Gt(XSe),onFalse:()=>yt}),r),{onFailure:(n)=>n===XSe?X(!0):Gt(n),onSuccess:()=>X(!1)}))),hEe=(e,t,r)=>{let n=e.next();if(n.done)return X(!1);return V(r(n.value,t),(o)=>o?X(o):hEe(e,t+1,r))},gEe=p((e)=>ol(e[0])&&!Hr(e[0]),(e,t,r)=>{let n=r?.negate?(o,s)=>xe(t(o,s),i0):t;return x0(r?.concurrency,()=>Re(()=>De(e).reduceRight((o,s,i)=>pm(o,Re(()=>n(s,i)),(a,c)=>c?[s,...a]:a),ue(()=>[]))),()=>xe(yu(e,(o,s)=>xe(n(o,s),(i)=>i?_(o):R()),r),Jd))}),Tst=(e)=>{if(Array.isArray(e)||ol(e))return[e,R()];let t=Object.keys(e),r=t.length;return[t.map((n)=>e[n]),_((n)=>{let o={};for(let s=0;s<r;s++)o[t[s]]=n[s];return o})]},Rst=(e,t,r)=>{let n=[];for(let o of e)n.push(pp(o));return V(yu(n,te,{concurrency:r?.concurrency,batching:r?.batching,concurrentFinalizers:r?.concurrentFinalizers}),(o)=>{let s=R(),i=o.length,a=Array(i),c=Array(i),l=!1;for(let u=0;u<i;u++){let f=o[u];if(f._tag==="Left")a[u]=_(f.left),l=!0;else c[u]=f.right,a[u]=s}if(l)return t._tag==="Some"?Gt(t.value(a)):Gt(a);else if(r?.discard)return yt;return t._tag==="Some"?X(t.value(c)):X(c)})},Mst=(e,t,r)=>{let n=[];for(let o of e)n.push(pp(o));if(r?.discard)return yu(n,te,{concurrency:r?.concurrency,batching:r?.batching,discard:!0,concurrentFinalizers:r?.concurrentFinalizers});return xe(yu(n,te,{concurrency:r?.concurrency,batching:r?.batching,concurrentFinalizers:r?.concurrentFinalizers}),(o)=>t._tag==="Some"?t.value(o):o)},Im=(e,t)=>{let[r,n]=Tst(e);if(t?.mode==="validate")return Rst(r,n,t);else if(t?.mode==="either")return Mst(r,n,t);return t?.discard!==!0&&n._tag==="Some"?xe(yu(r,te,t),n.value):yu(r,te,t)},xEe=(e)=>(t)=>Im(t,e),yEe=(e,t)=>xe(Im(De(e).map(fo),t),Tc((r)=>r0(r)?_(r.effect_instruction_i0):R())),V8=p(2,(e,t)=>Array.from({length:t},()=>e)),SEe=p((e)=>Hr(e[0]),(e,t,r)=>Im(V8(e,t),r)),yu=p((e)=>ol(e[0]),(e,t,r)=>Ot((n)=>{let o=r?.batching===!0||r?.batching==="inherit"&&n.getFiberRef(PI);if(r?.discard)return U6(r.concurrency,()=>CC(WI,r?.concurrentFinalizers)((s)=>o?kl(e,(i,a)=>s(t(i,a)),!0,!1,1):Mc(e,(i,a)=>s(t(i,a)))),()=>CC(v2,r?.concurrentFinalizers)((s)=>kl(e,(i,a)=>s(t(i,a)),o,!1)),(s)=>CC(T2(s),r?.concurrentFinalizers)((i)=>kl(e,(a,c)=>i(t(a,c)),o,!1,s)));return U6(r?.concurrency,()=>CC(WI,r?.concurrentFinalizers)((s)=>o?z8(e,1,(i,a)=>s(t(i,a)),!0):Ra(e,(i,a)=>s(t(i,a)))),()=>CC(v2,r?.concurrentFinalizers)((s)=>pA(e,(i,a)=>s(t(i,a)),o)),(s)=>CC(T2(s),r?.concurrentFinalizers)((i)=>z8(e,s,(a,c)=>i(t(a,c)),o)))})),pA=(e,t,r)=>Re(()=>{let n=De(e),o=Array(n.length);return Qt(kl(n,(i,a)=>V(t(i,a),(c)=>ue(()=>o[a]=c)),r,!1),X(o))}),kl=(e,t,r,n,o)=>Un((s)=>Y1((i)=>Ot((a)=>{let c=Array.from(e).reverse(),l=c.length;if(l===0)return yt;let u=0,f=!1,h=o?Math.min(c.length,o):c.length,y=new Set,E=[],b=()=>y.forEach((M)=>{M.currentScheduler.scheduleTask(()=>{M.unsafeInterruptAsFork(a.id())},0,M)}),w=[],T=[],A=[],k=()=>{let M=E.filter(({exit:B})=>B._tag==="Failure").sort((B,ee)=>B.index<ee.index?-1:B.index===ee.index?0:1).map(({exit:B})=>B);if(M.length===0)M.push(eo);return M},O=(M,B=!1)=>{let ee=Dc(i(M)),j=Pst(ee,a,a.currentRuntimeFlags,fg);return a.currentScheduler.scheduleTask(()=>{if(B)j.unsafeInterruptAsFork(a.id());j.resume(ee)},0,j),j},P=()=>{if(!n)l-=c.length,c=[];f=!0,b()},D=r?G1:fo,I=O(ac((M)=>{let B=(j,ae)=>{if(j._op==="Blocked")A.push(j);else if(E.push({index:ae,exit:j}),j._op==="Failure"&&!f)P()},ee=()=>{if(c.length>0){let j=c.pop(),ae=u++,F=()=>{let ne=c.pop();return ae=u++,V(um(),()=>V(D(s(t(ne,ae))),J))},J=(ne)=>{if(c.length>0){if(B(ne,ae),c.length>0)return F()}return X(ne)},G=V(D(s(t(j,ae))),J),Z=O(G);if(w.push(Z),y.add(Z),f)Z.currentScheduler.scheduleTask(()=>{Z.unsafeInterruptAsFork(a.id())},0,Z);Z.addObserver((ne)=>{let we;if(ne._op==="Failure")we=ne;else we=ne.effect_instruction_i0;if(T.push(Z),y.delete(Z),B(we,ae),E.length===l)M(X(Je(By(k(),{parallel:!0}),()=>eo)));else if(A.length+E.length===l){let ot=k(),rt=A.map((Dt)=>Dt.effect_instruction_i0).reduce(UJ);M(X(tg(rt,kl([Je(By(ot,{parallel:!0}),()=>eo),...A.map((Dt)=>Dt.effect_instruction_i1)],(Dt)=>Dt,r,!0,o))))}else ee()})}};for(let j=0;j<h;j++)ee()}));return In(Pc(Sl(s(gu(I))),iC({onFailure:(M)=>{P();let B=A.length+1,ee=Math.min(typeof o==="number"?o:A.length,A.length),j=Array.from(A);return ac((ae)=>{let F=[],J=0,G=0,Z=(we,ot)=>(rt)=>{if(F[we]=rt,J++,J===B)ae(Tr(Or(M)));if(j.length>0&&ot)ne()},ne=()=>{O(j.pop(),!0).addObserver(Z(G,!0)),G++};I.addObserver(Z(G,!1)),G++;for(let we=0;we<ee;we++)ne()})},onSuccess:()=>Ra(T,(M)=>M.inheritAll)})))}))),z8=(e,t,r,n)=>Re(()=>{let o=De(e),s=Array(o.length);return Qt(kl(o,(a,c)=>xe(r(a,c),(l)=>s[c]=l),n,!1,t),X(s))}),yg=(e)=>Ot((t,r)=>X(z0(e,t,r.runtimeFlags))),kC=(e)=>Dst(e,fg),EEe=p(2,(e,t)=>yg(Q1(e,(r)=>{let n=_f(r);switch(n._tag){case"Left":return t(n.left);case"Right":return dr(n.right)}}))),z0=(e,t,r,n=null)=>{let o=$U(e,t,r,n);return o.resume(e),o},Pst=(e,t,r,n=null)=>$U(e,t,r,n),$U=(e,t,r,n=null)=>{let o=y1(),s=t.getFiberRefs(),i=E6(s,o),a=new GU(o,i,r),c=ug(i,_s),l=a.currentSupervisor;return l.onStart(c,e,_(t),a),a.addObserver((f)=>l.onEnd(f,a)),(n!==null?n:d(t.getFiberRef(DT),Je(()=>t.scope()))).add(r,a),a},Dst=(e,t)=>Ot((r,n)=>X(z0(e,r,n.runtimeFlags,t))),G8=p((e)=>Xl(e[2]),(e,t,r,n)=>x0(n?.concurrency,()=>De(e).reduce((o,s,i)=>pm(o,s,(a,c)=>r(a,c,i)),X(t)),()=>V(qn(t),(o)=>V(yu(e,(s,i)=>V(s,(a)=>ea(o,(c)=>r(c,a,i))),n),()=>sn(o))))),K8=p((e)=>ol(e[0]),(e,t,r)=>d(yu(e,(n,o)=>pp(t(n,o)),r),xe((n)=>_de(n,te)))),bEe=p((e)=>ol(e[0]),(e,t,r)=>V(K8(e,t,{concurrency:r?.concurrency,batching:r?.batching,concurrentFinalizers:r?.concurrentFinalizers}),([n,o])=>tp(n)?Gt(n):r?.discard?yt:X(o))),CEe=(e)=>Ot((t,r)=>ac((n)=>{let o=new Set,s,i=Qs,a=()=>{for(let u of o)u.unsafeInterruptAsFork(t.id())},c=!1,l=!0;for(let u of e){l=!1;let f=z0(vf(u),t,r.runtimeFlags);if(o.add(f),f.addObserver((h)=>{if(o.delete(f),!s)if(h._tag==="Success")c=!0,s=f,i=Qs,a();else i=ms(h.cause,i);if(c&&o.size===0)n(s?Qt(AU(s),s.unsafePoll()):dr(i))}),s)break}if(l)return n(Ry(()=>new tC("Received an empty collection of effects")));return c=!0,OU(o,t.id())})),wEe=p((e)=>ol(e[0])&&!Hr(e[0]),(e,t,r,n)=>x0(n?.concurrency,()=>De(e).reduce((o,s,i)=>pm(o,s,(a,c)=>r(a,c,i)),t),()=>Re(()=>d(G8([t,...e],R(),(o,s,i)=>{switch(o._tag){case"None":return _(s);case"Some":return _(r(o.value,s,i))}},n),xe((o)=>{switch(o._tag){case"None":throw Error("BUG: Effect.reduceEffect - please report an issue at https://github.com/Effect-TS/effect/issues");case"Some":return o.value}}))))),jU=(e)=>hp((t)=>be(ws(t,na),{onNone:()=>e,onSome:(r)=>{switch(r.strategy._tag){case"Parallel":return e;case"Sequential":case"ParallelN":return V(uu(r,v2),(n)=>Am(e,n))}}})),eEe=(e)=>(t)=>hp((r)=>be(ws(r,na),{onNone:()=>t,onSome:(n)=>{if(n.strategy._tag==="ParallelN"&&n.strategy.parallelism===e)return t;return V(uu(n,T2(e)),(o)=>Am(t,o))}})),kEe=(e)=>(t)=>CC(e,!0)(t),CC=(e,t)=>(r)=>hp((n)=>be(ws(n,na),{onNone:()=>r(te),onSome:(o)=>{if(t===!0){let s=e._tag==="Parallel"?jU:e._tag==="Sequential"?VU:eEe(e.parallelism);switch(o.strategy._tag){case"Parallel":return s(r(jU));case"Sequential":return s(r(VU));case"ParallelN":return s(r(eEe(o.strategy.parallelism)))}}else return r(te)}})),bp=(e)=>V(na,e),$0=(e)=>V(Su(),(t)=>Pc(e(t),(r)=>t.close(r))),KU=(e)=>V(Su(),(t)=>Z8(e,t)),VU=(e)=>hp((t)=>be(ws(t,na),{onNone:()=>e,onSome:(r)=>{switch(r.strategy._tag){case"Sequential":return e;case"Parallel":case"ParallelN":return V(uu(r,WI),(n)=>Am(e,n))}}})),IEe=(e,t)=>J8([xC(e,t)]),J8=(e)=>hi(dm,(t)=>nu(t,e)),AEe=p(2,(e,t)=>$0((r)=>V(Am(e,r),t))),OEe=p((e)=>Hr(e[1]),(e,t,r)=>Q8(e,t,(n,o)=>[n,o],r)),Q8=p((e)=>Hr(e[1]),(e,t,r,n)=>Sl(Sg(fo(e),fo(t),(o,s)=>mp(o,s,{onSuccess:r,onFailure:(i,a)=>n?.concurrent?ms(i,a):yn(i,a)}),n)));var _Ee=p((e)=>ol(e[0]),(e,t,r)=>Py(yu(e,(n,o)=>Py(t(n,o)),r))),vEe=(e)=>hi(An,or(Lc,e)),TEe=(e)=>hi(An,or(gm,e)),JU=(e)=>hi(An,or(qI,e)),REe=(e)=>bp((t)=>V(uu(t,Cl),(r)=>d(e,Am(r),xe((n)=>[yl((o)=>Nc(r,sC(o))),n])))),MEe=p((e)=>Hr(e[1]),(e,t,r)=>Sg(e,t,(n,o)=>[n,o],r)),PEe=p((e)=>Hr(e[1]),(e,t,r)=>{if(r?.concurrent!==!0&&(r?.batching===void 0||r.batching===!1))return Yb(e,t);return Sg(e,t,(n,o)=>n,r)}),DEe=p((e)=>Hr(e[1]),(e,t,r)=>{if(r?.concurrent!==!0&&(r?.batching===void 0||r.batching===!1))return Qt(e,t);return Sg(e,t,(n,o)=>o,r)}),Sg=p((e)=>Hr(e[1]),(e,t,r,n)=>xe(Im([e,t],{concurrency:n?.concurrent?2:1,batching:n?.batching,concurrentFinalizers:n?.concurrentFinalizers}),([o,s])=>r(o,s))),Y8=(e)=>{if(e===Vfe)return yt;return d(RI,V((t)=>{let r=om(t,e),n=au(r,t);return d(Fy(e),Qt(qf(()=>Fy(n))),In)}),Dc)},na=qt("effect/Scope"),QU=na,Fst=(e,t)=>{if(e.state._tag==="Open")e.state.finalizers.set({},t)},Nst={[e0]:e0,[t0]:t0,pipe(){return ce(this,arguments)},fork(e){return ue(()=>{let t=FEe(e);if(this.state._tag==="Closed")return t.state=this.state,t;let r={},n=(o)=>t.close(o);return this.state.finalizers.set(r,n),Fst(t,(o)=>ue(()=>{if(this.state._tag==="Open")this.state.finalizers.delete(r)})),t})},close(e){return Re(()=>{if(this.state._tag==="Closed")return yt;let t=Array.from(this.state.finalizers.values()).reverse();if(this.state={_tag:"Closed",exit:e},t.length===0)return yt;return g6(this.strategy)?d(Ra(t,(r)=>fo(r(e))),V((r)=>d(By(r),jt(LI),Je(()=>eo)))):x6(this.strategy)?d(pA(t,(r)=>fo(r(e)),!1),V((r)=>d(By(r,{parallel:!0}),jt(LI),Je(()=>eo)))):d(z8(t,this.strategy.parallelism,(r)=>fo(r(e)),!1),V((r)=>d(By(r,{parallel:!0}),jt(LI),Je(()=>eo))))})},addFinalizer(e){return Re(()=>{if(this.state._tag==="Closed")return e(this.state.exit);return this.state.finalizers.set({},e),yt})}},FEe=(e=Cl)=>{let t=Object.create(Nst);return t.strategy=e,t.state={_tag:"Open",finalizers:new Map},t},Su=(e=Cl)=>ue(()=>FEe(e)),Am=p(2,(e,t)=>ig(e,Rn(_a(na,t)))),Z8=p(2,(e,t)=>d(e,Am(t),Pc((r)=>t.close(r)))),NEe=(e)=>Uy(e,{differ:QSe,fork:uA}),Na=p(2,(e,t)=>In(km(V(Fc(e),(r)=>Kr(eg(e,t),r)),(r)=>eg(e,r)))),hi=p(2,(e,t)=>_i(e,(r)=>Na(e,t(r))));var $8=Lde(PJ),j0=NEe(bC),X8=(e)=>yu(e,IU),YU=(e)=>({...cg,commit(){return gu(this)},[nA]:_0,id:()=>De(e).reduce((r,n)=>Nb(r,n.id()),Ks),await:fo(pA(e,(r)=>Sl(r.await),!1)),children:xe(pA(e,(r)=>r.children,!1),Ab),inheritAll:Mc(e,(r)=>r.inheritAll),poll:xe(Ra(e,(r)=>r.poll),dl(_(Tr([])),(r,n)=>{switch(n._tag){case"None":return R();case"Some":switch(r._tag){case"None":return R();case"Some":return _(mp(n.value,r.value,{onSuccess:(o,s)=>[o,...s],onFailure:ms}))}}})),interruptAsFork:(r)=>Mc(e,(n)=>n.interruptAsFork(r))}),LEe=(e)=>In(kC(Rf(e)));var e5=p(3,(e,t,r)=>t5(e,t,{onSelfWin:(n,o)=>V(n.await,(s)=>{switch(s._tag){case Cn:return V(n.inheritAll,()=>r.onSelfDone(s,o));case bn:return r.onSelfDone(s,o)}}),onOtherWin:(n,o)=>V(n.await,(s)=>{switch(s._tag){case Cn:return V(n.inheritAll,()=>r.onOtherDone(s,o));case bn:return r.onOtherDone(s,o)}})})),UEe=(e)=>Un((t)=>yl((r)=>V(kC(t(e)),(n)=>d(t(gu(n)),lc(()=>d(n,_U(r))))))),ZU=p(2,(e,t)=>yl((r)=>e5(e,t,{onSelfDone:(n,o)=>aC(n,{onFailure:(s)=>d(gu(o),XI((i)=>ms(s,i))),onSuccess:(s)=>d(o,El(r),Kr(s))}),onOtherDone:(n,o)=>aC(n,{onFailure:(s)=>d(gu(o),XI((i)=>ms(i,s))),onSuccess:(s)=>d(o,El(r),Kr(s))})}))),t5=p(3,(e,t,r)=>Ot((n,o)=>{let s=o.runtimeFlags,i=Qi(!0),a=$U(e,n,s,r.selfScope),c=$U(t,n,s,r.otherScope);return ac((l)=>{a.addObserver(()=>tEe(a,c,r.onSelfWin,i,l)),c.addObserver(()=>tEe(c,a,r.onOtherWin,i,l)),a.startFork(e),c.startFork(t)},Nb(a.id(),c.id()))})),tEe=(e,t,r,n,o)=>{if(f1(!0,!1)(n))o(r(e,t))},La=p(2,(e,t)=>Un((r)=>po(r(e),{onFailure:(n)=>po(t,{onFailure:(o)=>dr(yn(n,o)),onSuccess:()=>dr(n)}),onSuccess:(n)=>Kr(t,n)}))),Lst=(e,t,r)=>yl((n)=>La(V(kC(vf(e)),(o)=>ac((s)=>{let i=t.map((l)=>l.listeners.count),a=()=>{if(i.every((l)=>l===0)){if(t.every((l)=>{if(l.result.state.current._tag==="Pending")return!0;else if(l.result.state.current._tag==="Done"&&nC(l.result.state.current.effect)&&l.result.state.current.effect._tag==="Failure"&&kI(l.result.state.current.effect.cause))return!0;else return!1}))c.forEach((l)=>l()),r?.(),s(Rf(o))}};o.addObserver((l)=>{c.forEach((u)=>u()),s(l)});let c=t.map((l,u)=>{let f=(h)=>{i[u]=h,a()};return l.listeners.addObserver(f),()=>l.listeners.removeObserver(f)});return a(),ue(()=>{c.forEach((l)=>l())})})),Re(()=>{let o=t.flatMap((s)=>{if(!s.state.completed)return[s];return[]});return Mc(o,(s)=>R8(s.request,sC(n)))})));var Ep=(e,t)=>(t=Da(t),Dc(Ot((r)=>{let n=qo(r.getFiberRef(_s),na),o=SU(r,e,t),s=r.getFiberRef(mm),i=er(r.getFiberRef(An),Lc);return Kr(qy(n,(a)=>eA(o,a,i,s)),o)}))),XU=(e)=>hi(An,or(xm,e)),HEe=function(){let e=typeof arguments[0]!=="string",t=e?arguments[1]:arguments[0],r=Da(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return V(Ep(t,Da(r)),(o)=>Gy(n,vs,o))}return(n)=>V(Ep(t,Da(r)),(o)=>Gy(n,vs,o))};var Mr={};Ht(Mr,{CauseTypeId:()=>Ust,ExceededCapacityException:()=>Ait,ExceededCapacityExceptionTypeId:()=>$st,IllegalArgumentException:()=>Xy,IllegalArgumentExceptionTypeId:()=>Bst,InterruptedException:()=>yit,InterruptedExceptionTypeId:()=>qst,InvalidPubSubCapacityExceptionTypeId:()=>zst,NoSuchElementException:()=>J0,NoSuchElementExceptionTypeId:()=>Wst,RuntimeException:()=>Q0,RuntimeExceptionTypeId:()=>Hst,TimeoutException:()=>Cit,TimeoutExceptionTypeId:()=>r5,UnknownException:()=>kit,UnknownExceptionTypeId:()=>jst,YieldableError:()=>Vst,andThen:()=>uit,as:()=>cit,contains:()=>fit,defects:()=>tit,die:()=>oa,dieOption:()=>rit,empty:()=>V0,fail:()=>Cp,failureOption:()=>qEe,failureOrCause:()=>Bf,failures:()=>eit,filter:()=>hit,find:()=>mit,flatMap:()=>lit,flatten:()=>pit,flipCauseOption:()=>IC,interrupt:()=>Zy,interruptOption:()=>nit,interruptors:()=>K0,isCause:()=>s5,isDie:()=>a5,isDieType:()=>G0,isEmpty:()=>Zst,isEmptyType:()=>Gst,isExceededCapacityException:()=>Oit,isFailType:()=>i5,isFailure:()=>Xst,isIllegalArgumentException:()=>Eit,isInterruptType:()=>Kst,isInterrupted:()=>Ua,isInterruptedException:()=>Sit,isInterruptedOnly:()=>Om,isNoSuchElementException:()=>bit,isParallelType:()=>Qst,isRuntimeException:()=>l5,isSequentialType:()=>Jst,isTimeoutException:()=>wit,isUnknownException:()=>Iit,keepDefects:()=>oit,linearize:()=>sit,map:()=>fc,match:()=>git,originalError:()=>_it,parallel:()=>n5,pretty:()=>hA,prettyErrors:()=>AC,reduce:()=>xit,reduceWithContext:()=>c5,sequential:()=>o5,size:()=>Yst,squash:()=>gi,squashWith:()=>dit,stripFailures:()=>iit,stripSomeDefects:()=>ait});var Ust=L1,Hst=FT,qst=NT,Bst=LT,Wst=UT,zst=$1,$st=HT,r5=qT,jst=BT,Vst=NI,V0=Qs,Cp=xl,oa=Wo,Zy=Yi,n5=ms,o5=yn,s5=vT,Gst=U1,i5=nde,G0=Wb,Kst=ode,Jst=sde,Qst=ide,Yst=ade,Zst=Oy,Xst=cde,a5=lde,Ua=kI,Om=zb,eit=II,tit=AI,K0=$b,qEe=OI,Bf=_f,IC=ude,rit=$J,nit=jJ,oit=H1,sit=fde,iit=TT,ait=mde,cit=hde,fc=_I,lit=CI,uit=gde,pit=q1,fit=xde,gi=Bde,dit=o6,mit=sm,hit=Sde,git=im,xit=Zh,c5=jb,yit=i6,Sit=n2,Xy=tC,Eit=zde,J0=Ma,bit=o2,Q0=s6,l5=Wde,Cit=a6,wit=Gde,kit=rC,Iit=Kde,Ait=s2,Oit=jde,hA=cu,AC=Vb,_it=Ode;var vit="effect/ScheduleInterval",Y0=Symbol.for(vit),u5={[Y0]:Y0,startMillis:0,endMillis:0},eH=(e,t)=>{if(e>t)return u5;return{[Y0]:Y0,startMillis:e,endMillis:t}},BEe=p(2,(e,t)=>WEe(e,t)===e),WEe=p(2,(e,t)=>{if(e.endMillis<=t.startMillis)return e;if(t.endMillis<=e.startMillis)return t;if(e.startMillis<t.startMillis)return e;if(t.startMillis<e.startMillis)return t;if(e.endMillis<=t.endMillis)return e;return t});var zEe=(e)=>e.startMillis>=e.endMillis;var $Ee=p(2,(e,t)=>{let r=Math.max(e.startMillis,t.startMillis),n=Math.min(e.endMillis,t.endMillis);return eH(r,n)}),jEe=(e)=>Bo(e.endMillis-e.startMillis);var VEe=(e)=>eH(e,Number.POSITIVE_INFINITY);var tH=eH,p5=u5,GEe=BEe;var KEe=zEe;var JEe=$Ee,QEe=jEe;var YEe=VEe;var Rit="effect/ScheduleIntervals",f5=Symbol.for(Rit),d5=(e)=>({[f5]:f5,intervals:e});var XEe=p(2,(e,t)=>Mit(e.intervals,t.intervals,Ze())),Mit=(e,t,r)=>{let n=e,o=t,s=r;while(kn(n)&&kn(o)){let i=d(Ai(n),JEe(Ai(o))),a=KEe(i)?s:d(s,wn(i));if(d(Ai(n),GEe(Ai(o))))n=va(n);else o=va(o);s=a}return d5(ml(s))},rH=(e)=>d(e.intervals,If,Je(()=>p5)).startMillis,ebe=(e)=>d(e.intervals,If,Je(()=>p5)).endMillis,tbe=p(2,(e,t)=>rH(e)<rH(t)),rbe=(e)=>kn(e.intervals);var nbe=d5;var obe=XEe,gA=rH,nH=ebe,sbe=tbe,ibe=rbe;var h5="Continue",abe="Done",cbe=(e)=>({_tag:h5,intervals:e}),lbe=(e)=>({_tag:h5,intervals:nbe(We(e))}),ube={_tag:abe},pbe=(e)=>e._tag===h5,fbe=(e)=>e._tag===abe;var dbe=cbe;var g5=lbe,xA=ube,x5=pbe,eS=fbe;var sa={};Ht(sa,{CloseableScopeTypeId:()=>Nit,Scope:()=>wp,ScopeTypeId:()=>Fit,addFinalizer:()=>Ti,addFinalizerExit:()=>OC,close:()=>tS,extend:()=>rS,fork:()=>Z0,make:()=>X0,use:()=>Lit});var Fit=e0,Nit=t0,wp=na,Ti=FI,OC=qy,tS=Nc,rS=Am,Z0=uu,Lit=Z8,X0=Su;class gbe{permits;waiters=new Set;taken=0;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take=(e)=>am((t)=>{if(this.free<e){let r=()=>{if(this.free<e)return;this.waiters.delete(r),t(Re(()=>{if(this.free<e)return this.take(e);return this.taken+=e,X(e)}))};return this.waiters.add(r),ue(()=>{this.waiters.delete(r)})}t(Re(()=>{if(this.free<e)return this.take(e);return this.taken+=e,X(e)}))});updateTakenUnsafe(e,t){if(this.taken=t(this.taken),this.waiters.size>0)e.getFiberRef(Uf).scheduleTask(()=>{let r=this.waiters.values(),n=r.next();while(n.done===!1&&this.free>0)n.value(),n=r.next()},e.getFiberRef(Mf),e);return X(this.free)}updateTaken(e){return Ot((t)=>this.updateTakenUnsafe(t,e))}resize=(e)=>In(Ot((t)=>{if(this.permits=e,this.free<0)return yt;return this.updateTakenUnsafe(t,(r)=>r)}));release=(e)=>this.updateTaken((t)=>t-e);releaseAll=this.updateTaken((e)=>0);withPermits=(e)=>(t)=>Un((r)=>V(r(this.take(e)),(n)=>La(r(t),this.release(n))));withPermitsIfAvailable=(e)=>(t)=>Un((r)=>Re(()=>{if(this.free<e)return SC;return this.taken+=e,La(r(YI(t)),this.release(e))}))}var nS=(e)=>new gbe(e),xbe=(e)=>ue(()=>nS(e));class ybe extends Zi{isOpen;waiters=[];scheduled=!1;constructor(e){super();this.isOpen=e}commit(){return this.await}unsafeSchedule(e){if(this.scheduled||this.waiters.length===0)return yt;return this.scheduled=!0,e.currentScheduler.scheduleTask(this.flushWaiters,e.getFiberRef(Mf),e),yt}flushWaiters=()=>{this.scheduled=!1;let e=this.waiters;this.waiters=[];for(let t=0;t<e.length;t++)e[t](eo)};open=Ot((e)=>{if(this.isOpen)return yt;return this.isOpen=!0,this.unsafeSchedule(e)});unsafeOpen(){if(this.isOpen)return;this.isOpen=!0,this.flushWaiters()}release=Ot((e)=>{if(this.isOpen)return yt;return this.unsafeSchedule(e)});await=am((e)=>{if(this.isOpen)return e(yt);return this.waiters.push(e),ue(()=>{let t=this.waiters.indexOf(e);if(t!==-1)this.waiters.splice(t,1)})});unsafeClose(){this.isOpen=!1}close=ue(()=>{this.isOpen=!1});whenOpen=(e)=>Qt(this.await,e)}var E5=(e)=>new ybe(e??!1),Sbe=(e)=>ue(()=>E5(e)),Ebe=(e)=>oH(e,X8),bbe=p(2,(e,t)=>xe(b5(e,t),(r)=>r[0])),b5=p(2,(e,t)=>{let r=ur(t);return V(bl(),(n)=>xe(yA(R()),(o)=>[pu(Uit(e,r,o),n),Hit(o)]))}),hbe=(e,t,r)=>{let n=ds(ur(t));return d(Ys(),rs((o)=>lm(e,o)),xe((o)=>_([r+n,o])))},Uit=(e,t,r)=>Un((n)=>d(yp((o)=>o.currentTimeMillis),V((o)=>Pbe(r,(s)=>{switch(s._tag){case"None":return _(hbe(e,t,o));case"Some":{let[i]=s.value;return i-o<=0?_(hbe(e,t,o)):R()}}})),V((o)=>vt(o)?Ty("BUG: Effect.cachedInvalidate - please report an issue at https://github.com/Effect-TS/effect/issues"):n(Mn(o.value[1]))))),Hit=(e)=>xp(e,R()),Cbe=p(2,(e,t)=>oH(e,(r)=>t(YU(r)))),oH=p(2,(e,t)=>V($Se,(r)=>d(C5(e,r),La(V(r.value,t))))),wbe=p((e)=>ol(e[0]),(e,t)=>t?.discard?Mc(e,yg):xe(Ra(e,yg),YU)),oS=p(2,(e,t)=>Ot((r,n)=>{let o=t,s=z0(e,r,n.runtimeFlags,fg);if(o.state._tag==="Open"){let i=()=>yl((c)=>ge(c,s.id())?yt:In(Rf(s))),a={};o.state.finalizers.set(a,i),s.addObserver(()=>{if(o.state._tag==="Closed")return;o.state.finalizers.delete(a)})}else s.unsafeInterruptAsFork(r.id());return X(s)})),sH=(e)=>bp((t)=>oS(e,t)),kbe=(e)=>gu(e),Ibe=(e)=>Re(()=>V(e,gu)),y5=Symbol.for("effect/Effect/memoizeFunction.key");class S5{a;eq;[y5]=y5;constructor(e,t){this.a=e,this.eq=t}[Pe](e){if(de(e,y5))if(this.eq)return this.eq(this.a,e.a);else return ge(this.a,e.a);return!1}[Ne](){return this.eq?0:lt(this,oe(this.a))}}var Abe=(e,t)=>d(ue(()=>mg()),V(yA),xe((r)=>(n)=>d(r.modifyEffect((o)=>{let s=d(o,hs(new S5(n,t)));if(vt(s))return d(Ys(),rs((i)=>d(ZI(e(n)),lm(i),yg)),xe((i)=>[i,d(o,pc(new S5(n,t),i))]));return X([s.value,o])}),V(Mn),V(([o,s])=>d(yC(o),Kr(s)))))),Obe=p(2,(e,t)=>d(fo(e),ZU(fo(t)),(r)=>Sl(r))),C5=p(2,(e,t)=>mi(j0,(n)=>n.zip(t))(e)),_be=p(2,(e,t)=>w5(e,{onTimeout:()=>Vde(t),duration:t})),w5=p(2,(e,{duration:t,onTimeout:r})=>Sl(eR(e,{onTimeout:()=>fp(r),onSuccess:X,duration:t}))),vbe=p(2,(e,{duration:t,onTimeout:r})=>Sl(eR(e,{onTimeout:()=>ng(r),onSuccess:X,duration:t}))),Tbe=p(2,(e,t)=>eR(e,{duration:t,onSuccess:_,onTimeout:R})),eR=p(2,(e,{duration:t,onSuccess:r,onTimeout:n})=>yl((o)=>Un((s)=>t5(s(e),vf(bm(t)),{onSelfWin:(i,a)=>V(i.await,(c)=>{if(c._tag==="Success")return V(i.inheritAll,()=>Kr(El(a,o),r(c.value)));else return V(El(a,o),()=>Or(c.cause))}),onOtherWin:(i,a)=>V(i.await,(c)=>{if(c._tag==="Success")return V(i.inheritAll,()=>Kr(El(a,o),n()));else return V(El(a,o),()=>Or(c.cause))}),otherScope:fg})))),qit="effect/Ref/SynchronizedRef",Rbe=Symbol.for(qit),Bit={_A:(e)=>e};class Mbe extends Zi{ref;withLock;[Rbe]=Bit;[nU]=P6;[Nf]=Nf;constructor(e,t){super();this.ref=e,this.withLock=t,this.get=vi(this.ref)}get;commit(){return this.get}modify(e){return this.modifyEffect((t)=>X(e(t)))}modifyEffect(e){return this.withLock(d(V(vi(this.ref),e),V(([t,r])=>Kr(xp(this.ref,r),t))))}}var yA=(e)=>ue(()=>iH(e)),iH=(e)=>{let t=KI(e),r=nS(1);return new Mbe(t,r.withPermits(1))},Pbe=p(2,(e,t)=>e.modifyEffect((r)=>{let n=t(r);switch(n._tag){case"None":return X([r,r]);case"Some":return xe(n.value,(o)=>[o,o])}}));var Dbe=p((e)=>Hr(e[0]),(e,t,r)=>V(e,(n)=>Im(t(n),r).pipe(xe((o)=>Object.assign({},n,o)))));var Fbe=Symbol.for("effect/ManagedRuntime");var Nbe="ExtendScope",Lbe="Fold",k5="Fresh",Ube="FromEffect",Hbe="Scoped",qbe="Suspend",Bbe="Provide",I5="ProvideMerge",Wbe="MergeAll",zbe="ZipWith";var sS=IU;var SA=mye,A5=AU,Ts=Rf;var EA=El,$be=_U;var jbe=OU,Vbe=LEe,qc=gu;var Gbe=dye;var bA=(e)=>function(){if(arguments.length===1){let t=arguments[0];return(r,...n)=>e(t,r,...n)}return e.apply(this,arguments)},CA=bA((e,t,r)=>{let n=y1(),o=[[_s,[[n,e.context]]]];if(r?.scheduler)o.push([Uf,[[n,r.scheduler]]]);let s=yhe(e.fiberRefs,{entries:o,forkAs:n});if(r?.updateRefs)s=r.updateRefs(s,n);let i=new GU(n,s,e.runtimeFlags),a=t;if(r?.scope)a=V(Z0(r.scope,Cl),(l)=>Qt(FI(l,yl((u)=>ge(u,i.id())?yt:El(i,u))),Pc(t,(u)=>tS(l,u))));let c=i.currentSupervisor;if(c!==bC)c.onStart(e.context,a,R(),i),i.addObserver((l)=>c.onEnd(l,i));if(fg.add(e.runtimeFlags,i),r?.immediate===!1)i.resume(a);else i.start(a);return i}),aH=bA((e,t,r={})=>{let n=CA(e,t,r);if(r.onExit)n.addObserver((o)=>{r.onExit(o)});return(o,s)=>aH(e)(d(n,EA(o??Ks)),{...s,onExit:s?.onExit?(i)=>s.onExit(o8(i)):void 0})}),Kbe=bA((e,t)=>{let r=v5(e)(t);if(r._tag==="Failure")throw _5(r.effect_instruction_i0);return r.effect_instruction_i0});class Jbe extends Error{fiber;_tag="AsyncFiberException";constructor(e){super(`Fiber #${e.id().id} cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work`);this.fiber=e,this.name=this._tag,this.stack=this.message}}var $it=(e)=>{let t=Error.stackTraceLimit;Error.stackTraceLimit=0;let r=new Jbe(e);return Error.stackTraceLimit=t,r};var O5=Symbol.for("effect/Runtime/FiberFailure"),rR=Symbol.for("effect/Runtime/FiberFailure/Cause");class Qbe extends Error{[O5];[rR];constructor(e){let t=Vb(e)[0];super(t?.message||"An error has occurred");if(this[O5]=O5,this[rR]=e,this.name=t?`(FiberFailure) ${t.name}`:"FiberFailure",t?.stack)this.stack=t.stack}toJSON(){return{_id:"FiberFailure",cause:this[rR].toJSON()}}toString(){return"(FiberFailure) "+cu(this[rR],{renderErrorCause:!0})}[dt](){return this.toString()}}var _5=(e)=>{let t=Error.stackTraceLimit;Error.stackTraceLimit=0;let r=new Qbe(e);return Error.stackTraceLimit=t,r};var Ybe=(e)=>{let t=e;switch(t._op){case"Failure":case"Success":return t;case"Left":return Pf(t.left);case"Right":return Tr(t.right);case"Some":return Tr(t.value);case"None":return Pf(new Ma)}},v5=bA((e,t)=>{let r=Ybe(t);if(r)return r;let n=new gC,o=CA(e)(t,{scheduler:n});n.flush();let s=o.unsafePoll();if(s)return s;return a2(V1($it(o),p2(o)))}),Zbe=bA((e,t,r)=>cH(e,t,r).then((n)=>{switch(n._tag){case Cn:return n.effect_instruction_i0;case bn:throw _5(n.effect_instruction_i0)}})),cH=bA((e,t,r)=>new Promise((n)=>{let o=Ybe(t);if(o)n(o);let s=CA(e)(t);if(s.addObserver((i)=>{n(i)}),r?.signal!==void 0)if(r.signal.aborted)s.unsafeInterruptAsFork(s.id());else r.signal.addEventListener("abort",()=>{s.unsafeInterruptAsFork(s.id())},{once:!0})}));class T5{context;runtimeFlags;fiberRefs;constructor(e,t,r){this.context=e,this.runtimeFlags=t,this.fiberRefs=r}pipe(){return ce(this,arguments)}}var lH=(e)=>new T5(e.context,e.runtimeFlags,e.fiberRefs),wA=()=>Ot((e,t)=>X(new T5(e.getFiberRef(_s),t.runtimeFlags,e.getFiberRefs()))),Xbe=M1(iu,T1,v1),Wf=lH({context:Tn(),runtimeFlags:Xbe,fiberRefs:She()});var eCe=p(2,(e,t)=>lH({context:t(e.context),runtimeFlags:e.runtimeFlags,fiberRefs:e.fiberRefs}));var tCe=aH(Wf),rCe=CA(Wf),nCe=Zbe(Wf),oCe=cH(Wf),sCe=Kbe(Wf),iCe=v5(Wf),aCe=(e)=>Re(()=>{let t=void 0;return V(Ys(),(r)=>V(wA(),(n)=>Un((o)=>Qt(yg(o(po(e((s)=>aH(n)(lm(s,r))),{onFailure:(s)=>UI(r,s),onSuccess:(s)=>(t=s,yt)}))),o(lc(Mn(r),()=>t??yt))))))});var M5=p(2,(e,t)=>e.modifyEffect(t));var cCe=p(2,(e,t)=>e.modifyEffect((r)=>xe(t(r),(n)=>[void 0,n])));var jit="effect/Layer",pH=Symbol.for(jit),Vit={_RIn:(e)=>e,_E:(e)=>e,_ROut:(e)=>e},kp={[pH]:Vit,pipe(){return ce(this,arguments)}},Git="effect/Layer/MemoMap",nR=Symbol.for(Git),P5=ko()("effect/Layer/CurrentMemoMap",{defaultValue:()=>Kit()}),oR=(e)=>de(e,pH),D5=(e)=>e._op_layer===k5;class F5{ref;[nR];constructor(e){this.ref=e,this[nR]=nR}getOrElseMemoize(e,t){return d(M5(this.ref,(r)=>{let n=r.get(e);if(n!==void 0){let[o,s]=n,i=d(o,V(([a,c])=>d(yC(a),Kr(c))),Pc(iC({onFailure:()=>yt,onSuccess:()=>qy(t,s)})));return X([i,r])}return d(hC(0),V((o)=>d(Ys(),V((s)=>d(hC(()=>yt),xe((i)=>{let a=Un((l)=>d(Su(),V((u)=>d(l(V(mCe(e,u,!0),(f)=>ZI(f(this)))),fo,V((f)=>{switch(f._tag){case bn:return d(UI(s,f.effect_instruction_i0),Qt(Nc(u,f)),Qt(dr(f.effect_instruction_i0)));case Cn:return d(xp(i,(h)=>d(Nc(u,h),Tf(oU(o,(y)=>[y===1,y-1])),In)),Qt(Vy(o,(h)=>h+1)),Qt(qy(t,(h)=>d(ue(()=>r.delete(e)),Qt(vi(i)),V((y)=>y(h))))),Qt(sg(s,f.effect_instruction_i0)),Kr(f.effect_instruction_i0[1]))}}))))),c=[d(Mn(s),Pc(aC({onFailure:()=>yt,onSuccess:()=>Vy(o,(l)=>l+1)}))),(l)=>d(vi(i),V((u)=>u(l)))];return[a,D5(e)?r:r.set(e,c)]}))))))}),Sl)}}var N5=Re(()=>xe(yA(new Map),(e)=>new F5(e))),Kit=()=>new F5(iH(new Map)),dCe=(e)=>bp((t)=>aS(e,t)),aS=p(2,(e,t)=>V(N5,(r)=>fH(e,r,t))),fH=p(3,(e,t,r)=>V(mCe(e,r),(n)=>Gy(n(t),P5,t))),mCe=(e,t,r=!1)=>{let n=e;switch(n._op_layer){case"Locally":return ue(()=>(o)=>n.f(o.getOrElseMemoize(n.self,t)));case"ExtendScope":return ue(()=>(o)=>bp((s)=>o.getOrElseMemoize(n.layer,s)));case"Fold":return ue(()=>(o)=>d(o.getOrElseMemoize(n.layer,t),po({onFailure:(s)=>o.getOrElseMemoize(n.failureK(s),t),onSuccess:(s)=>o.getOrElseMemoize(n.successK(s),t)})));case"Fresh":return ue(()=>(o)=>d(n.layer,aS(t)));case"FromEffect":return r?ue(()=>(o)=>n.effect):ue(()=>(o)=>o.getOrElseMemoize(e,t));case"Provide":return ue(()=>(o)=>d(o.getOrElseMemoize(n.first,t),V((s)=>d(o.getOrElseMemoize(n.second,t),pu(s)))));case"Scoped":return r?ue(()=>(o)=>Am(n.effect,t)):ue(()=>(o)=>o.getOrElseMemoize(e,t));case"Suspend":return ue(()=>(o)=>o.getOrElseMemoize(n.evaluate(),t));case"ProvideMerge":return ue(()=>(o)=>d(o.getOrElseMemoize(n.first,t),pm(o.getOrElseMemoize(n.second,t),n.zipK)));case"ZipWith":return Z1(function*(){let o=yield*uu(t,c0),s=yield*uu(o,Cl),i=yield*uu(o,Cl);return(a)=>d(a.getOrElseMemoize(n.first,s),Sg(a.getOrElseMemoize(n.second,i),n.zipK,{concurrent:!0}))});case"MergeAll":{let o=n.layers;return xe(uu(t,c0),(s)=>(i)=>{let a=Array(o.length);return xe(kl(o,og(function*(c,l){let u=yield*uu(s,Cl),f=yield*i.getOrElseMemoize(c,u);a[l]=f}),!1,!1),()=>H4(...a))})}}},_C=p(2,(e,t)=>SH(e,{onFailure:t,onSuccess:Eg})),L5=p(2,(e,t)=>yH(e,{onFailure:t,onSuccess:Eg})),U5=(e)=>sR(oa(e)),hCe=(e)=>mH(()=>oa(e())),gCe=(e)=>xH(e,()=>Tn()),dH=()=>dc(bl()),xCe=(e)=>{let t=Object.create(kp);return t._op_layer=Nbe,t.layer=e,t},H5=(e)=>sR(Cp(e)),q5=(e)=>mH(()=>Cp(e())),sR=(e)=>dc(dr(e)),mH=(e)=>dc(ng(e)),Eu=p(2,(e,t)=>SH(e,{onFailure:H5,onSuccess:t})),yCe=p(2,(e,t)=>Eu(e,er(t))),B5=(e)=>{let t=Object.create(kp);return t._op_layer=k5,t.layer=e,t},cS=p(2,(e,t)=>{let r=aI(e),n=r?e:t;return dc(xe(r?t:e,(s)=>_a(n,s)))}),SCe=(e)=>dc(xe(e,()=>Tn()));function dc(e){let t=Object.create(kp);return t._op_layer=Ube,t.effect=e,t}var ECe=p(3,(e,t,r)=>hH(e,Xn(t,r))),hH=p(2,(e,t)=>{let r=Object.create(kp);return r._op_layer="Locally",r.self=e,r.f=t,r}),gH=p(3,(e,t,r)=>hH(e,mi(t,r))),bCe=(e,t)=>Ip(Na(e,t)),CCe=(e,t)=>Ip(hi(e,t)),wCe=(e,t,r)=>dc(xe(e,(n)=>_a(t,r(n)))),kCe=(e)=>KU(Qt(bp((t)=>d(e,aS(t))),Ly)),ICe=function(){if(arguments.length===1)return(e)=>uCe(arguments[0],e);return uCe(arguments[0],arguments[1])},uCe=(e,t)=>IA(e,new Proxy({...t},{get(r,n,o){if(n in r)return r[n];let s=Error.stackTraceLimit;Error.stackTraceLimit=2;let i=Error(`${e.key}: Unimplemented method "${n.toString()}"`);return Error.stackTraceLimit=s,i.name="UnimplementedError",Jit(i)},has:uo})),Jit=(e)=>{let t=cc(e);function r(){return t}return Object.assign(r,t),Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r},xH=p(2,(e,t)=>Eu(e,(r)=>Eg(t(r)))),ACe=p(2,(e,t)=>_C(e,(r)=>q5(()=>t(r)))),yH=p(2,(e,{onFailure:t,onSuccess:r})=>{let n=Object.create(kp);return n._op_layer=Lbe,n.layer=e,n.failureK=t,n.successK=r,n}),SH=p(2,(e,{onFailure:t,onSuccess:r})=>yH(e,{onFailure:(n)=>{let o=Bf(n);switch(o._tag){case"Left":return t(o.left);case"Right":return sR(o.right)}},onSuccess:r})),OCe=(e)=>bp((t)=>xe(hU(aS(e,t)),dc)),W5=p(2,(e,t)=>z5(e,t,(r,n)=>Rn(r,n))),EH=(...e)=>{let t=Object.create(kp);return t._op_layer=Wbe,t.layers=e,t},_Ce=(e)=>_C(e,(t)=>U5(t)),vCe=p(2,(e,t)=>_C(e,t)),TCe=(e)=>W5(dH(),e),RCe=p(4,(e,t,r,n)=>xH(e,(o)=>_a(r,n(qo(o,t))))),MCe=p(2,(e,t)=>aR(()=>{let r=qt("effect/Layer/retry/{ state: unknown }");return d(IA(r,{state:t.initial}),Eu((n)=>PCe(e,t,r,d(n,er(r)).state)))})),PCe=(e,t,r,n)=>d(e,_C((o)=>d(Qit(t,r,o,n),Eu((s)=>B5(PCe(e,t,r,d(s,er(r)).state)))))),Qit=(e,t,r,n)=>cS(t,d(wl,V((o)=>d(e.step(o,r,n),V(([s,i,a])=>eS(a)?Gt(r):d(Em(Bo(gA(a.intervals)-o)),Kr({state:s}))))))),lS=p(2,(e,t)=>{let r=aI(e),n=r?e:t;return iR(xe(r?t:e,(s)=>_a(n,s)))}),Ip=(e)=>iR(d(e,Kr(Tn()))),iR=(e)=>{let t=Object.create(kp);return t._op_layer=Hbe,t.effect=e,t},DCe=iR(xe(km(Su(),(e,t)=>e.close(t)),(e)=>_a(wp,e))),FCe=(e)=>cS(e,e),IA=p(2,(e,t)=>{let r=aI(e);return dc(X(_a(r?e:t,r?t:e)))}),Eg=(e)=>dc(X(e)),NCe=Eg(Tn()),aR=(e)=>{let t=Object.create(kp);return t._op_layer=qbe,t.evaluate=e,t},bH=p(2,(e,t)=>{let r=aI(e),n=r?e:t,o=r?t:e;return dc(ue(()=>_a(n,o())))}),LCe=(e)=>dc(ue(e)),UCe=p(2,(e,t)=>Eu(e,(r)=>dc(Kr(t(r),r)))),HCe=p(2,(e,t)=>_C(e,(r)=>dc(V(t(r),()=>Gt(r))))),qCe=p(2,(e,t)=>L5(e,(r)=>dc(V(t(r),()=>dr(r))))),BCe=(e)=>d(bp((t)=>aS(e,t)),V((t)=>d(wA(),pu(t)))),WCe=p(2,(e,t)=>V(bp((r)=>fH(e,t,r)),(r)=>d(wA(),pu(r)))),vC=p(2,(e,t)=>aR(()=>{let r=Object.create(kp);return r._op_layer=Bbe,r.first=Object.create(kp,{_op_layer:{value:I5,enumerable:!0},first:{value:dH(),enumerable:!0},second:{value:Array.isArray(t)?EH(...t):t},zipK:{value:(n,o)=>d(n,Rn(o))}}),r.second=e,r})),zCe=p(2,(e,t)=>{let r=Object.create(kp);return r._op_layer=I5,r.first=t,r.second=vC(e,t),r.zipK=(n,o)=>d(n,Rn(o)),r}),z5=p(3,(e,t,r)=>aR(()=>{let n=Object.create(kp);return n._op_layer=zbe,n.first=e,n.second=t,n.zipK=r,n})),CH=(e)=>{let t=qt("effect/Layer/unwrapEffect/Layer.Layer<R1, E1, A>");return Eu(cS(t,e),(r)=>er(r,t))},kA=(e)=>{let t=qt("effect/Layer/unwrapScoped/Layer.Layer<R1, E1, A>");return Eu(lS(t,e),(r)=>er(r,t))},$Ce=p((e)=>oR(e[0]),function(){let e=arguments;return gH(e[0],fm,typeof e[1]==="string"?As(e[1],e[2]):(t)=>Object.entries(e[1]).reduce((r,[n,o])=>As(r,n,o),t))}),jCe=p((e)=>oR(e[0]),function(){let e=arguments;return gH(e[0],Xb,typeof e[1]==="string"?As(e[1],e[2]):(t)=>Object.entries(e[1]).reduce((r,[n,o])=>As(r,n,o),t))}),VCe=function(){let e=typeof arguments[0]!=="string",t=e?arguments[1]:arguments[0],r=Da(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return kA(xe(r?.onEnd?rs(Ep(t,r),(o)=>qf((s)=>r.onEnd(o,s))):Ep(t,r),(o)=>uH(n,o)))}return(n)=>kA(xe(r?.onEnd?rs(Ep(t,r),(o)=>qf((s)=>r.onEnd(o,s))):Ep(t,r),(o)=>uH(n,o)))},uH=p(2,(e,t)=>vC(e,Eg(_a(vs,t)))),pCe=p(2,(e,t)=>$0((r)=>V(aS(t,r),(n)=>u2(e,n)))),fCe=p(2,(e,t)=>{let r=fC(Wf.fiberRefs,t.fiberRefs),n=au(Wf.runtimeFlags,t.runtimeFlags);return Un((o)=>Ot((s)=>{let i=s.getFiberRef(_s),a=s.getFiberRefs(),c=dC(s.id(),a)(r),l=s.currentRuntimeFlags,u=om(n)(l),f=fC(c,a),h=au(u,l);return s.setFiberRefs(c),s.currentRuntimeFlags=u,La(u2(o(e),Rn(i,t.context)),Ot((y)=>(y.setFiberRefs(dC(y.id(),y.getFiberRefs())(f)),y.currentRuntimeFlags=om(h)(y.currentRuntimeFlags),yt)))}))}),wH=p(2,(e,t)=>{if(Array.isArray(t))return pCe(e,EH(...t));else if(oR(t))return pCe(e,t);else if(eT(t))return u2(e,t);else if(Fbe in t)return V(t.runtimeEffect,(r)=>fCe(e,r));else return fCe(e,t)});var GCe=xe(Fc(An),er(Pa)),Rs=(e)=>_i(An,(t)=>e(er(t,Pa))),kH=p(2,(e,t)=>mi(e,An,or(Pa,t))),KCe=(e)=>hi(An,or(Pa,e)),JCe=(e)=>Ip(hi(An,or(Pa,e))),QCe=(e,...t)=>Rs((r)=>r.assert(e,...t)),YCe=Rs((e)=>e.clear),ZCe=(e)=>Rs((t)=>t.count(e)),XCe=(e)=>Rs((t)=>t.countReset(e)),ewe=(...e)=>Rs((t)=>t.debug(...e)),twe=(e,t)=>Rs((r)=>r.dir(e,t)),rwe=(...e)=>Rs((t)=>t.dirxml(...e)),nwe=(...e)=>Rs((t)=>t.error(...e)),owe=(e)=>Rs((t)=>km(t.group(e),()=>t.groupEnd)),swe=(...e)=>Rs((t)=>t.info(...e)),iwe=(...e)=>Rs((t)=>t.log(...e)),awe=(e,t)=>Rs((r)=>r.table(e,t)),cwe=(e)=>Rs((t)=>km(t.time(e),()=>t.timeEnd(e))),lwe=(e,...t)=>Rs((r)=>r.timeLog(e,...t)),uwe=(...e)=>Rs((t)=>t.trace(...e)),pwe=(...e)=>Rs((t)=>t.warn(...e)),fwe=p((e)=>Hr(e[0]),(e,t)=>Rs((r)=>vI(r.group(t),()=>e,()=>r.groupEnd))),dwe=p((e)=>Hr(e[0]),(e,t)=>Rs((r)=>vI(r.time(t),()=>e,()=>r.timeEnd(t))));var Yit=I2,Zit=Pa,Xit=kH,eat=JCe,tat=Rs,rat=QCe,nat=YCe,oat=ZCe,sat=XCe,iat=ewe,aat=twe,cat=rwe,$5=nwe,lat=owe,uat=swe,Ao=iwe,pat=awe,fat=cwe,dat=lwe,mat=uwe,hat=pwe,gat=fwe,xat=dwe;var m={};Ht(m,{Do:()=>zut,EffectTypeId:()=>XH,Service:()=>Oft,Tag:()=>Aft,acquireRelease:()=>vr,acquireReleaseInterruptible:()=>Xlt,acquireUseRelease:()=>xS,addFinalizer:()=>TR,all:()=>Ha,allSuccesses:()=>flt,allWith:()=>plt,allowInterrupt:()=>Wlt,andThen:()=>npt,annotateCurrentSpan:()=>KQ,annotateLogs:()=>$C,annotateLogsScoped:()=>Opt,annotateSpans:()=>fft,ap:()=>Ypt,as:()=>qr,asSome:()=>sq,asSomeError:()=>Klt,asVoid:()=>Xs,async:()=>$o,asyncEffect:()=>Olt,awaitAllChildren:()=>sut,bind:()=>$ut,bindAll:()=>jut,bindTo:()=>Vut,blocked:()=>Zpt,cacheRequestResult:()=>rft,cached:()=>Bc,cachedFunction:()=>llt,cachedInvalidateWithTTL:()=>clt,cachedWithTTL:()=>alt,catch:()=>Mlt,catchAll:()=>jo,catchAllCause:()=>tn,catchAllDefect:()=>nq,catchIf:()=>oq,catchSome:()=>Tm,catchSomeCause:()=>UC,catchSomeDefect:()=>Plt,catchTag:()=>mc,catchTags:()=>gS,cause:()=>Dlt,checkInterruptible:()=>zlt,clock:()=>FQ,clockWith:()=>wut,configProviderWith:()=>Fut,console:()=>Aut,consoleWith:()=>Out,context:()=>Pn,contextWith:()=>BC,contextWithEffect:()=>UQ,currentParentSpan:()=>hft,currentPropagatedSpan:()=>mft,currentSpan:()=>dft,custom:()=>_lt,daemonChildren:()=>iut,delay:()=>gIe,descriptor:()=>aut,descriptorWith:()=>cut,die:()=>Ms,dieMessage:()=>$f,dieSync:()=>TQ,diffFiberRefs:()=>lut,disconnect:()=>$lt,dropUntil:()=>eq,dropWhile:()=>tq,either:()=>yS,ensureErrorType:()=>vft,ensureRequirementsType:()=>Tft,ensureSuccessType:()=>_ft,ensuring:()=>qa,ensuringChild:()=>uut,ensuringChildren:()=>put,eventually:()=>Flt,every:()=>mlt,exists:()=>hlt,exit:()=>ns,fail:()=>ie,failCause:()=>On,failCauseSync:()=>vQ,failSync:()=>PA,fiberId:()=>fut,fiberIdWith:()=>DA,filter:()=>rq,filterEffectOrElse:()=>Yut,filterEffectOrFail:()=>Zut,filterMap:()=>glt,filterOrDie:()=>Qut,filterOrDieMessage:()=>qQ,filterOrElse:()=>BQ,filterOrFail:()=>WQ,finalizersMask:()=>rut,findFirst:()=>_Q,firstSuccessOf:()=>Rpt,flatMap:()=>L,flatten:()=>aa,flip:()=>Jlt,flipWith:()=>Qlt,fn:()=>YQ,fnUntraced:()=>Wn,forEach:()=>en,forever:()=>NA,fork:()=>DQ,forkAll:()=>dut,forkDaemon:()=>vp,forkIn:()=>hn,forkScoped:()=>Ri,forkWithErrorHandler:()=>mut,fromFiber:()=>hut,fromFiberEffect:()=>gut,fromNullable:()=>Cft,functionWithSpan:()=>Eft,gen:()=>$e,getFiberRefs:()=>hpt,getRuntimeFlags:()=>Npt,head:()=>xlt,if:()=>Jut,ignore:()=>HC,ignoreLogged:()=>Nlt,inheritFiberRefs:()=>gpt,interrupt:()=>ia,interruptWith:()=>jlt,interruptible:()=>an,interruptibleMask:()=>Vlt,intoDeferred:()=>WC,isEffect:()=>mn,isFailure:()=>Cpt,isSuccess:()=>wpt,iterate:()=>lpt,labelMetrics:()=>Bpt,labelMetricsScoped:()=>zpt,let:()=>Gut,liftPredicate:()=>Glt,linkSpanCurrent:()=>Sft,linkSpans:()=>yft,locally:()=>Au,locallyScoped:()=>xpt,locallyScopedWith:()=>ypt,locallyWith:()=>yIe,log:()=>zQ,logAnnotations:()=>_pt,logDebug:()=>$Q,logError:()=>zC,logFatal:()=>VQ,logInfo:()=>Apt,logTrace:()=>Ipt,logWarning:()=>jQ,logWithLevel:()=>kpt,loop:()=>upt,makeLatch:()=>bIe,makeSemaphore:()=>UA,makeSpan:()=>JQ,makeSpanScoped:()=>QQ,map:()=>W,mapAccum:()=>Ylt,mapBoth:()=>Gf,mapError:()=>br,mapErrorCause:()=>Zlt,mapInputContext:()=>FA,match:()=>Fs,matchCause:()=>Ig,matchCauseEffect:()=>os,matchEffect:()=>wr,merge:()=>MQ,mergeAll:()=>ylt,metricLabels:()=>$pt,negate:()=>PQ,never:()=>mS,none:()=>vlt,onError:()=>qC,onExit:()=>RR,onInterrupt:()=>vR,once:()=>ult,option:()=>Kut,optionFromOptional:()=>wft,orDie:()=>Pr,orDieWith:()=>Tpt,orElse:()=>Pm,orElseFail:()=>jC,orElseSucceed:()=>GQ,parallelErrors:()=>Llt,parallelFinalizers:()=>eut,partition:()=>Slt,patchFiberRefs:()=>Spt,patchRuntimeFlags:()=>Lpt,promise:()=>LC,provide:()=>Vo,provideService:()=>xi,provideServiceEffect:()=>ku,race:()=>NR,raceAll:()=>opt,raceFirst:()=>aq,raceWith:()=>SS,random:()=>Mpt,randomWith:()=>Ppt,reduce:()=>_R,reduceEffect:()=>Clt,reduceRight:()=>blt,reduceWhile:()=>Elt,repeat:()=>LA,repeatN:()=>UR,repeatOrElse:()=>ppt,replicate:()=>wlt,replicateEffect:()=>klt,request:()=>tft,retry:()=>Rm,retryOrElse:()=>Hlt,runCallback:()=>Vpt,runFork:()=>Al,runPromise:()=>Ag,runPromiseExit:()=>Gpt,runRequestBlock:()=>Xpt,runSync:()=>xr,runSyncExit:()=>Kpt,runtime:()=>Wc,sandbox:()=>RQ,schedule:()=>fpt,scheduleForked:()=>dpt,scheduleFrom:()=>mpt,scope:()=>Mm,scopeWith:()=>MR,scoped:()=>ei,scopedWith:()=>PR,sequentialFinalizers:()=>tut,serviceConstants:()=>qut,serviceFunction:()=>Uut,serviceFunctionEffect:()=>Hut,serviceFunctions:()=>HQ,serviceMembers:()=>But,serviceOption:()=>FR,serviceOptional:()=>Wut,setFiberRefs:()=>Ept,sleep:()=>Tut,spanAnnotations:()=>gft,spanLinks:()=>xft,step:()=>eft,succeed:()=>N,succeedNone:()=>hS,succeedSome:()=>Tlt,summarized:()=>spt,supervised:()=>xut,suspend:()=>Qe,sync:()=>Ce,tagMetrics:()=>qpt,tagMetricsScoped:()=>Wpt,takeUntil:()=>dlt,takeWhile:()=>hIe,tap:()=>sr,tapBoth:()=>ipt,tapDefect:()=>apt,tapError:()=>LR,tapErrorCause:()=>Iu,tapErrorTag:()=>cpt,timed:()=>Rut,timedWith:()=>Mut,timeout:()=>DR,timeoutFail:()=>NQ,timeoutFailCause:()=>LQ,timeoutOption:()=>Put,timeoutTo:()=>Dut,tracer:()=>ift,tracerWith:()=>aft,transplant:()=>yut,transposeMapOption:()=>Ift,transposeOption:()=>kft,try:()=>Ps,tryMap:()=>jf,tryMapPromise:()=>qlt,tryPromise:()=>Ds,uninterruptible:()=>Vf,uninterruptibleMask:()=>wu,unless:()=>Xut,unlessEffect:()=>iq,unsafeMakeLatch:()=>Kf,unsafeMakeSemaphore:()=>VC,unsandbox:()=>Blt,updateFiberRefs:()=>bpt,updateService:()=>xIe,useSpan:()=>HA,using:()=>nut,validate:()=>Jpt,validateAll:()=>Ilt,validateFirst:()=>Alt,validateWith:()=>Qpt,void:()=>me,when:()=>Tp,whenEffect:()=>ept,whenFiberRef:()=>tpt,whenLogLevel:()=>vpt,whenRef:()=>rpt,whileLoop:()=>kg,withClock:()=>Iut,withClockScoped:()=>kut,withConcurrency:()=>Sut,withConfigProvider:()=>Nut,withConfigProviderScoped:()=>Lut,withConsole:()=>vut,withConsoleScoped:()=>_ut,withEarlyRelease:()=>out,withExecutionPlan:()=>Ult,withFiberRuntime:()=>Zs,withLogSpan:()=>SIe,withMaxOpsBeforeYield:()=>Cut,withMetric:()=>jpt,withParentSpan:()=>GC,withRandom:()=>EIe,withRandomFixed:()=>Dpt,withRandomScoped:()=>Fpt,withRequestBatching:()=>nft,withRequestCache:()=>sft,withRequestCaching:()=>oft,withRuntimeFlagsPatch:()=>Upt,withRuntimeFlagsPatchScoped:()=>Hpt,withScheduler:()=>Eut,withSchedulingPriority:()=>but,withSpan:()=>cq,withSpanScoped:()=>bft,withTracer:()=>cft,withTracerEnabled:()=>uft,withTracerScoped:()=>lft,withTracerTiming:()=>pft,withUnhandledErrorLogLevel:()=>HR,yieldNow:()=>Rlt,zip:()=>Ns,zipLeft:()=>Ba,zipRight:()=>ve,zipWith:()=>ca});var _m={};Ht(_m,{Class:()=>uR,Error:()=>AA,Structural:()=>Cat,TaggedClass:()=>bat,TaggedError:()=>fR,array:()=>j5,case:()=>Eat,struct:()=>lR,tagged:()=>uS,taggedEnum:()=>pR,tuple:()=>Sat,unsafeArray:()=>V5,unsafeStruct:()=>yat});var lR=SI,yat=(e)=>Object.setPrototypeOf(e,qd),Sat=(...e)=>V5(e),j5=(e)=>V5(e.slice(0)),V5=(e)=>Object.setPrototypeOf(e,Ofe),Eat=()=>(e)=>e===void 0?Object.create(qd):lR(e);var uS=(e)=>(t)=>{let r=t===void 0?Object.create(qd):lR(t);return r._tag=e,r},uR=Qh,bat=(e)=>{class t extends uR{_tag=e}return t},Cat=Qh,pR=()=>new Proxy({},{get(e,t,r){if(t==="$is")return Zu;else if(t==="$match")return wat;return uS(t)}});function wat(){if(arguments.length===1){let r=arguments[0];return function(n){return r[n._tag](n)}}let e=arguments[0];return arguments[1][e._tag](e)}var AA=function(){let e=Symbol.for("effect/Data/Error/plainArgs");return{BaseEffectError:class extends NI{constructor(r){super(r?.message,r?.cause?{cause:r.cause}:void 0);if(r)Object.assign(this,r),Object.defineProperty(this,e,{value:r,enumerable:!1})}toJSON(){return{...this[e],...this}}}}.BaseEffectError}(),fR=(e)=>{let t={BaseEffectError:class extends AA{_tag=e}};return t.BaseEffectError.prototype.name=e,t.BaseEffectError};var hR=Symbol.for("effect/DateTime"),gR=Symbol.for("effect/DateTime/TimeZone"),gwe={[hR]:hR,pipe(){return ce(this,arguments)},[dt](){return this.toString()},toJSON(){return pS(this).toJSON()}},kat={...gwe,_tag:"Utc",[Ne](){return lt(this,vh(this.epochMillis))},[Pe](e){return RC(e)&&e._tag==="Utc"&&this.epochMillis===e.epochMillis},toString(){return`DateTime.Utc(${pS(this).toJSON()})`}},Iat={...gwe,_tag:"Zoned",[Ne](){return d(vh(this.epochMillis),Ee(oe(this.zone)),lt(this))},[Pe](e){return RC(e)&&e._tag==="Zoned"&&this.epochMillis===e.epochMillis&&ge(this.zone,e.zone)},toString(){return`DateTime.Zoned(${sQ(this)})`}},xwe={[gR]:gR,[dt](){return this.toString()}},Aat={...xwe,_tag:"Named",[Ne](){return lt(this,It(`Named:${this.id}`))},[Pe](e){return MC(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},Oat={...xwe,_tag:"Offset",[Ne](){return lt(this,It(`Offset:${this.offset}`))},[Pe](e){return MC(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${NH(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},Ap=(e,t,r)=>{let n=Object.create(Iat);return n.epochMillis=e,n.zone=t,Object.defineProperty(n,"partsUtc",{value:r,enumerable:!1,writable:!0}),Object.defineProperty(n,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(n,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),n},RC=(e)=>de(e,hR),zf=(e)=>RC(e[0]),MC=(e)=>de(e,gR),ywe=(e)=>MC(e)&&e._tag==="Offset",Swe=(e)=>MC(e)&&e._tag==="Named",Ewe=(e)=>e._tag==="Utc",G5=(e)=>e._tag==="Zoned",bwe=No((e,t)=>e.epochMillis===t.epochMillis),vm=nc((e,t)=>e.epochMillis<t.epochMillis?-1:e.epochMillis>t.epochMillis?1:0),Cwe=$d(vm),PC=(e)=>{let t=Object.create(kat);return t.epochMillis=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},OA=(e)=>{let t=e.getTime();if(Number.isNaN(t))throw new Xy("Invalid date");return PC(t)},_H=(e)=>{if(RC(e))return e;else if(e instanceof Date)return OA(e);else if(typeof e==="object"){let t=new Date(0);return X5(t,e),OA(t)}else if(typeof e==="string"&&!_at(e))return OA(new Date(e+"Z"));return OA(new Date(e))},_at=(e)=>/Z|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),vat=-8639999956800000,Tat=8639999949600000,K5=(e,t)=>{if(t?.timeZone===void 0&&RC(e)&&G5(e))return e;let r=_H(e);if(r.epochMillis<vat||r.epochMillis>Tat)throw RangeError(`Epoch millis out of range: ${r.epochMillis}`);let n;if(t?.timeZone===void 0){let o=new Date(r.epochMillis).getTimezoneOffset()*-60*1000;n=TC(o)}else if(MC(t?.timeZone))n=t.timeZone;else if(typeof t?.timeZone==="number")n=TC(t.timeZone);else{let o=Q5(t.timeZone);if(vt(o))throw new Xy(`Invalid time zone: ${t.timeZone}`);n=o.value}if(t?.adjustForTimeZone!==!0)return Ap(r.epochMillis,n,r.partsUtc);return eQ(r.epochMillis,n,t?.disambiguation??"compatible")},AH=Uh(K5),wwe=Uh(_H),Rat=/^(.{17,35})\[(.+)\]$/,kwe=(e)=>{let t=Rat.exec(e);if(t===null){let o=tQ(e);return o!==null?AH(e,{timeZone:o}):R()}let[,r,n]=t;return AH(r,{timeZone:n})},vH=xe(wl,PC),Iwe=xe(wl,(e)=>new Date(e)),TH=()=>PC(Date.now()),Awe=(e)=>PC(e.epochMillis),xR=p(zf,(e,t,r)=>r?.adjustForTimeZone===!0?eQ(e.epochMillis,t,r?.disambiguation??"compatible"):Ap(e.epochMillis,t,e.partsUtc)),Owe=p(zf,(e,t,r)=>xR(e,TC(t),r)),mR=je("effect/DateTime/validZoneCache",()=>new Map),_we={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},vwe=(e)=>{let t=e.resolvedOptions().timeZone;if(mR.has(t))return mR.get(t);let r=Object.create(Aat);return r.id=t,r.format=e,mR.set(t,r),r},yR=(e)=>{if(mR.has(e))return mR.get(e);try{return vwe(new Intl.DateTimeFormat("en-US",{..._we,timeZone:e}))}catch{throw new Xy(`Invalid time zone: ${e}`)}},TC=(e)=>{let t=Object.create(Oat);return t.offset=e,t},RH=Uh(yR),J5=(e)=>E0({try:()=>yR(e),catch:(t)=>t}),Twe=()=>vwe(new Intl.DateTimeFormat("en-US",_we)),Mat=/^(?:GMT|[+-])/,Q5=(e)=>{if(Mat.test(e)){let t=tQ(e);return t===null?R():_(TC(t))}return RH(e)},Rwe=(e)=>{if(e._tag==="Offset")return NH(e.offset);return e.id},Mwe=p(zf,(e,t,r)=>jt(RH(t),(n)=>xR(e,n,r))),Pwe=p(zf,(e,t,r)=>xR(e,yR(t),r)),MH=p(2,(e,t)=>_A(t)-_A(e)),Dwe=p(2,(e,t)=>{let r=MH(e,t);return r>0?ye(Bo(r)):Ie(Bo(-r))}),Fwe=p(2,(e,t)=>Bo(Math.abs(MH(e,t)))),Nwe=Wd(vm),Lwe=zd(vm),PH=Fh(vm),Uwe=Nh(vm),DH=Dh(vm),Hwe=cy(vm),qwe=ly(vm),Bwe=(e)=>xe(vH,DH(e)),Wwe=(e)=>DH(TH(),e),zwe=(e)=>xe(vH,PH(e)),$we=(e)=>PH(TH(),e),pS=(e)=>new Date(e.epochMillis),bg=(e)=>{if(e._tag==="Utc")return new Date(e.epochMillis);else if(e.zone._tag==="Offset")return new Date(e.epochMillis+e.zone.offset);else if(e.adjustedEpochMillis!==void 0)return new Date(e.adjustedEpochMillis);let t=e.zone.format.formatToParts(e.epochMillis).filter((n)=>n.type!=="literal"),r=new Date(0);return r.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),r.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMillis=r.getTime(),r},FH=(e)=>bg(e).getTime()-_A(e),NH=(e)=>{let t=Math.abs(e),r=Math.floor(t/3600000),n=Math.round(t%3600000/60000);if(n===60)r+=1,n=0;return`${e<0?"-":"+"}${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`},Y5=(e)=>NH(FH(e)),_A=(e)=>e.epochMillis,jwe=(e)=>UH(e,(t)=>(t.setUTCHours(0,0,0,0),PC(t.getTime()))),Vwe=(e)=>({millis:e.getUTCMilliseconds(),seconds:e.getUTCSeconds(),minutes:e.getUTCMinutes(),hours:e.getUTCHours(),day:e.getUTCDate(),weekDay:e.getUTCDay(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}),Z5=(e)=>{if(e._tag==="Utc")return LH(e);else if(e.partsAdjusted!==void 0)return e.partsAdjusted;return e.partsAdjusted=UH(e,Vwe),e.partsAdjusted},LH=(e)=>{if(e.partsUtc!==void 0)return e.partsUtc;return e.partsUtc=nQ(e,Vwe),e.partsUtc},Gwe=p(2,(e,t)=>LH(e)[t]),Kwe=p(2,(e,t)=>Z5(e)[t]),X5=(e,t)=>{if(t.year!==void 0)e.setUTCFullYear(t.year);if(t.month!==void 0)e.setUTCMonth(t.month-1);if(t.day!==void 0)e.setUTCDate(t.day);if(t.weekDay!==void 0){let r=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+r)}if(t.hours!==void 0)e.setUTCHours(t.hours);if(t.minutes!==void 0)e.setUTCMinutes(t.minutes);if(t.seconds!==void 0)e.setUTCSeconds(t.seconds);if(t.millis!==void 0)e.setUTCMilliseconds(t.millis)},Jwe=p(2,(e,t)=>DC(e,(r)=>X5(r,t))),Qwe=p(2,(e,t)=>rQ(e,(r)=>X5(r,t))),hwe=86400000,eQ=(e,t,r)=>{if(t._tag==="Offset")return Ap(e-t.offset,t);let n=dR(e-hwe,e,t),o=dR(e+hwe,e,t);if(n===o)return Ap(e-n,t);let s=n<o,i=n-o;if(s){if(dR(e-o,e,t)===o)return Ap(e-o,t);let l=Ap(e-n,t),u=bg(l).getTime();if(e!==u)switch(r){case"reject":{let f=new Date(e).toISOString();throw RangeError(`Gap time: ${f} does not exist in time zone ${t.id}`)}case"earlier":return Ap(e-o,t);case"compatible":case"later":return l}return l}if(dR(e-n,e,t)===n){if(r==="earlier"||r==="compatible")return Ap(e-n,t);if(dR(e-n+i,e+i,t)===n)return Ap(e-n,t);if(r==="reject"){let l=new Date(e).toISOString();throw RangeError(`Ambiguous time: ${l} occurs twice in time zone ${t.id}`)}}return Ap(e-o,t)},Pat=/([+-])(\d{2}):(\d{2})$/,tQ=(e)=>{let t=Pat.exec(e);if(t===null)return null;let[,r,n,o]=t;return(r==="+"?1:-1)*(Number(n)*60+Number(o))*60*1000},dR=(e,t,r)=>{let n=r.format.formatToParts(e).find((s)=>s.type==="timeZoneName")?.value??"";if(n==="GMT")return 0;let o=tQ(n);if(o===null)return FH(Ap(t,r));return o},DC=p(zf,(e,t,r)=>{if(e._tag==="Utc"){let s=pS(e);return t(s),PC(s.getTime())}let n=bg(e),o=new Date(n.getTime());return t(o),eQ(o.getTime(),e.zone,r?.disambiguation??"compatible")}),rQ=p(2,(e,t)=>SR(e,(r)=>{let n=new Date(r);return t(n),n.getTime()})),SR=p(2,(e,t)=>{let r=t(_A(e));return e._tag==="Utc"?PC(r):Ap(r,e.zone)}),UH=p(2,(e,t)=>t(bg(e))),nQ=p(2,(e,t)=>t(pS(e))),Ywe=p(2,(e,t)=>e._tag==="Utc"?t.onUtc(e):t.onZoned(e)),Zwe=p(2,(e,t)=>SR(e,(r)=>r+ds(t))),Xwe=p(2,(e,t)=>SR(e,(r)=>r-ds(t))),IH=(e,t)=>{e.setTime(e.getTime()+t)},oQ=p(2,(e,t)=>DC(e,(r)=>{if(t.millis)IH(r,t.millis);if(t.seconds)IH(r,t.seconds*1000);if(t.minutes)IH(r,t.minutes*60*1000);if(t.hours)IH(r,t.hours*60*60*1000);if(t.days)r.setUTCDate(r.getUTCDate()+t.days);if(t.weeks)r.setUTCDate(r.getUTCDate()+t.weeks*7);if(t.months){let n=r.getUTCDate();if(r.setUTCMonth(r.getUTCMonth()+t.months+1,0),n<r.getUTCDate())r.setUTCDate(n)}if(t.years){let n=r.getUTCDate(),o=r.getUTCMonth();if(r.setUTCFullYear(r.getUTCFullYear()+t.years,o+1,0),n<r.getUTCDate())r.setUTCDate(n)}})),eke=p(2,(e,t)=>{let r={};for(let n in t)r[n]=-1*t[n];return oQ(e,r)}),tke=(e,t,r)=>{switch(t){case"second":{e.setUTCMilliseconds(0);break}case"minute":{e.setUTCSeconds(0,0);break}case"hour":{e.setUTCMinutes(0,0,0);break}case"day":{e.setUTCHours(0,0,0,0);break}case"week":{let n=r?.weekStartsOn??0,s=(e.getUTCDay()-n+7)%7;e.setUTCDate(e.getUTCDate()-s),e.setUTCHours(0,0,0,0);break}case"month":{e.setUTCDate(1),e.setUTCHours(0,0,0,0);break}case"year":{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);break}}},rke=p(zf,(e,t,r)=>DC(e,(n)=>tke(n,t,r))),nke=(e,t,r)=>{switch(t){case"second":{e.setUTCMilliseconds(999);break}case"minute":{e.setUTCSeconds(59,999);break}case"hour":{e.setUTCMinutes(59,59,999);break}case"day":{e.setUTCHours(23,59,59,999);break}case"week":{let n=r?.weekStartsOn??0,s=(e.getUTCDay()-n+7)%7;e.setUTCDate(e.getUTCDate()-s+6),e.setUTCHours(23,59,59,999);break}case"month":{e.setUTCMonth(e.getUTCMonth()+1,0),e.setUTCHours(23,59,59,999);break}case"year":{e.setUTCMonth(11,31),e.setUTCHours(23,59,59,999);break}}},oke=p(zf,(e,t,r)=>DC(e,(n)=>nke(n,t,r))),ske=p(zf,(e,t,r)=>DC(e,(n)=>{if(t==="milli")return;let o=n.getTime(),s=new Date(o);tke(s,t,r);let i=s.getTime(),a=new Date(o);nke(a,t,r);let c=a.getTime()+1,l=o-i,u=c-o;if(l<u)n.setTime(i);else n.setTime(c)})),Dat=(e)=>{if(e._tag==="Named")return e.id;return NH(e.offset)},ike=p(zf,(e,t)=>{try{return new Intl.DateTimeFormat(t?.locale,{timeZone:e._tag==="Utc"?"UTC":Dat(e.zone),...t}).format(e.epochMillis)}catch{return new Intl.DateTimeFormat(t?.locale,{timeZone:"UTC",...t}).format(bg(e))}}),ake=p(zf,(e,t)=>new Intl.DateTimeFormat(t?.locale,t).format(e.epochMillis)),cke=p(zf,(e,t)=>new Intl.DateTimeFormat(t?.locale,{...t,timeZone:"UTC"}).format(e.epochMillis)),lke=p(2,(e,t)=>t.format(e.epochMillis)),uke=(e)=>pS(e).toISOString(),pke=(e)=>bg(e).toISOString().slice(0,10),fke=(e)=>pS(e).toISOString().slice(0,10),OH=(e)=>{let t=bg(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${Y5(e)}`},sQ=(e)=>e.zone._tag==="Offset"?OH(e):`${OH(e)}[${e.zone.id}]`;var Sn={};Ht(Sn,{Equivalence:()=>Lat,Order:()=>Uat,at:()=>ect,camelToSnake:()=>wct,capitalize:()=>iQ,charAt:()=>tct,charCodeAt:()=>Zat,codePointAt:()=>rct,concat:()=>qat,empty:()=>Hat,endsWith:()=>Yat,includes:()=>Jat,indexOf:()=>nct,isEmpty:()=>Vat,isNonEmpty:()=>HH,isString:()=>Nat,kebabToSnake:()=>Ict,lastIndexOf:()=>oct,length:()=>Gat,linesIterator:()=>yct,linesWithSeparators:()=>xke,localeCompare:()=>sct,match:()=>ict,matchAll:()=>act,normalize:()=>cct,padEnd:()=>lct,padStart:()=>uct,pascalToSnake:()=>kct,repeat:()=>pct,replace:()=>Bat,replaceAll:()=>fct,search:()=>dct,slice:()=>jat,snakeToCamel:()=>Ect,snakeToKebab:()=>Cct,snakeToPascal:()=>bct,split:()=>Kat,startsWith:()=>Qat,stripMargin:()=>Sct,stripMarginWith:()=>yke,substring:()=>Xat,takeLeft:()=>gct,takeRight:()=>xct,toLocaleLowerCase:()=>mct,toLocaleUpperCase:()=>hct,toLowerCase:()=>mke,toUpperCase:()=>dke,trim:()=>Wat,trimEnd:()=>$at,trimStart:()=>zat,uncapitalize:()=>aQ});var Nat=Jr,Lat=Nle,Uat=lL,Hat="",qat=p(2,(e,t)=>e+t),dke=(e)=>e.toUpperCase(),mke=(e)=>e.toLowerCase(),iQ=(e)=>{if(e.length===0)return e;return dke(e[0])+e.slice(1)},aQ=(e)=>{if(e.length===0)return e;return mke(e[0])+e.slice(1)},Bat=(e,t)=>(r)=>r.replace(e,t),Wat=(e)=>e.trim(),zat=(e)=>e.trimStart(),$at=(e)=>e.trimEnd(),jat=(e,t)=>(r)=>r.slice(e,t),Vat=(e)=>e.length===0,HH=(e)=>e.length>0,Gat=(e)=>e.length,Kat=p(2,(e,t)=>{let r=e.split(t);return Yk(r)?r:[e]}),Jat=(e,t)=>(r)=>r.includes(e,t),Qat=(e,t)=>(r)=>r.startsWith(e,t),Yat=(e,t)=>(r)=>r.endsWith(e,t),Zat=p(2,(e,t)=>Vi(_(e.charCodeAt(t)),(r)=>!isNaN(r))),Xat=(e,t)=>(r)=>r.substring(e,t),ect=p(2,(e,t)=>Ft(e.at(t))),tct=p(2,(e,t)=>Vi(_(e.charAt(t)),HH)),rct=p(2,(e,t)=>Ft(e.codePointAt(t))),nct=(e)=>(t)=>Vi(_(t.indexOf(e)),f2(0)),oct=(e)=>(t)=>Vi(_(t.lastIndexOf(e)),f2(0)),sct=(e,t,r)=>(n)=>wme(n.localeCompare(e,t,r)),ict=(e)=>(t)=>Ft(t.match(e)),act=(e)=>(t)=>t.matchAll(e),cct=(e)=>(t)=>t.normalize(e),lct=(e,t)=>(r)=>r.padEnd(e,t),uct=(e,t)=>(r)=>r.padStart(e,t),pct=(e)=>(t)=>t.repeat(e),fct=(e,t)=>(r)=>r.replaceAll(e,t),dct=p(2,(e,t)=>Vi(_(e.search(t)),f2(0))),mct=(e)=>(t)=>t.toLocaleLowerCase(e),hct=(e)=>(t)=>t.toLocaleUpperCase(e),gct=p(2,(e,t)=>e.slice(0,Math.max(t,0))),xct=p(2,(e,t)=>e.slice(Math.max(0,e.length-Math.floor(t)),1/0)),hke=13,gke=10,yct=(e)=>Ske(e,!0),xke=(e)=>Ske(e,!1),yke=p(2,(e,t)=>{let r="";for(let n of xke(e)){let o=0;while(o<n.length&&n.charAt(o)<=" ")o=o+1;let s=o<n.length&&n.charAt(o)===t?n.substring(o+1):n;r=r+s}return r}),Sct=(e)=>yke(e,"|"),Ect=(e)=>{let t=e[0];for(let r=1;r<e.length;r++)t+=e[r]==="_"?e[++r].toUpperCase():e[r];return t},bct=(e)=>{let t=e[0].toUpperCase();for(let r=1;r<e.length;r++)t+=e[r]==="_"?e[++r].toUpperCase():e[r];return t},Cct=(e)=>e.replace(/_/g,"-"),wct=(e)=>e.replace(/([A-Z])/g,"_$1").toLowerCase(),kct=(e)=>(e.slice(0,1)+e.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),Ict=(e)=>e.replace(/-/g,"_");class cQ{s;stripped;index;length;constructor(e,t=!1){this.s=e,this.stripped=t,this.index=0,this.length=e.length}next(){if(this.done)return{done:!0,value:void 0};let e=this.index;while(!this.done&&!Act(this.s[this.index]))this.index=this.index+1;let t=this.index;if(!this.done){let r=this.s[this.index];if(this.index=this.index+1,!this.done&&Oct(r,this.s[this.index]))this.index=this.index+1;if(!this.stripped)t=this.index}return{done:!1,value:this.s.substring(e,t)}}[Symbol.iterator](){return new cQ(this.s,this.stripped)}get done(){return this.index>=this.length}}var Act=(e)=>{let t=e.charCodeAt(0);return t===hke||t===gke},Oct=(e,t)=>e.charCodeAt(0)===hke&&t.charCodeAt(0)===gke,Ske=(e,t)=>new cQ(e,t);var ER={};Ht(ER,{Random:()=>Lct,RandomTypeId:()=>_ct,choice:()=>Fct,fixed:()=>lQ,make:()=>Uct,next:()=>vct,nextBoolean:()=>Rct,nextInt:()=>Tct,nextIntBetween:()=>Pct,nextRange:()=>Mct,randomWith:()=>Nct,shuffle:()=>Dct});var _ct=BI,vct=Yme,Tct=Zme,Rct=Xme,Mct=ehe,Pct=the,Dct=rhe,Fct=nhe,Nct=fu,Lct=gm,Uct=A2,lQ=Ume;var Hct="effect/Schedule",WH=Symbol.for(Hct),fQ=(e)=>de(e,WH),qct="effect/ScheduleDriver",Cke=Symbol.for(qct),uQ={start:0,now:0,input:void 0,output:void 0,elapsed:hl,elapsedSincePrevious:hl,recurrence:0},FC=ko()("effect/Schedule/CurrentIterationMetadata",{defaultValue:()=>uQ}),Bct={_Out:(e)=>e,_In:(e)=>e,_R:(e)=>e},Wct={_Out:(e)=>e,_In:(e)=>e,_R:(e)=>e};class wke{initial;step;[WH]=Bct;constructor(e,t){this.initial=e,this.step=t}pipe(){return ce(this,arguments)}}var Eke=(e,t,r,n)=>Vy(e,(o)=>o.recurrence===0?{now:t,input:r,output:n,recurrence:o.recurrence+1,elapsed:hl,elapsedSincePrevious:hl,start:t}:{now:t,input:r,output:n,recurrence:o.recurrence+1,elapsed:Bo(t-o.start),elapsedSincePrevious:Bo(t-o.now),start:o.start});class kke{schedule;ref;[Cke]=Wct;constructor(e,t){this.schedule=e,this.ref=t}get state(){return xe(vi(this.ref),(e)=>e[1])}get last(){return V(vi(this.ref),([e,t])=>{switch(e._tag){case"None":return fp(()=>new Ma);case"Some":return X(e.value)}})}iterationMeta=KI(uQ);get reset(){return xp(this.ref,[R(),this.schedule.initial]).pipe(Yb(xp(this.iterationMeta,uQ)))}next(e){return d(xe(vi(this.ref),(t)=>t[1]),V((t)=>d(wl,V((r)=>d(Re(()=>this.schedule.step(r,e,t)),V(([n,o,s])=>{let i=xp(this.ref,[_(o),n]);if(eS(s))return i.pipe(Qt(Gt(R())));let a=gA(s.intervals)-r;if(a<=0)return i.pipe(Qt(Eke(this.iterationMeta,r,e,o)),Kr(o));let c=Bo(a);return d(i,Qt(Eke(this.iterationMeta,r,e,o)),Qt(bm(c)),Kr(o))}))))))}}var NC=(e,t)=>new wke(e,t),Ike=p(2,(e,t)=>Ake(e,(r)=>ue(()=>t(r)))),Ake=p(2,(e,t)=>Rke(e,(r,n)=>xe(t(r),(o)=>eJ(n,ur(o)))));var Oke=(e)=>mQ(e,wo);var _ke=p(2,(e,t)=>zH(e,(r,n)=>ue(()=>t(r,n)))),zH=p(2,(e,t)=>NC(e.initial,(r,n,o)=>V(e.step(r,n,o),([s,i,a])=>{if(eS(a))return X([s,i,xA]);return xe(t(n,i),(c)=>c?[s,i,a]:[s,i,xA])})));var CR=(e)=>d(hC([R(),e.initial]),xe((t)=>new kke(e,t)));var dQ=p(2,(e,t)=>vke(e,t,obe)),vke=p(3,(e,t,r)=>NC([e.initial,t.initial],(n,o,s)=>d(pm(e.step(n,o,s[0]),t.step(n,o,s[1]),(i,a)=>[i,a]),V(([[i,a,c],[l,u,f]])=>{if(x5(c)&&x5(f))return pQ(e,t,o,i,a,c.intervals,l,u,f.intervals,r);return X([[i,l],[a,u],xA])})))),pQ=(e,t,r,n,o,s,i,a,c,l)=>{let u=l(s,c);if(ibe(u))return X([[n,i],[o,a],dbe(u)]);if(d(s,sbe(c)))return V(e.step(nH(s),r,n),([f,h,y])=>{if(eS(y))return X([[f,i],[h,a],xA]);return pQ(e,t,r,f,h,y.intervals,i,a,c,l)});return V(t.step(nH(c),r,i),([f,h,y])=>{if(eS(y))return X([[n,f],[o,h],xA]);return pQ(e,t,r,n,o,s,f,h,y.intervals,l)})};var mQ=p(2,(e,t)=>Tke(e,(r)=>ue(()=>t(r)))),Tke=p(2,(e,t)=>NC(e.initial,(r,n,o)=>V(e.step(r,n,o),([s,i,a])=>xe(t(i),(c)=>[s,c,a]))));var Rke=p(2,(e,t)=>NC(e.initial,(r,n,o)=>V(e.step(r,n,o),([s,i,a])=>{if(eS(a))return X([s,i,a]);let c=a.intervals,l=QEe(tH(r,gA(c)));return xe(t(i,l),(u)=>{let f=ur(u),h=gA(c),y=r+ds(f),E=y-h,b=Math.max(0,nH(c)+E),w=tH(y,b);return[s,i,g5(w)]})})));var hQ=(e)=>NC(e.initial,(t,r,n)=>d(e.step(t,r,n),xe(([o,s,i])=>[o,r,i])));var $H=(e)=>Dke(vA,(t)=>t<e);var Mke=(e)=>Ike(vA,()=>e);var Pke=(e,t)=>NC(e,(r,n,o)=>ue(()=>[t(o),o,g5(YEe(r))]));var gQ=p(2,(e,t)=>zH(e,(r,n)=>gU(t(r))));var xQ=p(2,(e,t)=>zH(e,(r,n)=>t(r))),Dke=p(2,(e,t)=>_ke(e,(r,n)=>t(n)));var qH=Symbol.for("effect/Schedule/ScheduleDefect");class Fke{error;[qH];constructor(e){this.error=e,this[qH]=qH}}var zct=(e)=>de(e,qH),BH=(e)=>lu(e,(t)=>cc(new Fke(t))),yQ=(e)=>be(sm(e,(t)=>Wb(t)&&zct(t.defect)?_(t.defect):R()),{onNone:()=>e,onSome:(t)=>xl(t.error)}),wR=(e)=>cm(e,(t)=>dr(yQ(t))),bke=p(2,(e,t)=>SQ(e,t,(r,n)=>Gt(r))),Nke=p(2,(e,t)=>{if(fQ(t))return bke(e,t);let r=t.schedule??hQ(vA),n=t.while?xQ(r,(i)=>{let a=t.while(i);if(typeof a==="boolean")return X(a);return BH(a)}):r,o=t.until?gQ(n,(i)=>{let a=t.until(i);if(typeof a==="boolean")return X(a);return BH(a)}):n,s=t.times?dQ(o,$H(t.times)).pipe(mQ((i)=>i[0])):o;return wR(bke(e,s))}),SQ=p(3,(e,t,r)=>V(CR(t),(n)=>di(e,{onFailure:(o)=>r(o,R()),onSuccess:(o)=>Lke(Ky(e,FC,vi(n.iterationMeta)),n,(s,i)=>Ky(r(s,i),FC,vi(n.iterationMeta)),o)}))),Lke=(e,t,r,n)=>di(t.next(n),{onFailure:()=>Jb(t.last),onSuccess:(o)=>di(e,{onFailure:(s)=>r(s,_(o)),onSuccess:(s)=>Lke(e,t,r,s)})}),bR=p(2,(e,t)=>EQ(e,t,(r,n)=>Gt(r))),Uke=p(2,(e,t)=>{if(fQ(t))return bR(e,t);return wR(bR(e,jH(t)))}),jH=(e)=>{let t=e.schedule??vA,r=e.while?xQ(t,(o)=>{let s=e.while(o);if(typeof s==="boolean")return X(s);return BH(s)}):t,n=e.until?gQ(r,(o)=>{let s=e.until(o);if(typeof s==="boolean")return X(s);return BH(s)}):r;return e.times!==void 0?dQ(n,$H(e.times)):n},EQ=p(3,(e,t,r)=>V(CR(t),(n)=>Hke(Ky(e,FC,vi(n.iterationMeta)),n,(o,s)=>Ky(r(o,s),FC,vi(n.iterationMeta))))),Hke=(e,t,r)=>lu(e,(n)=>di(t.next(n),{onFailure:()=>d(t.last,Jb,V((o)=>r(n,o))),onSuccess:()=>Hke(e,t,r)})),bQ=p(2,(e,t)=>CQ(e,void 0,t)),CQ=p(3,(e,t,r)=>V(CR(r),(n)=>qke(Ky(e,FC,vi(n.iterationMeta)),t,n))),qke=(e,t,r)=>di(r.next(t),{onFailure:()=>Jb(r.last),onSuccess:()=>V(e,(n)=>qke(e,n,r))});var vA=Pke(0,(e)=>e+1),wQ=Oke($H(1));var Bke=p(2,(e,t)=>sH(bQ(e,t)));var Wke=p(2,(e,t)=>Re(()=>{let r=0,n;return V(Ny({while:()=>r<t.steps.length&&(n===void 0||Sr(n)),body:()=>{let o=t.steps[r],s=wH(e,o.provide);if(n){let i=!1,a=s;s=Re(()=>{if(i)return a;return i=!0,n}),s=wR(bR(s,kR(o,!1)))}else{let i=kR(o,!0);s=i?wR(bR(s,i)):s}return pp(s)},step:(o)=>{n=o,r++}}),()=>n)})),kR=(e,t)=>{if(!t)return jH({schedule:e.schedule?e.schedule:e.attempts?void 0:wQ,times:e.attempts,while:e.while});else if(e.attempts===1||!(e.schedule||e.attempts))return;return jH({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0})};var fS=W1,_r=Ys;var Wt=Mn;var GH=l2;var $ke=n0,KH=dme;var bu=UI;var IR=mme;var dS=hme,jke=gme,mo=sg;var kQ=Df,Cu=hm;var Vke=Symbol.for("effect/MutableList"),$ct={[Vke]:Vke,[Symbol.iterator](){let e=!1,t=this.head;return{next(){if(e)return this.return();if(t==null)return e=!0,this.return();let r=t.value;return t=t.next,{done:e,value:r}},return(r){if(!e)e=!0;return{done:!0,value:r}}}},toString(){return Ut(this.toJSON())},toJSON(){return{_id:"MutableList",values:Array.from(this).map(fr)}},[dt](){return this.toJSON()},pipe(){return ce(this,arguments)}},jct=(e)=>({value:e,removed:!1,prev:void 0,next:void 0}),Gke=()=>{let e=Object.create($ct);return e.head=void 0,e.tail=void 0,e._length=0,e};var IQ=(e)=>JH(e)===0,JH=(e)=>e._length;var Kke=p(2,(e,t)=>{let r=jct(t);if(e.head===void 0)e.head=r;if(e.tail===void 0)e.tail=r;else e.tail.next=r,r.prev=e.tail,e.tail=r;return e._length+=1,e}),Jke=(e)=>{let t=e.head;if(t!==void 0)return Vct(e,t),t.value;return};var Vct=(e,t)=>{if(t.removed)return;if(t.removed=!0,t.prev!==void 0&&t.next!==void 0)t.prev.next=t.next,t.next.prev=t.prev;else if(t.prev!==void 0)e.tail=t.prev,t.prev.next=void 0;else if(t.next!==void 0)e.head=t.next,t.next.prev=void 0;else e.tail=void 0,e.head=void 0;if(e._length>0)e._length-=1};var Qke=Symbol.for("effect/MutableQueue"),Bn=Symbol.for("effect/mutable/MutableQueue/Empty"),Kct={[Qke]:Qke,[Symbol.iterator](){return Array.from(this.queue)[Symbol.iterator]()},toString(){return Ut(this.toJSON())},toJSON(){return{_id:"MutableQueue",values:Array.from(this).map(fr)}},[dt](){return this.toJSON()},pipe(){return ce(this,arguments)}},Yke=(e)=>{let t=Object.create(Kct);return t.queue=Gke(),t.capacity=e,t},QH=(e)=>Yke(e),Cg=()=>Yke(void 0),YH=(e)=>JH(e.queue),wg=(e)=>IQ(e.queue);var Zke=(e)=>e.capacity===void 0?1/0:e.capacity,_p=p(2,(e,t)=>{let r=JH(e.queue);if(e.capacity!==void 0&&r===e.capacity)return!1;return Kke(t)(e.queue),!0}),AR=p(2,(e,t)=>{let r=t[Symbol.iterator](),n,o=Ze(),s=!0;while(s&&(n=r.next())&&!n.done)s=_p(n.value)(e);while(n!=null&&!n.done)o=wn(n.value)(o),n=r.next();return ml(o)}),Il=p(2,(e,t)=>{if(IQ(e.queue))return t;return Jke(e.queue)}),TA=p(2,(e,t)=>{let r=Ze(),n=0;while(n<t){let o=Il(Bn)(e);if(o===Bn)break;r=wn(o)(r),n+=1}return ml(r)});var Xke=(e,t,r,n)=>SI({_tag:"Complete",key:e,exit:t,entryStats:r,timeToLiveMillis:n}),eIe=(e,t)=>SI({_tag:"Pending",key:e,deferred:t}),Jct=(e,t)=>SI({_tag:"Refreshing",deferred:e,complete:t}),OQ=Symbol.for("effect/Cache/MapKey");class tIe{current;[OQ]=OQ;previous=void 0;next=void 0;constructor(e){this.current=e}[Ne](){return d(oe(this.current),Ee(oe(this.previous)),Ee(oe(this.next)),lt(this))}[Pe](e){if(this===e)return!0;return Qct(e)&&ge(this.current,e.current)&&ge(this.previous,e.previous)&&ge(this.next,e.next)}}var RA=(e)=>new tIe(e),Qct=(e)=>de(e,OQ);class rIe{head=void 0;tail=void 0;add(e){if(e!==this.tail)if(this.tail===void 0)this.head=e,this.tail=e;else{let{previous:t,next:r}=e;if(r!==void 0)if(e.next=void 0,t!==void 0)t.next=r,r.previous=t;else this.head=r,this.head.previous=void 0;this.tail.next=e,e.previous=this.tail,this.tail=e}}remove(){let e=this.head;if(e!==void 0){let t=e.next;if(t!==void 0)e.next=void 0,this.head=t,this.head.previous=void 0;else this.head=void 0,this.tail=void 0}return e}}var Yct=()=>new rIe,Zct=(e,t,r,n,o,s)=>({map:e,keys:t,accesses:r,updating:n,hits:o,misses:s}),Xct=()=>Zct(mg(),Yct(),Cg(),Qi(!1),0,0),elt="effect/Cache",tlt=Symbol.for(elt),rlt={_Key:(e)=>e,_Error:(e)=>e,_Value:(e)=>e},nlt="effect/ConsumerCache",olt=Symbol.for(nlt),slt={_Key:(e)=>e,_Error:(e)=>e,_Value:(e)=>e},ilt=(e)=>e,ZH=(e)=>({loadedMillis:e});class nIe{capacity;context;fiberId;lookup;timeToLive;[tlt]=rlt;[olt]=slt;cacheState;constructor(e,t,r,n,o){this.capacity=e,this.context=t,this.fiberId=r,this.lookup=n,this.timeToLive=o,this.cacheState=Xct()}get(e){return xe(this.getEither(e),Cb)}get cacheStats(){return ue(()=>ilt({hits:this.cacheState.hits,misses:this.cacheState.misses,size:sA(this.cacheState.map)}))}getOption(e){return Re(()=>be(hs(this.cacheState.map,e),{onNone:()=>{let t=RA(e);return this.trackAccess(t),this.trackMiss(),X(R())},onSome:(t)=>this.resolveMapValue(t)}))}getOptionComplete(e){return Re(()=>be(hs(this.cacheState.map,e),{onNone:()=>{let t=RA(e);return this.trackAccess(t),this.trackMiss(),X(R())},onSome:(t)=>this.resolveMapValue(t,!0)}))}contains(e){return ue(()=>xu(this.cacheState.map,e))}entryStats(e){return ue(()=>{let t=hs(this.cacheState.map,e);if(Oe(t))switch(t.value._tag){case"Complete":{let r=t.value.entryStats.loadedMillis;return _(ZH(r))}case"Pending":return R();case"Refreshing":{let r=t.value.complete.entryStats.loadedMillis;return _(ZH(r))}}return R()})}getEither(e){return Re(()=>{let t=e,r=void 0,n=void 0,o=Ar(hs(this.cacheState.map,t));if(o===void 0)if(n=kQ(this.fiberId),r=RA(t),xu(this.cacheState.map,t))o=Ar(hs(this.cacheState.map,t));else pc(this.cacheState.map,t,eIe(r,n));if(o===void 0)return this.trackAccess(r),this.trackMiss(),xe(this.lookupValueOf(e,n),ye);else return V(this.resolveMapValue(o),be({onNone:()=>this.getEither(e),onSome:(s)=>X(Ie(s))}))})}invalidate(e){return ue(()=>{wm(this.cacheState.map,e)})}invalidateWhen(e,t){return ue(()=>{let r=hs(this.cacheState.map,e);if(Oe(r)&&r.value._tag==="Complete"){if(r.value.exit._tag==="Success"){if(t(r.value.exit.value))wm(this.cacheState.map,e)}}})}get invalidateAll(){return ue(()=>{this.cacheState.map=mg()})}refresh(e){return yp((t)=>Re(()=>{let r=e,n=kQ(this.fiberId),o=Ar(hs(this.cacheState.map,r));if(o===void 0)if(xu(this.cacheState.map,r))o=Ar(hs(this.cacheState.map,r));else pc(this.cacheState.map,r,eIe(RA(r),n));if(o===void 0)return In(this.lookupValueOf(e,n));else switch(o._tag){case"Complete":{if(this.hasExpired(t,o.timeToLiveMillis)){let s=Ar(hs(this.cacheState.map,r));if(ge(s,o))wm(this.cacheState.map,r);return In(this.get(e))}return d(this.lookupValueOf(e,n),yU(()=>{let s=Ar(hs(this.cacheState.map,r));if(ge(s,o)){let i=Jct(n,o);return pc(this.cacheState.map,r,i),!0}return!1}),In)}case"Pending":return Wt(o.deferred);case"Refreshing":return Wt(o.deferred)}}))}set(e,t){return yp((r)=>ue(()=>{let n=r.unsafeCurrentTimeMillis(),o=e,s=Nt(t),i=Xke(RA(o),s,ZH(n),n+ds(ur(this.timeToLive(s))));pc(this.cacheState.map,o,i)}))}get size(){return ue(()=>sA(this.cacheState.map))}get values(){return ue(()=>{let e=[];for(let t of this.cacheState.map)if(t[1]._tag==="Complete"&&t[1].exit._tag==="Success")e.push(t[1].exit.value);return e})}get entries(){return ue(()=>{let e=[];for(let t of this.cacheState.map)if(t[1]._tag==="Complete"&&t[1].exit._tag==="Success")e.push([t[0],t[1].exit.value]);return e})}get keys(){return ue(()=>{let e=[];for(let t of this.cacheState.map)if(t[1]._tag==="Complete"&&t[1].exit._tag==="Success")e.push(t[0]);return e})}resolveMapValue(e,t=!1){return yp((r)=>{switch(e._tag){case"Complete":{if(this.trackAccess(e.key),this.hasExpired(r,e.timeToLiveMillis))return wm(this.cacheState.map,e.key.current),X(R());return this.trackHit(),xe(e.exit,_)}case"Pending":{if(this.trackAccess(e.key),this.trackHit(),t)return X(R());return xe(Wt(e.deferred),_)}case"Refreshing":{if(this.trackAccess(e.complete.key),this.trackHit(),this.hasExpired(r,e.complete.timeToLiveMillis)){if(t)return X(R());return xe(Wt(e.deferred),_)}return xe(e.complete.exit,_)}}})}trackHit(){this.cacheState.hits=this.cacheState.hits+1}trackMiss(){this.cacheState.misses=this.cacheState.misses+1}trackAccess(e){if(_p(this.cacheState.accesses,e),f1(this.cacheState.updating,!1,!0)){let t=!0;while(t){let n=Il(this.cacheState.accesses,Bn);if(n===Bn)t=!1;else this.cacheState.keys.add(n)}let r=sA(this.cacheState.map);t=r>this.capacity;while(t){let n=this.cacheState.keys.remove();if(n!==void 0){if(xu(this.cacheState.map,n.current))wm(this.cacheState.map,n.current),r=r-1,t=r>this.capacity}else t=!1}Oi(this.cacheState.updating,!1)}}hasExpired(e,t){return e.unsafeCurrentTimeMillis()>t}lookupValueOf(e,t){return yp((r)=>Re(()=>{let n=e;return d(this.lookup(e),pu(this.context),fo,V((o)=>{let s=r.unsafeCurrentTimeMillis(),i=ZH(s),a=Xke(RA(n),o,i,s+ds(ur(this.timeToLive(o))));return pc(this.cacheState.map,n,a),Qt($ke(t,o),o)}),lc(()=>Qt(IR(t),ue(()=>{wm(this.cacheState.map,n)}))))}))}}var oIe=(e,t,r)=>new nIe(e,Tn(),Db,t,(n)=>ur(r(n)));var MA=je(Symbol.for("effect/FiberRef/currentCache"),()=>Io(oIe(65536,()=>xe(Ys(),(e)=>({listeners:new U0,handle:e})),()=>vb(60)))),OR=je(Symbol.for("effect/FiberRef/currentCacheEnabled"),()=>Io(!1)),sIe=(e,t)=>V(Hr(t)?t:X(t),(r)=>yl((n)=>{let o=new Proxy(e,{});return _i(OR,(s)=>{if(s){let a=_i(MA,(c)=>V(c.getEither(o),(l)=>{switch(l._tag){case"Left":{if(l.left.listeners.interrupted)return V(c.invalidateWhen(o,(u)=>u.handle===l.left.handle),()=>a);return l.left.listeners.increment(),Un((u)=>V(fo(tg(Kfe,u(Mn(l.left.handle)))),(f)=>(l.left.listeners.decrement(),f)))}case"Right":return l.right.listeners.increment(),Un((u)=>V(fo(tg(HJ(r,qJ({request:o,result:l.right.handle,listeners:l.right.listeners,ownerId:n,state:{completed:!1}})),u(Mn(l.right.handle)))),()=>(l.right.listeners.decrement(),Mn(l.right.handle))))}}));return a}let i=new U0;return i.increment(),V(Ys(),(a)=>La(tg(HJ(r,qJ({request:o,result:a,listeners:i,ownerId:n,state:{completed:!1}})),Mn(a)),ue(()=>i.decrement())))})})),iIe=(e,t)=>_i(OR,(r)=>{if(r)return _i(MA,(n)=>V(n.getEither(e),(o)=>{switch(o._tag){case"Left":return yt;case"Right":return l2(o.right.handle,t)}}));return yt}),aIe=p(2,(e,t)=>Xn(e,OR,t)),cIe=p(2,(e,t)=>Xn(e,MA,t));var uIe=kSe;var pIe=ISe;var XH=rg,mn=Hr,alt=bbe,clt=b5,Bc=hU,llt=Abe,ult=j6,Ha=Im,plt=xEe,flt=yEe,eq=Rge,tq=Mge,dlt=Axe,hIe=Oxe,mlt=zge,hlt=mEe,rq=gEe,glt=Dge,_Q=Hge,en=yu,xlt=jge,ylt=G8,Slt=K8,_R=gxe,Elt=yxe,blt=xxe,Clt=wEe,wlt=V8,klt=SEe,Ilt=bEe,Alt=_Ee,$o=ac,Olt=aCe,_lt=WT,Zs=Ot,ie=Gt,PA=fp,On=dr,vQ=ng,Ms=cc,$f=Ty,TQ=Ry,$e=Z1,mS=Ly,vlt=lxe,LC=mxe,N=X,hS=SC,Tlt=kxe,Qe=Re,Ce=ue,me=yt;var Rlt=um,Mlt=yge;var jo=lu,tn=cm,nq=Sge,oq=zT,Tm=Ide,UC=Ege,Plt=bge,mc=Cge,gS=wge,Dlt=kge,Flt=W6,HC=mU,Nlt=Vge,Llt=dxe,RQ=Cxe,Rm=Uke,Ult=Wke,Hlt=EQ,Ps=E0;var jf=Dxe,qlt=Fxe,Ds=J6,Blt=Uxe,Wlt=Oge,zlt=Ade,$lt=UEe,ia=Zn,jlt=jT,an=vf,Vlt=J1,vR=lc,Vf=Dc,wu=Un,Glt=Lge,qr=Kr,sq=YI,Klt=xge,Xs=In,Jlt=Py,Qlt=Wge,W=xe,Ylt=axe,Gf=VT,br=Dy,Zlt=XI,MQ=cxe,PQ=gU,vr=km,Xlt=fEe,xS=vI,TR=qf,qa=La,qC=Q1,RR=Pc,eut=jU,tut=VU,rut=kEe,Mm=QU,MR=bp,PR=$0,ei=KU,nut=AEe,out=REe,sut=Ebe,iut=dEe,aut=_ge,cut=pU,lut=ZI,uut=Cbe,put=oH,fut=dp,DA=yl,DQ=yg,vp=kC,dut=wbe,hn=oS,Ri=sH,mut=EEe,hut=kbe,gut=Ibe,xut=C5,yut=Y1,Sut=vde,Eut=ige,but=n6,Cut=Ude,FQ=Ige,wut=yp,kut=vEe,Iut=Gme,Aut=GCe,Out=Rs,_ut=KCe,vut=kH,gIe=Age,Tut=bm,Rut=Mxe,Mut=K6,DR=_be,Put=Tbe,NQ=w5,LQ=vbe,Dut=eR,Fut=h6,Nut=Kme,Lut=JU,Pn=bl,BC=Pge,UQ=hp,FA=ig,Vo=wH,xi=Gy,ku=Ky,Uut=$xe,Hut=zxe,HQ=Q6,qut=Y6,But=jxe,FR=Vxe,Wut=Z6,xIe=Hxe,zut=vge,$ut=b0,jut=Dbe,Vut=C0,Gut=Tge;var Kut=uxe,yS=pp,ns=fo,WC=lm,Jut=K1;var Qut=Fge,qQ=Nge,BQ=w0,WQ=Uge,Yut=l6,Zut=xme,Xut=Nxe,iq=Lxe,Tp=yU,ept=Tf,tpt=qxe,rpt=Bxe,L=V,npt=My,aa=Sl,NR=ZU,opt=CEe,aq=Obe,SS=e5,spt=I0,sr=rs,ipt=_xe,apt=vxe,LR=G6,cpt=Txe,Iu=Rxe,NA=fU,lpt=z6,upt=oxe,LA=Nke,UR=Exe,ppt=SQ,fpt=bQ,dpt=Bke,mpt=CQ,kg=Ny,hpt=dU,gpt=Gge,Au=Xn,yIe=mi,xpt=Na,ypt=hi,Spt=yC,Ept=wxe,bpt=xU,Cpt=Kge,wpt=Jge,Fs=k0,Ig=$T,os=po,wr=di,zQ=Qge,kpt=(e,...t)=>pg(e)(...t),Ipt=Yge,$Q=$6,Apt=Zge,jQ=Xge,zC=exe,VQ=txe,SIe=rxe,$C=gge,Opt=uEe,_pt=nxe,HR=Hde,vpt=pEe,Pr=Jb,Tpt=QJ,Pm=Kb,jC=pxe,GQ=fxe,Rpt=Bge,Mpt=hxe,Ppt=fu,EIe=Qme,Dpt=p(2,(e,t)=>EIe(e,lQ(t))),Fpt=TEe,Wc=wA,Npt=RI,Lpt=Fy,Upt=X1,Hpt=Y8,qpt=Ixe,Bpt=V6,Wpt=IEe,zpt=J8,$pt=qde,jpt=Wxe,VC=nS,UA=xbe,Kf=E5,bIe=Sbe,Al=rCe,Vpt=tCe,Ag=nCe,Gpt=oCe,xr=sCe,Kpt=iCe,Jpt=OEe,Qpt=Q8,Ns=MEe,Ba=PEe,ve=DEe,ca=Sg,Ypt=p(2,(e,t)=>ca(e,t,(r,n)=>r(n))),Zpt=tg,Xpt=j1,eft=G1,tft=p((e)=>uIe(e[0]),sIe),rft=iIe,nft=Tde,oft=aIe,sft=cIe,ift=Pxe,aft=_2,cft=ohe,lft=XU,uft=Rde,pft=Mde,fft=Jxe,KQ=Gxe,dft=X6,mft=e8,hft=Qxe,gft=eye,xft=tye,yft=Yxe,Sft=Kxe,JQ=Xxe,QQ=Ep,HA=lU,cq=t8,Eft=rye,bft=HEe,GC=uU,Cft=nye,wft=oye,kft=(e)=>Ef(e)?hS:W(e.value,ui),Ift=p(2,(e,t)=>Ef(e)?hS:W(t(e.value),ui)),CIe=(e)=>{let t=new Map;return new Proxy(e,{get(r,n,o){if(n in r)return Reflect.get(r,n,o);if(t.has(n))return t.get(n);let s=(...f)=>My(r,(h)=>{if(typeof h[n]==="function")return t.set(n,(...y)=>My(r,(E)=>E[n](...y))),h[n](...f);return t.set(n,My(r,(y)=>y[n])),h[n]}),i=My(r,(f)=>f[n]);Object.assign(s,i);let{apply:a,bind:c,call:l}=s,u=Object.setPrototypeOf({},Object.getPrototypeOf(i));return u.apply=a,u.bind=c,u.call=l,Object.setPrototypeOf(s,u),t.set(n,s),s}})},Aft=(e)=>()=>{let t=Error.stackTraceLimit;Error.stackTraceLimit=2;let r=Error();Error.stackTraceLimit=t;function n(){}return Object.setPrototypeOf(n,iI),n.key=e,Object.defineProperty(n,"use",{get(){return(o)=>My(this,o)}}),Object.defineProperty(n,"stack",{get(){return r.stack}}),CIe(n)},Oft=function(){return function(){let[e,t]=arguments,r="accessors"in t?t.accessors:!1,n=Error.stackTraceLimit;Error.stackTraceLimit=2;let o=Error();Error.stackTraceLimit=n;let s="unchecked",i=function(f){if(s==="unchecked"){let h=Object.getPrototypeOf(f);if(h===Object.prototype||h===null)s="plain";else{let y=Object.getPrototypeOf(this);Object.setPrototypeOf(y,h),s="patched"}}if(s==="plain")Object.assign(this,f);else if(s==="patched")return Object.setPrototypeOf(f,Object.getPrototypeOf(this)),f};i.prototype._tag=e,Object.defineProperty(i,"make",{get(){return(f)=>new this(f)}}),Object.defineProperty(i,"use",{get(){return(f)=>My(this,f)}}),i.key=e,Object.assign(i,iI),Object.defineProperty(i,"stack",{get(){return o.stack}});let a="dependencies"in t&&t.dependencies.length>0,c=a?"DefaultWithoutDependencies":"Default",l,u=!1;if("effect"in t)u=typeof t.effect==="function",Object.defineProperty(i,c,{get(){if(u)return function(){return cS(i,W(t.effect.apply(null,arguments),(f)=>new this(f)))}.bind(this);return l??=cS(i,W(t.effect,(f)=>new this(f)))}});else if("scoped"in t)u=typeof t.scoped==="function",Object.defineProperty(i,c,{get(){if(u)return function(){return lS(i,W(t.scoped.apply(null,arguments),(f)=>new this(f)))}.bind(this);return l??=lS(i,W(t.scoped,(f)=>new this(f)))}});else if("sync"in t)Object.defineProperty(i,c,{get(){return l??=bH(i,()=>new this(t.sync()))}});else Object.defineProperty(i,c,{get(){return l??=IA(i,new this(t.succeed))}});if(a){let f;Object.defineProperty(i,"Default",{get(){if(u)return function(){return vC(this.DefaultWithoutDependencies.apply(null,arguments),t.dependencies)};return f??=vC(this.DefaultWithoutDependencies,t.dependencies)}})}return r===!0?CIe(i):i}},YQ=function(e,...t){let r=Error.stackTraceLimit;Error.stackTraceLimit=2;let n=Error();if(Error.stackTraceLimit=r,typeof e!=="string")return dIe(e.length,function(...i){let a=Error.stackTraceLimit;Error.stackTraceLimit=2;let c=Error();return Error.stackTraceLimit=a,mIe({self:this,body:e,args:i,pipeables:t,spanName:"<anonymous>",spanOptions:{context:uC.context(!0)},errorDef:n,errorCall:c})});let o=e,s=t[0];return(i,...a)=>dIe(i.length,{[o](...c){let l=Error.stackTraceLimit;Error.stackTraceLimit=2;let u=Error();return Error.stackTraceLimit=l,mIe({self:this,body:i,args:c,pipeables:a,spanName:o,spanOptions:s,errorDef:n,errorCall:u})}}[o])};function dIe(e,t){return Object.defineProperty(t,"length",{value:e,configurable:!0})}function mIe(e){let t,r=void 0;if(Qle(e.body))t=PT(()=>e.body.apply(e.self,e.args));else try{t=e.body.apply(e.self,e.args)}catch(i){r=i,t=Ms(i)}if(e.pipeables.length>0)try{for(let i of e.pipeables)t=i(t,...e.args)}catch(i){t=r?On(yn(Wo(r),Wo(i))):Ms(i)}let n=!1,o=()=>{if(n!==!1)return n;if(e.errorCall.stack){let i=e.errorDef.stack.trim().split(`
|
|
177
|
+
`),a=e.errorCall.stack.trim().split(`
|
|
178
|
+
`),c=i.slice(2).join(`
|
|
179
|
+
`).trim();if(!c.includes("("))c=c.replace(/at (.*)/,"at ($1)");let l=a.slice(2).join(`
|
|
180
|
+
`).trim();if(!l.includes("("))l=l.replace(/at (.*)/,"at ($1)");return n=`${c}
|
|
181
|
+
${l}`,n}},s=e.spanOptions&&"captureStackTrace"in e.spanOptions?e.spanOptions:{captureStackTrace:o,...e.spanOptions};return cq(t,e.spanName,s)}var Wn=og,_ft=()=>(e)=>e,vft=()=>(e)=>e,Tft=()=>(e)=>e;var ZQ=(e,t)=>{switch(t._tag){case"StringKeyword":case"TemplateLiteral":return Object.keys(e);case"SymbolKeyword":return Object.getOwnPropertySymbols(e);case"Refinement":return ZQ(e,t.from)}},qA=(e)=>{let t=!1,r;return()=>{if(t)return r;return r=e(),t=!0,r}},lq=(e)=>Array.isArray(e),kIe=(e)=>!Array.isArray(e),wIe=(e)=>`[${Ud(e)}]`,uq=(e)=>lq(e)?e.map(wIe).join(""):wIe(e);var Ol=(e,t,r,n)=>{let o=e;if(r&&ut(r))o+=`
|
|
182
|
+
at path: ${uq(r)}`;if(t!==void 0)o+=`
|
|
183
|
+
details: ${t}`;if(n)o+=`
|
|
184
|
+
schema (${n._tag}): ${n}`;return o},fq=(e)=>Ol("Invalid Argument",e),XQ=(e,t,r)=>Ol("Unsupported schema",e,t,r),IIe=(e,t,r)=>Ol("Missing annotation",e,t,r);var AIe=(e,t)=>XQ("Cannot build an Equivalence",t,e),eY=(e,t)=>IIe('Generating a JSON Schema for this schema requires a "jsonSchema" annotation',e,t),OIe=(e,t)=>IIe('Generating a JSON Schema for this schema requires an "identifier" annotation',e,t),_Ie=(e)=>Ol("Generating a JSON Schema for post-rest elements is not currently supported. You're welcome to contribute by submitting a Pull Request",void 0,e),vIe=(e,t)=>Ol("Unsupported key",`Cannot encode ${Ud(e)} key to JSON Schema`,t);var tY=(e,t,r)=>Ol("Unsupported schema or overlapping types",`cannot extend ${e} with ${t}`,r),TIe=(e)=>Ol("Unsupported template literal span",void 0,void 0,e),Og=(e)=>XQ(void 0,void 0,e),RIe=(e)=>Ol("Unsupported key schema",void 0,void 0,e),MIe=(e)=>Ol("Unsupported literal",`literal value: ${Uo(e)}`),rY=(e)=>Ol("Duplicate index signature",`${e} index signature`),PIe=Ol("Unsupported index signature parameter","An index signature parameter type must be `string`, `symbol`, a template literal type or a refinement of the previous types"),DIe=Ol("Invalid element","A required element cannot follow an optional element. ts(1257)"),nY=(e)=>Ol("Duplicate property signature transformation",`Duplicate key ${Uo(e)}`),FIe=(e)=>XQ(void 0,void 0,e),dq=(e)=>Ol("Duplicate property signature",`Duplicate key ${Uo(e)}`);var LIe=Symbol.for("effect/annotation/TypeConstructor"),iY=Symbol.for("effect/annotation/Brand"),QC=Symbol.for("effect/annotation/SchemaId"),aY=Symbol.for("effect/annotation/Message"),mq=Symbol.for("effect/annotation/MissingMessage"),jR=Symbol.for("effect/annotation/Identifier"),za=Symbol.for("effect/annotation/Title"),bS=Symbol.for("effect/annotation/AutoTitle"),_l=Symbol.for("effect/annotation/Description"),hq=Symbol.for("effect/annotation/Examples"),gq=Symbol.for("effect/annotation/Default"),xq=Symbol.for("effect/annotation/JSONSchema"),cY=Symbol.for("effect/annotation/Arbitrary"),lY=Symbol.for("effect/annotation/Pretty"),yq=Symbol.for("effect/annotation/Equivalence"),UIe=Symbol.for("effect/annotation/Documentation"),uY=Symbol.for("effect/annotation/Concurrency"),pY=Symbol.for("effect/annotation/Batching"),fY=Symbol.for("effect/annotation/ParseIssueTitle"),dY=Symbol.for("effect/annotation/ParseOptions"),mY=Symbol.for("effect/annotation/DecodingFallback"),VR=Symbol.for("effect/annotation/Surrogate"),GR=Symbol.for("effect/annotation/StableFilter"),Ls=p(2,(e,t)=>Object.prototype.hasOwnProperty.call(e.annotations,t)?_(e.annotations[t]):R());var hY=Ls(iY);var HIe=Ls(aY),qIe=Ls(mq),KR=Ls(za),gY=Ls(bS),JR=Ls(jR),Tg=Ls(_l),BIe=Ls(hq),WIe=Ls(gq),xY=Ls(xq);var zIe=Ls(uY),$Ie=Ls(pY),jIe=Ls(fY),VIe=Ls(dY),GIe=Ls(mY),Mp=Ls(VR),Rft=Ls(GR),yY=(e)=>h4(Rft(e),(t)=>t===!0),Sq=Symbol.for("effect/annotation/JSONIdentifier"),Mft=Ls(Sq),SY=(e)=>pi(Mft(e),()=>JR(e)),Eq=Symbol.for("effect/schema/ParseJson");class $A{typeParameters;decodeUnknown;encodeUnknown;annotations;_tag="Declaration";constructor(e,t,r,n={}){this.typeParameters=e,this.decodeUnknown=t,this.encodeUnknown=r,this.annotations=n}toString(){return Je(Rp(this),()=>"<declaration schema>")}toJSON(){return{_tag:this._tag,typeParameters:this.typeParameters.map((e)=>e.toJSON()),annotations:Go(this.annotations)}}}var $c=(e)=>(t)=>t._tag===e,KIe=$c("Declaration");class Dm{literal;annotations;_tag="Literal";constructor(e,t={}){this.literal=e,this.annotations=t}toString(){return Je(Rp(this),()=>Uo(this.literal))}toJSON(){return{_tag:this._tag,literal:Ld(this.literal)?String(this.literal):this.literal,annotations:Go(this.annotations)}}}var Fm=$c("Literal"),JIe=new Dm(null);class jA{symbol;annotations;_tag="UniqueSymbol";constructor(e,t={}){this.symbol=e,this.annotations=t}toString(){return Je(Rp(this),()=>Uo(this.symbol))}toJSON(){return{_tag:this._tag,symbol:String(this.symbol),annotations:Go(this.annotations)}}}var Pft=$c("UniqueSymbol");class QIe{annotations;_tag="UndefinedKeyword";constructor(e={}){this.annotations=e}toString(){return Zf(this)}toJSON(){return{_tag:this._tag,annotations:Go(this.annotations)}}}var YC=new QIe({[za]:"undefined"});class YIe{annotations;_tag="VoidKeyword";constructor(e={}){this.annotations=e}toString(){return Zf(this)}toJSON(){return{_tag:this._tag,annotations:Go(this.annotations)}}}var ZIe=new YIe({[za]:"void"});class XIe{annotations;_tag="NeverKeyword";constructor(e={}){this.annotations=e}toString(){return Zf(this)}toJSON(){return{_tag:this._tag,annotations:Go(this.annotations)}}}var ZC=new XIe({[za]:"never"}),Dft=$c("NeverKeyword");class eAe{annotations;_tag="UnknownKeyword";constructor(e={}){this.annotations=e}toString(){return Zf(this)}toJSON(){return{_tag:this._tag,annotations:Go(this.annotations)}}}var EY=new eAe({[za]:"unknown"});class tAe{annotations;_tag="AnyKeyword";constructor(e={}){this.annotations=e}toString(){return Zf(this)}toJSON(){return{_tag:this._tag,annotations:Go(this.annotations)}}}var bY=new tAe({[za]:"any"});class rAe{annotations;_tag="StringKeyword";constructor(e={}){this.annotations=e}toString(){return Zf(this)}toJSON(){return{_tag:this._tag,annotations:Go(this.annotations)}}}var VA=new rAe({[za]:"string",[_l]:"a string"}),QR=$c("StringKeyword");class nAe{annotations;_tag="NumberKeyword";constructor(e={}){this.annotations=e}toString(){return Zf(this)}toJSON(){return{_tag:this._tag,annotations:Go(this.annotations)}}}var GA=new nAe({[za]:"number",[_l]:"a number"}),CY=$c("NumberKeyword");class oAe{annotations;_tag="BooleanKeyword";constructor(e={}){this.annotations=e}toString(){return Zf(this)}toJSON(){return{_tag:this._tag,annotations:Go(this.annotations)}}}var KA=new oAe({[za]:"boolean",[_l]:"a boolean"}),wY=$c("BooleanKeyword");class sAe{annotations;_tag="BigIntKeyword";constructor(e={}){this.annotations=e}toString(){return Zf(this)}toJSON(){return{_tag:this._tag,annotations:Go(this.annotations)}}}var iAe=new sAe({[za]:"bigint",[_l]:"a bigint"});class aAe{annotations;_tag="SymbolKeyword";constructor(e={}){this.annotations=e}toString(){return Zf(this)}toJSON(){return{_tag:this._tag,annotations:Go(this.annotations)}}}var cAe=new aAe({[za]:"symbol",[_l]:"a symbol"}),bq=$c("SymbolKeyword");class lAe{annotations;_tag="ObjectKeyword";constructor(e={}){this.annotations=e}toString(){return Zf(this)}toJSON(){return{_tag:this._tag,annotations:Go(this.annotations)}}}var uAe=new lAe({[za]:"object",[_l]:"an object in the TypeScript meaning, i.e. the `object` type"});class kY{enums;annotations;_tag="Enums";constructor(e,t={}){this.enums=e,this.annotations=t}toString(){return Je(Rp(this),()=>`<enum ${this.enums.length} value(s): ${this.enums.map(([e,t])=>JSON.stringify(t)).join(" | ")}>`)}toJSON(){return{_tag:this._tag,enums:this.enums,annotations:Go(this.annotations)}}}var Fft=$c("Enums"),pAe=(e)=>{switch(e._tag){case"Literal":case"NumberKeyword":case"StringKeyword":case"TemplateLiteral":return!0;case"Union":return e.types.every(pAe)}return!1},fAe=(e)=>{switch(e._tag){case"Literal":return JSON.stringify(String(e.literal));case"StringKeyword":return"string";case"NumberKeyword":return"number";case"TemplateLiteral":return String(e);case"Union":return e.types.map(fAe).join(" | ")}},Nft=(e)=>{switch(e._tag){case"Literal":return String(e.literal);case"StringKeyword":return"${string}";case"NumberKeyword":return"${number}";case"TemplateLiteral":return"${"+String(e)+"}";case"Union":return"${"+e.types.map(fAe).join(" | ")+"}"}};class XC{literal;type;constructor(e,t){if(this.literal=t,pAe(e))this.type=e;else throw Error(TIe(e))}toString(){return Nft(this.type)+this.literal}toJSON(){return{type:this.type.toJSON(),literal:this.literal}}}class Cq{head;spans;annotations;_tag="TemplateLiteral";constructor(e,t,r={}){this.head=e,this.spans=t,this.annotations=r}toString(){return Je(Rp(this),()=>Lft(this))}toJSON(){return{_tag:this._tag,head:this.head,spans:this.spans.map((e)=>e.toJSON()),annotations:Go(this.annotations)}}}var Lft=(e)=>"`"+e.head+e.spans.map(String).join("")+"`",dAe=$c("TemplateLiteral");class ew{type;annotations;constructor(e,t={}){this.type=e,this.annotations=t}toJSON(){return{type:this.type.toJSON(),annotations:Go(this.annotations)}}toString(){return String(this.type)}}class vl extends ew{isOptional;constructor(e,t,r={}){super(e,r);this.isOptional=t}toJSON(){return{type:this.type.toJSON(),isOptional:this.isOptional,annotations:Go(this.annotations)}}toString(){return String(this.type)+(this.isOptional?"?":"")}}var wq=(e)=>e.map((t)=>t.type);class CS{elements;rest;isReadonly;annotations;_tag="TupleType";constructor(e,t,r,n={}){this.elements=e,this.rest=t,this.isReadonly=r,this.annotations=n;let o=!1,s=!1;for(let i of e)if(i.isOptional)o=!0;else if(o){s=!0;break}if(s||o&&t.length>1)throw Error(DIe)}toString(){return Je(Rp(this),()=>Uft(this))}toJSON(){return{_tag:this._tag,elements:this.elements.map((e)=>e.toJSON()),rest:this.rest.map((e)=>e.toJSON()),isReadonly:this.isReadonly,annotations:Go(this.annotations)}}}var Uft=(e)=>{let t=e.elements.map(String).join(", ");return Gi(e.rest,{onEmpty:()=>`readonly [${t}]`,onNonEmpty:(r,n)=>{let o=String(r),s=o.includes(" | ")?`(${o})`:o;if(n.length>0){let i=n.map(String).join(", ");if(e.elements.length>0)return`readonly [${t}, ...${s}[], ${i}]`;else return`readonly [...${s}[], ${i}]`}else if(e.elements.length>0)return`readonly [${t}, ...${s}[]]`;else return`ReadonlyArray<${o}>`}})};class ro extends vl{name;isReadonly;constructor(e,t,r,n,o){super(t,r,o);this.name=e,this.isReadonly=n}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:Go(this.annotations)}}}var mAe=(e)=>{switch(e._tag){case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":return!0;case"Refinement":return mAe(e.from)}return!1};class wS{type;isReadonly;parameter;constructor(e,t,r){if(this.type=t,this.isReadonly=r,mAe(e))this.parameter=e;else throw Error(PIe)}toString(){return(this.isReadonly?"readonly ":"")+`[x: ${this.parameter}]: ${this.type}`}toJSON(){return{parameter:this.parameter.toJSON(),type:this.type.toJSON(),isReadonly:this.isReadonly}}}class la{annotations;_tag="TypeLiteral";propertySignatures;indexSignatures;constructor(e,t,r={}){this.annotations=r;let n={};for(let s=0;s<e.length;s++){let i=e[s].name;if(Object.prototype.hasOwnProperty.call(n,i))throw Error(dq(i));n[i]=null}let o={string:!1,symbol:!1};for(let s=0;s<t.length;s++){let i=vg(t[s].parameter);if(QR(i)){if(o.string)throw Error(rY("string"));o.string=!0}else if(bq(i)){if(o.symbol)throw Error(rY("symbol"));o.symbol=!0}}this.propertySignatures=e,this.indexSignatures=t}toString(){return Je(Rp(this),()=>Hft(this))}toJSON(){return{_tag:this._tag,propertySignatures:this.propertySignatures.map((e)=>e.toJSON()),indexSignatures:this.indexSignatures.map((e)=>e.toJSON()),annotations:Go(this.annotations)}}}var NIe=(e)=>e.map(String).join("; "),Hft=(e)=>{if(e.propertySignatures.length>0){let t=e.propertySignatures.map(String).join("; ");if(e.indexSignatures.length>0)return`{ ${t}; ${NIe(e.indexSignatures)} }`;else return`{ ${t} }`}else if(e.indexSignatures.length>0)return`{ ${NIe(e.indexSignatures)} }`;else return"{}"},YR=$c("TypeLiteral"),qft=Aa(bf(uc,(e)=>{switch(e._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})),Bft={string:"StringKeyword",number:"NumberKeyword",boolean:"BooleanKeyword",bigint:"BigIntKeyword"},hAe=(e)=>Ho(e,(t)=>ZR(t)?hAe(t.types):[t]),Wft=(e)=>{let t=qft(e),r=[],n={},o=[];for(let s of t)switch(s._tag){case"NeverKeyword":break;case"AnyKeyword":return[bY];case"UnknownKeyword":return[EY];case"ObjectKeyword":case"UndefinedKeyword":case"VoidKeyword":case"StringKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"SymbolKeyword":{if(!n[s._tag])n[s._tag]=s,r.push(s);break}case"Literal":{let i=typeof s.literal;switch(i){case"string":case"number":case"bigint":case"boolean":{let a=Bft[i];if(!n[a]&&!o.includes(s.literal))o.push(s.literal),r.push(s);break}case"object":{if(!o.includes(s.literal))o.push(s.literal),r.push(s);break}}break}case"UniqueSymbol":{if(!n.SymbolKeyword&&!o.includes(s.symbol))o.push(s.symbol),r.push(s);break}case"TupleType":{if(!n.ObjectKeyword)r.push(s);break}case"TypeLiteral":{if(s.propertySignatures.length===0&&s.indexSignatures.length===0){if(!n["{}"])n["{}"]=s,r.push(s)}else if(!n.ObjectKeyword)r.push(s);break}default:r.push(s)}return r};class ho{types;annotations;static make=(e,t)=>kq(e)?new ho(e,t):e.length===1?e[0]:ZC;static unify=(e,t)=>ho.make(Wft(hAe(e)),t);_tag="Union";constructor(e,t={}){this.types=e,this.annotations=t}toString(){return Je(Rp(this),()=>this.types.map(String).join(" | "))}toJSON(){return{_tag:this._tag,types:this.types.map((e)=>e.toJSON()),annotations:Go(this.annotations)}}}var gAe=(e,t)=>e.map(t),kq=(e)=>e.length>1,ZR=$c("Union"),sY=je(Symbol.for("effect/Schema/AST/toJSONMemoMap"),()=>new WeakMap);class Yf{f;annotations;_tag="Suspend";constructor(e,t={}){this.f=e,this.annotations=t,this.f=qA(e)}toString(){return Rp(this).pipe(pi(()=>Qn(Uh(this.f)(),(e)=>Rp(e))),Je(()=>"<suspended schema>"))}toJSON(){let e=this.f(),t=sY.get(e);if(t)return t;return sY.set(e,{_tag:this._tag}),t={_tag:this._tag,ast:e.toJSON(),annotations:Go(this.annotations)},sY.set(e,t),t}}var IY=$c("Suspend");class kS{from;filter;annotations;_tag="Refinement";constructor(e,t,r={}){this.from=e,this.filter=t,this.annotations=r}toString(){return JR(this).pipe(Je(()=>be(AAe(this),{onNone:()=>`{ ${this.from} | filter }`,onSome:(e)=>Nm(this.from)?String(this.from)+" & "+e:e})))}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),annotations:Go(this.annotations)}}}var Nm=$c("Refinement"),Iq={};class Wa{from;to;transformation;annotations;_tag="Transformation";constructor(e,t,r,n={}){this.from=e,this.to=t,this.transformation=r,this.annotations=n}toString(){return Je(Rp(this),()=>`(${String(this.from)} <-> ${String(this.to)})`)}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),to:this.to.toJSON(),annotations:Go(this.annotations)}}}var Aq=$c("Transformation");class Oq{decode;encode;_tag="FinalTransformation";constructor(e,t){this.decode=e,this.encode=t}}var zft=(e)=>(t)=>t._tag===e;class xAe{_tag="ComposeTransformation"}var _q=new xAe;class XR{from;to;decode;encode;constructor(e,t,r,n){this.from=e,this.to=t,this.decode=r,this.encode=n}}var yAe=(e)=>e.decode===te&&e.encode===te;class IS{propertySignatureTransformations;_tag="TypeLiteralTransformation";constructor(e){this.propertySignatureTransformations=e;let t={},r={};for(let n of e){let o=n.from;if(t[o])throw Error(nY(o));t[o]=!0;let s=n.to;if(r[s])throw Error(nY(s));r[s]=!0}}}var eM=zft("TypeLiteralTransformation"),tM=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={...e.annotations};delete n[jR];let o={...n,...t},s=Mp(e);if(Oe(s))o[VR]=tM(s.value,t);return r.annotations.value=o,Object.create(Object.getPrototypeOf(e),r)},SAe=(e)=>ho.unify(BA(e)),$ft="[\\s\\S]*?",jft="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?",EAe=(e,t)=>{switch(e._tag){case"Literal":return HI(String(e.literal));case"StringKeyword":return $ft;case"NumberKeyword":return jft;case"TemplateLiteral":return AY(e,t,!1);case"Union":return e.types.map((r)=>EAe(r,t)).join("|")}},Vft=(e,t,r,n)=>{if(ZR(e)){if(r&&!n)return`(?:${t})`}else if(!r||!n)return t;return`(${t})`},AY=(e,t,r)=>{let n="";if(e.head!==""){let o=HI(e.head);n+=t&&r?`(${o})`:o}for(let o of e.spans){let s=EAe(o.type,t);if(n+=Vft(o.type,s,t,r),o.literal!==""){let i=HI(o.literal);n+=t&&r?`(${i})`:i}}return n},JA=(e)=>new RegExp(`^${AY(e,!1,!0)}$`),bAe=(e)=>new RegExp(`^${AY(e,!0,!0)}$`),zA=(e)=>{let t=Mp(e);if(Oe(t))return zA(t.value);switch(e._tag){case"TypeLiteral":return e.propertySignatures.slice();case"Suspend":return zA(e.f());case"Refinement":return zA(e.from)}return ES(e).map((r)=>_g(e,r))},qR=(e)=>{let t=Mp(e);if(Oe(t))return qR(t.value);switch(e._tag){case"TypeLiteral":return e.indexSignatures.slice();case"Suspend":return qR(e.f());case"Refinement":return qR(e.from);case"Transformation":return qR(e.to)}return[]},BR=(e)=>{switch(e._tag){case"TupleType":{let t=!1,r=[];for(let n of e.elements){if(n.isOptional)t=!0;r.push(n.type)}if(t)r.push(YC);return r=r.concat(wq(e.rest)),ho.make(r)}case"Refinement":return BR(e.from);case"Union":return ho.make(e.types.map(BR));case"Suspend":return BR(e.f())}throw Error(Og(e))},CAe=(e,t)=>{let r=Kd(e.propertySignatures,(n)=>n.name===t);if(Oe(r))return r.value;if(Jr(t)){let n=void 0;for(let o of e.indexSignatures){let s=vg(o.parameter);switch(s._tag){case"TemplateLiteral":{if(JA(s).test(t))return new ro(t,o.type,!1,!0);break}case"StringKeyword":if(n===void 0)n=new ro(t,o.type,!1,!0)}}if(n)return n}else if(Yu(t))for(let n of e.indexSignatures){let o=vg(n.parameter);if(bq(o))return new ro(t,n.type,!1,!0)}},_g=(e,t)=>{let r=Mp(e);if(Oe(r))return _g(r.value,t);switch(e._tag){case"TypeLiteral":{let n=CAe(e,t);if(n)return n;break}case"Union":return new ro(t,ho.make(e.types.map((n)=>_g(n,t).type)),!1,!0);case"Suspend":return _g(e.f(),t);case"Refinement":return _g(e.from,t);case"Transformation":return _g(e.to,t)}throw Error(Og(e))},ES=(e)=>{let t=Mp(e);if(Oe(t))return ES(t.value);switch(e._tag){case"TypeLiteral":return e.propertySignatures.map((r)=>r.name);case"Union":return e.types.slice(1).reduce((r,n)=>Yv(r,ES(n)),ES(e.types[0]));case"Suspend":return ES(e.f());case"Refinement":return ES(e.from);case"Transformation":return ES(e.to)}return[]},OY=(e,t)=>{let r=[],n=[],o=(s)=>{switch(s._tag){case"NeverKeyword":break;case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":case"Refinement":n.push(new wS(s,t,!0));break;case"Literal":if(Jr(s.literal)||li(s.literal))r.push(new ro(s.literal,t,!1,!0));else throw Error(MIe(s.literal));break;case"Enums":{for(let[i,a]of s.enums)r.push(new ro(a,t,!1,!0));break}case"UniqueSymbol":r.push(new ro(s.symbol,t,!1,!0));break;case"Union":s.types.forEach(o);break;default:throw Error(RIe(s))}};return o(e),{propertySignatures:r,indexSignatures:n}},Qf=(e,t)=>{let r=Mp(e);if(Oe(r))return Qf(r.value,t);switch(e._tag){case"TypeLiteral":{let n=[],o={};for(let s of e.propertySignatures)if(o[s.name]=null,t.includes(s.name))n.push(s);for(let s of t)if(!(s in o)){let i=CAe(e,s);if(i)n.push(i)}return new la(n,[])}case"Union":return new la(t.map((n)=>_g(e,n)),[]);case"Suspend":return Qf(e.f(),t);case"Refinement":return Qf(e.from,t);case"Transformation":switch(e.transformation._tag){case"ComposeTransformation":return new Wa(Qf(e.from,t),Qf(e.to,t),_q);case"TypeLiteralTransformation":{let n=[],o=[];for(let s of t){let i=e.transformation.propertySignatureTransformations.find((a)=>a.to===s);if(i)n.push(i),o.push(i.from);else o.push(s)}return ut(n)?new Wa(Qf(e.from,o),Qf(e.to,t),new IS(n)):Qf(e.from,o)}}}throw Error(Og(e))},wAe=(e,t)=>{let r=qR(e);if(r.length>0){if(r.some((n)=>QR(vg(n.parameter))))r=r.filter((n)=>!dAe(vg(n.parameter)));return new la([],r)}return Qf(e,ES(e).filter((n)=>!t.includes(n)))},WR=(e)=>ho.make([e,YC]),JC=(e,t)=>{let r=t?.exact===!0;switch(e._tag){case"TupleType":return new CS(e.elements.map((n)=>new vl(r?n.type:WR(n.type),!0)),es(e.rest,{onEmpty:()=>e.rest,onNonEmpty:(n)=>[new ew(ho.make([...wq(n),YC]))]}),e.isReadonly);case"TypeLiteral":return new la(e.propertySignatures.map((n)=>new ro(n.name,r?n.type:WR(n.type),!0,n.isReadonly,n.annotations)),e.indexSignatures.map((n)=>new wS(n.parameter,WR(n.type),n.isReadonly)));case"Union":return ho.make(e.types.map((n)=>JC(n,t)));case"Suspend":return new Yf(()=>JC(e.f(),t));case"Declaration":case"Refinement":throw Error(Og(e));case"Transformation":{if(eM(e.transformation)&&e.transformation.propertySignatureTransformations.every(yAe))return new Wa(JC(e.from,t),JC(e.to,t),e.transformation);throw Error(Og(e))}}return e},WA=(e)=>{switch(e._tag){case"TupleType":return new CS(e.elements.map((t)=>new vl(t.type,!1)),e.rest,e.isReadonly);case"TypeLiteral":return new la(e.propertySignatures.map((t)=>new ro(t.name,t.type,!1,t.isReadonly,t.annotations)),e.indexSignatures);case"Union":return ho.make(e.types.map((t)=>WA(t)));case"Suspend":return new Yf(()=>WA(e.f()));case"Declaration":case"Refinement":throw Error(Og(e));case"Transformation":{if(eM(e.transformation)&&e.transformation.propertySignatureTransformations.every(yAe))return new Wa(WA(e.from),WA(e.to),e.transformation);throw Error(Og(e))}}return e},KC=(e)=>{switch(e._tag){case"TupleType":return e.isReadonly===!1?e:new CS(e.elements,e.rest,!1,e.annotations);case"TypeLiteral":{let t=zc(e.propertySignatures,(n)=>n.isReadonly===!1?n:new ro(n.name,n.type,n.isOptional,!1,n.annotations)),r=zc(e.indexSignatures,(n)=>n.isReadonly===!1?n:new wS(n.parameter,n.type,!1));return t===e.propertySignatures&&r===e.indexSignatures?e:new la(t,r,e.annotations)}case"Union":{let t=zc(e.types,KC);return t===e.types?e:ho.make(t,e.annotations)}case"Suspend":return new Yf(()=>KC(e.f()),e.annotations);case"Refinement":{let t=KC(e.from);return t===e.from?e:new kS(t,e.filter,e.annotations)}case"Transformation":{let t=KC(e.from),r=KC(e.to);return t===e.from&&r===e.to?e:new Wa(t,r,e.transformation,e.annotations)}}return e};var _Y=(e)=>(t)=>{let r=void 0;for(let n of e)if(Object.prototype.hasOwnProperty.call(t.annotations,n)){if(r===void 0)r={};r[n]=t.annotations[n]}return r},kAe=(e)=>(t)=>{let r={...t.annotations};for(let n of e)delete r[n];return r},Gft=_Y([hq,gq,xq,cY,lY,yq]),_n=(e)=>{switch(e._tag){case"Declaration":{let t=zc(e.typeParameters,_n);return t===e.typeParameters?e:new $A(t,e.decodeUnknown,e.encodeUnknown,e.annotations)}case"TupleType":{let t=zc(e.elements,(o)=>{let s=_n(o.type);return s===o.type?o:new vl(s,o.isOptional)}),r=wq(e.rest),n=zc(r,_n);return t===e.elements&&n===r?e:new CS(t,n.map((o)=>new ew(o)),e.isReadonly,e.annotations)}case"TypeLiteral":{let t=zc(e.propertySignatures,(n)=>{let o=_n(n.type);return o===n.type?n:new ro(n.name,o,n.isOptional,n.isReadonly)}),r=zc(e.indexSignatures,(n)=>{let o=_n(n.type);return o===n.type?n:new wS(n.parameter,o,n.isReadonly)});return t===e.propertySignatures&&r===e.indexSignatures?e:new la(t,r,e.annotations)}case"Union":{let t=zc(e.types,_n);return t===e.types?e:ho.make(t,e.annotations)}case"Suspend":return new Yf(()=>_n(e.f()),e.annotations);case"Refinement":{let t=_n(e.from);return t===e.from?e:new kS(t,e.filter,e.annotations)}case"Transformation":{let t=Gft(e);return _n(t!==void 0?tM(e.to,t):e.to)}}return e};function zc(e,t){let r=!1,n=Vd(e.length);for(let o=0;o<e.length;o++){let s=e[o],i=t(s);if(i!==s)r=!0;n[o]=i}return r?n:e}var $R=(e)=>{switch(e._tag){case"Transformation":return e.from;case"Refinement":return $R(e.from);case"Suspend":return $R(e.f())}},Jf=(e,t)=>{switch(e._tag){case"Declaration":{let r=zc(e.typeParameters,(n)=>Jf(n,t));return r===e.typeParameters?e:new $A(r,e.decodeUnknown,e.encodeUnknown)}case"TupleType":{let r=zc(e.elements,(s)=>{let i=Jf(s.type,t);return i===s.type?s:new vl(i,s.isOptional)}),n=wq(e.rest),o=zc(n,(s)=>Jf(s,t));return r===e.elements&&o===n?e:new CS(r,o.map((s)=>new ew(s)),e.isReadonly)}case"TypeLiteral":{let r=zc(e.propertySignatures,(o)=>{let s=Jf(o.type,t);return s===o.type?o:new ro(o.name,s,o.isOptional,o.isReadonly)}),n=zc(e.indexSignatures,(o)=>{let s=Jf(o.type,t);return s===o.type?o:new wS(o.parameter,s,o.isReadonly)});return r===e.propertySignatures&&n===e.indexSignatures?e:new la(r,n)}case"Union":{let r=zc(e.types,(n)=>Jf(n,t));return r===e.types?e:ho.make(r)}case"Suspend":{let r=void 0,n=SY(e);if(Oe(n)){let o=t?"Bound":"";r={[Sq]:`${n.value}Encoded${o}`}}return new Yf(()=>Jf(e.f(),t),r)}case"Refinement":{let r=Jf(e.from,t);if(t){if(r===e.from)return e;if($R(e.from)===void 0&&yY(e))return new kS(r,e.filter,e.annotations);return r}else return r}case"Transformation":return Jf(e.from,t)}return e},rM=(e)=>Jf(e,!1),IAe=(e)=>Jf(e,!0),Go=(e)=>{let t={};for(let r of Object.getOwnPropertySymbols(e))t[String(r)]=e[r];return t},vg=(e)=>{switch(e._tag){case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":return e;case"Refinement":return vg(e.from)}},vY=(e,t)=>{switch(e._tag){case"Literal":return Fm(t)&&t.literal===e.literal;case"UniqueSymbol":return Pft(t)&&t.symbol===e.symbol;case"UndefinedKeyword":case"VoidKeyword":case"NeverKeyword":case"UnknownKeyword":case"AnyKeyword":case"StringKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"SymbolKeyword":case"ObjectKeyword":return t._tag===e._tag;case"TemplateLiteral":return dAe(t)&&t.head===e.head&&Kft(t.spans,e.spans);case"Enums":return Fft(t)&&Jft(t.enums,e.enums);case"Union":return ZR(t)&&Qft(e.types,t.types);case"Refinement":case"TupleType":case"TypeLiteral":case"Suspend":case"Transformation":case"Declaration":return e===t}},Kft=Ji((e,t)=>e.literal===t.literal&&vY(e.type,t.type)),Jft=Ji((e,t)=>t[0]===e[0]&&t[1]===e[1]),Qft=Ji(vY),Yft=EL(vY),BA=(e)=>{switch(e._tag){case"Declaration":{let t=Mp(e);if(Oe(t))return BA(t.value);break}case"TypeLiteral":return e.propertySignatures.map((t)=>Yu(t.name)?new jA(t.name):new Dm(t.name)).concat(e.indexSignatures.map((t)=>vg(t.parameter)));case"Suspend":return BA(e.f());case"Union":return e.types.slice(1).reduce((t,r)=>Yft(t,BA(r)),BA(e.types[0]));case"Transformation":return BA(e.to)}throw Error(Og(e))},TY=(e,t)=>new Wa(e,t,_q),zR=(e,t)=>{switch(e._tag){case"TypeLiteral":{let r=[];for(let n of Reflect.ownKeys(t)){let o=t[n];if(o!==void 0)r.push(new XR(n,o,te,te))}if(r.length===0)return e;return new Wa(e,new la(e.propertySignatures.map((n)=>{let o=t[n.name];return new ro(o===void 0?n.name:o,_n(n.type),n.isOptional,n.isReadonly,n.annotations)}),e.indexSignatures),new IS(r))}case"Union":return ho.make(e.types.map((r)=>zR(r,t)));case"Suspend":return new Yf(()=>zR(e.f(),t));case"Transformation":return TY(e,zR(_n(e),t))}throw Error(FIe(e))},Zf=(e)=>Je(Rp(e),()=>e._tag);function Zft(e){return be(hY(e),{onNone:()=>"",onSome:(t)=>t.map((r)=>` & Brand<${Uo(r)}>`).join("")})}var AAe=(e)=>KR(e).pipe(pi(()=>Tg(e)),pi(()=>gY(e)),jt((t)=>t+Zft(e))),Rp=(e)=>pi(JR(e),()=>AAe(e)),vq=(e,t,r)=>{switch(e._tag){case"UndefinedKeyword":return ZC;case"Union":{let n=[],o=!1;for(let s of e.types){let i=t(s);if(i){if(o=!0,!Dft(i))n.push(i)}else n.push(s)}if(o)return ho.make(n);break}case"Suspend":return t(e.f());case"Transformation":return r(e)}};class Mi{path;actual;issue;_tag="Pointer";constructor(e,t,r){this.path=e,this.actual=t,this.issue=r}}class PY{actual;message;_tag="Unexpected";constructor(e,t){this.actual=e,this.message=t}}class YA{ast;message;_tag="Missing";actual=void 0;constructor(e,t){this.ast=e,this.message=t}}class ss{ast;actual;issues;output;_tag="Composite";constructor(e,t,r,n){this.ast=e,this.actual=t,this.issues=r,this.output=n}}class Rq{ast;actual;kind;issue;_tag="Refinement";constructor(e,t,r,n){this.ast=e,this.actual=t,this.kind=r,this.issue=n}}class Mq{ast;actual;kind;issue;_tag="Transformation";constructor(e,t,r,n){this.ast=e,this.actual=t,this.kind=r,this.issue=n}}class Zt{ast;actual;message;_tag="Type";constructor(e,t,r){this.ast=e,this.actual=t,this.message=r}}class DY{ast;actual;message;_tag="Forbidden";constructor(e,t,r){this.ast=e,this.actual=t,this.message=r}}var FY=Symbol.for("effect/Schema/ParseErrorTypeId"),Pq=(e)=>de(e,FY);class vAe extends fR("ParseError"){[FY]=FY;get message(){return this.toString()}toString(){return vu.formatIssueSync(this.issue)}toJSON(){return{_id:"ParseError",message:this.toString()}}[dt](){return this.toJSON()}}var Rg=(e)=>new vAe({issue:e}),cn=ye,Ko=Ie,eO=ay;var iM=Wv,hc=Bd,_u=p(2,(e,t)=>hc(e)?Ir(e,{onLeft:Ie,onRight:t}):L(e,t)),ua=p(2,(e,t)=>hc(e)?eu(e,t):W(e,t)),rw=p(2,(e,t)=>hc(e)?pl(e,t):br(e,t));var TAe=p(2,(e,t)=>hc(e)?s4(e,{onLeft:t.onFailure,onRight:t.onSuccess}):Gf(e,t)),RAe=p(2,(e,t)=>hc(e)?Ir(e,{onLeft:t,onRight:ye}):jo(e,t)),aM=(e,t)=>{if(t===void 0||li(t))return e;if(e===void 0)return t;return{...e,...t}},cM=(e,t,r)=>{let n=Pi(e,t);return(o,s)=>n(o,aM(r,s))},LY=(e,t,r)=>{let n=cM(e,t,r);return(o,s)=>zv(n(o,s),Rg)},tO=(e,t,r)=>{let n=cM(e,t,r);return(o,s)=>uL(n(o,s))},UY=(e,t,r)=>{let n=Pi(e,t);return(o,s)=>n(o,{...aM(r,s),isEffectAllowed:!0})},HY=(e,t)=>LY(e.ast,!0,t),qY=(e,t)=>tO(e.ast,!0,t),BY=(e,t)=>cM(e.ast,!0,t);var gs=(e,t)=>UY(e.ast,!0,t),WY=(e,t)=>LY(e.ast,!1,t),zY=(e,t)=>tO(e.ast,!1,t),MAe=(e,t)=>cM(e.ast,!1,t);var Us=(e,t)=>UY(e.ast,!1,t),rO=HY,PAe=qY;var Dq=gs,nw=(e,t)=>LY(_n(e.ast),!0,t),DAe=(e,t)=>tO(_n(e.ast),!0,t),FAe=(e,t)=>cM(_n(e.ast),!0,t);var NAe=(e,t)=>UY(_n(e.ast),!0,t),OS=(e,t)=>{let r=Pi(_n(e.ast),!0);return(n,o)=>wi(r(n,{exact:!0,...aM(t,o)}))},LAe=(e,t)=>{let r=Pi(_n(e.ast),!0);return(n,o)=>{let s=r(n,{exact:!0,...aM(t,o)});if(Sr(s))throw Rg(s.left)}},_S=WY,UAe=zY;var Xft=je(Symbol.for("effect/ParseResult/decodeMemoMap"),()=>new WeakMap),edt=je(Symbol.for("effect/ParseResult/encodeMemoMap"),()=>new WeakMap),Pi=(e,t)=>{let r=t?Xft:edt,n=r.get(e);if(n)return n;let o=tdt(e,t),s=VIe(e),i=Oe(s)?(l,u)=>o(l,aM(u,s.value)):o,a=GIe(e),c=t&&Oe(a)?(l,u)=>oM(RAe(i(l,u),a.value),e,l,u):i;return r.set(e,c),c},RY=(e)=>Ar(zIe(e)),MY=(e)=>Ar($Ie(e)),tdt=(e,t)=>{switch(e._tag){case"Refinement":if(t){let r=Pi(e.from,!0);return(n,o)=>{o=o??Iq;let s=o?.errors==="all",i=_u(RAe(r(n,o),(a)=>{let c=new Rq(e,n,"From",a);if(s&&yY(e)&&WAe(a))return be(e.filter(n,o,e),{onNone:()=>Ie(c),onSome:(l)=>Ie(new ss(e,n,[c,new Rq(e,n,"Predicate",l)]))});return Ie(c)}),(a)=>be(e.filter(a,o,e),{onNone:()=>ye(a),onSome:(c)=>Ie(new Rq(e,n,"Predicate",c))}));return oM(i,e,n,o)}}else{let r=Pi(_n(e),!0),n=Pi(HAe(e.from),!1);return(o,s)=>oM(_u(r(o,s),(i)=>n(i,s)),e,o,s)}case"Transformation":{let r=ndt(e.transformation,t),n=t?Pi(e.from,!0):Pi(e.to,!1),o=t?Pi(e.to,!0):Pi(e.from,!1);return(s,i)=>oM(_u(rw(n(s,i),(a)=>new Mq(e,s,t?"Encoded":"Type",a)),(a)=>_u(rw(r(a,i??Iq,e,s),(c)=>new Mq(e,s,"Transformation",c)),(c)=>rw(o(c,i),(l)=>new Mq(e,s,t?"Type":"Encoded",l)))),e,s,i)}case"Declaration":{let r=t?e.decodeUnknown(...e.typeParameters):e.encodeUnknown(...e.typeParameters);return(n,o)=>oM(r(n,o??Iq,e),e,n,o)}case"Literal":return Ou(e,(r)=>r===e.literal);case"UniqueSymbol":return Ou(e,(r)=>r===e.symbol);case"UndefinedKeyword":return Ou(e,_h);case"NeverKeyword":return Ou(e,zle);case"UnknownKeyword":case"AnyKeyword":case"VoidKeyword":return ye;case"StringKeyword":return Ou(e,Jr);case"NumberKeyword":return Ou(e,li);case"BooleanKeyword":return Ou(e,ji);case"BigIntKeyword":return Ou(e,Ld);case"SymbolKeyword":return Ou(e,Yu);case"ObjectKeyword":return Ou(e,Zo);case"Enums":return Ou(e,(r)=>e.enums.some(([n,o])=>o===r));case"TemplateLiteral":{let r=JA(e);return Ou(e,(n)=>Jr(n)&&r.test(n))}case"TupleType":{let r=e.elements.map((l)=>Pi(l.type,t)),n=e.rest.map((l)=>Pi(l.type,t)),o=e.elements.filter((l)=>!l.isOptional);if(e.rest.length>0)o=o.concat(e.rest.slice(1));let s=o.length,i=e.elements.length>0?e.elements.map((l,u)=>u).join(" | "):"never",a=RY(e),c=MY(e);return(l,u)=>{if(!Gd(l))return Ie(new Zt(e,l));let f=u?.errors==="all",h=[],y=0,E=[],b=l.length;for(let k=b;k<=s-1;k++){let O=new Mi(k,l,new YA(o[k-b]));if(f){h.push([y++,O]);continue}else return Ie(new ss(e,l,O,E))}if(e.rest.length===0)for(let k=e.elements.length;k<=b-1;k++){let O=new Mi(k,l,new PY(l[k],`is unexpected, expected: ${i}`));if(f){h.push([y++,O]);continue}else return Ie(new ss(e,l,O,E))}let w=0,T=void 0;for(;w<r.length;w++)if(b<w+1){if(e.elements[w].isOptional)continue}else{let k=r[w],O=k(l[w],u);if(hc(O)){if(Sr(O)){let P=new Mi(w,l,O.left);if(f){h.push([y++,P]);continue}else return Ie(new ss(e,l,P,Xf(E)))}E.push([y++,O.right])}else{let P=y++,D=w;if(!T)T=[];T.push(({es:I,output:M})=>L(yS(O),(B)=>{if(Sr(B)){let ee=new Mi(D,l,B.left);if(f)return I.push([P,ee]),me;else return Ie(new ss(e,l,ee,Xf(M)))}return M.push([P,B.right]),me}))}}if(ut(n)){let[k,...O]=n;for(;w<b-O.length;w++){let P=k(l[w],u);if(hc(P))if(Sr(P)){let D=new Mi(w,l,P.left);if(f){h.push([y++,D]);continue}else return Ie(new ss(e,l,D,Xf(E)))}else E.push([y++,P.right]);else{let D=y++,I=w;if(!T)T=[];T.push(({es:M,output:B})=>L(yS(P),(ee)=>{if(Sr(ee)){let j=new Mi(I,l,ee.left);if(f)return M.push([D,j]),me;else return Ie(new ss(e,l,j,Xf(B)))}else return B.push([D,ee.right]),me}))}}for(let P=0;P<O.length;P++){let D=w+P;if(b<D+1)continue;else{let I=O[P](l[D],u);if(hc(I)){if(Sr(I)){let M=new Mi(D,l,I.left);if(f){h.push([y++,M]);continue}else return Ie(new ss(e,l,M,Xf(E)))}E.push([y++,I.right])}else{let M=y++;if(!T)T=[];T.push(({es:B,output:ee})=>L(yS(I),(j)=>{if(Sr(j)){let ae=new Mi(D,l,j.left);if(f)return B.push([M,ae]),me;else return Ie(new ss(e,l,ae,Xf(ee)))}return ee.push([M,j.right]),me}))}}}}let A=({es:k,output:O})=>tp(k)?Ie(new ss(e,l,Xf(k),Xf(O))):ye(Xf(O));if(T&&T.length>0){let k=T;return Qe(()=>{let O={es:py(h),output:py(E)};return L(en(k,(P)=>P(O),{concurrency:a,batching:c,discard:!0}),()=>A(O))})}return A({output:E,es:h})}}case"TypeLiteral":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return Ou(e,$le);let r=[],n={},o=[];for(let u of e.propertySignatures)r.push([Pi(u.type,t),u]),n[u.name]=null,o.push(u.name);let s=e.indexSignatures.map((u)=>[Pi(u.parameter,t),Pi(u.type,t),u.parameter]),i=ho.make(e.indexSignatures.map((u)=>u.parameter).concat(o.map((u)=>Yu(u)?new jA(u):new Dm(u)))),a=Pi(i,t),c=RY(e),l=MY(e);return(u,f)=>{if(!Xu(u))return Ie(new Zt(e,u));let h=f?.errors==="all",y=[],E=0,b=f?.onExcessProperty==="error",w=f?.onExcessProperty==="preserve",T={},A;if(b||w){A=Reflect.ownKeys(u);for(let D of A){let I=a(D,f);if(hc(I)&&Sr(I))if(b){let M=new Mi(D,u,new PY(u[D],`is unexpected, expected: ${String(i)}`));if(h){y.push([E++,M]);continue}else return Ie(new ss(e,u,M,T))}else T[D]=u[D]}}let k=void 0,O=f?.exact===!0;for(let D=0;D<r.length;D++){let I=r[D][1],M=I.name,B=Object.prototype.hasOwnProperty.call(u,M);if(!B){if(I.isOptional)continue;else if(O){let ae=new Mi(M,u,new YA(I));if(h){y.push([E++,ae]);continue}else return Ie(new ss(e,u,ae,T))}}let ee=r[D][0],j=ee(u[M],f);if(hc(j)){if(Sr(j)){let ae=new Mi(M,u,B?j.left:new YA(I));if(h){y.push([E++,ae]);continue}else return Ie(new ss(e,u,ae,T))}T[M]=j.right}else{let ae=E++,F=M;if(!k)k=[];k.push(({es:J,output:G})=>L(yS(j),(Z)=>{if(Sr(Z)){let ne=new Mi(F,u,B?Z.left:new YA(I));if(h)return J.push([ae,ne]),me;else return Ie(new ss(e,u,ne,G))}return G[F]=Z.right,me}))}}for(let D=0;D<s.length;D++){let I=s[D],M=I[0],B=I[1],ee=ZQ(u,I[2]);for(let j of ee){let ae=M(j,f);if(hc(ae)&&wi(ae)){let F=B(u[j],f);if(hc(F)){if(Sr(F)){let J=new Mi(j,u,F.left);if(h){y.push([E++,J]);continue}else return Ie(new ss(e,u,J,T))}else if(!Object.prototype.hasOwnProperty.call(n,j))T[j]=F.right}else{let J=E++,G=j;if(!k)k=[];k.push(({es:Z,output:ne})=>L(yS(F),(we)=>{if(Sr(we)){let ot=new Mi(G,u,we.left);if(h)return Z.push([J,ot]),me;else return Ie(new ss(e,u,ot,ne))}else{if(!Object.prototype.hasOwnProperty.call(n,j))ne[j]=we.right;return me}}))}}}}let P=({es:D,output:I})=>{if(tp(D))return Ie(new ss(e,u,Xf(D),I));if(f?.propertyOrder==="original"){let M=A||Reflect.ownKeys(u);for(let ee of o)if(M.indexOf(ee)===-1)M.push(ee);let B={};for(let ee of M)if(Object.prototype.hasOwnProperty.call(I,ee))B[ee]=I[ee];return ye(B)}return ye(I)};if(k&&k.length>0){let D=k;return Qe(()=>{let I={es:py(y),output:Object.assign({},T)};return L(en(D,(M)=>M(I),{concurrency:c,batching:l,discard:!0}),()=>P(I))})}return P({es:y,output:T})}}case"Union":{let r=$Y(e.types,t),n=Reflect.ownKeys(r.keys),o=n.length,s=e.types.length,i=new Map;for(let l=0;l<s;l++)i.set(e.types[l],Pi(e.types[l],t));let a=RY(e)??1,c=MY(e);return(l,u)=>{let f=[],h=0,y=[];if(o>0)if(qk(l))for(let w=0;w<o;w++){let T=n[w],A=r.keys[T].buckets;if(Object.prototype.hasOwnProperty.call(l,T)){let k=String(l[T]);if(Object.prototype.hasOwnProperty.call(A,k))y=y.concat(A[k]);else{let{candidates:O,literals:P}=r.keys[T],D=ho.make(P),I=O.length===s?new la([new ro(T,D,!1,!0)],[]):ho.make(O);f.push([h++,new ss(I,l,new Mi(T,l,new Zt(D,l[T])))])}}else{let{candidates:k,literals:O}=r.keys[T],P=new ro(T,ho.make(O),!1,!0),D=k.length===s?new la([P],[]):ho.make(k);f.push([h++,new ss(D,l,new Mi(T,l,new YA(P)))])}}else{let w=r.candidates.length===s?e:ho.make(r.candidates);f.push([h++,new Zt(w,l)])}if(r.otherwise.length>0)y=y.concat(r.otherwise);let E=void 0;for(let w=0;w<y.length;w++){let T=y[w],A=i.get(T)(l,u);if(hc(A)&&(!E||E.length===0))if(wi(A))return A;else f.push([h++,A.left]);else{let k=h++;if(!E)E=[];E.push((O)=>Qe(()=>{if("finalResult"in O)return me;else return L(yS(A),(P)=>{if(wi(P))O.finalResult=P;else O.es.push([k,P.left]);return me})}))}}let b=(w)=>tp(w)?w.length===1&&w[0][1]._tag==="Type"?Ie(w[0][1]):Ie(new ss(e,l,Xf(w))):Ie(new Zt(e,l));if(E&&E.length>0){let w=E;return Qe(()=>{let T={es:py(f)};return L(en(w,(A)=>A(T),{concurrency:a,batching:c,discard:!0}),()=>{if("finalResult"in T)return T.finalResult;return b(T.es)})})}return b(f)}}case"Suspend":{let r=qA(()=>Pi(e.f(),t));return(n,o)=>r()(n,o)}}},Ou=(e,t)=>(r)=>t(r)?ye(r):Ie(new Zt(e,r)),nM=(e,t)=>{switch(e._tag){case"Declaration":{let r=Mp(e);if(Oe(r))return nM(r.value,t);break}case"TypeLiteral":{let r=[];for(let n=0;n<e.propertySignatures.length;n++){let o=e.propertySignatures[n],s=t?rM(o.type):_n(o.type);if(Fm(s)&&!o.isOptional)r.push([o.name,s])}return r}case"TupleType":{let r=[];for(let n=0;n<e.elements.length;n++){let o=e.elements[n],s=t?rM(o.type):_n(o.type);if(Fm(s)&&!o.isOptional)r.push([n,s])}return r}case"Refinement":return nM(e.from,t);case"Suspend":return nM(e.f(),t);case"Transformation":return nM(t?e.from:e.to,t)}return[]},$Y=(e,t)=>{let r={},n=[],o=[];for(let s=0;s<e.length;s++){let i=e[s],a=nM(i,t);if(a.length>0){o.push(i);for(let c=0;c<a.length;c++){let[l,u]=a[c],f=String(u.literal);r[l]=r[l]||{buckets:{},literals:[],candidates:[]};let h=r[l].buckets;if(Object.prototype.hasOwnProperty.call(h,f)){if(c<a.length-1)continue;h[f].push(i),r[l].literals.push(u),r[l].candidates.push(i)}else{h[f]=[i],r[l].literals.push(u),r[l].candidates.push(i);break}}}else n.push(i)}return{keys:r,otherwise:n,candidates:o}},HAe=(e)=>Nm(e)?HAe(e.from):e,oM=(e,t,r,n)=>{if(n?.isEffectAllowed===!0)return e;if(hc(e))return e;let o=new gC,s=Al(e,{scheduler:o});o.flush();let i=s.unsafePoll();if(i){if(Uc(i))return ye(i.value);let a=i.cause;if(i5(a))return Ie(a.error);return Ie(new DY(t,r,hA(a)))}return Ie(new DY(t,r,"cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work"))},rdt=([e],[t])=>e>t?1:e<t?-1:0;function Xf(e){return e.sort(rdt).map((t)=>t[1])}var ndt=(e,t)=>{switch(e._tag){case"FinalTransformation":return t?e.decode:e.encode;case"ComposeTransformation":return ye;case"TypeLiteralTransformation":return(r)=>{let n=ye(r);for(let o of e.propertySignatureTransformations){let[s,i]=t?[o.from,o.to]:[o.to,o.from],a=t?o.decode:o.encode;n=ua(n,(l)=>{let u=a(Object.prototype.hasOwnProperty.call(l,s)?_(l[s]):R());if(delete l[s],Oe(u))l[i]=u.value;return l})}return n}}},jc=(e,t=[])=>({value:e,forest:t}),vu={formatIssue:(e)=>ua(ZA(e),odt),formatIssueSync:(e)=>{let t=vu.formatIssue(e);return hc(t)?cL(t):xr(t)},formatError:(e)=>vu.formatIssue(e.issue),formatErrorSync:(e)=>vu.formatIssueSync(e.issue)},odt=(e)=>e.value+qAe(`
|
|
185
|
+
`,e.forest),qAe=(e,t)=>{let r="",n=t.length,o;for(let s=0;s<n;s++){o=t[s];let i=s===n-1;r+=e+(i?"└":"├")+"─ "+o.value,r+=qAe(e+(n>1&&!i?"│ ":" "),o.forest)}return r},sdt=(e)=>{switch(e){case"Encoded":return"Encoded side transformation failure";case"Transformation":return"Transformation process failure";case"Type":return"Type side transformation failure"}},idt=(e)=>{switch(e){case"From":return"From side refinement failure";case"Predicate":return"Predicate refinement failure"}},BAe=(e)=>("ast"in e)?_(e.ast):R(),NY=ye(void 0),adt=(e)=>BAe(e).pipe(Qn(HIe),be({onNone:()=>NY,onSome:(t)=>{let r=t(e);if(Jr(r))return ye({message:r,override:!1});if(mn(r))return W(r,(n)=>({message:n,override:!1}));if(Jr(r.message))return ye({message:r.message,override:r.override});return W(r.message,(n)=>({message:n,override:r.override}))}})),jY=(e)=>(t)=>t._tag===e,WAe=jY("Composite"),OAe=jY("Refinement"),_Ae=jY("Transformation"),AS=(e)=>_u(adt(e),(t)=>{if(t!==void 0)return!t.override&&(WAe(e)||OAe(e)&&e.kind==="From"||_Ae(e)&&e.kind!=="Transformation")?_Ae(e)||OAe(e)?AS(e.issue):NY:ye(t.message);return NY}),zAe=(e)=>BAe(e).pipe(Qn(jIe),u4((t)=>t(e)),Ar);function cdt(e){return Tg(e).pipe(pi(()=>KR(e)),pi(()=>gY(e)),pi(()=>JR(e)),Je(()=>`{ ${e.from} | filter }`))}function ldt(e){if(e.message!==void 0)return e.message;return`Expected ${Nm(e.ast)?cdt(e.ast):String(e.ast)}, actual ${Uo(e.actual)}`}var $Ae=(e)=>ua(AS(e),(t)=>t??zAe(e)??ldt(e)),Tq=(e)=>zAe(e)??String(e.ast),jAe=(e)=>e.message??"is forbidden",VAe=(e)=>e.message??"is unexpected",GAe=(e)=>{let t=qIe(e.ast);if(Oe(t)){let r=t.value();return Jr(r)?ye(r):r}return ye(e.message??"is missing")},ZA=(e)=>{switch(e._tag){case"Type":return ua($Ae(e),jc);case"Forbidden":return ye(jc(Tq(e),[jc(jAe(e))]));case"Unexpected":return ye(jc(VAe(e)));case"Missing":return ua(GAe(e),jc);case"Transformation":return _u(AS(e),(t)=>{if(t!==void 0)return ye(jc(t));return ua(ZA(e.issue),(r)=>jc(Tq(e),[jc(sdt(e.kind),[r])]))});case"Refinement":return _u(AS(e),(t)=>{if(t!==void 0)return ye(jc(t));return ua(ZA(e.issue),(r)=>jc(Tq(e),[jc(idt(e.kind),[r])]))});case"Pointer":return ua(ZA(e.issue),(t)=>jc(uq(e.path),[t]));case"Composite":return _u(AS(e),(t)=>{if(t!==void 0)return ye(jc(t));let r=Tq(e);return lq(e.issues)?ua(en(e.issues,ZA),(n)=>jc(r,n)):ua(ZA(e.issues),(n)=>jc(r,[n]))})}},tw=(e,t,r)=>({_tag:e,path:t,message:r}),sM={formatIssue:(e)=>XA(e,void 0,[]),formatIssueSync:(e)=>{let t=sM.formatIssue(e);return hc(t)?cL(t):xr(t)},formatError:(e)=>sM.formatIssue(e.issue),formatErrorSync:(e)=>sM.formatIssueSync(e.issue)},XA=(e,t,r)=>{let n=e._tag;switch(n){case"Type":return ua($Ae(e),(o)=>[tw(t??n,r,o)]);case"Forbidden":return ye([tw(n,r,jAe(e))]);case"Unexpected":return ye([tw(n,r,VAe(e))]);case"Missing":return ua(GAe(e),(o)=>[tw(n,r,o)]);case"Pointer":return XA(e.issue,void 0,r.concat(e.path));case"Composite":return _u(AS(e),(o)=>{if(o!==void 0)return ye([tw(n,r,o)]);return lq(e.issues)?ua(en(e.issues,(s)=>XA(s,void 0,r)),Ab):XA(e.issues,void 0,r)});case"Refinement":return _u(AS(e),(o)=>{if(o!==void 0)return ye([tw(n,r,o)]);return XA(e.issue,e.kind==="Predicate"?n:void 0,r)});case"Transformation":return _u(AS(e),(o)=>{if(o!==void 0)return ye([tw(n,r,o)]);return XA(e.issue,e.kind==="Transformation"?n:void 0,r)})}};var un={};Ht(un,{FileDescriptor:()=>Gte,FileSystem:()=>Hi,FileTypeId:()=>QO,GiB:()=>C_t,KiB:()=>E_t,MiB:()=>b_t,PiB:()=>k_t,Size:()=>lx,TiB:()=>w_t,WatchBackend:()=>Bz,WatchEventCreate:()=>Kte,WatchEventRemove:()=>Qte,WatchEventUpdate:()=>Jte,isFile:()=>O_t,layerNoop:()=>A_t,make:()=>Vte,makeNoop:()=>I_t});var KAe=Symbol.for("effect/Brand/Refined");var lM=()=>Object.assign((e)=>e,{[KAe]:KAe,option:(e)=>_(e),either:(e)=>ye(e),is:(e)=>!0});var ed=Io;var Fq=Fc;var QAe=_i,YAe=eg;var Vc=_s,ZAe=Mf;var VY=mA;var Nq=Uf;var XAe=Zb,eOe=mm;var Tt={};Ht(Tt,{CurrentMemoMap:()=>JY,LayerTypeId:()=>udt,MemoMapTypeId:()=>pdt,annotateLogs:()=>mdt,annotateSpans:()=>hdt,build:()=>QY,buildWithMemoMap:()=>e9,buildWithScope:()=>YY,catchAll:()=>gdt,catchAllCause:()=>xdt,context:()=>Lq,die:()=>ydt,dieSync:()=>Sdt,discard:()=>Edt,effect:()=>gc,effectContext:()=>bdt,effectDiscard:()=>vS,empty:()=>Cdt,ensureErrorType:()=>bmt,ensureRequirementsType:()=>Cmt,ensureSuccessType:()=>Emt,extendScope:()=>wdt,fail:()=>kdt,failCause:()=>Adt,failCauseSync:()=>Odt,failSync:()=>Idt,fiberRefLocallyScopedWith:()=>jdt,flatMap:()=>_dt,flatten:()=>vdt,fresh:()=>Tdt,function:()=>Mdt,isFresh:()=>ddt,isLayer:()=>fdt,launch:()=>Pdt,locally:()=>zdt,locallyEffect:()=>Wdt,locallyScoped:()=>fOe,locallyWith:()=>$dt,makeMemoMap:()=>ymt,map:()=>pOe,mapError:()=>Ddt,match:()=>Fdt,matchCause:()=>Ndt,memoize:()=>Ldt,merge:()=>Uq,mergeAll:()=>fM,mock:()=>Rdt,orDie:()=>Udt,orElse:()=>Hdt,parentSpan:()=>omt,passthrough:()=>qdt,project:()=>Bdt,provide:()=>Oo,provideMerge:()=>Lm,retry:()=>Vdt,scope:()=>dOe,scoped:()=>Pp,scopedContext:()=>Mg,scopedDiscard:()=>yi,service:()=>Gdt,setClock:()=>rmt,setConfigProvider:()=>nmt,setRandom:()=>smt,setRequestBatching:()=>imt,setRequestCache:()=>cmt,setRequestCaching:()=>amt,setScheduler:()=>lmt,setTracer:()=>pmt,setTracerEnabled:()=>fmt,setTracerTiming:()=>dmt,setUnhandledErrorLogLevel:()=>mmt,setVersionMismatchErrorLogLevel:()=>hmt,span:()=>umt,succeed:()=>Hs,succeedContext:()=>ZY,suspend:()=>Kdt,sync:()=>ow,syncContext:()=>Jdt,tap:()=>Qdt,tapError:()=>Ydt,tapErrorCause:()=>Zdt,toRuntime:()=>Xdt,toRuntimeWithMemoMap:()=>emt,unwrapEffect:()=>XY,unwrapScoped:()=>mOe,updateService:()=>Smt,withParentSpan:()=>xmt,withSpan:()=>gmt,zipWith:()=>tmt});var tOe=(e)=>Ip(Na(fA,e)),rOe=p(2,(e,t)=>Xn(fA,t)(e)),uM=(e)=>Ip(hi(mA,ou(e))),GY=(e)=>CH(xe(e,uM)),KY=(e)=>kA(xe(e,uM)),pM=(e)=>Ip(hi(mA,Vh(e))),nOe=p(2,(e,t)=>Eu(pM(e),()=>uM(t))),oOe=p(2,(e,t)=>Eu(pM(e),()=>GY(t))),sOe=p(2,(e,t)=>Eu(pM(e),()=>KY(t)));var iOe=(e)=>Ip(JU(e)),aOe=(e)=>Eg(_a(vs,e)),cOe=(e,t)=>(t=Da(t),lS(vs,t?.onEnd?rs(Ep(e,t),(r)=>qf((n)=>t.onEnd(r,n))):Ep(e,t))),lOe=(e)=>Ip(XU(e));var udt=pH,pdt=nR,JY=P5,fdt=oR,ddt=D5,mdt=$Ce,hdt=jCe,QY=dCe,YY=aS,gdt=_C,xdt=L5,Lq=dH,ydt=U5,Sdt=hCe,Edt=gCe,gc=cS,vS=SCe,bdt=dc,Cdt=NCe,wdt=xCe,kdt=H5,Idt=q5,Adt=sR,Odt=mH,_dt=Eu,vdt=yCe,Tdt=B5,Rdt=ICe,Mdt=wCe;var Pdt=kCe,pOe=xH,Ddt=ACe,Fdt=SH,Ndt=yH,Ldt=OCe,Uq=W5,fM=EH,Udt=_Ce,Hdt=vCe,qdt=TCe,Bdt=RCe,Wdt=hH,zdt=ECe,$dt=gH,fOe=bCe,jdt=CCe,Vdt=MCe,dOe=DCe,Pp=lS,yi=Ip,Mg=iR,Gdt=FCe,Hs=IA,ZY=Eg,Kdt=aR,ow=bH,Jdt=LCe,Qdt=UCe,Ydt=HCe,Zdt=qCe,Xdt=BCe,emt=WCe,Oo=vC,Lm=zCe,tmt=z5,XY=CH,mOe=kA,rmt=(e)=>yi(hi(An,or(Lc,e))),nmt=iOe,omt=aOe,smt=(e)=>yi(hi(An,or(gm,e))),imt=(e)=>yi(Na(PI,e)),amt=(e)=>yi(Na(OR,e)),cmt=(e)=>yi(Hr(e)?V(e,(t)=>Na(MA,t)):Na(MA,e)),lmt=(e)=>yi(Na(Uf,e)),umt=cOe,pmt=lOe,fmt=(e)=>yi(Na(Zb,e)),dmt=(e)=>yi(Na(mm,e)),mmt=(e)=>yi(Na(DI,e)),hmt=(e)=>yi(Na(ZT,e)),gmt=VCe,xmt=uH,ymt=N5,e9=fH,Smt=p(3,(e,t,r)=>Oo(e,pOe(Lq(),(n)=>or(n,t,r(qo(n,t)))))),Emt=()=>(e)=>e,bmt=()=>(e)=>e,Cmt=()=>(e)=>e;var wmt="effect/QueueEnqueue",Bq=Symbol.for(wmt),kmt="effect/QueueDequeue",sO=Symbol.for(kmt),Imt="effect/QueueStrategy",Wq=Symbol.for(Imt),Amt="effect/BackingQueue",hOe=Symbol.for(Amt),t9={_A:(e)=>e},Omt={_A:(e)=>e},r9={_In:(e)=>e},zq={_Out:(e)=>e};class gOe extends Zi{queue;takers;shutdownHook;shutdownFlag;strategy;[Bq]=r9;[sO]=zq;constructor(e,t,r,n,o){super();this.queue=e,this.takers=t,this.shutdownHook=r,this.shutdownFlag=n,this.strategy=o}pipe(){return ce(this,arguments)}commit(){return this.take}capacity(){return this.queue.capacity()}get size(){return Re(()=>lu(this.unsafeSize(),()=>Zn))}unsafeSize(){if(pr(this.shutdownFlag))return R();return _(this.queue.length()-YH(this.takers)+this.strategy.surplusSize())}get isEmpty(){return xe(this.size,(e)=>e<=0)}get isFull(){return xe(this.size,(e)=>e>=this.capacity())}get shutdown(){return Dc(Ot((e)=>(d(this.shutdownFlag,Oi(!0)),d(kl(oO(this.takers),(t)=>lC(t,e.id()),!1,!1),Qt(this.strategy.shutdown),Tf(sg(this.shutdownHook,void 0)),In))))}get isShutdown(){return ue(()=>pr(this.shutdownFlag))}get awaitShutdown(){return Mn(this.shutdownHook)}isActive(){return!pr(this.shutdownFlag)}unsafeOffer(e){if(pr(this.shutdownFlag))return!1;let t;if(this.queue.length()===0){let n=d(this.takers,Il(Bn));if(n!==Bn)iw(n,e),t=!0;else t=!1}else t=!1;if(t)return!0;let r=this.queue.offer(e);return sw(this.strategy,this.queue,this.takers),r}offer(e){return Re(()=>{if(pr(this.shutdownFlag))return Zn;let t;if(this.queue.length()===0){let n=d(this.takers,Il(Bn));if(n!==Bn)iw(n,e),t=!0;else t=!1}else t=!1;if(t)return X(!0);let r=this.queue.offer(e);return sw(this.strategy,this.queue,this.takers),r?X(!0):this.strategy.handleSurplus([e],this.queue,this.takers,this.shutdownFlag)})}offerAll(e){return Re(()=>{if(pr(this.shutdownFlag))return Zn;let t=De(e),r=this.queue.length()===0?De(vmt(this.takers,t.length)):Ge,[n,o]=d(t,rI(r.length));for(let i=0;i<r.length;i++){let a=r[i],c=n[i];iw(a,c)}if(o.length===0)return X(!0);let s=this.queue.offerAll(o);return sw(this.strategy,this.queue,this.takers),At(s)?X(!0):this.strategy.handleSurplus(s,this.queue,this.takers,this.shutdownFlag)})}get take(){return Ot((e)=>{if(pr(this.shutdownFlag))return Zn;let t=this.queue.poll(Bn);if(t!==Bn)return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),X(t);else{let r=Df(e.id());return d(Re(()=>(d(this.takers,_p(r)),sw(this.strategy,this.queue,this.takers),pr(this.shutdownFlag)?Zn:Mn(r))),lc(()=>ue(()=>Tmt(this.takers,r))))}})}get takeAll(){return Re(()=>pr(this.shutdownFlag)?Zn:ue(()=>{let e=this.queue.pollUpTo(Number.POSITIVE_INFINITY);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),Fr(e)}))}takeUpTo(e){return Re(()=>pr(this.shutdownFlag)?Zn:ue(()=>{let t=this.queue.pollUpTo(e);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),Fr(t)}))}takeBetween(e,t){return Re(()=>xOe(this,e,t,Ze()))}}var xOe=(e,t,r,n)=>{if(r<t)return X(n);return d(n9(e,r),V((o)=>{let s=t-o.length;if(s===1)return d(Hq(e),xe((i)=>d(n,Vt(o),Is(i))));if(s>1)return d(Hq(e),V((i)=>xOe(e,s-1,r-o.length-1,d(n,Vt(o),Is(i)))));return X(d(n,Vt(o)))}))};var yOe=(e)=>d(ue(()=>QH(e)),V((t)=>dM($q(t),NOe()))),SOe=(e)=>d(ue(()=>QH(e)),V((t)=>dM($q(t),o9()))),EOe=(e)=>d(ue(()=>QH(e)),V((t)=>dM($q(t),LOe()))),bOe=()=>d(ue(()=>Cg()),V((e)=>dM($q(e),o9()))),_mt=(e,t,r,n,o)=>new gOe(e,t,r,n,o),dM=(e,t)=>d(Ys(),xe((r)=>_mt(e,Cg(),r,Qi(!1),t)));class COe{mutable;[hOe]=Omt;constructor(e){this.mutable=e}poll(e){return Il(this.mutable,e)}pollUpTo(e){return TA(this.mutable,e)}offerAll(e){return AR(this.mutable,e)}offer(e){return _p(this.mutable,e)}capacity(){return Zke(this.mutable)}length(){return YH(this.mutable)}}var $q=(e)=>new COe(e),wOe=(e)=>e.capacity(),kOe=(e)=>e.size,IOe=(e)=>e.isFull,AOe=(e)=>e.isEmpty,OOe=(e)=>e.isShutdown,_Oe=(e)=>e.awaitShutdown,vOe=(e)=>e.shutdown,TOe=p(2,(e,t)=>e.offer(t));var ROe=p(2,(e,t)=>e.offerAll(t)),MOe=(e)=>xe(e.takeUpTo(1),If),Hq=(e)=>e.take,POe=(e)=>e.takeAll,n9=p(2,(e,t)=>e.takeUpTo(t)),DOe=p(3,(e,t,r)=>e.takeBetween(t,r)),FOe=p(2,(e,t)=>e.takeBetween(t,t)),NOe=()=>new UOe,o9=()=>new HOe,LOe=()=>new qOe;class UOe{[Wq]=t9;putters=Cg();surplusSize(){return YH(this.putters)}onCompleteTakersWithEmptyQueue(e){while(!wg(this.putters)&&!wg(e)){let t=Il(e,void 0),r=Il(this.putters,void 0);if(r[2])iw(r[1],!0);iw(t,r[0])}}get shutdown(){return d(dp,V((e)=>d(ue(()=>oO(this.putters)),V((t)=>kl(t,([r,n,o])=>o?d(lC(n,e),In):yt,!1,!1)))))}handleSurplus(e,t,r,n){return Ot((o)=>{let s=Df(o.id());return d(Re(()=>(this.unsafeOffer(e,s),this.unsafeOnQueueEmptySpace(t,r),sw(this,t,r),pr(n)?Zn:Mn(s))),lc(()=>ue(()=>this.unsafeRemove(s))))})}unsafeOnQueueEmptySpace(e,t){let r=!0;while(r&&(e.capacity()===Number.POSITIVE_INFINITY||e.length()<e.capacity())){let n=d(this.putters,Il(Bn));if(n===Bn)r=!1;else{let o=e.offer(n[0]);if(o&&n[2])iw(n[1],!0);else if(!o)qq(this.putters,d(oO(this.putters),wn(n)));sw(this,e,t)}}}unsafeOffer(e,t){let r=De(e);for(let n=0;n<r.length;n++){let o=r[n];if(n===r.length-1)d(this.putters,_p([o,t,!0]));else d(this.putters,_p([o,t,!1]))}}unsafeRemove(e){qq(this.putters,d(oO(this.putters),sp(([,t])=>t!==e)))}}class HOe{[Wq]=t9;surplusSize(){return 0}get shutdown(){return yt}onCompleteTakersWithEmptyQueue(){}handleSurplus(e,t,r,n){return X(!1)}unsafeOnQueueEmptySpace(e,t){}}class qOe{[Wq]=t9;surplusSize(){return 0}get shutdown(){return yt}onCompleteTakersWithEmptyQueue(){}handleSurplus(e,t,r,n){return ue(()=>(this.unsafeOffer(t,e),sw(this,t,r),!0))}unsafeOnQueueEmptySpace(e,t){}unsafeOffer(e,t){let r=t[Symbol.iterator](),n,o=!0;while(!(n=r.next()).done&&o){if(e.capacity()===0)return;e.poll(Bn),o=e.offer(n.value)}}}var iw=(e,t)=>hm(e,X(t)),qq=(e,t)=>d(e,AR(t)),oO=(e)=>d(e,TA(Number.POSITIVE_INFINITY)),vmt=(e,t)=>d(e,TA(t)),Tmt=(e,t)=>{qq(e,d(oO(e),sp((r)=>t!==r)))},sw=(e,t,r)=>{let n=!0;while(n&&t.length()!==0){let o=d(r,Il(Bn));if(o!==Bn){let s=t.poll(Bn);if(s!==Bn)iw(o,s),e.unsafeOnQueueEmptySpace(t,r);else qq(r,d(oO(r),wn(o)));n=!0}else n=!1}if(n&&t.length()===0&&!wg(r))e.onCompleteTakersWithEmptyQueue(r)};var xs=Symbol.for("effect/PubSub/AbsentValue"),WOe=(e,t)=>(r)=>{if(!r.has(e))r.set(e,new Set);r.get(e).add(t)},Rmt=(e,t)=>(r)=>{if(!r.has(e))return;let n=r.get(e);if(n.delete(t),n.size===0)r.delete(e)},zOe=(e)=>Re(()=>{let t=s9(e);return Vq(t,new a_e)}),$Oe=(e)=>Re(()=>{let t=s9(e);return Vq(t,new i9)}),jOe=(e)=>Re(()=>{let t=s9(e);return Vq(t,new c_e)}),VOe=(e)=>Re(()=>{let t=Mmt(e);return Vq(t,new i9)});var GOe=(e)=>e.shutdown;var KOe=(e)=>e.subscribe,s9=(e)=>{let t=typeof e==="number"?{capacity:e}:e;Nmt(t.capacity);let r=t.replay&&t.replay>0?new l9(Math.ceil(t.replay)):void 0;if(t.capacity===1)return new XOe(r);else if(Ime(t.capacity)===t.capacity)return new YOe(t.capacity,r);else return new JOe(t.capacity,r)},Mmt=(e)=>new t_e(e?.replay?new l9(e.replay):void 0),Pmt=(e,t,r)=>xe(Ys(),(n)=>Dmt(e,t,e.subscribe(),Cg(),n,Qi(!1),r)),Dmt=(e,t,r,n,o,s,i)=>new n_e(e,t,r,n,o,s,i,e.replayWindow());class JOe{capacity;replayBuffer;array;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;constructor(e,t){this.capacity=e,this.replayBuffer=t,this.array=Array.from({length:e}),this.subscribers=Array.from({length:e})}replayWindow(){return this.replayBuffer?new mM(this.replayBuffer):Gq}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(e){if(this.isFull())return!1;if(this.subscriberCount!==0){let t=this.publisherIndex%this.capacity;this.array[t]=e,this.subscribers[t]=this.subscriberCount,this.publisherIndex+=1}if(this.replayBuffer)this.replayBuffer.offer(e);return!0}publishAll(e){if(this.subscriberCount===0){if(this.replayBuffer)this.replayBuffer.offerAll(e);return Ze()}let t=Fr(e),r=t.length,n=this.publisherIndex-this.subscribersIndex,o=this.capacity-n,s=Math.min(r,o);if(s===0)return t;let i=0,a=this.publisherIndex+s;while(this.publisherIndex!==a){let c=dn(t,i++),l=this.publisherIndex%this.capacity;if(this.array[l]=c,this.subscribers[l]=this.subscriberCount,this.publisherIndex+=1,this.replayBuffer)this.replayBuffer.offer(c)}return Zr(t,i)}slide(){if(this.subscribersIndex!==this.publisherIndex){let e=this.subscribersIndex%this.capacity;this.array[e]=xs,this.subscribers[e]=0,this.subscribersIndex+=1}if(this.replayBuffer)this.replayBuffer.slide()}subscribe(){return this.subscriberCount+=1,new QOe(this,this.publisherIndex,!1)}}class QOe{self;subscriberIndex;unsubscribed;constructor(e,t,r){this.self=e,this.subscriberIndex=t,this.unsubscribed=r}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(e){if(this.unsubscribed)return e;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex%this.self.capacity,r=this.self.array[t];if(this.self.subscribers[t]-=1,this.self.subscribers[t]===0)this.self.array[t]=xs,this.self.subscribersIndex+=1;return this.subscriberIndex+=1,r}return e}pollUpTo(e){if(this.unsubscribed)return Ze();this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let t=this.self.publisherIndex-this.subscriberIndex,r=Math.min(e,t);if(r<=0)return Ze();let n=[],o=this.subscriberIndex+r;while(this.subscriberIndex!==o){let s=this.subscriberIndex%this.self.capacity,i=this.self.array[s];if(this.self.subscribers[s]-=1,this.self.subscribers[s]===0)this.self.array[s]=xs,this.self.subscribersIndex+=1;n.push(i),this.subscriberIndex+=1}return Fr(n)}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 e=this.subscriberIndex%this.self.capacity;if(this.self.subscribers[e]-=1,this.self.subscribers[e]===0)this.self.array[e]=xs,this.self.subscribersIndex+=1;this.subscriberIndex+=1}}}}class YOe{capacity;replayBuffer;array;mask;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;constructor(e,t){this.capacity=e,this.replayBuffer=t,this.array=Array.from({length:e}),this.mask=e-1,this.subscribers=Array.from({length:e})}replayWindow(){return this.replayBuffer?new mM(this.replayBuffer):Gq}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(e){if(this.isFull())return!1;if(this.subscriberCount!==0){let t=this.publisherIndex&this.mask;this.array[t]=e,this.subscribers[t]=this.subscriberCount,this.publisherIndex+=1}if(this.replayBuffer)this.replayBuffer.offer(e);return!0}publishAll(e){if(this.subscriberCount===0){if(this.replayBuffer)this.replayBuffer.offerAll(e);return Ze()}let t=Fr(e),r=t.length,n=this.publisherIndex-this.subscribersIndex,o=this.capacity-n,s=Math.min(r,o);if(s===0)return t;let i=0,a=this.publisherIndex+s;while(this.publisherIndex!==a){let c=dn(t,i++),l=this.publisherIndex&this.mask;if(this.array[l]=c,this.subscribers[l]=this.subscriberCount,this.publisherIndex+=1,this.replayBuffer)this.replayBuffer.offer(c)}return Zr(t,i)}slide(){if(this.subscribersIndex!==this.publisherIndex){let e=this.subscribersIndex&this.mask;this.array[e]=xs,this.subscribers[e]=0,this.subscribersIndex+=1}if(this.replayBuffer)this.replayBuffer.slide()}subscribe(){return this.subscriberCount+=1,new ZOe(this,this.publisherIndex,!1)}}class ZOe{self;subscriberIndex;unsubscribed;constructor(e,t,r){this.self=e,this.subscriberIndex=t,this.unsubscribed=r}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(e){if(this.unsubscribed)return e;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex&this.self.mask,r=this.self.array[t];if(this.self.subscribers[t]-=1,this.self.subscribers[t]===0)this.self.array[t]=xs,this.self.subscribersIndex+=1;return this.subscriberIndex+=1,r}return e}pollUpTo(e){if(this.unsubscribed)return Ze();this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let t=this.self.publisherIndex-this.subscriberIndex,r=Math.min(e,t);if(r<=0)return Ze();let n=[],o=this.subscriberIndex+r;while(this.subscriberIndex!==o){let s=this.subscriberIndex&this.self.mask,i=this.self.array[s];if(this.self.subscribers[s]-=1,this.self.subscribers[s]===0)this.self.array[s]=xs,this.self.subscribersIndex+=1;n.push(i),this.subscriberIndex+=1}return Fr(n)}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 e=this.subscriberIndex&this.self.mask;if(this.self.subscribers[e]-=1,this.self.subscribers[e]===0)this.self.array[e]=xs,this.self.subscribersIndex+=1;this.subscriberIndex+=1}}}}class XOe{replayBuffer;publisherIndex=0;subscriberCount=0;subscribers=0;value=xs;capacity=1;constructor(e){this.replayBuffer=e}replayWindow(){return this.replayBuffer?new mM(this.replayBuffer):Gq}pipe(){return ce(this,arguments)}isEmpty(){return this.subscribers===0}isFull(){return!this.isEmpty()}size(){return this.isEmpty()?0:1}publish(e){if(this.isFull())return!1;if(this.subscriberCount!==0)this.value=e,this.subscribers=this.subscriberCount,this.publisherIndex+=1;if(this.replayBuffer)this.replayBuffer.offer(e);return!0}publishAll(e){if(this.subscriberCount===0){if(this.replayBuffer)this.replayBuffer.offerAll(e);return Ze()}let t=Fr(e);if(At(t))return t;if(this.publish(Zd(t)))return Zr(t,1);else return t}slide(){if(this.isFull())this.subscribers=0,this.value=xs;if(this.replayBuffer)this.replayBuffer.slide()}subscribe(){return this.subscriberCount+=1,new e_e(this,this.publisherIndex,!1)}}class e_e{self;subscriberIndex;unsubscribed;constructor(e,t,r){this.self=e,this.subscriberIndex=t,this.unsubscribed=r}isEmpty(){return this.unsubscribed||this.self.subscribers===0||this.subscriberIndex===this.self.publisherIndex}size(){return this.isEmpty()?0:1}poll(e){if(this.isEmpty())return e;let t=this.self.value;if(this.self.subscribers-=1,this.self.subscribers===0)this.self.value=xs;return this.subscriberIndex+=1,t}pollUpTo(e){if(this.isEmpty()||e<1)return Ze();let t=this.self.value;if(this.self.subscribers-=1,this.self.subscribers===0)this.self.value=xs;return this.subscriberIndex+=1,We(t)}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=xs}}}}class t_e{replayBuffer;publisherHead={value:xs,subscribers:0,next:null};publisherTail=this.publisherHead;publisherIndex=0;subscribersIndex=0;capacity=Number.MAX_SAFE_INTEGER;constructor(e){this.replayBuffer=e}replayWindow(){return this.replayBuffer?new mM(this.replayBuffer):Gq}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(e){let t=this.publisherTail.subscribers;if(t!==0)this.publisherTail.next={value:e,subscribers:t,next:null},this.publisherTail=this.publisherTail.next,this.publisherIndex+=1;if(this.replayBuffer)this.replayBuffer.offer(e);return!0}publishAll(e){if(this.publisherTail.subscribers!==0)for(let t of e)this.publish(t);else if(this.replayBuffer)this.replayBuffer.offerAll(e);return Ze()}slide(){if(this.publisherHead!==this.publisherTail)this.publisherHead=this.publisherHead.next,this.publisherHead.value=xs,this.subscribersIndex+=1;if(this.replayBuffer)this.replayBuffer.slide()}subscribe(){return this.publisherTail.subscribers+=1,new r_e(this,this.publisherTail,this.publisherIndex,!1)}}class r_e{self;subscriberHead;subscriberIndex;unsubscribed;constructor(e,t,r,n){this.self=e,this.subscriberHead=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){if(this.unsubscribed)return!0;let e=!0,t=!0;while(t)if(this.subscriberHead===this.self.publisherTail)t=!1;else if(this.subscriberHead.next.value!==xs)e=!1,t=!1;else this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1;return e}size(){if(this.unsubscribed)return 0;return this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(e){if(this.unsubscribed)return e;let t=!0,r=e;while(t)if(this.subscriberHead===this.self.publisherTail)t=!1;else{let n=this.subscriberHead.next.value;if(n!==xs){if(r=n,this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0)this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=xs,this.self.subscribersIndex+=1;t=!1}this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return r}pollUpTo(e){let t=[],r=xs,n=0;while(n!==e){let o=this.poll(r);if(o===r)n=e;else t.push(o),n+=1}return Fr(t)}unsubscribe(){if(!this.unsubscribed){this.unsubscribed=!0,this.self.publisherTail.subscribers-=1;while(this.subscriberHead!==this.self.publisherTail){if(this.subscriberHead.next.value!==xs){if(this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0)this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=xs,this.self.subscribersIndex+=1}this.subscriberHead=this.subscriberHead.next}}}}class n_e extends Zi{pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;[sO]=zq;constructor(e,t,r,n,o,s,i,a){super();this.pubsub=e,this.subscribers=t,this.subscription=r,this.pollers=n,this.shutdownHook=o,this.shutdownFlag=s,this.strategy=i,this.replayWindow=a}commit(){return this.take}pipe(){return ce(this,arguments)}capacity(){return this.pubsub.capacity}isActive(){return!pr(this.shutdownFlag)}get size(){return Re(()=>pr(this.shutdownFlag)?Zn:X(this.subscription.size()+this.replayWindow.remaining))}unsafeSize(){if(pr(this.shutdownFlag))return R();return _(this.subscription.size()+this.replayWindow.remaining)}get isFull(){return Re(()=>pr(this.shutdownFlag)?Zn:X(this.subscription.size()===this.capacity()))}get isEmpty(){return xe(this.size,(e)=>e===0)}get shutdown(){return Dc(Ot((e)=>(Oi(this.shutdownFlag,!0),d(pA(iO(this.pollers),(t)=>lC(t,e.id()),!1),Qt(ue(()=>{this.subscribers.delete(this.subscription),this.subscription.unsubscribe(),this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers)})),Tf(sg(this.shutdownHook,void 0)),In))))}get isShutdown(){return ue(()=>pr(this.shutdownFlag))}get awaitShutdown(){return Mn(this.shutdownHook)}get take(){return Ot((e)=>{if(pr(this.shutdownFlag))return Zn;if(this.replayWindow.remaining>0){let r=this.replayWindow.take();return X(r)}let t=wg(this.pollers)?this.subscription.poll(Bn):Bn;if(t===Bn){let r=Df(e.id());return d(Re(()=>(d(this.pollers,_p(r)),d(this.subscribers,WOe(this.subscription,this.pollers)),this.strategy.unsafeCompletePollers(this.pubsub,this.subscribers,this.subscription,this.pollers),pr(this.shutdownFlag)?Zn:Mn(r))),lc(()=>ue(()=>qmt(this.pollers,r))))}else return this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers),X(t)})}get takeAll(){return Re(()=>{if(pr(this.shutdownFlag))return Zn;let e=wg(this.pollers)?Lmt(this.subscription):Ze();if(this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers),this.replayWindow.remaining>0)return X(Vt(this.replayWindow.takeAll(),e));return X(e)})}takeUpTo(e){return Re(()=>{if(pr(this.shutdownFlag))return Zn;let t=void 0;if(this.replayWindow.remaining>=e){let n=this.replayWindow.takeN(e);return X(n)}else if(this.replayWindow.remaining>0)t=this.replayWindow.takeAll(),e=e-t.length;let r=wg(this.pollers)?Umt(this.subscription,e):Ze();return this.strategy.unsafeOnPubSubEmptySpace(this.pubsub,this.subscribers),t?X(Vt(t,r)):X(r)})}takeBetween(e,t){return Re(()=>o_e(this,e,t,Ze()))}}var o_e=(e,t,r,n)=>{if(r<t)return X(n);return d(e.takeUpTo(r),V((o)=>{let s=t-o.length;if(s===1)return d(e.take,xe((i)=>d(n,Vt(o),Is(i))));if(s>1)return d(e.take,V((i)=>o_e(e,s-1,r-o.length-1,d(n,Vt(o),Is(i)))));return X(d(n,Vt(o)))}))};class s_e{pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;[Bq]=r9;[sO]=zq;constructor(e,t,r,n,o,s){this.pubsub=e,this.subscribers=t,this.scope=r,this.shutdownHook=n,this.shutdownFlag=o,this.strategy=s}capacity(){return this.pubsub.capacity}get size(){return Re(()=>pr(this.shutdownFlag)?Zn:ue(()=>this.pubsub.size()))}unsafeSize(){if(pr(this.shutdownFlag))return R();return _(this.pubsub.size())}get isFull(){return xe(this.size,(e)=>e===this.capacity())}get isEmpty(){return xe(this.size,(e)=>e===0)}get awaitShutdown(){return Mn(this.shutdownHook)}get isShutdown(){return ue(()=>pr(this.shutdownFlag))}get shutdown(){return Dc(Ot((e)=>(d(this.shutdownFlag,Oi(!0)),d(this.scope.close(sC(e.id())),Qt(this.strategy.shutdown),Tf(sg(this.shutdownHook,void 0)),In))))}publish(e){return Re(()=>{if(pr(this.shutdownFlag))return Zn;if(this.pubsub.publish(e))return this.strategy.unsafeCompleteSubscribers(this.pubsub,this.subscribers),X(!0);return this.strategy.handleSurplus(this.pubsub,this.subscribers,We(e),this.shutdownFlag)})}isActive(){return!pr(this.shutdownFlag)}unsafeOffer(e){if(pr(this.shutdownFlag))return!1;if(this.pubsub.publish(e))return this.strategy.unsafeCompleteSubscribers(this.pubsub,this.subscribers),!0;return!1}publishAll(e){return Re(()=>{if(pr(this.shutdownFlag))return Zn;let t=Hmt(this.pubsub,e);if(this.strategy.unsafeCompleteSubscribers(this.pubsub,this.subscribers),At(t))return X(!0);return this.strategy.handleSurplus(this.pubsub,this.subscribers,t,this.shutdownFlag)})}get subscribe(){let e=rs(Im([this.scope.fork(Cl),Pmt(this.pubsub,this.subscribers,this.strategy)]),(t)=>t[0].addFinalizer(()=>t[1].shutdown));return xe(km(e,(t,r)=>t[0].close(r)),(t)=>t[1])}offer(e){return this.publish(e)}offerAll(e){return this.publishAll(e)}pipe(){return ce(this,arguments)}}var Vq=(e,t)=>V(Su(),(r)=>xe(Ys(),(n)=>Fmt(e,new Map,r,n,Qi(!1),t))),Fmt=(e,t,r,n,o,s)=>new s_e(e,t,r,n,o,s),Nmt=(e)=>{if(e<=0)throw new $de(`Cannot construct PubSub with capacity of ${e}`)},i_e=(e,t)=>{hm(e,X(t))},jq=(e,t)=>d(e,AR(t)),iO=(e)=>d(e,TA(Number.POSITIVE_INFINITY)),Lmt=(e)=>e.pollUpTo(Number.POSITIVE_INFINITY),Umt=(e,t)=>e.pollUpTo(t),Hmt=(e,t)=>e.publishAll(t),qmt=(e,t)=>{jq(e,d(iO(e),sp((r)=>r!==t)))};class a_e{publishers=Cg();get shutdown(){return V(dp,(e)=>V(ue(()=>iO(this.publishers)),(t)=>kl(t,([r,n,o])=>o?d(lC(n,e),In):yt,!1,!1)))}handleSurplus(e,t,r,n){return Ot((o)=>{let s=Df(o.id());return d(Re(()=>(this.unsafeOffer(r,s),this.unsafeOnPubSubEmptySpace(e,t),this.unsafeCompleteSubscribers(e,t),pr(n)?Zn:Mn(s))),lc(()=>ue(()=>this.unsafeRemove(s))))})}unsafeOnPubSubEmptySpace(e,t){let r=!0;while(r&&!e.isFull()){let n=d(this.publishers,Il(Bn));if(n===Bn)r=!1;else{let o=e.publish(n[0]);if(o&&n[2])i_e(n[1],!0);else if(!o)jq(this.publishers,d(iO(this.publishers),wn(n)));this.unsafeCompleteSubscribers(e,t)}}}unsafeCompletePollers(e,t,r,n){return a9(this,e,t,r,n)}unsafeCompleteSubscribers(e,t){return c9(this,e,t)}unsafeOffer(e,t){let r=e[Symbol.iterator](),n=r.next();if(!n.done)while(!0){let o=n.value;if(n=r.next(),n.done){d(this.publishers,_p([o,t,!0]));break}d(this.publishers,_p([o,t,!1]))}}unsafeRemove(e){jq(this.publishers,d(iO(this.publishers),sp(([t,r])=>r!==e)))}}class i9{get shutdown(){return yt}handleSurplus(e,t,r,n){return X(!1)}unsafeOnPubSubEmptySpace(e,t){}unsafeCompletePollers(e,t,r,n){return a9(this,e,t,r,n)}unsafeCompleteSubscribers(e,t){return c9(this,e,t)}}class c_e{get shutdown(){return yt}handleSurplus(e,t,r,n){return ue(()=>(this.unsafeSlidingPublish(e,r),this.unsafeCompleteSubscribers(e,t),!0))}unsafeOnPubSubEmptySpace(e,t){}unsafeCompletePollers(e,t,r,n){return a9(this,e,t,r,n)}unsafeCompleteSubscribers(e,t){return c9(this,e,t)}unsafeSlidingPublish(e,t){let r=t[Symbol.iterator](),n=r.next();if(!n.done&&e.capacity>0){let o=n.value,s=!0;while(s){e.slide();let i=e.publish(o);if(i&&(n=r.next())&&!n.done)o=n.value;else if(i)s=!1}}}}var a9=(e,t,r,n,o)=>{let s=!0;while(s&&!n.isEmpty()){let i=d(o,Il(Bn));if(i===Bn)if(d(r,Rmt(n,o)),wg(o))s=!1;else d(r,WOe(n,o));else{let a=n.poll(Bn);if(a===Bn)jq(o,d(iO(o),wn(i)));else i_e(i,a),e.unsafeOnPubSubEmptySpace(t,r)}}},c9=(e,t,r)=>{for(let[n,o]of r)for(let s of o)e.unsafeCompletePollers(t,r,n,s)};class l9{capacity;constructor(e){this.capacity=e}head={value:xs,next:null};tail=this.head;size=0;index=0;slide(){this.index++}offer(e){if(this.tail.value=e,this.tail.next={value:xs,next:null},this.tail=this.tail.next,this.size===this.capacity)this.head=this.head.next;else this.size+=1}offerAll(e){for(let t of e)this.offer(t)}}class mM{buffer;head;index;remaining;constructor(e){this.buffer=e,this.index=e.index,this.remaining=e.size,this.head=e.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 e=this.head.value;return this.head=this.head.next,e}takeN(e){if(this.remaining===0)return Ze();else if(this.index<this.buffer.index)this.fastForward();let t=Math.min(e,this.remaining),r=Array(t);for(let n=0;n<t;n++){let o=this.head.value;this.head=this.head.next,r[n]=o}return this.remaining-=t,nt(r)}takeAll(){return this.takeN(this.remaining)}}var Gq={remaining:0,take:()=>{return},takeN:()=>Ze(),takeAll:()=>Ze()};var hM=zOe,l_e=$Oe,u_e=jOe,p_e=VOe;var aO=GOe;var Um=KOe;var d_e=sO;var Tl=yOe,cO=SOe,lO=EOe,TS=bOe,m_e=wOe,Kq=kOe,h_e=AOe,g_e=IOe,gM=OOe,x_e=_Oe,zn=vOe,Br=TOe;var u9=ROe,y_e=MOe,$a=Hq,S_e=POe,E_e=n9,Jq=DOe,b_e=FOe;var Yq="Continue",p9="Close",f9="Yield";var Wmt="effect/ChannelChildExecutorDecision",w_e=Symbol.for(Wmt),zmt={[w_e]:w_e},d9=(e)=>{let t=Object.create(zmt);return t._tag=Yq,t};var uO="ContinuationK",k_e="ContinuationFinalizer";var A_e=Symbol.for("effect/ChannelContinuation"),O_e={_Env:(e)=>e,_InErr:(e)=>e,_InElem:(e)=>e,_InDone:(e)=>e,_OutErr:(e)=>e,_OutDone:(e)=>e,_OutErr2:(e)=>e,_OutElem:(e)=>e,_OutDone2:(e)=>e};class pO{onSuccess;onHalt;_tag=uO;[A_e]=O_e;constructor(e,t){this.onSuccess=e,this.onHalt=t}onExit(e){return Fa(e)?this.onHalt(e.cause):this.onSuccess(e.value)}}class m9{finalizer;_tag=k_e;[A_e]=O_e;constructor(e){this.finalizer=e}}var Zq="PullAfterNext",h9="PullAfterAllEnqueued";var Vmt="effect/ChannelUpstreamPullStrategy",Gmt=Symbol.for(Vmt),Kmt={_A:(e)=>e},Jmt={[Gmt]:Kmt},g9=(e)=>{let t=Object.create(Jmt);return t._tag=Zq,t.emitSeparator=e,t};var Xq="BracketOut",eB="Bridge",xM="ConcatAll",tB="Emit",rB="Ensuring",nB="Fail",fO="Fold",oB="FromEffect",sB="PipeTo",iB="Provide",aB="Read",cB="Succeed",lB="SucceedNow",uB="Suspend";var Ymt="effect/Channel",dO=Symbol.for(Ymt),Zmt={_Env:(e)=>e,_InErr:(e)=>e,_InElem:(e)=>e,_InDone:(e)=>e,_OutErr:(e)=>e,_OutElem:(e)=>e,_OutDone:(e)=>e},ja={[dO]:Zmt,pipe(){return ce(this,arguments)}},yM=(e)=>de(e,dO)||mn(e),x9=p(2,(e,t)=>{let r=Object.create(ja);return r._tag=Xq,r.acquire=()=>e,r.finalizer=t,r}),mO=p(2,(e,t)=>{let r=Object.create(ja);return r._tag=fO,r.channel=e,r.k=new pO(go,t),r}),Pg=(e)=>no(()=>{let t=[];return he(kt(e,T_e(t)),(r)=>rd(()=>[Fr(t),r]))}),T_e=(e)=>ln({onInput:(t)=>he(rd(()=>{e.push(t)}),()=>T_e(e)),onFailure:yr,onDone:_o});var pB=(e,t,r)=>{let n=Object.create(ja);return n._tag=xM,n.combineInners=t,n.combineAll=r,n.onPull=()=>g9(R()),n.onEmit=()=>d9,n.value=()=>e,n.k=te,n},y9=p(4,(e,t,r,n)=>{let o=Object.create(ja);return o._tag=xM,o.combineInners=r,o.combineAll=n,o.onPull=()=>g9(R()),o.onEmit=()=>d9,o.value=()=>e,o.k=t,o});var hO=p(2,(e,t)=>{let r=Object.create(ja);return r._tag=eB,r.input=t,r.channel=e,r}),RS=p(2,(e,t)=>{let r=Object.create(ja);return r._tag=rB,r.channel=e,r.finalizer=t,r}),yr=(e)=>ht(Cp(e));var ht=(e)=>SM(()=>e),SM=(e)=>{let t=Object.create(ja);return t._tag=nB,t.error=e,t},he=p(2,(e,t)=>{let r=Object.create(ja);return r._tag=fO,r.channel=e,r.k=new pO(t,ht),r}),aw=p(2,(e,t)=>{let r=Object.create(ja);return r._tag=fO,r.channel=e,r.k=new pO(t.onSuccess,t.onFailure),r}),Ye=(e)=>{let t=Object.create(ja);return t._tag=oB,t.effect=()=>e,t},kt=p(2,(e,t)=>{let r=Object.create(ja);return r._tag=sB,r.left=()=>e,r.right=()=>t,r}),MS=p(2,(e,t)=>{let r=Object.create(ja);return r._tag=iB,r.context=()=>t,r.inner=e,r});var ln=(e)=>tr({onInput:e.onInput,onFailure:(t)=>Ir(Bf(t),{onLeft:e.onFailure,onRight:ht}),onDone:e.onDone}),tr=(e)=>{let t=Object.create(ja);return t._tag=aB,t.more=e.onInput,t.done=new pO(e.onDone,e.onFailure),t},go=(e)=>rd(()=>e),_o=(e)=>{let t=Object.create(ja);return t._tag=lB,t.terminal=e,t},no=(e)=>{let t=Object.create(ja);return t._tag=uB,t.channel=e,t},rd=(e)=>{let t=Object.create(ja);return t._tag=cB,t.evaluate=e,t},it=_o(void 0);var Se=(e)=>{let t=Object.create(ja);return t._tag=tB,t.out=e,t};var PS="Done",DS="Emit",Dg="FromEffect",FS="Read";var Xmt=Symbol.for("effect/ChannelState"),eht={_E:(e)=>e,_R:(e)=>e},fB={[Xmt]:eht},lw=()=>{let e=Object.create(fB);return e._tag=PS,e},dB=()=>{let e=Object.create(fB);return e._tag=DS,e},gO=(e)=>{let t=Object.create(fB);return t._tag=Dg,t.effect=e,t},mB=(e,t,r,n)=>{let o=Object.create(fB);return o._tag=FS,o.upstream=e,o.onEffect=t,o.onEmit=r,o.onDone=n,o};var EM=(e)=>e._tag===Dg;var R_e=(e)=>EM(e)?e.effect:me,E9=(e)=>EM(e)?HC(e.effect):void 0;var b9="PullFromChild",hB="PullFromUpstream",gB="DrainChildExecutors",C9="Emit";class xO{childExecutor;parentSubexecutor;onEmit;_tag=b9;constructor(e,t,r){this.childExecutor=e,this.parentSubexecutor=t,this.onEmit=r}close(e){let t=this.childExecutor.close(e),r=this.parentSubexecutor.close(e);if(t!==void 0&&r!==void 0)return ca(ns(t),ns(r),(n,o)=>d(n,Qy(o)));else if(t!==void 0)return t;else if(r!==void 0)return r;else return}enqueuePullFromChild(e){return this}}class NS{upstreamExecutor;createChild;lastDone;activeChildExecutors;combineChildResults;combineWithChildResult;onPull;onEmit;_tag=hB;constructor(e,t,r,n,o,s,i,a){this.upstreamExecutor=e,this.createChild=t,this.lastDone=r,this.activeChildExecutors=n,this.combineChildResults=o,this.combineWithChildResult=s,this.onPull=i,this.onEmit=a}close(e){let t=this.upstreamExecutor.close(e),n=[...this.activeChildExecutors.map((o)=>o!==void 0?o.childExecutor.close(e):void 0),t].reduce((o,s)=>{if(o!==void 0&&s!==void 0)return ca(o,ns(s),(i,a)=>Qy(i,a));else if(o!==void 0)return o;else if(s!==void 0)return ns(s);else return},void 0);return n===void 0?n:n}enqueuePullFromChild(e){return new NS(this.upstreamExecutor,this.createChild,this.lastDone,[...this.activeChildExecutors,e],this.combineChildResults,this.combineWithChildResult,this.onPull,this.onEmit)}}class uw{upstreamExecutor;lastDone;activeChildExecutors;upstreamDone;combineChildResults;combineWithChildResult;onPull;_tag=gB;constructor(e,t,r,n,o,s,i){this.upstreamExecutor=e,this.lastDone=t,this.activeChildExecutors=r,this.upstreamDone=n,this.combineChildResults=o,this.combineWithChildResult=s,this.onPull=i}close(e){let t=this.upstreamExecutor.close(e),n=[...this.activeChildExecutors.map((o)=>o!==void 0?o.childExecutor.close(e):void 0),t].reduce((o,s)=>{if(o!==void 0&&s!==void 0)return ca(o,ns(s),(i,a)=>Qy(i,a));else if(o!==void 0)return o;else if(s!==void 0)return ns(s);else return},void 0);return n===void 0?n:n}enqueuePullFromChild(e){return new uw(this.upstreamExecutor,this.lastDone,[...this.activeChildExecutors,e],this.upstreamDone,this.combineChildResults,this.combineWithChildResult,this.onPull)}}class bM{value;next;_tag=C9;constructor(e,t){this.value=e,this.next=t}close(e){let t=this.next.close(e);return t===void 0?t:t}enqueuePullFromChild(e){return this}}var M_e="Pulled",P_e="NoUpstream";var oht="effect/ChannelUpstreamPullRequest",sht=Symbol.for(oht),iht={_A:(e)=>e},D_e={[sht]:iht},w9=(e)=>{let t=Object.create(D_e);return t._tag=M_e,t.value=e,t},F_e=(e)=>{let t=Object.create(D_e);return t._tag=P_e,t.activeDownstreamCount=e,t};class LS{_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(e,t,r){this._currentChannel=e,this._executeCloseLastSubstream=r,this._providedEnv=t}run(){let e=void 0;while(e===void 0)if(this._cancelled!==void 0)e=this.processCancellation();else if(this._activeSubexecutor!==void 0)e=this.runSubexecutor();else try{if(this._currentChannel===void 0)e=lw();else{if(mn(this._currentChannel))this._currentChannel=Ye(this._currentChannel);switch(this._currentChannel._tag){case Xq:{e=this.runBracketOut(this._currentChannel);break}case eB:{let t=this._currentChannel.input;if(this._currentChannel=this._currentChannel.channel,this._input!==void 0){let r=this._input;this._input=void 0;let n=()=>L(t.awaitRead(),()=>Qe(()=>{let o=r.run();switch(o._tag){case PS:return to(r.getDone(),{onFailure:(s)=>t.error(s),onSuccess:(s)=>t.done(s)});case DS:return L(t.emit(r.getEmit()),()=>n());case Dg:return os(o.effect,{onFailure:(s)=>t.error(s),onSuccess:()=>n()});case FS:return yB(o,()=>n(),(s)=>t.error(s))}}));e=gO(L(vp(an(n())),(o)=>Ce(()=>this.addFinalizer((s)=>L(Ts(o),()=>Qe(()=>{let i=this.restorePipe(s,r);return i!==void 0?i:me}))))))}break}case xM:{let t=new LS(this._currentChannel.value(),this._providedEnv,(n)=>Ce(()=>{let o=this._closeLastSubstream===void 0?me:this._closeLastSubstream;this._closeLastSubstream=d(o,ve(n))}));t._input=this._input;let r=this._currentChannel;this._activeSubexecutor=new NS(t,(n)=>r.k(n),void 0,[],(n,o)=>r.combineInners(n,o),(n,o)=>r.combineAll(n,o),(n)=>r.onPull(n),(n)=>r.onEmit(n)),this._closeLastSubstream=void 0,this._currentChannel=void 0;break}case tB:{this._emitted=this._currentChannel.out,this._currentChannel=this._activeSubexecutor!==void 0?void 0:it,e=dB();break}case rB:{this.runEnsuring(this._currentChannel);break}case nB:{e=this.doneHalt(this._currentChannel.error());break}case fO:{this._doneStack.push(this._currentChannel.k),this._currentChannel=this._currentChannel.channel;break}case oB:{let t=this._providedEnv===void 0?this._currentChannel.effect():d(this._currentChannel.effect(),Vo(this._providedEnv));e=gO(os(t,{onFailure:(r)=>{let n=this.doneHalt(r);return n!==void 0&&EM(n)?n.effect:me},onSuccess:(r)=>{let n=this.doneSucceed(r);return n!==void 0&&EM(n)?n.effect:me}}));break}case sB:{let t=this._input,r=new LS(this._currentChannel.left(),this._providedEnv,(n)=>this._executeCloseLastSubstream(n));r._input=t,this._input=r,this.addFinalizer((n)=>{let o=this.restorePipe(n,t);return o!==void 0?o:me}),this._currentChannel=this._currentChannel.right();break}case iB:{let t=this._providedEnv;this._providedEnv=this._currentChannel.context(),this._currentChannel=this._currentChannel.inner,this.addFinalizer(()=>Ce(()=>{this._providedEnv=t}));break}case aB:{let t=this._currentChannel;e=mB(this._input,te,(r)=>{try{this._currentChannel=t.more(r)}catch(n){this._currentChannel=t.done.onExit(hu(n))}return},(r)=>{let n=(o)=>t.done.onExit(o);this._currentChannel=n(r);return});break}case cB:{e=this.doneSucceed(this._currentChannel.evaluate());break}case lB:{e=this.doneSucceed(this._currentChannel.terminal);break}case uB:{this._currentChannel=this._currentChannel.channel();break}}}}catch(t){this._currentChannel=ht(oa(t))}return e}getDone(){return this._done}getEmit(){return this._emitted}cancelWith(e){this._cancelled=e}clearInProgressFinalizer(){this._inProgressFinalizer=void 0}storeInProgressFinalizer(e){this._inProgressFinalizer=e}popAllFinalizers(e){let t=[],r=this._doneStack.pop();while(r){if(r._tag==="ContinuationFinalizer")t.push(r.finalizer);r=this._doneStack.pop()}let n=t.length===0?me:I9(t,e);return this.storeInProgressFinalizer(n),n}popNextFinalizers(){let e=[];while(this._doneStack.length!==0){let t=this._doneStack[this._doneStack.length-1];if(t._tag===uO)return e;e.push(t),this._doneStack.pop()}return e}restorePipe(e,t){let r=this._input;if(this._input=t,r!==void 0)return r.close(e);return me}close(e){let t=void 0,r=this._inProgressFinalizer;if(r!==void 0)t=d(r,qa(Ce(()=>this.clearInProgressFinalizer())));let n=void 0,o=this.popAllFinalizers(e);if(o!==void 0)n=d(o,qa(Ce(()=>this.clearInProgressFinalizer())));let s=this._activeSubexecutor===void 0?void 0:this._activeSubexecutor.close(e);if(s===void 0&&t===void 0&&n===void 0)return;return d(ns(k9(s)),Ns(ns(k9(t))),Ns(ns(k9(n))),W(([[i,a],c])=>d(i,Qy(a),Qy(c))),Vf,L((i)=>Qe(()=>i)))}doneSucceed(e){if(this._doneStack.length===0)return this._done=Nt(e),this._currentChannel=void 0,lw();let t=this._doneStack[this._doneStack.length-1];if(t._tag===uO){this._doneStack.pop(),this._currentChannel=t.onSuccess(e);return}let r=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=r.reverse(),this._done=Nt(e),this._currentChannel=void 0,lw();let n=I9(r.map((s)=>s.finalizer),Nt(e));this.storeInProgressFinalizer(n);let o=d(n,qa(Ce(()=>this.clearInProgressFinalizer())),Vf,L(()=>Ce(()=>this.doneSucceed(e))));return gO(o)}doneHalt(e){if(this._doneStack.length===0)return this._done=gr(e),this._currentChannel=void 0,lw();let t=this._doneStack[this._doneStack.length-1];if(t._tag===uO){this._doneStack.pop();try{this._currentChannel=t.onHalt(e)}catch(s){this._currentChannel=ht(oa(s))}return}let r=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=r.reverse(),this._done=gr(e),this._currentChannel=void 0,lw();let n=I9(r.map((s)=>s.finalizer),gr(e));this.storeInProgressFinalizer(n);let o=d(n,qa(Ce(()=>this.clearInProgressFinalizer())),Vf,L(()=>Ce(()=>this.doneHalt(e))));return gO(o)}processCancellation(){return this._currentChannel=void 0,this._done=this._cancelled,this._cancelled=void 0,lw()}runBracketOut(e){let t=Vf(os(this.provide(e.acquire()),{onFailure:(r)=>Ce(()=>{this._currentChannel=ht(r)}),onSuccess:(r)=>Ce(()=>{this.addFinalizer((n)=>this.provide(e.finalizer(r,n))),this._currentChannel=Se(r)})}));return gO(t)}provide(e){if(this._providedEnv===void 0)return e;return d(e,Vo(this._providedEnv))}runEnsuring(e){this.addFinalizer(e.finalizer),this._currentChannel=e.channel}addFinalizer(e){this._doneStack.push(new m9(e))}runSubexecutor(){let e=this._activeSubexecutor;switch(e._tag){case b9:return this.pullFromChild(e.childExecutor,e.parentSubexecutor,e.onEmit,e);case hB:return this.pullFromUpstream(e);case gB:return this.drainChildExecutors(e);case C9:return this._emitted=e.value,this._activeSubexecutor=e.next,dB()}}replaceSubexecutor(e){this._currentChannel=void 0,this._activeSubexecutor=e}finishWithExit(e){let t=to(e,{onFailure:(r)=>this.doneHalt(r),onSuccess:(r)=>this.doneSucceed(r)});return this._activeSubexecutor=void 0,t===void 0?me:R_e(t)}finishSubexecutorWithCloseEffect(e,...t){this.addFinalizer(()=>d(t,en((n)=>d(Ce(()=>n(e)),L((o)=>o!==void 0?o:me)),{discard:!0})));let r=d(e,to({onFailure:(n)=>this.doneHalt(n),onSuccess:(n)=>this.doneSucceed(n)}));return this._activeSubexecutor=void 0,r}applyUpstreamPullStrategy(e,t,r){switch(r._tag){case Zq:{let n=!e||t.some((o)=>o!==void 0);return[r.emitSeparator,n?[void 0,...t]:t]}case h9:{let n=!e||t.some((o)=>o!==void 0);return[r.emitSeparator,n?[...t,void 0]:t]}}}pullFromChild(e,t,r,n){return mB(e,te,(o)=>{let s=r(o);switch(s._tag){case Yq:break;case p9:{this.finishWithDoneValue(e,t,s.value);break}case f9:{let i=t.enqueuePullFromChild(n);this.replaceSubexecutor(i);break}}this._activeSubexecutor=new bM(o,this._activeSubexecutor);return},to({onFailure:(o)=>{let s=this.handleSubexecutorFailure(e,t,o);return s===void 0?void 0:E9(s)},onSuccess:(o)=>{this.finishWithDoneValue(e,t,o);return}}))}finishWithDoneValue(e,t,r){let n=t;switch(n._tag){case hB:{let o=new NS(n.upstreamExecutor,n.createChild,n.lastDone!==void 0?n.combineChildResults(n.lastDone,r):r,n.activeChildExecutors,n.combineChildResults,n.combineWithChildResult,n.onPull,n.onEmit);this._closeLastSubstream=e.close(Nt(r)),this.replaceSubexecutor(o);break}case gB:{let o=new uw(n.upstreamExecutor,n.lastDone!==void 0?n.combineChildResults(n.lastDone,r):r,n.activeChildExecutors,n.upstreamDone,n.combineChildResults,n.combineWithChildResult,n.onPull);this._closeLastSubstream=e.close(Nt(r)),this.replaceSubexecutor(o);break}default:break}}handleSubexecutorFailure(e,t,r){return this.finishSubexecutorWithCloseEffect(gr(r),(n)=>t.close(n),(n)=>e.close(n))}pullFromUpstream(e){if(e.activeChildExecutors.length===0)return this.performPullFromUpstream(e);let t=e.activeChildExecutors[0],r=new NS(e.upstreamExecutor,e.createChild,e.lastDone,e.activeChildExecutors.slice(1),e.combineChildResults,e.combineWithChildResult,e.onPull,e.onEmit);if(t===void 0)return this.performPullFromUpstream(r);this.replaceSubexecutor(new xO(t.childExecutor,r,t.onEmit));return}performPullFromUpstream(e){return mB(e.upstreamExecutor,(t)=>{let r=this._closeLastSubstream===void 0?me:this._closeLastSubstream;return this._closeLastSubstream=void 0,d(this._executeCloseLastSubstream(r),ve(t))},(t)=>{if(this._closeLastSubstream!==void 0){let s=this._closeLastSubstream;return this._closeLastSubstream=void 0,d(this._executeCloseLastSubstream(s),W(()=>{let i=new LS(e.createChild(t),this._providedEnv,this._executeCloseLastSubstream);i._input=this._input;let[a,c]=this.applyUpstreamPullStrategy(!1,e.activeChildExecutors,e.onPull(w9(t)));if(this._activeSubexecutor=new xO(i,new NS(e.upstreamExecutor,e.createChild,e.lastDone,c,e.combineChildResults,e.combineWithChildResult,e.onPull,e.onEmit),e.onEmit),Oe(a))this._activeSubexecutor=new bM(a.value,this._activeSubexecutor);return}))}let r=new LS(e.createChild(t),this._providedEnv,this._executeCloseLastSubstream);r._input=this._input;let[n,o]=this.applyUpstreamPullStrategy(!1,e.activeChildExecutors,e.onPull(w9(t)));if(this._activeSubexecutor=new xO(r,new NS(e.upstreamExecutor,e.createChild,e.lastDone,o,e.combineChildResults,e.combineWithChildResult,e.onPull,e.onEmit),e.onEmit),Oe(n))this._activeSubexecutor=new bM(n.value,this._activeSubexecutor);return},(t)=>{if(e.activeChildExecutors.some((o)=>o!==void 0)){let o=new uw(e.upstreamExecutor,e.lastDone,[void 0,...e.activeChildExecutors],e.upstreamExecutor.getDone(),e.combineChildResults,e.combineWithChildResult,e.onPull);if(this._closeLastSubstream!==void 0){let s=this._closeLastSubstream;return this._closeLastSubstream=void 0,d(this._executeCloseLastSubstream(s),W(()=>this.replaceSubexecutor(o)))}this.replaceSubexecutor(o);return}let r=this._closeLastSubstream,n=this.finishSubexecutorWithCloseEffect(d(t,tA((o)=>e.combineWithChildResult(e.lastDone,o))),()=>r,(o)=>e.upstreamExecutor.close(o));return n===void 0?void 0:E9(n)})}drainChildExecutors(e){if(e.activeChildExecutors.length===0){let o=this._closeLastSubstream;if(o!==void 0)this.addFinalizer(()=>N(o));return this.finishSubexecutorWithCloseEffect(e.upstreamDone,()=>o,(s)=>e.upstreamExecutor.close(s))}let t=e.activeChildExecutors[0],r=e.activeChildExecutors.slice(1);if(t===void 0){let[o,s]=this.applyUpstreamPullStrategy(!0,r,e.onPull(F_e(r.reduce((i,a)=>a!==void 0?i+1:i,0))));if(this.replaceSubexecutor(new uw(e.upstreamExecutor,e.lastDone,s,e.upstreamDone,e.combineChildResults,e.combineWithChildResult,e.onPull)),Oe(o))return this._emitted=o.value,dB();return}let n=new uw(e.upstreamExecutor,e.lastDone,r,e.upstreamDone,e.combineChildResults,e.combineWithChildResult,e.onPull);this.replaceSubexecutor(new xO(t.childExecutor,n,t.onEmit));return}}var k9=(e)=>e!==void 0?e:me,I9=(e,t)=>d(en(e,(r)=>ns(r(t))),W((r)=>d(n8(r),Je(()=>ta))),L((r)=>Qe(()=>r))),yB=(e,t,r)=>{let n=[e],o=()=>{let s=n.pop();if(s===void 0||s.upstream===void 0)return $f("Unexpected end of input for channel execution");let i=s.upstream.run();switch(i._tag){case DS:{let a=s.onEmit(s.upstream.getEmit());if(n.length===0){if(a===void 0)return Qe(t);return d(a,os({onFailure:r,onSuccess:t}))}if(a===void 0)return Qe(()=>o());return d(a,os({onFailure:r,onSuccess:()=>o()}))}case PS:{let a=s.onDone(s.upstream.getDone());if(n.length===0){if(a===void 0)return Qe(t);return d(a,os({onFailure:r,onSuccess:t}))}if(a===void 0)return Qe(()=>o());return d(a,os({onFailure:r,onSuccess:()=>o()}))}case Dg:return n.push(s),d(s.onEffect(i.effect),tn((a)=>Qe(()=>{let c=s.onDone(gr(a));return c===void 0?me:c})),os({onFailure:r,onSuccess:()=>o()}));case FS:return n.push(s),n.push(i),Qe(()=>o())}};return o()},Rl=p(2,(e,t)=>{let r=(n,o,s)=>xS(Ce(()=>new LS(e,void 0,te)),(i)=>Qe(()=>xB(i.run(),i).pipe(WC(n),ve(Wt(n)),Ba(Wt(o)))),(i,a)=>{let c=i.close(a);if(c===void 0)return me;return Iu(c,(l)=>Ti(s,On(l)))});return wu((n)=>Ha([Z0(t,WI),_r(),_r()]).pipe(L(([o,s,i])=>n(r(s,i,o)).pipe(hn(t),L((a)=>t.addFinalizer((c)=>{let l=Fa(c)?K0(c.cause):void 0;return dS(s).pipe(L((u)=>u?mo(i,void 0).pipe(ve(sS(a)),ve(A5(a))):mo(i,void 0).pipe(ve(l&&jh(l)>0?EA(a,hfe(l)):Ts(a)),ve(A5(a)))))}).pipe(ve(n(Wt(s)))))))))}),xB=(e,t)=>{let r=e;switch(r._tag){case Dg:return d(r.effect,L(()=>xB(t.run(),t)));case DS:return xB(t.run(),t);case PS:return Qe(()=>t.getDone());case FS:return yB(r,()=>xB(t.run(),t),On)}};var SB="Done",N_e="Await";var cht="effect/ChannelMergeDecision",U_e=Symbol.for(cht),H_e={[U_e]:{_R:(e)=>e,_E0:(e)=>e,_Z0:(e)=>e,_E:(e)=>e,_Z:(e)=>e}},Fg=(e)=>{let t=Object.create(H_e);return t._tag=SB,t.effect=e,t},Ng=(e)=>{let t=Object.create(H_e);return t._tag=N_e,t.f=e,t};var EB="BothRunning",bB="LeftDone",CB="RightDone";var lht="effect/ChannelMergeState",B_e=Symbol.for(lht),_9={[B_e]:B_e},wB=(e,t)=>{let r=Object.create(_9);return r._tag=EB,r.left=e,r.right=t,r},v9=(e)=>{let t=Object.create(_9);return t._tag=bB,t.f=e,t},T9=(e)=>{let t=Object.create(_9);return t._tag=CB,t.f=e,t};var R9="BackPressure",M9="BufferSliding";var fht="effect/ChannelMergeStrategy",W_e=Symbol.for(fht),z_e={[W_e]:W_e},$_e=(e)=>{let t=Object.create(z_e);return t._tag=R9,t},j_e=(e)=>{let t=Object.create(z_e);return t._tag=M9,t};var V_e=p(2,(e,{onBackPressure:t,onBufferSliding:r})=>{switch(e._tag){case R9:return t();case M9:return r()}});var yO="Empty",CM="Emit",wM="Error",kM="Done",K_e=(e)=>({_tag:yO,notifyProducer:e}),P9=(e)=>({_tag:CM,notifyConsumers:e}),dht=(e)=>({_tag:wM,cause:e}),mht=(e)=>({_tag:kM,done:e});class J_e{ref;constructor(e){this.ref=e}awaitRead(){return aa(mu(this.ref,(e)=>e._tag===yO?[Wt(e.notifyProducer),e]:[me,e]))}get close(){return DA((e)=>this.error(Zy(e)))}done(e){return aa(mu(this.ref,(t)=>{switch(t._tag){case yO:return[Wt(t.notifyProducer),t];case CM:return[en(t.notifyConsumers,(r)=>mo(r,Ie(e)),{discard:!0}),mht(e)];case wM:return[ia,t];case kM:return[ia,t]}}))}emit(e){return L(_r(),(t)=>aa(mu(this.ref,(r)=>{switch(r._tag){case yO:return[Wt(r.notifyProducer),r];case CM:{let n=r.notifyConsumers[0],o=r.notifyConsumers.slice(1);if(n!==void 0)return[mo(n,ye(e)),o.length===0?K_e(t):P9(o)];throw Error("Bug: Channel.SingleProducerAsyncInput.emit - Queue was empty! please report an issue at https://github.com/Effect-TS/effect/issues")}case wM:return[ia,r];case kM:return[ia,r]}})))}error(e){return aa(mu(this.ref,(t)=>{switch(t._tag){case yO:return[Wt(t.notifyProducer),t];case CM:return[en(t.notifyConsumers,(r)=>bu(r,e),{discard:!0}),dht(e)];case wM:return[ia,t];case kM:return[ia,t]}}))}get take(){return this.takeWith((e)=>gr(fc(e,Ie)),(e)=>Nt(e),(e)=>Xr(ye(e)))}takeWith(e,t,r){return L(_r(),(n)=>aa(mu(this.ref,(o)=>{switch(o._tag){case yO:return[ve(mo(o.notifyProducer,void 0),Ig(Wt(n),{onFailure:e,onSuccess:Ir({onLeft:r,onRight:t})})),P9([n])];case CM:return[Ig(Wt(n),{onFailure:e,onSuccess:Ir({onLeft:r,onRight:t})}),P9([...o.notifyConsumers,n])];case wM:return[N(e(o.cause)),o];case kM:return[N(r(o.done)),o]}})))}}var kB=()=>d(_r(),L((e)=>qn(K_e(e))),W((e)=>new J_e(e)));var IB=(e,t,r)=>he(Ye(qn(()=>me)),(n)=>d(Ye(Vf(sr(e,(o)=>Xi(n,(s)=>r(o,s))))),he(t),RS((o)=>L(sn(n),(s)=>s(o))))),SO=p(2,(e,t)=>qS(e,()=>t));var HS=p(2,(e,t)=>mO(e,(r)=>Ir(Bf(r),{onLeft:t,onRight:ht}))),Dp=p(2,(e,t)=>y9(e,t,()=>{return},()=>{return}));var Fp=(e)=>{let t=tr({onInput:()=>t,onFailure:ht,onDone:go});return kt(e,t)};var pw=p(2,(e,t)=>RS(e,()=>t));var Q_e=(e)=>he(e,te),F9=p(2,(e,t)=>aw(e,{onFailure:(r)=>{let n=Bf(r);switch(n._tag){case"Left":return t.onFailure(n.left);case"Right":return ht(n.right)}},onSuccess:t.onSuccess}));var IM=(e)=>Yt(e.takeWith(ht,(t)=>he(Se(t),()=>IM(e)),go));var OB=(e)=>no(()=>Y_e(e)),Y_e=(e)=>d(Ye($a(e)),he(Ir({onLeft:to({onFailure:ht,onSuccess:_o}),onRight:(t)=>he(Se(t),()=>Y_e(e))}))),Ml=()=>ln({onInput:(e)=>he(Se(e),()=>Ml()),onFailure:yr,onDone:_o}),_B=p(2,(e,t)=>WS(e,{other:Ye(t),onSelfDone:(r)=>Fg(Qe(()=>r)),onOtherDone:(r)=>Fg(Qe(()=>r))})),N9=p(2,(e,t)=>_B(e,Wt(t))),qS=p(2,(e,t)=>he(e,(r)=>rd(()=>t(r))));var vB=p(2,(e,t)=>TB(e,fc(t))),TB=p(2,(e,t)=>mO(e,(r)=>ht(t(r)))),BS=p(2,(e,t)=>{let r=ln({onInput:(n)=>he(Se(t(n)),()=>r),onFailure:yr,onDone:_o});return kt(e,r)}),AM=p(2,(e,t)=>{let r=tr({onInput:(n)=>d(Ye(t(n)),he(Se),he(()=>r)),onFailure:ht,onDone:_o});return kt(e,r)}),RB=p(3,(e,t,r)=>Np((n)=>$e(function*(){let o=yield*kB(),s=IM(o),i=yield*Tl(r);yield*Ti(n,zn(i));let a=yield*_r(),c=r===Number.POSITIVE_INFINITY?(f)=>te:(yield*UA(r)).withPermits;yield*(yield*s.pipe(kt(e),US(n))).pipe(os({onFailure:(f)=>Br(i,On(f)),onSuccess:Ir({onLeft:(f)=>ve(an(c(r)(me)),Xs(Br(i,N(Ie(f))))),onRight:(f)=>$e(function*(){let h=yield*_r(),y=yield*_r();yield*Br(i,W(Wt(h),ye)),yield*mo(y,void 0).pipe(ve(wu((E)=>ns(E(Wt(a))).pipe(aq(ns(E(t(f)))),L(te))).pipe(Iu((E)=>bu(a,E)),WC(h))),c(1),hn(n)),yield*Wt(y)})})}),NA,an,hn(n));let u=Yt(Ig(aa($a(i)),{onFailure:ht,onSuccess:Ir({onLeft:_o,onRight:(f)=>he(Se(f),()=>u)})}));return hO(u,o)}))),Z_e=(e)=>(t)=>X_e(e)(t,wo);var X_e=({bufferSize:e=16,concurrency:t,mergeStrategy:r=$_e()})=>(n,o)=>Np((s)=>$e(function*(){let i=t==="unbounded"?Number.MAX_SAFE_INTEGER:t,a=yield*kB(),c=IM(a),l=yield*Tl(e);yield*Ti(s,zn(l));let u=yield*TS();yield*Ti(s,zn(u));let f=yield*qn(R()),h=yield*_r(),y=(yield*UA(i)).withPermits,E=yield*US(kt(c,n),s);function b(T){return T.pipe(L(Ir({onLeft:(A)=>N(_(A)),onRight:(A)=>qr(Br(l,N(ye(A))),R())})),LA({until:(A)=>Oe(A)}),L((A)=>ea(f,be({onNone:()=>_(A.value),onSome:(k)=>_(o(k,A.value))}))),tn((A)=>Ua(A)?On(A):Br(l,On(A)).pipe(ve(mo(h,void 0)),Xs)))}yield*E.pipe(os({onFailure:(T)=>Br(l,On(T)).pipe(ve(N(!1))),onSuccess:Ir({onLeft:(T)=>SS(an(Wt(h)),an(y(i)(me)),{onSelfDone:(A,k)=>qr(Ts(k),!1),onOtherDone:(A,k)=>ve(Ts(k),sn(f).pipe(L(be({onNone:()=>Br(l,N(Ie(T))),onSome:(O)=>Br(l,N(Ie(o(O,T))))})),qr(!1)))}),onRight:(T)=>V_e(r,{onBackPressure:()=>$e(function*(){let A=yield*_r(),k=PR((P)=>US(kt(c,T),P).pipe(L((D)=>NR(ns(b(D)),ns(an(Wt(h))))),L(te)));return yield*mo(A,void 0).pipe(ve(k),y(1),hn(s)),yield*Wt(A),!(yield*dS(h))}),onBufferSliding:()=>$e(function*(){let A=yield*_r(),k=yield*_r(),O=yield*Kq(u);yield*$a(u).pipe(L((I)=>mo(I,void 0)),Tp(()=>O>=i)),yield*Br(u,A);let P=PR((I)=>US(kt(c,T),I).pipe(L((M)=>ns(b(M)).pipe(NR(ns(an(Wt(h)))),NR(ns(an(Wt(A)))))),L(te)));return yield*mo(k,void 0).pipe(ve(P),y(1),hn(s)),yield*Wt(k),!(yield*dS(h))})})})}),LA({while:(T)=>T}),hn(s));let w=d($a(l),aa,Ig({onFailure:ht,onSuccess:Ir({onLeft:_o,onRight:(T)=>he(Se(T),()=>w)})}),Yt);return hO(w,a)})),MB=p(3,(e,t,r)=>Z_e(r)(BS(e,t)));var WS=p(2,(e,t)=>{function r(n){return $e(function*(){let o=yield*kB(),s=IM(o),i=yield*US(kt(s,e),n),a=yield*US(kt(s,t.other),n);function c(u,f,h){return(y,E,b)=>{function w(T){let A=T;if(A._tag===SB)return N(Ye(ve(Ts(f),A.effect)));return W(sS(f),to({onFailure:(k)=>Ye(A.f(gr(k))),onSuccess:Ir({onLeft:(k)=>Ye(A.f(Nt(k))),onRight:(k)=>ir(Se(k),l(b(A.f)))})}))}return to(u,{onFailure:(T)=>w(y(gr(T))),onSuccess:Ir({onLeft:(T)=>w(y(Nt(T))),onRight:(T)=>N(he(Se(T),()=>he(Ye(hn(an(h),n)),(A)=>l(E(A,f)))))})})}}function l(u){switch(u._tag){case EB:{let f=an(qc(u.left)),h=an(qc(u.right));return Yt(SS(f,h,{onSelfDone:(y,E)=>ve(Ts(E),c(y,u.right,i)(t.onSelfDone,wB,(b)=>v9(b))),onOtherDone:(y,E)=>ve(Ts(E),c(y,u.left,a)(t.onOtherDone,(b,w)=>wB(w,b),(b)=>T9(b)))}))}case bB:return Yt(W(ns(a),to({onFailure:(f)=>Ye(u.f(gr(f))),onSuccess:Ir({onLeft:(f)=>Ye(u.f(Nt(f))),onRight:(f)=>he(Se(f),()=>l(v9(u.f)))})})));case CB:return Yt(W(ns(i),to({onFailure:(f)=>Ye(u.f(gr(f))),onSuccess:Ir({onLeft:(f)=>Ye(u.f(Nt(f))),onRight:(f)=>he(Se(f),()=>l(T9(u.f)))})})))}}return Ye(Zs((u)=>{let f=Zs((E)=>(E.transferChildren(u.scope()),me)),h=an(i).pipe(qa(f),hn(n)),y=an(a).pipe(qa(f),hn(n));return ca(h,y,(E,b)=>wB(E,b))})).pipe(he(l),hO(o))})}return Np(r)});var L9=p(2,(e,t)=>HS(e,(r)=>SM(()=>oa(t(r))))),PB=p(2,(e,t)=>HS(e,t)),xo=p(2,(e,t)=>no(()=>{let r=void 0,n=ln({onInput:(s)=>he(Se(s),()=>n),onFailure:(s)=>(r=nve(s),ht(oa(r))),onDone:_o}),o=tr({onInput:(s)=>d(Se(s),he(()=>o)),onFailure:(s)=>G0(s)&&ove(s.defect)&&ge(s.defect,r)?yr(s.defect.error):ht(s),onDone:_o});return kt(kt(kt(e,n),t),o)}));var OM=(e)=>he(e,()=>OM(e)),fw=(e)=>PR((t)=>Rl(e,t));var U9=(e)=>fw(Fp(e)),EO=(e)=>MR((t)=>Rl(e,t)),DB=(e)=>Yt(wu((t)=>W(X0(),(r)=>x9(Iu(t(rS(e,r)),(n)=>tS(r,gr(n))),(n,o)=>tS(r,o))))),FB=(e)=>nd(W(Mm,(t)=>he(Ye(e(t)),Se)));var H9=()=>no(()=>{let e="",t=!1,r=(o)=>{let s=[];return Vr(o,(i)=>{if(i.length!==0){let a=0,c=i.indexOf("\r"),l=i.indexOf(`
|
|
186
|
+
`);if(t){if(l===0)s.push(e),e="",a=1,l=i.indexOf(`
|
|
187
|
+
`,a);else e=e+"\r";t=!1}while(c!==-1||l!==-1)if(c===-1||l!==-1&&l<c){if(e.length===0)s.push(i.substring(a,l));else s.push(e+i.substring(a,l)),e="";a=l+1,l=i.indexOf(`
|
|
188
|
+
`,a)}else if(i.length===c+1)t=!0,c=-1;else if(l===c+1){if(e.length===0)s.push(i.substring(a,c));else e=e+i.substring(a,c),s.push(e),e="";a=c+2,c=i.indexOf("\r",a),l=i.indexOf(`
|
|
189
|
+
`,a)}else c=i.indexOf("\r",c+1);if(t)e=e+i.substring(a,i.length-1);else e=e+i.substring(a,i.length)}}),nt(s)},n=tr({onInput:(o)=>{let s=r(o);return At(s)?n:he(Se(s),()=>n)},onFailure:(o)=>e.length===0?ht(o):he(Se(We(e)),()=>ht(o)),onDone:(o)=>e.length===0?go(o):he(Se(We(e)),()=>go(o))});return n}),q9=(e)=>eve(e),B9=(e)=>L(Mm,(t)=>US(e,t)),US=p(2,(e,t)=>Ns(Ce(()=>new LS(e,void 0,te)),Wc()).pipe(sr(([r,n])=>OC(t,(o)=>{let s=r.close(o);return s!==void 0?Vo(s,n):me})),Vf,W(([r])=>Qe(()=>D9(r.run(),r))))),D9=(e,t)=>{let r=e;switch(r._tag){case PS:return to(t.getDone(),{onFailure:On,onSuccess:(n)=>N(Ie(n))});case DS:return N(ye(t.getEmit()));case Dg:return d(r.effect,L(()=>D9(t.run(),t)));case FS:return yB(r,()=>D9(t.run(),t),(n)=>On(n))}},eve=(e)=>no(()=>tve(e)),tve=(e)=>tr({onInput:(t)=>he(Ye(Br(e,ye(t))),()=>tve(e)),onFailure:(t)=>Ye(Br(e,Ie(gr(t)))),onDone:(t)=>Ye(Br(e,Ie(Nt(t))))}),Yt=(e)=>Q_e(Ye(e)),nd=(e)=>pB(DB(e),(t,r)=>t,(t,r)=>t),Np=(e)=>pB(FB(e),(t,r)=>t,(t,r)=>t);var NB=function(){let e=typeof arguments[0]!=="string",t=e?arguments[1]:arguments[0],r=Da(e?arguments[2]:arguments[1]),n=Ha([JQ(t,r),Pn(),FQ,Fq(eOe)]);if(e){let o=arguments[0];return IB(n,([s,i])=>MS(o,or(i,vs,s)),([s,,i,a],c)=>eA(s,c,i,a))}return(o)=>IB(n,([s,i])=>MS(o,or(i,vs,s)),([s,,i,a],c)=>eA(s,c,i,a))},W9=(...e)=>pa(Fr(e)),pa=(e)=>rve(0,e.length,e),rve=(e,t,r)=>e===t?it:d(Se(d(r,dn(e))),he(()=>rve(e+1,t,r))),z9=p((e)=>yM(e[1]),(e,t,r)=>r?.concurrent?WS(e,{other:t,onSelfDone:(n)=>Ng((o)=>Qe(()=>bU(n,o))),onOtherDone:(n)=>Ng((o)=>Qe(()=>bU(o,n)))}):he(e,(n)=>qS(t,(o)=>[n,o]))),LB=p((e)=>yM(e[1]),(e,t,r)=>r?.concurrent?qS(z9(e,t,{concurrent:!0}),(n)=>n[0]):he(e,(n)=>SO(t,n))),ir=p((e)=>yM(e[1]),(e,t,r)=>r?.concurrent?qS(z9(e,t,{concurrent:!0}),(n)=>n[1]):he(e,()=>t)),AB=Symbol.for("effect/Channel/ChannelException"),nve=(e)=>({_tag:"ChannelException",[AB]:AB,error:e}),ove=(e)=>de(e,AB);var bO=Symbol.for("effect/Sink"),Cht={_A:(e)=>e,_In:(e)=>e,_L:(e)=>e,_E:(e)=>e,_R:(e)=>e};class Fi{channel;[bO]=Cht;constructor(e){this.channel=e}pipe(){return ce(this,arguments)}}var sve=(e)=>de(e,bO),CO=(e)=>new Fi(no(()=>Di(e())));var $9=()=>new Fi(ive(Ze())),ive=(e)=>tr({onInput:(t)=>ive(d(e,Vt(t))),onFailure:ht,onDone:()=>go(e)}),j9=(e)=>CO(()=>MM(ave(e,Ze()))),ave=(e,t)=>tr({onInput:(r)=>{let[n,o]=dy(r,e);if(n.length<e)return ave(e-n.length,Vt(t,n));if(At(o))return go(Vt(t,n));return he(Se(o),()=>go(Vt(t,n)))},onFailure:ht,onDone:()=>go(t)});var V9=(e)=>new Fi(d(Pg(Di(e)),qS(([t,r])=>[r,nT(t)])));var UB=new Fi(Fp(Ml()));var vM=(e)=>new Fi(yr(e));var TM=(e,t,r)=>CO(()=>new Fi(cve(e,t,r))),cve=(e,t,r)=>{if(!t(e))return _o(e);return ln({onInput:(n)=>{let[o,s]=lve(e,n,t,r,0,n.length);if(kn(s))return d(Se(s),SO(o));return cve(o,t,r)},onFailure:yr,onDone:()=>_o(e)})},lve=(e,t,r,n,o,s)=>{if(o===s)return[e,Ze()];let i=n(e,d(t,dn(o)));if(r(i))return lve(i,t,r,n,o+1,s);return[i,d(t,Zr(o+1))]},HB=p(2,(e,t)=>{let r=d(Di(e),Pg,F9({onFailure:(n)=>Di(t.onFailure(n)),onSuccess:([n,o])=>no(()=>{let s={ref:d(n,sp(kn))},i=d(rd(()=>{let l=s.ref;return s.ref=Ze(),l}),he((l)=>pa(l))),a=Ml(),c=d(i,ir(a),kt(Di(t.onSuccess(o))));return he(Pg(c),([l,u])=>d(go(s.ref),he(pa),ir(pa(l)),SO(u)))})}));return new Fi(r)}),uve=(e,t,r)=>CO(()=>new Fi(pve(e,t,r))),pve=(e,t,r)=>{if(!t(e))return _o(e);return ln({onInput:(n)=>pve(r(e,n),t,r),onFailure:yr,onDone:()=>_o(e)})};var qB=(e,t,r)=>CO(()=>new Fi(fve(e,t,r))),fve=(e,t,r)=>{if(!t(e))return _o(e);return ln({onInput:(n)=>d(Ye(wht(e,n,t,r)),he(([o,s])=>d(s,be({onNone:()=>fve(o,t,r),onSome:(i)=>d(Se(i),SO(o))})))),onFailure:yr,onDone:()=>_o(e)})},wht=(e,t,r,n)=>dve(e,t,0,t.length,r,n),dve=(e,t,r,n,o,s)=>{if(r===n)return N([e,R()]);return d(s(e,d(t,dn(r))),L((i)=>o(i)?dve(i,t,r+1,n,o,s):N([i,_(d(t,Zr(r+1)))])))};var wO=(e,t)=>uve(e,uo,t);var mve=p(2,(e,t)=>HB(e,{onFailure:vM,onSuccess:t})),RM=(e)=>{let t=tr({onInput:(r)=>d(Ye(en(r,(n)=>e(n),{discard:!0})),he(()=>t)),onFailure:ht,onDone:()=>it});return new Fi(t)},BB=(e)=>{let t=tr({onInput:(r)=>d(Ye(e(r)),he(()=>t)),onFailure:ht,onDone:()=>it});return new Fi(t)},WB=(e)=>{let t=tr({onInput:(r)=>hve(e,r,0,r.length,t),onFailure:ht,onDone:()=>it});return new Fi(t)},hve=(e,t,r,n,o)=>{if(r===n)return o;return d(Ye(e(d(t,dn(r)))),he((s)=>s?hve(e,t,r+1,n,o):Se(d(t,Zr(r)))),HS((s)=>d(Se(d(t,Zr(r))),ir(yr(s)))))};var MM=(e)=>new Fi(e),zB=(e)=>new Fi(Ye(e));var G9=()=>TM(R(),vt,(e,t)=>be(e,{onNone:()=>_(t),onSome:()=>e}));var K9=()=>wO(R(),(e,t)=>pi(oT(t),()=>e));var J9=p(2,(e,t)=>new Fi(d(Di(e),qS(t))));var gve=p(2,(e,t)=>{function r(n){return $e(function*(){let o=yield*hM(t?.capacity??16),s=yield*rS(Um(o),n),i=yield*rS(Um(o),n),a=q9(o),c=OB(s).pipe(kt(Di(e)),LB(Ye(zn(s))),WS({other:OB(i).pipe(kt(Di(t.other)),LB(Ye(zn(i)))),onSelfDone:t.onSelfDone,onOtherDone:t.onOtherDone})),l=WS(a,{other:c,onSelfDone:()=>Ng(te),onOtherDone:(u)=>Fg(u)});return new Fi(l)})}return yve(r)});var Q9=wO(0,(e,t)=>e+ip(t,0,(r,n)=>r+n));var Di=(e)=>mn(e)?Di(zB(e)):e.channel;var xve=(e)=>new Fi(nd(e.pipe(W((t)=>Di(t))))),yve=(e)=>new Fi(Np((t)=>e(t).pipe(W((r)=>Di(r)))));var Y9=p((e)=>sve(e[1]),(e,t,r)=>Sve(e,t,(n,o)=>o,r)),Sve=p((e)=>sve(e[1]),(e,t,r,n)=>n?.concurrent?gve(e,{other:t,onSelfDone:to({onFailure:(o)=>Fg(On(o)),onSuccess:(o)=>Ng(to({onFailure:On,onSuccess:(s)=>N(r(o,s))}))}),onOtherDone:to({onFailure:(o)=>Fg(On(o)),onSuccess:(o)=>Ng(to({onFailure:On,onSuccess:(s)=>N(r(s,o))}))})}):mve(e,(o)=>J9(t,(s)=>r(o,s))));var Z9=wO(0,(e,t)=>e+t.length),X9=CO(()=>{let e=[];return d(wO(void 0,(t,r)=>Vr(r,(n)=>{e.push(String(n))})),J9(()=>e.join("")))});var bve=Fg,Cve=Ng;var wve=Symbol.for("effect/RcRef"),e7={_tag:"Empty"},Iht={_tag:"Closed"},Aht={_A:te,_E:te};class kve extends Zi{acquire;context;scope;idleTimeToLive;[wve]=Aht;[Nf]=Nf;state=e7;semaphore=nS(1);constructor(e,t,r,n){super();this.acquire=e,this.context=t,this.scope=r,this.idleTimeToLive=n,this.get=t7(this)}get;commit(){return this.get}}var Ive=(e)=>Ot((t)=>{let r=t.getFiberRef(_s),n=er(r,na),o=new kve(e.acquire,r,n,e.idleTimeToLive?ur(e.idleTimeToLive):void 0);return Kr(n.addFinalizer(()=>o.semaphore.withPermits(1)(Re(()=>{let s=o.state._tag==="Acquired"?Nc(o.state.scope,eo):yt;return o.state=Iht,s}))),o)}),t7=(e)=>{let t=e,r=t.idleTimeToLive&&!Xd(t.idleTimeToLive);return Un((n)=>Re(()=>{switch(t.state._tag){case"Closed":return Zn;case"Acquired":return t.state.refCount++,t.state.fiber?Kr(Rf(t.state.fiber),t.state):X(t.state);case"Empty":return Su().pipe(C0("scope"),b0("value",({scope:o})=>n(Xn(t.acquire,_s,or(t.context,na,o)))),xe(({scope:o,value:s})=>{let i={_tag:"Acquired",value:s,scope:o,fiber:void 0,refCount:1};return t.state=i,i}))}})).pipe(t.semaphore.withPermits(1),C0("state"),b0("scope",()=>na),rs(({scope:n,state:o})=>n.addFinalizer(()=>Re(()=>{if(o.refCount--,o.refCount>0||r)return yt;if(t.idleTimeToLive===void 0)return t.state=e7,Nc(o.scope,eo);return bm(t.idleTimeToLive).pipe(vf,Qt(Re(()=>{if(t.state._tag==="Acquired"&&t.state.refCount===0)return t.state=e7,Nc(o.scope,eo);return yt})),La(ue(()=>{o.fiber=void 0})),oS(t.scope),rs((s)=>{o.fiber=s}),t.semaphore.withPermits(1))}))),xe(({state:n})=>n.value))};var $B=Ive,PM=t7;var xc=CA;var jB=cH,Hm=Wf;var DM=lH;var Ove=eCe;var _ve=WH;var zS=CR;var vve=vA;var Tve=hQ;var $S=Mke;var VB=FC;var Rve="Left",Mve="Right",Pve="Both",Dve="Either";var Fve={_tag:Rve},Nve={_tag:Mve},r7={_tag:Pve},Lve={_tag:Dve},n7=(e)=>{switch(e){case"left":return Fve;case"right":return Nve;case"both":return r7;case"either":return Lve;default:return e}};var Hve=r7;class FM{value;constructor(e){this.value=e}}var o7=(e,t)=>({ref:e,isNew:t,isChanged:!1,expected:e.versioned,newValue:e.versioned.value}),s7=(e)=>e.newValue,i7=(e,t)=>{e.isChanged=!0,e.newValue=t},Bve=(e)=>{e.ref.versioned=new FM(e.newValue)};var Wve=(e)=>e.ref.versioned!==e.expected,zve=(e)=>e.isChanged;var NM="Invalid",KB="ReadWrite",Tht="ReadOnly",a7=(e)=>{for(let t of e)Bve(t[1])},c7=(e)=>{let t=Tht;for(let[,r]of e)if(t=Wve(r)?NM:zve(r)?KB:t,t===NM)return t;return t};var jve=(e)=>{let t=new Map;for(let[,r]of e){for(let n of r.ref.todos)t.set(n[0],n[1]);r.ref.todos=new Map}return t},Vve=(e)=>{let t=Array.from(e.entries()).sort((r,n)=>r[0]-n[0]);for(let[r,n]of t)n()},Gve=(e,t,r)=>{let n=!1;for(let[,o]of t)if(!o.ref.todos.has(e))o.ref.todos.set(e,r),n=!0;return n};var l7="WithSTMRuntime",JB="OnFailure",u7="OnRetry",QB="OnSuccess",Kve="Provide",p7="Sync",f7="Succeed",d7="Retry",m7="Fail",h7="Die",g7="Interrupt";var Lg="Fail",Ug="Die",Hg="Interrupt",qm="Succeed",qg="Retry";var LM="Done",UM="Suspend";var HM="Done",YB="Interrupted",qM="Running";var XB="effect/STM/State",dw=Symbol.for(XB),y7=(e)=>de(e,dw),S7=(e)=>e._tag===qM,Qve=(e)=>e._tag===HM;var ZB=(e)=>({[dw]:dw,_tag:HM,exit:e,[Ne](){return d(oe(XB),Ee(oe(HM)),Ee(oe(e)),lt(this))},[Pe](t){return y7(t)&&t._tag===HM&&ge(e,t.exit)}}),Dht=d(oe(XB),Ee(oe(YB)),Ee(oe("interrupted"))),Yve={[dw]:dw,_tag:YB,[Ne](){return Dht},[Pe](e){return y7(e)&&e._tag===YB}},Fht=d(oe(XB),Ee(oe(qM)),Ee(oe("running"))),Zve={[dw]:dw,_tag:qM,[Ne](){return Fht},[Pe](e){return y7(e)&&e._tag===qM}},BM=(e)=>{switch(e._tag){case Lg:return ZB(Xr(e.error));case Ug:return ZB(hu(e.defect));case Hg:return ZB(Jy(e.fiberId));case qm:return ZB(Nt(e.value));case qg:throw Error("BUG: STM.STMState.fromTExit - please report an issue at https://github.com/Effect-TS/effect/issues")}};var IO="effect/TExit",AO=Symbol.for(IO),WM={_A:(e)=>e,_E:(e)=>e},zM=(e)=>de(e,AO);var Xve=(e)=>e._tag===qm,Lht=(e)=>e._tag===qg,eTe=(e)=>({[AO]:WM,_tag:Lg,error:e,[Ne](){return d(oe(IO),Ee(oe(Lg)),Ee(oe(e)),lt(this))},[Pe](t){return zM(t)&&t._tag===Lg&&ge(e,t.error)}}),tTe=(e)=>({[AO]:WM,_tag:Ug,defect:e,[Ne](){return d(oe(IO),Ee(oe(Ug)),Ee(oe(e)),lt(this))},[Pe](t){return zM(t)&&t._tag===Ug&&ge(e,t.defect)}}),rTe=(e)=>({[AO]:WM,_tag:Hg,fiberId:e,[Ne](){return d(oe(IO),Ee(oe(Hg)),Ee(oe(e)),lt(this))},[Pe](t){return zM(t)&&t._tag===Hg&&ge(e,t.fiberId)}}),E7=(e)=>({[AO]:WM,_tag:qm,value:e,[Ne](){return d(oe(IO),Ee(oe(qm)),Ee(oe(e)),lt(this))},[Pe](t){return zM(t)&&t._tag===qm&&ge(e,t.value)}}),Uht=d(oe(IO),Ee(oe(qg)),Ee(oe("retry"))),nTe={[AO]:WM,_tag:qg,[Ne](){return Uht},[Pe](e){return zM(e)&&Lht(e)}};var oTe=(e)=>({_tag:LM,exit:e}),b7=(e)=>({_tag:UM,journal:e});var sTe={ref:0},iTe=()=>{let e=sTe.ref+1;return sTe.ref=e,e};var Wht="effect/STM",zht=Symbol.for(Wht),eW={_R:(e)=>e,_E:(e)=>e,_A:(e)=>e};class Bm{effect_instruction_i0;_op=Rh;effect_instruction_i1=void 0;effect_instruction_i2=void 0;[XH];[Hv];[bO];[dO];get[zht](){return eW}constructor(e){this.effect_instruction_i0=e,this[XH]=Hd,this[Hv]=eW,this[bO]=eW,this[dO]=eW}[Pe](e){return this===e}[Ne](){return lt(this,sy(this))}[Symbol.iterator](){return new vy(new yf(this))}commit(){return aTe(this,wo,wo)}pipe(){return ce(this,arguments)}}var aTe=(e,t,r)=>Ot((n)=>{let o=n.id(),s=n.getFiberRef(Vc),i=n.getFiberRef(Nq),a=n.getFiberRef(ZAe),c=jht(o,e,s,i,a);switch(c._tag){case LM:return t(c.exit),c.exit;case UM:{let l=iTe(),u={value:Zve},f=$o((h)=>cTe(o,e,l,u,s,i,a,h));return wu((h)=>d(h(f),tn((y)=>{let E=u.value;if(S7(E))u.value=Yve;if(E=u.value,Qve(E))return t(E.exit),E.exit;return r(),On(y)})))}}}),$ht=(e,t,r,n,o,s)=>{let i=new Map,a=new w7(t,i,e,n).run(),c=c7(i);if(c===KB)a7(i);else if(c===NM)throw Error("BUG: STM.TryCommit.tryCommit - please report an issue at https://github.com/Effect-TS/effect/issues");switch(a._tag){case qm:return r.value=BM(a),jS(Nt(a.value),i,o,s);case Lg:{r.value=BM(a);let l=Cp(a.error);return jS(gr(l),i,o,s)}case Ug:{r.value=BM(a);let l=oa(a.defect);return jS(gr(l),i,o,s)}case Hg:{r.value=BM(a);let l=Zy(e);return jS(gr(l),i,o,s)}case qg:return b7(i)}},jht=(e,t,r,n,o)=>{let s=new Map,i=new w7(t,s,e,r).run(),a=c7(s);if(a===KB&&Xve(i))a7(s);else if(a===NM)throw Error("BUG: STM.TryCommit.tryCommitSync - please report an issue at https://github.com/Effect-TS/effect/issues");switch(i._tag){case qm:return jS(Nt(i.value),s,n,o);case Lg:{let c=Cp(i.error);return jS(gr(c),s,n,o)}case Ug:{let c=oa(i.defect);return jS(gr(c),s,n,o)}case Hg:{let c=Zy(e);return jS(gr(c),s,n,o)}case qg:return b7(s)}},cTe=(e,t,r,n,o,s,i,a)=>{if(S7(n.value)){let c=$ht(e,t,n,o,s,i);switch(c._tag){case LM:{Vht(c.exit,a);break}case UM:{Gve(r,c.journal,()=>cTe(e,t,r,n,o,s,i,a));break}}}},jS=(e,t,r,n)=>{let o=jve(t);if(o.size>0)r.scheduleTask(()=>Vve(o),n);return oTe(e)},Vht=(e,t)=>{t(e)};class w7{self;journal;fiberId;contStack=[];env;constructor(e,t,r,n){this.self=e,this.journal=t,this.fiberId=r,this.env=n}getEnv(){return this.env}pushStack(e){this.contStack.push(e)}popStack(){return this.contStack.pop()}nextSuccess(){let e=this.popStack();while(e!==void 0&&e.effect_instruction_i0!==QB)e=this.popStack();return e}nextFailure(){let e=this.popStack();while(e!==void 0&&e.effect_instruction_i0!==JB)e=this.popStack();return e}nextRetry(){let e=this.popStack();while(e!==void 0&&e.effect_instruction_i0!==u7)e=this.popStack();return e}run(){let e=this.self,t=void 0;while(t===void 0&&e!==void 0)try{let r=e;if(r)switch(r._op){case"Tag":{e=Lp((n,o,s)=>qo(s,r));break}case"Left":{e=tW(r.left);break}case"None":{e=tW(new J0);break}case"Right":{e=gn(r.right);break}case"Some":{e=gn(r.value);break}case"Commit":{switch(r.effect_instruction_i0){case h7:{t=tTe(on(()=>r.effect_instruction_i1()));break}case m7:{let n=this.nextFailure();if(n===void 0)t=eTe(on(()=>r.effect_instruction_i1()));else e=on(()=>n.effect_instruction_i2(on(()=>r.effect_instruction_i1())));break}case d7:{let n=this.nextRetry();if(n===void 0)t=nTe;else e=on(()=>n.effect_instruction_i2());break}case g7:{t=rTe(this.fiberId);break}case l7:{e=on(()=>r.effect_instruction_i1(this));break}case QB:case JB:case u7:{this.pushStack(r),e=r.effect_instruction_i1;break}case Kve:{let n=this.env;this.env=on(()=>r.effect_instruction_i2(n)),e=d(r.effect_instruction_i1,Ght($M(()=>this.env=n)));break}case f7:{let n=r.effect_instruction_i1,o=this.nextSuccess();if(o===void 0)t=E7(n);else e=on(()=>o.effect_instruction_i2(n));break}case p7:{let n=on(()=>r.effect_instruction_i1()),o=this.nextSuccess();if(o===void 0)t=E7(n);else e=on(()=>o.effect_instruction_i2(n));break}}break}}}catch(r){e=uTe(r)}return t}}var lTe=p(2,(e,t)=>{let r=new Bm(JB);return r.effect_instruction_i1=e,r.effect_instruction_i2=t,r});var uTe=(e)=>pTe(()=>e);var pTe=(e)=>{let t=new Bm(h7);return t.effect_instruction_i1=e,t},Lp=(e)=>Ni((t)=>gn(e(t.journal,t.fiberId,t.getEnv()))),Ght=p(2,(e,t)=>dTe(e,{onFailure:(r)=>C7(t,tW(r)),onSuccess:(r)=>C7(t,gn(r))})),tW=(e)=>fTe(()=>e),fTe=(e)=>{let t=new Bm(m7);return t.effect_instruction_i1=e,t},Gc=p(2,(e,t)=>{let r=new Bm(QB);return r.effect_instruction_i1=e,r.effect_instruction_i2=t,r}),dTe=p(2,(e,{onFailure:t,onSuccess:r})=>d(e,Va(ye),lTe((n)=>d(t(n),Va(Ie))),Gc((n)=>{switch(n._tag){case"Left":return gn(n.left);case"Right":return r(n.right)}}))),Ni=(e)=>{let t=new Bm(l7);return t.effect_instruction_i1=e,t};var Ga=(e)=>{let t=new Bm(g7);return t.effect_instruction_i1=e,t},Va=p(2,(e,t)=>d(e,Gc((r)=>$M(()=>t(r)))));var Pl=new Bm(d7),gn=(e)=>{let t=new Bm(f7);return t.effect_instruction_i1=e,t},$M=(e)=>{let t=new Bm(p7);return t.effect_instruction_i1=e,t};var C7=p(2,(e,t)=>d(e,Gc(()=>t))),mTe=p(3,(e,t,r)=>d(e,Gc((n)=>d(t,Va((o)=>r(n,o))))));var jM="BackPressure",VM="Dropping",GM="Sliding";var Kht=p(2,(e,t)=>d(e,Va(()=>t)));var Jht=(e)=>Gc(e,te);var KM=p((e)=>ol(e[0]),(e,t,r)=>{if(r?.discard)return d($M(()=>e[Symbol.iterator]()),Gc((n)=>{let o=k7(()=>{let s=n.next();if(s.done)return mw;return d(t(s.value),Gc(()=>o))});return o}));return k7(()=>De(e).reduce((n,o)=>mTe(n,t(o),(s,i)=>(s.push(i),s)),gn([])))});var gTe=(e,t)=>{if(Symbol.iterator in e)return KM(e,te,t);else if(t?.discard)return KM(Object.values(e),te,t);return Va(KM(Object.entries(e),([r,n])=>Va(n,(o)=>[r,o])),(r)=>{let n={};for(let[o,s]of r)n[o]=s;return n})};var k7=(e)=>Jht($M(e)),I7=p(2,(e,t)=>Gc(e,(r)=>Kht(t(r),r)));var mw=gn(void 0);var Qht="effect/TRef",Yht=Symbol.for(Qht),Zht={_A:(e)=>e};class JM{[Yht]=Zht;todos;versioned;constructor(e){this.versioned=new FM(e),this.todos=new Map}modify(e){return Lp((t)=>{let r=_7(this,t),[n,o]=e(s7(r));return i7(r,o),n})}pipe(){return ce(this,arguments)}}var A7=(e)=>Lp((t)=>{let r=new JM(e);return t.set(r,o7(r,!0)),r}),nW=(e)=>e.modify((t)=>[t,t]),O7=p(2,(e,t)=>e.modify(()=>[void 0,t]));var _7=(e,t)=>{if(t.has(e))return t.get(e);let r=o7(e,!1);return t.set(e,r),r},Lr=p(2,(e,t)=>s7(_7(e,t))),Wr=p(3,(e,t,r)=>{let n=_7(e,r);i7(n,t);return});var Xht="effect/TQueue/TEnqueue",oW=Symbol.for(Xht),egt="effect/TQueue/TDequeue",sW=Symbol.for(egt);var v7={_Out:(e)=>e},T7={_In:(e)=>e};class tgt{ref;requestedCapacity;strategy;[sW]=v7;[oW]=T7;constructor(e,t,r){this.ref=e,this.requestedCapacity=t,this.strategy=r}capacity(){return this.requestedCapacity}size=Ni((e)=>{let t=Lr(this.ref,e.journal);if(t===void 0)return Ga(e.fiberId);return gn(t.length)});isFull=Va(this.size,(e)=>e===this.requestedCapacity);isEmpty=Va(this.size,(e)=>e===0);shutdown=Ni((e)=>(Wr(this.ref,void 0,e.journal),mw));isShutdown=Lp((e)=>Lr(this.ref,e)===void 0);awaitShutdown=Gc(this.isShutdown,(e)=>e?mw:Pl);offer(e){return Ni((t)=>{let r=d(this.ref,Lr(t.journal));if(r===void 0)return Ga(t.fiberId);if(r.length<this.requestedCapacity)return r.push(e),Wr(this.ref,r,t.journal),gn(!0);switch(this.strategy._tag){case jM:return Pl;case VM:return gn(!1);case GM:{if(r.length===0)return gn(!0);return r.shift(),r.push(e),Wr(this.ref,r,t.journal),gn(!0)}}})}offerAll(e){return Ni((t)=>{let r=Array.from(e),n=Lr(this.ref,t.journal);if(n===void 0)return Ga(t.fiberId);if(n.length+r.length<=this.requestedCapacity)return Wr(this.ref,[...n,...r],t.journal),gn(!0);switch(this.strategy._tag){case jM:return Pl;case VM:{let o=r.slice(0,this.requestedCapacity-n.length);return Wr(this.ref,[...n,...o],t.journal),gn(!1)}case GM:{let o=r.slice(0,this.requestedCapacity-n.length),s=n.length+o.length-this.requestedCapacity,i=n.slice(s);return Wr(this.ref,[...i,...o],t.journal),gn(!0)}}})}peek=Ni((e)=>{let t=Lr(this.ref,e.journal);if(t===void 0)return Ga(e.fiberId);if(t.length===0)return Pl;return gn(t[0])});peekOption=Ni((e)=>{let t=Lr(this.ref,e.journal);if(t===void 0)return Ga(e.fiberId);return gn(Ft(t[0]))});take=Ni((e)=>{let t=Lr(this.ref,e.journal);if(t===void 0)return Ga(e.fiberId);if(t.length===0)return Pl;let r=t.shift();return Wr(this.ref,t,e.journal),gn(r)});takeAll=Ni((e)=>{let t=Lr(this.ref,e.journal);if(t===void 0)return Ga(e.fiberId);return Wr(this.ref,[],e.journal),gn(t)});takeUpTo(e){return Ni((t)=>{let r=Lr(this.ref,t.journal);if(r===void 0)return Ga(t.fiberId);let[n,o]=dy(nt(r),e);return Wr(this.ref,Array.from(o),t.journal),gn(Array.from(n))})}}var STe=(e)=>e.isShutdown;var R7=(e)=>e.shutdown;var ETe=(e)=>e.take;var rgt="effect/TPubSub",iW=Symbol.for(rgt),Tu=Symbol.for("effect/TPubSub/AbsentValue"),Bg=(e,t,r)=>({head:e,subscribers:t,tail:r});class ngt{pubsubSize;publisherHead;publisherTail;requestedCapacity;strategy;subscriberCount;subscribers;[iW]={_A:(e)=>e};[oW]=T7;constructor(e,t,r,n,o,s,i){this.pubsubSize=e,this.publisherHead=t,this.publisherTail=r,this.requestedCapacity=n,this.strategy=o,this.subscriberCount=s,this.subscribers=i}isShutdown=Lp((e)=>Lr(this.publisherTail,e)===void 0);awaitShutdown=Gc(this.isShutdown,(e)=>e?mw:Pl);capacity(){return this.requestedCapacity}size=Ni((e)=>{if(Lr(this.publisherTail,e.journal)===void 0)return Ga(e.fiberId);return gn(Lr(this.pubsubSize,e.journal))});isEmpty=Va(this.size,(e)=>e===0);isFull=Va(this.size,(e)=>e===this.capacity());offer(e){return Ni((t)=>{let r=Lr(this.publisherTail,t.journal);if(r===void 0)return Ga(t.fiberId);let n=Lr(this.subscriberCount,t.journal);if(n===0)return gn(!0);let o=Lr(this.pubsubSize,t.journal);if(o<this.requestedCapacity){let s=new JM(void 0),i=Bg(e,n,s);return Wr(r,i,t.journal),Wr(this.publisherTail,s,t.journal),Wr(this.pubsubSize,o+1,t.journal),gn(!0)}switch(this.strategy._tag){case jM:return Pl;case VM:return gn(!1);case GM:{if(this.requestedCapacity>0){let a=Lr(this.publisherHead,t.journal),c=!0;while(c){let l=Lr(a,t.journal);if(l===void 0)return Pl;let{head:u,tail:f}=l;if(u!==Tu){let h=Bg(Tu,l.subscribers,l.tail);Wr(a,h,t.journal),Wr(this.publisherHead,f,t.journal),c=!1}else a=f}}let s=new JM(void 0),i=Bg(e,n,s);return Wr(r,i,t.journal),Wr(this.publisherTail,s,t.journal),gn(!0)}}})}offerAll(e){return Va(KM(e,(t)=>this.offer(t)),Zv(te))}shutdown=Lp((e)=>{if(Lr(this.publisherTail,e)!==void 0){Wr(this.publisherTail,void 0,e);let r=Lr(this.subscribers,e);nfe(r,(n)=>{Wr(n,void 0,e)}),Wr(this.subscribers,gl(),e)}})}class CTe{pubsubSize;publisherHead;requestedCapacity;subscriberHead;subscriberCount;subscribers;[iW]=iW;[sW]=v7;constructor(e,t,r,n,o,s){this.pubsubSize=e,this.publisherHead=t,this.requestedCapacity=r,this.subscriberHead=n,this.subscriberCount=o,this.subscribers=s}isShutdown=Lp((e)=>Lr(this.subscriberHead,e)===void 0);awaitShutdown=Gc(this.isShutdown,(e)=>e?mw:Pl);capacity(){return this.requestedCapacity}size=Ni((e)=>{let t=Lr(this.subscriberHead,e.journal);if(t===void 0)return Ga(e.fiberId);let r=!0,n=0;while(r){let o=Lr(t,e.journal);if(o===void 0)r=!1;else{let{head:s,tail:i}=o;if(s!==Tu){if(n=n+1,n>=Number.MAX_SAFE_INTEGER)r=!1}t=i}}return gn(n)});isEmpty=Va(this.size,(e)=>e===0);isFull=Va(this.size,(e)=>e===this.capacity());peek=Ni((e)=>{let t=Lr(this.subscriberHead,e.journal);if(t===void 0)return Ga(e.fiberId);let r=Tu,n=!0;while(n){let o=Lr(t,e.journal);if(o===void 0)return Pl;let{head:s,tail:i}=o;if(s!==Tu)r=s,n=!1;else t=i}return gn(r)});peekOption=Ni((e)=>{let t=Lr(this.subscriberHead,e.journal);if(t===void 0)return Ga(e.fiberId);let r=R(),n=!0;while(n){let o=Lr(t,e.journal);if(o===void 0)r=R(),n=!1;else{let{head:s,tail:i}=o;if(s!==Tu)r=_(s),n=!1;else t=i}}return gn(r)});shutdown=Lp((e)=>{let t=Lr(this.subscriberHead,e);if(t!==void 0){Wr(this.subscriberHead,void 0,e);let r=!0;while(r){let o=Lr(t,e);if(o===void 0)r=!1;else{let{head:s,tail:i}=o;if(s!==Tu){let a=o.subscribers;if(a===1){let c=Lr(this.pubsubSize,e),l=Bg(Tu,0,i);Wr(t,l,e),Wr(this.publisherHead,i,e),Wr(this.pubsubSize,c-1,e)}else{let c=Bg(s,a-1,i);Wr(t,c,e)}}t=i}}let n=Lr(this.subscriberCount,e);Wr(this.subscriberCount,n-1,e),Wr(this.subscribers,Vh(Lr(this.subscribers,e),this.subscriberHead),e)}});take=Ni((e)=>{let t=Lr(this.subscriberHead,e.journal);if(t===void 0)return Ga(e.fiberId);let r=Tu,n=!0;while(n){let o=Lr(t,e.journal);if(o===void 0)return Pl;let{head:s,tail:i}=o;if(s!==Tu){let a=o.subscribers;if(a===1){let c=Lr(this.pubsubSize,e.journal),l=Bg(Tu,0,i);Wr(t,l,e.journal),Wr(this.publisherHead,i,e.journal),Wr(this.pubsubSize,c-1,e.journal)}else{let c=Bg(s,a-1,i);Wr(t,c,e.journal)}Wr(this.subscriberHead,i,e.journal),r=s,n=!1}else t=i}return gn(r)});takeAll=this.takeUpTo(Number.POSITIVE_INFINITY);takeUpTo(e){return Ni((t)=>{let r=Lr(this.subscriberHead,t.journal);if(r===void 0)return Ga(t.fiberId);let n=[],o=0;while(o!==e){let s=Lr(r,t.journal);if(s===void 0)o=e;else{let{head:i,tail:a}=s;if(i!==Tu){let c=s.subscribers;if(c===1){let l=Lr(this.pubsubSize,t.journal),u=Bg(Tu,0,a);Wr(r,u,t.journal),Wr(this.publisherHead,a,t.journal),Wr(this.pubsubSize,l-1,t.journal)}else{let l=Bg(i,c-1,a);Wr(r,l,t.journal)}n.push(i),o=o+1}r=a}}return Wr(this.subscriberHead,r,t.journal),gn(n)})}}var ogt=(e,t,r,n,o,s)=>d(nW(r),Gc((i)=>d(gTe([A7(i),nW(o),nW(s)]),I7(([a,c])=>d(o,O7(c+1))),I7(([a,c,l])=>d(s,O7(d(l,ou(a))))),Va(([a])=>new CTe(e,t,n,a,o,s)))));var wTe=(e)=>ogt(e.pubsubSize,e.publisherHead,e.publisherTail,e.requestedCapacity,e.subscriberCount,e.subscribers),kTe=(e)=>vr(wTe(e),(t)=>R7(t));var ITe=kTe;var ATe=STe;var OTe=ETe;class QM{capacity;array;size=0;current=0;constructor(e){this.capacity=e,this.array=Array.from({length:e},Oh)}head(){return Ft(this.array[this.current])}lastOrNull(){if(this.size===0)return;let e=this.current===0?this.array.length-1:this.current-1;return this.array[e]??void 0}put(e){this.array[this.current]=e,this.increment()}dropLast(){if(this.size>0)this.decrement(),this.array[this.current]=void 0}toChunk(){let e=this.current-this.size,t=e<0?[...this.array.slice(this.capacity+e,this.capacity),...this.array.slice(0,this.current)]:this.array.slice(e,this.current);return Fr(t)}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 _Te="NotStarted",vTe="Previous",TTe="Current",RTe={_tag:"NotStarted"},MTe=(e)=>({_tag:"Previous",fiber:e}),PTe=(e)=>({_tag:"Current",fiber:e});var aW=(e)=>Object.assign(e,{chunk(r){return this(N(r))},die(r){return this(Ms(r))},dieMessage(r){return this($f(r))},done(r){return this(Qe(()=>EU(r,{onFailure:_,onSuccess:We})))},end(){return this(ie(R()))},fail(r){return this(ie(_(r)))},fromEffect(r){return this(Gf(r,{onFailure:_,onSuccess:We}))},fromEffectChunk(r){return this(d(r,br(_)))},halt(r){return this(On(d(r,fc(_))))},single(r){return this(N(We(r)))}}),DTe=(e,t)=>{let r=!1,n=[],o=!1;function s(c){if(r)return!1;if(c.length<=50000)n.push.apply(n,c);else for(let l=0;l<c.length;l++)n.push(c[0]);if(!o)o=!0,t.scheduleTask(i,0);return!0}function i(){if(o=!1,n.length>0)e.unsafeOffer(n),n=[]}function a(c){if(r)return;if(r=!0,c._tag==="Success")n.push(c.value);i(),e.unsafeOffer(c._tag==="Success"?ta:c)}return{single(c){if(r)return!1;if(n.push(c),!o)o=!0,t.scheduleTask(i,0);return!0},array:s,chunk(c){return s(lr(c))},done:a,end(){if(r)return;r=!0,i(),e.unsafeOffer(ta)},halt(c){return a(gr(c))},fail(c){return a(Xr(c))},die(c){return a(hu(c))},dieMessage(c){return a(hu(Error(c)))}}};var ugt=Symbol.for("effect/Stream/Handoff"),FTe="Empty",NTe="Full",LTe=(e)=>({_tag:FTe,notifyConsumer:e}),pgt=(e,t)=>({_tag:NTe,value:e,notifyProducer:t}),UTe=(e,t)=>(r)=>{switch(r._tag){case FTe:return e(r.notifyConsumer);case NTe:return t(r.value,r.notifyProducer)}},fgt={_A:(e)=>e},Dl=()=>d(_r(),L((e)=>qn(LTe(e))),W((e)=>({[ugt]:fgt,ref:e}))),oo=p(2,(e,t)=>L(_r(),(r)=>aa(mu(e.ref,(n)=>d(n,UTe((o)=>[ve(mo(o,void 0),Wt(r)),pgt(t,r)],(o,s)=>[L(Wt(s),()=>d(e,oo(t))),n])))))),Fl=(e)=>L(_r(),(t)=>aa(mu(e.ref,(r)=>d(r,UTe((n)=>[L(Wt(n),()=>Fl(e)),r],(n,o)=>[qr(mo(o,void 0),n),LTe(t)])))));var YM="Emit",ZM="Halt",XM="End",M7=(e)=>({_tag:"Emit",elements:e}),cW=(e)=>({_tag:"Halt",cause:e}),eP=(e)=>({_tag:"End",reason:e});var hgt="effect/Take",ggt=Symbol.for(hgt),xgt={_A:(e)=>e,_E:(e)=>e};class hw{exit;[ggt]=xgt;constructor(e){this.exit=e}pipe(){return ce(this,arguments)}}var Wg=(e)=>new hw(Nt(e));var OO=(e)=>Qe(()=>e.exit),od=new hw(Xr(R()));var zg=(e)=>new hw(gr(d(e,fc(_))));var lW=(e)=>Ig(e,{onFailure:(t)=>be(IC(t),{onNone:()=>od,onSome:zg}),onSuccess:Wg});var _O=p(2,(e,{onEnd:t,onFailure:r,onSuccess:n})=>to(e.exit,{onFailure:(o)=>be(IC(o),{onNone:t,onSome:r}),onSuccess:n}));var uW=(e)=>new hw(Nt(We(e)));var tP=()=>ie(R());var pW=(e)=>br(On(e),_);var P7="ScheduleEnd",qTe="UpstreamEnd",vO={_tag:"ScheduleEnd"},D7={_tag:"UpstreamEnd"};var F7="DrainLeft",N7="DrainRight",L7="PullBoth",U7="PullLeft",H7="PullRight",VS={_tag:"DrainLeft"},GS={_tag:"DrainRight"},KS={_tag:"PullBoth"},$g=(e)=>({_tag:"PullLeft",rightChunk:e}),jg=(e)=>({_tag:"PullRight",leftChunk:e});var BTe="PullBoth",WTe="PullLet",zTe="PullRight",rP={_tag:"PullBoth"},nP=(e)=>({_tag:"PullLet",rightChunk:e}),oP=(e)=>({_tag:"PullRight",leftChunk:e});var Cgt="effect/Stream",hW=Symbol.for(Cgt),wgt={_R:(e)=>e,_E:(e)=>e,_A:(e)=>e};class Fe{channel;[hW]=wgt;constructor(e){this.channel=e}pipe(){return ce(this,arguments)}}var Kc=(e)=>de(e,hW)||mn(e),RO=4096,KTe=(e)=>iP(q7(e)),q7=(e)=>{let t=(r)=>ln({onInput:(n)=>{let o=Vt(r,n);return he(Se(o),()=>t(o))},onFailure:yr,onDone:()=>it});return new Fe(kt(_e(e),t(Ze())))},B7=(e,t)=>Ew(vr(e,t)),JTe=p(2,(e,t)=>gW(e,t,vve)),gW=p(3,(e,t,r)=>YS(W7(e,t,r),(n)=>Ir(n,{onLeft:R,onRight:_}))),W7=p(3,(e,t,r)=>{let n=Ha([Dl(),qn(vO),qn(Ze()),zS(r),qn(!1),qn(!1)]);return vo(n).pipe(Jo(([o,s,i,a,c,l])=>{let u=tr({onInput:(E)=>he(Ye(d(o,oo(M7(E)),Tp(()=>kn(E)))),()=>u),onFailure:(E)=>Ye(oo(o,cW(E))),onDone:()=>Ye(oo(o,eP(D7)))}),f=d(sU(i,Ze()),L((E)=>{if(kn(E))return d(Xi(c,!0),ve(N(d(Se(E),he(()=>f)))));return d(Fl(o),W((b)=>{switch(b._tag){case YM:return d(Ye(Xi(c,!0)),ir(Se(b.elements)),ir(Ye(sn(l))),he((w)=>w?it:f));case ZM:return ht(b.cause);case XM:{if(b.reason._tag===P7)return d(sn(c),W((w)=>w?Ye(d(Xi(s,vO),ve(Xi(l,!0)))):d(Ye(d(Xi(s,vO),ve(Xi(l,!0)))),he(()=>f))),Yt);return d(Xi(s,b.reason),ve(Xi(l,!0)),Ye)}}}))}),Yt),h=(E)=>a.next(E),y=(E,b,w)=>{let T=d(Xi(c,!1),ve(Xi(l,!1)),ve(d(f,xo(Di(t)),Pg,fw,hn(w)))),A=(k,O,P)=>d(Xi(i,nT(k)),ve(W(sn(s),(D)=>{switch(D._tag){case P7:return d(Ha([sn(c),T,d(h(_(O)),hn(w))]),W(([I,M,B])=>{let ee=d(P,be({onNone:()=>We(ye(O)),onSome:(j)=>kf(ye(O),Ie(j))}));if(I)return d(Se(ee),he(()=>y(M,B,w)));return y(M,B,w)}),Yt);case qTe:return d(sn(c),W((I)=>I?Se(We(ye(O))):it),Yt)}})),Yt);return Yt(SS(qc(E),qc(b),{onSelfDone:(k,O)=>d(Ts(b),ve(d(Qe(()=>k),W(([P,D])=>A(P,D,R()))))),onOtherDone:(k,O)=>os(Qe(()=>k),{onFailure:(P)=>Ir(Bf(P),{onLeft:()=>d(o,oo(eP(vO)),vp,ve(d(qc(E),W(([D,I])=>A(D,I,R()))))),onRight:(D)=>d(o,oo(cW(D)),vp,ve(d(qc(E),W(([I,M])=>A(I,M,R())))))}),onSuccess:(P)=>d(o,oo(eP(vO)),vp,ve(d(qc(E),W(([D,I])=>A(D,I,_(P))))))})}))};return LO((E)=>kt(_e(e),u).pipe(fw,hn(E),ve(xo(f,Di(t)).pipe(Pg,fw,hn(E),L((b)=>h(R()).pipe(hn(E),W((w)=>new Fe(y(b,w,E)))))))))}))}),QTe=p(2,(e,t)=>is(e,()=>t)),z7=(e)=>{if(e==="unbounded")return TS();else if(typeof e==="number"||e===void 0)return Tl(e??16);switch(e.strategy){case"dropping":return cO(e.bufferSize??16);case"sliding":return lO(e.bufferSize??16);default:return Tl(e.bufferSize??16)}},YTe=(e,t)=>vr(z7(t),(r)=>zn(r)).pipe(L((r)=>Wc().pipe(L((n)=>Ce(()=>{let o=jB(n);return e(aW((i)=>lW(i).pipe(L((a)=>Br(r,a)),Xs,o).then((a)=>{if(Fa(a)){if(!Ua(a.cause))throw gi(a.cause)}})))})),W((n)=>{let o=$a(r).pipe(L((s)=>OO(s)),Fs({onFailure:(s)=>Ye(zn(r)).pipe(ir(be(s,{onNone:()=>it,onSome:(i)=>yr(i)}))),onSuccess:(s)=>Se(s).pipe(he(()=>o))}),Yt);return tE(o).pipe(Gg(n??me))}))),sd),ZTe=(e,t)=>d(vr(z7(t),(r)=>zn(r)),L((r)=>d(Wc(),L((n)=>d(e(aW((o)=>d(lW(o),L((s)=>Br(r,s)),Xs,jB(n)).then((s)=>{if(Fa(s)){if(!Ua(s.cause))throw gi(s.cause)}}))),W(()=>{let o=d($a(r),L(OO),Fs({onFailure:(s)=>d(Ye(zn(r)),ir(be(s,{onNone:()=>it,onSome:yr}))),onSuccess:(s)=>d(Se(s),he(()=>o))}),Yt);return o}))))),nd,tE),kgt=(e)=>{if(e?.bufferSize==="unbounded"||e?.bufferSize===void 0&&e?.strategy===void 0)return TS();switch(e?.strategy){case"sliding":return lO(e.bufferSize??16);default:return cO(e?.bufferSize??16)}},$7=(e,t)=>vr(kgt(t),zn).pipe(sr((r)=>QAe(Nq,(n)=>e(DTe(r,n)))),W((r)=>{let n=he($a(r),(o)=>O0(o)?Uc(o)?it:ht(o.cause):ir(Se(nt(o)),n));return n}),nd,tE),XTe=(e,t)=>d(vr(z7(t),(r)=>zn(r)),L((r)=>d(Wc(),L((n)=>d(e(aW((o)=>d(lW(o),L((s)=>Br(r,s)),Xs,jB(n)).then((s)=>{if(Fa(s)){if(!Ua(s.cause))throw gi(s.cause)}}))),ve(qn(!1)),L((o)=>d(sn(o),W((s)=>s?tP():d($a(r),L(OO),qC(()=>d(Xi(o,!0),ve(zn(r)))))))))))),Ew,Jo(Qg)),e0e=p(3,(e,t,r)=>fa(()=>{let n=(s)=>ln({onInput:(i)=>{if(s.length+i.length>=t){let[c,l]=d(i,dy(t-s.length));return o(d(s,Vt(c)),l)}return n(d(s,Vt(i)))},onFailure:yr,onDone:()=>o(s,Ze())}),o=(s,i)=>kt(ir(Se(i),Ml()),_e(r(s)));return new Fe(d(_e(e),xo(n(Ze()))))})),t0e=p(3,(e,t,r)=>d(e,V7(t,r),W((n)=>n.map((o)=>eE(Up(o,{shutdown:!0})))))),j7=p(2,(e,t)=>W(PW(e,t),(r)=>eE(rZ(r)))),r0e=p(2,(e,t)=>W($B({acquire:j7(e,t),idleTimeToLive:t.idleTimeToLive}),(r)=>sd(PM(r)))),V7=p(3,(e,t,r)=>L(SMe(r),(n)=>d(Ha(Array.from({length:t},()=>Um(n))),sr(()=>Ri(MW(e,n)))))),n0e=p(2,(e,t)=>W(PW(e,t),Um)),o0e=p(2,(e,t)=>{if(t.capacity==="unbounded")return vgt(e);else if(t.strategy==="dropping")return Ogt(e,t.capacity);else if(t.strategy==="sliding")return _gt(e,t.capacity);let r=YZ(e,t);return new Fe(nd(W(r,(n)=>{let o=d(Ye($a(n)),he(to({onFailure:(s)=>d(IC(s),be({onNone:()=>it,onSome:ht})),onSuccess:(s)=>he(Se(We(s)),()=>o)})));return o})))}),s0e=p(2,(e,t)=>{if(t.strategy==="dropping")return Igt(e,t.capacity);else if(t.strategy==="sliding")return Agt(e,t.capacity);let r=DW(e,t);return new Fe(nd(W(r,(n)=>{let o=d(Ye($a(n)),he(_O({onEnd:()=>it,onFailure:ht,onSuccess:(s)=>d(Se(s),he(()=>o))})));return o})))}),Igt=p(2,(e,t)=>{let r=vr(cO(t),(n)=>zn(n));return new Fe(xW(r,_e(e)))}),Agt=p(2,(e,t)=>{let r=vr(lO(t),(n)=>zn(n));return new Fe(xW(r,_e(e)))}),Ogt=p(2,(e,t)=>{let r=vr(cO(t),(n)=>zn(n));return new Fe(xW(r,_e(gP(1)(e))))}),_gt=p(2,(e,t)=>{let r=vr(lO(t),(n)=>zn(n));return new Fe(xW(r,_e(d(e,gP(1)))))}),vgt=(e)=>{let t=DW(e,{strategy:"unbounded"});return new Fe(nd(W(t,(r)=>{let n=d(Ye($a(r)),he(_O({onEnd:()=>it,onFailure:ht,onSuccess:(o)=>he(Se(o),()=>n)})));return n})))},xW=(e,t)=>{let r=(o,s)=>{let i=(a)=>d(sn(s),sr(Wt),ve(_r()),L((c)=>d(Br(o,[a,c]),ve(Xi(s,c)),ve(Wt(c)))),Xs,Ye);return tr({onInput:(a)=>d(_r(),L((c)=>d(Br(o,[Wg(a),c]),L((l)=>d(Xi(s,c),Tp(()=>l))))),Xs,Ye,he(()=>r(o,s))),onFailure:(a)=>i(zg(a)),onDone:()=>i(od)})},n=(o)=>{let s=d(Ye($a(o)),he(([i,a])=>ir(Ye(mo(a,void 0)),_O(i,{onEnd:()=>it,onFailure:ht,onSuccess:(c)=>d(Se(c),he(()=>s))}))));return s};return nd(d(e,L((o)=>d(_r(),sr((s)=>mo(s,void 0)),L((s)=>d(qn(s),L((i)=>d(t,kt(r(o,i)),EO,Ri)),qr(n(o))))))))},Kg=p(2,(e,t)=>MO(e,(r)=>Ir(Bf(r),{onLeft:t,onRight:lP}))),MO=p(2,(e,t)=>new Fe(d(_e(e),mO((r)=>_e(t(r)))))),i0e=p(2,(e,t)=>d(e,Kg((r)=>d(t(r),Je(()=>Vg(r)))))),G7=p(2,(e,t)=>d(e,MO((r)=>d(t(r),Je(()=>lP(r)))))),a0e=p(3,(e,t,r)=>Kg(e,(n)=>{if("_tag"in n&&n._tag===t)return r(n);return Vg(n)})),c0e=p(2,(e,t)=>Kg(e,(r)=>{let n=Object.keys(t);if("_tag"in r&&n.includes(r._tag))return t[r._tag](r);return Vg(r)})),l0e=(e)=>d(e,K7((t,r)=>ge(r)(t))),K7=p(2,(e,t)=>{let r=(n)=>tr({onInput:(o)=>{let[s,i]=ip(o,[n,Ze()],([a,c],l)=>{if(Oe(a)&&t(a.value,l))return[_(l),c];return[_(l),d(c,Is(l))]});if(At(i))return r(s);return he(Se(i),()=>r(s))},onFailure:ht,onDone:()=>it});return new Fe(d(_e(e),kt(r(R()))))}),u0e=p(2,(e,t)=>{let r=(n)=>tr({onInput:(o)=>d(o,_R([n,Ze()],([s,i],a)=>{if(Oe(s))return d(t(s.value,a),W((c)=>c?[_(a),i]:[_(a),d(i,Is(a))]));return N([_(a),d(i,Is(a))])}),Ye,he(([s,i])=>d(Se(i),he(()=>r(s))))),onFailure:ht,onDone:()=>it});return new Fe(d(_e(e),kt(r(R()))))}),iP=(e)=>d(e,yw(We)),p0e=p(2,(e,t)=>uP(t(iP(e)))),JS=(e)=>jo(sq(e),(t)=>t._tag==="None"?hS:ie(t.value)),f0e=p(4,(e,t,r,n)=>{function o(s,i){return Ye(Fl(i)).pipe(ir(tr({onInput:(a)=>he(Ye(oo(s,Nt(a))),()=>o(s,i)),onFailure:(a)=>Ye(oo(s,gr(d(a,fc(_))))),onDone:()=>he(Ye(oo(s,Xr(R()))),()=>o(s,i))})))}return new Fe(Np((s)=>Ha([Dl(),Dl(),Dl(),Dl()]).pipe(sr(([i,a,c])=>_e(e).pipe(Dp(pa),kt(o(i,c)),Rl(s),hn(s))),sr(([,i,a,c])=>_e(t).pipe(Dp(pa),kt(o(i,c)),Rl(s),hn(s))),W(([i,a,c,l])=>{let u=oo(c,void 0).pipe(ve(Fl(i).pipe(L(te)))),f=oo(l,void 0).pipe(ve(Fl(a).pipe(L(te))));return _e(LW(r,(h)=>L(n(h,u,f),JS)))}))))}),aP=p(4,(e,t,r,n)=>{let o=(s,i)=>ir(Ye(Fl(i)),tr({onInput:(a)=>he(Ye(d(s,oo(Wg(a)))),()=>o(s,i)),onFailure:(a)=>Ye(oo(s,zg(a))),onDone:()=>Ye(oo(s,od))}));return new Fe(Np((s)=>Ha([Dl(),Dl(),Dl(),Dl()]).pipe(sr(([i,a,c])=>kt(_e(e),o(i,c)).pipe(Rl(s),hn(s))),sr(([i,a,c,l])=>kt(_e(t),o(a,l)).pipe(Rl(s),hn(s))),W(([i,a,c,l])=>{let u=oo(c,void 0).pipe(ve(Fl(i).pipe(L(OO)))),f=oo(l,void 0).pipe(ve(Fl(a).pipe(L(OO))));return _e(EP(r,(h)=>L(n(h,u,f),JS)))}))))}),QS=p(2,(e,t)=>new Fe(d(_e(e),ir(_e(t))))),d0e=(e)=>fa(()=>d(e,ip(Jg,(t,r)=>QS(r)(t)))),m0e=p(2,(e,t)=>d(e,SW(t,(r,n)=>[r,n]))),h0e=p(2,(e,t)=>d(e,SW(t,(r,n)=>r))),yW=p(2,(e,t)=>Jo(e,()=>t)),SW=p(3,(e,t,r)=>d(e,Jo((n)=>d(t,is((o)=>r(n,o)))))),g0e=p(2,(e,t)=>LO((r)=>$e(function*(){let n=yield*Dl();function o(a){return Em(t).pipe(qr(a),hn(r),W((c)=>i(MTe(c))))}let s=tr({onInput:(a)=>be(oT(a),{onNone:()=>s,onSome:(c)=>Ye(oo(n,M7(We(c)))).pipe(he(()=>s))}),onFailure:(a)=>Ye(oo(n,cW(a))),onDone:()=>Ye(oo(n,eP(D7)))});function i(a){switch(a._tag){case _Te:return Yt(Fl(n).pipe(W((c)=>{switch(c._tag){case YM:return Yt(o(c.elements));case ZM:return ht(c.cause);case XM:return it}})));case vTe:return Yt(Fl(n).pipe(hn(r),L((c)=>SS(qc(a.fiber),qc(c),{onSelfDone:(l,u)=>to(l,{onFailure:(f)=>Ts(u).pipe(qr(ht(f))),onSuccess:(f)=>Ts(u).pipe(ve(N(Se(f).pipe(he(()=>i(PTe(c)))))))}),onOtherDone:(l,u)=>to(l,{onFailure:(f)=>Ts(u).pipe(qr(ht(f))),onSuccess:(f)=>{switch(f._tag){case YM:return Ts(u).pipe(ve(o(f.elements)));case ZM:return Ts(u).pipe(qr(ht(f.cause)));case XM:return qc(u).pipe(W((h)=>Se(h).pipe(ir(it))))}}})}))));case TTe:return Yt(qc(a.fiber).pipe(W((c)=>{switch(c._tag){case YM:return Yt(o(c.elements));case ZM:return ht(c.cause);case XM:return it}})))}}return yP((a)=>kt(_e(e),s).pipe(Rl(a),hn(a))).pipe(yW(new Fe(i(RTe))))}))),EW=(e)=>vo(Ms(e)),x0e=(e)=>vo(TQ(e)),y0e=(e)=>vo($f(e)),J7=p(2,(e,t)=>d(_r(),L((r)=>d(e,Q7({maximumLag:t.maximumLag,decide:(n)=>L(Wt(r),(o)=>o(n))}),L((n)=>d(Ha(Vr(aT(0,t.size-1),(o)=>W(n,([s,i])=>[[s,o],i]))),W(nt),L((o)=>{let[s,i]=j4(o,[new Map,Ze()],([a,c],[l,u])=>[a.set(l[0],l[1]),d(c,wn(u))]);return d(mo(r,(a)=>W(t.decide(a),(c)=>(l)=>c(s.get(l)))),qr(Array.from(i)))}))))))),$Te={ref:0},jTe=()=>{let e=$Te.ref;return $Te.ref=e+1,e},Q7=p(2,(e,t)=>Y7(e,t.maximumLag,t.decide,()=>me)),Y7=p(4,(e,t,r,n)=>d(vr(qn(new Map),(o,s)=>d(sn(o),L((i)=>d(i.values(),en(zn))))),L((o)=>$e(function*(){let s=(l)=>d(r(l),L((u)=>d(sn(o),L((f)=>d(f.entries(),_R(Ze(),(h,[y,E])=>{if(u(y))return d(Br(E,Nt(l)),os({onFailure:(b)=>Ua(b)?N(d(h,wn(y))):On(b),onSuccess:()=>N(h)}));return N(h)}),L((h)=>{if(kn(h))return ea(o,(y)=>{for(let E of h)y.delete(E);return y});return me}))))),Xs),i=yield*UA(1),a=yield*qn(d(Tl(t),L((l)=>{let u=jTe();return d(ea(o,(f)=>f.set(u,l)),qr([u,l]))}))),c=(l)=>i.withPermits(1)(d(Xi(a,d(Tl(1),sr((u)=>Br(u,l)),L((u)=>{let f=jTe();return d(ea(o,(h)=>h.set(f,u)),qr(dL(f,u)))}))),ve(d(sn(o),L((u)=>d(Fr(u.values()),en((f)=>d(Br(f,l),UC((h)=>Ua(h)?_(me):R()))))))),ve(n(l)),Xs));return yield*d(e,FZ(s),os({onFailure:(l)=>c(gr(d(l,fc(_)))),onSuccess:()=>c(Xr(R()))}),Ri),i.withPermits(1)(aa(sn(a)))})))),PO=(e)=>new Fe(Fp(_e(e))),S0e=p(2,(e,t)=>vo(_r()).pipe(Jo((r)=>yP((n)=>_e(t).pipe(Fp,Rl(n),tn((o)=>bu(r,o)),hn(n))).pipe(yW(lZ(e,r)))))),Z7=p(2,(e,t)=>{let r=(n)=>ln({onInput:(o)=>{let s=d(o,Zr(n)),i=Math.max(0,n-o.length);if(At(o)||i>0)return r(i);return d(Se(s),ir(Ml()))},onFailure:yr,onDone:()=>it});return new Fe(d(_e(e),xo(r(t))))}),E0e=p(2,(e,t)=>{if(t<=0)return iZ();return fa(()=>{let r=new QM(t),n=ln({onInput:(o)=>{let s=d(o,fy((i)=>{let a=r.head();return r.put(i),a}));return d(Se(s),he(()=>n))},onFailure:yr,onDone:()=>it});return new Fe(d(_e(e),xo(n)))})}),b0e=p(2,(e,t)=>Z7(X7(e,(r)=>!t(r)),1)),C0e=p(2,(e,t)=>{let r=ln({onInput:(n)=>d(eq(n,t),W(nt),W((o)=>{if(At(o))return no(()=>r);return d(Se(o),ir(Ml()))}),Yt),onFailure:yr,onDone:()=>it});return new Fe(d(_e(e),xo(r)))}),X7=p(2,(e,t)=>{let r=ln({onInput:(n)=>{let o=HL(n,t);if(At(o))return no(()=>r);return ir(Se(o),Ml())},onFailure:yr,onDone:_o});return new Fe(xo(_e(e),r))}),w0e=p(2,(e,t)=>{let r=ln({onInput:(n)=>d(tq(n,t),W(nt),W((o)=>{if(At(o))return no(()=>r);return ir(Se(o),Ml())}),Yt),onFailure:yr,onDone:()=>it});return new Fe(xo(_e(e),r))}),k0e=(e)=>d(e,is(ye),Kg((t)=>TO(Ie(t)))),Jg=new Fe(it),Gg=p(2,(e,t)=>new Fe(d(_e(e),pw(t)))),I0e=p(2,(e,t)=>new Fe(RS(_e(e),t))),cP=()=>vo(Pn()),A0e=(e)=>d(cP(),is(e)),O0e=(e)=>d(cP(),Hp(e)),bW=(e)=>d(cP(),Jo(e)),eZ=(e)=>PO(vo(e)),Vg=(e)=>FO(ie(_(e))),CW=(e)=>FO(PA(()=>_(e()))),lP=(e)=>vo(On(e)),_0e=(e)=>vo(vQ(e)),v0e=p(2,(e,t)=>yw(e,sp(t))),tZ=p(2,(e,t)=>{let r=(n)=>{let o=n.next();if(o.done)return tr({onInput:(s)=>r(s[Symbol.iterator]()),onFailure:ht,onDone:go});else return d(t(o.value),W((s)=>s?d(Se(We(o.value)),he(()=>r(n))):r(n)),Yt)};return new Fe(no(()=>d(_e(e),kt(r(Ze()[Symbol.iterator]())))))}),YS=p(2,(e,t)=>yw(e,fy(t))),T0e=p(2,(e,t)=>fa(()=>{let r=(n)=>{let o=n.next();if(o.done)return tr({onInput:(s)=>r(s[Symbol.iterator]()),onFailure:ht,onDone:go});else return d(t(o.value),be({onNone:()=>Ce(()=>r(n)),onSome:W((s)=>he(Se(We(s)),()=>r(n)))}),Yt)};return new Fe(d(_e(e),kt(r(Ze()[Symbol.iterator]()))))})),R0e=p(2,(e,t)=>{let r=ln({onInput:(n)=>{let o=W4(n,t);if(o.length===n.length)return d(Se(o),he(()=>r));return Se(o)},onFailure:yr,onDone:go});return new Fe(d(_e(e),xo(r)))}),M0e=p(2,(e,t)=>fa(()=>{let r=(n)=>{let o=n.next();if(o.done)return tr({onInput:(s)=>r(s[Symbol.iterator]()),onFailure:ht,onDone:go});else return Yt(be(t(o.value),{onNone:()=>N(it),onSome:W((s)=>he(Se(We(s)),()=>r(n)))}))};return new Fe(d(_e(e),xo(r(Ze()[Symbol.iterator]()))))})),P0e=(e)=>B7(me,()=>e),D0e=p(2,(e,t)=>{let r=ln({onInput:(n)=>be($L(n,t),{onNone:()=>r,onSome:(o)=>Se(We(o))}),onFailure:yr,onDone:()=>it});return new Fe(d(_e(e),kt(r)))}),F0e=p(2,(e,t)=>{let r=ln({onInput:(n)=>d(_Q(n,t),W(be({onNone:()=>r,onSome:(o)=>Se(We(o))})),Yt),onFailure:yr,onDone:()=>it});return new Fe(d(_e(e),kt(r)))}),Jo=p((e)=>Kc(e[0]),(e,t,r)=>{let n=r?.bufferSize??16;if(r?.switch)return sP(r?.concurrency,()=>VTe(e,1,n,t),(o)=>VTe(e,o,n,t));return sP(r?.concurrency,()=>new Fe(Dp(_e(e),(o)=>d(o,Vr((s)=>_e(t(s))),ip(it,(s,i)=>d(s,ir(i)))))),(o)=>new Fe(d(_e(e),Dp(pa),MB((s)=>_e(t(s)),r))))}),sP=(e,t,r)=>{switch(e){case void 0:return t();case"unbounded":return r(Number.MAX_SAFE_INTEGER);default:return e>1?r(e):t()}},VTe=p(4,(e,t,r,n)=>new Fe(d(_e(e),Dp(pa),MB((o)=>_e(n(o)),{concurrency:t,mergeStrategy:j_e(),bufferSize:r})))),DO=p((e)=>Kc(e[0]),(e,t)=>Jo(e,te,t)),uP=(e)=>{let t=tr({onInput:(r)=>he(pa(r),()=>t),onFailure:ht,onDone:()=>it});return new Fe(d(_e(e),kt(t)))},N0e=p((e)=>Kc(e[0]),(e,t)=>t?.unordered?Jo(e,(r)=>vo(r),{concurrency:t.concurrency}):sP(t?.concurrency,()=>Hp(e,te),(r)=>new Fe(d(_e(e),Dp(pa),RB(te,r),BS(We))))),xw=(e)=>{let t=(n,o)=>{let[s,i]=d(n,WL((c)=>!Uc(c))),a=d(If(i),be({onNone:()=>o,onSome:to({onFailure:(c)=>be(IC(c),{onNone:()=>it,onSome:ht}),onSuccess:()=>it})}));return d(Se(d(s,fy((c)=>Uc(c)?_(c.value):R()))),he(()=>a))},r=tr({onInput:(n)=>t(n,r),onFailure:(n)=>ht(n),onDone:()=>it});return new Fe(d(_e(e),kt(r)))},L0e=(e)=>d(e,is(Fr),uP),eE=(e)=>uP(xw(d(e,is((t)=>t.exit)))),wW=(e)=>new Fe(OM(_e(e))),U0e=(e,t)=>d(vr(Ce(()=>e[Symbol.asyncIterator]()),(r)=>r.return?LC(async()=>r.return()):me),W((r)=>XS(d(Ds({try:async()=>r.next(),catch:(n)=>_(t(n))}),L((n)=>n.done?ie(R()):N(n.value))))),sd),tE=(e)=>new Fe(e),_e=(e)=>{if("channel"in e)return e.channel;else if(mn(e))return _e(vo(e));else throw TypeError("Expected a Stream.")},ZS=(e)=>new Fe(At(e)?it:Se(e)),H0e=(e,t)=>{if(t?.scoped){let n=W(Um(e),dW);return t.shutdown?W(n,Gg(aO(e))):n}let r=Jo(Ew(Um(e)),dW);return t?.shutdown?Gg(r,aO(e)):r},dW=(e,t)=>d($a(e),tn((r)=>d(gM(e),L((n)=>n&&Ua(r)?tP():pW(r)))),Qg,t?.shutdown?Gg(zn(e)):te),q0e=(...e)=>d(NO(e),Jo(ZS)),vo=(e)=>d(e,br(_),FO),FO=(e)=>new Fe(Yt(Fs(e,{onFailure:be({onNone:()=>it,onSome:yr}),onSuccess:(t)=>Se(We(t))}))),rZ=(e,t)=>{let r=t?.maxChunkSize??RO;if(t?.scoped){let o=W(Um(e),(s)=>Up(s,{maxChunkSize:r,shutdown:!0}));return t.shutdown?W(o,Gg(aO(e))):o}let n=Jo(Ew(Um(e)),(o)=>Up(o,{maxChunkSize:r}));return t?.shutdown?Gg(n,aO(e)):n},B0e=(e)=>sd(W(ITe(e),(t)=>oZ(t))),NO=(e)=>fa(()=>Yd(e)?ZS(e):nZ(e[Symbol.iterator]())),W0e=(e)=>d(e,W(NO),rE),nZ=(e,t=RO)=>d(Ce(()=>{let r=[],n=(o)=>d(Ce(()=>{let s=o.next();if(t===1){if(s.done)return it;return d(Se(We(s.value)),he(()=>n(o)))}r=[];let i=0;while(s.done===!1){if(r.push(s.value),i=i+1,i>=t)break;s=o.next()}if(i>0)return d(Se(nt(r)),he(()=>n(o)));return it}),Yt);return new Fe(n(e))}),rE),pP=(e)=>d(e,W(Qg),sd),Up=(e,t)=>d(Jq(e,1,t?.maxChunkSize??RO),tn((r)=>d(gM(e),L((n)=>n&&Ua(r)?tP():pW(r)))),Qg,t?.shutdown?Gg(zn(e)):te),oZ=(e)=>d(OTe(e),W(We),tn((t)=>d(ATe(e),L((r)=>r&&Ua(t)?tP():pW(t)))),Qg),z0e=(e)=>d(zS(e),W((t)=>XS(t.next(void 0))),rE),$0e=(...e)=>{let t=e.length===1?e[0].evaluate:e[0],r=e.length===1?e[0].onError:e[1],n=e.length===1?e[0].releaseLockOnEnd===!0:!1;return sd(W(vr(Ce(()=>t().getReader()),(o)=>n?Ce(()=>o.releaseLock()):LC(()=>o.cancel())),(o)=>XS(L(Ds({try:()=>o.read(),catch:(s)=>_(r(s))}),({done:s,value:i})=>s?ie(R()):N(i)))))},j0e=(...e)=>{let t=e.length===1?e[0].evaluate:e[0],r=e.length===1?e[0].onError:e[1],n=(e.length===1?e[0].bufferSize:e[2])??4096,o=e.length===1?e[0].releaseLockOnEnd===!0:!1;return sd(W(vr(Ce(()=>t().getReader({mode:"byob"})),(s)=>o?Ce(()=>s.releaseLock()):LC(()=>s.cancel())),(s)=>Kg(wW(Tgt(s,r,n)),(i)=>i===V0e?Jg:Vg(i))))},V0e=Symbol.for("effect/Stream/EOF"),Tgt=(e,t,r)=>{let n=new ArrayBuffer(r);return gZ(0,(o)=>L(Ds({try:()=>e.read(new Uint8Array(n,o,n.byteLength-o)),catch:(s)=>t(s)}),({done:s,value:i})=>{if(s)return ie(V0e);let a=o+i.byteLength;return N([i,a>=n.byteLength?R():_(a)])}))},G0e=p(2,(e,t)=>{let r=(o,s)=>{if(At(s))return[o,Ze()];let i=[],a=0,c=0,l=void 0,u=Ze();switch(o._tag){case"Some":{let y=o.value;l=y[0];let E=!0;while(E&&c<s.length){let b=dn(s,c),w=t(b);if(!ge(l,w)){let T=y[1],A=nt(Array.from(s).slice(a,c)),k=Vt(T,A);i.push([l,k]),l=w,a=c,E=!1}c=c+1}if(E)u=y[1];break}case"None":{l=t(dn(s,c)),c=c+1;break}}while(c<s.length){let y=dn(s,c),E=t(y);if(!ge(l,E))i.push([l,nt(Array.from(s).slice(a,c))]),l=E,a=c;c=c+1}let f=Vt(u,nt(Array.from(s).slice(a,c))),h=nt(i);return[_([l,f]),h]},n=(o)=>tr({onInput:(s)=>{let[i,a]=r(o,s);return At(a)?n(i):he(Se(a),()=>n(i))},onFailure:(s)=>be(o,{onNone:()=>ht(s),onSome:(i)=>he(Se(We(i)),()=>ht(s))}),onDone:(s)=>be(o,{onNone:()=>_o(s),onSome:(i)=>he(Se(We(i)),()=>_o(s))})});return new Fe(xo(_e(e),n(R())))}),K0e=p(2,(e,t)=>d(e,gP(t),iP)),J0e=p(3,(e,t,r)=>gW(e,j9(t),$S(r))),sZ=p(2,(e,t)=>{let r=(n)=>d(Gbe(n),W(be({onNone:()=>ln({onInput:(o)=>he(Se(o),()=>r(n)),onFailure:yr,onDone:()=>it}),onSome:to({onFailure:ht,onSuccess:()=>it})})),Yt);return new Fe(Np((n)=>t.pipe(hn(n),W((o)=>_e(e).pipe(kt(r(o)))))))}),Q0e=p(2,(e,t)=>d(e,sZ(Em(t)))),Y0e=p(2,(e,t)=>{let r=d(jke(t),W(be({onNone:()=>ln({onInput:(n)=>d(Se(n),he(()=>r)),onFailure:yr,onDone:()=>it}),onSome:(n)=>Yt(Fs(n,{onFailure:yr,onSuccess:()=>it}))})),Yt);return new Fe(d(_e(e),kt(r)))}),iZ=()=>new Fe(Ml()),Z0e=p(2,(e,t)=>d(e,aZ(t,wW(TO(!0,!1))))),aZ=p(3,(e,t,r)=>{let n=(o)=>tr({onInput:(s)=>he(Ye(oo(o,uW(s))),()=>n(o)),onFailure:(s)=>Ye(oo(o,zg(s))),onDone:()=>Ye(oo(o,od))});return new Fe(Np((o)=>d(Dl(),Ns(Dl()),sr(([s])=>_e(e).pipe(Dp(pa),kt(n(s)),Rl(o),hn(o))),sr(([s,i])=>_e(t).pipe(Dp(pa),kt(n(i)),Rl(o),hn(o))),W(([s,i])=>{let a=(c,l)=>tr({onInput:(u)=>{if(u&&!c)return d(Ye(Fl(s)),he(_O({onEnd:()=>l?it:a(!0,l),onFailure:ht,onSuccess:(f)=>d(Se(f),he(()=>a(c,l)))})));if(!u&&!l)return d(Ye(Fl(i)),he(_O({onEnd:()=>c?it:a(c,!0),onFailure:ht,onSuccess:(f)=>d(Se(f),he(()=>a(c,l)))})));return a(c,l)},onFailure:ht,onDone:()=>it});return d(_e(r),Dp(pa),kt(a(!1,!1)))}))))}),cZ=p(2,(e,t)=>new Fe(d(_e(e),xo(no(()=>{let r=(n)=>tr({onInput:(o)=>{let s=[],i=n;for(let a of o)if(i)i=!1,s.push(a);else s.push(t),s.push(a);return d(Se(nt(s)),he(()=>r(i)))},onFailure:ht,onDone:()=>it});return r(!0)}))))),X0e=p(2,(e,{end:t,middle:r,start:n})=>d(TO(n),QS(d(e,cZ(r))),QS(TO(t)))),eRe=p(2,(e,t)=>d(e,kW(Em(t)))),kW=p(2,(e,t)=>new Fe(d(_e(e),_B(t)))),lZ=p(2,(e,t)=>new Fe(d(_e(e),N9(t)))),tRe=(e,t)=>ZZ(e,(r)=>_([r,t(r)])),TO=(...e)=>NO(e),is=p(2,(e,t)=>new Fe(d(_e(e),BS(Vr(t))))),IW=p(3,(e,t,r)=>{let n=(o)=>ln({onInput:(s)=>{let[i,a]=BL(s,o,r);return he(Se(a),()=>n(i))},onFailure:yr,onDone:()=>it});return new Fe(d(_e(e),kt(n(t))))}),AW=p(3,(e,t,r)=>fa(()=>{let n=(o)=>ln({onInput:(s)=>d(Qe(()=>{let i=[],a=(c)=>Ce(()=>{i.push(c)});return d(s,_R(o,(c,l)=>d(r(c,l),L(([u,f])=>d(a(f),qr(u))))),Fs({onFailure:(c)=>{if(i.length!==0)return ir(Se(nt(i)),yr(c));return yr(c)},onSuccess:(c)=>he(Se(nt(i)),()=>n(c))}))}),Yt),onFailure:yr,onDone:()=>it});return new Fe(d(_e(e),xo(n(t))))})),rRe=p(2,(e,t)=>d(e,OW(t.onFailure),is(t.onSuccess))),yw=p(2,(e,t)=>new Fe(d(_e(e),BS(t)))),nRe=p(2,(e,t)=>new Fe(d(_e(e),AM(t)))),oRe=p(2,(e,t)=>d(e,fP((r)=>Fr(t(r))))),fP=p(2,(e,t)=>d(e,yw(qL(t)))),sRe=p(2,(e,t)=>d(e,Hp(t),fP(te))),iRe=p(2,(e,t)=>d(e,Hp((r)=>d(t(r),W(Fr))),fP(te))),Hp=p(2,(e,t)=>{let r=(n)=>{let o=n.next();if(o.done)return tr({onInput:(s)=>r(s[Symbol.iterator]()),onFailure:ht,onDone:go});else{let s=o.value;return Yt(W(t(s),(i)=>he(Se(We(i)),()=>r(n))))}};return new Fe(d(_e(e),kt(no(()=>r(Ze()[Symbol.iterator]())))))}),aRe=p(3,(e,t,r)=>new Fe(d(_e(e),Dp(pa),RB(r,t),BS(We)))),OW=p(2,(e,t)=>new Fe(d(_e(e),vB(t)))),cRe=p(2,(e,t)=>new Fe(d(_e(e),TB(t)))),dP=p((e)=>Kc(e[1]),(e,t,r)=>vW(e,t,{onSelf:te,onOther:te,haltStrategy:r?.haltStrategy})),_W=p((e)=>(Symbol.iterator in e[0]),(e,t)=>DO(NO(e),t)),lRe=p(2,(e,t)=>{let n=Object.keys(e).map((o)=>e[o].pipe(is((s)=>({_tag:o,value:s}))));return _W(n,t)}),uZ=p(2,(e,t)=>vW(e,t,{onSelf:Ie,onOther:ye})),uRe=p(2,(e,t)=>d(e,dP(PO(t)))),pRe=p(2,(e,t)=>d(PO(e),dP(t))),vW=p(3,(e,t,r)=>{let n=r.haltStrategy?n7(r.haltStrategy):Hve,o=(s)=>(i)=>s||!Uc(i)?bve(Qe(()=>i)):Cve((a)=>Qe(()=>a));return new Fe(WS(_e(is(e,r.onSelf)),{other:_e(is(t,r.onOther)),onSelfDone:o(n._tag==="Either"||n._tag==="Left"),onOtherDone:o(n._tag==="Either"||n._tag==="Right")}))}),fRe=(e)=>yc(e,X9),dRe=vo(mS),mRe=p(2,(e,t)=>QS(e,PO(vo(t)))),hRe=p(2,(e,t)=>d(e,MO((r)=>vo(d(t(r),ve(On(r))))))),gRe=p(2,(e,t)=>new Fe(d(_e(e),RS((r)=>Uc(r)?t():me)))),xRe=p(2,(e,t)=>rE(qr(t,e))),yRe=(e)=>d(e,pZ(te)),pZ=p(2,(e,t)=>new Fe(d(_e(e),L9(t)))),mP=p(2,(e,t)=>new Fe(d(_e(e),PB(()=>_e(t()))))),SRe=p(2,(e,t)=>d(e,is(Ie),mP(()=>d(t(),is(ye))))),ERe=p(2,(e,t)=>d(e,mP(()=>CW(t)))),bRe=p(2,(e,t)=>d(e,fZ(()=>We(t())))),fZ=p(2,(e,t)=>d(e,dZ(()=>new Fe(Se(t()))))),dZ=p(2,(e,t)=>{let r=ln({onInput:(n)=>{if(At(n))return no(()=>r);return d(Se(n),ir(Ml()))},onFailure:yr,onDone:()=>no(()=>_e(t()))});return new Fe(d(_e(e),kt(r)))}),CRe=p(2,(e,t)=>d(e,mP(()=>zZ(t)))),wRe=(e,t)=>mZ(e,(r)=>{let n=t(r);return[We(n[0]),n[1]]}),mZ=(e,t)=>{let r=(n)=>{let o=t(n);return be(o[1],{onNone:()=>ir(Se(o[0]),it),onSome:(s)=>he(Se(o[0]),()=>r(s))})};return new Fe(no(()=>r(e)))},hZ=(e,t)=>{let r=(n)=>Yt(W(t(n),([o,s])=>be(s,{onNone:()=>ir(Se(o),it),onSome:(i)=>he(Se(o),()=>r(i))})));return new Fe(no(()=>r(e)))},gZ=(e,t)=>hZ(e,(r)=>d(t(r),W(([n,o])=>[We(n),o]))),kRe=p(2,(e,t)=>d(_r(),L((s)=>d(Dl(),W((i)=>{let a=HB(V9(t),{onFailure:(l)=>Y9(zB(KH(s,l)),vM(l)),onSuccess:([l,u])=>{let f=tr({onInput:(h)=>he(Ye(oo(i,{_tag:"Emit",elements:h})),()=>f),onFailure:(h)=>ir(Ye(oo(i,{_tag:"Halt",cause:h})),ht(h)),onDone:(h)=>ir(Ye(oo(i,{_tag:"End"})),it)});return MM(d(Ye(mo(s,l)),ir(Ye(d(i,oo({_tag:"Emit",elements:u})))),ir(f)))}}),c=d(Fl(i),W((l)=>{switch(l._tag){case"Emit":return d(Se(l.elements),he(()=>c));case"Halt":return ht(l.cause);case"End":return it}}),Yt);return d(e,GZ((l)=>bu(s,l)),yc(a),Ri,ve(Wt(s)),W((l)=>[l,new Fe(c)]))}))),aa)),IRe=p((e)=>typeof e[1]==="function",(e,t,r)=>xZ(e,(n)=>N(t(n)?ye(n):Ie(n)),r)),xZ=p((e)=>typeof e[1]==="function",(e,t,r)=>d(Hp(e,t),J7({size:2,maximumLag:r?.bufferSize??16,decide:Ir({onLeft:()=>N((n)=>n===0),onRight:()=>N((n)=>n===1)})}),L(([n,o])=>N([YS(xw(Up(n,{shutdown:!0})),(s)=>Ir(s,{onLeft:_,onRight:R})),YS(xw(Up(o,{shutdown:!0})),(s)=>Ir(s,{onLeft:R,onRight:_}))])))),ARe=p(2,(e,t)=>new Fe(d(_e(e),xo(Di(t))))),yZ=p(2,(e,t)=>new Fe(kt(_e(e),t))),ORe=p(2,(e,t)=>new Fe(d(_e(e),xo(t)))),_Re=p(2,(e,t)=>new Fe(ir(Se(t),_e(e)))),TW=p(2,(e,t)=>new Fe(d(_e(e),MS(t)))),SZ=p(2,(e,t)=>RW(e,Rn(t))),EZ=p(2,(e,t)=>new Fe(Np((r)=>YY(t,r).pipe(W((n)=>d(_e(e),MS(n))))))),vRe=p(3,(e,t,r)=>hP(e,t,N(r))),hP=p(3,(e,t,r)=>bZ(e,t,vo(r))),bZ=p(3,(e,t,r)=>bW((n)=>Jo(r,(o)=>d(e,TW(or(n,t,o)))))),RW=p(2,(e,t)=>bW((r)=>d(e,TW(t(r))))),CZ=p(2,(e,t)=>d(e,EZ(d(Lq(),Uq(t))))),TRe=(e,t,r=RO)=>fa(()=>{if(e>t)return Jg;let n=(o,s,i)=>{let a=s-o+1;if(a>i)return d(Se(aT(o,o+i-1)),he(()=>n(o+i,s,i)));return Se(aT(o,o+a-1))};return new Fe(n(e,t,r))}),RRe=p(2,(e,t)=>wZ(e,t)),wZ=(...e)=>_r().pipe(W((t)=>{let r=null;return _W(e.map((n,o)=>n.pipe($Z(()=>{if(r===null)return r=o,Cu(t,ta),!0;return r===o}),kW(Wt(t).pipe(L(()=>r===o?mS:me))))),{concurrency:e.length})}),rE),gP=p(2,(e,t)=>fa(()=>{let r=Math.max(t,1),n=fW(new MRe(r),r);return new Fe(d(_e(e),kt(n)))})),fW=(e,t)=>tr({onInput:(r)=>{if(r.length===t&&e.isEmpty())return he(Se(r),()=>fW(e,t));if(r.length>0){let n=[],o=void 0,s=0;while(s<r.length){while(s<r.length&&o===void 0)o=e.write(d(r,dn(s))),s=s+1;if(o!==void 0)n.push(o),o=void 0}return he(W9(...n),()=>fW(e,t))}return no(()=>fW(e,t))},onFailure:(r)=>ir(e.emitIfNotEmpty(),ht(r)),onDone:()=>e.emitIfNotEmpty()});class MRe{n;builder=[];pos=0;constructor(e){this.n=e}isEmpty(){return this.pos===0}write(e){if(this.builder.push(e),this.pos+=1,this.pos===this.n){let t=nt(this.builder);return this.builder=[],this.pos=0,t}return}emitIfNotEmpty(){if(this.pos!==0)return Se(nt(this.builder));return it}}var PRe=p(2,(e,t)=>d(e,kZ(t,te))),kZ=p(3,(e,t,r)=>new Fe(HS(_e(e),(n)=>be(t(n),{onNone:()=>ht(oa(r(n))),onSome:yr})))),DRe=p(2,(e,t)=>YS(IZ(e,t),(r)=>Ir(r,{onLeft:R,onRight:_}))),FRe=(e)=>XS(d(e,br(_))),NRe=(e)=>Qg(d(e,br(_))),Qg=(e)=>EP(e,(t)=>d(W(t,(r)=>_([r,t])),jo(be({onNone:()=>N(R()),onSome:ie})))),XS=(e)=>Qg(d(e,W(We))),IZ=p(2,(e,t)=>OZ(e,t,{onElement:(r)=>ye(r),onSchedule:Ie})),LRe=p(2,(e,t)=>YS(AZ(e,t,{onElement:(r)=>_(r),onSchedule:R}),te)),AZ=p(3,(e,t,r)=>{let n=d(zS(t),W((o)=>{let s=(c)=>be(If(c),{onNone:()=>a,onSome:(l)=>ir(Se(We(r.onElement(l))),i(d(c,Zr(1)),l))}),i=(c,l)=>{let u=d(o.next(l),qr(d(Se(We(r.onElement(l))),he(()=>i(c,l))))),f=d(o.last,Pr,L((h)=>d(o.reset,W(()=>d(Se(We(r.onSchedule(h))),ir(s(c)))))));return d(u,Pm(()=>f),Yt)},a=ln({onInput:s,onFailure:yr,onDone:()=>it});return a}),Yt);return new Fe(d(_e(e),kt(n)))}),URe=(e)=>new Fe(OM(Se(We(e)))),OZ=p(3,(e,t,r)=>d(zS(t),W((n)=>{let o=hP(VB,sn(n.iterationMeta)),s=d(e,o,is(r.onElement),_e),i=Yt(Fs(n.next(void 0),{onFailure:()=>it,onSuccess:(a)=>he(s,()=>ir(Se(We(r.onSchedule(a))),i))}));return new Fe(ir(s,i))}),rE)),Rgt=(e,t)=>_Z(N(e),t),_Z=(e,t)=>Jo(vo(Ns(e,zS(t))),([r,n])=>{let o=ku(VB,sn(n.iterationMeta));return QS(SP(r),LW(r,(s)=>wr(n.next(s),{onFailure:N,onSuccess:()=>W(o(e),(i)=>_([i,i]))})))}),mW=p(2,(e,t)=>zS(t).pipe(W((r)=>{let n=hP(VB,sn(r.iterationMeta)),o=_e(n(e)).pipe(AM((s)=>qr(r.reset,s)),HS((s)=>r.next(s).pipe(Fs({onFailure:()=>yr(s),onSuccess:()=>o}),Yt)));return o}),Yt,tE)),HRe=p((e)=>Kc(e[0]),(e,t,r)=>fa(()=>{let n=r?.preventFallbackOnPartialStream??!1,o=0,s=R(),i=fa(()=>{let a=t.steps[o++];if(!a)return Vg(ru(s));let c=eT(a.provide)?SZ(e,a.provide):CZ(e,a.provide),l=!1;if(Oe(s)){let u=s.value,f=!1,h=c;c=fa(()=>{if(f)return h;return f=!0,Vg(u)}),c=GTe(mW(c,kR(a,!1)))}else{let u=kR(a,!0);c=u?GTe(mW(c,u)):c}return Kg(n?yw(c,(u)=>(l=!0,u)):c,(u)=>{if(n&&l)return Vg(u);return s=_(u),i})});return i})),GTe=(e)=>MO(e,(t)=>lP(yQ(t))),yc=p(2,(e,t)=>_e(e).pipe(xo(Di(t)),U9)),qRe=(e)=>yc(e,$9()),BRe=(e)=>yc(e,Z9),WRe=(e)=>yc(e,UB),zRe=p(3,(e,t,r)=>vZ(e,t,uo,r)),$Re=p(3,(e,t,r)=>TZ(e,t,uo,r)),jRe=p(3,(e,t,r)=>d(e,RZ(t,uo,r))),VRe=p(3,(e,t,r)=>d(e,MZ(t,uo,r))),vZ=p(4,(e,t,r,n)=>yc(e,TM(t,r,n))),TZ=p(4,(e,t,r,n)=>yc(e,qB(t,r,n))),RZ=p(4,(e,t,r,n)=>d(e,Sw(TM(t,r,n)))),MZ=p(4,(e,t,r,n)=>d(e,Sw(qB(t,r,n)))),PZ=p(2,(e,t)=>yc(e,RM(t))),DZ=p(2,(e,t)=>yc(e,BB(t))),GRe=p(2,(e,t)=>d(e,Sw(BB(t)))),FZ=p(2,(e,t)=>d(e,Sw(RM(t)))),KRe=p(2,(e,t)=>yc(e,WB(t))),JRe=p(2,(e,t)=>d(e,Sw(WB(t)))),QRe=(e)=>yc(e,G9()),YRe=p(2,(e,t)=>d(e,NZ(t))),MW=p(2,(e,t)=>d(e,xP(t))),NZ=p(2,(e,t)=>d(e,xP(t),ei)),LZ=p(2,(e,t)=>{let r=tr({onInput:(n)=>he(Ye(u9(t,Vr(n,Nt))),()=>r),onFailure:(n)=>Ye(Br(t,gr(fc(n,_)))),onDone:()=>Ye(Br(t,Xr(R())))});return d(kt(_e(e),r),Fp,EO,Xs)}),xP=p(2,(e,t)=>{let r=tr({onInput:(n)=>he(Se(Wg(n)),()=>r),onFailure:(n)=>Se(zg(n)),onDone:()=>Se(od)});return d(kt(_e(e),r),AM((n)=>Br(t,n)),Fp,EO,Xs)}),ZRe=(e)=>yc(e,K9()),Sw=p(2,(e,t)=>d(_e(e),xo(Di(t)),Fp,EO)),XRe=(e)=>yc(e,Q9),eMe=p(3,(e,t,r)=>d(e,qZ(t,(n,o)=>N(r(n,o))))),tMe=p(2,(e,t)=>d(e,UZ((r,n)=>N(t(r,n))))),UZ=p(2,(e,t)=>d(e,AW(R(),(r,n)=>{switch(r._tag){case"None":return N([_(n),n]);case"Some":return d(t(r.value,n),W((o)=>[_(o),o]))}}))),rMe=p(2,(e,t)=>YS(HZ(e,t,{onElement:_,onSchedule:R}),te)),HZ=p(3,(e,t,r)=>{let n=(o,s)=>{let i=s.next();if(i.done)return tr({onInput:(a)=>n(o,a[Symbol.iterator]()),onFailure:ht,onDone:_o});return Yt(wr(o.next(i.value),{onFailure:()=>d(o.last,Pr,W((a)=>d(Se(kf(r.onElement(i.value),r.onSchedule(a))),he(()=>n(o,s)))),Ba(o.reset)),onSuccess:()=>N(d(Se(We(r.onElement(i.value))),he(()=>n(o,s))))}))};return new Fe(d(Ye(zS(t)),he((o)=>d(_e(e),kt(n(o,Ze()[Symbol.iterator]()))))))}),qZ=p(3,(e,t,r)=>new Fe(d(Se(We(t)),he(()=>_e(d(e,AW(t,(n,o)=>d(r(n,o),W((s)=>[s,s]))))))))),Ew=(e)=>new Fe(pw(DB(d(e,W(We))),me)),yP=(e)=>new Fe(FB((t)=>e(t).pipe(W(We)))),nMe=(e)=>d(e,OW(_),BZ(()=>R())),oMe=p(2,(e,t)=>d(e,is(Je(t)))),BZ=p(2,(e,t)=>Hp(e,be({onNone:()=>PA(t),onSome:N}))),sMe=p(2,(e,t)=>WZ(e,t,1)),WZ=p(3,(e,t,r)=>{if(t<=0||r<=0)return EW(new Xy("Invalid bounds - `chunkSize` and `stepSize` must be greater than zero"));return new Fe(no(()=>{let n=new QM(t),o=(i,a)=>{if(i<t){let h=n.toChunk(),y=At(h)?Ze():We(h);return d(Se(y),he(()=>a))}let c=i-(i-t)%r;if(c===i)return a;let l=i-(c-t+r),u=d(n.toChunk(),sT(l)),f=At(u)?Ze():We(u);return d(Se(f),he(()=>a))},s=(i)=>tr({onInput:(a)=>he(Se(fy(a,(c,l)=>{n.put(c);let u=i+l+1;if(u<t||(u-t)%r>0)return R();return _(n.toChunk())})),()=>s(i+a.length)),onFailure:(a)=>o(i,ht(a)),onDone:()=>o(i,it)});return d(_e(e),kt(s(0)))}))}),iMe=p(2,(e,t)=>{let r=(o,s)=>{let[i,a]=d(o,Vt(s),WL(t));if(At(i)||At(a))return n(d(i,Vt(d(a,Zr(1)))));return d(Se(We(i)),he(()=>r(Ze(),d(a,Zr(1)))))},n=(o)=>ln({onInput:(s)=>r(o,s),onFailure:yr,onDone:()=>{if(At(o))return it;if(vt(d(o,$L(t))))return ir(Se(We(o)),it);return ir(r(Ze(),o),it)}});return new Fe(d(_e(e),kt(n(Ze()))))}),aMe=p(2,(e,t)=>{let r=(n,o)=>tr({onInput:(s)=>{let i,[a,c]=d(s,ip([d(n,Je(()=>Ze())),o],([u,f],h)=>{let y=d(u,Is(h));if(f<t.length&&ge(h,d(t,dn(f)))){if(f+1===t.length){if(i===void 0)i=[];return i.push(d(y,Ii(y.length-t.length))),[Ze(),0]}return[y,f+1]}return[y,ge(h,d(t,dn(0)))?1:0]})),l=i===void 0?Ze():nt(i);return he(Se(l),()=>r(kn(a)?_(a):R(),c))},onFailure:(s)=>be(n,{onNone:()=>ht(s),onSome:(i)=>ir(Se(We(i)),ht(s))}),onDone:(s)=>be(n,{onNone:()=>go(s),onSome:(i)=>ir(Se(We(i)),go(s))})});return new Fe(d(_e(e),kt(r(R(),0))))}),cMe=(e)=>yZ(e,H9()),SP=(e)=>ZS(We(e)),zZ=(e)=>fa(()=>ZS(We(e()))),fa=(e)=>new Fe(no(()=>_e(e()))),lMe=p(2,(e,t)=>{if(!Number.isInteger(t))return EW(new Xy(`${t} must be an integer`));let r=(n)=>ln({onInput:(o)=>{let s=d(o,Ii(Math.min(n,Number.POSITIVE_INFINITY))),i=Math.max(0,n-s.length);if(i>0)return d(Se(s),he(()=>r(i)));return Se(s)},onFailure:yr,onDone:go});return new Fe(d(_e(e),xo(0<t?r(t):it)))}),uMe=p(2,(e,t)=>{if(t<=0)return Jg;return new Fe(d(N(new QM(t)),W((r)=>{let n=ln({onInput:(o)=>{for(let s of o)r.put(s);return n},onFailure:yr,onDone:()=>d(Se(r.toChunk()),ir(it))});return d(_e(e),kt(n))}),Yt))}),pMe=p(2,(e,t)=>{let r=ln({onInput:(n)=>{let o=d(n,zL((i)=>!t(i))),s=d(n,Zr(o.length),Ii(1));if(At(s))return d(Se(o),he(()=>r));return Se(d(o,Vt(s)))},onFailure:yr,onDone:go});return new Fe(d(_e(e),xo(r)))}),fMe=p(2,(e,t)=>{let r=(n)=>{let o=n.next();if(o.done)return tr({onInput:(s)=>r(s[Symbol.iterator]()),onFailure:ht,onDone:go});return d(t(o.value),W((s)=>s?Se(We(o.value)):d(Se(We(o.value)),he(()=>r(n)))),Yt)};return new Fe(d(_e(e),kt(r(Ze()[Symbol.iterator]()))))}),$Z=p(2,(e,t)=>{let r=ln({onInput:(n)=>{let o=d(n,zL(t));if(o.length===n.length)return d(Se(o),he(()=>r));return Se(o)},onFailure:yr,onDone:go});return new Fe(d(_e(e),xo(r)))}),jZ=p(2,(e,t)=>Hp(e,(r)=>qr(t(r),r))),dMe=p(2,(e,t)=>d(e,VZ(t.onFailure),jZ(t.onSuccess))),VZ=p(2,(e,t)=>Kg(e,(r)=>vo(ve(t(r),ie(r))))),GZ=p(2,(e,t)=>{let r=tr({onInput:(n)=>he(Se(n),()=>r),onFailure:(n)=>Ye(ve(t(n),On(n))),onDone:_o});return new Fe(d(_e(e),kt(r)))}),mMe=p(2,(e,t)=>d(vo(Ha([Tl(1),_r()])),Jo(([r,n])=>{let o=eE(Up(r,{maxChunkSize:1})),s=tr({onInput:(i)=>d(Ye(Br(r,Wg(i))),aw({onFailure:()=>he(Se(i),()=>Ml()),onSuccess:()=>he(Se(i),()=>s)})),onFailure:(i)=>d(Ye(Br(r,zg(i))),aw({onFailure:()=>ht(i),onSuccess:()=>ht(i)})),onDone:()=>d(Ye(Br(r,od)),aw({onFailure:()=>it,onSuccess:()=>it}))});return d(new Fe(d(kt(_e(e),s),pw(ve(vp(Br(r,od)),Wt(n))))),dP(eZ(d(yc(o,t),qa(ve(zn(r),mo(n,void 0)))))))}))),hMe=p(2,(e,t)=>KZ(e,{...t,cost:(r)=>N(t.cost(r))})),KZ=p(2,(e,t)=>{if(t.strategy==="enforce")return Mgt(e,t.cost,t.units,t.duration,t.burst??0);return Pgt(e,t.cost,t.units,t.duration,t.burst??0)}),Mgt=(e,t,r,n,o)=>{let s=(a,c)=>tr({onInput:(l)=>d(t(l),Ns(wl),W(([u,f])=>{let y=(f-c)/ds(n),E=a+y*r,b=r+o<0?Number.POSITIVE_INFINITY:r+o,w=E<0?b:Math.min(E,b);if(u<=w)return d(Se(l),he(()=>s(w-u,f)));return s(a,c)}),Yt),onFailure:ht,onDone:()=>it}),i=d(wl,W((a)=>s(r,a)),Yt);return new Fe(d(_e(e),xo(i)))},Pgt=(e,t,r,n,o)=>{let s=(a,c)=>tr({onInput:(l)=>d(t(l),Ns(wl),W(([u,f])=>{let y=(f-c)/ds(n),E=a+y*r,b=r+o<0?Number.POSITIVE_INFINITY:r+o,T=(E<0?b:Math.min(E,b))-u,A=T>=0?0:-T/r,k=Bo(Math.max(0,A*ds(n)));if(pT(k,hl))return d(Ye(Em(k)),ir(Se(l)),he(()=>s(T,f)));return he(Se(l),()=>s(T,f))}),Yt),onFailure:ht,onDone:()=>it}),i=d(wl,W((a)=>s(r,a)),Yt);return new Fe(d(_e(e),xo(i)))},gMe=(e)=>Rgt(void 0,$S(e)),xMe=p(2,(e,t)=>d(gw(e),W(NQ({onTimeout:()=>R(),duration:t})),pP)),yMe=p(3,(e,t,r)=>d(e,QZ(r,CW(t)))),JZ=p(3,(e,t,r)=>d(gw(e),W(LQ({onTimeout:()=>fc(t(),_),duration:r})),pP)),QZ=p(3,(e,t,r)=>{let n=new Q0("Stream Timeout");return d(e,JZ(()=>oa(n),t),G7((o)=>G0(o)&&l5(o.defect)&&o.defect.message!==void 0&&o.defect.message==="Stream Timeout"?_(r):R()))}),SMe=(e)=>{if(typeof e==="number")return hM(e);else if(e.capacity==="unbounded")return p_e({replay:e.replay});switch(e.strategy){case"dropping":return l_e(e);case"sliding":return u_e(e);default:return hM(e)}},PW=p(2,(e,t)=>d(vr(SMe(t),(r)=>aO(r)),sr((r)=>d(e,MW(r),Ri)))),gw=(e)=>W(B9(_e(e)),(t)=>d(t,br(_),L(Ir({onLeft:()=>ie(R()),onRight:N})))),DW=p((e)=>Kc(e[0]),(e,t)=>sr(vr(t?.strategy==="unbounded"?TS():t?.strategy==="dropping"?cO(t.capacity??2):t?.strategy==="sliding"?lO(t.capacity??2):Tl(t?.capacity??2),(r)=>zn(r)),(r)=>Ri(xP(e,r)))),YZ=p((e)=>Kc(e[0]),(e,t)=>sr(vr(Tl(t?.capacity??2),(r)=>zn(r)),(r)=>Ri(LZ(e,r)))),EMe=p((e)=>Kc(e[0]),(e,t)=>FW(e,Hm,t)),bMe=p((e)=>Kc(e[0]),(e,t)=>W(Wc(),(r)=>FW(e,r,t))),FW=p((e)=>Kc(e[0]),(e,t,r)=>{let n=xc(t),o=void 0,s=void 0,i=Kf(!1);return new ReadableStream({start(a){s=n(DZ(e,(c)=>{if(c.length===0)return me;return i.whenOpen(Ce(()=>{i.unsafeClose();for(let l of c)a.enqueue(l);o(),o=void 0}))})),s.addObserver((c)=>{try{if(c._tag==="Failure")a.error(gi(c.cause));else a.close()}catch{}})},pull(){return new Promise((a)=>{o=a,xr(i.open)})},cancel(){if(!s)return;return Ag(Xs(Ts(s)))}},r?.strategy)}),CMe=p(2,(e,t)=>{let r=no(()=>{let n={ref:Ze()},o={ref:!1},s=no(()=>{let l=n.ref;if(At(l))return ln({onInput:(u)=>d(Se(u),he(()=>s)),onFailure:yr,onDone:_o});return n.ref=Ze(),d(pa(l),he(()=>s))}),i=(l)=>{let u=n.ref,f=Vt(u,sp(l,(h)=>h.length!==0));return n.ref=f,f},a=ln({onInput:(l)=>he(Se(l),()=>a),onFailure:yr,onDone:(l)=>ir(rd(()=>{o.ref=!0}),_o(l))}),c=d(t,Di,Pg,he(([l,u])=>d(go([o.ref,i(l)]),he(([f,h])=>{let y=f&&At(h)?it:c;return d(Se(We(u)),he(()=>y))}))));return d(_e(e),kt(a),kt(s),xo(c))});return new Fe(r)}),NW=p((e)=>Kc(e[0]),(e,t)=>{let r=xc(t);return{[Symbol.asyncIterator](){let n=void 0,o=void 0,s=void 0,i=Kf(!1),a=!1;return{next(){if(!s)s=r(PZ(e,(c)=>i.whenOpen(Ce(()=>{i.unsafeClose(),n({done:!1,value:c}),n=o=void 0})))),s.addObserver((c)=>{if(a)return;s=Al(i.whenOpen(Ce(()=>{if(c._tag==="Failure")o(gi(c.cause));else n({done:!0,value:void 0});n=o=void 0})))});return new Promise((c,l)=>{n=c,o=l,i.unsafeOpen()})},return(){if(a=!0,!s)return Promise.resolve({done:!0,value:void 0});return Ag(qr(Ts(s),{done:!0,value:void 0}))}}}}}),wMe=(e)=>NW(e,Hm),kMe=(e)=>W(Wc(),(t)=>NW(e,t)),ZZ=(e,t)=>XZ(e,(r)=>d(t(r),jt(([n,o])=>[We(n),o]))),XZ=(e,t)=>{let r=(n)=>be(t(n),{onNone:()=>it,onSome:([o,s])=>he(Se(o),()=>r(s))});return new Fe(no(()=>r(e)))},EP=(e,t)=>fa(()=>{let r=(n)=>Yt(W(t(n),be({onNone:()=>it,onSome:([o,s])=>he(Se(o),()=>r(s))})));return new Fe(r(e))}),LW=(e,t)=>EP(e,(r)=>d(t(r),W(jt(([n,o])=>[We(n),o])))),IMe=SP(void 0);var rE=(e)=>DO(vo(e)),sd=(e)=>DO(Ew(e)),LO=(e)=>DO(yP((t)=>e(t))),AMe=p(3,(e,t,r)=>d(e,RW((n)=>d(n,or(t,r(d(n,qo(t)))))))),OMe=p(2,(e,t)=>d(e,tX(Ce(t)))),_Me=(e,t)=>eX(t)(Ce(e)),eX=p(2,(e,t)=>d(vo(e),Jo((r)=>d(t(r),Je(()=>Jg))))),tX=p(2,(e,t)=>d(vo(t),Jo((r)=>r?e:Jg))),vMe=function(){let e=typeof arguments[0]!=="string",t=e?arguments[1]:arguments[0],r=Da(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return new Fe(NB(_e(n),t,r))}return(n)=>new Fe(NB(_e(n),t,r))},TMe=p(2,(e,t)=>d(e,HW(t,(r,n)=>[r,n]))),RMe=p(2,(e,t)=>d(e,HW(t,(r,n)=>[...r,n]))),MMe=p(2,(e,t)=>CP(e,{other:t.other,onSelf:(r)=>[r,t.defaultOther],onOther:(r)=>[t.defaultSelf,r],onBoth:(r,n)=>[r,n]})),PMe=p(3,(e,t,r)=>CP(e,{other:t,onSelf:te,onOther:()=>r,onBoth:(n)=>n})),DMe=p(3,(e,t,r)=>CP(e,{other:t,onSelf:()=>r,onOther:te,onBoth:(n,o)=>o})),FMe=p(2,(e,t)=>bP(e,{other:t.other,onSelf:(r)=>[r,t.defaultOther],onOther:(r)=>[t.defaultSelf,r],onBoth:(r,n)=>[r,n],order:t.order})),NMe=p(2,(e,t)=>bP(e,{other:t.other,onSelf:te,onOther:()=>t.defaultSelf,onBoth:(r)=>r,order:t.order})),LMe=p(2,(e,t)=>bP(e,{other:t.other,onSelf:()=>t.defaultOther,onOther:te,onBoth:(r,n)=>n,order:t.order})),bP=p(2,(e,t)=>{let r=(o,s,i)=>{switch(o._tag){case F7:return d(s,Fs({onFailure:Xr,onSuccess:(a)=>Nt([Vr(a,([c,l])=>[c,t.onSelf(l)]),VS])}));case N7:return d(i,Fs({onFailure:Xr,onSuccess:(a)=>Nt([Vr(a,([c,l])=>[c,t.onOther(l)]),GS])}));case L7:return d(JS(s),Ns(JS(i),{concurrent:!0}),wr({onFailure:(a)=>N(Xr(_(a))),onSuccess:([a,c])=>{if(Oe(a)&&Oe(c)){if(At(a.value)&&At(c.value))return r(KS,s,i);if(At(a.value))return r($g(c.value),s,i);if(At(c.value))return r(jg(a.value),s,i);return N(Nt(n(a.value,c.value)))}if(Oe(a)&&vt(c)){if(At(a.value))return r(VS,s,i);return N(Nt([d(a.value,Vr(([l,u])=>[l,t.onSelf(u)])),VS]))}if(vt(a)&&Oe(c)){if(At(c.value))return r(GS,s,i);return N(Nt([d(c.value,Vr(([l,u])=>[l,t.onOther(u)])),GS]))}return N(Xr(R()))}}));case U7:return wr(s,{onFailure:be({onNone:()=>N(Nt([d(o.rightChunk,Vr(([a,c])=>[a,t.onOther(c)])),GS])),onSome:(a)=>N(Xr(_(a)))}),onSuccess:(a)=>At(a)?r($g(o.rightChunk),s,i):N(Nt(n(a,o.rightChunk)))});case H7:return wr(i,{onFailure:be({onNone:()=>N(Nt([Vr(o.leftChunk,([a,c])=>[a,t.onSelf(c)]),VS])),onSome:(a)=>N(Xr(_(a)))}),onSuccess:(a)=>At(a)?r(jg(o.leftChunk),s,i):N(Nt(n(o.leftChunk,a)))})}},n=(o,s)=>{let i=(A,k)=>k<A.length-1,a=[],c=void 0,l=0,u=0,f=d(o,dn(l)),h=d(s,dn(u)),y=f[0],E=f[1],b=h[0],w=h[1],T=!0;while(T){let A=t.order(y,b);if(A===0)if(a.push([y,t.onBoth(E,w)]),i(o,l)&&i(s,u))l=l+1,u=u+1,f=d(o,dn(l)),h=d(s,dn(u)),y=f[0],E=f[1],b=h[0],w=h[1];else if(i(o,l))c=jg(d(o,Zr(l+1))),T=!1;else if(i(s,u))c=$g(d(s,Zr(u+1))),T=!1;else c=KS,T=!1;else if(A<0)if(a.push([y,t.onSelf(E)]),i(o,l))l=l+1,f=d(o,dn(l)),y=f[0],E=f[1];else{let k=[];k.push(h);while(i(s,u))u=u+1,h=d(s,dn(u)),k.push(h);c=$g(nt(k)),T=!1}else if(a.push([b,t.onOther(w)]),i(s,u))u=u+1,h=d(s,dn(u)),b=h[0],w=h[1];else{let k=[];k.push(f);while(i(o,l))l=l+1,f=d(o,dn(l)),k.push(f);c=jg(nt(k)),T=!1}}return[nt(a),c]};return aP(e,t.other,KS,r)}),CP=p(2,(e,t)=>{let r=(o,s,i)=>{switch(o._tag){case F7:return wr(s,{onFailure:(a)=>N(Xr(a)),onSuccess:(a)=>N(Nt([Vr(a,t.onSelf),VS]))});case N7:return wr(i,{onFailure:(a)=>N(Xr(a)),onSuccess:(a)=>N(Nt([Vr(a,t.onOther),GS]))});case L7:return d(JS(s),Ns(JS(i),{concurrent:!0}),wr({onFailure:(a)=>N(Xr(_(a))),onSuccess:([a,c])=>{if(Oe(a)&&Oe(c)){if(At(a.value)&&At(c.value))return r(KS,s,i);if(At(a.value))return r($g(c.value),s,i);if(At(c.value))return r(jg(a.value),s,i);return N(Nt(n(a.value,c.value,t.onBoth)))}if(Oe(a)&&vt(c))return N(Nt([Vr(a.value,t.onSelf),VS]));if(vt(a)&&Oe(c))return N(Nt([Vr(c.value,t.onOther),GS]));return N(Xr(R()))}}));case U7:return wr(s,{onFailure:be({onNone:()=>N(Nt([Vr(o.rightChunk,t.onOther),GS])),onSome:(a)=>N(Xr(_(a)))}),onSuccess:(a)=>{if(At(a))return r($g(o.rightChunk),s,i);if(At(o.rightChunk))return r(jg(a),s,i);return N(Nt(n(a,o.rightChunk,t.onBoth)))}});case H7:return wr(i,{onFailure:be({onNone:()=>N(Nt([Vr(o.leftChunk,t.onSelf),VS])),onSome:(a)=>N(Xr(_(a)))}),onSuccess:(a)=>{if(At(a))return r(jg(o.leftChunk),s,i);if(At(o.leftChunk))return r($g(a),s,i);return N(Nt(n(o.leftChunk,a,t.onBoth)))}})}},n=(o,s,i)=>{let[a,c]=WMe(o,s,i);switch(c._tag){case"Left":{if(At(c.left))return[a,KS];return[a,jg(c.left)]}case"Right":{if(At(c.right))return[a,KS];return[a,$g(c.right)]}}};return aP(e,t.other,KS,r)}),UMe=p(2,(e,t)=>d(e,UW(t,(r,n)=>[r,n]))),rX=(...e)=>{if(e.length===0)return Jg;else if(e.length===1)return is(e[0],(n)=>[n]);let[t,...r]=e;return UW(t,rX(...r),(n,o)=>[n,...o])},UW=p(3,(e,t,r)=>{let n=(o)=>d(o,L((s)=>At(s)?n(o):N(s)));return d(gw(e),W(n),Ns(d(gw(t),W(n))),L(([o,s])=>d(FO(SS(o,s,{onSelfDone:(i,a)=>d(Qe(()=>i),ca(qc(a),(c,l)=>[c,l,!0])),onOtherDone:(i,a)=>d(Qe(()=>i),ca(qc(a),(c,l)=>[l,c,!1]))})),Jo(([i,a,c])=>d(vo(qn([Wh(i),Wh(a)])),Jo((l)=>d(ZS(c?d(a,Vr((u)=>r(Wh(i),u))):d(i,Vr((u)=>r(u,Wh(a))))),QS(d(XS(o),uZ(XS(s)),Hp(Ir({onLeft:(u)=>mu(l,([f,h])=>[d(u,Vr((y)=>r(y,h))),[Wh(u),h]]),onRight:(u)=>mu(l,([f,h])=>[d(u,Vr((y)=>r(f,y))),[f,Wh(u)]])})),Jo(ZS))))))),gw)),pP)}),HMe=p(2,(e,t)=>d(e,wP(t,(r,n)=>{if(r.length>n.length)return[d(r,Ii(n.length)),Ie(d(r,Ii(n.length)))];return[r,ye(d(n,Zr(r.length)))]}))),qMe=p(2,(e,t)=>d(e,wP(t,(r,n)=>{if(r.length>n.length)return[n,Ie(d(r,Ii(n.length)))];return[d(n,Ii(r.length)),ye(d(n,Zr(r.length)))]}))),HW=p(3,(e,t,r)=>d(e,wP(t,(n,o)=>WMe(n,o,r)))),wP=p(3,(e,t,r)=>{let n=(s,i,a)=>{switch(s._tag){case BTe:return d(JS(i),Ns(JS(a),{concurrent:!0}),wr({onFailure:(c)=>N(Xr(_(c))),onSuccess:([c,l])=>{if(Oe(c)&&Oe(l)){if(At(c.value)&&At(l.value))return n(rP,i,a);if(At(c.value))return n(nP(l.value),i,a);if(At(l.value))return n(oP(c.value),i,a);return N(Nt(o(c.value,l.value)))}return N(Xr(R()))}}));case WTe:return wr(i,{onFailure:(c)=>N(Xr(c)),onSuccess:(c)=>{if(At(c))return n(nP(s.rightChunk),i,a);if(At(s.rightChunk))return n(oP(c),i,a);return N(Nt(o(c,s.rightChunk)))}});case zTe:return wr(a,{onFailure:(c)=>N(Xr(c)),onSuccess:(c)=>{if(At(c))return n(oP(s.leftChunk),i,a);if(At(s.leftChunk))return n(nP(c),i,a);return N(Nt(o(s.leftChunk,c)))}})}},o=(s,i)=>{let[a,c]=r(s,i);switch(c._tag){case"Left":{if(At(c.left))return[a,rP];return[a,oP(c.left)]}case"Right":{if(At(c.right))return[a,rP];return[a,nP(c.right)]}}};return d(e,aP(t,rP,n))}),nX=(e)=>d(e,IW(0,(t,r)=>[t+1,[r,t]])),oX=(e)=>{let t=(r)=>tr({onInput:(n)=>{let[o,s]=BL(n,r,(a,c)=>[_(c),d(a,jt((l)=>[l,c]))]),i=fy(s,(a)=>Oe(a)?_([a.value[0],_(a.value[1])]):R());return he(Se(i),()=>t(o))},onFailure:ht,onDone:()=>be(r,{onNone:()=>it,onSome:(n)=>ir(Se(We([n,R()])),it)})});return new Fe(d(_e(e),xo(t(R()))))},sX=(e)=>d(e,IW(R(),(t,r)=>[_(r),[t,r]])),BMe=(e)=>d(oX(sX(e)),is(([[t,r],n])=>[t,r,d(n,jt((o)=>o[1]))])),WMe=(e,t,r)=>{if(e.length>t.length)return[d(e,Ii(t.length),iT(t,r)),Ie(d(e,Zr(t.length)))];return[d(e,iT(d(t,Ii(e.length)),r)),ye(d(t,Zr(e.length)))]},zMe=SP({}),$Me=p((e)=>typeof e[0]!=="string",(e,t,r,n)=>Jo(e,(o)=>is(r(o),(s)=>({...o,[t]:s})),n)),jMe=Nd(is),VMe=Fd(is);var GMe=p((e)=>Kc(e[0]),(e,t="utf-8")=>fa(()=>{let r=new TextDecoder(t);return is(e,(n)=>r.decode(n,{stream:!0}))})),KMe=(e)=>fa(()=>{let t=new TextEncoder;return is(e,(r)=>t.encode(r))}),JMe=(e,t,r)=>$7((n)=>vr(Ce(()=>e.addEventListener(t,n.single,r)),()=>Ce(()=>e.removeEventListener(t,n.single,r))),{bufferSize:typeof r==="object"?r.bufferSize:void 0});var qW=IB;var UO=hO;var QMe=pw;var aX=ht;var id=he;var YMe=Ye;var ZMe=kt;var XMe=tr;var ePe=fw;var tPe=go,bw=no,rPe=rd;var Yg=it;var nE=Se;var kP=ir;var nPe=UB;var oPe=vM;var sPe=wO;var iPe=RM;var aPe=MM;var cPe=xve;var as={};Ht(as,{DefaultChunkSize:()=>Bgt,Do:()=>jbt,StreamTypeId:()=>AP,accumulate:()=>Wgt,accumulateChunks:()=>zgt,acquireRelease:()=>$gt,aggregate:()=>jgt,aggregateWithin:()=>Vgt,aggregateWithinEither:()=>Ggt,as:()=>Kgt,async:()=>Jgt,asyncEffect:()=>Qgt,asyncPush:()=>Ygt,asyncScoped:()=>uX,bind:()=>Vbt,bindEffect:()=>Gbt,bindTo:()=>Kbt,branchAfter:()=>Zgt,broadcast:()=>Xgt,broadcastDynamic:()=>txt,broadcastedQueues:()=>rxt,broadcastedQueuesDynamic:()=>nxt,buffer:()=>oxt,bufferChunks:()=>pX,catchAll:()=>WW,catchAllCause:()=>sxt,catchSome:()=>ixt,catchSomeCause:()=>lxt,catchTag:()=>axt,catchTags:()=>cxt,changes:()=>uxt,changesWith:()=>pxt,changesWithEffect:()=>fxt,chunks:()=>dxt,chunksWith:()=>mxt,combine:()=>hxt,combineChunks:()=>gxt,concat:()=>fX,concatAll:()=>xxt,context:()=>Uxt,contextWith:()=>Hxt,contextWithEffect:()=>qxt,contextWithStream:()=>Bxt,cross:()=>yxt,crossLeft:()=>Sxt,crossRight:()=>Ext,crossWith:()=>bxt,debounce:()=>Cxt,decodeText:()=>Qbt,die:()=>dX,dieMessage:()=>kxt,dieSync:()=>wxt,distributedWith:()=>Ixt,distributedWithDynamic:()=>Axt,drain:()=>Oxt,drainFork:()=>_xt,drop:()=>vxt,dropRight:()=>Txt,dropUntil:()=>Rxt,dropUntilEffect:()=>Mxt,dropWhile:()=>Pxt,dropWhileEffect:()=>Dxt,either:()=>Fxt,empty:()=>Nxt,encodeText:()=>Ybt,ensuring:()=>mX,ensuringWith:()=>Lxt,execute:()=>Wxt,fail:()=>oE,failCause:()=>$xt,failCauseSync:()=>jxt,failSync:()=>zxt,filter:()=>Vxt,filterEffect:()=>Gxt,filterMap:()=>Kxt,filterMapEffect:()=>Jxt,filterMapWhile:()=>Qxt,filterMapWhileEffect:()=>Yxt,finalizer:()=>Zxt,find:()=>Xxt,findEffect:()=>eyt,flatMap:()=>zW,flatten:()=>tyt,flattenChunks:()=>ryt,flattenEffect:()=>nyt,flattenExitOption:()=>oyt,flattenIterables:()=>syt,flattenTake:()=>iyt,forever:()=>ayt,fromAsyncIterable:()=>cyt,fromChannel:()=>Zg,fromChunk:()=>OP,fromChunkPubSub:()=>uyt,fromChunkQueue:()=>pyt,fromChunks:()=>fyt,fromEffect:()=>dyt,fromEffectOption:()=>myt,fromEventListener:()=>Zbt,fromIterable:()=>xyt,fromIterableEffect:()=>yyt,fromIteratorSucceed:()=>Syt,fromPubSub:()=>hyt,fromPull:()=>Eyt,fromQueue:()=>byt,fromReadableStream:()=>Cw,fromReadableStreamByob:()=>wyt,fromSchedule:()=>kyt,fromTPubSub:()=>gyt,fromTQueue:()=>Cyt,groupAdjacentBy:()=>Iyt,groupBy:()=>Ayt,groupByKey:()=>Oyt,grouped:()=>_yt,groupedWithin:()=>vyt,haltAfter:()=>Tyt,haltWhen:()=>Ryt,haltWhenDeferred:()=>Myt,identity:()=>Pyt,interleave:()=>Dyt,interleaveWith:()=>Fyt,interruptAfter:()=>Uyt,interruptWhen:()=>Hyt,interruptWhenDeferred:()=>qyt,intersperse:()=>Nyt,intersperseAffixes:()=>Lyt,iterate:()=>Byt,let:()=>Jbt,make:()=>Wyt,map:()=>zyt,mapAccum:()=>$yt,mapAccumEffect:()=>jyt,mapBoth:()=>Vyt,mapChunks:()=>hX,mapChunksEffect:()=>gX,mapConcat:()=>Gyt,mapConcatChunk:()=>Kyt,mapConcatChunkEffect:()=>Jyt,mapConcatEffect:()=>Qyt,mapEffect:()=>mPe,mapError:()=>_P,mapErrorCause:()=>Yyt,mapInputContext:()=>MSt,merge:()=>Zyt,mergeAll:()=>Xyt,mergeEither:()=>rSt,mergeLeft:()=>nSt,mergeRight:()=>oSt,mergeWith:()=>tSt,mergeWithTag:()=>eSt,mkString:()=>sSt,never:()=>iSt,onDone:()=>lSt,onEnd:()=>aSt,onError:()=>cSt,onStart:()=>uSt,orDie:()=>vP,orDieWith:()=>pSt,orElse:()=>fSt,orElseEither:()=>dSt,orElseFail:()=>mSt,orElseIfEmpty:()=>hSt,orElseIfEmptyChunk:()=>gSt,orElseIfEmptyStream:()=>xSt,orElseSucceed:()=>ySt,paginate:()=>SSt,paginateChunk:()=>ESt,paginateChunkEffect:()=>bSt,paginateEffect:()=>CSt,partition:()=>wSt,partitionEither:()=>kSt,peel:()=>ISt,pipeThrough:()=>ASt,pipeThroughChannel:()=>xX,pipeThroughChannelOrFail:()=>$W,prepend:()=>OSt,provideContext:()=>TP,provideLayer:()=>_St,provideService:()=>vSt,provideServiceEffect:()=>TSt,provideServiceStream:()=>RSt,provideSomeContext:()=>hPe,provideSomeLayer:()=>PSt,race:()=>DSt,raceAll:()=>FSt,range:()=>NSt,rechunk:()=>LSt,refineOrDie:()=>USt,refineOrDieWith:()=>HSt,repeat:()=>qSt,repeatEffect:()=>BSt,repeatEffectChunk:()=>WSt,repeatEffectChunkOption:()=>zSt,repeatEffectOption:()=>$St,repeatEffectWithSchedule:()=>jSt,repeatEither:()=>VSt,repeatElements:()=>GSt,repeatElementsWith:()=>KSt,repeatValue:()=>JSt,repeatWith:()=>QSt,retry:()=>YSt,run:()=>ad,runCollect:()=>yX,runCount:()=>XSt,runDrain:()=>eEt,runFold:()=>tEt,runFoldEffect:()=>rEt,runFoldScoped:()=>nEt,runFoldScopedEffect:()=>oEt,runFoldWhile:()=>sEt,runFoldWhileEffect:()=>iEt,runFoldWhileScoped:()=>aEt,runFoldWhileScopedEffect:()=>cEt,runForEach:()=>RP,runForEachChunk:()=>HO,runForEachChunkScoped:()=>lEt,runForEachScoped:()=>uEt,runForEachWhile:()=>pEt,runForEachWhileScoped:()=>fEt,runHead:()=>dEt,runIntoPubSub:()=>mEt,runIntoPubSubScoped:()=>hEt,runIntoQueue:()=>gEt,runIntoQueueElementsScoped:()=>xEt,runIntoQueueScoped:()=>yEt,runLast:()=>SEt,runScoped:()=>EEt,runSum:()=>bEt,scan:()=>CEt,scanEffect:()=>wEt,scanReduce:()=>kEt,scanReduceEffect:()=>IEt,schedule:()=>AEt,scheduleWith:()=>OEt,scoped:()=>_Et,scopedWith:()=>vEt,share:()=>ext,sliding:()=>TEt,slidingSize:()=>REt,some:()=>MEt,someOrElse:()=>PEt,someOrFail:()=>DEt,split:()=>FEt,splitLines:()=>SX,splitOnChunk:()=>NEt,succeed:()=>LEt,suspend:()=>EX,sync:()=>UEt,take:()=>HEt,takeRight:()=>qEt,takeUntil:()=>BEt,takeUntilEffect:()=>WEt,takeWhile:()=>zEt,tap:()=>$Et,tapBoth:()=>jEt,tapError:()=>VEt,tapErrorCause:()=>GEt,tapSink:()=>KEt,throttle:()=>JEt,throttleEffect:()=>QEt,tick:()=>YEt,timeout:()=>ZEt,timeoutFail:()=>XEt,timeoutFailCause:()=>ebt,timeoutTo:()=>tbt,toAsyncIterable:()=>pbt,toAsyncIterableEffect:()=>ubt,toAsyncIterableRuntime:()=>lbt,toChannel:()=>lyt,toPubSub:()=>rbt,toPull:()=>nbt,toQueue:()=>obt,toQueueOfElements:()=>sbt,toReadableStream:()=>ibt,toReadableStreamEffect:()=>abt,toReadableStreamRuntime:()=>cbt,transduce:()=>bX,unfold:()=>fbt,unfoldChunk:()=>dbt,unfoldChunkEffect:()=>mbt,unfoldEffect:()=>hbt,unwrap:()=>MP,unwrapScoped:()=>cd,unwrapScopedWith:()=>xbt,updateService:()=>ybt,void:()=>gbt,when:()=>Sbt,whenCase:()=>Ebt,whenCaseEffect:()=>bbt,whenEffect:()=>Cbt,withExecutionPlan:()=>ZSt,withSpan:()=>wbt,zip:()=>kbt,zipAll:()=>Abt,zipAllLeft:()=>Obt,zipAllRight:()=>_bt,zipAllSortedByKey:()=>vbt,zipAllSortedByKeyLeft:()=>Tbt,zipAllSortedByKeyRight:()=>Rbt,zipAllSortedByKeyWith:()=>Mbt,zipAllWith:()=>Pbt,zipFlatten:()=>Ibt,zipLatest:()=>Dbt,zipLatestAll:()=>Fbt,zipLatestWith:()=>Nbt,zipLeft:()=>Lbt,zipRight:()=>Ubt,zipWith:()=>Hbt,zipWithChunks:()=>qbt,zipWithIndex:()=>$bt,zipWithNext:()=>Bbt,zipWithPrevious:()=>Wbt,zipWithPreviousAndNext:()=>zbt});var Dgt="effect/GroupBy",lPe=Symbol.for(Dgt),Fgt={_R:(e)=>e,_E:(e)=>e,_K:(e)=>e,_V:(e)=>e},Ngt=(e)=>de(e,lPe),Lgt=p((e)=>Ngt(e[0]),(e,t,r)=>Jo(e.grouped,([n,o])=>t(n,eE(Up(o,{shutdown:!0}))),{concurrency:"unbounded",bufferSize:r?.bufferSize??16}));var uPe=(e)=>({[lPe]:Fgt,pipe(){return ce(this,arguments)},grouped:e}),pPe=p((e)=>Kc(e[0]),(e,t,r)=>uPe(sd($e(function*(){let n=yield*_r(),o=yield*vr(Tl(r?.bufferSize??16),(a)=>zn(a)),s=yield*qn(new Map),i=yield*d(Hp(e,t),Y7(r?.bufferSize??16,([a,c])=>L(Wt(n),(l)=>l(a,c)),(a)=>Br(o,a)));return yield*mo(n,(a,c)=>d(sn(s),W((l)=>Ft(l.get(a))),L(be({onNone:()=>L(i,([l,u])=>ve(ea(s,(f)=>f.set(a,l)),d(Br(o,Nt([a,Ugt(u,(f)=>new hw(d(f,tA((h)=>We(h[1])))))])),qr((f)=>f===l)))),onSome:(l)=>N((u)=>u===l)})))),xw(Up(o,{shutdown:!0}))})))),cX=p((e)=>typeof e[0]!=="function",(e,t,r)=>{if(r?.key)return Lgt(lX(e,r.key,{bufferSize:r.bufferSize}),(n,o)=>Hp(o,t));return sP(r?.concurrency,()=>Hp(e,t),(n)=>r?.unordered?Jo(e,(o)=>vo(t(o)),{concurrency:n}):aRe(e,n,t))}),fPe=p((e)=>typeof e[0]!=="string",(e,t,r,n)=>cX(e,(o)=>W(r(o),(s)=>({...o,[t]:s})),n)),Ugt=(e,t)=>new dPe(e,t);class dPe extends Zi{dequeue;f;[d_e]={_Out:(e)=>e};constructor(e,t){super();this.dequeue=e,this.f=t}capacity(){return m_e(this.dequeue)}get size(){return Kq(this.dequeue)}unsafeSize(){return this.dequeue.unsafeSize()}get awaitShutdown(){return x_e(this.dequeue)}isActive(){return this.dequeue.isActive()}get isShutdown(){return gM(this.dequeue)}get shutdown(){return zn(this.dequeue)}get isFull(){return g_e(this.dequeue)}get isEmpty(){return h_e(this.dequeue)}get take(){return d($a(this.dequeue),W((e)=>this.f(e)))}get takeAll(){return d(S_e(this.dequeue),W(Vr((e)=>this.f(e))))}takeUpTo(e){return d(E_e(this.dequeue,e),W(Vr((t)=>this.f(t))))}takeBetween(e,t){return d(Jq(this.dequeue,e,t),W(Vr((r)=>this.f(r))))}takeN(e){return d(b_e(this.dequeue,e),W(Vr((t)=>this.f(t))))}poll(){return d(y_e(this.dequeue),W(jt((e)=>this.f(e))))}pipe(){return ce(this,arguments)}commit(){return this.take}}var lX=p((e)=>typeof e[0]!=="function",(e,t,r)=>{let n=(o,s)=>tr({onInput:(i)=>he(Ye(en(Hgt(i,t),([a,c])=>{let l=o.get(a);if(l===void 0)return d(Tl(r?.bufferSize??16),L((u)=>d(Ce(()=>{o.set(a,u)}),ve(Br(s,uW([a,u]))),ve(d(Br(u,Wg(c)),UC((f)=>Om(f)?_(me):R()))))));return UC(Br(l,Wg(c)),(u)=>Om(u)?_(me):R())},{discard:!0})),()=>n(o,s)),onFailure:(i)=>Ye(Br(s,zg(i))),onDone:()=>Ye(d(en(o.entries(),([i,a])=>d(Br(a,od),UC((c)=>Om(c)?_(me):R())),{discard:!0}),ve(Br(s,od))))});return uPe(LO((o)=>$e(function*(){let s=new Map,i=yield*TS();return yield*Ti(o,zn(i)),yield*_e(e).pipe(kt(n(s,i)),Fp,Rl(o),hn(o),qr(eE(Up(i,{shutdown:!0}))))})))}),Hgt=p(2,(e,t)=>{let r=[],n=e[Symbol.iterator](),o=new Map,s;while((s=n.next())&&!s.done){let i=s.value,a=t(i);if(o.has(a))o.get(a).push(i);else{let c=[i];r.push([a,c]),o.set(a,c)}}return nt(r.map((i)=>[i[0],nt(i[1])]))});var AP=hW,Bgt=RO,Wgt=KTe,zgt=q7,$gt=B7,jgt=JTe,Vgt=gW,Ggt=W7,Kgt=QTe,Jgt=YTe;var Qgt=ZTe,Ygt=$7,uX=XTe,Zgt=e0e,Xgt=t0e,ext=r0e,txt=j7,rxt=V7,nxt=n0e,oxt=o0e,pX=s0e,WW=Kg,sxt=MO,ixt=i0e,axt=a0e,cxt=c0e,lxt=G7,uxt=l0e,pxt=K7,fxt=u0e,dxt=iP,mxt=p0e,hxt=f0e,gxt=aP,fX=QS,xxt=d0e,yxt=m0e,Sxt=h0e,Ext=yW,bxt=SW,Cxt=g0e,dX=EW,wxt=x0e,kxt=y0e,Ixt=J7,Axt=Q7,Oxt=PO,_xt=S0e,vxt=Z7,Txt=E0e,Rxt=b0e,Mxt=C0e,Pxt=X7,Dxt=w0e,Fxt=k0e,Nxt=Jg,mX=Gg,Lxt=I0e,Uxt=cP,Hxt=A0e,qxt=O0e,Bxt=bW,Wxt=eZ,oE=Vg,zxt=CW,$xt=lP,jxt=_0e,Vxt=v0e,Gxt=tZ,Kxt=YS,Jxt=T0e,Qxt=R0e,Yxt=M0e,Zxt=P0e,Xxt=D0e,eyt=F0e,zW=Jo,tyt=DO,ryt=uP,nyt=N0e,oyt=xw,syt=L0e,iyt=eE,ayt=wW,cyt=U0e,Zg=tE,lyt=_e,OP=ZS,uyt=H0e,pyt=dW,fyt=q0e,dyt=vo,myt=FO,hyt=rZ,gyt=B0e,xyt=NO,yyt=W0e,Syt=nZ,Eyt=pP,byt=Up,Cyt=oZ,Cw=$0e,wyt=j0e,kyt=z0e,Iyt=G0e,Ayt=pPe,Oyt=lX,_yt=K0e,vyt=J0e,Tyt=Q0e,Ryt=sZ,Myt=Y0e,Pyt=iZ,Dyt=Z0e,Fyt=aZ,Nyt=cZ,Lyt=X0e,Uyt=eRe,Hyt=kW,qyt=lZ,Byt=tRe,Wyt=TO,zyt=is,$yt=IW,jyt=AW,Vyt=rRe,hX=yw,gX=nRe,Gyt=oRe,Kyt=fP,Jyt=sRe,Qyt=iRe,mPe=cX,_P=OW,Yyt=cRe,Zyt=dP,Xyt=_W,eSt=lRe,tSt=vW,rSt=uZ,nSt=uRe,oSt=pRe,sSt=fRe,iSt=dRe,aSt=mRe,cSt=hRe,lSt=gRe,uSt=xRe,vP=yRe,pSt=pZ,fSt=mP,dSt=SRe,mSt=ERe,hSt=bRe,gSt=fZ,xSt=dZ,ySt=CRe,SSt=wRe,ESt=mZ,bSt=hZ,CSt=gZ,wSt=IRe,kSt=xZ,ISt=kRe,ASt=ARe,xX=yZ,$W=ORe,OSt=_Re,TP=TW,hPe=SZ,_St=EZ,vSt=vRe,TSt=hP,RSt=bZ,MSt=RW,PSt=CZ,DSt=RRe,FSt=wZ,NSt=TRe,LSt=gP,USt=PRe,HSt=kZ,qSt=DRe,BSt=FRe,WSt=NRe,zSt=Qg,$St=XS,jSt=_Z,VSt=IZ,GSt=LRe,KSt=AZ,JSt=URe,QSt=OZ,YSt=mW,ZSt=HRe,ad=yc,yX=qRe,XSt=BRe,eEt=WRe,tEt=zRe,rEt=$Re,nEt=jRe,oEt=VRe,sEt=vZ,iEt=TZ,aEt=RZ,cEt=MZ,RP=PZ,HO=DZ,lEt=GRe,uEt=FZ,pEt=KRe,fEt=JRe,dEt=QRe,mEt=YRe,hEt=MW,gEt=NZ,xEt=LZ,yEt=xP,SEt=ZRe,EEt=Sw,bEt=XRe,CEt=eMe,wEt=qZ,kEt=tMe,IEt=UZ,AEt=rMe,OEt=HZ,_Et=Ew,vEt=yP,TEt=sMe,REt=WZ,MEt=nMe,PEt=oMe,DEt=BZ,FEt=iMe,NEt=aMe,SX=cMe,LEt=SP,UEt=zZ,EX=fa,HEt=lMe,qEt=uMe,BEt=pMe,WEt=fMe,zEt=$Z,$Et=jZ,jEt=dMe,VEt=VZ,GEt=GZ,KEt=mMe,JEt=hMe,QEt=KZ,YEt=gMe,ZEt=xMe,XEt=yMe,ebt=JZ,tbt=QZ,rbt=PW,nbt=gw,obt=DW,sbt=YZ,ibt=EMe,abt=bMe,cbt=FW,lbt=NW,ubt=kMe,pbt=wMe,bX=CMe,fbt=ZZ,dbt=XZ,mbt=EP,hbt=LW,gbt=IMe;var MP=rE,cd=sd,xbt=LO,ybt=AMe,Sbt=OMe,Ebt=_Me,bbt=eX,Cbt=tX,wbt=vMe,kbt=TMe,Ibt=RMe,Abt=MMe,Obt=PMe,_bt=DMe,vbt=FMe,Tbt=NMe,Rbt=LMe,Mbt=bP,Pbt=CP,Dbt=UMe,Fbt=rX,Nbt=UW,Lbt=HMe,Ubt=qMe,Hbt=HW,qbt=wP,Bbt=oX,Wbt=sX,zbt=BMe,$bt=nX,jbt=zMe,Vbt=$Me,Gbt=fPe,Kbt=jMe,Jbt=VMe;var Qbt=GMe,Ybt=KMe,Zbt=JMe;var Qc={};Ht(Qc,{BadArgument:()=>Qa,Module:()=>$te,PlatformError:()=>g_t,SystemError:()=>Ec,SystemErrorReason:()=>D1e,TypeId:()=>JO,TypeIdError:()=>xE,isPlatformError:()=>h_t});var x={};Ht(x,{Any:()=>wz,Array:()=>st,ArrayEnsure:()=>dIt,ArrayFormatterIssue:()=>P1e,BetweenBigDecimalSchemaId:()=>ete,BetweenBigIntSchemaId:()=>Nee,BetweenDateSchemaId:()=>jee,BetweenDurationSchemaId:()=>Hee,BetweenSchemaId:()=>nLe,BigDecimal:()=>a1e,BigDecimalFromNumber:()=>c1e,BigDecimalFromSelf:()=>gE,BigInt:()=>_w,BigIntFromNumber:()=>OLe,BigIntFromSelf:()=>mE,Boolean:()=>St,BooleanFromString:()=>M1e,BooleanFromUnknown:()=>R1e,BrandSchemaId:()=>bee,Capitalize:()=>HNe,Capitalized:()=>hte,CapitalizedSchemaId:()=>MNe,Cause:()=>Bte,CauseFromSelf:()=>yz,Char:()=>NNe,Chunk:()=>mOt,ChunkFromSelf:()=>rD,Class:()=>mr,Config:()=>ZOt,Data:()=>EOt,DataFromSelf:()=>S1e,Date:()=>Pz,DateFromNumber:()=>WLe,DateFromSelf:()=>KO,DateFromSelfSchemaId:()=>Vee,DateFromString:()=>Tte,DateTimeUtc:()=>jLe,DateTimeUtcFromDate:()=>$Le,DateTimeUtcFromNumber:()=>zLe,DateTimeUtcFromSelf:()=>tD,DateTimeZoned:()=>YLe,DateTimeZonedFromSelf:()=>Pte,Defect:()=>io,Duration:()=>DLe,DurationFromMillis:()=>TLe,DurationFromNanos:()=>vLe,DurationFromSelf:()=>XP,Either:()=>BAt,EitherFromSelf:()=>Fte,EitherFromUnion:()=>WAt,EndsWithSchemaId:()=>vee,Enums:()=>oIt,Exit:()=>KP,ExitFromSelf:()=>A1e,FiberId:()=>C1e,FiberIdFromSelf:()=>qte,Finite:()=>pLe,FiniteSchemaId:()=>KNe,FromPropertySignature:()=>dE,GreaterThanBigDecimalSchemaId:()=>Qee,GreaterThanBigIntSchemaId:()=>Mee,GreaterThanDateSchemaId:()=>zee,GreaterThanDurationSchemaId:()=>Lee,GreaterThanOrEqualToBigDecimalSchemaId:()=>Yee,GreaterThanOrEqualToBigIntSchemaId:()=>Pee,GreaterThanOrEqualToDateSchemaId:()=>$ee,GreaterThanOrEqualToDurationSchemaId:()=>Uee,GreaterThanOrEqualToSchemaId:()=>YNe,GreaterThanSchemaId:()=>JNe,HashMap:()=>$Ot,HashMapFromSelf:()=>_1e,HashSet:()=>qOt,HashSetFromSelf:()=>O1e,IncludesSchemaId:()=>Tee,InstanceOfSchemaId:()=>Cee,Int:()=>Ja,IntSchemaId:()=>XNe,ItemsCountSchemaId:()=>HLe,JsonNumber:()=>xLe,JsonNumberSchemaId:()=>gLe,LengthSchemaId:()=>Aee,LessThanBigDecimalSchemaId:()=>Zee,LessThanBigIntSchemaId:()=>Dee,LessThanDateSchemaId:()=>Bee,LessThanDurationSchemaId:()=>VP,LessThanOrEqualToBigDecimalSchemaId:()=>Xee,LessThanOrEqualToBigIntSchemaId:()=>Fee,LessThanOrEqualToDateSchemaId:()=>Wee,LessThanOrEqualToDurationSchemaId:()=>aAt,LessThanOrEqualToSchemaId:()=>rLe,LessThanSchemaId:()=>eLe,List:()=>KOt,ListFromSelf:()=>v1e,Literal:()=>qe,Lowercase:()=>LNe,Lowercased:()=>dte,LowercasedSchemaId:()=>_Ne,Map:()=>GAt,MapFromRecord:()=>JAt,MapFromSelf:()=>Lte,MaxItemsSchemaId:()=>ULe,MaxLengthSchemaId:()=>INe,MinItemsSchemaId:()=>LLe,MinLengthSchemaId:()=>ANe,MultipleOfSchemaId:()=>ZNe,Negative:()=>mLe,NegativeBigDecimalFromSelf:()=>lOt,NegativeBigDecimalSchemaId:()=>d1e,NegativeBigInt:()=>GIt,NegativeBigIntFromSelf:()=>VIt,Never:()=>zp,NonEmptyArray:()=>$m,NonEmptyArrayEnsure:()=>mIt,NonEmptyChunk:()=>xOt,NonEmptyChunkFromSelf:()=>y1e,NonEmptyString:()=>WNe,NonEmptyTrimmedString:()=>yte,NonNaN:()=>fLe,NonNaNSchemaId:()=>oLe,NonNegative:()=>Tz,NonNegativeBigDecimalFromSelf:()=>cOt,NonNegativeBigDecimalSchemaId:()=>p1e,NonNegativeBigInt:()=>QIt,NonNegativeBigIntFromSelf:()=>ALe,NonNegativeInt:()=>mz,NonPositive:()=>hLe,NonPositiveBigDecimalFromSelf:()=>uOt,NonPositiveBigDecimalSchemaId:()=>h1e,NonPositiveBigInt:()=>JIt,NonPositiveBigIntFromSelf:()=>KIt,Not:()=>yLe,Null:()=>ix,NullOr:()=>zP,NullishOr:()=>$P,Number:()=>Et,NumberFromString:()=>ax,Object:()=>pNe,Option:()=>Dte,OptionFromNonEmptyTrimmedString:()=>XLe,OptionFromNullOr:()=>FAt,OptionFromNullishOr:()=>NAt,OptionFromSelf:()=>vw,OptionFromUndefinedOr:()=>LAt,PatternSchemaId:()=>Oee,Positive:()=>dLe,PositiveBigDecimalFromSelf:()=>aOt,PositiveBigDecimalSchemaId:()=>l1e,PositiveBigInt:()=>jIt,PositiveBigIntFromSelf:()=>$It,PropertyKey:()=>zte,PropertySignatureDeclaration:()=>fE,PropertySignatureTransformation:()=>dd,PropertySignatureTypeId:()=>ite,ReadonlyMap:()=>VAt,ReadonlyMapFromRecord:()=>KAt,ReadonlyMapFromSelf:()=>Nte,ReadonlySet:()=>XAt,ReadonlySetFromSelf:()=>s1e,Record:()=>ys,Redacted:()=>ZIt,RedactedFromSelf:()=>_Le,RefineSchemaId:()=>lte,Set:()=>eOt,SetFromSelf:()=>i1e,SortedSet:()=>YOt,SortedSetFromSelf:()=>T1e,StartsWithSchemaId:()=>_ee,String:()=>H,StringFromBase64:()=>dAt,StringFromBase64Url:()=>mAt,StringFromHex:()=>hAt,StringFromUriComponent:()=>gAt,Struct:()=>fe,Symbol:()=>bLe,SymbolFromSelf:()=>kz,TaggedClass:()=>COt,TaggedError:()=>ri,TaggedRequest:()=>p_t,TaggedStruct:()=>QP,TemplateLiteral:()=>cNe,TemplateLiteralParser:()=>sIt,TimeZone:()=>QLe,TimeZoneFromSelf:()=>Mte,TimeZoneNamed:()=>JLe,TimeZoneNamedFromSelf:()=>Fz,TimeZoneOffset:()=>GLe,TimeZoneOffsetFromSelf:()=>Dz,ToPropertySignature:()=>jm,Trim:()=>BNe,Trimmed:()=>_z,TrimmedSchemaId:()=>wNe,Tuple:()=>ma,TypeId:()=>pE,ULID:()=>VNe,ULIDSchemaId:()=>jNe,URL:()=>GNe,URLFromSelf:()=>Ste,UUID:()=>$Ne,UUIDSchemaId:()=>zNe,Uint8:()=>Ate,Uint8Array:()=>NLe,Uint8ArrayFromBase64:()=>eD,Uint8ArrayFromBase64Url:()=>pAt,Uint8ArrayFromHex:()=>fAt,Uint8ArrayFromSelf:()=>Rz,Uncapitalize:()=>qNe,Uncapitalized:()=>gte,UncapitalizedSchemaId:()=>DNe,Undefined:()=>Cz,UndefinedOr:()=>Li,Union:()=>gt,UniqueSymbolFromSelf:()=>iNe,Unknown:()=>To,Uppercase:()=>UNe,Uppercased:()=>mte,UppercasedSchemaId:()=>TNe,ValidDateFromSelf:()=>BLe,ValidDateSchemaId:()=>qee,Void:()=>sx,annotations:()=>PIt,asSchema:()=>En,asSerializable:()=>XOt,asSerializableWithResult:()=>u_t,asWithResult:()=>n_t,asserts:()=>LAe,attachPropertySignature:()=>MIt,between:()=>hE,betweenBigDecimal:()=>x1e,betweenBigInt:()=>bte,betweenDate:()=>AAt,betweenDuration:()=>FLe,brand:()=>kIt,capitalized:()=>PNe,clamp:()=>WIt,clampBigDecimal:()=>pOt,clampBigInt:()=>zIt,clampDuration:()=>sAt,compose:()=>Ow,declare:()=>jn,decode:()=>ote,decodeEither:()=>Ykt,decodeOption:()=>PAe,decodePromise:()=>Zkt,decodeSync:()=>rO,decodeUnknown:()=>Qr,decodeUnknownEither:()=>nNe,decodeUnknownOption:()=>qY,decodeUnknownPromise:()=>oNe,decodeUnknownSync:()=>HY,deserialize:()=>r_t,deserializeExit:()=>l_t,deserializeFailure:()=>s_t,deserializeSuccess:()=>a_t,element:()=>wee,encode:()=>Gm,encodeEither:()=>Jkt,encodeOption:()=>UAe,encodePromise:()=>Qkt,encodeSync:()=>_S,encodeUnknown:()=>Mu,encodeUnknownEither:()=>tNe,encodeUnknownOption:()=>zY,encodeUnknownPromise:()=>rNe,encodeUnknownSync:()=>WY,encodedBoundSchema:()=>nte,encodedSchema:()=>Ez,endsWith:()=>NIt,equivalence:()=>f_t,exitSchema:()=>Wte,extend:()=>YP,failureSchema:()=>rte,filter:()=>Jt,filterEffect:()=>TIt,finite:()=>Ete,format:()=>$n,fromBrand:()=>cIt,fromKey:()=>xIt,getClassTag:()=>Uz,getNumberIndexedAccess:()=>Mz,greaterThan:()=>QNe,greaterThanBigDecimal:()=>nOt,greaterThanBigInt:()=>CLe,greaterThanDate:()=>kAt,greaterThanDuration:()=>lAt,greaterThanOrEqualTo:()=>Ui,greaterThanOrEqualToBigDecimal:()=>oOt,greaterThanOrEqualToBigInt:()=>wLe,greaterThanOrEqualToDate:()=>IAt,greaterThanOrEqualToDuration:()=>uAt,head:()=>SAt,headNonEmpty:()=>EAt,headOrElse:()=>bAt,includes:()=>LIt,instanceOf:()=>uNe,int:()=>ZP,is:()=>OS,isPropertySignature:()=>Az,isSchema:()=>so,itemsCount:()=>qLe,keyof:()=>uIt,length:()=>ONe,lessThan:()=>tLe,lessThanBigDecimal:()=>sOt,lessThanBigInt:()=>kLe,lessThanDate:()=>CAt,lessThanDuration:()=>iAt,lessThanOrEqualTo:()=>Km,lessThanOrEqualToBigDecimal:()=>iOt,lessThanOrEqualToBigInt:()=>ILe,lessThanOrEqualToDate:()=>wAt,lessThanOrEqualToDuration:()=>cAt,lowercased:()=>vNe,make:()=>rr,makePropertySignature:()=>Vm,maxItems:()=>yAt,maxLength:()=>pte,minItems:()=>xAt,minLength:()=>yo,multipleOf:()=>BIt,mutable:()=>_It,negative:()=>aLe,negativeBigDecimal:()=>m1e,negativeBigInt:()=>wte,nonEmptyString:()=>xte,nonNaN:()=>sLe,nonNegative:()=>lLe,nonNegativeBigDecimal:()=>f1e,nonNegativeBigInt:()=>kte,nonPositive:()=>cLe,nonPositiveBigDecimal:()=>g1e,nonPositiveBigInt:()=>Ite,omit:()=>CIt,optional:()=>Be,optionalElement:()=>pIt,optionalToOptional:()=>Iee,optionalToRequired:()=>rx,optionalWith:()=>Y,parseJson:()=>vz,parseNumber:()=>uLe,partial:()=>IIt,partialWith:()=>AIt,pattern:()=>fte,pick:()=>SNe,pickLiteral:()=>rIt,pluck:()=>wIt,positive:()=>iLe,positiveBigDecimal:()=>u1e,positiveBigInt:()=>Cte,propertySignature:()=>VO,rename:()=>DIt,required:()=>OIt,requiredToOptional:()=>yIt,serializableSchema:()=>e_t,serialize:()=>t_t,serializeExit:()=>c_t,serializeFailure:()=>o_t,serializeSuccess:()=>i_t,split:()=>UIt,standardSchemaV1:()=>Kkt,startsWith:()=>FIt,successSchema:()=>Sz,suspend:()=>dz,symbolSerializable:()=>nD,symbolWithResult:()=>cx,tag:()=>Jc,transform:()=>Mt,transformLiteral:()=>CNe,transformLiterals:()=>RIt,transformOrFail:()=>Qo,trimmed:()=>kNe,typeSchema:()=>Kt,uncapitalized:()=>FNe,uppercased:()=>RNe,validDate:()=>vte,validate:()=>bz,validateEither:()=>Xkt,validateOption:()=>DAe,validatePromise:()=>eIt,validateSync:()=>nw,withConstructorDefault:()=>lE,withDecodingDefault:()=>gNe,withDefaults:()=>gIt});var gPe=/^[+-]?\d+$/,CX=Symbol.for("effect/BigDecimal"),Xbt={[CX]:CX,[Ne](){let e=ww(this);return d(oe(e.value),Ee(vh(e.scale)),lt(this))},[Pe](e){return kX(e)&&tCt(this,e)},toString(){return`BigDecimal(${ud(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[dt](){return this.toJSON()},pipe(){return ce(this,arguments)}},kX=(e)=>de(e,CX),sE=(e,t)=>{let r=Object.create(Xbt);return r.value=e,r.scale=t,r},yPe=(e,t)=>{if(e!==ld&&e%wX===ld)throw RangeError("Value must be normalized");let r=sE(e,t);return r.normalized=r,r},ld=BigInt(0);var wX=BigInt(10),SPe=yPe(ld,0),ww=(e)=>{if(e.normalized===void 0)if(e.value===ld)e.normalized=SPe;else{let t=`${e.value}`,r=0;for(let s=t.length-1;s>=0;s--)if(t[s]==="0")r++;else break;if(r===0)e.normalized=e;let n=BigInt(t.substring(0,t.length-r)),o=e.scale-r;e.normalized=yPe(n,o)}return e.normalized},jW=p(2,(e,t)=>{if(t>e.scale)return sE(e.value*wX**BigInt(t-e.scale),t);if(t<e.scale)return sE(e.value/wX**BigInt(e.scale-t),t);return e});var qO=nc((e,t)=>{let r=jv(xPe(e),xPe(t));if(r!==0)return r;if(e.scale>t.scale)return Zk(e.value,jW(t,e.scale).value);if(e.scale<t.scale)return Zk(jW(e,t.scale).value,t.value);return Zk(e.value,t.value)}),EPe=Dh(qO),bPe=cy(qO),CPe=Fh(qO),wPe=Nh(qO),kPe=ly(qO),IPe=$d(qO);var xPe=(e)=>e.value===ld?0:e.value<ld?-1:1,eCt=(e)=>e.value<ld?sE(-e.value,e.scale):e;var IX=No((e,t)=>{if(e.scale>t.scale)return jW(t,e.scale).value===e.value;if(e.scale<t.scale)return jW(e,t.scale).value===t.value;return e.value===t.value}),tCt=p(2,(e,t)=>IX(e,t));var APe=(e)=>fL(rCt(e),()=>RangeError(`Number must be finite, got ${e}`));var rCt=(e)=>{if(!Number.isFinite(e))return R();let t=`${e}`;if(t.includes("e"))return AX(t);let[r,n=""]=t.split(".");return _(sE(BigInt(`${r}${n}`),n.length))},AX=(e)=>{if(e==="")return _(SPe);let t,r,n=e.search(/[eE]/);if(n!==-1){let c=e.slice(n+1);if(t=e.slice(0,n),r=Number(c),t===""||!Number.isSafeInteger(r)||!gPe.test(c))return R()}else t=e,r=0;let o,s,i=t.search(/\./);if(i!==-1){let c=t.slice(0,i),l=t.slice(i+1);o=`${c}${l}`,s=l.length}else o=t,s=0;if(!gPe.test(o))return R();let a=s-r;if(!Number.isSafeInteger(a))return R();return _(sE(BigInt(o),a))};var ud=(e)=>{let t=ww(e);if(Math.abs(t.scale)>=16)return nCt(t);let r=t.value<ld,n=r?`${t.value}`.substring(1):`${t.value}`,o,s;if(t.scale>=n.length)o="0",s="0".repeat(t.scale-n.length)+n;else{let a=n.length-t.scale;if(a>n.length){let c=a-n.length;o=`${n}${"0".repeat(c)}`,s=""}else s=n.slice(a),o=n.slice(0,a)}let i=s===""?o:`${o}.${s}`;return r?`-${i}`:i},nCt=(e)=>{if(oCt(e))return"0e+0";let t=ww(e),r=`${eCt(t).value}`,n=r.slice(0,1),o=r.slice(1),s=`${OX(t)?"-":""}${n}`;if(o!=="")s+=`.${o}`;let i=o.length-t.scale;return`${s}e${i>=0?"+":""}${i}`},OPe=(e)=>Number(ud(e));var oCt=(e)=>e.value===ld,OX=(e)=>e.value<ld,_Pe=(e)=>e.value>ld;var iCt=Zk;var vPe=$d(iCt);var TPe=(e)=>{if(e>BigInt(Number.MAX_SAFE_INTEGER)||e<BigInt(Number.MIN_SAFE_INTEGER))return R();return _(Number(e))},RPe=(e)=>{try{return e.trim()===""?R():_(BigInt(e))}catch{return R()}},MPe=(e)=>{if(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)return R();try{return _(BigInt(e))}catch{return R()}};var Ae={};Ht(Ae,{ConfigTypeId:()=>dCt,all:()=>mCt,array:()=>hCt,boolean:()=>gCt,branded:()=>LCt,chunk:()=>SCt,date:()=>ECt,duration:()=>ACt,fail:()=>bCt,hashMap:()=>zCt,hashSet:()=>UCt,integer:()=>wCt,isConfig:()=>PX,literal:()=>kCt,logLevel:()=>ICt,map:()=>OCt,mapAttempt:()=>_Ct,mapOrFail:()=>DX,nested:()=>vCt,nonEmptyString:()=>HCt,number:()=>CCt,option:()=>MCt,orElse:()=>TCt,orElseIf:()=>RCt,port:()=>xCt,primitive:()=>PCt,redacted:()=>NCt,repeat:()=>DCt,secret:()=>FCt,string:()=>FX,succeed:()=>qCt,suspend:()=>BCt,sync:()=>WCt,unwrap:()=>$Ct,url:()=>yCt,validate:()=>jCt,withDefault:()=>VCt,withDescription:()=>GCt,zip:()=>KCt,zipWith:()=>JCt});var PPe="effect/Redacted",Xg=je("effect/Redacted/redactedRegistry",()=>new WeakMap),VW=Symbol.for(PPe),_X={[VW]:{_A:(e)=>e},pipe(){return ce(this,arguments)},toString(){return"<redacted>"},toJSON(){return"<redacted>"},[dt](){return"<redacted>"},[Ne](){return d(oe(PPe),Ee(oe(Xg.get(this))),lt(this))},[Pe](e){return vX(e)&&ge(Xg.get(this),Xg.get(e))}},vX=(e)=>de(e,VW),GW=(e)=>{let t=Object.create(_X);return Xg.set(t,e),t},DPe=(e)=>{if(Xg.has(e))return Xg.get(e);else throw Error("Unable to get redacted value")},FPe=(e)=>Xg.delete(e);var cCt="effect/Secret",RX=Symbol.for(cCt);var lCt={..._X,[RX]:RX},NPe=(e)=>{let t=Object.create(lCt);return Object.defineProperty(t,"toString",{enumerable:!1,value(){return"Secret(<redacted>)"}}),Object.defineProperty(t,"toJSON",{enumerable:!1,value(){return"<redacted>"}}),Object.defineProperty(t,"raw",{enumerable:!1,value:e}),Xg.set(t,e.map((r)=>String.fromCharCode(r)).join("")),t};var KW=(e)=>NPe(e.split("").map((t)=>t.charCodeAt(0)));var uCt="effect/Config",QW=Symbol.for(uCt),pCt={_A:(e)=>e},qp={...Sf,[QW]:pCt,commit(){return Jme(this)}},HPe=(e)=>{let t=Bp("a boolean property",(r)=>{switch(r){case"true":case"yes":case"on":case"1":return ye(!0);case"false":case"no":case"off":case"0":return ye(!1);default:{let n=sc([],`Expected a boolean value but received ${Uo(r)}`);return Ie(n)}}});return e===void 0?t:Ka(t,e)},qPe=(e)=>{let t=Bp("an URL property",(r)=>ay({try:()=>new URL(r),catch:(n)=>sc([],`Expected an URL value but received ${Uo(r)}`)}));return e===void 0?t:Ka(t,e)},BPe=(e)=>{let t=Bp("a network port property",(r)=>{let n=Number(r);if(Number.isNaN(n)||n.toString()!==r.toString()||!Number.isInteger(n)||n<1||n>65535)return Ie(sc([],`Expected a network port value but received ${Uo(r)}`));return ye(n)});return e===void 0?t:Ka(t,e)},WPe=(e,t)=>d(YW(e,t),Wm(rT)),YW=(e,t)=>Wm(t===void 0?JW(e):Ka(JW(e),t),nt),zPe=(e)=>{let t=Bp("a date property",(r)=>{let n=Date.parse(r);if(Number.isNaN(n))return Ie(sc([],`Expected a Date value but received ${Uo(r)}`));return ye(new Date(n))});return e===void 0?t:Ka(t,e)},$Pe=(e)=>{let t=Object.create(qp);return t._tag=h2,t.message=e,t.parse=()=>Ie(ML([],e)),t},jPe=(e)=>{let t=Bp("a number property",(r)=>{let n=Number(r);if(Number.isNaN(n))return Ie(sc([],`Expected a number value but received ${Uo(r)}`));return ye(n)});return e===void 0?t:Ka(t,e)},VPe=(e)=>{let t=Bp("an integer property",(r)=>{let n=Number(r);if(!Number.isInteger(n))return Ie(sc([],`Expected an integer value but received ${Uo(r)}`));return ye(n)});return e===void 0?t:Ka(t,e)},GPe=(...e)=>(t)=>{let r=e.map(String).join(", "),n=Bp(`one of (${r})`,(o)=>{let s=e.find((i)=>String(i)===o);if(s===void 0)return Ie(sc([],`Expected one of (${r}) but received ${Uo(o)}`));return ye(s)});return t===void 0?n:Ka(n,t)},KPe=(e)=>{let t=iE(BO(),(r)=>{let n=r.toUpperCase(),o=r2.find((s)=>s.label===n);return o===void 0?Ie(sc([],`Expected a log level but received ${Uo(r)}`)):ye(o)});return e===void 0?t:Ka(t,e)},JPe=(e)=>{let t=iE(BO(),(r)=>{let n=Q4(r);return Wv(n,()=>sc([],`Expected a duration but received ${Uo(r)}`))});return e===void 0?t:Ka(t,e)},Wm=p(2,(e,t)=>iE(e,(r)=>ye(t(r)))),QPe=p(2,(e,t)=>iE(e,(r)=>{try{return ye(t(r))}catch(n){return Ie(sc([],n instanceof Error?n.message:`${n}`))}})),iE=p(2,(e,t)=>{let r=Object.create(qp);return r._tag=y2,r.original=e,r.mapOrFail=t,r}),Ka=p(2,(e,t)=>{let r=Object.create(qp);return r._tag=S2,r.name=t,r.config=e,r}),YPe=p(2,(e,t)=>{let r=Object.create(qp);return r._tag=o0,r.first=e,r.second=PP(t),r.condition=uo,r}),ZW=p(2,(e,t)=>{let r=Object.create(qp);return r._tag=o0,r.first=e,r.second=PP(t.orElse),r.condition=t.if,r}),ZPe=(e)=>d(e,Wm(_),ZW({orElse:()=>WO(R()),if:Ob})),Bp=(e,t)=>{let r=Object.create(qp);return r._tag=E2,r.description=e,r.parse=t,r},JW=(e)=>{let t=Object.create(qp);return t._tag=b2,t.config=e,t},XPe=(e)=>{let t=Bp("a secret property",(r)=>ye(KW(r)));return e===void 0?t:Ka(t,e)},eDe=(e)=>{let t=DP(e)?e:BO(e);return Wm(t,GW)},tDe=p(2,(e,t)=>{let r=DP(e)?e:BO(e);return iE(r,(n)=>t.either(n).pipe(pl((o)=>sc([],o.map((s)=>s.message).join(`
|
|
190
|
+
`)))))}),rDe=(e,t)=>{let r=Wm(YW(e),cp);return t===void 0?r:Ka(r,t)},BO=(e)=>{let t=Bp("a text property",ye);return e===void 0?t:Ka(t,e)},nDe=(e)=>{let t=Bp("a non-empty text property",i4((r)=>r.length>0,()=>rp([],"Expected a non-empty string")));return e===void 0?t:Ka(t,e)},oDe=(e)=>{if(Array.isArray(e))return UPe(e);else if(Symbol.iterator in e)return UPe([...e]);return sDe(e)},sDe=(e)=>{let t=Object.entries(e),r=d(t[0][1],Wm((o)=>({[t[0][0]]:o})));if(t.length===1)return r;let n=t.slice(1);for(let[o,s]of n)r=d(r,FP(s,(i,a)=>({...i,[o]:a})));return r},WO=(e)=>{let t=Object.create(qp);return t._tag=m2,t.value=e,t.parse=()=>ye(e),t},PP=(e)=>{let t=Object.create(qp);return t._tag=x2,t.config=e,t},iDe=(e)=>PP(()=>WO(e())),aDe=(e,t)=>{let r=Object.create(qp);return r._tag=C2,r.valueConfig=e,t===void 0?r:Ka(r,t)},DP=(e)=>de(e,QW),UPe=(e)=>{if(e.length===0)return WO([]);if(e.length===1)return Wm(e[0],(r)=>[r]);let t=Wm(e[0],(r)=>[r]);for(let r=1;r<e.length;r++){let n=e[r];t=d(t,FP(n,(o,s)=>[...o,s]))}return t},MX=(e)=>{if(DP(e))return e;return sDe(Object.fromEntries(Object.entries(e).map(([t,r])=>[t,MX(r)])))},cDe=p(2,(e,{message:t,validation:r})=>iE(e,(n)=>{if(r(n))return ye(n);return Ie(sc([],t))})),lDe=p(2,(e,t)=>ZW(e,{orElse:()=>WO(t),if:Ob})),uDe=p(2,(e,t)=>{let r=Object.create(qp);return r._tag=g2,r.config=e,r.description=t,r}),pDe=p(2,(e,t)=>FP(e,t,(r,n)=>[r,n])),FP=p(3,(e,t,r)=>{let n=Object.create(qp);return n._tag=w2,n.left=e,n.right=t,n.zip=r,n});var dCt=QW,mCt=oDe,hCt=WPe,gCt=HPe,xCt=BPe,yCt=qPe,SCt=YW,ECt=zPe,bCt=$Pe,CCt=jPe,wCt=VPe,kCt=GPe,ICt=KPe,ACt=JPe,PX=DP,OCt=Wm,_Ct=QPe,DX=iE,vCt=Ka,TCt=YPe,RCt=ZW,MCt=ZPe,PCt=Bp,DCt=JW,FCt=XPe,NCt=eDe,LCt=tDe,UCt=rDe,FX=BO,HCt=nDe,qCt=WO,BCt=PP,WCt=iDe,zCt=aDe,$Ct=MX,jCt=cDe,VCt=lDe,GCt=uDe,KCt=pDe,JCt=FP;var ar={};Ht(ar,{CurrentTimeZone:()=>pd,Equivalence:()=>ez,Order:()=>XCt,TimeZoneTypeId:()=>YCt,TypeId:()=>QCt,add:()=>Gwt,addDuration:()=>jwt,between:()=>Swt,clamp:()=>ewt,distance:()=>uwt,distanceDuration:()=>fwt,distanceDurationEither:()=>pwt,endOf:()=>Qwt,format:()=>Zwt,formatIntl:()=>tkt,formatIso:()=>JX,formatIsoDate:()=>rkt,formatIsoDateUtc:()=>nkt,formatIsoOffset:()=>okt,formatIsoZoned:()=>QX,formatLocal:()=>Xwt,formatUtc:()=>ekt,getPart:()=>Rwt,getPartUtc:()=>Twt,greaterThan:()=>hwt,greaterThanOrEqualTo:()=>gwt,isDateTime:()=>XW,isFuture:()=>Ewt,isPast:()=>Cwt,isTimeZone:()=>ZCt,isTimeZoneNamed:()=>LX,isTimeZoneOffset:()=>NX,isUtc:()=>UX,isZoned:()=>HX,layerCurrentZone:()=>skt,layerCurrentZoneLocal:()=>ckt,layerCurrentZoneNamed:()=>akt,layerCurrentZoneOffset:()=>ikt,lessThan:()=>xwt,lessThanOrEqualTo:()=>ywt,make:()=>rwt,makeZoned:()=>twt,makeZonedFromString:()=>zX,mapEpochMillis:()=>Bwt,match:()=>$wt,max:()=>mwt,min:()=>dwt,mutate:()=>Hwt,mutateUtc:()=>qwt,nearest:()=>Ywt,now:()=>fDe,nowAsDate:()=>nwt,nowInCurrentZone:()=>Uwt,removeTime:()=>Owt,setParts:()=>Mwt,setPartsUtc:()=>Pwt,setZone:()=>dDe,setZoneCurrent:()=>hDe,setZoneNamed:()=>cwt,setZoneOffset:()=>iwt,startOf:()=>Jwt,subtract:()=>Kwt,subtractDuration:()=>Vwt,toDate:()=>kwt,toDateUtc:()=>GX,toEpochMillis:()=>KX,toParts:()=>_wt,toPartsUtc:()=>vwt,toUtc:()=>swt,unsafeFromDate:()=>qX,unsafeIsFuture:()=>bwt,unsafeIsPast:()=>wwt,unsafeMake:()=>BX,unsafeMakeZoned:()=>WX,unsafeNow:()=>owt,unsafeSetZoneNamed:()=>lwt,withCurrentZone:()=>Dwt,withCurrentZoneLocal:()=>Fwt,withCurrentZoneNamed:()=>Lwt,withCurrentZoneOffset:()=>Nwt,withDate:()=>Wwt,withDateUtc:()=>zwt,zoneFromString:()=>jX,zoneMakeLocal:()=>$X,zoneMakeNamed:()=>awt,zoneMakeNamedEffect:()=>mDe,zoneMakeOffset:()=>NP,zoneToString:()=>VX,zoneUnsafeMakeNamed:()=>tz,zonedOffset:()=>Iwt,zonedOffsetIso:()=>Awt});var QCt=hR,YCt=gR,XW=RC,ZCt=MC,NX=ywe,LX=Swe,UX=Ewe,HX=G5,ez=bwe,XCt=vm,ewt=Cwe,qX=OA,BX=_H,WX=K5,twt=AH,rwt=wwe,zX=kwe,fDe=vH,nwt=Iwe,owt=TH,swt=Awe,dDe=xR,iwt=Owe,tz=yR,NP=TC,awt=RH,mDe=J5,$X=Twe,jX=Q5,VX=Rwe,cwt=Mwe,lwt=Pwe,uwt=MH,pwt=Dwe,fwt=Fwe,dwt=Nwe,mwt=Lwe,hwt=PH,gwt=Uwe,xwt=DH,ywt=Hwe,Swt=qwe,Ewt=Bwe,bwt=Wwe,Cwt=zwe,wwt=$we,GX=pS,kwt=bg,Iwt=FH,Awt=Y5,KX=_A,Owt=jwe,_wt=Z5,vwt=LH,Twt=Gwe,Rwt=Kwe,Mwt=Jwe,Pwt=Qwe;class pd extends Gs("effect/DateTime/CurrentTimeZone")(){}var hDe=(e)=>W(pd,(t)=>dDe(e,t)),Dwt=p(2,(e,t)=>xi(e,pd,t)),Fwt=(e)=>ku(e,pd,Ce($X)),Nwt=p(2,(e,t)=>xi(e,pd,NP(t))),Lwt=p(2,(e,t)=>ku(e,pd,mDe(t))),Uwt=L(fDe,hDe),Hwt=DC,qwt=rQ,Bwt=SR,Wwt=UH,zwt=nQ,$wt=Ywe,jwt=Zwe,Vwt=Xwe,Gwt=oQ,Kwt=eke,Jwt=rke,Qwt=oke,Ywt=ske,Zwt=ike,Xwt=ake,ekt=cke,tkt=lke,JX=uke,rkt=pke,nkt=fke,okt=OH,QX=sQ,skt=(e)=>Hs(pd,e),ikt=(e)=>Hs(pd,TC(e)),akt=(e)=>gc(pd,J5(e)),ckt=ow(pd,$X);var YX=Symbol.for("effect/Encoding/errors/Decode"),Wp=(e,t)=>{let r={_tag:"DecodeException",[YX]:YX,input:e};if(Jr(t))r.message=t;return r};var ZX=Symbol.for("effect/Encoding/errors/Encode"),gDe=(e,t)=>{let r={_tag:"EncodeException",[ZX]:ZX,input:e};if(Jr(t))r.message=t;return r};var rz=new TextEncoder,nz=new TextDecoder;var LP=(e)=>{let t=e.length,r="",n;for(n=2;n<t;n+=3)r+=ex[e[n-2]>>2],r+=ex[(e[n-2]&3)<<4|e[n-1]>>4],r+=ex[(e[n-1]&15)<<2|e[n]>>6],r+=ex[e[n]&63];if(n===t+1)r+=ex[e[n-2]>>2],r+=ex[(e[n-2]&3)<<4],r+="==";if(n===t)r+=ex[e[n-2]>>2],r+=ex[(e[n-2]&3)<<4|e[n-1]>>4],r+=ex[(e[n-1]&15)<<2],r+="=";return r},sz=(e)=>{let t=XX(e),r=t.length;if(r%4!==0)return Ie(Wp(t,`Length must be a multiple of 4, but is ${r}`));let n=t.indexOf("=");if(n!==-1&&(n<r-2||n===r-2&&t[r-1]!=="="))return Ie(Wp(t,"Found a '=' character, but it is not at the end"));try{let o=t.endsWith("==")?2:t.endsWith("=")?1:0,s=new Uint8Array(3*(r/4)-o);for(let i=0,a=0;i<r;i+=4,a+=3){let c=oz(t.charCodeAt(i))<<18|oz(t.charCodeAt(i+1))<<12|oz(t.charCodeAt(i+2))<<6|oz(t.charCodeAt(i+3));s[a]=c>>16,s[a+1]=c>>8&255,s[a+2]=c&255}return ye(s)}catch(o){return Ie(Wp(t,o instanceof Error?o.message:"Invalid input"))}},XX=(e)=>e.replace(/[\n\r]/g,"");function oz(e){if(e>=xDe.length)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);let t=xDe[e];if(t===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return t}var ex=["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","+","/"],xDe=[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 eee=(e)=>LP(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),SDe=(e)=>{let t=XX(e),r=t.length;if(r%4===1)return Ie(Wp(t,`Length should be a multiple of 4, but is ${r}`));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(t))return Ie(Wp(t,"Invalid input"));let n=r%4===2?`${t}==`:r%4===3?`${t}=`:t;return n=n.replace(/-/g,"+").replace(/_/g,"/"),sz(n)};var tee=(e)=>{let t="";for(let r=0;r<e.length;++r)t+=pkt[e[r]];return t},bDe=(e)=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return Ie(Wp(e,`Length must be a multiple of 2, but is ${t.length}`));try{let r=t.length/2,n=new Uint8Array(r);for(let o=0;o<r;o++){let s=EDe(t[o*2]),i=EDe(t[o*2+1]);n[o]=s<<4|i}return ye(n)}catch(r){return Ie(Wp(e,r instanceof Error?r.message:"Invalid input"))}},pkt=["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"],EDe=(e)=>{if(48<=e&&e<=57)return e-48;if(97<=e&&e<=102)return e-97+10;if(65<=e&&e<=70)return e-65+10;throw TypeError("Invalid input")};var ree=(e)=>typeof e==="string"?LP(rz.encode(e)):LP(e),nee=(e)=>sz(e),CDe=(e)=>eu(nee(e),(t)=>nz.decode(t)),oee=(e)=>typeof e==="string"?eee(rz.encode(e)):eee(e),see=(e)=>SDe(e),wDe=(e)=>eu(see(e),(t)=>nz.decode(t)),iee=(e)=>typeof e==="string"?tee(rz.encode(e)):tee(e),aee=(e)=>bDe(e),kDe=(e)=>eu(aee(e),(t)=>nz.decode(t)),IDe=(e)=>ay({try:()=>encodeURIComponent(e),catch:(t)=>mkt(e,t instanceof Error?t.message:"Invalid input")}),ADe=(e)=>ay({try:()=>decodeURIComponent(e),catch:(t)=>dkt(e,t instanceof Error?t.message:"Invalid input")});var dkt=Wp;var mkt=gDe;class iz{[Symbol.iterator](){return this}next(e){return{value:e,done:!0}}}iz.nil=new iz;function ODe(){return iz.nil}function*_De(e,t){for(let r of e)yield t(r)}function*vDe(e,t){for(let r of e)yield*t(r)}function*TDe(e,t){for(let r of e)if(t(r))yield r}function*RDe(e,t){for(let r=0;r<t;++r){let n=e.next();if(n.done)break;yield n.value}}function*MDe(e,t){let r=e.next();while(!r.done&&t(r.value))yield r.value,r=e.next()}function*PDe(e,t){for(let r=e.next();!r.done;r=e.next())yield r.value;for(let r of t)for(let n=r.next();!n.done;n=r.next())yield n.value}var gkt=Symbol.iterator;class ti{static nil(){return new ti(ODe())}static of(...e){return new ti(e[gkt]())}constructor(e){this.g=e}next(){return this.g.next()}[Symbol.iterator](){return this.g}map(e){return new ti(_De(this.g,e))}flatMap(e){return new ti(vDe(this.g,e))}dropWhile(e){let t=!1;function*r(n){if(t||!e(n))t=!0,yield n}return this.flatMap(r)}drop(e){if(e<=0)return this;let t=0;function r(){return t++<e}return this.dropWhile(r)}takeWhile(e){return new ti(MDe(this.g,e))}take(e){return new ti(RDe(this.g,e))}filter(e){return new ti(TDe(this.g,e))}every(e){for(let t of this.g)if(!e(t))return!1;return!0}has(e){for(let t of this.g)if(e(t))return[!0,t];return[!1,null]}join(...e){return new ti(PDe(this.g,e))}getNthOrLast(e){let t=e,r=null;for(let n of this.g){if(t--===0)return n;r=n}return r}}function cee(e){return new ti(e)}var tx=Symbol.for("fast-check/cloneMethod");function UP(e){return e!==null&&(typeof e==="object"||typeof e==="function")&&tx in e&&typeof e[tx]==="function"}function HP(e){return UP(e)?e[tx]():e}var xkt=Object.defineProperty;class qs{constructor(e,t,r=void 0){if(this.value_=e,this.context=t,this.hasToBeCloned=r!==void 0||UP(e),this.readOnce=!1,this.hasToBeCloned)xkt(this,"value",{get:r!==void 0?r:this.getValue});else this.value=e}getValue(){if(this.hasToBeCloned){if(!this.readOnce)return this.readOnce=!0,this.value_;return this.value_[tx]()}return this.value_}}var DDe=Object.assign;class zm{filter(e){return new LDe(this,e)}map(e,t){return new NDe(this,e,t)}chain(e){return new FDe(this,e)}noShrink(){return new UDe(this)}noBias(){return new HDe(this)}}class FDe extends zm{constructor(e,t){super();this.arb=e,this.chainer=t}generate(e,t){let r=e.clone(),n=this.arb.generate(e,t);return this.valueChainer(n,e,r,t)}canShrinkWithoutContext(e){return!1}shrink(e,t){if(this.isSafeContext(t))return(!t.stoppedForOriginal?this.arb.shrink(t.originalValue,t.originalContext).map((r)=>this.valueChainer(r,t.clonedMrng.clone(),t.clonedMrng,t.originalBias)):ti.nil()).join(t.chainedArbitrary.shrink(e,t.chainedContext).map((r)=>{let n=DDe(DDe({},t),{chainedContext:r.context,stoppedForOriginal:!0});return new qs(r.value_,n)}));return ti.nil()}valueChainer(e,t,r,n){let o=this.chainer(e.value_),s=o.generate(t,n),i={originalBias:n,originalValue:e.value_,originalContext:e.context,stoppedForOriginal:!1,chainedArbitrary:o,chainedContext:s.context,clonedMrng:r};return new qs(s.value_,i)}isSafeContext(e){return e!=null&&typeof e==="object"&&"originalBias"in e&&"originalValue"in e&&"originalContext"in e&&"stoppedForOriginal"in e&&"chainedArbitrary"in e&&"chainedContext"in e&&"clonedMrng"in e}}class NDe extends zm{constructor(e,t,r){super();this.arb=e,this.mapper=t,this.unmapper=r,this.bindValueMapper=(n)=>this.valueMapper(n)}generate(e,t){let r=this.arb.generate(e,t);return this.valueMapper(r)}canShrinkWithoutContext(e){if(this.unmapper!==void 0)try{let t=this.unmapper(e);return this.arb.canShrinkWithoutContext(t)}catch(t){return!1}return!1}shrink(e,t){if(this.isSafeContext(t))return this.arb.shrink(t.originalValue,t.originalContext).map(this.bindValueMapper);if(this.unmapper!==void 0){let r=this.unmapper(e);return this.arb.shrink(r,void 0).map(this.bindValueMapper)}return ti.nil()}mapperWithCloneIfNeeded(e){let t=e.value,r=this.mapper(t);if(e.hasToBeCloned&&(typeof r==="object"&&r!==null||typeof r==="function")&&Object.isExtensible(r)&&!UP(r))Object.defineProperty(r,tx,{get:()=>()=>this.mapperWithCloneIfNeeded(e)[0]});return[r,t]}valueMapper(e){let[t,r]=this.mapperWithCloneIfNeeded(e),n={originalValue:r,originalContext:e.context};return new qs(t,n)}isSafeContext(e){return e!=null&&typeof e==="object"&&"originalValue"in e&&"originalContext"in e}}class LDe extends zm{constructor(e,t){super();this.arb=e,this.refinement=t,this.bindRefinementOnValue=(r)=>this.refinementOnValue(r)}generate(e,t){while(!0){let r=this.arb.generate(e,t);if(this.refinementOnValue(r))return r}}canShrinkWithoutContext(e){return this.arb.canShrinkWithoutContext(e)&&this.refinement(e)}shrink(e,t){return this.arb.shrink(e,t).filter(this.bindRefinementOnValue)}refinementOnValue(e){return this.refinement(e.value)}}class UDe extends zm{constructor(e){super();this.arb=e}generate(e,t){return this.arb.generate(e,t)}canShrinkWithoutContext(e){return this.arb.canShrinkWithoutContext(e)}shrink(e,t){return ti.nil()}noShrink(){return this}}class HDe extends zm{constructor(e){super();this.arb=e}generate(e,t){return this.arb.generate(e,void 0)}canShrinkWithoutContext(e){return this.arb.canShrinkWithoutContext(e)}shrink(e,t){return this.arb.shrink(e,t)}noBias(){return this}}var qDe=Function.prototype.apply,lee=Symbol("apply");function ykt(e){try{return e.apply}catch(t){return}}function Skt(e,t,r){let n=e;n[lee]=qDe;let o=n[lee](t,r);return delete n[lee],o}function kw(e,t,r){if(ykt(e)===qDe)return e.apply(t,r);return Skt(e,t,r)}var Scr=Array.prototype.forEach,BDe=Array.prototype.indexOf,Ecr=Array.prototype.join,WDe=Array.prototype.map,bcr=Array.prototype.filter,zDe=Array.prototype.push,Ccr=Array.prototype.pop,wcr=Array.prototype.splice,$De=Array.prototype.slice,kcr=Array.prototype.sort,Icr=Array.prototype.every;function Ekt(e){try{return e.indexOf}catch(t){return}}function bkt(e){try{return e.map}catch(t){return}}function Ckt(e){try{return e.push}catch(t){return}}function wkt(e){try{return e.slice}catch(t){return}}function uee(e,...t){if(Ekt(e)===BDe)return e.indexOf(...t);return kw(BDe,e,t)}function qP(e,t){if(bkt(e)===WDe)return e.map(t);return kw(WDe,e,[t])}function aE(e,...t){if(Ckt(e)===zDe)return e.push(...t);return kw(zDe,e,t)}function zO(e,...t){if(wkt(e)===$De)return e.slice(...t);return kw($De,e,t)}var Acr=Date.prototype.getTime,Ocr=Date.prototype.toISOString;var _cr=Set.prototype.add,vcr=Set.prototype.has;var Tcr=WeakMap.prototype.set,Rcr=WeakMap.prototype.get;var jDe=Map.prototype.set,VDe=Map.prototype.get;function kkt(e){try{return e.set}catch(t){return}}function Ikt(e){try{return e.get}catch(t){return}}function GDe(e,t,r){if(kkt(e)===jDe)return e.set(t,r);return kw(jDe,e,[t,r])}function KDe(e,t){if(Ikt(e)===VDe)return e.get(t);return kw(VDe,e,[t])}var Mcr=String.prototype.split,Pcr=String.prototype.startsWith,Dcr=String.prototype.endsWith,Fcr=String.prototype.substring,Ncr=String.prototype.toLowerCase,Lcr=String.prototype.toUpperCase,Ucr=String.prototype.padStart,Hcr=String.prototype.charCodeAt,qcr=String.prototype.normalize,Bcr=String.prototype.replace;var Wcr=Number.prototype.toString;class JDe{constructor(e){this.producer=e}[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 az(e){return new JDe(e)}var Akt={};function QDe(){return Akt}var{floor:Okt,log:YDe}=Math;function ZDe(e){return Okt(YDe(e)/YDe(2))}function XDe(e,t,r){if(e===t)return[{min:e,max:t}];if(e<0&&t>0){let i=r(-e),a=r(t);return[{min:-i,max:a},{min:t-a,max:t},{min:e,max:e+i}]}let n=r(t-e),o={min:e,max:e+n},s={min:t-n,max:t};return e<0?[s,o]:[o,s]}var{ceil:_kt,floor:vkt}=Math;function eFe(e){return vkt(e/2)}function tFe(e){return _kt(e/2)}function pee(e,t,r){let n=e-t;function*o(){let i=r?void 0:t,a=r?n:eFe(n);for(let c=a;c>0;c=eFe(c)){let l=c===n?t:e-c;yield new qs(l,i),i=l}}function*s(){let i=r?void 0:t,a=r?n:tFe(n);for(let c=a;c<0;c=tFe(c)){let l=c===n?t:e-c;yield new qs(l,i),i=l}}return n>0?cee(o()):cee(s())}var rFe=Math.sign,Tkt=Number.isInteger,Rkt=Object.is;class cz extends zm{constructor(e,t){super();this.min=e,this.max=t}generate(e,t){let r=this.computeGenerateRange(e,t);return new qs(e.nextInt(r.min,r.max),void 0)}canShrinkWithoutContext(e){return typeof e==="number"&&Tkt(e)&&!Rkt(e,-0)&&this.min<=e&&e<=this.max}shrink(e,t){if(!cz.isValidContext(e,t)){let r=this.defaultTarget();return pee(e,r,!0)}if(this.isLastChanceTry(e,t))return ti.of(new qs(t,void 0));return pee(e,t,!1)}defaultTarget(){if(this.min<=0&&this.max>=0)return 0;return this.min<0?this.max:this.min}computeGenerateRange(e,t){if(t===void 0||e.nextInt(1,t)!==1)return{min:this.min,max:this.max};let r=XDe(this.min,this.max,ZDe);if(r.length===1)return r[0];let n=e.nextInt(-2*(r.length-1),r.length-2);return n<0?r[0]:r[n+1]}isLastChanceTry(e,t){if(e>0)return e===t+1&&e>this.min;if(e<0)return e===t-1&&e<this.max;return!1}static isValidContext(e,t){if(t===void 0)return!1;if(typeof t!=="number")throw Error("Invalid context type passed to IntegerArbitrary (#1)");if(t!==0&&rFe(e)!==rFe(t))throw Error("Invalid context value passed to IntegerArbitrary (#2)");return!0}}var nFe=Number.isInteger;function Mkt(e){let t=e.min!==void 0?e.min:-2147483648,r=e.max!==void 0?e.max:2147483647;return{min:t,max:r}}function fee(e={}){let t=Mkt(e);if(t.min>t.max)throw Error("fc.integer maximum value should be equal or greater than the minimum one");if(!nFe(t.min))throw Error("fc.integer minimum value should be an integer");if(!nFe(t.max))throw Error("fc.integer maximum value should be an integer");return new cz(t.min,t.max)}var oFe=new Map;function sFe(e){if(e===void 0)return{depth:0};if(typeof e!=="string")return e;let t=KDe(oFe,e);if(t!==void 0)return t;let r={depth:0};return GDe(oFe,e,r),r}class dee{constructor(e,t,r){this.arb=e,this.mrng=t,this.biasFactor=r}attemptExact(){return}next(){return this.arb.generate(this.mrng,this.biasFactor)}}var{min:Pkt,max:Dkt}=Math;class mee{constructor(e,t,r,n){this.arb=e,this.mrng=t,this.slices=r,this.biasFactor=n,this.activeSliceIndex=0,this.nextIndexInSlice=0,this.lastIndexInSlice=-1}attemptExact(e){if(e!==0&&this.mrng.nextInt(1,this.biasFactor)===1){let t=[];for(let r=0;r!==this.slices.length;++r)if(this.slices[r].length===e)aE(t,r);if(t.length===0)return;this.activeSliceIndex=t[this.mrng.nextInt(0,t.length-1)],this.nextIndexInSlice=0,this.lastIndexInSlice=e-1}}next(){if(this.nextIndexInSlice<=this.lastIndexInSlice)return new qs(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 e=this.slices[this.activeSliceIndex];if(this.mrng.nextInt(1,this.biasFactor)!==1)return this.nextIndexInSlice=1,this.lastIndexInSlice=e.length-1,new qs(e[0],void 0);let t=this.mrng.nextInt(0,e.length-1),r=this.mrng.nextInt(0,e.length-1);return this.nextIndexInSlice=Pkt(t,r),this.lastIndexInSlice=Dkt(t,r),new qs(e[this.nextIndexInSlice++],void 0)}}function hee(e,t,r,n){if(n===void 0||r.length===0||t.nextInt(1,n)!==1)return new dee(e,t,n);return new mee(e,t,r,n)}var{floor:Fkt,log:iFe,max:aFe}=Math,Nkt=Array.isArray;function gee(e,t){if(e===t)return e;return e+Fkt(iFe(t-e)/iFe(2))}class lz extends zm{constructor(e,t,r,n,o,s,i){super();this.arb=e,this.minLength=t,this.maxGeneratedLength=r,this.maxLength=n,this.setBuilder=s,this.customSlices=i,this.lengthArb=fee({min:t,max:r}),this.depthContext=sFe(o)}preFilter(e){if(this.setBuilder===void 0)return e;let t=this.setBuilder();for(let r=0;r!==e.length;++r)t.tryAdd(e[r]);return t.getData()}static makeItCloneable(e,t){return e[tx]=()=>{let r=[];for(let n=0;n!==t.length;++n)aE(r,t[n].value);return this.makeItCloneable(r,t),r},e}generateNItemsNoDuplicates(e,t,r,n){let o=0,s=e(),i=hee(this.arb,r,this.customSlices,n);while(s.size()<t&&o<this.maxGeneratedLength){let a=i.next();if(s.tryAdd(a))o=0;else o+=1}return s.getData()}safeGenerateNItemsNoDuplicates(e,t,r,n){let o=aFe(0,t-gee(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=o;try{return this.generateNItemsNoDuplicates(e,t,r,n)}finally{this.depthContext.depth-=o}}generateNItems(e,t,r){let n=[],o=hee(this.arb,t,this.customSlices,r);o.attemptExact(e);for(let s=0;s!==e;++s){let i=o.next();aE(n,i)}return n}safeGenerateNItems(e,t,r){let n=aFe(0,e-gee(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=n;try{return this.generateNItems(e,t,r)}finally{this.depthContext.depth-=n}}wrapper(e,t,r,n){let o=t?this.preFilter(e):e,s=!1,i=[],a=[];for(let l=0;l!==o.length;++l){let u=o[l];s=s||u.hasToBeCloned,aE(i,u.value),aE(a,u.context)}if(s)lz.makeItCloneable(i,o);let c={shrunkOnce:t,lengthContext:e.length===o.length&&r!==void 0?r:void 0,itemsContexts:a,startIndex:n};return new qs(i,c)}generate(e,t){let r=this.applyBias(e,t),n=r.size,o=this.setBuilder!==void 0?this.safeGenerateNItemsNoDuplicates(this.setBuilder,n,e,r.biasFactorItems):this.safeGenerateNItems(n,e,r.biasFactorItems);return this.wrapper(o,!1,void 0,0)}applyBias(e,t){if(t===void 0)return{size:this.lengthArb.generate(e,void 0).value};if(this.minLength===this.maxGeneratedLength)return{size:this.lengthArb.generate(e,void 0).value,biasFactorItems:t};if(e.nextInt(1,t)!==1)return{size:this.lengthArb.generate(e,void 0).value};if(e.nextInt(1,t)!==1||this.minLength===this.maxGeneratedLength)return{size:this.lengthArb.generate(e,void 0).value,biasFactorItems:t};let r=gee(this.minLength,this.maxGeneratedLength);return{size:fee({min:this.minLength,max:r}).generate(e,void 0).value,biasFactorItems:t}}canShrinkWithoutContext(e){if(!Nkt(e)||this.minLength>e.length||e.length>this.maxLength)return!1;for(let r=0;r!==e.length;++r){if(!(r in e))return!1;if(!this.arb.canShrinkWithoutContext(e[r]))return!1}return this.preFilter(qP(e,(r)=>new qs(r,void 0))).length===e.length}shrinkItemByItem(e,t,r){let n=[];for(let o=t.startIndex;o<r;++o)aE(n,az(()=>this.arb.shrink(e[o],t.itemsContexts[o]).map((s)=>{let i=qP(zO(e,0,o),(c,l)=>new qs(HP(c),t.itemsContexts[l])),a=qP(zO(e,o+1),(c,l)=>new qs(HP(c),t.itemsContexts[l+o+1]));return[[...i,s,...a],void 0,o]})));return ti.nil().join(...n)}shrinkImpl(e,t){if(e.length===0)return ti.nil();let r=t!==void 0?t:{shrunkOnce:!1,lengthContext:void 0,itemsContexts:[],startIndex:0};return this.lengthArb.shrink(e.length,r.lengthContext).drop(r.shrunkOnce&&r.lengthContext===void 0&&e.length>this.minLength+1?1:0).map((n)=>{let o=e.length-n.value;return[qP(zO(e,o),(s,i)=>new qs(HP(s),r.itemsContexts[i+o])),n.context,0]}).join(az(()=>e.length>this.minLength?this.shrinkItemByItem(e,r,1):this.shrinkItemByItem(e,r,e.length))).join(e.length>this.minLength?az(()=>{let n={shrunkOnce:!1,lengthContext:void 0,itemsContexts:zO(r.itemsContexts,1),startIndex:0};return this.shrinkImpl(zO(e,1),n).filter((o)=>this.minLength<=o[0].length+1).map((o)=>[[new qs(HP(e[0]),r.itemsContexts[0]),...o[0]],void 0,0])}):ti.nil())}shrink(e,t){return this.shrinkImpl(e,t).map((r)=>this.wrapper(r[0],!0,r[1],r[2]))}}var{floor:Lkt,min:Ukt}=Math,cFe=2147483647,$O=["xsmall","small","medium","large","xlarge"],Hkt=["-4","-3","-2","-1","=","+1","+2","+3","+4"],qkt="small";function Bkt(e,t){switch(t){case"xsmall":return Lkt(1.1*e)+1;case"small":return 2*e+10;case"medium":return 11*e+100;case"large":return 101*e+1000;case"xlarge":return 1001*e+1e4;default:throw Error(`Unable to compute lengths based on received size: ${t}`)}}function Wkt(e,t){let r=uee(Hkt,e);if(r===-1)return e;let n=uee($O,t);if(n===-1)throw Error(`Unable to offset size based on the unknown defaulted one: ${t}`);let o=n+r-4;return o<0?$O[0]:o>=$O.length?$O[$O.length-1]:$O[o]}function lFe(e,t,r,n){let{baseSize:o=qkt,defaultSizeToMaxWhenMaxSpecified:s}=QDe()||{},i=e!==void 0?e:n&&s?"max":o;if(i==="max")return r;let a=Wkt(i,o);return Ukt(Bkt(t,a),r)}function xee(e,t={}){let r=t.size,n=t.minLength||0,o=t.maxLength,s=t.depthIdentifier,i=o!==void 0?o:cFe,c=lFe(r,n,i,o!==void 0),l=t.experimentalCustomSlices||[];return new lz(e,n,c,i,s,void 0,l)}var uFe=Symbol.for("effect/SchemaId/DateFromSelf"),pFe=Symbol.for("effect/SchemaId/GreaterThan"),fFe=Symbol.for("effect/SchemaId/GreaterThanOrEqualTo"),dFe=Symbol.for("effect/SchemaId/LessThan"),mFe=Symbol.for("effect/SchemaId/LessThanOrEqualTo"),uz=Symbol.for("effect/SchemaId/Int"),hFe=Symbol.for("effect/SchemaId/NonNaN"),gFe=Symbol.for("effect/SchemaId/Finite"),xFe=Symbol.for("effect/SchemaId/JsonNumber"),yFe=Symbol.for("effect/SchemaId/Between"),SFe=Symbol.for("effect/SchemaId/GreaterThanBigint"),EFe=Symbol.for("effect/SchemaId/GreaterThanOrEqualToBigint"),bFe=Symbol.for("effect/SchemaId/LessThanBigint"),CFe=Symbol.for("effect/SchemaId/LessThanOrEqualToBigint"),wFe=Symbol.for("effect/SchemaId/BetweenBigint"),kFe=Symbol.for("effect/SchemaId/MinLength"),IFe=Symbol.for("effect/SchemaId/MaxLength"),AFe=Symbol.for("effect/SchemaId/Length"),OFe=Symbol.for("effect/SchemaId/MinItems"),_Fe=Symbol.for("effect/SchemaId/MaxItems"),vFe=Symbol.for("effect/SchemaId/ItemsCount");var da={};Ht(da,{RedactedTypeId:()=>zkt,getEquivalence:()=>See,isRedacted:()=>yee,make:()=>Ru,unsafeWipe:()=>$kt,value:()=>cE});var zkt=VW,yee=vX,Ru=GW,cE=DPe,$kt=FPe,See=(e)=>No((t,r)=>e(cE(t),cE(r)));var RFe=p((e)=>Zo(e[0]),(e,...t)=>{let r={};for(let n of t)if(n in e)r[n]=e[n];return r}),MFe=p((e)=>Zo(e[0]),(e,...t)=>{let r={...e};for(let n of t)delete r[n];return r});var pE=Symbol.for("effect/Schema");function rr(e){return class{[pE]=Eee;static ast=e;static annotations(r){return rr(Nl(this.ast,r))}static pipe(){return ce(this,arguments)}static toString(){return String(e)}static Type;static Encoded;static Context;static[pE]=Eee}}var Eee={_A:(e)=>e,_I:(e)=>e,_R:(e)=>e},PFe=(e)=>Uc(e)?e.value:Vkt(hA(e.cause)),Vkt=(e)=>({issues:[{message:e}]}),Gkt=(e)=>W(sM.formatIssue(e),(t)=>({issues:t.map((r)=>({path:r.path,message:r.message}))})),Kkt=(e,t)=>{let r=gs(e,{errors:"all"});return class extends rr(e.ast){static "~standard"={version:1,vendor:"effect",validate(o){let s=new gC,i=Al(wr(r(o,t),{onFailure:Gkt,onSuccess:(c)=>N({value:c})}),{scheduler:s});s.flush();let a=i.unsafePoll();if(a)return PFe(a);return new Promise((c)=>{i.addObserver((l)=>{c(PFe(l))})})}}}},DFe={typeConstructor:LIe,schemaId:QC,message:aY,missingMessage:mq,identifier:jR,title:za,description:_l,examples:hq,default:gq,documentation:UIe,jsonSchema:xq,arbitrary:cY,pretty:lY,equivalence:yq,concurrency:uY,batching:pY,parseIssueTitle:fY,parseOptions:dY,decodingFallback:mY},ox=(e)=>{if(!e)return{};let t={...e};for(let r in DFe)if(r in e){let n=DFe[r];t[n]=e[r],delete t[r]}return t},Nl=(e,t)=>tM(e,ox(t));function En(e){return e}var $n=(e)=>String(e.ast),Ez=(e)=>rr(rM(e.ast)),nte=(e)=>rr(IAe(e.ast)),Kt=(e)=>rr(_n(e.ast)),Mu=(e,t)=>{let r=Us(e,t);return(n,o)=>rw(r(n,o),Rg)},tNe=(e,t)=>{let r=MAe(e,t);return(n,o)=>pl(r(n,o),Rg)},rNe=(e,t)=>{let r=Mu(e,t);return(n,o)=>Ag(r(n,o))},Gm=Mu,Jkt=tNe,Qkt=rNe,Qr=(e,t)=>{let r=gs(e,t);return(n,o)=>rw(r(n,o),Rg)},nNe=(e,t)=>{let r=BY(e,t);return(n,o)=>pl(r(n,o),Rg)},oNe=(e,t)=>{let r=Qr(e,t);return(n,o)=>Ag(r(n,o))},ote=Qr,Ykt=nNe,Zkt=oNe,bz=(e,t)=>{let r=NAe(e,t);return(n,o)=>rw(r(n,o),Rg)},Xkt=(e,t)=>{let r=FAe(e,t);return(n,o)=>pl(r(n,o),Rg)},eIt=(e,t)=>{let r=bz(e,t);return(n,o)=>Ag(r(n,o))},so=(e)=>de(e,pE)&&Zo(e[pE]);function tIt(e){return kq(e)?ho.make(gAe(e,(t)=>new Dm(t))):new Dm(e[0])}function sNe(e,t=tIt(e)){return class extends rr(t){static annotations(n){return sNe(this.literals,Nl(this.ast,n))}static literals=[...e]}}function qe(...e){return ut(e)?sNe(e):zp}var rIt=(...e)=>(t)=>qe(...e),iNe=(e)=>rr(new jA(e)),nIt=(e)=>new kY(Object.keys(e).filter((t)=>typeof e[e[t]]!=="number").map((t)=>[t,e[t]])),aNe=(e,t=nIt(e))=>class extends rr(t){static annotations(n){return aNe(this.enums,Nl(this.ast,n))}static enums={...e}},oIt=(e)=>aNe(e),cNe=(...[e,...t])=>{let r=[],n="",o=t;if(so(e))if(Fm(e.ast))n=String(e.ast.literal);else o=[e,...o];else n=String(e);for(let s=0;s<o.length;s++){let i=o[s];if(so(i)){if(s<o.length-1){let a=o[s+1];if(so(a)){if(Fm(a.ast)){r.push(new XC(i.ast,String(a.ast.literal))),s++;continue}}else{r.push(new XC(i.ast,String(a))),s++;continue}}r.push(new XC(i.ast,""))}else r.push(new XC(new Dm(i),""))}if(tp(r))return rr(new Cq(n,r));else return rr(new Cq("",[new XC(new Dm(n),"")]))};function lNe(e,t){let r=e.ast;switch(r._tag){case"Literal":{let n=r.literal;if(!Jr(n)){let o=String(n);return Mt(qe(o),t,{strict:!0,decode:()=>n,encode:()=>o})}break}case"NumberKeyword":return Ow(ax,t);case"Union":{let n=[],o=!1;for(let s of r.types){let i=rr(s),a=Ez(i),c=lNe(a,i);if(c)o=!0;n.push(c??i)}return o?Ow(gt(...n),t):t}}}var sIt=(...e)=>{let t=[],r=[],n=[],o=!1;for(let c=0;c<e.length;c++){let l=e[c],u=so(l)?l:qe(l);n.push(u);let f=Ez(u);t.push(f);let h=lNe(f,u);if(h)r.push(h),o=!0;else r.push(u)}let s=cNe(...t),i=bAe(s.ast),a=ma(...r);if(o)a=a.annotations({[bS]:$n(ma(...n))});return class extends Qo(s,a,{strict:!1,decode:(l,u,f)=>{let h=i.exec(l);return h?cn(h.slice(1,e.length+1)):Ko(new Zt(f,l,`${i.source}: no match for ${JSON.stringify(l)}`))},encode:(l)=>cn(l.join(""))}){static params=e.slice()}},iIt=(e,t,r)=>ste(e,new $A(e.map((n)=>n.ast),(...n)=>t.decode(...n.map(rr)),(...n)=>t.encode(...n.map(rr)),ox(r))),aIt=(e,t)=>{let r=()=>(o,s,i)=>e(o)?cn(o):Ko(new Zt(i,o));return ste([],new $A([],r,r,ox(t)))};function ste(e,t){return class extends rr(t){static annotations(n){return ste(this.typeParameters,Nl(this.ast,n))}static typeParameters=[...e]}}var jn=function(){if(Array.isArray(arguments[0])){let r=arguments[0],n=arguments[1],o=arguments[2];return iIt(r,n,o)}let e=arguments[0],t=arguments[1];return aIt(e,t)},bee=Symbol.for("effect/SchemaId/Brand"),cIt=(e,t)=>(r)=>cte(r,new kS(r.ast,function(s,i,a){let c=e.either(s);return Sr(c)?_(new Zt(a,s,c.left.map((l)=>l.message).join(", "))):R()},ox({schemaId:bee,[bee]:{constructor:e},...t}))),Cee=Symbol.for("effect/SchemaId/InstanceOf"),uNe=(e,t)=>jn((r)=>r instanceof e,{title:e.name,description:`an instance of ${e.name}`,pretty:()=>String,schemaId:Cee,[Cee]:{constructor:e},...t});class Cz extends rr(YC){}class sx extends rr(ZIe){}class ix extends rr(JIe){}class zp extends rr(ZC){}class To extends rr(EY){}class wz extends rr(bY){}class mE extends rr(iAe){}class kz extends rr(cAe){}class H extends rr(VA){}class Et extends rr(GA){}class St extends rr(KA){}class pNe extends rr(uAe){}var lIt=(e)=>ho.make(e.map((t)=>t.ast));function fNe(e,t=lIt(e)){return class extends rr(t){static annotations(n){return fNe(this.members,Nl(this.ast,n))}static members=[...e]}}function gt(...e){return kq(e)?fNe(e):ut(e)?e[0]:zp}var zP=(e)=>gt(e,ix),Li=(e)=>gt(e,Cz),$P=(e)=>gt(e,ix,Cz),uIt=(e)=>rr(SAe(e.ast)),wee=(e)=>new Iz(new vl(e.ast,!1),e),pIt=(e)=>new Iz(new vl(e.ast,!0),e);class Iz{ast;from;[pE];_Token;constructor(e,t){this.ast=e,this.from=t}annotations(e){return new Iz(new vl(this.ast.type,this.ast.isOptional,{...this.ast.annotations,...ox(e)}),this.from)}toString(){return`${this.ast.type}${this.ast.isOptional?"?":""}`}}var fIt=(e,t)=>new CS(e.map((r)=>so(r)?new vl(r.ast,!1):r.ast),t.map((r)=>so(r)?new ew(r.ast):r.ast),!0);function jP(e,t,r=fIt(e,t)){return class extends rr(r){static annotations(o){return jP(this.elements,this.rest,Nl(this.ast,o))}static elements=[...e];static rest=[...t]}}function ma(...e){return Array.isArray(e[0])?jP(e[0],e.slice(1)):jP(e,[])}function dNe(e,t){return class extends jP([],[e],t){static annotations(n){return dNe(this.value,Nl(this.ast,n))}static value=e}}var st=(e)=>dNe(e);function mNe(e,t){return class extends jP([e],[e],t){static annotations(n){return mNe(this.value,Nl(this.ast,n))}static value=e}}var $m=(e)=>mNe(e);function dIt(e){return Mt(gt(e,st(e)),st(Kt(En(e))),{strict:!0,decode:(t)=>uy(t),encode:(t)=>t.length===1?t[0]:t})}function mIt(e){return Mt(gt(e,$m(e)),$m(Kt(En(e))),{strict:!0,decode:(t)=>ut(t)?t:tt(t),encode:(t)=>t.length===1?t[0]:t})}var kee=(e)=>e?'"?:"':'":"';class fE extends vl{isReadonly;defaultValue;_tag="PropertySignatureDeclaration";constructor(e,t,r,n,o){super(e,t,n);this.isReadonly=r,this.defaultValue=o}toString(){let e=kee(this.isOptional),t=String(this.type);return`PropertySignature<${e}, ${t}, never, ${e}, ${t}>`}}class dE extends vl{isReadonly;fromKey;constructor(e,t,r,n,o){super(e,t,n);this.isReadonly=r,this.fromKey=o}}class jm extends vl{isReadonly;defaultValue;constructor(e,t,r,n,o){super(e,t,n);this.isReadonly=r,this.defaultValue=o}}var hIt=(e)=>{if(e===void 0)return"never";if(Jr(e))return JSON.stringify(e);return String(e)};class dd{from;to;decode;encode;_tag="PropertySignatureTransformation";constructor(e,t,r,n){this.from=e,this.to=t,this.decode=r,this.encode=n}toString(){return`PropertySignature<${kee(this.to.isOptional)}, ${this.to.type}, ${hIt(this.from.fromKey)}, ${kee(this.from.isOptional)}, ${this.from.type}>`}}var hNe=(e,t)=>{switch(e._tag){case"PropertySignatureDeclaration":return new fE(e.type,e.isOptional,e.isReadonly,{...e.annotations,...t},e.defaultValue);case"PropertySignatureTransformation":return new dd(e.from,new jm(e.to.type,e.to.isOptional,e.to.isReadonly,{...e.to.annotations,...t},e.to.defaultValue),e.decode,e.encode)}},ite=Symbol.for("effect/PropertySignature"),Az=(e)=>de(e,ite);class Oz{ast;[pE];[ite]=null;_TypeToken;_Key;_EncodedToken;_HasDefault;constructor(e){this.ast=e}pipe(){return ce(this,arguments)}annotations(e){return new Oz(hNe(this.ast,ox(e)))}toString(){return String(this.ast)}}var Vm=(e)=>new Oz(e);class JP extends Oz{from;constructor(e,t){super(e);this.from=t}annotations(e){return new JP(hNe(this.ast,ox(e)),this.from)}}var VO=(e)=>new JP(new fE(e.ast,!1,!0,{},void 0),e),lE=p(2,(e,t)=>{let r=e.ast;switch(r._tag){case"PropertySignatureDeclaration":return Vm(new fE(r.type,r.isOptional,r.isReadonly,r.annotations,t));case"PropertySignatureTransformation":return Vm(new dd(r.from,new jm(r.to.type,r.to.isOptional,r.to.isReadonly,r.to.annotations,t),r.decode,r.encode))}}),FFe=(e,t)=>be(e,{onNone:()=>_(t()),onSome:(r)=>_(r===void 0?t():r)}),pz=(e)=>vq(e,pz,(t)=>{let r=pz(t.to);if(r)return new Wa(t.from,r,t.transformation)}),gNe=p(2,(e,t)=>{let r=e.ast;switch(r._tag){case"PropertySignatureDeclaration":{let n=_n(r.type);return Vm(new dd(new dE(r.type,r.isOptional,r.isReadonly,r.annotations),new jm(pz(n)??n,!1,!0,{},r.defaultValue),(o)=>FFe(o,t),te))}case"PropertySignatureTransformation":{let n=r.to.type;return Vm(new dd(r.from,new jm(pz(n)??n,!1,r.to.isReadonly,r.to.annotations,r.to.defaultValue),(o)=>FFe(r.decode(o),t),r.encode))}}}),gIt=p(2,(e,t)=>e.pipe(gNe(t.decoding),lE(t.constructor))),xIt=p(2,(e,t)=>{let r=e.ast;switch(r._tag){case"PropertySignatureDeclaration":return Vm(new dd(new dE(r.type,r.isOptional,r.isReadonly,r.annotations,t),new jm(_n(r.type),r.isOptional,r.isReadonly,{},r.defaultValue),te,te));case"PropertySignatureTransformation":return Vm(new dd(new dE(r.from.type,r.from.isOptional,r.from.isReadonly,r.from.annotations,t),r.to,r.decode,r.encode))}}),rx=(e,t,r)=>Vm(new dd(new dE(e.ast,!0,!0,{},void 0),new jm(t.ast,!1,!0,{},void 0),(n)=>_(r.decode(n)),Qn(r.encode))),yIt=(e,t,r)=>Vm(new dd(new dE(e.ast,!1,!0,{},void 0),new jm(t.ast,!0,!0,{},void 0),Qn(r.decode),(n)=>_(r.encode(n)))),Iee=(e,t,r)=>Vm(new dd(new dE(e.ast,!0,!0,{},void 0),new jm(t.ast,!0,!0,{},void 0),r.decode,r.encode)),SIt=(e,t)=>{let r=t?.exact,n=t?.default,o=t?.nullable,s=t?.as=="Option",i=t?.onNoneEncoding?pi(t.onNoneEncoding):te;if(r)if(n)if(o)return lE(rx(zP(e),Kt(e),{decode:be({onNone:n,onSome:(a)=>a===null?n():a}),encode:_}),n).ast;else return lE(rx(e,Kt(e),{decode:be({onNone:n,onSome:te}),encode:_}),n).ast;else if(s){let a=Gee(Kt(e));if(o)return rx(zP(e),a,{decode:Vi(GN),encode:i}).ast;else return rx(e,a,{decode:te,encode:te}).ast}else if(o)return Iee(zP(e),Kt(e),{decode:Vi(GN),encode:te}).ast;else return new fE(e.ast,!0,!0,{},void 0);else if(n)if(o)return lE(rx($P(e),Kt(e),{decode:be({onNone:n,onSome:(a)=>a==null?n():a}),encode:_}),n).ast;else return lE(rx(Li(e),Kt(e),{decode:be({onNone:n,onSome:(a)=>a===void 0?n():a}),encode:_}),n).ast;else if(s){let a=Gee(Kt(e));if(o)return rx($P(e),a,{decode:Vi((c)=>c!=null),encode:i}).ast;else return rx(Li(e),a,{decode:Vi(Hk),encode:i}).ast}else if(o)return Iee($P(e),Li(Kt(e)),{decode:Vi(GN),encode:te}).ast;else return new fE(Li(e).ast,!0,!0,{},void 0)},Be=(e)=>{let t=e.ast===YC||e.ast===ZC?YC:Li(e).ast;return new JP(new fE(t,!0,!0,{},void 0),e)},Y=p((e)=>so(e[0]),(e,t)=>new JP(SIt(e,t),e)),EIt=_Y([mq]),bIt=(e,t)=>{let r=Reflect.ownKeys(e),n=[];if(r.length>0){let s=[],i=[],a=[];for(let c=0;c<r.length;c++){let l=r[c],u=e[l];if(Az(u)){let f=u.ast;switch(f._tag){case"PropertySignatureDeclaration":{let{type:h,isOptional:y,annotations:E}=f;s.push(new ro(l,h,y,!0,EIt(f))),i.push(new ro(l,_n(h),y,!0,E)),n.push(new ro(l,h,y,!0,E));break}case"PropertySignatureTransformation":{let h=f.from.fromKey??l;s.push(new ro(h,f.from.type,f.from.isOptional,!0,f.from.annotations)),i.push(new ro(l,f.to.type,f.to.isOptional,!0,f.to.annotations)),a.push(new XR(h,l,f.decode,f.encode));break}}}else s.push(new ro(l,u.ast,!1,!0)),i.push(new ro(l,_n(u.ast),!1,!0)),n.push(new ro(l,u.ast,!1,!0))}if(ut(a)){let c=[],l=[];for(let u of t){let{indexSignatures:f,propertySignatures:h}=OY(u.key.ast,u.value.ast);h.forEach((y)=>{s.push(y),i.push(new ro(y.name,_n(y.type),y.isOptional,y.isReadonly,y.annotations))}),f.forEach((y)=>{c.push(y),l.push(new wS(y.parameter,_n(y.type),y.isReadonly))})}return new Wa(new la(s,c,{[bS]:"Struct (Encoded side)"}),new la(i,l,{[bS]:"Struct (Type side)"}),new IS(a))}}let o=[];for(let s of t){let{indexSignatures:i,propertySignatures:a}=OY(s.key.ast,s.value.ast);a.forEach((c)=>n.push(c)),i.forEach((c)=>o.push(c))}return new la(n,o)},xNe=(e,t)=>{let r=Reflect.ownKeys(e);for(let n of r){let o=e[n];if(t[n]===void 0&&Az(o)){let s=o.ast,i=s._tag==="PropertySignatureDeclaration"?s.defaultValue:s.to.defaultValue;if(i!==void 0)t[n]=i()}}return t};function ate(e,t,r=bIt(e,t)){return class extends rr(r){static annotations(o){return ate(this.fields,this.records,Nl(this.ast,o))}static fields={...e};static records=[...t];static make=(o,s)=>{let i=xNe(e,{...o});return Hz(s)?i:nw(this)(i)};static pick(...o){return fe(RFe(e,...o))}static omit(...o){return fe(MFe(e,...o))}}}function fe(e,...t){return ate(e,t)}var Jc=(e)=>qe(e).pipe(VO,lE(()=>e)),QP=(e,t)=>fe({_tag:Jc(e),...t});function yNe(e,t,r){return class extends ate({},[{key:e,value:t}],r){static annotations(o){return yNe(e,t,Nl(this.ast,o))}static key=e;static value=t}}var ys=(e)=>yNe(e.key,e.value),SNe=(...e)=>(t)=>rr(Qf(t.ast,e)),CIt=(...e)=>(t)=>rr(wAe(t.ast,e)),wIt=p(2,(e,t)=>{let r=_g(_n(e.ast),t),n=rr(r.isOptional?WR(r.type):r.type);return Mt(e.pipe(SNe(t)),n,{strict:!0,decode:(s)=>s[t],encode:(s)=>r.isOptional&&s===void 0?{}:{[t]:s}})});function cte(e,t){return class extends rr(t){static annotations(n){return cte(this.from,Nl(this.ast,n))}static make=(n,o)=>Hz(o)?n:nw(this)(n);static from=e}}var kIt=(e,t)=>(r)=>{let n=be(hY(r.ast),{onNone:()=>[e],onSome:(s)=>[...s,e]}),o=tM(r.ast,ox({[iY]:n,...t}));return cte(r,o)},IIt=(e)=>rr(JC(e.ast)),AIt=p((e)=>so(e[0]),(e,t)=>rr(JC(e.ast,t))),OIt=(e)=>rr(WA(e.ast)),_It=(e)=>rr(KC(e.ast)),BP=(e,t,r)=>{if(YR(e)&&YR(t)){let n=[...e.propertySignatures];for(let o of t.propertySignatures){let s=o.name,i=n.findIndex((a)=>a.name===s);if(i===-1)n.push(o);else{let{isOptional:a,type:c}=n[i];n[i]=new ro(s,fz(c,o.type,r.concat(s)),a,!0)}}return new la(n,e.indexSignatures.concat(t.indexSignatures))}throw Error(tY(e,t,r))},vIt=kAe([jR]),WP=(e,t)=>t.map((r)=>new kS(r,e.filter,vIt(e))),fz=(e,t,r)=>ho.make(nx([e],[t],r)),Iw=(e)=>ZR(e)?e.types:[e],nx=(e,t,r)=>Ho(e,(n)=>Ho(t,(o)=>{switch(o._tag){case"Literal":{if(Jr(o.literal)&&QR(n)||li(o.literal)&&CY(n)||ji(o.literal)&&wY(n))return[o];break}case"StringKeyword":{if(o===VA){if(QR(n)||Fm(n)&&Jr(n.literal))return[n];else if(Nm(n))return WP(n,nx(Iw(n.from),[o],r))}else if(n===VA)return[o];break}case"NumberKeyword":{if(o===GA){if(CY(n)||Fm(n)&&li(n.literal))return[n];else if(Nm(n))return WP(n,nx(Iw(n.from),[o],r))}else if(n===GA)return[o];break}case"BooleanKeyword":{if(o===KA){if(wY(n)||Fm(n)&&ji(n.literal))return[n];else if(Nm(n))return WP(n,nx(Iw(n.from),[o],r))}else if(n===KA)return[o];break}case"Union":return nx(Iw(n),o.types,r);case"Suspend":return[new Yf(()=>fz(n,o.f(),r))];case"Refinement":return WP(o,nx(Iw(n),Iw(o.from),r));case"TypeLiteral":{switch(n._tag){case"Union":return nx(n.types,[o],r);case"Suspend":return[new Yf(()=>fz(n.f(),o,r))];case"Refinement":return WP(n,nx(Iw(n.from),[o],r));case"TypeLiteral":return[BP(n,o,r)];case"Transformation":{let s=n.transformation,i=BP(n.from,o,r),a=BP(n.to,_n(o),r);switch(s._tag){case"TypeLiteralTransformation":return[new Wa(i,a,new IS(s.propertySignatureTransformations))];case"ComposeTransformation":return[new Wa(i,a,_q)];case"FinalTransformation":return[new Wa(i,a,new Oq((c,l,u,f)=>ua(s.decode(c,l,u,f),(h)=>({...c,...h})),(c,l,u,f)=>ua(s.encode(c,l,u,f),(h)=>({...c,...h}))))]}}}break}case"Transformation":{if(Aq(n)){if(eM(o.transformation)&&eM(n.transformation))return[new Wa(BP(n.from,o.from,r),BP(n.to,o.to,r),new IS(o.transformation.propertySignatureTransformations.concat(n.transformation.propertySignatureTransformations)))]}else return nx([o],[n],r);break}}throw Error(tY(n,o,r))})),YP=p(2,(e,t)=>rr(fz(e.ast,t.ast,[]))),Ow=p((e)=>so(e[1]),(e,t)=>ute(e,t,TY(e.ast,t.ast))),dz=(e)=>rr(new Yf(()=>e().ast)),lte=Symbol.for("effect/SchemaId/Refine");function ENe(e,t,r){return class extends rr(r){static annotations(o){return ENe(this.from,this.filter,Nl(this.ast,o))}static[lte]=e;static from=e;static filter=t;static make=(o,s)=>Hz(s)?o:nw(this)(o)}}var NFe=(e,t,r)=>{if(ji(e))return e?R():_(new Zt(t,r));if(Jr(e))return _(new Zt(t,r,e));if(e!==void 0){if("_tag"in e)return _(e);let n=new Zt(t,r,e.message);return _(ut(e.path)?new Mi(e.path,r,n):n)}return R()},bNe=(e,t,r)=>{if(kIe(e))return NFe(e,t,r);if(ut(e)){let n=Tc(e,(o)=>NFe(o,t,r));if(ut(n))return _(n.length===1?n[0]:new ss(t,r,n))}return R()};function Jt(e,t){return(r)=>{function n(s,i,a){return bNe(e(s,i,a),a,s)}let o=new kS(r.ast,n,ox(t));return ENe(r,n,o)}}var TIt=p(2,(e,t)=>Qo(e,Kt(e),{strict:!0,decode:(r,n,o)=>_u(t(r,n,o),(s)=>be(bNe(s,o,r),{onNone:()=>cn(r),onSome:Ko})),encode:(r)=>cn(r)}));function ute(e,t,r){return class extends rr(r){static annotations(o){return ute(this.from,this.to,Nl(this.ast,o))}static from=e;static to=t}}var Qo=p((e)=>so(e[0])&&so(e[1]),(e,t,r)=>ute(e,t,new Wa(e.ast,t.ast,new Oq(r.decode,r.encode)))),Mt=p((e)=>so(e[0])&&so(e[1]),(e,t,r)=>Qo(e,t,{strict:!0,decode:(n,o,s,i)=>cn(r.decode(n,i)),encode:(n,o,s,i)=>cn(r.encode(n,i))}));function CNe(e,t){return Mt(qe(e),qe(t),{strict:!0,decode:()=>t,encode:()=>e})}function RIt(...e){return gt(...e.map(([t,r])=>CNe(t,r)))}var MIt=p((e)=>so(e[0]),(e,t,r,n)=>{let o=YP(Kt(e),fe({[t]:Yu(r)?iNe(r):qe(r)})).ast;return rr(new Wa(e.ast,n?Nl(o,n):o,new IS([new XR(t,t,()=>_(r),()=>R())])))}),PIt=p(2,(e,t)=>e.annotations(t)),DIt=p(2,(e,t)=>rr(zR(e.ast,t))),wNe=Symbol.for("effect/SchemaId/Trimmed"),kNe=(e)=>(t)=>t.pipe(Jt((r)=>r===r.trim(),{schemaId:wNe,title:"trimmed",description:"a string with no leading or trailing whitespace",jsonSchema:{pattern:"^\\S[\\s\\S]*\\S$|^\\S$|^$"},...e})),INe=IFe,pte=(e,t)=>(r)=>r.pipe(Jt((n)=>n.length<=e,{schemaId:INe,title:`maxLength(${e})`,description:`a string at most ${e} character(s) long`,jsonSchema:{maxLength:e},...t})),ANe=kFe,yo=(e,t)=>(r)=>r.pipe(Jt((n)=>n.length>=e,{schemaId:ANe,title:`minLength(${e})`,description:`a string at least ${e} character(s) long`,jsonSchema:{minLength:e},...t})),Aee=AFe,ONe=(e,t)=>(r)=>{let n=Zo(e)?Math.max(0,Math.floor(e.min)):Math.max(0,Math.floor(e)),o=Zo(e)?Math.max(n,Math.floor(e.max)):n;if(n!==o)return r.pipe(Jt((s)=>s.length>=n&&s.length<=o,{schemaId:Aee,title:`length({ min: ${n}, max: ${o})`,description:`a string at least ${n} character(s) and at most ${o} character(s) long`,jsonSchema:{minLength:n,maxLength:o},...t}));return r.pipe(Jt((s)=>s.length===n,{schemaId:Aee,title:`length(${n})`,description:n===1?"a single character":`a string ${n} character(s) long`,jsonSchema:{minLength:n,maxLength:n},...t}))},Oee=Symbol.for("effect/SchemaId/Pattern"),fte=(e,t)=>(r)=>{let n=e.source;return r.pipe(Jt((o)=>(e.lastIndex=0,e.test(o)),{schemaId:Oee,[Oee]:{regex:e},description:`a string matching the pattern ${n}`,jsonSchema:{pattern:n},...t}))},_ee=Symbol.for("effect/SchemaId/StartsWith"),FIt=(e,t)=>(r)=>{let n=JSON.stringify(e);return r.pipe(Jt((o)=>o.startsWith(e),{schemaId:_ee,[_ee]:{startsWith:e},title:`startsWith(${n})`,description:`a string starting with ${n}`,jsonSchema:{pattern:`^${e}`},...t}))},vee=Symbol.for("effect/SchemaId/EndsWith"),NIt=(e,t)=>(r)=>{let n=JSON.stringify(e);return r.pipe(Jt((o)=>o.endsWith(e),{schemaId:vee,[vee]:{endsWith:e},title:`endsWith(${n})`,description:`a string ending with ${n}`,jsonSchema:{pattern:`^.*${e}$`},...t}))},Tee=Symbol.for("effect/SchemaId/Includes"),LIt=(e,t)=>(r)=>{let n=JSON.stringify(e);return r.pipe(Jt((o)=>o.includes(e),{schemaId:Tee,[Tee]:{includes:e},title:`includes(${n})`,description:`a string including ${n}`,jsonSchema:{pattern:`.*${e}.*`},...t}))},_Ne=Symbol.for("effect/SchemaId/Lowercased"),vNe=(e)=>(t)=>t.pipe(Jt((r)=>r===r.toLowerCase(),{schemaId:_Ne,title:"lowercased",description:"a lowercase string",jsonSchema:{pattern:"^[^A-Z]*$"},...e}));class dte extends H.pipe(vNe({identifier:"Lowercased"})){}var TNe=Symbol.for("effect/SchemaId/Uppercased"),RNe=(e)=>(t)=>t.pipe(Jt((r)=>r===r.toUpperCase(),{schemaId:TNe,title:"uppercased",description:"an uppercase string",jsonSchema:{pattern:"^[^a-z]*$"},...e}));class mte extends H.pipe(RNe({identifier:"Uppercased"})){}var MNe=Symbol.for("effect/SchemaId/Capitalized"),PNe=(e)=>(t)=>t.pipe(Jt((r)=>r[0]?.toUpperCase()===r[0],{schemaId:MNe,title:"capitalized",description:"a capitalized string",jsonSchema:{pattern:"^[^a-z]?.*$"},...e}));class hte extends H.pipe(PNe({identifier:"Capitalized"})){}var DNe=Symbol.for("effect/SchemaId/Uncapitalized"),FNe=(e)=>(t)=>t.pipe(Jt((r)=>r[0]?.toLowerCase()===r[0],{schemaId:DNe,title:"uncapitalized",description:"a uncapitalized string",jsonSchema:{pattern:"^[^A-Z]?.*$"},...e}));class gte extends H.pipe(FNe({identifier:"Uncapitalized"})){}class NNe extends H.pipe(ONe(1,{identifier:"Char"})){}var xte=(e)=>yo(1,{title:"nonEmptyString",description:"a non empty string",...e});class LNe extends Mt(H.annotations({description:"a string that will be converted to lowercase"}),dte,{strict:!0,decode:(e)=>e.toLowerCase(),encode:te}).annotations({identifier:"Lowercase"}){}class UNe extends Mt(H.annotations({description:"a string that will be converted to uppercase"}),mte,{strict:!0,decode:(e)=>e.toUpperCase(),encode:te}).annotations({identifier:"Uppercase"}){}class HNe extends Mt(H.annotations({description:"a string that will be converted to a capitalized format"}),hte,{strict:!0,decode:(e)=>iQ(e),encode:te}).annotations({identifier:"Capitalize"}){}class qNe extends Mt(H.annotations({description:"a string that will be converted to an uncapitalized format"}),gte,{strict:!0,decode:(e)=>aQ(e),encode:te}).annotations({identifier:"Uncapitalize"}){}class _z extends H.pipe(kNe({identifier:"Trimmed"})){}class yte extends _z.pipe(xte({identifier:"NonEmptyTrimmedString"})){}class BNe extends Mt(H.annotations({description:"a string that will be trimmed"}),_z,{strict:!0,decode:(e)=>e.trim(),encode:te}).annotations({identifier:"Trim"}){}var UIt=(e)=>Mt(H.annotations({description:"a string that will be split"}),st(H),{strict:!0,decode:(t)=>t.split(e),encode:(t)=>t.join(e)}),Ree=(e)=>e instanceof Error?e.message:String(e),HIt=(e)=>Qo(H.annotations({description:"a string to be decoded into JSON"}),To,{strict:!0,decode:(t,r,n)=>eO({try:()=>JSON.parse(t,e?.reviver),catch:(o)=>new Zt(n,t,Ree(o))}),encode:(t,r,n)=>eO({try:()=>JSON.stringify(t,e?.replacer,e?.space),catch:(o)=>new Zt(n,t,Ree(o))})}).annotations({title:"parseJson",schemaId:Eq}),vz=(e,t)=>so(e)?Ow(vz(t),e):HIt(e);class WNe extends H.pipe(xte({identifier:"NonEmptyString"})){}var zNe=Symbol.for("effect/SchemaId/UUID"),LFe=/^[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 $Ne extends H.pipe(fte(LFe,{schemaId:zNe,identifier:"UUID",jsonSchema:{format:"uuid",pattern:LFe.source},description:"a Universally Unique Identifier",arbitrary:()=>(e)=>e.uuid()})){}var jNe=Symbol.for("effect/SchemaId/ULID"),qIt=/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i;class VNe extends H.pipe(fte(qIt,{schemaId:jNe,identifier:"ULID",description:"a Universally Unique Lexicographically Sortable Identifier",arbitrary:()=>(e)=>e.ulid()})){}class Ste extends uNe(URL,{typeConstructor:{_tag:"URL"},identifier:"URLFromSelf",arbitrary:()=>(e)=>e.webUrl().map((t)=>new URL(t)),pretty:()=>(e)=>e.toString()}){}class GNe extends Qo(H.annotations({description:"a string to be decoded into a URL"}),Ste,{strict:!0,decode:(e,t,r)=>eO({try:()=>new URL(e),catch:(n)=>new Zt(r,e,`Unable to decode ${JSON.stringify(e)} into a URL. ${Ree(n)}`)}),encode:(e)=>cn(e.toString())}).annotations({identifier:"URL",pretty:()=>(e)=>e.toString()}){}var KNe=gFe,Ete=(e)=>(t)=>t.pipe(Jt(Number.isFinite,{schemaId:KNe,title:"finite",description:"a finite number",jsonSchema:{},...e})),JNe=pFe,QNe=(e,t)=>(r)=>r.pipe(Jt((n)=>n>e,{schemaId:JNe,title:`greaterThan(${e})`,description:e===0?"a positive number":`a number greater than ${e}`,jsonSchema:{exclusiveMinimum:e},...t})),YNe=fFe,Ui=(e,t)=>(r)=>r.pipe(Jt((n)=>n>=e,{schemaId:YNe,title:`greaterThanOrEqualTo(${e})`,description:e===0?"a non-negative number":`a number greater than or equal to ${e}`,jsonSchema:{minimum:e},...t})),ZNe=Symbol.for("effect/SchemaId/MultipleOf"),BIt=(e,t)=>(r)=>{let n=Math.abs(e);return r.pipe(Jt((o)=>kme(o,e)===0,{schemaId:ZNe,title:`multipleOf(${n})`,description:`a number divisible by ${n}`,jsonSchema:{multipleOf:n},...t}))},XNe=uz,ZP=(e)=>(t)=>t.pipe(Jt((r)=>Number.isSafeInteger(r),{schemaId:XNe,title:"int",description:"an integer",jsonSchema:{type:"integer"},...e})),eLe=dFe,tLe=(e,t)=>(r)=>r.pipe(Jt((n)=>n<e,{schemaId:eLe,title:`lessThan(${e})`,description:e===0?"a negative number":`a number less than ${e}`,jsonSchema:{exclusiveMaximum:e},...t})),rLe=mFe,Km=(e,t)=>(r)=>r.pipe(Jt((n)=>n<=e,{schemaId:rLe,title:`lessThanOrEqualTo(${e})`,description:e===0?"a non-positive number":`a number less than or equal to ${e}`,jsonSchema:{maximum:e},...t})),nLe=yFe,hE=(e,t,r)=>(n)=>n.pipe(Jt((o)=>o>=e&&o<=t,{schemaId:nLe,title:`between(${e}, ${t})`,description:`a number between ${e} and ${t}`,jsonSchema:{minimum:e,maximum:t},...r})),oLe=hFe,sLe=(e)=>(t)=>t.pipe(Jt((r)=>!Number.isNaN(r),{schemaId:oLe,title:"nonNaN",description:"a number excluding NaN",...e})),iLe=(e)=>QNe(0,{title:"positive",...e}),aLe=(e)=>tLe(0,{title:"negative",...e}),cLe=(e)=>Km(0,{title:"nonPositive",...e}),lLe=(e)=>Ui(0,{title:"nonNegative",...e}),WIt=(e,t)=>(r)=>Mt(r,Kt(r).pipe(hE(e,t)),{strict:!1,decode:(n)=>Cme(n,{minimum:e,maximum:t}),encode:te});function uLe(e){return Qo(e,Et,{strict:!1,decode:(t,r,n)=>iM(Ame(t),()=>new Zt(n,t,`Unable to decode ${JSON.stringify(t)} into a number`)),encode:(t)=>cn(String(t))})}class ax extends uLe(H.annotations({description:"a string to be decoded into a number"})).annotations({identifier:"NumberFromString"}){}class pLe extends Et.pipe(Ete({identifier:"Finite"})){}class Ja extends Et.pipe(ZP({identifier:"Int"})){}class fLe extends Et.pipe(sLe({identifier:"NonNaN"})){}class dLe extends Et.pipe(iLe({identifier:"Positive"})){}class mLe extends Et.pipe(aLe({identifier:"Negative"})){}class hLe extends Et.pipe(cLe({identifier:"NonPositive"})){}class Tz extends Et.pipe(lLe({identifier:"NonNegative"})){}var gLe=xFe;class xLe extends Et.pipe(Ete({schemaId:gLe,identifier:"JsonNumber"})){}class yLe extends Mt(St.annotations({description:"a boolean that will be negated"}),St,{strict:!0,decode:(e)=>i0(e),encode:(e)=>i0(e)}){}var SLe=(e,t)=>{let r=Symbol.keyFor(e);return r===void 0?Ko(new Zt(t,e,`Unable to encode a unique symbol ${String(e)} into a string`)):cn(r)},ELe=(e)=>cn(Symbol.for(e));class bLe extends Qo(H.annotations({description:"a string to be decoded into a globally shared symbol"}),kz,{strict:!1,decode:(e)=>ELe(e),encode:(e,t,r)=>SLe(e,r)}).annotations({identifier:"Symbol"}){}var Mee=SFe,CLe=(e,t)=>(r)=>r.pipe(Jt((n)=>n>e,{schemaId:Mee,[Mee]:{min:e},title:`greaterThanBigInt(${e})`,description:e===0n?"a positive bigint":`a bigint greater than ${e}n`,...t})),Pee=EFe,wLe=(e,t)=>(r)=>r.pipe(Jt((n)=>n>=e,{schemaId:Pee,[Pee]:{min:e},title:`greaterThanOrEqualToBigInt(${e})`,description:e===0n?"a non-negative bigint":`a bigint greater than or equal to ${e}n`,...t})),Dee=bFe,kLe=(e,t)=>(r)=>r.pipe(Jt((n)=>n<e,{schemaId:Dee,[Dee]:{max:e},title:`lessThanBigInt(${e})`,description:e===0n?"a negative bigint":`a bigint less than ${e}n`,...t})),Fee=CFe,ILe=(e,t)=>(r)=>r.pipe(Jt((n)=>n<=e,{schemaId:Fee,[Fee]:{max:e},title:`lessThanOrEqualToBigInt(${e})`,description:e===0n?"a non-positive bigint":`a bigint less than or equal to ${e}n`,...t})),Nee=wFe,bte=(e,t,r)=>(n)=>n.pipe(Jt((o)=>o>=e&&o<=t,{schemaId:Nee,[Nee]:{min:e,max:t},title:`betweenBigInt(${e}, ${t})`,description:`a bigint between ${e}n and ${t}n`,...r})),Cte=(e)=>CLe(0n,{title:"positiveBigInt",...e}),wte=(e)=>kLe(0n,{title:"negativeBigInt",...e}),kte=(e)=>wLe(0n,{title:"nonNegativeBigInt",...e}),Ite=(e)=>ILe(0n,{title:"nonPositiveBigInt",...e}),zIt=(e,t)=>(r)=>Mt(r,r.pipe(Kt,bte(e,t)),{strict:!1,decode:(n)=>vPe(n,{minimum:e,maximum:t}),encode:te});class _w extends Qo(H.annotations({description:"a string to be decoded into a bigint"}),mE,{strict:!0,decode:(e,t,r)=>iM(RPe(e),()=>new Zt(r,e,`Unable to decode ${JSON.stringify(e)} into a bigint`)),encode:(e)=>cn(String(e))}).annotations({identifier:"BigInt"}){}var $It=mE.pipe(Cte({identifier:"PositiveBigintFromSelf"})),jIt=_w.pipe(Cte({identifier:"PositiveBigint"})),VIt=mE.pipe(wte({identifier:"NegativeBigintFromSelf"})),GIt=_w.pipe(wte({identifier:"NegativeBigint"})),KIt=mE.pipe(Ite({identifier:"NonPositiveBigintFromSelf"})),JIt=_w.pipe(Ite({identifier:"NonPositiveBigint"})),ALe=mE.pipe(kte({identifier:"NonNegativeBigintFromSelf"})),QIt=_w.pipe(kte({identifier:"NonNegativeBigint"}));class OLe extends Qo(Et.annotations({description:"a number to be decoded into a bigint"}),mE.pipe(bte(BigInt(Number.MIN_SAFE_INTEGER),BigInt(Number.MAX_SAFE_INTEGER))),{strict:!0,decode:(e,t,r)=>iM(MPe(e),()=>new Zt(r,e,`Unable to decode ${e} into a bigint`)),encode:(e,t,r)=>iM(TPe(e),()=>new Zt(r,e,`Unable to encode ${e}n into a number`))}).annotations({identifier:"BigIntFromNumber"}){}var YIt=(e)=>(t)=>e(t).map(Ru),Sc=(e,t,r,n)=>TAe(e,{onFailure:(o)=>new ss(r,n,o),onSuccess:t}),UFe=(e)=>(t,r,n)=>yee(t)?Sc(e(cE(t),r),Ru,n,t):Ko(new Zt(n,t)),_Le=(e)=>jn([e],{decode:(t)=>UFe(gs(t)),encode:(t)=>UFe(Us(t))},{typeConstructor:{_tag:"effect/Redacted"},description:"Redacted(<redacted>)",pretty:()=>()=>"Redacted(<redacted>)",arbitrary:YIt,equivalence:See});function ZIt(e){return Mt(e,_Le(Kt(En(e))),{strict:!0,decode:(t)=>Ru(t),encode:(t)=>cE(t)})}class XP extends jn(cT,{typeConstructor:{_tag:"effect/Duration"},identifier:"DurationFromSelf",pretty:()=>String,arbitrary:()=>(e)=>e.oneof(e.constant(_b),e.bigInt({min:0n}).map((t)=>Af(t)),e.maxSafeNat().map((t)=>Bo(t))),equivalence:()=>GL}){}class vLe extends Qo(ALe.annotations({description:"a bigint to be decoded into a Duration"}),XP.pipe(Jt((e)=>Xd(e),{description:"a finite duration"})),{strict:!0,decode:(e)=>cn(Af(e)),encode:(e,t,r)=>be(Y4(e),{onNone:()=>Ko(new Zt(r,e,`Unable to encode ${e} into a bigint`)),onSome:(n)=>cn(n)})}).annotations({identifier:"DurationFromNanos"}){}var mz=Tz.pipe(ZP()).annotations({identifier:"NonNegativeInt"});class TLe extends Mt(Tz.annotations({description:"a non-negative number to be decoded into a Duration"}),XP,{strict:!0,decode:(e)=>Bo(e),encode:(e)=>ds(e)}).annotations({identifier:"DurationFromMillis"}){}var RLe=QP("Millis",{millis:mz}),MLe=QP("Nanos",{nanos:_w}),PLe=QP("Infinity",{}),XIt=PLe.make({}),eAt=gt(RLe,MLe,PLe).annotations({identifier:"DurationValue",description:"an JSON-compatible tagged union to be decoded into a Duration"}),tAt=ma(wee(mz).annotations({title:"seconds"}),wee(mz).annotations({title:"nanos"})).annotations({identifier:"FiniteHRTime"}),rAt=ma(qe(-1),qe(0)).annotations({identifier:"InfiniteHRTime"}),nAt=gt(tAt,rAt).annotations({identifier:"HRTime",description:"a tuple of seconds and nanos to be decoded into a Duration"}),oAt=(e)=>typeof e==="object";class DLe extends Mt(gt(eAt,nAt),XP,{strict:!0,decode:(e)=>{if(oAt(e))switch(e._tag){case"Millis":return Bo(e.millis);case"Nanos":return Af(e.nanos);case"Infinity":return _b}let[t,r]=e;return t===-1?_b:Af(BigInt(t)*BigInt(1e9)+BigInt(r))},encode:(e)=>{switch(e.value._tag){case"Millis":return RLe.make({millis:e.value.millis});case"Nanos":return MLe.make({nanos:e.value.nanos});case"Infinity":return XIt}}}).annotations({identifier:"Duration"}){}var sAt=(e,t)=>(r)=>Mt(r,r.pipe(Kt,FLe(e,t)),{strict:!1,decode:(n)=>X4(n,{minimum:e,maximum:t}),encode:te}),VP=Symbol.for("effect/SchemaId/LessThanDuration"),iAt=(e,t)=>(r)=>r.pipe(Jt((n)=>KL(n,e),{schemaId:VP,[VP]:{max:e},title:`lessThanDuration(${e})`,description:`a Duration less than ${ur(e)}`,...t})),aAt=Symbol.for("effect/schema/LessThanOrEqualToDuration"),cAt=(e,t)=>(r)=>r.pipe(Jt((n)=>uT(n,e),{schemaId:VP,[VP]:{max:e},title:`lessThanOrEqualToDuration(${e})`,description:`a Duration less than or equal to ${ur(e)}`,...t})),Lee=Symbol.for("effect/SchemaId/GreaterThanDuration"),lAt=(e,t)=>(r)=>r.pipe(Jt((n)=>pT(n,e),{schemaId:Lee,[Lee]:{min:e},title:`greaterThanDuration(${e})`,description:`a Duration greater than ${ur(e)}`,...t})),Uee=Symbol.for("effect/schema/GreaterThanOrEqualToDuration"),uAt=(e,t)=>(r)=>r.pipe(Jt((n)=>uI(n,e),{schemaId:Uee,[Uee]:{min:e},title:`greaterThanOrEqualToDuration(${e})`,description:`a Duration greater than or equal to ${ur(e)}`,...t})),Hee=Symbol.for("effect/SchemaId/BetweenDuration"),FLe=(e,t,r)=>(n)=>n.pipe(Jt((o)=>Z4(o,{minimum:e,maximum:t}),{schemaId:Hee,[Hee]:{maximum:t,minimum:e},title:`betweenDuration(${e}, ${t})`,description:`a Duration between ${ur(e)} and ${ur(t)}`,...r}));class Rz extends jn(jle,{typeConstructor:{_tag:"Uint8Array"},identifier:"Uint8ArrayFromSelf",pretty:()=>(e)=>`new Uint8Array(${JSON.stringify(Array.from(e))})`,arbitrary:()=>(e)=>e.uint8Array(),equivalence:()=>Ji(ge)}){}class Ate extends Et.pipe(hE(0,255,{identifier:"Uint8",description:"a 8-bit unsigned integer"})){}class NLe extends Mt(st(Ate).annotations({description:"an array of 8-bit unsigned integers to be decoded into a Uint8Array"}),Rz,{strict:!0,decode:(e)=>Uint8Array.from(e),encode:(e)=>Array.from(e)}).annotations({identifier:"Uint8Array"}){}var Ote=(e,t,r)=>Qo(H.annotations({description:"a string to be decoded into a Uint8Array"}),Rz,{strict:!0,decode:(n,o,s)=>pl(t(n),(i)=>new Zt(s,n,i.message)),encode:(n)=>cn(r(n))}).annotations({identifier:e}),eD=Ote("Uint8ArrayFromBase64",nee,ree),pAt=Ote("Uint8ArrayFromBase64Url",see,oee),fAt=Ote("Uint8ArrayFromHex",aee,iee),_te=(e,t,r)=>Qo(H.annotations({description:`A string that is interpreted as being ${e}-encoded and will be decoded into a UTF-8 string`}),H,{strict:!0,decode:(n,o,s)=>pl(t(n),(i)=>new Zt(s,n,i.message)),encode:(n)=>cn(r(n))}).annotations({identifier:`StringFrom${e}`}),dAt=_te("Base64",CDe,ree),mAt=_te("Base64Url",wDe,oee),hAt=_te("Hex",kDe,iee),gAt=Qo(H.annotations({description:"A string that is interpreted as being UriComponent-encoded and will be decoded into a UTF-8 string"}),H,{strict:!0,decode:(e,t,r)=>pl(ADe(e),(n)=>new Zt(r,e,n.message)),encode:(e,t,r)=>pl(IDe(e),(n)=>new Zt(r,e,n.message))}).annotations({identifier:"StringFromUriComponent"}),LLe=OFe,xAt=(e,t)=>(r)=>{let n=Math.floor(e);if(n<1)throw Error(fq(`Expected an integer greater than or equal to 1, actual ${e}`));return r.pipe(Jt((o)=>o.length>=n,{schemaId:LLe,title:`minItems(${n})`,description:`an array of at least ${n} item(s)`,jsonSchema:{minItems:n},[GR]:!0,...t}))},ULe=_Fe,yAt=(e,t)=>(r)=>{let n=Math.floor(e);if(n<1)throw Error(fq(`Expected an integer greater than or equal to 1, actual ${e}`));return r.pipe(Jt((o)=>o.length<=n,{schemaId:ULe,title:`maxItems(${n})`,description:`an array of at most ${n} item(s)`,jsonSchema:{maxItems:n},[GR]:!0,...t}))},HLe=vFe,qLe=(e,t)=>(r)=>{let n=Math.floor(e);if(n<0)throw Error(fq(`Expected an integer greater than or equal to 0, actual ${e}`));return r.pipe(Jt((o)=>o.length===n,{schemaId:HLe,title:`itemsCount(${n})`,description:`an array of exactly ${n} item(s)`,jsonSchema:{minItems:n,maxItems:n},[GR]:!0,...t}))},Mz=(e)=>rr(BR(e.ast));function SAt(e){return Mt(e,vw(Mz(Kt(e))),{strict:!1,decode:(t)=>Ki(t),encode:(t)=>be(t,{onNone:()=>[],onSome:tt})})}function EAt(e){return Mt(e,Mz(Kt(e)),{strict:!1,decode:(t)=>jr(t),encode:(t)=>tt(t)})}var bAt=p((e)=>so(e[0]),(e,t)=>Qo(e,Mz(Kt(e)),{strict:!0,decode:(r,n,o)=>r.length>0?cn(r[0]):t?cn(t()):Ko(new Zt(o,r,"Unable to retrieve the first element of an empty array")),encode:(r)=>cn(tt(r))})),qee=Symbol.for("effect/SchemaId/ValidDate"),vte=(e)=>(t)=>t.pipe(Jt((r)=>!Number.isNaN(r.getTime()),{schemaId:qee,[qee]:{noInvalidDate:!0},title:"validDate",description:"a valid Date",...e})),Bee=Symbol.for("effect/SchemaId/LessThanDate"),CAt=(e,t)=>(r)=>r.pipe(Jt((n)=>n<e,{schemaId:Bee,[Bee]:{max:e},title:`lessThanDate(${rc(e)})`,description:`a date before ${rc(e)}`,...t})),Wee=Symbol.for("effect/schema/LessThanOrEqualToDate"),wAt=(e,t)=>(r)=>r.pipe(Jt((n)=>n<=e,{schemaId:Wee,[Wee]:{max:e},title:`lessThanOrEqualToDate(${rc(e)})`,description:`a date before or equal to ${rc(e)}`,...t})),zee=Symbol.for("effect/SchemaId/GreaterThanDate"),kAt=(e,t)=>(r)=>r.pipe(Jt((n)=>n>e,{schemaId:zee,[zee]:{min:e},title:`greaterThanDate(${rc(e)})`,description:`a date after ${rc(e)}`,...t})),$ee=Symbol.for("effect/schema/GreaterThanOrEqualToDate"),IAt=(e,t)=>(r)=>r.pipe(Jt((n)=>n>=e,{schemaId:$ee,[$ee]:{min:e},title:`greaterThanOrEqualToDate(${rc(e)})`,description:`a date after or equal to ${rc(e)}`,...t})),jee=Symbol.for("effect/SchemaId/BetweenDate"),AAt=(e,t,r)=>(n)=>n.pipe(Jt((o)=>o<=t&&o>=e,{schemaId:jee,[jee]:{max:t,min:e},title:`betweenDate(${rc(e)}, ${rc(t)})`,description:`a date between ${rc(e)} and ${rc(t)}`,...r})),Vee=uFe;class KO extends jn(Bk,{typeConstructor:{_tag:"Date"},identifier:"DateFromSelf",schemaId:Vee,[Vee]:{noInvalidDate:!1},description:"a potentially invalid Date instance",pretty:()=>(e)=>`new Date(${JSON.stringify(e)})`,arbitrary:()=>(e)=>e.date({noInvalidDate:!1}),equivalence:()=>Lle}){}class BLe extends KO.pipe(vte({identifier:"ValidDateFromSelf",description:"a valid Date instance"})){}class Tte extends Mt(H.annotations({description:"a string to be decoded into a Date"}),KO,{strict:!0,decode:(e)=>new Date(e),encode:(e)=>rc(e)}).annotations({identifier:"DateFromString"}){}class Pz extends Tte.pipe(vte({identifier:"Date"})){}class WLe extends Mt(Et.annotations({description:"a number to be decoded into a Date"}),KO,{strict:!0,decode:(e)=>new Date(e),encode:(e)=>e.getTime()}).annotations({identifier:"DateFromNumber"}){}class tD extends jn((e)=>XW(e)&&UX(e),{typeConstructor:{_tag:"effect/DateTime.Utc"},identifier:"DateTimeUtcFromSelf",description:"a DateTime.Utc instance",pretty:()=>(e)=>e.toString(),arbitrary:()=>(e)=>e.date({noInvalidDate:!0}).map((t)=>qX(t)),equivalence:()=>ez}){}var Rte=(e,t)=>eO({try:()=>BX(e),catch:()=>new Zt(t,e,`Unable to decode ${Uo(e)} into a DateTime.Utc`)});class zLe extends Qo(Et.annotations({description:"a number to be decoded into a DateTime.Utc"}),tD,{strict:!0,decode:(e,t,r)=>Rte(e,r),encode:(e)=>cn(KX(e))}).annotations({identifier:"DateTimeUtcFromNumber"}){}class $Le extends Qo(KO.annotations({description:"a Date to be decoded into a DateTime.Utc"}),tD,{strict:!0,decode:(e,t,r)=>Rte(e,r),encode:(e)=>cn(GX(e))}).annotations({identifier:"DateTimeUtcFromDate"}){}class jLe extends Qo(H.annotations({description:"a string to be decoded into a DateTime.Utc"}),tD,{strict:!0,decode:(e,t,r)=>Rte(e,r),encode:(e)=>cn(JX(e))}).annotations({identifier:"DateTimeUtc"}){}var VLe=()=>(e)=>e.integer({min:-43200000,max:50400000}).map(NP);class Dz extends jn(NX,{typeConstructor:{_tag:"effect/DateTime.TimeZone.Offset"},identifier:"TimeZoneOffsetFromSelf",description:"a TimeZone.Offset instance",pretty:()=>(e)=>e.toString(),arbitrary:VLe}){}class GLe extends Mt(Et.annotations({description:"a number to be decoded into a TimeZone.Offset"}),Dz,{strict:!0,decode:(e)=>NP(e),encode:(e)=>e.offset}).annotations({identifier:"TimeZoneOffset"}){}var KLe=()=>(e)=>e.constantFrom(...Intl.supportedValuesOf("timeZone")).map(tz);class Fz extends jn(LX,{typeConstructor:{_tag:"effect/DateTime.TimeZone.Named"},identifier:"TimeZoneNamedFromSelf",description:"a TimeZone.Named instance",pretty:()=>(e)=>e.toString(),arbitrary:KLe}){}class JLe extends Qo(H.annotations({description:"a string to be decoded into a TimeZone.Named"}),Fz,{strict:!0,decode:(e,t,r)=>eO({try:()=>tz(e),catch:()=>new Zt(r,e,`Unable to decode ${JSON.stringify(e)} into a TimeZone.Named`)}),encode:(e)=>cn(e.id)}).annotations({identifier:"TimeZoneNamed"}){}class Mte extends gt(Dz,Fz){}class QLe extends Qo(H.annotations({description:"a string to be decoded into a TimeZone"}),Mte,{strict:!0,decode:(e,t,r)=>be(jX(e),{onNone:()=>Ko(new Zt(r,e,`Unable to decode ${JSON.stringify(e)} into a TimeZone`)),onSome:cn}),encode:(e)=>cn(VX(e))}).annotations({identifier:"TimeZone"}){}var OAt=(e)=>e.oneof(VLe()(e),KLe()(e));class Pte extends jn((e)=>XW(e)&&HX(e),{typeConstructor:{_tag:"effect/DateTime.Zoned"},identifier:"DateTimeZonedFromSelf",description:"a DateTime.Zoned instance",pretty:()=>(e)=>e.toString(),arbitrary:()=>(e)=>e.tuple(e.integer({min:-31536000000000,max:31536000000000}),OAt(e)).map(([t,r])=>WX(t,{timeZone:r})),equivalence:()=>ez}){}class YLe extends Qo(H.annotations({description:"a string to be decoded into a DateTime.Zoned"}),Pte,{strict:!0,decode:(e,t,r)=>be(zX(e),{onNone:()=>Ko(new Zt(r,e,`Unable to decode ${JSON.stringify(e)} into a DateTime.Zoned`)),onSome:cn}),encode:(e)=>cn(QX(e))}).annotations({identifier:"DateTimeZoned"}){}var _At=fe({_tag:qe("None")}).annotations({description:"NoneEncoded"}),vAt=(e)=>fe({_tag:qe("Some"),value:e}).annotations({description:`SomeEncoded<${$n(e)}>`}),TAt=(e)=>gt(_At,vAt(e)).annotations({description:`OptionEncoded<${$n(e)}>`}),ZLe=(e)=>e._tag==="None"?R():_(e.value),RAt=(e,t)=>(r)=>r.oneof(t,r.record({_tag:r.constant("None")}),r.record({_tag:r.constant("Some"),value:e(r)})).map(ZLe),MAt=(e)=>be({onNone:()=>"none()",onSome:(t)=>`some(${e(t)})`}),HFe=(e)=>(t,r,n)=>Lh(t)?vt(t)?cn(R()):Sc(e(t.value,r),_,n,t):Ko(new Zt(n,t)),Gee=(e)=>jn([e],{decode:(t)=>HFe(gs(t)),encode:(t)=>HFe(Us(t))},{typeConstructor:{_tag:"effect/Option"},pretty:MAt,arbitrary:RAt,equivalence:d4}),vw=(e)=>Gee(e).annotations({description:`Option<${$n(e)}>`}),PAt={_tag:"None"},DAt=(e)=>({_tag:"Some",value:e});function Dte(e){let t=En(e);return Mt(TAt(t),vw(Kt(t)),{strict:!0,decode:(n)=>ZLe(n),encode:(n)=>be(n,{onNone:()=>PAt,onSome:DAt})})}function FAt(e){return Mt(zP(e),vw(Kt(En(e))),{strict:!0,decode:(t)=>Ft(t),encode:(t)=>pL(t)})}function NAt(e,t){return Mt($P(e),vw(Kt(En(e))),{strict:!0,decode:(r)=>Ft(r),encode:t===null?(r)=>pL(r):(r)=>Ar(r)})}function LAt(e){return Mt(Li(e),vw(Kt(En(e))),{strict:!0,decode:(t)=>Ft(t),encode:(t)=>Ar(t)})}class XLe extends Mt(H,vw(yte),{strict:!0,decode:(e)=>Vi(_(e.trim()),HH),encode:(e)=>Je(e,()=>"")}){}var e1e=(e)=>fe({_tag:qe("Right"),right:e}).annotations({description:`RightEncoded<${$n(e)}>`}),t1e=(e)=>fe({_tag:qe("Left"),left:e}).annotations({description:`LeftEncoded<${$n(e)}>`}),UAt=(e,t)=>gt(e1e(e),t1e(t)).annotations({description:`EitherEncoded<${$n(t)}, ${$n(e)}>`}),r1e=(e)=>e._tag==="Left"?Ie(e.left):ye(e.right),HAt=(e,t)=>(r)=>r.oneof(r.record({_tag:r.constant("Left"),left:t(r)}),r.record({_tag:r.constant("Right"),right:e(r)})).map(r1e),qAt=(e,t)=>Ir({onLeft:(r)=>`left(${t(r)})`,onRight:(r)=>`right(${e(r)})`}),qFe=(e,t)=>(r,n,o)=>Bd(r)?Ir(r,{onLeft:(s)=>Sc(t(s,n),Ie,o,r),onRight:(s)=>Sc(e(s,n),ye,o,r)}):Ko(new Zt(o,r)),Fte=({left:e,right:t})=>jn([t,e],{decode:(r,n)=>qFe(gs(r),gs(n)),encode:(r,n)=>qFe(Us(r),Us(n))},{typeConstructor:{_tag:"effect/Either"},description:`Either<${$n(t)}, ${$n(e)}>`,pretty:qAt,arbitrary:HAt,equivalence:(r,n)=>o4({left:n,right:r})}),Kee=(e)=>({_tag:"Left",left:e}),Jee=(e)=>({_tag:"Right",right:e}),BAt=({left:e,right:t})=>{let r=En(t),n=En(e);return Mt(UAt(r,n),Fte({left:Kt(n),right:Kt(r)}),{strict:!0,decode:(s)=>r1e(s),encode:(s)=>Ir(s,{onLeft:Kee,onRight:Jee})})},WAt=({left:e,right:t})=>{let r=En(t),n=En(e),o=Kt(r),s=Kt(n),i=Mt(r,e1e(o),{strict:!0,decode:(l)=>Jee(l),encode:(l)=>l.right}),a=Mt(n,t1e(s),{strict:!0,decode:(l)=>Kee(l),encode:(l)=>l.left});return Mt(gt(i,a),Fte({left:s,right:o}),{strict:!0,decode:(l)=>l._tag==="Left"?Ie(l.left):ye(l.right),encode:(l)=>Ir(l,{onLeft:Kee,onRight:Jee})})},zAt=(e,t,r)=>(n)=>{let o=n.array(n.tuple(e(n),t(n)));return(r.depthIdentifier!==void 0?n.oneof(r,n.constant([]),o):o).map((s)=>new Map(s))},$At=(e,t)=>(r)=>`new Map([${Array.from(r.entries()).map(([n,o])=>`[${e(n)}, ${t(o)}]`).join(", ")}])`,jAt=(e,t)=>{let r=Ji(No(([n,o],[s,i])=>e(n,s)&&t(o,i)));return No((n,o)=>r(Array.from(n.entries()),Array.from(o.entries())))},BFe=(e)=>(t,r,n)=>Ble(t)?Sc(e(Array.from(t.entries()),r),(o)=>new Map(o),n,t):Ko(new Zt(n,t)),n1e=(e,t,r)=>jn([e,t],{decode:(n,o)=>BFe(gs(st(ma(n,o)))),encode:(n,o)=>BFe(Us(st(ma(n,o))))},{typeConstructor:{_tag:"ReadonlyMap"},description:r,pretty:$At,arbitrary:zAt,equivalence:jAt}),Nte=({key:e,value:t})=>n1e(e,t,`ReadonlyMap<${$n(e)}, ${$n(t)}>`),Lte=({key:e,value:t})=>n1e(e,t,`Map<${$n(e)}, ${$n(t)}>`);function VAt({key:e,value:t}){return Mt(st(ma(e,t)),Nte({key:Kt(En(e)),value:Kt(En(t))}),{strict:!0,decode:(r)=>new Map(r),encode:(r)=>Array.from(r.entries())})}function GAt({key:e,value:t}){return Mt(st(ma(e,t)),Lte({key:Kt(En(e)),value:Kt(En(t))}),{strict:!0,decode:(r)=>new Map(r),encode:(r)=>Array.from(r.entries())})}var KAt=({key:e,value:t})=>Mt(ys({key:nte(e),value:t}).annotations({description:"a record to be decoded into a ReadonlyMap"}),Nte({key:e,value:Kt(t)}),{strict:!0,decode:(r)=>new Map(Object.entries(r)),encode:(r)=>Object.fromEntries(r)}),JAt=({key:e,value:t})=>Mt(ys({key:nte(e),value:t}).annotations({description:"a record to be decoded into a Map"}),Lte({key:e,value:Kt(t)}),{strict:!0,decode:(r)=>new Map(Object.entries(r)),encode:(r)=>Object.fromEntries(r)}),QAt=(e,t)=>(r)=>{let n=r.array(e(r));return(t.depthIdentifier!==void 0?r.oneof(t,r.constant([]),n):n).map((o)=>new Set(o))},YAt=(e)=>(t)=>`new Set([${Array.from(t.values()).map((r)=>e(r)).join(", ")}])`,ZAt=(e)=>{let t=Ji(e);return No((r,n)=>t(Array.from(r.values()),Array.from(n.values())))},WFe=(e)=>(t,r,n)=>qle(t)?Sc(e(Array.from(t.values()),r),(o)=>new Set(o),n,t):Ko(new Zt(n,t)),o1e=(e,t)=>jn([e],{decode:(r)=>WFe(gs(st(r))),encode:(r)=>WFe(Us(st(r)))},{typeConstructor:{_tag:"ReadonlySet"},description:t,pretty:YAt,arbitrary:QAt,equivalence:ZAt}),s1e=(e)=>o1e(e,`ReadonlySet<${$n(e)}>`),i1e=(e)=>o1e(e,`Set<${$n(e)}>`);function XAt(e){return Mt(st(e),s1e(Kt(En(e))),{strict:!0,decode:(t)=>new Set(t),encode:(t)=>Array.from(t)})}function eOt(e){return Mt(st(e),i1e(Kt(En(e))),{strict:!0,decode:(t)=>new Set(t),encode:(t)=>Array.from(t)})}var tOt=()=>(e)=>`BigDecimal(${ud(ww(e))})`,rOt=()=>(e)=>e.tuple(e.bigInt(),e.integer({min:-18,max:18})).map(([t,r])=>sE(t,r));class gE extends jn(kX,{typeConstructor:{_tag:"effect/BigDecimal"},identifier:"BigDecimalFromSelf",pretty:tOt,arbitrary:rOt,equivalence:()=>IX}){}class a1e extends Qo(H.annotations({description:"a string to be decoded into a BigDecimal"}),gE,{strict:!0,decode:(e,t,r)=>AX(e).pipe(be({onNone:()=>Ko(new Zt(r,e,`Unable to decode ${JSON.stringify(e)} into a BigDecimal`)),onSome:(n)=>cn(ww(n))})),encode:(e)=>cn(ud(ww(e)))}).annotations({identifier:"BigDecimal"}){}class c1e extends Mt(Et.annotations({description:"a number to be decoded into a BigDecimal"}),gE,{strict:!0,decode:(e)=>APe(e),encode:(e)=>OPe(e)}).annotations({identifier:"BigDecimalFromNumber"}){}var Qee=Symbol.for("effect/SchemaId/GreaterThanBigDecimal"),nOt=(e,t)=>(r)=>{let n=ud(e);return r.pipe(Jt((o)=>CPe(o,e),{schemaId:Qee,[Qee]:{min:e},title:`greaterThanBigDecimal(${n})`,description:`a BigDecimal greater than ${n}`,...t}))},Yee=Symbol.for("effect/schema/GreaterThanOrEqualToBigDecimal"),oOt=(e,t)=>(r)=>{let n=ud(e);return r.pipe(Jt((o)=>wPe(o,e),{schemaId:Yee,[Yee]:{min:e},title:`greaterThanOrEqualToBigDecimal(${n})`,description:`a BigDecimal greater than or equal to ${n}`,...t}))},Zee=Symbol.for("effect/SchemaId/LessThanBigDecimal"),sOt=(e,t)=>(r)=>{let n=ud(e);return r.pipe(Jt((o)=>EPe(o,e),{schemaId:Zee,[Zee]:{max:e},title:`lessThanBigDecimal(${n})`,description:`a BigDecimal less than ${n}`,...t}))},Xee=Symbol.for("effect/schema/LessThanOrEqualToBigDecimal"),iOt=(e,t)=>(r)=>{let n=ud(e);return r.pipe(Jt((o)=>bPe(o,e),{schemaId:Xee,[Xee]:{max:e},title:`lessThanOrEqualToBigDecimal(${n})`,description:`a BigDecimal less than or equal to ${n}`,...t}))},l1e=Symbol.for("effect/schema/PositiveBigDecimal"),u1e=(e)=>(t)=>t.pipe(Jt((r)=>_Pe(r),{schemaId:l1e,title:"positiveBigDecimal",description:"a positive BigDecimal",...e})),aOt=gE.pipe(u1e({identifier:"PositiveBigDecimalFromSelf"})),p1e=Symbol.for("effect/schema/NonNegativeBigDecimal"),f1e=(e)=>(t)=>t.pipe(Jt((r)=>r.value>=0n,{schemaId:p1e,title:"nonNegativeBigDecimal",description:"a non-negative BigDecimal",...e})),cOt=gE.pipe(f1e({identifier:"NonNegativeBigDecimalFromSelf"})),d1e=Symbol.for("effect/schema/NegativeBigDecimal"),m1e=(e)=>(t)=>t.pipe(Jt((r)=>OX(r),{schemaId:d1e,title:"negativeBigDecimal",description:"a negative BigDecimal",...e})),lOt=gE.pipe(m1e({identifier:"NegativeBigDecimalFromSelf"})),h1e=Symbol.for("effect/schema/NonPositiveBigDecimal"),g1e=(e)=>(t)=>t.pipe(Jt((r)=>r.value<=0n,{schemaId:h1e,title:"nonPositiveBigDecimal",description:"a non-positive BigDecimal",...e})),uOt=gE.pipe(g1e({identifier:"NonPositiveBigDecimalFromSelf"})),ete=Symbol.for("effect/SchemaId/BetweenBigDecimal"),x1e=(e,t,r)=>(n)=>{let o=ud(e),s=ud(t);return n.pipe(Jt((i)=>kPe(i,{minimum:e,maximum:t}),{schemaId:ete,[ete]:{maximum:t,minimum:e},title:`betweenBigDecimal(${o}, ${s})`,description:`a BigDecimal between ${o} and ${s}`,...r}))},pOt=(e,t)=>(r)=>Mt(r,r.pipe(Kt,x1e(e,t)),{strict:!1,decode:(n)=>IPe(n,{minimum:e,maximum:t}),encode:te}),fOt=(e,t)=>(r)=>{let n=r.array(e(r));return(t.depthIdentifier!==void 0?r.oneof(t,r.constant([]),n):n).map(Fr)},dOt=(e)=>(t)=>`Chunk(${lr(t).map(e).join(", ")})`,zFe=(e)=>(t,r,n)=>Yd(t)?At(t)?cn(Ze()):Sc(e(lr(t),r),Fr,n,t):Ko(new Zt(n,t)),rD=(e)=>jn([e],{decode:(t)=>zFe(gs(st(t))),encode:(t)=>zFe(Us(st(t)))},{typeConstructor:{_tag:"effect/Chunk"},description:`Chunk<${$n(e)}>`,pretty:dOt,arbitrary:fOt,equivalence:tT});function mOt(e){return Mt(st(e),rD(Kt(En(e))),{strict:!0,decode:(t)=>t.length===0?Ze():Fr(t),encode:(t)=>lr(t)})}var hOt=(e)=>(t)=>xee(e(t),{minLength:1}).map((r)=>cI(r)),gOt=(e)=>(t)=>`NonEmptyChunk(${lr(t).map(e).join(", ")})`,$Fe=(e)=>(t,r,n)=>Yd(t)&&kn(t)?Sc(e(lr(t),r),cI,n,t):Ko(new Zt(n,t)),y1e=(e)=>jn([e],{decode:(t)=>$Fe(gs($m(t))),encode:(t)=>$Fe(Us($m(t)))},{typeConstructor:{_tag:"effect/Chunk.NonEmptyChunk"},description:`NonEmptyChunk<${$n(e)}>`,pretty:gOt,arbitrary:hOt,equivalence:tT});function xOt(e){return Mt($m(e),y1e(Kt(En(e))),{strict:!0,decode:(t)=>cI(t),encode:(t)=>lr(t)})}var Ute=(e)=>Array.isArray(e)?j5(e):lR(e),yOt=(e)=>(t)=>e(t).map(Ute),SOt=(e)=>(t)=>`Data(${e(t)})`,jFe=(e)=>(t,r,n)=>iy(t)?Sc(e(t,r),Ute,n,t):Ko(new Zt(n,t)),S1e=(e)=>jn([e],{decode:(t)=>jFe(gs(t)),encode:(t)=>jFe(Us(t))},{description:`Data<${$n(e)}>`,pretty:SOt,arbitrary:yOt}),EOt=(e)=>Mt(e,S1e(Kt(e)),{strict:!1,decode:(t)=>Ute(t),encode:(t)=>Array.isArray(t)?Array.from(t):Object.assign({},t)}),bOt=(e)=>so(e)||Az(e),E1e=(e)=>Reflect.ownKeys(e).every((t)=>bOt(e[t])),Hte=(e)=>("fields"in e)?e.fields:Hte(e[lte]),Nz=(e)=>E1e(e)?fe(e):so(e)?e:fe(Hte(e)),Lz=(e)=>E1e(e)?e:Hte(e),mr=(e)=>(t,r)=>Aw({kind:"Class",identifier:e,schema:Nz(t),fields:Lz(t),Base:uR,annotations:r}),Uz=(e)=>lE(VO(qe(e)),()=>e),COt=(e)=>(t,r,n)=>{let o=Lz(r),s=Nz(r),i={_tag:Uz(t)},a=GO(i,o);return class extends Aw({kind:"TaggedClass",identifier:e??t,schema:YP(s,fe(i)),fields:a,Base:uR,annotations:n}){static _tag=t}},ri=(e)=>(t,r,n)=>{class o extends AA{}o.prototype.name=t;let s=Lz(r),i=Nz(r),a={_tag:Uz(t)},c=GO(a,s),l="message"in c;class u extends Aw({kind:"TaggedError",identifier:e??t,schema:YP(i,fe(a)),fields:c,Base:o,annotations:n,disableToString:!0}){static _tag=t}if(!l)Object.defineProperty(u.prototype,"message",{get(){return`{ ${Reflect.ownKeys(s).map((f)=>`${Ud(f)}: ${Uo(this[f])}`).join(", ")} }`},enumerable:!1,configurable:!0});return u},GO=(e,t)=>{let r={...e};for(let n of Reflect.ownKeys(t)){if(n in e)throw Error(dq(n));r[n]=t[n]}return r};function Hz(e){return ji(e)?e:e?.disableValidation??!1}var VFe=je("effect/Schema/astCache",()=>new WeakMap),wOt=(e)=>{if(e===void 0)return[];else if(Array.isArray(e))return e;else return[e]},Aw=({Base:e,annotations:t,disableToString:r,fields:n,identifier:o,kind:s,schema:i})=>{let a=Symbol.for(`effect/Schema/${s}/${o}`),[c,l,u]=wOt(t),f=Kt(i),h=f.annotations({identifier:o,...c}),y=f.annotations({[bS]:`${o} (Type side)`,...c}),E=i.annotations({[bS]:`${o} (Constructor)`,...c}),b=i.annotations({[bS]:`${o} (Encoded side)`,...u}),w=i.annotations({...u,...c,...l}),T=(k)=>de(k,a)&&OS(y)(k),A=class extends e{constructor(k={},O=!1){if(k={...k},s!=="Class")delete k._tag;if(k=xNe(n,k),!Hz(O))k=nw(E)(k);super(k,!0)}static[pE]=Eee;static get ast(){let k=VFe.get(this);if(k)return k;let O=jn([i],{decode:()=>(P,D,I)=>P instanceof this||T(P)?cn(P):Ko(new Zt(I,P)),encode:()=>(P,D)=>P instanceof this?cn(P):ua(Us(y)(P,D),(I)=>new this(I,!0))},{identifier:o,pretty:(P)=>(D)=>`${o}(${P(D)})`,arbitrary:(P)=>(D)=>P(D).map((I)=>new this(I)),equivalence:te,[VR]:h.ast,...c});return k=Mt(b,O,{strict:!0,decode:(P)=>new this(P,!0),encode:te}).annotations({[VR]:w.ast,...l}).ast,VFe.set(this,k),k}static pipe(){return ce(this,arguments)}static annotations(k){return rr(this.ast).annotations(k)}static toString(){return`(${String(b)} <-> ${o})`}static make(...k){return new this(...k)}static fields={...n};static identifier=o;static extend(k){return(O,P)=>{let D=Lz(O),I=Nz(O),M=GO(n,D);return Aw({kind:s,identifier:k,schema:YP(i,I),fields:M,Base:this,annotations:P})}}static transformOrFail(k){return(O,P,D)=>{let I=GO(n,O);return Aw({kind:s,identifier:k,schema:Qo(i,Kt(fe(I)),P),fields:I,Base:this,annotations:D})}}static transformOrFailFrom(k){return(O,P,D)=>{let I=GO(n,O);return Aw({kind:s,identifier:k,schema:Qo(Ez(i),fe(I),P),fields:I,Base:this,annotations:D})}}get[a](){return a}};if(r!==!0)Object.defineProperty(A.prototype,"toString",{value(){return`${o}({ ${Reflect.ownKeys(n).map((k)=>`${Ud(k)}: ${Uo(this[k])}`).join(", ")} })`},configurable:!0,writable:!0});return A},kOt=fe({_tag:qe("None")}).annotations({identifier:"FiberIdNoneEncoded"}),IOt=fe({_tag:qe("Runtime"),id:Ja,startTimeMillis:Ja}).annotations({identifier:"FiberIdRuntimeEncoded"}),AOt=fe({_tag:qe("Composite"),left:dz(()=>hz),right:dz(()=>hz)}).annotations({identifier:"FiberIdCompositeEncoded"}),hz=gt(kOt,IOt,AOt).annotations({identifier:"FiberIdEncoded"}),b1e=(e)=>e.letrec((t)=>({None:e.record({_tag:e.constant("None")}),Runtime:e.record({_tag:e.constant("Runtime"),id:e.integer(),startTimeMillis:e.integer()}),Composite:e.record({_tag:e.constant("Composite"),left:t("FiberId"),right:t("FiberId")}),FiberId:e.oneof(t("None"),t("Runtime"),t("Composite"))})).FiberId.map(GP),gz=(e)=>{switch(e._tag){case"None":return"FiberId.none";case"Runtime":return`FiberId.runtime(${e.id}, ${e.startTimeMillis})`;case"Composite":return`FiberId.composite(${gz(e.right)}, ${gz(e.left)})`}};class qte extends jn(mfe,{typeConstructor:{_tag:"effect/FiberId"},identifier:"FiberIdFromSelf",pretty:()=>gz,arbitrary:()=>b1e}){}var GP=(e)=>{switch(e._tag){case"None":return Ks;case"Runtime":return ffe(e.id,e.startTimeMillis);case"Composite":return dfe(GP(e.left),GP(e.right))}},tte=(e)=>{switch(e._tag){case"None":return{_tag:"None"};case"Runtime":return{_tag:"Runtime",id:e.id,startTimeMillis:e.startTimeMillis};case"Composite":return{_tag:"Composite",left:tte(e.left),right:tte(e.right)}}};class C1e extends Mt(hz,qte,{strict:!0,decode:(e)=>GP(e),encode:(e)=>tte(e)}).annotations({identifier:"FiberId"}){}var OOt=(e)=>fe({_tag:qe("Die"),defect:e}),_Ot=fe({_tag:qe("Empty")}),vOt=(e)=>fe({_tag:qe("Fail"),error:e}),TOt=fe({_tag:qe("Interrupt"),fiberId:hz}),ROt=0,xz=(e,t)=>{let r=En(e),n=En(t),o=dz(()=>s),s=gt(_Ot,vOt(r),OOt(n),TOt,fe({_tag:qe("Sequential"),left:o,right:o}),fe({_tag:qe("Parallel"),left:o,right:o})).annotations({title:`CauseEncoded<${$n(e)}>`,[Sq]:`CauseEncoded${ROt++}`});return s},w1e=(e,t)=>(r)=>r.letrec((n)=>({Empty:r.record({_tag:r.constant("Empty")}),Fail:r.record({_tag:r.constant("Fail"),error:e(r)}),Die:r.record({_tag:r.constant("Die"),defect:t(r)}),Interrupt:r.record({_tag:r.constant("Interrupt"),fiberId:b1e(r)}),Sequential:r.record({_tag:r.constant("Sequential"),left:n("Cause"),right:n("Cause")}),Parallel:r.record({_tag:r.constant("Parallel"),left:n("Cause"),right:n("Cause")}),Cause:r.oneof(n("Empty"),n("Fail"),n("Die"),n("Interrupt"),n("Sequential"),n("Parallel"))})).Cause.map(uE),k1e=(e)=>(t)=>{let r=(n)=>{switch(n._tag){case"Empty":return"Cause.empty";case"Fail":return`Cause.fail(${e(n.error)})`;case"Die":return`Cause.die(${hA(n)})`;case"Interrupt":return`Cause.interrupt(${gz(n.fiberId)})`;case"Sequential":return`Cause.sequential(${r(n.left)}, ${r(n.right)})`;case"Parallel":return`Cause.parallel(${r(n.left)}, ${r(n.right)})`}};return r(t)},GFe=(e)=>(t,r,n)=>s5(t)?Sc(e(jO(t),r),uE,n,t):Ko(new Zt(n,t)),yz=({defect:e,error:t})=>jn([t,e],{decode:(r,n)=>GFe(gs(xz(r,n))),encode:(r,n)=>GFe(Us(xz(r,n)))},{typeConstructor:{_tag:"effect/Cause"},title:`Cause<${t.ast}>`,pretty:k1e,arbitrary:w1e});function uE(e){switch(e._tag){case"Empty":return V0;case"Fail":return Cp(e.error);case"Die":return oa(e.defect);case"Interrupt":return Zy(GP(e.fiberId));case"Sequential":return o5(uE(e.left),uE(e.right));case"Parallel":return n5(uE(e.left),uE(e.right))}}function jO(e){switch(e._tag){case"Empty":return{_tag:"Empty"};case"Fail":return{_tag:"Fail",error:e.error};case"Die":return{_tag:"Die",defect:e.defect};case"Interrupt":return{_tag:"Interrupt",fiberId:e.fiberId};case"Sequential":return{_tag:"Sequential",left:jO(e.left),right:jO(e.right)};case"Parallel":return{_tag:"Parallel",left:jO(e.left),right:jO(e.right)}}}var Bte=({defect:e,error:t})=>{let r=En(t),n=En(e);return Mt(xz(r,n),yz({error:Kt(r),defect:Kt(n)}),{strict:!1,decode:(s)=>uE(s),encode:(s)=>jO(s)})};class io extends Mt(To,To,{strict:!0,decode:(e)=>{if(Zo(e)&&"message"in e&&typeof e.message==="string"){let t=Error(e.message,{cause:e});if("name"in e&&typeof e.name==="string")t.name=e.name;return t.stack="stack"in e&&typeof e.stack==="string"?e.stack:"",t}return B1(e)},encode:(e)=>{if(e instanceof Error)return{name:e.name,message:e.message};return B1(e)}}).annotations({identifier:"Defect"}){}var MOt=(e,t)=>fe({_tag:qe("Failure"),cause:xz(e,t)}),POt=(e)=>fe({_tag:qe("Success"),value:e}),DOt=(e,t,r)=>gt(MOt(t,r),POt(e)).annotations({title:`ExitEncoded<${$n(e)}, ${$n(t)}, ${$n(r)}>`}),I1e=(e)=>{switch(e._tag){case"Failure":return gr(uE(e.cause));case"Success":return Nt(e.value)}},FOt=(e,t,r)=>(n)=>n.oneof(n.record({_tag:n.constant("Failure"),cause:w1e(t,r)(n)}),n.record({_tag:n.constant("Success"),value:e(n)})).map(I1e),NOt=(e,t)=>(r)=>r._tag==="Failure"?`Exit.failCause(${k1e(t)(r.cause)})`:`Exit.succeed(${e(r.value)})`,KFe=(e,t)=>(r,n,o)=>O0(r)?to(r,{onFailure:(s)=>Sc(t(s,n),gr,o,r),onSuccess:(s)=>Sc(e(s,n),Nt,o,r)}):Ko(new Zt(o,r)),A1e=({defect:e,failure:t,success:r})=>jn([r,t,e],{decode:(n,o,s)=>KFe(gs(n),gs(yz({error:o,defect:s}))),encode:(n,o,s)=>KFe(Us(n),Us(yz({error:o,defect:s})))},{typeConstructor:{_tag:"effect/Exit"},title:`Exit<${r.ast}, ${t.ast}>`,pretty:NOt,arbitrary:FOt}),KP=({defect:e,failure:t,success:r})=>{let n=En(r),o=En(t),s=En(e);return Mt(DOt(n,o,s),A1e({failure:Kt(o),success:Kt(n),defect:Kt(s)}),{strict:!1,decode:(a)=>I1e(a),encode:(a)=>a._tag==="Failure"?{_tag:"Failure",cause:a.cause}:{_tag:"Success",value:a.value}})},LOt=(e,t)=>(r)=>{let n=r.array(e(r));return(t.depthIdentifier!==void 0?r.oneof(t,r.constant([]),n):n).map(cp)},UOt=(e)=>(t)=>`HashSet(${Array.from(t).map((r)=>e(r)).join(", ")})`,HOt=(e)=>{let t=Ji(e);return No((r,n)=>t(Array.from(r),Array.from(n)))},JFe=(e)=>(t,r,n)=>rfe(t)?Sc(e(Array.from(t),r),cp,n,t):Ko(new Zt(n,t)),O1e=(e)=>jn([e],{decode:(t)=>JFe(gs(st(t))),encode:(t)=>JFe(Us(st(t)))},{typeConstructor:{_tag:"effect/HashSet"},description:`HashSet<${$n(e)}>`,pretty:UOt,arbitrary:LOt,equivalence:HOt});function qOt(e){return Mt(st(e),O1e(Kt(En(e))),{strict:!0,decode:(t)=>cp(t),encode:(t)=>Array.from(t)})}var BOt=(e,t,r)=>(n)=>{let o=n.array(n.tuple(e(n),t(n)));return(r.depthIdentifier!==void 0?n.oneof(r,n.constant([]),o):o).map(lp)},WOt=(e,t)=>(r)=>`HashMap([${Array.from(r).map(([n,o])=>`[${e(n)}, ${t(o)}]`).join(", ")}])`,zOt=(e,t)=>{let r=Ji(No(([n,o],[s,i])=>e(n,s)&&t(o,i)));return No((n,o)=>r(Array.from(n),Array.from(o)))},QFe=(e)=>(t,r,n)=>xfe(t)?Sc(e(Array.from(t),r),lp,n,t):Ko(new Zt(n,t)),_1e=({key:e,value:t})=>jn([e,t],{decode:(r,n)=>QFe(gs(st(ma(r,n)))),encode:(r,n)=>QFe(Us(st(ma(r,n))))},{typeConstructor:{_tag:"effect/HashMap"},description:`HashMap<${$n(e)}, ${$n(t)}>`,pretty:WOt,arbitrary:BOt,equivalence:zOt}),$Ot=({key:e,value:t})=>Mt(st(ma(e,t)),_1e({key:Kt(En(e)),value:Kt(En(t))}),{strict:!0,decode:(r)=>lp(r),encode:(r)=>Array.from(r)}),jOt=(e,t)=>(r)=>{let n=r.array(e(r));return(t.depthIdentifier!==void 0?r.oneof(t,r.constant([]),n):n).map(b1)},VOt=(e)=>(t)=>`List(${Array.from(t).map((r)=>e(r)).join(", ")})`,GOt=(e)=>{let t=Ji(e);return No((r,n)=>t(Array.from(r),Array.from(n)))},YFe=(e)=>(t,r,n)=>E1(t)?Sc(e(Array.from(t),r),b1,n,t):Ko(new Zt(n,t)),v1e=(e)=>jn([e],{decode:(t)=>YFe(gs(st(t))),encode:(t)=>YFe(Us(st(t)))},{typeConstructor:{_tag:"effect/List"},description:`List<${$n(e)}>`,pretty:VOt,arbitrary:jOt,equivalence:GOt});function KOt(e){return Mt(st(e),v1e(Kt(En(e))),{strict:!0,decode:(t)=>b1(t),encode:(t)=>Array.from(t)})}var JOt=(e,t,r)=>(n)=>{let o=n.array(e(n));return(r.depthIdentifier!==void 0?n.oneof(r,n.constant([]),o):o).map((s)=>UU(s,t))},QOt=(e)=>(t)=>`new SortedSet([${Array.from(HU(t)).map((r)=>e(r)).join(", ")}])`,ZFe=(e,t)=>(r,n,o)=>q8(r)?Sc(e(Array.from(HU(r)),n),(s)=>UU(s,t),o,r):Ko(new Zt(o,r)),T1e=(e,t,r)=>jn([e],{decode:(n)=>ZFe(gs(st(n)),t),encode:(n)=>ZFe(Us(st(n)),r)},{typeConstructor:{_tag:"effect/SortedSet"},description:`SortedSet<${$n(e)}>`,pretty:QOt,arbitrary:(n,o)=>JOt(n,t,o),equivalence:()=>qSe()});function YOt(e,t){let r=Kt(En(e));return Mt(st(e),T1e(r,t,t),{strict:!0,decode:(n)=>UU(n,t),encode:(n)=>Array.from(HU(n))})}class R1e extends Mt(To,St,{strict:!0,decode:(e)=>Hle(e),encode:te}).annotations({identifier:"BooleanFromUnknown"}){}class M1e extends Mt(qe("true","false").annotations({description:"a string to be decoded into a boolean"}),St,{strict:!0,decode:(e)=>e==="true",encode:(e)=>e?"true":"false"}).annotations({identifier:"BooleanFromString"}){}var ZOt=(e,t)=>{let r=BY(t);return FX(e).pipe(DX((n)=>r(n).pipe(pl((o)=>Gue([],vu.formatIssueSync(o))))))},nD=Symbol.for("effect/Schema/Serializable/symbol"),XOt=(e)=>e,e_t=(e)=>e[nD],t_t=(e)=>Mu(e[nD])(e),r_t=p(2,(e,t)=>Qr(e[nD])(t)),cx=Symbol.for("effect/Schema/Serializable/symbolResult"),n_t=(e)=>e,rte=(e)=>e[cx].failure,Sz=(e)=>e[cx].success,XFe=je("effect/Schema/Serializable/exitSchemaCache",()=>new WeakMap),Wte=(e)=>{let t=Object.getPrototypeOf(e);if(!(cx in t))return KP({failure:rte(e),success:Sz(e),defect:io});let r=XFe.get(t);if(r===void 0)r=KP({failure:rte(e),success:Sz(e),defect:io}),XFe.set(t,r);return r},o_t=p(2,(e,t)=>Gm(e[cx].failure)(t)),s_t=p(2,(e,t)=>Qr(e[cx].failure)(t)),i_t=p(2,(e,t)=>Gm(e[cx].success)(t)),a_t=p(2,(e,t)=>Qr(e[cx].success)(t)),c_t=p(2,(e,t)=>Gm(Wte(e))(t)),l_t=p(2,(e,t)=>Qr(Wte(e))(t)),u_t=(e)=>e,p_t=(e)=>(t,r,n)=>{let o=GO({_tag:Uz(t)},r.payload);return class extends Aw({kind:"TaggedRequest",identifier:e??t,schema:fe(o),fields:o,Base:pIe,annotations:n}){static _tag=t;static success=r.success;static failure=r.failure;get[nD](){return this.constructor}get[cx](){return{failure:r.failure,success:r.success}}}},f_t=(e)=>fd(e.ast,[]),d_t=Ls(yq),fd=(e,t)=>{let r=d_t(e);if(Oe(r))switch(e._tag){case"Declaration":return r.value(...e.typeParameters.map((n)=>fd(n,t)));case"Refinement":return r.value(fd(e.from,t));default:return r.value()}switch(e._tag){case"NeverKeyword":throw Error(AIe(e,t));case"Transformation":return fd(e.to,t);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 ge;case"Refinement":return fd(e.from,t);case"Suspend":{let n=qA(()=>fd(e.f(),t));return(o,s)=>n()(o,s)}case"TupleType":{let n=e.elements.map((s,i)=>fd(s.type,t.concat(i))),o=e.rest.map((s)=>fd(s.type,t));return No((s,i)=>{if(!Array.isArray(s)||!Array.isArray(i))return!1;let a=s.length;if(a!==i.length)return!1;let c=0;for(;c<Math.min(a,e.elements.length);c++)if(!n[c](s[c],i[c]))return!1;if(ut(o)){let[l,...u]=o;for(;c<a-u.length;c++)if(!l(s[c],i[c]))return!1;for(let f=0;f<u.length;f++)if(c+=f,!u[f](s[c],i[c]))return!1}return!0})}case"TypeLiteral":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return ge;let n=e.propertySignatures.map((s)=>fd(s.type,t.concat(s.name))),o=e.indexSignatures.map((s)=>fd(s.type,t));return No((s,i)=>{if(!Xu(s)||!Xu(i))return!1;let a=Object.keys(s),c=Object.getOwnPropertySymbols(s);for(let f=0;f<n.length;f++){let h=e.propertySignatures[f],y=h.name,E=Object.prototype.hasOwnProperty.call(s,y),b=Object.prototype.hasOwnProperty.call(i,y);if(h.isOptional){if(E!==b)return!1}if(E&&b&&!n[f](s[y],i[y]))return!1}let l,u;for(let f=0;f<o.length;f++){let h=e.indexSignatures[f],y=vg(h.parameter),E=bq(y);if(E){if(l=l||Object.getOwnPropertySymbols(i),c.length!==l.length)return!1}else if(u=u||Object.keys(i),a.length!==u.length)return!1;let b=E?c:a;for(let w=0;w<b.length;w++){let T=b[w];if(!Object.prototype.hasOwnProperty.call(i,T)||!o[f](s[T],i[T]))return!1}}return!0})}case"Union":{let n=$Y(e.types,!0),o=Reflect.ownKeys(n.keys),s=o.length;return No((i,a)=>{let c=[];if(s>0&&qk(i))for(let u=0;u<s;u++){let f=o[u],h=n.keys[f].buckets;if(Object.prototype.hasOwnProperty.call(i,f)){let y=String(i[f]);if(Object.prototype.hasOwnProperty.call(h,y))c=c.concat(h[y])}}if(n.otherwise.length>0)c=c.concat(n.otherwise);let l=c.map((u)=>[fd(u,t),OS({ast:u})]);for(let u=0;u<l.length;u++){let[f,h]=l[u];if(h(i)&&h(a)){if(f(i,a))return!0}}return!1})}}},eNe=QP("symbol",{key:H}).annotations({description:"an object to be decoded into a globally shared symbol"}),m_t=Qo(eNe,kz,{strict:!0,decode:(e)=>ELe(e.key),encode:(e,t,r)=>ua(SLe(e,r),(n)=>eNe.make({key:n}))});class zte extends gt(H,Et,m_t).annotations({identifier:"PropertyKey"}){}class P1e extends fe({_tag:VO(qe("Pointer","Unexpected","Missing","Composite","Refinement","Transformation","Type","Forbidden")).annotations({description:"The tag identifying the type of parse issue"}),path:VO(st(zte)).annotations({description:"The path to the property where the issue occurred"}),message:VO(H).annotations({description:"A descriptive message explaining the issue"})}).annotations({identifier:"ArrayFormatterIssue",description:"Represents an issue returned by the ArrayFormatter formatter"}){}var JO=Symbol.for("@effect/platform/Error"),h_t=(e)=>de(e,JO),xE=(e,t)=>{class r extends AA{_tag=t}return r.prototype[e]=e,r.prototype.name=t,r},$te=qe("Clipboard","Command","FileSystem","KeyValueStore","Path","Stream","Terminal");class Qa extends ri("@effect/platform/Error/BadArgument")("BadArgument",{module:$te,method:H,description:Be(H),cause:Be(io)}){[JO]=JO;get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:""}`}}var D1e=qe("AlreadyExists","BadResource","Busy","InvalidData","NotFound","PermissionDenied","TimedOut","UnexpectedEof","Unknown","WouldBlock","WriteZero");class Ec extends ri("@effect/platform/Error/SystemError")("SystemError",{reason:D1e,module:$te,method:H,description:Be(H),syscall:Be(H),pathOrDescriptor:Be(gt(H,Et)),cause:Be(io)}){[JO]=JO;get message(){return`${this.reason}: ${this.module}.${this.method}${this.pathOrDescriptor!==void 0?` (${this.pathOrDescriptor})`:""}${this.description?`: ${this.description}`:""}`}}var g_t=gt(Qa,Ec);var qz=qt("@effect/platform/FileSystem"),Jm=(e)=>typeof e==="bigint"?e:BigInt(e),F1e=(e)=>Jm(e*1024),N1e=(e)=>Jm(e*1024*1024),L1e=(e)=>Jm(e*1024*1024*1024),U1e=(e)=>Jm(e*1024*1024*1024*1024),oD=BigInt(1024),x_t=oD*oD*oD*oD*oD,H1e=(e)=>Jm(BigInt(e)*x_t),q1e=(e)=>qz.of({...e,exists:(t)=>d(e.access(t),qr(!0),mc("SystemError",(r)=>r.reason==="NotFound"?N(!1):ie(r))),readFileString:(t,r)=>jf(e.readFile(t),{try:(n)=>new TextDecoder(r).decode(n),catch:(n)=>new Qa({module:"FileSystem",method:"readFileString",description:"invalid encoding",cause:n})}),stream:(t,r)=>d(e.open(t,{flag:"r"}),r?.offset?sr((n)=>n.seek(r.offset,"start")):te,W((n)=>y_t(n,r)),cd),sink:(t,r)=>d(e.open(t,{flag:"w",...r}),W((n)=>iPe((o)=>n.writeAll(o))),cPe),writeFileString:(t,r,n)=>L(Ps({try:()=>new TextEncoder().encode(r),catch:(o)=>new Qa({module:"FileSystem",method:"writeFileString",description:"could not encode string",cause:o})}),(o)=>e.writeFile(t,o,n))}),Bs=(e,t)=>new Ec({module:"FileSystem",method:e,reason:"NotFound",description:"No such file or directory",pathOrDescriptor:t}),jte=(e)=>({access(t){return ie(Bs("access",t))},chmod(t){return ie(Bs("chmod",t))},chown(t){return ie(Bs("chown",t))},copy(t){return ie(Bs("copy",t))},copyFile(t){return ie(Bs("copyFile",t))},exists(){return N(!1)},link(t){return ie(Bs("link",t))},makeDirectory(){return Ms("not implemented")},makeTempDirectory(){return Ms("not implemented")},makeTempDirectoryScoped(){return Ms("not implemented")},makeTempFile(){return Ms("not implemented")},makeTempFileScoped(){return Ms("not implemented")},open(t){return ie(Bs("open",t))},readDirectory(t){return ie(Bs("readDirectory",t))},readFile(t){return ie(Bs("readFile",t))},readFileString(t){return ie(Bs("readFileString",t))},readLink(t){return ie(Bs("readLink",t))},realPath(t){return ie(Bs("realPath",t))},remove(){return me},rename(t){return ie(Bs("rename",t))},sink(t){return oPe(Bs("sink",t))},stat(t){return ie(Bs("stat",t))},stream(t){return oE(Bs("stream",t))},symlink(t){return ie(Bs("symlink",t))},truncate(t){return ie(Bs("truncate",t))},utimes(t){return ie(Bs("utimes",t))},watch(t){return oE(Bs("watch",t))},writeFile(t){return ie(Bs("writeFile",t))},writeFileString(t){return ie(Bs("writeFileString",t))},...e}),B1e=(e)=>Hs(qz,jte(e)),y_t=(e,{bufferSize:t=16,bytesToRead:r,chunkSize:n=Jm(65536)}={})=>{let o=r!==void 0?Jm(r):void 0,s=Jm(n);function i(a){if(o!==void 0&&o<=a)return Yg;let c=o!==void 0&&o-a<s?o-a:s;return id(e.readAlloc(c),be({onNone:()=>Yg,onSome:(l)=>id(nE(We(l)),(u)=>i(a+BigInt(l.length)))}))}return pX(Zg(i(BigInt(0))),{capacity:t})};var lx=Jm,E_t=F1e,b_t=N1e,C_t=L1e,w_t=U1e,k_t=H1e,Hi=qz,Vte=q1e,I_t=jte,A_t=B1e,QO=Symbol.for("@effect/platform/FileSystem/File"),O_t=(e)=>typeof e==="object"&&e!==null&&(QO in e),Gte=lM(),Kte=uS("Create"),Jte=uS("Update"),Qte=uS("Remove");class Bz extends Gs("@effect/platform/FileSystem/WatchBackend")(){}var cHe=Dle(V1e(),1),une=Dle(Z1e(),1);var WFt=Yre(),zFt=bD(),$Ft=Fre(),lne=CD(),jFt=aD(),AE=pn(),VFt=bE(),GFt=Si(),KFt=wE(),JFt=kE(),apr=O$(),QFt=ine(),YFt=ane(),ZFt=cne(),R$=iHe(),aHe=sD();var eNt=WFt.Composer,tNt=zFt.Document,rNt=$Ft.Schema,nNt=lne.YAMLError,oNt=lne.YAMLParseError,sNt=lne.YAMLWarning,iNt=jFt.Alias,aNt=AE.isAlias,cNt=AE.isCollection,lNt=AE.isDocument,uNt=AE.isMap,pNt=AE.isNode,fNt=AE.isPair,dNt=AE.isScalar,mNt=AE.isSeq,hNt=VFt.Pair,gNt=GFt.Scalar,xNt=KFt.YAMLMap,yNt=JFt.YAMLSeq;var SNt=QFt.Lexer,ENt=YFt.LineCounter,bNt=ZFt.Parser,M$=R$.parse,CNt=R$.parseAllDocuments,wNt=R$.parseDocument,kNt=R$.stringify,INt=aHe.visit,ANt=aHe.visitAsync;var ONt={json:(e)=>JSON.parse(e),yaml:(e)=>M$(e),yml:(e)=>M$(e),ini:(e)=>cHe.parse(e),toml:(e)=>une.parse(e),tml:(e)=>une.parse(e)},P$=(e)=>L(Hi,(t)=>wr(t.readFile(e),{onFailure:(r)=>ie(`Could not read file (${e}): ${r}`),onSuccess:(r)=>N([e,r])})),D$=(e)=>L(Hi,(t)=>wr(t.readFileString(e),{onFailure:(r)=>ie(`Could not read file (${e}): ${r}`),onSuccess:(r)=>N([e,r])})),F$=(e,t,r)=>{let n=ONt[r??e.split(".").pop()];if(n===void 0)return ie(`Unsupported file format: ${r}`);return Ps({try:()=>n(t),catch:(o)=>`Could not parse ${r} file (${e}): ${o}`})};function uHe(e,t){return function(r){if(Array.isArray(r))return r.reduce(t,e);let n=e;for(let o of r)n=t(n,o);return n}}function pHe(e){return function(t){if(Array.isArray(t))return t.map(e);return function*(){for(let r of t)yield e(r)}()}}var fHe=(e)=>(t)=>{let r=Object.keys(t);return e.imap(e.productAll(r.map((n)=>t[n])),(n)=>{let o={};for(let s=0;s<n.length;s++)o[r[s]]=n[s];return o},(n)=>r.map((o)=>n[o]))};var dx=(e,t=(r,n)=>uHe(r,e)(n))=>({combine:e,combineMany:t});var vNt=(e)=>dx(()=>e,()=>e);var dHe=()=>dx((e)=>e,(e)=>e);var TNt=p(3,(e,t,r)=>dx((n,o)=>t(e.combine(r(n),r(o))),(n,o)=>t(e.combineMany(r(n),pHe(r)(o)))));var RNt=(e,t)=>dx(([r,n],[o,s])=>[e.combine(r,o),t.combine(n,s)]),mHe=(e)=>dx((t,r)=>{let n=Math.min(t.length,r.length),o=[],s=0;for(let i of e){if(s>=n)break;o.push(i.combine(t[s],r[s])),s++}return o}),MNt=(e,t)=>{let r=mHe(t);return dx((n,o)=>[e.combine(n[0],o[0]),...r.combine(n.slice(1),o.slice(1))])};var PNt=vNt,DNt={of:PNt,imap:TNt,product:RNt,productMany:MNt,productAll:mHe};var N$=()=>dx((e,t)=>e.concat(t)),L$=fHe(DNt);var _D=(e,t)=>({combine:e.combine,combineMany:e.combineMany,empty:t,combineAll:(r)=>e.combineMany(t,r)});var gHe=()=>_D(N$(),[]),xHe=(e)=>{let t={};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t[r]=e[r].empty;return _D(L$(e),t)};var U$={_tag:"Black"},H$={_tag:"Red"},pne={_tag:"Green"};var fne={_tag:"Magenta"},q$={_tag:"Cyan"},B$={_tag:"White"},c_=(e)=>{switch(e._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 yHe={_tag:"Reset"},SHe=(e)=>({_tag:"SetBold",bold:e}),mne=(e,t,r)=>({_tag:"SetColor",color:e,vivid:t,layer:r}),EHe=(e)=>({_tag:"SetItalicized",italicized:e}),bHe=(e)=>({_tag:"SetStrikethrough",strikethrough:e}),CHe=(e)=>({_tag:"SetUnderlined",underlined:e}),NNt=(e)=>{switch(e._tag){case"Reset":return 0;case"SetBold":return e.bold?1:22;case"SetColor":switch(e.layer){case"foreground":return e.vivid?90+c_(e.color):30+c_(e.color);case"background":return e.vivid?100+c_(e.color):40+c_(e.color)}case"SetItalicized":return e.italicized?3:23;case"SetStrikethrough":return e.strikethrough?9:29;case"SetUnderlined":return e.underlined?4:24}},wHe=(e)=>LNt("m",e),LNt=(e,t)=>`\x1B[${Array.from(t).map((n)=>`${NNt(n)}`).join(";")}${e}`;var BNt="@effect/printer-ansi/Ansi",W$=Symbol.for(BNt),Ss=(e)=>({...IHe.empty,...e}),kHe=dHe(),Lw=dx((e,t)=>Oe(e)?e:t),WNt=L$({[W$]:kHe,commands:N$(),foreground:Lw,background:Lw,bold:Lw,italicized:Lw,strikethrough:Lw,underlined:Lw}),zNt=_D(kHe,W$),l_=_D(Lw,R()),IHe=xHe({[W$]:zNt,commands:gHe(),foreground:l_,background:l_,bold:l_,italicized:l_,strikethrough:l_,underlined:l_}),AHe=IHe.empty,ni="\x1B[",$Nt="\x07",jNt=";",OHe=Ss({bold:_(SHe(!0))}),_He=Ss({italicized:_(EHe(!0))}),vHe=Ss({strikethrough:_(bHe(!0))}),THe=Ss({underlined:_(CHe(!0))}),hne=(e)=>Ss({foreground:_(mne(e,!0,"foreground"))}),u_=(e)=>Ss({foreground:_(mne(e,!1,"foreground"))});var RHe=u_(U$),MHe=u_(H$),PHe=u_(pne);var DHe=u_(B$),FHe=hne(U$);var NHe=hne(q$);var gne=Ss({commands:tt($Nt)}),xne=(e,t)=>{if(t===void 0){let n=`${ni}${Math.max(e+1,0)}G`;return Ss({commands:tt(n)})}let r=`${ni}${t+1}${jNt}${Math.max(e+1,0)}H`;return Ss({commands:tt(r)})},yne=(e,t=0)=>{let r="";if(t<0)r+=`${ni}${-t}A`;if(t>0)r+=`${ni}${t}B`;if(e>0)r+=`${ni}${e}C`;if(e<0)r+=`${ni}${-e}D`;return Ss({commands:tt(r)})};var Sne=(e=1)=>{let t=`${ni}${e}B`;return Ss({commands:tt(t)})};var Ene=Ss({commands:tt(`${ni}G`)}),bne=Ss({commands:tt(`${ni}s`)}),Cne=Ss({commands:tt(`${ni}u`)});var wne=Ss({commands:tt(`${ni}?25l`)}),kne=Ss({commands:tt(`${ni}?25h`)}),Ine=(e)=>{let t="";for(let r=0;r<e;r++)t+=`${ni}2K`+(r<e-1?`${ni}1A`:"");if(e>0)t+=`${ni}G`;return Ss({commands:tt(t)})},LHe=Ss({commands:tt(`${ni}K`)}),UHe=Ss({commands:tt(`${ni}1K`)}),Ane=Ss({commands:tt(`${ni}2K`)}),HHe=Ss({commands:tt(`${ni}J`)}),qHe=Ss({commands:tt(`${ni}1J`)}),BHe=Ss({commands:tt(`${ni}2J`)}),z$=(e)=>GNt(e),$$=p(2,(e,t)=>VNt(e,t)),VNt=(e,t)=>WNt.combine(e,t),GNt=(e)=>{let t=wHe(Jd([_(yHe),e.foreground,e.background,e.bold,e.italicized,e.strikethrough,e.underlined])),r=Xt(e.commands,"");return`${t}${r}`};var Ws=OHe,OE=_He,WHe=vHe,Yc=THe,zHe=u_;var $He=RHe,Ul=MHe,Ya=PHe;var Zm=DHe,rn=FHe;var Ro=NHe;var Ei=$$;var j$="@effect/printer/Flatten",jHe=Symbol.for(j$),XNt={Flattened:(e)=>Ee(oe(e.value))(It(j$)),AlreadyFlat:(e)=>Ee(It("@effect/printer/Flattened/AlreadyFlat"))(It(j$)),NeverFlat:(e)=>Ee(It("@effect/printer/Flattened/NeverFlat"))(It(j$))},eLt={Flattened:(e,t)=>_ne(t)&&t._tag==="Flattened"&&ge(e.value,t.value),AlreadyFlat:(e,t)=>_ne(t)&&t._tag==="AlreadyFlat",NeverFlat:(e,t)=>_ne(t)&&t._tag==="NeverFlat"},vne={[jHe]:{_A:(e)=>e},[Ne](){return lt(this,XNt[this._tag](this))},[Pe](e){return eLt[this._tag](this,e)}},_ne=(e)=>typeof e==="object"&&e!=null&&(jHe in e),p_=(e)=>e._tag==="Flattened",vD=(e)=>e._tag==="AlreadyFlat",Tne=(e)=>e._tag==="NeverFlat",eh=(e)=>(()=>{let t=Object.create(vne);return t._tag="Flattened",t.value=e,t})(),V$=(()=>{let e=Object.create(vne);return e._tag="AlreadyFlat",e})(),G$=(()=>{let e=Object.create(vne);return e._tag="NeverFlat",e})(),Rne=p(2,(e,t)=>{switch(e._tag){case"Flattened":return eh(t(e.value));case"AlreadyFlat":return V$;case"NeverFlat":return G$}});var Hl="@effect/printer/Doc",Pne=Symbol.for(Hl),rLt={Fail:(e)=>Ee(oe(Hl))(oe("@effect/printer/Doc/Fail")),Empty:(e)=>Ee(oe(Hl))(oe("@effect/printer/Doc/Empty")),Char:(e)=>Ee(oe(Hl))(It(e.char)),Text:(e)=>Ee(oe(Hl))(It(e.text)),Line:(e)=>Ee(oe(Hl))(oe("@effect/printer/Doc/Line")),FlatAlt:(e)=>Ee(oe(Hl))(Ee(oe(e.left))(oe(e.right))),Cat:(e)=>Ee(oe(Hl))(Ee(oe(e.left))(oe(e.right))),Nest:(e)=>Ee(oe(Hl))(Ee(oe(e.indent))(oe(e.doc))),Union:(e)=>Ee(oe(Hl))(Ee(oe(e.left))(oe(e.right))),Column:(e)=>Ee(oe(Hl))(oe(e.react)),WithPageWidth:(e)=>Ee(oe(Hl))(oe(e.react)),Nesting:(e)=>Ee(oe(Hl))(oe(e.react)),Annotated:(e)=>Ee(oe(Hl))(Ee(oe(e.annotation))(oe(e.doc)))},nLt={Fail:(e,t)=>ql(t)&&t._tag==="Fail",Empty:(e,t)=>ql(t)&&t._tag==="Empty",Char:(e,t)=>ql(t)&&t._tag==="Char"&&e.char===t.char,Text:(e,t)=>ql(t)&&t._tag==="Text"&&e.text===t.text,Line:(e,t)=>ql(t)&&t._tag==="Line",FlatAlt:(e,t)=>ql(t)&&t._tag==="FlatAlt"&&ge(t.left)(e.left)&&ge(t.right)(e.right),Cat:(e,t)=>ql(t)&&t._tag==="Cat"&&ge(t.left)(e.left)&&ge(t.right)(e.right),Nest:(e,t)=>ql(t)&&t._tag==="Nest"&&e.indent===t.indent&&ge(t.doc)(e.doc),Union:(e,t)=>ql(t)&&t._tag==="Union"&&ge(t.left)(e.left)&&ge(t.right)(e.right),Column:(e,t)=>ql(t)&&t._tag==="Column"&&ge(t.react)(e.react),WithPageWidth:(e,t)=>ql(t)&&t._tag==="WithPageWidth"&&ge(t.react)(e.react),Nesting:(e,t)=>ql(t)&&t._tag==="Nesting"&&ge(t.react)(e.react),Annotated:(e,t)=>ql(t)&&t._tag==="Annotated"&&ge(t.annotation)(e.annotation)&&ge(t.doc)(e.doc)},Pu={[Pne]:{_A:(e)=>e},[Ne](){return lt(this,rLt[this._tag](this))},[Pe](e){return nLt[this._tag](this,e)},pipe(){return ce(this,arguments)}},ql=(e)=>typeof e==="object"&&e!=null&&(Pne in e);var RD=(e)=>e._tag==="Empty",Vp=(e)=>e._tag==="Char",Gp=(e)=>e._tag==="Text";var _E=(e)=>e._tag==="Cat",Dne=(e)=>e._tag==="Nest";var MD=(e)=>{let t=Object.create(Pu);return t._tag="Char",t.char=e,t},vE=(e)=>{let t=Object.create(Pu);return t._tag="Text",t.text=e,t},PD=p(2,(e,t)=>{let r=Object.create(Pu);return r._tag="FlatAlt",r.left=e,r.right=t,r}),f_=p(2,(e,t)=>{let r=Object.create(Pu);return r._tag="Union",r.left=e,r.right=t,r}),Bi=p(2,(e,t)=>{let r=Object.create(Pu);return r._tag="Cat",r.left=e,r.right=t,r}),DD=(()=>{let e=Object.create(Pu);return e._tag="Empty",e})(),VHe=(()=>{let e=Object.create(Pu);return e._tag="Fail",e})(),J$=(()=>{let e=Object.create(Pu);return e._tag="Line",e})(),GHe=PD(J$,MD(" ")),KHe=PD(J$,DD);var Fne=MD(" ");var JHe=(e)=>rqe(XHe(e)),QHe=p(2,(e,t)=>Bi(e,Bi(GHe,t))),YHe=p(2,(e,t)=>Bi(e,Bi(KHe,t)));var ZHe=p(2,(e,t)=>Bi(e,Bi(Fne,t))),Q$=p(2,(e,t)=>b4(De(e),{onEmpty:()=>DD,onNonEmpty:(r,n)=>dl(r,n,(o,s)=>t(s,o))})),XHe=(e)=>Q$(e,(t,r)=>YHe(t,r));var eqe=(e)=>Q$(e,(t,r)=>ZHe(t,r)),tqe=(e)=>Q$(e,(t,r)=>QHe(t,r));var rqe=(e)=>{switch(e._tag){case"FlatAlt":{let t=Mne(e.right);switch(t._tag){case"Flattened":return f_(t.value,e.left);case"AlreadyFlat":return f_(e.right,e.left);case"NeverFlat":return e.left}}case"Union":return e;default:{let t=Mne(e);return p_(t)?f_(t.value,e):e}}},d_=(e)=>{let t=Object.create(Pu);return t._tag="Column",t.react=e,t},m_=(e)=>{let t=Object.create(Pu);return t._tag="Nesting",t.react=e,t};var FD=(e)=>{let t=Object.create(Pu);return t._tag="WithPageWidth",t.react=e,t},mx=p(2,(e,t)=>t===0?e:(()=>{let r=Object.create(Pu);return r._tag="Nest",r.indent=t,r.doc=e,r})()),Nne=(e)=>d_((t)=>m_((r)=>mx(e,t-r))),nqe=p(2,(e,t)=>Nne(mx(e,t))),oqe=p(2,(e,t)=>nqe(Bi(sqe(t),e),t));var K$=(e)=>xr(gd(e)),gd=(e)=>$e(function*(){switch(e._tag){case"Fail":return e;case"Empty":return e;case"Char":return e;case"Text":return e;case"Line":return VHe;case"FlatAlt":return yield*gd(e.right);case"Cat":{let t=yield*gd(e.left),r=yield*gd(e.right);return Bi(t,r)}case"Nest":{let t=yield*gd(e.doc);return mx(t,e.indent)}case"Union":return yield*gd(e.left);case"Column":return d_((t)=>K$(e.react(t)));case"WithPageWidth":return FD((t)=>K$(e.react(t)));case"Nesting":return m_((t)=>K$(e.react(t)));case"Annotated":{let t=yield*gd(e.doc);return h_(t,e.annotation)}}}),Mne=(e)=>xr(TD(e)),TD=(e)=>$e(function*(){switch(e._tag){case"Fail":case"Line":return G$;case"Empty":case"Char":case"Text":return V$;case"FlatAlt":{let t=yield*gd(e.right);return eh(t)}case"Cat":{let t=yield*TD(e.left),r=yield*TD(e.right);if(Tne(t)||Tne(r))return G$;if(p_(t)&&p_(r))return eh(Bi(t.value,r.value));if(p_(t)&&vD(r))return eh(Bi(t.value,e.right));if(vD(t)&&p_(r))return eh(Bi(e.left,r.value));if(vD(t)&&vD(r))return V$;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*d(TD(e.doc),W(Rne((t)=>mx(t,e.indent))));case"Union":return eh(e.left);case"Column":{let t=d_((r)=>xr(gd(e.react(r))));return eh(t)}case"WithPageWidth":{let t=FD((r)=>xr(gd(e.react(r))));return eh(t)}case"Nesting":{let t=m_((r)=>xr(gd(e.react(r))));return eh(t)}case"Annotated":return yield*d(TD(e.doc),W(Rne((t)=>h_(t,e.annotation))))}}),h_=p(2,(e,t)=>{let r=Object.create(Pu);return r._tag="Annotated",r.doc=e,r.annotation=t,r});var sqe=(e)=>{if(e<=0)return DD;if(e===1)return MD(" ");return vE(iqe(e))};var iqe=(e)=>{let t="";for(let r=0;r<e;r++)t=t+=" ";return t};var TE="@effect/printer/DocStream",cqe=Symbol.for(TE),oLt={FailedStream:(e)=>d(It("@effect/printer/DocStream/FailedStream"),Ee(It(TE))),EmptyStream:(e)=>d(It("@effect/printer/DocStream/EmptyStream"),Ee(It(TE))),CharStream:(e)=>d(oe("@effect/printer/DocStream/CharStream"),Ee(It(TE)),Ee(It(e.char)),Ee(oe(e.stream))),TextStream:(e)=>d(It("@effect/printer/DocStream/TextStream"),Ee(It(TE)),Ee(It(e.text)),Ee(oe(e.stream))),LineStream:(e)=>d(It("@effect/printer/DocStream/LineStream"),Ee(It(TE)),Ee(oe(e.stream))),PushAnnotationStream:(e)=>d(It("@effect/printer/DocStream/PopAnnotationStream"),Ee(It(TE)),Ee(oe(e.annotation)),Ee(oe(e.stream))),PopAnnotationStream:(e)=>d(It("@effect/printer/DocStream/PopAnnotationStream"),Ee(It(TE)),Ee(oe(e.stream)))},sLt={FailedStream:(e,t)=>Uw(t)&&t._tag==="FailedStream",EmptyStream:(e,t)=>Uw(t)&&t._tag==="EmptyStream",CharStream:(e,t)=>Uw(t)&&t._tag==="CharStream"&&e.char===t.char&&ge(e.stream,t.stream),TextStream:(e,t)=>Uw(t)&&t._tag==="TextStream"&&e.text===t.text&&ge(e.stream,t.stream),LineStream:(e,t)=>Uw(t)&&t._tag==="LineStream"&&ge(e.stream,t.stream),PushAnnotationStream:(e,t)=>Uw(t)&&t._tag==="PushAnnotationStream"&&ge(e.annotation,t.annotation)&&ge(e.stream,t.stream),PopAnnotationStream:(e,t)=>Uw(t)&&t._tag==="PopAnnotationStream"&&ge(e.stream,t.stream)},Hw={[cqe]:{_A:(e)=>e},[Ne](){return lt(this,oLt[this._tag](this))},[Pe](e){return sLt[this._tag](this,e)}},Uw=(e)=>typeof e==="object"&&e!=null&&(cqe in e);var lqe=(e)=>e._tag==="EmptyStream";var uqe=(e)=>e._tag==="LineStream";var Lne=(()=>{let e=Object.create(Hw);return e._tag="FailedStream",e})(),Une=(()=>{let e=Object.create(Hw);return e._tag="EmptyStream",e})(),Hne=p(2,(e,t)=>{let r=Object.create(Hw);return r._tag="CharStream",r.char=t,r.stream=e,r}),qne=p(2,(e,t)=>{let r=Object.create(Hw);return r._tag="TextStream",r.text=t,r.stream=e,r}),Bne=p(2,(e,t)=>{let r=Object.create(Hw);return r._tag="LineStream",r.indentation=t,r.stream=e,r}),pqe=p(2,(e,t)=>{let r=Object.create(Hw);return r._tag="PushAnnotationStream",r.annotation=t,r.stream=e,r}),fqe=(e)=>{let t=Object.create(Hw);return t._tag="PopAnnotationStream",t.stream=e,t};var dqe={_tag:"Nil"},Kp=(e,t,r)=>({_tag:"Cons",indent:e,document:t,pipeline:r}),mqe=(e)=>({_tag:"UndoAnnotation",pipeline:e});var Wne="@effect/printer/PageWidth",Y$=Symbol.for(Wne),cLt={AvailablePerLine:(e)=>d(oe("@effect/printer/PageWidth/AvailablePerLine"),Ee(oe(Wne)),Ee(oe(e.lineWidth)),Ee(oe(e.ribbonFraction))),Unbounded:(e)=>d(oe("@effect/printer/PageWidth/Unbounded"),Ee(oe(Wne)))},lLt={AvailablePerLine:(e,t)=>zne(t)&&t._tag==="AvailablePerLine"&&e.lineWidth===t.lineWidth&&e.ribbonFraction===t.ribbonFraction,Unbounded:(e,t)=>zne(t)&&t._tag==="Unbounded"},hqe={[Y$]:Y$,[Ne](){return lt(this,cLt[this._tag](this))},[Pe](e){return lLt[this._tag](this,e)}},zne=(e)=>typeof e==="object"&&e!=null&&(Y$ in e);var gqe=(e,t)=>{let r=Object.create(hqe);return r._tag="AvailablePerLine",r.lineWidth=e,r.ribbonFraction=t,r},Z$=(()=>{let e=Object.create(hqe);return e._tag="Unbounded",e})(),$ne=gqe(80,1),X$=(e,t,r,n)=>{let o=e-n,s=Math.max(0,Math.min(e,Math.floor(e*t))),i=r+s-n;return Math.min(o,i)};var yqe=(e)=>({pageWidth:e});var ej=p(3,(e,t,r)=>xr(uLt(Kp(0,e,dqe),0,0,t,r))),uLt=(e,t,r,n,o)=>{let s=(i,a,c)=>$e(function*(){switch(i._tag){case"Nil":return Une;case"Cons":switch(i.document._tag){case"Fail":return Lne;case"Empty":return yield*s(i.pipeline,a,c);case"Char":{let l=yield*s(i.pipeline,a,c+1);return Hne(l,i.document.char)}case"Text":{let l=i.document.text.length,u=yield*s(i.pipeline,a,c+l);return qne(u,i.document.text)}case"Line":{let l=yield*s(i.pipeline,i.indent,i.indent),u=lqe(l)||uqe(l)?0:i.indent;return Bne(l,u)}case"FlatAlt":{let l=Kp(i.indent,i.document.left,i.pipeline);return yield*s(l,a,c)}case"Cat":{let l=Kp(i.indent,i.document.right,i.pipeline),u=Kp(i.indent,i.document.left,l);return yield*s(u,a,c)}case"Nest":{let l=i.indent+i.document.indent,u=Kp(l,i.document.doc,i.pipeline);return yield*s(u,a,c)}case"Union":{let l=Kp(i.indent,i.document.left,i.pipeline),u=Kp(i.indent,i.document.right,i.pipeline),f=s(l,a,c),h=s(u,a,c);return pLt(n,a,c,f,h)}case"Column":{let l=i.document.react(c),u=Kp(i.indent,l,i.pipeline);return yield*s(u,a,c)}case"WithPageWidth":{let l=i.document.react(o.pageWidth),u=Kp(i.indent,l,i.pipeline);return yield*s(u,a,c)}case"Nesting":{let l=i.document.react(i.indent),u=Kp(i.indent,l,i.pipeline);return yield*s(u,a,c)}case"Annotated":{let l=mqe(i.pipeline),u=Kp(i.indent,i.document.doc,l),f=yield*s(u,a,c);return pqe(f,i.document.annotation)}}case"UndoAnnotation":{let l=yield*s(i.pipeline,t,r);return fqe(l)}}});return s(e,t,r)},pLt=(e,t,r,n,o)=>{let s=xr(n),i=void 0;return e(s,t,r,()=>i??(i=xr(o),i))?s:i??xr(o)},Sqe=(e)=>xr(Du(Kh(e),0)),Du=(e,t)=>$e(function*(){if(Rc(e))return Une;let{head:r,tail:n}=e;switch(r._tag){case"Fail":return Lne;case"Empty":return yield*Du(n,t);case"Char":{let o=yield*Du(n,t+1);return Hne(o,r.char)}case"Text":{let o=yield*Du(n,t+r.text.length);return qne(o,r.text)}case"Line":{let o=yield*Du(n,0);return Bne(o,0)}case"FlatAlt":return yield*Du(Js(r.left,n),t);case"Cat":{let o=Js(r.left,Js(r.right,n));return yield*Du(o,t)}case"Nest":return yield*Du(Js(r.doc,n),t);case"Union":return yield*Du(Js(r.right,n),t);case"Column":return yield*Du(Js(r.react(t),n),t);case"WithPageWidth":return yield*Du(Js(r.react(Z$),n),t);case"Nesting":return yield*Du(Js(r.react(0),n),t);case"Annotated":return yield*Du(Js(r.doc,n),t)}}),Eqe=p(2,(e,t)=>{let r=t.pageWidth;if(r._tag==="AvailablePerLine")return ej(e,(n,o,s)=>{let i=X$(r.lineWidth,r.ribbonFraction,o,s);return fLt(n,i)},t);return jne(e)}),fLt=(e,t)=>{let r=t,n=e;while(r>=0)switch(n._tag){case"FailedStream":return!1;case"EmptyStream":return!0;case"CharStream":{r=r-1,n=n.stream;break}case"TextStream":{r=r-n.text.length,n=n.stream;break}case"LineStream":return!0;case"PushAnnotationStream":{n=n.stream;break}case"PopAnnotationStream":{n=n.stream;break}}return!1},bqe=p(2,(e,t)=>{let r=t.pageWidth;if(r._tag==="AvailablePerLine")return ej(e,dLt(r.lineWidth,r.ribbonFraction),t);return jne(e)}),dLt=(e,t)=>(r,n,o,s)=>{let i=X$(e,t,n,o);return mLt(r,s,e,o,i)},mLt=(e,t,r,n,o)=>{let s,i=e,a=o;while(a>=0)switch(i._tag){case"FailedStream":return!1;case"EmptyStream":return!0;case"CharStream":{a=a-1,i=i.stream;break}case"TextStream":{a=a-i.text.length,i=i.stream;break}case"LineStream":{if(!s)s=be(hLt(t()),{onNone:()=>n,onSome:(c)=>Math.min(c,n)});if(s<i.indentation)return!1;a=r-i.indentation,i=i.stream;break}case"PushAnnotationStream":{i=i.stream;break}case"PopAnnotationStream":{i=i.stream;break}}return!1},hLt=(e)=>{let t=e;while(t._tag==="LineStream"||t._tag==="PushAnnotationStream"||t._tag==="PopAnnotationStream"){if(t._tag==="LineStream")return _(t.indentation);t=t.stream}return R()},jne=(e)=>ej(e,(t)=>!gLt(t),{pageWidth:Z$}),gLt=(e)=>{let t=e;while(!0)switch(t._tag){case"FailedStream":return!0;case"EmptyStream":return!1;case"CharStream":{t=t.stream;break}case"TextStream":{t=t.stream;break}case"LineStream":return!1;case"PushAnnotationStream":{t=t.stream;break}case"PopAnnotationStream":{t=t.stream;break}}throw Error("bug")};var qw=MD,et=vE;var Dr=DD;var Vn=J$;var zt=Fne;var se=Bi,Vne=JHe;var ha=eqe,ao=tqe;var Za=mx,hx=Nne;var tj=oqe;var Le=h_;var Cqe=Le(Dr,gne),wqe=(e,t)=>Le(Dr,xne(e,t)),kqe=(e,t)=>Le(Dr,yne(e,t));var Iqe=(e=1)=>Le(Dr,Sne(e));var Aqe=Le(Dr,Ene),Oqe=Le(Dr,bne),_qe=Le(Dr,Cne);var vqe=Le(Dr,wne),Tqe=Le(Dr,kne),Rqe=(e)=>Le(Dr,Ine(e));var Mqe=Le(Dr,Ane);var Gne=$ne;var Kne=yqe;var Pqe=Sqe,Dqe=Eqe,Fqe=bqe;var Lqe=p(2,(e,t)=>{switch(t.style){case"compact":return Jne(Pqe(e));case"pretty":{let r=Object.assign({},Gne,t.options);return Jne(Dqe(e,Kne(r)))}case"smart":{let r=Object.assign({},Gne,t.options);return Jne(Fqe(e,Kne(r)))}}}),Jne=(e)=>xr(g_(e,Kh(AHe))),Nqe=(e)=>{if(Rc(e))throw Error("BUG: AnsiRender.unsafePeek - peeked at an empty stack - please report an issue at https://github.com/Effect-TS/printer/issues");return e.head},CLt=(e)=>{if(Rc(e))throw Error("BUG: AnsiRender.unsafePop - popped from an empty stack - please report an issue at https://github.com/Effect-TS/printer/issues");return[e.head,e.tail]},g_=(e,t)=>{switch(e._tag){case"FailedStream":return $f("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 N("");case"CharStream":return W(Qe(()=>g_(e.stream,t)),(r)=>e.char+r);case"TextStream":return W(Qe(()=>g_(e.stream,t)),(r)=>e.text+r);case"LineStream":{let r=`
|
|
191
|
+
`;for(let n=0;n<e.indentation;n++)r=r+=" ";return W(Qe(()=>g_(e.stream,t)),(n)=>r+n)}case"PushAnnotationStream":{let r=Nqe(t),n=$$(e.annotation,r);return W(Qe(()=>g_(e.stream,Js(e.annotation,t))),(o)=>z$(n)+o)}case"PopAnnotationStream":{let[,r]=CLt(t),n=Nqe(r);return W(Qe(()=>g_(e.stream,r)),(o)=>z$(n)+o)}}};var bc=Cqe,Uqe=wqe,Hqe=kqe;var x_=Iqe;var Bl=Aqe,RE=Oqe,ME=_qe;var Fu=vqe,qqe=Tqe,Bqe=Rqe;var Cc=Mqe;var hr=Lqe;var Wqe=p(2,(e,t)=>xr(rj(e,t))),rj=(e,t)=>{let r=(n)=>$e(function*(){switch(n._tag){case"Fail":case"Empty":case"Char":case"Text":case"Line":return n;case"FlatAlt":{let o=yield*r(n.left),s=yield*r(n.right);return PD(o,s)}case"Cat":{if(RD(n.left))return yield*r(n.right);if(RD(n.right))return yield*r(n.left);if(Vp(n.left)&&Vp(n.right))return vE(n.left.char+n.right.char);if(Gp(n.left)&&Vp(n.right))return vE(n.left.text+n.right.char);if(Vp(n.left)&&Gp(n.right))return vE(n.left.char+n.right.text);if(Gp(n.left)&&Gp(n.right))return vE(n.left.text+n.right.text);if(Vp(n.left)&&_E(n.right)&&Vp(n.right.left)||Vp(n.left)&&_E(n.right)&&Gp(n.right.left)||Gp(n.left)&&_E(n.right)&&Vp(n.right.left)||Gp(n.left)&&_E(n.right)&&Gp(n.right.left)){let i=yield*r(Bi(n.left,n.right.left));return yield*r(Bi(i,n.right.right))}if(_E(n.left)&&Vp(n.left.right)||_E(n.left)&&Gp(n.left.right)){let i=yield*r(Bi(n.left.right,n.right));return yield*r(Bi(n.left.left,i))}let o=yield*r(n.left),s=yield*r(n.right);return Bi(o,s)}case"Nest":{if(n.indent===0)return yield*r(n.doc);if(RD(n.doc)||Vp(n.doc)||Gp(n.doc))return n.doc;if(Dne(n.doc)){let o=n.indent+n.doc.indent;return yield*r(mx(n.doc.doc,o))}return mx(yield*r(n.doc),n.indent)}case"Union":{let o=yield*r(n.left),s=yield*r(n.right);return f_(o,s)}case"Column":return t._tag==="Shallow"?n:d_((o)=>xr(rj(n.react(o),t)));case"WithPageWidth":return t._tag==="Shallow"?n:FD((o)=>xr(rj(n.react(o),t)));case"Nesting":return t._tag==="Shallow"?n:m_((o)=>xr(rj(n.react(o),t)));case"Annotated":return h_(yield*r(n.doc),n.annotation)}});return r(e)};var Dn={_tag:"Deep"},Fn=Wqe;var zqe=H$;var Qne=fne,nj=q$,$qe=B$;var $t=(e)=>({_tag:"Text",value:e}),Nu=$t(""),Wl=$t(" "),rh=(e)=>PE(e,$qe),jqe=(e)=>PE(e,zqe),PE=(e,t)=>({_tag:"Highlight",value:typeof e==="string"?$t(e):e,color:t}),oj=(e)=>({_tag:"Strong",value:typeof e==="string"?$t(e):e});var Vqe=(e)=>({_tag:"Weak",value:typeof e==="string"?$t(e):e});var Zne=(e)=>e._tag==="Text";var Xa=p(2,(e,t)=>({_tag:"Sequence",left:e,right:t})),th=(e)=>{switch(e._tag){case"Text":case"URI":return e.value;case"Highlight":case"Weak":case"Strong":return th(e.value);case"Sequence":return th(e.left)+th(e.right)}},zl=(e)=>{let t=De(e);if(ut(t))return t.slice(1).reduce(Xa,t[0]);return Nu},Xne=(e)=>Bw(e)===0,Bw=(e)=>{switch(e._tag){case"Text":case"URI":return e.value.length;case"Highlight":case"Strong":case"Weak":return Bw(e.value);case"Sequence":return Bw(e.left)+Bw(e.right)}},xx=(e)=>{switch(e._tag){case"Highlight":return Le(xx(e.value),zHe(e.color));case"Sequence":return se(xx(e.left),xx(e.right));case"Strong":return Le(xx(e.value),Ws);case"Text":return et(e.value);case"URI":return Le(et(e.value),Yc);case"Weak":return Le(xx(e.value),$He)}};var nh=(e)=>e._tag==="Empty",eoe=(e)=>e._tag==="Header",toe=(e)=>e._tag==="Paragraph",roe=(e)=>e._tag==="DescriptionList",Gqe=(e)=>e._tag==="Enumeration",Kqe=(e)=>e._tag==="Sequence",Gn={_tag:"Empty"},Rt=p(2,(e,t)=>{if(nh(e))return t;if(nh(t))return e;return{_tag:"Sequence",left:e,right:t}}),Jqe=p(2,(e,t)=>nh(e)?t:e),sj=(e)=>{let t=De(e);if(ut(t))return t.slice(1).reduce(Rt,t[0]);return Gn},Qp=(e)=>eoe(e)||toe(e)?e.value:Nu,yx=(e)=>({_tag:"DescriptionList",definitions:e}),y_=(e)=>({_tag:"Enumeration",elements:e}),Yp=(e)=>({_tag:"Header",value:typeof e==="string"?$t(e):e,level:1}),Qqe=(e)=>({_tag:"Header",value:typeof e==="string"?$t(e):e,level:2}),Yqe=(e)=>({_tag:"Header",value:typeof e==="string"?$t(e):e,level:3}),He=(e)=>({_tag:"Paragraph",value:typeof e==="string"?$t(e):e}),xd=p(2,(e,t)=>roe(e)?yx(Ke(e.definitions,([r,n])=>t(r,n))):e),noe=(e)=>Fn(ND(e),Dn),fn=(e)=>hr(noe(e),{style:"pretty"}),ND=(e)=>{switch(e._tag){case"Empty":return Dr;case"Header":return d(Le(xx(e.value),Ws),se(Vn));case"Paragraph":return d(xx(e.value),se(Vn));case"DescriptionList":{let t=e.definitions.map(([r,n])=>Vne([Le(xx(r),Ws),Dr,tj(ND(n),2)]));return ao(t)}case"Enumeration":{let t=e.elements.map((r)=>se(et("- "),ND(r)));return tj(ao(t),2)}case"Sequence":return ao([ND(e.left),ND(e.right)])}};var Zqe=KW;var ooe=(e)=>({...DE,...e}),S_=qt("@effect/cli/CliConfig"),DE={isCaseSensitive:!1,autoCorrectLimit:2,finalCheckBuiltIn:!1,showAllNames:!0,showBuiltIns:!0,showTypes:!0},Xqe=Hs(S_,DE),eBe=(e)=>Hs(S_,ooe(e)),bi=p(2,(e,t)=>e.isCaseSensitive?t:t.toLowerCase());var Es={};Ht(Es,{QuitException:()=>ij,Terminal:()=>zr,isQuitException:()=>soe});var tBe=qt("@effect/platform/Terminal");class ij extends fR("QuitException"){}var soe=(e)=>typeof e==="object"&&e!=null&&("_tag"in e)&&e._tag==="QuitException",zr=tBe;var ze=pR();var OLt="@effect/cli/Prompt",aj=Symbol.for(OLt),aoe={...cg,[aj]:{_Output:(e)=>e},commit(){return UD(this)},pipe(){return ce(this,arguments)}},cj=(e)=>typeof e==="object"&&e!=null&&(aj in e),rBe=(e)=>{if(e.length===0)return lj([]);if(e.length===1)return ga(e[0],(r)=>[r]);let t=ga(e[0],(r)=>[r]);for(let r=1;r<e.length;r++){let n=e[r];t=LD(t,(o)=>ga(n,(s)=>[...o,s]))}return t},nBe=function(){if(arguments.length===1)if(cj(arguments[0]))return ga(arguments[0],(e)=>[e]);else if(Array.isArray(arguments[0]))return rBe(arguments[0]);else{let e=Object.entries(arguments[0]),t=ga(e[0][1],(n)=>({[e[0][0]]:n}));if(e.length===1)return t;let r=e.slice(1);for(let[n,o]of r)t=t.pipe(LD((s)=>o.pipe(ga((i)=>({...s,[n]:i})))));return t}return rBe(arguments[0])},Wi=(e,t)=>{let r=Object.create(aoe);return r._tag="Loop",r.initialState=e,r.render=t.render,r.process=t.process,r.clear=t.clear,r},ga=p(2,(e,t)=>LD(e,(r)=>lj(t(r)))),LD=p(2,(e,t)=>{let r=Object.create(aoe);return r._tag="OnSuccess",r.prompt=e,r.onSuccess=t,r}),UD=Wn(function*(e){let t=yield*zr,r=yield*t.readInput;return yield*ioe(e,t,r)},br(()=>new ij),ei),ioe=(e,t,r)=>Qe(()=>{let n=e;switch(n._tag){case"Loop":return _Lt(n,t,r);case"OnSuccess":return L(ioe(n.prompt,t,r),(o)=>ioe(n.onSuccess(o),t,r));case"Succeed":return N(n.value)}}),_Lt=Wn(function*(e,t,r){let n=mn(e.initialState)?yield*e.initialState:e.initialState,o=ze.NextFrame({state:n});while(!0){let s=yield*e.render(n,o);yield*Pr(t.display(s));let i=yield*r.take;switch(o=yield*e.process(i,n),o._tag){case"Beep":continue;case"NextFrame":{yield*Pr(t.display(yield*e.clear(n,o))),n=o.state;continue}case"Submit":{yield*Pr(t.display(yield*e.clear(n,o)));let a=yield*e.render(n,o);return yield*Pr(t.display(a)),o.value}}}},(e,t,r)=>qa(e,Pr(r.display(hr(qqe,{style:"pretty"}))))),lj=(e)=>{let t=Object.create(aoe);return t._tag="Succeed",t.value=e,t};var Q={};Ht(Q,{MatcherTypeId:()=>FLt,SafeRefinementId:()=>g1t,any:()=>t1t,bigint:()=>i1t,boolean:()=>n1t,date:()=>c1t,defined:()=>r1t,discriminator:()=>WLt,discriminatorStartsWith:()=>zLt,discriminators:()=>$Lt,discriminatorsExhaustive:()=>jLt,either:()=>d1t,exhaustive:()=>h1t,instanceOf:()=>u1t,instanceOfUnsafe:()=>p1t,is:()=>ZLt,nonEmptyString:()=>YLt,not:()=>QLt,null:()=>s1t,number:()=>e1t,option:()=>m1t,orElse:()=>BD,orElseAbsurd:()=>f1t,record:()=>l1t,string:()=>XLt,symbol:()=>a1t,tag:()=>VLt,tagStartsWith:()=>GLt,tags:()=>KLt,tagsExhaustive:()=>JLt,type:()=>NLt,typeTags:()=>ULt,undefined:()=>o1t,value:()=>qD,valueTags:()=>LLt,when:()=>Uu,whenAnd:()=>BLt,whenOr:()=>qLt,withReturnType:()=>HLt});var uj=Symbol.for("@effect/matcher/Matcher"),vLt={[uj]:{_input:te,_filters:te,_remaining:te,_result:te,_return:te},_tag:"TypeMatcher",add(e){return pj([...this.cases,e])},pipe(){return ce(this,arguments)}};function pj(e){let t=Object.create(vLt);return t.cases=e,t}var TLt={[uj]:{_input:te,_filters:te,_remaining:te,_result:te,_provided:te,_return:te},_tag:"ValueMatcher",add(e){if(this.value._tag==="Right")return this;if(e._tag==="When"&&e.guard(this.provided)===!0)return coe(this.provided,ye(e.evaluate(this.provided)));else if(e._tag==="Not"&&e.guard(this.provided)===!1)return coe(this.provided,ye(e.evaluate(this.provided)));return this},pipe(){return ce(this,arguments)}};function coe(e,t){let r=Object.create(TLt);return r.provided=e,r.value=t,r}var b_=(e,t)=>({_tag:"When",guard:e,evaluate:t}),RLt=(e,t)=>({_tag:"Not",guard:e,evaluate:t}),E_=(e)=>{if(typeof e==="function")return e;else if(Array.isArray(e)){let t=e.map(E_),r=t.length;return(n)=>{if(!Array.isArray(n))return!1;for(let o=0;o<r;o++)if(t[o](n[o])===!1)return!1;return!0}}else if(e!==null&&typeof e==="object"){let t=Object.entries(e).map(([n,o])=>[n,E_(o)]),r=t.length;return(n)=>{if(typeof n!=="object"||n===null)return!1;for(let o=0;o<r;o++){let[s,i]=t[o];if(!(s in n)||i(n[s])===!1)return!1}return!0}}return(t)=>t===e},MLt=(e)=>{let t=e.map(E_),r=t.length;return(n)=>{for(let o=0;o<r;o++)if(t[o](n)===!0)return!0;return!1}},PLt=(e)=>{let t=e.map(E_),r=t.length;return(n)=>{for(let o=0;o<r;o++)if(t[o](n)===!1)return!1;return!0}},sBe=()=>pj([]),iBe=(e)=>coe(e,Ie(e)),aBe=p(2,(e,t)=>dj(t)(pj([]))(e)),cBe=()=>(e)=>{let t=dj(e)(pj([]));return(r)=>t(r)},lBe=()=>(e)=>e,uBe=(e,t)=>(r)=>r.add(b_(E_(e),t)),pBe=(...e)=>(t)=>{let r=e[e.length-1],n=e.slice(0,-1);return t.add(b_(MLt(n),r))},fBe=(...e)=>(t)=>{let r=e[e.length-1],n=e.slice(0,-1);return t.add(b_(PLt(n),r))},loe=(e)=>(...t)=>{let r=t[t.length-1],n=t.slice(0,-1),o=n.length===1?(s)=>s!=null&&s[e]===n[0]:(s)=>s!=null&&n.includes(s[e]);return(s)=>s.add(b_(o,r))},uoe=(e)=>(t,r)=>{let n=(o)=>o!=null&&typeof o[e]==="string"&&o[e].startsWith(t);return(o)=>o.add(b_(n,r))},fj=(e)=>(t)=>{let r=b_((n)=>n!=null&&(n[e]in t),(n)=>t[n[e]](n));return(n)=>n.add(r)},poe=(e)=>(t)=>{let r=fj(e)(t);return(n)=>moe(r(n))},dBe=loe("_tag"),mBe=uoe("_tag"),hBe=fj("_tag"),dj=poe("_tag"),gBe=(e,t)=>(r)=>r.add(RLt(E_(e),t)),xBe=(e)=>typeof e==="string"&&e.length>0,yBe=(...e)=>{let t=e.length;return(r)=>{for(let n=0;n<t;n++)if(r===e[n])return!0;return!1}},SBe=()=>!0,EBe=(e)=>e!==void 0&&e!==null,foe=(e)=>(t)=>t instanceof e;var doe=(e)=>(t)=>{let r=HD(t);if(Bd(r))return r._tag==="Right"?r.right:e(r.left);return(n)=>{let o=r(n);return o._tag==="Right"?o.right:e(o.left)}},bBe=(e)=>doe(()=>{throw Error("effect/Match/orElseAbsurd: absurd")})(e),HD=(e)=>{if(e._tag==="ValueMatcher")return e.value;let t=e.cases.length;if(t===1){let r=e.cases[0];return(n)=>{if(r._tag==="When"&&r.guard(n)===!0)return ye(r.evaluate(n));else if(r._tag==="Not"&&r.guard(n)===!1)return ye(r.evaluate(n));return Ie(n)}}return(r)=>{for(let n=0;n<t;n++){let o=e.cases[n];if(o._tag==="When"&&o.guard(r)===!0)return ye(o.evaluate(r));else if(o._tag==="Not"&&o.guard(r)===!1)return ye(o.evaluate(r))}return Ie(r)}},CBe=(e)=>{let t=HD(e);if(Bd(t))return Ir(t,{onLeft:()=>R(),onRight:_});return(r)=>Ir(t(r),{onLeft:()=>R(),onRight:_})},oBe="effect/Match/exhaustive: absurd",moe=(e)=>{let t=HD(e);if(Bd(t)){if(t._tag==="Right")return t.right;throw Error(oBe)}return(r)=>{let n=t(r);if(n._tag==="Right")return n.right;throw Error(oBe)}};var FLt=uj,NLt=sBe,qD=iBe,LLt=aBe,ULt=cBe,HLt=lBe,Uu=uBe,qLt=pBe,BLt=fBe,WLt=loe,zLt=uoe,$Lt=fj,jLt=poe,VLt=dBe,GLt=mBe,KLt=hBe,JLt=dj,QLt=gBe,YLt=xBe,ZLt=yBe,XLt=Jr,e1t=li,t1t=SBe,r1t=EBe,n1t=ji,o1t=_h;var s1t=Wle;var i1t=Ld,a1t=Yu,c1t=Bk,l1t=Xu,u1t=foe,p1t=foe,BD=doe,f1t=bBe,d1t=HD,m1t=CBe,h1t=moe,g1t=Symbol.for("effect/SafeRefinement");var WD={arrowUp:et("↑"),arrowDown:et("↓"),arrowLeft:et("←"),arrowRight:et("→"),radioOn:et("◉"),radioOff:et("◯"),checkboxOn:et("☒"),checkboxOff:et("☐"),tick:et("✔"),cross:et("✖"),ellipsis:et("…"),pointerSmall:et("›"),line:et("─"),pointer:et("❯")},x1t={arrowUp:WD.arrowUp,arrowDown:WD.arrowDown,arrowLeft:WD.arrowLeft,arrowRight:WD.arrowRight,radioOn:et("(*)"),radioOff:et("( )"),checkboxOn:et("[*]"),checkboxOff:et("[ ]"),tick:et("√"),cross:et("×"),ellipsis:et("..."),pointerSmall:et("»"),line:et("─"),pointer:et(">")},cs=W(Ce(()=>process.platform==="win32"),(e)=>e?x1t:WD);function oi(e,t){if(t===0)return se(Cc,Uqe(0));let r=0,n=e.split(/\r?\n/);for(let o of n)r+=1+Math.floor(Math.max(o.length-1,0)/t);return Bqe(r)}function C_(e,t){let r=e.split(/\r?\n/);return t===0?r.length:d(Ke(r,(n)=>Math.ceil(n.length/t)),ki(0,(n,o)=>n+o))}var y1t=hr(bc,{style:"pretty"});function S1t(e){return(t,r)=>$e(function*(){let o=yield*(yield*zr).columns,s=se(Cc,Bl),i=be(t.error,{onNone:()=>Dr,onSome:(c)=>x_(C_(c,o)).pipe(se(oi(`
|
|
192
|
+
${c}`,o)))}),a=oi(e.message,o);return i.pipe(se(a),se(s),Fn(Dn),hr({style:"pretty",options:{lineWidth:o}}))})}var E1t=/\r?\n/;function b1t(e,t){return be(e.error,{onNone:()=>Dr,onSome:(r)=>{let n=r.split(E1t);if(ut(n)){let o=(a)=>Le(et(a),Ei(OE,Ul)),s=se(Le(t,Ul),zt),i=Ke(n,(a)=>o(a));return RE.pipe(se(Vn),se(s),se(hx(ao(i))),se(ME))}return Dr}})}function kBe(e,t=!1){return ki(e.dateParts,Dr,(r,n,o)=>{let s=et(n.toString());if(o===e.cursor&&!t){let i=Ei(Yc,Ro);return se(r,Le(s,i))}return se(r,s)})}function IBe(e,t,r,n){let o=(i)=>Le(et(i),Ws),s=se(e,zt);return es(n.message.split(/\r?\n/),{onEmpty:()=>ha([s,t,r]),onNonEmpty:(i)=>{let a=Ke(i,(c)=>o(c));return s.pipe(se(Za(ao(a),2)),se(zt),se(t),se(zt),se(r))}})}function C1t(e,t){return $e(function*(){let n=yield*(yield*zr).columns,o=yield*cs,s=Le(et("?"),Ro),i=Le(o.pointerSmall,rn),a=kBe(e),c=IBe(s,i,a,t),l=b1t(e,o.pointerSmall);return Fu.pipe(se(c),se(l),Fn(Dn),hr({style:"pretty",options:{lineWidth:n}}))})}function w1t(e,t){return $e(function*(){let n=yield*(yield*zr).columns,o=yield*cs,s=Le(o.tick,Ya),i=Le(o.ellipsis,rn),a=kBe(e,!0);return IBe(s,i,a,t).pipe(se(Vn),Fn(Dn),hr({style:"pretty",options:{lineWidth:n}}))})}function k1t(e){return e.dateParts[e.cursor].increment(),ze.NextFrame({state:{...e,typed:""}})}function I1t(e){return e.dateParts[e.cursor].decrement(),ze.NextFrame({state:{...e,typed:""}})}function A1t(e){let t=e.dateParts[e.cursor].previousPart();return be(t,{onNone:()=>ze.Beep(),onSome:(r)=>ze.NextFrame({state:{...e,typed:"",cursor:e.dateParts.indexOf(r)}})})}function O1t(e){let t=e.dateParts[e.cursor].nextPart();return be(t,{onNone:()=>ze.Beep(),onSome:(r)=>ze.NextFrame({state:{...e,typed:"",cursor:e.dateParts.indexOf(r)}})})}function _1t(e){let t=e.dateParts[e.cursor].nextPart(),r=be(t,{onNone:()=>e.dateParts.findIndex((n)=>!n.isToken()),onSome:(n)=>e.dateParts.indexOf(n)});return ze.NextFrame({state:{...e,cursor:r}})}function v1t(e,t){if(/\d/.test(e)){let r=t.typed+e;return t.dateParts[t.cursor].setValue(r),ze.NextFrame({state:{...t,typed:r}})}return ze.Beep()}var T1t={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 R1t(e){return(t,r)=>ze.$match(r,{Beep:()=>N(y1t),NextFrame:({state:n})=>C1t(n,e),Submit:()=>w1t(t,e)})}function M1t(e){return(t,r)=>{switch(t.key.name){case"left":return N(A1t(r));case"right":return N(O1t(r));case"k":case"up":return N(k1t(r));case"j":case"down":return N(I1t(r));case"tab":return N(_1t(r));case"enter":case"return":return Fs(e.validate(r.value),{onFailure:(n)=>ze.NextFrame({state:{...r,error:_(n)}}),onSuccess:(n)=>ze.Submit({value:n})});default:{let n=Je(t.input,()=>"");return N(v1t(n,r))}}}}var mj=(e)=>{let t={initial:new Date,dateMask:"YYYY-MM-DD HH:mm:ss",validate:N,...e,locales:{...T1t,...e.locales}},r=D1t(t.dateMask,t.initial,t.locales),n=r.findIndex((s)=>!s.isToken()),o={dateParts:r,typed:"",cursor:n,value:t.initial,error:R()};return Wi(o,{render:R1t(t),process:M1t(t),clear:S1t(t)})},P1t=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,wBe={1:({token:e,...t})=>new hoe({token:e.replace(/\\(.)/g,"$1"),...t}),2:(e)=>new TBe(e),3:(e)=>new RBe(e),4:(e)=>new MBe(e),5:(e)=>new PBe(e),6:(e)=>new vBe(e),7:(e)=>new _Be(e),8:(e)=>new OBe(e),9:(e)=>new ABe(e)},D1t=(e,t,r)=>{let n=[],o=null;while(o=P1t.exec(e)){let i=o.shift(),a=o.findIndex((c)=>c!==void 0);if(a in wBe){let c=o[a]||i;n.push(wBe[a]({token:c,date:t,parts:n,locales:r}))}else n.push(new hoe({token:o[a]||i,date:t,parts:n,locales:r}))}let s=n.reduce((i,a)=>{let c=i[i.length-1];if(a.isToken()&&c!==void 0&&c.isToken())c.setValue(a.token);else i.push(a);return i},Ge());return n.splice(0,n.length,...s),n};class oh{token;date;parts;locales;constructor(e){this.token=e.token,this.locales=e.locales,this.date=e.date||new Date,this.parts=e.parts||[this]}isToken(){return!1}nextPart(){return Xk(this.parts,(e)=>e===this).pipe(Qn((e)=>Kd(this.parts.slice(e+1),(t)=>!t.isToken())))}previousPart(){return Xk(this.parts,(e)=>e===this).pipe(Qn((e)=>eI(this.parts.slice(0,e),(t)=>!t.isToken())))}toString(){return String(this.date)}}class hoe extends oh{increment(){}decrement(){}setValue(e){this.token=this.token+e}isToken(){return!0}toString(){return this.token}}class ABe extends oh{increment(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}decrement(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setValue(e){this.date.setMilliseconds(Number.parseInt(e.slice(-this.token.length)))}toString(){return`${this.date.getMilliseconds()}`.padStart(4,"0").substring(0,this.token.length)}}class OBe extends oh{increment(){this.date.setSeconds(this.date.getSeconds()+1)}decrement(){this.date.setSeconds(this.date.getSeconds()-1)}setValue(e){this.date.setSeconds(Number.parseInt(e.slice(-2)))}toString(){let e=`${this.date.getSeconds()}`;return this.token.length>1?e.padStart(2,"0"):e}}class _Be extends oh{increment(){this.date.setMinutes(this.date.getMinutes()+1)}decrement(){this.date.setMinutes(this.date.getMinutes()-1)}setValue(e){this.date.setMinutes(Number.parseInt(e.slice(-2)))}toString(){let e=`${this.date.getMinutes()}`;return this.token.length>1?e.padStart(2,"0"):e}}class vBe extends oh{increment(){this.date.setHours(this.date.getHours()+1)}decrement(){this.date.setHours(this.date.getHours()-1)}setValue(e){this.date.setHours(Number.parseInt(e.slice(-2)))}toString(){let e=/h/.test(this.token)?this.date.getHours()%12||12:this.date.getHours();return this.token.length>1?`${e}`.padStart(2,"0"):`${e}`}}class TBe extends oh{increment(){this.date.setDate(this.date.getDate()+1)}decrement(){this.date.setDate(this.date.getDate()-1)}setValue(e){this.date.setDate(Number.parseInt(e.slice(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return qD(this.token).pipe(Uu("DD",()=>`${e}`.padStart(2,"0")),Uu("Do",()=>`${e}${this.ordinalIndicator(e)}`),Uu("d",()=>`${t+1}`),Uu("ddd",()=>this.locales.weekdaysShort[t]),Uu("dddd",()=>this.locales.weekdays[t]),BD(()=>`${e}`))}ordinalIndicator(e){return qD(e%10).pipe(Uu(1,()=>"st"),Uu(2,()=>"nd"),Uu(3,()=>"rd"),BD(()=>"th"))}}class RBe extends oh{increment(){this.date.setMonth(this.date.getMonth()+1)}decrement(){this.date.setMonth(this.date.getMonth()-1)}setValue(e){let t=Number.parseInt(e.slice(-2))-1;this.date.setMonth(t<0?0:t)}toString(){let e=this.date.getMonth();return qD(this.token.length).pipe(Uu(2,()=>`${e+1}`.padStart(2,"0")),Uu(3,()=>this.locales.monthsShort[e]),Uu(4,()=>this.locales.months[e]),BD(()=>`${e+1}`))}}class MBe extends oh{increment(){this.date.setFullYear(this.date.getFullYear()+1)}decrement(){this.date.setFullYear(this.date.getFullYear()-1)}setValue(e){this.date.setFullYear(Number.parseInt(e.slice(-4)))}toString(){let e=`${this.date.getFullYear()}`.padStart(4,"0");return this.token.length===2?e.substring(-2):e}}class PBe extends oh{increment(){this.date.setHours((this.date.getHours()+12)%24)}decrement(){this.increment()}setValue(e){}toString(){let e=this.date.getHours()>12?"pm":"am";return/A/.test(this.token)?e.toUpperCase():e}}var So={};Ht(So,{Path:()=>wc,TypeId:()=>NE,layer:()=>V1t});var gj=Symbol.for("@effect/platform/Path"),xj=qt("@effect/platform/Path");function FBe(e,t){let r="",n=0,o=-1,s=0,i;for(let a=0;a<=e.length;++a){if(a<e.length)i=e.charCodeAt(a);else if(i===47)break;else i=47;if(i===47){if(o===a-1||s===1);else if(o!==a-1&&s===2){if(r.length<2||n!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){let c=r.lastIndexOf("/");if(c!==r.length-1){if(c===-1)r="",n=0;else r=r.slice(0,c),n=r.length-1-r.lastIndexOf("/");o=a,s=0;continue}}else if(r.length===2||r.length===1){r="",n=0,o=a,s=0;continue}}if(t){if(r.length>0)r+="/..";else r="..";n=2}}else{if(r.length>0)r+="/"+e.slice(o+1,a);else r=e.slice(o+1,a);n=a-o-1}o=a,s=0}else if(i===46&&s!==-1)++s;else s=-1}return r}function F1t(e,t){let r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");if(!r)return n;if(r===t.root)return r+n;return r+e+n}function N1t(e){if(e.protocol!=="file:")return ie(new Qa({module:"Path",method:"fromFileUrl",description:"URL must be of scheme file"}));else if(e.hostname!=="")return ie(new Qa({module:"Path",method:"fromFileUrl",description:"Invalid file URL host"}));let t=e.pathname;for(let r=0;r<t.length;r++)if(t[r]==="%"){let n=t.codePointAt(r+2)|32;if(t[r+1]==="2"&&n===102)return ie(new Qa({module:"Path",method:"fromFileUrl",description:"must not include encoded / characters"}))}return N(decodeURIComponent(t))}var NBe=function(){let t="",r=!1,n=void 0;for(let o=arguments.length-1;o>=-1&&!r;o--){let s;if(o>=0)s=arguments[o];else{let i=globalThis.process;if(n===void 0&&"process"in globalThis&&typeof i==="object"&&i!==null&&typeof i.cwd==="function")n=i.cwd();s=n}if(s.length===0)continue;t=s+"/"+t,r=s.charCodeAt(0)===47}if(t=FBe(t,!r),r)if(t.length>0)return"/"+t;else return"/";else if(t.length>0)return t;else return"."},L1t=47;function U1t(e){let t=new URL("file://"),r=NBe(e);if(e.charCodeAt(e.length-1)===L1t&&r[r.length-1]!=="/")r+="/";return t.pathname=$1t(r),N(t)}var H1t=/%/g,q1t=/\\/g,B1t=/\n/g,W1t=/\r/g,z1t=/\t/g;function $1t(e){if(e.includes("%"))e=e.replace(H1t,"%25");if(e.includes("\\"))e=e.replace(q1t,"%5C");if(e.includes(`
|
|
193
|
+
`))e=e.replace(B1t,"%0A");if(e.includes("\r"))e=e.replace(W1t,"%0D");if(e.includes("\t"))e=e.replace(z1t,"%09");return e}var hj=xj.of({[gj]:gj,resolve:NBe,normalize(e){if(e.length===0)return".";let t=e.charCodeAt(0)===47,r=e.charCodeAt(e.length-1)===47;if(e=FBe(e,!t),e.length===0&&!t)e=".";if(e.length>0&&r)e+="/";if(t)return"/"+e;return e},isAbsolute(e){return e.length>0&&e.charCodeAt(0)===47},join(){if(arguments.length===0)return".";let e;for(let t=0;t<arguments.length;++t){let r=arguments[t];if(r.length>0)if(e===void 0)e=r;else e+="/"+r}if(e===void 0)return".";return hj.normalize(e)},relative(e,t){if(e===t)return"";if(e=hj.resolve(e),t=hj.resolve(t),e===t)return"";let r=1;for(;r<e.length;++r)if(e.charCodeAt(r)!==47)break;let n=e.length,o=n-r,s=1;for(;s<t.length;++s)if(t.charCodeAt(s)!==47)break;let a=t.length-s,c=o<a?o:a,l=-1,u=0;for(;u<=c;++u){if(u===c){if(a>c){if(t.charCodeAt(s+u)===47)return t.slice(s+u+1);else if(u===0)return t.slice(s+u)}else if(o>c){if(e.charCodeAt(r+u)===47)l=u;else if(u===0)l=0}break}let h=e.charCodeAt(r+u),y=t.charCodeAt(s+u);if(h!==y)break;else if(h===47)l=u}let f="";for(u=r+l+1;u<=n;++u)if(u===n||e.charCodeAt(u)===47)if(f.length===0)f+="..";else f+="/..";if(f.length>0)return f+t.slice(s+l);else{if(s+=l,t.charCodeAt(s)===47)++s;return t.slice(s)}},dirname(e){if(e.length===0)return".";let t=e.charCodeAt(0),r=t===47,n=-1,o=!0;for(let s=e.length-1;s>=1;--s)if(t=e.charCodeAt(s),t===47){if(!o){n=s;break}}else o=!1;if(n===-1)return r?"/":".";if(r&&n===1)return"//";return e.slice(0,n)},basename(e,t){let r=0,n=-1,o=!0,s;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let i=t.length-1,a=-1;for(s=e.length-1;s>=0;--s){let c=e.charCodeAt(s);if(c===47){if(!o){r=s+1;break}}else{if(a===-1)o=!1,a=s+1;if(i>=0)if(c===t.charCodeAt(i)){if(--i===-1)n=s}else i=-1,n=a}}if(r===n)n=a;else if(n===-1)n=e.length;return e.slice(r,n)}else{for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!o){r=s+1;break}}else if(n===-1)o=!1,n=s+1;if(n===-1)return"";return e.slice(r,n)}},extname(e){let t=-1,r=0,n=-1,o=!0,s=0;for(let i=e.length-1;i>=0;--i){let a=e.charCodeAt(i);if(a===47){if(!o){r=i+1;break}continue}if(n===-1)o=!1,n=i+1;if(a===46){if(t===-1)t=i;else if(s!==1)s=1}else if(t!==-1)s=-1}if(t===-1||n===-1||s===0||s===1&&t===n-1&&t===r+1)return"";return e.slice(t,n)},format:function(t){if(t===null||typeof t!=="object")throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return F1t("/",t)},parse(e){let t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;let r=e.charCodeAt(0),n=r===47,o;if(n)t.root="/",o=1;else o=0;let s=-1,i=0,a=-1,c=!0,l=e.length-1,u=0;for(;l>=o;--l){if(r=e.charCodeAt(l),r===47){if(!c){i=l+1;break}continue}if(a===-1)c=!1,a=l+1;if(r===46){if(s===-1)s=l;else if(u!==1)u=1}else if(s!==-1)u=-1}if(s===-1||a===-1||u===0||u===1&&s===a-1&&s===i+1){if(a!==-1)if(i===0&&n)t.base=t.name=e.slice(1,a);else t.base=t.name=e.slice(i,a)}else{if(i===0&&n)t.name=e.slice(1,s),t.base=e.slice(1,a);else t.name=e.slice(i,s),t.base=e.slice(i,a);t.ext=e.slice(s,a)}if(i>0)t.dir=e.slice(0,i-1);else if(n)t.dir="/";return t},sep:"/",fromFileUrl:N1t,toFileUrl:U1t,toNamespacedPath:te}),LBe=Hs(xj,hj);var NE=gj,wc=xj,V1t=LBe;var w_=(e,t,r)=>{let n=r===void 0?t:r,o=Math.min(t-n,e-Math.floor(n/2));if(o<0)o=0;let s=Math.min(o+n,t);return{startIndex:o,endIndex:s}};var UBe="The selected directory contains files. Would you like to traverse the selected directory?",zD=pR(),yj=zD.$is("Show"),G1t=hr(bc,{style:"pretty"});function k_(e,t){return be(e,{onNone:()=>be(t.startingPath,{onNone:()=>Ce(()=>process.cwd()),onSome:(r)=>L(Hi,(n)=>Pr(n.exists(r)).pipe(qQ(te,`The provided starting path '${r}' does not exist`),qr(r)))}),onSome:(r)=>N(r)})}function xoe(e,t){return $e(function*(){let r=yield*Hi,n=yield*wc,o=yield*Pr(r.readDirectory(e)).pipe(W((s)=>["..",...s]));return yield*rq(o,(s)=>{let i=t.filter(s),a=mn(i)?i:N(i),c=t.type==="directory"?W(Pr(r.stat(n.join(e,s))),(l)=>l.type==="Directory"):N(!0);return ca(a,c,(l,u)=>l&&u)},{concurrency:o.length})})}function K1t(e){return(t,r)=>$e(function*(){let o=yield*(yield*zr).columns,s=yield*k_(t.path,e),i=`
|
|
194
|
+
`.repeat(Math.min(t.files.length,e.maxPerPage)),a=oi(s,o),c=yj(t.confirm)?UBe:e.message,l=oi(`
|
|
195
|
+
${c}`,o);return oi(i,o).pipe(se(a),se(l),Fn(Dn),hr({style:"pretty",options:{lineWidth:o}}))})}var J1t=/\r?\n/;function goe(e,t,r,n){let o=(i)=>Le(et(i),Ws),s=se(r,zt);return es(t.split(J1t),{onEmpty:()=>ha([s,n,e]),onNonEmpty:(i)=>{let a=Ke(i,(c)=>o(c));return s.pipe(se(Za(ao(a),2)),se(zt),se(n),se(zt),se(e))}})}function Q1t(e,t,r,n,o){let s=zt;if(r===t.startIndex&&t.startIndex>0)s=o.arrowUp;else if(r===t.endIndex-1&&t.endIndex<n)s=o.arrowDown;return e.cursor===r?o.pointer.pipe(Le(Ro),se(s)):s.pipe(se(zt))}function Y1t(e,t){return t?Le(et(e),Ei(Yc,Ro)):et(e)}function Z1t(e,t,r,n){let o=t.length,s=w_(e.cursor,o,n.maxPerPage),i=[];for(let a=s.startIndex;a<s.endIndex;a++){let c=e.cursor===a,l=Q1t(e,s,a,o,r),u=Y1t(t[a],c);i.push(se(l,u))}return ao(i)}function X1t(e,t){return $e(function*(){let r=yield*wc,o=yield*(yield*zr).columns,s=yield*cs,i=yield*k_(e.path,t),a=e.files[e.cursor],c=r.resolve(i,a),l=s.pointerSmall.pipe(se(zt),se(et(c)),Le(rn));if(yj(e.confirm)){let E=Le(et("?"),Ro),b=Le(s.pointerSmall,rn),w=Le(et("(Y/n)"),rn),T=goe(w,UBe,E,b);return Fu.pipe(se(T),se(Vn),se(l),Fn(Dn),hr({style:"pretty",options:{lineWidth:o}}))}let u=Le(s.tick,Ya),f=Le(s.ellipsis,rn),h=goe(Dr,t.message,u,f),y=Z1t(e,e.files,s,t);return Fu.pipe(se(h),se(Vn),se(l),se(Vn),se(y),Fn(Dn),hr({style:"pretty",options:{lineWidth:o}}))})}function e2t(e,t){return $e(function*(){let n=yield*(yield*zr).columns,o=yield*cs,s=Le(o.tick,Ya),i=Le(o.ellipsis,rn);return goe(Dr,t.message,s,i).pipe(se(zt),se(Le(et(e),Zm)),se(Vn),hr({style:"pretty",options:{lineWidth:n}}))})}function t2t(e){return(t,r)=>ze.$match(r,{Beep:()=>N(G1t),NextFrame:({state:n})=>X1t(n,e),Submit:({value:n})=>e2t(n,e)})}function r2t(e){let t=e.cursor-1;return N(ze.NextFrame({state:{...e,cursor:t<0?e.files.length-1:t}}))}function n2t(e){return N(ze.NextFrame({state:{...e,cursor:(e.cursor+1)%e.files.length}}))}function o2t(e,t){return $e(function*(){let r=yield*Hi,n=yield*wc,o=yield*k_(e.path,t),s=e.files[e.cursor],i=n.resolve(o,s);if((yield*Pr(r.stat(i))).type==="Directory"){let c=yield*xoe(i,t),l=c.filter((u)=>u!=="..");if(t.type==="directory"||t.type==="either")return l.length===0?ze.Submit({value:i}):ze.NextFrame({state:{...e,confirm:zD.Show()}});return ze.NextFrame({state:{cursor:0,files:c,path:_(i),confirm:zD.Hide()}})}return ze.Submit({value:i})})}function s2t(e){return(t,r)=>$e(function*(){switch(t.key.name){case"k":case"up":return yield*r2t(r);case"j":case"down":case"tab":return yield*n2t(r);case"enter":case"return":return yield*o2t(r,e);case"y":case"t":{if(yj(r.confirm)){let n=yield*wc,o=yield*k_(r.path,e),s=r.files[r.cursor],i=n.resolve(o,s),a=yield*xoe(i,e);return ze.NextFrame({state:{cursor:0,files:a,path:_(i),confirm:zD.Hide()}})}return ze.Beep()}case"n":case"f":{if(yj(r.confirm)){let n=yield*wc,o=yield*k_(r.path,e),s=r.files[r.cursor],i=n.resolve(o,s);return ze.Submit({value:i})}return ze.Beep()}default:return ze.Beep()}})}var Sj=(e={})=>{let t={type:e.type??"file",message:e.message??"Choose a file",startingPath:Ft(e.startingPath),maxPerPage:e.maxPerPage??10,filter:e.filter??(()=>N(!0))},r=$e(function*(){let n=R(),o=yield*k_(n,t),s=yield*xoe(o,t),i=zD.Hide();return{cursor:0,files:s,path:n,confirm:i}});return Wi(r,{render:t2t(t),process:s2t(t),clear:K1t(t)})};var BBe=ax.pipe(ZP(),Qr),WBe=Qr(ax),zBe=hr(bc,{style:"pretty"});function $Be(e){return(t,r)=>$e(function*(){let o=yield*(yield*zr).columns,s=se(Cc,Bl),i=be(t.error,{onNone:()=>Dr,onSome:(c)=>x_(C_(c,o)).pipe(se(oi(`
|
|
196
|
+
${c}`,o)))}),a=oi(e.message,o);return i.pipe(se(a),se(s),Fn(Dn),hr({style:"pretty",options:{lineWidth:o}}))})}function qBe(e,t){let r=be(e.error,{onNone:()=>Ei(Yc,Ro),onSome:()=>Ul}),n=e.value===""?Dr:et(`${e.value}`);return t?n:Le(n,r)}var i2t=/\r?\n/;function a2t(e,t){return be(e.error,{onNone:()=>Dr,onSome:(r)=>es(r.split(i2t),{onEmpty:()=>Dr,onNonEmpty:(n)=>{let o=(a)=>Le(et(a),Ei(OE,Ul)),s=se(Le(t,Ul),zt),i=Ke(n,(a)=>o(a));return RE.pipe(se(Vn),se(s),se(hx(ao(i))),se(ME))}})})}function jBe(e,t,r,n,o=!1){let s=(a)=>Le(et(a),Ws),i=se(t,zt);return es(n.message.split(/\r?\n/),{onEmpty:()=>ha([i,r,qBe(e,o)]),onNonEmpty:(a)=>{let c=Ke(a,(l)=>s(l));return i.pipe(se(Za(ao(c),2)),se(zt),se(r),se(zt),se(qBe(e,o)))}})}function VBe(e,t){return $e(function*(){let n=yield*(yield*zr).columns,o=yield*cs,s=Le(et("?"),Ro),i=Le(o.pointerSmall,rn),a=a2t(e,o.pointerSmall);return jBe(e,s,i,t).pipe(se(a),Fn(Dn),hr({style:"pretty",options:{lineWidth:n}}))})}function GBe(e,t){return $e(function*(){let n=yield*(yield*zr).columns,o=yield*cs,s=Le(o.tick,Ya),i=Le(o.ellipsis,rn);return jBe(e,s,i,t,!0).pipe(se(Vn),Fn(Dn),hr({style:"pretty",options:{lineWidth:n}}))})}function KBe(e){if(e.value.length<=0)return N(ze.Beep());let t=e.value.slice(0,e.value.length-1);return N(ze.NextFrame({state:{...e,value:t,error:R()}}))}function c2t(e,t){if(e.value.length===0&&t==="-")return N(ze.NextFrame({state:{...e,value:"-",error:R()}}));return Fs(BBe(e.value+t),{onFailure:()=>ze.Beep(),onSuccess:(r)=>ze.NextFrame({state:{...e,value:`${r}`,error:R()}})})}function l2t(e,t){if(t==="."&&e.value.includes("."))return N(ze.Beep());if(e.value.length===0&&t==="-")return N(ze.NextFrame({state:{...e,value:"-",error:R()}}));return Fs(WBe(e.value+t),{onFailure:()=>ze.Beep(),onSuccess:(r)=>ze.NextFrame({state:{...e,value:t==="."?`${r}.`:`${r}`,error:R()}})})}var JBe={cursor:0,value:"",error:R()};function u2t(e){return(t,r)=>ze.$match(r,{Beep:()=>N(zBe),NextFrame:({state:n})=>VBe(n,e),Submit:()=>GBe(t,e)})}function p2t(e){return(t,r)=>{switch(t.key.name){case"backspace":return KBe(r);case"k":case"up":return N(ze.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`${e.incrementBy}`:`${Number.parseInt(r.value)+e.incrementBy}`,error:R()}}));case"j":case"down":return N(ze.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`-${e.decrementBy}`:`${Number.parseInt(r.value)-e.decrementBy}`,error:R()}}));case"enter":case"return":return wr(BBe(r.value),{onFailure:()=>N(ze.NextFrame({state:{...r,error:_("Must provide an integer value")}})),onSuccess:(n)=>Fs(e.validate(n),{onFailure:(o)=>ze.NextFrame({state:{...r,error:_(o)}}),onSuccess:(o)=>ze.Submit({value:o})})});default:{let n=Je(t.input,()=>"");return c2t(r,n)}}}}var LE=(e)=>{let t={min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,incrementBy:1,decrementBy:1,validate:(r)=>{if(r<t.min)return ie(`${r} must be greater than or equal to ${t.min}`);if(r>t.max)return ie(`${r} must be less than or equal to ${t.max}`);return N(r)},...e};return Wi(JBe,{render:u2t(t),process:p2t(t),clear:$Be(t)})};function f2t(e){return(t,r)=>ze.$match(r,{Beep:()=>N(zBe),NextFrame:({state:n})=>VBe(n,e),Submit:()=>GBe(t,e)})}function d2t(e){return(t,r)=>{switch(t.key.name){case"backspace":return KBe(r);case"k":case"up":return N(ze.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`${e.incrementBy}`:`${Number.parseFloat(r.value)+e.incrementBy}`,error:R()}}));case"j":case"down":return N(ze.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`-${e.decrementBy}`:`${Number.parseFloat(r.value)-e.decrementBy}`,error:R()}}));case"enter":case"return":return wr(WBe(r.value),{onFailure:()=>N(ze.NextFrame({state:{...r,error:_("Must provide a floating point value")}})),onSuccess:(n)=>L(Ce(()=>Ome(n,e.precision)),(o)=>Fs(e.validate(o),{onFailure:(s)=>ze.NextFrame({state:{...r,error:_(s)}}),onSuccess:(s)=>ze.Submit({value:s})}))});default:{let n=Je(t.input,()=>"");return l2t(r,n)}}}}var Ej=(e)=>{let t={min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,incrementBy:1,decrementBy:1,precision:2,validate:(r)=>{if(r<t.min)return ie(`${r} must be greater than or equal to ${t.min}`);if(r>t.max)return ie(`${r} must be less than or equal to ${t.max}`);return N(r)},...e};return Wi(JBe,{render:f2t(t),process:d2t(t),clear:$Be(t)})};var m2t=hr(bc,{style:"pretty"}),h2t=/\r?\n/;function QBe(e,t,r){let n=(s)=>Le(et(s),Ws),o=se(e,zt);return es(r.message.split(h2t),{onEmpty:()=>ha([o,t]),onNonEmpty:(s)=>{let i=Ke(s,(a)=>n(a));return o.pipe(se(Za(ao(i),2)),se(zt),se(t),se(zt))}})}function g2t(e,t,r,n,o){let s=zt;if(n===r.startIndex&&r.startIndex>0)s=o.arrowUp;else if(n===r.endIndex-1&&r.endIndex<t.length)s=o.arrowDown;if(t[n].disabled){let i=Ei(Ws,rn);return e===n?o.pointer.pipe(Le(i),se(s)):s.pipe(se(zt))}return e===n?o.pointer.pipe(Le(Ro),se(s)):s.pipe(se(zt))}function x2t(e,t){let r=et(e.title);if(t)return e.disabled?Le(r,Ei(Yc,rn)):Le(r,Ei(Yc,Ro));return e.disabled?Le(r,Ei(WHe,rn)):r}function y2t(e,t){if(!e.disabled&&e.description&&t)return qw("-").pipe(se(zt),se(et(e.description)),Le(rn));return Dr}function S2t(e,t,r){let n=t.choices,o=w_(e,n.length,t.maxPerPage),s=[];for(let i=o.startIndex;i<o.endIndex;i++){let a=n[i],c=e===i,l=g2t(e,n,o,i,r),u=x2t(a,c),f=y2t(a,c);s.push(l.pipe(se(u),se(zt),se(f)))}return ao(s)}function E2t(e,t){return $e(function*(){let n=yield*(yield*zr).columns,o=yield*cs,s=S2t(e,t,o),i=Le(et("?"),Ro),a=Le(o.pointerSmall,rn),c=QBe(i,a,t);return Fu.pipe(se(c),se(Vn),se(s),hr({style:"pretty",options:{lineWidth:n}}))})}function b2t(e,t){return $e(function*(){let n=yield*(yield*zr).columns,o=yield*cs,s=et(t.choices[e].title),i=Le(o.tick,Ya),a=Le(o.ellipsis,rn);return QBe(i,a,t).pipe(se(zt),se(Le(s,Zm)),se(Vn),hr({style:"pretty",options:{lineWidth:n}}))})}function C2t(e,t){if(e===0)return N(ze.NextFrame({state:t.length-1}));return N(ze.NextFrame({state:e-1}))}function w2t(e,t){if(e===t.length-1)return N(ze.NextFrame({state:0}));return N(ze.NextFrame({state:e+1}))}function k2t(e,t){return N(ze.NextFrame({state:(e+1)%t.length}))}function I2t(e){return(t,r)=>ze.$match(r,{Beep:()=>N(m2t),NextFrame:({state:n})=>E2t(n,e),Submit:()=>b2t(t,e)})}function A2t(e){return $e(function*(){let r=yield*(yield*zr).columns,n=se(Cc,Bl),o=`
|
|
197
|
+
`.repeat(Math.min(e.choices.length,e.maxPerPage))+e.message;return oi(o,r).pipe(se(n),Fn(Dn),hr({style:"pretty",options:{lineWidth:r}}))})}function O2t(e){return(t,r)=>{switch(t.key.name){case"k":case"up":return C2t(r,e.choices);case"j":case"down":return w2t(r,e.choices);case"tab":return k2t(r,e.choices);case"enter":case"return":{let n=e.choices[r];if(n.disabled)return N(ze.Beep());return N(ze.Submit({value:n.value}))}default:return N(ze.Beep())}}}var Hu=(e)=>{let t={maxPerPage:10,...e},r=0,n=-1;for(let o=0;o<t.choices.length;o++)if(t.choices[o].selected===!0){if(n!==-1)throw Error("InvalidArgumentException: only a single choice can be selected by default for Prompt.select");n=o}if(n!==-1)r=n;return Wi(r,{render:I2t(t),process:O2t(t),clear:()=>A2t(t)})};function yoe(e,t){return e.value.length>0?e.value:t.default}var _2t=hr(bc,{style:"pretty"});function v2t(e,t){return $e(function*(){let n=yield*(yield*zr).columns,o=se(Cc,Bl),s=be(e.error,{onNone:()=>Dr,onSome:(l)=>x_(C_(l,n)).pipe(se(oi(`
|
|
198
|
+
${l}`,n)))}),i=e.value.length>0?e.value:t.default,a=`? ${t.message} › ${i}`,c=oi(a,n);return s.pipe(se(c),se(o),Fn(Dn),hr({style:"pretty",options:{lineWidth:n}}))})}function YBe(e,t,r){let n=yoe(e,t),o=be(e.error,{onNone:()=>{if(r)return Zm;if(e.value.length===0)return rn;return Ei(Yc,Ro)},onSome:()=>Ul});switch(t.type){case"hidden":return Dr;case"password":return Le(et("*".repeat(n.length)),o);case"text":return Le(et(n),o)}}function T2t(e,t){return be(e.error,{onNone:()=>Dr,onSome:(r)=>es(r.split(/\r?\n/),{onEmpty:()=>Dr,onNonEmpty:(n)=>{let o=(a)=>et(a).pipe(Le(Ei(OE,Ul))),s=se(Le(t,Ul),zt),i=Ke(n,(a)=>o(a));return RE.pipe(se(Vn),se(s),se(hx(ao(i))),se(ME))}})})}function ZBe(e,t,r,n,o=!1){let s=(c)=>Le(et(c),Ws),i=n.message.split(/\r?\n/),a=se(t,zt);if(ut(i)){let c=Ke(i,(l)=>s(l));return a.pipe(se(Za(ao(c),2)),se(zt),se(r),se(zt),se(YBe(e,n,o)))}return ha([a,r,YBe(e,n,o)])}function R2t(e,t){return $e(function*(){let n=yield*(yield*zr).columns,o=yield*cs,s=Le(et("?"),Ro),i=Le(o.pointerSmall,rn),a=ZBe(e,s,i,t),c=T2t(e,o.pointerSmall),l=e.cursor-e.value.length;return a.pipe(se(c),se(Hqe(l)),Fn(Dn),hr({style:"pretty",options:{lineWidth:n}}))})}function M2t(e,t){return $e(function*(){let n=yield*(yield*zr).columns,o=yield*cs,s=Le(o.tick,Ya),i=Le(o.ellipsis,rn);return ZBe(e,s,i,t,!0).pipe(se(Vn),Fn(Dn),hr({style:"pretty",options:{lineWidth:n}}))})}function P2t(e){if(e.cursor<=0)return N(ze.Beep());let t=e.value.slice(0,e.cursor-1),r=e.value.slice(e.cursor),n=e.cursor-1,o=`${t}${r}`;return N(ze.NextFrame({state:{...e,cursor:n,value:o,error:R()}}))}function D2t(e){if(e.cursor<=0)return N(ze.Beep());let t=e.cursor-1;return N(ze.NextFrame({state:{...e,cursor:t,error:R()}}))}function F2t(e){if(e.cursor>=e.value.length)return N(ze.Beep());let t=Math.min(e.cursor+1,e.value.length);return N(ze.NextFrame({state:{...e,cursor:t,error:R()}}))}function N2t(e,t){if(e.value===t.default)return N(ze.Beep());let r=yoe(e,t),n=r.length;return N(ze.NextFrame({state:{...e,value:r,cursor:n,error:R()}}))}function L2t(e,t){let r=t.value.slice(0,t.cursor),n=t.value.slice(t.cursor),o=`${r}${e}${n}`,s=t.cursor+e.length;return N(ze.NextFrame({state:{...t,cursor:s,value:o,error:R()}}))}var U2t={cursor:0,value:"",error:R()};function H2t(e){return(t,r)=>ze.$match(r,{Beep:()=>N(_2t),NextFrame:({state:n})=>R2t(n,e),Submit:()=>M2t(t,e)})}function q2t(e){return(t,r)=>{switch(t.key.name){case"backspace":return P2t(r);case"left":return D2t(r);case"right":return F2t(r);case"enter":case"return":{let n=yoe(r,e);return Fs(e.validate(n),{onFailure:(o)=>ze.NextFrame({state:{...r,value:n,error:_(o)}}),onSuccess:(o)=>ze.Submit({value:o})})}case"tab":return N2t(r,e);default:{let n=Je(t.input,()=>"");return L2t(n,r)}}}}function B2t(e){return(t,r)=>v2t(t,e)}function Soe(e,t){let r={default:"",type:t,validate:N,...e};return Wi(U2t,{render:H2t(r),process:q2t(r),clear:B2t(r)})}var jD=(e)=>Soe(e,"hidden").pipe(ga(Ru)),XBe=(e)=>Soe(e,"password").pipe(ga(Ru)),I_=(e)=>Soe(e,"text");var W2t=hr(bc,{style:"pretty"});function z2t(e){return $e(function*(){let r=yield*(yield*zr).columns,n=se(Cc,Bl);return oi(e.message,r).pipe(se(n),Fn(Dn),hr({style:"pretty",options:{lineWidth:r}}))})}function rWe(e,t,r=!1){let n=Le(qw("/"),rn),o=Ei(Yc,r?Zm:Ro),s=e?et(t.inactive):Le(et(t.inactive),o),i=e?Le(et(t.active),o):et(t.active);return ha([i,n,s])}function nWe(e,t,r,n){let o=(a)=>Le(et(a),Ws),s=n.message.split(/\r?\n/),i=se(t,zt);if(ut(s)){let a=Ke(s,(c)=>o(c));return i.pipe(se(Za(ao(a),2)),se(zt),se(r),se(zt),se(e))}return ha([i,r,e])}function $2t(e,t){return $e(function*(){let r=yield*zr,n=yield*cs,o=yield*r.columns,s=Le(et("?"),Ro),i=Le(n.pointerSmall,rn),a=rWe(e,t),c=nWe(a,s,i,t);return Fu.pipe(se(c),Fn(Dn),hr({style:"pretty",options:{lineWidth:o}}))})}function j2t(e,t){return $e(function*(){let r=yield*zr,n=yield*cs,o=yield*r.columns,s=Le(n.tick,Ya),i=Le(n.ellipsis,rn),a=rWe(e,t,!0);return nWe(a,s,i,t).pipe(se(Vn),Fn(Dn),hr({style:"pretty",options:{lineWidth:o}}))})}var eWe=N(ze.NextFrame({state:!0})),tWe=N(ze.NextFrame({state:!1}));function V2t(e){return(t,r)=>{switch(r._tag){case"Beep":return N(W2t);case"NextFrame":return $2t(t,e);case"Submit":return j2t(t,e)}}}function G2t(e,t){switch(e.key.name){case"0":case"j":case"delete":case"right":case"down":return tWe;case"1":case"k":case"left":case"up":return eWe;case" ":case"tab":return t?tWe:eWe;case"enter":case"return":return N(ze.Submit({value:t}));default:return N(ze.Beep())}}var A_=(e)=>{let t={initial:!1,active:"on",inactive:"off",...e};return Wi(t.initial,{render:V2t(t),process:G2t,clear:()=>z2t(t)})};var K2t="@effect/cli/Primitive",oWe=Symbol.for(K2t),Sx={[oWe]:{_A:(e)=>e},pipe(){return ce(this,arguments)}},J2t=(e)=>typeof e==="object"&&e!=null&&(oWe in e),VD=(e)=>J2t(e)&&Q2t(e),Q2t=(e)=>e._tag==="Bool";var Y2t=qe("true","1","y","yes","on"),GD=OS(Y2t),Z2t=qe("false","0","n","no","off"),KD=OS(Z2t),JD=(e)=>{let t=Object.create(Sx);return t._tag="Bool",t.defaultValue=e,t},QD=(e)=>{let t=Object.create(Sx);return t._tag="Choice",t.alternatives=e,t},Cj=(()=>{let e=Object.create(Sx);return e._tag="DateTime",e})(),wj=(()=>{let e=Object.create(Sx);return e._tag="Float",e})(),kj=(()=>{let e=Object.create(Sx);return e._tag="Integer",e})(),Vw=(e,t)=>{let r=Object.create(Sx);return r._tag="Path",r.pathType=e,r.pathExists=t,r},Ij=(()=>{let e=Object.create(Sx);return e._tag="Redacted",e})(),Aj=(()=>{let e=Object.create(Sx);return e._tag="Secret",e})(),YD=(()=>{let e=Object.create(Sx);return e._tag="Text",e})(),ZD=(e)=>X2t(e),Oj=(e)=>eUt(e),__=(e)=>jw(e),v_=p(3,(e,t,r)=>tUt(e,t,r)),_j=p(2,(e,t)=>oUt(e,t)),X2t=(e)=>{switch(e._tag){case"Bool":return _("true | false");case"Choice":{let t=d(Ke(e.alternatives,([r])=>r),Xt(" | "));return _(t)}case"DateTime":return _("date");case"Float":case"Integer":case"Path":case"Redacted":case"Secret":case"Text":return R()}},eUt=(e)=>{switch(e._tag){case"Bool":return $t("A true or false value.");case"Choice":{let t=d(Ke(e.alternatives,([r])=>r),Xt(", "));return $t(`One of the following: ${t}`)}case"DateTime":return $t("A date without a time-zone in the ISO-8601 format, such as 2007-12-03T10:15:30.");case"Float":return $t("A floating point number.");case"Integer":return $t("An integer.");case"Path":{if(e.pathType==="either"&&e.pathExists==="yes")return $t("An existing file or directory.");if(e.pathType==="file"&&e.pathExists==="yes")return $t("An existing file.");if(e.pathType==="directory"&&e.pathExists==="yes")return $t("An existing directory.");if(e.pathType==="either"&&e.pathExists==="no")return $t("A file or directory that must not exist.");if(e.pathType==="file"&&e.pathExists==="no")return $t("A file that must not exist.");if(e.pathType==="directory"&&e.pathExists==="no")return $t("A directory that must not exist.");if(e.pathType==="either"&&e.pathExists==="either")return $t("A file or directory.");if(e.pathType==="file"&&e.pathExists==="either")return $t("A file.");if(e.pathType==="directory"&&e.pathExists==="either")return $t("A directory.");throw Error(`[BUG]: Path.help - encountered invalid combination of path type ('${e.pathType}') and path existence ('${e.pathExists}')`)}case"Secret":case"Redacted":return $t("A user-defined piece of text that is confidential.");case"Text":return $t("A user-defined piece of text.")}},jw=(e)=>{switch(e._tag){case"Bool":return"boolean";case"Choice":return"choice";case"DateTime":return"date";case"Float":return"float";case"Integer":return"integer";case"Path":{if(e.pathType==="either")return"path";return e.pathType}case"Redacted":return"redacted";case"Secret":return"secret";case"Text":return"text"}},tUt=(e,t,r)=>{switch(e._tag){case"Bool":return jt(t,(n)=>bi(r,n)).pipe(be({onNone:()=>jC(e.defaultValue,()=>"Missing default value for boolean parameter"),onSome:(n)=>GD(n)?N(!0):KD(n)?N(!1):ie(`Unable to recognize '${n}' as a valid boolean`)}));case"Choice":return jC(t,()=>"Choice options to not have a default value").pipe(L((n)=>Kd(e.alternatives,([o])=>o===n)),Gf({onFailure:()=>`Expected one of the following cases: ${d(Ke(e.alternatives,([o])=>o),Xt(", "))}`,onSuccess:([,n])=>n}));case"DateTime":return O_(t,jw(e),Qr(Pz));case"Float":return O_(t,jw(e),Qr(ax));case"Integer":{let n=Ow(ax,Ja);return O_(t,jw(e),Qr(n))}case"Path":return L(Hi,(n)=>jC(t,()=>"Path options do not have a default value").pipe(sr((s)=>Pr(n.exists(s)).pipe(sr((i)=>rUt(s,e.pathExists,i).pipe(ve(nUt(s,e.pathType,n).pipe(Tp(()=>e.pathExists!=="no"&&i)))))))));case"Redacted":return O_(t,jw(e),Qr(H)).pipe(W((n)=>Ru(n)));case"Secret":return O_(t,jw(e),Qr(H)).pipe(W((n)=>Zqe(n)));case"Text":return O_(t,jw(e),Qr(H))}},O_=(e,t,r)=>jC(e,()=>`${t} options do not have a default value`).pipe(L((n)=>jC(r(n),()=>`'${n}' is not a ${t}`))),rUt=(e,t,r)=>{if(t==="no"&&r)return ie(`Path '${e}' must not exist`);if(t==="yes"&&!r)return ie(`Path '${e}' must exist`);return me},nUt=(e,t,r)=>{switch(t){case"file":{let n=r.stat(e).pipe(W((o)=>o.type==="File"),Pr);return ie(`Expected path '${e}' to be a regular file`).pipe(iq(n),Xs)}case"directory":{let n=r.stat(e).pipe(W((o)=>o.type==="Directory"),Pr);return ie(`Expected path '${e}' to be a directory`).pipe(iq(n),Xs)}case"either":return me}},oUt=(e,t)=>{switch(e._tag){case"Bool":{let r=He("Select true or false"),n=Rt(t,r),o=Je(e.defaultValue,()=>!1);return A_({message:fn(n).trimEnd(),initial:o,active:"true",inactive:"false"}).pipe(ga((s)=>`${s}`))}case"Choice":{let r=He("Select one of the following choices"),n=Rt(t,r);return Hu({message:fn(n).trimEnd(),choices:Ke(e.alternatives,([o])=>({title:o,value:o}))})}case"DateTime":{let r=He("Enter a date"),n=Rt(t,r);return mj({message:fn(n).trimEnd()}).pipe(ga((o)=>o.toISOString()))}case"Float":{let r=He("Enter a floating point value"),n=Rt(t,r);return Ej({message:fn(n).trimEnd()}).pipe(ga((o)=>`${o}`))}case"Integer":{let r=He("Enter an integer"),n=Rt(t,r);return LE({message:fn(n).trimEnd()}).pipe(ga((o)=>`${o}`))}case"Path":{let r=He("Select a file system path"),n=Rt(t,r);return Sj({type:e.pathType,message:fn(n).trimEnd()})}case"Redacted":{let r=He("Enter some text (value will be redacted)"),n=Rt(t,r);return jD({message:fn(n).trimEnd()})}case"Secret":{let r=He("Enter some text (value will be redacted)"),n=Rt(t,r);return jD({message:fn(n).trimEnd()})}case"Text":{let r=He("Enter some text"),n=Rt(t,r);return I_({message:fn(n).trimEnd()})}}},sWe=(e)=>{switch(e._tag){case"Bool":return'"${cur}"';case"DateTime":case"Float":case"Integer":case"Secret":case"Redacted":case"Text":return'$(compgen -f "${cur}")';case"Path":switch(e.pathType){case"file":return e.pathExists==="yes"||e.pathExists==="either"?'$(compgen -f "${cur}")':"";case"directory":return e.pathExists==="yes"||e.pathExists==="either"?'$(compgen -d "${cur}")':"";case"either":return e.pathExists==="yes"||e.pathExists==="either"?'$(compgen -f "${cur}")':""}case"Choice":return`$(compgen -W "${d(Ke(e.alternatives,([r])=>r),Xt(","))}" -- "\${cur}")`}},vj=(e)=>{switch(e._tag){case"Bool":return Ge();case"DateTime":case"Float":case"Integer":case"Redacted":case"Secret":case"Text":return Xo("-r","-f");case"Path":switch(e.pathType){case"file":return e.pathExists==="yes"||e.pathExists==="either"?Xo("-r","-F"):Xo("-r");case"directory":return e.pathExists==="yes"||e.pathExists==="either"?Xo("-r","-f","-a",'"(__fish_complete_directories (commandline -ct))"'):Xo("-r");case"either":return e.pathExists==="yes"||e.pathExists==="either"?Xo("-r","-F"):Xo("-r")}case"Choice":{let t=d(Ke(e.alternatives,([r])=>`${r}''`),Xt(","));return Xo("-r","-f","-a",`"{${t}}"`)}}},Tj=(e)=>{switch(e._tag){case"Bool":return"";case"Choice":return`:CHOICE:(${d(Ke(e.alternatives,([r])=>r),Xt(" "))})`;case"DateTime":return"";case"Float":return"";case"Integer":return"";case"Path":switch(e.pathType){case"file":return e.pathExists==="yes"||e.pathExists==="either"?":PATH:_files":"";case"directory":return e.pathExists==="yes"||e.pathExists==="either"?":PATH:_files -/":"";case"either":return e.pathExists==="yes"||e.pathExists==="either"?":PATH:_files":""}case"Redacted":case"Secret":case"Text":return""}};var Ex={_tag:"Empty"},Coe={_tag:"Empty"},UE=(e,t)=>({_tag:"Named",names:e,acceptedValues:t}),XD=(e)=>({_tag:"Optional",usage:e}),eF=(e)=>({_tag:"Repeated",usage:e}),woe=p(2,(e,t)=>({_tag:"Alternation",left:e,right:t})),ih=p(2,(e,t)=>({_tag:"Concat",left:e,right:t})),Rj=(e)=>{let t=koe(e,DE);if(ut(t)){let r=jr(t),n=ts(t);if(ut(n))return d(Ke(t,(o)=>He(o)),dl(Gn,(o,s)=>Rt(o,s)));return He(r)}return Gn},koe=p(2,(e,t)=>sh(Gw(e,t),t)),Gw=(e,t)=>{switch(e._tag){case"Empty":return Ex;case"Mixed":return Coe;case"Named":{if(vt(Ki(sh(e,t))))return Ex;return e}case"Optional":{if(e.usage._tag==="Empty")return Ex;let r=Gw(e.usage,t);return r._tag==="Empty"?Ex:r._tag==="Optional"?r:XD(r)}case"Repeated":{let r=Gw(e.usage,t);return r._tag==="Empty"?Ex:eF(r)}case"Alternation":{let r=Gw(e.left,t),n=Gw(e.right,t);return r._tag==="Empty"?n:n._tag==="Empty"?r:woe(r,n)}case"Concat":{let r=Gw(e.left,t),n=Gw(e.right,t);return r._tag==="Empty"?n:n._tag==="Empty"?r:ih(r,n)}}},sh=(e,t)=>{switch(e._tag){case"Empty":return tt($t(""));case"Mixed":return tt($t("<command>"));case"Named":{let r=t.showTypes?be(e.acceptedValues,{onNone:()=>Nu,onSome:(s)=>Xa(Wl,$t(s))}):Nu,n=t.showAllNames?e.names:e.names.length>1?d(Qd(e.names,(s)=>s.startsWith("--")),Ki,jt(tt),Je(()=>e.names)):e.names,o=$t(Xt(n,", "));return t.showAllNames&&e.names.length>1?tt(zl([$t("("),o,r,$t(")")])):tt(Xa(o,r))}case"Optional":return Ke(sh(e.usage,t),(r)=>zl([$t("["),r,$t("]")]));case"Repeated":return Ke(sh(e.usage,t),(r)=>Xa(r,$t("...")));case"Alternation":{if(e.left._tag==="Repeated"||e.right._tag==="Repeated"||e.left._tag==="Concat"||e.right._tag==="Concat")return xt(sh(e.left,t),sh(e.right,t));return Ho(sh(e.left,t),(r)=>Ke(sh(e.right,t),(n)=>zl([r,$t("|"),n])))}case"Concat":{let r=sh(e.left,t),n=sh(e.right,t),o=ut(r)&&ut(n)?Wl:Nu;return Ho(r,(s)=>Ke(n,(i)=>zl([s,o,i])))}}};var tF=Symbol.for("@effect/cli/ValidationError"),Zp={[tF]:tF},HE=(e)=>typeof e==="object"&&e!=null&&(tF in e),rF=(e)=>e._tag==="CommandMismatch",aWe=(e)=>e._tag==="CorrectedFlag",Pj=(e)=>e._tag==="HelpRequested",cWe=(e)=>e._tag==="InvalidArgument",lWe=(e)=>e._tag==="InvalidValue",nF=(e)=>e._tag==="MultipleValuesDetected",uWe=(e)=>e._tag==="MissingFlag",oF=(e)=>e._tag==="MissingValue",pWe=(e)=>e._tag==="MissingSubcommand",fWe=(e)=>e._tag==="NoBuiltInMatch",dWe=(e)=>e._tag==="UnclusteredFlag",bx=(e)=>{let t=Object.create(Zp);return t._tag="CommandMismatch",t.error=e,t},Dj=(e)=>{let t=Object.create(Zp);return t._tag="CorrectedFlag",t.error=e,t},ah=(e)=>{let t=Object.create(Zp);return t._tag="InvalidArgument",t.error=e,t},zs=(e)=>{let t=Object.create(Zp);return t._tag="InvalidValue",t.error=e,t},T_=(e)=>{let t=Object.create(Zp);return t._tag="MissingFlag",t.error=e,t},qu=(e)=>{let t=Object.create(Zp);return t._tag="MissingValue",t.error=e,t},mWe=(e)=>{let t=Object.create(Zp);return t._tag="MissingSubcommand",t.error=e,t},Fj=(e,t)=>{let r=Object.create(Zp);return r._tag="MultipleValuesDetected",r.error=e,r.values=t,r},Nj=(e)=>{let t=Object.create(Zp);return t._tag="NoBuiltInMatch",t.error=e,t},sF=(e,t,r)=>{let n=Object.create(Zp);return n._tag="UnclusteredFlag",n.error=e,n.unclustered=t,n.rest=r,n};var sUt="@effect/cli/Args",Uj=Symbol.for(sUt),Zw={[Uj]:{_A:(e)=>e},pipe(){return ce(this,arguments)}},cF=(e)=>typeof e==="object"&&e!=null&&(Uj in e),iUt=(e)=>e,gWe=(e)=>e._tag==="Empty";var aUt=(e)=>e._tag==="WithDefault";var Hj=function(){if(arguments.length===1)if(cF(arguments[0]))return Cx(arguments[0],(e)=>[e]);else if(Gd(arguments[0]))return hWe(arguments[0]);else{let e=Object.entries(arguments[0]),t=Cx(e[0][1],(n)=>({[e[0][0]]:n}));if(e.length===1)return t;let r=e.slice(1);for(let[n,o]of r)t=Cx(voe(t,o),([s,i])=>({...s,[n]:i}));return t}return hWe(arguments[0])},xWe=(e)=>Xp(Ft(e?.name),JD(R())),yWe=(e,t)=>Xp(Ft(t?.name),QD(e)),SWe=(e)=>Xp(Ft(e?.name),Cj),EWe=(e)=>Xp(Ft(e?.name),Vw("directory",e?.exists||"either")),qj=(e)=>Xp(Ft(e?.name),Vw("file",e?.exists||"either")),bWe=(e)=>BE(qj({...e,exists:"yes"}),(t)=>br(P$(t),(r)=>He(r))),Ioe=(e)=>BE(Aoe(e),([t,r])=>br(F$(t,r,e?.format),(n)=>He(n))),CWe=(e,t)=>_oe(Ioe(t),e),Aoe=(e)=>BE(qj({...e,exists:"yes"}),(t)=>br(D$(t),(r)=>He(r))),wWe=(e)=>Xp(Ft(e?.name),wj),kWe=(e)=>Xp(Ft(e?.name),kj),Xw=(()=>{let e=Object.create(Zw);return e._tag="Empty",e})(),IWe=(e)=>Xp(Ft(e?.name),Vw("either",e?.exists||"either")),AWe=(e)=>Xp(Ft(e?.name),Ij),OWe=(e)=>Xp(Ft(e?.name),Aj),_We=(e)=>Xp(Ft(e?.name),YD),vWe=p(2,(e,t)=>lF(e,_(t),R())),TWe=p(2,(e,t)=>lF(e,R(),_(t))),RWe=p(3,(e,t,r)=>lF(e,_(t),_(r))),Bj=(e)=>yd(e),MWe=(e)=>Lj(e),PWe=(e)=>Qw(e),DWe=(e)=>Yw(e),Wj=(e)=>R_(e),Cx=p(2,(e,t)=>BE(e,(r)=>N(t(r)))),BE=p(2,(e,t)=>qWe(e,t)),FWe=p(3,(e,t,r)=>BE(e,(n)=>{try{return ye(t(n))}catch(o){return Ie(r(o))}})),NWe=(e)=>jj(Cx(e,_),R()),LWe=(e)=>lF(e,R(),R()),zj=p(3,(e,t,r)=>Sd(e,t,r)),UWe=p(2,(e,t)=>jj(e,t)),Ooe=p(2,(e,t)=>{if(iUt(e)&&aUt(e))return jj(Ooe(e.args,t),e.fallback);return BWe(e,t)}),_oe=p(2,(e,t)=>{let r=Dq(t);return BE(e,(n)=>br(r(n),(o)=>He(vu.formatIssueSync(o))))}),HWe=p(2,(e,t)=>Kw(e,t)),$j=p(2,(e,t)=>Jw(e,t)),hWe=(e)=>{if(e.length===0)return Xw;if(e.length===1)return Cx(e[0],(r)=>[r]);let t=Cx(e[0],(r)=>[r]);for(let r=1;r<e.length;r++){let n=e[r];t=Cx(voe(t,n),([o,s])=>[...o,s])}return t},yd=(e)=>{switch(e._tag){case"Empty":return Gn;case"Single":return yx([[Vqe(e.name),Rt(He(Oj(e.primitiveType)),e.description)]]);case"Map":return yd(e.args);case"Both":return Rt(yd(e.left),yd(e.right));case"Variadic":{let t=yd(e.args);return xd(t,(r,n)=>{let o=Qw(e),s=Yw(e),i=$t(Oe(e.max)?` ${o} - ${s}`:o===0?"...":` ${o}+`),a=He(Oe(e.max)?`This argument must be repeated at least ${o} times and may be repeated up to ${s} times.`:o===0?"This argument may be repeated zero or more times.":`This argument must be repeated at least ${o} times.`);return[Xa(r,i),Rt(n,a)]})}case"WithDefault":return xd(yd(e.args),(t,r)=>{let n=Lh(e.fallback)?be(e.fallback,{onNone:()=>He("This setting is optional."),onSome:(o)=>{let s=Zo(o)?o:String(o),i=ll(s,0);return He(`This setting is optional. Defaults to: ${i}`)}}):He("This setting is optional.");return[t,Rt(r,n)]});case"WithFallbackConfig":return xd(yd(e.args),(t,r)=>[t,Rt(r,He("This argument can be set from environment variables."))])}},Lj=(e)=>{switch(e._tag){case"Empty":return R();case"Single":return _(e.name);case"Map":case"Variadic":case"WithDefault":case"WithFallbackConfig":return Lj(e.args);case"Both":{let t=Jd([Lj(e.left),Lj(e.right)]);return es(t,{onEmpty:()=>R(),onNonEmpty:(r)=>_(Xt(r,", "))})}}},Qw=(e)=>{switch(e._tag){case"Empty":case"WithDefault":case"WithFallbackConfig":return 0;case"Single":return 1;case"Map":return Qw(e.args);case"Both":{let t=Qw(e.left),r=Qw(e.right);return t+r}case"Variadic":{let t=Qw(e.args);return Math.floor(Je(e.min,()=>0)*t)}}},Yw=(e)=>{switch(e._tag){case"Empty":return 0;case"Single":return 1;case"Map":case"WithDefault":case"WithFallbackConfig":return Yw(e.args);case"Both":{let t=Yw(e.left),r=Yw(e.right);return t+r}case"Variadic":{let t=Yw(e.args);return Math.floor(Je(e.max,()=>Number.MAX_SAFE_INTEGER/2)*t)}}},R_=(e)=>{switch(e._tag){case"Empty":return Ex;case"Single":return UE(tt(e.name),ZD(e.primitiveType));case"Map":return R_(e.args);case"Both":return ih(R_(e.left),R_(e.right));case"Variadic":return eF(R_(e.args));case"WithDefault":case"WithFallbackConfig":return XD(R_(e.args))}},Xp=(e,t,r=Gn)=>{let n=Object.create(Zw);return n._tag="Single",n.name=`<${Je(e,()=>__(t))}>`,n.pseudoName=e,n.primitiveType=t,n.description=r,n},qWe=(e,t)=>{let r=Object.create(Zw);return r._tag="Map",r.args=e,r.f=t,r},voe=(e,t)=>{let r=Object.create(Zw);return r._tag="Both",r.left=e,r.right=t,r},jj=(e,t)=>{let r=Object.create(Zw);return r._tag="WithDefault",r.args=e,r.fallback=t,r},BWe=(e,t)=>{let r=Object.create(Zw);return r._tag="WithFallbackConfig",r.args=e,r.config=t,r},lF=(e,t,r)=>{let n=Object.create(Zw);return n._tag="Variadic",n.args=e,n.min=t,n.max=r,n},Sd=(e,t,r)=>{switch(e._tag){case"Empty":return N([t,void 0]);case"Single":return Qe(()=>Gi(t,{onEmpty:()=>{let n=ZD(e.primitiveType);if(Oe(e.pseudoName)&&Oe(n))return ie(qu(He(`Missing argument <${e.pseudoName.value}> with choices ${n.value}`)));if(Oe(e.pseudoName))return ie(qu(He(`Missing argument <${e.pseudoName.value}>`)));if(Oe(n))return ie(qu(He(`Missing argument ${__(e.primitiveType)} with choices ${n.value}`)));return ie(qu(He(`Missing argument ${__(e.primitiveType)}`)))},onNonEmpty:(n,o)=>v_(e.primitiveType,_(n),r).pipe(Gf({onFailure:(s)=>ah(He(s)),onSuccess:(s)=>[o,s]}))}));case"Map":return Sd(e.args,t,r).pipe(L(([n,o])=>wr(e.f(o),{onFailure:(s)=>ie(ah(s)),onSuccess:(s)=>N([n,s])})));case"Both":return Sd(e.left,t,r).pipe(L(([n,o])=>Sd(e.right,n,r).pipe(W(([s,i])=>[s,[o,i]]))));case"Variadic":{let n=Je(e.min,()=>0),o=Je(e.max,()=>Number.MAX_SAFE_INTEGER),s=(i,a)=>{if(a.length>=o)return N([i,a]);return Sd(e.args,i,r).pipe(wr({onFailure:(c)=>a.length>=n&&fs(i)?N([i,a]):ie(c),onSuccess:([c,l])=>s(c,Yn(a,l))}))};return s(t,Ge()).pipe(W(([i,a])=>[i,a]))}case"WithDefault":return Sd(e.args,t,r).pipe(mc("MissingValue",()=>N([t,e.fallback])));case"WithFallbackConfig":return Sd(e.args,t,r).pipe(mc("MissingValue",(n)=>W(jo(e.config,(o)=>{if(Ob(o)){let s=He(String(o)),i=zs(s);return ie(i)}return ie(n)}),(o)=>[t,o])))}},Kw=(e,t)=>{switch(e._tag){case"Empty":return Xw;case"Single":{let r=Rt(e.description,He(t));return Xp(e.pseudoName,e.primitiveType,r)}case"Map":return qWe(Kw(e.args,t),e.f);case"Both":return voe(Kw(e.left,t),Kw(e.right,t));case"Variadic":return lF(Kw(e.args,t),e.min,e.max);case"WithDefault":return jj(Kw(e.args,t),e.fallback);case"WithFallbackConfig":return BWe(Kw(e.args,t),e.config)}},Jw=(e,t)=>{switch(e._tag){case"Empty":return N(Ge());case"Single":{let r=yd(e);return _j(e.primitiveType,r).pipe(Ba(Ao()),L((n)=>{let o=tt(n);return Sd(e,o,t).pipe(qr(o))}))}case"Map":return Jw(e.args,t).pipe(sr((r)=>Sd(e.args,r,t)));case"Both":return ca(Jw(e.left,t),Jw(e.right,t),(r,n)=>xt(r,n)).pipe(sr((r)=>Sd(e,r,t)));case"Variadic":{let r=He("How many times should this argument should be repeated?"),n=d(yd(e),Rt(r));return LE({message:fn(n).trimEnd(),min:Qw(e),max:Yw(e)}).pipe(Ba(Ao()),L((o)=>o<=0?N(Ge()):qn(Ge()).pipe(L((s)=>Jw(e.args,t).pipe(L((i)=>ea(s,xt(i))),UR(o-1),ve(sn(s)),sr((i)=>Sd(e,i,t)))))))}case"WithDefault":{let r=He("This argument is optional - use the default?"),n=d(yd(e.args),Rt(r));return Hu({message:fn(n).trimEnd(),choices:[{title:`Default ['${JSON.stringify(e.fallback)}']`,value:!0},{title:"Custom",value:!1}]}).pipe(Ba(Ao()),L((o)=>o?N(Ge()):Jw(e.args,t)))}case"WithFallbackConfig":{let r=He("Try load this option from the environment?"),n=d(yd(e.args),Rt(r));return Hu({message:fn(n).trimEnd(),choices:[{title:"Use environment variables",value:!0},{title:"Custom",value:!1}]}).pipe(Ba(Ao()),L((o)=>o?N(Ge()):Jw(e.args,t)))}}},Toe=(e)=>{switch(e._tag){case"Empty":case"Both":return"";case"Single":return th(Qp(e.description));case"Map":case"Variadic":case"WithDefault":case"WithFallbackConfig":return Toe(e.args)}},aF=(e)=>{switch(e._tag){case"Empty":return Ge();case"Single":{let t=Toe(e);return d(vj(e.primitiveType),xt(t.length===0?Ge():tt(`-d '${t}'`)),Xt(" "),tt)}case"Both":return d(aF(e.left),xt(aF(e.right)));case"Map":case"Variadic":case"WithDefault":case"WithFallbackConfig":return aF(e.args)}},qE=(e,t={multiple:!1,optional:!1})=>{switch(e._tag){case"Empty":return Ge();case"Single":{let r=t.multiple?"*":"",n=t.optional?"::":":",o=Toe(e),s=o.length>0?` -- ${o}`:"",i=Tj(e.primitiveType);return i.length===0?Ge():tt(`${r}${n}${e.name}${s}${i}`)}case"Map":return qE(e.args,t);case"Both":{let r=qE(e.left,t),n=qE(e.right,t);return xt(r,n)}case"Variadic":return Oe(e.max)&&e.max.value>1?qE(e.args,{...t,multiple:!0}):qE(e.args,t);case"WithDefault":case"WithFallbackConfig":return qE(e.args,{...t,optional:!0})}};var cUt=Uj,lUt=cF,uUt=Hj,pUt=vWe,fUt=TWe,dUt=RWe,mUt=xWe,hUt=yWe,gUt=SWe,xUt=EWe,yUt=qj,SUt=bWe,EUt=Ioe,bUt=CWe,CUt=Aoe,wUt=wWe,kUt=Bj,IUt=MWe,AUt=PWe,OUt=DWe,_Ut=Wj,vUt=kWe,TUt=Cx,RUt=BE,MUt=FWe,PUt=NWe,DUt=Xw,FUt=IWe,NUt=LWe,LUt=AWe,UUt=OWe,HUt=_We,qUt=zj,BUt=UWe,WUt=Ooe,zUt=HWe,$Ut=_oe,jUt=$j;var Vj={};Ht(Vj,{CliConfig:()=>VUt,defaultConfig:()=>GUt,defaultLayer:()=>KUt,layer:()=>JUt,make:()=>QUt,normalizeCase:()=>YUt});var VUt=S_,GUt=DE,KUt=Xqe,JUt=eBe,QUt=ooe,YUt=bi;var Te={};Ht(Te,{TypeId:()=>ZBt,fromDescriptor:()=>XBt,getBashCompletions:()=>rWt,getFishCompletions:()=>nWt,getHelp:()=>eWt,getNames:()=>tWt,getSubcommands:()=>sWt,getUsage:()=>iWt,getZshCompletions:()=>oWt,make:()=>aWt,prompt:()=>cWt,provide:()=>lWt,provideEffect:()=>uWt,provideEffectDiscard:()=>pWt,provideSync:()=>fWt,run:()=>yWt,transformHandler:()=>dWt,withDescription:()=>mWt,withHandler:()=>hWt,withSubcommands:()=>gWt,wizard:()=>xWt});var CF={};Ht(CF,{ValidationErrorTypeId:()=>Mqt,commandMismatch:()=>jqt,correctedFlag:()=>Vqt,helpRequested:()=>Xoe,invalidArgument:()=>Gqt,invalidValue:()=>Kqt,isCommandMismatch:()=>Dqt,isCorrectedFlag:()=>Fqt,isHelpRequested:()=>Nqt,isInvalidArgument:()=>Lqt,isInvalidValue:()=>Uqt,isMissingFlag:()=>qqt,isMissingSubcommand:()=>Wqt,isMissingValue:()=>Bqt,isMultipleValuesDetected:()=>Hqt,isNoBuiltInMatch:()=>zqt,isUnclusteredFlag:()=>$qt,isValidationError:()=>Pqt,keyValuesDetected:()=>Jqt,missingFlag:()=>Qqt,missingSubcommand:()=>Zqt,missingValue:()=>Yqt,noBuiltInMatch:()=>Xqt,unclusteredFlag:()=>eBt});var WWe=yA,zWe=vi;var Moe=cCe;var ek={};Ht(ek,{blocks:()=>iHt,descriptionList:()=>uHt,empty:()=>sHt,enumeration:()=>pHt,getSpan:()=>fHt,h1:()=>aHt,h2:()=>cHt,h3:()=>lHt,isDescriptionList:()=>rHt,isEmpty:()=>XUt,isEnumeration:()=>nHt,isHeader:()=>eHt,isParagraph:()=>tHt,isSequence:()=>oHt,mapDescriptionList:()=>hHt,orElse:()=>mHt,p:()=>Gj,sequence:()=>dHt,toAnsiDoc:()=>gHt,toAnsiText:()=>xHt});var XUt=nh,eHt=eoe,tHt=toe,rHt=roe,nHt=Gqe,oHt=Kqe,sHt=Gn,iHt=sj,aHt=Yp,cHt=Qqe,lHt=Yqe,Gj=He,uHt=yx,pHt=y_,fHt=Qp,dHt=Rt,mHt=Jqe,hHt=xd,gHt=noe,xHt=fn;var bt={};Ht(bt,{OptionsTypeId:()=>IHt,all:()=>iV,atLeast:()=>KHt,atMost:()=>GHt,between:()=>JHt,boolean:()=>OHt,choice:()=>_Ht,choiceWithValue:()=>vHt,date:()=>THt,directory:()=>RHt,file:()=>MHt,fileContent:()=>PHt,fileParse:()=>DHt,fileSchema:()=>FHt,fileText:()=>NHt,filterMap:()=>QHt,float:()=>LHt,getHelp:()=>UHt,getIdentifier:()=>HHt,getUsage:()=>qHt,integer:()=>BHt,isBool:()=>YHt,isOptions:()=>AHt,keyValueMap:()=>WHt,map:()=>ZHt,mapEffect:()=>XHt,mapTryCatch:()=>eqt,none:()=>zHt,optional:()=>tqt,orElse:()=>rqt,orElseEither:()=>nqt,parse:()=>oqt,processCommandLine:()=>iqt,redacted:()=>$Ht,repeated:()=>sqt,secret:()=>jHt,text:()=>VHt,withAlias:()=>aqt,withDefault:()=>cqt,withDescription:()=>pqt,withFallbackConfig:()=>lqt,withFallbackPrompt:()=>uqt,withPseudoName:()=>fqt,withSchema:()=>dqt,wizard:()=>mqt});var $We=(e,t,r)=>{if(e.length===0&&t.length===0)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let n=e.length,o=t.length,s=Array(n),i=bi(r,e),a=bi(r,t);for(let c=0;c<=n;c++)s[c]=Array(o),s[c][0]=c;for(let c=0;c<=o;c++)s[0][c]=c;for(let c=1;c<=n;c++)for(let l=1;l<=o;l++){let u=i.charAt(c-1)===a.charAt(l-1)?0:1;s[c][l]=Math.min(s[c][l-1]+1,Math.min(s[c-1][l]+1,s[c-1][l-1]+u))}return s[n][o]};var Kj=(e)=>I_(e).pipe(ga((t)=>t.split(e.delimiter||",")));var SHt="@effect/cli/Options",Zj=Symbol.for(SHt),wx={[Zj]:{_A:(e)=>e},pipe(){return ce(this,arguments)}},dF=(e)=>typeof e==="object"&&e!=null&&(Zj in e),GWe=(e)=>e,KWe=(e)=>e._tag==="Empty",JWe=(e)=>e._tag==="Single";var QWe=(e)=>e._tag==="WithDefault";var kx=function(){if(arguments.length===1)if(dF(arguments[0]))return ef(arguments[0],(e)=>[e]);else if(Gd(arguments[0]))return VWe(arguments[0]);else{let e=Object.entries(arguments[0]),t=ef(e[0][1],(n)=>({[e[0][0]]:n}));if(e.length===1)return t;let r=e.slice(1);for(let[n,o]of r)t=ef(Boe(t,o),([s,i])=>({...s,[n]:i}));return t}return VWe(arguments[0])},EHt={ifPresent:!0,negationNames:[],aliases:[]},D_=(e,t)=>{let{aliases:r,ifPresent:n,negationNames:o}={...EHt,...t},s=kc(e,r,JD(_(n)));if(ut(o)){let i=jr(o),a=ts(o),c=kc(i,a,JD(_(!n)));return pF(Noe(s,c),!n)}return pF(s,!n)},YWe=(e,t)=>{let r=QD(Ke(t,(n)=>[n,n]));return kc(e,Ge(),r)},mF=(e,t)=>kc(e,Ge(),QD(t)),ZWe=(e)=>kc(e,Ge(),Cj),XWe=(e,t)=>kc(e,Ge(),Vw("directory",t?.exists??"either")),Xj=(e,t)=>kc(e,Ge(),Vw("file",t?.exists??"either")),eze=(e)=>$E(Xj(e,{exists:"yes"}),(t)=>br(P$(t),(r)=>zs(He(r)))),Doe=(e,t)=>$E(Foe(e),([r,n])=>br(F$(r,n,t),(o)=>zs(He(o)))),tze=(e,t,r)=>qoe(Doe(e,r),t),Foe=(e)=>$E(Xj(e,{exists:"yes"}),(t)=>br(D$(t),(r)=>zs(He(r)))),rze=p(3,(e,t,r)=>$E(e,(n)=>be(t(n),{onNone:()=>Ie(zs(He(r))),onSome:ye}))),nze=(e)=>kc(e,Ge(),wj),oze=(e)=>kc(e,Ge(),kj),sze=(e)=>{if(typeof e==="string"){let t=kc(e,Ge(),YD);return Poe(t)}if(!JWe(e))throw Error("InvalidArgumentException: only single options can be key/value maps");else return Poe(e)},F_=(()=>{let e=Object.create(wx);return e._tag="Empty",e})(),ize=(e)=>kc(e,Ge(),Ij),aze=(e)=>kc(e,Ge(),Aj),cze=(e)=>kc(e,Ge(),YD),lze=p(2,(e,t)=>xF(e,_(t),R())),uze=p(2,(e,t)=>xF(e,R(),_(t))),pze=p(3,(e,t,r)=>xF(e,_(t),_(r))),fze=(e)=>fF(e),eV=(e)=>Bu(e),dze=(e)=>bd(e);var tV=(e)=>ch(e),ef=p(2,(e,t)=>Woe(e,(r)=>ye(t(r)))),$E=p(2,(e,t)=>Woe(e,t)),mze=p(3,(e,t,r)=>$E(e,(n)=>{try{return ye(t(n))}catch(o){return Ie(zs(r(o)))}})),hF=(e)=>pF(ef(e,_),R()),Noe=p(2,(e,t)=>Loe(e,t).pipe(ef(Cb))),Loe=p(2,(e,t)=>Sze(e,t)),hze=p(3,(e,t,r)=>$l(e,t,r)),gF=p(3,(e,t,r)=>Eze(t,Jj(e),r).pipe(L(([n,o,s])=>$l(e,s,r).pipe(jo((i)=>be(n,{onNone:()=>ie(i),onSome:(a)=>ie(a)})),W((i)=>[n,o,i]))))),gze=(e)=>xF(e,R(),R()),rV=p(2,(e,t)=>uh(e,(r)=>{let n=Yn(r.aliases,t);return kc(r.name,n,r.primitiveType,r.description,r.pseudoName)})),pF=p(2,(e,t)=>oV(e,t)),Uoe=p(2,(e,t)=>{if(GWe(e)&&QWe(e))return oV(Uoe(e.options,t),e.fallback);return zoe(e,t)}),Hoe=p(2,(e,t)=>{if(GWe(e)&&QWe(e))return oV(Hoe(e.options,t),e.fallback);return zoe(e,t)}),jE=p(2,(e,t)=>uh(e,(r)=>{let n=Rt(r.description,He(t));return kc(r.name,r.aliases,r.primitiveType,n,r.pseudoName)})),xze=p(2,(e,t)=>uh(e,(r)=>kc(r.name,r.aliases,r.primitiveType,r.description,_(t)))),qoe=p(2,(e,t)=>{let r=Dq(t);return $E(e,(n)=>br(r(n),(o)=>zs(He(vu.formatIssueSync(o)))))}),nV=p(2,(e,t)=>Ed(e,t)),VWe=(e)=>{if(e.length===0)return F_;if(e.length===1)return ef(e[0],(r)=>[r]);let t=ef(e[0],(r)=>[r]);for(let r=1;r<e.length;r++){let n=e[r];t=ef(Boe(t,n),([o,s])=>[...o,s])}return t},Bu=(e)=>{switch(e._tag){case"Empty":return Gn;case"Single":return yx(tt([Qp(Rj(ch(e))),Rt(He(Oj(e.primitiveType)),e.description)]));case"KeyValueMap":{let t=ru(bd(e.argumentOption));return xd(Bu(e.argumentOption),(r,n)=>{let o=He("This setting is a property argument which:"),s=`${t} key1=value key2=value2`,i=`${t} key1=value ${t} key2=value2`,a=y_([He(`May be specified a single time: '${s}'`),He(`May be specified multiple times: '${i}'`)]),c=d(n,Rt(o),Rt(a));return[r,c]})}case"Map":return Bu(e.options);case"Both":case"OrElse":return Rt(Bu(e.left),Bu(e.right));case"Variadic":{let t=Bu(e.argumentOption);return xd(t,(r,n)=>{let o=WE(e),s=zE(e),i=$t(Oe(e.max)?` ${o} - ${s}`:o===0?"...":` ${o}+`),a=He(Oe(e.max)?`This option must be repeated at least ${o} times and may be repeated up to ${s} times.`:o===0?"This option may be repeated zero or more times.":`This option must be repeated at least ${o} times.`);return[Xa(r,i),Rt(n,a)]})}case"WithDefault":return xd(Bu(e.options),(t,r)=>{let n=Lh(e.fallback)?be(e.fallback,{onNone:()=>He("This setting is optional."),onSome:(o)=>{let s=Zo(o)?o:String(o),i=ll(s,0);return He(`This setting is optional. Defaults to: ${i}`)}}):He("This setting is optional.");return[t,Rt(r,n)]});case"WithFallback":{let t=PX(e.effect)?He("This option can be set from environment variables."):cj(e.effect)?He("Will prompt the user for input if this option is not provided."):Gn;return xd(Bu(e.options),(r,n)=>[r,Rt(n,t)])}}},bd=(e)=>{switch(e._tag){case"Empty":return R();case"Single":return _(e.fullName);case"Both":case"OrElse":{let t=Jd([bd(e.left),bd(e.right)]);return es(t,{onEmpty:()=>R(),onNonEmpty:(r)=>_(Xt(r,", "))})}case"KeyValueMap":case"Variadic":return bd(e.argumentOption);case"Map":case"WithFallback":case"WithDefault":return bd(e.options)}},WE=(e)=>{switch(e._tag){case"Empty":case"WithDefault":case"WithFallback":return 0;case"Single":case"KeyValueMap":return 1;case"Map":return WE(e.options);case"Both":{let t=WE(e.left),r=WE(e.right);return t+r}case"OrElse":{let t=WE(e.left),r=WE(e.right);return Math.min(t,r)}case"Variadic":{let t=Je(e.min,()=>0),r=WE(e.argumentOption);return t*r}}},zE=(e)=>{switch(e._tag){case"Empty":return 0;case"Single":return 1;case"KeyValueMap":return Number.MAX_SAFE_INTEGER;case"Map":case"WithDefault":case"WithFallback":return zE(e.options);case"Both":{let t=zE(e.left),r=zE(e.right);return t+r}case"OrElse":{let t=zE(e.left),r=zE(e.right);return Math.min(t,r)}case"Variadic":{let t=Je(e.max,()=>Number.MAX_SAFE_INTEGER/2),r=zE(e.argumentOption);return Math.floor(t*r)}}},ch=(e)=>{switch(e._tag){case"Empty":return Ex;case"Single":{let t=VD(e.primitiveType)?R():pi(ZD(e.primitiveType),()=>_(e.placeholder));return UE(Wu(e),t)}case"KeyValueMap":return ch(e.argumentOption);case"Map":return ch(e.options);case"Both":return ih(ch(e.left),ch(e.right));case"OrElse":return woe(ch(e.left),ch(e.right));case"Variadic":return eF(ch(e.argumentOption));case"WithDefault":case"WithFallback":return XD(ch(e.options))}},fF=(e)=>{switch(e._tag){case"Single":return VD(e.primitiveType);case"Map":return fF(e.options);case"WithDefault":return fF(e.options);default:return!1}},Boe=(e,t)=>{let r=Object.create(wx);return r._tag="Both",r.left=e,r.right=t,r},yze=(e)=>e.length===1?[!0,`-${e}`]:[!1,`--${e}`],Poe=(e)=>{let t=Object.create(wx);return t._tag="KeyValueMap",t.argumentOption=e,t},Woe=(e,t)=>{let r=Object.create(wx);return r._tag="Map",r.options=e,r.f=t,r},Sze=(e,t)=>{let r=Object.create(wx);return r._tag="OrElse",r.left=e,r.right=t,r},kc=(e,t,r,n=Gn,o=R())=>{let s=Object.create(wx);return s._tag="Single",s.name=e,s.fullName=yze(e)[1],s.placeholder=`${Je(o,()=>__(r))}`,s.aliases=t,s.primitiveType=r,s.description=n,s.pseudoName=o,s},xF=(e,t,r)=>{if(!JWe(e))throw Error("InvalidArgumentException: only single options can be variadic");let n=Object.create(wx);return n._tag="Variadic",n.argumentOption=e,n.min=t,n.max=r,n},oV=(e,t)=>{let r=Object.create(wx);return r._tag="WithDefault",r.options=e,r.fallback=t,r},zoe=(e,t)=>{let r=Object.create(wx);return r._tag="WithFallback",r.options=e,r.effect=t,r},uh=(e,t)=>{switch(e._tag){case"Empty":return F_;case"Single":return t(e);case"KeyValueMap":return Poe(t(e.argumentOption));case"Map":return Woe(uh(e.options,t),e.f);case"Both":return Boe(uh(e.left,t),uh(e.right,t));case"OrElse":return Sze(uh(e.left,t),uh(e.right,t));case"Variadic":return xF(t(e.argumentOption),e.min,e.max);case"WithDefault":return oV(uh(e.options,t),e.fallback);case"WithFallback":return zoe(uh(e.options,t),e.effect)}},Wu=(e)=>{let t=(n)=>{switch(n._tag){case"Empty":return Ge();case"Single":return Ia(n.aliases,n.name);case"KeyValueMap":case"Variadic":return t(n.argumentOption);case"Map":case"WithDefault":case"WithFallback":return t(n.options);case"Both":case"OrElse":{let o=t(n.left),s=t(n.right);return xt(o,s)}}},r=bf(c4,(n)=>!n[0]);return d(t(e),Ke((n)=>yze(n)),Aa(r),Ke((n)=>n[1]))},Jj=(e)=>{switch(e._tag){case"Empty":return Ge();case"Single":case"KeyValueMap":case"Variadic":return tt(e);case"Map":case"WithDefault":case"WithFallback":return Jj(e.options);case"Both":case"OrElse":return xt(Jj(e.left),Jj(e.right))}},bHt=/=(.*)/,$l=(e,t,r)=>{switch(e._tag){case"Empty":return me;case"Single":{let n=Tc(Wu(e),(s)=>Ub(t,s));if(ut(n)){let s=jr(n),i=ts(n);if(fs(i)){if(fs(s))return v_(e.primitiveType,R(),r).pipe(br((c)=>zs(He(c))));if(ut(s)&&fs(ts(s))){let c=jr(s);return v_(e.primitiveType,_(c),r).pipe(br((l)=>zs(He(l))))}return ie(Fj(Gn,s))}let a=He(`More than one reference to option '${e.fullName}' detected`);return ie(zs(a))}let o=He(`Expected to find option: '${e.fullName}'`);return ie(qu(o))}case"KeyValueMap":{let n=(o)=>{let s=o.trim().split(bHt,2);if(ut(s)&&s.length===2&&s[1]!=="")return N(s);let i=He(`Expected a key/value pair but received '${o}'`);return ie(ah(i))};return $l(e.argumentOption,t,r).pipe(wr({onFailure:(o)=>nF(o)?en(o.values,(s)=>n(s)).pipe(W(lp)):ie(o),onSuccess:(o)=>n(o).pipe(W(yT))}))}case"Map":return $l(e.options,t,r).pipe(L((n)=>e.f(n)));case"Both":return $l(e.left,t,r).pipe(jo((n)=>$l(e.right,t,r).pipe(wr({onFailure:(o)=>{let s=Rt(n.error,o.error);return ie(qu(s))},onSuccess:()=>ie(n)}))),Ns($l(e.right,t,r)));case"OrElse":return $l(e.left,t,r).pipe(wr({onFailure:(n)=>$l(e.right,t,r).pipe(Gf({onFailure:(o)=>oF(n)&&oF(o)?qu(Rt(n.error,o.error)):zs(Rt(n.error,o.error)),onSuccess:(o)=>ye(o)})),onSuccess:(n)=>$l(e.right,t,r).pipe(wr({onFailure:()=>N(Ie(n)),onSuccess:()=>{let o=Je(bd(e.left),()=>"???"),s=Je(bd(e.right),()=>"???"),i=He(`Collision between two options detected - you can only specify one of either: ['${o}', '${s}']`);return ie(zs(i))}}))}));case"Variadic":{let n=Je(e.min,()=>0),o=Je(e.max,()=>Number.MAX_SAFE_INTEGER),s=Tc(Wu(e),(a)=>Ub(t,a)),i=(a)=>{if(a.length<n){let u=e.argumentOption.fullName,f=`Expected at least ${n} value(s) for option: '${u}'`;return ie(zs(He(f)))}if(a.length>o){let u=e.argumentOption.fullName,f=`Expected at most ${o} value(s) for option: '${u}'`;return ie(zs(He(f)))}let c=e.argumentOption.primitiveType,l=(u)=>v_(c,_(u),r).pipe(br((f)=>zs(He(f))));return en(a,(u)=>l(u))};if(Zv(s,fs))return i(Ge());return $l(e.argumentOption,t,r).pipe(wr({onFailure:(a)=>nF(a)?i(a.values):ie(a),onSuccess:(a)=>i(tt(a))}))}case"WithDefault":return $l(e.options,t,r).pipe(mc("MissingValue",()=>N(e.fallback)));case"WithFallback":return $l(e.options,t,r).pipe(mc("MissingValue",(n)=>e.effect.pipe(jo((o)=>{if(Zu(o,"QuitException"))return Ms(o);if(Kue(o)&&!Ob(o)){let s=He(String(o)),i=zs(s);return ie(i)}return ie(n)}))))}},Ed=(e,t)=>{switch(e._tag){case"Empty":return N(Ge());case"Single":{let r=Bu(e);return _j(e.primitiveType,r).pipe(L((n)=>{let o=Xo(Wu(e)[0],n);return bze(e,o,t).pipe(qr(o))}),Ba(Ao()))}case"KeyValueMap":{let r=He("Enter `key=value` pairs separated by spaces");return Kj({message:fn(r).trim(),delimiter:" "}).pipe(L((n)=>{let o=Je(bd(e),()=>"");return $l(e,yT([o,n]),t).pipe(qr(Ia(n,o)))}),Ba(Ao()))}case"Map":return Ed(e.options,t);case"Both":return ca(Ed(e.left,t),Ed(e.right,t),(r,n)=>xt(r,n));case"OrElse":{let r=He("Select which option you would like to use"),n=d(Bu(e),Rt(r)),o=(i,a)=>({title:i,value:a}),s=Jd([jt(bd(e.left),(i)=>o(i,e.left)),jt(bd(e.right),(i)=>o(i,e.right))]);return Hu({message:fn(n).trimEnd(),choices:s}).pipe(L((i)=>Ed(i,t)))}case"Variadic":{let r=He("How many times should this argument be repeated?"),n=d(Bu(e),Rt(r));return LE({message:fn(n).trimEnd(),min:WE(e),max:zE(e)}).pipe(L((o)=>o<=0?N(Ge()):qn(Ge()).pipe(L((s)=>Ed(e.argumentOption,t).pipe(L((i)=>ea(s,xt(i))),UR(o-1),ve(sn(s)))))))}case"WithDefault":{if(fF(e.options))return Ed(e.options,t);let r=He("This option is optional - use the default?"),n=d(Bu(e.options),Rt(r));return Hu({message:fn(n).trimEnd(),choices:[{title:"Yes",value:!0,description:`use the default ${Lh(e.fallback)?be(e.fallback,{onNone:()=>"",onSome:(o)=>`(${JSON.stringify(o)})`}):`(${JSON.stringify(e.fallback)})`}`},{title:"No",value:!1,description:"use a custom value"}]}).pipe(Ba(Ao()),L((o)=>o?N(Ge()):Ed(e.options,t)))}case"WithFallback":{if(fF(e.options))return Ed(e.options,t);if(cj(e.effect))return Ed(e.options,t);let r=He("Try load this option from the environment?"),n=d(Bu(e.options),Rt(r));return Hu({message:fn(n).trimEnd(),choices:[{title:"Use environment variables",value:!0},{title:"Custom",value:!1}]}).pipe(Ba(Ao()),L((o)=>o?N(Ge()):Ed(e.options,t)))}}},Eze=(e,t,r)=>{if(ut(t))return uF(e,t,r).pipe(L(([n,o,s])=>{if(xI(s))return N([R(),e,s]);return Eze(n,o,r).pipe(W(([i,a,c])=>[i,a,$oe(s,De(c))]))}),jo((n)=>N([_(n),e,Ta()])));return fs(e)?N([R(),Ge(),Ta()]):N([R(),e,Ta()])},uF=(e,t,r)=>Gi(t,{onEmpty:()=>N([e,Ge(),Ta()]),onNonEmpty:(n,o)=>bze(n,e,r).pipe(L(({leftover:s,parsed:i})=>be(i,{onNone:()=>uF(s,o,r).pipe(W(([a,c,l])=>[a,Ia(c,n),l])),onSome:({name:a,values:c})=>N([s,o,yT([a,c])])})),gS({CorrectedFlag:(s)=>uF(e,o,r).pipe(Tm(()=>_(ie(s))),L(([i,a,c])=>ie(s).pipe(Tp(()=>xI(c)),qr([i,Ia(a,n),c])))),MissingFlag:()=>uF(e,o,r).pipe(W(([s,i,a])=>[s,Ia(i,n),a])),UnclusteredFlag:(s)=>Cze(s.unclustered,s.rest,t,r).pipe(jo(()=>ie(s)))}))}),CHt=/^-{1}([^-]{2,}$)/,Qj=/^(--[^=]+)(?:=(.+))?$/,wHt=(e)=>Gi(e,{onEmpty:()=>N(Ge()),onNonEmpty:(t,r)=>{let n=t.trim();if(CHt.test(n)){let o=n.substring(1).split("").map((s)=>`-${s}`);return ie(sF(Gn,o,r))}if(Qj.test(n)){let o=Qj.exec(n);if(o!==null&&o[2]!==void 0)return N(xt([o[1],o[2]],r))}return N(e)}}),bze=(e,t,r)=>{switch(e._tag){case"Single":return wHt(t).pipe(L((n)=>Gi(n,{onEmpty:()=>{let o=He(`Expected to find option: '${e.fullName}'`);return ie(T_(o))},onNonEmpty:(o,s)=>{let i=(A)=>bi(r,A),a=i(o),c=Ke(Wu(e),(A)=>i(A));if(oc(c,a)){if(VD(e.primitiveType))return Gi(s,{onEmpty:()=>{let A=_({name:o,values:Ge()});return N({parsed:A,leftover:s})},onNonEmpty:(A,k)=>{if(GD(A)){let P=_({name:o,values:tt("true")});return N({parsed:P,leftover:k})}if(KD(A)){let P=_({name:o,values:tt("false")});return N({parsed:P,leftover:k})}let O=_({name:o,values:Ge()});return N({parsed:O,leftover:s})}});return Gi(s,{onEmpty:()=>{let A=He(`Expected a value following option: '${e.fullName}'`);return ie(qu(A))},onNonEmpty:(A,k)=>{let O=_({name:o,values:tt(A)});return N({parsed:O,leftover:k})}})}if(o.startsWith("-")){if(e.name.length>r.autoCorrectLimit+1&&$We(o,e.fullName,r)<=r.autoCorrectLimit){let k=He(`The flag '${o}' is not recognized. Did you mean '${e.fullName}'?`);return ie(Dj(k))}let A=He(`Expected to find option: '${e.fullName}'`);return ie(T_(A))}let l=-1,u=void 0;for(let A=0;A<s.length;A++){let k=s[A],O=i(k);if(oc(c,O)){l=A;break}let P=Qj.exec(k);if(P!==null){let D=i(P[1]);if(oc(c,D)){l=A,u=P[2];break}}}if(l===-1){let A=He(`Expected to find option: '${e.fullName}'`);return ie(T_(A))}let f=s[l],h=u!==void 0?Qj.exec(f)[1]:f,y=Ia(s.slice(0,l),o),E=s.slice(l+1);if(VD(e.primitiveType)){if(u!==void 0){if(GD(u)){let O=_({name:h,values:tt("true")}),P=xt(y,E);return N({parsed:O,leftover:P})}if(KD(u)){let O=_({name:h,values:tt("false")}),P=xt(y,E);return N({parsed:O,leftover:P})}}if(E.length>0){let O=E[0];if(GD(O)){let P=_({name:h,values:tt("true")}),D=xt(y,E.slice(1));return N({parsed:P,leftover:D})}if(KD(O)){let P=_({name:h,values:tt("false")}),D=xt(y,E.slice(1));return N({parsed:P,leftover:D})}}let A=_({name:h,values:Ge()}),k=xt(y,E);return N({parsed:A,leftover:k})}if(u!==void 0){let A=_({name:h,values:tt(u)}),k=xt(y,E);return N({parsed:A,leftover:k})}if(E.length===0){let A=He(`Expected a value following option: '${e.fullName}'`);return ie(qu(A))}let b=E[0],w=_({name:h,values:tt(b)}),T=xt(y,E.slice(1));return N({parsed:w,leftover:T})}})));case"KeyValueMap":{let n=Ke(Wu(e.argumentOption),(o)=>bi(r,o));return Gi(t,{onEmpty:()=>N({parsed:R(),leftover:t}),onNonEmpty:(o,s)=>{let i=(b)=>{let w=Ge(),T=b;while(ut(T)){let A=jr(T).trim(),k=bi(r,A);if(T.length>=2&&oc(n,k)){let O=T[1].trim(),[P,D]=O.split("=");if(P!==void 0&&D!==void 0&&D.length>0){w=Yn(w,O),T=T.slice(2);continue}}if(A.includes("=")){let[O,P]=A.split("=");if(O!==void 0&&P!==void 0&&P.length>0){w=Yn(w,A),T=T.slice(1);continue}}break}return[w,T]},a=bi(r,o);if(oc(n,a)){let[b,w]=i(s);return N({parsed:_({name:o,values:b}),leftover:w})}if(o.startsWith("-"))return N({parsed:R(),leftover:t});let c=-1;for(let b=0;b<s.length;b++){let w=s[b],T=bi(r,w);if(oc(n,T)){c=b;break}}if(c===-1)return N({parsed:R(),leftover:t});let l=s[c],u=Ia(s.slice(0,c),o),f=s.slice(c+1),[h,y]=i(f),E=xt(u,y);return N({parsed:_({name:l,values:h}),leftover:E})}})}case"Variadic":{let n=Ke(Wu(e.argumentOption),(l)=>bi(r,l)),o=void 0,s=Ge(),i=t,a=Ge();while(ut(i)){let l=jr(i),u=bi(r,l);if(oc(n,u)){if(o===void 0)o=l;let f=i[1];if(f!==void 0&&f.length>0)s=Yn(s,f.trim());i=i.slice(2)}else a=Yn(a,jr(i)),i=i.slice(1)}let c=Ft(o).pipe(pi(()=>_(e.argumentOption.fullName)),jt((l)=>({name:l,values:s})));return N({parsed:c,leftover:a})}}},Cze=(e,t,r,n)=>{if(ut(e)){let o=jr(e),s=ts(e);return uF(tt(o),r,n).pipe(L(([i,a,c])=>{if(xI(c))return ie(sF(Gn,Ge(),t));return Cze(s,t,a,n).pipe(W(([l,u,f])=>[t,u,$oe(c,De(f))]))}))}return N([t,r,Ta()])},$oe=(e,t)=>{if(ut(t)){let r=jr(t),n=ts(t),o=be(Ub(e,r[0]),{onNone:()=>As(e,r[0],r[1]),onSome:(s)=>As(e,r[0],xt(s,r[1]))});return $oe(o,n)}return e},kHt=(e)=>e.replaceAll("\\","\\\\").replaceAll("'","'\\''").replaceAll("[","\\[").replaceAll("]","\\]").replaceAll(":","\\:").replaceAll("$","\\$").replaceAll("`","\\`").replaceAll("(","\\(").replaceAll(")","\\)"),Yj=(e)=>{switch(e._tag){case"Empty":case"Both":case"OrElse":return"";case"Single":return th(Qp(e.description));case"KeyValueMap":case"Variadic":return Yj(e.argumentOption);case"Map":case"WithDefault":case"WithFallback":return Yj(e.options)}},M_=(e)=>{switch(e._tag){case"Empty":return Ge();case"Single":{let t=Wu(e),r=Xt(t,"|"),n=sWe(e.primitiveType);return Xo(`${r})`,` COMPREPLY=( ${n} )`," return 0"," ;;")}case"KeyValueMap":case"Variadic":return M_(e.argumentOption);case"Map":case"WithDefault":case"WithFallback":return M_(e.options);case"Both":case"OrElse":{let t=M_(e.left),r=M_(e.right);return xt(t,r)}}},P_=(e)=>{switch(e._tag){case"Empty":return Ge();case"Single":{let t=Yj(e),r=bf(c4,(n)=>!n[0]);return d(Ia(e.aliases,e.name),Ke((n)=>[n.length===1,n]),Aa(r),Ho(([n,o])=>Xo(n?"-s":"-l",o)),xt(vj(e.primitiveType)),xt(t.length===0?Ge():tt(`-d '${t}'`)),Xt(" "),tt)}case"KeyValueMap":case"Variadic":return P_(e.argumentOption);case"Map":case"WithDefault":case"WithFallback":return P_(e.options);case"Both":case"OrElse":return d(P_(e.left),xt(P_(e.right)))}},lh=(e,t={conflicts:Ge(),multiple:!1})=>{switch(e._tag){case"Empty":return Ge();case"Single":{let r=Wu(e),n=Yj(e),o=Tj(e.primitiveType),s=t.multiple?"*":"",i=ut(t.conflicts)?`(${Xt(t.conflicts," ")})`:"";return Ke(r,(a)=>`${i}${s}${a}[${kHt(n)}]${o}`)}case"KeyValueMap":return lh(e.argumentOption,{...t,multiple:!0});case"Map":case"WithDefault":case"WithFallback":return lh(e.options,t);case"Both":{let r=lh(e.left,t),n=lh(e.right,t);return xt(r,n)}case"OrElse":{let r=Wu(e.left),n=Wu(e.right),o=lh(e.left,{...t,conflicts:xt(t.conflicts,n)}),s=lh(e.right,{...t,conflicts:xt(t.conflicts,r)});return xt(o,s)}case"Variadic":return Oe(e.max)&&e.max.value>1?lh(e.argumentOption,{...t,multiple:!0}):lh(e.argumentOption,t)}};var IHt=Zj,AHt=dF,iV=kx,OHt=D_,_Ht=YWe,vHt=mF,THt=ZWe,RHt=XWe,MHt=Xj,PHt=eze,DHt=Doe,FHt=tze,NHt=Foe,LHt=nze,UHt=eV,HHt=dze,qHt=tV,BHt=oze,WHt=sze,zHt=F_,$Ht=ize,jHt=aze,VHt=cze,GHt=uze,KHt=lze,JHt=pze,QHt=rze,YHt=fze,ZHt=ef,XHt=$E,eqt=mze,tqt=hF,rqt=Noe,nqt=Loe,oqt=hze,sqt=gze,iqt=gF,aqt=rV,cqt=pF,lqt=Uoe,uqt=Hoe,pqt=jE,fqt=xze,dqt=qoe,mqt=nV;var hqt=(e)=>({_tag:"SetLogLevel",level:e}),gqt=(e)=>({_tag:"ShowCompletions",shellType:e}),N_=(e,t)=>({_tag:"ShowHelp",usage:e,helpDoc:t}),joe=(e)=>({_tag:"ShowWizard",command:e}),xqt={_tag:"ShowVersion"};var Voe=(e)=>e._tag==="ShowHelp",Goe=(e)=>e._tag==="ShowWizard";var yqt=mF("completions",[["sh","bash"],["bash","bash"],["fish","fish"],["zsh","zsh"]]).pipe(hF,jE("Generate a completion script for a specific shell.")),Sqt=mF("log-level",k6.map((e)=>[e._tag.toLowerCase(),e])).pipe(hF,jE("Sets the minimum log level for a command.")),Eqt=D_("help").pipe(rV("h"),jE("Show the help documentation for a command.")),bqt=D_("version").pipe(jE("Show the version of the application.")),Cqt=D_("wizard").pipe(jE("Start wizard mode for a command.")),Ix=kx({completions:yqt,logLevel:Sqt,help:Eqt,wizard:Cqt,version:bqt}),wze=(e,t,r)=>ef(Ix,(n)=>{if(Oe(n.completions))return _(gqt(n.completions.value));if(Oe(n.logLevel))return _(hqt(n.logLevel.value));if(n.help)return _(N_(t,r));if(n.wizard)return _(joe(e));if(n.version)return _(xqt);return R()});var yF=(e)=>({_tag:"BuiltIn",option:e}),Ax=(e,t)=>({_tag:"UserDefined",leftover:e,value:t}),Koe=(e)=>e._tag==="BuiltIn",aV=(e)=>e._tag==="UserDefined";var kqt="@effect/cli/CommandDescriptor",Ize=Symbol.for(kqt),tk={[Ize]:{_A:(e)=>e},pipe(){return ce(this,arguments)}},Aze=(e)=>typeof e==="object"&&e!=null&&(Ize in e),rk=(e)=>e._tag==="Standard";var Oze=(e,t=F_,r=Xw)=>{let n=Object.create(tk);return n._tag="Standard",n.name=e,n.description=Gn,n.options=t,n.args=r,n},_ze=(e,t)=>{let r=Object.create(tk);return r._tag="GetUserInput",r.name=e,r.description=Gn,r.prompt=t,r},lV=(e,t)=>EF(e,t),U_=(e)=>cp(VE(e)),uV=(e,t)=>vqt(e,t),pV=(e,t)=>Tqt(e,t),fV=(e,t)=>Rqt(e,t),dV=(e)=>lp(bF(e)),mV=(e)=>L_(e),hV=p(2,(e,t)=>vze(e,(r)=>ye(t(r)))),vze=p(2,(e,t)=>{let r=Object.create(tk);return r._tag="Map",r.command=e,r.f=t,r}),Tze=p(3,(e,t,r)=>SF(e,t,r)),Rze=p(2,(e,t)=>Joe(e,t)),Mze=p(2,(e,t)=>{let r=Object.create(tk);return r._tag="Subcommands",r.parent=e,r.children=Ke(t,([n,o])=>hV(o,(s)=>[n,s])),r}),gV=p(3,(e,t,r)=>_qt(e,t,r)),EF=(e,t)=>{switch(e._tag){case"Standard":{let r=nh(e.description)?Gn:Rt(Yp("DESCRIPTION"),e.description),n=Bj(e.args),o=nh(n)?Gn:Rt(Yp("ARGUMENTS"),n),s=t.showBuiltIns?iV([e.options,Ix]):e.options,i=eV(s),a=nh(i)?Gn:Rt(Yp("OPTIONS"),i);return Rt(r,Rt(o,a))}case"GetUserInput":return nh(e.description)?Gn:Rt(Yp("DESCRIPTION"),e.description);case"Map":return EF(e.command,t);case"Subcommands":{let r=(o,s)=>{switch(o._tag){case"Standard":case"GetUserInput":{let i=Qp(Rj(L_(o))),a=Yn(s,i),c=ki(a,Nu,(u,f)=>Zne(u)&&u.value===""?f:Zne(f)&&f.value===""?u:zl([u,Wl,f])),l=Qp(o.description);return tt([c,l])}case"Map":return r(o.command,s);case"Subcommands":{let i=r(o.parent,s);return be(Ki(i),{onNone:()=>Ho(o.children,(a)=>r(a,s)),onSome:([a])=>{let c=Ho(o.children,(l)=>r(l,Yn(s,a)));return xt(i,c)}})}}},n=(o)=>{let s=dl(o,0,(a,[c])=>Math.max(Bw(c),a)),i=Ke(o,([a,c])=>He(zl([a,$t(" ".repeat(s-Bw(a)+2)),c])));if(ut(i))return y_(i);throw Error("[BUG]: Subcommands.usage - received empty list of subcommands to print")};return Rt(EF(e.parent,t),Rt(Yp("COMMANDS"),n(Ho(e.children,(o)=>r(o,Ge())))))}}},VE=(e)=>{switch(e._tag){case"Standard":case"GetUserInput":return tt(e.name);case"Map":return VE(e.command);case"Subcommands":return VE(e.parent)}},bF=(e)=>{let t=(r,n)=>{switch(r._tag){case"Standard":case"GetUserInput":return tt([r.name,r]);case"Map":return t(r.command,n);case"Subcommands":return n?t(r.parent,!1):Ho(r.children,(o)=>t(o,!0))}};return t(e,!1)},L_=(e)=>{switch(e._tag){case"Standard":return ih(UE(tt(e.name),R()),ih(tV(e.options),Wj(e.args)));case"GetUserInput":return UE(tt(e.name),R());case"Map":return L_(e.command);case"Subcommands":return ih(L_(e.parent),Coe)}},SF=(e,t,r)=>{let n=(o,s)=>Gi(s,{onEmpty:()=>{let i=He(`Missing command name: '${o.name}'`);return ie(bx(i))},onNonEmpty:(i,a)=>{let c=bi(r,i),l=bi(r,o.name);return N(a).pipe(Tp(()=>c===l),aa,mc("NoSuchElementException",()=>{let u=He(`Missing command name: '${o.name}'`);return ie(bx(u))}))}});switch(e._tag){case"Standard":{let o=(a)=>Gi(a,{onEmpty:()=>{let c=He(`Missing command name: '${e.name}'`);return ie(bx(c))},onNonEmpty:(c)=>{let l=bi(r,c),u=bi(r,e.name);if(l===u){let h=EF(e,r),y=L_(e),E=wze(e,y,h),b=wf(a,1);return gF(E,b,r).pipe(L((w)=>w[2]),mc("NoSuchElementException",()=>{let w=He("No built-in option was matched");return ie(Nj(w))}),W(yF))}let f=He(`Missing command name: '${e.name}'`);return ie(bx(f))}}),s=(a)=>n(e,a).pipe(L((c)=>{let[l,u]=Iqt(c);return gF(e.options,l,r).pipe(L(([f,h,y])=>zj(e.args,xt(h,u),r).pipe(jo((E)=>be(f,{onNone:()=>ie(E),onSome:(b)=>ie(b)})),W(([E,b])=>Ax(E,{name:e.name,options:y,args:b})))))})),i=(a)=>{if(oc(a,"--help")||oc(a,"-h"))return o(Xo(e.name,"--help"));if(oc(a,"--wizard"))return o(Xo(e.name,"--wizard"));if(oc(a,"--version"))return o(Xo(e.name,"--version"));let c=He(`Missing command name: '${e.name}'`);return ie(bx(c))};return o(t).pipe(Pm(()=>s(t)),Tm((a)=>{if(HE(a)){if(r.finalCheckBuiltIn)return _(i(t).pipe(Tm((c)=>HE(c)?_(ie(a)):R())));return _(ie(a))}return R()}))}case"GetUserInput":return n(e,t).pipe(ve(UD(e.prompt)),mc("QuitException",(o)=>Ms(o)),W((o)=>Ax(wf(t,1),{name:e.name,value:o})));case"Map":return SF(e.command,t,r).pipe(L((o)=>{if(aV(o))return e.f(o.value).pipe(W((s)=>Ax(o.leftover,s)));return N(o)}));case"Subcommands":{let o=VE(e),s=bF(e),[i,a]=qh(t,(E)=>!T4(s,([b])=>b===E)),c=(E)=>Qe(()=>{let b=e.children[Symbol.iterator](),w=(T)=>SF(T,E,r).pipe(oq(rF,(A)=>{let k=b.next();return k.done?ie(A):w(k.value)}));return w(b.next().value)}),l=c(a),u=Ce(()=>yF(N_(L_(e),EF(e,r)))),f=l.pipe(L((E)=>{if(Koe(E)&&Voe(E.option)){let b=Je(Ki(o),()=>""),w=yF(N_(ih(UE(tt(b),R()),E.option.usage),E.option.helpDoc));return N(w)}return ie(ah(Gn))})),h=Ce(()=>yF(joe(e))),y=l.pipe(L((E)=>{if(Koe(E)&&Goe(E.option))return N(E);return ie(ah(Gn))}));return Qe(()=>SF(e.parent,i,r).pipe(L((E)=>{switch(E._tag){case"BuiltIn":{if(Voe(E.option))return ut(a)?Pm(f,()=>u):u;if(Goe(E.option))return Pm(y,()=>h);return N(E)}case"UserDefined":{let b=xt(E.leftover,a);if(ut(b))return c(b).pipe(L((w)=>{if(!aV(w))return N(w);let T=w.leftover;if(fs(T))return N(Ax(T,{...E.value,subcommand:_(w.value)}));let A=xt(i,T);return SF(e.parent,A,r).pipe(L((k)=>{if(!aV(k))return N(Ax(T,{...E.value,subcommand:_(w.value)}));return N(Ax(k.leftover,{...k.value,subcommand:_(w.value)}))}),jo(()=>N(Ax(T,{...E.value,subcommand:_(w.value)}))))}),jo((w)=>{if(rF(w)){let T=Je(Ki(o),()=>""),A=Ke(s,([P])=>`'${P}'`),k=A.length===1?"":" one of",O=He(`Invalid subcommand for ${T} - use${k} ${Xt(A,", ")}`);return ie(bx(O))}return ie(w)}));return N(Ax(E.leftover,{...E.value,subcommand:R()}))}}}),Tm(()=>fs(t)?_(u):R())))}}},Iqt=(e)=>{let[t,r]=qh(e,(n)=>n!=="--");return[t,wf(r,1)]},Joe=(e,t)=>{switch(e._tag){case"Standard":{let r=typeof t==="string"?Gj(t):t,n=Object.create(tk);return n._tag="Standard",n.name=e.name,n.description=r,n.options=e.options,n.args=e.args,n}case"GetUserInput":{let r=typeof t==="string"?Gj(t):t,n=Object.create(tk);return n._tag="GetUserInput",n.name=e.name,n.description=r,n.prompt=e.prompt,n}case"Map":return vze(Joe(e.command,t),e.f);case"Subcommands":{let r=Object.create(tk);return r._tag="Subcommands",r.parent=Joe(e.parent,t),r.children=e.children.slice(),r}}},Aqt=rh("Args Wizard - "),Oqt=rh("Options Wizard - "),_qt=(e,t,r)=>{let n=(o,s)=>{switch(o._tag){case"GetUserInput":case"Standard":return $e(function*(){let i=sn(s).pipe(L((a)=>{let c=He(d(oj(PE("COMMAND:",nj)),Xa(Wl),Xa(PE(Xt(a," "),Qne))));return Ao(fn(c))}));if(rk(o)){yield*i;let a=PE(o.name,Qne);if(!KWe(o.options)){let c=He(Xa(Oqt,a));yield*Ao(fn(c));let l=yield*nV(o.options,r);yield*N6(s,xt(l)),yield*i}if(!gWe(o.args)){let c=He(Xa(Aqt,a));yield*Ao(fn(c));let l=yield*$j(o.args,r);yield*N6(s,xt(l)),yield*i}}return yield*sn(s)});case"Map":return n(o.command,s);case"Subcommands":{let i=He("Select which command you would like to execute"),a=fn(i).trimEnd(),c=(u,f)=>({title:u,value:[u,f]}),l=d(bF(o),Ke(([u],f)=>c(u,f)));return n(o.parent,s).pipe(ve(Hu({message:a,choices:l}).pipe(sr(([u])=>ea(s,Yn(u))),Ba(Ao()),L(([,u])=>n(o.children[u],s)))))}}};return qn(t).pipe(L((o)=>n(e,o).pipe(ve(sn(o)))))},Qoe=(e)=>{switch(e._tag){case"Standard":return th(Qp(e.description));case"GetUserInput":return th(Qp(e.description));case"Map":return Qoe(e.command);case"Subcommands":return""}},Yoe=(e,t,r)=>WWe(t).pipe(L((n)=>{let o=(s,i,a,c)=>{switch(s._tag){case"Standard":{let l={command:s,parentCommands:i,subcommands:a,level:c};return Moe(n,(u)=>r(u,l))}case"GetUserInput":{let l={command:s,parentCommands:i,subcommands:a,level:c};return Moe(n,(u)=>r(u,l))}case"Map":return o(s.command,i,a,c);case"Subcommands":{let l=VE(s.parent),u=bF(s),f=xt(i,l);return o(s.parent,i,u,c).pipe(ve(en(s.children,(h)=>o(h,f,a,c+1))))}}};return Qe(()=>o(e,Ge(),Ge(),0)).pipe(ve(zWe(n)))})),tf=p(2,(e,t)=>{let r=Vd(t+1).join(" ");return Ke(e,(n)=>`${r}${n}`)}),vqt=(e,t)=>Yoe(e,Ge(),(r,n)=>{let o=rk(n.command)?iV([n.command.options,Ix]):Ix,s=Wu(o),i=rk(n.command)?M_(n.command.options):Ge(),a=d(n.subcommands,Ke(([b])=>b),Aa(lL)),c=xt(s,a),l=fs(n.parentCommands)?tt(n.command.name):d(n.parentCommands,Yn(n.command.name),Ke((b)=>b.replace("-","__"))),u=Xt(l,","),f=Xt(l,"__"),h=fs(n.parentCommands)?Ge():[`${u})`,` cmd="${f}"`," ;;"],y=[`${f})`,` opts="${Xt(c," ")}"`,` if [[ \${cur} == -* || \${COMP_CWORD} -eq ${n.level+1} ]] ; then`,' COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )'," return 0"," fi",' case "${prev}" in',...tf(i,8)," *)"," COMPREPLY=()"," ;;"," esac",' COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )'," return 0"," ;;"],E=Yn(r,[h,y]);return N(E)}).pipe(W((r)=>{let n=kb(VE(e),0),o=`_${n}_bash_completions`,s=Ho(r,([a])=>a),i=Ho(r,([,a])=>a);return[`function ${o}() {`," 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="${t}"`," ;;",...tf(s,12)," *)"," ;;"," esac"," done",' case "${cmd}" in',...tf(i,8)," esac","}",`complete -F ${o} -o nosort -o bashdefault -o default ${n}`]})),Tqt=(e,t)=>Yoe(e,Ge(),(r,n)=>{let o=Xo("complete","-c",t),s=rk(n.command)?kx([Ix,n.command.options]):Ix,i=P_(s),a=rk(n.command)?aF(n.command.args):Ge(),c=(E)=>d(Ke(i,(b)=>d(o,xt(E),Yn(b),Xt(" "))),xt(Ke(a,(b)=>d(o,xt(E),Yn(b),Xt(" "))))),l=(E)=>Ke(n.subcommands,([b,w])=>{let T=Qoe(w);return d(o,xt(E),xt(Xo("-f","-a",`"${b}"`)),xt(T.length===0?Ge():Xo("-d",`'${T}'`)),Xt(" "))});if(fs(n.parentCommands)){let E=Xo("-n",'"__fish_use_subcommand"');return N(d(r,xt(c(E)),xt(l(E))))}let u=d(n.parentCommands,wf(1),Yn(n.command.name),Ke((E)=>`__fish_seen_subcommand_from ${E}`)),f=Ke(n.subcommands,([E])=>`not __fish_seen_subcommand_from ${E}`),h=d(xt(u,f),Xt("; and ")),y=Xo("-n",`"${h}"`);return N(d(r,xt(c(y)),xt(l(y))))}),Rqt=(e,t)=>Yoe(e,Ge(),(r,n)=>{let o=fs(n.parentCommands)?tt(n.command.name):d(n.parentCommands,Yn(n.command.name),Ke((u)=>u.replace("-","__"))),s=Xt(o,"__"),i=Xt(o," "),a=d(n.subcommands,Ke(([u,f])=>{let h=Qoe(f);return`'${u}:${h}' \\`})),c=fs(a)?"commands=()":`commands=(
|
|
199
|
+
${Xt(tf(a,8),`
|
|
200
|
+
`)}
|
|
201
|
+
)`,l=[`(( $+functions[_${s}_commands] )) ||`,`_${s}_commands() {`,` local commands; ${c}`,` _describe -t commands '${i} commands' commands "$@"`,"}"];return N(xt(r,l))}).pipe(W((r)=>{let n=kb(VE(e),0),o=cV(e,Ge(),Ge()),s=`_${n}_zsh_completions`;return[`#compdef ${t}`,"","autoload -U is-at-least","",`function ${s}() {`," 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',...tf(o,4),"}","",...r,"",`if [ "$funcstack[1]" = "${s}" ]; then`,` ${s} "$@"`,"else",` compdef ${s} ${n}`,"fi"]})),cV=(e,t,r)=>{switch(e._tag){case"Standard":case"GetUserInput":{let n=rk(e)?kx([Ix,e.options]):Ix,o=rk(e)?e.args:Xw,s=d(lh(n),Ke((a)=>`'${a}' \\`)),i=d(qE(o),Ke((a)=>`'${a}' \\`));if(fs(t))return['_arguments "${_arguments_options[@]}" \\',...tf(s,4),...tf(i,4),` ":: :_${e.name}_commands" \\`,` "*::: :->${e.name}" \\`," && ret=0"];if(fs(r))return[`(${e.name})`,'_arguments "${_arguments_options[@]}" \\',...tf(s,4),...tf(i,4)," && ret=0",";;"];return[`(${e.name})`,'_arguments "${_arguments_options[@]}" \\',...tf(s,4),...tf(i,4),` ":: :_${Yn(t,e.name).join("__")}_commands" \\`,` "*::: :->${e.name}" \\`," && ret=0"]}case"Map":return cV(e.command,t,r);case"Subcommands":{let n=bF(e),o=VE(e.parent),s=cV(e.parent,t,xt(r,n)),i=d(e.children,Ho((l)=>cV(l,xt(t,o),r))),a=d(xt(t,o),Xt("-")),c=d(o,Ho((l)=>["case $state in",` (${l})`,' words=($line[1] "${words[@]}")'," (( CURRENT += 1 ))",` curcontext="\${curcontext%:*:*}:${a}-command-$line[1]:"`," case $line[1] in",...tf(i,8)," esac"," ;;","esac"]),xt(fs(t)?Ge():tt(";;")));return xt(s,c)}}},Pze=(e)=>{let t=Object.create(Zp);return t._tag="HelpRequested",t.error=Gn,t.command=e,t};var Mqt=tF,Pqt=HE,Dqt=rF,Fqt=aWe,Nqt=Pj,Lqt=cWe,Uqt=lWe,Hqt=nF,qqt=uWe,Bqt=oF,Wqt=pWe,zqt=fWe,$qt=dWe,jqt=bx,Vqt=Dj,Xoe=Pze,Gqt=ah,Kqt=zs,Jqt=Fj,Qqt=T_,Yqt=qu,Zqt=mWe,Xqt=Nj,eBt=sF;var rf={};Ht(rf,{LoggerTypeId:()=>rBt,add:()=>oBt,addEffect:()=>sBt,addScoped:()=>iBt,batched:()=>pBt,defaultLogger:()=>H_,filterLogLevel:()=>lBt,isLogger:()=>LBt,json:()=>MBt,jsonLogger:()=>ABt,logFmt:()=>PBt,logfmtLogger:()=>OBt,make:()=>nBt,map:()=>uBt,mapInput:()=>aBt,mapInputOptions:()=>cBt,minimumLogLevel:()=>NBt,none:()=>hBt,pretty:()=>DBt,prettyLogger:()=>vBt,prettyLoggerDefault:()=>kF,remove:()=>xV,replace:()=>wF,replaceEffect:()=>gBt,replaceScoped:()=>xBt,simple:()=>yBt,stringLogger:()=>_Bt,structured:()=>FBt,structuredLogger:()=>TBt,succeed:()=>SBt,sync:()=>EBt,test:()=>bBt,tracerLogger:()=>RBt,withConsoleError:()=>mBt,withConsoleLog:()=>fBt,withLeveledConsole:()=>dBt,withMinimumLogLevel:()=>ese,withSpanAnnotations:()=>CBt,zip:()=>wBt,zipLeft:()=>kBt,zipRight:()=>IBt});var Dze=p(2,(e,t)=>e.log({fiberId:Db,logLevel:MI,message:t,cause:V0,context:R2(),spans:up(),annotations:Ta(),date:new Date}));var rBt=oA,nBt=ra,oBt=uM,sBt=GY,iBt=KY,aBt=hye,cBt=vU,lBt=gye,uBt=T0,pBt=lEe,fBt=dA,dBt=rEe,mBt=nEe,hBt=xye,xV=pM,wF=nOe,gBt=oOe,xBt=sOe,yBt=TU,SBt=yye,EBt=Sye,bBt=Dze,ese=rOe,CBt=cEe,wBt=RU,kBt=Eye,IBt=bye,H_=wC,ABt=DU,OBt=PU,_Bt=MU,vBt=f8,kF=FU,TBt=R0,RBt=j8,MBt=wF(wC,oEe),PBt=wF(wC,sEe),DBt=wF(wC,iEe),FBt=wF(wC,aEe),NBt=tOe,LBt=wye;var Fze=te;var HBt={pipe(){return ce(this,arguments)}},Lze=(e)=>{let t=Object.create(HBt);return t.name=e.name,t.version=e.version,t.executable=e.executable,t.command=e.command,t.summary=e.summary||Nu,t.footer=e.footer||Gn,t},yV=p(3,(e,t,r)=>UQ((n)=>{let o=Je(ws(n,S_),()=>DE),[s,i]=qBt(e,t),a=xt(BBt(e.command),i);return wr(Tze(e.command,a,o),{onFailure:(c)=>ve(tse(c.error),ie(c)),onSuccess:Fze((c)=>{switch(c._tag){case"UserDefined":return Gi(c.leftover,{onEmpty:()=>r(c.value).pipe(Tm((l)=>HE(l)&&Pj(l)?_(Nze(e,s,i,N_(mV(l.command),lV(l.command,o)),r,o,t)):R())),onNonEmpty:(l)=>{let u=He(`Received unknown argument: '${l}'`);return ve(tse(u),ie(zs(u)))}});case"BuiltIn":return Nze(e,s,i,c.option,r,o,t).pipe(Tm((l)=>HE(l)?_(ve(tse(l.error),ie(l))):R()))}})})})),qBt=(e,t)=>{if(e.executable!==void 0)return[e.executable,wf(t,2)];let[[r,n],o]=rI(t,2);return[`${r} ${n}`,o]},tse=(e)=>$5(fn(e)),Nze=(e,t,r,n,o,s,i)=>{switch(n._tag){case"SetLogLevel":{let a=Kv(i,2),c=[];for(let u=0;u<r.length;u++){if($Bt(r[u])||r[u-1]==="--log-level")continue;c.push(r[u])}let l=xt(a,c);return yV(e,l,o).pipe(ese(n.level))}case"ShowHelp":{let a=Yp(rh(e.name)),c=He(zl([$t(`${e.name} ${e.version}`),Xne(e.summary)?Nu:zl([Wl,$t("--"),Wl,e.summary])])),l=Rt(Yp("USAGE"),d(koe(n.usage,s),Ke((f)=>He(Xa($t("$ "),f))),dl(Gn,(f,h)=>Rt(f,h)))),u=d(a,Rt(c),Rt(l),Rt(n.helpDoc),Rt(e.footer));return Ao(fn(u))}case"ShowCompletions":{let a=De(U_(e.command))[0];switch(n.shellType){case"bash":return uV(e.command,a).pipe(L((c)=>Ao(Xt(c,`
|
|
202
|
+
`))));case"fish":return pV(e.command,a).pipe(L((c)=>Ao(Xt(c,`
|
|
203
|
+
`))));case"zsh":return fV(e.command,a).pipe(L((c)=>Ao(Xt(c,`
|
|
204
|
+
`))))}}case"ShowWizard":{let a=Xne(e.summary)?Nu:zl([Wl,$t("--"),Wl,e.summary]),c=Rt(He(zl([$t("The wizard mode will assist you with constructing commands for"),Wl,rh(`${e.name} (${e.version})`),$t(".")])),He("Please answer all prompts provided by the wizard.")),l=yx([[$t("Instructions"),c]]),u=Yp(zl([rh("Wizard Mode for CLI Application:"),Wl,rh(e.name),Wl,rh(`(${e.version})`),a])),f=Rt(u,l),h=fn(f),y=De(U_(e.command))[0],E=WBt(n,y,r);return Ao(h).pipe(ve(gV(n.command,E,s)),sr((b)=>Ao(fn(zBt(b)))),L((b)=>A_({message:"Would you like to run the command?",initial:!0,active:"yes",inactive:"no"}).pipe(L((w)=>{let T=Kv(i,2),A=wf(b,1),k=xt(T,A);return w?Ao().pipe(ve(yV(e,k,o))):me}))),jo((b)=>{if(soe(b)){let w=He(jqe(`
|
|
205
|
+
|
|
206
|
+
Quitting wizard mode...`));return Ao(fn(w))}return ie(b)}))}case"ShowVersion":{let a=He(e.version);return Ao(fn(a))}}},BBt=(e)=>{let t=e,r=Ge();while(t!==void 0)switch(t._tag){case"Standard":{r=tt(t.name),t=void 0;break}case"GetUserInput":{r=tt(t.name),t=void 0;break}case"Map":{t=t.command;break}case"Subcommands":{t=t.parent;break}}return r},WBt=(e,t,r)=>{let n=dV(e.command),[o,s]=qh(r,(a)=>!yfe(n,a)),i=Gi(s,{onEmpty:()=>Qd(o,(a)=>a!=="--wizard"),onNonEmpty:(a)=>Yn(o,a)});return xt(t.split(/\s+/),i)},zBt=(e)=>{let t=d(Qd(e,(n)=>n.length>0),Xt(" ")),r=$t("You may now execute your command directly with the following options and arguments:");return sj([He(oj(rh("Wizard Mode Complete!"))),He(r),He(Xa($t(" "),PE(t,nj)))])},$Bt=(e)=>e&&(e==="--log-level"||e.startsWith("--log-level="));var VBt="@effect/cli/Command",SV=Symbol.for(VBt),GBt=(e)=>{let t=[],r=0,n=[],o=0;function s(a){let c={};for(let l in a)c[l]=i(a[l]);return c}function i(a){if(Gd(a))return{_tag:"Array",children:Ke(a,i)};else if(cF(a))return t.push(a),{_tag:"Args",index:r++};else if(dF(a))return n.push(a),{_tag:"Options",index:o++};else return{_tag:"ParsedConfig",tree:s(a)}}return{args:t,options:n,tree:s(e)}},Uze=(e,t,r)=>{let n={};for(let s in e)n[s]=o(e[s]);return n;function o(s){if(s._tag==="Args")return t[s.index];else if(s._tag==="Options")return r[s.index];else if(s._tag==="Array")return Ke(s.children,o);else return Uze(s.tree,t,r)}},Hze={...cg,[SV]:SV,commit(){return this.tag},pipe(){return ce(this,arguments)}},rse=je("@effect/cli/Command/registeredDescriptors",()=>new WeakMap),KBt=(e)=>rse.get(e.tag)??e.descriptor,qze=(e,t,r,n=te)=>{let o=Object.create(Hze);return o.descriptor=e,o.handler=t,o.transform=n,o.tag=r,o},GE=(e,t)=>{let r=Object.create(Hze);return r.descriptor=t.descriptor??e.descriptor,r.handler=t.handler??e.handler,r.transform=t.transform?(n,o)=>t.transform(e.transform(n,o),o):e.transform,r.tag=e.tag,r},nse=p((e)=>Aze(e[0]),(e,t)=>{let r=qze(e,t??((n)=>PA(()=>Xoe(KBt(r)))),qt(`@effect/cli/Command/(${De(U_(e)).join("|")})`));return r}),JBt=(e,t)=>{let{args:r,options:n,tree:o}=GBt(t);return hV(Oze(e,kx(n),Hj(r)),({args:s,options:i})=>Uze(o,s,i))},Bze=(e,t={},r)=>nse(JBt(e,t),r),Wze=(e,t)=>lV(e.descriptor,t),zze=(e)=>U_(e.descriptor),$ze=(e,t)=>uV(e.descriptor,t),jze=(e,t)=>pV(e.descriptor,t),Vze=(e,t)=>fV(e.descriptor,t),Gze=(e)=>dV(e.descriptor),Kze=(e)=>mV(e.descriptor),QBt=p(2,(e,t)=>GE(e,{descriptor:t(e.descriptor)})),Jze=(e,t,r)=>qze(hV(_ze(e,t),(n)=>n.value),r,qt(`@effect/cli/Prompt/${e}`)),Qze=p(2,(e,t)=>GE(e,{handler:t,transform:te})),Yze=p(2,(e,t)=>GE(e,{transform:t})),Zze=p(2,(e,t)=>GE(e,{transform:(r,n)=>Vo(r,typeof t==="function"?t(n):t)})),Xze=p(3,(e,t,r)=>GE(e,{transform:(n,o)=>{let s=typeof r==="function"?r(o):r;return ku(n,t,s)}})),e$e=p(2,(e,t)=>GE(e,{transform:(r,n)=>{let o=typeof t==="function"?t(n):t;return ve(o,r)}})),t$e=p(3,(e,t,r)=>GE(e,{transform:(n,o)=>{let s=typeof r==="function"?r(o):r;return xi(n,t,s)}})),r$e=p(2,(e,t)=>QBt(e,Rze(t))),n$e=p(2,(e,t)=>{let r=Mze(e.descriptor,Ke(t,(s)=>[s.tag,s.descriptor])),n=ki(t,new Map,(s,i)=>(s.set(i.tag,i),rse.set(i.tag,i.descriptor),s));function o(s){if(s.subcommand._tag==="Some"){let[i,a]=s.subcommand.value,c=n.get(i),l=c.transform(c.handler(a),a);return xi(l,e.tag,s)}return e.handler(s)}return GE(e,{descriptor:r,handler:o})}),o$e=p(3,(e,t,r)=>gV(e.descriptor,t,r)),s$e=p(2,(e,t)=>{let r=Lze({...t,command:e.descriptor});rse.set(e.tag,e.descriptor);let n=(o)=>e.transform(e.handler(o),o);return(o)=>yV(r,o,n)});var ZBt=SV,XBt=nse,eWt=Wze,tWt=zze,rWt=$ze,nWt=jze,oWt=Vze,sWt=Gze,iWt=Kze,aWt=Bze,cWt=Jze,lWt=Zze,uWt=Xze,pWt=e$e,fWt=t$e,dWt=Yze,mWt=r$e,hWt=Qze,gWt=n$e,xWt=o$e,yWt=s$e;var jl={};Ht(jl,{PromptTypeId:()=>WWt,all:()=>zWt,confirm:()=>$Wt,custom:()=>jWt,date:()=>VWt,file:()=>GWt,flatMap:()=>KWt,float:()=>JWt,hidden:()=>QWt,integer:()=>YWt,list:()=>ZWt,map:()=>XWt,multiSelect:()=>nzt,password:()=>ezt,run:()=>tzt,select:()=>rzt,succeed:()=>ozt,text:()=>szt,toggle:()=>izt});var SWt=hr(bc,{style:"pretty"});function EWt(e){return $e(function*(){let r=yield*(yield*zr).columns,n=oi(e.message,r),o=se(Cc,Bl);return n.pipe(se(o),Fn(Dn),hr({style:"pretty",options:{lineWidth:r}}))})}var bWt=/\r?\n/;function i$e(e,t,r,n){let o=(i)=>Le(et(i),Ws),s=se(t,zt);return es(n.message.split(bWt),{onEmpty:()=>ha([s,r,e]),onNonEmpty:(i)=>{let a=Ke(i,(c)=>o(c));return s.pipe(se(Za(ao(a),2)),se(zt),se(r),se(zt),se(e))}})}function CWt(e,t){return $e(function*(){let n=yield*(yield*zr).columns,o=yield*cs,s=Le(et("?"),Ro),i=Le(o.pointerSmall,rn),a=e.value?t.placeholder.defaultConfirm:t.placeholder.defaultDeny,c=Le(et(a),rn),l=i$e(c,s,i,t);return Fu.pipe(se(l),Fn(Dn),hr({style:"pretty",options:{lineWidth:n}}))})}function wWt(e,t){return $e(function*(){let n=yield*(yield*zr).columns,o=yield*cs,s=Le(o.tick,Ya),i=Le(o.ellipsis,rn),a=e?t.label.confirm:t.label.deny,c=et(a);return i$e(c,s,i,t).pipe(se(Vn),Fn(Dn),hr({style:"pretty",options:{lineWidth:n}}))})}function kWt(e){return(t,r)=>ze.$match(r,{Beep:()=>N(SWt),NextFrame:({state:n})=>CWt(n,e),Submit:({value:n})=>wWt(n,e)})}var IWt=/^y|t$/,AWt=/^n|f$/;function OWt(e,t){let r=Je(e.input,()=>"");if(e.key.name==="enter"||e.key.name==="return")return N(ze.Submit({value:t}));if(IWt.test(r.toLowerCase()))return N(ze.Submit({value:!0}));if(AWt.test(r.toLowerCase()))return N(ze.Submit({value:!1}));return N(ze.Beep())}var a$e=(e)=>{let t={initial:!1,...e,label:{confirm:"yes",deny:"no",...e.label},placeholder:{defaultConfirm:"(Y/n)",defaultDeny:"(y/N)",...e.placeholder}},r={value:t.initial};return Wi(r,{render:kWt(t),process:(n)=>OWt(n,t.initial),clear:()=>EWt(t)})};var vWt=hr(bc,{style:"pretty"}),c$e=/\r?\n/;function l$e(e,t,r){let n=(s)=>Le(et(s),Ws),o=se(e,zt);return es(r.message.split(c$e),{onEmpty:()=>ha([o,t]),onNonEmpty:(s)=>{let i=Ke(s,(a)=>n(a));return o.pipe(se(Za(ao(i),2)),se(zt),se(t),se(zt))}})}function TWt(e,t){return be(e.error,{onNone:()=>Dr,onSome:(r)=>es(r.split(c$e),{onEmpty:()=>Dr,onNonEmpty:(n)=>{let o=(a)=>Le(et(a),Ei(OE,Ul)),s=se(Le(t,Ul),zt),i=Ke(n,(a)=>o(a));return RE.pipe(se(Vn),se(s),se(hx(ao(i))),se(ME))}})})}function RWt(e,t){if(!e.disabled&&e.description&&t)return qw("-").pipe(se(zt),se(et(e.description)),Le(rn));return Dr}var u$e=2;function MWt(e,t,r){let n=t.choices,o=n.length,a=e.selectedIndices.size===o?t?.selectNone??"Select None":t?.selectAll??"Select All",c=t?.inverseSelection??"Inverse Selection",l=[{title:a},{title:c}],u=[...l,...n],f=w_(e.index,u.length,t.maxPerPage),h=[];for(let y=f.startIndex;y<f.endIndex;y++){let E=u[y],b=e.index===y,w=zt;if(y===f.startIndex&&f.startIndex>0)w=r.arrowUp;else if(y===f.endIndex-1&&f.endIndex<u.length)w=r.arrowDown;if(y<l.length){let T=b?Le(et(E.title),Ro):et(E.title);h.push(w.pipe(se(zt),se(T)))}else{let T=y-l.length,k=e.selectedIndices.has(T)?r.checkboxOn:r.checkboxOff,O=b?Le(k,Ro):k,P=et(E.title),D=RWt(E,b);h.push(w.pipe(se(zt),se(O),se(zt),se(P),se(zt),se(D)))}}return ao(h)}function PWt(e,t){return $e(function*(){let n=yield*(yield*zr).columns,o=yield*cs,s=MWt(e,t,o),i=Le(et("?"),Ro),a=Le(o.pointerSmall,rn),c=l$e(i,a,t),l=TWt(e,o.pointer);return Fu.pipe(se(c),se(Vn),se(s),se(l),hr({style:"pretty",options:{lineWidth:n}}))})}function DWt(e,t){return $e(function*(){let n=yield*(yield*zr).columns,o=yield*cs,i=Array.from(e.selectedIndices).sort(uc).map((f)=>t.choices[f].title).join(", "),a=et(i),c=Le(o.tick,Ya),l=Le(o.ellipsis,rn);return l$e(c,l,t).pipe(se(zt),se(Le(a,Zm)),se(Vn),hr({style:"pretty",options:{lineWidth:n}}))})}function FWt(e,t){let r=e.index===0?t-1:e.index-1;return N(ze.NextFrame({state:{...e,index:r}}))}function NWt(e,t){let r=(e.index+1)%t;return N(ze.NextFrame({state:{...e,index:r}}))}function LWt(e,t){let r=new Set(e.selectedIndices);if(e.index===0)if(e.selectedIndices.size===t.choices.length)r.clear();else for(let n=0;n<t.choices.length;n++)r.add(n);else if(e.index===1)for(let n=0;n<t.choices.length;n++)if(e.selectedIndices.has(n))r.delete(n);else r.add(n);else{let n=e.index-u$e;if(r.has(n))r.delete(n);else r.add(n)}return N(ze.NextFrame({state:{...e,selectedIndices:r}}))}function UWt(e){return $e(function*(){let r=yield*(yield*zr).columns,n=se(Cc,Bl),o=`
|
|
207
|
+
`.repeat(Math.min(e.choices.length+2,e.maxPerPage))+e.message+1;return oi(o,r).pipe(se(n),Fn(Dn),hr({style:"pretty",options:{lineWidth:r}}))})}function HWt(e){return(t,r)=>{let n=e.choices.length+u$e;switch(t.key.name){case"k":case"up":return FWt({...r,error:R()},n);case"j":case"down":case"tab":return NWt({...r,error:R()},n);case"space":return LWt(r,e);case"enter":case"return":{let o=r.selectedIndices.size;if(e.min!==void 0&&o<e.min)return N(ze.NextFrame({state:{...r,error:_(`At least ${e.min} are required`)}}));if(e.max!==void 0&&o>e.max)return N(ze.NextFrame({state:{...r,error:_(`At most ${e.max} choices are allowed`)}}));let s=Array.from(r.selectedIndices).sort(uc).map((i)=>e.choices[i].value);return N(ze.Submit({value:s}))}default:return N(ze.Beep())}}}function qWt(e){return(t,r)=>ze.$match(r,{Beep:()=>N(vWt),NextFrame:({state:n})=>PWt(n,e),Submit:()=>DWt(t,e)})}var p$e=(e)=>{let t={maxPerPage:10,...e},r=new Set;for(let n=0;n<t.choices.length;n++)if(t.choices[n].selected===!0)r.add(n);return Wi({index:0,selectedIndices:r,error:R()},{render:qWt(t),process:HWt(t),clear:()=>UWt(t)})};var WWt=aj,zWt=nBe,$Wt=a$e,jWt=Wi,VWt=mj,GWt=Sj,KWt=LD,JWt=Ej,QWt=jD,YWt=LE,ZWt=Kj,XWt=ga,ezt=XBe,tzt=UD,rzt=Hu,nzt=p$e,ozt=lj,szt=I_,izt=A_;var Zc={};Ht(Zc,{CommandTypeId:()=>pzt,env:()=>dzt,exitCode:()=>mzt,feed:()=>hzt,flatten:()=>AV,isCommand:()=>fzt,lines:()=>gzt,make:()=>xzt,pipeTo:()=>yzt,runInShell:()=>Szt,start:()=>Ezt,stderr:()=>kzt,stdin:()=>OV,stdout:()=>Izt,stream:()=>bzt,streamLines:()=>Czt,string:()=>wzt,workingDirectory:()=>Azt});var EV=Symbol.for("@effect/platform/CommandExecutor"),f$e=Symbol.for("@effect/platform/Process"),d$e=lM(),m$e=lM(),Ox=qt("@effect/platform/CommandExecutor"),h$e=(e)=>{let t=(n)=>cd(W(e(n),(o)=>o.stdout)),r=(n,o)=>{let s=new TextDecoder(o);return SX(hX(t(n),Vr((i)=>s.decode(i))))};return{[EV]:EV,start:e,exitCode:(n)=>ei(L(e(n),(o)=>o.exitCode)),stream:t,string:(n,o="utf-8")=>{let s=new TextDecoder(o);return d(e(n),L((i)=>ad(i.stdout,azt)),W((i)=>s.decode(i)),ei)},lines:(n,o="utf-8")=>d(r(n,o),yX,W(rT)),streamLines:r}},azt=sPe(new Uint8Array,(e,t)=>ip(t,e,(r,n)=>{let o=new Uint8Array(r.length+n.length);return o.set(r),o.set(n,r.length),o}));var IF=Symbol.for("@effect/platform/Command"),sse=(e)=>typeof e==="object"&&e!=null&&(IF in e),bV=p(2,(e,t)=>{switch(e._tag){case"StandardCommand":return nk({...e,env:bfe(e.env,lp(Object.entries(t).filter(([r])=>r!==void 0)))});case"PipedCommand":return AF(bV(e.left,t),bV(e.right,t))}}),x$e=(e)=>L(Ox,(t)=>t.exitCode(e)),y$e=p(2,(e,t)=>IV(e,OP(We(new TextEncoder().encode(t))))),S$e=(e)=>Array.from(ose(e)),ose=(e)=>{switch(e._tag){case"StandardCommand":return We(e);case"PipedCommand":return Vt(ose(e.left),ose(e.right))}},CV=p(2,(e,t)=>{switch(e._tag){case"StandardCommand":return nk({...e,shell:t});case"PipedCommand":return AF(CV(e.left,t),CV(e.right,t))}}),E$e=(e,t="utf-8")=>L(Ox,(r)=>r.lines(e,t)),b$e={[IF]:IF,pipe(){return ce(this,arguments)},...al},czt={...b$e,_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()}}},nk=(e)=>Object.assign(Object.create(czt),e),lzt={...b$e,_tag:"PipedCommand",toJSON(){return{_id:"@effect/platform/Command",_tag:this._tag,left:this.left.toJSON(),right:this.right.toJSON()}}},kV=(e)=>Object.assign(Object.create(lzt),e),C$e=(e,...t)=>nk({command:e,args:t,env:Ta(),cwd:R(),shell:!1,stdin:"pipe",stdout:"pipe",stderr:"pipe",gid:R(),uid:R()}),AF=p(2,(e,t)=>kV({left:e,right:t})),ise=p(2,(e,t)=>{switch(e._tag){case"StandardCommand":return nk({...e,stderr:t});case"PipedCommand":return kV({...e,right:ise(e.right,t)})}}),IV=p(2,(e,t)=>{switch(e._tag){case"StandardCommand":return nk({...e,stdin:t});case"PipedCommand":return kV({...e,left:IV(e.left,t)})}}),ase=p(2,(e,t)=>{switch(e._tag){case"StandardCommand":return nk({...e,stdout:t});case"PipedCommand":return kV({...e,right:ase(e.right,t)})}}),w$e=(e)=>L(Ox,(t)=>t.start(e)),k$e=(e)=>zW(Ox,(t)=>t.stream(e)),I$e=(e,t)=>zW(Ox,(r)=>r.streamLines(e,t)),A$e=p((e)=>sse(e[0]),(e,t)=>L(Ox,(r)=>r.string(e,t))),wV=p(2,(e,t)=>{switch(e._tag){case"StandardCommand":return nk({...e,cwd:_(t)});case"PipedCommand":return AF(wV(e.left,t),wV(e.right,t))}});var pzt=IF,fzt=sse,dzt=bV,mzt=x$e,hzt=y$e,AV=S$e,gzt=E$e,xzt=C$e,yzt=AF,Szt=CV,Ezt=w$e,bzt=k$e,Czt=I$e,wzt=A$e,kzt=ise,OV=IV,Izt=ase,Azt=wV;var _x={};Ht(_x,{CommandExecutor:()=>cse,ExitCode:()=>lse,ProcessId:()=>use,ProcessTypeId:()=>_V,TypeId:()=>Ozt,makeExecutor:()=>pse});var Ozt=EV,cse=Ox,_V=f$e,lse=d$e,use=m$e,pse=h$e;var Gl={};Ht(Gl,{HttpClient:()=>e$t,SpanNameGenerator:()=>D$t,TypeId:()=>Xzt,catchAll:()=>l$t,catchTag:()=>u$t,catchTags:()=>p$t,currentTracerDisabledWhen:()=>T$t,currentTracerPropagation:()=>M$t,del:()=>a$t,execute:()=>t$t,filterOrElse:()=>f$t,filterOrFail:()=>d$t,filterStatus:()=>m$t,filterStatusOk:()=>h$t,followRedirects:()=>v$t,get:()=>r$t,head:()=>n$t,layerMergedContext:()=>FF,make:()=>DF,makeWith:()=>g$t,mapRequest:()=>S$t,mapRequestEffect:()=>E$t,mapRequestInput:()=>b$t,mapRequestInputEffect:()=>C$t,options:()=>c$t,patch:()=>s$t,post:()=>o$t,put:()=>i$t,retry:()=>w$t,retryTransient:()=>k$t,tap:()=>I$t,tapError:()=>A$t,tapRequest:()=>O$t,transform:()=>x$t,transformResponse:()=>y$t,withCookiesRef:()=>_$t,withScope:()=>N$t,withSpanNameGenerator:()=>F$t,withTracerDisabledWhen:()=>R$t,withTracerPropagation:()=>P$t});var O$e=Symbol.for("@effect/platform/Cookies");var _$e=Symbol.for("@effect/platform/Cookies/Cookie");var _zt={[O$e]:O$e,...al,toJSON(){return{_id:"@effect/platform/Cookies",cookies:S4(this.cookies,(e)=>e.toJSON())}},pipe(){return ce(this,arguments)}},T$e=(e)=>{let t=Object.create(_zt);return t.cookies=e,t},R$e=(e)=>{let t={};for(let r of e)t[r.name]=r;return T$e(t)},q_=(e)=>{let t=typeof e==="string"?[e]:e,r=[];for(let n of t){let o=vzt(n.trim());if(Oe(o))r.push(o.value)}return R$e(r)};function vzt(e){let t=e.split(";").map((a)=>a.trim()).filter((a)=>a!=="");if(t.length===0)return R();let r=t[0].indexOf("=");if(r===-1)return R();let n=t[0].slice(0,r);if(!Tzt.test(n))return R();let o=t[0].slice(r+1),s=D$e(o);if(t.length===1)return _(Object.assign(Object.create(v$e),{name:n,value:s,valueEncoded:o}));let i={};for(let a=1;a<t.length;a++){let c=t[a],l=c.indexOf("="),u=l===-1?c:c.slice(0,l).trim(),f=l===-1?void 0:c.slice(l+1).trim();switch(u.toLowerCase()){case"domain":{if(f===void 0)break;let h=f.trim().replace(/^\./,"");if(h)i.domain=h;break}case"expires":{if(f===void 0)break;let h=new Date(f);if(!isNaN(h.getTime()))i.expires=h;break}case"max-age":{if(f===void 0)break;let h=parseInt(f,10);if(!isNaN(h))i.maxAge=vb(h);break}case"path":{if(f===void 0)break;if(f[0]==="/")i.path=f;break}case"priority":{if(f===void 0)break;switch(f.toLowerCase()){case"low":i.priority="low";break;case"medium":i.priority="medium";break;case"high":i.priority="high";break}break}case"httponly":{i.httpOnly=!0;break}case"secure":{i.secure=!0;break}case"partitioned":{i.partitioned=!0;break}case"samesite":{if(f===void 0)break;switch(f.toLowerCase()){case"lax":i.sameSite="lax";break;case"strict":i.sameSite="strict";break;case"none":i.sameSite="none";break}break}}}return _(Object.assign(Object.create(v$e),{name:n,value:s,valueEncoded:o,options:Object.keys(i).length>0?i:void 0}))}var vx=R$e([]),fse=(e)=>Cf(e.cookies),Tzt=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,v$e={[_$e]:_$e,...al,toJSON(){return{_id:"@effect/platform/Cookies/Cookie",name:this.name,value:this.value,options:this.options}}};var dse=p(2,(e,t)=>T$e({...e.cookies,...t.cookies}));var M$e=(e)=>Object.values(e.cookies).map((t)=>`${t.name}=${t.valueEncoded}`).join("; ");function P$e(e){let t={},r=e.length,n=0,o=0;while(!0){if(o===r)break;if(o=e.indexOf(";",n),o===-1)o=r;let s=e.indexOf("=",n);if(s===-1)break;if(s>o){n=o+1;continue}let i=e.substring(n,s++).trim();if(t[i]===void 0){let a=e.charCodeAt(s)===34?e.substring(s+1,o-1).trim():e.substring(s,o).trim();t[i]=a.indexOf("%")!==-1?D$e(a):a}n=o+1}return t}var D$e=(e)=>{try{return decodeURIComponent(e)}catch{return e}};var F$e=Symbol.for("@effect/platform/Headers");var OF=Object.assign(Object.create(null),{[F$e]:F$e,[zk](e){return RV(this,Ff(e,xse))}}),vV=(e)=>Object.assign(Object.create(OF),e);var Cd=Object.create(OF),Ci=(e)=>{if(e===void 0)return Cd;else if(Symbol.iterator in e){let r=Object.create(OF);for(let[n,o]of e)r[n.toLowerCase()]=o;return r}let t=Object.create(OF);for(let[r,n]of Object.entries(e))if(Array.isArray(n))t[r.toLowerCase()]=n.join(", ");else if(n!==void 0)t[r.toLowerCase()]=n;return t},mse=(e)=>Object.setPrototypeOf(e,OF);var _F=p(3,(e,t,r)=>{let n=vV(e);return n[t.toLowerCase()]=r,n}),hse=p(2,(e,t)=>vV({...e,...Ci(t)})),TV=p(2,(e,t)=>{let r=vV(e);return Object.assign(r,t),r}),gse=p(2,(e,t)=>{let r=vV(e),n=(o)=>{if(typeof o==="string"){let s=o.toLowerCase();if(s in e)delete r[s]}else for(let s in e)if(o.test(s))delete r[s]};if(Array.isArray(t))for(let o=0;o<t.length;o++)n(t[o]);else n(t);return r}),RV=p(2,(e,t)=>{let r={...e},n=(o)=>{if(typeof o==="string"){let s=o.toLowerCase();if(s in e)r[s]=Ru(e[s])}else for(let s in e)if(o.test(s))r[s]=Ru(e[s])};if(Array.isArray(t))for(let o=0;o<t.length;o++)n(t[o]);else n(t);return r}),xse=je("@effect/platform/Headers/currentRedactedNames",()=>ed(["authorization","cookie","set-cookie","x-api-key"]));var Tx={};Ht(Tx,{RequestError:()=>nf,ResponseError:()=>bs,TypeId:()=>MV,isHttpClientError:()=>yse});var N$e=Symbol.for("@effect/platform/HttpClientError");var MV=N$e,yse=(e)=>de(e,MV);class nf extends xE(MV,"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 bs extends xE(MV,"ResponseError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return this.description?`${this.reason}: ${this.description} (${e})`:`${this.reason} error (${e})`}}var zu=(e)=>{let t=L$e(e),r=[];for(let n=0;n<t.length;n++)if(Array.isArray(t[n][0])){let[o,s]=t[n];r.push([`${o[0]}[${o.slice(1).join("][")}]`,s])}else r.push(t[n]);return r},L$e=(e)=>{let t=Symbol.iterator in e?De(e):Object.entries(e),r=[];for(let[n,o]of t)if(Array.isArray(o)){for(let s=0;s<o.length;s++)if(o[s]!==void 0)r.push([n,String(o[s])])}else if(typeof o==="object"){let s=L$e(o);for(let[i,a]of s)r.push([[n,...typeof i==="string"?[i]:i],a])}else if(o!==void 0)r.push([n,String(o)]);return r};var U$e=[];var H$e=p(3,(e,t,r)=>Yn(Qd(e,([n])=>n!==t),[t,String(r)])),q$e=p(2,(e,t)=>{let r=zu(t),n=new Set;for(let o=0;o<r.length;o++)n.add(r[o][0]);for(let o=0;o<e.length;o++){if(n.has(e[o][0]))continue;r.push(e[o])}return r}),B$e=p(3,(e,t,r)=>Yn(e,[t,String(r)])),W$e=p(2,(e,t)=>xt(e,zu(t)));var PV=(e,t,r)=>{try{let n=new URL(e,Mzt());for(let o=0;o<t.length;o++){let[s,i]=t[o];if(i!==void 0)n.searchParams.append(s,i)}if(r._tag==="Some")n.hash=r.value;return ye(n)}catch(n){return Ie(n)}},z$e=(e)=>new URLSearchParams(e).toString(),Mzt=()=>{if("location"in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname;return},Pzt=(e)=>{let t=Object.create(null);for(let[r,n]of e){let o=t[r];if(o===void 0)t[r]=n;else if(typeof o==="string")t[r]=[o,n];else o.push(n)}return{...t}};var $$e=(e,t)=>(r)=>Qr(e,t)(Pzt(r));var zi=Symbol.for("@effect/platform/HttpIncomingMessage"),ph=(e,t)=>{let r=Qr(e,t);return(n)=>L(n.json,r)},Sse=(e,t)=>{let r=$$e(e,t);return(n)=>L(n.urlParamsBody,r)},Ese=(e,t)=>{let r=Qr(e,t);return(n)=>r(n.headers)};class W_ extends ko()("@effect/platform/HttpIncomingMessage/MaxBodySize",{defaultValue:R}){}var KE=(e,t)=>{let r=e.headers["content-type"]??"",n;if(r.includes("application/json"))try{n=xr(e.json)}catch{}else if(r.includes("text/")||r.includes("urlencoded"))try{n=xr(e.text)}catch{}let o={...t,headers:ka(e.headers),remoteAddress:e.remoteAddress.toJSON()};if(n!==void 0)o.body=n;return o};var j$e=(e)=>mse({b3:`${e.traceId}-${e.spanId}-${e.sampled?"1":"0"}${e.parent._tag==="Some"?`-${e.parent.value.spanId}`:""}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?"01":"00"}`});var bse=Symbol.for("@effect/platform/HttpBody"),V$e=Symbol.for("@effect/platform/HttpBody/HttpBodyError"),Fzt=uS("HttpBodyError"),G$e=(e)=>Fzt({[V$e]:V$e,reason:e});class vF{[bse];constructor(){this[bse]=bse}[dt](){return this.toJSON()}toString(){return Ut(this)}}class K$e extends vF{_tag="Empty";toJSON(){return{_id:"@effect/platform/HttpBody",_tag:"Empty"}}}var DV=new K$e;class J$e extends vF{body;contentType;_tag="Uint8Array";constructor(e,t){super();this.body=e,this.contentType=t}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 TF=(e,t)=>new J$e(e,t??"application/octet-stream"),Nzt=new TextEncoder,z_=(e,t)=>TF(Nzt.encode(e),t??"text/plain"),FV=(e,t)=>z_(JSON.stringify(e),t??"application/json"),NV=(e,t)=>Ps({try:()=>FV(e,t),catch:(r)=>G$e({_tag:"JsonError",error:r})});var Cse=(e,t)=>{let r=Gm(e,t);return(n,o)=>L(br(r(n),(s)=>G$e({_tag:"SchemaError",error:s})),(s)=>NV(s,o))},Q$e=(e,t)=>L(Hi,(r)=>W(r.stat(e),(n)=>$_(r.stream(e,t),t?.contentType,Number(n.size))));var Y$e=(e)=>$_(Cw(()=>e.stream(),te),e.type,e.size);class wse extends vF{formData;_tag="FormData";constructor(e){super();this.formData=e}toJSON(){return{_id:"@effect/platform/HttpBody",_tag:"FormData",formData:this.formData}}}var kse=(e)=>new wse(e),Z$e=(e)=>{let t=new FormData;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let o of n){if(o==null)continue;t.append(r,typeof n==="object"?o:String(o))}else if(n!=null)t.append(r,typeof n==="object"?n:String(n));return new wse(t)};class X$e extends vF{stream;contentType;contentLength;_tag="Stream";constructor(e,t,r){super();this.stream=e,this.contentType=t,this.contentLength=r}toJSON(){return{_id:"@effect/platform/HttpBody",_tag:"Stream",contentType:this.contentType,contentLength:this.contentLength}}}var $_=(e,t,r)=>new X$e(e,t??"application/octet-stream",r);var Ise=Symbol.for("@effect/platform/HttpClientRequest"),Lzt={[Ise]:Ise,...al,toJSON(){return{_id:"@effect/platform/HttpClientRequest",method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:ka(this.headers),body:this.body.toJSON()}},pipe(){return ce(this,arguments)}};function Ic(e,t,r,n,o,s){let i=Object.create(Lzt);return i.method=e,i.url=t,i.urlParams=r,i.hash=n,i.headers=o,i.body=s,i}var LV=(e)=>typeof e==="object"&&e!==null&&(Ise in e),Uzt=Ic("GET","",U$e,R(),Cd,DV),Rx=(e)=>(t,r)=>Ose(Uzt,{method:e,url:t,...r??void 0}),UV=Rx("GET"),HV=Rx("POST"),qV=Rx("PUT"),BV=Rx("PATCH"),WV=Rx("DELETE"),zV=Rx("HEAD"),$V=Rx("OPTIONS"),Ose=p(2,(e,t)=>{let r=e;if(t.method)r=vse(r,t.method);if(t.url)r=MF(r,t.url);if(t.headers)r=RF(r,t.headers);if(t.urlParams)r=Tse(r,t.urlParams);if(t.hash)r=Rse(r,t.hash);if(t.body)r=Vl(r,t.body);if(t.accept)r=jV(r,t.accept);if(t.acceptJson)r=_se(r);return r}),ik=p(3,(e,t,r)=>Ic(e.method,e.url,e.urlParams,e.hash,_F(e.headers,t,r),e.body)),RF=p(2,(e,t)=>Ic(e.method,e.url,e.urlParams,e.hash,hse(e.headers,t),e.body)),Ase=(e)=>typeof e==="string"?e:cE(e),tje=p(3,(e,t,r)=>ik(e,"Authorization",`Basic ${btoa(`${Ase(t)}:${Ase(r)}`)}`)),rje=p(2,(e,t)=>ik(e,"Authorization",`Bearer ${Ase(t)}`)),jV=p(2,(e,t)=>ik(e,"Accept",t)),_se=jV("application/json"),vse=p(2,(e,t)=>Ic(t,e.url,e.urlParams,e.hash,e.headers,e.body)),MF=p(2,(e,t)=>{if(typeof t==="string")return Ic(e.method,t,e.urlParams,e.hash,e.headers,e.body);let r=new URL(t.toString()),n=zu(r.searchParams),o=r.hash?_(r.hash.slice(1)):R();return r.search="",r.hash="",Ic(e.method,r.toString(),n,o,e.headers,e.body)}),nje=p(2,(e,t)=>{if(t==="")return e;let r=e.url.endsWith("/")?e.url:e.url+"/",n=t.startsWith("/")?t.slice(1):t;return Ic(e.method,r+n,e.urlParams,e.hash,e.headers,e.body)}),oje=p(2,(e,t)=>Ic(e.method,t.endsWith("/")&&e.url.startsWith("/")?t+e.url.slice(1):t+e.url,e.urlParams,e.hash,e.headers,e.body)),sje=p(2,(e,t)=>Ic(e.method,t(e.url),e.urlParams,e.hash,e.headers,e.body)),ije=p(3,(e,t,r)=>Ic(e.method,e.url,B$e(e.urlParams,t,r),e.hash,e.headers,e.body)),aje=p(2,(e,t)=>Ic(e.method,e.url,W$e(e.urlParams,t),e.hash,e.headers,e.body)),cje=p(3,(e,t,r)=>Ic(e.method,e.url,H$e(e.urlParams,t,r),e.hash,e.headers,e.body)),Tse=p(2,(e,t)=>Ic(e.method,e.url,q$e(e.urlParams,t),e.hash,e.headers,e.body)),Rse=p(2,(e,t)=>Ic(e.method,e.url,e.urlParams,_(t),e.headers,e.body)),lje=(e)=>Ic(e.method,e.url,e.urlParams,R(),e.headers,e.body),uje=(e)=>n4(PV(e.url,e.urlParams,e.hash)),Vl=p(2,(e,t)=>{let r=e.headers;if(t._tag==="Empty"||t._tag==="FormData")r=gse(r,["Content-type","Content-length"]);else{let n=t.contentType;if(n)r=_F(r,"content-type",n);let o=t.contentLength;if(o)r=_F(r,"content-length",o.toString())}return Ic(e.method,e.url,e.urlParams,e.hash,r,t)}),pje=p((e)=>LV(e[0]),(e,t,r="application/octet-stream")=>Vl(e,TF(t,r))),fje=p((e)=>LV(e[0]),(e,t,r="text/plain")=>Vl(e,z_(t,r))),dje=p(2,(e,t)=>W(NV(t),(r)=>Vl(e,r))),mje=p(2,(e,t)=>Vl(e,FV(t))),hje=p((e)=>LV(e[0]),(e,t,r)=>W(Q$e(t,r),(n)=>Vl(e,n))),gje=p(2,(e,t)=>Vl(e,Y$e(t))),xje=(e,t)=>{let r=Cse(e,t);return p(2,(n,o)=>W(r(o),(s)=>Vl(n,s)))},yje=p(2,(e,t)=>Vl(e,z_(z$e(zu(t)),"application/x-www-form-urlencoded"))),Sje=p(2,(e,t)=>Vl(e,kse(t))),Eje=p(2,(e,t)=>Vl(e,Z$e(t))),bje=p((e)=>LV(e[0]),(e,t,{contentLength:r,contentType:n="application/octet-stream"}={})=>Vl(e,$_(t,n,r)));var JE=Symbol.for("@effect/platform/HttpClientResponse"),wje=(e,t)=>new kje(e,t);class kje extends cl{request;source;[zi];[JE];constructor(e,t){super();this.request=e,this.source=t,this[zi]=zi,this[JE]=JE}toJSON(){return KE(this,{_id:"@effect/platform/HttpClientResponse",request:this.request.toJSON(),status:this.status})}get status(){return this.source.status}get headers(){return Ci(this.source.headers)}cachedCookies;get cookies(){if(this.cachedCookies)return this.cachedCookies;return this.cachedCookies=q_(this.source.headers.getSetCookie())}get remoteAddress(){return R()}get stream(){return this.source.body?Cw(()=>this.source.body,(e)=>new bs({request:this.request,response:this,reason:"Decode",cause:e})):oE(new bs({request:this.request,response:this,reason:"EmptyBody",description:"can not create stream from empty body"}))}get json(){return jf(this.text,{try:(e)=>e===""?null:JSON.parse(e),catch:(e)=>new bs({request:this.request,response:this,reason:"Decode",cause:e})})}textBody;get text(){return this.textBody??=Ds({try:()=>this.source.text(),catch:(e)=>new bs({request:this.request,response:this,reason:"Decode",cause:e})}).pipe(Bc,xr)}get urlParamsBody(){return L(this.text,(e)=>Ps({try:()=>zu(new URLSearchParams(e)),catch:(t)=>new bs({request:this.request,response:this,reason:"Decode",cause:t})}))}formDataBody;get formData(){return this.formDataBody??=Ds({try:()=>this.source.formData(),catch:(e)=>new bs({request:this.request,response:this,reason:"Decode",cause:e})}).pipe(Bc,xr)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody??=Ds({try:()=>this.source.arrayBuffer(),catch:(e)=>new bs({request:this.request,response:this,reason:"Decode",cause:e})}).pipe(Bc,xr)}}var Ije=(e,t)=>{let r=Qr(e,t);return(n)=>L(n.json,(o)=>r({status:n.status,headers:n.headers,body:o}))},Aje=(e,t)=>{let r=Qr(e,t);return(n)=>r({status:n.status,headers:n.headers})},Oje=(e)=>MP(W(e,(t)=>t.stream)),_je=p(2,(e,t)=>{let r=e.status;if(t[r])return t[r](e);else if(r>=200&&r<300&&t["2xx"])return t["2xx"](e);else if(r>=300&&r<400&&t["3xx"])return t["3xx"](e);else if(r>=400&&r<500&&t["4xx"])return t["4xx"](e);else if(r>=500&&r<600&&t["5xx"])return t["5xx"](e);return t.orElse(e)}),VV=p(2,(e,t)=>Qe(()=>t(e.status)?N(e):ie(new bs({response:e,request:e.request,reason:"StatusCode",description:"invalid status code"})))),GV=(e)=>e.status>=200&&e.status<300?N(e):ie(new bs({response:e,request:e.request,reason:"StatusCode",description:"non 2xx status code"}));var Hzt=(e)=>`http.request.header.${e}`,qzt="http.request.method",Bzt=(e)=>`http.response.header.${e}`,Wzt="http.response.status_code",zzt="server.address",$zt="server.port",jzt="url.full",Vzt="url.path",Gzt="url.scheme",Kzt="url.query",PF=Symbol.for("@effect/platform/HttpClient"),JV=qt("@effect/platform/HttpClient"),QV=je(Symbol.for("@effect/platform/HttpClient/tracerDisabledWhen"),()=>ed(Fo)),Rje=p(2,(e,t)=>ec(e,Au(QV,t))),YV=je(Symbol.for("@effect/platform/HttpClient/currentTracerPropagation"),()=>ed(!0)),Mje=p(2,(e,t)=>ec(e,Au(YV,t))),ZV=ko()("@effect/platform/HttpClient/SpanNameGenerator",{defaultValue:()=>(e)=>`http.client ${e.method}`}),Pje=p(2,(e,t)=>ec(e,xi(ZV,t))),Jzt={[PF]:PF,pipe(){return ce(this,arguments)},...al,toJSON(){return{_id:"@effect/platform/HttpClient"}},get(e,t){return this.execute(UV(e,t))},head(e,t){return this.execute(zV(e,t))},post(e,t){return this.execute(HV(e,t))},put(e,t){return this.execute(qV(e,t))},patch(e,t){return this.execute(BV(e,t))},del(e,t){return this.execute(WV(e,t))},options(e,t){return this.execute($V(e,t))}},Qzt=(e)=>de(e,PF),of=(e,t)=>{let r=Object.create(Jzt);return r.preprocess=t,r.postprocess=e,r.execute=function(n){return e(t(n))},r},KV=je("@effect/platform/HttpClient/responseRegistry",()=>{if("FinalizationRegistry"in globalThis&&globalThis.FinalizationRegistry){let t=new FinalizationRegistry((r)=>{r.abort()});return{register(r,n){t.register(r,n,r)},unregister(r){t.unregister(r)}}}let e=new Map;return{register(t,r){e.set(t,setTimeout(()=>r.abort(),5000))},unregister(t){let r=e.get(t);if(r===void 0)return;clearTimeout(r),e.delete(t)}}}),Dje=je("@effect/platform/HttpClient/scopedRequests",()=>new WeakMap),Fje=(e)=>of((t)=>L(t,(r)=>Zs((n)=>{let o=Dje.get(r),s=o??new AbortController,i=PV(r.url,r.urlParams,r.hash);if(i._tag==="Left")return ie(new nf({request:r,reason:"InvalidUrl",cause:i.left}));let a=i.right;if(!n.getFiberRef(XAe)||n.getFiberRef(QV)(r)){let u=e(r,a,s.signal,n);if(o)return u;return wu((f)=>os(f(u),{onSuccess(h){return KV.register(h,s),N(new Mse(h,s))},onFailure(h){if(Ua(h))s.abort();return On(h)}}))}let l=er(n.currentContext,ZV);return HA(l(r),{kind:"client",captureStackTrace:!1},(u)=>{if(u.attribute(qzt,r.method),u.attribute(zzt,a.origin),a.port!=="")u.attribute($zt,+a.port);u.attribute(jzt,a.toString()),u.attribute(Vzt,a.pathname),u.attribute(Gzt,a.protocol.slice(0,-1));let f=a.search.slice(1);if(f!=="")u.attribute(Kzt,f);let h=n.getFiberRef(xse),y=RV(r.headers,h);for(let E in y)u.attribute(Hzt(E),String(y[E]));return r=n.getFiberRef(YV)?RF(r,j$e(u)):r,wu((E)=>E(e(r,a,s.signal,n)).pipe(GC(u),os({onSuccess:(b)=>{u.attribute(Wzt,b.status);let w=RV(b.headers,h);for(let T in w)u.attribute(Bzt(T),String(w[T]));if(o)return N(b);return KV.register(b,s),N(new Mse(b,s))},onFailure(b){if(!o&&Ua(b))s.abort();return On(b)}})))})})),N);class Mse{original;controller;constructor(e,t){this.original=e,this.controller=t}[JE]=JE;[zi]=zi;applyInterrupt(e){return Qe(()=>(KV.unregister(this.original),vR(e,()=>Ce(()=>{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 EX(()=>(KV.unregister(this.original),mX(this.original.stream,Ce(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[dt](){return this.original[dt]()}}var Nje=(e)=>Pse(e,(t,r)=>{let n=new AbortController;return Dje.set(r,n),ve(MR((o)=>Ti(o,Ce(()=>n.abort()))),t)}),{del:Lje,execute:Uje,get:Hje,head:qje,options:Bje,patch:Wje,post:zje,put:$je}=HQ(JV),Pse=p(2,(e,t)=>{let r=e;return of(L((n)=>t(r.postprocess(N(n)),n)),r.preprocess)}),jje=p(2,(e,t)=>ec(e,L(VV(t)))),Vje=(e)=>ec(e,L(GV)),ec=p(2,(e,t)=>{let r=e;return of((n)=>t(r.postprocess(n)),r.preprocess)}),Gje=p(3,(e,t,r)=>ec(e,mc(t,r))),Kje=p(2,(e,t)=>ec(e,gS(t))),Jje=p(2,(e,t)=>ec(e,jo(t))),Qje=p(3,(e,t,r)=>ec(e,BQ(t,r))),Yje=p(3,(e,t,r)=>ec(e,WQ(t,r))),Zje=p(2,(e,t)=>{let r=e;return of(r.postprocess,(n)=>W(r.preprocess(n),t))}),Xje=p(2,(e,t)=>{let r=e;return of(r.postprocess,(n)=>L(r.preprocess(n),t))}),eVe=p(2,(e,t)=>{let r=e;return of(r.postprocess,(n)=>r.preprocess(t(n)))}),tVe=p(2,(e,t)=>{let r=e;return of(r.postprocess,(n)=>L(t(n),r.preprocess))}),rVe=p(2,(e,t)=>ec(e,Rm(t))),nVe=p(2,(e,t)=>{let r=_ve in t,n=r?"both":t.mode??"both",o=r?t:t.schedule,s=o&&Tve(o),i=r?void 0:t.times;return ec(e,ry(n==="errors-only"?te:LA({schedule:s,times:i,while:oVe}),n==="response-only"?te:Rm({while:r||t.while===void 0?Tje:Vle(Tje,t.while),schedule:o,times:i})))}),Tje=(e)=>de(e,r5)||Yzt(e),Yzt=(e)=>yse(e)&&(e._tag==="RequestError"&&e.reason==="Transport"||e._tag==="ResponseError"&&oVe(e.response)),oVe=(e)=>e.status===408||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504,sVe=p(2,(e,t)=>ec(e,sr(t))),iVe=p(2,(e,t)=>ec(e,LR(t))),aVe=p(2,(e,t)=>{let r=e;return of(r.postprocess,(n)=>sr(r.preprocess(n),t))}),cVe=p(2,(e,t)=>{let r=e;return of((n)=>sr(r.postprocess(n),(o)=>ea(t,(s)=>dse(s,o.cookies))),(n)=>L(r.preprocess(n),(o)=>W(sn(t),(s)=>fse(s)?o:ik(o,"cookie",M$e(s)))))}),lVe=p((e)=>Qzt(e[0]),(e,t)=>{let r=e;return of((n)=>{let o=(s,i)=>L(r.postprocess(N(s)),(a)=>a.status>=300&&a.status<400&&a.headers.location&&i<(t??10)?o(MF(s,new URL(a.headers.location,a.request.url)),i+1):N(a));return L(n,(s)=>o(s,0))},r.preprocess)}),uVe=(e)=>gc(JV,L(Pn(),(t)=>W(e,(r)=>ec(r,FA((n)=>Rn(t,n))))));var Xzt=PF,e$t=JV,t$t=Uje,r$t=Hje,n$t=qje,o$t=zje,s$t=Wje,i$t=$je,a$t=Lje,c$t=Bje,l$t=Jje,u$t=Gje,p$t=Kje,f$t=Qje,d$t=Yje,m$t=jje,h$t=Vje,g$t=of,DF=Fje,x$t=Pse,y$t=ec,S$t=Zje,E$t=Xje,b$t=eVe,C$t=tVe,w$t=rVe,k$t=nVe,I$t=sVe,A$t=iVe,O$t=aVe,_$t=cVe,v$t=lVe,T$t=QV,R$t=Rje,M$t=YV,P$t=Mje,FF=uVe,D$t=ZV,F$t=Pje,N$t=Nje;var Kn={};Ht(Kn,{TypeId:()=>L$t,accept:()=>Q$t,acceptJson:()=>Y$t,appendUrl:()=>ejt,appendUrlParam:()=>njt,appendUrlParams:()=>ojt,basicAuth:()=>K$t,bearerToken:()=>J$t,bodyFile:()=>xjt,bodyFileWeb:()=>yjt,bodyFormData:()=>mjt,bodyFormDataRecord:()=>hjt,bodyJson:()=>j_,bodyStream:()=>gjt,bodyText:()=>ujt,bodyUint8Array:()=>ljt,bodyUnsafeJson:()=>pjt,bodyUrlParams:()=>djt,del:()=>W$t,get:()=>U$t,head:()=>z$t,make:()=>QE,modify:()=>j$t,options:()=>$$t,patch:()=>q$t,post:()=>H$t,prependUrl:()=>X$t,put:()=>B$t,removeHash:()=>ijt,schemaBodyJson:()=>fjt,setBody:()=>cjt,setHash:()=>sjt,setHeader:()=>G$t,setHeaders:()=>Dse,setMethod:()=>V$t,setUrl:()=>Z$t,setUrlParam:()=>rjt,setUrlParams:()=>NF,toUrl:()=>ajt,updateUrl:()=>tjt});var L$t=Symbol.for("@effect/platform/HttpClientRequest"),QE=Rx,U$t=UV,H$t=HV,q$t=BV,B$t=qV,W$t=WV,z$t=zV,$$t=$V,j$t=Ose,V$t=vse,G$t=ik,Dse=RF,K$t=tje,J$t=rje,Q$t=jV,Y$t=_se,Z$t=MF,X$t=oje,ejt=nje,tjt=sje,rjt=cje,NF=Tse,njt=ije,ojt=aje,sjt=Rse,ijt=lje,ajt=uje,cjt=Vl,ljt=pje,ujt=fje,j_=dje,pjt=mje,fjt=xje,djt=yje,mjt=Sje,hjt=Eje,gjt=bje,xjt=hje,yjt=gje;var si={};Ht(si,{TypeId:()=>Mx,filterStatus:()=>wjt,filterStatusOk:()=>kjt,fromWeb:()=>Sjt,matchStatus:()=>YE,schemaBodyJson:()=>ph,schemaBodyUrlParams:()=>Sse,schemaHeaders:()=>Ese,schemaJson:()=>Ejt,schemaNoBody:()=>bjt,stream:()=>Cjt});var Mx=JE,Sjt=wje,Ejt=Ije,bjt=Aje,Cjt=Oje,YE=_je,wjt=VV,kjt=GV;var n3={};Ht(n3,{layer:()=>Pjt});import*as t3 from"node:child_process";var Jn=(e,t)=>(r,[n])=>{let o="Unknown";switch(r.code){case"ENOENT":o="NotFound";break;case"EACCES":o="PermissionDenied";break;case"EEXIST":o="AlreadyExists";break;case"EISDIR":o="BadResource";break;case"ENOTDIR":o="BadResource";break;case"EBUSY":o="Busy";break;case"ELOOP":o="BadResource";break}return new Ec({reason:o,module:e,method:t,pathOrDescriptor:n,syscall:r.syscall,description:r.message,cause:r})};import{Readable as Ijt}from"node:stream";var ZE=(e,t,r)=>Zg(Fse(e,t,r)),pVe=(e,t)=>{let r=t.maxBytes?Number(t.maxBytes):void 0;return xS(Ce(()=>{let n=e();return n.setEncoding(t.encoding??"utf8"),n}),(n)=>$o((o)=>{let s="",i=0;n.once("error",(a)=>{o(ie(t.onFailure(a)))}),n.once("end",()=>{o(N(s))}),n.on("data",(a)=>{if(s+=a,i+=Buffer.byteLength(a),r&&i>r)o(ie(t.onFailure(Error("maxBytes exceeded"))))})}),(n)=>Ce(()=>{if("closed"in n&&!n.closed)n.destroy()}))},fVe=(e,t)=>{let r=t.maxBytes?Number(t.maxBytes):void 0;return xS(Ce(e),(n)=>$o((o)=>{let s=Buffer.alloc(0),i=0;n.once("error",(a)=>{o(ie(t.onFailure(a)))}),n.once("end",()=>{o(N(s))}),n.on("data",(a)=>{if(s=Buffer.concat([s,a]),i+=a.length,r&&i>r)o(ie(t.onFailure(Error("maxBytes exceeded"))))})}),(n)=>Ce(()=>{if("closed"in n&&!n.closed)n.destroy()}))},XV=(e,t,r)=>bw(()=>{let n=e();if(!n.readable)return Yg;let o=Qi(void 0);return UO(hVe(n,t,o,r),Nse(n,(s)=>Ce(()=>Oi(o,gr(s))),r))}),dVe=p((e)=>(AP in e[0]),(e,t,r,n)=>$W(e,XV(t,r,n))),mVe=p(2,(e,t)=>$W(e,XV(t,(r)=>new Ec({module:"Stream",method:"pipeThroughSimple",reason:"Unknown",cause:r})))),Fse=(e,t,r)=>bw(()=>hVe(e(),t,Qi(void 0),r)),Nse=(e,t,{encoding:r,endOnDone:n=!0}={},o=me)=>{let s=Ajt(e,r),i=n?$o((a)=>{if("closed"in e&&e.closed)a(me);else e.once("finish",()=>a(me)),e.end()}):me;return{awaitRead:()=>me,emit:s,error:(a)=>ve(i,t(a)),done:(a)=>ve(i,o)}},Ajt=(e,t)=>(r)=>r.length===0?me:$o((n)=>{let o=r[Symbol.iterator](),s=o.next();function i(){let a=s;s=o.next();let c=e.write(a.value,t);if(s.done)n(me);else if(c)i();else e.once("drain",i)}i()}),hVe=(e,t,r,n)=>{if(!e.readable)return Yg;let o=Kf(!1);function s(){o.unsafeOpen()}function i(u){r.current=Xr(t(u)),o.unsafeOpen()}function a(){r.current=ta,o.unsafeOpen()}e.on("readable",s),e.on("error",i),e.on("end",a);let c=n?.chunkSize?Number(n.chunkSize):void 0,l=bw(function u(){let f=e.read(c);if(f===null){if(r.current)return YMe(r.current);return o.unsafeClose(),id(o.await,u)}let h=[f];while(!0){if(f=e.read(c),f===null)return id(nE(nt(h)),u);h.push(f)}});return QMe(l,Ce(()=>{if(e.off("readable",s),e.off("error",i),e.off("end",a),n?.closeOnDone!==!1&&"closed"in e&&!e.closed)e.destroy()}))};class Lse extends Ijt{readLatch;fiber=void 0;constructor(e,t){super({});this.readLatch=Kf(!1),this.fiber=xc(e)(this.readLatch.whenOpen(HO(t,(r)=>this.readLatch.whenOpen(Ce(()=>{if(r.length===0)return;this.readLatch.unsafeClose();for(let n of r)if(typeof n==="string")this.push(n,"utf8");else this.push(n)}))))),this.fiber.addObserver((r)=>{if(this.fiber=void 0,Uc(r))this.push(null);else this.destroy(gi(r.cause))})}_read(e){this.readLatch.unsafeOpen()}_destroy(e,t){if(!this.fiber)return t(e);Al(Ts(this.fiber)).addObserver((r)=>{t(r._tag==="Failure"?gi(r.cause):e)})}}var gVe=(e)=>W(Wc(),(t)=>new Lse(t,e)),xVe=(e)=>new Lse(Hm,e);var e3=(e,t,r)=>aPe(Use(e,t,r)),Use=(e,t,r)=>id(Ns(Ce(()=>e()),_r()),([n,o])=>UO(_jt(n,o,t),Nse(n,(s)=>bu(o,s),r,GH(o,me)))),_jt=(e,t,r)=>Qe(()=>{function n(o){Cu(t,ie(r(o)))}return e.on("error",n),qa(Wt(t),Ce(()=>{e.removeListener("error",n)}))});var Tjt=(e)=>typeof e==="string"?e:"pipe",yVe=(e)=>typeof e==="string"?e:"pipe",LF=(e)=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),XE=(e,t,r)=>{let n=AV(r).reduce((o,s)=>{let i=`${s.command} ${s.args.join(" ")}`;return o.length===0?i:`${o} | ${i}`},"");return Jn("Command",e)(t,[n])},Rjt={[_V]:_V,...al,toJSON(){return{_id:"@effect/platform/CommandExecutor/Process",pid:this.pid}}},UF=(e)=>(t)=>{switch(t._tag){case"StandardCommand":{let r=L(_r(),(s)=>$o((i)=>{let a=t3.spawn(t.command,t.args,{stdio:[Tjt(t.stdin),yVe(t.stdout),yVe(t.stderr)],cwd:Je(t.cwd,Oh),shell:t.shell,env:{...process.env,...Object.fromEntries(t.env)},detached:process.platform!=="win32"});return a.on("error",(c)=>{i(ie(XE("spawn",c,t)))}),a.on("exit",(...c)=>{Cu(s,N(c))}),a.on("spawn",()=>{i(N([a,s]))}),Ce(()=>{a.kill("SIGTERM")})})),n=process.platform==="win32"?(s,i)=>$o((a)=>{t3.exec(`taskkill /pid ${s.pid} /T /F`,(c)=>{if(c)a(ie(XE("kill",LF(c),t)));else a(me)})}):(s,i)=>Ps({try:()=>process.kill(-s.pid,i),catch:(a)=>XE("kill",LF(a),t)}),o=(s,i)=>Qe(()=>s.kill(i)?me:ie(XE("kill",new globalThis.Error("Failed to kill process"),t)));return d(be(t.cwd,{onNone:()=>me,onSome:(s)=>e.access(s)}),ve(vr(r,([s,i])=>L(dS(i),(a)=>{if(!a)return n(s,"SIGTERM").pipe(Pm(()=>o(s,"SIGTERM")),ve(Wt(i)),HC);return L(Wt(i),([c])=>{if(c!==0&&c!==null)return n(s,"SIGTERM").pipe(HC);return me})}))),W(([s,i])=>{let a=nPe;if(s.stdin!==null)a=e3(()=>s.stdin,(E)=>XE("toWritable",LF(E),t));let c=L(Wt(i),([E,b])=>{if(E!==null)return N(lse(E));return ie(XE("exitCode",new globalThis.Error(`Process interrupted due to receipt of signal: ${b}`),t))}),l=PQ(dS(i)),u=(E="SIGTERM")=>n(s,E).pipe(Pm(()=>o(s,E)),ve(Xs(Wt(i)))),f=use(s.pid),h=ZE(()=>s.stderr,(E)=>XE("fromReadable(stderr)",LF(E),t)),y=ZE(()=>s.stdout,(E)=>XE("fromReadable(stdout)",LF(E),t));if(typeof t.stdout!=="string")y=bX(y,t.stdout);return Object.assign(Object.create(Rjt),{pid:f,exitCode:c,isRunning:l,kill:u,stdin:a,stderr:h,stdout:y})}),typeof t.stdin==="string"?te:sr((s)=>vp(ad(t.stdin,s.stdin))))}case"PipedCommand":{let r=AV(t);if(r.length===1)return d(r[0],UF(e));let n=r[0],o=r.slice(1),s=o.slice(0,o.length-1),i=o[o.length-1],a=s.reduce((c,l)=>d(OV(l,c),UF(e),W((u)=>u.stdout),cd),d(UF(e)(n),W((c)=>c.stdout),cd));return d(OV(i,a),UF(e))}}},SVe=gc(cse,d(Hi,W((e)=>pse(UF(e)))));var r3=SVe;var Pjt=r3;var rb={};Ht(rb,{layer:()=>vVt});var bVe=(e,t,r)=>(...n)=>$o((o)=>{try{e(...n,(s,i)=>{if(s)o(ie(t?t(s,n):s));else o(N(i))})}catch(s){o(r?ie(r(s,n)):Ms(s))}});var ls=bVe;import*as CVe from"node:crypto";import*as Pt from"node:fs";import*as wVe from"node:os";import*as V_ from"node:path";var Yo=(e)=>(t)=>new Qa({module:"FileSystem",method:e,cause:t}),Fjt=(()=>{let e=ls(Pt.access,Jn("FileSystem","access"),Yo("access"));return(t,r)=>{let n=Pt.constants.F_OK;if(r?.readable)n|=Pt.constants.R_OK;if(r?.writable)n|=Pt.constants.W_OK;return e(t,n)}})(),Njt=(()=>{let e=ls(Pt.cp,Jn("FileSystem","copy"),Yo("copy"));return(t,r,n)=>e(t,r,{force:n?.overwrite??!1,preserveTimestamps:n?.preserveTimestamps??!1,recursive:!0})})(),Ljt=(()=>{let e=ls(Pt.copyFile,Jn("FileSystem","copyFile"),Yo("copyFile"));return(t,r)=>e(t,r)})(),Ujt=(()=>{let e=ls(Pt.chmod,Jn("FileSystem","chmod"),Yo("chmod"));return(t,r)=>e(t,r)})(),Hjt=(()=>{let e=ls(Pt.chown,Jn("FileSystem","chown"),Yo("chown"));return(t,r,n)=>e(t,r,n)})(),qjt=(()=>{let e=ls(Pt.link,Jn("FileSystem","link"),Yo("link"));return(t,r)=>e(t,r)})(),Bjt=(()=>{let e=ls(Pt.mkdir,Jn("FileSystem","makeDirectory"),Yo("makeDirectory"));return(t,r)=>e(t,{recursive:r?.recursive??!1,mode:r?.mode})})(),Hse=(e)=>{let t=ls(Pt.mkdtemp,Jn("FileSystem",e),Yo(e));return(r)=>Qe(()=>{let n=r?.prefix??"",o=typeof r?.directory==="string"?V_.join(r.directory,"."):wVe.tmpdir();return t(n?V_.join(o,n):o+"/")})},Wjt=Hse("makeTempDirectory"),qse=(e)=>{let t=ls(Pt.rm,Jn("FileSystem",e),Yo(e));return(r,n)=>t(r,{recursive:n?.recursive??!1,force:n?.force??!1})},zjt=qse("remove"),$jt=(()=>{let e=Hse("makeTempDirectoryScoped"),t=qse("makeTempDirectoryScoped");return(r)=>vr(e(r),(n)=>Pr(t(n,{recursive:!0})))})(),kVe=(e)=>{let t=ls(Pt.open,Jn("FileSystem",e),Yo(e)),r=ls(Pt.close,Jn("FileSystem",e),Yo(e));return(n,o)=>d(vr(t(n,o?.flag??"r",o?.mode),(s)=>Pr(r(s))),W((s)=>Vjt(Gte(s),o?.flag?.startsWith("a")??!1)))},jjt=kVe("open"),Vjt=(()=>{let e=(u)=>ls(Pt.read,Jn("FileSystem",u),Yo(u)),t=e("read"),r=e("readAlloc"),n=ls(Pt.fstat,Jn("FileSystem","stat"),Yo("stat")),o=ls(Pt.ftruncate,Jn("FileSystem","truncate"),Yo("truncate")),s=ls(Pt.fsync,Jn("FileSystem","sync"),Yo("sync")),i=(u)=>ls(Pt.write,Jn("FileSystem",u),Yo(u)),a=i("write"),c=i("writeAll");class l{fd;append;[QO];semaphore=VC(1);position=0n;constructor(u,f){this.fd=u,this.append=f,this[QO]=QO}get stat(){return W(n(this.fd),AVe)}get sync(){return s(this.fd)}seek(u,f){let h=lx(u);return this.semaphore.withPermits(1)(Ce(()=>{if(f==="start")this.position=h;else if(f==="current")this.position=this.position+h;return this.position}))}read(u){return this.semaphore.withPermits(1)(W(Qe(()=>t(this.fd,{buffer:u,position:this.position})),(f)=>{let h=lx(f);return this.position=this.position+h,h}))}readAlloc(u){let f=Number(u);return this.semaphore.withPermits(1)(L(Ce(()=>Buffer.allocUnsafeSlow(f)),(h)=>W(r(this.fd,{buffer:h,position:this.position}),(y)=>{if(y===0)return R();if(this.position=this.position+BigInt(y),y===f)return _(h);let E=Buffer.allocUnsafeSlow(y);return h.copy(E,0,0,y),_(E)})))}truncate(u){return this.semaphore.withPermits(1)(W(o(this.fd,u?Number(u):void 0),()=>{if(!this.append){let f=BigInt(u??0);if(this.position>f)this.position=f}}))}write(u){return this.semaphore.withPermits(1)(W(Qe(()=>a(this.fd,u,void 0,void 0,this.append?void 0:Number(this.position))),(f)=>{let h=lx(f);if(!this.append)this.position=this.position+h;return h}))}writeAllChunk(u){return L(Qe(()=>c(this.fd,u,void 0,void 0,this.append?void 0:Number(this.position))),(f)=>{if(f===0)return ie(new Ec({module:"FileSystem",method:"writeAll",reason:"WriteZero",pathOrDescriptor:this.fd,description:"write returned 0 bytes written"}));if(!this.append)this.position=this.position+BigInt(f);return f<u.length?this.writeAllChunk(u.subarray(f)):me})}writeAll(u){return this.semaphore.withPermits(1)(this.writeAllChunk(u))}}return(u,f)=>new l(u,f)})(),IVe=(e)=>{let t=Hse(e),r=kVe(e),n=(o)=>Ce(()=>CVe.randomBytes(o).toString("hex"));return(o)=>d(Ns(t(o),n(6)),W(([s,i])=>V_.join(s,i+(o?.suffix??""))),sr((s)=>ei(r(s,{flag:"w+"}))))},Gjt=IVe("makeTempFile"),Kjt=(()=>{let e=IVe("makeTempFileScoped"),t=qse("makeTempFileScoped");return(r)=>vr(e(r),(n)=>Pr(t(V_.dirname(n),{recursive:!0})))})(),Jjt=(e,t)=>Ds({try:()=>Pt.promises.readdir(e,t),catch:(r)=>Jn("FileSystem","readDirectory")(r,[e])}),Qjt=(e)=>$o((t,r)=>{try{Pt.readFile(e,{signal:r},(n,o)=>{if(n)t(ie(Jn("FileSystem","readFile")(n,[e])));else t(N(o))})}catch(n){t(ie(Yo("readFile")(n)))}}),Yjt=(()=>{let e=ls(Pt.readlink,Jn("FileSystem","readLink"),Yo("readLink"));return(t)=>e(t)})(),Zjt=(()=>{let e=ls(Pt.realpath,Jn("FileSystem","realPath"),Yo("realPath"));return(t)=>e(t)})(),Xjt=(()=>{let e=ls(Pt.rename,Jn("FileSystem","rename"),Yo("rename"));return(t,r)=>e(t,r)})(),AVe=(e)=>({type:e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":e.isBlockDevice()?"BlockDevice":e.isCharacterDevice()?"CharacterDevice":e.isFIFO()?"FIFO":e.isSocket()?"Socket":"Unknown",mtime:Ft(e.mtime),atime:Ft(e.atime),birthtime:Ft(e.birthtime),dev:e.dev,rdev:Ft(e.rdev),ino:Ft(e.ino),mode:e.mode,nlink:Ft(e.nlink),uid:Ft(e.uid),gid:Ft(e.gid),size:lx(e.size),blksize:jt(Ft(e.blksize),lx),blocks:Ft(e.blocks)}),Bse=(()=>{let e=ls(Pt.stat,Jn("FileSystem","stat"),Yo("stat"));return(t)=>W(e(t),AVe)})(),eVt=(()=>{let e=ls(Pt.symlink,Jn("FileSystem","symlink"),Yo("symlink"));return(t,r)=>e(t,r)})(),tVt=(()=>{let e=ls(Pt.truncate,Jn("FileSystem","truncate"),Yo("truncate"));return(t,r)=>e(t,r!==void 0?Number(r):void 0)})(),rVt=(()=>{let e=ls(Pt.utimes,Jn("FileSystem","utime"),Yo("utime"));return(t,r,n)=>e(t,r,n)})(),nVt=(e,t)=>uX((r)=>vr(Ce(()=>{let n=Pt.watch(e,{recursive:t?.recursive},(o,s)=>{if(!s)return;switch(o){case"rename":{r.fromEffect(wr(Bse(s),{onSuccess:(i)=>N(Kte({path:s})),onFailure:(i)=>i._tag==="SystemError"&&i.reason==="NotFound"?N(Qte({path:s})):ie(i)}));return}case"change":{r.single(Jte({path:s}));return}}});return n.on("error",(o)=>{r.fail(new Ec({module:"FileSystem",reason:"Unknown",method:"watch",pathOrDescriptor:e,cause:o}))}),n.on("close",()=>{r.end()}),n}),(n)=>Ce(()=>n.close()))),oVt=(e,t,r)=>Bse(t).pipe(W((n)=>e.pipe(Qn((o)=>o.register(t,n,r)),Je(()=>nVt(t,r)))),MP),sVt=(e,t,r)=>$o((n,o)=>{try{Pt.writeFile(e,t,{signal:o,flag:r?.flag,mode:r?.mode},(s)=>{if(s)n(ie(Jn("FileSystem","writeFile")(s,[e])));else n(me)})}catch(s){n(ie(Yo("writeFile")(s)))}}),iVt=W(FR(Bz),(e)=>Vte({access:Fjt,chmod:Ujt,chown:Hjt,copy:Njt,copyFile:Ljt,link:qjt,makeDirectory:Bjt,makeTempDirectory:Wjt,makeTempDirectoryScoped:$jt,makeTempFile:Gjt,makeTempFileScoped:Kjt,open:jjt,readDirectory:Jjt,readFile:Qjt,readLink:Yjt,realPath:Zjt,remove:zjt,rename:Xjt,stat:Bse,symlink:eVt,truncate:tVt,utimes:rVt,watch(t,r){return oVt(e,t,r)},writeFile:sVt})),OVe=gc(Hi,iVt);var o3=OVe;import*as HF from"node:path";import*as s3 from"node:url";var Wse=(e)=>Ps({try:()=>s3.fileURLToPath(e),catch:(t)=>new Qa({module:"Path",method:"fromFileUrl",description:`Invalid file URL: ${e}`,cause:t})}),zse=(e)=>Ps({try:()=>s3.pathToFileURL(e),catch:(t)=>new Qa({module:"Path",method:"toFileUrl",description:`Invalid path: ${e}`,cause:t})}),vVe=Hs(wc,wc.of({[NE]:NE,...HF.posix,fromFileUrl:Wse,toFileUrl:zse})),TVe=Hs(wc,wc.of({[NE]:NE,...HF.win32,fromFileUrl:Wse,toFileUrl:zse})),RVe=Hs(wc,wc.of({[NE]:NE,...HF,fromFileUrl:Wse,toFileUrl:zse}));var i3=RVe,MVe=vVe,PVe=TVe;var l3=Symbol.for("effect/Mailbox"),$se=Symbol.for("effect/Mailbox/ReadonlyMailbox");var ak=Ze(),FVe=Tr(ak),a3=Tr(!1),c3=Tr(!0),NVe=[ak,!0];class LVe extends Zi{scheduler;capacity;strategy;[l3]=l3;[$se]=$se;state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set};messages=[];messagesChunk=Ze();constructor(e,t,r){super();this.scheduler=e,this.capacity=t,this.strategy=r}offer(e){return Re(()=>{if(this.state._tag!=="Open")return a3;else if(this.messages.length+this.messagesChunk.length>=this.capacity)switch(this.strategy){case"dropping":return a3;case"suspend":if(this.capacity<=0&&this.state.takers.size>0)return this.messages.push(e),this.releaseTaker(),c3;return this.offerRemainingSingle(e);case"sliding":return this.unsafeTake(),this.messages.push(e),c3}return this.messages.push(e),this.scheduleReleaseTaker(),c3})}unsafeOffer(e){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(e),!0;else if(this.capacity<=0&&this.state.takers.size>0)return this.messages.push(e),this.releaseTaker(),!0;return!1}return this.messages.push(e),this.scheduleReleaseTaker(),!0}offerAll(e){return Re(()=>{if(this.state._tag!=="Open")return X(Fr(e));let t=this.unsafeOfferAllArray(e);if(t.length===0)return FVe;else if(this.strategy==="dropping")return X(nt(t));return this.offerRemainingArray(t)})}unsafeOfferAll(e){return nt(this.unsafeOfferAllArray(e))}unsafeOfferAllArray(e){if(this.state._tag!=="Open")return De(e);else if(this.capacity===Number.POSITIVE_INFINITY||this.strategy==="sliding"){if(this.messages.length>0)this.messagesChunk=Vt(this.messagesChunk,nt(this.messages));if(this.strategy==="sliding")this.messagesChunk=this.messagesChunk.pipe(Vt(Fr(e)),sT(this.capacity));else if(Yd(e))this.messagesChunk=Vt(this.messagesChunk,e);else this.messages=De(e);return this.scheduleReleaseTaker(),[]}let t=this.capacity<=0?this.state.takers.size:this.capacity-this.messages.length-this.messagesChunk.length;if(t===0)return De(e);let r=[],n=0;for(let o of e){if(n<t)this.messages.push(o);else r.push(o);n++}return this.scheduleReleaseTaker(),r}fail(e){return this.done(Pf(e))}failCause(e){return this.done(Or(e))}unsafeDone(e){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(e),!0;return this.state={...this.state,_tag:"Closing",exit:e},!0}shutdown=ue(()=>{if(this.state._tag==="Done")return!0;this.messages=[],this.messagesChunk=ak;let e=this.state.offers;if(this.finalize(this.state._tag==="Open"?eo:this.state.exit),e.size>0){for(let t of e)if(t._tag==="Single")t.resume(a3);else t.resume(Tr(nt(t.remaining.slice(t.offset))));e.clear()}return!0});done(e){return ue(()=>this.unsafeDone(e))}end=this.done(eo);clear=Re(()=>{if(this.state._tag==="Done")return oC(this.state.exit,ak);let e=this.unsafeTakeAll();return this.releaseCapacity(),X(e)});takeAll=Re(()=>{if(this.state._tag==="Done")return oC(this.state.exit,NVe);let e=this.unsafeTakeAll();if(e.length===0)return Qt(this.awaitTake,this.takeAll);return X([e,this.releaseCapacity()])});takeN(e){return Re(()=>{if(this.state._tag==="Done")return oC(this.state.exit,NVe);else if(e<=0)return X([ak,!1]);e=Math.min(e,this.capacity);let t;if(e<=this.messagesChunk.length)t=Ii(this.messagesChunk,e),this.messagesChunk=Zr(this.messagesChunk,e);else if(e<=this.messages.length+this.messagesChunk.length)this.messagesChunk=Vt(this.messagesChunk,nt(this.messages)),this.messages=[],t=Ii(this.messagesChunk,e),this.messagesChunk=Zr(this.messagesChunk,e);else return Qt(this.awaitTake,this.takeN(e));return X([t,this.releaseCapacity()])})}unsafeTake(){if(this.state._tag==="Done")return c2(this.state.exit,Pf(new J0));let e;if(this.messagesChunk.length>0)e=Zd(this.messagesChunk),this.messagesChunk=Zr(this.messagesChunk,1);else if(this.messages.length>0)e=this.messages[0],this.messagesChunk=Zr(nt(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?Tr(this.messages.pop()):void 0;else return;return this.releaseCapacity(),Tr(e)}take=Re(()=>this.unsafeTake()??Qt(this.awaitTake,this.take));await=am((e)=>{if(this.state._tag==="Done")return e(this.state.exit);return this.state.awaiters.add(e),ue(()=>{if(this.state._tag!=="Done")this.state.awaiters.delete(e)})});unsafeSize(){let e=this.messages.length+this.messagesChunk.length;return this.state._tag==="Done"?R():_(e)}size=ue(()=>this.unsafeSize());commit(){return this.takeAll}pipe(){return ce(this,arguments)}toJSON(){return{_id:"effect/Mailbox",state:this.state._tag,size:this.unsafeSize().toJSON()}}toString(){return Ut(this)}[dt](){return Ut(this)}offerRemainingSingle(e){return am((t)=>{if(this.state._tag!=="Open")return t(a3);let r={_tag:"Single",message:e,resume:t};return this.state.offers.add(r),ue(()=>{if(this.state._tag==="Open")this.state.offers.delete(r)})})}offerRemainingArray(e){return am((t)=>{if(this.state._tag!=="Open")return t(Tr(nt(e)));let r={_tag:"Array",remaining:e,offset:0,resume:t};return this.state.offers.add(r),ue(()=>{if(this.state._tag==="Open")this.state.offers.delete(r)})})}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 e=this.capacity-this.messages.length-this.messagesChunk.length;for(let t of this.state.offers)if(e===0)return!1;else if(t._tag==="Single")this.messages.push(t.message),e--,t.resume(c3),this.state.offers.delete(t);else{for(;t.offset<t.remaining.length;t.offset++){if(e===0)return!1;this.messages.push(t.remaining[t.offset]),e--}t.resume(FVe),this.state.offers.delete(t)}return!1}awaitTake=am((e)=>{if(this.state._tag==="Done")return e(this.state.exit);return this.state.takers.add(e),ue(()=>{if(this.state._tag!=="Done")this.state.takers.delete(e)})});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 e of this.state.takers)if(this.state.takers.delete(e),e(eo),this.messages.length+this.messagesChunk.length===0)break};unsafeTakeAll(){if(this.messagesChunk.length>0){let e=this.messages.length>0?Vt(this.messagesChunk,nt(this.messages)):this.messagesChunk;return this.messagesChunk=ak,this.messages=[],e}else if(this.messages.length>0){let e=nt(this.messages);return this.messages=[],e}else if(this.state._tag!=="Done"&&this.state.offers.size>0)return this.capacity=1,this.releaseCapacity(),this.capacity=0,We(this.messages.pop());return ak}finalize(e){if(this.state._tag==="Done")return;let t=this.state;this.state={_tag:"Done",exit:e};for(let r of t.takers)r(e);t.takers.clear();for(let r of t.awaiters)r(e);t.awaiters.clear()}}var UVe=(e)=>Ot((t)=>X(new LVe(t.currentScheduler,typeof e==="number"?e:e?.capacity??Number.POSITIVE_INFINITY,typeof e==="number"?"suspend":e?.strategy??"suspend")));var jse=(e)=>{let t=he(e.takeAll,([r,n])=>n?r.length===0?it:Se(r):ir(Se(r),t));return t},HVe=(e)=>tE(jse(e));var uVt=l3;var qVe=(e)=>de(e,uVt);var Xc=UVe;var BVe=jse,qF=HVe;import*as u3 from"node:readline";var WVe=(e)=>e.key.ctrl&&(e.key.name==="c"||e.key.name==="d"),zVe=Wn(function*(e=WVe){let{stdin:t,stdout:r}=process,n=yield*$B({acquire:vr(Ce(()=>{let u=u3.createInterface({input:t,escapeCodeTimeout:50});if(u3.emitKeypressEvents(t,u),t.isTTY)t.setRawMode(!0);return u}),(u)=>Ce(()=>{if(t.isTTY)t.setRawMode(!1);u.close()}))}),o=Ce(()=>r.columns??0),s=Ce(()=>r.rows??0),i=Ce(()=>Boolean(r.isTTY)),a=$e(function*(){yield*PM(n);let u=yield*Xc(),f=(h,y)=>{let E={input:Ft(h),key:{name:y.name??"",ctrl:!!y.ctrl,meta:!!y.meta,shift:!!y.shift}};if(u.unsafeOffer(E),e(E))u.unsafeDone(ta)};return yield*TR(()=>Ce(()=>t.off("keypress",f))),t.on("keypress",f),u}),c=PM(n).pipe(L((u)=>$o((f)=>{let h=(y)=>f(N(y));return u.once("line",h),Ce(()=>u.off("line",h))})),ei),l=(u)=>Vf($o((f)=>{r.write(u,(h)=>h?f(ie(new Qa({module:"Terminal",method:"display",description:"Failed to write prompt to stdout",cause:h}))):f(me))}));return zr.of({columns:o,rows:s,isTTY:i,readInput:a,readLine:c,display:l})}),$Ve=Pp(zr,zVe(WVe));var jVe=$Ve;var eb={};Ht(eb,{TypeId:()=>p3,add:()=>yVt,awaitEmpty:()=>CVt,clear:()=>SVt,isFiberSet:()=>Vse,join:()=>Kse,make:()=>ck,makeRuntime:()=>hVt,makeRuntimePromise:()=>gVt,run:()=>EVt,runtime:()=>BF,runtimePromise:()=>JVe,size:()=>bVt,unsafeAdd:()=>Px});var p3=Symbol.for("effect/FiberSet"),Vse=(e)=>de(e,p3),dVt={[p3]:p3,[Symbol.iterator](){if(this.state._tag==="Closed")return Cue();return this.state.backing[Symbol.iterator]()},toString(){return Ut(this.toJSON())},toJSON(){return{_id:"FiberMap",state:this.state}},[dt](){return this.toJSON()},pipe(){return ce(this,arguments)}},mVt=(e,t)=>{let r=Object.create(dVt);return r.state={_tag:"Open",backing:e},r.deferred=t,r},ck=()=>vr(W(_r(),(e)=>mVt(new Set,e)),(e)=>Zs((t)=>{let r=e.state;if(r._tag==="Closed")return me;e.state={_tag:"Closed"};let n=r.backing;return jbe(n,Nb(t.id(),Gse)).pipe(WC(e.deferred))})),hVt=()=>L(ck(),(e)=>BF(e)()),gVt=()=>L(ck(),(e)=>JVe(e)()),GVe=-1,Gse=Lb(GVe,0),xVt=c5(void 0,{emptyCase:Fo,failCase:Fo,dieCase:Fo,interruptCase:(e,t)=>gI(xT(t),GVe),sequentialCase:(e,t,r)=>t||r,parallelCase:(e,t,r)=>t||r}),Px=p((e)=>Vse(e[0]),(e,t,r)=>{if(e.state._tag==="Closed"){t.unsafeInterruptAsFork(Nb(r?.interruptAs??Ks,Gse));return}else if(e.state.backing.has(t))return;e.state.backing.add(t),t.addObserver((n)=>{if(e.state._tag==="Closed")return;if(e.state.backing.delete(t),Fa(n)&&(r?.propagateInterruption===!0?!xVt(n.cause):!Om(n.cause)))Cu(e.deferred,n)})}),yVt=p((e)=>Vse(e[0]),(e,t,r)=>DA((n)=>Ce(()=>Px(e,t,{...r,interruptAs:n})))),SVt=(e)=>Zs((t)=>{if(e.state._tag==="Closed")return me;return en(e.state.backing,(r)=>EA(r,Nb(t.id(),Gse)))}),KVe=function(){let e=void 0;return()=>{if(e===void 0)e=Al(ia);return e}}(),EVt=function(){let e=arguments[0];if(!mn(arguments[1])){let t=arguments[1];return(r)=>VVe(e,r,t)}return VVe(e,arguments[1],arguments[2])},VVe=(e,t,r)=>DA((n)=>{if(e.state._tag==="Closed")return Ce(KVe);return sr(vp(t),(o)=>Px(e,o,{...r,interruptAs:n}))}),BF=(e)=>()=>W(Wc(),(t)=>{let r=xc(t);return(n,o)=>{if(e.state._tag==="Closed")return KVe();let s=r(n,o);return Px(e,s),s}}),JVe=(e)=>()=>W(BF(e)(),(t)=>(r,n)=>new Promise((o,s)=>t(r,n).addObserver((i)=>{if(Uc(i))o(i.value);else s(gi(i.cause))}))),bVt=(e)=>Ce(()=>e.state._tag==="Closed"?0:e.state.backing.size),Kse=(e)=>Wt(e.deferred),CVt=(e)=>kg({while:()=>e.state._tag==="Open"&&e.state.backing.size>0,body:()=>sS(Eue(e)),step:wo});class tb extends Gs("@effect/platform/Transferable/Collector")(){}var K_=()=>{let e=[],t=(o)=>{e.push(...o)},r=()=>e,n=()=>{let o=e;return e=[],o};return tb.of({unsafeAddAll:t,addAll:(o)=>Ce(()=>t(o)),unsafeRead:r,read:Ce(r),unsafeClear:n,clear:Ce(n)})};var QVe=Symbol.for("@effect/platform/WorkerError");var YVe=QVe;class Dx extends ri()("WorkerError",{reason:qe("spawn","decode","send","unknown","encode"),cause:io}){[YVe]=YVe;static Cause=Bte({error:this,defect:io});static encodeCause=_S(this.Cause);static decodeCause=rO(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 Qse=Symbol.for("@effect/platform/Worker/PlatformWorker"),f3=qt("@effect/platform/Worker/PlatformWorker"),Yse=Symbol.for("@effect/platform/Worker/WorkerManager"),Zse=qt("@effect/platform/Worker/WorkerManager"),ZVe=qt("@effect/platform/Worker/Spawner"),XVe=$e(function*(){let e=yield*f3,t=0;return Zse.of({[Yse]:Yse,spawn({encode:r,initialMessage:n}){return $e(function*(){let o=t++,s=0,i=new Map,a=K_(),c=r?(w)=>ve(a.clear,xi(r(w),tb,a)):N,l=yield*_r(),u=yield*e.spawn(o);yield*u.run((w)=>{if(w[0]===0)return GH(l,me);return f(w[1])}).pipe(qC((w)=>en(i.values(),(T)=>(fS in T)?bu(T,w):T.failCause(w))),Iu(jQ),Rm($S(1000)),$C({package:"@effect/platform",module:"Worker"}),an,Ri),yield*TR(()=>ve(en(i.values(),(w)=>(fS in w)?IR(w):w.end,{discard:!0}),Ce(()=>i.clear())));let f=(w)=>Qe(()=>{let T=i.get(w[0]);if(!T)return me;switch(w[1]){case 0:return fS in T?mo(T,w[2][0]):T.offerAll(w[2]);case 1:{if(w.length===2)return fS in T?IR(T):T.end;return fS in T?mo(T,w[2][0]):ve(T.offerAll(w[2]),T.end)}case 2:case 3:{if(w[1]===2)return fS in T?KH(T,w[2]):T.fail(w[2]);let A=Dx.decodeCause(w[2]);return fS in T?bu(T,A):T.failCause(A)}}}),h=(w,T)=>Zs((A)=>{let k=A.getFiberRef(Vc),O=ws(k,QI).pipe(Vi((D)=>D._tag==="Span")),P=s++;return T.pipe(sr((D)=>(i.set(P,D),c(w).pipe(sr((I)=>u.send([P,0,I,O._tag==="Some"?[O.value.traceId,O.value.spanId,O.value.sampled]:void 0],a.unsafeRead())),tn((I)=>qVe(D)?D.failCause(I):bu(D,I))))),W((D)=>({id:P,mailbox:D})))}),y=({id:w},T)=>{let A=Ce(()=>i.delete(w));return Fa(T)?ve(Pr(u.send([w,1])),A):A},E=(w)=>Zg(qW(h(w,Xc()),({mailbox:T})=>BVe(T),y)),b=(w)=>xS(h(w,_r()),({mailbox:T})=>Wt(T),y);if(yield*Wt(l),n)yield*Ce(n).pipe(L(b),br((w)=>new Dx({reason:"spawn",cause:w})));return{id:o,execute:E,executeEffect:b}})}})}),e3e=gc(Zse,XVe);var t3e=()=>(e)=>f3.of({[Qse]:Qse,spawn(t){return $e(function*(){let r=yield*ZVe,n,o=[];return{run:(a)=>wu((c)=>$e(function*(){let l=yield*Mm,u=yield*e.setup({worker:r(t),scope:l});n=u,yield*Ti(l,Ce(()=>{n=void 0}));let f=(yield*Wc()).pipe(Ove(UL(wp))),h=yield*ck(),y=xc(f);if(yield*e.listen({port:u,scope:l,emit(E){Px(h,y(a(E)))},deferred:h.deferred}),o.length>0){for(let[E,b]of o)u.postMessage([0,E],b);o.length=0}return yield*c(Kse(h))}).pipe(ei)),send:(a,c)=>Ps({try:()=>{if(n===void 0)o.push([a,c]);else n.postMessage([0,a],c)},catch:(l)=>new Dx({reason:"send",cause:l})})}})}});var r3e=t3e,n3e=f3;var o3e=e3e;var AVt=r3e()({setup({scope:e,worker:t}){return L(_r(),(r)=>{let n="postMessage"in t?{postMessage(o,s){t.postMessage(o,s)},kill:()=>t.terminate(),worker:t}:{postMessage(o,s){t.send(o)},kill:()=>t.kill("SIGKILL"),worker:t};return t.on("exit",()=>{Cu(r,ta)}),qr(Ti(e,Qe(()=>(n.postMessage([1]),Wt(r))).pipe(an,DR(5000),tn(()=>Ce(()=>n.kill())))),n)})},listen({deferred:e,emit:t,port:r}){return r.worker.on("message",(n)=>{t(n)}),r.worker.on("messageerror",(n)=>{Cu(e,new Dx({reason:"decode",cause:n}))}),r.worker.on("error",(n)=>{Cu(e,new Dx({reason:"unknown",cause:n}))}),r.worker.on("exit",(n)=>{Cu(e,new Dx({reason:"unknown",cause:Error(`exited with code ${n}`)}))}),me}}),s3e=Hs(n3e,AVt),i3e=Oo(o3e,s3e);var a3e=i3e;var vVt=d(fM(i3,r3,jVe,a3e),Lm(o3));var xa={};Ht(xa,{layer:()=>TVt});var TVt=o3;var dh={};Ht(dh,{Dispatcher:()=>s3t,HttpAgent:()=>ZVt,HttpAgentTypeId:()=>YVt,UndiciRequestOptions:()=>h3e,agentLayer:()=>e3t,dispatcherLayer:()=>a3t,dispatcherLayerGlobal:()=>c3t,layer:()=>n3t,layerUndici:()=>u3t,layerUndiciWithoutDispatcher:()=>p3t,layerWithoutAgent:()=>o3t,make:()=>r3t,makeAgent:()=>XVt,makeAgentLayer:()=>t3t,makeDispatcher:()=>i3t,makeUndici:()=>l3t});import*as m3 from"node:http";import*as h3 from"node:https";import{Readable as l3e}from"node:stream";import{pipeline as zVt}from"node:stream/promises";var WF={};Ht(WF,{fromWritable:()=>J_,fromWritableChannel:()=>RVt,stderr:()=>PVt,stdin:()=>DVt,stdout:()=>MVt});var J_=e3,RVt=Use,MVt=J_(()=>process.stdout,(e)=>new Ec({module:"Stream",method:"stdout",reason:"Unknown",cause:e})),PVt=J_(()=>process.stderr,(e)=>new Ec({module:"Stream",method:"stderr",reason:"Unknown",cause:e})),DVt=J_(()=>process.stdin,(e)=>new Ec({module:"Stream",method:"stdin",reason:"Unknown",cause:e}));var fh={};Ht(fh,{fromDuplex:()=>NVt,fromReadable:()=>zF,fromReadableChannel:()=>FVt,pipeThroughDuplex:()=>LVt,pipeThroughSimple:()=>UVt,stderr:()=>WVt,stdin:()=>qVt,stdout:()=>BVt,toReadable:()=>Xse,toReadableNever:()=>HVt,toString:()=>eie,toUint8Array:()=>tie});var zF=ZE,FVt=Fse,NVt=XV,LVt=dVe,UVt=mVe,Xse=gVe,HVt=xVe,eie=pVe,tie=fVe,qVt=ZE(()=>process.stdin,(e)=>e,{closeOnDone:!1}).pipe(vP),BVt=ZE(()=>process.stdout,(e)=>e,{closeOnDone:!1}).pipe(vP),WVt=ZE(()=>process.stderr,(e)=>e,{closeOnDone:!1}).pipe(vP);class rie extends cl{source;onError;remoteAddressOverride;[zi];constructor(e,t,r){super();this.source=e,this.onError=t,this.remoteAddressOverride=r,this[zi]=zi}get headers(){return Ci(this.source.headers)}get remoteAddress(){return Ft(this.remoteAddressOverride??this.source.socket.remoteAddress)}textEffect;get text(){if(this.textEffect)return this.textEffect;return this.textEffect=xr(Bc(L(W_,(e)=>eie(()=>this.source,{onFailure:this.onError,maxBytes:Ar(e)})))),this.textEffect}get unsafeText(){return xr(this.text)}get json(){return jf(this.text,{try:(e)=>e===""?null:JSON.parse(e),catch:this.onError})}get unsafeJson(){return xr(this.json)}get urlParamsBody(){return L(this.text,(e)=>Ps({try:()=>zu(new URLSearchParams(e)),catch:this.onError}))}get stream(){return zF(()=>this.source,this.onError)}get arrayBuffer(){return L(W_,(e)=>tie(()=>this.source,{onFailure:this.onError,maxBytes:Ar(e)}))}}var d3=Symbol.for("@effect/platform-node/Http/NodeClient/HttpAgent"),g3=qt("@effect/platform-node/Http/NodeClient/HttpAgent"),nie=(e)=>W(Ha([vr(Ce(()=>new m3.Agent(e)),(t)=>Ce(()=>t.destroy())),vr(Ce(()=>new h3.Agent(e)),(t)=>Ce(()=>t.destroy()))]),([t,r])=>({[d3]:d3,http:t,https:r})),oie=(e)=>Pp(g3,nie(e)),sie=oie(),$Vt=(e)=>DF((t,r,n)=>{let o=r.protocol==="https:"?h3.request(r,{agent:e.https,method:t.method,headers:t.headers,signal:n}):m3.request(r,{agent:e.http,method:t.method,headers:t.headers,signal:n});return d(ve(jVt(o,t,t.body),VVt(o,t),{concurrent:!0}),W((s)=>new u3e(t,s)))}),jVt=(e,t,r)=>Qe(()=>{switch(r._tag){case"Empty":return e.end(),c3e(e,t);case"Uint8Array":case"Raw":return e.end(r.body),c3e(e,t);case"FormData":{let n=new Response(r.formData);return n.headers.forEach((o,s)=>{e.setHeader(s,o)}),Ds({try:()=>zVt(l3e.fromWeb(n.body),e),catch:(o)=>new nf({request:t,reason:"Transport",cause:o})})}case"Stream":return ad(_P(r.stream,(n)=>new nf({request:t,reason:"Encode",cause:n})),J_(()=>e,(n)=>new nf({request:t,reason:"Transport",cause:n})))}}),VVt=(e,t)=>$o((r)=>{function n(s){r(ie(new nf({request:t,reason:"Transport",cause:s})))}e.on("error",n);function o(s){e.off("error",n),r(N(s))}return e.on("upgrade",o),e.on("response",o),Ce(()=>{e.off("error",n),e.off("upgrade",o),e.off("response",o)})}),c3e=(e,t)=>$o((r)=>{function n(s){r(ie(new nf({request:t,reason:"Transport",cause:s})))}e.once("error",n);function o(){e.off("error",n),r(me)}return e.once("finish",o),Ce(()=>{e.off("error",n),e.off("finish",o)})});class u3e extends rie{request;[Mx];constructor(e,t){super(t,(r)=>new bs({request:e,response:this,reason:"Decode",cause:r}));this.request=e,this[Mx]=Mx}get status(){return this.source.statusCode}cachedCookies;get cookies(){if(this.cachedCookies!==void 0)return this.cachedCookies;let e=this.source.headers["set-cookie"];if(Array.isArray(e))return this.cachedCookies=q_(e);return this.cachedCookies=vx}get formData(){return Ds({try:()=>{let e={headers:new globalThis.Headers(this.source.headers)};if(this.source.statusCode)e.status=this.source.statusCode;if(this.source.statusMessage)e.statusText=this.source.statusMessage;return new Response(l3e.toWeb(this.source),e).formData()},catch:this.onError})}toJSON(){return KE(this,{_id:"@effect/platform/HttpClientResponse",request:this.request.toJSON(),status:this.status})}}var iie=W(g3,$Vt),aie=FF(iie),p3e=Oo(aie,sie);var $F=qt("@effect/platform-node/NodeHttpClient/Dispatcher"),cie=vr(Ce(()=>new x3.Agent),(e)=>LC(()=>e.destroy())),lie=Pp($F,cie),f3e=ow($F,()=>x3.getGlobalDispatcher()),uie="@effect/platform-node/NodeHttpClient/undiciOptions",pie=(e)=>DF((t,r,n,o)=>{let i=o.getFiberRef(Vc).unsafeMap.get(uie)??{};return KVt(t.body).pipe(L((a)=>Ds({try:()=>e.request({...i,signal:n,method:t.method,headers:t.headers,origin:r.origin,path:r.pathname+r.search+r.hash,body:a,headersTimeout:3600000,bodyTimeout:0}),catch:(c)=>new nf({request:t,reason:"Transport",cause:c})})),W((a)=>new d3e(t,a)))});function KVt(e){switch(e._tag){case"Empty":return N(null);case"Uint8Array":case"Raw":return N(e.body);case"FormData":return N(e.formData);case"Stream":return Xse(e.stream)}}function JVt(e){}class d3e extends cl{request;source;[zi];[Mx];constructor(e,t){super();this.request=e,this.source=t,this[zi]=zi,this[Mx]=Mx,t.body.on("error",JVt)}get status(){return this.source.statusCode}get statusText(){return}cachedCookies;get cookies(){if(this.cachedCookies!==void 0)return this.cachedCookies;let e=this.source.headers["set-cookie"];if(e!==void 0)return this.cachedCookies=q_(Array.isArray(e)?e:[e]);return this.cachedCookies=vx}get headers(){return Ci(this.source.headers)}get remoteAddress(){return R()}get stream(){return zF(()=>this.source.body,(e)=>new bs({request:this.request,response:this,reason:"Decode",cause:e}))}get json(){return jf(this.text,{try:(e)=>e===""?null:JSON.parse(e),catch:(e)=>new bs({request:this.request,response:this,reason:"Decode",cause:e})})}textBody;get text(){return this.textBody??=Ds({try:()=>this.source.body.text(),catch:(e)=>new bs({request:this.request,response:this,reason:"Decode",cause:e})}).pipe(Bc,xr)}get urlParamsBody(){return L(this.text,(e)=>Ps({try:()=>zu(new URLSearchParams(e)),catch:(t)=>new bs({request:this.request,response:this,reason:"Decode",cause:t})}))}formDataBody;get formData(){return this.formDataBody??=Ds({try:()=>this.source.body.formData(),catch:(e)=>new bs({request:this.request,response:this,reason:"Decode",cause:e})}).pipe(Bc,xr)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody??=Ds({try:()=>this.source.body.arrayBuffer(),catch:(e)=>new bs({request:this.request,response:this,reason:"Decode",cause:e})}).pipe(Bc,xr)}toJSON(){return KE(this,{_id:"@effect/platform/HttpClientResponse",request:this.request.toJSON(),status:this.status})}}var fie=FF(W($F,pie)),m3e=Oo(fie,lie);var YVt=d3,ZVt=g3,XVt=nie,e3t=sie,t3t=oie,r3t=iie,n3t=p3e,o3t=aie,s3t=$F,i3t=cie,a3t=lie,c3t=f3e;class h3e extends Gs(uie)(){}var l3t=pie,u3t=m3e,p3t=fie;var Ac={};Ht(Ac,{layer:()=>f3t,layerPosix:()=>d3t,layerWin32:()=>m3t});var f3t=i3,d3t=MVe,m3t=PVe;var y3={};Ht(y3,{runMain:()=>y3t});var h3t=(e,t)=>{t(Fa(e)&&!Om(e.cause)?1:0)},g3e=(e,t)=>{let r=Ff(e,VY);if(!gI(r,H_))return e;return C6(e,{fiberId:t,fiberRef:VY,value:r.pipe(Vh(H_),ou(kF))})},x3e=(e)=>p((t)=>mn(t[0]),(t,r)=>{let n=r?.disableErrorReporting===!0?Al(t,{updateRefs:r?.disablePrettyLogger===!0?void 0:g3e}):Al(Iu(t,(s)=>{if(Om(s))return me;return zC(s)}),{updateRefs:r?.disablePrettyLogger===!0?void 0:g3e}),o=r?.teardown??h3t;return e({fiber:n,teardown:o})});var y3e=x3e(({fiber:e,teardown:t})=>{let r=setInterval(wo,2147483647),n=!1;e.addObserver((s)=>{if(!n)process.removeListener("SIGINT",o),process.removeListener("SIGTERM",o);clearInterval(r),t(s,(i)=>{if(n||i!==0)process.exit(i)})});function o(){n=!0,process.removeListener("SIGINT",o),process.removeListener("SIGTERM",o),e.unsafeInterruptAsFork(e.id())}process.on("SIGINT",o),process.on("SIGTERM",o)});var S3e=y3e;var y3t=S3e;var jF="https://expand.land";function S3t(e){return e.replace(/\/+$/,"")}function E3t(e){return e!==null&&e!==void 0&&Number.isInteger(e)&&e>0&&e<=2147483647?e:void 0}function E3e(e){return e!==null&&e!==void 0&&Number.isInteger(e)&&e>=0&&e<=4294967295?e:void 0}function die(e,t="https://expand.land"){return`${S3t(t)}/s/${encodeURIComponent(e)}`}function b3t(e){return new URL(e).origin}function nb(e,t){if(e==null)return t;try{return b3t(e)}catch{return t}}function Q_(e,t,r,n="https://expand.land"){let o=typeof t==="string",s=o?t:void 0,i=o?typeof r==="string"?void 0:r:t,c=die(e,o?n:typeof r==="string"?r:"https://expand.land"),l=E3t(i?.evidenceId);if(l!==void 0)return`${c}?id=${l}`;if(s==="statejson"){let u=E3e(i?.stateJsonSourceId);return u===void 0?c:`${c}?id=${u}`}if(s==="markdown"||s==="appendix"){let u=E3e(i?.nodeIds?.[0]);return u===void 0?c:`${c}/playground#focus=${u}`}return c}function b3e(e,t,r,n){return m.scoped(m.gen(function*(){let o=yield*e.open(t,{flag:"wx",mode:n}),s=yield*o.stat,i={dev:s.dev,ino:q.getOrUndefined(s.ino),mode:s.mode,type:s.type},a=yield*m.exit(o.writeAll(new TextEncoder().encode(r)).pipe(m.zipRight(o.sync)));if(Rr.isFailure(a))return{identity:i,writeExit:a,pathMatchesHandle:!1};let c=yield*e.stat(t),l=Y_(i,{exists:!0,dev:c.dev,ino:q.getOrUndefined(c.ino),type:c.type});return{identity:i,writeExit:a,pathMatchesHandle:l}}))}function Y_(e,t){return t.exists&&t.dev===e.dev&&t.ino===e.ino&&t.type===e.type}import{homedir as C3t}from"node:os";var S3=m.gen(function*(){let e=yield*So.Path;return yield*Ae.string("XDG_CONFIG_HOME").pipe(Ae.withDefault(""),Ae.map((t)=>t.trim()===""?e.join(C3t(),".config"):t))});var b3="https://api.expand.ai",w3t="https://expand.ai",ev=(e)=>Ae.string(e).pipe(Ae.option,Ae.map(q.match({onNone:()=>!1,onSome:(t)=>t!==""&&t!=="0"&&t!=="false"}))),C3=(e,t)=>Ae.string(e).pipe(Ae.option,Ae.map(q.flatMap(x.decodeUnknownOption(t)))),w3=x.Redacted(x.NonEmptyTrimmedString.pipe(x.brand("ApiKey"))),k3="Re-authenticate in this shell with `expandai login --json`. When an agent is handling the task, it must run that command itself and only ask the user to approve the returned URL and code in a browser.",mie=x.TaggedStruct("ApiKey",{apiKey:w3}),GF=x.TaggedStruct("OAuth",{accessToken:x.Redacted(x.String),refreshToken:x.optional(x.Redacted(x.String)),expiresAt:x.DateTimeUtc,clientId:x.optional(x.String)}),k3t=x.Struct({enabled:x.optional(x.Boolean),distinctId:x.optional(x.String),noticeShown:x.optional(x.Boolean)});class Fx extends x.Class("ExpandCliConfig")({apiUrl:x.optional(x.URL),authMethod:x.optional(x.Union(mie,GF)),telemetry:x.optional(k3t)}){static Json=x.parseJson(Fx)}function I3(e,t){if(e._tag==="ApiKey")return"healthy";if(ar.lessThan(t,e.expiresAt))return da.value(e.accessToken).trim().length>0?"healthy":"unusable";let r=e.refreshToken;return r!==void 0&&da.value(r).trim().length>0?"refresh_required":"unusable"}function A3(e,t){return I3(e,t)!=="unusable"}var I3t=x.Record({key:x.String,value:x.Unknown}),E3=x.parseJson(I3t);function A3t(e,t){return{...e,...t}}function O3t(e,t){return typeof e==="object"&&e!==null&&"code"in e&&e.code===t}function _3t(e){return`'${e.replaceAll("'","''")}'`}function C3e(e,t){return`$targetPaths = @(${t.map((r)=>_3t(r)).join(", ")})
|
|
208
|
+
try {
|
|
209
|
+
Import-Module (Join-Path $PSHOME 'Modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1') -ErrorAction Stop
|
|
210
|
+
$null = & {
|
|
211
|
+
${e}
|
|
212
|
+
}
|
|
213
|
+
exit 0
|
|
214
|
+
} catch {
|
|
215
|
+
[Console]::Error.WriteLine($_.Exception.Message)
|
|
216
|
+
exit 1
|
|
217
|
+
}`}function w3e(e,t){return e.exists===t.exists&&e.dev===t.dev&&e.ino===t.ino&&e.realPath===t.realPath&&e.type===t.type}class Z_ extends x.TaggedError()("ConfigNotWritable",{path:x.String}){get message(){return`Cannot write to ${this.path}. Check filesystem permissions on the config directory.`}}class VF extends x.TaggedError()("ConfigCleanupError",{path:x.String,temporaryPath:x.String,error:x.Defect,operationError:x.Defect}){get message(){return`Could not safely clean up config temporary state at ${this.temporaryPath}; it was left unchanged.`}}class X_ extends x.TaggedError()("ConfigParseError",{path:x.String,error:x.Defect}){get message(){return`Could not parse ${this.path}. Delete the file and run \`expandai login\` to recreate it.`}}class kd extends x.TaggedError()("CredentialStoreInsecure",{path:x.String,reason:x.String,error:x.Defect}){get message(){return`Credential storage at ${this.path} is insecure: ${this.reason}`}}class O3 extends x.TaggedError()("NotAuthenticated",{}){get message(){return`Not authenticated. ${k3}`}}class KF extends x.TaggedError()("OAuthTokenExpired",{expiredAt:x.DateTimeUtc}){get message(){return`Your OAuth token expired at ${ar.formatIso(this.expiredAt)}. ${k3}`}}var k3e=m.gen(function*(){let e=yield*x.Config("EXPAND_API_KEY",w3).pipe(Ae.option),t=yield*Ae.url("EXPAND_API_URL").pipe(Ae.option);return Fx.make({apiUrl:q.getOrUndefined(t),authMethod:q.getOrUndefined(q.map(e,(r)=>({_tag:"ApiKey",apiKey:r})))})});class Cr extends m.Service()("@expandai/cli/Config/ConfigManager",{dependencies:[rb.layer],effect:m.gen(function*(){let e=yield*_x.CommandExecutor,t=yield*un.FileSystem,r=yield*So.Path,n=r.join(yield*S3,"expandai","config.json"),o=r.dirname(n),s=(F,J,G)=>new kd({path:F,reason:J,error:G}),i=m.fnUntraced(function*(F){let J=yield*m.either(t.readLink(F));if(mt.isRight(J))return yield*s(F,"symbolic links are not allowed for credential storage",Error(J.right));let G=J.left;if(G instanceof Qc.SystemError&&(G.reason==="InvalidData"||G.reason==="NotFound"||G.method==="readLink"&&O3t(G.cause,"EINVAL")))return;return yield*s(F,"could not inspect the credential path without following links",G)}),a=m.fnUntraced(function*(F){if(yield*i(F),!(yield*t.exists(F).pipe(m.mapError((we)=>s(F,"could not inspect the credential path",we)))))return{exists:!1};let G=yield*t.stat(F).pipe(m.mapError((we)=>s(F,"could not inspect the credential path",we))),Z=yield*t.realPath(F).pipe(m.mapError((we)=>s(F,"could not resolve the credential path",we)));return{exists:!0,dev:G.dev,ino:q.getOrUndefined(G.ino),realPath:Z,type:G.type}}),c=(F,J,G)=>w3e(J,G)?m.void:m.fail(s(F,"credential path identity changed during the operation",Error("Path swap detected"))),l=m.fnUntraced(function*(F){let J=r.dirname(F),G=yield*a(J);if(!G.exists||G.type!=="Directory")return yield*s(J,"credential parent is not a directory",Error("Invalid parent"));return{parentPath:J,parent:G,file:yield*a(F)}}),u=m.fnUntraced(function*(F){let J=yield*l(F);if(!J.file.exists||J.file.type!=="File")return yield*s(F,"credential path is not a regular file",Error("Invalid file"));let G=yield*t.readFileString(F).pipe(m.mapError((ne)=>s(F,"could not read the credential file",ne))),Z=yield*l(F);return yield*c(J.parentPath,J.parent,Z.parent),yield*c(F,J.file,Z.file),G}),f=m.fnUntraced(function*(F,J,G){let Z=yield*a(F);if(!Z.exists||Z.type!==G)return yield*s(F,`expected a ${G.toLowerCase()}`,Error("Invalid path type"));yield*t.chmod(F,J).pipe(m.mapError((rt)=>s(F,`could not set mode ${J.toString(8)}`,rt)));let ne=yield*t.stat(F).pipe(m.mapError((rt)=>s(F,"could not verify permissions",rt))),we=ne.mode&4095;if(ne.type!==G||we!==J)return yield*s(F,`expected ${G.toLowerCase()} mode ${J.toString(8)}, found ${ne.type.toLowerCase()} mode ${we.toString(8)}`,Error("Permission verification failed"));let ot=yield*a(F);yield*c(F,Z,ot)}),h=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
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
-
|
|
203
|
-
|
|
264
|
+
'SECURE'
|
|
265
|
+
`,y=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
|
-
|
|
290
|
+
'SECURE'
|
|
291
|
+
`,E=m.fnUntraced(function*(F){let J=yield*Zc.make("powershell.exe","-NoLogo","-NoProfile","-NonInteractive","-Command",C3e(h,F)).pipe(Zc.stderr("inherit"),Zc.exitCode,m.provideService(_x.CommandExecutor,e),m.mapError((G)=>s(o,"could not apply or verify the Windows ACL allowlist",G)));if(J!==0)return yield*s(o,"Windows ACL verification failed",Error(`PowerShell exited with status ${J}`))}),b=m.fnUntraced(function*(F){let J=yield*Zc.make("powershell.exe","-NoLogo","-NoProfile","-NonInteractive","-Command",C3e(y,F)).pipe(Zc.stderr("inherit"),Zc.exitCode,m.provideService(_x.CommandExecutor,e),m.mapError((G)=>s(o,"could not inspect the Windows ACL allowlist",G)));if(J!==0)return yield*s(o,"Windows ACL inspection failed",Error(`PowerShell exited with status ${J}`))}),w=m.fn("ConfigManager.inspectSecureStorage")(function*(){let F=yield*a(o);if(!F.exists)return yield*m.void;if(F.type!=="Directory")return yield*s(o,"config directory is not a regular directory",Error("Invalid config directory"));let J=yield*a(n);if(J.exists&&J.type!=="File")return yield*s(n,"credential path is not a regular file",Error("Invalid file"));if(process.platform==="win32"){let Z=J.exists?[o,n]:[o],ne=yield*m.forEach(Z,a);yield*b(Z);let we=yield*m.forEach(Z,a);return yield*m.forEach(Z,(ot,rt)=>c(ot,ne[rt]??{exists:!1},we[rt]??{exists:!1}),{discard:!0}),yield*m.void}if(((yield*t.stat(o).pipe(m.mapError((Z)=>s(o,"could not inspect directory mode",Z)))).mode&4095)!==448)return yield*s(o,"config directory mode is not 700",Error("Invalid directory mode"));if(J.exists){if(((yield*t.stat(n).pipe(m.mapError((ne)=>s(n,"could not inspect credential file mode",ne)))).mode&4095)!==384)return yield*s(n,"credential file mode is not 600",Error("Invalid file mode"))}return yield*m.void}),T=m.fn("ConfigManager.ensureSecureStorage")(function*(){yield*t.makeDirectory(o,{recursive:!0,mode:448}).pipe(m.mapError((G)=>s(o,"could not create the config directory",G)));let F=yield*a(o);if(!F.exists||F.type!=="Directory")return yield*s(o,"config directory is not a regular directory",Error("Invalid config directory"));if(!(yield*t.exists(n).pipe(m.mapError((G)=>s(n,"could not inspect the credential file",G))))){let G=yield*m.either(t.writeFileString(n,"{}",{flag:"wx",mode:384}));if(mt.isLeft(G)&&(!(G.left instanceof Qc.SystemError)||G.left.reason!=="AlreadyExists"))return yield*s(n,"could not create the credential file",G.left)}if(yield*l(n),process.platform==="win32"){let G=[o,n],Z=yield*m.forEach(G,(we)=>a(we));yield*E(G);let ne=yield*m.forEach(G,(we)=>a(we));yield*m.forEach(G,(we,ot)=>c(we,Z[ot]??{exists:!1},ne[ot]??{exists:!1}),{discard:!0})}else yield*f(o,448,"Directory"),yield*f(n,384,"File");return yield*m.void}),A=m.fnUntraced(function*(F){yield*T();let J=yield*l(n),G=yield*ER.nextIntBetween(0,2147483647),Z=r.join(o,`.config.json.${process.pid}.${G.toString(16)}.tmp`),ne=m.fnUntraced(function*(Dt,Lt){let Do=yield*m.either(l(Z));if(mt.isLeft(Do))return yield*new VF({path:n,temporaryPath:Z,error:Do.left,operationError:Lt});if(!w3e(J.parent,Do.right.parent))return yield*new VF({path:n,temporaryPath:Z,error:Error("Config temp parent identity changed; refusing cleanup"),operationError:Lt});if(!Y_(Dt,Do.right.file))return yield*new VF({path:n,temporaryPath:Z,error:Error("Config temp identity changed or disappeared; refusing cleanup"),operationError:Lt});let Ea=yield*m.either(t.remove(Z));if(mt.isLeft(Ea))return yield*new VF({path:n,temporaryPath:Z,error:Ea.left,operationError:Lt})}),we=yield*b3e(t,Z,F,384).pipe(m.mapError(()=>new Z_({path:Z})));if(Rr.isFailure(we.writeExit)){let Dt=new Z_({path:Z});return yield*ne(we.identity,Dt),yield*Dt}if(!we.pathMatchesHandle){let Dt=new Z_({path:Z});return yield*ne(we.identity,Dt),yield*Dt}let ot=yield*m.either(m.gen(function*(){let Dt=yield*l(Z);if(yield*c(J.parentPath,J.parent,Dt.parent),!Y_(we.identity,Dt.file))return yield*s(Z,"config temp identity differs from its creating handle",Error("Config temp replacement detected"));if(process.platform==="win32"){yield*E([Z]);let Do=yield*l(Z);if(yield*c(J.parentPath,J.parent,Do.parent),!Y_(we.identity,Do.file))return yield*s(Z,"config temp changed while applying its ACL",Error("Config temp replacement detected"))}else if(((yield*t.stat(Z).pipe(m.mapError((Ea)=>s(Z,"could not verify config temp mode",Ea)))).mode&4095)!==384)return yield*s(Z,"config temp mode is not 600",Error("Invalid config temp mode"));let Lt=yield*l(n);yield*c(J.parentPath,J.parent,Lt.parent),yield*c(n,J.file,Lt.file),yield*t.rename(Z,n).pipe(m.mapError(()=>new Z_({path:n})))}));if(mt.isLeft(ot))return yield*ne(we.identity,ot.left),yield*ot.left;let rt=yield*l(n);if(yield*c(J.parentPath,J.parent,rt.parent),!Y_(we.identity,rt.file))return yield*s(n,"atomic credential installation identity could not be verified",Error("Installed file identity mismatch"))}),k=m.gen(function*(){if(!(yield*t.exists(n)))return{config:Fx.make({}),raw:{}};let J=yield*u(n),G=yield*x.decode(E3)(J).pipe(m.mapError((we)=>new X_({path:n,error:we})));return{config:yield*x.decodeUnknown(Fx)(G).pipe(m.mapError((we)=>new X_({path:n,error:we}))),raw:G}}),O=k.pipe(m.map(({config:F})=>F)),P=m.fn("loadConfig")(function*(){let F=yield*k3e,J=yield*O,G={env:q.fromNullable(F.apiUrl),file:q.fromNullable(J.apiUrl)},Z={env:q.fromNullable(F.authMethod),file:q.fromNullable(J.authMethod)};yield*m.logWarning(`EXPAND_API_URL overrides apiUrl from ${n}`).pipe(m.when(()=>q.zipWith(G.env,G.file,(rt,Dt)=>rt.toString()!==Dt.toString()).pipe(q.getOrElse(()=>!1))));let ne=yield*ar.now,we=Z.file.pipe(q.filter((rt)=>rt._tag==="OAuth"&&A3(rt,ne))),ot=q.firstSomeOf([we,Z.env,Z.file]);return yield*m.logWarning(`EXPAND_API_KEY is set but ${n} 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(m.when(()=>q.isSome(Z.env)&&q.isSome(we))),yield*m.logWarning(`EXPAND_API_KEY overrides the API key stored in ${n}`).pipe(m.when(()=>q.isSome(Z.env)&&q.isSome(Z.file)&&q.isNone(we))),yield*q.match(ot,{onNone:()=>m.fail(new O3),onSome:(rt)=>m.succeed({apiUrl:q.firstSomeOf([G.env,G.file]).pipe(q.getOrElse(()=>new URL(b3))),authMethod:rt})})}),D=m.fn("saveConfig")(function*(F){let J=yield*x.encode(Fx.Json)(F);yield*A(J)}),I=m.fn("updateConfig")(function*(F){let J=yield*k,G=Fx.make({...J.config,...F}),Z=yield*x.encode(Fx.Json)(G).pipe(m.flatMap(x.decode(E3))),ne=yield*x.encode(E3)(A3t(J.raw,Z));yield*A(ne)}),M=m.fn("readConfigFile")(function*(){return yield*k.pipe(m.map(({config:F})=>({config:F,parseFailed:!1})),m.orElseSucceed(()=>({config:Fx.make({}),parseFailed:!0})))}),B=m.fn("clearConfig")(function*(){let F=yield*m.either(k);if(mt.isLeft(F)){if(!(F.left instanceof X_))return yield*F.left;yield*m.logWarning(`Could not parse ${n}; removing it. Telemetry preferences and apiUrl were not preserved.`),yield*t.remove(n).pipe(m.mapError(()=>new Z_({path:n})));return}let J={...F.right.raw};delete J.authMethod;let G=yield*x.encode(E3)(J);yield*A(G)}),ee=m.fn("getApiUrl")(function*(){let F=yield*k3e,J=yield*O,G={env:q.fromNullable(F.apiUrl),file:q.fromNullable(J.apiUrl)};return q.firstSomeOf([G.env,G.file]).pipe(q.getOrElse(()=>new URL(b3)))}),j=m.fn("getAppUrl")(function*(){return yield*Ae.string("EXPAND_APP_URL").pipe(Ae.withDefault(w3t))}),ae=m.fn("getPlaygroundHost")(function*(){return yield*Ae.string("EXPAND_PLAYGROUND_HOST").pipe(Ae.withDefault(jF))});return{configPath:n,inspectSecureStorage:w,ensureSecureStorage:T,loadConfig:P,saveConfig:D,updateConfig:I,clearConfig:B,readConfigFile:M,getApiUrl:ee,getAppUrl:j,getPlaygroundHost:ae}})}){}var lk="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.",_3="Authorization complete. That setup code has been consumed and cannot be reused.",v3="Expand is already authorized. Agent setup is complete.",hie="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.",gie="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.",xie="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.",$s=x.Literal("claude-code","cursor","opencode","codex");class T3 extends x.Class("InitDetectionResult")({schemaVersion:x.Literal(1),status:x.Literal("detected"),harnesses:x.Array($s),current:x.optional($s),userMessage:x.Literal(gie,xie)}){}var yie=x.NonEmptyArray($s),el=x.Literal("project","global"),v3t=x.Literal("webfetch-hook","runtime-skill","mcp"),T3t=x.Literal("unverified","observed","reload_required","blocked"),Pbr=x.Literal("authorization_required","completed"),R3t=x.String.pipe(x.minLength(20),x.maxLength(256)),M3t=x.transform(R3t,x.Redacted(x.String),{strict:!0,decode:(e)=>e,encode:()=>"<redacted-redacted-setup-token>"});class R3 extends x.Class("InitRequest")({harnesses:yie,scope:el,setupToken:x.optional(M3t)}){}var P3t=x.Struct({schemaVersion:x.Literal(1),status:x.Literal("authorization_required"),harnesses:yie,scope:el,userMessage:x.Literal(lk),authorization:x.Struct({url:x.URL,userCode:x.String,approvalExpiresAt:x.DateTimeUtc})}),D3t=x.Struct({runtimeState:T3t,nextAction:x.String}),F3t=x.Struct({harness:$s,configured:x.Boolean,changed:x.Boolean,components:x.Array(v3t),version:x.String,verification:D3t}),N3t=x.Struct({harness:$s,code:x.String,recoverable:x.Boolean}),L3t=x.Struct({schemaVersion:x.Literal(1),status:x.Literal("completed"),harnesses:yie,scope:el,userMessage:x.Literal(_3,v3,hie),auth:x.Struct({healthy:x.Boolean}),projectPath:x.optional(x.String),installations:x.NonEmptyArray(F3t),failures:x.optional(x.Array(N3t))}),JF=x.Union(P3t,L3t);class ob extends x.Class("InitErrorEnvelope")({schemaVersion:x.Literal(1),status:x.Literal("error"),code:x.String,message:x.String,recoverable:x.Boolean}){}var sf="expandai-cli-browser",U3t=x.Struct({apiOrigin:x.String,clientId:x.Literal(sf),purpose:x.optional(x.Literal("login","agent-setup")),harness:x.Literal("agent-harnesses"),scope:x.Literal("project","global"),canonicalScopeRoot:x.String});class tv extends x.Class("PendingInitRecord")({key:U3t,deviceCode:x.Redacted(x.String),userCode:x.String,verificationUri:x.String,intervalSeconds:x.Number,nextPollAt:x.DateTimeUtc,approvalExpiresAt:x.DateTimeUtc}){}class Nx extends x.TaggedError()("PendingInitCorrupt",{path:x.String,error:x.Defect}){recoverable=!0;get message(){return`Pending authorization state at ${this.path} is corrupt and was left unchanged.`}}class Sie extends x.TaggedError()("PendingInitStorageError",{path:x.String,error:x.Defect}){recoverable=!0;get message(){return`Could not access pending authorization state at ${this.path}.`}}class Eie extends x.Class("DeviceAuthorizationCreated")({deviceCode:x.Redacted(x.NonEmptyString),userCode:x.NonEmptyString,verificationUri:x.URL,expiresIn:x.Int.pipe(x.positive()),interval:x.Int.pipe(x.nonNegative())}){}var H3t=x.Struct({access_token:x.Redacted(x.NonEmptyString),refresh_token:x.Redacted(x.NonEmptyString),token_type:x.NonEmptyString,expires_in:x.Number.pipe(x.positive()),scope:x.optional(x.String)}),q3t=x.Literal("create","poll");class af extends x.TaggedError()("DeviceAuthorizationApiError",{operation:q3t,kind:x.Literal("request_failed","rejected","invalid_response"),status:x.optional(x.Number),recoverable:x.Boolean}){get message(){return this.kind==="rejected"?`Device authorization ${this.operation} was rejected. Restart authorization if the problem persists.`:`Device authorization ${this.operation} could not be completed safely. Try again.`}}class M3 extends m.Service()("@expandai/cli/Auth/DeviceAuthorizationClient",{dependencies:[dh.layer,Cr.Default],effect:m.gen(function*(){let e=yield*Gl.HttpClient,t=yield*Cr;function r(a,c,l){return new af({operation:a,kind:c,status:l,recoverable:c!=="invalid_response"})}let n=m.fn("DeviceAuthorizationClient.create")(function*(a){let c=yield*t.getApiUrl(),l=yield*Kn.post(new URL("/v1/cli-authorization/device",c)).pipe(Kn.bodyJson(a),m.mapError(()=>r("create","request_failed")));return yield*e.execute(l).pipe(m.flatMap((u)=>Q.value(u.status).pipe(Q.when((f)=>f>=200&&f<300,()=>si.schemaBodyJson(Eie)(u).pipe(m.mapError(()=>r("create","invalid_response")))),Q.orElse(()=>u.text.pipe(m.ignore,m.zipRight(r("create","rejected",u.status)))))),m.catchAll((u)=>u instanceof af?u:r("create","request_failed")))}),o=x.Struct({error:x.String,error_description:x.optional(x.String)}),s=new Set(["invalid_target","invalid_client","invalid_scope","unsupported_grant_type","unauthorized_client","invalid_request"]),i=m.fn("DeviceAuthorizationClient.poll")(function*(a){let c=yield*t.getApiUrl(),l=Kn.post(new URL("/api/auth/oauth2/token",c)).pipe(Kn.bodyUrlParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:da.value(a),client_id:sf,resource:c.toString()}));return yield*e.execute(l).pipe(m.flatMap(m.fnUntraced(function*(u){return yield*Q.value(u.status).pipe(Q.when((f)=>f>=200&&f<300,()=>si.schemaBodyJson(H3t)(u).pipe(m.mapError(()=>r("poll","invalid_response")),m.map((f)=>({_tag:"Tokens",token:f})))),Q.when((f)=>f>=500,()=>u.text.pipe(m.ignore,m.zipRight(r("poll","rejected",u.status)))),Q.orElse(()=>si.schemaBodyJson(o)(u).pipe(m.mapError(()=>r("poll","invalid_response")),m.map((f)=>Q.value(f.error).pipe(Q.when("authorization_pending",()=>({_tag:"Pending"})),Q.when("slow_down",()=>({_tag:"SlowDown"})),Q.when("access_denied",()=>({_tag:"Denied"})),Q.when("expired_token",()=>({_tag:"Expired"})),Q.orElse(()=>s.has(f.error)?{_tag:"Refused",error:f.error,...f.error_description===void 0?{}:{description:f.error_description}}:{_tag:"Invalid"}))))))})),m.catchAll((u)=>u instanceof af?u:r("poll","request_failed")))});return{create:n,poll:i}})}){}var ii="0.0.6";class A3e extends x.TaggedClass()("DeviceAuthorizationTokensSaved",{}){}class O3e extends x.TaggedClass()("DeviceAuthorizationPending",{}){}class _3e extends x.TaggedClass()("DeviceAuthorizationSlowDown",{}){}class v3e extends x.TaggedClass()("DeviceAuthorizationExpired",{}){}class T3e extends x.TaggedClass()("DeviceAuthorizationInvalid",{}){}class Id extends x.TaggedError()("DeviceAuthorizationDenied",{recoverable:x.Literal(!0)}){get message(){return"The authorization request was denied in the browser. Run the same command again to start a new one."}}class Lx extends x.TaggedError()("DeviceAuthorizationRefused",{error:x.String,description:x.optional(x.String),recoverable:x.Literal(!1)}){get message(){let e=this.description===void 0?"":` — ${this.description}`;return`Expand refused to complete this authorization: ${this.error}${e}. This is a server-side configuration problem, not something a new code can fix. Do not start authorization again; report this error.`}}class Ux extends x.TaggedError()("DeviceAuthorizationCredentialSaveFailed",{recoverable:x.Literal(!1)}){get message(){return"Authorization succeeded, but credentials could not be saved. Start authorization again."}}function I3e(e){return e.platform??process.platform}class uk extends m.Service()("@expandai/cli/Auth/DeviceAuthorization",{dependencies:[Cr.Default,M3.Default],effect:m.gen(function*(){let e=yield*Cr,t=yield*M3,r=m.fn("DeviceAuthorization.create")(function*(s){yield*e.ensureSecureStorage();let i={platform:I3e(s),machineLabel:`${I3e(s)}-${process.arch}`,cliVersion:ii};return yield*s.purpose==="login"?t.create({purpose:"login",harness:"agent-harnesses",scope:"global",...i}):t.create({purpose:"agent-setup",harness:s.harness,scope:s.scope,...i})}),n=m.fnUntraced(function*(s){let i=yield*ar.now,a=yield*m.either(e.updateConfig({authMethod:GF.make({accessToken:s.access_token,refreshToken:s.refresh_token,expiresAt:ar.addDuration(i,Gr.seconds(s.expires_in)),clientId:sf})}));return yield*mt.match(a,{onLeft:()=>new Ux({recoverable:!1}),onRight:()=>m.void})}),o=m.fn("DeviceAuthorization.poll")(function*(s){let i=yield*t.poll(s);return yield*Q.value(i).pipe(Q.tag("Tokens",({token:a})=>n(a).pipe(m.as(new A3e))),Q.tag("Pending",()=>m.succeed(new O3e)),Q.tag("SlowDown",()=>m.succeed(new _3e)),Q.tag("Denied",()=>new Id({recoverable:!0})),Q.tag("Expired",()=>m.succeed(new v3e)),Q.tag("Invalid",()=>m.succeed(new T3e)),Q.tag("Refused",({error:a,description:c})=>new Lx({error:a,...c===void 0?{}:{description:c},recoverable:!1})),Q.exhaustive)});return{create:r,poll:o}})}){}import{createHash as B3t}from"node:crypto";var bie=x.parseJson(tv),W3t=300000,R3e=x.parseJson(x.Union(x.Tuple(x.String,x.Literal(sf),x.Literal("agent-harnesses"),x.Literal("project","global"),x.String),x.Tuple(x.String,x.Literal(sf),x.Literal("login"))));function Cie(e,t){return typeof e==="object"&&e!==null&&"code"in e&&e.code===t}function z3t(e){return e instanceof Qc.SystemError&&(e.reason==="AlreadyExists"||Cie(e.cause,"EEXIST"))}function $3t(e){return e instanceof Qc.SystemError&&(e.reason==="NotFound"||Cie(e.cause,"ENOENT"))}function j3t(e){return e.purpose==="login"?x.encodeSync(R3e)([e.apiOrigin,e.clientId,e.purpose]):x.encodeSync(R3e)([e.apiOrigin,e.clientId,e.harness,e.scope,e.canonicalScopeRoot])}function M3e(e,t){let r=e.dirname(t);return r===t?[t]:[t,...M3e(e,r)]}class Hx extends m.Service()("@expandai/cli/Auth/PendingInitStore",{dependencies:[rb.layer],effect:m.gen(function*(){let e=yield*un.FileSystem,t=yield*So.Path,r=t.join(yield*S3,"expandai"),n=t.join(r,"pending-init"),o=(I,M)=>new Sie({path:I,error:M}),s=(I,M)=>M.pipe(m.mapError((B)=>o(I,B))),i=m.fnUntraced(function*(I){let M=yield*m.either(e.readLink(I));if(mt.isRight(M))return yield*o(I,Error("Symbolic links are not allowed for pending authorization"));let B=M.left;if(B instanceof Qc.SystemError&&(B.reason==="InvalidData"||B.reason==="NotFound"||B.method==="readLink"&&Cie(B.cause,"EINVAL")))return;return yield*o(I,B)}),a=m.fnUntraced(function*(){if(yield*i(r),yield*i(n),yield*s(n,e.makeDirectory(n,{recursive:!0,mode:448})),yield*i(r),yield*i(n),(yield*s(n,e.stat(n))).type!=="Directory")return yield*o(n,Error("Pending authorization path is not a directory"));if(process.platform!=="win32")yield*s(r,e.chmod(r,448)),yield*s(n,e.chmod(n,448))}),c=(I)=>{let M=B3t("sha256").update(j3t(I)).digest("hex");return t.join(n,`${M}.json`)},l=m.fnUntraced(function*(I,M){let B=yield*x.decode(bie)(M).pipe(m.mapError(()=>new Nx({path:I,error:Error("Stored pending authorization did not match the expected schema")})));if(c(B.key)!==I)return yield*new Nx({path:I,error:Error("Stored pending authorization key did not match its file")});return B}),u=m.fnUntraced(function*(I){if(yield*i(I),!(yield*s(I,e.exists(I))))return q.none();let B=yield*s(I,e.stat(I));if(B.type!=="File")return yield*o(I,Error("Pending state is not a regular file"));if(process.platform!=="win32"&&(B.mode&511)!==384)return yield*o(I,Error("Pending state file mode is not 600"));let ee=yield*s(I,e.readFileString(I));return q.some(yield*l(I,ee))}),f=(I)=>u(c(I)),h=m.fnUntraced(function*(I){let M=ar.toEpochMillis(yield*ar.now);return ar.toEpochMillis(I.approvalExpiresAt)+W3t<=M}),y=m.fnUntraced(function*(I){yield*a();let M=c(I.key),B=yield*x.encode(bie)(I).pipe(m.mapError((j)=>o(M,j))),ee=yield*m.either(m.scoped(m.gen(function*(){let j=yield*e.open(M,{flag:"wx",mode:384});yield*j.writeAll(new TextEncoder().encode(B)),yield*j.sync})));if(mt.isLeft(ee)){if(z3t(ee.left))return!1;return yield*e.remove(M).pipe(m.ignore),yield*o(M,ee.left)}if(process.platform!=="win32"){let j=yield*m.either(e.chmod(M,384));if(mt.isLeft(j))return yield*e.remove(M).pipe(m.ignore),yield*o(M,j.left)}return!0}),E=m.fn("PendingInitStore.replaceIfMatch")(function*(I,M){yield*a();let B=c(M.key);if(c(I.key)!==B)return yield*o(B,Error("Pending authorization replacement changed its key"));let ee=yield*u(B);if(q.isNone(ee)||ee.value.userCode!==I.userCode)return!1;let j=yield*x.encode(bie)(M).pipe(m.mapError((J)=>o(B,J))),ae=`${B}.${process.pid}.${Math.random().toString(36).slice(2,10)}.tmp`,F=yield*m.scoped(m.acquireRelease(m.succeed(ae),()=>e.remove(ae).pipe(m.ignore)).pipe(m.zipRight(m.gen(function*(){yield*i(ae),yield*m.scoped(m.gen(function*(){let J=yield*e.open(ae,{flag:"wx",mode:384});yield*J.writeAll(new TextEncoder().encode(j)),yield*J.sync})),yield*e.rename(ae,B)})))).pipe(m.either);if(mt.isLeft(F))return yield*o(B,F.left);return!0}),b=m.fnUntraced(function*(I){let M=c(I.key),B=yield*u(M);if(q.isNone(B)||B.value.userCode!==I.userCode)return!1;return yield*s(M,e.remove(M)),!0}),w=m.fn("PendingInitStore.get")(function*(I){let M=yield*f(I);if(q.isNone(M)||!(yield*h(M.value)))return M;return yield*b(M.value),q.none()}),T=m.fn("PendingInitStore.peek")(function*(I){return yield*f(I)}),A=m.fn("PendingInitStore.putIfAbsent")(function*(I){let M=yield*f(I.key);if(q.isSome(M)&&!(yield*h(M.value)))return M.value;if(q.isSome(M))yield*b(M.value);if(yield*y(I))return I;let B=yield*f(I.key);return yield*q.match(B,{onNone:()=>o(c(I.key),Error("Pending record creation lost without a winner")),onSome:m.succeed})}),k=m.fn("PendingInitStore.removeIfMatch")((I)=>b(I)),O=m.fn("PendingInitStore.removeCorrupt")(function*(I){let M=c(I),B=yield*m.either(u(M));if(mt.isRight(B))return!1;if(!(B.left instanceof Nx))return yield*B.left;let ee=yield*m.either(e.remove(M));if(mt.isLeft(ee)&&$3t(ee.left))return!1;if(mt.isLeft(ee))return yield*o(M,ee.left);return!0}),P=m.fn("PendingInitStore.pruneExpired")(function*(){if(yield*i(n),!(yield*s(n,e.exists(n))))return 0;let M=yield*s(n,e.readDirectory(n));return(yield*m.forEach(M.filter((ee)=>ee.endsWith(".json")),(ee)=>m.gen(function*(){let j=yield*u(t.join(n,ee));if(q.isNone(j)||!(yield*h(j.value)))return 0;return(yield*b(j.value))?1:0}).pipe(m.orElseSucceed(()=>0)))).reduce((ee,j)=>ee+j,0)}),D=m.fn("PendingInitStore.canonicalScopeRoot")(function*(I,M=process.cwd()){if(I==="global")return"global";let B=yield*s(M,e.realPath(M)),j=(yield*m.forEach(M3e(t,B),(ae)=>s(ae,e.exists(t.join(ae,".git"))).pipe(m.map((F)=>({candidate:ae,exists:F}))))).find(({exists:ae})=>ae)?.candidate;return j===void 0?B:yield*s(j,e.realPath(j))});return{pendingPath:n,get:w,peek:T,putIfAbsent:A,replaceIfMatch:E,removeIfMatch:k,removeCorrupt:O,pruneExpired:P,canonicalScopeRoot:D}})}){}var V3t=sf,G3t=5;class QF extends x.Class("ManualAuthorizationInput")({purpose:x.optionalWith(x.Literal("login","agent-setup"),{default:()=>"agent-setup"}),harness:x.Literal("agent-harnesses"),scope:el,cwd:x.optional(x.String),platform:x.optional(x.String)}){}class wie extends x.Class("ManualAuthorizationRequired")({verificationUri:x.String,userCode:x.NonEmptyString,approvalExpiresAt:x.DateTimeUtc}){}class kie extends x.TaggedClass()("TokensSaved",{}){}class sb extends x.TaggedClass()("AuthorizationPending",{pending:wie}){}var fCr=x.Union(kie,sb);function rv(e){return new wie({verificationUri:e.verificationUri,userCode:e.userCode,approvalExpiresAt:e.approvalExpiresAt})}class cf extends m.Service()("@expandai/cli/Auth/ManualAuthorization",{dependencies:[Cr.Default,Hx.Default,uk.Default],effect:m.gen(function*(){let e=yield*Cr,t=yield*Hx,r=yield*uk,n=m.fnUntraced(function*(l){yield*e.ensureSecureStorage(),yield*t.pruneExpired();let u=yield*e.getApiUrl(),f=yield*t.canonicalScopeRoot(l.scope,l.cwd);return{apiOrigin:u.origin,clientId:V3t,purpose:l.purpose,harness:l.harness,scope:l.scope,canonicalScopeRoot:f}}),o=m.fnUntraced(function*(l,u){let f=l.platform===void 0?{}:{platform:l.platform},h=yield*r.create(l.purpose==="login"?{purpose:"login",...f}:{purpose:"agent-setup",harness:l.harness,scope:l.scope,...f}),y=yield*ar.now,E=new tv({key:u,deviceCode:h.deviceCode,userCode:h.userCode,verificationUri:h.verificationUri.toString(),intervalSeconds:h.interval,nextPollAt:ar.addDuration(y,Gr.seconds(h.interval)),approvalExpiresAt:ar.addDuration(y,Gr.seconds(h.expiresIn))}),b=yield*m.either(t.putIfAbsent(E));if(mt.isLeft(b))return yield*b.left;return b.right}),s=m.fnUntraced(function*(l,u){let f=yield*ar.now,h=l.intervalSeconds+(u?G3t:0),y=new tv({...l,intervalSeconds:h,nextPollAt:ar.addDuration(f,Gr.seconds(h))}),E=yield*m.either(t.replaceIfMatch(l,y));if(mt.isLeft(E))return l;return E.right?y:l}),i=m.fnUntraced(function*(l,u){let f=yield*m.either(t.get(u));if(mt.isRight(f))return f.right;if(l.purpose!=="login"||!(f.left instanceof Nx))return yield*f.left;return yield*t.removeCorrupt(u),yield*t.get(u)}),a=m.fn("ManualAuthorization.advance")(function*(l){let u=yield*n(l),f=yield*i(l,u);if(q.isNone(f)){let w=yield*o(l,u);return new sb({pending:rv(w)})}let h=f.value,y=yield*ar.now;if(ar.greaterThan(y,h.approvalExpiresAt)){yield*t.removeIfMatch(h);let w=yield*o(l,u);return new sb({pending:rv(w)})}if(ar.lessThan(y,h.nextPollAt))return new sb({pending:rv(h)});let E=yield*m.either(r.poll(h.deviceCode)),b=m.fnUntraced(function*(){yield*t.removeIfMatch(h);let w=yield*o(l,u);return new sb({pending:rv(w)})});return yield*mt.match(E,{onLeft:(w)=>t.removeIfMatch(h).pipe(m.when(()=>w instanceof Id),m.zipRight(m.fail(w))),onRight:(w)=>Q.value(w).pipe(Q.tag("DeviceAuthorizationTokensSaved",()=>t.removeIfMatch(h).pipe(m.as(new kie))),Q.tag("DeviceAuthorizationPending",()=>s(h,!1).pipe(m.map((T)=>new sb({pending:rv(T)})))),Q.tag("DeviceAuthorizationSlowDown",()=>s(h,!0).pipe(m.map((T)=>new sb({pending:rv(T)})))),Q.tag("DeviceAuthorizationExpired",b),Q.tag("DeviceAuthorizationInvalid",b),Q.exhaustive)})}),c=m.fn("ManualAuthorization.redeemPreApproved")(function*(l){let u=yield*r.poll(l);function f(){return new af({operation:"poll",kind:"rejected",status:400,recoverable:!1})}return yield*Q.value(u).pipe(Q.tag("DeviceAuthorizationTokensSaved",()=>m.void),Q.tag("DeviceAuthorizationPending",f),Q.tag("DeviceAuthorizationSlowDown",f),Q.tag("DeviceAuthorizationExpired",f),Q.tag("DeviceAuthorizationInvalid",f),Q.exhaustive)});return{advance:a,redeemPreApproved:c}})}){}var P3e="Authorization complete. Expand is ready to use; retry the command that required authentication.",K3t=x.Literal("authorization_internal_error","authorization_unreachable","authorization_rejected","authorization_service_unavailable","authorization_invalid_response","authorization_denied","authorization_refused","credential_save_failed","credential_storage_insecure");class Kl extends x.TaggedError()("DeviceLoginError",{code:K3t,recoverable:x.Boolean,httpStatus:x.optional(x.Number)}){get message(){switch(this.code){case"authorization_internal_error":return"Authorization failed for an unexpected internal reason. Do not retry in a loop; report this error.";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 until the connection is fixed; then run the same command again.";case"authorization_rejected":return"The Expand API rejected the device authorization request. Retry later; if this persists, the CLI and API versions may be incompatible.";case"authorization_service_unavailable":return`The Expand device authorization service is unavailable${this.httpStatus===void 0?"":` (HTTP ${this.httpStatus})`}. Retry later or use the staging API for an isolated test.`;case"authorization_invalid_response":return"The Expand API returned an invalid device authorization response. Do not continue with a URL or code from this response; update the CLI or report the problem.";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"authorization_refused":return"Expand refused to complete the authorization for a reason a new code cannot fix. Do not start another authorization; report the error.";case"credential_save_failed":return"Authorization completed, but credentials could not be saved. Fix credential storage before starting again.";case"credential_storage_insecure":return"Credential storage is not secure enough to continue."}}}class D3 extends x.Class("DeviceLoginErrorEnvelope")({schemaVersion:x.Literal(1),status:x.Literal("error"),code:x.String,message:x.String,recoverable:x.Boolean}){}var J3t=x.Struct({schemaVersion:x.Literal(1),status:x.Literal("authorization_required"),userMessage:x.Literal(lk),authorization:x.Struct({url:x.URL,userCode:x.NonEmptyString,approvalExpiresAt:x.DateTimeUtc})}),Q3t=x.Struct({schemaVersion:x.Literal(1),status:x.Literal("completed"),userMessage:x.Literal(P3e),auth:x.Struct({healthy:x.Literal(!0)})}),P3=x.Union(J3t,Q3t);function Y3t(e){if(e instanceof kd)return new Kl({code:"credential_storage_insecure",recoverable:!1});if(e instanceof Id)return new Kl({code:"authorization_denied",recoverable:!0});if(e instanceof Lx)return new Kl({code:"authorization_refused",recoverable:!1});if(e instanceof Ux)return new Kl({code:"credential_save_failed",recoverable:!1});if(e instanceof af)switch(e.kind){case"request_failed":return new Kl({code:"authorization_unreachable",recoverable:!0});case"rejected":if(e.status!==void 0&&e.status>=500)return new Kl({code:"authorization_service_unavailable",recoverable:!0,httpStatus:e.status});return new Kl({code:"authorization_rejected",recoverable:e.recoverable});case"invalid_response":return new Kl({code:"authorization_invalid_response",recoverable:!1})}return new Kl({code:"authorization_internal_error",recoverable:!1})}class YF extends m.Service()("@expandai/cli/Auth/DeviceLogin",{dependencies:[cf.Default],effect:m.gen(function*(){let e=yield*cf;return{run:m.fn("DeviceLogin.run")(function*(){let r=yield*e.advance(new QF({purpose:"login",harness:"agent-harnesses",scope:"global"})).pipe(m.mapError(Y3t));return yield*Q.value(r).pipe(Q.tag("TokensSaved",()=>x.decodeUnknown(P3)({schemaVersion:1,status:"completed",userMessage:P3e,auth:{healthy:!0}}).pipe(m.mapError(()=>new Kl({code:"authorization_internal_error",recoverable:!1})))),Q.tag("AuthorizationPending",({pending:n})=>x.decodeUnknown(P3)({schemaVersion:1,status:"authorization_required",userMessage:lk,authorization:{url:n.verificationUri,userCode:n.userCode,approvalExpiresAt:ar.formatIso(n.approvalExpiresAt)}}).pipe(m.mapError(()=>new Kl({code:"authorization_internal_error",recoverable:!1})))),Q.exhaustive)})}})}){}class F3 extends x.TaggedError()("SetupGrantAuthorizationError",{code:x.Literal("invalid_or_expired","stored_credential_conflict","request_failed","denied","credential_save_failed","refused","config_unreadable"),recoverable:x.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 pk(e){return new F3({code:e,recoverable:e!=="denied"&&e!=="credential_save_failed"&&e!=="refused"})}class nv extends m.Service()("@expandai/cli/Auth/SetupGrantAuthorization",{dependencies:[Cr.Default,cf.Default],effect:m.gen(function*(){let e=yield*Cr,t=yield*cf;return{authorize:m.fn("SetupGrantAuthorization.authorize")(function*(n){let o=yield*e.readConfigFile();if(o.parseFailed)return yield*pk("config_unreadable");if(o.config.authMethod?._tag==="ApiKey")return yield*pk("stored_credential_conflict");yield*m.annotateCurrentSpan({harness:n.harness,scope:n.scope}),yield*t.redeemPreApproved(n.setupToken).pipe(m.mapError((s)=>{if(s instanceof Id)return pk("denied");if(s instanceof Ux)return pk("credential_save_failed");if(s instanceof Lx)return pk("refused");if(s instanceof af&&s.kind==="request_failed")return pk("request_failed");return pk("invalid_or_expired")}))})}})}){}import Lie from"node:process";import Hie from"node:path";import{fileURLToPath as NGt}from"node:url";import LGt from"node:child_process";import UGt,{constants as HGt}from"node:fs/promises";import aGt from"node:path";import{promisify as cGt}from"node:util";import lGt from"node:child_process";import Tie,{constants as q3e}from"node:fs/promises";import N3e from"node:process";import rGt from"node:os";import _ie from"node:fs";import eGt from"node:fs";import D3e from"node:fs";var Iie;function Z3t(){try{return D3e.statSync("/.dockerenv"),!0}catch{return!1}}function X3t(){try{return D3e.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Aie(){if(Iie===void 0)Iie=Z3t()||X3t();return Iie}var Oie,tGt=()=>{try{return eGt.statSync("/run/.containerenv"),!0}catch{return!1}};function fk(){if(Oie===void 0)Oie=tGt()||Aie();return Oie}var F3e=()=>{if(N3e.platform!=="linux")return!1;if(rGt.release().toLowerCase().includes("microsoft")){if(fk())return!1;return!0}try{if(_ie.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft"))return!fk()}catch{}if(_ie.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")||_ie.existsSync("/run/WSL"))return!fk();return!1},mh=N3e.env.__IS_WSL_TEST__?F3e:F3e();import L3e from"node:process";import{Buffer as nGt}from"node:buffer";import{promisify as oGt}from"node:util";import sGt from"node:child_process";var iGt=oGt(sGt.execFile),vie=()=>`${L3e.env.SYSTEMROOT||L3e.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;var dk=async(e,t={})=>{let{powerShellPath:r,...n}=t,o=dk.encodeCommand(e);return iGt(r??vie(),[...dk.argumentsPrefix,o],{encoding:"utf8",...n})};dk.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];dk.encodeCommand=(e)=>nGt.from(e,"utf16le").toString("base64");dk.escapeArgument=(e)=>`'${String(e).replaceAll("'","''")}'`;function U3e(e){for(let t of e.split(`
|
|
292
|
+
`)){if(/^\s*#/.test(t))continue;let r=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(t);if(!r)continue;return r.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}var uGt=cGt(lGt.execFile),pGt=(()=>{let t;return async function(){if(t)return t;let r="/etc/wsl.conf",n=!1;try{await Tie.access(r,q3e.F_OK),n=!0}catch{}if(!n)return"/mnt/";let o=await Tie.readFile(r,{encoding:"utf8"}),s=U3e(o);if(s===void 0)return"/mnt/";return t=s,t=t.endsWith("/")?t:`${t}/`,t}})(),fGt=async()=>`${await pGt()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,N3=mh?fGt:vie,H3e,B3e=async()=>(H3e??=(async()=>{try{let e=await N3();return await Tie.access(e,q3e.X_OK),!0}catch{return!1}})(),H3e),W3e=async()=>{let e=await N3(),t=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:r}=await dk(t,{powerShellPath:e,cwd:aGt.dirname(e)});return r.trim()},dGt=(e)=>/^[a-z]+:\/\//i.test(e),z3e=async(e)=>{let t=Array.isArray(e),r=t?e:[e],n=[],o=[];for(let[i,a]of r.entries())if(!dGt(a))n.push(i),o.push(a);let s=[...r];if(o.length>0)try{let{stdout:i}=await uGt("wslpath",["-aw",...o],{encoding:"utf8"}),a=i.split(/\r?\n/).filter(Boolean);for(let[c,l]of n.entries())s[l]=a[c]??r[l]}catch{}return t?s:s[0]};import $3e from"node:process";import{Buffer as mGt}from"node:buffer";import{promisify as hGt}from"node:util";import gGt from"node:child_process";var xGt=hGt(gGt.execFile),yGt=()=>`${$3e.env.SYSTEMROOT||$3e.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;var j3e=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"],V3e=(e)=>mGt.from(e,"utf16le").toString("base64"),SGt=(e)=>`'${String(e).replaceAll("'","''")}'`,G3e=(e)=>[...j3e,V3e(e)],hh=async(e,t={})=>{let{powerShellPath:r,...n}=t;return xGt(r??yGt(),G3e(e),{encoding:"utf8",...n})};hh.argumentsPrefix=j3e;hh.encodeCommand=V3e;hh.escapeArgument=SGt;hh.createArguments=G3e;function mk(e,t,r){let n=(o)=>Object.defineProperty(e,t,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let o=r();return n(o),o},set(o){n(o)}}),e}import{promisify as RGt}from"node:util";import Die from"node:process";import{execFile as MGt}from"node:child_process";import{promisify as EGt}from"node:util";import bGt from"node:process";import{execFile as CGt}from"node:child_process";var wGt=EGt(CGt);async function Rie(){if(bGt.platform!=="darwin")throw Error("macOS only");let{stdout:e}=await wGt("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??"com.apple.Safari";if(r==="com.apple.safari")return"com.apple.Safari";return r}import kGt from"node:process";import{promisify as IGt}from"node:util";import{execFile as AGt,execFileSync as fwr}from"node:child_process";var OGt=IGt(AGt);async function K3e(e,{humanReadableOutput:t=!0,signal:r}={}){if(kGt.platform!=="darwin")throw Error("macOS only");let n=t?[]:["-ss"],o={};if(r)o.signal=r;let{stdout:s}=await OGt("osascript",["-e",e,n],o);return s.trim()}async function Mie(e){return K3e(`tell application "Finder" to set app_path to application file id "${e}" 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 J3e from"node:process";import{promisify as _Gt}from"node:util";import{execFile as vGt}from"node:child_process";var TGt=_Gt(vGt),L3={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"}},U3=new Map(Object.entries(L3));class Q3e extends Error{}async function Pie(e=TGt){let t=`${J3e.env.SYSTEMROOT??J3e.env.windir??"C:\\Windows"}\\System32\\reg.exe`,{stdout:r}=await e(t,["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(r);if(!n)throw new Q3e(`Cannot find Windows browser in stdout: ${JSON.stringify(r)}`);let{id:o}=n.groups,s=o.lastIndexOf("."),i=o.lastIndexOf("-"),a=s===-1?void 0:o.slice(0,s),c=i===-1?void 0:o.slice(0,i);return L3[o]??L3[a]??L3[c]??{name:o,id:o}}var PGt=RGt(MGt),DGt=(e)=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,(t)=>t.toUpperCase());async function Fie(){if(Die.platform==="darwin"){let e=await Rie();return{name:await Mie(e),id:e}}if(Die.platform==="linux"){let{stdout:e}=await PGt("xdg-mime",["query","default","x-scheme-handler/http"]),t=e.trim();return{name:DGt(t.replace(/.desktop$/,"").replace("-"," ")),id:t}}if(Die.platform==="win32")return Pie();throw Error("Only macOS, Linux, and Windows are supported")}import Nie from"node:process";var FGt=Boolean(Nie.env.SSH_CONNECTION||Nie.env.SSH_CLIENT||Nie.env.SSH_TTY),Y3e=FGt;var H3=Symbol("fallbackAttempt"),Uie=import.meta.url?Hie.dirname(NGt(import.meta.url)):"",Z3e=Hie.join(Uie,"xdg-open"),{platform:ov,arch:X3e}=Lie,eGe=async(e,t)=>{if(e.length===0)return;let r=[];for(let n of e)try{return await t(n)}catch(o){r.push(o)}throw AggregateError(r,"Failed to open in all supported apps")},q3=async(e)=>{e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e};let t=e[H3]===!0;if(delete e[H3],Array.isArray(e.app))return eGe(e.app,(l)=>q3({...e,app:l,[H3]:!0}));let{name:r,arguments:n=[]}=e.app??{};if(n=[...n],Array.isArray(r))return eGe(r,(l)=>q3({...e,app:{name:l,arguments:n},[H3]:!0}));if(r==="browser"||r==="browserPrivate"){let l={"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"},u={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},f;if(mh){let h=await W3e();f=U3.get(h)??{}}else f=await Fie();if(f.id in l){let h=l[f.id.toLowerCase()];if(r==="browserPrivate"){if(h==="safari")throw Error("Safari doesn't support opening in private mode via command line");n.push(u[h])}return q3({...e,app:{name:sv[h],arguments:n}})}throw Error(`${f.name} is not supported as a default browser`)}let o,s=[],i={},a=!1;if(mh&&!fk()&&!Y3e&&!r)a=await B3e();if(ov==="darwin"){if(o="open",e.wait)s.push("--wait-apps");if(e.background)s.push("--background");if(e.newInstance)s.push("--new");if(r)s.push("-a",r)}else if(ov==="win32"||a){if(o=await N3(),s.push(...hh.argumentsPrefix),!mh)i.windowsVerbatimArguments=!0;if(mh&&e.target)e.target=await z3e(e.target);let l=["$ProgressPreference = 'SilentlyContinue';","Start"];if(e.wait)l.push("-Wait");if(r){if(l.push(hh.escapeArgument(r)),e.target)n.push(e.target)}else if(e.target)l.push(hh.escapeArgument(e.target));if(n.length>0)n=n.map((u)=>hh.escapeArgument(u)),l.push("-ArgumentList",n.join(","));if(e.target=hh.encodeCommand(l.join(" ")),!e.wait)i.stdio="ignore";if(mh)i.cwd=Hie.dirname(o)}else{if(r)o=r;else{let l=!Uie||Uie==="/",u=!1;try{await UGt.access(Z3e,HGt.X_OK),u=!0}catch{}o=Lie.versions.electron??(ov==="android"||l||!u)?"xdg-open":Z3e}if(n.length>0)s.push(...n);if(!e.wait)i.stdio="ignore",i.detached=!0}if(ov==="darwin"&&n.length>0)s.push("--args",...n);if(e.target)s.push(e.target);let c=LGt.spawn(o,s,i);if(e.wait)return new Promise((l,u)=>{c.once("error",u),c.once("close",(f)=>{if(!e.allowNonzeroExitCode&&f!==0){u(Error(`Exited with code ${f}`));return}l(c)})});if(t)return new Promise((l,u)=>{c.once("error",u),c.once("spawn",()=>{c.once("close",(f)=>{if(c.off("error",u),f!==0){u(Error(`Exited with code ${f}`));return}c.unref(),l(c)})})});return c.unref(),new Promise((l,u)=>{c.once("error",u),c.once("spawn",()=>{c.off("error",u),l(c)})})},qGt=(e,t)=>{if(typeof e!=="string")throw TypeError("Expected a `target`");return q3({...t,target:e})};function tGe(e){if(typeof e==="string"||Array.isArray(e))return e;let{[X3e]:t}=e;if(!t)throw Error(`${X3e} is not supported`);return t}function ZF({[ov]:e},{wsl:t}={}){if(t&&mh)return tGe(t);if(!e)throw Error(`${ov} is not supported`);return tGe(e)}var sv={browser:"browser",browserPrivate:"browserPrivate"};mk(sv,"chrome",()=>ZF({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"]}}));mk(sv,"brave",()=>ZF({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"]}}));mk(sv,"firefox",()=>ZF({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));mk(sv,"edge",()=>ZF({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));mk(sv,"safari",()=>ZF({darwin:"Safari"}));var rGe=qGt;var BGt=5;class oGe extends x.Class("DeviceLoginPrompt")({userCode:x.NonEmptyString,verificationUri:x.URL,expiresIn:x.Int.pipe(x.positive())}){}class sGe extends x.TaggedError()("InteractiveDeviceLoginExpired",{}){get message(){return"Browser authorization expired. Run `expandai login` to start a new request."}}class iGe extends x.TaggedError()("InteractiveDeviceLoginInvalid",{}){get message(){return"Browser authorization is no longer valid. Run `expandai login` to start a new request."}}function nGe(e){return e}class B3 extends m.Service()("@expandai/cli/Auth/InteractiveDeviceLogin",{dependencies:[uk.Default],effect:m.gen(function*(){let e=yield*uk;return{login:m.fn("InteractiveDeviceLogin.login")(function*(r){let n=yield*e.create({purpose:"login"});yield*r(new oGe({userCode:n.userCode,verificationUri:n.verificationUri,expiresIn:n.expiresIn}));let o={intervalSeconds:n.interval,done:!1};yield*m.iterate(o,{while:({done:s})=>!s,body:({intervalSeconds:s})=>m.sleep(Gr.seconds(s)).pipe(m.zipRight(e.poll(n.deviceCode)),m.flatMap((i)=>Q.value(i).pipe(Q.tag("DeviceAuthorizationTokensSaved",()=>m.succeed({intervalSeconds:s,done:!0})),Q.tag("DeviceAuthorizationPending",()=>m.succeed({intervalSeconds:s,done:!1})),Q.tag("DeviceAuthorizationSlowDown",()=>m.succeed({intervalSeconds:s+BGt,done:!1})),Q.tag("DeviceAuthorizationExpired",()=>nGe(new sGe)),Q.tag("DeviceAuthorizationInvalid",()=>nGe(new iGe)),Q.exhaustive)))})})}})}){}import{homedir as $Gt}from"node:os";var aGe=new URL("../",import.meta.url),iv=new URL("skills/expandai/",aGe),cGe=new URL("assets/opencode/expandai-webfetch.js",aGe);class gh extends x.TaggedError()("McpParseError",{path:x.String,error:x.Defect}){get message(){return`Failed to parse MCP config at ${this.path}: ${kr.format(this.error)}`}}class Ad extends x.TaggedError()("McpWriteError",{path:x.String,error:x.Defect}){get message(){return`Failed to write MCP config at ${this.path}: ${kr.format(this.error)}`}}var z3=x.Literal("claude-code","cursor","opencode","codex"),pGe=x.Literal(...z3.literals,"unknown"),qie=x.Literal("project","global"),W3=x.Record({key:x.String,value:x.Unknown}),qx=x.parseJson(x.Struct({mcpServers:x.optionalWith(W3,{default:()=>({})})},W3),{space:2}),Bie=x.parseJson(x.Struct({mcp:x.optionalWith(W3,{default:()=>({})})},W3),{space:2}),co="expandai",XF={command:"expandai",args:[]},WGt={command:"npx",args:["-y","expandai"]};var lGe=m.gen(function*(){let e=yield*un.FileSystem,t=yield*So.Path,r=yield*Ae.string("PATH").pipe(Ae.withDefault(""));return{resolve:m.fn("CliInvocation.resolve")(function*(){return(yield*m.exists(ct.filter(r.split(":"),Sn.isNonEmpty),(s)=>e.exists(t.join(s,"expandai")).pipe(m.orElseSucceed(()=>!1))))?XF:WGt})}});class tl extends m.Service()("@expandai/cli/Install/CliInvocation",{dependencies:[xa.layer,Ac.layer],effect:lGe}){static layer=Tt.effect(tl,lGe.pipe(m.map(tl.make)))}var zGt=m.fn(function*(e){let t=yield*un.FileSystem;if(!(yield*t.exists(e)))return"{}";return yield*t.readFileString(e)}),uGe=m.fn(function*(e,t){let r=yield*un.FileSystem,n=yield*So.Path;yield*r.makeDirectory(n.dirname(e),{recursive:!0}),yield*r.writeFileString(e,`${t}
|
|
294
|
+
`)});class rl extends m.Service()("@expandai/cli/Install/ConfigIo",{dependencies:[xa.layer,Ac.layer],effect:m.gen(function*(){let e=yield*un.FileSystem,t=yield*So.Path,r=m.fn("ConfigIo.read")(function*(a,c){let l=yield*zGt(a).pipe(m.provideService(un.FileSystem,e));return yield*x.decode(c)(l)}),n=m.fn("ConfigIo.write")(function*(a,c,l){let u=yield*x.encodeUnknown(l)(c);yield*uGe(a,u).pipe(m.provideService(un.FileSystem,e),m.provideService(So.Path,t))}),o=m.fn("ConfigIo.exists")(function*(a){return yield*e.exists(a)}),s=m.fn("ConfigIo.readText")(function*(a){return(yield*e.exists(a))?yield*e.readFileString(a):""}),i=m.fn("ConfigIo.writeText")(function*(a,c){yield*uGe(a,c).pipe(m.provideService(un.FileSystem,e),m.provideService(So.Path,t))});return{read:r,write:n,exists:o,readText:s,writeText:i}})}){}class xh extends m.Service()("@expandai/cli/Install/SkillIo",{dependencies:[xa.layer,Ac.layer],effect:m.gen(function*(){let e=yield*un.FileSystem,t=yield*So.Path,r=yield*t.fromFileUrl(iv),n=m.fn("SkillIo.install")(function*(i){return yield*e.makeDirectory(t.dirname(i),{recursive:!0}),yield*e.copy(r,i,{overwrite:!0}),i}),o=m.fn("SkillIo.uninstall")(function*(i){if(yield*e.exists(i))yield*e.remove(i,{recursive:!0});return i}),s=m.fn("SkillIo.isCurrent")(function*(i){let a=t.join(i,"SKILL.md");if(!(yield*e.exists(a)))return!1;let[c,l]=yield*m.all([e.readFileString(a),e.readFileString(t.join(r,"SKILL.md"))]);return c===l});return{install:n,uninstall:o,isCurrent:s}})}){}var jGt=x.Struct({type:x.Literal("command"),command:x.String,expandaiProfileVersion:x.optional(x.String),expandaiManagedDeny:x.optional(x.Boolean)},x.Record({key:x.String,value:x.Unknown})),VGt=x.Struct({matcher:x.optional(x.String),hooks:x.Array(jGt)},x.Record({key:x.String,value:x.Unknown})),GGt=x.Struct({PreToolUse:x.optional(x.Array(VGt))},x.Record({key:x.String,value:x.Unknown})),KGt=x.Struct({deny:x.optional(x.Array(x.String))},x.Record({key:x.String,value:x.Unknown})),fGe=x.parseJson(x.Struct({hooks:x.optionalWith(GGt,{default:()=>({})}),permissions:x.optional(KGt)},x.Record({key:x.String,value:x.Unknown})),{space:2});class $3 extends m.Service()("@expandai/cli/Install/Claude/Hook",{dependencies:[rl.Default],effect:m.gen(function*(){let e=yield*Ae.string("HOME").pipe(Ae.withDefault($Gt())),t=yield*Ae.string("PWD").pipe(Ae.withDefault(process.cwd())),r=m.fn(function*(i){return yield*Q.value(i).pipe(Q.when("global",()=>m.succeed(`${e}/.claude/settings.json`)),Q.when("project",()=>m.succeed(`${t}/.claude/settings.json`)),Q.exhaustive)}),n="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.",o=m.fn("ClaudeHook.install")(function*(i){yield*ft.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.")}),s=m.fn("ClaudeHook.uninstall")(function*(i){yield*ft.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:o,uninstall:s,pathFor:r}})}){}import{homedir as JGt}from"node:os";class mGe extends x.Class("ClaudeMcpEntry")({type:x.Literal("stdio"),command:x.NonEmptyTrimmedString,args:x.Array(x.String),env:x.optional(x.Record({key:x.String,value:x.String}))}){}var QGt=["mcp","run"];function hGe(e=XF){return new mGe({type:"stdio",command:e.command,args:[...e.args,...QGt],env:{EXPANDAI_HARNESS:"claude-code"}})}var skr=hGe();function dGe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function YGt(e,t){if(!dGe(e))return!1;let{args:r,env:n}=e;return e.type===t.type&&e.command===t.command&&Array.isArray(r)&&r.length===t.args.length&&r.every((o,s)=>o===t.args[s])&&dGe(n)&&n.EXPANDAI_HARNESS==="claude-code"}function j3(e,t=XF){let r=hGe(t);if(YGt(e.mcpServers[co],r))return{changed:!1,config:e};return{changed:!0,config:{...e,mcpServers:{...e.mcpServers,[co]:r}}}}function ZGt(e){if(!(co in e.mcpServers))return{changed:!1,config:e};return{changed:!0,config:{...e,mcpServers:fl.remove(e.mcpServers,co)}}}class V3 extends m.Service()("@expandai/cli/Install/Claude/Mcp",{dependencies:[rl.Default],effect:m.gen(function*(){let e=yield*rl,t=yield*Ae.string("HOME").pipe(Ae.withDefault(JGt())),r=yield*Ae.string("PWD").pipe(Ae.withDefault(process.cwd())),n=m.fn(function*(l){return yield*Q.value(l).pipe(Q.when("global",()=>m.succeed(`${t}/.claude.json`)),Q.when("project",()=>m.succeed(`${r}/.mcp.json`)),Q.exhaustive)}),o=m.fn(function*(l){return yield*e.read(l,qx).pipe(m.mapError((u)=>new gh({path:l,error:u})))}),s=m.fn(function*(l,u){yield*e.write(l,u,qx).pipe(m.mapError((f)=>new Ad({path:l,error:f})))}),i=m.fn(function*(l){let u=yield*n(l),f=j3(yield*o(u));if(f.changed)yield*s(u,f.config);yield*ft.log(`Installed expandai MCP server into ${u}`)}),a=m.fn(function*(l){let u=yield*n(l),f=ZGt(yield*o(u));if(!f.changed)return;yield*s(u,f.config),yield*ft.log(`Removed expandai MCP server from ${u}`)}),c=m.fn(function*(l){let u=yield*n(l);return co in(yield*o(u)).mcpServers});return{install:i,uninstall:a,isInstalled:c,pathFor:n}})}){}import{homedir as fKt}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 XGt=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class ib extends Date{#t=!1;#r=!1;#e=null;constructor(e){let t=!0,r=!0,n="Z";if(typeof e==="string"){let o=e.match(XGt);if(o){if(!o[1])t=!1,e=`0000-01-01T${e}`;if(r=!!o[2],r&&e[10]===" "&&(e=e.replace(" ","T")),o[2]&&+o[2]>23)e="";else if(n=o[3]||null,e=e.toUpperCase(),!n&&r)e+="Z"}else e=""}super(e);if(!isNaN(this.getTime()))this.#t=t,this.#r=r,this.#e=n}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z")return e;let t=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return t=this.#e[0]==="-"?t:-t,new Date(this.getTime()-t*60000).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,t="Z"){let r=new ib(e);return r.#e=t,r}static wrapAsLocalDateTime(e){let t=new ib(e);return t.#e=null,t}static wrapAsLocalDate(e){let t=new ib(e);return t.#r=!1,t.#e=null,t}static wrapAsLocalTime(e){let t=new ib(e);return t.#t=!1,t.#e=null,t}}/*!
|
|
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 eKt(e,t){let r=e.slice(0,t).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function tKt(e,t,r){let n=e.split(/\r\n|\n|\r/g),o="",s=(Math.log10(t+1)|0)+1;for(let i=t-1;i<=t+1;i++){let a=n[i-1];if(!a)continue;if(o+=i.toString().padEnd(s," "),o+=": ",o+=a,o+=`
|
|
347
|
+
`,i===t)o+=" ".repeat(s+r+2),o+=`^
|
|
348
|
+
`}return o}class Ur extends Error{line;column;codeblock;constructor(e,t){let[r,n]=eKt(t.toml,t.ptr),o=tKt(t.toml,r,n);super(`Invalid TOML document: ${e}
|
|
349
|
+
|
|
350
|
+
${o}`,t);this.line=r,this.column=n,this.codeblock=o}}/*!
|
|
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
|
+
*/function Wie(e,t=0){let r=e.indexOf(`
|
|
377
|
+
`,t);if(e.charCodeAt(r-1)===13)r--;return r}function G3(e){for(;e.p<e.s.length;e.p++){let t=e.s.charCodeAt(e.p);if(t===10)break;if(t===13&&e.s.charCodeAt(e.p+1)===10){e.p++;break}if(t<32&&t!==9||t===127)throw new Ur("control characters are not allowed in comments",{toml:e.s,ptr:e.p})}}function yh(e,t,r){let n;while(!0){while((n=e.s.charCodeAt(e.p))===32||n===9||!t&&(n===10||n===13&&e.s.charCodeAt(e.p+1)===10))e.p++;if(r||n!==35)break;G3(e)}}function gGe(e,t,r){let n=e.p;if(!r){n=Wie(e.s,n),e.p=n<0?e.s.length:n;return}for(;e.p<e.s.length;e.p++){let o=e.s.charCodeAt(e.p);if(o===35)G3(e);else if(o===r||o===t)return}throw new Ur("cannot find end of structure",{toml:e.s,ptr:n})}/*!
|
|
378
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
379
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
380
|
+
*
|
|
381
|
+
* Redistribution and use in source and binary forms, with or without
|
|
382
|
+
* modification, are permitted provided that the following conditions are met:
|
|
383
|
+
*
|
|
384
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
385
|
+
* list of conditions and the following disclaimer.
|
|
386
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
387
|
+
* this list of conditions and the following disclaimer in the
|
|
388
|
+
* documentation and/or other materials provided with the distribution.
|
|
389
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
390
|
+
* may be used to endorse or promote products derived from this software without
|
|
391
|
+
* specific prior written permission.
|
|
392
|
+
*
|
|
393
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
394
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
395
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
396
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
397
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
398
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
399
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
400
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
401
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
402
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
403
|
+
*/var rKt=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,nKt=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,oKt=/^[+-]?0[0-9_]/;function K3(e){let t=e.p,r=e.s.charCodeAt(e.p++),n=r,o=r===39,s=r===e.s.charCodeAt(e.p)&&r===e.s.charCodeAt(e.p+1);if(s){if((r=e.s.charCodeAt(e.p+=2))===10)e.p++;else if(r===13&&e.s.charCodeAt(e.p+1)===10)e.p+=2}let i="",a=e.p,c=0;for(;e.p<e.s.length;e.p++)if(r=e.s.charCodeAt(e.p),s&&(r===10||r===13&&e.s.charCodeAt(e.p+1)===10))c=c&&3;else if(r<32&&r!==9||r===127)throw new Ur("control characters are not allowed in strings",{toml:e.s,ptr:e.p});else if((!c||c===3)&&r===n&&(!s||e.s.charCodeAt(e.p+1)===n&&e.s.charCodeAt(e.p+2)===n)){if(s){if(e.s.charCodeAt(e.p+3)===n)e.p++;if(e.s.charCodeAt(e.p+3)===n)e.p++}if(!c)i+=e.s.slice(a,e.p);return e.p+=s?3:1,i}else if(!c){if(!o&&r===92)i+=e.s.slice(a,a=e.p),c=1}else if(c===1)if(r===120||r===117||r===85){let l=0,u=r===120?2:r===117?4:8;for(let f=0;f<u;f++,e.p++){let h=e.s.charCodeAt(e.p+1),y=h>=48&&h<=57?h-48:h>=65&&h<=70?h-65+10:h>=97&&h<=102?h-97+10:-1;if(y<0)throw new Ur("invalid non-hex character in unicode escape",{toml:e.s,ptr:e.p+1});l=l<<4|y}if(l<0||l>1114111||l>=55296&&l<=57343)throw new Ur("invalid unicode escape",{toml:e.s,ptr:e.p});i+=String.fromCodePoint(l),a=e.p+1,c=0}else if(r===32||r===9)c=2;else{if(r===98)i+="\b";else if(r===116)i+="\t";else if(r===110)i+=`
|
|
404
|
+
`;else if(r===102)i+="\f";else if(r===114)i+="\r";else if(r===101)i+="\x1B";else if(r===34)i+='"';else if(r===92)i+="\\";else throw new Ur("unrecognized escape sequence",{toml:e.s,ptr:e.p});a=e.p+1,c=0}else if(r!==32&&r!==9){if(c===2)throw new Ur("invalid escape: only line-ending whitespace may be escaped",{toml:e.s,ptr:a});c=!o&&r===92?1:0,a=e.p}throw new Ur("unfinished string",{toml:e.s,ptr:t})}function sKt(e,t,r){let n=e.s.slice(t,r),o=n.indexOf("#");if(o>0)G3({s:n,p:o,d:0}),n=n.slice(0,o);return n.trimEnd()}function xGe(e,t,r){let n=e.p,o={toml:e.s,ptr:n};gGe(e,44,r);let s=sKt(e,n,e.p);if(!s)throw new Ur("incomplete declaration: value expected",o);if(s==="-inf")return-1/0;if(s==="inf"||s==="+inf")return 1/0;if(s==="nan"||s==="+nan"||s==="-nan")return NaN;if(s==="-0")return t?0n:0;let i=rKt.test(s);if(i||nKt.test(s)){if(oKt.test(s))throw new Ur("leading zeroes are not allowed",o);s=s.replace(/_/g,"");let c=+s;if(isNaN(c))throw new Ur("invalid number",o);if(i){if((i=!Number.isSafeInteger(c))&&!t)throw new Ur("integer value cannot be represented losslessly",o);if(i||t===!0)c=BigInt(s)}return c}let a=new ib(s);if(!a.isValid())throw new Ur("invalid value",o);return a}/*!
|
|
405
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
406
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
407
|
+
*
|
|
408
|
+
* Redistribution and use in source and binary forms, with or without
|
|
409
|
+
* modification, are permitted provided that the following conditions are met:
|
|
410
|
+
*
|
|
411
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
412
|
+
* list of conditions and the following disclaimer.
|
|
413
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
414
|
+
* this list of conditions and the following disclaimer in the
|
|
415
|
+
* documentation and/or other materials provided with the distribution.
|
|
416
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
417
|
+
* may be used to endorse or promote products derived from this software without
|
|
418
|
+
* specific prior written permission.
|
|
419
|
+
*
|
|
420
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
421
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
422
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
423
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
424
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
425
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
426
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
427
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
428
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
429
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
430
|
+
*/function eN(e,t,r){let n=e.p,o=e.s.charCodeAt(n);if(o===91||o===123){if(!e.d--)throw new Ur("document contains excessively nested structures. aborting.",{toml:e.s,ptr:n});let s=o===91?SGe(e,r):yGe(e,r);return e.d++,s}if(o===34||o===39)return K3(e);if(o===116){if(e.s.charCodeAt(++e.p)!==114||e.s.charCodeAt(++e.p)!==117||e.s.charCodeAt(++e.p)!==101)throw new Ur("invalid value",{toml:e.s,ptr:n});return e.p++,!0}if(o===102){if(e.s.charCodeAt(++e.p)!==97||e.s.charCodeAt(++e.p)!==108||e.s.charCodeAt(++e.p)!==115||e.s.charCodeAt(++e.p)!==101)throw new Ur("invalid value",{toml:e.s,ptr:n});return e.p++,!1}return xGe(e,r,t)}/*!
|
|
431
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
432
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
433
|
+
*
|
|
434
|
+
* Redistribution and use in source and binary forms, with or without
|
|
435
|
+
* modification, are permitted provided that the following conditions are met:
|
|
436
|
+
*
|
|
437
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
438
|
+
* list of conditions and the following disclaimer.
|
|
439
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
440
|
+
* this list of conditions and the following disclaimer in the
|
|
441
|
+
* documentation and/or other materials provided with the distribution.
|
|
442
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
443
|
+
* may be used to endorse or promote products derived from this software without
|
|
444
|
+
* specific prior written permission.
|
|
445
|
+
*
|
|
446
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
447
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
448
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
449
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
450
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
451
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
452
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
453
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
454
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
455
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
456
|
+
*/var iKt=/^[a-zA-Z0-9-_]+[ \t]*$/;function J3(e,t="="){let r=e.p,n=r-1,o=[],s=e.s.indexOf(t,r);if(s<0)throw new Ur("incomplete key-value: cannot find end of key",{toml:e.s,ptr:r});do{let i=e.s.charCodeAt(e.p=++n);if(i!==32&&i!==9)if(i===34||i===39){if(i===e.s.charCodeAt(e.p+1)&&i===e.s.charCodeAt(e.p+2))throw new Ur("multiline strings are not allowed in keys",{toml:e.s,ptr:e.p});let a=K3(e);n=e.s.indexOf(".",e.p);let c=e.s.slice(e.p,n<0||n>s?s:n),l=Wie(c);if(l>-1)throw new Ur("newlines are not allowed in keys",{toml:e.s,ptr:l});if(c.trimStart())throw new Ur("found extra tokens after the string part",{toml:e.s,ptr:e.p});if(s<e.p){if(s=e.s.indexOf(t,e.p),s<0)throw new Ur("incomplete key-value: cannot find end of key",{toml:e.s,ptr:r})}o.push(a)}else{n=e.s.indexOf(".",e.p);let a=e.s.slice(e.p,n<0||n>s?s:n);if(!iKt.test(a))throw new Ur("only letter, numbers, dashes and underscores are allowed in keys",{toml:e.s,ptr:e.p});o.push(a.trimEnd())}}while(n+1&&n<s);return e.p=s+1,yh(e,!0,!0),o}function yGe(e,t){let r={},n=new Set,o;e.p++;while(e.p<e.s.length){if(yh(e),(o=e.s.charCodeAt(e.p))===125)return e.p++,r;let s,i=r,a=!1,c=e.p,l=J3(e);for(let f=0;f<l.length;f++){if(f)i=a?i[s]:i[s]={};if(s=l[f],(a=Object.hasOwn(i,s))&&(typeof i[s]!=="object"||n.has(i[s])))throw new Ur("trying to redefine an already defined value",{toml:e.s,ptr:c});if(!a&&s==="__proto__")Object.defineProperty(i,s,{enumerable:!0,configurable:!0,writable:!0})}if(a)throw new Ur("trying to redefine an already defined value",{toml:e.s,ptr:e.p});let u=eN(e,125,t);if(n.add(i[s]=u),yh(e),(o=e.s.charCodeAt(e.p++))===125)return r;if(o!==44)throw new Ur("expected comma or end of structure",{toml:e.s,ptr:e.p-1})}throw new Ur("unfinished table encountered",{toml:e.s,ptr:e.p})}function SGe(e,t){let r=[],n;e.p++;while(e.p<e.s.length){if(yh(e),(n=e.s.charCodeAt(e.p))===93)return e.p++,r;if(r.push(eN(e,93,t)),yh(e),(n=e.s.charCodeAt(e.p++))===93)return r;if(n!==44)throw new Ur("expected comma or end of structure",{toml:e.s,ptr:e.p-1})}throw new Ur("unfinished array encountered",{toml:e.s,ptr:e.p})}/*!
|
|
457
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
458
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
459
|
+
*
|
|
460
|
+
* Redistribution and use in source and binary forms, with or without
|
|
461
|
+
* modification, are permitted provided that the following conditions are met:
|
|
462
|
+
*
|
|
463
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
464
|
+
* list of conditions and the following disclaimer.
|
|
465
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
466
|
+
* this list of conditions and the following disclaimer in the
|
|
467
|
+
* documentation and/or other materials provided with the distribution.
|
|
468
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
469
|
+
* may be used to endorse or promote products derived from this software without
|
|
470
|
+
* specific prior written permission.
|
|
471
|
+
*
|
|
472
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
473
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
474
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
475
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
476
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
477
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
478
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
479
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
480
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
481
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
482
|
+
*/function EGe(e,t,r,n){let o=t,s=r,i,a=!1,c;for(let l=0;l<e.length;l++){if(l){if(o=a?o[i]:o[i]={},s=(c=s[i]).c,n===0&&(c.t===1||c.t===2))return null;if(c.t===2){let u=o.length-1;o=o[u],s=s[u].c}}if(i=e[l],(a=Object.hasOwn(o,i))&&s[i]?.t===0&&s[i]?.d)return null;if(!a){if(i==="__proto__")Object.defineProperty(o,i,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(s,i,{enumerable:!0,configurable:!0,writable:!0});s[i]={t:l<e.length-1&&n===2?3:n,d:!1,i:0,c:{}}}}if(c=s[i],c.t!==n&&!(n===1&&c.t===3))return null;if(n===2){if(!c.d)c.d=!0,o[i]=[];o[i].push(o={}),c.c[c.i++]=c={t:1,d:!1,i:0,c:{}}}if(c.d)return null;if(c.d=!0,n===1)o=a?o[i]:o[i]={};else if(n===0&&a)return null;return[i,o,c.c]}function zie(e,{maxDepth:t=1000,integersAsBigInt:r}={}){let n={s:e,p:0,d:t},o={},s={},i,a=o,c=s;yh(n);while(n.p<e.length){if(e.charCodeAt(n.p)===91){let l=e.charCodeAt(++n.p)===91;i=n.p+=+l;let u=J3(n,"]");if(l){if(e.charCodeAt(n.p-1)!==93)throw new Ur("expected end of table declaration",{toml:e,ptr:n.p-1});n.p++}let f=EGe(u,o,s,l?2:1);if(!f)throw new Ur("trying to redefine an already defined table or value",{toml:e,ptr:i});c=f[2],a=f[1]}else{i=n.p;let l=J3(n),u=EGe(l,a,c,0);if(!u)throw new Ur("trying to redefine an already defined table or value",{toml:e,ptr:i});u[1][u[0]]=eN(n,void 0,r)}if(yh(n,!0),n.p<e.length&&(i=e.charCodeAt(n.p))!==10&&i!==13)throw new Ur("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:n.p});yh(n)}return o}/*!
|
|
483
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
484
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
485
|
+
*
|
|
486
|
+
* Redistribution and use in source and binary forms, with or without
|
|
487
|
+
* modification, are permitted provided that the following conditions are met:
|
|
488
|
+
*
|
|
489
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
490
|
+
* list of conditions and the following disclaimer.
|
|
491
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
492
|
+
* this list of conditions and the following disclaimer in the
|
|
493
|
+
* documentation and/or other materials provided with the distribution.
|
|
494
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
495
|
+
* may be used to endorse or promote products derived from this software without
|
|
496
|
+
* specific prior written permission.
|
|
497
|
+
*
|
|
498
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
499
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
500
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
501
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
502
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
503
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
504
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
505
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
506
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
507
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
508
|
+
*/var bGe=/^[a-z0-9-_]+$/i;function tN(e){let t=typeof e;if(t==="object"){if(Array.isArray(e))return"array";if(typeof e?.getUTCDate==="function"&&e instanceof Date)return"date";if(globalThis.Temporal&&typeof e?.since==="function"&&(e instanceof Temporal.Instant||e instanceof Temporal.PlainDate||e instanceof Temporal.PlainDateTime||e instanceof Temporal.PlainTime||e instanceof Temporal.ZonedDateTime))return"temporal"}return t}function aKt(e){for(let t=0;t<e.length;t++)if(tN(e[t])!=="object")return!1;return e.length!=0}function $ie(e){return JSON.stringify(e).replace(/\x7f/g,"\\u007f")}function cKt(e){return e.toString({calendarName:"never",timeZoneName:"never"})}function jie(e,t,r,n){if(r===0)throw Error("Could not stringify the object: maximum object depth exceeded");switch(t){case"number":if(isNaN(e))return"nan";if(e===1/0)return"inf";if(e===-1/0)return"-inf";if(Number.isInteger(e)&&(n||!Number.isSafeInteger(e)))return e.toFixed(1);case"bigint":case"boolean":return e.toString();case"string":return $ie(e);case"date":if(isNaN(e.getTime()))throw TypeError("cannot serialize invalid date");return e.toISOString();case"object":return lKt(e,r,n);case"array":return uKt(e,r,n);case"temporal":return cKt(e)}}function lKt(e,t,r){let n=Object.keys(e);if(n.length===0)return"{}";let o="{ ";for(let s=0;s<n.length;s++){let i=n[s];if(s)o+=", ";o+=bGe.test(i)?i:$ie(i),o+=" = ",o+=jie(e[i],tN(e[i]),t-1,r)}return o+" }"}function uKt(e,t,r){if(e.length===0)return"[]";let n="[ ";for(let o=0;o<e.length;o++){if(o)n+=", ";if(e[o]===null||e[o]===void 0)throw TypeError("arrays cannot contain null or undefined values");n+=jie(e[o],tN(e[o]),t-1,r)}return n+" ]"}function pKt(e,t,r,n){if(r===0)throw Error("Could not stringify the object: maximum object depth exceeded");let o="";for(let s=0;s<e.length;s++)o+=`${o&&`
|
|
509
|
+
`}[[${t}]]
|
|
510
|
+
`,o+=Vie(0,e[s],t,r,n);return o}function Vie(e,t,r,n,o){if(n===0)throw Error("Could not stringify the object: maximum object depth exceeded");let s="",i="",a=Object.keys(t);for(let c=0;c<a.length;c++){let l=a[c];if(t[l]!==null&&t[l]!==void 0){let u=tN(t[l]);if(u==="symbol"||u==="function")throw TypeError(`cannot serialize values of type '${u}'`);let f=bGe.test(l)?l:$ie(l);if(u==="array"&&aKt(t[l]))i+=(i&&`
|
|
511
|
+
`)+pKt(t[l],r?`${r}.${f}`:f,n-1,o);else if(u==="object"){let h=r?`${r}.${f}`:f;i+=(i&&`
|
|
512
|
+
`)+Vie(h,t[l],h,n-1,o)}else s+=f,s+=" = ",s+=jie(t[l],u,n,o),s+=`
|
|
513
|
+
`}}if(e&&(s||!i))s=s?`[${e}]
|
|
514
|
+
${s}`:`[${e}]`;return s&&i?`${s}
|
|
515
|
+
${i}`:s||i}function Gie(e,{maxDepth:t=1000,numbersAsFloat:r=!1}={}){if(tN(e)!=="object")throw TypeError("stringify can only be called with an object");let n=Vie(0,e,"",t,r);if(n[n.length-1]!==`
|
|
516
|
+
`)return n+`
|
|
517
|
+
`;return n}/*!
|
|
518
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
519
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
520
|
+
*
|
|
521
|
+
* Redistribution and use in source and binary forms, with or without
|
|
522
|
+
* modification, are permitted provided that the following conditions are met:
|
|
523
|
+
*
|
|
524
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
525
|
+
* list of conditions and the following disclaimer.
|
|
526
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
527
|
+
* this list of conditions and the following disclaimer in the
|
|
528
|
+
* documentation and/or other materials provided with the distribution.
|
|
529
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
530
|
+
* may be used to endorse or promote products derived from this software without
|
|
531
|
+
* specific prior written permission.
|
|
532
|
+
*
|
|
533
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
534
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
535
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
536
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
537
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
538
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
539
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
540
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
541
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
542
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
543
|
+
*/class CGe extends x.Class("CodexMcpEntry")({command:x.NonEmptyTrimmedString,args:x.Array(x.String),env:x.optional(x.Record({key:x.String,value:x.String})),enabled:x.Boolean}){}function dKt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Kie=m.fn(function*(e){let t=e.mcp_servers;return dKt(t)?t:{}});function mKt(e){return e}class hk extends m.Service()("@expandai/cli/Install/Codex/Mcp",{dependencies:[rl.Default,tl.Default],effect:m.gen(function*(){let e=yield*rl,t=yield*tl,r=yield*Ae.string("HOME").pipe(Ae.withDefault(fKt())),n=yield*Ae.string("PWD").pipe(Ae.withDefault(process.cwd())),o=m.fn(function*(u){return yield*Q.value(u).pipe(Q.when("global",()=>m.succeed(`${r}/.codex/config.toml`)),Q.when("project",()=>m.succeed(`${n}/.codex/config.toml`)),Q.exhaustive)}),s=m.fn(function*(u){let f=yield*e.readText(u);return yield*m.try({try:()=>zie(f,{integersAsBigInt:!1}),catch:(h)=>new gh({path:u,error:h})})}),i=m.fn(function*(u,f){let h=yield*m.try({try:()=>Gie(mKt(f)),catch:(y)=>new Ad({path:u,error:y})});yield*e.writeText(u,h).pipe(m.mapError((y)=>new Ad({path:u,error:y})))}),a=m.fn(function*(u){let f=yield*o(u),h=yield*s(f),y=yield*Kie(h),E=yield*t.resolve(),b=new CGe({command:E.command,args:[...E.args,"mcp","run"],env:{EXPANDAI_HARNESS:"codex"},enabled:!0}),w={command:b.command,args:[...b.args],env:{...b.env},enabled:b.enabled};yield*i(f,{...h,mcp_servers:fl.set(y,co,w)}),yield*ft.log(`Installed expandai MCP server into ${f}`)}),c=m.fn(function*(u){let f=yield*o(u),h=yield*s(f),y=yield*Kie(h);if(!(co in y))return;yield*i(f,{...h,mcp_servers:fl.remove(y,co)}),yield*ft.log(`Removed expandai MCP server from ${f}`)}),l=m.fn(function*(u){let f=yield*o(u),h=yield*s(f),y=yield*Kie(h);return co in y});return{install:a,uninstall:c,isInstalled:l,pathFor:o}})}){}import{homedir as hKt}from"node:os";class wGe extends x.Class("CursorMcpEntry")({type:x.Literal("stdio"),command:x.NonEmptyTrimmedString,args:x.Array(x.String),env:x.optional(x.Record({key:x.String,value:x.String}))}){}class gk extends m.Service()("@expandai/cli/Install/Cursor/Mcp",{dependencies:[rl.Default,tl.Default],effect:m.gen(function*(){let e=yield*rl,t=yield*tl,r=yield*Ae.string("HOME").pipe(Ae.withDefault(hKt())),n=yield*Ae.string("PWD").pipe(Ae.withDefault(process.cwd())),o=m.fn(function*(u){return yield*Q.value(u).pipe(Q.when("global",()=>m.succeed(`${r}/.cursor/mcp.json`)),Q.when("project",()=>m.succeed(`${n}/.cursor/mcp.json`)),Q.exhaustive)}),s=m.fn(function*(u){return yield*e.read(u,qx).pipe(m.mapError((f)=>new gh({path:u,error:f})))}),i=m.fn(function*(u,f){yield*e.write(u,f,qx).pipe(m.mapError((h)=>new Ad({path:u,error:h})))}),a=m.fn(function*(u){let f=yield*o(u),h=yield*s(f),y=yield*t.resolve();yield*i(f,{...h,mcpServers:{...h.mcpServers,[co]:new wGe({type:"stdio",command:y.command,args:[...y.args,"mcp","run"],env:{EXPANDAI_HARNESS:"cursor"}})}}),yield*ft.log(`Installed expandai MCP server into ${f}`)}),c=m.fn(function*(u){let f=yield*o(u),h=yield*s(f);if(!(co in h.mcpServers))return;yield*i(f,{...h,mcpServers:fl.remove(h.mcpServers,co)}),yield*ft.log(`Removed expandai MCP server from ${f}`)}),l=m.fn(function*(u){let f=yield*o(u),h=yield*s(f);return co in h.mcpServers});return{install:a,uninstall:c,isInstalled:l,pathFor:o}})}){}import{homedir as gKt}from"node:os";class kGe extends x.Class("OpencodeMcpEntry")({type:x.Literal("local"),command:x.Array(x.String),environment:x.optional(x.Record({key:x.String,value:x.String})),enabled:x.optional(x.Boolean)}){}class xk extends m.Service()("@expandai/cli/Install/Opencode/Mcp",{dependencies:[rl.Default,tl.Default],effect:m.gen(function*(){let e=yield*rl,t=yield*tl,r=yield*Ae.string("HOME").pipe(Ae.withDefault(gKt())),n=yield*Ae.string("PWD").pipe(Ae.withDefault(process.cwd())),o=m.fn(function*(u){return yield*Q.value(u).pipe(Q.when("global",()=>m.succeed(`${r}/.config/opencode/opencode.json`)),Q.when("project",()=>m.succeed(`${n}/opencode.json`)),Q.exhaustive)}),s=m.fn(function*(u){return yield*e.read(u,Bie).pipe(m.mapError((f)=>new gh({path:u,error:f})))}),i=m.fn(function*(u,f){yield*e.write(u,f,Bie).pipe(m.mapError((h)=>new Ad({path:u,error:h})))}),a=m.fn(function*(u){let f=yield*o(u),h=yield*s(f),y=yield*t.resolve();yield*i(f,{...h,mcp:{...h.mcp,[co]:new kGe({type:"local",command:[y.command,...y.args,"mcp","run"],environment:{EXPANDAI_HARNESS:"opencode"},enabled:!0})}}),yield*ft.log(`Installed expandai MCP server into ${f}`)}),c=m.fn(function*(u){let f=yield*o(u),h=yield*s(f);if(!(co in h.mcp))return;yield*i(f,{...h,mcp:fl.remove(h.mcp,co)}),yield*ft.log(`Removed expandai MCP server from ${f}`)}),l=m.fn(function*(u){let f=yield*o(u),h=yield*s(f);return co in h.mcp});return{install:a,uninstall:c,isInstalled:l,pathFor:o}})}){}class $u extends m.Service()("@expandai/cli/Install/Mcp",{dependencies:[V3.Default,gk.Default,xk.Default,hk.Default],effect:m.gen(function*(){let e=yield*V3,t=yield*gk,r=yield*xk,n=yield*hk,o=m.fn("Mcp.pathFor")(function*(c,l){return yield*Q.value(c).pipe(Q.when("claude-code",()=>e.pathFor(l)),Q.when("cursor",()=>t.pathFor(l)),Q.when("opencode",()=>r.pathFor(l)),Q.when("codex",()=>n.pathFor(l)),Q.exhaustive)}),s=m.fn("Mcp.install")(function*(c,l){yield*Q.value(c).pipe(Q.when("claude-code",()=>e.install(l)),Q.when("cursor",()=>t.install(l)),Q.when("opencode",()=>r.install(l)),Q.when("codex",()=>n.install(l)),Q.exhaustive)}),i=m.fn("Mcp.uninstall")(function*(c,l){yield*Q.value(c).pipe(Q.when("claude-code",()=>e.uninstall(l)),Q.when("cursor",()=>t.uninstall(l)),Q.when("opencode",()=>r.uninstall(l)),Q.when("codex",()=>n.uninstall(l)),Q.exhaustive)}),a=m.fn("Mcp.isInstalled")(function*(c,l){return yield*Q.value(c).pipe(Q.when("claude-code",()=>e.isInstalled(l)),Q.when("cursor",()=>t.isInstalled(l)),Q.when("opencode",()=>r.isInstalled(l)),Q.when("codex",()=>n.isInstalled(l)),Q.exhaustive)});return{install:s,uninstall:i,isInstalled:a,pathFor:o}})}){}import{homedir as xKt}from"node:os";var IGe="expandai-webfetch.js";class yk extends m.Service()("@expandai/cli/Install/Opencode/Hook",{dependencies:[xa.layer,Ac.layer],effect:m.gen(function*(){let e=yield*un.FileSystem,t=yield*So.Path,r=yield*t.fromFileUrl(cGe),n=yield*Ae.string("HOME").pipe(Ae.withDefault(xKt())),o=yield*Ae.string("PWD").pipe(Ae.withDefault(process.cwd())),s=m.fn(function*(c){return yield*Q.value(c).pipe(Q.when("global",()=>m.succeed(`${n}/.config/opencode/plugins/${IGe}`)),Q.when("project",()=>m.succeed(`${o}/.opencode/plugins/${IGe}`)),Q.exhaustive)}),i=m.fn("OpencodeHook.install")(function*(c){let l=yield*s(c);yield*e.makeDirectory(t.dirname(l),{recursive:!0}),yield*e.copyFile(r,l),yield*ft.log(`Installed expandai webfetch plugin at ${l}`)}),a=m.fn("OpencodeHook.uninstall")(function*(c){let l=yield*s(c);if(yield*e.exists(l))yield*e.remove(l),yield*ft.log(`Removed expandai webfetch plugin from ${l}`)});return{install:i,uninstall:a,pathFor:s}})}){}var pIr=x.Literal("claude-code","opencode");class Sh extends m.Service()("@expandai/cli/Install/Hook",{dependencies:[$u.Default,$3.Default,yk.Default],effect:m.gen(function*(){let e=yield*$u,t=yield*$3,r=yield*yk,n=m.fn("HookInstaller.install")(function*(s,i){yield*e.install(s,i),yield*Q.value(s).pipe(Q.when("claude-code",()=>t.install(i)),Q.when("opencode",()=>r.install(i)),Q.exhaustive)}),o=m.fn("HookInstaller.uninstall")(function*(s,i){yield*Q.value(s).pipe(Q.when("claude-code",()=>t.uninstall(i)),Q.when("opencode",()=>r.uninstall(i)),Q.exhaustive),yield*e.uninstall(s,i)});return{install:n,uninstall:o}})}){}import{homedir as yKt}from"node:os";var av="expandai",Sk="SKILL.md",AGe=/^(\s*expandai-profile-version:\s*).+$/mu;function SKt(e,t=ii){if(!AGe.test(e))throw Error("Bundled Expand skill is missing expandai-profile-version metadata");return e.replace(AGe,`$1${t}`)}function rN(e,t,r=ii){let n=SKt(t,r);return{changed:e!==n,text:n}}var EKt=m.gen(function*(){let e=yield*un.FileSystem,t=yield*So.Path,r=yield*Ae.string("HOME").pipe(Ae.withDefault(yKt())),n=yield*Ae.string("PWD").pipe(Ae.withDefault(process.cwd())),o=t.join(yield*t.fromFileUrl(iv),Sk),s=m.fn(function*(l){return yield*Q.value(l).pipe(Q.when("global",()=>m.succeed(t.join(r,".claude","skills",av))),Q.when("project",()=>m.succeed(t.join(n,".claude","skills",av))),Q.exhaustive)}),i=m.fn("ClaudeSkill.source")(function*(){return yield*e.readFileString(o)}),a=m.fn("ClaudeSkill.install")(function*(l){let u=yield*s(l),f=t.join(u,Sk),h=(yield*e.exists(f))?yield*e.readFileString(f):void 0,y=rN(h,yield*i());if(y.changed)yield*e.makeDirectory(u,{recursive:!0}),yield*e.writeFileString(f,y.text);return u}),c=m.fn("ClaudeSkill.uninstall")(function*(l){let u=yield*s(l);if(yield*e.exists(u))yield*e.remove(u,{recursive:!0});return u});return{install:a,uninstall:c,pathFor:s,source:i}});class Q3 extends m.Service()("@expandai/cli/Install/Claude/Skill",{dependencies:[xa.layer,Ac.layer],effect:EKt}){}import{homedir as bKt}from"node:os";var OGe="expandai";class Ek extends m.Service()("@expandai/cli/Install/Codex/Skill",{dependencies:[xh.Default],effect:m.gen(function*(){let e=yield*xh,t=yield*Ae.string("HOME").pipe(Ae.withDefault(bKt())),r=yield*Ae.string("PWD").pipe(Ae.withDefault(process.cwd())),n=m.fn(function*(a){return yield*Q.value(a).pipe(Q.when("global",()=>m.succeed(`${t}/.agents/skills/${OGe}`)),Q.when("project",()=>m.succeed(`${r}/.agents/skills/${OGe}`)),Q.exhaustive)}),o=m.fn(function*(a){return yield*e.install(yield*n(a))}),s=m.fn(function*(a){return yield*e.uninstall(yield*n(a))}),i=m.fn(function*(a){return yield*e.isCurrent(yield*n(a))});return{install:o,uninstall:s,isCurrent:i,pathFor:n}})}){}import{homedir as CKt}from"node:os";var _Ge="expandai";class bk extends m.Service()("@expandai/cli/Install/Cursor/Skill",{dependencies:[xh.Default],effect:m.gen(function*(){let e=yield*xh,t=yield*Ae.string("HOME").pipe(Ae.withDefault(CKt())),r=yield*Ae.string("PWD").pipe(Ae.withDefault(process.cwd())),n=m.fn(function*(a){return yield*Q.value(a).pipe(Q.when("global",()=>m.succeed(`${t}/.cursor/skills/${_Ge}`)),Q.when("project",()=>m.succeed(`${r}/.cursor/skills/${_Ge}`)),Q.exhaustive)}),o=m.fn(function*(a){return yield*e.install(yield*n(a))}),s=m.fn(function*(a){return yield*e.uninstall(yield*n(a))}),i=m.fn(function*(a){return yield*e.isCurrent(yield*n(a))});return{install:o,uninstall:s,isCurrent:i,pathFor:n}})}){}import{homedir as wKt}from"node:os";var vGe="expandai";class Ck extends m.Service()("@expandai/cli/Install/Opencode/Skill",{dependencies:[xh.Default],effect:m.gen(function*(){let e=yield*xh,t=yield*Ae.string("HOME").pipe(Ae.withDefault(wKt())),r=yield*Ae.string("PWD").pipe(Ae.withDefault(process.cwd())),n=m.fn(function*(a){return yield*Q.value(a).pipe(Q.when("global",()=>m.succeed(`${t}/.config/opencode/skills/${vGe}`)),Q.when("project",()=>m.succeed(`${r}/.opencode/skills/${vGe}`)),Q.exhaustive)}),o=m.fn(function*(a){return yield*e.install(yield*n(a))}),s=m.fn(function*(a){return yield*e.uninstall(yield*n(a))}),i=m.fn(function*(a){return yield*e.isCurrent(yield*n(a))});return{install:o,uninstall:s,isCurrent:i,pathFor:n}})}){}class Eh extends m.Service()("@expandai/cli/Install/Skill",{dependencies:[Q3.Default,bk.Default,Ck.Default,Ek.Default],effect:m.gen(function*(){let e=yield*Q3,t=yield*bk,r=yield*Ck,n=yield*Ek,o=m.fn("Skill.install")(function*(i,a){let c=yield*Q.value(i).pipe(Q.when("claude-code",()=>e.install(a)),Q.when("cursor",()=>t.install(a)),Q.when("opencode",()=>r.install(a)),Q.when("codex",()=>n.install(a)),Q.exhaustive);yield*ft.log(`Installed expandai skill into ${c}`)}),s=m.fn("Skill.uninstall")(function*(i,a){let c=yield*Q.value(i).pipe(Q.when("claude-code",()=>e.uninstall(a)),Q.when("cursor",()=>t.uninstall(a)),Q.when("opencode",()=>r.uninstall(a)),Q.when("codex",()=>n.uninstall(a)),Q.exhaustive);yield*ft.log(`Removed expandai skill from ${c}`)});return{install:o,uninstall:s}})}){}var kKt=x.Literal("all","hook","skill","mcp");class RGe extends x.Class("UninstallOptions")({target:x.optional(kKt),host:x.optional(z3),scope:x.optional(qie)}){}var IKt=["global","project"],AKt=["claude-code","cursor","opencode","codex"],TGe=(e)=>e==="claude-code"||e==="opencode";class Bx extends m.Service()("@expandai/cli/Install/Uninstall",{dependencies:[Sh.Default,$u.Default,Eh.Default],effect:m.gen(function*(){let e=yield*Sh,t=yield*$u,r=yield*Eh;return{uninstall:m.fn(function*(o=new RGe({})){let s=o.target??"all",i=o.host?[o.host]:AKt,a=o.scope?[o.scope]:IKt,c=m.fnUntraced(function*(){let h=ct.filter(i,TGe);yield*m.forEach(h,(y)=>m.forEach(a,(E)=>e.uninstall(y,E),{discard:!0}),{discard:!0})}),l=m.fnUntraced(function*(){yield*m.forEach(i,(h)=>m.forEach(a,(y)=>r.uninstall(h,y),{discard:!0}),{discard:!0})}),u=m.fnUntraced(function*(){yield*m.forEach(i,(h)=>m.forEach(a,(y)=>t.uninstall(h,y),{discard:!0}),{discard:!0})}),f=m.fnUntraced(function*(){let h=ct.filter(i,(y)=>!TGe(y));yield*m.forEach(h,(y)=>m.forEach(a,(E)=>t.uninstall(y,E),{discard:!0}),{discard:!0})});yield*Q.value(s).pipe(Q.when("all",()=>c().pipe(m.zipRight(f()),m.zipRight(l()))),Q.when("hook",()=>c()),Q.when("skill",()=>l()),Q.when("mcp",()=>u()),Q.exhaustive)})}})}){}var MGe=m.fn("Authentication.formatAuthStatus")(function*(e){return yield*Q.value(e).pipe(Q.tag("ApiKey",()=>m.succeed("Authenticated via API key.")),Q.tag("OAuth",({expiresAt:t})=>m.gen(function*(){let r=yield*ar.now;return`Authenticated via OAuth (${ar.lessThan(t,r)?`expired ${Gr.format(ar.distanceDuration(t,r))} ago — run \`expandai login --json\``:`expires in ${Gr.format(ar.distanceDuration(r,t))}`}).`})),Q.exhaustive)});class ju extends m.Service()("@expandai/cli/Authentication",{dependencies:[Cr.Default,B3.Default,Bx.Default],effect:m.gen(function*(){let e=yield*Cr,t=yield*B3,r=yield*Bx,n=m.fn("Authentication.hasLocallyUsableCredentials")(function*(){yield*e.ensureSecureStorage();let h=yield*m.either(e.loadConfig());if(mt.isLeft(h)){if(h.left._tag==="NotAuthenticated")return!1;return yield*m.fail(h.left)}let y=yield*ar.now;return A3(h.right.authMethod,y)}),o=m.fn("Authentication.apiKeyLogin")(function*(){let h=yield*jl.password({message:"Enter your API Key"});yield*e.updateConfig({authMethod:mie.make({apiKey:yield*x.validate(w3)(h)})}),yield*ft.log("API key saved successfully!")}),s=m.fnUntraced(function*(h){yield*ft.log(Sn.stripMargin(`
|
|
544
|
+
|
|
|
545
|
+
|Starting browser authorization...`)),yield*t.login(h),yield*ft.log(Sn.stripMargin(`
|
|
546
|
+
|
|
|
547
|
+
|Successfully authenticated!`))}),i=m.fnUntraced(function*(h){yield*ft.log(Sn.stripMargin(`
|
|
548
|
+
|
|
|
549
|
+
|Open this URL in a browser:
|
|
550
|
+
| ${h.verificationUri.toString()}
|
|
551
|
+
|
|
|
552
|
+
|Enter this code:
|
|
553
|
+
| ${h.userCode}
|
|
554
|
+
|
|
|
555
|
+
|Waiting for browser authorization...`))}),a=m.fn("Authentication.loginWithBrowser")(function*(){yield*s(i)}),c=m.fn("Authentication.oauthLogin")(function*(){yield*s((h)=>m.gen(function*(){yield*ft.log(Sn.stripMargin(`
|
|
556
|
+
|
|
|
557
|
+
|Open this URL in a browser:
|
|
558
|
+
| ${h.verificationUri.toString()}
|
|
559
|
+
|
|
|
560
|
+
|Enter this code:
|
|
561
|
+
| ${h.userCode}
|
|
562
|
+
|`)),yield*m.tryPromise(()=>rGe(h.verificationUri.toString())).pipe(m.catchAll(()=>ft.log("Could not open browser automatically — use the URL above."))),yield*ft.log(Sn.stripMargin(`
|
|
563
|
+
|
|
|
564
|
+
|Waiting for browser authorization...`))}))}),l=m.fn("Authentication.login")(function*(){yield*e.ensureSecureStorage();let h=yield*m.either(e.loadConfig());if(mt.isRight(h)){let E=yield*MGe(h.right.authMethod);if(!(yield*jl.confirm({message:Sn.stripMargin(`
|
|
565
|
+
|${E}
|
|
566
|
+
|Do you want to re-authenticate?`)})))return}let y=yield*jl.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*Q.value(y).pipe(Q.when("api-key",()=>o()),Q.when("oauth",()=>c()),Q.exhaustive)}),u=m.fn("Authentication.whoami")(function*(){let{authMethod:h}=yield*e.loadConfig(),y=yield*MGe(h);yield*ft.log(y)}),f=m.fn("Authentication.logout")(function*(){if(yield*e.clearConfig(),!process.stdout.isTTY||!process.stdin.isTTY){yield*m.logInfo(Sn.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*ft.log("Logged out.");return}let h=yield*jl.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(h.length>0)yield*m.forEach(h,(y)=>r.uninstall(y),{discard:!0});yield*ft.log("Logged out.")});return{hasLocallyUsableCredentials:n,loginWithBrowser:a,login:l,whoami:u,logout:f}})}){}var PGe=Te.make("login").pipe(Te.withDescription("Authenticate with ExpandAI"),Te.withHandler(()=>m.flatMap(ju,(e)=>e.login()))),Jie=Te.make("whoami").pipe(Te.withDescription("Show current authentication status"),Te.withHandler(()=>m.flatMap(ju,(e)=>e.whoami()))),Qie=Te.make("logout").pipe(Te.withDescription("Clear stored credentials and optionally remove installed integrations"),Te.withHandler(()=>m.flatMap(ju,(e)=>e.logout())));var OKt=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 nN(e){let[t,r]=e.slice(2),n=t===void 0?void 0:OKt.get(t);if(t===void 0||n===void 0)return"(none)";return r!==void 0&&n.has(r)?`${t} ${r}`:t}class _Kt extends fe({include:Y(H,{nullable:!0})}){}class vKt extends mr("FetchFetchRequest")({url:H,include:Y(fe({html:Y(gt(St,ys({key:H,value:To})),{nullable:!0}),markdown:Y(gt(St,ys({key:H,value:To})),{nullable:!0}),screenshot:Y(gt(St,fe({fullPage:Y(St,{nullable:!0})})),{nullable:!0}),links:Y(gt(St,fe({sameDomainOnly:Y(St,{nullable:!0,default:()=>!0}),includePatterns:Y(st(H),{nullable:!0}),excludePatterns:Y(st(H),{nullable:!0})})),{nullable:!0}),meta:Y(St,{nullable:!0,default:()=>!0}),response:Y(fe({includeHeaders:Y(St,{nullable:!0,default:()=>!1})}),{nullable:!0}),json:Y(St,{nullable:!0,default:()=>!1}),appendix:Y(St,{nullable:!0})}),{nullable:!0}),search:Y(fe({query:H,maxResults:Y(Ja.pipe(Ui(1),Km(50)),{nullable:!0,default:()=>5}),minScore:Y(Et.pipe(Ui(0),Km(1)),{nullable:!0,default:()=>0.6})}),{nullable:!0}),browserConfig:Y(fe({scrollFullPage:Y(St,{nullable:!0,default:()=>!1})}),{nullable:!0})}){}class DGe extends qe("Pointer","Unexpected","Missing","Composite","Refinement","Transformation","Type","Forbidden"){}class FGe extends qe("symbol"){}class NGe extends gt(H,Et,fe({_tag:FGe,key:H})){}class LGe extends fe({_tag:DGe,path:st(NGe),message:H}){}class UGe extends qe("HttpApiDecodeError"){}class wk extends fe({issues:st(LGe),message:H,_tag:UGe}){}class HGe extends qe("BadRequest"){}class oN extends fe({message:H,_tag:HGe}){}class Y3 extends gt(wk,oN){}class qGe extends qe("InvalidApiKey","InvalidToken","InvalidSession","InvalidTenant"){}class BGe extends qe("AuthFailed"){}class lf extends mr("AuthFailed")({reason:qGe,description:Y(gt(H,fe({message:H})),{nullable:!0}),_tag:BGe}){}class sN extends H{}class WGe extends qe("FetchBlocked"){}class Z3 extends fe({url:H,blockedType:Y(H,{nullable:!0}),_tag:WGe}){}class X3 extends gt(fe({organizationId:H.pipe(yo(1)),blockedUntil:Y(gt(sN,ix),{nullable:!0}),_tag:qe("AccessBlocked")}),Z3){}class zGe extends qe("PayloadTooLarge"){}class df extends fe({_tag:zGe}){}class $Ge extends qe("transfer_bytes","domsnapshot_bytes","ast_bytes"){}class jGe extends qe("FetchPageTooLarge"){}class eG extends fe({url:H,limitKind:Y($Ge,{nullable:!0}),limitBytes:Y(Et,{nullable:!0}),measuredBytes:Y(Et,{nullable:!0}),_tag:jGe}){}class VGe extends gt(df,eG){}class GGe extends qe("TooManyRequests"){}class uf extends mr("TooManyRequests")({_tag:GGe}){}class KGe extends qe("InternalError"){}class pf extends mr("InternalError")({_tag:KGe}){}class JGe extends qe("browserInternalDocument"){}class QGe extends qe("FetchNavigationFailed"){}class ab extends mr("FetchNavigationFailed")({url:H,failureType:JGe,_tag:QGe}){}class YGe extends qe("ServiceUnavailable"){}class ff extends mr("ServiceUnavailable")({message:Y(H,{nullable:!0}),requestId:Y(H,{nullable:!0}),_tag:YGe}){}class ZGe extends qe("FetchCaptureTimeout"){}class cb extends mr("FetchCaptureTimeout")({url:H,timeoutMs:Y(Et,{nullable:!0}),_tag:ZGe}){}class XGe extends qe("FetchCapacityTimeout"){}class lb extends mr("FetchCapacityTimeout")({url:H,timeoutMs:Y(Et,{nullable:!0}),_tag:XGe}){}class TKt extends fe({include:Y(H,{nullable:!0})}){}class RKt extends mr("FetchFetchJsonRequest")({url:H,include:Y(fe({html:Y(gt(St,ys({key:H,value:To})),{nullable:!0}),markdown:Y(gt(St,ys({key:H,value:To})),{nullable:!0}),screenshot:Y(gt(St,fe({fullPage:Y(St,{nullable:!0})})),{nullable:!0}),links:Y(gt(St,fe({sameDomainOnly:Y(St,{nullable:!0,default:()=>!0}),includePatterns:Y(st(H),{nullable:!0}),excludePatterns:Y(st(H),{nullable:!0})})),{nullable:!0}),meta:Y(St,{nullable:!0,default:()=>!0}),response:Y(fe({includeHeaders:Y(St,{nullable:!0,default:()=>!1})}),{nullable:!0}),json:Y(St,{nullable:!0,default:()=>!1}),appendix:Y(St,{nullable:!0})}),{nullable:!0}),search:Y(fe({query:H,maxResults:Y(Ja.pipe(Ui(1),Km(50)),{nullable:!0,default:()=>5}),minScore:Y(Et.pipe(Ui(0),Km(1)),{nullable:!0,default:()=>0.6})}),{nullable:!0}),browserConfig:Y(fe({scrollFullPage:Y(St,{nullable:!0,default:()=>!1})}),{nullable:!0})}){}class eKe extends qe(1){}class tKe extends fe({sameDomain:Et,external:Et}){}class rKe extends fe({url:H,links:tKe}){}class nKe extends fe({moreTokens:Et}){}class oKe extends fe({url:H,moreTokens:Y(Et,{nullable:!0})}){}class tG extends fe({version:eKe,url:H,capturedAt:H,snapshotId:H,lang:H,pageType:H,playground:H,title:Y(H,{nullable:!0}),finalUrl:Y(H,{nullable:!0}),canonical:Y(H,{nullable:!0}),description:Y(H,{nullable:!0}),author:Y(H,{nullable:!0}),createdAt:Y(H,{nullable:!0}),updatedAt:Y(H,{nullable:!0}),image:Y(H,{nullable:!0}),paginationNext:Y(H,{nullable:!0}),appendix:Y(rKe,{nullable:!0}),stateJson:Y(nKe,{nullable:!0}),markdown:Y(oKe,{nullable:!0}),blocked:Y(H,{nullable:!0}),loadingStatus:Y(H,{nullable:!0})}){}class sKe extends qe("inline","network"){}class iKe extends qe("ld+json","next-data","nuxt","apollo-state","initial-state","application-json","script-tag","data-attribute","network-json","network-response","other"){}class aKe extends qe(!0){}class cKe extends qe("invalid","unsafe","too-long"){}class rG extends fe({id:Et,kind:sKe,role:iKe,score:Et,url:Y(H,{nullable:!0}),method:Y(H,{nullable:!0}),moreTokens:Y(Et,{nullable:!0}),keys:Y(st(H),{nullable:!0}),urlRedacted:Y(aKe,{nullable:!0}),urlOmitted:Y(cKe,{nullable:!0})}){}class lKe extends qe("data-url"){}class iN extends fe({id:H,kind:lKe,placeholder:H,archiveKey:H,mimeType:H,sha256:H,bytes:Et}){}class uKe extends qe("pageTooLarge","modelInputTooLarge"){}class pKe extends qe("domsnapshot_bytes","ast_bytes","hfc_tokens"){}class Yie extends fe({reason:uKe,skipped:st(qe("hfc")),limitKind:pKe,measuredBytes:Y(Ja.pipe(Ui(0)),{nullable:!0}),thresholdBytes:Y(Ja.pipe(Ui(0)),{nullable:!0}),measuredTokens:Y(Ja.pipe(Ui(0)),{nullable:!0}),thresholdTokens:Y(Ja.pipe(Ui(0)),{nullable:!0})}){}class fKe extends Ja{}class nG extends fe({evidenceId:Y(fKe,{nullable:!0}),markdownBlockId:Y(H,{nullable:!0}),nodeIds:Y(st(Et),{nullable:!0}),stateJsonSourceId:Y(Et,{nullable:!0}),jsonPath:Y(H,{nullable:!0})}){}class dKe extends qe("markdown","appendix","statejson"){}class mKe extends qe("zeroentropy","mixedbread","local_lexical"){}class hKe extends qe("timeout","error"){}class gKe extends fe({source:dKe,chunkCount:Ja.pipe(Ui(0)),batchCount:Ja.pipe(Ui(0)),ranker:mKe,fallback:St,fallbackReason:Y(hKe,{nullable:!0}),durationMs:Et.pipe(Ui(0))}){}class oG extends fe({durationMs:Et.pipe(Ui(0)),sources:st(gKe)}){}class kk extends fe({query:H,snippets:st(fe({type:Y(qe("text"),{nullable:!0,default:()=>"text"}),source:qe("markdown","appendix","statejson"),text:H,score:Et.pipe(Ui(0),Km(1)),location:Y(nG,{nullable:!0})})),meta:Y(oG,{nullable:!0})}){}class aN extends mr("FetchObjectModeResult")({meta:tG,markdown:H,json:st(rG),data:Y(fe({assets:Y(st(iN),{nullable:!0}),degraded:Y(Yie,{nullable:!0}),search:Y(kk,{nullable:!0}),screenshot:Y(fe({url:H,fullPage:St}),{nullable:!0})}),{nullable:!0})}){}class sG extends gt(wk,oN){}class iG extends gt(fe({organizationId:H.pipe(yo(1)),blockedUntil:Y(gt(sN,ix),{nullable:!0}),_tag:qe("AccessBlocked")}),Z3){}class xKe extends gt(df,eG){}class MKt extends mr("FetchFetchSearchRequest")({snapshotId:H.pipe(yo(1)),search:fe({query:H,maxResults:Y(Ja.pipe(Ui(1),Km(50)),{nullable:!0,default:()=>5}),minScore:Y(Et.pipe(Ui(0),Km(1)),{nullable:!0,default:()=>0.6})}),include:Y(fe({html:Y(gt(St,ys({key:H,value:To})),{nullable:!0}),markdown:Y(gt(St,ys({key:H,value:To})),{nullable:!0}),screenshot:Y(gt(St,fe({fullPage:Y(St,{nullable:!0})})),{nullable:!0}),links:Y(gt(St,fe({sameDomainOnly:Y(St,{nullable:!0,default:()=>!0}),includePatterns:Y(st(H),{nullable:!0}),excludePatterns:Y(st(H),{nullable:!0})})),{nullable:!0}),meta:Y(St,{nullable:!0,default:()=>!0}),response:Y(fe({includeHeaders:Y(St,{nullable:!0,default:()=>!1})}),{nullable:!0}),json:Y(St,{nullable:!0,default:()=>!1}),appendix:Y(St,{nullable:!0})}),{nullable:!0})}){}class yKe extends H{}class Ik extends fe({url:H,requestedUrl:Y(yKe,{nullable:!0}),originStatusCode:Y(Et,{nullable:!0}),redirectStatusCode:Y(Et,{nullable:!0}),headers:Y(fe({}),{nullable:!0})}){}class SKe extends mr("FetchSnapshotSearchResult")({snapshotId:H.pipe(yo(1)),response:Ik,search:kk,durationMs:Et.pipe(Ui(0)),playground:H}){}class aG extends gt(wk,oN){}class EKe extends qe("AccessBlocked"){}class cG extends fe({organizationId:H.pipe(yo(1)),blockedUntil:Y(gt(sN,ix),{nullable:!0}),_tag:EKe}){}class Zie extends H.pipe(yo(1)){}class bKe extends qe("FetchSnapshotSearchNotFound"){}class lG extends mr("FetchSnapshotSearchNotFound")({snapshotId:Zie,_tag:bKe}){}class PKt extends fe({"x-idempotency-key":Y(H.pipe(yo(1),pte(255)),{nullable:!0})}){}class DKt extends mr("FetchBatchedRequest")({urls:$m(H),include:Y(fe({html:Y(gt(St,ys({key:H,value:To})),{nullable:!0}),markdown:Y(gt(St,ys({key:H,value:To})),{nullable:!0}),screenshot:Y(gt(St,fe({fullPage:Y(St,{nullable:!0})})),{nullable:!0}),links:Y(gt(St,fe({sameDomainOnly:Y(St,{nullable:!0,default:()=>!0}),includePatterns:Y(st(H),{nullable:!0}),excludePatterns:Y(st(H),{nullable:!0})})),{nullable:!0}),meta:Y(St,{nullable:!0,default:()=>!0}),response:Y(fe({includeHeaders:Y(St,{nullable:!0,default:()=>!1})}),{nullable:!0}),json:Y(St,{nullable:!0,default:()=>!1}),appendix:Y(St,{nullable:!0})}),{nullable:!0}),browserConfig:Y(fe({scrollFullPage:Y(St,{nullable:!0,default:()=>!1})}),{nullable:!0})}){}class CKe extends mr("BatchedRun")({id:H}){}class wKe extends gt(wk,oN){}class kKe extends qe("AccessBlocked"){}class IKe extends fe({organizationId:H.pipe(yo(1)),blockedUntil:Y(gt(sN,ix),{nullable:!0}),_tag:kKe}){}class AKe extends qe("payload_mismatch"){}class OKe extends qe("BatchedIdempotencyConflict"){}class _Ke extends mr("BatchedIdempotencyConflict")({existingRunId:H,reason:AKe,_tag:OKe}){}class FKt extends fe({limit:Y(H,{nullable:!0}),offset:Y(H,{nullable:!0}),include:Y(H,{nullable:!0})}){}class vKe extends qe("QUEUED","RUNNING","CANCELLING","COMPLETED","FAILED","CANCELLED"){}class TKe extends qe("QUEUED","RUNNING","CANCELLING","COMPLETED","FAILED","CANCELLED"){}class RKe extends qe("QUEUED","RUNNING","SUCCEEDED","FAILED","CANCELLED"){}class MKe extends fe({href:H.pipe(yo(1)),rel:H.pipe(yo(1)),type:Y(H.pipe(yo(1)),{nullable:!0}),sizes:Y(H.pipe(yo(1)),{nullable:!0})}){}class PKe extends fe({url:H.pipe(yo(1)),width:Y(Et,{nullable:!0}),height:Y(Et,{nullable:!0}),alt:Y(H,{nullable:!0})}){}class DKe extends fe({title:Y(H,{nullable:!0}),description:Y(H,{nullable:!0}),type:Y(H.pipe(yo(1)),{nullable:!0}),url:Y(H.pipe(yo(1)),{nullable:!0}),siteName:Y(H,{nullable:!0}),locale:Y(H,{nullable:!0}),images:Y(st(PKe),{nullable:!0})}){}class FKe extends fe({card:Y(H.pipe(yo(1)),{nullable:!0}),site:Y(H,{nullable:!0}),creator:Y(H,{nullable:!0}),title:Y(H,{nullable:!0}),description:Y(H,{nullable:!0}),image:Y(H.pipe(yo(1)),{nullable:!0})}){}class NKe extends fe({title:Y(H,{nullable:!0}),description:Y(H,{nullable:!0}),canonicalUrl:Y(H.pipe(yo(1)),{nullable:!0}),language:Y(H.pipe(yo(1)),{nullable:!0}),charset:Y(H.pipe(yo(1)),{nullable:!0}),favicon:Y(H.pipe(yo(1)),{nullable:!0}),icons:Y(st(MKe),{nullable:!0}),openGraph:Y(DKe,{nullable:!0}),twitter:Y(FKe,{nullable:!0})}){}class LKe extends fe({url:H,text:Y(H,{nullable:!0})}){}class UKe extends qe("rust"){}class HKe extends qe("rust"){}class qKe extends qe("rust"){}class BKe extends fe({capture:Y(UKe,{nullable:!0}),markdown:Y(HKe,{nullable:!0}),tree:Y(qKe,{nullable:!0})}){}class WKe extends fe({status:RKe,data:Y(fe({response:Ik,meta:Y(NKe,{nullable:!0}),json:Y(st(fe({})),{nullable:!0}),snapshotId:Y(Zie,{nullable:!0}),html:Y(H.pipe(yo(1)),{nullable:!0}),markdown:Y(H.pipe(yo(1)),{nullable:!0}),screenshot:Y(fe({url:H,fullPage:St}),{nullable:!0}),search:Y(kk,{nullable:!0}),links:Y(st(LKe),{nullable:!0}),appendix:Y(H.pipe(yo(1)),{nullable:!0}),renderEngines:Y(BKe,{nullable:!0}),assets:Y(st(iN),{nullable:!0}),degraded:Y(Yie,{nullable:!0})}),{nullable:!0}),error:Y(gt(Z3,eG,ab,cb,lb),{nullable:!0})}){}class zKe extends fe({total:Et,limit:Et,offset:Et,hasMore:St}){}class $Ke extends mr("BatchedStatus")({id:H,status:vKe,batchedStatus:TKe,totalUrls:Et,results:st(WKe),pagination:zKe}){}class jKe extends qe("BatchedIncludeUnsupported"){}class VKe extends fe({unsupportedFields:st(H),_tag:jKe}){}class GKe extends gt(wk,VKe){}class KKe extends qe("CANCELLING","CANCELLED"){}class JKe extends mr("BatchedCancellation")({id:H,status:KKe}){}class QKe extends qe("COMPLETED","FAILED"){}class YKe extends qe("BatchedCancellationConflict"){}class ZKe extends mr("BatchedCancellationConflict")({id:H,status:QKe,_tag:YKe}){}var XKe=(e,t={})=>{let r=(s,i)=>L(GQ(i.text,()=>"Unexpected status code"),(a)=>ie(new bs({request:s,response:i,reason:"StatusCode",description:a}))),n=(s)=>t.transformClient?t.transformClient(s):N(s),o=(s,i)=>L(ph(i)(s),ie);return{fetchFetch:(s)=>QE("POST")("/v1/fetch").pipe(NF({include:s.params.include}),(i)=>Pr(j_(i,s.payload)),L((i)=>L(n(e),(a)=>L(a.execute(i),YE({"400":(c)=>o(c,Y3),"401":(c)=>o(c,lf),"403":(c)=>o(c,X3),"413":(c)=>o(c,VGe),"429":(c)=>o(c,uf),"500":(c)=>o(c,pf),"502":(c)=>o(c,ab),"503":(c)=>o(c,ff),"504":(c)=>o(c,cb),"529":(c)=>o(c,lb),orElse:(c)=>r(i,c)}))))),fetchFetchJson:(s)=>QE("POST")("/v1/fetch/json").pipe(NF({include:s.params.include}),(i)=>Pr(j_(i,s.payload)),L((i)=>L(n(e),(a)=>L(a.execute(i),YE({"200":(c)=>ph(aN)(c),"400":(c)=>o(c,sG),"401":(c)=>o(c,lf),"403":(c)=>o(c,iG),"413":(c)=>o(c,xKe),"429":(c)=>o(c,uf),"500":(c)=>o(c,pf),"502":(c)=>o(c,ab),"503":(c)=>o(c,ff),"504":(c)=>o(c,cb),"529":(c)=>o(c,lb),orElse:(c)=>r(i,c)}))))),fetchFetchSearch:(s)=>QE("POST")("/v1/fetch/search").pipe((i)=>Pr(j_(i,s)),L((i)=>L(n(e),(a)=>L(a.execute(i),YE({"200":(c)=>ph(SKe)(c),"400":(c)=>o(c,aG),"401":(c)=>o(c,lf),"403":(c)=>o(c,cG),"404":(c)=>o(c,lG),"413":(c)=>o(c,df),"429":(c)=>o(c,uf),"500":(c)=>o(c,pf),"503":(c)=>o(c,ff),orElse:(c)=>r(i,c)}))))),fetchBatched:(s)=>QE("POST")("/v1/fetch/batched").pipe(Dse({"x-idempotency-key":s.params["x-idempotency-key"]??void 0}),(i)=>Pr(j_(i,s.payload)),L((i)=>L(n(e),(a)=>L(a.execute(i),YE({"200":(c)=>ph(CKe)(c),"400":(c)=>o(c,wKe),"401":(c)=>o(c,lf),"403":(c)=>o(c,IKe),"409":(c)=>o(c,_Ke),"413":(c)=>o(c,df),"429":(c)=>o(c,uf),"500":(c)=>o(c,pf),"503":(c)=>o(c,ff),orElse:(c)=>r(i,c)}))))),fetchGetBatched:(s,i)=>QE("GET")(`/v1/fetch/batched/${s}`).pipe(NF({limit:i.limit,offset:i.offset,include:i.include}),N,L((a)=>L(n(e),(c)=>L(c.execute(a),YE({"200":(l)=>ph($Ke)(l),"400":(l)=>o(l,GKe),"401":(l)=>o(l,lf),"413":(l)=>o(l,df),"429":(l)=>o(l,uf),"500":(l)=>o(l,pf),"503":(l)=>o(l,ff),orElse:(l)=>r(a,l)}))))),fetchCancelBatched:(s)=>QE("POST")(`/v1/fetch/batched/${s}/cancel`).pipe(N,L((i)=>L(n(e),(a)=>L(a.execute(i),YE({"200":(c)=>ph(JKe)(c),"400":(c)=>o(c,wk),"401":(c)=>o(c,lf),"409":(c)=>o(c,ZKe),"413":(c)=>o(c,df),"429":(c)=>o(c,uf),"500":(c)=>o(c,pf),"503":(c)=>o(c,ff),orElse:(c)=>r(i,c)})))))}};function cN(e,t){return m.flatMap(m.orElseSucceed(t.text,()=>"Unexpected status code"),(r)=>m.fail(new Tx.ResponseError({request:e,response:t,reason:"StatusCode",description:r})))}function Nn(e,t){return m.flatMap(si.schemaBodyJson(t)(e),m.fail)}var NKt=x.Struct({...kk.fields.snippets.value.fields,json:x.optionalWith(x.Unknown,{nullable:!0})}),e4e=x.Struct({...kk.fields,snippets:x.Array(NKt)});class t4e extends x.Class("FetchObjectModeResultWithJson")({...aN.fields,data:x.optionalWith(x.Struct({...aN.fields.data.from.fields,search:x.optionalWith(e4e,{nullable:!0})}),{nullable:!0})}){}class r4e extends x.Class("FetchSnapshotSearchResultWithJson")({snapshotId:x.String.pipe(x.minLength(1)),response:Ik,search:e4e,durationMs:x.Number.pipe(x.greaterThanOrEqualTo(0)),playground:x.String}){}var eae=(e,t)=>Kn.make("POST")("/v1/fetch/json").pipe(Kn.setUrlParams(t.params.include!==void 0?{include:t.params.include}:{}),(r)=>m.orDie(Kn.bodyJson(r,t.payload)),m.flatMap((r)=>m.flatMap(e.execute(r),si.matchStatus({"200":(n)=>si.schemaBodyJson(t4e)(n),"400":(n)=>Nn(n,sG),"401":(n)=>Nn(n,lf),"403":(n)=>Nn(n,iG),"413":(n)=>Nn(n,df),"429":(n)=>Nn(n,uf),"500":(n)=>Nn(n,pf),"502":(n)=>Nn(n,ab),"503":(n)=>Nn(n,ff),"504":(n)=>Nn(n,cb),"529":(n)=>Nn(n,lb),orElse:(n)=>cN(r,n)})))),n4e=(e,t)=>Kn.make("POST")("/v1/fetch/search").pipe((r)=>m.orDie(Kn.bodyJson(r,t)),m.flatMap((r)=>m.flatMap(e.execute(r),si.matchStatus({"200":(n)=>si.schemaBodyJson(r4e)(n),"400":(n)=>Nn(n,aG),"401":(n)=>Nn(n,lf),"403":(n)=>Nn(n,cG),"404":(n)=>Nn(n,lG),"413":(n)=>Nn(n,df),"429":(n)=>Nn(n,uf),"500":(n)=>Nn(n,pf),"503":(n)=>Nn(n,ff),orElse:(n)=>cN(r,n)}))));var cv="/api/auth/oauth2/token",LKt="expandai-cli",UKt=x.transform(x.Number,x.DurationFromSelf,{strict:!0,decode:Gr.seconds,encode:Gr.toSeconds});class o4e extends x.Class("OAuthTokenResponse")({access_token:x.String,refresh_token:x.optional(x.String),expires_in:UKt,token_type:x.String,scope:x.optional(x.String)}){}class lv extends x.TaggedError()("OAuthTokenRequestFailed",{endpoint:x.String,error:x.Defect,status:x.optional(x.Number)}){get message(){return`OAuth request to ${this.endpoint} failed${this.status?` (${this.status})`:""}: ${kr.format(this.error)}`}}class s4e extends x.TaggedError()("OAuthTokenInvalidGrant",{}){}function tae(e){return e}var HKt=x.parseJson(x.Struct({error:x.String})),qKt=x.decodeUnknownOption(HKt);class uG extends m.Service()("@expandai/cli/Auth/OAuthTokenClient",{dependencies:[dh.layer,Cr.Default],effect:m.gen(function*(){let e=yield*Gl.HttpClient,t=yield*Cr,r=m.fn("OAuthTokenClient.exchangeToken")(function*(o){yield*t.ensureSecureStorage();let s=yield*t.getApiUrl(),i=s.toString(),a=Kn.post(new URL(cv,s)).pipe(Kn.bodyUrlParams([...o,["resource",i]]));return yield*e.execute(a).pipe(m.flatMap(si.matchStatus({"200":(c)=>si.schemaBodyJson(o4e)(c),orElse:(c)=>c.text.pipe(m.flatMap((l)=>q.match(qKt(l),{onNone:()=>tae(new lv({endpoint:cv,status:c.status,error:l})),onSome:({error:u})=>Q.value(u).pipe(Q.when("invalid_grant",()=>tae(new s4e)),Q.orElse(()=>tae(new lv({endpoint:cv,status:c.status,error:l}))))})))})),m.catchTags({RequestError:(c)=>new lv({endpoint:cv,error:c}),ResponseError:(c)=>new lv({endpoint:cv,error:c}),ParseError:(c)=>new lv({endpoint:cv,error:c})}))});return{refreshToken:m.fn("OAuthTokenClient.refreshToken")(function*(o,s=LKt){return yield*r([["grant_type","refresh_token"],["client_id",s],["refresh_token",o]])})}})}){}class pG extends Bt.Tag("@expandai/cli/Mcp/RequestHeaders/CurrentRequestHeaders")(){static Default=Tt.succeed(this,{})}class a4e extends x.TaggedError()("ApiRequestFailed",{detail:x.String}){get message(){return this.detail}}var BKt=Gr.minutes(1);class c4e extends _m.TaggedError("OAuthAuthMethodChanged"){}function fG(e,t){return typeof e==="object"&&e!==null&&t in e?e[t]:void 0}function lN(e,t){let r=fG(e,t);return typeof r==="string"?r:void 0}function i4e(e,t){let r=fG(e,t);return typeof r==="number"?r:void 0}function WKt(e){let t=fG(e,"issues");return Array.isArray(t)?t:[]}function zKt(e){let t=fG(e,"unsupportedFields");return Array.isArray(t)?t.filter((r)=>typeof r==="string"):[]}function $Kt({path:e,message:t}){let r=e.map((n)=>typeof n==="object"?n.key:String(n)).join(".");return r?`${r}: ${t}`:t}function jKt(e){switch(lN(e,"_tag")){case"HttpApiDecodeError":{let t=WKt(e);return t.length===0?lN(e,"message")??"Invalid request":t.map($Kt).join("; ")}case"AuthFailed":return`Authentication failed (${lN(e,"reason")??"unknown"}). ${k3}`;case"AccessBlocked":return"Access blocked. Check your billing status or contact support.";case"BatchedIncludeUnsupported":return`Unsupported batched include fields: ${zKt(e).join(", ")}.`;case"FetchSnapshotSearchNotFound":return"Fetch snapshot not found.";case"FetchNavigationFailed":return`The target page could not be captured because browser navigation failed (${lN(e,"failureType")??"unknown"}).`;case"FetchCaptureTimeout":{let t=i4e(e,"timeoutMs");return t===void 0?"No publishable capture result reached the API before the server deadline. Automatic retry is disabled; a deliberate retry may still be appropriate.":`No publishable capture result reached the API before the ${t} ms server deadline. Automatic retry is disabled; a deliberate retry may still be appropriate.`}case"FetchCapacityTimeout":{let t=i4e(e,"timeoutMs");return t===void 0?"The capture could not start before the server deadline because capacity was unavailable. Retry shortly.":`The capture could not start within ${t} ms because capacity was unavailable. Retry shortly.`}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 e instanceof Error?e.message:lN(e,"message")??"Expand API request failed."}}var uv=(e)=>e.pipe(m.catchAll((t)=>new a4e({detail:jKt(t)})));class ya extends m.Service()("@expandai/cli/ApiClient",{dependencies:[dh.layer,Cr.Default,uG.Default],scoped:m.gen(function*(){let e=yield*Cr,t=yield*uG,r=yield*Gl.HttpClient,n=yield*m.makeSemaphore(1),o=m.fn("ApiClient.freshOAuthAccessToken")(function*({accessToken:f,expiresAt:h,refreshToken:y}){let E=yield*ar.now,b=y===void 0?E:ar.addDuration(E,BKt);if(ar.lessThan(b,h))return q.some(da.value(f));return q.none()}),s=m.fn("ApiClient.refreshOAuthToken")(function*({refreshToken:f,expiresAt:h,clientId:y}){if(f===void 0)return yield*new KF({expiredAt:h});let E=yield*ar.now,b=yield*t.refreshToken(da.value(f),y).pipe(m.catchTag("OAuthTokenInvalidGrant",()=>new KF({expiredAt:h})));if(b===void 0)return yield*new KF({expiredAt:h});let w=ar.addDuration(E,b.expires_in),T=b.refresh_token===void 0?f:da.make(b.refresh_token);return yield*e.updateConfig({authMethod:GF.make({accessToken:da.make(b.access_token),refreshToken:T,expiresAt:w,clientId:y})}),b.access_token}),i=m.fn("ApiClient.oauthBearerToken")(function*(f){let h=yield*o(f);if(q.isSome(h))return h.value;return yield*n.withPermits(1)(m.gen(function*(){let{authMethod:y}=yield*e.loadConfig();if(y._tag!=="OAuth")return yield*new c4e({});let E=yield*o(y);if(q.isSome(E))return E.value;return yield*s(y)}))}),a=()=>m.gen(function*(){let f=yield*m.serviceOption(pG).pipe(m.map(q.getOrElse(()=>({})))),h=q.fromNullable(f.authorization);if(q.isSome(h)){let T=yield*e.getApiUrl(),A=ry(Kn.prependUrl(T.toString()),Kn.setHeader("authorization",h.value));return r.pipe(Gl.mapRequest(A))}let{authMethod:y,apiUrl:E}=yield*e.loadConfig(),b=yield*Q.value(y).pipe(Q.tag("ApiKey",({apiKey:T})=>m.succeed(Kn.setHeader("x-expand-api-key",da.value(T)))),Q.tag("OAuth",(T)=>i(T).pipe(m.map((A)=>Kn.bearerToken(A)))),Q.exhaustive),w=ry(Kn.prependUrl(E.toString()),b);return r.pipe(Gl.mapRequest(w))}),c=()=>a().pipe(m.catchTag("OAuthAuthMethodChanged",()=>a())),l=()=>c().pipe(m.map(XKe)),u=(f,h)=>Kn.make("POST")("/v1/fetch").pipe(Kn.setUrlParams(h.params.include!==void 0?{include:h.params.include}:{}),(y)=>m.orDie(Kn.bodyJson(y,h.payload)),m.flatMap((y)=>m.flatMap(f.execute(y),si.matchStatus({"200":(E)=>E.text,"400":(E)=>Nn(E,Y3),"401":(E)=>Nn(E,lf),"403":(E)=>Nn(E,X3),"413":(E)=>Nn(E,df),"429":(E)=>Nn(E,uf),"500":(E)=>Nn(E,pf),"502":(E)=>Nn(E,ab),"503":(E)=>Nn(E,ff),"504":(E)=>Nn(E,cb),"529":(E)=>Nn(E,lb),orElse:(E)=>cN(y,E)}))));return{fetchFetch:(...f)=>c().pipe(m.flatMap((h)=>u(h,...f).pipe(uv))),fetchFetchResult:(...f)=>c().pipe(m.flatMap((h)=>eae(h,...f).pipe(uv))),fetchFetchJson:(...f)=>c().pipe(m.flatMap((h)=>eae(h,...f).pipe(uv))),fetchFetchSearch:(...f)=>c().pipe(m.flatMap((h)=>n4e(h,...f).pipe(uv))),fetchBatched:(...f)=>l().pipe(m.flatMap((h)=>h.fetchBatched(...f).pipe(uv))),fetchGetBatched:(...f)=>l().pipe(m.flatMap((h)=>h.fetchGetBatched(...f).pipe(uv)))}})}){}var VKt=/^playground:\s*"?([^"\n]+)"?\s*$/mu;function l4e(e){let t=VKt.exec(e)?.[1]?.trim();if(t===void 0||t.length===0)return e;let r=Sn.stripMargin(`
|
|
567
|
+
|---
|
|
568
|
+
|
|
|
569
|
+
|> Cite what you take from this page. Evidence ids are stamped next to the text they
|
|
570
|
+
|> belong to, written as \`{1199}\`. End your answer with:
|
|
571
|
+
|>
|
|
572
|
+
|> **Sources**
|
|
573
|
+
|> [1] [<page title>](${t}?id=<evidence id>)
|
|
574
|
+
|>
|
|
575
|
+
|> One marker per sentence, numbered in order. Never invent an evidence id, and never
|
|
576
|
+
|> reuse an id from different text. A link without \`?id=\` is not a citation, so if the
|
|
577
|
+
|> sentence you want carries no id, quote one that does or say the capture has none —
|
|
578
|
+
|> never fall back to linking the original page.
|
|
579
|
+
|>
|
|
580
|
+
|> An id covers its whole block. To cite one cell of a table, append
|
|
581
|
+
|> \`&row=<r>&col=<c>\`. Both are 0-indexed, counted within that table alone:
|
|
582
|
+
|> \`row\` over body rows only (header and \`|---|\` separator excluded),
|
|
583
|
+
|> \`col=0\` the label column.`);return`${e.trimEnd()}
|
|
584
|
+
|
|
585
|
+
${r}
|
|
586
|
+
`}function dG(e,t,r){return`${Sn.stripMargin(`
|
|
587
|
+
|> Fetched via expand.ai (snapshot \`${t}\`). Capture: ${r}
|
|
588
|
+
|>
|
|
589
|
+
|> Cite every claim you take from this page. The body below stamps an evidence id next
|
|
590
|
+
|> to the text it belongs to, written as \`{1199}\`. For each sentence you use, take the
|
|
591
|
+
|> id nearest that text and end your answer with:
|
|
592
|
+
|>
|
|
593
|
+
|> **Sources**
|
|
594
|
+
|> [1] [<page title>](${r}?id=<evidence id>)
|
|
595
|
+
|>
|
|
596
|
+
|> Number the markers \`[1]\`, \`[2]\`, … in the order they appear, one per sentence.
|
|
597
|
+
|> An id covers its whole block, so to cite one cell of a table append
|
|
598
|
+
|> \`&row=<r>&col=<c>\`. Both are 0-indexed, counted within that table alone:
|
|
599
|
+
|> \`row\` over body rows only (header and \`|---|\` separator excluded),
|
|
600
|
+
|> \`col=0\` the label column.
|
|
601
|
+
|> Never invent an evidence id, and never reuse an id from different text.
|
|
602
|
+
|> A bare capture link without \`?id=\` is not a citation — the reader cannot
|
|
603
|
+
|> check the sentence against the page. If the sentence you want carries no id, quote
|
|
604
|
+
|> one that does, or say the capture has none. Never fall back to the original page URL.
|
|
605
|
+
|>
|
|
606
|
+
|> To extract specific passages, search the snapshot by handle — call the \`fetch_search\`
|
|
607
|
+
|> tool with \`snapshotId: "${t}"\`, or run \`expandai search ${t} "<query>"\`.
|
|
608
|
+
|> Each snippet returns a \`citationUrl\` that already carries the right \`?id=\`.
|
|
609
|
+
|> Do not fetch this URL again.`)}
|
|
610
|
+
|
|
611
|
+
---
|
|
612
|
+
|
|
613
|
+
${e}`}function p4e(e={isTty:process.stdout.isTTY===!0,env:process.env}){let{env:t,isTty:r}=e,n=t.FORCE_COLOR?.trim();if(n!==void 0&&n!=="")return n!=="0";if(t.NO_COLOR!==void 0&&t.NO_COLOR!=="")return!1;if(t.TERM==="dumb")return!1;return r}function Wx(e,t){return t===""?t:`${e}${t}\x1B[0m`}function rae(e,t){let r=[],n=e.replace(/`[^`\n]+`/g,(o)=>(r.push(`\x1B[36m${o}\x1B[0m`),`\x00${r.length-1}\x00`));if(t?.dimPipes)n=n.replaceAll("|","\x1B[2m|\x1B[0m");return n=n.replace(/\[([^\]\n]*)\]\(([^)\n]*)\)/g,(o,s,i)=>`\x1B[2m[\x1B[0m\x1B[34;4m${s}\x1B[0m\x1B[2m](${i})\x1B[0m`),n=n.replace(/\*\*([^*\n]+)\*\*/g,(o,s)=>`\x1B[1m**${s}**\x1B[0m`),n.replace(/\x00(\d+)\x00/g,(o,s)=>r[Number(s)]??"")}var u4e=/^(\s*)(`{3,}|~{3,})(.*)$/,GKt=/^#{1,6}\s/,KKt=/^ {0,3}(-{3,}|\*{3,}|_{3,})\s*$/,JKt=/^(\s*)([-*+]|\d{1,9}[.)])(\s+)(.*)$/,QKt=/^(\s*)([\w.-]+):(.*)$/;function f4e(e){let t=e.split(`
|
|
614
|
+
`),r=[],n=!1,o;return t.forEach((s,i)=>{if(o){if(u4e.test(s)&&o.test(s))o=void 0,r.push(Wx("\x1B[2m",s));else r.push(Wx("\x1B[33m",s));return}if(i===0&&s==="---"){n=!0,r.push(Wx("\x1B[2m",s));return}if(n){if(s==="---"){n=!1,r.push(Wx("\x1B[2m",s));return}let l=s.match(QKt);r.push(l?`${l[1]}\x1B[36m${l[2]}\x1B[0m\x1B[2m:${l[3]}\x1B[0m`:Wx("\x1B[2m",s));return}let a=s.match(u4e);if(a){let l=a[2]??"```";o=new RegExp(`^\\s*${l[0]==="`"?"`":"~"}{${l.length},}\\s*$`),r.push(Wx("\x1B[2m",s));return}if(GKt.test(s)){r.push(Wx("\x1B[1;36m",s));return}if(KKt.test(s)){r.push(Wx("\x1B[2m",s));return}if(s.trimStart().startsWith(">")){r.push(Wx("\x1B[32m",s));return}if(s.trimStart().startsWith("|")){r.push(rae(s,{dimPipes:!0}));return}let c=s.match(JKt);if(c){r.push(`${c[1]}\x1B[33m${c[2]}\x1B[0m${c[3]}${rae(c[4]??"")}`);return}r.push(rae(s))}),r.join(`
|
|
615
|
+
`)}var YKt=x.encodeSync(x.parseJson(x.Unknown,{space:2}));function d4e(e,t,r){return r.map((n)=>({...n,citationUrl:Q_(e,n.location,t)}))}function mG(e,t,r){return r.map((n)=>{let o=Q_(e,n.location,t),s=`[${n.source} · score ${n.score.toFixed(2)}] ${o}`,i=n.json==null?"":`
|
|
616
|
+
|
|
617
|
+
${YKt(n.json)}`;return`${s}
|
|
618
|
+
|
|
619
|
+
${n.text}${i}`}).join(`
|
|
620
|
+
|
|
621
|
+
---
|
|
622
|
+
|
|
623
|
+
`)}class pv extends x.TaggedError()("MarkdownUnavailable",{url:x.String}){get message(){return`No markdown content was returned for ${this.url}`}}class m4e extends x.TaggedError()("SnippetsUnavailable",{url:x.String,query:x.String}){get message(){return`No snippets were returned for ${this.url} matching '${this.query}'`}}var ZKt=m.fn("Fetch.parseUrlArg")(function*(e){if(e.startsWith("-"))return yield*m.fail(ek.p(`Missing argument <url> (received '${e}')`));let t=e.startsWith("http://")||e.startsWith("https://")?e:`https://${e}`,r=yield*m.try({try:()=>new URL(t),catch:()=>ek.p(`Invalid URL '${e}'`)});if(!r.hostname.includes(".")&&r.hostname!=="localhost")return yield*m.fail(ek.p(`URL must contain a valid domain (got '${e}')`));return r}),XKt=Mo.text({name:"url"}).pipe(Mo.mapEffect(ZKt)),e4t=bt.text("format").pipe(bt.withDefault("text"),bt.withDescription("Output format (text or json)"),bt.withSchema(x.Literal("text","json"))),t4t=bt.text("search").pipe(bt.optional,bt.withDescription("Semantic search query. Returns relevant snippets instead of markdown.")),r4t=bt.integer("max-results").pipe(bt.withDefault(5),bt.withDescription("Maximum snippets to return when using --search (default: 5)"),bt.withSchema(x.Int.pipe(x.greaterThanOrEqualTo(1),x.lessThanOrEqualTo(50)))),n4t=bt.float("min-score").pipe(bt.withDefault(0.6),bt.withDescription("Minimum snippet relevance score from 0 to 1 when using --search (default: 0.6)"),bt.withSchema(x.Number.pipe(x.greaterThanOrEqualTo(0),x.lessThanOrEqualTo(1)))),o4t={url:XKt,format:e4t,search:t4t,maxResults:r4t,minScore:n4t},nae=Te.make("fetch",o4t).pipe(Te.withDescription("Fetch content from a URL as markdown or snippets"),Te.withHandler(m.fnUntraced(function*({format:e,maxResults:t,minScore:r,search:n,url:o}){let s=yield*ya,i=q.getOrUndefined(n),a=i===void 0?{params:{},payload:{url:o.toString(),include:{markdown:!0}}}:{params:{},payload:{url:o.toString(),include:{markdown:!0,json:!0},search:{query:i,maxResults:t,minScore:r}}},c=e==="text"&&i===void 0?yield*s.fetchFetch(a).pipe(m.flatMap((l)=>Sn.isNonEmpty(l)?m.succeed(l):m.fail(new pv({url:o.toString()}))),m.map((l)=>p4e()?f4e(l):l4e(l))):yield*s.fetchFetchResult(a).pipe(m.flatMap((l)=>Q.value(e).pipe(Q.when("text",()=>{let u=l.data?.search?.snippets??[];return u.length===0?m.fail(new m4e({url:o.toString(),query:i??""})):m.succeed(mG(l.meta.snapshotId,nb(l.meta.playground,jF),u))}),Q.when("json",()=>{let u=l.data?.search,f=u==null?l:{...l,data:{...l.data,search:{...u,snippets:d4e(l.meta.snapshotId,nb(l.meta.playground,jF),u.snippets)}}};return x.encode(x.parseJson(x.Unknown,{space:2}))(f)}),Q.exhaustive)));yield*ft.log(c)},m.provide(ya.Default))));class uN extends x.TaggedError()("StdinReadError",{error:x.Defect}){get message(){return"Failed to read hook payload from stdin."}}class zx extends x.TaggedError()("HookProtocolFailed",{error:x.Defect,url:x.optional(x.String)}){get message(){let e=this.error instanceof Error?this.error.message:"Hook protocol failed.";return this.url?`${e} (url: ${this.url})`:e}}var s4t="WebFetch";class h4e extends x.Class("WebFetchToolInput")({url:x.String,prompt:x.optional(x.String)}){}class g4e extends x.Class("PreToolUseHookPayload")({hook_event_name:x.Literal("PreToolUse"),tool_name:x.String,tool_input:h4e}){}var i4t=x.decode(x.parseJson(g4e)),a4t=x.encode(x.parseJson(x.Unknown)),c4t=fh.toString(()=>process.stdin,{onFailure:(e)=>new uN({error:e}),encoding:"utf8"});class fv extends m.Service()("@expandai/cli/Hook/Claude",{dependencies:[ya.Default],effect:m.gen(function*(){let e=yield*ya;return{runProtocol:m.fn("ClaudeHook.runProtocol")(function*(){let r=yield*c4t.pipe(m.mapError((s)=>new zx({error:s}))),n=yield*i4t(r).pipe(m.mapError((s)=>new zx({error:s})));if(n.tool_name!==s4t)return;let o=n.tool_input.url;yield*m.gen(function*(){let s=yield*e.fetchFetchResult({params:{},payload:{url:o,include:{markdown:!0}}});if(Sn.isEmpty(s.markdown))return yield*new pv({url:o});let i={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:dG(s.markdown,s.meta.snapshotId,s.meta.playground)}};yield*ft.log(yield*a4t(i))}).pipe(m.mapError((s)=>new zx({error:s,url:o})))})}})}){}class x4e extends x.Class("OpencodeWebfetchInput")({url:x.String}){}var l4t=x.decode(x.parseJson(x4e)),u4t=x.encode(x.parseJson(x.Unknown)),p4t=fh.toString(()=>process.stdin,{onFailure:(e)=>new uN({error:e}),encoding:"utf8"});class dv extends m.Service()("@expandai/cli/Hook/Opencode",{dependencies:[ya.Default],effect:m.gen(function*(){let e=yield*ya;return{runProtocol:m.fn("OpencodeHook.runProtocol")(function*(){let r=yield*p4t.pipe(m.mapError((s)=>new zx({error:s}))),o=(yield*l4t(r).pipe(m.mapError((s)=>new zx({error:s})))).url;yield*m.gen(function*(){let s=yield*e.fetchFetchResult({params:{},payload:{url:o,include:{markdown:!0}}});if(Sn.isEmpty(s.markdown))return yield*new pv({url:o});let i=dG(s.markdown,s.meta.snapshotId,s.meta.playground);yield*ft.log(yield*u4t({markdown:i}))}).pipe(m.mapError((s)=>new zx({error:s,url:o})))})}})}){}var y4e=Te.make("claude-code").pipe(Te.withDescription("Run the Claude Code WebFetch hook protocol over stdio"),Te.withHandler(()=>m.flatMap(fv,(e)=>e.runProtocol()))),S4e=Te.make("opencode").pipe(Te.withDescription("Run the OpenCode webfetch plugin protocol over stdio"),Te.withHandler(()=>m.flatMap(dv,(e)=>e.runProtocol()))),E4e=Mo.choice([["claude-code","claude-code"],["opencode","opencode"]]),b4e=Mo.choice([["global","global"],["project","project"]]),f4t=Te.make("install",{host:E4e,scope:b4e}).pipe(Te.withDescription("Install the expandai MCP server + webfetch hook for the chosen host + scope"),Te.withHandler(({host:e,scope:t})=>m.flatMap(Sh,(r)=>r.install(e,t)))),d4t=Te.make("uninstall",{host:E4e,scope:b4e}).pipe(Te.withDescription("Remove the expandai MCP server + webfetch hook for the chosen host + scope"),Te.withHandler(({host:e,scope:t})=>m.flatMap(Sh,(r)=>r.uninstall(e,t)))),C4e=Te.make("hook").pipe(Te.withDescription("expandai hooks for AI coding assistants"),Te.withSubcommands([y4e,S4e,f4t,d4t])),w4e=Te.make("hook").pipe(Te.withDescription("expandai hooks for AI coding assistants"),Te.withSubcommands([y4e,S4e]));import{homedir as m4t}from"node:os";var k4e=["claude-code","cursor","opencode","codex"];function h4t(e){return e!==void 0&&e!==""&&e!=="0"&&e!=="false"}function I4e(e){let t=x.decodeUnknownOption($s)(e.EXPANDAI_HARNESS);if(q.isSome(t))return t;if(h4t(e.CLAUDECODE))return q.some("claude-code");if(e.CURSOR_TRACE_ID!==void 0)return q.some("cursor");if(e.CODEX_RUN_ID!==void 0)return q.some("codex");return q.none()}class $x extends m.Service()("@expandai/cli/Init/HarnessDetector",{dependencies:[xa.layer,Ac.layer],effect:m.gen(function*(){let e=yield*un.FileSystem,t=yield*So.Path,r=m.fn("HarnessDetector.detect")(function*(o={}){let s=o.environment??process.env,i=o.cwd??s.PWD??process.cwd(),a=s.HOME??m4t(),c=new Map([["claude-code",[t.join(a,".claude"),t.join(i,".claude")]],["cursor",[t.join(a,".cursor"),t.join(i,".cursor")]],["opencode",[t.join(a,".config","opencode"),t.join(i,".opencode"),t.join(i,"opencode.json")]],["codex",[t.join(a,".codex"),t.join(i,".codex")]]]),l=new Set,u=I4e(s);if(q.isSome(u))l.add(u.value);if(o.hint!==void 0)l.add(o.hint);let f=yield*m.forEach(k4e,(h)=>m.exists(c.get(h)??[],(y)=>e.exists(y).pipe(m.orElseSucceed(()=>!1))).pipe(m.map((y)=>({harness:h,exists:y}))),{concurrency:"unbounded"});for(let{harness:h,exists:y}of f)if(y)l.add(h);return k4e.filter((h)=>l.has(h))}),n=m.fnUntraced(function*(o={}){return I4e(o.environment??process.env)});return{detect:r,detectCurrent:n}})}){}import{homedir as g4t}from"node:os";var jx=ii,x4t="managed_mcp_only",y4t="managed_mcp_denied",S4t="managed_mcp_not_allowed",iae="target_read_only",E4t=x.parseJson(x.Record({key:x.String,value:x.Unknown})),b4t=/^\s*expandai-profile-version:\s*([^\s]+)\s*$/mu,C4t=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/u,oae=new TextEncoder,w4t=new TextDecoder,A4e=4095;function v4e(e){return typeof e==="object"&&e!==null&&!ct.isArray(e)}function k4t(){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 pN extends m.Service()("@expandai/cli/Init/ClaudeManagedSettingsLocations",{sync:k4t}){static testLayer(e){return Tt.succeed(pN,pN.make(e))}}function O4e(e){if(!ct.isArray(e))return!1;return e.some((t)=>{if(t===co)return!0;if(!v4e(t))return!1;return t.name===co||t.serverName===co})}function I4t(e){let t=new Set,r=e.some((s)=>s.allowManagedMcpServersOnly===!0),n=e.some((s)=>ct.isArray(s.allowedMcpServers)),o=e.some((s)=>O4e(s.allowedMcpServers));for(let s of e)if(O4e(s.deniedMcpServers))t.add(y4t);if(r&&!o)t.add(x4t);if(n&&!o)t.add(S4t);return[...t].sort()}function T4e(e){if(e===void 0)return;return b4t.exec(e)?.[1]}function _4e(e){let t=C4t.exec(e),r=t?.[1],n=t?.[2],o=t?.[3];if(r===void 0||n===void 0||o===void 0)return;return{major:Number.parseInt(r,10),minor:Number.parseInt(n,10),patch:Number.parseInt(o,10),...t?.[4]===void 0?{}:{prerelease:t[4]}}}function A4t(e,t){let r=_4e(e),n=_4e(t);if(r===void 0||n===void 0)return;if(r.major!==n.major)return r.major<n.major?-1:1;if(r.minor!==n.minor)return r.minor<n.minor?-1:1;if(r.patch!==n.patch)return r.patch<n.patch?-1:1;if(r.prerelease===n.prerelease)return 0;if(r.prerelease===void 0)return 1;if(n.prerelease===void 0)return-1;return}function O4t(e){if(!v4e(e))return e===void 0?[]:["owned-entry"];let{command:t,args:r}=e;if(t==="npx"&&ct.isArray(r)&&r[0]==="-y")return["npx-y"];if(typeof t==="string"&&t!=="expandai"&&/(?:^|[\\/])expandai(?:\.exe)?$/u.test(t))return["absolute-path"];return["owned-entry"]}function sae(e,t,r){let n=rN(t.skillText,t.bundledSkillText,jx),o=T4e(t.skillText),s=t.skillText!==void 0&&!n.changed,i=t.mcp.mcpServers[co],a=!j3(t.mcp,r).changed,c=[];if(s)c.push("runtime-skill");if(a)c.push("mcp");let l=I4t(t.managedSettings);if(t.readOnlyTargets.length>0)l.push(iae);return{scope:e,targets:t.targets,hook:{current:!0,installed:!1,legacyVariants:[]},skill:{current:s,installed:t.skillText!==void 0,legacyVariants:t.skillText===void 0||s?[]:["outdated-runtime-skill"],...o===void 0?{}:{version:o}},mcp:{current:a,installed:i!==void 0,legacyVariants:a?[]:O4t(i)},components:c,configured:c.length===2,profileVersion:jx,componentVersions:{...o===void 0?{}:{skill:o},...a?{mcp:jx}:{}},policyBlocks:[...new Set(l)].sort(),remotePolicyMayApply:!0,reloadMayBeRequired:!a,consentMayBeRequired:e==="project"}}var _4t=m.gen(function*(){let e=yield*un.FileSystem,t=yield*So.Path,r=yield*pN,n=yield*(yield*tl).resolve(),o=yield*Ae.string("HOME").pipe(Ae.withDefault(g4t())),s=yield*Ae.string("PWD").pipe(Ae.withDefault(process.cwd())),i=t.join(yield*t.fromFileUrl(iv),Sk),a=m.fnUntraced(function*(b){return(yield*e.exists(b))?yield*e.readFileString(b):void 0}),c=m.fnUntraced(function*(b){if(!(yield*e.exists(b)))return{expected:{exists:!1}};let w=yield*e.stat(b),T=yield*e.readFile(b);return{expected:{exists:!0,type:"File",bytes:T,mode:w.mode&A4e},text:w4t.decode(T)}}),l=m.fnUntraced(function*(b){if(!(yield*e.exists(b)))return{exists:!1};let w=yield*e.stat(b);if(w.type!=="Directory")throw Error("Planned directory target is not a directory");return{exists:!0,type:"Directory",mode:w.mode&A4e}}),u=m.fnUntraced(function*(b){function w(P){let D=t.dirname(P);return D===P?[P]:[P,...w(D)]}let T=w(b),k=(yield*m.forEach(T,(P)=>e.exists(P).pipe(m.map((D)=>({candidate:P,exists:D}))))).find((P)=>P.exists)?.candidate??T[T.length-1];if(k===void 0)return!1;return((yield*e.stat(k)).mode&146)!==0}),f=m.fnUntraced(function*(b){if(b.type==="write"&&b.expected?.exists===!0&&b.expected.type==="File"&&!(yield*m.either(e.access(b.path,{writable:!0}))).pipe(mt.isRight))return!1;if(b.type==="mkdir"&&b.expected?.exists===!0)return!0;let w=t.dirname(b.path);function T(I){let M=t.dirname(I);return M===I?[I]:[I,...T(M)]}let A=T(w),k=yield*m.forEach(A,(I)=>e.exists(I).pipe(m.map((M)=>({candidate:I,exists:M})))),O=k.find((I)=>I.exists)?.candidate;if(O===void 0)return!1;let P=k.filter((I)=>I.exists);if(!(yield*m.forEach(P,({candidate:I})=>e.stat(I).pipe(m.map((M)=>M.type==="Directory"&&(process.platform==="win32"||(M.mode&73)!==0)),m.orElseSucceed(()=>!1)))).every(Boolean))return!1;return(yield*m.either(e.access(O,{writable:!0}))).pipe(mt.isRight)}),h=m.fn("ClaudeProfile.load")(function*(b){let w=b==="global"?o:s,T=t.join(w,".claude","skills",av),A=r,k=yield*m.flatMap(m.forEach(A.directories,(Z)=>e.exists(Z).pipe(m.flatMap((ne)=>ne?e.readDirectory(Z):m.succeed([])),m.map((ne)=>ne.filter((we)=>!we.startsWith(".")&&we.endsWith(".json")).sort().map((we)=>t.join(Z,we))))),(Z)=>m.succeed(Z.flat())),O={settingsFile:t.join(w,".claude","settings.json"),skillDirectory:T,skillFile:t.join(T,Sk),mcpFile:b==="global"?t.join(o,".claude.json"):t.join(s,".mcp.json"),managedSettingsFiles:[...A.files,...k],managedSettingsDirectories:A.directories},P=yield*c(O.settingsFile),D=yield*c(O.skillFile),I=yield*c(O.mcpFile),M=P.text,B=D.text,ee=I.text,j=yield*e.readFileString(i),ae=yield*x.decode(fGe)(M??"{}"),F=yield*x.decode(qx)(ee??"{}"),J=yield*m.forEach(O.managedSettingsFiles,(Z)=>a(Z).pipe(m.flatMap((ne)=>ne===void 0?m.succeed(q.none()):x.decode(E4t)(ne).pipe(m.map(q.some))))),G=yield*m.filter([O.skillFile,O.mcpFile],(Z)=>u(Z).pipe(m.map((ne)=>!ne)));return{targets:O,settings:ae,settingsExpected:P.expected,...M===void 0?{}:{settingsText:M},skillExpected:D.expected,...B===void 0?{}:{skillText:B},bundledSkillText:j,mcp:F,mcpExpected:I.expected,...ee===void 0?{}:{mcpText:ee},managedSettings:ct.getSomes(J),readOnlyTargets:G}}),y=m.fn("ClaudeProfile.inspect")(function*(b){return sae(b,yield*h(b),n)}),E=m.fn("ClaudeProfile.plan")(function*(b){let w=yield*h(b),T=b==="project"?yield*c(t.join(o,".claude","skills",av,Sk)):void 0,A=T4e(T?.text),k=A===void 0?void 0:A4t(A,jx),O=T?.text!==void 0&&k!==void 0&&k<=0?{file:t.join(o,".claude","skills",av,Sk),expected:T.expected,plan:rN(T.text,w.bundledSkillText,jx)}:void 0,P=rN(w.skillText,w.bundledSkillText,jx),D=j3(w.mcp,n),I=`${yield*x.encode(qx)(D.config)}
|
|
624
|
+
`,M=t.dirname(w.targets.settingsFile),B=t.dirname(w.targets.skillDirectory),ee=O?.plan.changed===!0?{type:"write",path:O.file,bytes:oae.encode(O.plan.text),expected:O.expected}:void 0,j=ee===void 0||!(yield*f(ee))?void 0:ee,ae=[];if(P.changed)ae.push({type:"mkdir",path:M,expected:yield*l(M)});if(P.changed)ae.push({type:"mkdir",path:B,expected:yield*l(B)}),ae.push({type:"mkdir",path:w.targets.skillDirectory,expected:yield*l(w.targets.skillDirectory)}),ae.push({type:"write",path:w.targets.skillFile,bytes:oae.encode(P.text),expected:w.skillExpected});if(j!==void 0)ae.push(j);if(D.changed)ae.push({type:"write",path:w.targets.mcpFile,bytes:oae.encode(I),expected:w.mcpExpected});let J=(yield*m.forEach(ae,f)).every(Boolean)?w:{...w,readOnlyTargets:[...w.readOnlyTargets,"mutation-requirement"]},G=sae(b,J,n),Z=sae(b,{...J,skillText:P.text,mcp:D.config,mcpText:I},n);return{changed:P.changed||j!==void 0||D.changed,inspection:G,resultInspection:Z,operations:ae}});return{inspect:y,plan:E}});class hG extends m.Service()("@expandai/cli/Init/ClaudeProfile",{dependencies:[xa.layer,Ac.layer,pN.Default,tl.Default],effect:_4t}){}class fN extends x.TaggedError()("HarnessInspectionError",{harness:$s,scope:el,error:x.Defect}){get message(){return`Failed to inspect ${this.harness} (${this.scope}): ${kr.format(this.error)}`}}class dN extends x.TaggedError()("HarnessConfigurationError",{harness:$s,scope:el,error:x.Defect}){get message(){return`Failed to configure ${this.harness} (${this.scope}): ${kr.format(this.error)}`}}var xG=x.Struct({path:x.String,operation:x.Literal("write","remove","mkdir"),error:x.Defect});class lae extends x.TaggedError()("MutationSymlinkError",{path:x.String}){get message(){return`Refusing to mutate through symbolic link ${this.path}`}}class mf extends x.TaggedError()("MutationPathChangedError",{path:x.String}){get message(){return`Path lineage changed while the mutation transaction was using ${this.path}`}}class uae extends x.TaggedError()("MutationRollbackConflictError",{path:x.String}){get message(){return`Rollback preserved concurrent state at ${this.path}`}}class yG extends x.TaggedError()("MutationValidationError",xG.fields){get message(){return`Mutation validation failed for ${this.path}: ${kr.format(this.error)}`}}class mv extends x.TaggedError()("MutationApplicationError",{...xG.fields,rollbackFailures:x.Array(xG)}){get message(){let e=this.rollbackFailures.length===0?"":`; ${this.rollbackFailures.length} rollback operation(s) also failed`;return`Mutation failed for ${this.path}: ${kr.format(this.error)}${e}`}}class R4e extends x.TaggedError()("MutationRollbackError",{rollbackFailures:x.Array(xG)}){get message(){return`${this.rollbackFailures.length} rollback operation(s) failed after a defect or interruption`}}var aae=4095;function cae(e,t){let r=e.resolve(t),n=e.parse(r).root;function o(s){if(s===n)return[n];return[...o(e.dirname(s)),s]}return o(r)}function fae(e,t){if(e===void 0||t===void 0)return e===t;if(e.byteLength!==t.byteLength)return!1;return e.every((r,n)=>r===t[n])}function v4t(e,t){if(e===void 0||t===void 0)return e===t;return e.length===t.length&&e.every((r,n)=>r===t[n])}function gG(e,t){return e.exists===t.exists&&e.type===t.type&&e.mode===t.mode&&fae(e.bytes,t.bytes)&&v4t(e.entries,t.entries)}function Ak(e,t){return gG(e,t)&&(!e.exists||e.dev===t.dev&&e.ino===t.ino&&e.realPath===t.realPath)}function T4t(e,t){if(e.exists!==t.exists)return!1;if(!t.exists)return!0;if(e.type!==t.type||e.mode!==t.mode)return!1;return t.type==="Directory"||fae(e.bytes,t.bytes)}function R4t(e,t){return typeof e==="object"&&e!==null&&"code"in e&&e.code===t}function M4t(e,t){return e.length===t.length&&e.every((r,n)=>{let o=t[n];return o!==void 0&&r.path===o.path&&r.exists===o.exists&&r.dev===o.dev&&r.ino===o.ino&&r.realPath===o.realPath&&r.type===o.type})}function pae(e,t){return new yG({path:e.path,operation:e.type,error:t})}function Ok(e,t){return pae(e,Error(t))}function P4t(e,t){return new mv({path:e.path,operation:e.type,error:t,rollbackFailures:[]})}var D4t=m.gen(function*(){let e=yield*un.FileSystem,t=yield*So.Path,r=m.fnUntraced(function*(k){let O=yield*m.either(e.readLink(k));if(mt.isRight(O))return yield*new lae({path:k});let P=O.left;if(P instanceof Qc.SystemError&&(P.reason==="InvalidData"||P.reason==="NotFound"||P.method==="readLink"&&R4t(P.cause,"EINVAL")))return;return yield*P}),n=m.fnUntraced(function*(k){return yield*m.forEach(cae(t,k),(O)=>m.gen(function*(){if(yield*r(O),!(yield*e.exists(O)))return{path:O,exists:!1};let D=yield*e.stat(O);return{path:O,exists:!0,dev:D.dev,ino:q.getOrUndefined(D.ino),realPath:yield*e.realPath(O),type:D.type}}))}),o=m.fnUntraced(function*(k,O){let P=yield*n(k),D=yield*m.exit(O),I=yield*m.exit(n(k));if(Rr.isFailure(I))return yield*Rr.isFailure(D)?m.failCause(Mr.sequential(D.cause,I.cause)):m.failCause(I.cause);if(!M4t(P,I.value)){let M=new mf({path:k});return yield*Rr.isFailure(D)?m.failCause(Mr.sequential(D.cause,Mr.fail(M))):M}return yield*Rr.isFailure(D)?m.failCause(D.cause):m.succeed(D.value)}),s=m.fnUntraced(function*(k,O){if(!(yield*e.exists(k)))return{exists:!1};let D=yield*e.stat(k);if(D.type==="File")return{exists:!0,bytes:yield*e.readFile(k),dev:D.dev,ino:q.getOrUndefined(D.ino),mode:D.mode&aae,realPath:yield*e.realPath(k),type:"File"};if(D.type==="Directory"){let I=O?[...yield*e.readDirectory(k)].sort():void 0;return{exists:!0,dev:D.dev,...I===void 0?{}:{entries:I},ino:q.getOrUndefined(D.ino),mode:D.mode&aae,realPath:yield*e.realPath(k),type:"Directory"}}return yield*new mf({path:k})}),i=m.fnUntraced(function*(k,O=!0){return yield*o(k,s(k,O).pipe(m.flatMap((P)=>s(k,O).pipe(m.flatMap((D)=>gG(P,D)?m.succeed(D):new mf({path:k}))))))}),a=m.fnUntraced(function*(k){if("mode"in k&&k.mode!==void 0){if(!(Number.isInteger(k.mode)&&k.mode>=0&&k.mode<=aae))return yield*Ok(k,`Invalid file mode ${k.mode}`)}}),c=m.fnUntraced(function*(k){let O=new Set,P=new Set;return yield*m.forEach(k,(D)=>{let I=t.resolve(D.path);return m.gen(function*(){if(O.has(I))return yield*Ok(D,`Multiple mutations target ${I}`);O.add(I),yield*a(D);let M=yield*n(I);if(yield*m.forEach(M,(B,ee)=>{let j=ee===M.length-1;if(!B.exists)return D.type==="mkdir"||j||P.has(B.path)?m.void:Ok(D,`Parent directory does not exist: ${B.path}`);if(!j&&B.type!=="Directory")return Ok(D,`Parent path is not a directory: ${B.path}`);if(j&&D.type==="mkdir"&&B.type!=="Directory")return Ok(D,`Directory mutation targets ${B.type}: ${B.path}`);if(j&&D.type!=="mkdir"&&B.type!=="File")return Ok(D,`File mutation targets ${B.type}: ${B.path}`);return m.void},{discard:!0}),D.validate!==void 0)yield*D.validate;if(D.type==="mkdir")ct.forEach(cae(t,I),(B)=>P.add(B));return{operation:D,absolutePath:I}}).pipe(m.mapError((M)=>M instanceof yG||M instanceof lae?M:pae(D,M)))})}),l=m.fnUntraced(function*(k,O,P,D,I){let M=t.dirname(k),B=yield*m.acquireRelease(o(M,e.makeTempFile({directory:M,prefix:".expandai-init-"})),(F)=>{let J=t.dirname(F),G=t.resolve(J)!==t.resolve(M);return o(M,G?e.remove(J,{force:!0,recursive:!0}):e.remove(F,{force:!0})).pipe(m.ignore)});if(yield*o(B,e.writeFile(B,O)),D!==void 0)yield*o(B,e.chmod(B,D));let j={...yield*i(B),realPath:t.resolve(k)};yield*o(M,m.gen(function*(){let F=yield*i(k);if(!Ak(F,P))return yield*new mf({path:k});yield*m.uninterruptible(e.rename(B,k).pipe(m.zipRight(I===void 0?m.void:I(j))))}));let ae=yield*i(k);if(!Ak(ae,j))return yield*new mf({path:k});return ae},m.scoped),u=m.fnUntraced(function*(k,O,P){let D={exists:!1},I=O.type==="Directory"?e.remove(k,{recursive:!0}):e.remove(k);yield*o(t.dirname(k),m.gen(function*(){let B=yield*i(k);if(!Ak(B,O))return yield*new mf({path:k});yield*m.uninterruptible(I.pipe(m.zipRight(P===void 0?m.void:P(D))))}));let M=yield*i(k);if(!gG(M,D))return yield*new mf({path:k});return D}),f=m.fnUntraced(function*(k,O,P,D){let I=t.dirname(k),M=yield*m.acquireRelease(o(I,e.makeTempDirectory({directory:I,prefix:".expandai-init-directory-"})),(ae)=>o(I,e.remove(ae,{force:!0,recursive:!0})).pipe(m.ignore));if(P!==void 0)yield*o(M,e.chmod(M,P));let ee={...yield*i(M),realPath:t.resolve(k)};yield*o(I,m.gen(function*(){let ae=yield*i(k);if(!Ak(ae,O))return yield*new mf({path:k});yield*m.uninterruptible(e.rename(M,k).pipe(m.zipRight(D===void 0?m.void:D(ee))))}));let j=yield*i(k);if(!Ak(j,ee))return yield*new mf({path:k});return j},m.scoped),h=(k,O,P,D)=>m.exit(D).pipe(m.flatMap((I)=>Rr.isSuccess(I)?m.void:m.sync(()=>{k.push({path:O,operation:P,error:I.cause})}).pipe(m.zipRight(m.logError(`Rollback failed for ${O} (${P})`,Mr.pretty(I.cause)))))),y=m.fnUntraced(function*(k,O,P,D){let I=yield*i(k);if(!Ak(I,O))return yield*new uae({path:k});yield*D(I);let M=yield*i(k);if(!gG(M,P))return yield*new uae({path:k})}),E=(k,O,P)=>y(k,O,P,(D)=>u(k,D)),b=(k,O,P,D)=>y(k,O,P,(I)=>l(k,D,I,P.mode)),w=m.fnUntraced(function*(k,O,P){let{operation:D,path:I,snapshot:M}=k,B=yield*i(I);if(!Ak(B,M))return yield*new mf({path:I});let ee=(j,ae)=>(F)=>sa.addFinalizerExit(O,(J)=>Rr.isSuccess(J)?m.void:h(P,j,D.type,ae(F)));if(D.type==="write"){let j=D.mode??M.mode;if(M.type==="File"&&fae(M.bytes,D.bytes)&&M.mode===j)return;let ae=M.exists?M.bytes:void 0;yield*l(I,D.bytes,M,j,ee(I,(F)=>ae===void 0?E(I,F,M):b(I,F,M,ae)));return}if(D.type==="remove"){if(!M.exists)return;let j=M.bytes;if(j===void 0)return yield*new mf({path:I});yield*u(I,M,ee(I,(ae)=>b(I,ae,M,j)));return}if(M.exists)return;yield*m.forEach(cae(t,I),(j)=>m.gen(function*(){let ae=yield*i(j,!1);if(ae.exists)return;yield*f(j,ae,D.mode,ee(j,(F)=>E(j,F,ae)))}),{discard:!0})}),T=m.fnUntraced(function*(k,O){if(O.length===0)return k;let P=Mr.map(k,(I)=>I instanceof mv?new mv({path:I.path,operation:I.operation,error:I.error,rollbackFailures:[...O]}):I);return Nr.some(Mr.failures(k),(I)=>I instanceof mv)?P:Mr.sequential(P,Mr.fail(new R4e({rollbackFailures:[...O]})))});return{run:m.fn("MutationTransaction.run")(function*(k){let O=yield*c(k),P=yield*m.forEach(O,({operation:j,absolutePath:ae})=>m.gen(function*(){let F=yield*i(ae);if(j.expected!==void 0&&!T4t(F,j.expected))return yield*Ok(j,"Expected mutation state no longer matches");return{operation:j,path:ae,snapshot:F}}).pipe(m.mapError((F)=>F instanceof yG?F:pae(j,F)))),D=yield*sa.make(),I=[],M=m.forEach(P,(j)=>w(j,D,I).pipe(m.mapError((ae)=>ae instanceof mv?ae:P4t(j.operation,ae))),{discard:!0}),B=yield*m.exit(M.pipe(m.onExit((j)=>sa.close(D,j))));if(Rr.isSuccess(B))return;let ee=yield*T(B.cause,I);return yield*m.failCause(ee)})}});class SG extends m.Service()("@expandai/cli/Init/MutationTransaction",{dependencies:[xa.layer,Ac.layer],effect:D4t}){}class dae extends x.TaggedError()("IncompatibleClaudeProfileVersionError",{executingVersion:x.String,requiredVersion:x.String}){get message(){return`Executing CLI ${this.executingVersion} is incompatible with Claude profile ${this.requiredVersion}`}}class mae extends x.TaggedError()("ClaudeProfilePolicyBlockedError",{policyBlock:x.String}){get message(){return`Claude Code policy blocks profile configuration: ${this.policyBlock}`}}class mN extends x.TaggedError()("ClaudeAdapterOperationError",{code:x.Literal("inspection_failed","configuration_failed")}){get message(){return this.code==="inspection_failed"?"Claude Code profile inspection failed":"Claude Code profile configuration failed"}}var F4t="5 seconds",N4t=m.gen(function*(){let e=yield*_x.CommandExecutor,t=yield*Ae.string("PATH").pipe(Ae.withDefault("")),r=m.scoped(m.gen(function*(){let n=Zc.make("expandai","--version").pipe(Zc.env({...process.env,EXPANDAI_NO_TELEMETRY:"1",PATH:t}),Zc.stdout("pipe"),Zc.stderr("pipe")),o=yield*e.start(n),[s,,i]=yield*m.all([o.stdout.pipe(as.decodeText(),as.mkString),o.stderr.pipe(as.runDrain),o.exitCode],{concurrency:"unbounded"});return i===0&&s.trim()===ii})).pipe(m.timeoutFail({duration:F4t,onTimeout:()=>Error("expandai --version timed out")}),m.orElseSucceed(()=>!1));return{executingVersion:ii,portableCommandAvailable:r}});class hN extends m.Service()("@expandai/cli/Init/ClaudeRuntimeProbe",{dependencies:[n3.layer],effect:N4t}){static testLayer(e){return Tt.succeed(hN,hN.make({executingVersion:e.executingVersion,portableCommandAvailable:m.succeed(e.portableCommandAvailable)}))}}function M4e(e,t,r){let n=e.policyBlocks[0],o=n!==void 0,s=e.configured&&!t;return{configured:e.configured,changed:r,components:e.components,integrationVersion:e.profileVersion,...n===void 0?{}:{policyBlock:n},runtimeState:o?"blocked":s?"reload_required":"unverified",nextAction:o?"resolve-claude-policy-block":s?"restart-claude-code-current-path-unavailable":e.configured?"invoke-native-webfetch":"configure-claude-code"}}var L4t=m.gen(function*(){let e=yield*hG,t=yield*SG,r=yield*hN,n=m.fn("ClaudeAdapter.inspect")(function*(s){return yield*m.gen(function*(){let i=yield*e.inspect(s),a=yield*r.portableCommandAvailable;return M4e(i,a,!1)}).pipe(m.catchAllDefect(()=>new mN({code:"inspection_failed"})),m.mapError(()=>new fN({harness:"claude-code",scope:s,error:new mN({code:"inspection_failed"})})))}),o=m.fn("ClaudeAdapter.configure")(function*(s){return yield*m.gen(function*(){if(r.executingVersion!==jx)return yield*new dae({executingVersion:r.executingVersion,requiredVersion:jx});let i=yield*r.portableCommandAvailable,a=yield*e.plan(s),c=a.inspection.policyBlocks[0];if(c!==void 0)return yield*new mae({policyBlock:c});return yield*t.run(a.operations),M4e(a.resultInspection,i,a.changed)}).pipe(m.catchAllDefect(()=>new mN({code:"configuration_failed"})),m.mapError((i)=>new dN({harness:"claude-code",scope:s,error:i instanceof dae||i instanceof mae?i:new mN({code:"configuration_failed"})})))});return{harness:"claude-code",inspect:n,configure:o}});class EG extends m.Service()("@expandai/cli/Init/ClaudeAdapter",{dependencies:[hG.Default,SG.Default,hN.Default],effect:L4t}){}function P4e(e,t,r){let n=e.components.every((o)=>t.includes(o));return{configured:n,changed:r,components:[...t],integrationVersion:n?ii:void 0,runtimeState:n?"reload_required":"unverified",nextAction:n?"restart-or-reload-harness-then-use-expand":"configure-harness"}}function hae(e){let t=m.fn(`${e.harness}.inspect`)(function*(n){return yield*e.inspectComponents(n).pipe(m.map((o)=>P4e(e,o,!1)),m.mapError((o)=>new fN({harness:e.harness,scope:n,error:o})))}),r=m.fn(`${e.harness}.configure`)(function*(n){return yield*m.gen(function*(){let o=yield*e.inspectComponents(n),s=e.components.every((a)=>o.includes(a));if(!s)yield*e.install(n);let i=yield*e.inspectComponents(n);return P4e(e,i,!s)}).pipe(m.mapError((o)=>new dN({harness:e.harness,scope:n,error:o})))});return{harness:e.harness,inspect:t,configure:r}}class bG extends m.Service()("@expandai/cli/Init/CursorAdapter",{dependencies:[gk.Default,bk.Default],effect:m.gen(function*(){let e=yield*gk,t=yield*bk;return hae({harness:"cursor",components:["runtime-skill","mcp"],inspectComponents:(r)=>m.all([e.isInstalled(r),t.isCurrent(r)]).pipe(m.map(([n,o])=>[...o?["runtime-skill"]:[],...n?["mcp"]:[]])),install:(r)=>m.all([e.install(r),t.install(r)])})})}){}class CG extends m.Service()("@expandai/cli/Init/CodexAdapter",{dependencies:[hk.Default,Ek.Default],effect:m.gen(function*(){let e=yield*hk,t=yield*Ek;return hae({harness:"codex",components:["runtime-skill","mcp"],inspectComponents:(r)=>m.all([e.isInstalled(r),t.isCurrent(r)]).pipe(m.map(([n,o])=>[...o?["runtime-skill"]:[],...n?["mcp"]:[]])),install:(r)=>m.all([e.install(r),t.install(r)])})})}){}class wG extends m.Service()("@expandai/cli/Init/OpencodeAdapter",{dependencies:[xa.layer,yk.Default,xk.Default,Ck.Default],effect:m.gen(function*(){let e=yield*un.FileSystem,t=yield*yk,r=yield*xk,n=yield*Ck;return hae({harness:"opencode",components:["webfetch-hook","runtime-skill","mcp"],inspectComponents:(o)=>m.all([r.isInstalled(o),t.pathFor(o).pipe(m.flatMap(e.exists)),n.isCurrent(o)]).pipe(m.map(([s,i,a])=>[...i?["webfetch-hook"]:[],...a?["runtime-skill"]:[],...s?["mcp"]:[]])),install:(o)=>m.all([r.install(o),t.install(o),n.install(o)])})})}){}class kG extends x.TaggedError()("UnsupportedInitHarnessError",{harness:x.String}){get message(){return`No init adapter is registered for ${this.harness}`}}function D4e(e){let t=new Map(e.map((s)=>[s.harness,s])),r=m.fn("HarnessRegistry.find")(function*(s){let i=t.get(s);if(i===void 0)return yield*new kG({harness:s});return i}),n=m.fn("HarnessRegistry.inspect")(function*(s,i){return yield*(yield*r(s)).inspect(i)}),o=m.fn("HarnessRegistry.configure")(function*(s,i){return yield*(yield*r(s)).configure(i)});return{inspect:n,configure:o}}class Od extends m.Service()("@expandai/cli/Init/HarnessRegistry",{dependencies:[EG.Default,bG.Default,wG.Default,CG.Default],effect:m.gen(function*(){let e=yield*m.all([EG,bG,wG,CG]);return D4e(e)})}){static fromAdapters=(e)=>Od.make(D4e(e))}var U4t=x.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 IG extends x.TaggedError()("InitServiceError",{code:U4t,recoverable:x.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 lo(e,t){return new IG({code:e,recoverable:t})}function H4t(e){return ft.consoleWith((t)=>e.pipe(ft.withConsole({...t,log:()=>m.void})))}function xae(e,t){if(typeof e!=="object"||e===null||!(t in e))return;return Object.getOwnPropertyDescriptor(e,t)?.value}function F4e(e,t){let r=xae(e,t);return typeof r==="string"?r:void 0}function N4e(e,t){let r=xae(e,t);return typeof r==="boolean"?r:void 0}function gae(e){return e instanceof kd?lo("credential_storage_insecure",!1):lo("credential_health_failed",!1)}function q4t(e){if(e instanceof kd)return lo("credential_storage_insecure",!1);if(e instanceof Id)return lo("authorization_denied",!0);if(e instanceof Lx)return lo("authorization_refused",!1);if(e instanceof Ux)return lo("credential_save_failed",!1);if(e instanceof af&&e.kind==="request_failed")return lo("authorization_unreachable",!0);return lo("authorization_failed",N4e(e,"recoverable")??!0)}function B4t(e){if(e instanceof kd)return lo("credential_storage_insecure",!1);if(e instanceof F3){if(e.code==="stored_credential_conflict")return lo("stored_credential_conflict",!0);if(e.code==="request_failed")return lo("setup_unreachable",!0);if(e.code==="denied")return lo("authorization_denied",!0);if(e.code==="credential_save_failed")return lo("credential_save_failed",!1);if(e.code==="refused")return lo("authorization_refused",!1);if(e.code==="config_unreadable")return lo("credential_storage_insecure",!0);return lo("setup_token_rejected",!0)}return lo("authorization_failed",N4e(e,"recoverable")??!0)}function W4t(e){if(e instanceof kG)return lo("unsupported_harness",!1);let t=xae(e,"error")??e,r=F4e(t,"_tag");if(r==="ClaudeProfilePolicyBlockedError")return lo("policy_blocked",!1);if(r==="ClaudeAdapterOperationError"&&F4e(t,"code")==="inspection_failed")return lo("inspection_failed",!0);return lo("configuration_failed",!0)}function z4t(e){return new QF({harness:"agent-harnesses",scope:e.scope})}function $4t(e){return e.runtimeState==="reload_required"?"reload_required":"unverified"}function j4t(e,t){if(!t.configured||typeof t.changed!=="boolean")return!1;if(t.integrationVersion===void 0||t.integrationVersion.trim().length===0)return!1;if(t.nextAction.trim().length===0)return!1;let r=new Set(t.components),n=e==="opencode";return r.size===t.components.length&&r.has("runtime-skill")&&r.has("mcp")&&(n?r.has("webfetch-hook")&&r.size===3:r.size===2)}class gN extends m.Service()("@expandai/cli/Init/Service",{dependencies:[ju.Default,cf.Default,nv.Default,Od.Default],effect:m.gen(function*(){let e=yield*ju,t=yield*cf,r=yield*nv,n=yield*Od,o=m.fnUntraced(function*(i,a){let c=yield*m.forEach(i.harnesses,(b)=>H4t(n.configure(b,i.scope)).pipe(m.withTracerEnabled(!1),m.mapError(W4t),m.flatMap((w)=>{if(w.policyBlock!==void 0||w.runtimeState==="blocked")return lo("policy_blocked",!1);if(!j4t(b,w))return lo("invalid_adapter_result",!1);return m.succeed({harness:b,configured:w.configured,changed:w.changed,components:w.components,version:w.integrationVersion,verification:{runtimeState:$4t(w),nextAction:w.nextAction}})}),m.either,m.map((w)=>({harness:b,outcome:w}))),{concurrency:"unbounded"}),l=ct.getRights(c.map(({outcome:b})=>b)),u=c.flatMap(({harness:b,outcome:w})=>mt.isLeft(w)?[{harness:b,code:w.left.code,recoverable:w.left.recoverable}]:[]),f=u[0];if(l.length===0&&f!==void 0)return yield*lo(f.code,f.recoverable);let h=yield*Ae.string("PWD").pipe(Ae.withDefault(process.cwd()),m.orElseSucceed(()=>process.cwd())),y={schemaVersion:1,status:"completed",harnesses:i.harnesses,scope:i.scope,userMessage:u.length>0?hie:a?_3:v3,auth:{healthy:!0},...i.scope==="project"?{projectPath:h}:{},installations:l,...u.length>0?{failures:u}:{}},E=yield*x.decodeUnknown(JF)(y).pipe(m.mapError(()=>lo("invalid_adapter_result",!1)));return yield*m.annotateCurrentSpan({status:E.status,harnessCount:l.length,componentCount:l.reduce((b,w)=>b+w.components.length,0)}),E});return{run:m.fn("InitService.run")(function*(i){return yield*m.annotateCurrentSpan({harnessCount:i.harnesses.length,scope:i.scope}),yield*m.gen(function*(){let a=yield*e.hasLocallyUsableCredentials().pipe(m.withTracerEnabled(!1),m.mapError(gae));if(i.setupToken!==void 0){if(yield*r.authorize({setupToken:i.setupToken,harness:"agent-harnesses",scope:i.scope}).pipe(m.withTracerEnabled(!1),m.mapError(B4t)),!(yield*e.hasLocallyUsableCredentials().pipe(m.withTracerEnabled(!1),m.mapError(gae))))return yield*lo("authorization_failed",!0);return yield*o(i,!0)}if(a)return yield*o(i,!1);let c=yield*t.advance(z4t(i)).pipe(m.withTracerEnabled(!1),m.mapError(q4t));if(c._tag==="TokensSaved"){if(!(yield*e.hasLocallyUsableCredentials().pipe(m.withTracerEnabled(!1),m.mapError(gae))))return yield*lo("authorization_failed",!0);return yield*o(i,!0)}let l={schemaVersion:1,status:"authorization_required",harnesses:i.harnesses,scope:i.scope,userMessage:lk,authorization:{url:c.pending.verificationUri,userCode:c.pending.userCode,approvalExpiresAt:ar.formatIso(c.pending.approvalExpiresAt)}},u=yield*x.decodeUnknown(JF)(l).pipe(m.mapError(()=>lo("authorization_failed",!1)));return yield*m.annotateCurrentSpan({status:u.status,componentCount:0}),u})})}})}){}var V4t=bt.text("harness").pipe(bt.optional,bt.withDescription("Agent harness running this setup, used as a detection hint")),G4t=bt.text("harnesses").pipe(bt.optional,bt.withDescription("Comma-separated harnesses to configure. Omit to configure every detected harness.")),K4t=bt.boolean("detect").pipe(bt.withDescription("Report the harnesses setup would configure, and change nothing")),J4t=bt.text("scope").pipe(bt.optional,bt.withDescription("Configuration scope")),Q4t=bt.text("setup-token").pipe(bt.optional,bt.withDescription("Short-lived, single-use setup token from the Expand dashboard")),Y4t=bt.boolean("json").pipe(bt.withDescription("Emit one machine-readable JSON result")),L4e={harness:V4t,harnesses:G4t,detect:K4t,scope:J4t,setupToken:Q4t,json:Y4t},U4e=x.parseJson(ob),Z4t=x.parseJson(JF),X4t=x.parseJson(T3),ub="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.",H4e="claude-code, cursor, opencode, codex",q4e=`Expand does not support that agent harness. Supported harnesses are ${H4e}. Do not substitute a different harness: tell the user their agent is not supported yet.`,eJt="That setup token is malformed. Copy it exactly as the dashboard issued it, or create a new one; do not retype or truncate it.",B4e=`--harnesses takes a comma-separated list drawn from ${H4e}, for example --harnesses claude-code,cursor. Every entry must be one of those names.`,tJt=/^[A-Za-z0-9._~-]{20,256}$/u;function AG(e,t){return x.encodeSync(U4e)(new ob({schemaVersion:1,status:"error",code:e,message:t,recoverable:!0}))}function yae(){return AG("invalid_arguments",ub)}function rJt(e,t,r){return x.encodeSync(U4e)(new ob({schemaVersion:1,status:"error",code:e,message:t,recoverable:r}))}function tc(e,t,r,n){return ft.error(rJt(e,t,r)).pipe(m.zipRight(m.sync(()=>void(process.exitCode=n))))}function Sae(e){let t=e.split(",").map((n)=>n.trim()),r=[];for(let n of t){let o=x.decodeUnknownOption($s)(n);if(q.isNone(o))return;if(!r.includes(o.value))r.push(o.value)}return ct.isNonEmptyArray(r)?r:void 0}function nJt(e){return e!==void 0&&e!==""&&e!=="0"&&e!=="false"}function xN(e,t){if(e.argv[2]!==t)return;let r=e.argv.slice(3),n=e.environment.EXPANDAI_CLI_CONTEXT==="agent"||nJt(e.environment.CLAUDECODE)||e.environment.CURSOR_TRACE_ID!==void 0||e.environment.CODEX_RUN_ID!==void 0;return!e.stdinIsTty||!e.stdoutIsTty||r.includes("--json")||n?"machine":"human"}function Eae(e){return xN(e,"init")}function oJt(e){function t(r,n){if(r>=e.length)return n;let o=e[r];if(o==="--json"&&!n.json)return t(r+1,{...n,json:!0});if(o==="--detect"&&!n.detect)return t(r+1,{...n,detect:!0});if(o!=="--setup-token"&&o!=="--harness"&&o!=="--harnesses"&&o!=="--scope")return;let s=e[r+1];if(s===void 0||s.startsWith("-"))return;if(o==="--setup-token"&&q.isNone(n.setupToken))return t(r+2,{...n,setupToken:q.some(s)});if(o==="--harness"&&q.isNone(n.harness))return t(r+2,{...n,harness:q.some(s)});if(o==="--harnesses"&&q.isNone(n.harnesses))return t(r+2,{...n,harnesses:q.some(s)});if(o==="--scope"&&q.isNone(n.scope))return t(r+2,{...n,scope:q.some(s)});return}return t(0,{detect:!1,harness:q.none(),harnesses:q.none(),json:!1,scope:q.none(),setupToken:q.none()})}function W4e(e){if(e[2]!=="init")return;let t=e.slice(3);if(t.length===1&&(t[0]==="--help"||t[0]==="-h"))return;let r=oJt(t);if(r===void 0)return yae();if(!r.json)return yae();if(q.isSome(r.harness)&&q.isNone(x.decodeUnknownOption($s)(r.harness.value)))return AG("unsupported_harness",q4e);if(q.isSome(r.harnesses)&&Sae(r.harnesses.value)===void 0)return AG("invalid_harness_selection",B4e);if(r.detect)return;if(!q.contains(r.scope,"project")&&!q.contains(r.scope,"global"))return yae();if(q.isSome(r.setupToken)&&!tJt.test(r.setupToken.value))return AG("invalid_setup_token",eJt);return}function sJt(e){if(e.status==="authorization_required")return`Expand authorization required
|
|
625
|
+
${e.userMessage}
|
|
626
|
+
Open: ${e.authorization.url.toString()}
|
|
627
|
+
Enter code: ${e.authorization.userCode}`;let t=e.installations.map((s)=>s.harness).join(", "),r=e.failures??[],n=r.length>0?"Expand setup incomplete":"Expand setup complete",o=r.map((s)=>`${s.harness} (${s.code})`).join(", ");return[n,e.userMessage,`Configured: ${t}`,...r.length>0?[`Failed: ${o}`]:[]].join(`
|
|
628
|
+
`)}var z4e=m.fnUntraced(function*(e,t){let r=yield*gN,n=yield*m.either(r.run(e));if(mt.isLeft(n)){let s=n.left;if(s instanceof IG){yield*tc(s.code,s.message,s.recoverable,1);return}yield*tc("init_failed","Expand init could not be completed safely.",!0,1);return}if(!t){yield*ft.log(sJt(n.right));return}let o=yield*x.encode(Z4t)(n.right).pipe(m.catchAll(()=>tc("invalid_result","Expand init returned an invalid result.",!1,1)));if(typeof o==="string")yield*ft.log(o)}),iJt=m.fnUntraced(function*(e){let t=yield*$x,r=yield*t.detect({...q.isSome(e)?{hint:e.value}:{}}),n=yield*t.detectCurrent(),o=yield*x.encode(X4t)(new T3({schemaVersion:1,status:"detected",harnesses:r,...q.isSome(n)?{current:n.value}:{},userMessage:r.length===0?xie:gie})).pipe(m.catchAll(()=>tc("invalid_result","Expand init returned an invalid result.",!1,1)));if(typeof o==="string")yield*ft.log(o)}),$4e=m.fnUntraced(function*({detect:e,harness:t,harnesses:r,json:n,scope:o,setupToken:s}){if(!n){yield*tc("invalid_arguments",ub,!0,2);return}let i=q.flatMap(t,(f)=>x.decodeUnknownOption($s)(f));if(q.isSome(t)&&q.isNone(i)){yield*tc("unsupported_harness",q4e,!0,2);return}if(e){yield*iJt(i);return}if(!q.contains(o,"project")&&!q.contains(o,"global")){yield*tc("invalid_arguments",ub,!0,2);return}let a=q.map(r,Sae);if(q.isSome(a)&&a.value===void 0){yield*tc("invalid_harness_selection",B4e,!0,2);return}let c=yield*$x,l=q.isSome(a)&&a.value!==void 0?a.value:yield*c.detect({...q.isSome(i)?{hint:i.value}:{}});if(l.length===0){yield*tc("no_harness_detected","No supported agent harness was detected. Pass --harness with the agent currently running setup.",!0,2);return}let u=yield*x.decodeUnknown(R3)({harnesses:l,scope:q.getOrUndefined(o),...q.isSome(s)?{setupToken:s.value}:{}}).pipe(m.catchAll(()=>tc("invalid_arguments",ub,!0,2).pipe(m.as(void 0))));if(u===void 0)return;yield*z4e(u,!0)});class OG extends m.Service()("@expandai/cli/Commands/InitTerminalInteraction",{effect:m.gen(function*(){let e=yield*Es.Terminal,t=m.fnUntraced(function*(){return yield*jl.select({message:"Where should Expand be available?",choices:[{title:"All projects for this user",value:"global"},{title:"This project",value:"project"}]}).pipe(m.provideService(Es.Terminal,e))}),r=m.fnUntraced(function*(n){return yield*jl.multiSelect({message:"Which harnesses should Expand configure?",choices:n.map((o)=>({title:o,value:o,selected:!0}))}).pipe(m.provideService(Es.Terminal,e))});return{chooseScope:t,chooseHarnesses:r}})}){}var aJt=m.fnUntraced(function*(e){let t=yield*$x,r=yield*t.detect({...q.isSome(e)?{hint:e.value}:{}}),n=yield*t.detectCurrent();if(r.length===0){yield*ft.log("No supported agent harness was detected. Nothing was changed.");return}yield*ft.log(["Detected harnesses. Nothing was changed.",...r.map((o)=>` ${o}${q.isSome(n)&&n.value===o?" (this one)":""}`),"","Run `expandai init` to configure them."].join(`
|
|
629
|
+
`))}),cJt=m.fnUntraced(function*(e){if(e.json){yield*$4e(e);return}let t=q.flatMap(e.harness,(l)=>x.decodeUnknownOption($s)(l));if(q.isSome(e.harness)&&q.isNone(t)){yield*tc("invalid_arguments",ub,!0,2);return}if(e.detect){yield*aJt(t);return}let r=yield*OG,n=q.isSome(e.scope)?e.scope.value:yield*r.chooseScope(),o=x.decodeUnknownOption(el)(n);if(q.isNone(o)){yield*tc("invalid_arguments",ub,!0,2);return}let s=q.map(e.harnesses,Sae);if(q.isSome(s)&&s.value===void 0){yield*tc("invalid_arguments",ub,!0,2);return}let a=(q.isSome(s)?s.value:void 0)??(yield*m.gen(function*(){let u=yield*(yield*$x).detect({...q.isSome(t)?{hint:t.value}:{}});return u.length===0?void 0:yield*r.chooseHarnesses(u)}));if(a===void 0){yield*tc("no_harness_detected","No supported agent harness was detected. Re-run with --harness for the agent you want to configure.",!0,2);return}if(!ct.isNonEmptyReadonlyArray(a)){yield*ft.log("No harnesses selected. Nothing was changed.");return}let c=yield*x.decodeUnknown(R3)({harnesses:a,scope:o.value,...q.isSome(e.setupToken)?{setupToken:e.setupToken.value}:{}}).pipe(m.catchAll(()=>tc("invalid_arguments",ub,!0,2).pipe(m.as(void 0))));if(c===void 0)return;if(q.isNone(e.setupToken)){let l=yield*ju,u=yield*m.either(l.hasLocallyUsableCredentials());if(mt.isLeft(u)){yield*tc("credential_health_failed","Stored credentials could not be validated safely.",!1,1);return}if(!u.right){let f=yield*m.either(l.loginWithBrowser());if(mt.isLeft(f)){yield*tc("authorization_failed","Browser authorization could not be completed.",!0,1);return}}}yield*z4e(c,e.json)}),j4e="Authorize Expand and configure the complete supported harness profile",V4e=Te.make("init",L4e).pipe(Te.withDescription(j4e),Te.withHandler(cJt)),G4e=Te.make("init",L4e).pipe(Te.withDescription(j4e),Te.withHandler($4e));var lJt=bt.boolean("json").pipe(bt.withDescription("Emit one machine-readable JSON result")),uJt=x.parseJson(D3),pJt=x.parseJson(P3),K4e="Agent login requires exactly `expandai login --json`.";function J4e(e,t,r){return x.encodeSync(uJt)(new D3({schemaVersion:1,status:"error",code:e,message:t,recoverable:r}))}function _G(e,t,r,n){return ft.error(J4e(e,t,r)).pipe(m.zipRight(m.sync(()=>void(process.exitCode=n))))}function bae(e){return xN(e,"login")}function Q4e(e){if(e[2]!=="login")return;let t=e.slice(3);if(t.length===1&&(t[0]==="--help"||t[0]==="-h"))return;return t.length===1&&t[0]==="--json"?void 0:J4e("invalid_arguments",K4e,!0)}var fJt=m.fnUntraced(function*({json:e}){if(!e){yield*_G("invalid_arguments",K4e,!0,2);return}let t=yield*YF,r=yield*m.either(t.run());if(mt.isLeft(r)){let o=r.left;if(o instanceof Kl){yield*_G(o.code,o.message,o.recoverable,1);return}yield*_G("authorization_internal_error","Authorization failed for an unexpected internal reason. Do not retry in a loop; report this error.",!1,1);return}let n=yield*x.encode(pJt)(r.right).pipe(m.catchAll(()=>_G("invalid_result","Device login returned an invalid result.",!1,1)));if(typeof n==="string")yield*ft.log(n)}),Y4e=Te.make("login",{json:lJt}).pipe(Te.withDescription("Authorize Expand with an agent-safe browser code flow"),Te.withHandler(fJt));var Z4e=Mo.choice([["claude-code","claude-code"],["cursor","cursor"],["opencode","opencode"],["codex","codex"]]),X4e=Mo.choice([["global","global"],["project","project"]]),eJe=Te.make("install",{host:Z4e,scope:X4e}).pipe(Te.withDescription("Install the expandai MCP server into the chosen host + scope (e.g. `claude-code global`)"),Te.withHandler(m.fnUntraced(function*({host:e,scope:t}){yield*(yield*$u).install(e,t)}))),tJe=Te.make("uninstall",{host:Z4e,scope:X4e}).pipe(Te.withDescription("Remove the expandai MCP server from the chosen host + scope"),Te.withHandler(({host:e,scope:t})=>m.flatMap($u,(r)=>r.uninstall(e,t))));var Xx={};Ht(Xx,{McpServer:()=>_c,elicit:()=>r5t,layer:()=>CK,layerHttp:()=>Y8t,layerHttpRouter:()=>Z8t,layerStdio:()=>Q8t,prompt:()=>t5t,registerPrompt:()=>J5e,registerResource:()=>Tce,registerToolkit:()=>K5e,resource:()=>e5t,run:()=>G5e,toolkit:()=>X8t});var vG=()=>(e)=>Qe(()=>{let t=VC(1),r=[],n=(...o)=>BC((s)=>{r.push([o,s])});return W(e((...o)=>n(...o)),(o)=>({...o,run(s){return t.withPermits(1)($e(function*(){let i=n;n=s;for(let[a,c]of r)yield*Vo(n(...a),c);return r=[],yield*RR(mS,()=>(n=i,me))}))}}))});var rJe=Symbol.for("effect/PrimaryKey");var yN=Symbol.for("@effect/rpc/RpcSchema/Stream"),TG=(e)=>e.ast.annotations[QC]===yN;var hv=(e)=>e.annotations[yN]?_(e.annotations[yN]):R(),oJe=({failure:e,success:t})=>Object.assign(jn([t,e],{decode:(r,n)=>nJe(gs(rD(r)),gs(n)),encode:(r,n)=>nJe(Us(rD(r)),Us(n))},{schemaId:yN,[yN]:{success:t,failure:e}}),{success:t,failure:e}),mJt=(e)=>de(e,AP),nJe=(e,t)=>(r,n,o)=>L(Pn(),(s)=>{if(!mJt(r))return ie(new Zt(o,r));return N(r.pipe(gX((i)=>e(i,n)),WW((i)=>{if(Pq(i))return dX(i);return wr(t(i,n),{onFailure:Ms,onSuccess:ie})}),TP(s)))});var sJe=Symbol.for("@effect/rpc/Rpc");var hJt={[sJe]:sJe,pipe(){return ce(this,arguments)},setSuccess(e){return Vx({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return Vx({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return Vx({_tag:this._tag,payloadSchema:so(e)?e:fe(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return Vx({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:new Set([...this.middlewares,e])})},prefix(e){return Vx({_tag:`${e}${this._tag}`,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},annotate(e,t){return Vx({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:or(this.annotations,e,t)})},annotateContext(e){return Vx({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:Rn(this.annotations,e)})}},Vx=(e)=>{function t(){}return Object.setPrototypeOf(t,hJt),Object.assign(t,e),t.key=`@effect/rpc/Rpc/${e._tag}`,t},Po=(e,t)=>{let r=t?.success??sx,n=t?.error??zp,o;if(t?.primaryKey)o=class extends mr(`@effect/rpc/Rpc/${e}`)(t.payload){[rJe](){return t.primaryKey(this)}};else o=so(t?.payload)?t?.payload:t?.payload?fe(t?.payload):sx;return Vx({_tag:e,payloadSchema:o,successSchema:t?.stream?oJe({success:r,failure:n}):r,errorSchema:t?.stream?zp:n,defectSchema:t?.defect??io,annotations:Tn(),middlewares:new Set})},iJe=(e)=>Vx({_tag:e._tag,payloadSchema:e,successSchema:e.success,errorSchema:e.failure,defectSchema:io,annotations:Tn(),middlewares:new Set}),wae=je("@effect/rpc/Rpc/exitSchemaCache",()=>new WeakMap),RG=(e)=>{if(wae.has(e))return wae.get(e);let t=e,r=new Set([t.errorSchema]),n=hv(t.successSchema.ast);if(Oe(n))r.add(n.value.failure);for(let s of t.middlewares)r.add(s.failure);let o=KP({success:Oe(n)?sx:t.successSchema,failure:gt(...r),defect:t.defectSchema});return wae.set(e,o),o},gJt=Symbol.for("@effect/rpc/Rpc/Wrapper"),MG=(e)=>(gJt in e);var bh=(e)=>typeof e==="bigint"?e:BigInt(e),aJe={_tag:"Eof"};var xJt=_S(io),kae=(e)=>({_tag:"Defect",defect:xJt(e)}),cJe={_tag:"Pong"};var Aae;try{Aae=new TextDecoder}catch(e){}var Xe,Gu,K=0;var Tae=[],vk=Tae,SN=0,Eo={},nn,Gx,Vu=0,hf=0,$i,Kx,Jl=[],Yr,lJe={useRecords:!1,mapsAsObjects:!0};class LG{}var Rae=new LG;Rae.name="MessagePack 0xC1";var pb=!1,uJe=2,Oae,_ae,vae;class Ch{constructor(e){if(e){if(e.useRecords===!1&&e.mapsAsObjects===void 0)e.mapsAsObjects=!0;if(e.sequential&&e.trusted!==!1){if(e.trusted=!0,!e.structures&&e.useRecords!=!1){if(e.structures=[],!e.maxSharedStructures)e.maxSharedStructures=0}}if(e.structures)e.structures.sharedLength=e.structures.length;else if(e.getStructures)(e.structures=[]).uninitialized=!0,e.structures.sharedLength=0;if(e.int64AsNumber)e.int64AsType="number"}Object.assign(this,e)}unpack(e,t){if(Xe)return vJe(()=>(NG(),this?this.unpack(e,t):Ch.prototype.unpack.call(lJe,e,t)));if(!e.buffer&&e.constructor===ArrayBuffer)e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e);if(typeof t==="object")Gu=t.end||e.length,K=t.start||0;else K=0,Gu=t>-1?t:e.length;SN=0,hf=0,Gx=null,vk=Tae,$i=null,Xe=e;try{Yr=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(r){if(Xe=null,e instanceof Uint8Array)throw r;throw Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof Ch){if(Eo=this,this.structures)return nn=this.structures,DG(t);else if(!nn||nn.length>0)nn=[]}else if(Eo=lJe,!nn||nn.length>0)nn=[];return DG(t)}unpackMultiple(e,t){let r,n=0;try{pb=!0;let o=e.length,s=this?this.unpack(e,o):UG.unpack(e,o);if(t){if(t(s,n,K)===!1)return;while(K<o)if(n=K,t(DG(),n,K)===!1)return}else{r=[s];while(K<o)n=K,r.push(DG());return r}}catch(o){throw o.lastPosition=n,o.values=r,o}finally{pb=!1,NG()}}_mergeStructures(e,t){if(_ae)e=_ae.call(this,e);if(e=e||[],Object.isFrozen(e))e=e.map((r)=>r.slice(0));for(let r=0,n=e.length;r<n;r++){let o=e[r];if(o){if(o.isShared=!0,r>=32)o.highByte=r-32>>5}}e.sharedLength=e.length;for(let r in t||[])if(r>=0){let n=e[r],o=t[r];if(o){if(n)(e.restoreStructures||(e.restoreStructures=[]))[r]=n;e[r]=o}}return this.structures=e}decode(e,t){return this.unpack(e,t)}}function DG(e){try{if(!Eo.trusted&&!pb){let r=nn.sharedLength||0;if(r<nn.length)nn.length=r}let t;if(Eo.randomAccessStructure&&Xe[K]<64&&Xe[K]>=32&&Oae){if(t=Oae(Xe,K,Gu,Eo),Xe=null,!(e&&e.lazy)&&t)t=t.toJSON();K=Gu}else t=ai();if($i)K=$i.postBundlePosition,$i=null;if(pb)nn.restoreStructures=null;if(K==Gu){if(nn&&nn.restoreStructures)pJe();if(nn=null,Xe=null,Kx)Kx=null}else if(K>Gu)throw Error("Unexpected end of MessagePack data");else if(!pb){let r;try{r=JSON.stringify(t,(n,o)=>typeof o==="bigint"?`${o}n`:o).slice(0,100)}catch(n){r="(JSON view not available "+n+")"}throw Error("Data read, but end of buffer not reached "+r)}return t}catch(t){if(nn&&nn.restoreStructures)pJe();if(NG(),t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||K>Gu)t.incomplete=!0;throw t}}function pJe(){for(let e in nn.restoreStructures)nn[e]=nn.restoreStructures[e];nn.restoreStructures=null}function ai(){let e=Xe[K++];if(e<160)if(e<128)if(e<64)return e;else{let t=nn[e&63]||Eo.getStructures&&SJe()[e&63];if(t){if(!t.read)t.read=Mae(t,e&63);return t.read()}else return e}else if(e<144)if(e-=128,Eo.mapsAsObjects){let t={};for(let r=0;r<e;r++){let n=OJe();if(n==="__proto__")n="__proto_";t[n]=ai()}return t}else{let t=new Map;for(let r=0;r<e;r++)t.set(ai(),ai());return t}else{e-=144;let t=Array(e);for(let r=0;r<e;r++)t[r]=ai();if(Eo.freezeData)return Object.freeze(t);return t}else if(e<192){let t=e-160;if(hf>=K)return Gx.slice(K-Vu,(K+=t)-Vu);if(hf==0&&Gu<140){let r=t<16?Pae(t):AJe(t);if(r!=null)return r}return FG(t)}else{let t;switch(e){case 192:return null;case 193:if($i)if(t=ai(),t>0)return $i[1].slice($i.position1,$i.position1+=t);else return $i[0].slice($i.position0,$i.position0-=t);return Rae;case 194:return!1;case 195:return!0;case 196:if(t=Xe[K++],t===void 0)throw Error("Unexpected end of buffer");return Iae(t);case 197:return t=Yr.getUint16(K),K+=2,Iae(t);case 198:return t=Yr.getUint32(K),K+=4,Iae(t);case 199:return _k(Xe[K++]);case 200:return t=Yr.getUint16(K),K+=2,_k(t);case 201:return t=Yr.getUint32(K),K+=4,_k(t);case 202:if(t=Yr.getFloat32(K),Eo.useFloat32>2){let r=Rk[(Xe[K]&127)<<1|Xe[K+1]>>7];return K+=4,(r*t+(t>0?0.5:-0.5)>>0)/r}return K+=4,t;case 203:return t=Yr.getFloat64(K),K+=8,t;case 204:return Xe[K++];case 205:return t=Yr.getUint16(K),K+=2,t;case 206:return t=Yr.getUint32(K),K+=4,t;case 207:if(Eo.int64AsType==="number")t=Yr.getUint32(K)*4294967296,t+=Yr.getUint32(K+4);else if(Eo.int64AsType==="string")t=Yr.getBigUint64(K).toString();else if(Eo.int64AsType==="auto"){if(t=Yr.getBigUint64(K),t<=BigInt(2)<<BigInt(52))t=Number(t)}else t=Yr.getBigUint64(K);return K+=8,t;case 208:return Yr.getInt8(K++);case 209:return t=Yr.getInt16(K),K+=2,t;case 210:return t=Yr.getInt32(K),K+=4,t;case 211:if(Eo.int64AsType==="number")t=Yr.getInt32(K)*4294967296,t+=Yr.getUint32(K+4);else if(Eo.int64AsType==="string")t=Yr.getBigInt64(K).toString();else if(Eo.int64AsType==="auto"){if(t=Yr.getBigInt64(K),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52))t=Number(t)}else t=Yr.getBigInt64(K);return K+=8,t;case 212:if(t=Xe[K++],t==114)return xJe(Xe[K++]&63);else{let r=Jl[t];if(r)if(r.read)return K++,r.read(ai());else if(r.noBuffer)return K++,r();else return r(Xe.subarray(K,++K));else throw Error("Unknown extension "+t)}case 213:if(t=Xe[K],t==114)return K++,xJe(Xe[K++]&63,Xe[K++]);else return _k(2);case 214:return _k(4);case 215:return _k(8);case 216:return _k(16);case 217:if(t=Xe[K++],hf>=K)return Gx.slice(K-Vu,(K+=t)-Vu);return EJe(t);case 218:if(t=Yr.getUint16(K),K+=2,hf>=K)return Gx.slice(K-Vu,(K+=t)-Vu);return bJe(t);case 219:if(t=Yr.getUint32(K),K+=4,hf>=K)return Gx.slice(K-Vu,(K+=t)-Vu);return CJe(t);case 220:return t=Yr.getUint16(K),K+=2,dJe(t);case 221:return t=Yr.getUint32(K),K+=4,dJe(t);case 222:return t=Yr.getUint16(K),K+=2,mJe(t);case 223:return t=Yr.getUint32(K),K+=4,mJe(t);default:if(e>=224)return e-256;if(e===void 0){let r=Error("Unexpected end of MessagePack data");throw r.incomplete=!0,r}throw Error("Unknown MessagePack token "+e)}}}var yJt=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Mae(e,t){function r(){if(r.count++>uJe){let o;try{o=e.read=Function("r","return function(){return "+(Eo.freezeData?"Object.freeze":"")+"({"+e.map((s)=>s==="__proto__"?"__proto_:r()":yJt.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(ai)}catch(s){return uJe=1/0,r()}if(e.read0=o,e.highByte===0)e.read=fJe(t,e.read);return o()}let n={};for(let o=0,s=e.length;o<s;o++){let i=e[o];if(i==="__proto__")i="__proto_";n[i]=ai()}if(Eo.freezeData)return Object.freeze(n);return n}if(r.count=0,e.read0=r,e.highByte===0)return fJe(t,r);return r}var fJe=(e,t)=>function(){let r=Xe[K++];if(r===0)return t();let n=e<32?-(e+(r<<5)):e+(r<<5),o=nn[n]||SJe()[n];if(!o)throw Error("Record id is not defined for "+n);if(!o.read)o.read=Mae(o,e);return o.read()};function SJe(){let e=vJe(()=>(Xe=null,Eo.getStructures()));return nn=Eo._mergeStructures(e,nn)}var FG=Tk,EJe=Tk,bJe=Tk,CJe=Tk,wJe=!1;function kJe(e){wJe=!0,FG=t(1),EJe=t(2),bJe=t(3),CJe=t(5);function t(r){return function(o){let s=vk[SN++];if(s==null){if($i)return Tk(o);let a=Xe.byteOffset,c=e(K-r+a,Gu+a,Xe.buffer);if(typeof c=="string")s=c,vk=Tae;else if(vk=c,SN=1,hf=1,s=vk[0],s===void 0)throw Error("Unexpected end of buffer")}let i=s.length;if(i<=o)return K+=o,s;return Gx=s,Vu=K,hf=K+i,K+=o,s.slice(0,o)}}}function Tk(e){let t;if(e<16){if(t=Pae(e))return t}if(e>64&&Aae)return Aae.decode(Xe.subarray(K,K+=e));let r=K+e,n=[];t="";while(K<r){let o=Xe[K++];if((o&128)===0)n.push(o);else if((o&224)===192){let s=Xe[K++]&63,i=(o&31)<<6|s;if(i<128)n.push(65533);else n.push(i)}else if((o&240)===224){let s=Xe[K++]&63,i=Xe[K++]&63,a=(o&31)<<12|s<<6|i;if(a<2048||a>=55296&&a<=57343)n.push(65533);else n.push(a)}else if((o&248)===240){let s=Xe[K++]&63,i=Xe[K++]&63,a=Xe[K++]&63,c=(o&7)<<18|s<<12|i<<6|a;if(c<65536||c>1114111)n.push(65533);else if(c>65535)c-=65536,n.push(c>>>10&1023|55296),c=56320|c&1023,n.push(c);else n.push(c)}else n.push(65533);if(n.length>=4096)t+=Sa.apply(String,n),n.length=0}if(n.length>0)t+=Sa.apply(String,n);return t}function IJe(e,t,r){let n=Xe;Xe=e,K=t;try{return Tk(r)}finally{Xe=n}}function dJe(e){let t=Array(e);for(let r=0;r<e;r++)t[r]=ai();if(Eo.freezeData)return Object.freeze(t);return t}function mJe(e){if(Eo.mapsAsObjects){let t={};for(let r=0;r<e;r++){let n=OJe();if(n==="__proto__")n="__proto_";t[n]=ai()}return t}else{let t=new Map;for(let r=0;r<e;r++)t.set(ai(),ai());return t}}var Sa=String.fromCharCode;function AJe(e){let t=K,r=Array(e);for(let n=0;n<e;n++){let o=Xe[K++];if((o&128)>0){K=t;return}r[n]=o}return Sa.apply(String,r)}function Pae(e){if(e<4)if(e<2)if(e===0)return"";else{let t=Xe[K++];if((t&128)>1){K-=1;return}return Sa(t)}else{let t=Xe[K++],r=Xe[K++];if((t&128)>0||(r&128)>0){K-=2;return}if(e<3)return Sa(t,r);let n=Xe[K++];if((n&128)>0){K-=3;return}return Sa(t,r,n)}else{let t=Xe[K++],r=Xe[K++],n=Xe[K++],o=Xe[K++];if((t&128)>0||(r&128)>0||(n&128)>0||(o&128)>0){K-=4;return}if(e<6)if(e===4)return Sa(t,r,n,o);else{let s=Xe[K++];if((s&128)>0){K-=5;return}return Sa(t,r,n,o,s)}else if(e<8){let s=Xe[K++],i=Xe[K++];if((s&128)>0||(i&128)>0){K-=6;return}if(e<7)return Sa(t,r,n,o,s,i);let a=Xe[K++];if((a&128)>0){K-=7;return}return Sa(t,r,n,o,s,i,a)}else{let s=Xe[K++],i=Xe[K++],a=Xe[K++],c=Xe[K++];if((s&128)>0||(i&128)>0||(a&128)>0||(c&128)>0){K-=8;return}if(e<10)if(e===8)return Sa(t,r,n,o,s,i,a,c);else{let l=Xe[K++];if((l&128)>0){K-=9;return}return Sa(t,r,n,o,s,i,a,c,l)}else if(e<12){let l=Xe[K++],u=Xe[K++];if((l&128)>0||(u&128)>0){K-=10;return}if(e<11)return Sa(t,r,n,o,s,i,a,c,l,u);let f=Xe[K++];if((f&128)>0){K-=11;return}return Sa(t,r,n,o,s,i,a,c,l,u,f)}else{let l=Xe[K++],u=Xe[K++],f=Xe[K++],h=Xe[K++];if((l&128)>0||(u&128)>0||(f&128)>0||(h&128)>0){K-=12;return}if(e<14)if(e===12)return Sa(t,r,n,o,s,i,a,c,l,u,f,h);else{let y=Xe[K++];if((y&128)>0){K-=13;return}return Sa(t,r,n,o,s,i,a,c,l,u,f,h,y)}else{let y=Xe[K++],E=Xe[K++];if((y&128)>0||(E&128)>0){K-=14;return}if(e<15)return Sa(t,r,n,o,s,i,a,c,l,u,f,h,y,E);let b=Xe[K++];if((b&128)>0){K-=15;return}return Sa(t,r,n,o,s,i,a,c,l,u,f,h,y,E,b)}}}}}function hJe(){let e=Xe[K++],t;if(e<192)t=e-160;else switch(e){case 217:t=Xe[K++];break;case 218:t=Yr.getUint16(K),K+=2;break;case 219:t=Yr.getUint32(K),K+=4;break;default:throw Error("Expected string")}return Tk(t)}function Iae(e){return Eo.copyBuffers?Uint8Array.prototype.slice.call(Xe,K,K+=e):Xe.subarray(K,K+=e)}function _k(e){let t=Xe[K++];if(Jl[t]){let r;return Jl[t](Xe.subarray(K,r=K+=e),(n)=>{K=n;try{return ai()}finally{K=r}})}else throw Error("Unknown extension type "+t)}var gJe=Array(4096);function OJe(){let e=Xe[K++];if(e>=160&&e<192){if(e=e-160,hf>=K)return Gx.slice(K-Vu,(K+=e)-Vu);else if(!(hf==0&&Gu<180))return FG(e)}else return K--,_Je(ai());let t=(e<<5^(e>1?Yr.getUint16(K):e>0?Xe[K]:0))&4095,r=gJe[t],n=K,o=K+e-3,s,i=0;if(r&&r.bytes==e){while(n<o){if(s=Yr.getUint32(n),s!=r[i++]){n=1879048192;break}n+=4}o+=3;while(n<o)if(s=Xe[n++],s!=r[i++]){n=1879048192;break}if(n===o)return K=n,r.string;o-=3,n=K}r=[],gJe[t]=r,r.bytes=e;while(n<o)s=Yr.getUint32(n),r.push(s),n+=4;o+=3;while(n<o)s=Xe[n++],r.push(s);let a=e<16?Pae(e):AJe(e);if(a!=null)return r.string=a;return r.string=FG(e)}function _Je(e){if(typeof e==="string")return e;if(typeof e==="number"||typeof e==="boolean"||typeof e==="bigint")return e.toString();if(e==null)return e+"";if(Eo.allowArraysInMapKeys&&Array.isArray(e)&&e.flat().every((t)=>["string","number","boolean","bigint"].includes(typeof t)))return e.flat().toString();throw Error(`Invalid property type for record: ${typeof e}`)}var xJe=(e,t)=>{let r=ai().map(_Je),n=e;if(t!==void 0)e=e<32?-((t<<5)+e):(t<<5)+e,r.highByte=t;let o=nn[e];if(o&&(o.isShared||pb))(nn.restoreStructures||(nn.restoreStructures=[]))[e]=o;return nn[e]=r,r.read=Mae(r,n),(r.read0||r.read)()};Jl[0]=()=>{};Jl[0].noBuffer=!0;Jl[66]=(e)=>{let t=e.byteLength%8||8,r=BigInt(e[0]&128?e[0]-256:e[0]);for(let n=1;n<t;n++)r<<=BigInt(8),r+=BigInt(e[n]);if(e.byteLength!==t){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),o=(s,i)=>{let a=i-s;if(a<=40){let f=n.getBigUint64(s);for(let h=s+8;h<i;h+=8)f<<=BigInt(64),f|=n.getBigUint64(h);return f}let c=s+(a>>4<<3),l=o(s,c),u=o(c,i);return l<<BigInt((i-c)*8)|u};r=r<<BigInt((n.byteLength-t)*8)|o(t,n.byteLength)}return r};var yJe={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError==="function"?AggregateError:null};Jl[101]=()=>{let e=ai();if(!yJe[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return yJe[e[0]](e[1],{cause:e[2]})};Jl[105]=(e)=>{if(Eo.structuredClone===!1)throw Error("Structured clone extension is disabled");let t=Yr.getUint32(K-4);if(!Kx)Kx=new Map;let r=Xe[K],n;if(r>=144&&r<160||r==220||r==221)n=[];else if(r>=128&&r<144||r==222||r==223)n=new Map;else if((r>=199&&r<=201||r>=212&&r<=216)&&Xe[K+1]===115)n=new Set;else n={};let o={target:n};Kx.set(t,o);let s=ai();if(!o.used)return o.target=s;else Object.assign(n,s);if(n instanceof Map)for(let[i,a]of s.entries())n.set(i,a);if(n instanceof Set)for(let i of Array.from(s))n.add(i);return n};Jl[112]=(e)=>{if(Eo.structuredClone===!1)throw Error("Structured clone extension is disabled");let t=Yr.getUint32(K-4),r=Kx.get(t);return r.used=!0,r.target};Jl[115]=()=>new Set(ai());var Dae=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map((e)=>e+"Array"),SJt=typeof globalThis==="object"?globalThis:window;Jl[116]=(e)=>{let t=e[0],r=Uint8Array.prototype.slice.call(e,1).buffer,n=Dae[t];if(!n){if(t===16)return r;if(t===17)return new DataView(r);throw Error("Could not find typed array for code "+t)}return new SJt[n](r)};Jl[120]=()=>{let e=ai();return new RegExp(e[0],e[1])};var EJt=[];Jl[98]=(e)=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],r=K;return K+=t-e.length,$i=EJt,$i=[hJe(),hJe()],$i.position0=0,$i.position1=0,$i.postBundlePosition=K,K=r,ai()};Jl[255]=(e)=>{if(e.length==4)return new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1000);else if(e.length==8)return new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1000);else if(e.length==12)return new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1000);else return new Date("invalid")};function vJe(e){if(vae)vae();let t=Gu,r=K,n=SN,o=Vu,s=hf,i=Gx,a=vk,c=Kx,l=$i,u=new Uint8Array(Xe.slice(0,Gu)),f=nn,h=nn.slice(0,nn.length),y=Eo,E=pb,b=e();return Gu=t,K=r,SN=n,Vu=o,hf=s,Gx=i,vk=a,Kx=c,$i=l,Xe=u,pb=E,nn=f,nn.splice(0,nn.length,...h),Eo=y,Yr=new DataView(Xe.buffer,Xe.byteOffset,Xe.byteLength),b}function NG(){Xe=null,Kx=null,nn=null}var Rk=Array(147);for(let e=0;e<256;e++)Rk[e]=+("1e"+Math.floor(45.15-e*0.30103));var UG=new Ch({useRecords:!1}),bJt=UG.unpack,CJt=UG.unpackMultiple,wJt=UG.unpack;var kJt=new Float32Array(1),v_r=new Uint8Array(kJt.buffer,0,4);function TJe(e,t,r){Oae=e,_ae=t,vae=r}var qG;try{qG=new TextEncoder}catch(e){}var Lae,Uae,gv=typeof Buffer<"u",HG=gv?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,FJe=gv?Buffer:Uint8Array,RJe=gv?4294967296:2144337920,pe,EN,bo,re=0,Oc,Cs=null,NJe,IJt=21760,AJt=/[\u0080-\uFFFF]/,_d=Symbol("record-id");class xv extends Ch{constructor(e){super(e);this.offset=0;let t,r,n,o,s,i=FJe.prototype.utf8Write?function(F,J){return pe.utf8Write(F,J,pe.byteLength-J)}:qG&&qG.encodeInto?function(F,J){return qG.encodeInto(F,pe.subarray(J)).written}:!1,a=this;if(!e)e={};let c=e&&e.sequential,l=e.structures||e.saveStructures,u=e.maxSharedStructures;if(u==null)u=l?32:0;if(u>8160)throw Error("Maximum maxSharedStructure is 8160");if(e.structuredClone&&e.moreTypes==null)this.moreTypes=!0;let f=e.maxOwnStructures;if(f==null)f=l?32:64;if(!this.structures&&e.useRecords!=!1)this.structures=[];let h=u>32||f+u>64,y=u+64,E=u+f+64;if(E>8256)throw Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let b=[],w=0,T=0;this.pack=this.encode=function(F,J){if(!pe)pe=new HG(8192),bo=pe.dataView||(pe.dataView=new DataView(pe.buffer,0,8192)),re=0;if(Oc=pe.length-10,Oc-re<2048)pe=new HG(pe.length),bo=pe.dataView||(pe.dataView=new DataView(pe.buffer,0,pe.length)),Oc=pe.length-10,re=0;else re=re+7&2147483640;if(r=re,J&WJe)re+=J&255;if(s=a.structuredClone?new Map:null,a.bundleStrings&&typeof F!=="string")Cs=[],Cs.size=1/0;else Cs=null;if(o=a.structures,o){if(o.uninitialized)o=a._mergeStructures(a.getStructures());let Z=o.sharedLength||0;if(Z>u)throw Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+o.sharedLength);if(!o.transitions){o.transitions=Object.create(null);for(let ne=0;ne<Z;ne++){let we=o[ne];if(!we)continue;let ot,rt=o.transitions;for(let Dt=0,Lt=we.length;Dt<Lt;Dt++){let Do=we[Dt];if(ot=rt[Do],!ot)ot=rt[Do]=Object.create(null);rt=ot}rt[_d]=ne+64}this.lastNamedStructuresLength=Z}if(!c)o.nextId=Z+64}if(n)n=!1;let G;try{if(a.randomAccessStructure&&!a.readOnlyStructures&&F&&typeof F==="object")if(F.constructor===Object)ae(F);else if(F.constructor!==Map&&!Array.isArray(F)&&!Uae.some((ne)=>F instanceof ne))ae(F.toJSON?F.toJSON():F);else O(F);else O(F);let Z=Cs;if(Cs)PJe(r,O,0);if(s&&s.idsToInsert){let ne=s.idsToInsert.sort((Dt,Lt)=>Dt.offset>Lt.offset?1:-1),we=ne.length,ot=-1;while(Z&&we>0){let Dt=ne[--we].offset+r;if(Dt<Z.stringsPosition+r&&ot===-1)ot=0;if(Dt>Z.position+r){if(ot>=0)ot+=6}else{if(ot>=0)bo.setUint32(Z.position+r,bo.getUint32(Z.position+r)+ot),ot=-1;Z=Z.previous,we++}}if(ot>=0&&Z)bo.setUint32(Z.position+r,bo.getUint32(Z.position+r)+ot);if(re+=ne.length*6,re>Oc)B(re);a.offset=re;let rt=OJt(pe.subarray(r,re),ne);return s=null,rt}if(a.offset=re,J&qJe)return pe.start=r,pe.end=re,pe;return pe.subarray(r,re)}catch(Z){throw G=Z,Z}finally{if(o){if(A(),n&&a.saveStructures){let Z=o.sharedLength||0,ne=pe.subarray(r,re),we=LJe(o,a);if(!G){if(a.saveStructures(we,we.isCompatible)===!1)return o.uninitialized=!0,a.pack(F,J);if(a.lastNamedStructuresLength=Z,pe.length>1073741824)pe=null;return ne}}}if(pe.length>1073741824)pe=null;if(J&BJe)re=r}};let A=()=>{if(T<10)T++;let F=o.sharedLength||0;if(o.length>F&&!c)o.length=F;if(w>1e4){if(o.transitions=null,T=0,w=0,b.length>0)b=[]}else if(b.length>0&&!c){for(let J=0,G=b.length;J<G;J++)b[J][_d]=0;b=[]}},k=(F)=>{var J=F.length;if(J<16)pe[re++]=144|J;else if(J<65536)pe[re++]=220,pe[re++]=J>>8,pe[re++]=J&255;else pe[re++]=221,bo.setUint32(re,J),re+=4;for(let G=0;G<J;G++)O(F[G])},O=(F)=>{if(re>Oc)pe=B(re);var J=typeof F,G;if(J==="string"){let Z=F.length;if(Cs&&Z>=4&&Z<4096){if((Cs.size+=Z)>IJt){let rt,Dt=(Cs[0]?Cs[0].length*3+Cs[1].length:0)+10;if(re+Dt>Oc)pe=B(re+Dt);let Lt;if(Cs.position)Lt=Cs,pe[re]=200,re+=3,pe[re++]=98,rt=re-r,re+=4,PJe(r,O,0),bo.setUint16(rt+r-3,re-r-rt);else pe[re++]=214,pe[re++]=98,rt=re-r,re+=4;Cs=["",""],Cs.previous=Lt,Cs.size=0,Cs.position=rt}let ot=AJt.test(F);Cs[ot?0:1]+=F,pe[re++]=193,O(ot?-Z:Z);return}let ne;if(Z<32)ne=1;else if(Z<256)ne=2;else if(Z<65536)ne=3;else ne=5;let we=Z*3;if(re+we>Oc)pe=B(re+we);if(Z<64||!i){let ot,rt,Dt,Lt=re+ne;for(ot=0;ot<Z;ot++)if(rt=F.charCodeAt(ot),rt<128)pe[Lt++]=rt;else if(rt<2048)pe[Lt++]=rt>>6|192,pe[Lt++]=rt&63|128;else if((rt&64512)===55296&&((Dt=F.charCodeAt(ot+1))&64512)===56320)rt=65536+((rt&1023)<<10)+(Dt&1023),ot++,pe[Lt++]=rt>>18|240,pe[Lt++]=rt>>12&63|128,pe[Lt++]=rt>>6&63|128,pe[Lt++]=rt&63|128;else pe[Lt++]=rt>>12|224,pe[Lt++]=rt>>6&63|128,pe[Lt++]=rt&63|128;G=Lt-re-ne}else G=i(F,re+ne);if(G<32)pe[re++]=160|G;else if(G<256){if(ne<2)pe.copyWithin(re+2,re+1,re+1+G);pe[re++]=217,pe[re++]=G}else if(G<65536){if(ne<3)pe.copyWithin(re+3,re+2,re+2+G);pe[re++]=218,pe[re++]=G>>8,pe[re++]=G&255}else{if(ne<5)pe.copyWithin(re+5,re+3,re+3+G);pe[re++]=219,bo.setUint32(re,G),re+=4}re+=G}else if(J==="number")if(F>>>0===F)if(F<32||F<128&&this.useRecords===!1||F<64&&!this.randomAccessStructure)pe[re++]=F;else if(F<256)pe[re++]=204,pe[re++]=F;else if(F<65536)pe[re++]=205,pe[re++]=F>>8,pe[re++]=F&255;else pe[re++]=206,bo.setUint32(re,F),re+=4;else if(F>>0===F)if(F>=-32)pe[re++]=256+F;else if(F>=-128)pe[re++]=208,pe[re++]=F+256;else if(F>=-32768)pe[re++]=209,bo.setInt16(re,F),re+=2;else pe[re++]=210,bo.setInt32(re,F),re+=4;else{let Z;if((Z=this.useFloat32)>0&&F<4294967296&&F>=-2147483648){pe[re++]=202,bo.setFloat32(re,F);let ne;if(Z<4||(ne=F*Rk[(pe[re]&127)<<1|pe[re+1]>>7])>>0===ne){re+=4;return}else re--}pe[re++]=203,bo.setFloat64(re,F),re+=8}else if(J==="object"||J==="function")if(!F)pe[re++]=192;else{if(s){let ne=s.get(F);if(ne){if(!ne.id){let we=s.idsToInsert||(s.idsToInsert=[]);ne.id=we.push(ne)}pe[re++]=214,pe[re++]=112,bo.setUint32(re,ne.id),re+=4;return}else s.set(F,{offset:re-r})}let Z=F.constructor;if(Z===Object)M(F);else if(Z===Array)k(F);else if(Z===Map)if(this.mapAsEmptyObject)pe[re++]=128;else{if(G=F.size,G<16)pe[re++]=128|G;else if(G<65536)pe[re++]=222,pe[re++]=G>>8,pe[re++]=G&255;else pe[re++]=223,bo.setUint32(re,G),re+=4;for(let[ne,we]of F)O(ne),O(we)}else{for(let ne=0,we=Lae.length;ne<we;ne++){let ot=Uae[ne];if(F instanceof ot){let rt=Lae[ne];if(rt.write){if(rt.type)pe[re++]=212,pe[re++]=rt.type,pe[re++]=0;let Ah=rt.write.call(this,F);if(Ah===F)if(Array.isArray(F))k(F);else M(F);else O(Ah);return}let Dt=pe,Lt=bo,Do=re;pe=null;let Ea;try{Ea=rt.pack.call(this,F,(Ah)=>{if(pe=Dt,Dt=null,re+=Ah,re>Oc)B(re);return{target:pe,targetView:bo,position:re-Ah}},O)}finally{if(Dt)pe=Dt,bo=Lt,re=Do,Oc=pe.length-10}if(Ea){if(Ea.length+re>Oc)B(Ea.length+re);re=MJe(Ea,pe,re,rt.type)}return}}if(Array.isArray(F))k(F);else{if(F.toJSON){let ne=F.toJSON();if(ne!==F)return O(ne)}if(J==="function")return O(this.writeFunction&&this.writeFunction(F));M(F)}}}else if(J==="boolean")pe[re++]=F?195:194;else if(J==="bigint"){if(F<9223372036854776000&&F>=-9223372036854776000)pe[re++]=211,bo.setBigInt64(re,F);else if(F<18446744073709552000&&F>0)pe[re++]=207,bo.setBigUint64(re,F);else if(this.largeBigIntToFloat)pe[re++]=203,bo.setFloat64(re,Number(F));else if(this.largeBigIntToString)return O(F.toString());else if(this.useBigIntExtension||this.moreTypes){let Z=F<0?BigInt(-1):BigInt(0),ne;if(F>>BigInt(65536)===Z){let we=BigInt(18446744073709552000)-BigInt(1),ot=[];while(!0){if(ot.push(F&we),F>>BigInt(63)===Z)break;F>>=BigInt(64)}ne=new Uint8Array(new BigUint64Array(ot).buffer),ne.reverse()}else{let we=F<0,ot=(we?~F:F).toString(16);if(ot.length%2)ot="0"+ot;else if(parseInt(ot.charAt(0),16)>=8)ot="00"+ot;if(gv)ne=Buffer.from(ot,"hex");else{ne=new Uint8Array(ot.length/2);for(let rt=0;rt<ne.length;rt++)ne[rt]=parseInt(ot.slice(rt*2,rt*2+2),16)}if(we)for(let rt=0;rt<ne.length;rt++)ne[rt]=~ne[rt]}if(ne.length+re>Oc)B(ne.length+re);re=MJe(ne,pe,re,66);return}else throw RangeError(F+" 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");re+=8}else if(J==="undefined")if(this.encodeUndefinedAsNil)pe[re++]=192;else pe[re++]=212,pe[re++]=0,pe[re++]=0;else throw Error("Unknown type: "+J)},P=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?(F)=>{let J;if(this.skipValues){J=[];for(let ne in F)if((typeof F.hasOwnProperty!=="function"||F.hasOwnProperty(ne))&&!this.skipValues.includes(F[ne]))J.push(ne)}else J=Object.keys(F);let G=J.length;if(G<16)pe[re++]=128|G;else if(G<65536)pe[re++]=222,pe[re++]=G>>8,pe[re++]=G&255;else pe[re++]=223,bo.setUint32(re,G),re+=4;let Z;if(this.coercibleKeyAsNumber)for(let ne=0;ne<G;ne++){Z=J[ne];let we=Number(Z);O(isNaN(we)?Z:we),O(F[Z])}else for(let ne=0;ne<G;ne++)O(Z=J[ne]),O(F[Z])}:(F)=>{pe[re++]=222;let J=re-r;re+=2;let G=0;for(let Z in F)if(typeof F.hasOwnProperty!=="function"||F.hasOwnProperty(Z))O(Z),O(F[Z]),G++;if(G>65535)throw Error('Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object');pe[J+++r]=G>>8,pe[J+r]=G&255},D=this.useRecords===!1?P:e.progressiveRecords&&!h?(F)=>{let J,G=o.transitions||(o.transitions=Object.create(null)),Z=re++-r,ne;for(let we in F)if(typeof F.hasOwnProperty!=="function"||F.hasOwnProperty(we)){if(J=G[we],J)G=J;else{let ot=Object.keys(F),rt=G;G=o.transitions;let Dt=0;for(let Lt=0,Do=ot.length;Lt<Do;Lt++){let Ea=ot[Lt];if(J=G[Ea],!J)J=G[Ea]=Object.create(null),Dt++;G=J}if(Z+r+1==re)re--,ee(G,ot,Dt);else j(G,ot,Z,Dt);ne=!0,G=rt[we]}O(F[we])}if(!ne){let we=G[_d];if(we)pe[Z+r]=we;else j(G,Object.keys(F),Z,0)}}:(F)=>{let J,G=o.transitions||(o.transitions=Object.create(null)),Z=0;for(let we in F)if(typeof F.hasOwnProperty!=="function"||F.hasOwnProperty(we)){if(J=G[we],!J)J=G[we]=Object.create(null),Z++;G=J}let ne=G[_d];if(ne)if(ne>=96&&h)pe[re++]=((ne-=96)&31)+96,pe[re++]=ne>>5;else pe[re++]=ne;else ee(G,G.__keys__||Object.keys(F),Z);for(let we in F)if(typeof F.hasOwnProperty!=="function"||F.hasOwnProperty(we))O(F[we])},I=typeof this.useRecords=="function"&&this.useRecords,M=I?(F)=>{I(F)?D(F):P(F)}:D,B=(F)=>{let J;if(F>16777216){if(F-r>RJe)throw Error("Packed buffer would be larger than maximum buffer size");J=Math.min(RJe,Math.round(Math.max((F-r)*(F>67108864?1.25:2),4194304)/4096)*4096)}else J=(Math.max(F-r<<2,pe.length-1)>>12)+1<<12;let G=new HG(J);if(bo=G.dataView||(G.dataView=new DataView(G.buffer,0,J)),F=Math.min(F,pe.length),pe.copy)pe.copy(G,0,r,F);else G.set(pe.slice(r,F));return re-=r,r=0,Oc=G.length-10,pe=G},ee=(F,J,G)=>{let Z=o.nextId;if(!Z)Z=64;if(Z<y&&this.shouldShareStructure&&!this.shouldShareStructure(J)){if(Z=o.nextOwnId,!(Z<E))Z=y;o.nextOwnId=Z+1}else{if(Z>=E)Z=y;o.nextId=Z+1}let ne=J.highByte=Z>=96&&h?Z-96>>5:-1;if(F[_d]=Z,F.__keys__=J,o[Z-64]=J,Z<y)if(J.isShared=!0,o.sharedLength=Z-63,n=!0,ne>=0)pe[re++]=(Z&31)+96,pe[re++]=ne;else pe[re++]=Z;else{if(ne>=0)pe[re++]=213,pe[re++]=114,pe[re++]=(Z&31)+96,pe[re++]=ne;else pe[re++]=212,pe[re++]=114,pe[re++]=Z;if(G)w+=T*G;if(b.length>=f)b.shift()[_d]=0;b.push(F),O(J)}},j=(F,J,G,Z)=>{let ne=pe,we=re,ot=Oc,rt=r;if(pe=EN,re=0,r=0,!pe)EN=pe=new HG(8192);Oc=pe.length-10,ee(F,J,Z),EN=pe;let Dt=re;if(pe=ne,re=we,Oc=ot,r=rt,Dt>1){let Lt=re+Dt-1;if(Lt>Oc)B(Lt);let Do=G+r;pe.copyWithin(Do+Dt,Do+1,re),pe.set(EN.slice(0,Dt),Do),re=Lt}else pe[G+r]=EN[0]},ae=(F)=>{let J=NJe(F,pe,r,re,o,B,(G,Z,ne)=>{if(ne)return n=!0;re=Z;let we=pe;if(O(G),A(),we!==pe)return{position:re,targetView:bo,target:pe};return re},this);if(J===0)return M(F);re=J}}useBuffer(e){pe=e,pe.dataView||(pe.dataView=new DataView(pe.buffer,pe.byteOffset,pe.byteLength)),bo=pe.dataView,re=0}set position(e){re=e}get position(){return re}clearSharedData(){if(this.structures)this.structures=[];if(this.typedStructs)this.typedStructs=[]}}Uae=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,LG];Lae=[{pack(e,t,r){let n=e.getTime()/1000;if((this.useTimestamp32||e.getMilliseconds()===0)&&n>=0&&n<4294967296){let{target:o,targetView:s,position:i}=t(6);o[i++]=214,o[i++]=255,s.setUint32(i,n)}else if(n>0&&n<4294967296){let{target:o,targetView:s,position:i}=t(10);o[i++]=215,o[i++]=255,s.setUint32(i,e.getMilliseconds()*4000000+(n/1000/4294967296>>0)),s.setUint32(i+4,n)}else if(isNaN(n)){if(this.onInvalidDate)return t(0),r(this.onInvalidDate());let{target:o,targetView:s,position:i}=t(3);o[i++]=212,o[i++]=255,o[i++]=255}else{let{target:o,targetView:s,position:i}=t(15);o[i++]=199,o[i++]=12,o[i++]=255,s.setUint32(i,e.getMilliseconds()*1e6),s.setBigInt64(i+4,BigInt(Math.floor(n)))}}},{pack(e,t,r){if(this.setAsEmptyObject)return t(0),r({});let n=Array.from(e),{target:o,position:s}=t(this.moreTypes?3:0);if(this.moreTypes)o[s++]=212,o[s++]=115,o[s++]=0;r(n)}},{pack(e,t,r){let{target:n,position:o}=t(this.moreTypes?3:0);if(this.moreTypes)n[o++]=212,n[o++]=101,n[o++]=0;r([e.name,e.message,e.cause])}},{pack(e,t,r){let{target:n,position:o}=t(this.moreTypes?3:0);if(this.moreTypes)n[o++]=212,n[o++]=120,n[o++]=0;r([e.source,e.flags])}},{pack(e,t){if(this.moreTypes)Fae(e,16,t);else Nae(gv?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let r=e.constructor;if(r!==FJe&&this.moreTypes)Fae(e,Dae.indexOf(r.name),t);else Nae(e,t)}},{pack(e,t){if(this.moreTypes)Fae(e,17,t);else Nae(gv?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let{target:r,position:n}=t(1);r[n]=193}}];function Fae(e,t,r,n){let o=e.byteLength;if(o+1<256){var{target:s,position:i}=r(4+o);s[i++]=199,s[i++]=o+1}else if(o+1<65536){var{target:s,position:i}=r(5+o);s[i++]=200,s[i++]=o+1>>8,s[i++]=o+1&255}else{var{target:s,position:i,targetView:a}=r(7+o);s[i++]=201,a.setUint32(i,o+1),i+=4}if(s[i++]=116,s[i++]=t,!e.buffer)e=new Uint8Array(e);s.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i)}function Nae(e,t){let r=e.byteLength;var n,o;if(r<256){var{target:n,position:o}=t(r+2);n[o++]=196,n[o++]=r}else if(r<65536){var{target:n,position:o}=t(r+3);n[o++]=197,n[o++]=r>>8,n[o++]=r&255}else{var{target:n,position:o,targetView:s}=t(r+5);n[o++]=198,s.setUint32(o,r),o+=4}n.set(e,o)}function MJe(e,t,r,n){let o=e.length;switch(o){case 1:t[r++]=212;break;case 2:t[r++]=213;break;case 4:t[r++]=214;break;case 8:t[r++]=215;break;case 16:t[r++]=216;break;default:if(o<256)t[r++]=199,t[r++]=o;else if(o<65536)t[r++]=200,t[r++]=o>>8,t[r++]=o&255;else t[r++]=201,t[r++]=o>>24,t[r++]=o>>16&255,t[r++]=o>>8&255,t[r++]=o&255}return t[r++]=n,t.set(e,r),r+=o,r}function OJt(e,t){let r,n=t.length*6,o=e.length-n;while(r=t.pop()){let{offset:s,id:i}=r;e.copyWithin(s+n,s,o),n-=6;let a=s+n;e[a++]=214,e[a++]=105,e[a++]=i>>24,e[a++]=i>>16&255,e[a++]=i>>8&255,e[a++]=i&255,o=s}return e}function PJe(e,t,r){if(Cs.length>0){bo.setUint32(Cs.position+e,re+r-Cs.position-e),Cs.stringsPosition=re-e;let n=Cs;Cs=null,t(n[0]),t(n[1])}}function LJe(e,t){return e.isCompatible=(r)=>{let n=!r||(t.lastNamedStructuresLength||0)===r.length;if(!n)t._mergeStructures(r);return n},e}function UJe(e,t){NJe=e,LJe=t}var HJe=new xv({useRecords:!1}),_Jt=HJe.pack,vJt=HJe.pack;var qJe=512,BJe=1024,WJe=2048;var qae=3,Sv=0,bN=2,BG=1,Wae=16,zae=["num","object","string","ascii"];zae[Wae]="date";var RJt=[!1,!0,!0,!1,!1,!0,!0,!1],$Je;try{Function(""),$Je=!0}catch(e){}var Mk,MJt=typeof Buffer<"u",WG,wh;try{WG=new TextEncoder}catch(e){}var PJt=MJt?function(e,t,r){return e.utf8Write(t,r,e.byteLength-r)}:WG&&WG.encodeInto?function(e,t,r){return WG.encodeInto(t,e.subarray(r)).written}:!1,U_r=Symbol("type"),H_r=Symbol("parent");UJe(jJe,UJt);function jJe(e,t,r,n,o,s,i,a,c){let l=a.typedStructs||(a.typedStructs=[]),u=a.maxOwnStructures??1/0,f=!c&&l.length>=u,h=t.dataView,y=(l.lastStringStart||100)+n,E=t.length-10,b=n;if(n>E)t=s(n),h=t.dataView,n-=r,b-=r,y-=r,r=0,E=t.length-10;let w,T=y,A=l.transitions||(l.transitions=Object.create(null)),k=l.nextId||l.length,O=k<15?1:k<240?2:k<61440?3:k<15728640?4:0;if(O===0)return 0;n+=O;let P=[],D,I=0;for(let ee in e){let j=A[ee];if(!j){if(f)return 0;A[ee]=j={key:ee,parent:A,enumerationOffset:0,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null,date64:null}}let ae=e[ee];if(n>E)t=s(n),h=t.dataView,n-=r,b-=r,y-=r,T-=r,r=0,E=t.length-10;switch(typeof ae){case"number":let F=ae;if(k<200||!j.num64){if(F>>0===F&&F<536870912&&F>-520093696){if(F<246&&F>=0&&(j.num8&&!(k>200&&j.num32)||F<32&&!j.num32))A=j.num8||vd(j,Sv,1,f),t[n++]=F;else A=j.num32||vd(j,Sv,4,f),h.setUint32(n,F,!0),n+=4;break}else if(F<4294967296&&F>=-2147483648){if(h.setFloat32(n,F,!0),RJt[t[n+3]>>>5]){let ne;if((ne=F*Rk[(t[n+3]&127)<<1|t[n+2]>>7])>>0===ne){A=j.num32||vd(j,Sv,4,f),n+=4;break}}}}A=j.num64||vd(j,Sv,8,f),h.setFloat64(n,F,!0),n+=8;break;case"string":let J=ae.length;if(w=T-y,(J<<2)+T>E)t=s((J<<2)+T),h=t.dataView,n-=r,b-=r,y-=r,T-=r,r=0,E=t.length-10;if(J>65280+w>>2){P.push(ee,ae,n-b);break}let G,Z=T;if(J<64){let ne,we,ot;for(ne=0;ne<J;ne++)if(we=ae.charCodeAt(ne),we<128)t[T++]=we;else if(we<2048)G=!0,t[T++]=we>>6|192,t[T++]=we&63|128;else if((we&64512)===55296&&((ot=ae.charCodeAt(ne+1))&64512)===56320)G=!0,we=65536+((we&1023)<<10)+(ot&1023),ne++,t[T++]=we>>18|240,t[T++]=we>>12&63|128,t[T++]=we>>6&63|128,t[T++]=we&63|128;else G=!0,t[T++]=we>>12|224,t[T++]=we>>6&63|128,t[T++]=we&63|128}else T+=PJt(t,ae,T),G=T-Z>J;if(w<160||w<246&&(j.ascii8||j.string8)){if(G){if(!(A=j.string8))if(l.length>10&&(A=j.ascii8))A.__type=bN,j.ascii8=null,j.string8=A,i(null,0,!0);else A=vd(j,bN,1,f)}else if(w===0&&!D){D=!0,A=j.ascii0||vd(j,qae,0,f);break}else if(!(A=j.ascii8)&&!(l.length>10&&(A=j.string8)))A=vd(j,qae,1,f);t[n++]=w}else A=j.string16||vd(j,bN,2,f),h.setUint16(n,w,!0),n+=2;break;case"object":if(ae){if(ae.constructor===Date)A=j.date64||vd(j,Wae,8,f),h.setFloat64(n,ae.getTime(),!0),n+=8;else P.push(ee,ae,I);break}else if(j=zJe(j,n,h,-10),j)A=j,n=Mk;else P.push(ee,ae,I);break;case"boolean":A=j.num8||j.ascii8||vd(j,Sv,1,f),t[n++]=ae?249:248;break;case"undefined":if(j=zJe(j,n,h,-9),j)A=j,n=Mk;else P.push(ee,ae,I);break;default:P.push(ee,ae,I)}if(A===void 0)return 0;I++}if(!c&&P.length>0&&l.length>=u){let ee=A;for(let j=0,ae=P.length;j<ae;j+=3){if(P[j+1]!=null)return 0;let F=ee[P[j]];if(!F)return 0;let J=F.object16;if(!J)return 0;ee=J}if(ee[_d]==null)return 0}let M=!1;for(let ee=0,j=P.length;ee<j;){let ae=P[ee++],F=P[ee++],J=P[ee++],G=A[ae];if(!G)A[ae]=G={key:ae,parent:A,enumerationOffset:J-I,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null};let Z;if(F){let ne;if(w=T-y,w<65280)if(A=G.object16,A)ne=2;else if(A=G.object32)ne=4;else A=Hae(G,BG,2),ne=2;else A=G.object32||Hae(G,BG,4),ne=4;if(Z=i(F,T),M=!0,typeof Z==="object")T=Z.position,h=Z.targetView,t=Z.target,y-=r,n-=r,b-=r,r=0;else T=Z;if(ne===2)h.setUint16(n,w,!0),n+=2;else h.setUint32(n,w,!0),n+=4}else A=G.object16||Hae(G,BG,2),h.setInt16(n,F===null?-10:-9,!0),n+=2;I++}let B=A[_d];if(B==null){if(!M&&l.length>=u)return 0;B=a.typedStructs.length;let ee=[],j=A,ae,F;while((F=j.__type)!==void 0){let J=j.__size;j=j.__parent,ae=j.key;let G=[F,J,ae];if(j.enumerationOffset)G.push(j.enumerationOffset);ee.push(G),j=j.parent}ee.reverse(),A[_d]=B,a.typedStructs[B]=ee,i(null,0,!0)}switch(O){case 1:if(B>=16)return 0;t[b]=B+32;break;case 2:if(B>=256)return 0;t[b]=56,t[b+1]=B;break;case 3:if(B>=65536)return 0;t[b]=57,h.setUint16(b+1,B,!0);break;case 4:if(B>=16777216)return 0;h.setUint32(b,(B<<8)+58,!0);break}if(n<y){if(y===T)return n;t.copyWithin(n,y,T),T+=n-y,l.lastStringStart=n-b}else if(n>y){if(y===T)return n;return l.lastStringStart=n-b,jJe(e,t,r,b,o,s,i,a,!0)}return T}function zJe(e,t,r,n){let o;if(o=e.ascii8||e.num8)return r.setInt8(t,n,!0),Mk=t+1,o;if(o=e.string16||e.object16)return r.setInt16(t,n,!0),Mk=t+2,o;if(o=e.num32)return r.setUint32(t,3758096640+n,!0),Mk=t+4,o;if(o=e.num64)return r.setFloat64(t,NaN,!0),r.setInt8(t,n),Mk=t+8,o;Mk=t;return}function vd(e,t,r,n){let o=zae[t]+(r<<3),s=e[o];if(s)return s;if(n)return;return s=e[o]=Object.create(null),s.__type=t,s.__size=r,s.__parent=e,s}function Hae(e,t,r){let n=zae[t]+(r<<3),o=e[n];if(o)return o;return o=e[n]=Object.create(null),o.__type=t,o.__size=r,o.__parent=e,o}function DJt(e){if(!(e instanceof Map))return e;let t=e.get("typed")||[];if(Object.isFrozen(t))t=t.map((o)=>o.slice(0));let r=e.get("named"),n=Object.create(null);for(let o=0,s=t.length;o<s;o++){let i=t[o],a=n;for(let[c,l,u]of i){let f=a[u];if(!f)a[u]=f={key:u,parent:a,enumerationOffset:0,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null,date64:null};a=vd(f,c,l,!1)}a[_d]=o}return t.transitions=n,this.typedStructs=t,this.lastTypedStructuresLength=t.length,r}var Bae=Symbol.for("source");function FJt(e,t,r,n){let o=e[t++]-32;if(o>=24)switch(o){case 24:o=e[t++];break;case 25:o=e[t++]+(e[t++]<<8);break;case 26:o=e[t++]+(e[t++]<<8)+(e[t++]<<16);break;case 27:o=e[t++]+(e[t++]<<8)+(e[t++]<<16)+(e[t++]<<24);break}let s=n.typedStructs&&n.typedStructs[o];if(!s){if(e=Uint8Array.prototype.slice.call(e,t,r),r-=t,t=0,!n.getStructures)throw Error(`Reference to shared structure ${o} without getStructures method`);if(n._mergeStructures(n.getStructures()),!n.typedStructs)throw Error("Could not find any shared typed structures");if(n.lastTypedStructuresLength=n.typedStructs.length,s=n.typedStructs[o],!s)throw Error("Could not find typed structure "+o)}var{construct:i,fullConstruct:a}=s;if(!i){i=s.construct=function(){},a=s.fullConstruct=function(){},a.prototype=n.structPrototype||{};var c=i.prototype=n.structPrototype?Object.create(n.structPrototype):{};let u=[],f=0,h;for(let y=0,E=s.length;y<E;y++){let b=s[y],[w,T,A,k]=b;if(A==="__proto__")A="__proto_";let O={key:A,offset:f};if(k)u.splice(y+k,0,O);else u.push(O);let P;switch(T){case 0:P=()=>0;break;case 1:P=(I,M)=>{let B=I.bytes[M+O.offset];return B>=246?yv(B):B};break;case 2:P=(I,M)=>{let B=I.bytes,j=(B.dataView||(B.dataView=new DataView(B.buffer,B.byteOffset,B.byteLength))).getUint16(M+O.offset,!0);return j>=65280?yv(j&255):j};break;case 4:P=(I,M)=>{let B=I.bytes,j=(B.dataView||(B.dataView=new DataView(B.buffer,B.byteOffset,B.byteLength))).getUint32(M+O.offset,!0);return j>=4294967040?yv(j&255):j};break}O.getRef=P,f+=T;let D;switch(w){case qae:if(h&&!h.next)h.next=O;h=O,O.multiGetCount=0,D=function(I){let{bytes:M,position:B}=I,ee=f+B,j=P(I,B);if(typeof j!=="number")return j;let ae,F=O.next;while(F){if(ae=F.getRef(I,B),typeof ae==="number")break;else ae=null;F=F.next}if(ae==null)ae=I.bytesEnd-ee;if(I.srcString)return I.srcString.slice(j,ae);return IJe(M,j+ee,ae-j)};break;case bN:case BG:if(h&&!h.next)h.next=O;h=O,D=function(I){let M=I.position,B=f+M,ee=P(I,M);if(typeof ee!=="number")return ee;let j=I.bytes,ae,F=O.next;while(F){if(ae=F.getRef(I,M),typeof ae==="number")break;else ae=null;F=F.next}if(ae==null)ae=I.bytesEnd-B;if(w===bN)return j.toString("utf8",ee+B,ae+B);else{wh=I;try{return n.unpack(j,{start:ee+B,end:ae+B})}finally{wh=null}}};break;case Sv:switch(T){case 4:D=function(I){let M=I.bytes,B=M.dataView||(M.dataView=new DataView(M.buffer,M.byteOffset,M.byteLength)),ee=I.position+O.offset,j=B.getInt32(ee,!0);if(j<536870912){if(j>-520093696)return j;if(j>-536870912)return yv(j&255)}let ae=B.getFloat32(ee,!0),F=Rk[(M[ee+3]&127)<<1|M[ee+2]>>7];return(F*ae+(ae>0?0.5:-0.5)>>0)/F};break;case 8:D=function(I){let M=I.bytes,ee=(M.dataView||(M.dataView=new DataView(M.buffer,M.byteOffset,M.byteLength))).getFloat64(I.position+O.offset,!0);if(isNaN(ee)){let j=M[I.position+O.offset];if(j>=246)return yv(j)}return ee};break;case 1:D=function(I){let B=I.bytes[I.position+O.offset];return B<246?B:yv(B)};break}break;case Wae:D=function(I){let M=I.bytes,B=M.dataView||(M.dataView=new DataView(M.buffer,M.byteOffset,M.byteLength));return new Date(B.getFloat64(I.position+O.offset,!0))};break}O.get=D}if($Je){let y=[],E=[],b=0,w;for(let A of u){if(n.alwaysLazyProperty&&n.alwaysLazyProperty(A.key)){w=!0;continue}Object.defineProperty(c,A.key,{get:NJt(A.get),enumerable:!0});let k="v"+b++;E.push(k),y.push("o["+JSON.stringify(A.key)+"]="+k+"(s)")}if(w)y.push("__proto__:this");let T=Function(...E,"var c=this;return function(s){var o=new c();"+y.join(";")+";return o;}").apply(a,u.map((A)=>A.get));Object.defineProperty(c,"toJSON",{value(A){return T.call(this,this[Bae])}})}else Object.defineProperty(c,"toJSON",{value(y){let E={};for(let b=0,w=u.length;b<w;b++){let T=u[b].key;E[T]=this[T]}return E}})}var l=new i;return l[Bae]={bytes:e,position:t,srcString:"",bytesEnd:r},l}function yv(e){switch(e){case 246:return null;case 247:return;case 248:return!1;case 249:return!0}throw Error("Unknown constant")}function NJt(e){return function(){return e(this[Bae])}}function LJt(){if(wh)wh.bytes=Uint8Array.prototype.slice.call(wh.bytes,wh.position,wh.bytesEnd),wh.position=0,wh.bytesEnd=wh.bytes.length}function UJt(e,t){if(t.typedStructs){let n=new Map;n.set("named",e),n.set("typed",t.typedStructs),e=n}let r=t.lastTypedStructuresLength||0;return e.isCompatible=(n)=>{let o=!0;if(n instanceof Map){if((n.get("named")||[]).length!==(t.lastNamedStructuresLength||0))o=!1;if((n.get("typed")||[]).length!==r)o=!1}else if(n instanceof Array||Array.isArray(n)){if(n.length!==(t.lastNamedStructuresLength||0))o=!1}if(!o)t._mergeStructures(n);return o},t.lastTypedStructuresLength=t.typedStructs&&t.typedStructs.length,e}TJe(FJt,DJt,LJt);var BJt=process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED!==void 0&&process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED.toLowerCase()==="true";if(!BJt){let e;try{if(e=Uk("msgpackr-extract"),e)kJe(e.extractStrings)}catch(t){}}class Jx extends Gs("@effect/rpc/RpcSerialization")(){}var zJt=Jx.of({contentType:"application/ndjson",includesFraming:!0,unsafeMake:()=>{let e=new TextDecoder,t="";return{decode:(r)=>{t+=typeof r==="string"?r:e.decode(r);let n=0,o=t.indexOf(`
|
|
630
|
+
`,n),s=[];while(o!==-1){let i=JSON.parse(t.slice(n,o));s.push(i),n=o+1,o=t.indexOf(`
|
|
631
|
+
`,n)}return t=t.slice(n),s},encode:(r)=>{if(Array.isArray(r)){if(r.length===0)return;let n="";for(let o=0;o<r.length;o++)n+=JSON.stringify(r[o])+`
|
|
632
|
+
`;return n}return JSON.stringify(r)+`
|
|
633
|
+
`}}}}),$Jt=(e)=>Jx.of({contentType:e?.contentType??"application/json",includesFraming:!1,unsafeMake:()=>{let t=new TextDecoder,r=new Map;return{decode:(n)=>{let o=JSON.parse(typeof n==="string"?n:t.decode(n));return VJe(o,r)},encode:(n)=>{if(Array.isArray(n)){if(n.length===0)return;return JSON.stringify(n.map(CN))}let o=GJe(n,r);return o&&JSON.stringify(o)}}}}),jJt=(e)=>Jx.of({contentType:e?.contentType??"application/json-rpc",includesFraming:!0,unsafeMake:()=>{let t=zJt.unsafeMake(),r=new Map;return{decode:(n)=>{let o=t.decode(n);if(o.length===0)return[];let s=[];for(let i=0;i<o.length;i++){let a=o[i];s.push(...VJe(a,r))}return s},encode:(n)=>{if(Array.isArray(n))return t.encode(n.map(CN));let o=GJe(n,r);return o&&t.encode(o)}}}});function VJe(e,t){if(Array.isArray(e)){let r={size:0,responses:new Map},n=[];for(let o=0;o<e.length;o++){let s=$ae(e[o]);if(s._tag==="Request")r.size++,t.set(s.id,r)}return n}return Array.isArray(e)?e.map($ae):[$ae(e)]}function $ae(e){if("method"in e){if(!e.id&&e.method.startsWith("@effect/rpc/")){let t=e.method.slice(12),r=e.params?.requestId;return r?{_tag:t,requestId:String(r)}:{_tag:t}}return{_tag:"Request",id:e.id?String(e.id):"",tag:e.method,payload:e.params,headers:e.headers??[],traceId:e.traceId,spanId:e.spanId,sampled:e.sampled}}else if(e.error&&e.error._tag==="Defect")return{_tag:"Defect",defect:e.error.data};else if(e.chunk===!0)return{_tag:"Chunk",requestId:String(e.id),values:e.result};return{_tag:"Exit",requestId:String(e.id),exit:e.error!=null?{_tag:"Failure",cause:e.error._tag==="Cause"?e.error.data:{_tag:"Die",defect:e.error}}:{_tag:"Success",value:e.result}}}function GJe(e,t){if(!("requestId"in e))return CN(e);let r=t.get(e.requestId);if(r){if(t.delete(e.requestId),r.responses.set(e.requestId,e),r.size===r.responses.size)return Array.from(r.responses.values(),CN);return}return CN(e)}function CN(e){switch(e._tag){case"Request":return{jsonrpc:"2.0",method:e.tag,params:e.payload,id:e.id&&Number(e.id),headers:e.headers,traceId:e.traceId,spanId:e.spanId,sampled:e.sampled};case"Ping":case"Pong":case"Interrupt":case"Ack":case"Eof":return{jsonrpc:"2.0",method:`@effect/rpc/${e._tag}`,params:"requestId"in e?{requestId:e.requestId}:void 0};case"Chunk":return{jsonrpc:"2.0",chunk:!0,id:Number(e.requestId),result:e.values};case"Exit":return{jsonrpc:"2.0",id:e.requestId?Number(e.requestId):void 0,result:e.exit._tag==="Success"?e.exit.value:void 0,error:e.exit._tag==="Failure"?{_tag:"Cause",code:e.exit.cause._tag==="Fail"&&de(e.exit.cause.error,"code")?Number(e.exit.cause.error.code):0,message:e.exit.cause._tag==="Fail"&&de(e.exit.cause.error,"message")?e.exit.cause.error.message:JSON.stringify(e.exit.cause),data:e.exit.cause}:void 0};case"Defect":return{jsonrpc:"2.0",id:VJt,error:{_tag:"Defect",code:1,message:"A defect occurred",data:e.defect}};case"ClientProtocolError":return{}}}var VJt=-32603;var jae=(e)=>Hs(Jx,$Jt(e)),KJe=(e)=>Hs(Jx,jJt(e));var GJt=BigInt(0),Vae=Wn(function*(e,t){let r=t?.spanPrefix??"RpcClient",n=t?.supportsAck??!0,o=t?.disableTracing??!1,s=t?.generateRequestId??(()=>GJt++),i=yield*Pn(),a=er(i,wp),c=new Map,l=!1;yield*Ti(a,Qe(()=>(l=!0,u(Jy(KJt)))));let u=Wn(function*(A){for(let[k,O]of c)if(c.delete(k),O._tag==="Mailbox")yield*O.mailbox.done(A);else O.resume(A)}),f=(A)=>{let k=TG(A.successSchema),O=E(A);return(P,D)=>{let I=D?.headers?Ci(D.headers):Cd,M=D?.context??Tn();if(!k){let ee=(j)=>h(A,O,j,A.payloadSchema.make?A.payloadSchema.make(P):P,I,M,D?.discard??!1);return o?ee(void 0):HA(`${r}.${A._tag}`,{captureStackTrace:!1,attributes:t.spanAttributes},ee)}let B=y(A,O,A.payloadSchema.make?A.payloadSchema.make(P):P,I,D?.streamBufferSize??16,M);if(D?.asMailbox)return B;return cd(W(B,qF))}},h=(A,k,O,P,D,I,M)=>Zs((B)=>{if(l)return ia;let ee=s(),j=k({_tag:"Request",id:ee,tag:A._tag,payload:P,traceId:O?.traceId,spanId:O?.spanId,sampled:O?.sampled,headers:TV(B.getFiberRef(QJe),D)});if(M)return L(j,(G)=>t.onFromClient({message:G,context:I,discard:M}));let ae=DM({context:B.currentContext,fiberRefs:B.getFiberRefs(),runtimeFlags:Hm.runtimeFlags}),F,J=!1;return vR($o((G)=>{let Z={_tag:"Effect",rpc:A,context:I,resume(ne){if(J=!0,G(ne),F&&!F.unsafePoll())B.currentScheduler.scheduleTask(()=>{F.unsafeInterruptAsFork(B.id())},0,F)}};c.set(ee,Z),F=j.pipe(L((ne)=>t.onFromClient({message:ne,context:I,discard:M})),O?GC(O):te,xc(ae)),F.addObserver((ne)=>{if(ne._tag==="Failure")return G(ne)})}),(G)=>{if(J)return me;c.delete(ee);let Z=Array.from(G).flatMap((ne)=>Array.from(xJ(ne)));return ve(Ts(F),b(ee,Z,I))})}),y=Wn(function*(A,k,O,P,D,I){if(l)return yield*ia;let M=o?void 0:yield*QQ(`${r}.${A._tag}`,{captureStackTrace:!1,attributes:t.spanAttributes}),B=ru(SA()),ee=s(),j=qo(B.currentContext,wp);yield*OC(j,(F)=>{if(!c.has(ee))return me;return c.delete(ee),b(ee,Fa(F)?Array.from(K0(F.cause)).flatMap((J)=>Array.from(xJ(J))):[],I)});let ae=yield*Xc(D);return c.set(ee,{_tag:"Mailbox",rpc:A,mailbox:ae,scope:j,context:I}),yield*k({_tag:"Request",id:ee,tag:A._tag,traceId:M?.traceId,payload:O,spanId:M?.spanId,sampled:M?.sampled,headers:TV(B.getFiberRef(QJe),P)}).pipe(L((F)=>t.onFromClient({message:F,context:I,discard:!1})),M?GC(M):te,tn((F)=>ae.failCause(F)),an,hn(j)),ae}),E=(A)=>{let k=[];for(let O of A.middlewares.values()){let P=i.unsafeMap.get(`${O.key}/Client`);if(!P)continue;k.push(P)}return k.length===0?N:function(O){let P=0;return W(kg({while:()=>P<k.length,body:()=>k[P]({rpc:A,request:O}),step(D){O=D,P++}}),()=>O)}},b=(A,k,O)=>$o((P)=>{let D=ru(SA()),I=DM({context:D.currentContext,fiberRefs:D.getFiberRefs(),runtimeFlags:Hm.runtimeFlags});t.onFromClient({message:{_tag:"Interrupt",requestId:A,interruptors:k},context:O,discard:!1}).pipe(DR(1000),xc(I)).addObserver(()=>{P(me)})}),w=(A)=>{switch(A._tag){case"Chunk":{let k=A.requestId,O=c.get(k);if(!O||O._tag!=="Mailbox")return me;return O.mailbox.offerAll(A.values).pipe(n?ve(t.onFromClient({message:{_tag:"Ack",requestId:A.requestId},context:O.context,discard:!1})):te,tn((P)=>O.mailbox.done(gr(P))))}case"Exit":{let k=A.requestId,O=c.get(k);if(!O)return me;if(c.delete(k),O._tag==="Effect")return O.resume(A.exit),me;return O.mailbox.done(r8(A.exit))}case"Defect":return u(hu(A.defect));case"ClientEnd":return me}},T;if(t.flatten){let A=new Map;T=function(O,P,D){let I=A.get(O);if(!I)I=f(e.requests.get(O)),A.set(O,I);return I(P,D)}}else{T={};for(let A of e.requests.values()){let k=A._tag.indexOf("."),O=k===-1?void 0:A._tag.slice(0,k);if(O!==void 0&&!(O in T))T[O]={};let P=O!==void 0?T[O]:T,D=O!==void 0?A._tag.slice(k+1):A._tag;P[D]=f(A)}}return{client:T,write:w}}),KJt=Lb(-503,0),YJe=Wn(function*(e,t){let{run:r,send:n,supportsAck:o,supportsTransferables:s}=yield*wN,i=new Map,{client:a,write:c}=yield*Vae(e,{...t,supportsAck:o,onFromClient({message:l}){switch(l._tag){case"Request":{let u=e.requests.get(l.tag),f=hv(u.successSchema.ast),h=s?K_():void 0,y=ru(SA()),E={rpc:u,context:h?or(y.currentContext,tb,h):y.currentContext,decodeChunk:Oe(f)?Qr($m(f.value.success)):void 0};return i.set(l.id,E),Gm(u.payloadSchema)(l.payload).pipe(Au(Vc,E.context),Pr,L((b)=>n({...l,id:String(l.id),payload:b,headers:Object.entries(l.headers)},h&&h.unsafeClear())))}case"Ack":{if(!i.get(l.requestId))return me;return n({_tag:"Ack",requestId:String(l.requestId)})}case"Interrupt":{if(!i.get(l.requestId))return me;return i.delete(l.requestId),n({_tag:"Interrupt",requestId:String(l.requestId)})}case"Eof":return me}}});return yield*r((l)=>{switch(l._tag){case"Chunk":{let u=bh(l.requestId),f=i.get(u);if(!f||!f.decodeChunk)return me;return f.decodeChunk(l.values).pipe(Au(Vc,f.context),Pr,L((h)=>c({_tag:"Chunk",clientId:0,requestId:bh(l.requestId),values:h})),qC((h)=>c({_tag:"Exit",clientId:0,requestId:bh(l.requestId),exit:gr(h)})))}case"Exit":{let u=bh(l.requestId),f=i.get(u);if(!f)return me;return i.delete(u),ote(RG(f.rpc))(l.exit).pipe(Au(Vc,f.context),Pr,os({onSuccess:(h)=>c({_tag:"Exit",clientId:0,requestId:u,exit:h}),onFailure:(h)=>c({_tag:"Exit",clientId:0,requestId:u,exit:gr(h)})}))}case"Defect":return i.clear(),c({_tag:"Defect",clientId:0,defect:JJt(l.defect)});case"ClientProtocolError":{let u=Xr(l.error);return en(i.keys(),(f)=>(i.delete(f),c({_tag:"Exit",clientId:0,requestId:f,exit:u})))}default:return me}}).pipe(tn(zC),an,Ri),a}),QJe=je("@effect/rpc/RpcClient/currentHeaders",()=>ed(Cd));class wN extends Gs("@effect/rpc/RpcClient/Protocol")(){static make=vG()}var JJt=rO(io);var zG=Symbol.for("@effect/platform/HttpServerResponse"),YJt=Symbol.for("@effect/platform/HttpServerRespondable");class kN extends a0{status;statusText;cookies;body;[zG];headers;constructor(e,t,r,n,o){super();if(this.status=e,this.statusText=t,this.cookies=n,this.body=o,this[zG]=zG,o.contentType||o.contentLength){let s={...r};if(o.contentType)s["content-type"]=o.contentType;if(o.contentLength)s["content-length"]=o.contentLength.toString();this.headers=s}else this.headers=r}commit(){return N(this)}[YJt](){return N(this)}[dt](){return this.toJSON()}toString(){return Ut(this)}toJSON(){return{_id:"@effect/platform/HttpServerResponse",status:this.status,statusText:this.statusText,headers:ka(this.headers),cookies:this.cookies.toJSON(),body:this.body.toJSON()}}}var ZJe=(e)=>typeof e==="object"&&e!==null&&(zG in e),XJe=(e)=>new kN(e?.status??204,e?.statusText,e?.headers?Ci(e.headers):Cd,e?.cookies??vx,DV);var e6e=(e,t)=>{let r=t?.headers?Ci(t.headers):Cd;return new kN(t?.status??200,t?.statusText,r,t?.cookies??vx,TF(e,Gae(t,r)))},t6e=(e,t)=>{let r=t?.headers?Ci(t.headers):Cd;return new kN(t?.status??200,t?.statusText,r,t?.cookies??vx,z_(e,Gae(t,r)))};var r6e=(e,t)=>{let r=t?.headers?Ci(t.headers):Cd;return new kN(t?.status??200,t?.statusText,r,t?.cookies??vx,$_(e,Gae(t,r),t?.contentLength))},Gae=(e,t)=>{if(e?.contentType)return e.contentType;else if(e?.headers)return t["content-type"];else return};var n6e=ZJe,Ev=XJe;var o6e=e6e,s6e=t6e;var i6e=r6e;var IN=Symbol.for("@effect/platform/HttpServerRespondable");var Jae=(e)=>{if(n6e(e))return N(e);return Pr(e[IN]())};var c6e=Symbol.for("@effect/platform/HttpServerError");var Qae=c6e;class Qx extends xE(Qae,"RequestError"){[IN](){return Ev({status:400})}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 Yae extends xE(Qae,"RouteNotFound"){constructor(e){super(e);this.stack=`${this.name}: ${this.message}`}[IN](){return Ev({status:404})}get message(){return`${this.request.method} ${this.request.url} not found`}}class e6t extends xE(Qae,"ResponseError"){[IN](){return Ev({status:500})}get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return this.description?`${this.description} (${e})`:`${this.reason} error (${e})`}}var u6e=/; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu,p6e=/\\([\v\u0020-\u00ff])/gu,t6t=/^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u,r6t=/^[!#$%&'*+.^\w|~-]+$/u,$G={value:"",parameters:Object.create(null)};function jG(e,t=!1){if(typeof e!=="string")return $G;let r=e.indexOf(";"),n=r!==-1?e.slice(0,r).trim():e.trim();if((t?r6t:t6t).test(n)===!1)return $G;let s={value:n.toLowerCase(),parameters:Object.create(null)};if(r===-1)return s;let i,a,c;u6e.lastIndex=r;while(a=u6e.exec(e)){if(a.index!==r)return $G;if(r+=a[0].length,i=a[1].toLowerCase(),c=a[2],c[0]==='"')c=c.slice(1,c.length-1),!t&&p6e.test(c)&&(c=c.replace(p6e,"$1"));s.parameters[i]=c}if(r!==e.length)return $G;return s}var gf;(function(e){e[e.key=0]="key",e[e.whitespace=1]="whitespace",e[e.value=2]="value"})(gf||(gf={}));var AN={_tag:"Continue"},o6t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1],s6t=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];function f6e(){let e=new TextDecoder,t={state:gf.key,headers:Object.create(null),key:"",value:void 0,crlf:0,previousChunk:void 0,pairs:0,size:0};function r(s){return t.state=gf.key,t.headers=Object.create(null),t.key="",t.value=void 0,t.crlf=0,t.previousChunk=void 0,t.pairs=0,t.size=0,s}function n(s,i){let a=new Uint8Array(s.length+i.length);return a.set(s),a.set(i,s.length),a}function o(s){return r({_tag:"Failure",reason:s,headers:t.headers})}return function(i,a){let c=0,l;if(t.previousChunk!==void 0){c=t.previousChunk.length,l=c;let f=new Uint8Array(i.length+c);f.set(t.previousChunk),f.set(i,c),t.previousChunk=void 0,i=f}let u=i.length;e:while(a<u){if(t.state===gf.key){let f=a;for(;f<u;f++){if(t.size++>16384)return o("HeaderTooLarge");if(i[f]===58){if(t.key+=e.decode(i.subarray(a,f)).toLowerCase(),t.key.length===0)return o("InvalidHeaderName");if(i[f+1]===32&&i[f+2]!==32&&i[f+2]!==9)a=f+2,t.state=gf.value,t.size++;else if(i[f+1]!==32&&i[f+1]!==9)a=f+1,t.state=gf.value;else a=f+1,t.state=gf.whitespace;break}else if(o6t[i[f]]!==1)return o("InvalidHeaderName")}if(f===u)return t.key+=e.decode(i.subarray(a,u)).toLowerCase(),AN}if(t.state===gf.whitespace){for(;a<u;a++){if(t.size++>16384)return o("HeaderTooLarge");if(i[a]!==32&&i[a]!==9){t.state=gf.value;break}}if(a===u)return AN}if(t.state===gf.value){let f=a;if(l!==void 0)f=l,l=void 0;for(;f<u;f++){if(t.size++>16384)return o("HeaderTooLarge");if(i[f]===13||t.crlf>0){let h=i[f];if(h===13&&t.crlf===0)t.crlf=1,f++,t.size++,h=i[f];if(h===10&&t.crlf===1)t.crlf=2,f++,t.size++,h=i[f];if(h===13&&t.crlf===2)t.crlf=3,f++,t.size++,h=i[f];if(h===10&&t.crlf===3)t.crlf=4,f++,t.size++;if(t.crlf<4&&f>=u)return t.previousChunk=i.subarray(a),AN;else if(t.crlf>=2){t.value=t.value===void 0?i.subarray(a,f-t.crlf):n(t.value,i.subarray(a,f-t.crlf));let y=e.decode(t.value);if(t.headers[t.key]===void 0)t.headers[t.key]=y;else if(typeof t.headers[t.key]==="string")t.headers[t.key]=[t.headers[t.key],y];else t.headers[t.key].push(y);if(a=f,t.size--,t.crlf!==4&&t.pairs===100)return o("TooManyHeaders");else if(t.crlf===3)return o("InvalidHeaderValue");else if(t.crlf===4)return r({_tag:"Headers",headers:t.headers,endPosition:a-c});t.pairs++,t.key="",t.value=void 0,t.crlf=0,t.state=gf.key;continue e}}else if(s6t[i[f]]!==1)return o("InvalidHeaderValue")}if(f===u)return t.value=t.value===void 0?i.subarray(a,u):n(t.value,i.subarray(a,u)),AN}}if(a>u)t.size+=u-a;return AN}}function a6t(e){let t=new TextEncoder().encode(e),r=t.length,n={};for(let o=0;o<r;o++){let s=t[o];if(n[s]===void 0)n[s]=[];n[s].push(o)}return{needle:t,needleLength:r,indexes:n,firstByte:t[0],previousChunk:void 0,previousChunkLength:0,matchIndex:0}}function d6e(e,t,r){let n=a6t(e);if(r!==void 0)n.previousChunk=r,n.previousChunkLength=r.length;function o(){if("Buffer"in globalThis&&!(("Bun"in globalThis)||("Deno"in globalThis)))return function(l,u,f){return Buffer.prototype.indexOf.call(l,u,f)};let c=new Uint8Array(256).fill(n.needle.length);for(let l=0,u=n.needle.length-1;l<u;++l)c[n.needle[l]]=u-l;return function(l,u,f){let h=l.length,y=f+n.needleLength-1;while(y<h){for(let E=n.needleLength-1,b=y;E>=0&&l[b]===u[E];E--,b--)if(E===0)return b;y+=c[l[y]]}return-1}}let s=o();function i(c){let l=c.length;if(n.previousChunk!==void 0){let f=new Uint8Array(n.previousChunkLength+l);f.set(n.previousChunk),f.set(c,n.previousChunkLength),c=f,l=n.previousChunkLength+l,n.previousChunk=void 0}if(l<n.needleLength){n.previousChunk=c,n.previousChunkLength=l;return}let u=0;while(u<l){let f=s(c,n.needle,u);if(f>-1){if(f>u)t(n.matchIndex,c.subarray(u,f));n.matchIndex+=1,u=f+n.needleLength;continue}else if(c[l-1]in n.indexes){let h=n.indexes[c[l-1]],y=-1;for(let E=0,b=h.length;E<b;E++){let w=h[E];if(c[l-1-w]===n.firstByte&&E>y)y=w}if(y===-1)if(u===0)t(n.matchIndex,c);else t(n.matchIndex,c.subarray(u));else{if(l-1-y>u)t(n.matchIndex,c.subarray(u,l-1-y));n.previousChunk=c.subarray(l-1-y),n.previousChunkLength=y+1}}else if(u===0)t(n.matchIndex,c);else t(n.matchIndex,c.subarray(u));break}}function a(){if(n.previousChunk!==void 0&&n.previousChunk!==r)t(n.matchIndex,n.previousChunk);n.previousChunk=r,n.previousChunkLength=r?.length??0,n.matchIndex=0}return{write:i,end:a}}var Yx;(function(e){e[e.headers=0]="headers",e[e.body=1]="body"})(Yx||(Yx={}));var l6t={_tag:"InvalidDisposition"},u6t={_tag:"EndNotReached"},p6t={_tag:"ReachedLimit",limit:"MaxParts"},f6t={_tag:"ReachedLimit",limit:"MaxTotalSize"},d6t={_tag:"ReachedLimit",limit:"MaxPartSize"},m6e={_tag:"ReachedLimit",limit:"MaxFieldSize"},m6t=new TextEncoder().encode(`\r
|
|
634
|
+
`);function Zae(e){return e.filename!==void 0||e.contentType==="application/octet-stream"}function h6t(e){return jG(e["content-type"]).parameters.boundary}function VG(e){}function g6e({headers:e,onFile:t,onField:r,onError:n,onDone:o,isFile:s=Zae,maxParts:i=1/0,maxTotalSize:a=1/0,maxPartSize:c=1/0,maxFieldSize:l=1048576}){let u=h6t(e);if(u===void 0)return n({_tag:"InvalidBoundary"}),{write:VG,end(){}};let f={state:Yx.headers,index:0,parts:0,onChunk:VG,info:void 0,headerSkip:0,partSize:0,totalSize:0,isFile:!1,fieldChunks:[],fieldSize:0};function h(){f.state=Yx.body,f.isFile=!0,f.onChunk=VG}let y=f6e(),E=d6e(`\r
|
|
635
|
+
--${u}`,function(b,w){if(b===0){h();return}else if(b!==f.index){if(f.index>0)if(f.isFile)f.onChunk(null),f.partSize=0;else{if(f.fieldChunks.length===1)r(f.info,f.fieldChunks[0]);else{let T=new Uint8Array(f.fieldSize),A=0;for(let k=0;k<f.fieldChunks.length;k++){let O=f.fieldChunks[k];T.set(O,A),A+=O.length}r(f.info,T)}f.fieldSize=0,f.fieldChunks=[]}if(f.state=Yx.headers,f.index=b,f.headerSkip=2,w[0]===45&&w[1]===45)return o();if(f.parts++,f.parts>i)n(p6t)}if((f.partSize+=w.length)>c)n(d6t);if(f.state===Yx.headers){let T=y(w,f.headerSkip);if(f.headerSkip=0,T._tag==="Continue")return;else if(T._tag==="Failure")return h(),n({_tag:"BadHeaders",error:T});let A=jG(T.headers["content-type"]),k=jG(T.headers["content-disposition"],!0);if(k.value==="form-data"&&!("name"in k.parameters))return h(),n(l6t);let O;if("filename*"in k.parameters){let P=k.parameters["filename*"].split("''");if(P.length===2)O=decodeURIComponent(P[1])}if(f.info={name:k.parameters.name??"",filename:O??k.parameters.filename,contentType:A.value===""?k.parameters.filename!==void 0?"application/octet-stream":"text/plain":A.value,contentTypeParameters:A.parameters,contentDisposition:k.value,contentDispositionParameters:k.parameters,headers:T.headers},f.state=Yx.body,f.isFile=s(f.info),f.isFile)f.onChunk=t(f.info);if(T.endPosition<w.length)if(f.isFile)f.onChunk(w.subarray(T.endPosition));else{let P=w.subarray(T.endPosition);if((f.fieldSize+=P.length)>l)n(m6e);f.fieldChunks.push(P)}}else if(f.isFile)f.onChunk(w);else{if((f.fieldSize+=w.length)>l)n(m6e);f.fieldChunks.push(w)}},m6t);return{write(b){if((f.totalSize+=b.length)>a)return n(f6t);return E.write(b)},end(){if(E.end(),f.state===Yx.body)n(u6t);f.state=Yx.headers,f.index=0,f.parts=0,f.onChunk=VG,f.info=void 0,f.totalSize=0,f.partSize=0,f.fieldChunks=[],f.fieldSize=0}}}var h6e=new TextDecoder("utf-8");function g6t(e){if(e==="utf-8"||e==="utf8"||e==="")return h6e;try{return new TextDecoder(e)}catch(t){return h6e}}function x6e(e,t){return g6t(e.contentTypeParameters.charset??"utf-8").decode(t)}var y6e=g6e,S6e=Zae,E6e=x6e;var Xae=Symbol.for("@effect/platform/Multipart");var b6e=Symbol.for("@effect/platform/Multipart/MultipartError");class xf extends ri()("MultipartError",{reason:qe("FileTooLarge","FieldTooLarge","BodyTooLarge","TooManyParts","InternalError","Parse"),cause:io}){[b6e]=b6e;get message(){return this.reason}}var S6t=(e)=>Zs((t)=>{let r=er(t.currentContext,R6e);return N({headers:e,maxParts:Ar(er(t.currentContext,_6e)),maxFieldSize:Number(er(t.currentContext,v6e)),maxPartSize:er(t.currentContext,T6e).pipe(jt(Number),Ar),maxTotalSize:er(t.currentContext,W_).pipe(jt(Number),Ar),isFile:r.length===0?void 0:(n)=>!$4(r,(o)=>n.contentType.includes(o))&&S6e(n)})}),w6e=(e,t=16)=>qW(Ha([S6t(e),Xc(t)]),([r,n])=>{let o=[],s=R(),i={awaitRead:()=>me,emit(u){return n.offer(u)},error(u){return s=_(gr(u)),n.end},done(u){return n.end}},a=y6e({...r,onField(u,f){o.push(new k6e(u.name,u.contentType,E6e(u,f)))},onFile(u){let f=[],h=!1,y=bw(()=>{if(f.length===0)return h?Yg:kP(c,y);let E=nt(f);return f=[],h?nE(E):kP(nE(E),kP(c,y))});return o.push(new I6e(u,y)),function(E){if(E===null)h=!0;else f.push(E)}},onError(u){s=_(Xr(E6t(u)))},onDone(){s=_(ta)}}),c=id(n.takeAll,([u,f])=>rPe(()=>{if(lI(u,lI(a.write)),f)a.end()})),l=id(c,()=>{if(o.length===0)return s._tag==="None"?l:C6e(s.value);let u=nt(o);return o=[],kP(nE(u),s._tag==="None"?l:C6e(s.value))});return UO(l,i)},([,r])=>r.shutdown),C6e=(e)=>e._tag==="Success"?Yg:aX(e.cause);function E6t(e){switch(e._tag){case"ReachedLimit":switch(e.limit){case"MaxParts":return new xf({reason:"TooManyParts",cause:e});case"MaxFieldSize":return new xf({reason:"FieldTooLarge",cause:e});case"MaxPartSize":return new xf({reason:"FileTooLarge",cause:e});case"MaxTotalSize":return new xf({reason:"BodyTooLarge",cause:e})}default:return new xf({reason:"Parse",cause:e})}}class GG extends cl{[Xae];constructor(){super();this[Xae]=Xae}}class k6e extends GG{key;contentType;value;_tag="Field";constructor(e,t,r){super();this.key=e,this.contentType=t,this.value=r}toJSON(){return{_id:"@effect/platform/Multipart/Part",_tag:"Field",key:this.key,contentType:this.contentType,value:this.value}}}class I6e extends GG{_tag="File";key;name;contentType;content;contentEffect;constructor(e,t){super();this.key=e.name,this.name=e.filename??e.name,this.contentType=e.contentType,this.content=Zg(t),this.contentEffect=t.pipe(ZMe(C6t),ePe,br((r)=>new xf({reason:"InternalError",cause:r})))}toJSON(){return{_id:"@effect/platform/Multipart/Part",_tag:"File",key:this.key,name:this.name,contentType:this.contentType}}}var b6t=(e,t)=>L(Hi,(r)=>br(ad(t.content,r.sink(e)),(n)=>new xf({reason:"InternalError",cause:n}))),C6t=bw(()=>{let e=new Uint8Array(0),t=XMe({onInput(r){for(let n of r){let o=new Uint8Array(e.length+n.length);o.set(e,0),o.set(n,e.length),e=o}return t},onFailure:(r)=>aX(r),onDone:()=>tPe(e)});return t}),A6e=(e,t=b6t)=>$e(function*(){let r=yield*Hi,n=yield*wc,o=yield*r.makeTempDirectoryScoped(),s=Object.create(null);return yield*RP(e,(i)=>{if(i._tag==="Field"){if(!(i.key in s))s[i.key]=i.value;else if(typeof s[i.key]==="string")s[i.key]=[s[i.key],i.value];else s[i.key].push(i.value);return me}else if(i.name==="")return me;let a=i,c=n.join(o,n.basename(a.name).slice(-128)),l=new O6e(a.key,a.name,a.contentType,c);if(Array.isArray(s[i.key]))s[i.key].push(l);else s[i.key]=[l];return t(c,a)}),s}).pipe(gS({SystemError:(r)=>ie(new xf({reason:"InternalError",cause:r})),BadArgument:(r)=>ie(new xf({reason:"InternalError",cause:r}))}));class O6e extends GG{key;name;contentType;path;_tag="PersistedFile";constructor(e,t,r,n){super();this.key=e,this.name=t,this.contentType=r,this.path=n}toJSON(){return{_id:"@effect/platform/Multipart/Part",_tag:"PersistedFile",key:this.key,name:this.name,contentType:this.contentType,path:this.path}}}class _6e extends ko()("@effect/platform/Multipart/MaxParts",{defaultValue:R}){}class v6e extends ko()("@effect/platform/Multipart/MaxFieldSize",{defaultValue:nl(lx(10485760))}){}class T6e extends ko()("@effect/platform/Multipart/MaxFileSize",{defaultValue:R}){}class R6e extends ko()("@effect/platform/Multipart/FieldMimeTypes",{defaultValue:nl(kf("application/json"))}){}var KG=Symbol.for("@effect/platform/HttpServerRequest"),M6e=qt("@effect/platform/HttpServerRequest"),P6e=qt("@effect/platform/HttpServerRequest/ParsedSearchParams");class D6e extends cl{source;url;headersOverride;remoteAddressOverride;[KG];[zi];constructor(e,t,r,n){super();this.source=e,this.url=t,this.headersOverride=r,this.remoteAddressOverride=n,this[KG]=KG,this[zi]=zi}toJSON(){return KE(this,{_id:"@effect/platform/HttpServerRequest",method:this.method,url:this.originalUrl})}modify(e){return new D6e(this.source,e.url??this.url,e.headers??this.headersOverride,e.remoteAddress??this.remoteAddressOverride)}get method(){return this.source.method.toUpperCase()}get originalUrl(){return this.source.url}get remoteAddress(){return this.remoteAddressOverride?_(this.remoteAddressOverride):R()}get headers(){return this.headersOverride??=Ci(this.source.headers),this.headersOverride}cachedCookies;get cookies(){if(this.cachedCookies)return this.cachedCookies;return this.cachedCookies=P$e(this.headers.cookie??"")}get stream(){return this.source.body?Cw(()=>this.source.body,(e)=>new Qx({request:this,reason:"Decode",cause:e})):oE(new Qx({request:this,reason:"Decode",description:"can not create stream from empty body"}))}textEffect;get text(){if(this.textEffect)return this.textEffect;return this.textEffect=xr(Bc(Ds({try:()=>this.source.text(),catch:(e)=>new Qx({request:this,reason:"Decode",cause:e})}))),this.textEffect}get json(){return jf(this.text,{try:(e)=>JSON.parse(e),catch:(e)=>new Qx({request:this,reason:"Decode",cause:e})})}get urlParamsBody(){return L(this.text,(e)=>Ps({try:()=>zu(new URLSearchParams(e)),catch:(t)=>new Qx({request:this,reason:"Decode",cause:t})}))}multipartEffect;get multipart(){if(this.multipartEffect)return this.multipartEffect;return this.multipartEffect=xr(Bc(A6e(this.multipartStream))),this.multipartEffect}get multipartStream(){return xX(_P(this.stream,(e)=>new xf({reason:"InternalError",cause:e})),w6e(this.headers))}arrayBufferEffect;get arrayBuffer(){if(this.arrayBufferEffect)return this.arrayBufferEffect;return this.arrayBufferEffect=xr(Bc(Ds({try:()=>this.source.arrayBuffer(),catch:(e)=>new Qx({request:this,reason:"Decode",cause:e})}))),this.arrayBufferEffect}get upgrade(){return ie(new Qx({request:this,reason:"Decode",description:"Not an upgradeable ServerRequest"}))}}var bv=M6e,F6e=P6e;var L6e=je(Symbol.for("@effect/platform/HttpMiddleware/loggerDisabled"),()=>ed(!1)),U6e=(e)=>ve(YAe(L6e,!0),e);var H6e=/\+/g,q6e=function(){};q6e.prototype=Object.create(null);function B6e(e){let t=new q6e;if(typeof e!=="string")return t;let r=e.length,n="",o="",s=-1,i=-1,a=!1,c=!1,l=!1,u=!1,f=!1,h=0;for(let y=0;y<r+1;y++)if(h=y!==r?e.charCodeAt(y):38,h===38){if(f=i>s,!f)i=y;if(n=e.slice(s+1,i),f||n.length>0){if(l)n=n.replace(H6e," ");if(a)try{n=decodeURIComponent(n)||n}catch{}if(f){if(o=e.slice(i+1,y),u)o=o.replace(H6e," ");if(c)try{o=decodeURIComponent(o)||o}catch{}}let E=t[n];if(E===void 0)t[n]=o;else if(E.pop)E.push(o);else t[n]=[E,o]}o="",s=y,i=y,a=!1,c=!1,l=!1,u=!1}else if(h===61)if(i<=s)i=y;else c=!0;else if(h===43)if(i>s)u=!0;else l=!0;else if(h===37)if(i>s)c=!0;else a=!0;return t}var O6t=/^https?:\/\/.*?\//,ece=/(\/:[^/()]*?)\?(\/?)/,j6e=(e={})=>new V6e(e);class V6e{constructor(e={}){this.options={ignoreTrailingSlash:!0,ignoreDuplicateSlashes:!0,caseSensitive:!1,maxParamLength:100,...e}}options;routes=[];trees={};on(e,t,r){let n=t.match(ece);if(n&&n.index!==void 0){_6t(t.length===n.index+n[0].length,"Optional Parameter needs to be the last parameter of the path");let s=t.replace(ece,"$1$2"),i=t.replace(ece,"$2");this.on(e,s,r),this.on(e,i,r);return}if(this.options.ignoreDuplicateSlashes)t=W6e(t);if(this.options.ignoreTrailingSlash)t=z6e(t);let o=typeof e==="string"?[e]:e;for(let s of o)this._on(s,t,r)}all(e,t){this.on(D6t,e,t)}_on(e,t,r){if(this.trees[e]===void 0)this.trees[e]=new ON("/");let n=t;if(n==="*"&&this.trees[e].prefix.length!==0){let c=this.trees[e];this.trees[e]=new ON(""),this.trees[e].staticChildren["/"]=c}let o=this.trees[e].prefix.length,s=this.trees[e],i=[];for(let c=0;c<=n.length;c++){if(n.charCodeAt(c)===58&&n.charCodeAt(c+1)===58){c++;continue}let l=n.charCodeAt(c)===58&&n.charCodeAt(c+1)!==58,u=n.charCodeAt(c)===42;if(l||u||c===n.length&&c!==o){let f=n.slice(o,c);if(!this.options.caseSensitive)f=f.toLowerCase();f=f.split("::").join(":"),f=f.split("%").join("%25"),s=s.createStaticChild(f)}if(l){let f=!1,h=[],y=c+1;for(let E=y;;E++){let b=n.charCodeAt(E),w=b===40,T=b===45||b===46,A=b===47||E===n.length;if(w||T||A){let k=n.slice(y,E);if(i.push(k),f=f||w||T,w){let D=T6t(n,E),I=n.slice(E,D+1);h.push(R6t(I)),E=D+1}else h.push("(.*?)");let O=E;for(;E<n.length;E++){let D=n.charCodeAt(E);if(D===47)break;if(D===58)if(n.charCodeAt(E+1)===58)E++;else break}let P=n.slice(O,E);if(P)P=P.split("::").join(":"),P=P.split("%").join("%25"),h.push(M6t(P));if(y=E+1,A||n.charCodeAt(E)===47||E===n.length){let D=f?"()"+P:P,I=n.slice(c,E);n=n.slice(0,c+1)+D+n.slice(E),c+=D.length;let M=f?new RegExp("^"+h.join("")+"$"):void 0;s=s.createParametricChild(M,P,I),o=c+1;break}}}}else if(u){if(i.push("*"),s=s.createWildcardChild(),o=c+1,c!==n.length-1)throw Error("Wildcard must be the last character in the route")}}if(!this.options.caseSensitive)n=n.toLowerCase();if(n==="*")n="/*";for(let c of this.routes)if(c.method===e&&c.pattern===n)throw Error(`Method '${e}' already declared for route '${n}'`);let a={method:e,path:t,pattern:n,params:i,handler:r};this.routes.push(a),s.addRoute(a)}has(e,t){let r=this.trees[e];if(r===void 0)return!1;let n=r.getStaticChild(t);if(n===void 0)return!1;return n.isLeafNode}find(e,t){let r=this.trees[e];if(r===void 0)return;if(t.charCodeAt(0)!==47)t=t.replace(O6t,"/");if(this.options.ignoreDuplicateSlashes)t=W6e(t);let n,o,s;try{n=P6t(t),t=n.path,o=n.querystring,s=n.shouldDecodeParam}catch(h){return}if(this.options.ignoreTrailingSlash)t=z6e(t);let i=t;if(this.options.caseSensitive===!1)t=t.toLowerCase();let a=this.options.maxParamLength,c=r.prefix.length,l=[],u=t.length,f=[];while(!0){if(c===u&&r.isLeafNode){let y=r.handlerStorage?.find();if(y!==void 0)return{handler:y.handler,params:y.createParams(l),searchParams:B6e(o)}}let h=r.getNextNode(t,c,f,l.length);if(h===void 0){if(f.length===0)return;let y=f.pop();c=y.brotherPathIndex,l.splice(y.paramsCount),h=y.brotherNode}if(r=h,r._tag==="StaticNode"){c+=r.prefix.length;continue}if(r._tag==="WildcardNode"){let y=i.slice(c);if(s)y=$6e(y);l.push(y),c=u;continue}if(r._tag==="ParametricNode"){let y=i.indexOf("/",c);if(y===-1)y=u;let E=i.slice(c,y);if(s)E=$6e(E);if(r.regex!==void 0){let b=r.regex.exec(E);if(b===null)continue;for(let w=1;w<b.length;w++){let T=b[w];if(T.length>a)return;l.push(T)}}else{if(E.length>a)return;l.push(E)}c=y}}}}class G6e{handlers=[];unconstrainedHandler;find(){return this.unconstrainedHandler}add(e){let t={params:e.params,handler:e.handler,createParams:v6t(e.params)};this.handlers.push(t),this.unconstrainedHandler=this.handlers[0]}}class tce{isLeafNode=!1;routes;handlerStorage;addRoute(e){if(this.routes===void 0)this.routes=[e];else this.routes.push(e);if(this.handlerStorage===void 0)this.handlerStorage=new G6e;this.isLeafNode=!0,this.handlerStorage.add(e)}}class rce extends tce{staticChildren={};findStaticMatchingChild(e,t){let r=this.staticChildren[e.charAt(t)];if(r===void 0||!r.matchPrefix(e,t))return;return r}getStaticChild(e,t=0){if(e.length===t)return this;let r=this.findStaticMatchingChild(e,t);if(r===void 0)return;return r.getStaticChild(e,t+r.prefix.length)}createStaticChild(e){if(e.length===0)return this;let t=this.staticChildren[e.charAt(0)];if(t){let n=1;for(;n<t.prefix.length;n++)if(e.charCodeAt(n)!==t.prefix.charCodeAt(n)){t=t.split(this,n);break}return t.createStaticChild(e.slice(n))}let r=e.charAt(0);return this.staticChildren[r]=new ON(e),this.staticChildren[r]}}class ON extends rce{_tag="StaticNode";constructor(e){super();this.setPrefix(e)}prefix;matchPrefix;parametricChildren=[];wildcardChild;setPrefix(e){if(this.prefix=e,e.length===1)this.matchPrefix=(t,r)=>!0;else{let t=e.length;this.matchPrefix=function(r,n){for(let o=1;o<t;o++)if(r.charCodeAt(n+o)!==this.prefix.charCodeAt(o))return!1;return!0}}}getParametricChild(e){if(e===void 0)return this.parametricChildren.find((r)=>r.isRegex===!1);let t=e.source;return this.parametricChildren.find((r)=>{if(r.regex===void 0)return!1;return r.regex.source===t})}createParametricChild(e,t,r){let n=this.getParametricChild(e);if(n!==void 0)return n.nodePaths.add(r),n;return n=new K6e(e,t,r),this.parametricChildren.push(n),this.parametricChildren.sort((o,s)=>{if(!o.isRegex)return 1;if(!s.isRegex)return-1;if(o.staticSuffix===void 0)return 1;if(s.staticSuffix===void 0)return-1;if(s.staticSuffix.endsWith(o.staticSuffix))return 1;if(o.staticSuffix.endsWith(s.staticSuffix))return-1;return 0}),n}createWildcardChild(){if(this.wildcardChild===void 0)this.wildcardChild=new J6e;return this.wildcardChild}split(e,t){let r=this.prefix.slice(0,t),n=this.prefix.slice(t);this.setPrefix(n);let o=new ON(r);return o.staticChildren[n.charAt(0)]=this,e.staticChildren[r.charAt(0)]=o,o}getNextNode(e,t,r,n){let o=this.findStaticMatchingChild(e,t),s=0;if(o===void 0){if(this.parametricChildren.length===0)return this.wildcardChild;o=this.parametricChildren[0],s=1}if(this.wildcardChild!==void 0)r.push({paramsCount:n,brotherPathIndex:t,brotherNode:this.wildcardChild});for(let i=this.parametricChildren.length-1;i>=s;i--)r.push({paramsCount:n,brotherPathIndex:t,brotherNode:this.parametricChildren[i]});return o}}class K6e extends rce{regex;staticSuffix;_tag="ParametricNode";constructor(e,t,r){super();this.regex=e,this.staticSuffix=t,this.isRegex=!!e,this.nodePaths=new Set([r])}isRegex;nodePaths;getNextNode(e,t){return this.findStaticMatchingChild(e,t)}}class J6e extends tce{_tag="WildcardNode";getNextNode(e,t,r,n){return}}var _6t=(e,t)=>{if(!e)throw Error(t)};function W6e(e){return e.replace(/\/\/+/g,"/")}function z6e(e){if(e.length>1&&e.charCodeAt(e.length-1)===47)return e.slice(0,-1);return e}function v6t(e){let t=e.length;return function(r){let n={};for(let o=0;o<t;o++)n[e[o]]=r[o];return n}}function T6t(e,t){let r=1;while(t<e.length){if(t++,e[t]==="\\"){t++;continue}if(e[t]===")")r--;else if(e[t]==="(")r++;if(!r)return t}throw TypeError('Invalid regexp expression in "'+e+'"')}function R6t(e){if(e.charCodeAt(1)===94)e=e.slice(0,1)+e.slice(2);if(e.charCodeAt(e.length-2)===36)e=e.slice(0,e.length-2)+e.slice(e.length-1);return e}function M6t(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Q6e(e,t){if(e===50){if(t===53)return"%";if(t===51)return"#";if(t===52)return"$";if(t===54)return"&";if(t===66)return"+";if(t===98)return"+";if(t===67)return",";if(t===99)return",";if(t===70)return"/";if(t===102)return"/";return}if(e===51){if(t===65)return":";if(t===97)return":";if(t===66)return";";if(t===98)return";";if(t===68)return"=";if(t===100)return"=";if(t===70)return"?";if(t===102)return"?";return}if(e===52&&t===48)return"@";return}function P6t(e){let t=!1,r=!1,n="";for(let s=1;s<e.length;s++){let i=e.charCodeAt(s);if(i===37){let a=e.charCodeAt(s+1),c=e.charCodeAt(s+2);if(Q6e(a,c)===void 0)t=!0;else{if(r=!0,a===50&&c===53)t=!0,e=e.slice(0,s+1)+"25"+e.slice(s+1),s+=2;s+=2}}else if(i===63||i===59||i===35){n=e.slice(s+1),e=e.slice(0,s);break}}return{path:t?decodeURI(e):e,querystring:n,shouldDecodeParam:r}}function $6e(e){let t=e.indexOf("%");if(t===-1)return e;let r="",n=t;for(let o=t;o<e.length;o++)if(e.charCodeAt(o)===37){let s=e.charCodeAt(o+1),i=e.charCodeAt(o+2),a=Q6e(s,i);r+=e.slice(n,o)+a,n=o+3}return e.slice(0,t)+r+e.slice(n)}var D6t=["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 JG=j6e;var Y6e=U6e;var oce=Symbol.for("@effect/platform/HttpServer"),Z6e=qt("@effect/platform/HttpServer"),TTr={[oce]:oce};var X6e=p((e)=>mn(e[0]),(e,t)=>yi(L(Z6e,(r)=>r.serve(e,t))));var e8e=X6e;var Cv=Symbol.for("@effect/platform/HttpRouter"),QG=Symbol.for("@effect/platform/HttpRouter/Route"),YG=Symbol.for("@effect/platform/HttpRouter/RouteContext"),sce=qt("@effect/platform/HttpRouter/RouteContext"),H6t=(e)=>de(e,Cv);var r8e=je("@effect/platform/HttpRouter/currentRouterConfig",()=>ed({}));class Pk extends a0{routes;mounts;[Cv];constructor(e,t){super();this.routes=e,this.mounts=t,this[Cv]=Cv,this.httpApp=n8e(this).pipe(L((r)=>this.httpApp=r))}httpApp;commit(){return this.httpApp}toJSON(){return{_id:"Router",routes:this.routes.toJSON(),mounts:this.mounts.toJSON()}}toString(){return Ut(this)}[dt](){return this.toJSON()}}var n8e=(e)=>W(Fq(r8e),(t)=>{let r=JG(t),n=lr(e.mounts).map(([s,i,a])=>[s,new ice(new ZG("*",a?.includePrefix?`${s}/*`:"/*",i,a?.includePrefix?R():_(s),!1),{}),a]),o=n.length;return lI(e.routes,(s)=>{if(s.method==="*")r.all(s.path,s);else r.on(s.method,s.path,s)}),Zs((s)=>{let i=Oa(new Map(s.getFiberRef(Vc).unsafeMap)),a=qo(i,bv);if(o>0){let h=a.url.indexOf("?"),y=h===-1?a.url:a.url.slice(0,h);for(let E=0;E<o;E++){let[b,w,T]=n[E];if(y===b||y.startsWith(b+"/")){if(i.unsafeMap.set(sce.key,w),T?.includePrefix!==!0)i.unsafeMap.set(bv.key,t8e(a,b));return Au(L(w.route.handler,Jae),Vc,i)}}}let c=r.find(a.method,a.url);if(c===void 0&&a.method==="HEAD")c=r.find("GET",a.url);if(c===void 0)return ie(new Yae({request:a}));let l=c.handler;if(l.prefix._tag==="Some")i.unsafeMap.set(bv.key,t8e(a,l.prefix.value));i.unsafeMap.set(F6e.key,c.searchParams),i.unsafeMap.set(sce.key,new ice(l,c.params));let u=ws(i,QI);if(u._tag==="Some"&&u.value._tag==="Span")u.value.attribute("http.route",l.path);let f=L(l.handler,Jae);return Au(l.uninterruptible?f:an(f),Vc,i)})});function t8e(e,t){let r=t.length;return e.modify({url:e.url.length<=r?"/":e.url.slice(r)})}class ZG extends cl{method;path;handler;prefix;uninterruptible;[QG];constructor(e,t,r,n=R(),o=!1){super();this.method=e,this.path=t,this.handler=r,this.prefix=n,this.uninterruptible=o,this[QG]=QG}toJSON(){return{_id:"@effect/platform/HttpRouter/Route",method:this.method,path:this.path,prefix:this.prefix.toJSON()}}}class ice{route;params;[YG];constructor(e,t){this.route=e,this.params=t,this[YG]=YG}}var o8e=new Pk(Ze(),Ze());var s8e=p(2,(e,t)=>new Pk(Is(e.routes,t),e.mounts)),ace=p(2,(e,t)=>i8e(e,t)),i8e=(...e)=>new Pk(e.reduce((t,r)=>Vt(t,r.routes),Ze()),e.reduce((t,r)=>Vt(t,r.mounts),Ze())),a8e=(e)=>e.endsWith("/")?e.slice(0,-1):e;var c8e=p(2,(e,t)=>(t=a8e(t),new Pk(Vr(e.routes,(r)=>new ZG(r.method,r.path==="/"?t:t+r.path,r.handler,pi(jt(r.prefix,(n)=>t+n),()=>_(t)),r.uninterruptible)),Vr(e.mounts,([r,n])=>[r==="/"?t:t+r,n])))),l8e=p(3,(e,t,r)=>ace(e,c8e(r,t))),u8e=p((e)=>de(e[0],Cv),(e,t,r,n)=>new Pk(e.routes,Is(e.mounts,[a8e(t),r,n]))),Zx=(e)=>p((t)=>H6t(t[0]),(t,r,n,o)=>new Pk(Is(t.routes,new ZG(e,r,n,R(),o?.uninterruptible??!1)),t.mounts)),p8e=Zx("*"),f8e=Zx("GET"),d8e=Zx("POST"),m8e=Zx("PUT"),h8e=Zx("PATCH"),g8e=Zx("DELETE"),x8e=Zx("HEAD"),y8e=Zx("OPTIONS");var q6t=()=>{let e=o8e;return{addRoute(t){return Ce(()=>{e=s8e(e,t)})},all(t,r,n){return Ce(()=>{e=p8e(e,t,r,n)})},get(t,r,n){return Ce(()=>{e=f8e(e,t,r,n)})},post(t,r,n){return Ce(()=>{e=d8e(e,t,r,n)})},put(t,r,n){return Ce(()=>{e=m8e(e,t,r,n)})},patch(t,r,n){return Ce(()=>{e=h8e(e,t,r,n)})},del(t,r,n){return Ce(()=>{e=g8e(e,t,r,n)})},head(t,r,n){return Ce(()=>{e=x8e(e,t,r,n)})},options(t,r,n){return Ce(()=>{e=y8e(e,t,r,n)})},router:Ce(()=>e),mount(t,r){return Ce(()=>{e=l8e(e,t,r)})},mountApp(t,r,n){return Ce(()=>{e=u8e(e,t,r,n)})},concat(t){return Ce(()=>{e=ace(e,t)})}}},S8e=(e)=>()=>{let t=globalThis.Error,r=t.stackTraceLimit;t.stackTraceLimit=2;let n=new t;t.stackTraceLimit=r;function o(){}let s=o;return Object.setPrototypeOf(o,Object.getPrototypeOf(qt(e))),o.key=e,Object.defineProperty(o,"stack",{get(){return n.stack}}),s.Live=ow(s,q6t),s.router=L(s,(i)=>i.router),s.use=(i)=>s.pipe(L(i),yi,Oo(s.Live)),s.unwrap=(i)=>s.pipe(L((a)=>a.router),W(i),XY,Oo(s.Live)),s.serve=(i)=>s.unwrap(e8e(i)),o};var W6t=S8e;class XG extends W6t("@effect/platform/HttpRouter/Default")(){}var rK=(e,t)=>{let r=t.definitionPath??"#/$defs/",n=(a)=>r+a,o=t.target??"jsonSchema7",s=t.topLevelReferenceStrategy??"keep",i=t.additionalPropertiesStrategy??"strict";return ci(e,t.definitions,"handle-identifier",[],{getRef:n,target:o,topLevelReferenceStrategy:s,additionalPropertiesStrategy:i},"handle-annotation","handle-errors")},_N={$id:"/schemas/never",not:{}},Dk={$id:"/schemas/any"},w8e={$id:"/schemas/unknown"},k8e={$id:"/schemas/void"},$6t={$id:"/schemas/object",anyOf:[{type:"object"},{type:"array"}]},j6t={$id:"/schemas/%7B%7D",anyOf:[{type:"object"},{type:"array"}]};function I8e(e){if(e!==void 0)return Ar(Tg(e))}function A8e(e){if(e!==void 0)return Ar(KR(e))}function O8e(e){if(e!==void 0)return WIe(e);return R()}function V6t(e,t){return tO(e,!1)(t)}function _8e(e){if(e!==void 0)return Ar(BIe(e))}function G6t(e,t){let r=tO(e,!1),n=Tc(t,(o)=>r(o).pipe(Vi(eK)));return n.length>0?n:void 0}function E8e(e,t,r){if(t!==void 0)switch(e._tag){case"StringKeyword":return t!==VA.annotations[r]?t:void 0;case"NumberKeyword":return t!==GA.annotations[r]?t:void 0;case"BooleanKeyword":return t!==KA.annotations[r]?t:void 0}return t}function eK(e,t=new Set){if(e===null||typeof e==="string"||typeof e==="number"||typeof e==="boolean")return!0;if(Array.isArray(e)||typeof e==="object"){if(t.has(e))return!1;t.add(e);try{if(Array.isArray(e))return e.every((n)=>eK(n,t));let r=Object.getPrototypeOf(e);if(r!==null&&r!==Object.prototype)return!1;if(Object.getOwnPropertySymbols(e).length>0)return!1;return Object.values(e).every((n)=>eK(n,t))}finally{t.delete(e)}}return!1}function v8e(e,t,r,n,o){let s={};if(t!==void 0)s.description=t;if(r!==void 0)s.title=r;if(Oe(n)){let i=V6t(e,n.value);if(Oe(i)&&eK(i.value))s.default=i.value}if(o!==void 0){let i=G6t(e,o);if(i!==void 0)s.examples=i}if(Object.keys(s).length===0)return;return s}function cce(e,t){return v8e(e,I8e(t),A8e(t),O8e(t),_8e(t))}function T8e(e){return v8e(e,E8e(e,I8e(e),_l),E8e(e,A8e(e),za),O8e(e),_8e(e))}function lce(e,t){if(t){if("$ref"in e)return{allOf:[e],...t};return{...e,...t}}return e}var tK=(e)=>{if(vt(xY(e)))return vq(e,tK,(t)=>tK(t.from))},K6t=(e)=>e.annotations[QC]===Eq,J6t=(e,t)=>{if(Nm(e)){if(e.annotations[QC]===uz)return"type"in t&&t.type!=="integer"}return"type"in t||"oneOf"in t||"anyOf"in t||"$ref"in t},Q6t=(e,t,r)=>{let n={...e,...T8e(r),...t};n.allOf??=[];let o=(s,i)=>{if(s in t&&s in e)n.allOf.unshift({[s]:e[s]}),n.allOf=n.allOf.filter(i)};if(o("minLength",(s)=>s.minLength>t.minLength),o("maxLength",(s)=>s.maxLength<t.maxLength),o("pattern",(s)=>s.pattern!==t.pattern),o("minItems",(s)=>s.minItems>t.minItems),o("maxItems",(s)=>s.maxItems<t.maxItems),o("minimum",(s)=>s.minimum>t.minimum),o("maximum",(s)=>s.maximum<t.maximum),o("exclusiveMinimum",(s)=>s.exclusiveMinimum>t.exclusiveMinimum),o("exclusiveMaximum",(s)=>s.exclusiveMaximum<t.exclusiveMaximum),o("multipleOf",(s)=>s.multipleOf!==t.multipleOf),n.allOf.length===0)delete n.allOf;return n};function Y6t(e){switch(e.target){case"jsonSchema7":return!1;case"jsonSchema2019-09":case"jsonSchema2020-12":case"openApi3.1":return!0}}function Z6t(e){switch(e.additionalPropertiesStrategy){case"allow":return!0;case"strict":return!1}}function Co(e,t){return R8e(e,T8e(t))}function R8e(e,t){if(t===void 0||Object.keys(t).length===0)return e;if("$ref"in e)return{allOf:[e],...t};return{...e,...t}}function uce(e){let t=Ar(SY(e));if(t===void 0){if(IY(e))return uce(e.f());if(Aq(e)&&YR(e.from)&&KIe(e.to)){let r=e.to,n=Mp(r);if(Oe(n))return uce(r)}}return t}function ci(e,t,r,n,o,s,i){if(r==="handle-identifier"&&(o.topLevelReferenceStrategy!=="skip"||IY(e))){let c=uce(e);if(c!==void 0){let l=c.replace(/~/ig,"~0").replace(/\//ig,"~1"),u={$ref:o.getRef(l)};if(!vc(t,c))t[c]=u,t[c]=ci(e,t,"ignore-identifier",n,o,"handle-annotation",i);return u}}if(s==="handle-annotation"){let c=xY(e);if(Oe(c)){let l=c.value;if(J6t(e,l))switch(e._tag){case"Declaration":return Co(l,e);default:return l}else switch(e._tag){case"Refinement":{let u=$R(e);if(u===void 0)return Q6t(ci(e.from,t,r,n,o,"handle-annotation",i),l,e);else return ci(u,t,r,n,o,"handle-annotation",i)}default:return{...ci(e,t,r,n,o,"ignore-annotation",i),...l}}}}let a=Mp(e);if(Oe(a))return ci(a.value,t,r,n,o,"handle-annotation",i);switch(e._tag){case"Declaration":case"UndefinedKeyword":case"BigIntKeyword":case"UniqueSymbol":case"SymbolKeyword":{if(i==="ignore-errors")return Co(Dk,e);throw Error(eY(n,e))}case"Suspend":{if(r==="handle-identifier"){if(i==="ignore-errors")return Co(Dk,e);throw Error(OIe(n,e))}return ci(e.f(),t,"ignore-identifier",n,o,"handle-annotation",i)}case"NeverKeyword":return Co(_N,e);case"VoidKeyword":return Co(k8e,e);case"UnknownKeyword":return Co(w8e,e);case"AnyKeyword":return Co(Dk,e);case"ObjectKeyword":return Co($6t,e);case"StringKeyword":return Co({type:"string"},e);case"NumberKeyword":return Co({type:"number"},e);case"BooleanKeyword":return Co({type:"boolean"},e);case"Literal":{let c=e.literal;if(c===null)return Co({type:"null"},e);else if(Jr(c))return Co({type:"string",enum:[c]},e);else if(li(c))return Co({type:"number",enum:[c]},e);else if(ji(c))return Co({type:"boolean",enum:[c]},e);if(i==="ignore-errors")return Co(Dk,e);throw Error(eY(n,e))}case"Enums":{let c=e.enums.map((l)=>({type:li(l[1])?"number":"string",title:l[0],enum:[l[1]]}));return c.length>=1?Co({$comment:"/schemas/enums",anyOf:c},e):Co(_N,e)}case"TupleType":{let c=e.elements.map((y,E)=>lce(ci(y.type,t,"handle-identifier",n.concat(E),o,"handle-annotation",i),cce(y.type,y))),l=e.rest.map((y)=>lce(ci(y.type,t,"handle-identifier",n,o,"handle-annotation",i),cce(y.type,y))),u={type:"array"},f=e.elements.length;if(f>0)if(u.minItems=f-e.elements.filter((y)=>y.isOptional).length,o.target==="jsonSchema7")u.items=c;else u.prefixItems=c;let h=l.length;if(h>0){let y=l[0];if(h===1&&e.elements.every((b)=>b.type===e.rest[0].type))if(o.target==="jsonSchema7")u.items=y;else u.items=y,delete u.prefixItems;else if(o.target==="jsonSchema7")u.additionalItems=y;else u.items=y;if(h>1){if(i==="ignore-errors")return Co(Dk,e);throw Error(_Ie(n))}}else if(f>0)if(o.target==="jsonSchema7")u.additionalItems=!1;else u.items=!1;else u.maxItems=0;return Co(u,e)}case"TypeLiteral":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return Co(j6t,e);let c={type:"object",required:[],properties:{},additionalProperties:Z6t(o)},l=void 0,u=void 0;for(let f of e.indexSignatures){let h=tK(f.type)??f.type,y=f.parameter;switch(y._tag){case"StringKeyword":{c.additionalProperties=ci(h,t,"handle-identifier",n,o,"handle-annotation",i);break}case"TemplateLiteral":{l=ci(h,t,"handle-identifier",n,o,"handle-annotation",i),u={type:"string",pattern:JA(y).source};break}case"Refinement":{l=ci(h,t,"handle-identifier",n,o,"handle-annotation",i),u=ci(y,t,"handle-identifier",n,o,"handle-annotation",i);break}case"SymbolKeyword":{let E=n.concat("[symbol]");c.additionalProperties=ci(h,t,"handle-identifier",E,o,"handle-annotation",i),u=ci(y,t,"handle-identifier",E,o,"handle-annotation",i);break}}}for(let f=0;f<e.propertySignatures.length;f++){let h=e.propertySignatures[f],y=h.name;if(Jr(y)){let E=tK(h.type),b=E??h.type;if(c.properties[y]=lce(ci(b,t,"handle-identifier",n.concat(h.name),o,"handle-annotation",i),cce(b,h)),!h.isOptional&&E===void 0)c.required.push(y)}else{if(i==="ignore-errors")return Co(Dk,e);throw Error(vIe(y,n))}}if(l!==void 0)delete c.additionalProperties,c.patternProperties={"":l};if(u!==void 0)c.propertyNames=u;return Co(c,e)}case"Union":{let c=e.types.map((u)=>ci(u,t,"handle-identifier",n,o,"handle-annotation",i)),l=n8t(c);switch(l.length){case 0:return _N;case 1:return Co(l[0],e);default:return Co({anyOf:l},e)}}case"Refinement":return ci(e.from,t,r,n,o,"handle-annotation",i);case"TemplateLiteral":{let c=JA(e);return Co({type:"string",title:String(e),description:"a template literal",pattern:c.source},e)}case"Transformation":{if(K6t(e.from)){let l={type:"string",contentMediaType:"application/json"};if(Y6t(o))l.contentSchema=ci(e.to,t,r,n,o,"handle-annotation",i);return l}let c=ci(e.from,t,r,n,o,"handle-annotation",i);if(e.transformation._tag==="TypeLiteralTransformation"&&b8e(c)){let l=ci(e.to,{},"ignore-identifier",n,o,"handle-annotation","ignore-errors");if(b8e(l))for(let u of e.transformation.propertySignatureTransformations){let{to:f,from:h}=u;if(Jr(f)&&Jr(h)){let y=l.properties[f];if(Xu(y)){let E=c.properties[h];if(Xu(E)){let b={};if(Jr(y.title))b.title=y.title;if(Jr(y.description))b.description=y.description;if(Array.isArray(y.examples))b.examples=y.examples;if(Object.hasOwn(y,"default")&&y.default!==void 0)b.default=y.default;c.properties[h]=R8e(E,b)}}}}}return Co(c,e)}}}function b8e(e){return Xu(e)&&e.type==="object"&&Xu(e.properties)}function X6t(e){return e===_N||de(e,"$id")&&e.$id===_N.$id&&Object.keys(e).length===3&&e.title===ZC.annotations[za]}function e8t(e){return"$id"in e&&e.$id===Dk.$id}function t8t(e){return"$id"in e&&e.$id===w8e.$id}function r8t(e){return"$id"in e&&e.$id===k8e.$id}function C8e(e){return de(e,"enum")&&"type"in e&&Object.keys(e).length===2}function n8t(e){let t=[];for(let r of e){if(X6t(r))continue;if(e8t(r)||t8t(r)||r8t(r))return[r];if(C8e(r)&&t.length>0){let n=t[t.length-1];if(C8e(n)&&n.type===r.type){t[t.length-1]={type:n.type,enum:[...n.enum,...r.enum]};continue}}t.push(r)}return t}var fce=qt("@effect/platform/HttpLayerRouter");var o8t=Symbol.for("@effect/platform/HttpLayerRouter/Middleware"),s8t=function(){if(arguments.length===0)return P8e;return P8e(arguments[0],arguments[1])},P8e=(e,t)=>t?.global?yi($e(function*(){let r=yield*fce,n=mn(e)?yield*e:e;yield*r.addGlobalMiddleware(n)})):new dce(mn(e)?Mg(W(e,(r)=>Oa(new Map([[pce,r]])))):ZY(Oa(new Map([[pce,e]])))),i8t=0,pce="@effect/platform/HttpLayerRouter/MiddlewareFn";class dce{layerFn;dependencies;[o8t]={};constructor(e,t){this.layerFn=e,this.dependencies=t;let r=`@effect/platform/HttpLayerRouter/Middleware-${++i8t}`;this.layer=Mg($e(this,function*(){let n=yield*Pn(),o=[n.unsafeMap.get(pce)];if(this.dependencies){let s=yield*JY,i=er(n,wp),a=yield*e9(this.dependencies,s,i);o.push(...a8t(a))}return Oa(new Map([[r,o]]))})).pipe(Oo(this.layerFn))}layer;combine(e){return new dce(this.layerFn,this.dependencies?Lm(this.dependencies,e.layer):e.layer)}}var D8e=new WeakMap,a8t=(e)=>{let t=D8e.get(e);if(t)return t;let r=Ge(),n=0;for(let[o,s]of e.unsafeMap)if(o.startsWith("@effect/platform/HttpLayerRouter/Middleware-")){if(r.push(s),s.length>n)n=s.length}if(r.length===0)t=[];else{let o=new Set;for(let s=n-1;s>=0;s--)for(let i of r)if(s<i.length)o.add(i[s]);t=De(o).reverse()}return D8e.set(e,t),t};var c0r=s8t(Y6e).layer;var F8e=iu;var N8e=OT;var u8t=Wn(function*(e,t){let r=t.disableTracing!==!0,n=t.disableSpanPropagation!==!0,o=t.disableClientAcks!==!0,s=t.spanPrefix??"RpcServer",i=t.concurrency??"unbounded",a=t.disableFatalDefects??!1,c=yield*Pn(),l=er(c,wp),u=yield*ck(),f=yield*BF(u)().pipe(an),h=i==="unbounded"?void 0:VC(i).withPermits(1),y=new Map,E=!1,b=Kf(!1);yield*Ti(l,Qe(()=>{E=!0;for(let D of y.values()){if(D.ended=!0,D.fibers.size===0){f(A(D));continue}for(let I of D.fibers.values())I.unsafeInterruptAsFork(L8e)}if(y.size===0)return me;return b.await}));let w=(D)=>Qe(()=>{let I=y.get(D);if(!I)return me;for(let M of I.fibers.values())M.unsafeInterruptAsFork(L8e);return y.delete(D),me}),T=(D,I)=>nq(Zs((M)=>{if(E)return ia;let B=y.get(D);if(!B)B={id:D,latches:new Map,fibers:new Map,ended:!1},y.set(D,B);else if(B.ended)return ia;switch(I._tag){case"Request":return k(M,B,I);case"Ack":{let ee=B.latches.get(I.requestId);return ee?ee.open:me}case"Interrupt":{let ee=B.fibers.get(I.requestId);return ee?$be(ee,g8t):t.onFromServer({_tag:"Exit",clientId:D,requestId:I.requestId,exit:Jy(Ks)})}case"Eof":{if(B.ended=!0,B.fibers.size>0)return me;return A(B)}default:return P(B,`Unknown request tag: ${I._tag}`)}}),(M)=>P(y.get(D),M)),A=(D)=>{y.delete(D.id);let I=t.onFromServer({_tag:"ClientEnd",clientId:D.id});if(E&&y.size===0)return ve(I,b.open);return I},k=(D,I,M)=>{if(I.fibers.has(M.id))return L(sS(I.fibers.get(M.id)),()=>k(D,I,M));let B=e.requests.get(M.tag),ee=c.unsafeMap.get(B?.key);if(!B||!ee){let Lt=nq(t.onFromServer({_tag:"Exit",clientId:I.id,requestId:M.id,exit:hu(`Unknown request tag: ${M.tag}`)}),(Do)=>P(I,Do));if(!I.ended||I.fibers.size>0)return Lt;return ve(Lt,A(I))}let j=TG(B.successSchema),ae=ee.handler(M.payload,{clientId:I.id,headers:M.headers}),F=MG(ae),J=F&&ae.fork,G=F&&ae.uninterruptible,Z=F?ae.value:ae,ne=p8t(B,c,I.id,M.payload,M.headers,j?O(I,M,Z):Z),we=!1,ot=os(G?ne:an(ne),{onSuccess:(Lt)=>(we=!0,t.onFromServer({_tag:"Exit",clientId:I.id,requestId:M.id,exit:Nt(Lt)})),onFailure:(Lt)=>{if(we=!0,!a&&a5(Lt)&&!Ua(Lt))return P(I,gi(Lt));return t.onFromServer({_tag:"Exit",clientId:I.id,requestId:M.id,exit:gr(Lt)})}});if(r){let Lt=D.currentContext.unsafeMap.get(QI.key);ot=cq(ot,`${s}.${M.tag}`,{captureStackTrace:!1,attributes:{requestId:String(M.id),...t.spanAttributes},parent:n&&M.spanId?{_tag:"ExternalSpan",traceId:M.traceId,spanId:M.spanId,sampled:M.sampled,context:Tn()}:void 0,links:n&&Lt?[{_tag:"SpanLink",span:Lt,attributes:{}}]:void 0})}if(!J&&h)ot=h(ot);let rt=DM({context:Rn(ee.context,D.currentContext),fiberRefs:D.getFiberRefs(),runtimeFlags:N8e(Hm.runtimeFlags,F8e)}),Dt=xc(rt,ot);return I.fibers.set(M.id,Dt),Dt.addObserver((Lt)=>{if(!we&&Lt._tag==="Failure")Px(u,xc(rt,t.onFromServer({_tag:"Exit",clientId:I.id,requestId:M.id,exit:Jy(Ks)})));if(I.fibers.delete(M.id),I.latches.delete(M.id),I.ended&&I.fibers.size===0)Px(u,xc(rt,A(I)))}),me},O=(D,I,M)=>{let B=D.latches.get(I.id);if(o&&!B)B=Kf(!1),D.latches.set(I.id,B);if(mn(M)){let ee=!1;return M.pipe(L((j)=>kg({while:()=>!ee,body:nl(L(j.takeAll,([ae,F])=>{if(ee=F,!kn(ae))return me;let J=t.onFromServer({_tag:"Chunk",clientId:D.id,requestId:I.id,values:lr(ae)});if(!B)return J;return B.unsafeClose(),ve(J,B.await)})),step:wo})),ei)}return HO(M,(ee)=>{if(!kn(ee))return me;let j=t.onFromServer({_tag:"Chunk",clientId:D.id,requestId:I.id,values:lr(ee)});if(!B)return j;return B.unsafeClose(),ve(j,B.await)})},P=(D,I)=>Qe(()=>{let M=D.ended&&D.fibers.size===0,B=t.onFromServer({_tag:"Defect",clientId:D.id,defect:I});if(!M)return B;return ve(B,A(D))});return te({write:T,disconnect:w})}),p8t=(e,t,r,n,o,s)=>{if(e.middlewares.size===0)return s;let i={rpc:e,payload:n,headers:o,clientId:r};for(let a of e.middlewares)if(a.wrap)s=qo(t,a)({...i,next:s});else if(a.optional){let c=qo(t,a),l=s;s=wr(c(i),{onFailure:()=>l,onSuccess:a.provides!==void 0?(u)=>xi(l,a.provides,u):(u)=>l})}else{let c=qo(t,a);s=a.provides!==void 0?ku(s,a.provides,c(i)):ve(c(i),s)}return s},U8e=Wn(function*(e,t){let{disconnects:r,end:n,run:o,send:s,supportsAck:i,supportsSpanPropagation:a,supportsTransferables:c}=yield*Td,l=yield*Pn(),u=yield*X0(),f=yield*u8t(e,{...t,disableClientAcks:!i,disableSpanPropagation:!a,onFromServer(k){let O=E.get(k.clientId);if(!O)return me;switch(k._tag){case"Chunk":{let P=O.schemas.get(k.requestId);if(!P)return me;return b(O,k.requestId,P.encodeDefect,P.collector,Vo(P.encodeChunk(k.values),P.context),(D)=>({_tag:"Chunk",requestId:String(k.requestId),values:D}))}case"Exit":{let P=O.schemas.get(k.requestId);if(!P)return me;return O.schemas.delete(k.requestId),b(O,k.requestId,P.encodeDefect,P.collector,Vo(P.encodeExit(k.exit),P.context),(D)=>({_tag:"Exit",requestId:String(k.requestId),exit:D}))}case"Defect":return A(O,k.defect);case"ClientEnd":return E.delete(k.clientId),n(k.clientId)}}}).pipe(rS(u));yield*DQ(an(kg({while:uo,body:nl(L(r.take,(k)=>(E.delete(k),f.disconnect(k)))),step:wo})));let h=new WeakMap,y=(k)=>{let O=h.get(k);if(!O){let P=l.unsafeMap.get(k.key),D=hv(k.successSchema.ast);O={decode:Qr(k.payloadSchema),encodeChunk:Mu(st(Oe(D)?D.value.success:wz)),encodeExit:Mu(RG(k)),encodeDefect:Mu(k.defectSchema),context:P.context},h.set(k,O)}return O},E=new Map,b=(k,O,P,D,I,M)=>(D?xi(I,tb,D):I).pipe(L((B)=>s(k.id,M(B),D&&D.unsafeClear())),tn((B)=>{k.schemas.delete(O);let ee=gi(fc(B,vu.formatErrorSync));return ve(T(k,O,P,ee),f.write(k.id,{_tag:"Interrupt",requestId:O,interruptors:[]}))})),w=_S(io),T=(k,O,P,D)=>tn(P(D).pipe(L((I)=>s(k.id,{_tag:"Exit",requestId:String(O),exit:{_tag:"Failure",cause:{_tag:"Die",defect:I}}}))),(I)=>A(k,gi(I))),A=(k,O)=>tn(s(k.id,{_tag:"Defect",defect:w(O)}),(P)=>$C($Q(P),{module:"RpcServer",method:"sendDefect"}));return yield*o((k,O)=>{let P=E.get(k);if(!P)P={id:k,schemas:new Map},E.set(k,P);switch(O._tag){case"Request":{let D=de(O,"tag")?O.tag:"",I=e.requests.get(D);if(!I)return A(P,`Unknown request tag: ${D}`);let M;switch(typeof O.id){case"bigint":case"string":{M=bh(O.id);break}default:return A(P,`Invalid request id: ${O.id}`)}let B=y(I);return wr(Vo(B.decode(O.payload),B.context),{onFailure:(ee)=>T(P,M,B.encodeDefect,vu.formatErrorSync(ee)),onSuccess:(ee)=>(P.schemas.set(M,c?{...B,collector:K_()}:B),f.write(k,{...O,id:M,payload:ee,headers:Ci(O.headers)}))})}case"Ping":return tn(s(P.id,cJe),(D)=>A(P,gi(D)));case"Eof":return f.write(k,O);case"Ack":return f.write(k,{...O,requestId:bh(O.requestId)});case"Interrupt":return f.write(k,{...O,requestId:bh(O.requestId),interruptors:[]});default:return A(P,`Unknown request tag: ${O._tag}`)}}).pipe(an,Iu((k)=>VQ("BUG: RpcServer protocol crashed",k)),RR((k)=>tS(u,k)),HR(R()))});class Td extends Gs("@effect/rpc/RpcServer/Protocol")(){static make=vG()}var H8e=$e(function*(){let e=yield*Jx,t=e.includesFraming,r=!e.contentType.includes("json"),n=yield*Xc(),o,s=0,i=new Map,a=new Set,c=new TextEncoder,l=$e(function*(){let f=yield*bv,h=yield*Mm,y=Object.entries(f.headers),E=yield*Pr(r?W(f.arrayBuffer,(I)=>new Uint8Array(I)):f.text),b=s++,w=yield*Xc(),T=e.unsafeMake(),A=(I)=>typeof I==="string"?w.offer(c.encode(I)):w.offer(I);a.add(b);let k={write:!t?(I)=>w.offer(I):(I)=>{try{let M=T.encode(I);if(M===void 0)return me;return A(M)}catch(M){return A(T.encode(kae(M)))}},end:w.end};i.set(b,k),yield*OC(h,()=>{if(a.delete(b),i.delete(b),n.unsafeOffer(b),w.unsafeSize()._tag==="None")return me;return en(O,(I)=>o(b,{_tag:"Interrupt",requestId:String(I)}),{discard:!0})});let O=[];try{let I=T.decode(E);for(let M of I){if(M._tag==="Request")O.push(bh(M.id)),M.headers=y.concat(M.headers);yield*o(b,M)}}catch(I){yield*k.write(kae(I))}if(yield*o(b,aJe),!t){let I=Ge();while(!0){let[M,B]=yield*w.takeAll;if(I.push(...M),B)break}return s6e(T.encode(I),{contentType:e.contentType})}let[P,D]=yield*w.takeAll;if(D)return o6e(f8t(P),{contentType:e.contentType});return i6e(OP(P).pipe(fX(qF(w))),{contentType:e.contentType})}).pipe(an,HR(R()));return{protocol:yield*Td.make((f)=>(o=f,N({disconnects:n,send(h,y){let E=i.get(h);if(!E)return me;return E.write(y)},end(h){let y=i.get(h);if(!y)return me;return y.end},clientIds:Ce(()=>a),initialMessage:hS,supportsAck:!1,supportsTransferables:!1,supportsSpanPropagation:!1}))),httpApp:l}}),f8t=(e)=>{if(e.length===0)return new Uint8Array(0);if(e.length===1)return Zd(e);let t=ip(e,0,(o,s)=>o+s.length),r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r},d8t=Wn(function*(e){let{httpApp:t,protocol:r}=yield*H8e;return yield*(yield*e.routerTag??XG).post(e.path,t),r}),m8t=Wn(function*(e){let t=yield*fce,{httpApp:r,protocol:n}=yield*H8e;return yield*t.add("POST",e.path,r),n});var q8e=(e)=>{let t=e.routerTag??XG;return gc(Td,d8t(e)).pipe(Oo(t.Live))},B8e=(e)=>gc(Td,m8t(e));var h8t=Wn(function*(e){let t=ru(SA()),r=yield*Jx;return yield*Td.make(Wn(function*(n){let o=yield*Xc(),s=r.unsafeMake();return yield*e.stdin.pipe(RP((i)=>{let a=s.decode(i);if(a.length===0)return me;let c=0;return kg({while:()=>c<a.length,body:()=>n(0,a[c++]),step:wo})}),RQ,LR(zC),Rm($S(500)),qa(Vbe(t)),Ri,an,HR(R())),yield*qF(o).pipe(ad(e.stdout),Rm($S(500)),Ri,an),{disconnects:yield*Xc(),send(i,a){let c=s.encode(a);if(c===void 0)return me;return o.offer(c)},end(i){return o.end},clientIds:N(new Set([0])),initialMessage:hS,supportsAck:!0,supportsTransferables:!1,supportsSpanPropagation:!0}}))}),W8e=(e)=>Pp(Td,h8t(e)),g8t=Lb(-499,0),L8e=Lb(-503,0);var mce=Symbol.for("effect/RcMap"),y8t={_K:te,_A:te,_E:te};class z8e{lookup;context;scope;idleTimeToLive;capacity;[mce];state={_tag:"Open",map:mg()};semaphore=nS(1);constructor(e,t,r,n,o){this.lookup=e,this.context=t,this.scope=r,this.idleTimeToLive=n,this.capacity=o,this[mce]=y8t}pipe(){return ce(this,arguments)}}var $8e=(e)=>Ot((t)=>{let r=t.getFiberRef(_s),n=er(r,na),o=e.idleTimeToLive===void 0?void 0:typeof e.idleTimeToLive==="function"?ry(e.idleTimeToLive,ur):nl(ur(e.idleTimeToLive)),s=new z8e(e.lookup,r,n,o,Math.max(e.capacity??Number.POSITIVE_INFINITY,0));return Kr(n.addFinalizer(()=>Re(()=>{if(s.state._tag==="Closed")return yt;let i=s.state.map;return s.state={_tag:"Closed"},Mc(i,([,a])=>Nc(a.scope,eo)).pipe(rs(()=>{Vye(i)}),s.semaphore.withPermits(1))})),s)}),j8e=p(2,(e,t)=>{let r=e;return Un((n)=>S8t(r,t,n))}),S8t=og(function*(e,t,r){if(e.state._tag==="Closed")return yield*Zn;let n=e.state,o=hs(n.map,t),s;if(o._tag==="Some")s=o.value,s.refCount++;else if(Number.isFinite(e.capacity)&&sA(e.state.map)>=e.capacity)return yield*Gt(new s2(`RcMap attempted to exceed capacity of ${e.capacity}`));else s=yield*e.semaphore.withPermits(1)(E8t(e,t,r));return yield*(yield*na).addFinalizer(()=>s.finalizer),yield*r(Mn(s.deferred))}),E8t=og(function*(e,t,r){let n=yield*Su(),o=yield*Ys(),s=e.lookup(t),i=new Map(e.context.unsafeMap);yield*r(ig(s,(l)=>(l.unsafeMap.forEach((u,f)=>{i.set(f,u)}),i.set(na.key,n),Oa(i)))).pipe(fo,V((l)=>n0(o,l)),oS(n));let a=e.idleTimeToLive?e.idleTimeToLive(t):hl,c={deferred:o,scope:n,finalizer:void 0,idleTimeToLive:a,fiber:void 0,expiresAt:0,refCount:1};if(c.finalizer=b8t(e,t,c),e.state._tag==="Open")pc(e.state.map,t,c);return c}),b8t=(e,t,r)=>yp((n)=>{if(r.refCount--,r.refCount>0)return yt;else if(e.state._tag==="Closed"||!xu(e.state.map,t)||VL(r.idleTimeToLive)){if(e.state._tag==="Open")wm(e.state.map,t);return Nc(r.scope,eo)}if(!Xd(r.idleTimeToLive))return yt;if(r.expiresAt=n.unsafeCurrentTimeMillis()+ds(r.idleTimeToLive),r.fiber)return yt;return J1(function o(s){let i=n.unsafeCurrentTimeMillis(),a=r.expiresAt-i;if(a<=0){if(e.state._tag==="Closed"||r.refCount>0)return yt;return wm(e.state.map,t),s(Nc(r.scope,eo))}return V(n.sleep(Bo(a)),()=>o(s))}).pipe(La(ue(()=>{r.fiber=void 0})),oS(e.scope),rs((o)=>{r.fiber=o}),e.semaphore.withPermits(1))});var V8e=$8e,hce=j8e;var k8t={add(...e){return fb({requests:G8e(...this.requests.values(),...e),annotations:this.annotations})},merge(...e){let t=new Map(this.requests),r=new Map(this.annotations.unsafeMap);for(let n of e){for(let[o,s]of n.requests)t.set(o,s);for(let[o,s]of n.annotations.unsafeMap)r.set(o,s)}return fb({requests:t,annotations:Oa(r)})},middleware(e){let t=new Map;for(let[r,n]of this.requests)t.set(r,n.middleware(e));return fb({requests:t,annotations:this.annotations})},toHandlersContext(e){return $e(this,function*(){let t=yield*Pn(),r=mn(e)?yield*e:e,n=new Map;for(let[o,s]of Object.entries(r)){let i=this.requests.get(o);n.set(i.key,{handler:s,context:t})}return Oa(n)})},prefix(e){let t=new Map;for(let r of this.requests.values()){let n=r.prefix(e);t.set(n._tag,n)}return fb({requests:t,annotations:this.annotations})},toLayer(e){return Mg(this.toHandlersContext(e))},of:te,toLayerHandler(e,t){return Mg($e(this,function*(){let r=yield*Pn(),n=mn(t)?yield*t:t,o=new Map,s=this.requests.get(e);return o.set(s.key,{handler:n,context:r}),Oa(o)}))},accessHandler(e){return BC((t)=>{let r=this.requests.get(e),{context:n,handler:o}=t.unsafeMap.get(r.key);return(s,i)=>{let a=o(s,i),c=MG(a)?a.value:a;return mn(c)?Vo(c,n):TP(c,n)}})},annotate(e,t){return fb({requests:this.requests,annotations:or(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsContext(_a(e,t))},annotateContext(e){return fb({requests:this.requests,annotations:Rn(this.annotations,e)})},annotateRpcsContext(e){let t=new Map;for(let[r,n]of this.requests)t.set(r,n.annotateContext(Rn(e,n.annotations)));return fb({requests:t,annotations:this.annotations})}},fb=(e)=>Object.assign(function(){},k8t,{requests:e.requests,annotations:e.annotations}),G8e=(...e)=>{let t=new Map;for(let r of e)t.set(r._tag,so(r)?iJe(r):r);return t},vN=(...e)=>fb({requests:G8e(...e),annotations:Tn()});var K8e=Symbol.for("@effect/rpc/RpcMiddleware"),J8e=()=>(e,t)=>{let r=globalThis.Error,n=r.stackTraceLimit;r.stackTraceLimit=2;let o=new r;r.stackTraceLimit=n;function s(){}let i=s;if(Object.setPrototypeOf(s,Object.getPrototypeOf(qt(e))),s.key=e,Object.defineProperty(s,"stack",{get(){return o.stack}}),i[K8e]=K8e,i.failure=t?.optional===!0||t?.failure===void 0?zp:t.failure,t?.provides)i.provides=t.provides;return i.optional=t?.optional??!1,i.requiredForClient=t?.requiredForClient??!1,i.wrap=t?.wrap??!1,s};var O8t=gt(H,Et),Q8e=gt(H,Et);class Rd extends fe({_meta:Be(fe({progressToken:Be(Q8e)}))}){}class db extends fe({_meta:Be(ys({key:H,value:To}))}){}class kh extends fe({_meta:Be(ys({key:H,value:To}))}){}var Y8e=H;class TN extends fe({...Rd.fields,cursor:Be(Y8e)}){}class RN extends fe({...db.fields,nextCursor:Be(Y8e)}){}var gce=qe("user","assistant");class Fk extends fe({audience:Be(st(gce)),priority:Be(Et.pipe(hE(0,1)))}){}class xce extends fe({name:H,title:Be(H),version:H}){}class Z8e extends mr("@effect/ai/McpSchema/ClientCapabilities")({experimental:Be(ys({key:H,value:fe({})})),roots:Be(fe({listChanged:Be(St)})),sampling:Be(fe({})),elicitation:Be(fe({}))}){}class X8e extends fe({experimental:Be(ys({key:H,value:fe({})})),logging:Be(fe({})),completions:Be(fe({})),prompts:Be(fe({listChanged:Be(St)})),resources:Be(fe({subscribe:Be(St),listChanged:Be(St)})),tools:Be(fe({listChanged:Be(St)}))}){}class js extends mr("@effect/ai/McpSchema/McpError")({code:Et,message:H,data:Be(To)}){}var _8t=-32600,v8t=-32601,T8t=-32602,R8t=-32603,M8t=-32700;class P8t extends ri()("ParseError",{...js.fields,code:Jc(M8t)}){}class D8t extends ri()("InvalidRequest",{...js.fields,code:Jc(_8t)}){}class F8t extends ri()("MethodNotFound",{...js.fields,code:Jc(v8t)}){}class wv extends ri()("InvalidParams",{...js.fields,code:Jc(T8t)}){}class Md extends ri()("InternalError",{...js.fields,code:Jc(R8t)}){static notImplemented=new Md({message:"Not implemented"})}class yce extends Po("ping",{success:fe({}),error:js,payload:Li(Rd)}){}class e5e extends mr("@effect/ai/McpSchema/InitializeResult")({...db.fields,protocolVersion:H,capabilities:X8e,serverInfo:xce,instructions:Be(H)}){}class t5e extends Po("initialize",{success:e5e,error:js,payload:{...Rd.fields,protocolVersion:H,capabilities:Z8e,clientInfo:xce}}){}class r5e extends Po("notifications/initialized",{payload:Li(kh)}){}class Sce extends Po("notifications/cancelled",{payload:{...kh.fields,requestId:O8t,reason:Be(H)}}){}class Ece extends Po("notifications/progress",{payload:{...kh.fields,progressToken:Q8e,progress:Be(Et),total:Be(Et),message:Be(H)}}){}class MN extends mr("@effect/ai/McpSchema/Resource")({uri:H,name:H,title:Be(H),description:Be(H),mimeType:Be(H),annotations:Be(Fk),size:Be(Et)}){}class nK extends mr("@effect/ai/McpSchema/ResourceTemplate")({uriTemplate:H,name:H,title:Be(H),description:Be(H),mimeType:Be(H),annotations:Be(Fk)}){}class bce extends fe({uri:H,mimeType:Be(H)}){}class Cce extends fe({...bce.fields,text:H}){}class wce extends fe({...bce.fields,blob:eD}){}class oK extends mr("@effect/ai/McpSchema/ListResourcesResult")({...RN.fields,resources:st(MN)}){}class n5e extends Po("resources/list",{success:oK,error:js,payload:Li(TN)}){}class sK extends mr("@effect/ai/McpSchema/ListResourceTemplatesResult")({...RN.fields,resourceTemplates:st(nK)}){}class o5e extends Po("resources/templates/list",{success:sK,error:js,payload:Li(TN)}){}class s5e extends fe({...db.fields,contents:st(gt(Cce,wce))}){}class i5e extends Po("resources/read",{success:s5e,error:js,payload:{...Rd.fields,uri:H}}){}class a5e extends Po("notifications/resources/list_changed",{payload:Li(kh)}){}class c5e extends Po("resources/subscribe",{error:js,payload:{...Rd.fields,uri:H}}){}class l5e extends Po("resources/unsubscribe",{error:js,payload:{...Rd.fields,uri:H}}){}class u5e extends Po("notifications/resources/updated",{payload:{...kh.fields,uri:H}}){}class p5e extends fe({name:H,title:Be(H),description:Be(H),required:Be(St)}){}class iK extends mr("@effect/ai/McpSchema/Prompt")({name:H,title:Be(H),description:Be(H),arguments:Be(st(p5e))}){}class PN extends fe({type:Jc("text"),text:H,annotations:Be(Fk)}){}class kce extends fe({type:Jc("image"),data:eD,mimeType:H,annotations:Be(Fk)}){}class Ice extends fe({type:Jc("audio"),data:eD,mimeType:H,annotations:Be(Fk)}){}class f5e extends fe({type:Jc("resource"),resource:gt(Cce,wce),annotations:Be(Fk)}){}class d5e extends fe({...MN.fields,type:Jc("resource_link")}){}class Ace extends gt(PN,kce,Ice,f5e,d5e){}class m5e extends fe({role:gce,content:Ace}){}class aK extends mr("@effect/ai/McpSchema/ListPromptsResult")({...RN.fields,prompts:st(iK)}){}class h5e extends Po("prompts/list",{success:aK,error:js,payload:Li(TN)}){}class cK extends mr("@effect/ai/McpSchema/GetPromptResult")({...db.fields,messages:st(m5e),description:Be(H)}){}class g5e extends Po("prompts/get",{success:cK,error:js,payload:{...Rd.fields,name:H,title:Be(H),arguments:Be(ys({key:H,value:H}))}}){}class x5e extends Po("notifications/prompts/list_changed",{payload:Li(kh)}){}class lK extends mr("@effect/ai/McpSchema/ToolAnnotations")({title:Be(H),readOnlyHint:Y(St,{default:()=>!1}),destructiveHint:Y(St,{default:()=>!0}),idempotentHint:Y(St,{default:()=>!1}),openWorldHint:Y(St,{default:()=>!0})}){}class uK extends mr("@effect/ai/McpSchema/Tool")({name:H,title:Be(H),description:Be(H),inputSchema:To,annotations:Be(lK)}){}class pK extends mr("@effect/ai/McpSchema/ListToolsResult")({...RN.fields,tools:st(uK)}){}class y5e extends Po("tools/list",{success:pK,error:js,payload:Li(TN)}){}class DN extends mr("@effect/ai/McpSchema/CallToolResult")({...db.fields,content:st(Ace),structuredContent:Be(To),isError:Be(St)}){}class S5e extends Po("tools/call",{success:DN,error:js,payload:{...Rd.fields,name:H,arguments:ys({key:H,value:To})}}){}class E5e extends Po("notifications/tools/list_changed",{payload:Li(kh)}){}var b5e=qe("debug","info","notice","warning","error","critical","alert","emergency");class C5e extends Po("logging/setLevel",{payload:{...Rd.fields,level:b5e},error:js}){}class w5e extends Po("notifications/message",{payload:fe({...kh.fields,level:b5e,logger:Be(H),data:To})}){}class k5e extends fe({role:gce,content:gt(PN,kce,Ice)}){}class I5e extends fe({name:Be(H)}){}class A5e extends mr("@effect/ai/McpSchema/ModelPreferences")({hints:Be(st(I5e)),costPriority:Be(Et.pipe(hE(0,1))),speedPriority:Be(Et.pipe(hE(0,1))),intelligencePriority:Be(Et.pipe(hE(0,1)))}){}class O5e extends mr("@effect/ai/McpSchema/CreateMessageResult")({model:H,stopReason:Be(H)}){}class _5e extends Po("sampling/createMessage",{success:O5e,error:js,payload:{messages:st(k5e),modelPreferences:Be(A5e),systemPrompt:Be(H),includeContext:Be(qe("none","thisServer","allServers")),temperature:Be(Et),maxTokens:Et,stopSequences:Be(st(H)),metadata:To}}){}class v5e extends fe({type:Jc("ref/resource"),uri:H}){}class T5e extends fe({type:Jc("ref/prompt"),name:H,title:Be(H)}){}class kv extends mr("@effect/ai/McpSchema/CompleteResult")({completion:fe({values:st(H),total:Be(Et),hasMore:Be(St)})}){static empty=kv.make({completion:{values:[],total:0,hasMore:!1}})}class R5e extends Po("completion/complete",{success:kv,error:js,payload:fe({ref:gt(T5e,v5e),argument:fe({name:H,value:H}),context:Y(fe({arguments:Y(ys({key:H,value:H}),{default:()=>({})})}),{default:()=>({arguments:{}})})})}){}class M5e extends mr("@effect/ai/McpSchema/Root")({uri:H,name:Be(H)}){}class P5e extends mr("@effect/ai/McpSchema/ListRootsResult")({roots:st(M5e)}){}class D5e extends Po("roots/list",{success:P5e,error:js,payload:Li(Rd)}){}class F5e extends Po("notifications/roots/list_changed",{payload:Li(kh)}){}class N5e extends mr("@effect/ai/McpSchema/ElicitAcceptResult")({...db.fields,action:qe("accept"),content:To}){}class L5e extends mr("@effect/ai/McpSchema/ElicitDeclineResult")({...db.fields,action:qe("cancel","decline")}){}var N8t=gt(N5e,L5e);class FN extends Po("elicitation/create",{success:N8t,error:js,payload:{message:H,requestedSchema:To}}){}class fK extends ri("@effect/ai/McpSchema/ElicitationDeclined")("ElicitationDeclined",{request:FN.payloadSchema,cause:Be(io)}){}class NN extends Gs("@effect/ai/McpSchema/McpServerClient")(){}class LN extends J8e()("@effect/ai/McpSchema/McpServerClientMiddleware",{provides:NN}){}class U5e extends vN(yce,t5e,R5e,C5e,g5e,h5e,n5e,o5e,i5e,c5e,l5e,S5e,y5e).middleware(LN){}class dK extends vN(Sce,Ece,r5e,F5e){}class mK extends U5e.merge(dK){}class Oce extends vN(yce,_5e,D5e,FN){}class hK extends vN(Sce,Ece,w5e,u5e,a5e,E5e,x5e){}var H5e=Symbol.for("@effect/ai/McpSchema/ParamNameId");var Pd={};Ht(Pd,{Destructive:()=>SK,Idempotent:()=>EK,OpenWorld:()=>bK,ProviderDefinedTypeId:()=>gK,Readonly:()=>yK,Title:()=>xK,TypeId:()=>_ce,fromTaggedRequest:()=>vce,getDescription:()=>W8t,getDescriptionFromSchemaAst:()=>z5e,getJsonSchema:()=>z8t,getJsonSchemaFromSchemaAst:()=>$5e,isProviderDefined:()=>q5e,isUserDefined:()=>L8t,make:()=>q8t,providerDefined:()=>B8t,unsafeSecureJsonParse:()=>K8t});var _ce="~@effect/ai/Tool",gK="~@effect/ai/Tool/ProviderDefined",L8t=(e)=>de(e,_ce)&&!q5e(e),q5e=(e)=>de(e,gK),B5e={[_ce]:{_Requirements:te},pipe(){return ce(this,arguments)},addDependency(){return mb({...this})},setParameters(e){return mb({...this,parametersSchema:so(e)?e:fe(e)})},setSuccess(e){return mb({...this,successSchema:e})},setFailure(e){return mb({...this,failureSchema:e})},annotate(e,t){return mb({...this,annotations:or(this.annotations,e,t)})},annotateContext(e){return mb({...this,annotations:Rn(this.annotations,e)})}},U8t={...B5e,[gK]:gK},mb=(e)=>{let t=Object.assign(Object.create(B5e),e);return t.id=`@effect/ai/Tool/${e.name}`,t},H8t=(e)=>Object.assign(Object.create(U8t),e),W5e=fe({}),q8t=(e,t)=>{let r=t?.success??sx,n=t?.failure??zp;return mb({name:e,description:t?.description,parametersSchema:t?.parameters?fe(t?.parameters):W5e,successSchema:r,failureSchema:n,failureMode:t?.failureMode??"error",annotations:Tn()})},B8t=(e)=>(t)=>{let r="failureMode"in t?t.failureMode:void 0,n=e?.success??sx,o=e?.failure??zp;return H8t({id:e.id,name:e.toolkitName,providerName:e.providerName,args:t,argsSchema:fe(e.args),requiresHandler:e.requiresHandler??!1,parametersSchema:e?.parameters?fe(e?.parameters):W5e,successSchema:n,failureSchema:o,failureMode:r??"error"})},vce=(e)=>mb({name:e._tag,description:Ar(Tg(e.ast.to)),parametersSchema:e,successSchema:e.success,failureSchema:e.failure,failureMode:"error",annotations:Tn()}),W8t=(e)=>{if(Hk(e.description))return e.description;return z5e(e.parametersSchema.ast)},z5e=(e)=>{let t=e._tag==="Transformation"?{...e.to.annotations,...e.annotations}:e.annotations;return _l in t?t[_l]:void 0},z8t=(e)=>$5e(e.parametersSchema.ast),$5e=(e)=>{let t={},r=rK(e,{definitions:t,topLevelReferenceStrategy:"skip"});if(Object.keys(t).length===0)return r;return r.$defs=t,r};class xK extends Gs("@effect/ai/Tool/Title")(){}class yK extends ko()("@effect/ai/Tool/Readonly",{defaultValue:Fo}){}class SK extends ko()("@effect/ai/Tool/Destructive",{defaultValue:uo}){}class EK extends ko()("@effect/ai/Tool/Idempotent",{defaultValue:Fo}){}class bK extends ko()("@effect/ai/Tool/OpenWorld",{defaultValue:uo}){}var $8t=/"__proto__"\s*:/,j8t=/"constructor"\s*:/;function V8t(e){let t=JSON.parse(e);if(t===null||typeof t!=="object")return t;if($8t.test(e)===!1&&j8t.test(e)===!1)return t;return G8t(t)}function G8t(e){let t=[e];while(t.length){let r=t;t=[];for(let n of r){if(Object.prototype.hasOwnProperty.call(n,"__proto__"))throw SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(n,"constructor")&&Object.prototype.hasOwnProperty.call(n.constructor,"prototype"))throw SyntaxError("Object contains forbidden prototype property");for(let o in n){let s=n[o];if(s&&typeof s==="object")t.push(s)}}}return e}var K8t=(e)=>{let{stackTraceLimit:t}=Error;Error.stackTraceLimit=0;try{return V8t(e)}finally{Error.stackTraceLimit=t}};class _c extends Gs("@effect/ai/McpServer")(){static make=$e(function*(){let e=n5t(),t=Ge(),r=new Map,n=[],o=[],s=[],i=new Map,a=new Map,c=yield*Xc(),l=new Map,u=yield*Vae(hK,{spanPrefix:"McpServer/Notifications",onFromClient(f){let h=f.message;if(h._tag!=="Request")return me;if(h.tag.includes("list_changed")){if(!l.has(h.tag))l.set(h.tag,setTimeout(()=>{c.unsafeOffer(h),l.delete(h.tag)},0))}else c.unsafeOffer(h);return u.write({clientId:0,requestId:h.id,_tag:"Exit",exit:ta})}});return _c.of({notifications:u.client,notificationsMailbox:c,initializedClients:new Set,get tools(){return t},addTool:(f)=>Qe(()=>(t.push(f.tool),r.set(f.tool.name,f.handle),u.client["notifications/tools/list_changed"]({}))),callTool:(f)=>Qe(()=>{let h=r.get(f.name);if(!h)return ie(new wv({message:`Tool '${f.name}' not found`}));return h(f.arguments)}),get resources(){return n},get resourceTemplates(){return o},addResource:(f,h)=>Qe(()=>(n.push(f),e.add(f.uri,{_tag:"Resource",effect:h}),u.client["notifications/resources/list_changed"]({}))),addResourceTemplate:({completions:f,handle:h,routerPath:y,template:E})=>Qe(()=>{o.push(E),e.add(y,{_tag:"ResourceTemplate",handle:h});for(let[b,w]of Object.entries(f))a.set(`ref/resource/${E.uriTemplate}/${b}`,w);return u.client["notifications/resources/list_changed"]({})}),findResource:(f)=>Qe(()=>{let h=e.find(f);if(!h)return N({contents:[]});else if(h.handler._tag==="Resource")return h.handler.effect;let y=[];for(let E of Object.keys(h.params))y[Number(E)]=h.params[E];return h.handler.handle(f,y)}),get prompts(){return s},addPrompt:(f)=>Qe(()=>{s.push(f.prompt),i.set(f.prompt.name,f.handle);for(let[h,y]of Object.entries(f.completions))a.set(`ref/prompt/${f.prompt.name}/${h}`,y);return u.client["notifications/prompts/list_changed"]({})}),getPromptResult:Wn(function*({arguments:f,name:h}){let y=i.get(h);if(!y)return yield*new wv({message:`Prompt '${h}' not found`});return yield*y(f??{})}),completion:Wn(function*(f){let h=f.ref,y=h.type==="ref/resource"?`ref/resource/${h.uri}/${f.argument.name}`:`ref/prompt/${h.name}/${f.argument.name}`,E=a.get(y);return E?yield*E(f.argument.value):kv.empty})})});static layer=Pp(_c,_c.make)}var V5e="2025-06-18",J8t=[V5e,"2025-03-26","2024-11-05","2024-10-07"],G5e=Wn(function*(e){let t=yield*Td,r=yield*QY(s5t(e)),n=yield*_c,o=yield*V8e({lookup:Wn(function*(c){let l;return{client:yield*YJe(Oce,{spanPrefix:"McpServer/Client"}).pipe(ku(wN,wN.make(Wn(function*(f){return l=f,{send(h,y){return t.send(c,{...h,headers:void 0,traceId:void 0,spanId:void 0,sampled:void 0})},supportsAck:!0,supportsTransferables:!1}})))),write:l}}),idleTimeToLive:1e4}),s=LN.of(({clientId:c})=>Ce(()=>NN.of({clientId:c,getClient:hce(o,c).pipe(W(({client:l})=>l))}))),i=Td.of({...t,run:(c)=>t.run((l,u)=>{let f=u;switch(f._tag){case"Request":{if(dK.requests.has(f.tag)){if(f.tag==="notifications/cancelled")return c(l,{_tag:"Interrupt",requestId:String(f.payload.requestId)});let h=r.unsafeMap.get(f.tag);return h?h.handler(f.payload,{clientId:l,headers:Ci(f.headers)}):me}return c(l,f)}case"Ping":case"Ack":case"Interrupt":case"Eof":return c(l,f);case"Pong":case"Exit":case"Chunk":case"ClientProtocolError":case"Defect":return hce(o,l).pipe(L(({write:h})=>h(f)),ei)}})}),a=Gm(gt(...Array.from(hK.requests.values(),(c)=>c.payloadSchema)));return yield*n.notificationsMailbox.take.pipe(L(Wn(function*(c){let l=yield*a(c.payload),u={_tag:"Request",tag:c.tag,payload:l},f=yield*i.clientIds;for(let h of n.initializedClients){if(!f.has(h)){n.initializedClients.delete(h);continue}yield*i.send(h,u)}})),tn(()=>me),NA,Ri),yield*U8e(mK,{spanPrefix:"McpServer",disableFatalDefects:!0}).pipe(xi(Td,i),xi(LN,s),Vo(r))},ei),CK=(e)=>yi(Ri(G5e(e))).pipe(Lm(_c.layer)),Q8t=(e)=>CK(e).pipe(Oo(W8e({stdin:e.stdin,stdout:e.stdout})),Oo(KJe()),Lm(xV(H_)),Lm(xV(kF))),Y8t=(e)=>CK(e).pipe(Oo(q8e(e)),Oo(jae())),Z8t=(e)=>CK(e).pipe(Oo(B8e(e)),Oo(jae())),K5e=Wn(function*(e){let t=yield*_c,r=yield*e,n=yield*Pn();for(let o of Object.values(r.tools)){let s=new uK({name:o.name,description:o.description,inputSchema:Q5e(o.parametersSchema.ast),annotations:new lK({...ws(o.annotations,xK).pipe(jt((i)=>({title:i})),Ar),readOnlyHint:er(o.annotations,yK),destructiveHint:er(o.annotations,SK),idempotentHint:er(o.annotations,EK),openWorldHint:er(o.annotations,bK)})});yield*t.addTool({tool:s,handle(i){return r.handle(o.name,i).pipe(Vo(n),Fs({onFailure:(a)=>new DN({isError:!0,structuredContent:typeof a==="object"?a:void 0,content:[{type:"text",text:JSON.stringify(a)}]}),onSuccess:(a)=>new DN({isError:!1,structuredContent:typeof a.encodedResult==="object"?a.encodedResult:void 0,content:[{type:"text",text:JSON.stringify(a.encodedResult)}]})}))}})}}),X8t=(e)=>vS(K5e(e)).pipe(Oo(_c.layer)),Tce=function(){if(arguments.length===1){let o=arguments[0];return $e(function*(){let s=yield*Pn();yield*(yield*_c).addResource(new MN({...o,annotations:o}),o.content.pipe(Vo(s),W((a)=>j5e(o.uri,a)),tn((a)=>{let c=AC(a)[0];return new Md({message:c.message})})))})}let{params:e,routerPath:t,schema:r,uriPath:n}=o5t(...arguments);return Wn(function*(o){let s=yield*Pn(),i=yield*_c,a=Qr(r),c=new nK({...o,uriTemplate:n,annotations:o}),l={};for(let[u,f]of Object.entries(o.completion??{})){let h=Mu(st(e[u])),y=(E)=>f(E).pipe(L(h),W((b)=>new kv({completion:{values:b,total:b.length,hasMore:!1}})),tn((b)=>{let w=AC(b)[0];return new Md({message:w.message})}),Vo(s));l[u]=y}yield*i.addResourceTemplate({template:c,routerPath:t,completions:l,handle:(u,f)=>a(f).pipe(br((h)=>new wv({message:h.message})),L((h)=>o.content(u,...h).pipe(W((y)=>j5e(u,y)),tn((y)=>{let E=AC(y)[0];return new Md({message:E.message})}))),Vo(s))})})},e5t=function(){if(arguments.length===1)return vS(Tce(arguments[0])).pipe(Oo(_c.layer));let e=Tce(...arguments);return(t)=>vS(e(t)).pipe(Oo(_c.layer))},J5e=(e)=>{let t=Ge(),r={},n=e.parameters?zA(e.parameters.ast):[];for(let a of n)t.push({name:a.name,description:Ar(Tg(a)),required:!a.isOptional}),r[a.name]=rr(a.type);let o=new iK({name:e.name,description:e.description,arguments:t}),s=e.parameters?Qr(e.parameters):()=>N({}),i=e.completion??{};return $e(function*(){let a=yield*_c,c=yield*Pn(),l={};for(let[u,f]of Object.entries(i)){let h=Mu(st(r[u])),y=(E)=>f(E).pipe(L(h),W((b)=>({completion:{values:b,total:b.length,hasMore:!1}})),tn((b)=>{let w=AC(b)[0];return new Md({message:w.message})}),Vo(c));l[u]=y}yield*a.addPrompt({prompt:o,completions:l,handle:(u)=>s(u).pipe(br((f)=>new wv({message:f.message})),L((f)=>e.content(f)),W((f)=>(f=typeof f==="string"?[{role:"user",content:PN.make({text:f})}]:f,new cK({messages:f,description:o.description}))),tn((f)=>{let h=AC(f)[0];return new Md({message:h.message})}),Vo(c))})})},t5t=(e)=>vS(J5e(e)).pipe(Oo(_c.layer)),r5t=Wn(function*(e){let{getClient:t}=yield*NN,r=yield*t,n=FN.payloadSchema.make({message:e.message,requestedSchema:Q5e(e.schema.ast)}),o=yield*r["elicitation/create"](n).pipe(tn((s)=>ie(new fK({cause:gi(s),request:n}))));switch(o.action){case"accept":return yield*Pr(Qr(e.schema)(o.content));case"cancel":return yield*ia;case"decline":return yield*ie(new fK({request:n}))}},ei),n5t=()=>{let e=JG({ignoreTrailingSlash:!0,ignoreDuplicateSlashes:!0,caseSensitive:!0});return{add:(n,o)=>{e.on("GET",n,o)},find:(n)=>e.find("GET",n)}},o5t=(e,...t)=>{let r=e[0].replace(":","::"),n=e[0],o={},s=ma();if(t.length>0){let i=[];for(let a=0;a<t.length;a++){let c=t[a],l=e[a+1],u=String(a);i.push(c),r+=`:${u}${l.replace(":","::")}`;let f=Ls(H5e)(c.ast).pipe(Je(()=>`param${u}`));o[f]=c,n+=`{${f}}${l}`}s=ma(...i)}return{routerPath:r,uriPath:n,schema:s,params:o}},s5t=(e)=>mK.toLayer($e(function*(){let t=yield*_c;return{ping:()=>N({}),initialize(r,{clientId:n}){let o=r.protocolVersion,s={completions:{}};if(t.tools.length>0)s.tools={listChanged:!0};if(t.resources.length>0||t.resourceTemplates.length>0)s.resources={listChanged:!0,subscribe:!1};if(t.prompts.length>0)s.prompts={listChanged:!0};return t.initializedClients.add(n),N({capabilities:s,serverInfo:e,protocolVersion:J8t.includes(o)?o:V5e})},"completion/complete":t.completion,"logging/setLevel":()=>Md.notImplemented,"prompts/get":t.getPromptResult,"prompts/list":()=>Ce(()=>new aK({prompts:t.prompts})),"resources/list":()=>Ce(()=>new oK({resources:t.resources})),"resources/read":({uri:r})=>t.findResource(r),"resources/subscribe":()=>Md.notImplemented,"resources/unsubscribe":()=>Md.notImplemented,"resources/templates/list":()=>Ce(()=>new sK({resourceTemplates:t.resourceTemplates})),"tools/call":t.callTool,"tools/list":()=>Ce(()=>new pK({tools:t.tools})),"notifications/cancelled":(r)=>me,"notifications/initialized":(r)=>me,"notifications/progress":(r)=>me,"notifications/roots/list_changed":(r)=>me}})),Q5e=(e)=>{if(zA(e).length===0)return{type:"object",properties:{},required:[],additionalProperties:!1};let r={},n=rK(e,{definitions:r,topLevelReferenceStrategy:"skip"});if(Object.keys(r).length===0)return n;return n.$defs=r,n},j5e=(e,t)=>{if(typeof t==="string")return{contents:[{uri:e,text:t}]};else if(t instanceof Uint8Array)return{contents:[{uri:e,blob:t}]};return t};var kK={};Ht(kK,{TypeId:()=>u5t,empty:()=>d5t,make:()=>m5t,merge:()=>h5t});var Ih="~@effect/ai/AiError";var Y5e=fe({method:qe("GET","POST","PATCH","PUT","DELETE","HEAD","OPTIONS"),url:H,urlParams:st(ma(H,H)),hash:Dte(H),headers:ys({key:H,value:H})}).annotations({identifier:"HttpRequestDetails"});class Z5e extends ri("@effect/ai/AiError/HttpRequestError")("HttpRequestError",{module:H,method:H,reason:qe("Transport","Encode","InvalidUrl"),request:Y5e,description:Be(H),cause:Be(io)}){[Ih]=Ih;static fromRequestError({error:e,...t}){return new Z5e({...t,cause:e,description:e.description,reason:e.reason,request:{hash:e.request.hash,headers:ka(e.request.headers),method:e.request.method,url:e.request.url,urlParams:e.request.urlParams}},{disableValidation:!0})}get message(){let e=`${this.request.method} ${this.request.url}`,t=this.description?`${this.reason}: ${this.description}`:`${this.reason}: An HTTP request error occurred.`;t+=` (${e})`;let r="";switch(this.reason){case"Encode":{r+="Check that the request body data is properly formatted and matches the expected content type.";break}case"InvalidUrl":{r+="Verify that the URL format is correct and that all required parameters have been provided.",r+=" Check for any special characters that may need encoding.";break}case"Transport":{r+="Check your network connection and verify that the requested URL is accessible.";break}}return t+=`
|
|
636
|
+
|
|
637
|
+
Suggestion: ${r}`,t}}var i5t=fe({status:Et,headers:ys({key:H,value:H})}).annotations({identifier:"HttpResponseDetails"});class X5e extends ri("@effect/ai/AiError/HttpResponseError")("HttpResponseError",{module:H,method:H,request:Y5e,response:i5t,body:Be(H),reason:qe("StatusCode","Decode","EmptyBody"),description:Be(H)}){[Ih]=Ih;static fromResponseError({error:e,...t}){let r=me,n=e.response.headers["content-type"]??"";if(n.includes("application/json"))r=e.response.json;else if(n.includes("text/")||n.includes("urlencoded"))r=e.response.text;return L(MQ(r),(o)=>new X5e({...t,description:e.description,reason:e.reason,request:{hash:e.request.hash,headers:ka(e.request.headers),method:e.request.method,url:e.request.url,urlParams:e.request.urlParams},response:{headers:ka(e.response.headers),status:e.response.status},body:Ut(o)},{disableValidation:!0}))}get message(){let e=`${this.response.status} ${this.request.method} ${this.request.url}`,t=this.description?`${this.reason}: ${this.description}`:`${this.reason}: An HTTP response error occurred.`;t+=` (${e})`;let r="";switch(this.reason){case"Decode":{r+="The response format does not match what is expected. Verify API version compatibility, check response content-type, and/or examine if the endpoint schema has changed.";break}case"EmptyBody":{r+="The response body was empty. This may indicate a server issue, API version mismatch, or the endpoint may have changed its response format.";break}case"StatusCode":{r+=c5t(this.response.status);break}}if(t+=`
|
|
638
|
+
|
|
639
|
+
${r}`,Hk(this.body))t+=`
|
|
640
|
+
|
|
641
|
+
Response Body: ${this.body}`;return t}}class wK extends ri("@effect/ai/AiError/MalformedInput")("MalformedInput",{module:H,method:H,description:Be(H),cause:Be(io)}){[Ih]=Ih}class UN extends ri("@effect/ai/AiError/MalformedOutput")("MalformedOutput",{module:H,method:H,description:Be(H),cause:Be(io)}){[Ih]=Ih;static fromParseError({error:e,...t}){return new UN({...t,cause:e})}}class a5t extends ri("@effect/ai/UnknownError")("UnknownError",{module:H,method:H,description:Be(H),cause:Be(io)}){[Ih]=Ih;get message(){let e=`${this.module}.${this.method}`;return _h(this.description)?`${e}: An error occurred`:`${e}: ${this.description}`}}var c5t=(e)=>{if(e>=400&&e<500)switch(e){case 400:return"Bad Request - Check request parameters, headers, and body format against API documentation.";case 401:return"Unauthorized - Verify API key, authentication credentials, or token expiration.";case 403:return"Forbidden - Check API permissions, usage limits, or resource access rights.";case 404:return"Not Found - Verify the endpoint URL, API version, and resource identifiers.";case 408:return"Request Timeout - Consider increasing timeout duration or implementing retry logic.";case 422:return"Unprocessable Entity - Check request data validation, required fields, and data formats.";case 429:return"Rate Limited - Implement exponential backoff or reduce request frequency.";default:return"Client error - Review request format, parameters, and API documentation."}else if(e>=500)return"Server error - This is likely temporary. Implement retry logic with exponential backoff.";else return"Check API documentation for this status code."};var u5t="~@effect/ai/Toolkit",p5t={...cg,...al,of:te,toContext(e){return $e(this,function*(){let t=yield*Pn(),r=mn(e)?yield*e:e,n=new Map;for(let[o,s]of Object.entries(r)){let i=this.tools[o];n.set(i.id,{handler:s,context:t})}return Oa(n)})},toLayer(e){return Mg(this.toContext(e))},commit(){return $e(this,function*(){let e=this.tools,t=yield*Pn(),r=new WeakMap,n=(s)=>{let i=r.get(s);if(_h(i)){let a=t.unsafeMap.get(s.id),c=Qr(s.parametersSchema),l=gt(s.successSchema,s.failureSchema),u=bz(l),f=Mu(l);i={context:a.context,handler:a.handler,decodeParameters:c,validateResult:u,encodeResult:f},r.set(s,i)}return i},o=YQ("Toolkit.handle",{captureStackTrace:!1})(function*(s,i){yield*KQ({tool:s,parameters:i});let a=e[s];if(_h(a)){let y=Object.keys(e).join(",");return yield*new UN({module:"Toolkit",method:`${s}.handle`,description:`Failed to find tool with name '${s}' in toolkit - available tools: ${y}`})}let c=n(a),l=yield*br(c.decodeParameters(i),(y)=>new UN({module:"Toolkit",method:`${s}.handle`,description:`Failed to decode tool call parameters for tool '${s}' from:
|
|
642
|
+
'${JSON.stringify(i,void 0,2)}'`,cause:y})),{isFailure:u,result:f}=yield*c.handler(l).pipe(W((y)=>({result:y,isFailure:!1})),jo((y)=>a.failureMode==="error"?ie(y):N({result:y,isFailure:!0})),sr(({result:y})=>c.validateResult(y)),FA((y)=>Rn(c.context,y)),br((y)=>Pq(y)?new wK({module:"Toolkit",method:`${s}.handle`,description:`Failed to validate tool call result for tool '${s}'`,cause:y}):y)),h=yield*br(c.encodeResult(f),(y)=>new wK({module:"Toolkit",method:`${s}.handle`,description:`Failed to encode tool call result for tool '${s}'`,cause:y}));return{isFailure:u,result:f,encodedResult:h}});return{tools:e,handle:o}})},toJSON(){return{_id:"@effect/ai/Toolkit",tools:Array.from(Object.values(this.tools)).map((e)=>e.name)}},pipe(){return ce(this,arguments)}},Rce=(e)=>Object.assign(function(){},p5t,{tools:e}),f5t=(...e)=>{let t={};for(let r of e){let n=so(r)?vce(r):r;t[r.name]=n}return t},d5t=Rce({}),m5t=(...e)=>Rce(f5t(...e)),h5t=(...e)=>{let t={};for(let r of e)for(let[n,o]of Object.entries(r.tools))t[n]=o;return Rce(t)};function g5t(e){return`Read ${new URL("/start.md",e).toString()} and set up Expand. Fetch it as raw text with curl — a summarizing web-fetch tool drops the exact commands.`}function x5t(e){return Sn.stripMargin(`
|
|
643
|
+
|# Expand Start Guide
|
|
644
|
+
|
|
|
645
|
+
|The setup procedure is served as a single document. Fetch it and follow it:
|
|
646
|
+
|
|
|
647
|
+
|${new URL("/start.md",e).toString()}
|
|
648
|
+
|
|
|
649
|
+
|## Agent Setup Prompt
|
|
650
|
+
|
|
|
651
|
+
|${g5t(e)}
|
|
652
|
+
|`)}function y5t(e){return Sn.stripMargin(`
|
|
653
|
+
|# expand.ai
|
|
654
|
+
|
|
|
655
|
+
|- Website: ${e}
|
|
656
|
+
|- Quickstart: ${new URL("/docs",e).toString()}
|
|
657
|
+
|- Dashboard: ${new URL("/dashboard",e).toString()}
|
|
658
|
+
|`)}var eQe=m.gen(function*(){return yield*(yield*Cr).getAppUrl()}),S5t=Xx.resource({uri:"expand://about",name:"About expand.ai",description:"Key links for the expand.ai platform",content:m.map(eQe,y5t)}),E5t=Xx.resource({uri:"expand://start",name:"Expand Start Guide",description:"Where to find the Expand agent setup guide, and the prompt that runs it",content:m.map(eQe,x5t)}),tQe=Tt.mergeAll(S5t,E5t).pipe(Tt.provide(Cr.Default));import{randomUUID as b5t}from"node:crypto";var C5t=Ae.all({apiKey:Ae.string("POSTHOG_API_KEY").pipe(Ae.withDefault("phc_sffcV4skT33mMKmo0BenNoE7t7AghUrOugyW9qSx43B")),host:Ae.string("POSTHOG_HOST").pipe(Ae.withDefault("https://us.i.posthog.com")),doNotTrack:ev("DO_NOT_TRACK"),noTelemetry:ev("EXPANDAI_NO_TELEMETRY"),apiUrl:Ae.string("EXPAND_API_URL").pipe(Ae.option),harnessOverride:C3("EXPANDAI_HARNESS",pGe),claudeCode:ev("CLAUDECODE"),cursor:Ae.string("CURSOR_TRACE_ID").pipe(Ae.option,Ae.map(q.isSome)),codex:Ae.string("CODEX_RUN_ID").pipe(Ae.option,Ae.map(q.isSome))});function w5t(e){if(q.isSome(e.harnessOverride))return e.harnessOverride.value;if(e.claudeCode)return"claude-code";if(e.cursor)return"cursor";if(e.codex)return"codex";return"unknown"}var rQe=m.sync(()=>b5t());function nQe(e){try{return new URL(e).toString()}catch{return`unparseable:${e}`}}class Ql extends m.Service()("@expandai/cli/Telemetry",{dependencies:[Cr.Default,dh.layer],scoped:m.gen(function*(){let e=yield*Cr,t=yield*Gl.HttpClient,r=yield*eb.make(),n=yield*C5t,o=yield*Ae.string("EXPAND_API_KEY").pipe(Ae.option,Ae.map(q.isSome)),{config:s,parseFailed:i}=yield*e.readConfigFile(),a=s.telemetry,c=q.firstSomeOf([n.apiUrl,q.map(q.fromNullable(s.apiUrl),(A)=>A.toString())]),l=q.match(c,{onNone:()=>!1,onSome:(A)=>nQe(A)!==nQe(b3)}),u=!n.doNotTrack&&!n.noTelemetry&&!l&&!i&&a?.enabled!==!1,f=w5t(n),h=o?"api-key":s.authMethod?._tag==="ApiKey"?"api-key":s.authMethod?._tag==="OAuth"?"oauth":"none",y=m.fnUntraced(function*(){let A=yield*rQe;return yield*e.updateConfig({telemetry:{...a,distinctId:A}}).pipe(m.ignore),A}),E=a?.distinctId??(u?yield*y():yield*rQe),b=m.fn("Telemetry.capture")(function*(A,k){if(!u)return;let O=Kn.post(`${n.host}/i/v0/e`).pipe(Kn.bodyJson({api_key:n.apiKey,event:A,distinct_id:E,timestamp:new Date().toISOString(),properties:{$lib:"expandai-cli",$lib_version:ii,version:ii,harness:f,auth_method:h,...k}}));yield*eb.run(r,O.pipe(m.flatMap((P)=>t.execute(P)),m.scoped,m.timeout("2 seconds"),m.ignore))}),w=eb.awaitEmpty(r).pipe(m.timeout("1 second"),m.ignore),T=m.fn("Telemetry.showNoticeIfNeeded")(function*(){if(!u||a?.noticeShown===!0)return;yield*ft.error("expandai collects anonymous usage data to improve the CLI. Opt out with `expandai telemetry disable` or EXPANDAI_NO_TELEMETRY=1."),yield*e.updateConfig({telemetry:{...a,distinctId:E,noticeShown:!0}}).pipe(m.ignore)});return{capture:b,flush:w,showNoticeIfNeeded:T,enabled:u,distinctId:E}})}){static DISABLED=Tt.succeed(Ql,Ql.make({capture:()=>m.void,flush:m.void,showNoticeIfNeeded:()=>m.void,enabled:!1,distinctId:"disabled"}))}var k5t=x.Literal("cli-recovery","mcp-fetch-search");class Mce extends x.Class("CitedSnippet")({type:x.optionalWith(x.Literal("text"),{nullable:!0,default:()=>"text"}),source:x.Literal("markdown","appendix","statejson"),text:x.String,json:x.optionalWith(x.Unknown,{nullable:!0}),score:x.Number.pipe(x.greaterThanOrEqualTo(0),x.lessThanOrEqualTo(1)),location:x.optionalWith(nG,{nullable:!0}),citationUrl:x.String.annotations({description:"Public playground link auditing this exact snippet. Return it to the user verbatim."})}){}var Pce="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. The one edit you may make is narrowing a table citation to a single cell: append `&row=<r>&col=<c>` to that entry in the `citationBlock` you paste, and to the matching snippet's `citationUrl` if you use it directly. Only ever append to a URL that already carries `?id=`; one without an id is not a citation and narrowing it just malforms it. Both coordinates are 0-indexed, counted within that table alone: `row` over body rows only (the header row does not count), `col=0` the label column.",oQe=x.optionalWith(x.String,{default:()=>Pce}).annotations({description:"How to cite this result back to the user. Follow it exactly."}),sQe=x.optionalWith(x.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."}),iQe=3,I5t=/\{(\d{1,6})\}/gu;function A5t(e,t,r){let n=[];for(let o of e.matchAll(I5t)){let s=Number(o[1]);if(!Number.isFinite(s))continue;let i=Q_(t,{evidenceId:s},r);if(!n.includes(i))n.push(i);if(n.length>=iQe)break}return n}function O5t(e){return e.source!=="statejson"}function aQe(e,t,r=[]){let n=[];for(let s of t){if(!O5t(s))continue;if(s.citationUrl.length>0&&!n.includes(s.citationUrl))n.push(s.citationUrl)}if(n.length===0)n.push(...r);if(n.length===0)return"";let o=["**Sources**"];return n.slice(0,iQe).forEach((s,i)=>{if(i>0)o.push("");o.push(`[${i+1}] [${e}](${s})`)}),o.join(`
|
|
659
|
+
`)}class IK extends x.Class("CitedSearchResult")({query:x.String,snippets:x.Array(Mce),meta:x.optionalWith(oG,{nullable:!0})}){}class AK extends x.Class("CitedObjectModeResult")({invocationPath:x.Literal("mcp-fetch-search"),citationInstructions:oQe,citationBlock:sQe,meta:tG,markdown:x.String,json:x.Array(rG),data:x.optionalWith(x.Struct({assets:x.optionalWith(x.Array(iN),{nullable:!0}),search:x.optionalWith(IK,{nullable:!0})}),{nullable:!0})}){}class Iv extends x.Class("CitedSnapshotSearchResult")({invocationPath:k5t,citationInstructions:oQe,citationBlock:sQe,snapshotId:x.String.pipe(x.minLength(1)),response:Ik,search:IK,durationMs:x.Number.pipe(x.greaterThanOrEqualTo(0)),playground:x.String.annotations({description:"Public playground link for the whole snapshot."})}){}function _5t(e,t,r){return new Mce({type:r.type,source:r.source,text:r.text,json:r.json,score:r.score,location:r.location,citationUrl:Q_(e,r.location,t)})}function cQe(e,t,r){return new IK({query:r.query,snippets:r.snippets.map((n)=>_5t(e,t,n)),meta:r.meta})}function lQe(e,t){let r=nb(e.meta.playground,t),n=e.data,o=n?.search==null?void 0:cQe(e.meta.snapshotId,r,n.search),s=aQe(e.meta.url,o?.snippets??[],A5t(e.markdown,e.meta.snapshotId,r));return new AK({invocationPath:"mcp-fetch-search",citationInstructions:Pce,citationBlock:s,meta:e.meta,markdown:s.length===0?e.markdown:`${e.markdown.trimEnd()}
|
|
660
|
+
|
|
661
|
+
---
|
|
662
|
+
|
|
663
|
+
${s}
|
|
664
|
+
`,json:e.json,data:n==null?n:{assets:n.assets,search:o}})}function OK(e,t,r="mcp-fetch-search"){let n=nb(e.playground,t),o=cQe(e.snapshotId,n,e.search);return new Iv({invocationPath:r,citationInstructions:Pce,citationBlock:aQe(e.response.url,o.snippets),snapshotId:e.snapshotId,response:e.response,search:o,durationMs:e.durationMs,playground:die(e.snapshotId,n)})}class Dce extends x.Class("FetchSearchParams")({query:x.NonEmptyTrimmedString.annotations({description:"Search query. When provided, fetch returns search results only."}),maxResults:x.optionalWith(x.Int.pipe(x.between(1,50)),{default:()=>5}).annotations({description:"Maximum snippets to return.",default:5}),minScore:x.optionalWith(x.Number.pipe(x.between(0,1)),{default:()=>0}).annotations({description:"Minimum snippet relevance score from 0 to 1.",default:0})}){}class uQe extends x.Class("FetchParams")({url:x.String.annotations({description:"The URL to fetch content from"}),search:x.optional(Dce).annotations({description:"Semantic search configuration. When provided, the API returns snippets under data.search.snippets."}),includeMeta:x.optionalWith(x.Boolean,{default:()=>!1}).annotations({description:"Include page meta tags (title, description, Open Graph)",default:!1}),includeAppendix:x.optionalWith(x.Boolean,{default:()=>!1}).annotations({description:"Include extracted links and sidebar content",default:!1}),includeJson:x.optionalWith(x.Boolean,{default:()=>!0}).annotations({description:"Include JSON extracted from network responses and DOM",default:!0})}){}class pQe extends x.Class("FetchSnapshotSearchParams")({snapshotId:x.NonEmptyString.annotations({description:"Snapshot ID returned by a previous fetch response."}),search:Dce.annotations({description:"Semantic search configuration. Returns snippets from stored fetch artifacts."}),includeMarkdown:x.optionalWith(x.Boolean,{default:()=>!0}).annotations({description:"Search the stored markdown corpus.",default:!0}),includeAppendix:x.optionalWith(x.Boolean,{default:()=>!1}).annotations({description:"Search extracted appendix content.",default:!1}),includeJson:x.optionalWith(x.Boolean,{default:()=>!0}).annotations({description:"Search stored State JSON.",default:!0})}){}var fQe=Pd.make("fetch",{description:Sn.stripMargin(`
|
|
665
|
+
|Fetch and extract content from any URL.
|
|
666
|
+
|
|
|
667
|
+
|You MUST cite what you take from the result. The result carries a ready-made
|
|
668
|
+
|'citationBlock' — append it verbatim to the end of your answer. Do not retype it, do not
|
|
669
|
+
|substitute the URL you fetched, and do not build a link yourself: the citation points at
|
|
670
|
+
|expand.ai's stored capture, not at the original site. Drop only the markers you did not use.
|
|
671
|
+
|A 'Verify it' link without '?id=' is not a citation. Never invent or reuse an evidence id.
|
|
672
|
+
|
|
|
673
|
+
|An id covers a whole block. To narrow a table citation to one cell, append
|
|
674
|
+
|'&row=<r>&col=<c>' to that entry's URL, but only where it already carries '?id='. Both are
|
|
675
|
+
|0-indexed, counted within that table alone: 'row' over body rows only (header row excluded),
|
|
676
|
+
|'col=0' the label column.
|
|
677
|
+
|
|
|
678
|
+
|Returns object-mode output with markdown, front-matter metadata, and optional extracted JSON.
|
|
679
|
+
|When 'search' is set, the response also carries ranked snippets under data.search.snippets.
|
|
680
|
+
|For State JSON sources each snippet also carries the extracted 'json' value.`),parameters:uQe.fields,success:AK,failure:x.Defect,failureMode:"return"}).annotate(Pd.Readonly,!0).annotate(Pd.Destructive,!1),dQe=Pd.make("fetch_search",{description:Sn.stripMargin(`
|
|
681
|
+
|Search a previous fetch by snapshotId without starting a new capture.
|
|
682
|
+
|
|
|
683
|
+
|You MUST cite what you take from the result. The result carries a ready-made
|
|
684
|
+
|'citationBlock' — append it verbatim to the end of your answer. Do not retype it, do not
|
|
685
|
+
|substitute the URL you fetched, and do not build a link yourself: the citation points at
|
|
686
|
+
|expand.ai's stored capture, not at the original site. Drop only the markers you did not use.
|
|
687
|
+
|A 'Verify it' link without '?id=' is not a citation. Never invent or reuse an evidence id.
|
|
688
|
+
|
|
|
689
|
+
|Returns ranked snippets from stored markdown, appendix, or State JSON artifacts. For State JSON
|
|
690
|
+
|sources each snippet also carries the extracted 'json' value. The result also includes a
|
|
691
|
+
|whole-snapshot 'playground' link.`),parameters:pQe.fields,success:Iv,failure:x.Defect,failureMode:"return"}).annotate(Pd.Readonly,!0).annotate(Pd.Destructive,!1);class _K extends m.Service()("@expandai/cli/Mcp/Fetch",{dependencies:[ya.Default,Cr.Default,Ql.Default],scoped:m.gen(function*(){let e=yield*ya,t=yield*Cr,r=yield*Ql,n=yield*t.getPlaygroundHost(),o=m.fn("Fetch.fetch")(function*({url:i,search:a,includeMeta:c,includeAppendix:l,includeJson:u}){yield*m.logDebug("MCP fetch started").pipe(m.annotateLogs({operation:"fetch",hasSearch:a!==void 0,includeMeta:c,includeAppendix:l,includeJson:u})),yield*r.capture("mcp_tool_called",{tool:"fetch",has_search:a!==void 0});let f=l&&u?"appendix,statejson":l?"appendix":u?void 0:"",h=yield*e.fetchFetchJson({params:{include:f},payload:{url:i,include:{markdown:!0,meta:c,json:u,appendix:l},search:a}});return yield*m.logDebug("MCP fetch completed").pipe(m.annotateLogs({operation:"fetch",hasSearch:a!==void 0,searchResultCount:h.data?.search?.snippets.length??0,jsonEvidenceCount:h.json.length})),lQe(h,n)}),s=m.fn("Fetch.fetchSearch")(function*({snapshotId:i,search:a,includeMarkdown:c,includeAppendix:l,includeJson:u}){yield*m.logDebug("MCP snapshot search started").pipe(m.annotateLogs({operation:"fetch_search",includeMarkdown:c,includeAppendix:l,includeJson:u})),yield*r.capture("mcp_tool_called",{tool:"fetch_search",has_search:!0});let f=yield*e.fetchFetchSearch({snapshotId:i,search:a,include:{markdown:c,json:u,appendix:l}});return OK(f,n,"mcp-fetch-search")});return{fetch:o,fetchSearch:s}})}){}var Fce=kK.make(fQe,dQe),v5t=Fce.toLayer(m.gen(function*(){let e=yield*_K;return Fce.of({fetch:e.fetch,fetch_search:e.fetchSearch})})).pipe(Tt.provide(_K.Default),Tt.provide(ya.Default)),Nce=Xx.toolkit(Fce).pipe(Tt.provide(v5t));var mQe={name:co,version:ii},hQe=(e={})=>e.includeDocs?Tt.mergeAll(Nce,tQe):Nce;var T5t=bt.boolean("docs").pipe(bt.withDefault(!1),bt.withDescription("Expose documentation resources alongside tools")),Lce=Te.make("run",{includeDocs:T5t}).pipe(Te.withDescription("Run the expandai MCP server over stdio"),Te.withHandler(m.fnUntraced(function*({includeDocs:e}){let t=Xx.layerStdio({...mQe,stdin:fh.stdin,stdout:WF.stdout}).pipe(Tt.provide(hQe({includeDocs:e})));return yield*Tt.launch(t)})));class gQe extends x.TaggedError()("SnapshotSnippetsUnavailable",{snapshotId:x.String,query:x.String}){get message(){return`No snippets in snapshot ${this.snapshotId} matched '${this.query}'`}}var R5t=Mo.text({name:"snapshotId"}).pipe(Mo.withDescription("Snapshot handle from a previous fetch (meta.snapshotId, or the WebFetch hook note)")),M5t=Mo.text({name:"query"}).pipe(Mo.withDescription("Semantic search query")),P5t=bt.text("format").pipe(bt.withDefault("text"),bt.withDescription("Output format (text or json)"),bt.withSchema(x.Literal("text","json"))),D5t=bt.integer("max-results").pipe(bt.withDefault(5),bt.withDescription("Maximum snippets to return (default: 5)"),bt.withSchema(x.Int.pipe(x.greaterThanOrEqualTo(1),x.lessThanOrEqualTo(50)))),F5t=bt.float("min-score").pipe(bt.withDefault(0.6),bt.withDescription("Minimum snippet relevance score from 0 to 1 (default: 0.6)"),bt.withSchema(x.Number.pipe(x.greaterThanOrEqualTo(0),x.lessThanOrEqualTo(1)))),N5t={snapshotId:R5t,query:M5t,format:P5t,maxResults:D5t,minScore:F5t},Uce=Te.make("search",N5t).pipe(Te.withDescription("Search a previously fetched page by its snapshot handle — no new capture"),Te.withHandler(m.fnUntraced(function*({format:e,maxResults:t,minScore:r,query:n,snapshotId:o}){let s=yield*ya,a=yield*(yield*Cr).getPlaygroundHost(),c=yield*s.fetchFetchSearch({snapshotId:o,search:{query:n,maxResults:t,minScore:r},include:{markdown:!0,json:!0}}),l=OK(c,a,"cli-recovery"),u=yield*Q.value(e).pipe(Q.when("text",()=>{let f=l.search.snippets;return f.length===0?m.fail(new gQe({snapshotId:o,query:n})):m.succeed(`[invocation: cli-recovery]
|
|
692
|
+
${mG(o,nb(c.playground,a),f)}`)}),Q.when("json",()=>x.encode(x.parseJson(Iv,{space:2}))(l)),Q.exhaustive);yield*ft.log(u)},m.provide(Tt.mergeAll(ya.Default,Cr.Default)))));var xQe=Mo.choice([["claude-code","claude-code"],["cursor","cursor"],["opencode","opencode"],["codex","codex"]]),yQe=Mo.choice([["global","global"],["project","project"]]),L5t=Te.make("install",{host:xQe,scope:yQe}).pipe(Te.withDescription("Install the expandai skill into the chosen host + scope"),Te.withHandler(({host:e,scope:t})=>m.flatMap(Eh,(r)=>r.install(e,t)))),U5t=Te.make("uninstall",{host:xQe,scope:yQe}).pipe(Te.withDescription("Remove the expandai skill from the chosen host + scope"),Te.withHandler(({host:e,scope:t})=>m.flatMap(Eh,(r)=>r.uninstall(e,t)))),SQe=Te.make("skill").pipe(Te.withDescription("Manage the expandai agent skill"),Te.withSubcommands([L5t,U5t]));var bQe=/^[0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u,CQe=x.String.pipe(x.minLength(1),x.maxLength(64),x.pattern(bQe));class vK extends x.Class("StatusRequest")({harness:$s,scope:el}){}var H5t=x.Struct({state:x.Literal("absent","unusable","refresh_required","healthy"),healthy:x.Boolean}),q5t=x.Union(x.Struct({state:x.Literal("none"),count:x.Literal(0)}),x.Struct({state:x.Literal("approval_pending"),count:x.Literal(1),approvalExpiresAt:x.DateTimeUtc})),B5t=x.Struct({configured:x.Boolean,integrationVersion:x.optional(CQe),components:x.Struct({webfetchHook:x.Boolean,runtimeSkill:x.Boolean,mcp:x.Boolean}),runtimeState:x.Literal("unverified","reload_required","blocked"),reloadState:x.Literal("not_required","required"),consentState:x.Literal("not_required","may_be_required"),policyState:x.Literal("unverified","blocked"),policyCodes:x.Array(x.Literal("managed_policy_blocked","target_read_only")).pipe(x.maxItems(1))});class TK extends x.Class("StatusResult")({schemaVersion:x.Literal(1),status:x.Literal("ok"),harness:$s,scope:el,cli:x.Struct({version:CQe}),auth:H5t,pendingAuthorization:q5t,installation:B5t}){}var W5t=x.Literal("credential_config_malformed","credential_storage_insecure","credential_health_failed","pending_state_malformed","pending_state_unavailable","harness_inspection_failed","invalid_status_result");class RK extends x.TaggedError()("StatusServiceError",{code:W5t,recoverable:x.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 ey(e,t){return new RK({code:e,recoverable:t})}function Hce(e){if(e instanceof X_)return ey("credential_config_malformed",!1);if(e instanceof kd)return ey("credential_storage_insecure",!1);return ey("credential_health_failed",!1)}function EQe(e){if(e instanceof kd)return ey("credential_storage_insecure",!1);return e instanceof Nx?ey("pending_state_malformed",!0):ey("pending_state_unavailable",!0)}function z5t(e){return m.gen(function*(){let t=yield*m.either(e.loadConfig());if(t._tag==="Left"){if(t.left instanceof O3)return{state:"absent",healthy:!1};return yield*Hce(t.left)}let r=yield*ar.now,n=I3(t.right.authMethod,r);return{state:n,healthy:n==="healthy"}})}function $5t(e){return m.gen(function*(){if(q.isNone(e))return{state:"none",count:0};let t=ar.toEpochMillis(yield*ar.now);if(ar.toEpochMillis(e.value.approvalExpiresAt)<=t)return{state:"none",count:0};return{state:"approval_pending",count:1,approvalExpiresAt:ar.formatIso(e.value.approvalExpiresAt)}})}function j5t(e,t){let r=new Set(t.components),n=e==="opencode",o=r.has("runtime-skill")&&r.has("mcp")&&(n?r.has("webfetch-hook")&&r.size===3:r.size===2),s=t.integrationVersion===void 0||t.integrationVersion.length<=64&&bQe.test(t.integrationVersion),i=t.configured===o,a=t.runtimeState!=="observed";return r.size===t.components.length&&s&&i&&a?m.succeed(t):ey("invalid_status_result",!1)}function V5t(e,t){let r=new Set(e.components),n=e.policyBlock!==void 0||e.runtimeState==="blocked",o=e.policyBlock===iae?["target_read_only"]:n?["managed_policy_blocked"]:[],s=!n&&e.runtimeState==="reload_required";return{configured:e.configured,...e.integrationVersion===void 0?{}:{integrationVersion:e.integrationVersion},components:{webfetchHook:r.has("webfetch-hook"),runtimeSkill:r.has("runtime-skill"),mcp:r.has("mcp")},runtimeState:n?"blocked":s?"reload_required":"unverified",reloadState:s?"required":"not_required",consentState:t==="project"?"may_be_required":"not_required",policyState:n?"blocked":"unverified",policyCodes:o}}class HN extends m.Service()("@expandai/cli/Init/StatusService",{dependencies:[Cr.Default,Hx.Default,Od.Default],effect:m.gen(function*(){let e=yield*Cr,t=yield*Hx,r=yield*Od;return{run:m.fn("StatusService.run")(function*(o){return yield*m.annotateCurrentSpan({harness:o.harness,scope:o.scope}),yield*m.gen(function*(){yield*e.inspectSecureStorage().pipe(m.withTracerEnabled(!1),m.mapError(Hce));let s=yield*z5t(e).pipe(m.withTracerEnabled(!1)),i=yield*e.getApiUrl().pipe(m.withTracerEnabled(!1),m.mapError(Hce)),a=yield*t.canonicalScopeRoot(o.scope).pipe(m.withTracerEnabled(!1),m.mapError(EQe)),c={apiOrigin:i.origin,clientId:sf,harness:"agent-harnesses",scope:o.scope,canonicalScopeRoot:a},l=yield*t.peek(c).pipe(m.withTracerEnabled(!1),m.mapError(EQe)),u=yield*r.inspect(o.harness,o.scope).pipe(m.withTracerEnabled(!1),m.mapError(()=>ey("harness_inspection_failed",!0)),m.flatMap((h)=>j5t(o.harness,h))),f={schemaVersion:1,status:"ok",harness:o.harness,scope:o.scope,cli:{version:ii},auth:s,pendingAuthorization:yield*$5t(l),installation:V5t(u,o.scope)};return yield*x.decodeUnknown(TK)(f).pipe(m.mapError(()=>ey("invalid_status_result",!1)))})})}})}){}var G5t=bt.text("harness").pipe(bt.optional,bt.withDescription("Agent harness to inspect")),K5t=bt.text("scope").pipe(bt.optional,bt.withDescription("Configuration scope")),J5t=bt.boolean("json").pipe(bt.withDescription("Emit one machine-readable JSON result")),wQe={harness:G5t,scope:K5t,json:J5t},Q5t=x.parseJson(ob),Y5t=x.parseJson(TK),MK="Agent status requires --harness claude-code|cursor|opencode|codex, --scope project|global, and --json.";function kQe(e,t,r){return x.encodeSync(Q5t)(new ob({schemaVersion:1,status:"error",code:e,message:t,recoverable:r}))}function qce(){return kQe("invalid_arguments",MK,!0)}function Av(e,t,r,n){return ft.error(kQe(e,t,r)).pipe(m.zipRight(m.sync(()=>void(process.exitCode=n))))}function Bce(e){return xN(e,"status")}function Z5t(e){function t(r,n){if(r>=e.length)return n;let o=e[r];if(o==="--json"&&!n.json)return t(r+1,{...n,json:!0});if(o!=="--harness"&&o!=="--scope")return;let s=e[r+1];if(s===void 0||s.startsWith("-"))return;if(o==="--harness"&&q.isNone(n.harness))return t(r+2,{...n,harness:q.some(s)});if(o==="--scope"&&q.isNone(n.scope))return t(r+2,{...n,scope:q.some(s)});return}return t(0,{harness:q.none(),json:!1,scope:q.none()})}function IQe(e){if(e[2]!=="status")return;let t=e.slice(3);if(t.length===1&&(t[0]==="--help"||t[0]==="-h"))return;let r=Z5t(t);if(r===void 0||!r.json)return qce();if(q.isNone(q.flatMap(r.harness,(n)=>x.decodeUnknownOption($s)(n))))return qce();if(!q.contains(r.scope,"project")&&!q.contains(r.scope,"global"))return qce();return}var X5t={"claude-code":"Claude Code",cursor:"Cursor",codex:"Codex",opencode:"OpenCode"},eQt=["claude-code","opencode"];function tQt(e){let t=e.pendingAuthorization.count===1?"approval pending":"none",r=e.installation.configured?"configured":"partial or not configured",n=(o)=>o?"configured":"not configured";return["Expand status",`Auth: ${e.auth.state}`,`Pending authorization: ${t}`,`${X5t[e.harness]}: ${r}`,...eQt.includes(e.harness)?[`WebFetch hook: ${n(e.installation.components.webfetchHook)}`]:[],`Runtime skill: ${n(e.installation.components.runtimeSkill)}`,`MCP: ${n(e.installation.components.mcp)}`,`Runtime: ${e.installation.runtimeState}`].join(`
|
|
693
|
+
`)}var AQe=m.fnUntraced(function*(e,t){let r=yield*HN,n=yield*m.either(t?r.run(e).pipe(rf.withMinimumLogLevel(Sm.None)):r.run(e));if(mt.isLeft(n)){let s=n.left;if(s instanceof RK){yield*Av(s.code,s.message,s.recoverable,1);return}yield*Av("status_failed","Expand status could not be inspected safely.",!0,1);return}if(!t){yield*ft.log(tQt(n.right));return}let o=yield*x.encode(Y5t)(n.right).pipe(m.catchAll(()=>Av("invalid_status_result","Expand status returned an invalid result.",!1,1).pipe(m.as(void 0))));if(typeof o==="string")yield*ft.log(o)}),OQe=m.fnUntraced(function*({harness:e,json:t,scope:r}){if(!t||q.isNone(q.flatMap(e,(o)=>x.decodeUnknownOption($s)(o)))||!q.contains(r,"project")&&!q.contains(r,"global")){yield*Av("invalid_arguments",MK,!0,2);return}let n=yield*x.decodeUnknown(vK)({harness:q.getOrUndefined(e),scope:q.getOrUndefined(r)}).pipe(m.catchAll(()=>Av("invalid_arguments",MK,!0,2).pipe(m.as(void 0))));if(n!==void 0)yield*AQe(n,!0)});class PK extends m.Service()("@expandai/cli/Commands/StatusTerminalInteraction",{effect:m.gen(function*(){let e=yield*Es.Terminal,t=m.fnUntraced(function*(){return yield*jl.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(m.provideService(Es.Terminal,e))}),r=m.fnUntraced(function*(){return yield*jl.select({message:"Which configuration scope should Expand inspect?",choices:[{title:"This project",value:"project"},{title:"All projects for this user",value:"global"}]}).pipe(m.provideService(Es.Terminal,e))});return{chooseHarness:t,chooseScope:r}})}){}var rQt=m.fnUntraced(function*(e){if(e.json){yield*OQe(e);return}let t=yield*PK,r=q.isSome(e.harness)?e.harness.value:yield*t.chooseHarness(),n=q.isSome(e.scope)?e.scope.value:yield*t.chooseScope(),o=x.decodeUnknownOption($s)(r),s=x.decodeUnknownOption(el)(n);if(q.isNone(o)||q.isNone(s)){yield*Av("invalid_arguments",MK,!0,2);return}let i=new vK({harness:o.value,scope:s.value});yield*AQe(i,!1)}),_Qe="Inspect redacted local Expand onboarding status",vQe=Te.make("status",wQe).pipe(Te.withDescription(_Qe),Te.withHandler(rQt)),TQe=Te.make("status",wQe).pipe(Te.withDescription(_Qe),Te.withHandler(OQe));var RQe=m.fnUntraced(function*(e){let t=yield*Cr,{config:r}=yield*t.readConfigFile();yield*t.updateConfig({telemetry:{...r.telemetry,enabled:e}}),yield*ft.log(`Telemetry ${e?"enabled":"disabled"}.`)}),nQt=m.fnUntraced(function*(){let e=yield*Ql;yield*ft.log(e.enabled?"Telemetry is enabled. Disable with `expandai telemetry disable` or EXPANDAI_NO_TELEMETRY=1.":"Telemetry is disabled.")}),oQt=Te.make("status").pipe(Te.withDescription("Show whether anonymous usage telemetry is enabled"),Te.withHandler(()=>nQt())),sQt=Te.make("enable").pipe(Te.withDescription("Enable anonymous usage telemetry"),Te.withHandler(()=>RQe(!0))),iQt=Te.make("disable").pipe(Te.withDescription("Disable anonymous usage telemetry"),Te.withHandler(()=>RQe(!1))),Wce=Te.make("telemetry").pipe(Te.withDescription("Manage anonymous usage telemetry"),Te.withSubcommands([oQt,sQt,iQt]));var aQt=Mo.choice([["all","all"],["hook","hook"],["skill","skill"],["mcp","mcp"]]).pipe(Mo.optional),cQt=Mo.choice([["claude-code","claude-code"],["cursor","cursor"],["opencode","opencode"],["codex","codex"]]).pipe(Mo.optional),lQt=Mo.choice([["global","global"],["project","project"]]).pipe(Mo.optional),zce=Te.make("uninstall",{target:aQt,host:cQt,scope:lQt}).pipe(Te.withDescription("Remove expandai hooks, skills, and MCP server entries. Defaults to `all` across every host and scope when target/host/scope are omitted."),Te.withHandler(m.fnUntraced(function*({target:e,host:t,scope:r}){yield*(yield*Bx).uninstall({target:q.getOrUndefined(e),host:q.getOrUndefined(t),scope:q.getOrUndefined(r)})})));var uQt=Ae.all({override:C3("EXPANDAI_CLI_CONTEXT",x.Literal("human","agent")),mcpTransport:Ae.string("MCP_TRANSPORT").pipe(Ae.option,Ae.map(q.isSome)),claudeCode:ev("CLAUDECODE"),cursor:Ae.string("CURSOR_TRACE_ID").pipe(Ae.option,Ae.map(q.isSome)),codex:Ae.string("CODEX_RUN_ID").pipe(Ae.option,Ae.map(q.isSome))}),pQt=m.fnUntraced(function*(e){let t=Eae({argv:process.argv,environment:process.env,stdinIsTty:process.stdin.isTTY===!0,stdoutIsTty:process.stdout.isTTY===!0});if(t!==void 0)return t==="machine"?"agent":"human";let r=bae({argv:process.argv,environment:process.env,stdinIsTty:process.stdin.isTTY===!0,stdoutIsTty:process.stdout.isTTY===!0});if(r!==void 0)return r==="machine"?"agent":"human";let n=Bce({argv:process.argv,environment:process.env,stdinIsTty:process.stdin.isTTY===!0,stdoutIsTty:process.stdout.isTTY===!0});if(n!==void 0)return n==="machine"?"agent":"human";let o=yield*uQt,s=e==="mcp run"||o.mcpTransport?q.some("mcp"):q.none(),i=o.claudeCode||o.cursor||o.codex||!process.stdout.isTTY?q.some("agent"):q.none();return q.firstSomeOf([s,o.override,i]).pipe(q.getOrElse(()=>"human"))}),fQt=Te.make("mcp").pipe(Te.withDescription("Run or install the expandai MCP server"),Te.withSubcommands([Lce,eJe,tJe])),dQt=Te.make("mcp").pipe(Te.withDescription("Run the expandai MCP server"),Te.withSubcommands([Lce])),PQe=gN.DefaultWithoutDependencies.pipe(Tt.provide(Tt.mergeAll(ju.Default,cf.Default,nv.Default,Od.Default))),DQe=HN.DefaultWithoutDependencies.pipe(Tt.provide(Tt.mergeAll(Cr.Default,Hx.Default,Od.Default))),mQt=Te.make("expandai").pipe(Te.withDescription("expand.ai CLI and MCP server"),Te.withSubcommands([nae,Uce,PGe,Jie,Qie,V4e,vQe,zce,fQt,SQe,C4e,Wce]),Te.provide(Tt.mergeAll(Cr.Default,ju.Default,$u.Default,Sh.Default,Eh.Default,Bx.Default,fv.Default,dv.Default,PQe,$x.Default,OG.Default,DQe,PK.Default))),hQt=Te.make("expandai").pipe(Te.withDescription("expand.ai CLI and MCP server"),Te.withSubcommands([nae,Uce,Y4e,Jie,Qie,G4e,TQe,zce,dQt,w4e,Wce]),Te.provide(Tt.mergeAll(Cr.Default,YF.Default,ju.Default,fv.Default,dv.Default,$u.Default,Sh.Default,Eh.Default,Bx.Default,PQe,$x.Default,DQe))),gQt=Tt.unwrapEffect(m.gen(function*(){let e=yield*Ae.boolean("DEBUG").pipe(Ae.withDefault(!1));return Tt.mergeAll(rf.replace(rf.defaultLogger,rf.prettyLogger({stderr:!0})),rf.minimumLogLevel(e?Sm.All:Sm.Info))})),xQt=nN(process.argv)==="status"||nN(process.argv)==="init"&&process.argv.includes("--detect"),yQt=xQt?Ql.DISABLED:Ql.Default,SQt=Tt.mergeAll(rb.layer,Vj.layer({showBuiltIns:!1}),gQt,yQt),EQt=(e)=>Mr.failureOption(e).pipe(q.match({onNone:()=>"Defect",onSome:(t)=>typeof t==="object"&&t!==null&&("_tag"in t)&&typeof t._tag==="string"?t._tag:"UnknownError"}));function bQt(){if(Eae({argv:process.argv,environment:process.env,stdinIsTty:process.stdin.isTTY===!0,stdoutIsTty:process.stdout.isTTY===!0})==="machine")return W4e(process.argv);if(bae({argv:process.argv,environment:process.env,stdinIsTty:process.stdin.isTTY===!0,stdoutIsTty:process.stdout.isTTY===!0})==="machine")return Q4e(process.argv);return Bce({argv:process.argv,environment:process.env,stdinIsTty:process.stdin.isTTY===!0,stdoutIsTty:process.stdout.isTTY===!0})==="machine"?IQe(process.argv):void 0}var CQt=m.gen(function*(){let e=nN(process.argv),t=yield*pQt(e),r=yield*Ql;if(t==="human")yield*r.showNoticeIfNeeded();yield*r.capture("cli_command_run",{command:e,context:t});let n=t==="human"?mQt:hQt;return yield*Te.run(n,{name:"expand.ai CLI",version:ii})(process.argv)}).pipe(m.catchAllCause((e)=>{let t=Mr.failureOption(e);if(Mr.isInterruptedOnly(e)||q.isSome(t)&&Es.isQuitException(t.value))return m.void;let r=q.match(t,{onSome:(s)=>CF.isValidationError(s)?m.void:ft.error(`Error: ${s.message}`),onNone:()=>ft.error(Sn.stripMargin(`
|
|
694
|
+
|Unexpected failure:
|
|
695
|
+
|${Mr.pretty(e)}`))}),n=m.logDebug("Error cause").pipe(m.annotateLogs({cause:Mr.pretty(e)})),o=m.flatMap(Ql,(s)=>s.capture("cli_command_failed",{command:nN(process.argv),error_tag:EQt(e)}));return r.pipe(m.zipRight(n),m.zipRight(o),m.zipRight(m.failCause(e)))}),m.ensuring(m.flatMap(Ql,(e)=>e.flush)),m.provide(SQt)),MQe=bQt();if(MQe!==void 0)process.stderr.write(`${MQe}
|
|
696
|
+
`),process.exitCode=2;else y3.runMain(CQt,{disableErrorReporting:!0,disablePrettyLogger:!0});
|