@fungi.computer/oyster 0.0.0-stage → 0.0.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 (242) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1082 -2
  3. package/dist/agents.d.ts +114 -0
  4. package/dist/agents.js +322 -0
  5. package/dist/app-builds.d.ts +151 -0
  6. package/dist/app-builds.js +355 -0
  7. package/dist/app-sandbox.d.ts +2 -0
  8. package/dist/app-sandbox.js +2 -0
  9. package/dist/app-sources.d.ts +46 -0
  10. package/dist/app-sources.js +335 -0
  11. package/dist/app-storage.d.ts +141 -0
  12. package/dist/app-storage.js +281 -0
  13. package/dist/apps/gate.d.ts +105 -0
  14. package/dist/apps/gate.js +273 -0
  15. package/dist/apps/index.d.ts +5 -0
  16. package/dist/apps/index.js +5 -0
  17. package/dist/apps/installation.d.ts +248 -0
  18. package/dist/apps/installation.js +307 -0
  19. package/dist/apps/operations.d.ts +8 -0
  20. package/dist/apps/operations.js +98 -0
  21. package/dist/apps/tools.d.ts +33 -0
  22. package/dist/apps/tools.js +17 -0
  23. package/dist/auth.d.ts +11 -0
  24. package/dist/auth.js +93 -0
  25. package/dist/backend-request.d.ts +3 -0
  26. package/dist/backend-request.js +53 -0
  27. package/dist/build/build-jobs.d.ts +128 -0
  28. package/dist/build/build-jobs.js +197 -0
  29. package/dist/build/build-step.d.ts +26 -0
  30. package/dist/build/build-step.js +20 -0
  31. package/dist/build/bundled-html.d.ts +7 -0
  32. package/dist/build/bundled-html.js +64 -0
  33. package/dist/build/definition-emission.d.ts +34 -0
  34. package/dist/build/definition-emission.js +201 -0
  35. package/dist/build/effect.d.ts +231 -0
  36. package/dist/build/effect.js +396 -0
  37. package/dist/build/git-environment.d.ts +6 -0
  38. package/dist/build/git-environment.js +48 -0
  39. package/dist/build/html-recipe.d.ts +20 -0
  40. package/dist/build/html-recipe.js +51 -0
  41. package/dist/build/local-build.d.ts +57 -0
  42. package/dist/build/local-build.js +1078 -0
  43. package/dist/build/r2-artifact-writer.d.ts +31 -0
  44. package/dist/build/r2-artifact-writer.js +179 -0
  45. package/dist/build/snapshot-package-store.d.ts +2 -0
  46. package/dist/build/snapshot-package-store.js +21 -0
  47. package/dist/build/snapshot-program-scripts.d.ts +6 -0
  48. package/dist/build/snapshot-program-scripts.js +2 -0
  49. package/dist/build/submission-contract.d.ts +384 -0
  50. package/dist/build/submission-contract.js +70 -0
  51. package/dist/build/workspace-build.d.ts +50 -0
  52. package/dist/build/workspace-build.js +156 -0
  53. package/dist/build-contract.d.ts +4 -0
  54. package/dist/build-contract.js +4 -0
  55. package/dist/build-jobs.d.ts +2 -0
  56. package/dist/build-jobs.js +2 -0
  57. package/dist/build.d.ts +11 -0
  58. package/dist/build.js +13 -0
  59. package/dist/capability-descriptor.d.ts +46 -0
  60. package/dist/capability-descriptor.js +51 -0
  61. package/dist/catalog-frame.d.ts +39 -0
  62. package/dist/catalog-frame.js +72 -0
  63. package/dist/cause-class.d.ts +19 -0
  64. package/dist/cause-class.js +54 -0
  65. package/dist/cloudflare.d.ts +123 -0
  66. package/dist/cloudflare.js +391 -0
  67. package/dist/computer-terminal.d.ts +38 -0
  68. package/dist/computer-terminal.js +410 -0
  69. package/dist/computer.d.ts +60 -0
  70. package/dist/computer.js +33 -0
  71. package/dist/event-recipients.d.ts +57 -0
  72. package/dist/event-recipients.js +144 -0
  73. package/dist/facet-invocation.d.ts +4 -0
  74. package/dist/facet-invocation.js +45 -0
  75. package/dist/files.d.ts +42 -0
  76. package/dist/files.js +123 -0
  77. package/dist/frame-binding-wire-script.d.ts +2 -0
  78. package/dist/frame-binding-wire-script.js +1 -0
  79. package/dist/frame-binding-wire.d.ts +28 -0
  80. package/dist/frame-binding-wire.js +54 -0
  81. package/dist/git-admission.d.ts +52 -0
  82. package/dist/git-admission.js +188 -0
  83. package/dist/git-auth.d.ts +11 -0
  84. package/dist/git-auth.js +27 -0
  85. package/dist/git-door.d.ts +35 -0
  86. package/dist/git-door.js +108 -0
  87. package/dist/git-journal.d.ts +31 -0
  88. package/dist/git-journal.js +188 -0
  89. package/dist/git.d.ts +31 -0
  90. package/dist/git.js +64 -0
  91. package/dist/guest-policy.d.ts +9 -0
  92. package/dist/guest-policy.js +13 -0
  93. package/dist/host.d.ts +244 -0
  94. package/dist/host.js +1043 -0
  95. package/dist/index.d.ts +166 -0
  96. package/dist/index.js +320 -0
  97. package/dist/installation-consent.d.ts +79 -0
  98. package/dist/installation-consent.js +82 -0
  99. package/dist/internal/background-origins.d.ts +3 -0
  100. package/dist/internal/background-origins.js +8 -0
  101. package/dist/internal/delivery.d.ts +12 -0
  102. package/dist/internal/delivery.js +167 -0
  103. package/dist/internal/host-gate.d.ts +14 -0
  104. package/dist/internal/host-gate.js +62 -0
  105. package/dist/internal/registry-installations.d.ts +6 -0
  106. package/dist/internal/registry-installations.js +12 -0
  107. package/dist/invocation.d.ts +251 -0
  108. package/dist/invocation.js +377 -0
  109. package/dist/keys.d.ts +48 -0
  110. package/dist/keys.js +52 -0
  111. package/dist/mcp-owner.d.ts +27 -0
  112. package/dist/mcp-owner.js +143 -0
  113. package/dist/mcp.d.ts +89 -0
  114. package/dist/mcp.js +429 -0
  115. package/dist/media.d.ts +23 -0
  116. package/dist/media.js +12 -0
  117. package/dist/pack.d.ts +76 -0
  118. package/dist/pack.js +134 -0
  119. package/dist/page/capabilities.d.ts +23 -0
  120. package/dist/page/capabilities.js +256 -0
  121. package/dist/page/computer-handles.d.ts +79 -0
  122. package/dist/page/computer-handles.js +44 -0
  123. package/dist/page/lifetime.d.ts +6 -0
  124. package/dist/page/lifetime.js +19 -0
  125. package/dist/page/mount.d.ts +163 -0
  126. package/dist/page/mount.js +390 -0
  127. package/dist/page/storage.d.ts +3 -0
  128. package/dist/page/storage.js +82 -0
  129. package/dist/page/terminal.d.ts +5 -0
  130. package/dist/page/terminal.js +7 -0
  131. package/dist/page-script.d.ts +14 -0
  132. package/dist/page-script.js +5 -0
  133. package/dist/r2-files.d.ts +3 -0
  134. package/dist/r2-files.js +79 -0
  135. package/dist/release.d.ts +72 -0
  136. package/dist/release.js +164 -0
  137. package/dist/root-data.d.ts +86 -0
  138. package/dist/root-data.js +69 -0
  139. package/dist/shell/app-directory.d.ts +537 -0
  140. package/dist/shell/app-directory.js +195 -0
  141. package/dist/shell/browser-actions.d.ts +7 -0
  142. package/dist/shell/browser-actions.js +56 -0
  143. package/dist/shell/command-host.d.ts +112 -0
  144. package/dist/shell/command-host.js +502 -0
  145. package/dist/shell/commands.d.ts +25 -0
  146. package/dist/shell/commands.js +78 -0
  147. package/dist/shell/index.d.ts +8 -0
  148. package/dist/shell/index.js +8 -0
  149. package/dist/shell/keys.d.ts +41 -0
  150. package/dist/shell/keys.js +134 -0
  151. package/dist/shell/shell-module.d.ts +31 -0
  152. package/dist/shell/shell-module.js +37 -0
  153. package/dist/shell/window-manager.d.ts +124 -0
  154. package/dist/shell/window-manager.js +711 -0
  155. package/dist/shell/workbench-contract.d.ts +68 -0
  156. package/dist/shell/workbench-contract.js +1 -0
  157. package/dist/shell/workbench-host-types.d.ts +96 -0
  158. package/dist/shell/workbench-host-types.js +1 -0
  159. package/dist/shell/workbench-host.d.ts +34 -0
  160. package/dist/shell/workbench-host.js +347 -0
  161. package/dist/shell/workbench-model.d.ts +192 -0
  162. package/dist/shell/workbench-model.js +53 -0
  163. package/dist/shell/workbench.d.ts +4 -0
  164. package/dist/shell/workbench.js +2 -0
  165. package/dist/source/fork.d.ts +27 -0
  166. package/dist/source/fork.js +46 -0
  167. package/dist/source/index.d.ts +11 -0
  168. package/dist/source/index.js +11 -0
  169. package/dist/source/seed-receipt.d.ts +53 -0
  170. package/dist/source/seed-receipt.js +18 -0
  171. package/dist/source/team-source.d.ts +32 -0
  172. package/dist/source/team-source.js +42 -0
  173. package/dist/source/template-repository.d.ts +2 -0
  174. package/dist/source/template-repository.js +8 -0
  175. package/dist/source/template-write.d.ts +69 -0
  176. package/dist/source/template-write.js +344 -0
  177. package/dist/storage-frame.d.ts +64 -0
  178. package/dist/storage-frame.js +28 -0
  179. package/dist/tenant.d.ts +81 -0
  180. package/dist/tenant.js +71 -0
  181. package/dist/testing/capabilities.d.ts +29 -0
  182. package/dist/testing/capabilities.js +130 -0
  183. package/dist/testing/catalog.d.ts +3 -0
  184. package/dist/testing/catalog.js +53 -0
  185. package/dist/testing/index.d.ts +10 -0
  186. package/dist/testing/index.js +10 -0
  187. package/dist/testing/installation.d.ts +11 -0
  188. package/dist/testing/installation.js +25 -0
  189. package/dist/testing/native-worker.d.ts +21 -0
  190. package/dist/testing/native-worker.js +106 -0
  191. package/dist/testing/worker.d.ts +18 -0
  192. package/dist/testing/worker.js +67 -0
  193. package/dist/testing/workers-runtime.d.ts +24 -0
  194. package/dist/testing/workers-runtime.js +33 -0
  195. package/dist/webhook-delivery.d.ts +14 -0
  196. package/dist/webhook-delivery.js +17 -0
  197. package/dist/workers-git.d.ts +285 -0
  198. package/dist/workers-git.js +1174 -0
  199. package/dist/workers.d.ts +352 -0
  200. package/dist/workers.js +866 -0
  201. package/docs/api/README.md +82 -0
  202. package/docs/api/agents.md +332 -0
  203. package/docs/api/app-storage.md +209 -0
  204. package/docs/api/apps.md +1375 -0
  205. package/docs/api/auth.md +63 -0
  206. package/docs/api/build-contract.md +507 -0
  207. package/docs/api/build.md +1476 -0
  208. package/docs/api/cloudflare.md +421 -0
  209. package/docs/api/computer.md +203 -0
  210. package/docs/api/files.md +117 -0
  211. package/docs/api/git.md +470 -0
  212. package/docs/api/host.md +1328 -0
  213. package/docs/api/index.md +430 -0
  214. package/docs/api/invocation.md +738 -0
  215. package/docs/api/keys.md +175 -0
  216. package/docs/api/mcp.md +301 -0
  217. package/docs/api/media.md +40 -0
  218. package/docs/api/modules.md +42 -0
  219. package/docs/api/pack.md +138 -0
  220. package/docs/api/page/mount.md +298 -0
  221. package/docs/api/root-data.md +111 -0
  222. package/docs/api/shell/app-directory.md +332 -0
  223. package/docs/api/shell/command-host.md +224 -0
  224. package/docs/api/shell/commands.md +197 -0
  225. package/docs/api/shell/keys.md +183 -0
  226. package/docs/api/shell/shell-module.md +143 -0
  227. package/docs/api/shell/window-manager.md +267 -0
  228. package/docs/api/shell/workbench.md +186 -0
  229. package/docs/api/shell.md +1788 -0
  230. package/docs/api/tenant.md +194 -0
  231. package/docs/api/workers-git.md +1527 -0
  232. package/docs/api/workers.md +1678 -0
  233. package/docs/media/architecture.mmd +32 -0
  234. package/docs/media/architecture.png +0 -0
  235. package/docs/media/bonsai-network.png +0 -0
  236. package/docs/media/bonsai-repository.png +0 -0
  237. package/docs/site/agent-quickstart.mdx +349 -0
  238. package/examples/git/worker.ts +39 -0
  239. package/examples/git/wrangler.jsonc +32 -0
  240. package/examples/standalone/worker.ts +14 -0
  241. package/examples/standalone/wrangler.jsonc +21 -0
  242. package/package.json +249 -3
@@ -0,0 +1,2 @@
1
+ export const dependencyBuildProgram = "// src/build/snapshot-programs/dependency-build.ts\nimport fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, relative as relative2, resolve as resolve4, sep as sep2 } from \"node:path\";\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Pipeable.js\nvar pipeArguments = (self, args2) => {\n switch (args2.length) {\n case 0:\n return self;\n case 1:\n return args2[0](self);\n case 2:\n return args2[1](args2[0](self));\n case 3:\n return args2[2](args2[1](args2[0](self)));\n case 4:\n return args2[3](args2[2](args2[1](args2[0](self))));\n case 5:\n return args2[4](args2[3](args2[2](args2[1](args2[0](self)))));\n case 6:\n return args2[5](args2[4](args2[3](args2[2](args2[1](args2[0](self))))));\n case 7:\n return args2[6](args2[5](args2[4](args2[3](args2[2](args2[1](args2[0](self)))))));\n case 8:\n return args2[7](args2[6](args2[5](args2[4](args2[3](args2[2](args2[1](args2[0](self))))))));\n case 9:\n return args2[8](args2[7](args2[6](args2[5](args2[4](args2[3](args2[2](args2[1](args2[0](self)))))))));\n default: {\n let ret = self;\n for (let i = 0, len = args2.length; i < len; i++) {\n ret = args2[i](ret);\n }\n return ret;\n }\n }\n};\nvar Prototype = {\n pipe() {\n return pipeArguments(this, arguments);\n }\n};\nvar Class = /* @__PURE__ */ (function() {\n function PipeableBase() {\n }\n PipeableBase.prototype = Prototype;\n return PipeableBase;\n})();\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Function.js\nvar dual = function(arity, body) {\n if (typeof arity === \"function\") {\n return function() {\n return arity(arguments) ? body.apply(this, arguments) : (self) => body(self, ...arguments);\n };\n }\n switch (arity) {\n case 0:\n case 1:\n throw new RangeError(`Invalid arity ${arity}`);\n case 2:\n return function(a, b) {\n if (arguments.length >= 2) {\n return body(a, b);\n }\n return function(self) {\n return body(self, a);\n };\n };\n case 3:\n return function(a, b, c) {\n if (arguments.length >= 3) {\n return body(a, b, c);\n }\n return function(self) {\n return body(self, a, b);\n };\n };\n default:\n return function() {\n if (arguments.length >= arity) {\n return body.apply(this, arguments);\n }\n const args2 = arguments;\n return function(self) {\n return body(self, ...args2);\n };\n };\n }\n};\nvar identity = (a) => a;\nvar constant = (value) => () => value;\nvar constTrue = /* @__PURE__ */ constant(true);\nvar constUndefined = /* @__PURE__ */ constant(void 0);\nvar constVoid = constUndefined;\nfunction memoize(f) {\n const cache2 = /* @__PURE__ */ new WeakMap();\n return (a) => {\n const cached2 = cache2.get(a);\n if (cached2 !== void 0) return cached2;\n const result2 = f(a);\n cache2.set(a, result2);\n return result2;\n };\n}\nfunction memoizeIdempotent(f) {\n const cache2 = /* @__PURE__ */ new WeakMap();\n return (a) => {\n const cached2 = cache2.get(a);\n if (cached2 !== void 0) return cached2;\n const result2 = f(a);\n cache2.set(a, result2);\n if (result2 !== a) {\n cache2.set(result2, result2);\n }\n return result2;\n };\n}\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/equal.js\nvar getAllObjectKeys = (obj) => {\n const keys = new Set(Reflect.ownKeys(obj));\n if (obj.constructor === Object) return keys;\n if (obj instanceof Error) {\n keys.delete(\"stack\");\n }\n const proto = Object.getPrototypeOf(obj);\n let current = proto;\n while (current !== null && current !== Object.prototype) {\n const ownKeys = Reflect.ownKeys(current);\n for (let i = 0; i < ownKeys.length; i++) {\n keys.add(ownKeys[i]);\n }\n current = Object.getPrototypeOf(current);\n }\n if (keys.has(\"constructor\") && typeof obj.constructor === \"function\" && proto === obj.constructor.prototype) {\n keys.delete(\"constructor\");\n }\n return keys;\n};\nvar byReferenceInstances = /* @__PURE__ */ new WeakSet();\nvar viewBytes = (view) => new Uint8Array(view.buffer, view.byteOffset, view.byteLength);\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/hash.js\nvar backEdges = 0;\nvar addBackEdge = () => {\n backEdges++;\n};\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Predicate.js\nfunction isString(input) {\n return typeof input === \"string\";\n}\nfunction isNumber(input) {\n return typeof input === \"number\";\n}\nfunction isFunction(input) {\n return typeof input === \"function\";\n}\nfunction isNotNullish(input) {\n return input != null;\n}\nfunction isUnknown(_) {\n return true;\n}\nfunction isObject(input) {\n return typeof input === \"object\" && input !== null && !Array.isArray(input);\n}\nfunction isObjectKeyword(input) {\n return typeof input === \"object\" && input !== null || isFunction(input);\n}\nvar hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObjectKeyword(self) && property in self);\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Hash.js\nvar symbol = \"~effect/Hash\";\nvar hash = (self) => {\n switch (typeof self) {\n case \"number\":\n return number(self);\n case \"bigint\":\n return string(self.toString(10));\n case \"string\":\n return string(self);\n case \"function\":\n case \"object\": {\n if (self === null) {\n break;\n } else if (self instanceof Date) {\n if (Number.isNaN(self.getTime())) {\n return string(\"Invalid Date\");\n }\n return string(self.toISOString());\n } else if (self instanceof RegExp) {\n return string(self.toString());\n } else {\n if (byReferenceInstances.has(self)) {\n return random(self);\n }\n const cached2 = hashCache.get(self);\n if (cached2 !== void 0) {\n return cached2;\n }\n if (visitedObjects.has(self)) {\n addBackEdge();\n return string(\"[Circular]\");\n }\n visitedObjects.add(self);\n const seen = backEdges;\n let h;\n try {\n if (symbol in self) {\n h = self[symbol]();\n } else if (typeof self === \"function\") {\n h = random(self);\n } else if (self instanceof DataView) {\n h = array(viewBytes(self));\n } else if (Array.isArray(self) || ArrayBuffer.isView(self)) {\n h = array(self);\n } else if (self instanceof Map) {\n h = hashMap(self);\n } else if (self instanceof Set) {\n h = hashSet(self);\n } else {\n h = structure(self);\n }\n } finally {\n visitedObjects.delete(self);\n }\n if (seen === backEdges) {\n hashCache.set(self, h);\n }\n return h;\n }\n }\n }\n return optimize(mix(string(String(self))));\n};\nvar random = (self) => {\n if (!randomHashCache.has(self)) {\n randomHashCache.set(self, optimize(Math.random() * 4294967296 | 0));\n }\n return randomHashCache.get(self);\n};\nvar mix = (h) => {\n h ^= h >>> 16;\n h = Math.imul(h, 2246822507);\n h ^= h >>> 13;\n h = Math.imul(h, 3266489909);\n return h ^ h >>> 16;\n};\nvar combine = /* @__PURE__ */ dual(2, (self, b) => mix(Math.imul(self, 2654435761) + Math.imul(b, 2246822507)));\nvar optimize = (n) => n & 3221225471 | n >>> 1 & 1073741824;\nvar float64 = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));\nvar number = (n) => {\n const h = n | 0;\n if (h === n) {\n return optimize(h);\n }\n float64.setFloat64(0, n !== n ? NaN : n);\n return optimize(combine(float64.getInt32(0), float64.getInt32(4)));\n};\nvar string = (str) => {\n let h = 5381, i = str.length;\n while (i) {\n h = h * 33 ^ str.charCodeAt(--i);\n }\n return optimize(h);\n};\nvar structureKeys = (o, keys) => {\n let h = 12289;\n for (const key of keys) {\n h ^= combine(hash(key), hash(o[key]));\n }\n return optimize(h);\n};\nvar structure = (o) => structureKeys(o, getAllObjectKeys(o));\nvar unordered = (seed, f) => (iter) => {\n let h = seed;\n for (const element of iter) {\n h ^= f(element);\n }\n return optimize(h);\n};\nvar array = (arr) => {\n let h = 6151;\n for (const element of arr) {\n h = combine(h, hash(element));\n }\n return optimize(h);\n};\nvar hashMap = /* @__PURE__ */ unordered(/* @__PURE__ */ string(\"Map\"), ([k, v]) => combine(hash(k), hash(v)));\nvar setSeed = /* @__PURE__ */ string(\"Set\");\nvar hashSet = /* @__PURE__ */ unordered(setSeed, (element) => combine(setSeed, hash(element)));\nvar randomHashCache = /* @__PURE__ */ new WeakMap();\nvar hashCache = /* @__PURE__ */ new WeakMap();\nvar visitedObjects = /* @__PURE__ */ new WeakSet();\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Equal.js\nvar symbol2 = \"~effect/Equal\";\nfunction equals() {\n if (arguments.length === 1) {\n return (self) => compareBoth(self, arguments[0]);\n }\n return compareBoth(arguments[0], arguments[1]);\n}\nfunction compareBoth(self, that) {\n if (self === that) return true;\n if (self == null || that == null) return false;\n const selfType = typeof self;\n if (selfType !== typeof that) {\n return false;\n }\n if (selfType === \"number\" && self !== self && that !== that) {\n return true;\n }\n if (selfType !== \"object\" && selfType !== \"function\") {\n return false;\n }\n if (byReferenceInstances.has(self) || byReferenceInstances.has(that)) {\n return false;\n }\n return compareObjects(self, that);\n}\nfunction compareObjects(self, that) {\n const depth = pathLeft.length;\n for (let i = depth; i-- > 0; ) {\n if (pathLeft[i] === self && pathRight[i] === that) return true;\n }\n if (depth) return compareOnPath(self, that);\n let known = results.get(self);\n if (!known) results.set(self, known = /* @__PURE__ */ new WeakMap());\n let result2 = known.get(that);\n if (result2 === void 0) known.set(that, result2 = compareOnPath(self, that));\n return result2;\n}\nfunction compareOnPath(self, that) {\n pathLeft.push(self);\n pathRight.push(that);\n try {\n return compareStructure(self, that);\n } finally {\n pathLeft.pop();\n pathRight.pop();\n }\n}\nvar pathLeft = [];\nvar pathRight = [];\nvar results = /* @__PURE__ */ new WeakMap();\nfunction compareStructure(self, that) {\n if (hash(self) !== hash(that)) {\n return false;\n } else if (self instanceof Date) {\n if (!(that instanceof Date)) return false;\n const selfTime = self.getTime();\n const thatTime = that.getTime();\n return selfTime === thatTime || Number.isNaN(selfTime) && Number.isNaN(thatTime);\n } else if (self instanceof RegExp) {\n return that instanceof RegExp && self.toString() === that.toString();\n }\n const bothEquals = isEqual(self);\n if (bothEquals !== isEqual(that) || typeof self === \"function\" && !bothEquals) {\n return false;\n } else if (bothEquals) {\n return self[symbol2](that);\n } else if (Array.isArray(self)) {\n if (!Array.isArray(that) || self.length !== that.length) {\n return false;\n }\n return compareArrays(self, that);\n } else if (ArrayBuffer.isView(self)) {\n const selfIsDataView = self instanceof DataView;\n if (!ArrayBuffer.isView(that) || self.byteLength !== that.byteLength || selfIsDataView !== that instanceof DataView) {\n return false;\n }\n if (selfIsDataView) {\n return compareTypedArrays(viewBytes(self), viewBytes(that));\n }\n return compareTypedArrays(self, that);\n } else if (self instanceof Map) {\n if (!(that instanceof Map) || self.size !== that.size) {\n return false;\n }\n return compareHashed(self, that, entryHash, equalEntries);\n } else if (self instanceof Set) {\n if (!(that instanceof Set) || self.size !== that.size) {\n return false;\n }\n return compareHashed(self, that, hash, compareBoth);\n }\n return compareRecords(self, that);\n}\nfunction compareArrays(self, that) {\n for (let i = 0; i < self.length; i++) {\n if (!compareBoth(self[i], that[i])) {\n return false;\n }\n }\n return true;\n}\nfunction compareTypedArrays(self, that) {\n if (self.length !== that.length) {\n return false;\n }\n for (let i = 0; i < self.length; i++) {\n if (self[i] !== that[i]) {\n return false;\n }\n }\n return true;\n}\nfunction compareRecords(self, that) {\n const selfKeys = getAllObjectKeys(self);\n const thatKeys = getAllObjectKeys(that);\n if (selfKeys.size !== thatKeys.size) {\n return false;\n }\n for (const key of selfKeys) {\n if (!thatKeys.has(key) || !compareBoth(self[key], that[key])) {\n return false;\n }\n }\n return true;\n}\nfunction compareHashed(self, that, hashOf, equivalent) {\n const groups = /* @__PURE__ */ new Map();\n let remaining = 0;\n for (const item of that) {\n const h = hashOf(item);\n const group = groups.get(h);\n if (group) group.push(item);\n else groups.set(h, [item]);\n remaining++;\n }\n outer: for (const item of self) {\n const group = groups.get(hashOf(item));\n if (group) {\n for (let i = 0; i < group.length; i++) {\n if (equivalent(item, group[i])) {\n group[i] = group[group.length - 1];\n group.pop();\n remaining--;\n continue outer;\n }\n }\n }\n return false;\n }\n return remaining === 0;\n}\nvar entryHash = (entry) => hash(entry[0]);\nvar equalEntries = (self, that) => compareBoth(self[0], that[0]) && compareBoth(self[1], that[1]);\nvar isEqual = (u) => hasProperty(u, symbol2);\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/array.js\nvar isArrayNonEmpty = (self) => self.length > 0;\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/record.js\nfunction assignProperty(self, key, value) {\n if (key === \"__proto__\") {\n Object.defineProperty(self, key, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n } else {\n ;\n self[key] = value;\n }\n}\nfunction assignProperties(self, source) {\n for (const key of Reflect.ownKeys(source)) {\n if (Object.prototype.propertyIsEnumerable.call(source, key)) {\n assignProperty(self, key, source[key]);\n }\n }\n}\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Redactable.js\nvar symbolRedactable = /* @__PURE__ */ Symbol.for(\"~effect/Redactable\");\nvar isRedactable = (u) => hasProperty(u, symbolRedactable);\nfunction redact(u) {\n if (isRedactable(u)) return getRedacted(u);\n return u;\n}\nfunction getRedacted(redactable) {\n return redactable[symbolRedactable](globalThis[currentFiberTypeId]?.context ?? emptyContext);\n}\nvar currentFiberTypeId = \"~effect/Fiber/currentFiber\";\nvar emptyMap = /* @__PURE__ */ new Map();\nvar emptyContext = {\n \"~effect/Context\": {},\n base: emptyMap,\n depth: 0,\n mapUnsafe: emptyMap,\n pipe() {\n return pipeArguments(this, arguments);\n }\n};\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Formatter.js\nfunction format(input, options) {\n const space = options?.space ?? 0;\n const ancestors = /* @__PURE__ */ new WeakSet();\n const gap = !space ? \"\" : typeof space === \"number\" ? \" \".repeat(space) : space;\n const ind = (d) => gap.repeat(d);\n const wrap = (v, body) => {\n const ctor = v?.constructor;\n return ctor && ctor !== Object.prototype.constructor && ctor.name ? `${ctor.name}(${body})` : body;\n };\n const ownKeys = (o) => {\n try {\n return Reflect.ownKeys(o);\n } catch {\n return [\"[ownKeys threw]\"];\n }\n };\n function recur(v, d = 0) {\n try {\n return recurUnsafe(v, d);\n } catch {\n if (typeof v === \"object\" && v !== null || typeof v === \"function\") ancestors.delete(v);\n return \"[inspection threw]\";\n }\n }\n function recurUnsafe(v, d = 0) {\n if (typeof v === \"string\") return JSON.stringify(v);\n if (typeof v === \"number\" || v == null || typeof v === \"boolean\" || typeof v === \"symbol\") return String(v);\n if (typeof v === \"bigint\") return String(v) + \"n\";\n if (typeof v === \"object\" || typeof v === \"function\") {\n if (ancestors.has(v)) return CIRCULAR;\n ancestors.add(v);\n let output;\n if (symbolRedactable in v) {\n output = recur(getRedacted(v), d);\n } else if (Array.isArray(v)) {\n output = !gap || v.length <= 1 ? `[${v.map((x) => recur(x, d)).join(\",\")}]` : `[\n${ind(d + 1)}${v.map((x) => recur(x, d + 1)).join(\",\\n\" + ind(d + 1))}\n${ind(d)}]`;\n } else if (v instanceof Date) {\n output = formatDate(v);\n } else if (!options?.ignoreToString && hasProperty(v, \"toString\") && typeof v[\"toString\"] === \"function\" && v[\"toString\"] !== Object.prototype.toString && v[\"toString\"] !== Array.prototype.toString) {\n const s = safeToString(v);\n output = v instanceof Error && v.cause !== void 0 ? `${s} (cause: ${recur(v.cause, d)})` : s;\n } else if (Symbol.iterator in v) {\n output = `${v.constructor.name}(${recur(Array.from(v), d)})`;\n } else {\n const keys = ownKeys(v);\n if (!gap || keys.length <= 1) {\n const body = `{${keys.map((k) => `${formatPropertyKey(k)}:${recur(safeGet(v, k), d)}`).join(\",\")}}`;\n output = wrap(v, body);\n } else {\n const body = `{\n${keys.map((k) => `${ind(d + 1)}${formatPropertyKey(k)}: ${recur(safeGet(v, k), d + 1)}`).join(\",\\n\")}\n${ind(d)}}`;\n output = wrap(v, body);\n }\n }\n ancestors.delete(v);\n return output;\n }\n return String(v);\n }\n return recur(input, 0);\n}\nvar CIRCULAR = \"[Circular]\";\nfunction formatPropertyKey(name) {\n return typeof name === \"string\" ? JSON.stringify(name) : String(name);\n}\nfunction formatPath(path) {\n return path.map((key) => `[${formatPropertyKey(key)}]`).join(\"\");\n}\nfunction formatDate(date) {\n try {\n return date.toISOString();\n } catch {\n return \"Invalid Date\";\n }\n}\nfunction safeToString(input) {\n try {\n const s = input.toString();\n return typeof s === \"string\" ? s : String(s);\n } catch {\n return \"[toString threw]\";\n }\n}\nfunction safeGet(input, key) {\n try {\n return input[key];\n } catch {\n return \"[property access threw]\";\n }\n}\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Inspectable.js\nvar NodeInspectSymbol = /* @__PURE__ */ Symbol.for(\"nodejs.util.inspect.custom\");\nvar toJson = (input) => {\n try {\n input = redact(input);\n if (hasProperty(input, \"toJSON\") && isFunction(input[\"toJSON\"]) && input[\"toJSON\"].length === 0) {\n return input.toJSON();\n } else if (Array.isArray(input)) {\n return input.map(toJson);\n }\n return input;\n } catch {\n return \"[toJSON threw]\";\n }\n};\nvar BaseProto = {\n toJSON() {\n return toJson(this);\n },\n [NodeInspectSymbol]() {\n return this.toJSON();\n },\n toString() {\n return format(this.toJSON());\n }\n};\nvar Class2 = class {\n /**\n * Node.js custom inspection method.\n *\n * **When to use**\n *\n * Use to expose the class JSON representation to Node.js inspection.\n *\n * @since 2.0.0\n */\n [NodeInspectSymbol]() {\n return this.toJSON();\n }\n /**\n * Returns a formatted string representation of this object.\n *\n * **When to use**\n *\n * Use to format the class JSON representation as a string.\n *\n * @since 2.0.0\n */\n toString() {\n return format(this.toJSON());\n }\n};\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/stackTraceLimit.js\nvar isStackTraceLimitWritable = () => {\n const desc = Object.getOwnPropertyDescriptor(Error, \"stackTraceLimit\");\n if (desc === void 0) {\n return Object.isExtensible(Error);\n }\n return Object.hasOwn(desc, \"writable\") ? desc.writable === true : desc.set !== void 0;\n};\nvar canWriteStackTraceLimit = /* @__PURE__ */ isStackTraceLimitWritable();\nvar getStackTraceLimit = () => Error.stackTraceLimit;\nvar setStackTraceLimit = (value) => {\n if (canWriteStackTraceLimit) {\n ;\n Error.stackTraceLimit = value;\n }\n};\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Utils.js\nvar SingleShotGen = class {\n constructor(self) {\n this.value = self;\n this.done = false;\n }\n /**\n * Yields the stored value once, then completes with the value sent back in.\n *\n * **When to use**\n *\n * Use to advance a `SingleShotGen` through its single yield and completion\n * step.\n *\n * @since 2.0.0\n */\n next(a) {\n if (this.done) {\n this.value = a;\n return this;\n }\n this.done = true;\n return {\n value: this.value,\n done: false\n };\n }\n};\nvar pickInternalCall = () => {\n const InternalTypeId = \"~effect/Utils/internal\";\n const standard = {\n [InternalTypeId]: (body) => {\n return body();\n }\n };\n const forced = {\n [InternalTypeId]: (body) => {\n try {\n return body();\n } finally {\n }\n }\n };\n const isNotOptimizedAway = getStackTraceLimit() !== 0 && standard[InternalTypeId](() => new Error().stack)?.includes(InternalTypeId) === true;\n return isNotOptimizedAway ? standard[InternalTypeId] : forced[InternalTypeId];\n};\nvar internalCall = /* @__PURE__ */ pickInternalCall();\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/core.js\nvar EffectTypeId = `~effect/Effect`;\nvar ExitTypeId = `~effect/Exit`;\nvar effectVariance = {\n _A: identity,\n _E: identity,\n _R: identity\n};\nvar identifier = `${EffectTypeId}/identifier`;\nvar args = `${EffectTypeId}/args`;\nvar evaluate = `${EffectTypeId}/evaluate`;\nvar contA = `${EffectTypeId}/successCont`;\nvar contE = `${EffectTypeId}/failureCont`;\nvar contAll = `${EffectTypeId}/ensureCont`;\nvar Yield = /* @__PURE__ */ Symbol.for(\"effect/Effect/Yield\");\nvar PipeInspectableProto = {\n pipe() {\n return pipeArguments(this, arguments);\n },\n toJSON() {\n return {\n ...this\n };\n },\n toString() {\n return format(this.toJSON(), {\n ignoreToString: true,\n space: 2\n });\n },\n [NodeInspectSymbol]() {\n return this.toJSON();\n }\n};\nvar StructuralProto = {\n [symbol]() {\n return structureKeys(this, Object.keys(this));\n },\n [symbol2](that) {\n const selfKeys = Object.keys(this);\n const thatKeys = Object.keys(that);\n if (selfKeys.length !== thatKeys.length) return false;\n for (let i = 0; i < selfKeys.length; i++) {\n if (selfKeys[i] !== thatKeys[i] || !equals(this[selfKeys[i]], that[selfKeys[i]])) {\n return false;\n }\n }\n return true;\n }\n};\nvar EffectProto = {\n [EffectTypeId]: effectVariance,\n ...PipeInspectableProto,\n [Symbol.iterator]() {\n return new SingleShotGen(this);\n },\n toJSON() {\n return {\n _id: \"Effect\",\n op: this[identifier],\n ...args in this ? {\n args: this[args]\n } : void 0\n };\n }\n};\nvar isExit = (u) => hasProperty(u, ExitTypeId);\nvar CauseTypeId = \"~effect/Cause\";\nvar CauseReasonTypeId = \"~effect/Cause/Reason\";\nvar isCause = (self) => hasProperty(self, CauseTypeId);\nvar CauseImpl = class {\n constructor(failures) {\n this[CauseTypeId] = CauseTypeId;\n this.reasons = failures;\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n toJSON() {\n return {\n _id: \"Cause\",\n failures: this.reasons.map((f) => f.toJSON())\n };\n }\n toString() {\n return `Cause(${format(this.reasons)})`;\n }\n [NodeInspectSymbol]() {\n return this.toJSON();\n }\n [symbol2](that) {\n return isCause(that) && this.reasons.length === that.reasons.length && this.reasons.every((e, i) => equals(e, that.reasons[i]));\n }\n [symbol]() {\n return array(this.reasons);\n }\n};\nvar annotationsMap = /* @__PURE__ */ new WeakMap();\nvar ReasonBase = class {\n [CauseReasonTypeId];\n annotations;\n _tag;\n constructor(_tag, annotations, originalError) {\n this[CauseReasonTypeId] = CauseReasonTypeId;\n this._tag = _tag;\n if (annotations !== constEmptyAnnotations && typeof originalError === \"object\" && originalError !== null && annotations.size > 0) {\n const prevAnnotations = annotationsMap.get(originalError);\n if (prevAnnotations) {\n annotations = new Map([...prevAnnotations, ...annotations]);\n }\n annotationsMap.set(originalError, annotations);\n }\n this.annotations = annotations;\n }\n annotate(annotations, options) {\n if (annotations.mapUnsafe.size === 0) return this;\n const newAnnotations = new Map(this.annotations);\n annotations.mapUnsafe.forEach((value, key) => {\n if (options?.overwrite !== true && newAnnotations.has(key)) return;\n newAnnotations.set(key, value);\n });\n const self = Object.assign(Object.create(Object.getPrototypeOf(this)), this);\n self.annotations = newAnnotations;\n return self;\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n toString() {\n return format(this);\n }\n [NodeInspectSymbol]() {\n return this.toString();\n }\n};\nvar constEmptyAnnotations = /* @__PURE__ */ new Map();\nvar Fail = class extends ReasonBase {\n constructor(error, annotations = constEmptyAnnotations) {\n super(\"Fail\", annotations, error);\n this.error = error;\n }\n toString() {\n return `Fail(${format(this.error)})`;\n }\n toJSON() {\n return {\n _tag: \"Fail\",\n error: this.error\n };\n }\n [symbol2](that) {\n return isFailReason(that) && equals(this.error, that.error) && equals(this.annotations, that.annotations);\n }\n [symbol]() {\n return combine(string(this._tag))(combine(hash(this.error))(hash(this.annotations)));\n }\n};\nvar causeFromReasons = (reasons) => new CauseImpl(reasons);\nvar dedupeReasons = (self, that) => {\n const buckets = /* @__PURE__ */ new Map();\n const out = [];\n for (const reason of self.concat(that)) {\n const hash2 = hash(reason);\n const bucket = buckets.get(hash2);\n if (bucket === void 0) {\n buckets.set(hash2, [reason]);\n } else if (bucket.some((previous) => equals(previous, reason))) {\n continue;\n } else {\n bucket.push(reason);\n }\n out.push(reason);\n }\n return out;\n};\nvar causeCombine = /* @__PURE__ */ dual(2, (self, that) => {\n if (self.reasons.length === 0) {\n return that;\n } else if (that.reasons.length === 0) {\n return self;\n }\n const newCause = new CauseImpl(dedupeReasons(self.reasons, that.reasons));\n return equals(self, newCause) ? self : newCause;\n});\nvar causeFail = (error) => new CauseImpl([new Fail(error)]);\nvar Die = class extends ReasonBase {\n constructor(defect, annotations = constEmptyAnnotations) {\n super(\"Die\", annotations, defect);\n this.defect = defect;\n }\n toString() {\n return `Die(${format(this.defect)})`;\n }\n toJSON() {\n return {\n _tag: \"Die\",\n defect: this.defect\n };\n }\n [symbol2](that) {\n return isDieReason(that) && equals(this.defect, that.defect) && equals(this.annotations, that.annotations);\n }\n [symbol]() {\n return combine(string(this._tag))(combine(hash(this.defect))(hash(this.annotations)));\n }\n};\nvar causeDie = (defect) => new CauseImpl([new Die(defect)]);\nvar causeAnnotate = /* @__PURE__ */ dual((args2) => isCause(args2[0]), (self, annotations, options) => {\n if (annotations.mapUnsafe.size === 0) return self;\n return new CauseImpl(self.reasons.map((f) => f.annotate(annotations, options)));\n});\nvar isFailReason = (self) => self._tag === \"Fail\";\nvar isDieReason = (self) => self._tag === \"Die\";\nvar isInterruptReason = (self) => self._tag === \"Interrupt\";\nfunction defaultEvaluate(_fiber) {\n return exitDie(`Effect.evaluate: Not implemented`);\n}\nvar makePrimitiveProto = (options) => ({\n ...EffectProto,\n [identifier]: options.op,\n [evaluate]: options[evaluate] ?? defaultEvaluate,\n [contA]: options[contA],\n [contE]: options[contE],\n [contAll]: options[contAll]\n});\nvar makePrimitive = (options) => {\n const Proto2 = makePrimitiveProto(options);\n const PrimitiveImpl = function(value) {\n this[args] = value;\n };\n PrimitiveImpl.prototype = Proto2;\n return function(value) {\n return new PrimitiveImpl(value);\n };\n};\nvar makeExit = (options) => {\n const Proto2 = {\n [ExitTypeId]: ExitTypeId,\n _tag: options.op,\n get [options.prop]() {\n return this[args];\n },\n ...makePrimitiveProto(options),\n toString() {\n return `${options.op}(${format(this[args])})`;\n },\n toJSON() {\n return {\n _id: \"Exit\",\n _tag: options.op,\n [options.prop]: this[args]\n };\n },\n [symbol2](that) {\n return isExit(that) && that._tag === this._tag && equals(this[args], that[args]);\n },\n [symbol]() {\n return combine(string(options.op), hash(this[args]));\n }\n };\n const ExitPrimitive = function(value) {\n this[args] = value;\n };\n ExitPrimitive.prototype = Proto2;\n return function(value) {\n return new ExitPrimitive(value);\n };\n};\nvar exitSucceed = /* @__PURE__ */ makeExit({\n op: \"Success\",\n prop: \"value\",\n [evaluate](fiber2) {\n const cont = fiber2.getCont(contA);\n return cont ? cont[contA](this[args], fiber2, this) : fiber2.yieldWith(this);\n }\n});\nvar StackTraceKey = {\n key: \"effect/Cause/StackTrace\"\n};\nvar InterruptorStackTrace = {\n key: \"effect/Cause/InterruptorStackTrace\"\n};\nvar exitFailCause = /* @__PURE__ */ makeExit({\n op: \"Failure\",\n prop: \"cause\",\n [evaluate](fiber2) {\n let cause = this[args];\n let annotated = false;\n if (fiber2.cache.stackFrame) {\n cause = causeAnnotate(cause, {\n mapUnsafe: /* @__PURE__ */ new Map([[StackTraceKey.key, fiber2.cache.stackFrame]])\n });\n annotated = true;\n }\n let cont = fiber2.getCont(contE);\n const interruptedCause = fiber2._interruptedCause;\n if (interruptedCause && fiber2.interruptible) {\n let skippedHandler = false;\n while (cont && fiber2.interruptible) {\n skippedHandler ||= identifier in cont;\n cont = fiber2.getCont(contE);\n }\n if (skippedHandler) {\n cause = causeFromReasons(cause.reasons.filter((reason) => reason._tag !== \"Fail\"));\n }\n cause = causeCombine(cause, interruptedCause);\n annotated = true;\n }\n return cont ? cont[contE](cause, fiber2, annotated ? void 0 : this) : fiber2.yieldWith(annotated ? exitFailCause(cause) : this);\n }\n});\nvar exitFail = (e) => exitFailCause(causeFail(e));\nvar exitDie = (defect) => exitFailCause(causeDie(defect));\nvar withFiber = /* @__PURE__ */ makePrimitive({\n op: \"WithFiber\",\n [evaluate](fiber2) {\n return this[args](fiber2);\n }\n});\nvar withFiberSucceed = /* @__PURE__ */ makePrimitive({\n op: \"WithFiberSucceed\",\n [evaluate](fiber2) {\n const value = this[args](fiber2);\n const cont = fiber2.getCont(contA);\n return cont ? cont[contA](value, fiber2) : fiber2.yieldWith(exitSucceed(value));\n }\n});\nvar YieldableError = /* @__PURE__ */ (function() {\n class YieldableError2 extends globalThis.Error {\n }\n const proto = /* @__PURE__ */ makePrimitiveProto({\n op: \"YieldableError\",\n [evaluate]() {\n return exitFail(this);\n }\n });\n delete proto.toString;\n Object.assign(YieldableError2.prototype, proto);\n return YieldableError2;\n})();\nvar Error2 = /* @__PURE__ */ (function() {\n const plainArgsSymbol = /* @__PURE__ */ Symbol.for(\"effect/Data/Error/plainArgs\");\n return class Base extends YieldableError {\n constructor(args2) {\n super(args2?.message, args2?.cause ? {\n cause: args2.cause\n } : void 0);\n if (args2) {\n assignProperties(this, args2);\n Object.defineProperty(this, plainArgsSymbol, {\n value: args2,\n enumerable: false\n });\n }\n }\n toJSON() {\n return {\n ...this[plainArgsSymbol],\n ...this\n };\n }\n };\n})();\nvar TaggedError = (tag2) => {\n class Base extends Error2 {\n _tag = tag2;\n }\n ;\n Base.prototype.name = tag2;\n return Base;\n};\nvar NoSuchElementErrorTypeId = \"~effect/Cause/NoSuchElementError\";\nvar NoSuchElementError = class extends (/* @__PURE__ */ TaggedError(\"NoSuchElementError\")) {\n [NoSuchElementErrorTypeId] = NoSuchElementErrorTypeId;\n constructor(message) {\n super({\n message\n });\n }\n};\nvar DoneTypeId = \"~effect/Cause/Done\";\nvar DoneVoid = {\n [DoneTypeId]: DoneTypeId,\n _tag: \"Done\",\n value: void 0\n};\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/option.js\nvar TypeId = \"~effect/Option\";\nvar CommonProto = {\n [TypeId]: {\n _A: (_) => _\n },\n ...PipeInspectableProto,\n [Symbol.iterator]() {\n return new SingleShotGen(this);\n }\n};\nvar SomeProto = /* @__PURE__ */ Object.defineProperty(/* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), {\n _tag: \"Some\",\n _op: \"Some\",\n [symbol2](that) {\n return isOption(that) && isSome(that) && equals(this.value, that.value);\n },\n [symbol]() {\n return combine(hash(this._tag))(hash(this.value));\n },\n toString() {\n return `some(${format(this.value)})`;\n },\n toJSON() {\n return {\n _id: \"Option\",\n _tag: this._tag,\n value: toJson(this.value)\n };\n }\n}), \"valueOrUndefined\", {\n get() {\n return this.value;\n }\n});\nvar NoneHash = /* @__PURE__ */ hash(\"None\");\nvar NoneProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), {\n _tag: \"None\",\n _op: \"None\",\n valueOrUndefined: void 0,\n [symbol2](that) {\n return isOption(that) && isNone(that);\n },\n [symbol]() {\n return NoneHash;\n },\n toString() {\n return `none()`;\n },\n toJSON() {\n return {\n _id: \"Option\",\n _tag: this._tag\n };\n }\n});\nvar isOption = (input) => hasProperty(input, TypeId);\nvar isNone = (fa) => fa._tag === \"None\";\nvar isSome = (fa) => fa._tag === \"Some\";\nvar none = /* @__PURE__ */ Object.create(NoneProto);\nvar SomeImpl = function(value) {\n this.value = value;\n};\nSomeImpl.prototype = SomeProto;\nvar some = (value) => new SomeImpl(value);\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/result.js\nvar TypeId2 = \"~effect/Result\";\nvar CommonProto2 = {\n [TypeId2]: {\n /* v8 ignore next 2 */\n _A: (_) => _,\n _E: (_) => _\n },\n ...PipeInspectableProto,\n [Symbol.iterator]() {\n return new SingleShotGen(this);\n }\n};\nvar SuccessProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {\n _tag: \"Success\",\n _op: \"Success\",\n [symbol2](that) {\n return isResult(that) && isSuccess(that) && equals(this.success, that.success);\n },\n [symbol]() {\n return combine(hash(this._tag))(hash(this.success));\n },\n toString() {\n return `success(${format(this.success)})`;\n },\n toJSON() {\n return {\n _id: \"Result\",\n _tag: this._tag,\n value: toJson(this.success)\n };\n }\n});\nvar FailureProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {\n _tag: \"Failure\",\n _op: \"Failure\",\n [symbol2](that) {\n return isResult(that) && isFailure(that) && equals(this.failure, that.failure);\n },\n [symbol]() {\n return combine(hash(this._tag))(hash(this.failure));\n },\n toString() {\n return `failure(${format(this.failure)})`;\n },\n toJSON() {\n return {\n _id: \"Result\",\n _tag: this._tag,\n failure: toJson(this.failure)\n };\n }\n});\nvar isResult = (input) => hasProperty(input, TypeId2);\nvar isFailure = (result2) => result2._tag === \"Failure\";\nvar isSuccess = (result2) => result2._tag === \"Success\";\nvar FailureImpl = function(failure) {\n this.failure = failure;\n};\nFailureImpl.prototype = FailureProto;\nvar fail = (failure) => new FailureImpl(failure);\nvar SuccessImpl = function(success) {\n this.success = success;\n};\nSuccessImpl.prototype = SuccessProto;\nvar succeed = (success) => new SuccessImpl(success);\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Option.js\nvar none2 = () => none;\nvar some2 = some;\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Result.js\nvar succeed2 = succeed;\nvar fail2 = fail;\nvar isFailure2 = isFailure;\nvar match = /* @__PURE__ */ dual(2, (self, {\n onFailure,\n onSuccess\n}) => isFailure2(self) ? onFailure(self.failure) : onSuccess(self.success));\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Array.js\nvar Array2 = globalThis.Array;\nvar append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);\nvar isArray = Array2.isArray;\nvar isArrayNonEmpty2 = isArrayNonEmpty;\nvar isReadonlyArrayNonEmpty = isArrayNonEmpty;\nvar empty = () => [];\nvar map = /* @__PURE__ */ dual(2, (self, f) => self.map(f));\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Effectable.js\nvar Prototype2 = (options) => makePrimitiveProto({\n op: options.label,\n [evaluate]: options.evaluate\n});\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Context.js\nvar ServiceTypeId = \"~effect/Context/Service\";\nvar Service = function() {\n function KeyClass() {\n }\n const self = KeyClass;\n Object.setPrototypeOf(self, ServiceProto);\n const init = (key, options) => {\n self.key = key;\n if (options?.defaultValue) {\n self[ReferenceTypeId] = ReferenceTypeId;\n self.defaultValue = options.defaultValue;\n }\n if (options?.make) {\n ;\n self.make = options.make;\n }\n if (options?.fiberCached) {\n cacheKeys.add(key);\n }\n return self;\n };\n return arguments.length > 0 ? init(arguments[0], arguments[1]) : init;\n};\nvar ServiceProto = {\n [ServiceTypeId]: ServiceTypeId,\n .../* @__PURE__ */ Prototype2({\n label: \"Service\",\n evaluate(fiber2) {\n return exitSucceed(get(fiber2.context, this));\n }\n }),\n toJSON() {\n return {\n _id: \"Service\",\n key: this.key\n };\n },\n of(self) {\n return self;\n },\n context(self) {\n return make(this, self);\n },\n use(f) {\n return withFiber((fiber2) => f(get(fiber2.context, this)));\n },\n useSync(f) {\n return withFiber((fiber2) => exitSucceed(f(get(fiber2.context, this))));\n }\n};\nvar cacheKeys = /* @__PURE__ */ new Set();\nvar ReferenceTypeId = \"~effect/Context/Reference\";\nvar TypeId3 = \"~effect/Context\";\nvar MaxDepth = 8;\nvar FlattenAfterBaseHits = 8;\nvar makeImpl = (cacheRoot, base, overlay, depth) => {\n const self = Object.create(Proto);\n self.cacheRoot = cacheRoot ?? self;\n self.base = base;\n self.overlay = overlay;\n self.depth = depth;\n self._flat = void 0;\n self.baseHits = 0;\n return self;\n};\nvar applyOverlays = (map5, overlay) => {\n if (!overlay) return;\n applyOverlays(map5, overlay.parent);\n map5.set(overlay.key, overlay.value);\n};\nvar flatten = (self) => {\n if (self._flat) return self._flat;\n if (!self.overlay) return self._flat = self.base;\n const map5 = new Map(self.base);\n applyOverlays(map5, self.overlay);\n return self._flat = map5;\n};\nvar notFound = /* @__PURE__ */ Symbol();\nvar lookup = (self, key) => {\n const impl = self;\n for (let overlay = impl.overlay; overlay; overlay = overlay.parent) {\n if (overlay.key === key) return overlay.value;\n }\n const value = impl.base.get(key);\n if (value === void 0 && !impl.base.has(key)) return notFound;\n if (impl.overlay && ++impl.baseHits >= impl.base.size && impl.baseHits >= FlattenAfterBaseHits) {\n impl.base = flatten(impl);\n impl.overlay = void 0;\n impl.depth = 0;\n }\n return value;\n};\nvar makeUnsafe = (mapUnsafe) => makeImpl(void 0, mapUnsafe, void 0, 0);\nvar Proto = {\n get mapUnsafe() {\n return flatten(this);\n },\n ...PipeInspectableProto,\n [TypeId3]: {\n _Services: (_) => _\n },\n toJSON() {\n return {\n _id: \"Context\",\n services: Array.from(this.mapUnsafe).map(([key, value]) => ({\n key,\n value\n }))\n };\n },\n [symbol2](that) {\n if (!isContext(that)) return false;\n const self = this.mapUnsafe;\n const other = that.mapUnsafe;\n if (self.size !== other.size) return false;\n for (const [key, value] of self) {\n if (!other.has(key) || !equals(value, other.get(key))) return false;\n }\n return true;\n },\n [symbol]() {\n return number(this.mapUnsafe.size);\n }\n};\nvar hasSameCache = (self, that) => self.cacheRoot === that.cacheRoot;\nvar isContext = (u) => hasProperty(u, TypeId3);\nvar isReference = (u) => !!u[ReferenceTypeId];\nvar empty2 = () => emptyContext2;\nvar emptyContext2 = /* @__PURE__ */ makeUnsafe(/* @__PURE__ */ new Map());\nvar make = (key, service2) => makeUnsafe(/* @__PURE__ */ new Map([[key.key, service2]]));\nvar add = /* @__PURE__ */ dual(3, (self, key, service2) => addUnsafe(self, key.key, service2));\nvar addUnsafe = (self, key, service2) => {\n const impl = self;\n const cacheRoot = cacheKeys.has(key) ? void 0 : impl.cacheRoot;\n if (impl.depth >= MaxDepth) {\n const map5 = new Map(impl.mapUnsafe);\n map5.set(key, service2);\n return makeImpl(cacheRoot, map5, void 0, 0);\n }\n return makeImpl(cacheRoot, impl.base, {\n key,\n value: service2,\n parent: impl.overlay\n }, impl.depth + 1);\n};\nvar getOrUndefinedUnsafe = (self, key) => {\n const value = lookup(self, key);\n return value === notFound ? void 0 : value;\n};\nvar getUnsafe = /* @__PURE__ */ dual(2, (self, service2) => {\n const value = lookup(self, service2.key);\n if (value === notFound) {\n if (isReference(service2)) return getDefaultValue(service2);\n throw serviceNotFoundError(service2);\n }\n return value;\n});\nvar get = getUnsafe;\nvar defaultValueCacheKey = \"~effect/Context/defaultValue\";\nvar getDefaultValue = (ref) => {\n if (defaultValueCacheKey in ref) {\n return ref[defaultValueCacheKey];\n }\n return ref[defaultValueCacheKey] = ref.defaultValue();\n};\nvar serviceNotFoundError = (service2) => {\n const error = new Error(`Service not found${service2.key ? `: ${String(service2.key)}` : \"\"}`);\n if (error.stack) {\n const lines = error.stack.split(\"\\n\");\n lines.splice(1, 3);\n error.stack = lines.join(\"\\n\");\n }\n return error;\n};\nvar Reference = Service;\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Scheduler.js\nvar Scheduler = /* @__PURE__ */ Reference(\"effect/Scheduler\", {\n fiberCached: true,\n defaultValue: () => new MixedScheduler()\n});\nvar setMicrotask = (f) => {\n let cancelled = false;\n Promise.resolve().then(() => {\n if (!cancelled) f();\n });\n return () => {\n cancelled = true;\n };\n};\nvar setTimer = \"setImmediate\" in globalThis ? (f) => {\n const timer = globalThis.setImmediate(f);\n return () => globalThis.clearImmediate(timer);\n} : (f) => {\n const timer = setTimeout(f, 0);\n return () => clearTimeout(timer);\n};\nvar setImmediate = (f) => {\n try {\n return setTimer(f);\n } catch {\n return setMicrotask(f);\n }\n};\nvar PriorityBuckets = class {\n buckets = [];\n scheduleTask(task, priority) {\n const buckets = this.buckets;\n const len = buckets.length;\n let bucket;\n let index = 0;\n for (; index < len; index++) {\n if (buckets[index][0] > priority) break;\n bucket = buckets[index];\n }\n if (bucket && bucket[0] === priority) {\n bucket[1].push(task);\n } else if (index === len) {\n buckets.push([priority, [task]]);\n } else {\n buckets.splice(index, 0, [priority, [task]]);\n }\n }\n drain() {\n const buckets = this.buckets;\n this.buckets = [];\n return buckets;\n }\n};\nvar MixedScheduler = class {\n executionMode;\n setImmediate;\n constructor(executionMode = \"async\", setImmediateFn) {\n this.executionMode = executionMode;\n this.setImmediate = setImmediateFn ?? (executionMode === \"sync\" ? setMicrotask : setImmediate);\n }\n /**\n * Returns whether the fiber has reached its operation budget and should yield.\n *\n * **When to use**\n *\n * Use to decide whether a fiber should yield after consuming its current\n * operation budget.\n *\n * @since 2.0.0\n */\n shouldYield(fiber2) {\n return fiber2.currentOpCount >= fiber2.cache.maxOpsBeforeYield;\n }\n /**\n * Creates a dispatcher that schedules work through this scheduler.\n *\n * **When to use**\n *\n * Use when you need a standalone dispatcher from a scheduler instance, for\n * example in tests that enqueue tasks and then flush them deterministically.\n *\n * @since 4.0.0\n */\n makeDispatcher() {\n return new MixedSchedulerDispatcher(this.setImmediate);\n }\n};\nvar MixedSchedulerDispatcher = class {\n tasks = /* @__PURE__ */ new PriorityBuckets();\n running = void 0;\n setImmediate;\n constructor(setImmediateFn = setImmediate) {\n this.setImmediate = setImmediateFn;\n }\n /**\n * @since 2.0.0\n */\n scheduleTask(task, priority) {\n this.tasks.scheduleTask(task, priority);\n if (this.running === void 0) {\n this.running = this.setImmediate(this.afterScheduled);\n }\n }\n /**\n * @since 2.0.0\n */\n afterScheduled = () => {\n this.running = void 0;\n this.runTasks();\n };\n /**\n * @since 2.0.0\n */\n runTasks() {\n const buckets = this.tasks.drain();\n for (let i = 0; i < buckets.length; i++) {\n const toRun = buckets[i][1];\n for (let j = 0; j < toRun.length; j++) {\n toRun[j]();\n }\n }\n }\n /**\n * @since 2.0.0\n */\n flush() {\n while (this.tasks.buckets.length > 0) {\n if (this.running !== void 0) {\n this.running();\n this.running = void 0;\n }\n this.runTasks();\n }\n }\n};\nvar MaxOpsBeforeYield = /* @__PURE__ */ Reference(\"effect/Scheduler/MaxOpsBeforeYield\", {\n fiberCached: true,\n defaultValue: () => 2048\n});\nvar PreventSchedulerYield = /* @__PURE__ */ Reference(\"effect/Scheduler/PreventSchedulerYield\", {\n fiberCached: true,\n defaultValue: () => false\n});\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Data.js\nvar TaggedError2 = TaggedError;\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/encoding/EncodingError.js\nvar EncodingErrorTypeId = \"~effect/encoding/EncodingError\";\nvar EncodingError = class extends (/* @__PURE__ */ TaggedError2(\"EncodingError\")) {\n /**\n * Marks this value as an encoding or decoding error for runtime guards.\n *\n * **When to use**\n *\n * Use to identify `EncodingError` instances through `isEncodingError`.\n *\n * @since 4.0.0\n */\n [EncodingErrorTypeId] = EncodingErrorTypeId;\n};\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Tracer.js\nvar ParentSpanKey = \"effect/Tracer/ParentSpan\";\nvar TracerKey = \"effect/Tracer\";\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/metric.js\nvar FiberRuntimeMetricsKey = \"effect/Metric/FiberRuntimeMetrics\";\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/references.js\nvar CurrentStackFrame = /* @__PURE__ */ Reference(\"effect/References/CurrentStackFrame\", {\n fiberCached: true,\n defaultValue: constUndefined\n});\nvar TracerEnabled = /* @__PURE__ */ Reference(\"effect/References/TracerEnabled\", {\n fiberCached: true,\n defaultValue: constTrue\n});\nvar CurrentLogLevel = /* @__PURE__ */ Reference(\"effect/References/CurrentLogLevel\", {\n fiberCached: true,\n defaultValue: () => \"Info\"\n});\nvar MinimumLogLevel = /* @__PURE__ */ Reference(\"effect/References/MinimumLogLevel\", {\n fiberCached: true,\n defaultValue: () => \"Info\"\n});\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/effect.js\nvar Interrupt = class extends ReasonBase {\n constructor(fiberId2, annotations = constEmptyAnnotations) {\n super(\"Interrupt\", annotations, \"Interrupted\");\n this.fiberId = fiberId2;\n }\n toString() {\n return `Interrupt(${this.fiberId})`;\n }\n toJSON() {\n return {\n _tag: \"Interrupt\",\n fiberId: this.fiberId\n };\n }\n [symbol2](that) {\n return isInterruptReason(that) && this.fiberId === that.fiberId && this.annotations === that.annotations;\n }\n [symbol]() {\n return combine(string(`${this._tag}:${this.fiberId}`))(random(this.annotations));\n }\n};\nvar causeInterrupt = (fiberId2) => new CauseImpl([new Interrupt(fiberId2)]);\nvar findError = (self) => {\n for (let i = 0; i < self.reasons.length; i++) {\n const reason = self.reasons[i];\n if (reason._tag === \"Fail\") {\n return succeed2(reason.error);\n }\n }\n return fail2(self);\n};\nvar hasInterrupts = (self) => self.reasons.some(isInterruptReason);\nvar causeMap = /* @__PURE__ */ dual(2, (self, f) => {\n let hasFail = false;\n const failures = self.reasons.map((failure) => {\n if (isFailReason(failure)) {\n hasFail = true;\n return new Fail(f(failure.error), failure.annotations);\n }\n return failure;\n });\n return hasFail ? causeFromReasons(failures) : self;\n});\nvar FiberTypeId = \"~effect/Fiber\";\nvar fiberVariance = {\n _A: identity,\n _E: identity\n};\nvar fiberIdStore = {\n id: 0\n};\nvar AsyncResource = /* @__PURE__ */ (() => {\n try {\n return globalThis.process?.getBuiltinModule?.(\"node:async_hooks\")?.AsyncResource;\n } catch {\n return void 0;\n }\n})();\nvar captureAsyncContext = () => AsyncResource === void 0 ? void 0 : new AsyncResource(\"effect/Fiber\");\nvar getCurrentFiber = () => globalThis[currentFiberTypeId];\nvar FiberImpl = class {\n constructor(context2, interruptible2 = true) {\n this.setContext(context2);\n this.id = ++fiberIdStore.id;\n this.currentOpCount = 0;\n this.interruptible = interruptible2;\n this._stack = [];\n this._observers = void 0;\n this._exit = void 0;\n this._children = void 0;\n this._interruptedCause = void 0;\n this._yielded = void 0;\n this._running = false;\n this._deferredInterrupt = false;\n this._parent = void 0;\n this._asyncContext = void 0;\n this.cache.runtimeMetrics?.recordFiberStart(this.context);\n }\n get [FiberTypeId]() {\n return fiberVariance;\n }\n get currentDispatcher() {\n return this._dispatcher ??= this.cache.scheduler.makeDispatcher();\n }\n getRef(ref) {\n return get(this.context, ref);\n }\n addObserver(cb) {\n if (this._exit) {\n cb(this._exit);\n return constVoid;\n }\n if (this._observers === void 0) {\n this._observers = [cb];\n } else {\n this._observers.push(cb);\n }\n return () => this.removeObserver(cb);\n }\n removeObserver(cb) {\n if (this._exit || this._observers === void 0) return;\n const index = this._observers.indexOf(cb);\n if (index >= 0) {\n this._observers.splice(index, 1);\n }\n }\n interruptUnsafe(fiberId2, annotations) {\n if (this._exit) {\n return;\n }\n let cause = causeInterrupt(fiberId2);\n if (this.cache.stackFrame) {\n cause = causeAnnotate(cause, make(StackTraceKey, this.cache.stackFrame));\n }\n if (annotations) {\n cause = causeAnnotate(cause, annotations);\n }\n this._interruptedCause = this._interruptedCause ? causeCombine(this._interruptedCause, cause) : cause;\n if (this.interruptible) {\n if (this._running) {\n this._deferredInterrupt = true;\n } else {\n this.evaluate(failCause(this._interruptedCause));\n }\n }\n }\n pollUnsafe() {\n return this._exit;\n }\n evaluate(effect) {\n if (this._exit) {\n return;\n } else if (this._asyncContext !== void 0) {\n const asyncContext = this._asyncContext;\n this._asyncContext = void 0;\n return asyncContext.runInAsyncScope(this.evaluate, this, effect);\n } else if (this._yielded !== void 0) {\n const yielded = this._yielded;\n this._yielded = void 0;\n yielded();\n }\n const exit3 = this.runLoop(effect);\n if (exit3 === Yield) {\n this._asyncContext = captureAsyncContext();\n return;\n }\n const interruptChildren = fiberMiddleware.interruptChildren && fiberMiddleware.interruptChildren(this);\n if (interruptChildren !== void 0) {\n return this.evaluate(flatMap(interruptChildren, () => exit3));\n }\n this._exit = exit3;\n this.cache.runtimeMetrics?.recordFiberEnd(this.context, this._exit);\n if (this._parent) {\n this._parent._children?.delete(this);\n this._parent = void 0;\n }\n if (this._observers !== void 0) {\n const observers = this._observers;\n this._observers = void 0;\n for (let i = 0; i < observers.length; i++) {\n observers[i](exit3);\n }\n }\n this._stack.length = 0;\n this._children = void 0;\n this.context = empty2();\n }\n runLoop(effect) {\n const prevFiber = globalThis[currentFiberTypeId];\n globalThis[currentFiberTypeId] = this;\n const prevRunning = this._running;\n this._running = true;\n let yielding = false;\n let current = effect;\n this.currentOpCount = 0;\n try {\n while (true) {\n try {\n if (this._deferredInterrupt) {\n this._deferredInterrupt = false;\n current = failCause(this._interruptedCause);\n }\n this.currentOpCount++;\n const cache2 = this.cache;\n if (!yielding && !cache2.preventYield && cache2.scheduler.shouldYield(this)) {\n yielding = true;\n const prev = current;\n current = flatMap(yieldNow, () => prev);\n }\n current = cache2.tracerContext ? cache2.tracerContext(current, this) : current[evaluate](this);\n if (current === Yield) {\n const yielded = this._yielded;\n if (ExitTypeId in yielded) {\n this._deferredInterrupt = false;\n this._yielded = void 0;\n return yielded;\n } else if (this._deferredInterrupt) {\n this._yielded = void 0;\n yielded();\n continue;\n }\n return Yield;\n }\n } catch (error) {\n if (!hasProperty(current, evaluate)) {\n return exitDie(`Fiber.runLoop: Not a valid effect: ${String(current)}`);\n }\n current = exitDie(error);\n }\n }\n } finally {\n this._running = prevRunning;\n globalThis[currentFiberTypeId] = prevFiber;\n }\n }\n getCont(symbol4) {\n if (this._deferredInterrupt) {\n this._deferredInterrupt = false;\n return deferredInterruptCont;\n }\n while (true) {\n const op = this._stack.pop();\n if (!op) return void 0;\n const all2 = op[contAll];\n if (all2 !== void 0) {\n const cont = all2.call(op, this);\n if (cont) {\n ;\n cont[symbol4] = cont;\n return cont;\n }\n }\n if (op[symbol4]) return op;\n }\n }\n // Passes a success value straight to the next continuation instead of\n // returning an Exit for the run loop to unwrap. Each call counts as an\n // operation, and every `maxInlineSteps`th call returns an Exit instead, so\n // continuations calling continuations never nest deeper than that.\n succeedWith(value) {\n if ((++this.currentOpCount & maxInlineSteps - 1) === 0) {\n return exitSucceed(value);\n }\n const cont = this.getCont(contA);\n return cont ? cont[contA](value, this) : this.yieldWith(exitSucceed(value));\n }\n yieldWith(value) {\n this._yielded = value;\n return Yield;\n }\n children() {\n return this._children ??= /* @__PURE__ */ new Set();\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n setContext(context2) {\n const previous = this.context;\n this.context = context2;\n if (previous !== void 0 && hasSameCache(previous, context2)) return;\n const root = context2.cacheRoot;\n const cache2 = root._fiberCache ??= makeFiberContextCache(context2);\n if (this.cache?.scheduler !== cache2.scheduler) {\n this._dispatcher = void 0;\n }\n this.cache = cache2;\n }\n get currentSpanLocal() {\n const span = this.cache.span;\n return span?._tag === \"Span\" ? span : void 0;\n }\n};\nvar makeFiberContextCache = (context2) => {\n const currentTracer = getOrUndefinedUnsafe(context2, TracerKey);\n return {\n scheduler: get(context2, Scheduler),\n tracer: currentTracer,\n tracerContext: currentTracer ? currentTracer[\"context\"] : void 0,\n tracerEnabled: get(context2, TracerEnabled),\n span: getOrUndefinedUnsafe(context2, ParentSpanKey),\n logLevel: get(context2, CurrentLogLevel),\n minimumLogLevel: get(context2, MinimumLogLevel),\n stackFrame: get(context2, CurrentStackFrame),\n runtimeMetrics: getOrUndefinedUnsafe(context2, FiberRuntimeMetricsKey),\n maxOpsBeforeYield: get(context2, MaxOpsBeforeYield),\n preventYield: get(context2, PreventSchedulerYield)\n };\n};\nvar deferredInterruptCont = {\n [contA](_value, fiber2) {\n return failCause(fiber2._interruptedCause);\n },\n [contE](_cause, fiber2) {\n return failCause(fiber2._interruptedCause);\n }\n};\nvar maxInlineSteps = 32;\nvar fiberMiddleware = {\n interruptChildren: void 0\n};\nvar fiberStackAnnotations = (fiber2) => {\n if (!fiber2.cache.stackFrame) return void 0;\n const annotations = /* @__PURE__ */ new Map();\n annotations.set(InterruptorStackTrace.key, fiber2.cache.stackFrame);\n return makeUnsafe(annotations);\n};\nvar fiberAwaitAll = (self) => callback((resume) => {\n const iter = self[Symbol.iterator]();\n const exits = [];\n let cancel = void 0;\n function loop() {\n let result2 = iter.next();\n while (!result2.done) {\n if (result2.value._exit) {\n exits.push(result2.value._exit);\n result2 = iter.next();\n continue;\n }\n cancel = result2.value.addObserver((exit3) => {\n exits.push(exit3);\n loop();\n });\n return;\n }\n resume(succeed3(exits));\n }\n loop();\n return sync(() => cancel?.());\n});\nvar fiberInterruptAll = (fibers) => withFiber((parent) => {\n const annotations = fiberStackAnnotations(parent);\n let fiberArr = empty();\n for (const fiber2 of fibers) {\n fiber2.interruptUnsafe(parent.id, annotations);\n fiberArr.push(fiber2);\n }\n return asVoid(fiberAwaitAll(fiberArr));\n});\nvar succeed3 = exitSucceed;\nvar failCause = exitFailCause;\nvar fail3 = exitFail;\nvar sync = /* @__PURE__ */ makePrimitive({\n op: \"Sync\",\n [evaluate](fiber2) {\n const value = this[args]();\n const cont = fiber2.getCont(contA);\n return cont ? cont[contA](value, fiber2) : fiber2.yieldWith(exitSucceed(value));\n }\n});\nvar suspend = /* @__PURE__ */ makePrimitive({\n op: \"Suspend\",\n [evaluate](_fiber) {\n return this[args]();\n }\n});\nvar fromResult = /* @__PURE__ */ match({\n onFailure: fail3,\n onSuccess: succeed3\n});\nvar yieldNowWith = /* @__PURE__ */ makePrimitive({\n op: \"Yield\",\n [evaluate](fiber2) {\n let resumed = false;\n fiber2.currentDispatcher.scheduleTask(() => {\n if (resumed) return;\n fiber2.evaluate(exitVoid);\n }, this[args] ?? 0);\n return fiber2.yieldWith(() => {\n resumed = true;\n });\n }\n});\nvar yieldNow = /* @__PURE__ */ yieldNowWith(0);\nvar failCauseSync = (evaluate2) => suspend(() => failCause(evaluate2()));\nvar die = (defect) => exitDie(defect);\nvar failSync = (error) => suspend(() => fail3(error()));\nvar void_ = /* @__PURE__ */ succeed3(void 0);\nvar try_ = (options) => {\n const evaluate2 = typeof options === \"function\" ? options : options.try;\n const catcher = typeof options === \"function\" ? (cause) => new UnknownError(cause, \"An error occurred in Effect.try\") : options.catch;\n return suspend(() => {\n try {\n return succeed3(evaluate2());\n } catch (err) {\n return fail3(catcher(err));\n }\n });\n};\nvar tryPromise = (options) => {\n const f = typeof options === \"function\" ? options : options.try;\n const catcher = typeof options === \"function\" ? (cause) => new UnknownError(cause, \"An error occurred in Effect.tryPromise\") : options.catch;\n return callbackOptions(function(resume, signal) {\n const failWithCatch = (cause) => suspend(() => {\n try {\n return fail3(internalCall(() => catcher(cause)));\n } catch (err) {\n return die(err);\n }\n });\n try {\n f(signal).then((a) => resume(succeed3(a)), (e) => resume(failWithCatch(e)));\n } catch (err) {\n resume(failWithCatch(err));\n }\n }, f.length !== 0);\n};\nvar callbackOptions = /* @__PURE__ */ (function() {\n const Proto2 = /* @__PURE__ */ makePrimitiveProto({\n op: \"Async\",\n [evaluate](fiber2) {\n let resumed = false;\n let yielded = false;\n const controller = this.withSignal ? new AbortController() : void 0;\n const onCancel = this.register.call(fiber2.cache.scheduler, (effect) => {\n if (resumed) return;\n resumed = true;\n if (yielded) {\n fiber2.evaluate(effect);\n } else {\n yielded = effect;\n }\n }, controller?.signal);\n if (yielded !== false) return yielded;\n yielded = true;\n fiber2._yielded = () => {\n resumed = true;\n };\n if (controller === void 0 && onCancel === void 0) {\n return Yield;\n }\n fiber2._stack.push(asyncFinalizer(() => {\n resumed = true;\n controller?.abort();\n return onCancel ?? exitVoid;\n }));\n return Yield;\n }\n });\n const AsyncImpl = function(register, withSignal) {\n this.register = register;\n this.withSignal = withSignal;\n };\n AsyncImpl.prototype = Proto2;\n return function(register, withSignal) {\n return new AsyncImpl(register, withSignal);\n };\n})();\nvar asyncFinalizer = /* @__PURE__ */ makePrimitive({\n op: \"AsyncFinalizer\",\n [contAll](fiber2) {\n if (fiber2.interruptible) {\n fiber2.interruptible = false;\n fiber2._stack.push(setInterruptibleTrue);\n }\n },\n [contE](cause, _fiber) {\n return hasInterrupts(cause) ? flatMap(combineFinalizerCause(exitFailCause(cause), this[args]()), () => failCause(cause)) : failCause(cause);\n }\n});\nvar callback = (register) => callbackOptions(register, register.length >= 2);\nvar defineFunctionLength = (length, fn2) => Object.defineProperty(fn2, \"length\", {\n value: length,\n configurable: true\n});\nvar fnUntracedEager = (body, ...pipeables) => defineFunctionLength(body.length, pipeables.length === 0 ? function() {\n return fromIteratorEagerUnsafe(() => body.apply(this, arguments));\n} : function() {\n let effect = fromIteratorEagerUnsafe(() => body.apply(this, arguments));\n for (const pipeable of pipeables) {\n effect = pipeable(effect, ...arguments);\n }\n return effect;\n});\nvar fromIteratorEagerUnsafe = (evaluate2) => {\n try {\n const iterator = evaluate2();\n let value = void 0;\n while (true) {\n const state = iterator.next(value);\n if (state.done) {\n return succeed3(state.value);\n }\n const primitive = state.value;\n if (primitive && primitive._tag === \"Success\") {\n value = primitive.value;\n continue;\n } else if (primitive && primitive._tag === \"Failure\") {\n return state.value;\n } else {\n let isFirstExecution = true;\n return suspend(() => {\n if (isFirstExecution) {\n isFirstExecution = false;\n return flatMap(state.value, (value2) => fromIteratorUnsafe(iterator, value2));\n } else {\n return suspend(() => fromIteratorUnsafe(evaluate2()));\n }\n });\n }\n }\n } catch (error) {\n return die(error);\n }\n};\nvar fromIteratorUnsafe = /* @__PURE__ */ (function() {\n const Proto2 = /* @__PURE__ */ makePrimitiveProto({\n op: \"Iterator\",\n [contA](value, fiber2) {\n const iter = this.iterator;\n while (true) {\n const state = iter.next(value);\n if (state.done) return succeed3(state.value);\n if (!effectIsExit(state.value)) {\n fiber2._stack.push(this);\n return state.value;\n } else if (state.value._tag === \"Failure\") {\n return state.value;\n }\n value = state.value.value;\n }\n },\n [evaluate](fiber2) {\n return this[contA](this.initial, fiber2);\n }\n });\n const IteratorImpl = function(iterator, initial) {\n this.iterator = iterator;\n this.initial = initial;\n };\n IteratorImpl.prototype = Proto2;\n return function(iterator, initial) {\n return new IteratorImpl(iterator, initial);\n };\n})();\nvar evaluateCont = function(fiber2) {\n fiber2._stack.push(this);\n return this[args];\n};\nvar OnSuccessProto = /* @__PURE__ */ makePrimitiveProto({\n op: \"OnSuccess\",\n [evaluate]: evaluateCont\n});\nvar ContImpl = function(self, cont, payload) {\n this[args] = self;\n this[contA] = cont;\n this.payload = payload;\n};\nContImpl.prototype = OnSuccessProto;\nvar returnPayload = function() {\n return this.payload;\n};\nvar continuationMarksStack = /* @__PURE__ */ (() => {\n const marker = \"~effect/Effect/stackProbe\";\n const probe = {\n [marker]: function stackProbe() {\n return new Error().stack;\n }\n };\n return probe[marker]()?.includes(\"[as \" + marker + \"]\") === true;\n})();\nvar mapCont = function(value, fiber2) {\n const f = this.payload;\n return fiber2.succeedWith(continuationMarksStack ? f(value) : internalCall(() => f(value)));\n};\nvar andThenCont = function(value) {\n const f = this.payload;\n return f(value);\n};\nvar asVoid = (self) => new ContImpl(self, returnPayload, exitVoid);\nvar flatMap = /* @__PURE__ */ dual(2, (self, f) => new ContImpl(self, andThenCont, f));\nvar effectIsExit = (effect) => effect[ExitTypeId] !== void 0;\nvar flatMapEager = /* @__PURE__ */ dual(2, (self, f) => {\n if (effectIsExit(self)) {\n return self._tag === \"Success\" ? f(self.value) : self;\n }\n return flatMap(self, f);\n});\nvar map2 = /* @__PURE__ */ dual(2, (self, f) => new ContImpl(self, mapCont, f));\nvar mapEager = /* @__PURE__ */ dual(2, (self, f) => effectIsExit(self) ? exitMap(self, f) : map2(self, f));\nvar mapErrorEager = /* @__PURE__ */ dual(2, (self, f) => effectIsExit(self) ? exitMapError(self, f) : mapError(self, f));\nvar exitIsSuccess = (self) => self._tag === \"Success\";\nvar exitVoid = /* @__PURE__ */ exitSucceed(void 0);\nvar exitMap = /* @__PURE__ */ dual(2, (self, f) => self._tag === \"Success\" ? exitSucceed(f(self.value)) : self);\nvar exitMapError = /* @__PURE__ */ dual(2, (self, f) => {\n if (self._tag === \"Success\") return self;\n const error = findError(self.cause);\n if (isFailure2(error)) return self;\n return exitFail(f(error.success));\n});\nvar catchCause = /* @__PURE__ */ dual(2, (self, f) => new OnFailureImpl(self, f.length !== 1 ? (cause) => f(cause) : f));\nvar OnFailureProto = /* @__PURE__ */ makePrimitiveProto({\n op: \"OnFailure\",\n [evaluate]: evaluateCont\n});\nvar OnFailureImpl = function(self, f) {\n this[args] = self;\n this[contE] = f;\n};\nOnFailureImpl.prototype = OnFailureProto;\nvar catchCauseFilter = /* @__PURE__ */ dual(3, (self, filter2, f) => catchCause(self, (cause) => {\n const eb = filter2(cause);\n return isFailure2(eb) ? failCause(eb.failure) : f(eb.success, cause);\n}));\nvar catch_ = /* @__PURE__ */ dual(2, (self, f) => catchCauseFilter(self, findError, (e) => f(e)));\nvar mapError = /* @__PURE__ */ dual(2, (self, f) => catch_(self, (error) => failSync(() => f(error))));\nvar OnSuccessAndFailureProto = /* @__PURE__ */ makePrimitiveProto({\n op: \"OnSuccessAndFailure\",\n [evaluate]: evaluateCont\n});\nvar OnSuccessAndFailureImpl = function(self, onSuccess, onFailure) {\n this[args] = self;\n this[contA] = onSuccess;\n this[contE] = onFailure;\n};\nOnSuccessAndFailureImpl.prototype = OnSuccessAndFailureProto;\nvar exit = (self) => effectIsExit(self) ? exitSucceed(self) : exitPrimitive(self);\nvar exitPrimitive = /* @__PURE__ */ makePrimitive({\n op: \"Exit\",\n [evaluate](fiber2) {\n fiber2._stack.push(this);\n return this[args];\n },\n [contA](value, fiber2, exit3) {\n return fiber2.succeedWith(exit3 ?? exitSucceed(value));\n },\n [contE](cause, fiber2, exit3) {\n return fiber2.succeedWith(exit3 ?? exitFailCause(cause));\n }\n});\nvar combineFinalizerCause = (exit_, finalizer) => exitIsSuccess(exit_) ? finalizer : catchCause(finalizer, (cause) => failCause(causeCombine(exit_.cause, cause)));\nvar uninterruptible = (self) => withFiber((fiber2) => {\n if (!fiber2.interruptible) return self;\n fiber2.interruptible = false;\n fiber2._stack.push(setInterruptibleTrue);\n return self;\n});\nvar setInterruptible = /* @__PURE__ */ makePrimitive({\n op: \"SetInterruptible\",\n [contAll](fiber2) {\n fiber2.interruptible = this[args];\n if (fiber2._interruptedCause && fiber2.interruptible) {\n return () => failCause(fiber2._interruptedCause);\n }\n }\n});\nvar setInterruptibleTrue = /* @__PURE__ */ setInterruptible(true);\nvar whileLoop = /* @__PURE__ */ makePrimitive({\n op: \"While\",\n [contA](value, fiber2) {\n this[args].step(value);\n if (this[args].while()) {\n fiber2._stack.push(this);\n return this[args].body();\n }\n return exitVoid;\n },\n [evaluate](fiber2) {\n if (this[args].while()) {\n fiber2._stack.push(this);\n return this[args].body();\n }\n return exitVoid;\n }\n});\nvar resolveConcurrency = (concurrency) => concurrency === \"unbounded\" ? Number.POSITIVE_INFINITY : Math.max(1, concurrency ?? 1);\nvar iterateEager = () => (options) => {\n const onItem = options.onItem;\n const step = options.step;\n const resumeSequential = (state, items, index, end, effect) => flatMap(exit(effect), (itemExit) => step(state, items[index], itemExit, index) ?? runSequential(state, items, index + 1, end) ?? void_);\n const runSequential = (state, items, index = 0, end = items.length) => {\n for (; index < end; index++) {\n const item = items[index];\n const effect = onItem(state, item, index);\n if (!effectIsExit(effect)) {\n return resumeSequential(state, items, index, end, effect);\n }\n const terminal = step(state, item, effect, index);\n if (terminal) return terminal._tag === \"Failure\" ? terminal : void 0;\n }\n };\n return runSequential;\n};\nvar iterateConcurrentImpl = (options) => {\n const onItem = options.onItem;\n const step = options.step;\n return (state, items, opts) => {\n let index = 0;\n const end = opts.end ?? items.length;\n const concurrency = opts.concurrency;\n let done2 = false;\n let parentFiber;\n let fibers;\n let resume;\n let terminal;\n let effect;\n const failDefect = (error) => {\n const defect = exitDie(error);\n terminal = defect;\n done2 = true;\n return fibers && fibers.size > 0 ? flatMap(uninterruptible(fiberInterruptAll(Array.from(fibers))), () => terminal ?? defect) : defect;\n };\n const go = () => {\n let paused = false;\n for (; !terminal && index < end; index++) {\n const item = items[index];\n const eff = effect ?? onItem(state, item, index);\n if (effectIsExit(eff)) {\n terminal = step(state, item, eff, index);\n if (terminal) break;\n } else if (!parentFiber) {\n return callback((cb) => {\n parentFiber = getCurrentFiber();\n fibers = /* @__PURE__ */ new Set();\n effect = eff;\n resume = cb;\n let result2;\n try {\n result2 = go();\n } catch (error) {\n return cb(failDefect(error));\n }\n if (result2) return cb(result2);\n return suspend(() => {\n terminal ??= exitVoid;\n return flatMap(fibers ? fiberInterruptAll(fibers) : void_, () => terminal?._tag === \"Failure\" ? terminal : void_);\n });\n });\n } else {\n effect = void 0;\n const fiber2 = forkUnsafe(parentFiber, eff, true, true, \"inherit\");\n if (fiber2._exit) {\n terminal = step(state, item, fiber2._exit, index);\n if (terminal) break;\n continue;\n }\n fibers.add(fiber2);\n const currentIndex = index;\n fiber2.addObserver((exit3) => {\n fibers.delete(fiber2);\n try {\n if (terminal) {\n if (exit3._tag === \"Failure\") {\n const reasons = exit3.cause.reasons.filter((reason) => reason._tag !== \"Interrupt\");\n if (reasons.length > 0) {\n const cause = causeFromReasons(reasons);\n terminal = exitFailCause(terminal._tag === \"Failure\" ? causeCombine(terminal.cause, cause) : cause);\n }\n }\n } else {\n const result2 = step(state, item, exit3, currentIndex);\n if (result2) {\n terminal = result2;\n go();\n }\n }\n if (paused) {\n const eff2 = go();\n if (eff2) resume(eff2);\n } else if (done2 && fibers.size === 0) {\n resume(terminal ?? void_);\n }\n } catch (error) {\n resume(failDefect(error));\n }\n });\n if (fibers.size < concurrency) continue;\n paused = true;\n index++;\n return;\n }\n }\n done2 = true;\n if (terminal) {\n if (fibers && fibers.size > 0) {\n const annotations = fiberStackAnnotations(parentFiber);\n fibers.forEach((f) => f.interruptUnsafe(parentFiber.id, annotations));\n return;\n }\n if (resume || terminal._tag === \"Failure\") {\n return terminal;\n }\n } else if (resume) {\n if (!fibers) {\n return exitVoid;\n } else if (fibers.size === 0) {\n resume(void_);\n }\n }\n };\n return go();\n };\n};\nvar iterateConcurrent = () => (options) => iterateConcurrentImpl(options);\nvar forkUnsafe = (parent, effect, immediate = false, daemon = false, uninterruptible2 = false) => {\n const parentRuntime = parent;\n const interruptible2 = uninterruptible2 === \"inherit\" ? parentRuntime.interruptible : !uninterruptible2;\n const child = new FiberImpl(parentRuntime.context, interruptible2);\n if (!daemon) {\n parentRuntime.children().add(child);\n child._parent = parentRuntime;\n }\n if (immediate) {\n child.evaluate(effect);\n } else {\n child._asyncContext = captureAsyncContext();\n parentRuntime.currentDispatcher.scheduleTask(() => child.evaluate(effect), 0);\n }\n return child;\n};\nvar runForkWith = (context2) => (effect, options) => {\n const fiber2 = new FiberImpl(options?.scheduler ? add(context2, Scheduler, options.scheduler) : context2, options?.uninterruptible !== true);\n fiber2.evaluate(effect);\n if (fiber2._exit) return fiber2;\n if (options?.signal) {\n if (options.signal.aborted) {\n fiber2.interruptUnsafe();\n } else {\n const abort = () => fiber2.interruptUnsafe();\n options.signal.addEventListener(\"abort\", abort, {\n once: true\n });\n fiber2.addObserver(() => options.signal.removeEventListener(\"abort\", abort));\n }\n }\n if (options?.onFiberStart) {\n options.onFiberStart(fiber2);\n }\n return fiber2;\n};\nvar runSyncExitWith = (context2) => {\n const runFork2 = runForkWith(context2);\n return (effect) => {\n if (effectIsExit(effect)) return effect;\n const scheduler = new MixedScheduler(\"sync\");\n const fiber2 = runFork2(effect, {\n scheduler\n });\n fiber2._dispatcher?.flush();\n return fiber2._exit ?? exitDie(new AsyncFiberError(fiber2));\n };\n};\nvar runSyncExit = /* @__PURE__ */ runSyncExitWith(/* @__PURE__ */ empty2());\nvar MAX_TIMER_MILLIS = 2 ** 31 - 1;\nvar TimeoutErrorTypeId = \"~effect/Cause/TimeoutError\";\nvar TimeoutError = class extends (/* @__PURE__ */ TaggedError(\"TimeoutError\")) {\n [TimeoutErrorTypeId] = TimeoutErrorTypeId;\n constructor(message) {\n super({\n message\n });\n }\n};\nvar IllegalArgumentErrorTypeId = \"~effect/Cause/IllegalArgumentError\";\nvar IllegalArgumentError = class extends (/* @__PURE__ */ TaggedError(\"IllegalArgumentError\")) {\n [IllegalArgumentErrorTypeId] = IllegalArgumentErrorTypeId;\n constructor(message) {\n super({\n message\n });\n }\n};\nvar ExceededCapacityErrorTypeId = \"~effect/Cause/ExceededCapacityError\";\nvar ExceededCapacityError = class extends (/* @__PURE__ */ TaggedError(\"ExceededCapacityError\")) {\n [ExceededCapacityErrorTypeId] = ExceededCapacityErrorTypeId;\n constructor(message) {\n super({\n message\n });\n }\n};\nvar AsyncFiberErrorTypeId = \"~effect/Cause/AsyncFiberError\";\nvar AsyncFiberError = class extends (/* @__PURE__ */ TaggedError(\"AsyncFiberError\")) {\n [AsyncFiberErrorTypeId] = AsyncFiberErrorTypeId;\n constructor(fiber2) {\n super({\n message: \"An asynchronous Effect was executed with Effect.runSync\",\n fiber: fiber2\n });\n }\n};\nvar UnknownErrorTypeId = \"~effect/Cause/UnknownError\";\nvar UnknownError = class extends (/* @__PURE__ */ TaggedError(\"UnknownError\")) {\n [UnknownErrorTypeId] = UnknownErrorTypeId;\n constructor(cause, message) {\n super({\n message,\n cause\n });\n }\n};\nvar LoggerTypeId = \"~effect/Logger\";\nvar LoggerProto = {\n [LoggerTypeId]: {\n _Message: identity,\n _Output: identity\n },\n pipe() {\n return pipeArguments(this, arguments);\n }\n};\nvar colors = {\n bold: \"1\",\n red: \"31\",\n green: \"32\",\n yellow: \"33\",\n blue: \"34\",\n cyan: \"36\",\n white: \"37\",\n gray: \"90\",\n black: \"30\",\n bgBrightRed: \"101\"\n};\nvar logLevelColors = {\n None: [],\n All: [],\n Trace: [colors.gray],\n Debug: [colors.blue],\n Info: [colors.green],\n Warn: [colors.yellow],\n Error: [colors.red],\n Fatal: [colors.bgBrightRed, colors.black]\n};\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Cause.js\nvar isFailReason2 = isFailReason;\nvar die2 = causeDie;\nvar map3 = causeMap;\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Exit.js\nvar succeed4 = exitSucceed;\nvar failCause2 = exitFailCause;\nvar fail4 = exitFail;\nvar void_2 = exitVoid;\nvar isSuccess3 = exitIsSuccess;\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Effect.js\nvar tryPromise2 = tryPromise;\nvar succeed5 = succeed3;\nvar suspend2 = suspend;\nvar fail5 = fail3;\nvar failCauseSync2 = failCauseSync;\nvar die3 = die;\nvar try_2 = try_;\nvar fromResult2 = fromResult;\nvar flatMap2 = flatMap;\nvar exit2 = exit;\nvar catchCause2 = catchCause;\nvar runSyncExit2 = runSyncExit;\nvar mapEager2 = mapEager;\nvar mapErrorEager2 = mapErrorEager;\nvar flatMapEager2 = flatMapEager;\nvar fnUntracedEager2 = fnUntracedEager;\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/encoding/Base64.js\nvar encode = (input) => encodeBytes(typeof input === \"string\" ? encoder.encode(input) : input);\nvar decode = (str) => {\n const stripped = stripCrlf(str);\n const length = stripped.length;\n if (length % 4 !== 0) {\n return fail2(new EncodingError({\n kind: \"Decode\",\n module: \"Base64\",\n input: stripped,\n message: `Length must be a multiple of 4, but is ${length}`\n }));\n }\n const index = stripped.indexOf(\"=\");\n if (index !== -1 && (index < length - 2 || index === length - 2 && stripped[length - 1] !== \"=\")) {\n return fail2(new EncodingError({\n kind: \"Decode\",\n module: \"Base64\",\n input: stripped,\n message: \"Found a '=' character, but it is not at the end\"\n }));\n }\n try {\n const missingOctets = stripped.endsWith(\"==\") ? 2 : stripped.endsWith(\"=\") ? 1 : 0;\n const result2 = new Uint8Array(3 * (length / 4) - missingOctets);\n for (let i = 0, j = 0; i < length; i += 4, j += 3) {\n const buffer = getCode(stripped.charCodeAt(i)) << 18 | getCode(stripped.charCodeAt(i + 1)) << 12 | getCode(stripped.charCodeAt(i + 2)) << 6 | getCode(stripped.charCodeAt(i + 3));\n result2[j] = buffer >> 16;\n result2[j + 1] = buffer >> 8 & 255;\n result2[j + 2] = buffer & 255;\n }\n return succeed2(result2);\n } catch (cause) {\n return fail2(new EncodingError({\n kind: \"Decode\",\n module: \"Base64\",\n input: stripped,\n message: cause instanceof Error ? cause.message : \"Invalid input\"\n }));\n }\n};\nvar encodeBytes = (bytes) => {\n const length = bytes.length;\n let result2 = \"\";\n let i;\n for (i = 2; i < length; i += 3) {\n result2 += alphabet[bytes[i - 2] >> 2];\n result2 += alphabet[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];\n result2 += alphabet[(bytes[i - 1] & 15) << 2 | bytes[i] >> 6];\n result2 += alphabet[bytes[i] & 63];\n }\n if (i === length + 1) {\n result2 += alphabet[bytes[i - 2] >> 2];\n result2 += alphabet[(bytes[i - 2] & 3) << 4];\n result2 += \"==\";\n }\n if (i === length) {\n result2 += alphabet[bytes[i - 2] >> 2];\n result2 += alphabet[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];\n result2 += alphabet[(bytes[i - 1] & 15) << 2];\n result2 += \"=\";\n }\n return result2;\n};\nvar encoder = /* @__PURE__ */ new TextEncoder();\nvar stripCrlf = (str) => str.replace(/[\\n\\r]/g, \"\");\nvar alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar codes = /* @__PURE__ */ new Uint8Array(123).fill(255);\nfor (let i = 0; i < alphabet.length; i++) codes[/* @__PURE__ */ alphabet.charCodeAt(i)] = i;\ncodes[/* @__PURE__ */ \"=\".charCodeAt(0)] = 0;\nvar getCode = (charCode) => {\n if (charCode >= codes.length || codes[charCode] === 255) {\n throw new TypeError(`Invalid character ${String.fromCharCode(charCode)}`);\n }\n return codes[charCode];\n};\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/annotations.js\nfunction resolve(ast) {\n return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;\n}\nvar STRUCTURAL_ANNOTATION_KEY = \"~structural\";\nvar SENTINELS_ANNOTATION_KEY = \"~sentinels\";\nvar CONSTRUCTOR_ANNOTATION_KEY = \"~constructor\";\nvar getExpected = /* @__PURE__ */ memoize((ast) => {\n const identifier2 = resolve(ast)?.identifier;\n if (typeof identifier2 === \"string\") return identifier2;\n return ast.getExpected(getExpected);\n});\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/parser.js\nvar missing = /* @__PURE__ */ Symbol();\nvar succeed6 = succeed4;\nvar missingExit = /* @__PURE__ */ succeed6(missing);\nvar sameExit = /* @__PURE__ */ succeed6(missing);\nvar toOption = (value) => value === missing ? none2() : some2(value);\nvar fromOptionExit = (option2) => option2._tag === \"None\" ? missingExit : succeed6(option2.value);\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/SchemaIssue.js\nvar TypeId4 = \"~effect/SchemaIssue/Issue\";\nfunction isIssue(u) {\n return hasProperty(u, TypeId4) && u[TypeId4] === TypeId4;\n}\nfunction hasInput(issue) {\n return Object.hasOwn(issue, \"input\");\n}\nvar IssueNodeImpl = class {\n [TypeId4] = TypeId4;\n constructor(input, options) {\n if (options?.reportInput === true && input !== missing) {\n this.input = input;\n }\n }\n};\nvar Filter = class extends IssueNodeImpl {\n _tag = \"Filter\";\n /**\n * The filter that failed.\n */\n filter;\n /**\n * The issue that occurred.\n */\n issue;\n constructor(filter2, issue, input, options) {\n super(input, options);\n this.filter = filter2;\n this.issue = issue;\n }\n};\nvar Encoding = class extends IssueNodeImpl {\n _tag = \"Encoding\";\n /**\n * The schema that caused the issue.\n */\n ast;\n /**\n * The issue that occurred.\n */\n issue;\n constructor(ast, issue, input, options) {\n super(input, options);\n this.ast = ast;\n this.issue = issue;\n }\n};\nvar Pointer = class extends IssueNodeImpl {\n _tag = \"Pointer\";\n /**\n * The path to the location in the input that caused the issue.\n */\n path;\n /**\n * The issue that occurred.\n */\n issue;\n constructor(path, issue) {\n super();\n this.path = path;\n this.issue = issue;\n }\n};\nvar MissingKey = class extends IssueNodeImpl {\n _tag = \"MissingKey\";\n /**\n * The metadata for the issue.\n */\n annotations;\n constructor(annotations) {\n super();\n this.annotations = annotations;\n }\n};\nvar UnexpectedKey = class extends IssueNodeImpl {\n _tag = \"UnexpectedKey\";\n /**\n * The schema that caused the issue.\n */\n ast;\n constructor(ast, input, options) {\n super(input, options);\n this.ast = ast;\n }\n};\nvar Composite = class extends IssueNodeImpl {\n _tag = \"Composite\";\n /**\n * The schema that caused the issue.\n */\n ast;\n /**\n * The issues that occurred.\n */\n issues;\n constructor(ast, issues, input, options) {\n super(input, options);\n this.ast = ast;\n this.issues = issues;\n }\n};\nvar InvalidType = class extends IssueNodeImpl {\n _tag = \"InvalidType\";\n /**\n * The schema that caused the issue.\n */\n ast;\n constructor(ast, input, options) {\n super(input, options);\n this.ast = ast;\n }\n};\nvar InvalidValue = class extends IssueNodeImpl {\n _tag = \"InvalidValue\";\n /**\n * The metadata for the issue.\n */\n annotations;\n constructor(annotations, input, options) {\n super(input, options);\n this.annotations = annotations;\n }\n};\nvar AnyOf = class extends IssueNodeImpl {\n _tag = \"AnyOf\";\n /**\n * The schema that caused the issue.\n */\n ast;\n /**\n * The issues that occurred.\n */\n issues;\n constructor(ast, issues, input, options) {\n super(input, options);\n this.ast = ast;\n this.issues = issues;\n }\n};\nvar OneOf = class extends IssueNodeImpl {\n _tag = \"OneOf\";\n /**\n * The schema that caused the issue.\n */\n ast;\n /**\n * The schemas that were successful.\n */\n successes;\n constructor(ast, successes, input, options) {\n super(input, options);\n this.ast = ast;\n this.successes = successes;\n }\n};\nfunction makeFilterIssue(entry, input, options) {\n if (isIssue(entry)) {\n return entry;\n }\n if (typeof entry === \"string\") {\n return new InvalidValue({\n message: entry\n }, input, options);\n }\n const inner = typeof entry.issue === \"string\" ? new InvalidValue({\n message: entry.issue\n }, input, options) : entry.issue;\n return new Pointer(entry.path, inner);\n}\nfunction makeSingle(out, input, options) {\n if (out === void 0) {\n return void 0;\n }\n if (typeof out === \"boolean\") {\n return out ? void 0 : new InvalidValue(void 0, input, options);\n }\n return makeFilterIssue(out, input, options);\n}\nfunction normalizeFilterOutput(ast, out, input, options) {\n if (Array.isArray(out)) {\n if (!isReadonlyArrayNonEmpty(out)) {\n return void 0;\n }\n return out.length === 1 ? makeFilterIssue(out[0], input, options) : new Composite(ast, map(out, (entry) => makeFilterIssue(entry, input, options)), input, options);\n }\n return makeSingle(out, input, options);\n}\nvar defaultLeafHook = (issue) => {\n const message = findMessage(issue);\n if (message !== void 0) return message;\n switch (issue._tag) {\n case \"InvalidType\":\n return getExpectedMessage(getExpected(issue.ast), issue);\n case \"InvalidValue\": {\n const expected = findExpected(issue);\n if (expected !== void 0) return getExpectedMessage(expected, issue);\n const input = formatInput(issue);\n return input === void 0 ? \"Expected a valid value\" : `Invalid data ${input}`;\n }\n case \"MissingKey\":\n return \"Missing key\";\n case \"UnexpectedKey\": {\n const input = formatInput(issue);\n return input === void 0 ? \"Expected no excess property\" : `Unexpected key with value ${input}`;\n }\n case \"Forbidden\":\n return \"Forbidden operation\";\n case \"OneOf\": {\n const input = formatInput(issue);\n return input === void 0 ? \"Expected exactly one member to match\" : `Expected exactly one member to match the input ${input}`;\n }\n }\n};\nvar defaultCheckHook = (issue) => findMessage(issue.issue) ?? findMessage(issue);\nfunction formatInput(issue) {\n return hasInput(issue) ? format(issue.input) : void 0;\n}\nfunction findExpected(issue) {\n const expected = issue.annotations?.expected;\n return typeof expected === \"string\" ? expected : void 0;\n}\nfunction getExpectedMessage(expected, issue) {\n const input = formatInput(issue);\n return input === void 0 ? `Expected ${expected}` : `Expected ${expected}, got ${input}`;\n}\nfunction formatCheck(check) {\n const expected = check.annotations?.expected;\n if (typeof expected === \"string\") return expected;\n switch (check._tag) {\n case \"Filter\":\n return \"<filter>\";\n case \"FilterGroup\":\n return check.checks.map((check2) => formatCheck(check2)).join(\" & \");\n }\n}\nfunction makeFormatterDefault() {\n return (issue) => formatIssue(issue, \"\");\n}\nvar defaultFormatter = /* @__PURE__ */ makeFormatterDefault();\nfunction formatIssue(issue, path) {\n let message;\n switch (issue._tag) {\n case \"Filter\": {\n const annotated = defaultCheckHook(issue);\n if (annotated !== void 0) {\n message = annotated;\n } else {\n if (issue.issue._tag !== \"InvalidValue\") {\n return formatIssue(issue.issue, path);\n }\n const expected = findExpected(issue.issue);\n message = expected === void 0 ? getExpectedMessage(formatCheck(issue.filter), issue) : getExpectedMessage(expected, issue.issue);\n }\n break;\n }\n case \"Encoding\":\n return formatIssue(issue.issue, path);\n case \"Pointer\":\n return formatIssue(issue.issue, path + formatPath(issue.path));\n case \"Composite\":\n case \"AnyOf\": {\n if (issue._tag === \"Composite\" || issue.issues.length > 0) {\n return issue.issues.map((issue2) => formatIssue(issue2, path)).join(\"\\n\");\n }\n message = findMessage(issue) ?? getExpectedMessage(getExpected(issue.ast), issue);\n break;\n }\n default:\n message = defaultLeafHook(issue);\n break;\n }\n return path ? `${message}\n at ${path}` : message;\n}\nfunction findMessage(issue) {\n if (issue._tag === \"Pointer\") return;\n if (issue._tag === \"Encoding\") return findMessage(issue.issue);\n const annotations = issue._tag === \"Filter\" ? issue.filter.annotations : \"annotations\" in issue ? issue.annotations : issue.ast.annotations;\n const message = annotations?.[issue._tag === \"MissingKey\" ? \"messageMissingKey\" : issue._tag === \"UnexpectedKey\" ? \"messageUnexpectedKey\" : \"message\"];\n if (typeof message === \"string\") return message;\n}\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/cause.js\nfunction getSchemaIssue(cause) {\n let issue;\n for (const reason of cause.reasons) {\n if (!isFailReason2(reason) || !isIssue(reason.error)) {\n return void 0;\n }\n issue ??= reason.error;\n }\n return issue;\n}\nfunction getSchemaIssueOrThrow(cause, message) {\n const issue = getSchemaIssue(cause);\n if (issue === void 0) {\n throw new Error(message, {\n cause\n });\n }\n return issue;\n}\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/SchemaGetter.js\nvar makeGetter = (fields) => Object.assign(Object.create(Prototype), fields);\nvar passthrough_ = /* @__PURE__ */ makeGetter({\n _tag: \"Passthrough\"\n});\nfunction passthrough() {\n return passthrough_;\n}\nfunction transform(f) {\n return makeGetter({\n _tag: \"Transform\",\n transform: f\n });\n}\nfunction transformEffect(f) {\n return makeGetter({\n _tag: \"TransformEffect\",\n transform: f\n });\n}\nfunction String2() {\n return transform(globalThis.String);\n}\nfunction Number2() {\n return transform(globalThis.Number);\n}\nfunction parseJson(options) {\n return transformEffect((input, parseOptions) => try_2({\n try: () => JSON.parse(input, options?.reviver),\n catch: () => new InvalidValue({\n expected: \"a valid JSON string\"\n }, input, parseOptions)\n }));\n}\nfunction stringifyJson(options) {\n return transformEffect((input, parseOptions) => try_2({\n try: () => {\n const output = JSON.stringify(input, options?.replacer, options?.space);\n if (output === void 0) {\n throw new TypeError(\"Value cannot be represented as JSON\");\n }\n return output;\n },\n catch: () => new InvalidValue({\n expected: \"a JSON-serializable value\"\n }, input, parseOptions)\n }));\n}\nfunction encodeBase64() {\n return transform(encode);\n}\nfunction decodeBase64() {\n return transformEffect((input, options) => mapErrorEager2(fromResult2(decode(input)), () => new InvalidValue({\n expected: \"a valid Base64 string\"\n }, input, options)));\n}\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/SchemaTransformation.js\nvar TypeId5 = \"~effect/SchemaTransformation/Transformation\";\nvar Transformation = class extends Class {\n [TypeId5] = TypeId5;\n _tag = \"Transformation\";\n decode;\n encode;\n constructor(decode2, encode2) {\n super();\n this.decode = decode2;\n this.encode = encode2;\n }\n flip() {\n return new Transformation(this.encode, this.decode);\n }\n};\nfunction isTransformation(u) {\n return hasProperty(u, TypeId5) && u[TypeId5] === TypeId5;\n}\nvar makeTransformation = (options) => {\n if (isTransformation(options)) {\n return options;\n }\n return new Transformation(options.decode, options.encode);\n};\nfunction transformEffect2(options) {\n return new Transformation(transformEffect(options.decode), transformEffect(options.encode));\n}\nfunction transform2(options) {\n return new Transformation(transform(options.decode), transform(options.encode));\n}\nvar passthrough_2 = /* @__PURE__ */ new Transformation(/* @__PURE__ */ passthrough(), /* @__PURE__ */ passthrough());\nfunction passthrough2() {\n return passthrough_2;\n}\nvar numberFromString = /* @__PURE__ */ new Transformation(/* @__PURE__ */ Number2(), /* @__PURE__ */ String2());\nvar urlFromString = /* @__PURE__ */ transformEffect2({\n decode: (s, options) => URL.canParse(s) ? succeed5(new URL(s)) : fail5(new InvalidValue({\n expected: \"a valid URL string\"\n }, s, options)),\n encode: (url) => succeed5(url.href)\n});\nvar uint8ArrayFromBase64String = /* @__PURE__ */ new Transformation(/* @__PURE__ */ decodeBase64(), /* @__PURE__ */ encodeBase64());\nfunction fromJsonString(options) {\n return new Transformation(parseJson(options ?? {}), stringifyJson(options));\n}\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/SchemaAST.js\nfunction makeGuard(tag2) {\n return (ast) => ast._tag === tag2;\n}\nvar isDeclaration = /* @__PURE__ */ makeGuard(\"Declaration\");\nvar isNever2 = /* @__PURE__ */ makeGuard(\"Never\");\nvar isLiteral = /* @__PURE__ */ makeGuard(\"Literal\");\nvar isUniqueSymbol = /* @__PURE__ */ makeGuard(\"UniqueSymbol\");\nvar isArrays = /* @__PURE__ */ makeGuard(\"Arrays\");\nvar isObjects = /* @__PURE__ */ makeGuard(\"Objects\");\nvar isSuspend = /* @__PURE__ */ makeGuard(\"Suspend\");\nvar Link = class {\n to;\n transformation;\n constructor(to, transformation) {\n this.to = to;\n this.transformation = transformation;\n }\n};\nvar defaultParseOptions = {};\nvar Context = class {\n isOptional;\n isMutable;\n /** Used for constructor default values (e.g. `withConstructorDefault` API) */\n constructorDefault;\n annotations;\n constructor(isOptional2, isMutable, constructorDefault = void 0, annotations = void 0) {\n this.isOptional = isOptional2;\n this.isMutable = isMutable;\n this.constructorDefault = constructorDefault;\n this.annotations = annotations;\n }\n};\nvar TypeId6 = \"~effect/Schema\";\nvar ASTNodeImpl = class {\n [TypeId6] = TypeId6;\n annotations;\n checks;\n encoding;\n context;\n constructor(annotations = void 0, checks = void 0, encoding = void 0, context2 = void 0) {\n this.annotations = annotations;\n this.checks = checks;\n this.encoding = encoding;\n this.context = context2;\n }\n toString() {\n return `<${this._tag}>`;\n }\n};\nvar Declaration = class extends ASTNodeImpl {\n _tag = \"Declaration\";\n typeParameters;\n run;\n encodingChecks;\n /**\n * Parser factory {@link flip} swaps in, so a declaration can behave\n * differently when encoding. `undefined` reuses `run`.\n */\n encodingRun;\n constructor(typeParameters, run2, annotations, checks, encoding, context2, encodingChecks, encodingRun) {\n super(annotations, checks, encoding, context2);\n this.typeParameters = typeParameters;\n this.run = run2;\n this.encodingChecks = encodingChecks;\n this.encodingRun = encodingRun;\n }\n /** @internal */\n getParser() {\n let run2;\n return (input, options) => {\n if (input === missing) return missingExit;\n return (run2 ??= this.run(this.typeParameters))(input, this, options);\n };\n }\n _rebuild(recur, checks, encodingChecks, run2, encodingRun) {\n const tps = mapOrSame(this.typeParameters, recur);\n return tps === this.typeParameters && checks === this.checks && encodingChecks === this.encodingChecks && run2 === this.run && encodingRun === this.encodingRun ? this : new Declaration(tps, run2, this.annotations, checks, void 0, this.context, encodingChecks, encodingRun);\n }\n /** @internal */\n recur(recur) {\n return this._rebuild(recur, this.checks, this.encodingChecks, this.run, this.encodingRun);\n }\n /** @internal */\n flip(recur) {\n return this._rebuild(recur, this.encodingChecks, this.checks, this.encodingRun ?? this.run, this.run);\n }\n /** @internal */\n getExpected() {\n const expected = this.annotations?.expected;\n if (typeof expected === \"string\") return expected;\n return \"<Declaration>\";\n }\n};\nvar Unknown = class extends ASTNodeImpl {\n _tag = \"Unknown\";\n /** @internal */\n getParser() {\n return fromRefinement(this, isUnknown);\n }\n /** @internal */\n getExpected() {\n return \"unknown\";\n }\n};\nvar unknown = /* @__PURE__ */ new Unknown();\nvar Literal = class extends ASTNodeImpl {\n _tag = \"Literal\";\n literal;\n constructor(literal, annotations, checks, encoding, context2) {\n super(annotations, checks, encoding, context2);\n if (typeof literal === \"number\" && !globalThis.Number.isFinite(literal)) {\n throw new Error(`A numeric literal must be finite, got ${format(literal)}`);\n }\n this.literal = literal;\n }\n /** @internal */\n getParser() {\n return fromConst(this, this.literal);\n }\n /** @internal */\n matchPart(s, _options) {\n return s === globalThis.String(this.literal) ? this.literal : void 0;\n }\n /** @internal */\n toCodecJson() {\n return typeof this.literal === \"bigint\" ? literalToString(this) : this;\n }\n /** @internal */\n toCodecStringTree() {\n return typeof this.literal === \"string\" ? this : literalToString(this);\n }\n /** @internal */\n getExpected() {\n return typeof this.literal === \"string\" ? JSON.stringify(this.literal) : globalThis.String(this.literal);\n }\n};\nfunction literalToString(ast) {\n const literalAsString = globalThis.String(ast.literal);\n return replaceEncoding(ast, [new Link(new Literal(literalAsString), new Transformation(transform(() => ast.literal), transform(() => literalAsString)))]);\n}\nvar String3 = class extends ASTNodeImpl {\n _tag = \"String\";\n /** @internal */\n getParser() {\n return fromRefinement(this, isString);\n }\n /** @internal */\n matchPart(s, options) {\n const checks = this.checks;\n return checks && !options.disableChecks && collectIssues(checks, s, void 0, this, options) ? void 0 : s;\n }\n /** @internal */\n getExpected() {\n return \"string\";\n }\n};\nvar string2 = /* @__PURE__ */ new String3();\nvar Number3 = class extends ASTNodeImpl {\n _tag = \"Number\";\n /** @internal */\n getParser() {\n return fromRefinement(this, isNumber);\n }\n /** @internal */\n matchKey(s, options) {\n return this._match(isStringNumberRegExp, s, options);\n }\n /** @internal */\n matchPart(s, options) {\n return this._match(isStringFiniteRegExp, s, options);\n }\n _match(regexp, s, options) {\n if (!regexp.test(s)) return void 0;\n const value = globalThis.Number(s);\n if (options.disableChecks || !this.checks) return value;\n return collectIssues(this.checks, value, void 0, this, options) ? void 0 : value;\n }\n /** @internal */\n toCodecJson() {\n if (this.checks && (hasCheck(this.checks, \"effect/schema/isFinite\") || hasCheck(this.checks, \"effect/schema/isInt\"))) {\n return this;\n }\n return replaceEncoding(this, [numberToJson]);\n }\n /** @internal */\n toCodecStringTree() {\n if (this.toCodecJson() === this) {\n return replaceEncoding(this, [finiteToString]);\n }\n return replaceEncoding(this, [numberToString]);\n }\n /** @internal */\n getExpected() {\n return \"number\";\n }\n};\nfunction hasCheck(checks, id) {\n return checks.some((check) => check.annotations?.representation?.id === id || check._tag === \"FilterGroup\" && hasCheck(check.checks, id));\n}\nvar number2 = /* @__PURE__ */ new Number3();\nvar Arrays = class extends ASTNodeImpl {\n _tag = \"Arrays\";\n isMutable;\n elements;\n rest;\n encodingChecks;\n constructor(isMutable, elements, rest, annotations, checks, encoding, context2, encodingChecks) {\n super(annotations, checks, encoding, context2);\n this.isMutable = isMutable;\n this.elements = elements;\n this.rest = rest;\n this.encodingChecks = encodingChecks;\n let hasOptional = false;\n for (let i = 0; i < elements.length; i++) {\n if (isOptional(elements[i])) {\n hasOptional = true;\n } else if (hasOptional) {\n throw new Error(\"A required element cannot follow an optional element. ts(1257)\");\n }\n }\n if (hasOptional && rest.length > 1) {\n throw new Error(\"A required element cannot follow an optional element. ts(1257)\");\n }\n for (let i = 1; i < rest.length; i++) {\n if (isOptional(rest[i])) {\n throw new Error(\"An optional element cannot follow a rest element. ts(1266)\");\n }\n }\n }\n /** @internal */\n getParser(compile2, compileField2 = compile2) {\n const ast = this;\n let elements;\n let rest;\n const elementLen = ast.elements.length;\n const tailLen = Math.max(0, ast.rest.length - 1);\n function getParser(tailThreshold, index) {\n if (index < elementLen) {\n return elements[index];\n } else if (index >= tailThreshold) {\n return rest[index - tailThreshold + 1];\n }\n return rest[0];\n }\n const finish = (state) => {\n const {\n input,\n len,\n options\n } = state;\n if (ast.rest.length === 0 && len > elementLen) {\n for (let i = elementLen; i < len; i++) {\n const unexpected = new UnexpectedKey(ast, input[i], options);\n const issue = new Pointer([i], unexpected);\n if (options.errors === \"all\") {\n if (state.issues) state.issues.push(issue);\n else state.issues = [issue];\n } else {\n return fail5(new Composite(ast, [issue], input, options));\n }\n }\n }\n if (state.issues) {\n return fail5(new Composite(ast, state.issues, input, options));\n }\n return succeed6(state.output);\n };\n const parse = (input, options) => {\n const len = input.length;\n const state = {\n ast,\n getParser,\n input,\n len,\n tailThreshold: Math.max(elementLen, len - tailLen),\n output: new globalThis.Array(len),\n issues: void 0,\n options\n };\n const end = ast.rest.length === 0 ? elementLen : Math.max(len, elementLen + tailLen);\n const concurrency = options.concurrency === void 0 ? 1 : resolveConcurrency(options.concurrency);\n const eff = concurrency === 1 ? parseArray(state, input, 0, end) : parseArrayConcurrent(state, input, {\n concurrency,\n end\n });\n if (!eff) return finish(state);\n if (effectIsExit(eff)) return flatMapEager2(eff, () => finish(state));\n let first2 = true;\n return suspend2(() => {\n if (!first2) return parse(input, options);\n first2 = false;\n return flatMap2(eff, () => finish(state));\n });\n };\n return (input, options) => {\n if (input === missing) return missingExit;\n try {\n if (!Array.isArray(input)) {\n return fail5(new InvalidType(ast, input, options));\n }\n if (!elements) {\n elements = ast.elements.map((ast2) => ({\n ast: ast2,\n parser: compileField2(ast2)\n }));\n rest = ast.rest.map((ast2) => ({\n ast: ast2,\n parser: compileField2(ast2)\n }));\n }\n return parse(input, options);\n } catch (error) {\n return die3(error);\n }\n };\n }\n _rebuild(recur, checks, encodingChecks) {\n const elements = mapOrSame(this.elements, recur);\n const rest = mapOrSame(this.rest, recur);\n 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);\n }\n /** @internal */\n recur(recur) {\n return this._rebuild(recur, this.checks, this.encodingChecks);\n }\n /** @internal */\n flip(recur) {\n return this._rebuild(recur, this.encodingChecks, this.checks);\n }\n /** @internal */\n getExpected() {\n return \"array\";\n }\n};\nfunction stepArray(s, item, exit3, i) {\n if (exit3._tag === \"Failure\") {\n return wrapPropertyKeyIssue(s, s.ast, i, exit3);\n }\n const value = exit3 === sameExit ? item : exit3[args];\n if (value !== missing) {\n s.output[i] = value;\n } else {\n const p = s.getParser(s.tailThreshold, i);\n if (isOptional(p.ast)) return;\n const issue = new Pointer([i], new MissingKey(p.ast.context?.annotations));\n if (s.options.errors === \"all\") {\n if (s.issues) s.issues.push(issue);\n else s.issues = [issue];\n } else {\n return fail4(new Composite(s.ast, [issue], s.input, s.options));\n }\n }\n}\nvar parseArrayOptions = {\n onItem(s, item, i) {\n const value = i < s.len ? item : missing;\n return s.getParser(s.tailThreshold, i).parser(value, s.options);\n },\n step: stepArray\n};\nvar parseArray = /* @__PURE__ */ iterateEager()(parseArrayOptions);\nvar parseArrayConcurrent = /* @__PURE__ */ iterateConcurrent()(parseArrayOptions);\nvar wrapPropertyKeyIssue = (s, ast, key, exit3) => {\n if (exit3.cause.reasons.length === 0) {\n return exit3;\n }\n const issue = getSchemaIssue(exit3.cause);\n if (issue === void 0) {\n return failCause2(map3(exit3.cause, (issue2) => new Composite(ast, [new Pointer([key], issue2)], s.input, s.options)));\n }\n const pointer = new Pointer([key], issue);\n if (s.options.errors === \"all\") {\n if (s.issues) s.issues.push(pointer);\n else s.issues = [pointer];\n } else {\n return fail4(new Composite(ast, [pointer], s.input, s.options));\n }\n};\nvar FINITE_PATTERN = \"[+-]?\\\\d*\\\\.?\\\\d+(?:[Ee][+-]?\\\\d+)?\";\nfunction getIndexSignatureKeys(input, parameter, options = defaultParseOptions) {\n let stringKeys;\n let symbolKeys;\n function go(parameter2) {\n switch (parameter2._tag) {\n case \"String\":\n case \"TemplateLiteral\":\n return (stringKeys ??= Object.keys(input)).filter((k) => parameter2.matchPart(k, options) !== void 0);\n case \"Number\":\n return (stringKeys ??= Object.keys(input)).filter((k) => parameter2.matchKey(k, options) !== void 0);\n case \"Symbol\":\n return (symbolKeys ??= Object.getOwnPropertySymbols(input)).filter((k) => Object.prototype.propertyIsEnumerable.call(input, k) && parameter2.matchKey(k, options) !== void 0);\n case \"Union\":\n return [...new Set(parameter2.types.flatMap(go))];\n default:\n return [];\n }\n }\n return go(parameterFromPropertyKey(toEncoded(parameter)));\n}\nvar PropertySignature = class {\n name;\n type;\n constructor(name, type) {\n this.name = name;\n this.type = type;\n }\n};\nfunction isIndexSignatureParameterSide(ast) {\n switch (ast._tag) {\n case \"String\":\n case \"Number\":\n case \"Symbol\":\n case \"TemplateLiteral\":\n return true;\n case \"Union\":\n return ast.types.every(isIndexSignatureParameterSide);\n default:\n return false;\n }\n}\nfunction isIndexSignatureParameterEncodedSide(ast) {\n const encoded = getLastEncoding(ast);\n switch (encoded._tag) {\n case \"String\":\n case \"Number\":\n case \"Symbol\":\n case \"TemplateLiteral\":\n return true;\n case \"Union\":\n return encoded.types.every(isIndexSignatureParameterEncodedSide);\n default:\n return false;\n }\n}\nfunction isIndexSignatureParameter(ast) {\n return isIndexSignatureParameterSide(ast) && isIndexSignatureParameterEncodedSide(ast);\n}\nvar IndexSignature = class {\n parameter;\n type;\n constructor(parameter, type) {\n if (!isIndexSignatureParameter(parameter)) {\n throw new Error(`Invalid index signature parameter ${parameter._tag}`);\n }\n this.parameter = parameter;\n this.type = type;\n if (isOptional(type) && !containsUndefined(type)) {\n throw new Error(\"Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.\");\n }\n }\n};\nvar Objects = class extends ASTNodeImpl {\n _tag = \"Objects\";\n propertySignatures;\n indexSignatures;\n encodingChecks;\n constructor(propertySignatures, indexSignatures, annotations, checks, encoding, context2, encodingChecks) {\n super(annotations, checks, encoding, context2);\n this.propertySignatures = propertySignatures;\n this.indexSignatures = indexSignatures;\n this.encodingChecks = encodingChecks;\n }\n /** @internal */\n getParser(compile2, compileField2 = compile2) {\n const ast = this;\n const hasProperties = ast.propertySignatures.length;\n const indexCount = ast.indexSignatures.length;\n if (!hasProperties && !indexCount) {\n return fromRefinement(ast, isNotNullish);\n }\n let properties;\n let indexes;\n const compileMembers = () => {\n if (!properties) {\n properties = ast.propertySignatures.map((ps) => ({\n parser: compileField2(ps.type),\n name: ps.name,\n type: ps.type\n }));\n indexes = indexCount ? ast.indexSignatures.map((is2) => ({\n is: is2,\n parserKey: compile2(parameterFromPropertyKey(is2.parameter)),\n parserValue: compileField2(is2.type)\n })) : void 0;\n }\n return properties;\n };\n const makeFallback = () => {\n const expectedKeys = new Set(ast.propertySignatures.map((ps) => typeof ps.name === \"number\" ? globalThis.String(ps.name) : ps.name));\n const finishIndex = (s, key, k2, inputValue, exitValue) => {\n if (exitValue._tag === \"Failure\") {\n return wrapPropertyKeyIssue(s, ast, key, exitValue) ?? void_2;\n }\n const value = exitValue === sameExit ? inputValue : exitValue[args];\n if (k2 !== missing && value !== missing) {\n if (hasProperties && (expectedKeys.has(key) || expectedKeys.has(typeof k2 === \"number\" ? globalThis.String(k2) : k2))) return void_2;\n assignProperty(s.out, k2, value);\n }\n return void_2;\n };\n const parseIndex = (s, key, index, exitKey) => {\n if (!exitKey) {\n const eff = index.parserKey(key, s.options);\n if (!effectIsExit(eff)) {\n return flatMap2(exit2(eff), (exit3) => parseIndex(s, key, index, exit3));\n }\n exitKey = eff;\n }\n if (exitKey._tag === \"Failure\") {\n return wrapPropertyKeyIssue(s, ast, key, exitKey) ?? void_2;\n }\n const k2 = exitKey === sameExit ? key : exitKey[args];\n const inputValue = s.input[key];\n const result2 = index.parserValue(inputValue, s.options);\n return effectIsExit(result2) ? finishIndex(s, key, k2, inputValue, result2) : flatMap2(exit2(result2), (exit3) => finishIndex(s, key, k2, inputValue, exit3));\n };\n const parseStringIndex = (s, key, index) => {\n const inputValue = s.input[key];\n const result2 = index.parserValue(inputValue, s.options);\n return effectIsExit(result2) ? finishIndex(s, key, key, inputValue, result2) : flatMap2(exit2(result2), (exit3) => finishIndex(s, key, key, inputValue, exit3));\n };\n const parseIndexes = indexCount ? iterateConcurrent()({\n onItem: (s, [key, index]) => index.is.parameter === string2 ? parseStringIndex(s, key, index) : parseIndex(s, key, index),\n step: (_s, _item, exit3) => exit3._tag === \"Failure\" ? exit3 : void 0\n }) : void 0;\n return fnUntracedEager2(function* (input, options) {\n if (input === missing) {\n return missing;\n }\n if (!(typeof input === \"object\" && input !== null && !Array.isArray(input))) {\n return yield* fail5(new InvalidType(ast, input, options));\n }\n compileMembers();\n const record2 = input;\n const out = {};\n const state = {\n ast,\n input: record2,\n out,\n issues: void 0,\n options\n };\n const errorsAllOption = options.errors === \"all\";\n const onExcessPropertyError = options.onExcessProperty === \"error\";\n const concurrency = options.concurrency === void 0 ? 1 : resolveConcurrency(options.concurrency);\n const indexKeys = indexCount && onExcessPropertyError ? ast.indexSignatures.map((index) => getIndexSignatureKeys(record2, index.parameter, options)) : void 0;\n if (onExcessPropertyError) {\n const coveredKeys = indexKeys ? new Set(expectedKeys) : expectedKeys;\n if (indexKeys) {\n for (const keys of indexKeys) {\n for (const key of keys) coveredKeys.add(key);\n }\n }\n const inputKeys = Reflect.ownKeys(record2);\n for (let i = 0; i < inputKeys.length; i++) {\n const key = inputKeys[i];\n if (!coveredKeys.has(key) && Object.prototype.propertyIsEnumerable.call(record2, key)) {\n const unexpected = new UnexpectedKey(ast, record2[key], options);\n const issue = new Pointer([key], unexpected);\n if (errorsAllOption) {\n if (state.issues) {\n state.issues.push(issue);\n } else {\n state.issues = [issue];\n }\n continue;\n } else {\n return yield* fail5(new Composite(ast, [issue], input, options));\n }\n }\n }\n }\n if (hasProperties) {\n const eff = concurrency === 1 ? parseProperties(state, properties) : parsePropertiesConcurrent(state, properties, {\n concurrency\n });\n if (eff) yield* eff;\n }\n if (indexCount && concurrency === 1) {\n for (let i = 0; i < indexCount; i++) {\n const index = indexes[i];\n const parse = index.is.parameter === string2 ? parseStringIndex : parseIndex;\n const keys = indexKeys?.[i] ?? (index.is.parameter === string2 ? Object.keys(record2) : getIndexSignatureKeys(record2, index.is.parameter, options));\n for (let j = 0; j < keys.length; j++) {\n const eff = parse(state, keys[j], index);\n if (!effectIsExit(eff)) yield* eff;\n else if (eff._tag === \"Failure\") return yield* eff;\n }\n }\n } else if (parseIndexes) {\n const keyPairs = empty();\n for (let i = 0; i < indexCount; i++) {\n const index = indexes[i];\n const keys = indexKeys?.[i] ?? (index.is.parameter === string2 ? Object.keys(record2) : getIndexSignatureKeys(record2, index.is.parameter, options));\n for (let j = 0; j < keys.length; j++) {\n keyPairs.push([keys[j], index]);\n }\n }\n const eff = parseIndexes(state, keyPairs, {\n concurrency\n });\n if (eff) yield* eff;\n }\n if (state.issues) {\n return yield* fail5(new Composite(ast, state.issues, input, options));\n }\n return out;\n });\n };\n if (indexCount) return makeFallback();\n let fallback;\n const resume = (state, index, pending) => {\n const property = properties[index];\n return flatMap2(exit2(pending), (exit3) => {\n const terminal = stepProperty(state, property, exit3);\n if (terminal) return terminal;\n const done2 = () => succeed6(state.out);\n const eff = parseProperties(state, properties.slice(index + 1));\n return eff ? flatMapEager2(eff, done2) : done2();\n });\n };\n return (input, options) => {\n if (input === missing) return missingExit;\n if (options.errors === \"all\" || options.onExcessProperty !== void 0 || options.concurrency !== void 0 && resolveConcurrency(options.concurrency) !== 1) {\n return (fallback ??= makeFallback())(input, options);\n }\n if (!(typeof input === \"object\" && input !== null && !Array.isArray(input))) {\n return fail5(new InvalidType(ast, input, options));\n }\n const props = compileMembers();\n const record2 = input;\n const out = {};\n const state = {\n ast,\n input: record2,\n out,\n issues: void 0,\n options\n };\n try {\n for (let index = 0; index < props.length; index++) {\n const property = props[index];\n const name = property.name;\n const hasKey = hasPropertySignature(record2, name);\n const value = hasKey ? record2[name] : missing;\n const exit3 = property.parser(value, options);\n if (!effectIsExit(exit3)) {\n return resume(state, index, exit3);\n }\n if (exit3 === sameExit) {\n if (hasKey) assignProperty(out, name, value);\n continue;\n }\n const terminal = stepProperty(state, property, exit3);\n if (terminal) return terminal;\n }\n } catch (error) {\n return die3(error);\n }\n return succeed6(out);\n };\n }\n _rebuild(recur, recurParameter, checks, encodingChecks) {\n const props = mapOrSame(this.propertySignatures, (ps) => {\n const t = recur(ps.type);\n return t === ps.type ? ps : new PropertySignature(ps.name, t);\n });\n const indexes = mapOrSame(this.indexSignatures, (is2) => {\n const p = recurParameter(is2.parameter);\n const t = recur(is2.type);\n return p === is2.parameter && t === is2.type ? is2 : new IndexSignature(p, t);\n });\n return props === this.propertySignatures && indexes === this.indexSignatures && checks === this.checks && encodingChecks === this.encodingChecks ? this : new Objects(props, indexes, this.annotations, checks, void 0, this.context, encodingChecks);\n }\n /** @internal */\n flip(recur) {\n return this._rebuild(recur, recur, this.encodingChecks, this.checks);\n }\n /** @internal */\n recur(recur, recurParameter = recur) {\n return this._rebuild(recur, recurParameter, this.checks, this.encodingChecks);\n }\n /** @internal */\n getExpected() {\n if (this.propertySignatures.length === 0 && this.indexSignatures.length === 0) return \"object | array\";\n return \"object\";\n }\n};\nfunction stepProperty(s, p, exit3) {\n if (exit3._tag === \"Failure\") {\n return wrapPropertyKeyIssue(s, s.ast, p.name, exit3);\n }\n if (exit3 === sameExit) return;\n const value = exit3[args];\n if (value !== missing) {\n assignProperty(s.out, p.name, value);\n return;\n }\n delete s.out[p.name];\n if (!isOptional(p.type)) {\n const issue = new Pointer([p.name], new MissingKey(p.type.context?.annotations));\n if (s.options.errors === \"all\") {\n if (s.issues) s.issues.push(issue);\n else s.issues = [issue];\n return;\n } else {\n return fail4(new Composite(s.ast, [issue], s.input, s.options));\n }\n }\n}\nvar parsePropertiesOptions = {\n onItem(s, p) {\n if (!hasPropertySignature(s.input, p.name)) {\n return p.parser(missing, s.options);\n }\n const value = s.input[p.name];\n assignProperty(s.out, p.name, value);\n return p.parser(value, s.options);\n },\n step: stepProperty\n};\nvar parseProperties = /* @__PURE__ */ iterateEager()(parsePropertiesOptions);\nvar parsePropertiesConcurrent = /* @__PURE__ */ iterateConcurrent()(parsePropertiesOptions);\nfunction combineChecks(a, b) {\n if (!a) return b;\n if (!b) return a;\n return [...a, ...b];\n}\nfunction struct(fields, checks, annotations) {\n return new Objects(Reflect.ownKeys(fields).map((key) => {\n return new PropertySignature(key, fields[key].ast);\n }), [], annotations, checks);\n}\nfunction getAST(self) {\n return self.ast;\n}\nfunction tuple(elements, checks = void 0) {\n return new Arrays(false, elements.map((e) => e.ast), [], void 0, checks);\n}\nfunction union(members, options, checks) {\n return new Union(members.map(getAST), options, void 0, checks);\n}\nvar toCandidate = /* @__PURE__ */ memoizeIdempotent((ast) => {\n while (true) {\n if (isSuspend(ast)) return unknown;\n const encoding = ast.encoding;\n if (!encoding) {\n return ast.recur?.(toCandidate, identity) ?? ast;\n }\n if (encoding.some((link2) => link2.transformation._tag === \"Middleware\" && link2.transformation.decode !== identity)) return unknown;\n ast = encoding[encoding.length - 1].to;\n }\n});\nfunction getCandidateTypes(ast) {\n switch (ast._tag) {\n case \"Null\":\n return [\"null\"];\n case \"Undefined\":\n return [\"undefined\"];\n case \"String\":\n case \"TemplateLiteral\":\n return [\"string\"];\n case \"Number\":\n return [\"number\"];\n case \"Boolean\":\n return [\"boolean\"];\n case \"Symbol\":\n case \"UniqueSymbol\":\n return [\"symbol\"];\n case \"BigInt\":\n return [\"bigint\"];\n case \"Arrays\":\n return [\"array\"];\n case \"ObjectKeyword\":\n return [\"object\", \"array\", \"function\"];\n case \"Objects\":\n return ast.propertySignatures.length || ast.indexSignatures.length ? [\"object\"] : [\"string\", \"number\", \"boolean\", \"symbol\", \"bigint\", \"object\", \"array\", \"function\"];\n case \"Enum\":\n return Array.from(new Set(ast.enums.map(([, v]) => typeof v)));\n case \"Literal\":\n return [typeof ast.literal];\n case \"Union\":\n return Array.from(new Set(ast.types.flatMap(getCandidateTypes)));\n default:\n return [\"null\", \"undefined\", \"string\", \"number\", \"boolean\", \"symbol\", \"bigint\", \"object\", \"array\", \"function\"];\n }\n}\nfunction collectSentinels(ast) {\n switch (ast._tag) {\n default:\n return [];\n case \"Declaration\": {\n const s = ast.annotations?.[SENTINELS_ANNOTATION_KEY];\n return Array.isArray(s) ? s : [];\n }\n case \"Objects\":\n return ast.propertySignatures.flatMap((ps) => {\n const type = ps.type;\n if (!isOptional(type)) {\n if (isLiteral(type)) {\n return [{\n key: ps.name,\n literal: type.literal\n }];\n }\n if (isUniqueSymbol(type)) {\n return [{\n key: ps.name,\n literal: type.symbol\n }];\n }\n }\n return [];\n });\n case \"Arrays\":\n return ast.elements.flatMap((e, i) => {\n if (!isOptional(e)) {\n if (isLiteral(e)) {\n return [{\n key: i,\n literal: e.literal\n }];\n }\n if (isUniqueSymbol(e)) {\n return [{\n key: i,\n literal: e.symbol\n }];\n }\n }\n return [];\n });\n case \"Union\": {\n if (ast.types.length === 0) return [];\n const members = ast.types.map((type) => collectSentinels(toCandidate(type)));\n return members[0].filter((s) => members.every((sentinels) => sentinels.some((o) => o.key === s.key && o.literal === s.literal)));\n }\n case \"Suspend\":\n return collectSentinels(ast.thunk());\n }\n}\nvar candidateIndexCache = /* @__PURE__ */ new WeakMap();\nvar emptyCandidates = /* @__PURE__ */ Object.freeze([]);\nvar getRuntimeType = (input) => input === null ? \"null\" : Array.isArray(input) ? \"array\" : typeof input;\nvar hasPropertySignature = (input, key) => key === \"__proto__\" ? Object.hasOwn(input, key) : key in input;\nfunction getCandidateIndex(types) {\n let index = candidateIndexCache.get(types);\n if (index) return index;\n let bySentinel;\n let sentinelCandidateCount = 0;\n let otherwise;\n let literalCandidates;\n let onlyLiterals = true;\n const literalOf = [];\n for (let i = 0; i < types.length; i++) {\n const a = types[i];\n const encoded = toCandidate(a);\n if (isNever2(encoded)) continue;\n if (isLiteral(encoded) || isUniqueSymbol(encoded)) {\n literalCandidates ??= /* @__PURE__ */ new Map();\n const literal = isLiteral(encoded) ? encoded.literal : encoded.symbol;\n literalOf[i] = literal;\n let arr = literalCandidates.get(literal);\n if (!arr) literalCandidates.set(literal, arr = []);\n arr.push(i);\n } else {\n onlyLiterals = false;\n }\n const sentinels = collectSentinels(encoded);\n if (sentinels.length) {\n bySentinel ??= /* @__PURE__ */ new Map();\n sentinelCandidateCount++;\n for (const {\n key,\n literal\n } of sentinels) {\n let entry = bySentinel.get(key);\n if (!entry) bySentinel.set(key, entry = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Set()]);\n entry[1].add(i);\n let indexes = entry[0].get(literal);\n if (!indexes) entry[0].set(literal, indexes = /* @__PURE__ */ new Set());\n indexes.add(i);\n }\n } else {\n otherwise ??= {};\n const candidateTypes = getCandidateTypes(encoded);\n for (const t of candidateTypes) (otherwise[t] ??= []).push(i);\n }\n }\n const fallbacks = {};\n const getFallback = (type) => fallbacks[type] ??= Object.freeze(otherwise?.[type] ?? emptyCandidates);\n if (onlyLiterals && literalCandidates) {\n literalCandidates.forEach(Object.freeze);\n index = (input) => literalCandidates.get(input) ?? emptyCandidates;\n } else if (bySentinel?.size === 1 && !otherwise) {\n const [key, [byValue]] = bySentinel.entries().next().value;\n const candidates = /* @__PURE__ */ new Map();\n for (const [literal, indexes] of byValue) {\n candidates.set(literal, Object.freeze(Array.from(indexes)));\n }\n const all2 = Object.freeze(types.map((_, i) => i));\n index = (input, isConstructor) => {\n if (isObjectKeyword(input)) {\n const value = hasPropertySignature(input, key) ? input[key] : void 0;\n if (value !== void 0) return candidates.get(value) ?? emptyCandidates;\n if (isConstructor) return all2;\n }\n return emptyCandidates;\n };\n } else if (bySentinel) {\n let commonSentinel;\n for (const entry of bySentinel) {\n if ((!commonSentinel || entry[1][0].size > commonSentinel[1][0].size) && entry[1][1].size === sentinelCandidateCount) {\n commonSentinel = entry;\n }\n }\n index = (input, isConstructor) => {\n const runtimeType = getRuntimeType(input);\n if (!isObjectKeyword(input)) return getFallback(runtimeType);\n const selected = new Set(otherwise?.[runtimeType]);\n let directKey;\n if (commonSentinel) {\n const [key, [byValue]] = commonSentinel;\n const hasKey = hasPropertySignature(input, key);\n const value = hasKey ? input[key] : void 0;\n if (hasKey && (!isConstructor || value !== void 0)) {\n const match3 = byValue.get(value);\n if (!match3) return getFallback(runtimeType);\n for (const i of match3) selected.add(i);\n directKey = key;\n }\n }\n if (directKey === void 0) {\n for (const [key, [byValue, all2]] of bySentinel) {\n const hasKey = hasPropertySignature(input, key);\n const value = hasKey ? input[key] : void 0;\n if (hasKey && (!isConstructor || value !== void 0)) {\n const match3 = byValue.get(value);\n if (match3) {\n for (const i of match3) selected.add(i);\n }\n } else if (isConstructor) {\n for (const i of all2) selected.add(i);\n }\n }\n }\n for (const [key, [byValue, all2]] of bySentinel) {\n if (key === directKey) continue;\n const hasKey = hasPropertySignature(input, key);\n const value = hasKey ? input[key] : void 0;\n if (hasKey && (!isConstructor || value !== void 0)) {\n const match3 = byValue.get(value);\n for (const i of selected) {\n if (all2.has(i) && !match3?.has(i)) selected.delete(i);\n }\n }\n }\n return Array.from(selected).sort((a, b) => a - b);\n };\n } else {\n index = (input) => {\n const fallback = getFallback(getRuntimeType(input));\n return literalCandidates ? fallback.filter((i) => literalOf[i] === void 0 || literalOf[i] === input) : fallback;\n };\n }\n candidateIndexCache.set(types, index);\n return index;\n}\nvar Union = class extends ASTNodeImpl {\n _tag = \"Union\";\n types;\n options;\n encodingChecks;\n constructor(types, options, annotations, checks, encoding, context2, encodingChecks) {\n super(annotations, checks, encoding, context2);\n this.types = types;\n this.options = options;\n this.encodingChecks = encodingChecks;\n }\n /** @internal */\n getParser(compile2, compileField2) {\n const ast = this;\n const isConstructor = compileField2 !== void 0;\n const parsers = [];\n const parser = (i) => parsers[i] ??= compile2(ast.types[i]);\n let index;\n return (input, options) => {\n if (input === missing) {\n return missingExit;\n }\n const candidates = (index ??= getCandidateIndex(ast.types))(input, isConstructor);\n if (candidates.length === 0) {\n return fail5(new AnyOf(ast, [], input, options));\n }\n if (candidates.length === 1) {\n const result2 = parser(candidates[0])(input, options);\n if (result2._tag === \"Success\") return result2;\n return effectIsExit(result2) ? failSingleUnionCandidate(ast, result2.cause, input, options) : catchSingleUnionCandidate(ast, result2, input, options);\n }\n return parseUnionCandidates(ast, parser, candidates, input, options);\n };\n }\n _rebuild(recur, checks, encodingChecks) {\n const types = mapOrSame(this.types, recur);\n return types === this.types && checks === this.checks && encodingChecks === this.encodingChecks ? this : new Union(types, this.options, this.annotations, checks, void 0, this.context, encodingChecks);\n }\n /** @internal */\n recur(recur) {\n return this._rebuild(recur, this.checks, this.encodingChecks);\n }\n /** @internal */\n flip(recur) {\n return this._rebuild(recur, this.encodingChecks, this.checks);\n }\n /** @internal */\n matchPart(s, options) {\n for (const type of this.types) {\n const out = type.matchPart(s, options);\n if (out !== void 0) return out;\n }\n return void 0;\n }\n /** @internal */\n getExpected(getExpected2) {\n const expected = this.annotations?.expected;\n if (typeof expected === \"string\") return expected;\n if (this.types.length === 0) return \"never\";\n const types = this.types.map((type) => {\n const encoded = toEncoded(type);\n switch (encoded._tag) {\n case \"Arrays\": {\n const literals = encoded.elements.filter(isLiteral);\n if (literals.length > 0) {\n return `${formatIsMutable(encoded.isMutable)}[ ${literals.map((e) => getExpected2(e) + formatIsOptional(e.context?.isOptional)).join(\", \")}, ... ]`;\n }\n break;\n }\n case \"Objects\": {\n const literals = encoded.propertySignatures.filter((ps) => isLiteral(ps.type));\n if (literals.length > 0) {\n return `{ ${literals.map((ps) => `${formatIsMutable(ps.type.context?.isMutable)}${formatPropertyKey(ps.name)}${formatIsOptional(ps.type.context?.isOptional)}: ${getExpected2(ps.type)}`).join(\", \")}, ... }`;\n }\n break;\n }\n }\n return getExpected2(encoded);\n });\n return Array.from(new Set(types)).join(\" | \");\n }\n};\nfunction failSingleUnionCandidate(ast, cause, input, options) {\n const issue = getSchemaIssue(cause);\n if (!issue) return failCause2(cause);\n return fail4(new AnyOf(ast, [issue], input, options));\n}\nfunction catchSingleUnionCandidate(ast, result2, input, options) {\n return catchCause2(result2, (cause) => failSingleUnionCandidate(ast, cause, input, options));\n}\nfunction parseUnionCandidates(ast, parser, candidates, input, options) {\n const state = {\n ast,\n parser,\n input,\n out: void 0,\n successes: ast.options?.mode === \"oneOf\" ? [] : void 0,\n issues: void 0,\n options\n };\n const eff = parseUnion(state, candidates);\n if (!eff) {\n if (state.out) return state.out;\n return fail5(new AnyOf(ast, state.issues ?? [], input, options));\n }\n if (effectIsExit(eff)) return resumeUnion(eff, state);\n let first2 = true;\n return suspend2(() => {\n if (!first2) return parseUnionCandidates(ast, parser, candidates, input, options);\n first2 = false;\n return resumeUnion(eff, state);\n });\n}\nfunction resumeUnion(eff, state) {\n return flatMapEager2(eff, (_) => {\n if (state.out === sameExit) return succeed5(state.input);\n if (state.out) return state.out;\n return fail5(new AnyOf(state.ast, state.issues ?? [], state.input, state.options));\n });\n}\nvar parseUnion = /* @__PURE__ */ iterateEager()({\n onItem(s, i) {\n return s.parser(i)(s.input, s.options);\n },\n step(s, i, exit3) {\n if (exit3._tag === \"Failure\") {\n const issue = getSchemaIssue(exit3.cause);\n if (issue === void 0) {\n return exit3;\n }\n if (s.issues) s.issues.push(issue);\n else s.issues = [issue];\n } else {\n if (s.out && s.successes) {\n s.successes.push(s.ast.types[i]);\n return fail4(new OneOf(s.ast, s.successes, s.input, s.options));\n }\n s.out = exit3;\n if (s.successes) {\n s.successes.push(s.ast.types[i]);\n } else {\n return void_2;\n }\n }\n }\n});\nvar nonFiniteLiterals = /* @__PURE__ */ new Union([/* @__PURE__ */ new Literal(\"Infinity\"), /* @__PURE__ */ new Literal(\"-Infinity\"), /* @__PURE__ */ new Literal(\"NaN\")]);\nfunction formatIsMutable(isMutable) {\n return isMutable ? \"\" : \"readonly \";\n}\nfunction formatIsOptional(isOptional2) {\n return isOptional2 ? \"?\" : \"\";\n}\nvar Filter2 = class extends Class {\n _tag = \"Filter\";\n run;\n annotations;\n /**\n * Whether the parsing process should be aborted after this check has failed.\n */\n aborted;\n constructor(run2, annotations = void 0, aborted = false) {\n super();\n this.run = run2;\n this.annotations = annotations;\n this.aborted = aborted;\n }\n annotate(annotations) {\n return new Filter2(this.run, {\n ...this.annotations,\n ...annotations\n }, this.aborted);\n }\n abort() {\n return new Filter2(this.run, this.annotations, true);\n }\n and(other, annotations) {\n return new FilterGroup([this, other], annotations);\n }\n};\nvar FilterGroup = class extends Class {\n _tag = \"FilterGroup\";\n checks;\n annotations;\n constructor(checks, annotations = void 0) {\n super();\n this.checks = checks;\n this.annotations = annotations;\n }\n annotate(annotations) {\n return new FilterGroup(this.checks, {\n ...this.annotations,\n ...annotations\n });\n }\n and(other, annotations) {\n return new FilterGroup([this, other], annotations);\n }\n};\nfunction makeFilter(filter2, annotations, aborted = false) {\n return new Filter2((input, ast, options) => normalizeFilterOutput(ast, filter2(input, ast, options), input, options), annotations, aborted);\n}\nfunction isFinite(annotations) {\n return makeFilter((n) => globalThis.Number.isFinite(n), {\n expected: \"a finite number\",\n representation: {\n id: \"effect/schema/isFinite\",\n payload: null\n },\n toJsonSchema: () => ({\n type: \"number\"\n }),\n toCode: () => ({\n runtime: \"Schema.isFinite()\"\n }),\n arbitraryConstraint: {\n number: \"finite\"\n },\n ...annotations\n });\n}\nvar finite = /* @__PURE__ */ appendChecks(number2, [/* @__PURE__ */ isFinite()]);\nvar numberToJson = /* @__PURE__ */ new Link(/* @__PURE__ */ new Union([finite, nonFiniteLiterals]), /* @__PURE__ */ new Transformation(/* @__PURE__ */ Number2(), /* @__PURE__ */ transform((n) => globalThis.Number.isFinite(n) ? n : globalThis.String(n))));\nfunction isPattern(regExp, annotations) {\n const copy2 = new globalThis.RegExp(regExp);\n const payload = {\n source: copy2.source,\n flags: copy2.flags\n };\n return makeFilter((s) => {\n copy2.lastIndex = 0;\n return copy2.test(s);\n }, {\n expected: `a string matching the RegExp ${payload.source}`,\n representation: {\n id: \"effect/schema/isPattern\",\n payload\n },\n // Keep the filter exportable so its JSON Schema annotations are preserved\n // when the RegExp constraint itself is omitted.\n toJsonSchema: () => [{}, true],\n arbitraryConstraint: {\n patterns: [payload]\n },\n ...annotations\n });\n}\nvar bodyOwners = /* @__PURE__ */ new WeakMap();\nfunction copy(ast, changes) {\n const out = Object.assign(Object.create(Object.getPrototypeOf(ast)), ast, changes);\n if (Reflect.ownKeys(changes).every((key) => key === \"context\" || key === \"encoding\")) {\n bodyOwners.set(out, getContextOwner(ast));\n }\n return out;\n}\nfunction getContextOwner(ast) {\n const existing = bodyOwners.get(ast);\n if (existing !== void 0) return existing;\n if (ast.encoding === void 0) return ast;\n const owner = Object.assign(Object.create(Object.getPrototypeOf(ast)), ast, {\n encoding: void 0\n });\n bodyOwners.set(ast, owner);\n return owner;\n}\nfunction replaceEncoding(ast, encoding) {\n return ast.encoding === encoding ? ast : copy(ast, {\n encoding\n });\n}\nfunction replaceContext(ast, context2) {\n if (ast.context === context2) {\n return ast;\n }\n const owner = getContextOwner(ast);\n if (owner.context === context2 && owner.encoding === ast.encoding) {\n return owner;\n }\n return copy(ast, {\n context: context2\n });\n}\nfunction getLastEncoding(ast) {\n return ast.encoding ? getLastEncoding(ast.encoding[ast.encoding.length - 1].to) : ast;\n}\nfunction annotate(ast, annotations) {\n if (ast.checks) {\n const last = ast.checks[ast.checks.length - 1];\n return replaceChecks(ast, append(ast.checks.slice(0, -1), last.annotate(annotations)));\n }\n return copy(ast, {\n annotations: {\n ...ast.annotations,\n ...annotations\n }\n });\n}\nfunction replaceChecks(ast, checks) {\n if (ast._tag === \"Suspend\" && checks) {\n throw new Error(\"Cannot add checks to Suspend\");\n }\n if (ast.checks === checks) {\n return ast;\n }\n return copy(ast, {\n checks\n });\n}\nfunction appendChecks(ast, checks) {\n return replaceChecks(ast, combineChecks(ast.checks, checks));\n}\nfunction mapLink(link2, f) {\n const to = f(link2.to);\n return to === link2.to ? link2 : new Link(to, link2.transformation);\n}\nfunction updateLastLink(encoding, f) {\n const links = encoding;\n const last = links[links.length - 1];\n const out = mapLink(last, f);\n return out === last ? encoding : append(encoding.slice(0, encoding.length - 1), out);\n}\nfunction applyToSelfOrLastLinkEncodingIdempotent(f, options) {\n function out(ast) {\n if (ast.encoding) {\n const last = ast.encoding[ast.encoding.length - 1];\n return options?.stopAt?.(last) ? ast : replaceEncoding(ast, updateLastLink(ast.encoding, out));\n }\n return f(ast);\n }\n return memoizeIdempotent(out);\n}\nfunction appendTransformation(from, transformation, to) {\n const link2 = new Link(from, transformation);\n return replaceEncoding(to, to.encoding ? [...to.encoding, link2] : [link2]);\n}\nfunction mapOrSame(as2, f) {\n let out;\n for (let i = 0; i < as2.length; i++) {\n const a = as2[i];\n const fa = f(a);\n if (out) {\n out[i] = fa;\n } else if (fa !== a) {\n out = new Array(as2.length);\n for (let j = 0; j < i; j++) {\n out[j] = as2[j];\n }\n out[i] = fa;\n }\n }\n return out ?? as2;\n}\nfunction annotateKey(ast, annotations) {\n const context2 = ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, ast.context.constructorDefault, {\n ...ast.context.annotations,\n ...annotations\n }) : new Context(false, false, void 0, annotations);\n return replaceContext(ast, context2);\n}\nfunction withConstructorDefault(ast, defaultValue) {\n const context2 = ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, defaultValue, ast.context.annotations) : new Context(false, false, defaultValue);\n return replaceContext(ast, context2);\n}\nfunction decodeTo(from, to, transformation) {\n return appendTransformation(from, transformation, to);\n}\nfunction isOptional(ast) {\n return ast.context?.isOptional ?? false;\n}\nfunction isStructuralCheck(check) {\n return check.annotations?.[STRUCTURAL_ANNOTATION_KEY] === true || check._tag === \"FilterGroup\" && check.checks.every(isStructuralCheck);\n}\nfunction extractStructuralChecks(checks) {\n function extract(check) {\n if (isStructuralCheck(check)) return [check];\n return check._tag === \"FilterGroup\" ? check.checks.flatMap(extract) : [];\n }\n const out = checks.flatMap(extract);\n return isArrayNonEmpty2(out) ? out : void 0;\n}\nfunction canPreserveEncodingChecks(ast) {\n let preserve = true;\n function visit(child) {\n preserve = preserve && !child.encoding && !isSuspend(child);\n if (preserve && \"recur\" in child) child.recur(visit);\n return child;\n }\n if (\"recur\" in ast) ast.recur(visit);\n return preserve;\n}\nvar toType = /* @__PURE__ */ memoizeIdempotent((ast) => {\n const owner = getContextOwner(ast);\n if (owner !== ast) {\n const type2 = toType(owner);\n return type2 === owner && ast.encoding === void 0 ? ast : replaceContext(type2, ast.context);\n }\n const type = \"recur\" in ast ? ast.recur(toType) : ast;\n if (\"encodingChecks\" in type && type.encodingChecks) {\n const checks = canPreserveEncodingChecks(ast) ? type.encodingChecks : isArrays(type) || isObjects(type) || isDeclaration(type) && type.typeParameters.length > 0 ? extractStructuralChecks(type.encodingChecks) : void 0;\n return copy(type, {\n encodingChecks: void 0,\n checks: combineChecks(type.checks, checks)\n });\n }\n return type;\n});\nvar toEncoded = /* @__PURE__ */ memoizeIdempotent((ast) => {\n return toType(flip2(ast));\n});\nfunction flipEncoding(ast, encoding) {\n const links = encoding;\n const len = links.length;\n const last = links[len - 1];\n const ls = [new Link(flip2(replaceEncoding(ast, void 0)), links[0].transformation.flip())];\n for (let i = 1; i < len; i++) {\n ls.unshift(new Link(flip2(links[i - 1].to), links[i].transformation.flip()));\n }\n const to = flip2(last.to);\n if (to.encoding) {\n return replaceEncoding(to, [...to.encoding, ...ls]);\n } else {\n return replaceEncoding(to, ls);\n }\n}\nvar flip2 = /* @__PURE__ */ memoize((ast) => {\n if (ast.encoding) {\n return flipEncoding(ast, ast.encoding);\n }\n const owner = getContextOwner(ast);\n if (owner !== ast) {\n const flipped = flip2(owner);\n return flipped === owner ? ast : replaceContext(flipped, ast.context);\n }\n return \"flip\" in ast ? ast.flip(flip2) : \"recur\" in ast ? ast.recur(flip2) : ast;\n});\nfunction containsUndefined(ast) {\n switch (ast._tag) {\n case \"Undefined\":\n return true;\n case \"Union\":\n return ast.types.some(containsUndefined);\n default:\n return false;\n }\n}\nfunction fromConst(ast, value) {\n const succeed7 = value === 0 ? sameExit : succeed6(value);\n return (input, options) => {\n if (input === missing) return missingExit;\n if (input === value) return succeed7;\n return fail5(new InvalidType(ast, input, options));\n };\n}\nfunction fromRefinement(ast, refinement) {\n return (input, options) => {\n if (input === missing) return missingExit;\n if (refinement(input)) return sameExit;\n return fail5(new InvalidType(ast, input, options));\n };\n}\nvar parameterFromPropertyKey = /* @__PURE__ */ applyToSelfOrLastLinkEncodingIdempotent((ast) => {\n switch (ast._tag) {\n default:\n return ast;\n case \"Number\":\n return ast.toCodecStringTree();\n case \"Union\":\n return ast.recur(parameterFromPropertyKey);\n }\n});\nvar isStringFiniteRegExp = /* @__PURE__ */ new globalThis.RegExp(`^${FINITE_PATTERN}$`);\nvar isStringNumberRegExp = /* @__PURE__ */ new globalThis.RegExp(`^(?:${FINITE_PATTERN}|Infinity|-Infinity|NaN)$`);\nfunction isStringFinite(annotations) {\n return isPattern(isStringFiniteRegExp, {\n expected: \"a string representing a finite number\",\n representation: {\n id: \"effect/schema/isStringFinite\",\n payload: null\n },\n toJsonSchema: () => ({\n pattern: isStringFiniteRegExp.source\n }),\n ...annotations\n });\n}\nvar finiteString = /* @__PURE__ */ appendChecks(string2, [/* @__PURE__ */ isStringFinite()]);\nvar finiteToString = /* @__PURE__ */ new Link(finiteString, numberFromString);\nvar numberToString = /* @__PURE__ */ new Link(/* @__PURE__ */ new Union([finiteString, nonFiniteLiterals]), numberFromString);\nvar BIGINT_PATTERN = \"-?\\\\d+\";\nvar isStringBigIntRegExp = /* @__PURE__ */ new globalThis.RegExp(`^${BIGINT_PATTERN}$`);\nvar REGEXP_PATTERN = \"Symbol\\\\(([\\\\s\\\\S]*)\\\\)\";\nvar isStringSymbolRegExp = /* @__PURE__ */ new globalThis.RegExp(`^${REGEXP_PATTERN}$`);\nfunction collectIssues(checks, value, issues, ast, options) {\n for (let i = 0; i < checks.length; i++) {\n const check = checks[i];\n if (check._tag === \"FilterGroup\") {\n issues = collectIssues(check.checks, value, issues, ast, options);\n if (issues && (options.errors !== \"all\" || issues[issues.length - 1].filter.aborted)) {\n return issues;\n }\n } else {\n const issue = check.run(value, ast, options);\n if (issue) {\n const filter2 = new Filter(check, issue, value, options);\n if (issues) issues.push(filter2);\n else issues = [filter2];\n if (options.errors !== \"all\" || check.aborted) {\n return issues;\n }\n }\n }\n }\n return issues;\n}\nfunction getConstructorDescriptor(ast) {\n if (!isDeclaration(ast)) return void 0;\n const getDescriptor = ast.annotations?.[CONSTRUCTOR_ANNOTATION_KEY];\n return isFunction(getDescriptor) ? getDescriptor(ast.typeParameters) : void 0;\n}\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/interpreter.js\nvar flatMapTransformation = (result2, current, f) => result2 === sameExit ? f(current) : flatMapEager2(result2, f);\nfunction compileTransformation(transformation) {\n if (transformation._tag === \"Middleware\") {\n return (result2, current, options) => {\n const transformed = result2 === sameExit ? transformation.decode(succeed6(toOption(current)), options) : transformation.decode(mapEager2(result2, toOption), options);\n return fromOptionalEffect(transformed);\n };\n }\n const getter = transformation.decode;\n switch (getter._tag) {\n case \"Passthrough\":\n return (result2, current) => result2 === sameExit ? succeed6(current) : result2;\n case \"Transform\": {\n const transform3 = (value) => value === missing ? missingExit : succeed6(getter.transform(value));\n return (result2, current) => flatMapTransformation(result2, current, transform3);\n }\n case \"TransformOptional\": {\n const transform3 = (value) => fromOptionExit(getter.transform(toOption(value)));\n return (result2, current) => flatMapTransformation(result2, current, transform3);\n }\n case \"TransformEffect\":\n return (result2, current, options) => flatMapTransformation(result2, current, (value) => value === missing ? missingExit : getter.transform(value, options));\n case \"TransformOptionalEffect\":\n return (result2, current, options) => flatMapTransformation(result2, current, (value) => fromOptionalEffect(getter.transform(toOption(value), options)));\n }\n}\nvar fromOptionalEffect = (effect) => flatMapEager2(effect, fromOptionExit);\nvar wrapEncoding = (ast, input, options, effect) => catchCause2(effect, (cause) => failCauseSync2(() => map3(cause, (issue) => new Encoding(ast, issue, input, options))));\nfunction makeConstructorParser(descriptor, compile2) {\n const transform3 = compileTransformation(descriptor.link.transformation);\n let sourceParser;\n return (input, options) => {\n if (input === missing) return missingExit;\n if (descriptor.isConstructed(input)) return sameExit;\n const result2 = (sourceParser ??= compile2(descriptor.link.to))(input, options);\n return transform3(result2, input, options);\n };\n}\nfunction withDefault(ast, parser) {\n const defaultValue = ast.context.constructorDefault;\n return (input, options) => {\n if (input !== missing && input !== void 0) return parser(input, options);\n const result2 = defaultValue;\n if (effectIsExit(result2) && result2._tag === \"Success\") {\n const local = parser(result2[args], options);\n return local === sameExit ? result2 : local;\n }\n return flatMapEager2(wrapEncoding(ast, input, options, result2), (value) => {\n const local = parser(value, options);\n return local === sameExit ? succeed6(value) : local;\n });\n };\n}\nfunction compileField(ast, compile2) {\n const parser = compile2(ast);\n return ast.context?.constructorDefault === void 0 ? parser : withDefault(ast, parser);\n}\nfunction compile(ast, compile2, compileField2, base, specialize) {\n if (ast._tag === \"Declaration\") {\n for (const parameter of ast.typeParameters) compile2(parameter);\n }\n const descriptor = compileField2 ? getConstructorDescriptor(ast) : void 0;\n const parser = descriptor ? makeConstructorParser(descriptor, compile2) : base ?? ast.getParser(compile2, compileField2);\n const checks = ast.checks;\n const links = ast.encoding;\n const transformations = links?.map((link2) => compileTransformation(link2.transformation));\n const encodingChecks = ast.encodingChecks;\n if (!links && !checks && !encodingChecks) {\n return parser;\n }\n let encodingParsers;\n const parseChecks = (input, options) => {\n let result2 = parser(input, options);\n if (encodingChecks && !options.disableChecks) {\n if (effectIsExit(result2)) {\n if (result2._tag === \"Success\") {\n const output = result2 === sameExit ? input : result2[args];\n if (input !== missing && output !== missing) {\n const issues = collectIssues(encodingChecks, input, void 0, ast, options);\n if (issues) {\n result2 = fail5(new Composite(ast, issues, input, options));\n }\n }\n }\n } else {\n result2 = flatMap2(result2, (value) => {\n if (input !== missing && value !== missing) {\n const issues = collectIssues(encodingChecks, input, void 0, ast, options);\n if (issues) {\n return fail5(new Composite(ast, issues, input, options));\n }\n }\n return succeed5(value);\n });\n }\n }\n if (checks && !options.disableChecks) {\n if (effectIsExit(result2)) {\n if (result2._tag === \"Success\") {\n const value = result2 === sameExit ? input : result2[args];\n if (value === missing) return result2;\n const issues = collectIssues(checks, value, void 0, ast, options);\n if (issues) {\n result2 = fail5(new Composite(ast, issues, value, options));\n }\n }\n } else {\n result2 = flatMap2(result2, (value) => {\n if (value !== missing) {\n const issues = collectIssues(checks, value, void 0, ast, options);\n if (issues) {\n return fail5(new Composite(ast, issues, value, options));\n }\n }\n return succeed5(value);\n });\n }\n }\n return result2;\n };\n const parseLocal = specialize === void 0 ? parseChecks : specialize(parseChecks);\n if (!links) {\n return parseLocal;\n }\n return (input, options) => {\n const parsers = encodingParsers ??= links.map((link2) => compile2(link2.to));\n let current = input;\n let result2 = parsers[parsers.length - 1](input, options);\n for (let i = links.length - 1; i >= 0; i--) {\n result2 = transformations[i](result2, current, options);\n if (i !== 0) {\n const next = parsers[i - 1];\n if (result2._tag === \"Success\") {\n current = result2[args];\n result2 = next(current, options);\n } else {\n result2 = flatMapEager2(result2, (value) => {\n const nextResult = next(value, options);\n return nextResult === sameExit ? succeed6(value) : nextResult;\n });\n }\n }\n }\n if (result2._tag === \"Success\") {\n const value = result2[args];\n const local = parseLocal(value, options);\n return local === sameExit ? result2 : local;\n }\n result2 = wrapEncoding(ast, input, options, result2);\n return flatMapEager2(result2, (value) => {\n const local = parseLocal(value, options);\n return local === sameExit ? succeed6(value) : local;\n });\n };\n}\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/compilerRegistry.js\nvar invalid = /* @__PURE__ */ Symbol();\nvar cache = /* @__PURE__ */ new WeakMap();\nvar compiler;\nvar compilerAdaptersEnabled = false;\nvar decodeChild = (ast) => compilerAdaptersEnabled ? lazyParser(resolve2, ast, \"parser\") : resolve2(ast).parser;\nvar makeChild = (ast) => compilerAdaptersEnabled ? lazyParser(resolve2, ast, \"makeEffect\") : resolve2(ast).makeEffect;\nvar makeField = (ast) => compileField(ast, makeChild);\nvar InterpretedEntry = class {\n ast;\n constructor(ast) {\n this.ast = ast;\n }\n get decodeEffect() {\n return this.cachedDecodeEffect ??= compile(this.ast, decodeChild);\n }\n get parser() {\n return this.decodeEffect;\n }\n get makeEffect() {\n return this.cachedMakeEffect ??= compile(this.ast, makeChild, makeField);\n }\n};\nvar CompilerEntry = class extends InterpretedEntry {\n compiled;\n resolve;\n constructor(ast, compiled, resolve5) {\n super(ast);\n this.compiled = compiled;\n this.resolve = resolve5;\n }\n save(key, value) {\n Object.defineProperty(this, key, {\n value\n });\n return value;\n }\n operation(key) {\n const compiled = this.compiled;\n return typeof compiled === \"function\" ? compiled(this.ast, this.resolve, key) : compiled?.[key];\n }\n get is() {\n return this.save(\"is\", this.operation(\"is\"));\n }\n get decode() {\n return this.save(\"decode\", this.operation(\"decode\"));\n }\n get make() {\n return this.save(\"make\", this.operation(\"make\"));\n }\n get decodeEffect() {\n return this.save(\"decodeEffect\", this.operation(\"decodeEffect\") ?? compile(this.ast, (ast) => lazyParser(this.resolve, ast, \"parser\")));\n }\n get parser() {\n const decode2 = this.decode;\n return decode2 === void 0 ? this.decodeEffect : this.save(\"parser\", withDecode(decode2, () => this.decodeEffect));\n }\n get makeEffect() {\n const makeEffect2 = this.operation(\"makeEffect\");\n if (makeEffect2 !== void 0) return this.save(\"makeEffect\", makeEffect2);\n const child = (ast) => lazyParser(this.resolve, ast, \"makeEffect\");\n return this.save(\"makeEffect\", compile(this.ast, child, (ast) => compileField(ast, child)));\n }\n};\nfunction withDecode(fastDecode, decodeEffect2) {\n let detailed;\n return (input, options) => {\n if (input !== missing) {\n try {\n const value = fastDecode(input, options);\n if (value !== invalid) return value === input ? sameExit : succeed6(value);\n } catch (error) {\n return die3(error);\n }\n }\n return (detailed ??= decodeEffect2())(input, options);\n };\n}\nfunction lazyParser(resolve5, ast, operation) {\n const entry = resolve5(ast);\n if (entry.compiled === void 0 || Object.hasOwn(entry, operation)) {\n return entry[operation];\n }\n let parser;\n return (input, options) => (parser ??= entry[operation])(input, options);\n}\nfunction resolve2(ast) {\n const cached2 = cache.get(ast);\n if (cached2 !== void 0) return cached2;\n const entry = compiler === void 0 ? new InterpretedEntry(ast) : new CompilerEntry(ast, compiler(ast, resolve2), resolve2);\n cache.set(ast, entry);\n return entry;\n}\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/SchemaParser.js\nfunction makeEffect(schema) {\n const ast = schema.ast;\n let parser;\n return (input, options) => {\n return (parser ??= runWithCompiler(constructorCompiler, toType(ast)))(input, options?.disableChecks ? options?.parseOptions ? {\n ...options.parseOptions,\n disableChecks: true\n } : {\n disableChecks: true\n } : options?.parseOptions);\n };\n}\nfunction makeOption(schema) {\n const parser = makeEffect(schema);\n return (input, options) => {\n const exit3 = runSyncExit2(parser(input, options));\n if (isSuccess3(exit3)) {\n return some2(exit3.value);\n }\n getSchemaIssueOrThrow(exit3.cause, \"Option adapter can only return none for schema issues\");\n return none2();\n };\n}\nfunction make2(schema) {\n return makeConstructorSync(toType(schema.ast));\n}\nfunction decodeUnknownEffect(schema, options) {\n const parser = run(schema.ast);\n return options === void 0 ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));\n}\nvar mergeParseOptions = (options, overrideOptions) => overrideOptions ? {\n ...options,\n ...overrideOptions\n} : options;\nvar getValue = (value) => {\n if (value === missing) {\n return fail5(new InvalidValue());\n }\n return succeed5(value);\n};\nfunction run(ast) {\n return runWithCompiler(normalCompiler, ast);\n}\nfunction parserResult(result2, input) {\n if (result2 === sameExit) {\n return succeed5(input);\n }\n if (!effectIsExit(result2)) {\n return flatMapEager2(result2, getValue);\n }\n return result2[args] === missing ? getValue(missing) : result2;\n}\nfunction runWithCompiler(compiler2, ast) {\n let parser;\n return (input, options) => {\n const result2 = (parser ??= compiler2(ast))(input, options ?? defaultParseOptions);\n if (result2 === sameExit) {\n return succeed5(input);\n }\n if (!effectIsExit(result2)) {\n return flatMapEager2(result2, getValue);\n }\n return result2[args] === missing ? getValue(missing) : result2;\n };\n}\nfunction runSync2(effect, message) {\n const exit3 = runSyncExit2(effect);\n if (isSuccess3(exit3)) {\n return exit3.value;\n }\n const issue = getSchemaIssueOrThrow(exit3.cause, message);\n throw new Error(\"Schema validation failed\", {\n cause: issue\n });\n}\nfunction makeConstructorSync(ast) {\n let entry;\n let parser;\n return (input, options) => {\n entry ??= resolve2(ast);\n const parseOptions = options?.disableChecks ? options.parseOptions ? {\n ...options.parseOptions,\n disableChecks: true\n } : {\n disableChecks: true\n } : options?.parseOptions ?? defaultParseOptions;\n const make5 = entry.make;\n if (make5 !== void 0 && input !== missing) {\n let output;\n try {\n output = make5(input, parseOptions);\n } catch (error) {\n getSchemaIssueOrThrow(die2(error), \"Constructor adapter can only throw schema issues\");\n throw error;\n }\n if (output !== invalid && output !== missing) return output;\n }\n const result2 = (parser ??= entry.makeEffect)(input, parseOptions);\n return runSync2(parserResult(result2, input), \"Constructor adapter can only throw schema issues\");\n };\n}\nvar normalCompiler = (ast) => resolve2(ast).parser;\nvar constructorCompiler = (ast) => resolve2(ast).makeEffect;\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/make.js\nvar TypeId7 = \"~effect/Schema/Schema\";\nvar RebuildOptions = /* @__PURE__ */ Symbol();\nvar SchemaProto = {\n [TypeId7]: TypeId7,\n get make() {\n const value = make2(this);\n Object.defineProperty(this, \"make\", {\n value,\n enumerable: true\n });\n return value;\n },\n get makeEffect() {\n const value = makeEffect(this);\n Object.defineProperty(this, \"makeEffect\", {\n value,\n enumerable: true\n });\n return value;\n },\n get makeOption() {\n const value = makeOption(this);\n Object.defineProperty(this, \"makeOption\", {\n value,\n enumerable: true\n });\n return value;\n },\n pipe() {\n return pipeArguments(this, arguments);\n },\n annotate(annotations) {\n return this.rebuild(annotate(this.ast, annotations));\n },\n annotateKey(annotations) {\n return this.rebuild(annotateKey(this.ast, annotations));\n },\n check(...checks) {\n return this.rebuild(appendChecks(this.ast, checks));\n },\n rebuild(ast) {\n return make3(ast, this[RebuildOptions]);\n }\n};\nfunction make3(ast, options) {\n function Schema() {\n }\n const self = Object.setPrototypeOf(Schema, SchemaProto);\n if (options && (Object.hasOwn(options, \"name\") || Object.hasOwn(options, \"length\") || Object.hasOwn(options, \"__proto__\"))) {\n Object.defineProperties(self, Object.getOwnPropertyDescriptors({\n ...options\n }));\n } else {\n Object.assign(self, options);\n }\n self[RebuildOptions] = options;\n self.ast = ast;\n return self;\n}\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Struct.js\nvar lambda = (f) => f;\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schemaError.js\nvar SchemaErrorTypeId = \"~effect/Schema/SchemaError\";\nfunction isSchemaError(u) {\n return hasProperty(u, SchemaErrorTypeId) && u[SchemaErrorTypeId] === SchemaErrorTypeId;\n}\n\n// ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Schema.js\nfunction declareConstructor() {\n return (typeParameters, run2, annotations) => {\n return make4(new Declaration(typeParameters.map(getAST), (typeParameters2) => run2(typeParameters2.map((ast) => make4(ast))), annotations));\n };\n}\nfunction declare(is2, annotations) {\n return declareConstructor()([], () => (input, ast, options) => is2(input) ? succeed5(input) : fail5(new InvalidType(ast, input, options)), annotations);\n}\nvar SchemaError = class extends (/* @__PURE__ */ TaggedError2(\"SchemaError\")) {\n [SchemaErrorTypeId] = SchemaErrorTypeId;\n constructor(issue) {\n const stackTraceLimit = getStackTraceLimit();\n setStackTraceLimit(0);\n try {\n super({\n issue\n });\n } finally {\n setStackTraceLimit(stackTraceLimit);\n }\n }\n get message() {\n return defaultFormatter(this.issue);\n }\n toString() {\n return `SchemaError(${this.message})`;\n }\n};\nfunction isSchemaError2(u) {\n return isSchemaError(u);\n}\nfunction fromIssueEffect(self) {\n if (effectIsExit(self)) {\n return fromIssueExit(self);\n }\n return catchCause2(self, (cause) => failCauseSync2(() => map3(cause, (issue) => new SchemaError(issue))));\n}\nfunction fromIssueExit(exit3) {\n return isSuccess3(exit3) ? exit3 : failCause2(map3(exit3.cause, (issue) => new SchemaError(issue)));\n}\nfunction getSchemaErrorOrThrow(cause, message) {\n let schemaError;\n for (const reason of cause.reasons) {\n if (!isFailReason2(reason) || !isSchemaError2(reason.error)) {\n throw new globalThis.Error(message, {\n cause\n });\n }\n schemaError ??= reason.error;\n }\n if (schemaError === void 0) {\n throw new globalThis.Error(message, {\n cause\n });\n }\n return schemaError;\n}\nfunction runSchemaErrorSync(self) {\n const exit3 = runSyncExit2(self);\n if (isSuccess3(exit3)) {\n return exit3.value;\n }\n throw getSchemaErrorOrThrow(exit3.cause, \"Sync adapter can only throw schema errors\");\n}\nfunction decodeUnknownEffect2(schema, options) {\n const parser = decodeUnknownEffect(schema, options);\n return (input, options2) => {\n return fromIssueEffect(parser(input, options2));\n };\n}\nfunction decodeUnknownSync(schema, options) {\n const parser = decodeUnknownEffect2(schema, options);\n return (input, options2) => {\n return runSchemaErrorSync(parser(input, options2));\n };\n}\nvar make4 = make3;\nfunction Literal2(literal) {\n const out = make4(new Literal(literal), {\n literal,\n transform(to) {\n return out.pipe(decodeTo2(Literal2(to), {\n decode: transform(() => to),\n encode: transform(() => literal)\n }));\n }\n });\n return out;\n}\nvar String4 = /* @__PURE__ */ make4(string2);\nvar Number4 = /* @__PURE__ */ make4(number2);\nfunction makeStruct(ast, fields) {\n return make4(ast, {\n fields,\n mapFields(f, options) {\n const fields2 = f(this.fields);\n return makeStruct(struct(fields2, options?.unsafePreserveChecks ? this.ast.checks : void 0), fields2);\n }\n });\n}\nfunction Struct(fields) {\n return makeStruct(struct(fields, void 0), fields);\n}\nfunction makeTuple(ast, elements) {\n return make4(ast, {\n elements,\n mapElements(f, options) {\n const elements2 = f(this.elements);\n return makeTuple(tuple(elements2, options?.unsafePreserveChecks ? this.ast.checks : void 0), elements2);\n }\n });\n}\nfunction Tuple(elements) {\n return makeTuple(tuple(elements), elements);\n}\nvar ArraySchema = /* @__PURE__ */ lambda((schema) => make4(new Arrays(false, [], [schema.ast]), {\n value: schema\n}));\nfunction makeUnion(ast, members) {\n return make4(ast, {\n members,\n mapMembers(f, options) {\n const members2 = f(this.members);\n return makeUnion(union(members2, this.ast.options, options?.unsafePreserveChecks ? this.ast.checks : void 0), members2);\n }\n });\n}\nfunction Union2(members, options) {\n return makeUnion(union(members, options, void 0), members);\n}\nfunction decodeTo2(to, transformation) {\n return (from) => {\n return make4(decodeTo(from.ast, to.ast, transformation ? makeTransformation(transformation) : passthrough2()), {\n from,\n to\n });\n };\n}\nfunction withConstructorDefault2(defaultValue) {\n return (schema) => make4(withConstructorDefault(schema.ast, defaultValue), {\n schema\n });\n}\nfunction tag(literal) {\n return Literal2(literal).pipe(withConstructorDefault2(succeed5(literal)));\n}\nfunction instanceOf(constructor, annotations) {\n return declare((u) => u instanceof constructor, annotations);\n}\nfunction link() {\n return (encodeTo, transformation) => {\n return new Link(encodeTo.ast, makeTransformation(transformation));\n };\n}\nvar makeFilter2 = makeFilter;\nfunction isPattern2(regExp, annotations) {\n const source = regExp.source;\n const flags = regExp.flags;\n const canExport = /^[dg]*uy?$/.test(flags);\n const runtimeRegExp = flags === \"\" ? `new RegExp(${format(source)})` : `new RegExp(${format(source)}, ${format(flags)})`;\n return isPattern(regExp, {\n toJsonSchema: () => canExport ? {\n pattern: flags.endsWith(\"y\") ? `^(?:${source})` : source\n } : [{}, true],\n toCode: () => ({\n runtime: `Schema.isPattern(${runtimeRegExp})`\n }),\n ...annotations\n });\n}\nfunction isBase64(annotations) {\n const regExp = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;\n return isPattern2(regExp, {\n expected: \"a base64 encoded string\",\n representation: {\n id: \"effect/schema/isBase64\",\n payload: null\n },\n toJsonSchema: () => ({\n pattern: regExp.source\n }),\n toCode: () => ({\n runtime: \"Schema.isBase64()\"\n }),\n ...annotations\n });\n}\nfunction isInt(annotations) {\n return makeFilter2((n) => globalThis.Number.isSafeInteger(n), {\n expected: \"an integer\",\n representation: {\n id: \"effect/schema/isInt\",\n payload: null\n },\n toJsonSchema: () => [{\n type: \"integer\"\n }, true],\n toCode: () => ({\n runtime: \"Schema.isInt()\"\n }),\n arbitraryConstraint: {\n number: \"integer\"\n },\n ...annotations\n });\n}\nvar Int = /* @__PURE__ */ Number4.check(/* @__PURE__ */ isInt());\nvar RegExp2 = /* @__PURE__ */ instanceOf(globalThis.RegExp, {\n representation: {\n id: \"effect/schema/RegExp\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.RegExp`,\n Type: `globalThis.RegExp`\n }),\n expected: \"RegExp\",\n toCodecJson: () => link()(Struct({\n source: String4,\n flags: String4\n }), transformEffect2({\n decode: (e, options) => try_2({\n try: () => new globalThis.RegExp(e.source, e.flags),\n catch: () => new InvalidValue({\n expected: \"valid RegExp source and flags\"\n }, e, options)\n }),\n encode: (regExp) => succeed5({\n source: regExp.source,\n flags: regExp.flags\n })\n }))\n});\nvar URLString = /* @__PURE__ */ String4.annotate({\n expected: \"a string that will be decoded as a URL\"\n});\nvar URL2 = /* @__PURE__ */ instanceOf(globalThis.URL, {\n representation: {\n id: \"effect/schema/URL\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.URL`,\n Type: `globalThis.URL`\n }),\n expected: \"URL\",\n toCodecJson: () => link()(URLString, urlFromString)\n});\nvar JsonString = /* @__PURE__ */ String4.annotate({\n expected: \"a string that will be decoded as JSON\",\n contentMediaType: \"application/json\"\n});\nfunction fromJsonString2(schema, options) {\n return JsonString.pipe(decodeTo2(schema, fromJsonString(options)));\n}\nvar File = /* @__PURE__ */ instanceOf(globalThis.File, {\n representation: {\n id: \"effect/schema/File\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.File`,\n Type: `globalThis.File`\n }),\n expected: \"File\",\n toCodecJson: () => link()(Struct({\n data: String4.check(isBase64()),\n type: String4,\n name: String4,\n lastModified: Int\n }), transformEffect2({\n decode: (e, options) => match(decode(e.data), {\n onFailure: () => fail5(new InvalidValue({\n expected: \"a valid Base64 string\"\n }, e.data, options)),\n onSuccess: (bytes) => {\n const buffer = new globalThis.Uint8Array(bytes);\n return succeed5(new globalThis.File([buffer], e.name, {\n type: e.type,\n lastModified: e.lastModified\n }));\n }\n }),\n encode: (file, options) => tryPromise2({\n try: async () => {\n const bytes = new globalThis.Uint8Array(await file.arrayBuffer());\n return {\n data: encode(bytes),\n type: file.type,\n name: file.name,\n lastModified: file.lastModified\n };\n },\n catch: () => new InvalidValue({\n expected: \"a readable File\"\n }, file, options)\n })\n }))\n});\nvar FormData2 = /* @__PURE__ */ instanceOf(globalThis.FormData, {\n representation: {\n id: \"effect/schema/FormData\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.FormData`,\n Type: `globalThis.FormData`\n }),\n expected: \"FormData\",\n toCodecJson: () => link()(ArraySchema(Tuple([String4, Union2([Struct({\n _tag: tag(\"String\"),\n value: String4\n }), Struct({\n _tag: tag(\"File\"),\n value: File\n })])])), transformEffect2({\n decode: (e) => {\n const out = new globalThis.FormData();\n for (const [key, entry] of e) {\n out.append(key, entry.value);\n }\n return succeed5(out);\n },\n encode: (formData) => {\n return succeed5(globalThis.Array.from(formData.entries()).map(([key, value]) => {\n if (typeof value === \"string\") {\n return [key, {\n _tag: \"String\",\n value\n }];\n } else {\n return [key, {\n _tag: \"File\",\n value\n }];\n }\n }));\n }\n }))\n});\nvar URLSearchParams2 = /* @__PURE__ */ instanceOf(globalThis.URLSearchParams, {\n representation: {\n id: \"effect/schema/URLSearchParams\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.URLSearchParams`,\n Type: `globalThis.URLSearchParams`\n }),\n expected: \"URLSearchParams\",\n toCodecJson: () => link()(String4.annotate({\n expected: \"a query string that will be decoded as URLSearchParams\"\n }), transform2({\n decode: (e) => new globalThis.URLSearchParams(e),\n encode: (params) => params.toString()\n }))\n});\nvar Base64String = /* @__PURE__ */ String4.annotate({\n expected: \"a base64 encoded string that will be decoded as Uint8Array\",\n format: \"byte\",\n contentEncoding: \"base64\"\n});\nvar Uint8Array2 = /* @__PURE__ */ instanceOf(globalThis.Uint8Array, {\n representation: {\n id: \"effect/schema/Uint8Array\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.Uint8Array`,\n Type: `globalThis.Uint8Array`\n }),\n expected: \"Uint8Array\",\n toCodecJson: () => link()(Base64String, uint8ArrayFromBase64String)\n});\nvar arbitraryMinimumDateTimestamp = -864e13;\nvar arbitraryMaximumDateTimestamp = 864e13;\nvar arbitraryMinimumZonedDateTimeTimestamp = arbitraryMinimumDateTimestamp + 14 * 60 * 60 * 1e3;\nvar arbitraryMaximumZonedDateTimeTimestamp = arbitraryMaximumDateTimestamp - 14 * 60 * 60 * 1e3;\nvar arbitraryMinimumTimeZoneOffset = -12 * 60 * 60 * 1e3;\nvar arbitraryMaximumTimeZoneOffset = 14 * 60 * 60 * 1e3;\n\n// src/build/snapshot-programs/pinned-modules.ts\nvar system = declare(\n (input) => isObject(input)\n);\nvar typeScriptModule = Struct({\n sys: system,\n matchFiles: declare(\n (input) => isFunction(input)\n ),\n createCompilerHost: declare(\n (input) => isFunction(input)\n ),\n createProgram: declare(\n (input) => isFunction(input)\n ),\n flattenDiagnosticMessageText: declare(\n (input) => isFunction(input)\n ),\n formatDiagnosticsWithColorAndContext: declare(\n (input) => isFunction(input)\n ),\n getParsedCommandLineOfConfigFile: declare(\n (input) => isFunction(input)\n ),\n getPreEmitDiagnostics: declare(\n (input) => isFunction(input)\n )\n});\nvar tailwindModule = declare(\n (input) => hasProperty(input, \"compile\") && isFunction(input.compile)\n);\nvar tailwindNodeModule = Struct({\n compile: declare(\n (input) => isFunction(input)\n ),\n optimize: declare(\n (input) => isFunction(input)\n ),\n loadModule: declare(\n (input) => isFunction(input)\n )\n});\nvar tailwindOxideModule = Struct({\n Scanner: declare(\n (input) => isFunction(input)\n )\n});\nvar enhancedResolveModule = declare(\n (input) => hasProperty(input, \"ResolverFactory\") && hasProperty(input.ResolverFactory, \"createResolver\") && isFunction(input.ResolverFactory.createResolver)\n);\n\n// src/build/snapshot-programs/snapshot-path.ts\nimport { isAbsolute, relative, resolve as resolve3, sep } from \"node:path\";\nfunction isInsideSnapshot(snapshot2, path) {\n const suffix = relative(snapshot2, resolve3(path));\n return suffix !== \"..\" && !suffix.startsWith(`..${sep}`) && !isAbsolute(suffix);\n}\n\n// src/build/build-step.ts\nvar workspaceBuildStepSchema = Union2([\n Struct({\n kind: Literal2(\"typescript\"),\n config: String4\n }),\n Struct({\n kind: Literal2(\"tailwind\"),\n input: String4,\n output: String4\n })\n]);\nvar workspaceBuildStepsJsonSchema = fromJsonString2(\n ArraySchema(workspaceBuildStepSchema)\n);\n\n// src/build/snapshot-programs/dependency-build.ts\nfunction programArguments() {\n const [snapshot2, appDirectory2, format3, steps2, ...rest] = process.argv.slice(2);\n if (snapshot2 === void 0 || appDirectory2 === void 0 || format3 === void 0 || steps2 === void 0 || rest.length > 0)\n throw new Error(\n \"Dependency build requires a snapshot, App directory, format and steps\"\n );\n return {\n snapshot: snapshot2,\n appDirectory: appDirectory2,\n format: format3,\n steps: decodeUnknownSync(workspaceBuildStepsJsonSchema)(steps2)\n };\n}\nvar { snapshot, appDirectory, format: format2, steps } = programArguments();\nfunction inSnapshot(path) {\n return isInsideSnapshot(snapshot, path);\n}\nfunction contained(path, links = 0) {\n const candidate = resolve4(path);\n if (!inSnapshot(candidate)) {\n throw new Error(\n `Dependency build input escapes captured snapshot: ${path}`\n );\n }\n if (links > 40)\n throw new Error(\"Captured dependency has too many symbolic links\");\n const parts = relative2(snapshot, candidate).split(sep2).filter(Boolean);\n let current = snapshot;\n for (const [index, part] of parts.entries()) {\n current = join(current, part);\n let stat;\n try {\n stat = fs.lstatSync(current, { throwIfNoEntry: false });\n } catch (error) {\n if (error instanceof Error && \"code\" in error && error.code === \"ENOTDIR\")\n return candidate;\n throw error;\n }\n if (!stat) return candidate;\n if (stat.isSymbolicLink()) {\n const target = resolve4(dirname(current), fs.readlinkSync(current));\n return contained(join(target, ...parts.slice(index + 1)), links + 1);\n }\n }\n return candidate;\n}\nvar require2 = createRequire(import.meta.url);\nfunction loadPinned(module, path) {\n const loaded = require2(contained(require2.resolve(contained(path))));\n return decodeUnknownSync(module)(loaded);\n}\nfunction compileTypeScript(compilerSteps) {\n const ts = loadPinned(\n typeScriptModule,\n join(snapshot, appDirectory, \"node_modules/typescript/lib/typescript.js\")\n );\n const entries = (path) => {\n const directory = contained(path);\n let names;\n try {\n names = fs.readdirSync(directory, { withFileTypes: true });\n } catch (error) {\n if (error instanceof Error && \"code\" in error && (error.code === \"ENOENT\" || error.code === \"ENOTDIR\"))\n return { files: [], directories: [] };\n throw error;\n }\n const files = [];\n const directories = [];\n for (const entry of names) {\n const entryPath = contained(join(directory, entry.name));\n const stat = entry.isSymbolicLink() ? fs.statSync(entryPath) : entry;\n if (stat.isFile()) files.push(entry.name);\n else if (stat.isDirectory()) directories.push(entry.name);\n }\n return { files: files.sort(), directories: directories.sort() };\n };\n const filesystem = {\n readFile: (path) => ts.sys.readFile(contained(path)),\n // Compiler fallback searches may climb ancestors. Outside paths are absent\n // without probing the host; explicit reads/enumerations still reject them.\n fileExists: (path) => inSnapshot(path) && ts.sys.fileExists(contained(path)),\n directoryExists: (path) => inSnapshot(path) && ts.sys.directoryExists(contained(path)),\n getDirectories: (path) => [...entries(path).directories],\n realpath: (path) => contained(path),\n createDirectory: (path) => {\n ts.sys.createDirectory(contained(path));\n },\n readDirectory: (path, extensions, excludes, includes, depth) => {\n contained(path);\n for (const pattern of [...excludes ?? [], ...includes ?? []])\n contained(resolve4(path, pattern));\n return ts.matchFiles(\n path,\n extensions,\n excludes,\n includes,\n ts.sys.useCaseSensitiveFileNames,\n snapshot,\n depth,\n entries,\n (entry) => contained(entry)\n );\n }\n };\n const diagnosticHost = {\n getCurrentDirectory: () => snapshot,\n getCanonicalFileName: (path) => path,\n getNewLine: () => \"\\n\"\n };\n let previousProgram;\n for (const compilerStep of compilerSteps) {\n if (compilerStep.kind !== \"typescript\")\n throw new Error(\"Compiler group contains a non-TypeScript step\");\n const config = contained(join(snapshot, compilerStep.config));\n const configHost = {\n ...ts.sys,\n ...filesystem,\n onUnRecoverableConfigFileDiagnostic: (diagnostic) => {\n throw new Error(\n ts.flattenDiagnosticMessageText(diagnostic.messageText, \"\\n\")\n );\n }\n };\n const parsed = ts.getParsedCommandLineOfConfigFile(config, {}, configHost);\n if (!parsed) throw new Error(\"Captured TypeScript config is invalid\");\n if (parsed.errors.length)\n throw new Error(\n ts.formatDiagnosticsWithColorAndContext(parsed.errors, diagnosticHost)\n );\n const host = Object.assign(\n ts.createCompilerHost(parsed.options),\n filesystem\n );\n const writeFile = host.writeFile;\n host.writeFile = (path, ...rest) => {\n writeFile(contained(path), ...rest);\n };\n const programOptions = {\n rootNames: parsed.fileNames.map((path) => contained(path)),\n options: parsed.options,\n host\n };\n if (parsed.projectReferences !== void 0)\n programOptions.projectReferences = parsed.projectReferences;\n if (previousProgram !== void 0)\n programOptions.oldProgram = previousProgram;\n const program = ts.createProgram(programOptions);\n const diagnostics = ts.getPreEmitDiagnostics(program);\n if (diagnostics.length)\n throw new Error(\n ts.formatDiagnosticsWithColorAndContext(diagnostics, diagnosticHost)\n );\n const emitted = program.emit();\n if (emitted.emitSkipped || emitted.diagnostics.length)\n throw new Error(\"Captured TypeScript emit failed\");\n previousProgram = program;\n }\n}\nvar snapshotFileSystem = {\n statSync: (path, ...options) => {\n contained(path);\n return fs.statSync(path, ...options);\n },\n lstatSync: (path, ...options) => {\n contained(path);\n return fs.lstatSync(path, ...options);\n },\n readFileSync: (path, ...options) => {\n contained(path);\n return fs.readFileSync(path, ...options);\n },\n readdirSync: (path, ...options) => {\n contained(path);\n return fs.readdirSync(path, ...options);\n },\n readlinkSync: (path, ...options) => {\n contained(path);\n return fs.readlinkSync(path, ...options);\n }\n};\nfunction settled(compute) {\n return new Promise((settle) => {\n settle(compute());\n });\n}\nfunction resolvedPath(path, id) {\n if (path === false)\n throw new Error(`Captured stylesheet dependency did not resolve: ${id}`);\n return contained(path);\n}\nasync function compileTailwind(stylesheet) {\n const cli = contained(\n join(snapshot, \"packages/caps/node_modules/@tailwindcss/cli\")\n );\n const modules = contained(resolve4(cli, \"../..\"));\n const { compile: compile2 } = loadPinned(\n tailwindModule,\n join(modules, \"tailwindcss/dist/lib.js\")\n );\n const {\n compile: compileNode,\n optimize: optimize2,\n loadModule\n } = loadPinned(\n tailwindNodeModule,\n join(modules, \"@tailwindcss/node/dist/index.js\")\n );\n const { Scanner } = loadPinned(\n tailwindOxideModule,\n join(modules, \"@tailwindcss/oxide/index.js\")\n );\n const { ResolverFactory } = loadPinned(\n enhancedResolveModule,\n join(modules, \"enhanced-resolve/lib/index.js\")\n );\n const cssResolver = ResolverFactory.createResolver({\n fileSystem: snapshotFileSystem,\n useSyncFileSystemCalls: true,\n extensions: [\".css\"],\n mainFields: [\"style\"],\n conditionNames: [\"style\"],\n modules: [\"node_modules\"]\n });\n const jsResolver = ResolverFactory.createResolver({\n fileSystem: snapshotFileSystem,\n useSyncFileSystemCalls: true,\n extensions: [\".js\", \".json\", \".node\"],\n conditionNames: [\"node\", \"import\"],\n modules: [\"node_modules\"]\n });\n const resolveCss = (id, base) => resolvedPath(cssResolver.resolveSync({}, contained(base), id), id);\n const resolveJs = (id, base) => settled(() => {\n contained(base);\n const typography = id === \"@tailwindcss/typography\";\n if (id !== \"daisyui\" && id !== \"daisyui/theme\" && !typography)\n throw new Error(\"Only the pinned stylesheet plugins are allowed\");\n return resolvedPath(jsResolver.resolveSync({}, base, id), id);\n });\n const input = contained(join(snapshot, stylesheet.input));\n let compiled = await compile2(fs.readFileSync(input, \"utf8\"), {\n base: dirname(input),\n from: input,\n loadModule: (id, base) => loadModule(id, contained(base), contained, resolveJs),\n loadStylesheet: (id, base) => settled(() => {\n const path = resolveCss(id, base);\n return {\n path,\n base: dirname(path),\n content: fs.readFileSync(path, \"utf8\")\n };\n })\n });\n const sources = [...compiled.sources];\n if (compiled.root === null)\n sources.push({\n base: join(snapshot, appDirectory),\n pattern: \"**/*\",\n negated: false\n });\n else if (compiled.root !== \"none\")\n sources.push({ ...compiled.root, negated: false });\n for (const source of sources) {\n contained(source.base);\n contained(resolve4(source.base, source.pattern));\n }\n if (format2 === \"assets\") {\n compiled = await compileNode(fs.readFileSync(input, \"utf8\"), {\n base: dirname(input),\n from: input,\n shouldRewriteUrls: true,\n onDependency: contained,\n customCssResolver: (id, base) => settled(() => resolveCss(id, base)),\n customJsResolver: resolveJs\n });\n }\n const scanner = new Scanner({ sources });\n const candidates = scanner.scan();\n for (const source of scanner.globs) contained(source.base);\n for (const file of scanner.files) contained(file);\n const css = optimize2(compiled.build(candidates), { minify: true }).code;\n const output = contained(join(snapshot, stylesheet.output));\n fs.writeFileSync(output, css);\n}\nvar [first, ...following] = steps;\nif (first === void 0) throw new Error(\"Dependency build has no steps\");\nif (first.kind === \"typescript\") compileTypeScript(steps);\nelse {\n if (following.length)\n throw new Error(\"Only TypeScript steps can share a compiler process\");\n await compileTailwind(first);\n}\n";
2
+ export const htmlBuildProgram = "// src/build/snapshot-programs/html-build.ts\nimport { Buffer } from \"node:buffer\";\nimport { writeFile } from \"node:fs/promises\";\nimport { isAbsolute as isAbsolute2, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { build, version } from \"vite\";\n\n// src/build/snapshot-programs/snapshot-path.ts\nimport { isAbsolute, relative, resolve, sep } from \"node:path\";\nfunction isInsideSnapshot(snapshot2, path) {\n const suffix = relative(snapshot2, resolve(path));\n return suffix !== \"..\" && !suffix.startsWith(`..${sep}`) && !isAbsolute(suffix);\n}\n\n// src/build/snapshot-programs/html-build.ts\nfunction programArguments() {\n const [\n snapshot2,\n maximum2,\n appDirectory2,\n format2,\n assetBase2,\n entryDirectory2,\n reactEnabled2,\n shellEntry2\n ] = process.argv.slice(2);\n if (snapshot2 === void 0 || maximum2 === void 0 || appDirectory2 === void 0 || format2 === void 0 || assetBase2 === void 0 || entryDirectory2 === void 0 || reactEnabled2 === void 0 || shellEntry2 === void 0)\n throw new Error(\n \"HTML build requires a snapshot, bound, App directory, format, asset base, entry directory, React flag and shell entry\"\n );\n return {\n snapshot: snapshot2,\n maximum: maximum2,\n appDirectory: appDirectory2,\n format: format2,\n assetBase: assetBase2,\n entryDirectory: entryDirectory2,\n reactEnabled: reactEnabled2,\n shellEntry: shellEntry2\n };\n}\nvar {\n snapshot,\n maximum,\n appDirectory,\n format,\n assetBase,\n entryDirectory,\n reactEnabled,\n shellEntry\n} = programArguments();\nvar reactPlugins = reactEnabled === \"true\" ? [(await import(\"@vitejs/plugin-react\")).default()] : [];\nvar splitAssets = format === \"assets\";\nif (shellEntry !== \"\" && (!splitAssets || assetBase !== \"./\")) {\n throw new Error(\"A shell module requires split assets with a relative base\");\n}\nvar shellModule = shellEntry === \"\" ? {} : {\n input: {\n index: join(snapshot, entryDirectory, \"index.html\"),\n shell: join(snapshot, appDirectory, shellEntry)\n },\n preserveEntrySignatures: \"exports-only\"\n};\nvar shellOutput = shellEntry === \"\" ? {} : {\n entryFileNames: (chunk) => chunk.isEntry && chunk.name === \"shell\" ? \"shell.js\" : \"assets/[name]-[hash].js\"\n};\nvar singleFilePlugins = splitAssets ? [] : [\n (await import(\"vite-plugin-singlefile\")).viteSingleFile({\n useRecommendedBuildConfig: false\n })\n];\nvar maxBytes = Number(maximum);\nif (process.versions.node !== \"24.20.0\")\n throw new Error(\"Publisher requires Node 24.20.0\");\nif (version !== \"8.2.2\")\n throw new Error(\"Captured Vite version differs from the recipe\");\nvar result = await build({\n root: join(snapshot, entryDirectory),\n configFile: false,\n envDir: false,\n base: splitAssets ? assetBase : \"/\",\n envPrefix: [],\n mode: \"production\",\n logLevel: \"warn\",\n resolve: { dedupe: [\"react\", \"react-dom\"] },\n css: { postcss: { plugins: [] } },\n plugins: [\n {\n name: \"captured-source-only\",\n enforce: \"pre\",\n load(id) {\n if (!isAbsolute2(id)) return;\n const path = fileURLToPath(new URL(id, \"file:///\"));\n if (!isInsideSnapshot(snapshot, path)) {\n throw new Error(\n \"HTML build resolved an input outside its captured snapshot\"\n );\n }\n }\n },\n ...reactPlugins,\n ...singleFilePlugins\n ],\n build: {\n target: \"es2022\",\n write: splitAssets,\n cssCodeSplit: splitAssets,\n outDir: join(snapshot, \".publisher-output\"),\n assetsInlineLimit: splitAssets ? 0 : maxBytes,\n sourcemap: false,\n emptyOutDir: false,\n rolldownOptions: {\n ...shellModule,\n output: { inlineDynamicImports: !splitAssets, ...shellOutput }\n }\n }\n});\nif (shellEntry !== \"\" && !(!Array.isArray(result) && \"output\" in result && result.output.some(\n (chunk) => chunk.type === \"chunk\" && chunk.isEntry && chunk.fileName === \"shell.js\"\n))) {\n throw new Error(\"Shell build must emit its shell module as shell.js\");\n}\nif (!splitAssets) {\n if (Array.isArray(result) || !(\"output\" in result) || result.output.length !== 1) {\n throw new Error(\"HTML build must emit exactly one complete HTML file\");\n }\n const output = result.output.at(0);\n if (output?.type !== \"asset\" || output.fileName !== \"index.html\") {\n throw new Error(\"HTML build must emit exactly one complete HTML file\");\n }\n const bytes = Buffer.from(output.source);\n if (bytes.byteLength > maxBytes)\n throw new Error(\"HTML output exceeded its pinned bound\");\n await writeFile(join(snapshot, \".publisher.html\"), bytes, { flag: \"wx\" });\n}\n";