clanka 0.7.3 → 0.7.4

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 (49) hide show
  1. package/dist/Acp.d.ts +10 -0
  2. package/dist/Acp.d.ts.map +1 -1
  3. package/dist/Acp.js +1 -2
  4. package/dist/Acp.js.map +1 -1
  5. package/dist/AgentTools.d.ts.map +1 -1
  6. package/dist/AgentTools.js +1 -2
  7. package/dist/AgentTools.js.map +1 -1
  8. package/dist/GlobalWebSocket.d.ts +15 -0
  9. package/dist/GlobalWebSocket.d.ts.map +1 -0
  10. package/dist/GlobalWebSocket.js +26 -0
  11. package/dist/GlobalWebSocket.js.map +1 -0
  12. package/dist/WebToMarkdown.d.ts.map +1 -1
  13. package/dist/WebToMarkdown.js +8 -4
  14. package/dist/WebToMarkdown.js.map +1 -1
  15. package/dist/bin/Effect-DdkIoNCD.mjs +5058 -0
  16. package/dist/bin/Effect-DdkIoNCD.mjs.map +1 -0
  17. package/dist/bin/{McpClient-D6vFD-wP.mjs → McpClient-CJ0Vugoi.mjs} +582 -2896
  18. package/dist/bin/{McpClient-D6vFD-wP.mjs.map → McpClient-CJ0Vugoi.mjs.map} +1 -1
  19. package/dist/bin/OutputFormatter-DN8OGwuK.mjs +575 -0
  20. package/dist/bin/OutputFormatter-DN8OGwuK.mjs.map +1 -0
  21. package/dist/bin/Schema-BALIXGp7.mjs +5475 -0
  22. package/dist/bin/Schema-BALIXGp7.mjs.map +1 -0
  23. package/dist/bin/{SemanticSearch-D9iZ_Mi9.mjs → SemanticSearch-O6PZBRfd.mjs} +147 -1160
  24. package/dist/bin/{SemanticSearch-D9iZ_Mi9.mjs.map → SemanticSearch-O6PZBRfd.mjs.map} +1 -1
  25. package/dist/bin/Stream-B5ebASRi.mjs +2090 -0
  26. package/dist/bin/Stream-B5ebASRi.mjs.map +1 -0
  27. package/dist/bin/cli.mjs +9628 -41430
  28. package/dist/bin/cli.mjs.map +1 -1
  29. package/dist/bin/index.min-CI3qqohw.mjs +3300 -0
  30. package/dist/bin/index.min-CI3qqohw.mjs.map +1 -0
  31. package/dist/bin/turndown.cjs-usmCKZ4b.mjs +15195 -0
  32. package/dist/bin/turndown.cjs-usmCKZ4b.mjs.map +1 -0
  33. package/dist/cli.js +9 -5
  34. package/dist/cli.js.map +1 -1
  35. package/dist/index.d.ts +4 -0
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +4 -0
  38. package/dist/index.js.map +1 -1
  39. package/package.json +2 -4
  40. package/src/Acp.ts +1 -2
  41. package/src/AgentTools.ts +3 -2
  42. package/src/GlobalWebSocket.ts +40 -0
  43. package/src/WebToMarkdown.ts +17 -7
  44. package/src/cli.ts +14 -5
  45. package/src/index.ts +5 -0
  46. package/dist/bin/Schema-D6y3R-At.mjs +0 -28728
  47. package/dist/bin/Schema-D6y3R-At.mjs.map +0 -1
  48. package/dist/bin/Undici-ChB4UBDa.mjs +0 -28
  49. package/dist/bin/Undici-ChB4UBDa.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Schema-BALIXGp7.mjs","names":["makeEquivalence","Equivalence.Tuple","InternalRecord.assignProperty","makeEquivalence","effect.ClockRef","effect.currentTimeMillis","TypeId","Proto","Inspectable.NodeInspectSymbol","toDateUtc","Hash.symbol","Hash.number","Equal.symbol","isDateTime","Hash.combine","Hash.hash","Equal.equals","Hash.string","Predicate.hasProperty","isUtc","fromDateUnsafe","makeUnsafe","make","now","Clock.currentTimeMillis","toUtc","toEpochMillis","removeTime","formatIso","formatIsoDate","value","TypeId","make","Proto","Hash.symbol","Hash.hash","Equal.symbol","Equal.equals","redacted.value","Equivalence.make","TypeId","Hash.symbol","Hash.combine","Hash.hash","Hash.number","Equal.symbol","make","Equivalence","Internal.isDateTime","Internal.isUtc","Internal.fromDateUnsafe","Internal.makeUnsafe","make","Internal.make","Internal.now","Internal.toUtc","Internal.toDateUtc","Internal.toEpochMillis","Internal.removeTime","Internal.formatIso","Internal.formatIsoDate","resolveAt","resolveIdentifier","resolveDescription","Exit.succeed","Option.none","Option.some","TypeId","InternalParser.missing","Filter","Arr.isReadonlyArrayNonEmpty","Arr.map","InternalAnnotations.getExpected","format","Cause.isFailReason","SchemaIssue.isIssue","Pipeable.Class","Effect.mapEager","Option.map","Effect.flatMapEager","Effect.fail","Option.isSome","SchemaIssue.Forbidden","passthrough_","Effect.succeed","passthrough","Option.isNone","Effect.succeedNone","transform","transformOptional","transformEffect","Option.some","omit","Option.filter","Predicate.isNotUndefined","String","Number","BigInt","Date","Effect.try","SchemaIssue.InvalidValue","Encoding.encodeBase64","Effect.mapErrorEager","Effect.fromResult","Encoding.decodeBase64","dateTimeUtcFromInput","Option.match","DateTime.make","DateTime.toUtc","TypeId","Predicate.hasProperty","make","SchemaGetter.transformEffect","SchemaGetter.transform","SchemaGetter.transformOptional","Predicate.isObject","format","Predicate.isError","Option.fromNullOr","Option.getOrNull","Option.filter","Predicate.isNotUndefined","Option.some","Option.flatten","Effect.succeed","Effect.fail","SchemaIssue.InvalidValue","fromJsonString","SchemaGetter.parseJson","SchemaGetter.stringifyJson","TypeId","InternalParser.missing","InternalParser.missingExit","Null","Undefined","SchemaTransformation.Transformation","Void","succeed","InternalParser.succeed","Never","Predicate.isNever","Any","Predicate.isUnknown","Unknown","Literal","format","SchemaGetter.transform","String","Predicate.isString","Number","Predicate.isNumber","Boolean","Predicate.isBoolean","BigInt","Predicate.isBigInt","Effect.fnUntracedEager","Effect.fail","SchemaIssue.InvalidType","SchemaIssue.UnexpectedKey","SchemaIssue.Pointer","SchemaIssue.Composite","InternalParser.sameExit","InternalParser.args","SchemaIssue.MissingKey","Exit.fail","InternalSchemaCause.getSchemaIssue","Exit.failCause","Cause.map","toEncoded","Predicate.isNotNullish","Exit.void","Effect.flatMap","Effect.exit","Arr.empty","Effect.flatMapEager","Effect.die","Union","mutable","InternalAnnotations.SENTINELS_ANNOTATION_KEY","Predicate.isObjectKeyword","SchemaIssue.AnyOf","Effect.catchCause","Effect.succeed","SchemaIssue.OneOf","Pipeable.Class","makeFilter","SchemaIssue.normalizeFilterOutput","isFinite","isPattern","Arr.append","brand","InternalAnnotations.resolveBrands","optionalKey","optional","withConstructorDefault","SchemaGetter.withDefault","SchemaGetter.passthrough","decodeTo","Predicate.isPropertyKey","Arr.isArrayNonEmpty","toType","SchemaTransformation.numberFromString","SchemaTransformation.bigintFromString","SchemaIssue.Filter","InternalAnnotations.CONSTRUCTOR_ANNOTATION_KEY","Predicate.isFunction","InternalAnnotations.resolveAt","InternalAnnotations.resolveIdentifier","InternalAnnotations.resolveDescription","Json","MutableJson","SchemaAST.toType","Effect.runSyncExit","Exit.isSuccess","Option.some","Option.none","make","InternalSchemaCause.getSchemaIssueOrThrow","is","SchemaAST.defaultParseOptions","decodeUnknownEffect","decodeEffect","decodeUnknownOption","encodeUnknownEffect","SchemaAST.flip","encodeEffect","InternalParser.missing","Effect.fail","SchemaIssue.InvalidValue","Effect.succeed","InternalParser.sameExit","Effect.flatMapEager","InternalParser.args","InternalParser.toOption","InternalParser.succeed","Effect.mapEager","InternalParser.fromOptionExit","InternalParser.missingExit","SchemaAST.getConstructorDescriptor","SchemaAST.collectIssues","SchemaIssue.Composite","Effect.flatMap","Effect.catchCause","Effect.failCauseSync","Cause.map","SchemaIssue.Encoding","TypeId","Pipeable.pipeArguments","SchemaAST.annotate","SchemaAST.annotateKey","SchemaAST.appendChecks","make","SchemaParser.makeEffect","SchemaParser.make","SchemaParser.makeOption","Predicate.isObject","toCodecJson","InternalMake.make","SchemaAST.replaceContextLastLink","SchemaAST.Context","SchemaAST.toEncoded","Predicate.isFunction","SchemaAST.replaceEncoding","SchemaAST.unknownToJson","SchemaAST.mapLink","SchemaAST.objectKeywordToJson","SchemaAST.parameterFromString","SchemaAST.Union","toCodecStringTree","SchemaAST.unknownToStringTree","SchemaAST.Link","SchemaAST.Literal","InternalTransformation.Transformation","RegExp","InternalAnnotations.annotationExcludedKeys","InternalAnnotations.IDENTIFIER_FALLBACK_KEY","InternalAnnotations.jsonSchemaAnnotationKeys","InternalAST.isJson","Arr.map","Equal.equals","RegEx.escape","InternalAST.STRING_PATTERN","InternalAST.FINITE_PATTERN","toJsonSchemaDocument","Arr.map","InternalAnnotations.resolveIdentifierFallback","SchemaAST.annotate","InternalAnnotations.IDENTIFIER_FALLBACK_KEY","SchemaAST.getLastEncoding","SchemaAST.getContextOwner","InternalAnnotations.resolveIdentifier","SchemaAST.toType","SchemaAST.isOptional","SchemaAST.isMutable","isSchemaError","Predicate.hasProperty","TypeId","Predicate.hasProperty","Data.Error","Proto","Inspectable.BaseProto","Record.map","Duration.seconds","empty","Result.fail","Result.succeed","Duration.isFinite","Duration.fromInputUnsafe","Result.getOrThrow","Duration.toSeconds","toRecord","TypeId","Equal.symbol","Hash.symbol","Hash.array","make","Arr.fromIterable","InternalMake.TypeId","SchemaAST.Declaration","SchemaAST.getAST","Effect.succeed","Effect.fail","SchemaIssue.InvalidType","SchemaIssue.defaultFormatter","isSchemaErrorInternal","Effect.catchCause","Effect.failCauseSync","Cause_.map","Exit_.isSuccess","Exit_.failCause","Cause_.isFailReason","Effect.runSyncExit","SchemaParser.is","SchemaParser.decodeUnknownEffect","SchemaParser.decodeUnknownOption","SchemaParser.encodeUnknownEffect","InternalMake.make","Predicate.hasProperty","SchemaAST.optionalKey","SchemaAST.optional","SchemaAST.toType","SchemaAST.toEncoded","SchemaAST.Literal","SchemaGetter.transform","SchemaAST.never","SchemaAST.any","SchemaAST.unknown","SchemaAST.null","SchemaAST.undefined","String","SchemaAST.string","Number","SchemaAST.number","SchemaAST.boolean","BigInt","SchemaAST.bigInt","SchemaAST.void","SchemaAST.struct","SchemaAST.record","SchemaAST.structWithRest","SchemaAST.tuple","SchemaAST.Arrays","SchemaAST.mutable","SchemaAST.union","SchemaAST.brand","SchemaAST.decodeTo","SchemaTransformation.make","SchemaTransformation.passthrough","SchemaGetter.forbiddenEncoding","SchemaAST.withConstructorDefault","SchemaGetter.omit","SchemaGetter.passthrough","SchemaGetter.withDefault","SchemaAST.isUnion","SchemaAST.collectSentinels","Predicate.isPropertyKey","SchemaAST.Link","SchemaAST.makeFilter","SchemaAST.FilterGroup","format","SchemaAST.isPattern","SchemaAST.finite","SchemaAST.isFinite","Order.isGreaterThan","Order.isGreaterThanOrEqualTo","Order.isLessThan","Order.isLessThanOrEqualTo","Order.Number","Order.Date","Order.BigInt","InternalAnnotations.STRUCTURAL_ANNOTATION_KEY","SchemaParser._issue","SchemaIssue.Pointer","Arr.isArrayNonEmpty","SchemaIssue.Composite","SchemaTransformation.defectFromJson","SchemaTransformation.transformEffect","Effect.try","SchemaIssue.InvalidValue","URL","SchemaTransformation.urlFromString","Date","SchemaTransformation.dateFromString","SchemaTransformation.fromJsonString","Result_.match","Encoding.decodeBase64","Effect.tryPromise","Encoding.encodeBase64","FormData","URLSearchParams","SchemaTransformation.transform","SchemaTransformation.uint8ArrayFromBase64String","BigDecimal_.Order","BigDecimal_.format","Cause_.isReason","Effect.mapBothEager","Cause_.makeFailReason","SchemaIssue.makeCompositeAtKey","Cause_.makeDieReason","Cause_.makeInterruptReason","Cause_.isCause","Cause_.fromReasons","SchemaGetter.transformEffect","Option_.match","DateTime.make","DateTime.toUtc","DateTime.formatIso","DateTime.isDateTime","DateTime.isUtc","DateTime.makeUnsafe","DateTime.toDateUtc","DateTime.toEpochMillis","Duration_.isDuration","Duration_.infinity","Duration_.negativeInfinity","Duration_.nanos","Duration_.millis","Exit_.isExit","Exit_.succeed","Option_.isOption","Option_.isNone","Effect.succeedNone","Option_.some","Option_.none","Option_.isSome","SchemaTransformation.optionFromNullOr","Cookies_.isCookie","Cookies_.isCookies","Cookies_.fromSetCookie","Cookies_.toSetCookieHeaders","Cookies_.fromReadonlyRecord","Cookies_.toRecord","Cookies_.fromIterable","Cookies_.makeCookieUnsafe","UrlParams_.isUrlParams","UrlParams_.Equivalence","UrlParams_.make","UrlParams_.toReadonlyRecord","UrlParams_.fromInput","SchemaTransformation.optionFromOptional","value","Redacted_.isRedacted","Effect.mapErrorEager","Effect.void","Effect.flatMapEager","Redacted_.value","Redacted_.make","SchemaGetter.forbidden","Redacted_.makeEquivalence","struct","internalOptions","Pipeable.pipeArguments","SchemaParser.make","SchemaParser.makeOption","SchemaAST.annotate","SchemaAST.annotateKey","SchemaAST.appendChecks","SchemaTransformation.Transformation","InternalAnnotations.CONSTRUCTOR_ANNOTATION_KEY","InternalAnnotations.SENTINELS_ANNOTATION_KEY","Data.Class","Error","core.Error","InternalToRepresentation.toRepresentation","InternalToCodec.toCodecJsonAST","InternalToJsonSchemaDocument.toJsonSchemaDocument","InternalToCodec.toCodecJson","InternalToCodec.toCodecStringTree","SchemaAST.Json","SchemaAST.MutableJson"],"sources":["../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Tuple.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Record.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Clock.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/dateTime.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/redacted.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Redacted.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/BigDecimal.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/DateTime.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/annotations.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/parser.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaIssue.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/cause.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaGetter.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaTransformation.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaAST.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaParser.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/make.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/JsonPointer.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/JsonSchema.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toCodec.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/RegExp.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/errors.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toRepresentation.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Struct.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schemaError.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/http/Cookies.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/http/UrlParams.js","../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Schema.js"],"sourcesContent":["/**\n * Works with fixed-length arrays, also called tuples.\n *\n * The runtime helpers in this module create new tuples instead of mutating\n * their inputs, and the types preserve element positions where possible. The\n * helpers cover tuple construction, indexed access, selecting or removing\n * positions, appending values, transforming elements, renaming indices, mapping\n * typed positions, and deriving comparison or combination helpers for tuple\n * shapes.\n *\n * @since 2.0.0\n */\nimport * as Combiner from \"./Combiner.js\";\nimport * as Equivalence from \"./Equivalence.js\";\nimport { dual } from \"./Function.js\";\nimport * as order from \"./Order.js\";\nimport * as Reducer from \"./Reducer.js\";\n/**\n * Creates a tuple from the provided arguments.\n *\n * **When to use**\n *\n * Use when you need a properly typed tuple without writing `[a, b, c] as const`\n * or another manual cast.\n *\n * **Details**\n *\n * The returned value has the exact tuple type, with each element's literal type\n * preserved.\n *\n * **Example** (Creating a tuple)\n *\n * ```ts import.meta.vitest\n * import { Tuple } from \"effect\"\n *\n * Tuple.make(10, 20, \"red\") // => [10, 20, \"red\"]\n * ```\n *\n * @see {@link get} – access a single element by index\n * @see {@link appendElement} – append an element to a tuple\n * @category constructors\n * @since 2.0.0\n */\nexport const make = (...elements) => elements;\n/**\n * Retrieves the element at the specified index from a tuple.\n *\n * **When to use**\n *\n * Use when a single tuple element should be extracted in a pipeline.\n *\n * **Details**\n *\n * The index is constrained to valid tuple positions at the type level.\n *\n * **Example** (Extracting an element by index)\n *\n * ```ts import.meta.vitest\n * import { pipe, Tuple } from \"effect\"\n *\n * pipe(Tuple.make(1, true, \"hello\"), Tuple.get(2)) // => \"hello\"\n * ```\n *\n * @see {@link make} – create a tuple\n * @see {@link pick} – extract multiple elements into a new tuple\n * @category getters\n * @since 4.0.0\n */\nexport const get = /*#__PURE__*/dual(2, (self, index) => self[index]);\n/**\n * Creates a new tuple containing only the elements at the specified indices.\n *\n * **When to use**\n *\n * Use to select a subset of elements from a tuple by position.\n *\n * **Details**\n *\n * The result order matches the order of the provided indices.\n *\n * **Example** (Selecting elements by index)\n *\n * ```ts import.meta.vitest\n * import { Tuple } from \"effect\"\n *\n * Tuple.pick([\"a\", \"b\", \"c\", \"d\"], [0, 2, 3]) // => [\"a\", \"c\", \"d\"]\n * ```\n *\n * @see {@link omit} – the inverse (exclude indices instead)\n * @see {@link get} – extract a single element\n * @category filtering\n * @since 4.0.0\n */\nexport const pick = /*#__PURE__*/dual(2, (self, indices) => {\n return indices.map(i => self[i]);\n});\n/**\n * Creates a new tuple with the elements at the specified indices removed.\n *\n * **When to use**\n *\n * Use to drop elements from a tuple by position.\n *\n * **Details**\n *\n * Elements not at the specified indices are kept in their original order.\n *\n * **Example** (Removing elements by index)\n *\n * ```ts import.meta.vitest\n * import { Tuple } from \"effect\"\n *\n * Tuple.omit([\"a\", \"b\", \"c\", \"d\"], [1, 3]) // => [\"a\", \"c\"]\n * ```\n *\n * @see {@link pick} – the inverse (keep only specified indices)\n * @category filtering\n * @since 4.0.0\n */\nexport const omit = /*#__PURE__*/dual(2, (self, indices) => {\n const toDrop = new Set(indices);\n return self.filter((_, i) => !toDrop.has(i));\n});\n/**\n * Appends a single element to the end of a tuple.\n *\n * **When to use**\n *\n * Use when you need the appended value to remain part of the tuple's type-level\n * shape and preserve literal element positions.\n *\n * **Details**\n *\n * The result type is `[...T, E]`, preserving all existing element types.\n *\n * **Example** (Appending an element)\n *\n * ```ts import.meta.vitest\n * import { pipe, Tuple } from \"effect\"\n *\n * pipe(Tuple.make(1, 2), Tuple.appendElement(\"end\")) // => [1, 2, \"end\"]\n * ```\n *\n * @see {@link appendElements} – append multiple elements (another tuple)\n * @category combining\n * @since 2.0.0\n */\nexport const appendElement = /*#__PURE__*/dual(2, (self, element) => [...self, element]);\n/**\n * Concatenates two tuples into a single tuple.\n *\n * **When to use**\n *\n * Use to append all elements from one tuple to another tuple.\n *\n * **Details**\n *\n * The result type is `[...T1, ...T2]`, preserving all element types from both\n * tuples. Neither input tuple is mutated; a fresh tuple is returned.\n *\n * **Example** (Concatenating tuples)\n *\n * ```ts import.meta.vitest\n * import { pipe, Tuple } from \"effect\"\n *\n * pipe(Tuple.make(1, 2), Tuple.appendElements([\"a\", \"b\"] as const)) // => [1, 2, \"a\", \"b\"]\n * ```\n *\n * @see {@link appendElement} – append a single element\n * @category combining\n * @since 4.0.0\n */\nexport const appendElements = /*#__PURE__*/dual(2, (self, that) => [...self, ...that]);\n/**\n * Transforms elements of a tuple by providing an array of transform functions.\n * Each function applies to the element at the same position. Positions beyond\n * the array's length are copied unchanged.\n *\n * **When to use**\n *\n * Use when you want to update the first N elements while keeping the rest.\n *\n * **Details**\n *\n * Each transform function receives the current value and can return a different\n * type.\n *\n * **Example** (Transforming selected elements)\n *\n * ```ts import.meta.vitest\n * import { pipe, Tuple } from \"effect\"\n *\n * pipe(\n * Tuple.make(\"hello\", 42, true),\n * Tuple.evolve([\n * (s) => s.toUpperCase(),\n * (n) => n * 2\n * ])\n * ) // => [\"HELLO\", 84, true]\n * ```\n *\n * @see {@link map} – apply the same transformation to all elements\n * @see {@link renameIndices} – swap element positions\n * @category mapping\n * @since 4.0.0\n */\nexport const evolve = /*#__PURE__*/dual(2, (self, evolver) => {\n return self.map((e, i) => evolver[i] !== undefined ? evolver[i](e) : e);\n});\n/**\n * Renames tuple indices by providing an array of stringified source\n * indices. Each position in the array specifies which index to read from\n * (e.g., `[\"2\", \"1\", \"0\"]` reverses a 3-element tuple).\n *\n * **When to use**\n *\n * Use to reorder tuple elements while preserving index-specific types.\n *\n * **Details**\n *\n * The mapping returns a tuple in the requested index order.\n *\n * **Gotchas**\n *\n * The mapping uses stringified source indices, not arbitrary names.\n *\n * **Example** (Swapping elements)\n *\n * ```ts import.meta.vitest\n * import { pipe, Tuple } from \"effect\"\n *\n * pipe(\n * Tuple.make(\"a\", \"b\", \"c\"),\n * Tuple.renameIndices([\"2\", \"1\", \"0\"])\n * ) // => [\"c\", \"b\", \"a\"]\n * ```\n *\n * @see {@link evolve} – transform element values instead of positions\n * @category transforming\n * @since 4.0.0\n */\nexport const renameIndices = /*#__PURE__*/dual(2, (self, mapping) => {\n return self.map((e, i) => mapping[i] !== undefined ? self[mapping[i]] : e);\n});\n/**\n * Applies a `Struct.Lambda` transformation to every element in a tuple.\n *\n * **When to use**\n *\n * Use when you want to apply the same transformation to every tuple element.\n *\n * **Details**\n *\n * The lambda lets the compiler track the output type for each element.\n *\n * **Gotchas**\n *\n * The lambda must be created with `Struct.lambda`; a plain function will not\n * type-check.\n *\n * **Example** (Wrapping every element in an array)\n *\n * ```ts import.meta.vitest\n * import { pipe, Struct, Tuple } from \"effect\"\n *\n * interface AsArray extends Struct.Lambda {\n * <A>(self: A): Array<A>\n * readonly \"~lambda.out\": Array<this[\"~lambda.in\"]>\n * }\n *\n * const asArray = Struct.lambda<AsArray>((a) => [a])\n * pipe(Tuple.make(1, \"hello\", true), Tuple.map(asArray)) // => [[1], [\"hello\"], [true]]\n * ```\n *\n * @see {@link mapPick} – apply a lambda only to selected indices\n * @see {@link mapOmit} – apply a lambda to all indices except selected ones\n * @see {@link evolve} – apply different functions to different indices\n * @category mapping\n * @since 3.9.0\n */\nexport const map = /*#__PURE__*/dual(2, (self, lambda) => {\n return self.map(e => lambda(e));\n});\n/**\n * Applies a `Struct.Lambda` transformation only to the elements at the\n * specified indices; all other elements are copied unchanged.\n *\n * **When to use**\n *\n * Use when you want to apply the same transformation to a subset of\n * positions.\n *\n * **Example** (Wrapping only selected elements in arrays)\n *\n * ```ts import.meta.vitest\n * import { pipe, Struct, Tuple } from \"effect\"\n *\n * interface AsArray extends Struct.Lambda {\n * <A>(self: A): Array<A>\n * readonly \"~lambda.out\": Array<this[\"~lambda.in\"]>\n * }\n *\n * const asArray = Struct.lambda<AsArray>((a) => [a])\n * pipe(\n * Tuple.make(1, \"hello\", true),\n * Tuple.mapPick([0, 2], asArray)\n * ) // => [[1], \"hello\", [true]]\n * ```\n *\n * @see {@link map} – apply a lambda to all elements\n * @see {@link mapOmit} – apply a lambda to all elements except selected ones\n * @category mapping\n * @since 4.0.0\n */\nexport const mapPick = /*#__PURE__*/dual(3, (self, indices, lambda) => {\n const toPick = new Set(indices);\n return self.map((e, i) => toPick.has(i) ? lambda(e) : e);\n});\n/**\n * Applies a `Struct.Lambda` transformation to all elements except those at the\n * specified indices; the excluded elements are copied unchanged.\n *\n * **When to use**\n *\n * Use when most elements should be transformed but a few should be\n * preserved.\n *\n * **Example** (Wrapping all elements except one in arrays)\n *\n * ```ts import.meta.vitest\n * import { pipe, Struct, Tuple } from \"effect\"\n *\n * interface AsArray extends Struct.Lambda {\n * <A>(self: A): Array<A>\n * readonly \"~lambda.out\": Array<this[\"~lambda.in\"]>\n * }\n *\n * const asArray = Struct.lambda<AsArray>((a) => [a])\n * pipe(\n * Tuple.make(1, \"hello\", true),\n * Tuple.mapOmit([1], asArray)\n * ) // => [[1], \"hello\", [true]]\n * ```\n *\n * @see {@link map} – apply a lambda to all elements\n * @see {@link mapPick} – apply a lambda only to selected indices\n * @category mapping\n * @since 4.0.0\n */\nexport const mapOmit = /*#__PURE__*/dual(3, (self, indices, lambda) => {\n const toOmit = new Set(indices);\n return self.map((e, i) => toOmit.has(i) ? e : lambda(e));\n});\n/**\n * Creates an `Equivalence` for tuples by comparing corresponding elements\n * using the provided per-position `Equivalence`s. Two tuples are equivalent\n * when all their corresponding elements are equivalent.\n *\n * **When to use**\n *\n * Use when you need an `Equivalence` to compare tuples element-by-element.\n *\n * **Details**\n *\n * This is an alias of `Equivalence.Tuple`.\n *\n * **Example** (Comparing tuples for equivalence)\n *\n * ```ts import.meta.vitest\n * import { Equivalence, Tuple } from \"effect\"\n *\n * const eq = Tuple.makeEquivalence([\n * Equivalence.strictEqual<string>(),\n * Equivalence.strictEqual<number>()\n * ])\n *\n * eq([\"Alice\", 30], [\"Alice\", 30]) // => true\n * eq([\"Alice\", 30], [\"Bob\", 30]) // => false\n * ```\n *\n * @see {@link makeOrder} – create an `Order` for tuples\n * @category instances\n * @since 4.0.0\n */\nexport const makeEquivalence = Equivalence.Tuple;\n/**\n * Creates an `Order` for tuples by comparing corresponding elements using the\n * provided per-position `Order`s. Elements are compared left-to-right; the\n * first non-zero comparison determines the result.\n *\n * **When to use**\n *\n * Use when you need to sort fixed-position arrays lexicographically, with each\n * position using its own ordering rule.\n *\n * **Details**\n *\n * This is an alias of `Order.Tuple`.\n *\n * **Example** (Ordering tuples)\n *\n * ```ts import.meta.vitest\n * import { Number, String, Tuple } from \"effect\"\n *\n * const ord = Tuple.makeOrder([String.Order, Number.Order])\n *\n * ord([\"Alice\", 30], [\"Bob\", 25]) // => -1\n * ord([\"Alice\", 30], [\"Alice\", 30]) // => 0\n * ```\n *\n * @see {@link makeEquivalence} – create an `Equivalence` for tuples\n * @category ordering\n * @since 4.0.0\n */\nexport const makeOrder = order.Tuple;\nexport {\n/**\n * Checks whether an array has exactly `N` elements, narrowing the type to a\n * fixed-length tuple.\n *\n * **When to use**\n *\n * Use to guard that an array has exactly the tuple length expected at\n * runtime.\n *\n * **Details**\n *\n * This is a re-export of `Predicate.isTupleOf`. It narrows the type to\n * `TupleOf<N, T>` in the truthy branch.\n *\n * **Gotchas**\n *\n * This only checks `.length`; it does not validate element types.\n *\n * **Example** (Checking exact length)\n *\n * ```ts import.meta.vitest\n * import { Tuple } from \"effect\"\n *\n * const arr: Array<number> = [1, 2, 3]\n * if (Tuple.isTupleOf(arr, 3)) {\n * arr // => [1, 2, 3]\n * }\n * ```\n *\n * @see `isTupleOfAtLeast` – check for a minimum length\n * @category guards\n * @since 3.3.0\n */\nisTupleOf,\n/**\n * Checks whether an array has at least `N` elements, narrowing the type to a\n * tuple with a minimum length.\n *\n * **When to use**\n *\n * Use to guard that an array has at least the tuple length expected at\n * runtime.\n *\n * **Details**\n *\n * This is a re-export of `Predicate.isTupleOfAtLeast`. It narrows the type to\n * `TupleOfAtLeast<N, T>` in the truthy branch.\n *\n * **Gotchas**\n *\n * This only checks `.length`; it does not validate element types.\n *\n * **Example** (Checking minimum length)\n *\n * ```ts import.meta.vitest\n * import { Tuple } from \"effect\"\n *\n * const arr: Array<number> = [1, 2, 3, 4]\n * if (Tuple.isTupleOfAtLeast(arr, 3)) {\n * arr // => [1, 2, 3, 4]\n * }\n * ```\n *\n * @see `isTupleOf` – check for an exact length\n * @category guards\n * @since 3.3.0\n */\nisTupleOfAtLeast } from \"./Predicate.js\";\n/**\n * Creates a `Combiner` for a tuple shape by providing a `Combiner` for each\n * position. When two tuples are combined, each element is merged using its\n * corresponding combiner.\n *\n * **When to use**\n *\n * Use when you need to merge two same-shape tuples by combining each position\n * independently, such as summing counters or concatenating strings.\n *\n * **Example** (Combining tuple elements)\n *\n * ```ts import.meta.vitest\n * import { Number, String, Tuple } from \"effect\"\n *\n * const C = Tuple.makeCombiner<readonly [number, string]>([\n * Number.ReducerSum,\n * String.ReducerConcat\n * ])\n *\n * C.combine([1, \"hello\"], [2, \" world\"]) // => [3, \"hello world\"]\n * ```\n *\n * @see {@link makeReducer} – like `makeCombiner` but with an initial value\n * @category combining\n * @since 4.0.0\n */\nexport function makeCombiner(combiners) {\n return Combiner.make((self, that) => {\n const out = [];\n for (let i = 0; i < self.length; i++) {\n out.push(combiners[i].combine(self[i], that[i]));\n }\n return out;\n });\n}\n/**\n * Creates a `Reducer` for a tuple shape by providing a `Reducer` for each\n * position. The initial value is derived from each position's\n * `Reducer.initialValue`. When reducing a collection of tuples, each element\n * is combined independently.\n *\n * **When to use**\n *\n * Use when you need to fold same-shape tuples by accumulating each position\n * independently into one summary tuple.\n *\n * **Example** (Reducing a collection of tuples)\n *\n * ```ts import.meta.vitest\n * import { Number, String, Tuple } from \"effect\"\n *\n * const R = Tuple.makeReducer<readonly [number, string]>([\n * Number.ReducerSum,\n * String.ReducerConcat\n * ])\n *\n * R.combineAll([\n * [1, \"a\"],\n * [2, \"b\"],\n * [3, \"c\"]\n * ]) // => [6, \"abc\"]\n * ```\n *\n * @see {@link makeCombiner} – like `makeReducer` but without an initial value\n * @category folding\n * @since 4.0.0\n */\nexport function makeReducer(reducers) {\n const combine = makeCombiner(reducers).combine;\n const initialValue = [];\n for (let i = 0; i < reducers.length; i++) {\n initialValue.push(reducers[i].initialValue);\n }\n return Reducer.make(combine, initialValue);\n}\n//# sourceMappingURL=Tuple.js.map","/**\n * Works with plain JavaScript records as immutable key/value dictionaries.\n *\n * A record is an object whose keys are strings or symbols. This module includes\n * helpers for construction, lookup, updates, mapping, filtering, folding,\n * set-like combination, and typed conversions between records and iterable\n * entries. Helpers that change values return new records instead of mutating the\n * input.\n *\n * @since 2.0.0\n */\nimport * as Equal from \"./Equal.js\";\nimport { dual, identity } from \"./Function.js\";\nimport * as InternalRecord from \"./internal/record.js\";\nimport * as Option from \"./Option.js\";\nimport * as Reducer from \"./Reducer.js\";\nimport * as R from \"./Result.js\";\n/**\n * Creates a new, empty record.\n *\n * **Example** (Creating an empty record)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * // Create an empty record\n * const emptyRecord = Record.empty<string, number>()\n * emptyRecord // => {}\n *\n * // The type ensures type safety for future operations\n * Record.set(emptyRecord, \"count\", 42) // => { count: 42 }\n * ```\n *\n * @category constructors\n * @since 2.0.0\n */\nexport const empty = () => ({});\n/**\n * Determines if a mutable record is empty.\n *\n * **Example** (Checking for an empty record)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.isEmptyRecord({}) // => true\n * Record.isEmptyRecord({ a: 3 }) // => false\n * ```\n *\n * @category guards\n * @since 2.0.0\n */\nexport const isEmptyRecord = self => Object.keys(self).length === 0;\n/**\n * Determines if a readonly record is empty.\n *\n * **Example** (Checking for an empty readonly record)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.isEmptyReadonlyRecord({}) // => true\n * Record.isEmptyReadonlyRecord({ a: 3 }) // => false\n * ```\n *\n * @category guards\n * @since 2.0.0\n */\nexport const isEmptyReadonlyRecord = isEmptyRecord;\n/**\n * Takes an iterable and a projection function and returns a record.\n * The projection function maps each value of the iterable to a tuple of a key and a value, which is then added to the resulting record.\n *\n * **Example** (Building a record from mapped iterable values)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.fromIterableWith([1, 2, 3, 4], (a) => [String(a), a * 2]) // => { \"1\": 2, \"2\": 4, \"3\": 6, \"4\": 8 }\n * ```\n *\n * @category constructors\n * @since 2.0.0\n */\nexport const fromIterableWith = /*#__PURE__*/dual(2, (self, f) => {\n const out = empty();\n for (const a of self) {\n const [k, b] = f(a);\n InternalRecord.assignProperty(out, k, b);\n }\n return out;\n});\n/**\n * Creates a new record from an iterable, utilizing the provided function to determine the key for each element.\n *\n * **Example** (Building a record keyed by iterable values)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * const users = [\n * { id: \"2\", name: \"name2\" },\n * { id: \"1\", name: \"name1\" }\n * ]\n *\n * Record.fromIterableBy(\n * users,\n * (user) => user.id\n * ) // => { \"1\": { id: \"1\", name: \"name1\" }, \"2\": { id: \"2\", name: \"name2\" } }\n * ```\n *\n * @category constructors\n * @since 2.0.0\n */\nexport const fromIterableBy = /*#__PURE__*/dual(2, (items, f) => fromIterableWith(items, a => [f(a), a]));\n/**\n * Builds a record from an iterable of key-value pairs.\n *\n * **Details**\n *\n * If there are conflicting keys when using `fromEntries`, the last occurrence of the key/value pair will overwrite the\n * previous ones. So the resulting record will only have the value of the last occurrence of each key.\n *\n * **Example** (Building a record from entries)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.fromEntries([[\"a\", 1], [\"b\", 2]]) // => { a: 1, b: 2 }\n * ```\n *\n * @category constructors\n * @since 2.0.0\n */\nexport const fromEntries = Object.fromEntries;\n/**\n * Transforms the values of a record into an `Array` with a custom mapping function.\n *\n * **Example** (Collecting mapped record values)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * const x = { a: 1, b: 2, c: 3 }\n * Record.collect(x, (key, n) => [key, n]) // => [[\"a\", 1], [\"b\", 2], [\"c\", 3]]\n * ```\n *\n * @category converting\n * @since 2.0.0\n */\nexport const collect = /*#__PURE__*/dual(2, (self, f) => {\n const out = [];\n for (const key of keys(self)) {\n out.push(f(key, self[key]));\n }\n return out;\n});\n/**\n * Takes a record and returns an array of tuples containing its keys and values.\n *\n * **Example** (Converting a record to entries)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * const x = { a: 1, b: 2, c: 3 }\n * Record.toEntries(x) // => [[\"a\", 1], [\"b\", 2], [\"c\", 3]]\n * ```\n *\n * @category converting\n * @since 2.0.0\n */\nexport const toEntries = /*#__PURE__*/collect((key, value) => [key, value]);\n/**\n * Returns the number of key/value pairs in a record.\n *\n * **Example** (Getting the record size)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.size({ a: \"a\", b: 1, c: true }) // => 3\n * ```\n *\n * @category getters\n * @since 2.0.0\n */\nexport const size = self => keys(self).length;\n/**\n * Checks whether a given `key` exists in a record.\n *\n * **Example** (Checking key membership)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.has({ a: 1, b: 2 }, \"a\") // => true\n * Record.has(Record.empty<string>(), \"c\") // => false\n * ```\n *\n * @category predicates\n * @since 2.0.0\n */\nexport const has = /*#__PURE__*/dual(2, (self, key) => Object.hasOwn(self, key));\n/**\n * Retrieves a value at a particular key from a record safely, returning it wrapped in an `Option`.\n *\n * **Example** (Getting a value as an Option)\n *\n * ```ts import.meta.vitest\n * import { Option, Record as R } from \"effect\"\n *\n * const person: Record<string, unknown> = { name: \"John Doe\", age: 35 }\n *\n * R.get(person, \"name\") // => Option.some(\"John Doe\")\n * R.get(person, \"email\") // => Option.none()\n * ```\n *\n * @category getters\n * @since 2.0.0\n */\nexport const get = /*#__PURE__*/dual(2, (self, key) => Object.hasOwn(self, key) ? Option.some(self[key]) : Option.none());\n/**\n * Applies a function to the element at the specified key safely, creating a new record,\n * or return `Option.none()` if the key doesn't exist.\n *\n * **Example** (Modifying a value at a key)\n *\n * ```ts import.meta.vitest\n * import { Option, Record } from \"effect\"\n *\n * const f = (x: number) => x * 2\n *\n * const input: Record<string, number> = { a: 3 }\n *\n * Record.modify(input, \"a\", f) // => Option.some({ a: 6 })\n * Record.modify(input, \"b\", f) // => Option.none()\n * ```\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const modify = /*#__PURE__*/dual(3, (self, key, f) => {\n if (!has(self, key)) return Option.none();\n return Option.some({\n ...self,\n [key]: f(self[key])\n });\n});\n/**\n * Replaces the value at an existing key safely and returns the updated record in\n * `Option.some`.\n *\n * **Details**\n *\n * If the key is not present, returns `Option.none()` and leaves the record\n * unchanged.\n *\n * **Example** (Replacing a value at a key)\n *\n * ```ts import.meta.vitest\n * import { Option, Record } from \"effect\"\n *\n * Record.replace({ a: 1, b: 2, c: 3 }, \"a\", 10) // => Option.some({ a: 10, b: 2, c: 3 })\n * Record.replace(Record.empty<string>(), \"a\", 10) // => Option.none()\n * ```\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const replace = /*#__PURE__*/dual(3, (self, key, b) => modify(self, key, () => b));\n/**\n * Removes a key from a record.\n *\n * **When to use**\n *\n * Use to create a shallow copy of a record without one property.\n *\n * **Details**\n *\n * If the key is not present, the result is still a shallow copy of the original\n * record.\n *\n * **Example** (Removing a key)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.remove({ a: 1, b: 2 }, \"a\") // => { b: 2 }\n * ```\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const remove = /*#__PURE__*/dual(2, (self, key) => {\n if (!has(self, key)) {\n return {\n ...self\n };\n }\n const out = {\n ...self\n };\n delete out[key];\n return out;\n});\n/**\n * Retrieves the value of the property with the given `key` from a record safely and returns an `Option`\n * of a tuple with the value and the record with the removed property.\n * If the key is not present, returns `Option.none()`.\n *\n * **Example** (Popping a value and removing its key)\n *\n * ```ts import.meta.vitest\n * import { Option, Record } from \"effect\"\n *\n * const input: Record<string, number> = { a: 1, b: 2 }\n *\n * Record.pop(input, \"a\") // => Option.some([1, { b: 2 }])\n * Record.pop(input, \"c\") // => Option.none()\n * ```\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const pop = /*#__PURE__*/dual(2, (self, key) => has(self, key) ? Option.some([self[key], remove(self, key)]) : Option.none());\n/**\n * Maps a record into another record by applying a transformation function to each of its values.\n *\n * **Example** (Mapping record values)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * const f = (n: number) => `-${n}`\n *\n * Record.map({ a: 3, b: 5 }, f) // => { a: \"-3\", b: \"-5\" }\n *\n * const g = (n: number, key: string) => `${key.toUpperCase()}-${n}`\n *\n * Record.map({ a: 3, b: 5 }, g) // => { a: \"A-3\", b: \"B-5\" }\n * ```\n *\n * @category mapping\n * @since 2.0.0\n */\nexport const map = /*#__PURE__*/dual(2, (self, f) => {\n const out = {\n ...self\n };\n for (const key of keys(self)) {\n InternalRecord.assignProperty(out, key, f(self[key], key));\n }\n return out;\n});\n/**\n * Maps the keys of a `ReadonlyRecord` while preserving the corresponding values.\n *\n * **Example** (Mapping record keys)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.mapKeys({ a: 3, b: 5 }, (key) => key.toUpperCase()) // => { A: 3, B: 5 }\n * ```\n *\n * @category mapping\n * @since 2.0.0\n */\nexport const mapKeys = /*#__PURE__*/dual(2, (self, f) => {\n const out = {};\n for (const key of keys(self)) {\n const a = self[key];\n InternalRecord.assignProperty(out, f(key, a), a);\n }\n return out;\n});\n/**\n * Maps entries of a `ReadonlyRecord` using the provided function, allowing modification of both keys and corresponding values.\n *\n * **Example** (Mapping record entries)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.mapEntries({ a: 3, b: 5 }, (a, key) => [key.toUpperCase(), a + 1]) // => { A: 4, B: 6 }\n * ```\n *\n * @category mapping\n * @since 2.0.0\n */\nexport const mapEntries = /*#__PURE__*/dual(2, (self, f) => {\n const out = {};\n for (const key of keys(self)) {\n const [k, b] = f(self[key], key);\n InternalRecord.assignProperty(out, k, b);\n }\n return out;\n});\n/**\n * Transforms a record by applying the function `f` to each key and value in the original record.\n * If the function succeeds, the key-value pair is included in the output record.\n *\n * **Example** (Filtering and mapping with Result)\n *\n * ```ts import.meta.vitest\n * import { Record, Result } from \"effect\"\n *\n * const x = { a: 1, b: 2, c: 3 }\n * const f = (a: number, key: string) => a > 2 ? Result.succeed(a * 2) : Result.failVoid\n * Record.filterMap(x, f) // => { c: 6 }\n * ```\n *\n * @category filtering\n * @since 2.0.0\n */\nexport const filterMap = /*#__PURE__*/dual(2, (self, f) => {\n const out = empty();\n for (const key of keys(self)) {\n const result = f(self[key], key);\n if (R.isSuccess(result)) {\n InternalRecord.assignProperty(out, key, result.success);\n }\n }\n return out;\n});\n/**\n * Selects properties from a record whose values match the given predicate.\n *\n * **Example** (Filtering record values)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * const x = { a: 1, b: 2, c: 3, d: 4 }\n * Record.filter(x, (n) => n > 2) // => { c: 3, d: 4 }\n * ```\n *\n * @category filtering\n * @since 2.0.0\n */\nexport const filter = /*#__PURE__*/dual(2, (self, predicate) => {\n const out = empty();\n for (const key of keys(self)) {\n if (predicate(self[key], key)) {\n InternalRecord.assignProperty(out, key, self[key]);\n }\n }\n return out;\n});\n/**\n * Returns a new record containing only the `Some` values from a record of\n * `Option` values, preserving the original keys.\n *\n * **Example** (Extracting Some values)\n *\n * ```ts import.meta.vitest\n * import { Option, Record } from \"effect\"\n *\n * Record.getSomes({ a: Option.some(1), b: Option.none(), c: Option.some(2) }) // => { a: 1, c: 2 }\n * ```\n *\n * @category filtering\n * @since 2.0.0\n */\nexport const getSomes = self => {\n const out = empty();\n for (const key of keys(self)) {\n const option = self[key];\n if (Option.isSome(option)) {\n InternalRecord.assignProperty(out, key, option.value);\n }\n }\n return out;\n};\n/**\n * Returns a new record containing only the `Err` values from a record of\n * `Result` values, preserving the original keys.\n *\n * **Example** (Extracting Result failures)\n *\n * ```ts import.meta.vitest\n * import { Record, Result } from \"effect\"\n *\n * Record.getFailures({\n * a: Result.succeed(1),\n * b: Result.fail(\"err\"),\n * c: Result.succeed(2)\n * }) // => { b: \"err\" }\n * ```\n *\n * @category filtering\n * @since 4.0.0\n */\nexport const getFailures = self => {\n const out = empty();\n for (const key of keys(self)) {\n const value = self[key];\n if (R.isFailure(value)) {\n InternalRecord.assignProperty(out, key, value.failure);\n }\n }\n return out;\n};\n/**\n * Returns a new record containing only the `Ok` values from a record of\n * `Result` values, preserving the original keys.\n *\n * **Example** (Extracting Result successes)\n *\n * ```ts import.meta.vitest\n * import { Record, Result } from \"effect\"\n *\n * Record.getSuccesses({\n * a: Result.succeed(1),\n * b: Result.fail(\"err\"),\n * c: Result.succeed(2)\n * }) // => { a: 1, c: 2 }\n * ```\n *\n * @category filtering\n * @since 4.0.0\n */\nexport const getSuccesses = self => {\n const out = empty();\n for (const key of keys(self)) {\n const value = self[key];\n if (R.isSuccess(value)) {\n InternalRecord.assignProperty(out, key, value.success);\n }\n }\n return out;\n};\n/**\n * Applies a function to each record entry and partitions the returned `Result`\n * values into two records.\n *\n * **Details**\n *\n * Failure values are collected in the left record, and success values are\n * collected in the right record, preserving the original keys.\n *\n * **Example** (Partitioning with Result)\n *\n * ```ts import.meta.vitest\n * import { Record, Result } from \"effect\"\n *\n * const x = { a: 1, b: 2, c: 3 }\n * const f = (n: number) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n))\n * Record.partition(x, f) // => [{ a: 1, c: 3 }, { b: 2 }]\n * ```\n *\n * @category filtering\n * @since 2.0.0\n */\nexport const partition = /*#__PURE__*/dual(2, (self, f) => {\n const left = empty();\n const right = empty();\n for (const key of keys(self)) {\n const e = f(self[key], key);\n if (R.isFailure(e)) {\n InternalRecord.assignProperty(left, key, e.failure);\n } else {\n InternalRecord.assignProperty(right, key, e.success);\n }\n }\n return [left, right];\n});\n/**\n * Partitions a record of `Result` values into two separate records,\n * one with the `Err` values and one with the `Ok` values.\n *\n * **Example** (Separating Result values)\n *\n * ```ts import.meta.vitest\n * import { Record, Result } from \"effect\"\n *\n * Record.separate({ a: Result.fail(\"e\"), b: Result.succeed(1) }) // => [{ a: \"e\" }, { b: 1 }]\n * ```\n *\n * @category filtering\n * @since 2.0.0\n */\nexport const separate = /*#__PURE__*/partition(identity);\n/**\n * Retrieves the keys of a given record as an array.\n *\n * **Example** (Getting record keys)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.keys({ a: 1, b: 2, c: 3 }) // => [\"a\", \"b\", \"c\"]\n * ```\n *\n * @category getters\n * @since 2.0.0\n */\nexport const keys = self => Object.keys(self);\n/**\n * Retrieves the values of a given record as an array.\n *\n * **Example** (Getting record values)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.values({ a: 1, b: 2, c: 3 }) // => [1, 2, 3]\n * ```\n *\n * @category getters\n * @since 2.0.0\n */\nexport const values = self => collect(self, (_, a) => a);\n/**\n * Adds a new key-value pair or update an existing key's value in a record.\n *\n * **Example** (Setting a record value)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.set(\"a\", 5)({ a: 1, b: 2 }) // => { a: 5, b: 2 }\n * Record.set(\"c\", 5)({ a: 1, b: 2 }) // => { a: 1, b: 2, c: 5 }\n * ```\n *\n * @category mutations\n * @since 2.0.0\n */\nexport const set = /*#__PURE__*/dual(3, (self, key, value) => {\n return {\n ...self,\n [key]: value\n };\n});\n/**\n * Mutates a record by assigning a value to a property.\n *\n * **When to use**\n *\n * Use when incrementally constructing a new record and copying it for every\n * property would be unnecessary.\n *\n * **Gotchas**\n *\n * This function mutates `self`. When `key` is `\"__proto__\"`, it creates an\n * own data property instead of changing the object's prototype.\n *\n * **Example** (Assigning an external key safely)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * const key: string = \"__proto__\" // Assume this comes from external input\n * const value = { polluted: true }\n *\n * const unsafe: Record<string, unknown> = {}\n * unsafe[key] = value\n * Object.getPrototypeOf(unsafe) === value // => true\n *\n * const safe: Record<string, unknown> = {}\n * Record.assignProperty(safe, key, value)\n * Object.getPrototypeOf(safe) === Object.prototype // => true\n * safe[key] === value // => true\n * ```\n *\n * @see {@link set} for an immutable update\n * @category mutations\n * @since 4.0.0\n */\nexport const assignProperty = InternalRecord.assignProperty;\n/**\n * Checks whether all the keys and values in one record are also found in another record.\n * Uses the provided equivalence function to compare values.\n *\n * **Example** (Checking subrecords with a custom equivalence)\n *\n * ```ts import.meta.vitest\n * import { Equivalence, Record } from \"effect\"\n *\n * const isSubrecord = Record.isSubrecordBy(\n * Equivalence.make<string>((self, that) => self.toLowerCase() === that.toLowerCase())\n * )\n *\n * const required: Record.ReadonlyRecord<string, string> = { role: \"Admin\" }\n * const available: Record.ReadonlyRecord<string, string> = {\n * role: \"admin\",\n * status: \"active\"\n * }\n *\n * isSubrecord(required, available) // => true\n * isSubrecord({ role: \"Admin\", status: \"inactive\" }, available) // => false\n * isSubrecord(required, { role: \"editor\", status: \"active\" }) // => false\n * ```\n *\n * @category predicates\n * @since 2.0.0\n */\nexport const isSubrecordBy = equivalence => dual(2, (self, that) => {\n for (const key of keys(self)) {\n if (!has(that, key) || !equivalence(self[key], that[key])) {\n return false;\n }\n }\n return true;\n});\n/**\n * Checks whether the first record is a subrecord of the second record.\n *\n * **Details**\n *\n * Returns `true` when every key and value in `self` is also present in `that`.\n * Values are compared with Effect equality via `Equal.asEquivalence()`.\n *\n * **Example** (Checking subrecords)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.isSubrecord({ a: 1 } as Record<string, number>, { a: 1, b: 2 }) // => true\n * Record.isSubrecord({ a: 1, b: 2 }, { a: 1 } as Record<string, number>) // => false\n * ```\n *\n * @category predicates\n * @since 2.0.0\n */\nexport const isSubrecord = /*#__PURE__*/isSubrecordBy(/*#__PURE__*/Equal.asEquivalence());\n/**\n * Reduces a record to a single value by combining its entries with a specified function.\n *\n * **Example** (Reducing record values)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.reduce({ a: 1, b: 2, c: 3 }, 0, (acc, value) => acc + value) // => 6\n * ```\n *\n * @category folding\n * @since 2.0.0\n */\nexport const reduce = /*#__PURE__*/dual(3, (self, zero, f) => {\n let out = zero;\n for (const key of keys(self)) {\n out = f(out, self[key], key);\n }\n return out;\n});\n/**\n * Checks whether all entries in a record meet a specific condition.\n *\n * **Example** (Checking every record value)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.every({ a: 1, b: 2 }, (n) => n > 0) // => true\n * Record.every({ a: 1, b: -1 }, (n) => n > 0) // => false\n * ```\n *\n * @category guards\n * @since 2.0.0\n */\nexport const every = /*#__PURE__*/dual(2, (self, refinement) => {\n for (const key of keys(self)) {\n if (!refinement(self[key], key)) {\n return false;\n }\n }\n return true;\n});\n/**\n * Checks whether any entry in a record meets a specific condition.\n *\n * **Example** (Checking for any matching value)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.some({ a: 1, b: 2 }, (n) => n > 1) // => true\n * Record.some({ a: 1, b: 2 }, (n) => n > 2) // => false\n * ```\n *\n * @category predicates\n * @since 2.0.0\n */\nexport const some = /*#__PURE__*/dual(2, (self, predicate) => {\n for (const key of keys(self)) {\n if (predicate(self[key], key)) {\n return true;\n }\n }\n return false;\n});\n/**\n * Merges two records, preserving entries that exist in either of the records.\n * For keys that exist in both records, the provided combine function is used to merge the values.\n *\n * **Example** (Merging records with union)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.union({ a: 1, b: 2 }, { b: 3, c: 4 }, (a, b) => a + b) // => { a: 1, b: 5, c: 4 }\n * ```\n *\n * @category combining\n * @since 2.0.0\n */\nexport const union = /*#__PURE__*/dual(3, (self, that, combine) => {\n if (isEmptyRecord(self)) {\n return {\n ...that\n };\n }\n if (isEmptyRecord(that)) {\n return {\n ...self\n };\n }\n const out = empty();\n for (const key of keys(self)) {\n if (has(that, key)) {\n InternalRecord.assignProperty(out, key, combine(self[key], that[key]));\n } else {\n InternalRecord.assignProperty(out, key, self[key]);\n }\n }\n for (const key of keys(that)) {\n if (!has(out, key)) {\n InternalRecord.assignProperty(out, key, that[key]);\n }\n }\n return out;\n});\n/**\n * Merges two records, retaining only the entries that exist in both records.\n * For intersecting keys, the provided combine function is used to merge the values.\n *\n * **Example** (Merging intersecting keys)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.intersection({ a: 1, b: 2 }, { b: 3, c: 4 }, (a, b) => a + b) // => { b: 5 }\n * ```\n *\n * @category combining\n * @since 2.0.0\n */\nexport const intersection = /*#__PURE__*/dual(3, (self, that, combine) => {\n const out = empty();\n if (isEmptyRecord(self) || isEmptyRecord(that)) {\n return out;\n }\n for (const key of keys(self)) {\n if (has(that, key)) {\n InternalRecord.assignProperty(out, key, combine(self[key], that[key]));\n }\n }\n return out;\n});\n/**\n * Merges two records, preserving only the entries that are unique to each record.\n * Keys that exist in both records are excluded from the result.\n *\n * **Example** (Keeping keys unique to each record)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.difference({ a: 1, b: 2 }, { b: 3, c: 4 }) // => { a: 1, c: 4 }\n * ```\n *\n * @category combining\n * @since 2.0.0\n */\nexport const difference = /*#__PURE__*/dual(2, (self, that) => {\n if (isEmptyRecord(self)) {\n return {\n ...that\n };\n }\n if (isEmptyRecord(that)) {\n return {\n ...self\n };\n }\n const out = {};\n for (const key of keys(self)) {\n if (!has(that, key)) {\n InternalRecord.assignProperty(out, key, self[key]);\n }\n }\n for (const key of keys(that)) {\n if (!has(self, key)) {\n InternalRecord.assignProperty(out, key, that[key]);\n }\n }\n return out;\n});\n/**\n * Create an `Equivalence` for records using the provided `Equivalence` for values.\n * Two records are considered equivalent if they have the same keys and their corresponding values are equivalent.\n *\n * **Example** (Comparing records with a value equivalence)\n *\n * ```ts import.meta.vitest\n * import { Equal, Record } from \"effect\"\n *\n * const recordEquivalence = Record.makeEquivalence(Equal.asEquivalence<number>())\n *\n * recordEquivalence({ a: 1, b: 2 }, { a: 1, b: 2 }) // => true\n * recordEquivalence({ a: 1, b: 2 }, { a: 1, b: 3 }) // => false\n * ```\n *\n * @category instances\n * @since 4.0.0\n */\nexport const makeEquivalence = equivalence => {\n const is = isSubrecordBy(equivalence);\n return (self, that) => is(self, that) && is(that, self);\n};\n/**\n * Create a non-empty record from a single element.\n *\n * **Example** (Creating a singleton record)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.singleton(\"a\", 1) // => { a: 1 }\n * ```\n *\n * @category constructors\n * @since 2.0.0\n */\nexport const singleton = (key, value) => ({\n [key]: value\n});\n/**\n * Creates a `Reducer` for combining `Record`s using union, with values for keys that exist in both records combined\n * using the provided `Combiner`.\n *\n * **When to use**\n *\n * Use to build a reusable reducer for accumulating many records into one\n * union-shaped record, preserving keys from every input and combining\n * overlapping values with the supplied combiner.\n *\n * **Details**\n *\n * The returned reducer uses `Record.union` for combine and an empty record as\n * `initialValue`, so the default `combineAll` folds from `{}` and accumulates\n * keys from each input record.\n *\n * @see {@link union} for one-off record merging with the same union semantics\n * @see {@link makeReducerIntersection} for a reducer that keeps only keys present on both sides\n *\n * @category combining\n * @since 4.0.0\n */\nexport function makeReducerUnion(combiner) {\n return Reducer.make((self, that) => union(self, that, combiner.combine), {});\n}\n/**\n * Creates a `Reducer` whose `combine` operation intersects two records and\n * combines values for keys present in both records.\n *\n * **When to use**\n *\n * Use to build a `Reducer` that combines records by retaining only keys shared\n * by both inputs and combining matching values with a `Combiner`.\n *\n * **Gotchas**\n *\n * The reducer's `initialValue` is an empty record. Because intersection with\n * an empty record is empty, the default `combineAll` folds from `{}` and\n * therefore produces `{}` for ordinary non-empty inputs.\n *\n * @see {@link makeReducerUnion} for a reducer that preserves keys from either input record\n * @see {@link intersection} for applying the shared-key merge to one pair of records\n *\n * @category combining\n * @since 4.0.0\n */\nexport function makeReducerIntersection(combiner) {\n return Reducer.make((self, that) => intersection(self, that, combiner.combine), {});\n}\n/**\n * Returns the first entry that satisfies the specified\n * predicate, or `None` if no such entry exists.\n *\n * **Example** (Finding the first matching entry)\n *\n * ```ts import.meta.vitest\n * import { Option, Record } from \"effect\"\n *\n * const record = { a: 1, b: 2, c: 3 }\n * Record.findFirst(\n * record,\n * (value, key) => value > 1 && key !== \"b\"\n * ) // => Option.some([\"c\", 3])\n * ```\n *\n * @category searching\n * @since 3.14.0\n */\nexport const findFirst = /*#__PURE__*/dual(2, (self, f) => {\n const k = keys(self);\n for (let i = 0; i < k.length; i++) {\n const key = k[i];\n if (f(self[key], key)) {\n return Option.some([key, self[key]]);\n }\n }\n return Option.none();\n});\n//# sourceMappingURL=Record.js.map","import * as effect from \"./internal/effect.js\";\n/**\n * Context reference for the active time service in the environment.\n *\n * **When to use**\n *\n * Use when you need to access or provide the full time service, including sleep\n * operations, rather than a single timestamp accessor.\n *\n * **Example** (Accessing the Clock service)\n *\n * ```ts import.meta.vitest\n * import { Clock, Effect } from \"effect\"\n *\n * const testClock: Clock.Clock = {\n * currentTimeMillisUnsafe: () => 1_000,\n * currentTimeMillis: Effect.succeed(1_000),\n * monotonicTimeNanosUnsafe: () => 1_000_000_000n,\n * monotonicTimeNanos: Effect.succeed(1_000_000_000n),\n * currentTimeNanosUnsafe: () => 1_000_000_000n,\n * currentTimeNanos: Effect.succeed(1_000_000_000n),\n * sleep: () => Effect.void\n * }\n *\n * const program = Effect.gen(function*() {\n * const clock = yield* Clock.Clock\n * return clock.currentTimeMillisUnsafe()\n * })\n *\n * await Effect.runPromise(Effect.provideService(program, Clock.Clock, testClock)) // => 1_000\n * ```\n *\n * @see {@link clockWith} for using the current Clock service inside an effect\n * @see {@link currentTimeMillis} for reading the current time in milliseconds\n * @see {@link currentTimeNanos} for reading the current time in nanoseconds\n *\n * @category services\n * @since 2.0.0\n */\nexport const Clock = effect.ClockRef;\n/**\n * Accesses the current Clock service and uses it to run the provided function.\n *\n * **When to use**\n *\n * Use when you need the full Clock service interface to perform multiple time\n * operations or call unsafe variants within a single effect.\n *\n * **Example** (Accessing the current Clock service)\n *\n * ```ts import.meta.vitest\n * import { Clock, Effect } from \"effect\"\n *\n * const testClock: Clock.Clock = {\n * currentTimeMillisUnsafe: () => 1_000,\n * currentTimeMillis: Effect.succeed(1_000),\n * monotonicTimeNanosUnsafe: () => 1_000_000_000n,\n * monotonicTimeNanos: Effect.succeed(1_000_000_000n),\n * currentTimeNanosUnsafe: () => 1_000_000_000n,\n * currentTimeNanos: Effect.succeed(1_000_000_000n),\n * sleep: () => Effect.void\n * }\n *\n * const program = Clock.clockWith((clock) => Effect.sync(() => clock.currentTimeMillisUnsafe()))\n *\n * await Effect.runPromise(Effect.provideService(program, Clock.Clock, testClock)) // => 1_000\n * ```\n *\n * @see {@link Clock} for the service reference\n * @see {@link currentTimeMillis} for convenience accessor that returns milliseconds\n * @see {@link currentTimeNanos} for convenience accessor that returns nanoseconds\n * @category accessors\n * @since 2.0.0\n */\nexport const clockWith = effect.clockWith;\n/**\n * Returns an Effect that succeeds with the current Unix time in milliseconds.\n *\n * **When to use**\n *\n * Use to create wall-clock timestamps from the active `Clock` service with\n * millisecond precision.\n *\n * **Gotchas**\n *\n * The value can move backward or forward when the system wall clock is\n * corrected, so it is not suitable for measuring elapsed time.\n *\n * **Example** (Reading milliseconds)\n *\n * ```ts import.meta.vitest\n * import { Clock, Effect } from \"effect\"\n *\n * const testClock: Clock.Clock = {\n * currentTimeMillisUnsafe: () => 1_000,\n * currentTimeMillis: Effect.succeed(1_000),\n * monotonicTimeNanosUnsafe: () => 1_000_000_000n,\n * monotonicTimeNanos: Effect.succeed(1_000_000_000n),\n * currentTimeNanosUnsafe: () => 1_000_000_000n,\n * currentTimeNanos: Effect.succeed(1_000_000_000n),\n * sleep: () => Effect.void\n * }\n *\n * await Effect.runPromise(Effect.provideService(Clock.currentTimeMillis, Clock.Clock, testClock)) // => 1_000\n * ```\n *\n * @see {@link currentTimeNanos} for nanosecond precision\n * @see {@link monotonicTimeNanos} for measuring elapsed time\n * @see {@link clockWith} for accessing the full Clock service\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const currentTimeMillis = effect.currentTimeMillis;\n/**\n * Returns an Effect that succeeds with the current Unix time in nanoseconds.\n *\n * **When to use**\n *\n * Use to create wall-clock timestamps from the active `Clock` service with\n * nanosecond precision.\n *\n * **Gotchas**\n *\n * The value can move backward or forward when the system wall clock is\n * corrected, so it is not suitable for measuring elapsed time.\n * The live clock allows up to one second of drift from `Date.now()` before\n * re-anchoring.\n *\n * **Example** (Reading nanoseconds)\n *\n * ```ts import.meta.vitest\n * import { Clock, Effect } from \"effect\"\n *\n * const testClock: Clock.Clock = {\n * currentTimeMillisUnsafe: () => 1_000,\n * currentTimeMillis: Effect.succeed(1_000),\n * monotonicTimeNanosUnsafe: () => 1_000_000_000n,\n * monotonicTimeNanos: Effect.succeed(1_000_000_000n),\n * currentTimeNanosUnsafe: () => 1_000_000_000n,\n * currentTimeNanos: Effect.succeed(1_000_000_000n),\n * sleep: () => Effect.void\n * }\n *\n * await Effect.runPromise(Effect.provideService(Clock.currentTimeNanos, Clock.Clock, testClock)) // => 1_000_000_000n\n * ```\n *\n * @see {@link monotonicTimeNanos} for measuring elapsed time\n *\n * @category accessors\n * @since 2.0.0\n */\nexport const currentTimeNanos = effect.currentTimeNanos;\n/**\n * Returns an Effect that succeeds with the current monotonic time in\n * nanoseconds.\n *\n * **When to use**\n *\n * Use to measure elapsed time by subtracting two readings.\n *\n * **Gotchas**\n *\n * The value has an arbitrary origin and is unsuitable for serialization. Use\n * it only to subtract readings produced by the same clock. Whether it advances\n * while the host is suspended depends on the runtime.\n *\n * @see {@link currentTimeNanos} for Unix wall-clock timestamps\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const monotonicTimeNanos = effect.monotonicTimeNanos;\n//# sourceMappingURL=Clock.js.map","import { IllegalArgumentError } from \"../Cause.js\";\nimport * as Clock from \"../Clock.js\";\nimport * as Duration from \"../Duration.js\";\nimport * as Equal from \"../Equal.js\";\nimport * as Equ from \"../Equivalence.js\";\nimport { dual } from \"../Function.js\";\nimport * as Hash from \"../Hash.js\";\nimport * as Inspectable from \"../Inspectable.js\";\nimport * as Option from \"../Option.js\";\nimport * as order from \"../Order.js\";\nimport { pipeArguments } from \"../Pipeable.js\";\nimport * as Predicate from \"../Predicate.js\";\nimport * as effect from \"./effect.js\";\n/** @internal */\nexport const TypeId = \"~effect/DateTime\";\n/** @internal */\nexport const TimeZoneTypeId = \"~effect/DateTime/TimeZone\";\nconst Proto = {\n [TypeId]: TypeId,\n pipe() {\n return pipeArguments(this, arguments);\n },\n [Inspectable.NodeInspectSymbol]() {\n return this.toString();\n },\n toJSON() {\n return toDateUtc(this).toJSON();\n }\n};\nconst ProtoUtc = {\n ...Proto,\n _tag: \"Utc\",\n [Hash.symbol]() {\n return Hash.number(this.epochMilliseconds);\n },\n [Equal.symbol](that) {\n return isDateTime(that) && that._tag === \"Utc\" && this.epochMilliseconds === that.epochMilliseconds;\n },\n toString() {\n return `DateTime.Utc(${toDateUtc(this).toJSON()})`;\n }\n};\nconst ProtoZoned = {\n ...Proto,\n _tag: \"Zoned\",\n [Hash.symbol]() {\n return Hash.combine(Hash.number(this.epochMilliseconds))(Hash.hash(this.zone));\n },\n [Equal.symbol](that) {\n return isDateTime(that) && that._tag === \"Zoned\" && this.epochMilliseconds === that.epochMilliseconds && Equal.equals(this.zone, that.zone);\n },\n toString() {\n return `DateTime.Zoned(${formatIsoZoned(this)})`;\n }\n};\nconst ProtoTimeZone = {\n [TimeZoneTypeId]: TimeZoneTypeId,\n [Inspectable.NodeInspectSymbol]() {\n return this.toString();\n }\n};\nconst ProtoTimeZoneNamed = {\n ...ProtoTimeZone,\n _tag: \"Named\",\n [Hash.symbol]() {\n return Hash.string(`Named:${this.id}`);\n },\n [Equal.symbol](that) {\n return isTimeZone(that) && that._tag === \"Named\" && this.id === that.id;\n },\n toString() {\n return `TimeZone.Named(${this.id})`;\n },\n toJSON() {\n return {\n _id: \"TimeZone\",\n _tag: \"Named\",\n id: this.id\n };\n }\n};\nconst ProtoTimeZoneOffset = {\n ...ProtoTimeZone,\n _tag: \"Offset\",\n [Hash.symbol]() {\n return Hash.string(`Offset:${this.offset}`);\n },\n [Equal.symbol](that) {\n return isTimeZone(that) && that._tag === \"Offset\" && this.offset === that.offset;\n },\n toString() {\n return `TimeZone.Offset(${offsetToString(this.offset)})`;\n },\n toJSON() {\n return {\n _id: \"TimeZone\",\n _tag: \"Offset\",\n offset: this.offset\n };\n }\n};\n/** @internal */\nexport const makeZonedProto = (epochMillis, zone, partsUtc) => {\n const self = Object.create(ProtoZoned);\n self.epochMilliseconds = epochMillis;\n self.zone = zone;\n Object.defineProperty(self, \"partsUtc\", {\n value: partsUtc,\n enumerable: false,\n writable: true\n });\n Object.defineProperty(self, \"adjustedEpochMillis\", {\n value: undefined,\n enumerable: false,\n writable: true\n });\n Object.defineProperty(self, \"partsAdjusted\", {\n value: undefined,\n enumerable: false,\n writable: true\n });\n return self;\n};\n// =============================================================================\n// guards\n// =============================================================================\n/** @internal */\nexport const isDateTime = u => Predicate.hasProperty(u, TypeId);\nconst isDateTimeArgs = args => isDateTime(args[0]);\n/** @internal */\nexport const isTimeZone = u => Predicate.hasProperty(u, TimeZoneTypeId);\n/** @internal */\nexport const isTimeZoneOffset = u => isTimeZone(u) && u._tag === \"Offset\";\n/** @internal */\nexport const isTimeZoneNamed = u => isTimeZone(u) && u._tag === \"Named\";\n/** @internal */\nexport const isUtc = self => self._tag === \"Utc\";\n/** @internal */\nexport const isZoned = self => self._tag === \"Zoned\";\n// =============================================================================\n// instances\n// =============================================================================\n/** @internal */\nexport const Equivalence = /*#__PURE__*/Equ.make((a, b) => a.epochMilliseconds === b.epochMilliseconds);\n/** @internal */\nexport const Order = /*#__PURE__*/order.make((self, that) => self.epochMilliseconds < that.epochMilliseconds ? -1 : self.epochMilliseconds > that.epochMilliseconds ? 1 : 0);\n/** @internal */\nexport const clamp = /*#__PURE__*/order.clamp(Order);\n// =============================================================================\n// constructors\n// =============================================================================\nconst makeUtc = epochMillis => {\n const self = Object.create(ProtoUtc);\n self.epochMilliseconds = epochMillis;\n Object.defineProperty(self, \"partsUtc\", {\n value: undefined,\n enumerable: false,\n writable: true\n });\n return self;\n};\n/** @internal */\nexport const fromDateUnsafe = date => {\n const epochMillis = date.getTime();\n if (Number.isNaN(epochMillis)) {\n throw new IllegalArgumentError(\"Invalid date\");\n }\n return makeUtc(epochMillis);\n};\n/** @internal */\nexport const makeUnsafe = input => {\n if (isDateTime(input)) {\n return input;\n } else if (input instanceof Date) {\n return fromDateUnsafe(input);\n } else if (typeof input === \"object\") {\n if (\"epochMilliseconds\" in input) {\n return fromDateUnsafe(new Date(input.epochMilliseconds));\n }\n const date = new Date(0);\n setPartsDate(date, input);\n return fromDateUnsafe(date);\n } else if (typeof input === \"string\" && !hasZone(input)) {\n return fromDateUnsafe(new Date(input + \"Z\"));\n }\n return fromDateUnsafe(new Date(input));\n};\n/**\n * Detects whether a date string already contains timezone info.\n * Without a zone, `new Date(\"2024-01-01T12:00:00\")` is parsed as local time,\n * so `makeUnsafe` appends \"Z\" to force UTC interpretation.\n * This check prevents appending \"Z\" to strings that already have a zone\n * (e.g. \"2024-01-01T12:00:00Z\", \"...+05:30\", \"...GMT\"), which would produce invalid dates.\n */\nconst hasZone = input => /Z|GMT|[+-]\\d{2}$|[+-]\\d{2}:?\\d{2}$|\\]$/.test(input);\nconst minEpochMillis = -8640000000000000 + 12 * 60 * 60 * 1000;\nconst maxEpochMillis = 8640000000000000 - 14 * 60 * 60 * 1000;\n/** @internal */\nexport const makeZonedUnsafe = (input, options) => {\n let timeZoneOption = options?.timeZone;\n if (timeZoneOption === undefined && isDateTime(input) && isZoned(input)) {\n return input;\n }\n const self = makeUnsafe(input);\n if (self.epochMilliseconds < minEpochMillis || self.epochMilliseconds > maxEpochMillis) {\n throw new RangeError(`Epoch millis out of range: ${self.epochMilliseconds}`);\n }\n if (timeZoneOption === undefined && typeof input === \"object\" && \"timeZoneId\" in input) {\n timeZoneOption = input.timeZoneId;\n }\n let zone;\n if (timeZoneOption === undefined) {\n const offset = new Date(self.epochMilliseconds).getTimezoneOffset() * -60 * 1000;\n zone = zoneMakeOffset(offset);\n } else if (isTimeZone(timeZoneOption)) {\n zone = timeZoneOption;\n } else if (typeof timeZoneOption === \"number\") {\n zone = zoneMakeOffset(timeZoneOption);\n } else {\n const parsedZone = zoneFromString(timeZoneOption);\n if (Option.isNone(parsedZone)) {\n throw new IllegalArgumentError(`Invalid time zone: ${timeZoneOption}`);\n }\n zone = parsedZone.value;\n }\n if (options?.adjustForTimeZone !== true) {\n return makeZonedProto(self.epochMilliseconds, zone, self.partsUtc);\n }\n return makeZonedFromAdjusted(self.epochMilliseconds, zone, options?.disambiguation ?? \"compatible\");\n};\n/** @internal */\nexport const makeZoned = /*#__PURE__*/Option.liftThrowable(makeZonedUnsafe);\n/** @internal */\nexport const make = /*#__PURE__*/Option.liftThrowable(makeUnsafe);\nconst zonedStringRegExp = /^(.{17,35})\\[(.+)\\]$/;\n/** @internal */\nexport const makeZonedFromString = input => {\n const match = zonedStringRegExp.exec(input);\n if (match === null) {\n const offset = parseOffset(input);\n return offset !== null ? makeZoned(input, {\n timeZone: offset\n }) : Option.none();\n }\n const [, isoString, timeZone] = match;\n return makeZoned(isoString, {\n timeZone\n });\n};\n/** @internal */\nexport const now = /*#__PURE__*/effect.map(Clock.currentTimeMillis, makeUtc);\n/** @internal */\nexport const nowAsDate = /*#__PURE__*/effect.map(Clock.currentTimeMillis, millis => new Date(millis));\n/** @internal */\nexport const nowUnsafe = () => makeUtc(Date.now());\n// =============================================================================\n// time zones\n// =============================================================================\n/** @internal */\nexport const toUtc = self => makeUtc(self.epochMilliseconds);\n/** @internal */\nexport const setZone = /*#__PURE__*/dual(isDateTimeArgs, (self, zone, options) => options?.adjustForTimeZone === true ? makeZonedFromAdjusted(self.epochMilliseconds, zone, options?.disambiguation ?? \"compatible\") : makeZonedProto(self.epochMilliseconds, zone, self.partsUtc));\n/** @internal */\nexport const setZoneOffset = /*#__PURE__*/dual(isDateTimeArgs, (self, offset, options) => setZone(self, zoneMakeOffset(offset), options));\nconst validZoneCache = /*#__PURE__*/new Map();\nconst formatOptions = {\n day: \"numeric\",\n month: \"numeric\",\n year: \"numeric\",\n hour: \"numeric\",\n minute: \"numeric\",\n second: \"numeric\",\n timeZoneName: \"longOffset\",\n fractionalSecondDigits: 3,\n hourCycle: \"h23\"\n};\nconst zoneMakeIntl = format => {\n const zoneId = format.resolvedOptions().timeZone;\n if (validZoneCache.has(zoneId)) {\n return validZoneCache.get(zoneId);\n }\n const zone = Object.create(ProtoTimeZoneNamed);\n zone.id = zoneId;\n zone.format = format;\n validZoneCache.set(zoneId, zone);\n return zone;\n};\n/** @internal */\nexport const zoneMakeNamedUnsafe = zoneId => {\n if (validZoneCache.has(zoneId)) {\n return validZoneCache.get(zoneId);\n }\n try {\n return zoneMakeIntl(new Intl.DateTimeFormat(\"en-US\", {\n ...formatOptions,\n timeZone: zoneId\n }));\n } catch {\n throw new IllegalArgumentError(`Invalid time zone: ${zoneId}`);\n }\n};\n/** @internal */\nexport const zoneMakeOffset = offset => {\n const zone = Object.create(ProtoTimeZoneOffset);\n zone.offset = offset;\n return zone;\n};\n/** @internal */\nexport const zoneMakeNamed = /*#__PURE__*/Option.liftThrowable(zoneMakeNamedUnsafe);\n/** @internal */\nexport const zoneMakeNamedEffect = zoneId => effect.try({\n try: () => zoneMakeNamedUnsafe(zoneId),\n catch: e => e\n});\n/** @internal */\nexport const zoneMakeLocal = () => zoneMakeIntl(new Intl.DateTimeFormat(\"en-US\", formatOptions));\nconst offsetZoneRegExp = /^(?:GMT|[+-])/;\n/** @internal */\nexport const zoneFromString = zone => {\n if (offsetZoneRegExp.test(zone)) {\n const offset = parseOffset(zone);\n return offset === null ? Option.none() : Option.some(zoneMakeOffset(offset));\n }\n return zoneMakeNamed(zone);\n};\n/** @internal */\nexport const zoneToString = self => {\n if (self._tag === \"Offset\") {\n return offsetToString(self.offset);\n }\n return self.id;\n};\n/** @internal */\nexport const setZoneNamed = /*#__PURE__*/dual(isDateTimeArgs, (self, zoneId, options) => Option.map(zoneMakeNamed(zoneId), zone => setZone(self, zone, options)));\n/** @internal */\nexport const setZoneNamedUnsafe = /*#__PURE__*/dual(isDateTimeArgs, (self, zoneId, options) => setZone(self, zoneMakeNamedUnsafe(zoneId), options));\n// =============================================================================\n// comparisons\n// =============================================================================\n/** @internal */\nexport const distance = /*#__PURE__*/dual(2, (self, other) => Duration.millis(toEpochMillis(other) - toEpochMillis(self)));\n/** @internal */\nexport const min = /*#__PURE__*/order.min(Order);\n/** @internal */\nexport const max = /*#__PURE__*/order.max(Order);\n/** @internal */\nexport const isGreaterThan = /*#__PURE__*/order.isGreaterThan(Order);\n/** @internal */\nexport const isGreaterThanOrEqualTo = /*#__PURE__*/order.isGreaterThanOrEqualTo(Order);\n/** @internal */\nexport const isLessThan = /*#__PURE__*/order.isLessThan(Order);\n/** @internal */\nexport const isLessThanOrEqualTo = /*#__PURE__*/order.isLessThanOrEqualTo(Order);\n/** @internal */\nexport const between = /*#__PURE__*/order.isBetween(Order);\n/** @internal */\nexport const isFuture = self => effect.map(now, isLessThan(self));\n/** @internal */\nexport const isFutureUnsafe = self => isLessThan(nowUnsafe(), self);\n/** @internal */\nexport const isPast = self => effect.map(now, isGreaterThan(self));\n/** @internal */\nexport const isPastUnsafe = self => isGreaterThan(nowUnsafe(), self);\n// =============================================================================\n// conversions\n// =============================================================================\n/** @internal */\nexport const toDateUtc = self => new Date(self.epochMilliseconds);\n/** @internal */\nexport const toDate = self => {\n if (self._tag === \"Utc\") {\n return new Date(self.epochMilliseconds);\n } else if (self.zone._tag === \"Offset\") {\n return new Date(self.epochMilliseconds + self.zone.offset);\n } else if (self.adjustedEpochMilliseconds !== undefined) {\n return new Date(self.adjustedEpochMilliseconds);\n }\n const parts = self.zone.format.formatToParts(self.epochMilliseconds).filter(_ => _.type !== \"literal\");\n const date = new Date(0);\n date.setUTCFullYear(Number(parts[2].value), Number(parts[0].value) - 1, Number(parts[1].value));\n date.setUTCHours(Number(parts[3].value), Number(parts[4].value), Number(parts[5].value), Number(parts[6].value));\n self.adjustedEpochMilliseconds = date.getTime();\n return date;\n};\n/** @internal */\nexport const zonedOffset = self => {\n const date = toDate(self);\n return date.getTime() - toEpochMillis(self);\n};\nconst offsetToString = offset => {\n const abs = Math.abs(offset);\n let hours = Math.floor(abs / (60 * 60 * 1000));\n let minutes = Math.round(abs % (60 * 60 * 1000) / (60 * 1000));\n if (minutes === 60) {\n hours += 1;\n minutes = 0;\n }\n return `${offset < 0 ? \"-\" : \"+\"}${String(hours).padStart(2, \"0\")}:${String(minutes).padStart(2, \"0\")}`;\n};\n/** @internal */\nexport const zonedOffsetIso = self => offsetToString(zonedOffset(self));\n/** @internal */\nexport const toEpochMillis = self => self.epochMilliseconds;\n/** @internal */\nexport const toEpochSeconds = self => Math.floor(self.epochMilliseconds / 1000);\n/** @internal */\nexport const fromEpochSeconds = seconds => makeUtc(seconds * 1000);\n/** @internal */\nexport const removeTime = self => withDate(self, date => {\n date.setUTCHours(0, 0, 0, 0);\n return makeUtc(date.getTime());\n});\n// =============================================================================\n// parts\n// =============================================================================\nconst dateToParts = date => ({\n millisecond: date.getUTCMilliseconds(),\n second: date.getUTCSeconds(),\n minute: date.getUTCMinutes(),\n hour: date.getUTCHours(),\n day: date.getUTCDate(),\n weekDay: date.getUTCDay(),\n month: date.getUTCMonth() + 1,\n year: date.getUTCFullYear()\n});\n/** @internal */\nexport const toParts = self => {\n if (self._tag === \"Utc\") {\n return toPartsUtc(self);\n } else if (self.partsAdjusted !== undefined) {\n return self.partsAdjusted;\n }\n self.partsAdjusted = withDate(self, dateToParts);\n return self.partsAdjusted;\n};\n/** @internal */\nexport const toPartsUtc = self => {\n if (self.partsUtc !== undefined) {\n return self.partsUtc;\n }\n self.partsUtc = withDateUtc(self, dateToParts);\n return self.partsUtc;\n};\n/** @internal */\nexport const getPartUtc = /*#__PURE__*/dual(2, (self, part) => toPartsUtc(self)[part]);\n/** @internal */\nexport const getPart = /*#__PURE__*/dual(2, (self, part) => toParts(self)[part]);\nconst setPartsDate = (date, parts) => {\n if (parts.year !== undefined || parts.month !== undefined || parts.day !== undefined) {\n date.setUTCFullYear(parts.year ?? date.getUTCFullYear(), parts.month !== undefined ? parts.month - 1 : date.getUTCMonth(), parts.day ?? date.getUTCDate());\n }\n if (parts.weekDay !== undefined) {\n const diff = parts.weekDay - date.getUTCDay();\n date.setUTCDate(date.getUTCDate() + diff);\n }\n if (parts.hour !== undefined) {\n date.setUTCHours(parts.hour);\n }\n if (parts.minute !== undefined) {\n date.setUTCMinutes(parts.minute);\n }\n if (parts.second !== undefined) {\n date.setUTCSeconds(parts.second);\n }\n if (parts.millisecond !== undefined) {\n date.setUTCMilliseconds(parts.millisecond);\n }\n};\n/** @internal */\nexport const setParts = /*#__PURE__*/dual(2, (self, parts) => mutate(self, date => setPartsDate(date, parts)));\n/** @internal */\nexport const setPartsUtc = /*#__PURE__*/dual(2, (self, parts) => mutateUtc(self, date => setPartsDate(date, parts)));\n// =============================================================================\n// mapping\n// =============================================================================\nconst constDayMillis = 24 * 60 * 60 * 1000;\nconst makeZonedFromAdjusted = (adjustedMillis, zone, disambiguation) => {\n if (zone._tag === \"Offset\") {\n return makeZonedProto(adjustedMillis - zone.offset, zone);\n }\n const beforeOffset = calculateNamedOffset(adjustedMillis - constDayMillis, adjustedMillis, zone);\n const afterOffset = calculateNamedOffset(adjustedMillis + constDayMillis, adjustedMillis, zone);\n // If there is no transition, we can return early\n if (beforeOffset === afterOffset) {\n return makeZonedProto(adjustedMillis - beforeOffset, zone);\n }\n const isForwards = beforeOffset < afterOffset;\n const transitionMillis = beforeOffset - afterOffset;\n // If the transition is forwards, we only need to check if we should move the\n // local wall clock time forward if it is inside the gap\n if (isForwards) {\n const currentAfterOffset = calculateNamedOffset(adjustedMillis - afterOffset, adjustedMillis, zone);\n if (currentAfterOffset === afterOffset) {\n return makeZonedProto(adjustedMillis - afterOffset, zone);\n }\n const before = makeZonedProto(adjustedMillis - beforeOffset, zone);\n const beforeAdjustedMillis = toDate(before).getTime();\n // If the wall clock time has changed, we are inside the gap\n if (adjustedMillis !== beforeAdjustedMillis) {\n switch (disambiguation) {\n case \"reject\":\n {\n const formatted = new Date(adjustedMillis).toISOString();\n throw new RangeError(`Gap time: ${formatted} does not exist in time zone ${zone.id}`);\n }\n case \"earlier\":\n return makeZonedProto(adjustedMillis - afterOffset, zone);\n case \"compatible\":\n case \"later\":\n return before;\n }\n }\n // The wall clock time is in the earlier offset, so we use that\n return before;\n }\n const currentBeforeOffset = calculateNamedOffset(adjustedMillis - beforeOffset, adjustedMillis, zone);\n // The wall clock time is in the earlier offset, so we use that\n if (currentBeforeOffset === beforeOffset) {\n if (disambiguation === \"earlier\" || disambiguation === \"compatible\") {\n return makeZonedProto(adjustedMillis - beforeOffset, zone);\n }\n const laterOffset = calculateNamedOffset(adjustedMillis - beforeOffset + transitionMillis, adjustedMillis + transitionMillis, zone);\n if (laterOffset === beforeOffset) {\n return makeZonedProto(adjustedMillis - beforeOffset, zone);\n }\n // If the offset changed in this period, then we are inside the period where\n // the wall clock time occurs twice, once in the earlier offset and once in\n // the later offset.\n if (disambiguation === \"reject\") {\n const formatted = new Date(adjustedMillis).toISOString();\n throw new RangeError(`Ambiguous time: ${formatted} occurs twice in time zone ${zone.id}`);\n }\n // If the disambiguation is \"later\", we return the later offset below\n }\n return makeZonedProto(adjustedMillis - afterOffset, zone);\n};\nconst offsetRegExp = /([+-])(\\d{2}):(\\d{2})$/;\nconst parseOffset = offset => {\n const match = offsetRegExp.exec(offset);\n if (match === null) {\n return null;\n }\n const [, sign, hours, minutes] = match;\n return (sign === \"+\" ? 1 : -1) * (Number(hours) * 60 + Number(minutes)) * 60 * 1000;\n};\nconst calculateNamedOffset = (utcMillis, adjustedMillis, zone) => {\n const offset = zone.format.formatToParts(utcMillis).find(_ => _.type === \"timeZoneName\")?.value ?? \"\";\n if (offset === \"GMT\") {\n return 0;\n }\n const result = parseOffset(offset);\n if (result === null) {\n // fallback to using the adjusted date\n return zonedOffset(makeZonedProto(adjustedMillis, zone));\n }\n return result;\n};\n/** @internal */\nexport const mutate = /*#__PURE__*/dual(isDateTimeArgs, (self, f, options) => {\n if (self._tag === \"Utc\") {\n const date = toDateUtc(self);\n f(date);\n return makeUtc(date.getTime());\n }\n const adjustedDate = toDate(self);\n const newAdjustedDate = new Date(adjustedDate.getTime());\n f(newAdjustedDate);\n return makeZonedFromAdjusted(newAdjustedDate.getTime(), self.zone, options?.disambiguation ?? \"compatible\");\n});\n/** @internal */\nexport const mutateUtc = /*#__PURE__*/dual(2, (self, f) => mapEpochMillis(self, millis => {\n const date = new Date(millis);\n f(date);\n return date.getTime();\n}));\n/** @internal */\nexport const mapEpochMillis = /*#__PURE__*/dual(2, (self, f) => {\n const millis = f(toEpochMillis(self));\n return self._tag === \"Utc\" ? makeUtc(millis) : makeZonedProto(millis, self.zone);\n});\n/** @internal */\nexport const withDate = /*#__PURE__*/dual(2, (self, f) => f(toDate(self)));\n/** @internal */\nexport const withDateUtc = /*#__PURE__*/dual(2, (self, f) => f(toDateUtc(self)));\n/** @internal */\nexport const match = /*#__PURE__*/dual(2, (self, options) => self._tag === \"Utc\" ? options.onUtc(self) : options.onZoned(self));\n// =============================================================================\n// math\n// =============================================================================\n/** @internal */\nexport const addDuration = /*#__PURE__*/dual(2, (self, duration) => mapEpochMillis(self, millis => millis + Duration.toMillis(Duration.fromInputUnsafe(duration))));\n/** @internal */\nexport const subtractDuration = /*#__PURE__*/dual(2, (self, duration) => mapEpochMillis(self, millis => millis - Duration.toMillis(Duration.fromInputUnsafe(duration))));\nconst addMillis = (date, amount) => {\n date.setTime(date.getTime() + amount);\n};\n/** @internal */\nexport const add = /*#__PURE__*/dual(2, (self, parts) => mutate(self, date => {\n if (parts.milliseconds) {\n addMillis(date, parts.milliseconds);\n }\n if (parts.seconds) {\n addMillis(date, parts.seconds * 1000);\n }\n if (parts.minutes) {\n addMillis(date, parts.minutes * 60 * 1000);\n }\n if (parts.hours) {\n addMillis(date, parts.hours * 60 * 60 * 1000);\n }\n if (parts.days) {\n date.setUTCDate(date.getUTCDate() + parts.days);\n }\n if (parts.weeks) {\n date.setUTCDate(date.getUTCDate() + parts.weeks * 7);\n }\n if (parts.months) {\n const day = date.getUTCDate();\n date.setUTCMonth(date.getUTCMonth() + parts.months + 1, 0);\n if (day < date.getUTCDate()) {\n date.setUTCDate(day);\n }\n }\n if (parts.years) {\n const day = date.getUTCDate();\n const month = date.getUTCMonth();\n date.setUTCFullYear(date.getUTCFullYear() + parts.years, month + 1, 0);\n if (day < date.getUTCDate()) {\n date.setUTCDate(day);\n }\n }\n}));\n/** @internal */\nexport const subtract = /*#__PURE__*/dual(2, (self, parts) => {\n const newParts = {};\n for (const key in parts) {\n newParts[key] = -1 * parts[key];\n }\n return add(self, newParts);\n});\nconst startOfDate = (date, part, options) => {\n switch (part) {\n case \"second\":\n {\n date.setUTCMilliseconds(0);\n break;\n }\n case \"minute\":\n {\n date.setUTCSeconds(0, 0);\n break;\n }\n case \"hour\":\n {\n date.setUTCMinutes(0, 0, 0);\n break;\n }\n case \"day\":\n {\n date.setUTCHours(0, 0, 0, 0);\n break;\n }\n case \"week\":\n {\n const weekStartsOn = options?.weekStartsOn ?? 0;\n const day = date.getUTCDay();\n const diff = (day - weekStartsOn + 7) % 7;\n date.setUTCDate(date.getUTCDate() - diff);\n date.setUTCHours(0, 0, 0, 0);\n break;\n }\n case \"month\":\n {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n break;\n }\n case \"year\":\n {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n break;\n }\n }\n};\n/** @internal */\nexport const startOf = /*#__PURE__*/dual(isDateTimeArgs, (self, part, options) => mutate(self, date => startOfDate(date, part, options)));\nconst endOfDate = (date, part, options) => {\n switch (part) {\n case \"second\":\n {\n date.setUTCMilliseconds(999);\n break;\n }\n case \"minute\":\n {\n date.setUTCSeconds(59, 999);\n break;\n }\n case \"hour\":\n {\n date.setUTCMinutes(59, 59, 999);\n break;\n }\n case \"day\":\n {\n date.setUTCHours(23, 59, 59, 999);\n break;\n }\n case \"week\":\n {\n const weekStartsOn = options?.weekStartsOn ?? 0;\n const day = date.getUTCDay();\n const diff = (day - weekStartsOn + 7) % 7;\n date.setUTCDate(date.getUTCDate() - diff + 6);\n date.setUTCHours(23, 59, 59, 999);\n break;\n }\n case \"month\":\n {\n date.setUTCMonth(date.getUTCMonth() + 1, 0);\n date.setUTCHours(23, 59, 59, 999);\n break;\n }\n case \"year\":\n {\n date.setUTCMonth(11, 31);\n date.setUTCHours(23, 59, 59, 999);\n break;\n }\n }\n};\n/** @internal */\nexport const endOf = /*#__PURE__*/dual(isDateTimeArgs, (self, part, options) => mutate(self, date => endOfDate(date, part, options)));\n/** @internal */\nexport const nearest = /*#__PURE__*/dual(isDateTimeArgs, (self, part, options) => mutate(self, date => {\n if (part === \"millisecond\") return;\n const millis = date.getTime();\n const start = new Date(millis);\n startOfDate(start, part, options);\n const startMillis = start.getTime();\n const end = new Date(millis);\n endOfDate(end, part, options);\n const endMillis = end.getTime() + 1;\n const diffStart = millis - startMillis;\n const diffEnd = endMillis - millis;\n if (diffStart < diffEnd) {\n date.setTime(startMillis);\n } else {\n date.setTime(endMillis);\n }\n}));\n// =============================================================================\n// formatting\n// =============================================================================\nconst intlTimeZone = self => {\n if (self._tag === \"Named\") {\n return self.id;\n }\n return offsetToString(self.offset);\n};\n/** @internal */\nexport const format = /*#__PURE__*/dual(isDateTimeArgs, (self, options) => {\n try {\n return new Intl.DateTimeFormat(options?.locale, {\n timeZone: self._tag === \"Utc\" ? \"UTC\" : intlTimeZone(self.zone),\n ...options\n }).format(self.epochMilliseconds);\n } catch {\n return new Intl.DateTimeFormat(options?.locale, {\n timeZone: \"UTC\",\n ...options\n }).format(toDate(self));\n }\n});\n/** @internal */\nexport const formatLocal = /*#__PURE__*/dual(isDateTimeArgs, (self, options) => new Intl.DateTimeFormat(options?.locale, options).format(self.epochMilliseconds));\n/** @internal */\nexport const formatUtc = /*#__PURE__*/dual(isDateTimeArgs, (self, options) => new Intl.DateTimeFormat(options?.locale, {\n ...options,\n timeZone: \"UTC\"\n}).format(self.epochMilliseconds));\n/** @internal */\nexport const formatIntl = /*#__PURE__*/dual(2, (self, format) => format.format(self.epochMilliseconds));\n/** @internal */\nexport const formatIso = self => toDateUtc(self).toISOString();\n/** @internal */\nexport const formatIsoDate = self => toDate(self).toISOString().slice(0, 10);\n/** @internal */\nexport const formatIsoDateUtc = self => toDateUtc(self).toISOString().slice(0, 10);\n/** @internal */\nexport const formatIsoOffset = self => {\n const date = toDate(self);\n return self._tag === \"Utc\" ? date.toISOString() : `${date.toISOString().slice(0, -1)}${zonedOffsetIso(self)}`;\n};\n/** @internal */\nexport const formatIsoZoned = self => self.zone._tag === \"Offset\" ? formatIsoOffset(self) : `${formatIsoOffset(self)}[${self.zone.id}]`;\n//# sourceMappingURL=dateTime.js.map","/** @internal */\nexport const redactedRegistry = /*#__PURE__*/new WeakMap();\n/** @internal */\nexport const value = self => {\n if (redactedRegistry.has(self)) {\n return redactedRegistry.get(self);\n } else {\n throw new Error(\"Unable to get redacted value\" + (self.label ? ` with label: \"${self.label}\"` : \"\"));\n }\n};\n/** @internal */\nexport const stringOrRedacted = val => typeof val === \"string\" ? val : value(val);\n//# sourceMappingURL=redacted.js.map","/**\n * Wraps sensitive values so normal output does not reveal them.\n *\n * A `Redacted<A>` shows a redacted placeholder in string, JSON, and inspection\n * output, while still storing the original value for trusted code that needs to\n * recover it. This helps reduce accidental leaks in logs and diagnostics. This\n * module includes constructors, runtime checks, value recovery, wiping of stored\n * values, and comparison helpers that avoid exposing the wrapped value at the\n * call site.\n *\n * @since 3.3.0\n */\nimport * as Equal from \"./Equal.js\";\nimport * as Equivalence from \"./Equivalence.js\";\nimport * as Hash from \"./Hash.js\";\nimport { PipeInspectableProto } from \"./internal/core.js\";\nimport * as redacted from \"./internal/redacted.js\";\nimport { hasProperty, isString } from \"./Predicate.js\";\nconst TypeId = \"~effect/Redacted\";\n/**\n * Returns `true` if a value is a `Redacted` wrapper.\n *\n * **When to use**\n *\n * Use to validate unknown input and narrow it to `Redacted`.\n *\n * **Details**\n *\n * When this function returns `true`, TypeScript narrows the value to\n * `Redacted<unknown>`.\n *\n * **Example** (Checking for redacted values)\n *\n * ```ts import.meta.vitest\n * import { Redacted } from \"effect\"\n *\n * const secret = Redacted.make(\"my-secret\")\n * const plainString = \"not-secret\"\n *\n * Redacted.isRedacted(secret) // => true\n * Redacted.isRedacted(plainString) // => false\n * ```\n *\n * @category guards\n * @since 3.3.0\n */\nexport const isRedacted = u => hasProperty(u, TypeId);\n/**\n * Creates a `Redacted` wrapper for a sensitive value.\n *\n * **When to use**\n *\n * Use to wrap a sensitive value so normal string, JSON, and inspection output\n * is redacted.\n *\n * **Details**\n *\n * The wrapper redacts string, JSON, and inspection output to reduce accidental\n * disclosure. The original value remains retrievable with `Redacted.value`\n * until the wrapper is wiped or becomes unreachable.\n *\n * **Example** (Creating a redacted value)\n *\n * ```ts import.meta.vitest\n * import { Redacted } from \"effect\"\n *\n * const API_KEY = Redacted.make(\"1234567890\")\n * String(API_KEY) // => \"<redacted>\"\n * ```\n *\n * @category constructors\n * @since 3.3.0\n */\nexport const make = (value, options) => {\n const self = Object.create(Proto);\n if (options?.label) {\n self.label = options.label;\n }\n redacted.redactedRegistry.set(self, value);\n return self;\n};\nconst Proto = {\n [TypeId]: {\n _A: _ => _\n },\n label: undefined,\n ...PipeInspectableProto,\n toJSON() {\n return this.toString();\n },\n toString() {\n return `<redacted${isString(this.label) ? \":\" + this.label : \"\"}>`;\n },\n [Hash.symbol]() {\n return Hash.hash(redacted.redactedRegistry.get(this));\n },\n [Equal.symbol](that) {\n return isRedacted(that) && Equal.equals(redacted.redactedRegistry.get(this), redacted.redactedRegistry.get(that));\n }\n};\n/**\n * Retrieves the original value from a `Redacted` instance. Use this function\n * with caution, as it exposes the sensitive data.\n *\n * **When to use**\n *\n * Use when you need the underlying sensitive value at a trusted boundary.\n *\n * **Example** (Retrieving a redacted value)\n *\n * ```ts import.meta.vitest\n * import { Redacted } from \"effect\"\n *\n * const API_KEY = Redacted.make(\"1234567890\")\n *\n * Redacted.value(API_KEY) // => \"1234567890\"\n * ```\n *\n * @category getters\n * @since 3.3.0\n */\nexport const value = redacted.value;\n/**\n * Deletes the stored value for a `Redacted` wrapper, making future\n * `Redacted.value` calls on that wrapper fail.\n *\n * **When to use**\n *\n * Use when a `Redacted` wrapper should no longer be able to reveal its stored\n * value.\n *\n * **Gotchas**\n *\n * This unsafe operation does not zero memory and does not affect other\n * references to the original value. It only removes the value from the\n * internal redacted registry.\n *\n * **Example** (Wiping a redacted value)\n *\n * ```ts import.meta.vitest\n * import { Redacted, Result } from \"effect\"\n *\n * const API_KEY = Redacted.make(\"1234567890\")\n *\n * Redacted.value(API_KEY) // => \"1234567890\"\n *\n * Redacted.wipeUnsafe(API_KEY)\n *\n * const failure = Result.try({\n * try: () => Redacted.value(API_KEY),\n * catch: (error) => (error as Error).message\n * })\n * failure // => Result.fail(\"Unable to get redacted value\")\n * ```\n *\n * @category unsafe\n * @since 4.0.0\n */\nexport const wipeUnsafe = self => redacted.redactedRegistry.delete(self);\n/**\n * Generates an equivalence relation for `Redacted<A>` values based on an\n * equivalence relation for the underlying values `A`. This function is useful\n * for comparing `Redacted` instances without exposing their contents.\n *\n * **When to use**\n *\n * Use when you need to compare wrapped secrets through an approved equality\n * rule without exposing the underlying values at each comparison site.\n *\n * **Example** (Comparing redacted values)\n *\n * ```ts import.meta.vitest\n * import { Equivalence, Redacted } from \"effect\"\n *\n * const API_KEY1 = Redacted.make(\"1234567890\")\n * const API_KEY2 = Redacted.make(\"1-34567890\")\n * const API_KEY3 = Redacted.make(\"1234567890\")\n *\n * const equivalence = Redacted.makeEquivalence(Equivalence.strictEqual<string>())\n *\n * equivalence(API_KEY1, API_KEY2) // => false\n * equivalence(API_KEY1, API_KEY3) // => true\n * ```\n *\n * @category instances\n * @since 4.0.0\n */\nexport const makeEquivalence = isEquivalent => Equivalence.make((x, y) => isEquivalent(value(x), value(y)));\n//# sourceMappingURL=Redacted.js.map","/**\n * Decimal numbers and arithmetic for cases where JavaScript `number` rounding\n * is not precise enough. A `BigDecimal` stores digits as a `bigint` plus a\n * decimal scale, which lets the module parse, compare, add, subtract, multiply,\n * divide, round, and format decimal values such as money, quantities, and\n * measurements.\n *\n * @since 2.0.0\n */\nimport * as Equal from \"./Equal.js\";\nimport * as Equ from \"./Equivalence.js\";\nimport { dual } from \"./Function.js\";\nimport * as Hash from \"./Hash.js\";\nimport { NodeInspectSymbol } from \"./Inspectable.js\";\nimport * as Option from \"./Option.js\";\nimport * as order from \"./Order.js\";\nimport { pipeArguments } from \"./Pipeable.js\";\nimport { hasProperty } from \"./Predicate.js\";\nconst DEFAULT_PRECISION = 100;\nconst FINITE_INT_REGEXP = /^[+-]?\\d+$/;\nconst TypeId = \"~effect/BigDecimal\";\nconst BigDecimalProto = {\n [TypeId]: TypeId,\n [Hash.symbol]() {\n const normalized = normalize(this);\n return Hash.combine(Hash.hash(normalized.value), Hash.number(normalized.scale));\n },\n [Equal.symbol](that) {\n return isBigDecimal(that) && equals(this, that);\n },\n toString() {\n return `BigDecimal(${format(this)})`;\n },\n toJSON() {\n return {\n _id: \"BigDecimal\",\n value: String(this.value),\n scale: this.scale\n };\n },\n [NodeInspectSymbol]() {\n return this.toJSON();\n },\n pipe() {\n return pipeArguments(this, arguments);\n }\n};\n/**\n * Checks whether a given value is a `BigDecimal`.\n *\n * **When to use**\n *\n * Use to validate unknown input and narrow it to `BigDecimal`.\n *\n * **Example** (Checking BigDecimal values)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const decimal = BigDecimal.fromNumber(123.45)\n * BigDecimal.isBigDecimal(decimal) // => false\n * BigDecimal.isBigDecimal(BigDecimal.fromStringUnsafe(\"123.45\")) // => true\n * BigDecimal.isBigDecimal(123.45) // => false\n * BigDecimal.isBigDecimal(\"123.45\") // => false\n * ```\n *\n * @category guards\n * @since 2.0.0\n */\nexport const isBigDecimal = u => hasProperty(u, TypeId);\n/**\n * Creates a `BigDecimal` from a `bigint` value and a safe integer scale.\n *\n * **When to use**\n *\n * Use to construct a decimal directly from its unscaled integer value and\n * decimal scale.\n *\n * **Gotchas**\n *\n * Throws a `RangeError` if `scale` is not a safe integer.\n *\n * **Example** (Creating decimals from bigint and scale)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * // Create 123.45 (12345 with scale 2)\n * const decimal = BigDecimal.make(12345n, 2)\n * decimal // => BigDecimal.fromStringUnsafe(\"123.45\")\n *\n * // Create 42 (42 with scale 0)\n * const integer = BigDecimal.make(42n, 0)\n * integer // => BigDecimal.fromBigInt(42n)\n * ```\n *\n * @see {@link fromBigInt} for constructing an integer decimal from a `bigint`\n *\n * @category constructors\n * @since 2.0.0\n */\nexport const make = (value, scale) => {\n if (!Number.isSafeInteger(scale)) {\n throw new RangeError(`Scale must be a safe integer, got ${scale}`);\n }\n const o = Object.create(BigDecimalProto);\n o.value = value;\n o.scale = scale;\n return o;\n};\n/**\n * Internal function used to create pre-normalized `BigDecimal`s.\n *\n * @internal\n */\nexport const makeNormalizedUnsafe = (value, scale) => {\n if (value !== bigint0 && value % bigint10 === bigint0) {\n throw new RangeError(\"Value must be normalized\");\n }\n const o = make(value, scale);\n o.normalized = o;\n return o;\n};\nconst bigint0 = /*#__PURE__*/BigInt(0);\nconst bigint1 = /*#__PURE__*/BigInt(1);\nconst bigint_1 = /*#__PURE__*/BigInt(-1);\nconst bigint2 = /*#__PURE__*/BigInt(2);\nconst bigint5 = /*#__PURE__*/BigInt(5);\nconst bigint_5 = /*#__PURE__*/BigInt(-5);\nconst bigint10 = /*#__PURE__*/BigInt(10);\nconst zero = /*#__PURE__*/makeNormalizedUnsafe(bigint0, 0);\nconst one = /*#__PURE__*/makeNormalizedUnsafe(bigint1, 0);\n/**\n * Normalizes a given `BigDecimal` by removing trailing zeros.\n *\n * **When to use**\n *\n * Use to canonicalize decimals that have equivalent values but different\n * internal scales.\n *\n * **Example** (Normalizing trailing zeros)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const decimal = BigDecimal.normalize(BigDecimal.fromStringUnsafe(\"123.00000\"))\n * const decimalStorage = [decimal.value, decimal.scale] // => [123n, 0]\n *\n * const largeDecimal = BigDecimal.normalize(BigDecimal.fromStringUnsafe(\"12300000\"))\n * const largeDecimalStorage = [largeDecimal.value, largeDecimal.scale] // => [123n, -5]\n * ```\n *\n * @see {@link format} for rendering normalized decimals as strings\n *\n * @category scaling\n * @since 2.0.0\n */\nexport const normalize = self => {\n if (self.normalized === undefined) {\n if (self.value === bigint0) {\n self.normalized = zero;\n } else {\n const digits = `${self.value}`;\n let trail = 0;\n for (let i = digits.length - 1; i >= 0; i--) {\n if (digits[i] === \"0\") {\n trail++;\n } else {\n break;\n }\n }\n if (trail === 0) {\n self.normalized = self;\n }\n const value = BigInt(digits.substring(0, digits.length - trail));\n const scale = self.scale - trail;\n self.normalized = makeNormalizedUnsafe(value, scale);\n }\n }\n return self.normalized;\n};\n/**\n * Changes a `BigDecimal` to the specified scale.\n *\n * **When to use**\n *\n * Use to change how many decimal places are represented by a `BigDecimal`.\n *\n * **Details**\n *\n * Increasing the scale appends decimal zeros. Decreasing the scale discards\n * digits beyond the target scale by `bigint` division, which truncates toward\n * zero.\n *\n * **Example** (Scaling decimal precision)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const decimal = BigDecimal.fromNumberUnsafe(123.45)\n *\n * // Increase scale (add more precision)\n * const scaled = BigDecimal.scale(decimal, 4)\n * const scaledStorage = [scaled.value, scaled.scale] // => [1234500n, 4]\n *\n * // Decrease scale (reduce precision, truncating toward zero)\n * const reduced = BigDecimal.scale(decimal, 1)\n * reduced // => BigDecimal.fromStringUnsafe(\"123.4\")\n * ```\n *\n * @see {@link round} for changing scale with configurable rounding\n *\n * @category scaling\n * @since 2.0.0\n */\nexport const scale = /*#__PURE__*/dual(2, (self, scale) => {\n if (scale > self.scale) {\n return make(self.value * bigint10 ** BigInt(scale - self.scale), scale);\n }\n if (scale < self.scale) {\n return make(self.value / bigint10 ** BigInt(self.scale - scale), scale);\n }\n return self;\n});\n/**\n * Provides an addition operation on `BigDecimal`s.\n *\n * **When to use**\n *\n * Use when you need a decimal addition function for piping or higher-order APIs\n * while preserving decimal precision.\n *\n * **Example** (Adding decimals)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const result = BigDecimal.sum(\n * BigDecimal.fromStringUnsafe(\"2\"),\n * BigDecimal.fromStringUnsafe(\"3\")\n * ) // => BigDecimal.fromBigInt(5n)\n * ```\n *\n * @see {@link sumAll} for summing an iterable of `BigDecimal` values\n *\n * @category math\n * @since 2.0.0\n */\nexport const sum = /*#__PURE__*/dual(2, (self, that) => {\n if (that.value === bigint0) {\n return self;\n }\n if (self.value === bigint0) {\n return that;\n }\n if (self.scale > that.scale) {\n return make(scale(that, self.scale).value + self.value, self.scale);\n }\n if (self.scale < that.scale) {\n return make(scale(self, that.scale).value + that.value, that.scale);\n }\n return make(self.value + that.value, self.scale);\n});\n/**\n * Takes an `Iterable` of `BigDecimal`s and returns their sum as a single `BigDecimal`.\n *\n * **When to use**\n *\n * Use when you need to aggregate decimal quantities with decimal precision\n * instead of converting through JavaScript numbers.\n *\n * **Example** (Adding multiple decimals)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const result = BigDecimal.sumAll([\n * BigDecimal.fromStringUnsafe(\"2\"),\n * BigDecimal.fromStringUnsafe(\"3\"),\n * BigDecimal.fromStringUnsafe(\"4\")\n * ]) // => BigDecimal.fromBigInt(9n)\n * ```\n *\n * @see {@link sum} for adding two `BigDecimal` values\n *\n * @category math\n * @since 3.16.0\n */\nexport const sumAll = collection => {\n let out = zero;\n for (const n of collection) {\n out = sum(out, n);\n }\n return out;\n};\n/**\n * Provides a multiplication operation on `BigDecimal`s.\n *\n * **When to use**\n *\n * Use to multiply two `BigDecimal` values.\n *\n * **Example** (Multiplying decimals)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const result = BigDecimal.multiply(\n * BigDecimal.fromStringUnsafe(\"2\"),\n * BigDecimal.fromStringUnsafe(\"3\")\n * ) // => BigDecimal.fromBigInt(6n)\n * ```\n *\n * @see {@link multiplyAll} for multiplying an iterable of `BigDecimal` values\n *\n * @category math\n * @since 2.0.0\n */\nexport const multiply = /*#__PURE__*/dual(2, (self, that) => {\n if (that.value === bigint0 || self.value === bigint0) {\n return zero;\n }\n return make(self.value * that.value, self.scale + that.scale);\n});\n/**\n * Takes an `Iterable` of `BigDecimal`s and returns their multiplication as a single `BigDecimal`.\n *\n * **When to use**\n *\n * Use to multiply all `BigDecimal` values in an iterable.\n *\n * **Example** (Multiplying multiple decimals)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const result = BigDecimal.multiplyAll([\n * BigDecimal.fromStringUnsafe(\"2\"),\n * BigDecimal.fromStringUnsafe(\"3\"),\n * BigDecimal.fromStringUnsafe(\"4\")\n * ]) // => BigDecimal.fromBigInt(24n)\n * ```\n *\n * @see {@link multiply} for multiplying two `BigDecimal` values\n *\n * @category math\n * @since 4.0.0\n */\nexport const multiplyAll = collection => {\n let out = one;\n for (const n of collection) {\n if (n.value === bigint0) {\n return zero;\n }\n out = multiply(out, n);\n }\n return out;\n};\n/**\n * Provides a subtraction operation on `BigDecimal`s.\n *\n * **When to use**\n *\n * Use to subtract one `BigDecimal` value from another.\n *\n * **Example** (Subtracting decimals)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const result = BigDecimal.subtract(\n * BigDecimal.fromStringUnsafe(\"2\"),\n * BigDecimal.fromStringUnsafe(\"3\")\n * ) // => BigDecimal.fromBigInt(-1n)\n * ```\n *\n * @category math\n * @since 2.0.0\n */\nexport const subtract = /*#__PURE__*/dual(2, (self, that) => {\n if (that.value === bigint0) {\n return self;\n }\n if (self.value === bigint0) {\n return make(-that.value, that.scale);\n }\n if (self.scale > that.scale) {\n return make(self.value - scale(that, self.scale).value, self.scale);\n }\n if (self.scale < that.scale) {\n return make(scale(self, that.scale).value - that.value, that.scale);\n }\n return make(self.value - that.value, self.scale);\n});\n/**\n * Internal function used for arbitrary precision division.\n */\nconst divideWithPrecision = (num, den, scale, precision) => {\n const numNegative = num < bigint0;\n const denNegative = den < bigint0;\n const negateResult = numNegative !== denNegative;\n num = numNegative ? -num : num;\n den = denNegative ? -den : den;\n // Shift digits until numerator is larger than denominator (set scale appropriately).\n while (num < den) {\n num *= bigint10;\n scale++;\n }\n // First division.\n let quotient = num / den;\n let remainder = num % den;\n if (remainder === bigint0) {\n // No remainder, return immediately.\n return make(negateResult ? -quotient : quotient, scale);\n }\n // The quotient is guaranteed to be non-negative at this point. No need to consider sign.\n let count = `${quotient}`.length;\n // Shift the remainder by 1 decimal; The quotient will be 1 digit upon next division.\n remainder *= bigint10;\n while (remainder !== bigint0 && count < precision) {\n const q = remainder / den;\n const r = remainder % den;\n quotient = quotient * bigint10 + q;\n remainder = r * bigint10;\n count++;\n scale++;\n }\n if (remainder !== bigint0) {\n // Round final number with remainder.\n quotient += roundTerminal(remainder / den);\n }\n return make(negateResult ? -quotient : quotient, scale);\n};\n/**\n * Internal function used for rounding.\n *\n * Returns 1 if the most significant digit is >= 5, otherwise 0.\n *\n * This is used after dividing a number by a power of ten and rounding the last digit.\n *\n * @internal\n */\nexport const roundTerminal = n => {\n const pos = n >= bigint0 ? 0 : 1;\n return Number(`${n}`[pos]) < 5 ? bigint0 : bigint1;\n};\n/**\n * Divides `BigDecimal`s safely.\n *\n * **When to use**\n *\n * Use to divide `BigDecimal` values while representing division by zero as\n * `Option.none`.\n *\n * **Details**\n *\n * If the dividend is not a multiple of the divisor, the result will be a `BigDecimal` value\n * with up to the default division precision. If the divisor is `0`, the result\n * will be `Option.none()`.\n *\n * **Example** (Dividing decimals safely)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal, Option } from \"effect\"\n *\n * const six = BigDecimal.fromBigInt(6n)\n *\n * BigDecimal.divide(six, BigDecimal.fromBigInt(3n)) // => Option.some(BigDecimal.fromBigInt(2n))\n * BigDecimal.divide(six, BigDecimal.fromBigInt(4n)) // => Option.some(BigDecimal.fromStringUnsafe(\"1.5\"))\n * BigDecimal.divide(six, BigDecimal.fromBigInt(0n)) // => Option.none()\n * ```\n *\n * @see {@link divideUnsafe} for division that throws when the divisor is zero\n * @see {@link remainder} for the decimal remainder operation\n *\n * @category math\n * @since 2.0.0\n */\nexport const divide = /*#__PURE__*/dual(2, (self, that) => {\n if (that.value === bigint0) {\n return Option.none();\n }\n if (self.value === bigint0) {\n return Option.some(zero);\n }\n const scale = self.scale - that.scale;\n if (self.value === that.value) {\n return Option.some(make(bigint1, scale));\n }\n return Option.some(divideWithPrecision(self.value, that.value, scale, DEFAULT_PRECISION));\n});\n/**\n * Provides an unsafe division operation on `BigDecimal`s.\n *\n * **When to use**\n *\n * Use when you need to divide `BigDecimal` values where the divisor is known\n * to be non-zero, so division by zero should be a thrown exception.\n *\n * **Details**\n *\n * If the dividend is not a multiple of the divisor, the result will be a `BigDecimal` value\n * with up to the default division precision.\n *\n * **Gotchas**\n *\n * Throws a `RangeError` if the divisor is `0`.\n *\n * **Example** (Dividing decimals unsafely)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.divideUnsafe(BigDecimal.fromStringUnsafe(\"6\"), BigDecimal.fromStringUnsafe(\"3\")) // => BigDecimal.fromBigInt(2n)\n * BigDecimal.divideUnsafe(BigDecimal.fromStringUnsafe(\"6\"), BigDecimal.fromStringUnsafe(\"4\")) // => BigDecimal.fromStringUnsafe(\"1.5\")\n * ```\n *\n * @see {@link divide} for division that returns `Option.none` when the divisor is zero\n *\n * @category math\n * @since 4.0.0\n */\nexport const divideUnsafe = /*#__PURE__*/dual(2, (self, that) => {\n if (that.value === bigint0) {\n throw new RangeError(\"Division by zero\");\n }\n if (self.value === bigint0) {\n return zero;\n }\n const scale = self.scale - that.scale;\n if (self.value === that.value) {\n return make(bigint1, scale);\n }\n return divideWithPrecision(self.value, that.value, scale, DEFAULT_PRECISION);\n});\nconst MAX_COMPARISON_SCALE_ALIGNMENT = 100;\nconst comparisonPowersOfTen = [bigint1];\nconst compareBigInt = (self, that) => self === that ? 0 : self < that ? -1 : 1;\nconst compareMagnitude = (self, that) => {\n const selfDigits = `${self.value < bigint0 ? -self.value : self.value}`;\n const thatDigits = `${that.value < bigint0 ? -that.value : that.value}`;\n const exponentDifference = BigInt(selfDigits.length - thatDigits.length) - BigInt(self.scale) + BigInt(that.scale);\n if (exponentDifference !== bigint0) return exponentDifference < bigint0 ? -1 : 1;\n const length = Math.max(selfDigits.length, thatDigits.length);\n for (let i = 0; i < length; i++) {\n const selfDigit = i < selfDigits.length ? selfDigits.charCodeAt(i) : 48;\n const thatDigit = i < thatDigits.length ? thatDigits.charCodeAt(i) : 48;\n if (selfDigit !== thatDigit) return selfDigit < thatDigit ? -1 : 1;\n }\n return 0;\n};\nconst compare = (self, that) => {\n if (self.scale === that.scale) return compareBigInt(self.value, that.value);\n const selfSign = sign(self);\n const thatSign = sign(that);\n if (selfSign !== thatSign) return selfSign < thatSign ? -1 : 1;\n if (selfSign === 0) return 0;\n const scaleDifference = self.scale - that.scale;\n const absoluteScaleDifference = Math.abs(scaleDifference);\n if (absoluteScaleDifference > MAX_COMPARISON_SCALE_ALIGNMENT) {\n return selfSign === -1 ? compareMagnitude(that, self) : compareMagnitude(self, that);\n }\n const powerOfTen = comparisonPowersOfTen[absoluteScaleDifference] ??= bigint10 ** BigInt(absoluteScaleDifference);\n return scaleDifference > 0 ? compareBigInt(self.value, that.value * powerOfTen) : compareBigInt(self.value * powerOfTen, that.value);\n};\n/**\n * Provides an `Order` instance for `BigDecimal` that allows comparing and sorting BigDecimal values.\n *\n * **When to use**\n *\n * Use when you need to sort or compare decimal values through APIs that accept\n * an ordering instance.\n *\n * **Example** (Comparing decimals)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const a = BigDecimal.fromNumberUnsafe(1.5)\n * const b = BigDecimal.fromNumberUnsafe(2.3)\n * const c = BigDecimal.fromNumberUnsafe(1.5)\n *\n * BigDecimal.Order(a, b) // => -1\n * BigDecimal.Order(b, a) // => 1\n * BigDecimal.Order(a, c) // => 0\n * ```\n *\n * @category instances\n * @since 2.0.0\n */\nexport const Order = /*#__PURE__*/order.make(compare);\n/**\n * Returns `true` if the first argument is less than the second, otherwise `false`.\n *\n * **When to use**\n *\n * Use to test whether one `BigDecimal` is strictly less than another.\n *\n * **Example** (Checking less-than comparisons)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const two = BigDecimal.fromStringUnsafe(\"2\")\n * const three = BigDecimal.fromStringUnsafe(\"3\")\n * const four = BigDecimal.fromStringUnsafe(\"4\")\n *\n * BigDecimal.isLessThan(two, three) // => true\n * BigDecimal.isLessThan(three, three) // => false\n * BigDecimal.isLessThan(four, three) // => false\n * ```\n *\n * @category predicates\n * @since 4.0.0\n */\nexport const isLessThan = /*#__PURE__*/order.isLessThan(Order);\n/**\n * Checks whether a given `BigDecimal` is less than or equal to the provided one.\n *\n * **When to use**\n *\n * Use to test whether one `BigDecimal` is less than or equal to another.\n *\n * **Example** (Checking less-than-or-equal comparisons)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const two = BigDecimal.fromStringUnsafe(\"2\")\n * const three = BigDecimal.fromStringUnsafe(\"3\")\n * const four = BigDecimal.fromStringUnsafe(\"4\")\n *\n * BigDecimal.isLessThanOrEqualTo(two, three) // => true\n * BigDecimal.isLessThanOrEqualTo(three, three) // => true\n * BigDecimal.isLessThanOrEqualTo(four, three) // => false\n * ```\n *\n * @category predicates\n * @since 4.0.0\n */\nexport const isLessThanOrEqualTo = /*#__PURE__*/order.isLessThanOrEqualTo(Order);\n/**\n * Returns `true` if the first argument is greater than the second, otherwise `false`.\n *\n * **When to use**\n *\n * Use to test whether one `BigDecimal` is strictly greater than another.\n *\n * **Example** (Checking greater-than comparisons)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const two = BigDecimal.fromStringUnsafe(\"2\")\n * const three = BigDecimal.fromStringUnsafe(\"3\")\n * const four = BigDecimal.fromStringUnsafe(\"4\")\n *\n * BigDecimal.isGreaterThan(two, three) // => false\n * BigDecimal.isGreaterThan(three, three) // => false\n * BigDecimal.isGreaterThan(four, three) // => true\n * ```\n *\n * @category predicates\n * @since 4.0.0\n */\nexport const isGreaterThan = /*#__PURE__*/order.isGreaterThan(Order);\n/**\n * Checks whether a given `BigDecimal` is greater than or equal to the provided one.\n *\n * **When to use**\n *\n * Use to test whether one `BigDecimal` is greater than or equal to another.\n *\n * **Example** (Checking greater-than-or-equal comparisons)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const two = BigDecimal.fromStringUnsafe(\"2\")\n * const three = BigDecimal.fromStringUnsafe(\"3\")\n * const four = BigDecimal.fromStringUnsafe(\"4\")\n *\n * BigDecimal.isGreaterThanOrEqualTo(two, three) // => false\n * BigDecimal.isGreaterThanOrEqualTo(three, three) // => true\n * BigDecimal.isGreaterThanOrEqualTo(four, three) // => true\n * ```\n *\n * @category predicates\n * @since 4.0.0\n */\nexport const isGreaterThanOrEqualTo = /*#__PURE__*/order.isGreaterThanOrEqualTo(Order);\n/**\n * Checks whether a `BigDecimal` is between a `minimum` and `maximum` value (inclusive).\n *\n * **When to use**\n *\n * Use to test whether a `BigDecimal` falls inside an inclusive range.\n *\n * **Example** (Checking decimal ranges)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const between = BigDecimal.between({\n * minimum: BigDecimal.fromStringUnsafe(\"1\"),\n * maximum: BigDecimal.fromStringUnsafe(\"5\")\n * })\n *\n * between(BigDecimal.fromStringUnsafe(\"3\")) // => true\n * between(BigDecimal.fromStringUnsafe(\"0\")) // => false\n * between(BigDecimal.fromStringUnsafe(\"6\")) // => false\n * ```\n *\n * @see {@link clamp} for forcing a `BigDecimal` into an inclusive range\n *\n * @category predicates\n * @since 2.0.0\n */\nexport const between = /*#__PURE__*/order.isBetween(Order);\n/**\n * Restricts the given `BigDecimal` to be within the range specified by the `minimum` and `maximum` values.\n *\n * **When to use**\n *\n * Use to force a `BigDecimal` into an inclusive range.\n *\n * **Details**\n *\n * If the `BigDecimal` is less than the `minimum` value, the function returns\n * the `minimum` value. If it is greater than the `maximum` value, the function\n * returns the `maximum` value. Otherwise, it returns the original `BigDecimal`.\n *\n * **Example** (Clamping decimals to a range)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const clamp = BigDecimal.clamp({\n * minimum: BigDecimal.fromStringUnsafe(\"1\"),\n * maximum: BigDecimal.fromStringUnsafe(\"5\")\n * })\n *\n * clamp(BigDecimal.fromStringUnsafe(\"3\")) // => BigDecimal.fromBigInt(3n)\n * clamp(BigDecimal.fromStringUnsafe(\"0\")) // => BigDecimal.fromBigInt(1n)\n * clamp(BigDecimal.fromStringUnsafe(\"6\")) // => BigDecimal.fromBigInt(5n)\n * ```\n *\n * @see {@link between} for checking whether a `BigDecimal` is already inside a range\n *\n * @category math\n * @since 2.0.0\n */\nexport const clamp = /*#__PURE__*/order.clamp(Order);\n/**\n * Returns the minimum between two `BigDecimal`s.\n *\n * **When to use**\n *\n * Use to select the smaller of two `BigDecimal` values.\n *\n * **Example** (Selecting the smaller decimal)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const result = BigDecimal.min(\n * BigDecimal.fromStringUnsafe(\"2\"),\n * BigDecimal.fromStringUnsafe(\"3\")\n * ) // => BigDecimal.fromBigInt(2n)\n * ```\n *\n * @see {@link max} for selecting the larger value\n *\n * @category math\n * @since 2.0.0\n */\nexport const min = /*#__PURE__*/order.min(Order);\n/**\n * Returns the maximum between two `BigDecimal`s.\n *\n * **When to use**\n *\n * Use to select the larger of two `BigDecimal` values.\n *\n * **Example** (Selecting the larger decimal)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const result = BigDecimal.max(\n * BigDecimal.fromStringUnsafe(\"2\"),\n * BigDecimal.fromStringUnsafe(\"3\")\n * ) // => BigDecimal.fromBigInt(3n)\n * ```\n *\n * @see {@link min} for selecting the smaller value\n *\n * @category math\n * @since 2.0.0\n */\nexport const max = /*#__PURE__*/order.max(Order);\n/**\n * Determines the sign of a given `BigDecimal`.\n *\n * **When to use**\n *\n * Use to classify a `BigDecimal` as negative, zero, or positive.\n *\n * **Example** (Reading decimal signs)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.sign(BigDecimal.fromStringUnsafe(\"-5\")) // => -1\n * BigDecimal.sign(BigDecimal.fromStringUnsafe(\"0\")) // => 0\n * BigDecimal.sign(BigDecimal.fromStringUnsafe(\"5\")) // => 1\n * ```\n *\n * @category math\n * @since 2.0.0\n */\nexport const sign = n => n.value === bigint0 ? 0 : n.value < bigint0 ? -1 : 1;\n/**\n * Determines the absolute value of a given `BigDecimal`.\n *\n * **When to use**\n *\n * Use to remove the sign from a `BigDecimal` while preserving its magnitude.\n *\n * **Example** (Calculating absolute values)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.abs(BigDecimal.fromStringUnsafe(\"-5\")) // => BigDecimal.fromBigInt(5n)\n * BigDecimal.abs(BigDecimal.fromStringUnsafe(\"0\")) // => BigDecimal.fromBigInt(0n)\n * BigDecimal.abs(BigDecimal.fromStringUnsafe(\"5\")) // => BigDecimal.fromBigInt(5n)\n * ```\n *\n * @category math\n * @since 2.0.0\n */\nexport const abs = n => n.value < bigint0 ? make(-n.value, n.scale) : n;\n/**\n * Provides a negate operation on `BigDecimal`s.\n *\n * **When to use**\n *\n * Use to flip the sign of a `BigDecimal`.\n *\n * **Example** (Negating decimals)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.negate(BigDecimal.fromStringUnsafe(\"3\")) // => BigDecimal.fromBigInt(-3n)\n * BigDecimal.negate(BigDecimal.fromStringUnsafe(\"-6\")) // => BigDecimal.fromBigInt(6n)\n * ```\n *\n * @category math\n * @since 2.0.0\n */\nexport const negate = n => make(-n.value, n.scale);\n/**\n * Computes the decimal remainder safely when one operand is divided by a second\n * operand.\n *\n * **When to use**\n *\n * Use to compute a decimal remainder while representing division by zero as\n * `Option.none`.\n *\n * **Details**\n *\n * If the divisor is `0`, the result will be `Option.none()`.\n *\n * **Example** (Computing remainders safely)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal, Option } from \"effect\"\n *\n * const two = BigDecimal.fromStringUnsafe(\"2\")\n * const three = BigDecimal.fromStringUnsafe(\"3\")\n * const zero = BigDecimal.fromStringUnsafe(\"0\")\n *\n * BigDecimal.remainder(three, two) // => Option.some(BigDecimal.fromBigInt(1n))\n * BigDecimal.remainder(two, zero) // => Option.none()\n * ```\n *\n * @see {@link remainderUnsafe} for remainder calculation that throws when the divisor is zero\n * @see {@link divide} for decimal quotient calculation\n *\n * @category math\n * @since 2.0.0\n */\nexport const remainder = /*#__PURE__*/dual(2, (self, divisor) => {\n if (divisor.value === bigint0) {\n return Option.none();\n }\n const max = Math.max(self.scale, divisor.scale);\n return Option.some(make(scale(self, max).value % scale(divisor, max).value, max));\n});\n/**\n * Returns the decimal remainder left over when one operand is divided by a\n * non-zero second operand.\n *\n * **When to use**\n *\n * Use when you need to compute a `BigDecimal` remainder with a divisor known to\n * be non-zero and want a plain `BigDecimal` result instead of an `Option`.\n *\n * **Gotchas**\n *\n * Throws a `RangeError` if the divisor is `0`.\n *\n * **Example** (Computing remainders unsafely)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.remainderUnsafe(\n * BigDecimal.fromStringUnsafe(\"3\"),\n * BigDecimal.fromStringUnsafe(\"2\")\n * ) // => BigDecimal.fromBigInt(1n)\n * ```\n *\n * @see {@link remainder} for returning `Option.none` when the divisor is zero\n *\n * @category math\n * @since 4.0.0\n */\nexport const remainderUnsafe = /*#__PURE__*/dual(2, (self, divisor) => {\n if (divisor.value === bigint0) {\n throw new RangeError(\"Division by zero\");\n }\n const max = Math.max(self.scale, divisor.scale);\n return make(scale(self, max).value % scale(divisor, max).value, max);\n});\n/**\n * Provides an `Equivalence` instance for `BigDecimal` that determines equality between BigDecimal values.\n *\n * **When to use**\n *\n * Use when comparing decimal values through APIs that accept an equivalence\n * relation.\n *\n * **Example** (Checking decimal equivalence)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const a = BigDecimal.fromStringUnsafe(\"1.50\")\n * const b = BigDecimal.fromStringUnsafe(\"1.5\")\n * const c = BigDecimal.fromStringUnsafe(\"2.0\")\n *\n * BigDecimal.Equivalence(a, b) // => true\n * BigDecimal.Equivalence(a, c) // => false\n * ```\n *\n * @category instances\n * @since 2.0.0\n */\nexport const Equivalence = /*#__PURE__*/Equ.make((self, that) => compare(self, that) === 0);\n/**\n * Checks whether two `BigDecimal`s are equal.\n *\n * **When to use**\n *\n * Use to compare two `BigDecimal` values for numeric equality.\n *\n * **Example** (Checking decimal equality)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const a = BigDecimal.fromStringUnsafe(\"1.5\")\n * const b = BigDecimal.fromStringUnsafe(\"1.50\")\n * const c = BigDecimal.fromStringUnsafe(\"2.0\")\n *\n * BigDecimal.equals(a, b) // => true\n * BigDecimal.equals(a, c) // => false\n * ```\n *\n * @see {@link Equivalence} for passing decimal equality to APIs that require an `Equivalence`\n *\n * @category predicates\n * @since 2.0.0\n */\nexport const equals = /*#__PURE__*/dual(2, (self, that) => Equivalence(self, that));\n/**\n * Creates a `BigDecimal` from a `bigint` value.\n *\n * **When to use**\n *\n * Use to construct an integer `BigDecimal` from a `bigint`.\n *\n * **Example** (Creating decimals from bigint)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const decimal = BigDecimal.fromBigInt(123n)\n * decimal // => BigDecimal.fromStringUnsafe(\"123\")\n *\n * const largeBigInt = BigDecimal.fromBigInt(9007199254740991n)\n * largeBigInt // => BigDecimal.fromStringUnsafe(\"9007199254740991\")\n * ```\n *\n * @see {@link make} for constructing a decimal with an explicit scale\n *\n * @category constructors\n * @since 2.0.0\n */\nexport const fromBigInt = n => make(n, 0);\n/**\n * Creates a `BigDecimal` from a finite `number`.\n *\n * **When to use**\n *\n * Use when you need to convert a trusted finite JavaScript number to a\n * `BigDecimal` and want a plain result instead of an `Option`.\n *\n * **Gotchas**\n *\n * It is not recommended to convert a floating point number to a decimal\n * directly, as the floating point representation may be unexpected. Throws a\n * `RangeError` if the number is not finite (`NaN`, `+Infinity` or `-Infinity`).\n *\n * **Example** (Creating decimals from finite numbers)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.fromNumberUnsafe(123) // => BigDecimal.fromBigInt(123n)\n * BigDecimal.fromNumberUnsafe(123.456) // => BigDecimal.fromStringUnsafe(\"123.456\")\n * ```\n *\n * @see {@link fromNumber} for returning `Option.none` when the number is not finite\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromNumberUnsafe = n => {\n return Option.getOrThrowWith(fromNumber(n), () => new RangeError(`Number must be finite, got ${n}`));\n};\n/**\n * Creates a `BigDecimal` safely from a finite `number`.\n *\n * **When to use**\n *\n * Use to convert a finite JavaScript number to a `BigDecimal` without throwing\n * on invalid input.\n *\n * **Details**\n *\n * Returns `Option.none()` for `NaN`, `+Infinity` or `-Infinity`.\n *\n * **Gotchas**\n *\n * It is not recommended to convert a floating point number to a decimal\n * directly, as the floating point representation may be unexpected.\n *\n * **Example** (Creating decimals from numbers safely)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal, Option } from \"effect\"\n *\n * BigDecimal.fromNumber(123.456) // => Option.some(BigDecimal.fromStringUnsafe(\"123.456\"))\n * BigDecimal.fromNumber(Infinity) // => Option.none()\n * ```\n *\n * @see {@link fromNumberUnsafe} for throwing when the number is not finite\n * @see {@link fromString} for parsing decimal strings directly\n *\n * @category constructors\n * @since 2.0.0\n */\nexport const fromNumber = n => {\n if (!Number.isFinite(n)) {\n return Option.none();\n }\n const string = `${n}`;\n if (string.includes(\"e\")) {\n return fromString(string);\n }\n const [lead, trail = \"\"] = string.split(\".\");\n return Option.some(make(BigInt(`${lead}${trail}`), trail.length));\n};\n/**\n * Parses a decimal string into a `BigDecimal` safely.\n *\n * **When to use**\n *\n * Use to parse external decimal text without throwing on invalid input.\n *\n * **Details**\n *\n * Returns `Option.some` for valid decimal or exponent notation and\n * `Option.none` when the string cannot be parsed or would produce an unsafe\n * scale. The empty string parses as zero.\n *\n * **Example** (Parsing decimal strings safely)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal, Option } from \"effect\"\n *\n * BigDecimal.fromString(\"123.456\") // => Option.some(BigDecimal.make(123456n, 3))\n * BigDecimal.fromString(\"123.abc\") // => Option.none()\n * ```\n *\n * @see {@link fromStringUnsafe} for parsing that throws on invalid input\n * @see {@link fromNumber} for converting finite JavaScript numbers\n *\n * @category constructors\n * @since 2.0.0\n */\nexport const fromString = s => {\n if (s === \"\") {\n return Option.some(zero);\n }\n let base;\n let exp;\n const seperator = s.search(/[eE]/);\n if (seperator !== -1) {\n const trail = s.slice(seperator + 1);\n base = s.slice(0, seperator);\n exp = Number(trail);\n if (base === \"\" || !Number.isSafeInteger(exp) || !FINITE_INT_REGEXP.test(trail)) {\n return Option.none();\n }\n } else {\n base = s;\n exp = 0;\n }\n let digits;\n let offset;\n const dot = base.search(/\\./);\n if (dot !== -1) {\n const lead = base.slice(0, dot);\n const trail = base.slice(dot + 1);\n digits = `${lead}${trail}`;\n offset = trail.length;\n } else {\n digits = base;\n offset = 0;\n }\n if (!FINITE_INT_REGEXP.test(digits)) {\n return Option.none();\n }\n const scale = offset - exp;\n if (!Number.isSafeInteger(scale)) {\n return Option.none();\n }\n return Option.some(make(BigInt(digits), scale));\n};\n/**\n * Parses a decimal string into a `BigDecimal`, throwing if the string is\n * invalid.\n *\n * **When to use**\n *\n * Use when you expect decimal text to be valid and want parse errors to throw.\n *\n * **Details**\n *\n * Accepts the same syntax as `fromString`. Use `fromString` when invalid input\n * should be represented as `Option.none` instead of throwing.\n *\n * **Example** (Parsing decimal strings unsafely)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.fromStringUnsafe(\"123\") // => BigDecimal.fromBigInt(123n)\n * BigDecimal.fromStringUnsafe(\"123.456\") // => BigDecimal.make(123456n, 3)\n * ```\n *\n * @see {@link fromString} for returning `Option.none` on invalid input\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromStringUnsafe = s => {\n return Option.getOrThrowWith(fromString(s), () => new Error(`Invalid numerical string: ${s}`));\n};\n/**\n * Formats a `BigDecimal` as a string.\n *\n * **When to use**\n *\n * Use to render a `BigDecimal` as plain decimal text when possible.\n *\n * **Details**\n *\n * The value is normalized before formatting. Scientific notation is used when\n * the absolute value of the normalized scale is at least `16`; otherwise plain\n * decimal notation is used.\n *\n * **Example** (Formatting decimals)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.format(BigDecimal.fromStringUnsafe(\"-5\")) // => \"-5\"\n * BigDecimal.format(BigDecimal.fromStringUnsafe(\"123.456\")) // => \"123.456\"\n * BigDecimal.format(BigDecimal.fromStringUnsafe(\"-0.00000123\")) // => \"-0.00000123\"\n * ```\n *\n * @see {@link toExponential} for always rendering scientific notation\n *\n * @category converting\n * @since 2.0.0\n */\nexport const format = n => {\n const normalized = normalize(n);\n if (Math.abs(normalized.scale) >= 16) {\n return toExponential(normalized);\n }\n const negative = normalized.value < bigint0;\n const absolute = negative ? `${normalized.value}`.substring(1) : `${normalized.value}`;\n let before;\n let after;\n if (normalized.scale >= absolute.length) {\n before = \"0\";\n after = \"0\".repeat(normalized.scale - absolute.length) + absolute;\n } else {\n const location = absolute.length - normalized.scale;\n if (location > absolute.length) {\n const zeros = location - absolute.length;\n before = `${absolute}${\"0\".repeat(zeros)}`;\n after = \"\";\n } else {\n after = absolute.slice(location);\n before = absolute.slice(0, location);\n }\n }\n const complete = after === \"\" ? before : `${before}.${after}`;\n return negative ? `-${complete}` : complete;\n};\n/**\n * Formats a given `BigDecimal` as a `string` in scientific notation.\n *\n * **When to use**\n *\n * Use to render a `BigDecimal` in scientific notation.\n *\n * **Example** (Formatting decimals exponentially)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.toExponential(BigDecimal.make(123456n, -5)) // => \"1.23456e+10\"\n * ```\n *\n * @see {@link format} for plain decimal formatting when possible\n *\n * @category converting\n * @since 3.11.0\n */\nexport const toExponential = n => {\n if (isZero(n)) {\n return \"0e+0\";\n }\n const normalized = normalize(n);\n const digits = `${abs(normalized).value}`;\n const head = digits.slice(0, 1);\n const tail = digits.slice(1);\n let output = `${isNegative(normalized) ? \"-\" : \"\"}${head}`;\n if (tail !== \"\") {\n output += `.${tail}`;\n }\n const exp = tail.length - normalized.scale;\n return `${output}e${exp >= 0 ? \"+\" : \"\"}${exp}`;\n};\n/**\n * Converts a `BigDecimal` to a JavaScript `number`.\n *\n * **When to use**\n *\n * Use when you need a JavaScript number at an interop boundary where precision\n * loss is acceptable.\n *\n * **Gotchas**\n *\n * This conversion is unsafe because the result can lose integer or fractional\n * precision, round to a nearby representable value, or become `Infinity` when\n * the decimal cannot be represented as a finite JavaScript `number`.\n *\n * **Example** (Converting decimals to numbers)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.toNumberUnsafe(BigDecimal.fromStringUnsafe(\"123.456\")) // => 123.456\n * ```\n *\n * @see {@link format} for preserving decimal precision as text\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toNumberUnsafe = n => Number(format(n));\n/**\n * Checks whether a given `BigDecimal` is an integer.\n *\n * **When to use**\n *\n * Use to test whether a `BigDecimal` has no fractional decimal part.\n *\n * **Example** (Checking integer decimals)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.isInteger(BigDecimal.fromStringUnsafe(\"0\")) // => true\n * BigDecimal.isInteger(BigDecimal.fromStringUnsafe(\"1\")) // => true\n * BigDecimal.isInteger(BigDecimal.fromStringUnsafe(\"1.1\")) // => false\n * ```\n *\n * @category predicates\n * @since 2.0.0\n */\nexport const isInteger = n => normalize(n).scale <= 0;\n/**\n * Checks whether a given `BigDecimal` is `0`.\n *\n * **When to use**\n *\n * Use to test whether a `BigDecimal` is exactly zero.\n *\n * **Example** (Checking zero decimals)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.isZero(BigDecimal.fromStringUnsafe(\"0\")) // => true\n * BigDecimal.isZero(BigDecimal.fromStringUnsafe(\"1\")) // => false\n * ```\n *\n * @category predicates\n * @since 2.0.0\n */\nexport const isZero = n => n.value === bigint0;\n/**\n * Checks whether a given `BigDecimal` is negative.\n *\n * **When to use**\n *\n * Use to test whether a `BigDecimal` is less than zero.\n *\n * **Example** (Checking negative decimals)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.isNegative(BigDecimal.fromStringUnsafe(\"-1\")) // => true\n * BigDecimal.isNegative(BigDecimal.fromStringUnsafe(\"0\")) // => false\n * BigDecimal.isNegative(BigDecimal.fromStringUnsafe(\"1\")) // => false\n * ```\n *\n * @category predicates\n * @since 2.0.0\n */\nexport const isNegative = n => n.value < bigint0;\n/**\n * Checks whether a given `BigDecimal` is positive.\n *\n * **When to use**\n *\n * Use to test whether a `BigDecimal` is greater than zero.\n *\n * **Example** (Checking positive decimals)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.isPositive(BigDecimal.fromStringUnsafe(\"-1\")) // => false\n * BigDecimal.isPositive(BigDecimal.fromStringUnsafe(\"0\")) // => false\n * BigDecimal.isPositive(BigDecimal.fromStringUnsafe(\"1\")) // => true\n * ```\n *\n * @category predicates\n * @since 2.0.0\n */\nexport const isPositive = n => n.value > bigint0;\nconst isBigDecimalArgs = args => isBigDecimal(args[0]);\n/**\n * Computes a rounded `BigDecimal` at the given scale with the specified rounding mode.\n *\n * **When to use**\n *\n * Use to round a decimal at a requested scale with an explicit rounding mode.\n *\n * **Example** (Rounding decimals)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * const positive = BigDecimal.round(BigDecimal.fromStringUnsafe(\"145\"), { mode: \"from-zero\", scale: -1 })\n * positive // => BigDecimal.fromBigInt(150n)\n *\n * const negative = BigDecimal.round(BigDecimal.fromStringUnsafe(\"-14.5\"))\n * negative // => BigDecimal.fromBigInt(-15n)\n * ```\n *\n * @see {@link ceil} for fixed rounding toward positive infinity\n * @see {@link floor} for fixed rounding toward negative infinity\n * @see {@link truncate} for fixed rounding toward zero\n *\n * @category math\n * @since 3.16.0\n */\nexport const round = /*#__PURE__*/dual(isBigDecimalArgs, (self, options) => {\n const mode = options?.mode ?? \"half-from-zero\";\n const scale = options?.scale ?? 0;\n switch (mode) {\n case \"ceil\":\n return ceil(self, scale);\n case \"floor\":\n return floor(self, scale);\n case \"to-zero\":\n return truncate(self, scale);\n case \"from-zero\":\n return isPositive(self) ? ceil(self, scale) : floor(self, scale);\n case \"half-ceil\":\n return floor(sum(self, make(bigint5, scale + 1)), scale);\n case \"half-floor\":\n return ceil(sum(self, make(bigint_5, scale + 1)), scale);\n case \"half-to-zero\":\n return isNegative(self) ? floor(sum(self, make(bigint5, scale + 1)), scale) : ceil(sum(self, make(bigint_5, scale + 1)), scale);\n case \"half-from-zero\":\n return isNegative(self) ? ceil(sum(self, make(bigint_5, scale + 1)), scale) : floor(sum(self, make(bigint5, scale + 1)), scale);\n }\n const halfCeil = floor(sum(self, make(bigint5, scale + 1)), scale);\n const halfFloor = ceil(sum(self, make(bigint_5, scale + 1)), scale);\n const digit = digitAt(halfCeil, scale);\n switch (mode) {\n case \"half-even\":\n return equals(halfCeil, halfFloor) ? halfCeil : digit % bigint2 === bigint0 ? halfCeil : halfFloor;\n case \"half-odd\":\n return equals(halfCeil, halfFloor) ? halfCeil : digit % bigint2 === bigint0 ? halfFloor : halfCeil;\n }\n});\n/**\n * Computes a truncated `BigDecimal` at the given scale. This removes fractional digits beyond the scale,\n * rounding toward zero.\n *\n * **When to use**\n *\n * Use when you need to discard fractional digits beyond a scale rather than\n * round half up, half down, or toward an infinity.\n *\n * **Example** (Truncating decimals)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.truncate(BigDecimal.fromStringUnsafe(\"145\"), -1) // => BigDecimal.fromBigInt(140n)\n * BigDecimal.truncate(BigDecimal.fromStringUnsafe(\"-14.5\")) // => BigDecimal.fromBigInt(-14n)\n * ```\n *\n * @see {@link round} for configurable rounding modes\n * @see {@link ceil} for rounding toward positive infinity\n * @see {@link floor} for rounding toward negative infinity\n *\n * @category math\n * @since 3.16.0\n */\nexport const truncate = /*#__PURE__*/dual(isBigDecimalArgs, (self, scale = 0) => {\n if (self.scale <= scale) {\n return self;\n }\n // BigInt division truncates towards zero\n return make(self.value / bigint10 ** BigInt(self.scale - scale), scale);\n});\n/**\n * Computes the ceiling of a `BigDecimal` at the given scale.\n *\n * **When to use**\n *\n * Use to round a decimal toward positive infinity at a requested scale.\n *\n * **Details**\n *\n * The default scale is `0`. Positive scales keep digits to the right of the\n * decimal point, and negative scales round positions to the left of the decimal\n * point.\n *\n * @see {@link floor} for rounding toward negative infinity\n * @see {@link truncate} for rounding toward zero\n * @see {@link round} for configurable rounding modes\n *\n * **Example** (Rounding decimals up)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.ceil(BigDecimal.fromStringUnsafe(\"145\"), -1) // => BigDecimal.fromBigInt(150n)\n * BigDecimal.ceil(BigDecimal.fromStringUnsafe(\"-14.5\")) // => BigDecimal.fromBigInt(-14n)\n * ```\n *\n * @category math\n * @since 3.16.0\n */\nexport const ceil = /*#__PURE__*/dual(isBigDecimalArgs, (self, scale = 0) => {\n const truncated = truncate(self, scale);\n if (isPositive(self) && isLessThan(truncated, self)) {\n return sum(truncated, make(bigint1, scale));\n }\n return truncated;\n});\n/**\n * Internal function used by `round` for `half-even` and `half-odd` rounding modes.\n *\n * Returns the digit at the position of the given `scale` within the `BigDecimal`.\n *\n * @internal\n */\nexport const digitAt = /*#__PURE__*/dual(2, (self, scale) => {\n if (self.scale < scale) {\n return bigint0;\n }\n const scaled = self.value / bigint10 ** BigInt(self.scale - scale);\n return scaled % bigint10;\n});\n/**\n * Computes the floor of a `BigDecimal` at the given scale.\n *\n * **When to use**\n *\n * Use to round a decimal toward negative infinity at a requested scale.\n *\n * **Example** (Rounding decimals down)\n *\n * ```ts import.meta.vitest\n * import { BigDecimal } from \"effect\"\n *\n * BigDecimal.floor(BigDecimal.fromStringUnsafe(\"145\"), -1) // => BigDecimal.fromBigInt(140n)\n * BigDecimal.floor(BigDecimal.fromStringUnsafe(\"-14.5\")) // => BigDecimal.fromBigInt(-15n)\n * ```\n *\n * @see {@link ceil} for rounding toward positive infinity\n * @see {@link truncate} for rounding toward zero\n * @see {@link round} for configurable rounding modes\n *\n * @category math\n * @since 3.16.0\n */\nexport const floor = /*#__PURE__*/dual(isBigDecimalArgs, (self, scale = 0) => {\n const truncated = truncate(self, scale);\n if (isNegative(self) && isGreaterThan(truncated, self)) {\n return sum(truncated, make(bigint_1, scale));\n }\n return truncated;\n});\n//# sourceMappingURL=BigDecimal.js.map","import * as Context from \"./Context.js\";\nimport * as Effect from \"./Effect.js\";\nimport { dual, flow } from \"./Function.js\";\nimport * as Internal from \"./internal/dateTime.js\";\nimport { provideService } from \"./internal/effect.js\";\nimport * as Layer from \"./Layer.js\";\nconst TypeId = Internal.TypeId;\nconst TimeZoneTypeId = Internal.TimeZoneTypeId;\n// =============================================================================\n// guards\n// =============================================================================\n/**\n * Checks whether a value is a `DateTime`.\n *\n * **When to use**\n *\n * Use to narrow an unknown value before treating it as a `DateTime`.\n *\n * @see {@link isUtc} for narrowing a known `DateTime` to UTC\n * @see {@link isZoned} for narrowing a known `DateTime` to zoned\n *\n * @category guards\n * @since 3.6.0\n */\nexport const isDateTime = Internal.isDateTime;\n/**\n * Checks whether a value is a `TimeZone`.\n *\n * **When to use**\n *\n * Use to narrow unknown input to any `TimeZone` before passing it to APIs that\n * accept either fixed-offset or named time zones.\n *\n * @see {@link isTimeZoneOffset} for narrowing to fixed-offset time zones\n * @see {@link isTimeZoneNamed} for narrowing to named time zones\n *\n * @category guards\n * @since 3.6.0\n */\nexport const isTimeZone = Internal.isTimeZone;\n/**\n * Checks whether a value is an offset-based `TimeZone`.\n *\n * **When to use**\n *\n * Use when you need to narrow an unknown or union `TimeZone` value to the\n * fixed-offset variant before reading its offset in milliseconds.\n *\n * @see {@link isTimeZone} for checking either time zone variant\n * @see {@link isTimeZoneNamed} for narrowing to named time zones\n *\n * @category guards\n * @since 3.6.0\n */\nexport const isTimeZoneOffset = Internal.isTimeZoneOffset;\n/**\n * Checks whether a value is a named `TimeZone` (IANA time zone).\n *\n * **When to use**\n *\n * Use to narrow an unknown value to the `TimeZone.Named` variant before\n * reading named-zone fields such as `id`.\n *\n * @see {@link isTimeZone} for checking either time zone variant\n * @see {@link isTimeZoneOffset} for narrowing to fixed-offset time zones\n *\n * @category guards\n * @since 3.6.0\n */\nexport const isTimeZoneNamed = Internal.isTimeZoneNamed;\n/**\n * Checks whether a `DateTime` is a UTC `DateTime` (no time zone information).\n *\n * **When to use**\n *\n * Use to narrow a `DateTime` before passing it to code that requires a UTC\n * value without an associated time zone.\n *\n * @see {@link isZoned} for narrowing to zoned date-times\n * @see {@link match} for handling both UTC and zoned cases\n *\n * @category guards\n * @since 3.6.0\n */\nexport const isUtc = Internal.isUtc;\n/**\n * Checks whether a `DateTime` is a zoned `DateTime` (has time zone information).\n *\n * **When to use**\n *\n * Use to narrow a known `DateTime` before reading its zone or passing it to\n * APIs that require `DateTime.Zoned`.\n *\n * @see {@link isUtc} for narrowing to UTC date-times\n * @see {@link match} for handling both UTC and zoned cases\n *\n * @category guards\n * @since 3.6.0\n */\nexport const isZoned = Internal.isZoned;\n// =============================================================================\n// instances\n// =============================================================================\n/**\n * Provides an `Equivalence` for comparing two `DateTime` values for equality.\n *\n * **Details**\n *\n * Two `DateTime` values are considered equivalent if they represent the same\n * point in time, regardless of their time zone.\n *\n * **Example** (Comparing DateTime values for equivalence)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const utc = DateTime.makeUnsafe(\"2024-01-01T12:00:00Z\")\n * const zoned = DateTime.makeZonedUnsafe(\"2024-01-01T12:00:00Z\", {\n * timeZone: \"Europe/London\"\n * })\n *\n * DateTime.Equivalence(utc, zoned) // => true\n * ```\n *\n * @category instances\n * @since 3.6.0\n */\nexport const Equivalence = Internal.Equivalence;\n/**\n * Provides an `Order` for comparing and sorting `DateTime` values.\n *\n * **Details**\n *\n * `DateTime` values are ordered by their epoch milliseconds, so earlier times\n * come before later times regardless of time zone.\n *\n * **Example** (Sorting DateTime values chronologically)\n *\n * ```ts import.meta.vitest\n * import { Array, DateTime } from \"effect\"\n *\n * const dates = [\n * DateTime.makeUnsafe(\"2024-03-01\"),\n * DateTime.makeUnsafe(\"2024-01-01\"),\n * DateTime.makeUnsafe(\"2024-02-01\")\n * ]\n *\n * Array.sort(dates, DateTime.Order).map(DateTime.formatIsoDateUtc) // => [\"2024-01-01\", \"2024-02-01\", \"2024-03-01\"]\n * ```\n *\n * @category instances\n * @since 3.6.0\n */\nexport const Order = Internal.Order;\n/**\n * Returns a `DateTime` constrained between a minimum and maximum value.\n *\n * **Details**\n *\n * If the `DateTime` is before the minimum, the minimum is returned.\n * If the `DateTime` is after the maximum, the maximum is returned.\n * Otherwise, the original `DateTime` is returned.\n *\n * **Example** (Clamping DateTime values)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const min = DateTime.makeUnsafe(\"2024-01-01\")\n * const max = DateTime.makeUnsafe(\"2024-12-31\")\n * const date = DateTime.makeUnsafe(\"2025-06-15\")\n *\n * DateTime.clamp(date, { minimum: min, maximum: max }) // => DateTime.makeUnsafe(\"2024-12-31\")\n * ```\n *\n * @category ordering\n * @since 3.6.0\n */\nexport const clamp = Internal.clamp;\n// =============================================================================\n// constructors\n// =============================================================================\n/**\n * Create a `DateTime` from a `Date`.\n *\n * **Details**\n *\n * If the `Date` is invalid, an `IllegalArgumentError` will be thrown.\n *\n * **Example** (Creating DateTime values from Dates)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * DateTime.fromDateUnsafe(new Date(\"2024-01-01T12:00:00Z\")) // => DateTime.makeUnsafe(\"2024-01-01T12:00:00Z\")\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromDateUnsafe = Internal.fromDateUnsafe;\n/**\n * Create a `DateTime` from supported input values.\n *\n * **When to use**\n *\n * Use when creating a `DateTime` from trusted input and construction failures\n * should throw an `IllegalArgumentError` instead of returning `Option.none`.\n *\n * **Details**\n *\n * - A `DateTime`\n * - A `Date` instance (invalid dates will throw an `IllegalArgumentError`)\n * - The `number` of milliseconds since the Unix epoch\n * - An object with the parts of a date\n * - A `string` that can be parsed by `Date.parse`\n *\n * **Example** (Creating DateTime values unsafely)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * // from Date\n * DateTime.makeUnsafe(new Date(\"2024-01-01T12:00:00Z\")) // => DateTime.makeUnsafe(\"2024-01-01T12:00:00Z\")\n *\n * // from parts\n * DateTime.makeUnsafe({ year: 2024 }) // => DateTime.makeUnsafe(\"2024-01-01T00:00:00Z\")\n *\n * // from string\n * DateTime.makeUnsafe(\"2024-01-01\") // => DateTime.makeUnsafe(\"2024-01-01T00:00:00Z\")\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeUnsafe = Internal.makeUnsafe;\n/**\n * Creates a `DateTime.Utc` from the number of seconds since the Unix epoch.\n *\n * **Example** (Creating from epoch seconds)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * DateTime.fromEpochSeconds(1704067200).toJSON() // => \"2024-01-01T00:00:00.000Z\"\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromEpochSeconds = Internal.fromEpochSeconds;\n/**\n * Create a `DateTime.Zoned` using `DateTime.makeUnsafe` and a time zone.\n *\n * **When to use**\n *\n * Use when the date/time input and zone options are trusted and invalid or\n * rejected ambiguous times should throw instead of returning `Option.none`.\n *\n * **Details**\n *\n * The input is treated as UTC and then the time zone is attached, unless\n * `adjustForTimeZone` is set to `true`. In that case, the input is treated as\n * already in the time zone.\n *\n * When `adjustForTimeZone` is true and ambiguous times occur during DST transitions,\n * the `disambiguation` option controls how to resolve the ambiguity:\n * - `compatible` (default): Choose earlier time for repeated times, later for gaps\n * - `earlier`: Always choose the earlier of two possible times\n * - `later`: Always choose the later of two possible times\n * - `reject`: Throw an error when ambiguous times are encountered\n *\n * **Example** (Creating zoned DateTime values unsafely)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const zoned = DateTime.makeZonedUnsafe(\"2024-06-15T14:30:00Z\", {\n * timeZone: \"Europe/London\"\n * })\n *\n * DateTime.formatIsoZoned(zoned) // => \"2024-06-15T15:30:00.000+01:00[Europe/London]\"\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeZonedUnsafe = Internal.makeZonedUnsafe;\n/**\n * Creates a `DateTime.Zoned` safely from an input and a time zone.\n *\n * **Details**\n *\n * By default, the input is interpreted as a UTC instant and the time zone is\n * attached without changing that instant. When `adjustForTimeZone` is `true`,\n * the input is interpreted as wall-clock time in the target zone.\n *\n * When `adjustForTimeZone` is `true`, `disambiguation` controls\n * daylight-saving gaps and repeated times:\n *\n * - `\"compatible\"` (default): chooses the earlier occurrence for repeated\n * times and the later interpretation for gaps\n * - `\"earlier\"`: chooses the earlier possible instant\n * - `\"later\"`: chooses the later possible instant\n * - `\"reject\"`: rejects ambiguous or nonexistent wall-clock times\n *\n * Returns `Some` when construction succeeds, or `None` when the input, time\n * zone, or disambiguation cannot be resolved.\n *\n * **Example** (Creating optional zoned DateTime values)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Option } from \"effect\"\n *\n * const result = DateTime.makeZoned(\"2024-06-15T14:30:00Z\", {\n * timeZone: \"Europe/London\"\n * })\n *\n * result.pipe(Option.map(DateTime.formatIsoZoned)) // => Option.some(\"2024-06-15T15:30:00.000+01:00[Europe/London]\")\n * ```\n *\n * @category constructors\n * @since 3.6.0\n */\nexport const makeZoned = Internal.makeZoned;\n/**\n * Creates a `DateTime` safely from supported input values.\n *\n * **Details**\n *\n * - A `DateTime`\n * - A JavaScript `Date`\n * - The number of milliseconds since the Unix epoch\n * - An object with date and time parts\n * - A string that can be parsed as a date\n *\n * Returns `Some` with the constructed `DateTime` when the input is valid, or\n * `None` when construction would fail, including invalid `Date` instances or\n * unparseable strings.\n *\n * **Example** (Creating optional DateTime values)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Option } from \"effect\"\n *\n * // from Date\n * DateTime.make(new Date(\"2024-01-01T12:00:00Z\")) // => Option.some(DateTime.makeUnsafe(\"2024-01-01T12:00:00Z\"))\n *\n * // from parts\n * DateTime.make({ year: 2024 }) // => Option.some(DateTime.makeUnsafe(\"2024-01-01T00:00:00Z\"))\n *\n * // from string\n * DateTime.make(\"2024-01-01\") // => Option.some(DateTime.makeUnsafe(\"2024-01-01T00:00:00Z\"))\n *\n * DateTime.make(\"not a date\") // => Option.none()\n * ```\n *\n * @category constructors\n * @since 3.6.0\n */\nexport const make = Internal.make;\n/**\n * Parses an ISO zoned date-time string into a `DateTime.Zoned` safely.\n *\n * **Details**\n *\n * Accepts named-zone strings such as\n * `YYYY-MM-DDTHH:mm:ss.sss+HH:MM[Time/Zone]` and offset-only strings such as\n * `YYYY-MM-DDTHH:mm:ss.sss+HH:MM`. Returns `None` when the input cannot be\n * parsed.\n *\n * **Example** (Parsing zoned DateTime strings)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Option } from \"effect\"\n *\n * DateTime.makeZonedFromString(\n * \"2024-01-01T12:00:00+02:00[Europe/Berlin]\"\n * ).pipe(Option.map(DateTime.formatIsoZoned)) // => Option.some(\"2024-01-01T11:00:00.000+01:00[Europe/Berlin]\")\n *\n * DateTime.makeZonedFromString(\"2024-01-01T12:00:00Z\") // => Option.none()\n * DateTime.makeZonedFromString(\"invalid\") // => Option.none()\n * ```\n *\n * @category constructors\n * @since 3.6.0\n */\nexport const makeZonedFromString = Internal.makeZonedFromString;\n/**\n * Gets the current time using the `Clock` service and converts it to a `DateTime`.\n *\n * **Example** (Getting the current DateTime)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n * import { TestClock } from \"effect/testing\"\n *\n * await Effect.runPromise(Effect.map(DateTime.now, DateTime.isDateTime)) // => true\n * ```\n *\n * @category constructors\n * @since 3.6.0\n */\nexport const now = Internal.now;\n/**\n * Gets the current time from the `Clock` service and returns it as a\n * JavaScript `Date`.\n *\n * **Example** (Getting the current Date)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n * import { TestClock } from \"effect/testing\"\n *\n * await Effect.runPromise(Effect.map(DateTime.nowAsDate, (now) => now instanceof Date)) // => true\n * ```\n *\n * @category constructors\n * @since 3.14.0\n */\nexport const nowAsDate = Internal.nowAsDate;\n/**\n * Gets the current time using `Date.now`.\n *\n * **When to use**\n *\n * Use when synchronous wall-clock access outside an Effect program is\n * acceptable and testability through the `Clock` service is not needed.\n *\n * **Details**\n *\n * This is a synchronous version of `now` that directly uses `Date.now()`\n * instead of the Effect `Clock` service.\n *\n * **Example** (Getting the current DateTime unsafely)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * Number.isFinite(DateTime.toEpochMillis(DateTime.nowUnsafe())) // => true\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const nowUnsafe = Internal.nowUnsafe;\n// =============================================================================\n// time zones\n// =============================================================================\n/**\n * Converts a `DateTime` to a UTC `DateTime`.\n *\n * **When to use**\n *\n * Use to represent the same instant in UTC instead of its current time zone.\n *\n * **Details**\n *\n * The returned value keeps the same epoch milliseconds and changes only the\n * `DateTime` representation to UTC.\n *\n * **Example** (Converting DateTime values to UTC)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const now = DateTime.makeZonedUnsafe({ year: 2024 }, {\n * timeZone: \"Europe/London\"\n * })\n *\n * // set as UTC\n * const utc: DateTime.Utc = DateTime.toUtc(now)\n * utc // => DateTime.makeUnsafe(\"2024-01-01T00:00:00Z\")\n * ```\n *\n * @category converting\n * @since 3.13.0\n */\nexport const toUtc = Internal.toUtc;\n/**\n * Sets the time zone of a `DateTime`, returning a new `DateTime.Zoned`.\n *\n * **Example** (Setting time zones)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const zone = DateTime.zoneMakeNamedUnsafe(\"Europe/London\")\n * const zoned: DateTime.Zoned = DateTime.setZone(DateTime.makeUnsafe(\"2024-01-01\"), zone)\n *\n * DateTime.isZoned(zoned) // => true\n * ```\n *\n * @category transforming\n * @since 3.6.0\n */\nexport const setZone = Internal.setZone;\n/**\n * Adds a fixed offset time zone to a `DateTime`.\n *\n * **Details**\n *\n * The offset is in milliseconds.\n *\n * **Example** (Setting fixed-offset time zones)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dateTime = DateTime.makeUnsafe(\"2024-01-01\")\n * const zoned: DateTime.Zoned = DateTime.setZoneOffset(dateTime, 3 * 60 * 60 * 1000)\n *\n * DateTime.zoneToString(zoned.zone) // => \"+03:00\"\n * ```\n *\n * @category transforming\n * @since 3.6.0\n */\nexport const setZoneOffset = Internal.setZoneOffset;\n/**\n * Attempts to create a named time zone from an IANA time zone identifier.\n *\n * **When to use**\n *\n * Use when the IANA zone id is trusted and invalid zones should throw instead\n * of returning `Option.none` or failing in `Effect`.\n *\n * **Details**\n *\n * If the time zone is invalid, an `IllegalArgumentError` will be thrown.\n *\n * **Example** (Creating named time zones unsafely)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * DateTime.zoneToString(DateTime.zoneMakeNamedUnsafe(\"Europe/London\")) // => \"Europe/London\"\n * DateTime.zoneToString(DateTime.zoneMakeNamedUnsafe(\"Asia/Tokyo\")) // => \"Asia/Tokyo\"\n *\n * // This would throw an IllegalArgumentError:\n * // DateTime.zoneMakeNamedUnsafe(\"Invalid/Zone\")\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const zoneMakeNamedUnsafe = Internal.zoneMakeNamedUnsafe;\n/**\n * Create a fixed offset time zone.\n *\n * **Details**\n *\n * The offset is specified in milliseconds from UTC. Positive values are\n * ahead of UTC, negative values are behind UTC.\n *\n * **Example** (Creating fixed-offset time zones)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * // Create a time zone with +3 hours offset\n * const zone = DateTime.zoneMakeOffset(3 * 60 * 60 * 1000)\n *\n * const dt = DateTime.makeZonedUnsafe(\"2024-01-01T12:00:00Z\", {\n * timeZone: zone\n * })\n * DateTime.formatIsoZoned(dt) // => \"2024-01-01T15:00:00.000+03:00\"\n * ```\n *\n * @category constructors\n * @since 3.6.0\n */\nexport const zoneMakeOffset = Internal.zoneMakeOffset;\n/**\n * Creates a named time zone safely from an IANA time zone identifier.\n *\n * **Details**\n *\n * If the time zone is invalid, `None` will be returned.\n *\n * **Example** (Creating optional named time zones)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Option } from \"effect\"\n *\n * DateTime.zoneMakeNamed(\"Europe/London\").pipe(Option.map(DateTime.zoneToString)) // => Option.some(\"Europe/London\")\n * DateTime.zoneMakeNamed(\"Invalid/Zone\") // => Option.none()\n * ```\n *\n * @category constructors\n * @since 3.6.0\n */\nexport const zoneMakeNamed = Internal.zoneMakeNamed;\n/**\n * Creates a named time zone effectfully from an IANA time zone identifier.\n *\n * **When to use**\n *\n * Use when invalid IANA zone ids should fail in the Effect error channel\n * instead of returning `Option.none` or throwing.\n *\n * **Example** (Creating named time zones effectfully)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const zone = yield* DateTime.zoneMakeNamedEffect(\"Europe/London\")\n * const now = yield* DateTime.now\n * return DateTime.setZone(now, zone)\n * })\n *\n * DateTime.zoneToString((await Effect.runPromise(program)).zone) // => \"Europe/London\"\n * ```\n *\n * @category constructors\n * @since 3.6.0\n */\nexport const zoneMakeNamedEffect = Internal.zoneMakeNamedEffect;\n/**\n * Create a named time zone from the system's local time zone.\n *\n * **Details**\n *\n * This uses the system's configured time zone, which may vary depending\n * on the runtime environment.\n *\n * **Example** (Creating local time zones)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * DateTime.isTimeZoneNamed(DateTime.zoneMakeLocal()) // => true\n * ```\n *\n * @category constructors\n * @since 3.6.0\n */\nexport const zoneMakeLocal = Internal.zoneMakeLocal;\n/**\n * Tries to parse a `TimeZone` from a string safely.\n *\n * **Details**\n *\n * Supports both IANA time zone identifiers and offset formats like \"+03:00\".\n *\n * **Example** (Parsing time zones)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Option } from \"effect\"\n *\n * DateTime.zoneFromString(\"Europe/London\").pipe(Option.map(DateTime.zoneToString)) // => Option.some(\"Europe/London\")\n * DateTime.zoneFromString(\"+03:00\").pipe(Option.map(DateTime.zoneToString)) // => Option.some(\"+03:00\")\n * DateTime.zoneFromString(\"invalid\") // => Option.none()\n * ```\n *\n * @category decoding\n * @since 3.6.0\n */\nexport const zoneFromString = Internal.zoneFromString;\n/**\n * Formats a `TimeZone` as a string.\n *\n * **Example** (Formatting time zones)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * DateTime.zoneToString(DateTime.zoneMakeOffset(3 * 60 * 60 * 1000)) // => \"+03:00\"\n * DateTime.zoneToString(DateTime.zoneMakeNamedUnsafe(\"Europe/London\")) // => \"Europe/London\"\n * ```\n *\n * @category encoding\n * @since 3.6.0\n */\nexport const zoneToString = Internal.zoneToString;\n/**\n * Sets the time zone of a `DateTime` safely from an IANA time zone identifier. If the\n * time zone is invalid, `None` will be returned.\n *\n * **Example** (Setting named time zones safely)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Option } from \"effect\"\n *\n * const dateTime = DateTime.makeUnsafe(\"2024-01-01\")\n * const result = DateTime.setZoneNamed(dateTime, \"Europe/London\").pipe(Option.map(DateTime.formatIsoZoned))\n *\n * result // => Option.some(\"2024-01-01T00:00:00.000+00:00[Europe/London]\")\n * ```\n *\n * @category transforming\n * @since 3.6.0\n */\nexport const setZoneNamed = Internal.setZoneNamed;\n/**\n * Sets the time zone of a `DateTime` from an IANA time zone identifier. If the\n * time zone is invalid, an `IllegalArgumentError` will be thrown.\n *\n * **Example** (Setting named time zones unsafely)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dateTime = DateTime.makeUnsafe(\"2024-01-01\")\n * const zoned = DateTime.setZoneNamedUnsafe(dateTime, \"Europe/London\")\n *\n * DateTime.zoneToString(zoned.zone) // => \"Europe/London\"\n * ```\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const setZoneNamedUnsafe = Internal.setZoneNamedUnsafe;\n// =============================================================================\n// comparisons\n// =============================================================================\n/**\n * Computes the difference between two `DateTime` values, returning a\n * `Duration` representing the amount of time between them.\n *\n * **Details**\n *\n * If `other` is *after* `self`, the result will be a positive `Duration`. If\n * `other` is *before* `self`, the result will be a negative `Duration`. If they\n * are equal, the result will be a `Duration` of zero.\n *\n * **Example** (Measuring distance between DateTime values)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Duration } from \"effect\"\n *\n * const start = DateTime.makeUnsafe(\"2024-01-01T00:00:00Z\")\n * const end = DateTime.add(start, { minutes: 1 })\n *\n * DateTime.distance(start, end) // => Duration.minutes(1)\n * ```\n *\n * @category comparisons\n * @since 3.6.0\n */\nexport const distance = Internal.distance;\n/**\n * Returns the earlier of two `DateTime` values.\n *\n * **Example** (Selecting the earlier DateTime)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const date1 = DateTime.makeUnsafe(\"2024-01-01\")\n * const date2 = DateTime.makeUnsafe(\"2024-02-01\")\n *\n * DateTime.min(date1, date2) // => DateTime.makeUnsafe(\"2024-01-01\")\n * ```\n *\n * @category comparisons\n * @since 3.6.0\n */\nexport const min = Internal.min;\n/**\n * Returns the later of two `DateTime` values.\n *\n * **Example** (Selecting the later DateTime)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const date1 = DateTime.makeUnsafe(\"2024-01-01\")\n * const date2 = DateTime.makeUnsafe(\"2024-02-01\")\n *\n * DateTime.max(date1, date2) // => DateTime.makeUnsafe(\"2024-02-01\")\n * ```\n *\n * @category comparisons\n * @since 3.6.0\n */\nexport const max = Internal.max;\n/**\n * Checks whether the first `DateTime` is after the second `DateTime`.\n *\n * **Example** (Checking whether a DateTime is later)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const date1 = DateTime.makeUnsafe(\"2024-02-01\")\n * const date2 = DateTime.makeUnsafe(\"2024-01-01\")\n *\n * DateTime.isGreaterThan(date1, date2) // => true\n * DateTime.isGreaterThan(date2, date1) // => false\n * ```\n *\n * @category comparisons\n * @since 4.0.0\n */\nexport const isGreaterThan = Internal.isGreaterThan;\n/**\n * Checks whether the first `DateTime` is after or equal to the second `DateTime`.\n *\n * **Example** (Checking whether a DateTime is later or equal)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const date1 = DateTime.makeUnsafe(\"2024-01-01\")\n * const date2 = DateTime.makeUnsafe(\"2024-01-01\")\n * const date3 = DateTime.makeUnsafe(\"2024-02-01\")\n *\n * DateTime.isGreaterThanOrEqualTo(date1, date2) // => true\n * DateTime.isGreaterThanOrEqualTo(date3, date1) // => true\n * DateTime.isGreaterThanOrEqualTo(date1, date3) // => false\n * ```\n *\n * @category comparisons\n * @since 4.0.0\n */\nexport const isGreaterThanOrEqualTo = Internal.isGreaterThanOrEqualTo;\n/**\n * Checks whether the first `DateTime` is before the second `DateTime`.\n *\n * **Example** (Checking whether a DateTime is earlier)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const date1 = DateTime.makeUnsafe(\"2024-01-01\")\n * const date2 = DateTime.makeUnsafe(\"2024-02-01\")\n *\n * DateTime.isLessThan(date1, date2) // => true\n * DateTime.isLessThan(date2, date1) // => false\n * ```\n *\n * @category comparisons\n * @since 4.0.0\n */\nexport const isLessThan = Internal.isLessThan;\n/**\n * Checks whether the first `DateTime` is before or equal to the second `DateTime`.\n *\n * **Example** (Checking whether a DateTime is earlier or equal)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const date1 = DateTime.makeUnsafe(\"2024-01-01\")\n * const date2 = DateTime.makeUnsafe(\"2024-01-01\")\n * const date3 = DateTime.makeUnsafe(\"2024-02-01\")\n *\n * DateTime.isLessThanOrEqualTo(date1, date2) // => true\n * DateTime.isLessThanOrEqualTo(date1, date3) // => true\n * DateTime.isLessThanOrEqualTo(date3, date1) // => false\n * ```\n *\n * @category comparisons\n * @since 4.0.0\n */\nexport const isLessThanOrEqualTo = Internal.isLessThanOrEqualTo;\n/**\n * Checks whether a `DateTime` is between two other `DateTime` values (inclusive).\n *\n * **Example** (Checking whether a DateTime is within bounds)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const min = DateTime.makeUnsafe(\"2024-01-01\")\n * const max = DateTime.makeUnsafe(\"2024-12-31\")\n * const date = DateTime.makeUnsafe(\"2024-06-15\")\n *\n * DateTime.between(date, { minimum: min, maximum: max }) // => true\n * ```\n *\n * @category comparisons\n * @since 3.6.0\n */\nexport const between = Internal.between;\n/**\n * Checks effectfully if a `DateTime` is in the future compared to the current time.\n *\n * **Details**\n *\n * This is an effectful operation that uses the current time from the `Clock` service.\n *\n * **Example** (Checking future DateTime values effectfully)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n * import { TestClock } from \"effect/testing\"\n *\n * const futureDate = DateTime.makeUnsafe(1)\n * await Effect.runPromise(Effect.provide(DateTime.isFuture(futureDate), TestClock.layer())) // => true\n * ```\n *\n * @category comparisons\n * @since 3.6.0\n */\nexport const isFuture = Internal.isFuture;\n/**\n * Checks synchronously if a `DateTime` is in the future compared to the current time.\n *\n * **When to use**\n *\n * Use when checking whether a `DateTime` is in the future with a synchronous\n * live-clock read and `Clock`-based testability is not needed.\n *\n * **Details**\n *\n * This is a synchronous version that uses `Date.now()` directly.\n *\n * **Example** (Checking future DateTime values unsafely)\n *\n * ```ts\n * import { DateTime } from \"effect\"\n *\n * const oneHourFromNow = DateTime.add(DateTime.nowUnsafe(), { hours: 1 })\n * DateTime.isFutureUnsafe(oneHourFromNow)\n * ```\n *\n * @category comparisons\n * @since 4.0.0\n */\nexport const isFutureUnsafe = Internal.isFutureUnsafe;\n/**\n * Checks effectfully if a `DateTime` is in the past compared to the current time.\n *\n * **Details**\n *\n * This is an effectful operation that uses the current time from the `Clock` service.\n *\n * **Example** (Checking past DateTime values effectfully)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n * import { TestClock } from \"effect/testing\"\n *\n * const pastDate = DateTime.makeUnsafe(-1)\n * await Effect.runPromise(Effect.provide(DateTime.isPast(pastDate), TestClock.layer())) // => true\n * ```\n *\n * @category comparisons\n * @since 3.6.0\n */\nexport const isPast = Internal.isPast;\n/**\n * Checks synchronously if a `DateTime` is in the past compared to the current time.\n *\n * **When to use**\n *\n * Use when checking whether a `DateTime` is in the past with a synchronous\n * live-clock read and `Clock`-based testability is not needed.\n *\n * **Details**\n *\n * This is a synchronous version that uses `Date.now()` directly.\n *\n * **Example** (Checking past DateTime values unsafely)\n *\n * ```ts\n * import { DateTime } from \"effect\"\n *\n * const oneHourAgo = DateTime.subtract(DateTime.nowUnsafe(), { hours: 1 })\n * DateTime.isPastUnsafe(oneHourAgo)\n * ```\n *\n * @category comparisons\n * @since 4.0.0\n */\nexport const isPastUnsafe = Internal.isPastUnsafe;\n// =============================================================================\n// conversions\n// =============================================================================\n/**\n * Gets the UTC `Date` of a `DateTime`.\n *\n * **Details**\n *\n * This always returns the UTC representation, ignoring any time zone information.\n *\n * **Example** (Converting DateTime values to UTC Dates)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dt = DateTime.makeZonedUnsafe(\"2024-01-01T12:00:00Z\", {\n * timeZone: \"Europe/London\"\n * })\n *\n * DateTime.toDateUtc(dt).toISOString() // => \"2024-01-01T12:00:00.000Z\"\n * ```\n *\n * @category converting\n * @since 3.6.0\n */\nexport const toDateUtc = Internal.toDateUtc;\n/**\n * Converts a `DateTime` to a `Date`, applying the time zone first.\n *\n * **Details**\n *\n * For `DateTime.Zoned`, this adjusts for the time zone before converting.\n * For `DateTime.Utc`, this is equivalent to `toDateUtc`.\n *\n * **Example** (Converting DateTime values to Dates)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const utc = DateTime.makeUnsafe(\"2024-01-01T12:00:00Z\")\n * const zoned = DateTime.makeZonedUnsafe(\"2024-01-01T12:00:00Z\", {\n * timeZone: \"Europe/London\"\n * })\n *\n * DateTime.toDate(utc).toISOString() // => \"2024-01-01T12:00:00.000Z\"\n * DateTime.toDate(zoned).toISOString() // => \"2024-01-01T12:00:00.000Z\"\n * ```\n *\n * @category converting\n * @since 3.6.0\n */\nexport const toDate = Internal.toDate;\n/**\n * Computes the time zone offset of a `DateTime.Zoned` in milliseconds.\n *\n * **Details**\n *\n * Returns the offset from UTC in milliseconds. Positive values indicate\n * time zones ahead of UTC, negative values indicate time zones behind UTC.\n *\n * **Example** (Reading zoned offsets)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const zoned = DateTime.makeZonedUnsafe(\"2024-01-01T12:00:00Z\", {\n * timeZone: \"Europe/London\"\n * })\n *\n * DateTime.zonedOffset(zoned) // => 0\n * ```\n *\n * @category converting\n * @since 3.6.0\n */\nexport const zonedOffset = Internal.zonedOffset;\n/**\n * Formats the time zone offset of a `DateTime.Zoned` as an ISO string.\n *\n * **Details**\n *\n * The offset is formatted as \"±HH:MM\".\n *\n * **Example** (Formatting zoned offsets)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const zoned = DateTime.makeZonedUnsafe(\"2024-01-01T12:00:00Z\", {\n * timeZone: DateTime.zoneMakeOffset(3 * 60 * 60 * 1000) // +3 hours\n * })\n *\n * DateTime.zonedOffsetIso(zoned) // => \"+03:00\"\n * ```\n *\n * @category converting\n * @since 3.6.0\n */\nexport const zonedOffsetIso = Internal.zonedOffsetIso;\n/**\n * Gets the milliseconds since the Unix epoch of a `DateTime`.\n *\n * **Details**\n *\n * This returns the UTC timestamp regardless of any time zone information.\n *\n * **Example** (Reading epoch milliseconds)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dt = DateTime.makeUnsafe(\"2024-01-01T00:00:00Z\")\n * DateTime.toEpochMillis(dt) // => 1704067200000\n * ```\n *\n * @category converting\n * @since 3.6.0\n */\nexport const toEpochMillis = Internal.toEpochMillis;\n/**\n * Converts a `DateTime` to the number of seconds since the Unix epoch.\n *\n * **Details**\n *\n * This returns the UTC timestamp regardless of any time zone information.\n * The result is floored to the nearest second.\n *\n * **Example** (Reading epoch seconds)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dt = DateTime.makeUnsafe(\"2024-01-01T00:00:00Z\")\n * DateTime.toEpochSeconds(dt) // => 1704067200\n * ```\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toEpochSeconds = Internal.toEpochSeconds;\n/**\n * Removes the time aspect of a `DateTime`, first adjusting for the time\n * zone. It will return a `DateTime.Utc` only containing the date.\n *\n * **Example** (Removing time components)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * // returns \"2024-01-01T00:00:00Z\"\n * DateTime.makeZonedUnsafe(\"2024-01-01T05:00:00Z\", {\n * timeZone: \"Pacific/Auckland\",\n * adjustForTimeZone: true\n * }).pipe(\n * DateTime.removeTime,\n * DateTime.formatIso\n * ) // => \"2024-01-01T00:00:00.000Z\"\n * ```\n *\n * @category converting\n * @since 3.6.0\n */\nexport const removeTime = Internal.removeTime;\n// =============================================================================\n// parts\n// =============================================================================\n/**\n * Gets the time-zone-adjusted parts of a `DateTime` as an object.\n *\n * **Details**\n *\n * The parts will be time zone adjusted if the `DateTime` is zoned.\n *\n * **Example** (Reading DateTime parts)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dt = DateTime.makeUnsafe(\"2024-01-01T12:30:45.123Z\")\n * const parts = DateTime.toParts(dt)\n *\n * const selectedParts = [parts.year, parts.month, parts.day, parts.hour] // => [2024, 1, 1, 12]\n * ```\n *\n * @category getters\n * @since 3.6.0\n */\nexport const toParts = Internal.toParts;\n/**\n * Gets the UTC parts of a `DateTime` as an object.\n *\n * **Details**\n *\n * The parts will always be in UTC, ignoring any time zone information.\n *\n * **Example** (Reading UTC DateTime parts)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const zoned = DateTime.makeZonedUnsafe(\"2024-01-01T12:30:45.123Z\", {\n * timeZone: \"Europe/London\"\n * })\n * const parts = DateTime.toPartsUtc(zoned)\n *\n * const selectedParts = [parts.year, parts.month, parts.day, parts.hour] // => [2024, 1, 1, 12]\n * ```\n *\n * @category getters\n * @since 3.6.0\n */\nexport const toPartsUtc = Internal.toPartsUtc;\n/**\n * Gets one UTC part of a `DateTime` as a number.\n *\n * **Details**\n *\n * The part will be in the UTC time zone.\n *\n * **Example** (Reading UTC DateTime parts by key)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dateTime = DateTime.makeUnsafe({ year: 2024 })\n * DateTime.getPartUtc(dateTime, \"year\") // => 2024\n * ```\n *\n * @category getters\n * @since 3.6.0\n */\nexport const getPartUtc = Internal.getPartUtc;\n/**\n * Gets one time-zone-adjusted part of a `DateTime` as a number.\n *\n * **Details**\n *\n * The part will be time zone adjusted.\n *\n * **Example** (Reading DateTime parts by key)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dateTime = DateTime.makeZonedUnsafe({ year: 2024 }, {\n * timeZone: \"Europe/London\"\n * })\n * DateTime.getPart(dateTime, \"year\") // => 2024\n * ```\n *\n * @category getters\n * @since 3.6.0\n */\nexport const getPart = Internal.getPart;\n/**\n * Sets time-zone-adjusted parts on a `DateTime`.\n *\n * **Details**\n *\n * The date will be time zone adjusted for `DateTime.Zoned`.\n *\n * **Example** (Updating DateTime parts)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dt = DateTime.makeZonedUnsafe(\"2024-01-01T12:00:00Z\", { timeZone: \"UTC\" })\n * const updated = DateTime.setParts(dt, {\n * year: 2025,\n * month: 6,\n * day: 15\n * })\n *\n * updated // => DateTime.makeZonedUnsafe(\"2025-06-15T12:00:00Z\", { timeZone: \"UTC\" })\n * ```\n *\n * @category transforming\n * @since 3.6.0\n */\nexport const setParts = Internal.setParts;\n/**\n * Sets UTC parts on a `DateTime`.\n *\n * **Details**\n *\n * The parts are always interpreted as UTC, ignoring any time zone information.\n *\n * **Example** (Updating UTC DateTime parts)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dt = DateTime.makeUnsafe(\"2024-01-01T12:00:00Z\")\n * const updated = DateTime.setPartsUtc(dt, {\n * year: 2025,\n * hour: 18\n * })\n *\n * updated // => DateTime.makeUnsafe(\"2025-01-01T18:00:00Z\")\n * ```\n *\n * @category transforming\n * @since 3.6.0\n */\nexport const setPartsUtc = Internal.setPartsUtc;\n// =============================================================================\n// current time zone\n// =============================================================================\n/**\n * Context service that supplies the ambient `TimeZone` for APIs that work in\n * the current zone, such as `DateTime.setZoneCurrent` and\n * `DateTime.nowInCurrentZone`.\n *\n * **Details**\n *\n * Provide it with `DateTime.withCurrentZone`, one of the `withCurrentZone*`\n * helpers, or one of the `layerCurrentZone*` layers.\n *\n * **Example** (Accessing the current time zone service)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * return DateTime.zoneToString(yield* DateTime.CurrentTimeZone)\n * })\n *\n * // Provide a time zone\n * const layer = DateTime.layerCurrentZoneNamed(\"Europe/London\")\n * await Effect.runPromise(Effect.provide(program, layer)) // => \"Europe/London\"\n * ```\n *\n * @category services\n * @since 3.11.0\n */\nexport class CurrentTimeZone extends /*#__PURE__*/Context.Service()(\"effect/DateTime/CurrentTimeZone\") {}\n/**\n * Sets the time zone of a `DateTime` to the current time zone, which is\n * determined by the `CurrentTimeZone` service.\n *\n * **Example** (Setting the current time zone)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n *\n * await Effect.runPromise(Effect.gen(function*() {\n * const zoned = yield* DateTime.setZoneCurrent(DateTime.makeUnsafe(\"2024-01-01\"))\n * return DateTime.zoneToString(zoned.zone)\n * }).pipe(DateTime.withCurrentZoneNamed(\"Europe/London\"))) // => \"Europe/London\"\n * ```\n *\n * @category accessors\n * @since 3.6.0\n */\nexport const setZoneCurrent = self => Effect.map(CurrentTimeZone, zone => setZone(self, zone));\n/**\n * Provides the `CurrentTimeZone` to an effect.\n *\n * **Example** (Providing the current time zone)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n *\n * const zone = DateTime.zoneMakeNamedUnsafe(\"Europe/London\")\n *\n * await Effect.runPromise(Effect.gen(function*() {\n * const zoned = yield* DateTime.setZoneCurrent(DateTime.makeUnsafe(\"2024-01-01\"))\n * return DateTime.zoneToString(zoned.zone)\n * }).pipe(DateTime.withCurrentZone(zone))) // => \"Europe/London\"\n * ```\n *\n * @category providing services\n * @since 3.6.0\n */\nexport const withCurrentZone = /*#__PURE__*/provideService(CurrentTimeZone);\n/**\n * Provides the `CurrentTimeZone` to an effect, using the system's local time\n * zone.\n *\n * **Example** (Providing the local time zone)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n *\n * await Effect.runPromise(Effect.gen(function*() {\n * return DateTime.isZoned(yield* DateTime.nowInCurrentZone)\n * }).pipe(DateTime.withCurrentZoneLocal)) // => true\n * ```\n *\n * @category providing services\n * @since 3.6.0\n */\nexport const withCurrentZoneLocal = effect => Effect.provideServiceEffect(effect, CurrentTimeZone, Effect.sync(zoneMakeLocal));\n/**\n * Provides the `CurrentTimeZone` to an effect, using an offset.\n *\n * **Example** (Providing a fixed-offset time zone)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * return DateTime.zoneToString(yield* DateTime.CurrentTimeZone)\n * }).pipe(DateTime.withCurrentZoneOffset(3 * 60 * 60 * 1000))\n *\n * await Effect.runPromise(program) // => \"+03:00\"\n * ```\n *\n * @category providing services\n * @since 3.6.0\n */\nexport const withCurrentZoneOffset = /*#__PURE__*/dual(2, (effect, offset) => Effect.provideService(effect, CurrentTimeZone, zoneMakeOffset(offset)));\n/**\n * Provides the `CurrentTimeZone` to an effect using an IANA time zone\n * identifier.\n *\n * **Details**\n *\n * If the time zone is invalid, it will fail with an `IllegalArgumentError`.\n *\n * **Example** (Providing a named time zone)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n *\n * await Effect.runPromise(Effect.gen(function*() {\n * const zoned = yield* DateTime.setZoneCurrent(DateTime.makeUnsafe(\"2024-01-01\"))\n * return DateTime.zoneToString(zoned.zone)\n * }).pipe(DateTime.withCurrentZoneNamed(\"Europe/London\"))) // => \"Europe/London\"\n * ```\n *\n * @category providing services\n * @since 3.6.0\n */\nexport const withCurrentZoneNamed = /*#__PURE__*/dual(2, (effect, zone) => Effect.provideServiceEffect(effect, CurrentTimeZone, zoneMakeNamedEffect(zone)));\n/**\n * Gets the current time as a `DateTime.Zoned`, using the `CurrentTimeZone`.\n *\n * **Example** (Getting the current time in the current zone)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n *\n * await Effect.runPromise(Effect.gen(function*() {\n * return DateTime.zoneToString((yield* DateTime.nowInCurrentZone).zone)\n * }).pipe(DateTime.withCurrentZoneNamed(\"Europe/London\"))) // => \"Europe/London\"\n * ```\n *\n * @category accessors\n * @since 3.6.0\n */\nexport const nowInCurrentZone = /*#__PURE__*/Effect.flatMap(now, setZoneCurrent);\n// =============================================================================\n// mapping\n// =============================================================================\n/**\n * Modifies a `DateTime` with a mutable local `Date` copy.\n *\n * **When to use**\n *\n * Use to adjust calendar fields in the `DateTime`'s own time zone with an\n * existing `Date` mutation API.\n *\n * **Details**\n *\n * The `Date` will first have the time zone applied if possible, and then be\n * converted back to a `DateTime` within the same time zone.\n *\n * Supports `disambiguation` when the new wall clock time is ambiguous.\n *\n * **Example** (Mutating DateTime values with Dates)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dt = DateTime.makeUnsafe(\"2024-01-01T12:00:00Z\")\n *\n * DateTime.mutate(dt, (date) => {\n * date.setHours(15) // Set to 3 PM\n * date.setMinutes(30) // Set to 30 minutes\n * })\n * ```\n *\n * @category mapping\n * @since 3.6.0\n */\nexport const mutate = Internal.mutate;\n/**\n * Modifies a `DateTime` with a mutable UTC `Date` copy.\n *\n * **When to use**\n *\n * Use to adjust the instant with an existing `Date` mutation API that works on\n * UTC calendar fields.\n *\n * **Example** (Mutating DateTime values with UTC Dates)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dt = DateTime.makeZonedUnsafe(\"2024-01-01T12:00:00Z\", {\n * timeZone: \"Europe/London\"\n * })\n *\n * const modified = DateTime.mutateUtc(dt, (date) => {\n * date.setUTCHours(18) // Set UTC time to 6 PM\n * })\n *\n * modified // => DateTime.makeZonedUnsafe(\"2024-01-01T18:00:00Z\", { timeZone: \"Europe/London\" })\n * ```\n *\n * @category mapping\n * @since 3.6.0\n */\nexport const mutateUtc = Internal.mutateUtc;\n/**\n * Transforms a `DateTime` by applying a function to the number of milliseconds\n * since the Unix epoch.\n *\n * **Example** (Mapping epoch milliseconds)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * // add 10 milliseconds\n * const result = DateTime.makeUnsafe(0).pipe(\n * DateTime.mapEpochMillis((millis) => millis + 10)\n * )\n * result // => DateTime.makeUnsafe(10)\n * ```\n *\n * @category mapping\n * @since 3.6.0\n */\nexport const mapEpochMillis = Internal.mapEpochMillis;\n/**\n * Applies a function to a JavaScript `Date` representing the `DateTime` and\n * returns the function's result.\n *\n * **Details**\n *\n * The callback receives the time-zone-adjusted wall-clock date for\n * `DateTime.Zoned` values. Use `DateTime.withDateUtc` when the callback should\n * receive the UTC instant.\n *\n * **Example** (Applying time zone adjusted Dates)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * // get the time zone adjusted date in milliseconds\n * DateTime.makeZonedUnsafe(0, { timeZone: \"Europe/London\" }).pipe(\n * DateTime.withDate((date) => date.getTime())\n * ) // => 3600000\n * ```\n *\n * @category mapping\n * @since 3.6.0\n */\nexport const withDate = Internal.withDate;\n/**\n * Applies a function to a JavaScript `Date` representing the `DateTime`'s UTC\n * instant and returns the function's result.\n *\n * **Details**\n *\n * This ignores any associated time zone. Use `DateTime.withDate` when the\n * callback should receive the time-zone-adjusted wall-clock date.\n *\n * **Example** (Applying UTC Dates)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * // get the date in milliseconds\n * DateTime.makeUnsafe(0).pipe(\n * DateTime.withDateUtc((date) => date.getTime())\n * ) // => 0\n * ```\n *\n * @category mapping\n * @since 3.6.0\n */\nexport const withDateUtc = Internal.withDateUtc;\n/**\n * Pattern match on a `DateTime` to handle `Utc` and `Zoned` cases differently.\n *\n * **Example** (Pattern matching DateTime variants)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dt1 = DateTime.makeUnsafe(\"2024-01-01T12:00:00Z\") // Utc\n * const dt2 = DateTime.makeZonedUnsafe(\"2024-06-15T14:30:00Z\", {\n * timeZone: \"Europe/London\"\n * }) // Zoned\n *\n * const result1 = DateTime.match(dt1, {\n * onUtc: (utc) => `UTC: ${DateTime.formatIso(utc)}`,\n * onZoned: (zoned) => `Zoned: ${DateTime.formatIsoZoned(zoned)}`\n * })\n *\n * const result2 = DateTime.match(dt2, {\n * onUtc: (utc) => `UTC: ${DateTime.formatIso(utc)}`,\n * onZoned: (zoned) => `Zoned: ${DateTime.formatIsoZoned(zoned)}`\n * })\n *\n * result1 // => \"UTC: 2024-01-01T12:00:00.000Z\"\n * result2 // => \"Zoned: 2024-06-15T15:30:00.000+01:00[Europe/London]\"\n * ```\n *\n * @category mapping\n * @since 3.6.0\n */\nexport const match = Internal.match;\n// =============================================================================\n// math\n// =============================================================================\n/**\n * Adds the given `Duration` to a `DateTime`.\n *\n * **When to use**\n *\n * Use to move a `DateTime` by an elapsed duration such as minutes, seconds, or\n * milliseconds.\n *\n * **Details**\n *\n * The duration is converted to milliseconds and added to the epoch\n * milliseconds. Zoned values keep their original time zone.\n *\n * **Gotchas**\n *\n * This is elapsed-time arithmetic, not calendar-aware local date arithmetic.\n * Use `add` when adding days, weeks, months, or years should account for the\n * date/time zone rules.\n *\n * **Example** (Adding durations)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * // add 5 minutes\n * DateTime.makeUnsafe(0).pipe(\n * DateTime.addDuration(\"5 minutes\")\n * ) // => DateTime.makeUnsafe(300000)\n * ```\n *\n * @see {@link add} for calendar-aware date/time part arithmetic\n * @see {@link subtractDuration} for subtracting an elapsed duration\n *\n * @category math\n * @since 3.6.0\n */\nexport const addDuration = Internal.addDuration;\n/**\n * Subtracts the given `Duration` from a `DateTime`.\n *\n * **Example** (Subtracting durations)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * // subtract 5 minutes\n * DateTime.makeUnsafe(0).pipe(\n * DateTime.subtractDuration(\"5 minutes\")\n * ) // => DateTime.makeUnsafe(-300000)\n * ```\n *\n * @category math\n * @since 3.6.0\n */\nexport const subtractDuration = Internal.subtractDuration;\n/**\n * Adds the given `amount` of `unit` to a `DateTime`.\n *\n * **Details**\n *\n * The time zone is taken into account when adding days, weeks, months, and\n * years.\n *\n * **Example** (Adding date and time parts)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * // add 5 minutes\n * DateTime.makeUnsafe(0).pipe(\n * DateTime.add({ minutes: 5 })\n * ) // => DateTime.makeUnsafe(300000)\n * ```\n *\n * @category math\n * @since 3.6.0\n */\nexport const add = Internal.add;\n/**\n * Subtracts the given `amount` of `unit` from a `DateTime`.\n *\n * **Example** (Subtracting date and time parts)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * // subtract 5 minutes\n * DateTime.makeUnsafe(0).pipe(\n * DateTime.subtract({ minutes: 5 })\n * ) // => DateTime.makeUnsafe(-300000)\n * ```\n *\n * @category math\n * @since 3.6.0\n */\nexport const subtract = Internal.subtract;\n/**\n * Converts a `DateTime` to the start of the given `part`.\n *\n * **Details**\n *\n * If the part is `week`, the `weekStartsOn` option can be used to specify the\n * day of the week that the week starts on. The default is 0 (Sunday).\n *\n * **Example** (Rounding down DateTime values)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * // returns \"2024-01-01T00:00:00Z\"\n * DateTime.makeUnsafe(\"2024-01-01T12:00:00Z\").pipe(\n * DateTime.startOf(\"day\"),\n * ) // => DateTime.makeUnsafe(\"2024-01-01T00:00:00Z\")\n * ```\n *\n * @category math\n * @since 3.6.0\n */\nexport const startOf = Internal.startOf;\n/**\n * Converts a `DateTime` to the end of the given `part`.\n *\n * **Details**\n *\n * If the part is `week`, the `weekStartsOn` option can be used to specify the\n * day of the week that the week starts on. The default is 0 (Sunday).\n *\n * **Example** (Rounding up DateTime values)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * // returns \"2024-01-01T23:59:59.999Z\"\n * DateTime.makeUnsafe(\"2024-01-01T12:00:00Z\").pipe(\n * DateTime.endOf(\"day\"),\n * ) // => DateTime.makeUnsafe(\"2024-01-01T23:59:59.999Z\")\n * ```\n *\n * @category math\n * @since 3.6.0\n */\nexport const endOf = Internal.endOf;\n/**\n * Converts a `DateTime` to the nearest given `part`.\n *\n * **Details**\n *\n * If the part is `week`, the `weekStartsOn` option can be used to specify the\n * day of the week that the week starts on. The default is 0 (Sunday).\n *\n * **Example** (Rounding DateTime values to nearest units)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * // returns \"2024-01-02T00:00:00Z\"\n * DateTime.makeUnsafe(\"2024-01-01T12:01:00Z\").pipe(\n * DateTime.nearest(\"day\"),\n * ) // => DateTime.makeUnsafe(\"2024-01-02T00:00:00Z\")\n * ```\n *\n * @category math\n * @since 3.6.0\n */\nexport const nearest = Internal.nearest;\n// =============================================================================\n// formatting\n// =============================================================================\n/**\n * Formats a `DateTime` with `Intl.DateTimeFormat`.\n *\n * **Details**\n *\n * Unless a `timeZone` option is supplied, UTC values are formatted in UTC and\n * zoned values are formatted in their named zone or fixed-offset zone.\n *\n * Fixed-offset zones depend on runtime support for offset `timeZone`\n * identifiers. When unsupported, formatting falls back to UTC with the\n * `DateTime` adjusted to the offset.\n *\n * **Example** (Formatting DateTime values with Intl options)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dt = DateTime.makeZonedUnsafe(\"2024-06-15T14:30:00Z\", {\n * timeZone: \"Europe/London\"\n * })\n *\n * DateTime.format(dt, {\n * dateStyle: \"full\",\n * timeStyle: \"short\",\n * locale: \"en-US\"\n * }) // => \"Saturday, June 15, 2024 at 3:30 PM\"\n * ```\n *\n * @category formatting\n * @since 3.6.0\n */\nexport const format = Internal.format;\n/**\n * Formats a `DateTime` with `Intl.DateTimeFormat` using the system local time\n * zone and locale.\n *\n * **Example** (Formatting DateTime values locally)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dt = DateTime.makeUnsafe(\"2024-06-15T14:30:00Z\")\n *\n * // Uses system local time zone and locale\n * DateTime.formatLocal(dt, {\n * year: \"numeric\",\n * month: \"long\",\n * day: \"numeric\",\n * hour: \"2-digit\",\n * minute: \"2-digit\"\n * })\n * ```\n *\n * @category formatting\n * @since 3.6.0\n */\nexport const formatLocal = Internal.formatLocal;\n/**\n * Formats a `DateTime` with `Intl.DateTimeFormat` using the UTC time zone.\n *\n * **Details**\n *\n * This forces the time zone to be UTC.\n *\n * **Example** (Formatting DateTime values in UTC)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dt = DateTime.makeZonedUnsafe(\"2024-06-15T14:30:00Z\", {\n * timeZone: \"Europe/London\"\n * })\n *\n * // Force UTC formatting regardless of time zone\n * DateTime.formatUtc(dt, {\n * year: \"numeric\",\n * month: \"2-digit\",\n * day: \"2-digit\",\n * hour: \"2-digit\",\n * minute: \"2-digit\",\n * timeZoneName: \"short\"\n * })\n * ```\n *\n * @category formatting\n * @since 3.6.0\n */\nexport const formatUtc = Internal.formatUtc;\n/**\n * Formats a `DateTime` as a string using the `Intl.DateTimeFormat` API.\n *\n * **When to use**\n *\n * Use when you already have an `Intl.DateTimeFormat` and want it to control the\n * locale, time zone, and formatting options.\n *\n * **Details**\n *\n * The formatter receives the `DateTime` epoch milliseconds. Any time zone\n * conversion comes from the supplied formatter.\n *\n * **Example** (Formatting DateTime values with custom formatters)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dt = DateTime.makeUnsafe(\"2024-06-15T14:30:00Z\")\n *\n * // Create a custom formatter\n * const formatter = new Intl.DateTimeFormat(\"de-DE\", {\n * year: \"numeric\",\n * month: \"long\",\n * day: \"numeric\",\n * hour: \"2-digit\",\n * minute: \"2-digit\",\n * timeZone: \"Europe/Berlin\"\n * })\n *\n * DateTime.formatIntl(dt, formatter).length > 0 // => true\n * ```\n *\n * @see {@link formatUtc} for formatting with options forced to UTC\n * @see {@link formatIso} for stable ISO formatting\n *\n * @category formatting\n * @since 3.6.0\n */\nexport const formatIntl = Internal.formatIntl;\n/**\n * Formats a `DateTime` as a UTC ISO string.\n *\n * **Details**\n *\n * Always returns the UTC representation in ISO 8601 format, ignoring any time zone.\n *\n * **Example** (Formatting DateTime values as ISO strings)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * DateTime.formatIso(DateTime.makeUnsafe(\"2024-01-01T12:30:45.123Z\")) // => \"2024-01-01T12:30:45.123Z\"\n *\n * const zoned = DateTime.makeZonedUnsafe(\"2024-01-01T12:30:45.123Z\", {\n * timeZone: \"Europe/London\"\n * })\n * DateTime.formatIso(zoned) // => \"2024-01-01T12:30:45.123Z\"\n * ```\n *\n * @category formatting\n * @since 3.6.0\n */\nexport const formatIso = Internal.formatIso;\n/**\n * Formats a `DateTime` as a time zone adjusted ISO date string.\n *\n * **Details**\n *\n * Returns only the date part (YYYY-MM-DD) after applying time zone adjustments.\n *\n * **Example** (Formatting DateTime values as ISO dates)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dt = DateTime.makeUnsafe(\"2024-01-01T23:30:00Z\")\n * DateTime.formatIsoDate(dt) // => \"2024-01-01\"\n *\n * const zoned = DateTime.makeZonedUnsafe(\"2024-01-01T23:30:00Z\", {\n * timeZone: \"Pacific/Auckland\" // UTC+12/13\n * })\n * DateTime.formatIsoDate(zoned) // => \"2024-01-02\"\n * ```\n *\n * @category formatting\n * @since 3.6.0\n */\nexport const formatIsoDate = Internal.formatIsoDate;\n/**\n * Formats a `DateTime` as a UTC ISO date string.\n *\n * **Details**\n *\n * Returns only the date part (YYYY-MM-DD) in UTC, ignoring any time zone.\n *\n * **Example** (Formatting DateTime values as UTC ISO dates)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const dt = DateTime.makeUnsafe(\"2024-01-01T23:30:00Z\")\n * DateTime.formatIsoDateUtc(dt) // => \"2024-01-01\"\n *\n * const zoned = DateTime.makeZonedUnsafe(\"2024-01-01T23:30:00Z\", {\n * timeZone: \"Pacific/Auckland\"\n * })\n * DateTime.formatIsoDateUtc(zoned) // => \"2024-01-01\"\n * ```\n *\n * @category formatting\n * @since 3.6.0\n */\nexport const formatIsoDateUtc = Internal.formatIsoDateUtc;\n/**\n * Formats a `DateTime.Zoned` as an ISO string with an offset.\n *\n * **Details**\n *\n * For `DateTime.Utc`, returns the same as `formatIso`. For `DateTime.Zoned`,\n * includes the time zone offset in the format.\n *\n * **Example** (Formatting DateTime values with offsets)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const utc = DateTime.makeUnsafe(\"2024-01-01T12:00:00Z\")\n * DateTime.formatIsoOffset(utc) // => \"2024-01-01T12:00:00.000Z\"\n *\n * const zoned = DateTime.makeZonedUnsafe(\"2024-01-01T12:00:00Z\", {\n * timeZone: DateTime.zoneMakeOffset(3 * 60 * 60 * 1000)\n * })\n * DateTime.formatIsoOffset(zoned) // => \"2024-01-01T15:00:00.000+03:00\"\n * ```\n *\n * @category formatting\n * @since 3.6.0\n */\nexport const formatIsoOffset = Internal.formatIsoOffset;\n/**\n * Formats a `DateTime.Zoned` as a string.\n *\n * **Details**\n *\n * It uses the format: `YYYY-MM-DDTHH:mm:ss.sss+HH:MM[Time/Zone]`.\n *\n * **Example** (Formatting zoned DateTime values)\n *\n * ```ts import.meta.vitest\n * import { DateTime } from \"effect\"\n *\n * const zoned = DateTime.makeZonedUnsafe(\"2024-06-15T14:30:45.123Z\", {\n * timeZone: \"Europe/London\"\n * })\n *\n * DateTime.formatIsoZoned(zoned) // => \"2024-06-15T15:30:45.123+01:00[Europe/London]\"\n *\n * const offsetZone = DateTime.makeZonedUnsafe(\"2024-06-15T14:30:45.123Z\", {\n * timeZone: DateTime.zoneMakeOffset(3 * 60 * 60 * 1000)\n * })\n *\n * DateTime.formatIsoZoned(offsetZone) // => \"2024-06-15T17:30:45.123+03:00\"\n * ```\n *\n * @category formatting\n * @since 3.6.0\n */\nexport const formatIsoZoned = Internal.formatIsoZoned;\n/**\n * Create a Layer from the given time zone.\n *\n * **Details**\n *\n * This layer provides the `CurrentTimeZone` service with the specified time zone.\n *\n * **Example** (Providing current time zone layers)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n *\n * const zone = DateTime.zoneMakeNamedUnsafe(\"Europe/London\")\n * const layer = DateTime.layerCurrentZone(zone)\n *\n * const program = Effect.gen(function*() {\n * const now = yield* DateTime.nowInCurrentZone\n * return DateTime.zoneToString(now.zone)\n * })\n *\n * // Use the layer to provide the time zone\n * await Effect.runPromise(Effect.provide(program, layer)) // => \"Europe/London\"\n * ```\n *\n * @category layers\n * @since 3.6.0\n */\nexport const layerCurrentZone = /*#__PURE__*/Layer.succeed(CurrentTimeZone);\n/**\n * Create a Layer from the given time zone offset.\n *\n * **Details**\n *\n * This layer provides the `CurrentTimeZone` service with a fixed offset time zone.\n *\n * **Example** (Providing fixed-offset time zone layers)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n *\n * // Create a layer for UTC+3\n * const layer = DateTime.layerCurrentZoneOffset(3 * 60 * 60 * 1000)\n *\n * const program = Effect.gen(function*() {\n * const now = yield* DateTime.nowInCurrentZone\n * return DateTime.zoneToString(now.zone)\n * })\n *\n * await Effect.runPromise(Effect.provide(program, layer)) // => \"+03:00\"\n * ```\n *\n * @category layers\n * @since 3.6.0\n */\nexport const layerCurrentZoneOffset = offset => Layer.succeed(CurrentTimeZone)(Internal.zoneMakeOffset(offset));\n/**\n * Create a Layer from the given IANA time zone identifier.\n *\n * **Details**\n *\n * This layer provides the `CurrentTimeZone` service with a named time zone.\n * If the time zone identifier is invalid, the layer will fail.\n *\n * **Example** (Providing named time zone layers)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n *\n * const layer = DateTime.layerCurrentZoneNamed(\"Europe/London\")\n *\n * const program = Effect.gen(function*() {\n * const now = yield* DateTime.nowInCurrentZone\n * return DateTime.zoneToString(now.zone)\n * })\n *\n * await Effect.runPromise(Effect.provide(program, layer)) // => \"Europe/London\"\n * ```\n *\n * @category layers\n * @since 3.6.0\n */\nexport const layerCurrentZoneNamed = /*#__PURE__*/flow(Internal.zoneMakeNamedEffect, /*#__PURE__*/Layer.effect(CurrentTimeZone));\n/**\n * Create a Layer from the system's local time zone.\n *\n * **Details**\n *\n * This layer provides the `CurrentTimeZone` service using the system's\n * configured local time zone.\n *\n * **Example** (Providing local time zone layers)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect } from \"effect\"\n *\n * const program = Effect.gen(function*() {\n * const now = yield* DateTime.nowInCurrentZone\n * return DateTime.isZoned(now)\n * })\n *\n * // Use the system's local time zone\n * await Effect.runPromise(Effect.provide(program, DateTime.layerCurrentZoneLocal)) // => true\n * ```\n *\n * @category layers\n * @since 3.6.0\n */\nexport const layerCurrentZoneLocal = /*#__PURE__*/Layer.sync(CurrentTimeZone)(zoneMakeLocal);\n//# sourceMappingURL=DateTime.js.map","import { memoize } from \"../../Function.js\";\n/** @internal */\nexport function resolve(ast) {\n return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;\n}\n/** @internal */\nexport function resolveAt(key) {\n return ast => resolve(ast)?.[key];\n}\n/** @internal */\nexport const STRUCTURAL_ANNOTATION_KEY = \"~structural\";\n/** @internal */\nexport const IDENTIFIER_FALLBACK_KEY = \"~identifier\";\n/** @internal */\nexport const SENTINELS_ANNOTATION_KEY = \"~sentinels\";\n/** @internal */\nexport const CONSTRUCTOR_ANNOTATION_KEY = \"~constructor\";\n/** @internal */\nexport const jsonSchemaAnnotationKeys = [\"title\", \"description\", \"default\", \"examples\", \"readOnly\", \"writeOnly\", \"format\", \"contentEncoding\", \"contentMediaType\", \"contentSchema\"];\n/** @internal */\nexport const resolveIdentifier = /*#__PURE__*/resolveAt(\"identifier\");\n/** @internal */\nexport const resolveIdentifierFallback = /*#__PURE__*/resolveAt(IDENTIFIER_FALLBACK_KEY);\n/** @internal */\nexport const resolveTitle = /*#__PURE__*/resolveAt(\"title\");\n/** @internal */\nexport const resolveDescription = /*#__PURE__*/resolveAt(\"description\");\n/** @internal */\nexport const resolveBrands = /*#__PURE__*/resolveAt(\"brands\");\n/** @internal */\nexport const getExpected = /*#__PURE__*/memoize(ast => {\n const identifier = resolve(ast)?.identifier;\n if (typeof identifier === \"string\") return identifier;\n return ast.getExpected(getExpected);\n});\n/** @internal */\nexport function collectBrands(annotations) {\n return annotations !== undefined && Array.isArray(annotations.brands) ? annotations.brands : [];\n}\n/** @internal */\nexport const annotationExcludedKeys = /*#__PURE__*/new Set([SENTINELS_ANNOTATION_KEY, STRUCTURAL_ANNOTATION_KEY, \"representation\", \"arbitraryConstraint\", \"brands\", \"toJsonSchema\", \"toCode\", \"toEquivalence\", \"toFormatter\", \"toCodec\", \"toCodecJson\", \"toCodecStringTree\", \"toCodecIso\", \"toCodecArbitrary\"]);\n//# sourceMappingURL=annotations.js.map","import * as Exit from \"../../Exit.js\";\nimport * as Option from \"../../Option.js\";\nimport { args } from \"../core.js\";\n/** @internal */\nexport const missing = /*#__PURE__*/Symbol();\n/** @internal */\nexport { args };\n/** @internal */\nexport const succeed = Exit.succeed;\n/** @internal */\nexport const missingExit = /*#__PURE__*/succeed(missing);\n// Shared success for a present input returned unchanged. It must be resolved\n// before crossing an asynchronous or transformation boundary.\n/** @internal */\nexport const sameExit = /*#__PURE__*/succeed(missing);\n/** @internal */\nexport const toOption = value => value === missing ? Option.none() : Option.some(value);\n/** @internal */\nexport const fromOptionExit = option => option._tag === \"None\" ? missingExit : succeed(option.value);\n//# sourceMappingURL=parser.js.map","/**\n * Describes problems found while decoding, encoding, or checking data with\n * schemas.\n *\n * An `Issue` records what failed and, for nested data, where the failure\n * happened. The Schema system uses these values for missing keys, unexpected\n * keys, invalid types, invalid values, failed filters, failed transformations,\n * and alternatives that did not match. This module also formats issues.\n *\n * @since 4.0.0\n */\nimport * as Arr from \"./Array.js\";\nimport { format, formatPath } from \"./Formatter.js\";\nimport * as InternalAnnotations from \"./internal/schema/annotations.js\";\nimport * as InternalParser from \"./internal/schema/parser.js\";\nimport { hasProperty } from \"./Predicate.js\";\nconst TypeId = \"~effect/SchemaIssue/Issue\";\n/**\n * Returns `true` if the given value is an {@link Issue}.\n *\n * **When to use**\n *\n * Use when you need to narrow an `unknown` value to `Issue` in error-handling\n * code, such as distinguishing an `Issue` from other error types in a catch-all\n * handler.\n *\n * **Details**\n *\n * - Checks for the internal `TypeId` brand on the value.\n *\n * **Example** (Type-guarding an unknown error)\n *\n * ```ts import.meta.vitest\n * import { SchemaIssue } from \"effect\"\n *\n * const issue = new SchemaIssue.MissingKey(undefined)\n * SchemaIssue.isIssue(issue) // => true\n * SchemaIssue.isIssue(\"not an issue\") // => false\n * ```\n *\n * @see {@link Issue}\n *\n * @category guards\n * @since 4.0.0\n */\nexport function isIssue(u) {\n return hasProperty(u, TypeId) && u[TypeId] === TypeId;\n}\n/**\n * Returns `true` when an issue contains an input reported by the schema parser.\n *\n * **When to use**\n *\n * Use when reading `Issue.input`, especially when `undefined` is a valid input\n * value.\n *\n * **Details**\n *\n * Reported input is stored as an own property. This guard checks for that\n * property and narrows `input` from optional to required.\n *\n * **Example** (Reading a reported input)\n *\n * ```ts import.meta.vitest\n * import { Result, Schema, SchemaIssue } from \"effect\"\n *\n * const result = Schema.decodeUnknownResult(Schema.String)(1, { reportInput: true })\n * if (Result.isFailure(result) && SchemaIssue.hasInput(result.failure.issue)) {\n * result.failure.issue.input // => 1\n * }\n * ```\n *\n * @see {@link Issue} for the complete issue model\n *\n * @category guards\n * @since 4.0.0\n */\nexport function hasInput(issue) {\n return Object.hasOwn(issue, \"input\");\n}\nclass IssueNodeImpl {\n [TypeId] = TypeId;\n constructor(input, options) {\n if (options?.reportInput === true && input !== InternalParser.missing) {\n this.input = input;\n }\n }\n}\n/**\n * Constructs a schema issue for a failed refinement check.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const 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(\n /**\n * The filter that failed.\n */\n filter,\n /**\n * The issue that occurred.\n */\n issue,\n /**\n * The present input associated with the issue. It is retained only when\n * `options.reportInput` is `true`.\n */\n input,\n /**\n * The effective parse options controlling input retention.\n */\n options) {\n super(input, options);\n this.filter = filter;\n this.issue = issue;\n }\n};\n/**\n * Constructs a schema issue for a failed transformation.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const 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(\n /**\n * The schema that caused the issue.\n */\n ast,\n /**\n * The issue that occurred.\n */\n issue,\n /**\n * The present input associated with the issue. It is retained only when\n * `options.reportInput` is `true`.\n */\n input,\n /**\n * The effective parse options controlling input retention.\n */\n options) {\n super(input, options);\n this.ast = ast;\n this.issue = issue;\n }\n};\n/**\n * Constructs a schema issue that points to a nested location.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const 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(\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 super();\n this.path = path;\n this.issue = issue;\n }\n};\n/**\n * Constructs a schema issue for a missing key or tuple index.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const MissingKey = class extends IssueNodeImpl {\n _tag = \"MissingKey\";\n /**\n * The metadata for the issue.\n */\n annotations;\n constructor(\n /**\n * The metadata for the issue.\n */\n annotations) {\n super();\n this.annotations = annotations;\n }\n};\n/**\n * Constructs a schema issue for an unexpected key or tuple index.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const UnexpectedKey = class extends IssueNodeImpl {\n _tag = \"UnexpectedKey\";\n /**\n * The schema that caused the issue.\n */\n ast;\n constructor(\n /**\n * The schema that caused the issue.\n */\n ast,\n /**\n * The present input associated with the issue. It is retained only when\n * `options.reportInput` is `true`.\n */\n input,\n /**\n * The effective parse options controlling input retention.\n */\n options) {\n super(input, options);\n this.ast = ast;\n }\n};\n/**\n * Constructs a schema issue that groups multiple child issues.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const 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(\n /**\n * The schema that caused the issue.\n */\n ast,\n /**\n * The issues that occurred.\n */\n issues,\n /**\n * The present input associated with the issue. It is retained only when\n * `options.reportInput` is `true`.\n */\n input,\n /**\n * The effective parse options controlling input retention.\n */\n options) {\n super(input, options);\n this.ast = ast;\n this.issues = issues;\n }\n};\n/**\n * Constructs a schema issue for an input with an invalid runtime type.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const InvalidType = class extends IssueNodeImpl {\n _tag = \"InvalidType\";\n /**\n * The schema that caused the issue.\n */\n ast;\n constructor(\n /**\n * The schema that caused the issue.\n */\n ast,\n /**\n * The present input associated with the issue. It is retained only when\n * `options.reportInput` is `true`.\n */\n input,\n /**\n * The effective parse options controlling input retention.\n */\n options) {\n super(input, options);\n this.ast = ast;\n }\n};\n/**\n * Constructs a schema issue for a value that violates a constraint.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const InvalidValue = class extends IssueNodeImpl {\n _tag = \"InvalidValue\";\n /**\n * The metadata for the issue.\n */\n annotations;\n constructor(\n /**\n * The metadata for the issue.\n */\n annotations,\n /**\n * The present input associated with the issue. It is retained only when\n * `options.reportInput` is `true`.\n */\n input,\n /**\n * The effective parse options controlling input retention.\n */\n options) {\n super(input, options);\n this.annotations = annotations;\n }\n};\n/** @internal */\nexport function makeCompositeAtKey(compositeAst, pointerKey, pointerIssue, compositeInput, parseOptions) {\n return new Composite(compositeAst, [new Pointer([pointerKey], pointerIssue)], compositeInput, parseOptions);\n}\n/**\n * Constructs a schema issue for a forbidden parsing operation.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Forbidden = class extends IssueNodeImpl {\n _tag = \"Forbidden\";\n /**\n * The metadata for the issue.\n */\n annotations;\n constructor(\n /**\n * The metadata for the issue.\n */\n annotations,\n /**\n * The present input associated with the issue. It is retained only when\n * `options.reportInput` is `true`.\n */\n input,\n /**\n * The effective parse options controlling input retention.\n */\n options) {\n super(input, options);\n this.annotations = annotations;\n }\n};\n/**\n * Constructs a schema issue for a value that matches no union member.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const 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(\n /**\n * The schema that caused the issue.\n */\n ast,\n /**\n * The issues that occurred.\n */\n issues,\n /**\n * The present input associated with the issue. It is retained only when\n * `options.reportInput` is `true`.\n */\n input,\n /**\n * The effective parse options controlling input retention.\n */\n options) {\n super(input, options);\n this.ast = ast;\n this.issues = issues;\n }\n};\n/**\n * Constructs a schema issue for a value that matches multiple union members.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const 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(\n /**\n * The schema that caused the issue.\n */\n ast,\n /**\n * The schemas that were successful.\n */\n successes,\n /**\n * The present input associated with the issue. It is retained only when\n * `options.reportInput` is `true`.\n */\n input,\n /**\n * The effective parse options controlling input retention.\n */\n 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}\n/** @internal */\nexport function makeSingle(out, input, options) {\n if (out === undefined) {\n return undefined;\n }\n if (typeof out === \"boolean\") {\n return out ? undefined : new InvalidValue(undefined, input, options);\n }\n return makeFilterIssue(out, input, options);\n}\n/** @internal */\nexport function normalizeFilterOutput(ast, out, input, options) {\n if (Array.isArray(out)) {\n if (!Arr.isReadonlyArrayNonEmpty(out)) {\n return undefined;\n }\n return out.length === 1 ? makeFilterIssue(out[0], input, options) : new Composite(ast, Arr.map(out, entry => makeFilterIssue(entry, input, options)), input, options);\n }\n return makeSingle(out, input, options);\n}\n/**\n * Returns the built-in {@link LeafHook} used by default formatters.\n *\n * **When to use**\n *\n * Use as the default leaf renderer when customizing only the {@link CheckHook}.\n *\n * **Details**\n *\n * - Checks for a `message` annotation first; returns it if present.\n * - For `InvalidValue`, an `expected` annotation uses the standard expected\n * value message and includes reported input when available.\n * - Otherwise generates a default message per `_tag`. When the issue reports\n * input, the message includes its formatted value where applicable:\n * - `InvalidType` → `\"Expected <type>\"` or `\"Expected <type>, got <input>\"`\n * - `InvalidValue` → `\"Expected a valid value\"` or `\"Invalid data <input>\"`\n * - `MissingKey` → `\"Missing key\"`\n * - `UnexpectedKey` → `\"Expected no excess property\"` or\n * `\"Unexpected key with value <input>\"`\n * - `Forbidden` → `\"Forbidden operation\"`\n * - `OneOf` → `\"Expected exactly one member to match\"` or\n * `\"Expected exactly one member to match the input <input>\"`\n *\n * **Example** (Formatting Standard Schema issues with defaultLeafHook)\n *\n * ```ts import.meta.vitest\n * import { SchemaIssue } from \"effect\"\n *\n * const formatter = SchemaIssue.makeFormatterStandardSchemaV1({\n * leafHook: SchemaIssue.defaultLeafHook\n * })\n * formatter(new SchemaIssue.MissingKey(undefined)) // => { issues: [{ path: [], message: \"Missing key\" }] }\n * ```\n *\n * @see {@link LeafHook}\n * @see {@link makeFormatterStandardSchemaV1}\n *\n * @category formatting\n * @since 4.0.0\n */\nexport const defaultLeafHook = issue => {\n const message = findMessage(issue);\n if (message !== undefined) return message;\n switch (issue._tag) {\n case \"InvalidType\":\n return getExpectedMessage(InternalAnnotations.getExpected(issue.ast), issue);\n case \"InvalidValue\":\n {\n const expected = findExpected(issue);\n if (expected !== undefined) return getExpectedMessage(expected, issue);\n const input = formatInput(issue);\n return input === undefined ? \"Expected a valid value\" : `Invalid data ${input}`;\n }\n case \"MissingKey\":\n return \"Missing key\";\n case \"UnexpectedKey\":\n {\n const input = formatInput(issue);\n return input === undefined ? \"Expected no excess property\" : `Unexpected key with value ${input}`;\n }\n case \"Forbidden\":\n return \"Forbidden operation\";\n case \"OneOf\":\n {\n const input = formatInput(issue);\n return input === undefined ? \"Expected exactly one member to match\" : `Expected exactly one member to match the input ${input}`;\n }\n }\n};\n/**\n * Returns the built-in {@link CheckHook} used by default formatters.\n *\n * **When to use**\n *\n * Use as the default filter renderer when customizing only the {@link LeafHook}.\n *\n * **Details**\n *\n * - Looks for a `message` annotation on the inner issue first, then on the\n * filter itself.\n * - Returns `undefined` when no annotation is found, causing the formatter to\n * fall back to `\"Expected <filter>\"` or, when the filter reports input,\n * `\"Expected <filter>, got <input>\"`.\n *\n * @see {@link CheckHook}\n * @see {@link makeFormatterStandardSchemaV1}\n *\n * @category formatting\n * @since 4.0.0\n */\nexport const defaultCheckHook = issue => findMessage(issue.issue) ?? findMessage(issue);\n/**\n * Creates a {@link Formatter} that produces a `StandardSchemaV1.FailureResult`.\n *\n * **When to use**\n *\n * Use when you need schema parse errors in\n * [Standard Schema V1](https://github.com/standard-schema/standard-schema)\n * format, optionally customizing leaf or check issue rendering.\n *\n * **Details**\n *\n * - Returns a `Formatter<StandardSchemaV1.FailureResult>`.\n * - Each leaf issue is flattened into `{ message, path }` entries.\n * - `Pointer` paths are accumulated to produce full property paths.\n * - Falls back to {@link defaultLeafHook} / {@link defaultCheckHook} when no\n * hooks are provided.\n * - Default messages include reported input when the issue that produces the\n * message has an `input` field. The returned Standard Schema issues do not\n * receive an `input` field.\n *\n * **Gotchas**\n *\n * Reported input can appear inside the Standard Schema `message` string even\n * though it is not exposed as a separate property. Custom hooks control their\n * complete message and are not modified.\n *\n * **Example** (Creating a Standard Schema V1 formatter)\n *\n * ```ts import.meta.vitest\n * import { SchemaIssue } from \"effect\"\n *\n * const formatter = SchemaIssue.makeFormatterStandardSchemaV1()\n * formatter(new SchemaIssue.MissingKey(undefined)).issues[0].message // => \"Missing key\"\n * ```\n *\n * @see {@link makeFormatterDefault} — produces a plain string instead\n * @see {@link LeafHook}\n * @see {@link CheckHook}\n *\n * @category formatting\n * @since 4.0.0\n */\nexport function makeFormatterStandardSchemaV1(options) {\n return issue => ({\n issues: toDefaultIssues(issue, [], options?.leafHook ?? defaultLeafHook, options?.checkHook ?? defaultCheckHook)\n });\n}\nfunction formatInput(issue) {\n return hasInput(issue) ? format(issue.input) : undefined;\n}\nfunction findExpected(issue) {\n const expected = issue.annotations?.expected;\n return typeof expected === \"string\" ? expected : undefined;\n}\nfunction getExpectedMessage(expected, issue) {\n const input = formatInput(issue);\n return input === undefined ? `Expected ${expected}` : `Expected ${expected}, got ${input}`;\n}\nfunction toDefaultIssues(issue, path, leafHook, checkHook) {\n switch (issue._tag) {\n case \"Filter\":\n {\n const message = checkHook(issue);\n if (message !== undefined) {\n return [{\n path,\n message\n }];\n }\n if (issue.issue._tag !== \"InvalidValue\") {\n return toDefaultIssues(issue.issue, path, leafHook, checkHook);\n }\n const expected = findExpected(issue.issue);\n return [{\n path,\n message: expected === undefined ? getExpectedMessage(formatCheck(issue.filter), issue) : getExpectedMessage(expected, issue.issue)\n }];\n }\n case \"Encoding\":\n return toDefaultIssues(issue.issue, path, leafHook, checkHook);\n case \"Pointer\":\n return toDefaultIssues(issue.issue, [...path, ...issue.path], leafHook, checkHook);\n case \"Composite\":\n return issue.issues.flatMap(issue => toDefaultIssues(issue, path, leafHook, checkHook));\n case \"AnyOf\":\n {\n if (issue.issues.length === 0) {\n return [{\n path,\n message: findMessage(issue) ?? getExpectedMessage(InternalAnnotations.getExpected(issue.ast), issue)\n }];\n }\n return issue.issues.flatMap(issue => toDefaultIssues(issue, path, leafHook, checkHook));\n }\n default:\n return [{\n path,\n message: leafHook(issue)\n }];\n }\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(check => formatCheck(check)).join(\" & \");\n }\n}\n/**\n * Creates a {@link Formatter} that converts an {@link Issue} into a\n * human-readable multi-line string.\n *\n * **When to use**\n *\n * Use when you need to format a `SchemaIssue.Issue` as error messages for\n * logging, CLI output, or developer-facing diagnostics.\n *\n * **Details**\n *\n * - Flattens the issue tree into `{ message, path }` entries using\n * {@link defaultLeafHook} and {@link defaultCheckHook}.\n * - Includes reported input in default messages when the node producing the\n * message has an `input` field.\n * - Each entry is rendered as `\"<message>\"` or `\"<message>\\n at <path>\"`.\n * - Multiple entries are joined with newlines.\n *\n * **Gotchas**\n *\n * Formatting an issue can disclose input retained with `reportInput: true`.\n * Wrapper inputs are not inherited by child messages, and custom messages are\n * returned unchanged.\n *\n * **Example** (Formatting an issue as a string)\n *\n * ```ts import.meta.vitest\n * import { SchemaIssue } from \"effect\"\n *\n * const formatter = SchemaIssue.makeFormatterDefault()\n * formatter(new SchemaIssue.MissingKey(undefined)) // => \"Missing key\"\n * ```\n *\n * @see {@link makeFormatterStandardSchemaV1} — produces Standard Schema V1 format instead\n * @see {@link Formatter}\n *\n * @category formatting\n * @since 4.0.0\n */\nexport function makeFormatterDefault() {\n return issue => formatIssue(issue, \"\");\n}\n/** @internal */\nexport const defaultFormatter = /*#__PURE__*/makeFormatterDefault();\nfunction formatIssue(issue, path) {\n let message;\n switch (issue._tag) {\n case \"Filter\":\n {\n const annotated = defaultCheckHook(issue);\n if (annotated !== undefined) {\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 === undefined ? 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 {\n if (issue._tag === \"Composite\" || issue.issues.length > 0) {\n return issue.issues.map(issue => formatIssue(issue, path)).join(\"\\n\");\n }\n message = findMessage(issue) ?? getExpectedMessage(InternalAnnotations.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//# sourceMappingURL=SchemaIssue.js.map","import * as Cause from \"../../Cause.js\";\nimport * as SchemaIssue from \"../../SchemaIssue.js\";\n/** @internal */\nexport function getSchemaIssue(cause) {\n let issue;\n for (const reason of cause.reasons) {\n if (!Cause.isFailReason(reason) || !SchemaIssue.isIssue(reason.error)) {\n return undefined;\n }\n issue ??= reason.error;\n }\n return issue;\n}\n/** @internal */\nexport function getSchemaIssueOrThrow(cause, message) {\n const issue = getSchemaIssue(cause);\n if (issue === undefined) {\n throw new Error(message, {\n cause\n });\n }\n return issue;\n}\n//# sourceMappingURL=cause.js.map","/**\n * Builds one-way conversions used by schemas.\n *\n * A `Getter<T, E, R>` receives an optional encoded value and returns an\n * optional decoded value. It can also report a schema issue or require Effect\n * services. Schema transformations use getters to describe one direction of a\n * conversion, for example decoding a field from input data. This module\n * includes basic getters, validation helpers, pure and effectful conversions,\n * and ready-made conversions for common string, number, binary, date, form, and\n * URL-related values.\n *\n * @since 4.0.0\n */\nimport * as Arr from \"./Array.js\";\nimport * as DateTime from \"./DateTime.js\";\nimport * as Effect from \"./Effect.js\";\nimport * as Encoding from \"./Encoding.js\";\nimport * as InternalRecord from \"./internal/record.js\";\nimport * as Option from \"./Option.js\";\nimport * as Pipeable from \"./Pipeable.js\";\nimport * as Predicate from \"./Predicate.js\";\nimport * as Result from \"./Result.js\";\nimport * as SchemaIssue from \"./SchemaIssue.js\";\nimport * as Str from \"./String.js\";\n/**\n * Constructs a composable schema getter.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Getter = class extends Pipeable.Class {\n run;\n constructor(run) {\n super();\n this.run = run;\n }\n map(f) {\n return new Getter((oe, options) => this.run(oe, options).pipe(Effect.mapEager(Option.map(f))));\n }\n compose(other) {\n if (isPassthrough(this)) {\n return other;\n }\n if (isPassthrough(other)) {\n return this;\n }\n return new Getter((oe, options) => this.run(oe, options).pipe(Effect.flatMapEager(ot => other.run(ot, options))));\n }\n};\n/**\n * Creates a getter that always produces the given constant value, ignoring the input.\n *\n * **When to use**\n *\n * Use when you need a schema getter that always decodes a field to a fixed\n * value.\n *\n * **Details**\n *\n * The getter is pure and always returns `Option.some(t)` regardless of whether\n * the input is `Some` or `None`.\n *\n * **Example** (Returning a constant getter)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const alwaysZero = SchemaGetter.succeed(0)\n * await Effect.runPromise(alwaysZero.run(Option.none(), {})) // => Option.some(0)\n * ```\n *\n * @see {@link transform} when you need to use the input value\n * @see {@link passthrough} when you want to keep the input as-is\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function succeed(t) {\n return new Getter(() => Effect.succeedSome(t));\n}\n/**\n * Creates a getter that always fails with the given issue.\n *\n * **When to use**\n *\n * Use when you need a schema getter that unconditionally rejects input.\n * - Building custom validation getters that produce specific error types.\n *\n * **Details**\n *\n * - Always fails with the `Issue` returned by `f`.\n * - The failure function receives the original `Option<E>` input and the\n * effective `ParseOptions` for error context.\n *\n * **Example** (Defining an always-failing getter)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter, SchemaIssue } from \"effect\"\n *\n * const rejectAll = SchemaGetter.fail<string, string>(\n * () => new SchemaIssue.InvalidValue({ message: \"not allowed\" })\n * )\n * const issue = await Effect.runPromise(Effect.flip(rejectAll.run(Option.some(\"x\"), {})))\n * issue._tag // => \"InvalidValue\"\n * ```\n *\n * @see {@link forbidden} for a convenience helper for `Forbidden` issues\n * @see {@link checkEffect} to fail conditionally based on input value\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function fail(f) {\n return new Getter((oe, options) => Effect.fail(f(oe, options)));\n}\n/**\n * Creates a getter that always fails with a `Forbidden` issue.\n *\n * **When to use**\n *\n * Use when you need a schema getter to disallow a field or direction\n * (encode/decode) entirely.\n * - You want a clear \"forbidden\" error message in schema validation output.\n *\n * **Details**\n *\n * - Always fails with `SchemaIssue.Forbidden`.\n * - The message function receives the `Option<E>` input for context.\n *\n * **Example** (Forbidding a decode direction)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const noEncode = SchemaGetter.forbidden<string, number>(\n * () => \"encoding is not supported\"\n * )\n * const issue = await Effect.runPromise(Effect.flip(noEncode.run(Option.some(1), {})))\n * issue._tag // => \"Forbidden\"\n * ```\n *\n * @see {@link fail} to fail with a custom issue type\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function forbidden(message) {\n return fail((oe, options) => {\n const annotations = {\n message: message(oe)\n };\n return Option.isSome(oe) ? new SchemaIssue.Forbidden(annotations, oe.value, options) : new SchemaIssue.Forbidden(annotations);\n });\n}\n/**\n * Getter that always fails with a `Forbidden` issue indicating that encoding is unsupported.\n *\n * **When to use**\n *\n * Use as the encode side of a decode-only Schema transformation.\n *\n * **Details**\n *\n * Its `Getter<never, unknown>` type is assignable to every encoding getter because it accepts any input and never\n * produces an output value.\n *\n * **Example** (Rejecting encoding)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const issue = await Effect.runPromise(\n * Effect.flip(SchemaGetter.forbiddenEncoding.run(Option.some(\"value\"), {}))\n * )\n * issue._tag // => \"Forbidden\"\n * ```\n *\n * @see {@link forbidden} for a forbidden getter with a custom message\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const forbiddenEncoding = /*#__PURE__*/forbidden(() => \"Encoding is not supported\");\nconst passthrough_ = /*#__PURE__*/new Getter(Effect.succeed);\nfunction isPassthrough(getter) {\n return getter.run === passthrough_.run;\n}\nexport function passthrough() {\n return passthrough_;\n}\nexport function passthroughSupertype() {\n return passthrough_;\n}\nexport function passthroughSubtype() {\n return passthrough_;\n}\n/**\n * Creates a getter that handles the case when the input is absent (`Option.None`).\n *\n * **When to use**\n *\n * Use when you need a schema getter to provide a fallback or computed value for\n * missing struct keys.\n * - Building custom \"default value\" logic more complex than {@link withDefault}.\n *\n * **Details**\n *\n * - When input is `None`, calls `f` to produce the result.\n * - When input is `Some`, passes it through unchanged.\n * - `f` receives the parse options and may return `None` to keep the value absent.\n *\n * **Example** (Providing a default timestamp for a missing field)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const withTimestamp = SchemaGetter.onNone<number>(() =>\n * Effect.succeed(Option.some(0))\n * )\n * await Effect.runPromise(withTimestamp.run(Option.none(), {})) // => Option.some(0)\n * ```\n *\n * @see {@link required} when absent input should fail\n * @see {@link withDefault} for a simpler default value for undefined inputs\n * @see {@link onSome} to handle only present values\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function onNone(f) {\n return new Getter((ot, options) => Option.isNone(ot) ? f(options) : Effect.succeed(ot));\n}\n/**\n * Creates a getter that fails with `MissingKey` if the input is absent (`Option.None`).\n *\n * **When to use**\n *\n * Use when you need a schema getter to require a struct field in the encoded\n * input and report a missing key error when it is absent.\n *\n * **Details**\n *\n * - When input is `None`, fails with `SchemaIssue.MissingKey`.\n * - When input is `Some`, passes it through unchanged.\n * - Optional `annotations` customize the error message for the missing key.\n *\n * **Example** (Defining a required struct field)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const mustExist = SchemaGetter.required<string>()\n * const issue = await Effect.runPromise(Effect.flip(mustExist.run(Option.none(), {})))\n * issue._tag // => \"MissingKey\"\n * ```\n *\n * @see {@link onNone} to provide a fallback instead of failing\n * @see {@link withDefault} to substitute a default for undefined values\n *\n * @category validation\n * @since 4.0.0\n */\nexport function required(annotations) {\n return onNone(() => Effect.fail(new SchemaIssue.MissingKey(annotations)));\n}\n/**\n * Creates a getter that handles present values (`Option.Some`), passing `None` through.\n *\n * **When to use**\n *\n * Use when you need a schema getter to transform or validate only when a field\n * value is present.\n * - Missing keys should remain absent in the output.\n *\n * **Details**\n *\n * - When input is `None`, returns `None` (no-op).\n * - When input is `Some(e)`, calls `f(e, options)` to produce the result.\n * - `f` may return `None` to omit the value, or fail with an `Issue`.\n *\n * **Example** (Transforming only present values)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const parseIfPresent = SchemaGetter.onSome<number, string>(\n * (s) => Effect.succeed(Option.some(Number(s)))\n * )\n * await Effect.runPromise(parseIfPresent.run(Option.some(\"42\"), {})) // => Option.some(42)\n * ```\n *\n * @see {@link onNone} to handle only absent values\n * @see {@link transform} for a simpler pure transformation of present values\n * @see {@link transformEffect} for effectful transformation of present values\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function onSome(f) {\n return new Getter((oe, options) => Option.isNone(oe) ? Effect.succeedNone : f(oe.value, options));\n}\n/**\n * Creates a getter that validates a value using an effectful check function.\n *\n * **When to use**\n *\n * Use when you need a schema getter to validate a decoded value (e.g. check a\n * constraint or call an external service).\n * - The validation may be asynchronous or require Effect services.\n *\n * **Details**\n *\n * - Only runs when input is `Some` — `None` passes through.\n * - The check function returns a validation result:\n * - `undefined` or `true` — value is valid, passes through.\n * - `false` or a `string` — value is invalid, fails with an `Issue`.\n * - An `Issue` object — fails with that issue directly.\n * - `{ path, issue }` — fails with a nested path issue (`issue` may be a\n * message string or a full {@link SchemaIssue.Issue}).\n * - Does not transform the value — input and output types are the same.\n *\n * **Example** (Validating effectfully)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const nonNegative = SchemaGetter.checkEffect<number>((n) =>\n * Effect.succeed(n >= 0 ? undefined : \"must be non-negative\")\n * )\n * await Effect.runPromise(nonNegative.run(Option.some(1), {})) // => Option.some(1)\n * ```\n *\n * @see {@link transform} when you need to change the value, not just validate\n * @see {@link fail} for unconditional failure\n *\n * @category validation\n * @since 4.0.0\n */\nexport function checkEffect(f) {\n return onSome((t, options) => {\n return f(t, options).pipe(Effect.flatMapEager(out => {\n const issue = SchemaIssue.makeSingle(out, t, options);\n return issue ? Effect.fail(issue) : Effect.succeed(Option.some(t));\n }));\n });\n}\n/**\n * Creates a getter that applies a pure function to present values.\n *\n * **When to use**\n *\n * Use when you need a schema getter for a pure, infallible transformation\n * between types.\n * - Building encode/decode pairs for `Schema.decodeTo`.\n *\n * **Details**\n *\n * - This is the most commonly used constructor.\n * - Transforms `Some(e)` to `Some(f(e))` and leaves `None` unchanged.\n * - Skips `None` inputs — only called when a value is present.\n * - Never fails.\n *\n * **Example** (Transforming strings to numbers)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaGetter } from \"effect\"\n *\n * const NumberFromString = Schema.String.pipe(\n * Schema.decodeTo(Schema.Number, {\n * decode: SchemaGetter.transform((s) => Number(s)),\n * encode: SchemaGetter.transform((n) => String(n))\n * })\n * )\n * Schema.decodeSync(NumberFromString)(\"42\") // => 42\n * ```\n *\n * @see {@link transformEffect} when the transformation returns an `Effect`\n * @see {@link transformOptional} when you need to handle `None` inputs\n * @see {@link passthrough} when no transformation is needed\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function transform(f) {\n return transformOptional(Option.map(f));\n}\n/**\n * Creates a getter that applies an effectful transformation to present values.\n *\n * **When to use**\n *\n * Use when you need a schema getter for a transformation that may fail, require\n * Effect services, or run asynchronously.\n *\n * **Details**\n *\n * - Skips `None` inputs — only called when a value is present.\n * - On success, wraps the result in `Some`.\n * - On failure, propagates the `Issue`.\n *\n * **Example** (Parsing with failure)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter, SchemaIssue } from \"effect\"\n *\n * const safeParseInt = SchemaGetter.transformEffect<number, string>(\n * (s, options) => {\n * const n = parseInt(s, 10)\n * return isNaN(n)\n * ? Effect.fail(new SchemaIssue.InvalidValue({ message: \"not an integer\" }, s, options))\n * : Effect.succeed(n)\n * }\n * )\n * await Effect.runPromise(safeParseInt.run(Option.some(\"42\"), {})) // => Option.some(42)\n * ```\n *\n * @see {@link transform} when transformation cannot fail\n * @see {@link onSome} when you need full `Option` control over the output\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function transformEffect(f) {\n return onSome((e, options) => f(e, options).pipe(Effect.mapEager(Option.some)));\n}\n/**\n * Creates a getter that transforms the full `Option` — both present and absent values.\n *\n * **When to use**\n *\n * Use when you need a schema getter to handle both `Some` and `None` cases.\n *\n * **Details**\n *\n * The getter is pure and never fails. It receives the full `Option<E>` and\n * must return `Option<T>`, so it can turn a present value into absent or an\n * absent value into present.\n *\n * **Example** (Filtering out empty strings)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const skipEmpty = SchemaGetter.transformOptional<string, string>((o) =>\n * Option.filter(o, (s) => s.length > 0)\n * )\n * await Effect.runPromise(skipEmpty.run(Option.some(\"\"), {})) // => Option.none()\n * ```\n *\n * @see {@link transform} when you only need to transform present values\n * @see {@link omit} when you always want `None`\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function transformOptional(f) {\n return new Getter(oe => Effect.succeed(f(oe)));\n}\n/**\n * Creates a getter that always returns `None`, effectively omitting the value from output.\n *\n * **When to use**\n *\n * Use when you need a schema getter to exclude a field during decoding or\n * encoding.\n *\n * **Details**\n *\n * - Always returns `Option.None` regardless of input.\n * - Never fails.\n *\n * **Example** (Omitting a field during encoding)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const omitField = SchemaGetter.omit<string>()\n * await Effect.runPromise(omitField.run(Option.some(\"hidden\"), {})) // => Option.none()\n * ```\n *\n * @see {@link transformOptional} when you want conditional omission\n * @see {@link forbidden} when you want to fail instead of silently omit\n *\n * @category filtering\n * @since 4.0.0\n */\nexport function omit() {\n return new Getter(() => Effect.succeedNone);\n}\n/**\n * Creates a getter that replaces `undefined` values with a default.\n *\n * **When to use**\n *\n * Use when you need a schema getter to provide a fallback for a field that may\n * be `undefined` in the encoded input.\n *\n * **Details**\n *\n * - If the input is `Some(undefined)` or `None`, produces `Some(T)`.\n * - If the input is `Some(value)` where value is not `undefined`, passes it through.\n * - `defaultValue` is an `Effect` that will be executed each time a default is needed.\n *\n * **Example** (Providing a default value for an optional field)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const withZero = SchemaGetter.withDefault(Effect.succeed(0))\n * await Effect.runPromise(withZero.run(Option.some(undefined), {})) // => Option.some(0)\n * ```\n *\n * @see {@link onNone} to handle only absent keys (not `undefined` values)\n * @see {@link required} when absent input should fail instead of using a default\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function withDefault(defaultValue) {\n return new Getter(o => {\n const filtered = Option.filter(o, Predicate.isNotUndefined);\n return Option.isSome(filtered) ? Effect.succeed(filtered) : Effect.mapEager(defaultValue, Option.some);\n });\n}\n/**\n * Coerces any value to a `string` using the global `String()` constructor.\n *\n * **When to use**\n *\n * Use when you need a schema getter to coerce a present encoded value to a\n * string with `String()`.\n *\n * **Details**\n *\n * The getter is pure, never fails, and delegates to `globalThis.String`.\n *\n * **Example** (Coercing to a string)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const toString = SchemaGetter.String<number>()\n * await Effect.runPromise(toString.run(Option.some(42), {})) // => Option.some(\"42\")\n * ```\n *\n * @see {@link transform} for custom string conversions\n *\n * @category converting\n * @since 4.0.0\n */\nexport function String() {\n return transform(globalThis.String);\n}\n/**\n * Coerces any value to a `number` using the global `Number()` constructor.\n *\n * **When to use**\n *\n * Use when you need a schema getter to coerce a present encoded value to a\n * number with `Number()`.\n *\n * **Details**\n *\n * The getter is pure, never fails, and delegates to `globalThis.Number`. It may\n * produce `NaN` for non-numeric inputs.\n *\n * **Example** (Coercing to a number)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const toNumber = SchemaGetter.Number<string>()\n * await Effect.runPromise(toNumber.run(Option.some(\"42\"), {})) // => Option.some(42)\n * ```\n *\n * @see {@link transformEffect} for effectful or validated number parsing\n *\n * @category converting\n * @since 4.0.0\n */\nexport function Number() {\n return transform(globalThis.Number);\n}\n/**\n * Coerces any value to a `boolean` using the global `Boolean()` constructor.\n *\n * **When to use**\n *\n * Use when you need a schema getter to coerce a present encoded value to a\n * boolean with `Boolean()`.\n *\n * **Details**\n *\n * The getter is pure, never fails, and delegates to `globalThis.Boolean`.\n *\n * **Example** (Coercing to a boolean)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const toBool = SchemaGetter.Boolean<string>()\n * await Effect.runPromise(toBool.run(Option.some(\"true\"), {})) // => Option.some(true)\n * ```\n *\n * @category converting\n * @since 4.0.0\n */\nexport function Boolean() {\n return transform(globalThis.Boolean);\n}\n/**\n * Coerces a value to `bigint` using the global `BigInt()` constructor.\n *\n * **When to use**\n *\n * Use when you need a schema getter to convert a present string, number, or\n * boolean value to `bigint`.\n *\n * **Details**\n *\n * - Delegates to `globalThis.BigInt`.\n * - Throws at runtime if the input cannot be converted (e.g. non-numeric string).\n *\n * **Example** (Coercing to a bigint)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const toBigInt = SchemaGetter.BigInt<string>()\n * await Effect.runPromise(toBigInt.run(Option.some(\"42\"), {})) // => Option.some(42n)\n * ```\n *\n * @category converting\n * @since 4.0.0\n */\nexport function BigInt() {\n return transform(globalThis.BigInt);\n}\n/**\n * Coerces a value to a `Date` using `new Date(input)`.\n *\n * **When to use**\n *\n * Use when you need a schema getter to coerce a present string, number, or\n * existing date object into a new date object.\n *\n * **Details**\n *\n * - Delegates to `new globalThis.Date(input)`.\n * - Does not validate the result — may produce an invalid Date.\n *\n * **Example** (Coercing to a Date)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const toDate = SchemaGetter.Date<string>()\n * const result = await Effect.runPromise(toDate.run(Option.some(\"1970-01-01\"), {}))\n * Option.map(result, (date) => date.toISOString()) // => Option.some(\"1970-01-01T00:00:00.000Z\")\n * ```\n *\n * @see {@link dateTimeUtcFromInput} for validated DateTime parsing\n *\n * @category converting\n * @since 4.0.0\n */\nexport function Date() {\n return transform(u => new globalThis.Date(u));\n}\n/**\n * Strips whitespace from both ends of a string.\n *\n * **Details**\n *\n * - Pure, delegates to `String.trim`.\n *\n * **Example** (Trimming whitespace)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const trimmed = SchemaGetter.trim<string>()\n * await Effect.runPromise(trimmed.run(Option.some(\" hello \"), {})) // => Option.some(\"hello\")\n * ```\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function trim() {\n return transform(Str.trim);\n}\n/**\n * Capitalizes the first character of a string.\n *\n * **Details**\n *\n * - Pure, delegates to `String.capitalize`.\n *\n * **Example** (Capitalizing a string)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const cap = SchemaGetter.capitalize<string>()\n * await Effect.runPromise(cap.run(Option.some(\"hello\"), {})) // => Option.some(\"Hello\")\n * ```\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function capitalize() {\n return transform(Str.capitalize);\n}\n/**\n * Uncapitalizes the first character of a string.\n *\n * **Details**\n *\n * - Pure, delegates to `String.uncapitalize`.\n *\n * **Example** (Uncapitalizing a string)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const uncap = SchemaGetter.uncapitalize<string>()\n * await Effect.runPromise(uncap.run(Option.some(\"Hello\"), {})) // => Option.some(\"hello\")\n * ```\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function uncapitalize() {\n return transform(Str.uncapitalize);\n}\n/**\n * Converts a `snake_case` string to `camelCase`.\n *\n * **Details**\n *\n * - Pure, delegates to `String.snakeToCamel`.\n *\n * **Example** (Converting snake case to camel case)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const toCamel = SchemaGetter.snakeToCamel<string>()\n * await Effect.runPromise(toCamel.run(Option.some(\"user_name\"), {})) // => Option.some(\"userName\")\n * ```\n *\n * @see {@link camelToSnake} for the inverse operation\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function snakeToCamel() {\n return transform(Str.snakeToCamel);\n}\n/**\n * Converts a `camelCase` string to `snake_case`.\n *\n * **Details**\n *\n * - Pure, delegates to `String.camelToSnake`.\n *\n * **Example** (Converting camel case to snake case)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const toSnake = SchemaGetter.camelToSnake<string>()\n * await Effect.runPromise(toSnake.run(Option.some(\"userName\"), {})) // => Option.some(\"user_name\")\n * ```\n *\n * @see {@link snakeToCamel} for the inverse operation\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function camelToSnake() {\n return transform(Str.camelToSnake);\n}\n/**\n * Converts a string to lowercase.\n *\n * **Details**\n *\n * - Pure, delegates to `String.toLowerCase`.\n *\n * **Example** (Converting to lowercase)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const lower = SchemaGetter.toLowerCase<string>()\n * await Effect.runPromise(lower.run(Option.some(\"HELLO\"), {})) // => Option.some(\"hello\")\n * ```\n *\n * @see {@link toUpperCase} for the inverse operation\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function toLowerCase() {\n return transform(Str.toLowerCase);\n}\n/**\n * Converts a string to uppercase.\n *\n * **Details**\n *\n * - Pure, delegates to `String.toUpperCase`.\n *\n * **Example** (Converting to uppercase)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const upper = SchemaGetter.toUpperCase<string>()\n * await Effect.runPromise(upper.run(Option.some(\"hello\"), {})) // => Option.some(\"HELLO\")\n * ```\n *\n * @see {@link toLowerCase} for the inverse operation\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function toUpperCase() {\n return transform(Str.toUpperCase);\n}\nexport function parseJson(options) {\n return onSome((input, parseOptions) => Effect.try({\n try: () => Option.some(JSON.parse(input, options?.reviver)),\n catch: () => new SchemaIssue.InvalidValue({\n expected: \"a valid JSON string\"\n }, input, parseOptions)\n }));\n}\n/**\n * Stringifies a present value using `JSON.stringify`.\n *\n * **When to use**\n *\n * Use when you need a schema getter to serialize a present decoded value to\n * JSON text during encoding.\n *\n * **Details**\n *\n * - Skips `None` inputs.\n * - If `JSON.stringify` throws or returns `undefined`, fails with\n * `SchemaIssue.InvalidValue`.\n * - Supports optional `replacer` and `space` options, matching\n * `JSON.stringify`.\n *\n * **Example** (Stringifying JSON)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const stringify = SchemaGetter.stringifyJson()\n * await Effect.runPromise(stringify.run(Option.some({ a: 1 }), {})) // => Option.some(\"{\\\"a\\\":1}\")\n * ```\n *\n * @see {@link parseJson} for the inverse operation\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function stringifyJson(options) {\n return onSome((input, parseOptions) => Effect.try({\n try: () => {\n const output = JSON.stringify(input, options?.replacer, options?.space);\n if (output === undefined) {\n throw new TypeError(\"Value cannot be represented as JSON\");\n }\n return Option.some(output);\n },\n catch: () => new SchemaIssue.InvalidValue({\n expected: \"a JSON-serializable value\"\n }, input, parseOptions)\n }));\n}\n/**\n * Parses a string into a record of key-value pairs.\n *\n * **When to use**\n *\n * Use when you need a schema getter to parse a present encoded string that\n * contains delimited key-value pairs (e.g. `\"a=1,b=2\"`).\n *\n * **Details**\n *\n * The getter is pure and never fails. It splits the string by `separator`\n * (default `,`) and then each pair by `keyValueSeparator` (default `=`). Pairs\n * missing a key or value are silently skipped.\n *\n * **Example** (Parsing a key-value string)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const parse = SchemaGetter.splitKeyValue<string>()\n * await Effect.runPromise(parse.run(Option.some(\"a=1,b=2\"), {})) // => Option.some({ a: \"1\", b: \"2\" })\n * ```\n *\n * @see {@link joinKeyValue} for the inverse operation\n * @see {@link split} to split into an array of strings\n *\n * @category splitting\n * @since 4.0.0\n */\nexport function splitKeyValue(options) {\n const separator = options?.separator ?? \",\";\n const keyValueSeparator = options?.keyValueSeparator ?? \"=\";\n return transform(input => input.split(separator).reduce((acc, pair) => {\n const [key, value] = pair.split(keyValueSeparator);\n if (key && value) {\n InternalRecord.assignProperty(acc, key, value);\n }\n return acc;\n }, {}));\n}\n/**\n * Joins a record of key-value pairs into a delimited string.\n *\n * **When to use**\n *\n * Use when you need a schema getter to serialize a present decoded record as a\n * delimited key-value string.\n *\n * **Details**\n *\n * The getter is pure and never fails. It joins entries with `separator`\n * (default `,`) and joins each key and value with `keyValueSeparator` (default\n * `=`).\n *\n * **Example** (Joining key-value records)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const join = SchemaGetter.joinKeyValue()\n * await Effect.runPromise(join.run(Option.some({ a: \"1\", b: \"2\" }), {})) // => Option.some(\"a=1,b=2\")\n * ```\n *\n * @see {@link splitKeyValue} for the inverse operation\n *\n * @category combining\n * @since 4.0.0\n */\nexport function joinKeyValue(options) {\n const separator = options?.separator ?? \",\";\n const keyValueSeparator = options?.keyValueSeparator ?? \"=\";\n return transform(input => Object.entries(input).map(([key, value]) => `${key}${keyValueSeparator}${value}`).join(separator));\n}\n/**\n * Splits a string into an array of strings by a separator.\n *\n * **When to use**\n *\n * Use when you need a schema getter to split a present encoded string\n * containing a delimited list, such as CSV values.\n *\n * **Details**\n *\n * The getter is pure and never fails. It splits by `separator` (default `,`).\n * An empty string produces an empty array, not `[\"\"]`.\n *\n * **Example** (Splitting a comma-separated string)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const splitComma = SchemaGetter.split<string>()\n * await Effect.runPromise(splitComma.run(Option.some(\"a,b,c\"), {})) // => Option.some([\"a\", \"b\", \"c\"])\n * ```\n *\n * @see {@link splitKeyValue} when values are key-value pairs\n *\n * @category splitting\n * @since 4.0.0\n */\nexport function split(options) {\n const separator = options?.separator ?? \",\";\n return transform(input => input === \"\" ? [] : input.split(separator));\n}\n/**\n * Encodes a `Uint8Array` or string to a Base64 string.\n *\n * **Details**\n *\n * The getter is pure and never fails.\n *\n * **Example** (Encoding to Base64)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const encode = SchemaGetter.encodeBase64<Uint8Array>()\n * await Effect.runPromise(encode.run(Option.some(new Uint8Array([1, 2, 3])), {})) // => Option.some(\"AQID\")\n * ```\n *\n * @see {@link decodeBase64} for the inverse operation to `Uint8Array`\n * @see {@link decodeBase64String} for the inverse operation to `string`\n * @see {@link encodeBase64Url} for the URL-safe variant\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeBase64() {\n return transform(Encoding.encodeBase64);\n}\n/**\n * Encodes a `Uint8Array` or string to a URL-safe Base64 string.\n *\n * **Details**\n *\n * The getter is pure and never fails.\n *\n * **Example** (Encoding to Base64Url)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const encode = SchemaGetter.encodeBase64Url<Uint8Array>()\n * await Effect.runPromise(encode.run(Option.some(new Uint8Array([251, 255])), {})) // => Option.some(\"-_8\")\n * ```\n *\n * @see {@link decodeBase64Url} for the inverse operation to `Uint8Array`\n * @see {@link decodeBase64UrlString} for the inverse operation to `string`\n * @see {@link encodeBase64} for the standard Base64 variant\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeBase64Url() {\n return transform(Encoding.encodeBase64Url);\n}\n/**\n * Encodes a `Uint8Array` or string to a hexadecimal string.\n *\n * **Details**\n *\n * The getter is pure and never fails.\n *\n * **Example** (Encoding to hex)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const encode = SchemaGetter.encodeHex<Uint8Array>()\n * await Effect.runPromise(encode.run(Option.some(new Uint8Array([1, 2, 3])), {})) // => Option.some(\"010203\")\n * ```\n *\n * @see {@link decodeHex} for the inverse operation to `Uint8Array`\n * @see {@link decodeHexString} for the inverse operation to `string`\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeHex() {\n return transform(Encoding.encodeHex);\n}\n/**\n * Decodes a Base64 string to a `Uint8Array`.\n *\n * **Details**\n *\n * - Fails with `SchemaIssue.InvalidValue` if the input is not valid Base64.\n *\n * **Example** (Decoding Base64 to bytes)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const decode = SchemaGetter.decodeBase64<string>()\n * const result = await Effect.runPromise(decode.run(Option.some(\"AQID\"), {}))\n * Option.map(result, Array.from) // => Option.some([1, 2, 3])\n * ```\n *\n * @see {@link decodeBase64String} to decode to `string` instead\n * @see {@link encodeBase64} for the inverse operation\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeBase64() {\n return transformEffect((input, options) => Effect.mapErrorEager(Effect.fromResult(Encoding.decodeBase64(input)), () => new SchemaIssue.InvalidValue({\n expected: \"a valid Base64 string\"\n }, input, options)));\n}\n/**\n * Decodes a Base64 string to a UTF-8 `string`.\n *\n * **Details**\n *\n * - Fails with `SchemaIssue.InvalidValue` if the input is not valid Base64.\n *\n * **Example** (Decoding Base64 to string)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const decode = SchemaGetter.decodeBase64String<string>()\n * await Effect.runPromise(decode.run(Option.some(\"aGVsbG8=\"), {})) // => Option.some(\"hello\")\n * ```\n *\n * @see {@link decodeBase64} to decode to `Uint8Array` instead\n * @see {@link encodeBase64} for the inverse operation\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeBase64String() {\n return transformEffect((input, options) => Result.match(Encoding.decodeBase64String(input), {\n onFailure: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid Base64 string\"\n }, input, options)),\n onSuccess: Effect.succeed\n }));\n}\n/**\n * Decodes a URL-safe Base64 string to a `Uint8Array`.\n *\n * **Details**\n *\n * - Fails with `SchemaIssue.InvalidValue` if the input is not valid Base64Url.\n *\n * **Example** (Decoding Base64Url to bytes)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const decode = SchemaGetter.decodeBase64Url<string>()\n * const result = await Effect.runPromise(decode.run(Option.some(\"-_8=\"), {}))\n * Option.map(result, Array.from) // => Option.some([251, 255])\n * ```\n *\n * @see {@link decodeBase64UrlString} to decode to `string` instead\n * @see {@link encodeBase64Url} for the inverse operation\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeBase64Url() {\n return transformEffect((input, options) => Result.match(Encoding.decodeBase64Url(input), {\n onFailure: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid Base64Url string\"\n }, input, options)),\n onSuccess: Effect.succeed\n }));\n}\n/**\n * Decodes a URL-safe Base64 string to a UTF-8 `string`.\n *\n * **Details**\n *\n * - Fails with `SchemaIssue.InvalidValue` if the input is not valid Base64Url.\n *\n * **Example** (Decoding Base64Url to string)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const decode = SchemaGetter.decodeBase64UrlString<string>()\n * await Effect.runPromise(decode.run(Option.some(\"aGVsbG8\"), {})) // => Option.some(\"hello\")\n * ```\n *\n * @see {@link decodeBase64Url} to decode to `Uint8Array` instead\n * @see {@link encodeBase64Url} for the inverse operation\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeBase64UrlString() {\n return transformEffect((input, options) => Result.match(Encoding.decodeBase64UrlString(input), {\n onFailure: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid Base64Url string\"\n }, input, options)),\n onSuccess: Effect.succeed\n }));\n}\n/**\n * Decodes a hexadecimal string to a `Uint8Array`.\n *\n * **Details**\n *\n * - Fails with `SchemaIssue.InvalidValue` if the input is not valid hex.\n *\n * **Example** (Decoding hex to bytes)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const decode = SchemaGetter.decodeHex<string>()\n * const result = await Effect.runPromise(decode.run(Option.some(\"010203\"), {}))\n * Option.map(result, Array.from) // => Option.some([1, 2, 3])\n * ```\n *\n * @see {@link decodeHexString} to decode to `string` instead\n * @see {@link encodeHex} for the inverse operation\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeHex() {\n return transformEffect((input, options) => Result.match(Encoding.decodeHex(input), {\n onFailure: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid hexadecimal string\"\n }, input, options)),\n onSuccess: Effect.succeed\n }));\n}\n/**\n * Decodes a hexadecimal string to a UTF-8 `string`.\n *\n * **Details**\n *\n * - Fails with `SchemaIssue.InvalidValue` if the input is not valid hex.\n *\n * **Example** (Decoding hex to string)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const decode = SchemaGetter.decodeHexString<string>()\n * await Effect.runPromise(decode.run(Option.some(\"68656c6c6f\"), {})) // => Option.some(\"hello\")\n * ```\n *\n * @see {@link decodeHex} to decode to `Uint8Array` instead\n * @see {@link encodeHex} for the inverse operation\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeHexString() {\n return transformEffect((input, options) => Result.match(Encoding.decodeHexString(input), {\n onFailure: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid hexadecimal string\"\n }, input, options)),\n onSuccess: Effect.succeed\n }));\n}\n/**\n * Encodes a present string using `encodeURIComponent`.\n *\n * **Details**\n *\n * - Skips `None` inputs.\n * - May throw a `URIError` for malformed surrogate pairs; this exception is not\n * converted into an `Issue`.\n *\n * **Example** (Encoding a URI component)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const encode = SchemaGetter.encodeUriComponent<string>()\n * await Effect.runPromise(encode.run(Option.some(\"hello world\"), {})) // => Option.some(\"hello%20world\")\n * ```\n *\n * @see {@link decodeUriComponent} for the inverse operation\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeUriComponent() {\n return transform(encodeURIComponent);\n}\n/**\n * Decodes a URI component encoded string using `decodeURIComponent`.\n *\n * **Details**\n *\n * - Fails with `SchemaIssue.InvalidValue` if the input contains malformed percent-encoding sequences.\n *\n * **Example** (Decoding a URI component)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const decode = SchemaGetter.decodeUriComponent<string>()\n * await Effect.runPromise(decode.run(Option.some(\"hello%20world\"), {})) // => Option.some(\"hello world\")\n * ```\n *\n * @see {@link encodeUriComponent} for the inverse operation\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeUriComponent() {\n return transformEffect((input, options) => {\n try {\n return Effect.succeed(globalThis.decodeURIComponent(input));\n } catch {\n return Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid URI component\"\n }, input, options));\n }\n });\n}\n/**\n * Parses a `DateTime.Input` value into a `DateTime.Utc`.\n *\n * **When to use**\n *\n * Use when you need a schema getter to decode a present encoded date/time value\n * to a `DateTime.Utc`.\n *\n * **Details**\n *\n * - Accepted input includes existing `DateTime` values, partial date/time parts,\n * instant objects, zoned instant objects, JavaScript `Date` instances, epoch\n * milliseconds, and date strings.\n * - Converts successfully parsed values to UTC.\n * - Fails with `SchemaIssue.InvalidValue` if the input cannot be parsed as a valid\n * `DateTime`.\n *\n * **Example** (Parsing DateTime)\n *\n * ```ts import.meta.vitest\n * import { DateTime, Effect, Option, SchemaGetter } from \"effect\"\n *\n * const parseDate = SchemaGetter.dateTimeUtcFromInput<string>()\n * const result = await Effect.runPromise(parseDate.run(Option.some(\"2024-01-01T00:00:00Z\"), {}))\n * Option.map(result, DateTime.toEpochMillis) // => Option.some(1704067200000)\n * ```\n *\n * @see {@link Date} for a simpler coercion to `Date` (no validation)\n *\n * @category converting\n * @since 4.0.0\n */\nexport function dateTimeUtcFromInput() {\n return transformEffect((input, options) => {\n return Option.match(DateTime.make(input), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n message: \"Invalid DateTime input\"\n }, input, options)),\n onSome: dt => Effect.succeed(DateTime.toUtc(dt))\n });\n });\n}\n/**\n * Decodes a `FormData` object into a nested tree structure using bracket-path notation.\n *\n * **When to use**\n *\n * Use when you need a schema getter to parse `FormData` from HTTP requests into\n * structured objects.\n *\n * **Details**\n *\n * The getter is pure and never fails. It interprets bracket-path keys such as\n * `user[name]` and `items[0]` to build nested objects or arrays, and each leaf\n * value is a `string` or `Blob`.\n *\n * **Example** (Decoding FormData)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const decode = SchemaGetter.decodeFormData()\n * const formData = new FormData()\n * formData.append(\"user[name]\", \"Alice\")\n * await Effect.runPromise(decode.run(Option.some(formData), {})) // => Option.some({ user: { name: \"Alice\" } })\n * ```\n *\n * @see {@link encodeFormData} for the corresponding encoder\n * @see {@link makeTreeRecord} for the underlying bracket-path parser\n * @see {@link decodeURLSearchParams} for the URLSearchParams variant\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeFormData() {\n return transform(input => makeTreeRecord(Array.from(input.entries())));\n}\nconst collectFormDataEntries = /*#__PURE__*/collectBracketPathEntries(value => typeof value === \"string\" || typeof Blob !== \"undefined\" && value instanceof Blob);\n/**\n * Encodes a nested object into a `FormData` instance using bracket-path notation.\n *\n * **When to use**\n *\n * Use when you need a schema getter to serialize structured data to `FormData`\n * for HTTP requests.\n *\n * **Details**\n *\n * The getter is pure and never fails. It flattens nested objects or arrays into\n * bracket-path keys such as `user[name]` and `items[0]`. Non-object inputs\n * produce an empty `FormData`.\n *\n * **Example** (Encoding to FormData)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const encode = SchemaGetter.encodeFormData()\n * const result = await Effect.runPromise(encode.run(Option.some({ name: \"Alice\" }), {}))\n * Option.map(result, (formData) => formData.get(\"name\")) // => Option.some(\"Alice\")\n * ```\n *\n * @see {@link decodeFormData} for the corresponding decoder\n * @see {@link collectBracketPathEntries} for the underlying flattener\n * @see {@link encodeURLSearchParams} for the URLSearchParams variant\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeFormData() {\n return transform(input => {\n const out = new FormData();\n if (typeof input === \"object\" && input !== null) {\n const entries = collectFormDataEntries(input);\n entries.forEach(([key, value]) => {\n out.append(key, value);\n });\n }\n return out;\n });\n}\n/**\n * Decodes a `URLSearchParams` object into a nested tree structure using bracket-path notation.\n *\n * **When to use**\n *\n * Use when you need a schema getter to parse query parameters from URLs into\n * structured objects.\n *\n * **Details**\n *\n * The getter is pure and never fails. It interprets bracket-path keys such as\n * `user[name]` and `items[0]` to build nested objects or arrays, and each leaf\n * value is a `string`.\n *\n * **Example** (Decoding URLSearchParams)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const decode = SchemaGetter.decodeURLSearchParams()\n * const params = new URLSearchParams(\"user[name]=Alice\")\n * await Effect.runPromise(decode.run(Option.some(params), {})) // => Option.some({ user: { name: \"Alice\" } })\n * ```\n *\n * @see {@link encodeURLSearchParams} for the corresponding encoder\n * @see {@link makeTreeRecord} for the underlying bracket-path parser\n * @see {@link decodeFormData} for the FormData variant\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeURLSearchParams() {\n return transform(input => makeTreeRecord(Array.from(input.entries())));\n}\nconst collectURLSearchParamsEntries = /*#__PURE__*/collectBracketPathEntries(Predicate.isString);\n/**\n * Encodes a nested object into a `URLSearchParams` instance using bracket-path notation.\n *\n * **When to use**\n *\n * Use when you need a schema getter to serialize structured data to query\n * parameters for URLs.\n *\n * **Details**\n *\n * The getter is pure and never fails. It flattens nested objects or arrays into\n * bracket-path keys. Non-object inputs produce an empty `URLSearchParams`.\n *\n * **Example** (Encoding to URLSearchParams)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const encode = SchemaGetter.encodeURLSearchParams()\n * const result = await Effect.runPromise(encode.run(Option.some({ name: \"Alice\" }), {}))\n * Option.map(result, (params) => params.toString()) // => Option.some(\"name=Alice\")\n * ```\n *\n * @see {@link decodeURLSearchParams} for the corresponding decoder\n * @see {@link collectBracketPathEntries} for the underlying flattener\n * @see {@link encodeFormData} for the FormData variant\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeURLSearchParams() {\n return transform(input => {\n if (typeof input === \"object\" && input !== null) {\n return new URLSearchParams(collectURLSearchParamsEntries(input));\n }\n return new URLSearchParams();\n });\n}\nfunction bracketPathToTokens(bracketPath) {\n // real empty path (from append(\"\", value))\n if (bracketPath === \"\") {\n return [\"\"];\n }\n const replaced = bracketPath.replace(/\\[(.*?)\\]/g, \".$1\");\n const parts = replaced.split(\".\");\n // if bracket path started with \"[...]\" we get \".foo\" => [\"\", \"foo\"]; drop the synthetic first \"\"\n const start = replaced.startsWith(\".\") ? 1 : 0;\n return parts.slice(start).map(part => Arr.isCanonicalArrayIndex(part) ? globalThis.Number(part) : part);\n}\n/**\n * Builds a nested tree object from a list of bracket-path entries.\n *\n * **When to use**\n *\n * Use when you need a schema getter to parse FormData or URLSearchParams\n * entries into structured objects.\n * - You have flat key-value pairs with bracket-path keys that need nesting.\n *\n * **Details**\n *\n * - A bracket path is a string like `\"user[address][city]\"` that describes nested\n * object/array structure.\n * - Interprets bracket paths and constructs the corresponding nested object.\n * - Builds and returns a nested object from the input entries.\n * - Supported syntax:\n * - `\"foo\"` → object key `\"foo\"`\n * - `\"foo[bar]\"` → nested `{ foo: { bar: ... } }`\n * - `\"foo[0]\"` → array index `{ foo: [value] }`\n * - `\"foo[]\"` → append to array `foo`\n * - `\"\"` → real empty key\n * - Numeric bracket segments become array indices only when they are valid\n * JavaScript array-index strings; otherwise they remain object keys.\n * - Duplicate keys for the same path are merged into arrays.\n * - If a structural path conflicts with a previous leaf or a different container\n * type, the later structural path replaces the conflicting value.\n * - The notation has no escaping for `.`, `[` or `]`, so keys containing these\n * delimiters cannot be round-tripped without changing their structure.\n *\n * **Example** (Building a tree from bracket paths)\n *\n * ```ts import.meta.vitest\n * import { SchemaGetter } from \"effect\"\n *\n * SchemaGetter.makeTreeRecord([\n * [\"user[name]\", \"Alice\"],\n * [\"user[tags][]\", \"admin\"],\n * [\"user[tags][]\", \"editor\"]\n * ]) // => { user: { name: \"Alice\", tags: [\"admin\", \"editor\"] } }\n * ```\n *\n * @see {@link collectBracketPathEntries} for flattening trees into bracket-path entries\n * @see {@link decodeFormData} for a higher-level FormData decoder\n * @see {@link decodeURLSearchParams} for a higher-level URLSearchParams decoder\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function makeTreeRecord(bracketPathEntries) {\n const out = {};\n const containers = new WeakSet();\n const duplicates = new WeakSet();\n function getOrCreateContainer(self, key, shouldBeArray) {\n const current = Object.hasOwn(self, key) ? self[key] : undefined;\n if (containers.has(current) && Array.isArray(current) === shouldBeArray) {\n return current;\n }\n const container = shouldBeArray ? [] : {};\n containers.add(container);\n InternalRecord.assignProperty(self, key, container);\n return container;\n }\n bracketPathEntries.forEach(([key, value]) => {\n const tokens = bracketPathToTokens(key);\n let cur = out;\n tokens.forEach((token, i) => {\n const isLast = i === tokens.length - 1;\n // We are inside an array and see \"[]\" (empty token) => append\n if (Array.isArray(cur) && token === \"\") {\n if (isLast) {\n cur.push(value);\n } else {\n // bracket path: \"foo[][bar]\" => push a new element and descend into it\n const next = tokens[i + 1];\n const shouldBeArray = typeof next === \"number\" || next === \"\";\n const index = cur.length;\n cur = getOrCreateContainer(cur, index, shouldBeArray);\n }\n } else if (isLast) {\n // If we're setting a value at a path that already exists\n // convert it to an array to support multiple values for the same key\n const hasOwn = Object.hasOwn(cur, token);\n if (hasOwn && Array.isArray(cur[token]) && (containers.has(cur[token]) || duplicates.has(cur[token]))) {\n cur[token].push(value);\n } else if (hasOwn) {\n const values = [cur[token], value];\n duplicates.add(values);\n InternalRecord.assignProperty(cur, token, values);\n } else {\n InternalRecord.assignProperty(cur, token, value);\n }\n } else {\n const next = tokens[i + 1];\n // if next is a number OR \"\" (from []), we are building an array\n const shouldBeArray = typeof next === \"number\" || next === \"\";\n cur = getOrCreateContainer(cur, token, shouldBeArray);\n }\n });\n });\n return out;\n}\n/**\n * Flattens a nested object into bracket-path entries, filtering leaf values by a type guard.\n *\n * **When to use**\n *\n * Use when you need a schema getter to serialize structured objects to flat\n * key-value entries.\n * - Building custom `FormData` or `URLSearchParams` encoders.\n *\n * **Details**\n *\n * - Takes a nested object and produces flat `[bracketPath, value]` pairs suitable for\n * `FormData` or `URLSearchParams`.\n * - Returns a curried function: first call provides the leaf type guard, second call provides the object.\n * - Recursively traverses objects and arrays.\n * - If all elements of an array are leaves, encodes them as multiple entries with the same key\n * (e.g. `tags=a&tags=b`). Otherwise uses indexed bracket paths (e.g. `items[0]`, `items[1]`).\n * - Non-leaf values that aren't objects or arrays are silently skipped.\n * - Empty arrays and objects produce no entries, and path delimiters in property\n * names are not escaped. The resulting format is therefore lossy.\n *\n * **Example** (Flattening an object to bracket paths)\n *\n * ```ts import.meta.vitest\n * import { Predicate, SchemaGetter } from \"effect\"\n *\n * const collectStrings = SchemaGetter.collectBracketPathEntries(Predicate.isString)\n * const entries = collectStrings({ user: { name: \"Alice\", tags: [\"admin\", \"editor\"] } })\n *\n * entries // => [[\"user[name]\", \"Alice\"], [\"user[tags]\", \"admin\"], [\"user[tags]\", \"editor\"]]\n * ```\n *\n * @see {@link makeTreeRecord} for building trees from bracket-path entries\n * @see {@link encodeFormData} for a higher-level FormData encoder\n * @see {@link encodeURLSearchParams} for a higher-level URLSearchParams encoder\n *\n * @category converting\n * @since 4.0.0\n */\nexport function collectBracketPathEntries(isLeaf) {\n return input => {\n const bracketPathEntries = [];\n function append(key, value) {\n if (isLeaf(value)) {\n bracketPathEntries.push([key, value]);\n } else if (Array.isArray(value)) {\n // If all values are leaves, encode as multiple entries with the same key\n const allLeaves = value.every(isLeaf);\n if (allLeaves) {\n value.forEach(v => {\n bracketPathEntries.push([key, v]);\n });\n } else {\n value.forEach((v, i) => {\n append(`${key}[${i}]`, v);\n });\n }\n } else if (typeof value === \"object\" && value !== null) {\n for (const [k, v] of Object.entries(value)) {\n append(`${key}[${k}]`, v);\n }\n }\n }\n for (const [key, value] of Object.entries(input)) {\n append(key, value);\n }\n return bracketPathEntries;\n };\n}\n//# sourceMappingURL=SchemaGetter.js.map","/**\n * Builds two-way conversions used by schemas.\n *\n * A `Transformation<T, E>` describes how to decode an encoded value into a\n * decoded value and how to encode it back again. Schema APIs use\n * transformations to connect two representations, such as a string and a\n * number, a JSON value and a richer TypeScript value, or a form field and an\n * application value. This module includes transformation and middleware types,\n * constructors for pure or effectful conversions, and common conversions used\n * by the Schema module.\n *\n * @since 4.0.0\n */\nimport * as BigDecimal from \"./BigDecimal.js\";\nimport * as ByteSize from \"./ByteSize.js\";\nimport * as DateTime from \"./DateTime.js\";\nimport * as Duration from \"./Duration.js\";\nimport * as Effect from \"./Effect.js\";\nimport { format, formatDate, formatJson } from \"./Formatter.js\";\nimport * as Option from \"./Option.js\";\nimport * as Predicate from \"./Predicate.js\";\nimport * as SchemaGetter from \"./SchemaGetter.js\";\nimport * as SchemaIssue from \"./SchemaIssue.js\";\n/**\n * Constructs schema middleware from its decode and encode functions.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Middleware = class {\n _tag = \"Middleware\";\n decode;\n encode;\n constructor(decode, encode) {\n this.decode = decode;\n this.encode = encode;\n }\n flip() {\n return new Middleware(this.encode, this.decode);\n }\n};\nconst TypeId = \"~effect/SchemaTransformation/Transformation\";\n/**\n * Constructs a bidirectional schema transformation from its decode and encode getters.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Transformation = class {\n [TypeId] = TypeId;\n _tag = \"Transformation\";\n decode;\n encode;\n constructor(decode, encode) {\n this.decode = decode;\n this.encode = encode;\n }\n flip() {\n return new Transformation(this.encode, this.decode);\n }\n compose(other) {\n return new Transformation(this.decode.compose(other.decode), other.encode.compose(this.encode));\n }\n};\n/**\n * Returns `true` if `u` is a `Transformation` instance.\n *\n * **When to use**\n *\n * Use to check whether a value is already a schema transformation before\n * wrapping it.\n *\n * **Details**\n *\n * - Pure predicate, no side effects.\n * - Acts as a TypeScript type guard.\n *\n * **Example** (Checking a value)\n *\n * ```ts import.meta.vitest\n * import { SchemaTransformation } from \"effect\"\n *\n * SchemaTransformation.isTransformation(SchemaTransformation.trim()) // => true\n * SchemaTransformation.isTransformation({ decode: null, encode: null }) // => false\n * ```\n *\n * @see {@link Transformation}\n * @see {@link make}\n *\n * @category guards\n * @since 4.0.0\n */\nexport function isTransformation(u) {\n return Predicate.hasProperty(u, TypeId) && u[TypeId] === TypeId;\n}\n/**\n * Constructs a `Transformation` from an object with `decode` and `encode`\n * `Getter`s. If the input is already a `Transformation`, returns it as-is.\n *\n * **When to use**\n *\n * Use when you already have schema getter instances and want to pair them into\n * a schema transformation.\n * - You want idempotent wrapping (won't double-wrap).\n *\n * **Details**\n *\n * - Returns the input unchanged if it is already a `Transformation`.\n *\n * **Example** (Wrapping existing getters)\n *\n * ```ts import.meta.vitest\n * import { SchemaGetter, SchemaTransformation } from \"effect\"\n *\n * const t = SchemaTransformation.make({\n * decode: SchemaGetter.transform<number, string>((s) => Number(s)),\n * encode: SchemaGetter.transform<string, number>((n) => String(n))\n * })\n * t._tag // => \"Transformation\"\n * ```\n *\n * @see {@link transform} — simpler constructor from pure functions\n * @see {@link transformEffect} — constructor from effectful functions\n * @see {@link Transformation}\n *\n * @category constructors\n * @since 3.10.0\n */\nexport const make = options => {\n if (isTransformation(options)) {\n return options;\n }\n return new Transformation(options.decode, options.encode);\n};\n/**\n * Creates a `Transformation` from effectful decode and encode functions.\n *\n * **When to use**\n *\n * Use when you need a schema transformation that may fail or require Effect\n * services.\n *\n * **Details**\n *\n * - Each function receives the input value and `ParseOptions`.\n * - Must return an `Effect` that succeeds with the output or fails with `Issue`.\n * - Skips `None` inputs (missing keys) — functions are only called on present values.\n *\n * **Example** (Parsing a date string that can fail)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, Schema, SchemaIssue, SchemaTransformation } from \"effect\"\n *\n * const DateFromString = Schema.String.pipe(\n * Schema.decodeTo(\n * Schema.Date,\n * SchemaTransformation.transformEffect({\n * decode: (s, options) => {\n * const d = new Date(s)\n * return isNaN(d.getTime())\n * ? Effect.fail(new SchemaIssue.InvalidValue({ message: \"Invalid date\" }, s, options))\n * : Effect.succeed(d)\n * },\n * encode: (d) => Effect.succeed(d.toISOString())\n * })\n * )\n * )\n * Schema.decodeSync(DateFromString)(\"2024-01-01\").toISOString() // => \"2024-01-01T00:00:00.000Z\"\n * ```\n *\n * @see {@link transform} — for infallible, pure transformations\n * @see {@link transformOptional} — for transformations that handle missing keys\n * @see {@link make} — for transformations from existing Getters\n *\n * @category transforming\n * @since 3.10.0\n */\nexport function transformEffect(options) {\n return new Transformation(SchemaGetter.transformEffect(options.decode), SchemaGetter.transformEffect(options.encode));\n}\n/**\n * Creates a `Transformation` from pure (sync, infallible) decode and encode\n * functions.\n *\n * **When to use**\n *\n * Use when you need an infallible schema transformation that does not require\n * Effect services.\n *\n * **Details**\n *\n * - Each function receives the input and returns the output directly.\n * - Skips `None` inputs (missing keys) — functions are only called on present values.\n * - Does not allocate Effects internally; uses optimized sync path.\n *\n * **Example** (Converting between cents and dollars)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const CentsFromDollars = Schema.Number.pipe(\n * Schema.decodeTo(\n * Schema.Number,\n * SchemaTransformation.transform({\n * decode: (dollars) => dollars * 100,\n * encode: (cents) => cents / 100\n * })\n * )\n * )\n * Schema.decodeSync(CentsFromDollars)(2.5) // => 250\n * ```\n *\n * @see {@link transformEffect} — for fallible or effectful transformations\n * @see {@link transformOptional} — for transformations that handle missing keys\n * @see {@link passthrough} — when no conversion is needed\n *\n * @category transforming\n * @since 3.10.0\n */\nexport function transform(options) {\n return new Transformation(SchemaGetter.transform(options.decode), SchemaGetter.transform(options.encode));\n}\n/**\n * Creates a `Transformation` where decode and encode operate on `Option`\n * values, giving full control over missing-key handling.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to produce or consume `Option.None`\n * for absent keys.\n * - You are working with optional struct fields.\n *\n * **Details**\n *\n * - Each function receives `Option<input>` and returns `Option<output>`.\n * - `Option.None` input means the key is absent; returning `Option.None`\n * omits the key from the output.\n * - Pure and synchronous.\n *\n * **Example** (Converting an optional key to Option)\n *\n * ```ts import.meta.vitest\n * import { Option, Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.Struct({\n * a: Schema.optionalKey(Schema.Number).pipe(\n * Schema.decodeTo(\n * Schema.Option(Schema.Number),\n * SchemaTransformation.transformOptional({\n * decode: Option.some,\n * encode: Option.flatten\n * })\n * )\n * )\n * })\n * Schema.decodeSync(schema)({}).a // => Option.none()\n * ```\n *\n * @see {@link transform} — when you don't need Option-level control\n * @see {@link optionFromOptionalKey} — built-in for the common optional-key-to-Option pattern\n * @see {@link optionFromOptional} — built-in for optional (undefined) to Option\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function transformOptional(options) {\n return new Transformation(SchemaGetter.transformOptional(options.decode), SchemaGetter.transformOptional(options.encode));\n}\n/**\n * Transforms strings by trimming whitespace on decode.\n * Encode is passthrough (no change).\n *\n * **When to use**\n *\n * Use when you need a schema transformation to normalize user input by\n * stripping leading/trailing whitespace.\n *\n * **Details**\n *\n * Decoding applies `String.prototype.trim()`. Encoding is passthrough and\n * returns the string unchanged. This is not round-trippable if the original had\n * whitespace.\n *\n * **Example** (Trimming on decode)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const Trimmed = Schema.String.pipe(\n * Schema.decode(SchemaTransformation.trim())\n * )\n * Schema.decodeSync(Trimmed)(\" hello \") // => \"hello\"\n * ```\n *\n * @see {@link toLowerCase}\n * @see {@link toUpperCase}\n * @see {@link snakeToCamel}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function trim() {\n return new Transformation(SchemaGetter.trim(), SchemaGetter.passthrough());\n}\n/**\n * Transforms strings by converting snake_case to camelCase\n * on decode and camelCase to snake_case on encode.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to convert API field names between\n * snake_case and camelCase conventions.\n *\n * **Details**\n *\n * Decoding converts values such as `\"my_field_name\"` to `\"myFieldName\"`.\n * Encoding converts values such as `\"myFieldName\"` back to `\"my_field_name\"`.\n * The transformation is round-trippable for standard snake_case and camelCase.\n *\n * **Example** (Converting snake case to camel case)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const SnakeToCamel = Schema.String.pipe(\n * Schema.decode(SchemaTransformation.snakeToCamel())\n * )\n * Schema.decodeSync(SnakeToCamel)(\"user_name\") // => \"userName\"\n * ```\n *\n * @see {@link trim}\n * @see {@link toLowerCase}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function snakeToCamel() {\n return new Transformation(SchemaGetter.snakeToCamel(), SchemaGetter.camelToSnake());\n}\n/**\n * Transforms strings by lowercasing on decode.\n * Encode is passthrough.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to normalize strings to lowercase\n * (e.g. email addresses).\n *\n * **Details**\n *\n * Decoding applies `String.prototype.toLowerCase()`. Encoding is passthrough.\n * This is not round-trippable if the original had uppercase characters.\n *\n * **Example** (Lowercasing on decode)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const Lowered = Schema.String.pipe(\n * Schema.decode(SchemaTransformation.toLowerCase())\n * )\n * Schema.decodeSync(Lowered)(\"HELLO\") // => \"hello\"\n * ```\n *\n * @see {@link toUpperCase}\n * @see {@link trim}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function toLowerCase() {\n return new Transformation(SchemaGetter.toLowerCase(), SchemaGetter.passthrough());\n}\n/**\n * Transforms strings by uppercasing on decode.\n * Encode is passthrough.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to normalize strings to uppercase\n * (e.g. country codes).\n *\n * **Details**\n *\n * Decoding applies `String.prototype.toUpperCase()`. Encoding is passthrough.\n * This is not round-trippable if the original had lowercase characters.\n *\n * **Example** (Uppercasing on decode)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const Uppered = Schema.String.pipe(\n * Schema.decode(SchemaTransformation.toUpperCase())\n * )\n * Schema.decodeSync(Uppered)(\"hello\") // => \"HELLO\"\n * ```\n *\n * @see {@link toLowerCase}\n * @see {@link trim}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function toUpperCase() {\n return new Transformation(SchemaGetter.toUpperCase(), SchemaGetter.passthrough());\n}\n/**\n * Transforms strings by capitalizing the first character on\n * decode. Encode is passthrough.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to normalize display names or\n * titles.\n *\n * **Details**\n *\n * Decoding uppercases the first character and leaves the rest unchanged.\n * Encoding is passthrough.\n *\n * **Example** (Capitalizing on decode)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const Capitalized = Schema.String.pipe(\n * Schema.decode(SchemaTransformation.capitalize())\n * )\n * Schema.decodeSync(Capitalized)(\"hello\") // => \"Hello\"\n * ```\n *\n * @see {@link uncapitalize}\n * @see {@link toUpperCase}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function capitalize() {\n return new Transformation(SchemaGetter.capitalize(), SchemaGetter.passthrough());\n}\n/**\n * Transforms strings by lowercasing the first character on\n * decode. Encode is passthrough.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to normalize identifiers or field\n * names.\n *\n * **Details**\n *\n * Decoding lowercases the first character and leaves the rest unchanged.\n * Encoding is passthrough.\n *\n * **Example** (Uncapitalizing on decode)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const Uncapitalized = Schema.String.pipe(\n * Schema.decode(SchemaTransformation.uncapitalize())\n * )\n * Schema.decodeSync(Uncapitalized)(\"Hello\") // => \"hello\"\n * ```\n *\n * @see {@link capitalize}\n * @see {@link toLowerCase}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function uncapitalize() {\n return new Transformation(SchemaGetter.uncapitalize(), SchemaGetter.passthrough());\n}\n/**\n * Transforms a string into a record of key-value pairs and\n * encodes a record of key-value pairs into a string.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to parse query-string-like or\n * config-file-like strings into records.\n *\n * **Details**\n *\n * Decoding splits the string by `separator` (default `\",\"`) into pairs, then\n * splits each pair by `keyValueSeparator` (default `\"=\"`). Encoding joins the\n * record back into a string using the same separators. The transformation is\n * round-trippable when keys and values do not contain the separators.\n *\n * **Example** (Parsing key-value pairs)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const Config = Schema.String.pipe(\n * Schema.decodeTo(\n * Schema.Record(Schema.String, Schema.String),\n * SchemaTransformation.splitKeyValue({ separator: \";\", keyValueSeparator: \":\" })\n * )\n * )\n * Schema.decodeSync(Config)(\"host:localhost;port:3000\") // => { host: \"localhost\", port: \"3000\" }\n * ```\n *\n * @see {@link trim}\n * @see {@link snakeToCamel}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function splitKeyValue(options) {\n return new Transformation(SchemaGetter.splitKeyValue(options), SchemaGetter.joinKeyValue(options));\n}\nconst passthrough_ = /*#__PURE__*/new Transformation(/*#__PURE__*/SchemaGetter.passthrough(), /*#__PURE__*/SchemaGetter.passthrough());\nexport function passthrough() {\n return passthrough_;\n}\nexport function passthroughSupertype() {\n return passthrough_;\n}\nexport function passthroughSubtype() {\n return passthrough_;\n}\n/**\n * Decodes a `string` into a `number` and encodes a `number` back to a\n * `string`.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to parse numeric strings from APIs,\n * form data, or URL parameters.\n *\n * **Details**\n *\n * Decoding coerces the string to a number like `Number(s)`. Encoding coerces\n * the number to a string like `String(n)`. This does not validate that the\n * result is finite; combine with `Schema.Finite` or `Schema.Int` for stricter\n * checks.\n *\n * **Example** (Converting a string to a number)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.String.pipe(\n * Schema.decodeTo(Schema.Number, SchemaTransformation.numberFromString)\n * )\n * Schema.decodeSync(schema)(\"42\") // => 42\n * ```\n *\n * @see {@link bigintFromString}\n * @see {@link transform}\n *\n * @category converting\n * @since 4.0.0\n */\nexport const numberFromString = /*#__PURE__*/new Transformation(/*#__PURE__*/SchemaGetter.Number(), /*#__PURE__*/SchemaGetter.String());\n/**\n * Decodes a `string` into a `bigint` and encodes a `bigint` back to a\n * `string`.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to parse large integer strings\n * (e.g. database IDs, blockchain values).\n *\n * **Details**\n *\n * Decoding coerces the string to a bigint like `BigInt(s)`. Encoding coerces\n * the bigint to a string like `String(n)`. Decoding fails if the string is not\n * a valid bigint representation.\n *\n * **Example** (Converting a string to a BigInt)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.String.pipe(\n * Schema.decodeTo(Schema.BigInt, SchemaTransformation.bigintFromString)\n * )\n * Schema.decodeSync(schema)(\"42\") // => 42n\n * ```\n *\n * @see {@link numberFromString}\n * @see {@link transform}\n *\n * @category converting\n * @since 4.0.0\n */\nexport const bigintFromString = /*#__PURE__*/new Transformation(/*#__PURE__*/SchemaGetter.BigInt(), /*#__PURE__*/SchemaGetter.String());\n/**\n * Decodes a `string` into a `Date` and encodes a `Date` back to a `string`.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to parse date strings from APIs or\n * user input.\n *\n * **Details**\n *\n * Decoding creates a `Date` from the string like `new Date(s)`. Encoding\n * converts the `Date` to an ISO string like `date.toISOString()`, returning\n * `\"Invalid Date\"` for invalid dates.\n *\n * **Example** (Converting a string to a Date)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.String.pipe(\n * Schema.decodeTo(Schema.Date, SchemaTransformation.dateFromString)\n * )\n * Schema.decodeSync(schema)(\"2024-01-01\").toISOString() // => \"2024-01-01T00:00:00.000Z\"\n * ```\n *\n * @see {@link dateFromMillis}\n * @see {@link dateTimeUtcFromString}\n *\n * @category converting\n * @since 4.0.0\n */\nexport const dateFromString = /*#__PURE__*/new Transformation(/*#__PURE__*/SchemaGetter.Date(), /*#__PURE__*/SchemaGetter.transform(formatDate));\n/**\n * Decodes epoch milliseconds into a `Date` and encodes a `Date` back to epoch\n * milliseconds.\n *\n * **When to use**\n *\n * Use when you need a schema transformation for numeric timestamps represented\n * as milliseconds since the Unix epoch.\n *\n * **Details**\n *\n * Decoding creates a `Date` from the number like `new Date(ms)`. Encoding\n * returns the `Date` timestamp like `date.getTime()`.\n *\n * **Gotchas**\n *\n * This transformation does not validate date validity. `NaN`, `Infinity`, and\n * `-Infinity` decode to invalid `Date` instances.\n *\n * **Example** (Converting milliseconds to a Date)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.Number.pipe(\n * Schema.decodeTo(Schema.Date, SchemaTransformation.dateFromMillis)\n * )\n * Schema.decodeSync(schema)(0).toISOString() // => \"1970-01-01T00:00:00.000Z\"\n * ```\n *\n * @see {@link dateFromString}\n * @see {@link SchemaGetter.dateTimeUtcFromInput}\n *\n * @category converting\n * @since 4.0.0\n */\nexport const dateFromMillis = /*#__PURE__*/new Transformation(/*#__PURE__*/SchemaGetter.Date(), /*#__PURE__*/SchemaGetter.transform(date => date.getTime()));\n/**\n * Decodes a `string` into a `Duration` and encodes a `Duration` back to a\n * parseable `string`.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to parse human-readable duration\n * strings from APIs, config, or user input.\n *\n * **Details**\n *\n * Decoding accepts any string that `Duration.fromInput` can parse, including\n * `\"Infinity\"` and `\"-Infinity\"`. Encoding returns `String(duration)`,\n * producing strings such as `\"2000 millis\"` or `\"10 nanos\"` that round-trip\n * through the parser.\n *\n * **Example** (Converting a string to a Duration)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.String.pipe(\n * Schema.decodeTo(Schema.Duration, SchemaTransformation.durationFromString)\n * )\n * String(Schema.decodeSync(schema)(\"5 seconds\")) // => \"5000 millis\"\n * ```\n *\n * @see {@link durationFromNanos}\n * @see {@link durationFromMillis}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const durationFromString = /*#__PURE__*/transformEffect({\n decode: (s, options) => Option.match(Duration.fromInput(s), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid Duration string\"\n }, s, options)),\n onSome: Effect.succeed\n }),\n encode: duration => Effect.succeed(String(duration))\n});\n/**\n * Decodes a `bigint` (nanoseconds) into a `Duration` and encodes a\n * `Duration` back to `bigint` nanoseconds.\n *\n * **When to use**\n *\n * Use when you need a schema transformation for nanosecond-precision timestamps\n * or intervals.\n *\n * **Details**\n *\n * Decoding always succeeds and creates a `Duration` from nanoseconds. Encoding\n * fails with `InvalidValue` if the `Duration` cannot be represented as a\n * `bigint`, such as `Duration.infinity`.\n *\n * **Example** (Converting nanoseconds to a Duration)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.BigInt.pipe(\n * Schema.decodeTo(Schema.Duration, SchemaTransformation.durationFromNanos)\n * )\n * String(Schema.decodeSync(schema)(5n)) // => \"5 nanos\"\n * ```\n *\n * @see {@link durationFromMillis}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const durationFromNanos = /*#__PURE__*/transformEffect({\n decode: i => Effect.succeed(Duration.nanos(i)),\n encode: (a, options) => Option.match(Duration.toNanos(a), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a Duration representable as a bigint\"\n }, a, options)),\n onSome: nanos => Effect.succeed(nanos)\n })\n});\n/**\n * Decodes a `number` of milliseconds into a `Duration` and encodes a `Duration`\n * back to milliseconds.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to decode timeouts, delays, elapsed\n * intervals, or other duration values stored as millisecond counts.\n *\n * **Details**\n *\n * Decode creates a duration from the number, and encode returns the duration\n * length in milliseconds.\n *\n * **Example** (Converting milliseconds to a Duration)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.Number.pipe(\n * Schema.decodeTo(Schema.Duration, SchemaTransformation.durationFromMillis)\n * )\n * String(Schema.decodeSync(schema)(5000)) // => \"5000 millis\"\n * ```\n *\n * @see {@link durationFromNanos}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const durationFromMillis = /*#__PURE__*/transform({\n decode: i => Duration.millis(i),\n encode: a => Duration.toMillis(a)\n});\n/**\n * Decodes a string into a `ByteSize` and encodes it as an exact string.\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const byteSizeFromString = /*#__PURE__*/transformEffect({\n decode: (input, options) => Option.match(ByteSize.fromInput(input), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid ByteSize string\"\n }, input, options)),\n onSome: Effect.succeed\n }),\n encode: byteSize => Effect.succeed(`${byteSize} ${byteSize === BigInt(1) ? \"byte\" : \"bytes\"}`)\n});\n/**\n * Decodes a non-negative bigint byte count into a `ByteSize`.\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const byteSizeFromBigInt = /*#__PURE__*/transformEffect({\n decode: (input, options) => Option.match(ByteSize.fromInput(input), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a non-negative bigint byte count\"\n }, input, options)),\n onSome: Effect.succeed\n }),\n encode: byteSize => Effect.succeed(ByteSize.toBigInt(byteSize))\n});\n/**\n * Decodes a non-negative safe-integer byte count into a `ByteSize`.\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const byteSizeFromNumber = /*#__PURE__*/transformEffect({\n decode: (input, options) => Option.match(ByteSize.fromInput(input), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a non-negative safe-integer byte count\"\n }, input, options)),\n onSome: Effect.succeed\n }),\n encode: (byteSize, options) => Option.match(ByteSize.toNumber(byteSize), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a ByteSize representable as a safe integer\"\n }, byteSize, options)),\n onSome: Effect.succeed\n })\n});\nconst isJsonError = input => Predicate.isObject(input) && typeof input[\"message\"] === \"string\";\nconst decodeJsonError = input => {\n const hasCause = Object.hasOwn(input, \"cause\");\n const err = hasCause ? new Error(input.message, {\n cause: decodeDefect(input.cause)\n }) : new Error(input.message);\n if (typeof input.name === \"string\" && input.name !== \"Error\") err.name = input.name;\n if (typeof input.stack === \"string\") err.stack = input.stack;\n return err;\n};\nconst encodeUnknownAsJson = input => {\n try {\n const json = formatJson(input);\n return json === undefined ? format(input) : JSON.parse(json);\n } catch {\n return format(input);\n }\n};\nconst encodeJsonError = (input, options, encodeDefect) => {\n const encoded = {\n name: input.name,\n message: typeof input.message === \"string\" ? input.message : \"\"\n };\n if (options?.includeStack && typeof input.stack === \"string\") {\n encoded.stack = input.stack;\n }\n if (!options?.excludeCause && input.cause !== undefined) {\n encoded.cause = encodeDefect(input.cause);\n }\n return encoded;\n};\nconst makeEncodeDefect = options => {\n const seen = new WeakSet();\n const encode = input => {\n if (Predicate.isError(input)) {\n if (seen.has(input)) {\n return \"[Circular]\";\n }\n seen.add(input);\n const encoded = encodeJsonError(input, options, encode);\n seen.delete(input);\n return encoded;\n }\n return encodeUnknownAsJson(input);\n };\n return encode;\n};\nconst decodeDefect = input => isJsonError(input) ? decodeJsonError(input) : input;\n/** @internal */\nexport const errorFromJsonError = options => transform({\n decode: decodeJsonError,\n encode: input => makeEncodeDefect(options)(input)\n});\n/** @internal */\nexport const defectFromJson = options => transform({\n decode: decodeDefect,\n encode: makeEncodeDefect(options)\n});\n/**\n * Decodes `T | null` into `Option<T>` and encodes `Option<T>` back to\n * `T | null`.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to convert nullable API fields to\n * `Option`.\n *\n * **Details**\n *\n * Decoding maps `null` to `Option.none()` and non-null values to\n * `Option.some(value)`. Encoding maps `Option.none()` to `null` and\n * `Option.some(value)` to `value`. The transformation is pure and synchronous.\n *\n * **Example** (Converting nullable values to an Option)\n *\n * ```ts import.meta.vitest\n * import { Option, Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.NullOr(Schema.String).pipe(\n * Schema.decodeTo(\n * Schema.Option(Schema.String),\n * SchemaTransformation.optionFromNullOr()\n * )\n * )\n * Schema.decodeSync(schema)(null) // => Option.none()\n * ```\n *\n * @see {@link optionFromNullishOr}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function optionFromNullOr() {\n return transform({\n decode: Option.fromNullOr,\n encode: Option.getOrNull\n });\n}\n/**\n * Decodes `T | undefined` into `Option<T>` and encodes `Option.none()` back to\n * `undefined`.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to convert API fields that use\n * `undefined` for absence to `Option`.\n *\n * **Details**\n *\n * Decoding maps `undefined` to `Option.none()` and non-undefined values to\n * `Option.some(value)`. Encoding maps `Option.none()` to `undefined` and\n * `Option.some(value)` to `value`. The transformation is pure and synchronous.\n *\n * **Example** (Converting undefined-or values to an Option)\n *\n * ```ts import.meta.vitest\n * import { Option, Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.UndefinedOr(Schema.String).pipe(\n * Schema.decodeTo(\n * Schema.Option(Schema.String),\n * SchemaTransformation.optionFromUndefinedOr()\n * )\n * )\n * Schema.decodeSync(schema)(undefined) // => Option.none()\n * ```\n *\n * @see {@link optionFromOptionalKey}\n * @see {@link optionFromOptional}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function optionFromUndefinedOr() {\n return transform({\n decode: Option.fromUndefinedOr,\n encode: Option.getOrUndefined\n });\n}\n/**\n * Decodes `T | null | undefined` into `Option<T>` and encodes `Option<T>`\n * back to `T | null` or `T | undefined` depending on the provided\n * `options.onNoneEncoding` (defaults to `undefined`).\n *\n * **When to use**\n *\n * Use when you need a schema transformation to convert nullish API fields to\n * `Option` when both `null` and `undefined` represent absence.\n *\n * **Details**\n *\n * Decoding maps `null` and `undefined` to `Option.none()` and all other values\n * to `Option.some(value)`. Encoding maps `Option.none()` to `null` or\n * `undefined` according to `options.onNoneEncoding`, and maps\n * `Option.some(value)` to `value`. The transformation is pure and synchronous.\n *\n * **Example** (Converting nullish values to an Option and encoding None as null)\n *\n * ```ts import.meta.vitest\n * import { Option, Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.NullishOr(Schema.String).pipe(\n * Schema.decodeTo(\n * Schema.Option(Schema.String),\n * SchemaTransformation.optionFromNullishOr({ onNoneEncoding: null })\n * )\n * )\n * Schema.encodeSync(schema)(Option.none()) // => null\n * ```\n *\n * @see {@link optionFromNullOr}\n * @see {@link optionFromUndefinedOr}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function optionFromNullishOr(options) {\n return transform({\n decode: Option.fromNullishOr,\n encode: options?.onNoneEncoding === null ? Option.getOrNull : Option.getOrUndefined\n });\n}\n/**\n * Decodes an optional struct key into `Option<T>` and encodes `Option<T>`\n * back to an optional key.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to convert optional struct keys\n * (declared with `Schema.optionalKey`) to `Option` values.\n *\n * **Details**\n *\n * Decoding maps an absent key (`None`) to `Some(None)` and a present key\n * (`Some(v)`) to `Some(Some(v))`. Encoding maps `Some(None)` to `None` to omit\n * the key, and maps `Some(Some(v))` to `Some(v)`. This uses\n * `transformOptional` under the hood.\n *\n * **Example** (Converting an optional key to an Option)\n *\n * ```ts import.meta.vitest\n * import { Option, Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.Struct({\n * name: Schema.optionalKey(Schema.String).pipe(\n * Schema.decodeTo(\n * Schema.Option(Schema.String),\n * SchemaTransformation.optionFromOptionalKey()\n * )\n * )\n * })\n * Schema.decodeSync(schema)({}).name // => Option.none()\n * ```\n *\n * @see {@link optionFromOptional}\n * @see {@link optionFromUndefinedOr}\n * @see {@link transformOptional}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function optionFromOptionalKey() {\n return transformOptional({\n decode: Option.some,\n encode: Option.flatten\n });\n}\n/**\n * Decodes optional values into `Option<T>` and encodes `Option.none()` back to\n * an omitted optional value.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to convert optional (possibly\n * `undefined`) values to `Option`.\n *\n * **Details**\n *\n * Decoding maps an absent or `undefined` value to `Some(None)` and a present\n * value to `Some(Some(v))`. Encoding maps `Some(None)` to `None` to omit the\n * value, and maps `Some(Some(v))` to `Some(v)`. This uses\n * `transformOptional` under the hood and filters out `undefined` on decode.\n *\n * **Example** (Converting an optional value to an Option)\n *\n * ```ts import.meta.vitest\n * import { Option, Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.Struct({\n * age: Schema.optional(Schema.Number).pipe(\n * Schema.decodeTo(\n * Schema.Option(Schema.Number),\n * SchemaTransformation.optionFromOptional()\n * )\n * )\n * })\n * Schema.decodeSync(schema)({ age: undefined }).age // => Option.none()\n * ```\n *\n * @see {@link optionFromOptionalKey}\n * @see {@link optionFromUndefinedOr}\n * @see {@link transformOptional}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function optionFromOptional() {\n return transformOptional({\n decode: ot => ot.pipe(Option.filter(Predicate.isNotUndefined), Option.some),\n encode: Option.flatten\n });\n}\n/**\n * Decodes a `string` into a `URL` and encodes a `URL` back to its `href`\n * string.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to parse URL strings from user\n * input or API responses.\n *\n * **Details**\n *\n * Decoding checks `URL.canParse(s)` and fails with `InvalidValue` if the string\n * is not a valid URL. Encoding returns `url.href`.\n *\n * **Example** (Converting a string to a URL)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.String.pipe(\n * Schema.decodeTo(Schema.URL, SchemaTransformation.urlFromString)\n * )\n * Schema.decodeSync(schema)(\"https://example.com/path\").href // => \"https://example.com/path\"\n * ```\n *\n * @see {@link numberFromString}\n * @see {@link transformEffect}\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const urlFromString = /*#__PURE__*/transformEffect({\n decode: (s, options) => URL.canParse(s) ? Effect.succeed(new URL(s)) : Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid URL string\"\n }, s, options)),\n encode: url => Effect.succeed(url.href)\n});\n/**\n * Decodes a `string` into a `BigDecimal` and encodes a `BigDecimal` back to\n * its string representation.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to parse decimal number strings\n * from APIs or user input.\n *\n * **Details**\n *\n * Decoding calls `BigDecimal.fromString(s)` and fails with `InvalidValue` if\n * the string is not a valid `BigDecimal` representation. Encoding returns\n * `BigDecimal.format(bd)`.\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const bigDecimalFromString = /*#__PURE__*/transformEffect({\n decode: (s, options) => {\n const result = BigDecimal.fromString(s);\n return Option.isNone(result) ? Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid BigDecimal string\"\n }, s, options)) : Effect.succeed(result.value);\n },\n encode: bd => Effect.succeed(BigDecimal.format(bd))\n});\n/**\n * Decodes a Base64-encoded `string` into a `Uint8Array` and encodes a\n * `Uint8Array` back to a Base64 string.\n *\n * **When to use**\n *\n * Use when you need a schema transformation for binary data transmitted as\n * Base64 strings (e.g. file uploads, API payloads).\n *\n * **Details**\n *\n * Decoding parses the Base64 string into bytes. Encoding writes the byte array\n * as a Base64 string.\n *\n * **Example** (Converting Base64 to a Uint8Array)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.String.pipe(\n * Schema.decodeTo(Schema.Uint8Array, SchemaTransformation.uint8ArrayFromBase64String)\n * )\n * Array.from(Schema.decodeSync(schema)(\"AQID\")) // => [1, 2, 3]\n * ```\n *\n * @see {@link fromJsonString}\n * @see `Schema.Uint8ArrayFromBase64` - a ready-made schema wrapping this transformation.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const uint8ArrayFromBase64String = /*#__PURE__*/new Transformation(/*#__PURE__*/SchemaGetter.decodeBase64(), /*#__PURE__*/SchemaGetter.encodeBase64());\n/**\n * Decodes a Base64-encoded `string` into a UTF-8 `string` and encodes a\n * UTF-8 `string` back to a Base64 string.\n *\n * **When to use**\n *\n * Use when you need a schema transformation for text data transmitted as Base64\n * strings.\n *\n * **Details**\n *\n * Decoding parses the Base64 string into a UTF-8 string. Encoding writes the\n * string as a Base64 string.\n *\n * **Example** (Converting Base64 to a string)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.String.pipe(\n * Schema.decodeTo(Schema.String, SchemaTransformation.stringFromBase64String)\n * )\n * Schema.decodeSync(schema)(\"aGVsbG8=\") // => \"hello\"\n * ```\n *\n * @see {@link uint8ArrayFromBase64String}\n * @see `Schema.StringFromBase64` - a ready-made schema wrapping this transformation.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const stringFromBase64String = /*#__PURE__*/new Transformation(/*#__PURE__*/SchemaGetter.decodeBase64String(), /*#__PURE__*/SchemaGetter.encodeBase64());\n/**\n * Decodes a base64 (URL) encoded `string` into a UTF-8 `string` and encodes it back.\n *\n * **When to use**\n *\n * Use when you need a schema transformation for text data transmitted as Base64\n * URL-safe strings.\n *\n * **Details**\n *\n * Decoding parses the Base64 URL string into a UTF-8 string. Encoding writes\n * the string as a Base64 URL string.\n *\n * **Example** (Converting Base64Url to a string)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.String.pipe(\n * Schema.decodeTo(Schema.String, SchemaTransformation.stringFromBase64UrlString)\n * )\n * Schema.decodeSync(schema)(\"aGVsbG8\") // => \"hello\"\n * ```\n *\n * @see {@link stringFromBase64String}\n * @see `Schema.StringFromBase64Url` - a ready-made schema wrapping this transformation.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const stringFromBase64UrlString = /*#__PURE__*/new Transformation(/*#__PURE__*/SchemaGetter.decodeBase64UrlString(), /*#__PURE__*/SchemaGetter.encodeBase64Url());\n/**\n * Decodes a hex encoded `string` into a UTF-8 `string` and encodes it back.\n *\n * **When to use**\n *\n * Use when you need a schema transformation for text data transmitted as\n * hexadecimal strings.\n *\n * **Details**\n *\n * Decoding parses the hex string into a UTF-8 string. Encoding writes the\n * string as a hex string.\n *\n * **Example** (Converting hex to a string)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.String.pipe(\n * Schema.decodeTo(Schema.String, SchemaTransformation.stringFromHexString)\n * )\n * Schema.decodeSync(schema)(\"68656c6c6f\") // => \"hello\"\n * ```\n *\n * @see {@link stringFromBase64String}\n * @see `Schema.StringFromHex` - a ready-made schema wrapping this transformation.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const stringFromHexString = /*#__PURE__*/new Transformation(/*#__PURE__*/SchemaGetter.decodeHexString(), /*#__PURE__*/SchemaGetter.encodeHex());\n/**\n * Decodes a URI component encoded string into a UTF-8 string and encodes a\n * UTF-8 string into a URI component encoded string.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to store structured data in URL\n * query parameters or fragments, such as composing with `Schema.parseJson` to\n * round-trip JSON through a URL.\n *\n * **Details**\n *\n * Decoding calls `decodeURIComponent` and fails if the input contains malformed\n * percent-encoding sequences. Encoding calls `encodeURIComponent`.\n *\n * **Example** (Defining a URI component schema)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.String.pipe(\n * Schema.decodeTo(Schema.String, SchemaTransformation.stringFromUriComponent)\n * )\n * Schema.decodeSync(schema)(\"hello%20world\") // => \"hello world\"\n * ```\n *\n * @see {@link stringFromBase64String}\n * @see `Schema.StringFromUriComponent` - a ready-made schema wrapping this transformation.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const stringFromUriComponent = /*#__PURE__*/new Transformation(/*#__PURE__*/SchemaGetter.decodeUriComponent(), /*#__PURE__*/SchemaGetter.encodeUriComponent());\n/**\n * Decodes a JSON string with `JSON.parse` and encodes a value with\n * `JSON.stringify`.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to decode JSON stored or\n * transmitted as a string, usually before composing with another schema that\n * validates the parsed structure.\n *\n * **Details**\n *\n * The `reviver` option is passed to `JSON.parse` during decoding. The\n * `replacer` and `space` options are passed to `JSON.stringify` during\n * encoding. Decode fails with `InvalidValue` for invalid JSON, and encode can\n * fail with `InvalidValue` when `JSON.stringify` cannot serialize the value.\n *\n * **Example** (Parsing JSON)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.String.pipe(\n * Schema.decodeTo(Schema.Unknown, SchemaTransformation.fromJsonString())\n * )\n * Schema.decodeSync(schema)(\"{\\\"ok\\\":true}\") // => { ok: true }\n * ```\n *\n * @see {@link uint8ArrayFromBase64String}\n * @see {@link fromFormData}\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function fromJsonString(options) {\n return new Transformation(SchemaGetter.parseJson(options ?? {}), SchemaGetter.stringifyJson(options));\n}\n/**\n * Decodes a `FormData` instance into a nested record using bracket-path keys and\n * encodes object-like values back into `FormData`.\n *\n * **When to use**\n *\n * Use when you need a schema transformation for form or multipart payloads\n * whose keys, such as `user[name]` or `items[0]`, should become nested data.\n *\n * **Details**\n *\n * Decode preserves string and `Blob` leaves. Encode flattens nested objects and\n * arrays into bracket-path entries and returns an empty `FormData` for\n * non-object inputs.\n *\n * **Example** (Decoding FormData)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.instanceOf(FormData).pipe(\n * Schema.decodeTo(Schema.Unknown, SchemaTransformation.fromFormData)\n * )\n * const formData = new FormData()\n * formData.append(\"user[name]\", \"Alice\")\n * Schema.decodeSync(schema)(formData) // => { user: { name: \"Alice\" } }\n * ```\n *\n * @see {@link fromURLSearchParams}\n * @see {@link fromJsonString}\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const fromFormData = /*#__PURE__*/new Transformation(/*#__PURE__*/SchemaGetter.decodeFormData(), /*#__PURE__*/SchemaGetter.encodeFormData());\n/**\n * Decodes `URLSearchParams` into a nested record using bracket-path keys and\n * encodes object-like values back into `URLSearchParams`.\n *\n * **When to use**\n *\n * Use when you need a schema transformation for query strings whose keys, such\n * as `filter[name]` or `items[0]`, should become nested data.\n *\n * **Details**\n *\n * Decode produces string leaves. Encode flattens nested objects and arrays into\n * bracket-path entries and returns empty `URLSearchParams` for non-object\n * inputs.\n *\n * **Example** (Decoding URLSearchParams)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const schema = Schema.instanceOf(URLSearchParams).pipe(\n * Schema.decodeTo(Schema.Unknown, SchemaTransformation.fromURLSearchParams)\n * )\n * Schema.decodeSync(schema)(new URLSearchParams(\"user[name]=Alice\")) // => { user: { name: \"Alice\" } }\n * ```\n *\n * @see {@link fromFormData}\n * @see {@link fromJsonString}\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const fromURLSearchParams = /*#__PURE__*/new Transformation(/*#__PURE__*/SchemaGetter.decodeURLSearchParams(), /*#__PURE__*/SchemaGetter.encodeURLSearchParams());\n/**\n * Decodes a numeric time-zone offset in milliseconds into a\n * `DateTime.TimeZone.Offset` and encodes it back to the offset number.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to represent fixed-offset time\n * zones with numeric millisecond offsets.\n *\n * **Details**\n *\n * Decode uses `DateTime.zoneMakeOffset`; encode returns the offset's `offset`\n * field.\n *\n * @see {@link timeZoneFromString} for IANA or offset string encodings\n * @see {@link timeZoneNamedFromString} for IANA named-zone strings\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const timeZoneOffsetFromNumber = /*#__PURE__*/transform({\n decode: n => DateTime.zoneMakeOffset(n),\n encode: tz => tz.offset\n});\n/**\n * Decodes an IANA time-zone identifier string into a\n * `DateTime.TimeZone.Named` and encodes a named time zone back to its `id`.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to accept only IANA time-zone\n * identifier strings and produce `DateTime.TimeZone.Named` values.\n *\n * **Details**\n *\n * Decode fails with `InvalidValue` when the string is not a valid IANA time-zone\n * identifier.\n *\n * @see {@link timeZoneFromString} for time-zone strings that may be either IANA identifiers or offset strings\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const timeZoneNamedFromString = /*#__PURE__*/transformEffect({\n decode: (s, options) => {\n return Option.match(DateTime.zoneMakeNamed(s), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid IANA time zone\"\n }, s, options)),\n onSome: Effect.succeed\n });\n },\n encode: tz => Effect.succeed(tz.id)\n});\n/**\n * Decodes a string into a `DateTime.TimeZone` and encodes a time zone back to\n * its string representation.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to accept either an IANA time-zone\n * identifier or an offset string and produce a general `DateTime.TimeZone`.\n *\n * **Details**\n *\n * Accepted decode inputs include valid IANA identifiers and offset strings such\n * as `\"+03:00\"`. Decode fails with `InvalidValue` when the string cannot be\n * parsed as a time zone.\n *\n * @see {@link timeZoneNamedFromString} for IANA named-zone strings only\n * @see {@link timeZoneOffsetFromNumber} for fixed-offset zones encoded as numbers\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const timeZoneFromString = /*#__PURE__*/transformEffect({\n decode: (s, options) => {\n return Option.match(DateTime.zoneFromString(s), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid time zone\"\n }, s, options)),\n onSome: Effect.succeed\n });\n },\n encode: tz => Effect.succeed(DateTime.zoneToString(tz))\n});\n/**\n * Decodes a date-time string into a `DateTime.Utc` and encodes it back to an ISO\n * string.\n *\n * **When to use**\n *\n * Use when you need a schema transformation to decode date-time strings to a\n * normalized `DateTime.Utc` and encode back as a UTC ISO string.\n *\n * **Details**\n *\n * Decode accepts strings supported by `DateTime.make`, converts the result to\n * UTC, and fails with `InvalidValue` when parsing fails. Encode uses\n * `DateTime.formatIso`.\n *\n * @see {@link dateFromString} for decoding into JavaScript `Date`\n * @see {@link dateTimeZonedFromString} for ISO strings that should preserve zoned date-time information\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const dateTimeUtcFromString = /*#__PURE__*/transformEffect({\n decode: (s, options) => {\n return Option.match(DateTime.make(s), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid UTC DateTime string\"\n }, s, options)),\n onSome: result => Effect.succeed(DateTime.toUtc(result))\n });\n },\n encode: utc => Effect.succeed(DateTime.formatIso(utc))\n});\n/**\n * Decodes a zoned date-time string into a `DateTime.Zoned` and encodes it back\n * to an ISO zoned string.\n *\n * **When to use**\n *\n * Use when you need a schema transformation for ISO zoned date-time strings\n * that decode to `DateTime.Zoned` and encode with `DateTime.formatIsoZoned`.\n *\n * **Details**\n *\n * Decode uses `DateTime.makeZonedFromString` and fails with `InvalidValue` when\n * the input is not a valid zoned date-time. Encode uses\n * `DateTime.formatIsoZoned`.\n *\n * @see {@link dateTimeUtcFromString} for date-time strings that should decode to `DateTime.Utc` and encode as UTC ISO strings\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const dateTimeZonedFromString = /*#__PURE__*/transformEffect({\n decode: (s, options) => {\n return Option.match(DateTime.makeZonedFromString(s), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid Zoned DateTime string\"\n }, s, options)),\n onSome: Effect.succeed\n });\n },\n encode: zoned => Effect.succeed(DateTime.formatIsoZoned(zoned))\n});\n//# sourceMappingURL=SchemaTransformation.js.map","/**\n * Represents Effect schemas as runtime trees.\n *\n * Every `Schema` has an AST made from nodes for declarations, primitives,\n * literals, arrays, objects, unions, suspended schemas, checks, annotations,\n * encoding links, and parsing context. Most users work with the higher-level\n * `Schema` module. Use `SchemaAST` when you need to inspect schema nodes, build\n * ASTs programmatically, change encoded or decoded views, collect issues, or\n * run low-level schema checks.\n *\n * @since 4.0.0\n */\nimport * as Arr from \"./Array.js\";\nimport * as Cause from \"./Cause.js\";\nimport * as Effect from \"./Effect.js\";\nimport * as Exit from \"./Exit.js\";\nimport { format, formatPropertyKey } from \"./Formatter.js\";\nimport { identity, memoize, memoizeIdempotent } from \"./Function.js\";\nimport { effectIsExit, iterateConcurrent, iterateEager, resolveConcurrency } from \"./internal/effect.js\";\nimport * as InternalRecord from \"./internal/record.js\";\nimport * as InternalAnnotations from \"./internal/schema/annotations.js\";\nimport * as InternalSchemaCause from \"./internal/schema/cause.js\";\nimport * as InternalParser from \"./internal/schema/parser.js\";\nimport * as Pipeable from \"./Pipeable.js\";\nimport * as Predicate from \"./Predicate.js\";\nimport * as Result from \"./Result.js\";\nimport * as SchemaGetter from \"./SchemaGetter.js\";\nimport * as SchemaIssue from \"./SchemaIssue.js\";\nimport * as SchemaTransformation from \"./SchemaTransformation.js\";\nfunction makeGuard(tag) {\n return ast => ast._tag === tag;\n}\n/**\n * Returns `true` if the value is an {@link AST} node (any variant).\n *\n * **Details**\n *\n * Uses the internal `TypeId` brand to distinguish AST nodes from arbitrary\n * objects.\n *\n * @see {@link AST}\n * @category guards\n * @since 4.0.0\n */\nexport function isAST(u) {\n return Predicate.hasProperty(u, TypeId) && u[TypeId] === TypeId;\n}\n/**\n * Narrows an {@link AST} to {@link Declaration}.\n *\n * **When to use**\n *\n * Use to recognize declaration AST nodes before running declaration-specific\n * handling.\n *\n * @see {@link Declaration} for the AST node type narrowed by this guard\n *\n * @category guards\n * @since 3.10.0\n */\nexport const isDeclaration = /*#__PURE__*/makeGuard(\"Declaration\");\n/**\n * Narrows an {@link AST} to {@link Null}.\n *\n * **When to use**\n *\n * Use to recognize an AST node that represents exactly the `null` literal when\n * inspecting, traversing, or transforming schema ASTs.\n *\n * @see {@link Null} for the AST node type narrowed by this guard\n * @see {@link null_ null} for the singleton `Null` AST instance\n * @see {@link isLiteral} for exact primitive literal AST nodes\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isNull = /*#__PURE__*/makeGuard(\"Null\");\n/**\n * Narrows an {@link AST} to {@link Undefined}.\n *\n * **When to use**\n *\n * Use to identify AST nodes that represent exactly the JavaScript `undefined`\n * value.\n *\n * @see {@link isVoid} for narrowing AST nodes that represent TypeScript `void` instead of exact `undefined`\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isUndefined = /*#__PURE__*/makeGuard(\"Undefined\");\n/**\n * Narrows an {@link AST} to {@link Void}.\n *\n * **When to use**\n *\n * Use to identify AST nodes that represent the TypeScript `void` type before\n * handling `Void`-specific schema behavior.\n *\n * @see {@link isUndefined} for narrowing AST nodes that represent the literal `undefined` value instead of TypeScript `void`\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isVoid = /*#__PURE__*/makeGuard(\"Void\");\n/**\n * Narrows an {@link AST} to {@link Never}.\n *\n * **When to use**\n *\n * Use to detect the AST node for a schema that can never match before handling\n * other schema variants.\n *\n * @see {@link Never} for the AST node type narrowed by this guard\n * @see {@link never} for the singleton `Never` AST instance\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isNever = /*#__PURE__*/makeGuard(\"Never\");\n/**\n * Narrows an {@link AST} to {@link Unknown}.\n *\n * **When to use**\n *\n * Use when you need to inspect a schema AST and handle the `Unknown` node\n * variant specifically.\n *\n * @see {@link isAny} for the guard for the `Any` node, whose parsed result is typed as `any` rather than `unknown`\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isUnknown = /*#__PURE__*/makeGuard(\"Unknown\");\n/**\n * Narrows an {@link AST} to {@link Any}.\n *\n * **When to use**\n *\n * Use when you need to inspect a schema AST and handle the `Any` node\n * variant specifically.\n *\n * @see {@link isUnknown} for the guard for the `Unknown` node, whose parsed result is typed as `unknown` rather than `any`\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isAny = /*#__PURE__*/makeGuard(\"Any\");\n/**\n * Narrows an {@link AST} to {@link String}.\n *\n * **When to use**\n *\n * Use to detect schema AST nodes that match any string value while inspecting\n * or transforming a Schema AST.\n *\n * @see {@link String} for the AST node class narrowed by this guard\n * @see {@link string} for the singleton `String` AST instance\n * @see {@link isLiteral} for exact primitive literal AST nodes, including exact string literals\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isString = /*#__PURE__*/makeGuard(\"String\");\n/**\n * Narrows an {@link AST} to {@link Number}.\n *\n * **When to use**\n *\n * Use to detect `Number` AST nodes while inspecting, traversing, or transforming\n * schema ASTs.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isNumber = /*#__PURE__*/makeGuard(\"Number\");\n/**\n * Narrows an {@link AST} to {@link Boolean}.\n *\n * **When to use**\n *\n * Use to identify the `Boolean` AST variant while inspecting, traversing, or\n * transforming schema definitions.\n *\n * @see {@link Boolean} for the AST node type matched by this guard\n * @see {@link boolean} for the singleton instance to use when constructing a boolean AST directly\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isBoolean = /*#__PURE__*/makeGuard(\"Boolean\");\n/**\n * Narrows an {@link AST} to {@link BigInt}.\n *\n * **When to use**\n *\n * Use to identify bigint AST nodes while inspecting or transforming schema ASTs.\n *\n * @see {@link BigInt} for the AST node matched by this guard\n * @see {@link bigInt} for the singleton instance; use `isBigInt` when narrowing an existing `AST` value\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isBigInt = /*#__PURE__*/makeGuard(\"BigInt\");\n/**\n * Narrows an {@link AST} to {@link Symbol}.\n *\n * **When to use**\n *\n * Use to narrow an `AST` node before handling the `Symbol` variant for schemas\n * that accept any JavaScript symbol value.\n *\n * @see {@link isUniqueSymbol} for the sibling guard that narrows the `UniqueSymbol` variant for one exact symbol value\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isSymbol = /*#__PURE__*/makeGuard(\"Symbol\");\n/**\n * Narrows an {@link AST} to {@link Literal}.\n *\n * **When to use**\n *\n * Use to recognize exact string, number, boolean, or bigint literal AST nodes.\n *\n * @see {@link Literal} for the AST node type narrowed by this guard\n * @see {@link LiteralValue} for the values stored by literal nodes\n *\n * @category guards\n * @since 3.10.0\n */\nexport const isLiteral = /*#__PURE__*/makeGuard(\"Literal\");\n/**\n * Narrows an {@link AST} to {@link UniqueSymbol}.\n *\n * @category guards\n * @since 3.10.0\n */\nexport const isUniqueSymbol = /*#__PURE__*/makeGuard(\"UniqueSymbol\");\n/**\n * Narrows an {@link AST} to {@link ObjectKeyword}.\n *\n * **When to use**\n *\n * Use to identify the AST node for the TypeScript `object` keyword when\n * inspecting or transforming a Schema AST.\n *\n * @see {@link ObjectKeyword} for the AST node matched by this guard\n * @see {@link objectKeyword} for the singleton `ObjectKeyword` AST instance\n * @see {@link isObjects} for struct and record AST nodes\n *\n * @category guards\n * @since 3.10.0\n */\nexport const isObjectKeyword = /*#__PURE__*/makeGuard(\"ObjectKeyword\");\n/**\n * Narrows an {@link AST} to {@link Enum}.\n *\n * **When to use**\n *\n * Use to recognize enum AST nodes before reading enum cases or running\n * enum-specific handling.\n *\n * @see {@link Enum} for the AST node type narrowed by this guard\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isEnum = /*#__PURE__*/makeGuard(\"Enum\");\n/**\n * Narrows an {@link AST} to {@link TemplateLiteral}.\n *\n * @category guards\n * @since 3.10.0\n */\nexport const isTemplateLiteral = /*#__PURE__*/makeGuard(\"TemplateLiteral\");\n/**\n * Narrows an {@link AST} to {@link Arrays}.\n *\n * **When to use**\n *\n * Use to recognize array-like AST nodes before reading their element, rest, or\n * mutability metadata.\n *\n * @see {@link Arrays} for the AST node type narrowed by this guard\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isArrays = /*#__PURE__*/makeGuard(\"Arrays\");\n/**\n * Narrows an {@link AST} to {@link Objects}.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isObjects = /*#__PURE__*/makeGuard(\"Objects\");\n/**\n * Narrows an {@link AST} to {@link Union}.\n *\n * @category guards\n * @since 3.10.0\n */\nexport const isUnion = /*#__PURE__*/makeGuard(\"Union\");\n/**\n * Narrows an {@link AST} to {@link Suspend}.\n *\n * @category guards\n * @since 3.10.0\n */\nexport const isSuspend = /*#__PURE__*/makeGuard(\"Suspend\");\n/**\n * Constructs a {@link Link}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Link = class {\n to;\n transformation;\n constructor(to, transformation) {\n this.to = to;\n this.transformation = transformation;\n }\n};\n/** @internal */\nexport const defaultParseOptions = {};\n/**\n * Constructs a {@link Context}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Context = class {\n isOptional;\n isMutable;\n /** Used for constructor default values (e.g. `withConstructorDefault` API) */\n constructorDefault;\n annotations;\n constructor(isOptional, isMutable, /** Used for constructor default values (e.g. `withConstructorDefault` API) */\n constructorDefault = undefined, annotations = undefined) {\n this.isOptional = isOptional;\n this.isMutable = isMutable;\n this.constructorDefault = constructorDefault;\n this.annotations = annotations;\n }\n};\nconst TypeId = \"~effect/Schema\";\nclass ASTNodeImpl {\n [TypeId] = TypeId;\n annotations;\n checks;\n encoding;\n context;\n constructor(annotations = undefined, checks = undefined, encoding = undefined, context = undefined) {\n this.annotations = annotations;\n this.checks = checks;\n this.encoding = encoding;\n this.context = context;\n }\n toString() {\n return `<${this._tag}>`;\n }\n}\n/**\n * Constructs a {@link Declaration}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const 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, run, annotations, checks, encoding, context, encodingChecks, encodingRun) {\n super(annotations, checks, encoding, context);\n this.typeParameters = typeParameters;\n this.run = run;\n this.encodingChecks = encodingChecks;\n this.encodingRun = encodingRun;\n }\n /** @internal */\n getParser() {\n let run;\n return (input, options) => {\n if (input === InternalParser.missing) return InternalParser.missingExit;\n return (run ??= this.run(this.typeParameters))(input, this, options);\n };\n }\n _rebuild(recur, checks, encodingChecks, run, encodingRun) {\n const tps = mapOrSame(this.typeParameters, recur);\n return tps === this.typeParameters && checks === this.checks && encodingChecks === this.encodingChecks && run === this.run && encodingRun === this.encodingRun ? this : new Declaration(tps, run, this.annotations, checks, undefined, 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};\n/**\n * Constructs a {@link Null}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Null = class extends ASTNodeImpl {\n _tag = \"Null\";\n /** @internal */\n getParser() {\n return fromConst(this, null);\n }\n /** @internal */\n getExpected() {\n return \"null\";\n }\n};\nconst null_ = /*#__PURE__*/new Null();\nexport {\n/**\n * Provides the singleton {@link Null} AST instance.\n *\n * **When to use**\n *\n * Use when you need the shared AST node for exact null values while inspecting\n * or constructing schema ASTs.\n *\n * @category constants\n * @since 4.0.0\n */\nnull_ as null };\n/**\n * Constructs a {@link Undefined}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Undefined = class extends ASTNodeImpl {\n _tag = \"Undefined\";\n /** @internal */\n getParser() {\n return fromConst(this, undefined);\n }\n /** @internal */\n toCodecJson() {\n return replaceEncoding(this, [undefinedToNull]);\n }\n /** @internal */\n getExpected() {\n return \"undefined\";\n }\n};\nconst undefinedToNull = /*#__PURE__*/new Link(null_, /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.transform(() => undefined), /*#__PURE__*/SchemaGetter.transform(() => null)));\nconst undefined_ = /*#__PURE__*/new Undefined();\nexport {\n/**\n * Provides the singleton {@link Undefined} AST instance.\n *\n * **When to use**\n *\n * Use when you need the shared AST node for exact undefined values while\n * inspecting or constructing schema ASTs.\n *\n * @category constants\n * @since 4.0.0\n */\nundefined_ as undefined };\n/**\n * Constructs a {@link Void}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Void = class extends ASTNodeImpl {\n _tag = \"Void\";\n /** @internal */\n getParser() {\n const succeed = InternalParser.succeed(undefined);\n return input => input === InternalParser.missing ? InternalParser.missingExit : succeed;\n }\n /** @internal */\n toCodecJson() {\n return replaceEncoding(this, [undefinedToNull]);\n }\n /** @internal */\n getExpected() {\n return \"void\";\n }\n};\nconst void_ = /*#__PURE__*/new Void();\nexport {\n/**\n * Provides the singleton {@link Void} AST instance.\n *\n * **When to use**\n *\n * Use when constructing or comparing AST nodes for TypeScript `void` return\n * values whose result is intentionally ignored.\n *\n * **Details**\n *\n * The node parses any present runtime value as `undefined`; schemas may still\n * expose `void` on their typed decoded and encoded sides.\n *\n * @see {@link Void} for the AST node class\n * @see {@link undefined} for the sibling AST singleton that matches exactly `undefined`\n * @see {@link isVoid} for narrowing an AST to a `Void` node\n *\n * @category constructors\n * @since 4.0.0\n */\nvoid_ as void };\n/**\n * Constructs a {@link Never}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Never = class extends ASTNodeImpl {\n _tag = \"Never\";\n /** @internal */\n getParser() {\n return fromRefinement(this, Predicate.isNever);\n }\n /** @internal */\n getExpected() {\n return \"never\";\n }\n};\n/**\n * Provides the singleton {@link Never} AST instance.\n *\n * **When to use**\n *\n * Use to reuse the canonical bottom-type AST node when constructing,\n * comparing, or returning ASTs.\n *\n * @see {@link Never} for the AST node class\n * @see {@link isNever} for narrowing an AST to a `Never` node\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const never = /*#__PURE__*/new Never();\n/**\n * Constructs a {@link Any}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Any = class extends ASTNodeImpl {\n _tag = \"Any\";\n /** @internal */\n getParser() {\n return fromRefinement(this, Predicate.isUnknown);\n }\n /** @internal */\n getExpected() {\n return \"any\";\n }\n};\n/**\n * Provides the singleton {@link Any} AST instance.\n *\n * **When to use**\n *\n * Use when you need the singleton AST node for the TypeScript `any` type and\n * intentionally want parsing to accept every input value.\n *\n * @see {@link unknown} for the sibling AST singleton that also accepts every value while preserving the safer `unknown` type\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const any = /*#__PURE__*/new Any();\n/**\n * Constructs a {@link Unknown}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Unknown = class extends ASTNodeImpl {\n _tag = \"Unknown\";\n /** @internal */\n getParser() {\n return fromRefinement(this, Predicate.isUnknown);\n }\n /** @internal */\n getExpected() {\n return \"unknown\";\n }\n};\n/**\n * Provides the singleton {@link Unknown} AST instance.\n *\n * **When to use**\n *\n * Use when you need the reusable AST singleton for a schema node that accepts\n * every value while keeping parsed values opaque.\n *\n * @see {@link any} for the singleton that accepts every value as `any`\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const unknown = /*#__PURE__*/new Unknown();\n/**\n * Constructs a {@link ObjectKeyword}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const ObjectKeyword = class extends ASTNodeImpl {\n _tag = \"ObjectKeyword\";\n /** @internal */\n getParser() {\n return fromRefinement(this, Predicate.isObjectKeyword);\n }\n /** @internal */\n getExpected() {\n return \"object | array | function\";\n }\n};\n/**\n * Provides the singleton {@link ObjectKeyword} AST instance.\n *\n * **When to use**\n *\n * Use to reuse the canonical AST node for the TypeScript `object` keyword when\n * building or comparing `SchemaAST` values directly.\n *\n * @see {@link ObjectKeyword} for the AST node class\n * @see {@link isObjectKeyword} for narrowing an AST to an `ObjectKeyword` node\n *\n * @category constructors\n * @since 3.10.0\n */\nexport const objectKeyword = /*#__PURE__*/new ObjectKeyword();\n/**\n * Constructs a {@link Enum}. Numeric values must be finite.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Enum = class extends ASTNodeImpl {\n _tag = \"Enum\";\n enums;\n constructor(enums, annotations, checks, encoding, context) {\n super(annotations, checks, encoding, context);\n for (const [, value] of enums) {\n if (typeof value === \"number\" && !globalThis.Number.isFinite(value)) {\n throw new Error(`A numeric enum value must be finite, got ${format(value)}`);\n }\n }\n this.enums = enums;\n }\n /** @internal */\n getParser() {\n const values = new Set(this.enums.map(([, v]) => v));\n return fromRefinement(this, input => values.has(input));\n }\n /** @internal */\n toCodecStringTree() {\n if (this.enums.some(([_, v]) => typeof v === \"number\")) {\n const coercions = Object.fromEntries(this.enums.map(([_, v]) => [globalThis.String(v), v]));\n return replaceEncoding(this, [new Link(new Union(Object.keys(coercions).map(k => new Literal(k))), new SchemaTransformation.Transformation(SchemaGetter.transform(s => coercions[s]), SchemaGetter.String()))]);\n }\n return this;\n }\n /** @internal */\n getExpected() {\n return this.enums.map(([_, value]) => JSON.stringify(value)).join(\" | \");\n }\n};\nfunction formatTemplateLiteralPath(path) {\n return typeof path === \"number\" ? `parts[${path}]` : path;\n}\nfunction isTemplateLiteralPart(ast, path, validated) {\n if (validated.has(ast)) return true;\n if (ast.encoding) {\n throw new Error(`TemplateLiteral parts cannot have an encoding at ${formatTemplateLiteralPath(path)}`);\n }\n let valid;\n switch (ast._tag) {\n case \"String\":\n case \"Number\":\n case \"BigInt\":\n valid = true;\n break;\n case \"Literal\":\n valid = !ast.checks;\n break;\n case \"TemplateLiteral\":\n {\n const currentPath = formatTemplateLiteralPath(path);\n valid = !ast.checks && ast.parts.every((part, index) => isTemplateLiteralPart(part, `${currentPath}.parts[${index}]`, validated));\n break;\n }\n case \"Union\":\n {\n const currentPath = formatTemplateLiteralPath(path);\n valid = !ast.checks && ast.types.every((part, index) => isTemplateLiteralPart(part, `${currentPath}.types[${index}]`, validated));\n break;\n }\n default:\n return false;\n }\n if (valid) validated.add(ast);\n return valid;\n}\n/**\n * Constructs a {@link TemplateLiteral}.\n *\n * **Gotchas**\n *\n * Throws if a part contains an encoding, including inside unions or nested\n * template literals. Parts must describe their values without transformations.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const TemplateLiteral = class extends ASTNodeImpl {\n _tag = \"TemplateLiteral\";\n parts;\n /** @internal */\n encodedParts;\n /** @internal */\n literals;\n /** @internal */\n suffixLengths;\n constructor(parts, annotations, checks, encoding, context) {\n super(annotations, checks, encoding, context);\n const encodedParts = [];\n const literals = [];\n const validated = new Set();\n for (let index = 0; index < parts.length; index++) {\n const part = parts[index];\n if (!isTemplateLiteralPart(part, index, validated)) {\n throw new Error(`Invalid TemplateLiteral part ${part._tag}`);\n }\n encodedParts.push(part);\n literals.push(part._tag === \"Literal\" ? globalThis.String(part.literal) : undefined);\n }\n const suffixLengths = new Array(encodedParts.length + 1);\n suffixLengths[encodedParts.length] = 0;\n for (let i = encodedParts.length - 1; i >= 0; i--) {\n suffixLengths[i] = suffixLengths[i + 1] + (literals[i]?.length ?? 0);\n }\n this.parts = parts;\n this.encodedParts = encodedParts;\n this.literals = literals;\n this.suffixLengths = suffixLengths;\n }\n /** @internal */\n getParser(compile) {\n const tuple = new Arrays(false, this.parts.map(partFromString), []);\n const parser = compile(decodeTo(string, tuple, templateLiteralTransformation(this)));\n return (input, options) => {\n if (input === InternalParser.missing) return InternalParser.missingExit;\n const result = parser(input, options);\n if (result._tag === \"Success\") {\n return InternalParser.sameExit;\n }\n return Effect.mapBothEager(result, {\n onSuccess: () => input,\n onFailure: issue => new SchemaIssue.Composite(this, [issue], input, options)\n });\n };\n }\n /** @internal */\n getExpected() {\n return \"string\";\n }\n /** @internal */\n matchPart(s, options) {\n return segmentTemplateLiteralParts(this, s, options) === undefined ? undefined : s;\n }\n};\n/** @internal */\nexport function templateLiteralParser(parts) {\n // Encoded members can overlap even when decoding selects exactly one member.\n // Match their spellings here; the original tuple enforces the union's mode.\n const normalize = memoize(encoded => {\n if (encoded._tag !== \"Union\") return encoded;\n const types = mapOrSame(encoded.types, normalize);\n return (encoded.options?.mode ?? \"anyOf\") === \"anyOf\" && types === encoded.types ? encoded : new Union(types, encoded.options === undefined ? undefined : {\n ...encoded.options,\n mode: \"anyOf\"\n }, encoded.annotations, encoded.checks, undefined, encoded.context);\n });\n const template = new TemplateLiteral(parts.map(part => normalize(toEncoded(part))));\n const tuple = new Arrays(false, parts.map(partFromString), []);\n return decodeTo(template, tuple, templateLiteralTransformation(template));\n}\nfunction templateLiteralTransformation(template) {\n return new SchemaTransformation.Transformation(SchemaGetter.transformEffect((s, options) => {\n const segments = segmentTemplateLiteralParts(template, s, options);\n if (segments) return Effect.succeed(segments);\n return Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a string matching template literal parts\"\n }, s, options));\n }), SchemaGetter.transform(parts => parts.join(\"\")));\n}\n/**\n * Constructs a {@link UniqueSymbol}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const UniqueSymbol = class extends ASTNodeImpl {\n _tag = \"UniqueSymbol\";\n symbol;\n constructor(symbol, annotations, checks, encoding, context) {\n super(annotations, checks, encoding, context);\n this.symbol = symbol;\n }\n /** @internal */\n getParser() {\n return fromConst(this, this.symbol);\n }\n /** @internal */\n toCodecStringTree() {\n const key = globalThis.Symbol.keyFor(this.symbol);\n return replaceEncoding(this, [new Link(key === undefined ? never : new Literal(globalThis.String(this.symbol)), symbolToString.transformation)]);\n }\n /** @internal */\n getExpected() {\n return globalThis.String(this.symbol);\n }\n};\n/**\n * Constructs a {@link Literal}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Literal = class extends ASTNodeImpl {\n _tag = \"Literal\";\n literal;\n constructor(literal, annotations, checks, encoding, context) {\n super(annotations, checks, encoding, context);\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 : undefined;\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 SchemaTransformation.Transformation(SchemaGetter.transform(() => ast.literal), SchemaGetter.transform(() => literalAsString)))]);\n}\n/**\n * Constructs a {@link String}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const String = class extends ASTNodeImpl {\n _tag = \"String\";\n /** @internal */\n getParser() {\n return fromRefinement(this, Predicate.isString);\n }\n /** @internal */\n matchPart(s, options) {\n const checks = this.checks;\n return checks && !options.disableChecks && collectIssues(checks, s, undefined, this, options) ? undefined : s;\n }\n /** @internal */\n getExpected() {\n return \"string\";\n }\n};\n/**\n * Provides the singleton {@link String} AST instance.\n *\n * **When to use**\n *\n * Use as the shared `SchemaAST` node for unconstrained JavaScript strings.\n *\n * @see {@link String} for the AST node class\n * @see {@link isString} for narrowing an AST to a string node\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const string = /*#__PURE__*/new String();\n/**\n * Constructs a {@link Number}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Number = class extends ASTNodeImpl {\n _tag = \"Number\";\n /** @internal */\n getParser() {\n return fromRefinement(this, Predicate.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 undefined;\n const value = globalThis.Number(s);\n if (options.disableChecks || !this.checks) return value;\n return collectIssues(this.checks, value, undefined, this, options) ? undefined : 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}\n/**\n * Provides the singleton {@link Number} AST instance.\n *\n * **When to use**\n *\n * Use when you need the canonical `SchemaAST` node for schemas that accept any\n * JavaScript number value.\n *\n * @see {@link Number} for the AST node class and serialization behavior\n * @see {@link Literal} for exact finite numeric literal AST nodes\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const number = /*#__PURE__*/new Number();\n/**\n * Constructs a {@link Boolean}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Boolean = class extends ASTNodeImpl {\n _tag = \"Boolean\";\n /** @internal */\n getParser() {\n return fromRefinement(this, Predicate.isBoolean);\n }\n /** @internal */\n getExpected() {\n return \"boolean\";\n }\n};\n/**\n * Provides the singleton {@link Boolean} AST instance.\n *\n * **When to use**\n *\n * Use to reuse the standard AST node that accepts either `true` or `false` when\n * constructing schema ASTs directly.\n *\n * @see {@link Boolean} for the AST node class\n * @see {@link Literal} for exact boolean literal AST nodes\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const boolean = /*#__PURE__*/new Boolean();\n/**\n * Constructs a {@link Symbol}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Symbol = class extends ASTNodeImpl {\n _tag = \"Symbol\";\n /** @internal */\n getParser() {\n return fromRefinement(this, Predicate.isSymbol);\n }\n /** @internal */\n matchKey(s, options) {\n if (options.disableChecks || !this.checks) return s;\n return collectIssues(this.checks, s, undefined, this, options) ? undefined : s;\n }\n /** @internal */\n toCodecStringTree() {\n return replaceEncoding(this, [symbolToString]);\n }\n /** @internal */\n getExpected() {\n return \"symbol\";\n }\n};\n/**\n * Provides the singleton {@link Symbol} AST instance.\n *\n * **When to use**\n *\n * Use to reuse the singleton AST node for schemas that match any JavaScript\n * symbol value.\n *\n * **Gotchas**\n *\n * String-based codecs can encode only symbols registered with `Symbol.for`,\n * because the implementation uses `Symbol.keyFor`.\n *\n * @see {@link UniqueSymbol} for an AST node that matches one specific symbol\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const symbol = /*#__PURE__*/new Symbol();\n/**\n * Constructs a {@link BigInt}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const BigInt = class extends ASTNodeImpl {\n _tag = \"BigInt\";\n /** @internal */\n getParser() {\n return fromRefinement(this, Predicate.isBigInt);\n }\n /** @internal */\n matchPart(s, options) {\n if (!isStringBigIntRegExp.test(s)) return undefined;\n const value = globalThis.BigInt(s);\n if (options.disableChecks || !this.checks) return value;\n return collectIssues(this.checks, value, undefined, this, options) ? undefined : value;\n }\n /** @internal */\n toCodecStringTree() {\n return replaceEncoding(this, [bigIntToString]);\n }\n /** @internal */\n getExpected() {\n return \"bigint\";\n }\n};\n/**\n * Provides the singleton {@link BigInt} AST instance.\n *\n * **When to use**\n *\n * Use to reuse the canonical `BigInt` AST node when constructing, inspecting,\n * or transforming schemas at the AST level.\n *\n * @see {@link BigInt} for the AST node class and string-codec behavior\n * @see {@link isBigInt} for narrowing an AST to a `BigInt` node\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const bigInt = /*#__PURE__*/new BigInt();\n/**\n * Constructs a {@link Arrays}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Arrays = class extends ASTNodeImpl {\n _tag = \"Arrays\";\n isMutable;\n elements;\n rest;\n encodingChecks;\n constructor(isMutable, elements, rest, annotations, checks, encoding, context, encodingChecks) {\n super(annotations, checks, encoding, context);\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 // An optional element cannot follow a rest element.ts(1266)\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(compile, compileConstructorDefault = compile) {\n // oxlint-disable-next-line @typescript-eslint/no-this-alias\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 return Effect.fnUntracedEager(function* (input, options) {\n if (input === InternalParser.missing) {\n return InternalParser.missing;\n }\n // If the input is not an array, return early with an error\n if (!Array.isArray(input)) {\n return yield* Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n }\n if (!elements) {\n elements = ast.elements.map(ast => ({\n ast,\n parser: compileConstructorDefault(ast)\n }));\n rest = ast.rest.map(ast => ({\n ast,\n parser: compileConstructorDefault(ast)\n }));\n }\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: undefined,\n options\n };\n const end = ast.rest.length === 0 ? elementLen : Math.max(len, elementLen + tailLen);\n const concurrency = options.concurrency === undefined ? 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) yield* eff;\n // ---------------------------------------------\n // handle excess indexes\n // ---------------------------------------------\n if (ast.rest.length === 0 && len > elementLen) {\n for (let i = elementLen; i <= len - 1; i++) {\n const unexpected = new SchemaIssue.UnexpectedKey(ast, input[i], options);\n const issue = new SchemaIssue.Pointer([i], unexpected);\n if (options.errors === \"all\") {\n if (state.issues) state.issues.push(issue);else state.issues = [issue];\n } else {\n return yield* Effect.fail(new SchemaIssue.Composite(ast, [issue], input, options));\n }\n }\n }\n if (state.issues) {\n return yield* Effect.fail(new SchemaIssue.Composite(ast, state.issues, input, options));\n }\n return state.output;\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, undefined, 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};\nconst parseArrayOptions = {\n onItem(s, item, i) {\n const value = i < s.len ? item : InternalParser.missing;\n return s.getParser(s.tailThreshold, i).parser(value, s.options);\n },\n step(s, item, exit, i) {\n if (exit._tag === \"Failure\") {\n return wrapPropertyKeyIssue(s, s.ast, i, exit);\n }\n const value = exit === InternalParser.sameExit ? item : exit[InternalParser.args];\n if (value !== InternalParser.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 SchemaIssue.Pointer([i], new SchemaIssue.MissingKey(p.ast.context?.annotations));\n if (s.options.errors === \"all\") {\n if (s.issues) s.issues.push(issue);else s.issues = [issue];\n } else {\n return Exit.fail(new SchemaIssue.Composite(s.ast, [issue], s.input, s.options));\n }\n }\n }\n};\nconst parseArray = /*#__PURE__*/iterateEager()(parseArrayOptions);\nconst parseArrayConcurrent = /*#__PURE__*/iterateConcurrent()(parseArrayOptions);\nconst wrapPropertyKeyIssue = (s, ast, key, exit) => {\n if (exit.cause.reasons.length === 0) {\n return exit;\n }\n const issue = InternalSchemaCause.getSchemaIssue(exit.cause);\n if (issue === undefined) {\n return Exit.failCause(Cause.map(exit.cause, issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer([key], issue)], s.input, s.options)));\n }\n const pointer = new SchemaIssue.Pointer([key], issue);\n if (s.options.errors === \"all\") {\n if (s.issues) s.issues.push(pointer);else s.issues = [pointer];\n } else {\n return Exit.fail(new SchemaIssue.Composite(ast, [pointer], s.input, s.options));\n }\n};\n/**\n * floating point or integer, with optional exponent\n * @internal\n */\nexport const FINITE_PATTERN = \"[+-]?\\\\d*\\\\.?\\\\d+(?:[Ee][+-]?\\\\d+)?\";\n/**\n * Returns the object keys that match the index signature parameter schema.\n * @internal\n */\nexport function getIndexSignatureKeys(input, parameter, options = defaultParseOptions) {\n let stringKeys;\n let symbolKeys;\n function go(parameter) {\n switch (parameter._tag) {\n case \"String\":\n case \"TemplateLiteral\":\n return (stringKeys ??= Object.keys(input)).filter(k => parameter.matchPart(k, options) !== undefined);\n case \"Number\":\n return (stringKeys ??= Object.keys(input)).filter(k => parameter.matchKey(k, options) !== undefined);\n case \"Symbol\":\n return (symbolKeys ??= Object.getOwnPropertySymbols(input)).filter(k => parameter.matchKey(k, options) !== undefined);\n case \"Union\":\n return [...new Set(parameter.types.flatMap(go))];\n default:\n return [];\n }\n }\n return go(parameterFromPropertyKey(toEncoded(parameter)));\n}\n/**\n * Constructs a {@link PropertySignature}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const 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}\n/**\n * Constructs a {@link IndexSignature}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const 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};\n/**\n * Constructs a {@link Objects}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Objects = class extends ASTNodeImpl {\n _tag = \"Objects\";\n propertySignatures;\n indexSignatures;\n encodingChecks;\n constructor(propertySignatures, indexSignatures, annotations, checks, encoding, context, encodingChecks) {\n super(annotations, checks, encoding, context);\n this.propertySignatures = propertySignatures;\n this.indexSignatures = indexSignatures;\n this.encodingChecks = encodingChecks;\n // Duplicate property signatures\n const seen = new Set();\n const duplicates = [];\n for (const propertySignature of propertySignatures) {\n const name = propertySignature.name;\n if (seen.has(name)) {\n duplicates.push(name);\n } else {\n seen.add(name);\n }\n }\n if (duplicates.length > 0) {\n throw new Error(`Duplicate identifiers: ${JSON.stringify(duplicates)}. ts(2300)`);\n }\n }\n /** @internal */\n getParser(compile, compileConstructorDefault = compile) {\n // oxlint-disable-next-line @typescript-eslint/no-this-alias\n const ast = this;\n const expectedKeys = [];\n for (const ps of ast.propertySignatures) {\n expectedKeys.push(typeof ps.name === \"number\" ? globalThis.String(ps.name) : ps.name);\n }\n const hasProperties = expectedKeys.length;\n const indexCount = ast.indexSignatures.length;\n let expectedKeysSet = hasProperties && indexCount ? new Set(expectedKeys) : undefined;\n // ---------------------------------------------\n // handle empty struct\n // ---------------------------------------------\n if (!hasProperties && !indexCount) {\n return fromRefinement(ast, Predicate.isNotNullish);\n }\n let properties;\n let indexes;\n const finishIndex = (s, key, k2, inputValue, exitValue) => {\n if (exitValue._tag === \"Failure\") {\n return wrapPropertyKeyIssue(s, ast, key, exitValue) ?? Exit.void;\n }\n const value = exitValue === InternalParser.sameExit ? inputValue : exitValue[InternalParser.args];\n if (k2 !== InternalParser.missing && value !== InternalParser.missing) {\n if (hasProperties && (expectedKeysSet.has(key) || expectedKeysSet.has(typeof k2 === \"number\" ? globalThis.String(k2) : k2))) return Exit.void;\n InternalRecord.assignProperty(s.out, k2, value);\n }\n return Exit.void;\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 Effect.flatMap(Effect.exit(eff), exit => parseIndex(s, key, index, exit));\n }\n exitKey = eff;\n }\n if (exitKey._tag === \"Failure\") {\n return wrapPropertyKeyIssue(s, ast, key, exitKey) ?? Exit.void;\n }\n const k2 = exitKey === InternalParser.sameExit ? key : exitKey[InternalParser.args];\n const inputValue = s.input[key];\n const result = index.parserValue(inputValue, s.options);\n return effectIsExit(result) ? finishIndex(s, key, k2, inputValue, result) : Effect.flatMap(Effect.exit(result), exit => finishIndex(s, key, k2, inputValue, exit));\n };\n const parseStringIndex = (s, key, index) => {\n const inputValue = s.input[key];\n const result = index.parserValue(inputValue, s.options);\n return effectIsExit(result) ? finishIndex(s, key, key, inputValue, result) : Effect.flatMap(Effect.exit(result), exit => finishIndex(s, key, key, inputValue, exit));\n };\n const parseIndexes = indexCount ? iterateConcurrent()({\n onItem: (s, [key, index]) => index.is.parameter === string ? parseStringIndex(s, key, index) : parseIndex(s, key, index),\n step: (_s, _item, exit) => exit._tag === \"Failure\" ? exit : undefined\n }) : undefined;\n const compileMembers = () => {\n if (!properties) {\n properties = ast.propertySignatures.map(ps => ({\n parser: compileConstructorDefault(ps.type),\n name: ps.name,\n type: ps.type\n }));\n indexes = indexCount ? ast.indexSignatures.map(is => ({\n is,\n parserKey: compile(parameterFromPropertyKey(is.parameter)),\n parserValue: compileConstructorDefault(is.type)\n })) : undefined;\n }\n return properties;\n };\n const fallback = Effect.fnUntracedEager(function* (input, options) {\n if (input === InternalParser.missing) {\n return InternalParser.missing;\n }\n // If the input is not a record, return early with an error\n if (!(typeof input === \"object\" && input !== null && !Array.isArray(input))) {\n return yield* Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n }\n compileMembers();\n const record = input;\n const out = {};\n const state = {\n ast,\n input: record,\n out,\n issues: undefined,\n options\n };\n const errorsAllOption = options.errors === \"all\";\n const onExcessPropertyError = options.onExcessProperty === \"error\";\n const concurrency = options.concurrency === undefined ? 1 : resolveConcurrency(options.concurrency);\n // ---------------------------------------------\n // handle excess properties\n // ---------------------------------------------\n const indexKeys = indexCount && onExcessPropertyError ? ast.indexSignatures.map(index => getIndexSignatureKeys(record, index.parameter, options)) : undefined;\n if (onExcessPropertyError) {\n expectedKeysSet ??= new Set(expectedKeys);\n const coveredKeys = indexKeys ? new Set(expectedKeysSet) : expectedKeysSet;\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(record);\n for (let i = 0; i < inputKeys.length; i++) {\n const key = inputKeys[i];\n if (!coveredKeys.has(key)) {\n // key is unexpected\n const unexpected = new SchemaIssue.UnexpectedKey(ast, record[key], options);\n const issue = new SchemaIssue.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* Effect.fail(new SchemaIssue.Composite(ast, [issue], input, options));\n }\n }\n }\n }\n // ---------------------------------------------\n // handle property signatures\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 // ---------------------------------------------\n // handle index signatures\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 === string ? parseStringIndex : parseIndex;\n const keys = indexKeys?.[i] ?? (index.is.parameter === string ? Object.keys(record) : getIndexSignatureKeys(record, 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;else if (eff._tag === \"Failure\") return yield* eff;\n }\n }\n } else if (parseIndexes) {\n const keyPairs = Arr.empty();\n for (let i = 0; i < indexCount; i++) {\n const index = indexes[i];\n const keys = indexKeys?.[i] ?? (index.is.parameter === string ? Object.keys(record) : getIndexSignatureKeys(record, 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* Effect.fail(new SchemaIssue.Composite(ast, state.issues, input, options));\n }\n return out;\n });\n if (indexCount) return fallback;\n // Resumes at the property whose parser suspended, without replaying the\n // properties already parsed.\n const resume = (state, index, pending) => {\n const property = properties[index];\n return Effect.flatMap(Effect.exit(pending), exit => {\n const terminal = stepProperty(state, property, exit);\n if (terminal) return terminal;\n const done = () => InternalParser.succeed(state.out);\n const eff = parseProperties(state, properties.slice(index + 1));\n return eff ? Effect.flatMapEager(eff, done) : done();\n });\n };\n // Fast path: a struct without index signatures, under the default parse\n // options, needs none of the generator the fallback runs per value.\n return (input, options) => {\n if (input === InternalParser.missing) return InternalParser.missingExit;\n if (options.errors === \"all\" || options.onExcessProperty !== undefined || options.concurrency !== undefined && resolveConcurrency(options.concurrency) !== 1) {\n return fallback(input, options);\n }\n if (!(typeof input === \"object\" && input !== null && !Array.isArray(input))) {\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n }\n const props = compileMembers();\n const record = input;\n const out = {};\n const state = {\n ast,\n input: record,\n out,\n issues: undefined,\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(record, name);\n const value = hasKey ? record[name] : InternalParser.missing;\n const exit = property.parser(value, options);\n if (!effectIsExit(exit)) {\n return resume(state, index, exit);\n }\n if (exit === InternalParser.sameExit) {\n if (hasKey) InternalRecord.assignProperty(out, name, value);\n continue;\n }\n const terminal = stepProperty(state, property, exit);\n if (terminal) return terminal;\n }\n } catch (error) {\n // `Effect.fnUntracedEager` turns a synchronous throw into a defect\n return Effect.die(error);\n }\n return InternalParser.succeed(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, is => {\n const p = recurParameter(is.parameter);\n const t = recur(is.type);\n return p === is.parameter && t === is.type ? is : 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, undefined, 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, exit) {\n if (exit._tag === \"Failure\") {\n return wrapPropertyKeyIssue(s, s.ast, p.name, exit);\n }\n if (exit === InternalParser.sameExit) return;\n const value = exit[InternalParser.args];\n if (value !== InternalParser.missing) {\n InternalRecord.assignProperty(s.out, p.name, value);\n return;\n }\n delete s.out[p.name];\n if (!isOptional(p.type)) {\n const issue = new SchemaIssue.Pointer([p.name], new SchemaIssue.MissingKey(p.type.context?.annotations));\n if (s.options.errors === \"all\") {\n if (s.issues) s.issues.push(issue);else s.issues = [issue];\n return;\n } else {\n return Exit.fail(new SchemaIssue.Composite(s.ast, [issue], s.input, s.options));\n }\n }\n}\nconst parsePropertiesOptions = {\n onItem(s, p) {\n if (!hasPropertySignature(s.input, p.name)) {\n return p.parser(InternalParser.missing, s.options);\n }\n const value = s.input[p.name];\n InternalRecord.assignProperty(s.out, p.name, value);\n return p.parser(value, s.options);\n },\n step: stepProperty\n};\nconst parseProperties = /*#__PURE__*/iterateEager()(parsePropertiesOptions);\nconst parsePropertiesConcurrent = /*#__PURE__*/iterateConcurrent()(parsePropertiesOptions);\nfunction combineChecks(a, b) {\n if (!a) return b;\n if (!b) return a;\n return [...a, ...b];\n}\n/** @internal */\nexport function 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}\n/** @internal */\nexport function getAST(self) {\n return self.ast;\n}\n/** @internal */\nexport function tuple(elements, checks = undefined) {\n return new Arrays(false, elements.map(e => e.ast), [], undefined, checks);\n}\n/** @internal */\nexport function union(members, options, checks) {\n return new Union(members.map(getAST), options, undefined, checks);\n}\n/** @internal */\nexport function structWithRest(ast, records) {\n if (ast.encoding || records.some(r => r.encoding)) {\n throw new Error(\"StructWithRest does not support encodings\");\n }\n let propertySignatures = ast.propertySignatures;\n let indexSignatures = ast.indexSignatures;\n let checks = ast.checks;\n for (const record of records) {\n propertySignatures = propertySignatures.concat(record.propertySignatures);\n indexSignatures = indexSignatures.concat(record.indexSignatures);\n checks = combineChecks(checks, record.checks);\n }\n return new Objects(propertySignatures, indexSignatures, undefined, checks);\n}\n/** @internal */\nexport function tupleWithRest(ast, rest) {\n if (ast.encoding) {\n throw new Error(\"TupleWithRest does not support encodings\");\n }\n return new Arrays(ast.isMutable, ast.elements, rest, undefined, ast.checks);\n}\n/** @internal */\nexport function mutable(ast) {\n if (ast.encoding) {\n throw new Error(\"mutable does not support encodings\");\n }\n return new Arrays(true, ast.elements, ast.rest, ast.annotations, ast.checks, undefined, ast.context, ast.encodingChecks);\n}\nconst toCandidate = /*#__PURE__*/memoizeIdempotent(ast => {\n while (true) {\n if (isSuspend(ast)) return unknown;\n const encoding = ast.encoding;\n if (!encoding) {\n // Index signature parameters do not participate in union selection.\n return ast.recur?.(toCandidate, identity) ?? ast;\n }\n if (encoding.some(link => link.transformation._tag === \"Middleware\" && link.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}\n/** @internal */\nexport function collectSentinels(ast) {\n switch (ast._tag) {\n default:\n return [];\n case \"Declaration\":\n {\n const s = ast.annotations?.[InternalAnnotations.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 {\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}\nconst candidateIndexCache = /*#__PURE__*/new WeakMap();\nconst emptyCandidates = /*#__PURE__*/Object.freeze([]);\nconst hasPropertySignature = (input, key) => key === \"__proto__\" ? Object.hasOwn(input, key) : key in input;\nfunction getIndex(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 for (let i = 0; i < types.length; i++) {\n const a = types[i];\n const encoded = toCandidate(a);\n if (isNever(encoded)) continue;\n if (onlyLiterals) {\n if (isLiteral(encoded) || isUniqueSymbol(encoded)) {\n literalCandidates ??= new Map();\n const literal = isLiteral(encoded) ? encoded.literal : encoded.symbol;\n let arr = literalCandidates.get(literal);\n if (!arr) literalCandidates.set(literal, arr = []);\n arr.push(a);\n } else {\n onlyLiterals = false;\n }\n }\n const sentinels = collectSentinels(encoded);\n if (sentinels.length) {\n // discriminated variants\n bySentinel ??= 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 = [new Map(), new Set()]);\n entry[1].add(i);\n let indexes = entry[0].get(literal);\n if (!indexes) entry[0].set(literal, indexes = new Set());\n indexes.add(i);\n }\n } else {\n // non-discriminated\n otherwise ??= {};\n const candidateTypes = getCandidateTypes(encoded);\n for (const t of candidateTypes) (otherwise[t] ??= []).push(i);\n }\n }\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 = byValue;\n for (const [literal, indexes] of byValue) {\n candidates.set(literal, Object.freeze(Array.from(indexes, index => types[index])));\n }\n index = (input, isConstructor) => {\n if (Predicate.isObjectKeyword(input)) {\n const value = hasPropertySignature(input, key) ? input[key] : undefined;\n if (value !== undefined) return candidates.get(value) ?? emptyCandidates;\n if (isConstructor) return types;\n }\n return emptyCandidates;\n };\n } else if (bySentinel) {\n // A key owned by every discriminated candidate is safe to use as the initial selector: no candidate can\n // be excluded merely because it uses a different sentinel key. Prefer the key with the most distinct values\n // to minimize the matching bucket.\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 = input === null ? \"null\" : Array.isArray(input) ? \"array\" : typeof input;\n const base = otherwise?.[runtimeType] ?? emptyCandidates;\n if (!Predicate.isObjectKeyword(input)) return base.map(i => types[i]);\n // Non-discriminated candidates are runtime-type fallbacks and are never removed by sentinel checks.\n const selected = new Set(base);\n let directKey;\n // An observed common key can seed the selection directly; an unknown value rules out every\n // discriminated candidate.\n if (commonSentinel) {\n const [key, [byValue]] = commonSentinel;\n const hasKey = hasPropertySignature(input, key);\n const value = hasKey ? input[key] : undefined;\n if (hasKey && (!isConstructor || value !== undefined)) {\n const match = byValue.get(value);\n if (!match) return base.map(i => types[i]);\n for (const i of match) selected.add(i);\n directKey = key;\n }\n }\n // Without an observed common key, collect positive matches from every sentinel. Constructor mode treats\n // absent and undefined keys as unconstrained and therefore selects every candidate that owns the key.\n if (directKey === undefined) {\n for (const [key, [byValue, all]] of bySentinel) {\n const hasKey = hasPropertySignature(input, key);\n const value = hasKey ? input[key] : undefined;\n if (hasKey && (!isConstructor || value !== undefined)) {\n const match = byValue.get(value);\n if (match) {\n for (const i of match) selected.add(i);\n }\n } else if (isConstructor) {\n for (const i of all) selected.add(i);\n }\n }\n }\n // Missing keys are neutral. An observed key rejects only selected candidates that own it and do not match.\n for (const [key, [byValue, all]] of bySentinel) {\n if (key === directKey) continue;\n const hasKey = hasPropertySignature(input, key);\n const value = hasKey ? input[key] : undefined;\n if (hasKey && (!isConstructor || value !== undefined)) {\n const match = byValue.get(value);\n for (const i of selected) {\n if (all.has(i) && !match?.has(i)) selected.delete(i);\n }\n }\n }\n return Array.from(selected).sort((a, b) => a - b).map(i => types[i]);\n };\n } else {\n index = input => {\n const runtimeType = input === null ? \"null\" : Array.isArray(input) ? \"array\" : typeof input;\n return (otherwise?.[runtimeType] ?? emptyCandidates).map(i => types[i]).filter(filterLiterals(input));\n };\n }\n candidateIndexCache.set(types, index);\n return index;\n}\nfunction filterLiterals(input) {\n return ast => {\n const encoded = toCandidate(ast);\n return encoded._tag === \"Literal\" ? encoded.literal === input : encoded._tag === \"UniqueSymbol\" ? encoded.symbol === input : true;\n };\n}\n/**\n * The goal is to reduce the number of a union members that will be checked.\n * This is useful to reduce the number of issues that will be returned.\n *\n * @internal\n */\nexport function getCandidates(input, types, isConstructor = false) {\n return getIndex(types)(input, isConstructor);\n}\n/**\n * Constructs a {@link Union}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Union = class extends ASTNodeImpl {\n _tag = \"Union\";\n types;\n options;\n encodingChecks;\n constructor(types, options, annotations, checks, encoding, context, encodingChecks) {\n super(annotations, checks, encoding, context);\n this.types = types;\n this.options = options;\n this.encodingChecks = encodingChecks;\n }\n /** @internal */\n getParser(compile, compileConstructorDefault) {\n // oxlint-disable-next-line @typescript-eslint/no-this-alias\n const ast = this;\n return (input, options) => {\n if (input === InternalParser.missing) {\n return InternalParser.missingExit;\n }\n const candidates = getCandidates(input, ast.types, compileConstructorDefault !== undefined);\n if (candidates.length === 0) {\n return Effect.fail(new SchemaIssue.AnyOf(ast, [], input, options));\n }\n if (candidates.length === 1) {\n const result = compile(candidates[0])(input, options);\n if (result._tag === \"Success\") return result;\n return effectIsExit(result) ? failSingleUnionCandidate(ast, result.cause, input, options) : Effect.catchCause(result, cause => failSingleUnionCandidate(ast, cause, input, options));\n }\n const state = {\n ast,\n compile,\n input,\n out: undefined,\n successes: ast.options?.mode === \"oneOf\" ? [] : undefined,\n issues: undefined,\n options\n };\n const eff = parseUnion(state, candidates);\n if (!eff) {\n if (state.out) return state.out;\n return Effect.fail(new SchemaIssue.AnyOf(ast, state.issues ?? [], input, options));\n }\n return Effect.flatMapEager(eff, _ => {\n if (state.out === InternalParser.sameExit) return Effect.succeed(input);\n if (state.out) return state.out;\n return Effect.fail(new SchemaIssue.AnyOf(ast, state.issues ?? [], input, options));\n });\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, undefined, 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 !== undefined) return out;\n }\n return undefined;\n }\n /** @internal */\n getExpected(getExpected) {\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 {\n const literals = encoded.elements.filter(isLiteral);\n if (literals.length > 0) {\n return `${formatIsMutable(encoded.isMutable)}[ ${literals.map(e => getExpected(e) + formatIsOptional(e.context?.isOptional)).join(\", \")}, ... ]`;\n }\n break;\n }\n case \"Objects\":\n {\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)}: ${getExpected(ps.type)}`).join(\", \")}, ... }`;\n }\n break;\n }\n }\n return getExpected(encoded);\n });\n return Array.from(new Set(types)).join(\" | \");\n }\n};\nfunction failSingleUnionCandidate(ast, cause, input, options) {\n const issue = InternalSchemaCause.getSchemaIssue(cause);\n if (!issue) return Exit.failCause(cause);\n return Exit.fail(new SchemaIssue.AnyOf(ast, [issue], input, options));\n}\nconst parseUnion = /*#__PURE__*/iterateEager()({\n onItem(s, ast) {\n const parser = s.compile(ast);\n return parser(s.input, s.options);\n },\n step(s, candidate, exit) {\n if (exit._tag === \"Failure\") {\n const issue = InternalSchemaCause.getSchemaIssue(exit.cause);\n if (issue === undefined) {\n return exit;\n }\n if (s.issues) s.issues.push(issue);else s.issues = [issue];\n } else {\n if (s.out && s.successes) {\n s.successes.push(candidate);\n return Exit.fail(new SchemaIssue.OneOf(s.ast, s.successes, s.input, s.options));\n }\n s.out = exit;\n if (s.successes) {\n s.successes.push(candidate);\n } else {\n return Exit.void;\n }\n }\n }\n});\nconst 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(isOptional) {\n return isOptional ? \"?\" : \"\";\n}\n/**\n * Constructs a {@link Suspend}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Suspend = class extends ASTNodeImpl {\n _tag = \"Suspend\";\n thunk;\n constructor(thunk, annotations, checks, encoding, context) {\n if (checks) {\n throw new Error(\"Cannot add checks to Suspend\");\n }\n super(annotations, undefined, encoding, context);\n let ast;\n this.thunk = () => ast ??= thunk();\n }\n /** @internal */\n getParser(compile) {\n let parser;\n return (input, options) => (parser ??= compile(this.thunk()))(input, options);\n }\n /** @internal */\n recur(recur) {\n return new Suspend(() => recur(this.thunk()), this.annotations, undefined, undefined, this.context);\n }\n /** @internal */\n getExpected(getExpected) {\n return getExpected(this.thunk());\n }\n};\n/**\n * Constructs a {@link Filter}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Filter = class extends Pipeable.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(run, annotations = undefined,\n /**\n * Whether the parsing process should be aborted after this check has failed.\n */\n aborted = false) {\n super();\n this.run = run;\n this.annotations = annotations;\n this.aborted = aborted;\n }\n annotate(annotations) {\n return new Filter(this.run, {\n ...this.annotations,\n ...annotations\n }, this.aborted);\n }\n abort() {\n return new Filter(this.run, this.annotations, true);\n }\n and(other, annotations) {\n return new FilterGroup([this, other], annotations);\n }\n};\n/**\n * Constructs a {@link FilterGroup}.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const FilterGroup = class extends Pipeable.Class {\n _tag = \"FilterGroup\";\n checks;\n annotations;\n constructor(checks, annotations = undefined) {\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};\n/** @internal */\nexport function makeFilter(filter, annotations, aborted = false) {\n return new Filter((input, ast, options) => SchemaIssue.normalizeFilterOutput(ast, filter(input, ast, options), input, options), annotations, aborted);\n}\n/** @internal */\nexport function makeFilterByGuard(is, annotations) {\n return new Filter((input, _ast, options) => is(input) ? undefined : new SchemaIssue.InvalidValue(undefined, input, options), annotations, true // after a guard, we always want to abort\n );\n}\n/** @internal */\nexport function 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}\n/** @internal */\nexport const finite = /*#__PURE__*/appendChecks(number, [/*#__PURE__*/isFinite()]);\nconst numberToJson = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finite, nonFiniteLiterals]), /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.Number(), /*#__PURE__*/SchemaGetter.transform(n => globalThis.Number.isFinite(n) ? n : globalThis.String(n))));\n/**\n * Creates a {@link Filter} that validates strings by running `RegExp.test`.\n *\n * **When to use**\n *\n * Use when string validation should be represented as a schema `Filter` backed\n * by a regular expression.\n *\n * **Details**\n *\n * The filter can be used with `Schema.filter` or attached directly to a\n * `String` AST node through checks. The regular expression is cloned and its\n * `lastIndex` is reset before each test, so global and sticky expressions are\n * deterministic and the provided regular expression is not mutated. The\n * regular expression source is stored in annotations for serialization and\n * arbitrary generation.\n *\n * **Gotchas**\n *\n * Arbitrary metadata preserves both `regExp.source` and `regExp.flags`.\n * Implementations that cannot consume all flags may still use the source as a\n * generation hint because the Schema filter validates every generated value.\n * JSON Schema has no way to carry JavaScript regular-expression flags. The\n * generated `pattern` contains the source only, so validation can differ when\n * the RegExp uses flags or relies on JavaScript's non-Unicode behavior.\n *\n * **Example** (Validating an email pattern)\n *\n * ```ts import.meta.vitest\n * import { SchemaAST } from \"effect\"\n *\n * const emailFilter = SchemaAST.isPattern(/^[^@]+@[^@]+$/)\n * emailFilter.run(\"alice@example.com\", SchemaAST.string, {}) // => undefined\n * emailFilter.run(\"invalid\", SchemaAST.string, {})?._tag // => \"InvalidValue\"\n * ```\n *\n * @see {@link Filter}\n * @category constructors\n * @since 4.0.0\n */\nexport function isPattern(regExp, annotations) {\n const source = regExp.source;\n const pattern = new globalThis.RegExp(source, regExp.flags);\n return makeFilter(s => {\n pattern.lastIndex = 0;\n return pattern.test(s);\n }, {\n expected: `a string matching the RegExp ${source}`,\n representation: {\n id: \"effect/schema/isPattern\",\n payload: {\n source,\n flags: regExp.flags\n }\n },\n toJsonSchema: () => ({\n pattern: source\n }),\n arbitraryConstraint: {\n patterns: [{\n source: regExp.source,\n flags: regExp.flags\n }]\n },\n ...annotations\n });\n}\nfunction modifyOwnPropertyDescriptors(ast, f) {\n const d = Object.getOwnPropertyDescriptors(ast);\n f(d);\n return Object.create(Object.getPrototypeOf(ast), d);\n}\nconst contextOwners = /*#__PURE__*/new WeakMap();\n/** @internal */\nexport function getContextOwner(ast) {\n return contextOwners.get(ast) ?? ast;\n}\n/** @internal */\nexport function replaceEncoding(ast, encoding) {\n if (ast.encoding === encoding) {\n return ast;\n }\n return modifyOwnPropertyDescriptors(ast, d => {\n d.encoding.value = encoding;\n });\n}\n/** @internal */\nexport function replaceContext(ast, context) {\n if (ast.context === context) {\n return ast;\n }\n const owner = getContextOwner(ast);\n if (owner.context === context) {\n return owner;\n }\n const out = modifyOwnPropertyDescriptors(ast, d => {\n d.context.value = context;\n });\n contextOwners.set(out, owner);\n return out;\n}\n/** @internal */\nexport function getLastEncoding(ast) {\n return ast.encoding ? getLastEncoding(ast.encoding[ast.encoding.length - 1].to) : ast;\n}\n/** @internal */\nexport function annotate(ast, annotations) {\n if (ast.checks) {\n const last = ast.checks[ast.checks.length - 1];\n return replaceChecks(ast, Arr.append(ast.checks.slice(0, -1), last.annotate(annotations)));\n }\n return modifyOwnPropertyDescriptors(ast, d => {\n d.annotations.value = {\n ...d.annotations.value,\n ...annotations\n };\n });\n}\n/** @internal */\nexport function 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 modifyOwnPropertyDescriptors(ast, d => {\n d.checks.value = checks;\n });\n}\n/** @internal */\nexport function appendChecks(ast, checks) {\n return replaceChecks(ast, combineChecks(ast.checks, checks));\n}\n/** @internal */\nexport function mapLink(link, f) {\n const to = f(link.to);\n return to === link.to ? link : new Link(to, link.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 : Arr.append(encoding.slice(0, encoding.length - 1), out);\n}\n/** @internal */\nexport function applyToLastLink(f) {\n return ast => ast.encoding ? replaceEncoding(ast, updateLastLink(ast.encoding, f)) : ast;\n}\n/** @internal */\nexport function replaceContextLastLink(ast, context) {\n return applyToLastLink(ast => replaceContext(ast, context))(ast);\n}\n/** @internal */\nexport function applyToSelfOrLastLinkEncoding(f) {\n function out(ast) {\n return ast.encoding ? replaceEncoding(ast, updateLastLink(ast.encoding, out)) : f(ast);\n }\n return memoize(out);\n}\n/** @internal */\nexport function 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}\n/** @internal */\nexport function middlewareDecoding(ast, middleware) {\n return appendTransformation(ast, middleware, toType(ast));\n}\n/** @internal */\nexport function middlewareEncoding(ast, middleware) {\n return appendTransformation(toEncoded(ast), middleware, ast);\n}\nfunction appendTransformation(from, transformation, to) {\n const link = new Link(from, transformation);\n return replaceEncoding(to, to.encoding ? [...to.encoding, link] : [link]);\n}\n/** @internal */\nexport function brand(ast, brand) {\n const existing = InternalAnnotations.resolveBrands(ast);\n const brands = existing ? [...existing, brand] : [brand];\n return annotate(ast, {\n brands\n });\n}\nexport function mapOrSame(as, f) {\n let changed = false;\n const out = new Array(as.length);\n for (let i = 0; i < as.length; i++) {\n const a = as[i];\n const fa = f(a);\n if (fa !== a) {\n changed = true;\n }\n out[i] = fa;\n }\n return changed ? out : as;\n}\n/** @internal */\nexport function annotateKey(ast, annotations) {\n const context = ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, ast.context.constructorDefault, {\n ...ast.context.annotations,\n ...annotations\n }) : new Context(false, false, undefined, annotations);\n return replaceContext(ast, context);\n}\n/** @internal */\nexport const optionalKey = /*#__PURE__*/memoizeIdempotent(ast => {\n const context = ast.context ? ast.context.isOptional === false ? new Context(true, ast.context.isMutable, ast.context.constructorDefault, ast.context.annotations) : ast.context : new Context(true, false);\n return optionalKeyLastLink(replaceContext(ast, context));\n});\nconst optionalKeyLastLink = /*#__PURE__*/applyToLastLink(optionalKey);\n/** @internal */\nexport const optional = /*#__PURE__*/memoize(ast => optionalKey(new Union([ast, undefined_])));\n/** @internal */\nexport const mutableKey = /*#__PURE__*/memoizeIdempotent(ast => {\n const context = ast.context ? ast.context.isMutable === false ? new Context(ast.context.isOptional, true, ast.context.constructorDefault, ast.context.annotations) : ast.context : new Context(false, true);\n return mutableKeyLastLink(replaceContext(ast, context));\n});\nconst mutableKeyLastLink = /*#__PURE__*/applyToLastLink(mutableKey);\n/** @internal */\nexport function withConstructorDefault(ast, defaultValue) {\n const transformation = new SchemaTransformation.Transformation(SchemaGetter.withDefault(defaultValue), SchemaGetter.passthrough());\n const constructorDefault = new Link(unknown, transformation);\n const context = ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, constructorDefault, ast.context.annotations) : new Context(false, false, constructorDefault);\n return replaceContext(ast, context);\n}\n/**\n * Attaches a `Transformation` to the `to` AST, making it decode from the\n * `from` AST and encode back to it.\n *\n * **Details**\n *\n * This is the low-level primitive behind `Schema.decodeTo`. It appends a\n * {@link Link} to the `to` node's encoding chain.\n *\n * - Returns a new AST with the same type as `to`.\n *\n * @see {@link Link}\n * @see {@link Encoding}\n * @see {@link flip}\n * @category transforming\n * @since 4.0.0\n */\nexport function decodeTo(from, to, transformation) {\n return appendTransformation(from, transformation, to);\n}\nfunction parseParameter(ast) {\n const literals = [];\n const parameters = [];\n function go(ast) {\n switch (ast._tag) {\n case \"Literal\":\n if (Predicate.isPropertyKey(ast.literal)) {\n literals.push(ast.literal);\n }\n return;\n case \"UniqueSymbol\":\n literals.push(ast.symbol);\n return;\n case \"Never\":\n return;\n case \"Union\":\n for (let i = 0; i < ast.types.length; i++) {\n go(ast.types[i]);\n }\n return;\n default:\n parameters.push(ast);\n }\n }\n go(ast);\n return {\n literals,\n parameters\n };\n}\n/** @internal */\nexport function record(key, value) {\n const {\n literals,\n parameters: indexSignatures\n } = parseParameter(key);\n return new Objects(literals.map(literal => new PropertySignature(literal, value)), indexSignatures.map(parameter => new IndexSignature(parameter, value)));\n}\n// -------------------------------------------------------------------------------------\n// Public APIs\n// -------------------------------------------------------------------------------------\n/**\n * Returns `true` if the AST node represents an optional property.\n *\n * **Details**\n *\n * Checks `ast.context?.isOptional`. Defaults to `false` when no\n * {@link Context} is set.\n *\n * @see `Schema.optionalKey`\n * @see {@link Context}\n * @category predicates\n * @since 4.0.0\n */\nexport function isOptional(ast) {\n return ast.context?.isOptional ?? false;\n}\n/** @internal */\nexport function isMutable(ast) {\n return ast.context?.isMutable ?? false;\n}\nfunction isStructuralCheck(check) {\n return check.annotations?.[InternalAnnotations.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 Arr.isArrayNonEmpty(out) ? out : undefined;\n}\n/**\n * Strips all encoding transformations from an AST, returning the decoded\n * (type-level) representation.\n *\n * **Details**\n *\n * - Memoized: same input reference → same output reference.\n * - Recursively walks into composite nodes ({@link Arrays}, {@link Objects},\n * {@link Union}, {@link Suspend}).\n *\n * **Example** (Getting the type AST)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaAST } from \"effect\"\n *\n * const schema = Schema.NumberFromString\n * const typeAst = SchemaAST.toType(schema.ast)\n * typeAst._tag // => \"Number\"\n * ```\n *\n * @see {@link toEncoded}\n * @see {@link flip}\n * @category transforming\n * @since 4.0.0\n */\nexport const toType = /*#__PURE__*/memoizeIdempotent(ast => {\n if (ast.encoding) {\n return toType(replaceEncoding(ast, undefined));\n }\n const out = ast;\n const type = out.recur?.(toType) ?? out;\n const encodingChecks = type.encodingChecks;\n if (encodingChecks) {\n const checks = type === ast ? encodingChecks : isArrays(type) || isObjects(type) || isDeclaration(type) && type.typeParameters.length > 0 ? extractStructuralChecks(encodingChecks) : undefined;\n return modifyOwnPropertyDescriptors(type, d => {\n d.encodingChecks.value = undefined;\n d.checks.value = combineChecks(type.checks, checks);\n });\n }\n return type;\n});\n/**\n * Returns the encoded (wire-format) AST by flipping and then stripping\n * encodings.\n *\n * **Details**\n *\n * Equivalent to `toType(flip(ast))`. This gives you the AST that describes\n * the shape of the serialized/encoded data.\n *\n * - Memoized: same input reference → same output reference.\n *\n * **Example** (Getting the encoded AST)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaAST } from \"effect\"\n *\n * const schema = Schema.NumberFromString\n * const encodedAst = SchemaAST.toEncoded(schema.ast)\n * encodedAst._tag // => \"String\"\n * ```\n *\n * @see {@link toType}\n * @see {@link flip}\n * @category transforming\n * @since 4.0.0\n */\nexport const toEncoded = /*#__PURE__*/memoizeIdempotent(ast => {\n return toType(flip(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(flip(replaceEncoding(ast, undefined)), links[0].transformation.flip())];\n for (let i = 1; i < len; i++) {\n ls.unshift(new Link(flip(links[i - 1].to), links[i].transformation.flip()));\n }\n const to = flip(last.to);\n if (to.encoding) {\n return replaceEncoding(to, [...to.encoding, ...ls]);\n } else {\n return replaceEncoding(to, ls);\n }\n}\n/**\n * Swaps the decode and encode directions of an AST's {@link Encoding} chain.\n *\n * **Details**\n *\n * After flipping, what was decoding becomes encoding and vice versa. This is\n * the core operation behind `Schema.encode` — encoding a value is decoding\n * with a flipped SchemaAST.\n *\n * - Memoized: same input reference → same output reference.\n * - Recursively walks composite nodes.\n *\n * @see {@link toType}\n * @see {@link toEncoded}\n * @category transforming\n * @since 4.0.0\n */\nexport const flip = /*#__PURE__*/memoize(ast => {\n if (ast.encoding) {\n return flipEncoding(ast, ast.encoding);\n }\n const out = ast;\n return out.flip?.(flip) ?? out.recur?.(flip) ?? out;\n});\n/** @internal */\nexport function 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 succeed = value === 0 ? InternalParser.sameExit : InternalParser.succeed(value);\n return (input, options) => {\n if (input === InternalParser.missing) return InternalParser.missingExit;\n if (input === value) return succeed;\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n };\n}\nfunction fromRefinement(ast, refinement) {\n return (input, options) => {\n if (input === InternalParser.missing) return InternalParser.missingExit;\n if (refinement(input)) return InternalParser.sameExit;\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n };\n}\nfunction segmentTemplateLiteralParts(ast, input, options) {\n const parts = ast.encodedParts;\n const literals = ast.literals;\n const inputLength = input.length;\n for (let i = 0; i < literals.length; i++) {\n const literal = literals[i];\n if (literal && !input.includes(literal)) return undefined;\n }\n if (ast.suffixLengths[0] > inputLength) return undefined;\n const out = new Array(parts.length);\n let failures;\n function go(i, pos) {\n if (i === parts.length) return pos === inputLength;\n if (failures?.has(i * (inputLength + 1) + pos)) return false;\n const part = parts[i];\n if (i === parts.length - 1) {\n const s = input.slice(pos);\n if (part.matchPart(s, options) !== undefined) {\n out[i] = s;\n return true;\n }\n } else if (part._tag === \"Literal\") {\n const s = literals[i];\n if (input.startsWith(s, pos) && go(i + 1, pos + s.length)) {\n out[i] = s;\n return true;\n }\n } else {\n const maximumEnd = inputLength - ast.suffixLengths[i + 1];\n // Splits preceding a literal only need to consider occurrences of that literal.\n const anchor = literals[i + 1];\n let end = anchor === undefined ? maximumEnd : input.lastIndexOf(anchor, maximumEnd);\n while (end >= pos) {\n const s = input.slice(pos, end);\n if (part.matchPart(s, options) !== undefined && go(i + 1, end)) {\n out[i] = s;\n return true;\n }\n if (end === 0) break;\n end = anchor === undefined ? end - 1 : input.lastIndexOf(anchor, end - 1);\n }\n }\n failures ??= new Set();\n failures.add(i * (inputLength + 1) + pos);\n return false;\n }\n return go(0, 0) ? out : undefined;\n}\nconst 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});\n/** @internal */\nexport const parameterFromString = /*#__PURE__*/applyToSelfOrLastLinkEncodingIdempotent(ast => {\n switch (ast._tag) {\n default:\n return ast;\n case \"Symbol\":\n case \"UniqueSymbol\":\n return ast.toCodecStringTree();\n case \"Union\":\n return ast.recur(parameterFromString);\n }\n});\nconst partFromString = /*#__PURE__*/applyToSelfOrLastLinkEncodingIdempotent(ast => {\n switch (ast._tag) {\n default:\n return ast;\n case \"Number\":\n case \"Literal\":\n case \"BigInt\":\n return ast.toCodecStringTree();\n case \"Union\":\n return ast.recur(partFromString);\n }\n});\n/**\n * any string, including newlines\n * @internal\n */\nexport const STRING_PATTERN = \"[\\\\s\\\\S]*?\";\nconst isStringFiniteRegExp = /*#__PURE__*/new globalThis.RegExp(`^${FINITE_PATTERN}$`);\nconst isStringNumberRegExp = /*#__PURE__*/new globalThis.RegExp(`^(?:${FINITE_PATTERN}|Infinity|-Infinity|NaN)$`);\n/** @internal */\nexport function 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}\nconst finiteString = /*#__PURE__*/appendChecks(string, [/*#__PURE__*/isStringFinite()]);\nconst finiteToString = /*#__PURE__*/new Link(finiteString, SchemaTransformation.numberFromString);\nconst numberToString = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finiteString, nonFiniteLiterals]), SchemaTransformation.numberFromString);\n/**\n * signed integer only (no leading \"+\" because TypeScript doesn't support it)\n */\nconst BIGINT_PATTERN = \"-?\\\\d+\";\nconst isStringBigIntRegExp = /*#__PURE__*/new globalThis.RegExp(`^${BIGINT_PATTERN}$`);\n/** @internal */\nexport function isStringBigInt(annotations) {\n return isPattern(isStringBigIntRegExp, {\n expected: \"a string representing a bigint\",\n representation: {\n id: \"effect/schema/isStringBigInt\",\n payload: null\n },\n toJsonSchema: () => ({\n pattern: isStringBigIntRegExp.source\n }),\n ...annotations\n });\n}\n/** @internal */\nexport const bigIntString = /*#__PURE__*/appendChecks(string, [/*#__PURE__*/isStringBigInt({\n expected: \"a string representing a bigint\"\n})]);\nconst bigIntToString = /*#__PURE__*/new Link(bigIntString, SchemaTransformation.bigintFromString);\nconst REGEXP_PATTERN = \"Symbol\\\\(([\\\\s\\\\S]*)\\\\)\";\nconst isStringSymbolRegExp = /*#__PURE__*/new globalThis.RegExp(`^${REGEXP_PATTERN}$`);\n/** @internal */\nexport const symbolString = /*#__PURE__*/appendChecks(string, [/*#__PURE__*/isStringSymbol()]);\n/**\n * to distinguish between Symbol and String, we need to add a check to the string keyword\n */\nconst symbolToString = /*#__PURE__*/new Link(symbolString, /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.transform(description => globalThis.Symbol.for(isStringSymbolRegExp.exec(description)[1])), /*#__PURE__*/SchemaGetter.transformEffect((sym, options) => {\n const key = globalThis.Symbol.keyFor(sym);\n if (key !== undefined) {\n return Effect.succeed(globalThis.String(sym));\n }\n return Effect.fail(new SchemaIssue.Forbidden({\n message: \"cannot serialize to string, Symbol is not registered\"\n }, sym, options));\n})));\n/** @internal */\nexport function isStringSymbol(annotations) {\n return isPattern(isStringSymbolRegExp, {\n expected: \"a string representing a symbol\",\n representation: {\n id: \"effect/schema/isStringSymbol\",\n payload: null\n },\n toJsonSchema: () => ({\n pattern: isStringSymbolRegExp.source\n }),\n ...annotations\n });\n}\n/** @internal */\nexport function 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 filter = new SchemaIssue.Filter(check, issue, value, options);\n if (issues) issues.push(filter);else issues = [filter];\n if (options.errors !== \"all\" || check.aborted) {\n return issues;\n }\n }\n }\n }\n return issues;\n}\n/** @internal */\nexport function runChecks(checks, s) {\n const issues = collectIssues(checks, s, undefined, unknown, {\n errors: \"all\"\n });\n if (issues) {\n const issue = new SchemaIssue.Composite(unknown, issues);\n return Result.fail(issue);\n }\n return Result.succeed(s);\n}\n/** @internal */\nexport function getConstructorDescriptor(ast) {\n if (!isDeclaration(ast)) return undefined;\n const getDescriptor = ast.annotations?.[InternalAnnotations.CONSTRUCTOR_ANNOTATION_KEY];\n return Predicate.isFunction(getDescriptor) ? getDescriptor(ast.typeParameters) : undefined;\n}\n/**\n * Returns all annotations from the AST node.\n *\n * **Details**\n *\n * If the node has {@link Checks}, returns annotations from the last check\n * (which is where user-supplied annotations end up after `.pipe(Schema.annotations(...))`).\n * Otherwise returns the node's `annotations` directly.\n *\n * **Example** (Reading annotations)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaAST } from \"effect\"\n *\n * const schema = Schema.String.annotate({ title: \"Name\" })\n * const annotations = SchemaAST.resolve(schema.ast)\n * annotations?.title // => \"Name\"\n * ```\n *\n * @see {@link resolveAt}\n * @see {@link resolveIdentifier}\n * @see {@link resolveTitle}\n * @see {@link resolveDescription}\n * @category annotations\n * @since 4.0.0\n */\nexport const resolve = InternalAnnotations.resolve;\n/**\n * Returns a single annotation value by key from the AST node.\n *\n * **Details**\n *\n * Like {@link resolve}, reads from the last check's annotations when checks\n * are present. Returns `undefined` if the key is not found.\n *\n * @see {@link resolve}\n * @category annotations\n * @since 4.0.0\n */\nexport const resolveAt = InternalAnnotations.resolveAt;\n/**\n * Returns the `identifier` annotation from the AST node, if set.\n *\n * **Details**\n *\n * The identifier is typically set by `Schema.annotations({ identifier: \"...\" })`\n * and is used for error messages and schema identification.\n *\n * @see {@link resolve}\n * @see {@link resolveTitle}\n * @category annotations\n * @since 4.0.0\n */\nexport const resolveIdentifier = InternalAnnotations.resolveIdentifier;\n/**\n * Returns the `title` annotation from the AST node, if set.\n *\n * @see {@link resolve}\n * @see {@link resolveIdentifier}\n * @see {@link resolveDescription}\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const resolveTitle = InternalAnnotations.resolveTitle;\n/**\n * Returns the `description` annotation from the AST node, if set.\n *\n * @see {@link resolve}\n * @see {@link resolveTitle}\n * @see {@link resolveIdentifier}\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const resolveDescription = InternalAnnotations.resolveDescription;\nfunction isJsonLeaf(u) {\n return u === null || typeof u === \"string\" || typeof u === \"boolean\" || typeof u === \"number\" && globalThis.Number.isFinite(u);\n}\nfunction isStringTreeLeaf(u) {\n return u === undefined || typeof u === \"string\";\n}\nfunction isTree(u, isLeaf) {\n const cache = new WeakMap();\n const stack = [];\n outer: while (true) {\n if (typeof u !== \"object\" || u === null) {\n if (!isLeaf(u)) {\n return false;\n }\n } else {\n const value = u;\n const cached = cache.get(value);\n // `false` marks a node on the current path, while `true` marks a fully\n // validated node that can be safely reused by a DAG.\n if (cached === false) {\n return false;\n }\n if (cached === undefined) {\n const isArray = Array.isArray(value);\n if (!isArray) {\n const prototype = Object.getPrototypeOf(value);\n // A plain object from another realm has a different Object.prototype,\n // but that prototype still has a null prototype.\n if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {\n return false;\n }\n }\n cache.set(value, false);\n stack.push({\n value,\n keys: isArray ? value.length : Object.keys(value),\n index: 0\n });\n }\n }\n while (stack.length > 0) {\n const frame = stack[stack.length - 1];\n const keys = frame.keys;\n if (typeof keys === \"number\") {\n if (frame.index < keys) {\n // A sparse slot is read as `undefined`; the leaf predicate determines\n // whether that is valid for the current tree.\n u = frame.value[frame.index++];\n continue outer;\n }\n } else if (frame.index < keys.length) {\n u = frame.value[keys[frame.index++]];\n continue outer;\n }\n cache.set(frame.value, true);\n stack.pop();\n }\n return true;\n }\n}\n/**\n * Returns true if the value is a JSON value.\n *\n * When a cyclic reference is detected, returns false.\n *\n * @internal\n */\nexport function isJson(u) {\n return isTree(u, isJsonLeaf);\n}\n/** @internal */\nexport const Json = /*#__PURE__*/new Declaration([], () => (input, ast, options) => isJson(input) ? InternalParser.sameExit : Effect.fail(new SchemaIssue.InvalidType(ast, input, options)), {\n representation: {\n id: \"effect/schema/Json\",\n payload: null\n },\n expected: \"JSON value\",\n toCodecJson: () => undefined,\n toCodecStringTree: () => unknownToStringTree\n});\n/** @internal */\nexport const MutableJson = /*#__PURE__*/annotate(Json, {\n representation: {\n id: \"effect/schema/MutableJson\",\n payload: null\n }\n});\n/** @internal */\nexport const unknownToJson = /*#__PURE__*/new Link(Json, /*#__PURE__*/SchemaTransformation.passthrough());\n/** @internal */\nexport const objectKeywordToJson = /*#__PURE__*/new Link(/*#__PURE__*/new Union([/*#__PURE__*/new Arrays(false, [], [Json]), /*#__PURE__*/new Objects([], [/*#__PURE__*/new IndexSignature(string, Json)])]), /*#__PURE__*/SchemaTransformation.passthrough());\n/**\n * Returns true if the value is a StringTree value.\n *\n * When a cyclic reference is detected, returns false.\n *\n * @internal\n */\nexport function isStringTree(u) {\n return isTree(u, isStringTreeLeaf);\n}\nconst StringTree = /*#__PURE__*/new Declaration([], () => (input, ast, options) => isStringTree(input) ? InternalParser.sameExit : Effect.fail(new SchemaIssue.InvalidType(ast, input, options)), {\n expected: \"StringTree\",\n toCodecStringTree: () => undefined\n});\n/** @internal */\nexport const unknownToStringTree = /*#__PURE__*/new Link(StringTree, /*#__PURE__*/SchemaTransformation.passthrough());\n//# sourceMappingURL=SchemaAST.js.map","/**\n * Runs schemas against real values.\n *\n * Schema parsers construct values from schema input, check whether a value\n * matches a schema, decode encoded input, and encode decoded values back to\n * their external form. This module exposes those operations through several\n * result styles, including `Effect`, `Promise`, `Exit`, `Option`, `Result`, and\n * synchronous functions that throw. It also contains the lower-level runner that\n * walks a schema AST and reports schema failures as `SchemaIssue.Issue` values.\n *\n * @since 4.0.0\n */\nimport * as Cause from \"./Cause.js\";\nimport * as Effect from \"./Effect.js\";\nimport * as Exit from \"./Exit.js\";\nimport { memoize } from \"./Function.js\";\nimport { effectIsExit } from \"./internal/effect.js\";\nimport * as InternalSchemaCause from \"./internal/schema/cause.js\";\nimport * as InternalParser from \"./internal/schema/parser.js\";\nimport * as Option from \"./Option.js\";\nimport * as Result from \"./Result.js\";\nimport * as SchemaAST from \"./SchemaAST.js\";\nimport * as SchemaIssue from \"./SchemaIssue.js\";\n/**\n * Creates an effectful maker for the schema's decoded type side.\n *\n * **When to use**\n *\n * Use to construct decoded schema values in `Effect` while preserving\n * construction failures as `SchemaIssue.Issue` values in the error channel.\n *\n * **Details**\n *\n * The returned function accepts constructor input, applies constructor defaults,\n * runs type-side validation unless checks are disabled, and fails with a\n * `SchemaIssue.Issue` when construction fails.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function makeEffect(schema) {\n const ast = schema.ast;\n let parser;\n return (input, options) => {\n return (parser ??= runWithCompiler(constructorCompiler, SchemaAST.toType(ast)))(input, options?.disableChecks ? options?.parseOptions ? {\n ...options.parseOptions,\n disableChecks: true\n } : {\n disableChecks: true\n } : options?.parseOptions);\n };\n}\n/**\n * Creates a synchronous maker that returns `Option.some` with the constructed\n * value on success, or `Option.none` when construction fails with schema issues.\n *\n * **When to use**\n *\n * Use when you need to validate schema constructor input and only care whether\n * construction succeeds, without exposing `SchemaIssue.Issue` details.\n *\n * **Gotchas**\n *\n * Only causes made entirely of schema issues are converted to `Option.none`.\n * Causes that contain defects, interruptions, or asynchronous work at this\n * synchronous boundary throw an `Error` whose cause is the underlying `Cause`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function makeOption(schema) {\n const parser = makeEffect(schema);\n return (input, options) => {\n const exit = Effect.runSyncExit(parser(input, options));\n if (Exit.isSuccess(exit)) {\n return Option.some(exit.value);\n }\n InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, \"Option adapter can only return none for schema issues\");\n return Option.none();\n };\n}\n/**\n * Creates a synchronous maker for the schema's decoded type side.\n *\n * **When to use**\n *\n * Use to construct decoded schema values synchronously when invalid input\n * should throw an `Error` whose cause is `SchemaIssue.Issue`.\n *\n * **Details**\n *\n * The returned function constructs a value from constructor input and throws an\n * `Error` with the `SchemaIssue.Issue` in its `cause` when construction fails.\n * Schema validation failures use the generic message `\"Schema validation failed\"`.\n * Format the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when\n * human-readable details are needed.\n *\n * **Gotchas**\n *\n * Causes that contain defects, interruptions, or asynchronous work at this\n * synchronous boundary throw an `Error` whose cause is the underlying `Cause`,\n * instead of being converted to a schema validation error.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function make(schema) {\n const parser = makeEffect(schema);\n return (input, options) => {\n const exit = Effect.runSyncExit(parser(input, options));\n if (Exit.isSuccess(exit)) {\n return exit.value;\n }\n const issue = InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, \"Constructor adapter can only throw schema issues\");\n throw new Error(\"Schema validation failed\", {\n cause: issue\n });\n };\n}\n/**\n * Creates a type guard that checks whether an input satisfies the schema's decoded\n * type side.\n *\n * **When to use**\n *\n * Use to build a type guard for checking the decoded side of a schema without\n * exposing issue details.\n *\n * **Details**\n *\n * The guard returns `true` on successful validation and `false` when validation\n * fails only with schema issues, without exposing issue details.\n *\n * **Gotchas**\n *\n * Only causes made entirely of schema issues are converted to `false`. Causes\n * that contain defects, interruptions, or asynchronous work at this synchronous\n * boundary throw an `Error` whose cause is the underlying `Cause`.\n *\n * @category guards\n * @since 3.10.0\n */\nexport function is(schema) {\n return _is(schema.ast);\n}\n/** @internal */\nexport function _is(ast) {\n const parser = asExit(run(SchemaAST.toType(ast)));\n return input => {\n const exit = parser(input, SchemaAST.defaultParseOptions);\n if (Exit.isSuccess(exit)) {\n return true;\n }\n InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, \"Type guard adapter can only return false for schema issues\");\n return false;\n };\n}\n/** @internal */\nexport function _issue(ast) {\n const parser = run(ast);\n return (input, options) => {\n const exit = Effect.runSyncExit(parser(input, options));\n if (Exit.isSuccess(exit)) {\n return undefined;\n }\n return InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, \"Issue adapter can only return schema issues\");\n };\n}\n/**\n * Asserts that an input satisfies the schema's decoded type side.\n *\n * **When to use**\n *\n * Use to assert that an input satisfies the decoded side of a schema when schema\n * validation failures should throw an `Error` whose cause is `SchemaIssue.Issue`.\n *\n * **Details**\n *\n * The assertion returns normally when validation succeeds. When the input does\n * not satisfy the schema with a schema-only failure, it throws an `Error` with\n * the `SchemaIssue.Issue` in its `cause`.\n * Schema validation failures use the generic message `\"Schema validation failed\"`.\n * Format the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when\n * human-readable details are needed.\n *\n * **Gotchas**\n *\n * Causes that contain defects, interruptions, or asynchronous work at this\n * synchronous boundary throw an `Error` whose cause is the underlying `Cause`,\n * instead of being converted to a schema validation error.\n *\n * @category guards\n * @since 4.0.0\n */\nexport function asserts(schema, input) {\n const parser = asExit(run(SchemaAST.toType(schema.ast)));\n const exit = parser(input, SchemaAST.defaultParseOptions);\n if (Exit.isFailure(exit)) {\n const issue = InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, \"Assertion adapter can only throw schema issues\");\n throw new Error(\"Schema validation failed\", {\n cause: issue\n });\n }\n}\n/**\n * Creates an effectful decoder for `unknown` input.\n *\n * **When to use**\n *\n * Use when you need to decode untyped boundary input in an `Effect` whose\n * failure channel is `SchemaIssue.Issue`, while preserving transformations\n * and service requirements.\n *\n * **Details**\n *\n * The returned function succeeds with the schema's decoded `Type` or fails with a\n * `SchemaIssue.Issue`. Decoding service requirements are preserved in the returned\n * `Effect`. Parse options may be provided when creating the decoder and overridden\n * when applying it.\n *\n * @see {@link decodeEffect} for input already typed as the schema's `Encoded` type\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeUnknownEffect(schema, options) {\n const parser = run(schema.ast);\n return options === undefined ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));\n}\n/**\n * Creates an effectful decoder for input already typed as the schema's `Encoded`\n * type.\n *\n * **When to use**\n *\n * Use when you already have input typed as the schema's `Encoded` type and\n * need an `Effect` whose failure channel is `SchemaIssue.Issue`, while\n * preserving decoding service requirements.\n *\n * **Details**\n *\n * The returned function succeeds with the decoded `Type` or fails with a\n * `SchemaIssue.Issue`, preserving any decoding service requirements in the\n * returned `Effect`.\n *\n * @see {@link decodeUnknownEffect} for untyped boundary input\n * @see {@link encodeEffect} for the opposite direction\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const decodeEffect = decodeUnknownEffect;\n/**\n * Creates a Promise-based decoder for `unknown` input.\n *\n * **When to use**\n *\n * Use when you need to decode untyped input with a service-free schema and\n * return a JavaScript `Promise`.\n *\n * **Details**\n *\n * The returned function resolves with the decoded `Type` on success and rejects\n * with an `Error` whose cause is a `SchemaIssue.Issue` on decoding failure.\n * Schema validation failures use the generic message `\"Schema validation failed\"`.\n * Format the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when\n * human-readable details are needed.\n *\n * **Gotchas**\n *\n * Causes that contain defects, interruptions, or other non-schema reasons reject\n * with an `Error` whose cause is the underlying `Cause`.\n *\n * @see {@link decodePromise} for input already typed as the schema's `Encoded` type\n * @see {@link decodeUnknownEffect} for schemas that require decoding services or when failures should remain in `Effect`\n *\n * @category decoding\n * @since 3.10.0\n */\nexport function decodeUnknownPromise(schema, options) {\n return asPromise(decodeUnknownEffect(schema, options));\n}\n/**\n * Creates a Promise-based decoder for input already typed as the schema's\n * `Encoded` type.\n *\n * **When to use**\n *\n * Use when you already have input typed as the schema's `Encoded` type and need\n * decoding to return a JavaScript `Promise`.\n *\n * **Details**\n *\n * The returned function resolves with the decoded `Type` on success and rejects\n * with an `Error` whose cause is a `SchemaIssue.Issue` on decoding failure.\n * Schema validation failures use the generic message `\"Schema validation failed\"`.\n * Format the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when\n * human-readable details are needed.\n *\n * **Gotchas**\n *\n * Causes that contain defects, interruptions, or other non-schema reasons reject\n * with an `Error` whose cause is the underlying `Cause`.\n *\n * @see {@link decodeUnknownPromise} for untyped input returning a JavaScript `Promise`\n * @see {@link decodeEffect} for preserving decoding services and failures in `Effect`\n *\n * @category decoding\n * @since 3.10.0\n */\nexport function decodePromise(schema, options) {\n return asPromise(decodeEffect(schema, options));\n}\n/**\n * Creates a synchronous decoder for `unknown` input that reports failure safely\n * as an `Exit`.\n *\n * **When to use**\n *\n * Use when you need to decode unknown input synchronously into an `Exit` whose\n * failure contains `SchemaIssue.Issue`.\n *\n * **Details**\n *\n * The returned function produces `Exit.Success` with the decoded `Type`.\n * Schema issues are represented by an `Exit.Failure` cause containing a\n * `SchemaIssue.Issue`.\n *\n * **Gotchas**\n *\n * Because this adapter runs synchronously, async decoding work can produce an\n * `Exit.Failure` with a defect cause. When the cause contains both schema\n * issues and non-schema reasons, all reasons remain in the returned `Cause`.\n *\n * @see {@link decodeExit} for input already typed as the schema's `Encoded` type\n * @see {@link decodeUnknownEffect} for preserving decoding services and failures in `Effect`\n * @see {@link decodeUnknownResult} for returning schema issues as data\n * @see {@link decodeUnknownSync} for throwing on decoding failure\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeUnknownExit(schema, options) {\n return asExit(decodeUnknownEffect(schema, options));\n}\n/**\n * Creates a synchronous decoder for input already typed as the schema's `Encoded`\n * type, reporting failure safely as an `Exit`.\n *\n * **When to use**\n *\n * Use when you need synchronous decoding of already typed `Encoded` input into\n * an `Exit` whose failure contains `SchemaIssue.Issue`.\n *\n * **Details**\n *\n * The returned function produces `Exit.Success` with the decoded `Type` or\n * `Exit.Failure` with a `SchemaIssue.Issue`.\n *\n * **Gotchas**\n *\n * Because this adapter runs synchronously, async decoding work can produce an\n * `Exit.Failure` with a defect cause. When the cause contains both schema\n * issues and non-schema reasons, all reasons remain in the returned `Cause`.\n *\n * @see {@link decodeUnknownExit} for untyped input with the same `Exit` result shape\n * @see {@link decodeEffect} for preserving decoding services and failures in `Effect`\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const decodeExit = decodeUnknownExit;\n/** @internal */\nexport function decodeUnknownOption(schema, options) {\n return asOption(decodeUnknownEffect(schema, options));\n}\n/** @internal */\nexport const decodeOption = decodeUnknownOption;\n/**\n * Creates a decoder for `unknown` input that reports failure safely as a\n * `Result`.\n *\n * **When to use**\n *\n * Use when decoding untyped boundary input and you want `SchemaIssue.Issue`\n * failures returned as data in a `Result`.\n *\n * **Details**\n *\n * The returned function produces `Result.succeed` with the decoded `Type` on\n * success or `Result.fail` with a `SchemaIssue.Issue` on decoding failure.\n *\n * **Gotchas**\n *\n * This adapter runs synchronously. Causes made entirely of schema issues become\n * `Result.fail`, but causes that contain defects, interruptions, or asynchronous\n * work at this synchronous boundary throw instead.\n *\n * @see {@link decodeResult} for input already typed as the schema's `Encoded` type\n * @see {@link decodeUnknownEffect} for effectful or service-requiring decoding\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeUnknownResult(schema, options) {\n return asResult(decodeUnknownEffect(schema, options));\n}\n/**\n * Creates a decoder for input already typed as the schema's `Encoded` type,\n * reporting failure safely as a `Result`.\n *\n * **When to use**\n *\n * Use when you already have input typed as the schema's `Encoded` type and want\n * schema decoding failures represented as `Result.fail` with `SchemaIssue.Issue`.\n *\n * **Details**\n *\n * The returned function produces `Result.succeed` with the decoded `Type` on\n * success or `Result.fail` with a `SchemaIssue.Issue` on decoding failure.\n *\n * **Gotchas**\n *\n * This synchronous adapter returns `Result.fail` for causes made entirely of\n * schema issues, but causes that contain defects, interruptions, or other\n * non-schema reasons throw instead.\n *\n * @see {@link decodeUnknownResult} for untyped input with the same `Result` shape\n * @see {@link decodeEffect} for effectful or service-requiring decoding\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const decodeResult = decodeUnknownResult;\n/**\n * Creates a synchronous decoder for `unknown` input.\n *\n * **When to use**\n *\n * Use to decode untrusted or dynamically typed input at a synchronous boundary\n * where invalid data should throw an `Error` whose cause is `SchemaIssue.Issue`.\n *\n * **Details**\n *\n * The returned function returns the decoded `Type` on success and throws an\n * `Error` with the `SchemaIssue.Issue` in its `cause` on decoding failure.\n * Schema validation failures use the generic message `\"Schema validation failed\"`.\n * Format the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when\n * human-readable details are needed.\n *\n * **Gotchas**\n *\n * Causes that contain defects, interruptions, or asynchronous work at this\n * synchronous boundary throw an `Error` whose cause is the underlying `Cause`,\n * instead of being converted to a schema validation error.\n *\n * @see {@link decodeSync} for input already typed as the schema's `Encoded` type\n * @see {@link decodeUnknownEffect} for preserving decoding failures in `Effect`\n * @see {@link decodeUnknownResult} for returning schema issues as data\n *\n * @category decoding\n * @since 3.10.0\n */\nexport function decodeUnknownSync(schema, options) {\n return asSync(decodeUnknownEffect(schema, options));\n}\n/**\n * Creates a synchronous decoder for input already typed as the schema's `Encoded`\n * type.\n *\n * **When to use**\n *\n * Use to decode values already typed as the schema's `Encoded` input when\n * decoding failure should throw an `Error` whose cause is `SchemaIssue.Issue`.\n *\n * **Details**\n *\n * The returned function returns the decoded `Type` on success and throws an\n * `Error` with the `SchemaIssue.Issue` in its `cause` on decoding failure.\n * Schema validation failures use the generic message `\"Schema validation failed\"`.\n * Format the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when\n * human-readable details are needed.\n *\n * **Gotchas**\n *\n * Causes that contain defects, interruptions, or asynchronous work at this\n * synchronous boundary throw an `Error` whose cause is the underlying `Cause`,\n * instead of being converted to a schema validation error.\n *\n * @see {@link decodeUnknownSync} for untrusted or dynamically typed input\n * @see {@link decodeResult} for returning schema issues as data\n * @see {@link decodeEffect} for preserving decoding failures in `Effect`\n *\n * @category decoding\n * @since 3.10.0\n */\nexport const decodeSync = decodeUnknownSync;\n/**\n * Creates an effectful encoder for `unknown` input.\n *\n * **When to use**\n *\n * Use when you need to encode untyped boundary input in an `Effect` whose\n * failure channel is `SchemaIssue.Issue`, while preserving service\n * requirements.\n *\n * **Details**\n *\n * The returned function succeeds with the schema's `Encoded` value or fails with a\n * `SchemaIssue.Issue`. Encoding service requirements are preserved in the returned\n * `Effect`. Parse options may be provided when creating the encoder and overridden\n * when applying it.\n *\n * @see {@link encodeEffect} for the typed-input variant when the value is already typed as the schema's decoded `Type`\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeUnknownEffect(schema, options) {\n const parser = run(SchemaAST.flip(schema.ast));\n return options === undefined ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));\n}\n/**\n * Creates an effectful encoder for input already typed as the schema's decoded\n * `Type`.\n *\n * **When to use**\n *\n * Use when you need to encode values already typed as the schema's decoded\n * `Type` in an `Effect` whose failure channel is `SchemaIssue.Issue`, while\n * preserving service requirements.\n *\n * **Details**\n *\n * The returned function succeeds with the schema's `Encoded` value or fails with a\n * `SchemaIssue.Issue`, preserving any encoding service requirements in the\n * returned `Effect`.\n *\n * @see {@link encodeUnknownEffect} for encoding unknown input before the value is statically typed as the schema's `Type`\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const encodeEffect = encodeUnknownEffect;\n/**\n * Creates a Promise-based encoder for `unknown` input.\n *\n * **When to use**\n *\n * Use when you need to encode untrusted or dynamically typed values with a\n * service-free schema and return a JavaScript `Promise`.\n *\n * **Details**\n *\n * The returned function resolves with the schema's `Encoded` value on success and\n * rejects with an `Error` whose cause is a `SchemaIssue.Issue` on encoding failure.\n * Schema validation failures use the generic message `\"Schema validation failed\"`.\n * Format the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when\n * human-readable details are needed.\n *\n * **Gotchas**\n *\n * Causes that contain defects, interruptions, or other non-schema reasons reject\n * with an `Error` whose cause is the underlying `Cause`.\n *\n * @see {@link encodePromise} for input already typed as the schema's decoded `Type`\n * @see {@link encodeUnknownEffect} for schemas that require encoding services or when failures should remain in `Effect`\n *\n * @category encoding\n * @since 3.10.0\n */\nexport const encodeUnknownPromise = (schema, options) => asPromise(encodeUnknownEffect(schema, options));\n/**\n * Creates a Promise-based encoder for input already typed as the schema's decoded\n * `Type`.\n *\n * **When to use**\n *\n * Use when you already have values typed as the schema's decoded `Type` and\n * need encoding to return a JavaScript `Promise`.\n *\n * **Details**\n *\n * The returned function resolves with the schema's `Encoded` value on success and\n * rejects with an `Error` whose cause is a `SchemaIssue.Issue` on encoding failure.\n * Schema validation failures use the generic message `\"Schema validation failed\"`.\n * Format the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when\n * human-readable details are needed.\n *\n * **Gotchas**\n *\n * Causes that contain defects, interruptions, or other non-schema reasons reject\n * with an `Error` whose cause is the underlying `Cause`.\n *\n * @see {@link encodeUnknownPromise} for encoding untyped input\n * @see {@link encodeEffect} for effectful encoding or schemas with encoding service requirements\n *\n * @category encoding\n * @since 3.10.0\n */\nexport const encodePromise = encodeUnknownPromise;\n/**\n * Creates a synchronous encoder for `unknown` input that reports failure safely\n * as an `Exit`.\n *\n * **When to use**\n *\n * Use when you need synchronous encoding of unknown input into an `Exit` whose\n * failure contains `SchemaIssue.Issue`.\n *\n * **Details**\n *\n * The returned function produces `Exit.Success` with the schema's `Encoded` value\n * or `Exit.Failure` with a `SchemaIssue.Issue`.\n *\n * **Gotchas**\n *\n * Because this adapter runs synchronously, async encoding work can produce an\n * `Exit.Failure` with a defect cause. When the cause contains both schema\n * issues and non-schema reasons, all reasons remain in the returned `Cause`.\n *\n * @see {@link encodeExit} for input already typed as the schema's decoded `Type`\n * @see {@link encodeUnknownEffect} for effectful encoding that preserves service requirements\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeUnknownExit(schema, options) {\n return asExit(encodeUnknownEffect(schema, options));\n}\n/**\n * Creates a synchronous encoder for input already typed as the schema's decoded\n * `Type`, reporting failure safely as an `Exit`.\n *\n * **When to use**\n *\n * Use when you need synchronous encoding of already typed schema values into\n * an `Exit` whose failure contains `SchemaIssue.Issue`.\n *\n * **Details**\n *\n * The returned function produces `Exit.Success` with the schema's `Encoded` value\n * or `Exit.Failure` with a `SchemaIssue.Issue`.\n *\n * **Gotchas**\n *\n * Because this adapter runs synchronously, async encoding work can produce an\n * `Exit.Failure` with a defect cause. When the cause contains both schema\n * issues and non-schema reasons, all reasons remain in the returned `Cause`.\n *\n * @see {@link encodeUnknownExit} for unknown input with the same `Exit` result shape\n * @see {@link encodeEffect} for effectful encoding that preserves service requirements\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const encodeExit = encodeUnknownExit;\n/** @internal */\nexport function encodeUnknownOption(schema, options) {\n return asOption(encodeUnknownEffect(schema, options));\n}\n/** @internal */\nexport const encodeOption = encodeUnknownOption;\n/**\n * Creates an encoder for `unknown` input that reports failure safely as a\n * `Result`.\n *\n * **When to use**\n *\n * Use when encoding values from an unknown or dynamically typed boundary\n * synchronously, and you want `SchemaIssue.Issue` failures returned as `Result`\n * data.\n *\n * **Details**\n *\n * The returned function produces `Result.succeed` with the schema's `Encoded`\n * value on success or `Result.fail` with a `SchemaIssue.Issue` on encoding\n * failure.\n *\n * **Gotchas**\n *\n * This adapter runs synchronously. Causes made entirely of schema issues become\n * `Result.fail`, but causes that contain defects, interruptions, or asynchronous\n * work at this synchronous boundary throw instead.\n *\n * @see {@link encodeResult} for input already typed as the schema's decoded `Type`\n * @see {@link encodeUnknownEffect} for effectful encoding, including schemas with encoding service requirements\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeUnknownResult(schema, options) {\n return asResult(encodeUnknownEffect(schema, options));\n}\n/**\n * Creates an encoder for input already typed as the schema's decoded `Type`,\n * reporting failure safely as a `Result`.\n *\n * **When to use**\n *\n * Use when you already have input typed as the schema's decoded `Type` and want\n * encoding failures returned as `Result.fail` with `SchemaIssue.Issue`.\n *\n * **Details**\n *\n * The returned function produces `Result.succeed` with the schema's `Encoded`\n * value on success or `Result.fail` with a `SchemaIssue.Issue` on encoding\n * failure.\n *\n * **Gotchas**\n *\n * This synchronous adapter returns `Result.fail` for causes made entirely of\n * schema issues, but causes that contain defects, interruptions, or other\n * non-schema reasons throw instead.\n *\n * @see {@link encodeUnknownResult} for the same `Result` shape when the input is not already typed\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const encodeResult = encodeUnknownResult;\n/**\n * Creates a synchronous encoder for `unknown` input.\n *\n * **When to use**\n *\n * Use when you need to encode values from untyped input in synchronous code and\n * want encoding failures to throw an `Error` whose cause is `SchemaIssue.Issue`.\n *\n * **Details**\n *\n * The returned function returns the schema's `Encoded` value on success and throws\n * an `Error` with the `SchemaIssue.Issue` in its `cause` on encoding failure.\n * Schema validation failures use the generic message `\"Schema validation failed\"`.\n * Format the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when\n * human-readable details are needed.\n *\n * **Gotchas**\n *\n * Causes that contain defects, interruptions, or asynchronous work at this\n * synchronous boundary throw an `Error` whose cause is the underlying `Cause`,\n * instead of being converted to a schema validation error.\n *\n * @see {@link encodeSync} for input already typed as the schema's decoded `Type`\n * @see {@link encodeUnknownEffect} for effectful encoding that preserves service requirements\n *\n * @category encoding\n * @since 3.10.0\n */\nexport function encodeUnknownSync(schema, options) {\n return asSync(encodeUnknownEffect(schema, options));\n}\n/**\n * Creates a synchronous encoder for input already typed as the schema's decoded\n * `Type`.\n *\n * **When to use**\n *\n * Use to encode already typed schema values synchronously when encoding failure\n * should throw an `Error` whose cause is `SchemaIssue.Issue`.\n *\n * **Details**\n *\n * The returned function returns the schema's `Encoded` value on success and throws\n * an `Error` with the `SchemaIssue.Issue` in its `cause` on encoding failure.\n * Schema validation failures use the generic message `\"Schema validation failed\"`.\n * Format the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when\n * human-readable details are needed.\n *\n * **Gotchas**\n *\n * Causes that contain defects, interruptions, or asynchronous work at this\n * synchronous boundary throw an `Error` whose cause is the underlying `Cause`,\n * instead of being converted to a schema validation error.\n *\n * @see {@link encodeUnknownSync} for unknown input with the same throwing boundary\n * @see {@link encodeResult} for returning schema issues as data\n * @see {@link encodeEffect} for effectful encoding that preserves service requirements\n *\n * @category encoding\n * @since 3.10.0\n */\nexport const encodeSync = encodeUnknownSync;\nconst mergeParseOptions = (options, overrideOptions) => overrideOptions ? {\n ...options,\n ...overrideOptions\n} : options;\nconst getValue = value => {\n if (value === InternalParser.missing) {\n return Effect.fail(new SchemaIssue.InvalidValue());\n }\n return Effect.succeed(value);\n};\n/** @internal */\nexport function run(ast) {\n return runWithCompiler(normalCompiler, ast);\n}\nfunction runWithCompiler(compiler, ast) {\n let parser;\n return (input, options) => {\n const result = (parser ??= compiler(ast))(input, options ?? SchemaAST.defaultParseOptions);\n if (result === InternalParser.sameExit) {\n return Effect.succeed(input);\n }\n if (!effectIsExit(result)) {\n return Effect.flatMapEager(result, getValue);\n }\n return result[InternalParser.args] === InternalParser.missing ? getValue(InternalParser.missing) : result;\n };\n}\nfunction asPromise(parser) {\n return (input, options) => Effect.runPromiseExit(parser(input, options)).then(exit => {\n if (Exit.isSuccess(exit)) {\n return exit.value;\n }\n const issue = InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, \"Promise adapter can only reject schema issues\");\n throw new Error(\"Schema validation failed\", {\n cause: issue\n });\n });\n}\nfunction asExit(parser) {\n return (input, options) => Effect.runSyncExit(parser(input, options));\n}\n/** @internal */\nexport function asOption(parser) {\n const parserExit = asExit(parser);\n return (input, options) => {\n const exit = parserExit(input, options);\n if (Exit.isSuccess(exit)) {\n return Option.some(exit.value);\n }\n InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, \"Option adapter can only return none for schema issues\");\n return Option.none();\n };\n}\nfunction asResult(parser) {\n const parserExit = asExit(parser);\n return (input, options) => {\n const exit = parserExit(input, options);\n if (Exit.isSuccess(exit)) {\n return Result.succeed(exit.value);\n }\n return Result.fail(InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, \"Result adapter can only return schema issues\"));\n };\n}\nfunction asSync(parser) {\n const parserExit = asExit(parser);\n return (input, options) => {\n const exit = parserExit(input, options);\n if (Exit.isSuccess(exit)) {\n return exit.value;\n }\n const issue = InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, \"Sync adapter can only throw schema issues\");\n throw new Error(\"Schema validation failed\", {\n cause: issue\n });\n };\n}\nconst normalCompiler = /*#__PURE__*/memoize(ast => makeParser(ast, normalCompiler));\nconst constructorCompiler = /*#__PURE__*/memoize(ast => makeParser(ast, constructorCompiler, compileConstructorDefault));\nconst compileDefaulted = /*#__PURE__*/memoize(ast => makeParser(ast, constructorCompiler, compileConstructorDefault, ast.context?.constructorDefault));\nfunction compileConstructorDefault(ast) {\n return ast.context?.constructorDefault ? compileDefaulted(ast) : constructorCompiler(ast);\n}\nfunction applyTransformation(result, current, transformation, options) {\n let transformed;\n if (effectIsExit(result) && result._tag === \"Success\") {\n const optional = InternalParser.toOption(result === InternalParser.sameExit ? current : result[InternalParser.args]);\n transformed = transformation._tag === \"Transformation\" ? transformation.decode.run(optional, options) : transformation.decode(InternalParser.succeed(optional), options);\n } else if (transformation._tag === \"Transformation\") {\n transformed = Effect.flatMapEager(result, value => transformation.decode.run(InternalParser.toOption(value), options));\n } else {\n transformed = transformation.decode(Effect.mapEager(result, InternalParser.toOption), options);\n }\n return effectIsExit(transformed) && transformed._tag === \"Success\" ? InternalParser.fromOptionExit(transformed[InternalParser.args]) : Effect.flatMapEager(transformed, InternalParser.fromOptionExit);\n}\nfunction makeConstructorParser(descriptor, compile) {\n let sourceParser;\n return (input, options) => {\n if (input === InternalParser.missing) return InternalParser.missingExit;\n if (descriptor.isConstructed(input)) return InternalParser.sameExit;\n const result = (sourceParser ??= compile(descriptor.link.to))(input, options);\n return applyTransformation(result, input, descriptor.link.transformation, options);\n };\n}\nfunction makeParser(ast, compile, compileConstructorDefault, constructorDefault) {\n const descriptor = compileConstructorDefault ? SchemaAST.getConstructorDescriptor(ast) : undefined;\n const parser = descriptor ? makeConstructorParser(descriptor, compile) : ast.getParser(compile, compileConstructorDefault);\n const checks = ast.checks;\n const links = constructorDefault ? ast.encoding ? [...ast.encoding, constructorDefault] : [constructorDefault] : ast.encoding;\n const encodingChecks = ast.encodingChecks;\n if (!links && !checks && !encodingChecks) {\n return parser;\n }\n let encodingParsers;\n const parseLocal = (input, options) => {\n let result = parser(input, options);\n if (encodingChecks && !options.disableChecks) {\n if (effectIsExit(result)) {\n if (result._tag === \"Success\") {\n const output = result === InternalParser.sameExit ? input : result[InternalParser.args];\n if (input !== InternalParser.missing && output !== InternalParser.missing) {\n const issues = SchemaAST.collectIssues(encodingChecks, input, undefined, ast, options);\n if (issues) {\n result = Effect.fail(new SchemaIssue.Composite(ast, issues, input, options));\n }\n }\n }\n } else {\n result = Effect.flatMap(result, value => {\n if (input !== InternalParser.missing && value !== InternalParser.missing) {\n const issues = SchemaAST.collectIssues(encodingChecks, input, undefined, ast, options);\n if (issues) {\n return Effect.fail(new SchemaIssue.Composite(ast, issues, input, options));\n }\n }\n return Effect.succeed(value);\n });\n }\n }\n if (checks && !options.disableChecks) {\n if (effectIsExit(result)) {\n if (result._tag === \"Success\") {\n const value = result === InternalParser.sameExit ? input : result[InternalParser.args];\n if (value === InternalParser.missing) return result;\n const issues = SchemaAST.collectIssues(checks, value, undefined, ast, options);\n if (issues) {\n result = Effect.fail(new SchemaIssue.Composite(ast, issues, value, options));\n }\n }\n } else {\n result = Effect.flatMap(result, value => {\n if (value !== InternalParser.missing) {\n const issues = SchemaAST.collectIssues(checks, value, undefined, ast, options);\n if (issues) {\n return Effect.fail(new SchemaIssue.Composite(ast, issues, value, options));\n }\n }\n return Effect.succeed(value);\n });\n }\n }\n return result;\n };\n if (!links) {\n return parseLocal;\n }\n return (input, options) => {\n const parsers = encodingParsers ??= links.map(link => compile(link.to));\n let current = input;\n let result = parsers[parsers.length - 1](input, options);\n for (let i = links.length - 1; i >= 0; i--) {\n result = applyTransformation(result, current, links[i].transformation, options);\n if (i !== 0) {\n const next = parsers[i - 1];\n if (result._tag === \"Success\") {\n current = result[InternalParser.args];\n result = next(current, options);\n } else {\n result = Effect.flatMapEager(result, value => {\n const nextResult = next(value, options);\n return nextResult === InternalParser.sameExit ? InternalParser.succeed(value) : nextResult;\n });\n }\n }\n }\n if (result._tag === \"Success\") {\n const value = result[InternalParser.args];\n const local = parseLocal(value, options);\n return local === InternalParser.sameExit ? result : local;\n }\n result = Effect.catchCause(result, cause => Effect.failCauseSync(() => Cause.map(cause, issue => new SchemaIssue.Encoding(ast, issue, input, options))));\n return Effect.flatMapEager(result, value => {\n const local = parseLocal(value, options);\n return local === InternalParser.sameExit ? InternalParser.succeed(value) : local;\n });\n };\n}\n//# sourceMappingURL=SchemaParser.js.map","import * as Pipeable from \"../../Pipeable.js\";\nimport * as SchemaAST from \"../../SchemaAST.js\";\nimport * as SchemaParser from \"../../SchemaParser.js\";\n/** @internal */\nexport const TypeId = \"~effect/Schema/Schema\";\nconst SchemaProto = {\n [TypeId]: TypeId,\n pipe() {\n return Pipeable.pipeArguments(this, arguments);\n },\n annotate(annotations) {\n return this.rebuild(SchemaAST.annotate(this.ast, annotations));\n },\n annotateKey(annotations) {\n return this.rebuild(SchemaAST.annotateKey(this.ast, annotations));\n },\n check(...checks) {\n return this.rebuild(SchemaAST.appendChecks(this.ast, checks));\n }\n};\n/** @internal */\nexport function make(ast, options) {\n function Schema() {}\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.ast = ast;\n self.rebuild = ast => make(ast, options);\n self.makeEffect = SchemaParser.makeEffect(self);\n self.make = SchemaParser.make(self);\n self.makeOption = SchemaParser.makeOption(self);\n return self;\n}\n//# sourceMappingURL=make.js.map","/**\n * Helpers for escaping JSON Pointer path segments and converting JSON Pointer\n * URI fragments. JSON Pointer uses `/` to separate path tokens inside a JSON\n * document, so token text must encode literal `~` and `/` characters. URI\n * fragments additionally apply percent-encoding after JSON Pointer escaping.\n *\n * @since 4.0.0\n */\n/**\n * Escapes a JSON Pointer reference token according to RFC 6901 by encoding special characters so the token can be safely used as a segment in a JSON Pointer.\n *\n * **When to use**\n *\n * Use when you need to escape a single JSON Pointer path segment.\n *\n * **Details**\n *\n * - Returns a new escaped string\n * - Replaces `~` (tilde) with `~0` and `/` (forward slash) with `~1`\n * - Returns the input unchanged if it contains no special characters\n * - Empty strings are valid and returned unchanged\n *\n * **Gotchas**\n *\n * The replacement order matters: `~` is replaced before `/` to prevent double-escaping.\n *\n * **Example** (Escaping special characters)\n *\n * ```ts import.meta.vitest\n * import { JsonPointer } from \"effect\"\n *\n * JsonPointer.escapeToken(\"a/b\") // => \"a~1b\"\n * JsonPointer.escapeToken(\"c~d\") // => \"c~0d\"\n * JsonPointer.escapeToken(\"path/to~key\") // => \"path~1to~0key\"\n * ```\n *\n * @see {@link unescapeToken} The inverse operation for decoding escaped tokens\n * @category encoding\n * @since 4.0.0\n */\nexport function escapeToken(token) {\n return token.replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\n}\n/**\n * Decodes a JSON Pointer reference token according to RFC 6901 escaping rules.\n *\n * **When to use**\n *\n * Use when you need to decode a single escaped JSON Pointer path segment.\n *\n * **Details**\n *\n * - Returns a new unescaped string\n * - Replaces `~1` with `/` (forward slash) and `~0` with `~` (tilde)\n * - Returns the input unchanged if it contains no escaped sequences\n * - Empty strings are valid and returned unchanged\n *\n * **Gotchas**\n *\n * The replacement order matters: `~1` is replaced before `~0` to prevent incorrect decoding.\n *\n * **Example** (Unescaping special characters)\n *\n * ```ts import.meta.vitest\n * import { JsonPointer } from \"effect\"\n *\n * JsonPointer.unescapeToken(\"a~1b\") // => \"a/b\"\n * JsonPointer.unescapeToken(\"c~0d\") // => \"c~d\"\n * JsonPointer.unescapeToken(\"path~1to~0key\") // => \"path/to~key\"\n * ```\n *\n * @see {@link escapeToken} The inverse operation for encoding tokens\n * @category decoding\n * @since 4.0.0\n */\nexport function unescapeToken(token) {\n return token.replace(/~1/g, \"/\").replace(/~0/g, \"~\");\n}\n/** @internal */\nexport function formatUriFragmentToken(token) {\n return encodeURI(escapeToken(token)).replace(/#/g, \"%23\");\n}\n/** @internal */\nexport function decodeUriFragment(fragment) {\n if (fragment.length === 0 || fragment === \"#\") return \"\";\n if (!fragment.startsWith(\"#\")) return undefined;\n const encoded = fragment.slice(1);\n try {\n if (encodeURI(encoded).replace(/%25/g, \"%\").replace(/#/g, \"%23\") !== encoded) return undefined;\n const pointer = decodeURIComponent(encoded);\n return pointer.startsWith(\"/\") && !/~(?:[^01]|$)/.test(pointer) ? pointer : undefined;\n } catch {\n return undefined;\n }\n}\n/**\n * Parses a JSON Pointer URI fragment into decoded path tokens.\n *\n * **When to use**\n *\n * Use when you need to resolve a URI fragment against a JSON document.\n *\n * **Details**\n *\n * Percent-encoding is decoded before the pointer is split into tokens, then\n * each token is decoded with {@link unescapeToken}. The empty string and `#`\n * both represent the document root.\n *\n * **Gotchas**\n *\n * Returns `undefined` when the input is not a URI fragment, contains characters\n * that require percent-encoding, or contains an invalid JSON Pointer escape\n * sequence.\n *\n * **Example** (Parsing URI fragments)\n *\n * ```ts import.meta.vitest\n * import { JsonPointer } from \"effect\"\n *\n * JsonPointer.parseUriFragment(\"#/users/a~1b\") // => [\"users\", \"a/b\"]\n * JsonPointer.parseUriFragment(\"#/caf%C3%A9\") // => [\"café\"]\n * JsonPointer.parseUriFragment(\"#/%\") // => undefined\n * JsonPointer.parseUriFragment(\"#/a#b\") // => undefined\n * ```\n *\n * @see {@link formatUriFragment} for the inverse operation\n * @category decoding\n * @since 4.0.0\n */\nexport function parseUriFragment(fragment) {\n const pointer = decodeUriFragment(fragment);\n return pointer === undefined ? undefined : pointer.length === 0 ? [] : pointer.slice(1).split(\"/\").map(unescapeToken);\n}\n/**\n * Formats path tokens as a JSON Pointer URI fragment.\n *\n * **When to use**\n *\n * Use when you need a URI fragment that identifies a value in a JSON document.\n *\n * **Details**\n *\n * Each token is encoded with {@link escapeToken} before URI percent-encoding\n * is applied. An empty path is formatted as `#`.\n *\n * **Gotchas**\n *\n * Throws a `URIError` when a token contains an unpaired surrogate.\n *\n * **Example** (Formatting a URI fragment)\n *\n * ```ts import.meta.vitest\n * import { JsonPointer } from \"effect\"\n *\n * JsonPointer.formatUriFragment([\"users\", \"a/b\", \"Rate%\"]) // => \"#/users/a~1b/Rate%25\"\n * ```\n *\n * @see {@link parseUriFragment} for the inverse operation\n * @category encoding\n * @since 4.0.0\n */\nexport function formatUriFragment(path) {\n return path.reduce((fragment, token) => `${fragment}/${formatUriFragmentToken(token)}`, \"#\");\n}\n//# sourceMappingURL=JsonPointer.js.map","/**\n * Helpers for normalizing and converting JSON Schema and OpenAPI schema\n * documents. Supported inputs include JSON Schema Draft-07, Draft 2020-12,\n * OpenAPI 3.0, and OpenAPI 3.1; conversions normalize through\n * `Document<\"draft-2020-12\">` before emitting another dialect, including\n * JSON Schema Draft-04. The module also defines document types, meta-schema\n * constants, and OpenAPI component-key helpers.\n *\n * @since 4.0.0\n */\nimport * as InternalRecord from \"./internal/record.js\";\nimport { formatUriFragment, parseUriFragment } from \"./JsonPointer.js\";\nimport * as Predicate from \"./Predicate.js\";\n/**\n * Represents the `$schema` meta-schema URI for JSON Schema Draft-04.\n *\n * **When to use**\n *\n * Use when constructing a Draft-04 JSON Schema document and you need a stable\n * value for the root `$schema` field.\n *\n * @see {@link META_SCHEMA_URI_DRAFT_07} for the Draft-07 `$schema` URI\n * @category constants\n * @since 4.0.0\n */\nexport const META_SCHEMA_URI_DRAFT_04 = \"http://json-schema.org/draft-04/schema#\";\n/**\n * Represents the `$schema` meta-schema URI for JSON Schema Draft-07.\n *\n * **When to use**\n *\n * Use when constructing a Draft-07 JSON Schema document and you need a stable\n * value for the root `$schema` field.\n *\n * **Details**\n *\n * The exported value is the literal string\n * `http://json-schema.org/draft-07/schema#`.\n *\n * @see {@link META_SCHEMA_URI_DRAFT_04} for the Draft-04 `$schema` URI\n * @see {@link META_SCHEMA_URI_DRAFT_2020_12} for the Draft 2020-12 `$schema` URI\n *\n * @category constants\n * @since 4.0.0\n */\nexport const META_SCHEMA_URI_DRAFT_07 = \"http://json-schema.org/draft-07/schema#\";\n/**\n * Represents the `$schema` meta-schema URI for JSON Schema Draft 2020-12.\n *\n * **When to use**\n *\n * Use when you need to populate the `$schema` field while emitting a JSON\n * Schema document that should declare JSON Schema Draft 2020-12.\n *\n * **Details**\n *\n * The exported value is the literal string\n * `https://json-schema.org/draft/2020-12/schema`.\n *\n * @see {@link META_SCHEMA_URI_DRAFT_07} for the Draft-07 `$schema` URI\n *\n * @category constants\n * @since 4.0.0\n */\nexport const META_SCHEMA_URI_DRAFT_2020_12 = \"https://json-schema.org/draft/2020-12/schema\";\nconst META_SCHEMA_URI_OPEN_API_3_1 = \"https://spec.openapis.org/oas/3.1/dialect/base\";\nfunction isMetaSchemaUri(value, uri) {\n return value === uri || value === (uri.endsWith(\"#\") ? uri.slice(0, -1) : `${uri}#`);\n}\nfunction rewriteOpenApiComponentsReference(reference) {\n const path = reference.startsWith(\"#\") ? parseUriFragment(reference) : undefined;\n return path !== undefined && path[0] === \"components\" && path[1] === \"schemas\" ? formatUriFragment([\"$defs\", ...path.slice(2)]) : reference;\n}\nconst OPEN_API_31_TARGET_COLLISIONS = [\"example\", \"discriminator\", \"xml\", \"externalDocs\"];\n/**\n * Parses a raw Draft-07 JSON Schema into a `Document<\"draft-2020-12\">`.\n *\n * **When to use**\n *\n * Use when you have a raw JSON Schema object that follows Draft-07 conventions\n * and need the canonical Draft-2020-12 document representation.\n *\n * **Details**\n *\n * This converts Draft-07 tuple syntax (`items` as array plus\n * `additionalItems`) to Draft-2020-12 form (`prefixItems` plus `items`), splits\n * `dependencies` into `dependentRequired` and `dependentSchemas`, converts\n * plain-name `$id` fragments to `$anchor`, and extracts root-level\n * `definitions` into the `definitions` field. Local JSON Pointer refs are\n * relocated when one of these structural conversions moves its target.\n *\n * **Gotchas**\n *\n * Unknown and custom keywords are copied as opaque values. Their contents are\n * not treated as nested schemas. Draft-07 keywords such as `if` / `then` /\n * `else` and `contains` are preserved and their subschemas are converted.\n * Siblings of a valid Draft-07 `$ref` are ignored according to Draft-07\n * semantics. The conversion throws when a Draft-07 `$id` fragment cannot be\n * represented as a Draft-2020-12 `$anchor`, or when an unknown Draft-07\n * keyword would become an active Draft-2020-12 keyword after copying.\n *\n * **Example** (Parsing a Draft-07 schema)\n *\n * ```ts import.meta.vitest\n * import { JsonSchema } from \"effect\"\n *\n * const raw: JsonSchema.JsonSchema = {\n * type: \"object\",\n * properties: {\n * tags: {\n * type: \"array\",\n * items: { type: \"string\" }\n * }\n * }\n * }\n *\n * const doc = JsonSchema.fromSchemaDraft07(raw)\n * doc.dialect // => \"draft-2020-12\"\n * doc.schema.properties // => { tags: { type: \"array\", items: { type: \"string\" } } }\n * ```\n *\n * @see {@link fromSchemaDraft2020_12}\n * @see {@link fromSchemaOpenApi3_0}\n * @see {@link toDocumentDraft07}\n * @category decoding\n * @since 4.0.0\n */\nexport function fromSchemaDraft07(js) {\n return fromSchemaDraft2020_12(convertDraft07(js));\n}\n/**\n * Parses a raw Draft-2020-12 JSON Schema into a `Document<\"draft-2020-12\">`.\n *\n * **When to use**\n *\n * Use when you already have a raw JSON Schema object in Draft-2020-12 format.\n *\n * **Details**\n *\n * This separates `$defs` from the root schema into the `definitions` field.\n * Unlike {@link fromSchemaDraft07}, this performs no keyword rewriting.\n *\n * **Example** (Parsing a Draft-2020-12 schema)\n *\n * ```ts import.meta.vitest\n * import { JsonSchema } from \"effect\"\n *\n * const raw: JsonSchema.JsonSchema = {\n * type: \"number\",\n * minimum: 0,\n * $defs: { PositiveInt: { type: \"integer\", minimum: 1 } }\n * }\n *\n * const doc = JsonSchema.fromSchemaDraft2020_12(raw)\n * doc.schema // => { type: \"number\", minimum: 0 }\n * doc.definitions // => { PositiveInt: { type: \"integer\", minimum: 1 } }\n * ```\n *\n * @see {@link fromSchemaDraft07}\n * @see {@link fromSchemaOpenApi3_1}\n * @category decoding\n * @since 4.0.0\n */\nexport function fromSchemaDraft2020_12(js) {\n const {\n $defs,\n ...schema\n } = js;\n return {\n dialect: \"draft-2020-12\",\n schema,\n definitions: Predicate.isObject($defs) ? $defs : {}\n };\n}\n/**\n * Parses a raw OpenAPI 3.1 JSON Schema into a `Document<\"draft-2020-12\">`.\n *\n * **When to use**\n *\n * Use when you need to consume raw JSON Schema objects from an OpenAPI 3.1\n * specification.\n *\n * **Details**\n *\n * This rewrites `#/components/schemas/...` refs to `#/$defs/...`, normalizes the\n * OpenAPI base dialect URI to Draft 2020-12, converts the deprecated singular\n * `example` field to `examples`, then delegates to\n * {@link fromSchemaDraft2020_12}.\n *\n * **Gotchas**\n *\n * When both `example` and `examples` are present, the singular example is\n * prepended to the array. Custom `$schema` dialect URIs and unknown keywords\n * are copied opaquely. Component references inside a schema resource identified\n * by `$id` are left unchanged because they are relative to that resource.\n *\n * **Example** (Parsing an OpenAPI 3.1 schema)\n *\n * ```ts import.meta.vitest\n * import { JsonSchema } from \"effect\"\n *\n * const raw: JsonSchema.JsonSchema = {\n * type: \"object\",\n * properties: {\n * user: { $ref: \"#/components/schemas/User\" }\n * }\n * }\n *\n * const doc = JsonSchema.fromSchemaOpenApi3_1(raw)\n * doc.schema.properties // => { user: { $ref: \"#/$defs/User\" } }\n * ```\n *\n * @see {@link fromSchemaOpenApi3_0}\n * @see {@link toMultiDocumentOpenApi3_1}\n * @category decoding\n * @since 4.0.0\n */\nexport function fromSchemaOpenApi3_1(js) {\n const isRootResource = createsResource(js.$id);\n const schema = transformSchema(js, (schema, inEmbeddedResource) => {\n if (!isRootResource && !inEmbeddedResource) rewriteSchemaRef(schema, rewriteOpenApiComponentsReference);\n if (isMetaSchemaUri(schema.$schema, META_SCHEMA_URI_OPEN_API_3_1)) {\n InternalRecord.assignProperty(schema, \"$schema\", META_SCHEMA_URI_DRAFT_2020_12);\n }\n if (Object.hasOwn(schema, \"example\")) {\n const examples = schema.examples;\n if (examples === undefined || Array.isArray(examples)) {\n InternalRecord.assignProperty(schema, \"examples\", [schema.example, ...(examples ?? [])]);\n delete schema.example;\n }\n }\n });\n return fromSchemaDraft2020_12(schema);\n}\n/**\n * Parses a raw OpenAPI 3.0 JSON Schema into a `Document<\"draft-2020-12\">`.\n *\n * **When to use**\n *\n * Use when you need to consume raw JSON Schema objects from an OpenAPI 3.0\n * specification.\n *\n * **Details**\n *\n * This directly converts OpenAPI 3.0 schema objects to Draft-2020-12. It\n * handles `nullable`, singular `example`, boolean `exclusiveMinimum` and\n * `exclusiveMaximum`, and OpenAPI component refs. Only values in OpenAPI\n * schema positions are traversed as schemas.\n *\n * **Gotchas**\n *\n * OpenAPI 3.0 `nullable` is applied only when the same Schema Object has an\n * explicit string `type`; other constraints such as `enum` are left\n * unchanged. Unknown keywords, vendor extensions, and annotation values are\n * copied opaquely unless their name would become active in Draft 2020-12 and\n * change meaning, in which case conversion throws. Siblings of a valid\n * OpenAPI 3.0 `$ref` are ignored.\n *\n * **Example** (Parsing an OpenAPI 3.0 nullable schema)\n *\n * ```ts import.meta.vitest\n * import { JsonSchema } from \"effect\"\n *\n * const raw: JsonSchema.JsonSchema = {\n * type: \"string\",\n * nullable: true\n * }\n *\n * const doc = JsonSchema.fromSchemaOpenApi3_0(raw)\n * doc.schema.type // => [\"string\", \"null\"]\n * ```\n *\n * @see {@link fromSchemaOpenApi3_1}\n * @see {@link fromSchemaDraft07}\n * @category decoding\n * @since 4.0.0\n */\nexport function fromSchemaOpenApi3_0(schema) {\n return fromSchemaDraft2020_12(convertOpenApi30(schema));\n}\n/**\n * Converts a `Document<\"draft-2020-12\">` to a `Document<\"draft-07\">`.\n *\n * **When to use**\n *\n * Use when you need to output a canonical JSON Schema document in Draft-07\n * format.\n *\n * **Details**\n *\n * This rewrites `#/$defs/...` refs to `#/definitions/...`, converts\n * Draft-2020-12 tuple syntax (`prefixItems` plus `items`) to Draft-07 form\n * (`items` as array plus `additionalItems`), merges `dependentRequired` and\n * `dependentSchemas` into `dependencies`, and converts both the root schema\n * and all definitions. Local JSON Pointer refs are relocated when structural\n * keywords move.\n *\n * **Gotchas**\n *\n * Unknown and custom keywords are copied as opaque values. Known keywords\n * that Draft-07 cannot represent cause the conversion to throw\n * instead of being dropped. These include dynamic references,\n * `unevaluatedProperties`, `unevaluatedItems`, and non-default `minContains`\n * or `maxContains` constraints. Conversion also throws when an opaque\n * Draft-2020-12 keyword would collide with an active Draft-07 keyword, or when\n * `$id` and `$anchor` occur together because Draft-07 cannot preserve both identifiers.\n *\n * **Example** (Converting to Draft-07)\n *\n * ```ts import.meta.vitest\n * import { JsonSchema } from \"effect\"\n *\n * const doc = JsonSchema.fromSchemaDraft2020_12({\n * type: \"array\",\n * prefixItems: [{ type: \"string\" }, { type: \"number\" }],\n * items: { type: \"boolean\" }\n * })\n *\n * const draft07 = JsonSchema.toDocumentDraft07(doc)\n * draft07.dialect // => \"draft-07\"\n * draft07.schema.items // => [{ type: \"string\" }, { type: \"number\" }]\n * draft07.schema.additionalItems // => { type: \"boolean\" }\n * ```\n *\n * @see {@link fromSchemaDraft07}\n * @see {@link toDocumentDraft04} for converting to Draft-04\n * @see {@link toMultiDocumentOpenApi3_1}\n * @category encoding\n * @since 4.0.0\n */\nexport function toDocumentDraft07(document) {\n return {\n dialect: \"draft-07\",\n ...convertDocument(document, draft07Adapter)\n };\n}\n/**\n * Converts a `Document<\"draft-2020-12\">` to a `Document<\"draft-04\">`.\n *\n * **When to use**\n *\n * Use when you need to output a canonical JSON Schema document in Draft-04\n * format.\n *\n * **Details**\n *\n * This directly rewrites `#/$defs/...` refs to `#/definitions/...`, converts\n * tuple syntax, merges canonical dependencies, lowers `const` to `enum`,\n * converts numeric exclusive bounds to the Draft-04 boolean form, lowers\n * conditionals and basic `contains` through boolean applicators, and converts\n * both the root schema and all definitions.\n *\n * **Gotchas**\n *\n * Unknown and custom keywords are copied as opaque values. Newer annotation\n * keywords are preserved as Draft-04 extensions. Known keywords\n * without a Draft-04 equivalent, including `propertyNames`, non-default\n * `contains` cardinality, dynamic references, and unevaluated constraints,\n * cause the conversion to throw instead of being dropped. A conditional with\n * both branches also throws when lowering it would duplicate a nested schema\n * identifier. Conversion also throws when an opaque Draft-2020-12 keyword\n * would collide with an active Draft-04 keyword, or when `$id` and `$anchor`\n * occur together because Draft-04 cannot preserve both identifiers.\n *\n * **Example** (Converting exclusive bounds)\n *\n * ```ts import.meta.vitest\n * import { JsonSchema } from \"effect\"\n *\n * const doc = JsonSchema.fromSchemaDraft2020_12({\n * type: \"number\",\n * exclusiveMinimum: 0\n * })\n *\n * JsonSchema.toDocumentDraft04(doc).schema // => { type: \"number\", minimum: 0, exclusiveMinimum: true }\n * ```\n *\n * @see {@link toDocumentDraft07} for converting to Draft-07\n * @category encoding\n * @since 4.0.0\n */\nexport function toDocumentDraft04(document) {\n return {\n dialect: \"draft-04\",\n ...convertDocument(document, draft04Adapter, {\n booleanAdapter: schema => schema ? {} : {\n not: {}\n }\n })\n };\n}\n/**\n * Converts a `MultiDocument<\"draft-2020-12\">` to a\n * `MultiDocument<\"openapi-3.1\">`.\n *\n * **When to use**\n *\n * Use when you need to emit an OpenAPI 3.1 multi-document from canonical JSON\n * Schema documents.\n *\n * **Details**\n *\n * This rewrites local `#/$defs/...` refs to `#/components/schemas/...` and\n * sanitizes definition keys to match the OpenAPI component key pattern\n * (`^[a-zA-Z0-9.\\-_]+$`) by replacing invalid characters with `_`. Valid keys\n * are preserved. When sanitized keys collide, the converter appends the first\n * available `_1`, `_2`, and subsequent suffix, with allocation independent of\n * definition insertion order. All local refs are updated to use the allocated\n * keys, including refs to paths within a definition.\n *\n * **Gotchas**\n *\n * External refs and local refs outside `#/$defs` are left unchanged. Conversion\n * throws when a custom keyword would become an active OpenAPI keyword and\n * therefore change meaning. References inside schema resources identified by\n * `$id` are left unchanged. Conversion throws when an identified root schema\n * references the detached shared definitions pool because OpenAPI cannot\n * preserve that fragment reference.\n *\n * **Example** (Converting to OpenAPI 3.1)\n *\n * ```ts import.meta.vitest\n * import { JsonSchema } from \"effect\"\n *\n * const multi: JsonSchema.MultiDocument<\"draft-2020-12\"> = {\n * dialect: \"draft-2020-12\",\n * schemas: [{ $ref: \"#/$defs/User\" }],\n * definitions: {\n * User: { type: \"object\", properties: { name: { type: \"string\" } } }\n * }\n * }\n *\n * const openapi = JsonSchema.toMultiDocumentOpenApi3_1(multi)\n * openapi.dialect // => \"openapi-3.1\"\n * openapi.schemas[0] // => { $ref: \"#/components/schemas/User\" }\n * ```\n *\n * @see {@link toDocumentDraft07}\n * @see {@link MultiDocument}\n * @category encoding\n * @since 4.0.0\n */\nexport function toMultiDocumentOpenApi3_1(multiDocument) {\n const definitionKeys = Object.keys(multiDocument.definitions);\n const keyMap = new Map();\n const usedKeys = new Set(definitionKeys.filter(key => VALID_OPEN_API_COMPONENTS_SCHEMAS_KEY_REGEXP.test(key)));\n const invalidKeys = definitionKeys.filter(key => !VALID_OPEN_API_COMPONENTS_SCHEMAS_KEY_REGEXP.test(key)).sort().map(key => [key, sanitizeOpenApiComponentsSchemasKey(key)]);\n for (const [key, base] of invalidKeys) {\n if (usedKeys.has(base)) continue;\n usedKeys.add(base);\n keyMap.set(key, base);\n }\n for (const [key, base] of invalidKeys) {\n if (keyMap.has(key)) continue;\n let candidate;\n let suffix = 0;\n do candidate = `${base}_${++suffix}`; while (usedKeys.has(candidate));\n usedKeys.add(candidate);\n keyMap.set(key, candidate);\n }\n function rewrite(schema, rejectSharedDefinitionRefs = false) {\n const isRootResource = createsResource(schema.$id);\n const localDefinitions = Predicate.isObject(schema.$defs) ? schema.$defs : undefined;\n return transformSchema(schema, (schema, inEmbeddedResource) => {\n rejectKeywordCollisions(schema, OPEN_API_31_TARGET_COLLISIONS, \"OpenAPI 3.1\", \"Draft 2020-12\");\n rewriteSchemaRef(schema, (reference, keyword) => {\n const path = reference.startsWith(\"#\") ? parseUriFragment(reference) : undefined;\n if (path === undefined || path[0] !== \"$defs\" || path.length < 2) return reference;\n const key = path[1];\n if (isRootResource) {\n if (rejectSharedDefinitionRefs && !inEmbeddedResource && Object.hasOwn(multiDocument.definitions, key) && (localDefinitions === undefined || !Object.hasOwn(localDefinitions, key))) {\n unsupported(keyword, \"OpenAPI 3.1\", \"a schema resource cannot reference the shared definitions pool\");\n }\n return reference;\n }\n return inEmbeddedResource ? reference : formatUriFragment([\"components\", \"schemas\", keyMap.get(key) ?? key, ...path.slice(2)]);\n });\n });\n }\n const schemas = multiDocument.schemas.map(schema => rewrite(schema, true));\n const definitions = {};\n for (const key of definitionKeys) {\n InternalRecord.assignProperty(definitions, keyMap.get(key) ?? key, rewrite(multiDocument.definitions[key]));\n }\n return {\n dialect: \"openapi-3.1\",\n schemas,\n definitions\n };\n}\n/** @internal */\nexport const VALID_OPEN_API_COMPONENTS_SCHEMAS_KEY_REGEXP = /^[a-zA-Z0-9.\\-_]+$/;\n/**\n * Returns a sanitized key for an OpenAPI component schema.\n * Should match the `^[a-zA-Z0-9.\\-_]+$` regular expression.\n *\n * @internal\n */\nexport function sanitizeOpenApiComponentsSchemasKey(s) {\n return s.length === 0 ? \"_\" : s.replace(/[^a-zA-Z0-9._-]/gu, \"_\");\n}\n/** @internal */\nexport function getReferenceKey($ref) {\n const path = $ref.startsWith(\"#\") ? parseUriFragment($ref) : undefined;\n return path !== undefined && path.length === 2 && path[0] === \"$defs\" ? path[1] : undefined;\n}\nfunction transformSchema(node, transform) {\n return walk(node, false, true);\n function walk(node, inheritedResource, isRoot = false) {\n if (!Predicate.isObject(node)) return node;\n const inEmbeddedResource = inheritedResource || !isRoot && createsResource(node.$id);\n const out = {};\n for (const key of Object.keys(node)) {\n const value = node[key];\n let transformed = value;\n switch (key) {\n case \"$defs\":\n case \"properties\":\n case \"patternProperties\":\n case \"dependentSchemas\":\n transformed = mapObject(value, value => walk(value, inEmbeddedResource)) ?? value;\n break;\n case \"allOf\":\n case \"anyOf\":\n case \"oneOf\":\n case \"prefixItems\":\n transformed = Array.isArray(value) ? value.map(value => walk(value, inEmbeddedResource)) : value;\n break;\n case \"not\":\n case \"additionalProperties\":\n case \"propertyNames\":\n case \"unevaluatedProperties\":\n case \"items\":\n case \"contains\":\n case \"unevaluatedItems\":\n case \"if\":\n case \"then\":\n case \"else\":\n case \"contentSchema\":\n transformed = walk(value, inEmbeddedResource);\n }\n InternalRecord.assignProperty(out, key, transformed);\n }\n transform(out, inEmbeddedResource);\n return out;\n }\n}\n/** @internal */\nexport function rewriteRefs(schema, rewrite) {\n return transformSchema(schema, schema => {\n rewriteSchemaRef(schema, rewrite);\n });\n}\nfunction rewriteSchemaRef(schema, rewrite) {\n if (typeof schema.$ref === \"string\") {\n InternalRecord.assignProperty(schema, \"$ref\", rewrite(schema.$ref, \"$ref\"));\n }\n if (typeof schema.$dynamicRef === \"string\") {\n InternalRecord.assignProperty(schema, \"$dynamicRef\", rewrite(schema.$dynamicRef, \"$dynamicRef\"));\n }\n}\nfunction mapObject(value, f) {\n if (!Predicate.isObject(value)) return undefined;\n const out = {};\n for (const key of Object.keys(value)) {\n InternalRecord.assignProperty(out, key, f(value[key], key));\n }\n return out;\n}\n// Adapters decide which values are schemas. The kernel only handles recursion,\n// resource scopes, and reference relocation between structural source/target paths.\nfunction runConverter(adapter, options, use) {\n const locations = new Map();\n const references = [];\n let rootUri = ROOT_URI;\n function convert(root, sourcePath = [], targetPath = []) {\n if (sourcePath.length === 0 && options?.trackIds) {\n const id = Predicate.isObject(root) ? getResourceId(root) : undefined;\n rootUri = resolveResourceUri(id, ROOT_URI) ?? ROOT_URI;\n }\n return loop(root, sourcePath, targetPath, {\n sourceRoot: [],\n targetRoot: [],\n uri: rootUri\n });\n }\n function finish() {\n for (const [out, value, sourceResource] of references) {\n let reference = value;\n const resolved = resolveUrl(value, sourceResource);\n if (resolved !== undefined) {\n const sourcePointer = parseUriFragment(resolved.hash);\n resolved.hash = \"\";\n if (sourcePointer !== undefined) {\n const targetPath = locations.get(locationKey(resolved.href, sourcePointer));\n if (targetPath !== undefined) reference = relocateReference(value, targetPath);\n }\n }\n InternalRecord.assignProperty(out, \"$ref\", reference);\n }\n }\n const out = use(convert);\n finish();\n return out;\n function loop(node, sourcePath, targetPath, resourceScope) {\n if (typeof node === \"boolean\") {\n recordLocations(sourcePath, targetPath, resourceScope);\n return options?.booleanAdapter?.(node) ?? node;\n }\n if (!Predicate.isObject(node)) return node;\n let currentResourceScope = resourceScope;\n const id = getResourceId(node);\n if (sourcePath.length > 0 && options?.trackIds && createsResource(id)) {\n const uri = resolveResourceUri(id, resourceScope.uri);\n if (uri !== undefined) {\n currentResourceScope = {\n parent: resourceScope,\n sourceRoot: sourcePath,\n targetRoot: targetPath,\n uri\n };\n }\n }\n recordLocations(sourcePath, targetPath, currentResourceScope);\n const currentResource = currentResourceScope.uri;\n const context = {\n isDocumentRoot: sourcePath.length === 0,\n schema(value, sourceKey, targetKey = sourceKey) {\n return loop(value, [...sourcePath, sourceKey], [...targetPath, targetKey], currentResourceScope);\n },\n schemaAt(value, sourceSuffix, targetSuffix) {\n return loop(value, [...sourcePath, ...sourceSuffix], [...targetPath, ...targetSuffix], currentResourceScope);\n },\n schemaArray(value, sourceKey, targetKey = sourceKey) {\n return Array.isArray(value) ? value.map((item, index) => loop(item, [...sourcePath, sourceKey, String(index)], [...targetPath, targetKey, String(index)], currentResourceScope)) : value;\n },\n schemaMap(value, sourceKey, targetKey = sourceKey) {\n if (!Predicate.isObject(value)) return value;\n return mapObject(value, (item, key) => loop(item, [...sourcePath, sourceKey, key], [...targetPath, targetKey, key], currentResourceScope));\n },\n reference(out, value) {\n if (typeof value === \"string\") {\n references.push([out, value, currentResource]);\n } else {\n InternalRecord.assignProperty(out, \"$ref\", value);\n }\n }\n };\n return adapter(node, context);\n }\n function getResourceId(schema) {\n return options?.ignoreRefSiblings === true && typeof schema.$ref === \"string\" ? undefined : schema.$id;\n }\n function recordLocations(sourcePath, targetPath, scope) {\n // A JSON Pointer can address an embedded schema from any containing resource.\n if (scope.parent !== undefined) recordLocations(sourcePath, targetPath, scope.parent);\n locations.set(locationKey(scope.uri, sourcePath.slice(scope.sourceRoot.length)), targetPath.slice(scope.targetRoot.length));\n }\n}\nconst ROOT_URI = \"https://effect.invalid/.json-schema/\";\nfunction resolveUrl(value, base) {\n return URL.canParse(value, base) ? new URL(value, base) : undefined;\n}\nfunction resolveResourceUri(value, base) {\n if (typeof value !== \"string\") return undefined;\n const url = resolveUrl(value, base);\n if (url === undefined) return undefined;\n url.hash = \"\";\n return url.href;\n}\nfunction relocateReference(reference, targetPath) {\n const index = reference.indexOf(\"#\");\n if (index === -1 && targetPath.length === 0) return reference;\n const uri = index === -1 ? reference : reference.slice(0, index);\n return `${uri}${formatUriFragment(targetPath)}`;\n}\nfunction locationKey(resource, pointer) {\n return `${resource}\\u0000${JSON.stringify(pointer)}`;\n}\nfunction createsResource(id) {\n return typeof id === \"string\" && id.length > 0 && id[0] !== \"#\";\n}\nfunction convertSchema(root, adapter, options) {\n return runConverter(adapter, options, convert => convert(root));\n}\nfunction convertDocument(document, adapter, options) {\n return runConverter(adapter, {\n ...options,\n trackIds: true\n }, convert => ({\n schema: convert(document.schema),\n definitions: mapObject(document.definitions, (definition, key) => convert(definition, [\"$defs\", key], [\"definitions\", key]))\n }));\n}\nconst SCHEMA_MAP_KEYWORDS = /*#__PURE__*/new Set([\"properties\", \"patternProperties\"]);\nconst SCHEMA_ARRAY_KEYWORDS = /*#__PURE__*/new Set([\"allOf\", \"anyOf\", \"oneOf\"]);\nconst JSON_SCHEMA_SINGLE_KEYWORDS = /*#__PURE__*/new Set([\"not\", \"additionalProperties\", \"propertyNames\", \"contains\", \"if\", \"then\", \"else\", \"contentSchema\"]);\nconst OPEN_API_30_SCHEMA_MAP_KEYWORDS = /*#__PURE__*/new Set([\"properties\"]);\nconst OPEN_API_30_SCHEMA_SINGLE_KEYWORDS = /*#__PURE__*/new Set([\"not\", \"items\", \"additionalProperties\"]);\nconst DRAFT_04_SCHEMA_SINGLE_KEYWORDS = /*#__PURE__*/new Set([\"not\", \"additionalProperties\", \"contentSchema\"]);\nfunction convertSubschemaKeyword(out, key, value, context, singleKeywords, mapKeywords = SCHEMA_MAP_KEYWORDS) {\n let converted;\n if (mapKeywords.has(key)) converted = context.schemaMap(value, key);else if (SCHEMA_ARRAY_KEYWORDS.has(key)) converted = context.schemaArray(value, key);else if (singleKeywords.has(key)) converted = context.schema(value, key);else return false;\n InternalRecord.assignProperty(out, key, converted);\n return true;\n}\nconst PRE_2020_TO_2020_COLLISIONS = [\"$anchor\", \"$defs\", \"$dynamicAnchor\", \"$dynamicRef\", \"$vocabulary\", \"contentSchema\", \"dependentRequired\", \"dependentSchemas\", \"maxContains\", \"minContains\", \"prefixItems\", \"unevaluatedItems\", \"unevaluatedProperties\"];\nconst DRAFT_07_TO_2020_COLLISIONS = [...PRE_2020_TO_2020_COLLISIONS, \"deprecated\"];\nconst OPEN_API_30_TO_2020_COLLISIONS = [...PRE_2020_TO_2020_COLLISIONS, \"$comment\", \"$id\", \"$schema\", \"const\", \"contains\", \"contentEncoding\", \"contentMediaType\", \"else\", \"examples\", \"if\", \"patternProperties\", \"propertyNames\", \"then\"];\nconst ANCHOR_REGEXP = /^[A-Za-z_][-A-Za-z0-9._]*$/;\nconst LEGACY_ID_FRAGMENT_REGEXP = /^[A-Za-z][-A-Za-z0-9._:]*$/;\nfunction convertDraft07(root) {\n return convertSchema(root, (source, context) => {\n const out = {};\n if (typeof source.$ref === \"string\") {\n context.reference(out, source.$ref);\n if (Object.hasOwn(source, \"definitions\")) {\n InternalRecord.assignProperty(out, \"$defs\", context.schemaMap(source.definitions, \"definitions\", \"$defs\"));\n }\n return out;\n }\n rejectKeywordCollisions(source, DRAFT_07_TO_2020_COLLISIONS, \"Draft 2020-12\", \"Draft-07\");\n let items = undefined;\n let additionalItems = undefined;\n for (const key of Object.keys(source)) {\n const value = source[key];\n if (convertSubschemaKeyword(out, key, value, context, JSON_SCHEMA_SINGLE_KEYWORDS)) continue;\n switch (key) {\n case \"$schema\":\n InternalRecord.assignProperty(out, key, isMetaSchemaUri(value, META_SCHEMA_URI_DRAFT_07) ? META_SCHEMA_URI_DRAFT_2020_12 : value);\n break;\n case \"$id\":\n convertDraft07Id(out, value);\n break;\n case \"definitions\":\n InternalRecord.assignProperty(out, \"$defs\", context.schemaMap(value, key, \"$defs\"));\n break;\n case \"dependencies\":\n {\n if (!Predicate.isObject(value)) {\n InternalRecord.assignProperty(out, key, value);\n break;\n }\n const dependentRequired = {};\n const dependentSchemas = {};\n for (const dependency of Object.keys(value)) {\n const dependencyValue = value[dependency];\n InternalRecord.assignProperty(Array.isArray(dependencyValue) ? dependentRequired : dependentSchemas, dependency, Array.isArray(dependencyValue) ? dependencyValue : context.schemaAt(dependencyValue, [\"dependencies\", dependency], [\"dependentSchemas\", dependency]));\n }\n if (Object.keys(dependentRequired).length > 0) {\n InternalRecord.assignProperty(out, \"dependentRequired\", dependentRequired);\n }\n if (Object.keys(dependentSchemas).length > 0) {\n InternalRecord.assignProperty(out, \"dependentSchemas\", dependentSchemas);\n }\n break;\n }\n case \"items\":\n items = value;\n break;\n case \"additionalItems\":\n additionalItems = value;\n break;\n default:\n InternalRecord.assignProperty(out, key, value);\n }\n }\n if (items !== undefined) {\n if (Array.isArray(items)) {\n InternalRecord.assignProperty(out, \"prefixItems\", context.schemaArray(items, \"items\", \"prefixItems\"));\n if (additionalItems !== undefined) {\n InternalRecord.assignProperty(out, \"items\", context.schema(additionalItems, \"additionalItems\", \"items\"));\n }\n } else {\n InternalRecord.assignProperty(out, \"items\", context.schema(items, \"items\"));\n }\n }\n return out;\n }, {\n trackIds: true,\n ignoreRefSiblings: true\n });\n}\nfunction convertDraft07Id(out, value) {\n if (typeof value !== \"string\" || !value.includes(\"#\")) {\n InternalRecord.assignProperty(out, \"$id\", value);\n return;\n }\n const fragmentIndex = value.indexOf(\"#\");\n const id = value.slice(0, fragmentIndex);\n const anchor = value.slice(fragmentIndex + 1);\n if (anchor.length === 0) {\n if (id.length > 0) InternalRecord.assignProperty(out, \"$id\", id);\n return;\n }\n if (!ANCHOR_REGEXP.test(anchor)) {\n unsupported(\"$id\", \"Draft 2020-12\", `fragment \"#${anchor}\" is not a valid $anchor`);\n }\n if (id.length > 0) InternalRecord.assignProperty(out, \"$id\", id);\n InternalRecord.assignProperty(out, \"$anchor\", anchor);\n}\nfunction unsupported(keyword, dialect, details) {\n throw new Error(`Cannot convert JSON Schema keyword \"${keyword}\" to ${dialect}: ${details}`);\n}\nfunction rejectKeywordCollisions(source, keywords, targetDialect, sourceDialect) {\n for (const keyword of keywords) {\n if (Object.hasOwn(source, keyword)) {\n unsupported(keyword, targetDialect, `it is not active in ${sourceDialect} but would become active in the target`);\n }\n }\n}\nconst DRAFT_07_TARGET_COLLISIONS = [\"additionalItems\", \"definitions\", \"dependencies\"];\nfunction convertMetaSchemaKeyword(out, value, context, targetUri, targetDialect) {\n if (context.isDocumentRoot) {\n InternalRecord.assignProperty(out, \"$schema\", isMetaSchemaUri(value, META_SCHEMA_URI_DRAFT_2020_12) ? targetUri : value);\n } else if (!isMetaSchemaUri(value, META_SCHEMA_URI_DRAFT_2020_12)) {\n unsupported(\"$schema\", targetDialect, \"an embedded resource cannot declare a different dialect\");\n }\n}\nfunction draft07Adapter(source, context) {\n rejectKeywordCollisions(source, DRAFT_07_TARGET_COLLISIONS, \"Draft-07\", \"Draft 2020-12\");\n const out = {};\n let reference = undefined;\n let prefixItems = undefined;\n let items = undefined;\n for (const key of Object.keys(source)) {\n const value = source[key];\n if (convertSubschemaKeyword(out, key, value, context, JSON_SCHEMA_SINGLE_KEYWORDS)) continue;\n switch (key) {\n case \"$ref\":\n reference = value;\n break;\n case \"$schema\":\n convertMetaSchemaKeyword(out, value, context, META_SCHEMA_URI_DRAFT_07, \"Draft-07\");\n break;\n case \"$id\":\n case \"$anchor\":\n break;\n case \"$defs\":\n InternalRecord.assignProperty(out, \"definitions\", context.schemaMap(value, key, \"definitions\"));\n break;\n case \"prefixItems\":\n prefixItems = value;\n break;\n case \"items\":\n items = value;\n break;\n case \"dependentRequired\":\n case \"dependentSchemas\":\n case \"minContains\":\n case \"maxContains\":\n break;\n case \"$dynamicRef\":\n case \"$dynamicAnchor\":\n case \"$vocabulary\":\n case \"unevaluatedProperties\":\n case \"unevaluatedItems\":\n unsupported(key, \"Draft-07\", \"the target dialect has no equivalent\");\n case \"required\":\n if (Array.isArray(value) && value.length === 0) break;\n InternalRecord.assignProperty(out, key, value);\n break;\n default:\n InternalRecord.assignProperty(out, key, value);\n }\n }\n convertTuple(out, prefixItems, items, context);\n if (Object.hasOwn(source, \"contains\")) {\n const minContains = source.minContains;\n const maxContains = source.maxContains;\n if (minContains !== undefined && minContains !== 1 || maxContains !== undefined) {\n unsupported(\"minContains/maxContains\", \"Draft-07\", \"contains cardinality cannot be represented\");\n }\n if (Object.hasOwn(source, \"minContains\")) InternalRecord.assignProperty(out, \"minContains\", minContains);\n } else {\n if (Object.hasOwn(source, \"minContains\")) InternalRecord.assignProperty(out, \"minContains\", source.minContains);\n if (Object.hasOwn(source, \"maxContains\")) InternalRecord.assignProperty(out, \"maxContains\", source.maxContains);\n }\n convertDependencies(source, out, context, \"draft-07\");\n convertLegacyId(source, out, \"$id\", \"Draft-07\");\n convertReference(out, reference, context);\n return out;\n}\nfunction convertTuple(out, prefixItems, items, context) {\n if (prefixItems === undefined) {\n if (items !== undefined) InternalRecord.assignProperty(out, \"items\", context.schema(items, \"items\"));\n return;\n }\n InternalRecord.assignProperty(out, \"items\", context.schemaArray(prefixItems, \"prefixItems\", \"items\"));\n if (items !== undefined) {\n InternalRecord.assignProperty(out, \"additionalItems\", context.schema(items, \"items\", \"additionalItems\"));\n }\n}\nfunction convertReference(out, reference, context) {\n if (reference === undefined) return;\n if (typeof reference === \"string\" && Object.keys(out).length > 0) {\n const referenceSchema = {};\n context.reference(referenceSchema, reference);\n appendAllOf(out, referenceSchema);\n } else {\n context.reference(out, reference);\n }\n}\nfunction convertDependencies(source, out, context, targetDialect) {\n const dependentRequired = Predicate.isObject(source.dependentRequired) ? source.dependentRequired : undefined;\n const dependentSchemas = Predicate.isObject(source.dependentSchemas) ? source.dependentSchemas : undefined;\n if (dependentRequired === undefined && dependentSchemas === undefined) return;\n const dependencies = {};\n const keys = new Set([...Object.keys(dependentRequired ?? {}), ...Object.keys(dependentSchemas ?? {})]);\n for (const key of keys) {\n const required = dependentRequired?.[key];\n const dependency = dependentSchemas?.[key];\n const omitRequired = targetDialect === \"draft-04\" && Array.isArray(required) && required.length === 0;\n if (dependency === undefined) {\n if (!omitRequired) InternalRecord.assignProperty(dependencies, key, required);\n } else if (required === undefined || omitRequired) {\n InternalRecord.assignProperty(dependencies, key, context.schemaAt(dependency, [\"dependentSchemas\", key], [\"dependencies\", key]));\n } else {\n InternalRecord.assignProperty(dependencies, key, {\n allOf: [context.schemaAt(dependency, [\"dependentSchemas\", key], [\"dependencies\", key, \"allOf\", \"0\"]), {\n required\n }]\n });\n }\n }\n if (Object.keys(dependencies).length > 0) InternalRecord.assignProperty(out, \"dependencies\", dependencies);\n}\nfunction convertOpenApi30(root) {\n return convertSchema(root, (source, context) => {\n const out = {};\n if (typeof source.$ref === \"string\") {\n context.reference(out, rewriteOpenApiComponentsReference(source.$ref));\n return out;\n }\n rejectKeywordCollisions(source, OPEN_API_30_TO_2020_COLLISIONS, \"Draft 2020-12\", \"OpenAPI 3.0\");\n for (const key of Object.keys(source)) {\n const value = source[key];\n if (convertSubschemaKeyword(out, key, value, context, OPEN_API_30_SCHEMA_SINGLE_KEYWORDS, OPEN_API_30_SCHEMA_MAP_KEYWORDS)) {\n continue;\n }\n switch (key) {\n case \"example\":\n InternalRecord.assignProperty(out, \"examples\", [value]);\n break;\n case \"nullable\":\n case \"exclusiveMinimum\":\n case \"exclusiveMaximum\":\n break;\n default:\n InternalRecord.assignProperty(out, key, value);\n }\n }\n convertOpenApiExclusiveBound(source, out, \"minimum\");\n convertOpenApiExclusiveBound(source, out, \"maximum\");\n if (source.nullable === true && typeof source.type === \"string\") {\n InternalRecord.assignProperty(out, \"type\", [source.type, \"null\"]);\n }\n return out;\n });\n}\nfunction convertOpenApiExclusiveBound(source, out, boundKey) {\n const exclusiveKey = boundKey === \"minimum\" ? \"exclusiveMinimum\" : \"exclusiveMaximum\";\n const exclusive = source[exclusiveKey];\n if (typeof exclusive !== \"boolean\") {\n if (exclusive !== undefined) InternalRecord.assignProperty(out, exclusiveKey, exclusive);\n return;\n }\n if (exclusive && typeof source[boundKey] === \"number\") {\n InternalRecord.assignProperty(out, exclusiveKey, source[boundKey]);\n delete out[boundKey];\n }\n}\nconst DRAFT_04_TARGET_COLLISIONS = [\"additionalItems\", \"definitions\", \"dependencies\", \"id\"];\nfunction draft04Adapter(source, context) {\n rejectKeywordCollisions(source, DRAFT_04_TARGET_COLLISIONS, \"Draft-04\", \"Draft 2020-12\");\n const out = {};\n let reference = undefined;\n let prefixItems = undefined;\n let items = undefined;\n let constSchema;\n for (const key of Object.keys(source)) {\n const value = source[key];\n if (convertSubschemaKeyword(out, key, value, context, DRAFT_04_SCHEMA_SINGLE_KEYWORDS)) continue;\n switch (key) {\n case \"$ref\":\n reference = value;\n break;\n case \"$schema\":\n convertMetaSchemaKeyword(out, value, context, META_SCHEMA_URI_DRAFT_04, \"Draft-04\");\n break;\n case \"$id\":\n case \"$anchor\":\n break;\n case \"$defs\":\n InternalRecord.assignProperty(out, \"definitions\", context.schemaMap(value, key, \"definitions\"));\n break;\n case \"prefixItems\":\n prefixItems = value;\n break;\n case \"items\":\n items = value;\n break;\n case \"$dynamicRef\":\n case \"$dynamicAnchor\":\n case \"$vocabulary\":\n case \"unevaluatedProperties\":\n case \"unevaluatedItems\":\n case \"propertyNames\":\n unsupported(key, \"Draft-04\", \"the target dialect has no equivalent\");\n case \"dependentRequired\":\n case \"dependentSchemas\":\n case \"contains\":\n case \"minContains\":\n case \"maxContains\":\n case \"if\":\n case \"then\":\n case \"else\":\n case \"minimum\":\n case \"maximum\":\n case \"exclusiveMinimum\":\n case \"exclusiveMaximum\":\n break;\n case \"const\":\n constSchema = {\n enum: [value]\n };\n break;\n case \"required\":\n if (Array.isArray(value) && value.length === 0) break;\n InternalRecord.assignProperty(out, key, value);\n break;\n default:\n InternalRecord.assignProperty(out, key, value);\n }\n }\n convertTuple(out, prefixItems, items, context);\n convertDraft04ExclusiveBound(source, out, \"minimum\");\n convertDraft04ExclusiveBound(source, out, \"maximum\");\n convertDependencies(source, out, context, \"draft-04\");\n convertLegacyId(source, out, \"id\", \"Draft-04\");\n convertDraft04Conditionals(source, out, context);\n convertDraft04Contains(source, out, context);\n if (constSchema !== undefined) {\n if (Object.hasOwn(source, \"enum\")) {\n appendAllOf(out, constSchema);\n } else {\n InternalRecord.assignProperty(out, \"enum\", constSchema.enum);\n }\n }\n convertReference(out, reference, context);\n return out;\n}\nfunction convertDraft04Conditionals(source, out, context) {\n const hasIf = Object.hasOwn(source, \"if\");\n const hasThen = Object.hasOwn(source, \"then\");\n const hasElse = Object.hasOwn(source, \"else\");\n if (!hasIf || !hasThen && !hasElse) {\n if (hasIf) InternalRecord.assignProperty(out, \"if\", context.schema(source.if, \"if\"));\n if (hasThen) InternalRecord.assignProperty(out, \"then\", context.schema(source.then, \"then\"));\n if (hasElse) InternalRecord.assignProperty(out, \"else\", context.schema(source.else, \"else\"));\n return;\n }\n const index = Array.isArray(out.allOf) ? out.allOf.length : 0;\n const base = [\"allOf\", String(index), \"anyOf\"];\n const convertBranch = (key, targetPath) => context.schemaAt(source[key], [key], [...base, ...targetPath]);\n let conditional;\n if (hasThen && hasElse) {\n if (hasSchemaIdentifier(source.if)) {\n unsupported(\"if\", \"Draft-04\", \"lowering both branches would duplicate a schema identifier\");\n }\n // (if AND then) OR ((NOT if) AND else)\n conditional = {\n anyOf: [{\n allOf: [convertBranch(\"if\", [\"0\", \"allOf\", \"0\"]), convertBranch(\"then\", [\"0\", \"allOf\", \"1\"])]\n }, {\n allOf: [{\n not: convertBranch(\"if\", [\"1\", \"allOf\", \"0\", \"not\"])\n }, convertBranch(\"else\", [\"1\", \"allOf\", \"1\"])]\n }]\n };\n } else if (hasThen) {\n // (NOT if) OR then\n conditional = {\n anyOf: [{\n not: convertBranch(\"if\", [\"0\", \"not\"])\n }, convertBranch(\"then\", [\"1\"])]\n };\n } else {\n // if OR else\n conditional = {\n anyOf: [convertBranch(\"if\", [\"0\"]), convertBranch(\"else\", [\"1\"])]\n };\n }\n appendAllOf(out, conditional);\n}\nfunction hasSchemaIdentifier(node) {\n if (!Predicate.isObject(node)) return false;\n if (Object.hasOwn(node, \"$id\") || Object.hasOwn(node, \"$anchor\")) return true;\n for (const key of Object.keys(node)) {\n const value = node[key];\n switch (key) {\n case \"$defs\":\n case \"properties\":\n case \"patternProperties\":\n case \"dependentSchemas\":\n if (Predicate.isObject(value) && Object.values(value).some(hasSchemaIdentifier)) return true;\n break;\n case \"allOf\":\n case \"anyOf\":\n case \"oneOf\":\n case \"prefixItems\":\n if (Array.isArray(value) && value.some(hasSchemaIdentifier)) return true;\n break;\n case \"not\":\n case \"additionalProperties\":\n case \"propertyNames\":\n case \"unevaluatedProperties\":\n case \"items\":\n case \"contains\":\n case \"unevaluatedItems\":\n case \"if\":\n case \"then\":\n case \"else\":\n case \"contentSchema\":\n if (hasSchemaIdentifier(value)) return true;\n }\n }\n return false;\n}\nfunction convertDraft04Contains(source, out, context) {\n if (!Object.hasOwn(source, \"contains\")) {\n if (Object.hasOwn(source, \"minContains\")) InternalRecord.assignProperty(out, \"minContains\", source.minContains);\n if (Object.hasOwn(source, \"maxContains\")) InternalRecord.assignProperty(out, \"maxContains\", source.maxContains);\n return;\n }\n const minContains = source.minContains;\n const maxContains = source.maxContains;\n if (minContains !== undefined && minContains !== 1 || maxContains !== undefined) {\n unsupported(\"minContains/maxContains\", \"Draft-04\", \"contains cardinality cannot be represented\");\n }\n const index = Array.isArray(out.allOf) ? out.allOf.length : 0;\n const contains = context.schemaAt(source.contains, [\"contains\"], [\"allOf\", String(index), \"anyOf\", \"1\", \"not\", \"items\", \"not\"]);\n appendAllOf(out, {\n anyOf: [{\n not: {\n type: \"array\"\n }\n }, {\n not: {\n items: {\n not: contains\n }\n }\n }]\n });\n}\nfunction appendAllOf(out, schema) {\n if (Array.isArray(out.allOf)) out.allOf.push(schema);else InternalRecord.assignProperty(out, \"allOf\", [schema]);\n}\nfunction convertLegacyId(source, out, targetKey, dialect) {\n const id = source.$id;\n const anchor = source.$anchor;\n if (anchor === undefined) {\n if (id !== undefined) InternalRecord.assignProperty(out, targetKey, id);\n return;\n }\n if (typeof anchor !== \"string\" || !ANCHOR_REGEXP.test(anchor)) {\n unsupported(\"$anchor\", dialect, \"the anchor is not valid\");\n }\n if (!LEGACY_ID_FRAGMENT_REGEXP.test(anchor)) {\n unsupported(\"$anchor\", dialect, \"the anchor cannot be represented as a plain-name fragment identifier\");\n }\n if (id === undefined) {\n InternalRecord.assignProperty(out, targetKey, `#${anchor}`);\n } else {\n unsupported(\"$anchor\", dialect, \"it cannot be combined with the schema $id\");\n }\n}\nfunction convertDraft04ExclusiveBound(source, out, boundKey) {\n const exclusiveKey = boundKey === \"minimum\" ? \"exclusiveMinimum\" : \"exclusiveMaximum\";\n const bound = source[boundKey];\n const exclusive = source[exclusiveKey];\n if (typeof exclusive === \"number\") {\n const isBoundStricter = typeof bound === \"number\" && (boundKey === \"minimum\" ? bound > exclusive : bound < exclusive);\n if (isBoundStricter) {\n InternalRecord.assignProperty(out, boundKey, bound);\n } else {\n InternalRecord.assignProperty(out, boundKey, exclusive);\n InternalRecord.assignProperty(out, exclusiveKey, true);\n }\n } else if (bound !== undefined) {\n InternalRecord.assignProperty(out, boundKey, bound);\n }\n}\n//# sourceMappingURL=JsonSchema.js.map","import { memoize } from \"../../Function.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as SchemaAST from \"../../SchemaAST.js\";\nimport * as SchemaGetter from \"../../SchemaGetter.js\";\nimport * as InternalTransformation from \"../../SchemaTransformation.js\";\nimport * as InternalMake from \"./make.js\";\n/** @internal */\nexport function toCodecJson(schema) {\n return InternalMake.make(toCodecJsonAST(schema.ast), {\n schema\n });\n}\n/** @internal */\nexport const toCodecJsonAST = /*#__PURE__*/SchemaAST.applyToSelfOrLastLinkEncodingIdempotent(ast => {\n const out = toCodecJsonASTStep(ast, toCodecJsonAST);\n const context = ast.context;\n if (out === ast || context === undefined) return out;\n return SchemaAST.replaceContextLastLink(out, withoutConstructorDefault(context));\n});\nfunction withoutConstructorDefault(context) {\n return context.constructorDefault === undefined ? context : new SchemaAST.Context(context.isOptional, context.isMutable, undefined, context.annotations);\n}\nfunction validateCanonicalObjectPropertyNames(ast) {\n if (ast.propertySignatures.some(ps => typeof ps.name !== \"string\")) {\n throw new globalThis.Error(\"Objects property names must be strings\", {\n cause: ast\n });\n }\n}\nfunction makeReorder(getPriority) {\n return types => {\n // Create a map of original indices for O(1) lookup\n const indexMap = new Map();\n for (let i = 0; i < types.length; i++) {\n indexMap.set(SchemaAST.toEncoded(types[i]), i);\n }\n // Create a sorted copy of the types array\n const sortedTypes = [...types].sort((a, b) => {\n a = SchemaAST.toEncoded(a);\n b = SchemaAST.toEncoded(b);\n const pa = getPriority(a);\n const pb = getPriority(b);\n if (pa !== pb) return pa - pb;\n // If priorities are equal, maintain original order (stable sort)\n return indexMap.get(a) - indexMap.get(b);\n });\n // Check if order changed by comparing arrays\n const orderChanged = sortedTypes.some((ast, index) => ast !== types[index]);\n if (!orderChanged) return types;\n return sortedTypes;\n };\n}\nconst toCodecJsonReorder = /*#__PURE__*/makeReorder(ast => {\n switch (ast._tag) {\n case \"BigInt\":\n case \"Symbol\":\n case \"UniqueSymbol\":\n return 0;\n default:\n return 1;\n }\n});\nfunction toCodecJsonASTStep(ast, recur) {\n switch (ast._tag) {\n case \"Declaration\":\n {\n const getLink = ast.annotations?.toCodecJson ?? ast.annotations?.toCodec;\n if (!Predicate.isFunction(getLink)) {\n return SchemaAST.replaceEncoding(ast, [SchemaAST.unknownToJson]);\n }\n const typeParameters = ast.typeParameters.map(tp => InternalMake.make(SchemaAST.toEncoded(tp)));\n const link = getLink(typeParameters);\n return link === undefined ? ast : SchemaAST.replaceEncoding(ast, [SchemaAST.mapLink(link, recur)]);\n }\n case \"Unknown\":\n return SchemaAST.replaceEncoding(ast, [SchemaAST.unknownToJson]);\n case \"ObjectKeyword\":\n return SchemaAST.replaceEncoding(ast, [SchemaAST.objectKeywordToJson]);\n case \"Undefined\":\n case \"Void\":\n case \"Literal\":\n case \"Number\":\n return ast.toCodecJson();\n case \"UniqueSymbol\":\n case \"Symbol\":\n case \"BigInt\":\n return ast.toCodecStringTree();\n case \"Objects\":\n {\n validateCanonicalObjectPropertyNames(ast);\n return ast.recur(recur, SchemaAST.parameterFromString);\n }\n case \"Union\":\n {\n const sortedTypes = toCodecJsonReorder(ast.types);\n if (sortedTypes !== ast.types) {\n return new SchemaAST.Union(sortedTypes, ast.options, ast.annotations, ast.checks, ast.encoding, ast.context, ast.encodingChecks).recur(recur);\n }\n return ast.recur(recur);\n }\n case \"Arrays\":\n case \"Suspend\":\n return ast.recur(recur);\n }\n // `Schema.Any` is used as an escape hatch\n return ast;\n}\n/** @internal */\nexport function toCodecIso(schema) {\n return InternalMake.make(toCodecIsoAST(SchemaAST.toType(schema.ast)));\n}\nconst toCodecIsoAST = /*#__PURE__*/memoize(ast => {\n const out = toCodecIsoASTStep(ast, toCodecIsoAST);\n return out !== ast && ast.context !== undefined ? SchemaAST.replaceContextLastLink(out, withoutConstructorDefault(ast.context)) : out;\n});\nfunction toCodecIsoASTStep(ast, recur) {\n switch (ast._tag) {\n case \"Declaration\":\n {\n const getLink = ast.annotations?.toCodecIso ?? ast.annotations?.toCodec;\n if (Predicate.isFunction(getLink)) {\n const link = getLink(ast.typeParameters.map(tp => InternalMake.make(tp)));\n return SchemaAST.replaceEncoding(ast, [SchemaAST.mapLink(link, recur)]);\n }\n return ast;\n }\n case \"Arrays\":\n case \"Objects\":\n case \"Union\":\n case \"Suspend\":\n return ast.recur(recur);\n }\n return ast;\n}\n/** @internal */\nexport function toCodecStringTree(schema) {\n return InternalMake.make(toCodecStringTreeAST(schema.ast), {\n schema\n });\n}\n/** @internal */\nexport function toCodecArrayFromSingle(schema) {\n return InternalMake.make(toCodecArrayFromSingleAST(schema.ast));\n}\nconst toStringTreeReorder = /*#__PURE__*/makeReorder(ast => {\n switch (ast._tag) {\n case \"Null\":\n case \"Boolean\":\n case \"Number\":\n case \"BigInt\":\n case \"Symbol\":\n case \"UniqueSymbol\":\n return 0;\n default:\n return 1;\n }\n});\nfunction toCodecStringTreeASTStep(ast, recur, onMissingAnnotation) {\n switch (ast._tag) {\n case \"Declaration\":\n {\n const typeParameters = ast.typeParameters.map(tp => InternalMake.make(recur(SchemaAST.toEncoded(tp))));\n const getStringTreeLink = ast.annotations?.toCodecStringTree;\n if (Predicate.isFunction(getStringTreeLink)) {\n const link = getStringTreeLink(typeParameters);\n if (link === undefined) return ast;\n return SchemaAST.replaceEncoding(ast, [SchemaAST.mapLink(link, recur)]);\n }\n const getJsonLink = ast.annotations?.toCodecJson;\n const jsonLink = Predicate.isFunction(getJsonLink) ? getJsonLink(typeParameters) : undefined;\n const getLink = jsonLink === undefined ? ast.annotations?.toCodec : undefined;\n const link = jsonLink ?? (Predicate.isFunction(getLink) ? getLink(typeParameters) : undefined);\n return link === undefined ? onMissingAnnotation(ast) : SchemaAST.replaceEncoding(ast, [SchemaAST.mapLink(link, recur)]);\n }\n case \"Null\":\n return SchemaAST.replaceEncoding(ast, [nullToString]);\n case \"Boolean\":\n return SchemaAST.replaceEncoding(ast, [booleanToString]);\n case \"Unknown\":\n case \"ObjectKeyword\":\n return SchemaAST.replaceEncoding(ast, [SchemaAST.unknownToStringTree]);\n case \"Enum\":\n case \"Number\":\n case \"Literal\":\n case \"UniqueSymbol\":\n case \"Symbol\":\n case \"BigInt\":\n return ast.toCodecStringTree();\n case \"Objects\":\n {\n validateCanonicalObjectPropertyNames(ast);\n return ast.recur(recur, SchemaAST.parameterFromString);\n }\n case \"Union\":\n {\n const sortedTypes = toStringTreeReorder(ast.types);\n if (sortedTypes !== ast.types) {\n return new SchemaAST.Union(sortedTypes, ast.options, ast.annotations, ast.checks, ast.encoding, ast.context, ast.encodingChecks).recur(recur);\n }\n return ast.recur(recur);\n }\n case \"Arrays\":\n case \"Suspend\":\n return ast.recur(recur);\n }\n // `Schema.Any` is used as an escape hatch\n return ast;\n}\nconst nullToString = /*#__PURE__*/new SchemaAST.Link(/*#__PURE__*/new SchemaAST.Literal(\"null\"), /*#__PURE__*/new InternalTransformation.Transformation(/*#__PURE__*/SchemaGetter.transform(() => null), /*#__PURE__*/SchemaGetter.transform(() => \"null\")));\nconst booleanToString = /*#__PURE__*/new SchemaAST.Link(/*#__PURE__*/new SchemaAST.Union([/*#__PURE__*/new SchemaAST.Literal(\"true\"), /*#__PURE__*/new SchemaAST.Literal(\"false\")]), /*#__PURE__*/new InternalTransformation.Transformation(/*#__PURE__*/SchemaGetter.transform(s => s === \"true\"), /*#__PURE__*/SchemaGetter.String()));\nconst arrayFromSingleTransformation = /*#__PURE__*/new InternalTransformation.Transformation(/*#__PURE__*/SchemaGetter.transform(input => typeof input === \"string\" ? [input] : input), /*#__PURE__*/SchemaGetter.passthrough());\nconst isCodecArrayFromSingleLink = link => link.transformation === arrayFromSingleTransformation;\nconst toCodecStringTreeAST = /*#__PURE__*/SchemaAST.applyToSelfOrLastLinkEncodingIdempotent(ast => {\n const out = toCodecStringTreeASTStep(ast, toCodecStringTreeAST, ast => {\n throw new globalThis.Error(\"Missing structural codec for StringTree\", {\n cause: ast\n });\n });\n if (out !== ast && ast.context !== undefined) {\n return SchemaAST.replaceContextLastLink(out, withoutConstructorDefault(ast.context));\n }\n return out;\n}, {\n stopAt: isCodecArrayFromSingleLink\n});\nconst toArrayFromSingleInputElement = ast => SchemaAST.isOptional(ast) ? SchemaAST.optionalKey(SchemaAST.unknown) : SchemaAST.unknown;\nconst toCodecArrayFromSingleAST = /*#__PURE__*/SchemaAST.applyToSelfOrLastLinkEncodingIdempotent(ast => {\n const out = toCodecArrayFromSingleASTStep(ast);\n if (SchemaAST.isArrays(out)) {\n const ensure = SchemaAST.decodeTo(new SchemaAST.Union([new SchemaAST.Arrays(out.isMutable, out.elements.map(toArrayFromSingleInputElement), out.rest.map(toArrayFromSingleInputElement)), SchemaAST.string], {\n mode: \"anyOf\"\n }), out, arrayFromSingleTransformation);\n return SchemaAST.isOptional(ast) ? SchemaAST.optionalKey(ensure) : ensure;\n }\n return out;\n}, {\n stopAt: isCodecArrayFromSingleLink\n});\nfunction toCodecArrayFromSingleASTStep(ast) {\n return ast._tag === \"Declaration\" || ast._tag === \"Arrays\" || ast._tag === \"Objects\" || ast._tag === \"Union\" || ast._tag === \"Suspend\" ? ast.recur(toCodecArrayFromSingleAST) : ast;\n}\n//# sourceMappingURL=toCodec.js.map","/**\n * Tools for working with JavaScript regular expressions from the Effect module\n * namespace. The module exposes the native `RegExp` constructor, a guard for\n * narrowing unknown values, and escaping for literal text that will be embedded\n * in a pattern.\n *\n * Reach for `RegExp` when you need to build a regular expression from user or\n * data-driven text, check whether an unknown value is already a `RegExp`, or\n * access the native constructor without leaving the Effect namespace.\n *\n * @since 2.0.0\n */\nimport * as predicate from \"./Predicate.js\";\n/**\n * Exposes the JavaScript regular expression constructor from `globalThis`.\n *\n * **When to use**\n *\n * Use to construct JavaScript regular expressions through the Effect module\n * namespace.\n *\n * **Example** (Creating a regular expression)\n *\n * ```ts import.meta.vitest\n * import { RegExp } from \"effect\"\n *\n * const pattern = new RegExp.RegExp(\"hello\", \"i\")\n * pattern // => /hello/i\n * pattern.test(\"Hello World\") // => true\n * pattern.test(\"goodbye\") // => false\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const RegExp = globalThis.RegExp;\n/**\n * Checks whether a value is a `RegExp`.\n *\n * **When to use**\n *\n * Use to validate unknown input before treating it as a regular expression.\n *\n * **Example** (Checking for regular expressions)\n *\n * ```ts import.meta.vitest\n * import { RegExp } from \"effect\"\n *\n * RegExp.isRegExp(/a/) // => true\n * RegExp.isRegExp(\"a\") // => false\n * ```\n *\n * @category guards\n * @since 3.9.0\n */\nexport const isRegExp = predicate.isRegExp;\n/**\n * Escapes special characters in a regular expression pattern.\n *\n * **When to use**\n *\n * Use to turn literal text into a safe regular expression pattern fragment.\n *\n * **Example** (Escaping a pattern string)\n *\n * ```ts import.meta.vitest\n * import { RegExp } from \"effect\"\n *\n * RegExp.escape(\"a*b\") // => \"a\\\\*b\"\n * ```\n *\n * @category transforming\n * @since 2.0.0\n */\nexport const escape = string => string.replace(/[/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n//# sourceMappingURL=RegExp.js.map","import { formatPath } from \"../Formatter.js\";\n/** @internal */\nexport function errorWithPath(message, path) {\n if (path.length > 0) {\n message += `\\n at ${formatPath(path)}`;\n }\n return new Error(message);\n}\n//# sourceMappingURL=errors.js.map","import * as Arr from \"../../Array.js\";\nimport * as Equal from \"../../Equal.js\";\nimport { decodeUriFragment, formatUriFragmentToken, unescapeToken } from \"../../JsonPointer.js\";\nimport { rewriteRefs } from \"../../JsonSchema.js\";\nimport * as RegEx from \"../../RegExp.js\";\nimport * as InternalAST from \"../../SchemaAST.js\";\nimport { errorWithPath } from \"../errors.js\";\nimport * as InternalRecord from \"../record.js\";\nimport * as InternalAnnotations from \"./annotations.js\";\nfunction formatDefinitionReference(key) {\n return `#/$defs/${formatUriFragmentToken(key)}`;\n}\nconst jsonSchemaAnnotationExcludedKeys = /*#__PURE__*/new Set([...InternalAnnotations.annotationExcludedKeys, InternalAnnotations.IDENTIFIER_FALLBACK_KEY, ...InternalAnnotations.jsonSchemaAnnotationKeys]);\nfunction collectJsonSchemaAnnotations(annotations, options) {\n if (annotations === undefined) return undefined;\n const out = {};\n const title = annotations.title;\n if (typeof title === \"string\") out.title = title;\n const description = annotations.description;\n const expected = annotations.expected;\n if (typeof description === \"string\") out.description = description;else if (options?.generateDescriptions === true && typeof expected === \"string\") out.description = expected;\n const defaultValue = annotations.default;\n if (InternalAST.isJson(defaultValue)) out.default = defaultValue;\n const examples = annotations.examples;\n if (Array.isArray(examples) && InternalAST.isJson(examples)) out.examples = examples;\n const readOnly = annotations.readOnly;\n if (typeof readOnly === \"boolean\") out.readOnly = readOnly;\n const writeOnly = annotations.writeOnly;\n if (typeof writeOnly === \"boolean\") out.writeOnly = writeOnly;\n const format = annotations.format;\n if (typeof format === \"string\") out.format = format;\n const contentEncoding = annotations.contentEncoding;\n if (typeof contentEncoding === \"string\") out.contentEncoding = contentEncoding;\n const contentMediaType = annotations.contentMediaType;\n if (typeof contentMediaType === \"string\") out.contentMediaType = contentMediaType;\n const contentSchema = annotations.contentSchema;\n if (InternalAST.isJson(contentSchema)) out.contentSchema = contentSchema;\n if (options?.includeAnnotationKey !== undefined) {\n for (const [key, value] of Object.entries(annotations)) {\n if (jsonSchemaAnnotationExcludedKeys.has(key) || !options.includeAnnotationKey(key)) {\n continue;\n }\n if (InternalAST.isJson(value)) InternalRecord.assignProperty(out, key, value);\n }\n }\n return Object.keys(out).length === 0 ? undefined : out;\n}\nfunction extractJsonSchemaNumberType(schema) {\n let type = schema.type === \"number\" || schema.type === \"integer\" ? schema.type : undefined;\n let out = schema;\n if (type !== undefined) {\n out = {\n ...schema\n };\n delete out.type;\n }\n if (Array.isArray(out.allOf)) {\n const members = [];\n let changed = false;\n for (const member of out.allOf) {\n const extracted = extractJsonSchemaNumberType(member);\n if (extracted.type !== undefined) {\n changed = true;\n if (type === undefined || extracted.type === \"integer\") type = extracted.type;\n }\n if (Object.keys(extracted.schema).length > 0) members.push(extracted.schema);\n }\n if (changed) {\n const {\n allOf: _,\n ...rest\n } = out;\n out = members.length === 0 ? rest : {\n ...rest,\n allOf: members\n };\n }\n }\n return {\n type,\n schema: out\n };\n}\nfunction isJsonSchemaNumberEncoding(schema) {\n if (!Array.isArray(schema.anyOf) || schema.anyOf.length !== 2 || schema.anyOf[0]?.type !== \"number\") return false;\n const special = schema.anyOf[1];\n return special?.type === \"string\" && Array.isArray(special.enum) && special.enum.length === 3 && special.enum.includes(\"NaN\") && special.enum.includes(\"Infinity\") && special.enum.includes(\"-Infinity\");\n}\n// Keep this allowlist closed: applicators and dependent keywords can change meaning when moved across schema objects.\nconst inlineableCheckKeywords = \"|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|\";\nfunction hasOnlyKeywords(schema, allowed) {\n return Object.keys(schema).every(key => allowed.includes(`|${key}|`));\n}\nfunction hasNoCollisions(left, rightKeys) {\n return typeof left.$ref !== \"string\" && rightKeys.every(key => !Object.hasOwn(left, key));\n}\n// `format` and `content*` can affect validation, so they are not treated as pure annotations.\nconst promotableAnnotationKeywords = \"|title|description|default|examples|readOnly|writeOnly|\";\nconst inlineableAnnotatedCheckKeywords = inlineableCheckKeywords + promotableAnnotationKeywords;\nfunction appendJsonSchema(left, right, inlineCheck) {\n if (Object.keys(left).length === 0) return right;\n const rightKeys = Object.keys(right);\n if (rightKeys.length === 0) return left;\n const leftType = left.type === \"number\" || left.type === \"integer\" ? left.type : undefined;\n const isNumberEncoding = isJsonSchemaNumberEncoding(left);\n if (leftType !== undefined || isNumberEncoding) {\n const extracted = extractJsonSchemaNumberType(right);\n if (extracted.type !== undefined) {\n const type = leftType === \"integer\" || extracted.type === \"integer\" ? \"integer\" : \"number\";\n const base = {\n ...left,\n type\n };\n if (isNumberEncoding) delete base.anyOf;\n const extractedKeys = Object.keys(extracted.schema);\n if (extractedKeys.length === 0) return base;\n return hasOnlyKeywords(extracted.schema, promotableAnnotationKeywords) && hasNoCollisions(base, extractedKeys) ? {\n ...base,\n ...extracted.schema\n } : appendJsonSchema(base, extracted.schema, inlineCheck);\n }\n }\n if (inlineCheck && hasNoCollisions(left, rightKeys)) {\n return {\n ...left,\n ...right\n };\n }\n const members = Array.isArray(right.allOf) && rightKeys.length === 1 ? right.allOf : [right];\n if (Array.isArray(left.allOf)) {\n return {\n ...left,\n allOf: [...left.allOf, ...members]\n };\n }\n if (typeof left.$ref === \"string\") {\n return {\n allOf: [left, ...members]\n };\n }\n return {\n ...left,\n allOf: members\n };\n}\nfunction compileJsonSchema(representations, rootPaths, references, options) {\n // null = compiling, string = canonical key, object = compiled schema\n const definitionStates = new Map();\n const compiledRepresentations = new WeakMap();\n const fallbackDefinitions = new Map();\n const referenceKeys = Object.keys(references);\n for (const key of referenceKeys) {\n compileDefinition(key, [\"references\", key]);\n }\n const schemas = Arr.map(representations, (representation, index) => finalizeJsonSchema(recur(representation, rootPaths[index])));\n const definitions = {};\n for (const key of referenceKeys) {\n const compiled = definitionStates.get(key);\n if (typeof compiled !== \"string\") {\n InternalRecord.assignProperty(definitions, key, finalizeJsonSchema(compiled));\n }\n }\n return {\n dialect: \"draft-2020-12\",\n schemas,\n definitions\n };\n function compileDefinition(key, path) {\n const compiled = definitionStates.get(key);\n if (compiled !== undefined) return typeof compiled === \"string\" ? compiled : key;\n if (!Object.hasOwn(references, key)) {\n throw errorWithPath(`Invalid reference ${key}`, [...path, \"$ref\"]);\n }\n definitionStates.set(key, null);\n const representation = references[key];\n const schema = recur(representation, [\"references\", key]);\n const fallback = getIdentifierFallback(representation);\n if (fallback !== undefined) {\n const candidates = fallbackDefinitions.get(fallback);\n const match = candidates?.find(candidate => Equal.equals(definitionStates.get(candidate), schema));\n if (match === undefined) {\n if (candidates === undefined) fallbackDefinitions.set(fallback, [key]);else candidates.push(key);\n } else {\n definitionStates.set(key, match);\n return match;\n }\n }\n definitionStates.set(key, schema);\n return key;\n }\n function finalizeJsonSchema(schema) {\n return rewriteRefs(schema, $ref => {\n const pointer = decodeUriFragment($ref);\n if (pointer === undefined) {\n if (/^#(?:\\/|%2f)/i.test($ref)) {\n throw new Error(`Invalid JSON Pointer URI fragment ${JSON.stringify($ref)}`);\n }\n return $ref;\n }\n if (!pointer.startsWith(\"/$defs/\")) return $ref;\n const separator = pointer.indexOf(\"/\", 7);\n const canonical = definitionStates.get(unescapeToken(pointer.slice(7, separator < 0 ? undefined : separator)));\n if (typeof canonical !== \"string\") return $ref;\n // URI-encoded slashes separate pointer tokens; only ~1 represents a slash within a token.\n return $ref.replace(/^#(?:\\/|%2f).*?(?:\\/|%2f).*?(?=\\/|%2f|$)/i, formatDefinitionReference(canonical));\n });\n }\n function getIdentifierFallback(representation) {\n if (representation._tag === \"Reference\") return undefined;\n const annotations = representation.checks.length === 0 ? representation.annotations : representation.checks[representation.checks.length - 1].annotations;\n return typeof annotations?.identifier !== \"string\" && typeof annotations?.[InternalAnnotations.IDENTIFIER_FALLBACK_KEY] === \"string\" ? annotations[InternalAnnotations.IDENTIFIER_FALLBACK_KEY] : undefined;\n }\n function annotationSchemas(representation, path) {\n return representation?.schemas?.map((schema, index) => recur(schema, [...path, \"schemas\", index])) ?? [];\n }\n function compileCheck(check, type, path) {\n const annotations = check.annotations;\n const callback = annotations?.toJsonSchema;\n if (callback !== undefined) {\n const schemas = annotationSchemas(check.representation, [...path, \"representation\"]);\n const fragment = callback({\n type,\n schemas\n });\n const ordinary = collectJsonSchemaAnnotations(annotations, options);\n const schema = ordinary === undefined ? fragment : {\n ...fragment,\n ...ordinary\n };\n const allowed = ordinary === undefined ? inlineableCheckKeywords : inlineableAnnotatedCheckKeywords;\n return check._tag === \"Filter\" && hasOnlyKeywords(schema, allowed) && (ordinary === undefined || hasOnlyKeywords(ordinary, promotableAnnotationKeywords)) ? [schema, true] : [schema];\n }\n if (check._tag === \"Filter\") return undefined;\n const children = check.checks.map((child, index) => compileCheck(child, type, [...path, \"checks\", index])).filter(child => child !== undefined);\n if (children.length === 0) return undefined;\n const ordinary = collectJsonSchemaAnnotations(annotations, options);\n const allOf = children.map(([schema]) => schema);\n return [ordinary === undefined ? {\n allOf\n } : {\n allOf,\n ...ordinary\n }];\n }\n function recur(representation, path) {\n if (representation._tag === \"Reference\") {\n const canonical = compileDefinition(representation.$ref, path);\n return {\n $ref: formatDefinitionReference(canonical)\n };\n }\n const cached = compiledRepresentations.get(representation);\n if (cached !== undefined) return cached;\n let output = on(representation, path);\n const ordinary = collectJsonSchemaAnnotations(representation.annotations, options);\n if (ordinary !== undefined) {\n output = {\n ...output,\n ...ordinary\n };\n }\n for (let index = 0; index < representation.checks.length; index++) {\n const type = typeof output.type === \"string\" && isJsonSchemaType(output.type) ? output.type : undefined;\n const check = compileCheck(representation.checks[index], type, [...path, \"checks\", index]);\n if (check !== undefined) {\n output = appendJsonSchema(output, ...check);\n }\n }\n compiledRepresentations.set(representation, output);\n return output;\n }\n function on(representation, path) {\n switch (representation._tag) {\n case \"Any\":\n case \"Unknown\":\n return {};\n case \"ObjectKeyword\":\n return {\n anyOf: [{\n type: \"object\"\n }, {\n type: \"array\"\n }]\n };\n case \"Void\":\n case \"Undefined\":\n case \"Null\":\n return {\n type: \"null\"\n };\n case \"BigInt\":\n return {\n type: \"string\",\n allOf: [{\n pattern: \"^-?\\\\d+$\"\n }]\n };\n case \"Symbol\":\n return {\n type: \"string\",\n allOf: [{\n pattern: \"^Symbol\\\\(([\\\\s\\\\S]*)\\\\)$\"\n }]\n };\n case \"UniqueSymbol\":\n return globalThis.Symbol.keyFor(representation.symbol) === undefined ? {\n not: {}\n } : {\n type: \"string\",\n enum: [globalThis.String(representation.symbol)]\n };\n case \"Declaration\":\n {\n return {};\n }\n case \"Suspend\":\n return recur(representation.thunk, [...path, \"thunk\"]);\n case \"Never\":\n return {\n not: {}\n };\n case \"String\":\n return {\n type: \"string\"\n };\n case \"Number\":\n return {\n anyOf: [{\n type: \"number\"\n }, {\n type: \"string\",\n enum: [\"NaN\", \"Infinity\", \"-Infinity\"]\n }]\n };\n case \"Boolean\":\n return {\n type: \"boolean\"\n };\n case \"Literal\":\n {\n const literal = representation.literal;\n return typeof literal === \"bigint\" ? {\n type: \"string\",\n enum: [globalThis.String(literal)]\n } : {\n type: typeof literal,\n enum: [literal]\n };\n }\n case \"Enum\":\n {\n const types = representation.enums.map(([title, literal], index) => {\n if (typeof literal === \"number\" && !globalThis.Number.isFinite(literal)) {\n throw errorWithPath(`Invalid numeric enum value ${globalThis.String(literal)}`, [...path, \"enums\", index, 1]);\n }\n return {\n type: typeof literal,\n enum: [literal],\n title\n };\n });\n return types.length === 0 ? {\n not: {}\n } : {\n anyOf: types\n };\n }\n case \"TemplateLiteral\":\n return {\n type: \"string\",\n pattern: `^${representation.parts.map(getPartPattern).join(\"\")}$`\n };\n case \"Arrays\":\n {\n if (representation.rest.length > 1) {\n throw errorWithPath(\"Invalid schema representation document\", [...path, \"rest\"]);\n }\n const out = {\n type: \"array\"\n };\n let minItems = representation.elements.length;\n const prefixItems = representation.elements.map((element, index) => {\n if (element.isOptional) minItems--;\n const compiled = recur(element.type, [...path, \"elements\", index, \"type\"]);\n const annotations = collectJsonSchemaAnnotations(element.annotations, options);\n return annotations === undefined ? compiled : appendJsonSchema(compiled, annotations);\n });\n if (prefixItems.length > 0) {\n out.prefixItems = prefixItems;\n out.maxItems = representation.elements.length;\n if (minItems > 0) out.minItems = minItems;\n } else {\n out.items = false;\n }\n if (representation.rest.length === 1) {\n delete out.maxItems;\n const rest = recur(representation.rest[0], [...path, \"rest\", 0]);\n if (Object.keys(rest).length > 0) out.items = rest;else delete out.items;\n }\n return out;\n }\n case \"Objects\":\n {\n if (representation.propertySignatures.length === 0 && representation.indexSignatures.length === 0) {\n return {\n not: {\n type: \"null\"\n }\n };\n }\n const out = {\n type: \"object\"\n };\n const properties = {};\n const required = [];\n for (let index = 0; index < representation.propertySignatures.length; index++) {\n const property = representation.propertySignatures[index];\n if (typeof property.name !== \"string\") {\n throw errorWithPath(\"Invalid schema representation document\", [...path, \"propertySignatures\", index, \"name\"]);\n }\n const name = property.name;\n const compiled = recur(property.type, [...path, \"propertySignatures\", index, \"type\"]);\n const annotations = collectJsonSchemaAnnotations(property.annotations, options);\n InternalRecord.assignProperty(properties, name, annotations === undefined ? compiled : appendJsonSchema(compiled, annotations));\n if (!property.isOptional) required.push(name);\n }\n if (representation.propertySignatures.length > 0) out.properties = properties;\n if (required.length > 0) out.required = required;\n const patternProperties = {};\n const additionalPropertySchemas = [];\n const indexValueSchemas = [];\n let hasUnrepresentableIndexPattern = false;\n for (let index = 0; index < representation.indexSignatures.length; index++) {\n const signature = representation.indexSignatures[index];\n let type = recur(signature.type, [...path, \"indexSignatures\", index, \"type\"]);\n if (Equal.equals(type, {\n not: {}\n })) type = false;\n indexValueSchemas.push(type);\n const patterns = getParameterPatterns(signature.parameter, [...path, \"indexSignatures\", index, \"parameter\"], new Set());\n if (patterns === undefined) {\n hasUnrepresentableIndexPattern = true;\n continue;\n }\n if (patterns.length === 0) {\n additionalPropertySchemas.push(type);\n } else {\n for (const pattern of patterns) {\n const previous = patternProperties[pattern];\n InternalRecord.assignProperty(patternProperties, pattern, previous === undefined ? type : previous === false || type === false ? false : appendJsonSchema(previous, type));\n }\n }\n }\n const hasPatternProperties = Object.keys(patternProperties).length > 0;\n if (hasPatternProperties) {\n out.patternProperties = patternProperties;\n }\n if (hasUnrepresentableIndexPattern && options?.onExcessProperty === \"error\") {\n const propertyNames = [];\n if (representation.propertySignatures.length > 0) {\n propertyNames.push({\n enum: Object.keys(properties)\n });\n }\n for (let index = 0; index < representation.indexSignatures.length; index++) {\n propertyNames.push(recur(representation.indexSignatures[index].parameter, [...path, \"indexSignatures\", index, \"parameter\"]));\n }\n out.propertyNames = propertyNames.length === 1 ? propertyNames[0] : {\n anyOf: propertyNames\n };\n out.additionalProperties = indexValueSchemas.length === 1 ? indexValueSchemas[0] : {\n anyOf: indexValueSchemas\n };\n if (additionalPropertySchemas.length > 0) {\n out.allOf = additionalPropertySchemas.map(type => ({\n type: \"object\",\n additionalProperties: type\n }));\n }\n } else if (additionalPropertySchemas.length === 0) {\n out.additionalProperties = hasUnrepresentableIndexPattern || options?.onExcessProperty !== \"error\";\n } else if (additionalPropertySchemas.length === 1 && representation.propertySignatures.length === 0 && !hasPatternProperties) {\n out.additionalProperties = additionalPropertySchemas[0];\n } else if (additionalPropertySchemas.length > 0) {\n out.allOf = additionalPropertySchemas.map(type => ({\n type: \"object\",\n additionalProperties: type\n }));\n }\n if (typeof out.additionalProperties === \"object\" && out.additionalProperties !== null && Object.keys(out.additionalProperties).length === 0) {\n delete out.additionalProperties;\n }\n return out;\n }\n case \"Union\":\n {\n const types = representation.types.map((type, index) => recur(type, [...path, \"types\", index]));\n if (types.length === 0) return {\n not: {}\n };\n const mode = representation.options?.mode ?? \"anyOf\";\n if (mode === \"anyOf\" && types.length > 1) {\n const compacted = compactEnums(types);\n if (compacted !== undefined) return compacted;\n }\n return mode === \"anyOf\" ? {\n anyOf: types\n } : {\n oneOf: types\n };\n }\n }\n }\n function getParameterPatterns(parameter, path, seenReferences) {\n switch (parameter._tag) {\n case \"Reference\":\n {\n if (!Object.hasOwn(references, parameter.$ref)) {\n throw errorWithPath(`Invalid reference ${parameter.$ref}`, [...path, \"$ref\"]);\n }\n compileDefinition(parameter.$ref, path);\n if (seenReferences.has(parameter.$ref)) return undefined;\n const next = new Set(seenReferences).add(parameter.$ref);\n return getParameterPatterns(references[parameter.$ref], [\"references\", parameter.$ref], next);\n }\n case \"String\":\n {\n if (parameter.checks.length === 0) return [];\n if (parameter.checks.length !== 1 || parameter.checks[0]._tag !== \"Filter\" || parameter.checks[0].annotations?.toJsonSchema === undefined) {\n return undefined;\n }\n const schema = recur(parameter, path);\n return schema.type === \"string\" && typeof schema.pattern === \"string\" && hasOnlyKeywords(schema, \"|type|pattern|title|description|default|examples|readOnly|writeOnly|\") ? [schema.pattern] : undefined;\n }\n case \"TemplateLiteral\":\n return parameter.checks.length === 0 ? [`^${parameter.parts.map(getPartPattern).join(\"\")}$`] : undefined;\n case \"Union\":\n {\n if (parameter.types.length === 0 || parameter.checks.length > 0 || parameter.options?.mode === \"oneOf\") {\n return undefined;\n }\n const patterns = [];\n for (let index = 0; index < parameter.types.length; index++) {\n const memberPatterns = getParameterPatterns(parameter.types[index], [...path, \"types\", index], seenReferences);\n if (memberPatterns === undefined) return undefined;\n if (memberPatterns.length === 0) return [];\n patterns.push(...memberPatterns);\n }\n return patterns;\n }\n default:\n throw errorWithPath(\"Invalid schema representation document\", path);\n }\n }\n}\nfunction isJsonSchemaType(input) {\n return input === \"string\" || input === \"number\" || input === \"boolean\" || input === \"array\" || input === \"object\" || input === \"null\" || input === \"integer\";\n}\nfunction compactEnums(schemas) {\n let sharedType = undefined;\n const values = [];\n for (const schema of schemas) {\n const keys = Object.keys(schema);\n if (keys.length !== 2 || schema.type === undefined || !Array.isArray(schema.enum) || schema.enum.length === 0) {\n return undefined;\n }\n if (sharedType === undefined) sharedType = schema.type;else if (schema.type !== sharedType) return undefined;\n for (const value of schema.enum) {\n if (values.includes(value)) return undefined;\n values.push(value);\n }\n }\n return {\n type: sharedType,\n enum: values\n };\n}\nfunction getPartPattern(part) {\n switch (part._tag) {\n case \"Literal\":\n return RegEx.escape(globalThis.String(part.literal));\n case \"String\":\n return InternalAST.STRING_PATTERN;\n case \"Number\":\n return InternalAST.FINITE_PATTERN;\n case \"TemplateLiteral\":\n return part.parts.map(getPartPattern).join(\"\");\n case \"Union\":\n return `(?:${part.types.map(getPartPattern).join(\"|\")})`;\n default:\n throw errorWithPath(\"Invalid schema representation document\", []);\n }\n}\n/** @internal */\nexport function toJsonSchemaDocument(document, options) {\n const output = compileJsonSchema([document.representation], [[\"representation\"]], document.references, options);\n return {\n dialect: output.dialect,\n schema: output.schemas[0],\n definitions: output.definitions\n };\n}\n/** @internal */\nexport function toJsonSchemaMultiDocument(document, options) {\n return compileJsonSchema(document.representations, document.representations.map((_, index) => [\"representations\", index]), document.references, options);\n}\n//# sourceMappingURL=toJsonSchemaDocument.js.map","import * as Arr from \"../../Array.js\";\nimport * as SchemaAST from \"../../SchemaAST.js\";\nimport * as InternalRecord from \"../record.js\";\nimport * as InternalAnnotations from \"./annotations.js\";\nconst defaultReferencePolicy = ({\n identifier\n}) => identifier;\nfunction annotationsField(annotations) {\n return annotations === undefined ? undefined : {\n annotations\n };\n}\n/** @internal */\nexport function toRepresentation(ast, options) {\n const {\n references,\n representations\n } = toRepresentations([ast], options);\n return {\n representation: representations[0],\n references\n };\n}\n/** @internal */\nexport function toRepresentations(asts, options) {\n const references = {};\n const referenceOwners = new Map();\n const buildingReferences = new Set();\n const candidates = new Map();\n const visitingCandidates = new Set();\n for (const ast of asts) visit(ast);\n const referencePolicy = options?.referencePolicy ?? defaultReferencePolicy;\n for (const candidatesByIdentifier of candidates.values()) {\n for (const candidate of candidatesByIdentifier.values()) {\n const requestedReference = referencePolicy({\n ast: candidate.ast,\n occurrences: candidate.occurrences,\n identifier: candidate.identifier\n });\n if (requestedReference !== undefined) {\n const separator = requestedReference === candidate.identifier || !requestedReference.endsWith(\"_\") ? \"_\" : \"\";\n candidate.reference = getReference(requestedReference, candidate, separator);\n } else if (candidate.isRecursive) {\n candidate.reference = getReference(`${candidate.ast._tag}_`, candidate, \"\");\n }\n }\n }\n const representations = Arr.map(asts, ast => recur(ast));\n return {\n representations,\n references\n };\n function getReference(prefix, owner, separator = \"_\") {\n let candidate = prefix;\n let suffix = 0;\n while (referenceOwners.has(candidate)) {\n if (referenceOwners.get(candidate) === owner) return candidate;\n candidate = `${prefix}${separator}${++suffix}`;\n }\n referenceOwners.set(candidate, owner);\n return candidate;\n }\n function annotateReference(ast, candidate, reference) {\n const fallback = candidate.fallback;\n if (fallback !== undefined) {\n return InternalAnnotations.resolveIdentifierFallback(ast) === fallback ? ast : SchemaAST.annotate(ast, {\n [InternalAnnotations.IDENTIFIER_FALLBACK_KEY]: fallback\n });\n }\n return reference === candidate.identifier ? ast : SchemaAST.annotate(ast, {\n identifier: reference\n });\n }\n function makeReference(reference, ast) {\n if (!Object.hasOwn(references, reference) && !buildingReferences.has(reference)) {\n buildingReferences.add(reference);\n const representation = on(ast);\n buildingReferences.delete(reference);\n InternalRecord.assignProperty(references, reference, representation);\n }\n return {\n _tag: \"Reference\",\n $ref: reference\n };\n }\n function getCandidate(input) {\n const ast = SchemaAST.getLastEncoding(input);\n const owner = SchemaAST.getContextOwner(ast);\n let identifier = InternalAnnotations.resolveIdentifier(ast);\n const fallback = identifier === undefined ? (ast !== input ? InternalAnnotations.resolveIdentifier(input) : undefined) ?? InternalAnnotations.resolveIdentifierFallback(ast) : undefined;\n if (fallback !== undefined) identifier = `${fallback}Encoded`;\n let candidatesByIdentifier = candidates.get(owner);\n if (candidatesByIdentifier === undefined) {\n candidatesByIdentifier = new Map();\n candidates.set(owner, candidatesByIdentifier);\n }\n let candidate = candidatesByIdentifier.get(identifier);\n if (candidate === undefined) {\n candidate = {\n ast: owner,\n identifier,\n fallback,\n occurrences: 0,\n isRecursive: false,\n reference: undefined\n };\n candidatesByIdentifier.set(identifier, candidate);\n }\n return candidate;\n }\n function visit(input) {\n const candidate = getCandidate(input);\n const ast = candidate.ast;\n candidate.occurrences++;\n if (visitingCandidates.has(candidate)) {\n candidate.isRecursive = true;\n return;\n }\n if (candidate.occurrences > 1) return;\n visitingCandidates.add(candidate);\n visitChecks(ast.checks);\n switch (ast._tag) {\n case \"Declaration\":\n case \"Arrays\":\n case \"Objects\":\n case \"Union\":\n ast.recur(child => {\n visit(child);\n return child;\n });\n break;\n case \"TemplateLiteral\":\n ast.parts.forEach(visit);\n break;\n case \"Suspend\":\n visit(ast.thunk());\n break;\n }\n visitingCandidates.delete(candidate);\n }\n function visitChecks(checks) {\n checks?.forEach(check => {\n check.annotations?.representation?.schemas?.forEach(schema => visit(SchemaAST.toType(schema)));\n if (check._tag === \"FilterGroup\") visitChecks(check.checks);\n });\n }\n function recur(input) {\n const candidate = getCandidate(input);\n const ast = candidate.ast;\n const reference = candidate.reference;\n if (reference !== undefined) {\n const annotated = candidate.identifier === undefined ? ast : annotateReference(ast, candidate, reference);\n return makeReference(reference, annotated);\n }\n return on(ast);\n }\n function on(ast) {\n const checks = fromChecks(ast.checks);\n switch (ast._tag) {\n case \"Declaration\":\n return {\n _tag: \"Declaration\",\n typeParameters: ast.typeParameters.map(ast => recur(ast)),\n checks,\n ...fromDeclarationAnnotations(ast.annotations)\n };\n case \"Null\":\n case \"Undefined\":\n case \"Void\":\n case \"Never\":\n case \"Unknown\":\n case \"Any\":\n case \"String\":\n case \"Boolean\":\n case \"Number\":\n case \"BigInt\":\n case \"Symbol\":\n case \"ObjectKeyword\":\n return {\n _tag: ast._tag,\n checks,\n ...annotationsField(ast.annotations)\n };\n case \"Literal\":\n return {\n _tag: \"Literal\",\n literal: ast.literal,\n checks,\n ...annotationsField(ast.annotations)\n };\n case \"UniqueSymbol\":\n return {\n _tag: \"UniqueSymbol\",\n symbol: ast.symbol,\n checks,\n ...annotationsField(ast.annotations)\n };\n case \"Enum\":\n return {\n _tag: \"Enum\",\n enums: ast.enums,\n checks,\n ...annotationsField(ast.annotations)\n };\n case \"TemplateLiteral\":\n return {\n _tag: \"TemplateLiteral\",\n parts: ast.parts.map(ast => recur(ast)),\n checks,\n ...annotationsField(ast.annotations)\n };\n case \"Arrays\":\n return {\n _tag: \"Arrays\",\n elements: ast.elements.map(element => {\n const projected = SchemaAST.getLastEncoding(element);\n const annotations = projected.context?.annotations;\n return {\n isOptional: SchemaAST.isOptional(projected),\n type: recur(element),\n ...annotationsField(annotations)\n };\n }),\n rest: ast.rest.map(ast => recur(ast)),\n checks,\n ...annotationsField(ast.annotations)\n };\n case \"Objects\":\n return {\n _tag: \"Objects\",\n propertySignatures: ast.propertySignatures.map(property => {\n const projected = SchemaAST.getLastEncoding(property.type);\n const annotations = projected.context?.annotations;\n return {\n name: property.name,\n type: recur(property.type),\n isOptional: SchemaAST.isOptional(projected),\n isMutable: SchemaAST.isMutable(projected),\n ...annotationsField(annotations)\n };\n }),\n indexSignatures: ast.indexSignatures.map(index => ({\n parameter: recur(index.parameter),\n type: recur(index.type)\n })),\n checks,\n ...annotationsField(ast.annotations)\n };\n case \"Union\":\n return {\n _tag: \"Union\",\n types: ast.types.map(ast => recur(ast)),\n ...(ast.options === undefined ? {} : {\n options: ast.options\n }),\n checks,\n ...annotationsField(ast.annotations)\n };\n case \"Suspend\":\n return {\n _tag: \"Suspend\",\n checks: [],\n thunk: recur(ast.thunk()),\n ...annotationsField(ast.annotations)\n };\n }\n }\n function fromChecks(checks) {\n return checks?.map(fromCheck) ?? [];\n }\n function fromCheck(check) {\n switch (check._tag) {\n case \"Filter\":\n return {\n _tag: \"Filter\",\n aborted: check.aborted,\n ...fromCheckAnnotations(check.annotations)\n };\n case \"FilterGroup\":\n return {\n _tag: \"FilterGroup\",\n checks: Arr.map(check.checks, fromCheck),\n ...fromCheckAnnotations(check.annotations)\n };\n }\n }\n function fromDeclarationAnnotations(annotations) {\n if (annotations === undefined) return undefined;\n const {\n representation,\n ...ordinary\n } = annotations;\n return {\n ...(representation === undefined ? undefined : {\n representation\n }),\n ...(Object.keys(ordinary).length === 0 ? undefined : {\n annotations: ordinary\n })\n };\n }\n function fromCheckAnnotations(annotations) {\n if (annotations === undefined) return undefined;\n const {\n representation,\n ...ordinary\n } = annotations;\n const projected = representation === undefined ? undefined : representation.schemas === undefined ? representation : {\n ...representation,\n schemas: representation.schemas.map(schema => recur(SchemaAST.toType(schema)))\n };\n return {\n ...(projected === undefined ? undefined : {\n representation: projected\n }),\n ...(Object.keys(ordinary).length === 0 ? undefined : {\n annotations: ordinary\n })\n };\n }\n}\n//# sourceMappingURL=toRepresentation.js.map","/**\n * Works with plain TypeScript objects, also called structs.\n *\n * The runtime helpers in this module create new objects instead of mutating\n * their inputs. They cover common object workflows such as reading properties,\n * listing typed keys, picking or omitting fields, assigning and renaming keys,\n * transforming values, deriving comparison helpers, and creating records from a\n * list of keys. The module also includes type-level helpers for simplifying and\n * merging object shapes.\n *\n * @since 2.0.0\n */\nimport * as Combiner from \"./Combiner.js\";\nimport * as Equivalence from \"./Equivalence.js\";\nimport { dual } from \"./Function.js\";\nimport * as InternalRecord from \"./internal/record.js\";\nimport * as order from \"./Order.js\";\nimport * as Reducer from \"./Reducer.js\";\n/**\n * Retrieves the value at `key` from a struct.\n *\n * **When to use**\n *\n * Use to extract a single property from a struct in a pipeline.\n *\n * **Details**\n *\n * The return type is narrowed to `S[K]`.\n *\n * **Example** (Extracting a property in a pipeline)\n *\n * ```ts import.meta.vitest\n * import { pipe, Struct } from \"effect\"\n *\n * pipe({ name: \"Alice\", age: 30 }, Struct.get(\"name\")) // => \"Alice\"\n * ```\n *\n * @see {@link keys} – list all string keys of a struct\n * @see {@link pick} – extract multiple properties into a new struct\n * @category getters\n * @since 2.0.0\n */\nexport const get = /*#__PURE__*/dual(2, (self, key) => self[key]);\n/**\n * Returns the string keys of a struct as a properly typed `Array<keyof S & string>`.\n *\n * **When to use**\n *\n * Use when you want a typed replacement for `Object.keys` that narrows the result\n * to the known string keys of the struct.\n *\n * **Gotchas**\n *\n * Symbol keys are excluded; only string keys are returned.\n *\n * **Example** (Reading typed keys)\n *\n * ```ts import.meta.vitest\n * import { Struct } from \"effect\"\n *\n * const user = { name: \"Alice\", age: 30, [Symbol.for(\"id\")]: 1 }\n *\n * const k: Array<\"name\" | \"age\"> = Struct.keys(user)\n * k // => [\"name\", \"age\"]\n * ```\n *\n * @see {@link get} – access a single key's value\n * @see {@link pick} – select a subset of keys into a new struct\n * @category getters\n * @since 3.6.0\n */\nexport const keys = self => Object.keys(self);\n/**\n * Creates a new struct containing only the specified keys.\n *\n * **When to use**\n *\n * Use to narrow a struct down to a subset of its properties.\n *\n * **Gotchas**\n *\n * Keys not present in the struct are silently ignored.\n *\n * **Example** (Selecting specific properties)\n *\n * ```ts import.meta.vitest\n * import { pipe, Struct } from \"effect\"\n *\n * const user = { name: \"Alice\", age: 30, admin: true }\n * pipe(user, Struct.pick([\"name\", \"age\"])) // => { name: \"Alice\", age: 30 }\n * ```\n *\n * @see {@link omit} – the inverse (exclude keys instead)\n * @see {@link get} – extract a single value\n * @category filtering\n * @since 2.0.0\n */\nexport const pick = /*#__PURE__*/dual(2, (self, keys) => {\n return buildStruct(self, (k, v) => hasPropertyKey(keys, k) ? [k, v] : undefined);\n});\n/**\n * Creates a new struct with the specified keys removed.\n *\n * **When to use**\n *\n * Use to exclude sensitive or irrelevant fields from a struct.\n *\n * **Gotchas**\n *\n * Keys not present in the struct are silently ignored.\n *\n * **Example** (Removing a property)\n *\n * ```ts import.meta.vitest\n * import { pipe, Struct } from \"effect\"\n *\n * const user = { name: \"Alice\", age: 30, password: \"secret\" }\n * pipe(user, Struct.omit([\"password\"])) // => { name: \"Alice\", age: 30 }\n * ```\n *\n * @see {@link pick} – the inverse (keep only specified keys)\n * @category filtering\n * @since 2.0.0\n */\nexport const omit = /*#__PURE__*/dual(2, (self, keys) => {\n return buildStruct(self, (k, v) => !hasPropertyKey(keys, k) ? [k, v] : undefined);\n});\n/**\n * Merges two structs into a new struct. When both structs share a key, the\n * value from `that` (the second struct) wins.\n *\n * **When to use**\n *\n * Use when you want `{ ...self, ...that }` with proper types.\n *\n * **Details**\n *\n * The result type is `Simplify<Assign<S, O>>`.\n *\n * **Example** (Merging structs with overlapping keys)\n *\n * ```ts import.meta.vitest\n * import { pipe, Struct } from \"effect\"\n *\n * const defaults = { theme: \"light\", lang: \"en\" }\n * const overrides = { theme: \"dark\", fontSize: 14 }\n * pipe(defaults, Struct.assign(overrides)) // => { theme: \"dark\", lang: \"en\", fontSize: 14 }\n * ```\n *\n * @see {@link Assign} – the type-level equivalent\n * @see {@link evolve} – transform individual values instead of replacing them\n * @category combining\n * @since 4.0.0\n */\nexport const assign = /*#__PURE__*/dual(2, (self, that) => {\n return {\n ...self,\n ...that\n };\n});\n/**\n * Transforms values of a struct selectively using per-key functions. Keys\n * without a corresponding function are copied unchanged.\n *\n * **When to use**\n *\n * Use when you want to update specific fields while keeping the rest intact.\n *\n * **Details**\n *\n * Each transform function receives the current value and returns the new value;\n * the return type can differ from the input type.\n *\n * **Example** (Transforming selected values)\n *\n * ```ts import.meta.vitest\n * import { pipe, Struct } from \"effect\"\n *\n * const result = pipe(\n * { name: \"alice\", age: 30, active: true },\n * Struct.evolve({\n * name: (s) => s.toUpperCase(),\n * age: (n) => n + 1\n * })\n * )\n * result // => { name: \"ALICE\", age: 31, active: true }\n * ```\n *\n * @see {@link evolveKeys} – transform keys instead of values\n * @see {@link evolveEntries} – transform both keys and values\n * @see {@link map} – apply the same transformation to all values\n * @category transforming\n * @since 2.0.0\n */\nexport const evolve = /*#__PURE__*/dual(2, (self, e) => {\n return buildStruct(self, (k, v) => [k, Object.hasOwn(e, k) ? e[k](v) : v]);\n});\n/**\n * Transforms keys of a struct selectively using per-key functions. Keys without\n * a corresponding function are copied unchanged.\n *\n * **When to use**\n *\n * Use when you need computed key names, such as uppercasing or prefixing.\n *\n * **Details**\n *\n * Each transform function receives the key name and must return a new\n * `PropertyKey`.\n *\n * **Example** (Renaming keys with functions)\n *\n * ```ts import.meta.vitest\n * import { pipe, Struct } from \"effect\"\n *\n * const result = pipe(\n * { name: \"Alice\", age: 30 },\n * Struct.evolveKeys({\n * name: (k) => k.toUpperCase()\n * })\n * )\n * result // => { NAME: \"Alice\", age: 30 }\n * ```\n *\n * @see {@link renameKeys} – rename keys with a static mapping\n * @see {@link evolve} – transform values instead of keys\n * @see {@link evolveEntries} – transform both keys and values\n * @category transforming\n * @since 4.0.0\n */\nexport const evolveKeys = /*#__PURE__*/dual(2, (self, e) => {\n return buildStruct(self, (k, v) => [Object.hasOwn(e, k) ? e[k](k) : k, v]);\n});\n/**\n * Transforms both keys and values of a struct selectively. Each per-key\n * function receives `(key, value)` and must return a `[newKey, newValue]`\n * tuple. Keys without a corresponding function are copied unchanged.\n *\n * **When to use**\n *\n * Use when you need to rename a key and change its value in one step.\n *\n * **Details**\n *\n * The return type is fully tracked at the type level.\n *\n * **Example** (Transforming keys and values together)\n *\n * ```ts import.meta.vitest\n * import { pipe, Struct } from \"effect\"\n *\n * const result = pipe(\n * { amount: 100, label: \"total\" },\n * Struct.evolveEntries({\n * amount: (k, v) => [`${k}Cents`, v * 100],\n * label: (k, v) => [k, v.toUpperCase()]\n * })\n * )\n * result // => { amountCents: 10000, label: \"TOTAL\" }\n * ```\n *\n * @see {@link evolve} – transform values only\n * @see {@link evolveKeys} – transform keys only\n * @category transforming\n * @since 4.0.0\n */\nexport const evolveEntries = /*#__PURE__*/dual(2, (self, e) => {\n return buildStruct(self, (k, v) => Object.hasOwn(e, k) ? e[k](k, v) : [k, v]);\n});\n/**\n * Renames keys in a struct using a static `{ oldKey: newKey }` mapping. Keys\n * not mentioned in the mapping are copied unchanged.\n *\n * **When to use**\n *\n * Use when you need simple, declarative key renaming without custom logic.\n *\n * **Details**\n *\n * For computed key names, use {@link evolveKeys} instead.\n *\n * **Example** (Renaming keys)\n *\n * ```ts import.meta.vitest\n * import { pipe, Struct } from \"effect\"\n *\n * const result = pipe(\n * { firstName: \"Alice\", lastName: \"Smith\", age: 30 },\n * Struct.renameKeys({ firstName: \"first\", lastName: \"last\" })\n * )\n * result // => { first: \"Alice\", last: \"Smith\", age: 30 }\n * ```\n *\n * @see {@link evolveKeys} – rename keys using functions\n * @see {@link evolveEntries} – rename keys and transform values\n * @category transforming\n * @since 4.0.0\n */\nexport const renameKeys = /*#__PURE__*/dual(2, (self, mapping) => {\n return buildStruct(self, (k, v) => [Object.hasOwn(mapping, k) ? mapping[k] : k, v]);\n});\n/**\n * Creates an `Equivalence` for a struct by providing an `Equivalence` for each\n * property. Two structs are equivalent when all their corresponding properties\n * are equivalent.\n *\n * **When to use**\n *\n * Use when you need equality for a record-like object to be decided field by\n * field, with a custom equality rule for each property.\n *\n * **Details**\n *\n * This is an alias of `Equivalence.Struct`. Each property's equivalence is\n * checked independently; all must return `true` for the overall result to be\n * `true`.\n *\n * **Example** (Comparing structs for equivalence)\n *\n * ```ts import.meta.vitest\n * import { Equivalence, Struct } from \"effect\"\n *\n * const PersonEquivalence = Struct.makeEquivalence({\n * name: Equivalence.strictEqual<string>(),\n * age: Equivalence.strictEqual<number>()\n * })\n *\n * PersonEquivalence({ name: \"Alice\", age: 30 }, { name: \"Alice\", age: 30 }) // => true\n * PersonEquivalence({ name: \"Alice\", age: 30 }, { name: \"Bob\", age: 30 }) // => false\n * ```\n *\n * @see {@link makeOrder} – create an `Order` for structs\n * @category instances\n * @since 4.0.0\n */\nexport const makeEquivalence = Equivalence.Struct;\n/**\n * Creates an `Order` for a struct by providing an `Order` for each property.\n * Properties are compared in the order they appear in the fields object; the\n * first non-zero comparison determines the result.\n *\n * **When to use**\n *\n * Use when you need to sort record-like objects lexicographically by several\n * fields, with each field using its own ordering rule.\n *\n * **Details**\n *\n * This is an alias of `Order.Struct`. The order of keys in the `fields` object\n * determines comparison priority.\n *\n * **Example** (Ordering structs by name then age)\n *\n * ```ts import.meta.vitest\n * import { Number, String, Struct } from \"effect\"\n *\n * const PersonOrder = Struct.makeOrder({\n * name: String.Order,\n * age: Number.Order\n * })\n *\n * PersonOrder({ name: \"Alice\", age: 30 }, { name: \"Bob\", age: 25 }) // => -1\n * ```\n *\n * @see {@link makeEquivalence} – create an `Equivalence` for structs\n * @category ordering\n * @since 4.0.0\n */\nexport const makeOrder = order.Struct;\n/**\n * Wraps a plain function as a {@link Lambda} value so it can be used with\n * {@link map}, {@link mapPick}, and {@link mapOmit}.\n *\n * **When to use**\n *\n * Use to create a typed lambda for struct mapping APIs that need type-level\n * input and output tracking.\n *\n * **Details**\n *\n * The type parameter `L` encodes both the input and output types at the type\n * level, allowing the compiler to track how struct value types change. At\n * runtime, the returned value is the same function; `lambda` only adjusts the\n * type.\n *\n * **Example** (Wrapping values in arrays)\n *\n * ```ts import.meta.vitest\n * import { pipe, Struct } from \"effect\"\n *\n * interface AsArray extends Struct.Lambda {\n * <A>(self: A): Array<A>\n * readonly \"~lambda.out\": Array<this[\"~lambda.in\"]>\n * }\n *\n * const asArray = Struct.lambda<AsArray>((a) => [a])\n * const result = pipe({ x: 1, y: \"hello\" }, Struct.map(asArray))\n * result // => { x: [1], y: [\"hello\"] }\n * ```\n *\n * @see {@link Lambda} – the type-level interface\n * @see {@link map} – apply a lambda to all struct values\n * @category constructors\n * @since 4.0.0\n */\nexport const lambda = f => f;\n/**\n * Applies a {@link Lambda} transformation to every value in a struct.\n *\n * **When to use**\n *\n * Use when you want to apply the same function to every value in a struct.\n *\n * **Details**\n *\n * The lambda must be created with {@link lambda} so the compiler can track the\n * output types.\n *\n * **Example** (Wrapping every value in an array)\n *\n * ```ts import.meta.vitest\n * import { pipe, Struct } from \"effect\"\n *\n * interface AsArray extends Struct.Lambda {\n * <A>(self: A): Array<A>\n * readonly \"~lambda.out\": Array<this[\"~lambda.in\"]>\n * }\n *\n * const asArray = Struct.lambda<AsArray>((a) => [a])\n * const result = pipe({ width: 10, height: 20 }, Struct.map(asArray))\n * result // => { width: [10], height: [20] }\n * ```\n *\n * @see {@link mapPick} – apply a lambda only to selected keys\n * @see {@link mapOmit} – apply a lambda to all keys except selected ones\n * @see {@link evolve} – apply different functions to different keys\n * @category mapping\n * @since 4.0.0\n */\nexport const map = /*#__PURE__*/dual(2, (self, lambda) => {\n return buildStruct(self, (k, v) => [k, lambda(v)]);\n});\n/**\n * Applies a {@link Lambda} transformation only to the specified keys; all\n * other keys are copied unchanged.\n *\n * **When to use**\n *\n * Use when you want to apply the same transformation to a subset of properties.\n *\n * **Example** (Wrapping only selected values in arrays)\n *\n * ```ts import.meta.vitest\n * import { pipe, Struct } from \"effect\"\n *\n * interface AsArray extends Struct.Lambda {\n * <A>(self: A): Array<A>\n * readonly \"~lambda.out\": Array<this[\"~lambda.in\"]>\n * }\n *\n * const asArray = Struct.lambda<AsArray>((a) => [a])\n * const result = pipe(\n * { x: 1, y: 2, z: 3 },\n * Struct.mapPick([\"x\", \"z\"], asArray)\n * )\n * result // => { x: [1], y: 2, z: [3] }\n * ```\n *\n * @see {@link map} – apply a lambda to all keys\n * @see {@link mapOmit} – apply a lambda to all keys except selected ones\n * @category mapping\n * @since 4.0.0\n */\nexport const mapPick = /*#__PURE__*/dual(3, (self, keys, lambda) => {\n return buildStruct(self, (k, v) => [k, hasPropertyKey(keys, k) ? lambda(v) : v]);\n});\n/**\n * Applies a {@link Lambda} transformation to all keys except the specified\n * ones; the excluded keys are copied unchanged.\n *\n * **When to use**\n *\n * Use when most keys should be transformed but a few should be preserved.\n *\n * **Example** (Wrapping all values except one in arrays)\n *\n * ```ts import.meta.vitest\n * import { pipe, Struct } from \"effect\"\n *\n * interface AsArray extends Struct.Lambda {\n * <A>(self: A): Array<A>\n * readonly \"~lambda.out\": Array<this[\"~lambda.in\"]>\n * }\n *\n * const asArray = Struct.lambda<AsArray>((a) => [a])\n * const result = pipe(\n * { x: 1, y: 2, z: 3 },\n * Struct.mapOmit([\"y\"], asArray)\n * )\n * result // => { x: [1], y: 2, z: [3] }\n * ```\n *\n * @see {@link map} – apply a lambda to all keys\n * @see {@link mapPick} – apply a lambda only to selected keys\n * @category mapping\n * @since 4.0.0\n */\nexport const mapOmit = /*#__PURE__*/dual(3, (self, keys, lambda) => {\n return buildStruct(self, (k, v) => [k, !hasPropertyKey(keys, k) ? lambda(v) : v]);\n});\nfunction hasPropertyKey(keys, key) {\n return keys.some(candidate => candidate === key || typeof candidate === \"number\" && String(candidate) === key);\n}\n/**\n * Walk `source`; for each key decide what to emit via the small callback.\n *\n * The callback returns either\n * • `undefined` → nothing is copied, or\n * • `[newKey, newVal]`\n *\n * so every public API just supplies a different callback.\n */\nfunction buildStruct(source, f) {\n const out = {};\n for (const k of Reflect.ownKeys(source)) {\n if (!Object.prototype.propertyIsEnumerable.call(source, k)) continue;\n const res = f(k, source[k]);\n if (res) {\n const [nk, nv] = res;\n InternalRecord.assignProperty(out, nk, nv);\n }\n }\n return out;\n}\n/**\n * Creates a `Combiner` for a struct shape by providing a `Combiner` for each\n * property. When two structs are combined, each property is merged using its\n * corresponding combiner.\n *\n * **When to use**\n *\n * Use when you need to merge two same-shape records by combining each property\n * independently, such as summing counters or concatenating strings.\n *\n * **Details**\n *\n * Pass `omitKeyWhen` to drop properties whose merged value matches a predicate,\n * such as omitting zero counters.\n *\n * **Example** (Combining struct properties)\n *\n * ```ts import.meta.vitest\n * import { Number, String, Struct } from \"effect\"\n *\n * const C = Struct.makeCombiner<{ readonly n: number; readonly s: string }>({\n * n: Number.ReducerSum,\n * s: String.ReducerConcat\n * })\n *\n * C.combine({ n: 1, s: \"hello\" }, { n: 2, s: \" world\" }) // => { n: 3, s: \"hello world\" }\n * ```\n *\n * @see {@link makeReducer} – like `makeCombiner` but with an initial value\n * @category combining\n * @since 4.0.0\n */\nexport function makeCombiner(combiners, options) {\n const omitKeyWhen = options?.omitKeyWhen ?? (() => false);\n return Combiner.make((self, that) => {\n const keys = Reflect.ownKeys(combiners);\n const out = {};\n for (const key of keys) {\n const merge = combiners[key].combine(self[key], that[key]);\n if (omitKeyWhen(merge)) continue;\n InternalRecord.assignProperty(out, key, merge);\n }\n return out;\n });\n}\n/**\n * Creates a `Reducer` for a struct shape by providing a `Reducer` for each\n * property. The initial value is derived from each property's\n * `Reducer.initialValue`. When reducing a collection of structs, each property\n * is combined independently.\n *\n * **When to use**\n *\n * Use when you need to fold same-shape records by accumulating each property\n * independently into one summary record.\n *\n * **Details**\n *\n * Pass `omitKeyWhen` to drop properties whose reduced value matches a\n * predicate.\n *\n * **Example** (Reducing a collection of structs)\n *\n * ```ts import.meta.vitest\n * import { Number, String, Struct } from \"effect\"\n *\n * const R = Struct.makeReducer<{ readonly n: number; readonly s: string }>({\n * n: Number.ReducerSum,\n * s: String.ReducerConcat\n * })\n *\n * const result = R.combineAll([\n * { n: 1, s: \"a\" },\n * { n: 2, s: \"b\" },\n * { n: 3, s: \"c\" }\n * ])\n * result // => { n: 6, s: \"abc\" }\n * ```\n *\n * @see {@link makeCombiner} – like `makeReducer` but without an initial value\n * @category folding\n * @since 4.0.0\n */\nexport function makeReducer(reducers, options) {\n const combine = makeCombiner(reducers, options).combine;\n const initialValue = {};\n for (const key of Reflect.ownKeys(reducers)) {\n const iv = reducers[key].initialValue;\n if (options?.omitKeyWhen?.(iv)) continue;\n InternalRecord.assignProperty(initialValue, key, iv);\n }\n return Reducer.make(combine, initialValue);\n}\n/**\n * Creates a record with the given keys and value.\n *\n * **When to use**\n *\n * Use to build an object where each provided key receives the same value.\n *\n * **Example** (Creating a record)\n *\n * ```ts import.meta.vitest\n * import { Struct } from \"effect\"\n *\n * Struct.Record([\"a\", \"b\"], \"value\") // => { a: \"value\", b: \"value\" }\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function Record(keys, value) {\n const out = {};\n for (const key of keys) {\n InternalRecord.assignProperty(out, key, value);\n }\n return out;\n}\n//# sourceMappingURL=Struct.js.map","import * as Predicate from \"../Predicate.js\";\nexport const SchemaErrorTypeId = \"~effect/Schema/SchemaError\";\nexport function isSchemaError(u) {\n return Predicate.hasProperty(u, SchemaErrorTypeId) && u[SchemaErrorTypeId] === SchemaErrorTypeId;\n}\n//# sourceMappingURL=schemaError.js.map","/**\n * Models HTTP cookies and cookie collections for requests and responses.\n *\n * A `Cookie` stores a name, value, encoded value, and standard cookie\n * attributes. A `Cookies` value is an immutable collection keyed by cookie\n * name. This module parses request `Cookie` headers, builds response\n * `Set-Cookie` headers, and provides helpers for adding, removing, merging, and\n * expiring cookies.\n *\n * @since 4.0.0\n */\nimport * as Data from \"../../Data.js\";\nimport * as Duration from \"../../Duration.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as InternalRecord from \"../../internal/record.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Record from \"../../Record.js\";\nimport * as Result from \"../../Result.js\";\nconst TypeId = \"~effect/http/Cookies\";\n/**\n * Returns `true` when a value is a `Cookies` collection.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isCookies = u => Predicate.hasProperty(u, TypeId);\nconst CookieTypeId = \"~effect/http/Cookies/Cookie\";\n/**\n * Returns `true` when a value is a `Cookie`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isCookie = u => Predicate.hasProperty(u, CookieTypeId);\nconst CookieErrorTypeId = \"~effect/http/Cookies/CookieError\";\n/**\n * Error reason describing why cookie construction failed, such as invalid name,\n * value, domain, path, or infinite max-age.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class CookiesErrorReason extends Data.Error {}\n/**\n * Error returned when a cookie name, value, domain, path, or max-age option is invalid.\n *\n * **Details**\n *\n * Inspect `reason` to determine the specific validation failure.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class CookiesError extends /*#__PURE__*/Data.TaggedError(\"CookiesError\") {\n /**\n * Creates a cookie error from a reason tag and optional cause.\n *\n * @since 4.0.0\n */\n static fromReason(reason, cause) {\n return new CookiesError({\n reason: new CookiesErrorReason({\n _tag: reason,\n cause\n })\n });\n }\n /**\n * Marks this value as a cookie validation error for runtime guards.\n *\n * @since 4.0.0\n */\n [CookieErrorTypeId] = CookieErrorTypeId;\n /**\n * Uses the concrete cookie error reason as the public message.\n *\n * @since 4.0.0\n */\n get message() {\n return this.reason._tag;\n }\n}\nconst Proto = {\n [TypeId]: TypeId,\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"effect/Cookies\",\n cookies: Record.map(this.cookies, cookie => cookie.toJSON())\n };\n },\n pipe() {\n return pipeArguments(this, arguments);\n }\n};\n/**\n * Creates a `Cookies` collection from an existing readonly record of cookies keyed by cookie name.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromReadonlyRecord = cookies => {\n const self = Object.create(Proto);\n self.cookies = cookies;\n return self;\n};\n/**\n * Create a Cookies object from an Iterable\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromIterable = cookies => {\n const record = {};\n for (const cookie of cookies) {\n InternalRecord.assignProperty(record, cookie.name, cookie);\n }\n return fromReadonlyRecord(record);\n};\n/**\n * Create a Cookies object from a set of Set-Cookie headers\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromSetCookie = headers => {\n const arrayHeaders = typeof headers === \"string\" ? [headers] : headers;\n const cookies = [];\n for (const header of arrayHeaders) {\n const cookie = parseSetCookie(header.trim());\n if (cookie) {\n cookies.push(cookie);\n }\n }\n return fromIterable(cookies);\n};\nfunction parseSetCookie(header) {\n const parts = header.split(\";\").map(_ => _.trim()).filter(_ => _ !== \"\");\n if (parts.length === 0) {\n return undefined;\n }\n const firstEqual = parts[0].indexOf(\"=\");\n if (firstEqual === -1) {\n return undefined;\n }\n const name = parts[0].slice(0, firstEqual);\n if (!cookieNameRegExp.test(name)) {\n return undefined;\n }\n const valueEncoded = parts[0].slice(firstEqual + 1);\n const value = tryDecodeURIComponent(valueEncoded);\n if (parts.length === 1) {\n return Object.assign(Object.create(CookieProto), {\n name,\n value,\n valueEncoded\n });\n }\n const options = {};\n for (let i = 1; i < parts.length; i++) {\n const part = parts[i];\n const equalIndex = part.indexOf(\"=\");\n const key = equalIndex === -1 ? part : part.slice(0, equalIndex).trim();\n const value = equalIndex === -1 ? undefined : part.slice(equalIndex + 1).trim();\n switch (key.toLowerCase()) {\n case \"domain\":\n {\n if (value === undefined) {\n break;\n }\n const domain = value.trim().replace(/^\\./, \"\");\n if (domain) {\n options.domain = domain;\n }\n break;\n }\n case \"expires\":\n {\n if (value === undefined) {\n break;\n }\n const date = new Date(value);\n if (!isNaN(date.getTime())) {\n options.expires = date;\n }\n break;\n }\n case \"max-age\":\n {\n if (value === undefined) {\n break;\n }\n const maxAge = parseInt(value, 10);\n if (!isNaN(maxAge)) {\n options.maxAge = Duration.seconds(maxAge);\n }\n break;\n }\n case \"path\":\n {\n if (value === undefined) {\n break;\n }\n if (value[0] === \"/\") {\n options.path = value;\n }\n break;\n }\n case \"priority\":\n {\n if (value === undefined) {\n break;\n }\n switch (value.toLowerCase()) {\n case \"low\":\n options.priority = \"low\";\n break;\n case \"medium\":\n options.priority = \"medium\";\n break;\n case \"high\":\n options.priority = \"high\";\n break;\n }\n break;\n }\n case \"httponly\":\n {\n options.httpOnly = true;\n break;\n }\n case \"secure\":\n {\n options.secure = true;\n break;\n }\n case \"partitioned\":\n {\n options.partitioned = true;\n break;\n }\n case \"samesite\":\n {\n if (value === undefined) {\n break;\n }\n switch (value.toLowerCase()) {\n case \"lax\":\n options.sameSite = \"lax\";\n break;\n case \"strict\":\n options.sameSite = \"strict\";\n break;\n case \"none\":\n options.sameSite = \"none\";\n break;\n }\n break;\n }\n }\n }\n return Object.assign(Object.create(CookieProto), {\n name,\n value,\n valueEncoded,\n options: Object.keys(options).length > 0 ? options : undefined\n });\n}\n/**\n * An empty Cookies object\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/fromIterable([]);\n/**\n * Returns `true` when the `Cookies` collection contains no cookies.\n *\n * @category predicates\n * @since 4.0.0\n */\nexport const isEmpty = self => Record.isEmptyRecord(self.cookies);\n// oxlint-disable-next-line no-control-regex\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\nconst cookieNameRegExp = /^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$/;\n// oxlint-disable-next-line no-control-regex\nconst cookieDomainRegExp = /^[\\u0009\\u0020-\\u003a\\u003c-\\u007e\\u0080-\\u00ff]+$/;\nconst cookiePathRegExp = /^[\\u0020-\\u003a\\u003c-\\u007e]+$/;\nconst CookieProto = {\n [CookieTypeId]: CookieTypeId,\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"effect/Cookies/Cookie\",\n name: this.name,\n value: this.value,\n options: this.options\n };\n }\n};\n/**\n * Creates a cookie, validating the name, encoded value, domain, path, and finite `maxAge`.\n *\n * **Details**\n *\n * Returns a `CookiesError` in the `Result` failure channel when validation fails.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function makeCookie(name, value, options) {\n const encodedValue = encodeURIComponent(value);\n const error = validateCookie(name, encodedValue, options);\n if (error !== undefined) {\n return Result.fail(error);\n }\n return Result.succeed(Object.assign(Object.create(CookieProto), {\n name,\n value,\n valueEncoded: encodedValue,\n options\n }));\n}\nfunction validateCookie(name, encodedValue, options) {\n if (!cookieNameRegExp.test(name)) {\n return CookiesError.fromReason(\"InvalidCookieName\");\n }\n if (encodedValue && !fieldContentRegExp.test(encodedValue)) {\n return CookiesError.fromReason(\"InvalidCookieValue\");\n }\n if (options?.domain !== undefined && !cookieDomainRegExp.test(options.domain)) {\n return CookiesError.fromReason(\"InvalidCookieDomain\");\n }\n if (options?.path !== undefined && !cookiePathRegExp.test(options.path)) {\n return CookiesError.fromReason(\"InvalidCookiePath\");\n }\n if (options?.maxAge !== undefined && !Duration.isFinite(Duration.fromInputUnsafe(options.maxAge))) {\n return CookiesError.fromReason(\"CookieInfinityMaxAge\");\n }\n}\n/**\n * Create a new cookie, throwing an error if invalid\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeCookieUnsafe = (name, value, options) => Result.getOrThrow(makeCookie(name, value, options));\n/**\n * Adds a cookie to a Cookies object\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookie = /*#__PURE__*/dual(2, (self, cookie) => fromReadonlyRecord(Record.set(self.cookies, cookie.name, cookie)));\n/**\n * Adds multiple cookies to a Cookies object\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAllCookie = /*#__PURE__*/dual(2, (self, cookies) => {\n const record = {\n ...self.cookies\n };\n for (const cookie of cookies) {\n InternalRecord.assignProperty(record, cookie.name, cookie);\n }\n return fromReadonlyRecord(record);\n});\n/**\n * Combines two Cookies objects, removing duplicates from the first\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const merge = /*#__PURE__*/dual(2, (self, that) => fromReadonlyRecord({\n ...self.cookies,\n ...that.cookies\n}));\n/**\n * Removes a cookie by name\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const remove = /*#__PURE__*/dual(2, (self, name) => fromReadonlyRecord(Record.remove(self.cookies, name)));\n/**\n * Gets a cookie from a Cookies object safely.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const get = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name) => Option.fromUndefinedOr(Object.hasOwn(self.cookies, name) ? self.cookies[name] : undefined));\n/**\n * Gets the decoded value of a cookie by name safely.\n *\n * **Details**\n *\n * Returns `Option.none()` when the cookie is not present.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getValue = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name) => Option.map(get(self, name), cookie => cookie.value));\n/**\n * Creates and adds a cookie safely by name and value.\n *\n * **Details**\n *\n * The cookie fields are validated first; invalid input returns a `CookiesError` in the `Result` failure channel.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const set = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, value, options) => Result.map(makeCookie(name, value, options), cookie => fromReadonlyRecord(Record.set(self.cookies, name, cookie))));\n/**\n * Creates and adds a cookie by name and value, throwing if the cookie fields are invalid.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setUnsafe = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, value, options) => fromReadonlyRecord(Record.set(self.cookies, name, makeCookieUnsafe(name, value, options))));\n/**\n * Adds an expired cookie safely with an empty value, `Max-Age=0`, and an epoch `Expires` value.\n *\n * **Details**\n *\n * Returns a `CookiesError` in the `Result` failure channel when the name or options are invalid.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const expireCookie = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, options) => set(self, name, \"\", {\n ...options,\n maxAge: 0,\n expires: new Date(0)\n}));\n/**\n * Adds an expired cookie to a Cookies object, throwing an error if invalid\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const expireCookieUnsafe = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, options) => setUnsafe(self, name, \"\", {\n ...options,\n maxAge: 0,\n expires: new Date(0)\n}));\n/**\n * Creates and adds multiple cookies safely from name/value/options tuples.\n *\n * **Details**\n *\n * If any tuple is invalid, returns the first `CookiesError` and leaves the original collection unchanged.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAll = /*#__PURE__*/dual(2, (self, cookies) => {\n const record = {\n ...self.cookies\n };\n for (const [name, value, options] of cookies) {\n const result = makeCookie(name, value, options);\n if (Result.isFailure(result)) {\n return result;\n }\n InternalRecord.assignProperty(record, name, result.success);\n }\n return Result.succeed(fromReadonlyRecord(record));\n});\n/**\n * Adds multiple cookies to a Cookies object, throwing an error if invalid\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAllUnsafe = /*#__PURE__*/dual(2, (self, cookies) => Result.getOrThrow(setAll(self, cookies)));\n/**\n * Serializes a cookie into a string.\n *\n * **Details**\n *\n * Adapted from https://github.com/fastify/fastify-cookie under MIT License\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function serializeCookie(self) {\n const error = validateCookie(self.name, self.valueEncoded, self.options);\n if (error !== undefined) {\n throw error;\n }\n let str = self.name + \"=\" + self.valueEncoded;\n if (self.options === undefined) {\n return str;\n }\n const options = self.options;\n if (options.maxAge !== undefined) {\n const maxAge = Duration.toSeconds(Duration.fromInputUnsafe(options.maxAge));\n str += \"; Max-Age=\" + Math.trunc(maxAge);\n }\n if (options.domain !== undefined) {\n str += \"; Domain=\" + options.domain;\n }\n if (options.path !== undefined) {\n str += \"; Path=\" + options.path;\n }\n if (options.priority !== undefined) {\n switch (options.priority) {\n case \"low\":\n str += \"; Priority=Low\";\n break;\n case \"medium\":\n str += \"; Priority=Medium\";\n break;\n case \"high\":\n str += \"; Priority=High\";\n break;\n }\n }\n if (options.expires !== undefined) {\n str += \"; Expires=\" + options.expires.toUTCString();\n }\n if (options.httpOnly) {\n str += \"; HttpOnly\";\n }\n if (options.secure) {\n str += \"; Secure\";\n }\n // Draft implementation to support Chrome from 2024-Q1 forward.\n // See https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1\n if (options.partitioned) {\n str += \"; Partitioned\";\n }\n if (options.sameSite !== undefined) {\n switch (options.sameSite) {\n case \"lax\":\n str += \"; SameSite=Lax\";\n break;\n case \"strict\":\n str += \"; SameSite=Strict\";\n break;\n case \"none\":\n str += \"; SameSite=None\";\n break;\n }\n }\n return str;\n}\n/**\n * Serializes a `Cookies` object into a Cookie header.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const toCookieHeader = self => Object.values(self.cookies).map(cookie => `${cookie.name}=${cookie.valueEncoded}`).join(\"; \");\n/**\n * Converts a `Cookies` collection to a record of decoded cookie values keyed by cookie name.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const toRecord = self => {\n const record = {};\n const cookies = Object.values(self.cookies);\n for (let index = 0; index < cookies.length; index++) {\n const cookie = cookies[index];\n InternalRecord.assignProperty(record, cookie.name, cookie.value);\n }\n return record;\n};\n/**\n * Serializes a `Cookies` collection into an array of `Set-Cookie` header values.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const toSetCookieHeaders = self => Object.values(self.cookies).map(serializeCookie);\n/**\n * Parses a cookie header into a record of key-value pairs\n *\n * **Details**\n *\n * Adapted from https://github.com/fastify/fastify-cookie under MIT License\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function parseHeader(header) {\n const result = {};\n const strLen = header.length;\n let pos = 0;\n let terminatorPos = 0;\n while (true) {\n if (terminatorPos === strLen) break;\n terminatorPos = header.indexOf(\";\", pos);\n if (terminatorPos === -1) terminatorPos = strLen; // This is the last pair\n let eqIdx = header.indexOf(\"=\", pos);\n if (eqIdx === -1) break; // No key-value pairs left\n if (eqIdx > terminatorPos) {\n // Malformed key-value pair\n pos = terminatorPos + 1;\n continue;\n }\n const key = header.substring(pos, eqIdx++).trim();\n if (!Object.hasOwn(result, key)) {\n const val = header.charCodeAt(eqIdx) === 0x22 ? header.substring(eqIdx + 1, terminatorPos - 1).trim() : header.substring(eqIdx, terminatorPos).trim();\n InternalRecord.assignProperty(result, key, !(val.indexOf(\"%\") === -1) ? tryDecodeURIComponent(val) : val);\n }\n pos = terminatorPos + 1;\n }\n return result;\n}\nconst tryDecodeURIComponent = str => {\n try {\n return decodeURIComponent(str);\n // oxlint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (_) {\n return str;\n }\n};\n//# sourceMappingURL=Cookies.js.map","/**\n * Models URL query parameters as ordered string pairs.\n *\n * `UrlParams` is used for HTTP client query strings, URL-encoded form bodies,\n * and server-side decoding. Values can be built from records, iterables, or\n * native `URLSearchParams`, then updated, serialized, converted to a `URL`, or\n * decoded with schemas.\n *\n * @since 4.0.0\n */\nimport * as Arr from \"../../Array.js\";\nimport * as Equal from \"../../Equal.js\";\nimport * as Equ from \"../../Equivalence.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Hash from \"../../Hash.js\";\nimport { PipeInspectableProto } from \"../../internal/core.js\";\nimport * as InternalRecord from \"../../internal/record.js\";\nimport * as Option from \"../../Option.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as Tuple from \"../../Tuple.js\";\nconst TypeId = \"~effect/http/UrlParams\";\n/**\n * Returns `true` when a value is a `UrlParams` instance.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isUrlParams = u => hasProperty(u, TypeId);\nconst Proto = {\n ...PipeInspectableProto,\n [TypeId]: TypeId,\n [Symbol.iterator]() {\n return this.params[Symbol.iterator]();\n },\n toJSON() {\n return {\n _id: \"UrlParams\",\n params: Object.fromEntries(this.params)\n };\n },\n [Equal.symbol](that) {\n return Equivalence(this, that);\n },\n [Hash.symbol]() {\n return Hash.array(this.params.flat());\n }\n};\n/**\n * Creates `UrlParams` from ordered string key-value pairs.\n *\n * **Details**\n *\n * The input pairs are used as-is and are not coerced or normalized.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = params => {\n const self = Object.create(Proto);\n self.params = params;\n return self;\n};\n/**\n * Creates `UrlParams` from a supported input shape.\n *\n * **Details**\n *\n * Primitive values are converted to strings, arrays produce repeated parameters,\n * nested records use bracket notation, and `undefined` values are omitted.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromInput = input => {\n if (isUrlParams(input)) {\n return input;\n }\n const parsed = fromInputNested(input);\n const out = [];\n for (let i = 0; i < parsed.length; i++) {\n if (Array.isArray(parsed[i][0])) {\n const [keys, value] = parsed[i];\n out.push([`${keys[0]}[${keys.slice(1).join(\"][\")}]`, value]);\n } else {\n out.push(parsed[i]);\n }\n }\n return make(out);\n};\nconst fromInputNested = input => {\n const entries = typeof input[Symbol.iterator] === \"function\" ? Arr.fromIterable(input) : Object.entries(input);\n const out = [];\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n if (value[i] !== undefined) {\n out.push([key, String(value[i])]);\n }\n }\n } else if (value !== null && typeof value === \"object\") {\n const nested = fromInputNested(value);\n for (const [k, v] of nested) {\n out.push([[key, ...(typeof k === \"string\" ? [k] : k)], v]);\n }\n } else if (value !== undefined) {\n out.push([key, String(value)]);\n }\n }\n return out;\n};\n/**\n * Provides an order-sensitive `Equivalence` instance for `UrlParams`.\n *\n * **Details**\n *\n * Two values are equivalent when they contain the same key-value pairs in the same\n * order.\n *\n * @category instances\n * @since 4.0.0\n */\nexport const Equivalence = /*#__PURE__*/Equ.make((a, b) => arrayEquivalence(a.params, b.params));\nconst arrayEquivalence = /*#__PURE__*/Arr.makeEquivalence(/*#__PURE__*/Tuple.makeEquivalence([/*#__PURE__*/Equ.strictEqual(), /*#__PURE__*/Equ.strictEqual()]));\n/**\n * An empty `UrlParams` value.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/make([]);\n/**\n * Returns all values for a query parameter key in insertion order.\n *\n * **Details**\n *\n * Returns an empty array when the key is absent.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getAll = /*#__PURE__*/dual(2, (self, key) => Arr.reduce(self.params, [], (acc, [k, value]) => {\n if (k === key) {\n acc.push(value);\n }\n return acc;\n}));\n/**\n * Returns the first value for a query parameter key safely.\n *\n * **When to use**\n *\n * Use when duplicate query parameters are ordered and the first occurrence has\n * precedence.\n *\n * **Details**\n *\n * Returns `Option.none` when the key is absent.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getFirst = /*#__PURE__*/dual(2, (self, key) => Arr.findFirst(self.params, ([k]) => k === key).pipe(Option.map(([, value]) => value)));\n/**\n * Returns the last value for a query parameter key safely.\n *\n * **When to use**\n *\n * Use when duplicate query parameters are ordered and the last occurrence has\n * precedence.\n *\n * **Details**\n *\n * Returns `Option.none` when the key is absent.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getLast = /*#__PURE__*/dual(2, (self, key) => Arr.findLast(self.params, ([k]) => k === key).pipe(Option.map(([, value]) => value)));\n/**\n * Sets a query parameter to a single value.\n *\n * **Details**\n *\n * Existing values for the same key are removed, and the new value is appended to\n * the end.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const set = /*#__PURE__*/dual(3, (self, key, value) => make(Arr.append(Arr.filter(self.params, ([k]) => k !== key), [key, String(value)])));\n/**\n * Transforms the underlying ordered key-value pairs of `UrlParams`.\n *\n * **Details**\n *\n * The result is wrapped in a new `UrlParams` value.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const transform = /*#__PURE__*/dual(2, (self, f) => make(f(self.params)));\n/**\n * Sets multiple query parameters from input.\n *\n * **Details**\n *\n * Keys present in the input replace existing values for those keys, while\n * unmentioned existing parameters are preserved.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAll = /*#__PURE__*/dual(2, (self, input) => {\n const params = fromInput(input).params.slice();\n const keys = new Set();\n for (let i = 0; i < params.length; i++) {\n keys.add(params[i][0]);\n }\n for (let i = 0; i < self.params.length; i++) {\n if (keys.has(self.params[i][0])) continue;\n params.push(self.params[i]);\n }\n return make(params);\n});\n/**\n * Appends a query parameter value without removing existing values for the key.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const append = /*#__PURE__*/dual(3, (self, key, value) => make(Arr.append(self.params, [key, String(value)])));\n/**\n * Appends all query parameters produced from the supplied input.\n *\n * **Details**\n *\n * Existing parameters are preserved.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const appendAll = /*#__PURE__*/dual(2, (self, input) => transform(self, Arr.appendAll(fromInput(input).params)));\n/**\n * Removes all query parameter values for the specified key.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const remove = /*#__PURE__*/dual(2, (self, key) => transform(self, Arr.filter(([k]) => k !== key)));\n/**\n * Serializes `UrlParams` to a URL query string without a leading question mark.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toString = input => new URLSearchParams(fromInput(input).params).toString();\n/**\n * Builds a `Record` containing all the key-value pairs in the given `UrlParams`\n * as `string` (if only one value for a key) or a `NonEmptyArray<string>`\n * (when more than one value for a key)\n *\n * **Example** (Converting parameters to a record)\n *\n * ```ts import.meta.vitest\n * import { UrlParams } from \"effect/unstable/http\"\n *\n * const urlParams = UrlParams.fromInput({\n * a: 1,\n * b: true,\n * c: \"string\",\n * e: [1, 2, 3]\n * })\n * UrlParams.toRecord(urlParams) // => { a: \"1\", b: \"true\", c: \"string\", e: [\"1\", \"2\", \"3\"] }\n * ```\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toRecord = self => {\n const out = {};\n for (const [k, value] of self.params) {\n if (!Object.hasOwn(out, k)) {\n InternalRecord.assignProperty(out, k, value);\n } else {\n const current = out[k];\n if (typeof current === \"string\") {\n InternalRecord.assignProperty(out, k, [current, value]);\n } else {\n current.push(value);\n }\n }\n }\n return out;\n};\n/**\n * Builds a readonly record from `UrlParams`.\n *\n * **Details**\n *\n * Keys with one value map to a string, and keys with multiple values map to a\n * non-empty readonly array of strings.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toReadonlyRecord = toRecord;\n//# sourceMappingURL=UrlParams.js.map","/**\n * Describes data shapes and how unknown input becomes trusted values.\n *\n * A schema can validate input, decode it into an application type, and encode\n * that value back to another representation. This module contains the main\n * schema, codec, decoder, and encoder APIs, together with schemas for common\n * JavaScript values and Effect data types. It also supports refinements,\n * transformations, defaults, classes, JSON Schema generation, test data\n * generation, formatting, equivalence, optics, and differs derived from schema\n * definitions.\n *\n * @since 4.0.0\n */\nimport * as Arr from \"./Array.js\";\nimport * as BigDecimal_ from \"./BigDecimal.js\";\nimport * as ByteSize_ from \"./ByteSize.js\";\nimport * as Cause_ from \"./Cause.js\";\nimport * as Chunk_ from \"./Chunk.js\";\nimport * as Data from \"./Data.js\";\nimport * as DateTime from \"./DateTime.js\";\nimport * as Duration_ from \"./Duration.js\";\nimport * as Effect from \"./Effect.js\";\nimport * as Encoding from \"./Encoding.js\";\nimport * as Equal from \"./Equal.js\";\nimport * as Exit_ from \"./Exit.js\";\nimport { format, formatPropertyKey } from \"./Formatter.js\";\nimport { identity } from \"./Function.js\";\nimport * as HashMap_ from \"./HashMap.js\";\nimport * as HashSet_ from \"./HashSet.js\";\nimport * as core from \"./internal/core.js\";\nimport { effectIsExit } from \"./internal/effect.js\";\nimport * as InternalGraph from \"./internal/graph.js\";\nimport * as InternalRecord from \"./internal/record.js\";\nimport * as InternalAnnotations from \"./internal/schema/annotations.js\";\nimport * as InternalMake from \"./internal/schema/make.js\";\nimport * as InternalStandardSchema from \"./internal/schema/standardSchema.js\";\nimport * as InternalToCodec from \"./internal/schema/toCodec.js\";\nimport * as InternalToDifferJsonPatch from \"./internal/schema/toDifferJsonPatch.js\";\nimport * as InternalToEncoderXml from \"./internal/schema/toEncoderXml.js\";\nimport * as InternalEquivalence from \"./internal/schema/toEquivalence.js\";\nimport * as InternalToFormatter from \"./internal/schema/toFormatter.js\";\nimport * as InternalToIso from \"./internal/schema/toIso.js\";\nimport * as InternalToJsonSchemaDocument from \"./internal/schema/toJsonSchemaDocument.js\";\nimport * as InternalToRepresentation from \"./internal/schema/toRepresentation.js\";\nimport { isSchemaError as isSchemaErrorInternal, SchemaErrorTypeId } from \"./internal/schemaError.js\";\nimport { getStackTraceLimit, setStackTraceLimit } from \"./internal/stackTraceLimit.js\";\nimport { remainder } from \"./Number.js\";\nimport * as Option_ from \"./Option.js\";\nimport * as Order from \"./Order.js\";\nimport * as Pipeable from \"./Pipeable.js\";\nimport * as Predicate from \"./Predicate.js\";\nimport * as Record_ from \"./Record.js\";\nimport * as Redacted_ from \"./Redacted.js\";\nimport * as RegExp_ from \"./RegExp.js\";\nimport * as Result_ from \"./Result.js\";\nimport * as SchemaAST from \"./SchemaAST.js\";\nimport * as SchemaGetter from \"./SchemaGetter.js\";\nimport * as SchemaIssue from \"./SchemaIssue.js\";\nimport * as SchemaParser from \"./SchemaParser.js\";\nimport * as SchemaTransformation from \"./SchemaTransformation.js\";\nimport * as Struct_ from \"./Struct.js\";\nimport * as Cookies_ from \"./unstable/http/Cookies.js\";\nimport * as Headers_ from \"./unstable/http/Headers.js\";\nimport * as UrlParams_ from \"./unstable/http/UrlParams.js\";\nimport * as IpInterface_ from \"./unstable/net/IpInterface.js\";\nimport * as IpNetwork_ from \"./unstable/net/IpNetwork.js\";\nimport * as NetAddress_ from \"./unstable/net/NetAddress.js\";\nconst TypeId = InternalMake.TypeId;\n/**\n * Creates a schema for a **parametric** type (a generic container such as\n * `Array<A>`, `Option<A>`, etc.) by accepting a list of type-parameter schemas\n * and a decoder factory.\n *\n * **When to use**\n *\n * Use when you are defining a schema for a generic container whose validation\n * depends on one or more type-parameter schemas.\n *\n * **Details**\n *\n * The outer call `declareConstructor<T, E, Iso>()` fixes the decoded type `T`,\n * the encoded type `E`, and the optional iso type. The inner call receives:\n * - `typeParameters` — the concrete schemas for each type variable\n * - `run` — a factory that, given resolved codecs for each type parameter,\n * returns a parsing function `(u, ast, options) => Effect<T, Issue>`\n * - `annotations` — optional metadata\n *\n * @see {@link declare} for creating schemas for non-parametric types.\n *\n * **Example** (Schema for a parametric `Box<A>` type)\n *\n * ```ts import.meta.vitest\n * import { Effect, Schema, SchemaIssue, SchemaParser } from \"effect\"\n *\n * interface Box<A> {\n * readonly value: A\n * }\n *\n * const isBox = (u: unknown): u is Box<unknown> =>\n * typeof u === \"object\" && u !== null && \"value\" in u\n *\n * const Box = <A extends Schema.Constraint>(item: A) =>\n * Schema.declareConstructor<Box<A[\"Type\"]>, Box<A[\"Encoded\"]>>()(\n * [item],\n * ([itemCodec]) =>\n * (u, ast, options) => {\n * if (!isBox(u)) {\n * return Effect.fail(new SchemaIssue.InvalidType(ast, u, options))\n * }\n * return Effect.map(\n * SchemaParser.decodeUnknownEffect(itemCodec)(u.value, options),\n * (value) => ({ value })\n * )\n * }\n * )\n *\n * const schema = Box(Schema.Number)\n * Effect.runSync(Schema.decodeUnknownEffect(schema)({ value: 1 })) // => { value: 1 }\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function declareConstructor() {\n return (typeParameters, run, annotations) => {\n return make(new SchemaAST.Declaration(typeParameters.map(SchemaAST.getAST), typeParameters => run(typeParameters.map(ast => make(ast))), annotations));\n };\n}\n/**\n * Creates a schema for a **non-parametric** opaque type using a type-guard\n * function. The schema accepts any unknown value and succeeds when `is` returns\n * `true`, failing with an `InvalidType` issue otherwise.\n *\n * **When to use**\n *\n * Use when you are defining a schema for an opaque type with no type parameters\n * and validation can be expressed as a type guard.\n *\n * **Example** (Defining a schema for a custom `UserId` branded type)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * type UserId = string & { readonly _tag: \"UserId\" }\n *\n * const isUserId = (u: unknown): u is UserId =>\n * typeof u === \"string\" && u.startsWith(\"user_\")\n *\n * const UserId = Schema.declare<UserId>(isUserId, {\n * title: \"UserId\",\n * description: \"A user identifier starting with 'user_'\"\n * })\n * Schema.decodeUnknownSync(UserId)(\"user_123\") // => \"user_123\"\n * ```\n *\n * @see {@link declareConstructor} for creating schemas for parametric types.\n *\n * @category constructors\n * @since 3.10.0\n */\nexport function declare(is, annotations) {\n return declareConstructor()([], () => (input, ast, options) => is(input) ? Effect.succeed(input) : Effect.fail(new SchemaIssue.InvalidType(ast, input, options)), annotations);\n}\n/**\n * Returns a schema widened to the fully-parameterized {@link Bottom} interface,\n * making all 14 type parameters visible to TypeScript.\n *\n * **Details**\n *\n * Normally, concrete schema interfaces (e.g. `Schema<string>`) hide most type\n * parameters. `revealBottom` is useful when writing generic utilities that need\n * to inspect or propagate the complete set of type parameters.\n *\n * **Example** (Inspecting all type parameters of a schema)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.String\n *\n * // Widen to Bottom to access all 14 type parameters\n * const bottom = Schema.revealBottom(schema)\n *\n * // `bottom` now exposes Type, Encoded, DecodingServices, EncodingServices,\n * // ast, Rebuild, ~type.make.in, Iso, ~type.parameters, etc.\n * type T = typeof bottom[\"Type\"] // string\n * type E = typeof bottom[\"Encoded\"] // string\n * ```\n *\n * @category utility types\n * @since 4.0.0\n */\nexport function revealBottom(bottom) {\n return bottom;\n}\n/**\n * Adds metadata annotations to a schema without changing its runtime behavior.\n * This is the pipeable (curried) counterpart of the `.annotate` method.\n *\n * **Details**\n *\n * Annotations provide extra context used by documentation generators, JSON\n * Schema converters, error formatters, and other tooling. Common keys include\n * `title`, `description`, `examples`, `message`, and `identifier`.\n *\n * **Example** (Adding a title and description)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const Age = Schema.Natural.pipe(\n * Schema.annotate({\n * title: \"Age\",\n * description: \"A non-negative integer representing age in years\"\n * })\n * )\n * Schema.resolveAnnotations(Age)?.title // => \"Age\"\n * ```\n *\n * @see {@link annotateEncoded} to annotate the encoded side instead.\n *\n * @category annotations\n * @since 4.0.0\n */\nexport function annotate(annotations) {\n return self => self.annotate(annotations);\n}\n/**\n * Adds metadata annotations to the **encoded** side of a schema without\n * changing its runtime behavior. This is the encoded-side counterpart of\n * `annotate`, which targets the decoded (Type) side.\n *\n * **Details**\n *\n * Internally the schema is flipped so that `Encoded` becomes `Type`,\n * annotated, and then flipped back.\n *\n * **Example** (Adding a title to the encoded representation)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.NumberFromString.pipe(\n * Schema.annotateEncoded({\n * title: \"my title\"\n * })\n * )\n *\n * Schema.toEncoded(schema).ast.annotations?.title // => \"my title\"\n * ```\n *\n * @see {@link annotate} to annotate the type side instead.\n *\n * @category annotations\n * @since 4.0.0\n */\nexport function annotateEncoded(annotations) {\n return self => flip(flip(self).annotate(annotations));\n}\n/**\n * Adds key-level annotations to a schema field. This is the pipeable\n * (curried) counterpart of the `.annotateKey` method.\n *\n * **Details**\n *\n * Key annotations apply to a field's position inside a `Struct` or `Tuple`\n * rather than to the field's value type. They can carry a\n * `messageMissingKey` to customise the error shown when the field is absent,\n * as well as standard documentation fields such as `title`, `description`,\n * and `examples`.\n *\n * **Example** (Customizing the missing-key message for a required field)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.Struct({\n * username: Schema.String.pipe(\n * Schema.annotateKey({\n * description: \"The username used to log in\",\n * messageMissingKey: \"Username is required\"\n * })\n * )\n * })\n * schema.fields.username.ast.context?.annotations?.messageMissingKey // => \"Username is required\"\n * ```\n *\n * @category annotations\n * @since 4.0.0\n */\nexport function annotateKey(annotations) {\n return self => {\n return self.rebuild(SchemaAST.annotateKey(self.ast, annotations));\n };\n}\n/**\n * Returns a codec widened to the full {@link Codec} interface, prompting\n * TypeScript to infer all four type parameters (`T`, `E`, `RD`, `RE`).\n *\n * **Details**\n *\n * When a schema is stored in a variable typed as `Schema<T>` or `Top`, the\n * encoded type and service requirements are erased. Passing the value through\n * `revealCodec` recovers those parameters without any runtime cost.\n *\n * **Example** (Recovering encoded type from a schema variable)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema: Schema.Schema<number> = Schema.NumberFromString\n *\n * // Without revealCodec, Encoded is unknown\n * const codec = Schema.revealCodec(schema)\n * type Enc = typeof codec[\"Encoded\"] // string\n * ```\n *\n * @category utility types\n * @since 4.0.0\n */\nexport function revealCodec(codec) {\n return codec;\n}\n/**\n * Error thrown or returned when schema decoding or encoding fails.\n *\n * **Details**\n *\n * The `issue` field contains a structured {@link SchemaIssue.Issue} tree describing\n * every validation failure, including the path to the problematic value and\n * the expected type or constraint. The `message` field renders the issue tree\n * with the default formatter.\n *\n * **Gotchas**\n *\n * Parsing with `reportInput: true` adds an enumerable `input` field to\n * value-bearing issues. Built-in messages may include reported input, and\n * custom annotations or messages are not sanitized.\n *\n * **Example** (Inspecting a SchemaError)\n *\n * ```ts import.meta.vitest\n * import { Result, Schema } from \"effect\"\n *\n * const result = Schema.decodeUnknownResult(Schema.Number)(\"not a number\")\n * const message = Result.isFailure(result) ? result.failure.message : \"\"\n * message // => \"Expected number\"\n * ```\n *\n * @see {@link isSchemaError} for narrowing unknown values\n * @category errors\n * @since 4.0.0\n */\nexport class SchemaError extends /*#__PURE__*/Data.TaggedError(\"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 SchemaIssue.defaultFormatter(this.issue);\n }\n toString() {\n return `SchemaError(${this.message})`;\n }\n}\n/**\n * Returns `true` if `u` is a {@link SchemaError}.\n *\n * **When to use**\n *\n * Use when you need to narrow an unknown value to `SchemaError`.\n *\n * **Example** (Narrowing Schema errors)\n *\n * ```ts import.meta.vitest\n * import { Result, Schema } from \"effect\"\n *\n * const result = Result.try(() => Schema.decodeUnknownSync(Schema.Number)(\"oops\"))\n * const error: unknown = Result.isFailure(result) ? result.failure : undefined\n * Schema.isSchemaError(error) // => true\n * ```\n *\n * @category guards\n * @since 4.0.0\n */\nexport function isSchemaError(u) {\n return isSchemaErrorInternal(u);\n}\nfunction fromIssueEffect(self) {\n if (effectIsExit(self)) {\n return fromIssueExit(self);\n }\n return Effect.catchCause(self, cause => Effect.failCauseSync(() => Cause_.map(cause, issue => new SchemaError(issue))));\n}\nfunction fromIssueExit(exit) {\n return Exit_.isSuccess(exit) ? exit : Exit_.failCause(Cause_.map(exit.cause, issue => new SchemaError(issue)));\n}\nfunction getSchemaErrorOrThrow(cause, message) {\n let schemaError;\n for (const reason of cause.reasons) {\n if (!Cause_.isFailReason(reason) || !isSchemaError(reason.error)) {\n throw new globalThis.Error(message, {\n cause\n });\n }\n schemaError ??= reason.error;\n }\n if (schemaError === undefined) {\n throw new globalThis.Error(message, {\n cause\n });\n }\n return schemaError;\n}\nfunction runSchemaErrorPromise(self) {\n return Effect.runPromiseExit(self).then(exit => {\n if (Exit_.isSuccess(exit)) {\n return exit.value;\n }\n throw getSchemaErrorOrThrow(exit.cause, \"Promise adapter can only reject schema errors\");\n });\n}\nfunction runSchemaErrorSync(self) {\n const exit = Effect.runSyncExit(self);\n if (Exit_.isSuccess(exit)) {\n return exit.value;\n }\n throw getSchemaErrorOrThrow(exit.cause, \"Sync adapter can only throw schema errors\");\n}\n/**\n * Returns a \"Standard Schema\" object conforming to the [Standard Schema\n * v1](https://standardschema.dev/) specification.\n *\n * **Details**\n *\n * This function creates a schema whose `validate` method attempts to decode and\n * validate the provided input synchronously. If the underlying `Schema`\n * includes any asynchronous components (e.g., asynchronous message resolutions\n * or checks), then validation will necessarily return a `Promise` instead.\n *\n * **Example** (Creating a standard schema from a regular schema)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * // Define custom hook functions for error formatting\n * const leafHook = (issue: any) => {\n * switch (issue._tag) {\n * case \"InvalidType\":\n * return \"Expected different type\"\n * case \"InvalidValue\":\n * return \"Invalid value provided\"\n * case \"MissingKey\":\n * return \"Required property missing\"\n * case \"UnexpectedKey\":\n * return \"Unexpected property found\"\n * case \"Forbidden\":\n * return \"Operation not allowed\"\n * case \"OneOf\":\n * return \"Multiple valid options available\"\n * default:\n * return \"Validation error\"\n * }\n * }\n *\n * // Create a standard schema from a regular schema\n * const PersonSchema = Schema.Struct({\n * name: Schema.NonEmptyString,\n * age: Schema.Finite.check(Schema.isBetween({ minimum: 0, maximum: 150 }))\n * })\n *\n * const standardSchema = Schema.toStandardSchemaV1(PersonSchema, {\n * leafHook\n * })\n *\n * // The standard schema can be used with any Standard Schema v1 compatible library\n * const validResult = standardSchema[\"~standard\"].validate({\n * name: \"Alice\",\n * age: 30\n * })\n * const invalidResult = standardSchema[\"~standard\"].validate({\n * name: \"\",\n * age: 200\n * })\n *\n * if (validResult instanceof Promise || invalidResult instanceof Promise) {\n * throw new Error(\"Expected synchronous validation\")\n * }\n * if (\"value\" in validResult) {\n * validResult.value // => { name: \"Alice\", age: 30 }\n * }\n * invalidResult.issues?.map((issue) => issue.path) // => [[\"name\"], [\"age\"]]\n * ```\n *\n * @category converting\n * @since 4.0.0\n */\nexport function toStandardSchemaV1(self, options) {\n return InternalStandardSchema.toStandardSchemaV1(self, options);\n}\n/**\n * Converts a schema to an experimental Standard JSON Schema V1 representation.\n *\n * **Details**\n *\n * https://github.com/standard-schema/standard-schema/pull/134\n *\n * @category converting\n * @since 4.0.0\n */\nexport function toStandardJSONSchemaV1(self) {\n return InternalStandardSchema.toStandardJSONSchemaV1(self);\n}\n/**\n * Creates a type guard function that checks if a value conforms to a given\n * schema.\n *\n * **Details**\n *\n * This function returns a predicate that performs a type-safe check, narrowing\n * the type of the input value if the check passes. The predicate returns `false`\n * for schema mismatches.\n *\n * **Gotchas**\n *\n * Only causes made entirely of schema issues are converted to `false`. Causes\n * that contain defects, interruptions, or other non-schema reasons throw\n * instead.\n *\n * **Example** (Defining a basic type guard)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const isString = Schema.is(Schema.String)\n *\n * isString(\"hello\") // => true\n * isString(42) // => false\n *\n * // Type narrowing in action\n * const value: unknown = \"hello\"\n * if (isString(value)) {\n * // value is now typed as string\n * value.toUpperCase() // => \"HELLO\"\n * }\n * ```\n *\n * @category guards\n * @since 3.10.0\n */\nexport const is = SchemaParser.is;\n/**\n * Creates an assertion function that throws an error if the input does not match\n * the schema.\n *\n * **When to use**\n *\n * Use to validate unknown input at runtime while narrowing the value with a\n * TypeScript assertion signature.\n *\n * **Details**\n *\n * The input is narrowed if the assertion succeeds. If schema validation fails,\n * the assertion throws an `Error` whose cause is `SchemaIssue.Issue`.\n * Schema validation failures use the generic message `\"Schema validation failed\"`.\n * Format the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when\n * human-readable details are needed.\n *\n * **Gotchas**\n *\n * Causes that contain defects, interruptions, or other non-schema reasons throw\n * with the underlying `Cause` attached instead of being converted to schema\n * validation errors.\n *\n * **Example** (Asserting and narrowing an input)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaIssue } from \"effect\"\n *\n * const input: unknown = \"hello\"\n *\n * // This will pass silently (no return value) and narrow input to string\n * Schema.asserts(Schema.String, input)\n * input.toUpperCase() // => \"HELLO\"\n *\n * // This will throw an error\n * try {\n * const invalid: unknown = 123\n * Schema.asserts(Schema.String, invalid)\n * } catch (error) {\n * if (error instanceof Error) {\n * SchemaIssue.isIssue(error.cause) // => true\n * }\n * }\n * ```\n *\n * @category guards\n * @since 4.0.0\n */\nexport const asserts = SchemaParser.asserts;\n/**\n * Decodes an `unknown` input against a schema, returning an `Effect` that\n * succeeds with the decoded value or fails with a {@link SchemaError}.\n *\n * **When to use**\n *\n * Use when you need to decode unknown input in an `Effect` whose failure\n * channel is `SchemaError`.\n *\n * **Details**\n *\n * Prefer {@link decodeEffect} when the input is already typed as the schema's\n * `Encoded` type.\n * Options may be provided either when creating the decoder or when applying it;\n * application options override creation options.\n *\n * @see {@link SchemaParser.decodeUnknownEffect} for the adapter that fails with `SchemaIssue.Issue` directly\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeUnknownEffect(schema, options) {\n const parser = SchemaParser.decodeUnknownEffect(schema, options);\n return (input, options) => {\n return fromIssueEffect(parser(input, options));\n };\n}\n/**\n * Decodes a typed input (the schema's `Encoded` type) against a schema,\n * returning an `Effect` that succeeds with the decoded value or fails with a\n * {@link SchemaError}.\n *\n * **When to use**\n *\n * Use when you need to decode input already typed as the schema's `Encoded`\n * type in an `Effect` whose failure channel is `SchemaError`.\n *\n * **Details**\n *\n * For `unknown` input use {@link decodeUnknownEffect}.\n * Options may be provided either when creating the decoder or when applying it;\n * application options override creation options.\n *\n * @see {@link SchemaParser.decodeEffect} for the adapter that fails with `SchemaIssue.Issue` directly\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const decodeEffect = decodeUnknownEffect;\n/**\n * Decodes an `unknown` input against a schema synchronously, returning an\n * `Exit` that is either a `Success` with the decoded value or a `Failure`.\n *\n * **When to use**\n *\n * Use when you need to decode unknown input into an `Exit` and capture schema\n * mismatches as `SchemaError`.\n *\n * **Details**\n *\n * Only usable with schemas that have no `DecodingServices` requirement. Prefer\n * {@link decodeExit} when the input is already typed as the schema's `Encoded`\n * type.\n * Options may be provided either when creating the decoder or when applying it;\n * application options override creation options.\n * Schema mismatches are represented by a `Failure` cause containing\n * `SchemaError`.\n *\n * **Gotchas**\n *\n * Schema issue fail reasons are wrapped as `SchemaError`. Defects,\n * interruptions, and other non-schema reasons remain in the returned `Cause`,\n * including when they are mixed with schema issues.\n *\n * @see {@link SchemaParser.decodeUnknownExit} for the adapter whose failure contains `SchemaIssue.Issue` directly\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeUnknownExit(schema, options) {\n const parser = SchemaParser.decodeUnknownExit(schema, options);\n return (input, options) => {\n return fromIssueExit(parser(input, options));\n };\n}\n/**\n * Decodes a typed input (the schema's `Encoded` type) against a schema\n * synchronously, returning an `Exit` that is either a `Success` with the decoded\n * value or a `Failure`.\n *\n * **When to use**\n *\n * Use when you need to decode already typed `Encoded` input into an `Exit` and\n * capture schema mismatches as `SchemaError`.\n *\n * **Details**\n *\n * Only usable with schemas that have no `DecodingServices` requirement. For\n * `unknown` input use {@link decodeUnknownExit}.\n * Options may be provided either when creating the decoder or when applying it;\n * application options override creation options.\n * Schema mismatches are represented by a `Failure` cause containing\n * `SchemaError`.\n *\n * **Gotchas**\n *\n * Schema issue fail reasons are wrapped as `SchemaError`. Defects,\n * interruptions, and other non-schema reasons remain in the returned `Cause`,\n * including when they are mixed with schema issues.\n *\n * @see {@link SchemaParser.decodeExit} for the adapter whose failure contains `SchemaIssue.Issue` directly\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const decodeExit = decodeUnknownExit;\n/**\n * Decodes an `unknown` input against a schema, returning an `Option` that is\n * `Some` with the decoded value on success or `None` for schema mismatches.\n *\n * **When to use**\n *\n * Use when you do not know the input type statically and only need to know\n * whether decoding succeeded.\n *\n * **Details**\n *\n * Prefer this over {@link decodeUnknownExit} or {@link decodeUnknownEffect}\n * when you don't need error details. For input already typed as the schema's\n * `Encoded` type use {@link decodeOption}.\n * Options may be provided either when creating the decoder or when applying it;\n * application options override creation options.\n *\n * **Gotchas**\n *\n * Only causes made entirely of schema issues are converted to `None`. Causes\n * that contain defects, interruptions, or other non-schema reasons throw\n * instead.\n *\n * @category decoding\n * @since 3.10.0\n */\nexport const decodeUnknownOption = SchemaParser.decodeUnknownOption;\n/**\n * Decodes a typed input (the schema's `Encoded` type) against a schema,\n * returning an `Option` that is `Some` with the decoded value on success or\n * `None` for schema mismatches.\n *\n * **When to use**\n *\n * Use when you already have input typed as the schema's `Encoded` type and\n * only need to know whether decoding succeeded.\n *\n * **Details**\n *\n * For `unknown` input use {@link decodeUnknownOption}.\n * Options may be provided either when creating the decoder or when applying it;\n * application options override creation options.\n *\n * **Gotchas**\n *\n * Only causes made entirely of schema issues are converted to `None`. Causes\n * that contain defects, interruptions, or other non-schema reasons throw\n * instead.\n *\n * @category decoding\n * @since 3.10.0\n */\nexport const decodeOption = SchemaParser.decodeOption;\n/**\n * Decodes an `unknown` input against a schema, returning a `Result` that\n * succeeds with the decoded value or fails with a {@link SchemaError} for schema\n * mismatches.\n *\n * **When to use**\n *\n * Use when you do not know the input type statically and want schema mismatches\n * returned as `Result.fail` with `SchemaError`.\n *\n * **Details**\n *\n * For input already typed as the schema's `Encoded` type use\n * {@link decodeResult}.\n * Options may be provided either when creating the decoder or when applying it;\n * application options override creation options.\n * Schema mismatches are returned as `Result.fail` with `SchemaError`.\n *\n * **Gotchas**\n *\n * Only causes made entirely of schema issues are returned as `Result.fail`.\n * Causes that contain defects, interruptions, or other non-schema reasons throw\n * instead.\n *\n * @see {@link SchemaParser.decodeUnknownResult} for the adapter that fails with `SchemaIssue.Issue` directly\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeUnknownResult(schema, options) {\n const parser = SchemaParser.decodeUnknownResult(schema, options);\n return (input, options) => {\n return Result_.mapError(parser(input, options), issue => new SchemaError(issue));\n };\n}\n/**\n * Decodes a typed input (the schema's `Encoded` type) against a schema,\n * returning a `Result` that succeeds with the decoded value or fails with a\n * {@link SchemaError} for schema mismatches.\n *\n * **When to use**\n *\n * Use when you already have input typed as the schema's `Encoded` type and want\n * schema mismatches returned as `Result.fail` with `SchemaError`.\n *\n * **Details**\n *\n * For `unknown` input use {@link decodeUnknownResult}.\n * Options may be provided either when creating the decoder or when applying it;\n * application options override creation options.\n * Schema mismatches are returned as `Result.fail` with `SchemaError`.\n *\n * **Gotchas**\n *\n * Only causes made entirely of schema issues are returned as `Result.fail`.\n * Causes that contain defects, interruptions, or other non-schema reasons throw\n * instead.\n *\n * @see {@link SchemaParser.decodeResult} for the adapter that fails with `SchemaIssue.Issue` directly\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const decodeResult = decodeUnknownResult;\n/**\n * Decodes an `unknown` input against a schema, returning a `Promise` that\n * resolves with the decoded value or rejects with a {@link SchemaError} for\n * schema mismatches.\n *\n * **When to use**\n *\n * Use when you need decoding of unknown input to return a JavaScript `Promise`\n * that rejects with `SchemaError` for schema mismatches.\n *\n * **Details**\n *\n * For input already typed as the schema's `Encoded` type use\n * {@link decodePromise}.\n * Options may be provided either when creating the decoder or when applying it;\n * application options override creation options.\n *\n * **Gotchas**\n *\n * Non-schema failures may reject with a runtime failure instead of\n * `SchemaError`.\n *\n * @see {@link SchemaParser.decodeUnknownPromise} for the adapter that rejects with an `Error` whose cause is `SchemaIssue.Issue`\n *\n * @category decoding\n * @since 3.10.0\n */\nexport function decodeUnknownPromise(schema, options) {\n const parser = decodeUnknownEffect(schema, options);\n return (input, options) => {\n return runSchemaErrorPromise(parser(input, options));\n };\n}\n/**\n * Decodes a typed input (the schema's `Encoded` type) against a schema,\n * returning a `Promise` that resolves with the decoded value or rejects with a\n * {@link SchemaError} for schema mismatches.\n *\n * **When to use**\n *\n * Use when you already have input typed as the schema's `Encoded` type and\n * need decoding to return a JavaScript `Promise` that rejects with\n * `SchemaError` for schema mismatches.\n *\n * **Details**\n *\n * For `unknown` input use `decodeUnknownPromise`.\n * Options may be provided either when creating the decoder or when applying it;\n * application options override creation options.\n *\n * **Gotchas**\n *\n * Non-schema failures may reject with a runtime failure instead of\n * `SchemaError`.\n *\n * @see {@link SchemaParser.decodePromise} for the adapter that rejects with an `Error` whose cause is `SchemaIssue.Issue`\n *\n * @category decoding\n * @since 3.10.0\n */\nexport const decodePromise = decodeUnknownPromise;\n/**\n * Decodes an `unknown` input against a schema synchronously, returning the\n * decoded value or throwing a {@link SchemaError} for schema mismatches.\n *\n * **When to use**\n *\n * Use when you need to validate unknown data at a synchronous boundary and want\n * schema mismatches to throw `SchemaError`.\n *\n * **Details**\n *\n * For input already typed as the schema's `Encoded` type use `decodeSync`.\n * Only service-free schemas can be decoded synchronously. For alternatives that\n * do not throw on schema mismatches, see `decodeUnknownOption`,\n * `decodeUnknownExit`, or `decodeUnknownEffect`. Options may be provided either\n * when creating the decoder or when applying it; application options override\n * creation options.\n *\n * **Gotchas**\n *\n * Non-schema failures may throw a runtime failure instead of `SchemaError`.\n *\n * **Example** (Decoding with a transformation schema)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const NumberFromString = Schema.NumberFromString\n *\n * Schema.decodeUnknownSync(NumberFromString)(\"42\") // => 42\n * ```\n *\n * @see {@link SchemaParser.decodeUnknownSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeUnknownSync(schema, options) {\n const parser = decodeUnknownEffect(schema, options);\n return (input, options) => {\n return runSchemaErrorSync(parser(input, options));\n };\n}\n/**\n * Decodes a typed input (the schema's `Encoded` type) against a schema\n * synchronously, returning the decoded value or throwing a {@link SchemaError}\n * for schema mismatches.\n *\n * **When to use**\n *\n * Use when you already have input typed as the schema's `Encoded` type and\n * want schema mismatches to throw `SchemaError` synchronously.\n *\n * **Details**\n *\n * For `unknown` input use `decodeUnknownSync`.\n * Only service-free schemas can be decoded synchronously. Options may be\n * provided either when creating the decoder or when applying it; application\n * options override creation options.\n *\n * **Gotchas**\n *\n * Non-schema failures may throw a runtime failure instead of `SchemaError`.\n *\n * @see {@link SchemaParser.decodeSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const decodeSync = decodeUnknownSync;\n/**\n * Encodes an `unknown` input against a schema, returning an `Effect` that\n * succeeds with the encoded value or fails with a {@link SchemaError}.\n *\n * **When to use**\n *\n * Use when you need to encode unknown input in an `Effect` whose failure\n * channel is `SchemaError`.\n *\n * **Details**\n *\n * Prefer {@link encodeEffect} when the value is already typed as the schema's\n * `Type`.\n * Options may be provided either when creating the encoder or when applying it;\n * application options override creation options.\n *\n * **Example** (Encoding a value to a string)\n *\n * ```ts import.meta.vitest\n * import { Effect, Schema } from \"effect\"\n *\n * const NumberFromString = Schema.NumberFromString\n *\n * await Effect.runPromise(Schema.encodeUnknownEffect(NumberFromString)(42)) // => \"42\"\n * ```\n *\n * @see {@link SchemaParser.encodeUnknownEffect} for the adapter that fails with `SchemaIssue.Issue` directly\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeUnknownEffect(schema, options) {\n const parser = SchemaParser.encodeUnknownEffect(schema, options);\n return (input, options) => {\n return fromIssueEffect(parser(input, options));\n };\n}\n/**\n * Encodes a typed input (the schema's `Type`) against a schema, returning an\n * `Effect` that succeeds with the encoded value or fails with a\n * {@link SchemaError}.\n *\n * **When to use**\n *\n * Use when you need to encode input already typed as the schema's `Type` in\n * an `Effect` whose failure channel is `SchemaError`.\n *\n * **Details**\n *\n * For `unknown` input use {@link encodeUnknownEffect}.\n * Options may be provided either when creating the encoder or when applying it;\n * application options override creation options.\n *\n * @see {@link SchemaParser.encodeEffect} for the adapter that fails with `SchemaIssue.Issue` directly\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const encodeEffect = encodeUnknownEffect;\n/**\n * Encodes an `unknown` input against a schema synchronously, returning an\n * `Exit` that is either a `Success` with the encoded value or a `Failure`.\n *\n * **When to use**\n *\n * Use when you need to encode unknown input into an `Exit` and capture schema\n * mismatches as `SchemaError`.\n *\n * **Details**\n *\n * Only usable with schemas that have no `EncodingServices` requirement. Prefer\n * {@link encodeExit} when the value is already typed as the schema's `Type`.\n * Options may be provided either when creating the encoder or when applying it;\n * application options override creation options.\n * Schema mismatches are represented by a `Failure` cause containing\n * `SchemaError`.\n *\n * **Gotchas**\n *\n * Schema issue fail reasons are wrapped as `SchemaError`. Defects,\n * interruptions, and other non-schema reasons remain in the returned `Cause`,\n * including when they are mixed with schema issues.\n *\n * @see {@link SchemaParser.encodeUnknownExit} for the adapter whose failure contains `SchemaIssue.Issue` directly\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeUnknownExit(schema, options) {\n const parser = SchemaParser.encodeUnknownExit(schema, options);\n return (input, options) => {\n return fromIssueExit(parser(input, options));\n };\n}\n/**\n * Encodes a typed input (the schema's `Type`) against a schema synchronously,\n * returning an `Exit` that is either a `Success` with the encoded value or a\n * `Failure`.\n *\n * **When to use**\n *\n * Use when you need to encode already typed schema values into an `Exit` and\n * capture schema mismatches as `SchemaError`.\n *\n * **Details**\n *\n * Only usable with schemas that have no `EncodingServices` requirement. For\n * `unknown` input use {@link encodeUnknownExit}.\n * Options may be provided either when creating the encoder or when applying it;\n * application options override creation options.\n * Schema mismatches are represented by a `Failure` cause containing\n * `SchemaError`.\n *\n * **Gotchas**\n *\n * Schema issue fail reasons are wrapped as `SchemaError`. Defects,\n * interruptions, and other non-schema reasons remain in the returned `Cause`,\n * including when they are mixed with schema issues.\n *\n * @see {@link SchemaParser.encodeExit} for the adapter whose failure contains `SchemaIssue.Issue` directly\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const encodeExit = encodeUnknownExit;\n/**\n * Encodes an `unknown` input against a schema, returning an `Option` that is\n * `Some` with the encoded value on success or `None` for schema mismatches.\n *\n * **When to use**\n *\n * Use when you do not know the input type statically and only need to know\n * whether encoding succeeded.\n *\n * **Details**\n *\n * Prefer this over {@link encodeUnknownExit} or {@link encodeUnknownEffect}\n * when you don't need error details. For values already typed as the schema's\n * `Type` use {@link encodeOption}.\n * Options may be provided either when creating the encoder or when applying it;\n * application options override creation options.\n *\n * **Gotchas**\n *\n * Only causes made entirely of schema issues are converted to `None`. Causes\n * that contain defects, interruptions, or other non-schema reasons throw\n * instead.\n *\n * @category encoding\n * @since 3.10.0\n */\nexport const encodeUnknownOption = SchemaParser.encodeUnknownOption;\n/**\n * Encodes a typed input (the schema's `Type`) against a schema, returning an\n * `Option` that is `Some` with the encoded value on success or `None` for schema\n * mismatches.\n *\n * **When to use**\n *\n * Use when you already have a value typed as the schema's `Type` and only need\n * to know whether encoding succeeded.\n *\n * **Details**\n *\n * For `unknown` input use {@link encodeUnknownOption}.\n * Options may be provided either when creating the encoder or when applying it;\n * application options override creation options.\n *\n * **Gotchas**\n *\n * Only causes made entirely of schema issues are converted to `None`. Causes\n * that contain defects, interruptions, or other non-schema reasons throw\n * instead.\n *\n * @category encoding\n * @since 3.10.0\n */\nexport const encodeOption = SchemaParser.encodeOption;\n/**\n * Encodes an `unknown` input against a schema, returning a `Result` that\n * succeeds with the encoded value or fails with a {@link SchemaError} for schema\n * mismatches.\n *\n * **When to use**\n *\n * Use when you do not know the input type statically and want schema mismatches\n * returned as `Result.fail` with `SchemaError`.\n *\n * **Details**\n *\n * For values already typed as the schema's `Type` use {@link encodeResult}.\n * Options may be provided either when creating the encoder or when applying it;\n * application options override creation options.\n * Schema mismatches are returned as `Result.fail` with `SchemaError`.\n *\n * **Gotchas**\n *\n * Only causes made entirely of schema issues are returned as `Result.fail`.\n * Causes that contain defects, interruptions, or other non-schema reasons throw\n * instead.\n *\n * @see {@link SchemaParser.encodeUnknownResult} for the adapter that fails with `SchemaIssue.Issue` directly\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeUnknownResult(schema, options) {\n const parser = SchemaParser.encodeUnknownResult(schema, options);\n return (input, options) => {\n return Result_.mapError(parser(input, options), issue => new SchemaError(issue));\n };\n}\n/**\n * Encodes a typed input (the schema's `Type`) against a schema, returning a\n * `Result` that succeeds with the encoded value or fails with a\n * {@link SchemaError} for schema mismatches.\n *\n * **When to use**\n *\n * Use when you already have a value typed as the schema's `Type` and want schema\n * mismatches returned as `Result.fail` with `SchemaError`.\n *\n * **Details**\n *\n * For `unknown` input use {@link encodeUnknownResult}.\n * Options may be provided either when creating the encoder or when applying it;\n * application options override creation options.\n * Schema mismatches are returned as `Result.fail` with `SchemaError`.\n *\n * **Gotchas**\n *\n * Only causes made entirely of schema issues are returned as `Result.fail`.\n * Causes that contain defects, interruptions, or other non-schema reasons throw\n * instead.\n *\n * @see {@link SchemaParser.encodeResult} for the adapter that fails with `SchemaIssue.Issue` directly\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const encodeResult = encodeUnknownResult;\n/**\n * Encodes an `unknown` input against a schema, returning a `Promise` that\n * resolves with the encoded value or rejects with a {@link SchemaError} for\n * schema mismatches.\n *\n * **When to use**\n *\n * Use when you need encoding of unknown input to return a JavaScript `Promise`\n * that rejects with `SchemaError` for schema mismatches.\n *\n * **Details**\n *\n * For values already typed as the schema's `Type` use {@link encodePromise}.\n * Options may be provided either when creating the encoder or when applying it;\n * application options override creation options.\n *\n * **Gotchas**\n *\n * Non-schema failures may reject with a runtime failure instead of\n * `SchemaError`.\n *\n * @see {@link SchemaParser.encodeUnknownPromise} for the adapter that rejects with an `Error` whose cause is `SchemaIssue.Issue`\n *\n * @category encoding\n * @since 3.10.0\n */\nexport function encodeUnknownPromise(schema, options) {\n const parser = encodeUnknownEffect(schema, options);\n return (input, options) => {\n return runSchemaErrorPromise(parser(input, options));\n };\n}\n/**\n * Encodes a typed input (the schema's `Type`) against a schema, returning a\n * `Promise` that resolves with the encoded value or rejects with a\n * {@link SchemaError} for schema mismatches.\n *\n * **When to use**\n *\n * Use when you already have a value typed as the schema's `Type` and need\n * encoding to return a JavaScript `Promise` that rejects with `SchemaError` for\n * schema mismatches.\n *\n * **Details**\n *\n * For `unknown` input use {@link encodeUnknownPromise}.\n * Options may be provided either when creating the encoder or when applying it;\n * application options override creation options.\n *\n * **Gotchas**\n *\n * Non-schema failures may reject with a runtime failure instead of\n * `SchemaError`.\n *\n * @see {@link SchemaParser.encodePromise} for the adapter that rejects with an `Error` whose cause is `SchemaIssue.Issue`\n *\n * @category encoding\n * @since 3.10.0\n */\nexport const encodePromise = encodeUnknownPromise;\n/**\n * Encodes an `unknown` input against a schema synchronously, throwing a\n * {@link SchemaError} for schema mismatches.\n *\n * **When to use**\n *\n * Use when you need to serialize unknown data at a synchronous boundary and\n * want schema mismatches to throw `SchemaError`.\n *\n * **Details**\n *\n * For alternatives that do not throw on schema mismatches, see\n * {@link encodeUnknownOption}, {@link encodeUnknownExit}, or\n * {@link encodeUnknownEffect}. For values already typed as the schema's `Type`\n * use {@link encodeSync}. Options may be provided either when creating the\n * encoder or when applying it; application options override creation options.\n *\n * **Gotchas**\n *\n * Non-schema failures may throw a runtime failure instead of `SchemaError`.\n *\n * @see {@link SchemaParser.encodeUnknownSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeUnknownSync(schema, options) {\n const parser = encodeUnknownEffect(schema, options);\n return (input, options) => {\n return runSchemaErrorSync(parser(input, options));\n };\n}\n/**\n * Encodes a typed input (the schema's `Type`) against a schema synchronously,\n * throwing a {@link SchemaError} for schema mismatches.\n *\n * **When to use**\n *\n * Use when you already have a value typed as the schema's `Type` and want\n * schema mismatches to throw `SchemaError` synchronously.\n *\n * **Details**\n *\n * For `unknown` input use {@link encodeUnknownSync}.\n * Options may be provided either when creating the encoder or when applying it;\n * application options override creation options.\n *\n * **Gotchas**\n *\n * Non-schema failures may throw a runtime failure instead of `SchemaError`.\n *\n * @see {@link SchemaParser.encodeSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const encodeSync = encodeUnknownSync;\n/**\n * Creates a schema from an AST (Abstract Syntax Tree) node.\n *\n * **Details**\n *\n * This is the fundamental constructor for all schemas in the Effect Schema\n * library. It takes an AST node and wraps it in a fully-typed schema that\n * preserves all type information and provides the complete schema API.\n *\n * The `make` function is used internally to create all primitive schemas like\n * `String`, `Number`, `Boolean`, etc., as well as more complex schemas. It's\n * the bridge between the untyped AST representation and the strongly-typed\n * schema.\n *\n * @category constructors\n * @since 3.10.0\n */\nexport const make = InternalMake.make;\n/**\n * Checks whether a value is a `Schema`.\n *\n * @category guards\n * @since 3.10.0\n */\nexport function isSchema(u) {\n return Predicate.hasProperty(u, TypeId) && u[TypeId] === TypeId;\n}\n/**\n * Creates an exact optional key schema for struct fields. Unlike `optional`,\n * this creates exact optional properties (not `| undefined`) that can be\n * completely omitted from the object.\n *\n * **Example** (Creating a struct with optional key)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.Struct({\n * name: Schema.String,\n * age: Schema.optionalKey(Schema.Number)\n * })\n *\n * // Type: { readonly name: string; readonly age?: number }\n * type Person = typeof schema[\"Type\"]\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const optionalKey = /*#__PURE__*/Struct_.lambda(schema => make(SchemaAST.optionalKey(schema.ast), {\n schema\n}));\n/**\n * Reverses `optionalKey` and returns the inner required schema.\n *\n * **When to use**\n *\n * Use to remove optional-key wrapping from a schema field that was previously\n * wrapped with {@link optionalKey}.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const requiredKey = /*#__PURE__*/Struct_.lambda(self => self.schema);\n/**\n * Marks a struct field as optional, allowing the key to be absent or\n * `undefined`.\n *\n * **Details**\n *\n * The resulting property may be absent or explicitly set to `undefined`.\n * Equivalent to `optionalKey(UndefinedOr(S))`.\n *\n * Use {@link optionalKey} instead if you want exact optional semantics (absent\n * only, not `undefined`).\n *\n * **Example** (Defining an optional field accepting undefined)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.Struct({\n * name: Schema.String,\n * age: Schema.optional(Schema.Number)\n * })\n *\n * // { readonly name: string; readonly age?: number | undefined }\n * type Person = typeof schema.Type\n * ```\n *\n * @category combinators\n * @since 3.10.0\n */\nexport const optional = /*#__PURE__*/Struct_.lambda(self => {\n const schema = UndefinedOr(self);\n return make(SchemaAST.optional(self.ast), {\n schema\n });\n});\n/**\n * Reverses `optional` and returns the inner schema.\n *\n * **When to use**\n *\n * Use to remove optional wrapping from a schema field that was previously\n * wrapped with {@link optional}.\n *\n * **Details**\n *\n * This also unwraps the `UndefinedOr` member added by `optional`.\n *\n * @category combinators\n * @since 3.10.0\n */\nexport const required = /*#__PURE__*/Struct_.lambda(self => self.schema.members[0]);\n/**\n * Makes a struct field mutable (removes the `readonly` modifier on the property).\n * Use {@link readonlyKey} to reverse.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const mutableKey = /*#__PURE__*/Struct_.lambda(schema => make(SchemaAST.mutableKey(schema.ast), {\n schema\n}));\n/**\n * Reverses `mutableKey` and returns the inner readonly schema.\n *\n * **When to use**\n *\n * Use to remove mutable-key wrapping from a schema field that was previously\n * wrapped with {@link mutableKey}.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const readonlyKey = /*#__PURE__*/Struct_.lambda(self => self.schema);\n/**\n * Extracts the type-side schema: sets `Encoded` to equal the decoded `Type`,\n * discarding the encoding transformation path.\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const toType = /*#__PURE__*/Struct_.lambda(schema => make(SchemaAST.toType(schema.ast), {\n schema\n}));\n/**\n * Extracts the encoded-side schema: sets `Type` to equal the `Encoded`,\n * discarding the decoding transformation path.\n *\n * @category transforming\n * @since 4.0.0\n */\nexport const toEncoded = /*#__PURE__*/Struct_.lambda(schema => make(SchemaAST.toEncoded(schema.ast), {\n schema\n}));\nconst FlipTypeId = \"~effect/Schema/flip\";\nfunction isFlip$(schema) {\n return Predicate.hasProperty(schema, FlipTypeId) && schema[FlipTypeId] === FlipTypeId;\n}\nexport function flip(schema) {\n if (isFlip$(schema)) {\n return schema.schema.rebuild(SchemaAST.flip(schema.ast));\n }\n return make(SchemaAST.flip(schema.ast), {\n [FlipTypeId]: FlipTypeId,\n schema\n });\n}\n/**\n * Creates a schema for a single literal value (string, number, bigint, boolean, or null).\n *\n * **Example** (Defining a string literal)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.Literal(\"hello\")\n * // Type: Schema.Literal<\"hello\">\n * Schema.decodeSync(schema)(\"hello\") // => \"hello\"\n * ```\n *\n * @see {@link Literals} for a schema that represents a union of literals.\n * @see {@link tag} for a schema that represents a literal value that can be\n * used as a discriminator field in tagged unions and has a constructor default.\n * @category constructors\n * @since 3.10.0\n */\nexport function Literal(literal) {\n const out = make(new SchemaAST.Literal(literal), {\n literal,\n transform(to) {\n return out.pipe(decodeTo(Literal(to), {\n decode: SchemaGetter.transform(() => to),\n encode: SchemaGetter.transform(() => literal)\n }));\n }\n });\n return out;\n}\nfunction templateLiteralParts(parts) {\n return parts.map(part => isSchema(part) ? part.ast : new SchemaAST.Literal(part));\n}\n/**\n * Creates a schema that validates strings by matching ordered template literal\n * parts.\n *\n * **When to use**\n *\n * Use when the decoded value should remain the matched string and you do not\n * need the individual template parts parsed into a tuple.\n *\n * **Details**\n *\n * Each part can be a literal `string`, `number`, or `bigint`, or a schema whose\n * encoded type is `string`, `number`, or `bigint`. Checks on string, number,\n * and bigint schema parts are applied while matching each segment.\n *\n * **Gotchas**\n *\n * Parts must not contain encodings, including inside unions or nested templates.\n * Construction throws for transformed parts even when their decoded and encoded\n * types are the same. Use {@link TemplateLiteralParser} to decode transformed parts.\n * Brands and supported checks without encodings remain valid.\n *\n * **Example** (Defining a URL path pattern)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.TemplateLiteral([\"/user/\", Schema.Number])\n * Schema.is(schema)(\"/user/123\") // => true\n * ```\n *\n * @see {@link TemplateLiteralParser} for a schema that also parses matched parts into a tuple.\n * @category constructors\n * @since 3.10.0\n */\nexport function TemplateLiteral(parts) {\n return make(new SchemaAST.TemplateLiteral(templateLiteralParts(parts)), {\n parts\n });\n}\n/**\n * Schema for parsing matched template literal strings into typed tuple parts.\n *\n * **When to use**\n *\n * Use to validate a template literal string and decode the matched parts into\n * typed values.\n *\n * **Details**\n *\n * Unlike {@link TemplateLiteral}, this schema decodes the matched string into a\n * readonly tuple with one element per schema part. Checks on string, number,\n * and bigint schema parts are applied while matching each segment.\n * The source template uses the encoded sides of the parts; the tuple retains\n * their transformations, checks, and decoding and encoding service requirements.\n *\n * **Gotchas**\n *\n * Ambiguous templates use greedy segmentation with backtracking. Encoding a\n * tuple and decoding the resulting string can therefore produce a different\n * tuple when a segment contains a separator used by the template.\n *\n * **Example** (Parsing path parameters)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.TemplateLiteralParser([\"/user/\", Schema.NumberFromString])\n * Schema.decodeSync(schema)(\"/user/42\") // => [\"/user/\", 42]\n * ```\n *\n * @see {@link TemplateLiteral} for a validation-only version that keeps the string encoded.\n * @category constructors\n * @since 3.10.0\n */\nexport function TemplateLiteralParser(parts) {\n return make(SchemaAST.templateLiteralParser(templateLiteralParts(parts)), {\n parts\n });\n}\n/**\n * Creates a schema from a TypeScript enum object. Validates that the input is one of the enum's values.\n * Numeric enum values must be finite.\n *\n * **Gotchas**\n *\n * Throws when a numeric member is `NaN`, `Infinity`, or `-Infinity`.\n *\n * **Example** (Defining a direction enum)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * enum Direction {\n * Up = \"Up\",\n * Down = \"Down\"\n * }\n *\n * const schema = Schema.Enum(Direction)\n * Schema.decodeSync(schema)(Direction.Up) // => \"Up\"\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function Enum(enums) {\n return make(new SchemaAST.Enum(Object.keys(enums).filter(key => typeof enums[enums[key]] !== \"number\").map(key => [key, enums[key]])), {\n enums\n });\n}\n/**\n * Schema for the `never` type. Always fails validation — no value satisfies it.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const Never = /*#__PURE__*/make(SchemaAST.never);\n/**\n * Schema for the `any` type. Accepts any value without validation.\n *\n * @see {@link Unknown} for a safer alternative that uses `unknown`.\n * @category schemas\n * @since 3.10.0\n */\nexport const Any = /*#__PURE__*/make(SchemaAST.any);\n/**\n * Schema for the `unknown` type. Accepts any value without validation.\n *\n * **When to use**\n *\n * Use as a top schema when you need to accept any input while preserving\n * TypeScript's `unknown` safety at use sites.\n *\n * @see {@link Any} for the `any` variant.\n * @category schemas\n * @since 3.10.0\n */\nexport const Unknown = /*#__PURE__*/make(SchemaAST.unknown);\n/**\n * Schema for the `null` literal. Validates that the input is strictly `null`.\n *\n * @see {@link NullOr} for a union with another schema.\n * @category schemas\n * @since 3.10.0\n */\nexport const Null = /*#__PURE__*/make(SchemaAST.null);\n/**\n * Schema for the `undefined` literal. Validates that the input is strictly `undefined`.\n *\n * @see {@link UndefinedOr} for a union with another schema.\n * @category schemas\n * @since 3.10.0\n */\nexport const Undefined = /*#__PURE__*/make(SchemaAST.undefined);\n/**\n * Schema for `string` values. Validates that the input is `typeof` `\"string\"`.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const String = /*#__PURE__*/make(SchemaAST.string);\n/**\n * Schema for `number` values, including `NaN`, `Infinity`, and `-Infinity`.\n *\n * **Details**\n *\n * Default JSON serializer:\n *\n * - Finite numbers are serialized as numbers.\n * - Non-finite values are serialized as strings (`\"NaN\"`, `\"Infinity\"`, `\"-Infinity\"`).\n *\n * @see {@link Finite} for a schema that excludes non-finite values.\n * @category schemas\n * @since 4.0.0\n */\nexport const Number = /*#__PURE__*/make(SchemaAST.number);\n/**\n * Schema for `boolean` values. Validates that the input is `typeof` `\"boolean\"`.\n *\n * **When to use**\n *\n * Use to validate values that are already JavaScript booleans.\n *\n * @see {@link BooleanFromBit} for a schema that decodes bit literals `0` or `1` into a boolean\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const Boolean = /*#__PURE__*/make(SchemaAST.boolean);\n/**\n * Schema for `symbol` values. Validates that the input is `typeof` `\"symbol\"`.\n *\n * @see {@link UniqueSymbol} for a schema that matches a specific symbol.\n * @category schemas\n * @since 4.0.0\n */\nexport const Symbol = /*#__PURE__*/make(SchemaAST.symbol);\n/**\n * Schema for `bigint` values. Validates that the input is `typeof` `\"bigint\"`.\n *\n * **When to use**\n *\n * Use when the input is already a bigint and the schema should validate and\n * preserve bigint values without parsing from another representation.\n *\n * @see {@link BigIntFromString} for parsing string input into a bigint\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const BigInt = /*#__PURE__*/make(SchemaAST.bigInt);\n/**\n * Schema for a TypeScript `void` return value.\n *\n * **When to use**\n *\n * Use when you need to model the return value of a function, RPC, or endpoint\n * whose result is intentionally ignored.\n *\n * **Details**\n *\n * Runtime parsing accepts any present value and discards it, producing\n * `undefined`. The public decoded and encoded TypeScript representation remains\n * `void`, so typed construction, decoding, and encoding APIs are still modeled\n * as `void`.\n *\n * @see {@link Undefined} for a schema that matches only the exact `undefined` value.\n * @category schemas\n * @since 3.10.0\n */\nexport const Void = /*#__PURE__*/make(SchemaAST.void);\n/**\n * Schema for the `object` type. Validates that the input is a non-null object or function\n * (i.e. `typeof value === \"object\" && value !== null || typeof value === \"function\"`).\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const ObjectKeyword = /*#__PURE__*/make(SchemaAST.objectKeyword);\n/**\n * Creates a schema for a specific symbol. Only that exact symbol satisfies the schema.\n *\n * **Gotchas**\n *\n * Only globally registered symbols have a JSON encoding. Their canonical JSON\n * form is the exact string returned by `String(symbol)`. A local symbol cannot\n * be encoded as JSON.\n *\n * **Example** (Defining a specific symbol)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const mySymbol = Symbol.for(\"mySymbol\")\n * const schema = Schema.UniqueSymbol(mySymbol)\n * Schema.decodeSync(schema)(mySymbol) === mySymbol // => true\n * ```\n *\n * @see {@link Symbol} for a schema that accepts any symbol.\n * @category constructors\n * @since 4.0.0\n */\nexport function UniqueSymbol(symbol) {\n return make(new SchemaAST.UniqueSymbol(symbol));\n}\nfunction makeStruct(ast, fields) {\n return make(ast, {\n fields,\n mapFields(f, options) {\n const fields = f(this.fields);\n return makeStruct(SchemaAST.struct(fields, options?.unsafePreserveChecks ? this.ast.checks : undefined), fields);\n }\n });\n}\n/**\n * Defines a struct schema from a map of field schemas.\n *\n * **Details**\n *\n * Each field value is a schema. Use {@link optionalKey} or {@link optional} to\n * mark fields as optional, and {@link mutableKey} to mark them as mutable.\n *\n * The resulting schema's `Type` is a readonly object type with the fields'\n * decoded types. The `Encoded` form mirrors the field schemas' encoded types.\n * Declared fields may be inherited and are copied to own properties in the\n * output. The `__proto__` field is accepted only when it is an own property.\n * Parsing does not guarantee that output keys retain their input order.\n *\n * **Example** (Defining a basic struct)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const Person = Schema.Struct({\n * name: Schema.String,\n * age: Schema.Number,\n * email: Schema.optionalKey(Schema.String)\n * })\n *\n * // { readonly name: string; readonly age: number; readonly email?: string }\n * type Person = typeof Person.Type\n *\n * Schema.decodeUnknownSync(Person)({ name: \"Alice\", age: 30 }) // => { name: \"Alice\", age: 30 }\n * ```\n *\n * @category constructors\n * @since 3.10.0\n */\nexport function Struct(fields) {\n return makeStruct(SchemaAST.struct(fields, undefined), fields);\n}\n/**\n * Adds fields to a struct schema through a struct-mapping lambda.\n *\n * **When to use**\n *\n * Use to add the same fields to an existing struct or every struct member of a\n * union.\n *\n * **Details**\n *\n * This is a shortcut for `MyStruct.mapFields(Struct.assign(fields))`.\n *\n * **Example** (Adding fields to a union of structs)\n *\n * ```ts import.meta.vitest\n * import { Schema, Tuple } from \"effect\"\n *\n * // Add a new field to all members of a union of structs\n * const schema = Schema.Union([\n * Schema.Struct({ a: Schema.String }),\n * Schema.Struct({ b: Schema.Number })\n * ]).mapMembers(Tuple.map(Schema.fieldsAssign({ c: Schema.Number })))\n * Schema.decodeSync(schema)({ a: \"a\", c: 1 }) // => { a: \"a\", c: 1 }\n * ```\n *\n * @category combinators\n * @since 4.0.0\n */\nexport function fieldsAssign(fields) {\n return Struct_.lambda(struct => struct.mapFields(Struct_.assign(fields)));\n}\nconst canonicalPropertyKey = key => typeof key === \"symbol\" ? key : globalThis.String(key);\n/**\n * Renames struct keys in the encoded form without changing the decoded type.\n *\n * **Details**\n *\n * Takes a partial mapping `{ decodedKey: encodedKey }` and produces a\n * transformation schema that decodes from the renamed keys and encodes back to\n * the renamed keys. Keys not present in the mapping are left unchanged.\n * If two existing fields would produce the same encoded key, construction\n * fails.\n *\n * **Example** (Renaming `name` to `full_name` in the encoded form)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const Person = Schema.Struct({ name: Schema.String, age: Schema.Number })\n * const Encoded = Person.pipe(Schema.encodeKeys({ name: \"full_name\" }))\n *\n * // Decodes { full_name: \"Alice\", age: 30 } → { name: \"Alice\", age: 30 }\n * Schema.decodeUnknownSync(Encoded)({ full_name: \"Alice\", age: 30 }) // => { name: \"Alice\", age: 30 }\n * ```\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function encodeKeys(mapping) {\n return function (self) {\n const fields = {};\n const appliedMapping = Object.create(null);\n const reverseMapping = Object.create(null);\n const seenEncodedKeys = new Set();\n for (const k of Reflect.ownKeys(self.fields)) {\n const encoded = toEncoded(self.fields[k]);\n const hasMapping = Object.hasOwn(mapping, k);\n const encodedKey = hasMapping ? mapping[k] : k;\n const canonical = canonicalPropertyKey(encodedKey);\n if (seenEncodedKeys.has(canonical)) {\n throw new globalThis.Error(`Duplicate encoded keys: ${formatPropertyKey(encodedKey)}`);\n }\n seenEncodedKeys.add(canonical);\n InternalRecord.assignProperty(fields, encodedKey, encoded);\n if (hasMapping) {\n appliedMapping[k] = encodedKey;\n reverseMapping[encodedKey] = k;\n }\n }\n return Struct(fields).pipe(decodeTo(self, SchemaTransformation.transform({\n decode: Struct_.renameKeys(reverseMapping),\n encode: Struct_.renameKeys(appliedMapping)\n })));\n };\n}\n/**\n * Adds derived fields to a struct schema during decoding.\n *\n * **Details**\n *\n * Each new field is derived from the decoded struct value via a function that\n * returns `Option`. On encoding the derived fields are stripped. This allows\n * computed or enriched fields to live in the decoded type without appearing in\n * the encoded form.\n *\n * **Example** (Adding a computed `fullName` field)\n *\n * ```ts import.meta.vitest\n * import { Option, Schema } from \"effect\"\n *\n * const Person = Schema.Struct({ first: Schema.String, last: Schema.String })\n * const Extended = Person.pipe(\n * Schema.extendTo(\n * { fullName: Schema.String },\n * { fullName: (p) => Option.some(`${p.first} ${p.last}`) }\n * )\n * )\n *\n * const alice = Schema.decodeUnknownSync(Extended)({ first: \"Alice\", last: \"Smith\" })\n * alice.fullName // => \"Alice Smith\"\n * ```\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function extendTo(fields, derive) {\n return self => {\n const f = Record_.map(self.fields, toType);\n const to = Struct({\n ...f,\n ...fields\n });\n return self.pipe(decodeTo(to, SchemaTransformation.transform({\n decode: input => {\n const out = {\n ...input\n };\n for (const k in fields) {\n const f = derive[k];\n const o = f(input);\n if (Option_.isSome(o)) {\n InternalRecord.assignProperty(out, k, o.value);\n }\n }\n return out;\n },\n encode: input => {\n const out = {\n ...input\n };\n for (const k in fields) {\n delete out[k];\n }\n return out;\n }\n })));\n };\n}\n/**\n * Defines a record schema whose dynamic properties are selected by a key schema\n * and decoded with a value schema.\n *\n * **Details**\n *\n * For dynamic keys, the key schema selects matching own properties and the\n * value schema decodes or encodes only those selected properties. Checks on\n * string, number, symbol, and template literal key schemas narrow which\n * properties are selected.\n *\n * For transformed key schemas, property selection is based on encoded property\n * names before the selected key is decoded.\n *\n * **Gotchas**\n *\n * When decoded or encoded key transformations produce the same property key,\n * sequential parsing applies selected own properties in selection order, so\n * the later selected property overwrites the earlier value. Dynamic key\n * selection always examines own properties. Finite literal keys are declared\n * fields and may therefore be inherited. Output key order is not guaranteed.\n *\n * **Example** (Defining a string-keyed record of numbers)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.Record(Schema.String, Schema.Number)\n *\n * // { readonly [x: string]: number }\n * type R = typeof schema.Type\n *\n * Schema.decodeUnknownSync(schema)({ a: 1, b: 2 }) // => { a: 1, b: 2 }\n * ```\n *\n * @category constructors\n * @since 3.10.0\n */\nexport function Record(key, value) {\n return make(SchemaAST.record(key.ast, value.ast), {\n key,\n value\n });\n}\n/**\n * Extends a struct schema with one or more record (index-signature) schemas,\n * producing a schema whose decoded type intersects the struct and all records.\n *\n * **Gotchas**\n *\n * TypeScript index signatures also apply to fixed keys. `StructWithRest` does\n * not reject incompatible fixed fields at the call site; use\n * `StructWithRest.ValidateRecords` when you want an explicit type-level\n * compatibility check.\n *\n * **Example** (Defining structs with string-indexed extra keys)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.StructWithRest(\n * Schema.Struct({ id: Schema.Number }),\n * [Schema.Record(Schema.String, Schema.Number)]\n * )\n *\n * // { readonly id: number, readonly [x: string]: number }\n * type T = typeof schema.Type\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function StructWithRest(schema, records) {\n return make(SchemaAST.structWithRest(schema.ast, records.map(SchemaAST.getAST)), {\n schema,\n records\n });\n}\nfunction makeTuple(ast, elements) {\n return make(ast, {\n elements,\n mapElements(f, options) {\n const elements = f(this.elements);\n return makeTuple(SchemaAST.tuple(elements, options?.unsafePreserveChecks ? this.ast.checks : undefined), elements);\n }\n });\n}\n/**\n * Defines a fixed-length tuple schema from an array of element schemas.\n *\n * **Example** (Defining a pair of string and number)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.Tuple([Schema.String, Schema.Number])\n *\n * Schema.decodeUnknownSync(schema)([\"hello\", 42]) // => [\"hello\", 42]\n * ```\n *\n * @category constructors\n * @since 3.10.0\n */\nexport function Tuple(elements) {\n return makeTuple(SchemaAST.tuple(elements), elements);\n}\n/**\n * Extends a fixed-length tuple schema with a variadic rest segment.\n *\n * **Details**\n *\n * The resulting tuple starts with the fixed elements from `schema`. The first\n * schema in `rest` is the repeatable element schema, and any additional schemas\n * in `rest` are required trailing tuple elements after the variadic segment. For\n * example, `[Schema.Boolean, Schema.String]` represents zero or more booleans\n * followed by a final string.\n *\n * **Example** (Defining tuples with rest elements)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * // [string, number, ...boolean[]]\n * const schema = Schema.TupleWithRest(\n * Schema.Tuple([Schema.String, Schema.Number]),\n * [Schema.Boolean]\n * )\n *\n * Schema.decodeUnknownSync(schema)([\"hello\", 1, true, false]) // => [\"hello\", 1, true, false]\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function TupleWithRest(schema, rest) {\n return make(SchemaAST.tupleWithRest(schema.ast, rest.map(SchemaAST.getAST)), {\n schema,\n rest\n });\n}\n/**\n * @category constructors\n * @since 4.0.0\n */\nconst ArraySchema = /*#__PURE__*/Struct_.lambda(schema => make(new SchemaAST.Arrays(false, [], [schema.ast]), {\n value: schema\n}));\nexport {\n/**\n * Defines a `ReadonlyArray` schema for a given element schema.\n *\n * **Example** (Defining an array of strings)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.Array(Schema.String)\n *\n * Schema.decodeUnknownSync(schema)([\"a\", \"b\", \"c\"]) // => [\"a\", \"b\", \"c\"]\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nArraySchema as Array };\n/** @internal */\nexport function withArrayLengthConstraints(self, minimum, maximum) {\n if (minimum !== undefined && maximum !== undefined) {\n return self.check(isLengthBetween(minimum, maximum));\n }\n if (minimum !== undefined) return self.check(isMinLength(minimum));\n if (maximum !== undefined) return self.check(isMaxLength(maximum));\n return self;\n}\n/**\n * Defines a non-empty `ReadonlyArray` schema — at least one element required.\n * Type is `readonly [T, ...T[]]`.\n *\n * **Example** (Defining a non-empty array of numbers)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.NonEmptyArray(Schema.Number)\n *\n * Schema.decodeUnknownSync(schema)([1, 2, 3]) // => [1, 2, 3]\n * ```\n *\n * @category constructors\n * @since 3.10.0\n */\nexport const NonEmptyArray = /*#__PURE__*/Struct_.lambda(schema => make(new SchemaAST.Arrays(false, [schema.ast], [schema.ast]), {\n value: schema\n}));\n/**\n * Creates a schema that accepts either a value decoded by `schema` or an array\n * decoded by `Schema.Array(schema)`, then returns an array.\n *\n * **When to use**\n *\n * Use to accept input that may be provided either as one item or as an array,\n * while normalizing decoded values to a readonly array.\n *\n * **Details**\n *\n * During encoding, one-element arrays are encoded as the single element. Empty\n * arrays and arrays with two or more elements are encoded as arrays.\n *\n * **Gotchas**\n *\n * The single-value branch is tried before the array branch. If `schema` itself\n * accepts arrays, an array input can be treated as one value and wrapped in a\n * one-element array.\n *\n * @see {@link Array} for accepting only array input\n * @see {@link NonEmptyArray} for requiring at least one decoded element\n *\n * @category constructors\n * @since 3.10.0\n */\nexport function ArrayEnsure(schema) {\n const many = ArraySchema(schema);\n const to = ArraySchema(toType(schema));\n const one = decodeTo(Tuple([Unknown]), SchemaTransformation.transform({\n decode: value => [value],\n encode: ([value]) => value\n }))(schema);\n return make(Union([one, many]).pipe(decodeTo(to)).ast, {\n from: Union([schema, many]),\n to\n });\n}\n/**\n * Returns a new array schema that ensures all elements are unique.\n *\n * **Details**\n *\n * The equivalence used to determine uniqueness is the one provided by\n * `Schema.toEquivalence(item)`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function UniqueArray(item) {\n return ArraySchema(item).check(isUnique());\n}\n/**\n * Makes an array or tuple schema mutable, removing the `readonly` modifier.\n *\n * **Gotchas**\n *\n * This combinator does not support an encoding attached to the array or tuple\n * node and throws if one is present. Encodings on element schemas are\n * supported.\n *\n * **Example** (Defining mutable arrays)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.mutable(Schema.Array(Schema.Number))\n *\n * // number[] (mutable)\n * type T = typeof schema.Type\n * const value: T = [1, 2]\n * value.push(3)\n * value // => [1, 2, 3]\n * ```\n *\n * @category transforming\n * @since 3.10.0\n */\nexport const mutable = /*#__PURE__*/Struct_.lambda(schema => make(SchemaAST.mutable(schema.ast), {\n schema\n}));\nfunction makeUnion(ast, members) {\n return make(ast, {\n members,\n mapMembers(f, options) {\n const members = f(this.members);\n return makeUnion(SchemaAST.union(members, this.ast.options, options?.unsafePreserveChecks ? this.ast.checks : undefined), members);\n }\n });\n}\n/**\n * Creates a union schema from an array of member schemas. Members are tested in\n * order; the first match is returned.\n *\n * **Details**\n *\n * Optionally, specify `mode`:\n * - `\"anyOf\"` (default) — matches if any member matches.\n * - `\"oneOf\"` — matches if exactly one member matches.\n *\n * **Example** (Defining a string or number union)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.Union([Schema.String, Schema.Number])\n *\n * Schema.decodeUnknownSync(schema)(\"hello\") // => \"hello\"\n * Schema.decodeUnknownSync(schema)(42) // => 42\n * ```\n *\n * @category constructors\n * @since 3.10.0\n */\nexport function Union(members, options) {\n return makeUnion(SchemaAST.union(members, options, undefined), members);\n}\n/**\n * Creates a union schema from an array of literal values.\n *\n * **Example** (Defining status codes)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.Literals([\"active\", \"inactive\", \"pending\"])\n * Schema.decodeSync(schema)(\"active\") // => \"active\"\n * ```\n *\n * @see {@link Literal} for a schema that represents a single literal.\n * @category constructors\n * @since 4.0.0\n */\nexport function Literals(literals) {\n const members = literals.map(Literal);\n return make(SchemaAST.union(members, undefined, undefined), {\n literals,\n members,\n mapMembers(f) {\n return Union(f(this.members));\n },\n pick(literals) {\n return Literals(literals);\n },\n transform(to) {\n return Union(members.map((member, index) => member.transform(to[index])));\n }\n });\n}\n/**\n * Creates a union schema of `S | null`.\n *\n * @category constructors\n * @since 3.10.0\n */\nexport const NullOr = /*#__PURE__*/Struct_.lambda(self => Union([self, Null]));\n/**\n * Creates a union schema of `S | undefined`.\n *\n * @category constructors\n * @since 3.10.0\n */\nexport const UndefinedOr = /*#__PURE__*/Struct_.lambda(self => Union([self, Undefined]));\n/**\n * Creates a union schema of `S | null | undefined`.\n *\n * @category constructors\n * @since 3.10.0\n */\nexport const NullishOr = /*#__PURE__*/Struct_.lambda(self => Union([self, Null, Undefined]));\n/**\n * Creates a suspended schema that defers evaluation until needed. This is\n * essential for creating recursive schemas where a schema references itself,\n * preventing infinite recursion during schema definition.\n *\n * **Example** (Defining recursive tree schemas)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * interface Tree {\n * readonly value: number\n * readonly children: ReadonlyArray<Tree>\n * }\n *\n * const Tree = Schema.Struct({\n * value: Schema.Number,\n * children: Schema.Array(Schema.suspend((): Schema.Codec<Tree> => Tree))\n * })\n * Schema.decodeSync(Tree)({ value: 1, children: [] }) // => { value: 1, children: [] }\n * ```\n *\n * @category constructors\n * @since 3.10.0\n */\nexport function suspend(f) {\n return make(new SchemaAST.Suspend(() => f().ast));\n}\n/**\n * Attaches one or more filter checks to a schema without changing the\n * TypeScript type.\n *\n * **Example** (Adding checks to a schema)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const AgeSchema = Schema.Finite.pipe(\n * Schema.check(Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(120))\n * )\n * Schema.is(AgeSchema)(42) // => true\n * Schema.is(AgeSchema)(121) // => false\n * ```\n *\n * @category filtering\n * @since 4.0.0\n */\nexport function check(...checks) {\n return self => self.check(...checks);\n}\n/**\n * Narrows the TypeScript type of a schema's output via a type guard predicate,\n * attaching the guard as a runtime filter check.\n *\n * **Details**\n *\n * The `annotations` parameter annotates the filter created by the refinement.\n * With the default formatter, failed refinements use `message` first,\n * `expected` second, and `<filter>` when neither is provided. `identifier`\n * names type-level failures before the refinement runs; it does not name the\n * failed refinement itself.\n *\n * @category filtering\n * @since 3.10.0\n */\nexport function refine(refinement, annotations) {\n return schema => make(SchemaAST.appendChecks(schema.ast, [SchemaAST.makeFilterByGuard(refinement, annotations)]), {\n schema\n });\n}\n/**\n * Adds a nominal brand to a schema, intersecting the output type with\n * `Brand.Brand<B>` to prevent accidental mixing of structurally identical types.\n *\n * **When to use**\n *\n * Use to make values decoded by an existing schema nominally distinct when the\n * schema already carries the runtime validation you need.\n *\n * **Gotchas**\n *\n * `brand` adds brand metadata and narrows the TypeScript output type, but it\n * does not add runtime checks.\n *\n * @see {@link fromBrand} for applying a Brand constructor's checks along with the brand tag\n *\n * @category branding\n * @since 3.10.0\n */\nexport function brand(identifier) {\n return schema => make(SchemaAST.brand(schema.ast, identifier), {\n schema,\n identifier\n });\n}\n/**\n * Creates a branded schema from a {@link Brand.Constructor}, applying the\n * constructor's checks and brand tag to the underlying schema.\n *\n * @category branding\n * @since 3.10.0\n */\nexport function fromBrand(identifier, ctor) {\n return self => {\n return (ctor.checks ? self.check(...ctor.checks) : self).pipe(brand(identifier));\n };\n}\n/**\n * Intercepts the decoding pipeline of a schema.\n *\n * **Details**\n *\n * The provided function receives the current decoding `Effect` and `ParseOptions`,\n * and returns a new `Effect` — potentially adding service requirements (`RD`),\n * recovering from errors, or augmenting the result.\n *\n * **Example** (Logging decode failures)\n *\n * ```ts import.meta.vitest\n * import { Effect, Schema } from \"effect\"\n *\n * const events: Array<string> = []\n * const Logged = Schema.String.pipe(\n * Schema.middlewareDecoding((effect) =>\n * Effect.tapError(effect, () => Effect.sync(() => events.push(\"decode failed\")))\n * )\n * )\n * Effect.runSync(Effect.result(Schema.decodeUnknownEffect(Logged)(42)))\n * events // => [\"decode failed\"]\n * ```\n *\n * @see {@link catchDecoding} for a simpler error-recovery variant\n * @category decoding\n * @since 4.0.0\n */\nexport function middlewareDecoding(decode) {\n return schema => make(SchemaAST.middlewareDecoding(schema.ast, new SchemaTransformation.Middleware(decode, identity)), {\n schema\n });\n}\n/**\n * Intercepts the encoding pipeline of a schema.\n *\n * **Details**\n *\n * The provided function receives the current encoding `Effect` and `ParseOptions`,\n * and returns a new `Effect` — potentially adding service requirements (`RE`),\n * recovering from errors, or augmenting the result.\n *\n * **Example** (Logging encode failures)\n *\n * ```ts import.meta.vitest\n * import { Effect, Schema } from \"effect\"\n *\n * const events: Array<string> = []\n * const Logged = Schema.String.pipe(\n * Schema.middlewareEncoding((effect) =>\n * Effect.tapError(effect, () => Effect.sync(() => events.push(\"encode failed\")))\n * )\n * )\n * Effect.runSync(Effect.result(Schema.encodeUnknownEffect(Logged)(42)))\n * events // => [\"encode failed\"]\n * ```\n *\n * @see {@link catchEncoding} for a simpler error-recovery variant\n * @category encoding\n * @since 4.0.0\n */\nexport function middlewareEncoding(encode) {\n return schema => make(SchemaAST.middlewareEncoding(schema.ast, new SchemaTransformation.Middleware(identity, encode)), {\n schema\n });\n}\n/**\n * Recovers from a decoding error by providing a fallback value.\n *\n * **Details**\n *\n * The handler receives the `Issue` and returns an `Effect` that either\n * succeeds with a fallback value or re-fails with a (possibly different) issue.\n *\n * **Example** (Returning a default on decode failure)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, Schema } from \"effect\"\n *\n * const schema = Schema.Number.pipe(\n * Schema.catchDecoding((_issue) => Effect.succeed(Option.some(0)))\n * )\n * Effect.runSync(Schema.decodeUnknownEffect(schema)(\"invalid\")) // => 0\n * ```\n *\n * @see {@link catchDecodingWithContext} to add service requirements to the handler\n * @category error handling\n * @since 4.0.0\n */\nexport function catchDecoding(f) {\n return catchDecodingWithContext(f);\n}\n/**\n * Recovers from a decoding error with a handler that may require Effect services.\n *\n * **When to use**\n *\n * Use when you need decoding fallback logic to require services from the Effect\n * context.\n *\n * **Details**\n *\n * The handler receives the `Issue` and returns an `Effect` that either succeeds\n * with a fallback value or re-fails with a (possibly different) issue. The\n * handler's services are added to the schema's decoding services.\n *\n * @see {@link catchDecoding} for recovery handlers that do not require services\n * @see {@link middlewareDecoding} for intercepting or replacing the full decoding pipeline\n *\n * @category error handling\n * @since 4.0.0\n */\nexport function catchDecodingWithContext(f) {\n return self => middlewareDecoding(Effect.catchEager(f))(self);\n}\n/**\n * Recovers from an encoding error by providing a fallback value.\n *\n * **Details**\n *\n * The handler receives the `Issue` and returns an `Effect` that either\n * succeeds with a fallback value or re-fails with a (possibly different) issue.\n *\n * @see {@link catchEncodingWithContext} to add service requirements to the handler\n * @category error handling\n * @since 4.0.0\n */\nexport function catchEncoding(f) {\n return catchEncodingWithContext(f);\n}\n/**\n * Recovers from an encoding error with a handler that may require Effect services.\n *\n * **When to use**\n *\n * Use when you need encoding fallback logic to require services from the Effect\n * context.\n *\n * **Details**\n *\n * The handler receives the `Issue` and returns an `Effect` that either succeeds\n * with a fallback encoded value or re-fails with a (possibly different) issue.\n * The handler's services are added to the schema's encoding services.\n *\n * @see {@link catchEncoding} for recovery handlers that do not require services\n * @see {@link middlewareEncoding} for intercepting or replacing the full encoding pipeline\n *\n * @category error handling\n * @since 4.0.0\n */\nexport function catchEncodingWithContext(f) {\n return self => middlewareEncoding(Effect.catchEager(f))(self);\n}\nexport function decodeTo(to, transformation) {\n return from => {\n return make(SchemaAST.decodeTo(from.ast, to.ast, transformation ? SchemaTransformation.make(transformation) : SchemaTransformation.passthrough()), {\n from,\n to\n });\n };\n}\n/**\n * Constructs a decode-only `SchemaAST.Link`.\n *\n * @internal\n */\nexport function linkDecoding() {\n return (to, decode) => link()(to, {\n decode,\n encode: SchemaGetter.forbiddenEncoding\n });\n}\n/** @internal */\nexport const TrueLiterals = /*#__PURE__*/Literals([\"true\", \"yes\", \"on\", \"1\", \"y\"]);\n/** @internal */\nexport const FalseLiterals = /*#__PURE__*/Literals([\"false\", \"no\", \"off\", \"0\", \"n\"]);\n/** @internal */\nexport const BooleanLiterals = /*#__PURE__*/Literals([...TrueLiterals.literals, ...FalseLiterals.literals]).pipe(/*#__PURE__*/decodeTo(Boolean, /*#__PURE__*/SchemaTransformation.transform({\n decode: value => value === \"true\" || value === \"yes\" || value === \"on\" || value === \"1\" || value === \"y\",\n encode: value => value ? \"true\" : \"false\"\n})));\n/**\n * Applies a transformation to a schema, creating a new schema with the same type but transformed encoding/decoding.\n *\n * **When to use**\n *\n * Use when the decoded type stays the same and the transformation only\n * normalizes values during encoding and decoding.\n *\n * **Details**\n *\n * Call it with a transformation object and then pipe a schema into the returned\n * function. The resulting schema keeps the same `Type` and `Encoded` types as\n * the source schema, while applying the transformation during both decoding and\n * encoding.\n *\n * Internally this uses `toType(self)` as the target schema and combines service\n * requirements from the source schema and the transformation.\n *\n * **Gotchas**\n *\n * Use {@link decodeTo} instead when the transformation should change the\n * decoded type. For this helper, both transformation getters operate on\n * `S[\"Type\"]` values.\n *\n * **Example** (Trimming string values during encoding/decoding)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaGetter } from \"effect\"\n *\n * const Trimmed = Schema.String.pipe(\n * Schema.decode({\n * decode: SchemaGetter.transform((s) => s.trim()),\n * encode: SchemaGetter.transform((s) => s.trim())\n * })\n * )\n *\n * Schema.decodeUnknownSync(Trimmed)(\" hello \") // => \"hello\"\n * ```\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function decode(transformation) {\n return self => {\n return decodeTo(toType(self), transformation)(self);\n };\n}\nexport function encodeTo(to, transformation) {\n return from => {\n return transformation ? decodeTo(from, transformation)(to) : decodeTo(from)(to);\n };\n}\n/**\n * Applies a transformation to a schema's encoded type, creating a new schema where encoding/decoding\n * operate on `S[\"Encoded\"]` rather than `S[\"Type\"]`.\n *\n * **Details**\n *\n * The `decode` getter maps `S[\"Encoded\"]` → `S[\"Encoded\"]` (applied during decoding),\n * and the `encode` getter maps `S[\"Encoded\"]` → `S[\"Encoded\"]` (applied during encoding).\n *\n * **Example** (Upper-casing encoded strings)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaGetter } from \"effect\"\n *\n * const UpperFromLower = Schema.String.pipe(\n * Schema.encode({\n * decode: SchemaGetter.transform((s: string) => s.toLowerCase()),\n * encode: SchemaGetter.transform((s: string) => s.toUpperCase())\n * })\n * )\n * Schema.encodeSync(UpperFromLower)(\"hello\") // => \"HELLO\"\n * ```\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function encode(transformation) {\n return self => {\n return decodeTo(self, transformation)(toEncoded(self));\n };\n}\n/**\n * Attaches a constructor default value to a schema field.\n *\n * **Details**\n *\n * Constructor defaults are applied only during `make*`, not during decoding or\n * encoding. Failures are represented directly as `SchemaIssue.Issue` values.\n *\n * **Example** (Defining an optional field with a static default)\n *\n * ```ts import.meta.vitest\n * import { Effect, Schema } from \"effect\"\n *\n * const MySchema = Schema.Struct({\n * name: Schema.String.pipe(\n * Schema.optionalKey,\n * Schema.withConstructorDefault(Effect.succeed(\"anonymous\"))\n * )\n * })\n *\n * MySchema.make({}).name // => \"anonymous\"\n * ```\n *\n * @category constructors\n * @since 3.10.0\n */\nexport function withConstructorDefault(\n// `S[\"~type.make.in\"]` instead of `S[\"Type\"]` is intentional here because\n// it makes easier to define the default value if there are nested defaults\ndefaultValue) {\n return schema => make(SchemaAST.withConstructorDefault(schema.ast, defaultValue), {\n schema\n });\n}\nfunction toIssueEffect(self) {\n return Effect.catchCause(self, cause => Effect.failCauseSync(() => Cause_.map(cause, error => error.issue)));\n}\n/**\n * Makes a struct key optional on the `Encoded` side and provides a default\n * `Encoded` value when the key is missing during decoding.\n *\n * **Details**\n *\n * The key uses `optionalKey` on the encoded side, so it may be absent from the\n * input object but **not** `undefined`. The default value is specified in terms\n * of the `Encoded` type (before any decoding transformations).\n *\n * Options:\n *\n * - `encodingStrategy`:\n * - `\"passthrough\"` (default): include the value in the encoded output.\n * - `\"omit\"`: omit the key from the encoded output.\n *\n * **Example** (Providing a default for a missing struct key)\n *\n * ```ts import.meta.vitest\n * import { Effect, Schema } from \"effect\"\n *\n * const MySchema = Schema.Struct({\n * name: Schema.String.pipe(Schema.withDecodingDefaultKey(Effect.succeed(\"anonymous\")))\n * })\n *\n * Schema.decodeUnknownSync(MySchema)({}).name // => \"anonymous\"\n * ```\n *\n * @see {@link withDecodingDefault} for the value-level variant (key absent **or** `undefined`)\n * @see {@link withDecodingDefaultTypeKey} for the variant where the default is a `Type` value\n * @category decoding\n * @since 4.0.0\n */\nexport function withDecodingDefaultKey(defaultValue, options) {\n const encode = options?.encodingStrategy === \"omit\" ? SchemaGetter.omit() : SchemaGetter.passthrough();\n return self => {\n return optionalKey(toEncoded(self)).pipe(decodeTo(self, {\n decode: SchemaGetter.withDefault(toIssueEffect(defaultValue)),\n encode\n }));\n };\n}\n/**\n * Makes a struct key optional on the `Encoded` side (`optionalKey`, so the\n * key may be absent but **not** `undefined`) and provides a default `Type`\n * value when the key is missing during decoding.\n *\n * **Details**\n *\n * Unlike {@link withDecodingDefaultKey}, the default value is specified in\n * terms of the `Type` (decoded) representation, so it does not need to go\n * through the decoding transformation.\n *\n * Options:\n *\n * - `encodingStrategy`:\n * - `\"passthrough\"` (default): include the value in the encoded output.\n * - `\"omit\"`: omit the key from the encoded output.\n *\n * @see {@link withDecodingDefaultKey} for the variant where the default is an `Encoded` value\n * @see {@link withDecodingDefaultType} for the value-level variant\n * @category decoding\n * @since 4.0.0\n */\nexport function withDecodingDefaultTypeKey(defaultValue, options) {\n return self => {\n return toType(self).pipe(withDecodingDefaultKey(defaultValue, options), encodeTo(optionalKey(self)));\n };\n}\n/**\n * Wraps the `Encoded` side with `optional` (key absent **or** `undefined`)\n * and provides a default `Encoded` value when the field is missing or\n * `undefined` during decoding.\n *\n * **When to use**\n *\n * Use when the default is expressed in the encoded representation, before the\n * field's decoding transformation runs.\n *\n * **Details**\n *\n * The default value is specified in terms of the `Encoded` type (before any\n * decoding transformations).\n *\n * Options:\n *\n * - `encodingStrategy`:\n * - `\"passthrough\"` (default): include the value in the encoded output.\n * - `\"omit\"`: omit the key from the encoded output.\n *\n * **Example** (Providing a default for an optional field value)\n *\n * ```ts import.meta.vitest\n * import { Effect, Schema } from \"effect\"\n *\n * const MySchema = Schema.Struct({\n * name: Schema.String.pipe(Schema.optional, Schema.withDecodingDefault(Effect.succeed(\"anonymous\")))\n * })\n *\n * Schema.decodeUnknownSync(MySchema)({ name: undefined }).name // => \"anonymous\"\n * ```\n *\n * @see {@link withDecodingDefaultKey} for the key-level variant (key absent only, not `undefined`)\n * @see {@link withDecodingDefaultType} for the variant where the default is a `Type` value\n * @category decoding\n * @since 3.10.0\n */\nexport function withDecodingDefault(defaultValue, options) {\n const encode = options?.encodingStrategy === \"omit\" ? SchemaGetter.omit() : SchemaGetter.passthrough();\n return self => {\n return optional(toEncoded(self)).pipe(decodeTo(self, {\n decode: SchemaGetter.withDefault(toIssueEffect(defaultValue)),\n encode\n }));\n };\n}\n/**\n * Wraps the `Encoded` side with `optional` (key absent **or** `undefined`)\n * and provides a default `Type` value when the field is missing or\n * `undefined` during decoding.\n *\n * **When to use**\n *\n * Use when the default is already in the decoded representation and should not\n * pass through the field's decoding transformation.\n *\n * **Details**\n *\n * Unlike {@link withDecodingDefault}, the default value is specified in terms\n * of the `Type` (decoded) representation, so it does not need to go through\n * the decoding transformation.\n *\n * Options:\n *\n * - `encodingStrategy`:\n * - `\"passthrough\"` (default): include the value in the encoded output.\n * - `\"omit\"`: omit the key from the encoded output.\n *\n * @see {@link withDecodingDefault} for the variant where the default is an `Encoded` value\n * @see {@link withDecodingDefaultTypeKey} for the key-level variant\n * @category decoding\n * @since 4.0.0\n */\nexport function withDecodingDefaultType(defaultValue, options) {\n return self => {\n return toType(self).pipe(withDecodingDefault(defaultValue, options), encodeTo(optional(self)));\n };\n}\n/**\n * Combines a {@link Literal} schema with {@link withConstructorDefault}, making it ideal\n * for discriminator fields in tagged unions. When constructing via `make`, the\n * `_tag` field can be omitted and will be filled automatically.\n *\n * **Example** (Defining a discriminated union tag)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const A = Schema.Struct({ _tag: Schema.tag(\"A\"), value: Schema.Number })\n *\n * // _tag is optional in make, auto-filled to \"A\"\n * const a = A.make({ value: 42 })\n * a // => { _tag: \"A\", value: 42 }\n * ```\n *\n * @see {@link tagDefaultOmit} to also omit the tag during encoding\n * @see {@link TaggedStruct} for a shorthand that adds `_tag` automatically\n * @category constructors\n * @since 3.10.0\n */\nexport function tag(literal) {\n return Literal(literal).pipe(withConstructorDefault(Effect.succeed(literal)));\n}\n/**\n * Creates a literal `_tag` schema that is omitted from encoded output.\n *\n * **When to use**\n *\n * Use to decode data that omits the discriminator field while still constructing\n * values with a `_tag` for tagged union matching.\n *\n * **Details**\n *\n * The tag is filled during decoding and construction, like {@link tag}, but is\n * omitted when encoding.\n *\n * **Example** (Omitting tags during encoding)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const A = Schema.Struct({\n * _tag: Schema.tagDefaultOmit(\"A\"),\n * value: Schema.Number\n * })\n *\n * // Encode strips the _tag field\n * Schema.encodeUnknownSync(A)({ _tag: \"A\", value: 1 }) // => { value: 1 }\n * ```\n *\n * @see {@link tag} for the variant that keeps the tag during encoding\n * @category constructors\n * @since 4.0.0\n */\nexport function tagDefaultOmit(literal) {\n return tag(literal).pipe(withDecodingDefaultKey(Effect.succeed(literal), {\n encodingStrategy: \"omit\"\n }));\n}\n/**\n * Creates a struct schema with an automatically populated `_tag` field.\n *\n * **When to use**\n *\n * Use to define a tagged union case from a literal tag and a set of fields.\n *\n * **Details**\n *\n * When using the `make` method, the `_tag` field is optional and will be\n * added automatically. However, when decoding or encoding, the `_tag` field\n * must be present in the input.\n *\n * **Example** (Defining a tagged struct shorthand)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * // Defines a struct with a fixed `_tag` field\n * const tagged = Schema.TaggedStruct(\"A\", {\n * a: Schema.String\n * })\n *\n * // This is the same as writing:\n * const equivalent = Schema.Struct({\n * _tag: Schema.tag(\"A\"),\n * a: Schema.String\n * })\n * void tagged\n * void equivalent\n * ```\n *\n * **Example** (Accessing the literal value of the tag)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const tagged = Schema.TaggedStruct(\"A\", {\n * a: Schema.String\n * })\n *\n * tagged.fields._tag.schema.literal // => \"A\"\n * ```\n *\n * @category constructors\n * @since 3.10.0\n */\nexport function TaggedStruct(value, fields) {\n return Struct({\n _tag: tag(value),\n ...fields\n });\n}\n/**\n * Augments an existing {@link Union} of tagged structs with utility methods and an ordered tuple of discriminant\n * values.\n *\n * **Gotchas**\n *\n * Throws if multiple members use the same discriminant property key.\n *\n * **Example** (Adding tagged-union utilities to an existing union)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const A = Schema.TaggedStruct(\"A\", { value: Schema.Number })\n * const B = Schema.TaggedStruct(\"B\", { name: Schema.String })\n *\n * const MyUnion = Schema.Union([A, B]).pipe(Schema.toTaggedUnion(\"_tag\"))\n *\n * // Pattern-match on the union\n * const result = MyUnion.match({ _tag: \"A\", value: 1 }, {\n * A: (a) => `number: ${a.value}`,\n * B: (b) => `name: ${b.name}`\n * })\n * result // => \"number: 1\"\n * ```\n *\n * @see {@link TaggedUnion} for a shorthand that builds the union from scratch\n * @category combinators\n * @since 4.0.0\n */\nexport function toTaggedUnion(tag) {\n return self => {\n const cases = {};\n const discriminants = [];\n const discriminantKeys = new Set();\n const guards = {};\n const isAnyOf = keys => value => keys.includes(value[tag]);\n walk(self);\n return Object.assign(self, {\n cases,\n discriminants,\n isAnyOf,\n guards,\n match,\n matchOrElse\n });\n function walk(schema) {\n const ast = schema.ast;\n if (SchemaAST.isUnion(ast) && \"members\" in schema && globalThis.Array.isArray(schema.members) && schema.members.every(isSchema)) {\n return schema.members.forEach(walk);\n }\n const sentinels = SchemaAST.collectSentinels(ast);\n if (sentinels.length > 0) {\n const literal = sentinels.find(s => s.key === tag)?.literal;\n if (Predicate.isPropertyKey(literal)) {\n const key = typeof literal === \"number\" ? globalThis.String(literal) : literal;\n if (discriminantKeys.has(key)) {\n throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(literal)}`);\n }\n discriminantKeys.add(key);\n discriminants.push(literal);\n InternalRecord.assignProperty(cases, literal, schema);\n InternalRecord.assignProperty(guards, literal, SchemaParser.is(toType(schema)));\n return;\n }\n }\n throw new globalThis.Error(\"No literal or unique symbol found\");\n }\n function match() {\n if (arguments.length === 1) {\n const cases = arguments[0];\n return function (value) {\n const key = value[tag];\n const handler = Object.hasOwn(cases, key) ? cases[key] : undefined;\n return handler(value);\n };\n }\n const value = arguments[0];\n const cases = arguments[1];\n const key = value[tag];\n const handler = Object.hasOwn(cases, key) ? cases[key] : undefined;\n return handler(value);\n }\n function matchOrElse() {\n if (arguments.length === 2) {\n const cases = arguments[0];\n const orElse = arguments[1];\n return function (value) {\n const key = value[tag];\n const handler = Object.hasOwn(cases, key) ? cases[key] ?? orElse : orElse;\n return handler(value);\n };\n }\n const value = arguments[0];\n const cases = arguments[1];\n const orElse = arguments[2];\n const key = value[tag];\n const handler = Object.hasOwn(cases, key) ? cases[key] ?? orElse : orElse;\n return handler(value);\n }\n };\n}\n/**\n * Builds a discriminated union from a record of field sets, one per variant.\n * Each key becomes the `_tag` literal and the value is passed to {@link TaggedStruct}.\n * The result includes `cases`, `guards`, `isAnyOf`, `match`, and `matchOrElse` utilities.\n *\n * **Example** (Pattern matching a discriminated union)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const Shape = Schema.TaggedUnion({\n * Circle: { radius: Schema.Number },\n * Rectangle: { width: Schema.Number, height: Schema.Number }\n * })\n *\n * // Pattern-match on a decoded value\n * const area = Shape.match({ _tag: \"Circle\", radius: 5 }, {\n * Circle: (c) => Math.PI * c.radius ** 2,\n * Rectangle: (r) => r.width * r.height\n * })\n * Math.round(area * 100) / 100 // => 78.54\n * ```\n *\n * @see {@link toTaggedUnion} to augment an existing union instead\n * @category constructors\n * @since 4.0.0\n */\nexport function TaggedUnion(casesByTag) {\n const cases = {};\n const members = [];\n for (const key of Object.keys(casesByTag)) {\n const member = TaggedStruct(key, casesByTag[key]);\n InternalRecord.assignProperty(cases, key, member);\n members.push(member);\n }\n const union = Union(members);\n const {\n guards,\n isAnyOf,\n match,\n matchOrElse\n } = toTaggedUnion(\"_tag\")(union);\n return make(union.ast, {\n cases,\n isAnyOf,\n guards,\n match,\n matchOrElse\n });\n}\n/**\n * Wraps a struct schema so that its decoded `Type` becomes a nominally distinct type `Self`.\n * Useful for creating opaque types that are structurally identical to a base struct\n * but type-incompatible with it.\n *\n * **Example** (Defining opaque structs)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * class Person extends Schema.Opaque<Person>()(\n * Schema.Struct({\n * name: Schema.String\n * })\n * ) {}\n *\n * // Decoded value is Person, not { name: string }\n * const person = Schema.decodeUnknownSync(Person)({ name: \"Alice\" })\n * person.name // => \"Alice\"\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function Opaque() {\n return schema => schema;\n}\n/**\n * Creates a schema that validates values using `instanceof`.\n * Decoding and encoding pass the value through unchanged.\n *\n * **Example** (Defining a schema for a built-in class)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const DateSchema = Schema.instanceOf(Date)\n *\n * const decoded = Schema.decodeUnknownSync(DateSchema)(new Date(\"2024-01-01\"))\n * decoded.toISOString() // => \"2024-01-01T00:00:00.000Z\"\n * ```\n *\n * @category constructors\n * @since 3.10.0\n */\nexport function instanceOf(constructor, annotations) {\n return declare(u => u instanceof constructor, annotations);\n}\n/**\n * Constructs an `SchemaAST.Link` that describes how a value of type `T` encodes to and decodes from a `To` schema.\n * Used when building low-level AST transformations that bridge two schema types.\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function link() {\n return (encodeTo, transformation) => {\n return new SchemaAST.Link(encodeTo.ast, SchemaTransformation.make(transformation));\n };\n}\n/**\n * Creates a custom validation filter from a predicate function.\n *\n * **Details**\n *\n * The predicate receives the decoded input value, the schema AST, and parse\n * options, and returns a `FilterOutput`. Non-success outputs are normalized into\n * schema issues. The `annotations` parameter annotates the filter itself; with\n * the default formatter, failures use `message` first, `expected` second, and\n * `<filter>` when neither is provided.\n *\n * When `abort` is `true`, parsing stops after this filter fails instead of\n * collecting later check failures.\n *\n * **Example** (Reporting failure at a nested path)\n *\n * ```ts import.meta.vitest\n * import { Result, Schema } from \"effect\"\n *\n * const schema = Schema.Struct({ password: Schema.String, confirmPassword: Schema.String }).check(\n * Schema.makeFilter((o) =>\n * o.password === o.confirmPassword\n * ? undefined\n * : { path: [\"password\"], issue: \"password and confirmPassword must match\" }\n * )\n * )\n *\n * const result = Schema.decodeUnknownResult(schema)({ password: \"123456\", confirmPassword: \"1234567\" })\n * if (Result.isFailure(result) && result.failure.issue._tag === \"Filter\" && result.failure.issue.issue._tag === \"Pointer\") {\n * result.failure.issue.issue.path // => [\"password\"]\n * }\n * ```\n *\n * **Example** (Reporting multiple failures at once)\n *\n * ```ts import.meta.vitest\n * import { Result, Schema } from \"effect\"\n *\n * const schema = Schema.Struct({ a: Schema.Finite, b: Schema.Finite, c: Schema.Finite }).check(\n * Schema.makeFilter((o) => {\n * const issues: Array<Schema.FilterIssue> = []\n * if (o.a > 0) {\n * if (o.b <= 0) issues.push({ path: [\"b\"], issue: \"b must be greater than 0\" })\n * if (o.c <= 0) issues.push({ path: [\"c\"], issue: \"c must be greater than 0\" })\n * }\n * return issues\n * })\n * )\n *\n * const result = Schema.decodeUnknownResult(schema)({ a: 1, b: 0, c: 0 })\n * if (Result.isFailure(result) && result.failure.issue._tag === \"Filter\" && result.failure.issue.issue._tag === \"Composite\") {\n * result.failure.issue.issue.issues.map((issue) => issue._tag === \"Pointer\" ? issue.path : []) // => [[\"b\"], [\"c\"]]\n * }\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeFilter = SchemaAST.makeFilter;\n/**\n * Groups multiple checks into a single {@link SchemaAST.FilterGroup}, applying\n * optional shared annotations to the group as a whole.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function makeFilterGroup(checks, annotations = undefined) {\n return new SchemaAST.FilterGroup(checks, annotations);\n}\nconst TRIMMED_PATTERN = \"^\\\\S[\\\\s\\\\S]*\\\\S$|^\\\\S$|^$\";\n/**\n * Validates that a string has no leading or trailing whitespace.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to a `pattern` constraint in JSON Schema that\n * matches strings without leading or trailing whitespace.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a `patterns`\n * constraint to ensure generated strings match the trimmed pattern.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isTrimmed(annotations) {\n const regExp = new globalThis.RegExp(TRIMMED_PATTERN);\n return makeFilter(s => s.trim() === s, {\n expected: \"a string with no leading or trailing whitespace\",\n representation: {\n id: \"effect/schema/isTrimmed\",\n payload: null\n },\n toJsonSchema: () => ({\n pattern: regExp.source\n }),\n toCode: () => ({\n runtime: \"Schema.isTrimmed()\"\n }),\n arbitraryConstraint: {\n patterns: [{\n source: TRIMMED_PATTERN,\n flags: \"\"\n }]\n },\n ...annotations\n });\n}\n/**\n * Validates that a string matches the specified regular expression pattern.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * JSON Schema receives the RegExp source as a `pattern`. JavaScript flags are\n * not represented, so validation can differ when the RegExp uses flags or\n * relies on JavaScript's non-Unicode behavior.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a `patterns`\n * constraint to ensure generated strings match the specified RegExp pattern.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isPattern(regExp, annotations) {\n const source = regExp.source;\n const flags = regExp.flags;\n const runtimeRegExp = flags === \"\" ? `new RegExp(${format(source)})` : `new RegExp(${format(source)}, ${format(flags)})`;\n return SchemaAST.isPattern(regExp, {\n toCode: () => ({\n runtime: `Schema.isPattern(${runtimeRegExp})`\n }),\n ...annotations\n });\n}\n/**\n * Validates that a string represents a finite number.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to a `pattern` constraint in JSON Schema that matches\n * strings representing finite numbers.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a `patterns`\n * constraint to ensure generated strings match the number string pattern.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isStringFinite(annotations) {\n return SchemaAST.isStringFinite({\n toCode: () => ({\n runtime: \"Schema.isStringFinite()\"\n }),\n ...annotations\n });\n}\n/**\n * Validates that a string is a signed base-10 integer literal for Effect's\n * BigInt string encoding.\n *\n * **Details**\n *\n * The check uses the pattern `^-?\\d+$`. It does not accept leading `+`, decimal\n * points, exponent notation, separators, or non-decimal inputs such as\n * hexadecimal strings.\n *\n * JSON Schema:\n * This check corresponds to a `pattern` constraint with the same signed\n * base-10 integer pattern.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isStringBigInt(annotations) {\n return SchemaAST.isStringBigInt({\n toCode: () => ({\n runtime: \"Schema.isStringBigInt()\"\n }),\n ...annotations\n });\n}\n/**\n * Validates that a string has the `Symbol(description)` format used by Effect's\n * symbol string encoding.\n *\n * **Details**\n *\n * The check uses the pattern `^Symbol\\((.*)\\)$`. It is not a general test for\n * whether a string can be passed to JavaScript's `Symbol()` function.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isStringSymbol(annotations) {\n return SchemaAST.isStringSymbol({\n toCode: () => ({\n runtime: \"Schema.isStringSymbol()\"\n }),\n ...annotations\n });\n}\nconst getUUIDRegExp = version => {\n if (version) {\n return new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);\n }\n return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/;\n};\n/**\n * Validates that a string is a strict Universally Unique Identifier (UUID).\n *\n * **When to use**\n *\n * Use when you need UUID semantics, including version and RFC variant bits,\n * rather than only the dashed hexadecimal shape.\n *\n * **Details**\n *\n * Without a version argument, this accepts UUID versions 1 through 8, the nil\n * UUID (`00000000-0000-0000-0000-000000000000`), and the max UUID\n * (`ffffffff-ffff-ffff-ffff-ffffffffffff`). With a version argument, this\n * accepts only UUIDs with that version and RFC variant bits; nil and max UUIDs\n * are not versioned UUIDs and do not match version-specific checks.\n *\n * JSON Schema:\n *\n * This check corresponds to a `pattern` constraint in JSON Schema that matches\n * UUID format, and includes a `format: \"uuid\"` annotation.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a `patterns`\n * constraint to ensure generated strings match the UUID pattern.\n *\n * @see {@link isGUID} for shape-only GUID validation.\n * @category validation\n * @since 4.0.0\n */\nexport function isUUID(version, annotations) {\n const regExp = getUUIDRegExp(version);\n return isPattern(regExp, {\n expected: version ? `a UUID v${version}` : \"a UUID\",\n representation: {\n id: \"effect/schema/isUUID\",\n payload: {\n version: version ?? null\n }\n },\n toJsonSchema: () => ({\n pattern: regExp.source,\n format: \"uuid\"\n }),\n toCode: () => ({\n runtime: version === undefined ? \"Schema.isUUID()\" : `Schema.isUUID(${version})`\n }),\n ...annotations\n });\n}\nconst GUID_REGEXP = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;\n/**\n * Validates that a string has the GUID / UUID textual shape.\n *\n * **When to use**\n *\n * Use when you need to accept dashed hexadecimal identifiers without enforcing\n * UUID version or variant bits.\n *\n * **Details**\n *\n * This check accepts strings in the `8-4-4-4-12` hexadecimal form. JSON Schema\n * output includes the corresponding `pattern` constraint and intentionally does\n * not include `format: \"uuid\"` because GUID validation is looser than UUID\n * validation.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a `patterns`\n * constraint to ensure generated strings match the GUID pattern.\n *\n * @see {@link isUUID} for strict UUID validation.\n * @category validation\n * @since 4.0.0\n */\nexport function isGUID(annotations) {\n return isPattern(GUID_REGEXP, {\n expected: \"a GUID\",\n representation: {\n id: \"effect/schema/isGUID\",\n payload: null\n },\n toJsonSchema: () => ({\n pattern: GUID_REGEXP.source\n }),\n toCode: () => ({\n runtime: \"Schema.isGUID()\"\n }),\n ...annotations\n });\n}\n/**\n * Validates that a string is a valid ULID (Universally Unique Lexicographically\n * Sortable Identifier).\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to a `pattern` constraint in JSON Schema that matches\n * the ULID format.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a `patterns`\n * constraint to ensure generated strings match the ULID pattern.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isULID(annotations) {\n const regExp = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;\n return isPattern(regExp, {\n representation: {\n id: \"effect/schema/isULID\",\n payload: null\n },\n toJsonSchema: () => ({\n pattern: regExp.source\n }),\n toCode: () => ({\n runtime: \"Schema.isULID()\"\n }),\n ...annotations\n });\n}\n/**\n * Validates that a string is valid Base64 encoded data.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to a `pattern` constraint in JSON Schema that matches\n * Base64 format.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a `patterns`\n * constraint to ensure generated strings match the Base64 pattern.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isBase64(annotations) {\n const regExp = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;\n return isPattern(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}\n/**\n * Validates that a string is valid Base64URL encoded data (Base64 with URL-safe\n * characters).\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to a `pattern` constraint in JSON Schema that matches\n * Base64URL format.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a `patterns`\n * constraint to ensure generated strings match the Base64URL pattern.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isBase64Url(annotations) {\n const regExp = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;\n return isPattern(regExp, {\n expected: \"a base64url encoded string\",\n representation: {\n id: \"effect/schema/isBase64Url\",\n payload: null\n },\n toJsonSchema: () => ({\n pattern: regExp.source\n }),\n toCode: () => ({\n runtime: \"Schema.isBase64Url()\"\n }),\n ...annotations\n });\n}\n/**\n * Validates at runtime that a string starts with the specified literal prefix.\n *\n * **Details**\n *\n * RegExp metacharacters in the prefix are escaped in JSON Schema and arbitrary\n * metadata so that the generated patterns retain literal `startsWith` semantics.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isStartsWith(startsWith, annotations) {\n const formatted = JSON.stringify(startsWith);\n const regExp = new globalThis.RegExp(`^${RegExp_.escape(startsWith)}`);\n return makeFilter(s => s.startsWith(startsWith), {\n expected: `a string starting with ${formatted}`,\n representation: {\n id: \"effect/schema/isStartsWith\",\n payload: {\n startsWith\n }\n },\n toJsonSchema: () => ({\n pattern: regExp.source\n }),\n toCode: () => ({\n runtime: `Schema.isStartsWith(${format(startsWith)})`\n }),\n arbitraryConstraint: {\n patterns: [{\n source: regExp.source,\n flags: regExp.flags\n }]\n },\n ...annotations\n });\n}\n/**\n * Validates at runtime that a string ends with the specified literal suffix.\n *\n * **Details**\n *\n * RegExp metacharacters in the suffix are escaped in JSON Schema and arbitrary\n * metadata so that the generated patterns retain literal `endsWith` semantics.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isEndsWith(endsWith, annotations) {\n const formatted = JSON.stringify(endsWith);\n const regExp = new globalThis.RegExp(`${RegExp_.escape(endsWith)}$`);\n return makeFilter(s => s.endsWith(endsWith), {\n expected: `a string ending with ${formatted}`,\n representation: {\n id: \"effect/schema/isEndsWith\",\n payload: {\n endsWith\n }\n },\n toJsonSchema: () => ({\n pattern: regExp.source\n }),\n toCode: () => ({\n runtime: `Schema.isEndsWith(${format(endsWith)})`\n }),\n arbitraryConstraint: {\n patterns: [{\n source: regExp.source,\n flags: regExp.flags\n }]\n },\n ...annotations\n });\n}\n/**\n * Validates at runtime that a string contains the specified literal substring.\n *\n * **Details**\n *\n * RegExp metacharacters in the substring are escaped in JSON Schema and\n * arbitrary metadata so that the generated patterns retain literal `includes`\n * semantics.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isIncludes(includes, annotations) {\n const formatted = JSON.stringify(includes);\n const regExp = new globalThis.RegExp(RegExp_.escape(includes));\n return makeFilter(s => s.includes(includes), {\n expected: `a string including ${formatted}`,\n representation: {\n id: \"effect/schema/isIncludes\",\n payload: {\n includes\n }\n },\n toJsonSchema: () => ({\n pattern: regExp.source\n }),\n toCode: () => ({\n runtime: `Schema.isIncludes(${format(includes)})`\n }),\n arbitraryConstraint: {\n patterns: [{\n source: regExp.source,\n flags: regExp.flags\n }]\n },\n ...annotations\n });\n}\nconst UPPERCASED_PATTERN = \"^[^a-z]*$\";\n/**\n * Validates that a string is unchanged by JavaScript's `toUpperCase()`.\n *\n * **Details**\n *\n * This accepts empty strings and characters that do not have lowercase forms,\n * such as digits, punctuation, and whitespace. It rejects strings that would\n * change when uppercased.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isUppercased(annotations) {\n const regExp = new globalThis.RegExp(UPPERCASED_PATTERN);\n return makeFilter(s => s.toUpperCase() === s, {\n expected: \"a string with all characters in uppercase\",\n representation: {\n id: \"effect/schema/isUppercased\",\n payload: null\n },\n toJsonSchema: () => ({\n pattern: regExp.source\n }),\n toCode: () => ({\n runtime: \"Schema.isUppercased()\"\n }),\n arbitraryConstraint: {\n patterns: [{\n source: UPPERCASED_PATTERN,\n flags: \"\"\n }]\n },\n ...annotations\n });\n}\nconst LOWERCASED_PATTERN = \"^[^A-Z]*$\";\n/**\n * Validates that a string is unchanged by JavaScript's `toLowerCase()`.\n *\n * **Details**\n *\n * This accepts empty strings and characters that do not have uppercase forms,\n * such as digits, punctuation, and whitespace. It rejects strings that would\n * change when lowercased.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isLowercased(annotations) {\n const regExp = new globalThis.RegExp(LOWERCASED_PATTERN);\n return makeFilter(s => s.toLowerCase() === s, {\n expected: \"a string with all characters in lowercase\",\n representation: {\n id: \"effect/schema/isLowercased\",\n payload: null\n },\n toJsonSchema: () => ({\n pattern: regExp.source\n }),\n toCode: () => ({\n runtime: \"Schema.isLowercased()\"\n }),\n arbitraryConstraint: {\n patterns: [{\n source: LOWERCASED_PATTERN,\n flags: \"\"\n }]\n },\n ...annotations\n });\n}\nconst CAPITALIZED_PATTERN = \"^(?:[^a-z][\\\\s\\\\S]*)?$\";\n/**\n * Validates that the first character of a string is unchanged by\n * `toUpperCase()`.\n *\n * **Details**\n *\n * Empty strings pass. Strings whose first character has no lowercase form, such\n * as a digit, punctuation mark, or whitespace, also pass.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isCapitalized(annotations) {\n const regExp = new globalThis.RegExp(CAPITALIZED_PATTERN);\n return makeFilter(s => s.charAt(0).toUpperCase() === s.charAt(0), {\n expected: \"a string with the first character in uppercase\",\n representation: {\n id: \"effect/schema/isCapitalized\",\n payload: null\n },\n toJsonSchema: () => ({\n pattern: regExp.source\n }),\n toCode: () => ({\n runtime: \"Schema.isCapitalized()\"\n }),\n arbitraryConstraint: {\n patterns: [{\n source: CAPITALIZED_PATTERN,\n flags: \"\"\n }]\n },\n ...annotations\n });\n}\nconst UNCAPITALIZED_PATTERN = \"^(?:[^A-Z][\\\\s\\\\S]*)?$\";\n/**\n * Validates that the first character of a string is unchanged by\n * `toLowerCase()`.\n *\n * **Details**\n *\n * Empty strings pass. Strings whose first character has no uppercase form, such\n * as a digit, punctuation mark, or whitespace, also pass.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isUncapitalized(annotations) {\n const regExp = new globalThis.RegExp(UNCAPITALIZED_PATTERN);\n return makeFilter(s => s.charAt(0).toLowerCase() === s.charAt(0), {\n expected: \"a string with the first character in lowercase\",\n representation: {\n id: \"effect/schema/isUncapitalized\",\n payload: null\n },\n toJsonSchema: () => ({\n pattern: regExp.source\n }),\n toCode: () => ({\n runtime: \"Schema.isUncapitalized()\"\n }),\n arbitraryConstraint: {\n patterns: [{\n source: UNCAPITALIZED_PATTERN,\n flags: \"\"\n }]\n },\n ...annotations\n });\n}\n/**\n * Schema for finite numbers, rejecting `NaN`, `Infinity`, and `-Infinity`.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const Finite = /*#__PURE__*/make(SchemaAST.finite);\n/**\n * Validates that a number is finite (not `Infinity`, `-Infinity`, or `NaN`).\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check does not have a direct JSON Schema equivalent, but ensures the\n * number is valid and finite.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a finite-number constraint.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isFinite = SchemaAST.isFinite;\n/**\n * Creates a greater-than (`>`) check for any ordered type from an\n * `Order.Order` instance.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function makeIsGreaterThan(options) {\n const gt = Order.isGreaterThan(options.order);\n const formatter = options.formatter ?? format;\n return (exclusiveMinimum, annotations) => {\n return makeFilter(input => gt(input, exclusiveMinimum), {\n expected: `a value greater than ${formatter(exclusiveMinimum)}`,\n arbitraryConstraint: {\n order: options.order,\n minimum: exclusiveMinimum,\n exclusiveMinimum: true\n },\n ...options.annotate?.(exclusiveMinimum),\n ...annotations\n });\n };\n}\n/**\n * Creates a greater-than-or-equal-to (`>=`) check for any ordered type from an\n * `Order.Order` instance.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function makeIsGreaterThanOrEqualTo(options) {\n const gte = Order.isGreaterThanOrEqualTo(options.order);\n const formatter = options.formatter ?? format;\n return (minimum, annotations) => {\n return makeFilter(input => gte(input, minimum), {\n expected: `a value greater than or equal to ${formatter(minimum)}`,\n arbitraryConstraint: {\n order: options.order,\n minimum\n },\n ...options.annotate?.(minimum),\n ...annotations\n });\n };\n}\n/**\n * Creates a less-than (`<`) check for any ordered type from an `Order.Order`\n * instance.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function makeIsLessThan(options) {\n const lt = Order.isLessThan(options.order);\n const formatter = options.formatter ?? format;\n return (exclusiveMaximum, annotations) => {\n return makeFilter(input => lt(input, exclusiveMaximum), {\n expected: `a value less than ${formatter(exclusiveMaximum)}`,\n arbitraryConstraint: {\n order: options.order,\n maximum: exclusiveMaximum,\n exclusiveMaximum: true\n },\n ...options.annotate?.(exclusiveMaximum),\n ...annotations\n });\n };\n}\n/**\n * Creates a less-than-or-equal-to (`<=`) check for any ordered type from an\n * `Order.Order` instance.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function makeIsLessThanOrEqualTo(options) {\n const lte = Order.isLessThanOrEqualTo(options.order);\n const formatter = options.formatter ?? format;\n return (maximum, annotations) => {\n return makeFilter(input => lte(input, maximum), {\n expected: `a value less than or equal to ${formatter(maximum)}`,\n arbitraryConstraint: {\n order: options.order,\n maximum\n },\n ...options.annotate?.(maximum),\n ...annotations\n });\n };\n}\n/**\n * Creates an inclusive or exclusive range check for any ordered type from an\n * `Order.Order` instance.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function makeIsBetween(deriveOptions) {\n const greaterThanOrEqualTo = Order.isGreaterThanOrEqualTo(deriveOptions.order);\n const greaterThan = Order.isGreaterThan(deriveOptions.order);\n const lessThanOrEqualTo = Order.isLessThanOrEqualTo(deriveOptions.order);\n const lessThan = Order.isLessThan(deriveOptions.order);\n const formatter = deriveOptions.formatter ?? format;\n return (options, annotations) => {\n const gte = options.exclusiveMinimum ? greaterThan : greaterThanOrEqualTo;\n const lte = options.exclusiveMaximum ? lessThan : lessThanOrEqualTo;\n return makeFilter(input => gte(input, options.minimum) && lte(input, options.maximum), {\n expected: `a value between ${formatter(options.minimum)}${options.exclusiveMinimum ? \" (excluded)\" : \"\"} and ${formatter(options.maximum)}${options.exclusiveMaximum ? \" (excluded)\" : \"\"}`,\n arbitraryConstraint: {\n order: deriveOptions.order,\n minimum: options.minimum,\n maximum: options.maximum,\n ...(options.exclusiveMinimum && {\n exclusiveMinimum: true\n }),\n ...(options.exclusiveMaximum && {\n exclusiveMaximum: true\n })\n },\n ...deriveOptions.annotate?.(options),\n ...annotations\n });\n };\n}\n/**\n * Creates a divisibility check for any numeric type from a remainder function\n * and a zero value.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function makeIsMultipleOf(options) {\n return (divisor, annotations) => {\n const formatter = options.formatter ?? format;\n return makeFilter(input => options.remainder(input, divisor) === options.zero, {\n expected: `a value that is a multiple of ${formatter(divisor)}`,\n ...options.annotate?.(divisor),\n ...annotations\n });\n };\n}\nfunction encodeNumberPayload(number) {\n if (!globalThis.Number.isFinite(number)) {\n throw new globalThis.RangeError(`Expected a finite number, got ${format(number)}`);\n }\n return number;\n}\n/**\n * Validates that a number is greater than the specified value (exclusive).\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to the `exclusiveMinimum` constraint in JSON Schema.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies an\n * `exclusiveMinimum` constraint to ensure generated numbers are greater than\n * the specified value.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isGreaterThan = /*#__PURE__*/makeIsGreaterThan({\n order: Order.Number,\n annotate: exclusiveMinimum => ({\n representation: {\n id: \"effect/schema/isGreaterThan\",\n payload: {\n exclusiveMinimum: encodeNumberPayload(exclusiveMinimum)\n }\n },\n toJsonSchema: () => ({\n exclusiveMinimum\n }),\n toCode: () => ({\n runtime: `Schema.isGreaterThan(${format(exclusiveMinimum)})`\n })\n })\n});\n/**\n * Validates that a number is greater than or equal to the specified value\n * (inclusive).\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to the `minimum` constraint in JSON Schema.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a `minimum` constraint\n * to ensure generated numbers are greater than or equal to the specified value.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isGreaterThanOrEqualTo = /*#__PURE__*/makeIsGreaterThanOrEqualTo({\n order: Order.Number,\n annotate: minimum => ({\n representation: {\n id: \"effect/schema/isGreaterThanOrEqualTo\",\n payload: {\n minimum: encodeNumberPayload(minimum)\n }\n },\n toJsonSchema: () => ({\n minimum\n }),\n toCode: () => ({\n runtime: `Schema.isGreaterThanOrEqualTo(${format(minimum)})`\n })\n })\n});\n/**\n * Validates that a number is less than the specified value (exclusive).\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to the `exclusiveMaximum` constraint in JSON Schema.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies an\n * `exclusiveMaximum` constraint to ensure generated numbers are less than the\n * specified value.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isLessThan = /*#__PURE__*/makeIsLessThan({\n order: Order.Number,\n annotate: exclusiveMaximum => ({\n representation: {\n id: \"effect/schema/isLessThan\",\n payload: {\n exclusiveMaximum: encodeNumberPayload(exclusiveMaximum)\n }\n },\n toJsonSchema: () => ({\n exclusiveMaximum\n }),\n toCode: () => ({\n runtime: `Schema.isLessThan(${format(exclusiveMaximum)})`\n })\n })\n});\n/**\n * Validates that a number is less than or equal to the specified value\n * (inclusive).\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to the `maximum` constraint in JSON Schema.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a `maximum` constraint\n * to ensure generated numbers are less than or equal to the specified value.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isLessThanOrEqualTo = /*#__PURE__*/makeIsLessThanOrEqualTo({\n order: Order.Number,\n annotate: maximum => ({\n representation: {\n id: \"effect/schema/isLessThanOrEqualTo\",\n payload: {\n maximum: encodeNumberPayload(maximum)\n }\n },\n toJsonSchema: () => ({\n maximum\n }),\n toCode: () => ({\n runtime: `Schema.isLessThanOrEqualTo(${format(maximum)})`\n })\n })\n});\n/**\n * Validates that a number is within a specified range. The range boundaries can\n * be inclusive or exclusive based on the provided options.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to `minimum`/`maximum` or `exclusiveMinimum`/`exclusiveMaximum`\n * constraints in JSON Schema, depending on the options provided.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies `minimum` and\n * `maximum` constraints with optional `exclusiveMinimum` and\n * `exclusiveMaximum` flags to ensure generated numbers fall within the\n * specified range.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isBetween = /*#__PURE__*/makeIsBetween({\n order: Order.Number,\n annotate: options => {\n const exclusiveMinimum = options.exclusiveMinimum ? true : undefined;\n const exclusiveMaximum = options.exclusiveMaximum ? true : undefined;\n const payload = {\n minimum: encodeNumberPayload(options.minimum),\n maximum: encodeNumberPayload(options.maximum),\n ...(exclusiveMinimum && {\n exclusiveMinimum\n }),\n ...(exclusiveMaximum && {\n exclusiveMaximum\n })\n };\n return {\n representation: {\n id: \"effect/schema/isBetween\",\n payload\n },\n toJsonSchema: () => ({\n [exclusiveMinimum ? \"exclusiveMinimum\" : \"minimum\"]: options.minimum,\n [exclusiveMaximum ? \"exclusiveMaximum\" : \"maximum\"]: options.maximum\n }),\n toCode: () => ({\n runtime: `Schema.isBetween({ minimum: ${format(options.minimum)}, maximum: ${format(options.maximum)}, exclusiveMinimum: ${format(exclusiveMinimum)}, exclusiveMaximum: ${format(exclusiveMaximum)} })`\n })\n };\n }\n});\n/**\n * Validates that a number is a multiple of the specified divisor.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to the `multipleOf` constraint in JSON Schema.\n * Negative divisors are normalized to their absolute value because JSON\n * Schema requires `multipleOf` to be positive.\n *\n * **Gotchas**\n *\n * Throws a `RangeError` when `divisor` is zero or is not finite.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isMultipleOf(divisor, annotations) {\n if (!globalThis.Number.isFinite(divisor) || divisor === 0) {\n throw new globalThis.RangeError(`Expected a finite non-zero number, got ${globalThis.String(divisor)}`);\n }\n divisor = globalThis.Math.abs(divisor);\n return makeFilter(input => remainder(input, divisor) === 0, {\n expected: `a value that is a multiple of ${divisor}`,\n representation: {\n id: \"effect/schema/isMultipleOf\",\n payload: {\n divisor\n }\n },\n toJsonSchema: () => ({\n multipleOf: divisor\n }),\n toCode: () => ({\n runtime: `Schema.isMultipleOf(${format(divisor)})`\n }),\n ...annotations\n });\n}\n/**\n * Validates that a number is a safe integer (within the safe integer range\n * that can be exactly represented in JavaScript).\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to the `type: \"integer\"` constraint in JSON Schema.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies an integer constraint.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isInt(annotations) {\n return makeFilter(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 }),\n toCode: () => ({\n runtime: \"Schema.isInt()\"\n }),\n arbitraryConstraint: {\n number: \"integer\"\n },\n ...annotations\n });\n}\n/**\n * Schema for integers, rejecting `NaN`, `Infinity`, and `-Infinity`.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const Int = /*#__PURE__*/Number.check(/*#__PURE__*/isInt());\n/**\n * Schema for non-negative safe integers, including zero.\n *\n * **When to use**\n *\n * Use when you need a count, index, or size that cannot be negative.\n *\n * @see {@link Int} for safe integers that may be negative\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const Natural = /*#__PURE__*/Int.check(/*#__PURE__*/isGreaterThanOrEqualTo(0));\n/**\n * Validates that a number is a 32-bit signed integer (range: -2,147,483,648 to\n * 2,147,483,647).\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to the `format: \"int32\"` constraint in OpenAPI 3.1,\n * or `minimum`/`maximum` constraints in other JSON Schema targets.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies integer and range\n * constraints to ensure generated numbers are 32-bit signed integers.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isInt32(annotations) {\n return new SchemaAST.FilterGroup([isInt(), isBetween({\n minimum: -2147483648,\n maximum: 2147483647\n })], {\n expected: \"a 32-bit integer\",\n ...annotations\n });\n}\n/**\n * Validates that a number is a 32-bit unsigned integer (range: 0 to\n * 4,294,967,295).\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to the `format: \"uint32\"` constraint in OpenAPI 3.1,\n * or `minimum`/`maximum` constraints in other JSON Schema targets.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies integer and range\n * constraints to ensure generated numbers are 32-bit unsigned integers.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isUint32(annotations) {\n return new SchemaAST.FilterGroup([isInt(), isBetween({\n minimum: 0,\n maximum: 4294967295\n })], {\n expected: \"a 32-bit unsigned integer\",\n ...annotations\n });\n}\nfunction encodeDatePayload(date) {\n if (globalThis.Number.isNaN(date.getTime())) {\n throw new globalThis.RangeError(`Expected a valid Date, got ${format(date)}`);\n }\n return date.toISOString();\n}\nfunction formatDateRuntime(date) {\n return `new Date(${format(date.getTime())})`;\n}\n/**\n * Validates that a Date is greater than the specified value (exclusive).\n *\n * **Details**\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies an exclusive lower bound.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isGreaterThanDate = /*#__PURE__*/makeIsGreaterThan({\n order: Order.Date,\n annotate: exclusiveMinimum => {\n const encoded = encodeDatePayload(exclusiveMinimum);\n return {\n representation: {\n id: \"effect/schema/isGreaterThanDate\",\n payload: {\n exclusiveMinimum: encoded\n }\n },\n toJsonSchema: () => ({}),\n toCode: () => ({\n runtime: `Schema.isGreaterThanDate(${formatDateRuntime(exclusiveMinimum)})`\n })\n };\n }\n});\n/**\n * Validates that a Date is greater than or equal to the specified date\n * (inclusive).\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check does not have a direct JSON Schema equivalent, as JSON Schema\n * validates date strings, not Date objects.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies an inclusive lower bound.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isGreaterThanOrEqualToDate = /*#__PURE__*/makeIsGreaterThanOrEqualTo({\n order: Order.Date,\n annotate: minimum => {\n const encoded = encodeDatePayload(minimum);\n return {\n representation: {\n id: \"effect/schema/isGreaterThanOrEqualToDate\",\n payload: {\n minimum: encoded\n }\n },\n toJsonSchema: () => ({}),\n toCode: () => ({\n runtime: `Schema.isGreaterThanOrEqualToDate(${formatDateRuntime(minimum)})`\n })\n };\n }\n});\n/**\n * Validates that a Date is less than the specified value (exclusive).\n *\n * **Details**\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies an exclusive upper bound.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isLessThanDate = /*#__PURE__*/makeIsLessThan({\n order: Order.Date,\n annotate: exclusiveMaximum => {\n const encoded = encodeDatePayload(exclusiveMaximum);\n return {\n representation: {\n id: \"effect/schema/isLessThanDate\",\n payload: {\n exclusiveMaximum: encoded\n }\n },\n toJsonSchema: () => ({}),\n toCode: () => ({\n runtime: `Schema.isLessThanDate(${formatDateRuntime(exclusiveMaximum)})`\n })\n };\n }\n});\n/**\n * Validates that a Date is less than or equal to the specified date\n * (inclusive).\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check does not have a direct JSON Schema equivalent, as JSON Schema\n * validates date strings, not Date objects.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies an inclusive upper bound.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isLessThanOrEqualToDate = /*#__PURE__*/makeIsLessThanOrEqualTo({\n order: Order.Date,\n annotate: maximum => {\n const encoded = encodeDatePayload(maximum);\n return {\n representation: {\n id: \"effect/schema/isLessThanOrEqualToDate\",\n payload: {\n maximum: encoded\n }\n },\n toJsonSchema: () => ({}),\n toCode: () => ({\n runtime: `Schema.isLessThanOrEqualToDate(${formatDateRuntime(maximum)})`\n })\n };\n }\n});\n/**\n * Validates that a Date is within a specified range. The range boundaries can\n * be inclusive or exclusive based on the provided options.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check does not have a direct JSON Schema equivalent, as JSON Schema\n * validates date strings, not Date objects.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies the specified lower and upper bounds.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isBetweenDate = /*#__PURE__*/makeIsBetween({\n order: Order.Date,\n annotate: options => {\n const exclusiveMinimum = options.exclusiveMinimum ? true : undefined;\n const exclusiveMaximum = options.exclusiveMaximum ? true : undefined;\n const payload = {\n minimum: encodeDatePayload(options.minimum),\n maximum: encodeDatePayload(options.maximum),\n ...(exclusiveMinimum && {\n exclusiveMinimum\n }),\n ...(exclusiveMaximum && {\n exclusiveMaximum\n })\n };\n return {\n representation: {\n id: \"effect/schema/isBetweenDate\",\n payload\n },\n toJsonSchema: () => ({}),\n toCode: () => ({\n runtime: `Schema.isBetweenDate({ minimum: ${formatDateRuntime(options.minimum)}, maximum: ${formatDateRuntime(options.maximum)}, exclusiveMinimum: ${format(exclusiveMinimum)}, exclusiveMaximum: ${format(exclusiveMaximum)} })`\n })\n };\n }\n});\n/**\n * Validates that a BigInt is greater than the specified value (exclusive).\n *\n * **Details**\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies an exclusive lower bound.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isGreaterThanBigInt = /*#__PURE__*/makeIsGreaterThan({\n order: Order.BigInt,\n annotate: exclusiveMinimum => {\n const encoded = exclusiveMinimum.toString(10);\n return {\n representation: {\n id: \"effect/schema/isGreaterThanBigInt\",\n payload: {\n exclusiveMinimum: encoded\n }\n },\n toJsonSchema: () => ({}),\n toCode: () => ({\n runtime: `Schema.isGreaterThanBigInt(${format(exclusiveMinimum)})`\n })\n };\n }\n});\n/**\n * Validates that a BigInt is greater than or equal to the specified value\n * (inclusive).\n *\n * **Details**\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies an inclusive lower bound.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isGreaterThanOrEqualToBigInt = /*#__PURE__*/makeIsGreaterThanOrEqualTo({\n order: Order.BigInt,\n annotate: minimum => {\n const encoded = minimum.toString(10);\n return {\n representation: {\n id: \"effect/schema/isGreaterThanOrEqualToBigInt\",\n payload: {\n minimum: encoded\n }\n },\n toJsonSchema: () => ({}),\n toCode: () => ({\n runtime: `Schema.isGreaterThanOrEqualToBigInt(${format(minimum)})`\n })\n };\n }\n});\n/**\n * Validates that a BigInt is less than the specified value (exclusive).\n *\n * **Details**\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies an exclusive upper bound.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isLessThanBigInt = /*#__PURE__*/makeIsLessThan({\n order: Order.BigInt,\n annotate: exclusiveMaximum => {\n const encoded = exclusiveMaximum.toString(10);\n return {\n representation: {\n id: \"effect/schema/isLessThanBigInt\",\n payload: {\n exclusiveMaximum: encoded\n }\n },\n toJsonSchema: () => ({}),\n toCode: () => ({\n runtime: `Schema.isLessThanBigInt(${format(exclusiveMaximum)})`\n })\n };\n }\n});\n/**\n * Validates that a BigInt is less than or equal to the specified value\n * (inclusive).\n *\n * **Details**\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies an inclusive upper bound.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isLessThanOrEqualToBigInt = /*#__PURE__*/makeIsLessThanOrEqualTo({\n order: Order.BigInt,\n annotate: maximum => {\n const encoded = maximum.toString(10);\n return {\n representation: {\n id: \"effect/schema/isLessThanOrEqualToBigInt\",\n payload: {\n maximum: encoded\n }\n },\n toJsonSchema: () => ({}),\n toCode: () => ({\n runtime: `Schema.isLessThanOrEqualToBigInt(${format(maximum)})`\n })\n };\n }\n});\n/**\n * Validates that a BigInt is within a specified range. The range boundaries can\n * be inclusive or exclusive based on the provided options.\n *\n * **Details**\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies the specified lower and upper bounds.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isBetweenBigInt = /*#__PURE__*/makeIsBetween({\n order: Order.BigInt,\n annotate: options => {\n const exclusiveMinimum = options.exclusiveMinimum ? true : undefined;\n const exclusiveMaximum = options.exclusiveMaximum ? true : undefined;\n const payload = {\n minimum: options.minimum.toString(10),\n maximum: options.maximum.toString(10),\n ...(exclusiveMinimum && {\n exclusiveMinimum\n }),\n ...(exclusiveMaximum && {\n exclusiveMaximum\n })\n };\n return {\n representation: {\n id: \"effect/schema/isBetweenBigInt\",\n payload\n },\n toJsonSchema: () => ({}),\n toCode: () => ({\n runtime: `Schema.isBetweenBigInt({ minimum: ${format(options.minimum)}, maximum: ${format(options.maximum)}, exclusiveMinimum: ${format(exclusiveMinimum)}, exclusiveMaximum: ${format(exclusiveMaximum)} })`\n })\n };\n }\n});\n/**\n * Validates that a value has at least the specified length. Works with strings\n * and arrays.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * For arrays, this check corresponds to `minItems`. For strings, it corresponds\n * to `minLength`. JavaScript counts UTF-16 code units while JSON Schema counts\n * Unicode code points, so the two validations can differ for some strings.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a `minLength`\n * constraint to ensure generated strings or arrays have at least the required\n * length.\n *\n * **Example** (Checking minimum length)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const NonEmptyStringSchema = Schema.String.check(Schema.isMinLength(1))\n * const NonEmptyArraySchema = Schema.Array(Schema.Number).check(Schema.isMinLength(1))\n * Schema.is(NonEmptyStringSchema)(\"a\") // => true\n * Schema.is(NonEmptyArraySchema)([1]) // => true\n * ```\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isMinLength(minLength, annotations) {\n minLength = Math.max(0, Math.floor(minLength));\n return makeFilter(input => input.length >= minLength, {\n expected: `a value with a length of at least ${minLength}`,\n representation: {\n id: \"effect/schema/isMinLength\",\n payload: {\n minLength\n }\n },\n toJsonSchema: ({\n type\n }) => type === \"array\" ? {\n minItems: minLength\n } : {\n minLength\n },\n toCode: () => ({\n runtime: `Schema.isMinLength(${minLength})`\n }),\n [InternalAnnotations.STRUCTURAL_ANNOTATION_KEY]: true,\n arbitraryConstraint: {\n minLength\n },\n ...annotations\n });\n}\n/**\n * Validates that a value has at least one element. Works with strings and arrays.\n * This is equivalent to `isMinLength(1)`.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to the `minLength: 1` constraint for strings or the\n * `minItems: 1` constraint for arrays in JSON Schema.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a `minLength: 1`\n * constraint to ensure generated strings or arrays are non-empty.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isNonEmpty(annotations) {\n return isMinLength(1, annotations);\n}\n/**\n * Validates that a value has at most the specified length. Works with strings\n * and arrays.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to the `maxLength` constraint for strings or the\n * `maxItems` constraint for arrays in JSON Schema.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a `maxLength`\n * constraint to ensure generated strings or arrays have at most the required\n * length.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isMaxLength(maxLength, annotations) {\n maxLength = Math.max(0, Math.floor(maxLength));\n return makeFilter(input => input.length <= maxLength, {\n expected: `a value with a length of at most ${maxLength}`,\n representation: {\n id: \"effect/schema/isMaxLength\",\n payload: {\n maxLength\n }\n },\n toJsonSchema: ({\n type\n }) => type === \"array\" ? {\n maxItems: maxLength\n } : {\n maxLength\n },\n toCode: () => ({\n runtime: `Schema.isMaxLength(${maxLength})`\n }),\n [InternalAnnotations.STRUCTURAL_ANNOTATION_KEY]: true,\n arbitraryConstraint: {\n maxLength\n },\n ...annotations\n });\n}\n/**\n * Validates that a value's length is within the specified range. Works with\n * strings and arrays.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * For arrays, this check corresponds to `minItems` and `maxItems`. For strings,\n * it corresponds to `minLength` and `maxLength`. JavaScript counts UTF-16 code\n * units while JSON Schema counts Unicode code points, so the two validations\n * can differ for some strings.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies `minLength` and\n * `maxLength` constraints to ensure generated strings or arrays have a length\n * within the specified range.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isLengthBetween(minimum, maximum, annotations) {\n minimum = Math.max(0, Math.floor(minimum));\n maximum = Math.max(0, Math.floor(maximum));\n return makeFilter(input => input.length >= minimum && input.length <= maximum, {\n expected: minimum === maximum ? `a value with a length of ${minimum}` : `a value with a length between ${minimum} and ${maximum}`,\n representation: {\n id: \"effect/schema/isLengthBetween\",\n payload: {\n minimum,\n maximum\n }\n },\n toJsonSchema: ({\n type\n }) => type === \"array\" ? {\n allOf: [{\n minItems: minimum\n }, {\n maxItems: maximum\n }]\n } : {\n allOf: [{\n minLength: minimum\n }, {\n maxLength: maximum\n }]\n },\n toCode: () => ({\n runtime: `Schema.isLengthBetween(${minimum}, ${maximum})`\n }),\n [InternalAnnotations.STRUCTURAL_ANNOTATION_KEY]: true,\n arbitraryConstraint: {\n minLength: minimum,\n maxLength: maximum\n },\n ...annotations\n });\n}\n/**\n * Validates that a value has at least the specified size. Works with values\n * that have a `size` property, such as `Set` or `Map`.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check does not have a direct JSON Schema equivalent, as it applies to\n * values with a `size` property rather than standard JSON Schema types.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a node-local `minSize` constraint.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isMinSize(minSize, annotations) {\n minSize = Math.max(0, Math.floor(minSize));\n return makeFilter(input => input.size >= minSize, {\n expected: `a value with a size of at least ${minSize}`,\n representation: {\n id: \"effect/schema/isMinSize\",\n payload: {\n minSize\n }\n },\n toJsonSchema: () => ({}),\n toCode: () => ({\n runtime: `Schema.isMinSize(${minSize})`\n }),\n [InternalAnnotations.STRUCTURAL_ANNOTATION_KEY]: true,\n arbitraryConstraint: {\n minSize\n },\n ...annotations\n });\n}\n/**\n * Validates that a value has at most the specified size. Works with values\n * that have a `size` property, such as `Set` or `Map`.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check does not have a direct JSON Schema equivalent, as it applies to\n * values with a `size` property rather than standard JSON Schema types.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a node-local `maxSize` constraint.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isMaxSize(maxSize, annotations) {\n maxSize = Math.max(0, Math.floor(maxSize));\n return makeFilter(input => input.size <= maxSize, {\n expected: `a value with a size of at most ${maxSize}`,\n representation: {\n id: \"effect/schema/isMaxSize\",\n payload: {\n maxSize\n }\n },\n toJsonSchema: () => ({}),\n toCode: () => ({\n runtime: `Schema.isMaxSize(${maxSize})`\n }),\n [InternalAnnotations.STRUCTURAL_ANNOTATION_KEY]: true,\n arbitraryConstraint: {\n maxSize\n },\n ...annotations\n });\n}\n/**\n * Validates that a value's size is within the specified range. Works with\n * values that have a `size` property, such as `Set` or `Map`.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check does not have a direct JSON Schema equivalent, as it applies to\n * values with a `size` property rather than standard JSON Schema types.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies node-local `minSize` and `maxSize` constraints.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isSizeBetween(minimum, maximum, annotations) {\n minimum = Math.max(0, Math.floor(minimum));\n maximum = Math.max(0, Math.floor(maximum));\n return makeFilter(input => input.size >= minimum && input.size <= maximum, {\n expected: minimum === maximum ? `a value with a size of ${minimum}` : `a value with a size between ${minimum} and ${maximum}`,\n representation: {\n id: \"effect/schema/isSizeBetween\",\n payload: {\n minimum,\n maximum\n }\n },\n toJsonSchema: () => ({}),\n toCode: () => ({\n runtime: `Schema.isSizeBetween(${minimum}, ${maximum})`\n }),\n [InternalAnnotations.STRUCTURAL_ANNOTATION_KEY]: true,\n arbitraryConstraint: {\n minSize: minimum,\n maxSize: maximum\n },\n ...annotations\n });\n}\n/**\n * Validates that an object contains at least the specified number of\n * properties. This includes both string and symbol keys when counting\n * properties.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to `minProperties` in JSON Schema. Effect applies the\n * check to the decoded object, while JSON Schema applies it to the original\n * input. Defaults and property transformations can therefore produce different\n * results.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a node-local `minProperties` constraint.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isMinProperties(minProperties, annotations) {\n minProperties = Math.max(0, Math.floor(minProperties));\n return makeFilter(input => Reflect.ownKeys(input).length >= minProperties, {\n expected: `a value with at least ${minProperties === 1 ? \"1 entry\" : `${minProperties} entries`}`,\n representation: {\n id: \"effect/schema/isMinProperties\",\n payload: {\n minProperties\n }\n },\n toJsonSchema: () => ({\n minProperties\n }),\n toCode: () => ({\n runtime: `Schema.isMinProperties(${minProperties})`\n }),\n [InternalAnnotations.STRUCTURAL_ANNOTATION_KEY]: true,\n arbitraryConstraint: {\n minProperties\n },\n ...annotations\n });\n}\n/**\n * Validates that an object contains at most the specified number of properties.\n * This includes both string and symbol keys when counting properties.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to `maxProperties` in JSON Schema. Effect applies the\n * check to the decoded object, while JSON Schema applies it to the original\n * input. Excess-property handling and property transformations can therefore\n * produce different results.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a node-local `maxProperties` constraint.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isMaxProperties(maxProperties, annotations) {\n maxProperties = Math.max(0, Math.floor(maxProperties));\n return makeFilter(input => Reflect.ownKeys(input).length <= maxProperties, {\n expected: `a value with at most ${maxProperties === 1 ? \"1 entry\" : `${maxProperties} entries`}`,\n representation: {\n id: \"effect/schema/isMaxProperties\",\n payload: {\n maxProperties\n }\n },\n toJsonSchema: () => ({\n maxProperties\n }),\n toCode: () => ({\n runtime: `Schema.isMaxProperties(${maxProperties})`\n }),\n [InternalAnnotations.STRUCTURAL_ANNOTATION_KEY]: true,\n arbitraryConstraint: {\n maxProperties\n },\n ...annotations\n });\n}\n/**\n * Validates that an object contains between `minimum` and `maximum` properties (inclusive).\n * This includes both string and symbol keys when counting properties.\n *\n * **Details**\n *\n * JSON Schema:\n *\n * This check corresponds to `minProperties` and `maxProperties` in JSON\n * Schema. Effect applies the check to the decoded object, while JSON Schema\n * applies it to the original input. Defaults, excess-property handling, and\n * property transformations can therefore produce different results.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies node-local `minProperties` and `maxProperties` constraints.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isPropertiesLengthBetween(minimum, maximum, annotations) {\n minimum = Math.max(0, Math.floor(minimum));\n maximum = Math.max(0, Math.floor(maximum));\n return makeFilter(input => Reflect.ownKeys(input).length >= minimum && Reflect.ownKeys(input).length <= maximum, {\n expected: minimum === maximum ? `a value with exactly ${minimum === 1 ? \"1 entry\" : `${minimum} entries`}` : `a value with between ${minimum} and ${maximum} entries`,\n representation: {\n id: \"effect/schema/isPropertiesLengthBetween\",\n payload: {\n minimum,\n maximum\n }\n },\n toJsonSchema: () => ({\n minProperties: minimum,\n maxProperties: maximum\n }),\n toCode: () => ({\n runtime: `Schema.isPropertiesLengthBetween(${minimum}, ${maximum})`\n }),\n [InternalAnnotations.STRUCTURAL_ANNOTATION_KEY]: true,\n arbitraryConstraint: {\n minProperties: minimum,\n maxProperties: maximum\n },\n ...annotations\n });\n}\n/**\n * Validates that every own property key of an object satisfies the encoded side\n * of the provided key schema.\n *\n * **Details**\n *\n * This check uses `Reflect.ownKeys`, so symbol keys are validated in addition to\n * string property names.\n *\n * JSON Schema:\n * This check corresponds to `propertyNames` in JSON Schema. Effect checks the\n * decoded object's keys, including symbols, while JSON Schema checks the string\n * names in the original input. Property transformations and excess-property\n * handling can therefore produce different results.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isPropertyNames(keySchema, annotations) {\n const propertyNames = toEncoded(keySchema);\n const parser = SchemaParser._issue(propertyNames.ast);\n return makeFilter((input, ast, options) => {\n const keys = Reflect.ownKeys(input);\n const issues = [];\n for (const key of keys) {\n const issue = parser(key, options);\n if (issue !== undefined) {\n issues.push(new SchemaIssue.Pointer([key], issue));\n if (options.errors === \"first\") break;\n }\n }\n if (Arr.isArrayNonEmpty(issues)) {\n return new SchemaIssue.Composite(ast, issues, input, options);\n }\n return true;\n }, {\n expected: \"an object with property names matching the schema\",\n representation: {\n id: \"effect/schema/isPropertyNames\",\n payload: null,\n schemas: [propertyNames.ast]\n },\n toJsonSchema: ({\n schemas\n }) => ({\n propertyNames: schemas[0]\n }),\n toCode: ({\n schemas\n }) => ({\n runtime: `Schema.isPropertyNames(${schemas[0].runtime})`\n }),\n [InternalAnnotations.STRUCTURAL_ANNOTATION_KEY]: true,\n ...annotations\n });\n}\n/**\n * Validates that all items in an array are unique according to Effect equality.\n *\n * **Details**\n *\n * JSON Schema:\n * This check corresponds to the `uniqueItems: true` constraint in JSON Schema.\n *\n * Arbitrary:\n * During arbitrary generation, this applies a node-local identity selector\n * for constructive uniqueness using Effect equality.\n *\n * @category validation\n * @since 4.0.0\n */\nexport function isUnique(annotations) {\n return makeFilter(input => Arr.dedupe(input).length === input.length, {\n expected: \"an array with unique items\",\n representation: {\n id: \"effect/schema/isUnique\",\n payload: null\n },\n toJsonSchema: () => ({\n uniqueItems: true\n }),\n toCode: () => ({\n runtime: \"Schema.isUnique()\"\n }),\n arbitraryConstraint: {\n uniqueBy: identity\n },\n ...annotations\n });\n}\n/**\n * Validates that all first elements in an array of key-value tuples are unique according to Effect equality.\n *\n * **Details**\n *\n * Arbitrary:\n * During arbitrary generation, this projects each entry to its key for constructive uniqueness.\n *\n * JSON Schema:\n * JSON Schema has no equivalent constraint, so this check is omitted from generated documents.\n *\n * @see {@link isUnique} for validating uniqueness of complete array elements\n * @category validation\n * @since 4.0.0\n */\nexport function isUniqueKey(annotations) {\n return makeFilter(input => Arr.dedupe(input.map(([key]) => key)).length === input.length, {\n expected: \"an array with unique keys\",\n representation: {\n id: \"effect/schema/isUniqueKey\",\n payload: null\n },\n toCode: () => ({\n runtime: \"Schema.isUniqueKey()\"\n }),\n arbitraryConstraint: {\n uniqueBy: entry => entry[0]\n },\n ...annotations\n });\n}\n/**\n * Schema for non-empty strings. Validates that a string has at least one\n * character.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const NonEmptyString = /*#__PURE__*/String.check(/*#__PURE__*/isNonEmpty());\n/**\n * Schema for strings whose JavaScript `length` is exactly `1`.\n *\n * **When to use**\n *\n * Use to validate string values that must have `length === 1`.\n *\n * **Gotchas**\n *\n * This schema uses JavaScript `String.length`, so visible characters made from\n * multiple UTF-16 code units do not satisfy `length === 1`.\n *\n * @see {@link String} for unconstrained string values\n * @see {@link NonEmptyString} for strings with length greater than zero\n * @see {@link isLengthBetween} for the underlying length check\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const Char = /*#__PURE__*/String.check(/*#__PURE__*/isLengthBetween(1, 1));\nconst getErrorOptionsKey = options => (options?.includeStack === true ? 1 : 0) | (options?.excludeCause === true ? 2 : 0);\nconst getErrorOptions = key => {\n switch (key) {\n case 0:\n return undefined;\n case 1:\n return {\n includeStack: true\n };\n case 2:\n return {\n excludeCause: true\n };\n case 3:\n return {\n includeStack: true,\n excludeCause: true\n };\n }\n};\nconst errorSchemaCache = [];\n/**\n * Schema for JavaScript `Error` objects.\n *\n * **Details**\n *\n * Default JSON serializer:\n *\n * Encodes an `Error` as an object with `message`, optional `name`, and optional\n * `cause` properties, and decodes that object back into an `Error`. Stack\n * traces are omitted by default for security. Pass `{ includeStack: true }` to\n * include stack traces, or `{ excludeCause: true }` to omit causes.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport function ErrorInstance(options) {\n const key = getErrorOptionsKey(options);\n const cached = errorSchemaCache[key];\n if (cached !== undefined) {\n return cached;\n }\n const normalizedOptions = getErrorOptions(key);\n const schema = instanceOf(globalThis.Error, {\n representation: {\n id: \"effect/schema/Error\",\n payload: normalizedOptions ?? null\n },\n toCode: () => ({\n runtime: normalizedOptions !== undefined ? `Schema.ErrorInstance(${format(normalizedOptions)})` : `Schema.ErrorInstance()`,\n Type: `globalThis.Error`\n }),\n expected: \"Error\",\n toCodecJson: () => link()(JsonError, SchemaTransformation.errorFromJsonError(normalizedOptions))\n });\n errorSchemaCache[key] = schema;\n return schema;\n}\nconst defectSchemaCache = [];\n/**\n * Schema for unexpected defect values represented as `unknown` with a JSON\n * encoded form.\n *\n * **When to use**\n *\n * Use when you need a schema for `Cause` defects or other unexpected failures\n * whose runtime value may be any value.\n *\n * **Details**\n *\n * The encoded side is {@link Json}. During decoding, JSON objects with a string\n * `message` property are decoded into JavaScript `Error` values, preserving a\n * non-default `name` and any string `stack`. Other JSON values decode\n * unchanged.\n *\n * During encoding, JavaScript `Error` values encode to JSON objects with\n * `name`, `message`, and optional `cause` properties. Pass\n * `{ includeStack: true }` to include string stack traces in encoded `Error`\n * defects, or `{ excludeCause: true }` to omit causes. Other values are\n * serialized through Effect's JSON formatter and then parsed back into JSON\n * when possible.\n *\n * **Gotchas**\n *\n * This schema is for carrying defects across JSON boundaries, not for\n * preserving every JavaScript value exactly. Some values cannot round-trip\n * unchanged:\n *\n * - A non-`Error` object such as `{ message: \"boom\" }` encodes as an\n * error-shaped JSON object and decodes back as an `Error`.\n * - JSON serialization normalizes unsupported values. For example,\n * `undefined` array elements encode as `null`, unsupported object properties\n * are omitted, and circular references are dropped.\n * - Values that cannot be represented as JSON fall back to Effect's formatted\n * string representation.\n *\n * @see {@link ErrorInstance} for a schema that only accepts JavaScript `Error` values.\n * @category schemas\n * @since 4.0.0\n */\nexport function Defect(options) {\n const key = getErrorOptionsKey(options);\n const cached = defectSchemaCache[key];\n if (cached !== undefined) {\n return cached;\n }\n const schema = Json.pipe(decodeTo(Unknown, SchemaTransformation.defectFromJson(getErrorOptions(key))));\n defectSchemaCache[key] = schema;\n return schema;\n}\n/**\n * Schema for readonly maps whose keys and values conform to the provided\n * schemas.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport function ReadonlyMap(key, value) {\n const schema = declareConstructor()([key, value], ([key, value]) => {\n const array = ArraySchema(Tuple([key, value]));\n return (input, ast, options) => {\n if (input instanceof globalThis.Map) {\n return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(array)([...input], options), {\n onSuccess: array => new globalThis.Map(array),\n onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, \"entries\", issue, input, options)\n });\n }\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n };\n }, {\n representation: {\n id: \"effect/schema/ReadonlyMap\",\n payload: null\n },\n toCode: ({\n typeParameters\n }) => ({\n runtime: `Schema.ReadonlyMap(${typeParameters[0].runtime}, ${typeParameters[1].runtime})`,\n Type: `globalThis.ReadonlyMap<${typeParameters[0].Type}, ${typeParameters[1].Type}>`\n }),\n expected: \"ReadonlyMap\",\n toCodec: ([key, value]) => link()(ArraySchema(Tuple([key, value])), SchemaTransformation.transform({\n decode: entries => new globalThis.Map(entries),\n encode: map => [...map.entries()]\n }))\n });\n return make(schema.ast, {\n key,\n value\n });\n}\n/**\n * Schema for readonly sets whose values conform to the provided element schema.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport function ReadonlySet(value) {\n const schema = declareConstructor()([value], ([value]) => {\n const array = ArraySchema(value);\n return (input, ast, options) => {\n if (input instanceof globalThis.Set) {\n return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(array)([...input], options), {\n onSuccess: array => new globalThis.Set(array),\n onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, \"values\", issue, input, options)\n });\n }\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n };\n }, {\n representation: {\n id: \"effect/schema/ReadonlySet\",\n payload: null\n },\n toCode: ({\n typeParameters\n }) => ({\n runtime: `Schema.ReadonlySet(${typeParameters[0].runtime})`,\n Type: `globalThis.ReadonlySet<${typeParameters[0].Type}>`\n }),\n expected: \"ReadonlySet\",\n toCodec: ([value]) => link()(ArraySchema(value), SchemaTransformation.transform({\n decode: values => new globalThis.Set(values),\n encode: set => [...set.values()]\n }))\n });\n return make(schema.ast, {\n value\n });\n}\n/**\n * Schema for JavaScript `RegExp` objects.\n *\n * **Details**\n *\n * The default JSON serializer encodes a `RegExp` as `{ source, flags }`.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const RegExp = /*#__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: String,\n flags: String\n }), SchemaTransformation.transformEffect({\n decode: (e, options) => Effect.try({\n try: () => new globalThis.RegExp(e.source, e.flags),\n catch: () => new SchemaIssue.InvalidValue({\n expected: \"valid RegExp source and flags\"\n }, e, options)\n }),\n encode: regExp => Effect.succeed({\n source: regExp.source,\n flags: regExp.flags\n })\n }))\n});\nconst URLString = /*#__PURE__*/String.annotate({\n expected: \"a string that will be decoded as a URL\"\n});\n/**\n * Schema for JavaScript `URL` objects.\n *\n * **Details**\n *\n * Default JSON serializer:\n *\n * - encodes `URL` as a `string`\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const URL = /*#__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, SchemaTransformation.urlFromString)\n});\n/**\n * Schema that decodes a `string` into a `URL`.\n *\n * **Details**\n *\n * Decoding:\n * - A **valid** URL `string` is decoded as a `URL`\n *\n * Encoding:\n * - A `URL` is encoded as a `string`\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const URLFromString = /*#__PURE__*/URLString.pipe(/*#__PURE__*/decodeTo(URL, SchemaTransformation.urlFromString));\nconst DateString = /*#__PURE__*/String.annotate({\n expected: \"a string that will be decoded as a Date\"\n});\n/**\n * Schema for valid JavaScript `Date` objects.\n *\n * **When to use**\n *\n * Use to validate in-memory values that must already be valid JavaScript date\n * objects.\n *\n * **Details**\n *\n * This schema accepts `Date` instances whose timestamp is not `NaN`. The\n * default JSON serializer encodes dates as ISO 8601 strings.\n *\n * **Example** (Defining a Date schema)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const date = Schema.decodeUnknownSync(Schema.Date)(new Date(\"2024-01-01\"))\n * date.toISOString() // => \"2024-01-01T00:00:00.000Z\"\n * ```\n *\n * @see {@link DateFromString} for decoding strings into Date instances\n * @see {@link DateFromMillis} for decoding epoch milliseconds into Date instances\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const Date = /*#__PURE__*/declare(input => input instanceof globalThis.Date && !globalThis.Number.isNaN(input.getTime()), {\n representation: {\n id: \"effect/schema/Date\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.Date`,\n Type: `globalThis.Date`\n }),\n expected: \"a valid Date\",\n toCodecJson: () => link()(DateString, SchemaTransformation.dateFromString)\n});\n/**\n * Schema that decodes a string into a JavaScript `Date`.\n *\n * **When to use**\n *\n * Use to model string-encoded dates that decode to JavaScript `Date` objects\n * and encode back to strings.\n *\n * **Details**\n *\n * Decoding:\n * The string is passed to JavaScript `Date` construction.\n *\n * Encoding:\n * A `Date` is encoded as an ISO string.\n *\n * Invalid date strings fail decoding.\n *\n * @see {@link DateFromMillis} for decoding epoch milliseconds into Date instances\n * @see {@link DateTimeUtcFromString} for decoding date-time strings into UTC values\n * @see {@link Date} for accepting Date instances directly\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const DateFromString = /*#__PURE__*/DateString.pipe(/*#__PURE__*/decodeTo(Date, SchemaTransformation.dateFromString));\n/**\n * Schema that decodes epoch milliseconds into a JavaScript `Date`.\n *\n * **When to use**\n *\n * Use to model numeric millisecond timestamps that decode to JavaScript `Date`\n * objects and encode back to numbers.\n *\n * **Details**\n *\n * Decoding:\n * A safe integer number of milliseconds since the Unix epoch is decoded as a\n * `Date`.\n *\n * Encoding:\n * A `Date` is encoded as its millisecond timestamp.\n *\n * **Gotchas**\n *\n * JavaScript `Date` supports a narrower range than safe integers, so integers\n * outside the supported `Date` range fail decoding.\n *\n * @see {@link DateFromString} for decoding string-encoded dates\n * @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const DateFromMillis = /*#__PURE__*/Int.pipe(/*#__PURE__*/decodeTo(Date, SchemaTransformation.dateFromMillis));\nconst JsonString = /*#__PURE__*/String.annotate({\n expected: \"a string that will be decoded as JSON\",\n contentMediaType: \"application/json\"\n});\n/**\n * Returns a schema that decodes a JSON string and then decodes the parsed value\n * using the given schema.\n *\n * **Details**\n *\n * This is useful when working with JSON-encoded strings where the actual\n * structure of the value is known and described by an existing schema.\n *\n * During decoding, the resulting schema first parses the input string as JSON,\n * using `reviver` when provided, and then runs the provided schema on the\n * parsed result. During encoding, it first encodes with the provided schema and\n * then passes the result to `JSON.stringify` with the optional `replacer` and\n * `space`.\n *\n * **Example** (Formatting encoded JSON)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.Struct({ a: Schema.Number })\n * const schemaFromJsonString = Schema.fromJsonString(schema, { space: 2 })\n *\n * Schema.encodeSync(schemaFromJsonString)({ a: 1 }) // => \"{\\n \\\"a\\\": 1\\n}\"\n * ```\n *\n * @category schemas\n * @since 4.0.0\n */\nexport function fromJsonString(schema, options) {\n return JsonString.pipe(decodeTo(schema, SchemaTransformation.fromJsonString(options)));\n}\n/** @internal */\nexport const UnknownFromJsonString = /*#__PURE__*/fromJsonString(Unknown);\n/**\n * Schema for JavaScript `File` objects.\n *\n * **Details**\n *\n * The default JSON serializer encodes a `File` as `{ data, type, name, lastModified }`\n * where `data` is base64-encoded.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const 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: String.check(isBase64()),\n type: String,\n name: String,\n lastModified: Int\n }), SchemaTransformation.transformEffect({\n decode: (e, options) => Result_.match(Encoding.decodeBase64(e.data), {\n onFailure: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid Base64 string\"\n }, e.data, options)),\n onSuccess: bytes => {\n const buffer = new globalThis.Uint8Array(bytes);\n return Effect.succeed(new globalThis.File([buffer], e.name, {\n type: e.type,\n lastModified: e.lastModified\n }));\n }\n }),\n encode: (file, options) => Effect.tryPromise({\n try: async () => {\n const bytes = new globalThis.Uint8Array(await file.arrayBuffer());\n return {\n data: Encoding.encodeBase64(bytes),\n type: file.type,\n name: file.name,\n lastModified: file.lastModified\n };\n },\n catch: () => new SchemaIssue.InvalidValue({\n expected: \"a readable File\"\n }, file, options)\n })\n }))\n});\n/**\n * Schema for JavaScript `FormData` objects.\n *\n * **Details**\n *\n * The default JSON serializer encodes a `FormData` as an array of `[key, entry]`\n * pairs where each entry is tagged as `\"String\"` or `\"File\"`.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const FormData = /*#__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([String, Union([Struct({\n _tag: tag(\"String\"),\n value: String\n }), Struct({\n _tag: tag(\"File\"),\n value: File\n })])])), SchemaTransformation.transformEffect({\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 Effect.succeed(out);\n },\n encode: formData => {\n return Effect.succeed(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});\n/**\n * Schema for decoding `FormData` through a bracket-notation tree.\n *\n * **When to use**\n *\n * Use to decode browser or multipart form data into a structured schema value.\n *\n * **Details**\n *\n * The decoding process has two steps:\n *\n * 1. Parse `FormData` into a nested tree record.\n * 2. Decode the parsed value with the given schema.\n *\n * You can express nested values using bracket notation.\n *\n * If you want to decode string fields into non-string primitive values, use\n * `Schema.toCodecStringTree`.\n *\n * **Example** (Decoding a flat structure)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.fromFormData(\n * Schema.Struct({\n * a: Schema.String\n * })\n * )\n *\n * const formData = new FormData()\n * formData.append(\"a\", \"1\")\n * formData.append(\"b\", \"2\")\n *\n * Schema.decodeUnknownSync(schema)(formData) // => { a: \"1\" }\n * ```\n *\n * **Example** (Decoding nested fields)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.fromFormData(\n * Schema.Struct({\n * a: Schema.String,\n * b: Schema.Struct({\n * c: Schema.String,\n * d: Schema.String\n * })\n * })\n * )\n *\n * const formData = new FormData()\n * formData.append(\"a\", \"1\")\n * formData.append(\"b[c]\", \"2\")\n * formData.append(\"b[d]\", \"3\")\n *\n * Schema.decodeUnknownSync(schema)(formData) // => { a: \"1\", b: { c: \"2\", d: \"3\" } }\n * ```\n *\n * **Example** (Parsing non-string values)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.fromFormData(\n * Schema.toCodecStringTree(\n * Schema.Struct({\n * a: Schema.Int\n * })\n * )\n * )\n *\n * const formData = new FormData()\n * formData.append(\"a\", \"1\")\n *\n * Schema.decodeUnknownSync(schema)(formData) // => { a: 1 }\n * ```\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function fromFormData(schema) {\n return FormData.pipe(decodeTo(schema, SchemaTransformation.fromFormData));\n}\n/**\n * Schema for JavaScript `URLSearchParams` objects.\n *\n * **Details**\n *\n * The default JSON serializer encodes a `URLSearchParams` as a query string.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const URLSearchParams = /*#__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()(String.annotate({\n expected: \"a query string that will be decoded as URLSearchParams\"\n }), SchemaTransformation.transform({\n decode: e => new globalThis.URLSearchParams(e),\n encode: params => params.toString()\n }))\n});\n/**\n * Schema for decoding `URLSearchParams` through a bracket-notation tree.\n *\n * **When to use**\n *\n * Use to decode query parameters into a structured schema value.\n *\n * **Details**\n *\n * The decoding process has two steps:\n *\n * 1. Parse `URLSearchParams` into a nested tree record.\n * 2. Decode the parsed value with the given schema.\n *\n * You can express nested values using bracket notation.\n *\n * If you want to decode values that are not strings, use\n * `Schema.toCodecStringTree`. This serializer preserves values such as\n * numbers when compatible with the schema.\n *\n * **Example** (Decoding a flat structure)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.fromURLSearchParams(\n * Schema.Struct({\n * a: Schema.String\n * })\n * )\n *\n * const urlSearchParams = new URLSearchParams(\"a=1&b=2\")\n *\n * Schema.decodeUnknownSync(schema)(urlSearchParams) // => { a: \"1\" }\n * ```\n *\n * **Example** (Decoding nested fields)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.fromURLSearchParams(\n * Schema.Struct({\n * a: Schema.String,\n * b: Schema.Struct({\n * c: Schema.String,\n * d: Schema.String\n * })\n * })\n * )\n *\n * const urlSearchParams = new URLSearchParams(\"a=1&b[c]=2&b[d]=3\")\n *\n * Schema.decodeUnknownSync(schema)(urlSearchParams) // => { a: \"1\", b: { c: \"2\", d: \"3\" } }\n * ```\n *\n * **Example** (Parsing non-string values)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.fromURLSearchParams(\n * Schema.toCodecStringTree(\n * Schema.Struct({\n * a: Schema.Int\n * })\n * )\n * )\n *\n * const urlSearchParams = new URLSearchParams(\"a=1&b=2\")\n *\n * Schema.decodeUnknownSync(schema)(urlSearchParams) // => { a: 1 }\n * ```\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function fromURLSearchParams(schema) {\n return URLSearchParams.pipe(decodeTo(schema, SchemaTransformation.fromURLSearchParams));\n}\n/**\n * Schema that parses a string into a `number` using JavaScript\n * number coercion.\n *\n * **Details**\n *\n * Decoding:\n * A `string` is decoded as a number, including possible non-finite values such as\n * `NaN`, `Infinity`, and `-Infinity`. Use `FiniteFromString` to reject non-finite\n * numbers.\n *\n * Encoding:\n * A number is encoded as a `string`.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const NumberFromString = /*#__PURE__*/String.annotate({\n expected: \"a string that will be decoded as a number\"\n}).pipe(/*#__PURE__*/decodeTo(Number, SchemaTransformation.numberFromString));\n/**\n * Schema that parses a string into a finite number.\n *\n * **Details**\n *\n * Decoding:\n * - A `string` is decoded as a finite number, rejecting `NaN`, `Infinity`, and\n * `-Infinity` values.\n *\n * Encoding:\n * - A finite number is encoded as a `string`.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const FiniteFromString = /*#__PURE__*/String.annotate({\n expected: \"a string that will be decoded as a finite number\"\n}).pipe(/*#__PURE__*/decodeTo(Finite, SchemaTransformation.numberFromString));\n/**\n * Schema that parses a string into a `bigint`.\n *\n * **When to use**\n *\n * Use to parse signed base-10 integer strings into bigint values while encoding\n * bigint values back to decimal strings.\n *\n * **Details**\n *\n * Decoding:\n * - A `string` is decoded as a `bigint`.\n *\n * Encoding:\n * - A `bigint` is encoded as a `string`.\n *\n * **Gotchas**\n *\n * Decoding accepts only strings matching `^-?\\d+$`.\n *\n * @see {@link isStringBigInt} for the string predicate used by this schema\n * @see {@link BigInt} for validating values that are already bigint values\n * @see {@link NumberFromString} for parsing JavaScript number strings, including non-finite values\n * @see {@link BigDecimalFromString} for parsing decimal number strings\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const BigIntFromString = /*#__PURE__*/make(SchemaAST.bigIntString).pipe(/*#__PURE__*/decodeTo(BigInt, SchemaTransformation.bigintFromString));\n/**\n * Schema for strings that contains no leading or trailing whitespaces.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const Trimmed = /*#__PURE__*/String.check(/*#__PURE__*/isTrimmed());\n/**\n * Schema that trims whitespace from a string.\n *\n * **Details**\n *\n * Decoding:\n * - A `string` is decoded as a string with no leading or trailing whitespaces.\n *\n * Encoding:\n * - The trimmed string is encoded as is.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const Trim = /*#__PURE__*/String.annotate({\n expected: \"a string that will be decoded as a trimmed string\"\n}).pipe(/*#__PURE__*/decodeTo(Trimmed, /*#__PURE__*/SchemaTransformation.trim()));\n/**\n * Decodes a base64 (RFC4648) encoded string into a UTF-8 string.\n *\n * **Details**\n *\n * Decoding:\n * - A **valid** base64 encoded string is decoded as a UTF-8 `string`.\n *\n * Encoding:\n * - A `string` is encoded as a base64-encoded string.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const StringFromBase64 = /*#__PURE__*/String.annotate({\n expected: \"a base64 encoded string that will be decoded as a UTF-8 string\"\n}).pipe(/*#__PURE__*/decodeTo(String, SchemaTransformation.stringFromBase64String));\n/**\n * Decodes a base64 (URL) encoded string into a UTF-8 string.\n *\n * **Details**\n *\n * Decoding:\n * - A **valid** base64 (URL) encoded string is decoded as a UTF-8 `string`.\n *\n * Encoding:\n * - A `string` is encoded as a base64 (URL) encoded string.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const StringFromBase64Url = /*#__PURE__*/String.annotate({\n expected: \"a base64 (URL) encoded string that will be decoded as a UTF-8 string\"\n}).pipe(/*#__PURE__*/decodeTo(String, SchemaTransformation.stringFromBase64UrlString));\n/**\n * Decodes a hex encoded string into a UTF-8 string.\n *\n * **Details**\n *\n * Decoding:\n * - A **valid** hex encoded string is decoded as a UTF-8 `string`.\n *\n * Encoding:\n * - A `string` is encoded as a hex string.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const StringFromHex = /*#__PURE__*/String.annotate({\n expected: \"a hex encoded string that will be decoded as a UTF-8 string\"\n}).pipe(/*#__PURE__*/decodeTo(String, SchemaTransformation.stringFromHexString));\n/**\n * Decodes a URI component encoded string into a UTF-8 string.\n * Can be used to store data in a URL.\n *\n * **Details**\n *\n * Decoding:\n * - A **valid** URI component encoded string is decoded as a UTF-8 `string`.\n *\n * Encoding:\n * - A `string` is encoded as a URI component encoded string.\n *\n * **Example** (Decoding URI component strings)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const PaginationSchema = Schema.Struct({\n * maxItemPerPage: Schema.Number,\n * page: Schema.Number\n * })\n *\n * const UrlSchema = Schema.StringFromUriComponent.pipe(\n * Schema.decodeTo(Schema.fromJsonString(PaginationSchema))\n * )\n *\n * Schema.encodeSync(UrlSchema)({ maxItemPerPage: 10, page: 1 }) // => \"%7B%22maxItemPerPage%22%3A10%2C%22page%22%3A1%7D\"\n * ```\n *\n * @category schemas\n * @since 3.12.0\n */\nexport const StringFromUriComponent = /*#__PURE__*/String.annotate({\n expected: \"a URI component encoded string that will be decoded as a UTF-8 string\"\n}).pipe(/*#__PURE__*/decodeTo(String, SchemaTransformation.stringFromUriComponent));\n/**\n * Schema for property keys accepted by Effect schemas: finite `number`,\n * `symbol`, or `string`.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const PropertyKey = /*#__PURE__*/Union([Finite, Symbol, String]);\n/**\n * Schema for a Standard Schema v1 failure result.\n *\n * **Details**\n *\n * The result contains an `issues` array where each issue has a message and an\n * optional path made of property keys or keyed path segments.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const StandardSchemaV1FailureResult = /*#__PURE__*/Struct({\n issues: /*#__PURE__*/ArraySchema(/*#__PURE__*/Struct({\n message: String,\n path: /*#__PURE__*/optional(/*#__PURE__*/ArraySchema(/*#__PURE__*/Union([PropertyKey, /*#__PURE__*/Struct({\n key: PropertyKey\n })])))\n }))\n});\n/**\n * Schema for a boolean parsed from 0 or 1.\n *\n * **When to use**\n *\n * Use when decoding data sources that represent booleans as `0 | 1` while\n * keeping boolean values in the decoded model.\n *\n * **Details**\n *\n * Decoding accepts only `0 | 1`, maps `1` to `true`, and maps `0` to `false`.\n * Encoding maps `true` to `1` and `false` to `0`.\n *\n * @see {@link Boolean} for validating values that are already booleans\n * @see {@link Literals} for keeping bit literals instead of decoding them\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const BooleanFromBit = /*#__PURE__*/Literals([0, 1]).pipe(/*#__PURE__*/decodeTo(Boolean, /*#__PURE__*/SchemaTransformation.transform({\n decode: bit => bit === 1,\n encode: bool => bool ? 1 : 0\n})));\nconst Base64String = /*#__PURE__*/String.annotate({\n expected: \"a base64 encoded string that will be decoded as Uint8Array\",\n format: \"byte\",\n contentEncoding: \"base64\"\n});\n/**\n * Schema for JavaScript `Uint8Array` objects.\n *\n * **Details**\n *\n * Default JSON serializer:\n *\n * The default JSON serializer encodes Uint8Array as a Base64 encoded string.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const Uint8Array = /*#__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, SchemaTransformation.uint8ArrayFromBase64String)\n});\n/**\n * Schema that decodes a base64 encoded string into a\n * `Uint8Array`.\n *\n * **Details**\n *\n * Decoding:\n * - A **valid** base64 encoded string is decoded as a `Uint8Array`.\n *\n * Encoding:\n * - A `Uint8Array` is encoded as a base64-encoded string.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const Uint8ArrayFromBase64 = /*#__PURE__*/Base64String.pipe(/*#__PURE__*/decodeTo(Uint8Array, SchemaTransformation.uint8ArrayFromBase64String));\n/**\n * Schema that decodes a base64 (URL) encoded string into a\n * `Uint8Array`.\n *\n * **Details**\n *\n * Decoding:\n * - A **valid** base64 (URL) encoded string is decoded as a `Uint8Array`.\n *\n * Encoding:\n * - A `Uint8Array` is encoded as a base64 (URL) encoded string.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const Uint8ArrayFromBase64Url = /*#__PURE__*/String.annotate({\n expected: \"a base64 (URL) encoded string that will be decoded as a Uint8Array\"\n}).pipe(/*#__PURE__*/decodeTo(Uint8Array, {\n decode: /*#__PURE__*/SchemaGetter.decodeBase64Url(),\n encode: /*#__PURE__*/SchemaGetter.encodeBase64Url()\n}));\n/**\n * Schema that decodes a hex encoded string into a\n * `Uint8Array`.\n *\n * **Details**\n *\n * Decoding:\n * - A **valid** hex encoded string is decoded as a `Uint8Array`.\n *\n * Encoding:\n * - A `Uint8Array` is encoded as a hex encoded string.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const Uint8ArrayFromHex = /*#__PURE__*/String.annotate({\n expected: \"a hex encoded string that will be decoded as a Uint8Array\"\n}).pipe(/*#__PURE__*/decodeTo(Uint8Array, {\n decode: /*#__PURE__*/SchemaGetter.decodeHex(),\n encode: /*#__PURE__*/SchemaGetter.encodeHex()\n}));\n// -----------------------------------------------------------------------------\n// BigDecimal schemas\n// -----------------------------------------------------------------------------\nconst bigDecimalFromString = /*#__PURE__*/SchemaTransformation.transformEffect({\n decode: (s, options) => {\n const result = BigDecimal_.fromString(s);\n return Option_.isNone(result) ? Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid BigDecimal string\"\n }, s, options)) : Effect.succeed(result.value);\n },\n encode: bd => Effect.succeed(BigDecimal_.format(bd))\n});\n/**\n * Validates that a BigDecimal is greater than the specified value (exclusive).\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isGreaterThanBigDecimal = /*#__PURE__*/makeIsGreaterThan({\n order: BigDecimal_.Order,\n formatter: bd => BigDecimal_.format(bd)\n});\n/**\n * Validates that a BigDecimal is greater than or equal to the specified value\n * (inclusive).\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isGreaterThanOrEqualToBigDecimal = /*#__PURE__*/makeIsGreaterThanOrEqualTo({\n order: BigDecimal_.Order,\n formatter: bd => BigDecimal_.format(bd)\n});\n/**\n * Validates that a BigDecimal is less than the specified value (exclusive).\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isLessThanBigDecimal = /*#__PURE__*/makeIsLessThan({\n order: BigDecimal_.Order,\n formatter: bd => BigDecimal_.format(bd)\n});\n/**\n * Validates that a BigDecimal is less than or equal to the specified value\n * (inclusive).\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isLessThanOrEqualToBigDecimal = /*#__PURE__*/makeIsLessThanOrEqualTo({\n order: BigDecimal_.Order,\n formatter: bd => BigDecimal_.format(bd)\n});\n/**\n * Validates that a `BigDecimal` is within a specified range.\n *\n * **Details**\n *\n * The minimum and maximum boundaries are inclusive by default. Pass\n * `exclusiveMinimum` or `exclusiveMaximum` to exclude either boundary.\n *\n * @category validation\n * @since 4.0.0\n */\nexport const isBetweenBigDecimal = /*#__PURE__*/makeIsBetween({\n order: BigDecimal_.Order,\n formatter: bd => BigDecimal_.format(bd)\n});\nconst BigDecimalString = /*#__PURE__*/String.annotate({\n expected: \"a string that will be decoded as a BigDecimal\"\n});\nconst arbitraryBigDecimalMaxScale = 20;\nfunction bigIntArbitrarySchema(minimum, maximum) {\n if (minimum !== undefined && maximum !== undefined) {\n return BigInt.check(isBetweenBigInt({\n minimum,\n maximum\n }));\n }\n if (minimum !== undefined) return BigInt.check(isGreaterThanOrEqualToBigInt(minimum));\n if (maximum !== undefined) return BigInt.check(isLessThanOrEqualToBigInt(maximum));\n return BigInt;\n}\nfunction bigDecimalValueAtScale(value, scale) {\n return value.value * globalThis.BigInt(10) ** globalThis.BigInt(scale - value.scale);\n}\nfunction bigDecimalArbitrarySchema(constraint) {\n if (constraint?.minimum === undefined && constraint?.maximum === undefined) {\n return Struct({\n value: BigInt,\n scale: Int.check(isBetween({\n minimum: 0,\n maximum: arbitraryBigDecimalMaxScale\n }))\n });\n }\n const scale = Math.max(arbitraryBigDecimalMaxScale, constraint.minimum?.scale ?? 0, constraint.maximum?.scale ?? 0, constraint.exclusiveMinimum === true && constraint.minimum !== undefined ? constraint.minimum.scale + 1 : 0, constraint.exclusiveMaximum === true && constraint.maximum !== undefined ? constraint.maximum.scale + 1 : 0);\n const minimum = constraint.minimum === undefined ? undefined : bigDecimalValueAtScale(constraint.minimum, scale) + (constraint.exclusiveMinimum === true ? globalThis.BigInt(1) : globalThis.BigInt(0));\n const maximum = constraint.maximum === undefined ? undefined : bigDecimalValueAtScale(constraint.maximum, scale) - (constraint.exclusiveMaximum === true ? globalThis.BigInt(1) : globalThis.BigInt(0));\n if (minimum !== undefined && maximum !== undefined && minimum > maximum) {\n return Struct({\n value: BigInt,\n scale: Int.check(isBetween({\n minimum: 0,\n maximum: arbitraryBigDecimalMaxScale\n }))\n });\n }\n return Struct({\n value: bigIntArbitrarySchema(minimum, maximum),\n scale: Literal(scale)\n });\n}\n/**\n * Schema for `BigDecimal` values.\n *\n * **When to use**\n *\n * Use when you already have Effect decimal instances and need schema\n * validation, formatting, equivalence, and JSON string serialization.\n *\n * **Details**\n *\n * Default JSON serializer:\n *\n * - encodes `BigDecimal` as a `string`\n *\n * @see {@link BigDecimalFromString} for parsing string input into a BigDecimal\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const BigDecimal = /*#__PURE__*/declare(BigDecimal_.isBigDecimal, {\n representation: {\n id: \"effect/schema/BigDecimal\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.BigDecimal`,\n Type: `BigDecimal.BigDecimal`,\n importDeclarations: [`import * as BigDecimal from \"effect/BigDecimal\"`]\n }),\n expected: \"BigDecimal\",\n toCodecArbitrary: ({\n constraint\n }) => linkDecoding()(bigDecimalArbitrarySchema(constraint), SchemaGetter.transform(({\n scale,\n value\n }) => BigDecimal_.make(value, scale))),\n toCodecJson: () => link()(BigDecimalString, bigDecimalFromString),\n toFormatter: () => bd => BigDecimal_.format(bd)\n});\n/**\n * Schema that parses a string into a `BigDecimal`.\n *\n * **When to use**\n *\n * Use to parse decimal or exponent-notation strings into arbitrary-precision\n * BigDecimal values while encoding them back to strings.\n *\n * **Details**\n *\n * Decoding:\n * - A `string` is decoded with `BigDecimal.fromString`.\n *\n * Encoding:\n * - A `BigDecimal` is encoded with `BigDecimal.format`.\n *\n * **Gotchas**\n *\n * An empty string decodes as zero.\n *\n * @see {@link BigDecimal} for validating values that are already BigDecimal values\n * @see {@link BigIntFromString} for parsing base-10 integer strings into bigint values\n * @see {@link NumberFromString} for parsing JavaScript number strings\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const BigDecimalFromString = /*#__PURE__*/BigDecimalString.pipe(/*#__PURE__*/decodeTo(BigDecimal, bigDecimalFromString));\n/**\n * Schema for exact, non-negative `ByteSize` values.\n *\n * **Details**\n *\n * The JSON codec encodes the byte count as a bigint string, preserving values\n * beyond JavaScript's safe-integer range. The StringTree codec uses the\n * human-readable byte-size syntax exposed by {@link ByteSizeFromString}.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const ByteSize = /*#__PURE__*/declare(ByteSize_.isByteSize, {\n representation: {\n id: \"effect/schema/ByteSize\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.ByteSize`,\n Type: `ByteSize.ByteSize`,\n importDeclarations: [`import * as ByteSize from \"effect/ByteSize\"`]\n }),\n expected: \"ByteSize\",\n toCodecJson: () => link()(BigInt.check(isGreaterThanOrEqualToBigInt(globalThis.BigInt(0))), SchemaTransformation.transform({\n decode: ByteSize_.bytes,\n encode: ByteSize_.toBigInt\n })),\n toCodecStringTree: () => link()(ByteSizeString, SchemaTransformation.byteSizeFromString)\n});\nconst ByteSizeString = /*#__PURE__*/String.annotate({\n expected: \"a string that will be decoded as a ByteSize\"\n});\n/**\n * Schema that decodes byte-size strings into exact, non-negative `ByteSize`\n * values.\n *\n * **Details**\n *\n * Decoding accepts an unsigned base-10 integer or decimal followed by optional\n * whitespace and one of these case-sensitive units:\n *\n * - bytes: `B`, `byte`, or `bytes`\n * - decimal SI units (powers of 1,000): `kB`, `MB`, `GB`, `TB`, `PB`, `EB`,\n * `ZB`, `YB`, `RB`, or `QB`, plus their lowercase singular and plural names\n * - binary IEC units (powers of 1,024): `KiB`, `MiB`, `GiB`, `TiB`, `PiB`,\n * `EiB`, `ZiB`, or `YiB`, plus their lowercase singular and plural names\n *\n * Leading and trailing whitespace is ignored. A decimal quantity must resolve\n * to an integral number of bytes, so `1.5 kB` is accepted while `0.1 KiB` is\n * rejected.\n *\n * Encoding returns the exact byte count as `<count> byte` or `<count> bytes`.\n *\n * **Gotchas**\n *\n * A unit is required. Signs, exponent notation, digit separators, and ambiguous\n * unit spellings such as `KB`, `mb`, `Mb`, or `b` are rejected.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const ByteSizeFromString = /*#__PURE__*/ByteSizeString.pipe(/*#__PURE__*/decodeTo(ByteSize, SchemaTransformation.byteSizeFromString));\n/**\n * Schema that decodes non-negative bigint byte counts.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const ByteSizeFromBigInt = /*#__PURE__*/BigInt.pipe(/*#__PURE__*/decodeTo(ByteSize, SchemaTransformation.byteSizeFromBigInt));\n/**\n * Schema that decodes non-negative safe-integer byte counts.\n *\n * **Details**\n *\n * Encoding fails when the byte count exceeds `Number.MAX_SAFE_INTEGER`.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const ByteSizeFromNumber = /*#__PURE__*/Number.pipe(/*#__PURE__*/decodeTo(ByteSize, SchemaTransformation.byteSizeFromNumber));\n/**\n * Creates a schema for `Cause.Reason` values using separate schemas for typed\n * failures and unexpected defects.\n *\n * **When to use**\n *\n * Use when serializing or decoding individual cause reasons separately from a\n * full failure cause, with distinct schemas for typed errors and defects.\n *\n * **Details**\n *\n * `Fail` reasons use the `error` schema, `Die` reasons use the `defect` schema,\n * and `Interrupt` reasons carry only an optional fiber id.\n *\n * @see {@link Cause} for constructing schemas for full Cause values\n * @see {@link CauseReasonIso} for the ISO shape of each cause reason\n *\n * @category schemas\n * @since 4.0.0\n */\nexport function CauseReason(error, defect) {\n const schema = declareConstructor()([error, defect], ([error, defect]) => (input, ast, options) => {\n if (!Cause_.isReason(input)) {\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n }\n switch (input._tag) {\n case \"Fail\":\n return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(error)(input.error, options), {\n onSuccess: Cause_.makeFailReason,\n onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, \"error\", issue, input, options)\n });\n case \"Die\":\n return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(defect)(input.defect, options), {\n onSuccess: Cause_.makeDieReason,\n onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, \"defect\", issue, input, options)\n });\n case \"Interrupt\":\n return Effect.succeed(input);\n }\n }, {\n representation: {\n id: \"effect/schema/CauseReason\",\n payload: null\n },\n toCode: ({\n typeParameters\n }) => ({\n runtime: `Schema.CauseReason(${typeParameters[0].runtime}, ${typeParameters[1].runtime})`,\n Type: `Cause.Failure<${typeParameters[0].Type}, ${typeParameters[1].Type}>`,\n importDeclarations: [`import * as Cause from \"effect/Cause\"`]\n }),\n expected: \"Cause.Failure\",\n toCodec: ([error, defect]) => link()(Union([Struct({\n _tag: Literal(\"Fail\"),\n error\n }), Struct({\n _tag: Literal(\"Die\"),\n defect\n }), Struct({\n _tag: Literal(\"Interrupt\"),\n fiberId: UndefinedOr(Finite)\n })]), SchemaTransformation.transform({\n decode: e => {\n switch (e._tag) {\n case \"Fail\":\n return Cause_.makeFailReason(e.error);\n case \"Die\":\n return Cause_.makeDieReason(e.defect);\n case \"Interrupt\":\n return Cause_.makeInterruptReason(e.fiberId);\n }\n },\n encode: identity\n }))\n });\n return make(schema.ast, {\n error,\n defect\n });\n}\n/**\n * Creates a schema for `Cause` values using separate schemas for typed failures\n * and unexpected defects.\n *\n * **When to use**\n *\n * Use to validate, transform, or serialize Effect failure causes when typed\n * failures and unexpected defects need separate schemas.\n *\n * **Details**\n *\n * The `error` schema is applied to `Fail` reasons and the `defect` schema is\n * applied to `Die` reasons. Interrupt reasons do not use either schema and\n * carry only an optional fiber id.\n *\n * @see {@link CauseReason} for the schema used by each individual cause reason\n * @see {@link CauseIso} for the ordered array representation used by the schema ISO\n *\n * @category schemas\n * @since 3.10.0\n */\nexport function Cause(error, defect) {\n const schema = declareConstructor()([error, defect], ([error, defect]) => {\n const failures = ArraySchema(CauseReason(error, defect));\n return (input, ast, options) => {\n if (!Cause_.isCause(input)) {\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n }\n return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(failures)(input.reasons, options), {\n onSuccess: Cause_.fromReasons,\n onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, \"failures\", issue, input, options)\n });\n };\n }, {\n representation: {\n id: \"effect/schema/Cause\",\n payload: null\n },\n toCode: ({\n typeParameters\n }) => ({\n runtime: `Schema.Cause(${typeParameters[0].runtime}, ${typeParameters[1].runtime})`,\n Type: `Cause.Cause<${typeParameters[0].Type}, ${typeParameters[1].Type}>`,\n importDeclarations: [`import * as Cause from \"effect/Cause\"`]\n }),\n expected: \"Cause\",\n toCodec: ([error, defect]) => link()(ArraySchema(CauseReason(error, defect)), SchemaTransformation.transform({\n decode: Cause_.fromReasons,\n encode: ({\n reasons: failures\n }) => failures\n }))\n });\n return make(schema.ast, {\n error,\n defect\n });\n}\n// -----------------------------------------------------------------------------\n// Chunk schemas\n// -----------------------------------------------------------------------------\nfunction chunkLink(values) {\n return link()(values, SchemaTransformation.transform({\n decode: Chunk_.fromIterable,\n encode: Arr.fromIterable\n }));\n}\n/**\n * Schema for chunks whose values conform to the provided element schema.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport function Chunk(value) {\n const schema = declareConstructor()([value], ([value]) => {\n const values = ArraySchema(value);\n return (input, ast, options) => {\n if (Chunk_.isChunk(input)) {\n return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(values)(Arr.fromIterable(input), options), {\n onSuccess: Chunk_.fromIterable,\n onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, \"values\", issue, input, options)\n });\n }\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n };\n }, {\n representation: {\n id: \"effect/schema/Chunk\",\n payload: null\n },\n toCode: ({\n typeParameters\n }) => ({\n runtime: `Schema.Chunk(${typeParameters[0].runtime})`,\n Type: `Chunk.Chunk<${typeParameters[0].Type}>`\n }),\n expected: \"Chunk\",\n toCodec: ([value]) => chunkLink(ArraySchema(value)),\n toCodecArbitrary: ({\n constraint,\n typeParameters: [value]\n }) => chunkLink(withArrayLengthConstraints(ArraySchema(value), constraint?.minLength, constraint?.maxLength)),\n toEquivalence: ([value]) => Chunk_.makeEquivalence(value)\n });\n return make(schema.ast, {\n value\n });\n}\n// -----------------------------------------------------------------------------\n// DateTime schemas\n// -----------------------------------------------------------------------------\nfunction dateTimeUtcFromInput() {\n return SchemaGetter.transformEffect((input, options) => {\n return Option_.match(DateTime.make(input), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n message: \"Invalid DateTime input\"\n }, input, options)),\n onSome: dt => Effect.succeed(DateTime.toUtc(dt))\n });\n });\n}\nconst timeZoneOffsetFromNumber = /*#__PURE__*/SchemaTransformation.transform({\n decode: n => DateTime.zoneMakeOffset(n),\n encode: tz => tz.offset\n});\nconst timeZoneNamedFromString = /*#__PURE__*/SchemaTransformation.transformEffect({\n decode: (s, options) => {\n return Option_.match(DateTime.zoneMakeNamed(s), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid IANA time zone\"\n }, s, options)),\n onSome: Effect.succeed\n });\n },\n encode: tz => Effect.succeed(tz.id)\n});\nconst timeZoneFromString = /*#__PURE__*/SchemaTransformation.transformEffect({\n decode: (s, options) => {\n return Option_.match(DateTime.zoneFromString(s), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid time zone\"\n }, s, options)),\n onSome: Effect.succeed\n });\n },\n encode: tz => Effect.succeed(DateTime.zoneToString(tz))\n});\nconst dateTimeUtcFromString = /*#__PURE__*/SchemaTransformation.transformEffect({\n decode: (s, options) => {\n return Option_.match(DateTime.make(s), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid UTC DateTime string\"\n }, s, options)),\n onSome: result => Effect.succeed(DateTime.toUtc(result))\n });\n },\n encode: utc => Effect.succeed(DateTime.formatIso(utc))\n});\nconst dateTimeZonedFromString = /*#__PURE__*/SchemaTransformation.transformEffect({\n decode: (s, options) => {\n return Option_.match(DateTime.makeZonedFromString(s), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid Zoned DateTime string\"\n }, s, options)),\n onSome: Effect.succeed\n });\n },\n encode: zoned => Effect.succeed(DateTime.formatIsoZoned(zoned))\n});\nconst arbitraryMinimumDateTimestamp = -8_640_000_000_000_000;\nconst arbitraryMaximumDateTimestamp = 8_640_000_000_000_000;\nconst arbitraryMinimumZonedDateTimeTimestamp = arbitraryMinimumDateTimestamp + 14 * 60 * 60 * 1000;\nconst arbitraryMaximumZonedDateTimeTimestamp = arbitraryMaximumDateTimestamp - 14 * 60 * 60 * 1000;\nconst arbitraryMinimumTimeZoneOffset = -12 * 60 * 60 * 1000;\nconst arbitraryMaximumTimeZoneOffset = 14 * 60 * 60 * 1000;\nconst arbitraryNamedTimeZones = [\"UTC\", \"Europe/London\", \"America/New_York\", \"Asia/Tokyo\", \"Australia/Sydney\"];\nfunction dateTimeArbitraryBounds(constraint, domainMinimum, domainMaximum) {\n const minimum = Math.max(domainMinimum, constraint?.minimum === undefined ? domainMinimum : constraint.minimum.epochMilliseconds + (constraint.exclusiveMinimum === true ? 1 : 0));\n const maximum = Math.min(domainMaximum, constraint?.maximum === undefined ? domainMaximum : constraint.maximum.epochMilliseconds - (constraint.exclusiveMaximum === true ? 1 : 0));\n return minimum <= maximum ? [minimum, maximum] : [domainMinimum, domainMaximum];\n}\nfunction dateTimeArbitraryInteger(minimum, maximum) {\n return Int.check(isBetween({\n minimum,\n maximum\n }));\n}\nfunction timeZoneArbitrarySchema() {\n return Union([dateTimeArbitraryInteger(arbitraryMinimumTimeZoneOffset, arbitraryMaximumTimeZoneOffset), Literals(arbitraryNamedTimeZones)]);\n}\n/**\n * Schema for `DateTime.Utc` values.\n *\n * **When to use**\n *\n * Use to validate existing `DateTime.Utc` schema values and use the default JSON\n * codec that represents them as UTC ISO strings.\n *\n * **Details**\n *\n * The default JSON codec decodes UTC ISO strings into `DateTime.Utc` values and\n * encodes `DateTime.Utc` values as UTC ISO strings.\n *\n * @see {@link DateTimeUtcFromString} for decoding date-time strings into UTC values\n * @see {@link DateTimeUtcFromDate} for decoding JavaScript Date values into UTC values\n * @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values\n * @see {@link DateTimeZoned} for preserving zoned DateTime values\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const DateTimeUtc = /*#__PURE__*/declare(u => DateTime.isDateTime(u) && DateTime.isUtc(u), {\n representation: {\n id: \"effect/schema/DateTimeUtc\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.DateTimeUtc`,\n Type: `DateTime.Utc`,\n importDeclarations: [`import * as DateTime from \"effect/DateTime\"`]\n }),\n expected: \"DateTime.Utc\",\n toCodecArbitrary: ({\n constraint\n }) => {\n const [minimum, maximum] = dateTimeArbitraryBounds(constraint, arbitraryMinimumDateTimestamp, arbitraryMaximumDateTimestamp);\n return linkDecoding()(dateTimeArbitraryInteger(minimum, maximum), SchemaGetter.transform(DateTime.makeUnsafe));\n },\n toCodecJson: () => link()(String, dateTimeUtcFromString),\n toFormatter: () => utc => utc.toString()\n});\n/**\n * Schema that decodes a `Date` into a `DateTime.Utc`.\n *\n * **When to use**\n *\n * Use when you need to decode valid JavaScript `Date` objects into\n * `DateTime.Utc` values.\n *\n * **Details**\n *\n * Decoding:\n * - A **valid** `Date` is decoded as a `DateTime.Utc`\n *\n * Encoding:\n * - A `DateTime.Utc` is encoded as a `Date`\n *\n * @see {@link DateTimeUtc} for validating values that are already `DateTime.Utc`\n * @see {@link DateTimeUtcFromString} for decoding date-time strings into UTC values\n * @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values\n * @see {@link Date} for validating Date instances without converting them\n *\n * @category schemas\n * @since 3.12.0\n */\nexport const DateTimeUtcFromDate = /*#__PURE__*/Date.pipe(/*#__PURE__*/decodeTo(DateTimeUtc, {\n decode: /*#__PURE__*/dateTimeUtcFromInput(),\n encode: /*#__PURE__*/SchemaGetter.transform(DateTime.toDateUtc)\n}));\n/**\n * Schema that decodes a date-time string into a `DateTime.Utc`.\n *\n * **Details**\n *\n * Decoding:\n *\n * - A string accepted by `DateTime.make` is parsed and normalized to UTC. Strings\n * without an explicit zone are interpreted as UTC.\n *\n * Encoding:\n *\n * - A `DateTime.Utc` is encoded as a UTC ISO 8601 string.\n *\n * @see {@link DateTimeUtcFromDate} for decoding JavaScript Date values into UTC values\n * @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values\n * @see {@link DateFromString} for decoding strings into JavaScript Date instances\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const DateTimeUtcFromString = /*#__PURE__*/String.annotate({\n expected: \"a string that will be decoded as a DateTime.Utc\"\n}).pipe(/*#__PURE__*/decodeTo(DateTimeUtc, dateTimeUtcFromString));\n/**\n * Schema that decodes a number into a `DateTime.Utc`.\n *\n * **Details**\n *\n * Decoding:\n * - A number of milliseconds since the Unix epoch is decoded as a `DateTime.Utc`\n *\n * Encoding:\n * - A `DateTime.Utc` is encoded as a number of milliseconds since the Unix epoch.\n *\n * @see {@link DateTimeUtcFromDate} for decoding JavaScript Date values into UTC values\n * @see {@link DateTimeUtcFromString} for decoding date-time strings into UTC values\n * @see {@link DateFromMillis} for decoding epoch milliseconds into JavaScript Date instances\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const DateTimeUtcFromMillis = /*#__PURE__*/Int.pipe(/*#__PURE__*/decodeTo(DateTimeUtc, {\n decode: /*#__PURE__*/dateTimeUtcFromInput(),\n encode: /*#__PURE__*/SchemaGetter.transform(DateTime.toEpochMillis)\n}));\n/**\n * Schema for `DateTime.TimeZone.Offset` values.\n *\n * **Details**\n *\n * Default JSON serializer:\n *\n * - encodes `DateTime.TimeZone.Offset` as a number (offset in milliseconds)\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const TimeZoneOffset = /*#__PURE__*/declare(DateTime.isTimeZoneOffset, {\n representation: {\n id: \"effect/schema/TimeZoneOffset\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.TimeZoneOffset`,\n Type: `DateTime.TimeZone.Offset`,\n importDeclarations: [`import * as DateTime from \"effect/DateTime\"`]\n }),\n expected: \"DateTime.TimeZone.Offset\",\n toCodecJson: () => link()(Int, timeZoneOffsetFromNumber),\n toFormatter: () => tz => DateTime.zoneToString(tz)\n});\nconst TimeZoneNamedString = /*#__PURE__*/String.annotate({\n expected: \"an IANA time zone identifier\"\n});\n/**\n * Schema for `DateTime.TimeZone.Named` values.\n *\n * **Details**\n *\n * Default JSON serializer:\n *\n * - encodes `DateTime.TimeZone.Named` as a string (IANA time zone identifier)\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const TimeZoneNamed = /*#__PURE__*/declare(DateTime.isTimeZoneNamed, {\n representation: {\n id: \"effect/schema/TimeZoneNamed\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.TimeZoneNamed`,\n Type: `DateTime.TimeZone.Named`,\n importDeclarations: [`import * as DateTime from \"effect/DateTime\"`]\n }),\n expected: \"DateTime.TimeZone.Named\",\n toCodecArbitrary: () => linkDecoding()(Literals(arbitraryNamedTimeZones), SchemaGetter.transform(DateTime.zoneMakeNamedUnsafe)),\n toCodecJson: () => link()(TimeZoneNamedString, timeZoneNamedFromString),\n toFormatter: () => tz => DateTime.zoneToString(tz)\n});\n/**\n * Schema that parses an IANA time zone identifier string into a `DateTime.TimeZone.Named`.\n *\n * **Details**\n *\n * Decoding:\n * - A `string` is decoded as a `DateTime.TimeZone.Named`.\n *\n * Encoding:\n * - A `DateTime.TimeZone.Named` is encoded as a `string`.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const TimeZoneNamedFromString = /*#__PURE__*/TimeZoneNamedString.pipe(/*#__PURE__*/decodeTo(TimeZoneNamed, timeZoneNamedFromString));\nconst TimeZoneString = /*#__PURE__*/String.annotate({\n expected: \"a time zone string (IANA identifier or offset like +03:00)\"\n});\n/**\n * Schema for `DateTime.TimeZone` values.\n *\n * **Details**\n *\n * Default JSON serializer:\n *\n * - encodes `DateTime.TimeZone` as a string (IANA identifier or offset like\n * `+03:00`)\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const TimeZone = /*#__PURE__*/declare(DateTime.isTimeZone, {\n representation: {\n id: \"effect/schema/TimeZone\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.TimeZone`,\n Type: `DateTime.TimeZone`,\n importDeclarations: [`import * as DateTime from \"effect/DateTime\"`]\n }),\n expected: \"DateTime.TimeZone\",\n toCodecArbitrary: () => linkDecoding()(timeZoneArbitrarySchema(), SchemaGetter.transform(value => typeof value === \"number\" ? DateTime.zoneMakeOffset(value) : DateTime.zoneMakeNamedUnsafe(value))),\n toCodecJson: () => link()(TimeZoneString, timeZoneFromString),\n toFormatter: () => tz => DateTime.zoneToString(tz)\n});\n/**\n * Schema that parses a time zone string into a `DateTime.TimeZone`.\n *\n * **Details**\n *\n * Decoding:\n * - A `string` (IANA identifier or offset like `+03:00`) is decoded as a `DateTime.TimeZone`.\n *\n * Encoding:\n * - A `DateTime.TimeZone` is encoded as a `string`.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const TimeZoneFromString = /*#__PURE__*/TimeZoneString.pipe(/*#__PURE__*/decodeTo(TimeZone, timeZoneFromString));\nconst DateTimeZonedString = /*#__PURE__*/String.annotate({\n expected: \"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])\"\n});\n/**\n * Schema for `DateTime.Zoned` values.\n *\n * **Details**\n *\n * Default JSON serializer:\n *\n * - encodes offset zones as an ISO date-time with a numeric offset, such as\n * `YYYY-MM-DDTHH:mm:ss.sss+HH:MM`\n * - encodes named zones by appending the IANA identifier in brackets, such as\n * `YYYY-MM-DDTHH:mm:ss.sss+HH:MM[Time/Zone]`\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const DateTimeZoned = /*#__PURE__*/declare(u => DateTime.isDateTime(u) && DateTime.isZoned(u), {\n representation: {\n id: \"effect/schema/DateTimeZoned\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.DateTimeZoned`,\n Type: `DateTime.Zoned`,\n importDeclarations: [`import * as DateTime from \"effect/DateTime\"`]\n }),\n expected: \"DateTime.Zoned\",\n toCodecArbitrary: ({\n constraint\n }) => {\n const [minimum, maximum] = dateTimeArbitraryBounds(constraint, arbitraryMinimumZonedDateTimeTimestamp, arbitraryMaximumZonedDateTimeTimestamp);\n return linkDecoding()(Struct({\n epochMilliseconds: dateTimeArbitraryInteger(minimum, maximum),\n timeZone: timeZoneArbitrarySchema()\n }), SchemaGetter.transform(({\n epochMilliseconds,\n timeZone\n }) => DateTime.makeZonedUnsafe(epochMilliseconds, {\n timeZone\n })));\n },\n toCodecJson: () => link()(DateTimeZonedString, dateTimeZonedFromString),\n toFormatter: () => zoned => DateTime.formatIsoZoned(zoned),\n toEquivalence: () => DateTime.Equivalence\n});\n/**\n * Schema that parses a zoned DateTime string into a `DateTime.Zoned`.\n *\n * **Details**\n *\n * Decoding:\n * - A `string` (e.g. `2024-01-01T00:00:00.000+00:00[Europe/London]`) is decoded as a `DateTime.Zoned`.\n *\n * Encoding:\n * - A `DateTime.Zoned` is encoded as a `string`.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const DateTimeZonedFromString = /*#__PURE__*/DateTimeZonedString.pipe(/*#__PURE__*/decodeTo(DateTimeZoned, dateTimeZonedFromString));\nconst netAddressFromString = (declaration, parse, encode, identifier) => String.pipe(decodeTo(declaration, SchemaTransformation.transformEffect({\n decode: (input, options) => {\n const result = parse(input);\n return Result_.isSuccess(result) ? Effect.succeed(result.success) : Effect.fail(new SchemaIssue.InvalidValue({\n message: result.failure.message\n }, input, options));\n },\n encode: value => Effect.succeed(encode(value))\n}))).annotate({\n identifier\n});\n/**\n * Schema for already-constructed MAC address values.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const MacAddress = /*#__PURE__*/declare(NetAddress_.isMacAddress, {\n identifier: \"MacAddress\"\n});\n/**\n * Schema for MAC addresses encoded as canonical colon-separated hexadecimal strings.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const MacAddressFromString = /*#__PURE__*/netAddressFromString(MacAddress, NetAddress_.macAddressFromString, NetAddress_.formatMacAddress, \"MacAddressFromString\");\n/**\n * Schema for already-constructed IPv4 address values.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv4Address = /*#__PURE__*/declare(NetAddress_.isIpv4Address, {\n identifier: \"Ipv4Address\"\n});\n/**\n * Schema for IPv4 addresses encoded as canonical dotted-decimal strings.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv4AddressFromString = /*#__PURE__*/netAddressFromString(Ipv4Address, NetAddress_.ipv4FromString, NetAddress_.formatIp, \"Ipv4AddressFromString\");\n/**\n * Schema for already-constructed IPv6 address values.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv6Address = /*#__PURE__*/declare(NetAddress_.isIpv6Address, {\n identifier: \"Ipv6Address\"\n});\n/**\n * Schema for IPv6 addresses encoded as canonical strings.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv6AddressFromString = /*#__PURE__*/netAddressFromString(Ipv6Address, NetAddress_.ipv6FromString, NetAddress_.formatIp, \"Ipv6AddressFromString\");\n/**\n * Schema for already-constructed IPv4 or IPv6 address values.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpAddress = /*#__PURE__*/declare(NetAddress_.isIpAddress, {\n identifier: \"IpAddress\"\n});\n/**\n * Schema for IP addresses encoded as canonical numeric strings.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpAddressFromString = /*#__PURE__*/netAddressFromString(IpAddress, NetAddress_.ipFromString, NetAddress_.formatIp, \"IpAddressFromString\");\n/**\n * Schema for already-constructed IPv4 interface address values.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv4Interface = /*#__PURE__*/declare(IpInterface_.isIpv4Interface, {\n identifier: \"Ipv4Interface\"\n});\n/**\n * Schema for IPv4 interface addresses encoded as an address and prefix length.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv4InterfaceFromString = /*#__PURE__*/netAddressFromString(Ipv4Interface, IpInterface_.ipv4FromString, IpInterface_.format, \"Ipv4InterfaceFromString\");\n/**\n * Schema for already-constructed IPv6 interface address values.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv6Interface = /*#__PURE__*/declare(IpInterface_.isIpv6Interface, {\n identifier: \"Ipv6Interface\"\n});\n/**\n * Schema for IPv6 interface addresses encoded as an address and prefix length.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv6InterfaceFromString = /*#__PURE__*/netAddressFromString(Ipv6Interface, IpInterface_.ipv6FromString, IpInterface_.format, \"Ipv6InterfaceFromString\");\n/**\n * Schema for already-constructed IPv4 or IPv6 interface address values.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpInterface = /*#__PURE__*/declare(IpInterface_.isIpInterface, {\n identifier: \"IpInterface\"\n});\n/**\n * Schema for IPv4 or IPv6 interface addresses encoded as an address and prefix length.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpInterfaceFromString = /*#__PURE__*/netAddressFromString(IpInterface, IpInterface_.fromString, IpInterface_.format, \"IpInterfaceFromString\");\n/**\n * Schema for already-constructed canonical IPv4 network prefixes.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv4Network = /*#__PURE__*/declare(IpNetwork_.isIpv4Network, {\n identifier: \"Ipv4Network\"\n});\n/**\n * Schema for canonical IPv4 network prefixes encoded in CIDR notation.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv4NetworkFromString = /*#__PURE__*/netAddressFromString(Ipv4Network, IpNetwork_.ipv4FromString, IpNetwork_.format, \"Ipv4NetworkFromString\");\n/**\n * Schema for already-constructed canonical IPv6 network prefixes.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv6Network = /*#__PURE__*/declare(IpNetwork_.isIpv6Network, {\n identifier: \"Ipv6Network\"\n});\n/**\n * Schema for canonical IPv6 network prefixes encoded in CIDR notation.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv6NetworkFromString = /*#__PURE__*/netAddressFromString(Ipv6Network, IpNetwork_.ipv6FromString, IpNetwork_.format, \"Ipv6NetworkFromString\");\n/**\n * Schema for already-constructed canonical IPv4 or IPv6 network prefixes.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpNetwork = /*#__PURE__*/declare(IpNetwork_.isIpNetwork, {\n identifier: \"IpNetwork\"\n});\n/**\n * Schema for canonical IPv4 or IPv6 network prefixes encoded in CIDR notation.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpNetworkFromString = /*#__PURE__*/netAddressFromString(IpNetwork, IpNetwork_.fromString, IpNetwork_.format, \"IpNetworkFromString\");\n/**\n * Schema for already-constructed resolved IPv4 internet addresses.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const InetAddressV4 = /*#__PURE__*/declare(NetAddress_.isInetAddressV4, {\n identifier: \"InetAddressV4\"\n});\n/**\n * Schema for already-constructed resolved IPv6 internet addresses.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const InetAddressV6 = /*#__PURE__*/declare(NetAddress_.isInetAddressV6, {\n identifier: \"InetAddressV6\"\n});\n/**\n * Schema for already-constructed resolved internet addresses.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const InetAddress = /*#__PURE__*/declare(NetAddress_.isInetAddress, {\n identifier: \"InetAddress\"\n});\n/**\n * Schema for resolved internet addresses encoded as numeric socket strings.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const InetAddressFromString = /*#__PURE__*/netAddressFromString(InetAddress, NetAddress_.inetAddressFromString, NetAddress_.formatInet, \"InetAddressFromString\");\n/**\n * Schema for already-constructed Unix-domain filesystem addresses.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const UnixPathAddress = /*#__PURE__*/declare(NetAddress_.isUnixPathAddress, {\n identifier: \"UnixPathAddress\"\n});\n/**\n * Schema for Unix-domain filesystem addresses encoded as opaque path strings.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const UnixPathAddressFromString = /*#__PURE__*/String.pipe(decodeTo(UnixPathAddress, SchemaTransformation.transform({\n decode: NetAddress_.unixPathAddress,\n encode: address => address.path\n}))).annotate({\n identifier: \"UnixPathAddressFromString\"\n});\n/**\n * Schema for already-constructed portable concrete socket addresses.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const SocketAddress = /*#__PURE__*/declare(NetAddress_.isSocketAddress, {\n identifier: \"SocketAddress\"\n});\n// -----------------------------------------------------------------------------\n// Duration schemas\n// -----------------------------------------------------------------------------\nconst durationFromString = /*#__PURE__*/SchemaTransformation.transformEffect({\n decode: (s, options) => Option_.match(Duration_.fromInput(s), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a valid Duration string\"\n }, s, options)),\n onSome: Effect.succeed\n }),\n encode: duration => Effect.succeed(globalThis.String(duration))\n});\nconst durationFromNanos = /*#__PURE__*/SchemaTransformation.transformEffect({\n decode: i => Effect.succeed(Duration_.nanos(i)),\n encode: (a, options) => Option_.match(Duration_.toNanos(a), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a Duration representable as a bigint\"\n }, a, options)),\n onSome: nanos => Effect.succeed(nanos)\n })\n});\nconst durationFromMillis = /*#__PURE__*/SchemaTransformation.transform({\n decode: i => Duration_.millis(i),\n encode: a => Duration_.toMillis(a)\n});\n/**\n * Schema for `Duration` values.\n *\n * **Details**\n *\n * The default JSON serializer encodes `Duration` as a tagged object with the\n * duration type and value.\n *\n * **Example** (Defining a Duration schema)\n *\n * ```ts import.meta.vitest\n * import { Duration, Schema } from \"effect\"\n *\n * Schema.decodeUnknownSync(Schema.Duration)(Duration.seconds(5)) // => Duration.seconds(5)\n * ```\n *\n * @category schemas\n *\n * @since 3.10.0\n */\nexport const Duration = /*#__PURE__*/declare(Duration_.isDuration, {\n representation: {\n id: \"effect/schema/Duration\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.Duration`,\n Type: `Duration.Duration`,\n importDeclarations: [`import * as Duration from \"effect/Duration\"`]\n }),\n expected: \"Duration\",\n toCodecJson: () => link()(Union([Struct({\n _tag: Literal(\"Infinity\")\n }), Struct({\n _tag: Literal(\"NegativeInfinity\")\n }), Struct({\n _tag: Literal(\"Nanos\"),\n value: BigInt\n }), Struct({\n _tag: Literal(\"Millis\"),\n value: Int\n })]), SchemaTransformation.transform({\n decode: e => {\n switch (e._tag) {\n case \"Infinity\":\n return Duration_.infinity;\n case \"NegativeInfinity\":\n return Duration_.negativeInfinity;\n case \"Nanos\":\n return Duration_.nanos(e.value);\n case \"Millis\":\n return Duration_.millis(e.value);\n }\n },\n encode: duration => {\n switch (duration.value._tag) {\n case \"Infinity\":\n return {\n _tag: \"Infinity\"\n };\n case \"NegativeInfinity\":\n return {\n _tag: \"NegativeInfinity\"\n };\n case \"Nanos\":\n return {\n _tag: \"Nanos\",\n value: duration.value.nanos\n };\n case \"Millis\":\n return {\n _tag: \"Millis\",\n value: duration.value.millis\n };\n }\n }\n }))\n});\nconst DurationString = /*#__PURE__*/String.annotate({\n expected: \"a string that will be decoded as a Duration\"\n});\n/**\n * Schema that parses a string into a `Duration`.\n *\n * **Details**\n *\n * Decoding:\n * - A `string` is decoded as a `Duration`, accepting any format that\n * `Duration.fromInput` can parse.\n *\n * Encoding:\n * - A `Duration` is encoded as a parseable `string`.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const DurationFromString = /*#__PURE__*/DurationString.pipe(/*#__PURE__*/decodeTo(Duration, durationFromString));\n/**\n * Schema that decodes a `bigint` into a `Duration`, treating the bigint as\n * nanoseconds.\n *\n * **Details**\n *\n * Decoding:\n * A `bigint` representing nanoseconds is decoded as a `Duration`.\n *\n * Encoding:\n * Finite durations are encoded as a `bigint` number of nanoseconds. Encoding\n * fails when the duration cannot be represented as nanoseconds, such as\n * `Duration.infinity` or `Duration.negativeInfinity`.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const DurationFromNanos = /*#__PURE__*/BigInt.pipe(/*#__PURE__*/decodeTo(Duration, durationFromNanos));\n/**\n * Schema that decodes a number into a `Duration`, treating the number as\n * milliseconds.\n *\n * **Details**\n *\n * Decoding:\n * - A finite or infinite number is decoded as a `Duration`\n *\n * Encoding:\n * - A `Duration` is encoded to a finite or infinite number of milliseconds\n *\n * **Gotchas**\n *\n * `NaN` is decoded as `Duration.zero`, matching `Duration.millis`.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport const DurationFromMillis = /*#__PURE__*/Number.pipe(/*#__PURE__*/decodeTo(Duration, durationFromMillis));\n/**\n * Creates a schema for `Exit` values using schemas for the success value, typed\n * failure, and unexpected defect channels.\n *\n * **When to use**\n *\n * Use when serializing or validating an effect outcome where success, typed\n * failure, and defects each need their own schema.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport function Exit(value, error, defect) {\n const schema = declareConstructor()([value, error, defect], ([value, error, defect]) => {\n const cause = Cause(error, defect);\n return (input, ast, options) => {\n if (!Exit_.isExit(input)) {\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n }\n switch (input._tag) {\n case \"Success\":\n return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(value)(input.value, options), {\n onSuccess: Exit_.succeed,\n onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, \"value\", issue, input, options)\n });\n case \"Failure\":\n return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(cause)(input.cause, options), {\n onSuccess: Exit_.failCause,\n onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, \"cause\", issue, input, options)\n });\n }\n };\n }, {\n representation: {\n id: \"effect/schema/Exit\",\n payload: null\n },\n toCode: ({\n typeParameters\n }) => ({\n runtime: `Schema.Exit(${typeParameters[0].runtime}, ${typeParameters[1].runtime}, ${typeParameters[2].runtime})`,\n Type: `Exit.Exit<${typeParameters[0].Type}, ${typeParameters[1].Type}, ${typeParameters[2].Type}>`,\n importDeclarations: [`import * as Exit from \"effect/Exit\"`]\n }),\n expected: \"Exit\",\n toCodec: ([value, error, defect]) => link()(Union([Struct({\n _tag: Literal(\"Success\"),\n value\n }), Struct({\n _tag: Literal(\"Failure\"),\n cause: Cause(error, defect)\n })]), SchemaTransformation.transform({\n decode: e => e._tag === \"Success\" ? Exit_.succeed(e.value) : Exit_.failCause(e.cause),\n encode: exit => Exit_.isSuccess(exit) ? {\n _tag: \"Success\",\n value: exit.value\n } : {\n _tag: \"Failure\",\n cause: exit.cause\n }\n }))\n });\n return make(schema.ast, {\n value,\n error,\n defect\n });\n}\nfunction graphEncodedSchema(type, node, edge) {\n return Struct({\n type: Literal(type),\n nodes: ArraySchema(Struct({\n index: Natural,\n data: node\n })),\n edges: ArraySchema(Struct({\n index: Natural,\n source: Natural,\n target: Natural,\n data: edge\n }))\n });\n}\nfunction graphDecode(input, options) {\n let previous = -1;\n const indexes = new Set();\n for (let i = 0; i < input.nodes.length; i++) {\n const index = input.nodes[i].index;\n if (index <= previous) {\n return Effect.fail(new SchemaIssue.Pointer([\"nodes\", i, \"index\"], new SchemaIssue.InvalidValue({\n expected: \"a strictly increasing node index\"\n }, index, options)));\n }\n previous = index;\n indexes.add(index);\n }\n previous = -1;\n for (let i = 0; i < input.edges.length; i++) {\n const edge = input.edges[i];\n if (edge.index <= previous) {\n return Effect.fail(new SchemaIssue.Pointer([\"edges\", i, \"index\"], new SchemaIssue.InvalidValue({\n expected: \"a strictly increasing edge index\"\n }, edge.index, options)));\n }\n previous = edge.index;\n if (!indexes.has(edge.source)) {\n return Effect.fail(new SchemaIssue.Pointer([\"edges\", i, \"source\"], new SchemaIssue.InvalidValue({\n expected: \"an encoded node index\"\n }, edge.source, options)));\n }\n if (!indexes.has(edge.target)) {\n return Effect.fail(new SchemaIssue.Pointer([\"edges\", i, \"target\"], new SchemaIssue.InvalidValue({\n expected: \"an encoded node index\"\n }, edge.target, options)));\n }\n }\n return Effect.succeed(InternalGraph.hydrate(input));\n}\nfunction graphEncode(input, type, options) {\n if (!InternalGraph.isGraph(input) || input.mutable || input.type !== type) {\n return Effect.fail(new SchemaIssue.InvalidValue({\n expected: `an immutable ${type} Graph`\n }, input, options));\n }\n return Effect.succeed(InternalGraph.snapshot(input));\n}\nfunction graphToEquivalence(node, edge) {\n return (self, that) => {\n const a = InternalGraph.snapshot(self);\n const b = InternalGraph.snapshot(that);\n if (a.type !== b.type || a.nodes.length !== b.nodes.length || a.edges.length !== b.edges.length) return false;\n for (let i = 0; i < a.nodes.length; i++) {\n if (a.nodes[i].index !== b.nodes[i].index || !node(a.nodes[i].data, b.nodes[i].data)) return false;\n }\n for (let i = 0; i < a.edges.length; i++) {\n const ae = a.edges[i];\n const be = b.edges[i];\n const sameEndpoints = a.type === \"directed\" ? ae.source === be.source && ae.target === be.target : ae.source === be.source && ae.target === be.target || ae.source === be.target && ae.target === be.source;\n if (ae.index !== be.index || !sameEndpoints || !edge(ae.data, be.data)) return false;\n }\n return true;\n };\n}\nfunction graphToArbitrary(type, node, edge) {\n return linkDecoding()(Union([Null, Struct({\n nodes: NonEmptyArray(node),\n edges: ArraySchema(Tuple([Natural, Natural, edge]))\n })]), SchemaGetter.transform(input => {\n if (input === null) return InternalGraph.hydrate({\n type,\n nodes: [],\n edges: []\n });\n const nodes = input.nodes.map((data, index) => ({\n index,\n data\n }));\n return InternalGraph.hydrate({\n type,\n nodes,\n edges: input.edges.map(([source, target, data], index) => ({\n index,\n source: source % nodes.length,\n target: target % nodes.length,\n data\n }))\n });\n }));\n}\nexport function Graph(type, node, edge) {\n const schema = declareConstructor()([node, edge], ([node, edge]) => {\n const encoded = graphEncodedSchema(type, node, edge);\n return (input, ast, options) => {\n if (!InternalGraph.isGraph(input) || input.mutable || input.type !== type) {\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n }\n return Effect.flatMap(SchemaParser.decodeUnknownEffect(encoded)(InternalGraph.snapshot(input), options), snapshot => graphDecode(snapshot, options));\n };\n }, {\n representation: {\n id: \"effect/schema/Graph\",\n payload: type\n },\n toCode: ({\n typeParameters\n }) => ({\n runtime: `Schema.Graph(${format(type)}, ${typeParameters[0].runtime}, ${typeParameters[1].runtime})`,\n Type: `Graph.Graph<${typeParameters[0].Type}, ${typeParameters[1].Type}, ${format(type)}>`,\n importDeclarations: [`import * as Graph from \"effect/Graph\"`]\n }),\n expected: `an immutable ${type} Graph`,\n toCodec: ([node, edge]) => link()(graphEncodedSchema(type, node, edge), SchemaTransformation.transformEffect({\n decode: graphDecode,\n encode: (graph, options) => graphEncode(graph, type, options)\n })),\n toCodecArbitrary: ({\n typeParameters: [node, edge]\n }) => graphToArbitrary(type, node, edge),\n toEquivalence: ([node, edge]) => graphToEquivalence(node, edge)\n });\n return make(schema.ast, {\n type,\n node,\n edge\n });\n}\n// -----------------------------------------------------------------------------\n// HashMap schemas\n// -----------------------------------------------------------------------------\nfunction hashMapLink(entries) {\n return link()(entries, SchemaTransformation.transform({\n decode: HashMap_.fromIterable,\n encode: HashMap_.toEntries\n }));\n}\n/**\n * Schema for hash maps whose keys and values conform to the provided schemas.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport function HashMap(key, value) {\n const schema = declareConstructor()([key, value], ([key, value]) => {\n const entries = ArraySchema(Tuple([key, value]));\n return (input, ast, options) => {\n if (HashMap_.isHashMap(input)) {\n return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(entries)(HashMap_.toEntries(input), options), {\n onSuccess: HashMap_.fromIterable,\n onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, \"entries\", issue, input, options)\n });\n }\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n };\n }, {\n representation: {\n id: \"effect/schema/HashMap\",\n payload: null\n },\n toCode: ({\n typeParameters\n }) => ({\n runtime: `Schema.HashMap(${typeParameters[0].runtime}, ${typeParameters[1].runtime})`,\n Type: `HashMap.HashMap<${typeParameters[0].Type}, ${typeParameters[1].Type}>`,\n importDeclarations: [`import * as HashMap from \"effect/HashMap\"`]\n }),\n expected: \"HashMap\",\n toCodec: ([key, value]) => hashMapLink(ArraySchema(Tuple([key, value]))),\n toCodecArbitrary: ({\n constraint,\n typeParameters: [key, value]\n }) => hashMapLink(withArrayLengthConstraints(ArraySchema(Tuple([key, value])).check(isUniqueKey()), constraint?.minSize, constraint?.maxSize)),\n toEquivalence: ([key, value]) => Equal.makeCompareMap(key, value)\n });\n return make(schema.ast, {\n key,\n value\n });\n}\n// -----------------------------------------------------------------------------\n// HashSet schemas\n// -----------------------------------------------------------------------------\nfunction hashSetLink(values) {\n return link()(values, SchemaTransformation.transform({\n decode: HashSet_.fromIterable,\n encode: Arr.fromIterable\n }));\n}\n/**\n * Schema for hash sets whose values conform to the provided element schema.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport function HashSet(value) {\n const schema = declareConstructor()([value], ([value]) => {\n const values = ArraySchema(value);\n return (input, ast, options) => {\n if (HashSet_.isHashSet(input)) {\n return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(values)(Arr.fromIterable(input), options), {\n onSuccess: HashSet_.fromIterable,\n onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, \"values\", issue, input, options)\n });\n }\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n };\n }, {\n representation: {\n id: \"effect/schema/HashSet\",\n payload: null\n },\n toCode: ({\n typeParameters\n }) => ({\n runtime: `Schema.HashSet(${typeParameters[0].runtime})`,\n Type: `HashSet.HashSet<${typeParameters[0].Type}>`\n }),\n expected: \"HashSet\",\n toCodec: ([value]) => hashSetLink(ArraySchema(value)),\n toCodecArbitrary: ({\n constraint,\n typeParameters: [value]\n }) => hashSetLink(withArrayLengthConstraints(ArraySchema(value).check(isUnique()), constraint?.minSize, constraint?.maxSize)),\n toEquivalence: ([value]) => Equal.makeCompareSet(value)\n });\n return make(schema.ast, {\n value\n });\n}\n/**\n * Schema for `Option<A>` values.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport function Option(value) {\n const schema = declareConstructor()([value], ([value]) => (input, ast, options) => {\n if (Option_.isOption(input)) {\n if (Option_.isNone(input)) {\n return Effect.succeedNone;\n }\n return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(value)(input.value, options), {\n onSuccess: Option_.some,\n onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, \"value\", issue, input, options)\n });\n }\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n }, {\n representation: {\n id: \"effect/schema/Option\",\n payload: null\n },\n toCode: ({\n typeParameters\n }) => ({\n runtime: `Schema.Option(${typeParameters[0].runtime})`,\n Type: `Option.Option<${typeParameters[0].Type}>`,\n importDeclarations: [`import * as Option from \"effect/Option\"`]\n }),\n expected: \"Option\",\n toCodec: ([value]) => link()(Union([Struct({\n _tag: Literal(\"Some\"),\n value\n }), Struct({\n _tag: Literal(\"None\")\n })]), SchemaTransformation.transform({\n decode: e => e._tag === \"None\" ? Option_.none() : Option_.some(e.value),\n encode: o => Option_.isSome(o) ? {\n _tag: \"Some\",\n value: o.value\n } : {\n _tag: \"None\"\n }\n }))\n });\n return make(schema.ast, {\n value\n });\n}\n/**\n * Decodes a nullable, required value `T` to a required `Option<T>` value.\n *\n * **Details**\n *\n * Decoding maps `null` to `None` and all other values to `Some`. Encoding maps\n * `None` to `null` and maps `Some` to its value.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport function OptionFromNullOr(schema) {\n return NullOr(schema).pipe(decodeTo(Option(toType(schema)), SchemaTransformation.optionFromNullOr()));\n}\n/**\n * Decodes a required value that may be `undefined` to a required `Option<T>`\n * value.\n *\n * **Details**\n *\n * Decoding maps `undefined` to `None` and all other values to `Some`. Encoding\n * maps `None` to `undefined` and maps `Some` to its value.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport function OptionFromUndefinedOr(schema) {\n return UndefinedOr(schema).pipe(decodeTo(Option(toType(schema)), SchemaTransformation.optionFromUndefinedOr()));\n}\n/**\n * Decodes a nullish value `T` to a required `Option<T>` value.\n *\n * **Details**\n *\n * Decoding maps `null` and `undefined` to `None` and all other values to\n * `Some`. Encoding maps `None` to `null` or `undefined` depending on\n * `options.onNoneEncoding`, which defaults to `undefined`, and maps `Some` to\n * its value.\n *\n * @category schemas\n * @since 3.10.0\n */\nexport function OptionFromNullishOr(schema, options) {\n return NullishOr(schema).pipe(decodeTo(Option(toType(schema)), SchemaTransformation.optionFromNullishOr(options)));\n}\n/**\n * Schema for HTTP cookie values.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Cookie = /*#__PURE__*/declare(Cookies_.isCookie, {\n representation: {\n id: \"effect/http/Cookie\",\n payload: null\n },\n toCode: () => ({\n runtime: \"Schema.Cookie\",\n Type: \"Cookies.Cookie\",\n importDeclarations: [`import * as Cookies from \"effect/unstable/http/Cookies\"`]\n }),\n expected: \"Cookie\"\n});\n/**\n * Schema for HTTP cookie collections.\n *\n * **Details**\n *\n * JSON encoding uses `Set-Cookie` header strings, while isomorphic encoding uses\n * a readonly record of cookie values.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Cookies = /*#__PURE__*/declare(Cookies_.isCookies, {\n representation: {\n id: \"effect/http/Cookies\",\n payload: null\n },\n toCode: () => ({\n runtime: \"Schema.Cookies\",\n Type: \"Cookies.Cookies\",\n importDeclarations: [`import * as Cookies from \"effect/unstable/http/Cookies\"`]\n }),\n expected: \"Cookies\",\n toCodecJson: () => link()(ArraySchema(String), SchemaTransformation.transform({\n decode: Cookies_.fromSetCookie,\n encode: Cookies_.toSetCookieHeaders\n })),\n toCodecIso: () => link()(Record(String, Cookie), SchemaTransformation.transform({\n decode: Cookies_.fromReadonlyRecord,\n encode: cookies => cookies.cookies\n }))\n});\n/**\n * Schema that decodes HTTP cookies into a record of decoded string values keyed\n * by cookie name.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const RecordFromCookies = /*#__PURE__*/Cookies.pipe(/*#__PURE__*/decodeTo(/*#__PURE__*/Record(String, String), /*#__PURE__*/SchemaTransformation.transform({\n decode: Cookies_.toRecord,\n encode: self => Cookies_.fromIterable(globalThis.Object.entries(self).map(([name, value]) => Cookies_.makeCookieUnsafe(name, value)))\n})));\n/**\n * Schema for HTTP headers encoded as records of string values.\n *\n * **Details**\n *\n * Decoding normalizes header names; encoding returns a plain record.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Headers = /*#__PURE__*/declare(Headers_.isHeaders, {\n representation: {\n id: \"effect/http/Headers\",\n payload: null\n },\n toCode: () => ({\n runtime: \"Schema.Headers\",\n Type: \"Headers.Headers\",\n importDeclarations: [`import * as Headers from \"effect/unstable/http/Headers\"`]\n }),\n expected: \"Headers\",\n toEquivalence: () => Headers_.Equivalence,\n toCodec: () => link()(Record(String, String), SchemaTransformation.transform({\n decode: Headers_.fromInput,\n encode: headers => ({\n ...headers\n })\n }))\n});\n/**\n * Schema for HTTP URL parameters.\n *\n * **Details**\n *\n * The encoded representation is an array of string key-value tuples.\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const UrlParams = /*#__PURE__*/declare(UrlParams_.isUrlParams, {\n representation: {\n id: \"effect/http/UrlParams\",\n payload: null\n },\n toCode: () => ({\n runtime: \"Schema.UrlParams\",\n Type: \"UrlParams.UrlParams\",\n importDeclarations: [`import * as UrlParams from \"effect/unstable/http/UrlParams\"`]\n }),\n expected: \"UrlParams\",\n toEquivalence: () => UrlParams_.Equivalence,\n toCodec: () => link()(ArraySchema(Tuple([String, String])), SchemaTransformation.transform({\n decode: UrlParams_.make,\n encode: self => self.params\n }))\n});\n/**\n * Extracts a JSON value from the first occurrence of the given `field` in URL\n * parameters.\n *\n * **Example** (Decoding a JSON parameter field)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n * import { UrlParams } from \"effect/unstable/http\"\n *\n * const extractFoo = Schema.JsonFromUrlParamsField(\"foo\").pipe(\n * Schema.decodeTo(Schema.Struct({\n * some: Schema.String,\n * number: Schema.Number\n * }))\n * )\n *\n * const decoded = Schema.decodeSync(extractFoo)(UrlParams.fromInput({\n * foo: `{\"some\":\"bar\",\"number\":42}`,\n * baz: \"qux\"\n * }))\n * const result = [decoded.some, decoded.number] // => [\"bar\", 42]\n * ```\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const JsonFromUrlParamsField = (field, options) => UrlParams.pipe(decodeTo(fromJsonString(Unknown, options), SchemaTransformation.transformEffect({\n decode: params => Option_.match(UrlParams_.getFirst(params, field), {\n onNone: () => Effect.fail(new SchemaIssue.Pointer([field], new SchemaIssue.MissingKey(undefined))),\n onSome: Effect.succeed\n }),\n encode: value => Effect.succeed(UrlParams_.make([[field, value]]))\n})));\n/**\n * Schema that decodes URL parameters into a record of string values.\n *\n * **Details**\n *\n * Keys with one value decode to a string, and keys with multiple values decode to\n * a non-empty readonly array of strings.\n *\n * **Example** (Decoding URL parameters to a record)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n * import { UrlParams } from \"effect/unstable/http\"\n *\n * const toStruct = Schema.RecordFromUrlParams.pipe(\n * Schema.decodeTo(Schema.Struct({\n * some: Schema.String,\n * number: Schema.FiniteFromString\n * }))\n * )\n *\n * const decoded = Schema.decodeSync(toStruct)(UrlParams.fromInput({\n * some: \"value\",\n * number: 42\n * }))\n * const result = [decoded.some, decoded.number] // => [\"value\", 42]\n * ```\n *\n * @unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const RecordFromUrlParams = /*#__PURE__*/UrlParams.pipe(/*#__PURE__*/decodeTo(/*#__PURE__*/Record(String, /*#__PURE__*/Union([String, /*#__PURE__*/NonEmptyArray(String)])), /*#__PURE__*/SchemaTransformation.transform({\n decode: UrlParams_.toReadonlyRecord,\n encode: UrlParams_.fromInput\n})));\n/**\n * Decodes an optional value `A` to a required `Option<A>` value.\n *\n * **Details**\n *\n * Decoding maps a missing key to `None` and a present value to `Some`.\n * Encoding maps `None` to a missing key and maps `Some` to its value.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport function OptionFromOptionalKey(schema) {\n return optionalKey(schema).pipe(decodeTo(Option(toType(schema)), SchemaTransformation.optionFromOptionalKey()));\n}\n/**\n * Decodes an optional or `undefined` value `A` to a required `Option<A>`\n * value.\n *\n * **Details**\n *\n * Decoding maps a missing key or a present `undefined` value to `None`, and\n * maps all other values to `Some`. Encoding maps `None` to a missing key and\n * maps `Some` to its value.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport function OptionFromOptional(schema) {\n return optional(schema).pipe(decodeTo(Option(toType(schema)), SchemaTransformation.optionFromOptional()));\n}\n/**\n * Decodes an optional or `null` or `undefined` value `A` to a required `Option<A>`\n * value.\n *\n * **Details**\n *\n * Decoding maps a missing key, `undefined`, or `null` to `None`, and maps all\n * other values to `Some`. Encoding maps `Some` to its value. `None` is encoded\n * according to `options.onNoneEncoding`: `\"omit\"` encodes a missing key,\n * `null` encodes `null`, and `undefined` encodes `undefined`.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport function OptionFromOptionalNullOr(schema, options) {\n const onNoneEncoding = options === undefined ? \"omit\" : options.onNoneEncoding;\n const noneValue = onNoneEncoding === null ? null : undefined;\n return optional(NullOr(schema)).pipe(decodeTo(Option(toType(schema)), SchemaTransformation.transformOptional({\n decode: oe => oe.pipe(Option_.filter(Predicate.isNotNullish), Option_.some),\n encode: onNoneEncoding === \"omit\" ? Option_.flatten : ot => Option_.some(Option_.getOrElse(Option_.flatten(ot), () => noneValue))\n })));\n}\n/**\n * Schema for `Redacted` values, which hide their contents from inspection.\n *\n * **Details**\n *\n * Options:\n *\n * - `label`: When provided, the schema will behave as follows:\n * - Values will be validated against the label in addition to the wrapped schema\n * - The default JSON serializer will deserialize into a `Redacted` instance with the label\n * - The arbitrary generator will produce a `Redacted` instance with the label\n * - The formatter will return the label\n * - `disallowJsonEncode`: When set to `true`, when attempting to encode a `Redacted` instance\n * into JSON, it will fail with an error. This is useful when the wrapped schema is\n * sensitive and should not be exposed in JSON.\n *\n * @see {@link RedactedFromValue} for decoding raw values and wrapping them in `Redacted`.\n * @category schemas\n * @since 3.10.0\n */\nexport function Redacted(value, options) {\n const label = typeof options?.label === \"string\" ? options.label : undefined;\n const disallowJsonEncode = options?.disallowJsonEncode === true;\n const normalizedOptions = label !== undefined ? disallowJsonEncode ? {\n label,\n disallowJsonEncode: true\n } : {\n label\n } : disallowJsonEncode ? {\n disallowJsonEncode: true\n } : undefined;\n const decodeLabel = label !== undefined ? SchemaParser.decodeUnknownEffect(Literal(label)) : undefined;\n const schema = declareConstructor()([value], ([value]) => (input, ast, poptions) => {\n if (Redacted_.isRedacted(input)) {\n const label = decodeLabel !== undefined ? Effect.mapErrorEager(decodeLabel(input.label, poptions), issue => new SchemaIssue.Pointer([\"label\"], issue)) : Effect.void;\n return Effect.flatMapEager(label, () => Effect.mapBothEager(SchemaParser.decodeUnknownEffect(value)(Redacted_.value(input), poptions), {\n onSuccess: () => input,\n onFailure: () => {\n return new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer([\"value\"], new SchemaIssue.InvalidValue(undefined, input, poptions))], input, poptions);\n }\n }));\n }\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, poptions));\n }, {\n representation: {\n id: \"effect/schema/Redacted\",\n payload: normalizedOptions ?? null\n },\n toCode: ({\n typeParameters\n }) => ({\n runtime: normalizedOptions !== undefined ? `Schema.Redacted(${typeParameters[0].runtime}, ${format(normalizedOptions)})` : `Schema.Redacted(${typeParameters[0].runtime})`,\n Type: `Redacted.Redacted<${typeParameters[0].Type}>`,\n importDeclarations: [`import * as Redacted from \"effect/Redacted\"`]\n }),\n expected: \"Redacted\",\n toCodecJson: ([value]) => link()(value, {\n decode: SchemaGetter.transform(e => Redacted_.make(e, {\n label\n })),\n encode: disallowJsonEncode ? SchemaGetter.forbidden(oe => \"Cannot serialize Redacted\" + (Option_.isSome(oe) && typeof oe.value.label === \"string\" ? ` with label: \"${oe.value.label}\"` : \"\")) : SchemaGetter.transform(Redacted_.value)\n }),\n toEquivalence: ([value]) => Redacted_.makeEquivalence(value)\n });\n return make(schema.ast, {\n value\n });\n}\n/**\n * Decodes a value and wraps it in `Redacted<A>`. Unlike {@link Redacted} which\n * expects the input to already be a `Redacted` instance, this schema decodes\n * the raw value and wraps it.\n *\n * @see {@link Redacted} for schemas whose input is already a `Redacted` value.\n * @category schemas\n * @since 4.0.0\n */\nexport function RedactedFromValue(value, options) {\n return decodeTo(Redacted(toType(value), {\n label: options?.label,\n disallowJsonEncode: options?.disallowEncode\n }), {\n decode: SchemaGetter.transform(t => Redacted_.make(t, {\n label: options?.label\n })),\n encode: options?.disallowEncode ? SchemaGetter.forbidden(oe => \"Cannot encode Redacted\" + (Option_.isSome(oe) && typeof oe.value.label === \"string\" ? ` with label: \"${oe.value.label}\"` : \"\")) : SchemaGetter.transform(Redacted_.value)\n })(value);\n}\n/**\n * Schema for `Result<A, E>` values.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport function Result(success, failure) {\n const schema = declareConstructor()([success, failure], ([success, failure]) => (input, ast, options) => {\n if (!Result_.isResult(input)) {\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n }\n switch (input._tag) {\n case \"Success\":\n return Effect.mapBothEager(SchemaParser.decodeEffect(success)(input.success, options), {\n onSuccess: Result_.succeed,\n onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, \"success\", issue, input, options)\n });\n case \"Failure\":\n return Effect.mapBothEager(SchemaParser.decodeEffect(failure)(input.failure, options), {\n onSuccess: Result_.fail,\n onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, \"failure\", issue, input, options)\n });\n }\n }, {\n representation: {\n id: \"effect/schema/Result\",\n payload: null\n },\n toCode: ({\n typeParameters\n }) => ({\n runtime: `Schema.Result(${typeParameters[0].runtime}, ${typeParameters[1].runtime})`,\n Type: `Result.Result<${typeParameters[0].Type}, ${typeParameters[1].Type}>`,\n importDeclarations: [`import * as Result from \"effect/Result\"`]\n }),\n expected: \"Result\",\n toCodec: ([success, failure]) => link()(Union([Struct({\n _tag: Literal(\"Success\"),\n success\n }), Struct({\n _tag: Literal(\"Failure\"),\n failure\n })]), SchemaTransformation.transform({\n decode: e => e._tag === \"Success\" ? Result_.succeed(e.success) : Result_.fail(e.failure),\n encode: r => Result_.isSuccess(r) ? {\n _tag: \"Success\",\n success: r.success\n } : {\n _tag: \"Failure\",\n failure: r.failure\n }\n }))\n });\n return make(schema.ast, {\n success,\n failure\n });\n}\nconst immerable = /*#__PURE__*/globalThis.Symbol.for(\"immer-draftable\");\nconst payloadToken = {};\nfunction makeClass(Inherited, identifier, struct, annotations, proto) {\n const getClassSchema = getClassSchemaFactory(struct, identifier, annotations);\n const ClassTypeId = getClassTypeId(identifier); // HMR support\n const out = class extends Inherited {\n constructor(...[input, options]) {\n const internalOptions = options;\n const payload = internalOptions?.[\"~payload\"];\n const value = payload?.token === payloadToken ? payload.value : struct.make(input ?? {}, options);\n super(value, {\n ...options,\n disableChecks: true,\n \"~payload\": {\n token: payloadToken,\n value\n }\n });\n }\n static [TypeId] = TypeId;\n get [ClassTypeId]() {\n return ClassTypeId;\n }\n static [immerable] = true;\n static identifier = identifier;\n static fields = struct.fields;\n static get ast() {\n return getClassSchema(this).ast;\n }\n static pipe() {\n return Pipeable.pipeArguments(this, arguments);\n }\n static rebuild(ast) {\n return getClassSchema(this).rebuild(ast);\n }\n static make(input, options) {\n return SchemaParser.make(getClassSchema(this))(input ?? {}, options);\n }\n static makeOption(input, options) {\n return SchemaParser.makeOption(getClassSchema(this))(input ?? {}, options);\n }\n static makeEffect(input, options) {\n return getClassSchema(this).makeEffect(input ?? {}, options);\n }\n static annotate(annotations) {\n return this.rebuild(SchemaAST.annotate(this.ast, annotations));\n }\n static annotateKey(annotations) {\n return this.rebuild(SchemaAST.annotateKey(this.ast, annotations));\n }\n static check(...checks) {\n return this.rebuild(SchemaAST.appendChecks(this.ast, checks));\n }\n static extend(identifier) {\n return (schema, annotations) => {\n const extension = isStruct(schema) ? schema : Struct(schema);\n const fields = {\n ...struct.fields,\n ...extension.fields\n };\n const ast = SchemaAST.struct(fields, struct.ast.checks, {\n identifier\n });\n return makeClass(this, identifier, makeStruct(SchemaAST.appendChecks(ast, extension.ast.checks), fields), annotations, proto);\n };\n }\n static mapFields(f, options) {\n return struct.mapFields(f, options);\n }\n };\n if (proto !== undefined) {\n Object.assign(out.prototype, proto(identifier));\n }\n return out;\n}\nfunction getClassTransformation(self) {\n return new SchemaTransformation.Transformation(SchemaGetter.transform(input => new self(input, {\n \"~payload\": {\n token: payloadToken,\n value: input\n }\n })), SchemaGetter.passthrough());\n}\nfunction getClassTypeId(identifier) {\n return `~effect/Schema/Class/${identifier}`;\n}\nfunction getClassSchemaFactory(from, identifier, annotations) {\n let memo;\n return self => {\n if (memo !== undefined) {\n return memo;\n }\n const ClassTypeId = getClassTypeId(identifier);\n const isClassValue = input => input instanceof self || Predicate.hasProperty(input, ClassTypeId);\n const transformation = getClassTransformation(self);\n const to = make(new SchemaAST.Declaration([from.ast], () => (input, ast, options) => {\n return isClassValue(input) ? Effect.succeed(input) : Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n }, {\n identifier,\n [InternalAnnotations.CONSTRUCTOR_ANNOTATION_KEY]: ([from]) => ({\n isConstructed: isClassValue,\n link: new SchemaAST.Link(from, transformation)\n }),\n toCodec: ([from]) => new SchemaAST.Link(from.ast, transformation),\n toEquivalence: ([from]) => from,\n toFormatter: ([from]) => t => `${self.identifier}(${from(t)})`,\n [InternalAnnotations.SENTINELS_ANNOTATION_KEY]: SchemaAST.collectSentinels(from.ast),\n ...annotations\n }));\n return memo = decodeTo(to, transformation)(from);\n };\n}\nfunction isStruct(schema) {\n return isSchema(schema);\n}\n/**\n * Creates a schema-backed class whose constructor validates input against a\n * {@link Struct} schema. Construction throws an `Error` with a\n * `SchemaIssue.Issue` in its `cause` on invalid input.\n *\n * **When to use**\n *\n * Use when you need a schema-backed data class with validated construction,\n * schema-derived decoding/encoding, and class-style methods or inheritance.\n *\n * **Details**\n *\n * Pass the desired class type as the first type parameter. The second optional\n * type parameter can be used to add nominal brands.\n *\n * The `identifier` is the schema's stable runtime name. It is exposed on the\n * class, stored in the schema AST, and used to label diagnostics and generated\n * references as well as to format class instances.\n *\n * It also derives a runtime marker that recognizes instances across hot module\n * reloads, where `instanceof` can fail because the constructor has been\n * replaced. The identifier is explicit because the outer JavaScript class name\n * is not available while the `extends` expression is evaluated and may change\n * through renaming or minification.\n *\n * **Gotchas**\n *\n * Passing `disableChecks` in the options skips constructor validation.\n *\n * **Example** (Defining a basic class)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * class Person extends Schema.Class<Person>(\"Person\")({\n * name: Schema.String,\n * age: Schema.Number\n * }) {}\n *\n * const alice = new Person({ name: \"Alice\", age: 30 })\n * alice.name // => \"Alice\"\n * String(alice) // => \"Person({\\\"name\\\":\\\"Alice\\\",\\\"age\\\":30})\"\n * ```\n *\n * **Example** (Extending a class)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * class Animal extends Schema.Class<Animal>(\"Animal\")({\n * name: Schema.String\n * }) {}\n *\n * class Dog extends Animal.extend<Dog>(\"Dog\")({\n * breed: Schema.String\n * }) {}\n *\n * const dog = new Dog({ name: \"Rex\", breed: \"Labrador\" })\n * dog.name // => \"Rex\"\n * dog.breed // => \"Labrador\"\n * ```\n *\n * @see {@link TaggedClass} for adding a `_tag` literal field to the class schema\n * @see {@link Error} for defining schema-backed error classes\n * @see {@link TaggedError} for defining tagged schema-backed error classes\n *\n * @category constructors\n * @since 3.10.0\n */\nexport const Class = identifier => (schema, annotations) => {\n const struct = isStruct(schema) ? schema : Struct(schema);\n return makeClass(Data.Class, identifier, struct, annotations, identifier => ({\n toString() {\n return `${identifier}(${format({\n ...this\n })})`;\n }\n }));\n};\n/**\n * Defines a schema-backed class with an automatically populated `_tag` field.\n *\n * **When to use**\n *\n * Use to define class instances that are validated by a schema and participate\n * in tagged union matching.\n *\n * **Details**\n *\n * The optional `identifier` parameter overrides the schema identifier;\n * it defaults to the `tag` value.\n *\n * **Example** (Defining a tagged class)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * class Circle extends Schema.TaggedClass<Circle>()(\"Circle\", {\n * radius: Schema.Number\n * }) {}\n *\n * const c = new Circle({ radius: 5 })\n * c._tag // => \"Circle\"\n * c.radius // => 5\n * ```\n *\n * @category constructors\n * @since 3.10.0\n */\nexport const TaggedClass = identifier => {\n return (tagValue, schema, annotations) => {\n const struct = isStruct(schema) ? schema.mapFields(fields => ({\n _tag: tag(tagValue),\n ...fields\n }), {\n unsafePreserveChecks: true\n }) : TaggedStruct(tagValue, schema);\n return Class(identifier ?? tagValue)(struct, annotations);\n };\n};\n/**\n * Creates a schema-backed error class that can be used as a typed,\n * yieldable error in Effect programs. Combines {@link Class} validation with\n * the `YieldableError` interface so instances can be yielded directly inside\n * `Effect.gen`.\n *\n * **Example** (Schema-backed error)\n *\n * ```ts import.meta.vitest\n * import { Effect, Schema } from \"effect\"\n *\n * class NotFound extends Schema.Error<NotFound>(\"NotFound\")({\n * id: Schema.Number\n * }) {}\n *\n * const program = Effect.gen(function*() {\n * yield* new NotFound({ id: 1 })\n * })\n * const error = await Effect.runPromise(Effect.flip(program))\n * error.id // => 1\n * ```\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const Error = identifier => (schema, annotations) => {\n const struct = isStruct(schema) ? schema : Struct(schema);\n const self = makeClass(core.Error, identifier, struct, annotations, identifier => ({\n name: identifier\n }));\n return self;\n};\n/**\n * Defines a schema-backed yieldable error class with an automatically populated\n * `_tag` field.\n *\n * **When to use**\n *\n * Use to define typed errors that are schema validated, yielded in `Effect.gen`,\n * and matched as tagged union members.\n *\n * **Example** (Defining a tagged error class)\n *\n * ```ts import.meta.vitest\n * import { Effect, Schema } from \"effect\"\n *\n * class NotFound extends Schema.TaggedError<NotFound>()(\"NotFound\", {\n * id: Schema.Number\n * }) {}\n *\n * const program = Effect.gen(function*() {\n * yield* new NotFound({ id: 42 })\n * })\n * const error = await Effect.runPromise(Effect.flip(program))\n * error._tag // => \"NotFound\"\n * error.id // => 42\n * ```\n *\n * @category constructors\n * @since 3.10.0\n */\nexport const TaggedError = identifier => {\n return (tagValue, schema, annotations) => {\n const struct = isStruct(schema) ? schema.mapFields(fields => ({\n _tag: tag(tagValue),\n ...fields\n }), {\n unsafePreserveChecks: true\n }) : TaggedStruct(tagValue, schema);\n return Error(identifier ?? tagValue)(struct, annotations);\n };\n};\n/**\n * Attaches a custom formatter used by `toFormatter`.\n *\n * **Details**\n *\n * Use this when the formatter derived from the schema structure is not suitable.\n * The annotation is applied through this helper because adding it directly to\n * `Annotations.Bottom` would make schemas invariant.\n *\n * @category formatting\n * @since 4.0.0\n */\nexport function overrideToFormatter(toFormatter) {\n return self => self.annotate({\n toFormatter\n });\n}\n/**\n * Derives a string formatter function from a schema. The formatter converts\n * a value to its human-readable string representation, recursing into structs,\n * arrays, and unions.\n *\n * **Details**\n *\n * The optional `onBefore` hook lets you intercept specific AST nodes before\n * the default formatting logic runs.\n *\n * @category formatting\n * @since 4.0.0\n */\nexport function toFormatter(schema, options) {\n return InternalToFormatter.toFormatter(schema.ast, options);\n}\n/**\n * Overrides the equivalence derivation for a schema by supplying a custom\n * `Equivalence`.\n *\n * **When to use**\n *\n * Use when you need a custom equivalence instead of the default structural\n * equivalence derived by {@link toEquivalence}.\n *\n * @category instances\n * @since 4.0.0\n */\nexport function overrideToEquivalence(toEquivalence) {\n return self => self.annotate({\n toEquivalence\n });\n}\n/**\n * Derives an `Equivalence` from a schema. Two values are considered equal when\n * every field (and nested field) compares equal according to the schema\n * structure.\n *\n * **Example** (Comparing structs)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const eq = Schema.toEquivalence(Schema.Struct({ id: Schema.Number, name: Schema.String }))\n *\n * eq({ id: 1, name: \"Alice\" }, { id: 1, name: \"Alice\" }) // => true\n * eq({ id: 1, name: \"Alice\" }, { id: 2, name: \"Alice\" }) // => false\n * ```\n *\n * @category instances\n * @since 4.0.0\n */\nexport function toEquivalence(schema) {\n return InternalEquivalence.toEquivalence(schema.ast);\n}\n/**\n * Derives an intermediate `SchemaRepresentation.Document` from the encoded\n * side of a schema.\n *\n * **When to use**\n *\n * Use when you have a `Schema` and need its live structural representation for inspection, persistence, or compilation.\n *\n * **Details**\n *\n * Use {@link toType} before this function to represent the type side instead.\n * The optional reference policy controls which candidates are extracted into the document's reference table. By\n * default, only candidates with a resolved identifier become references; recursive candidates always require one.\n *\n * @see {@link SchemaRepresentation.toRepresentation} for converting a `SchemaAST.AST` directly\n *\n * @category converting\n * @since 4.0.0\n */\nexport function toRepresentation(schema, options) {\n return InternalToRepresentation.toRepresentation(schema.ast, options);\n}\n/**\n * Returns a JSON Schema document using draft 2020-12.\n *\n * **When to use**\n *\n * Use when you need a draft-2020-12 description of the canonical JSON form of a runtime schema.\n *\n * **Details**\n *\n * The `options` parameter controls reference extraction and generation details\n * such as excess properties and synthesized check descriptions; it does not\n * change the draft target. The reference policy receives canonical JSON\n * encoded ASTs. By default, anonymous non-recursive candidates remain inline,\n * while candidates with resolved identifiers become definitions. Declarations\n * are lowered through their `toCodecJson` or `toCodec` annotation when\n * available before the representation document is compiled.\n *\n * The generated document is intended for preliminary validation. JSON Schema\n * and Effect checks do not always have identical semantics, so the Effect\n * decoder remains the final authority. Passing JSON Schema validation does not\n * guarantee that Effect decoding will succeed.\n *\n * **Gotchas**\n *\n * JSON Schema generation is best-effort. String length uses Unicode code points\n * in JSON Schema and UTF-16 code units in Effect. A generated `pattern` cannot\n * retain JavaScript RegExp flags. Object property checks apply to the original\n * input in JSON Schema but to the decoded object in Effect. `oneOf` can also\n * reject values accepted by overlapping Effect union members. Custom\n * `toJsonSchema` annotations are the annotation author's responsibility. When\n * canonical JSON derivation adds an artificial transformation, checks and\n * annotations on its source node are not copied to the JSON target, so they do\n * not appear in the emitted document. Opaque declarations without a structural\n * codec are represented by an unconstrained JSON Schema. The default\n * `onExcessProperty: \"ignore\"` matches the decoder default and leaves\n * unrepresentable index-signature keys open. In `\"error\"` mode, the compiler\n * constrains those keys with `propertyNames` and applies a permissive choice of\n * candidate index value schemas. The Effect decoder enforces the exact\n * key-value association.\n *\n * @see {@link SchemaRepresentation.toJsonSchemaDocument} for compiling an existing live representation document\n *\n * @category converting\n * @since 4.0.0\n */\nexport function toJsonSchemaDocument(schema, options) {\n const document = InternalToRepresentation.toRepresentation(InternalToCodec.toCodecJsonAST(schema.ast), options);\n return InternalToJsonSchemaDocument.toJsonSchemaDocument(document, options);\n}\n/**\n * Derives a canonical JSON codec from a schema. The encoded form is `Json`, and\n * decoding produces the schema's `Type`.\n *\n * **Details**\n *\n * Derivation does not run transformations. Annotation links may be asynchronous,\n * may fail, and may use optional services; the consuming parser chooses the\n * execution and failure handling. Because hooks do not widen the returned\n * service types, links cannot require services not declared by the input schema.\n *\n * **Gotchas**\n *\n * Declarations without a `toCodecJson` or `toCodec` annotation use `Json` as\n * their encoded schema. This keeps codec construction total, but encoding or\n * decoding can still fail when declaration values are not JSON values. A\n * `toCodecJson` callback can return `undefined` when the declaration is already\n * in canonical JSON form. When derivation adds an artificial transformation,\n * checks and annotations remain on its source node rather than being copied to\n * the JSON target. Source checks still run after the transformation.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toCodecJson = InternalToCodec.toCodecJson;\n/**\n * Derives an isomorphism codec from a schema. The encoded form is the schema's\n * `Iso` type — the intermediate representation used for round-tripping.\n *\n * **Details**\n *\n * Annotation links may be asynchronous, may fail, and may use optional services;\n * the consuming parser chooses the execution and failure handling.\n *\n * **Gotchas**\n *\n * Links cannot require services because the returned `Codec` does not expose\n * service requirements.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toCodecIso = InternalToCodec.toCodecIso;\n/**\n * Converts a schema to the StringTree canonical codec, where every leaf value\n * becomes a string while preserving the original structure.\n *\n * **Details**\n *\n * Derivation does not run transformations. Annotation links may be asynchronous,\n * may fail, and may use optional services; the consuming parser chooses the\n * execution and failure handling. Links cannot require services not declared by\n * the input schema because hooks do not widen the returned service types.\n *\n * **Gotchas**\n *\n * Declarations must provide a structural `toCodecStringTree`, `toCodecJson`, or\n * `toCodec` encoding. A callback can return `undefined` when the declaration is\n * already in canonical StringTree form.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toCodecStringTree = InternalToCodec.toCodecStringTree;\n/**\n * Allows array schemas to decode from either an array input or a single value\n * input.\n *\n * **When to use**\n *\n * Use when you need to accept transport formats that may represent a\n * single-item array as a bare value, such as query-string or form-data adapters.\n *\n * **Gotchas**\n *\n * This combinator is intentionally not part of `toCodecStringTree`; it adds a\n * decoding convenience rather than a canonical StringTree representation. It\n * does not parse comma-separated strings.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toCodecArrayFromSingle = InternalToCodec.toCodecArrayFromSingle;\n/**\n * Derives an XML encoder from a codec.\n *\n * **Details**\n *\n * The returned function encodes a value through `toCodecStringTree` and returns\n * an `Effect` that succeeds with the XML string or fails with a\n * {@link SchemaIssue.Issue} if codec encoding fails.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function toEncoderXml(codec, options) {\n return InternalToEncoderXml.toEncoderXml(codec, options);\n}\n/**\n * Derives an `Iso` optic from a schema that isomorphically converts between\n * the schema's `Type` and its `Iso` (intermediate / serialized form).\n *\n * **Details**\n *\n * Reading through the `Iso` encodes the schema value, while replacing through\n * it decodes the new focus.\n *\n * **Gotchas**\n *\n * This API runs synchronously, so failing, asynchronous, or service-dependent\n * transformations can throw. Schema failures use `\"Schema validation failed\"`\n * with a `SchemaIssue.Issue` in `cause`; format it with\n * `SchemaIssue.makeFormatterDefault()`. Consume {@link toCodecIso} with an\n * effectful parser for asynchronous execution or explicit failure handling.\n *\n * @category converting\n * @since 4.0.0\n */\nexport function toIso(schema) {\n return InternalToIso.toIso(schema);\n}\n/**\n * Returns an identity `Iso` over the schema's source (`Type`) side.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function toIsoSource(schema) {\n return InternalToIso.toIsoSource(schema);\n}\n/**\n * Returns an identity `Iso` over the schema's focus (`Iso`) side.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function toIsoFocus(schema) {\n return InternalToIso.toIsoFocus(schema);\n}\n/**\n * Overrides a schema's derived ISO codec with an explicit target codec.\n *\n * **When to use**\n *\n * Use to provide a custom ISO transformation when the default derivation is not\n * appropriate.\n *\n * **Details**\n *\n * The resulting schema carries a custom `Iso` type parameter and uses the\n * provided `decode` and `encode` getters to transform between the schema type\n * and the target codec.\n *\n * @category transforming\n * @since 4.0.0\n */\nexport function overrideToCodecIso(to, transformation) {\n return schema => {\n return make(SchemaAST.annotate(schema.ast, {\n toCodecIso: () => new SchemaAST.Link(to.ast, SchemaTransformation.make(transformation))\n }), {\n schema\n });\n };\n}\n/**\n * Derives a JSON Patch differ from a codec. Serializes values to JSON (via\n * {@link toCodecJson}), computes RFC 6902 JSON Patch operations between old\n * and new values, and can apply patches back to the typed value.\n *\n * **Details**\n *\n * `diff` encodes both values before computing the patch. `patch` encodes the old\n * value, applies the patch to its JSON representation, and decodes the result.\n *\n * **Gotchas**\n *\n * This API runs synchronously, so failing, asynchronous, or service-dependent\n * transformations can throw. Schema failures use `\"Schema validation failed\"`\n * with a `SchemaIssue.Issue` in `cause`; format it with\n * `SchemaIssue.makeFormatterDefault()`. Invalid patch operations instead produce\n * {@link JsonPatch.apply} errors.\n *\n * @category converting\n * @since 4.0.0\n */\nexport function toDifferJsonPatch(schema) {\n return InternalToDifferJsonPatch.toDifferJsonPatch(schema);\n}\n/**\n * Creates a recursive schema for a {@link Tree} of values described by `node`.\n * The resulting schema accepts a single node value, an array of trees, or an\n * object whose values are trees.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport function Tree(node) {\n const Tree$ref = suspend(() => Tree);\n const Tree = Union([node, ArraySchema(Tree$ref), Record(String, Tree$ref)]);\n return Tree;\n}\n/**\n * Schema that accepts and validates any immutable JSON-compatible value.\n *\n * **Example** (Validating a JSON value)\n *\n * ```ts import.meta.vitest\n * import { Option, Schema } from \"effect\"\n *\n * Schema.decodeUnknownOption(Schema.Json)({ key: [1, true, null] }) // => Option.some({ key: [1, true, null] })\n * ```\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const Json = /*#__PURE__*/make(/*#__PURE__*/SchemaAST.annotate(SchemaAST.Json, {\n toCode: () => ({\n runtime: \"Schema.Json\",\n Type: \"Schema.Json\"\n })\n}));\n/**\n * Schema for readonly string-keyed records whose values are JSON-compatible.\n *\n * **When to use**\n *\n * Use when you need to validate a JSON object rather than any JSON value.\n *\n * **Example** (Validating a JSON object)\n *\n * ```ts import.meta.vitest\n * import { Option, Schema } from \"effect\"\n *\n * Schema.decodeUnknownOption(Schema.JsonObject)({ key: [1, true, null] }) // => Option.some({ key: [1, true, null] })\n * Schema.decodeUnknownOption(Schema.JsonObject)([1, 2, 3]) // => Option.none()\n * ```\n *\n * @see {@link Json} for a schema that also accepts JSON arrays and primitive values\n * @category schemas\n * @since 4.0.0\n */\nexport const JsonObject = /*#__PURE__*/Record(String, Json);\nconst JsonError = /*#__PURE__*/Struct({\n message: String,\n name: /*#__PURE__*/optionalKey(String),\n stack: /*#__PURE__*/optionalKey(String),\n cause: /*#__PURE__*/optionalKey(Json)\n});\n/**\n * Schema that accepts any mutable JSON-compatible value. See {@link Json} for\n * the immutable variant.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const MutableJson = /*#__PURE__*/make(/*#__PURE__*/SchemaAST.annotate(SchemaAST.MutableJson, {\n toCode: () => ({\n runtime: \"Schema.MutableJson\",\n Type: \"Schema.MutableJson\"\n })\n}));\n/**\n * Resolves the typed annotations from a schema. The term \"resolve\" (rather\n * than \"get\") reflects the lookup strategy: if the schema has checks, the\n * annotations are taken from the last check; otherwise they are taken from\n * the base schema instance.\n *\n * @category getters\n * @since 4.0.0\n */\nexport function resolveAnnotations(schema) {\n return InternalAnnotations.resolve(schema.ast);\n}\n/**\n * Resolves the context (key-level) annotations from a schema. Context\n * annotations are those attached via `annotateKey` and live on the AST's\n * `context` rather than on the schema node itself.\n *\n * @category getters\n * @since 4.0.0\n */\nexport function resolveAnnotationsKey(schema) {\n return schema.ast.context?.annotations;\n}\n//# sourceMappingURL=Schema.js.map"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28],"mappings":";;AAgYA,MAAaA,oBAAkBC;;;ACrL/B,MAAa,MAAmB,KAAK,IAAI,MAAM,QAAQ,OAAO,OAAO,MAAM,GAAG,CAAC;AA+I/E,MAAa,MAAmB,KAAK,IAAI,MAAM,MAAM;CACnD,MAAM,MAAM,EACV,GAAG,KACL;CACA,KAAK,MAAM,OAAO,KAAK,IAAI,GACzB,iBAA8B,KAAK,KAAK,EAAE,KAAK,MAAM,GAAG,CAAC;CAE3D,OAAO;AACT,CAAC;AAoPD,MAAa,QAAO,SAAQ,OAAO,KAAK,IAAI;AAwE5C,MAAa,iBAAiBC;AA4B9B,MAAa,iBAAgB,gBAAe,KAAK,IAAI,MAAM,SAAS;CAClE,KAAK,MAAM,OAAO,KAAK,IAAI,GACzB,IAAI,CAAC,IAAI,MAAM,GAAG,KAAK,CAAC,YAAY,KAAK,MAAM,KAAK,IAAI,GACtD,OAAO;CAGX,OAAO;AACT,CAAC;AAsND,MAAaC,qBAAkB,gBAAe;CAC5C,MAAM,KAAK,cAAc,WAAW;CACpC,QAAQ,MAAM,SAAS,GAAG,MAAM,IAAI,KAAK,GAAG,MAAM,IAAI;AACxD;;;ACn3BA,MAAa,QAAQC;AA0ErB,MAAa,oBAAoBC;;;ACnGjC,MAAaC,WAAS;AAEtB,MAAa,iBAAiB;AAC9B,MAAMC,UAAQ;EACXD,WAASA;CACV,OAAO;EACL,OAAO,cAAc,MAAM,SAAS;CACtC;CACA,CAACE,qBAAiC;EAChC,OAAO,KAAK,SAAS;CACvB;CACA,SAAS;EACP,OAAOC,YAAU,IAAI,CAAC,CAAC,OAAO;CAChC;AACF;AACA,MAAM,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