@knpkv/alchemy-console 0.2.1 → 0.3.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.
@@ -1,2834 +0,0 @@
1
- //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Pipeable.js
2
- var e = (e, t) => {
3
- switch (t.length) {
4
- case 0: return e;
5
- case 1: return t[0](e);
6
- case 2: return t[1](t[0](e));
7
- case 3: return t[2](t[1](t[0](e)));
8
- case 4: return t[3](t[2](t[1](t[0](e))));
9
- case 5: return t[4](t[3](t[2](t[1](t[0](e)))));
10
- case 6: return t[5](t[4](t[3](t[2](t[1](t[0](e))))));
11
- case 7: return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));
12
- case 8: return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));
13
- case 9: return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));
14
- default: {
15
- let n = e;
16
- for (let e = 0, r = t.length; e < r; e++) n = t[e](n);
17
- return n;
18
- }
19
- }
20
- }, t = function(e, t) {
21
- if (typeof e == "function") return function() {
22
- return e(arguments) ? t.apply(this, arguments) : (e) => t(e, ...arguments);
23
- };
24
- switch (e) {
25
- case 0:
26
- case 1: throw RangeError(`Invalid arity ${e}`);
27
- case 2: return function(e, n) {
28
- return arguments.length >= 2 ? t(e, n) : function(n) {
29
- return t(n, e);
30
- };
31
- };
32
- case 3: return function(e, n, r) {
33
- return arguments.length >= 3 ? t(e, n, r) : function(r) {
34
- return t(r, e, n);
35
- };
36
- };
37
- default: return function() {
38
- if (arguments.length >= e) return t.apply(this, arguments);
39
- let n = arguments;
40
- return function(e) {
41
- return t(e, ...n);
42
- };
43
- };
44
- }
45
- }, n = (e) => e, r = (e) => () => e, i = /*#__PURE__*/ r(!0), a = /*#__PURE__*/ r(!1), o = /*#__PURE__*/ r(void 0), s = o, c = (e) => {
46
- let t = new Set(Reflect.ownKeys(e));
47
- if (e.constructor === Object) return t;
48
- e instanceof Error && t.delete("stack");
49
- let n = Object.getPrototypeOf(e), r = n;
50
- for (; r !== null && r !== Object.prototype;) {
51
- let e = Reflect.ownKeys(r);
52
- for (let n = 0; n < e.length; n++) t.add(e[n]);
53
- r = Object.getPrototypeOf(r);
54
- }
55
- return t.has("constructor") && typeof e.constructor == "function" && n === e.constructor.prototype && t.delete("constructor"), t;
56
- }, l = /*#__PURE__*/ new WeakSet(), ee = (e) => new Uint8Array(e.buffer, e.byteOffset, e.byteLength), u = 0, te = () => {
57
- u++;
58
- };
59
- //#endregion
60
- //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Predicate.js
61
- function ne(e) {
62
- return typeof e == "string";
63
- }
64
- function re(e) {
65
- return typeof e == "number";
66
- }
67
- function ie(e) {
68
- return typeof e == "function";
69
- }
70
- function ae(e) {
71
- return typeof e == "object" && !!e || ie(e);
72
- }
73
- var d = /*#__PURE__*/ t(2, (e, t) => ae(e) && t in e), f = "~effect/Hash", p = (e) => {
74
- switch (typeof e) {
75
- case "number": return le(e);
76
- case "bigint": return g(e.toString(10));
77
- case "string": return g(e);
78
- case "function":
79
- case "object":
80
- if (e === null) break;
81
- if (e instanceof Date) return Number.isNaN(e.getTime()) ? g("Invalid Date") : g(e.toISOString());
82
- if (e instanceof RegExp) return g(e.toString());
83
- {
84
- if (l.has(e)) return oe(e);
85
- let t = ve.get(e);
86
- if (t !== void 0) return t;
87
- if (ye.has(e)) return te(), g("[Circular]");
88
- ye.add(e);
89
- let n = u, r;
90
- try {
91
- r = "~effect/Hash" in e ? e[f]() : typeof e == "function" ? oe(e) : e instanceof DataView ? pe(ee(e)) : Array.isArray(e) || ArrayBuffer.isView(e) ? pe(e) : e instanceof Map ? me(e) : e instanceof Set ? ge(e) : de(e);
92
- } finally {
93
- ye.delete(e);
94
- }
95
- return n === u && ve.set(e, r), r;
96
- }
97
- }
98
- return h(se(g(String(e))));
99
- }, oe = (e) => (_e.has(e) || _e.set(e, h(Math.random() * 4294967296 | 0)), _e.get(e)), se = (e) => (e ^= e >>> 16, e = Math.imul(e, 2246822507), e ^= e >>> 13, e = Math.imul(e, 3266489909), e ^ e >>> 16), m = /*#__PURE__*/ t(2, (e, t) => se(Math.imul(e, 2654435761) + Math.imul(t, 2246822507))), h = (e) => e & 3221225471 | e >>> 1 & 1073741824, ce = /*#__PURE__*/ new DataView(/*#__PURE__*/ new ArrayBuffer(8)), le = (e) => {
100
- let t = e | 0;
101
- return t === e ? h(t) : (ce.setFloat64(0, e === e ? e : NaN), h(m(ce.getInt32(0), ce.getInt32(4))));
102
- }, g = (e) => {
103
- let t = 5381, n = e.length;
104
- for (; n;) t = t * 33 ^ e.charCodeAt(--n);
105
- return h(t);
106
- }, ue = (e, t) => {
107
- let n = 12289;
108
- for (let r of t) n ^= m(p(r), p(e[r]));
109
- return h(n);
110
- }, de = (e) => ue(e, c(e)), fe = (e, t) => (n) => {
111
- let r = e;
112
- for (let e of n) r ^= t(e);
113
- return h(r);
114
- }, pe = (e) => {
115
- let t = 6151;
116
- for (let n of e) t = m(t, p(n));
117
- return h(t);
118
- }, me = /*#__PURE__*/ fe(/*#__PURE__*/ g("Map"), ([e, t]) => m(p(e), p(t))), he = /*#__PURE__*/ g("Set"), ge = /*#__PURE__*/ fe(he, (e) => m(he, p(e))), _e = /*#__PURE__*/ new WeakMap(), ve = /*#__PURE__*/ new WeakMap(), ye = /*#__PURE__*/ new WeakSet(), _ = "~effect/Equal";
119
- function v() {
120
- return arguments.length === 1 ? (e) => y(e, arguments[0]) : y(arguments[0], arguments[1]);
121
- }
122
- function y(e, t) {
123
- if (e === t) return !0;
124
- if (e == null || t == null) return !1;
125
- let n = typeof e;
126
- return n === typeof t ? n === "number" && e !== e && t !== t ? !0 : n !== "object" && n !== "function" || l.has(e) || l.has(t) ? !1 : be(e, t) : !1;
127
- }
128
- function be(e, t) {
129
- let n = Se.length;
130
- for (let r = n; r-- > 0;) if (Se[r] === e && Ce[r] === t) return !0;
131
- if (n) return xe(e, t);
132
- let r = we.get(e);
133
- r || we.set(e, r = /* @__PURE__ */ new WeakMap());
134
- let i = r.get(t);
135
- return i === void 0 && r.set(t, i = xe(e, t)), i;
136
- }
137
- function xe(e, t) {
138
- Se.push(e), Ce.push(t);
139
- try {
140
- return Te(e, t);
141
- } finally {
142
- Se.pop(), Ce.pop();
143
- }
144
- }
145
- var Se = [], Ce = [], we = /*#__PURE__*/ new WeakMap();
146
- function Te(e, t) {
147
- if (p(e) !== p(t)) return !1;
148
- if (e instanceof Date) {
149
- if (!(t instanceof Date)) return !1;
150
- let n = e.getTime(), r = t.getTime();
151
- return n === r || Number.isNaN(n) && Number.isNaN(r);
152
- }
153
- if (e instanceof RegExp) return t instanceof RegExp && e.toString() === t.toString();
154
- let n = Me(e);
155
- if (n !== Me(t) || typeof e == "function" && !n) return !1;
156
- if (n) return e[_](t);
157
- if (Array.isArray(e)) return !Array.isArray(t) || e.length !== t.length ? !1 : Ee(e, t);
158
- if (ArrayBuffer.isView(e)) {
159
- let n = e instanceof DataView;
160
- return !ArrayBuffer.isView(t) || e.byteLength !== t.byteLength || n !== t instanceof DataView ? !1 : n ? De(ee(e), ee(t)) : De(e, t);
161
- }
162
- return e instanceof Map ? !(t instanceof Map) || e.size !== t.size ? !1 : ke(e, t, Ae, je) : e instanceof Set ? !(t instanceof Set) || e.size !== t.size ? !1 : ke(e, t, p, y) : Oe(e, t);
163
- }
164
- function Ee(e, t) {
165
- for (let n = 0; n < e.length; n++) if (!y(e[n], t[n])) return !1;
166
- return !0;
167
- }
168
- function De(e, t) {
169
- if (e.length !== t.length) return !1;
170
- for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
171
- return !0;
172
- }
173
- function Oe(e, t) {
174
- let n = c(e), r = c(t);
175
- if (n.size !== r.size) return !1;
176
- for (let i of n) if (!r.has(i) || !y(e[i], t[i])) return !1;
177
- return !0;
178
- }
179
- function ke(e, t, n, r) {
180
- let i = /* @__PURE__ */ new Map();
181
- for (let e of t) {
182
- let t = n(e), r = i.get(t);
183
- r ? r.push(e) : i.set(t, [e]);
184
- }
185
- outer: for (let t of e) {
186
- let e = i.get(n(t));
187
- if (e) {
188
- for (let n = 0; n < e.length; n++) if (r(t, e[n])) {
189
- e[n] = e[e.length - 1], e.pop();
190
- continue outer;
191
- }
192
- }
193
- return !1;
194
- }
195
- return !0;
196
- }
197
- var Ae = (e) => p(e[0]), je = (e, t) => y(e[0], t[0]) && y(e[1], t[1]), Me = (e) => d(e, _), Ne = /*#__PURE__*/ Symbol.for("~effect/Redactable"), Pe = (e) => d(e, Ne);
198
- function Fe(e) {
199
- return Pe(e) ? Ie(e) : e;
200
- }
201
- function Ie(e) {
202
- return e[Ne](globalThis["~effect/Fiber/currentFiber"]?.context ?? ze);
203
- }
204
- var Le = "~effect/Fiber/currentFiber", Re = /*#__PURE__*/ new Map(), ze = {
205
- "~effect/Context": {},
206
- base: Re,
207
- depth: 0,
208
- mapUnsafe: Re,
209
- pipe() {
210
- return e(this, arguments);
211
- }
212
- };
213
- //#endregion
214
- //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Formatter.js
215
- function b(e, t) {
216
- let n = t?.space ?? 0, r = /* @__PURE__ */ new WeakSet(), i = n ? typeof n == "number" ? " ".repeat(n) : n : "", a = (e) => i.repeat(e), o = (e, t) => {
217
- let n = e?.constructor;
218
- return n && n !== Object.prototype.constructor && n.name ? `${n.name}(${t})` : t;
219
- }, s = (e) => {
220
- try {
221
- return Reflect.ownKeys(e);
222
- } catch {
223
- return ["[ownKeys threw]"];
224
- }
225
- };
226
- function c(e, t = 0) {
227
- try {
228
- return l(e, t);
229
- } catch {
230
- return (typeof e == "object" && e || typeof e == "function") && r.delete(e), "[inspection threw]";
231
- }
232
- }
233
- function l(e, n = 0) {
234
- if (typeof e == "string") return JSON.stringify(e);
235
- if (typeof e == "number" || e == null || typeof e == "boolean" || typeof e == "symbol") return String(e);
236
- if (typeof e == "bigint") return String(e) + "n";
237
- if (typeof e == "object" || typeof e == "function") {
238
- if (r.has(e)) return Be;
239
- r.add(e);
240
- let l;
241
- if (Ne in e) l = c(Ie(e), n);
242
- 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(",\n" + a(n + 1))}\n${a(n)}]`;
243
- else if (e instanceof Date) l = He(e);
244
- else if (!t?.ignoreToString && d(e, "toString") && typeof e.toString == "function" && e.toString !== Object.prototype.toString && e.toString !== Array.prototype.toString) {
245
- let t = Ue(e);
246
- l = e instanceof Error && e.cause !== void 0 ? `${t} (cause: ${c(e.cause, n)})` : t;
247
- } else if (Symbol.iterator in e) l = `${e.constructor.name}(${c(Array.from(e), n)})`;
248
- else {
249
- let t = s(e);
250
- if (!i || t.length <= 1) {
251
- let r = `{${t.map((t) => `${Ve(t)}:${c(We(e, t), n)}`).join(",")}}`;
252
- l = o(e, r);
253
- } else {
254
- let r = `{\n${t.map((t) => `${a(n + 1)}${Ve(t)}: ${c(We(e, t), n + 1)}`).join(",\n")}\n${a(n)}}`;
255
- l = o(e, r);
256
- }
257
- }
258
- return r.delete(e), l;
259
- }
260
- return String(e);
261
- }
262
- return c(e, 0);
263
- }
264
- var Be = "[Circular]";
265
- function Ve(e) {
266
- return typeof e == "string" ? JSON.stringify(e) : String(e);
267
- }
268
- function He(e) {
269
- try {
270
- return e.toISOString();
271
- } catch {
272
- return "Invalid Date";
273
- }
274
- }
275
- function Ue(e) {
276
- try {
277
- let t = e.toString();
278
- return typeof t == "string" ? t : String(t);
279
- } catch {
280
- return "[toString threw]";
281
- }
282
- }
283
- function We(e, t) {
284
- try {
285
- return e[t];
286
- } catch {
287
- return "[property access threw]";
288
- }
289
- }
290
- //#endregion
291
- //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Inspectable.js
292
- var x = /*#__PURE__*/ Symbol.for("nodejs.util.inspect.custom"), Ge = (e) => {
293
- try {
294
- return e = Fe(e), d(e, "toJSON") && ie(e.toJSON) && e.toJSON.length === 0 ? e.toJSON() : Array.isArray(e) ? e.map(Ge) : e;
295
- } catch {
296
- return "[toJSON threw]";
297
- }
298
- }, Ke = {
299
- toJSON() {
300
- return Ge(this);
301
- },
302
- [x]() {
303
- return this.toJSON();
304
- },
305
- toString() {
306
- return b(this.toJSON());
307
- }
308
- }, qe = class {
309
- [x]() {
310
- return this.toJSON();
311
- }
312
- toString() {
313
- return b(this.toJSON());
314
- }
315
- }, Je = /*#__PURE__*/ (() => {
316
- let e = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
317
- return e === void 0 ? Object.isExtensible(Error) : Object.hasOwn(e, "writable") ? e.writable === !0 : e.set !== void 0;
318
- })(), Ye = () => Error.stackTraceLimit, Xe = (e) => {
319
- Je && (Error.stackTraceLimit = e);
320
- }, Ze = class {
321
- constructor(e) {
322
- this.value = e, this.done = !1;
323
- }
324
- next(e) {
325
- return this.done ? (this.value = e, this) : (this.done = !0, {
326
- value: this.value,
327
- done: !1
328
- });
329
- }
330
- }, Qe = /*#__PURE__*/ (() => {
331
- let e = "~effect/Utils/internal", t = { [e]: (e) => e() }, n = { [e]: (e) => {
332
- try {
333
- return e();
334
- } finally {}
335
- } };
336
- return Ye() !== 0 && t[e](() => (/* @__PURE__ */ Error()).stack)?.includes(e) === !0 ? t[e] : n[e];
337
- })();
338
- //#endregion
339
- //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/record.js
340
- function $e(e, t, n) {
341
- t === "__proto__" ? Object.defineProperty(e, t, {
342
- value: n,
343
- writable: !0,
344
- enumerable: !0,
345
- configurable: !0
346
- }) : e[t] = n;
347
- }
348
- function et(e, t) {
349
- for (let n of Reflect.ownKeys(t)) Object.prototype.propertyIsEnumerable.call(t, n) && $e(e, n, t[n]);
350
- }
351
- //#endregion
352
- //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/core.js
353
- var S = "~effect/Effect", tt = "~effect/Exit", nt = {
354
- _A: n,
355
- _E: n,
356
- _R: n
357
- }, rt = `${S}/identifier`, C = `${S}/args`, w = `${S}/evaluate`, T = `${S}/successCont`, E = `${S}/failureCont`, it = `${S}/ensureCont`, at = /*#__PURE__*/ Symbol.for("effect/Effect/Yield"), D = {
358
- pipe() {
359
- return e(this, arguments);
360
- },
361
- toJSON() {
362
- return { ...this };
363
- },
364
- toString() {
365
- return b(this.toJSON(), {
366
- ignoreToString: !0,
367
- space: 2
368
- });
369
- },
370
- [x]() {
371
- return this.toJSON();
372
- }
373
- }, ot = {
374
- [S]: nt,
375
- ...D,
376
- [Symbol.iterator]() {
377
- return new Ze(this);
378
- },
379
- toJSON() {
380
- return {
381
- _id: "Effect",
382
- op: this[rt],
383
- ...C in this ? { args: this[C] } : void 0
384
- };
385
- }
386
- }, st = (e) => d(e, S), ct = (e) => d(e, tt), lt = "~effect/Cause", ut = "~effect/Cause/Reason", dt = (e) => d(e, lt), ft = class {
387
- constructor(e) {
388
- this[lt] = lt, this.reasons = e;
389
- }
390
- pipe() {
391
- return e(this, arguments);
392
- }
393
- toJSON() {
394
- return {
395
- _id: "Cause",
396
- failures: this.reasons.map((e) => e.toJSON())
397
- };
398
- }
399
- toString() {
400
- return `Cause(${b(this.reasons)})`;
401
- }
402
- [x]() {
403
- return this.toJSON();
404
- }
405
- [_](e) {
406
- return dt(e) && this.reasons.length === e.reasons.length && this.reasons.every((t, n) => v(t, e.reasons[n]));
407
- }
408
- [f]() {
409
- return pe(this.reasons);
410
- }
411
- }, pt = /*#__PURE__*/ new WeakMap(), mt = class {
412
- [ut];
413
- annotations;
414
- _tag;
415
- constructor(e, t, n) {
416
- if (this[ut] = ut, this._tag = e, t !== ht && typeof n == "object" && n && t.size > 0) {
417
- let e = pt.get(n);
418
- e && (t = new Map([...e, ...t])), pt.set(n, t);
419
- }
420
- this.annotations = t;
421
- }
422
- annotate(e, t) {
423
- if (e.mapUnsafe.size === 0) return this;
424
- let n = new Map(this.annotations);
425
- e.mapUnsafe.forEach((e, r) => {
426
- t?.overwrite !== !0 && n.has(r) || n.set(r, e);
427
- });
428
- let r = Object.assign(Object.create(Object.getPrototypeOf(this)), this);
429
- return r.annotations = n, r;
430
- }
431
- pipe() {
432
- return e(this, arguments);
433
- }
434
- toString() {
435
- return b(this);
436
- }
437
- [x]() {
438
- return this.toString();
439
- }
440
- }, ht = /*#__PURE__*/ new Map(), gt = class extends mt {
441
- constructor(e, t = ht) {
442
- super("Fail", t, e), this.error = e;
443
- }
444
- toString() {
445
- return `Fail(${b(this.error)})`;
446
- }
447
- toJSON() {
448
- return {
449
- _tag: "Fail",
450
- error: this.error
451
- };
452
- }
453
- [_](e) {
454
- return St(e) && v(this.error, e.error) && v(this.annotations, e.annotations);
455
- }
456
- [f]() {
457
- return m(g(this._tag))(m(p(this.error))(p(this.annotations)));
458
- }
459
- }, _t = (e) => new ft(e), vt = (e) => new ft([new gt(e)]), yt = class extends mt {
460
- constructor(e, t = ht) {
461
- super("Die", t, e), this.defect = e;
462
- }
463
- toString() {
464
- return `Die(${b(this.defect)})`;
465
- }
466
- toJSON() {
467
- return {
468
- _tag: "Die",
469
- defect: this.defect
470
- };
471
- }
472
- [_](e) {
473
- return Ct(e) && v(this.defect, e.defect) && v(this.annotations, e.annotations);
474
- }
475
- [f]() {
476
- return m(g(this._tag))(m(p(this.defect))(p(this.annotations)));
477
- }
478
- }, bt = (e) => new ft([new yt(e)]), xt = /*#__PURE__*/ t((e) => dt(e[0]), (e, t, n) => t.mapUnsafe.size === 0 ? e : new ft(e.reasons.map((e) => e.annotate(t, n)))), St = (e) => e._tag === "Fail", Ct = (e) => e._tag === "Die", wt = (e) => e._tag === "Interrupt";
479
- function Tt(e) {
480
- return M("Effect.evaluate: Not implemented");
481
- }
482
- var O = (e) => ({
483
- ...ot,
484
- [rt]: e.op,
485
- [w]: e[w] ?? Tt,
486
- [T]: e[T],
487
- [E]: e[E],
488
- [it]: e[it]
489
- }), k = (e) => {
490
- let t = O(e), n = function(e) {
491
- this[C] = e;
492
- };
493
- return n.prototype = t, function(e) {
494
- return new n(e);
495
- };
496
- }, Et = (e) => {
497
- let t = {
498
- [tt]: tt,
499
- _tag: e.op,
500
- get [e.prop]() {
501
- return this[C];
502
- },
503
- ...O(e),
504
- toString() {
505
- return `${e.op}(${b(this[C])})`;
506
- },
507
- toJSON() {
508
- return {
509
- _id: "Exit",
510
- _tag: e.op,
511
- [e.prop]: this[C]
512
- };
513
- },
514
- [_](e) {
515
- return ct(e) && e._tag === this._tag && v(this[C], e[C]);
516
- },
517
- [f]() {
518
- return m(g(e.op), p(this[C]));
519
- }
520
- }, n = function(e) {
521
- this[C] = e;
522
- };
523
- return n.prototype = t, function(e) {
524
- return new n(e);
525
- };
526
- }, A = /*#__PURE__*/ Et({
527
- op: "Success",
528
- prop: "value",
529
- [w](e) {
530
- let t = e.getCont(T);
531
- return t ? t[T](this[C], e, this) : e.yieldWith(this);
532
- }
533
- }), Dt = { key: "effect/Cause/StackTrace" }, Ot = { key: "effect/Cause/InterruptorStackTrace" }, j = /*#__PURE__*/ Et({
534
- op: "Failure",
535
- prop: "cause",
536
- [w](e) {
537
- let t = this[C], n = !1;
538
- e.cache.stackFrame && (t = xt(t, { mapUnsafe: /* @__PURE__ */ new Map([[Dt.key, e.cache.stackFrame]]) }), n = !0);
539
- let r = e.getCont(E);
540
- for (; e.interruptible && e._interruptedCause && r;) r = e.getCont(E);
541
- return r ? r[E](t, e, n ? void 0 : this) : e.yieldWith(n ? j(t) : this);
542
- }
543
- }), kt = (e) => j(vt(e)), M = (e) => j(bt(e)), N = /*#__PURE__*/ k({
544
- op: "WithFiber",
545
- [w](e) {
546
- return this[C](e);
547
- }
548
- }), At = /*#__PURE__*/ function() {
549
- class e extends globalThis.Error {}
550
- let t = /*#__PURE__*/ O({
551
- op: "YieldableError",
552
- [w]() {
553
- return kt(this);
554
- }
555
- });
556
- return delete t.toString, Object.assign(e.prototype, t), e;
557
- }(), jt = /*#__PURE__*/ function() {
558
- let e = /*#__PURE__*/ Symbol.for("effect/Data/Error/plainArgs");
559
- return class extends At {
560
- constructor(t) {
561
- super(t?.message, t?.cause ? { cause: t.cause } : void 0), t && (et(this, t), Object.defineProperty(this, e, {
562
- value: t,
563
- enumerable: !1
564
- }));
565
- }
566
- toJSON() {
567
- return {
568
- ...this[e],
569
- ...this
570
- };
571
- }
572
- };
573
- }(), Mt = (e) => {
574
- class t extends jt {
575
- _tag = e;
576
- }
577
- return t.prototype.name = e, t;
578
- }, Nt = "~effect/Cause/Done", Pt = (e) => d(e, Nt), Ft = {
579
- [Nt]: Nt,
580
- _tag: "Done",
581
- value: void 0
582
- }, It = (e) => e === void 0 ? Ft : {
583
- [Nt]: Nt,
584
- _tag: "Done",
585
- value: e
586
- }, Lt = /*#__PURE__*/ kt(Ft), Rt = (e) => e === void 0 ? Lt : kt(It(e)), zt = (e) => O({
587
- op: e.label,
588
- [w]: e.evaluate
589
- }), Bt = (e) => (t, n) => t === n || e(t, n), Vt = (e, t) => e === t, Ht = () => Vt;
590
- function Ut(e) {
591
- return Bt((t, n) => {
592
- if (t.length !== n.length) return !1;
593
- for (let r = 0; r < t.length; r++) if (!e[r](t[r], n[r])) return !1;
594
- return !0;
595
- });
596
- }
597
- function Wt(e) {
598
- return Bt((t, n) => {
599
- if (t.length !== n.length) return !1;
600
- for (let r = 0; r < t.length; r++) if (!e(t[r], n[r])) return !1;
601
- return !0;
602
- });
603
- }
604
- //#endregion
605
- //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/option.js
606
- var Gt = "~effect/Option", Kt = {
607
- [Gt]: { _A: (e) => e },
608
- ...D,
609
- [Symbol.iterator]() {
610
- return new Ze(this);
611
- }
612
- }, qt = /*#__PURE__*/ Object.defineProperty(/*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Kt), {
613
- _tag: "Some",
614
- _op: "Some",
615
- [_](e) {
616
- return Xt(e) && Qt(e) && v(this.value, e.value);
617
- },
618
- [f]() {
619
- return m(p(this._tag))(p(this.value));
620
- },
621
- toString() {
622
- return `some(${b(this.value)})`;
623
- },
624
- toJSON() {
625
- return {
626
- _id: "Option",
627
- _tag: this._tag,
628
- value: Ge(this.value)
629
- };
630
- }
631
- }), "valueOrUndefined", { get() {
632
- return this.value;
633
- } }), Jt = /*#__PURE__*/ p("None"), Yt = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Kt), {
634
- _tag: "None",
635
- _op: "None",
636
- valueOrUndefined: void 0,
637
- [_](e) {
638
- return Xt(e) && Zt(e);
639
- },
640
- [f]() {
641
- return Jt;
642
- },
643
- toString() {
644
- return "none()";
645
- },
646
- toJSON() {
647
- return {
648
- _id: "Option",
649
- _tag: this._tag
650
- };
651
- }
652
- }), Xt = (e) => d(e, Gt), Zt = (e) => e._tag === "None", Qt = (e) => e._tag === "Some", $t = /*#__PURE__*/ Object.create(Yt), en = function(e) {
653
- this.value = e;
654
- };
655
- en.prototype = qt;
656
- var tn = (e) => new en(e), nn = "~effect/Result", rn = {
657
- [nn]: {
658
- /* v8 ignore next 2 */
659
- _A: (e) => e,
660
- _E: (e) => e
661
- },
662
- ...D,
663
- [Symbol.iterator]() {
664
- return new Ze(this);
665
- }
666
- }, an = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(rn), {
667
- _tag: "Success",
668
- _op: "Success",
669
- [_](e) {
670
- return sn(e) && ln(e) && v(this.success, e.success);
671
- },
672
- [f]() {
673
- return m(p(this._tag))(p(this.success));
674
- },
675
- toString() {
676
- return `success(${b(this.success)})`;
677
- },
678
- toJSON() {
679
- return {
680
- _id: "Result",
681
- _tag: this._tag,
682
- value: Ge(this.success)
683
- };
684
- }
685
- }), on = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(rn), {
686
- _tag: "Failure",
687
- _op: "Failure",
688
- [_](e) {
689
- return sn(e) && cn(e) && v(this.failure, e.failure);
690
- },
691
- [f]() {
692
- return m(p(this._tag))(p(this.failure));
693
- },
694
- toString() {
695
- return `failure(${b(this.failure)})`;
696
- },
697
- toJSON() {
698
- return {
699
- _id: "Result",
700
- _tag: this._tag,
701
- failure: Ge(this.failure)
702
- };
703
- }
704
- }), sn = (e) => d(e, nn), cn = (e) => e._tag === "Failure", ln = (e) => e._tag === "Success", un = function(e) {
705
- this.failure = e;
706
- };
707
- un.prototype = on;
708
- var dn = (e) => new un(e), fn = function(e) {
709
- this.success = e;
710
- };
711
- fn.prototype = an;
712
- var pn = (e) => new fn(e);
713
- //#endregion
714
- //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Order.js
715
- function mn(e) {
716
- return (t, n) => t === n ? 0 : e(t, n);
717
- }
718
- var hn = /*#__PURE__*/ mn((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), gn = /*#__PURE__*/ t(2, (e, t) => mn((n, r) => e(t(n), t(r)))), _n = (e) => t(2, (t, n) => e(t, n) === 1), P = () => $t, vn = tn, yn = Zt, bn = Qt, xn = /*#__PURE__*/ t(2, (e, { onNone: t, onSome: n }) => yn(e) ? t() : n(e.value)), Sn = /*#__PURE__*/ t(2, (e, t) => yn(e) ? t() : e.value), Cn = (e) => e == null ? P() : vn(e), wn = /*#__PURE__*/ Sn(o), Tn = "~effect/Context/Service", En = function() {
719
- function e() {}
720
- let t = e;
721
- Object.setPrototypeOf(t, Dn);
722
- let n = (e, n) => (t.key = e, n?.defaultValue && (t[kn] = kn, t.defaultValue = n.defaultValue), n?.make && (t.make = n.make), n?.fiberCached && On.add(e), t);
723
- return arguments.length > 0 ? n(arguments[0], arguments[1]) : n;
724
- }, Dn = {
725
- [Tn]: Tn,
726
- .../*#__PURE__*/ zt({
727
- label: "Service",
728
- evaluate(e) {
729
- return A(I(e.context, this));
730
- }
731
- }),
732
- toJSON() {
733
- return {
734
- _id: "Service",
735
- key: this.key
736
- };
737
- },
738
- of(e) {
739
- return e;
740
- },
741
- context(e) {
742
- return Gn(this, e);
743
- },
744
- use(e) {
745
- return N((t) => e(I(t.context, this)));
746
- },
747
- useSync(e) {
748
- return N((t) => A(e(I(t.context, this))));
749
- }
750
- }, On = /*#__PURE__*/ new Set(), kn = "~effect/Context/Reference", An = "~effect/Context", jn = 8, Mn = 8, Nn = (e, t, n, r) => {
751
- let i = Object.create(Bn);
752
- return i.cacheRoot = e ?? i, i.base = t, i.overlay = n, i.depth = r, i._flat = void 0, i.baseHits = 0, i;
753
- }, Pn = (e, t) => {
754
- t && (Pn(e, t.parent), e.set(t.key, t.value));
755
- }, Fn = (e) => {
756
- if (e._flat) return e._flat;
757
- if (!e.overlay) return e._flat = e.base;
758
- let t = new Map(e.base);
759
- return Pn(t, e.overlay), e._flat = t;
760
- }, In = (e, t) => {
761
- let n = new Map(e.mapUnsafe);
762
- return t(n), zn(n);
763
- }, Ln = /*#__PURE__*/ Symbol(), Rn = (e, t) => {
764
- let n = e;
765
- for (let e = n.overlay; e; e = e.parent) if (e.key === t) return e.value;
766
- let r = n.base.get(t);
767
- return r === void 0 && !n.base.has(t) ? Ln : (n.overlay && ++n.baseHits >= n.base.size && n.baseHits >= Mn && (n.base = Fn(n), n.overlay = void 0, n.depth = 0), r);
768
- }, zn = (e) => Nn(void 0, e, void 0, 0), Bn = {
769
- get mapUnsafe() {
770
- return Fn(this);
771
- },
772
- ...D,
773
- [An]: { _Services: (e) => e },
774
- toJSON() {
775
- return {
776
- _id: "Context",
777
- services: Array.from(this.mapUnsafe).map(([e, t]) => ({
778
- key: e,
779
- value: t
780
- }))
781
- };
782
- },
783
- [_](e) {
784
- if (!Hn(e)) return !1;
785
- let t = this.mapUnsafe, n = e.mapUnsafe;
786
- if (t.size !== n.size) return !1;
787
- for (let [e, r] of t) if (!n.has(e) || !v(r, n.get(e))) return !1;
788
- return !0;
789
- },
790
- [f]() {
791
- return le(this.mapUnsafe.size);
792
- }
793
- }, Vn = (e, t) => e.cacheRoot === t.cacheRoot, Hn = (e) => d(e, An), Un = (e) => !!e[kn], F = () => Wn, Wn = /*#__PURE__*/ zn(/*#__PURE__*/ new Map()), Gn = (e, t) => zn(/* @__PURE__ */ new Map([[e.key, t]])), Kn = /*#__PURE__*/ t(3, (e, t, n) => qn(e, t.key, n)), qn = (e, t, n) => {
794
- let r = e, i = On.has(t) ? void 0 : r.cacheRoot;
795
- if (r.depth >= jn) {
796
- let e = new Map(r.mapUnsafe);
797
- return e.set(t, n), Nn(i, e, void 0, 0);
798
- }
799
- return Nn(i, r.base, {
800
- key: t,
801
- value: n,
802
- parent: r.overlay
803
- }, r.depth + 1);
804
- }, Jn = /*#__PURE__*/ t(2, (e, t) => Yn(e, t.key)), Yn = (e, t) => {
805
- let n = Rn(e, t);
806
- return n === Ln ? void 0 : n;
807
- }, Xn = /*#__PURE__*/ t(2, (e, t) => {
808
- let n = Rn(e, t.key);
809
- if (n === Ln) {
810
- if (Un(t)) return Qn(t);
811
- throw $n(t);
812
- }
813
- return n;
814
- }), I = Xn, Zn = "~effect/Context/defaultValue", Qn = (e) => Zn in e ? e[Zn] : e[Zn] = e.defaultValue(), $n = (e) => {
815
- let t = /* @__PURE__ */ Error(`Service not found${e.key ? `: ${String(e.key)}` : ""}`);
816
- if (t.stack) {
817
- let e = t.stack.split("\n");
818
- e.splice(1, 3), t.stack = e.join("\n");
819
- }
820
- return t;
821
- }, er = /*#__PURE__*/ t(2, (e, t) => e.mapUnsafe.size === 0 ? t : t.mapUnsafe.size === 0 ? e : In(e, (e) => t.mapUnsafe.forEach((t, n) => e.set(n, t)))), L = En, tr = pn, nr = dn, rr = (e) => {
822
- if (ie(e)) try {
823
- return tr(e());
824
- } catch (e) {
825
- return nr(e);
826
- }
827
- try {
828
- return tr(e.try());
829
- } catch (t) {
830
- return nr(e.catch(t));
831
- }
832
- }, ir = cn, ar = ln, or = Ut, sr = /*#__PURE__*/ t(2, (e, t) => Object.hasOwn(e, t)), cr = /*#__PURE__*/ t(2, (e, t) => {
833
- let n = { ...e };
834
- for (let r of lr(e)) $e(n, r, t(e[r], r));
835
- return n;
836
- }), lr = (e) => Object.keys(e), ur = (e) => t(2, (t, n) => {
837
- for (let r of lr(t)) if (!sr(n, r) || !e(t[r], n[r])) return !1;
838
- return !0;
839
- }), dr = (e) => {
840
- let t = ur(e);
841
- return (e, n) => t(e, n) && t(n, e);
842
- }, fr = globalThis.Array, pr = (e) => fr.isArray(e) ? e : fr.from(e);
843
- fr.isArray;
844
- var mr = (e) => [e], hr = Wt, gr = "~effect/Duration", _r = /*#__PURE__*/ BigInt(0), vr = /*#__PURE__*/ BigInt(1), yr = /*#__PURE__*/ BigInt(2), br = /*#__PURE__*/ BigInt(10), xr = /*#__PURE__*/ BigInt(1e3), Sr = (e) => BigInt(e < 0 ? Math.ceil(e - .5) : Math.floor(e + .5)), Cr = (e) => Sr(e * 1e6), wr = (e, t) => {
845
- let n = e.indexOf(".");
846
- if (n === -1) return BigInt(e) * t;
847
- let r = e[0] === "-", i = e.slice(n + 1), a = br ** BigInt(i.length), o = (BigInt(e.slice(+!!r, n)) * a + BigInt(i)) * t, s = o / a + (o % a * yr >= a ? vr : _r);
848
- return r ? -s : s;
849
- }, Tr = /^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/, Er = (e) => {
850
- switch (typeof e) {
851
- case "number": return Lr(e);
852
- case "bigint": return Ir(e);
853
- case "string": {
854
- if (e === "Infinity") return Pr;
855
- if (e === "-Infinity") return Fr;
856
- let t = Tr.exec(e);
857
- if (!t) break;
858
- let [n, r, i] = t;
859
- if (i === "nano" || i === "nanos") return Ir(wr(r, vr));
860
- if (i === "micro" || i === "micros") return Ir(wr(r, xr));
861
- let a = Number(r);
862
- switch (i) {
863
- case "milli":
864
- case "millis": return Lr(a);
865
- case "second":
866
- case "seconds": return Rr(a);
867
- case "minute":
868
- case "minutes": return zr(a);
869
- case "hour":
870
- case "hours": return Br(a);
871
- case "day":
872
- case "days": return Vr(a);
873
- case "week":
874
- case "weeks": return Hr(a);
875
- }
876
- break;
877
- }
878
- case "object": {
879
- if (e === null) break;
880
- if (gr in e) return e;
881
- if (Array.isArray(e)) return e.length !== 2 || !e.every(re) ? Dr(e) : Number.isNaN(e[0]) || Number.isNaN(e[1]) ? Nr : e[0] === -Infinity || e[1] === -Infinity ? Fr : e[0] === Infinity || e[1] === Infinity ? Pr : R(Sr(e[0] * 1e9 + e[1]));
882
- let t = e, n = 0;
883
- 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 ? R(n) : R(Sr(n * 1e6 + (t.microseconds ?? 0) * 1e3 + (t.nanoseconds ?? 0)));
884
- }
885
- }
886
- return Dr(e);
887
- }, Dr = (e) => {
888
- throw Error(`Invalid Input: ${e}`);
889
- }, Or = {
890
- _tag: "Millis",
891
- millis: 0
892
- }, kr = { _tag: "Infinity" }, Ar = { _tag: "NegativeInfinity" }, jr = {
893
- [gr]: gr,
894
- [f]() {
895
- switch (this.value._tag) {
896
- case "Millis": {
897
- let e = this.value.millis * 1e6;
898
- return Number.isFinite(e) ? p(Sr(e)) : le(this.value.millis);
899
- }
900
- case "Nanos": return p(this.value.nanos);
901
- default: return de(this.value);
902
- }
903
- },
904
- [_](e) {
905
- return Mr(e) && Jr(this, e);
906
- },
907
- toString() {
908
- switch (this.value._tag) {
909
- case "Infinity": return "Infinity";
910
- case "NegativeInfinity": return "-Infinity";
911
- case "Nanos": return `${this.value.nanos} nanos`;
912
- case "Millis": return `${this.value.millis} millis`;
913
- }
914
- },
915
- toJSON() {
916
- switch (this.value._tag) {
917
- case "Millis": return {
918
- _id: "Duration",
919
- _tag: "Millis",
920
- millis: this.value.millis
921
- };
922
- case "Nanos": return {
923
- _id: "Duration",
924
- _tag: "Nanos",
925
- nanos: String(this.value.nanos)
926
- };
927
- case "Infinity": return {
928
- _id: "Duration",
929
- _tag: "Infinity"
930
- };
931
- case "NegativeInfinity": return {
932
- _id: "Duration",
933
- _tag: "NegativeInfinity"
934
- };
935
- }
936
- },
937
- [x]() {
938
- return this.toJSON();
939
- },
940
- pipe() {
941
- return e(this, arguments);
942
- }
943
- }, R = (e) => {
944
- let t = Object.create(jr);
945
- return t.value = typeof e == "number" ? isNaN(e) || e === 0 || Object.is(e, -0) ? Or : Number.isFinite(e) ? Number.isInteger(e) ? {
946
- _tag: "Millis",
947
- millis: e
948
- } : {
949
- _tag: "Nanos",
950
- nanos: Cr(e)
951
- } : e > 0 ? kr : Ar : e === _r ? Or : {
952
- _tag: "Nanos",
953
- nanos: e
954
- }, t;
955
- }, Mr = (e) => d(e, gr), Nr = /*#__PURE__*/ R(0), Pr = /*#__PURE__*/ R(Infinity), Fr = /*#__PURE__*/ R(-Infinity), Ir = (e) => R(e), Lr = (e) => R(e), Rr = (e) => R(e * 1e3), zr = (e) => R(e * 6e4), Br = (e) => R(e * 36e5), Vr = (e) => R(e * 864e5), Hr = (e) => R(e * 6048e5), Ur = (e) => Gr(Er(e), {
956
- onMillis: n,
957
- onNanos: (e) => Number(e) / 1e6,
958
- onInfinity: () => Infinity,
959
- onNegativeInfinity: () => -Infinity
960
- }), Wr = (e) => {
961
- let t = Er(e);
962
- switch (t.value._tag) {
963
- case "Infinity":
964
- case "NegativeInfinity": throw Error("Cannot convert infinite duration to nanos");
965
- case "Nanos": return t.value.nanos;
966
- case "Millis": return Cr(t.value.millis);
967
- }
968
- }, Gr = /*#__PURE__*/ t(2, (e, t) => {
969
- switch (e.value._tag) {
970
- case "Millis": return t.onMillis(e.value.millis);
971
- case "Nanos": return t.onNanos(e.value.nanos);
972
- case "Infinity": return t.onInfinity();
973
- case "NegativeInfinity": return (t.onNegativeInfinity ?? t.onInfinity)();
974
- }
975
- }), Kr = /*#__PURE__*/ t(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(Wr(e), t.value.nanos) : n.onNanos(e.value.nanos, Wr(t))), qr = (e, t) => Kr(e, t, {
976
- onMillis: (e, t) => e === t,
977
- onNanos: (e, t) => e === t,
978
- onInfinity: (e, t) => e.value._tag === t.value._tag
979
- }), Jr = /*#__PURE__*/ t(2, (e, t) => qr(e, t)), Yr = /*#__PURE__*/ L("effect/Scheduler", {
980
- fiberCached: !0,
981
- defaultValue: () => new ei()
982
- }), Xr = (e) => {
983
- let t = !1;
984
- return Promise.resolve().then(() => {
985
- t || e();
986
- }), () => {
987
- t = !0;
988
- };
989
- }, Zr = "setImmediate" in globalThis ? (e) => {
990
- let t = globalThis.setImmediate(e);
991
- return () => globalThis.clearImmediate(t);
992
- } : (e) => {
993
- let t = setTimeout(e, 0);
994
- return () => clearTimeout(t);
995
- }, Qr = (e) => {
996
- try {
997
- return Zr(e);
998
- } catch {
999
- return Xr(e);
1000
- }
1001
- }, $r = class {
1002
- buckets = [];
1003
- scheduleTask(e, t) {
1004
- let n = this.buckets, r = n.length, i, a = 0;
1005
- for (; a < r && !(n[a][0] > t); a++) i = n[a];
1006
- i && i[0] === t ? i[1].push(e) : a === r ? n.push([t, [e]]) : n.splice(a, 0, [t, [e]]);
1007
- }
1008
- drain() {
1009
- let e = this.buckets;
1010
- return this.buckets = [], e;
1011
- }
1012
- }, ei = class {
1013
- executionMode;
1014
- setImmediate;
1015
- constructor(e = "async", t) {
1016
- this.executionMode = e, this.setImmediate = t ?? (e === "sync" ? Xr : Qr);
1017
- }
1018
- shouldYield(e) {
1019
- return e.currentOpCount >= e.cache.maxOpsBeforeYield;
1020
- }
1021
- makeDispatcher() {
1022
- return new ti(this.setImmediate);
1023
- }
1024
- }, ti = class {
1025
- tasks = /*#__PURE__*/ new $r();
1026
- running = void 0;
1027
- setImmediate;
1028
- constructor(e = Qr) {
1029
- this.setImmediate = e;
1030
- }
1031
- scheduleTask(e, t) {
1032
- this.tasks.scheduleTask(e, t), this.running === void 0 && (this.running = this.setImmediate(this.afterScheduled));
1033
- }
1034
- afterScheduled = () => {
1035
- this.running = void 0, this.runTasks();
1036
- };
1037
- runTasks() {
1038
- let e = this.tasks.drain();
1039
- for (let t = 0; t < e.length; t++) {
1040
- let n = e[t][1];
1041
- for (let e = 0; e < n.length; e++) n[e]();
1042
- }
1043
- }
1044
- flush() {
1045
- for (; this.tasks.buckets.length > 0;) this.running !== void 0 && (this.running(), this.running = void 0), this.runTasks();
1046
- }
1047
- }, ni = /*#__PURE__*/ L("effect/Scheduler/MaxOpsBeforeYield", {
1048
- fiberCached: !0,
1049
- defaultValue: () => 2048
1050
- }), ri = /*#__PURE__*/ L("effect/Scheduler/PreventSchedulerYield", {
1051
- fiberCached: !0,
1052
- defaultValue: () => !1
1053
- }), ii = Mt, ai = (e) => {
1054
- switch (e) {
1055
- case 16: return si();
1056
- case 32: return ci();
1057
- default: {
1058
- let t = "";
1059
- for (let n = e >>> 3; n > 0; n--) t += oi();
1060
- return t;
1061
- }
1062
- }
1063
- }, z = /*#__PURE__*/ Uint8Array.from("0123456789abcdef", (e) => e.charCodeAt(0)), B = () => Math.random() * 4294967296 >>> 0, oi = () => {
1064
- let e = B();
1065
- return String.fromCharCode(z[e >>> 28], z[e >>> 24 & 15], z[e >>> 20 & 15], z[e >>> 16 & 15], z[e >>> 12 & 15], z[e >>> 8 & 15], z[e >>> 4 & 15], z[e & 15]);
1066
- }, si = () => {
1067
- let e = B(), t = B();
1068
- return String.fromCharCode(z[e >>> 28], z[e >>> 24 & 15], z[e >>> 20 & 15], z[e >>> 16 & 15], z[e >>> 12 & 15], z[e >>> 8 & 15], z[e >>> 4 & 15], z[e & 15], z[t >>> 28], z[t >>> 24 & 15], z[t >>> 20 & 15], z[t >>> 16 & 15], z[t >>> 12 & 15], z[t >>> 8 & 15], z[t >>> 4 & 15], z[t & 15]);
1069
- }, ci = () => {
1070
- let e = B(), t = B(), n = B(), r = B();
1071
- return String.fromCharCode(z[e >>> 28], z[e >>> 24 & 15], z[e >>> 20 & 15], z[e >>> 16 & 15], z[e >>> 12 & 15], z[e >>> 8 & 15], z[e >>> 4 & 15], z[e & 15], z[t >>> 28], z[t >>> 24 & 15], z[t >>> 20 & 15], z[t >>> 16 & 15], z[t >>> 12 & 15], z[t >>> 8 & 15], z[t >>> 4 & 15], z[t & 15], z[n >>> 28], z[n >>> 24 & 15], z[n >>> 20 & 15], z[n >>> 16 & 15], z[n >>> 12 & 15], z[n >>> 8 & 15], z[n >>> 4 & 15], z[n & 15], z[r >>> 28], z[r >>> 24 & 15], z[r >>> 20 & 15], z[r >>> 16 & 15], z[r >>> 12 & 15], z[r >>> 8 & 15], z[r >>> 4 & 15], z[r & 15]);
1072
- }, li = "effect/Tracer/ParentSpan", ui = class extends (/*#__PURE__*/ En()(li, { fiberCached: !0 })) {}, di = (e) => e, fi = /*#__PURE__*/ L("effect/Tracer/DisablePropagation", { defaultValue: a }), pi = /*#__PURE__*/ L("effect/Tracer/CurrentTraceLevel", { defaultValue: () => "Info" }), mi = /*#__PURE__*/ L("effect/Tracer/MinimumTraceLevel", { defaultValue: () => "All" }), hi = "effect/Tracer", gi = /*#__PURE__*/ di({ span: (e) => new _i(e) }), _i = class {
1073
- _tag = "Span";
1074
- sampled;
1075
- name;
1076
- parent;
1077
- annotations;
1078
- links;
1079
- startTime;
1080
- kind;
1081
- status;
1082
- _traceId = void 0;
1083
- _spanId = void 0;
1084
- _attributes = void 0;
1085
- _events = void 0;
1086
- constructor(e) {
1087
- this.name = e.name, this.parent = e.parent, this.annotations = e.annotations, this.links = e.links, this.startTime = e.startTime, this.kind = e.kind, this.sampled = e.sampled, this.status = {
1088
- _tag: "Started",
1089
- startTime: e.startTime
1090
- };
1091
- }
1092
- get traceId() {
1093
- return this._traceId ??= wn(this.parent)?.traceId ?? ai(32);
1094
- }
1095
- get spanId() {
1096
- return this._spanId ??= ai(16);
1097
- }
1098
- get attributes() {
1099
- return this._attributes ??= /* @__PURE__ */ new Map();
1100
- }
1101
- get events() {
1102
- return this._events ??= [];
1103
- }
1104
- end(e, t) {
1105
- this.status = {
1106
- _tag: "Ended",
1107
- endTime: e,
1108
- exit: t,
1109
- startTime: this.status.startTime
1110
- };
1111
- }
1112
- attribute(e, t) {
1113
- this.attributes.set(e, t);
1114
- }
1115
- event(e, t, n) {
1116
- this.events.push([
1117
- e,
1118
- t,
1119
- n ?? {}
1120
- ]);
1121
- }
1122
- addLinks(e) {
1123
- this.links.push(...e);
1124
- }
1125
- }, vi = "effect/Metric/FiberRuntimeMetrics", yi = /*#__PURE__*/ L("effect/References/CurrentStackFrame", {
1126
- fiberCached: !0,
1127
- defaultValue: o
1128
- }), bi = /*#__PURE__*/ L("effect/References/TracerEnabled", {
1129
- fiberCached: !0,
1130
- defaultValue: i
1131
- }), xi = /*#__PURE__*/ L("effect/References/TracerTimingEnabled", { defaultValue: i }), Si = /*#__PURE__*/ L("effect/References/TracerSpanAnnotations", { defaultValue: () => ({}) }), Ci = /*#__PURE__*/ L("effect/References/TracerSpanLinks", { defaultValue: () => [] }), wi = /*#__PURE__*/ L("effect/References/CurrentLogLevel", {
1132
- fiberCached: !0,
1133
- defaultValue: () => "Info"
1134
- }), Ti = /*#__PURE__*/ L("effect/References/MinimumLogLevel", {
1135
- fiberCached: !0,
1136
- defaultValue: () => "Info"
1137
- }), Ei = (e) => {
1138
- if (e?.captureStackTrace === !1 || e?.captureStackTrace !== void 0 && typeof e.captureStackTrace != "boolean") return e;
1139
- let t = Ye();
1140
- if (t === 0 && e?.captureStackTrace !== !0) return {
1141
- ...e,
1142
- captureStackTrace: !1
1143
- };
1144
- Xe(3);
1145
- let n = /* @__PURE__ */ Error();
1146
- return Xe(t), {
1147
- ...e,
1148
- captureStackTrace: Oi(() => n.stack)
1149
- };
1150
- }, Di = (e) => (t) => {
1151
- let n;
1152
- return () => {
1153
- if (n !== void 0) return n;
1154
- let r = t();
1155
- if (!r) return;
1156
- let i = r.split("\n");
1157
- if (i[e] !== void 0) return n = i[e].trim(), n;
1158
- };
1159
- }, Oi = /*#__PURE__*/ Di(3), ki = class extends mt {
1160
- constructor(e, t = ht) {
1161
- super("Interrupt", t, "Interrupted"), this.fiberId = e;
1162
- }
1163
- toString() {
1164
- return `Interrupt(${this.fiberId})`;
1165
- }
1166
- toJSON() {
1167
- return {
1168
- _tag: "Interrupt",
1169
- fiberId: this.fiberId
1170
- };
1171
- }
1172
- [_](e) {
1173
- return wt(e) && this.fiberId === e.fiberId && this.annotations === e.annotations;
1174
- }
1175
- [f]() {
1176
- return m(g(`${this._tag}:${this.fiberId}`))(oe(this.annotations));
1177
- }
1178
- }, Ai = (e) => new ft([new ki(e)]), ji = (e) => e.reasons.some(wt), Mi = (e) => {
1179
- let t;
1180
- for (let n = 0; n < e.reasons.length; n++) {
1181
- let r = e.reasons[n];
1182
- r._tag === "Interrupt" && (t ??= /* @__PURE__ */ new Set(), r.fiberId !== void 0 && t.add(r.fiberId));
1183
- }
1184
- return t ? tr(t) : nr(e);
1185
- }, Ni = (e, t) => {
1186
- let n = /* @__PURE__ */ new Map(), r = [];
1187
- for (let i of e.concat(t)) {
1188
- let e = p(i), t = n.get(e);
1189
- if (t === void 0) n.set(e, [i]);
1190
- else if (t.some((e) => v(e, i))) continue;
1191
- else t.push(i);
1192
- r.push(i);
1193
- }
1194
- return r;
1195
- }, Pi = /*#__PURE__*/ t(2, (e, t) => {
1196
- if (e.reasons.length === 0) return t;
1197
- if (t.reasons.length === 0) return e;
1198
- let n = new ft(Ni(e.reasons, t.reasons));
1199
- return v(e, n) ? e : n;
1200
- }), Fi = (e) => {
1201
- let t;
1202
- for (let n of e.reasons) {
1203
- if (n._tag === "Fail") return n.error;
1204
- n._tag === "Die" && (t ??= n);
1205
- }
1206
- return t === void 0 ? e.reasons.length > 0 ? new globalThis.Error("All fibers interrupted without error") : new globalThis.Error("Empty cause") : t.defect;
1207
- }, Ii = "~effect/Fiber", Li = {
1208
- _A: n,
1209
- _E: n
1210
- }, Ri = { id: 0 }, zi = () => globalThis[Le], Bi = class {
1211
- constructor(e, t = !0) {
1212
- this.setContext(e), this.id = ++Ri.id, this.currentOpCount = 0, this.interruptible = t, this._stack = [], this._observers = void 0, this._exit = void 0, this._children = void 0, this._interruptedCause = void 0, this._yielded = void 0, this._running = !1, this._deferredInterrupt = !1, this._parent = void 0, this.cache.runtimeMetrics?.recordFiberStart(this.context);
1213
- }
1214
- get [Ii]() {
1215
- return Li;
1216
- }
1217
- get currentDispatcher() {
1218
- return this._dispatcher ??= this.cache.scheduler.makeDispatcher();
1219
- }
1220
- getRef(e) {
1221
- return I(this.context, e);
1222
- }
1223
- addObserver(e) {
1224
- return this._exit ? (e(this._exit), s) : (this._observers === void 0 ? this._observers = [e] : this._observers.push(e), () => this.removeObserver(e));
1225
- }
1226
- removeObserver(e) {
1227
- if (this._exit || this._observers === void 0) return;
1228
- let t = this._observers.indexOf(e);
1229
- t >= 0 && this._observers.splice(t, 1);
1230
- }
1231
- interruptUnsafe(e, t) {
1232
- if (this._exit) return;
1233
- let n = Ai(e);
1234
- this.cache.stackFrame && (n = xt(n, Gn(Dt, this.cache.stackFrame))), t && (n = xt(n, t)), this._interruptedCause = this._interruptedCause ? Pi(this._interruptedCause, n) : n, this.interruptible && (this._running ? this._deferredInterrupt = !0 : this.evaluate(H(this._interruptedCause)));
1235
- }
1236
- pollUnsafe() {
1237
- return this._exit;
1238
- }
1239
- evaluate(e) {
1240
- if (this._exit) return;
1241
- if (this._yielded !== void 0) {
1242
- let e = this._yielded;
1243
- this._yielded = void 0, e();
1244
- }
1245
- let t = this.runLoop(e);
1246
- if (t === at) return;
1247
- let n = Wi.interruptChildren && Wi.interruptChildren(this);
1248
- if (n !== void 0) return this.evaluate(q(n, () => t));
1249
- if (this._exit = t, this.cache.runtimeMetrics?.recordFiberEnd(this.context, this._exit), this._parent &&= (this._parent._children?.delete(this), void 0), this._observers !== void 0) {
1250
- let e = this._observers;
1251
- this._observers = void 0;
1252
- for (let n = 0; n < e.length; n++) e[n](t);
1253
- }
1254
- this._stack.length = 0, this._children = void 0, this.context = F();
1255
- }
1256
- runLoop(e) {
1257
- let t = globalThis[Le];
1258
- globalThis[Le] = this;
1259
- let n = this._running;
1260
- this._running = !0;
1261
- let r = !1, i = e;
1262
- this.currentOpCount = 0;
1263
- try {
1264
- for (;;) {
1265
- this._deferredInterrupt && (this._deferredInterrupt = !1, i = H(this._interruptedCause)), this.currentOpCount++;
1266
- let e = this.cache;
1267
- if (!r && !e.preventYield && e.scheduler.shouldYield(this)) {
1268
- r = !0;
1269
- let e = i;
1270
- i = q(Zi, () => e);
1271
- }
1272
- if (i = e.tracerContext ? e.tracerContext(i, this) : i[w](this), i === at) {
1273
- let e = this._yielded;
1274
- if (tt in e) return this._deferredInterrupt = !1, this._yielded = void 0, e;
1275
- if (this._deferredInterrupt) {
1276
- this._yielded = void 0, e();
1277
- continue;
1278
- }
1279
- return at;
1280
- }
1281
- }
1282
- } catch (e) {
1283
- return d(i, w) ? this.runLoop(M(e)) : M(`Fiber.runLoop: Not a valid effect: ${String(i)}`);
1284
- } finally {
1285
- this._running = n, globalThis[Le] = t;
1286
- }
1287
- }
1288
- getCont(e) {
1289
- if (this._deferredInterrupt) return this._deferredInterrupt = !1, Hi;
1290
- for (;;) {
1291
- let t = this._stack.pop();
1292
- if (!t) return;
1293
- let n = t[it];
1294
- if (n !== void 0) {
1295
- let r = n.call(t, this);
1296
- if (r) return r[e] = r, r;
1297
- }
1298
- if (t[e]) return t;
1299
- }
1300
- }
1301
- succeedWith(e) {
1302
- if (!(++this.currentOpCount & Ui - 1)) return A(e);
1303
- let t = this.getCont(T);
1304
- return t ? t[T](e, this) : this.yieldWith(A(e));
1305
- }
1306
- yieldWith(e) {
1307
- return this._yielded = e, at;
1308
- }
1309
- children() {
1310
- return this._children ??= /* @__PURE__ */ new Set();
1311
- }
1312
- pipe() {
1313
- return e(this, arguments);
1314
- }
1315
- setContext(e) {
1316
- let t = this.context;
1317
- if (this.context = e, t !== void 0 && Vn(t, e)) return;
1318
- let n = e.cacheRoot, r = n._fiberCache ??= Vi(e);
1319
- this.cache?.scheduler !== r.scheduler && (this._dispatcher = void 0), this.cache = r;
1320
- }
1321
- get currentSpanLocal() {
1322
- let e = this.cache.span;
1323
- return e?._tag === "Span" ? e : void 0;
1324
- }
1325
- }, Vi = (e) => {
1326
- let t = Yn(e, hi);
1327
- return {
1328
- scheduler: I(e, Yr),
1329
- tracer: t,
1330
- tracerContext: t ? t.context : void 0,
1331
- tracerEnabled: I(e, bi),
1332
- span: Yn(e, li),
1333
- logLevel: I(e, wi),
1334
- minimumLogLevel: I(e, Ti),
1335
- stackFrame: I(e, yi),
1336
- runtimeMetrics: Yn(e, vi),
1337
- maxOpsBeforeYield: I(e, ni),
1338
- preventYield: I(e, ri)
1339
- };
1340
- }, Hi = {
1341
- [T](e, t) {
1342
- return H(t._interruptedCause);
1343
- },
1344
- [E](e, t) {
1345
- return H(t._interruptedCause);
1346
- }
1347
- }, Ui = 32, Wi = { interruptChildren: void 0 }, Gi = (e) => {
1348
- if (!e.cache.stackFrame) return;
1349
- let t = /* @__PURE__ */ new Map();
1350
- return t.set(Ot.key, e.cache.stackFrame), zn(t);
1351
- }, Ki = (e) => {
1352
- let t = e;
1353
- return t._exit ? V(t._exit) : ia((n) => t._exit ? n(V(t._exit)) : U(e.addObserver((e) => n(V(e)))));
1354
- }, qi = (e) => ia((t) => {
1355
- let n = e[Symbol.iterator](), r = [], i;
1356
- function a() {
1357
- let e = n.next();
1358
- for (; !e.done;) {
1359
- if (e.value._exit) {
1360
- r.push(e.value._exit), e = n.next();
1361
- continue;
1362
- }
1363
- i = e.value.addObserver((e) => {
1364
- r.push(e), a();
1365
- });
1366
- return;
1367
- }
1368
- t(V(r));
1369
- }
1370
- return a(), U(() => i?.());
1371
- }), Ji = (e) => N((t) => Yi(e, t.id)), Yi = /*#__PURE__*/ t((e) => d(e[0], Ii), (e, t, n) => N((r) => {
1372
- let i = Gi(r);
1373
- return i = i && n ? er(i, n) : i ?? n, e.interruptUnsafe(t, i), wa(Ki(e));
1374
- })), V = A, H = j, Xi = kt, U = /*#__PURE__*/ k({
1375
- op: "Sync",
1376
- [w](e) {
1377
- let t = this[C](), n = e.getCont(T);
1378
- return n ? n[T](t, e) : e.yieldWith(A(t));
1379
- }
1380
- }), W = /*#__PURE__*/ k({
1381
- op: "Suspend",
1382
- [w](e) {
1383
- return this[C]();
1384
- }
1385
- }), Zi = /*#__PURE__*/ (/* @__PURE__ */ k({
1386
- op: "Yield",
1387
- [w](e) {
1388
- let t = !1;
1389
- return e.currentDispatcher.scheduleTask(() => {
1390
- t || e.evaluate(J);
1391
- }, this[C] ?? 0), e.yieldWith(() => {
1392
- t = !0;
1393
- });
1394
- }
1395
- }))(0), Qi = (e) => M(e), G = /*#__PURE__*/ V(void 0), $i = (e) => {
1396
- let t = typeof e == "function" ? e : e.try, n = typeof e == "function" ? (e) => new ms(e, "An error occurred in Effect.try") : e.catch;
1397
- return W(() => {
1398
- try {
1399
- return V(t());
1400
- } catch (e) {
1401
- return Xi(n(e));
1402
- }
1403
- });
1404
- }, ea = (e) => na(function(t, n) {
1405
- e(n).then((e) => t(V(e)), (e) => t(Qi(e)));
1406
- }, e.length !== 0), ta = (e) => {
1407
- let t = typeof e == "function" ? e : e.try, n = typeof e == "function" ? (e) => new ms(e, "An error occurred in Effect.tryPromise") : e.catch;
1408
- return na(function(e, r) {
1409
- let i = (t) => {
1410
- try {
1411
- e(Xi(Qe(() => n(t))));
1412
- } catch (t) {
1413
- e(Qi(t));
1414
- }
1415
- };
1416
- try {
1417
- t(r).then((t) => e(V(t)), i);
1418
- } catch (e) {
1419
- i(e);
1420
- }
1421
- }, t.length !== 0);
1422
- }, na = /*#__PURE__*/ function() {
1423
- let e = /*#__PURE__*/ O({
1424
- op: "Async",
1425
- [w](e) {
1426
- let t = !1, n = !1, r = this.withSignal ? new AbortController() : void 0, i = this.register.call(e.cache.scheduler, (r) => {
1427
- t || (t = !0, n ? e.evaluate(r) : n = r);
1428
- }, r?.signal);
1429
- return n === !1 ? (n = !0, e._yielded = () => {
1430
- t = !0;
1431
- }, r === void 0 && i === void 0 || e._stack.push(ra(() => (t = !0, r?.abort(), i ?? J))), at) : n;
1432
- }
1433
- }), t = function(e, t) {
1434
- this.register = e, this.withSignal = t;
1435
- };
1436
- return t.prototype = e, function(e, n) {
1437
- return new t(e, n);
1438
- };
1439
- }(), ra = /*#__PURE__*/ k({
1440
- op: "AsyncFinalizer",
1441
- [it](e) {
1442
- e.interruptible && (e.interruptible = !1, e._stack.push(Co));
1443
- },
1444
- [E](e, t) {
1445
- return ji(e) ? q(to(j(e), this[C]()), () => H(e)) : H(e);
1446
- }
1447
- }), ia = (e) => na(e, e.length >= 2), aa = /*#__PURE__*/ ia(s), oa = (e, ...t) => {
1448
- let n = t.length === 0 ? function() {
1449
- return W(() => da(e.apply(this, arguments)));
1450
- } : function() {
1451
- let n = W(() => da(e.apply(this, arguments)));
1452
- for (let e = 0; e < t.length; e++) n = t[e](n, ...arguments);
1453
- return n;
1454
- };
1455
- return sa(e.length, n);
1456
- }, sa = (e, t) => Object.defineProperty(t, "length", {
1457
- value: e,
1458
- configurable: !0
1459
- }), ca = /*#__PURE__*/ Di(2), la = function() {
1460
- let e = typeof arguments[0] == "string", t = e ? arguments[0] : "Effect.fn", n = e ? arguments[1] : void 0, r = Ye(), i;
1461
- return r !== 0 && (Xe(2), i = new globalThis.Error(), Xe(r)), e ? (r, ...a) => ua(t, r, i, a, e, n) : ua(t, arguments[0], i, Array.prototype.slice.call(arguments, 1), e, n);
1462
- }, ua = (e, t, n, r, i, a) => {
1463
- let s = typeof t == "function" ? t : r.shift().bind(t.self), c = `${e} (definition)`, l = n ? ca(() => n.stack) : o;
1464
- return sa(s.length, function(...t) {
1465
- let n = W(() => {
1466
- let e = s.apply(this, arguments);
1467
- return st(e) ? e : da(e);
1468
- });
1469
- for (let e = 0; e < r.length; e++) n = r[e](n, ...t);
1470
- if (!st(n)) return n;
1471
- let ee = Ye(), u;
1472
- return ee !== 0 && (Xe(2), u = new globalThis.Error(), Xe(ee)), Ma(i ? ns(e, a, (e) => rs(n, e)) : n, yi, (t) => ({
1473
- name: e,
1474
- stack: u ? ca(() => u.stack) : o,
1475
- parent: {
1476
- name: c,
1477
- stack: l,
1478
- parent: t
1479
- }
1480
- }));
1481
- });
1482
- }, da = /*#__PURE__*/ function() {
1483
- let e = /*#__PURE__*/ O({
1484
- op: "Iterator",
1485
- [T](e, t) {
1486
- let n = this.iterator;
1487
- for (;;) {
1488
- let r = n.next(e);
1489
- if (r.done) return V(r.value);
1490
- if (!Ta(r.value)) return t._stack.push(this), r.value;
1491
- if (r.value._tag === "Failure") return r.value;
1492
- e = r.value.value;
1493
- }
1494
- },
1495
- [w](e) {
1496
- return this[T](this.initial, e);
1497
- }
1498
- }), t = function(e, t) {
1499
- this.iterator = e, this.initial = t;
1500
- };
1501
- return t.prototype = e, function(e, n) {
1502
- return new t(e, n);
1503
- };
1504
- }(), fa = /*#__PURE__*/ t(2, (e, t) => new K(e, ha, V(t))), pa = function(e) {
1505
- return e._stack.push(this), this[C];
1506
- }, ma = /*#__PURE__*/ O({
1507
- op: "OnSuccess",
1508
- [w]: pa
1509
- }), K = function(e, t, n) {
1510
- this[C] = e, this[T] = t, this.payload = n;
1511
- };
1512
- K.prototype = ma;
1513
- var ha = function() {
1514
- return this.payload;
1515
- }, ga = function(e, t) {
1516
- return t.succeedWith(this.payload);
1517
- }, _a = /*#__PURE__*/ (() => {
1518
- let e = "~effect/Effect/stackProbe";
1519
- return { [e]: function() {
1520
- return (/* @__PURE__ */ Error()).stack;
1521
- } }[e]()?.includes("[as " + e + "]") === !0;
1522
- })(), va = function(e, t) {
1523
- let n = this.payload;
1524
- return t.succeedWith(_a ? n(e) : Qe(() => n(e)));
1525
- }, ya = function(e) {
1526
- let t = this.payload;
1527
- return t(e);
1528
- }, ba = function(e) {
1529
- let t = this.payload;
1530
- return new K(t(e), ga, e);
1531
- }, xa = function(e) {
1532
- return new K(this.payload, ga, e);
1533
- }, Sa = /*#__PURE__*/ t(2, (e, t) => new K(e, st(t) ? ha : ya, t)), Ca = /*#__PURE__*/ t(2, (e, t) => new K(e, st(t) ? xa : ba, t)), wa = (e) => new K(e, ha, J), q = /*#__PURE__*/ t(2, (e, t) => new K(e, ya, t)), Ta = (e) => e[tt] !== void 0, Ea = (e) => q(e, n), Da = /*#__PURE__*/ t(2, (e, t) => new K(e, va, t)), Oa = (e) => e._tag === "Success", ka = (e) => e._tag === "Failure" ? tr(e.cause) : nr(e), J = /*#__PURE__*/ A(void 0), Aa = (e) => {
1534
- let t = [];
1535
- for (let n of e) n._tag === "Failure" && t.push(...n.cause.reasons);
1536
- return t.length === 0 ? J : j(_t(t));
1537
- }, ja = /*#__PURE__*/ t(2, (e, t) => N((n) => {
1538
- let r = n.context, i = t(r);
1539
- return r === i ? e : (n.setContext(i), ho(n, () => {
1540
- n.setContext(r);
1541
- }), e);
1542
- })), Ma = /*#__PURE__*/ t(3, (e, t, n) => ja(e, (e) => {
1543
- let r = Xn(e, t), i = n(r);
1544
- return r === i ? e : Kn(e, t, i);
1545
- })), Na = () => Pa, Pa = /*#__PURE__*/ N((e) => V(e.context)), Fa = (e) => N((t) => e(t.context)), Ia = /*#__PURE__*/ t(2, (e, t) => Ta(e) ? e : ja(e, er(t))), La = function() {
1546
- return arguments.length === 1 ? t(2, (e, t) => Ra(e, arguments[0], t)) : t(3, (e, t, n) => Ra(e, t, n)).apply(this, arguments);
1547
- }, Ra = (e, t, n) => ja(e, Kn(t, n)), za = /*#__PURE__*/ t((e) => st(e[0]), (e, t) => ko({
1548
- while: i,
1549
- body: r(t?.disableYield ? e : q(e, (e) => Zi)),
1550
- step: s
1551
- })), Ba = /*#__PURE__*/ t(2, (e, t) => new Ha(e, t.length === 1 ? t : (e) => t(e))), Va = /*#__PURE__*/ O({
1552
- op: "OnFailure",
1553
- [w]: pa
1554
- }), Ha = function(e, t) {
1555
- this[C] = e, this[E] = t;
1556
- };
1557
- Ha.prototype = Va;
1558
- var Ua = /*#__PURE__*/ t(3, (e, t, n) => Ba(e, (e) => {
1559
- let r = t(e);
1560
- return ir(r) ? H(r.failure) : n(r.success, e);
1561
- })), Wa = /*#__PURE__*/ t(2, (e, t) => new Ka(e, t.onSuccess.length === 1 ? t.onSuccess : (e) => t.onSuccess(e), t.onFailure.length === 1 ? t.onFailure : (e) => t.onFailure(e))), Ga = /*#__PURE__*/ O({
1562
- op: "OnSuccessAndFailure",
1563
- [w]: pa
1564
- }), Ka = function(e, t, n) {
1565
- this[C] = e, this[T] = t, this[E] = n;
1566
- };
1567
- Ka.prototype = Ga;
1568
- var qa = (e) => Ta(e) ? A(e) : Ja(e), Ja = /*#__PURE__*/ k({
1569
- op: "Exit",
1570
- [w](e) {
1571
- return e._stack.push(this), this[C];
1572
- },
1573
- [T](e, t, n) {
1574
- return t.succeedWith(n ?? A(e));
1575
- },
1576
- [E](e, t, n) {
1577
- return t.succeedWith(n ?? j(e));
1578
- }
1579
- }), Ya = "~effect/Scope", Xa = "~effect/Scope/Closeable", Za = /*#__PURE__*/ En("effect/Scope"), Qa = (e, t) => N((n) => {
1580
- let r = $a(e, t);
1581
- return r === void 0 ? G : (Eo(n), r);
1582
- }), $a = (e, t) => {
1583
- let n = e.state;
1584
- if (n._tag === "Closed" || (e.state = {
1585
- _tag: "Closed",
1586
- exit: t
1587
- }, e.parent !== void 0 && so(e.parent, e), n._tag === "Empty")) return;
1588
- if (n.finalizer !== void 0) return eo(n.finalizer, t);
1589
- let r = n.finalizers;
1590
- return r.size === 1 ? eo(r.values().next().value, t) : no(e, r, t);
1591
- }, eo = (e, t) => {
1592
- try {
1593
- return e(t);
1594
- } catch (e) {
1595
- return M(e);
1596
- }
1597
- }, to = (e, t) => Oa(e) ? t : Ba(t, (t) => H(Pi(e.cause, t))), no = /*#__PURE__*/ oa(function* (e, t, n) {
1598
- let r = [], i = [], a = Array.from(t.values()), o = zi();
1599
- for (let t = a.length - 1; t >= 0; t--) {
1600
- let s = a[t];
1601
- e.strategy === "sequential" ? r.push(yield* qa(eo(s, n))) : i.push(Ao(o, eo(s, n), !0, !0, "inherit"));
1602
- }
1603
- return i.length > 0 && (r = yield* qi(i)), yield* Aa(r);
1604
- }), ro = (e, t) => {
1605
- let n = lo(t, e);
1606
- return e.state._tag === "Closed" ? (n.state = e.state, n) : (oo(e, n, (e) => Qa(n, e)), n);
1607
- }, io = (e, t) => W(() => e.state._tag === "Closed" ? t(e.state.exit) : (oo(e, {}, t), G)), ao = (e, t) => io(e, r(t)), oo = (e, t, n) => {
1608
- if (e.state._tag === "Empty") e.state = {
1609
- _tag: "Open",
1610
- finalizerKey: t,
1611
- finalizer: n,
1612
- finalizers: void 0
1613
- };
1614
- else if (e.state._tag === "Open") {
1615
- let r = e.state;
1616
- r.finalizer === void 0 ? r.finalizers.set(t, n) : (r.finalizers = /* @__PURE__ */ new Map([[r.finalizerKey, r.finalizer]]), r.finalizerKey = void 0, r.finalizer = void 0, r.finalizers.set(t, n));
1617
- }
1618
- }, so = (e, t) => {
1619
- if (e.state._tag !== "Open") return;
1620
- let n = e.state;
1621
- n.finalizerKey === t ? e.state = uo : n.finalizers !== void 0 && (n.finalizers.delete(t), n.finalizers.size === 0 && (e.state = uo));
1622
- }, co = (e) => lo(e, void 0), lo = (e = "sequential", t) => ({
1623
- [Xa]: Xa,
1624
- [Ya]: Ya,
1625
- strategy: e,
1626
- parent: t,
1627
- state: uo
1628
- }), uo = { _tag: "Empty" }, fo = /*#__PURE__*/ La(Za), po = /*#__PURE__*/ function() {
1629
- let e = /*#__PURE__*/ O({
1630
- op: "OnExit",
1631
- [w](e) {
1632
- return e._stack.push(this), this.effect;
1633
- },
1634
- [it](e) {
1635
- e.interruptible && this.interruptible !== !0 && (e._stack.push(Co), e.interruptible = !1);
1636
- },
1637
- [T](e, t, n) {
1638
- n ??= A(e);
1639
- let r;
1640
- try {
1641
- r = this.onExit(n);
1642
- } catch (e) {
1643
- r = M(e);
1644
- }
1645
- return r ? q(r, (e) => n) : n;
1646
- },
1647
- [E](e, t, n) {
1648
- n ??= j(e);
1649
- let r;
1650
- try {
1651
- r = this.onExit(n);
1652
- } catch (e) {
1653
- r = M(e);
1654
- }
1655
- return r ? q(to(n, r), (e) => n) : n;
1656
- }
1657
- }), t = function(e, t, n) {
1658
- this.effect = e, this.onExit = t, this.interruptible = n;
1659
- };
1660
- return t.prototype = e, t;
1661
- }(), mo = (e, t, n) => new po(e, t, n), ho = (e, t) => {
1662
- e._stack.push(new po(void 0, t, void 0));
1663
- }, go = /*#__PURE__*/ t(2, mo), _o = /*#__PURE__*/ t(3, (e, t, n) => go(e, (e) => {
1664
- let r = t(e);
1665
- return ir(r) ? G : n(r.success, e);
1666
- })), vo = /*#__PURE__*/ t(2, (e, t) => _o(e, ka, t)), yo = /*#__PURE__*/ t(3, (e, t, n) => go(e, (e) => {
1667
- if (e._tag !== "Failure") return G;
1668
- let r = t(e.cause);
1669
- return ir(r) ? G : n(r.success, e.cause);
1670
- })), bo = /*#__PURE__*/ t(2, (e, t) => yo(Mi, t)(e)), xo = (e) => U(() => {
1671
- let t = qo(!1), n = !1, r, i = q(t.await, () => r);
1672
- return N((a) => r === void 0 ? n ? i : (n = !0, ho(a, (e) => U(() => {
1673
- r = e, t.openUnsafe();
1674
- })), e) : r);
1675
- }), So = /*#__PURE__*/ k({
1676
- op: "SetInterruptible",
1677
- [it](e) {
1678
- if (e.interruptible = this[C], e._interruptedCause && e.interruptible) return () => H(e._interruptedCause);
1679
- }
1680
- }), Co = /*#__PURE__*/ So(!0), wo = /*#__PURE__*/ So(!1), To = (e) => {
1681
- if (e.interruptible = !0, e._stack.push(wo), e._interruptedCause) return H(e._interruptedCause);
1682
- }, Eo = (e) => {
1683
- let t = e;
1684
- t.interruptible && (t.interruptible = !1, t._stack.push(Co));
1685
- }, Do = (e) => N((t) => t.interruptible ? e : To(t) ?? e), Oo = (e) => N((t) => t.interruptible ? (t.interruptible = !1, t._stack.push(Co), e(Do)) : e(n)), ko = /*#__PURE__*/ k({
1686
- op: "While",
1687
- [T](e, t) {
1688
- return this[C].step(e), this[C].while() ? (t._stack.push(this), this[C].body()) : J;
1689
- },
1690
- [w](e) {
1691
- return this[C].while() ? (e._stack.push(this), this[C].body()) : J;
1692
- }
1693
- }), Ao = (e, t, n = !1, r = !1, i = !1) => {
1694
- let a = e, o = i === "inherit" ? a.interruptible : !i, s = new Bi(a.context, o);
1695
- return n ? s.evaluate(t) : a.currentDispatcher.scheduleTask(() => s.evaluate(t), 0), !r && !s._exit && (a.children().add(s), s._parent = a), s;
1696
- }, jo = (e) => (t, n) => {
1697
- let r = new Bi(n?.scheduler ? Kn(e, Yr, n.scheduler) : e, n?.uninterruptible !== !0);
1698
- if (r.evaluate(t), r._exit) return r;
1699
- if (n?.signal) {
1700
- if (n.signal.aborted) r.interruptUnsafe();
1701
- else {
1702
- let e = () => r.interruptUnsafe();
1703
- n.signal.addEventListener("abort", e, { once: !0 }), r.addObserver(() => n.signal.removeEventListener("abort", e));
1704
- }
1705
- }
1706
- return n?.onFiberStart && n.onFiberStart(r), r;
1707
- }, Mo = /*#__PURE__*/ t(2, (e, t) => {
1708
- if (e._exit) return e;
1709
- if (t.state._tag === "Closed") return e.interruptUnsafe(e.id), e;
1710
- let n = {};
1711
- return oo(t, n, () => Ji(e)), e.addObserver(() => so(t, n)), e;
1712
- }), No = /*#__PURE__*/ jo(/*#__PURE__*/ F()), Po = (e) => {
1713
- let t = jo(e);
1714
- return (e, n) => {
1715
- let r = t(e, n);
1716
- return n?.onExit && r.addObserver(n.onExit), (e) => r.interruptUnsafe(e);
1717
- };
1718
- }, Fo = /*#__PURE__*/ Po(/*#__PURE__*/ F()), Io = (e) => {
1719
- let t = jo(e);
1720
- return (e, n) => {
1721
- let r = t(e, n);
1722
- return new Promise((e) => {
1723
- r.addObserver((t) => e(t));
1724
- });
1725
- };
1726
- }, Lo = /*#__PURE__*/ Io(/*#__PURE__*/ F()), Ro = (e) => {
1727
- let t = Io(e);
1728
- return (e, n) => t(e, n).then((e) => {
1729
- if (e._tag === "Failure") throw Fi(e.cause);
1730
- return e.value;
1731
- });
1732
- }, zo = /*#__PURE__*/ Ro(/*#__PURE__*/ F()), Bo = (e) => {
1733
- let t = jo(e);
1734
- return (e) => {
1735
- if (Ta(e)) return e;
1736
- let n = new ei("sync"), r = t(e, { scheduler: n });
1737
- return r._dispatcher?.flush(), r._exit ?? M(new fs(r));
1738
- };
1739
- }, Vo = /*#__PURE__*/ Bo(/*#__PURE__*/ F()), Ho = (e) => {
1740
- let t = Bo(e);
1741
- return (e) => {
1742
- let n = t(e);
1743
- if (n._tag === "Failure") throw Fi(n.cause);
1744
- return n.value;
1745
- };
1746
- }, Uo = /*#__PURE__*/ Ho(/*#__PURE__*/ F()), Wo = /*#__PURE__*/ V(!0), Go = /*#__PURE__*/ V(!1), Ko = class {
1747
- waiters = [];
1748
- scheduled = void 0;
1749
- _isOpen;
1750
- constructor(e) {
1751
- this._isOpen = e;
1752
- }
1753
- scheduleUnsafe(e) {
1754
- if (this.waiters.length === 0) return Wo;
1755
- if (this.scheduled === void 0) this.scheduled = this.waiters, e.currentDispatcher.scheduleTask(this.flushScheduled, 0);
1756
- else for (let e = 0; e < this.waiters.length; e++) this.scheduled.push(this.waiters[e]);
1757
- return this.waiters = [], Wo;
1758
- }
1759
- flushScheduled = () => {
1760
- if (this.scheduled === void 0) return;
1761
- let e = this.scheduled;
1762
- this.scheduled = void 0;
1763
- for (let t = 0; t < e.length; t++) e[t](J);
1764
- };
1765
- flushWaiters() {
1766
- let e = this.waiters;
1767
- this.waiters = [], this.flushScheduled();
1768
- for (let t = 0; t < e.length; t++) e[t](J);
1769
- }
1770
- open = /*#__PURE__*/ N((e) => this._isOpen ? Go : (this._isOpen = !0, this.scheduleUnsafe(e)));
1771
- release = /*#__PURE__*/ N((e) => this._isOpen ? Go : this.scheduleUnsafe(e));
1772
- openUnsafe() {
1773
- return !this._isOpen && (this._isOpen = !0, this.flushWaiters(), !0);
1774
- }
1775
- await = /*#__PURE__*/ ia((e) => this._isOpen ? e(G) : (this.waiters.push(e), U(() => {
1776
- let t = this.waiters.indexOf(e);
1777
- t === -1 ? this.scheduled !== void 0 && (t = this.scheduled.indexOf(e), t !== -1 && this.scheduled.splice(t, 1)) : this.waiters.splice(t, 1);
1778
- })));
1779
- closeUnsafe() {
1780
- return this._isOpen ? (this._isOpen = !1, !0) : !1;
1781
- }
1782
- close = /*#__PURE__*/ U(() => this.closeUnsafe());
1783
- whenOpen = (e) => q(this.await, () => e);
1784
- isOpen() {
1785
- return this._isOpen;
1786
- }
1787
- }, qo = (e) => new Ko(e ?? !1), Jo = /*#__PURE__*/ La(bi), Yo = /*#__PURE__*/ BigInt(0), Xo = {
1788
- _tag: "Span",
1789
- spanId: "noop",
1790
- traceId: "noop",
1791
- sampled: !1,
1792
- status: {
1793
- _tag: "Ended",
1794
- startTime: Yo,
1795
- endTime: Yo,
1796
- exit: J
1797
- },
1798
- attributes: /*#__PURE__*/ new Map(),
1799
- links: [],
1800
- kind: "internal",
1801
- attribute() {},
1802
- event() {},
1803
- end() {},
1804
- addLinks() {}
1805
- }, Zo = (e) => Object.assign(Object.create(Xo), e), Qo = (e) => e ? I(e.annotations, fi) ? e._tag === "Span" ? Qo(wn(e.parent)) : P() : vn(e) : P(), $o = (e, t, n) => {
1806
- let r = !e.cache.tracerEnabled || n?.annotations && I(n.annotations, fi), i = n?.parent === void 0 ? n?.root ? P() : Qo(e.cache.span) : vn(n.parent), a;
1807
- if (r) a = Zo({
1808
- name: t,
1809
- parent: i,
1810
- annotations: Kn(n?.annotations ?? F(), fi, !0)
1811
- });
1812
- else {
1813
- let r = e.cache.tracer ?? gi, o = e.getRef(as), s = e.getRef(xi), c = e.getRef(Si), l = e.getRef(Ci), ee = n?.level ?? e.getRef(pi), u = n?.links === void 0 ? l.length === 0 ? [] : l.slice() : [...l, ...n.links];
1814
- a = r.span({
1815
- name: t,
1816
- parent: i,
1817
- annotations: n?.annotations ?? F(),
1818
- links: u,
1819
- startTime: s ? o.currentTimeNanosUnsafe() : Yo,
1820
- kind: n?.kind ?? "internal",
1821
- root: n?.root ?? yn(i),
1822
- sampled: n?.sampled ?? (bn(i) && i.value.sampled === !1 ? !1 : !hs(e.getRef(mi), ee))
1823
- });
1824
- for (let e in c) a.attribute(e, c[e]);
1825
- if (n?.attributes !== void 0) for (let e in n.attributes) a.attribute(e, n.attributes[e]);
1826
- }
1827
- return a;
1828
- }, es = (e, t) => (t = typeof t == "function" ? t : o, Ma(yi, (n) => ({
1829
- name: e,
1830
- stack: t,
1831
- parent: n
1832
- }))), ts = (e, t, n, r) => U(() => {
1833
- e.status._tag !== "Ended" && e.end(r ? n.currentTimeNanosUnsafe() : Yo, t);
1834
- }), ns = (e, ...t) => {
1835
- let n = t.length === 1 ? void 0 : t[0], r = t[t.length - 1];
1836
- return N((t) => {
1837
- let i = $o(t, e, n), a = t.getRef(as), o = t.getRef(xi);
1838
- return ho(t, (e) => ts(i, e, a, o)), r(i);
1839
- });
1840
- }, rs = /*#__PURE__*/ La(ui), is = function() {
1841
- let e = st(arguments[0]), t = e ? arguments[1] : arguments[0], r = e ? arguments[2] : arguments[1], i = n;
1842
- return t._tag === "Span" && (r = Ei(r), i = es(t.name, r?.captureStackTrace)), e ? rs(i(arguments[0]), t) : (e) => rs(i(e), t);
1843
- }, as = /*#__PURE__*/ L("effect/Clock", { defaultValue: () => new ss() }), os = 2 ** 31 - 1, ss = class {
1844
- currentTimeMillisUnsafe() {
1845
- return Date.now();
1846
- }
1847
- currentTimeMillis = /*#__PURE__*/ U(() => this.currentTimeMillisUnsafe());
1848
- currentTimeNanosUnsafe() {
1849
- return us();
1850
- }
1851
- currentTimeNanos = /*#__PURE__*/ U(() => this.currentTimeNanosUnsafe());
1852
- monotonicTimeNanosUnsafe() {
1853
- return ls();
1854
- }
1855
- monotonicTimeNanos = /*#__PURE__*/ U(() => this.monotonicTimeNanosUnsafe());
1856
- sleep(e) {
1857
- return this.sleepMillis(Ur(e));
1858
- }
1859
- sleepMillis(e) {
1860
- return e <= 0 ? Zi : Number.isFinite(e) ? ia((t) => {
1861
- let n = e > os ? this.sleepMillis(e - os) : G, r = setTimeout(() => t(n), Math.min(e, os));
1862
- return U(() => clearTimeout(r));
1863
- }) : aa;
1864
- }
1865
- }, cs = /*#__PURE__*/ BigInt(1e6), ls = /*#__PURE__*/ function() {
1866
- let e = globalThis.process?.hrtime;
1867
- if (typeof e?.bigint == "function") return () => e.bigint();
1868
- if (typeof performance < "u" && typeof performance.now == "function") return () => BigInt(Math.round(performance.now() * 1e6));
1869
- let t = /*#__PURE__*/ BigInt(0);
1870
- return () => {
1871
- let e = BigInt(Date.now()) * cs;
1872
- return e > t && (t = e), t;
1873
- };
1874
- }(), us = /*#__PURE__*/ function() {
1875
- let e = /*#__PURE__*/ BigInt(1e9), t;
1876
- return () => {
1877
- let n = ls(), r = BigInt(Date.now()) * cs;
1878
- if (t === void 0) t = r - n;
1879
- else {
1880
- let i = t + n;
1881
- (r > i ? r - i : i - r) > e && (t = r - n);
1882
- }
1883
- return t + n;
1884
- };
1885
- }(), ds = "~effect/Cause/AsyncFiberError", fs = class extends (/*#__PURE__*/ Mt("AsyncFiberError")) {
1886
- [ds] = ds;
1887
- constructor(e) {
1888
- super({
1889
- message: "An asynchronous Effect was executed with Effect.runSync",
1890
- fiber: e
1891
- });
1892
- }
1893
- }, ps = "~effect/Cause/UnknownError", ms = class extends (/*#__PURE__*/ Mt("UnknownError")) {
1894
- [ps] = ps;
1895
- constructor(e, t) {
1896
- super({
1897
- message: t,
1898
- cause: e
1899
- });
1900
- }
1901
- }, hs = /*#__PURE__*/ _n(/* @__PURE__ */ gn(hn, (e) => {
1902
- switch (e) {
1903
- case "All": return -(2 ** 53 - 1);
1904
- case "Fatal": return 5e4;
1905
- case "Error": return 4e4;
1906
- case "Warn": return 3e4;
1907
- case "Info": return 2e4;
1908
- case "Debug": return 1e4;
1909
- case "Trace": return 0;
1910
- case "None": return 2 ** 53 - 1;
1911
- }
1912
- })), Y = {
1913
- bold: "1",
1914
- red: "31",
1915
- green: "32",
1916
- yellow: "33",
1917
- blue: "34",
1918
- cyan: "36",
1919
- white: "37",
1920
- gray: "90",
1921
- black: "30",
1922
- bgBrightRed: "101"
1923
- };
1924
- Y.gray, Y.blue, Y.green, Y.yellow, Y.red, Y.bgBrightRed, Y.black;
1925
- //#endregion
1926
- //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Cause.js
1927
- var gs = _t, _s = Fi, vs = ji, ys = Pt, bs = Rt, xs = A, Ss = j, Cs = J, ws = {
1928
- "~effect/Deferred": {
1929
- _A: n,
1930
- _E: n
1931
- },
1932
- pipe() {
1933
- return e(this, arguments);
1934
- }
1935
- }, Ts = function() {
1936
- this.resumes = void 0, this.effect = void 0;
1937
- };
1938
- Ts.prototype = ws;
1939
- var Es = () => new Ts(), Ds = (e) => ia((t) => e.effect ? t(e.effect) : (e.resumes ??= [], e.resumes.push(t), U(() => {
1940
- let n = e.resumes;
1941
- if (n === void 0) return;
1942
- let r = n.indexOf(t);
1943
- r >= 0 && n.splice(r, 1);
1944
- }))), Os = (e, t) => {
1945
- if (e.effect) return !1;
1946
- if (e.effect = t, e.resumes) {
1947
- let n = e.resumes;
1948
- e.resumes = void 0;
1949
- for (let e = 0; e < n.length; e++) n[e](t);
1950
- }
1951
- return !0;
1952
- }, ks = co, As = fo, js = io, Ms = ao, Ns = ro, Ps = Qa, Fs = "~effect/Layer", Is = "~effect/Layer/MemoMap", Ls = (e, t) => {
1953
- let n = {
1954
- observers: 0,
1955
- deferred: Es(),
1956
- scope: ks(),
1957
- finalizer: (r) => W(() => --n.observers > 0 ? G : (e.map.delete(t), Ps(n.scope, r)))
1958
- };
1959
- return n;
1960
- }, Rs = (e, t) => t.state._tag !== "Closed" && (e.observers++, oo(t, {}, e.finalizer), !0), zs = {
1961
- [Fs]: {
1962
- _ROut: n,
1963
- _E: n,
1964
- _RIn: n
1965
- },
1966
- pipe() {
1967
- return e(this, arguments);
1968
- }
1969
- }, Bs = (e) => {
1970
- let t = Object.create(zs);
1971
- return t.build = e, t;
1972
- }, Vs = (e) => Bs((t, n) => {
1973
- let r = Ns(n);
1974
- return go(e(t, r), (e) => e._tag === "Failure" ? Ps(r, e) : G);
1975
- }), Hs = (e) => {
1976
- let t = Vs((n, r) => n.getOrElseMemoize(t, r, e));
1977
- return t;
1978
- }, Us = class {
1979
- get [Is]() {
1980
- return Is;
1981
- }
1982
- parent;
1983
- constructor(e) {
1984
- this.parent = e;
1985
- }
1986
- map = /*#__PURE__*/ new Map();
1987
- get(e, t) {
1988
- let n = this.map.get(e);
1989
- return n ? (Rs(n, t), n.deferred.effect ?? Ds(n.deferred)) : this.parent?.get(e, t);
1990
- }
1991
- getOrElseMemoize(e, t, n) {
1992
- return W(() => {
1993
- let r;
1994
- return mo(W(() => {
1995
- let i = this.get(e, t);
1996
- if (i) return i;
1997
- let a = Ls(this, e);
1998
- return Rs(a, t) ? (r = a.deferred, this.map.set(e, a), n(this, a.scope)) : n(this, t);
1999
- }), (e) => {
2000
- r && Os(r, e);
2001
- });
2002
- });
2003
- }
2004
- }, Ws = () => new Us(), Gs = (e) => new Us(e), Ks = class e extends (/*#__PURE__*/ En()("effect/Layer/CurrentMemoMap")) {
2005
- static forkOrCreate(t) {
2006
- let n = Jn(t, e);
2007
- return n ? Gs(n) : Ws();
2008
- }
2009
- }, qs = /*#__PURE__*/ t(3, (e, t, n) => La(Da(e.build(t, n), Kn(Ks, t)), Ks, t)), Js = function() {
2010
- return arguments.length === 1 ? (e) => Ys(arguments[0], e) : Ys(arguments[0], arguments[1]);
2011
- }, Ys = (e, t) => Xs(Da(t, (t) => Gn(e, t))), Xs = (e) => Hs((t, n) => As(e, n)), Zs = /*#__PURE__*/ t(2, (e, t) => Ua(e, ec, (e) => t(e))), Qs = (e) => e._tag === "Fail" && ys(e.error), $s = (e) => {
2012
- let t, n = !1;
2013
- for (let r of e.reasons) Qs(r) ? t ??= r.error : r._tag !== "Interrupt" && (n = !0);
2014
- return t === void 0 ? nr(e) : n ? nr(gs(e.reasons.filter((e) => !Qs(e)))) : tr(t);
2015
- }, ec = (e) => {
2016
- let t = $s(e);
2017
- return ir(t) ? t : tr(t.success.value);
2018
- }, tc = (e) => {
2019
- let t = $s(e);
2020
- return ir(t) ? Ss(t.failure) : xs(t.success.value);
2021
- }, nc = ea, rc = ta, X = V, ic = W, ac = U, oc = Xi, sc = H, cc = Qi, lc = $i, uc = N, Z = q, dc = Ea, fc = Sa, pc = Ca, mc = Da, hc = fa, gc = wa, _c = Ba, vc = Wa, yc = Na, bc = Fa, xc = Ia, Sc = ja, Cc = La, wc = vo, Tc = go, Ec = xo, Dc = bo, Oc = Oo, kc = za, Ac = Jo, jc = ns, Mc = is, Nc = No, Pc = jo, Fc = Po, Ic = Fo, Lc = zo, Rc = Ro, zc = Lo, Bc = Io, Vc = Uo, Hc = Ho, Uc = Vo, Wc = Bo, Gc = oa, Kc = la, qc = "~effect/http/Cookies", Jc = "~effect/http/Cookies/Cookie", Yc = {
2022
- [qc]: qc,
2023
- ...Ke,
2024
- toJSON() {
2025
- return {
2026
- _id: "effect/Cookies",
2027
- cookies: cr(this.cookies, (e) => e.toJSON())
2028
- };
2029
- },
2030
- pipe() {
2031
- return e(this, arguments);
2032
- }
2033
- }, Xc = (e) => {
2034
- let t = Object.create(Yc);
2035
- return t.cookies = e, t;
2036
- }, Zc = (e) => {
2037
- let t = {};
2038
- for (let n of e) $e(t, n.name, n);
2039
- return Xc(t);
2040
- }, Qc = (e) => {
2041
- let t = typeof e == "string" ? [e] : e, n = [];
2042
- for (let e of t) {
2043
- let t = $c(e.trim());
2044
- t && n.push(t);
2045
- }
2046
- return Zc(n);
2047
- };
2048
- function $c(e) {
2049
- let t = e.split(";").map((e) => e.trim()).filter((e) => e !== "");
2050
- if (t.length === 0) return;
2051
- let n = t[0].indexOf("=");
2052
- if (n === -1) return;
2053
- let r = t[0].slice(0, n);
2054
- if (!el.test(r)) return;
2055
- let i = t[0].slice(n + 1), a = nl(i);
2056
- if (t.length === 1) return Object.assign(Object.create(tl), {
2057
- name: r,
2058
- value: a,
2059
- valueEncoded: i
2060
- });
2061
- let o = {};
2062
- for (let e = 1; e < t.length; e++) {
2063
- let n = t[e], r = n.indexOf("="), i = r === -1 ? n : n.slice(0, r).trim(), a = r === -1 ? void 0 : n.slice(r + 1).trim();
2064
- switch (i.toLowerCase()) {
2065
- case "domain": {
2066
- if (a === void 0) break;
2067
- let e = a.trim().replace(/^\./, "");
2068
- e && (o.domain = e);
2069
- break;
2070
- }
2071
- case "expires": {
2072
- if (a === void 0) break;
2073
- let e = new Date(a);
2074
- isNaN(e.getTime()) || (o.expires = e);
2075
- break;
2076
- }
2077
- case "max-age": {
2078
- if (a === void 0) break;
2079
- let e = parseInt(a, 10);
2080
- isNaN(e) || (o.maxAge = Rr(e));
2081
- break;
2082
- }
2083
- case "path":
2084
- if (a === void 0) break;
2085
- a[0] === "/" && (o.path = a);
2086
- break;
2087
- case "priority":
2088
- if (a === void 0) break;
2089
- switch (a.toLowerCase()) {
2090
- case "low":
2091
- o.priority = "low";
2092
- break;
2093
- case "medium":
2094
- o.priority = "medium";
2095
- break;
2096
- case "high": o.priority = "high";
2097
- }
2098
- break;
2099
- case "httponly":
2100
- o.httpOnly = !0;
2101
- break;
2102
- case "secure":
2103
- o.secure = !0;
2104
- break;
2105
- case "partitioned":
2106
- o.partitioned = !0;
2107
- break;
2108
- case "samesite":
2109
- if (a === void 0) break;
2110
- switch (a.toLowerCase()) {
2111
- case "lax":
2112
- o.sameSite = "lax";
2113
- break;
2114
- case "strict":
2115
- o.sameSite = "strict";
2116
- break;
2117
- case "none": o.sameSite = "none";
2118
- }
2119
- }
2120
- }
2121
- return Object.assign(Object.create(tl), {
2122
- name: r,
2123
- value: a,
2124
- valueEncoded: i,
2125
- options: Object.keys(o).length > 0 ? o : void 0
2126
- });
2127
- }
2128
- var el = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/, tl = {
2129
- [Jc]: Jc,
2130
- ...Ke,
2131
- toJSON() {
2132
- return {
2133
- _id: "effect/Cookies/Cookie",
2134
- name: this.name,
2135
- value: this.value,
2136
- options: this.options
2137
- };
2138
- }
2139
- }, nl = (e) => {
2140
- try {
2141
- return decodeURIComponent(e);
2142
- } catch {
2143
- return e;
2144
- }
2145
- }, rl = /*#__PURE__*/ new WeakMap(), il = (e) => {
2146
- if (rl.has(e)) return rl.get(e);
2147
- throw Error("Unable to get redacted value" + (e.label ? ` with label: "${e.label}"` : ""));
2148
- }, al = (e) => typeof e == "string" ? e : il(e), ol = "~effect/Redacted", sl = (e) => d(e, ol), cl = (e, t) => {
2149
- let n = Object.create(ll);
2150
- return t?.label && (n.label = t.label), rl.set(n, e), n;
2151
- }, ll = {
2152
- [ol]: { _A: (e) => e },
2153
- label: void 0,
2154
- ...D,
2155
- toJSON() {
2156
- return this.toString();
2157
- },
2158
- toString() {
2159
- return `<redacted${ne(this.label) ? ":" + this.label : ""}>`;
2160
- },
2161
- [f]() {
2162
- return p(rl.get(this));
2163
- },
2164
- [_](e) {
2165
- return sl(e) && v(rl.get(this), rl.get(e));
2166
- }
2167
- }, ul = /*#__PURE__*/ Symbol.for("~effect/http/Headers"), dl = /*#__PURE__*/ Object.defineProperties(/*#__PURE__*/ Object.create(null), {
2168
- [ul]: { value: ul },
2169
- [Ne]: { value(e) {
2170
- return xl(this, I(e, Cl));
2171
- } },
2172
- toJSON: { value() {
2173
- return Fe(this);
2174
- } },
2175
- [_]: { value(e) {
2176
- return pl(this, e);
2177
- } },
2178
- [f]: { value() {
2179
- return de(this);
2180
- } },
2181
- toString: { value: Ke.toString },
2182
- [x]: { value: Ke[x] }
2183
- }), fl = (e) => Object.assign(Object.create(dl), e), pl = /*#__PURE__*/ dr(/*#__PURE__*/ Ht()), ml = /*#__PURE__*/ Object.create(dl), hl = (e) => {
2184
- if (e === void 0) return ml;
2185
- if (Symbol.iterator in e) {
2186
- let t = Object.create(dl);
2187
- for (let [n, r] of e) t[n.toLowerCase()] = r;
2188
- return t;
2189
- }
2190
- let t = Object.create(dl);
2191
- for (let [n, r] of Object.entries(e)) Array.isArray(r) ? t[n.toLowerCase()] = r.join(", ") : r !== void 0 && (t[n.toLowerCase()] = r);
2192
- return t;
2193
- }, gl = (e) => Object.setPrototypeOf(e, dl), _l = /*#__PURE__*/ t(3, (e, t, n) => {
2194
- let r = fl(e);
2195
- return r[t.toLowerCase()] = n, r;
2196
- }), vl = /*#__PURE__*/ t(2, (e, t) => fl({
2197
- ...e,
2198
- ...hl(t)
2199
- })), yl = /*#__PURE__*/ t(2, (e, t) => {
2200
- let n = fl(e);
2201
- return Object.assign(n, t), n;
2202
- }), bl = /*#__PURE__*/ t(2, (e, t) => {
2203
- let n = fl(e);
2204
- return delete n[t.toLowerCase()], n;
2205
- }), xl = /*#__PURE__*/ t(2, (e, t) => {
2206
- let n = { ...e }, r = (t) => {
2207
- if (typeof t == "string") {
2208
- let r = t.toLowerCase();
2209
- r in e && (n[r] = cl(e[r]));
2210
- } else for (let r in e) r.search(t) !== -1 && (n[r] = cl(e[r]));
2211
- };
2212
- if (Array.isArray(t)) for (let e = 0; e < t.length; e++) r(t[e]);
2213
- else r(t);
2214
- return n;
2215
- }), Sl = (e, t) => {
2216
- for (let n = 0; n < t.length; n++) {
2217
- let r = t[n];
2218
- if (typeof r == "string") {
2219
- if (r.toLowerCase() === e.toLowerCase()) return !0;
2220
- } else if (e.search(r) !== -1) return !0;
2221
- }
2222
- return !1;
2223
- }, Cl = /*#__PURE__*/ L("effect/Headers/CurrentRedactedNames", { defaultValue: () => [
2224
- "authorization",
2225
- "cookie",
2226
- "set-cookie",
2227
- "x-api-key"
2228
- ] }), wl = "~effect/http/UrlParams", Tl = (e) => d(e, wl), El = {
2229
- ...D,
2230
- [wl]: wl,
2231
- [Symbol.iterator]() {
2232
- return this.params[Symbol.iterator]();
2233
- },
2234
- toJSON() {
2235
- return {
2236
- _id: "UrlParams",
2237
- params: Object.fromEntries(this.params)
2238
- };
2239
- },
2240
- [_](e) {
2241
- return Al(this, e);
2242
- },
2243
- [f]() {
2244
- return pe(this.params.flat());
2245
- }
2246
- }, Dl = (e) => {
2247
- let t = Object.create(El);
2248
- return t.params = e, t;
2249
- }, Ol = (e) => {
2250
- if (Tl(e)) return e;
2251
- let t = kl(e), n = [];
2252
- for (let e = 0; e < t.length; e++) if (Array.isArray(t[e][0])) {
2253
- let [r, i] = t[e];
2254
- n.push([`${r[0]}[${r.slice(1).join("][")}]`, i]);
2255
- } else n.push(t[e]);
2256
- return Dl(n);
2257
- }, kl = (e) => {
2258
- let t = typeof e[Symbol.iterator] == "function" ? pr(e) : Object.entries(e), n = [];
2259
- for (let [e, r] of t) if (Array.isArray(r)) for (let t = 0; t < r.length; t++) r[t] !== void 0 && n.push([e, String(r[t])]);
2260
- else if (typeof r == "object" && r) {
2261
- let t = kl(r);
2262
- for (let [r, i] of t) n.push([[e, ...typeof r == "string" ? [r] : r], i]);
2263
- } else r !== void 0 && n.push([e, String(r)]);
2264
- return n;
2265
- }, Al = /*#__PURE__*/ Bt((e, t) => jl(e.params, t.params)), jl = /*#__PURE__*/ hr(/*#__PURE__*/ or([/*#__PURE__*/ Ht(), /*#__PURE__*/ Ht()])), Ml = /*#__PURE__*/ Dl([]), Nl = /*#__PURE__*/ t(2, (e, t) => {
2266
- let n = Ol(t).params.slice(), r = /* @__PURE__ */ new Set();
2267
- for (let e = 0; e < n.length; e++) r.add(n[e][0]);
2268
- for (let t = 0; t < e.params.length; t++) r.has(e.params[t][0]) || n.push(e.params[t]);
2269
- return Dl(n);
2270
- }), Pl = Ki, Fl = Ji, Il = Mo, Ll = qo, Rl = "~effect/MutableRef", zl = {
2271
- [Rl]: Rl,
2272
- ...D,
2273
- toJSON() {
2274
- return {
2275
- _id: "MutableRef",
2276
- current: Ge(this.current)
2277
- };
2278
- }
2279
- }, Bl = (e) => {
2280
- let t = Object.create(zl);
2281
- return t.current = e, t;
2282
- }, Vl = {
2283
- "~effect/Channel": {
2284
- _Env: n,
2285
- _InErr: n,
2286
- _InElem: n,
2287
- _OutErr: n,
2288
- _OutElem: n
2289
- },
2290
- pipe() {
2291
- return e(this, arguments);
2292
- }
2293
- }, Hl = (e) => {
2294
- let t = Object.create(Vl);
2295
- return t.transform = (t, n) => _c(e(t, n), (e) => X(sc(e))), t;
2296
- }, Ul = (e) => Hl((t, n) => e), Wl = (e) => Hl(Gc(function* (t, n) {
2297
- let r = Ns(n), i = (e) => Ps(r, tc(e));
2298
- return wc(yield* wc(e(t, n, r), i), i);
2299
- })), Gl = (e) => e.transform, Kl = (e) => Hl((t, n) => ic(() => Gl(e())(t, n))), ql = (e) => Ul(X(oc(e))), Jl = (e) => Hl((t, n) => Yl({
2300
- scope: n,
2301
- readable: e.evaluate(),
2302
- onError: e.onError,
2303
- releaseLockOnEnd: e.releaseLockOnEnd
2304
- })), Yl = (e) => {
2305
- let t = e.readable.getReader(), n = e.exit ?? Bl(void 0), r = ic(() => n.current ? n.current : vc(rc({
2306
- try: () => t.read(),
2307
- catch: e.onError
2308
- }), {
2309
- onFailure: (e) => n.current ?? sc(e),
2310
- onSuccess: ({ done: e, value: t }) => n.current ? n.current : e ? bs() : X(mr(t))
2311
- }));
2312
- return hc(Ms(e.scope, e.releaseLockOnEnd ? ac(() => t.releaseLock()) : nc(() => t.cancel().catch(s))), r);
2313
- }, Xl = /*#__PURE__*/ t(2, (e, t) => Wl((n, r, i) => js(i, t).pipe(fc(Gl(e)(n, r))))), Zl = /*#__PURE__*/ t(2, (e, t) => Xl(e, (e) => t)), Ql = (e, t, n) => ic(() => {
2314
- let r = ks();
2315
- return Zs(Z(Gl(e)(bs(), r), t), n || X).pipe(Tc((e) => Ps(r, e)));
2316
- }), $l = /*#__PURE__*/ t(2, (e, t) => Ql(e, (e) => kc(Z(e, t), { disableYield: !0 }))), eu = "~effect/Stream", tu = {
2317
- _R: n,
2318
- _E: n,
2319
- _A: n
2320
- }, nu = function(e) {
2321
- this.channel = e;
2322
- };
2323
- nu.prototype = {
2324
- [eu]: tu,
2325
- pipe() {
2326
- return e(this, arguments);
2327
- }
2328
- };
2329
- var ru = (e) => new nu(e), iu = "~effect/Stream", au = (e) => d(e, iu), ou = ru, su = (e) => ou(Kl(() => e().channel)), cu = (e) => ou(ql(e)), lu = (e) => ou(Jl(e)), uu = /*#__PURE__*/ t(2, (e, t) => ou(Zl(e.channel, t))), du = /*#__PURE__*/ t(2, (e, t) => $l(e.channel, t)), fu = /*#__PURE__*/ t((e) => au(e[0]), (e, t, n) => {
2330
- let r, i, a = Ll(!1);
2331
- return new ReadableStream({
2332
- start(n) {
2333
- i = Nc(xc(du(e, (e) => a.whenOpen(ac(() => {
2334
- a.closeUnsafe();
2335
- for (let t = 0; t < e.length; t++) n.enqueue(e[t]);
2336
- r(), r = void 0;
2337
- }))), t)), i.addObserver((e) => {
2338
- e._tag === "Failure" ? n.error(_s(e.cause)) : n.close();
2339
- });
2340
- },
2341
- pull() {
2342
- return new Promise((e) => {
2343
- r = e, a.openUnsafe();
2344
- });
2345
- },
2346
- cancel() {
2347
- if (i) return Lc(gc(Fl(i)));
2348
- }
2349
- }, n?.strategy);
2350
- }), pu = /*#__PURE__*/ t((e) => au(e[0]), (e, t) => mc(yc(), (n) => fu(e, n, t))), mu = "~effect/ManagedRuntime", hu = (e, t) => {
2351
- let n = t?.memoMap ?? Ws(), r = ks("sequential"), i = Ns(r, "sequential"), a = { onFiberStart: Il(Ns(r, "parallel")) }, o = (e) => e ? {
2352
- ...e,
2353
- onFiberStart: e.onFiberStart ? (t) => {
2354
- a.onFiberStart(t), e.onFiberStart(t);
2355
- } : a.onFiberStart
2356
- } : a, s, c = uc((t) => (s ||= Nc(pc(qs(e, n, i), (e) => ac(() => {
2357
- l.cachedContext = e;
2358
- })), {
2359
- ...a,
2360
- scheduler: t.cache.scheduler
2361
- }), dc(Pl(s)))), l = {
2362
- [mu]: mu,
2363
- memoMap: n,
2364
- scope: r,
2365
- contextEffect: c,
2366
- cachedContext: void 0,
2367
- context() {
2368
- return l.cachedContext === void 0 ? Lc(l.contextEffect) : Promise.resolve(l.cachedContext);
2369
- },
2370
- dispose() {
2371
- return Lc(l.disposeEffect);
2372
- },
2373
- [Symbol.asyncDispose]() {
2374
- return l.dispose();
2375
- },
2376
- disposeEffect: ic(() => (l.contextEffect = cc("ManagedRuntime disposed"), l.cachedContext = void 0, Ps(l.scope, Cs))),
2377
- runFork(e, t) {
2378
- return l.cachedContext === void 0 ? Nc(gu(l, e), o(t)) : Pc(l.cachedContext)(e, o(t));
2379
- },
2380
- runCallback(e, t) {
2381
- return l.cachedContext === void 0 ? Ic(gu(l, e), o(t)) : Fc(l.cachedContext)(e, o(t));
2382
- },
2383
- runSyncExit(e) {
2384
- return l.cachedContext === void 0 ? Uc(gu(l, e)) : Wc(l.cachedContext)(e);
2385
- },
2386
- runSync(e) {
2387
- return l.cachedContext === void 0 ? Vc(gu(l, e)) : Hc(l.cachedContext)(e);
2388
- },
2389
- runPromiseExit(e, t) {
2390
- return l.cachedContext === void 0 ? zc(gu(l, e), o(t)) : Bc(l.cachedContext)(e, o(t));
2391
- },
2392
- runPromise(e, t) {
2393
- return l.cachedContext === void 0 ? Lc(gu(l, e), o(t)) : Rc(l.cachedContext)(e, o(t));
2394
- }
2395
- };
2396
- return l;
2397
- };
2398
- function gu(e, t) {
2399
- return Z(e.contextEffect, (e) => xc(t, e));
2400
- }
2401
- //#endregion
2402
- //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/http/HttpBody.js
2403
- var _u = "~effect/http/HttpBody", vu = class {
2404
- [_u];
2405
- constructor() {
2406
- this[_u] = _u;
2407
- }
2408
- [x]() {
2409
- return this.toJSON();
2410
- }
2411
- toString() {
2412
- return b(this, { ignoreToString: !0 });
2413
- }
2414
- }, yu = /*#__PURE__*/ new class extends vu {
2415
- _tag = "Empty";
2416
- toJSON() {
2417
- return {
2418
- _id: "effect/HttpBody",
2419
- _tag: "Empty"
2420
- };
2421
- }
2422
- }();
2423
- globalThis.Buffer;
2424
- //#endregion
2425
- //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/http/HttpClientError.js
2426
- var bu = "~effect/http/HttpClientError", Q = class extends (/*#__PURE__*/ ii("HttpClientError")) {
2427
- constructor(e) {
2428
- "cause" in e.reason ? super({
2429
- ...e,
2430
- cause: e.reason.cause
2431
- }) : super(e);
2432
- }
2433
- [bu] = bu;
2434
- get request() {
2435
- return this.reason.request;
2436
- }
2437
- get response() {
2438
- return "response" in this.reason ? this.reason.response : void 0;
2439
- }
2440
- get message() {
2441
- return this.reason.message;
2442
- }
2443
- }, xu = (e) => e.endsWith("Error") ? e.slice(0, -5) : e, Su = (e, t, n) => t ? `${e}: ${t} (${n})` : `${e} error (${n})`, Cu = class extends (/*#__PURE__*/ ii("TransportError")) {
2444
- get methodAndUrl() {
2445
- return `${this.request.method} ${this.request.url}`;
2446
- }
2447
- get message() {
2448
- return Su(xu(this._tag), this.description, this.methodAndUrl);
2449
- }
2450
- }, wu = class extends (/*#__PURE__*/ ii("InvalidUrlError")) {
2451
- get methodAndUrl() {
2452
- return `${this.request.method} ${this.request.url}`;
2453
- }
2454
- get message() {
2455
- return Su(xu(this._tag), this.description, this.methodAndUrl);
2456
- }
2457
- }, Tu = class extends (/*#__PURE__*/ ii("DecodeError")) {
2458
- get methodAndUrl() {
2459
- return `${this.request.method} ${this.request.url}`;
2460
- }
2461
- get message() {
2462
- let e = `${this.response.status} ${this.methodAndUrl}`;
2463
- return Su(xu(this._tag), this.description, e);
2464
- }
2465
- }, Eu = class extends (/*#__PURE__*/ ii("EmptyBodyError")) {
2466
- get methodAndUrl() {
2467
- return `${this.request.method} ${this.request.url}`;
2468
- }
2469
- get message() {
2470
- let e = `${this.response.status} ${this.methodAndUrl}`;
2471
- return Su(xu(this._tag), this.description, e);
2472
- }
2473
- }, Du = [
2474
- ["GET", "get"],
2475
- ["POST", "post"],
2476
- ["PUT", "put"],
2477
- ["DELETE", "del"],
2478
- ["PATCH", "patch"],
2479
- ["HEAD", "head"],
2480
- ["OPTIONS", "options"],
2481
- ["TRACE", "trace"],
2482
- ["QUERY", "query"]
2483
- ], Ou = (e, t) => t._tag === "Empty" || t._tag === "FormData" ? bl(bl(e, "content-type"), "content-length") : (e = t.contentType === void 0 ? bl(e, "content-type") : _l(e, "content-type", t.contentType), t.contentLength === void 0 ? bl(e, "content-length") : _l(e, "content-length", t.contentLength.toString())), ku = class extends (/*#__PURE__*/ ii("UrlError")) {}, Au = (e, t, n) => rr({
2484
- try: () => {
2485
- let r = new URL(e, ju());
2486
- for (let e = 0; e < t.params.length; e++) {
2487
- let [n, i] = t.params[e];
2488
- i !== void 0 && r.searchParams.append(n, i);
2489
- }
2490
- return n !== void 0 && (r.hash = n), r;
2491
- },
2492
- catch: (e) => new ku({ cause: e })
2493
- }), ju = () => {
2494
- if ("location" in globalThis && globalThis.location !== void 0 && globalThis.location.origin !== void 0 && globalThis.location.pathname !== void 0) return location.origin + location.pathname;
2495
- }, Mu = "~effect/http/HttpClientRequest", Nu = {
2496
- [Mu]: Mu,
2497
- ...Ke,
2498
- toJSON() {
2499
- return {
2500
- _id: "HttpClientRequest",
2501
- method: this.method,
2502
- url: this.url,
2503
- urlParams: this.urlParams,
2504
- hash: this.hash,
2505
- headers: Fe(this.headers),
2506
- body: this.body.toJSON()
2507
- };
2508
- },
2509
- pipe() {
2510
- return e(this, arguments);
2511
- }
2512
- };
2513
- function $(e, t, n, r, i, a) {
2514
- let o = Object.create(Nu);
2515
- return o.method = e, o.url = t, o.urlParams = n, o.hash = r, o.headers = i, o.body = a, o;
2516
- }
2517
- var Pu = /*#__PURE__*/ $("GET", "", Ml, /*#__PURE__*/ P(), ml, yu), Fu = (e) => (t, n) => Lu(Pu, {
2518
- method: e,
2519
- url: t,
2520
- ...n ?? void 0
2521
- }), Iu = /*#__PURE__*/ Fu("POST"), Lu = /*#__PURE__*/ t(2, (e, t) => {
2522
- let n = e;
2523
- return t.method && (n = Ru(n, t.method)), t.url && (n = Wu(n, t.url)), t.headers && (n = Bu(n, t.headers)), t.urlParams && (n = Gu(n, t.urlParams)), t.hash && (n = Ku(n, t.hash)), t.body && (n = qu(n, t.body)), t.accept && (n = Hu(n, t.accept)), t.acceptJson && (n = Uu(n)), n;
2524
- }), Ru = /*#__PURE__*/ t(2, (e, t) => $(t, e.url, e.urlParams, e.hash, e.headers, e.body)), zu = /*#__PURE__*/ t(3, (e, t, n) => $(e.method, e.url, e.urlParams, e.hash, _l(e.headers, t, n), e.body)), Bu = /*#__PURE__*/ t(2, (e, t) => $(e.method, e.url, e.urlParams, e.hash, vl(e.headers, t), e.body)), Vu = /*#__PURE__*/ t(2, (e, t) => zu(e, "Authorization", `Bearer ${al(t)}`)), Hu = /*#__PURE__*/ t(2, (e, t) => zu(e, "Accept", t)), Uu = /*#__PURE__*/ Hu("application/json"), Wu = /*#__PURE__*/ t(2, (e, t) => {
2525
- if (typeof t == "string") return $(e.method, t, e.urlParams, e.hash, e.headers, e.body);
2526
- let n = new URL(t.toString()), r = Ol(n.searchParams), i = Cn(n.hash === "" ? void 0 : n.hash.slice(1));
2527
- return n.search = "", n.hash = "", $(e.method, n.toString(), r, i, e.headers, e.body);
2528
- }), Gu = /*#__PURE__*/ t(2, (e, t) => $(e.method, e.url, Nl(e.urlParams, t), e.hash, e.headers, e.body)), Ku = /*#__PURE__*/ t(2, (e, t) => $(e.method, e.url, e.urlParams, vn(t), e.headers, e.body)), qu = /*#__PURE__*/ t(2, (e, t) => $(e.method, e.url, e.urlParams, e.hash, Ou(e.headers, t), t));
2529
- function Ju(e) {
2530
- let t = Au(e.url, e.urlParams, wn(e.hash));
2531
- return ar(t) ? vn(t.success) : P();
2532
- }
2533
- //#endregion
2534
- //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/http/HttpIncomingMessage.js
2535
- var Yu = "~effect/http/HttpIncomingMessage", Xu = (e, t) => {
2536
- let n = e.headers["content-type"] ?? "", r;
2537
- if (n.includes("application/json")) try {
2538
- r = Vc(e.json);
2539
- } catch {}
2540
- else if (n.includes("text/") || n.includes("urlencoded")) try {
2541
- r = Vc(e.text);
2542
- } catch {}
2543
- let i = {
2544
- ...t,
2545
- headers: Fe(e.headers),
2546
- remoteAddress: e.remoteAddress
2547
- };
2548
- return r !== void 0 && (i.body = r), i;
2549
- }, Zu = "~effect/http/HttpClientResponse", Qu = (e, t) => new $u(e, t), $u = class extends qe {
2550
- [Yu];
2551
- [Zu];
2552
- request;
2553
- source;
2554
- constructor(e, t) {
2555
- super(), this.request = e, this.source = t, this[Yu] = Yu, this[Zu] = Zu;
2556
- }
2557
- toJSON() {
2558
- return Xu(this, {
2559
- _id: "HttpClientResponse",
2560
- request: this.request.toJSON(),
2561
- status: this.status
2562
- });
2563
- }
2564
- get status() {
2565
- return this.source.status;
2566
- }
2567
- get url() {
2568
- if (this.source.url) return this.source.url.split("#")[0];
2569
- let e = Ju(this.request);
2570
- return yn(e) ? "" : (e.value.hash = "", e.value.href);
2571
- }
2572
- get headers() {
2573
- return hl(this.source.headers);
2574
- }
2575
- cachedCookies;
2576
- get cookies() {
2577
- return this.cachedCookies ? this.cachedCookies : this.cachedCookies = Qc(this.source.headers.getSetCookie());
2578
- }
2579
- get remoteAddress() {
2580
- return P();
2581
- }
2582
- get stream() {
2583
- return this.source.body ? lu({
2584
- evaluate: () => this.source.body,
2585
- onError: (e) => new Q({ reason: new Tu({
2586
- request: this.request,
2587
- response: this,
2588
- cause: e
2589
- }) })
2590
- }) : cu(new Q({ reason: new Eu({
2591
- request: this.request,
2592
- response: this,
2593
- description: "can not create stream from empty body"
2594
- }) }));
2595
- }
2596
- get json() {
2597
- return Z(this.text, (e) => lc({
2598
- try: () => e === "" ? null : JSON.parse(e),
2599
- catch: (e) => new Q({ reason: new Tu({
2600
- request: this.request,
2601
- response: this,
2602
- cause: e
2603
- }) })
2604
- }));
2605
- }
2606
- textBody;
2607
- get text() {
2608
- return this.textBody ??= mc(this.arrayBuffer, (e) => new TextDecoder().decode(e));
2609
- }
2610
- get urlParamsBody() {
2611
- return Z(this.text, (e) => lc({
2612
- try: () => Ol(new URLSearchParams(e)),
2613
- catch: (e) => new Q({ reason: new Tu({
2614
- request: this.request,
2615
- response: this,
2616
- cause: e
2617
- }) })
2618
- }));
2619
- }
2620
- formDataBody;
2621
- get formData() {
2622
- return this.formDataBody ??= rc({
2623
- try: () => this.source.formData(),
2624
- catch: (e) => new Q({ reason: new Tu({
2625
- request: this.request,
2626
- response: this,
2627
- cause: e
2628
- }) })
2629
- }).pipe(Ec, Vc);
2630
- }
2631
- arrayBufferBody;
2632
- get arrayBuffer() {
2633
- return this.arrayBufferBody ||= rc({
2634
- try: () => this.source.arrayBuffer(),
2635
- catch: (e) => new Q({ reason: new Tu({
2636
- request: this.request,
2637
- response: this,
2638
- cause: e
2639
- }) })
2640
- }).pipe(Ec, Vc), this.arrayBufferBody;
2641
- }
2642
- pipe() {
2643
- return e(this, arguments);
2644
- }
2645
- }, ed = (e) => gl({
2646
- b3: `${e.traceId}-${e.spanId}-${e.sampled ? "1" : "0"}${xn(e.parent, {
2647
- onNone: () => "",
2648
- onSome: (e) => `-${e.spanId}`
2649
- })}`,
2650
- traceparent: `00-${e.traceId}-${e.spanId}-${e.sampled ? "01" : "00"}`
2651
- }), td = "~effect/http/HttpClient", nd = /*#__PURE__*/ En("effect/HttpClient"), rd = /*#__PURE__*/ t(2, (e, t) => id((n) => t(e.postprocess(n)), e.preprocess)), id = (e, t) => {
2652
- let n = Object.create(ad);
2653
- return n.preprocess = t, n.postprocess = e, n.execute = function(n) {
2654
- return e(t(n));
2655
- }, n;
2656
- }, ad = {
2657
- [td]: td,
2658
- pipe() {
2659
- return e(this, arguments);
2660
- },
2661
- ...Ke,
2662
- toJSON() {
2663
- return { _id: "effect/HttpClient" };
2664
- },
2665
- .../*#__PURE__*/ Object.fromEntries(/*#__PURE__*/ Du.map(([e, t]) => [t, function(t, n) {
2666
- return this.execute(Fu(e)(t, n));
2667
- }]))
2668
- }, od = (e) => id((t) => Z(t, (t) => uc((n) => {
2669
- let r = pd.get(t), i = r ?? new AbortController(), a = Au(t.url, t.urlParams, wn(t.hash));
2670
- if (ir(a)) return oc(new Q({ reason: new wu({
2671
- request: t,
2672
- cause: a.failure
2673
- }) }));
2674
- let o = a.success;
2675
- if (n.getRef(fi) || n.getRef(sd)(t)) {
2676
- let a = e(t, o, i.signal, n);
2677
- return r ? a : Oc((e) => vc(e(a), {
2678
- onSuccess(e) {
2679
- return fd.register(e, i), X(new md(e, i));
2680
- },
2681
- onFailure(e) {
2682
- return vs(e) && i.abort(), sc(e);
2683
- }
2684
- }));
2685
- }
2686
- return jc(n.getRef(ud)(t), { kind: "client" }, (a) => {
2687
- a.attribute("http.request.method", t.method), a.attribute("server.address", o.origin), o.port !== "" && a.attribute("server.port", +o.port), a.attribute("url.full", o.toString()), a.attribute("url.path", o.pathname), a.attribute("url.scheme", o.protocol.slice(0, -1));
2688
- let s = o.search.slice(1);
2689
- s !== "" && a.attribute("url.query", s);
2690
- let c = n.getRef(Cl), l = n.getRef(cd);
2691
- for (let e in t.headers) l(e, "request") && a.attribute(`http.request.header.${e}`, Sl(e, c) ? "<redacted>" : t.headers[e]);
2692
- return t = n.getRef(ld) ? Bu(t, ed(a)) : t, Oc((s) => s(e(t, o, i.signal, n)).pipe(Mc(a, { captureStackTrace: !1 }), vc({
2693
- onSuccess: (e) => {
2694
- a.attribute("http.response.status_code", e.status);
2695
- for (let t in e.headers) l(t, "response") && a.attribute(`http.response.header.${t}`, Sl(t, c) ? "<redacted>" : e.headers[t]);
2696
- return r ? X(e) : (fd.register(e, i), X(new md(e, i)));
2697
- },
2698
- onFailure(e) {
2699
- return !r && vs(e) && i.abort(), sc(e);
2700
- }
2701
- })));
2702
- });
2703
- })), X), sd = /*#__PURE__*/ L("effect/http/HttpClient/TracerDisabledWhen", { defaultValue: () => a }), cd = /*#__PURE__*/ L("effect/http/HttpClient/TracerHeaderFilter", { defaultValue: () => i }), ld = /*#__PURE__*/ L("effect/http/HttpClient/TracerPropagationEnabled", { defaultValue: i }), ud = /*#__PURE__*/ L("effect/http/HttpClient/SpanNameGenerator", { defaultValue: () => (e) => `http.client ${e.method}` }), dd = (e) => Js(nd)(bc((t) => mc(e, (e) => rd(e, Sc((e) => er(t, e)))))), fd = /*#__PURE__*/ (() => {
2704
- if ("FinalizationRegistry" in globalThis && globalThis.FinalizationRegistry) {
2705
- let e = /*#__PURE__*/ new FinalizationRegistry((e) => {
2706
- e.abort();
2707
- });
2708
- return {
2709
- register(t, n) {
2710
- e.register(t, n, t);
2711
- },
2712
- unregister(t) {
2713
- e.unregister(t);
2714
- }
2715
- };
2716
- }
2717
- let e = /*#__PURE__*/ new Map();
2718
- return {
2719
- register(t, n) {
2720
- e.set(t, setTimeout(() => n.abort(), 5e3));
2721
- },
2722
- unregister(t) {
2723
- let n = e.get(t);
2724
- n !== void 0 && (clearTimeout(n), e.delete(t));
2725
- }
2726
- };
2727
- })(), pd = /*#__PURE__*/ new WeakMap(), md = class {
2728
- original;
2729
- controller;
2730
- constructor(e, t) {
2731
- this.original = e, this.controller = t;
2732
- }
2733
- [Zu] = Zu;
2734
- [Yu] = Yu;
2735
- applyInterrupt(e) {
2736
- return ic(() => (fd.unregister(this.original), Dc(e, () => ac(() => {
2737
- this.controller.abort();
2738
- }))));
2739
- }
2740
- get request() {
2741
- return this.original.request;
2742
- }
2743
- get url() {
2744
- return this.original.url;
2745
- }
2746
- get status() {
2747
- return this.original.status;
2748
- }
2749
- get headers() {
2750
- return this.original.headers;
2751
- }
2752
- get cookies() {
2753
- return this.original.cookies;
2754
- }
2755
- get remoteAddress() {
2756
- return this.original.remoteAddress;
2757
- }
2758
- get formData() {
2759
- return this.applyInterrupt(this.original.formData);
2760
- }
2761
- get text() {
2762
- return this.applyInterrupt(this.original.text);
2763
- }
2764
- get json() {
2765
- return this.applyInterrupt(this.original.json);
2766
- }
2767
- get urlParamsBody() {
2768
- return this.applyInterrupt(this.original.urlParamsBody);
2769
- }
2770
- get arrayBuffer() {
2771
- return this.applyInterrupt(this.original.arrayBuffer);
2772
- }
2773
- get stream() {
2774
- return su(() => (fd.unregister(this.original), uu(this.original.stream, ac(() => {
2775
- this.controller.abort();
2776
- }))));
2777
- }
2778
- toJSON() {
2779
- return this.original.toJSON();
2780
- }
2781
- [x]() {
2782
- return this.original[x]();
2783
- }
2784
- pipe() {
2785
- return e(this, arguments);
2786
- }
2787
- }, hd = /*#__PURE__*/ L("effect/http/FetchHttpClient/Fetch", { defaultValue: () => globalThis.fetch }), gd = class extends (/*#__PURE__*/ En()("effect/http/FetchHttpClient/RequestInit")) {}, _d = /*#__PURE__*/ dd(/*#__PURE__*/ X(/* @__PURE__ */ od((e, t, n, r) => {
2788
- let i = r.getRef(hd), a = Jn(r.context, gd) ?? {}, o = a.headers ? yl(hl(a.headers), e.headers) : e.headers;
2789
- o["content-length"] && (o = bl(o, "content-length"));
2790
- let s = (r) => mc(rc({
2791
- try: () => i(t, {
2792
- ...a,
2793
- method: e.method,
2794
- headers: o,
2795
- body: r,
2796
- duplex: typeof ReadableStream < "u" && r instanceof ReadableStream ? "half" : void 0,
2797
- signal: n
2798
- }),
2799
- catch: (t) => new Q({ reason: new Cu({
2800
- request: e,
2801
- cause: t
2802
- }) })
2803
- }), (t) => Qu(e, t));
2804
- switch (e.body._tag) {
2805
- case "Raw":
2806
- case "Uint8Array": return s(e.body.body);
2807
- case "FormData": return s(e.body.formData);
2808
- case "Stream": return Z(pu(e.body.stream), s);
2809
- }
2810
- return s(void 0);
2811
- }))), vd = Kc("AlchemyConsole.bootstrap")(function* () {
2812
- let e = new URLSearchParams(window.location.hash.slice(1)).get("bootstrap_token");
2813
- window.history.replaceState(null, "", "/");
2814
- let t = yield* nd;
2815
- if (e !== null) {
2816
- let n = yield* t.execute(Iu(new URL("/auth/bootstrap", window.location.href)).pipe(Vu(e))).pipe(Cc(gd, {
2817
- credentials: "same-origin",
2818
- cache: "no-store",
2819
- redirect: "error"
2820
- }));
2821
- if (yield* n.text, n.status !== 200) return !1;
2822
- }
2823
- return window.location.replace("/api/stacks"), !0;
2824
- }), yd = hu(_d);
2825
- window.addEventListener("hashchange", () => window.location.reload());
2826
- var bd = () => {
2827
- let e = document.getElementById("status");
2828
- e !== null && (e.textContent = "Sign-in failed or link already used. Run alchemy-console login.");
2829
- };
2830
- yd.runPromise(vd().pipe(Ac(!1))).then((e) => {
2831
- e || bd();
2832
- }, bd).finally(() => yd.dispose());
2833
- //#endregion
2834
- export { vd as bootstrap };