@typeonce/effect-machine-devtools 0.23.0 → 0.24.0
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 +10 -4
- package/dist/DevServer.d.ts +2 -1
- package/dist/DevServer.d.ts.map +1 -1
- package/dist/DevServer.js.map +1 -1
- package/dist/DevToolsProtocol.d.ts +731 -17
- package/dist/DevToolsProtocol.d.ts.map +1 -1
- package/dist/DevToolsProtocol.js +191 -1
- package/dist/DevToolsProtocol.js.map +1 -1
- package/dist/MachineDocument.d.ts +78 -2
- package/dist/MachineDocument.d.ts.map +1 -1
- package/dist/MachineDocument.js +33 -1
- package/dist/MachineDocument.js.map +1 -1
- package/dist/MachineRegistry.d.ts +36 -6
- package/dist/MachineRegistry.d.ts.map +1 -1
- package/dist/ProjectInspector.d.ts +2 -0
- package/dist/ProjectInspector.d.ts.map +1 -1
- package/dist/ProjectInspector.js.map +1 -1
- package/dist/client/assets/index-B49Tjawc.js +14 -0
- package/dist/client/assets/index-BKH0cOG2.css +1 -0
- package/dist/client/index.html +2 -2
- package/dist/internal/devServer.d.ts +2 -1
- package/dist/internal/devServer.d.ts.map +1 -1
- package/dist/internal/devServer.js +68 -7
- package/dist/internal/devServer.js.map +1 -1
- package/dist/internal/evaluationWorker.d.ts.map +1 -1
- package/dist/internal/evaluationWorker.js +279 -4
- package/dist/internal/evaluationWorker.js.map +1 -1
- package/dist/internal/machineDocument.d.ts.map +1 -1
- package/dist/internal/machineDocument.js +63 -2
- package/dist/internal/machineDocument.js.map +1 -1
- package/dist/internal/projectInspector.d.ts.map +1 -1
- package/dist/internal/projectInspector.js +26 -10
- package/dist/internal/projectInspector.js.map +1 -1
- package/package.json +2 -2
- package/src/DevServer.ts +6 -2
- package/src/DevToolsProtocol.ts +286 -1
- package/src/MachineDocument.ts +54 -1
- package/src/ProjectInspector.ts +5 -0
- package/src/internal/browser/input-form.ts +669 -0
- package/src/internal/browser/planner-example.ts +143 -0
- package/src/internal/browser/simulation-client.ts +20 -0
- package/src/internal/browser/styles.css +323 -3
- package/src/internal/browser/visualizer-app.ts +395 -34
- package/src/internal/browser/visualizer.ts +1 -1
- package/src/internal/devServer.ts +91 -8
- package/src/internal/evaluationWorker.ts +390 -8
- package/src/internal/machineDocument.ts +75 -2
- package/src/internal/projectInspector.ts +58 -15
- package/dist/client/assets/index-BGOhE3Ng.css +0 -1
- package/dist/client/assets/index-DiqGhsGR.js +0 -14
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Machine } from "@typeonce/effect-machine"
|
|
2
|
+
import * as Schema from "effect/Schema"
|
|
2
3
|
import type * as Public from "../MachineDocument.js"
|
|
3
4
|
|
|
4
5
|
const enabled = Machine.enabled as (
|
|
@@ -6,6 +7,72 @@ const enabled = Machine.enabled as (
|
|
|
6
7
|
snapshot: unknown
|
|
7
8
|
) => ReadonlyArray<PropertyKey>
|
|
8
9
|
|
|
10
|
+
const inputEventSchemas = Machine.inputEventSchemas as (
|
|
11
|
+
machine: Machine.Machine.Any
|
|
12
|
+
) => ReadonlyArray<Machine.Machine.TaggedSchema>
|
|
13
|
+
|
|
14
|
+
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
15
|
+
typeof value === "object" && value !== null && !Array.isArray(value)
|
|
16
|
+
|
|
17
|
+
const resolveReference = (
|
|
18
|
+
value: unknown,
|
|
19
|
+
definitions: Readonly<Record<string, unknown>>
|
|
20
|
+
): Record<string, unknown> | undefined => {
|
|
21
|
+
if (!isRecord(value)) return undefined
|
|
22
|
+
if (typeof value.$ref !== "string" || !value.$ref.startsWith("#/$defs/")) return value
|
|
23
|
+
const name = decodeURIComponent(value.$ref.slice("#/$defs/".length))
|
|
24
|
+
const target = definitions[name]
|
|
25
|
+
return isRecord(target) ? target : undefined
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const tagsOf = (
|
|
29
|
+
value: unknown,
|
|
30
|
+
definitions: Readonly<Record<string, unknown>>
|
|
31
|
+
): ReadonlyArray<string> => {
|
|
32
|
+
const schema = resolveReference(value, definitions)
|
|
33
|
+
if (schema === undefined || !isRecord(schema.properties)) return []
|
|
34
|
+
const tag = resolveReference(schema.properties._tag, definitions)
|
|
35
|
+
if (tag === undefined) return []
|
|
36
|
+
if (typeof tag.const === "string" || typeof tag.const === "number") return [String(tag.const)]
|
|
37
|
+
return Array.isArray(tag.enum)
|
|
38
|
+
? tag.enum.filter((item): item is string | number => typeof item === "string" || typeof item === "number").map(
|
|
39
|
+
String
|
|
40
|
+
)
|
|
41
|
+
: []
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const inputSchema = (schema: Schema.Top): Public.InputSchema => {
|
|
45
|
+
const document = Schema.toJsonSchemaDocument(schema)
|
|
46
|
+
return {
|
|
47
|
+
dialect: document.dialect,
|
|
48
|
+
schema: document.schema as Schema.Json,
|
|
49
|
+
definitions: document.definitions as Record<string, Schema.Json>
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const eventInputs = (machine: Machine.Machine.Any): ReadonlyArray<Public.EventInput> => {
|
|
54
|
+
const inputs: Array<Public.EventInput> = []
|
|
55
|
+
for (const eventSchema of inputEventSchemas(machine)) {
|
|
56
|
+
const document = inputSchema(eventSchema)
|
|
57
|
+
const root = document.schema
|
|
58
|
+
const record = isRecord(root) ? root : undefined
|
|
59
|
+
const variants = record !== undefined && Array.isArray(record.anyOf)
|
|
60
|
+
? record.anyOf
|
|
61
|
+
: record !== undefined && Array.isArray(record.oneOf)
|
|
62
|
+
? record.oneOf
|
|
63
|
+
: [root]
|
|
64
|
+
for (const variant of variants) {
|
|
65
|
+
for (const event of tagsOf(variant, document.definitions)) {
|
|
66
|
+
inputs.push({
|
|
67
|
+
event,
|
|
68
|
+
schema: { ...document, schema: variant as Schema.Json }
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return inputs
|
|
74
|
+
}
|
|
75
|
+
|
|
9
76
|
const selection = (value: Machine.Machine.TransitionTargetSelection): Public.Selection => ({
|
|
10
77
|
path: value.path ?? null,
|
|
11
78
|
kind: value.kind,
|
|
@@ -102,7 +169,7 @@ export const make = <M extends Machine.Machine.Any>(
|
|
|
102
169
|
|
|
103
170
|
const initial = Machine.initialDefinition(machine)
|
|
104
171
|
return {
|
|
105
|
-
schemaVersion:
|
|
172
|
+
schemaVersion: 2,
|
|
106
173
|
revision: options.revision ?? 0,
|
|
107
174
|
source: options.source ?? null,
|
|
108
175
|
machineId: machine.id ?? "Machine",
|
|
@@ -128,11 +195,17 @@ export const make = <M extends Machine.Machine.Any>(
|
|
|
128
195
|
})),
|
|
129
196
|
transitions,
|
|
130
197
|
activities,
|
|
198
|
+
inputs: {
|
|
199
|
+
machine: machine.input === undefined ? null : inputSchema(machine.input),
|
|
200
|
+
events: eventInputs(machine)
|
|
201
|
+
},
|
|
131
202
|
snapshot: options.snapshot === undefined
|
|
132
203
|
? null
|
|
133
204
|
: {
|
|
134
205
|
activePaths: Machine.configuration(machine, options.snapshot).map((node) => node.path),
|
|
135
|
-
candidateEvents: enabled(machine, options.snapshot)
|
|
206
|
+
candidateEvents: enabled(machine, options.snapshot)
|
|
207
|
+
.map(String)
|
|
208
|
+
.filter((event) => Object.hasOwn(machine.events, event))
|
|
136
209
|
}
|
|
137
210
|
}
|
|
138
211
|
}
|
|
@@ -28,15 +28,26 @@ const defaultExclude = [
|
|
|
28
28
|
] as const
|
|
29
29
|
|
|
30
30
|
interface EvaluationRequest {
|
|
31
|
+
readonly _tag: "InspectMachines"
|
|
31
32
|
readonly root: string
|
|
32
33
|
readonly revision: number
|
|
33
34
|
readonly candidates: ReadonlyArray<ProjectInspector.Candidate>
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
interface EvaluationResponse {
|
|
38
|
+
readonly _tag: "InspectedMachines"
|
|
37
39
|
readonly results: ReadonlyArray<unknown>
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
interface SimulationWorkerRequest {
|
|
43
|
+
readonly _tag: "Simulate"
|
|
44
|
+
readonly root: string
|
|
45
|
+
readonly request: DevToolsProtocol.SimulationRequest
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type WorkerRequest = EvaluationRequest | SimulationWorkerRequest
|
|
49
|
+
type WorkerResponse = EvaluationResponse | DevToolsProtocol.SimulationResult
|
|
50
|
+
|
|
40
51
|
const scriptKind = (file: string): ts.ScriptKind => {
|
|
41
52
|
if (file.endsWith(".tsx")) return ts.ScriptKind.TSX
|
|
42
53
|
if (file.endsWith(".jsx")) return ts.ScriptKind.JSX
|
|
@@ -169,6 +180,22 @@ const WorkerLayer = NodeWorker.layer(() =>
|
|
|
169
180
|
})
|
|
170
181
|
)
|
|
171
182
|
|
|
183
|
+
const runWorker = (
|
|
184
|
+
request: WorkerRequest
|
|
185
|
+
): Effect.Effect<WorkerResponse, unknown> =>
|
|
186
|
+
Effect.scoped(
|
|
187
|
+
Effect.gen(function*() {
|
|
188
|
+
const platform = yield* Worker.WorkerPlatform
|
|
189
|
+
const worker = yield* platform.spawn<WorkerResponse, WorkerRequest>(0)
|
|
190
|
+
const response = yield* Deferred.make<WorkerResponse>()
|
|
191
|
+
const runner = yield* Effect.forkScoped(
|
|
192
|
+
worker.run((message) => Deferred.succeed(response, message))
|
|
193
|
+
)
|
|
194
|
+
yield* worker.send(request)
|
|
195
|
+
return yield* Effect.raceFirst(Deferred.await(response), Fiber.join(runner))
|
|
196
|
+
})
|
|
197
|
+
).pipe(Effect.provide(WorkerLayer))
|
|
198
|
+
|
|
172
199
|
const evaluate = (
|
|
173
200
|
api: PublicApi,
|
|
174
201
|
candidates: ReadonlyArray<ProjectInspector.Candidate>,
|
|
@@ -177,28 +204,22 @@ const evaluate = (
|
|
|
177
204
|
if (candidates.length === 0) return Effect.succeed([])
|
|
178
205
|
|
|
179
206
|
const request: EvaluationRequest = {
|
|
207
|
+
_tag: "InspectMachines",
|
|
180
208
|
root: options.root,
|
|
181
209
|
revision: options.revision ?? 0,
|
|
182
210
|
candidates
|
|
183
211
|
}
|
|
184
212
|
|
|
185
|
-
return
|
|
186
|
-
Effect.
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
worker.run((message) => Deferred.succeed(response, message))
|
|
192
|
-
)
|
|
193
|
-
yield* worker.send(request)
|
|
194
|
-
const message = yield* Effect.raceFirst(Deferred.await(response), Fiber.join(runner))
|
|
195
|
-
return yield* Effect.forEach(
|
|
213
|
+
return runWorker(request).pipe(
|
|
214
|
+
Effect.flatMap((message) => {
|
|
215
|
+
if (message._tag !== "InspectedMachines") {
|
|
216
|
+
return Effect.fail(new Error(`Unexpected worker response: ${message._tag}`))
|
|
217
|
+
}
|
|
218
|
+
return Effect.forEach(
|
|
196
219
|
message.results,
|
|
197
220
|
(result) => Schema.decodeUnknownEffect(DevToolsProtocol.MachineResult)(result)
|
|
198
221
|
)
|
|
199
|
-
})
|
|
200
|
-
).pipe(
|
|
201
|
-
Effect.provide(WorkerLayer),
|
|
222
|
+
}),
|
|
202
223
|
Effect.mapError((cause) =>
|
|
203
224
|
new api.EvaluationError({
|
|
204
225
|
message: "The isolated machine evaluator failed",
|
|
@@ -208,6 +229,27 @@ const evaluate = (
|
|
|
208
229
|
)
|
|
209
230
|
}
|
|
210
231
|
|
|
232
|
+
const simulate = (
|
|
233
|
+
api: PublicApi,
|
|
234
|
+
request: DevToolsProtocol.SimulationRequest,
|
|
235
|
+
options: Pick<ProjectInspector.InspectOptions, "root">
|
|
236
|
+
): Effect.Effect<DevToolsProtocol.SimulationResult, ProjectInspector.EvaluationError> =>
|
|
237
|
+
runWorker({ _tag: "Simulate", root: options.root, request }).pipe(
|
|
238
|
+
Effect.timeout("10 seconds"),
|
|
239
|
+
Effect.flatMap((response) => {
|
|
240
|
+
if (response._tag === "InspectedMachines") {
|
|
241
|
+
return Effect.fail(new Error("The isolated planner returned an inspection response"))
|
|
242
|
+
}
|
|
243
|
+
return Schema.decodeUnknownEffect(DevToolsProtocol.SimulationResult)(response)
|
|
244
|
+
}),
|
|
245
|
+
Effect.mapError((cause) =>
|
|
246
|
+
new api.EvaluationError({
|
|
247
|
+
message: "The isolated machine planner failed",
|
|
248
|
+
cause
|
|
249
|
+
})
|
|
250
|
+
)
|
|
251
|
+
)
|
|
252
|
+
|
|
211
253
|
const make = (api: PublicApi) =>
|
|
212
254
|
Effect.gen(function*() {
|
|
213
255
|
const discover = yield* makeDiscovery(api)
|
|
@@ -216,7 +258,8 @@ const make = (api: PublicApi) =>
|
|
|
216
258
|
return api.ProjectInspector.of({
|
|
217
259
|
discover,
|
|
218
260
|
evaluate: (candidates, options) => evaluate(api, candidates, options),
|
|
219
|
-
inspect
|
|
261
|
+
inspect,
|
|
262
|
+
simulate: (request, options) => simulate(api, request, options)
|
|
220
263
|
})
|
|
221
264
|
})
|
|
222
265
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;color:#e8eaed;font-synthesis:none;text-rendering:optimizelegibility;--surface:#0f1114;--surface-raised:#14171b;--line:#292d34;--line-soft:#20242a;--muted:#8e949e;--accent:#75a7ff;--accent-bg:#4b7dff2e;--orange:#f0a35b;background:#0b0c0e;font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}*{box-sizing:border-box}html,body,#app{min-width:320px;min-height:100%;margin:0}body{background:#0b0c0e}.devtools-shell{grid-template-columns:220px minmax(0,1fr);min-height:100vh;display:grid}.machine-index{border-right:1px solid var(--line);background:#0d0f12;min-width:0;height:100vh;padding:8px 0;overflow:auto}.machine-row{color:#c9cdd2;text-align:left;cursor:pointer;-webkit-user-select:none;user-select:none;background:0 0;border:0;grid-template-columns:8px minmax(0,1fr);gap:3px 8px;width:100%;padding:10px 12px;display:grid}.machine-row:hover,.machine-row:focus-visible{color:#fff;background:#171a1f;outline:none}.machine-row.is-selected{color:#fff;background:#4b7dff2e}.machine-row-status{background:#646b75;border-radius:50%;grid-row:1;align-self:center;width:6px;height:6px}.machine-row-status.status-ready{background:#67c894}.machine-row-status.status-partial{background:var(--orange)}.machine-row-status.status-error{background:#df6964}.machine-row-label,.machine-row-file{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.machine-row-label{grid-column:2;font:600 12px/1.3 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.machine-row-file{color:#727983;grid-column:2;font:10px/1.3 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.machine-index-empty{color:#646b75;padding:12px;font:11px/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.machine-view{min-width:0}.registry-empty,.connection-failure{color:#7f8690;align-content:start;gap:7px;min-height:100vh;padding:28px;font:12px/1.6 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;display:grid}.registry-empty strong{color:#d4d7dc;font-size:13px}.connection-failure{color:#e4b4b1}button{font:inherit}.app-shell,.workspace{min-height:100vh}.workspace{grid-template-columns:minmax(420px,1fr) minmax(380px,46%);height:100vh;display:grid}.tree-panel{border-right:1px solid var(--line);flex-direction:column;min-width:0;height:100vh;display:flex;overflow:hidden}.diagnostics{border-bottom:1px solid var(--line);background:#121418}.diagnostic{color:#aeb4bd;flex-wrap:wrap;align-items:center;gap:8px;min-height:36px;padding:8px 16px;font-size:11px;display:flex}.diagnostic+.diagnostic{border-top:1px solid var(--line-soft)}.badge-warning{color:#e9c89f;background:#f0a35b21}.badge-error{color:#f2aaa7;background:#e0595424}.toolbar{border-bottom:1px solid var(--line);justify-content:space-between;align-items:center;gap:2px;min-height:46px;padding:7px 16px;display:flex}.toolbar-actions,.runtime-summary{align-items:center;display:flex}.toolbar-actions{gap:2px}.runtime-summary{color:#7f8690;gap:7px;font:11px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.runtime-dot{background:#555c65;border-radius:50%;width:6px;height:6px}.runtime-dot.has-snapshot{background:var(--accent)}.toolbar-button{color:var(--muted);cursor:pointer;background:0 0;border:0;border-radius:4px;padding:6px 9px;font-size:12px}.toolbar-button:not(:disabled):hover,.toolbar-button:not(:disabled):focus-visible{color:#fff;background:#1b1e23;outline:none}.toolbar-button:disabled{color:#50545c;cursor:default}.topology-tree{flex:1;min-height:0;padding:23px 18px 34px;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;overflow:auto}.machine-id{color:#fff;margin:0 8px 16px;font-weight:700}.enabled-events{border-bottom:1px solid var(--line-soft);flex-wrap:wrap;align-items:center;gap:6px;min-height:32px;margin:0 8px 14px;padding-bottom:13px;display:flex}.enabled-events-label,.enabled-events-empty{color:#6f7680;font-size:10px}.enabled-events-label{text-transform:uppercase;margin-right:3px}.simulation-feedback{color:#7f99c4;margin:-5px 8px 14px;font:10px/1.5 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.simulation-feedback[data-status=indeterminate]{color:#d9ae7e}.simulation-feedback[data-status=blocked]{color:#d58d89}.enabled-events[hidden],.simulation-feedback[hidden]{display:none}.event-button{color:#aeb5bf;cursor:pointer;background:#1b1f25;border:0;border-radius:3px;padding:4px 7px;font:11px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.event-button:hover,.event-button:focus-visible,.event-button.is-selected{color:#d9e6ff;background:#4b7dff38;outline:none}.topology-node{background:0 0}.topology-empty{color:#7f8690;gap:7px;max-width:420px;margin:26px 8px;font:12px/1.6 Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;display:grid}.topology-empty strong{color:#d4d7dc;font:600 13px/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.topology-node.is-selected{background:var(--accent-bg)}.state-row{width:100%;min-height:38px;padding:6px 8px 6px calc(8px + var(--depth) * 22px);color:#d7d9dc;text-align:left;cursor:pointer;-webkit-user-select:none;user-select:none;background:0 0;border:0;grid-template-columns:14px 10px minmax(90px,auto) 1fr;align-items:center;gap:8px;display:grid}.state-row:hover,.state-row:focus-visible{color:#fff;background:#1b1e23;outline:none}.state-row[aria-selected=true],.topology-node.is-selected>.state-row{color:#fff}.topology-node.is-related-target>.state-row{background:#4b7dff17}.topology-node.is-related-source>.state-row{background:#ac68e014}.topology-node.is-related-update>.state-row{background:#f0a35b14}.state-disclosure{color:#737a84;font-size:11px}.state-status{border:1px solid #686f78;border-radius:50%;width:7px;height:7px}.state-status.is-active{border-color:var(--accent);background:var(--accent);box-shadow:0 0 0 3px #75a7ff1a}.state-label{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.state-markers,.inspector-eyebrow,.card-title,.card-flags,.branch-main{align-items:center;gap:6px;display:flex}.state-markers{justify-self:end}.badge{color:#a8afb8;letter-spacing:.02em;white-space:nowrap;background:#20242a;border-radius:3px;align-items:center;min-height:18px;padding:2px 6px;font:600 10px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;display:inline-flex}.badge-active{color:#b9d2ff;background:#4b7dff38}.badge-initial{color:#e9c89f;background:#f0a35b21}.badge-trigger{color:#b9d2ff;background:#4b7dff29}.badge-condition{color:#d9b8ef;background:#ac68e026}.badge-activity{color:#a8ddc4;background:#4eb58324}.badge-count{color:#858c96;background:0 0}.inspector{background:var(--surface);min-width:0;height:100vh;padding:28px;overflow:auto}.failure-shell{color:#d6d8dc;background:#0b0c0e;align-content:start;gap:12px;min-height:100vh;padding:32px;display:grid}.failure-kind{color:#f2aaa7;letter-spacing:.08em;text-transform:uppercase;font:600 10px/1.2 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.failure-shell h1{margin:0;font:600 18px/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.failure-shell pre{color:#e4b4b1;white-space:pre-wrap;background:#151112;border-left:2px solid #a54743;max-width:900px;margin:4px 0 0;padding:14px 16px;font:12px/1.6 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;overflow:auto}.failure-shell p{color:#7f8690;margin:0;font-size:12px}.inspector-empty{max-width:420px;color:var(--muted)}.inspector-empty-kind{color:var(--orange);letter-spacing:.08em;text-transform:uppercase;font:600 10px/1.2 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.inspector-empty h2,.inspector-header h2{color:#f1f2f4;overflow-wrap:anywhere;margin:9px 0 0;font:600 18px/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.inspector-empty p,.section-empty,.empty-inline{color:var(--muted);font-size:12px;line-height:1.6}.inspector-header{border-bottom:1px solid var(--line);padding-bottom:24px}.state-annotations{margin-top:18px}.state-annotations p{color:#aeb4bd;margin:7px 0 0;font-size:12px;line-height:1.6}.state-annotations .state-documentation{color:#7f8690;white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.breadcrumbs{flex-wrap:wrap;align-items:center;gap:5px;min-width:0;margin-bottom:16px;display:flex}.breadcrumb-separator{color:#555c65}.state-link{color:#9bbfff;overflow-wrap:anywhere;text-align:left;cursor:pointer;background:0 0;border:0;max-width:100%;padding:0;font:11px/1.5 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.state-link:hover,.state-link:focus-visible{color:#d5e4ff;outline:none;text-decoration:underline}.metadata{grid-template-columns:minmax(74px,auto) minmax(0,1fr);gap:8px 16px;margin:20px 0 0;font-size:11px;display:grid}.metadata dt{color:#727983}.metadata dd{color:#d2d5da;overflow-wrap:anywhere;min-width:0;margin:0;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.inspector-section{margin-top:28px}.section-heading{justify-content:space-between;align-items:center;margin-bottom:11px;display:flex}.section-heading h3{color:#c9cdd2;margin:0;font-size:12px;font-weight:650}.section-count{color:#737a84;font:11px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.inspection-card{border:1px solid var(--line-soft);background:var(--surface-raised);margin-top:8px}.card-header{justify-content:space-between;align-items:center;gap:12px;min-height:42px;padding:10px 12px;display:flex}.transition-source{color:#727983;align-items:baseline;gap:12px;padding:0 12px 10px;font-size:11px;display:flex}.card-title{min-width:0}.card-title strong{color:#e2e4e7;overflow-wrap:anywhere;font:600 12px/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.branch-list{border-top:1px solid var(--line-soft)}.branch-row{padding:11px 12px 13px}.branch-row+.branch-row{border-top:1px solid var(--line-soft)}.branch-main{min-width:0}.branch-arrow{color:var(--accent)}.branch-target{color:#d7d9dc;overflow-wrap:anywhere;font:11px/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.branch-row .metadata,.activity-card .metadata,.incoming-card .metadata{margin-top:10px}.incoming-card{padding-bottom:12px}.incoming-card .metadata{padding:0 12px}.branch-updates{grid-template-columns:minmax(74px,auto) minmax(0,1fr);gap:8px 16px;margin-top:9px;font-size:11px;display:grid}.branch-updates-label{color:#727983}.branch-updates .state-link+.state-link{grid-column:2}.activity-card{padding-bottom:12px}.activity-card .metadata{padding:0 12px}@media (width<=900px){.devtools-shell{grid-template-columns:1fr}.machine-index{border-right:0;border-bottom:1px solid var(--line);height:auto;min-height:54px;padding:0;display:flex;overflow-x:auto}.machine-row{flex:none;width:min(220px,70vw)}.workspace{grid-template-columns:1fr;height:auto}.tree-panel{border-right:0;border-bottom:1px solid var(--line);height:58vh;min-height:58vh}.inspector{height:auto;min-height:42vh}}@media (width<=600px){.toolbar{align-items:flex-start;padding-inline:10px}.toolbar-actions{flex-wrap:wrap;justify-content:flex-end}.runtime-summary{padding-top:8px}.topology-tree,.inspector{padding-inline:14px}.state-markers .badge-count{display:none}}@media (prefers-reduced-motion:no-preference){.state-row,.toolbar-button{transition:color .12s,background-color .12s}}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=(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 n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},t={pipe(){return e(this,arguments)}},n=function(){function e(){}return e.prototype=t,e}(),r=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},i=e=>e,a=e=>()=>e,o=a(!1),s=a(void 0),c=s;function l(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i}}function u(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),t.set(i,i),i}}var d=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(`stack`);let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let e=Reflect.ownKeys(r);for(let n=0;n<e.length;n++)t.add(e[n]);r=Object.getPrototypeOf(r)}return t.has(`constructor`)&&typeof e.constructor==`function`&&n===e.constructor.prototype&&t.delete(`constructor`),t},f=new WeakSet;function p(e){return typeof e==`string`}function m(e){return typeof e==`number`}function h(e){return typeof e==`boolean`}function g(e){return typeof e==`function`}function _(e){return e!==void 0}function v(e){return e!=null}function ee(e){return!0}function y(e){return typeof e==`object`&&!!e||g(e)}var b=r(2,(e,t)=>y(e)&&t in e),x=`~effect/interfaces/Hash`,S=e=>{switch(typeof e){case`number`:return ie(e);case`bigint`:return w(e.toString(10));case`boolean`:return w(String(e));case`symbol`:return w(String(e));case`string`:return w(e);case`undefined`:return w(`undefined`);case`function`:case`object`:if(e===null)return w(`null`);if(e instanceof Date)return Number.isNaN(e.getTime())?w(`Invalid Date`):w(e.toISOString());if(e instanceof RegExp)return w(e.toString());{if(f.has(e))return te(e);if(fe.has(e))return fe.get(e);let t=me(e,()=>re(e)?e[x]():typeof e==`function`?te(e):e instanceof DataView?ce(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):Array.isArray(e)||ArrayBuffer.isView(e)?ce(e):e instanceof Map?le(e):e instanceof Set?ue(e):oe(e));return fe.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},te=e=>(de.has(e)||de.set(e,ie(Math.floor(Math.random()*(2**53-1)))),de.get(e)),C=r(2,(e,t)=>e*53^t),ne=e=>e&3221225471|e>>>1&1073741824,re=e=>b(e,x),ie=e=>{if(e!==e)return w(`NaN`);if(e===1/0)return w(`Infinity`);if(e===-1/0)return w(`-Infinity`);let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return ne(t)},w=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return ne(t)},ae=(e,t)=>{let n=12289;for(let r of t)n^=C(S(r),S(e[r]));return ne(n)},oe=e=>ae(e,d(e)),se=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return ne(r)},ce=se(6151,S),le=se(w(`Map`),([e,t])=>C(S(e),S(t))),ue=se(w(`Set`),S),de=new WeakMap,fe=new WeakMap,pe=new WeakSet;function me(e,t){if(pe.has(e))return w(`[Circular]`);pe.add(e);let n=t();return pe.delete(e),n}var T=`~effect/interfaces/Equal`;function E(){return arguments.length===1?e=>D(e,arguments[0]):D(arguments[0],arguments[1])}function D(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n===typeof t?n===`number`&&e!==e&&t!==t?!0:n!==`object`&&n!==`function`||f.has(e)||f.has(t)?!1:ve(e,t,_e):!1}function he(e,t,n){let r=O.has(e),i=ge.has(t);if(r&&i)return!0;if(r||i)return!1;O.add(e),ge.add(t);let a=n();return O.delete(e),ge.delete(t),a}var O=new WeakSet,ge=new WeakSet;function _e(e,t){if(S(e)!==S(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),r=t.getTime();return n===r||Number.isNaN(n)&&Number.isNaN(r)}else if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let n=De(e),r=De(t);if(n!==r)return!1;let i=n&&r;return typeof e==`function`&&!i?!1:he(e,t,()=>{if(i)return e[T](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:be(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;if(!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView)return!1;if(n){let n=t;return xe(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(n.buffer,n.byteOffset,n.byteLength))}return xe(e,t)}else if(e instanceof Map)return!(t instanceof Map)||e.size!==t.size?!1:we(e,t);else if(e instanceof Set)return!(t instanceof Set)||e.size!==t.size?!1:Ee(e,t);return Se(e,t)})}function ve(e,t,n){let r=ye.get(e);if(!r)r=new WeakMap,ye.set(e,r);else if(r.has(t))return r.get(t);let i=n(e,t);r.set(t,i);let a=ye.get(t);return a||(a=new WeakMap,ye.set(t,a)),a.set(e,i),i}var ye=new WeakMap;function be(e,t){for(let n=0;n<e.length;n++)if(!D(e[n],t[n]))return!1;return!0}function xe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Se(e,t){let n=d(e),r=d(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!D(e[i],t[i]))return!1;return!0}function Ce(e,t){return function(n,r){let i=Array.from(r);for(let[r,a]of n){let n=!1;for(let o=0;o<i.length;o++){let[s,c]=i[o];if(e(r,s)&&t(a,c)){i[o]=i[i.length-1],i.pop(),n=!0;break}}if(!n)return!1}return!0}}var we=Ce(D,D);function Te(e){return function(t,n){let r=Array.from(n);for(let n of t){let t=!1;for(let i=0;i<r.length;i++){let a=r[i];if(e(n,a)){r[i]=r[r.length-1],r.pop(),t=!0;break}}if(!t)return!1}return!0}}var Ee=Te(D),De=e=>b(e,T),Oe=Symbol.for(`~effect/Redactable`),ke=e=>b(e,Oe);function Ae(e){return ke(e)?je(e):e}function je(e){return e[Oe](globalThis[`~effect/Fiber/currentFiber`]?.context??Pe)}var Me=`~effect/Fiber/currentFiber`,Ne=new Map,Pe={"~effect/Context":{},base:Ne,depth:0,mapUnsafe:Ne,pipe(){return e(this,arguments)}};function k(e,t){let n=t?.space??0,r=new WeakSet,i=n?typeof n==`number`?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,n=0){if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||e==null||typeof e==`boolean`||typeof e==`symbol`)return String(e);if(typeof e==`bigint`)return String(e)+`n`;if(typeof e==`object`||typeof e==`function`){if(r.has(e))return Fe;r.add(e);let l;if(Oe in e)l=c(je(e),n);else if(Array.isArray(e))l=!i||e.length<=1?`[${e.map(e=>c(e,n)).join(`,`)}]`:`[\n${a(n+1)}${e.map(e=>c(e,n+1)).join(`,
|
|
2
|
-
`+a(n+1))}\n${a(n)}]`;else if(e instanceof Date)l=Re(e);else if(!t?.ignoreToString&&b(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=ze(e);l=e instanceof Error&&e.cause?`${t} (cause: ${c(e.cause,n)})`:t}else if(Symbol.iterator in e)l=`${e.constructor.name}(${c(Array.from(e),n)})`;else{let t=s(e);if(!i||t.length<=1){let r=`{${t.map(t=>`${Ie(t)}:${c(e[t],n)}`).join(`,`)}}`;l=o(e,r)}else{let r=`{\n${t.map(t=>`${a(n+1)}${Ie(t)}: ${c(e[t],n+1)}`).join(`,
|
|
3
|
-
`)}\n${a(n)}}`;l=o(e,r)}}return r.delete(e),l}return String(e)}return c(e,0)}var Fe=`[Circular]`;function Ie(e){return typeof e==`string`?JSON.stringify(e):String(e)}function Le(e){return e.map(e=>`[${Ie(e)}]`).join(``)}function Re(e){try{return e.toISOString()}catch{return`Invalid Date`}}function ze(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function Be(e,t){let n=[];return JSON.stringify(e,function(e,t){let r=Object.getOwnPropertyDescriptor(this,e)?.value,i=b(r,Oe)?Ae(r):Ae(t);if(typeof i==`bigint`)return k(i);if(typeof i!=`object`||!i)return i;for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(!n.includes(i))return n.push(i),i},t?.space)??`null`}var Ve=Symbol.for(`nodejs.util.inspect.custom`),He=e=>{try{return e=Ae(e),b(e,`toJSON`)&&g(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(He):e}catch{return`[toJSON threw]`}},Ue=(e,t=2)=>{if(typeof e==`string`)return e;try{return typeof e==`object`?Be(e,{space:t}):k(e,{space:t})}catch{return String(e)}},We=class e{called=!1;self;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new e(this.self)}},Ge=(()=>{let e=`~effect/Utils/internal`,t={[e]:e=>e()},n={[e]:e=>{try{return e()}finally{}}};return t[e](()=>Error().stack)?.includes(e)===!0?t[e]:n[e]})();function Ke(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function qe(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&Ke(e,n,t[n])}var Je=`~effect/Effect`,Ye=`~effect/Exit`,Xe={_A:i,_E:i,_R:i},Ze=`${Je}/identifier`,A=`${Je}/args`,j=`${Je}/evaluate`,M=`${Je}/successCont`,N=`${Je}/failureCont`,Qe=`${Je}/ensureCont`,$e=Symbol.for(`effect/Effect/Yield`),et={pipe(){return e(this,arguments)},toJSON(){return{...this}},toString(){return k(this.toJSON(),{ignoreToString:!0,space:2})},[Ve](){return this.toJSON()}},tt={[Je]:Xe,...et,[Symbol.iterator](){return new We(this)},toJSON(){return{_id:`Effect`,op:this[Ze],...A in this?{args:this[A]}:void 0}}},nt=e=>b(e,Je),rt=e=>b(e,Ye),it=`~effect/Cause`,at=`~effect/Cause/Reason`,ot=e=>b(e,it),st=class{[it];reasons;constructor(e){this[it]=it,this.reasons=e}pipe(){return e(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${k(this.reasons)})`}[Ve](){return this.toJSON()}[T](e){return ot(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>E(t,e.reasons[n]))}[x](){return ce(this.reasons)}},ct=new WeakMap,lt=class{[at];annotations;_tag;constructor(e,t,n){if(this[at]=at,this._tag=e,t!==ut&&typeof n==`object`&&n&&t.size>0){let e=ct.get(n);e&&(t=new Map([...e,...t])),ct.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((e,r)=>{t?.overwrite!==!0&&n.has(r)||n.set(r,e)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return e(this,arguments)}toString(){return k(this)}[Ve](){return this.toString()}},ut=new Map,dt=class extends lt{error;constructor(e,t=ut){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${k(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[T](e){return vt(e)&&E(this.error,e.error)&&E(this.annotations,e.annotations)}[x](){return C(w(this._tag))(C(S(this.error))(S(this.annotations)))}},ft=e=>new st(e),pt=new st([]),mt=e=>new st([new dt(e)]),ht=class extends lt{defect;constructor(e,t=ut){super(`Die`,t,e),this.defect=e}toString(){return`Die(${k(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[T](e){return yt(e)&&E(this.defect,e.defect)&&E(this.annotations,e.annotations)}[x](){return C(w(this._tag))(C(S(this.defect))(S(this.annotations)))}},gt=e=>new st([new ht(e)]),_t=r(e=>ot(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new st(e.reasons.map(e=>e.annotate(t,n)))),vt=e=>e._tag===`Fail`,yt=e=>e._tag===`Die`,bt=e=>e._tag===`Interrupt`;function xt(e){return At(`Effect.evaluate: Not implemented`)}var St=e=>({...tt,[Ze]:e.op,[j]:e[j]??xt,[M]:e[M],[N]:e[N],[Qe]:e[Qe]}),Ct=e=>{let t=St(e);return function(){let n=Object.create(t);return n[A]=e.single===!1?arguments:arguments[0],n}},wt=e=>{let t={[Ye]:Ye,_tag:e.op,get[e.prop](){return this[A]},...St(e),toString(){return`${e.op}(${k(this[A])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[A]}},[T](e){return rt(e)&&e._tag===this._tag&&E(this[A],e[A])},[x](){return C(w(e.op),S(this[A]))}};return function(e){let n=Object.create(t);return n[A]=e,n}},Tt=wt({op:`Success`,prop:`value`,[j](e){let t=e.getCont(M);return t?t[M](this[A],e,this):e.yieldWith(this)}}),Et={key:`effect/Cause/StackTrace`},Dt={key:`effect/Cause/InterruptorStackTrace`},Ot=wt({op:`Failure`,prop:`cause`,[j](e){let t=this[A],n=!1;e.currentStackFrame&&(t=_t(t,{mapUnsafe:new Map([[Et.key,e.currentStackFrame]])}),n=!0);let r=e.getCont(N);for(;e.interruptible&&e._interruptedCause&&r;)r=e.getCont(N);return r?r[N](t,e,n?void 0:this):e.yieldWith(n?Ot(t):this)}}),kt=e=>Ot(mt(e)),At=e=>Ot(gt(e)),jt=Ct({op:`WithFiber`,[j](e){return this[A](e)}}),Mt=function(){class e extends globalThis.Error{}let t=St({op:`YieldableError`,[j](){return kt(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),Nt=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends Mt{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(qe(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),Pt=e=>{class t extends Nt{_tag=e}return t.prototype.name=e,t};Pt(`NoSuchElementError`);var Ft=e=>St({op:e.label,[j]:e.evaluate}),It=e=>(t,n)=>t===n||e(t,n),Lt=`~effect/data/Option`,Rt={[Lt]:{_A:e=>e},...et,[Symbol.iterator](){return new We(this)}},zt=Object.defineProperty(Object.assign(Object.create(Rt),{_tag:`Some`,_op:`Some`,[T](e){return Ht(e)&&Wt(e)&&E(this.value,e.value)},[x](){return C(S(this._tag))(S(this.value))},toString(){return`some(${k(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:He(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),Bt=S(`None`),Vt=Object.assign(Object.create(Rt),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[T](e){return Ht(e)&&Ut(e)},[x](){return Bt},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),Ht=e=>b(e,Lt),Ut=e=>e._tag===`None`,Wt=e=>e._tag===`Some`,Gt=Object.create(Vt),Kt=e=>{let t=Object.create(zt);return t.value=e,t},qt=`~effect/data/Result`;({...et});function Jt(e){return(t,n)=>t===n?0:e(t,n)}var Yt=Jt((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),Xt=r(2,(e,t)=>Jt((n,r)=>e(t(n),t(r)))),Zt=e=>r(2,(t,n)=>e(t,n)===1),Qt=e=>r(2,(t,n)=>e(t,n)!==-1),$t=()=>Gt,en=Kt,tn=Ut,nn=Wt,rn=r(2,(e,t)=>tn(e)?$t():en(t(e.value))),an=r(2,(e,t)=>tn(e)?$t():t(e.value)?en(e.value):$t()),on=`~effect/Context/Service`,sn=function(){function e(){}let t=e;Object.setPrototypeOf(t,cn);let n=(e,n)=>(t.key=e,n?.defaultValue&&(t[un]=un,t.defaultValue=n.defaultValue),n?.make&&(t.make=n.make),n?.fiberCached&&ln.add(e),t);return arguments.length>0?n(arguments[0],arguments[1]):n},cn={[on]:on,...Ft({label:`Service`,evaluate(e){return Tt(jn(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key}},of(e){return e},context(e){return Dn(this,e)},use(e){return jt(t=>e(jn(t.context,this)))},useSync(e){return jt(t=>Tt(e(jn(t.context,this))))}},ln=new Set,un=`~effect/Context/Reference`,dn=`~effect/Context`,fn=8,pn=8,mn=(e,t,n,r)=>{let i=Object.create(xn);return i.cacheRoot=e??i,i.base=t,i.overlay=n,i.depth=r,i._flat=void 0,i.baseHits=0,i},hn=(e,t)=>{t&&(hn(e,t.parent),e.set(t.key,t.value))},gn=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return hn(t,e.overlay),e._flat=t},_n=(e,t)=>{let n=new Map(e.mapUnsafe);return t(n),bn(n)},vn=Symbol(),yn=(e,t)=>{let n=e;for(let e=n.overlay;e;e=e.parent)if(e.key===t)return e.value;let r=n.base.get(t);return r===void 0&&!n.base.has(t)?vn:(n.overlay&&++n.baseHits>=pn&&(n.base=gn(n),n.overlay=void 0,n.depth=0),r)},bn=e=>mn(void 0,e,void 0,0),xn={get mapUnsafe(){return gn(this)},...et,[dn]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[T](e){if(!Cn(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[e,r]of t)if(!n.has(e)||!E(r,n.get(e)))return!1;return!0},[x](){return ie(this.mapUnsafe.size)}},Sn=(e,t)=>e.cacheRoot===t.cacheRoot,Cn=e=>b(e,dn),wn=e=>!!e[un],Tn=()=>En,En=bn(new Map),Dn=(e,t)=>bn(new Map([[e.key,t]])),On=r(3,(e,t,n)=>kn(e,t.key,n)),kn=(e,t,n)=>{let r=e,i=ln.has(t)?void 0:r.cacheRoot;if(r.depth>=fn){let e=new Map(r.mapUnsafe);return e.set(t,n),mn(i,e,void 0,0)}return mn(i,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)},An=(e,t)=>{let n=yn(e,t);return n===vn?void 0:n},jn=r(2,(e,t)=>{let n=yn(e,t.key);if(n===vn){if(wn(t))return Nn(t);throw Pn(t)}return n}),Mn=`~effect/Context/defaultValue`,Nn=e=>Mn in e?e[Mn]:e[Mn]=e.defaultValue(),Pn=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(t.stack){let e=t.stack.split(`
|
|
4
|
-
`);e.splice(1,3),t.stack=e.join(`
|
|
5
|
-
`)}return t},Fn=r(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:_n(e,e=>t.mapUnsafe.forEach((t,n)=>e.set(n,t)))),P=sn,In=e=>e.length>0,Ln=globalThis.Array,Rn=e=>Ln.isArray(e)?e:Ln.from(e),zn=r(2,(e,t)=>[...e,t]),Bn=r(2,(e,t)=>Rn(e).concat(Rn(t)));Ln.isArray;var Vn=In,Hn=In,Un=(e,t)=>{let n=S(t),r=e.get(n);if(r===void 0)return e.set(n,[t]),!0;for(let e of r)if(E(e,t))return!1;return r.push(t),!0},Wn=r(2,(e,t)=>{let n=Rn(e),r=Rn(t);return Hn(n)?Hn(r)?qn(Bn(n,r)):n:r}),Gn=()=>[],Kn=r(2,(e,t)=>e.map(t)),qn=e=>{let t=Rn(e);if(t.length<2)return[...t];let n=new Map,r=[];for(let e of t)Un(n,e)&&r.push(e);return r},Jn=`~effect/time/Duration`,Yn=BigInt(0),Xn=BigInt(1),Zn=BigInt(2),Qn=BigInt(10),$n=BigInt(1e3),er=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),tr=e=>er(e*1e6),nr=(e,t)=>{let n=e.indexOf(`.`);if(n===-1)return BigInt(e)*t;let r=e[0]===`-`,i=e.slice(n+1),a=Qn**BigInt(i.length),o=(BigInt(e.slice(+!!r,n))*a+BigInt(i))*t,s=o/a+(o%a*Zn>=a?Xn:Yn);return r?-s:s},rr=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,ir=e=>{switch(typeof e){case`number`:return hr(e);case`bigint`:return mr(e);case`string`:{if(e===`Infinity`)return fr;if(e===`-Infinity`)return pr;let t=rr.exec(e);if(!t)break;let[n,r,i]=t;if(i===`nano`||i===`nanos`)return mr(nr(r,Xn));if(i===`micro`||i===`micros`)return mr(nr(r,$n));let a=Number(r);switch(i){case`milli`:case`millis`:return hr(a);case`second`:case`seconds`:return gr(a);case`minute`:case`minutes`:return _r(a);case`hour`:case`hours`:return vr(a);case`day`:case`days`:return yr(a);case`week`:case`weeks`:return br(a)}break}case`object`:{if(e===null)break;if(Jn in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(m)?ar(e):Number.isNaN(e[0])||Number.isNaN(e[1])?dr:e[0]===-1/0||e[1]===-1/0?pr:e[0]===1/0||e[1]===1/0?fr:F(er(e[0]*1e9+e[1]));let t=e,n=0;return t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds?F(n):F(er(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return ar(e)},ar=e=>{throw Error(`Invalid Input: ${e}`)},or={_tag:`Millis`,millis:0},sr={_tag:`Infinity`},cr={_tag:`NegativeInfinity`},lr={[Jn]:Jn,[x](){switch(this.value._tag){case`Millis`:{let e=this.value.millis*1e6;return Number.isFinite(e)?S(er(e)):ie(this.value.millis)}case`Nanos`:return S(this.value.nanos);default:return oe(this.value)}},[T](e){return ur(e)&&Er(this,e)},toString(){switch(this.value._tag){case`Infinity`:return`Infinity`;case`NegativeInfinity`:return`-Infinity`;case`Nanos`:return`${this.value.nanos} nanos`;case`Millis`:return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case`Millis`:return{_id:`Duration`,_tag:`Millis`,millis:this.value.millis};case`Nanos`:return{_id:`Duration`,_tag:`Nanos`,nanos:String(this.value.nanos)};case`Infinity`:return{_id:`Duration`,_tag:`Infinity`};case`NegativeInfinity`:return{_id:`Duration`,_tag:`NegativeInfinity`}}},[Ve](){return this.toJSON()},pipe(){return e(this,arguments)}},F=e=>{let t=Object.create(lr);return typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?t.value=or:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:`Millis`,millis:e}:t.value={_tag:`Nanos`,nanos:tr(e)}:t.value=e>0?sr:cr:e===Yn?t.value=or:t.value={_tag:`Nanos`,nanos:e},t},ur=e=>b(e,Jn),dr=F(0),fr=F(1/0),pr=F(-1/0),mr=e=>F(e),hr=e=>F(e),gr=e=>F(e*1e3),_r=e=>F(e*6e4),vr=e=>F(e*36e5),yr=e=>F(e*864e5),br=e=>F(e*6048e5),xr=e=>Cr(ir(e),{onMillis:i,onNanos:e=>Number(e)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Sr=e=>{let t=ir(e);switch(t.value._tag){case`Infinity`:case`NegativeInfinity`:throw Error(`Cannot convert infinite duration to nanos`);case`Nanos`:return t.value.nanos;case`Millis`:return tr(t.value.millis)}},Cr=r(2,(e,t)=>{switch(e.value._tag){case`Millis`:return t.onMillis(e.value.millis);case`Nanos`:return t.onNanos(e.value.nanos);case`Infinity`:return t.onInfinity();case`NegativeInfinity`:return(t.onNegativeInfinity??t.onInfinity)()}}),wr=r(3,(e,t,n)=>e.value._tag===`Infinity`||e.value._tag===`NegativeInfinity`||t.value._tag===`Infinity`||t.value._tag===`NegativeInfinity`?n.onInfinity(e,t):e.value._tag===`Millis`?t.value._tag===`Millis`?n.onMillis(e.value.millis,t.value.millis):n.onNanos(Sr(e),t.value.nanos):n.onNanos(e.value.nanos,Sr(t))),Tr=(e,t)=>wr(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t,onInfinity:(e,t)=>e.value._tag===t.value._tag}),Er=r(2,(e,t)=>Tr(e,t)),Dr=P(`effect/Scheduler`,{fiberCached:!0,defaultValue:()=>new jr}),Or=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},kr=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},Ar=class{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,i,a=0;for(;a<r&&!(n[a][0]>t);a++)i=n[a];i&&i[0]===t?i[1].push(e):a===r?n.push([t,[e]]):n.splice(a,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}},jr=class{executionMode;setImmediate;constructor(e=`async`,t){this.executionMode=e,this.setImmediate=t??(e===`sync`?kr:Or)}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new Mr(this.setImmediate)}},Mr=class{tasks=new Ar;running=void 0;setImmediate;constructor(e=Or){this.setImmediate=e}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let e=0;e<n.length;e++)n[e]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},Nr=P(`effect/Scheduler/MaxOpsBeforeYield`,{fiberCached:!0,defaultValue:()=>2048}),Pr=P(`effect/Scheduler/PreventSchedulerYield`,{fiberCached:!0,defaultValue:()=>!1}),Fr=Pt;Fr(`EncodingError`);var Ir=[];for(let e=0;e<256;e++)Ir.push(e.toString(16).padStart(2,`0`));var Lr=`effect/Tracer/ParentSpan`;sn()(Lr,{fiberCached:!0});var Rr=`effect/Tracer`,zr=`effect/observability/Metric/FiberRuntimeMetricsKey`,Br=P(`effect/References/CurrentStackFrame`,{fiberCached:!0,defaultValue:s}),Vr=P(`effect/References/CurrentLogAnnotations`,{defaultValue:()=>({})}),Hr=P(`effect/References/CurrentLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),Ur=P(`effect/References/MinimumLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),Wr=P(`effect/References/CurrentLogSpans`,{defaultValue:()=>[]}),Gr=(()=>{let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,`writable`)?e.writable===!0:e.set!==void 0})(),Kr=()=>Error.stackTraceLimit,qr=e=>{Gr&&(Error.stackTraceLimit=e)},Jr=class extends lt{fiberId;constructor(e,t=ut){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[T](e){return bt(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[x](){return C(w(`${this._tag}:${this.fiberId}`))(te(this.annotations))}},Yr=e=>new st([new Jr(e)]),Xr=e=>e.reasons.some(bt),Zr=e=>e.reasons.length>0&&e.reasons.every(bt),Qr=r(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new st(Wn(e.reasons,t.reasons));return E(e,n)?e:n}),$r=r(2,(e,t)=>{let n=!1,r=e.reasons.map(e=>vt(e)?(n=!0,new dt(t(e.error),e.annotations)):e);return n?ft(r):e}),ei=e=>{let t={Fail:[],Die:[],Interrupt:[]};for(let n=0;n<e.reasons.length;n++)t[e.reasons[n]._tag].push(e.reasons[n]);return t},ti=e=>{let t=ei(e);return t.Fail.length>0?t.Fail[0].error:t.Die.length>0?t.Die[0].defect:t.Interrupt.length>0?new globalThis.Error(`All fibers interrupted without error`):new globalThis.Error(`Empty cause`)},ni=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let i=Kr();qr(1);for(let i of e.reasons){if(i._tag===`Interrupt`){r.push(i);continue}n.push(ri(i._tag===`Die`?i.defect:i.error,i.annotations,t))}if(n.length===0){let e=Error(`The fiber was interrupted by:`);e.name=`InterruptCause`,e.stack=ci(e,r);let i=new globalThis.Error(`All fibers interrupted without error`,{cause:e});i.name=`InterruptError`,i.stack=`${i.name}: ${i.message}`,n.push(ri(i,r[0].annotations,t))}return qr(i),n},ri=(e,t,n)=>{let r=typeof e,i;if(e&&r===`object`){if(i=new globalThis.Error(ii(e),{cause:e.cause?ri(e.cause):void 0}),typeof e.name==`string`&&(i.name=e.name),typeof e.stack==`string`)i.stack=oi(e.stack,i,t);else{let e=`${i.name}: ${i.message}`;i.stack=t?si(e,t):e}n?.includeCauseInStack&&(i.stack=di(i));for(let t of Object.keys(e))t in i||(i[t]=e[t])}else i=new globalThis.Error(e?r===`string`?e:Be(e):`Unknown error: ${e}`);return i},ii=e=>{if(typeof e.message==`string`)return e.message;if(typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return Be(e)},ai=/\((.*)\)/g,oi=(e,t,n)=>{let r=`${t.name}: ${t.message}`,i=(e.startsWith(r)?e.slice(r.length):e).split(`
|
|
6
|
-
`),a=[r];for(let e=1;e<i.length&&!/(?:Generator\.next|~effect\/Effect)/.test(i[e]);e++)a.push(i[e]);return n?si(a.join(`
|
|
7
|
-
`),n):a.join(`
|
|
8
|
-
`)},si=(e,t)=>{let n=t?.get(Et.key);return n&&(e=`${e}\n${li(n)}`),e},ci=(e,t)=>{let n=[`${e.name}: ${e.message}`];for(let e of t){let t=e.fiberId===void 0?`unknown`:`#${e.fiberId}`,r=e.annotations.get(Dt.key);n.push(` at fiber (${t})`),r&&n.push(li(r))}return n.join(`
|
|
9
|
-
`)},li=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(ai),i=!1;for(let[,e]of r)i=!0,t.push(` at ${n.name} (${e})`);i||t.push(` at ${n.name} (${e.replace(/^at /,``)})`)}else t.push(` at ${n.name}`);n=n.parent,r++}return t.join(`
|
|
10
|
-
`)},ui=e=>ni(e).map(di).join(`
|
|
11
|
-
`),di=e=>e.cause?`${e.stack} {\n${fi(e.cause,` `)}\n}`:e.stack,fi=(e,t)=>{let n=e.stack.split(`
|
|
12
|
-
`),r=`${t}[cause]: ${n[0]}`;for(let e=1,i=n.length;e<i;e++)r+=`\n${t}${n[e]}`;return e.cause&&(r+=` {\n${fi(e.cause,`${t} `)}\n${t}}`),r},pi=`~effect/Fiber`,mi={_A:i,_E:i},hi={id:0},gi=()=>globalThis[Me],_i=class{constructor(e,t=!0){this[pi]=mi,this.setContext(e),this.id=++hi.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this.runtimeMetrics?.recordFiberStart(this.context)}[pi];id;interruptible;currentOpCount;_stack;_observers;_exit;_children;_interruptedCause;_yielded;_running;_deferredInterrupt;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(e){return jn(this.context,e)}addObserver(e){return this._exit?(e(this._exit),c):(this._observers.push(e),()=>{if(this._exit)return;let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)})}interruptUnsafe(e,t){if(this._exit)return;let n=Yr(e);this.currentStackFrame&&(n=_t(n,Dn(Et,this.currentStackFrame))),t&&(n=_t(n,t)),this._interruptedCause=this._interruptedCause?Qr(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(I(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===$e)return;let n=yi.interruptChildren&&yi.interruptChildren(this);if(n!==void 0)return this.evaluate(L(n,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let e=0;e<this._observers.length;e++)this._observers[e](t);this._observers.length=0,this._stack.length=0,this._children=void 0,this.context=Tn()}runLoop(e){let t=globalThis[Me];globalThis[Me]=this;let n=this._running;this._running=!0;let r=!1,i=e;this.currentOpCount=0;try{for(;;){if(this._deferredInterrupt&&(this._deferredInterrupt=!1,i=I(this._interruptedCause)),this.currentOpCount++,!r&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){r=!0;let e=i;i=L(Di,()=>e)}if(i=this.currentTracerContext?this.currentTracerContext(i,this):i[j](this),i===$e){let e=this._yielded;if(Ye in e)return this._deferredInterrupt=!1,this._yielded=void 0,e;if(this._deferredInterrupt){this._yielded=void 0,e();continue}return $e}}}catch(e){return b(i,j)?this.runLoop(At(e)):At(`Fiber.runLoop: Not a valid effect: ${String(i)}`)}finally{this._running=n,globalThis[Me]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,vi;for(;;){let t=this._stack.pop();if(!t)return;let n=t[Qe]&&t[Qe](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,$e}children(){return this._children??=new Set}pipe(){return e(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&Sn(t,e))return;let n=this.getRef(Dr);n!==this.currentScheduler&&(this.currentScheduler=n,this._dispatcher=void 0),this.currentSpan=An(e,Lr),this.currentLogLevel=this.getRef(Hr),this.minimumLogLevel=this.getRef(Ur),this.currentStackFrame=this.getRef(Br),this.maxOpsBeforeYield=this.getRef(Nr),this.currentPreventYield=this.getRef(Pr),this.runtimeMetrics=An(e,zr);let r=An(e,Rr);this.currentTracerContext=r?r.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag===`Span`?this.currentSpan:void 0}},vi={[M](e,t){return I(t._interruptedCause)},[N](e,t){return I(t._interruptedCause)}},yi={interruptChildren:void 0},bi=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(Dt.key,e.currentStackFrame),bn(t)},xi=e=>Ni(t=>{let n=e[Symbol.iterator](),r=[],i;function a(){let e=n.next();for(;!e.done;){if(e.value._exit){r.push(e.value._exit),e=n.next();continue}i=e.value.addObserver(e=>{r.push(e),a()});return}t(Ci(r))}return a(),Ti(()=>i?.())}),Si=e=>jt(t=>{let n=bi(t),r=Gn();for(let i of e)i.interruptUnsafe(t.id,n),r.push(i);return Ui(xi(r))}),Ci=Tt,I=Ot,wi=kt,Ti=Ct({op:`Sync`,[j](e){let t=this[A](),n=e.getCont(M);return n?n[M](t,e):e.yieldWith(Tt(t))}}),Ei=Ct({op:`Suspend`,[j](e){return this[A]()}}),Di=Ct({op:`Yield`,[j](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(Yi)},this[A]??0),e.yieldWith(()=>{t=!0})}})(0),Oi=e=>Ei(()=>I(Ge(e))),ki=e=>At(e),Ai=Ci(void 0),ji=Ct({op:`Async`,single:!1,[j](e){let t=Ge(()=>this[A][0].bind(e.currentScheduler)),n=!1,r=!1,i=this[A][1]?new AbortController:void 0,a=t(t=>{n||(n=!0,r?e.evaluate(t):r=t)},i?.signal);return r===!1?(r=!0,e._yielded=()=>{n=!0},i===void 0&&a===void 0||e._stack.push(Mi(()=>(n=!0,i?.abort(),a??Yi))),$e):r}}),Mi=Ct({op:`AsyncFinalizer`,[Qe](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Sa))},[N](e,t){return Xr(e)?L(this[A](),()=>I(e)):I(e)}}),Ni=e=>ji(e,e.length>=2),Pi=Ni(c),Fi=(e,...t)=>{let n=t.length===0?function(){return Ei(()=>zi(e.apply(this,arguments)))}:function(){let n=Ei(()=>zi(e.apply(this,arguments)));for(let e=0;e<t.length;e++)n=t[e](n,...arguments);return n};return Ii(e.length,n)},Ii=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),Li=(e,...t)=>Ii(e.length,t.length===0?function(){return Ri(()=>e.apply(this,arguments))}:function(){let n=Ri(()=>e.apply(this,arguments));for(let e of t)n=e(n);return n}),Ri=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return Ci(r.value);let i=r.value;if(i&&i._tag===`Success`){n=i.value;continue}else if(i&&i._tag===`Failure`)return r.value;else{let n=!0;return Ei(()=>n?(n=!1,L(r.value,e=>zi(t,e))):Ei(()=>zi(e())))}}}catch(e){return ki(e)}},zi=Ct({op:`Iterator`,single:!1,[M](e,t){let n=this[A][0];for(;;){let r=n.next(e);if(r.done)return Ci(r.value);if(!R(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[j](e){return this[M](this[A][1],e)}}),Bi=r(2,(e,t)=>{let n=Ci(t);return L(e,e=>n)}),Vi=r(2,(e,t)=>L(e,e=>nt(t)?t:Ge(()=>t(e)))),Hi=r(2,(e,t)=>L(e,e=>Bi(nt(t)?t:Ge(()=>t(e)),e))),Ui=e=>L(e,e=>Yi),L=r(2,(e,t)=>{let n=Object.create(Wi);return n[A]=e,n[M]=t.length===1?t:e=>t(e),n}),Wi=St({op:`OnSuccess`,[j](e){return e._stack.push(this),this[A]}}),R=e=>Ye in e,Gi=r(2,(e,t)=>R(e)?e._tag===`Success`?t(e.value):e:L(e,t)),Ki=r(2,(e,t)=>L(e,e=>Ci(Ge(()=>t(e))))),qi=r(2,(e,t)=>R(e)?Xi(e,t):Ki(e,t)),Ji=e=>e._tag===`Success`,Yi=Tt(void 0),Xi=r(2,(e,t)=>e._tag===`Success`?Tt(t(e.value)):e),Zi=e=>{let t=[];for(let n of e)n._tag===`Failure`&&t.push(...n.cause.reasons);return t.length===0?Yi:Ot(ft(t))},Qi=r(2,(e,t)=>jt(n=>{let r=n.context,i=t(r);return r===i?e:(n.setContext(i),ya(e,()=>{n.setContext(r)}))})),$i=e=>jt(t=>e(t.context)),ea=r(2,(e,t)=>R(e)?e:Qi(e,Fn(t))),ta=r(2,(e,t)=>{let n=Object.create(na);return n[A]=e,n[N]=t.length===1?t:e=>t(e),n}),na=St({op:`OnFailure`,[j](e){return e._stack.push(this),this[A]}}),ra=r(2,(e,t)=>ta(e,e=>Vi(Ge(()=>t(e)),I(e)))),ia=e=>R(e)?Tt(e):aa(e),aa=Ct({op:`Exit`,[j](e){return e._stack.push(this),this[A]},[M](e,t,n){return Ci(n??Tt(e))},[N](e,t,n){return Ci(n??Ot(e))}}),oa=`~effect/Scope`,sa=`~effect/Scope/Closeable`,ca=sn(`effect/Scope`),la=(e,t)=>{if(e.state._tag===`Closed`)return;let n={_tag:`Closed`,exit:t};if(e.state._tag===`Empty`){e.state=n;return}let{finalizers:r}=e.state;if(e.state=n,r.size!==0)return r.size===1?r.values().next().value(t):da(e,r,t)},ua=(e,t)=>Ji(e)?t:ta(t,t=>I(Qr(e.cause,t))),da=Fi(function*(e,t,n){let r=[],i=[],a=Array.from(t.values()),o=gi();for(let t=a.length-1;t>=0;t--){let s=a[t];e.strategy===`sequential`?r.push(yield*ia(s(n))):i.push(ka(o,s(n),!0,!0,`inherit`))}return i.length>0&&(r=yield*xi(i)),yield*Zi(r)}),fa=(e,t)=>Ei(()=>e.state._tag===`Closed`?t(e.state.exit):(pa(e,{},t),Ai)),pa=(e,t,n)=>{e.state._tag===`Empty`?e.state={_tag:`Open`,finalizers:new Map([[t,n]])}:e.state._tag===`Open`&&e.state.finalizers.set(t,n)},ma=(e=`sequential`)=>({[sa]:sa,[oa]:oa,strategy:e,state:ha}),ha={_tag:`Empty`},ga=ca,_a=e=>jt(t=>{let n=t.context,r=ma();return t.setContext(On(t.context,ca,r)),ya(e,e=>(t.setContext(n),la(r,e)))}),va=(e,t,n)=>$i(r=>Ea(i=>L(ga,a=>Hi(n?.interruptible?i(e):e,e=>fa(a,n=>ea(t(e,n),r)))))),ya=Ct({op:`OnExit`,single:!1,[j](e){return e._stack.push(this),this[A][0]},[Qe](e){e.interruptible&&this[A][2]!==!0&&(e._stack.push(Sa),e.interruptible=!1)},[M](e,t,n){n??=Tt(e);let r=this[A][1](n);return r?L(r,e=>n):n},[N](e,t,n){n??=Ot(e);let r=this[A][1](n);return r?L(ua(n,r),e=>n):n}}),ba=e=>jt(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Sa),e):e),xa=Ct({op:`SetInterruptible`,[Qe](e){if(e.interruptible=this[A],e._interruptedCause&&e.interruptible)return()=>I(e._interruptedCause)}}),Sa=xa(!0),Ca=xa(!1),wa=e=>{if(e.interruptible=!0,e._stack.push(Ca),e._interruptedCause)return I(e._interruptedCause)},Ta=e=>jt(t=>t.interruptible?e:wa(t)??e),Ea=e=>jt(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Sa),e(Ta)):e(i)),Da=e=>{let t=e.onItem,n=e.step,r=(e,i,a,o)=>{for(;a<o;a++){let s=i[a],c=t(e,s,a);if(!R(c))return L(ia(c),t=>n(e,s,t,a)??r(e,i,a+1,o)??Ai);let l=n(e,s,c,a);if(l)return l._tag===`Failure`?l:void 0}};return(e,i,a)=>{let o=0,s=a?.end??i.length,c=a?.concurrency??1;if(c===1)return r(e,i,0,s);let l=a?.orderedStep===!0&&c>1,u=!1,d,f,p,m=!1,h,g,_=o,v=l?Array(s):void 0,ee=e=>{let t=At(e);return h=t,u=!0,m=!0,f&&f.size>0?L(ba(Si(Array.from(f))),()=>t):t},y=(t,r,a)=>{if(!l)return n(e,t,r,a);if(h)return h;for(v[a]=r;_<s;){let t=v[_];if(t===void 0)return;v[_]=void 0;let r=_++,a=n(e,i[r],t,r);if(a)return a}},b=()=>{let n=!1;for(;!h&&o<s;o++){let r=i[o],a=g??t(e,r,o);if(R(a)){if(h=y(r,a,o),h)break}else if(d){g=void 0;let e=ka(d,a,!0,!0,`inherit`);if(e._exit){if(h=y(r,e._exit,o),h)break;continue}f.add(e);let t=o;if(e.addObserver(i=>{f.delete(e);try{if(h){if(!m&&i._tag===`Failure`)for(let e of i.cause.reasons)if(e._tag===`Interrupt`)continue;else h._tag===`Failure`?h.cause.reasons.push(e):h=Ot(ft([e]))}else{let e=y(r,i,t);e&&(h=e._tag===`Failure`?Ot(ft(e.cause.reasons.slice())):e,b())}if(n){let e=b();e&&p(e)}else u&&f.size===0&&p(h??Ai)}catch(e){p(ee(e))}}),f.size<c)continue;n=!0,o++;return}else return Ni(e=>{d=gi(),f=new Set,g=a,p=e;let t;try{t=b()}catch(t){return e(ee(t))}return t?e(t):Ei(()=>(h=Yi,m=!0,f?Si(f):Ai))})}if(u=!0,h){if(f&&f.size>0){let e=bi(d);f.forEach(t=>t.interruptUnsafe(d.id,e));return}if(p||h._tag===`Failure`)return h}else if(p)if(f)f.size===0&&p(Ai);else return Yi};return b()}},Oa=()=>Da,ka=(e,t,n=!1,r=!1,i=!1)=>{let a=e,o=i===`inherit`?a.interruptible:!i,s=new _i(a.context,o);return n?s.evaluate(t):a.currentDispatcher.scheduleTask(()=>s.evaluate(t),0),!r&&!s._exit&&(a.children().add(s),s.addObserver(()=>a._children.delete(s))),s},Aa=e=>(t,n)=>{let r=new _i(n?.scheduler?On(e,Dr,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal)if(n.signal.aborted)r.interruptUnsafe();else{let e=()=>r.interruptUnsafe();n.signal.addEventListener(`abort`,e,{once:!0}),r.addObserver(()=>n.signal.removeEventListener(`abort`,e))}return n?.onFiberStart&&n.onFiberStart(r),r},ja=Aa(Tn()),Ma=(e=>{let t=Aa(e);return e=>{if(R(e))return e;let n=new jr(`sync`),r=t(e,{scheduler:n});return r._dispatcher?.flush(),r._exit??At(new Ba(r))}})(Tn()),Na=P(`effect/Clock`,{defaultValue:()=>new Fa}),Pa=2**31-1,Fa=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=Ti(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return Ra()}currentTimeNanos=Ti(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return La()}monotonicTimeNanos=Ti(()=>this.monotonicTimeNanosUnsafe());sleep(e){return this.sleepMillis(xr(e))}sleepMillis(e){return e<=0?Di:Number.isFinite(e)?Ni(t=>{let n=e>Pa?this.sleepMillis(e-Pa):Ai,r=setTimeout(()=>t(n),Math.min(e,Pa));return Ti(()=>clearTimeout(r))}):Pi}},Ia=BigInt(1e6),La=function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint==`function`)return()=>e.bigint();if(typeof performance<`u`&&typeof performance.now==`function`)return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let e=BigInt(Date.now())*Ia;return e>t&&(t=e),t}}(),Ra=function(){let e=BigInt(1e9),t;return()=>{let n=La(),r=BigInt(Date.now())*Ia;if(t===void 0)t=r-n;else{let i=t+n;(r>i?r-i:i-r)>e&&(t=r-n)}return t+n}}();Pt(`TimeoutError`),Pt(`IllegalArgumentError`),Pt(`ExceededCapacityError`);var za=`~effect/Cause/AsyncFiberError`,Ba=class extends Pt(`AsyncFiberError`){[za]=za;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}};Pt(`UnknownError`);var Va=P(`effect/Console/CurrentConsole`,{defaultValue:()=>globalThis.console}),Ha=Zt(Xt(Yt,e=>{switch(e){case`All`:return-(2**53-1);case`Fatal`:return 5e4;case`Error`:return 4e4;case`Warn`:return 3e4;case`Info`:return 2e4;case`Debug`:return 1e4;case`Trace`:return 0;case`None`:return 2**53-1}})),Ua=P(`effect/Loggers/CurrentLoggers`,{defaultValue:()=>new Set([Qa,$a])}),Wa=P(`effect/Logger/LogToStderr`,{defaultValue:o}),Ga={"~effect/Logger":{_Message:i,_Output:i},pipe(){return e(this,arguments)}},Ka=e=>{let t=Object.create(Ga);return t.log=e,t},qa=e=>e.replace(/[\s="]/g,`_`),Ja=(e,t)=>`${qa(e[0])}=${t-e[1]}ms`,Ya=e=>(...t)=>{let n;for(let e=0,r=t.length;e<r;e++){let r=t[e];ot(r)&&(n?t.splice(e,1):t=t.slice(0,e).concat(t.slice(e+1)),n=n?ft(n.reasons.concat(r.reasons)):r,e--)}return n===void 0&&(n=pt),jt(r=>{let i=e??r.currentLogLevel;if(Ha(r.minimumLogLevel,i))return Ai;let a=r.getRef(Na),o=r.getRef(Ua);if(o.size>0){let e=new Date(a.currentTimeMillisUnsafe());for(let a of o)a.log({cause:n,fiber:r,date:e,logLevel:i,message:t})}return Ai})},Xa={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};Xa.gray,Xa.blue,Xa.green,Xa.yellow,Xa.red,Xa.bgBrightRed,Xa.black;var Za=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`)}`,Qa=Ka(({cause:e,date:t,fiber:n,logLevel:r,message:i})=>{let a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(ui(e));let o=t.getTime(),s=n.getRef(Wr),c=``;for(let e of s)c+=` ${Ja(e,o)}`;let l=n.getRef(Vr);Object.keys(l).length>0&&a.push(l);let u=n.getRef(Va);(n.getRef(Wa)?u.error:u.log)(`[${Za(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...a)}),$a=Ka(({cause:e,fiber:t,logLevel:n,message:r})=>{let i=t.getRef(Na),a=t.getRef(Vr),o=t.currentSpan;if(o===void 0||o._tag===`ExternalSpan`)return;let s={};for(let[e,t]of Object.entries(a))Ke(s,e,t);s[`effect.fiberId`]=t.id,s[`effect.logLevel`]=n.toUpperCase(),e.reasons.length>0&&(s[`effect.cause`]=ui(e)),o.event(Ue(Array.isArray(r)&&r.length===1?r[0]:r),i.currentTimeNanosUnsafe(),s)}),eo=vt,to=Zr,no=$r,ro=ti;sn()(`effect/Cause/StackTrace`),sn()(`effect/Cause/InterruptorStackTrace`);var io=Tt,ao=Ot,oo=kt,so=Yi,co=Ji,lo=`~effect/time/DateTime`,uo=`~effect/time/DateTime/TimeZone`,fo={[lo]:lo,pipe(){return e(this,arguments)},[Ve](){return this.toString()},toJSON(){return mo(this).toJSON()}};({...fo}),{...fo};var po={[uo]:uo,[Ve](){return this.toString()}};({...po}),{...po};var mo=e=>new Date(e.epochMilliseconds),ho=nt,go=Ci,_o=Ti,vo=Ai,yo=Ni,z=wi,bo=Oi,xo=L,So=ia,Co=ta,wo=ra,To=_a,Eo=va,Do=ja,Oo=Ma,ko=Ya(`Error`);sn()(`effect/Effect/Transaction`);var Ao=qi,jo=Gi,Mo=Li,No=(e,t)=>co(e)?t(0):to(e.cause)?t(130):t(Io(ro(e.cause))),Po=e=>r(e=>ho(e[0]),(t,n)=>{let r=n?.disableErrorReporting===!0?Do(t):Do(wo(t,e=>to(e)?vo:Ro(ro(e))?ko(e):vo));try{let e=globalThis.setInterval(c,2147483647);r.addObserver(()=>{clearInterval(e)})}catch{}return e({fiber:r,teardown:n?.teardown??No})}),Fo=`~effect/Runtime/errorExitCode`,Io=e=>{if(typeof e==`object`&&e&&`~effect/Runtime/errorExitCode`in e){let t=e[Fo];if(typeof t==`number`)return t}return 1},Lo=`~effect/Runtime/errorReported`,Ro=e=>{if(typeof e==`object`&&e&&`~effect/Runtime/errorReported`in e){let t=e[Lo];if(typeof t==`boolean`)return t}return!0},zo=Po(({fiber:e})=>{globalThis.addEventListener(`pagehide`,t=>{t.persisted||e.interruptUnsafe(e.id)})}),Bo=`~effect/BigDecimal`,Vo={[Bo]:Bo,[x](){let e=Jo(this);return C(S(e.value),ie(e.scale))},[T](e){return Ho(e)&&Qo(this,e)},toString(){return`BigDecimal(${$o(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[Ve](){return this.toJSON()},pipe(){return e(this,arguments)}},Ho=e=>b(e,Bo),Uo=(e,t)=>{let n=Object.create(Vo);return n.value=e,n.scale=t,n},Wo=(e,t)=>{if(e!==Go&&e%Ko===Go)throw RangeError(`Value must be normalized`);let n=Uo(e,t);return n.normalized=n,n},Go=BigInt(0),Ko=BigInt(10),qo=Wo(Go,0),Jo=e=>{if(e.normalized===void 0)if(e.value===Go)e.normalized=qo;else{let t=`${e.value}`,n=0;for(let e=t.length-1;e>=0&&t[e]===`0`;e--)n++;n===0&&(e.normalized=e),e.normalized=Wo(BigInt(t.substring(0,t.length-n)),e.scale-n)}return e.normalized},Yo=r(2,(e,t)=>t>e.scale?Uo(e.value*Ko**BigInt(t-e.scale),t):t<e.scale?Uo(e.value/Ko**BigInt(e.scale-t),t):e),Xo=e=>e.value<Go?Uo(-e.value,e.scale):e,Zo=It((e,t)=>e.scale>t.scale?Yo(t,e.scale).value===e.value:e.scale<t.scale?Yo(e,t.scale).value===t.value:e.value===t.value),Qo=r(2,(e,t)=>Zo(e,t)),$o=e=>{let t=Jo(e);if(Math.abs(t.scale)>=16)return es(t);let n=t.value<Go,r=n?`${t.value}`.substring(1):`${t.value}`,i,a;if(t.scale>=r.length)i=`0`,a=`0`.repeat(t.scale-r.length)+r;else{let e=r.length-t.scale;if(e>r.length){let t=e-r.length;i=`${r}${`0`.repeat(t)}`,a=``}else a=r.slice(e),i=r.slice(0,e)}let o=a===``?i:`${i}.${a}`;return n?`-${o}`:o},es=e=>{if(ts(e))return`0e+0`;let t=Jo(e),n=`${Xo(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${ns(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},ts=e=>e.value===Go,ns=e=>e.value<Go;sn()(`effect/DateTime/CurrentTimeZone`);function rs(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}var is=`~sentinels`,as=`~constructor`,os=l(e=>{let t=rs(e)?.identifier;return typeof t==`string`?t:e.getExpected(os)}),B=Symbol(),ss=io,cs=ss(B),V=ss(B),ls=e=>e===B?$t():en(e),us=e=>e._tag===`None`?cs:ss(e.value),ds=`~effect/SchemaIssue/Issue`;function fs(e){return b(e,ds)&&e[ds]===ds}function ps(e){return Object.hasOwn(e,`input`)}var ms=class{[ds]=ds;constructor(e,t){t?.reportInput===!0&&e!==B&&(this.input=e)}},hs=class extends ms{_tag=`Filter`;filter;issue;constructor(e,t,n,r){super(n,r),this.filter=e,this.issue=t}},gs=class extends ms{_tag=`Encoding`;ast;issue;constructor(e,t,n,r){super(n,r),this.ast=e,this.issue=t}},_s=class extends ms{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},vs=class extends ms{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},ys=class extends ms{_tag=`UnexpectedKey`;ast;constructor(e,t,n){super(t,n),this.ast=e}},H=class extends ms{_tag=`Composite`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},bs=class extends ms{_tag=`InvalidType`;ast;constructor(e,t,n){super(t,n),this.ast=e}},xs=class extends ms{_tag=`InvalidValue`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}},Ss=class extends ms{_tag=`AnyOf`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},Cs=class extends ms{_tag=`OneOf`;ast;successes;constructor(e,t,n,r){super(n,r),this.ast=e,this.successes=t}};function ws(e,t,n){if(fs(e))return e;if(typeof e==`string`)return new xs({message:e},t,n);let r=typeof e.issue==`string`?new xs({message:e.issue},t,n):e.issue;return new _s(e.path,r)}function Ts(e,t,n){if(e!==void 0)return typeof e==`boolean`?e?void 0:new xs(void 0,t,n):ws(e,t,n)}function Es(e,t,n,r){return Array.isArray(t)?Hn(t)?t.length===1?ws(t[0],n,r):new H(e,Kn(t,e=>ws(e,n,r)),n,r):void 0:Ts(t,n,r)}var Ds=e=>{let t=Is(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return js(os(e.ast),e);case`InvalidValue`:{let t=As(e);if(t!==void 0)return js(t,e);let n=ks(e);return n===void 0?`Expected a valid value`:`Invalid data ${n}`}case`MissingKey`:return`Missing key`;case`UnexpectedKey`:{let t=ks(e);return t===void 0?`Expected no excess property`:`Unexpected key with value ${t}`}case`Forbidden`:return`Forbidden operation`;case`OneOf`:{let t=ks(e);return t===void 0?`Expected exactly one member to match`:`Expected exactly one member to match the input ${t}`}}},Os=e=>Is(e.issue)??Is(e);function ks(e){return ps(e)?k(e.input):void 0}function As(e){let t=e.annotations?.expected;return typeof t==`string`?t:void 0}function js(e,t){let n=ks(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function Ms(e){let t=e.annotations?.expected;if(typeof t==`string`)return t;switch(e._tag){case`Filter`:return`<filter>`;case`FilterGroup`:return e.checks.map(e=>Ms(e)).join(` & `)}}function Ns(){return e=>Fs(e,``)}var Ps=Ns();function Fs(e,t){let n;switch(e._tag){case`Filter`:{let r=Os(e);if(r!==void 0)n=r;else{if(e.issue._tag!==`InvalidValue`)return Fs(e.issue,t);let r=As(e.issue);n=r===void 0?js(Ms(e.filter),e):js(r,e.issue)}break}case`Encoding`:return Fs(e.issue,t);case`Pointer`:return Fs(e.issue,t+Le(e.path));case`Composite`:case`AnyOf`:if(e._tag===`Composite`||e.issues.length>0)return e.issues.map(e=>Fs(e,t)).join(`
|
|
13
|
-
`);n=Is(e)??js(os(e.ast),e);break;default:n=Ds(e);break}return t?`${n}\n at ${t}`:n}function Is(e){if(e._tag===`Pointer`)return;if(e._tag===`Encoding`)return Is(e.issue);let t=(e._tag===`Filter`?e.filter.annotations:`annotations`in e?e.annotations:e.ast.annotations)?.[e._tag===`MissingKey`?`messageMissingKey`:e._tag===`UnexpectedKey`?`messageUnexpectedKey`:`message`];if(typeof t==`string`)return t}function Ls(e){let t;for(let n of e.reasons){if(!eo(n)||!fs(n.error))return;t??=n.error}return t}function Rs(e,t){let n=Ls(e);if(n===void 0)throw Error(t,{cause:e});return n}var zs=class e extends n{run;constructor(e){super(),this.run=e}map(t){return new e((e,n)=>this.run(e,n).pipe(Ao(rn(t))))}compose(t){return Vs(this)?t:Vs(t)?this:new e((e,n)=>this.run(e,n).pipe(jo(e=>t.run(e,n))))}},Bs=new zs(go);function Vs(e){return e.run===Bs.run}function Hs(){return Bs}function Us(e){return Ws(rn(e))}function Ws(e){return new zs(t=>go(e(t)))}function Gs(e){return new zs(t=>{let n=an(t,_);return nn(n)?go(n):Ao(e,en)})}function Ks(){return Us(globalThis.String)}function qs(){return Us(globalThis.Number)}var Js=`~effect/SchemaTransformation/Transformation`,Ys=class e{[Js]=Js;_tag=`Transformation`;decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function Xs(e){return b(e,Js)&&e[Js]===Js}var Zs=e=>Xs(e)?e:new Ys(e.decode,e.encode),Qs=new Ys(Hs(),Hs());function $s(){return Qs}var ec=new Ys(qs(),Ks());function tc(e){return t=>t._tag===e}var nc=tc(`Declaration`),rc=tc(`Never`),ic=tc(`Literal`),ac=tc(`UniqueSymbol`),oc=tc(`Arrays`),sc=tc(`Objects`),cc=tc(`Suspend`),lc=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},uc={},dc=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=n,this.annotations=r}},fc=`~effect/Schema`,pc=class{[fc]=fc;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},mc=new class extends pc{_tag=`Null`;getParser(){return kl(this,null)}getExpected(){return`null`}},hc=new class extends pc{_tag=`Unknown`;getParser(){return Al(this,ee)}getExpected(){return`unknown`}},gc=class extends pc{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${k(e)}`);this.literal=e}getParser(){return kl(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?_c(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:_c(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function _c(e){let t=globalThis.String(e.literal);return U(e,[new lc(new gc(t),new Ys(Us(()=>e.literal),Us(()=>t)))])}var vc=new class extends pc{_tag=`String`;getParser(){return Al(this,p)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&Rl(n,e,void 0,this,t)?void 0:e}getExpected(){return`string`}},yc=class extends pc{_tag=`Number`;getParser(){return Al(this,m)}matchKey(e,t){return this._match(Nl,e,t)}matchPart(e,t){return this._match(Ml,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);return n.disableChecks||!this.checks?r:Rl(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){return this.checks&&(bc(this.checks,`effect/schema/isFinite`)||bc(this.checks,`effect/schema/isInt`))?this:U(this,[il])}toCodecStringTree(){return this.toCodecJson()===this?U(this,[Il]):U(this,[Ll])}getExpected(){return`number`}};function bc(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&bc(e.checks,t))}var xc=new yc,Sc=new class extends pc{_tag=`Boolean`;getParser(){return Al(this,h)}getExpected(){return`boolean`}},Cc=class e extends pc{_tag=`Arrays`;isMutable;elements;rest;encodingChecks;constructor(e,t,n,r,i,a,o,s){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=s;let c=!1;for(let e=0;e<t.length;e++)if(xl(t[e]))c=!0;else if(c)throw Error(`A required element cannot follow an optional element. ts(1257)`);if(c&&n.length>1)throw Error(`A required element cannot follow an optional element. ts(1257)`);for(let e=1;e<n.length;e++)if(xl(n[e]))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e,t=e){let n=this,r,i,a=n.elements.length,o=Math.max(0,n.rest.length-1);function s(e,t){return t<a?r[t]:t>=e?i[t-e+1]:i[0]}return Mo(function*(e,c){if(e===B)return B;if(!Array.isArray(e))return yield*z(new bs(n,e,c));r||(r=n.elements.map(e=>({ast:e,parser:t(e)})),i=n.rest.map(e=>({ast:e,parser:t(e)})));let l=e.length,u={ast:n,getParser:s,input:e,len:l,tailThreshold:Math.max(a,l-o),output:new globalThis.Array(l),issues:void 0,options:c},d=wc(u,e,{concurrency:Tc(c?.concurrency)?.concurrency,end:n.rest.length===0?a:Math.max(l,a+o)});if(d&&(yield*d),n.rest.length===0&&l>a)for(let t=a;t<=l-1;t++){let r=new ys(n,e[t],c),i=new _s([t],r);if(c.errors===`all`)u.issues?u.issues.push(i):u.issues=[i];else return yield*z(new H(n,[i],e,c))}return u.issues?yield*z(new H(n,u.issues,e,c)):u.output})}_rebuild(t,n,r){let i=_l(this.elements,t),a=_l(this.rest,t);return i===this.elements&&a===this.rest&&n===this.checks&&r===this.encodingChecks?this:new e(this.isMutable,i,a,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return`array`}},wc=Oa()({onItem(e,t,n){let r=n<e.len?t:B;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag===`Failure`)return Ec(e,e.ast,r,n);let i=n===V?t:n[A];if(i!==B)e.output[r]=i;else{let t=e.getParser(e.tailThreshold,r);if(xl(t.ast))return;let n=new _s([r],new vs(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return oo(new H(e.ast,[n],e.input,e.options))}}}),Tc=e=>(e=e===`unbounded`?1/0:e??1,e>1?{concurrency:e}:void 0),Ec=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=Ls(r.cause);if(i===void 0)return ao(no(r.cause,r=>new H(t,[new _s([n],r)],e.input,e.options)));let a=new _s([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return oo(new H(t,[a],e.input,e.options))},Dc=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function Oc(e,t,n=uc){let r,i;function a(t){switch(t._tag){case`String`:case`TemplateLiteral`:return(r??=Object.keys(e)).filter(e=>t.matchPart(e,n)!==void 0);case`Number`:return(r??=Object.keys(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Symbol`:return(i??=Object.getOwnPropertySymbols(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Union`:return[...new Set(t.types.flatMap(a))];default:return[]}}return a(jl(Tl(t)))}var kc=class{name;type;constructor(e,t){this.name=e,this.type=t}};function Ac(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(Ac);default:return!1}}function jc(e){return Ac(e)&&Ac(Tl(e))}var Mc=class{parameter;type;constructor(e,t){if(!jc(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,xl(t)&&!Ol(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},Nc=class e extends pc{_tag=`Objects`;propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=o;let s=e.map(e=>e.name).filter((e,t,n)=>n.indexOf(e)!==t);if(s.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(s)}. ts(2300)`)}getParser(e,t=e){let n=this,r=[];for(let e of n.propertySignatures)r.push(e.name);let i=r.length,a=n.indexSignatures.length,o=i&&a?new Set(r):void 0;if(!i&&!a)return Al(n,v);let s,c,l=(e,t,r,a,s)=>{if(s._tag===`Failure`)return Ec(e,n,t,s)??so;let c=s===V?a:s[A];if(r!==B&&c!==B){if(i&&(o.has(t)||o.has(r)))return so;Ke(e.out,r,c)}return so},u=(e,t,r,i)=>{if(!i){let n=r.parserKey(t,e.options);if(!R(n))return xo(So(n),n=>u(e,t,r,n));i=n}if(i._tag===`Failure`)return Ec(e,n,t,i)??so;let a=i===V?t:i[A],o=e.input[t],s=r.parserValue(o,e.options);return R(s)?l(e,t,a,o,s):xo(So(s),n=>l(e,t,a,o,n))},d=(e,t,n)=>{let r=e.input[t],i=n.parserValue(r,e.options);return R(i)?l(e,t,t,r,i):xo(So(i),n=>l(e,t,t,r,n))},f=a?Oa()({onItem:(e,[t,n])=>u(e,t,n),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return Mo(function*(l,p){if(l===B)return B;if(!(typeof l==`object`&&l&&!Array.isArray(l)))return yield*z(new bs(n,l,p));s||(s=n.propertySignatures.map(e=>({parser:t(e.type),name:e.name,type:e.type})),c=a?n.indexSignatures.map(n=>({is:n,parserKey:e(jl(n.parameter)),parserValue:t(n.type)})):void 0);let m=l,h={},g={ast:n,input:m,out:h,issues:void 0,options:p},_=p.errors===`all`,v=p.onExcessProperty===`error`,ee=p.onExcessProperty===`preserve`,y;if(!a&&(v||ee)){o??=new Set(r),y=Reflect.ownKeys(m);for(let e=0;e<y.length;e++){let t=y[e];if(!o.has(t))if(v){let e=new ys(n,m[t],p),r=new _s([t],e);if(_){g.issues?g.issues.push(r):g.issues=[r];continue}else return yield*z(new H(n,[r],l,p))}else Ke(h,t,m[t])}}let b=Tc(p?.concurrency);if(i){let e=Pc(g,s,b);e&&(yield*e)}if(a&&!b)for(let e=0;e<a;e++){let t=c[e],n=t.is.parameter===vc?d:u,r=t.is.parameter===vc?Object.keys(m):Oc(m,t.is.parameter,p);for(let e=0;e<r.length;e++){let i=n(g,r[e],t);if(!R(i))yield*i;else if(i._tag===`Failure`)return yield*i}}else if(f){let e=Gn();for(let t=0;t<a;t++){let n=c[t],r=Oc(m,n.is.parameter,p);for(let t=0;t<r.length;t++)e.push([r[t],n])}let t=f(g,e,b);t&&(yield*t)}if(g.issues)return yield*z(new H(n,g.issues,l,p));if(p.propertyOrder===`original`){let e=(y??Reflect.ownKeys(m)).concat(r),t={};for(let n of e)Object.hasOwn(h,n)&&Ke(t,n,h[n]);return t}return h})}_rebuild(t,n,r,i){let a=_l(this.propertySignatures,e=>{let n=t(e.type);return n===e.type?e:new kc(e.name,n)}),o=_l(this.indexSignatures,e=>{let r=n(e.parameter),i=t(e.type);return r===e.parameter&&i===e.type?e:new Mc(r,i)});return a===this.propertySignatures&&o===this.indexSignatures&&r===this.checks&&i===this.encodingChecks?this:new e(a,o,this.annotations,r,void 0,this.context,i)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}},Pc=Oa()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(B,e.options);let n=e.input[t.name];return Ke(e.out,t.name,n),t.parser(n,e.options)},step(e,t,n){if(n._tag===`Failure`)return Ec(e,e.ast,t.name,n);if(n===V)return;let r=n[A];if(r!==B){Ke(e.out,t.name,r);return}if(delete e.out[t.name],!xl(t.type)){let n=new _s([t.name],new vs(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}else return oo(new H(e.ast,[n],e.input,e.options))}}});function Fc(e,t){return e?t?[...e,...t]:e:t}function Ic(e,t,n){return new Nc(Reflect.ownKeys(e).map(t=>new kc(t,e[t].ast)),[],n,t)}function Lc(e){return e.ast}function Rc(e,t=void 0){return new Cc(!1,e.map(e=>e.ast),[],void 0,t)}function zc(e,t,n){return new Jc(e.map(Lc),t,void 0,n)}var Bc=u(e=>{for(;;){if(cc(e))return hc;let t=e.encoding;if(!t)return e.recur?.(Bc,i)??e;if(t.some(e=>e.transformation._tag===`Middleware`&&e.transformation.decode!==i))return hc;e=t[t.length-1].to}});function Vc(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:return[`undefined`];case`String`:case`TemplateLiteral`:return[`string`];case`Number`:return[`number`];case`Boolean`:return[`boolean`];case`Symbol`:case`UniqueSymbol`:return[`symbol`];case`BigInt`:return[`bigint`];case`Arrays`:return[`array`];case`ObjectKeyword`:return[`object`,`array`,`function`];case`Objects`:return e.propertySignatures.length||e.indexSignatures.length?[`object`]:[`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(Vc)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function Hc(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[is];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!xl(t)){if(ic(t))return[{key:e.name,literal:t.literal}];if(ac(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>{if(!xl(e)){if(ic(e))return[{key:t,literal:e.literal}];if(ac(e))return[{key:t,literal:e.symbol}]}return[]});case`Union`:{if(e.types.length===0)return[];let t=e.types.map(e=>Hc(Bc(e)));return t[0].filter(e=>t.every(t=>t.some(t=>t.key===e.key&&t.literal===e.literal)))}case`Suspend`:return Hc(e.thunk())}}var Uc=new WeakMap,Wc=Object.freeze([]);function Gc(e){let t=Uc.get(e);if(t)return t;let n,r=0,i,a,o=!0;for(let t=0;t<e.length;t++){let s=e[t],c=Bc(s);if(rc(c))continue;if(o)if(ic(c)||ac(c)){a??=new Map;let e=ic(c)?c.literal:c.symbol,t=a.get(e);t||a.set(e,t=[]),t.push(s)}else o=!1;let l=Hc(c);if(l.length){n??=new Map,r++;for(let{key:e,literal:r}of l){let i=n.get(e);i||n.set(e,i=[new Map,new Set]),i[1].add(t);let a=i[0].get(r);a||i[0].set(r,a=new Set),a.add(t)}}else{i??={};let e=Vc(c);for(let n of e)(i[n]??=[]).push(t)}}if(o&&a)a.forEach(Object.freeze),t=e=>a.get(e)??Wc;else if(n?.size===1&&!i){let[r,[i]]=n.entries().next().value,a=i;for(let[t,n]of i)a.set(t,Object.freeze(Array.from(n,t=>e[t])));t=(t,n)=>{if(y(t)){let i=Object.hasOwn(t,r)?t[r]:void 0;if(i!==void 0)return a.get(i)??Wc;if(n)return e}return Wc}}else if(n){let a;for(let e of n)(!a||e[1][0].size>a[1][0].size)&&e[1][1].size===r&&(a=e);t=(t,r)=>{let o=i?.[t===null?`null`:Array.isArray(t)?`array`:typeof t]??Wc;if(!y(t))return o.map(t=>e[t]);let s=new Set(o),c;if(a){let[n,[i]]=a,l=Object.hasOwn(t,n),u=l?t[n]:void 0;if(l&&(!r||u!==void 0)){let t=i.get(u);if(!t)return o.map(t=>e[t]);for(let e of t)s.add(e);c=n}}if(c===void 0)for(let[e,[i,a]]of n){let n=Object.hasOwn(t,e),o=n?t[e]:void 0;if(n&&(!r||o!==void 0)){let e=i.get(o);if(e)for(let t of e)s.add(t)}else if(r)for(let e of a)s.add(e)}for(let[e,[i,a]]of n){if(e===c)continue;let n=Object.hasOwn(t,e),o=n?t[e]:void 0;if(n&&(!r||o!==void 0)){let e=i.get(o);for(let t of s)a.has(t)&&!e?.has(t)&&s.delete(t)}}return Array.from(s).sort((e,t)=>e-t).map(t=>e[t])}}else t=t=>(i?.[t===null?`null`:Array.isArray(t)?`array`:typeof t]??Wc).map(t=>e[t]).filter(Kc(t));return Uc.set(e,t),t}function Kc(e){return t=>{let n=Bc(t);return n._tag===`Literal`?n.literal===e:n._tag!==`UniqueSymbol`||n.symbol===e}}function qc(e,t,n=!1){return Gc(t)(e,n)}var Jc=class e extends pc{_tag=`Union`;types;mode;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.types=e,this.mode=t,this.encodingChecks=o}getParser(e,t){let n=this;return(r,i)=>{if(r===B)return cs;let a=qc(r,n.types,t!==void 0);if(a.length===1){let t=e(a[0])(r,i);return t._tag===`Success`?t:R(t)?Yc(n,t.cause,r,i):Co(t,e=>Yc(n,e,r,i))}let o={ast:n,compile:e,input:r,out:void 0,successes:n.mode===`oneOf`?[]:void 0,issues:void 0,options:i},s=Tc(i?.concurrency),c=Xc(o,a,s?{...s,orderedStep:!0}:void 0);return c?jo(c,e=>o.out===V?go(r):o.out?o.out:z(new Ss(n,o.issues??[],r,i))):o.out?o.out:z(new Ss(n,o.issues??[],r,i))}}_rebuild(t,n,r){let i=_l(this.types,t);return i===this.types&&n===this.checks&&r===this.encodingChecks?this:new e(i,this.mode,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let n of this.types){let r=n.matchPart(e,t);if(r!==void 0)return r}}getExpected(e){let t=this.annotations?.expected;if(typeof t==`string`)return t;if(this.types.length===0)return`never`;let n=this.types.map(t=>{let n=Tl(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(ic);if(t.length>0)return`${Qc(n.isMutable)}[ ${t.map(t=>e(t)+$c(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>ic(e.type));if(t.length>0)return`{ ${t.map(t=>`${Qc(t.type.context?.isMutable)}${Ie(t.name)}${$c(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};function Yc(e,t,n,r){let i=Ls(t);return i?oo(new Ss(e,[i],n,r)):ao(t)}var Xc=Oa()({onItem(e,t){return e.compile(t)(e.input,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Ls(n.cause);if(t===void 0)return n;e.issues?e.issues.push(t):e.issues=[t]}else{if(e.out&&e.successes)return e.successes.push(t),oo(new Cs(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(t);else return so}}}),Zc=new Jc([new gc(`Infinity`),new gc(`-Infinity`),new gc(`NaN`)],`anyOf`);function Qc(e){return e?``:`readonly `}function $c(e){return e?`?`:``}var el=class e extends n{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(e,t){return new tl([this,e],t)}},tl=class e extends n{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,n){return new e([this,t],n)}};function nl(e,t,n=!1){return new el((t,n,r)=>Es(n,e(t,n,r),t,r),t,n)}function rl(e){return nl(e=>globalThis.Number.isFinite(e),{expected:`a finite number`,representation:{id:`effect/schema/isFinite`,payload:null},toJsonSchema:()=>({type:`number`}),toCode:()=>({runtime:`Schema.isFinite()`}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}var il=new lc(new Jc([fl(xc,[rl()]),Zc],`anyOf`),new Ys(qs(),Us(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function al(e,t){let n=e.source,r=new globalThis.RegExp(n,e.flags);return nl(e=>(r.lastIndex=0,r.test(e)),{expected:`a string matching the RegExp ${n}`,representation:{id:`effect/schema/isPattern`,payload:{source:n,flags:e.flags}},toJsonSchema:()=>({pattern:n}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function ol(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}var sl=new WeakMap;function cl(e){return sl.get(e)??e}function U(e,t){return e.encoding===t?e:ol(e,e=>{e.encoding.value=t})}function ll(e,t){if(e.context===t)return e;let n=cl(e);if(n.context===t)return n;let r=ol(e,e=>{e.context.value=t});return sl.set(r,n),r}function ul(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return dl(e,zn(e.checks.slice(0,-1),n.annotate(t)))}return ol(e,e=>{e.annotations.value={...e.annotations.value,...t}})}function dl(e,t){if(e._tag===`Suspend`&&t)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:ol(e,e=>{e.checks.value=t})}function fl(e,t){return dl(e,Fc(e.checks,t))}function pl(e,t){let n=t(e.to);return n===e.to?e:new lc(n,e.transformation)}function ml(e,t){let n=e,r=n[n.length-1],i=pl(r,t);return i===r?e:zn(e.slice(0,e.length-1),i)}function hl(e,t){function n(r){if(r.encoding){let e=r.encoding[r.encoding.length-1];return t?.stopAt?.(e)?r:U(r,ml(r.encoding,n))}return e(r)}return u(n)}function gl(e,t,n){let r=new lc(e,t);return U(n,n.encoding?[...n.encoding,r]:[r])}function _l(e,t){let n=!1,r=Array(e.length);for(let i=0;i<e.length;i++){let a=e[i],o=t(a);o!==a&&(n=!0),r[i]=o}return n?r:e}function vl(e,t){return ll(e,e.context?new dc(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new dc(!1,!1,void 0,t))}function yl(e,t){let n=new lc(hc,new Ys(Gs(t),Hs()));return ll(e,e.context?new dc(e.context.isOptional,e.context.isMutable,n,e.context.annotations):new dc(!1,!1,n))}function bl(e,t,n){return gl(e,n,t)}function xl(e){return e.context?.isOptional??!1}function Sl(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(Sl)}function Cl(e){function t(e){return Sl(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return Vn(n)?n:void 0}var wl=u(e=>{if(e.encoding)return wl(U(e,void 0));let t=e,n=t.recur?.(wl)??t,r=n.encodingChecks;if(r){let t=n===e?r:oc(n)||sc(n)||nc(n)&&n.typeParameters.length>0?Cl(r):void 0;return ol(n,e=>{e.encodingChecks.value=void 0,e.checks.value=Fc(n.checks,t)})}return n}),Tl=u(e=>wl(Dl(e)));function El(e,t){let n=t,r=n.length,i=n[r-1],a=[new lc(Dl(U(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new lc(Dl(n[e-1].to),n[e].transformation.flip()));let o=Dl(i.to);return o.encoding?U(o,[...o.encoding,...a]):U(o,a)}var Dl=l(e=>{if(e.encoding)return El(e,e.encoding);let t=e;return t.flip?.(Dl)??t.recur?.(Dl)??t});function Ol(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(Ol);default:return!1}}function kl(e,t){let n=ss(t);return(r,i)=>r===B?cs:r===t?n:z(new bs(e,r,i))}function Al(e,t){return(n,r)=>n===B?cs:t(n)?V:z(new bs(e,n,r))}var jl=hl(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(jl)}}),Ml=new globalThis.RegExp(`^${Dc}$`),Nl=new globalThis.RegExp(`^(?:${Dc}|Infinity|-Infinity|NaN)$`);function Pl(e){return al(Ml,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:Ml.source}),...e})}var Fl=fl(vc,[Pl()]),Il=new lc(Fl,ec),Ll=new lc(new Jc([Fl,Zc],`anyOf`),ec);function Rl(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`){if(n=Rl(o.checks,t,n,r,i),n&&(i.errors!==`all`||n[n.length-1].filter.aborted))return n}else{let e=o.run(t,r,i);if(e){let r=new hs(o,e,t,i);if(n?n.push(r):n=[r],i.errors!==`all`||o.aborted)return n}}}return n}function zl(e){if(!nc(e))return;let t=e.annotations?.[as];return g(t)?t(e.typeParameters):void 0}function Bl(e){let t=ql(Yl,wl(e.ast));return(e,n)=>t(e,n?.disableChecks?n?.parseOptions?{...n.parseOptions,disableChecks:!0}:{disableChecks:!0}:n?.parseOptions)}function Vl(e){let t=Bl(e);return(e,n)=>{let r=Oo(t(e,n));return co(r)?en(r.value):(Rs(r.cause,`Option adapter can only return none for schema issues`),$t())}}function Hl(e){let t=Bl(e);return(e,n)=>{let r=Oo(t(e,n));if(co(r))return r.value;let i=Rs(r.cause,`Constructor adapter can only throw schema issues`);throw Error(`Schema validation failed`,{cause:i})}}function Ul(e,t){let n=Kl(e.ast);return t===void 0?n:(e,r)=>n(e,Wl(t,r))}var Wl=(e,t)=>t?{...e,...t}:e,Gl=e=>e===B?z(new xs):go(e);function Kl(e){return ql(Jl,e)}function ql(e,t){let n;return(r,i)=>{let a=(n??=e(t))(r,i??uc);return a===V?go(r):R(a)?a[A]===B?Gl(B):a:jo(a,Gl)}}var Jl=l(e=>eu(e,Jl)),Yl=l(e=>eu(e,Yl,Zl)),Xl=l(e=>eu(e,Yl,Zl,e.context?.constructorDefault));function Zl(e){return e.context?.constructorDefault?Xl(e):Yl(e)}function Ql(e,t,n,r){let i;if(R(e)&&e._tag===`Success`){let a=ls(e===V?t:e[A]);i=n._tag===`Transformation`?n.decode.run(a,r):n.decode(ss(a),r)}else i=n._tag===`Transformation`?jo(e,e=>n.decode.run(ls(e),r)):n.decode(Ao(e,ls),r);return R(i)&&i._tag===`Success`?us(i[A]):jo(i,us)}function $l(e,t){let n;return(r,i)=>r===B?cs:e.isConstructed(r)?V:Ql((n??=t(e.link.to))(r,i),r,e.link.transformation,i)}function eu(e,t,n,r){let i=n?zl(e):void 0,a=i?$l(i,t):e.getParser(t,n),o=e.checks,s=r?e.encoding?[...e.encoding,r]:[r]:e.encoding,c=e.encodingChecks,l=(o?o[o.length-1].annotations:e.annotations)?.parseOptions;if(!s&&!o&&!c)return l?(e,t)=>a(e,Wl(t,l)):a;let u,d=(t,n)=>{let r=a(t,n);if(c&&!n.disableChecks)if(R(r)){if(r._tag===`Success`){let i=r===V?t:r[A];if(t!==B&&i!==B){let i=Rl(c,t,void 0,e,n);i&&(r=z(new H(e,i,t,n)))}}}else r=xo(r,r=>{if(t!==B&&r!==B){let r=Rl(c,t,void 0,e,n);if(r)return z(new H(e,r,t,n))}return go(r)});if(o&&!n.disableChecks)if(R(r)){if(r._tag===`Success`){let i=r===V?t:r[A];if(i===B)return r;let a=Rl(o,i,void 0,e,n);a&&(r=z(new H(e,a,i,n)))}}else r=xo(r,t=>{if(t!==B){let r=Rl(o,t,void 0,e,n);if(r)return z(new H(e,r,t,n))}return go(t)});return r};return s?(n,r)=>{l&&(r=Wl(r,l));let i=u??=s.map(e=>t(e.to)),a=n,o=i[i.length-1](n,r);for(let e=s.length-1;e>=0;e--)if(o=Ql(o,a,s[e].transformation,r),e!==0){let t=i[e-1];o._tag===`Success`?(a=o[A],o=t(a,r)):o=jo(o,e=>{let n=t(e,r);return n===V?ss(e):n})}if(o._tag===`Success`){let e=o[A],t=d(e,r);return t===V?o:t}return o=Co(o,t=>bo(()=>no(t,t=>new gs(e,t,n,r)))),jo(o,e=>{let t=d(e,r);return t===V?ss(e):t})}:l?(e,t)=>d(e,Wl(t,l)):d}var tu=`~effect/Schema/Schema`,nu={[tu]:tu,pipe(){return e(this,arguments)},annotate(e){return this.rebuild(ul(this.ast,e))},annotateKey(e){return this.rebuild(vl(this.ast,e))},check(...e){return this.rebuild(fl(this.ast,e))}};function ru(e,t){function n(){}let r=Object.defineProperties(Object.setPrototypeOf(n,nu),Object.getOwnPropertyDescriptors({...t}));return r.ast=e,r.rebuild=e=>ru(e,t),r.makeEffect=Bl(r),r.make=Hl(r),r.makeOption=Vl(r),r}var iu=e=>e,au=`~effect/SchemaError/SchemaError`,ou=class extends Fr(`SchemaError`){[au]=au;constructor(e){super({issue:e})}get message(){return Ps(this.issue)}toString(){return`SchemaError(${this.message})`}};function su(e){return b(e,au)&&e[au]===au}function cu(e,t){let n=Ul(e,t);return(e,t)=>lu(n(e,t))}function lu(e){return Co(e,e=>bo(()=>no(e,e=>new ou(e))))}function uu(e,t){let n;for(let r of e.reasons){if(!eo(r)||!su(r.error))throw new globalThis.Error(t,{cause:e});n??=r.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function du(e){let t=Oo(e);if(co(t))return t.value;throw uu(t.cause,`Sync adapter can only throw schema errors`)}function fu(e,t){let n=cu(e,t);return(e,t)=>du(n(e,t))}var W=ru;function pu(e){let t=W(new gc(e),{literal:e,transform(n){return t.pipe(xu(pu(n),{decode:Us(()=>n),encode:Us(()=>e)}))}});return t}var mu=W(mc),G=W(vc),hu=W(xc),gu=W(Sc);function _u(e,t){return W(e,{fields:t,mapFields(e,t){let n=e(this.fields);return _u(Ic(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function K(e){return _u(Ic(e,void 0),e)}function vu(e,t){return W(e,{elements:t,mapElements(e,t){let n=e(this.elements);return vu(Rc(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}var q=iu(e=>W(new Cc(!1,[],[e.ast]),{value:e}));function yu(e,t){return W(e,{members:t,mapMembers(e,t){let n=e(this.members);return yu(zc(n,this.ast.mode,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function bu(e,t){return yu(zc(e,t?.mode??`anyOf`,void 0),e)}function J(e){let t=e.map(pu);return W(zc(t,`anyOf`,void 0),{literals:e,members:t,mapMembers(e){return bu(e(this.members))},pick(e){return J(e)},transform(e){return bu(t.map((t,n)=>t.transform(e[n])))}})}var Y=iu(e=>bu([e,mu]));function xu(e,t){return n=>W(bl(n.ast,e.ast,t?Zs(t):$s()),{from:n,to:e})}function Su(e){return t=>W(yl(t.ast,e),{schema:t})}function X(e){return pu(e).pipe(Su(go(e)))}var Cu=nl;function wu(e){let t=Qt(e.order),n=e.formatter??k;return(r,i)=>Cu(e=>t(e,r),{expected:`a value greater than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r}}},...e.annotate?.(r),...i})}function Tu(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${k(e)}`);return e}var Eu=wu({order:Yt,annotate:e=>({representation:{id:`effect/schema/isGreaterThanOrEqualTo`,payload:{minimum:Tu(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${k(e)})`})})});function Du(e){return Cu(e=>globalThis.Number.isSafeInteger(e),{expected:`an integer`,representation:{id:`effect/schema/isInt`,payload:null},toJsonSchema:()=>({type:`integer`}),toCode:()=>({runtime:`Schema.isInt()`}),arbitrary:{constraint:{integer:!0}},...e})}var Ou=hu.check(Du()).check(Eu(0));globalThis.RegExp,globalThis.URL,globalThis.File,globalThis.FormData,globalThis.URLSearchParams,globalThis.Uint8Array;var ku=K({file:G,exportName:Y(G)}),Au=K({path:Y(G),kind:J([`state`,`initial`,`history`,`choice`,`update`,`none`]),scope:Y(J([`local`,`branch`,`full`,`initial`]))}),ju=K({target:G,selection:Au}),Mu=K({path:G,key:G,order:Ou,title:Y(G),description:Y(G),documentation:Y(G),type:J([`atomic`,`compound`,`parallel`,`final`,`history`,`choice`]),history:Y(J([`shallow`,`deep`])),parent:Y(G),children:q(G),initial:Y(G),transitionIds:q(G),activityIds:q(G)}),Nu=bu([K({type:X(`event`),event:G}),K({type:X(`always`)}),K({type:X(`done`)}),K({type:X(`choice`)}),K({type:X(`invoke`),id:G,outcome:J([`element`,`done`,`failure`,`snapshot`])})]),Pu={id:G,target:Y(G),selection:Au,updates:q(G)},Fu=bu([K({...Pu,type:X(`direct`)}),K({...Pu,type:X(`branch`),key:G,title:G})]),Iu=K({id:G,source:G,trigger:Nu,reenter:gu,acceptance:J([`required`,`declinable`]),branches:q(Fu)}),Lu={id:G,source:G,lifecycleId:G},Ru=bu([K({...Lu,type:X(`process`)}),K({...Lu,type:X(`effect`),outcomes:K({success:pu(`dynamic`),failure:J([`dynamic`,`none`])})}),K({...Lu,type:X(`timer`),duration:G}),K({...Lu,type:X(`stream`)}),K({...Lu,type:X(`machine`),child:K({id:G,machineId:Y(G)})})]),zu=K({activePaths:q(G),candidateEvents:q(G)}),Bu=K({schemaVersion:pu(1),revision:Ou,source:Y(ku),machineId:G,initial:ju,roots:q(G),states:q(Mu),transitions:q(Iu),activities:q(Ru),snapshot:Y(zu)}),Vu=K({file:G,line:Y(Ou),column:Y(Ou)}),Hu=K({severity:J([`warning`,`error`]),code:G,message:G,location:Y(Vu),statePath:Y(G)}),Uu={protocolVersion:pu(1),key:G},Wu=bu([K({...Uu,_tag:X(`Ready`),document:Bu,diagnostics:q(Hu)}),K({...Uu,_tag:X(`Partial`),document:Bu,diagnostics:q(Hu)}),K({...Uu,_tag:X(`Failed`),source:ku,machineId:Y(G),diagnostics:q(Hu)})]),Gu=K({protocolVersion:pu(1),revision:Ou,results:q(Wu)}),Ku=e=>({states:new Map(e.states.map(e=>[e.path,e])),order:new Map(e.states.map(e=>[e.path,e.order]))}),qu=(e,t)=>[...new Set(t)].sort((t,n)=>(e.order.get(t)??0)-(e.order.get(n)??0)),Ju=(e,t,n)=>{let r=e.states.get(t);r!==void 0&&(n.add(t),r.type===`parallel`?r.children.forEach(t=>Ju(e,t,n)):r.type===`compound`&&r.initial!==null&&Ju(e,r.initial,n))},Yu=(e,t)=>{let n=[],r=e.states.get(t);for(;r!==void 0;)n.unshift(r.path),r=r.parent===null?void 0:e.states.get(r.parent);return n},Xu=(e,t,n)=>{let r=Yu(e,t),i=Yu(e,n),a=null,o=Math.min(r.length,i.length);for(let e=0;e<o&&r[e]===i[e];e++)a=r[e]??null;return a},Zu=(e,t,n)=>t!==n&&Yu(e,t).includes(n),Qu=(e,t)=>{let n=new Set(t);return[...new Set(e.transitions.flatMap(e=>e.trigger.type===`event`&&n.has(e.source)?[e.trigger.event]:[]))].sort()},$u=(e,t,n,r)=>{let i=qu(t,r);return{step:n,activePaths:i,candidateEvents:Qu(e,i)}},ed=e=>{let t=Ku(e),n=new Set;return e.snapshot===null?(Yu(t,e.initial.target).forEach(e=>n.add(e)),Ju(t,e.initial.target,n)):e.snapshot.activePaths.forEach(e=>n.add(e)),{document:e,snapshot:$u(e,t,0,n)}},td=(e,t,n,r)=>({_tag:`Indeterminate`,event:t,transitionIds:n.map(e=>e.id),session:e.snapshot,reason:r}),nd=(e,t,n)=>{let r=new Set([`runtime-effects-skipped`]);t.reenter&&r.add(`reentry-lifecycles-skipped`),t.branches.some(e=>e.updates.length>0)&&r.add(`state-updates-skipped`);let i=new Set(n);return e.transitions.some(e=>i.has(e.source)&&(e.trigger.type===`always`||e.trigger.type===`choice`||e.trigger.type===`done`))&&r.add(`automatic-transitions-skipped`),[...r]},rd=(e,t,n)=>{let r=e.document,i=Ku(r);if(n===null)return{document:r,snapshot:$u(r,i,e.snapshot.step+1,e.snapshot.activePaths)};if(!i.states.has(n))return;let a=Xu(i,t.source,n),o=i.states.get(t.source)?.parent??null,s=t.reenter?o===null||a===null?null:Yu(i,a).length<=Yu(i,o).length?a:o:a,c=new Set(e.snapshot.activePaths);for(let e of c)(s===null||Zu(i,e,s))&&c.delete(e);return Yu(i,n).forEach(e=>{(s===null||e===s||Zu(i,e,s))&&c.add(e)}),Ju(i,n,c),{document:r,snapshot:$u(r,i,e.snapshot.step+1,c)}},id=(e,t)=>{let n=new Set(e.snapshot.activePaths),r=e.document.transitions.filter(e=>e.trigger.type===`event`&&e.trigger.event===t&&n.has(e.source));if(r.length===0)return{_tag:`Blocked`,event:t,transitionIds:[],session:e.snapshot,reason:`event-not-enabled`};if(r.length>1)return td(e,t,r,`multiple-transitions`);let i=r[0];if(i.acceptance===`declinable`)return td(e,t,r,`declinable-transition`);if(i.branches.length!==1||i.branches[0]?.type===`branch`)return td(e,t,r,`conditional-branches`);let a=i.branches[0];if(a.selection.kind===`history`)return td(e,t,r,`history-target`);if(a.selection.kind===`choice`)return td(e,t,r,`choice-target`);let o=rd(e,i,a.target);return o===void 0?td(e,t,r,`missing-target`):{_tag:`Applied`,event:t,transitionIds:[i.id],session:o.snapshot,notes:nd(e.document,i,o.snapshot.activePaths)}},ad=K({step:Ou,activePaths:q(G),candidateEvents:q(G)}),od=J([`runtime-effects-skipped`,`state-updates-skipped`,`reentry-lifecycles-skipped`,`automatic-transitions-skipped`]),sd={event:G,transitionIds:q(G),session:ad};bu([K({...sd,_tag:X(`Applied`),notes:q(od)}),K({...sd,_tag:X(`Blocked`),reason:pu(`event-not-enabled`)}),K({...sd,_tag:X(`Indeterminate`),reason:J([`multiple-transitions`,`declinable-transition`,`conditional-branches`,`history-target`,`choice-target`,`missing-target`])})]);var cd=ed,ld=id,ud=e=>e.title===null?e.key:`${e.title} (${e.key})`,dd=e=>{switch(e.trigger.type){case`event`:return e.trigger.event;case`always`:return`Always`;case`done`:return`On completion`;case`choice`:return`Choice`;case`invoke`:return`${e.trigger.id} · ${e.trigger.outcome}`}},fd=e=>{let t=new Set([e.initial.target]);for(let n of e.states)n.initial!==null&&t.add(n.initial);return t},pd=e=>{let t=new Map(e.states.map(e=>[e.path,e])),n=new Map(e.transitions.map(e=>[e.id,e])),r=new Map(e.activities.map(e=>[e.id,e])),i=new Set(e.snapshot?.activePaths??[]),a=fd(e),o=e.snapshot?.candidateEvents??[],s=e=>e.transitionIds.flatMap(e=>{let t=n.get(e);return t===void 0?[]:[t]}),c=e=>e.activityIds.flatMap(e=>{let t=r.get(e);return t===void 0?[]:[t]}),l=new Map;for(let t of e.transitions)for(let e of t.branches){if(e.target===null)continue;let n=l.get(e.target)??[];n.push({transition:t,branch:e}),l.set(e.target,n)}let u=e=>{let n=t.get(e);if(n!==void 0)return{path:n.path,label:ud(n),type:n.type,active:i.has(n.path),initial:a.has(n.path),transitionCount:n.transitionIds.length,activityCount:n.activityIds.length,children:n.children.flatMap(e=>{let t=u(e);return t===void 0?[]:[t]})}},d=e=>{let n=[],r=e;for(;r!==void 0;)n.unshift({path:r.path,label:ud(r)}),r=r.parent===null?void 0:t.get(r.parent);return n};return{machineId:e.machineId,roots:e.roots.flatMap(e=>{let t=u(e);return t===void 0?[]:[t]}),hasSnapshot:e.snapshot!==null,activePaths:[...i],candidateEvents:[...o],inspectState:e=>{let n=t.get(e);return n===void 0?void 0:{state:n,label:ud(n),active:i.has(e),initial:a.has(e),breadcrumbs:d(n),outgoing:s(n),incoming:[...l.get(e)??[]],activities:c(n)}},inspectEvent:t=>({event:t,candidate:o.includes(t),transitions:e.transitions.filter(e=>e.trigger.type===`event`&&e.trigger.event===t)})}},Z=(e,t,n)=>{let r=document.createElement(e);return t!==void 0&&(r.className=t),n!==void 0&&(r.textContent=n),r},md=e=>{let t=Z(`dl`,`metadata`);for(let[n,r]of e)t.append(Z(`dt`,void 0,n),Z(`dd`,void 0,r));return t},Q=(e,t=`neutral`)=>Z(`span`,`badge badge-${t}`,e),hd=(e,t,n)=>{let r=Z(`button`,`state-link`,t);return r.type=`button`,r.addEventListener(`click`,()=>n(e)),r},gd=(e,t)=>{let n=Z(`div`,`branch-row`),r=Z(`div`,`branch-main`);e.type===`branch`&&r.append(Q(e.title,`condition`)),r.append(Z(`span`,`branch-arrow`,`→`)),e.target===null?r.append(Z(`span`,`branch-target`,e.updates.length>0?`Remain in state`:`No target`)):r.append(hd(e.target,e.target,t)),n.append(r);let i=[[`Selection`,e.selection.kind],[`Scope`,e.selection.scope??`none`]];if(n.append(md(i)),e.updates.length>0){let r=Z(`div`,`branch-updates`);r.append(Z(`span`,`branch-updates-label`,`Updates`)),e.updates.forEach(e=>r.append(hd(e,e,t))),n.append(r)}return n},_d=(e,t,n=!1)=>{let r=Z(`article`,`inspection-card transition-card`),i=Z(`div`,`card-header`),a=Z(`div`,`card-title`);a.append(Q(e.trigger.type,`trigger`),Z(`strong`,void 0,dd(e)));let o=Z(`div`,`card-flags`);if(e.reenter&&o.append(Q(`reenter`)),e.acceptance===`declinable`&&o.append(Q(`declinable`)),i.append(a,o),r.append(i),n){let n=Z(`div`,`transition-source`);n.append(Z(`span`,void 0,`From`),hd(e.source,e.source,t)),r.append(n)}let s=Z(`div`,`branch-list`);return e.branches.length===0?s.append(Z(`div`,`empty-inline`,`No transition branches`)):e.branches.forEach(e=>s.append(gd(e,t))),r.append(s),r},vd=(e,t)=>{let n=Z(`article`,`inspection-card incoming-card`),r=Z(`div`,`card-header`),i=Z(`div`,`card-title`);i.append(Q(e.transition.trigger.type,`trigger`),Z(`strong`,void 0,dd(e.transition))),r.append(i,hd(e.transition.source,e.transition.source,t)),n.append(r);let a=[[`Selection`,e.branch.selection.kind],[`Scope`,e.branch.selection.scope??`none`]];return e.branch.type===`branch`&&a.unshift([`Branch`,e.branch.title]),n.append(md(a)),n},yd=e=>{switch(e.type){case`process`:case`effect`:case`timer`:case`stream`:return e.lifecycleId;case`machine`:return`${e.lifecycleId} → ${e.child.machineId??e.child.id}`}},bd=e=>{let t=Z(`article`,`inspection-card activity-card`),n=Z(`div`,`card-header`),r=Z(`div`,`card-title`);r.append(Q(e.type,`activity`),Z(`strong`,void 0,yd(e))),n.append(r),t.append(n);let i=[[`Owner`,e.source]];return e.type===`timer`&&i.push([`Duration`,e.duration]),e.type===`effect`&&i.push([`Success`,e.outcomes.success],[`Failure`,e.outcomes.failure]),e.type===`machine`&&i.push([`Child address`,e.child.id],[`Machine`,e.child.machineId??`dynamic`]),t.append(md(i)),t},xd=(e,t)=>{let n=Z(`div`,`section-heading`);return n.append(Z(`h3`,void 0,e),Z(`span`,`section-count`,String(t))),n},Sd=e=>e._tag===`Applied`?`${e.event} applied · runtime code was skipped`:e._tag===`Blocked`?`${e.event} is not enabled in the current topology`:`${e.event} was not applied · ${{"multiple-transitions":`multiple active transitions`,"declinable-transition":`acceptance depends on runtime code`,"conditional-branches":`the selected branch depends on runtime code`,"history-target":`history resolution needs runtime state`,"choice-target":`choice resolution needs runtime code`,"missing-target":`the target is not present in the document`}[e.reason]}`,Cd=(e,t,n=[])=>{let r=pd(t),i=new Map,a=new Map,o=new Map,s=new Map,c=new Set,l,u,d,f=()=>d?.snapshot.activePaths??r.activePaths,p=()=>d?.snapshot.candidateEvents??r.candidateEvents,m=Z(`main`,`app-shell`),h=Z(`section`,`workspace`),g=Z(`section`,`tree-panel`);g.setAttribute(`aria-label`,`${r.machineId} topology`);let _=Z(`aside`,`inspector`);_.setAttribute(`aria-live`,`polite`);let v=Z(`button`,`toolbar-button`,`Clear selection`);v.type=`button`,v.disabled=!0;let ee=Z(`button`,`toolbar-button`,`Expand all`);ee.type=`button`;let y=Z(`button`,`toolbar-button`,`Collapse all`);y.type=`button`;let b=Z(`button`,`toolbar-button`,`Reveal active`);b.type=`button`,b.disabled=r.activePaths.length===0;let x=Z(`button`,`toolbar-button`,`Start simulation`);x.type=`button`,x.disabled=r.roots.length===0;let S=()=>{_.replaceChildren();let e=Z(`div`,`inspector-empty`);e.append(Z(`span`,`inspector-empty-kind`,`Machine`)),e.append(Z(`h2`,void 0,t.machineId)),e.append(md([[`Source`,t.source?.file??`in memory`],[`Export`,t.source?.exportName??`none`],[`Initial`,t.initial.target],[`Selection`,t.initial.selection.kind],[`Revision`,String(t.revision)]])),e.append(Z(`p`,void 0,`Select a state to inspect its transitions and activities.`)),_.append(e)},te=e=>{_.replaceChildren();let t=Z(`header`,`inspector-header`),n=Z(`nav`,`breadcrumbs`);n.setAttribute(`aria-label`,`State path`),e.breadcrumbs.forEach((e,t)=>{t>0&&n.append(Z(`span`,`breadcrumb-separator`,`/`)),n.append(hd(e.path,e.label,se))});let r=Z(`div`,`inspector-eyebrow`);if(r.append(Q(e.state.type,`state`)),f().includes(e.state.path)&&r.append(Q(`active`,`active`)),e.initial&&r.append(Q(`initial`,`initial`)),t.append(n,r,Z(`h2`,void 0,e.label)),t.append(md([[`Path`,e.state.path],[`Parent`,e.state.parent??`root`],[`Children`,String(e.state.children.length)],[`Initial child`,e.state.initial??`none`],[`History`,e.state.history??`none`]])),e.state.description!==null||e.state.documentation!==null){let n=Z(`div`,`state-annotations`);e.state.description!==null&&n.append(Z(`p`,`state-description`,e.state.description)),e.state.documentation!==null&&n.append(Z(`p`,`state-documentation`,e.state.documentation)),t.append(n)}_.append(t);let i=Z(`section`,`inspector-section`);i.append(xd(`Transitions`,e.outgoing.length)),e.outgoing.length===0?i.append(Z(`p`,`section-empty`,`No transitions leave this state.`)):e.outgoing.forEach(e=>i.append(_d(e,se))),_.append(i);let a=Z(`section`,`inspector-section`);if(a.append(xd(`Entered by`,e.incoming.length)),e.incoming.length===0?a.append(Z(`p`,`section-empty`,`No transitions target this state.`)):e.incoming.forEach(e=>a.append(vd(e,se))),_.append(a),e.activities.length>0){let t=Z(`section`,`inspector-section`);t.append(xd(`Activities`,e.activities.length)),e.activities.forEach(e=>t.append(bd(e))),_.append(t)}},C=e=>{_.replaceChildren();let t=Z(`header`,`inspector-header`),n=Z(`div`,`inspector-eyebrow`);n.append(Q(`event`,`trigger`));let r=p().includes(e.event);r&&n.append(Q(`enabled`,`active`)),t.append(n,Z(`h2`,void 0,e.event)),t.append(md([[`Status`,r?`enabled`:`not enabled`],[`Registrations`,String(e.transitions.length)]])),_.append(t);let i=Z(`section`,`inspector-section`);i.append(xd(`Transitions`,e.transitions.length)),e.transitions.forEach(e=>i.append(_d(e,se,!0))),_.append(i)},ne=()=>{for(let e of c)a.get(e)?.classList.remove(`is-related-source`,`is-related-target`,`is-related-update`);c.clear()},re=()=>{l!==void 0&&(a.get(l)?.classList.remove(`is-selected`),i.get(l)?.setAttribute(`aria-selected`,`false`)),u!==void 0&&s.get(u)?.classList.remove(`is-selected`),ne(),l=void 0,u=void 0,v.disabled=!0,S()},ie=e=>{for(let t of e){c.add(t.source),a.get(t.source)?.classList.add(`is-related-source`);for(let e of t.branches){e.target!==null&&(c.add(e.target),a.get(e.target)?.classList.add(`is-related-target`));for(let t of e.updates)c.add(t),a.get(t)?.classList.add(`is-related-update`)}}},w=e=>{ne();for(let t of e.incoming)c.add(t.transition.source),a.get(t.transition.source)?.classList.add(`is-related-source`);ie(e.outgoing)},ae=e=>{for(let t of e.breadcrumbs.slice(0,-1)){let e=i.get(t.path),n=a.get(t.path)?.querySelector(`:scope > .topology-children`);if(e===void 0||n==null)continue;e.setAttribute(`aria-expanded`,`true`),n.hidden=!1;let r=e.querySelector(`.state-disclosure`);r!==null&&(r.textContent=`▾`)}},oe=(e,t)=>{let n=r.inspectState(e);n!==void 0&&(ae(n),l!==void 0&&(a.get(l)?.classList.remove(`is-selected`),i.get(l)?.setAttribute(`aria-selected`,`false`)),u!==void 0&&s.get(u)?.classList.remove(`is-selected`),l=e,u=void 0,a.get(e)?.classList.add(`is-selected`),i.get(e)?.setAttribute(`aria-selected`,`true`),w(n),v.disabled=!1,te(n),t&&(i.get(e)?.focus({preventScroll:!0}),i.get(e)?.scrollIntoView({block:`nearest`})))};function se(e){oe(e,!0)}let ce=e=>{let t=r.inspectEvent(e);l!==void 0&&(a.get(l)?.classList.remove(`is-selected`),i.get(l)?.setAttribute(`aria-selected`,`false`)),u!==void 0&&s.get(u)?.classList.remove(`is-selected`),l=void 0,u=e,s.get(e)?.classList.add(`is-selected`),ne(),ie(t.transitions),v.disabled=!1,C(t)},le=(e,t)=>{let n=e.closest(`.topology-node`)?.querySelector(`:scope > .topology-children`);if(n==null)return;e.setAttribute(`aria-expanded`,String(t)),n.hidden=!t;let r=e.querySelector(`.state-disclosure`);r!==null&&(r.textContent=t?`▾`:`▸`)},ue=(e,t)=>{let n=Z(`div`,`topology-node`);n.dataset.statePath=e.path,a.set(e.path,n);let r=Z(`button`,`state-row`);r.type=`button`,r.tabIndex=-1,r.setAttribute(`role`,`treeitem`),r.setAttribute(`aria-level`,String(t+1)),r.setAttribute(`aria-selected`,`false`),r.style.setProperty(`--depth`,String(t)),r.dataset.statePath=e.path,i.set(e.path,r);let s=Z(`span`,`state-disclosure`,e.children.length===0?``:`▾`),c=Z(`span`,`state-status${e.active?` is-active`:``}`);c.setAttribute(`aria-label`,e.active?`active`:`inactive`),o.set(e.path,c);let l=Z(`span`,`state-label`,e.label),u=Z(`span`,`state-markers`);if(e.initial&&u.append(Q(`initial`,`initial`)),e.type!==`atomic`&&u.append(Q(e.type,`state`)),e.transitionCount>0&&u.append(Q(`${e.transitionCount}t`,`count`)),e.activityCount>0&&u.append(Q(`${e.activityCount}a`,`count`)),r.append(s,c,l,u),n.append(r),r.addEventListener(`focus`,()=>{i.forEach(e=>e.tabIndex=e===r?0:-1)}),e.children.length>0){let i=Z(`div`,`topology-children`);i.setAttribute(`role`,`group`),e.children.forEach(e=>i.append(ue(e,t+1))),n.append(i),r.setAttribute(`aria-expanded`,`true`),r.addEventListener(`click`,()=>{let t=r.getAttribute(`aria-expanded`)===`true`;le(r,!t),oe(e.path,!1)})}else r.addEventListener(`click`,()=>oe(e.path,!1));return n},de=e=>{g.querySelectorAll(`.state-row[aria-expanded]`).forEach(t=>{le(t,e)})};v.addEventListener(`click`,re),ee.addEventListener(`click`,()=>de(!0)),y.addEventListener(`click`,()=>de(!1)),b.addEventListener(`click`,()=>{let e=[...f()].sort((e,t)=>t.split(`.`).length-e.split(`.`).length)[0];e!==void 0&&se(e)});let fe=Z(`div`,`toolbar`),pe=Z(`div`,`runtime-summary`),me=Z(`span`,`runtime-dot`),T=Z(`span`);pe.append(me,T);let E=Z(`div`,`toolbar-actions`);E.append(v,x,b,ee,y),fe.append(pe,E);let D=Z(`div`,`topology-tree`);D.setAttribute(`role`,`tree`),D.setAttribute(`aria-label`,`${r.machineId} states`),D.append(Z(`div`,`machine-id`,r.machineId));let he=Z(`div`,`enabled-events`),O=Z(`div`,`simulation-feedback`);O.setAttribute(`role`,`status`),D.append(he,O);let ge=()=>{he.replaceChildren(Z(`span`,`enabled-events-label`,`Enabled`)),s.clear();let e=p();if(e.length===0){he.append(Z(`span`,`enabled-events-empty`,`none`));return}e.forEach(e=>{let n=Z(`button`,`event-button${e===u?` is-selected`:``}`,e);n.type=`button`,n.addEventListener(`click`,()=>{if(d!==void 0){let n=ld(d,e);n._tag===`Applied`&&(d={document:t,snapshot:n.session}),O.textContent=Sd(n),O.dataset.status=n._tag.toLowerCase(),_e()}ce(e)}),s.set(e,n),he.append(n)})},_e=()=>{let e=new Set(f());o.forEach((t,n)=>{let r=e.has(n);t.classList.toggle(`is-active`,r),t.setAttribute(`aria-label`,r?`active`:`inactive`)});let t=d!==void 0||r.hasSnapshot;if(me.classList.toggle(`has-snapshot`,t),T.textContent=d===void 0?n.length>0?`Partial`:r.hasSnapshot?`${e.size} active`:`Structure only`:`${e.size} active · step ${d.snapshot.step}`,x.textContent=d===void 0?`Start simulation`:`Reset simulation`,b.disabled=e.size===0,he.hidden=!t,O.hidden=d===void 0,ge(),l!==void 0){let e=r.inspectState(l);e!==void 0&&te(e)}else u!==void 0&&C(r.inspectEvent(u))};if(x.addEventListener(`click`,()=>{d===void 0?(d=cd(t),O.textContent=`Best-effort simulation started · user code will not run`,O.dataset.status=`applied`):(d=void 0,O.textContent=``,delete O.dataset.status),_e()}),r.roots.length===0){let e=Z(`div`,`topology-empty`);e.append(Z(`strong`,void 0,`No states yet`),Z(`span`,void 0,`The topology will appear as the machine definition becomes available.`)),D.append(e)}else r.roots.forEach(e=>D.append(ue(e,0)));if(_e(),i.values().next().value?.setAttribute(`tabindex`,`0`),D.addEventListener(`keydown`,e=>{let t=e.target instanceof HTMLElement?e.target.closest(`.state-row`):null;if(t===null)return;let n=[...i.values()].filter(e=>e.getClientRects().length>0),r=n.indexOf(t),a=t=>{t!==void 0&&(e.preventDefault(),t.focus())};switch(e.key){case`ArrowDown`:a(n[r+1]);break;case`ArrowUp`:a(n[r-1]);break;case`Home`:a(n[0]);break;case`End`:a(n.at(-1));break;case`ArrowRight`:if(t.getAttribute(`aria-expanded`)===`false`)e.preventDefault(),le(t,!0);else{let e=t.closest(`.topology-node`)?.querySelector(`:scope > .topology-children > .topology-node > .state-row`);a(e??void 0)}break;case`ArrowLeft`:if(t.getAttribute(`aria-expanded`)===`true`)e.preventDefault(),le(t,!1);else{let e=t.closest(`.topology-children`)?.closest(`.topology-node`)?.querySelector(`:scope > .state-row`);a(e??void 0)}break;case`Enter`:case` `:e.preventDefault(),t.click();break;case`Escape`:e.preventDefault(),re();break}}),g.append(fe),n.length>0){let e=Z(`div`,`diagnostics`);e.setAttribute(`role`,`status`),n.forEach(t=>{let n=Z(`div`,`diagnostic diagnostic-${t.severity}`);n.append(Q(t.severity,t.severity),Z(`span`,void 0,t.message)),t.statePath!==null&&r.inspectState(t.statePath)!==void 0&&n.append(hd(t.statePath,t.statePath,se)),e.append(n)}),g.append(e)}g.append(D),S(),h.append(g,_),m.append(h),e.replaceChildren(m)},wd=(e,t)=>{let n=document.createElement(`main`);n.className=`failure-shell`,n.setAttribute(`role`,`alert`);let r=document.createElement(`span`);r.className=`failure-kind`,r.textContent=`Visualizer error`;let i=document.createElement(`h1`);i.textContent=`Machine could not be inspected`;let a=document.createElement(`pre`);a.textContent=t.diagnostics.map(e=>e.message).join(`
|
|
14
|
-
`);let o=document.createElement(`p`);o.textContent=`Fix the machine definition and the page will reload.`,n.append(r,i,a,o),e.replaceChildren(n)},Td=(e,t)=>{switch(t._tag){case`Ready`:case`Partial`:Cd(e,t.document,t.diagnostics);break;case`Failed`:wd(e,t);break}},Ed,$=(e,t,n)=>{let r=document.createElement(e);return t!==void 0&&(r.className=t),n!==void 0&&(r.textContent=n),r},Dd=e=>e._tag===`Ready`||e._tag===`Partial`?e.document.machineId:e.machineId??e.source.exportName??e.source.file.split(/[\\/]/).at(-1)??e.key,Od=e=>e._tag===`Ready`||e._tag===`Partial`?e.document.source?.file??`unknown source`:e.source.file,kd=e=>{switch(e._tag){case`Ready`:return`ready`;case`Partial`:return`partial`;case`Failed`:return`error`}},Ad=(e,t)=>{let n=[...t.results].sort((e,t)=>Dd(e).localeCompare(Dd(t)));(Ed===void 0||!n.some(e=>e.key===Ed))&&(Ed=n[0]?.key);let r=$(`main`,`devtools-shell`),i=$(`nav`,`machine-index`);i.setAttribute(`aria-label`,`Machines`);let a=$(`div`,`machine-view`);if(n.length===0){i.append($(`div`,`machine-index-empty`,`No machines`));let e=$(`div`,`registry-empty`);e.append($(`strong`,void 0,`No .handle machines found`),$(`span`,void 0,`The list updates when a matching source file changes.`)),a.append(e)}else{for(let r of n){let n=$(`button`,`machine-row${r.key===Ed?` is-selected`:``}`);n.type=`button`,n.dataset.machineKey=r.key,n.setAttribute(`aria-current`,r.key===Ed?`true`:`false`);let a=$(`span`,`machine-row-label`,Dd(r)),o=$(`span`,`machine-row-file`,Od(r)),s=$(`span`,`machine-row-status status-${kd(r)}`);s.setAttribute(`aria-label`,kd(r)),n.append(s,a,o),n.addEventListener(`click`,()=>{Ed=r.key,Ad(e,t)}),i.append(n)}let r=n.find(e=>e.key===Ed)??n[0];r!==void 0&&Td(a,r)}r.append(i,a),e.replaceChildren(r)},jd=document.querySelector(`#app`);if(jd===null)throw Error(`Visualizer root element was not found`);var Md=e=>{let t=document.createElement(`div`);t.className=`connection-failure`,t.textContent=e,jd.replaceChildren(t)};To(Eo(_o(()=>new EventSource(`/api/events`)),e=>_o(()=>e.close())).pipe(xo(e=>yo((t,n)=>{e.onmessage=e=>{try{Ad(jd,fu(Gu)(JSON.parse(e.data)))}catch(e){Md(e instanceof Error?e.message:String(e))}},e.onerror=()=>{e.readyState===EventSource.CLOSED&&Md(`The visualizer server disconnected. Restart the command to reconnect.`)},n.addEventListener(`abort`,()=>e.close(),{once:!0})})))).pipe(zo);
|