clanka 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AgentCallerConfig.test.js +5 -3
- package/dist/AgentCallerConfig.test.js.map +1 -1
- package/dist/ChunkRepo.d.ts +1 -1
- package/dist/Compaction.test.js +2 -1
- package/dist/Compaction.test.js.map +1 -1
- package/dist/CompactionTokens.test.js +15 -8
- package/dist/CompactionTokens.test.js.map +1 -1
- package/dist/bin/{Effect-On-1ks2z.mjs → Effect-DNYYQ84C.mjs} +421 -367
- package/dist/bin/Effect-DNYYQ84C.mjs.map +1 -0
- package/dist/bin/Latch-BSlIwuxI.mjs +7 -0
- package/dist/bin/Latch-BSlIwuxI.mjs.map +1 -0
- package/dist/bin/{McpClient-iwrW83Si.mjs → McpClient-C7ctqJWo.mjs} +4 -5
- package/dist/bin/{McpClient-iwrW83Si.mjs.map → McpClient-C7ctqJWo.mjs.map} +1 -1
- package/dist/bin/{OutputFormatter-DeNaqhQM.mjs → OutputFormatter-DXej05JW.mjs} +8 -13
- package/dist/bin/{OutputFormatter-DeNaqhQM.mjs.map → OutputFormatter-DXej05JW.mjs.map} +1 -1
- package/dist/bin/{Schema-B3pFcw4E.mjs → Schema-CSQN_Zso.mjs} +754 -800
- package/dist/bin/Schema-CSQN_Zso.mjs.map +1 -0
- package/dist/bin/{SemanticSearch-BZIXkWYz.mjs → SemanticSearch-BiwCnpKX.mjs} +241 -148
- package/dist/bin/SemanticSearch-BiwCnpKX.mjs.map +1 -0
- package/dist/bin/{Stream-DCB3_nIX.mjs → Stream-Dwvj9X5X.mjs} +161 -116
- package/dist/bin/Stream-Dwvj9X5X.mjs.map +1 -0
- package/dist/bin/cli.mjs +3994 -3220
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/{helpers-BPLUsjsL.mjs → helpers-CljL9OKa.mjs} +143 -177
- package/dist/bin/helpers-CljL9OKa.mjs.map +1 -0
- package/dist/bin/index.min-ClUfQ5ji.mjs +3782 -0
- package/dist/bin/index.min-ClUfQ5ji.mjs.map +1 -0
- package/dist/bin/{rolldown-runtime-Cjv6nE1W.mjs → rolldown-runtime-5zChB7MF.mjs} +1 -2
- package/dist/bin/{server-CBmuybpI.mjs → server-HlLriZxF.mjs} +5 -7
- package/dist/bin/{server-CBmuybpI.mjs.map → server-HlLriZxF.mjs.map} +1 -1
- package/dist/bin/{turndown.cjs-cie0BXQQ.mjs → turndown.cjs-C2WBxeA-.mjs} +56 -110
- package/dist/bin/{turndown.cjs-cie0BXQQ.mjs.map → turndown.cjs-C2WBxeA-.mjs.map} +1 -1
- package/dist/bin/{types-RT_9fFNm.mjs → types-LcwjLVkt.mjs} +20 -38
- package/dist/bin/{types-RT_9fFNm.mjs.map → types-LcwjLVkt.mjs.map} +1 -1
- package/dist/bin/upgrade-BSNjCnra.mjs +342 -0
- package/dist/bin/upgrade-BSNjCnra.mjs.map +1 -0
- package/package.json +14 -20
- package/src/AgentCallerConfig.test.ts +5 -3
- package/src/Compaction.test.ts +2 -1
- package/src/CompactionTokens.test.ts +15 -11
- package/dist/bin/Effect-On-1ks2z.mjs.map +0 -1
- package/dist/bin/Schema-B3pFcw4E.mjs.map +0 -1
- package/dist/bin/SemanticSearch-BZIXkWYz.mjs.map +0 -1
- package/dist/bin/Stream-DCB3_nIX.mjs.map +0 -1
- package/dist/bin/helpers-BPLUsjsL.mjs.map +0 -1
- package/dist/bin/index.min-Bkz7vIWv.mjs +0 -3300
- package/dist/bin/index.min-Bkz7vIWv.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Schema-CSQN_Zso.mjs","names":["makeEquivalence","Equivalence.Tuple","map","InternalRecord.assignProperty","makeEquivalence","Class","Pipeable.Class","TaggedClass","Predicate.isTagged","Error","core.Error","TaggedError","core.TaggedError","effect.ClockRef","effect.currentTimeMillis","effect.monotonicTimeNanos","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","isString","Hash.symbol","Hash.hash","Equal.symbol","Equal.equals","redacted.value","Equivalence.make","TypeId","Hash.symbol","Hash.combine","Hash.string","Hash.number","Equal.symbol","make","order.String","encoder","Result.fail","Result.succeed","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","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","Proto","Redactable.symbolRedactable","redact","Context.get","CurrentRedactedNames","Redactable.redact","Equal.symbol","Equivalence","Hash.symbol","Hash.structure","Inspectable.NodeInspectSymbol","Inspectable.BaseProto","make","empty","fromInput","setAll","Redacted.make","isRedactedName","Data.Error","seconds","Duration.seconds","Duration.nanos","Result.succeed","Result.fail","DateTime.makeUnsafe","Duration.millis","DateTime.toEpochMillis","value","Redacted.value","TypeId","Redactable.symbolRedactable","Context.get","Redactable.redact","Equal.symbol","Equivalence","Hash.symbol","Hash.array","make","Arr.fromIterable","Redacted.isRedacted","internal.unwrap","Redacted.make","Headers.isRedactedName","Context.empty","resolve","resolveAt","resolveIdentifier","resolveDescription","Exit.succeed","Option.none","Option.some","TypeId","InternalParser.missing","Filter","Arr.isReadonlyArrayNonEmpty","Arr.map","InternalAnnotations.getExpected","format","Cause.isFailReason","SchemaIssue.isIssue","Effect.succeed","Option.map","Option.isNone","Effect.succeedNone","Effect.mapEager","Option.some","Pipeable.Prototype","Effect.flatMapEager","transform","transformOptional","transformEffect","Effect.fail","Option.isSome","SchemaIssue.Forbidden","passthrough_","passthrough","omit","Option.none","withDefault","Option.filter","Predicate.isNotUndefined","String","Number","BigInt","SchemaIssue.InvalidValue","Date","Effect.try","Base64.encode","Effect.mapErrorEager","Effect.fromResult","Base64.decode","dateTimeUtcFromInput","Option.match","DateTime.make","DateTime.toUtc","Pipeable.Class","TypeId","Predicate.hasProperty","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","InternalContent.setContent","SchemaGetter.stringifyJson","TypeId","InternalParser.missing","InternalParser.missingExit","Effect.die","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","Symbol","Predicate.isSymbol","BigInt","Predicate.isBigInt","SchemaIssue.UnexpectedKey","SchemaIssue.Pointer","Effect.fail","SchemaIssue.Composite","Effect.flatMapEager","Effect.suspend","Effect.flatMap","SchemaIssue.InvalidType","InternalParser.sameExit","InternalParser.args","SchemaIssue.MissingKey","Exit.fail","InternalSchemaCause.getSchemaIssue","Exit.failCause","Cause.map","toEncoded","Predicate.isNotNullish","Exit.void","Effect.exit","Effect.fnUntracedEager","Arr.empty","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","optionalKey","optional","withConstructorDefault","decodeTo","Predicate.isPropertyKey","Arr.isArrayNonEmpty","toType","SchemaTransformation.numberFromString","SchemaTransformation.bigintFromString","SchemaIssue.Forbidden","SchemaIssue.Filter","InternalAnnotations.CONSTRUCTOR_ANNOTATION_KEY","Predicate.isFunction","InternalAnnotations.resolveAt","InternalAnnotations.resolveIdentifier","InternalAnnotations.resolveDescription","Json","MutableJson","InternalParser.sameExit","Effect.flatMapEager","Effect.die","InternalParser.succeed","InternalParser.toOption","Effect.mapEager","InternalParser.missing","InternalParser.missingExit","InternalParser.fromOptionExit","Effect.catchCause","Effect.failCauseSync","Cause.map","SchemaIssue.Encoding","InternalParser.args","SchemaAST.getConstructorDescriptor","SchemaAST.collectIssues","Effect.fail","SchemaIssue.Composite","Effect.flatMap","Effect.succeed","Interpreter.compileField","Interpreter.compile","InternalParser.missing","InternalParser.sameExit","InternalParser.succeed","Effect.die","SchemaAST.toType","Effect.runSyncExit","Exit.isSuccess","Option.some","Option.none","make","is","CompilerRegistry.compilerAdaptersEnabled","SchemaAST.defaultParseOptions","CompilerRegistry.resolve","Cause.die","InternalSchemaCause.getSchemaIssueOrThrow","decodeUnknownEffect","decodeEffect","decodeUnknownOption","encodeUnknownEffect","SchemaAST.flip","encodeEffect","InternalParser.missing","Effect.fail","SchemaIssue.InvalidValue","Effect.succeed","InternalParser.sameExit","Effect.flatMapEager","CompilerRegistry.invalid","SchemaAST.getConstructorDescriptor","TypeId","SchemaParser.make","SchemaParser.makeEffect","SchemaParser.makeOption","Pipeable.pipeArguments","SchemaAST.annotate","SchemaAST.annotateKey","SchemaAST.appendChecks","make","Predicate.isObject","InternalJsonSchema.getSubschemaKind","toCodecJson","InternalMake.make","SchemaAST.replaceContext","SchemaAST.applyToSelfOrLastLinkEncodingIdempotent","SchemaAST.getContextOwner","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","InternalAST.FINITE_PATTERN","Arr.map","Equal.equals","RegEx.escape","InternalAST.STRING_PATTERN","toJsonSchemaDocument","Arr.map","InternalAnnotations.resolveIdentifierFallback","SchemaAST.annotate","InternalAnnotations.IDENTIFIER_FALLBACK_KEY","InternalContent.getContent","SchemaAST.getContextOwner","InternalAnnotations.resolveIdentifier","SchemaAST.toType","SchemaAST.getLastEncoding","SchemaAST.isOptional","SchemaAST.isMutable","isSchemaError","Predicate.hasProperty","TypeId","Inspectable.BaseProto","Equal.symbol","Hash.symbol","Hash.optimize","Hash.combine","Bytes.Equivalence","Hash.array","Result.fail","Result.succeed","Result.map","Result.isFailure","Result.flatMap","Equal.equals","Hash.hash","Hash.number","formatHost","Hash.string","TypeId","NetAddress.formatIp","Inspectable.BaseProto","Equal.symbol","Equal.equals","Hash.symbol","Hash.combine","Hash.hash","Hash.number","Duration.isDuration","Duration.isFinite","Duration.toSeconds","NetAddress.isIpv4Address","NetAddress.isIpv6Address","Host.isDomainName","Inspectable.BaseProto","Equal.symbol","Equal.equals","Hash.symbol","Hash.structureKeys","Result.fail","NetAddress.NetAddressError","Result.succeed","NetAddress.formatIp","Hex.encode","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","Symbol","SchemaAST.symbol","BigInt","SchemaAST.bigInt","SchemaAST.void","SchemaAST.struct","SchemaAST.record","SchemaAST.structWithRest","SchemaAST.tuple","SchemaAST.tupleWithRest","SchemaAST.Arrays","SchemaAST.mutable","SchemaAST.union","SchemaAST.Suspend","SchemaAST.decodeTo","SchemaTransformation.makeTransformation","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","RegExp_.escape","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","Arr.dedupe","SchemaTransformation.defectFromJson","SchemaTransformation.transformEffect","Effect.try","SchemaIssue.InvalidValue","URL","SchemaTransformation.urlFromString","Date","SchemaTransformation.dateFromString","SchemaTransformation.fromJsonString","Result_.match","Base64.decode","Effect.tryPromise","Base64.encode","URLSearchParams","SchemaTransformation.transform","Uint8Array","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","NetAddress_.isIpv4Address","NetAddress_.isIpv6Address","Duration_.millis","Duration_.toMillis","Duration_.isDuration","Duration_.infinity","Duration_.negativeInfinity","Duration_.nanos","Result_.isFailure","NetAddress_.formatIp","Duration_.seconds","Duration_.toSeconds","Dns_.isDnsRecord","Dns_.makeRecord","Result_.isSuccess","NetAddress_.ipv4FromString","NetAddress_.ipv6FromString","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_internal.unwrap","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.makeClassSync","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.1.1/node_modules/effect/dist/Tuple.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Record.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Data.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/encoding/EncodingError.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Clock.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/dateTime.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/redacted.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Redacted.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/BigDecimal.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/encoding/Base64.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/DateTime.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/Cookies.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/Headers.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/internal/urlParams.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/http/UrlParams.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/schema/annotations.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/schema/parser.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/SchemaIssue.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/schema/cause.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/SchemaGetter.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/schema/content.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/SchemaTransformation.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/SchemaAST.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/schema/interpreter.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/schema/compilerRegistry.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/SchemaParser.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/schema/make.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/jsonSchema.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/JsonPointer.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/JsonSchema.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/schema/toCodec.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/RegExp.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/errors.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/schema/toRepresentation.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Struct.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/internal/schemaError.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/Bytes.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/net/NetAddress.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/net/Host.js","../../node_modules/.pnpm/effect@4.1.1/node_modules/effect/dist/net/Dns.js","../../node_modules/.pnpm/effect@4.1.1/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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * Success values are collected in the first record, and failure values are\n * collected in the second 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) // => [{ b: 2 }, { a: 1, c: 3 }]\n * ```\n *\n * @stability stable\n * @category filtering\n * @since 2.0.0\n */\nexport const partition = /*#__PURE__*/dual(2, (self, f) => {\n const passes = empty();\n const fails = empty();\n for (const key of keys(self)) {\n const e = f(self[key], key);\n if (R.isFailure(e)) {\n InternalRecord.assignProperty(fails, key, e.failure);\n } else {\n InternalRecord.assignProperty(passes, key, e.success);\n }\n }\n return [passes, fails];\n});\n/**\n * Partitions a record of `Result` values into two separate records,\n * one with the success values and one with the failure 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) }) // => [{ b: 1 }, { a: \"e\" }]\n * ```\n *\n * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * **Details**\n *\n * The reducer function receives the accumulator, the current value, and the\n * key of the current entry.\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 * **Example** (Using the key in the reducer)\n *\n * ```ts import.meta.vitest\n * import { Record } from \"effect\"\n *\n * Record.reduce(\n * { a: 1, b: 2, c: 3 },\n * \"\",\n * (acc, value, key) => (acc === \"\" ? `${key}${value}` : `${acc}-${key}${value}`)\n * ) // => \"a1-b2-c3\"\n * ```\n *\n * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 core from \"./internal/core.js\";\nimport * as InternalRecord from \"./internal/record.js\";\nimport * as Pipeable from \"./Pipeable.js\";\nimport * as Predicate from \"./Predicate.js\";\n/**\n * Provides a base class for immutable data types.\n *\n * **When to use**\n *\n * Use when you need a lightweight immutable value type with `.pipe()` support.\n *\n * **Details**\n *\n * Extend `Class` with a type parameter to declare fields. The constructor\n * accepts those fields as a single object argument. When there are no fields\n * the argument is optional. Instances are `Readonly` and `Pipeable`.\n *\n * **Example** (Defining a value class)\n *\n * ```ts import.meta.vitest\n * import { Data, Equal } from \"effect\"\n *\n * class Person extends Data.Class<{ readonly name: string }> {}\n *\n * Equal.equals(new Person({ name: \"Mike\" }), new Person({ name: \"Mike\" })) // => true\n * ```\n *\n * @see {@link TaggedClass} — adds a `_tag` field\n * @see {@link Error} — yieldable error variant\n *\n * @stability stable\n * @category constructors\n * @since 2.0.0\n */\nexport const Class = class extends Pipeable.Class {\n constructor(props) {\n super();\n if (props) {\n InternalRecord.assignProperties(this, props);\n }\n }\n};\n/**\n * Provides a base class for immutable data types with a `_tag` discriminator.\n *\n * **When to use**\n *\n * Use when you need a single-variant tagged type or an ad-hoc discriminator.\n *\n * **Details**\n *\n * Like {@link Class}, but the resulting instances also carry a\n * `readonly _tag: Tag` property. The `_tag` is excluded from the constructor\n * argument.\n *\n * **Example** (Defining a tagged class)\n *\n * ```ts import.meta.vitest\n * import { Data } from \"effect\"\n *\n * class Person extends Data.TaggedClass(\"Person\")<{\n * readonly name: string\n * }> {}\n *\n * new Person({ name: \"Mike\" })._tag // => \"Person\"\n * ```\n *\n * @see {@link Class} — without a `_tag`\n * @see {@link TaggedError} — tagged error variant\n * @see {@link TaggedEnum} — multi-variant unions\n *\n * @stability stable\n * @category constructors\n * @since 2.0.0\n */\nexport const TaggedClass = tag => class extends Class {\n _tag = tag;\n};\n/**\n * Creates constructors and matchers for a `TaggedEnum` type.\n *\n * **When to use**\n *\n * Use when you model a closed union with plain data objects and want\n * construction, tag checks, and exhaustive matching from the same definition.\n *\n * **Details**\n *\n * Returns an object with:\n * - One constructor per variant (keyed by tag name)\n * - `$is(tag)` — returns a type-guard function that checks only the `_tag` field\n * - `$match` — exhaustive pattern matching (data-first or data-last)\n *\n * **Gotchas**\n *\n * - Constructors produce **plain objects**, not class instances.\n * - `$is(tag)` only checks the `_tag` field, not the full structure. It relies\n * on the tag being globally unique and the value being produced by your\n * constructors. For untrusted input, validate with the `Schema` module first.\n *\n * **Example** (Creating and matching tagged enum values)\n *\n * ```ts import.meta.vitest\n * import { Data } from \"effect\"\n *\n * type HttpError = Data.TaggedEnum<{\n * BadRequest: { readonly message: string }\n * NotFound: { readonly url: string }\n * }>\n *\n * const { BadRequest, NotFound, $is, $match } = Data.taggedEnum<HttpError>()\n *\n * const err = NotFound({ url: \"/missing\" })\n *\n * $is(\"NotFound\")(err) // => true\n *\n * $match(err, {\n * BadRequest: (e) => e.message,\n * NotFound: (e) => `${e.url} not found`\n * }) // => \"/missing not found\"\n * ```\n *\n * **Example** (Defining a generic tagged enum)\n *\n * ```ts import.meta.vitest\n * import { Data } from \"effect\"\n *\n * type MyResult<E, A> = Data.TaggedEnum<{\n * Failure: { readonly error: E }\n * Success: { readonly value: A }\n * }>\n * interface MyResultDef extends Data.TaggedEnum.WithGenerics<2> {\n * readonly taggedEnum: MyResult<this[\"A\"], this[\"B\"]>\n * }\n * const { Failure, Success } = Data.taggedEnum<MyResultDef>()\n *\n * const ok = Success({ value: 42 })\n * // ok: { readonly _tag: \"Success\"; readonly value: number }\n * ok // => { value: 42, _tag: \"Success\" }\n * ```\n *\n * @see {@link TaggedEnum} — the type-level companion\n * @see {@link TaggedEnum.Constructor} — the returned object type\n * @see {@link TaggedEnum.WithGenerics} — generic enum support\n *\n * @stability stable\n * @category constructors\n * @since 2.0.0\n */\nexport const taggedEnum = () => new Proxy({}, {\n get(_target, tag, _receiver) {\n if (tag === \"$is\") {\n return Predicate.isTagged;\n } else if (tag === \"$match\") {\n return taggedMatch;\n }\n return props => ({\n ...props,\n _tag: tag\n });\n }\n});\nfunction taggedMatch() {\n if (arguments.length === 1) {\n const cases = arguments[0];\n return function (value) {\n return cases[value._tag](value);\n };\n }\n const value = arguments[0];\n const cases = arguments[1];\n return cases[value._tag](value);\n}\n/**\n * Provides a base class for yieldable errors.\n *\n * **When to use**\n *\n * Use when you need yieldable errors that do **not** need tag-based\n * discrimination.\n *\n * **Details**\n *\n * Extends `Cause.YieldableError`, so instances can be yielded inside\n * `Effect.gen` to fail the enclosing effect. Fields are passed as a single\n * object; when there are no fields the argument is optional. If a `message`\n * field is provided, it becomes the error's `.message`.\n *\n * **Example** (Defining a yieldable error)\n *\n * ```ts import.meta.vitest\n * import { Data, Effect, Exit } from \"effect\"\n *\n * class NetworkError extends Data.Error<{\n * readonly code: number\n * readonly message: string\n * }> {}\n *\n * const program = Effect.gen(function*() {\n * return yield* new NetworkError({ code: 500, message: \"timeout\" })\n * })\n *\n * Effect.runSync(Effect.exit(program)) // => Exit.fail(new NetworkError({ code: 500, message: \"timeout\" }))\n * ```\n *\n * @see {@link TaggedError} — adds a `_tag` for `Effect.catchTag`\n * @see {@link Class} — non-error data class\n *\n * @stability stable\n * @category constructors\n * @since 2.0.0\n */\nexport const Error = core.Error;\n/**\n * Creates a tagged error class with a `_tag` discriminator.\n *\n * **When to use**\n *\n * Use when you need domain errors with discriminated-union handling.\n *\n * **Details**\n *\n * Like {@link Error}, but instances also carry a `readonly _tag` property,\n * enabling `Effect.catchTag` and `Effect.catchTags` for tag-based recovery.\n * The `_tag` is excluded from the constructor argument. Yielding an instance\n * inside `Effect.gen` fails the effect with this error.\n *\n * **Example** (Recovering by tag)\n *\n * ```ts import.meta.vitest\n * import { Data, Effect } from \"effect\"\n *\n * class NotFound extends Data.TaggedError(\"NotFound\")<{\n * readonly resource: string\n * }> {}\n *\n * class Forbidden extends Data.TaggedError(\"Forbidden\")<{\n * readonly reason: string\n * }> {}\n *\n * const program = Effect.gen(function*() {\n * return yield* new NotFound({ resource: \"/users/42\" })\n * })\n *\n * const recovered = program.pipe(\n * Effect.catchTag(\"NotFound\", (e) =>\n * Effect.succeed(`missing: ${e.resource}`))\n * )\n *\n * await Effect.runPromise(recovered) // => \"missing: /users/42\"\n * ```\n *\n * @see {@link Error} — without a `_tag`\n * @see {@link TaggedClass} — tagged class that is not an error\n *\n * @stability stable\n * @category constructors\n * @since 2.0.0\n */\nexport const TaggedError = core.TaggedError;\n//# sourceMappingURL=Data.js.map","/**\n * Shared error type for encoding and decoding operations.\n *\n * @stability stable\n * @since 4.0.0\n */\nimport * as Data from \"../Data.js\";\nimport { hasProperty } from \"../Predicate.js\";\n/**\n * Type identifier stored on `EncodingError` values and used by\n * `isEncodingError`.\n *\n * **When to use**\n *\n * Use when implementing low-level `EncodingError`-compatible values that need\n * to carry the runtime marker.\n *\n * **Details**\n *\n * This marker is part of the runtime representation of `EncodingError`. Prefer\n * `isEncodingError` when narrowing unknown values.\n *\n * @see {@link isEncodingError} for the public guard that checks this marker\n *\n * @stability stable\n * @category type IDs\n * @since 4.0.0\n */\nexport const EncodingErrorTypeId = \"~effect/encoding/EncodingError\";\n/**\n * Error returned when an encoding or decoding operation cannot process its input.\n *\n * **When to use**\n *\n * Use when you need to handle or inspect failures from encoding or decoding\n * operations.\n *\n * **Details**\n *\n * The error records whether the failure happened during encoding or decoding,\n * which encoding module reported it, the original input, and a human-readable\n * message.\n *\n * @see {@link isEncodingError} for checking whether a value is an EncodingError\n *\n * @stability stable\n * @category errors\n * @since 4.0.0\n */\nexport class EncodingError extends /*#__PURE__*/Data.TaggedError(\"EncodingError\") {\n /**\n * Marks this value as an encoding or decoding error for runtime guards.\n *\n * **When to use**\n *\n * Use to identify `EncodingError` instances through `isEncodingError`.\n *\n * @since 4.0.0\n */\n [EncodingErrorTypeId] = EncodingErrorTypeId;\n}\n/**\n * Checks whether a value is an `EncodingError`.\n *\n * **When to use**\n *\n * Use to narrow an unknown value before handling it as an `EncodingError` from\n * encoding or decoding code.\n *\n * **Details**\n *\n * Returns `true` when the value carries the `EncodingErrorTypeId` marker and\n * narrows the value to `EncodingError`.\n *\n * @see {@link EncodingError} for the structured error produced by failed\n * encoding and decoding operations\n *\n * @stability stable\n * @category guards\n * @since 4.0.0\n */\nexport const isEncodingError = u => hasProperty(u, EncodingErrorTypeId);\n//# sourceMappingURL=EncodingError.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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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};\nconst cacheSlot = {\n value: undefined,\n enumerable: false,\n writable: true\n};\n// Instances sealed or frozen before their first cache write cannot receive own\n// slots, so their caches live here instead.\nconst sealedCaches = /*#__PURE__*/new WeakMap();\n// Until an instance has its own slots, every cache read and write, including\n// writes through the public fields from other copies of effect, reaches these\n// accessors. The first write defines all of the instance's slots at once and in\n// a fixed order, so construction avoids `Object.defineProperty` and instances\n// keep few shapes.\nconst cacheAccessor = (key, slots) => ({\n get() {\n return Object.isExtensible(this) ? undefined : sealedCaches.get(this)?.[key];\n },\n set(value) {\n if (Object.isExtensible(this)) {\n for (const slot of slots) {\n Object.defineProperty(this, slot, cacheSlot);\n }\n this[key] = value;\n } else {\n let caches = sealedCaches.get(this);\n if (caches === undefined) {\n caches = {};\n sealedCaches.set(this, caches);\n }\n caches[key] = value;\n }\n }\n});\nconst zonedSlots = [\"partsUtc\", \"adjustedEpochMilliseconds\", \"partsAdjusted\"];\nObject.defineProperty(ProtoUtc, \"partsUtc\", cacheAccessor(\"partsUtc\", [\"partsUtc\"]));\nObject.defineProperties(ProtoZoned, {\n partsUtc: cacheAccessor(\"partsUtc\", zonedSlots),\n adjustedEpochMilliseconds: cacheAccessor(\"adjustedEpochMilliseconds\", zonedSlots),\n partsAdjusted: cacheAccessor(\"partsAdjusted\", zonedSlots)\n});\n/** @internal */\nexport const makeZonedProto = (epochMillis, zone, partsUtc) => {\n const self = Object.create(ProtoZoned);\n self.epochMilliseconds = epochMillis;\n self.zone = zone;\n if (partsUtc !== undefined) {\n self.partsUtc = partsUtc;\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 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 * `Date.parse` also accepts a trailing `z` or `gmt` in any case. Only that trailing\n * match is case-insensitive, so lowercase letters in a comment like \"(xyz)\" do not\n * count as a zone.\n */\nconst hasZone = input => /Z|GMT|[+-]\\d{2}$|[+-]\\d{2}:?\\d{2}$|\\]$/.test(input) || /z$|gmt$/i.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 era: \"short\",\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 const cached = validZoneCache.get(zoneId);\n if (cached !== undefined) {\n return cached;\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 const cached = validZoneCache.get(zoneId);\n if (cached !== undefined) {\n return cached;\n }\n try {\n const zone = zoneMakeIntl(new Intl.DateTimeFormat(\"en-US\", {\n ...formatOptions,\n timeZone: zoneId\n }));\n validZoneCache.set(zoneId, zone);\n return zone;\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 let bc = false;\n const parts = self.zone.format.formatToParts(self.epochMilliseconds).filter(_ => {\n if (_.type === \"era\") {\n bc = _.value === \"BC\";\n return false;\n }\n return _.type !== \"literal\";\n });\n const year = Number(parts[2].value);\n const date = new Date(0);\n date.setUTCFullYear(bc ? 1 - year : year, Number(parts[0].value) - 1, Number(parts[1].value));\n date.setUTCHours(Number(parts[3].value), Number(parts[4].value), Number(parts[5].value), parts[6]?.type === \"fractionalSecond\" ? Number(parts[6].value) : (self.epochMilliseconds % 1000 + 1000) % 1000);\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 const parts = withDate(self, dateToParts);\n self.partsAdjusted = parts;\n return parts;\n};\n/** @internal */\nexport const toPartsUtc = self => {\n if (self.partsUtc !== undefined) {\n return self.partsUtc;\n }\n const parts = withDateUtc(self, dateToParts);\n self.partsUtc = parts;\n return parts;\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))));\n/** @internal */\nexport const add = /*#__PURE__*/dual(2, (self, parts) => {\n // time units move the instant, calendar units move the wall clock\n const shifted = mutateUtc(self, date => {\n if (parts.milliseconds) {\n date.setTime(date.getTime() + parts.milliseconds);\n }\n if (parts.seconds) {\n date.setTime(date.getTime() + parts.seconds * 1000);\n }\n if (parts.minutes) {\n date.setTime(date.getTime() + parts.minutes * 60 * 1000);\n }\n if (parts.hours) {\n date.setTime(date.getTime() + parts.hours * 60 * 60 * 1000);\n }\n });\n if (!parts.days && !parts.weeks && !parts.months && !parts.years) {\n return shifted;\n }\n return mutate(shifted, date => {\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});\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().split(\"T\")[0];\n/** @internal */\nexport const formatIsoDateUtc = self => toDateUtc(self).toISOString().split(\"T\")[0];\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * Parsed scales are limited to ±10,000, and operations that align scales throw\n * a `RangeError` when the scales differ by more than 20,000.\n *\n * @stability stable\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 MAX_SCALE = 10_000;\n// Allows aligning values parsed at opposite bounds\nconst MAX_SCALE_ALIGNMENT = 2 * MAX_SCALE;\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.string(String(normalized.value)), Hash.number(normalized.scale));\n },\n [Equal.symbol](that) {\n return isBigDecimal(that) && compare(this, that) === 0;\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 * @stability stable\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 * @stability stable\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};\nconst makeNormalized = (value, scale) => {\n const o = make(value, scale);\n o.normalized = o;\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 return makeNormalized(value, scale);\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__*/makeNormalized(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 * @stability stable\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 const zeros = trailingZeros(digits);\n self.normalized = makeNormalized(BigInt(digits.slice(0, digits.length - zeros)), self.scale - zeros);\n }\n }\n return self.normalized;\n};\nconst trailingZeros = digits => {\n let end = digits.length;\n while (digits[end - 1] === \"0\") end--;\n return digits.length - end;\n};\nconst powerOfTen = exponent => {\n if (exponent > MAX_SCALE_ALIGNMENT) {\n throw new RangeError(`Scale alignment must not exceed ${MAX_SCALE_ALIGNMENT} digits, got ${exponent}`);\n }\n return bigint10 ** BigInt(exponent);\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 * **Gotchas**\n *\n * Throws a `RangeError` if the scale changes by more than 20,000.\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 * @stability stable\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 * powerOfTen(scale - self.scale), scale);\n }\n if (scale < self.scale) {\n return make(self.value / powerOfTen(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 * **Gotchas**\n *\n * Throws a `RangeError` if the operands' scales differ by more than 20,000.\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 * @stability stable\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 * **Gotchas**\n *\n * Throws a `RangeError` if the operands' scales differ by more than 20,000.\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * **Gotchas**\n *\n * Throws a `RangeError` if the operands' scales differ by more than 20,000.\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 return order.String(selfDigits.padEnd(length, \"0\"), thatDigits.padEnd(length, \"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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * **Gotchas**\n *\n * Throws a `RangeError` if the operands' scales differ by more than 20,000.\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 * @stability stable\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` or the operands' scales differ by\n * more than 20,000.\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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` otherwise, including when the scale, before or after removing\n * trailing zeros, is outside ±10,000 (for example, more than 10,000 fractional\n * digits). 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 * @stability stable\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 if (!/^\\d*$/.test(trail)) {\n return Option.none();\n }\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 const value = BigInt(digits);\n // Keeps `format` output parseable\n const normalizedScale = value === bigint0 ? scale : scale - trailingZeros(digits);\n if (scale > MAX_SCALE || normalizedScale < -MAX_SCALE) {\n return Option.none();\n }\n return Option.some(make(value, 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 and scale limits as `fromString`. Use `fromString`\n * when invalid input should be represented as `Option.none` instead of\n * 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 * @stability stable\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 * @stability stable\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 : normalized.value}`;\n const digits = normalized.scale > 0 ? absolute.padStart(normalized.scale + 1, \"0\") : absolute.padEnd(absolute.length - normalized.scale, \"0\");\n const point = digits.length - normalized.scale;\n const complete = normalized.scale > 0 ? `${digits.slice(0, point)}.${digits.slice(point)}` : digits;\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 * @stability stable\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 = `${normalized.value}`;\n const point = normalized.value < bigint0 ? 2 : 1;\n const head = digits.slice(0, point);\n const tail = digits.slice(point);\n const exp = tail.length - normalized.scale;\n return `${head}${tail === \"\" ? \"\" : `.${tail}`}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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * **Details**\n *\n * Values already at or below the target scale are returned unchanged.\n *\n * **Gotchas**\n *\n * Throws a `RangeError` if the value's scale exceeds the target scale by more\n * than 20,000.\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 * @stability stable\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 if (self.scale <= scale) {\n return self;\n }\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 * **Gotchas**\n *\n * Throws a `RangeError` if the value's scale exceeds the target scale by more\n * than 20,000.\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 * @stability stable\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 / powerOfTen(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 * **Gotchas**\n *\n * Throws a `RangeError` if the value's scale exceeds the target scale by more\n * than 20,000.\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 * @stability stable\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 / powerOfTen(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 * **Gotchas**\n *\n * Throws a `RangeError` if the value's scale exceeds the target scale by more\n * than 20,000.\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 * @stability stable\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","/**\n * Base64 encoding and decoding helpers.\n *\n * @stability stable\n * @since 4.0.0\n */\nimport * as Result from \"../Result.js\";\nimport { EncodingError } from \"./EncodingError.js\";\n/**\n * Encodes the given value into a Base64 (RFC 4648) string.\n *\n * **When to use**\n *\n * Use to encode text or bytes as a standard padded Base64 string for storage or\n * transport.\n *\n * **Details**\n *\n * String inputs are encoded as UTF-8 bytes before Base64 encoding.\n * `Uint8Array` inputs are encoded directly. The output uses the standard\n * RFC 4648 alphabet with `=` padding.\n *\n * **Example** (Encoding Base64 strings and bytes)\n *\n * ```ts import.meta.vitest\n * import { Base64 } from \"effect/encoding\"\n *\n * Base64.encode(\"hello\") // => \"aGVsbG8=\"\n *\n * const bytes = new Uint8Array([72, 101, 108, 108, 111])\n * Base64.encode(bytes) // => \"SGVsbG8=\"\n * ```\n *\n * @see {@link decode} for decoding standard Base64 to bytes\n * @see {@link decodeString} for decoding standard Base64 to UTF-8 text\n *\n * @stability stable\n * @category encoding\n * @since 4.0.0\n */\nexport const encode = input => encodeBytes(typeof input === \"string\" ? encoder.encode(input) : input);\n/**\n * Decodes a Base64 (RFC 4648) string into bytes safely.\n *\n * **When to use**\n *\n * Use to decode a standard padded Base64 string into bytes without throwing on\n * invalid input.\n *\n * **Details**\n *\n * Returns `Result.succeed` with a `Uint8Array` when decoding succeeds, or\n * `Result.fail` with an `EncodingError` when the input is not valid Base64.\n *\n * **Example** (Decoding Base64 bytes)\n *\n * ```ts import.meta.vitest\n * import { Result } from \"effect\"\n * import { Base64 } from \"effect/encoding\"\n *\n * Base64.decode(\"SGVsbG8=\") // => Result.succeed(new Uint8Array([72, 101, 108, 108, 111]))\n * ```\n *\n * @stability stable\n * @category decoding\n * @since 4.0.0\n */\nexport const decode = str => {\n const stripped = stripCrlf(str);\n const length = stripped.length;\n if (length % 4 !== 0) {\n return Result.fail(new EncodingError({\n kind: \"Decode\",\n module: \"Base64\",\n input: stripped,\n message: `Length must be a multiple of 4, but is ${length}`\n }));\n }\n const index = stripped.indexOf(\"=\");\n if (index !== -1 && (index < length - 2 || index === length - 2 && stripped[length - 1] !== \"=\")) {\n return Result.fail(new EncodingError({\n kind: \"Decode\",\n module: \"Base64\",\n input: stripped,\n message: \"Found a '=' character, but it is not at the end\"\n }));\n }\n try {\n const missingOctets = stripped.endsWith(\"==\") ? 2 : stripped.endsWith(\"=\") ? 1 : 0;\n const result = new Uint8Array(3 * (length / 4) - missingOctets);\n for (let i = 0, j = 0; i < length; i += 4, j += 3) {\n const buffer = getCode(stripped.charCodeAt(i)) << 18 | getCode(stripped.charCodeAt(i + 1)) << 12 | getCode(stripped.charCodeAt(i + 2)) << 6 | getCode(stripped.charCodeAt(i + 3));\n result[j] = buffer >> 16;\n result[j + 1] = buffer >> 8 & 0xff;\n result[j + 2] = buffer & 0xff;\n }\n return Result.succeed(result);\n } catch (cause) {\n return Result.fail(new EncodingError({\n kind: \"Decode\",\n module: \"Base64\",\n input: stripped,\n message: cause instanceof Error ? cause.message : \"Invalid input\"\n }));\n }\n};\n/**\n * Decodes a Base64 (RFC 4648) string into UTF-8 text safely.\n *\n * **When to use**\n *\n * Use to decode a standard padded Base64 string into UTF-8 text without\n * throwing on invalid input.\n *\n * **Details**\n *\n * Returns `Result.succeed` with the decoded text when decoding succeeds, or\n * `Result.fail` with an `EncodingError` when the input is not valid Base64.\n *\n * **Example** (Decoding Base64 strings)\n *\n * ```ts import.meta.vitest\n * import { Result } from \"effect\"\n * import { Base64 } from \"effect/encoding\"\n *\n * Base64.decodeString(\"aGVsbG8=\") // => Result.succeed(\"hello\")\n * ```\n *\n * @stability stable\n * @category decoding\n * @since 4.0.0\n */\nexport const decodeString = str => Result.map(decode(str), _ => decoder.decode(_));\nconst encodeBytes = bytes => {\n const length = bytes.length;\n // Looked up on the prototype at call time, so own or subclass overrides are ignored.\n const toBase64 = Uint8Array.prototype.toBase64;\n // The size guard also keeps detached buffers (length 0) away from native `toBase64`, which throws on them.\n if (length >= 32 && typeof toBase64 === \"function\") return toBase64.call(bytes);\n // Below ~128 bytes, appending to a string beats filling a byte array and decoding it once.\n return length < 128 ? encodeShort(bytes) : encodeLong(bytes);\n};\nconst encodeShort = bytes => {\n const length = bytes.length;\n let result = \"\";\n let i;\n for (i = 2; i < length; i += 3) {\n result += alphabet[bytes[i - 2] >> 2];\n result += alphabet[(bytes[i - 2] & 0x03) << 4 | bytes[i - 1] >> 4];\n result += alphabet[(bytes[i - 1] & 0x0f) << 2 | bytes[i] >> 6];\n result += alphabet[bytes[i] & 0x3f];\n }\n if (i === length + 1) {\n result += alphabet[bytes[i - 2] >> 2];\n result += alphabet[(bytes[i - 2] & 0x03) << 4];\n result += \"==\";\n }\n if (i === length) {\n result += alphabet[bytes[i - 2] >> 2];\n result += alphabet[(bytes[i - 2] & 0x03) << 4 | bytes[i - 1] >> 4];\n result += alphabet[(bytes[i - 1] & 0x0f) << 2];\n result += \"=\";\n }\n return result;\n};\nconst encodeLong = bytes => {\n const length = bytes.length;\n const result = new Uint8Array(Math.ceil(length / 3) * 4);\n let i;\n let j = 0;\n for (i = 2; i < length; i += 3, j += 4) {\n result[j] = alphabetCodes[bytes[i - 2] >> 2];\n result[j + 1] = alphabetCodes[(bytes[i - 2] & 0x03) << 4 | bytes[i - 1] >> 4];\n result[j + 2] = alphabetCodes[(bytes[i - 1] & 0x0f) << 2 | bytes[i] >> 6];\n result[j + 3] = alphabetCodes[bytes[i] & 0x3f];\n }\n if (i === length + 1) {\n result[j] = alphabetCodes[bytes[i - 2] >> 2];\n result[j + 1] = alphabetCodes[(bytes[i - 2] & 0x03) << 4];\n result[j + 2] = paddingCode;\n result[j + 3] = paddingCode;\n }\n if (i === length) {\n result[j] = alphabetCodes[bytes[i - 2] >> 2];\n result[j + 1] = alphabetCodes[(bytes[i - 2] & 0x03) << 4 | bytes[i - 1] >> 4];\n result[j + 2] = alphabetCodes[(bytes[i - 1] & 0x0f) << 2];\n result[j + 3] = paddingCode;\n }\n return decoder.decode(result);\n};\nconst encoder = /*#__PURE__*/new TextEncoder();\nconst decoder = /*#__PURE__*/new TextDecoder();\nconst stripCrlf = str => str.replace(/[\\n\\r]/g, \"\");\nconst alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nconst alphabetCodes = /*#__PURE__*/encoder.encode(alphabet);\nconst paddingCode = /*#__PURE__*/\"=\".charCodeAt(0);\nconst codes = /*#__PURE__*/new Uint8Array(123).fill(255);\nfor (let i = 0; i < alphabet.length; i++) codes[/*#__PURE__*/alphabet.charCodeAt(i)] = i;\ncodes[/*#__PURE__*/\"=\".charCodeAt(0)] = 0;\nconst getCode = charCode => {\n if (charCode >= codes.length || codes[charCode] === 255) {\n throw new TypeError(`Invalid character ${String.fromCharCode(charCode)}`);\n }\n return codes[charCode];\n};\n//# sourceMappingURL=Base64.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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 preserves the original instant, regardless of 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 * @stability stable\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 stores the zoned wall-clock time in the returned\n * `Date`'s UTC fields, rather than preserving the original instant. Use\n * `toDateUtc` to preserve the instant.\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-07-01T12:00:00Z\")\n * const zoned = DateTime.makeZonedUnsafe(\"2024-07-01T12:00:00Z\", {\n * timeZone: \"Europe/London\"\n * })\n *\n * DateTime.toDate(utc).toISOString() // => \"2024-07-01T12:00:00.000Z\"\n * DateTime.toDate(zoned).toISOString() // => \"2024-07-01T13:00:00.000Z\"\n * DateTime.toDateUtc(zoned).toISOString() // => \"2024-07-01T12:00:00.000Z\"\n * ```\n *\n * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\n * @category layers\n * @since 3.6.0\n */\nexport const layerCurrentZoneLocal = /*#__PURE__*/Layer.sync(CurrentTimeZone)(zoneMakeLocal);\n//# sourceMappingURL=DateTime.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 * For client-side storage, `mergeIntoArray` and `toRequestCookieHeader`\n * work on a plain array of cookies scoped by domain, path and scheme, following\n * RFC 6265.\n *\n * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\n * @since 4.0.0\n */\n [CookieErrorTypeId] = CookieErrorTypeId;\n /**\n * Uses the concrete cookie error reason as the public message.\n *\n * @stability unstable\n * @since 4.0.0\n */\n get message() {\n return this.reason._tag;\n }\n}\n/**\n * Checks whether a value is a `CookiesError`.\n *\n * @stability unstable\n * @category guards\n * @since 4.0.0\n */\nexport const isCookiesError = u => Predicate.hasProperty(u, CookieErrorTypeId);\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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).replace(cookieWhitespaceRegExp, \"\");\n if (!cookieNameRegExp.test(name)) {\n return undefined;\n }\n const valueEncoded = parts[0].slice(firstEqual + 1).replace(cookieWhitespaceRegExp, \"\");\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 || !maxAgeRegExp.test(value)) {\n break;\n }\n options.maxAge = Duration.seconds(parseInt(value, 10));\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 * @stability unstable\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 * @stability unstable\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]+$/;\nconst cookieWhitespaceRegExp = /^[\\t ]+|[\\t ]+$/g;\n// RFC 6265 section 5.2.2\nconst maxAgeRegExp = /^-?[0-9]+$/;\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 && !options.hostOnly) {\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\n * @category encoding\n * @since 4.0.0\n */\nexport const toSetCookieHeaders = self => Object.values(self.cookies).map(serializeCookie);\n/**\n * Merges cookies set by `url` into an array of client cookies, returning a new\n * array.\n *\n * **When to use**\n *\n * Use to record the cookies of a response, or to seed an array of client\n * cookies from `Set-Cookie` values for a base URL.\n *\n * **Details**\n *\n * A cookie without a `Domain` attribute is scoped as `hostOnly` to the exact\n * host of `url`. A `Domain` attribute is accepted only when the host of `url`\n * domain-matches it. Without a `Path` attribute the cookie uses the default\n * path of `url`. `Max-Age` takes precedence over `Expires`, and both are\n * converted to an absolute `expires` computed from `now` (epoch milliseconds).\n *\n * A cookie replaces the existing cookie with the same name, domain and path,\n * keeping its position. A cookie that is already expired removes that existing\n * cookie instead. The array is returned unchanged when `url` is not a valid\n * absolute URL.\n *\n * **Gotchas**\n *\n * - There is no public suffix list. A `Domain` attribute is accepted whenever\n * the request host domain-matches it, unless the host is an IP address or the\n * domain is a single label such as `com`, so `foo.co.uk` can set\n * `Domain=co.uk`.\n *\n * @stability unstable\n * @category client storage\n * @since 4.0.0\n */\nexport const mergeIntoArray = /*#__PURE__*/dual(4, (self, url, cookies, now) => {\n const parsed = parseUrl(url);\n if (parsed === undefined) {\n return self;\n }\n const stored = self.slice();\n for (const cookie of Object.values(cookies.cookies)) {\n const scoped = scopeCookie(parsed, cookie, now);\n if (scoped === undefined) {\n continue;\n }\n const domain = cookieDomain(scoped);\n const path = cookiePath(scoped);\n const index = stored.findIndex(existing => existing.name === scoped.name && cookieDomain(existing) === domain && cookiePath(existing) === path);\n if (scoped.options.expires !== undefined && scoped.options.expires.getTime() <= now) {\n if (index !== -1) stored.splice(index, 1);\n } else if (index === -1) {\n stored.push(scoped);\n } else {\n stored[index] = scoped;\n }\n }\n return stored;\n});\n/**\n * Serializes the client cookies to send with a request to `url` into a\n * `Cookie` header value.\n *\n * **Details**\n *\n * Selects cookies that have not expired at `now` (epoch milliseconds) and whose\n * domain and path match `url`, skipping `Secure` cookies unless `url` uses\n * `https`. Every matching cookie is kept, including cookies with the same name,\n * ordered by longest path first. Returns `undefined` when no cookie matches.\n *\n * A leading dot and letter case in `domain` are ignored. A cookie without a\n * `domain` is never sent, and a cookie without a `path` matches every path.\n *\n * @stability unstable\n * @category client storage\n * @since 4.0.0\n */\nexport const toRequestCookieHeader = /*#__PURE__*/dual(3, (self, url, now) => {\n const parsed = parseUrl(url);\n if (parsed === undefined) {\n return undefined;\n }\n const host = parsed.hostname;\n const secure = parsed.protocol === \"https:\";\n const matching = self.filter(cookie => {\n const domain = cookieDomain(cookie);\n return domain !== undefined && (cookie.options?.hostOnly ? host === domain : domainMatches(host, domain)) && pathMatches(parsed.pathname, cookiePath(cookie)) && (cookie.options?.expires === undefined || cookie.options.expires.getTime() > now) && (secure || !cookie.options?.secure);\n });\n return matching.length === 0 ? undefined : matching.sort((a, b) => cookiePath(b).length - cookiePath(a).length).map(cookie => `${cookie.name}=${cookie.valueEncoded}`).join(\"; \");\n});\nconst parseUrl = url => {\n try {\n return new URL(url);\n } catch {\n return undefined;\n }\n};\nconst cookieDomain = cookie => cookie.options?.domain?.replace(/^\\./, \"\").toLowerCase() || undefined;\nconst cookiePath = cookie => cookie.options?.path?.startsWith(\"/\") ? cookie.options.path : \"/\";\nconst isIpAddress = host => host.startsWith(\"[\") || /^\\d+\\.\\d+\\.\\d+\\.\\d+$/.test(host);\nconst domainMatches = (host, domain) => host === domain || host.endsWith(\".\" + domain) && !isIpAddress(host);\nconst pathMatches = (requestPath, cookiePath) => requestPath === cookiePath || requestPath.startsWith(cookiePath) && (cookiePath.endsWith(\"/\") || requestPath[cookiePath.length] === \"/\");\nconst defaultPath = pathname => {\n const index = pathname.lastIndexOf(\"/\");\n return index <= 0 ? \"/\" : pathname.slice(0, index);\n};\nconst scopeCookie = (url, cookie, now) => {\n const host = url.hostname;\n let domain = host;\n let hostOnly = true;\n const attribute = cookieDomain(cookie);\n if (attribute !== undefined) {\n if (isIpAddress(host) || !domainMatches(host, attribute)) {\n return undefined;\n }\n if (attribute.includes(\".\")) {\n domain = attribute;\n hostOnly = false;\n } else if (attribute !== host) {\n // a single-label domain such as \"com\" is treated like a public suffix\n return undefined;\n }\n }\n const {\n maxAge,\n ...options\n } = cookie.options ?? {};\n return Object.assign(Object.create(CookieProto), {\n name: cookie.name,\n value: cookie.value,\n valueEncoded: cookie.valueEncoded,\n options: {\n ...options,\n domain,\n hostOnly: hostOnly || undefined,\n path: options.path?.startsWith(\"/\") ? options.path : defaultPath(url.pathname),\n expires: maxAge !== undefined ? new Date(now + Duration.toMillis(maxAge)) : options.expires\n }\n });\n};\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 * @stability unstable\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 let value = header.substring(eqIdx, terminatorPos).trim();\n if (value.charCodeAt(0) === 0x22) value = value.slice(1, -1).trim();\n InternalRecord.assignProperty(result, key, !(value.indexOf(\"%\") === -1) ? tryDecodeURIComponent(value) : value);\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 HTTP headers for the unstable HTTP client and server modules.\n *\n * `Headers` values are immutable maps keyed by lowercase header name. This\n * module converts common header inputs into that shape, provides helpers for\n * reading and updating header values, and redacts configured sensitive headers\n * when values are inspected.\n *\n * It also parses and formats the values of standard headers, such as HTTP\n * dates and `Retry-After`, with the tolerance the RFCs allow and nothing more.\n * The string codecs for those values live in `Schema`, for example\n * `Schema.DateTimeUtcFromHttpDate` and `Schema.RetryAfterFromString`.\n *\n * @stability unstable\n * @since 4.0.0\n */\nimport * as Context from \"../Context.js\";\nimport * as Data from \"../Data.js\";\nimport * as DateTime from \"../DateTime.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 Predicate from \"../Predicate.js\";\nimport * as Record from \"../Record.js\";\nimport * as Redactable from \"../Redactable.js\";\nimport * as Redacted from \"../Redacted.js\";\nimport * as Result from \"../Result.js\";\n/**\n * Runtime type identifier for `Headers` values.\n *\n * @stability unstable\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = /*#__PURE__*/Symbol.for(\"~effect/http/Headers\");\n/**\n * Returns `true` if the provided value is a `Headers` value.\n *\n * @stability unstable\n * @category guards\n * @since 4.0.0\n */\nexport const isHeaders = u => Predicate.hasProperty(u, TypeId);\n// the properties are folded into the initializer (rather than a separate\n// `Object.defineProperties(Proto, ...)` statement) so the whole definition\n// is pure-annotated by the build and tree-shakable.\nconst Proto = /*#__PURE__*/Object.defineProperties(/*#__PURE__*/Object.create(null), {\n [TypeId]: {\n value: TypeId\n },\n [Redactable.symbolRedactable]: {\n value(context) {\n return redact(this, Context.get(context, CurrentRedactedNames));\n }\n },\n toJSON: {\n value() {\n return Redactable.redact(this);\n }\n },\n [Equal.symbol]: {\n value(that) {\n return Equivalence(this, that);\n }\n },\n [Hash.symbol]: {\n value() {\n return Hash.structure(this);\n }\n },\n toString: {\n value: Inspectable.BaseProto.toString\n },\n [Inspectable.NodeInspectSymbol]: {\n value: Inspectable.BaseProto[Inspectable.NodeInspectSymbol]\n }\n});\nconst make = input => Object.assign(Object.create(Proto), input);\n/**\n * Provides an `Equivalence` instance that compares `Headers` by header names\n * and string values.\n *\n * @stability unstable\n * @category instances\n * @since 4.0.0\n */\nexport const Equivalence = /*#__PURE__*/Record.makeEquivalence(/*#__PURE__*/Equ.strictEqual());\n/**\n * An empty `Headers` collection.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/Object.create(Proto);\n/**\n * Creates `Headers` from a record or iterable of header entries.\n *\n * **Details**\n *\n * Header names are normalized to lowercase. Array values in record input are joined with `\", \"`, and `undefined` values are omitted.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const fromInput = input => {\n if (input === undefined) {\n return empty;\n } else if (Symbol.iterator in input) {\n const out = Object.create(Proto);\n for (const [k, v] of input) {\n out[k.toLowerCase()] = v;\n }\n return out;\n }\n const out = Object.create(Proto);\n for (const [k, v] of Object.entries(input)) {\n if (Array.isArray(v)) {\n out[k.toLowerCase()] = v.join(\", \");\n } else if (v !== undefined) {\n out[k.toLowerCase()] = v;\n }\n }\n return out;\n};\n/**\n * Treats an existing record as `Headers` unsafely.\n *\n * **Gotchas**\n *\n * This mutates the record's prototype and does not normalize header names; callers must provide the expected lowercase keys.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const fromRecordUnsafe = input => Object.setPrototypeOf(input, Proto);\n/**\n * Returns `true` when a header with the given name is present.\n *\n * **Details**\n *\n * The lookup lowercases the provided header name.\n *\n * @stability unstable\n * @category combinators\n * @since 4.0.0\n */\nexport const has = /*#__PURE__*/dual(2, (self, key) => key.toLowerCase() in self);\n/**\n * Gets a header value by name safely.\n *\n * **Details**\n *\n * The lookup lowercases the provided header name and returns `Option.none()` when absent.\n *\n * @stability unstable\n * @category combinators\n * @since 4.0.0\n */\nexport const get = /*#__PURE__*/dual(2, (self, key) => Option.fromUndefinedOr(self[key.toLowerCase()]));\n/**\n * Returns a new `Headers` collection with the given header set.\n *\n * **Details**\n *\n * The header name is normalized to lowercase.\n *\n * @stability unstable\n * @category combinators\n * @since 4.0.0\n */\nexport const set = /*#__PURE__*/dual(3, (self, key, value) => {\n const out = make(self);\n out[key.toLowerCase()] = value;\n return out;\n});\n/**\n * Returns a new `Headers` collection with all provided headers set.\n *\n * **Details**\n *\n * Input headers are normalized with `fromInput` and override existing headers with the same lowercase name.\n *\n * @stability unstable\n * @category combinators\n * @since 4.0.0\n */\nexport const setAll = /*#__PURE__*/dual(2, (self, headers) => make({\n ...self,\n ...fromInput(headers)\n}));\n/**\n * Returns a new `Headers` collection containing headers from both collections.\n *\n * **Details**\n *\n * Headers from the second collection override headers from the first collection with the same name.\n *\n * @stability unstable\n * @category combinators\n * @since 4.0.0\n */\nexport const merge = /*#__PURE__*/dual(2, (self, headers) => {\n const out = make(self);\n Object.assign(out, headers);\n return out;\n});\n/**\n * Returns a new `Headers` collection with the named header removed.\n *\n * **Details**\n *\n * The provided header name is normalized to lowercase before removal.\n *\n * @stability unstable\n * @category combinators\n * @since 4.0.0\n */\nexport const remove = /*#__PURE__*/dual(2, (self, key) => {\n const out = make(self);\n delete out[key.toLowerCase()];\n return out;\n});\n/**\n * Returns a new `Headers` collection with each named header removed.\n *\n * **Details**\n *\n * Each provided header name is normalized to lowercase before removal.\n *\n * @stability unstable\n * @category combinators\n * @since 4.0.0\n */\nexport const removeMany = /*#__PURE__*/dual(2, (self, keys) => {\n const out = make(self);\n for (const key of keys) {\n delete out[key.toLowerCase()];\n }\n return out;\n});\n/**\n * Returns a plain record with selected header values wrapped in `Redacted`.\n *\n * **Details**\n *\n * String keys are normalized to lowercase before matching; regular expressions are tested against the stored header names.\n *\n * @stability unstable\n * @category combinators\n * @since 4.0.0\n */\nexport const redact = /*#__PURE__*/dual(2, (self, key) => {\n const out = {\n ...self\n };\n const modify = key => {\n if (typeof key === \"string\") {\n const k = key.toLowerCase();\n if (k in self) {\n out[k] = Redacted.make(self[k]);\n }\n } else {\n for (const name in self) {\n if (name.search(key) !== -1) {\n out[name] = Redacted.make(self[name]);\n }\n }\n }\n };\n if (Array.isArray(key)) {\n for (let i = 0; i < key.length; i++) {\n modify(key[i]);\n }\n } else {\n modify(key);\n }\n return out;\n});\n/**\n * Checks whether a header name matches one of the redaction patterns.\n *\n * **Details**\n *\n * String patterns are compared case-insensitively against the header name;\n * regular expressions are tested against it. Use to avoid the record copy of\n * `redact` when only a membership check is needed.\n *\n * @stability unstable\n * @category combinators\n * @since 4.0.0\n */\nexport const isRedactedName = (name, patterns) => {\n const lowerName = name.toLowerCase();\n for (let i = 0; i < patterns.length; i++) {\n const pattern = patterns[i];\n if (typeof pattern === \"string\") {\n if (pattern.toLowerCase() === lowerName) {\n return true;\n }\n } else if (name.search(pattern) !== -1) {\n return true;\n }\n }\n return false;\n};\n/**\n * Context reference listing header names or patterns that should be redacted when `Headers` are inspected or rendered.\n *\n * **Details**\n *\n * Defaults include `authorization`, `cookie`, `set-cookie` and `x-api-key`.\n * A custom list replaces the defaults. Matching uses `isRedactedName`.\n * Use `UrlParams.CurrentRedactedNames` for query parameters.\n *\n * @stability unstable\n * @category services\n * @since 4.0.0\n */\nexport const CurrentRedactedNames = /*#__PURE__*/Context.Reference(\"effect/Headers/CurrentRedactedNames\", {\n defaultValue: () => [\"authorization\", \"cookie\", \"set-cookie\", \"x-api-key\"]\n});\n// -----------------------------------------------------------------------------\n// Header values\n// -----------------------------------------------------------------------------\nconst HeaderParseErrorTypeId = \"~effect/http/Headers/HeaderParseError\";\n/**\n * Error reason describing which header value failed to parse.\n *\n * **Details**\n *\n * `input` is the raw header value that was rejected.\n *\n * @stability unstable\n * @category errors\n * @since 4.0.0\n */\nexport class HeaderParseErrorReason extends Data.Error {}\n/**\n * Error returned when a header value does not match its grammar.\n *\n * **Details**\n *\n * Inspect `reason` to find the header that failed and the rejected input.\n *\n * @stability unstable\n * @category errors\n * @since 4.0.0\n */\nexport class HeaderParseError extends /*#__PURE__*/Data.TaggedError(\"HeaderParseError\") {\n /**\n * Creates a header parse error from a reason tag and the rejected input.\n *\n * @stability unstable\n * @since 4.0.0\n */\n static fromReason(reason, input) {\n return new HeaderParseError({\n reason: new HeaderParseErrorReason({\n _tag: reason,\n input\n })\n });\n }\n /**\n * Marks this value as a header parse error for runtime guards.\n *\n * @stability unstable\n * @since 4.0.0\n */\n [HeaderParseErrorTypeId] = HeaderParseErrorTypeId;\n /**\n * Names the failed header and the rejected input.\n *\n * @stability unstable\n * @since 4.0.0\n */\n get message() {\n return `${this.reason._tag}: ${JSON.stringify(this.reason.input)}`;\n }\n}\n/**\n * Checks whether a value is a `HeaderParseError`.\n *\n * @stability unstable\n * @category guards\n * @since 4.0.0\n */\nexport const isHeaderParseError = u => Predicate.hasProperty(u, HeaderParseErrorTypeId);\n// -----------------------------------------------------------------------------\n// HTTP dates (RFC 9110 §5.6.7)\n// -----------------------------------------------------------------------------\nconst monthNames = [\"jan\", \"feb\", \"mar\", \"apr\", \"may\", \"jun\", \"jul\", \"aug\", \"sep\", \"oct\", \"nov\", \"dec\"];\n// RFC 9110 §5.6.7: IMF-fixdate, then the obsolete RFC 850 and asctime forms\nconst httpDateFormats = [\n// Sun, 06 Nov 1994 08:49:37 GMT\n/^(?:mon|tue|wed|thu|fri|sat|sun), (?<day>\\d{2}) (?<month>[a-z]{3}) (?<year>\\d{4}) (?<hour>\\d{2}):(?<minute>\\d{2}):(?<second>\\d{2}) gmt$/i,\n// Sunday, 06-Nov-94 08:49:37 GMT\n/^(?:monday|tuesday|wednesday|thursday|friday|saturday|sunday), (?<day>\\d{2})-(?<month>[a-z]{3})-(?<year>\\d{2}) (?<hour>\\d{2}):(?<minute>\\d{2}):(?<second>\\d{2}) gmt$/i,\n// Sun Nov 6 08:49:37 1994\n/^(?:mon|tue|wed|thu|fri|sat|sun) (?<month>[a-z]{3}) (?<day> \\d|\\d{2}) (?<hour>\\d{2}):(?<minute>\\d{2}):(?<second>\\d{2}) (?<year>\\d{4})$/i];\nconst httpDateToMillis = input => {\n for (const format of httpDateFormats) {\n const groups = format.exec(input)?.groups;\n if (groups === undefined) continue;\n const month = monthNames.indexOf(groups.month.toLowerCase());\n const hour = Number(groups.hour);\n const minute = Number(groups.minute);\n const second = Number(groups.second);\n // the grammar allows 23:59:60 for a leap second\n if (month === -1 || hour > 23 || minute > 59 || second > 60) {\n return undefined;\n }\n // two-digit years use a fixed pivot, see parseHttpDate\n let year = Number(groups.year);\n if (groups.year.length === 2) {\n year += year < 70 ? 2000 : 1900;\n }\n const day = Number(groups.day);\n // setUTCFullYear keeps years below 100 as-is, unlike Date.UTC\n const date = new Date(0);\n date.setUTCFullYear(year, month, day);\n // an impossible day such as 31 Feb rolls over into the next month\n if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) {\n return undefined;\n }\n // a leap second cannot be represented in epoch time and reads as the\n // following second\n return date.getTime() + ((hour * 60 + minute) * 60 + second) * 1000;\n }\n return undefined;\n};\n/**\n * Parses an HTTP date header value into a UTC `DateTime`.\n *\n * **Details**\n *\n * Accepts the three formats of RFC 9110 §5.6.7: the preferred IMF-fixdate\n * (`Sun, 06 Nov 1994 08:49:37 GMT`), the obsolete RFC 850 format\n * (`Sunday, 06-Nov-94 08:49:37 GMT`) and the asctime format\n * (`Sun Nov 6 08:49:37 1994`). All three are read as UTC regardless of the\n * process time zone. Day and month names are case-insensitive, and the day\n * name is not checked against the date. A leap second (`23:59:60`) is read\n * as the following second, since epoch time cannot represent it.\n *\n * The two-digit year of the RFC 850 format is read with a fixed pivot:\n * `70`-`99` as 1970-1999 and `00`-`69` as 2000-2069. This deviates from\n * RFC 9110, which asks for the year to be chosen relative to the current\n * time so that it is never more than 50 years in the future. The fixed pivot\n * keeps parsing independent of the clock and matches most other HTTP\n * implementations.\n *\n * @stability unstable\n * @category header values\n * @since 4.0.0\n */\nexport const parseHttpDate = input => {\n const millis = httpDateToMillis(input.trim());\n return millis === undefined ? Result.fail(HeaderParseError.fromReason(\"InvalidHttpDate\", input)) : Result.succeed(DateTime.makeUnsafe(millis));\n};\n/**\n * Formats a `DateTime` as an IMF-fixdate HTTP date, such as\n * `Sun, 06 Nov 1994 08:49:37 GMT`.\n *\n * @stability unstable\n * @category header values\n * @since 4.0.0\n */\nexport const formatHttpDate = self => DateTime.toDateUtc(self).toUTCString();\n/**\n * Creates a `Retry-After` value from a delay.\n *\n * **Details**\n *\n * Infinite durations, positive or negative, have no header form and throw.\n * That check runs first; a finite negative duration then becomes zero.\n * Fractional seconds are kept, and {@link formatRetryAfter} rounds them up so\n * the header never asks for a shorter wait.\n *\n * A plain number is read as milliseconds, as everywhere in `Duration`: pass\n * `\"120 seconds\"` or `Duration.seconds(120)` for a two-minute delay.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const retryAfterDuration = input => {\n const duration = Duration.fromInputUnsafe(input);\n if (!Duration.isFinite(duration)) {\n throw new Error(\"Cannot create a Retry-After value from an infinite duration\");\n }\n return {\n _tag: \"Duration\",\n duration: Duration.isNegative(duration) ? Duration.zero : duration\n };\n};\n/**\n * Creates a `Retry-After` value from an HTTP date.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const retryAfterDateTime = dateTime => ({\n _tag: \"DateTime\",\n dateTime\n});\nconst wholeSeconds = /^\\d+$/;\nconst nanosPerSecond = /*#__PURE__*/BigInt(1_000_000_000);\n/**\n * Parses a `Retry-After` header value.\n *\n * **Details**\n *\n * Accepts whole non-negative seconds (`120`) of any size, read exactly, or an\n * HTTP date in any of the formats {@link parseHttpDate} accepts. Fractional,\n * negative, exponent and non-finite numbers are rejected, as are dates in\n * other formats.\n *\n * @stability unstable\n * @category header values\n * @since 4.0.0\n */\nexport const parseRetryAfter = input => {\n const trimmed = input.trim();\n if (wholeSeconds.test(trimmed)) {\n const seconds = Number(trimmed);\n // Keep the millisecond form while it is exact; beyond that, count nanos.\n const duration = Number.isSafeInteger(seconds * 1000) ? Duration.seconds(seconds) : Duration.nanos(BigInt(trimmed) * nanosPerSecond);\n return Result.succeed({\n _tag: \"Duration\",\n duration\n });\n }\n const millis = httpDateToMillis(trimmed);\n return millis === undefined ? Result.fail(HeaderParseError.fromReason(\"InvalidRetryAfter\", input)) : Result.succeed(retryAfterDateTime(DateTime.makeUnsafe(millis)));\n};\n/**\n * Formats a `Retry-After` value as a header value: the delay as whole\n * seconds, or the date as an IMF-fixdate.\n *\n * **Details**\n *\n * A delay with a fractional second is rounded up, since `Retry-After` is the\n * least time to wait. Large delays are written as exact decimal digits.\n *\n * @stability unstable\n * @category header values\n * @since 4.0.0\n */\nexport const formatRetryAfter = self => self._tag === \"Duration\" ? String((Duration.toNanosUnsafe(self.duration) + nanosPerSecond - BigInt(1)) / nanosPerSecond) : formatHttpDate(self.dateTime);\n/**\n * Computes how long to wait for a `Retry-After` value, measured from `now`\n * in epoch milliseconds.\n *\n * **Details**\n *\n * A date that is already in the past yields a zero duration, never a\n * negative one. Compute the delay when the retry is scheduled rather than\n * when the header is parsed, so the wait reflects the time already spent.\n *\n * @stability unstable\n * @category header values\n * @since 4.0.0\n */\nexport const retryAfterDelay = (self, now) => self._tag === \"Duration\" ? self.duration : Duration.millis(Math.max(0, DateTime.toEpochMillis(self.dateTime) - now));\n/**\n * Provides an `Equivalence` instance for `Retry-After` values.\n *\n * @stability unstable\n * @category instances\n * @since 4.0.0\n */\nexport const RetryAfterEquivalence = (self, that) => self._tag === \"Duration\" ? that._tag === \"Duration\" && Duration.Equivalence(self.duration, that.duration) : that._tag === \"DateTime\" && DateTime.Equivalence(self.dateTime, that.dateTime);\n//# sourceMappingURL=Headers.js.map","import * as Redacted from \"../../Redacted.js\";\n/** @internal */\nexport const unwrap = value => typeof value === \"string\" ? value : Redacted.value(value);\n/** @internal */\nexport const stripSearchAndHash = url => {\n const queryIndex = url.indexOf(\"?\");\n const hashIndex = url.indexOf(\"#\");\n if (queryIndex === -1) {\n return hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n if (hashIndex === -1) {\n return url.slice(0, queryIndex);\n }\n return url.slice(0, Math.min(queryIndex, hashIndex));\n};\n// URL-encoded bodies keep a leading U+FEFF as form data\nconst bodyDecoder = /*#__PURE__*/new TextDecoder(\"utf-8\", {\n ignoreBOM: true\n});\n/** @internal */\nexport const fromBody = bytes =>\n// A leading \"?\" is form data; URLSearchParams would drop it as a query prefix.\nnew URLSearchParams(bodyDecoder.decode(bytes).replace(/^\\?/, \"%3F\"));\nconst originForm = /^\\/(?![/\\\\])/;\n/** @internal */\nexport const toPath = url => {\n // Origin-form targets and \"*\" are already paths; absolute URLs can carry credentials.\n if (url === \"*\" || originForm.test(url)) {\n return stripSearchAndHash(url);\n }\n try {\n return new URL(url, \"http://localhost\").pathname;\n } catch {\n return \"<invalid URL>\";\n }\n};\n//# sourceMappingURL=urlParams.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 * @stability unstable\n * @since 4.0.0\n */\nimport * as Arr from \"../Array.js\";\nimport * as Context from \"../Context.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 Redactable from \"../Redactable.js\";\nimport * as Redacted from \"../Redacted.js\";\nimport * as Tuple from \"../Tuple.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as internal from \"./internal/urlParams.js\";\nconst TypeId = \"~effect/http/UrlParams\";\n/**\n * Returns `true` when a value is a `UrlParams` instance.\n *\n * @stability unstable\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 [Redactable.symbolRedactable](context) {\n return {\n _id: \"UrlParams\",\n params: Object.fromEntries(redact(this, Context.get(context, CurrentRedactedNames)))\n };\n },\n toJSON() {\n return Redactable.redact(this);\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 key-value pairs.\n *\n * **Details**\n *\n * The input pairs are used as-is and are not coerced or normalized.\n *\n * @stability unstable\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 * `Redacted` values are kept as-is.\n *\n * @stability unstable\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, coerce(value[i])]);\n }\n }\n } else if (value !== null && typeof value === \"object\" && !Redacted.isRedacted(value)) {\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, coerce(value)]);\n }\n }\n return out;\n};\nconst coerce = value => Redacted.isRedacted(value) ? value : String(value);\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 * @stability unstable\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__*/Equal.asEquivalence()]));\n/**\n * An empty `UrlParams` value.\n *\n * @stability unstable\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 * @stability unstable\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(internal.unwrap(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 * @stability unstable\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]) => internal.unwrap(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 * @stability unstable\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]) => internal.unwrap(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 * @stability unstable\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, coerce(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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\n * @category combinators\n * @since 4.0.0\n */\nexport const append = /*#__PURE__*/dual(3, (self, key, value) => make(Arr.append(self.params, [key, coerce(value)])));\n/**\n * Appends all query parameters produced from the supplied input.\n *\n * **Details**\n *\n * Existing parameters are preserved.\n *\n * @stability unstable\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 * @stability unstable\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 * **Gotchas**\n *\n * The output contains the unwrapped values of `Redacted` parameters.\n *\n * @stability unstable\n * @category converting\n * @since 4.0.0\n */\nexport const toString = input => new URLSearchParams(fromInput(input).params.map(([key, value]) => [key, internal.unwrap(value)])).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/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 * @stability unstable\n * @category converting\n * @since 4.0.0\n */\nexport const toRecord = self => {\n const out = {};\n for (const [k, v] of self.params) {\n const value = internal.unwrap(v);\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 * @stability unstable\n * @category converting\n * @since 4.0.0\n */\nexport const toReadonlyRecord = toRecord;\n/**\n * Returns the parameter pairs with selected values wrapped in `Redacted`.\n *\n * **Details**\n *\n * Keeps `Redacted` values and wraps values whose names match `isRedactedName`,\n * preserving order and repeated names.\n *\n * @stability unstable\n * @category combinators\n * @since 4.0.0\n */\nexport const redact = /*#__PURE__*/dual(2, (self, key) => {\n const patterns = Array.isArray(key) ? key : [key];\n return self.params.map(([name, value]) => [name, typeof value === \"string\" && isRedactedName(name, patterns) ? Redacted.make(value) : value]);\n});\n/**\n * Checks whether a parameter name matches one of the redaction patterns.\n *\n * **Details**\n *\n * String patterns match case-insensitively; regular expressions test the name.\n *\n * @stability unstable\n * @category combinators\n * @since 4.0.0\n */\nexport const isRedactedName = Headers.isRedactedName;\n/**\n * Redacts URL userinfo and the values of matching query parameters.\n *\n * **Details**\n *\n * Replaces userinfo with `REDACTED:REDACTED` and query values with `REDACTED`\n * when their decoded names match `isRedactedName`. Preserves all other text.\n * When names are omitted, uses the current fiber's `CurrentRedactedNames`,\n * falling back to the defaults outside a fiber.\n *\n * **Example** (Redacting a signed URL)\n *\n * ```ts import.meta.vitest\n * import { UrlParams } from \"effect/http\"\n *\n * const url = UrlParams.redactUrl(\"https://bucket.test/file?Signature=abc&size=1\")\n * url // => \"https://bucket.test/file?Signature=REDACTED&size=1\"\n * ```\n *\n * @stability unstable\n * @category combinators\n * @since 4.0.0\n */\nexport const redactUrl = (url, redactedNames = currentRedactedNames()) => {\n if (url.includes(\"@\")) url = redactUserinfo(url);\n const queryStart = url.indexOf(\"?\");\n if (queryStart === -1 || redactedNames.length === 0) return url;\n const hashStart = url.indexOf(\"#\");\n if (hashStart !== -1 && hashStart < queryStart) return url;\n const queryEnd = hashStart === -1 ? url.length : hashStart;\n return url.slice(0, queryStart + 1) + redactQuery(url.slice(queryStart + 1, queryEnd), redactedNames) + url.slice(queryEnd);\n};\nconst authorityStart = /^(?:(https?|ftp|wss?):[/\\\\]*|[a-z][a-z\\d+.-]*:\\/\\/|[/\\\\]{2,})/i;\nconst specialAuthorityEnd = /[/\\\\?#]/;\nconst authorityEnd = /[/?#]/;\n// Normalize only to locate userinfo; offsets preserve the original URL spelling.\nconst redactUserinfo = url => {\n let normalized = \"\";\n const offsets = [];\n for (let i = 0; i < url.length; i++) {\n const code = url.charCodeAt(i);\n if (code === 9 || code === 10 || code === 13 || normalized === \"\" && code <= 32) continue;\n normalized += url[i];\n offsets.push(i);\n }\n const authority = authorityStart.exec(normalized);\n if (authority === null) return url;\n const start = authority[0].length;\n const special = authority[1] !== undefined || !authority[0].includes(\":\");\n const rest = normalized.slice(start);\n const end = rest.search(special ? specialAuthorityEnd : authorityEnd);\n const userinfoEnd = (end === -1 ? rest : rest.slice(0, end)).lastIndexOf(\"@\");\n return userinfoEnd === -1 ? url : url.slice(0, offsets[start]) + \"REDACTED:REDACTED\" + url.slice(offsets[start + userinfoEnd]);\n};\nconst redactQuery = (query, redactedNames) => query.split(\"&\").map(part => {\n const index = part.indexOf(\"=\");\n return index !== -1 && isRedactedName(decodeQueryKey(part.slice(0, index)), redactedNames) ? part.slice(0, index + 1) + \"REDACTED\" : part;\n}).join(\"&\");\nconst decodeQueryKey = key => {\n if (!key.includes(\"%\") && !key.includes(\"+\")) return key;\n try {\n return decodeURIComponent(key.replace(/\\+/g, \" \"));\n } catch {\n return key;\n }\n};\nconst currentRedactedNames = () => Context.get(globalThis[Redactable.currentFiberTypeId]?.context ?? Context.empty(), CurrentRedactedNames);\n/**\n * Query parameter names or patterns to redact in inspection, spans and errors.\n *\n * **Details**\n *\n * Defaults match the OpenTelemetry `url.full` list: `X-Amz-Signature`,\n * `X-Amz-Credential`, `X-Amz-Security-Token`, `AWSAccessKeyId`, `Signature`,\n * `sig` and `X-Goog-Signature`.\n * A custom list replaces the defaults. Matching uses `isRedactedName`.\n * Redaction leaves request URLs and parameter values unchanged. `Redacted`\n * values are redacted regardless of this list.\n *\n * @stability unstable\n * @category services\n * @since 4.0.0\n */\nexport const CurrentRedactedNames = /*#__PURE__*/Context.Reference(\"effect/http/UrlParams/CurrentRedactedNames\", {\n defaultValue: () => [\"X-Amz-Signature\", \"X-Amz-Credential\", \"X-Amz-Security-Token\", \"AWSAccessKeyId\", \"Signature\", \"sig\", \"X-Goog-Signature\"]\n});\n//# sourceMappingURL=UrlParams.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 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 const annotationExcludedKeys = /*#__PURE__*/new Set([SENTINELS_ANNOTATION_KEY, STRUCTURAL_ANNOTATION_KEY, \"representation\", \"arbitraryConstraint\", \"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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 filter first, then on the inner\n * issue.\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 * @stability stable\n * @category formatting\n * @since 4.0.0\n */\nexport const defaultCheckHook = issue => findMessage(issue) ?? findMessage(issue.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 * @stability stable\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 getFilterMessage(issue, checkHook) {\n const message = checkHook(issue);\n if (message !== undefined || issue.issue._tag !== \"InvalidValue\") return message;\n const expected = findExpected(issue.issue);\n return expected === undefined ? getExpectedMessage(formatCheck(issue.filter), issue) : getExpectedMessage(expected, issue.issue);\n}\nfunction toDefaultIssues(issue, path, leafHook, checkHook, messageOverride) {\n switch (issue._tag) {\n case \"Filter\":\n return toDefaultIssues(issue.issue, path, leafHook, checkHook, messageOverride ?? getFilterMessage(issue, checkHook));\n case \"Encoding\":\n return toDefaultIssues(issue.issue, path, leafHook, checkHook, messageOverride);\n case \"Pointer\":\n return toDefaultIssues(issue.issue, [...path, ...issue.path], leafHook, checkHook, messageOverride);\n case \"Composite\":\n case \"AnyOf\":\n {\n if (issue._tag === \"Composite\" || issue.issues.length > 0) {\n return issue.issues.flatMap(issue => toDefaultIssues(issue, path, leafHook, checkHook, messageOverride));\n }\n return [{\n path,\n message: messageOverride ?? findMessage(issue) ?? getExpectedMessage(InternalAnnotations.getExpected(issue.ast), issue)\n }];\n }\n default:\n return [{\n path,\n message: messageOverride ?? 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 * @stability stable\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, messageOverride) {\n let message;\n switch (issue._tag) {\n case \"Filter\":\n return formatIssue(issue.issue, path, messageOverride ?? getFilterMessage(issue, defaultCheckHook));\n case \"Encoding\":\n return formatIssue(issue.issue, path, messageOverride);\n case \"Pointer\":\n return formatIssue(issue.issue, path + formatPath(issue.path), messageOverride);\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, messageOverride)).join(\"\\n\");\n }\n message = messageOverride ?? findMessage(issue) ?? getExpectedMessage(InternalAnnotations.getExpected(issue.ast), issue);\n break;\n }\n default:\n message = messageOverride ?? defaultLeafHook(issue);\n break;\n }\n return path ? `${message}\\n at ${path}` : message;\n}\nfunction findMessage(issue) {\n // A Composite's ast describes the whole schema, not the failures it groups.\n if (issue._tag === \"Pointer\" || issue._tag === \"Composite\") 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 * @stability stable\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 Base64 from \"./encoding/Base64.js\";\nimport * as Base64Url from \"./encoding/Base64Url.js\";\nimport * as Hex from \"./encoding/Hex.js\";\nimport { dual } from \"./Function.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\";\nconst runGetter = (self, input, options) => {\n switch (self._tag) {\n case \"Passthrough\":\n return Effect.succeed(input);\n case \"Transform\":\n return Effect.succeed(Option.map(input, self.transform));\n case \"TransformOptional\":\n return Effect.succeed(self.transform(input));\n case \"TransformEffect\":\n return Option.isNone(input) ? Effect.succeedNone : Effect.mapEager(self.transform(input.value, options), Option.some);\n case \"TransformOptionalEffect\":\n return self.transform(input, options);\n }\n};\n/**\n * Runs a getter directly.\n *\n * **Details**\n *\n * This is a convenience API for executing a getter outside a schema. When the\n * getter belongs to a schema, use the corresponding `SchemaParser` API. The\n * result is an `Effect` for every getter variant, including synchronous ones.\n *\n * **Example** (Running a getter)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const getter = SchemaGetter.transform<number, string>(Number)\n *\n * const result = Effect.runSync(\n * SchemaGetter.run(getter, Option.some(\"42\"), {})\n * )\n * result // => Option.some(42)\n * ```\n *\n * @stability stable\n * @category converting\n * @since 4.0.0\n */\nexport const run = /*#__PURE__*/dual(3, runGetter);\nconst makeGetter = fields => Object.assign(Object.create(Pipeable.Prototype), fields);\nconst composeOptionalEffect = (first, second) => transformOptionalEffect((input, options) => Effect.flatMapEager(runGetter(first, input, options), output => runGetter(second, output, options)));\n/**\n * Composes two getters by passing the output of the first to the second.\n *\n * **When to use**\n *\n * Use when a schema conversion requires multiple transformation steps.\n *\n * **Details**\n *\n * Composition forwards `Option.none()` to getters that handle optional values\n * and skips getters that operate only on present values. Composing with\n * {@link passthrough} returns the other getter unchanged. The function supports\n * both `compose(first, second)` and `first.pipe(compose(second))`.\n *\n * **Example** (Parsing and normalizing a number)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const getter = SchemaGetter.compose(\n * SchemaGetter.transform<number, string>(Number),\n * SchemaGetter.transform((n) => Math.max(0, n))\n * )\n *\n * Effect.runSync(SchemaGetter.run(getter, Option.some(\"-1\"), {})) // => Option.some(0)\n * ```\n *\n * @stability stable\n * @category combining\n * @since 4.0.0\n */\nexport const compose = /*#__PURE__*/dual(2, (self, other) => {\n if (self._tag === \"Passthrough\") return other;\n if (other._tag === \"Passthrough\") return self;\n switch (self._tag) {\n case \"Transform\":\n {\n switch (other._tag) {\n case \"Transform\":\n return transform(input => other.transform(self.transform(input)));\n case \"TransformOptional\":\n return transformOptional(input => other.transform(Option.map(input, self.transform)));\n case \"TransformEffect\":\n return transformEffect((input, options) => other.transform(self.transform(input), options));\n case \"TransformOptionalEffect\":\n return composeOptionalEffect(self, other);\n }\n }\n case \"TransformOptional\":\n {\n switch (other._tag) {\n case \"Transform\":\n return transformOptional(input => Option.map(self.transform(input), other.transform));\n case \"TransformOptional\":\n return transformOptional(input => other.transform(self.transform(input)));\n case \"TransformEffect\":\n case \"TransformOptionalEffect\":\n return composeOptionalEffect(self, other);\n }\n }\n case \"TransformEffect\":\n {\n switch (other._tag) {\n case \"Transform\":\n return transformEffect((input, options) => Effect.mapEager(self.transform(input, options), other.transform));\n case \"TransformOptional\":\n case \"TransformOptionalEffect\":\n return composeOptionalEffect(self, other);\n case \"TransformEffect\":\n return transformEffect((input, options) => Effect.flatMapEager(self.transform(input, options), output => other.transform(output, options)));\n }\n }\n case \"TransformOptionalEffect\":\n return composeOptionalEffect(self, other);\n }\n});\n/**\n * Maps the output of a getter while preserving missing values.\n *\n * **When to use**\n *\n * Use to add a synchronous transformation after an existing getter.\n *\n * **Details**\n *\n * The mapping function runs only for `Option.some`. The function supports both\n * `map(self, f)` and `self.pipe(map(f))`.\n *\n * **Example** (Mapping a getter result)\n *\n * ```ts import.meta.vitest\n * import { Effect, Option, SchemaGetter } from \"effect\"\n *\n * const getter = SchemaGetter.transform<number, string>(Number).pipe(\n * SchemaGetter.map((n) => n * 2)\n * )\n *\n * Effect.runSync(SchemaGetter.run(getter, Option.some(\"21\"), {})) // => Option.some(42)\n * ```\n *\n * @stability stable\n * @category mapping\n * @since 4.0.0\n */\nexport const map = /*#__PURE__*/dual(2, (self, f) => compose(self, transform(f)));\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 * Effect.runSync(SchemaGetter.run(alwaysZero, 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 * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nexport function succeed(t) {\n return transformOptional(() => Option.some(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(\n * Effect.flip(SchemaGetter.run(rejectAll, Option.some(\"x\"), {}))\n * )\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 * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nexport function fail(f) {\n return transformOptionalEffect((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(\n * Effect.flip(SchemaGetter.run(noEncode, Option.some(1), {}))\n * )\n * issue._tag // => \"Forbidden\"\n * ```\n *\n * @see {@link fail} to fail with a custom issue type\n *\n * @stability stable\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.run(SchemaGetter.forbiddenEncoding, Option.some(\"value\"), {}))\n * )\n * issue._tag // => \"Forbidden\"\n * ```\n *\n * @see {@link forbidden} for a forbidden getter with a custom message\n *\n * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nexport const forbiddenEncoding = /*#__PURE__*/forbidden(() => \"Encoding is not supported\");\nconst passthrough_ = /*#__PURE__*/makeGetter({\n _tag: \"Passthrough\"\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 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(\n * Effect.flip(SchemaGetter.run(mustExist, Option.none(), {}))\n * )\n * issue._tag // => \"MissingKey\"\n * ```\n *\n * @see {@link withDefault} to substitute a default for undefined values\n *\n * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function required(annotations) {\n return transformOptionalEffect(input => Option.isNone(input) ? Effect.fail(new SchemaIssue.MissingKey(annotations)) : Effect.succeed(input));\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(SchemaGetter.run(nonNegative, 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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function checkEffect(f) {\n return transformEffect((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(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 * @stability stable\n * @category transforming\n * @since 4.0.0\n */\nexport function transform(f) {\n return makeGetter({\n _tag: \"Transform\",\n transform: f\n });\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(SchemaGetter.run(safeParseInt, Option.some(\"42\"), {})) // => Option.some(42)\n * ```\n *\n * @see {@link transform} when transformation cannot fail\n * @see {@link transformOptionalEffect} when you need full `Option` control over the output\n *\n * @stability stable\n * @category transforming\n * @since 4.0.0\n */\nexport function transformEffect(f) {\n return makeGetter({\n _tag: \"TransformEffect\",\n transform: f\n });\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 * Effect.runSync(SchemaGetter.run(skipEmpty, 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 * @stability stable\n * @category transforming\n * @since 4.0.0\n */\nexport function transformOptional(f) {\n return makeGetter({\n _tag: \"TransformOptional\",\n transform: f\n });\n}\n/**\n * Creates a getter that effectfully transforms the full `Option`.\n *\n * @stability stable\n * @category transforming\n * @since 4.0.0\n */\nexport function transformOptionalEffect(f) {\n return makeGetter({\n _tag: \"TransformOptionalEffect\",\n transform: f\n });\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 * Effect.runSync(SchemaGetter.run(omitField, 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 * @stability stable\n * @category filtering\n * @since 4.0.0\n */\nexport function omit() {\n return transformOptional(() => Option.none());\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(SchemaGetter.run(withZero, Option.some(undefined), {})) // => Option.some(0)\n * ```\n *\n * @see {@link transformOptionalEffect} for custom effectful missing-key handling\n * @see {@link required} when absent input should fail instead of using a default\n *\n * @stability stable\n * @category transforming\n * @since 4.0.0\n */\nexport function withDefault(defaultValue) {\n return transformOptionalEffect(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 * Effect.runSync(SchemaGetter.run(toString, Option.some(42), {})) // => Option.some(\"42\")\n * ```\n *\n * @see {@link transform} for custom string conversions\n *\n * @stability stable\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 * Effect.runSync(SchemaGetter.run(toNumber, Option.some(\"42\"), {})) // => Option.some(42)\n * ```\n *\n * @see {@link transformEffect} for effectful or validated number parsing\n *\n * @stability stable\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 * Effect.runSync(SchemaGetter.run(toBool, Option.some(\"true\"), {})) // => Option.some(true)\n * ```\n *\n * @stability stable\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 * - Fails with `SchemaIssue.InvalidValue` if the input cannot be converted\n * (e.g. a non-numeric string or a non-integer number).\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 * Effect.runSync(SchemaGetter.run(toBigInt, Option.some(\"42\"), {})) // => Option.some(42n)\n * ```\n *\n * @stability stable\n * @category converting\n * @since 4.0.0\n */\nexport function BigInt() {\n return transformEffect((input, options) => {\n try {\n return Effect.succeed(globalThis.BigInt(input));\n } catch {\n return Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a value that can be converted to a bigint\"\n }, input, options));\n }\n });\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 = Effect.runSync(SchemaGetter.run(toDate, 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 * @stability stable\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 * Effect.runSync(SchemaGetter.run(trimmed, Option.some(\" hello \"), {})) // => Option.some(\"hello\")\n * ```\n *\n * @stability stable\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 * Effect.runSync(SchemaGetter.run(cap, Option.some(\"hello\"), {})) // => Option.some(\"Hello\")\n * ```\n *\n * @stability stable\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 * Effect.runSync(SchemaGetter.run(uncap, Option.some(\"Hello\"), {})) // => Option.some(\"hello\")\n * ```\n *\n * @stability stable\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 * Effect.runSync(SchemaGetter.run(toCamel, Option.some(\"user_name\"), {})) // => Option.some(\"userName\")\n * ```\n *\n * @see {@link camelToSnake} for the inverse operation\n *\n * @stability stable\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 * Effect.runSync(SchemaGetter.run(toSnake, Option.some(\"userName\"), {})) // => Option.some(\"user_name\")\n * ```\n *\n * @see {@link snakeToCamel} for the inverse operation\n *\n * @stability stable\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 * Effect.runSync(SchemaGetter.run(lower, Option.some(\"HELLO\"), {})) // => Option.some(\"hello\")\n * ```\n *\n * @see {@link toUpperCase} for the inverse operation\n *\n * @stability stable\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 * Effect.runSync(SchemaGetter.run(upper, Option.some(\"hello\"), {})) // => Option.some(\"HELLO\")\n * ```\n *\n * @see {@link toLowerCase} for the inverse operation\n *\n * @stability stable\n * @category transforming\n * @since 4.0.0\n */\nexport function toUpperCase() {\n return transform(Str.toUpperCase);\n}\nexport function parseJson(options) {\n return transformEffect((input, parseOptions) => Effect.try({\n try: () => 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 * const result = await Effect.runPromise(SchemaGetter.run(stringify, Option.some({ a: 1 }), {}))\n * result // => Option.some(\"{\\\"a\\\":1}\")\n * ```\n *\n * @see {@link parseJson} for the inverse operation\n *\n * @stability stable\n * @category encoding\n * @since 4.0.0\n */\nexport function stringifyJson(options) {\n return transformEffect((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 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 at the first `keyValueSeparator` (default `=`),\n * preserving the rest of the value. An empty `keyValueSeparator` uses the first\n * two characters as the key and value. Pairs without a `keyValueSeparator` or\n * with an empty key are skipped. Pairs with an empty value are skipped unless\n * `keepEmptyValues` is `true`, in which case the value is `\"\"`. When `trim` is\n * `true`, keys and values are trimmed before these checks.\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 * const result = Effect.runSync(SchemaGetter.run(parse, Option.some(\"a=1,b=2\"), {}))\n * result // => 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 * @stability stable\n * @category splitting\n * @since 4.0.0\n */\nexport function splitKeyValue(options) {\n const separator = options?.separator ?? \",\";\n const keyValueSeparator = options?.keyValueSeparator ?? \"=\";\n const trim = options?.trim ?? false;\n const keepEmptyValues = options?.keepEmptyValues ?? false;\n return transform(input => input.split(separator).reduce((acc, pair) => {\n let key;\n let value;\n if (keyValueSeparator === \"\") {\n key = pair.slice(0, 1);\n value = pair.slice(1, 2);\n } else {\n const index = pair.indexOf(keyValueSeparator);\n if (index === -1) return acc;\n key = pair.slice(0, index);\n value = pair.slice(index + keyValueSeparator.length);\n }\n if (trim) {\n key = key.trim();\n value = value.trim();\n }\n if (key === \"\" || value === \"\" && !keepEmptyValues) return acc;\n InternalRecord.assignProperty(acc, key, value);\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 * const result = Effect.runSync(SchemaGetter.run(join, Option.some({ a: \"1\", b: \"2\" }), {}))\n * result // => Option.some(\"a=1,b=2\")\n * ```\n *\n * @see {@link splitKeyValue} for the inverse operation\n *\n * @stability stable\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 * const result = Effect.runSync(SchemaGetter.run(splitComma, Option.some(\"a,b,c\"), {}))\n * result // => Option.some([\"a\", \"b\", \"c\"])\n * ```\n *\n * @see {@link splitKeyValue} when values are key-value pairs\n *\n * @stability stable\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 * const result = Effect.runSync(SchemaGetter.run(encode, Option.some(new Uint8Array([1, 2, 3])), {}))\n * result // => 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 * @stability stable\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeBase64() {\n return transform(Base64.encode);\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. The output is unpadded unless\n * `padding` is `true`.\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 * const result = Effect.runSync(SchemaGetter.run(encode, Option.some(new Uint8Array([251, 255])), {}))\n * result // => 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 * @stability stable\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeBase64Url(options) {\n return transform(options?.padding ? Base64Url.encodePadded : Base64Url.encode);\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 * const result = Effect.runSync(SchemaGetter.run(encode, Option.some(new Uint8Array([1, 2, 3])), {}))\n * result // => 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 * @stability stable\n * @category encoding\n * @since 4.0.0\n */\nexport function encodeHex() {\n return transform(Hex.encode);\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(SchemaGetter.run(decode, 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 * @stability stable\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeBase64() {\n return transformEffect((input, options) => Effect.mapErrorEager(Effect.fromResult(Base64.decode(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 * const result = await Effect.runPromise(SchemaGetter.run(decode, Option.some(\"aGVsbG8=\"), {}))\n * result // => Option.some(\"hello\")\n * ```\n *\n * @see {@link decodeBase64} to decode to `Uint8Array` instead\n * @see {@link encodeBase64} for the inverse operation\n *\n * @stability stable\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeBase64String() {\n return transformEffect((input, options) => Result.match(Base64.decodeString(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(SchemaGetter.run(decode, 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 * @stability stable\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeBase64Url() {\n return transformEffect((input, options) => Result.match(Base64Url.decode(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 * const result = await Effect.runPromise(SchemaGetter.run(decode, Option.some(\"aGVsbG8\"), {}))\n * result // => Option.some(\"hello\")\n * ```\n *\n * @see {@link decodeBase64Url} to decode to `Uint8Array` instead\n * @see {@link encodeBase64Url} for the inverse operation\n *\n * @stability stable\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeBase64UrlString() {\n return transformEffect((input, options) => Result.match(Base64Url.decodeString(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(SchemaGetter.run(decode, 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 * @stability stable\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeHex() {\n return transformEffect((input, options) => Result.match(Hex.decode(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 * const result = await Effect.runPromise(SchemaGetter.run(decode, Option.some(\"68656c6c6f\"), {}))\n * result // => Option.some(\"hello\")\n * ```\n *\n * @see {@link decodeHex} to decode to `Uint8Array` instead\n * @see {@link encodeHex} for the inverse operation\n *\n * @stability stable\n * @category decoding\n * @since 4.0.0\n */\nexport function decodeHexString() {\n return transformEffect((input, options) => Result.match(Hex.decodeString(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 * const result = Effect.runSync(SchemaGetter.run(encode, Option.some(\"hello world\"), {}))\n * result // => Option.some(\"hello%20world\")\n * ```\n *\n * @see {@link decodeUriComponent} for the inverse operation\n *\n * @stability stable\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 * const result = await Effect.runPromise(SchemaGetter.run(decode, Option.some(\"hello%20world\"), {}))\n * result // => Option.some(\"hello world\")\n * ```\n *\n * @see {@link encodeUriComponent} for the inverse operation\n *\n * @stability stable\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(\n * SchemaGetter.run(parseDate, Option.some(\"2024-01-01T00:00:00Z\"), {})\n * )\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 * @stability stable\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 * const result = Effect.runSync(SchemaGetter.run(decode, Option.some(formData), {}))\n * result // => 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 * @stability stable\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 = Effect.runSync(SchemaGetter.run(encode, 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 * @stability stable\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 * const result = Effect.runSync(SchemaGetter.run(decode, Option.some(params), {}))\n * result // => 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 * @stability stable\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 = Effect.runSync(SchemaGetter.run(encode, 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 * @stability stable\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 // Consume unmatched bracket runs too, avoiding repeated scans for a closing bracket.\n const replaced = bracketPath.replace(/\\[([^\\]\\r\\n\\u2028\\u2029]*)(\\])?/g, (match, content, closing) => closing ? `.${content}` : match);\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}\nconst MAX_ARRAY_HOLES = 20;\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 * - An indexed container becomes an array only when it has at most 20 holes\n * (missing indices below its highest index). Otherwise it is returned as an\n * object keyed by the index strings, so untrusted input such as\n * `a[4294967294]` cannot produce huge sparse arrays.\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 * @stability stable\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 // Indexed containers are built as plain objects so that large indices never\n // allocate sparse arrays, and are materialized once all entries are applied\n const indexed = new Map();\n bracketPathEntries.forEach(([key, value]) => {\n const tokens = bracketPathToTokens(key);\n let cur = out;\n for (let i = 0; i < tokens.length; i++) {\n const state = indexed.get(cur);\n // Resolve \"[]\" to the next index before handling leaves or containers\n const token = tokens[i] === \"\" && state !== undefined ? state.length : tokens[i];\n if (state !== undefined && typeof token === \"number\") {\n state.length = Math.max(state.length, token + 1);\n }\n const hasOwn = Object.hasOwn(cur, token);\n const current = hasOwn ? cur[token] : undefined;\n if (i === tokens.length - 1) {\n const currentState = indexed.get(current);\n if (currentState !== undefined) {\n InternalRecord.assignProperty(current, currentState.length++, value);\n } else if (duplicates.has(current)) {\n current.push(value);\n } else if (hasOwn) {\n const values = [current, 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 const shouldBeArray = typeof next === \"number\" || next === \"\";\n if (containers.has(current) && indexed.has(current) === shouldBeArray) {\n cur = current;\n } else {\n const container = {};\n containers.add(container);\n if (shouldBeArray) {\n indexed.set(container, {\n parent: cur,\n key: token,\n length: 0\n });\n }\n InternalRecord.assignProperty(cur, token, container);\n cur = container;\n }\n }\n }\n });\n // Children are created after their parents, so materializing in reverse\n // creation order replaces every nested container before its parent is copied\n for (const [builder, {\n key,\n length,\n parent\n }] of Array.from(indexed).reverse()) {\n // A later conflicting path may have replaced the container in its parent\n if (parent[key] === builder && length - Object.keys(builder).length <= MAX_ARRAY_HOLES) {\n InternalRecord.assignProperty(parent, key, Object.assign(new Array(length), builder));\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 * @stability stable\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","const ContentTypeId = /*#__PURE__*/Symbol.for(\"~effect/Schema/content\");\n/** @internal */\nexport function setContent(operation, content) {\n Object.defineProperty(operation, ContentTypeId, {\n value: content\n });\n return operation;\n}\n/** @internal */\nexport function getContent(operation) {\n return operation[ContentTypeId];\n}\n//# sourceMappingURL=content.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 * @stability stable\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 { dual } from \"./Function.js\";\nimport * as InternalContent from \"./internal/schema/content.js\";\nimport * as Option from \"./Option.js\";\nimport * as Pipeable from \"./Pipeable.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 * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nexport const Middleware = class extends Pipeable.Class {\n _tag = \"Middleware\";\n decode;\n encode;\n constructor(decode, encode) {\n super();\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 * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nexport const Transformation = class extends Pipeable.Class {\n [TypeId] = TypeId;\n _tag = \"Transformation\";\n decode;\n encode;\n constructor(decode, encode) {\n super();\n this.decode = decode;\n this.encode = encode;\n }\n flip() {\n return new Transformation(this.encode, this.decode);\n }\n};\n/**\n * Composes two schema transformations into a single bidirectional conversion.\n *\n * **When to use**\n *\n * Use when decoding and encoding require the same sequence of conversion\n * steps in opposite directions.\n *\n * **Details**\n *\n * Decoding applies `self.decode` followed by `other.decode`. Encoding applies\n * `other.encode` followed by `self.encode`. The function supports both\n * `composeTransformation(self, other)` and `composeTransformation(other)(self)`.\n *\n * **Example** (Trimming and lowercasing a string)\n *\n * ```ts import.meta.vitest\n * import { Schema, SchemaTransformation } from \"effect\"\n *\n * const transformation = SchemaTransformation.composeTransformation(\n * SchemaTransformation.trim(),\n * SchemaTransformation.toLowerCase()\n * )\n * const schema = Schema.String.pipe(Schema.decode(transformation))\n *\n * Schema.decodeUnknownSync(schema)(\" HELLO \") // => \"hello\"\n * ```\n *\n * @stability stable\n * @category combining\n * @since 4.0.0\n */\nexport const composeTransformation = /*#__PURE__*/dual(2, (self, other) => new Transformation(SchemaGetter.compose(self.decode, other.decode), SchemaGetter.compose(other.encode, self.encode)));\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 makeTransformation}\n *\n * @stability stable\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.makeTransformation({\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 * @stability stable\n * @category constructors\n * @since 3.10.0\n */\nexport const makeTransformation = 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 makeTransformation} — for transformations from existing Getters\n *\n * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * Lowercase snake_case values round-trip when single underscores separate the\n * segments and every segment after the first starts with a letter. A segment\n * that starts with a digit does not: `\"foo_2_bar\"` decodes to `\"foo2Bar\"`,\n * which encodes to `\"foo2_bar\"`.\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 `\"=\"`). Set `trim` to trim\n * keys and values, and `keepEmptyValues` to keep pairs with an empty value as\n * `\"\"` instead of skipping them (see {@link SchemaGetter.splitKeyValue}).\n * Encoding joins the record back into a string using the same separators. The\n * transformation is round-trippable when keys and values do not contain the\n * separators and, with `trim`, have no surrounding whitespace.\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability unstable\n * @category transforming\n * @since 4.0.0\n */\nexport const byteSizeFromString = /*#__PURE__*/transformEffect({\n decode: (input, options) => Option.match(ByteSize.fromString(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 * @stability unstable\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 * @stability unstable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 or its scale is\n * outside ±10,000. Encoding returns `BigDecimal.format(bd)`.\n *\n * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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.fromJsonString` 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 * @stability stable\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 * @stability stable\n * @category decoding\n * @since 4.0.0\n */\nexport function fromJsonString(options) {\n return new Transformation(SchemaGetter.parseJson(options ?? {}), InternalContent.setContent(SchemaGetter.stringifyJson(options), {\n mediaType: \"application/json\",\n preserveSchema: options?.reviver === undefined && options?.replacer === undefined\n }));\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\n * @category guards\n * @since 3.10.0\n */\nexport const isSuspend = /*#__PURE__*/makeGuard(\"Suspend\");\n/**\n * Constructs a {@link Link}.\n *\n * @stability stable\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 * @stability stable\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 * @stability stable\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 // Keep this declaration's initialization errors outside its callback catch.\n run ??= this.run(this.typeParameters);\n try {\n return run(input, this, options);\n } catch (error) {\n return Effect.die(error);\n }\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 * @stability stable\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 * @stability stable\n * @category constants\n * @since 4.0.0\n */\nnull_ as null };\n/**\n * Constructs a {@link Undefined}.\n *\n * @stability stable\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 * @stability stable\n * @category constants\n * @since 4.0.0\n */\nundefined_ as undefined };\n/**\n * Constructs a {@link Void}.\n *\n * @stability stable\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 * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nvoid_ as void };\n/**\n * Constructs a {@link Never}.\n *\n * @stability stable\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 * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nexport const never = /*#__PURE__*/new Never();\n/**\n * Constructs a {@link Any}.\n *\n * @stability stable\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 * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nexport const any = /*#__PURE__*/new Any();\n/**\n * Constructs a {@link Unknown}.\n *\n * @stability stable\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 * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nexport const unknown = /*#__PURE__*/new Unknown();\n/**\n * Constructs a {@link ObjectKeyword}.\n *\n * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nexport const string = /*#__PURE__*/new String();\n/**\n * Constructs a {@link Number}.\n *\n * @stability stable\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 * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nexport const number = /*#__PURE__*/new Number();\n/**\n * Constructs a {@link Boolean}.\n *\n * @stability stable\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 * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nexport const boolean = /*#__PURE__*/new Boolean();\n/**\n * Constructs a {@link Symbol}.\n *\n * @stability stable\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 * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nexport const symbol = /*#__PURE__*/new Symbol();\n/**\n * Constructs a {@link BigInt}.\n *\n * @stability stable\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 * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nexport const bigInt = /*#__PURE__*/new BigInt();\n/**\n * Constructs a {@link Arrays}.\n *\n * @stability stable\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, compileField = 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 const finish = state => {\n const {\n input,\n len,\n options\n } = state;\n if (ast.rest.length === 0 && len > elementLen) {\n for (let i = elementLen; i < len; i++) {\n const unexpected = new 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 Effect.fail(new SchemaIssue.Composite(ast, [issue], input, options));\n }\n }\n }\n if (state.issues) {\n return Effect.fail(new SchemaIssue.Composite(ast, state.issues, input, options));\n }\n return InternalParser.succeed(state.output);\n };\n const parse = (input, options) => {\n const len = input.length;\n const state = {\n ast,\n getParser,\n input,\n len,\n tailThreshold: Math.max(elementLen, len - tailLen),\n output: [],\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) return finish(state);\n if (effectIsExit(eff)) return Effect.flatMapEager(eff, () => finish(state));\n // Reparse on later runs to avoid reusing mutable traversal state.\n let first = true;\n return Effect.suspend(() => {\n if (!first) return parse(input, options);\n first = false;\n return Effect.flatMap(eff, () => finish(state));\n });\n };\n return (input, options) => {\n if (input === InternalParser.missing) return InternalParser.missingExit;\n try {\n if (!Array.isArray(input)) {\n return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));\n }\n if (!elements) {\n elements = ast.elements.map(ast => ({\n ast,\n parser: compileField(ast)\n }));\n rest = ast.rest.map(ast => ({\n ast,\n parser: compileField(ast)\n }));\n }\n return parse(input, options);\n } catch (error) {\n return Effect.die(error);\n }\n };\n }\n _rebuild(recur, checks, encodingChecks) {\n const elements = mapOrSame(this.elements, recur);\n const rest = mapOrSame(this.rest, recur);\n return elements === this.elements && rest === this.rest && checks === this.checks && encodingChecks === this.encodingChecks ? this : new Arrays(this.isMutable, elements, rest, this.annotations, checks, 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};\n/** @internal */\nexport function stepArray(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}\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: stepArray\n};\n/** @internal */\nexport const 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 *\n * The mantissa alternation keeps rejection linear: `\\d*\\.?\\d+` retries\n * every split of a long digit run.\n * @internal\n */\nexport const FINITE_PATTERN = \"[+-]?(?:\\\\d+(?:\\\\.\\\\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 => Object.prototype.propertyIsEnumerable.call(input, 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 * @stability stable\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 * @stability stable\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) || type.encoding !== undefined && isOptional(toEncoded(type))) {\n throw new Error(\"Cannot use `Schema.optionalKey` or `Schema.optional` with index signatures. Index signatures already allow keys to be absent; use `Schema.UndefinedOr` to allow `undefined` values.\");\n }\n }\n};\n/**\n * Constructs a {@link Objects}.\n *\n * @stability stable\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 }\n /** @internal */\n getParser(compile, compileField = compile) {\n // oxlint-disable-next-line @typescript-eslint/no-this-alias\n const ast = this;\n const hasProperties = ast.propertySignatures.length;\n const indexCount = ast.indexSignatures.length;\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 compileMembers = () => {\n if (!properties) {\n properties = ast.propertySignatures.map(ps => ({\n parser: compileField(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: compileField(is.type)\n })) : undefined;\n }\n return properties;\n };\n const makeFallback = () => {\n const expectedKeys = new Set(ast.propertySignatures.map(ps => typeof ps.name === \"number\" ? globalThis.String(ps.name) : ps.name));\n const finishIndex = (s, key, k2, inputValue, exitValue) => {\n if (exitValue._tag === \"Failure\") {\n return wrapPropertyKeyIssue(s, ast, key, exitValue) ?? Exit.void;\n }\n const value = exitValue === InternalParser.sameExit ? inputValue : exitValue[InternalParser.args];\n if (k2 !== InternalParser.missing && value !== InternalParser.missing) {\n if (hasProperties && (expectedKeys.has(key) || expectedKeys.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 return 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 const coveredKeys = indexKeys ? new Set(expectedKeys) : expectedKeys;\n if (indexKeys) {\n for (const keys of indexKeys) {\n for (const key of keys) coveredKeys.add(key);\n }\n }\n // Only enumerable own properties can be excess. Declared fields are\n // parsed separately, regardless of their enumerability.\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) && Object.prototype.propertyIsEnumerable.call(record, 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 };\n if (indexCount) return makeFallback();\n let fallback;\n // Resumes at the property whose parser suspended, without replaying the\n // properties already parsed.\n const resume = (snapshot, index, pending) => {\n const property = properties[index];\n return Effect.flatMap(Effect.exit(pending), exit => {\n // Copy the parsed prefix per execution so reruns cannot overwrite earlier results.\n const state = {\n ...snapshot,\n out: {\n ...snapshot.out\n }\n };\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 ??= makeFallback())(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 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};\n/** @internal */\nexport function 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};\n/** @internal */\nexport const 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 for (const propertySignature of record.propertySignatures) {\n if (propertySignatures.some(ps => ps.name === propertySignature.name)) {\n throw new Error(`Duplicate identifier: ${JSON.stringify(propertySignature.name)}. ts(2300)`);\n }\n }\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 getRuntimeType = input => input === null ? \"null\" : Array.isArray(input) ? \"array\" : typeof input;\nconst hasPropertySignature = (input, key) => key === \"__proto__\" ? Object.hasOwn(input, key) : key in input;\n/** @internal */\nexport function getCandidateIndex(types) {\n let index = candidateIndexCache.get(types);\n if (index) return index;\n let bySentinel;\n let sentinelCandidateCount = 0;\n let otherwise;\n let literalCandidates;\n let onlyLiterals = true;\n const literalOf = [];\n for (let i = 0; i < types.length; i++) {\n const a = types[i];\n const encoded = toCandidate(a);\n if (isNever(encoded)) continue;\n if (isLiteral(encoded) || isUniqueSymbol(encoded)) {\n literalCandidates ??= new Map();\n const literal = isLiteral(encoded) ? encoded.literal : encoded.symbol;\n literalOf[i] = literal;\n let arr = literalCandidates.get(literal);\n if (!arr) literalCandidates.set(literal, arr = []);\n arr.push(i);\n } else {\n onlyLiterals = false;\n }\n const sentinels = collectSentinels(encoded);\n if (sentinels.length) {\n // 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 // Non-discriminated members are grouped by runtime type once and reused by every decode.\n const fallbacks = {};\n const getFallback = type => fallbacks[type] ??= Object.freeze(otherwise?.[type] ?? emptyCandidates);\n if (onlyLiterals && literalCandidates) {\n literalCandidates.forEach(Object.freeze);\n index = input => literalCandidates.get(input) ?? emptyCandidates;\n } else if (bySentinel?.size === 1 && !otherwise) {\n const [key, [byValue]] = bySentinel.entries().next().value;\n const candidates = new Map();\n for (const [literal, indexes] of byValue) {\n candidates.set(literal, Object.freeze(Array.from(indexes)));\n }\n const all = Object.freeze(types.map((_, i) => i));\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 all;\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 = getRuntimeType(input);\n if (!Predicate.isObjectKeyword(input)) return getFallback(runtimeType);\n // Non-discriminated candidates are runtime-type fallbacks and are never removed by sentinel checks.\n const selected = new Set(otherwise?.[runtimeType]);\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 getFallback(runtimeType);\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);\n };\n } else {\n index = input => {\n const fallback = getFallback(getRuntimeType(input));\n return literalCandidates ? fallback.filter(i => literalOf[i] === undefined || literalOf[i] === input) : fallback;\n };\n }\n candidateIndexCache.set(types, index);\n return index;\n}\n/**\n * Constructs a {@link Union}.\n *\n * @stability stable\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, compileField) {\n // oxlint-disable-next-line @typescript-eslint/no-this-alias\n const ast = this;\n const isConstructor = compileField !== undefined;\n const parsers = [];\n const parser = i => parsers[i] ??= compile(ast.types[i]);\n let index;\n return (input, options) => {\n if (input === InternalParser.missing) {\n return InternalParser.missingExit;\n }\n const candidates = (index ??= getCandidateIndex(ast.types))(input, isConstructor);\n if (candidates.length === 0) {\n return Effect.fail(new SchemaIssue.AnyOf(ast, [], input, options));\n }\n if (candidates.length === 1) {\n const result = parser(candidates[0])(input, options);\n if (result._tag === \"Success\") return result;\n return effectIsExit(result) ? failSingleUnionCandidate(ast, result.cause, input, options) : catchSingleUnionCandidate(ast, result, input, options);\n }\n return parseUnionCandidates(ast, parser, candidates, input, options);\n };\n }\n _rebuild(recur, checks, encodingChecks) {\n const types = mapOrSame(this.types, recur);\n return types === this.types && checks === this.checks && encodingChecks === this.encodingChecks ? this : new Union(types, this.options, this.annotations, checks, 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}\nfunction catchSingleUnionCandidate(ast, result, input, options) {\n return Effect.catchCause(result, cause => failSingleUnionCandidate(ast, cause, input, options));\n}\nfunction parseUnionCandidates(ast, parser, candidates, input, options) {\n const state = {\n ast,\n parser,\n input,\n out: 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 if (effectIsExit(eff)) return resumeUnion(eff, state);\n // Reparse on later runs to avoid reusing mutable traversal state.\n let first = true;\n return Effect.suspend(() => {\n if (!first) return parseUnionCandidates(ast, parser, candidates, input, options);\n first = false;\n return resumeUnion(eff, state);\n });\n}\nfunction resumeUnion(eff, state) {\n return Effect.flatMapEager(eff, _ => {\n if (state.out === InternalParser.sameExit) return Effect.succeed(state.input);\n if (state.out) return state.out;\n return Effect.fail(new SchemaIssue.AnyOf(state.ast, state.issues ?? [], state.input, state.options));\n });\n}\nconst parseUnion = /*#__PURE__*/iterateEager()({\n onItem(s, i) {\n return s.parser(i)(s.input, s.options);\n },\n step(s, i, 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(s.ast.types[i]);\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(s.ast.types[i]);\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 * @stability stable\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 * @stability stable\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 * @stability stable\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.check` 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. Unless\n * annotations provide `toJsonSchema`, the RegExp constraint is omitted from\n * JSON Schema export.\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 * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nexport function isPattern(regExp, annotations) {\n const copy = new globalThis.RegExp(regExp);\n const payload = {\n source: copy.source,\n flags: copy.flags\n };\n return makeFilter(s => {\n copy.lastIndex = 0;\n return copy.test(s);\n }, {\n expected: `a string matching the RegExp ${payload.source}`,\n representation: {\n id: \"effect/schema/isPattern\",\n payload\n },\n // Keep the filter exportable so its JSON Schema annotations are preserved\n // when the RegExp constraint itself is omitted.\n toJsonSchema: () => [{}, true],\n arbitraryConstraint: {\n patterns: [payload]\n },\n ...annotations\n });\n}\n// Copies that update only context or encoding share a body.\n// All other fields describe the body itself, including child contexts.\nconst bodyOwners = /*#__PURE__*/new WeakMap();\nfunction copy(ast, changes) {\n // AST copies preserve the prototype and enumerable values, not property descriptors.\n const out = Object.assign(Object.create(Object.getPrototypeOf(ast)), ast, changes);\n if (Reflect.ownKeys(changes).every(key => key === \"context\" || key === \"encoding\")) {\n bodyOwners.set(out, getContextOwner(ast));\n }\n return out;\n}\n/** @internal */\nexport function getContextOwner(ast) {\n const existing = bodyOwners.get(ast);\n if (existing !== undefined) return existing;\n if (ast.encoding === undefined) return ast;\n // A body representative must not expose or retain the node's own codec.\n const owner = Object.assign(Object.create(Object.getPrototypeOf(ast)), ast, {\n encoding: undefined\n });\n bodyOwners.set(ast, owner);\n return owner;\n}\n/** @internal */\nexport function replaceEncoding(ast, encoding) {\n return ast.encoding === encoding ? ast : copy(ast, {\n 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 && owner.encoding === ast.encoding) {\n return owner;\n }\n return copy(ast, {\n context\n });\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 copy(ast, {\n annotations: {\n ...ast.annotations,\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 copy(ast, {\n 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}\nexport function mapOrSame(as, f) {\n let out;\n for (let i = 0; i < as.length; i++) {\n const a = as[i];\n const fa = f(a);\n if (out) {\n out[i] = fa;\n } else if (fa !== a) {\n out = new Array(as.length);\n for (let j = 0; j < i; j++) {\n out[j] = as[j];\n }\n out[i] = fa;\n }\n }\n return 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 context = ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, defaultValue, ast.context.annotations) : new Context(false, false, defaultValue);\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 * @stability stable\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 addLiteral(literal) {\n if (!literals.includes(literal)) {\n literals.push(literal);\n }\n }\n function go(ast) {\n switch (ast._tag) {\n case \"Literal\":\n if (Predicate.isPropertyKey(ast.literal)) {\n addLiteral(ast.literal);\n }\n return;\n case \"UniqueSymbol\":\n addLiteral(ast.symbol);\n return;\n case \"Enum\":\n for (const [, value] of ast.enums) {\n addLiteral(value);\n }\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 * @stability stable\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}\nfunction canPreserveEncodingChecks(ast) {\n let preserve = true;\n function visit(child) {\n preserve = preserve && !child.encoding && !isSuspend(child);\n if (preserve && \"recur\" in child) child.recur(visit);\n return child;\n }\n if (\"recur\" in ast) ast.recur(visit);\n return preserve;\n}\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 * @stability stable\n * @category transforming\n * @since 4.0.0\n */\nexport const toType = /*#__PURE__*/memoizeIdempotent(ast => {\n const owner = getContextOwner(ast);\n if (owner !== ast) {\n const type = toType(owner);\n return type === owner && ast.encoding === undefined ? ast : replaceContext(type, ast.context);\n }\n const type = \"recur\" in ast ? ast.recur(toType) : ast;\n if (\"encodingChecks\" in type && type.encodingChecks) {\n const checks = canPreserveEncodingChecks(ast) ? type.encodingChecks : isArrays(type) || isObjects(type) || isDeclaration(type) && type.typeParameters.length > 0 ? extractStructuralChecks(type.encodingChecks) : undefined;\n return copy(type, {\n encodingChecks: undefined,\n checks: 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 * @stability stable\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.encodeEffect` — 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 * @stability stable\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 owner = getContextOwner(ast);\n if (owner !== ast) {\n const flipped = flip(owner);\n return flipped === owner ? ast : replaceContext(flipped, ast.context);\n }\n return \"flip\" in ast ? ast.flip(flip) : \"recur\" in ast ? ast.recur(flip) : ast;\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}\n/** @internal */\nexport const 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.annotate(...))`).\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 * @stability stable\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 * @stability stable\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.annotate({ identifier: \"...\" })`\n * and is used for error messages and schema identification.\n *\n * @see {@link resolve}\n * @see {@link resolveTitle}\n * @stability stable\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 * @stability stable\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 * @stability stable\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","import * as Cause from \"../../Cause.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as SchemaAST from \"../../SchemaAST.js\";\nimport * as SchemaIssue from \"../../SchemaIssue.js\";\nimport { effectIsExit } from \"../effect.js\";\nimport * as InternalParser from \"./parser.js\";\nconst flatMapTransformation = (result, current, f) => result === InternalParser.sameExit ? f(current) : Effect.flatMapEager(result, f);\nfunction compileTransformation(transformation) {\n const apply = compileTransformationUnsafe(transformation);\n return (result, current, options) => {\n try {\n return apply(result, current, options);\n } catch (error) {\n return Effect.die(error);\n }\n };\n}\nfunction compileTransformationUnsafe(transformation) {\n if (transformation._tag === \"Middleware\") {\n return (result, current, options) => {\n const transformed = result === InternalParser.sameExit ? transformation.decode(InternalParser.succeed(InternalParser.toOption(current)), options) : transformation.decode(Effect.mapEager(result, InternalParser.toOption), options);\n return fromOptionalEffect(transformed);\n };\n }\n const getter = transformation.decode;\n switch (getter._tag) {\n case \"Passthrough\":\n return (result, current) => result === InternalParser.sameExit ? InternalParser.succeed(current) : result;\n case \"Transform\":\n {\n const transform = value => value === InternalParser.missing ? InternalParser.missingExit : InternalParser.succeed(getter.transform(value));\n return (result, current) => flatMapTransformation(result, current, transform);\n }\n case \"TransformOptional\":\n {\n const transform = value => InternalParser.fromOptionExit(getter.transform(InternalParser.toOption(value)));\n return (result, current) => flatMapTransformation(result, current, transform);\n }\n case \"TransformEffect\":\n return (result, current, options) => flatMapTransformation(result, current, value => value === InternalParser.missing ? InternalParser.missingExit : getter.transform(value, options));\n case \"TransformOptionalEffect\":\n return (result, current, options) => flatMapTransformation(result, current, value => fromOptionalEffect(getter.transform(InternalParser.toOption(value), options)));\n }\n}\nconst fromOptionalEffect = effect => Effect.flatMapEager(effect, InternalParser.fromOptionExit);\n/** @internal */\nexport const wrapEncoding = (ast, input, options, effect) => Effect.catchCause(effect, cause => Effect.failCauseSync(() => Cause.map(cause, issue => new SchemaIssue.Encoding(ast, issue, input, options))));\nfunction makeConstructorParser(descriptor, compile) {\n const transform = compileTransformation(descriptor.link.transformation);\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 transform(result, input, options);\n };\n}\nfunction withDefault(ast, parser) {\n const defaultValue = ast.context.constructorDefault;\n return (input, options) => {\n if (input !== InternalParser.missing && input !== undefined) return parser(input, options);\n const result = defaultValue;\n if (effectIsExit(result) && result._tag === \"Success\") {\n const local = parser(result[InternalParser.args], options);\n return local === InternalParser.sameExit ? result : local;\n }\n return Effect.flatMapEager(wrapEncoding(ast, input, options, result), value => {\n const local = parser(value, options);\n return local === InternalParser.sameExit ? InternalParser.succeed(value) : local;\n });\n };\n}\n/** @internal */\nexport function compileField(ast, compile) {\n const parser = compile(ast);\n return ast.context?.constructorDefault === undefined ? parser : withDefault(ast, parser);\n}\n/** @internal */\nexport function compile(ast, compile, compileField, base, specialize) {\n if (ast._tag === \"Declaration\") {\n // Declaration callbacks can create public parsers for their type parameters.\n // Register those ASTs with the same resolver before invoking the callback.\n for (const parameter of ast.typeParameters) compile(parameter);\n }\n // Construction supplies compileField for parent-owned defaults. Its presence\n // also selects the constructor semantics of declarations and Unions.\n const descriptor = compileField ? SchemaAST.getConstructorDescriptor(ast) : undefined;\n const parser = descriptor ? makeConstructorParser(descriptor, compile) : base ?? ast.getParser(compile, compileField);\n const checks = ast.checks;\n const links = ast.encoding;\n const transformations = links?.map(link => compileTransformation(link.transformation));\n const encodingChecks = ast.encodingChecks;\n if (!links && !checks && !encodingChecks) {\n return parser;\n }\n let encodingParsers;\n const parseChecks = (input, options) => {\n // Keep lazy child compilation outside the callback exception boundary.\n let result = parser(input, options);\n try {\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 } catch (error) {\n return Effect.die(error);\n }\n };\n const parseLocal = specialize === undefined ? parseChecks : specialize(parseChecks);\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 = transformations[i](result, current, 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 = wrapEncoding(ast, input, options, result);\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=interpreter.js.map","import * as Effect from \"../../Effect.js\";\nimport * as Interpreter from \"./interpreter.js\";\nimport * as InternalParser from \"./parser.js\";\n/** @internal */\nexport const invalid = /*#__PURE__*/Symbol();\nconst cache = /*#__PURE__*/new WeakMap();\nlet compiler;\n/** @internal */\nexport let compilerAdaptersEnabled = false;\nfunction activateCompilerAdapters() {\n compilerAdaptersEnabled = true;\n}\nconst decodeChild = ast => compilerAdaptersEnabled ? lazyParser(resolve, ast, \"parser\") : resolve(ast).parser;\nconst makeChild = ast => compilerAdaptersEnabled ? lazyParser(resolve, ast, \"makeEffect\") : resolve(ast).makeEffect;\nconst makeField = ast => Interpreter.compileField(ast, makeChild);\nclass InterpretedEntry {\n ast;\n constructor(ast) {\n this.ast = ast;\n }\n get decodeEffect() {\n return this.cachedDecodeEffect ??= Interpreter.compile(this.ast, decodeChild);\n }\n get parser() {\n return this.decodeEffect;\n }\n get makeEffect() {\n return this.cachedMakeEffect ??= Interpreter.compile(this.ast, makeChild, makeField);\n }\n}\nclass CompilerEntry extends InterpretedEntry {\n compiled;\n resolve;\n constructor(ast, compiled, resolve) {\n super(ast);\n this.compiled = compiled;\n this.resolve = resolve;\n }\n save(key, value) {\n Object.defineProperty(this, key, {\n value\n });\n return value;\n }\n operation(key) {\n const compiled = this.compiled;\n return typeof compiled === \"function\" ? compiled(this.ast, this.resolve, key) : compiled?.[key];\n }\n get is() {\n return this.save(\"is\", this.operation(\"is\"));\n }\n get decode() {\n return this.save(\"decode\", this.operation(\"decode\"));\n }\n get make() {\n return this.save(\"make\", this.operation(\"make\"));\n }\n get compiledMakeEffect() {\n return this.save(\"compiledMakeEffect\", this.operation(\"makeEffect\"));\n }\n get decodeEffect() {\n return this.save(\"decodeEffect\", this.operation(\"decodeEffect\") ?? Interpreter.compile(this.ast, ast => lazyParser(this.resolve, ast, \"parser\")));\n }\n get parser() {\n const decode = this.decode;\n return decode === undefined ? this.decodeEffect : this.save(\"parser\", withDecode(decode, () => this.decodeEffect));\n }\n get makeEffect() {\n const makeEffect = this.compiledMakeEffect;\n if (makeEffect !== undefined) return this.save(\"makeEffect\", makeEffect);\n const child = ast => lazyParser(this.resolve, ast, \"makeEffect\");\n return this.save(\"makeEffect\", Interpreter.compile(this.ast, child, ast => Interpreter.compileField(ast, child)));\n }\n}\n/** @internal */\nexport function withDecode(fastDecode, decodeEffect) {\n let detailed;\n return (input, options) => {\n if (input !== InternalParser.missing) {\n try {\n const value = fastDecode(input, options);\n if (value !== invalid) return value === input ? InternalParser.sameExit : InternalParser.succeed(value);\n } catch (error) {\n return Effect.die(error);\n }\n }\n return (detailed ??= decodeEffect())(input, options);\n };\n}\n/** @internal */\nexport function lazyParser(resolve, ast, operation) {\n const entry = resolve(ast);\n if (entry.compiled === undefined || Object.hasOwn(entry, operation)) {\n return entry[operation];\n }\n let parser;\n return (input, options) => (parser ??= entry[operation])(input, options);\n}\n/** @internal */\nexport function resolve(ast) {\n const cached = cache.get(ast);\n if (cached !== undefined) return cached;\n const entry = compiler === undefined ? new InterpretedEntry(ast) : new CompilerEntry(ast, compiler(ast, resolve), resolve);\n cache.set(ast, entry);\n return entry;\n}\n/** @internal */\nexport function set(ast, decoder, resolveChild = resolve) {\n if (decoder !== undefined) activateCompilerAdapters();\n const entry = new CompilerEntry(ast, decoder, resolveChild);\n cache.set(ast, entry);\n return entry;\n}\n/** @internal */\nexport function setCompiler(ast, compile, resolveChild = resolve) {\n activateCompilerAdapters();\n const entry = new CompilerEntry(ast, compile, resolveChild);\n cache.set(ast, entry);\n return entry;\n}\n/** @internal */\nexport function install(compile) {\n activateCompilerAdapters();\n compiler = compile;\n}\n/** @internal */\nexport function enable(ast, compile) {\n activateCompilerAdapters();\n const scoped = child => {\n const cached = cache.get(child);\n return cached !== undefined && (cached.compiled !== undefined || cached.resolve === scoped) ? cached : set(child, compile(child, scoped), scoped);\n };\n const decoder = compile(ast, scoped);\n const cached = cache.get(ast);\n if (decoder !== undefined || cached?.compiled === undefined) {\n set(ast, decoder, scoped);\n }\n}\n//# sourceMappingURL=compilerRegistry.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 * @stability stable\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 { effectIsExit } from \"./internal/effect.js\";\nimport * as InternalSchemaCause from \"./internal/schema/cause.js\";\nimport * as CompilerRegistry from \"./internal/schema/compilerRegistry.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 * @stability stable\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 * @stability stable\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 * @stability stable\n * @category constructors\n * @since 4.0.0\n */\nexport function make(schema) {\n return makeConstructorSync(SchemaAST.toType(schema.ast));\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 * @stability stable\n * @category guards\n * @since 3.10.0\n */\nexport function is(schema) {\n return _is(schema.ast);\n}\nfunction makeIs(ast) {\n if (!CompilerRegistry.compilerAdaptersEnabled) {\n const parser = asExit(run(ast));\n return input => {\n const exit = parser(input, SchemaAST.defaultParseOptions);\n if (Exit.isSuccess(exit)) return true;\n InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, \"Type guard adapter can only return false for schema issues\");\n return false;\n };\n }\n const entry = CompilerRegistry.resolve(ast);\n const guard = entry.is;\n if (guard !== undefined) {\n return input => {\n try {\n return guard(input, SchemaAST.defaultParseOptions);\n } catch (error) {\n InternalSchemaCause.getSchemaIssueOrThrow(Cause.die(error), \"Type guard adapter can only return false for schema issues\");\n return false;\n }\n };\n }\n const parser = entry.parser;\n return input => {\n const exit = Effect.runSyncExit(parserResult(parser(input, SchemaAST.defaultParseOptions), input));\n if (Exit.isSuccess(exit)) return true;\n InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, \"Type guard adapter can only return false for schema issues\");\n return false;\n };\n}\n/** @internal */\nexport function _is(ast) {\n const typeAST = SchemaAST.toType(ast);\n let guard = input => {\n guard = makeIs(typeAST);\n return guard(input);\n };\n return input => {\n return guard(input);\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 * @stability stable\n * @category guards\n * @since 4.0.0\n */\nexport function asserts(schema, input) {\n const ast = SchemaAST.toType(schema.ast);\n const result = CompilerRegistry.resolve(ast).parser(input, SchemaAST.defaultParseOptions);\n const exit = Effect.runSyncExit(parserResult(result, input));\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\n * @category decoding\n * @since 3.10.0\n */\nexport function decodeUnknownSync(schema, options) {\n return CompilerRegistry.compilerAdaptersEnabled ? makeSync(schema.ast, options) : 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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\n * @category encoding\n * @since 3.10.0\n */\nexport function encodeUnknownSync(schema, options) {\n return CompilerRegistry.compilerAdaptersEnabled ? makeSync(SchemaAST.flip(schema.ast), options) : 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 * @stability stable\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 parserResult(result, input) {\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}\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 makeSync(ast, options) {\n let run;\n return (input, overrideOptions) => (run ??= makeSyncEntry(CompilerRegistry.resolve(ast), options))(input, overrideOptions);\n}\nfunction makeSyncEntry(entry, options) {\n const decode = entry.decode;\n let detailed;\n const run = decode === undefined ? (input, parseOptions = SchemaAST.defaultParseOptions) => (detailed ??= makeDetailedSync(entry))(input, parseOptions) : (input, parseOptions = SchemaAST.defaultParseOptions) => {\n if (input === InternalParser.missing) {\n return (detailed ??= makeDetailedSync(entry))(input, parseOptions);\n }\n let output;\n try {\n output = decode(input, parseOptions);\n } catch (error) {\n InternalSchemaCause.getSchemaIssueOrThrow(Cause.die(error), \"Sync adapter can only throw schema issues\");\n throw error;\n }\n if (output !== CompilerRegistry.invalid) return output;\n return (detailed ??= makeDetailedSync(entry))(input, parseOptions);\n };\n return options === undefined ? run : (input, overrideOptions) => run(input, mergeParseOptions(options, overrideOptions));\n}\nfunction makeDetailedSync(entry) {\n return asSync(runWithCompiler(() => entry.decodeEffect, entry.ast));\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}\nfunction runSync(effect, message) {\n const exit = Effect.runSyncExit(effect);\n if (Exit.isSuccess(exit)) {\n return exit.value;\n }\n const issue = InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, message);\n throw new Error(\"Schema validation failed\", {\n cause: issue\n });\n}\nconst constructorDefectMessage = \"Constructor adapter can only throw schema issues\";\nfunction throwConstructorDefect(error) {\n throw new Error(constructorDefectMessage, {\n cause: Cause.die(error)\n });\n}\nfunction makeConstructorSync(ast) {\n let entry;\n return (input, options) => constructSync(entry ??= CompilerRegistry.resolve(ast), input, options);\n}\nfunction constructSync(entry, input, options) {\n const parseOptions = options?.disableChecks ? options.parseOptions ? {\n ...options.parseOptions,\n disableChecks: true\n } : {\n disableChecks: true\n } : options?.parseOptions ?? SchemaAST.defaultParseOptions;\n const make = entry.make;\n if (make !== undefined && input !== InternalParser.missing) {\n let output;\n try {\n output = make(input, parseOptions);\n } catch (error) {\n throwConstructorDefect(error);\n }\n if (output !== CompilerRegistry.invalid && output !== InternalParser.missing) return output;\n }\n return runSync(parserResult(entry.makeEffect(input, parseOptions), input), constructorDefectMessage);\n}\n/**\n * Constructs a class instance from its type-side declaration.\n *\n * When the declaration has no compiled constructor, the fields are validated first\n * and the instance is built outside the parser, so stacks captured by the\n * class constructor keep the caller's frames.\n *\n * @internal\n */\nexport function makeClassSync(ast, input, options, construct) {\n const entry = CompilerRegistry.resolve(ast);\n const descriptor = SchemaAST.getConstructorDescriptor(ast);\n if (descriptor === undefined || entry.make !== undefined || entry.compiledMakeEffect !== undefined) {\n return constructSync(entry, input, options);\n }\n if (descriptor.isConstructed(input)) return input;\n const fields = constructSync((entry.resolve ?? CompilerRegistry.resolve)(descriptor.link.to), input, options);\n try {\n return construct(fields);\n } catch (error) {\n throwConstructorDefect(error);\n }\n}\nconst normalCompiler = ast => CompilerRegistry.resolve(ast).parser;\nconst constructorCompiler = ast => CompilerRegistry.resolve(ast).makeEffect;\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 RebuildOptions = /*#__PURE__*/Symbol();\nconst SchemaProto = {\n [TypeId]: TypeId,\n get make() {\n const value = SchemaParser.make(this);\n Object.defineProperty(this, \"make\", {\n value,\n enumerable: true\n });\n return value;\n },\n get makeEffect() {\n const value = SchemaParser.makeEffect(this);\n Object.defineProperty(this, \"makeEffect\", {\n value,\n enumerable: true\n });\n return value;\n },\n get makeOption() {\n const value = SchemaParser.makeOption(this);\n Object.defineProperty(this, \"makeOption\", {\n value,\n enumerable: true\n });\n return value;\n },\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 rebuild(ast) {\n return make(ast, this[RebuildOptions]);\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[RebuildOptions] = options;\n self.ast = ast;\n return self;\n}\n//# sourceMappingURL=make.js.map","/** @internal */\nexport function getSubschemaKind(keyword) {\n switch (keyword) {\n case \"$defs\":\n case \"properties\":\n case \"patternProperties\":\n case \"dependentSchemas\":\n return \"map\";\n case \"allOf\":\n case \"anyOf\":\n case \"oneOf\":\n case \"prefixItems\":\n return \"array\";\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 return \"schema\";\n }\n}\n//# sourceMappingURL=jsonSchema.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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\n * @since 4.0.0\n */\nimport * as InternalJsonSchema from \"./internal/jsonSchema.js\";\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 specifies that `nullable` applies only when the same Schema\n * Object has an explicit string `type`. For compatibility with tooling that\n * uses a single-member `allOf` for nullable references, this converter also\n * rewrites `{ nullable: true, allOf: [schema] }` to\n * `{ anyOf: [schema, { type: \"null\" }] }` when there is no string `type` or\n * existing `anyOf`. Sibling constraints such as `enum` remain unchanged and\n * may still reject null.\n *\n * 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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 (InternalJsonSchema.getSubschemaKind(key)) {\n case \"map\":\n transformed = mapObject(value, value => walk(value, inEmbeddedResource)) ?? value;\n break;\n case \"array\":\n transformed = Array.isArray(value) ? value.map(value => walk(value, inEmbeddedResource)) : value;\n break;\n case \"schema\":\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 case \"enum\":\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 if (Array.isArray(source.enum) && source.enum.length === 0) appendAllOf(out, {\n not: {}\n });\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 const nullableAllOf = isOpenApi30NullableAllOf(source);\n for (const key of Object.keys(source)) {\n const value = source[key];\n if (nullableAllOf && key === \"allOf\") {\n InternalRecord.assignProperty(out, \"anyOf\", [context.schemaAt(source.allOf[0], [\"allOf\", \"0\"], [\"anyOf\", \"0\"]), {\n type: \"null\"\n }]);\n continue;\n }\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 isOpenApi30NullableAllOf(source) {\n return source.nullable === true && typeof source.type !== \"string\" && source.anyOf === undefined && Array.isArray(source.allOf) && source.allOf.length === 1;\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 (InternalJsonSchema.getSubschemaKind(key)) {\n case \"map\":\n if (Predicate.isObject(value) && Object.values(value).some(hasSchemaIdentifier)) return true;\n break;\n case \"array\":\n if (Array.isArray(value) && value.some(hasSchemaIdentifier)) return true;\n break;\n case \"schema\":\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 { identity, memoize, memoizeIdempotent } from \"../../Function.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as SchemaAST from \"../../SchemaAST.js\";\nimport * as SchemaGetter from \"../../SchemaGetter.js\";\nimport * as SchemaParser from \"../../SchemaParser.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__*/makeCodecDerivation(toCodecJsonASTStep);\nfunction makeCodecDerivation(step, options) {\n // Derive each body once, independently of its own context. Child contexts remain part of the body.\n const deriveBody = memoize(owner => {\n const body = SchemaAST.replaceContext(owner, undefined);\n const out = step(body, recur);\n return out === body ? null : out;\n });\n // Follow existing encodings before sharing bodies: their encoded forms may differ.\n const recur = SchemaAST.applyToSelfOrLastLinkEncodingIdempotent(ast => {\n const derived = deriveBody(SchemaAST.getContextOwner(ast));\n if (derived === null) return ast;\n const out = SchemaAST.replaceContext(derived, ast.context);\n return ast.context === undefined ? out : SchemaAST.replaceContextLastLink(out, withoutConstructorDefault(ast.context));\n }, options);\n return recur;\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 const sortedTypes = [...types].sort((a, b) => getPriority(SchemaAST.toEncoded(a)) - getPriority(SchemaAST.toEncoded(b)));\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__*/makeCodecDerivation((ast, recur) => toCodecStringTreeASTStep(ast, recur, ast => {\n throw new globalThis.Error(\"Missing structural codec for StringTree\", {\n cause: ast\n });\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});\n/** @internal */\nexport function toCodecGoJson(schema) {\n return InternalMake.make(toCodecGoJsonAST(schema.ast), {\n schema\n });\n}\n// Keep the canonical member first to preserve accepted nulls and union branch\n// selection. Added members (`never`, `[]`, `{}`) do not widen the decoded type.\nconst toCodecGoJsonAST = /*#__PURE__*/memoizeIdempotent(ast => nilAsEmptyAtEncoded(goNilAST(toCodecJsonAST(ast))));\nconst goNilAST = /*#__PURE__*/SchemaAST.applyToSelfOrLastLinkEncodingIdempotent(ast => {\n switch (ast._tag) {\n case \"Objects\":\n return ast.recur(type => nilAsMissingOrEmptyAtEncoded(goNilAST(type)), identity);\n case \"Arrays\":\n return ast.recur(type => nilAsEmptyAtEncoded(goNilAST(type)));\n case \"Declaration\":\n case \"Union\":\n case \"Suspend\":\n return ast.recur(goNilAST);\n }\n return ast;\n});\nconst nilAsMissingOrEmptyAtEncoded = /*#__PURE__*/SchemaAST.applyToSelfOrLastLinkEncoding(ast => SchemaAST.isOptional(ast) ? nilAsMissingAtEncoded(ast) : nilAsEmptyAtEncoded(ast));\nconst nilAsMissingAtEncoded = /*#__PURE__*/SchemaAST.applyToSelfOrLastLinkEncoding(ast => {\n if (SchemaAST.isSuspend(ast)) return ast.recur(nilAsMissingAtEncoded);\n if (isGoNil(ast) || acceptsNull(ast)) return ast;\n return orNull(ast, decodeNull(SchemaAST.never, nullAsMissing));\n});\n// Only a plain `Schema.Array` or `Schema.Record` can be a Go slice or map, so\n// tuples, non-empty arrays, and structs keep rejecting `null`. The empty value\n// still has to pass the collection's checks.\nconst nilAsEmptyAtEncoded = /*#__PURE__*/SchemaAST.applyToSelfOrLastLinkEncoding(ast => {\n if (SchemaAST.isSuspend(ast)) return ast.recur(nilAsEmptyAtEncoded);\n if (SchemaAST.isArrays(ast) && ast.elements.length === 0 && ast.rest.length === 1) {\n return orNull(ast, decodeNull(SchemaAST.replaceChecks(emptyArray, ast.checks), nullAsEmptyArray));\n }\n if (SchemaAST.isObjects(ast) && ast.propertySignatures.length === 0 && ast.indexSignatures.length > 0) {\n return orNull(ast, decodeNull(SchemaAST.replaceChecks(emptyRecord, ast.checks), nullAsEmptyRecord));\n }\n return ast;\n});\n// Only skips the `null` member when the schema certainly accepts `null`, to\n// keep the JSON Schema tidy. Suspended schemas are not resolved, so recursive\n// definitions stay lazy.\nfunction acceptsNull(ast) {\n const encoded = SchemaAST.getLastEncoding(ast);\n switch (encoded._tag) {\n case \"Union\":\n return encoded.checks === undefined && encoded.types.some(acceptsNull);\n case \"Null\":\n case \"Unknown\":\n case \"Any\":\n case \"Declaration\":\n return SchemaParser.is(InternalMake.make(SchemaAST.replaceContext(encoded, undefined)))(null);\n }\n return false;\n}\nfunction orNull(ast, member) {\n return SchemaAST.replaceContext(new SchemaAST.Union([SchemaAST.replaceContext(ast, undefined), member]), ast.context);\n}\nconst nullTo = decode => new InternalTransformation.Transformation(decode, SchemaGetter.forbidden(() => \"Go nil values are never encoded\"));\nconst nullAsMissing = /*#__PURE__*/nullTo(/*#__PURE__*/SchemaGetter.transformOptional(() => Option.none()));\nconst nullAsEmptyArray = /*#__PURE__*/nullTo(/*#__PURE__*/SchemaGetter.transform(() => []));\nconst nullAsEmptyRecord = /*#__PURE__*/nullTo(/*#__PURE__*/SchemaGetter.transform(() => ({})));\nconst emptyArray = /*#__PURE__*/new SchemaAST.Arrays(false, [], []);\nconst emptyRecord = /*#__PURE__*/SchemaAST.record(SchemaAST.string, SchemaAST.never);\nfunction decodeNull(to, transformation) {\n return SchemaAST.decodeTo(SchemaAST.null, to, transformation);\n}\n// A union this codec already built, so applying it again changes nothing.\nfunction isGoNil(ast) {\n if (!SchemaAST.isUnion(ast)) return false;\n const transformation = ast.types[ast.types.length - 1].encoding?.[0].transformation;\n return transformation === nullAsMissing || transformation === nullAsEmptyArray || transformation === nullAsEmptyRecord;\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 for (const key of [\"title\", \"description\", \"format\", \"contentEncoding\", \"contentMediaType\"]) {\n const value = annotations[key];\n if (typeof value === \"string\") out[key] = value;\n }\n for (const key of [\"readOnly\", \"writeOnly\"]) {\n const value = annotations[key];\n if (typeof value === \"boolean\") out[key] = value;\n }\n const expected = annotations.expected;\n if (out.description === undefined && options?.generateDescriptions === true && typeof expected === \"string\") {\n out.description = expected;\n }\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 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// Every bound on one schema object applies, so a repeated bound reduces to its tighter value.\nconst lowerBoundKeywords = \"|minimum|exclusiveMinimum|minLength|minItems|minProperties|\";\nconst upperBoundKeywords = \"|maximum|exclusiveMaximum|maxLength|maxItems|maxProperties|\";\n// Tightens repeated bounds and drops an inclusive or exclusive bound implied by the other on the same side. Returns\n// `undefined` for a `$ref` schema or a non-bound collision, so the caller falls back to `allOf`.\nfunction mergeInlineCheck(left, right, rightKeys) {\n if (typeof left.$ref === \"string\") return undefined;\n const out = {\n ...left,\n ...right\n };\n for (const key of rightKeys) {\n if (!Object.hasOwn(left, key)) continue;\n const a = left[key];\n const b = right[key];\n if (typeof a !== \"number\" || typeof b !== \"number\") return undefined;\n if (lowerBoundKeywords.includes(`|${key}|`)) out[key] = Math.max(a, b);else if (upperBoundKeywords.includes(`|${key}|`)) out[key] = Math.min(a, b);else return undefined;\n }\n if (typeof out.minimum === \"number\" && typeof out.exclusiveMinimum === \"number\") {\n delete out[out.exclusiveMinimum >= out.minimum ? \"minimum\" : \"exclusiveMinimum\"];\n }\n if (typeof out.maximum === \"number\" && typeof out.exclusiveMaximum === \"number\") {\n delete out[out.exclusiveMaximum <= out.maximum ? \"maximum\" : \"exclusiveMaximum\"];\n }\n return out;\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) {\n const merged = mergeInlineCheck(left, right, rightKeys);\n if (merged !== undefined) return merged;\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 isExact(exactness, seen = new Set()) {\n if (typeof exactness === \"boolean\") return exactness;\n if (seen.has(exactness)) return true;\n seen.add(exactness);\n return exactness.every(dependency => isExact(dependency, seen));\n}\nfunction isApproximateCheckOutput(output) {\n return Array.isArray(output);\n}\nfunction compileJsonSchema(representations, rootPaths, references, options) {\n const numberKeyPattern = `^(?:${InternalAST.FINITE_PATTERN}|Infinity|-Infinity|NaN)$`;\n const compiledDefinitions = new Map();\n const definitionAliases = new Map();\n const compiledRepresentations = new WeakMap();\n const pendingOneOf = new Map();\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 compiledSchemas = Arr.map(representations, (representation, index) => recur(representation, rootPaths[index], []));\n for (const {\n branches,\n schemas\n } of pendingOneOf.values()) {\n if (!isExact(branches)) {\n for (const schema of schemas) {\n if (Array.isArray(schema.oneOf)) {\n schema.anyOf = schema.oneOf;\n delete schema.oneOf;\n }\n }\n }\n }\n for (const key of referenceKeys) {\n const representation = references[key];\n const fallback = getIdentifierFallback(representation);\n if (fallback === undefined) continue;\n const schema = compiledDefinitions.get(key).schema;\n const candidates = fallbackDefinitions.get(fallback);\n const match = candidates?.find(candidate => Equal.equals(compiledDefinitions.get(candidate).schema, schema));\n if (match === undefined) {\n if (candidates === undefined) fallbackDefinitions.set(fallback, [key]);else candidates.push(key);\n } else {\n definitionAliases.set(key, match);\n }\n }\n const schemas = Arr.map(compiledSchemas, finalizeJsonSchema);\n const definitions = {};\n for (const key of referenceKeys) {\n if (!definitionAliases.has(key)) {\n InternalRecord.assignProperty(definitions, key, finalizeJsonSchema(compiledDefinitions.get(key).schema));\n }\n }\n return {\n dialect: \"draft-2020-12\",\n schemas,\n definitions\n };\n function registerPendingOneOf(schema) {\n if (Array.isArray(schema.oneOf)) pendingOneOf.get(schema.oneOf)?.schemas.push(schema);\n return schema;\n }\n function compileAnnotatedMember(member, path, dependencies) {\n const schema = recur(member.type, [...path, \"type\"], dependencies);\n const annotations = collectJsonSchemaAnnotations(member.annotations, options);\n return annotations === undefined ? schema : registerPendingOneOf(appendJsonSchema(schema, annotations));\n }\n function compileDefinition(key, path) {\n if (!Object.hasOwn(references, key)) {\n throw errorWithPath(`Invalid reference ${key}`, [...path, \"$ref\"]);\n }\n const cached = compiledDefinitions.get(key);\n if (cached !== undefined) return cached;\n // Register the dependency cell before compiling so recursive references share it.\n const result = {\n schema: {},\n dependencies: []\n };\n compiledDefinitions.set(key, result);\n result.schema = recur(references[key], [\"references\", key], result.dependencies);\n return result;\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 = definitionAliases.get(unescapeToken(pointer.slice(7, separator < 0 ? undefined : separator)));\n if (canonical === undefined) 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 compileCheck(check, type, path, dependencies) {\n const annotations = check.annotations;\n const callback = annotations?.toJsonSchema;\n if (callback !== undefined) {\n const schemas = check.representation?.schemas?.map((schema, index) => recur(schema, [...path, \"representation\", \"schemas\", index], dependencies)) ?? [];\n const result = callback({\n type,\n schemas\n });\n const approximate = isApproximateCheckOutput(result);\n if (approximate) {\n dependencies.push(false);\n }\n const fragment = approximate ? result[0] : result;\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 [schema, check._tag === \"Filter\" && hasOnlyKeywords(schema, allowed) && (ordinary === undefined || hasOnlyKeywords(ordinary, promotableAnnotationKeywords)) ? true : undefined];\n }\n if (check._tag === \"Filter\") {\n dependencies.push(false);\n return undefined;\n }\n const schemas = check.checks.flatMap((child, index) => {\n const result = compileCheck(child, type, [...path, \"checks\", index], dependencies);\n return result === undefined ? [] : [result[0]];\n });\n if (schemas.length === 0) return undefined;\n const ordinary = collectJsonSchemaAnnotations(annotations, options);\n const schema = {\n allOf: schemas\n };\n return [ordinary === undefined ? schema : {\n ...schema,\n ...ordinary\n }];\n }\n function recur(representation, path, dependencies) {\n if (representation._tag === \"Reference\") {\n dependencies.push(compileDefinition(representation.$ref, path).dependencies);\n return {\n $ref: formatDefinitionReference(representation.$ref)\n };\n }\n const cached = compiledRepresentations.get(representation);\n if (cached !== undefined) {\n dependencies.push(cached.dependencies);\n return cached.schema;\n }\n const local = [];\n dependencies.push(local);\n let output = {\n ...on(representation, path, local),\n ...collectJsonSchemaAnnotations(representation.annotations, options)\n };\n if (representation._tag === \"String\" && representation.content !== undefined) {\n const content = representation.content;\n output.contentMediaType = content.mediaType;\n delete output.contentSchema;\n if (content.schema !== undefined) {\n output.contentSchema = recur(content.schema, [...path, \"content\", \"schema\"], []);\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], local);\n if (check !== undefined) output = appendJsonSchema(output, ...check);\n }\n compiledRepresentations.set(representation, {\n schema: output,\n dependencies: local\n });\n return registerPendingOneOf(output);\n }\n function on(representation, path, dependencies) {\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 dependencies.push(false);\n return {};\n case \"Suspend\":\n return recur(representation.thunk, [...path, \"thunk\"], dependencies);\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]) => ({\n type: typeof literal,\n enum: [literal],\n title\n }));\n return types.length === 0 ? {\n not: {}\n } : {\n anyOf: types\n };\n }\n case \"TemplateLiteral\":\n {\n const {\n exact,\n pattern\n } = getTemplateLiteralPattern(representation.parts);\n if (!exact) dependencies.push(false);\n return {\n type: \"string\",\n pattern\n };\n }\n case \"Arrays\":\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 return compileAnnotatedMember(element, [...path, \"elements\", index], dependencies);\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], dependencies);\n if (Object.keys(rest).length > 0) out.items = rest;else delete out.items;\n } else if (representation.rest.length > 1) {\n delete out.maxItems;\n delete out.items;\n out.minItems = minItems + representation.rest.length - 1;\n dependencies.push(false);\n }\n return out;\n }\n case \"Objects\":\n return compileObjects(representation, path, dependencies);\n case \"Union\":\n {\n const branches = [];\n const types = representation.types.map((type, index) => recur(type, [...path, \"types\", index], branches));\n dependencies.push(branches);\n if (types.length === 0) return {\n not: {}\n };\n if (representation.options?.mode === \"oneOf\") {\n pendingOneOf.set(types, {\n branches,\n schemas: []\n });\n return {\n oneOf: types\n };\n }\n if (types.length > 1) {\n const compacted = compactEnums(types);\n if (compacted !== undefined) return compacted;\n }\n // A member that is only an `anyOf` adds no constraints of its own, so its alternatives can be spliced in.\n return {\n anyOf: types.flatMap(type => Array.isArray(type.anyOf) && Object.keys(type).length === 1 ? type.anyOf : [type])\n };\n }\n }\n }\n function compileObjects(representation, path, dependencies) {\n const {\n indexSignatures,\n propertySignatures\n } = representation;\n if (propertySignatures.length === 0 && indexSignatures.length === 0) return {\n not: {\n type: \"null\"\n }\n };\n const out = {\n type: \"object\"\n };\n const properties = {};\n const required = [];\n for (const [index, property] of propertySignatures.entries()) {\n const propertyPath = [...path, \"propertySignatures\", index];\n if (typeof property.name !== \"string\") {\n throw errorWithPath(\"Objects property names must be strings\", [...propertyPath, \"name\"]);\n }\n InternalRecord.assignProperty(properties, property.name, compileAnnotatedMember(property, propertyPath, dependencies));\n if (!property.isOptional) required.push(property.name);\n }\n if (propertySignatures.length > 0) out.properties = properties;\n if (required.length > 0) out.required = required;\n const indexes = indexSignatures.map((signature, index) => {\n const indexPath = [...path, \"indexSignatures\", index];\n const schema = recur(signature.type, [...indexPath, \"type\"], dependencies);\n const type = Equal.equals(schema, {\n not: {}\n }) ? false : schema;\n const patterns = getParameterPatterns(signature.parameter, [...indexPath, \"parameter\"], new Set());\n if (patterns === undefined) dependencies.push(false);\n return {\n type,\n patterns\n };\n });\n const patternProperties = {};\n for (const {\n patterns,\n type\n } of indexes) {\n for (const pattern of patterns ?? []) {\n const previous = patternProperties[pattern];\n InternalRecord.assignProperty(patternProperties, pattern, previous === undefined ? type : previous === false || type === false ? false : registerPendingOneOf(appendJsonSchema(previous, type)));\n }\n }\n const hasPatternProperties = Object.keys(patternProperties).length > 0;\n if (hasPatternProperties) out.patternProperties = patternProperties;\n const additionalPropertySchemas = indexes.filter(({\n patterns\n }) => patterns?.length === 0).map(({\n type\n }) => type);\n const hasUnrepresentableIndexPattern = indexes.some(({\n patterns\n }) => patterns === undefined);\n if (hasUnrepresentableIndexPattern && options?.onExcessProperty === \"error\") {\n const propertyNames = [];\n if (propertySignatures.length > 0) propertyNames.push({\n enum: Object.keys(properties)\n });\n for (const [index, signature] of indexSignatures.entries()) {\n propertyNames.push(getPropertyNameSchema(signature.parameter, [...path, \"indexSignatures\", index, \"parameter\"], dependencies, new Set()));\n }\n out.propertyNames = propertyNames.length === 1 ? propertyNames[0] : {\n anyOf: propertyNames\n };\n const values = indexes.map(({\n type\n }) => type);\n out.additionalProperties = values.length === 1 ? values[0] : {\n anyOf: values\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 && propertySignatures.length === 0 && !hasPatternProperties) {\n out.additionalProperties = additionalPropertySchemas[0];\n } else {\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 function getPropertyNameSchema(parameter, path, dependencies, seenReferences) {\n switch (parameter._tag) {\n case \"Number\":\n return {\n type: \"string\",\n pattern: numberKeyPattern\n };\n case \"Reference\":\n {\n if (seenReferences.has(parameter.$ref)) return {\n type: \"string\"\n };\n return getPropertyNameSchema(references[parameter.$ref], [\"references\", parameter.$ref], dependencies, new Set(seenReferences).add(parameter.$ref));\n }\n case \"Union\":\n return {\n anyOf: parameter.types.map(type => getPropertyNameSchema(type, path, dependencies, seenReferences))\n };\n default:\n return recur(parameter, path, dependencies);\n }\n }\n function getParameterPatterns(parameter, path, seenReferences) {\n switch (parameter._tag) {\n case \"Reference\":\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 dependencies = [];\n const schema = recur(parameter, path, dependencies);\n if (!isExact(dependencies)) return undefined;\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 {\n if (parameter.checks.length > 0) return undefined;\n const {\n exact,\n pattern\n } = getTemplateLiteralPattern(parameter.parts);\n return exact ? [pattern] : undefined;\n }\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 case \"Number\":\n return parameter.checks.length === 0 ? [numberKeyPattern] : undefined;\n default:\n throw errorWithPath(`Invalid index signature parameter ${parameter._tag}`, path);\n }\n }\n function getTemplateLiteralPattern(parts) {\n const activeReferences = new Set();\n let exact = true;\n const pattern = `^${parts.map(getPartPattern).join(\"\")}$`;\n return {\n pattern,\n exact\n };\n function getPartPattern(part) {\n // A segment check cannot generally be embedded in the enclosing pattern, even when it has a JSON Schema exporter.\n if (part._tag !== \"Reference\" && part.checks.length > 0) exact = false;\n switch (part._tag) {\n case \"Reference\":\n {\n if (!Object.hasOwn(references, part.$ref)) {\n throw errorWithPath(`Invalid reference ${part.$ref}`, []);\n }\n if (activeReferences.has(part.$ref)) {\n throw errorWithPath(`Invalid recursive TemplateLiteral part ${part.$ref}`, []);\n }\n activeReferences.add(part.$ref);\n const pattern = getPartPattern(references[part.$ref]);\n activeReferences.delete(part.$ref);\n return pattern;\n }\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 \"BigInt\":\n return \"-?\\\\d+\";\n case \"TemplateLiteral\":\n return part.parts.map(getPartPattern).join(\"\");\n case \"Union\":\n if (part.types.length === 0) return \"(?!)\";\n // Regex alternatives do not enforce that exactly one branch matches.\n if (part.options?.mode === \"oneOf\") exact = false;\n return `(?:${part.types.map(getPartPattern).join(\"|\")})`;\n default:\n throw errorWithPath(`Invalid TemplateLiteral part ${part._tag}`, []);\n }\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}\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\";\nimport * as InternalContent from \"./content.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 usedReferences = new Set();\n const candidates = new Map();\n for (const ast of asts) visit(ast);\n const referencePolicy = options?.referencePolicy ?? defaultReferencePolicy;\n for (const variants of candidates.values()) {\n for (const candidate of variants) {\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, separator);\n } else if (candidate.isRecursive) {\n candidate.reference = getReference(`${candidate.ast._tag}_`, \"\");\n }\n }\n }\n const representations = Arr.map(asts, recur);\n return {\n representations,\n references\n };\n function getReference(prefix, separator) {\n let candidate = prefix;\n let suffix = 0;\n while (usedReferences.has(candidate)) {\n candidate = `${prefix}${separator}${++suffix}`;\n }\n usedReferences.add(candidate);\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 getCandidate(input, encodingLength = input.encoding?.length ?? 0) {\n let ast = input;\n let content;\n while (ast.encoding !== undefined && encodingLength > 0) {\n const last = ast.encoding[encodingLength - 1];\n // Only retain content when this operation produces the final string.\n if (last.to.encoding === undefined && last.to._tag === \"String\") {\n const metadata = InternalContent.getContent(last.transformation.encode);\n if (metadata !== undefined) {\n content = {\n mediaType: metadata.mediaType,\n schema: metadata.preserveSchema ? getCandidate(ast, encodingLength - 1) : undefined\n };\n }\n }\n ast = last.to;\n encodingLength = ast.encoding?.length ?? 0;\n }\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 variants = candidates.get(owner);\n if (variants === undefined) {\n variants = [];\n candidates.set(owner, variants);\n }\n let candidate = variants.find(candidate => candidate.identifier === identifier && candidate.content?.mediaType === content?.mediaType && candidate.content?.schema === content?.schema);\n if (candidate === undefined) {\n candidate = {\n ast: owner,\n identifier,\n fallback,\n content,\n occurrences: 0\n };\n variants.push(candidate);\n }\n return candidate;\n }\n function visit(input) {\n visitCandidate(getCandidate(input));\n return input;\n }\n function visitCandidate(candidate) {\n const ast = candidate.ast;\n candidate.occurrences++;\n if (candidate.visiting) {\n candidate.isRecursive = true;\n return;\n }\n if (candidate.occurrences > 1) return;\n candidate.visiting = true;\n if (candidate.content?.schema !== undefined) visitCandidate(candidate.content.schema);\n visitChecks(ast.checks);\n switch (ast._tag) {\n default:\n if (\"recur\" in ast) ast.recur(visit);\n break;\n case \"TemplateLiteral\":\n ast.parts.forEach(visit);\n break;\n case \"Suspend\":\n visit(ast.thunk());\n break;\n }\n candidate.visiting = false;\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 return recurCandidate(getCandidate(input));\n }\n function recurCandidate(candidate) {\n const ast = candidate.ast;\n const reference = candidate.reference;\n if (reference !== undefined) {\n if (!candidate.emitted) {\n candidate.emitted = true;\n const annotated = candidate.identifier === undefined ? ast : annotateReference(ast, candidate, reference);\n const representation = on(annotated, candidate.content);\n InternalRecord.assignProperty(references, reference, representation);\n }\n return {\n _tag: \"Reference\",\n $ref: reference\n };\n }\n return on(ast, candidate.content);\n }\n function on(ast, content) {\n const common = {\n checks: ast.checks?.map(fromCheck) ?? [],\n ...(ast._tag === \"Declaration\" ? fromAnnotations(ast.annotations) : annotationsField(ast.annotations))\n };\n switch (ast._tag) {\n case \"Declaration\":\n return {\n _tag: ast._tag,\n typeParameters: ast.typeParameters.map(recur),\n ...common\n };\n default:\n return {\n _tag: ast._tag,\n ...(content === undefined ? undefined : {\n content: {\n mediaType: content.mediaType,\n ...(content.schema === undefined ? undefined : {\n schema: recurCandidate(content.schema)\n })\n }\n }),\n ...common\n };\n case \"Literal\":\n return {\n _tag: ast._tag,\n literal: ast.literal,\n ...common\n };\n case \"UniqueSymbol\":\n return {\n _tag: ast._tag,\n symbol: ast.symbol,\n ...common\n };\n case \"Enum\":\n return {\n _tag: ast._tag,\n enums: ast.enums,\n ...common\n };\n case \"TemplateLiteral\":\n return {\n _tag: ast._tag,\n parts: ast.parts.map(recur),\n ...common\n };\n case \"Arrays\":\n return {\n _tag: ast._tag,\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(recur),\n ...common\n };\n case \"Objects\":\n return {\n _tag: ast._tag,\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 ...common\n };\n case \"Union\":\n return {\n _tag: ast._tag,\n types: ast.types.map(recur),\n ...(ast.options === undefined ? {} : {\n options: ast.options\n }),\n ...common\n };\n case \"Suspend\":\n return {\n _tag: ast._tag,\n ...common,\n checks: [],\n thunk: recur(ast.thunk())\n };\n }\n }\n function fromCheck(check) {\n return {\n ...(check._tag === \"Filter\" ? {\n _tag: check._tag,\n aborted: check.aborted\n } : {\n _tag: check._tag,\n checks: Arr.map(check.checks, fromCheck)\n }),\n ...fromAnnotations(check.annotations, true)\n };\n }\n function fromAnnotations(annotations, projectSchemas = false) {\n if (annotations === undefined) return undefined;\n const {\n representation,\n ...ordinary\n } = annotations;\n const projected = projectSchemas && representation?.schemas !== undefined ? {\n ...representation,\n schemas: representation.schemas.map(schema => recur(SchemaAST.toType(schema)))\n } : representation;\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * Joins and compares byte sequences stored in `Uint8Array` values.\n *\n * Byte-to-text conversions live in `TextEncoder` / `TextDecoder`, and hex or\n * base64 conversions live in the `Encoding` modules.\n *\n * @stability unstable\n * @since 4.0.6\n */\nimport * as Equ from \"./Equivalence.js\";\nimport * as order from \"./Order.js\";\n/**\n * Joins byte chunks into one new `Uint8Array`.\n *\n * **When to use**\n *\n * Use to combine frames, headers, or streamed chunks into a single buffer.\n *\n * **Gotchas**\n *\n * The result is always a new array, even when there is zero or one chunk, so\n * it never aliases an input.\n *\n * **Example** (Joining byte chunks)\n *\n * ```ts import.meta.vitest\n * import { Bytes } from \"effect\"\n *\n * const bytes = Bytes.concat([new Uint8Array([1, 2]), new Uint8Array([3])])\n * Array.from(bytes) // => [1, 2, 3]\n * ```\n *\n * @stability unstable\n * @category combinators\n * @since 4.0.6\n */\nexport const concat = chunks => {\n let length = 0;\n for (let i = 0; i < chunks.length; i++) {\n length += chunks[i].length;\n }\n const out = new Uint8Array(length);\n let offset = 0;\n for (let i = 0; i < chunks.length; i++) {\n out.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n return out;\n};\n/**\n * Compares byte sequences for equality, byte by byte.\n *\n * **Gotchas**\n *\n * This returns as soon as a byte differs, so it is not constant-time. Do not\n * use it to compare secrets.\n *\n * **Example** (Comparing byte sequences)\n *\n * ```ts import.meta.vitest\n * import { Bytes } from \"effect\"\n *\n * Bytes.Equivalence(new Uint8Array([1, 2]), new Uint8Array([1, 2])) // => true\n * Bytes.Equivalence(new Uint8Array([1, 2]), new Uint8Array([1])) // => false\n * ```\n *\n * @stability unstable\n * @category instances\n * @since 4.0.6\n */\nexport const Equivalence = /*#__PURE__*/Equ.make((self, that) => {\n if (self.length !== that.length) {\n return false;\n }\n for (let i = 0; i < self.length; i++) {\n if (self[i] !== that[i]) {\n return false;\n }\n }\n return true;\n});\n/**\n * Orders byte sequences lexicographically by unsigned byte value, placing a\n * prefix before any longer sequence that starts with it.\n *\n * **Example** (Sorting byte sequences)\n *\n * ```ts import.meta.vitest\n * import { Bytes } from \"effect\"\n *\n * Bytes.Order(new Uint8Array([1, 2]), new Uint8Array([1, 3])) // => -1\n * Bytes.Order(new Uint8Array([2]), new Uint8Array([1, 9])) // => 1\n * Bytes.Order(new Uint8Array([1]), new Uint8Array([1, 0])) // => -1\n * ```\n *\n * @stability unstable\n * @category instances\n * @since 4.0.6\n */\nexport const Order = /*#__PURE__*/order.make((self, that) => {\n const length = Math.min(self.length, that.length);\n for (let i = 0; i < length; i++) {\n if (self[i] !== that[i]) {\n return self[i] < that[i] ? -1 : 1;\n }\n }\n return self.length < that.length ? -1 : self.length > that.length ? 1 : 0;\n});\n//# sourceMappingURL=Bytes.js.map","import * as Bytes from \"../Bytes.js\";\nimport * as Data from \"../Data.js\";\nimport * as Equal from \"../Equal.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 { hasProperty, isTupleOf } from \"../Predicate.js\";\nimport * as Result from \"../Result.js\";\nconst TypeId = \"~effect/net/NetAddress\";\nconst MulticastTypeId = \"~effect/net/NetAddress/MulticastAddress\";\nconst UnicastTypeId = \"~effect/net/NetAddress/UnicastAddress\";\nconst BroadcastTypeId = \"~effect/net/NetAddress/BroadcastAddress\";\nconst LoopbackTypeId = \"~effect/net/NetAddress/LoopbackAddress\";\nconst LinkLocalTypeId = \"~effect/net/NetAddress/LinkLocalAddress\";\nconst UnspecifiedTypeId = \"~effect/net/NetAddress/UnspecifiedAddress\";\nconst PrivateTypeId = \"~effect/net/NetAddress/PrivateAddress\";\nconst UniqueLocalTypeId = \"~effect/net/NetAddress/UniqueLocalAddress\";\nconst LocallyAdministeredTypeId = \"~effect/net/NetAddress/LocallyAdministeredAddress\";\nconst UniversallyAdministeredTypeId = \"~effect/net/NetAddress/UniversallyAdministeredAddress\";\n// IPv4 addresses store one unsigned 32-bit number and IPv6 addresses store four\n// unsigned 32-bit words, most significant first. Allocating a typed array per\n// address is expensive on some runtimes, notably Deno.\nconst ipv4Value = self => self.value;\nconst ipv6Words = self => self;\nconst getMacBytes = self => self.bytes;\n/**\n * A checked network-address operation failure retaining the address or supplied input.\n *\n * **Details**\n *\n * Address-based operations retain the address value. Parsing and numeric\n * construction retain the supplied string or array. Composed operations forward\n * errors from the failing operation unchanged. Failures from external operations\n * retain the original exception in `cause` when available.\n *\n * @stability unstable\n * @category errors\n * @since 4.0.0\n */\nexport class NetAddressError extends /*#__PURE__*/Data.TaggedError(\"NetAddressError\") {}\nconst isAddress = u => hasProperty(u, TypeId);\n/**\n * Returns `true` when a value is an IPv4 address.\n *\n * @stability unstable\n * @category guards\n * @since 4.0.0\n */\nexport const isIpv4Address = u => isAddress(u) && u._tag === \"Ipv4Address\";\n/**\n * Returns `true` when a value is an IPv6 address.\n *\n * @stability unstable\n * @category guards\n * @since 4.0.0\n */\nexport const isIpv6Address = u => isAddress(u) && u._tag === \"Ipv6Address\";\n/**\n * Returns `true` when a value is an IPv4 or IPv6 address.\n *\n * @stability unstable\n * @category guards\n * @since 4.0.0\n */\nexport const isIpAddress = u => isIpv4Address(u) || isIpv6Address(u);\n/**\n * Returns the bit width of an IP address.\n *\n * @stability unstable\n * @category getters\n * @since 4.0.0\n */\nexport const width = address => isIpv4Address(address) ? 32 : 128;\n/**\n * Returns the family of an IP address or internet address.\n *\n * **Example** (Reading address families)\n *\n * ```ts import.meta.vitest\n * import { NetAddress } from \"effect/net\"\n *\n * NetAddress.familyOf(NetAddress.ipv4Loopback) // => \"IPv4\"\n * NetAddress.familyOf(NetAddress.inetAddressFromStringUnsafe(\"[::1]:80\")) // => \"IPv6\"\n * ```\n *\n * @stability experimental\n * @category getters\n * @since 4.0.0\n */\nexport const familyOf = self => isIpv4Address(self) || isInetAddressV4(self) ? \"IPv4\" : \"IPv6\";\n/**\n * Returns `true` when an IP address or internet address belongs to a family,\n * narrowing it to that family.\n *\n * @stability experimental\n * @category predicates\n * @since 4.0.0\n */\nexport const isFamily = /*#__PURE__*/dual(2, (self, family) => familyOf(self) === family);\n/**\n * Returns `true` when a value is a MAC address.\n *\n * @stability unstable\n * @category guards\n * @since 4.0.0\n */\nexport const isMacAddress = u => isAddress(u) && u._tag === \"MacAddress\";\n/**\n * Returns `true` when a value is a resolved IPv4 internet address.\n *\n * @stability unstable\n * @category guards\n * @since 4.0.0\n */\nexport const isInetAddressV4 = u => isAddress(u) && u._tag === \"InetAddressV4\";\n/**\n * Returns `true` when a value is a resolved IPv6 internet address.\n *\n * @stability unstable\n * @category guards\n * @since 4.0.0\n */\nexport const isInetAddressV6 = u => isAddress(u) && u._tag === \"InetAddressV6\";\n/**\n * Returns `true` when a value is a resolved internet address.\n *\n * @stability unstable\n * @category guards\n * @since 4.0.0\n */\nexport const isInetAddress = u => isInetAddressV4(u) || isInetAddressV6(u);\n/**\n * Returns `true` when a value is a Unix-domain filesystem address.\n *\n * @stability unstable\n * @category guards\n * @since 4.0.0\n */\nexport const isUnixPathAddress = u => isAddress(u) && u._tag === \"UnixPathAddress\";\n/**\n * Returns `true` when a value is a portable concrete socket address.\n *\n * @stability unstable\n * @category guards\n * @since 4.0.0\n */\nexport const isSocketAddress = u => isInetAddress(u) || isUnixPathAddress(u);\nconst Ipv4Proto = {\n ...Inspectable.BaseProto,\n _tag: \"Ipv4Address\",\n [TypeId]: TypeId,\n [Equal.symbol](that) {\n return isIpv4Address(that) && ipv4Value(this) === ipv4Value(that);\n },\n [Hash.symbol]() {\n return Hash.optimize(Hash.combine(ipv4HashSeed, ipv4Value(this) | 0));\n },\n toString() {\n return formatIp(this);\n },\n toJSON() {\n return this.toString();\n }\n};\nconst Ipv6Proto = {\n ...Inspectable.BaseProto,\n _tag: \"Ipv6Address\",\n [TypeId]: TypeId,\n [Equal.symbol](that) {\n if (!isIpv6Address(that)) return false;\n const self = ipv6Words(this);\n const other = ipv6Words(that);\n return self.w0 === other.w0 && self.w1 === other.w1 && self.w2 === other.w2 && self.w3 === other.w3;\n },\n [Hash.symbol]() {\n const self = ipv6Words(this);\n let h = Hash.combine(ipv6HashSeed, self.w0 | 0);\n h = Hash.combine(h, self.w1 | 0);\n h = Hash.combine(h, self.w2 | 0);\n return Hash.optimize(Hash.combine(h, self.w3 | 0));\n },\n toString() {\n return formatIp(this);\n },\n toJSON() {\n return this.toString();\n }\n};\nconst MacProto = {\n ...Inspectable.BaseProto,\n _tag: \"MacAddress\",\n [TypeId]: TypeId,\n [Equal.symbol](that) {\n return isMacAddress(that) && Bytes.Equivalence(getMacBytes(this), getMacBytes(that));\n },\n [Hash.symbol]() {\n return Hash.combine(macHashSeed, Hash.array(getMacBytes(this)));\n },\n toString() {\n return formatMacAddress(this);\n },\n toJSON() {\n return this.toString();\n }\n};\nconst ipv4HashSeed = /*#__PURE__*/Hash.string(\"Ipv4Address\");\nconst ipv6HashSeed = /*#__PURE__*/Hash.string(\"Ipv6Address\");\nconst macHashSeed = /*#__PURE__*/Hash.string(\"MacAddress\");\nconst makeIpv4 = value => {\n const self = Object.create(Ipv4Proto);\n self.value = value >>> 0;\n return Object.freeze(self);\n};\nconst makeIpv6 = (w0, w1, w2, w3) => {\n const self = Object.create(Ipv6Proto);\n self.w0 = w0 >>> 0;\n self.w1 = w1 >>> 0;\n self.w2 = w2 >>> 0;\n self.w3 = w3 >>> 0;\n return Object.freeze(self);\n};\nconst packOctets = (a, b, c, d) => (a << 24 | b << 16 | c << 8 | d) >>> 0;\nconst packBytes = (bytes, offset) => packOctets(bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3]);\nconst wordToOctets = word => [word >>> 24, word >>> 16 & 0xff, word >>> 8 & 0xff, word & 0xff];\nconst makeMac = bytes => {\n const self = Object.assign(Object.create(MacProto), {\n bytes: new Uint8Array(bytes)\n });\n return Object.freeze(self);\n};\n/**\n * Creates an IPv4 address from trusted network-order bytes without validation.\n *\n * @stability unstable\n * @category unsafe\n * @since 4.0.0\n */\nexport const ipv4FromBytesUnsafe = bytes => makeIpv4(packBytes(bytes, 0));\n/**\n * Creates an IPv6 address from trusted network-order bytes without validation.\n *\n * @stability unstable\n * @category unsafe\n * @since 4.0.0\n */\nexport const ipv6FromBytesUnsafe = bytes => makeIpv6(packBytes(bytes, 0), packBytes(bytes, 4), packBytes(bytes, 8), packBytes(bytes, 12));\n/**\n * The IPv4 loopback address `127.0.0.1`.\n *\n * @stability unstable\n * @category constants\n * @since 4.0.0\n */\nexport const ipv4Loopback = /*#__PURE__*/makeIpv4(0x7f000001);\n/**\n * The IPv6 loopback address `::1`.\n *\n * @stability unstable\n * @category constants\n * @since 4.0.0\n */\nexport const ipv6Loopback = /*#__PURE__*/makeIpv6(0, 0, 0, 1);\n/**\n * The loopback addresses `127.0.0.1` and `::1`.\n *\n * @stability unstable\n * @category constants\n * @since 4.0.0\n */\nexport const loopbackAddresses = [ipv4Loopback, ipv6Loopback];\n/**\n * The unspecified IPv4 address `0.0.0.0`.\n *\n * @stability unstable\n * @category constants\n * @since 4.0.0\n */\nexport const ipv4Unspecified = /*#__PURE__*/makeIpv4(0);\n/**\n * The unspecified IPv6 address `::`.\n *\n * @stability unstable\n * @category constants\n * @since 4.0.0\n */\nexport const ipv6Unspecified = /*#__PURE__*/makeIpv6(0, 0, 0, 0);\n/**\n * The IPv4 broadcast address `255.255.255.255`.\n *\n * @stability unstable\n * @category constants\n * @since 4.0.0\n */\nexport const ipv4Broadcast = /*#__PURE__*/makeIpv4(0xffffffff);\nconst addressError = (input, message) => Result.fail(new NetAddressError({\n input,\n message\n}));\n// Checks by index because `every` skips holes in sparse arrays.\nconst allIntegersInRange = (values, max) => {\n for (let i = 0; i < values.length; i++) {\n const n = values[i];\n if (!Number.isInteger(n) || n < 0 || n > max) return false;\n }\n return true;\n};\n/**\n * Creates an IPv4 address from four checked octets.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const ipv4FromOctets = octets => {\n if (!allIntegersInRange(octets, 255)) {\n return addressError(octets, \"octets must be integers from 0 through 255\");\n }\n return Result.succeed(makeIpv4(packOctets(octets[0], octets[1], octets[2], octets[3])));\n};\n/**\n * Creates an IPv6 address from eight checked 16-bit segments.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const ipv6FromSegments = segments => {\n if (!allIntegersInRange(segments, 0xffff)) {\n return addressError(segments, \"segments must be integers from 0 through 65535\");\n }\n return Result.succeed(makeIpv6(segments[0] * 0x10000 + segments[1], segments[2] * 0x10000 + segments[3], segments[4] * 0x10000 + segments[5], segments[6] * 0x10000 + segments[7]));\n};\n/**\n * Creates a MAC address from six checked octets.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const macAddressFromOctets = octets => {\n if (!allIntegersInRange(octets, 255)) {\n return addressError(octets, \"octets must be integers from 0 through 255\");\n }\n return Result.succeed(makeMac(new Uint8Array(octets)));\n};\n/**\n * Parses a colon-separated MAC address containing six two-digit hexadecimal octets.\n *\n * @stability unstable\n * @category decoding\n * @since 4.0.0\n */\nexport const macAddressFromString = input => {\n if (!/^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(input)) {\n return addressError(input, \"expected six two-digit hexadecimal octets separated by colons\");\n }\n return Result.succeed(makeMac(new Uint8Array(input.split(\":\").map(part => Number.parseInt(part, 16)))));\n};\n/**\n * Parses a trusted colon-separated MAC address, throwing on failure.\n *\n * @stability unstable\n * @category unsafe\n * @since 4.0.0\n */\nexport const macAddressFromStringUnsafe = input => Result.getOrThrow(macAddressFromString(input));\n/**\n * Converts a `MacAddressInput` to a MAC address, parsing strings like\n * `macAddressFromString`, checking octets like `macAddressFromOctets`, and\n * returning MAC addresses unchanged.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const macAddressFromInput = input => {\n if (isMacAddress(input)) return Result.succeed(input);\n if (typeof input === \"string\") return macAddressFromString(input);\n if (Array.isArray(input) && isTupleOf(input, 6)) return macAddressFromOctets(input);\n return addressError(input, \"expected a MAC address, string, or 6 octets\");\n};\n/**\n * Converts a trusted `MacAddressInput` to a MAC address, throwing on failure.\n *\n * @stability unstable\n * @category unsafe\n * @since 4.0.0\n */\nexport const macAddressFromInputUnsafe = input => Result.getOrThrow(macAddressFromInput(input));\n/**\n * Parses a strict dotted-decimal IPv4 address.\n *\n * **Details**\n *\n * Multi-digit octets with a leading zero are rejected to avoid octal ambiguity.\n *\n * @stability unstable\n * @category decoding\n * @since 4.0.0\n */\nexport const ipv4FromString = input => {\n const parts = input.split(\".\");\n if (parts.length !== 4 || parts.some(part => !/^\\d{1,3}$/.test(part))) {\n return addressError(input, \"expected exactly four decimal octets\");\n }\n if (parts.some(part => part.length > 1 && part[0] === \"0\")) {\n return addressError(input, \"leading zeroes are not allowed\");\n }\n const octets = parts.map(Number);\n if (octets.some(part => part > 255)) {\n return addressError(input, \"octets must be at most 255\");\n }\n return ipv4FromOctets([octets[0], octets[1], octets[2], octets[3]]);\n};\nconst parseIpv6Segments = input => {\n if (input.includes(\"[\") || input.includes(\"]\") || input.includes(\"%\")) {\n return addressError(input, \"brackets and zone identifiers are not valid in a bare IPv6 address\");\n }\n const halves = input.split(\"::\");\n if (halves.length > 2) return addressError(input, \"only one compression marker is allowed\");\n const head = halves[0] === \"\" ? [] : halves[0].split(\":\");\n const tail = halves.length === 2 && halves[1] !== \"\" ? halves[1].split(\":\") : [];\n if (head.some(part => part === \"\") || tail.some(part => part === \"\")) {\n return addressError(input, \"empty segments are only valid in the compression marker\");\n }\n const trailing = tail.length > 0 ? tail[tail.length - 1] : head.length > 0 ? head[head.length - 1] : \"\";\n let embedded;\n if (trailing.includes(\".\")) {\n if (halves.length === 2 && tail.length === 0) {\n return addressError(input, \"embedded IPv4 syntax must be trailing\");\n }\n const parsed = Result.map(ipv4FromString(trailing), address => {\n const value = ipv4Value(address);\n return [value >>> 16, value & 0xffff];\n });\n if (Result.isFailure(parsed)) return parsed;\n embedded = parsed.success;\n if (tail.length > 0) tail.pop();else head.pop();\n }\n const explicit = head.length + tail.length + (embedded ? 2 : 0);\n if (halves.length === 1 ? explicit !== 8 : explicit >= 8) {\n return addressError(input, halves.length === 1 ? \"expected eight segments\" : \"compression must replace at least one segment\");\n }\n const parse = part => /^[0-9a-fA-F]{1,4}$/.test(part) ? Number.parseInt(part, 16) : undefined;\n const parsedHead = head.map(parse);\n const parsedTail = tail.map(parse);\n if (parsedHead.some(part => part === undefined) || parsedTail.some(part => part === undefined)) {\n return addressError(input, \"segments must contain one through four hexadecimal digits\");\n }\n return Result.succeed([...parsedHead, ...Array(8 - explicit).fill(0), ...parsedTail, ...(embedded ?? [])]);\n};\n/**\n * Parses an IPv6 address with optional compression and trailing embedded IPv4.\n *\n * @stability unstable\n * @category decoding\n * @since 4.0.0\n */\nexport const ipv6FromString = input => {\n return Result.flatMap(parseIpv6Segments(input), segments => ipv6FromSegments(segments));\n};\n/**\n * Parses a bare numeric IPv4 or IPv6 address.\n *\n * @stability unstable\n * @category decoding\n * @since 4.0.0\n */\nexport const ipFromString = input => {\n const result = input.includes(\":\") ? ipv6FromString(input) : ipv4FromString(input);\n return result;\n};\n/**\n * Parses a trusted bare numeric IPv4 or IPv6 address, throwing on failure.\n *\n * @stability unstable\n * @category unsafe\n * @since 4.0.0\n */\nexport const ipFromStringUnsafe = input => Result.getOrThrow(ipFromString(input));\n/**\n * Converts an `IpAddressInput` to an IP address, returning IP addresses\n * unchanged.\n *\n * **Details**\n *\n * Strings are parsed like `ipFromString`. Four octets or bytes make an IPv4\n * address, and eight segments or sixteen bytes make an IPv6 address.\n *\n * **Example** (Converting IP address inputs)\n *\n * ```ts import.meta.vitest\n * import { Result } from \"effect\"\n * import { NetAddress } from \"effect/net\"\n *\n * const address = Result.getOrThrow(NetAddress.ipFromInput(\"192.0.2.1\"))\n * NetAddress.formatIp(address) // => \"192.0.2.1\"\n * Result.getOrThrow(NetAddress.ipFromInput(address)) === address // => true\n * NetAddress.formatIp(Result.getOrThrow(NetAddress.ipFromInput([192, 0, 2, 1]))) // => \"192.0.2.1\"\n * Result.isFailure(NetAddress.ipFromInput(\"example.com\")) // => true\n * ```\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const ipFromInput = input => {\n if (isIpAddress(input)) return Result.succeed(input);\n if (typeof input === \"string\") return ipFromString(input);\n if (input instanceof Uint8Array && input.length === 4) return Result.succeed(ipv4FromBytesUnsafe(input));\n if (input instanceof Uint8Array && input.length === 16) return Result.succeed(ipv6FromBytesUnsafe(input));\n if (Array.isArray(input) && isTupleOf(input, 4)) return ipv4FromOctets(input);\n if (Array.isArray(input) && isTupleOf(input, 8)) return ipv6FromSegments(input);\n return addressError(input, \"expected an IP address, string, 4 octets, 8 segments, or 4 or 16 bytes\");\n};\n/**\n * Converts a trusted `IpAddressInput` to an IP address, throwing on failure.\n *\n * @stability unstable\n * @category unsafe\n * @since 4.0.0\n */\nexport const ipFromInputUnsafe = input => Result.getOrThrow(ipFromInput(input));\n/**\n * Converts an `Ipv4AddressInput` to an IPv4 address, parsing strings like\n * `ipv4FromString`, checking octets like `ipv4FromOctets`, and returning IPv4\n * addresses unchanged.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const ipv4FromInput = input => {\n if (isIpv4Address(input)) return Result.succeed(input);\n if (typeof input === \"string\") return ipv4FromString(input);\n if (input instanceof Uint8Array && input.length === 4) return Result.succeed(ipv4FromBytesUnsafe(input));\n if (Array.isArray(input) && isTupleOf(input, 4)) return ipv4FromOctets(input);\n return addressError(input, \"expected an IPv4 address, string, 4 octets, or 4 bytes\");\n};\n/**\n * Converts an `Ipv6AddressInput` to an IPv6 address, parsing strings like\n * `ipv6FromString`, checking segments like `ipv6FromSegments`, and returning\n * IPv6 addresses unchanged.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const ipv6FromInput = input => {\n if (isIpv6Address(input)) return Result.succeed(input);\n if (typeof input === \"string\") return ipv6FromString(input);\n if (input instanceof Uint8Array && input.length === 16) return Result.succeed(ipv6FromBytesUnsafe(input));\n if (Array.isArray(input) && isTupleOf(input, 8)) return ipv6FromSegments(input);\n return addressError(input, \"expected an IPv6 address, string, 8 segments, or 16 bytes\");\n};\n/**\n * Returns `true` when a value is a canonical scoped IPv6 literal.\n *\n * @stability experimental\n * @category guards\n * @since 4.0.0\n */\nexport const isScopedIpv6Literal = u => {\n if (typeof u !== \"string\" || !u.includes(\"%\")) return false;\n const result = scopedIpv6LiteralFromString(u);\n return Result.isSuccess(result) && result.success === u;\n};\n/**\n * Parses an IPv6 literal with a numeric or named zone, such as `fe80::1%eth0`.\n *\n * @stability experimental\n * @category decoding\n * @since 4.0.0\n */\nexport const scopedIpv6LiteralFromString = input => {\n const separator = input.indexOf(\"%\");\n if (separator === -1) return addressError(input, \"expected an IPv6 zone\");\n let zone = input.slice(separator + 1);\n if (zone.length === 0 || /[%[\\]/\\s\\p{Cc}]/u.test(zone)) {\n return addressError(input, \"invalid IPv6 scope identifier\");\n }\n if (/^\\d+$/.test(zone)) {\n const scopeId = Number(zone);\n if (scopeId > 0xffffffff) return addressError(input, \"scope identifier must be an unsigned 32-bit integer\");\n zone = String(scopeId);\n }\n return Result.map(ipv6FromString(input.slice(0, separator)), address => `${formatIp(address)}%${zone}`);\n};\n/**\n * Converts a `ScopedIpv6LiteralInput` to a scoped IPv6 literal, parsing it\n * like `scopedIpv6LiteralFromString`.\n *\n * **Details**\n *\n * Scoped IPv6 literals are strings, so every input is parsed.\n *\n * @stability experimental\n * @category constructors\n * @since 4.0.0\n */\nexport const scopedIpv6LiteralFromInput = input => scopedIpv6LiteralFromString(input);\n/**\n * Returns the four numeric octets of an IPv4 address in a fresh tuple.\n *\n * @stability unstable\n * @category getters\n * @since 4.0.0\n */\nexport const ipv4ToOctets = self => wordToOctets(ipv4Value(self));\n/**\n * Returns the eight numeric segments of an IPv6 address in a fresh tuple.\n *\n * @stability unstable\n * @category getters\n * @since 4.0.0\n */\nexport const ipv6ToSegments = self => {\n const {\n w0,\n w1,\n w2,\n w3\n } = ipv6Words(self);\n return [w0 >>> 16, w0 & 0xffff, w1 >>> 16, w1 & 0xffff, w2 >>> 16, w2 & 0xffff, w3 >>> 16, w3 & 0xffff];\n};\n/**\n * Returns the sixteen numeric octets of an IPv6 address in a fresh array.\n *\n * @stability unstable\n * @category getters\n * @since 4.0.0\n */\nexport const ipv6ToOctets = self => {\n const {\n w0,\n w1,\n w2,\n w3\n } = ipv6Words(self);\n return [...wordToOctets(w0), ...wordToOctets(w1), ...wordToOctets(w2), ...wordToOctets(w3)];\n};\n/**\n * Returns the six numeric octets of a MAC address in a fresh tuple.\n *\n * @stability unstable\n * @category getters\n * @since 4.0.0\n */\nexport const macAddressToOctets = self => {\n const bytes = getMacBytes(self);\n return [bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5]];\n};\n/**\n * Formats a MAC address as six lowercase hexadecimal octets separated by colons.\n *\n * @stability unstable\n * @category encoding\n * @since 4.0.0\n */\nexport const formatMacAddress = self => Array.from(getMacBytes(self), byte => byte.toString(16).padStart(2, \"0\")).join(\":\");\n/**\n * Returns `true` when the MAC address is the all-ones broadcast address.\n *\n * @stability unstable\n * @category predicates\n * @since 4.0.0\n */\nexport const isMacBroadcast = self => getMacBytes(self).every(byte => byte === 0xff);\n/**\n * Returns `true` when the MAC address has the IEEE group-address bit set.\n *\n * @stability unstable\n * @category predicates\n * @since 4.0.0\n */\nexport const isMacMulticast = self => (getMacBytes(self)[0] & 1) !== 0;\n/**\n * Returns `true` when the MAC address has the IEEE group-address bit clear.\n *\n * @stability unstable\n * @category predicates\n * @since 4.0.0\n */\nexport const isMacUnicast = self => (getMacBytes(self)[0] & 1) === 0;\n/**\n * Returns `true` when the MAC address has the IEEE local-administration bit set.\n *\n * @stability unstable\n * @category predicates\n * @since 4.0.0\n */\nexport const isMacLocallyAdministered = self => (getMacBytes(self)[0] & 2) !== 0;\n/**\n * Returns `true` when the MAC address has the IEEE local-administration bit clear.\n *\n * @stability unstable\n * @category predicates\n * @since 4.0.0\n */\nexport const isMacUniversallyAdministered = self => (getMacBytes(self)[0] & 2) === 0;\n/**\n * Folds an IP address by its numeric version.\n *\n * @stability unstable\n * @category pattern matching\n * @since 4.0.0\n */\nexport const match = /*#__PURE__*/dual(2, (self, options) => isIpv4Address(self) ? options.onIpv4(self) : options.onIpv6(self));\n/**\n * Formats an IP address in canonical numeric form.\n *\n * @stability unstable\n * @category encoding\n * @since 4.0.0\n */\nexport const formatIp = self => {\n if (isIpv4Address(self)) return ipv4ToOctets(self).join(\".\");\n const segments = ipv6ToSegments(self);\n if (isIpv4Mapped(self)) {\n return `::ffff:${segments[6] >> 8}.${segments[6] & 0xff}.${segments[7] >> 8}.${segments[7] & 0xff}`;\n }\n let bestStart = -1;\n let bestLength = 0;\n let start = -1;\n for (let index = 0; index <= 8; index++) {\n if (index < 8 && segments[index] === 0) {\n if (start === -1) start = index;\n } else if (start !== -1) {\n if (index - start > bestLength) {\n bestStart = start;\n bestLength = index - start;\n }\n start = -1;\n }\n }\n if (bestLength < 2) return segments.map(segment => segment.toString(16)).join(\":\");\n const head = segments.slice(0, bestStart).map(segment => segment.toString(16)).join(\":\");\n const tail = segments.slice(bestStart + bestLength).map(segment => segment.toString(16)).join(\":\");\n return `${head}::${tail}`;\n};\n/**\n * Returns `true` for the all-zero address of either IP version.\n *\n * @stability unstable\n * @category predicates\n * @since 4.0.0\n */\nexport const isUnspecified = self => {\n if (isIpv4Address(self)) return ipv4Value(self) === 0;\n const {\n w0,\n w1,\n w2,\n w3\n } = ipv6Words(self);\n return w0 === 0 && w1 === 0 && w2 === 0 && w3 === 0;\n};\n/**\n * Returns `true` for IPv4 `127.0.0.0/8` or IPv6 `::1`.\n *\n * @stability unstable\n * @category predicates\n * @since 4.0.0\n */\nexport const isLoopback = self => {\n if (isIpv4Address(self)) return ipv4Value(self) >>> 24 === 127;\n const {\n w0,\n w1,\n w2,\n w3\n } = ipv6Words(self);\n return w0 === 0 && w1 === 0 && w2 === 0 && w3 === 1;\n};\n/**\n * Returns `true` for IPv4 `224.0.0.0/4`, IPv6 `ff00::/8`, or a MAC address with\n * the IEEE group bit set, refining the value while preserving its address type.\n *\n * **Details**\n *\n * The MAC all-ones broadcast address has the group bit set and is multicast;\n * the IPv4 limited broadcast address `255.255.255.255` is not. Use\n * {@link isMacBroadcast} or {@link isBroadcast} to distinguish broadcast.\n *\n * **Example** (Classifying IP and MAC group addresses)\n *\n * ```ts import.meta.vitest\n * import { assert } from \"@effect/vitest\"\n * import { NetAddress } from \"effect/net\"\n *\n * const ip = NetAddress.ipFromStringUnsafe(\"239.255.0.1\")\n * const mac = NetAddress.macAddressFromStringUnsafe(\"ff:ff:ff:ff:ff:ff\")\n *\n * assert.isTrue(NetAddress.isMulticast(ip))\n * assert.isTrue(NetAddress.isMulticast(mac))\n * assert.isTrue(NetAddress.isBroadcast(mac))\n * assert.isFalse(NetAddress.isMulticast(NetAddress.ipv4Broadcast))\n * ```\n *\n * @stability unstable\n * @category predicates\n * @since 4.0.0\n */\nexport const isMulticast = self => {\n if (isMacAddress(self)) return isMacMulticast(self);\n if (isIpv4Address(self)) return ipv4Value(self) >>> 28 === 0xe;\n return ipv6Words(self).w0 >>> 24 === 0xff;\n};\n/**\n * Returns `true` for the IPv4 limited broadcast address `255.255.255.255` or\n * the MAC all-ones broadcast address.\n *\n * **Details**\n *\n * MAC broadcast is also multicast because its IEEE group bit is set. IPv4\n * limited broadcast is not multicast. Directed IPv4 broadcast cannot be\n * determined without a network prefix and is not classified here.\n *\n * @stability unstable\n * @category predicates\n * @since 4.0.0\n */\nexport const isBroadcast = self => isMacAddress(self) ? isMacBroadcast(self) : ipv4Value(self) === 0xffffffff;\n/**\n * Returns `true` when an address is syntactically unicast.\n *\n * **Details**\n *\n * IP addresses exclude multicast, unspecified, and IPv4 limited broadcast.\n * This does not exclude reserved ranges, prefix-relative directed broadcast,\n * or addresses that are unusable or unreachable in a particular deployment.\n * MAC addresses are unicast when their IEEE individual/group bit is clear.\n *\n * @stability unstable\n * @category predicates\n * @since 4.0.0\n */\nexport const isUnicast = self => {\n if (isMacAddress(self)) return isMacUnicast(self);\n return !isMulticast(self) && !isUnspecified(self) && (!isIpv4Address(self) || !isBroadcast(self));\n};\n/**\n * Returns `true` for IPv4 `169.254.0.0/16` or IPv6 `fe80::/10`.\n *\n * @stability unstable\n * @category predicates\n * @since 4.0.0\n */\nexport const isLinkLocal = self => {\n if (isIpv4Address(self)) return ipv4Value(self) >>> 16 === 0xa9fe;\n return (ipv6Words(self).w0 >>> 16 & 0xffc0) === 0xfe80;\n};\n/**\n * Returns `true` for IPv4 private-use ranges defined by RFC 1918.\n *\n * @stability unstable\n * @category predicates\n * @since 4.0.0\n */\nexport const isPrivate = self => {\n const value = ipv4Value(self);\n return value >>> 24 === 10 || (value >>> 16 & 0xfff0) === 0xac10 || value >>> 16 === 0xc0a8;\n};\n/**\n * Returns `true` for IPv6 unique-local addresses in `fc00::/7`.\n *\n * @stability unstable\n * @category predicates\n * @since 4.0.0\n */\nexport const isUniqueLocal = self => (ipv6Words(self).w0 >>> 24 & 0xfe) === 0xfc;\n/**\n * Returns `true` when an IPv6 address is in the `::ffff:0:0/96` mapped range.\n *\n * @stability unstable\n * @category predicates\n * @since 4.0.0\n */\nexport const isIpv4Mapped = self => {\n const {\n w0,\n w1,\n w2\n } = ipv6Words(self);\n return w0 === 0 && w1 === 0 && w2 === 0xffff;\n};\n/**\n * Converts an IPv4 address to its IPv4-mapped IPv6 representation.\n *\n * @stability unstable\n * @category converting\n * @since 4.0.0\n */\nexport const toIpv4Mapped = self => makeIpv6(0, 0, 0xffff, ipv4Value(self));\n/**\n * Extracts the IPv4 value from an IPv4-mapped IPv6 address.\n *\n * @stability unstable\n * @category converting\n * @since 4.0.0\n */\nexport const fromIpv4Mapped = self => isIpv4Mapped(self) ? Option.some(makeIpv4(ipv6Words(self).w3)) : Option.none();\n/**\n * @stability unstable\n */\nexport function toCanonical(self) {\n if (isInetAddress(self)) {\n const address = toCanonical(self.address);\n return address === self.address ? self : inetAddressUnsafe(address, self.port);\n }\n return isIpv6Address(self) ? Option.getOrElse(fromIpv4Mapped(self), () => self) : self;\n}\nconst InetV4Proto = {\n ...Inspectable.BaseProto,\n _tag: \"InetAddressV4\",\n [TypeId]: TypeId,\n [Equal.symbol](that) {\n return isInetAddressV4(that) && this.port === that.port && Equal.equals(this.address, that.address);\n },\n [Hash.symbol]() {\n return Hash.combine(Hash.hash(this.address), Hash.number(this.port));\n },\n toString() {\n return formatInet(this);\n },\n toJSON() {\n return this.toString();\n }\n};\nconst InetV6Proto = {\n ...Inspectable.BaseProto,\n _tag: \"InetAddressV6\",\n [TypeId]: TypeId,\n [Equal.symbol](that) {\n return isInetAddressV6(that) && this.port === that.port && this.scopeId === that.scopeId && Equal.equals(this.address, that.address);\n },\n [Hash.symbol]() {\n return Hash.combine(Hash.combine(Hash.hash(this.address), Hash.number(this.port)), Hash.number(this.scopeId));\n },\n toString() {\n return formatInet(this);\n },\n toJSON() {\n return this.toString();\n }\n};\nconst checkPort = port => Number.isInteger(port) && port >= 0 && port <= 0xffff;\n/**\n * Creates a checked IPv4 internet address.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const inetAddressV4 = (address, port) => {\n if (!checkPort(port)) {\n return addressError(address, \"port must be an integer from 0 through 65535\");\n }\n const self = Object.create(InetV4Proto);\n self.address = address;\n self.port = port;\n return Result.succeed(Object.freeze(self));\n};\n/**\n * Creates a checked IPv6 internet address with an optional scope identifier.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const inetAddressV6 = (address, port, options) => {\n if (!checkPort(port)) {\n return addressError(address, \"port must be an integer from 0 through 65535\");\n }\n const scopeId = options?.scopeId ?? 0;\n if (!Number.isInteger(scopeId) || scopeId < 0 || scopeId > 0xffffffff) {\n return addressError(address, \"scopeId must be an unsigned 32-bit integer\");\n }\n const self = Object.create(InetV6Proto);\n self.address = address;\n self.port = port;\n self.scopeId = scopeId;\n return Result.succeed(Object.freeze(self));\n};\n/**\n * Creates a checked internet address for an IP address and port.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const inetAddress = (address, port) => isIpv4Address(address) ? inetAddressV4(address, port) : inetAddressV6(address, port);\n/**\n * Creates an internet address from a trusted IP address and port, throwing on failure.\n *\n * @stability unstable\n * @category unsafe\n * @since 4.0.0\n */\nexport const inetAddressUnsafe = (address, port) => Result.getOrThrow(inetAddress(address, port));\n/**\n * Creates a checked internet address from a numeric IP string and port.\n *\n * **Gotchas**\n *\n * The address must be a numeric IPv4 or IPv6 literal. This function does not\n * resolve hostnames or accept IPv6 brackets.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const inetAddressFromIpString = (address, port) => {\n return Result.flatMap(ipFromString(address), address => inetAddress(address, port));\n};\n/**\n * Creates an internet address from a trusted numeric IP string and port.\n *\n * **Gotchas**\n *\n * This function throws when either input is invalid. Use only when both values\n * are already known to satisfy the checked constructor's requirements.\n *\n * @stability unstable\n * @category unsafe\n * @since 4.0.0\n */\nexport const inetAddressFromIpStringUnsafe = (address, port) => Result.getOrThrow(inetAddressFromIpString(address, port));\n/**\n * Creates an internet address from a trusted native numeric host and port.\n * Named IPv6 zones are resolved using the supplied interface-to-scope map.\n * Use only for runtime-supplied socket addresses: this skips input validation,\n * so malformed strings or ports may silently produce incorrect values. An\n * unknown named IPv6 zone throws rather than losing its scope.\n *\n * @stability unstable\n * @category unsafe\n * @since 4.0.0\n */\nexport const inetAddressFromNativeUnsafe = (host, port, scopeIds) => {\n const zoneStart = host.indexOf(\"%\");\n const end = zoneStart === -1 ? host.length : zoneStart;\n if (host.indexOf(\":\") === -1) {\n const self = Object.create(InetV4Proto);\n self.address = makeIpv4(parseNativeIpv4(host, 0, end));\n self.port = port;\n return Object.freeze(self);\n }\n let scopeId = 0;\n if (zoneStart !== -1) {\n const zone = host.slice(zoneStart + 1);\n const resolved = numericZone.test(zone) ? Number(zone) : scopeIds?.get(zone);\n if (resolved === undefined) throw new Error(`unknown IPv6 interface: ${zone}`);\n scopeId = resolved;\n }\n let w0 = 0;\n let w1 = 0;\n let w2 = 0;\n let w3 = 0;\n let segment = 0;\n let i = 0;\n while (i < end) {\n if (host.charCodeAt(i) === 58) {\n // The rest of a compressed address is anchored at the last segment.\n i += 2;\n if (i === end) break;\n let remaining = 1;\n for (let j = i; j < end; j++) {\n if (host.charCodeAt(j) === 58) remaining++;\n }\n const dot = host.indexOf(\".\", i);\n if (dot !== -1 && dot < end) remaining++;\n segment = 8 - remaining;\n }\n const start = i;\n let value = 0;\n while (i < end) {\n const ch = host.charCodeAt(i);\n if (ch === 58 || ch === 46) break;\n value = value << 4 | (ch <= 57 ? ch - 48 : (ch & 0x5f) - 55);\n i++;\n }\n if (i < end && host.charCodeAt(i) === 46) {\n w3 = parseNativeIpv4(host, start, end);\n break;\n }\n // even segments fill the high half of their 32-bit word\n const shifted = value << (1 - (segment & 1)) * 16;\n switch (segment >>> 1) {\n case 0:\n w0 |= shifted;\n break;\n case 1:\n w1 |= shifted;\n break;\n case 2:\n w2 |= shifted;\n break;\n default:\n w3 |= shifted;\n }\n segment++;\n if (i < end && host.charCodeAt(i + 1) !== 58) i++;\n }\n const self = Object.create(InetV6Proto);\n self.address = makeIpv6(w0, w1, w2, w3);\n self.port = port;\n self.scopeId = scopeId;\n return Object.freeze(self);\n};\nconst numericZone = /^\\d+$/;\nconst parseNativeIpv4 = (host, start, end) => {\n let value = 0;\n let octet = 0;\n for (let i = start; i < end; i++) {\n const ch = host.charCodeAt(i);\n if (ch === 46) {\n value = value << 8 | octet;\n octet = 0;\n } else {\n octet = octet * 10 + ch - 48;\n }\n }\n return (value << 8 | octet) >>> 0;\n};\n/**\n * Parses an unbracketed numeric host and port, resolving named IPv6 zones using\n * a supplied map of interface names to numeric scope IDs.\n *\n * **Details**\n *\n * IPv4, unscoped IPv6, and numeric IPv6 zones need no map. Named zones must have\n * a matching map entry. This function performs no DNS or operating-system lookup.\n *\n * @see {@link formatHost} for formatting the host of an internet address\n * @see {@link scopeIdsFromInterfaces} for building a scope map from interface entries\n * @stability unstable\n * @category decoding\n * @since 4.0.0\n */\nexport const inetAddressFromHostString = (host, port, scopeIds) => {\n const separator = host.indexOf(\"%\");\n if (separator !== -1) {\n const zone = host.slice(separator + 1);\n if (zone.length === 0 || zone.includes(\"%\")) {\n return addressError(host, \"invalid IPv6 scope identifier\");\n }\n if (!/^\\d+$/.test(zone)) {\n const scopeId = scopeIds?.get(zone);\n if (scopeId === undefined) {\n return addressError(host, `unknown IPv6 interface: ${zone}`);\n }\n host = `${host.slice(0, separator)}%${scopeId}`;\n }\n }\n return inetAddressFromString(host.includes(\":\") ? `[${host}]:${port}` : `${host}:${port}`);\n};\n/**\n * Returns the IPv6 scope ID of a network interface from its addresses.\n *\n * **Details**\n *\n * The first IPv6 address with a positive scope ID supplies the result. Accepts\n * the addresses of one interface, such as `os.networkInterfaces()[name]` or the\n * entries of `Deno.networkInterfaces()` with that name, without performing any\n * operating-system lookup itself.\n *\n * @see {@link scopeIdsFromInterfaces} for mapping every interface at once\n * @stability experimental\n * @category converting\n * @since 4.0.0\n */\nexport const scopeIdFromInterface = addresses => {\n for (const address of addresses ?? []) {\n if (address.family === \"IPv6\" && typeof address.scopeid === \"number\" && address.scopeid > 0) {\n return Option.some(address.scopeid);\n }\n }\n return Option.none();\n};\n/**\n * Creates a map from interface names to IPv6 scope IDs using supplied interface\n * entries.\n *\n * **Details**\n *\n * Each entry pairs an interface name with its addresses. The first IPv6 address\n * with a positive scope ID supplies that interface's mapping. Accepts entries\n * such as `Object.entries(os.networkInterfaces())` without performing any\n * operating-system lookup itself. Later changes to the entries do not affect\n * the map.\n *\n * @see {@link inetAddressFromHostString} for resolving named IPv6 zones with the map\n * @stability unstable\n * @category converting\n * @since 4.0.0\n */\nexport const scopeIdsFromInterfaces = interfaces => {\n const scopeIds = new Map();\n for (const [name, addresses] of interfaces) {\n const scopeId = scopeIdFromInterface(addresses);\n if (Option.isSome(scopeId)) scopeIds.set(name, scopeId.value);\n }\n return scopeIds;\n};\n/**\n * Parses `IPv4:port` or `[IPv6]:port` without DNS resolution.\n *\n * @stability unstable\n * @category decoding\n * @since 4.0.0\n */\nexport const inetAddressFromString = input => {\n let host;\n let portText;\n let scopeId = 0;\n const bracketed = input.startsWith(\"[\");\n if (bracketed) {\n const end = input.indexOf(\"]\");\n if (end < 0 || input[end + 1] !== \":\" || input.indexOf(\"]\", end + 1) !== -1) {\n return addressError(input, \"expected [IPv6]:port\");\n }\n host = input.slice(1, end);\n portText = input.slice(end + 2);\n const scopeSeparator = host.indexOf(\"%\");\n if (scopeSeparator !== -1) {\n const scopeText = host.slice(scopeSeparator + 1);\n if (host.indexOf(\"%\", scopeSeparator + 1) !== -1 || !/^\\d+$/.test(scopeText)) {\n return addressError(input, \"scope identifier must be decimal\");\n }\n scopeId = Number(scopeText);\n if (!Number.isInteger(scopeId) || scopeId > 0xffffffff) {\n return addressError(input, \"scope identifier must be an unsigned 32-bit integer\");\n }\n host = host.slice(0, scopeSeparator);\n }\n } else {\n const separator = input.lastIndexOf(\":\");\n if (separator < 0) {\n return addressError(input, \"expected host:port or [IPv6]:port\");\n }\n if (input.indexOf(\":\") !== separator) {\n return addressError(input, \"IPv6 addresses must be bracketed\");\n }\n host = input.slice(0, separator);\n portText = input.slice(separator + 1);\n }\n if (!/^(0|[1-9]\\d*)$/.test(portText)) {\n return addressError(input, \"port must be an unpadded decimal integer\");\n }\n return Result.flatMap(ipFromString(host), address => {\n if (bracketed !== isIpv6Address(address)) {\n return addressError(input, \"only IPv6 addresses use brackets\");\n }\n return isIpv6Address(address) ? inetAddressV6(address, Number(portText), {\n scopeId\n }) : inetAddressV4(address, Number(portText));\n });\n};\n/**\n * Parses a trusted numeric internet address and port, throwing on failure.\n *\n * @stability unstable\n * @category unsafe\n * @since 4.0.0\n */\nexport const inetAddressFromStringUnsafe = input => Result.getOrThrow(inetAddressFromString(input));\n/**\n * Converts an `InetAddressInput` to an internet address, parsing strings like\n * `inetAddressFromString`, converting parts like `inetAddressV4` and\n * `inetAddressV6`, and returning internet addresses unchanged.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const inetAddressFromInput = input => {\n if (isInetAddress(input)) return Result.succeed(input);\n if (typeof input === \"string\") return inetAddressFromString(input);\n if (!hasProperty(input, \"address\") || !hasProperty(input, \"port\")) {\n return addressError(input, \"expected an address and port\");\n }\n const {\n port,\n scopeId\n } = input;\n return Result.flatMap(ipFromInput(input.address), address => {\n if (isIpv6Address(address)) return inetAddressV6(address, port, {\n scopeId\n });\n return (scopeId ?? 0) === 0 ? inetAddressV4(address, port) : addressError(input, \"scopeId requires an IPv6 address\");\n });\n};\n/**\n * Converts a trusted `InetAddressInput` to an internet address, throwing on failure.\n *\n * @stability unstable\n * @category unsafe\n * @since 4.0.0\n */\nexport const inetAddressFromInputUnsafe = input => Result.getOrThrow(inetAddressFromInput(input));\n/**\n * Formats the numeric host of an internet address without brackets or a port,\n * preserving a nonzero IPv6 scope ID as a `%` suffix.\n *\n * **When to use**\n *\n * Use when the host and port are represented separately.\n *\n * @see {@link formatInet} for a complete socket address\n * @see {@link formatUrlHost} for a bracketed URL authority host\n * @stability unstable\n * @category encoding\n * @since 4.0.0\n */\nexport const formatHost = self => formatIp(self.address) + (isInetAddressV6(self) && self.scopeId !== 0 ? `%${self.scopeId}` : \"\");\n/**\n * Formats an internet address's host for a native socket API, without brackets\n * or a port.\n *\n * **Details**\n *\n * On `\"win32\"`, IPv6 zones remain numeric. On other platforms, the first\n * interface name matching the scope ID is used, falling back to the numeric ID\n * when no name matches. Unscoped IPv6 and IPv4 hosts are unchanged.\n *\n * Supply a scope map from {@link scopeIdsFromInterfaces} and optionally a platform\n * string. Omitting the platform uses non-Windows behavior. This function performs\n * no operating-system lookups.\n *\n * @stability unstable\n * @category encoding\n * @since 4.0.0\n */\nexport const formatNativeHost = (self, scopeIds, platform) => {\n if (platform !== \"win32\" && isInetAddressV6(self) && self.scopeId !== 0) {\n for (const [name, scopeId] of scopeIds) {\n if (scopeId === self.scopeId) return `${formatIp(self.address)}%${name}`;\n }\n }\n return formatHost(self);\n};\n/**\n * Formats an IPv4 address or IPv6 interface index for a native multicast API.\n *\n * **Details**\n *\n * IPv4 addresses are formatted as numeric IPs. An IPv6 index of zero produces\n * `\"::\"`. Other indices produce `\"::%index\"` on `\"win32\"`, or `\"::%name\"` on\n * other platforms using the first matching interface name, falling back to the\n * numeric index when no name matches.\n *\n * Supply a scope map from {@link scopeIdsFromInterfaces} and optionally a platform\n * string. Omitting the platform uses non-Windows behavior. This function performs\n * no operating-system lookups.\n *\n * @stability unstable\n * @category encoding\n * @since 4.0.0\n */\nexport const formatMulticastInterface = (networkInterface, scopeIds, platform) => {\n if (typeof networkInterface !== \"number\") return formatIp(networkInterface);\n if (networkInterface === 0) return \"::\";\n if (platform !== \"win32\") {\n for (const [name, scopeId] of scopeIds) {\n if (scopeId === networkInterface) return `::%${name}`;\n }\n }\n return `::%${networkInterface}`;\n};\n/**\n * Formats a resolved internet address, bracketing IPv6 around its port.\n *\n * @stability unstable\n * @category encoding\n * @since 4.0.0\n */\nexport const formatInet = self => {\n const host = formatHost(self);\n return isInetAddressV4(self) ? `${host}:${self.port}` : `[${host}]:${self.port}`;\n};\n/**\n * Formats an IP address for use as a URL authority host.\n *\n * @stability unstable\n * @category encoding\n * @since 4.0.0\n */\nexport const formatUrlHost = self => isIpv4Address(self) ? formatIp(self) : `[${formatIp(self)}]`;\n/**\n * Converts an IP address or internet socket address to a WHATWG `URL`.\n *\n * **Details**\n *\n * Defaults to the HTTP scheme and uses standard URL normalization, including\n * IPv6 brackets and omission of default ports. Bare IP addresses have no\n * explicit port; internet socket addresses retain their port, including zero.\n * Unspecified addresses are preserved.\n *\n * **Gotchas**\n *\n * Returns a `NetAddressError` for scoped IPv6 addresses or inputs that the URL\n * constructor rejects. Supply the scheme without a trailing colon, for example\n * `\"https\"`.\n *\n * @stability unstable\n * @category conversions\n * @since 4.0.0\n */\nexport const toUrl = (self, scheme = \"http\") => {\n if (self._tag === \"InetAddressV6\" && self.scopeId !== 0) {\n return addressError(self, \"scoped IPv6 addresses are not supported by WHATWG URLs\");\n }\n return Result.try({\n try: () => new URL(`${scheme}://${isInetAddress(self) ? formatInet(self) : formatUrlHost(self)}`),\n catch: cause => new NetAddressError({\n input: self,\n message: \"failed to construct URL\",\n cause\n })\n });\n};\n/**\n * Formats an IP or socket address as a URL display string.\n *\n * **Details**\n *\n * Defaults to HTTP, brackets IPv6 addresses, and omits default ports and the\n * trailing slash. Custom schemes such as `\"tcp\"` retain their scheme and host.\n * Unix socket addresses use {@link formatUnixPath}, preserving the raw path\n * with a `unix://` prefix regardless of the supplied scheme.\n *\n * **Gotchas**\n *\n * Returns a `NetAddressError` when URL conversion fails, including for scoped\n * IPv6 addresses.\n *\n * @stability unstable\n * @category encoding\n * @since 4.0.0\n */\nexport const formatUrl = (self, scheme = \"http\") => isUnixPathAddress(self) ? Result.succeed(formatUnixPath(self)) : Result.map(toUrl(self, scheme), url => `${url.protocol}//${url.host}`);\n/**\n * Formats an IP or socket address as a URL display string,\n * throwing a `NetAddressError` when conversion fails.\n *\n * @see {@link formatUrl} for the checked version and formatting behavior.\n *\n * @stability unstable\n * @category unsafe\n * @since 4.0.0\n */\nexport const formatUrlUnsafe = (self, scheme = \"http\") => Result.getOrThrow(formatUrl(self, scheme));\n/**\n * Formats a hostname or numeric IP address for use as a URL authority host.\n *\n * @stability unstable\n * @category encoding\n * @since 4.0.0\n */\nexport const formatUrlHostString = host => host.includes(\":\") && !host.startsWith(\"[\") ? `[${host}]` : host;\nconst UnixPathProto = {\n ...Inspectable.BaseProto,\n _tag: \"UnixPathAddress\",\n [TypeId]: TypeId,\n [Equal.symbol](that) {\n return isUnixPathAddress(that) && this.path === that.path;\n },\n [Hash.symbol]() {\n return Hash.combine(Hash.string(\"UnixPathAddress\"), Hash.string(this.path));\n },\n toString() {\n return this.path;\n },\n toJSON() {\n return this.toString();\n }\n};\n/**\n * Creates a Unix-domain filesystem address without normalizing its opaque path.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const unixPathAddress = path => {\n const self = Object.create(UnixPathProto);\n self.path = path;\n return Object.freeze(self);\n};\n/**\n * Formats a Unix-domain socket path as a readable `unix://path` display string.\n *\n * **Details**\n *\n * Preserves the raw path without URL encoding or normalization. The resulting\n * string is intended for display.\n *\n * @stability unstable\n * @category encoding\n * @since 4.0.0\n */\nexport const formatUnixPath = self => `unix://${self.path}`;\n/**\n * Converts a `SocketAddress.Input` to a concrete socket address.\n *\n * **Details**\n *\n * Internet addresses are converted like `inetAddressFromInput`, without\n * hostname resolution. Invalid IP literals, ports, and input shapes return a\n * `NetAddressError`.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const socketAddressFromInput = input => {\n if (isUnixPathAddress(input)) return Result.succeed(input);\n if (hasProperty(input, \"path\")) {\n return typeof input.path === \"string\" ? Result.succeed(unixPathAddress(input.path)) : addressError(input, \"path must be a string\");\n }\n return inetAddressFromInput(input);\n};\n/**\n * Converts a trusted `SocketAddress.Input` to a concrete socket address,\n * throwing on failure.\n *\n * @stability unstable\n * @category unsafe\n * @since 4.0.0\n */\nexport const socketAddressFromInputUnsafe = input => Result.getOrThrow(socketAddressFromInput(input));\n/**\n * Formats a portable socket address for human-readable output.\n *\n * @stability unstable\n * @category encoding\n * @since 4.0.0\n */\nexport const formatSocketAddress = self => self._tag === \"UnixPathAddress\" ? self.path : formatInet(self);\n//# sourceMappingURL=NetAddress.js.map","import * as Equal from \"../Equal.js\";\nimport * as Hash from \"../Hash.js\";\nimport * as Inspectable from \"../Inspectable.js\";\nimport { hasProperty } from \"../Predicate.js\";\nimport * as Result from \"../Result.js\";\nimport * as NetAddress from \"./NetAddress.js\";\nconst TypeId = \"~effect/net/Host\";\nconst hostError = (input, message) => Result.fail(new NetAddress.NetAddressError({\n input,\n message\n}));\nconst asciiName = /^[a-z0-9_.-]*$/i;\nconst nonAscii = /[\\u0080-\\uffff]/g;\nconst labelPattern = /^[a-z0-9_](?:[a-z0-9_-]{0,61}[a-z0-9_])?$/;\nconst numericLabel = /^(?:\\d+|0x[0-9a-f]*)$/;\nconst validateDomainName = name => {\n if (name === \".\") return undefined;\n const relative = name.endsWith(\".\") ? name.slice(0, -1) : name;\n if (relative.length === 0) return \"domain name must not be empty\";\n if (relative.length > 253) return \"domain name must be at most 253 characters\";\n const labels = relative.split(\".\");\n for (const label of labels) {\n if (label.length === 0) return \"domain name labels must not be empty\";\n if (label.length > 63) return \"domain name labels must be at most 63 characters\";\n if (!labelPattern.test(label)) {\n return \"domain name labels must contain only letters, digits, hyphens, or underscores and must not start or end with a hyphen\";\n }\n }\n if (numericLabel.test(labels[labels.length - 1])) {\n return \"the last domain name label must not be numeric\";\n }\n return undefined;\n};\nconst toAsciiDomainName = input => {\n if (asciiName.test(input)) return input.toLowerCase();\n // Check the composed form, so that `=\\u0338` is read as `≠`\n if (!asciiName.test(input.normalize(\"NFC\").replace(nonAscii, \"\"))) return undefined;\n try {\n return new URL(`http://${input}`).hostname;\n } catch {\n return undefined;\n }\n};\n/**\n * Returns `true` when a value is a valid, normalized domain name.\n *\n * @stability experimental\n * @category guards\n * @since 4.0.0\n */\nexport const isDomainName = u => typeof u === \"string\" && /^[a-z0-9_.-]+$/.test(u) && validateDomainName(u) === undefined;\n/**\n * Returns `true` when a value is a host.\n *\n * @stability experimental\n * @category guards\n * @since 4.0.0\n */\nexport const isHost = u => NetAddress.isIpAddress(u) || NetAddress.isScopedIpv6Literal(u) || isDomainName(u);\n/**\n * Returns `true` when a value is an unresolved host and port.\n *\n * @stability experimental\n * @category guards\n * @since 4.0.0\n */\nexport const isHostPort = u => hasProperty(u, TypeId);\n/**\n * Parses and normalizes a domain name.\n *\n * **Details**\n *\n * ASCII names are lowercased. Names containing non-ASCII characters are\n * converted to their ASCII (`xn--`) form using the WHATWG URL host parser, then\n * validated with the same rules as ASCII names. A trailing dot is preserved.\n *\n * **Example** (Normalizing domain names)\n *\n * ```ts import.meta.vitest\n * import { Result } from \"effect\"\n * import { Host } from \"effect/net\"\n *\n * Result.getOrThrow(Host.domainNameFromString(\"Example.COM\")) // => \"example.com\"\n * Result.getOrThrow(Host.domainNameFromString(\"bücher.example\")) // => \"xn--bcher-kva.example\"\n * Result.isFailure(Host.domainNameFromString(\"1.2.3.4\")) // => true\n * ```\n *\n * @stability experimental\n * @category decoding\n * @since 4.0.0\n */\nexport const domainNameFromString = input => {\n const name = toAsciiDomainName(input);\n if (name === undefined) return hostError(input, \"invalid domain name\");\n const error = validateDomainName(name);\n return error === undefined ? Result.succeed(name) : hostError(input, error);\n};\n/**\n * Parses a trusted domain name, throwing on failure.\n *\n * @stability experimental\n * @category unsafe\n * @since 4.0.0\n */\nexport const domainNameFromStringUnsafe = input => Result.getOrThrow(domainNameFromString(input));\n/**\n * Converts a `DomainNameInput` to a domain name, parsing and normalizing it like\n * `domainNameFromString`.\n *\n * **Details**\n *\n * Domain names are strings, so every input is parsed.\n *\n * @stability experimental\n * @category constructors\n * @since 4.0.0\n */\nexport const domainNameFromInput = input => domainNameFromString(input);\n/**\n * Converts a trusted `DomainNameInput` to a domain name, throwing on failure.\n *\n * @stability experimental\n * @category unsafe\n * @since 4.0.0\n */\nexport const domainNameFromInputUnsafe = input => Result.getOrThrow(domainNameFromInput(input));\n/**\n * Parses a host as a numeric IP address, a scoped IPv6 literal, or a domain\n * name, in that order.\n *\n * **Example** (Parsing hosts)\n *\n * ```ts import.meta.vitest\n * import { Result } from \"effect\"\n * import { Host, NetAddress } from \"effect/net\"\n *\n * NetAddress.isIpAddress(Result.getOrThrow(Host.hostFromString(\"10.0.0.5\"))) // => true\n * Result.getOrThrow(Host.hostFromString(\"fe80::1%eth0\")) // => \"fe80::1%eth0\"\n * Result.getOrThrow(Host.hostFromString(\"DB.internal\")) // => \"db.internal\"\n * ```\n *\n * @stability experimental\n * @category decoding\n * @since 4.0.0\n */\nexport const hostFromString = input => {\n if (input.includes(\"%\")) return NetAddress.scopedIpv6LiteralFromString(input);\n if (input.includes(\":\")) return NetAddress.ipFromString(input);\n if (/^[\\d.]+$/.test(input)) {\n const address = NetAddress.ipFromString(input);\n if (Result.isSuccess(address)) return address;\n }\n return domainNameFromString(input);\n};\n/**\n * Parses a trusted host, throwing on failure.\n *\n * @stability experimental\n * @category unsafe\n * @since 4.0.0\n */\nexport const hostFromStringUnsafe = input => Result.getOrThrow(hostFromString(input));\n/**\n * Converts a `HostInput` to a host, parsing strings like `hostFromString` and\n * converting other inputs like `NetAddress.ipFromInput`.\n *\n * @stability experimental\n * @category constructors\n * @since 4.0.0\n */\nexport const hostFromInput = input => typeof input === \"string\" ? hostFromString(input) : NetAddress.ipFromInput(input);\n/**\n * Converts a trusted `HostInput` to a host, throwing on failure.\n *\n * @stability experimental\n * @category unsafe\n * @since 4.0.0\n */\nexport const hostFromInputUnsafe = input => Result.getOrThrow(hostFromInput(input));\n/**\n * Formats a host without brackets.\n *\n * @stability experimental\n * @category encoding\n * @since 4.0.0\n */\nexport const formatHost = self => typeof self === \"string\" ? self : NetAddress.formatIp(self);\n/**\n * Returns `true` when a domain name ends with a dot, which excludes it from\n * resolver search domains.\n *\n * @stability experimental\n * @category predicates\n * @since 4.0.0\n */\nexport const isFullyQualified = self => self.endsWith(\".\");\n/**\n * Appends the trailing dot to a domain name, unless it is already fully\n * qualified.\n *\n * @stability experimental\n * @category converting\n * @since 4.0.0\n */\nexport const toFullyQualified = self => isFullyQualified(self) ? self : `${self}.`;\n/**\n * Removes the trailing dot of a fully qualified domain name, except from the\n * root name `.`.\n *\n * @stability experimental\n * @category converting\n * @since 4.0.0\n */\nexport const toRelative = self => self.length > 1 && isFullyQualified(self) ? self.slice(0, -1) : self;\nconst HostPortProto = {\n ...Inspectable.BaseProto,\n _tag: \"HostPort\",\n [TypeId]: TypeId,\n [Equal.symbol](that) {\n return isHostPort(that) && this.port === that.port && Equal.equals(this.host, that.host);\n },\n [Hash.symbol]() {\n return Hash.combine(Hash.hash(this.host), Hash.number(this.port));\n },\n toString() {\n return formatHostPort(this);\n },\n toJSON() {\n return this.toString();\n }\n};\nconst isPort = port => Number.isInteger(port) && port >= 0 && port <= 0xffff;\nconst makeHostPort = (host, port) => {\n const self = Object.create(HostPortProto);\n self.host = host;\n self.port = port;\n return Object.freeze(self);\n};\n/**\n * Creates a checked host and port.\n *\n * @stability experimental\n * @category constructors\n * @since 4.0.0\n */\nexport const hostPort = (host, port) => {\n if (!isHost(host)) return hostError(host, \"expected a host\");\n if (!isPort(port)) return hostError(port, \"port must be an integer from 0 through 65535\");\n return Result.succeed(makeHostPort(host, port));\n};\n/**\n * Creates a trusted host and port, throwing on failure.\n *\n * @stability experimental\n * @category unsafe\n * @since 4.0.0\n */\nexport const hostPortUnsafe = (host, port) => Result.getOrThrow(hostPort(host, port));\n/**\n * Parses `host:port`, `[IPv6]:port`, or `[IPv6%zone]:port`.\n *\n * **Details**\n *\n * IPv6 hosts must be bracketed and other hosts must not be. The port is\n * required and must be an unpadded decimal integer from 0 through 65535. A\n * zone follows the `%` directly; the percent-encoded `%25` separator of RFC\n * 6874 URLs is not decoded, because `[fe80::1%253]:80` would be ambiguous.\n *\n * **Example** (Parsing host and port strings)\n *\n * ```ts import.meta.vitest\n * import { Result } from \"effect\"\n * import { Host } from \"effect/net\"\n *\n * const endpoint = Result.getOrThrow(Host.hostPortFromString(\"DB.internal:5432\"))\n * endpoint.host // => \"db.internal\"\n * endpoint.port // => 5432\n * Host.formatHostPort(Result.getOrThrow(Host.hostPortFromString(\"[::1]:80\"))) // => \"[::1]:80\"\n * ```\n *\n * @see {@link formatHostPort} for the inverse operation\n * @stability experimental\n * @category decoding\n * @since 4.0.0\n */\nexport const hostPortFromString = input => {\n let hostText;\n let portText;\n if (input.startsWith(\"[\")) {\n const end = input.indexOf(\"]\");\n if (end === -1 || input[end + 1] !== \":\") return hostError(input, \"expected [IPv6]:port\");\n hostText = input.slice(1, end);\n portText = input.slice(end + 2);\n if (!hostText.includes(\":\")) return hostError(input, \"only IPv6 addresses use brackets\");\n } else {\n const separator = input.lastIndexOf(\":\");\n if (separator === -1) return hostError(input, \"expected host:port\");\n if (input.indexOf(\":\") !== separator) return hostError(input, \"IPv6 addresses must be bracketed\");\n hostText = input.slice(0, separator);\n portText = input.slice(separator + 1);\n }\n if (!/^(0|[1-9]\\d*)$/.test(portText)) {\n return hostError(input, \"port must be an unpadded decimal integer\");\n }\n const port = Number(portText);\n if (!isPort(port)) return hostError(input, \"port must be an integer from 0 through 65535\");\n return Result.map(hostFromString(hostText), host => makeHostPort(host, port));\n};\n/**\n * Parses a trusted `host:port` string, throwing on failure.\n *\n * @stability experimental\n * @category unsafe\n * @since 4.0.0\n */\nexport const hostPortFromStringUnsafe = input => Result.getOrThrow(hostPortFromString(input));\n/**\n * Converts a `HostPortInput` to an endpoint, parsing strings like\n * `hostPortFromString`, converting parts like `hostPort`, and returning\n * endpoints unchanged.\n *\n * @stability experimental\n * @category constructors\n * @since 4.0.0\n */\nexport const hostPortFromInput = input => {\n if (isHostPort(input)) return Result.succeed(input);\n if (typeof input === \"string\") return hostPortFromString(input);\n if (!hasProperty(input, \"host\") || !hasProperty(input, \"port\")) {\n return hostError(input, \"expected a host and port\");\n }\n const port = input.port;\n return Result.flatMap(hostFromInput(input.host), host => hostPort(host, port));\n};\n/**\n * Converts a trusted `HostPortInput` to an endpoint, throwing on failure.\n *\n * @stability experimental\n * @category unsafe\n * @since 4.0.0\n */\nexport const hostPortFromInputUnsafe = input => Result.getOrThrow(hostPortFromInput(input));\n/**\n * Formats a host and port, bracketing IPv6 hosts.\n *\n * @see {@link hostPortFromString} for the inverse operation\n * @stability experimental\n * @category encoding\n * @since 4.0.0\n */\nexport const formatHostPort = self => {\n const host = formatHost(self.host);\n return host.includes(\":\") ? `[${host}]:${self.port}` : `${host}:${self.port}`;\n};\n/**\n * Parses a hosts file into the addresses of each host name. Invalid entries\n * are skipped.\n *\n * **Example** (Parsing a hosts file)\n *\n * ```ts import.meta.vitest\n * import { Host, NetAddress } from \"effect/net\"\n *\n * const hosts = Host.parseHostsFile(`\n * 127.0.0.1 localhost\n * ::1 localhost ip6-localhost # loopback\n * `)\n * hosts.get(Host.domainNameFromStringUnsafe(\"localhost\"))?.map(NetAddress.formatIp) // => [\"127.0.0.1\", \"::1\"]\n * ```\n *\n * @stability experimental\n * @category decoding\n * @since 4.0.0\n */\nexport const parseHostsFile = text => {\n const hosts = new Map();\n for (const line of text.split(/\\r?\\n/)) {\n const comment = line.indexOf(\"#\");\n const [first, ...names] = (comment === -1 ? line : line.slice(0, comment)).trim().split(/\\s+/);\n const address = NetAddress.ipFromString(first);\n if (Result.isFailure(address)) continue;\n for (const name of names) {\n const domain = domainNameFromString(name);\n if (Result.isFailure(domain)) continue;\n const key = toRelative(domain.success);\n const addresses = hosts.get(key);\n if (addresses === undefined) hosts.set(key, [address.success]);else if (!addresses.some(existing => Equal.equals(existing, address.success))) addresses.push(address.success);\n }\n }\n return hosts;\n};\n//# sourceMappingURL=Host.js.map","/**\n * Host name resolution, DNS queries, and DNS record values.\n *\n * `lookup` resolves a host name to the addresses used to connect to it,\n * `resolve` queries DNS records of one type, and `reverse` looks up the names\n * of an address. Runtime packages provide the `Dns` service from the host\n * platform's resolver, whose `lookup` uses the operating system resolver\n * (`getaddrinfo`) and therefore also reads the hosts file and other system\n * sources, not only DNS. `AddressResolver` builds on `lookup` to resolve\n * `host:port` endpoints.\n *\n * @stability experimental\n * @since 4.0.0\n */\nimport * as Arr from \"../Array.js\";\nimport * as Context from \"../Context.js\";\nimport * as Data from \"../Data.js\";\nimport * as Duration from \"../Duration.js\";\nimport * as Effect from \"../Effect.js\";\nimport * as Hex from \"../encoding/Hex.js\";\nimport * as Equal from \"../Equal.js\";\nimport * as Hash from \"../Hash.js\";\nimport * as Inspectable from \"../Inspectable.js\";\nimport * as Layer from \"../Layer.js\";\nimport { hasProperty } from \"../Predicate.js\";\nimport * as Result from \"../Result.js\";\nimport * as Host from \"./Host.js\";\nimport * as NetAddress from \"./NetAddress.js\";\nconst RecordTypeId = \"~effect/net/Dns/DnsRecord\";\nconst isUint8 = u => Number.isInteger(u) && u >= 0 && u <= 0xff;\nconst isUint16 = u => Number.isInteger(u) && u >= 0 && u <= 0xffff;\nconst isUint32 = u => Number.isInteger(u) && u >= 0 && u <= 0xffffffff;\nconst isString = u => typeof u === \"string\";\n// SOA timers are 32-bit unsigned counts of seconds on the wire.\nconst isTimer = u => Duration.isDuration(u) && Duration.isFinite(u) && isUint32(Duration.toSeconds(u));\nconst recordFields = {\n A: {\n address: NetAddress.isIpv4Address\n },\n AAAA: {\n address: NetAddress.isIpv6Address\n },\n CAA: {\n critical: u => typeof u === \"boolean\",\n tag: u => isString(u) && /^[a-z0-9]+$/i.test(u),\n value: isString\n },\n CNAME: {\n target: Host.isDomainName\n },\n MX: {\n exchange: Host.isDomainName,\n priority: isUint16\n },\n NAPTR: {\n order: isUint16,\n preference: isUint16,\n flags: isString,\n service: isString,\n regexp: isString,\n replacement: Host.isDomainName\n },\n NS: {\n host: Host.isDomainName\n },\n PTR: {\n host: u => isString(u) && u.length > 0\n },\n SOA: {\n primary: Host.isDomainName,\n admin: u => isString(u) && u.length > 0,\n serial: isUint32,\n refresh: isTimer,\n retry: isTimer,\n expire: isTimer,\n minimum: isTimer\n },\n SRV: {\n target: Host.isDomainName,\n port: isUint16,\n priority: isUint16,\n weight: isUint16\n },\n TLSA: {\n certUsage: isUint8,\n selector: isUint8,\n matchingType: isUint8,\n data: u => u instanceof Uint8Array && u.length > 0\n },\n TXT: {\n chunks: u => Array.isArray(u) && u.length > 0 && u.every(isString)\n }\n};\n/**\n * Every supported record type.\n *\n * @stability experimental\n * @category constants\n * @since 4.0.0\n */\nexport const recordTypes = /*#__PURE__*/Object.keys(recordFields);\n/**\n * Returns `true` when a value is a supported record type.\n *\n * @stability experimental\n * @category guards\n * @since 4.0.0\n */\nexport const isRecordType = u => recordTypes.includes(u);\n/**\n * Returns `true` when a value is a DNS record.\n *\n * @stability experimental\n * @category guards\n * @since 4.0.0\n */\nexport const isDnsRecord = u => hasProperty(u, RecordTypeId);\nconst RecordPrototype = {\n ...Inspectable.BaseProto,\n [RecordTypeId]: RecordTypeId,\n [Equal.symbol](that) {\n return isDnsRecord(that) && that._tag === this._tag && Object.keys(this).every(key => Equal.equals(this[key], that[key]));\n },\n [Hash.symbol]() {\n return Hash.structureKeys(this, Object.keys(this));\n },\n toString() {\n return formatRecord(this);\n },\n toJSON() {\n return {\n ...this\n };\n }\n};\n/**\n * Creates a checked DNS record of a record type from its fields.\n *\n * **Details**\n *\n * Every field is checked at runtime: addresses must belong to the record's\n * address family, names must be normalized domain names, priorities, weights,\n * and ports must be 16-bit unsigned integers, the SOA serial and timers must be\n * 32-bit unsigned integers (the timers in whole seconds), the TLSA fields must\n * be 8-bit unsigned integers with non-empty `data`, which is copied, TXT\n * records need at least one chunk, and CAA property tags must be alphanumeric.\n * Fields that do not belong to the record type are ignored.\n *\n * **Example** (Creating a service record)\n *\n * ```ts import.meta.vitest\n * import { Result } from \"effect\"\n * import { Dns, Host } from \"effect/net\"\n *\n * const record = Result.getOrThrow(Dns.makeRecord(\"SRV\", {\n * target: Host.domainNameFromStringUnsafe(\"db.internal\"),\n * port: 5432,\n * priority: 10,\n * weight: 5\n * }))\n * Dns.formatRecord(record) // => \"SRV 10 5 5432 db.internal\"\n * ```\n *\n * @stability experimental\n * @category constructors\n * @since 4.0.0\n */\nexport const makeRecord = (type, fields) => {\n if (!isRecordType(type)) {\n return Result.fail(new NetAddress.NetAddressError({\n input: type,\n message: \"unknown DNS record type\"\n }));\n }\n const input = typeof fields === \"object\" && fields !== null ? fields : {};\n const self = Object.create(RecordPrototype);\n self._tag = type;\n for (const [key, check] of Object.entries(recordFields[type])) {\n const value = input[key];\n if (!check(value)) {\n return Result.fail(new NetAddress.NetAddressError({\n input: fields,\n message: `invalid ${type} record ${key}`\n }));\n }\n self[key] = Array.isArray(value) ? Object.freeze([...value]) : value instanceof Uint8Array ? new Uint8Array(value) : value;\n }\n return Result.succeed(Object.freeze(self));\n};\n/**\n * Creates a trusted DNS record of a record type from its fields, throwing on\n * failure.\n *\n * @stability experimental\n * @category unsafe\n * @since 4.0.0\n */\nexport const makeRecordUnsafe = (type, fields) => Result.getOrThrow(makeRecord(type, fields));\nconst encoder = /*#__PURE__*/new TextEncoder();\nconst decimalEscape = byte => `\\\\${byte.toString().padStart(3, \"0\")}`;\n// Quotes a character string in DNS presentation format (RFC 1035, section 5.1):\n// `\"` and `\\` are escaped, and bytes outside printable ASCII are written as `\\DDD`.\nconst quote = value => {\n let out = \"\\\"\";\n for (const byte of encoder.encode(value)) {\n out += byte === 0x22 || byte === 0x5c ? `\\\\${String.fromCharCode(byte)}` : byte < 0x20 || byte > 0x7e ? decimalEscape(byte) : String.fromCharCode(byte);\n }\n return out + \"\\\"\";\n};\nconst nameSpecials = [0x22, 0x24, 0x28, 0x29, 0x3b, 0x40];\n// Writes a name held as text, such as `Ptr.host`, in DNS presentation format:\n// its `\\.` and `\\\\` escapes are kept, other special characters are escaped, and\n// spaces and bytes outside printable ASCII are written as `\\DDD`.\nconst formatName = text => {\n const bytes = encoder.encode(text);\n let out = \"\";\n for (let i = 0; i < bytes.length; i++) {\n const byte = bytes[i];\n if (byte === 0x5c) {\n const next = bytes[i + 1];\n if (next === 0x2e || next === 0x5c) {\n out += `\\\\${String.fromCharCode(next)}`;\n i++;\n } else {\n out += \"\\\\\\\\\";\n }\n } else if (byte <= 0x20 || byte > 0x7e) {\n out += decimalEscape(byte);\n } else {\n out += nameSpecials.includes(byte) ? `\\\\${String.fromCharCode(byte)}` : String.fromCharCode(byte);\n }\n }\n return out;\n};\n/**\n * Formats a record in DNS presentation format, prefixed by its type.\n *\n * @stability experimental\n * @category encoding\n * @since 4.0.0\n */\nexport const formatRecord = self => {\n switch (self._tag) {\n case \"A\":\n case \"AAAA\":\n return `${self._tag} ${NetAddress.formatIp(self.address)}`;\n case \"CAA\":\n return `CAA ${self.critical ? 128 : 0} ${self.tag} ${quote(self.value)}`;\n case \"CNAME\":\n return `CNAME ${self.target}`;\n case \"MX\":\n return `MX ${self.priority} ${self.exchange}`;\n case \"NAPTR\":\n return `NAPTR ${self.order} ${self.preference} ${quote(self.flags)} ${quote(self.service)} ${quote(self.regexp)} ${self.replacement}`;\n case \"NS\":\n return `NS ${self.host}`;\n case \"PTR\":\n return `PTR ${formatName(self.host)}`;\n case \"SOA\":\n return `SOA ${self.primary} ${formatName(self.admin)} ${self.serial} ${Duration.toSeconds(self.refresh)} ${Duration.toSeconds(self.retry)} ${Duration.toSeconds(self.expire)} ${Duration.toSeconds(self.minimum)}`;\n case \"SRV\":\n return `SRV ${self.priority} ${self.weight} ${self.port} ${self.target}`;\n case \"TLSA\":\n return `TLSA ${self.certUsage} ${self.selector} ${self.matchingType} ${Hex.encode(self.data).toUpperCase()}`;\n case \"TXT\":\n return `TXT ${self.chunks.map(quote).join(\" \")}`;\n }\n};\n/**\n * Returns the reverse-lookup domain name for an IP address, in `in-addr.arpa`\n * for IPv4 or `ip6.arpa` for IPv6.\n *\n * **Example** (Building reverse-lookup names)\n *\n * ```ts import.meta.vitest\n * import { Dns, NetAddress } from \"effect/net\"\n *\n * Dns.reverseName(NetAddress.ipFromStringUnsafe(\"192.0.2.1\")) // => \"1.2.0.192.in-addr.arpa\"\n * ```\n *\n * @stability experimental\n * @category converting\n * @since 4.0.0\n */\nexport const reverseName = address => {\n if (NetAddress.isIpv4Address(address)) {\n return `${[...NetAddress.ipv4ToOctets(address)].reverse().join(\".\")}.in-addr.arpa`;\n }\n const nibbles = [];\n for (const octet of NetAddress.ipv6ToOctets(address)) {\n nibbles.push((octet >> 4).toString(16), (octet & 0xf).toString(16));\n }\n return `${nibbles.reverse().join(\".\")}.ip6.arpa`;\n};\n// =============================================================================\n// Name servers\n// =============================================================================\n/**\n * Parses the address of a name server: an IP address, which uses port 53, or\n * an IP address and port.\n *\n * **Details**\n *\n * IPv6 addresses with a port are written in brackets, and IPv6 addresses\n * without one are not.\n *\n * **Example** (Parsing name server addresses)\n *\n * ```ts import.meta.vitest\n * import { Result } from \"effect\"\n * import { Dns, NetAddress } from \"effect/net\"\n *\n * const format = (input: string) => Result.map(Dns.nameServerFromString(input), NetAddress.formatInet)\n *\n * format(\"192.0.2.53\") // => Result.succeed(\"192.0.2.53:53\")\n * format(\"2001:db8::53\") // => Result.succeed(\"[2001:db8::53]:53\")\n * format(\"[2001:db8::53]:5353\") // => Result.succeed(\"[2001:db8::53]:5353\")\n * Result.isFailure(format(\"ns.example\")) // => true\n * ```\n *\n * @stability experimental\n * @category decoding\n * @since 4.0.0\n */\nexport const nameServerFromString = input => NetAddress.inetAddressFromString(input.startsWith(\"[\") || /^[^:]*:\\d+$/.test(input) ? input : input.includes(\":\") ? `[${input}]:53` : `${input}:53`);\n/**\n * Converts a name server to the internet address to query. Strings are parsed\n * like `nameServerFromString`, internet addresses and address parts with a\n * port are converted like `NetAddress.inetAddressFromInput`, and other IP\n * address inputs are converted like `NetAddress.ipFromInput` and use port 53.\n *\n * @stability experimental\n * @category constructors\n * @since 4.0.0\n */\nexport const nameServerFromInput = input => typeof input === \"string\" ? nameServerFromString(input) : \"port\" in input ? NetAddress.inetAddressFromInput(input) : Result.map(NetAddress.ipFromInput(input), address => NetAddress.inetAddressUnsafe(address, 53));\n/**\n * A failed lookup, query, or reverse lookup.\n *\n * @stability experimental\n * @category errors\n * @since 4.0.0\n */\nexport class DnsError extends /*#__PURE__*/Data.TaggedError(\"DnsError\") {\n /**\n * Formats the reason, operation, and name of the failed resolution.\n *\n * @since 4.0.0\n */\n get message() {\n return `${this.reason}: Dns.${this.method} (${this.hostname}${this.recordType === undefined ? \"\" : ` ${this.recordType}`})`;\n }\n /**\n * Whether the failure is transient and the operation may succeed if retried.\n *\n * @since 4.0.0\n */\n get isTemporary() {\n return this.reason === \"Timeout\" || this.reason === \"Temporary\" || this.reason === \"ServerFailure\";\n }\n}\n/**\n * Service that resolves names to addresses, queries DNS records, and looks up\n * the names of addresses.\n *\n * **Details**\n *\n * Every operation either returns at least one result or fails with a\n * {@link DnsError}.\n *\n * @stability experimental\n * @category services\n * @since 4.0.0\n */\nexport class Dns extends /*#__PURE__*/Context.Service()(\"effect/net/Dns\") {}\nconst notFound = (method, hostname, recordType) => Effect.fail(new DnsError({\n reason: \"NotFound\",\n method,\n hostname,\n recordType\n}));\nconst badName = (method, hostname, cause, recordType) => Effect.fail(new DnsError({\n reason: \"BadName\",\n method,\n hostname,\n recordType,\n cause\n}));\nconst asciiName = /^[\\w.-]+$/;\n/**\n * Creates a `Dns` service from platform resolver operations.\n *\n * **Details**\n *\n * Lookup and query names are parsed and normalized, and reverse lookup\n * addresses are parsed, before platform callbacks receive them. Invalid names\n * and addresses fail with `BadName`.\n *\n * The constructor filters lookups by the requested address family, keeps only\n * records of the requested type, removes duplicates, and turns empty results\n * into `NotFound` failures. `reverse` receives the names of an address and\n * keeps those that are valid host names, failing with `InvalidResponse` when\n * there are names but none is valid. Without a `reverse` operation, the names\n * are those of the PTR records at the address's `reverseName`, and failures of\n * that query are reported as failures of `reverse`.\n *\n * Only `lookup` is required. Platforms that can resolve addresses but cannot\n * query records, such as browsers, omit `resolve`; record queries, and reverse\n * lookups without a `reverse` operation, then fail with `Unsupported`.\n *\n * @stability experimental\n * @category constructors\n * @since 4.0.0\n */\nexport const make = impl => {\n const inFamily = family => address => family === undefined || NetAddress.isFamily(address, family);\n const resolveRecords = impl.resolve ?? ((name, type) => Effect.fail(new DnsError({\n reason: \"Unsupported\",\n method: \"resolve\",\n hostname: name,\n recordType: type\n })));\n const reverseNames = impl.reverse ?? (address => resolveRecords(reverseName(address), \"PTR\").pipe(Effect.map(Arr.flatMap(record => record._tag === \"PTR\" ? [record.host] : [])), Effect.mapError(error => new DnsError({\n reason: error.reason,\n method: \"reverse\",\n hostname: NetAddress.formatIp(address),\n cause: error.cause\n }))));\n const lookup = (input, options) => Result.match(Host.domainNameFromInput(input), {\n onFailure: cause => badName(\"lookup\", input, cause),\n onSuccess: host => impl.lookup(host, options?.family).pipe(Effect.flatMap(addresses => Arr.match(Arr.dedupe(addresses.filter(inFamily(options?.family))), {\n onEmpty: () => notFound(\"lookup\", host),\n onNonEmpty: Effect.succeed\n })))\n });\n return Dns.of({\n lookup,\n resolve: (input, type) => Result.match(Host.domainNameFromInput(input), {\n onFailure: cause => badName(\"resolve\", input, cause, type),\n onSuccess: name => resolveRecords(name, type).pipe(Effect.flatMap(records => Arr.match(Arr.dedupe(records.filter(record => record._tag === type)), {\n onEmpty: () => notFound(\"resolve\", name, type),\n onNonEmpty: Effect.succeed\n })))\n }),\n reverse: input => Result.match(NetAddress.ipFromInput(input), {\n onFailure: cause => badName(\"reverse\", String(input), cause),\n onSuccess: address => reverseNames(address).pipe(Effect.flatMap(names => {\n const hostname = NetAddress.formatIp(address);\n // Only ASCII names: `domainNameFromString` would convert UTF-8 labels\n // to a different, `xn--` name.\n const hosts = Arr.dedupe(Arr.filterMap(names.filter(name => asciiName.test(name)), Host.domainNameFromString));\n return Arr.isReadonlyArrayNonEmpty(hosts) ? Effect.succeed(hosts) : names.length > 0 ? Effect.fail(new DnsError({\n reason: \"InvalidResponse\",\n method: \"reverse\",\n hostname\n })) : notFound(\"reverse\", hostname);\n }))\n })\n });\n};\nconst zoneKey = name => name.length > 1 && name.endsWith(\".\") ? name.slice(0, -1) : name;\n/**\n * Creates a `Dns` service that answers from fixed data.\n *\n * **When to use**\n *\n * Use to test code that depends on `Dns`, or to provide fixed names on\n * platforms without a resolver.\n *\n * **Details**\n *\n * Names without matching addresses or records fail with `NotFound`. CNAME\n * records are returned by `CNAME` queries but are not followed.\n *\n * **Example** (Looking up a name with a static resolver)\n *\n * ```ts import.meta.vitest\n * import { Effect, Result } from \"effect\"\n * import { Dns, NetAddress } from \"effect/net\"\n *\n * const dns = Result.getOrThrow(Dns.makeStatic({\n * hosts: { \"db.internal\": [\"10.0.0.5\"] }\n * }))\n *\n * const program = dns.lookup(\"db.internal\").pipe(\n * Effect.map((addresses) => addresses.map(NetAddress.formatIp))\n * )\n *\n * await Effect.runPromise(program) // => [\"10.0.0.5\"]\n * ```\n *\n * @see {@link layerStatic}\n * @stability experimental\n * @category constructors\n * @since 4.0.0\n */\nexport const makeStatic = zone => {\n const entries = new Map();\n const entry = name => Result.map(Host.domainNameFromString(name), domain => {\n const key = zoneKey(domain);\n let current = entries.get(key);\n if (current === undefined) {\n current = {\n addresses: [],\n records: []\n };\n entries.set(key, current);\n }\n return current;\n });\n for (const [name, addresses] of Object.entries(zone.hosts ?? {})) {\n const result = entry(name);\n if (Result.isFailure(result)) return Result.fail(result.failure);\n for (const input of addresses) {\n const address = NetAddress.ipFromInput(input);\n if (Result.isFailure(address)) return Result.fail(address.failure);\n result.success.addresses.push(address.success);\n }\n }\n for (const [name, records] of Object.entries(zone.records ?? {})) {\n const result = entry(name);\n if (Result.isFailure(result)) return Result.fail(result.failure);\n for (const record of records) {\n if (!isDnsRecord(record)) {\n return Result.fail(new NetAddress.NetAddressError({\n input: record,\n message: \"expected a DNS record\"\n }));\n }\n result.success.records.push(record);\n }\n }\n const recordsAt = name => entries.get(zoneKey(name))?.records ?? [];\n return Result.succeed(make({\n lookup: host => Effect.sync(() => [...(entries.get(zoneKey(host))?.addresses ?? []), ...recordsAt(host).flatMap(record => record._tag === \"A\" || record._tag === \"AAAA\" ? [record.address] : [])]),\n resolve: name => Effect.sync(() => recordsAt(name)),\n reverse: address => Effect.sync(() => [...[...entries].flatMap(([name, current]) => current.addresses.some(candidate => Equal.equals(candidate, address)) ? [name] : []), ...recordsAt(reverseName(address)).flatMap(record => record._tag === \"PTR\" ? [record.host] : [])])\n }));\n};\n/**\n * Creates a layer that provides a `Dns` service answering from fixed data.\n *\n * @see {@link makeStatic} for the resolution rules\n * @stability experimental\n * @category layers\n * @since 4.0.0\n */\nexport const layerStatic = zone => Layer.effect(Dns, Effect.fromResult(makeStatic(zone)));\n//# sourceMappingURL=Dns.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 * @stability stable\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 Aead_ from \"./crypto/Aead.js\";\nimport * as Cipher_ from \"./crypto/Cipher.js\";\nimport * as KeyAgreement_ from \"./crypto/KeyAgreement.js\";\nimport * as KeyFormat_ from \"./crypto/KeyFormat.js\";\nimport * as KeyWrap_ from \"./crypto/KeyWrap.js\";\nimport * as Mac_ from \"./crypto/Mac.js\";\nimport * as Signature_ from \"./crypto/Signature.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 Base64 from \"./encoding/Base64.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 Cookies_ from \"./http/Cookies.js\";\nimport * as Headers_ from \"./http/Headers.js\";\nimport * as UrlParams_internal from \"./http/internal/urlParams.js\";\nimport * as UrlParams_ from \"./http/UrlParams.js\";\nimport { NodeInspectSymbol } from \"./Inspectable.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 * as Dns_ from \"./net/Dns.js\";\nimport * as Host_ from \"./net/Host.js\";\nimport * as IpInterface_ from \"./net/IpInterface.js\";\nimport * as IpNetwork_ from \"./net/IpNetwork.js\";\nimport * as NetAddress_ from \"./net/NetAddress.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 SemVer_ from \"./SemVer.js\";\nimport * as SemVerRange_ from \"./SemVerRange.js\";\nimport * as Struct_ from \"./Struct.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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 toJSON() {\n return {\n _tag: this._tag,\n message: this.message\n };\n }\n [NodeInspectSymbol]() {\n return this.toJSON();\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 or an object mapping names to string or number values.\n * Validates that the input is one of those values. Numeric 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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\n * @category schemas\n * @since 4.0.0\n */\nexport const String = /*#__PURE__*/make(SchemaAST.string);\n/**\n * Schema for `string & {}`. Validates that the input is `typeof` `\"string\"`.\n *\n * **When to use**\n *\n * Use with {@link Union} and {@link Literals} when a value may be any string\n * and known literals should stay available for editor autocomplete.\n *\n * **Details**\n *\n * `string & {}` stays alongside string literals in a union, so editors keep\n * suggesting those literals. Any string still passes validation. Read the\n * literals from the {@link Literals} member.\n *\n * **Example** (Suggesting known HTTP methods)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const Method = Schema.Union([\n * Schema.StringForLiteralAutocomplete,\n * Schema.Literals([\"GET\", \"POST\"])\n * ])\n *\n * // Type: \"GET\" | \"POST\" | (string & {})\n * Method.make(\"PATCH\") // => \"PATCH\"\n * Method.members[1].literals // => [\"GET\", \"POST\"]\n * ```\n *\n * @see {@link String} for a schema whose type is plain `string`.\n * @see {@link Literals} for the known literals to include in the union.\n * @stability stable\n * @category schemas\n * @since 4.0.0\n */\nexport const StringForLiteralAutocomplete = 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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * Dynamic records reject value schemas wrapped with {@link optionalKey} or\n * {@link optional}. Index signatures already allow keys to be absent; use\n * {@link UndefinedOr} when existing entries may contain `undefined`. Optional\n * value schemas remain valid for finite literal keys, which become declared\n * properties.\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 and enum keys are\n * declared fields and may therefore be inherited. Output key order is not\n * 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 * @stability stable\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 * The base schema must have an object-shaped encoded type. Whole-object\n * transformations are not supported, even with an empty rest array. Apply\n * transformations such as `Schema.fromJsonString` to the completed\n * `StructWithRest` schema instead. Object-shaped encoded types alone do not\n * guarantee compatibility: unsupported encodings are still rejected at runtime.\n * Transformations on individual fields remain supported.\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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(isBetweenLength(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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * Intersects a schema's output type with `Brand.Brand<B>` to prevent accidental\n * 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 * - `identifier` must be a single concrete string literal. Widened strings,\n * unions, and open template literal types are rejected.\n * - `brand` only narrows the TypeScript output type. It does not change the\n * schema's runtime AST or add runtime checks.\n * - Schema representations and generated schema code omit the brand. Reapply\n * `brand` after rebuilding or generating a schema when the nominal type is\n * still required.\n *\n * @see {@link fromBrand} for applying a Brand constructor's checks along with its branded type\n *\n * @stability stable\n * @category branding\n * @since 3.10.0\n */\nexport function brand(identifier) {\n return schema => make(schema.ast, {\n schema,\n identifier\n });\n}\n/**\n * Creates a branded schema from a {@link Brand.Constructor}, applying the\n * constructor's checks and branded type to the underlying schema.\n *\n * **When to use**\n *\n * Use to reuse the checks from a constructor with one concrete brand key.\n *\n * **Gotchas**\n *\n * `identifier` must match the constructor's only brand key. Apply `fromBrand`\n * repeatedly to compose distinct brands, and use {@link Union} to represent\n * alternatives.\n *\n * @see {@link brand} for adding a brand without constructor checks\n *\n * @stability stable\n * @category branding\n * @since 3.10.0\n */\nexport function fromBrand(identifier, ctor) {\n return self =>\n // The constructor already guarantees a single concrete brand key.\n (ctor.checks ? self.check(...ctor.checks) : self).pipe(brand(identifier));\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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.makeTransformation(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 * @stability stable\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 * @stability stable\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 * @stability stable\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 if (effectIsExit(self) && self._tag === \"Success\") {\n return self;\n }\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 when multiple members use the same discriminant property key,\n * including members of nested unions. Numeric and string values such as `1`\n * and `\"1\"` count as duplicates.\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 * @stability stable\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 tag,\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 `tag`, `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 * @stability stable\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 tag,\n guards,\n isAnyOf,\n match,\n matchOrElse\n } = toTaggedUnion(\"_tag\")(union);\n return make(union.ast, {\n tag,\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 * @stability stable\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 * @stability stable\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 * @stability stable\n * @category transforming\n * @since 4.0.0\n */\nexport function link() {\n return (encodeTo, transformation) => {\n return new SchemaAST.Link(encodeTo.ast, SchemaTransformation.makeTransformation(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 * const message = Result.isFailure(result) ? result.failure.message : \"\"\n * message // => \"password and confirmPassword must match\\n at [\\\"password\\\"]\"\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 * const message = Result.isFailure(result) ? result.failure.message : \"\"\n * message // => \"b must be greater than 0\\n at [\\\"b\\\"]\\nc must be greater than 0\\n at [\\\"c\\\"]\"\n * ```\n *\n * @stability stable\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 * @stability stable\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 * @stability stable\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 * Unless annotations override `toJsonSchema`, JSON Schema receives a `pattern`\n * only when the JavaScript RegExp uses the Unicode flag and its other flags are\n * `d`, `g`, or `y`. Sticky patterns are anchored at the start of the string.\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 * @stability stable\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 canExport = /^[dg]*uy?$/.test(flags);\n const runtimeRegExp = flags === \"\" ? `new globalThis.RegExp(${format(source)})` : `new globalThis.RegExp(${format(source)}, ${format(flags)})`;\n return SchemaAST.isPattern(regExp, {\n toJsonSchema: () => canExport ? {\n pattern: flags.endsWith(\"y\") ? `^(?:${source})` : source\n } : [{}, true],\n toCode: () => ({\n runtime: `Schema.isPattern(${runtimeRegExp})`\n }),\n ...annotations\n });\n}\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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})$/u;\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 * @stability stable\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 toCode: () => ({\n runtime: \"Schema.isGUID()\"\n }),\n ...annotations\n });\n}\nconst ULID_REGEXP = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/u;\n/**\n * Validates that a string is a valid ULID (Universally Unique Lexicographically\n * Sortable Identifier).\n *\n * **Details**\n *\n * Accepts uppercase and lowercase characters. The first character must be\n * between `0` and `7` so the value fits in 128 bits.\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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isULID(annotations) {\n return isPattern(ULID_REGEXP, {\n representation: {\n id: \"effect/schema/isULID\",\n payload: null\n },\n toCode: () => ({\n runtime: \"Schema.isULID()\"\n }),\n ...annotations\n });\n}\n// oxlint-disable-next-line no-control-regex\nconst ASCII_REGEXP = /^[\\x00-\\x7F]*$/u;\n/**\n * Validates that a string contains only ASCII characters.\n *\n * **When to use**\n *\n * Use when a value must stay within the 7-bit ASCII range, for example\n * identifiers, protocol tokens, or data sent to systems that reject\n * non-ASCII input.\n *\n * **Details**\n *\n * This check accepts strings whose characters are all in the range `U+0000`\n * to `U+007F`, including control characters and the empty string.\n *\n * JSON Schema:\n *\n * This check corresponds to a `pattern` constraint in JSON Schema that matches\n * ASCII-only strings.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies a `patterns`\n * constraint to ensure generated strings match the ASCII pattern.\n *\n * @stability unstable\n * @category validation\n * @since 4.0.6\n */\nexport function isAscii(annotations) {\n return isPattern(ASCII_REGEXP, {\n expected: \"an ASCII string\",\n representation: {\n id: \"effect/schema/isAscii\",\n payload: null\n },\n toCode: () => ({\n runtime: \"Schema.isAscii()\"\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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isBase64(annotations) {\n const pattern = \"^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$\";\n // `pattern` overflows the V8 stack on large inputs\n const regExp = /^[0-9a-zA-Z+/]*={0,2}$/;\n return makeFilter(s => s.length % 4 === 0 && regExp.test(s), {\n expected: \"a base64 encoded string\",\n representation: {\n id: \"effect/schema/isBase64\",\n payload: null\n },\n toJsonSchema: () => ({\n pattern\n }),\n arbitraryConstraint: {\n patterns: [{\n source: pattern,\n flags: \"\"\n }]\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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isBase64Url(annotations) {\n const pattern = \"^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$\";\n // `pattern` overflows the V8 stack on large inputs\n const regExp = /^[0-9a-zA-Z-_]*={0,2}$/;\n return makeFilter(s => regExp.test(s) && (s.endsWith(\"=\") ? s.length % 4 === 0 : s.length % 4 !== 1), {\n expected: \"a base64url encoded string\",\n representation: {\n id: \"effect/schema/isBase64Url\",\n payload: null\n },\n toJsonSchema: () => ({\n pattern\n }),\n arbitraryConstraint: {\n patterns: [{\n source: pattern,\n flags: \"\"\n }]\n },\n toCode: () => ({\n runtime: \"Schema.isBase64Url()\"\n }),\n ...annotations\n });\n}\nfunction literalToJsonSchema(literal, original, pattern) {\n if (literal.length === 0) return original.length === 0 ? {} : [{}, true];\n const constraint = {\n pattern: new globalThis.RegExp(pattern).source\n };\n return literal === original ? constraint : [constraint, true];\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. If the prefix ends with a high surrogate, the JSON Schema pattern\n * omits that code unit so Unicode matching cannot reject a valid string.\n *\n * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isStartingWith(startsWith, annotations) {\n const formatted = JSON.stringify(startsWith);\n const regExp = new globalThis.RegExp(`^${RegExp_.escape(startsWith)}`);\n const jsonSchemaLiteral = startsWith.replace(/[\\uD800-\\uDBFF]$/, \"\");\n return makeFilter(s => s.startsWith(startsWith), {\n expected: `a string starting with ${formatted}`,\n representation: {\n id: \"effect/schema/isStartingWith\",\n payload: {\n startsWith\n }\n },\n toJsonSchema: () => literalToJsonSchema(jsonSchemaLiteral, startsWith, `^${RegExp_.escape(jsonSchemaLiteral)}`),\n toCode: () => ({\n runtime: `Schema.isStartingWith(${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. If the suffix begins with a low surrogate, the JSON Schema pattern\n * omits that code unit so Unicode matching cannot reject a valid string.\n *\n * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isEndingWith(endsWith, annotations) {\n const formatted = JSON.stringify(endsWith);\n const regExp = new globalThis.RegExp(`${RegExp_.escape(endsWith)}$`);\n const jsonSchemaLiteral = endsWith.replace(/^[\\uDC00-\\uDFFF]/, \"\");\n return makeFilter(s => s.endsWith(endsWith), {\n expected: `a string ending with ${formatted}`,\n representation: {\n id: \"effect/schema/isEndingWith\",\n payload: {\n endsWith\n }\n },\n toJsonSchema: () => literalToJsonSchema(jsonSchemaLiteral, endsWith, `${RegExp_.escape(jsonSchemaLiteral)}$`),\n toCode: () => ({\n runtime: `Schema.isEndingWith(${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. A leading low surrogate or trailing high surrogate is\n * omitted from the JSON Schema pattern so Unicode matching cannot reject a\n * valid string.\n *\n * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isIncluding(includes, annotations) {\n const formatted = JSON.stringify(includes);\n const regExp = new globalThis.RegExp(RegExp_.escape(includes));\n const jsonSchemaLiteral = includes.replace(/^[\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF]$/g, \"\");\n return makeFilter(s => s.includes(includes), {\n expected: `a string including ${formatted}`,\n representation: {\n id: \"effect/schema/isIncluding\",\n payload: {\n includes\n }\n },\n toJsonSchema: () => literalToJsonSchema(jsonSchemaLiteral, includes, RegExp_.escape(jsonSchemaLiteral)),\n toCode: () => ({\n runtime: `Schema.isIncluding(${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 * @stability stable\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 }, true],\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 * @stability stable\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 }, true],\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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isCapitalized(annotations) {\n return makeFilter(s => {\n const [first = \"\"] = s;\n return first.toUpperCase() === first;\n }, {\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: CAPITALIZED_PATTERN\n }, true],\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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isUncapitalized(annotations) {\n return makeFilter(s => {\n const [first = \"\"] = s;\n return first.toLowerCase() === first;\n }, {\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: UNCAPITALIZED_PATTERN\n }, true],\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 `type: \"integer\"` with `minimum: Number.MIN_SAFE_INTEGER`\n * and `maximum: Number.MAX_SAFE_INTEGER` in JSON Schema.\n *\n * Arbitrary:\n *\n * During arbitrary generation, this applies an integer constraint.\n *\n * @stability stable\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 minimum: globalThis.Number.MIN_SAFE_INTEGER,\n maximum: globalThis.Number.MAX_SAFE_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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 globalThis.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 * @stability stable\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: () => [{}, true],\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 * @stability stable\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: () => [{}, true],\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 * @stability stable\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: () => [{}, true],\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 * @stability stable\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: () => [{}, true],\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 * @stability stable\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: () => [{}, true],\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 * @stability stable\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: () => [{}, true],\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 * @stability stable\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: () => [{}, true],\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 * @stability stable\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: () => [{}, true],\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 * @stability stable\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: () => [{}, true],\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 * @stability stable\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: () => [{}, true],\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 * The bound must be finite; it is rounded down and clamped to zero. For arrays,\n * this check corresponds to `minItems`. JavaScript counts UTF-16 code units\n * while JSON Schema counts Unicode code points, so strings use\n * `minLength: Math.ceil(minLength / 2)`, the tightest lower bound that cannot\n * reject a string accepted by this check.\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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isMinLength(minLength, annotations) {\n minLength = normalizeCardinality(minLength);\n return makeIsMinLength(minLength, Math.ceil(minLength / 2), annotations);\n}\nfunction makeIsMinLength(minLength, minCodePoints, annotations) {\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 === \"string\" ? minLength <= 1 ? {\n minLength: minCodePoints\n } : [{\n minLength: minCodePoints\n }, true] : type === \"array\" ? {\n minItems: minLength\n } : type === undefined ? [{\n minLength: minCodePoints,\n minItems: minLength\n }, true] : [{}, true],\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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isNonEmpty(annotations) {\n return makeIsMinLength(1, 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 * The bound must be finite; it is rounded down and clamped to zero. This check\n * corresponds to `maxItems` for arrays. Strings use the same bound for\n * `maxLength`, which cannot reject a string accepted by this check because a\n * string has no more code points than UTF-16 code units.\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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isMaxLength(maxLength, annotations) {\n maxLength = normalizeCardinality(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 === \"string\" ? maxLength === 0 ? {\n maxLength\n } : [{\n maxLength\n }, true] : type === \"array\" ? {\n maxItems: maxLength\n } : type === undefined ? [{\n maxLength,\n maxItems: maxLength\n }, true] : [{}, true],\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 * Both bounds must be finite; they are rounded down and clamped to zero. Arrays\n * use the same bounds for `minItems` and `maxItems`. JavaScript counts UTF-16\n * code units while JSON Schema counts Unicode code points, so strings use\n * `Math.ceil(minimum / 2)` for `minLength` and `maximum` for `maxLength`. These\n * are the tightest bounds that cannot reject a string accepted by this check.\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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isBetweenLength(minimum, maximum, annotations) {\n minimum = normalizeCardinality(minimum);\n maximum = normalizeCardinality(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/isBetweenLength\",\n payload: {\n minimum,\n maximum\n }\n },\n toJsonSchema: ({\n type\n }) => type === \"string\" ? maximum === 0 || Math.ceil(minimum / 2) > maximum ? {\n minLength: Math.ceil(minimum / 2),\n maxLength: maximum\n } : [{\n minLength: Math.ceil(minimum / 2),\n maxLength: maximum\n }, true] : type === \"array\" ? {\n minItems: minimum,\n maxItems: maximum\n } : type === undefined ? [{\n minLength: Math.ceil(minimum / 2),\n maxLength: maximum,\n minItems: minimum,\n maxItems: maximum\n }, true] : [{}, true],\n toCode: () => ({\n runtime: `Schema.isBetweenLength(${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 string contains at least the specified number of Unicode code points.\n *\n * **Details**\n *\n * The bound must be finite; it is rounded down and clamped to zero. This check\n * corresponds to `minLength` in JSON Schema and guides arbitrary generation by\n * code point count.\n *\n * **Gotchas**\n *\n * Code points are not grapheme clusters: combining marks and joined emoji can\n * contribute multiple code points to one visible character. Unpaired UTF-16\n * surrogates count as one code point each. This check does not normalize strings.\n *\n * @see {@link isMinLength} for counting UTF-16 code units\n * @see {@link isMaxCodePoints}\n * @see {@link isBetweenCodePoints}\n * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isMinCodePoints(minCodePoints, annotations) {\n minCodePoints = normalizeCardinality(minCodePoints);\n return makeFilter(input => countCodePointsUpTo(input, minCodePoints) >= minCodePoints, {\n expected: `a string with at least ${minCodePoints} code points`,\n representation: {\n id: \"effect/schema/isMinCodePoints\",\n payload: {\n minCodePoints\n }\n },\n toJsonSchema: () => ({\n minLength: minCodePoints\n }),\n toCode: () => ({\n runtime: `Schema.isMinCodePoints(${minCodePoints})`\n }),\n arbitraryConstraint: {\n minCodePoints\n },\n ...annotations\n });\n}\n/**\n * Validates that a string contains at most the specified number of Unicode code points.\n *\n * **Details**\n *\n * The bound must be finite; it is rounded down and clamped to zero. This check\n * corresponds to `maxLength` in JSON Schema and guides arbitrary generation by\n * code point count.\n *\n * **Gotchas**\n *\n * Code points are not grapheme clusters: combining marks and joined emoji can\n * contribute multiple code points to one visible character. Unpaired UTF-16\n * surrogates count as one code point each. This check does not normalize strings.\n *\n * @see {@link isMaxLength} for counting UTF-16 code units\n * @see {@link isMinCodePoints}\n * @see {@link isBetweenCodePoints}\n * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isMaxCodePoints(maxCodePoints, annotations) {\n maxCodePoints = normalizeCardinality(maxCodePoints);\n return makeFilter(input => countCodePointsUpTo(input, maxCodePoints + 1) <= maxCodePoints, {\n expected: `a string with at most ${maxCodePoints} code points`,\n representation: {\n id: \"effect/schema/isMaxCodePoints\",\n payload: {\n maxCodePoints\n }\n },\n toJsonSchema: () => ({\n maxLength: maxCodePoints\n }),\n toCode: () => ({\n runtime: `Schema.isMaxCodePoints(${maxCodePoints})`\n }),\n arbitraryConstraint: {\n maxCodePoints\n },\n ...annotations\n });\n}\n/**\n * Validates that a string's Unicode code point count is within the specified inclusive range.\n *\n * **Details**\n *\n * Bounds must be finite; they are rounded down and clamped to zero. Equal bounds\n * require an exact count. This check corresponds to `minLength` and `maxLength`\n * in JSON Schema and guides arbitrary generation by code point count.\n *\n * **Gotchas**\n *\n * Code points are not grapheme clusters: combining marks and joined emoji can\n * contribute multiple code points to one visible character. Unpaired UTF-16\n * surrogates count as one code point each. This check does not normalize strings.\n *\n * @see {@link isBetweenLength} for counting UTF-16 code units\n * @see {@link isMinCodePoints}\n * @see {@link isMaxCodePoints}\n * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isBetweenCodePoints(minimum, maximum, annotations) {\n minimum = normalizeCardinality(minimum);\n maximum = normalizeCardinality(maximum);\n return makeFilter(input => {\n const count = countCodePointsUpTo(input, maximum + 1);\n return count >= minimum && count <= maximum;\n }, {\n expected: minimum === maximum ? `a string with ${minimum} code points` : `a string with between ${minimum} and ${maximum} code points`,\n representation: {\n id: \"effect/schema/isBetweenCodePoints\",\n payload: {\n minimum,\n maximum\n }\n },\n toJsonSchema: () => ({\n allOf: [{\n minLength: minimum\n }, {\n maxLength: maximum\n }]\n }),\n toCode: () => ({\n runtime: `Schema.isBetweenCodePoints(${minimum}, ${maximum})`\n }),\n arbitraryConstraint: {\n minCodePoints: minimum,\n maxCodePoints: maximum\n },\n ...annotations\n });\n}\nfunction countCodePointsUpTo(input, limit) {\n if (limit === 0) return 0;\n let count = 0;\n for (const _ of input) {\n if (++count >= limit) break;\n }\n return count;\n}\nfunction normalizeCardinality(value) {\n if (!globalThis.Number.isFinite(value)) {\n throw new globalThis.RangeError(`Expected a finite number, got ${value}`);\n }\n return Math.max(0, Math.floor(value));\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 * The bound must be finite; it is rounded down and clamped to zero.\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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isMinSize(minSize, annotations) {\n minSize = normalizeCardinality(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: () => [{}, true],\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 * The bound must be finite; it is rounded down and clamped to zero.\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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isMaxSize(maxSize, annotations) {\n maxSize = normalizeCardinality(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: () => [{}, true],\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 * Both bounds must be finite; they are rounded down and clamped to zero.\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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isBetweenSize(minimum, maximum, annotations) {\n minimum = normalizeCardinality(minimum);\n maximum = normalizeCardinality(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/isBetweenSize\",\n payload: {\n minimum,\n maximum\n }\n },\n toJsonSchema: () => [{}, true],\n toCode: () => ({\n runtime: `Schema.isBetweenSize(${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 * The bound must be finite; it is rounded down and clamped to zero.\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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isMinProperties(minProperties, annotations) {\n minProperties = normalizeCardinality(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 type\n }) => type === \"object\" ? {\n minProperties\n } : [{\n minProperties\n }, true],\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 * The bound must be finite; it is rounded down and clamped to zero.\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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isMaxProperties(maxProperties, annotations) {\n maxProperties = normalizeCardinality(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 type\n }) => type === \"object\" ? {\n maxProperties\n } : [{\n maxProperties\n }, true],\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 * Both bounds must be finite; they are rounded down and clamped to zero.\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 * @stability stable\n * @category validation\n * @since 4.0.0\n */\nexport function isBetweenProperties(minimum, maximum, annotations) {\n minimum = normalizeCardinality(minimum);\n maximum = normalizeCardinality(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/isBetweenProperties\",\n payload: {\n minimum,\n maximum\n }\n },\n toJsonSchema: ({\n type\n }) => type === \"object\" ? {\n minProperties: minimum,\n maxProperties: maximum\n } : [{\n minProperties: minimum,\n maxProperties: maximum\n }, true],\n toCode: () => ({\n runtime: `Schema.isBetweenProperties(${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 * @stability stable\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 type\n }) => type === \"object\" ? {\n propertyNames: schemas[0]\n } : [{\n propertyNames: schemas[0]\n }, true],\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 isBetweenLength} for the underlying length check\n *\n * @stability stable\n * @category schemas\n * @since 3.10.0\n */\nexport const Char = /*#__PURE__*/String.check(/*#__PURE__*/isBetweenLength(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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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});\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 * @stability stable\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 * @stability stable\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(Base64.decode(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: Base64.encode(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 * @stability stable\n * @category schemas\n * @since 4.0.0\n */\n// Read the global inside the guard: resolving globalThis.FormData at module\n// scope loads undici on Node.\nexport const FormData = /*#__PURE__*/declare(u => u 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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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});\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 * @stability stable\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 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. Strings with a scale outside ±10,000, such\n * as `\"1e300000000\"`, are rejected.\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 * @stability stable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability unstable\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 * @stability stable\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: reason => {\n switch (reason._tag) {\n case \"Fail\":\n return {\n _tag: \"Fail\",\n error: reason.error\n };\n case \"Die\":\n return {\n _tag: \"Die\",\n defect: reason.defect\n };\n case \"Interrupt\":\n return {\n _tag: \"Interrupt\",\n fiberId: reason.fiberId\n };\n }\n }\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 * @stability stable\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, \"reasons\", 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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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));\nconst dateTimeUtcFromHttpDate = /*#__PURE__*/SchemaTransformation.transformEffect({\n decode: (s, options) => Result_.match(Headers_.parseHttpDate(s), {\n onFailure: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"an HTTP date (RFC 9110 §5.6.7)\"\n }, s, options)),\n onSuccess: Effect.succeed\n }),\n encode: utc => Effect.succeed(Headers_.formatHttpDate(utc))\n});\n/**\n * Schema for HTTP date header values, such as `Date`, `Last-Modified` and\n * `Expires`, decoded as `DateTime.Utc`.\n *\n * **When to use**\n *\n * Use with HTTP API header schemas that carry dates. Decoding accepts the\n * three formats of RFC 9110 §5.6.7 and reads them as UTC; encoding emits the\n * preferred IMF-fixdate form (`Sun, 06 Nov 1994 08:49:37 GMT`).\n *\n * **Example** (Decoding an HTTP date)\n *\n * ```ts\n * import { DateTime, Schema } from \"effect\"\n *\n * const date = Schema.decodeSync(Schema.DateTimeUtcFromHttpDate)(\"Sun, 06 Nov 1994 08:49:37 GMT\")\n * const millis = DateTime.toEpochMillis(date) // => 784111777000\n * ```\n *\n * @see {@link DateTimeUtcFromString} for ISO 8601 strings\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const DateTimeUtcFromHttpDate = /*#__PURE__*/String.annotate({\n expected: \"an HTTP date string\"\n}).pipe(/*#__PURE__*/decodeTo(DateTimeUtc, dateTimeUtcFromHttpDate));\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpAddressFromString = /*#__PURE__*/netAddressFromString(IpAddress, NetAddress_.ipFromString, NetAddress_.formatIp, \"IpAddressFromString\");\nconst netAddressRefinement = (schema, guard, expected, identifier) => refine(guard, {\n expected\n})(schema).annotate({\n identifier\n});\n/**\n * Schema for already-constructed multicast IP addresses.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpMulticastAddress = /*#__PURE__*/netAddressRefinement(IpAddress, NetAddress_.isMulticast, \"a multicast address\", \"IpMulticastAddress\");\n/**\n * Schema for multicast IP addresses encoded as numeric strings.\n *\n * **Example** (Decoding a validated multicast address)\n *\n * ```ts import.meta.vitest\n * import { assert } from \"@effect/vitest\"\n * import { Schema } from \"effect\"\n * import { NetAddress } from \"effect/net\"\n *\n * const address = Schema.decodeUnknownSync(Schema.IpMulticastAddressFromString)(\"239.255.0.1\")\n * assert.isTrue(NetAddress.isMulticast(address))\n * ```\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpMulticastAddressFromString = /*#__PURE__*/netAddressRefinement(IpAddressFromString, NetAddress_.isMulticast, \"a multicast address\", \"IpMulticastAddressFromString\");\n/**\n * Schema for already-constructed multicast MAC addresses.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const MacMulticastAddress = /*#__PURE__*/netAddressRefinement(MacAddress, NetAddress_.isMulticast, \"a multicast address\", \"MacMulticastAddress\");\n/**\n * Schema for multicast MAC addresses encoded as canonical strings.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const MacMulticastAddressFromString = /*#__PURE__*/netAddressRefinement(MacAddressFromString, NetAddress_.isMulticast, \"a multicast address\", \"MacMulticastAddressFromString\");\n/**\n * Schema for already-constructed syntactic unicast IP addresses.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpUnicastAddress = /*#__PURE__*/netAddressRefinement(IpAddress, NetAddress_.isUnicast, \"a unicast address\", \"IpUnicastAddress\");\n/**\n * Schema for syntactic unicast IP addresses encoded as numeric strings.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpUnicastAddressFromString = /*#__PURE__*/netAddressRefinement(IpAddressFromString, NetAddress_.isUnicast, \"a unicast address\", \"IpUnicastAddressFromString\");\n/**\n * Schema for already-constructed unicast MAC addresses.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const MacUnicastAddress = /*#__PURE__*/netAddressRefinement(MacAddress, NetAddress_.isMacUnicast, \"a unicast address\", \"MacUnicastAddress\");\n/**\n * Schema for unicast MAC addresses encoded as canonical strings.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const MacUnicastAddressFromString = /*#__PURE__*/netAddressRefinement(MacAddressFromString, NetAddress_.isMacUnicast, \"a unicast address\", \"MacUnicastAddressFromString\");\n/**\n * Schema for the already-constructed IPv4 limited broadcast address.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv4BroadcastAddress = /*#__PURE__*/netAddressRefinement(Ipv4Address, NetAddress_.isBroadcast, \"a broadcast address\", \"Ipv4BroadcastAddress\");\n/**\n * Schema for the IPv4 limited broadcast address encoded as a string.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv4BroadcastAddressFromString = /*#__PURE__*/netAddressRefinement(Ipv4AddressFromString, NetAddress_.isBroadcast, \"a broadcast address\", \"Ipv4BroadcastAddressFromString\");\n/**\n * Schema for the already-constructed MAC all-ones broadcast address.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const MacBroadcastAddress = /*#__PURE__*/netAddressRefinement(MacAddress, NetAddress_.isMacBroadcast, \"a broadcast address\", \"MacBroadcastAddress\");\n/**\n * Schema for the MAC all-ones broadcast address encoded as a string.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const MacBroadcastAddressFromString = /*#__PURE__*/netAddressRefinement(MacAddressFromString, NetAddress_.isMacBroadcast, \"a broadcast address\", \"MacBroadcastAddressFromString\");\n/**\n * Schema for already-constructed loopback IP addresses.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpLoopbackAddress = /*#__PURE__*/netAddressRefinement(IpAddress, NetAddress_.isLoopback, \"a loopback address\", \"IpLoopbackAddress\");\n/**\n * Schema for loopback IP addresses encoded as numeric strings.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpLoopbackAddressFromString = /*#__PURE__*/netAddressRefinement(IpAddressFromString, NetAddress_.isLoopback, \"a loopback address\", \"IpLoopbackAddressFromString\");\n/**\n * Schema for already-constructed link-local IP addresses.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpLinkLocalAddress = /*#__PURE__*/netAddressRefinement(IpAddress, NetAddress_.isLinkLocal, \"a link-local address\", \"IpLinkLocalAddress\");\n/**\n * Schema for link-local IP addresses encoded as numeric strings.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpLinkLocalAddressFromString = /*#__PURE__*/netAddressRefinement(IpAddressFromString, NetAddress_.isLinkLocal, \"a link-local address\", \"IpLinkLocalAddressFromString\");\n/**\n * Schema for already-constructed unspecified IP addresses.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpUnspecifiedAddress = /*#__PURE__*/netAddressRefinement(IpAddress, NetAddress_.isUnspecified, \"an unspecified address\", \"IpUnspecifiedAddress\");\n/**\n * Schema for unspecified IP addresses encoded as numeric strings.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const IpUnspecifiedAddressFromString = /*#__PURE__*/netAddressRefinement(IpAddressFromString, NetAddress_.isUnspecified, \"an unspecified address\", \"IpUnspecifiedAddressFromString\");\n/**\n * Schema for already-constructed RFC 1918 private-use addresses.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv4PrivateAddress = /*#__PURE__*/netAddressRefinement(Ipv4Address, NetAddress_.isPrivate, \"a private address\", \"Ipv4PrivateAddress\");\n/**\n * Schema for RFC 1918 private-use addresses encoded as strings.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv4PrivateAddressFromString = /*#__PURE__*/netAddressRefinement(Ipv4AddressFromString, NetAddress_.isPrivate, \"a private address\", \"Ipv4PrivateAddressFromString\");\n/**\n * Schema for already-constructed IPv6 unique-local addresses.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv6UniqueLocalAddress = /*#__PURE__*/netAddressRefinement(Ipv6Address, NetAddress_.isUniqueLocal, \"a unique-local address\", \"Ipv6UniqueLocalAddress\");\n/**\n * Schema for IPv6 unique-local addresses encoded as strings.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const Ipv6UniqueLocalAddressFromString = /*#__PURE__*/netAddressRefinement(Ipv6AddressFromString, NetAddress_.isUniqueLocal, \"a unique-local address\", \"Ipv6UniqueLocalAddressFromString\");\n/**\n * Schema for already-constructed locally administered MAC addresses.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const MacLocallyAdministeredAddress = /*#__PURE__*/netAddressRefinement(MacAddress, NetAddress_.isMacLocallyAdministered, \"a locally administered address\", \"MacLocallyAdministeredAddress\");\n/**\n * Schema for locally administered MAC addresses encoded as strings.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const MacLocallyAdministeredAddressFromString = /*#__PURE__*/netAddressRefinement(MacAddressFromString, NetAddress_.isMacLocallyAdministered, \"a locally administered address\", \"MacLocallyAdministeredAddressFromString\");\n/**\n * Schema for already-constructed universally administered MAC addresses.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const MacUniversallyAdministeredAddress = /*#__PURE__*/netAddressRefinement(MacAddress, NetAddress_.isMacUniversallyAdministered, \"a universally administered address\", \"MacUniversallyAdministeredAddress\");\n/**\n * Schema for universally administered MAC addresses encoded as strings.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const MacUniversallyAdministeredAddressFromString = /*#__PURE__*/netAddressRefinement(MacAddressFromString, NetAddress_.isMacUniversallyAdministered, \"a universally administered address\", \"MacUniversallyAdministeredAddressFromString\");\n/**\n * Schema for already-constructed IPv4 interface address values.\n *\n * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability 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 * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const SocketAddress = /*#__PURE__*/declare(NetAddress_.isSocketAddress, {\n identifier: \"SocketAddress\"\n});\n/**\n * Schema for normalized DNS domain names.\n *\n * **Details**\n *\n * Only names already in normalized form (lowercase ASCII, with\n * internationalized labels in `xn--` form) are accepted. Use\n * {@link DomainNameFromString} to normalize arbitrary input.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DomainName = /*#__PURE__*/String.check(makeFilter(Host_.isDomainName, {\n expected: \"a normalized domain name\"\n})).pipe(brand(\"~effect/net/Host/DomainName\")).annotate({\n identifier: \"DomainName\"\n});\n/**\n * Schema for DNS domain names decoded from strings, normalizing case and\n * converting internationalized names to their ASCII form.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DomainNameFromString = /*#__PURE__*/netAddressFromString(DomainName, Host_.domainNameFromString, name => name, \"DomainNameFromString\");\n/**\n * Schema for canonical scoped IPv6 literals such as `fe80::1%eth0`.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const ScopedIpv6Literal = /*#__PURE__*/String.check(makeFilter(NetAddress_.isScopedIpv6Literal, {\n expected: \"a canonical scoped IPv6 literal\"\n})).pipe(brand(\"~effect/net/NetAddress/ScopedIpv6Literal\")).annotate({\n identifier: \"ScopedIpv6Literal\"\n});\n/**\n * Schema for scoped IPv6 literals decoded from strings, normalizing the address\n * and numeric zones.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const ScopedIpv6LiteralFromString = /*#__PURE__*/netAddressFromString(ScopedIpv6Literal, NetAddress_.scopedIpv6LiteralFromString, literal => literal, \"ScopedIpv6LiteralFromString\");\n/**\n * Schema for hosts: numeric IP addresses, scoped IPv6 literals, or domain names.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const Host = /*#__PURE__*/Union([IpAddress, ScopedIpv6Literal, DomainName]).annotate({\n identifier: \"Host\"\n});\n/**\n * Schema for hosts decoded from strings. Numeric IP strings decode to IP\n * addresses; other strings decode to scoped IPv6 literals or domain names.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const HostFromString = /*#__PURE__*/Union([IpAddressFromString, ScopedIpv6LiteralFromString, DomainNameFromString]).annotate({\n identifier: \"HostFromString\"\n});\n/**\n * Schema for already-constructed unresolved host and port values.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const HostPort = /*#__PURE__*/declare(Host_.isHostPort, {\n identifier: \"HostPort\"\n});\n/**\n * Schema for unresolved endpoints encoded as `host:port` or `[IPv6]:port`\n * strings.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const HostPortFromString = /*#__PURE__*/netAddressFromString(HostPort, Host_.hostPortFromString, Host_.formatHostPort, \"HostPortFromString\");\n/**\n * Schema for TCP and UDP port numbers from 0 through 65535.\n *\n * **Details**\n *\n * Port 0 is accepted because it asks the operating system to choose a port\n * when binding, and it matches the port range of `InetAddress` and `HostPort`.\n * `Config.Port` accepts only 1 through 65535.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const Port = /*#__PURE__*/Int.check(/*#__PURE__*/isBetween({\n minimum: 0,\n maximum: 65535\n}, {\n expected: \"a port number\"\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});\nconst durationFromIsoString = /*#__PURE__*/SchemaTransformation.transformEffect({\n decode: (s, options) => Option_.match(Duration_.fromIso(s), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"an ISO 8601 duration without years or months\"\n }, s, options)),\n onSome: Effect.succeed\n }),\n encode: (a, options) => Option_.match(Duration_.formatIso(a), {\n onNone: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"a finite Duration\"\n }, a, options)),\n onSome: Effect.succeed\n })\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\n * @category schemas\n * @since 3.10.0\n */\nexport const DurationFromMillis = /*#__PURE__*/Number.pipe(/*#__PURE__*/decodeTo(Duration, durationFromMillis));\n/**\n * Schema that decodes an ISO 8601 duration string into a `Duration`.\n *\n * **Details**\n *\n * Decoding:\n * - A string accepted by `Duration.fromIso` is decoded as a `Duration`, such\n * as `\"PT1H30M\"`, `\"P1W2D\"`, or `\"-PT0.5S\"`. Years and months are rejected\n * because they have no fixed length.\n *\n * Encoding:\n * - A finite `Duration` is encoded with `Duration.formatIso`, using days,\n * hours, minutes, and seconds. Encoding fails for `Duration.infinity` and\n * `Duration.negativeInfinity`.\n *\n * @see {@link DurationFromString} for the `\"5 seconds\"` string format\n *\n * @stability stable\n * @category schemas\n * @since 4.1.0\n */\nexport const DurationFromIsoString = /*#__PURE__*/String.annotate({\n expected: \"an ISO 8601 duration string that will be decoded as a Duration\"\n}).pipe(/*#__PURE__*/decodeTo(Duration, durationFromIsoString));\n/**\n * Schema for supported DNS record types such as `\"A\"` or `\"SRV\"`.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DnsRecordType = /*#__PURE__*/Literals(Dns_.recordTypes);\n// Addresses in JSON records must already be canonical; normalizing input is\n// left to the `*FromString` schemas.\nconst dnsCanonicalAddress = (schema, parse) => String.pipe(decodeTo(schema, SchemaTransformation.transformEffect({\n decode: (input, options) => {\n const result = parse(input);\n if (Result_.isFailure(result)) {\n return Effect.fail(new SchemaIssue.InvalidValue({\n message: result.failure.message\n }, input, options));\n }\n return NetAddress_.formatIp(result.success) === input ? Effect.succeed(result.success) : Effect.fail(new SchemaIssue.InvalidValue({\n message: \"expected a canonical address\"\n }, input, options));\n },\n encode: address => Effect.succeed(NetAddress_.formatIp(address))\n})));\nconst dnsUint8 = /*#__PURE__*/Int.check(/*#__PURE__*/isBetween({\n minimum: 0,\n maximum: 0xff\n}));\nconst dnsUint16 = /*#__PURE__*/Int.check(/*#__PURE__*/isBetween({\n minimum: 0,\n maximum: 0xffff\n}));\nconst dnsUint32 = /*#__PURE__*/Int.check(/*#__PURE__*/isBetween({\n minimum: 0,\n maximum: 0xffffffff\n}));\n// SOA timers are written as whole seconds, as in zone files.\nconst dnsSeconds = /*#__PURE__*/dnsUint32.pipe(/*#__PURE__*/decodeTo(Duration, /*#__PURE__*/SchemaTransformation.transform({\n decode: Duration_.seconds,\n encode: Duration_.toSeconds\n})));\n// Each record type is an opaque value whose JSON form is a plain object tagged\n// by record type, such as `{ \"_tag\": \"MX\", \"exchange\": \"mail.example.com\", \"priority\": 10 }`.\nconst dnsRecordOfType = (type, fields) => declare(u => Dns_.isDnsRecord(u) && u._tag === type, {\n identifier: `Dns${type.charAt(0)}${type.slice(1).toLowerCase()}Record`,\n toCodecJson: () => {\n const json = TaggedStruct(type, fields);\n return link()(json, SchemaTransformation.transformEffect({\n decode: (input, options) => {\n const {\n _tag,\n ...rest\n } = input;\n const result = Dns_.makeRecord(type, rest);\n return Result_.isSuccess(result) ? Effect.succeed(result.success) : Effect.fail(new SchemaIssue.InvalidValue({\n message: result.failure.message\n }, input, options));\n },\n // Records hold only their tag and fields as own properties.\n encode: record => Effect.succeed({\n ...record\n })\n }));\n }\n});\n/**\n * Schema for already-constructed IPv4 address (`A`) DNS records.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DnsARecord = /*#__PURE__*/dnsRecordOfType(\"A\", {\n address: /*#__PURE__*/dnsCanonicalAddress(Ipv4Address, NetAddress_.ipv4FromString)\n});\n/**\n * Schema for already-constructed IPv6 address (`AAAA`) DNS records.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DnsAaaaRecord = /*#__PURE__*/dnsRecordOfType(\"AAAA\", {\n address: /*#__PURE__*/dnsCanonicalAddress(Ipv6Address, NetAddress_.ipv6FromString)\n});\n/**\n * Schema for already-constructed certification authority authorization (`CAA`) DNS records.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DnsCaaRecord = /*#__PURE__*/dnsRecordOfType(\"CAA\", {\n critical: Boolean,\n tag: /*#__PURE__*/String.check(/*#__PURE__*/isPattern(/^[a-z0-9]+$/i)),\n value: String\n});\n/**\n * Schema for already-constructed canonical name (`CNAME`) DNS records.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DnsCnameRecord = /*#__PURE__*/dnsRecordOfType(\"CNAME\", {\n target: DomainName\n});\n/**\n * Schema for already-constructed mail exchange (`MX`) DNS records.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DnsMxRecord = /*#__PURE__*/dnsRecordOfType(\"MX\", {\n exchange: DomainName,\n priority: dnsUint16\n});\n/**\n * Schema for already-constructed naming authority pointer (`NAPTR`) DNS records.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DnsNaptrRecord = /*#__PURE__*/dnsRecordOfType(\"NAPTR\", {\n order: dnsUint16,\n preference: dnsUint16,\n flags: String,\n service: String,\n regexp: String,\n replacement: DomainName\n});\n/**\n * Schema for already-constructed name server (`NS`) DNS records.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DnsNsRecord = /*#__PURE__*/dnsRecordOfType(\"NS\", {\n host: DomainName\n});\n/**\n * Schema for already-constructed pointer (`PTR`) DNS records.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DnsPtrRecord = /*#__PURE__*/dnsRecordOfType(\"PTR\", {\n host: NonEmptyString\n});\n/**\n * Schema for already-constructed start of authority (`SOA`) DNS records.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DnsSoaRecord = /*#__PURE__*/dnsRecordOfType(\"SOA\", {\n primary: DomainName,\n admin: NonEmptyString,\n serial: dnsUint32,\n refresh: dnsSeconds,\n retry: dnsSeconds,\n expire: dnsSeconds,\n minimum: dnsSeconds\n});\n/**\n * Schema for already-constructed service locator (`SRV`) DNS records.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DnsSrvRecord = /*#__PURE__*/dnsRecordOfType(\"SRV\", {\n target: DomainName,\n port: dnsUint16,\n priority: dnsUint16,\n weight: dnsUint16\n});\n/**\n * Schema for already-constructed TLS authentication (`TLSA`) DNS records.\n *\n * **Details**\n *\n * The default JSON serializer encodes the certificate association `data` as a\n * hex string.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DnsTlsaRecord = /*#__PURE__*/dnsRecordOfType(\"TLSA\", {\n certUsage: dnsUint8,\n selector: dnsUint8,\n matchingType: dnsUint8,\n data: Uint8ArrayFromHex\n});\n/**\n * Schema for already-constructed text (`TXT`) DNS records.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DnsTxtRecord = /*#__PURE__*/dnsRecordOfType(\"TXT\", {\n chunks: /*#__PURE__*/NonEmptyArray(String)\n});\n/**\n * Schema for already-constructed DNS records of any supported record type.\n *\n * **Details**\n *\n * The default JSON serializer encodes records as objects tagged by record type,\n * with addresses and names as canonical strings, SOA timers as whole seconds,\n * and TLSA data as hex, such as\n * `{ \"_tag\": \"SRV\", \"target\": \"db.internal\", \"port\": 5432, \"priority\": 10, \"weight\": 5 }`.\n * Decoding accepts only canonical addresses and normalized domain names, and\n * reports invalid fields with their path.\n *\n * @stability experimental\n * @category schemas\n * @since 4.0.0\n */\nexport const DnsRecord = /*#__PURE__*/Union([DnsARecord, DnsAaaaRecord, DnsCaaRecord, DnsCnameRecord, DnsMxRecord, DnsNaptrRecord, DnsNsRecord, DnsPtrRecord, DnsSoaRecord, DnsSrvRecord, DnsTlsaRecord, DnsTxtRecord]).annotate({\n identifier: \"DnsRecord\"\n});\nconst cryptoAlgorithmEquals = (self, that) => self === that || self.name === that.name && self.hash?.name === that.hash?.name && self.saltLength === that.saltLength;\nconst cryptoDigestCode = hash => `Digest.${hash.name.toLowerCase().replace(\"-\", \"\")}`;\nconst cryptoAlgorithmCode = (family, algorithm) => {\n if (algorithm.modulusLength === undefined || algorithm.hash === undefined || algorithm._tag === undefined) {\n const code = `${family}.${algorithm.name}`;\n return algorithm.hash === undefined ? code : `{ ...${code}, hash: ${cryptoDigestCode(algorithm.hash)} }`;\n }\n const factory = algorithm._tag.charAt(0).toLowerCase() + algorithm._tag.slice(1);\n const saltLength = algorithm.saltLength === undefined ? \"\" : `, saltLength: ${algorithm.saltLength}`;\n return `${family}.${factory}({ hash: ${cryptoDigestCode(algorithm.hash)}, modulusLength: ${algorithm.modulusLength}${saltLength} })`;\n};\nconst cryptoAlgorithmPayload = algorithm => {\n const payload = {\n name: algorithm.name\n };\n if (algorithm.hash !== undefined) payload.hash = algorithm.hash.name;\n if (algorithm.modulusLength !== undefined) payload.modulusLength = algorithm.modulusLength;\n if (algorithm.saltLength !== undefined) payload.saltLength = algorithm.saltLength;\n return payload;\n};\nconst declareCryptoKey = (name, family, type, is, algorithm) => {\n const code = cryptoAlgorithmCode(family, algorithm);\n const forbidden = SchemaGetter.forbidden(() => `Cannot serialize ${family}.${type} values as JSON, use Schema.${name}FromFormat to read and write keys`);\n return declare(u => is(u) && cryptoAlgorithmEquals(u.algorithm, algorithm), {\n expected: `${family}.${type} for ${algorithm.name}`,\n representation: {\n id: `effect/crypto/${name}`,\n payload: cryptoAlgorithmPayload(algorithm)\n },\n toCode: () => ({\n runtime: `Schema.${name}(${code})`,\n Type: `${family}.${type}`,\n importDeclarations: [`import * as ${family} from \"effect/crypto/${family}\"`, ...(code.includes(\"Digest.\") ? [`import * as Digest from \"effect/crypto/Digest\"`] : [])]\n }),\n toCodecJson: () => link()(Unknown, {\n decode: forbidden,\n encode: forbidden\n }),\n // Keys have no Arbitrary: linking to `Never` makes derivation fail.\n toCodecArbitrary: () => link()(Never, {\n decode: forbidden,\n encode: forbidden\n }),\n toFormatter: () => key => globalThis.String(key),\n toEquivalence: () => (self, that) => self === that\n });\n};\nconst cryptoIssue = (error, input, options) => new SchemaIssue.InvalidValue({\n message: error.message,\n cause: error\n}, input, options);\nconst cryptoForbiddenEncode = (name, key, options) => Effect.fail(new SchemaIssue.Forbidden({\n message: `Schema.${name} only decodes, pass { allowEncode: true } to encode the key`\n}, key, options));\nconst cryptoKeyFromBytes = (name, to, fromBytes, toBytes) => Uint8Array.pipe(decodeTo(to, SchemaTransformation.transformEffect({\n decode: (bytes, options) => Effect.mapError(fromBytes(bytes), error => cryptoIssue(error, bytes, options)),\n encode: (key, options) => toBytes === undefined ? cryptoForbiddenEncode(name, key, options) : Effect.mapError(toBytes(key), error => cryptoIssue(error, key, options))\n})));\nconst CryptoJsonWebKeyMember = /*#__PURE__*/optionalKey(String);\n// The JWK members of RFC 7517 and RFC 7518 that `KeyFormat` reads and writes.\n// Other members are dropped.\nconst CryptoJsonWebKey = /*#__PURE__*/Struct({\n kty: CryptoJsonWebKeyMember,\n crv: CryptoJsonWebKeyMember,\n alg: CryptoJsonWebKeyMember,\n use: CryptoJsonWebKeyMember,\n key_ops: /*#__PURE__*/optionalKey(/*#__PURE__*/ArraySchema(String)),\n ext: /*#__PURE__*/optionalKey(Boolean),\n k: CryptoJsonWebKeyMember,\n x: CryptoJsonWebKeyMember,\n y: CryptoJsonWebKeyMember,\n d: CryptoJsonWebKeyMember,\n n: CryptoJsonWebKeyMember,\n e: CryptoJsonWebKeyMember,\n p: CryptoJsonWebKeyMember,\n q: CryptoJsonWebKeyMember,\n dp: CryptoJsonWebKeyMember,\n dq: CryptoJsonWebKeyMember,\n qi: CryptoJsonWebKeyMember,\n oth: /*#__PURE__*/optionalKey(/*#__PURE__*/ArraySchema(/*#__PURE__*/Struct({\n r: CryptoJsonWebKeyMember,\n d: CryptoJsonWebKeyMember,\n t: CryptoJsonWebKeyMember\n })))\n});\nconst cryptoFormatData = format => format._tag === \"jwk\" ? CryptoJsonWebKey : format.pem ? String : Uint8Array;\nconst cryptoKeyFromFormat = (name, to, format, decode, canEncode) => {\n // PKCS#1 and SEC1 are read only.\n const writable = canEncode && format._tag !== \"pkcs1\" && format._tag !== \"sec1\";\n return cryptoFormatData(format).pipe(decodeTo(to, SchemaTransformation.transformEffect({\n decode: (data, options) =>\n // Secret JWK decoding is synchronous, but all format schemas are async-only.\n Effect.flatMap(Effect.promise(() => Promise.resolve()), () => Effect.mapError(decode(data), error => cryptoIssue(error, data, options))),\n encode: (key, options) => writable ? Effect.mapError(KeyFormat_.encode(format, key), error => cryptoIssue(error, key, options)) : cryptoForbiddenEncode(name, key, options)\n })));\n};\n/**\n * Schema for live `Mac.Key` values of an algorithm.\n *\n * **Details**\n *\n * Decoding checks the key's algorithm and returns the key itself. The key has\n * no JSON form: `toCodecJson` fails with a `Forbidden` issue, so use\n * {@link MacKeyFromFormat} or {@link MacKeyFromBytes} to read and write keys.\n * Keys display redacted, compare by reference, and have no `Arbitrary`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const MacKey = algorithm => declareCryptoKey(\"MacKey\", \"Mac\", \"Key\", Mac_.isKey, algorithm);\n/**\n * Schema that decodes raw key bytes into a `Mac.Key`.\n *\n * **Details**\n *\n * Decoding runs `Mac.key`, which is synchronous, so the schema works with\n * `Schema.decodeSync`. Under `Config.schema` the bytes are read as base64. A\n * `CryptoError` becomes an `InvalidValue` issue whose `cause` is the error.\n * Encoding fails with a `Forbidden` issue unless `allowEncode` is `true`.\n *\n * **Example** (Reading an HMAC key from the environment)\n *\n * ```ts import.meta.vitest\n * import { Config, ConfigProvider, Effect, Schema } from \"effect\"\n * import { Mac } from \"effect/crypto\"\n *\n * const config = Config.schema(Schema.MacKeyFromBytes(Mac.hmacSha256), \"HMAC_KEY\")\n * const provider = ConfigProvider.fromEnv({ env: { HMAC_KEY: \"A\".repeat(43) + \"=\" } })\n * const key = await Effect.runPromise(Effect.provide(config, ConfigProvider.layer(provider)))\n * key.algorithm.name // => \"hmacSha256\"\n * ```\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const MacKeyFromBytes = (algorithm, options) => cryptoKeyFromBytes(\"MacKeyFromBytes\", MacKey(algorithm), bytes => Mac_.key(algorithm, bytes), options?.allowEncode === true ? Mac_.toBytes : undefined);\n/**\n * Schema that decodes a `Mac.Key` from a JWK with `KeyFormat.decodeSecret`.\n *\n * **Details**\n *\n * Decoding returns an Effect, so use the async decoding functions:\n * `Schema.decodeSync` throws. A `CryptoError` becomes an `InvalidValue` issue\n * whose `cause` is the error. Encoding fails with a `Forbidden` issue unless\n * `allowEncode` is `true`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const MacKeyFromFormat = (format, algorithm, options) => cryptoKeyFromFormat(\"MacKeyFromFormat\", MacKey(algorithm), format, data => KeyFormat_.decodeSecret(format, algorithm, data), options?.allowEncode === true);\n/**\n * Schema for live `Aead.Key` values of an algorithm.\n *\n * **Details**\n *\n * Decoding checks the key's algorithm and returns the key itself. The key has\n * no JSON form: `toCodecJson` fails with a `Forbidden` issue, so use\n * {@link AeadKeyFromFormat} or {@link AeadKeyFromBytes} to read and write\n * keys. Keys display redacted, compare by reference, and have no `Arbitrary`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const AeadKey = algorithm => declareCryptoKey(\"AeadKey\", \"Aead\", \"Key\", Aead_.isKey, algorithm);\n/**\n * Schema that decodes raw key bytes into an `Aead.Key`.\n *\n * **Details**\n *\n * Decoding runs `Aead.key`, which is synchronous, so the schema works with\n * `Schema.decodeSync`. Under `Config.schema` the bytes are read as base64. A\n * `CryptoError` becomes an `InvalidValue` issue whose `cause` is the error.\n * Encoding fails with a `Forbidden` issue unless `allowEncode` is `true`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const AeadKeyFromBytes = (algorithm, options) => cryptoKeyFromBytes(\"AeadKeyFromBytes\", AeadKey(algorithm), bytes => Aead_.key(algorithm, bytes), options?.allowEncode === true ? Aead_.toBytes : undefined);\n/**\n * Schema that decodes an `Aead.Key` from a JWK with `KeyFormat.decodeSecret`.\n *\n * **Details**\n *\n * Decoding returns an Effect, so use the async decoding functions:\n * `Schema.decodeSync` throws. A `CryptoError` becomes an `InvalidValue` issue\n * whose `cause` is the error. Encoding fails with a `Forbidden` issue unless\n * `allowEncode` is `true`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const AeadKeyFromFormat = (format, algorithm, options) => cryptoKeyFromFormat(\"AeadKeyFromFormat\", AeadKey(algorithm), format, data => KeyFormat_.decodeSecret(format, algorithm, data), options?.allowEncode === true);\n/**\n * Schema for live `Cipher.Key` values of an algorithm.\n *\n * **Details**\n *\n * Decoding checks the key's algorithm and returns the key itself. The key has\n * no JSON form: `toCodecJson` fails with a `Forbidden` issue, so use\n * {@link CipherKeyFromFormat} or {@link CipherKeyFromBytes} to read and\n * write keys. Keys display redacted, compare by reference, and have no\n * `Arbitrary`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const CipherKey = algorithm => declareCryptoKey(\"CipherKey\", \"Cipher\", \"Key\", Cipher_.isKey, algorithm);\n/**\n * Schema that decodes raw key bytes into a `Cipher.Key`.\n *\n * **Details**\n *\n * Decoding runs `Cipher.key`, which is synchronous, so the schema works with\n * `Schema.decodeSync`. Under `Config.schema` the bytes are read as base64. A\n * `CryptoError` becomes an `InvalidValue` issue whose `cause` is the error.\n * Encoding fails with a `Forbidden` issue unless `allowEncode` is `true`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const CipherKeyFromBytes = (algorithm, options) => cryptoKeyFromBytes(\"CipherKeyFromBytes\", CipherKey(algorithm), bytes => Cipher_.key(algorithm, bytes), options?.allowEncode === true ? Cipher_.toBytes : undefined);\n/**\n * Schema that decodes a `Cipher.Key` from a JWK with\n * `KeyFormat.decodeSecret`.\n *\n * **Details**\n *\n * Decoding returns an Effect, so use the async decoding functions:\n * `Schema.decodeSync` throws. A `CryptoError` becomes an `InvalidValue` issue\n * whose `cause` is the error. Encoding fails with a `Forbidden` issue unless\n * `allowEncode` is `true`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const CipherKeyFromFormat = (format, algorithm, options) => cryptoKeyFromFormat(\"CipherKeyFromFormat\", CipherKey(algorithm), format, data => KeyFormat_.decodeSecret(format, algorithm, data), options?.allowEncode === true);\n/**\n * Schema for live `Signature.PublicKey` values of an algorithm.\n *\n * **Details**\n *\n * Decoding checks the key's algorithm and returns the key itself. The key has\n * no JSON form: `toCodecJson` fails with a `Forbidden` issue, so use\n * {@link SignaturePublicKeyFromFormat} or {@link SignaturePublicKeyFromBytes}\n * to read and write keys. Keys compare by reference and have no `Arbitrary`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const SignaturePublicKey = algorithm => declareCryptoKey(\"SignaturePublicKey\", \"Signature\", \"PublicKey\", Signature_.isPublicKey, algorithm);\n/**\n * Schema that decodes a raw public key into a `Signature.PublicKey`: 32 bytes\n * for Ed25519, or an uncompressed SEC1 point for ECDSA.\n *\n * **Details**\n *\n * Decoding runs `Signature.publicKey`, which is synchronous, so the schema\n * works with `Schema.decodeSync`. Under `Config.schema` the bytes are read as\n * base64. A `CryptoError` becomes an `InvalidValue` issue whose `cause` is\n * the error. RSA public keys have no raw form, so passing an RSA algorithm is\n * a type error.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const SignaturePublicKeyFromBytes = algorithm => cryptoKeyFromBytes(\"SignaturePublicKeyFromBytes\", SignaturePublicKey(algorithm), bytes => Signature_.publicKey(algorithm, bytes), Signature_.toBytes);\n/**\n * Schema that decodes a `Signature.PublicKey` with\n * `KeyFormat.decodePublic` and encodes it with `KeyFormat.encode`.\n *\n * **Details**\n *\n * The format must hold public keys: `KeyFormat.spki`, `KeyFormat.jwk`, or\n * `KeyFormat.pem(KeyFormat.spki)`. A format for another role is a type\n * error. Decoding runs the runtime's key import, so use the async decoding\n * functions: `Schema.decodeSync` throws. A `CryptoError` becomes an\n * `InvalidValue` issue whose `cause` is the error.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const SignaturePublicKeyFromFormat = (format, algorithm) => cryptoKeyFromFormat(\"SignaturePublicKeyFromFormat\", SignaturePublicKey(algorithm), format, data => KeyFormat_.decodePublic(format, algorithm, data), true);\n/**\n * Schema for live `Signature.PrivateKey` values of an algorithm.\n *\n * **Details**\n *\n * Decoding checks the key's algorithm and returns the key itself. The key has\n * no JSON form: `toCodecJson` fails with a `Forbidden` issue, so use\n * {@link SignaturePrivateKeyFromFormat} or\n * {@link SignaturePrivateKeyFromBytes} to read and write keys. Keys display\n * redacted, compare by reference, and have no `Arbitrary`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const SignaturePrivateKey = algorithm => declareCryptoKey(\"SignaturePrivateKey\", \"Signature\", \"PrivateKey\", Signature_.isPrivateKey, algorithm);\n/**\n * Schema that decodes an Ed25519 seed into a `Signature.PrivateKey`.\n *\n * **Details**\n *\n * Decoding runs `Signature.privateKey`, which is synchronous, so the schema\n * works with `Schema.decodeSync`. Under `Config.schema` the bytes are read as\n * base64. A `CryptoError` becomes an `InvalidValue` issue whose `cause` is\n * the error. ECDSA and RSA private keys have no raw form, so passing them is\n * a type error. Encoding fails with a `Forbidden` issue unless `allowEncode`\n * is `true`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const SignaturePrivateKeyFromBytes = (algorithm, options) => cryptoKeyFromBytes(\"SignaturePrivateKeyFromBytes\", SignaturePrivateKey(algorithm), bytes => Signature_.privateKey(algorithm, bytes), options?.allowEncode === true ? Signature_.toBytes : undefined);\n/**\n * Schema that decodes a `Signature.PrivateKey` with\n * `KeyFormat.decodePrivate`.\n *\n * **Details**\n *\n * The format must hold private keys: `KeyFormat.pkcs8`, `KeyFormat.jwk`,\n * `KeyFormat.pkcs1`, `KeyFormat.sec1`, or their PEM forms. A format for\n * another role is a type error. Decoding runs the runtime's key import, so\n * use the async decoding functions: `Schema.decodeSync` throws. A\n * `CryptoError` becomes an `InvalidValue` issue whose `cause` is the error.\n * Encoding fails with a `Forbidden` issue unless `allowEncode` is `true`,\n * and always for the read-only PKCS#1 and SEC1 formats.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const SignaturePrivateKeyFromFormat = (format, algorithm, options) => cryptoKeyFromFormat(\"SignaturePrivateKeyFromFormat\", SignaturePrivateKey(algorithm), format, data => KeyFormat_.decodePrivate(format, algorithm, data), options?.allowEncode === true);\n/**\n * Schema for live `KeyAgreement.PublicKey` values of an algorithm.\n *\n * **Details**\n *\n * Decoding checks the key's algorithm and returns the key itself. The key has\n * no JSON form: `toCodecJson` fails with a `Forbidden` issue, so use\n * {@link KeyAgreementPublicKeyFromFormat} or\n * {@link KeyAgreementPublicKeyFromBytes} to read and write keys. Keys compare\n * by reference and have no `Arbitrary`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const KeyAgreementPublicKey = algorithm => declareCryptoKey(\"KeyAgreementPublicKey\", \"KeyAgreement\", \"PublicKey\", KeyAgreement_.isPublicKey, algorithm);\n/**\n * Schema that decodes a raw public key into a `KeyAgreement.PublicKey`: 32\n * bytes for X25519, or an uncompressed SEC1 point for ECDH.\n *\n * **Details**\n *\n * Decoding runs `KeyAgreement.publicKey`, which is synchronous, so the schema\n * works with `Schema.decodeSync`. Under `Config.schema` the bytes are read as\n * base64. A `CryptoError` becomes an `InvalidValue` issue whose `cause` is\n * the error.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const KeyAgreementPublicKeyFromBytes = algorithm => cryptoKeyFromBytes(\"KeyAgreementPublicKeyFromBytes\", KeyAgreementPublicKey(algorithm), bytes => KeyAgreement_.publicKey(algorithm, bytes), KeyAgreement_.toBytes);\n/**\n * Schema that decodes a `KeyAgreement.PublicKey` with\n * `KeyFormat.decodePublic` and encodes it with `KeyFormat.encode`.\n *\n * **Details**\n *\n * The format must hold public keys: `KeyFormat.spki`, `KeyFormat.jwk`, or\n * `KeyFormat.pem(KeyFormat.spki)`. A format for another role is a type\n * error. Decoding runs the runtime's key import, so use the async decoding\n * functions: `Schema.decodeSync` throws. A `CryptoError` becomes an\n * `InvalidValue` issue whose `cause` is the error.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const KeyAgreementPublicKeyFromFormat = (format, algorithm) => cryptoKeyFromFormat(\"KeyAgreementPublicKeyFromFormat\", KeyAgreementPublicKey(algorithm), format, data => KeyFormat_.decodePublic(format, algorithm, data), true);\n/**\n * Schema for live `KeyAgreement.PrivateKey` values of an algorithm.\n *\n * **Details**\n *\n * Decoding checks the key's algorithm and returns the key itself. The key has\n * no JSON form: `toCodecJson` fails with a `Forbidden` issue, so use\n * {@link KeyAgreementPrivateKeyFromFormat} or\n * {@link KeyAgreementPrivateKeyFromBytes} to read and write keys. Keys\n * display redacted, compare by reference, and have no `Arbitrary`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const KeyAgreementPrivateKey = algorithm => declareCryptoKey(\"KeyAgreementPrivateKey\", \"KeyAgreement\", \"PrivateKey\", KeyAgreement_.isPrivateKey, algorithm);\n/**\n * Schema that decodes an X25519 private key into a\n * `KeyAgreement.PrivateKey`.\n *\n * **Details**\n *\n * Decoding runs `KeyAgreement.privateKey`, which is synchronous, so the\n * schema works with `Schema.decodeSync`. Under `Config.schema` the bytes are\n * read as base64. A `CryptoError` becomes an `InvalidValue` issue whose\n * `cause` is the error. ECDH private keys have no raw form, so passing them\n * is a type error. Encoding fails with a `Forbidden` issue unless\n * `allowEncode` is `true`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const KeyAgreementPrivateKeyFromBytes = (algorithm, options) => cryptoKeyFromBytes(\"KeyAgreementPrivateKeyFromBytes\", KeyAgreementPrivateKey(algorithm), bytes => KeyAgreement_.privateKey(algorithm, bytes), options?.allowEncode === true ? KeyAgreement_.toBytes : undefined);\n/**\n * Schema that decodes a `KeyAgreement.PrivateKey` with\n * `KeyFormat.decodePrivate`.\n *\n * **Details**\n *\n * The format must hold private keys: `KeyFormat.pkcs8`, `KeyFormat.jwk`,\n * `KeyFormat.sec1`, or their PEM forms. A format for another role is a type\n * error. Decoding runs the runtime's key import, so use the async decoding\n * functions: `Schema.decodeSync` throws. A `CryptoError` becomes an\n * `InvalidValue` issue whose `cause` is the error. Encoding fails with a\n * `Forbidden` issue unless `allowEncode` is `true`, and always for the\n * read-only PKCS#1 and SEC1 formats.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const KeyAgreementPrivateKeyFromFormat = (format, algorithm, options) => cryptoKeyFromFormat(\"KeyAgreementPrivateKeyFromFormat\", KeyAgreementPrivateKey(algorithm), format, data => KeyFormat_.decodePrivate(format, algorithm, data), options?.allowEncode === true);\n/**\n * Schema for live AES-KW `KeyWrap.Key` values of an algorithm.\n *\n * **Details**\n *\n * Decoding checks the key's algorithm and returns the key itself. The key has\n * no JSON form: `toCodecJson` fails with a `Forbidden` issue, so use\n * {@link KeyWrapKeyFromFormat} or {@link KeyWrapKeyFromBytes} to read and\n * write keys. Keys display redacted, compare by reference, and have no\n * `Arbitrary`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const KeyWrapKey = algorithm => declareCryptoKey(\"KeyWrapKey\", \"KeyWrap\", \"Key\", KeyWrap_.isKey, algorithm);\n/**\n * Schema that decodes raw key bytes into an AES-KW `KeyWrap.Key`.\n *\n * **Details**\n *\n * Decoding runs `KeyWrap.key`, which is synchronous, so the schema works with\n * `Schema.decodeSync`. Under `Config.schema` the bytes are read as base64. A\n * `CryptoError` becomes an `InvalidValue` issue whose `cause` is the error.\n * Encoding fails with a `Forbidden` issue unless `allowEncode` is `true`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const KeyWrapKeyFromBytes = (algorithm, options) => cryptoKeyFromBytes(\"KeyWrapKeyFromBytes\", KeyWrapKey(algorithm), bytes => KeyWrap_.key(algorithm, bytes), options?.allowEncode === true ? KeyWrap_.toBytes : undefined);\n/**\n * Schema that decodes an AES-KW `KeyWrap.Key` from a JWK with\n * `KeyFormat.decodeSecret`.\n *\n * **Details**\n *\n * Decoding returns an Effect, so use the async decoding functions:\n * `Schema.decodeSync` throws. A `CryptoError` becomes an `InvalidValue` issue\n * whose `cause` is the error. Encoding fails with a `Forbidden` issue unless\n * `allowEncode` is `true`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const KeyWrapKeyFromFormat = (format, algorithm, options) => cryptoKeyFromFormat(\"KeyWrapKeyFromFormat\", KeyWrapKey(algorithm), format, data => KeyFormat_.decodeSecret(format, algorithm, data), options?.allowEncode === true);\n/**\n * Schema for live RSA-OAEP `KeyWrap.PublicKey` values of an algorithm.\n *\n * **Details**\n *\n * Decoding checks the key's algorithm and returns the key itself. The key has\n * no JSON form: `toCodecJson` fails with a `Forbidden` issue, so use\n * {@link KeyWrapPublicKeyFromFormat} to read and write keys. RSA-OAEP keys\n * have no raw form. Keys compare by reference and have no `Arbitrary`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const KeyWrapPublicKey = algorithm => declareCryptoKey(\"KeyWrapPublicKey\", \"KeyWrap\", \"PublicKey\", KeyWrap_.isPublicKey, algorithm);\n/**\n * Schema that decodes an RSA-OAEP `KeyWrap.PublicKey` with\n * `KeyFormat.decodePublic` and encodes it with `KeyFormat.encode`.\n *\n * **Details**\n *\n * The format must hold public keys: `KeyFormat.spki`, `KeyFormat.jwk`, or\n * `KeyFormat.pem(KeyFormat.spki)`. A format for another role is a type\n * error. Decoding runs the runtime's key import, so use the async decoding\n * functions: `Schema.decodeSync` throws. A `CryptoError` becomes an\n * `InvalidValue` issue whose `cause` is the error.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const KeyWrapPublicKeyFromFormat = (format, algorithm) => cryptoKeyFromFormat(\"KeyWrapPublicKeyFromFormat\", KeyWrapPublicKey(algorithm), format, data => KeyFormat_.decodePublic(format, algorithm, data), true);\n/**\n * Schema for live RSA-OAEP `KeyWrap.PrivateKey` values of an algorithm.\n *\n * **Details**\n *\n * Decoding checks the key's algorithm and returns the key itself. The key has\n * no JSON form: `toCodecJson` fails with a `Forbidden` issue, so use\n * {@link KeyWrapPrivateKeyFromFormat} to read and write keys. RSA-OAEP keys\n * have no raw form. Keys display redacted, compare by reference, and have no\n * `Arbitrary`.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const KeyWrapPrivateKey = algorithm => declareCryptoKey(\"KeyWrapPrivateKey\", \"KeyWrap\", \"PrivateKey\", KeyWrap_.isPrivateKey, algorithm);\n/**\n * Schema that decodes an RSA-OAEP `KeyWrap.PrivateKey` with\n * `KeyFormat.decodePrivate`.\n *\n * **Details**\n *\n * The format must hold private keys: `KeyFormat.pkcs8`, `KeyFormat.jwk`,\n * `KeyFormat.pkcs1`, or their PEM forms. A format for another role is a type\n * error. Decoding runs the runtime's key import, so use the async decoding\n * functions: `Schema.decodeSync` throws. A `CryptoError` becomes an\n * `InvalidValue` issue whose `cause` is the error. Encoding fails with a\n * `Forbidden` issue unless `allowEncode` is `true`, and always for the\n * read-only PKCS#1 format.\n *\n * @stability unstable\n * @category crypto\n * @since 4.0.0\n */\nexport const KeyWrapPrivateKeyFromFormat = (format, algorithm, options) => cryptoKeyFromFormat(\"KeyWrapPrivateKeyFromFormat\", KeyWrapPrivateKey(algorithm), format, data => KeyFormat_.decodePrivate(format, algorithm, data), options?.allowEncode === true);\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability 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/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 * @stability 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/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 * @stability 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 * @stability 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/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 parsed `Retry-After` header values.\n *\n * **Details**\n *\n * Matches `Headers.RetryAfter`: either `{ _tag: \"Duration\", duration }` or\n * `{ _tag: \"DateTime\", dateTime }`. The duration must be finite and\n * non-negative. Use {@link RetryAfterFromString} for the header string form.\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const RetryAfter = /*#__PURE__*/Union([/*#__PURE__*/Struct({\n _tag: /*#__PURE__*/tag(\"Duration\"),\n duration: /*#__PURE__*/Duration.check(/*#__PURE__*/makeFilter(d => Duration_.isFinite(d) && !Duration_.isNegative(d), {\n expected: \"a finite, non-negative duration\"\n }))\n}), /*#__PURE__*/Struct({\n _tag: /*#__PURE__*/tag(\"DateTime\"),\n dateTime: DateTimeUtc\n})]);\nconst retryAfterFromString = /*#__PURE__*/SchemaTransformation.transformEffect({\n decode: (s, options) => Result_.match(Headers_.parseRetryAfter(s), {\n onFailure: () => Effect.fail(new SchemaIssue.InvalidValue({\n expected: \"whole non-negative seconds or an HTTP date (RFC 9110 §10.2.3)\"\n }, s, options)),\n onSuccess: Effect.succeed\n }),\n encode: self => Effect.succeed(Headers_.formatRetryAfter(self))\n});\n/**\n * Schema for `Retry-After` header values, decoded with\n * `Headers.parseRetryAfter`.\n *\n * **When to use**\n *\n * Use with HTTP API header schemas that carry `Retry-After`. Decoding accepts\n * whole non-negative seconds or an HTTP date and rejects anything else;\n * encoding emits the delay as whole seconds, rounding a fractional second up,\n * or the date as an IMF-fixdate.\n *\n * **Example** (Decoding a Retry-After header)\n *\n * ```ts\n * import { Schema } from \"effect\"\n *\n * const value = Schema.decodeSync(Schema.RetryAfterFromString)(\"120\")\n * // => { _tag: \"Duration\", duration: Duration.seconds(120) }\n * ```\n *\n * @stability unstable\n * @category schemas\n * @since 4.0.0\n */\nexport const RetryAfterFromString = /*#__PURE__*/String.annotate({\n expected: \"a Retry-After header value\"\n}).pipe(/*#__PURE__*/decodeTo(RetryAfter, retryAfterFromString));\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 * @stability 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/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.map(([key, value]) => [key, UrlParams_internal.unwrap(value)])\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/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 * @stability 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/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 * @stability 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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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: value => Redacted_.make(value, {\n label: input.label\n }),\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 * @stability stable\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 * @stability stable\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}\n// -----------------------------------------------------------------------------\n// SemVer schemas\n// -----------------------------------------------------------------------------\nconst semVerStringTransformation = (parse, format) => SchemaTransformation.transformEffect({\n decode: (input, options) => Effect.mapErrorEager(Effect.fromResult(parse(input)), error => new SchemaIssue.InvalidValue({\n message: error.message\n }, input, options)),\n encode: value => Effect.succeed(format(value))\n});\n// Alphanumeric identifiers contain at least one non-digit.\nconst SemVerCoreArbitrary = /*#__PURE__*/Struct({\n major: Natural,\n minor: Natural,\n patch: Natural,\n prerelease: /*#__PURE__*/ArraySchema(/*#__PURE__*/Union([Natural, /*#__PURE__*/String.check(/*#__PURE__*/isPattern(/^[0-9]*[A-Za-z-][0-9A-Za-z-]*$/))]))\n});\nconst semVerFromString = /*#__PURE__*/semVerStringTransformation(SemVer_.parse, SemVer_.format);\nconst SemVerString = /*#__PURE__*/String.annotate({\n expected: \"a string that will be decoded as a SemVer\"\n});\n/**\n * Schema for `SemVer` values.\n *\n * **Details**\n *\n * The JSON and StringTree codecs encode a version as its canonical string,\n * including build metadata.\n *\n * @see {@link SemVerFromString} for parsing version strings\n * @stability unstable\n * @category schemas\n * @since 4.0.6\n */\nexport const SemVer = /*#__PURE__*/declare(SemVer_.isSemVer, {\n representation: {\n id: \"effect/schema/SemVer\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.SemVer`,\n Type: `SemVer.SemVer`,\n importDeclarations: [`import * as SemVer from \"effect/SemVer\"`]\n }),\n expected: \"SemVer\",\n toCodecArbitrary: () => linkDecoding()(Struct({\n ...SemVerCoreArbitrary.fields,\n build: ArraySchema(String.check(isPattern(/^[0-9A-Za-z-]+$/)))\n }), SchemaGetter.transform(SemVer_.make)),\n toCodecJson: () => link()(SemVerString, semVerFromString),\n toFormatter: () => SemVer_.format\n});\n/**\n * Schema that parses a Semantic Versioning 2.0.0 string into a `SemVer`.\n *\n * **Details**\n *\n * Decodes with `SemVer.parse`, rejecting a `v` prefix, surrounding whitespace,\n * partial versions, and leading zeros. Encodes with `SemVer.format`, including\n * build metadata.\n *\n * @see {@link SemVer} for validating values that are already SemVer values\n * @stability unstable\n * @category schemas\n * @since 4.0.6\n */\nexport const SemVerFromString = /*#__PURE__*/SemVerString.pipe(/*#__PURE__*/decodeTo(SemVer, semVerFromString));\nconst semVerRangeFromString = /*#__PURE__*/semVerStringTransformation(SemVerRange_.parse, SemVerRange_.format);\nconst SemVerRangeString = /*#__PURE__*/String.annotate({\n expected: \"a string that will be decoded as a SemVer range\"\n});\n/**\n * Schema for `SemVerRange` values.\n *\n * **Details**\n *\n * The JSON and StringTree codecs encode a range with `SemVerRange.format`.\n *\n * @see {@link SemVerRangeFromString} for parsing range strings\n * @stability unstable\n * @category schemas\n * @since 4.0.6\n */\nexport const SemVerRange = /*#__PURE__*/declare(SemVerRange_.isSemVerRange, {\n representation: {\n id: \"effect/schema/SemVerRange\",\n payload: null\n },\n toCode: () => ({\n runtime: `Schema.SemVerRange`,\n Type: `SemVerRange.SemVerRange`,\n importDeclarations: [`import * as SemVerRange from \"effect/SemVerRange\"`]\n }),\n expected: \"SemVerRange\",\n toCodecArbitrary: () => linkDecoding()(ArraySchema(ArraySchema(Struct({\n operator: Literals([\"\", \"=\", \"<\", \"<=\", \">\", \">=\", \"~\", \"^\"]),\n version: SemVerCoreArbitrary\n })).check(isMinLength(1))), SchemaGetter.transform(sets => SemVerRange_.parseUnsafe(sets.map(set => set.map(({\n operator,\n version\n }) => `${operator}${SemVer_.format(SemVer_.make(version))}`).join(\" \")).join(\" || \")))),\n toCodecJson: () => link()(SemVerRangeString, semVerRangeFromString),\n toFormatter: () => SemVerRange_.format\n});\n/**\n * Schema that parses an npm-style version range string into a `SemVerRange`.\n *\n * **Details**\n *\n * Decodes with `SemVerRange.parse` and encodes with `SemVerRange.format`,\n * preserving parsed operators and normalizing wildcard spellings.\n *\n * @see {@link SemVerRange} for validating values that are already ranges\n * @stability unstable\n * @category schemas\n * @since 4.0.6\n */\nexport const SemVerRangeFromString = /*#__PURE__*/SemVerRangeString.pipe(/*#__PURE__*/decodeTo(SemVerRange, semVerRangeFromString));\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.makeClassSync(SchemaAST.toType(getClassSchema(this).ast), input ?? {}, options, fields => makeClassTrusted(this, fields));\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}\n/**\n * Constructs a class instance from fields that were already validated against\n * the class struct, without running the constructor's schema pass.\n *\n * @internal\n */\nexport function makeClassTrusted(self, fields) {\n return new self(fields, {\n \"~payload\": {\n token: payloadToken,\n value: fields\n }\n });\n}\nfunction getClassTransformation(self) {\n return new SchemaTransformation.Transformation(SchemaGetter.transform(input => makeClassTrusted(self, input)), 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 * To subclass a `Schema.Class`, use `Base.extend<Self>(...)`, even when only\n * adding methods or getters. Pass `{}` for the fields when none are added.\n * Plain `class Child extends Base` is unsupported.\n *\n * Passing `disableChecks: true` skips filters and checks, not parsing of types\n * and structure. Wrong types and shapes are still rejected, and constructor\n * defaults still apply.\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * TypeScript-only distinctions such as those added by {@link brand} are not\n * part of the schema AST and are therefore omitted.\n *\n * @see {@link SchemaRepresentation.toRepresentation} for converting a `SchemaAST.AST` directly\n *\n * @stability stable\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 document describes the encoded side of `Schema.toCodecJson(schema)`.\n * Use that codec to decode JSON inputs. For example, it decodes JSON `null`\n * to JavaScript `undefined` for a field defined with `Schema.optional(Schema.String)`.\n * Decoding the same input with the original schema rejects `null`.\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. When a `oneOf`\n * branch contains a known approximation, the compiler emits `anyOf` so that\n * the approximation cannot create a false rejection. Unions with only exact\n * branches retain `oneOf`. Custom `toJsonSchema` callbacks return `[schema, true]` for safe,\n * looser approximations and are responsible for the semantics they declare. 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 * index-signature keys without exact selectors 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 * **Example** (Decoding JSON with the matching codec)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const schema = Schema.Struct({\n * name: Schema.optional(Schema.String)\n * })\n *\n * const document = Schema.toJsonSchemaDocument(schema)\n * const jsonCodec = Schema.toCodecJson(schema)\n *\n * Schema.decodeUnknownResult(schema)({ name: null })._tag // => \"Failure\"\n * Schema.decodeUnknownSync(jsonCodec)({ name: null }) // => { name: undefined }\n * Schema.decodeUnknownSync(jsonCodec)({}) // => {}\n * Schema.encodeSync(jsonCodec)({ name: undefined }) // => { name: null }\n * ```\n *\n * @see {@link toCodecJson} for decoding and encoding the canonical JSON representation\n * @see {@link SchemaRepresentation.toJsonSchemaDocument} for compiling an existing live representation document\n *\n * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\n * @category converting\n * @since 4.0.0\n */\nexport const toCodecArrayFromSingle = InternalToCodec.toCodecArrayFromSingle;\n/**\n * Derives a JSON codec, like {@link toCodecJson}, that also accepts the\n * `null` values Go's `encoding/json` writes for nil pointers, slices, and maps.\n *\n * **When to use**\n *\n * Use when decoding JSON produced by a Go service (for example the Docker\n * Engine or Kubernetes APIs), where any field the API document describes as\n * optional, or any slice or map, may arrive as `null`.\n *\n * **Details**\n *\n * Decoding applies these rules at every level of the schema:\n *\n * - An optional key that is `null` decodes as a missing key.\n * - A required array (`Schema.Array`) that is `null` decodes as `[]`.\n * - A required record (`Schema.Record`) that is `null` decodes as `{}`.\n *\n * Array and record rules also apply at the top level and to nested collection\n * values. Tuples, non-empty arrays, and structs are not treated as collections;\n * collection checks still apply to the empty value.\n *\n * Encoding is unchanged from {@link toCodecJson}: the added rules only decode\n * `null` and do not emit it. A missing key stays missing.\n *\n * These rules also accept `encoding/json/v2` output. By default, v2 writes\n * nil slices and maps as `[]` and `{}`, but it can be configured to emit\n * `null` instead.\n *\n * **Gotchas**\n *\n * - Normalization deliberately discards the distinction between nil and empty\n * Go slices or maps. They are distinguishable in Go, and unmarshalling a\n * missing key, `null`, or an empty collection can affect existing values\n * differently. Use {@link toCodecJson} with explicit nullable schemas when\n * that distinction matters.\n * - A key whose schema already accepts `null` (for example\n * `Schema.NullOr(X)`, `Schema.Unknown`, or `Schema.Json`) keeps `null` as a\n * value.\n * - A required field that is not an array or a record (a nil pointer to a Go\n * struct, for example) still fails on `null`. Make it optional if the API\n * can omit it.\n * - A nil `[]byte` is written as `null` by `encoding/json` (and as `\"\"` by\n * version 2), but its schema is a base64 string, not an array. A required\n * `[]byte` field that is `null` fails; make it optional if the API can send\n * `null`.\n * - Only these `null` rules are covered. Field formats such as durations,\n * base64 bytes, and numbers encoded as strings belong in the field schemas.\n *\n * **Example** (Decoding a Go response with nil fields)\n *\n * ```ts import.meta.vitest\n * import { Schema } from \"effect\"\n *\n * const Container = Schema.Struct({\n * Id: Schema.String,\n * Names: Schema.Array(Schema.String),\n * Labels: Schema.Record(Schema.String, Schema.String),\n * Status: Schema.optionalKey(Schema.String)\n * })\n *\n * const decode = Schema.decodeUnknownSync(Schema.toCodecGoJson(Container))\n *\n * decode({ Id: \"a\", Names: null, Labels: null, Status: null }) // => { Id: \"a\", Names: [], Labels: {} }\n * ```\n *\n * @see {@link toCodecJson} for the canonical JSON codec\n * @stability unstable\n * @category converting\n * @since 4.0.6\n */\nexport const toCodecGoJson = InternalToCodec.toCodecGoJson;\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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.makeTransformation(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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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 * @stability stable\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"],"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,29,30,31,32,33,34,35,36,37,38,39,40,41],"mappings":";;AA6YA,MAAaA,oBAAkBC;;ACvL/B,MAAa,MAAmB,KAAK,IAAI,MAAM,QAAQ,OAAO,OAAO,MAAM,GAAG,CAAC;AAqJ/E,MAAaC,QAAmB,KAAK,IAAI,MAAM,MAAM;CACnD,MAAM,MAAM,EACV,GAAG,KACL;CACA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