clanka 0.7.7 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/dist/Acp.d.ts +4 -4
  2. package/dist/Acp.d.ts.map +1 -1
  3. package/dist/Acp.js +8 -6
  4. package/dist/Acp.js.map +1 -1
  5. package/dist/Acp.test.js +66 -4
  6. package/dist/Acp.test.js.map +1 -1
  7. package/dist/AcpImage.test.js +7 -7
  8. package/dist/AcpImage.test.js.map +1 -1
  9. package/dist/Agent.d.ts +8 -8
  10. package/dist/Agent.d.ts.map +1 -1
  11. package/dist/Agent.js +17 -7
  12. package/dist/Agent.js.map +1 -1
  13. package/dist/Agent.test.js +53 -8
  14. package/dist/Agent.test.js.map +1 -1
  15. package/dist/AgentExecutor.d.ts +9 -9
  16. package/dist/AgentExecutor.d.ts.map +1 -1
  17. package/dist/AgentExecutor.js +5 -5
  18. package/dist/AgentExecutor.js.map +1 -1
  19. package/dist/AgentExecutorImage.test.js +6 -6
  20. package/dist/AgentExecutorImage.test.js.map +1 -1
  21. package/dist/AgentImage.test.js +3 -3
  22. package/dist/AgentImage.test.js.map +1 -1
  23. package/dist/AgentOutput.d.ts +10 -2
  24. package/dist/AgentOutput.d.ts.map +1 -1
  25. package/dist/AgentOutput.js +10 -2
  26. package/dist/AgentOutput.js.map +1 -1
  27. package/dist/AgentSkills.d.ts.map +1 -1
  28. package/dist/AgentSkills.js +6 -1
  29. package/dist/AgentSkills.js.map +1 -1
  30. package/dist/AgentSkills.test.js +21 -4
  31. package/dist/AgentSkills.test.js.map +1 -1
  32. package/dist/AgentTools.d.ts +4 -4
  33. package/dist/AgentTools.d.ts.map +1 -1
  34. package/dist/AgentTools.js +4 -4
  35. package/dist/AgentTools.js.map +1 -1
  36. package/dist/AgentToolsImage.test.js +2 -2
  37. package/dist/AgentToolsImage.test.js.map +1 -1
  38. package/dist/ChunkRepo.d.ts +10 -10
  39. package/dist/ChunkRepo.d.ts.map +1 -1
  40. package/dist/ChunkRepo.js +7 -7
  41. package/dist/ChunkRepo.js.map +1 -1
  42. package/dist/ChunkRepo.test.js +2 -2
  43. package/dist/ChunkRepo.test.js.map +1 -1
  44. package/dist/CodeChunker.d.ts +1 -1
  45. package/dist/CodeChunker.d.ts.map +1 -1
  46. package/dist/CodeChunker.js +2 -2
  47. package/dist/CodeChunker.js.map +1 -1
  48. package/dist/Codex.d.ts +5 -5
  49. package/dist/Codex.d.ts.map +1 -1
  50. package/dist/Codex.js +1 -1
  51. package/dist/Codex.js.map +1 -1
  52. package/dist/CodexAuth.d.ts +2 -2
  53. package/dist/CodexAuth.d.ts.map +1 -1
  54. package/dist/CodexAuth.js +6 -6
  55. package/dist/CodexAuth.js.map +1 -1
  56. package/dist/CodexAuth.test.js +3 -3
  57. package/dist/CodexAuth.test.js.map +1 -1
  58. package/dist/Compaction.d.ts +3 -3
  59. package/dist/Compaction.d.ts.map +1 -1
  60. package/dist/Compaction.js +3 -3
  61. package/dist/Compaction.js.map +1 -1
  62. package/dist/Compaction.test.js +3 -3
  63. package/dist/Compaction.test.js.map +1 -1
  64. package/dist/CompactionImage.test.js +4 -4
  65. package/dist/CompactionImage.test.js.map +1 -1
  66. package/dist/CompactionTokens.test.js +3 -3
  67. package/dist/CompactionTokens.test.js.map +1 -1
  68. package/dist/CompactionTransport.test.js +5 -5
  69. package/dist/CompactionTransport.test.js.map +1 -1
  70. package/dist/Copilot.d.ts +3 -3
  71. package/dist/Copilot.d.ts.map +1 -1
  72. package/dist/Copilot.js +1 -1
  73. package/dist/Copilot.js.map +1 -1
  74. package/dist/CopilotAuth.d.ts +2 -2
  75. package/dist/CopilotAuth.d.ts.map +1 -1
  76. package/dist/CopilotAuth.js +4 -4
  77. package/dist/CopilotAuth.js.map +1 -1
  78. package/dist/CopilotAuth.test.js +2 -2
  79. package/dist/CopilotAuth.test.js.map +1 -1
  80. package/dist/GlobalWebSocket.d.ts +1 -1
  81. package/dist/GlobalWebSocket.d.ts.map +1 -1
  82. package/dist/GlobalWebSocket.js +1 -1
  83. package/dist/GlobalWebSocket.js.map +1 -1
  84. package/dist/Image.d.ts +2 -2
  85. package/dist/Image.d.ts.map +1 -1
  86. package/dist/Image.js +3 -3
  87. package/dist/Image.js.map +1 -1
  88. package/dist/Image.test.js +2 -2
  89. package/dist/Image.test.js.map +1 -1
  90. package/dist/SemanticSearch.d.ts +3 -3
  91. package/dist/SemanticSearch.d.ts.map +1 -1
  92. package/dist/SemanticSearch.js +1 -1
  93. package/dist/SemanticSearch.js.map +1 -1
  94. package/dist/Sqlite.d.ts +2 -2
  95. package/dist/Sqlite.d.ts.map +1 -1
  96. package/dist/Sqlite.js +1 -1
  97. package/dist/Sqlite.js.map +1 -1
  98. package/dist/ToolkitRenderer.d.ts +2 -2
  99. package/dist/ToolkitRenderer.d.ts.map +1 -1
  100. package/dist/WebToMarkdown.d.ts +2 -2
  101. package/dist/WebToMarkdown.d.ts.map +1 -1
  102. package/dist/WebToMarkdown.js +1 -1
  103. package/dist/WebToMarkdown.js.map +1 -1
  104. package/dist/WebToMarkdown.test.js +1 -1
  105. package/dist/WebToMarkdown.test.js.map +1 -1
  106. package/dist/Xai.d.ts +10 -3
  107. package/dist/Xai.d.ts.map +1 -1
  108. package/dist/Xai.js +26 -2
  109. package/dist/Xai.js.map +1 -1
  110. package/dist/Xai.test.js +38 -4
  111. package/dist/Xai.test.js.map +1 -1
  112. package/dist/XaiAuth.d.ts +2 -2
  113. package/dist/XaiAuth.d.ts.map +1 -1
  114. package/dist/XaiAuth.js +4 -4
  115. package/dist/XaiAuth.js.map +1 -1
  116. package/dist/XaiAuth.test.js +2 -2
  117. package/dist/XaiAuth.test.js.map +1 -1
  118. package/dist/bin/{Effect-CeAMoJlg.mjs → Effect-DvI8YVcR.mjs} +81 -387
  119. package/dist/bin/Effect-DvI8YVcR.mjs.map +1 -0
  120. package/dist/bin/{McpClient-zQibhsnA.mjs → McpClient-CM7u8ZVd.mjs} +3 -3
  121. package/dist/bin/{McpClient-zQibhsnA.mjs.map → McpClient-CM7u8ZVd.mjs.map} +1 -1
  122. package/dist/bin/{OutputFormatter-C7Awn0DS.mjs → OutputFormatter-BpggeGvI.mjs} +3 -3
  123. package/dist/bin/{OutputFormatter-C7Awn0DS.mjs.map → OutputFormatter-BpggeGvI.mjs.map} +1 -1
  124. package/dist/bin/{Schema-Bc06DxcV.mjs → Schema-DyJ738Wp.mjs} +1979 -1663
  125. package/dist/bin/Schema-DyJ738Wp.mjs.map +1 -0
  126. package/dist/bin/{SemanticSearch-BPxQoRSC.mjs → SemanticSearch-BHUGFT1y.mjs} +46 -42
  127. package/dist/bin/SemanticSearch-BHUGFT1y.mjs.map +1 -0
  128. package/dist/bin/{Stream-DlGXvw0L.mjs → Stream-Dg7AGCgJ.mjs} +60 -61
  129. package/dist/bin/Stream-Dg7AGCgJ.mjs.map +1 -0
  130. package/dist/bin/cli.mjs +614 -371
  131. package/dist/bin/cli.mjs.map +1 -1
  132. package/dist/cli.js +7 -5
  133. package/dist/cli.js.map +1 -1
  134. package/dist/fixtures/TestImages.js +2 -2
  135. package/dist/fixtures/TestImages.js.map +1 -1
  136. package/package.json +7 -7
  137. package/src/Acp.test.ts +107 -5
  138. package/src/Acp.ts +10 -8
  139. package/src/AcpImage.test.ts +9 -9
  140. package/src/Agent.test.ts +61 -9
  141. package/src/Agent.ts +20 -10
  142. package/src/AgentExecutor.ts +8 -8
  143. package/src/AgentExecutorImage.test.ts +6 -6
  144. package/src/AgentImage.test.ts +5 -5
  145. package/src/AgentOutput.ts +10 -2
  146. package/src/AgentSkills.test.ts +81 -37
  147. package/src/AgentSkills.ts +5 -1
  148. package/src/AgentTools.ts +5 -5
  149. package/src/AgentToolsImage.test.ts +4 -4
  150. package/src/ChunkRepo.test.ts +2 -2
  151. package/src/ChunkRepo.ts +7 -7
  152. package/src/CodeChunker.ts +2 -2
  153. package/src/Codex.ts +4 -4
  154. package/src/CodexAuth.test.ts +3 -3
  155. package/src/CodexAuth.ts +6 -6
  156. package/src/Compaction.test.ts +3 -3
  157. package/src/Compaction.ts +3 -3
  158. package/src/CompactionImage.test.ts +4 -4
  159. package/src/CompactionTokens.test.ts +3 -3
  160. package/src/CompactionTransport.test.ts +6 -6
  161. package/src/Copilot.ts +2 -2
  162. package/src/CopilotAuth.test.ts +2 -6
  163. package/src/CopilotAuth.ts +4 -4
  164. package/src/GlobalWebSocket.ts +1 -1
  165. package/src/Image.test.ts +2 -2
  166. package/src/Image.ts +4 -4
  167. package/src/OutputFormatter.ts +1 -1
  168. package/src/SemanticSearch.test.ts +1 -1
  169. package/src/SemanticSearch.ts +3 -3
  170. package/src/Sqlite.ts +1 -1
  171. package/src/ToolkitRenderer.ts +2 -2
  172. package/src/WebToMarkdown.test.ts +1 -1
  173. package/src/WebToMarkdown.ts +2 -2
  174. package/src/Xai.test.ts +67 -8
  175. package/src/Xai.ts +52 -3
  176. package/src/XaiAuth.test.ts +2 -2
  177. package/src/XaiAuth.ts +4 -4
  178. package/src/cli.ts +9 -7
  179. package/src/fixtures/TestImages.ts +2 -2
  180. package/src/fixtures/patch13-broken.txt +4 -4
  181. package/src/fixtures/patch13-fixed.txt +4 -4
  182. package/dist/bin/Effect-CeAMoJlg.mjs.map +0 -1
  183. package/dist/bin/Schema-Bc06DxcV.mjs.map +0 -1
  184. package/dist/bin/SemanticSearch-BPxQoRSC.mjs.map +0 -1
  185. package/dist/bin/Stream-DlGXvw0L.mjs.map +0 -1
@@ -1,10 +1,10 @@
1
- import { $i as makeEquivalence$3, $o as number$1, Ai as decodeBase64$1, Bo as format$1, Br as void_$1, Do as args, Ea as seconds, Eo as PipeInspectableProto, Fo as setStackTraceLimit, Fs as Class$1, Ft as runSyncExit, Hn as isCause, Ho as formatJson, Ht as succeedNone, I as flatMap, Ii as TaggedError$1, Io as BaseProto, Ir as isExit, Is as pipeArguments, J as fromResult, Ja as fromNullOr, Ji as isArrayNonEmpty, Jn as makeInterruptReason, Jo as equals$1, Jr as currentTimeMillis$1, Ki as fromIterable$1, Kn as makeDieReason, L as flatMapEager, M as fail$1, Mi as encodeBase64$1, Ms as memoize, Ni as Class$2, No as assignProperty$1, Nr as fail$2, Ns as memoizeIdempotent, O as die, Oa as toSeconds, On as IllegalArgumentError, P as failCauseSync, Pi as Error$2, Po as getStackTraceLimit, Pr as failCause, Qa as getOrNull, Qo as hash, Rn as fromReasons, Ro as NodeInspectSymbol, Rr as isSuccess, Sa as millis, So as strictEqual, Ss as isUnknown, Ta as negativeInfinity, To as Error$3, Un as isFailReason, Uo as formatPath, V as fnUntracedEager, Vi as empty$2, Vo as formatDate, Vr as ClockRef, Vt as succeed$2, Wa as filter, Wn as isReason, Wo as formatPropertyKey, Xi as isReadonlyArrayNonEmpty, Xo as array, Xt as try_, Yn as map$4, Yo as symbol$1, Yr as effectIsExit, Yt as tryPromise, Zo as combine, _a as fromInputUnsafe, _o as isLessThan$1, _s as isObjectKeyword, ao as map$3, as as isBoolean, ba as isFinite$2, bo as Tuple$1, ct as mapEager, di as iterateConcurrent, ds as isNotNullish, ea as map$2, es as string$1, fi as iterateEager, fo as BigInt$4, fs as isNotUndefined, gi as map$1, go as isGreaterThanOrEqualTo$1, gs as isObject, ho as isGreaterThan$1, hs as isNumber, io as liftThrowable, is as isBigInt, j as exit, js as identity, ks as dual, la as getOrThrow, ls as isNever$1, m as catchCause, ma as succeed$3, mo as Number$4, no as isOption, ns as symbol, oo as match, os as isError, pa as match$1, po as Date$3, qa as flatten, qn as makeFailReason, rn as void_$2, ro as isSome, rs as hasProperty, sa as fail$3, so as none, ss as isFunction, st as mapBothEager, to as isNone, uo as some, ut as mapErrorEager, va as infinity, vo as isLessThanOrEqualTo$1, vs as isPropertyKey, wa as nanos, xo as make$9, ya as isDuration, yi as resolveConcurrency, yo as make$10, ys as isString, zi as append, zr as succeed$1 } from "./Effect-CeAMoJlg.mjs";
2
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Tuple.js
1
+ import { $a as map$4, $o as symbol, Ao as assignProperty$1, As as memoizeIdempotent, Bo as formatPath, Br as succeed$2, Co as args, Es as dual, Fo as NodeInspectSymbol, Fr as failCause, Ft as runSyncExit, Gn as isReason, Go as equals, Ha as fromNullOr, Hr as ClockRef, Ht as succeedNone, I as flatMap, J as fromResult, Jn as makeFailReason, Jo as combine, Ka as getOrNull, Ki as makeEquivalence$3, Ko as symbol$1, L as flatMapEager, Lo as format$1, Lr as isExit, M as fail$2, Mi as append, Mo as setStackTraceLimit, Ms as Class$2, No as BaseProto, Ns as Prototype, O as die, On as IllegalArgumentError, Os as identity, P as failCauseSync, Pi as empty$2, Pn as die$1, Pr as fail$3, Ps as pipeArguments, Qa as liftThrowable, Ra as filter, Ro as formatDate, Sa as toSeconds, So as TaggedError$2, Ui as isReadonlyArrayNonEmpty, Un as isCause, V as fnUntracedEager, Va as flatten, Vi as isArrayNonEmpty, Vo as formatPropertyKey, Vr as void_$1, Vt as succeed$3, Wn as isFailReason, Xa as isOption, Xn as map$5, Xo as number$1, Xr as effectIsExit, Xt as try_, Ya as isNone, Yn as makeInterruptReason, Yo as hash, Yr as currentTimeMillis$1, Yt as tryPromise, Za as isSome, Zo as string$1, _i as map$2, _o as strictEqual, _s as isTagged, ba as seconds, bi as resolveConcurrency, bo as Error$3, ca as succeed$1, co as Number$4, cs as isNotNullish, ct as mapEager, da as fromInputUnsafe, do as isGreaterThanOrEqualTo$1, ea as fail$1, eo as match, es as hasProperty, fa as infinity, fi as iterateConcurrent, fo as isLessThan$1, fs as isNumber, ga as millis, go as make$8, gs as isString, ho as Tuple$1, hs as isPropertyKey, io as some, is as isFunction, j as exit, jo as getStackTraceLimit, ko as assignProperties, ks as memoize, lo as String$4, ls as isNotUndefined, m as catchCause, ma as isFinite$2, mo as make$9, ms as isObjectKeyword, na as getOrThrow, ns as isBoolean, oo as BigInt$4, os as isNever$1, pa as isDuration, pi as iterateEager, po as isLessThanOrEqualTo$1, ps as isObject, qi as map$3, qn as makeDieReason, qo as array, rn as void_$2, rs as isError, sa as match$1, so as Date$3, st as mapBothEager, to as none, ts as isBigInt, uo as isGreaterThan$1, ut as mapErrorEager, va as nanos, xo as PipeInspectableProto, ya as negativeInfinity, ys as isUnknown, zi as fromIterable$1, zn as fromReasons, zo as formatJson, zr as isSuccess } from "./Effect-DvI8YVcR.mjs";
2
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/Tuple.js
3
3
  const makeEquivalence$2 = Tuple$1;
4
4
  //#endregion
5
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Record.js
5
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/Record.js
6
6
  const has = dual(2, (self, key) => Object.hasOwn(self, key));
7
- const map = dual(2, (self, f) => {
7
+ const map$1 = dual(2, (self, f) => {
8
8
  const out = { ...self };
9
9
  for (const key of keys(self)) assignProperty$1(out, key, f(self[key], key));
10
10
  return out;
@@ -20,11 +20,48 @@ const makeEquivalence$1 = (equivalence) => {
20
20
  return (self, that) => is(self, that) && is(that, self);
21
21
  };
22
22
  //#endregion
23
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Clock.js
23
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/Data.js
24
+ const Class$1 = class extends Class$2 {
25
+ constructor(props) {
26
+ super();
27
+ if (props) assignProperties(this, props);
28
+ }
29
+ };
30
+ const TaggedClass$1 = (tag) => class extends Class$1 {
31
+ _tag = tag;
32
+ };
33
+ const taggedEnum = () => new Proxy({}, { get(_target, tag, _receiver) {
34
+ if (tag === "$is") return isTagged;
35
+ else if (tag === "$match") return taggedMatch;
36
+ return (props) => ({
37
+ ...props,
38
+ _tag: tag
39
+ });
40
+ } });
41
+ function taggedMatch() {
42
+ if (arguments.length === 1) {
43
+ const cases = arguments[0];
44
+ return function(value) {
45
+ return cases[value._tag](value);
46
+ };
47
+ }
48
+ const value = arguments[0];
49
+ return arguments[1][value._tag](value);
50
+ }
51
+ const Error$2 = Error$3;
52
+ const TaggedError$1 = TaggedError$2;
53
+ //#endregion
54
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/encoding/EncodingError.js
55
+ const EncodingErrorTypeId = "~effect/encoding/EncodingError";
56
+ var EncodingError = class extends TaggedError$1("EncodingError") {
57
+ [EncodingErrorTypeId] = EncodingErrorTypeId;
58
+ };
59
+ //#endregion
60
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/Clock.js
24
61
  const Clock = ClockRef;
25
62
  const currentTimeMillis = currentTimeMillis$1;
26
63
  //#endregion
27
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/dateTime.js
64
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/internal/dateTime.js
28
65
  const TypeId$9 = "~effect/DateTime";
29
66
  const TimeZoneTypeId = "~effect/DateTime/TimeZone";
30
67
  const Proto$3 = {
@@ -59,7 +96,7 @@ const ProtoZoned = {
59
96
  return combine(number$1(this.epochMilliseconds))(hash(this.zone));
60
97
  },
61
98
  [symbol$1](that) {
62
- return isDateTime$1(that) && that._tag === "Zoned" && this.epochMilliseconds === that.epochMilliseconds && equals$1(this.zone, that.zone);
99
+ return isDateTime$1(that) && that._tag === "Zoned" && this.epochMilliseconds === that.epochMilliseconds && equals(this.zone, that.zone);
63
100
  },
64
101
  toString() {
65
102
  return `DateTime.Zoned(${formatIsoZoned(this)})`;
@@ -141,8 +178,8 @@ const makeUnsafe$1 = (input) => {
141
178
  return fromDateUnsafe$1(new Date(input));
142
179
  };
143
180
  const hasZone = (input) => /Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(input);
144
- const make$8 = liftThrowable(makeUnsafe$1);
145
- const now$1 = map$1(currentTimeMillis, makeUtc);
181
+ const make$7 = liftThrowable(makeUnsafe$1);
182
+ const now$1 = map$2(currentTimeMillis, makeUtc);
146
183
  const toUtc$1 = (self) => makeUtc(self.epochMilliseconds);
147
184
  const toDateUtc$1 = (self) => new Date(self.epochMilliseconds);
148
185
  const toDate = (self) => {
@@ -195,7 +232,7 @@ const formatIsoOffset = (self) => {
195
232
  };
196
233
  const formatIsoZoned = (self) => self.zone._tag === "Offset" ? formatIsoOffset(self) : `${formatIsoOffset(self)}[${self.zone.id}]`;
197
234
  //#endregion
198
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/redacted.js
235
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/internal/redacted.js
199
236
  const redactedRegistry = new WeakMap();
200
237
  const value$1 = (self) => {
201
238
  if (redactedRegistry.has(self)) return redactedRegistry.get(self);
@@ -203,10 +240,10 @@ const value$1 = (self) => {
203
240
  };
204
241
  const stringOrRedacted = (val) => typeof val === "string" ? val : value$1(val);
205
242
  //#endregion
206
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Redacted.js
243
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/Redacted.js
207
244
  const TypeId$8 = "~effect/Redacted";
208
245
  const isRedacted = (u) => hasProperty(u, TypeId$8);
209
- const make$7 = (value, options) => {
246
+ const make$6 = (value, options) => {
210
247
  const self = Object.create(Proto$2);
211
248
  if (options?.label) self.label = options.label;
212
249
  redactedRegistry.set(self, value);
@@ -226,22 +263,22 @@ const Proto$2 = {
226
263
  return hash(redactedRegistry.get(this));
227
264
  },
228
265
  [symbol$1](that) {
229
- return isRedacted(that) && equals$1(redactedRegistry.get(this), redactedRegistry.get(that));
266
+ return isRedacted(that) && equals(redactedRegistry.get(this), redactedRegistry.get(that));
230
267
  }
231
268
  };
232
269
  const value = value$1;
233
- const makeEquivalence = (isEquivalent) => make$9((x, y) => isEquivalent(value(x), value(y)));
270
+ const makeEquivalence = (isEquivalent) => make$8((x, y) => isEquivalent(value(x), value(y)));
234
271
  //#endregion
235
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/BigDecimal.js
272
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/BigDecimal.js
236
273
  const TypeId$7 = "~effect/BigDecimal";
237
274
  const BigDecimalProto = {
238
275
  [TypeId$7]: TypeId$7,
239
276
  [symbol]() {
240
277
  const normalized = normalize(this);
241
- return combine(hash(normalized.value), number$1(normalized.scale));
278
+ return combine(string$1(String(normalized.value)), number$1(normalized.scale));
242
279
  },
243
280
  [symbol$1](that) {
244
- return isBigDecimal(that) && equals(this, that);
281
+ return isBigDecimal(that) && compare(this, that) === 0;
245
282
  },
246
283
  toString() {
247
284
  return `BigDecimal(${format(this)})`;
@@ -261,35 +298,30 @@ const BigDecimalProto = {
261
298
  }
262
299
  };
263
300
  const isBigDecimal = (u) => hasProperty(u, TypeId$7);
264
- const make$6 = (value, scale) => {
301
+ const make$5 = (value, scale) => {
265
302
  if (!Number.isSafeInteger(scale)) throw new RangeError(`Scale must be a safe integer, got ${scale}`);
266
303
  const o = Object.create(BigDecimalProto);
267
304
  o.value = value;
268
305
  o.scale = scale;
269
306
  return o;
270
307
  };
271
- const makeNormalizedUnsafe = (value, scale) => {
272
- if (value !== bigint0 && value % bigint10 === bigint0) throw new RangeError("Value must be normalized");
273
- const o = make$6(value, scale);
308
+ const makeNormalized = (value, scale) => {
309
+ const o = make$5(value, scale);
274
310
  o.normalized = o;
275
311
  return o;
276
312
  };
277
313
  const bigint0 = BigInt(0);
278
314
  const bigint1 = BigInt(1);
279
315
  const bigint10 = BigInt(10);
280
- const zero = makeNormalizedUnsafe(bigint0, 0);
316
+ const zero = makeNormalized(bigint0, 0);
281
317
  const normalize = (self) => {
282
318
  if (self.normalized === void 0) {
283
319
  if (self.value === bigint0) self.normalized = zero;
284
320
  else {
285
321
  const digits = `${self.value}`;
286
- let trail = 0;
287
- for (let i = digits.length - 1; i >= 0; i--) if (digits[i] === "0") trail++;
288
- else break;
289
- if (trail === 0) self.normalized = self;
290
- const value = BigInt(digits.substring(0, digits.length - trail));
291
- const scale = self.scale - trail;
292
- self.normalized = makeNormalizedUnsafe(value, scale);
322
+ let end = digits.length;
323
+ while (digits[end - 1] === "0") end--;
324
+ self.normalized = makeNormalized(BigInt(digits.slice(0, end)), self.scale - (digits.length - end));
293
325
  }
294
326
  }
295
327
  return self.normalized;
@@ -303,12 +335,7 @@ const compareMagnitude = (self, that) => {
303
335
  const exponentDifference = BigInt(selfDigits.length - thatDigits.length) - BigInt(self.scale) + BigInt(that.scale);
304
336
  if (exponentDifference !== bigint0) return exponentDifference < bigint0 ? -1 : 1;
305
337
  const length = Math.max(selfDigits.length, thatDigits.length);
306
- for (let i = 0; i < length; i++) {
307
- const selfDigit = i < selfDigits.length ? selfDigits.charCodeAt(i) : 48;
308
- const thatDigit = i < thatDigits.length ? thatDigits.charCodeAt(i) : 48;
309
- if (selfDigit !== thatDigit) return selfDigit < thatDigit ? -1 : 1;
310
- }
311
- return 0;
338
+ return String$4(selfDigits.padEnd(length, "0"), thatDigits.padEnd(length, "0"));
312
339
  };
313
340
  const compare = (self, that) => {
314
341
  if (self.scale === that.scale) return compareBigInt(self.value, that.value);
@@ -322,55 +349,36 @@ const compare = (self, that) => {
322
349
  const powerOfTen = comparisonPowersOfTen[absoluteScaleDifference] ??= bigint10 ** BigInt(absoluteScaleDifference);
323
350
  return scaleDifference > 0 ? compareBigInt(self.value, that.value * powerOfTen) : compareBigInt(self.value * powerOfTen, that.value);
324
351
  };
325
- const Order = make$10(compare);
352
+ const Order = make$9(compare);
326
353
  const sign = (n) => n.value === bigint0 ? 0 : n.value < bigint0 ? -1 : 1;
327
- const abs = (n) => n.value < bigint0 ? make$6(-n.value, n.scale) : n;
328
- const Equivalence$1 = make$9((self, that) => compare(self, that) === 0);
329
- const equals = dual(2, (self, that) => Equivalence$1(self, that));
330
354
  const format = (n) => {
331
355
  const normalized = normalize(n);
332
356
  if (Math.abs(normalized.scale) >= 16) return toExponential(normalized);
333
357
  const negative = normalized.value < bigint0;
334
- const absolute = negative ? `${normalized.value}`.substring(1) : `${normalized.value}`;
335
- let before;
336
- let after;
337
- if (normalized.scale >= absolute.length) {
338
- before = "0";
339
- after = "0".repeat(normalized.scale - absolute.length) + absolute;
340
- } else {
341
- const location = absolute.length - normalized.scale;
342
- if (location > absolute.length) {
343
- const zeros = location - absolute.length;
344
- before = `${absolute}${"0".repeat(zeros)}`;
345
- after = "";
346
- } else {
347
- after = absolute.slice(location);
348
- before = absolute.slice(0, location);
349
- }
350
- }
351
- const complete = after === "" ? before : `${before}.${after}`;
358
+ const absolute = `${negative ? -normalized.value : normalized.value}`;
359
+ const digits = normalized.scale > 0 ? absolute.padStart(normalized.scale + 1, "0") : absolute.padEnd(absolute.length - normalized.scale, "0");
360
+ const point = digits.length - normalized.scale;
361
+ const complete = normalized.scale > 0 ? `${digits.slice(0, point)}.${digits.slice(point)}` : digits;
352
362
  return negative ? `-${complete}` : complete;
353
363
  };
354
364
  const toExponential = (n) => {
355
365
  if (isZero(n)) return "0e+0";
356
366
  const normalized = normalize(n);
357
- const digits = `${abs(normalized).value}`;
358
- const head = digits.slice(0, 1);
359
- const tail = digits.slice(1);
360
- let output = `${isNegative(normalized) ? "-" : ""}${head}`;
361
- if (tail !== "") output += `.${tail}`;
367
+ const digits = `${normalized.value}`;
368
+ const point = normalized.value < bigint0 ? 2 : 1;
369
+ const head = digits.slice(0, point);
370
+ const tail = digits.slice(point);
362
371
  const exp = tail.length - normalized.scale;
363
- return `${output}e${exp >= 0 ? "+" : ""}${exp}`;
372
+ return `${head}${tail === "" ? "" : `.${tail}`}e${exp >= 0 ? "+" : ""}${exp}`;
364
373
  };
365
374
  const isZero = (n) => n.value === bigint0;
366
- const isNegative = (n) => n.value < bigint0;
367
375
  //#endregion
368
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/DateTime.js
376
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/DateTime.js
369
377
  const isDateTime = isDateTime$1;
370
378
  const isUtc = isUtc$1;
371
379
  const fromDateUnsafe = fromDateUnsafe$1;
372
380
  const makeUnsafe = makeUnsafe$1;
373
- const make$5 = make$8;
381
+ const make$4 = make$7;
374
382
  const now = now$1;
375
383
  const toUtc = toUtc$1;
376
384
  const toDateUtc = toDateUtc$1;
@@ -379,1034 +387,1447 @@ const removeTime = removeTime$1;
379
387
  const formatIso = formatIso$1;
380
388
  const formatIsoDate = formatIsoDate$1;
381
389
  //#endregion
382
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/annotations.js
383
- function resolve(ast) {
384
- return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
385
- }
386
- function resolveAt$1(key) {
387
- return (ast) => resolve(ast)?.[key];
388
- }
389
- const STRUCTURAL_ANNOTATION_KEY = "~structural";
390
- const IDENTIFIER_FALLBACK_KEY = "~identifier";
391
- const SENTINELS_ANNOTATION_KEY = "~sentinels";
392
- const CONSTRUCTOR_ANNOTATION_KEY = "~constructor";
393
- const jsonSchemaAnnotationKeys = [
394
- "title",
395
- "description",
396
- "default",
397
- "examples",
398
- "readOnly",
399
- "writeOnly",
400
- "format",
401
- "contentEncoding",
402
- "contentMediaType",
403
- "contentSchema"
404
- ];
405
- const resolveIdentifier$1 = resolveAt$1("identifier");
406
- const resolveIdentifierFallback = resolveAt$1(IDENTIFIER_FALLBACK_KEY);
407
- const resolveDescription$1 = resolveAt$1("description");
408
- const resolveBrands = resolveAt$1("brands");
409
- const getExpected = memoize((ast) => {
410
- const identifier = resolve(ast)?.identifier;
411
- if (typeof identifier === "string") return identifier;
412
- return ast.getExpected(getExpected);
413
- });
414
- const annotationExcludedKeys = new Set([
415
- SENTINELS_ANNOTATION_KEY,
416
- STRUCTURAL_ANNOTATION_KEY,
417
- "representation",
418
- "arbitraryConstraint",
419
- "brands",
420
- "toJsonSchema",
421
- "toCode",
422
- "toEquivalence",
423
- "toFormatter",
424
- "toCodec",
425
- "toCodecJson",
426
- "toCodecStringTree",
427
- "toCodecIso",
428
- "toCodecArbitrary"
429
- ]);
430
- //#endregion
431
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/parser.js
432
- const missing = Symbol();
433
- const succeed = succeed$1;
434
- const missingExit = succeed(missing);
435
- const sameExit = succeed(missing);
436
- const toOption = (value) => value === missing ? none() : some(value);
437
- const fromOptionExit = (option) => option._tag === "None" ? missingExit : succeed(option.value);
438
- //#endregion
439
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaIssue.js
440
- const TypeId$6 = "~effect/SchemaIssue/Issue";
441
- function isIssue(u) {
442
- return hasProperty(u, TypeId$6) && u[TypeId$6] === TypeId$6;
443
- }
444
- function hasInput(issue) {
445
- return Object.hasOwn(issue, "input");
446
- }
447
- var IssueNodeImpl = class {
448
- [TypeId$6] = TypeId$6;
449
- constructor(input, options) {
450
- if (options?.reportInput === true && input !== missing) this.input = input;
451
- }
452
- };
453
- const Filter$1 = class extends IssueNodeImpl {
454
- _tag = "Filter";
455
- filter;
456
- issue;
457
- constructor(filter, issue, input, options) {
458
- super(input, options);
459
- this.filter = filter;
460
- this.issue = issue;
461
- }
462
- };
463
- const Encoding = class extends IssueNodeImpl {
464
- _tag = "Encoding";
465
- ast;
466
- issue;
467
- constructor(ast, issue, input, options) {
468
- super(input, options);
469
- this.ast = ast;
470
- this.issue = issue;
471
- }
472
- };
473
- const Pointer = class extends IssueNodeImpl {
474
- _tag = "Pointer";
475
- path;
476
- issue;
477
- constructor(path, issue) {
478
- super();
479
- this.path = path;
480
- this.issue = issue;
481
- }
482
- };
483
- const MissingKey = class extends IssueNodeImpl {
484
- _tag = "MissingKey";
485
- annotations;
486
- constructor(annotations) {
487
- super();
488
- this.annotations = annotations;
390
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/encoding/Base64.js
391
+ const encode = (input) => encodeBytes(typeof input === "string" ? encoder.encode(input) : input);
392
+ const decode = (str) => {
393
+ const stripped = stripCrlf(str);
394
+ const length = stripped.length;
395
+ if (length % 4 !== 0) return fail$1(new EncodingError({
396
+ kind: "Decode",
397
+ module: "Base64",
398
+ input: stripped,
399
+ message: `Length must be a multiple of 4, but is ${length}`
400
+ }));
401
+ const index = stripped.indexOf("=");
402
+ if (index !== -1 && (index < length - 2 || index === length - 2 && stripped[length - 1] !== "=")) return fail$1(new EncodingError({
403
+ kind: "Decode",
404
+ module: "Base64",
405
+ input: stripped,
406
+ message: "Found a '=' character, but it is not at the end"
407
+ }));
408
+ try {
409
+ const missingOctets = stripped.endsWith("==") ? 2 : stripped.endsWith("=") ? 1 : 0;
410
+ const result = new Uint8Array(3 * (length / 4) - missingOctets);
411
+ for (let i = 0, j = 0; i < length; i += 4, j += 3) {
412
+ const buffer = getCode(stripped.charCodeAt(i)) << 18 | getCode(stripped.charCodeAt(i + 1)) << 12 | getCode(stripped.charCodeAt(i + 2)) << 6 | getCode(stripped.charCodeAt(i + 3));
413
+ result[j] = buffer >> 16;
414
+ result[j + 1] = buffer >> 8 & 255;
415
+ result[j + 2] = buffer & 255;
416
+ }
417
+ return succeed$1(result);
418
+ } catch (cause) {
419
+ return fail$1(new EncodingError({
420
+ kind: "Decode",
421
+ module: "Base64",
422
+ input: stripped,
423
+ message: cause instanceof Error ? cause.message : "Invalid input"
424
+ }));
489
425
  }
490
426
  };
491
- const UnexpectedKey = class extends IssueNodeImpl {
492
- _tag = "UnexpectedKey";
493
- ast;
494
- constructor(ast, input, options) {
495
- super(input, options);
496
- this.ast = ast;
497
- }
427
+ const encodeBytes = (bytes) => {
428
+ const length = bytes.length;
429
+ let result = "";
430
+ let i = 2;
431
+ for (; i < length; i += 3) {
432
+ result += alphabet[bytes[i - 2] >> 2];
433
+ result += alphabet[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
434
+ result += alphabet[(bytes[i - 1] & 15) << 2 | bytes[i] >> 6];
435
+ result += alphabet[bytes[i] & 63];
436
+ }
437
+ if (i === length + 1) {
438
+ result += alphabet[bytes[i - 2] >> 2];
439
+ result += alphabet[(bytes[i - 2] & 3) << 4];
440
+ result += "==";
441
+ }
442
+ if (i === length) {
443
+ result += alphabet[bytes[i - 2] >> 2];
444
+ result += alphabet[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
445
+ result += alphabet[(bytes[i - 1] & 15) << 2];
446
+ result += "=";
447
+ }
448
+ return result;
498
449
  };
499
- const Composite = class extends IssueNodeImpl {
500
- _tag = "Composite";
501
- ast;
502
- issues;
503
- constructor(ast, issues, input, options) {
504
- super(input, options);
505
- this.ast = ast;
506
- this.issues = issues;
507
- }
450
+ const encoder = new TextEncoder();
451
+ const stripCrlf = (str) => str.replace(/[\n\r]/g, "");
452
+ const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
453
+ const codes = new Uint8Array(123).fill(255);
454
+ for (let i = 0; i < 64; i++) codes[alphabet.charCodeAt(i)] = i;
455
+ codes["=".charCodeAt(0)] = 0;
456
+ const getCode = (charCode) => {
457
+ if (charCode >= codes.length || codes[charCode] === 255) throw new TypeError(`Invalid character ${String.fromCharCode(charCode)}`);
458
+ return codes[charCode];
508
459
  };
509
- const InvalidType = class extends IssueNodeImpl {
510
- _tag = "InvalidType";
511
- ast;
512
- constructor(ast, input, options) {
513
- super(input, options);
514
- this.ast = ast;
460
+ //#endregion
461
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/http/Cookies.js
462
+ const TypeId$6 = "~effect/http/Cookies";
463
+ const isCookies = (u) => hasProperty(u, TypeId$6);
464
+ const CookieTypeId = "~effect/http/Cookies/Cookie";
465
+ const isCookie = (u) => hasProperty(u, CookieTypeId);
466
+ const CookieErrorTypeId = "~effect/http/Cookies/CookieError";
467
+ var CookiesErrorReason = class extends Error$2 {};
468
+ var CookiesError = class CookiesError extends TaggedError$1("CookiesError") {
469
+ static fromReason(reason, cause) {
470
+ return new CookiesError({ reason: new CookiesErrorReason({
471
+ _tag: reason,
472
+ cause
473
+ }) });
515
474
  }
516
- };
517
- const InvalidValue = class extends IssueNodeImpl {
518
- _tag = "InvalidValue";
519
- annotations;
520
- constructor(annotations, input, options) {
521
- super(input, options);
522
- this.annotations = annotations;
475
+ [CookieErrorTypeId] = CookieErrorTypeId;
476
+ get message() {
477
+ return this.reason._tag;
523
478
  }
524
479
  };
525
- function makeCompositeAtKey(compositeAst, pointerKey, pointerIssue, compositeInput, parseOptions) {
526
- return new Composite(compositeAst, [new Pointer([pointerKey], pointerIssue)], compositeInput, parseOptions);
527
- }
528
- const Forbidden = class extends IssueNodeImpl {
529
- _tag = "Forbidden";
530
- annotations;
531
- constructor(annotations, input, options) {
532
- super(input, options);
533
- this.annotations = annotations;
480
+ const Proto$1 = {
481
+ [TypeId$6]: TypeId$6,
482
+ ...BaseProto,
483
+ toJSON() {
484
+ return {
485
+ _id: "effect/Cookies",
486
+ cookies: map$1(this.cookies, (cookie) => cookie.toJSON())
487
+ };
488
+ },
489
+ pipe() {
490
+ return pipeArguments(this, arguments);
534
491
  }
535
492
  };
536
- const AnyOf = class extends IssueNodeImpl {
537
- _tag = "AnyOf";
538
- ast;
539
- issues;
540
- constructor(ast, issues, input, options) {
541
- super(input, options);
542
- this.ast = ast;
543
- this.issues = issues;
544
- }
493
+ const fromReadonlyRecord = (cookies) => {
494
+ const self = Object.create(Proto$1);
495
+ self.cookies = cookies;
496
+ return self;
545
497
  };
546
- const OneOf = class extends IssueNodeImpl {
547
- _tag = "OneOf";
548
- ast;
549
- successes;
550
- constructor(ast, successes, input, options) {
551
- super(input, options);
552
- this.ast = ast;
553
- this.successes = successes;
554
- }
498
+ const fromIterable = (cookies) => {
499
+ const record = {};
500
+ for (const cookie of cookies) assignProperty$1(record, cookie.name, cookie);
501
+ return fromReadonlyRecord(record);
555
502
  };
556
- function makeFilterIssue(entry, input, options) {
557
- if (isIssue(entry)) return entry;
558
- if (typeof entry === "string") return new InvalidValue({ message: entry }, input, options);
559
- const inner = typeof entry.issue === "string" ? new InvalidValue({ message: entry.issue }, input, options) : entry.issue;
560
- return new Pointer(entry.path, inner);
561
- }
562
- function makeSingle(out, input, options) {
563
- if (out === void 0) return;
564
- if (typeof out === "boolean") return out ? void 0 : new InvalidValue(void 0, input, options);
565
- return makeFilterIssue(out, input, options);
566
- }
567
- function normalizeFilterOutput(ast, out, input, options) {
568
- if (Array.isArray(out)) {
569
- if (!isReadonlyArrayNonEmpty(out)) return;
570
- return out.length === 1 ? makeFilterIssue(out[0], input, options) : new Composite(ast, map$2(out, (entry) => makeFilterIssue(entry, input, options)), input, options);
571
- }
572
- return makeSingle(out, input, options);
573
- }
574
- const defaultLeafHook = (issue) => {
575
- const message = findMessage(issue);
576
- if (message !== void 0) return message;
577
- switch (issue._tag) {
578
- case "InvalidType": return getExpectedMessage(getExpected(issue.ast), issue);
579
- case "InvalidValue": {
580
- const expected = findExpected(issue);
581
- if (expected !== void 0) return getExpectedMessage(expected, issue);
582
- const input = formatInput(issue);
583
- return input === void 0 ? "Expected a valid value" : `Invalid data ${input}`;
584
- }
585
- case "MissingKey": return "Missing key";
586
- case "UnexpectedKey": {
587
- const input = formatInput(issue);
588
- return input === void 0 ? "Expected no excess property" : `Unexpected key with value ${input}`;
589
- }
590
- case "Forbidden": return "Forbidden operation";
591
- case "OneOf": {
592
- const input = formatInput(issue);
593
- return input === void 0 ? "Expected exactly one member to match" : `Expected exactly one member to match the input ${input}`;
594
- }
503
+ const fromSetCookie = (headers) => {
504
+ const arrayHeaders = typeof headers === "string" ? [headers] : headers;
505
+ const cookies = [];
506
+ for (const header of arrayHeaders) {
507
+ const cookie = parseSetCookie(header.trim());
508
+ if (cookie) cookies.push(cookie);
595
509
  }
510
+ return fromIterable(cookies);
596
511
  };
597
- const defaultCheckHook = (issue) => findMessage(issue.issue) ?? findMessage(issue);
598
- function formatInput(issue) {
599
- return hasInput(issue) ? format$1(issue.input) : void 0;
600
- }
601
- function findExpected(issue) {
602
- const expected = issue.annotations?.expected;
603
- return typeof expected === "string" ? expected : void 0;
604
- }
605
- function getExpectedMessage(expected, issue) {
606
- const input = formatInput(issue);
607
- return input === void 0 ? `Expected ${expected}` : `Expected ${expected}, got ${input}`;
512
+ function parseSetCookie(header) {
513
+ const parts = header.split(";").map((_) => _.trim()).filter((_) => _ !== "");
514
+ if (parts.length === 0) return;
515
+ const firstEqual = parts[0].indexOf("=");
516
+ if (firstEqual === -1) return;
517
+ const name = parts[0].slice(0, firstEqual);
518
+ if (!cookieNameRegExp.test(name)) return;
519
+ const valueEncoded = parts[0].slice(firstEqual + 1);
520
+ const value = tryDecodeURIComponent(valueEncoded);
521
+ if (parts.length === 1) return Object.assign(Object.create(CookieProto), {
522
+ name,
523
+ value,
524
+ valueEncoded
525
+ });
526
+ const options = {};
527
+ for (let i = 1; i < parts.length; i++) {
528
+ const part = parts[i];
529
+ const equalIndex = part.indexOf("=");
530
+ const key = equalIndex === -1 ? part : part.slice(0, equalIndex).trim();
531
+ const value = equalIndex === -1 ? void 0 : part.slice(equalIndex + 1).trim();
532
+ switch (key.toLowerCase()) {
533
+ case "domain": {
534
+ if (value === void 0) break;
535
+ const domain = value.trim().replace(/^\./, "");
536
+ if (domain) options.domain = domain;
537
+ break;
538
+ }
539
+ case "expires": {
540
+ if (value === void 0) break;
541
+ const date = new Date(value);
542
+ if (!isNaN(date.getTime())) options.expires = date;
543
+ break;
544
+ }
545
+ case "max-age": {
546
+ if (value === void 0) break;
547
+ const maxAge = parseInt(value, 10);
548
+ if (!isNaN(maxAge)) options.maxAge = seconds(maxAge);
549
+ break;
550
+ }
551
+ case "path":
552
+ if (value === void 0) break;
553
+ if (value[0] === "/") options.path = value;
554
+ break;
555
+ case "priority":
556
+ if (value === void 0) break;
557
+ switch (value.toLowerCase()) {
558
+ case "low":
559
+ options.priority = "low";
560
+ break;
561
+ case "medium":
562
+ options.priority = "medium";
563
+ break;
564
+ case "high": options.priority = "high";
565
+ }
566
+ break;
567
+ case "httponly":
568
+ options.httpOnly = true;
569
+ break;
570
+ case "secure":
571
+ options.secure = true;
572
+ break;
573
+ case "partitioned":
574
+ options.partitioned = true;
575
+ break;
576
+ case "samesite":
577
+ if (value === void 0) break;
578
+ switch (value.toLowerCase()) {
579
+ case "lax":
580
+ options.sameSite = "lax";
581
+ break;
582
+ case "strict":
583
+ options.sameSite = "strict";
584
+ break;
585
+ case "none": options.sameSite = "none";
586
+ }
587
+ }
588
+ }
589
+ return Object.assign(Object.create(CookieProto), {
590
+ name,
591
+ value,
592
+ valueEncoded,
593
+ options: Object.keys(options).length > 0 ? options : void 0
594
+ });
608
595
  }
609
- function formatCheck(check) {
610
- const expected = check.annotations?.expected;
611
- if (typeof expected === "string") return expected;
612
- switch (check._tag) {
613
- case "Filter": return "<filter>";
614
- case "FilterGroup": return check.checks.map((check) => formatCheck(check)).join(" & ");
596
+ const empty$1 = fromIterable([]);
597
+ const fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
598
+ const cookieNameRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
599
+ const cookieDomainRegExp = /^[\u0009\u0020-\u003a\u003c-\u007e\u0080-\u00ff]+$/;
600
+ const cookiePathRegExp = /^[\u0020-\u003a\u003c-\u007e]+$/;
601
+ const CookieProto = {
602
+ [CookieTypeId]: CookieTypeId,
603
+ ...BaseProto,
604
+ toJSON() {
605
+ return {
606
+ _id: "effect/Cookies/Cookie",
607
+ name: this.name,
608
+ value: this.value,
609
+ options: this.options
610
+ };
615
611
  }
612
+ };
613
+ function makeCookie(name, value, options) {
614
+ const encodedValue = encodeURIComponent(value);
615
+ const error = validateCookie(name, encodedValue, options);
616
+ if (error !== void 0) return fail$1(error);
617
+ return succeed$1(Object.assign(Object.create(CookieProto), {
618
+ name,
619
+ value,
620
+ valueEncoded: encodedValue,
621
+ options
622
+ }));
616
623
  }
617
- function makeFormatterDefault() {
618
- return (issue) => formatIssue(issue, "");
624
+ function validateCookie(name, encodedValue, options) {
625
+ if (!cookieNameRegExp.test(name)) return CookiesError.fromReason("InvalidCookieName");
626
+ if (encodedValue && !fieldContentRegExp.test(encodedValue)) return CookiesError.fromReason("InvalidCookieValue");
627
+ if (options?.domain !== void 0 && !cookieDomainRegExp.test(options.domain)) return CookiesError.fromReason("InvalidCookieDomain");
628
+ if (options?.path !== void 0 && !cookiePathRegExp.test(options.path)) return CookiesError.fromReason("InvalidCookiePath");
629
+ if (options?.maxAge !== void 0 && !isFinite$2(fromInputUnsafe(options.maxAge))) return CookiesError.fromReason("CookieInfinityMaxAge");
619
630
  }
620
- const defaultFormatter = makeFormatterDefault();
621
- function formatIssue(issue, path) {
622
- let message;
623
- switch (issue._tag) {
624
- case "Filter": {
625
- const annotated = defaultCheckHook(issue);
626
- if (annotated !== void 0) message = annotated;
627
- else {
628
- if (issue.issue._tag !== "InvalidValue") return formatIssue(issue.issue, path);
629
- const expected = findExpected(issue.issue);
630
- message = expected === void 0 ? getExpectedMessage(formatCheck(issue.filter), issue) : getExpectedMessage(expected, issue.issue);
631
- }
631
+ const makeCookieUnsafe = (name, value, options) => getOrThrow(makeCookie(name, value, options));
632
+ function serializeCookie(self) {
633
+ const error = validateCookie(self.name, self.valueEncoded, self.options);
634
+ if (error !== void 0) throw error;
635
+ let str = self.name + "=" + self.valueEncoded;
636
+ if (self.options === void 0) return str;
637
+ const options = self.options;
638
+ if (options.maxAge !== void 0) {
639
+ const maxAge = toSeconds(fromInputUnsafe(options.maxAge));
640
+ str += "; Max-Age=" + Math.trunc(maxAge);
641
+ }
642
+ if (options.domain !== void 0) str += "; Domain=" + options.domain;
643
+ if (options.path !== void 0) str += "; Path=" + options.path;
644
+ if (options.priority !== void 0) switch (options.priority) {
645
+ case "low":
646
+ str += "; Priority=Low";
632
647
  break;
633
- }
634
- case "Encoding": return formatIssue(issue.issue, path);
635
- case "Pointer": return formatIssue(issue.issue, path + formatPath(issue.path));
636
- case "Composite":
637
- case "AnyOf":
638
- if (issue._tag === "Composite" || issue.issues.length > 0) return issue.issues.map((issue) => formatIssue(issue, path)).join("\n");
639
- message = findMessage(issue) ?? getExpectedMessage(getExpected(issue.ast), issue);
648
+ case "medium":
649
+ str += "; Priority=Medium";
640
650
  break;
641
- default: message = defaultLeafHook(issue);
651
+ case "high": str += "; Priority=High";
642
652
  }
643
- return path ? `${message}\n at ${path}` : message;
644
- }
645
- function findMessage(issue) {
646
- if (issue._tag === "Pointer") return;
647
- if (issue._tag === "Encoding") return findMessage(issue.issue);
648
- const message = (issue._tag === "Filter" ? issue.filter.annotations : "annotations" in issue ? issue.annotations : issue.ast.annotations)?.[issue._tag === "MissingKey" ? "messageMissingKey" : issue._tag === "UnexpectedKey" ? "messageUnexpectedKey" : "message"];
649
- if (typeof message === "string") return message;
650
- }
651
- //#endregion
652
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/cause.js
653
- function getSchemaIssue(cause) {
654
- let issue;
655
- for (const reason of cause.reasons) {
656
- if (!isFailReason(reason) || !isIssue(reason.error)) return;
657
- issue ??= reason.error;
653
+ if (options.expires !== void 0) str += "; Expires=" + options.expires.toUTCString();
654
+ if (options.httpOnly) str += "; HttpOnly";
655
+ if (options.secure) str += "; Secure";
656
+ if (options.partitioned) str += "; Partitioned";
657
+ if (options.sameSite !== void 0) switch (options.sameSite) {
658
+ case "lax":
659
+ str += "; SameSite=Lax";
660
+ break;
661
+ case "strict":
662
+ str += "; SameSite=Strict";
663
+ break;
664
+ case "none": str += "; SameSite=None";
658
665
  }
659
- return issue;
660
- }
661
- function getSchemaIssueOrThrow(cause, message) {
662
- const issue = getSchemaIssue(cause);
663
- if (issue === void 0) throw new Error(message, { cause });
664
- return issue;
666
+ return str;
665
667
  }
666
- //#endregion
667
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaGetter.js
668
- const Getter = class extends Class$1 {
669
- run;
670
- constructor(run) {
671
- super();
672
- this.run = run;
668
+ const toRecord$1 = (self) => {
669
+ const record = {};
670
+ const cookies = Object.values(self.cookies);
671
+ for (let index = 0; index < cookies.length; index++) {
672
+ const cookie = cookies[index];
673
+ assignProperty$1(record, cookie.name, cookie.value);
673
674
  }
674
- map(f) {
675
- return new Getter((oe, options) => this.run(oe, options).pipe(mapEager(map$3(f))));
675
+ return record;
676
+ };
677
+ const toSetCookieHeaders = (self) => Object.values(self.cookies).map(serializeCookie);
678
+ const tryDecodeURIComponent = (str) => {
679
+ try {
680
+ return decodeURIComponent(str);
681
+ } catch (_) {
682
+ return str;
676
683
  }
677
- compose(other) {
678
- if (isPassthrough(this)) return other;
679
- if (isPassthrough(other)) return this;
680
- return new Getter((oe, options) => this.run(oe, options).pipe(flatMapEager((ot) => other.run(ot, options))));
684
+ };
685
+ //#endregion
686
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/http/UrlParams.js
687
+ const TypeId$5 = "~effect/http/UrlParams";
688
+ const isUrlParams = (u) => hasProperty(u, TypeId$5);
689
+ const Proto = {
690
+ ...PipeInspectableProto,
691
+ [TypeId$5]: TypeId$5,
692
+ [Symbol.iterator]() {
693
+ return this.params[Symbol.iterator]();
694
+ },
695
+ toJSON() {
696
+ return {
697
+ _id: "UrlParams",
698
+ params: Object.fromEntries(this.params)
699
+ };
700
+ },
701
+ [symbol$1](that) {
702
+ return Equivalence(this, that);
703
+ },
704
+ [symbol]() {
705
+ return array(this.params.flat());
681
706
  }
682
707
  };
683
- function fail(f) {
684
- return new Getter((oe, options) => fail$1(f(oe, options)));
685
- }
686
- function forbidden(message) {
687
- return fail((oe, options) => {
688
- const annotations = { message: message(oe) };
689
- return isSome(oe) ? new Forbidden(annotations, oe.value, options) : new Forbidden(annotations);
690
- });
691
- }
692
- const forbiddenEncoding = forbidden(() => "Encoding is not supported");
693
- const passthrough_$1 = new Getter(succeed$2);
694
- function isPassthrough(getter) {
695
- return getter.run === passthrough_$1.run;
696
- }
697
- function passthrough$1() {
698
- return passthrough_$1;
699
- }
700
- function onSome(f) {
701
- return new Getter((oe, options) => isNone(oe) ? succeedNone : f(oe.value, options));
702
- }
703
- function transform$1(f) {
704
- return transformOptional$1(map$3(f));
705
- }
706
- function transformEffect$1(f) {
707
- return onSome((e, options) => f(e, options).pipe(mapEager(some)));
708
- }
709
- function transformOptional$1(f) {
710
- return new Getter((oe) => succeed$2(f(oe)));
711
- }
712
- function omit$1() {
713
- return new Getter(() => succeedNone);
714
- }
715
- function withDefault(defaultValue) {
716
- return new Getter((o) => {
717
- const filtered = filter(o, isNotUndefined);
718
- return isSome(filtered) ? succeed$2(filtered) : mapEager(defaultValue, some);
719
- });
720
- }
721
- function String$3() {
722
- return transform$1(globalThis.String);
723
- }
724
- function Number$3() {
725
- return transform$1(globalThis.Number);
726
- }
727
- function BigInt$3() {
728
- return transform$1(globalThis.BigInt);
729
- }
730
- function Date$2() {
731
- return transform$1((u) => new globalThis.Date(u));
732
- }
733
- function parseJson(options) {
734
- return onSome((input, parseOptions) => try_({
735
- try: () => some(JSON.parse(input, options?.reviver)),
736
- catch: () => new InvalidValue({ expected: "a valid JSON string" }, input, parseOptions)
737
- }));
738
- }
739
- function stringifyJson(options) {
740
- return onSome((input, parseOptions) => try_({
741
- try: () => {
742
- const output = JSON.stringify(input, options?.replacer, options?.space);
743
- if (output === void 0) throw new TypeError("Value cannot be represented as JSON");
744
- return some(output);
745
- },
746
- catch: () => new InvalidValue({ expected: "a JSON-serializable value" }, input, parseOptions)
747
- }));
748
- }
749
- function encodeBase64() {
750
- return transform$1(encodeBase64$1);
751
- }
752
- function decodeBase64() {
753
- return transformEffect$1((input, options) => mapErrorEager(fromResult(decodeBase64$1(input)), () => new InvalidValue({ expected: "a valid Base64 string" }, input, options)));
754
- }
755
- function dateTimeUtcFromInput$1() {
756
- return transformEffect$1((input, options) => {
757
- return match(make$5(input), {
758
- onNone: () => fail$1(new InvalidValue({ message: "Invalid DateTime input" }, input, options)),
759
- onSome: (dt) => succeed$2(toUtc(dt))
760
- });
761
- });
762
- }
763
- //#endregion
764
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaTransformation.js
765
- const TypeId$5 = "~effect/SchemaTransformation/Transformation";
766
- const Transformation = class {
767
- [TypeId$5] = TypeId$5;
768
- _tag = "Transformation";
769
- decode;
770
- encode;
771
- constructor(decode, encode) {
772
- this.decode = decode;
773
- this.encode = encode;
774
- }
775
- flip() {
776
- return new Transformation(this.encode, this.decode);
777
- }
778
- compose(other) {
779
- return new Transformation(this.decode.compose(other.decode), other.encode.compose(this.encode));
780
- }
708
+ const make$3 = (params) => {
709
+ const self = Object.create(Proto);
710
+ self.params = params;
711
+ return self;
781
712
  };
782
- function isTransformation(u) {
783
- return hasProperty(u, TypeId$5) && u[TypeId$5] === TypeId$5;
784
- }
785
- const make$4 = (options) => {
786
- if (isTransformation(options)) return options;
787
- return new Transformation(options.decode, options.encode);
713
+ const fromInput = (input) => {
714
+ if (isUrlParams(input)) return input;
715
+ const parsed = fromInputNested(input);
716
+ const out = [];
717
+ for (let i = 0; i < parsed.length; i++) if (Array.isArray(parsed[i][0])) {
718
+ const [keys, value] = parsed[i];
719
+ out.push([`${keys[0]}[${keys.slice(1).join("][")}]`, value]);
720
+ } else out.push(parsed[i]);
721
+ return make$3(out);
788
722
  };
789
- function transformEffect(options) {
790
- return new Transformation(transformEffect$1(options.decode), transformEffect$1(options.encode));
791
- }
792
- function transform(options) {
793
- return new Transformation(transform$1(options.decode), transform$1(options.encode));
794
- }
795
- function transformOptional(options) {
796
- return new Transformation(transformOptional$1(options.decode), transformOptional$1(options.encode));
797
- }
798
- const passthrough_ = new Transformation(passthrough$1(), passthrough$1());
799
- function passthrough() {
800
- return passthrough_;
801
- }
802
- const numberFromString = new Transformation(Number$3(), String$3());
803
- const bigintFromString = new Transformation(BigInt$3(), String$3());
804
- const dateFromString = new Transformation(Date$2(), transform$1(formatDate));
805
- const isJsonError = (input) => isObject(input) && typeof input["message"] === "string";
806
- const decodeJsonError = (input) => {
807
- const err = Object.hasOwn(input, "cause") ? new Error(input.message, { cause: decodeDefect(input.cause) }) : new Error(input.message);
808
- if (typeof input.name === "string" && input.name !== "Error") err.name = input.name;
809
- if (typeof input.stack === "string") err.stack = input.stack;
810
- return err;
723
+ const fromInputNested = (input) => {
724
+ const entries = typeof input[Symbol.iterator] === "function" ? fromIterable$1(input) : Object.entries(input);
725
+ const out = [];
726
+ for (const [key, value] of entries) if (Array.isArray(value)) {
727
+ for (let i = 0; i < value.length; i++) if (value[i] !== void 0) out.push([key, String(value[i])]);
728
+ } else if (value !== null && typeof value === "object") {
729
+ const nested = fromInputNested(value);
730
+ for (const [k, v] of nested) out.push([[key, ...typeof k === "string" ? [k] : k], v]);
731
+ } else if (value !== void 0) out.push([key, String(value)]);
732
+ return out;
811
733
  };
812
- const encodeUnknownAsJson = (input) => {
813
- try {
814
- const json = formatJson(input);
815
- return json === void 0 ? format$1(input) : JSON.parse(json);
816
- } catch {
817
- return format$1(input);
734
+ const Equivalence = make$8((a, b) => arrayEquivalence(a.params, b.params));
735
+ const arrayEquivalence = makeEquivalence$3(makeEquivalence$2([strictEqual(), strictEqual()]));
736
+ const empty = make$3([]);
737
+ const setAll = dual(2, (self, input) => {
738
+ const params = fromInput(input).params.slice();
739
+ const keys = new Set();
740
+ for (let i = 0; i < params.length; i++) keys.add(params[i][0]);
741
+ for (let i = 0; i < self.params.length; i++) {
742
+ if (keys.has(self.params[i][0])) continue;
743
+ params.push(self.params[i]);
818
744
  }
819
- };
820
- const encodeJsonError = (input, options, encodeDefect) => {
821
- const encoded = {
822
- name: input.name,
823
- message: typeof input.message === "string" ? input.message : ""
824
- };
825
- if (options?.includeStack && typeof input.stack === "string") encoded.stack = input.stack;
826
- if (!options?.excludeCause && input.cause !== void 0) encoded.cause = encodeDefect(input.cause);
827
- return encoded;
828
- };
829
- const makeEncodeDefect = (options) => {
830
- const seen = new WeakSet();
831
- const encode = (input) => {
832
- if (isError(input)) {
833
- if (seen.has(input)) return "[Circular]";
834
- seen.add(input);
835
- const encoded = encodeJsonError(input, options, encode);
836
- seen.delete(input);
837
- return encoded;
838
- }
839
- return encodeUnknownAsJson(input);
840
- };
841
- return encode;
842
- };
843
- const decodeDefect = (input) => isJsonError(input) ? decodeJsonError(input) : input;
844
- const defectFromJson = (options) => transform({
845
- decode: decodeDefect,
846
- encode: makeEncodeDefect(options)
745
+ return make$3(params);
847
746
  });
848
- function optionFromNullOr() {
849
- return transform({
850
- decode: fromNullOr,
851
- encode: getOrNull
852
- });
747
+ const toString = (input) => new URLSearchParams(fromInput(input).params).toString();
748
+ const toRecord = (self) => {
749
+ const out = {};
750
+ for (const [k, value] of self.params) if (!Object.hasOwn(out, k)) assignProperty$1(out, k, value);
751
+ else {
752
+ const current = out[k];
753
+ if (typeof current === "string") assignProperty$1(out, k, [current, value]);
754
+ else current.push(value);
755
+ }
756
+ return out;
757
+ };
758
+ const toReadonlyRecord = toRecord;
759
+ //#endregion
760
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/internal/schema/annotations.js
761
+ function resolve$1(ast) {
762
+ return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
853
763
  }
854
- function optionFromOptional() {
855
- return transformOptional({
856
- decode: (ot) => ot.pipe(filter(isNotUndefined), some),
857
- encode: flatten
858
- });
764
+ function resolveAt$1(key) {
765
+ return (ast) => resolve$1(ast)?.[key];
859
766
  }
860
- const urlFromString = transformEffect({
861
- decode: (s, options) => URL.canParse(s) ? succeed$2(new URL(s)) : fail$1(new InvalidValue({ expected: "a valid URL string" }, s, options)),
862
- encode: (url) => succeed$2(url.href)
767
+ const STRUCTURAL_ANNOTATION_KEY = "~structural";
768
+ const IDENTIFIER_FALLBACK_KEY = "~identifier";
769
+ const SENTINELS_ANNOTATION_KEY = "~sentinels";
770
+ const CONSTRUCTOR_ANNOTATION_KEY = "~constructor";
771
+ const jsonSchemaAnnotationKeys = [
772
+ "title",
773
+ "description",
774
+ "default",
775
+ "examples",
776
+ "readOnly",
777
+ "writeOnly",
778
+ "format",
779
+ "contentEncoding",
780
+ "contentMediaType",
781
+ "contentSchema"
782
+ ];
783
+ const resolveIdentifier$1 = resolveAt$1("identifier");
784
+ const resolveIdentifierFallback = resolveAt$1(IDENTIFIER_FALLBACK_KEY);
785
+ const resolveDescription$1 = resolveAt$1("description");
786
+ const resolveBrands = resolveAt$1("brands");
787
+ const getExpected = memoize((ast) => {
788
+ const identifier = resolve$1(ast)?.identifier;
789
+ if (typeof identifier === "string") return identifier;
790
+ return ast.getExpected(getExpected);
863
791
  });
864
- const uint8ArrayFromBase64String = new Transformation(decodeBase64(), encodeBase64());
865
- function fromJsonString$1(options) {
866
- return new Transformation(parseJson(options ?? {}), stringifyJson(options));
867
- }
792
+ const annotationExcludedKeys = new Set([
793
+ SENTINELS_ANNOTATION_KEY,
794
+ STRUCTURAL_ANNOTATION_KEY,
795
+ "representation",
796
+ "arbitraryConstraint",
797
+ "brands",
798
+ "toJsonSchema",
799
+ "toCode",
800
+ "toEquivalence",
801
+ "toFormatter",
802
+ "toCodec",
803
+ "toCodecJson",
804
+ "toCodecStringTree",
805
+ "toCodecIso",
806
+ "toCodecArbitrary"
807
+ ]);
868
808
  //#endregion
869
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaAST.js
870
- function makeGuard(tag) {
871
- return (ast) => ast._tag === tag;
809
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/internal/schema/parser.js
810
+ const missing = Symbol();
811
+ const succeed = succeed$2;
812
+ const missingExit = succeed(missing);
813
+ const sameExit = succeed(missing);
814
+ const toOption = (value) => value === missing ? none() : some(value);
815
+ const fromOptionExit = (option) => option._tag === "None" ? missingExit : succeed(option.value);
816
+ //#endregion
817
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/SchemaIssue.js
818
+ const TypeId$4 = "~effect/SchemaIssue/Issue";
819
+ function isIssue(u) {
820
+ return hasProperty(u, TypeId$4) && u[TypeId$4] === TypeId$4;
872
821
  }
873
- const isDeclaration = makeGuard("Declaration");
874
- const isNever = makeGuard("Never");
875
- const isLiteral = makeGuard("Literal");
876
- const isUniqueSymbol = makeGuard("UniqueSymbol");
877
- const isArrays = makeGuard("Arrays");
878
- const isObjects = makeGuard("Objects");
879
- const isUnion = makeGuard("Union");
880
- const isSuspend = makeGuard("Suspend");
881
- const Link = class {
882
- to;
883
- transformation;
884
- constructor(to, transformation) {
885
- this.to = to;
886
- this.transformation = transformation;
822
+ function hasInput(issue) {
823
+ return Object.hasOwn(issue, "input");
824
+ }
825
+ var IssueNodeImpl = class {
826
+ [TypeId$4] = TypeId$4;
827
+ constructor(input, options) {
828
+ if (options?.reportInput === true && input !== missing) this.input = input;
887
829
  }
888
830
  };
889
- const defaultParseOptions = {};
890
- const Context = class {
891
- isOptional;
892
- isMutable;
893
- constructorDefault;
894
- annotations;
895
- constructor(isOptional, isMutable, constructorDefault = void 0, annotations = void 0) {
896
- this.isOptional = isOptional;
897
- this.isMutable = isMutable;
898
- this.constructorDefault = constructorDefault;
899
- this.annotations = annotations;
831
+ const Filter$1 = class extends IssueNodeImpl {
832
+ _tag = "Filter";
833
+ filter;
834
+ issue;
835
+ constructor(filter, issue, input, options) {
836
+ super(input, options);
837
+ this.filter = filter;
838
+ this.issue = issue;
900
839
  }
901
840
  };
902
- const TypeId$4 = "~effect/Schema";
903
- var ASTNodeImpl = class {
904
- [TypeId$4] = TypeId$4;
905
- annotations;
906
- checks;
907
- encoding;
908
- context;
909
- constructor(annotations = void 0, checks = void 0, encoding = void 0, context = void 0) {
910
- this.annotations = annotations;
911
- this.checks = checks;
912
- this.encoding = encoding;
913
- this.context = context;
914
- }
915
- toString() {
916
- return `<${this._tag}>`;
841
+ const Encoding = class extends IssueNodeImpl {
842
+ _tag = "Encoding";
843
+ ast;
844
+ issue;
845
+ constructor(ast, issue, input, options) {
846
+ super(input, options);
847
+ this.ast = ast;
848
+ this.issue = issue;
917
849
  }
918
850
  };
919
- const Declaration = class extends ASTNodeImpl {
920
- _tag = "Declaration";
921
- typeParameters;
922
- run;
923
- encodingChecks;
924
- encodingRun;
925
- constructor(typeParameters, run, annotations, checks, encoding, context, encodingChecks, encodingRun) {
926
- super(annotations, checks, encoding, context);
927
- this.typeParameters = typeParameters;
928
- this.run = run;
929
- this.encodingChecks = encodingChecks;
930
- this.encodingRun = encodingRun;
931
- }
932
- getParser() {
933
- let run;
934
- return (input, options) => {
935
- if (input === missing) return missingExit;
936
- return (run ??= this.run(this.typeParameters))(input, this, options);
937
- };
938
- }
939
- _rebuild(recur, checks, encodingChecks, run, encodingRun) {
940
- const tps = mapOrSame(this.typeParameters, recur);
941
- return tps === this.typeParameters && checks === this.checks && encodingChecks === this.encodingChecks && run === this.run && encodingRun === this.encodingRun ? this : new Declaration(tps, run, this.annotations, checks, void 0, this.context, encodingChecks, encodingRun);
942
- }
943
- recur(recur) {
944
- return this._rebuild(recur, this.checks, this.encodingChecks, this.run, this.encodingRun);
945
- }
946
- flip(recur) {
947
- return this._rebuild(recur, this.encodingChecks, this.checks, this.encodingRun ?? this.run, this.run);
948
- }
949
- getExpected() {
950
- const expected = this.annotations?.expected;
951
- if (typeof expected === "string") return expected;
952
- return "<Declaration>";
851
+ const Pointer = class extends IssueNodeImpl {
852
+ _tag = "Pointer";
853
+ path;
854
+ issue;
855
+ constructor(path, issue) {
856
+ super();
857
+ this.path = path;
858
+ this.issue = issue;
953
859
  }
954
860
  };
955
- const Null$1 = class extends ASTNodeImpl {
956
- _tag = "Null";
957
- getParser() {
958
- return fromConst(this, null);
959
- }
960
- getExpected() {
961
- return "null";
861
+ const MissingKey = class extends IssueNodeImpl {
862
+ _tag = "MissingKey";
863
+ annotations;
864
+ constructor(annotations) {
865
+ super();
866
+ this.annotations = annotations;
962
867
  }
963
868
  };
964
- const null_ = new Null$1();
965
- const Undefined$1 = class extends ASTNodeImpl {
966
- _tag = "Undefined";
967
- getParser() {
968
- return fromConst(this, void 0);
969
- }
970
- toCodecJson() {
971
- return replaceEncoding(this, [undefinedToNull]);
972
- }
973
- getExpected() {
974
- return "undefined";
869
+ const UnexpectedKey = class extends IssueNodeImpl {
870
+ _tag = "UnexpectedKey";
871
+ ast;
872
+ constructor(ast, input, options) {
873
+ super(input, options);
874
+ this.ast = ast;
975
875
  }
976
876
  };
977
- const undefinedToNull = new Link(null_, new Transformation(transform$1(() => void 0), transform$1(() => null)));
978
- const undefined_ = new Undefined$1();
979
- const Void$1 = class extends ASTNodeImpl {
980
- _tag = "Void";
981
- getParser() {
982
- const succeed$4 = succeed(void 0);
983
- return (input) => input === missing ? missingExit : succeed$4;
984
- }
985
- toCodecJson() {
986
- return replaceEncoding(this, [undefinedToNull]);
987
- }
988
- getExpected() {
989
- return "void";
877
+ const Composite = class extends IssueNodeImpl {
878
+ _tag = "Composite";
879
+ ast;
880
+ issues;
881
+ constructor(ast, issues, input, options) {
882
+ super(input, options);
883
+ this.ast = ast;
884
+ this.issues = issues;
990
885
  }
991
886
  };
992
- const void_ = new Void$1();
993
- const Never$1 = class extends ASTNodeImpl {
994
- _tag = "Never";
995
- getParser() {
996
- return fromRefinement(this, isNever$1);
997
- }
998
- getExpected() {
999
- return "never";
887
+ const InvalidType = class extends IssueNodeImpl {
888
+ _tag = "InvalidType";
889
+ ast;
890
+ constructor(ast, input, options) {
891
+ super(input, options);
892
+ this.ast = ast;
1000
893
  }
1001
894
  };
1002
- const never = new Never$1();
1003
- const Any$1 = class extends ASTNodeImpl {
1004
- _tag = "Any";
1005
- getParser() {
1006
- return fromRefinement(this, isUnknown);
1007
- }
1008
- getExpected() {
1009
- return "any";
895
+ const InvalidValue = class extends IssueNodeImpl {
896
+ _tag = "InvalidValue";
897
+ annotations;
898
+ constructor(annotations, input, options) {
899
+ super(input, options);
900
+ this.annotations = annotations;
1010
901
  }
1011
902
  };
1012
- const any = new Any$1();
1013
- const Unknown$1 = class extends ASTNodeImpl {
1014
- _tag = "Unknown";
1015
- getParser() {
1016
- return fromRefinement(this, isUnknown);
1017
- }
1018
- getExpected() {
1019
- return "unknown";
903
+ function makeCompositeAtKey(compositeAst, pointerKey, pointerIssue, compositeInput, parseOptions) {
904
+ return new Composite(compositeAst, [new Pointer([pointerKey], pointerIssue)], compositeInput, parseOptions);
905
+ }
906
+ const Forbidden = class extends IssueNodeImpl {
907
+ _tag = "Forbidden";
908
+ annotations;
909
+ constructor(annotations, input, options) {
910
+ super(input, options);
911
+ this.annotations = annotations;
1020
912
  }
1021
913
  };
1022
- const unknown = new Unknown$1();
1023
- const Literal$1 = class extends ASTNodeImpl {
1024
- _tag = "Literal";
1025
- literal;
1026
- constructor(literal, annotations, checks, encoding, context) {
1027
- super(annotations, checks, encoding, context);
1028
- if (typeof literal === "number" && !globalThis.Number.isFinite(literal)) throw new Error(`A numeric literal must be finite, got ${format$1(literal)}`);
1029
- this.literal = literal;
1030
- }
1031
- getParser() {
1032
- return fromConst(this, this.literal);
1033
- }
1034
- matchPart(s, _options) {
1035
- return s === globalThis.String(this.literal) ? this.literal : void 0;
1036
- }
1037
- toCodecJson() {
1038
- return typeof this.literal === "bigint" ? literalToString(this) : this;
1039
- }
1040
- toCodecStringTree() {
1041
- return typeof this.literal === "string" ? this : literalToString(this);
914
+ const AnyOf = class extends IssueNodeImpl {
915
+ _tag = "AnyOf";
916
+ ast;
917
+ issues;
918
+ constructor(ast, issues, input, options) {
919
+ super(input, options);
920
+ this.ast = ast;
921
+ this.issues = issues;
1042
922
  }
1043
- getExpected() {
1044
- return typeof this.literal === "string" ? JSON.stringify(this.literal) : globalThis.String(this.literal);
923
+ };
924
+ const OneOf = class extends IssueNodeImpl {
925
+ _tag = "OneOf";
926
+ ast;
927
+ successes;
928
+ constructor(ast, successes, input, options) {
929
+ super(input, options);
930
+ this.ast = ast;
931
+ this.successes = successes;
1045
932
  }
1046
933
  };
1047
- function literalToString(ast) {
1048
- const literalAsString = globalThis.String(ast.literal);
1049
- return replaceEncoding(ast, [new Link(new Literal$1(literalAsString), new Transformation(transform$1(() => ast.literal), transform$1(() => literalAsString)))]);
934
+ function makeFilterIssue(entry, input, options) {
935
+ if (isIssue(entry)) return entry;
936
+ if (typeof entry === "string") return new InvalidValue({ message: entry }, input, options);
937
+ const inner = typeof entry.issue === "string" ? new InvalidValue({ message: entry.issue }, input, options) : entry.issue;
938
+ return new Pointer(entry.path, inner);
1050
939
  }
1051
- const String$2 = class extends ASTNodeImpl {
1052
- _tag = "String";
1053
- getParser() {
1054
- return fromRefinement(this, isString);
1055
- }
1056
- matchPart(s, options) {
1057
- const checks = this.checks;
1058
- return checks && !options.disableChecks && collectIssues(checks, s, void 0, this, options) ? void 0 : s;
940
+ function makeSingle(out, input, options) {
941
+ if (out === void 0) return;
942
+ if (typeof out === "boolean") return out ? void 0 : new InvalidValue(void 0, input, options);
943
+ return makeFilterIssue(out, input, options);
944
+ }
945
+ function normalizeFilterOutput(ast, out, input, options) {
946
+ if (Array.isArray(out)) {
947
+ if (!isReadonlyArrayNonEmpty(out)) return;
948
+ return out.length === 1 ? makeFilterIssue(out[0], input, options) : new Composite(ast, map$3(out, (entry) => makeFilterIssue(entry, input, options)), input, options);
1059
949
  }
1060
- getExpected() {
1061
- return "string";
950
+ return makeSingle(out, input, options);
951
+ }
952
+ const defaultLeafHook = (issue) => {
953
+ const message = findMessage(issue);
954
+ if (message !== void 0) return message;
955
+ switch (issue._tag) {
956
+ case "InvalidType": return getExpectedMessage(getExpected(issue.ast), issue);
957
+ case "InvalidValue": {
958
+ const expected = findExpected(issue);
959
+ if (expected !== void 0) return getExpectedMessage(expected, issue);
960
+ const input = formatInput(issue);
961
+ return input === void 0 ? "Expected a valid value" : `Invalid data ${input}`;
962
+ }
963
+ case "MissingKey": return "Missing key";
964
+ case "UnexpectedKey": {
965
+ const input = formatInput(issue);
966
+ return input === void 0 ? "Expected no excess property" : `Unexpected key with value ${input}`;
967
+ }
968
+ case "Forbidden": return "Forbidden operation";
969
+ case "OneOf": {
970
+ const input = formatInput(issue);
971
+ return input === void 0 ? "Expected exactly one member to match" : `Expected exactly one member to match the input ${input}`;
972
+ }
1062
973
  }
1063
974
  };
1064
- const string = new String$2();
1065
- const Number$2 = class extends ASTNodeImpl {
1066
- _tag = "Number";
1067
- getParser() {
1068
- return fromRefinement(this, isNumber);
1069
- }
1070
- matchKey(s, options) {
1071
- return this._match(isStringNumberRegExp, s, options);
1072
- }
1073
- matchPart(s, options) {
1074
- return this._match(isStringFiniteRegExp, s, options);
1075
- }
1076
- _match(regexp, s, options) {
1077
- if (!regexp.test(s)) return void 0;
1078
- const value = globalThis.Number(s);
1079
- if (options.disableChecks || !this.checks) return value;
1080
- return collectIssues(this.checks, value, void 0, this, options) ? void 0 : value;
975
+ const defaultCheckHook = (issue) => findMessage(issue.issue) ?? findMessage(issue);
976
+ function formatInput(issue) {
977
+ return hasInput(issue) ? format$1(issue.input) : void 0;
978
+ }
979
+ function findExpected(issue) {
980
+ const expected = issue.annotations?.expected;
981
+ return typeof expected === "string" ? expected : void 0;
982
+ }
983
+ function getExpectedMessage(expected, issue) {
984
+ const input = formatInput(issue);
985
+ return input === void 0 ? `Expected ${expected}` : `Expected ${expected}, got ${input}`;
986
+ }
987
+ function formatCheck(check) {
988
+ const expected = check.annotations?.expected;
989
+ if (typeof expected === "string") return expected;
990
+ switch (check._tag) {
991
+ case "Filter": return "<filter>";
992
+ case "FilterGroup": return check.checks.map((check) => formatCheck(check)).join(" & ");
1081
993
  }
1082
- toCodecJson() {
1083
- if (this.checks && (hasCheck(this.checks, "effect/schema/isFinite") || hasCheck(this.checks, "effect/schema/isInt"))) return this;
1084
- return replaceEncoding(this, [numberToJson]);
994
+ }
995
+ function makeFormatterDefault() {
996
+ return (issue) => formatIssue(issue, "");
997
+ }
998
+ const defaultFormatter = makeFormatterDefault();
999
+ function formatIssue(issue, path) {
1000
+ let message;
1001
+ switch (issue._tag) {
1002
+ case "Filter": {
1003
+ const annotated = defaultCheckHook(issue);
1004
+ if (annotated !== void 0) message = annotated;
1005
+ else {
1006
+ if (issue.issue._tag !== "InvalidValue") return formatIssue(issue.issue, path);
1007
+ const expected = findExpected(issue.issue);
1008
+ message = expected === void 0 ? getExpectedMessage(formatCheck(issue.filter), issue) : getExpectedMessage(expected, issue.issue);
1009
+ }
1010
+ break;
1011
+ }
1012
+ case "Encoding": return formatIssue(issue.issue, path);
1013
+ case "Pointer": return formatIssue(issue.issue, path + formatPath(issue.path));
1014
+ case "Composite":
1015
+ case "AnyOf":
1016
+ if (issue._tag === "Composite" || issue.issues.length > 0) return issue.issues.map((issue) => formatIssue(issue, path)).join("\n");
1017
+ message = findMessage(issue) ?? getExpectedMessage(getExpected(issue.ast), issue);
1018
+ break;
1019
+ default: message = defaultLeafHook(issue);
1085
1020
  }
1086
- toCodecStringTree() {
1087
- if (this.toCodecJson() === this) return replaceEncoding(this, [finiteToString]);
1088
- return replaceEncoding(this, [numberToString]);
1021
+ return path ? `${message}\n at ${path}` : message;
1022
+ }
1023
+ function findMessage(issue) {
1024
+ if (issue._tag === "Pointer") return;
1025
+ if (issue._tag === "Encoding") return findMessage(issue.issue);
1026
+ const message = (issue._tag === "Filter" ? issue.filter.annotations : "annotations" in issue ? issue.annotations : issue.ast.annotations)?.[issue._tag === "MissingKey" ? "messageMissingKey" : issue._tag === "UnexpectedKey" ? "messageUnexpectedKey" : "message"];
1027
+ if (typeof message === "string") return message;
1028
+ }
1029
+ //#endregion
1030
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/internal/schema/cause.js
1031
+ function getSchemaIssue(cause) {
1032
+ let issue;
1033
+ for (const reason of cause.reasons) {
1034
+ if (!isFailReason(reason) || !isIssue(reason.error)) return;
1035
+ issue ??= reason.error;
1089
1036
  }
1090
- getExpected() {
1091
- return "number";
1037
+ return issue;
1038
+ }
1039
+ function getSchemaIssueOrThrow(cause, message) {
1040
+ const issue = getSchemaIssue(cause);
1041
+ if (issue === void 0) throw new Error(message, { cause });
1042
+ return issue;
1043
+ }
1044
+ //#endregion
1045
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/SchemaGetter.js
1046
+ const runGetter = (self, input, options) => {
1047
+ switch (self._tag) {
1048
+ case "Passthrough": return succeed$3(input);
1049
+ case "Transform": return succeed$3(map$4(input, self.transform));
1050
+ case "TransformOptional": return succeed$3(self.transform(input));
1051
+ case "TransformEffect": return isNone(input) ? succeedNone : mapEager(self.transform(input.value, options), some);
1052
+ case "TransformOptionalEffect": return self.transform(input, options);
1092
1053
  }
1093
1054
  };
1094
- function hasCheck(checks, id) {
1095
- return checks.some((check) => check.annotations?.representation?.id === id || check._tag === "FilterGroup" && hasCheck(check.checks, id));
1055
+ const makeGetter = (fields) => Object.assign(Object.create(Prototype), fields);
1056
+ const composeOptionalEffect = (first, second) => transformOptionalEffect((input, options) => flatMapEager(runGetter(first, input, options), (output) => runGetter(second, output, options)));
1057
+ const compose = dual(2, (self, other) => {
1058
+ if (self._tag === "Passthrough") return other;
1059
+ if (other._tag === "Passthrough") return self;
1060
+ switch (self._tag) {
1061
+ case "Transform": switch (other._tag) {
1062
+ case "Transform": return transform$1((input) => other.transform(self.transform(input)));
1063
+ case "TransformOptional": return transformOptional$1((input) => other.transform(map$4(input, self.transform)));
1064
+ case "TransformEffect": return transformEffect$1((input, options) => other.transform(self.transform(input), options));
1065
+ case "TransformOptionalEffect": return composeOptionalEffect(self, other);
1066
+ }
1067
+ case "TransformOptional": switch (other._tag) {
1068
+ case "Transform": return transformOptional$1((input) => map$4(self.transform(input), other.transform));
1069
+ case "TransformOptional": return transformOptional$1((input) => other.transform(self.transform(input)));
1070
+ case "TransformEffect":
1071
+ case "TransformOptionalEffect": return composeOptionalEffect(self, other);
1072
+ }
1073
+ case "TransformEffect": switch (other._tag) {
1074
+ case "Transform": return transformEffect$1((input, options) => mapEager(self.transform(input, options), other.transform));
1075
+ case "TransformOptional":
1076
+ case "TransformOptionalEffect": return composeOptionalEffect(self, other);
1077
+ case "TransformEffect": return transformEffect$1((input, options) => flatMapEager(self.transform(input, options), (output) => other.transform(output, options)));
1078
+ }
1079
+ case "TransformOptionalEffect": return composeOptionalEffect(self, other);
1080
+ }
1081
+ });
1082
+ const map = dual(2, (self, f) => compose(self, transform$1(f)));
1083
+ function fail(f) {
1084
+ return transformOptionalEffect((oe, options) => fail$2(f(oe, options)));
1096
1085
  }
1097
- const number = new Number$2();
1098
- const Boolean$1 = class extends ASTNodeImpl {
1099
- _tag = "Boolean";
1100
- getParser() {
1101
- return fromRefinement(this, isBoolean);
1086
+ function forbidden(message) {
1087
+ return fail((oe, options) => {
1088
+ const annotations = { message: message(oe) };
1089
+ return isSome(oe) ? new Forbidden(annotations, oe.value, options) : new Forbidden(annotations);
1090
+ });
1091
+ }
1092
+ const forbiddenEncoding = forbidden(() => "Encoding is not supported");
1093
+ const passthrough_$1 = makeGetter({ _tag: "Passthrough" });
1094
+ function passthrough$1() {
1095
+ return passthrough_$1;
1096
+ }
1097
+ function transform$1(f) {
1098
+ return makeGetter({
1099
+ _tag: "Transform",
1100
+ transform: f
1101
+ });
1102
+ }
1103
+ function transformEffect$1(f) {
1104
+ return makeGetter({
1105
+ _tag: "TransformEffect",
1106
+ transform: f
1107
+ });
1108
+ }
1109
+ function transformOptional$1(f) {
1110
+ return makeGetter({
1111
+ _tag: "TransformOptional",
1112
+ transform: f
1113
+ });
1114
+ }
1115
+ function transformOptionalEffect(f) {
1116
+ return makeGetter({
1117
+ _tag: "TransformOptionalEffect",
1118
+ transform: f
1119
+ });
1120
+ }
1121
+ function omit$1() {
1122
+ return transformOptional$1(() => none());
1123
+ }
1124
+ function withDefault$1(defaultValue) {
1125
+ return transformOptionalEffect((o) => {
1126
+ const filtered = filter(o, isNotUndefined);
1127
+ return isSome(filtered) ? succeed$3(filtered) : mapEager(defaultValue, some);
1128
+ });
1129
+ }
1130
+ function String$3() {
1131
+ return transform$1(globalThis.String);
1132
+ }
1133
+ function Number$3() {
1134
+ return transform$1(globalThis.Number);
1135
+ }
1136
+ function BigInt$3() {
1137
+ return transform$1(globalThis.BigInt);
1138
+ }
1139
+ function Date$2() {
1140
+ return transform$1((u) => new globalThis.Date(u));
1141
+ }
1142
+ function parseJson(options) {
1143
+ return transformEffect$1((input, parseOptions) => try_({
1144
+ try: () => JSON.parse(input, options?.reviver),
1145
+ catch: () => new InvalidValue({ expected: "a valid JSON string" }, input, parseOptions)
1146
+ }));
1147
+ }
1148
+ function stringifyJson(options) {
1149
+ return transformEffect$1((input, parseOptions) => try_({
1150
+ try: () => {
1151
+ const output = JSON.stringify(input, options?.replacer, options?.space);
1152
+ if (output === void 0) throw new TypeError("Value cannot be represented as JSON");
1153
+ return output;
1154
+ },
1155
+ catch: () => new InvalidValue({ expected: "a JSON-serializable value" }, input, parseOptions)
1156
+ }));
1157
+ }
1158
+ function encodeBase64() {
1159
+ return transform$1(encode);
1160
+ }
1161
+ function decodeBase64() {
1162
+ return transformEffect$1((input, options) => mapErrorEager(fromResult(decode(input)), () => new InvalidValue({ expected: "a valid Base64 string" }, input, options)));
1163
+ }
1164
+ function dateTimeUtcFromInput$1() {
1165
+ return transformEffect$1((input, options) => {
1166
+ return match(make$4(input), {
1167
+ onNone: () => fail$2(new InvalidValue({ message: "Invalid DateTime input" }, input, options)),
1168
+ onSome: (dt) => succeed$3(toUtc(dt))
1169
+ });
1170
+ });
1171
+ }
1172
+ //#endregion
1173
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/SchemaTransformation.js
1174
+ const Middleware = class extends Class$2 {
1175
+ _tag = "Middleware";
1176
+ decode;
1177
+ encode;
1178
+ constructor(decode, encode) {
1179
+ super();
1180
+ this.decode = decode;
1181
+ this.encode = encode;
1102
1182
  }
1103
- getExpected() {
1104
- return "boolean";
1183
+ flip() {
1184
+ return new Middleware(this.encode, this.decode);
1105
1185
  }
1106
1186
  };
1107
- const boolean = new Boolean$1();
1108
- const BigInt$2 = class extends ASTNodeImpl {
1109
- _tag = "BigInt";
1110
- getParser() {
1111
- return fromRefinement(this, isBigInt);
1112
- }
1113
- matchPart(s, options) {
1114
- if (!isStringBigIntRegExp.test(s)) return void 0;
1115
- const value = globalThis.BigInt(s);
1116
- if (options.disableChecks || !this.checks) return value;
1117
- return collectIssues(this.checks, value, void 0, this, options) ? void 0 : value;
1118
- }
1119
- toCodecStringTree() {
1120
- return replaceEncoding(this, [bigIntToString]);
1187
+ const TypeId$3 = "~effect/SchemaTransformation/Transformation";
1188
+ const Transformation = class extends Class$2 {
1189
+ [TypeId$3] = TypeId$3;
1190
+ _tag = "Transformation";
1191
+ decode;
1192
+ encode;
1193
+ constructor(decode, encode) {
1194
+ super();
1195
+ this.decode = decode;
1196
+ this.encode = encode;
1121
1197
  }
1122
- getExpected() {
1123
- return "bigint";
1198
+ flip() {
1199
+ return new Transformation(this.encode, this.decode);
1124
1200
  }
1125
1201
  };
1126
- const bigInt = new BigInt$2();
1127
- const Arrays = class extends ASTNodeImpl {
1128
- _tag = "Arrays";
1129
- isMutable;
1130
- elements;
1131
- rest;
1132
- encodingChecks;
1133
- constructor(isMutable, elements, rest, annotations, checks, encoding, context, encodingChecks) {
1134
- super(annotations, checks, encoding, context);
1135
- this.isMutable = isMutable;
1136
- this.elements = elements;
1137
- this.rest = rest;
1138
- this.encodingChecks = encodingChecks;
1139
- let hasOptional = false;
1140
- for (let i = 0; i < elements.length; i++) if (isOptional(elements[i])) hasOptional = true;
1141
- else if (hasOptional) throw new Error("A required element cannot follow an optional element. ts(1257)");
1142
- if (hasOptional && rest.length > 1) throw new Error("A required element cannot follow an optional element. ts(1257)");
1143
- for (let i = 1; i < rest.length; i++) if (isOptional(rest[i])) throw new Error("An optional element cannot follow a rest element. ts(1266)");
1202
+ function isTransformation(u) {
1203
+ return hasProperty(u, TypeId$3) && u[TypeId$3] === TypeId$3;
1204
+ }
1205
+ const makeTransformation = (options) => {
1206
+ if (isTransformation(options)) return options;
1207
+ return new Transformation(options.decode, options.encode);
1208
+ };
1209
+ function transformEffect(options) {
1210
+ return new Transformation(transformEffect$1(options.decode), transformEffect$1(options.encode));
1211
+ }
1212
+ function transform(options) {
1213
+ return new Transformation(transform$1(options.decode), transform$1(options.encode));
1214
+ }
1215
+ function transformOptional(options) {
1216
+ return new Transformation(transformOptional$1(options.decode), transformOptional$1(options.encode));
1217
+ }
1218
+ const passthrough_ = new Transformation(passthrough$1(), passthrough$1());
1219
+ function passthrough() {
1220
+ return passthrough_;
1221
+ }
1222
+ const numberFromString = new Transformation(Number$3(), String$3());
1223
+ const bigintFromString = new Transformation(BigInt$3(), String$3());
1224
+ const dateFromString = new Transformation(Date$2(), transform$1(formatDate));
1225
+ const isJsonError = (input) => isObject(input) && typeof input["message"] === "string";
1226
+ const decodeJsonError = (input) => {
1227
+ const err = Object.hasOwn(input, "cause") ? new Error(input.message, { cause: decodeDefect(input.cause) }) : new Error(input.message);
1228
+ if (typeof input.name === "string" && input.name !== "Error") err.name = input.name;
1229
+ if (typeof input.stack === "string") err.stack = input.stack;
1230
+ return err;
1231
+ };
1232
+ const encodeUnknownAsJson = (input) => {
1233
+ try {
1234
+ const json = formatJson(input);
1235
+ return json === void 0 ? format$1(input) : JSON.parse(json);
1236
+ } catch {
1237
+ return format$1(input);
1144
1238
  }
1145
- getParser(compile, compileConstructorDefault = compile) {
1146
- const ast = this;
1147
- let elements;
1148
- let rest;
1149
- const elementLen = ast.elements.length;
1150
- const tailLen = Math.max(0, ast.rest.length - 1);
1151
- function getParser(tailThreshold, index) {
1152
- if (index < elementLen) return elements[index];
1153
- else if (index >= tailThreshold) return rest[index - tailThreshold + 1];
1154
- return rest[0];
1155
- }
1156
- return fnUntracedEager(function* (input, options) {
1157
- if (input === missing) return missing;
1158
- if (!Array.isArray(input)) return yield* fail$1(new InvalidType(ast, input, options));
1159
- if (!elements) {
1160
- elements = ast.elements.map((ast) => ({
1161
- ast,
1162
- parser: compileConstructorDefault(ast)
1163
- }));
1164
- rest = ast.rest.map((ast) => ({
1165
- ast,
1166
- parser: compileConstructorDefault(ast)
1167
- }));
1168
- }
1169
- const len = input.length;
1170
- const state = {
1171
- ast,
1172
- getParser,
1173
- input,
1174
- len,
1175
- tailThreshold: Math.max(elementLen, len - tailLen),
1176
- output: new globalThis.Array(len),
1177
- issues: void 0,
1178
- options
1179
- };
1180
- const end = ast.rest.length === 0 ? elementLen : Math.max(len, elementLen + tailLen);
1181
- const concurrency = options.concurrency === void 0 ? 1 : resolveConcurrency(options.concurrency);
1182
- const eff = concurrency === 1 ? parseArray(state, input, 0, end) : parseArrayConcurrent(state, input, {
1183
- concurrency,
1184
- end
1185
- });
1186
- if (eff) yield* eff;
1187
- if (ast.rest.length === 0 && len > elementLen) for (let i = elementLen; i <= len - 1; i++) {
1188
- const unexpected = new UnexpectedKey(ast, input[i], options);
1189
- const issue = new Pointer([i], unexpected);
1190
- if (options.errors === "all") {
1191
- if (state.issues) state.issues.push(issue);
1192
- else state.issues = [issue];
1193
- } else return yield* fail$1(new Composite(ast, [issue], input, options));
1194
- }
1195
- if (state.issues) return yield* fail$1(new Composite(ast, state.issues, input, options));
1196
- return state.output;
1197
- });
1239
+ };
1240
+ const encodeJsonError = (input, options, encodeDefect) => {
1241
+ const encoded = {
1242
+ name: input.name,
1243
+ message: typeof input.message === "string" ? input.message : ""
1244
+ };
1245
+ if (options?.includeStack && typeof input.stack === "string") encoded.stack = input.stack;
1246
+ if (!options?.excludeCause && input.cause !== void 0) encoded.cause = encodeDefect(input.cause);
1247
+ return encoded;
1248
+ };
1249
+ const makeEncodeDefect = (options) => {
1250
+ const seen = new WeakSet();
1251
+ const encode = (input) => {
1252
+ if (isError(input)) {
1253
+ if (seen.has(input)) return "[Circular]";
1254
+ seen.add(input);
1255
+ const encoded = encodeJsonError(input, options, encode);
1256
+ seen.delete(input);
1257
+ return encoded;
1258
+ }
1259
+ return encodeUnknownAsJson(input);
1260
+ };
1261
+ return encode;
1262
+ };
1263
+ const decodeDefect = (input) => isJsonError(input) ? decodeJsonError(input) : input;
1264
+ const defectFromJson = (options) => transform({
1265
+ decode: decodeDefect,
1266
+ encode: makeEncodeDefect(options)
1267
+ });
1268
+ function optionFromNullOr() {
1269
+ return transform({
1270
+ decode: fromNullOr,
1271
+ encode: getOrNull
1272
+ });
1273
+ }
1274
+ function optionFromOptional() {
1275
+ return transformOptional({
1276
+ decode: (ot) => ot.pipe(filter(isNotUndefined), some),
1277
+ encode: flatten
1278
+ });
1279
+ }
1280
+ const urlFromString = transformEffect({
1281
+ decode: (s, options) => URL.canParse(s) ? succeed$3(new URL(s)) : fail$2(new InvalidValue({ expected: "a valid URL string" }, s, options)),
1282
+ encode: (url) => succeed$3(url.href)
1283
+ });
1284
+ const uint8ArrayFromBase64String = new Transformation(decodeBase64(), encodeBase64());
1285
+ function fromJsonString$1(options) {
1286
+ return new Transformation(parseJson(options ?? {}), stringifyJson(options));
1287
+ }
1288
+ //#endregion
1289
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/SchemaAST.js
1290
+ function makeGuard(tag) {
1291
+ return (ast) => ast._tag === tag;
1292
+ }
1293
+ const isDeclaration = makeGuard("Declaration");
1294
+ const isNever = makeGuard("Never");
1295
+ const isLiteral = makeGuard("Literal");
1296
+ const isUniqueSymbol = makeGuard("UniqueSymbol");
1297
+ const isArrays = makeGuard("Arrays");
1298
+ const isObjects = makeGuard("Objects");
1299
+ const isUnion = makeGuard("Union");
1300
+ const isSuspend = makeGuard("Suspend");
1301
+ const Link = class {
1302
+ to;
1303
+ transformation;
1304
+ constructor(to, transformation) {
1305
+ this.to = to;
1306
+ this.transformation = transformation;
1198
1307
  }
1199
- _rebuild(recur, checks, encodingChecks) {
1200
- const elements = mapOrSame(this.elements, recur);
1201
- const rest = mapOrSame(this.rest, recur);
1202
- return elements === this.elements && rest === this.rest && checks === this.checks && encodingChecks === this.encodingChecks ? this : new Arrays(this.isMutable, elements, rest, this.annotations, checks, void 0, this.context, encodingChecks);
1308
+ };
1309
+ const defaultParseOptions = {};
1310
+ const Context = class {
1311
+ isOptional;
1312
+ isMutable;
1313
+ constructorDefault;
1314
+ annotations;
1315
+ constructor(isOptional, isMutable, constructorDefault = void 0, annotations = void 0) {
1316
+ this.isOptional = isOptional;
1317
+ this.isMutable = isMutable;
1318
+ this.constructorDefault = constructorDefault;
1319
+ this.annotations = annotations;
1320
+ }
1321
+ };
1322
+ const TypeId$2 = "~effect/Schema";
1323
+ var ASTNodeImpl = class {
1324
+ [TypeId$2] = TypeId$2;
1325
+ annotations;
1326
+ checks;
1327
+ encoding;
1328
+ context;
1329
+ constructor(annotations = void 0, checks = void 0, encoding = void 0, context = void 0) {
1330
+ this.annotations = annotations;
1331
+ this.checks = checks;
1332
+ this.encoding = encoding;
1333
+ this.context = context;
1334
+ }
1335
+ toString() {
1336
+ return `<${this._tag}>`;
1337
+ }
1338
+ };
1339
+ const Declaration = class extends ASTNodeImpl {
1340
+ _tag = "Declaration";
1341
+ typeParameters;
1342
+ run;
1343
+ encodingChecks;
1344
+ encodingRun;
1345
+ constructor(typeParameters, run, annotations, checks, encoding, context, encodingChecks, encodingRun) {
1346
+ super(annotations, checks, encoding, context);
1347
+ this.typeParameters = typeParameters;
1348
+ this.run = run;
1349
+ this.encodingChecks = encodingChecks;
1350
+ this.encodingRun = encodingRun;
1351
+ }
1352
+ getParser() {
1353
+ let run;
1354
+ return (input, options) => {
1355
+ if (input === missing) return missingExit;
1356
+ return (run ??= this.run(this.typeParameters))(input, this, options);
1357
+ };
1358
+ }
1359
+ _rebuild(recur, checks, encodingChecks, run, encodingRun) {
1360
+ const tps = mapOrSame(this.typeParameters, recur);
1361
+ return tps === this.typeParameters && checks === this.checks && encodingChecks === this.encodingChecks && run === this.run && encodingRun === this.encodingRun ? this : new Declaration(tps, run, this.annotations, checks, void 0, this.context, encodingChecks, encodingRun);
1203
1362
  }
1204
1363
  recur(recur) {
1205
- return this._rebuild(recur, this.checks, this.encodingChecks);
1364
+ return this._rebuild(recur, this.checks, this.encodingChecks, this.run, this.encodingRun);
1206
1365
  }
1207
1366
  flip(recur) {
1208
- return this._rebuild(recur, this.encodingChecks, this.checks);
1367
+ return this._rebuild(recur, this.encodingChecks, this.checks, this.encodingRun ?? this.run, this.run);
1209
1368
  }
1210
1369
  getExpected() {
1211
- return "array";
1370
+ const expected = this.annotations?.expected;
1371
+ if (typeof expected === "string") return expected;
1372
+ return "<Declaration>";
1212
1373
  }
1213
1374
  };
1214
- const parseArrayOptions = {
1215
- onItem(s, item, i) {
1216
- const value = i < s.len ? item : missing;
1217
- return s.getParser(s.tailThreshold, i).parser(value, s.options);
1218
- },
1219
- step(s, item, exit, i) {
1220
- if (exit._tag === "Failure") return wrapPropertyKeyIssue(s, s.ast, i, exit);
1221
- const value = exit === sameExit ? item : exit[args];
1222
- if (value !== missing) s.output[i] = value;
1223
- else {
1224
- const p = s.getParser(s.tailThreshold, i);
1225
- if (isOptional(p.ast)) return;
1226
- const issue = new Pointer([i], new MissingKey(p.ast.context?.annotations));
1227
- if (s.options.errors === "all") {
1228
- if (s.issues) s.issues.push(issue);
1229
- else s.issues = [issue];
1230
- } else return fail$2(new Composite(s.ast, [issue], s.input, s.options));
1231
- }
1375
+ const Null$1 = class extends ASTNodeImpl {
1376
+ _tag = "Null";
1377
+ getParser() {
1378
+ return fromConst(this, null);
1379
+ }
1380
+ getExpected() {
1381
+ return "null";
1232
1382
  }
1233
1383
  };
1234
- const parseArray = iterateEager()(parseArrayOptions);
1235
- const parseArrayConcurrent = iterateConcurrent()(parseArrayOptions);
1236
- const wrapPropertyKeyIssue = (s, ast, key, exit) => {
1237
- if (exit.cause.reasons.length === 0) return exit;
1238
- const issue = getSchemaIssue(exit.cause);
1239
- if (issue === void 0) return failCause(map$4(exit.cause, (issue) => new Composite(ast, [new Pointer([key], issue)], s.input, s.options)));
1240
- const pointer = new Pointer([key], issue);
1241
- if (s.options.errors === "all") {
1242
- if (s.issues) s.issues.push(pointer);
1243
- else s.issues = [pointer];
1244
- } else return fail$2(new Composite(ast, [pointer], s.input, s.options));
1384
+ const null_ = new Null$1();
1385
+ const Undefined$1 = class extends ASTNodeImpl {
1386
+ _tag = "Undefined";
1387
+ getParser() {
1388
+ return fromConst(this, void 0);
1389
+ }
1390
+ toCodecJson() {
1391
+ return replaceEncoding(this, [undefinedToNull]);
1392
+ }
1393
+ getExpected() {
1394
+ return "undefined";
1395
+ }
1245
1396
  };
1246
- const FINITE_PATTERN = "[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";
1247
- function getIndexSignatureKeys(input, parameter, options = defaultParseOptions) {
1248
- let stringKeys;
1249
- let symbolKeys;
1250
- function go(parameter) {
1251
- switch (parameter._tag) {
1252
- case "String":
1253
- case "TemplateLiteral": return (stringKeys ??= Object.keys(input)).filter((k) => parameter.matchPart(k, options) !== void 0);
1254
- case "Number": return (stringKeys ??= Object.keys(input)).filter((k) => parameter.matchKey(k, options) !== void 0);
1255
- case "Symbol": return (symbolKeys ??= Object.getOwnPropertySymbols(input)).filter((k) => parameter.matchKey(k, options) !== void 0);
1256
- case "Union": return [...new Set(parameter.types.flatMap(go))];
1257
- default: return [];
1258
- }
1397
+ const undefinedToNull = new Link(null_, new Transformation(transform$1(() => void 0), transform$1(() => null)));
1398
+ const undefined_ = new Undefined$1();
1399
+ const Void$1 = class extends ASTNodeImpl {
1400
+ _tag = "Void";
1401
+ getParser() {
1402
+ const succeed$4 = succeed(void 0);
1403
+ return (input) => input === missing ? missingExit : succeed$4;
1259
1404
  }
1260
- return go(parameterFromPropertyKey(toEncoded$1(parameter)));
1261
- }
1262
- const PropertySignature = class {
1263
- name;
1264
- type;
1265
- constructor(name, type) {
1266
- this.name = name;
1267
- this.type = type;
1405
+ toCodecJson() {
1406
+ return replaceEncoding(this, [undefinedToNull]);
1407
+ }
1408
+ getExpected() {
1409
+ return "void";
1268
1410
  }
1269
1411
  };
1270
- function isIndexSignatureParameterSide(ast) {
1271
- switch (ast._tag) {
1272
- case "String":
1273
- case "Number":
1274
- case "Symbol":
1275
- case "TemplateLiteral": return true;
1276
- case "Union": return ast.types.every(isIndexSignatureParameterSide);
1277
- default: return false;
1412
+ const void_ = new Void$1();
1413
+ const Never$1 = class extends ASTNodeImpl {
1414
+ _tag = "Never";
1415
+ getParser() {
1416
+ return fromRefinement(this, isNever$1);
1278
1417
  }
1279
- }
1280
- function isIndexSignatureParameterEncodedSide(ast) {
1281
- const encoded = getLastEncoding(ast);
1282
- switch (encoded._tag) {
1283
- case "String":
1284
- case "Number":
1285
- case "Symbol":
1286
- case "TemplateLiteral": return true;
1287
- case "Union": return encoded.types.every(isIndexSignatureParameterEncodedSide);
1288
- default: return false;
1418
+ getExpected() {
1419
+ return "never";
1289
1420
  }
1421
+ };
1422
+ const never = new Never$1();
1423
+ const Any$1 = class extends ASTNodeImpl {
1424
+ _tag = "Any";
1425
+ getParser() {
1426
+ return fromRefinement(this, isUnknown);
1427
+ }
1428
+ getExpected() {
1429
+ return "any";
1430
+ }
1431
+ };
1432
+ const any = new Any$1();
1433
+ const Unknown$1 = class extends ASTNodeImpl {
1434
+ _tag = "Unknown";
1435
+ getParser() {
1436
+ return fromRefinement(this, isUnknown);
1437
+ }
1438
+ getExpected() {
1439
+ return "unknown";
1440
+ }
1441
+ };
1442
+ const unknown = new Unknown$1();
1443
+ const Literal$1 = class extends ASTNodeImpl {
1444
+ _tag = "Literal";
1445
+ literal;
1446
+ constructor(literal, annotations, checks, encoding, context) {
1447
+ super(annotations, checks, encoding, context);
1448
+ if (typeof literal === "number" && !globalThis.Number.isFinite(literal)) throw new Error(`A numeric literal must be finite, got ${format$1(literal)}`);
1449
+ this.literal = literal;
1450
+ }
1451
+ getParser() {
1452
+ return fromConst(this, this.literal);
1453
+ }
1454
+ matchPart(s, _options) {
1455
+ return s === globalThis.String(this.literal) ? this.literal : void 0;
1456
+ }
1457
+ toCodecJson() {
1458
+ return typeof this.literal === "bigint" ? literalToString(this) : this;
1459
+ }
1460
+ toCodecStringTree() {
1461
+ return typeof this.literal === "string" ? this : literalToString(this);
1462
+ }
1463
+ getExpected() {
1464
+ return typeof this.literal === "string" ? JSON.stringify(this.literal) : globalThis.String(this.literal);
1465
+ }
1466
+ };
1467
+ function literalToString(ast) {
1468
+ const literalAsString = globalThis.String(ast.literal);
1469
+ return replaceEncoding(ast, [new Link(new Literal$1(literalAsString), new Transformation(transform$1(() => ast.literal), transform$1(() => literalAsString)))]);
1290
1470
  }
1291
- function isIndexSignatureParameter(ast) {
1292
- return isIndexSignatureParameterSide(ast) && isIndexSignatureParameterEncodedSide(ast);
1293
- }
1294
- const IndexSignature = class {
1295
- parameter;
1296
- type;
1297
- constructor(parameter, type) {
1298
- if (!isIndexSignatureParameter(parameter)) throw new Error(`Invalid index signature parameter ${parameter._tag}`);
1299
- this.parameter = parameter;
1300
- this.type = type;
1301
- if (isOptional(type) && !containsUndefined(type)) throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.");
1471
+ const String$2 = class extends ASTNodeImpl {
1472
+ _tag = "String";
1473
+ getParser() {
1474
+ return fromRefinement(this, isString);
1475
+ }
1476
+ matchPart(s, options) {
1477
+ const checks = this.checks;
1478
+ return checks && !options.disableChecks && collectIssues(checks, s, void 0, this, options) ? void 0 : s;
1479
+ }
1480
+ getExpected() {
1481
+ return "string";
1302
1482
  }
1303
1483
  };
1304
- const Objects = class extends ASTNodeImpl {
1305
- _tag = "Objects";
1306
- propertySignatures;
1307
- indexSignatures;
1484
+ const string = new String$2();
1485
+ const Number$2 = class extends ASTNodeImpl {
1486
+ _tag = "Number";
1487
+ getParser() {
1488
+ return fromRefinement(this, isNumber);
1489
+ }
1490
+ matchKey(s, options) {
1491
+ return this._match(isStringNumberRegExp, s, options);
1492
+ }
1493
+ matchPart(s, options) {
1494
+ return this._match(isStringFiniteRegExp, s, options);
1495
+ }
1496
+ _match(regexp, s, options) {
1497
+ if (!regexp.test(s)) return void 0;
1498
+ const value = globalThis.Number(s);
1499
+ if (options.disableChecks || !this.checks) return value;
1500
+ return collectIssues(this.checks, value, void 0, this, options) ? void 0 : value;
1501
+ }
1502
+ toCodecJson() {
1503
+ if (this.checks && (hasCheck(this.checks, "effect/schema/isFinite") || hasCheck(this.checks, "effect/schema/isInt"))) return this;
1504
+ return replaceEncoding(this, [numberToJson]);
1505
+ }
1506
+ toCodecStringTree() {
1507
+ if (this.toCodecJson() === this) return replaceEncoding(this, [finiteToString]);
1508
+ return replaceEncoding(this, [numberToString]);
1509
+ }
1510
+ getExpected() {
1511
+ return "number";
1512
+ }
1513
+ };
1514
+ function hasCheck(checks, id) {
1515
+ return checks.some((check) => check.annotations?.representation?.id === id || check._tag === "FilterGroup" && hasCheck(check.checks, id));
1516
+ }
1517
+ const number = new Number$2();
1518
+ const Boolean$1 = class extends ASTNodeImpl {
1519
+ _tag = "Boolean";
1520
+ getParser() {
1521
+ return fromRefinement(this, isBoolean);
1522
+ }
1523
+ getExpected() {
1524
+ return "boolean";
1525
+ }
1526
+ };
1527
+ const boolean = new Boolean$1();
1528
+ const BigInt$2 = class extends ASTNodeImpl {
1529
+ _tag = "BigInt";
1530
+ getParser() {
1531
+ return fromRefinement(this, isBigInt);
1532
+ }
1533
+ matchPart(s, options) {
1534
+ if (!isStringBigIntRegExp.test(s)) return void 0;
1535
+ const value = globalThis.BigInt(s);
1536
+ if (options.disableChecks || !this.checks) return value;
1537
+ return collectIssues(this.checks, value, void 0, this, options) ? void 0 : value;
1538
+ }
1539
+ toCodecStringTree() {
1540
+ return replaceEncoding(this, [bigIntToString]);
1541
+ }
1542
+ getExpected() {
1543
+ return "bigint";
1544
+ }
1545
+ };
1546
+ const bigInt = new BigInt$2();
1547
+ const Arrays = class extends ASTNodeImpl {
1548
+ _tag = "Arrays";
1549
+ isMutable;
1550
+ elements;
1551
+ rest;
1308
1552
  encodingChecks;
1309
- constructor(propertySignatures, indexSignatures, annotations, checks, encoding, context, encodingChecks) {
1553
+ constructor(isMutable, elements, rest, annotations, checks, encoding, context, encodingChecks) {
1310
1554
  super(annotations, checks, encoding, context);
1311
- this.propertySignatures = propertySignatures;
1312
- this.indexSignatures = indexSignatures;
1555
+ this.isMutable = isMutable;
1556
+ this.elements = elements;
1557
+ this.rest = rest;
1313
1558
  this.encodingChecks = encodingChecks;
1314
- const seen = new Set();
1315
- const duplicates = [];
1316
- for (const propertySignature of propertySignatures) {
1317
- const name = propertySignature.name;
1318
- if (seen.has(name)) duplicates.push(name);
1319
- else seen.add(name);
1320
- }
1321
- if (duplicates.length > 0) throw new Error(`Duplicate identifiers: ${JSON.stringify(duplicates)}. ts(2300)`);
1559
+ let hasOptional = false;
1560
+ for (let i = 0; i < elements.length; i++) if (isOptional(elements[i])) hasOptional = true;
1561
+ else if (hasOptional) throw new Error("A required element cannot follow an optional element. ts(1257)");
1562
+ if (hasOptional && rest.length > 1) throw new Error("A required element cannot follow an optional element. ts(1257)");
1563
+ for (let i = 1; i < rest.length; i++) if (isOptional(rest[i])) throw new Error("An optional element cannot follow a rest element. ts(1266)");
1322
1564
  }
1323
- getParser(compile, compileConstructorDefault = compile) {
1565
+ getParser(compile, compileField = compile) {
1324
1566
  const ast = this;
1325
- const expectedKeys = [];
1326
- for (const ps of ast.propertySignatures) expectedKeys.push(typeof ps.name === "number" ? globalThis.String(ps.name) : ps.name);
1327
- const hasProperties = expectedKeys.length;
1328
- const indexCount = ast.indexSignatures.length;
1329
- let expectedKeysSet = hasProperties && indexCount ? new Set(expectedKeys) : void 0;
1330
- if (!hasProperties && !indexCount) return fromRefinement(ast, isNotNullish);
1331
- let properties;
1332
- let indexes;
1333
- const finishIndex = (s, key, k2, inputValue, exitValue) => {
1334
- if (exitValue._tag === "Failure") return wrapPropertyKeyIssue(s, ast, key, exitValue) ?? void_$1;
1335
- const value = exitValue === sameExit ? inputValue : exitValue[args];
1336
- if (k2 !== missing && value !== missing) {
1337
- if (hasProperties && (expectedKeysSet.has(key) || expectedKeysSet.has(typeof k2 === "number" ? globalThis.String(k2) : k2))) return void_$1;
1338
- assignProperty$1(s.out, k2, value);
1339
- }
1340
- return void_$1;
1341
- };
1342
- const parseIndex = (s, key, index, exitKey) => {
1343
- if (!exitKey) {
1344
- const eff = index.parserKey(key, s.options);
1345
- if (!effectIsExit(eff)) return flatMap(exit(eff), (exit) => parseIndex(s, key, index, exit));
1346
- exitKey = eff;
1347
- }
1348
- if (exitKey._tag === "Failure") return wrapPropertyKeyIssue(s, ast, key, exitKey) ?? void_$1;
1349
- const k2 = exitKey === sameExit ? key : exitKey[args];
1350
- const inputValue = s.input[key];
1351
- const result = index.parserValue(inputValue, s.options);
1352
- return effectIsExit(result) ? finishIndex(s, key, k2, inputValue, result) : flatMap(exit(result), (exit) => finishIndex(s, key, k2, inputValue, exit));
1353
- };
1354
- const parseStringIndex = (s, key, index) => {
1355
- const inputValue = s.input[key];
1356
- const result = index.parserValue(inputValue, s.options);
1357
- return effectIsExit(result) ? finishIndex(s, key, key, inputValue, result) : flatMap(exit(result), (exit) => finishIndex(s, key, key, inputValue, exit));
1358
- };
1359
- const parseIndexes = indexCount ? iterateConcurrent()({
1360
- onItem: (s, [key, index]) => index.is.parameter === string ? parseStringIndex(s, key, index) : parseIndex(s, key, index),
1361
- step: (_s, _item, exit) => exit._tag === "Failure" ? exit : void 0
1362
- }) : void 0;
1363
- const compileMembers = () => {
1364
- if (!properties) {
1365
- properties = ast.propertySignatures.map((ps) => ({
1366
- parser: compileConstructorDefault(ps.type),
1367
- name: ps.name,
1368
- type: ps.type
1567
+ let elements;
1568
+ let rest;
1569
+ const elementLen = ast.elements.length;
1570
+ const tailLen = Math.max(0, ast.rest.length - 1);
1571
+ function getParser(tailThreshold, index) {
1572
+ if (index < elementLen) return elements[index];
1573
+ else if (index >= tailThreshold) return rest[index - tailThreshold + 1];
1574
+ return rest[0];
1575
+ }
1576
+ return fnUntracedEager(function* (input, options) {
1577
+ if (input === missing) return missing;
1578
+ if (!Array.isArray(input)) return yield* fail$2(new InvalidType(ast, input, options));
1579
+ if (!elements) {
1580
+ elements = ast.elements.map((ast) => ({
1581
+ ast,
1582
+ parser: compileField(ast)
1583
+ }));
1584
+ rest = ast.rest.map((ast) => ({
1585
+ ast,
1586
+ parser: compileField(ast)
1369
1587
  }));
1370
- indexes = indexCount ? ast.indexSignatures.map((is) => ({
1371
- is,
1372
- parserKey: compile(parameterFromPropertyKey(is.parameter)),
1373
- parserValue: compileConstructorDefault(is.type)
1374
- })) : void 0;
1375
1588
  }
1376
- return properties;
1377
- };
1378
- const fallback = fnUntracedEager(function* (input, options) {
1379
- if (input === missing) return missing;
1380
- if (!(typeof input === "object" && input !== null && !Array.isArray(input))) return yield* fail$1(new InvalidType(ast, input, options));
1381
- compileMembers();
1382
- const record = input;
1383
- const out = {};
1589
+ const len = input.length;
1384
1590
  const state = {
1385
1591
  ast,
1386
- input: record,
1387
- out,
1592
+ getParser,
1593
+ input,
1594
+ len,
1595
+ tailThreshold: Math.max(elementLen, len - tailLen),
1596
+ output: new globalThis.Array(len),
1388
1597
  issues: void 0,
1389
1598
  options
1390
1599
  };
1391
- const errorsAllOption = options.errors === "all";
1392
- const onExcessPropertyError = options.onExcessProperty === "error";
1600
+ const end = ast.rest.length === 0 ? elementLen : Math.max(len, elementLen + tailLen);
1393
1601
  const concurrency = options.concurrency === void 0 ? 1 : resolveConcurrency(options.concurrency);
1394
- const indexKeys = indexCount && onExcessPropertyError ? ast.indexSignatures.map((index) => getIndexSignatureKeys(record, index.parameter, options)) : void 0;
1395
- if (onExcessPropertyError) {
1396
- expectedKeysSet ??= new Set(expectedKeys);
1397
- const coveredKeys = indexKeys ? new Set(expectedKeysSet) : expectedKeysSet;
1398
- if (indexKeys) for (const keys of indexKeys) for (const key of keys) coveredKeys.add(key);
1399
- const inputKeys = Reflect.ownKeys(record);
1400
- for (let i = 0; i < inputKeys.length; i++) {
1401
- const key = inputKeys[i];
1402
- if (!coveredKeys.has(key)) {
1403
- const unexpected = new UnexpectedKey(ast, record[key], options);
1404
- const issue = new Pointer([key], unexpected);
1405
- if (errorsAllOption) {
1602
+ const eff = concurrency === 1 ? parseArray(state, input, 0, end) : parseArrayConcurrent(state, input, {
1603
+ concurrency,
1604
+ end
1605
+ });
1606
+ if (eff) yield* eff;
1607
+ if (ast.rest.length === 0 && len > elementLen) for (let i = elementLen; i <= len - 1; i++) {
1608
+ const unexpected = new UnexpectedKey(ast, input[i], options);
1609
+ const issue = new Pointer([i], unexpected);
1610
+ if (options.errors === "all") {
1611
+ if (state.issues) state.issues.push(issue);
1612
+ else state.issues = [issue];
1613
+ } else return yield* fail$2(new Composite(ast, [issue], input, options));
1614
+ }
1615
+ if (state.issues) return yield* fail$2(new Composite(ast, state.issues, input, options));
1616
+ return state.output;
1617
+ });
1618
+ }
1619
+ _rebuild(recur, checks, encodingChecks) {
1620
+ const elements = mapOrSame(this.elements, recur);
1621
+ const rest = mapOrSame(this.rest, recur);
1622
+ return elements === this.elements && rest === this.rest && checks === this.checks && encodingChecks === this.encodingChecks ? this : new Arrays(this.isMutable, elements, rest, this.annotations, checks, void 0, this.context, encodingChecks);
1623
+ }
1624
+ recur(recur) {
1625
+ return this._rebuild(recur, this.checks, this.encodingChecks);
1626
+ }
1627
+ flip(recur) {
1628
+ return this._rebuild(recur, this.encodingChecks, this.checks);
1629
+ }
1630
+ getExpected() {
1631
+ return "array";
1632
+ }
1633
+ };
1634
+ function stepArray(s, item, exit, i) {
1635
+ if (exit._tag === "Failure") return wrapPropertyKeyIssue(s, s.ast, i, exit);
1636
+ const value = exit === sameExit ? item : exit[args];
1637
+ if (value !== missing) s.output[i] = value;
1638
+ else {
1639
+ const p = s.getParser(s.tailThreshold, i);
1640
+ if (isOptional(p.ast)) return;
1641
+ const issue = new Pointer([i], new MissingKey(p.ast.context?.annotations));
1642
+ if (s.options.errors === "all") {
1643
+ if (s.issues) s.issues.push(issue);
1644
+ else s.issues = [issue];
1645
+ } else return fail$3(new Composite(s.ast, [issue], s.input, s.options));
1646
+ }
1647
+ }
1648
+ const parseArrayOptions = {
1649
+ onItem(s, item, i) {
1650
+ const value = i < s.len ? item : missing;
1651
+ return s.getParser(s.tailThreshold, i).parser(value, s.options);
1652
+ },
1653
+ step: stepArray
1654
+ };
1655
+ const parseArray = iterateEager()(parseArrayOptions);
1656
+ const parseArrayConcurrent = iterateConcurrent()(parseArrayOptions);
1657
+ const wrapPropertyKeyIssue = (s, ast, key, exit) => {
1658
+ if (exit.cause.reasons.length === 0) return exit;
1659
+ const issue = getSchemaIssue(exit.cause);
1660
+ if (issue === void 0) return failCause(map$5(exit.cause, (issue) => new Composite(ast, [new Pointer([key], issue)], s.input, s.options)));
1661
+ const pointer = new Pointer([key], issue);
1662
+ if (s.options.errors === "all") {
1663
+ if (s.issues) s.issues.push(pointer);
1664
+ else s.issues = [pointer];
1665
+ } else return fail$3(new Composite(ast, [pointer], s.input, s.options));
1666
+ };
1667
+ const FINITE_PATTERN = "[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";
1668
+ function getIndexSignatureKeys(input, parameter, options = defaultParseOptions) {
1669
+ let stringKeys;
1670
+ let symbolKeys;
1671
+ function go(parameter) {
1672
+ switch (parameter._tag) {
1673
+ case "String":
1674
+ case "TemplateLiteral": return (stringKeys ??= Object.keys(input)).filter((k) => parameter.matchPart(k, options) !== void 0);
1675
+ case "Number": return (stringKeys ??= Object.keys(input)).filter((k) => parameter.matchKey(k, options) !== void 0);
1676
+ case "Symbol": return (symbolKeys ??= Object.getOwnPropertySymbols(input)).filter((k) => parameter.matchKey(k, options) !== void 0);
1677
+ case "Union": return [...new Set(parameter.types.flatMap(go))];
1678
+ default: return [];
1679
+ }
1680
+ }
1681
+ return go(parameterFromPropertyKey(toEncoded$1(parameter)));
1682
+ }
1683
+ const PropertySignature = class {
1684
+ name;
1685
+ type;
1686
+ constructor(name, type) {
1687
+ this.name = name;
1688
+ this.type = type;
1689
+ }
1690
+ };
1691
+ function isIndexSignatureParameterSide(ast) {
1692
+ switch (ast._tag) {
1693
+ case "String":
1694
+ case "Number":
1695
+ case "Symbol":
1696
+ case "TemplateLiteral": return true;
1697
+ case "Union": return ast.types.every(isIndexSignatureParameterSide);
1698
+ default: return false;
1699
+ }
1700
+ }
1701
+ function isIndexSignatureParameterEncodedSide(ast) {
1702
+ const encoded = getLastEncoding(ast);
1703
+ switch (encoded._tag) {
1704
+ case "String":
1705
+ case "Number":
1706
+ case "Symbol":
1707
+ case "TemplateLiteral": return true;
1708
+ case "Union": return encoded.types.every(isIndexSignatureParameterEncodedSide);
1709
+ default: return false;
1710
+ }
1711
+ }
1712
+ function isIndexSignatureParameter(ast) {
1713
+ return isIndexSignatureParameterSide(ast) && isIndexSignatureParameterEncodedSide(ast);
1714
+ }
1715
+ const IndexSignature = class {
1716
+ parameter;
1717
+ type;
1718
+ constructor(parameter, type) {
1719
+ if (!isIndexSignatureParameter(parameter)) throw new Error(`Invalid index signature parameter ${parameter._tag}`);
1720
+ this.parameter = parameter;
1721
+ this.type = type;
1722
+ if (isOptional(type) && !containsUndefined(type)) throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.");
1723
+ }
1724
+ };
1725
+ const Objects = class extends ASTNodeImpl {
1726
+ _tag = "Objects";
1727
+ propertySignatures;
1728
+ indexSignatures;
1729
+ encodingChecks;
1730
+ constructor(propertySignatures, indexSignatures, annotations, checks, encoding, context, encodingChecks) {
1731
+ super(annotations, checks, encoding, context);
1732
+ this.propertySignatures = propertySignatures;
1733
+ this.indexSignatures = indexSignatures;
1734
+ this.encodingChecks = encodingChecks;
1735
+ const seen = new Set();
1736
+ const duplicates = [];
1737
+ for (const propertySignature of propertySignatures) {
1738
+ const name = propertySignature.name;
1739
+ if (seen.has(name)) duplicates.push(name);
1740
+ else seen.add(name);
1741
+ }
1742
+ if (duplicates.length > 0) throw new Error(`Duplicate identifiers: ${JSON.stringify(duplicates)}. ts(2300)`);
1743
+ }
1744
+ getParser(compile, compileField = compile) {
1745
+ const ast = this;
1746
+ const expectedKeys = [];
1747
+ for (const ps of ast.propertySignatures) expectedKeys.push(typeof ps.name === "number" ? globalThis.String(ps.name) : ps.name);
1748
+ const hasProperties = expectedKeys.length;
1749
+ const indexCount = ast.indexSignatures.length;
1750
+ let expectedKeysSet = hasProperties && indexCount ? new Set(expectedKeys) : void 0;
1751
+ if (!hasProperties && !indexCount) return fromRefinement(ast, isNotNullish);
1752
+ let properties;
1753
+ let indexes;
1754
+ const finishIndex = (s, key, k2, inputValue, exitValue) => {
1755
+ if (exitValue._tag === "Failure") return wrapPropertyKeyIssue(s, ast, key, exitValue) ?? void_$1;
1756
+ const value = exitValue === sameExit ? inputValue : exitValue[args];
1757
+ if (k2 !== missing && value !== missing) {
1758
+ if (hasProperties && (expectedKeysSet.has(key) || expectedKeysSet.has(typeof k2 === "number" ? globalThis.String(k2) : k2))) return void_$1;
1759
+ assignProperty$1(s.out, k2, value);
1760
+ }
1761
+ return void_$1;
1762
+ };
1763
+ const parseIndex = (s, key, index, exitKey) => {
1764
+ if (!exitKey) {
1765
+ const eff = index.parserKey(key, s.options);
1766
+ if (!effectIsExit(eff)) return flatMap(exit(eff), (exit) => parseIndex(s, key, index, exit));
1767
+ exitKey = eff;
1768
+ }
1769
+ if (exitKey._tag === "Failure") return wrapPropertyKeyIssue(s, ast, key, exitKey) ?? void_$1;
1770
+ const k2 = exitKey === sameExit ? key : exitKey[args];
1771
+ const inputValue = s.input[key];
1772
+ const result = index.parserValue(inputValue, s.options);
1773
+ return effectIsExit(result) ? finishIndex(s, key, k2, inputValue, result) : flatMap(exit(result), (exit) => finishIndex(s, key, k2, inputValue, exit));
1774
+ };
1775
+ const parseStringIndex = (s, key, index) => {
1776
+ const inputValue = s.input[key];
1777
+ const result = index.parserValue(inputValue, s.options);
1778
+ return effectIsExit(result) ? finishIndex(s, key, key, inputValue, result) : flatMap(exit(result), (exit) => finishIndex(s, key, key, inputValue, exit));
1779
+ };
1780
+ const parseIndexes = indexCount ? iterateConcurrent()({
1781
+ onItem: (s, [key, index]) => index.is.parameter === string ? parseStringIndex(s, key, index) : parseIndex(s, key, index),
1782
+ step: (_s, _item, exit) => exit._tag === "Failure" ? exit : void 0
1783
+ }) : void 0;
1784
+ const compileMembers = () => {
1785
+ if (!properties) {
1786
+ properties = ast.propertySignatures.map((ps) => ({
1787
+ parser: compileField(ps.type),
1788
+ name: ps.name,
1789
+ type: ps.type
1790
+ }));
1791
+ indexes = indexCount ? ast.indexSignatures.map((is) => ({
1792
+ is,
1793
+ parserKey: compile(parameterFromPropertyKey(is.parameter)),
1794
+ parserValue: compileField(is.type)
1795
+ })) : void 0;
1796
+ }
1797
+ return properties;
1798
+ };
1799
+ const fallback = fnUntracedEager(function* (input, options) {
1800
+ if (input === missing) return missing;
1801
+ if (!(typeof input === "object" && input !== null && !Array.isArray(input))) return yield* fail$2(new InvalidType(ast, input, options));
1802
+ compileMembers();
1803
+ const record = input;
1804
+ const out = {};
1805
+ const state = {
1806
+ ast,
1807
+ input: record,
1808
+ out,
1809
+ issues: void 0,
1810
+ options
1811
+ };
1812
+ const errorsAllOption = options.errors === "all";
1813
+ const onExcessPropertyError = options.onExcessProperty === "error";
1814
+ const concurrency = options.concurrency === void 0 ? 1 : resolveConcurrency(options.concurrency);
1815
+ const indexKeys = indexCount && onExcessPropertyError ? ast.indexSignatures.map((index) => getIndexSignatureKeys(record, index.parameter, options)) : void 0;
1816
+ if (onExcessPropertyError) {
1817
+ expectedKeysSet ??= new Set(expectedKeys);
1818
+ const coveredKeys = indexKeys ? new Set(expectedKeysSet) : expectedKeysSet;
1819
+ if (indexKeys) for (const keys of indexKeys) for (const key of keys) coveredKeys.add(key);
1820
+ const inputKeys = Reflect.ownKeys(record);
1821
+ for (let i = 0; i < inputKeys.length; i++) {
1822
+ const key = inputKeys[i];
1823
+ if (!coveredKeys.has(key)) {
1824
+ const unexpected = new UnexpectedKey(ast, record[key], options);
1825
+ const issue = new Pointer([key], unexpected);
1826
+ if (errorsAllOption) {
1406
1827
  if (state.issues) state.issues.push(issue);
1407
1828
  else state.issues = [issue];
1408
1829
  continue;
1409
- } else return yield* fail$1(new Composite(ast, [issue], input, options));
1830
+ } else return yield* fail$2(new Composite(ast, [issue], input, options));
1410
1831
  }
1411
1832
  }
1412
1833
  }
@@ -1434,7 +1855,7 @@ const Objects = class extends ASTNodeImpl {
1434
1855
  const eff = parseIndexes(state, keyPairs, { concurrency });
1435
1856
  if (eff) yield* eff;
1436
1857
  }
1437
- if (state.issues) return yield* fail$1(new Composite(ast, state.issues, input, options));
1858
+ if (state.issues) return yield* fail$2(new Composite(ast, state.issues, input, options));
1438
1859
  return out;
1439
1860
  });
1440
1861
  if (indexCount) return fallback;
@@ -1451,7 +1872,7 @@ const Objects = class extends ASTNodeImpl {
1451
1872
  return (input, options) => {
1452
1873
  if (input === missing) return missingExit;
1453
1874
  if (options.errors === "all" || options.onExcessProperty !== void 0 || options.concurrency !== void 0 && resolveConcurrency(options.concurrency) !== 1) return fallback(input, options);
1454
- if (!(typeof input === "object" && input !== null && !Array.isArray(input))) return fail$1(new InvalidType(ast, input, options));
1875
+ if (!(typeof input === "object" && input !== null && !Array.isArray(input))) return fail$2(new InvalidType(ast, input, options));
1455
1876
  const props = compileMembers();
1456
1877
  const record = input;
1457
1878
  const out = {};
@@ -1521,7 +1942,7 @@ function stepProperty(s, p, exit) {
1521
1942
  if (s.issues) s.issues.push(issue);
1522
1943
  else s.issues = [issue];
1523
1944
  return;
1524
- } else return fail$2(new Composite(s.ast, [issue], s.input, s.options));
1945
+ } else return fail$3(new Composite(s.ast, [issue], s.input, s.options));
1525
1946
  }
1526
1947
  }
1527
1948
  const parsePropertiesOptions = {
@@ -1786,12 +2207,12 @@ const Union$1 = class extends ASTNodeImpl {
1786
2207
  this.options = options;
1787
2208
  this.encodingChecks = encodingChecks;
1788
2209
  }
1789
- getParser(compile, compileConstructorDefault) {
2210
+ getParser(compile, compileField) {
1790
2211
  const ast = this;
1791
2212
  return (input, options) => {
1792
2213
  if (input === missing) return missingExit;
1793
- const candidates = getCandidates(input, ast.types, compileConstructorDefault !== void 0);
1794
- if (candidates.length === 0) return fail$1(new AnyOf(ast, [], input, options));
2214
+ const candidates = getCandidates(input, ast.types, compileField !== void 0);
2215
+ if (candidates.length === 0) return fail$2(new AnyOf(ast, [], input, options));
1795
2216
  if (candidates.length === 1) {
1796
2217
  const result = compile(candidates[0])(input, options);
1797
2218
  if (result._tag === "Success") return result;
@@ -1809,12 +2230,12 @@ const Union$1 = class extends ASTNodeImpl {
1809
2230
  const eff = parseUnion(state, candidates);
1810
2231
  if (!eff) {
1811
2232
  if (state.out) return state.out;
1812
- return fail$1(new AnyOf(ast, state.issues ?? [], input, options));
2233
+ return fail$2(new AnyOf(ast, state.issues ?? [], input, options));
1813
2234
  }
1814
2235
  return flatMapEager(eff, (_) => {
1815
- if (state.out === sameExit) return succeed$2(input);
2236
+ if (state.out === sameExit) return succeed$3(input);
1816
2237
  if (state.out) return state.out;
1817
- return fail$1(new AnyOf(ast, state.issues ?? [], input, options));
2238
+ return fail$2(new AnyOf(ast, state.issues ?? [], input, options));
1818
2239
  });
1819
2240
  };
1820
2241
  }
@@ -1860,7 +2281,7 @@ const Union$1 = class extends ASTNodeImpl {
1860
2281
  function failSingleUnionCandidate(ast, cause, input, options) {
1861
2282
  const issue = getSchemaIssue(cause);
1862
2283
  if (!issue) return failCause(cause);
1863
- return fail$2(new AnyOf(ast, [issue], input, options));
2284
+ return fail$3(new AnyOf(ast, [issue], input, options));
1864
2285
  }
1865
2286
  const parseUnion = iterateEager()({
1866
2287
  onItem(s, ast) {
@@ -1875,7 +2296,7 @@ const parseUnion = iterateEager()({
1875
2296
  } else {
1876
2297
  if (s.out && s.successes) {
1877
2298
  s.successes.push(candidate);
1878
- return fail$2(new OneOf(s.ast, s.successes, s.input, s.options));
2299
+ return fail$3(new OneOf(s.ast, s.successes, s.input, s.options));
1879
2300
  }
1880
2301
  s.out = exit;
1881
2302
  if (s.successes) s.successes.push(candidate);
@@ -1914,7 +2335,7 @@ const Suspend = class extends ASTNodeImpl {
1914
2335
  return getExpected(this.thunk());
1915
2336
  }
1916
2337
  };
1917
- const Filter = class extends Class$1 {
2338
+ const Filter = class extends Class$2 {
1918
2339
  _tag = "Filter";
1919
2340
  run;
1920
2341
  annotations;
@@ -1938,7 +2359,7 @@ const Filter = class extends Class$1 {
1938
2359
  return new FilterGroup([this, other], annotations);
1939
2360
  }
1940
2361
  };
1941
- const FilterGroup = class extends Class$1 {
2362
+ const FilterGroup = class extends Class$2 {
1942
2363
  _tag = "FilterGroup";
1943
2364
  checks;
1944
2365
  annotations;
@@ -2112,9 +2533,7 @@ const optionalKey$1 = memoizeIdempotent((ast) => {
2112
2533
  const optionalKeyLastLink = applyToLastLink(optionalKey$1);
2113
2534
  const optional$1 = memoize((ast) => optionalKey$1(new Union$1([ast, undefined_])));
2114
2535
  function withConstructorDefault$1(ast, defaultValue) {
2115
- const transformation = new Transformation(withDefault(defaultValue), passthrough$1());
2116
- const constructorDefault = new Link(unknown, transformation);
2117
- return replaceContext(ast, ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, constructorDefault, ast.context.annotations) : new Context(false, false, constructorDefault));
2536
+ return replaceContext(ast, ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, defaultValue, ast.context.annotations) : new Context(false, false, defaultValue));
2118
2537
  }
2119
2538
  function decodeTo$1(from, to, transformation) {
2120
2539
  return appendTransformation(from, transformation, to);
@@ -2208,14 +2627,14 @@ function fromConst(ast, value) {
2208
2627
  return (input, options) => {
2209
2628
  if (input === missing) return missingExit;
2210
2629
  if (input === value) return succeed$5;
2211
- return fail$1(new InvalidType(ast, input, options));
2630
+ return fail$2(new InvalidType(ast, input, options));
2212
2631
  };
2213
2632
  }
2214
2633
  function fromRefinement(ast, refinement) {
2215
2634
  return (input, options) => {
2216
2635
  if (input === missing) return missingExit;
2217
2636
  if (refinement(input)) return sameExit;
2218
- return fail$1(new InvalidType(ast, input, options));
2637
+ return fail$2(new InvalidType(ast, input, options));
2219
2638
  };
2220
2639
  }
2221
2640
  const parameterFromPropertyKey = applyToSelfOrLastLinkEncodingIdempotent((ast) => {
@@ -2341,7 +2760,7 @@ function isTree(u, isLeaf) {
2341
2760
  function isJson(u) {
2342
2761
  return isTree(u, isJsonLeaf);
2343
2762
  }
2344
- const Json$1 = new Declaration([], () => (input, ast, options) => isJson(input) ? sameExit : fail$1(new InvalidType(ast, input, options)), {
2763
+ const Json$1 = new Declaration([], () => (input, ast, options) => isJson(input) ? sameExit : fail$2(new InvalidType(ast, input, options)), {
2345
2764
  representation: {
2346
2765
  id: "effect/schema/Json",
2347
2766
  payload: null
@@ -2359,138 +2778,76 @@ const objectKeywordToJson = new Link(new Union$1([new Arrays(false, [], [Json$1]
2359
2778
  function isStringTree(u) {
2360
2779
  return isTree(u, isStringTreeLeaf);
2361
2780
  }
2362
- const StringTree = new Declaration([], () => (input, ast, options) => isStringTree(input) ? sameExit : fail$1(new InvalidType(ast, input, options)), {
2781
+ const StringTree = new Declaration([], () => (input, ast, options) => isStringTree(input) ? sameExit : fail$2(new InvalidType(ast, input, options)), {
2363
2782
  expected: "StringTree",
2364
2783
  toCodecStringTree: () => void 0
2365
2784
  });
2366
2785
  const unknownToStringTree = new Link(StringTree, passthrough());
2367
2786
  //#endregion
2368
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaParser.js
2369
- function makeEffect(schema) {
2370
- const ast = schema.ast;
2371
- let parser;
2372
- return (input, options) => {
2373
- return (parser ??= runWithCompiler(constructorCompiler, toType$1(ast)))(input, options?.disableChecks ? options?.parseOptions ? {
2374
- ...options.parseOptions,
2375
- disableChecks: true
2376
- } : { disableChecks: true } : options?.parseOptions);
2377
- };
2378
- }
2379
- function makeOption(schema) {
2380
- const parser = makeEffect(schema);
2381
- return (input, options) => {
2382
- const exit = runSyncExit(parser(input, options));
2383
- if (isSuccess(exit)) return some(exit.value);
2384
- getSchemaIssueOrThrow(exit.cause, "Option adapter can only return none for schema issues");
2385
- return none();
2787
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/internal/schema/interpreter.js
2788
+ const flatMapTransformation = (result, current, f) => result === sameExit ? f(current) : flatMapEager(result, f);
2789
+ function compileTransformation(transformation) {
2790
+ if (transformation._tag === "Middleware") return (result, current, options) => {
2791
+ const transformed = result === sameExit ? transformation.decode(succeed(toOption(current)), options) : transformation.decode(mapEager(result, toOption), options);
2792
+ return fromOptionalEffect(transformed);
2386
2793
  };
2794
+ const getter = transformation.decode;
2795
+ switch (getter._tag) {
2796
+ case "Passthrough": return (result, current) => result === sameExit ? succeed(current) : result;
2797
+ case "Transform": {
2798
+ const transform = (value) => value === missing ? missingExit : succeed(getter.transform(value));
2799
+ return (result, current) => flatMapTransformation(result, current, transform);
2800
+ }
2801
+ case "TransformOptional": {
2802
+ const transform = (value) => fromOptionExit(getter.transform(toOption(value)));
2803
+ return (result, current) => flatMapTransformation(result, current, transform);
2804
+ }
2805
+ case "TransformEffect": return (result, current, options) => flatMapTransformation(result, current, (value) => value === missing ? missingExit : getter.transform(value, options));
2806
+ case "TransformOptionalEffect": return (result, current, options) => flatMapTransformation(result, current, (value) => fromOptionalEffect(getter.transform(toOption(value), options)));
2807
+ }
2387
2808
  }
2388
- function make$3(schema) {
2389
- const parser = makeEffect(schema);
2809
+ const fromOptionalEffect = (effect) => flatMapEager(effect, fromOptionExit);
2810
+ const wrapEncoding = (ast, input, options, effect) => catchCause(effect, (cause) => failCauseSync(() => map$5(cause, (issue) => new Encoding(ast, issue, input, options))));
2811
+ function makeConstructorParser(descriptor, compile) {
2812
+ const transform = compileTransformation(descriptor.link.transformation);
2813
+ let sourceParser;
2390
2814
  return (input, options) => {
2391
- const exit = runSyncExit(parser(input, options));
2392
- if (isSuccess(exit)) return exit.value;
2393
- const issue = getSchemaIssueOrThrow(exit.cause, "Constructor adapter can only throw schema issues");
2394
- throw new Error("Schema validation failed", { cause: issue });
2395
- };
2396
- }
2397
- function is$1(schema) {
2398
- return _is(schema.ast);
2399
- }
2400
- function _is(ast) {
2401
- const parser = asExit(run(toType$1(ast)));
2402
- return (input) => {
2403
- const exit = parser(input, defaultParseOptions);
2404
- if (isSuccess(exit)) return true;
2405
- getSchemaIssueOrThrow(exit.cause, "Type guard adapter can only return false for schema issues");
2406
- return false;
2815
+ if (input === missing) return missingExit;
2816
+ if (descriptor.isConstructed(input)) return sameExit;
2817
+ const result = (sourceParser ??= compile(descriptor.link.to))(input, options);
2818
+ return transform(result, input, options);
2407
2819
  };
2408
2820
  }
2409
- function _issue(ast) {
2410
- const parser = run(ast);
2821
+ function withDefault(ast, parser) {
2822
+ const defaultValue = ast.context.constructorDefault;
2411
2823
  return (input, options) => {
2412
- const exit = runSyncExit(parser(input, options));
2413
- if (isSuccess(exit)) return;
2414
- return getSchemaIssueOrThrow(exit.cause, "Issue adapter can only return schema issues");
2824
+ if (input !== missing && input !== void 0) return parser(input, options);
2825
+ const result = defaultValue;
2826
+ if (effectIsExit(result) && result._tag === "Success") {
2827
+ const local = parser(result[args], options);
2828
+ return local === sameExit ? result : local;
2829
+ }
2830
+ return flatMapEager(wrapEncoding(ast, input, options, result), (value) => {
2831
+ const local = parser(value, options);
2832
+ return local === sameExit ? succeed(value) : local;
2833
+ });
2415
2834
  };
2416
2835
  }
2417
- function decodeUnknownEffect$1(schema, options) {
2418
- const parser = run(schema.ast);
2419
- return options === void 0 ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
2836
+ function compileField(ast, compile) {
2837
+ const parser = compile(ast);
2838
+ return ast.context?.constructorDefault === void 0 ? parser : withDefault(ast, parser);
2420
2839
  }
2421
- const decodeEffect$1 = decodeUnknownEffect$1;
2422
- function decodeUnknownOption$1(schema, options) {
2423
- return asOption(decodeUnknownEffect$1(schema, options));
2424
- }
2425
- function encodeUnknownEffect$1(schema, options) {
2426
- const parser = run(flip(schema.ast));
2427
- return options === void 0 ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
2428
- }
2429
- const encodeEffect$1 = encodeUnknownEffect$1;
2430
- const mergeParseOptions = (options, overrideOptions) => overrideOptions ? {
2431
- ...options,
2432
- ...overrideOptions
2433
- } : options;
2434
- const getValue = (value) => {
2435
- if (value === missing) return fail$1(new InvalidValue());
2436
- return succeed$2(value);
2437
- };
2438
- function run(ast) {
2439
- return runWithCompiler(normalCompiler, ast);
2440
- }
2441
- function runWithCompiler(compiler, ast) {
2442
- let parser;
2443
- return (input, options) => {
2444
- const result = (parser ??= compiler(ast))(input, options ?? defaultParseOptions);
2445
- if (result === sameExit) return succeed$2(input);
2446
- if (!effectIsExit(result)) return flatMapEager(result, getValue);
2447
- return result[args] === missing ? getValue(missing) : result;
2448
- };
2449
- }
2450
- function asExit(parser) {
2451
- return (input, options) => runSyncExit(parser(input, options));
2452
- }
2453
- function asOption(parser) {
2454
- const parserExit = asExit(parser);
2455
- return (input, options) => {
2456
- const exit = parserExit(input, options);
2457
- if (isSuccess(exit)) return some(exit.value);
2458
- getSchemaIssueOrThrow(exit.cause, "Option adapter can only return none for schema issues");
2459
- return none();
2460
- };
2461
- }
2462
- const normalCompiler = memoize((ast) => makeParser(ast, normalCompiler));
2463
- const constructorCompiler = memoize((ast) => makeParser(ast, constructorCompiler, compileConstructorDefault));
2464
- const compileDefaulted = memoize((ast) => makeParser(ast, constructorCompiler, compileConstructorDefault, ast.context?.constructorDefault));
2465
- function compileConstructorDefault(ast) {
2466
- return ast.context?.constructorDefault ? compileDefaulted(ast) : constructorCompiler(ast);
2467
- }
2468
- function applyTransformation(result, current, transformation, options) {
2469
- let transformed;
2470
- if (effectIsExit(result) && result._tag === "Success") {
2471
- const optional = toOption(result === sameExit ? current : result[args]);
2472
- transformed = transformation._tag === "Transformation" ? transformation.decode.run(optional, options) : transformation.decode(succeed(optional), options);
2473
- } else if (transformation._tag === "Transformation") transformed = flatMapEager(result, (value) => transformation.decode.run(toOption(value), options));
2474
- else transformed = transformation.decode(mapEager(result, toOption), options);
2475
- return effectIsExit(transformed) && transformed._tag === "Success" ? fromOptionExit(transformed[args]) : flatMapEager(transformed, fromOptionExit);
2476
- }
2477
- function makeConstructorParser(descriptor, compile) {
2478
- let sourceParser;
2479
- return (input, options) => {
2480
- if (input === missing) return missingExit;
2481
- if (descriptor.isConstructed(input)) return sameExit;
2482
- return applyTransformation((sourceParser ??= compile(descriptor.link.to))(input, options), input, descriptor.link.transformation, options);
2483
- };
2484
- }
2485
- function makeParser(ast, compile, compileConstructorDefault, constructorDefault) {
2486
- const descriptor = compileConstructorDefault ? getConstructorDescriptor(ast) : void 0;
2487
- const parser = descriptor ? makeConstructorParser(descriptor, compile) : ast.getParser(compile, compileConstructorDefault);
2840
+ function compile(ast, compile, compileField, base, specialize) {
2841
+ if (ast._tag === "Declaration") for (const parameter of ast.typeParameters) compile(parameter);
2842
+ const descriptor = compileField ? getConstructorDescriptor(ast) : void 0;
2843
+ const parser = descriptor ? makeConstructorParser(descriptor, compile) : base ?? ast.getParser(compile, compileField);
2488
2844
  const checks = ast.checks;
2489
- const links = constructorDefault ? ast.encoding ? [...ast.encoding, constructorDefault] : [constructorDefault] : ast.encoding;
2845
+ const links = ast.encoding;
2846
+ const transformations = links?.map((link) => compileTransformation(link.transformation));
2490
2847
  const encodingChecks = ast.encodingChecks;
2491
2848
  if (!links && !checks && !encodingChecks) return parser;
2492
2849
  let encodingParsers;
2493
- const parseLocal = (input, options) => {
2850
+ const parseChecks = (input, options) => {
2494
2851
  let result = parser(input, options);
2495
2852
  if (encodingChecks && !options.disableChecks) {
2496
2853
  if (effectIsExit(result)) {
@@ -2498,15 +2855,15 @@ function makeParser(ast, compile, compileConstructorDefault, constructorDefault)
2498
2855
  const output = result === sameExit ? input : result[args];
2499
2856
  if (input !== missing && output !== missing) {
2500
2857
  const issues = collectIssues(encodingChecks, input, void 0, ast, options);
2501
- if (issues) result = fail$1(new Composite(ast, issues, input, options));
2858
+ if (issues) result = fail$2(new Composite(ast, issues, input, options));
2502
2859
  }
2503
2860
  }
2504
2861
  } else result = flatMap(result, (value) => {
2505
2862
  if (input !== missing && value !== missing) {
2506
2863
  const issues = collectIssues(encodingChecks, input, void 0, ast, options);
2507
- if (issues) return fail$1(new Composite(ast, issues, input, options));
2864
+ if (issues) return fail$2(new Composite(ast, issues, input, options));
2508
2865
  }
2509
- return succeed$2(value);
2866
+ return succeed$3(value);
2510
2867
  });
2511
2868
  }
2512
2869
  if (checks && !options.disableChecks) {
@@ -2515,25 +2872,26 @@ function makeParser(ast, compile, compileConstructorDefault, constructorDefault)
2515
2872
  const value = result === sameExit ? input : result[args];
2516
2873
  if (value === missing) return result;
2517
2874
  const issues = collectIssues(checks, value, void 0, ast, options);
2518
- if (issues) result = fail$1(new Composite(ast, issues, value, options));
2875
+ if (issues) result = fail$2(new Composite(ast, issues, value, options));
2519
2876
  }
2520
2877
  } else result = flatMap(result, (value) => {
2521
2878
  if (value !== missing) {
2522
2879
  const issues = collectIssues(checks, value, void 0, ast, options);
2523
- if (issues) return fail$1(new Composite(ast, issues, value, options));
2880
+ if (issues) return fail$2(new Composite(ast, issues, value, options));
2524
2881
  }
2525
- return succeed$2(value);
2882
+ return succeed$3(value);
2526
2883
  });
2527
2884
  }
2528
2885
  return result;
2529
2886
  };
2887
+ const parseLocal = specialize === void 0 ? parseChecks : specialize(parseChecks);
2530
2888
  if (!links) return parseLocal;
2531
2889
  return (input, options) => {
2532
2890
  const parsers = encodingParsers ??= links.map((link) => compile(link.to));
2533
2891
  let current = input;
2534
2892
  let result = parsers[parsers.length - 1](input, options);
2535
2893
  for (let i = links.length - 1; i >= 0; i--) {
2536
- result = applyTransformation(result, current, links[i].transformation, options);
2894
+ result = transformations[i](result, current, options);
2537
2895
  if (i !== 0) {
2538
2896
  const next = parsers[i - 1];
2539
2897
  if (result._tag === "Success") {
@@ -2550,7 +2908,7 @@ function makeParser(ast, compile, compileConstructorDefault, constructorDefault)
2550
2908
  const local = parseLocal(value, options);
2551
2909
  return local === sameExit ? result : local;
2552
2910
  }
2553
- result = catchCause(result, (cause) => failCauseSync(() => map$4(cause, (issue) => new Encoding(ast, issue, input, options))));
2911
+ result = wrapEncoding(ast, input, options, result);
2554
2912
  return flatMapEager(result, (value) => {
2555
2913
  const local = parseLocal(value, options);
2556
2914
  return local === sameExit ? succeed(value) : local;
@@ -2558,10 +2916,252 @@ function makeParser(ast, compile, compileConstructorDefault, constructorDefault)
2558
2916
  };
2559
2917
  }
2560
2918
  //#endregion
2561
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/make.js
2562
- const TypeId$3 = "~effect/Schema/Schema";
2919
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/internal/schema/compilerRegistry.js
2920
+ const invalid = Symbol();
2921
+ const cache = new WeakMap();
2922
+ let compiler;
2923
+ let compilerAdaptersEnabled = false;
2924
+ const decodeChild = (ast) => compilerAdaptersEnabled ? lazyParser(resolve, ast, "parser") : resolve(ast).parser;
2925
+ const makeChild = (ast) => compilerAdaptersEnabled ? lazyParser(resolve, ast, "makeEffect") : resolve(ast).makeEffect;
2926
+ const makeField = (ast) => compileField(ast, makeChild);
2927
+ var InterpretedEntry = class {
2928
+ ast;
2929
+ constructor(ast) {
2930
+ this.ast = ast;
2931
+ }
2932
+ get decodeEffect() {
2933
+ return this.cachedDecodeEffect ??= compile(this.ast, decodeChild);
2934
+ }
2935
+ get parser() {
2936
+ return this.decodeEffect;
2937
+ }
2938
+ get makeEffect() {
2939
+ return this.cachedMakeEffect ??= compile(this.ast, makeChild, makeField);
2940
+ }
2941
+ };
2942
+ var CompilerEntry = class extends InterpretedEntry {
2943
+ compiled;
2944
+ resolve;
2945
+ constructor(ast, compiled, resolve) {
2946
+ super(ast);
2947
+ this.compiled = compiled;
2948
+ this.resolve = resolve;
2949
+ }
2950
+ save(key, value) {
2951
+ Object.defineProperty(this, key, { value });
2952
+ return value;
2953
+ }
2954
+ operation(key) {
2955
+ const compiled = this.compiled;
2956
+ return typeof compiled === "function" ? compiled(this.ast, this.resolve, key) : compiled?.[key];
2957
+ }
2958
+ get is() {
2959
+ return this.save("is", this.operation("is"));
2960
+ }
2961
+ get decode() {
2962
+ return this.save("decode", this.operation("decode"));
2963
+ }
2964
+ get make() {
2965
+ return this.save("make", this.operation("make"));
2966
+ }
2967
+ get decodeEffect() {
2968
+ return this.save("decodeEffect", this.operation("decodeEffect") ?? compile(this.ast, (ast) => lazyParser(this.resolve, ast, "parser")));
2969
+ }
2970
+ get parser() {
2971
+ const decode = this.decode;
2972
+ return decode === void 0 ? this.decodeEffect : this.save("parser", withDecode(decode, () => this.decodeEffect));
2973
+ }
2974
+ get makeEffect() {
2975
+ const makeEffect = this.operation("makeEffect");
2976
+ if (makeEffect !== void 0) return this.save("makeEffect", makeEffect);
2977
+ const child = (ast) => lazyParser(this.resolve, ast, "makeEffect");
2978
+ return this.save("makeEffect", compile(this.ast, child, (ast) => compileField(ast, child)));
2979
+ }
2980
+ };
2981
+ function withDecode(fastDecode, decodeEffect) {
2982
+ let detailed;
2983
+ return (input, options) => {
2984
+ if (input !== missing) try {
2985
+ const value = fastDecode(input, options);
2986
+ if (value !== invalid) return value === input ? sameExit : succeed(value);
2987
+ } catch (error) {
2988
+ return die(error);
2989
+ }
2990
+ return (detailed ??= decodeEffect())(input, options);
2991
+ };
2992
+ }
2993
+ function lazyParser(resolve, ast, operation) {
2994
+ const entry = resolve(ast);
2995
+ if (entry.compiled === void 0 || Object.hasOwn(entry, operation)) return entry[operation];
2996
+ let parser;
2997
+ return (input, options) => (parser ??= entry[operation])(input, options);
2998
+ }
2999
+ function resolve(ast) {
3000
+ const cached = cache.get(ast);
3001
+ if (cached !== void 0) return cached;
3002
+ const entry = compiler === void 0 ? new InterpretedEntry(ast) : new CompilerEntry(ast, compiler(ast, resolve), resolve);
3003
+ cache.set(ast, entry);
3004
+ return entry;
3005
+ }
3006
+ //#endregion
3007
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/SchemaParser.js
3008
+ function makeEffect(schema) {
3009
+ const ast = schema.ast;
3010
+ let parser;
3011
+ return (input, options) => {
3012
+ return (parser ??= runWithCompiler(constructorCompiler, toType$1(ast)))(input, options?.disableChecks ? options?.parseOptions ? {
3013
+ ...options.parseOptions,
3014
+ disableChecks: true
3015
+ } : { disableChecks: true } : options?.parseOptions);
3016
+ };
3017
+ }
3018
+ function makeOption(schema) {
3019
+ const parser = makeEffect(schema);
3020
+ return (input, options) => {
3021
+ const exit = runSyncExit(parser(input, options));
3022
+ if (isSuccess(exit)) return some(exit.value);
3023
+ getSchemaIssueOrThrow(exit.cause, "Option adapter can only return none for schema issues");
3024
+ return none();
3025
+ };
3026
+ }
3027
+ function make$2(schema) {
3028
+ return makeConstructorSync(toType$1(schema.ast));
3029
+ }
3030
+ function is$1(schema) {
3031
+ return _is(schema.ast);
3032
+ }
3033
+ function makeIs(ast) {
3034
+ if (!compilerAdaptersEnabled) {
3035
+ const parser = asExit(run(ast));
3036
+ return (input) => {
3037
+ const exit = parser(input, defaultParseOptions);
3038
+ if (isSuccess(exit)) return true;
3039
+ getSchemaIssueOrThrow(exit.cause, "Type guard adapter can only return false for schema issues");
3040
+ return false;
3041
+ };
3042
+ }
3043
+ const entry = resolve(ast);
3044
+ const guard = entry.is;
3045
+ if (guard !== void 0) return (input) => {
3046
+ try {
3047
+ return guard(input, defaultParseOptions);
3048
+ } catch (error) {
3049
+ getSchemaIssueOrThrow(die$1(error), "Type guard adapter can only return false for schema issues");
3050
+ return false;
3051
+ }
3052
+ };
3053
+ const parser = entry.parser;
3054
+ return (input) => {
3055
+ const exit = runSyncExit(parserResult(parser(input, defaultParseOptions), input));
3056
+ if (isSuccess(exit)) return true;
3057
+ getSchemaIssueOrThrow(exit.cause, "Type guard adapter can only return false for schema issues");
3058
+ return false;
3059
+ };
3060
+ }
3061
+ function _is(ast) {
3062
+ const typeAST = toType$1(ast);
3063
+ let guard = (input) => {
3064
+ guard = makeIs(typeAST);
3065
+ return guard(input);
3066
+ };
3067
+ return (input) => {
3068
+ return guard(input);
3069
+ };
3070
+ }
3071
+ function _issue(ast) {
3072
+ const parser = run(ast);
3073
+ return (input, options) => {
3074
+ const exit = runSyncExit(parser(input, options));
3075
+ if (isSuccess(exit)) return;
3076
+ return getSchemaIssueOrThrow(exit.cause, "Issue adapter can only return schema issues");
3077
+ };
3078
+ }
3079
+ function decodeUnknownEffect$1(schema, options) {
3080
+ const parser = run(schema.ast);
3081
+ return options === void 0 ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
3082
+ }
3083
+ const decodeEffect$1 = decodeUnknownEffect$1;
3084
+ function decodeUnknownOption$1(schema, options) {
3085
+ return asOption(decodeUnknownEffect$1(schema, options));
3086
+ }
3087
+ function encodeUnknownEffect$1(schema, options) {
3088
+ const parser = run(flip(schema.ast));
3089
+ return options === void 0 ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
3090
+ }
3091
+ const encodeEffect$1 = encodeUnknownEffect$1;
3092
+ const mergeParseOptions = (options, overrideOptions) => overrideOptions ? {
3093
+ ...options,
3094
+ ...overrideOptions
3095
+ } : options;
3096
+ const getValue = (value) => {
3097
+ if (value === missing) return fail$2(new InvalidValue());
3098
+ return succeed$3(value);
3099
+ };
3100
+ function run(ast) {
3101
+ return runWithCompiler(normalCompiler, ast);
3102
+ }
3103
+ function parserResult(result, input) {
3104
+ if (result === sameExit) return succeed$3(input);
3105
+ if (!effectIsExit(result)) return flatMapEager(result, getValue);
3106
+ return result[args] === missing ? getValue(missing) : result;
3107
+ }
3108
+ function runWithCompiler(compiler, ast) {
3109
+ let parser;
3110
+ return (input, options) => {
3111
+ const result = (parser ??= compiler(ast))(input, options ?? defaultParseOptions);
3112
+ if (result === sameExit) return succeed$3(input);
3113
+ if (!effectIsExit(result)) return flatMapEager(result, getValue);
3114
+ return result[args] === missing ? getValue(missing) : result;
3115
+ };
3116
+ }
3117
+ function asExit(parser) {
3118
+ return (input, options) => runSyncExit(parser(input, options));
3119
+ }
3120
+ function asOption(parser) {
3121
+ const parserExit = asExit(parser);
3122
+ return (input, options) => {
3123
+ const exit = parserExit(input, options);
3124
+ if (isSuccess(exit)) return some(exit.value);
3125
+ getSchemaIssueOrThrow(exit.cause, "Option adapter can only return none for schema issues");
3126
+ return none();
3127
+ };
3128
+ }
3129
+ function runSync(effect, message) {
3130
+ const exit = runSyncExit(effect);
3131
+ if (isSuccess(exit)) return exit.value;
3132
+ const issue = getSchemaIssueOrThrow(exit.cause, message);
3133
+ throw new Error("Schema validation failed", { cause: issue });
3134
+ }
3135
+ function makeConstructorSync(ast) {
3136
+ let entry;
3137
+ let parser;
3138
+ return (input, options) => {
3139
+ entry ??= resolve(ast);
3140
+ const parseOptions = options?.disableChecks ? options.parseOptions ? {
3141
+ ...options.parseOptions,
3142
+ disableChecks: true
3143
+ } : { disableChecks: true } : options?.parseOptions ?? defaultParseOptions;
3144
+ const make = entry.make;
3145
+ if (make !== void 0 && input !== missing) {
3146
+ let output;
3147
+ try {
3148
+ output = make(input, parseOptions);
3149
+ } catch (error) {
3150
+ getSchemaIssueOrThrow(die$1(error), "Constructor adapter can only throw schema issues");
3151
+ throw error;
3152
+ }
3153
+ if (output !== invalid && output !== missing) return output;
3154
+ }
3155
+ return runSync(parserResult((parser ??= entry.makeEffect)(input, parseOptions), input), "Constructor adapter can only throw schema issues");
3156
+ };
3157
+ }
3158
+ const normalCompiler = (ast) => resolve(ast).parser;
3159
+ const constructorCompiler = (ast) => resolve(ast).makeEffect;
3160
+ //#endregion
3161
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/internal/schema/make.js
3162
+ const TypeId$1 = "~effect/Schema/Schema";
2563
3163
  const SchemaProto = {
2564
- [TypeId$3]: TypeId$3,
3164
+ [TypeId$1]: TypeId$1,
2565
3165
  pipe() {
2566
3166
  return pipeArguments(this, arguments);
2567
3167
  },
@@ -2575,20 +3175,20 @@ const SchemaProto = {
2575
3175
  return this.rebuild(appendChecks(this.ast, checks));
2576
3176
  }
2577
3177
  };
2578
- function make$2(ast, options) {
3178
+ function make$1(ast, options) {
2579
3179
  function Schema() {}
2580
3180
  const self = Object.setPrototypeOf(Schema, SchemaProto);
2581
3181
  if (options && (Object.hasOwn(options, "name") || Object.hasOwn(options, "length") || Object.hasOwn(options, "__proto__"))) Object.defineProperties(self, Object.getOwnPropertyDescriptors({ ...options }));
2582
3182
  else Object.assign(self, options);
2583
3183
  self.ast = ast;
2584
- self.rebuild = (ast) => make$2(ast, options);
3184
+ self.rebuild = (ast) => make$1(ast, options);
2585
3185
  self.makeEffect = makeEffect(self);
2586
- self.make = make$3(self);
3186
+ self.make = make$2(self);
2587
3187
  self.makeOption = makeOption(self);
2588
3188
  return self;
2589
3189
  }
2590
3190
  //#endregion
2591
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/JsonPointer.js
3191
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/JsonPointer.js
2592
3192
  function escapeToken(token) {
2593
3193
  return token.replace(/~/g, "~0").replace(/\//g, "~1");
2594
3194
  }
@@ -2615,7 +3215,7 @@ function parseUriFragment(fragment) {
2615
3215
  return pointer === void 0 ? void 0 : pointer.length === 0 ? [] : pointer.slice(1).split("/").map(unescapeToken);
2616
3216
  }
2617
3217
  //#endregion
2618
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/JsonSchema.js
3218
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/JsonSchema.js
2619
3219
  function getReferenceKey($ref) {
2620
3220
  const path = $ref.startsWith("#") ? parseUriFragment($ref) : void 0;
2621
3221
  return path !== void 0 && path.length === 2 && path[0] === "$defs" ? path[1] : void 0;
@@ -2711,9 +3311,9 @@ const OPEN_API_30_TO_2020_COLLISIONS = [
2711
3311
  "then"
2712
3312
  ];
2713
3313
  //#endregion
2714
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toCodec.js
3314
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/internal/schema/toCodec.js
2715
3315
  function toCodecJson$1(schema) {
2716
- return make$2(toCodecJsonAST(schema.ast), { schema });
3316
+ return make$1(toCodecJsonAST(schema.ast), { schema });
2717
3317
  }
2718
3318
  const toCodecJsonAST = applyToSelfOrLastLinkEncodingIdempotent((ast) => {
2719
3319
  const out = toCodecJsonASTStep(ast, toCodecJsonAST);
@@ -2756,7 +3356,7 @@ function toCodecJsonASTStep(ast, recur) {
2756
3356
  case "Declaration": {
2757
3357
  const getLink = ast.annotations?.toCodecJson ?? ast.annotations?.toCodec;
2758
3358
  if (!isFunction(getLink)) return replaceEncoding(ast, [unknownToJson]);
2759
- const link = getLink(ast.typeParameters.map((tp) => make$2(toEncoded$1(tp))));
3359
+ const link = getLink(ast.typeParameters.map((tp) => make$1(toEncoded$1(tp))));
2760
3360
  return link === void 0 ? ast : replaceEncoding(ast, [mapLink(link, recur)]);
2761
3361
  }
2762
3362
  case "Unknown": return replaceEncoding(ast, [unknownToJson]);
@@ -2782,7 +3382,7 @@ function toCodecJsonASTStep(ast, recur) {
2782
3382
  return ast;
2783
3383
  }
2784
3384
  function toCodecStringTree$1(schema) {
2785
- return make$2(toCodecStringTreeAST(schema.ast), { schema });
3385
+ return make$1(toCodecStringTreeAST(schema.ast), { schema });
2786
3386
  }
2787
3387
  const toStringTreeReorder = makeReorder((ast) => {
2788
3388
  switch (ast._tag) {
@@ -2798,7 +3398,7 @@ const toStringTreeReorder = makeReorder((ast) => {
2798
3398
  function toCodecStringTreeASTStep(ast, recur, onMissingAnnotation) {
2799
3399
  switch (ast._tag) {
2800
3400
  case "Declaration": {
2801
- const typeParameters = ast.typeParameters.map((tp) => make$2(recur(toEncoded$1(tp))));
3401
+ const typeParameters = ast.typeParameters.map((tp) => make$1(recur(toEncoded$1(tp))));
2802
3402
  const getStringTreeLink = ast.annotations?.toCodecStringTree;
2803
3403
  if (isFunction(getStringTreeLink)) {
2804
3404
  const link = getStringTreeLink(typeParameters);
@@ -2846,17 +3446,17 @@ const toCodecStringTreeAST = applyToSelfOrLastLinkEncodingIdempotent((ast) => {
2846
3446
  return out;
2847
3447
  }, { stopAt: isCodecArrayFromSingleLink });
2848
3448
  //#endregion
2849
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/RegExp.js
3449
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/RegExp.js
2850
3450
  const RegExp$1 = globalThis.RegExp;
2851
3451
  const escape = (string) => string.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
2852
3452
  //#endregion
2853
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/errors.js
3453
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/internal/errors.js
2854
3454
  function errorWithPath(message, path) {
2855
3455
  if (path.length > 0) message += `\n at ${formatPath(path)}`;
2856
3456
  return new Error(message);
2857
3457
  }
2858
3458
  //#endregion
2859
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
3459
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
2860
3460
  function formatDefinitionReference(key) {
2861
3461
  return `#/$defs/${formatUriFragmentToken(key)}`;
2862
3462
  }
@@ -2985,7 +3585,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
2985
3585
  const fallbackDefinitions = new Map();
2986
3586
  const referenceKeys = Object.keys(references);
2987
3587
  for (const key of referenceKeys) compileDefinition(key, ["references", key]);
2988
- const schemas = map$2(representations, (representation, index) => finalizeJsonSchema(recur(representation, rootPaths[index])));
3588
+ const schemas = map$3(representations, (representation, index) => finalizeJsonSchema(recur(representation, rootPaths[index])));
2989
3589
  const definitions = {};
2990
3590
  for (const key of referenceKeys) {
2991
3591
  const compiled = definitionStates.get(key);
@@ -3006,7 +3606,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
3006
3606
  const fallback = getIdentifierFallback(representation);
3007
3607
  if (fallback !== void 0) {
3008
3608
  const candidates = fallbackDefinitions.get(fallback);
3009
- const match = candidates?.find((candidate) => equals$1(definitionStates.get(candidate), schema));
3609
+ const match = candidates?.find((candidate) => equals(definitionStates.get(candidate), schema));
3010
3610
  if (match === void 0) {
3011
3611
  if (candidates === void 0) fallbackDefinitions.set(fallback, [key]);
3012
3612
  else candidates.push(key);
@@ -3229,7 +3829,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
3229
3829
  index,
3230
3830
  "type"
3231
3831
  ]);
3232
- if (equals$1(type, { not: {} })) type = false;
3832
+ if (equals(type, { not: {} })) type = false;
3233
3833
  indexValueSchemas.push(type);
3234
3834
  const patterns = getParameterPatterns(signature.parameter, [
3235
3835
  ...path,
@@ -3363,7 +3963,7 @@ function toJsonSchemaDocument$1(document, options) {
3363
3963
  };
3364
3964
  }
3365
3965
  //#endregion
3366
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toRepresentation.js
3966
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/internal/schema/toRepresentation.js
3367
3967
  const defaultReferencePolicy = ({ identifier }) => identifier;
3368
3968
  function annotationsField(annotations) {
3369
3969
  return annotations === void 0 ? void 0 : { annotations };
@@ -3393,7 +3993,7 @@ function toRepresentations(asts, options) {
3393
3993
  else if (candidate.isRecursive) candidate.reference = getReference(`${candidate.ast._tag}_`, candidate, "");
3394
3994
  }
3395
3995
  return {
3396
- representations: map$2(asts, (ast) => recur(ast)),
3996
+ representations: map$3(asts, (ast) => recur(ast)),
3397
3997
  references
3398
3998
  };
3399
3999
  function getReference(prefix, owner, separator = "_") {
@@ -3477,494 +4077,195 @@ function toRepresentations(asts, options) {
3477
4077
  visitingCandidates.delete(candidate);
3478
4078
  }
3479
4079
  function visitChecks(checks) {
3480
- checks?.forEach((check) => {
3481
- check.annotations?.representation?.schemas?.forEach((schema) => visit(toType$1(schema)));
3482
- if (check._tag === "FilterGroup") visitChecks(check.checks);
3483
- });
3484
- }
3485
- function recur(input) {
3486
- const candidate = getCandidate(input);
3487
- const ast = candidate.ast;
3488
- const reference = candidate.reference;
3489
- if (reference !== void 0) return makeReference(reference, candidate.identifier === void 0 ? ast : annotateReference(ast, candidate, reference));
3490
- return on(ast);
3491
- }
3492
- function on(ast) {
3493
- const checks = fromChecks(ast.checks);
3494
- switch (ast._tag) {
3495
- case "Declaration": return {
3496
- _tag: "Declaration",
3497
- typeParameters: ast.typeParameters.map((ast) => recur(ast)),
3498
- checks,
3499
- ...fromDeclarationAnnotations(ast.annotations)
3500
- };
3501
- case "Null":
3502
- case "Undefined":
3503
- case "Void":
3504
- case "Never":
3505
- case "Unknown":
3506
- case "Any":
3507
- case "String":
3508
- case "Boolean":
3509
- case "Number":
3510
- case "BigInt":
3511
- case "Symbol":
3512
- case "ObjectKeyword": return {
3513
- _tag: ast._tag,
3514
- checks,
3515
- ...annotationsField(ast.annotations)
3516
- };
3517
- case "Literal": return {
3518
- _tag: "Literal",
3519
- literal: ast.literal,
3520
- checks,
3521
- ...annotationsField(ast.annotations)
3522
- };
3523
- case "UniqueSymbol": return {
3524
- _tag: "UniqueSymbol",
3525
- symbol: ast.symbol,
3526
- checks,
3527
- ...annotationsField(ast.annotations)
3528
- };
3529
- case "Enum": return {
3530
- _tag: "Enum",
3531
- enums: ast.enums,
3532
- checks,
3533
- ...annotationsField(ast.annotations)
3534
- };
3535
- case "TemplateLiteral": return {
3536
- _tag: "TemplateLiteral",
3537
- parts: ast.parts.map((ast) => recur(ast)),
3538
- checks,
3539
- ...annotationsField(ast.annotations)
3540
- };
3541
- case "Arrays": return {
3542
- _tag: "Arrays",
3543
- elements: ast.elements.map((element) => {
3544
- const projected = getLastEncoding(element);
3545
- const annotations = projected.context?.annotations;
3546
- return {
3547
- isOptional: isOptional(projected),
3548
- type: recur(element),
3549
- ...annotationsField(annotations)
3550
- };
3551
- }),
3552
- rest: ast.rest.map((ast) => recur(ast)),
3553
- checks,
3554
- ...annotationsField(ast.annotations)
3555
- };
3556
- case "Objects": return {
3557
- _tag: "Objects",
3558
- propertySignatures: ast.propertySignatures.map((property) => {
3559
- const projected = getLastEncoding(property.type);
3560
- const annotations = projected.context?.annotations;
3561
- return {
3562
- name: property.name,
3563
- type: recur(property.type),
3564
- isOptional: isOptional(projected),
3565
- isMutable: isMutable(projected),
3566
- ...annotationsField(annotations)
3567
- };
3568
- }),
3569
- indexSignatures: ast.indexSignatures.map((index) => ({
3570
- parameter: recur(index.parameter),
3571
- type: recur(index.type)
3572
- })),
3573
- checks,
3574
- ...annotationsField(ast.annotations)
3575
- };
3576
- case "Union": return {
3577
- _tag: "Union",
3578
- types: ast.types.map((ast) => recur(ast)),
3579
- ...ast.options === void 0 ? {} : { options: ast.options },
3580
- checks,
3581
- ...annotationsField(ast.annotations)
3582
- };
3583
- case "Suspend": return {
3584
- _tag: "Suspend",
3585
- checks: [],
3586
- thunk: recur(ast.thunk()),
3587
- ...annotationsField(ast.annotations)
3588
- };
3589
- }
3590
- }
3591
- function fromChecks(checks) {
3592
- return checks?.map(fromCheck) ?? [];
3593
- }
3594
- function fromCheck(check) {
3595
- switch (check._tag) {
3596
- case "Filter": return {
3597
- _tag: "Filter",
3598
- aborted: check.aborted,
3599
- ...fromCheckAnnotations(check.annotations)
3600
- };
3601
- case "FilterGroup": return {
3602
- _tag: "FilterGroup",
3603
- checks: map$2(check.checks, fromCheck),
3604
- ...fromCheckAnnotations(check.annotations)
3605
- };
3606
- }
3607
- }
3608
- function fromDeclarationAnnotations(annotations) {
3609
- if (annotations === void 0) return void 0;
3610
- const { representation, ...ordinary } = annotations;
3611
- return {
3612
- ...representation === void 0 ? void 0 : { representation },
3613
- ...Object.keys(ordinary).length === 0 ? void 0 : { annotations: ordinary }
3614
- };
3615
- }
3616
- function fromCheckAnnotations(annotations) {
3617
- if (annotations === void 0) return void 0;
3618
- const { representation, ...ordinary } = annotations;
3619
- const projected = representation === void 0 ? void 0 : representation.schemas === void 0 ? representation : {
3620
- ...representation,
3621
- schemas: representation.schemas.map((schema) => recur(toType$1(schema)))
3622
- };
3623
- return {
3624
- ...projected === void 0 ? void 0 : { representation: projected },
3625
- ...Object.keys(ordinary).length === 0 ? void 0 : { annotations: ordinary }
3626
- };
3627
- }
3628
- }
3629
- //#endregion
3630
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Struct.js
3631
- const omit = dual(2, (self, keys) => {
3632
- return buildStruct(self, (k, v) => !hasPropertyKey(keys, k) ? [k, v] : void 0);
3633
- });
3634
- const evolve = dual(2, (self, e) => {
3635
- return buildStruct(self, (k, v) => [k, Object.hasOwn(e, k) ? e[k](v) : v]);
3636
- });
3637
- const lambda = (f) => f;
3638
- function hasPropertyKey(keys, key) {
3639
- return keys.some((candidate) => candidate === key || typeof candidate === "number" && String(candidate) === key);
3640
- }
3641
- function buildStruct(source, f) {
3642
- const out = {};
3643
- for (const k of Reflect.ownKeys(source)) {
3644
- if (!Object.prototype.propertyIsEnumerable.call(source, k)) continue;
3645
- const res = f(k, source[k]);
3646
- if (res) {
3647
- const [nk, nv] = res;
3648
- assignProperty$1(out, nk, nv);
3649
- }
3650
- }
3651
- return out;
3652
- }
3653
- //#endregion
3654
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schemaError.js
3655
- const SchemaErrorTypeId = "~effect/Schema/SchemaError";
3656
- function isSchemaError$1(u) {
3657
- return hasProperty(u, "~effect/Schema/SchemaError") && u["~effect/Schema/SchemaError"] === "~effect/Schema/SchemaError";
3658
- }
3659
- //#endregion
3660
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/http/Cookies.js
3661
- const TypeId$2 = "~effect/http/Cookies";
3662
- const isCookies = (u) => hasProperty(u, TypeId$2);
3663
- const CookieTypeId = "~effect/http/Cookies/Cookie";
3664
- const isCookie = (u) => hasProperty(u, CookieTypeId);
3665
- const CookieErrorTypeId = "~effect/http/Cookies/CookieError";
3666
- var CookiesErrorReason = class extends Error$2 {};
3667
- var CookiesError = class CookiesError extends TaggedError$1("CookiesError") {
3668
- static fromReason(reason, cause) {
3669
- return new CookiesError({ reason: new CookiesErrorReason({
3670
- _tag: reason,
3671
- cause
3672
- }) });
3673
- }
3674
- [CookieErrorTypeId] = CookieErrorTypeId;
3675
- get message() {
3676
- return this.reason._tag;
3677
- }
3678
- };
3679
- const Proto$1 = {
3680
- [TypeId$2]: TypeId$2,
3681
- ...BaseProto,
3682
- toJSON() {
3683
- return {
3684
- _id: "effect/Cookies",
3685
- cookies: map(this.cookies, (cookie) => cookie.toJSON())
3686
- };
3687
- },
3688
- pipe() {
3689
- return pipeArguments(this, arguments);
3690
- }
3691
- };
3692
- const fromReadonlyRecord = (cookies) => {
3693
- const self = Object.create(Proto$1);
3694
- self.cookies = cookies;
3695
- return self;
3696
- };
3697
- const fromIterable = (cookies) => {
3698
- const record = {};
3699
- for (const cookie of cookies) assignProperty$1(record, cookie.name, cookie);
3700
- return fromReadonlyRecord(record);
3701
- };
3702
- const fromSetCookie = (headers) => {
3703
- const arrayHeaders = typeof headers === "string" ? [headers] : headers;
3704
- const cookies = [];
3705
- for (const header of arrayHeaders) {
3706
- const cookie = parseSetCookie(header.trim());
3707
- if (cookie) cookies.push(cookie);
3708
- }
3709
- return fromIterable(cookies);
3710
- };
3711
- function parseSetCookie(header) {
3712
- const parts = header.split(";").map((_) => _.trim()).filter((_) => _ !== "");
3713
- if (parts.length === 0) return;
3714
- const firstEqual = parts[0].indexOf("=");
3715
- if (firstEqual === -1) return;
3716
- const name = parts[0].slice(0, firstEqual);
3717
- if (!cookieNameRegExp.test(name)) return;
3718
- const valueEncoded = parts[0].slice(firstEqual + 1);
3719
- const value = tryDecodeURIComponent(valueEncoded);
3720
- if (parts.length === 1) return Object.assign(Object.create(CookieProto), {
3721
- name,
3722
- value,
3723
- valueEncoded
3724
- });
3725
- const options = {};
3726
- for (let i = 1; i < parts.length; i++) {
3727
- const part = parts[i];
3728
- const equalIndex = part.indexOf("=");
3729
- const key = equalIndex === -1 ? part : part.slice(0, equalIndex).trim();
3730
- const value = equalIndex === -1 ? void 0 : part.slice(equalIndex + 1).trim();
3731
- switch (key.toLowerCase()) {
3732
- case "domain": {
3733
- if (value === void 0) break;
3734
- const domain = value.trim().replace(/^\./, "");
3735
- if (domain) options.domain = domain;
3736
- break;
3737
- }
3738
- case "expires": {
3739
- if (value === void 0) break;
3740
- const date = new Date(value);
3741
- if (!isNaN(date.getTime())) options.expires = date;
3742
- break;
3743
- }
3744
- case "max-age": {
3745
- if (value === void 0) break;
3746
- const maxAge = parseInt(value, 10);
3747
- if (!isNaN(maxAge)) options.maxAge = seconds(maxAge);
3748
- break;
3749
- }
3750
- case "path":
3751
- if (value === void 0) break;
3752
- if (value[0] === "/") options.path = value;
3753
- break;
3754
- case "priority":
3755
- if (value === void 0) break;
3756
- switch (value.toLowerCase()) {
3757
- case "low":
3758
- options.priority = "low";
3759
- break;
3760
- case "medium":
3761
- options.priority = "medium";
3762
- break;
3763
- case "high": options.priority = "high";
3764
- }
3765
- break;
3766
- case "httponly":
3767
- options.httpOnly = true;
3768
- break;
3769
- case "secure":
3770
- options.secure = true;
3771
- break;
3772
- case "partitioned":
3773
- options.partitioned = true;
3774
- break;
3775
- case "samesite":
3776
- if (value === void 0) break;
3777
- switch (value.toLowerCase()) {
3778
- case "lax":
3779
- options.sameSite = "lax";
3780
- break;
3781
- case "strict":
3782
- options.sameSite = "strict";
3783
- break;
3784
- case "none": options.sameSite = "none";
3785
- }
3786
- }
3787
- }
3788
- return Object.assign(Object.create(CookieProto), {
3789
- name,
3790
- value,
3791
- valueEncoded,
3792
- options: Object.keys(options).length > 0 ? options : void 0
3793
- });
3794
- }
3795
- const empty$1 = fromIterable([]);
3796
- const fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
3797
- const cookieNameRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
3798
- const cookieDomainRegExp = /^[\u0009\u0020-\u003a\u003c-\u007e\u0080-\u00ff]+$/;
3799
- const cookiePathRegExp = /^[\u0020-\u003a\u003c-\u007e]+$/;
3800
- const CookieProto = {
3801
- [CookieTypeId]: CookieTypeId,
3802
- ...BaseProto,
3803
- toJSON() {
3804
- return {
3805
- _id: "effect/Cookies/Cookie",
3806
- name: this.name,
3807
- value: this.value,
3808
- options: this.options
3809
- };
3810
- }
3811
- };
3812
- function makeCookie(name, value, options) {
3813
- const encodedValue = encodeURIComponent(value);
3814
- const error = validateCookie(name, encodedValue, options);
3815
- if (error !== void 0) return fail$3(error);
3816
- return succeed$3(Object.assign(Object.create(CookieProto), {
3817
- name,
3818
- value,
3819
- valueEncoded: encodedValue,
3820
- options
3821
- }));
3822
- }
3823
- function validateCookie(name, encodedValue, options) {
3824
- if (!cookieNameRegExp.test(name)) return CookiesError.fromReason("InvalidCookieName");
3825
- if (encodedValue && !fieldContentRegExp.test(encodedValue)) return CookiesError.fromReason("InvalidCookieValue");
3826
- if (options?.domain !== void 0 && !cookieDomainRegExp.test(options.domain)) return CookiesError.fromReason("InvalidCookieDomain");
3827
- if (options?.path !== void 0 && !cookiePathRegExp.test(options.path)) return CookiesError.fromReason("InvalidCookiePath");
3828
- if (options?.maxAge !== void 0 && !isFinite$2(fromInputUnsafe(options.maxAge))) return CookiesError.fromReason("CookieInfinityMaxAge");
3829
- }
3830
- const makeCookieUnsafe = (name, value, options) => getOrThrow(makeCookie(name, value, options));
3831
- function serializeCookie(self) {
3832
- const error = validateCookie(self.name, self.valueEncoded, self.options);
3833
- if (error !== void 0) throw error;
3834
- let str = self.name + "=" + self.valueEncoded;
3835
- if (self.options === void 0) return str;
3836
- const options = self.options;
3837
- if (options.maxAge !== void 0) {
3838
- const maxAge = toSeconds(fromInputUnsafe(options.maxAge));
3839
- str += "; Max-Age=" + Math.trunc(maxAge);
3840
- }
3841
- if (options.domain !== void 0) str += "; Domain=" + options.domain;
3842
- if (options.path !== void 0) str += "; Path=" + options.path;
3843
- if (options.priority !== void 0) switch (options.priority) {
3844
- case "low":
3845
- str += "; Priority=Low";
3846
- break;
3847
- case "medium":
3848
- str += "; Priority=Medium";
3849
- break;
3850
- case "high": str += "; Priority=High";
4080
+ checks?.forEach((check) => {
4081
+ check.annotations?.representation?.schemas?.forEach((schema) => visit(toType$1(schema)));
4082
+ if (check._tag === "FilterGroup") visitChecks(check.checks);
4083
+ });
3851
4084
  }
3852
- if (options.expires !== void 0) str += "; Expires=" + options.expires.toUTCString();
3853
- if (options.httpOnly) str += "; HttpOnly";
3854
- if (options.secure) str += "; Secure";
3855
- if (options.partitioned) str += "; Partitioned";
3856
- if (options.sameSite !== void 0) switch (options.sameSite) {
3857
- case "lax":
3858
- str += "; SameSite=Lax";
3859
- break;
3860
- case "strict":
3861
- str += "; SameSite=Strict";
3862
- break;
3863
- case "none": str += "; SameSite=None";
4085
+ function recur(input) {
4086
+ const candidate = getCandidate(input);
4087
+ const ast = candidate.ast;
4088
+ const reference = candidate.reference;
4089
+ if (reference !== void 0) return makeReference(reference, candidate.identifier === void 0 ? ast : annotateReference(ast, candidate, reference));
4090
+ return on(ast);
3864
4091
  }
3865
- return str;
3866
- }
3867
- const toRecord$1 = (self) => {
3868
- const record = {};
3869
- const cookies = Object.values(self.cookies);
3870
- for (let index = 0; index < cookies.length; index++) {
3871
- const cookie = cookies[index];
3872
- assignProperty$1(record, cookie.name, cookie.value);
4092
+ function on(ast) {
4093
+ const checks = fromChecks(ast.checks);
4094
+ switch (ast._tag) {
4095
+ case "Declaration": return {
4096
+ _tag: "Declaration",
4097
+ typeParameters: ast.typeParameters.map((ast) => recur(ast)),
4098
+ checks,
4099
+ ...fromDeclarationAnnotations(ast.annotations)
4100
+ };
4101
+ case "Null":
4102
+ case "Undefined":
4103
+ case "Void":
4104
+ case "Never":
4105
+ case "Unknown":
4106
+ case "Any":
4107
+ case "String":
4108
+ case "Boolean":
4109
+ case "Number":
4110
+ case "BigInt":
4111
+ case "Symbol":
4112
+ case "ObjectKeyword": return {
4113
+ _tag: ast._tag,
4114
+ checks,
4115
+ ...annotationsField(ast.annotations)
4116
+ };
4117
+ case "Literal": return {
4118
+ _tag: "Literal",
4119
+ literal: ast.literal,
4120
+ checks,
4121
+ ...annotationsField(ast.annotations)
4122
+ };
4123
+ case "UniqueSymbol": return {
4124
+ _tag: "UniqueSymbol",
4125
+ symbol: ast.symbol,
4126
+ checks,
4127
+ ...annotationsField(ast.annotations)
4128
+ };
4129
+ case "Enum": return {
4130
+ _tag: "Enum",
4131
+ enums: ast.enums,
4132
+ checks,
4133
+ ...annotationsField(ast.annotations)
4134
+ };
4135
+ case "TemplateLiteral": return {
4136
+ _tag: "TemplateLiteral",
4137
+ parts: ast.parts.map((ast) => recur(ast)),
4138
+ checks,
4139
+ ...annotationsField(ast.annotations)
4140
+ };
4141
+ case "Arrays": return {
4142
+ _tag: "Arrays",
4143
+ elements: ast.elements.map((element) => {
4144
+ const projected = getLastEncoding(element);
4145
+ const annotations = projected.context?.annotations;
4146
+ return {
4147
+ isOptional: isOptional(projected),
4148
+ type: recur(element),
4149
+ ...annotationsField(annotations)
4150
+ };
4151
+ }),
4152
+ rest: ast.rest.map((ast) => recur(ast)),
4153
+ checks,
4154
+ ...annotationsField(ast.annotations)
4155
+ };
4156
+ case "Objects": return {
4157
+ _tag: "Objects",
4158
+ propertySignatures: ast.propertySignatures.map((property) => {
4159
+ const projected = getLastEncoding(property.type);
4160
+ const annotations = projected.context?.annotations;
4161
+ return {
4162
+ name: property.name,
4163
+ type: recur(property.type),
4164
+ isOptional: isOptional(projected),
4165
+ isMutable: isMutable(projected),
4166
+ ...annotationsField(annotations)
4167
+ };
4168
+ }),
4169
+ indexSignatures: ast.indexSignatures.map((index) => ({
4170
+ parameter: recur(index.parameter),
4171
+ type: recur(index.type)
4172
+ })),
4173
+ checks,
4174
+ ...annotationsField(ast.annotations)
4175
+ };
4176
+ case "Union": return {
4177
+ _tag: "Union",
4178
+ types: ast.types.map((ast) => recur(ast)),
4179
+ ...ast.options === void 0 ? {} : { options: ast.options },
4180
+ checks,
4181
+ ...annotationsField(ast.annotations)
4182
+ };
4183
+ case "Suspend": return {
4184
+ _tag: "Suspend",
4185
+ checks: [],
4186
+ thunk: recur(ast.thunk()),
4187
+ ...annotationsField(ast.annotations)
4188
+ };
4189
+ }
3873
4190
  }
3874
- return record;
3875
- };
3876
- const toSetCookieHeaders = (self) => Object.values(self.cookies).map(serializeCookie);
3877
- const tryDecodeURIComponent = (str) => {
3878
- try {
3879
- return decodeURIComponent(str);
3880
- } catch (_) {
3881
- return str;
4191
+ function fromChecks(checks) {
4192
+ return checks?.map(fromCheck) ?? [];
3882
4193
  }
3883
- };
3884
- //#endregion
3885
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/http/UrlParams.js
3886
- const TypeId$1 = "~effect/http/UrlParams";
3887
- const isUrlParams = (u) => hasProperty(u, TypeId$1);
3888
- const Proto = {
3889
- ...PipeInspectableProto,
3890
- [TypeId$1]: TypeId$1,
3891
- [Symbol.iterator]() {
3892
- return this.params[Symbol.iterator]();
3893
- },
3894
- toJSON() {
4194
+ function fromCheck(check) {
4195
+ switch (check._tag) {
4196
+ case "Filter": return {
4197
+ _tag: "Filter",
4198
+ aborted: check.aborted,
4199
+ ...fromCheckAnnotations(check.annotations)
4200
+ };
4201
+ case "FilterGroup": return {
4202
+ _tag: "FilterGroup",
4203
+ checks: map$3(check.checks, fromCheck),
4204
+ ...fromCheckAnnotations(check.annotations)
4205
+ };
4206
+ }
4207
+ }
4208
+ function fromDeclarationAnnotations(annotations) {
4209
+ if (annotations === void 0) return void 0;
4210
+ const { representation, ...ordinary } = annotations;
3895
4211
  return {
3896
- _id: "UrlParams",
3897
- params: Object.fromEntries(this.params)
4212
+ ...representation === void 0 ? void 0 : { representation },
4213
+ ...Object.keys(ordinary).length === 0 ? void 0 : { annotations: ordinary }
3898
4214
  };
3899
- },
3900
- [symbol$1](that) {
3901
- return Equivalence(this, that);
3902
- },
3903
- [symbol]() {
3904
- return array(this.params.flat());
3905
4215
  }
3906
- };
3907
- const make$1 = (params) => {
3908
- const self = Object.create(Proto);
3909
- self.params = params;
3910
- return self;
3911
- };
3912
- const fromInput = (input) => {
3913
- if (isUrlParams(input)) return input;
3914
- const parsed = fromInputNested(input);
3915
- const out = [];
3916
- for (let i = 0; i < parsed.length; i++) if (Array.isArray(parsed[i][0])) {
3917
- const [keys, value] = parsed[i];
3918
- out.push([`${keys[0]}[${keys.slice(1).join("][")}]`, value]);
3919
- } else out.push(parsed[i]);
3920
- return make$1(out);
3921
- };
3922
- const fromInputNested = (input) => {
3923
- const entries = typeof input[Symbol.iterator] === "function" ? fromIterable$1(input) : Object.entries(input);
3924
- const out = [];
3925
- for (const [key, value] of entries) if (Array.isArray(value)) {
3926
- for (let i = 0; i < value.length; i++) if (value[i] !== void 0) out.push([key, String(value[i])]);
3927
- } else if (value !== null && typeof value === "object") {
3928
- const nested = fromInputNested(value);
3929
- for (const [k, v] of nested) out.push([[key, ...typeof k === "string" ? [k] : k], v]);
3930
- } else if (value !== void 0) out.push([key, String(value)]);
3931
- return out;
3932
- };
3933
- const Equivalence = make$9((a, b) => arrayEquivalence(a.params, b.params));
3934
- const arrayEquivalence = makeEquivalence$3(makeEquivalence$2([strictEqual(), strictEqual()]));
3935
- const empty = make$1([]);
3936
- const setAll = dual(2, (self, input) => {
3937
- const params = fromInput(input).params.slice();
3938
- const keys = new Set();
3939
- for (let i = 0; i < params.length; i++) keys.add(params[i][0]);
3940
- for (let i = 0; i < self.params.length; i++) {
3941
- if (keys.has(self.params[i][0])) continue;
3942
- params.push(self.params[i]);
4216
+ function fromCheckAnnotations(annotations) {
4217
+ if (annotations === void 0) return void 0;
4218
+ const { representation, ...ordinary } = annotations;
4219
+ const projected = representation === void 0 ? void 0 : representation.schemas === void 0 ? representation : {
4220
+ ...representation,
4221
+ schemas: representation.schemas.map((schema) => recur(toType$1(schema)))
4222
+ };
4223
+ return {
4224
+ ...projected === void 0 ? void 0 : { representation: projected },
4225
+ ...Object.keys(ordinary).length === 0 ? void 0 : { annotations: ordinary }
4226
+ };
3943
4227
  }
3944
- return make$1(params);
4228
+ }
4229
+ //#endregion
4230
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/Struct.js
4231
+ const omit = dual(2, (self, keys) => {
4232
+ return buildStruct(self, (k, v) => !hasPropertyKey(keys, k) ? [k, v] : void 0);
3945
4233
  });
3946
- const toString = (input) => new URLSearchParams(fromInput(input).params).toString();
3947
- const toRecord = (self) => {
4234
+ const evolve = dual(2, (self, e) => {
4235
+ return buildStruct(self, (k, v) => [k, Object.hasOwn(e, k) ? e[k](v) : v]);
4236
+ });
4237
+ const lambda = (f) => f;
4238
+ function hasPropertyKey(keys, key) {
4239
+ return keys.some((candidate) => candidate === key || typeof candidate === "number" && String(candidate) === key);
4240
+ }
4241
+ function buildStruct(source, f) {
3948
4242
  const out = {};
3949
- for (const [k, value] of self.params) if (!Object.hasOwn(out, k)) assignProperty$1(out, k, value);
3950
- else {
3951
- const current = out[k];
3952
- if (typeof current === "string") assignProperty$1(out, k, [current, value]);
3953
- else current.push(value);
4243
+ for (const k of Reflect.ownKeys(source)) {
4244
+ if (!Object.prototype.propertyIsEnumerable.call(source, k)) continue;
4245
+ const res = f(k, source[k]);
4246
+ if (res) {
4247
+ const [nk, nv] = res;
4248
+ assignProperty$1(out, nk, nv);
4249
+ }
3954
4250
  }
3955
4251
  return out;
3956
- };
3957
- const toReadonlyRecord = toRecord;
4252
+ }
4253
+ //#endregion
4254
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/internal/schemaError.js
4255
+ const SchemaErrorTypeId = "~effect/Schema/SchemaError";
4256
+ function isSchemaError$1(u) {
4257
+ return hasProperty(u, "~effect/Schema/SchemaError") && u["~effect/Schema/SchemaError"] === "~effect/Schema/SchemaError";
4258
+ }
3958
4259
  //#endregion
3959
- //#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Schema.js
3960
- const TypeId = TypeId$3;
4260
+ //#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect+effect@24fa0ab_8fb3e3e1ff7f03df0873bfda51410aa1/node_modules/effect/dist/Schema.js
4261
+ const TypeId = TypeId$1;
3961
4262
  function declareConstructor() {
3962
4263
  return (typeParameters, run, annotations) => {
3963
4264
  return make(new Declaration(typeParameters.map(getAST), (typeParameters) => run(typeParameters.map((ast) => make(ast))), annotations));
3964
4265
  };
3965
4266
  }
3966
4267
  function declare(is, annotations) {
3967
- return declareConstructor()([], () => (input, ast, options) => is(input) ? succeed$2(input) : fail$1(new InvalidType(ast, input, options)), annotations);
4268
+ return declareConstructor()([], () => (input, ast, options) => is(input) ? succeed$3(input) : fail$2(new InvalidType(ast, input, options)), annotations);
3968
4269
  }
3969
4270
  var SchemaError = class extends TaggedError$1("SchemaError") {
3970
4271
  [SchemaErrorTypeId] = SchemaErrorTypeId;
@@ -3989,10 +4290,10 @@ function isSchemaError(u) {
3989
4290
  }
3990
4291
  function fromIssueEffect(self) {
3991
4292
  if (effectIsExit(self)) return fromIssueExit(self);
3992
- return catchCause(self, (cause) => failCauseSync(() => map$4(cause, (issue) => new SchemaError(issue))));
4293
+ return catchCause(self, (cause) => failCauseSync(() => map$5(cause, (issue) => new SchemaError(issue))));
3993
4294
  }
3994
4295
  function fromIssueExit(exit) {
3995
- return isSuccess(exit) ? exit : failCause(map$4(exit.cause, (issue) => new SchemaError(issue)));
4296
+ return isSuccess(exit) ? exit : failCause(map$5(exit.cause, (issue) => new SchemaError(issue)));
3996
4297
  }
3997
4298
  function getSchemaErrorOrThrow(cause, message) {
3998
4299
  let schemaError;
@@ -4031,7 +4332,7 @@ function encodeUnknownEffect(schema, options) {
4031
4332
  };
4032
4333
  }
4033
4334
  const encodeEffect = encodeUnknownEffect;
4034
- const make = make$2;
4335
+ const make = make$1;
4035
4336
  function isSchema(u) {
4036
4337
  return hasProperty(u, TypeId) && u[TypeId] === TypeId;
4037
4338
  }
@@ -4144,7 +4445,7 @@ function brand(identifier) {
4144
4445
  }
4145
4446
  function decodeTo(to, transformation) {
4146
4447
  return (from) => {
4147
- return make(decodeTo$1(from.ast, to.ast, transformation ? make$4(transformation) : passthrough()), {
4448
+ return make(decodeTo$1(from.ast, to.ast, transformation ? makeTransformation(transformation) : passthrough()), {
4148
4449
  from,
4149
4450
  to
4150
4451
  });
@@ -4183,13 +4484,13 @@ function withConstructorDefault(defaultValue) {
4183
4484
  return (schema) => make(withConstructorDefault$1(schema.ast, defaultValue), { schema });
4184
4485
  }
4185
4486
  function toIssueEffect(self) {
4186
- return catchCause(self, (cause) => failCauseSync(() => map$4(cause, (error) => error.issue)));
4487
+ return catchCause(self, (cause) => failCauseSync(() => map$5(cause, (error) => error.issue)));
4187
4488
  }
4188
4489
  function withDecodingDefaultKey(defaultValue, options) {
4189
4490
  const encode = options?.encodingStrategy === "omit" ? omit$1() : passthrough$1();
4190
4491
  return (self) => {
4191
4492
  return optionalKey(toEncoded(self)).pipe(decodeTo(self, {
4192
- decode: withDefault(toIssueEffect(defaultValue)),
4493
+ decode: withDefault$1(toIssueEffect(defaultValue)),
4193
4494
  encode
4194
4495
  }));
4195
4496
  };
@@ -4198,13 +4499,13 @@ function withDecodingDefault(defaultValue, options) {
4198
4499
  const encode = options?.encodingStrategy === "omit" ? omit$1() : passthrough$1();
4199
4500
  return (self) => {
4200
4501
  return optional(toEncoded(self)).pipe(decodeTo(self, {
4201
- decode: withDefault(toIssueEffect(defaultValue)),
4502
+ decode: withDefault$1(toIssueEffect(defaultValue)),
4202
4503
  encode
4203
4504
  }));
4204
4505
  };
4205
4506
  }
4206
4507
  function tag(literal) {
4207
- return Literal(literal).pipe(withConstructorDefault(succeed$2(literal)));
4508
+ return Literal(literal).pipe(withConstructorDefault(succeed$3(literal)));
4208
4509
  }
4209
4510
  function TaggedStruct(value, fields) {
4210
4511
  return Struct({
@@ -4299,7 +4600,7 @@ function instanceOf(constructor, annotations) {
4299
4600
  }
4300
4601
  function link() {
4301
4602
  return (encodeTo, transformation) => {
4302
- return new Link(encodeTo.ast, make$4(transformation));
4603
+ return new Link(encodeTo.ast, makeTransformation(transformation));
4303
4604
  };
4304
4605
  }
4305
4606
  const makeFilter = makeFilter$1;
@@ -4768,7 +5069,7 @@ const RegExp = instanceOf(globalThis.RegExp, {
4768
5069
  try: () => new globalThis.RegExp(e.source, e.flags),
4769
5070
  catch: () => new InvalidValue({ expected: "valid RegExp source and flags" }, e, options)
4770
5071
  }),
4771
- encode: (regExp) => succeed$2({
5072
+ encode: (regExp) => succeed$3({
4772
5073
  source: regExp.source,
4773
5074
  flags: regExp.flags
4774
5075
  })
@@ -4824,11 +5125,11 @@ const File = instanceOf(globalThis.File, {
4824
5125
  name: String$1,
4825
5126
  lastModified: Int
4826
5127
  }), transformEffect({
4827
- decode: (e, options) => match$1(decodeBase64$1(e.data), {
4828
- onFailure: () => fail$1(new InvalidValue({ expected: "a valid Base64 string" }, e.data, options)),
5128
+ decode: (e, options) => match$1(decode(e.data), {
5129
+ onFailure: () => fail$2(new InvalidValue({ expected: "a valid Base64 string" }, e.data, options)),
4829
5130
  onSuccess: (bytes) => {
4830
5131
  const buffer = new globalThis.Uint8Array(bytes);
4831
- return succeed$2(new globalThis.File([buffer], e.name, {
5132
+ return succeed$3(new globalThis.File([buffer], e.name, {
4832
5133
  type: e.type,
4833
5134
  lastModified: e.lastModified
4834
5135
  }));
@@ -4838,7 +5139,7 @@ const File = instanceOf(globalThis.File, {
4838
5139
  try: async () => {
4839
5140
  const bytes = new globalThis.Uint8Array(await file.arrayBuffer());
4840
5141
  return {
4841
- data: encodeBase64$1(bytes),
5142
+ data: encode(bytes),
4842
5143
  type: file.type,
4843
5144
  name: file.name,
4844
5145
  lastModified: file.lastModified
@@ -4868,10 +5169,10 @@ const FormData$1 = instanceOf(globalThis.FormData, {
4868
5169
  decode: (e) => {
4869
5170
  const out = new globalThis.FormData();
4870
5171
  for (const [key, entry] of e) out.append(key, entry.value);
4871
- return succeed$2(out);
5172
+ return succeed$3(out);
4872
5173
  },
4873
5174
  encode: (formData) => {
4874
- return succeed$2(globalThis.Array.from(formData.entries()).map(([key, value]) => {
5175
+ return succeed$3(globalThis.Array.from(formData.entries()).map(([key, value]) => {
4875
5176
  if (typeof value === "string") return [key, {
4876
5177
  _tag: "String",
4877
5178
  value
@@ -4908,7 +5209,7 @@ const Base64String = String$1.annotate({
4908
5209
  format: "byte",
4909
5210
  contentEncoding: "base64"
4910
5211
  });
4911
- const Uint8Array = instanceOf(globalThis.Uint8Array, {
5212
+ const Uint8Array$1 = instanceOf(globalThis.Uint8Array, {
4912
5213
  representation: {
4913
5214
  id: "effect/schema/Uint8Array",
4914
5215
  payload: null
@@ -4920,7 +5221,7 @@ const Uint8Array = instanceOf(globalThis.Uint8Array, {
4920
5221
  expected: "Uint8Array",
4921
5222
  toCodecJson: () => link()(Base64String, uint8ArrayFromBase64String)
4922
5223
  });
4923
- const Uint8ArrayFromBase64 = Base64String.pipe(decodeTo(Uint8Array, uint8ArrayFromBase64String));
5224
+ const Uint8ArrayFromBase64 = Base64String.pipe(decodeTo(Uint8Array$1, uint8ArrayFromBase64String));
4924
5225
  const isGreaterThanBigDecimal = makeIsGreaterThan({
4925
5226
  order: Order,
4926
5227
  formatter: (bd) => format(bd)
@@ -4943,7 +5244,7 @@ const isBetweenBigDecimal = makeIsBetween({
4943
5244
  });
4944
5245
  function CauseReason(error, defect) {
4945
5246
  const schema = declareConstructor()([error, defect], ([error, defect]) => (input, ast, options) => {
4946
- if (!isReason(input)) return fail$1(new InvalidType(ast, input, options));
5247
+ if (!isReason(input)) return fail$2(new InvalidType(ast, input, options));
4947
5248
  switch (input._tag) {
4948
5249
  case "Fail": return mapBothEager(decodeUnknownEffect$1(error)(input.error, options), {
4949
5250
  onSuccess: makeFailReason,
@@ -4953,7 +5254,7 @@ function CauseReason(error, defect) {
4953
5254
  onSuccess: makeDieReason,
4954
5255
  onFailure: (issue) => makeCompositeAtKey(ast, "defect", issue, input, options)
4955
5256
  });
4956
- case "Interrupt": return succeed$2(input);
5257
+ case "Interrupt": return succeed$3(input);
4957
5258
  }
4958
5259
  }, {
4959
5260
  representation: {
@@ -4987,7 +5288,22 @@ function CauseReason(error, defect) {
4987
5288
  case "Interrupt": return makeInterruptReason(e.fiberId);
4988
5289
  }
4989
5290
  },
4990
- encode: identity
5291
+ encode: (reason) => {
5292
+ switch (reason._tag) {
5293
+ case "Fail": return {
5294
+ _tag: "Fail",
5295
+ error: reason.error
5296
+ };
5297
+ case "Die": return {
5298
+ _tag: "Die",
5299
+ defect: reason.defect
5300
+ };
5301
+ case "Interrupt": return {
5302
+ _tag: "Interrupt",
5303
+ fiberId: reason.fiberId
5304
+ };
5305
+ }
5306
+ }
4991
5307
  }))
4992
5308
  });
4993
5309
  return make(schema.ast, {
@@ -4999,7 +5315,7 @@ function Cause(error, defect) {
4999
5315
  const schema = declareConstructor()([error, defect], ([error, defect]) => {
5000
5316
  const failures = ArraySchema(CauseReason(error, defect));
5001
5317
  return (input, ast, options) => {
5002
- if (!isCause(input)) return fail$1(new InvalidType(ast, input, options));
5318
+ if (!isCause(input)) return fail$2(new InvalidType(ast, input, options));
5003
5319
  return mapBothEager(decodeUnknownEffect$1(failures)(input.reasons, options), {
5004
5320
  onSuccess: fromReasons,
5005
5321
  onFailure: (issue) => makeCompositeAtKey(ast, "failures", issue, input, options)
@@ -5028,20 +5344,20 @@ function Cause(error, defect) {
5028
5344
  }
5029
5345
  function dateTimeUtcFromInput() {
5030
5346
  return transformEffect$1((input, options) => {
5031
- return match(make$5(input), {
5032
- onNone: () => fail$1(new InvalidValue({ message: "Invalid DateTime input" }, input, options)),
5033
- onSome: (dt) => succeed$2(toUtc(dt))
5347
+ return match(make$4(input), {
5348
+ onNone: () => fail$2(new InvalidValue({ message: "Invalid DateTime input" }, input, options)),
5349
+ onSome: (dt) => succeed$3(toUtc(dt))
5034
5350
  });
5035
5351
  });
5036
5352
  }
5037
5353
  const dateTimeUtcFromString = transformEffect({
5038
5354
  decode: (s, options) => {
5039
- return match(make$5(s), {
5040
- onNone: () => fail$1(new InvalidValue({ expected: "a valid UTC DateTime string" }, s, options)),
5041
- onSome: (result) => succeed$2(toUtc(result))
5355
+ return match(make$4(s), {
5356
+ onNone: () => fail$2(new InvalidValue({ expected: "a valid UTC DateTime string" }, s, options)),
5357
+ onSome: (result) => succeed$3(toUtc(result))
5042
5358
  });
5043
5359
  },
5044
- encode: (utc) => succeed$2(formatIso(utc))
5360
+ encode: (utc) => succeed$3(formatIso(utc))
5045
5361
  });
5046
5362
  const arbitraryMinimumDateTimestamp = -864e13;
5047
5363
  const arbitraryMaximumDateTimestamp = 864e13;
@@ -5138,10 +5454,10 @@ function Exit(value, error, defect) {
5138
5454
  ], ([value, error, defect]) => {
5139
5455
  const cause = Cause(error, defect);
5140
5456
  return (input, ast, options) => {
5141
- if (!isExit(input)) return fail$1(new InvalidType(ast, input, options));
5457
+ if (!isExit(input)) return fail$2(new InvalidType(ast, input, options));
5142
5458
  switch (input._tag) {
5143
5459
  case "Success": return mapBothEager(decodeUnknownEffect$1(value)(input.value, options), {
5144
- onSuccess: succeed$1,
5460
+ onSuccess: succeed$2,
5145
5461
  onFailure: (issue) => makeCompositeAtKey(ast, "value", issue, input, options)
5146
5462
  });
5147
5463
  case "Failure": return mapBothEager(decodeUnknownEffect$1(cause)(input.cause, options), {
@@ -5168,7 +5484,7 @@ function Exit(value, error, defect) {
5168
5484
  _tag: Literal("Failure"),
5169
5485
  cause: Cause(error, defect)
5170
5486
  })]), transform({
5171
- decode: (e) => e._tag === "Success" ? succeed$1(e.value) : failCause(e.cause),
5487
+ decode: (e) => e._tag === "Success" ? succeed$2(e.value) : failCause(e.cause),
5172
5488
  encode: (exit) => isSuccess(exit) ? {
5173
5489
  _tag: "Success",
5174
5490
  value: exit.value
@@ -5193,7 +5509,7 @@ function Option(value) {
5193
5509
  onFailure: (issue) => makeCompositeAtKey(ast, "value", issue, input, options)
5194
5510
  });
5195
5511
  }
5196
- return fail$1(new InvalidType(ast, input, options));
5512
+ return fail$2(new InvalidType(ast, input, options));
5197
5513
  }, {
5198
5514
  representation: {
5199
5515
  id: "effect/schema/Option",
@@ -5229,7 +5545,7 @@ const Cookie = declare(isCookie, {
5229
5545
  toCode: () => ({
5230
5546
  runtime: "Schema.Cookie",
5231
5547
  Type: "Cookies.Cookie",
5232
- importDeclarations: [`import * as Cookies from "effect/unstable/http/Cookies"`]
5548
+ importDeclarations: [`import * as Cookies from "effect/http/Cookies"`]
5233
5549
  }),
5234
5550
  expected: "Cookie"
5235
5551
  });
@@ -5241,7 +5557,7 @@ const Cookies = declare(isCookies, {
5241
5557
  toCode: () => ({
5242
5558
  runtime: "Schema.Cookies",
5243
5559
  Type: "Cookies.Cookies",
5244
- importDeclarations: [`import * as Cookies from "effect/unstable/http/Cookies"`]
5560
+ importDeclarations: [`import * as Cookies from "effect/http/Cookies"`]
5245
5561
  }),
5246
5562
  expected: "Cookies",
5247
5563
  toCodecJson: () => link()(ArraySchema(String$1), transform({
@@ -5265,12 +5581,12 @@ const UrlParams = declare(isUrlParams, {
5265
5581
  toCode: () => ({
5266
5582
  runtime: "Schema.UrlParams",
5267
5583
  Type: "UrlParams.UrlParams",
5268
- importDeclarations: [`import * as UrlParams from "effect/unstable/http/UrlParams"`]
5584
+ importDeclarations: [`import * as UrlParams from "effect/http/UrlParams"`]
5269
5585
  }),
5270
5586
  expected: "UrlParams",
5271
5587
  toEquivalence: () => Equivalence,
5272
5588
  toCodec: () => link()(ArraySchema(Tuple([String$1, String$1])), transform({
5273
- decode: make$1,
5589
+ decode: make$3,
5274
5590
  encode: (self) => self.params
5275
5591
  }))
5276
5592
  });
@@ -5281,7 +5597,7 @@ const RecordFromUrlParams = UrlParams.pipe(decodeTo(Record(String$1, Union([Stri
5281
5597
  function OptionFromOptional(schema) {
5282
5598
  return optional(schema).pipe(decodeTo(Option(toType(schema)), optionFromOptional()));
5283
5599
  }
5284
- function Redacted(value$3, options) {
5600
+ function Redacted(value$4, options) {
5285
5601
  const label = typeof options?.label === "string" ? options.label : void 0;
5286
5602
  const disallowJsonEncode = options?.disallowJsonEncode === true;
5287
5603
  const normalizedOptions = label !== void 0 ? disallowJsonEncode ? {
@@ -5289,17 +5605,17 @@ function Redacted(value$3, options) {
5289
5605
  disallowJsonEncode: true
5290
5606
  } : { label } : disallowJsonEncode ? { disallowJsonEncode: true } : void 0;
5291
5607
  const decodeLabel = label !== void 0 ? decodeUnknownEffect$1(Literal(label)) : void 0;
5292
- const schema = declareConstructor()([value$3], ([value$2]) => (input, ast, poptions) => {
5608
+ const schema = declareConstructor()([value$4], ([value$3]) => (input, ast, poptions) => {
5293
5609
  if (isRedacted(input)) {
5294
5610
  const label = decodeLabel !== void 0 ? mapErrorEager(decodeLabel(input.label, poptions), (issue) => new Pointer(["label"], issue)) : void_$2;
5295
- return flatMapEager(label, () => mapBothEager(decodeUnknownEffect$1(value$2)(value(input), poptions), {
5296
- onSuccess: () => input,
5611
+ return flatMapEager(label, () => mapBothEager(decodeUnknownEffect$1(value$3)(value(input), poptions), {
5612
+ onSuccess: (value) => make$6(value, { label: input.label }),
5297
5613
  onFailure: () => {
5298
5614
  return new Composite(ast, [new Pointer(["value"], new InvalidValue(void 0, input, poptions))], input, poptions);
5299
5615
  }
5300
5616
  }));
5301
5617
  }
5302
- return fail$1(new InvalidType(ast, input, poptions));
5618
+ return fail$2(new InvalidType(ast, input, poptions));
5303
5619
  }, {
5304
5620
  representation: {
5305
5621
  id: "effect/schema/Redacted",
@@ -5311,13 +5627,13 @@ function Redacted(value$3, options) {
5311
5627
  importDeclarations: [`import * as Redacted from "effect/Redacted"`]
5312
5628
  }),
5313
5629
  expected: "Redacted",
5314
- toCodecJson: ([value$4]) => link()(value$4, {
5315
- decode: transform$1((e) => make$7(e, { label })),
5630
+ toCodecJson: ([value$5]) => link()(value$5, {
5631
+ decode: transform$1((e) => make$6(e, { label })),
5316
5632
  encode: disallowJsonEncode ? forbidden((oe) => "Cannot serialize Redacted" + (isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")) : transform$1(value)
5317
5633
  }),
5318
5634
  toEquivalence: ([value]) => makeEquivalence(value)
5319
5635
  });
5320
- return make(schema.ast, { value: value$3 });
5636
+ return make(schema.ast, { value: value$4 });
5321
5637
  }
5322
5638
  const immerable = globalThis.Symbol.for("immer-draftable");
5323
5639
  const payloadToken = {};
@@ -5354,7 +5670,7 @@ function makeClass(Inherited, identifier, struct$1, annotations, proto) {
5354
5670
  return getClassSchema(this).rebuild(ast);
5355
5671
  }
5356
5672
  static make(input, options) {
5357
- return make$3(getClassSchema(this))(input ?? {}, options);
5673
+ return make$2(getClassSchema(this))(input ?? {}, options);
5358
5674
  }
5359
5675
  static makeOption(input, options) {
5360
5676
  return makeOption(getClassSchema(this))(input ?? {}, options);
@@ -5406,7 +5722,7 @@ function getClassSchemaFactory(from, identifier, annotations) {
5406
5722
  const isClassValue = (input) => input instanceof self || hasProperty(input, ClassTypeId);
5407
5723
  const transformation = getClassTransformation(self);
5408
5724
  return memo = decodeTo(make(new Declaration([from.ast], () => (input, ast, options) => {
5409
- return isClassValue(input) ? succeed$2(input) : fail$1(new InvalidType(ast, input, options));
5725
+ return isClassValue(input) ? succeed$3(input) : fail$2(new InvalidType(ast, input, options));
5410
5726
  }, {
5411
5727
  identifier,
5412
5728
  [CONSTRUCTOR_ANNOTATION_KEY]: ([from]) => ({
@@ -5426,7 +5742,7 @@ function isStruct(schema) {
5426
5742
  }
5427
5743
  const Class = (identifier) => (schema, annotations) => {
5428
5744
  const struct = isStruct(schema) ? schema : Struct(schema);
5429
- return makeClass(Class$2, identifier, struct, annotations, (identifier) => ({ toString() {
5745
+ return makeClass(Class$1, identifier, struct, annotations, (identifier) => ({ toString() {
5430
5746
  return `${identifier}(${format$1({ ...this })})`;
5431
5747
  } }));
5432
5748
  };
@@ -5467,6 +5783,6 @@ const MutableJson = make(annotate(MutableJson$1, { toCode: () => ({
5467
5783
  Type: "Schema.MutableJson"
5468
5784
  }) }));
5469
5785
  //#endregion
5470
- export { declare as $, Filter as $t, OptionFromNullOr as A, InvalidValue as An, tag as At, TaggedUnion as B, stringOrRedacted as Bn, fromInput as Bt, Never as C, transform as Cn, isSchemaError as Ct, NullOr as D, passthrough$1 as Dn, mutable as Dt, Null as E, dateTimeUtcFromInput$1 as En, makeFilterGroup as Et, String$1 as F, now as Fn, toType as Ft, Uint8Array as G, evolve as Gt, Tuple as H, assignProperty as Hn, toString as Ht, Struct as I, removeTime as In, withConstructorDefault as It, Union as J, _is as Jt, Uint8ArrayFromBase64 as K, omit as Kt, StructWithRest as L, isRedacted as Ln, withDecodingDefault as Lt, Record as M, formatIso as Mn, toCodecStringTree as Mt, Redacted as N, formatIsoDate as Nn, toEncoded as Nt, Number$1 as O, transform$1 as On, optional as Ot, SchemaError as P, fromDateUnsafe as Pn, toJsonSchemaDocument as Pt, check as Q, Arrays as Qt, TaggedClass as R, make$7 as Rn, withDecodingDefaultKey as Rt, Natural as S, passthrough as Sn, isSchema as St, NonEmptyString as T, transformOptional as Tn, makeFilter as Tt, URL$1 as U, makeEquivalence$1 as Un, empty$1 as Ut, TrueLiterals as V, Clock as Vn, setAll as Vt, URLFromString as W, map as Wn, fromSetCookie as Wt, Void as X, decodeUnknownEffect$1 as Xt, Unknown as Y, decodeEffect$1 as Yt, brand as Z, encodeEffect$1 as Zt, Int as _, string as _n, isMaxLength as _t, BooleanLiterals as a, Union$1 as an, decodeUnknownSync as at, Literals as b, unknown as bn, isPattern as bt, DateTimeUtcFromDate as c, isNever as cn, encodeUnknownEffect as ct, Defect as d, null_ as dn, is as dt, FilterGroup as en, decodeEffect as et, Duration as f, optionalKey$1 as fn, isFinite as ft, Finite as g, resolveIdentifier as gn, isLessThanOrEqualTo as gt, FalseLiterals as h, resolveDescription as hn, isInt as ht, BooleanFromBit as i, Suspend as in, decodeUnknownOption as it, OptionFromOptional as j, Pointer as jn, toCodecJson as jt, Option as k, transformEffect$1 as kn, optionalKey as kt, DateTimeUtcFromMillis as l, isOptional as ln, fromJsonString as lt, Exit as m, resolveAt as mn, isGreaterThanOrEqualTo as mt, ArraySchema as n, Objects as nn, decodeTo as nt, Class as o, applyToSelfOrLastLinkEncoding as on, encodeEffect as ot, Error$1 as p, replaceChecks as pn, isGreaterThan as pt, UndefinedOr as q, getReferenceKey as qt, Boolean as r, PropertySignature as rn, decodeUnknownEffect as rt, DateTimeUtc as s, decodeTo$1 as sn, encodeTo as st, Any as t, Literal$1 as tn, decodeSync as tt, DateTimeUtcFromString as u, mapOrSame as un, instanceOf as ut, Json as v, toEncoded$1 as vn, isMaxProperties as vt, NonEmptyArray as w, transformEffect as wn, make as wt, MutableJson as x, Transformation as xn, isPropertyNames as xt, Literal as y, toType$1 as yn, isMinLength as yt, TaggedError as z, value as zn, empty as zt };
5786
+ export { declare as $, Union$1 as $t, OptionFromNullOr as A, toString as An, tag as At, TaggedUnion as B, isRedacted as Bn, omit as Bt, Never as C, transform$1 as Cn, isSchemaError as Ct, NullOr as D, empty as Dn, mutable as Dt, Null as E, Pointer as En, makeFilterGroup as Et, String$1 as F, formatIso as Fn, toType as Ft, Uint8Array$1 as G, EncodingError as Gn, encodeEffect$1 as Gt, Tuple as H, value as Hn, _is as Ht, Struct as I, formatIsoDate as In, withConstructorDefault as It, Union as J, TaggedError$1 as Jn, FilterGroup as Jt, Uint8ArrayFromBase64 as K, Error$2 as Kn, Arrays as Kt, StructWithRest as L, fromDateUnsafe as Ln, withDecodingDefault as Lt, Record as M, fromSetCookie as Mn, toCodecStringTree as Mt, Redacted as N, decode as Nn, toEncoded as Nt, Number$1 as O, fromInput as On, optional as Ot, SchemaError as P, encode as Pn, toJsonSchemaDocument as Pt, check as Q, map$1 as Qn, Suspend as Qt, TaggedClass as R, now as Rn, withDecodingDefaultKey as Rt, Natural as S, passthrough$1 as Sn, isSchema as St, NonEmptyString as T, InvalidValue as Tn, makeFilter as Tt, URL$1 as U, stringOrRedacted as Un, decodeEffect$1 as Ut, TrueLiterals as V, make$6 as Vn, getReferenceKey as Vt, URLFromString as W, Clock as Wn, decodeUnknownEffect$1 as Wt, Void as X, assignProperty as Xn, Objects as Xt, Unknown as Y, taggedEnum as Yn, Literal$1 as Yt, brand as Z, makeEquivalence$1 as Zn, PropertySignature as Zt, Int as _, transform as _n, isMaxLength as _t, BooleanLiterals as a, null_ as an, decodeUnknownSync as at, Literals as b, dateTimeUtcFromInput$1 as bn, isPattern as bt, DateTimeUtcFromDate as c, resolveAt as cn, encodeUnknownEffect as ct, Defect as d, string as dn, is as dt, applyToSelfOrLastLinkEncoding as en, decodeEffect as et, Duration as f, toEncoded$1 as fn, isFinite as ft, Finite as g, passthrough as gn, isLessThanOrEqualTo as gt, FalseLiterals as h, Transformation as hn, isInt as ht, BooleanFromBit as i, mapOrSame as in, decodeUnknownOption as it, OptionFromOptional as j, empty$1 as jn, toCodecJson as jt, Option as k, setAll as kn, optionalKey as kt, DateTimeUtcFromMillis as l, resolveDescription as ln, fromJsonString as lt, Exit as m, unknown as mn, isGreaterThanOrEqualTo as mt, ArraySchema as n, isNever as nn, decodeTo as nt, Class as o, optionalKey$1 as on, encodeEffect as ot, Error$1 as p, toType$1 as pn, isGreaterThan as pt, UndefinedOr as q, TaggedClass$1 as qn, Filter as qt, Boolean as r, isOptional as rn, decodeUnknownEffect as rt, DateTimeUtc as s, replaceChecks as sn, encodeTo as st, Any as t, decodeTo$1 as tn, decodeSync as tt, DateTimeUtcFromString as u, resolveIdentifier as un, instanceOf as ut, Json as v, transformEffect as vn, isMaxProperties as vt, NonEmptyArray as w, transformEffect$1 as wn, make as wt, MutableJson as x, map as xn, isPropertyNames as xt, Literal as y, transformOptional as yn, isMinLength as yt, TaggedError as z, removeTime as zn, evolve as zt };
5471
5787
 
5472
- //# sourceMappingURL=Schema-Bc06DxcV.mjs.map
5788
+ //# sourceMappingURL=Schema-DyJ738Wp.mjs.map