@opencode/browse 0.0.11-dev.70 → 0.0.11-dev.71

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.
@@ -7108,15 +7108,23 @@ var setAll2 = /* @__PURE__ */ dual(2, (self, input) => {
7108
7108
  function resolve(ast) {
7109
7109
  return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
7110
7110
  }
7111
+ function resolveAt(key) {
7112
+ return (ast) => resolve(ast)?.[key];
7113
+ }
7111
7114
  var STRUCTURAL_ANNOTATION_KEY = "~structural";
7115
+ var IDENTIFIER_FALLBACK_KEY = "~identifier";
7112
7116
  var SENTINELS_ANNOTATION_KEY = "~sentinels";
7113
7117
  var CONSTRUCTOR_ANNOTATION_KEY = "~constructor";
7118
+ var jsonSchemaAnnotationKeys = ["title", "description", "default", "examples", "readOnly", "writeOnly", "format", "contentEncoding", "contentMediaType", "contentSchema"];
7119
+ var resolveIdentifier = /* @__PURE__ */ resolveAt("identifier");
7120
+ var resolveIdentifierFallback = /* @__PURE__ */ resolveAt(IDENTIFIER_FALLBACK_KEY);
7114
7121
  var getExpected = /* @__PURE__ */ memoize((ast) => {
7115
7122
  const identifier = resolve(ast)?.identifier;
7116
7123
  if (typeof identifier === "string")
7117
7124
  return identifier;
7118
7125
  return ast.getExpected(getExpected);
7119
7126
  });
7127
+ var annotationExcludedKeys = /* @__PURE__ */ new Set([SENTINELS_ANNOTATION_KEY, STRUCTURAL_ANNOTATION_KEY, "representation", "arbitraryConstraint", "toJsonSchema", "toCode", "toEquivalence", "toFormatter", "toCodec", "toCodecJson", "toCodecStringTree", "toCodecIso", "toCodecArbitrary"]);
7120
7128
 
7121
7129
  // node_modules/effect/dist/internal/schema/parser.js
7122
7130
  var missing = /* @__PURE__ */ Symbol();
@@ -9141,6 +9149,9 @@ function record(key, value) {
9141
9149
  function isOptional(ast) {
9142
9150
  return ast.context?.isOptional ?? false;
9143
9151
  }
9152
+ function isMutable(ast) {
9153
+ return ast.context?.isMutable ?? false;
9154
+ }
9144
9155
  function isStructuralCheck(check) {
9145
9156
  return check.annotations?.[STRUCTURAL_ANNOTATION_KEY] === true || check._tag === "FilterGroup" && check.checks.every(isStructuralCheck);
9146
9157
  }
@@ -9324,6 +9335,7 @@ var partFromString = /* @__PURE__ */ applyToSelfOrLastLinkEncodingIdempotent((as
9324
9335
  return ast.recur(partFromString);
9325
9336
  }
9326
9337
  });
9338
+ var STRING_PATTERN = "[\\s\\S]*?";
9327
9339
  var isStringFiniteRegExp = /* @__PURE__ */ new globalThis.RegExp(`^${FINITE_PATTERN}$`);
9328
9340
  var isStringNumberRegExp = /* @__PURE__ */ new globalThis.RegExp(`^(?:${FINITE_PATTERN}|Infinity|-Infinity|NaN)$`);
9329
9341
  function isStringFinite(annotations) {
@@ -9805,6 +9817,9 @@ function encodeUnknownEffect2(schema, options) {
9805
9817
  const parser = run(flip2(schema.ast));
9806
9818
  return options === undefined ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
9807
9819
  }
9820
+ function encodeUnknownOption2(schema, options) {
9821
+ return asOption(encodeUnknownEffect2(schema, options));
9822
+ }
9808
9823
  var mergeParseOptions = (options, overrideOptions) => overrideOptions ? {
9809
9824
  ...options,
9810
9825
  ...overrideOptions
@@ -9964,6 +9979,104 @@ function make20(ast, options) {
9964
9979
  return self;
9965
9980
  }
9966
9981
 
9982
+ // node_modules/effect/dist/JsonPointer.js
9983
+ function escapeToken(token) {
9984
+ return token.replace(/~/g, "~0").replace(/\//g, "~1");
9985
+ }
9986
+ function unescapeToken(token) {
9987
+ return token.replace(/~1/g, "/").replace(/~0/g, "~");
9988
+ }
9989
+ function formatUriFragmentToken(token) {
9990
+ return encodeURI(escapeToken(token)).replace(/#/g, "%23");
9991
+ }
9992
+ function decodeUriFragment(fragment) {
9993
+ if (fragment.length === 0 || fragment === "#")
9994
+ return "";
9995
+ if (!fragment.startsWith("#"))
9996
+ return;
9997
+ const encoded = fragment.slice(1);
9998
+ try {
9999
+ if (encodeURI(encoded).replace(/%25/g, "%").replace(/#/g, "%23") !== encoded)
10000
+ return;
10001
+ const pointer = decodeURIComponent(encoded);
10002
+ return pointer.startsWith("/") && !/~(?:[^01]|$)/.test(pointer) ? pointer : undefined;
10003
+ } catch {
10004
+ return;
10005
+ }
10006
+ }
10007
+
10008
+ // node_modules/effect/dist/JsonSchema.js
10009
+ function transformSchema(node, transform) {
10010
+ return walk(node, false, true);
10011
+ function walk(node, inheritedResource, isRoot = false) {
10012
+ if (!isObject(node))
10013
+ return node;
10014
+ const inEmbeddedResource = inheritedResource || !isRoot && createsResource(node.$id);
10015
+ const out = {};
10016
+ for (const key of Object.keys(node)) {
10017
+ const value = node[key];
10018
+ let transformed = value;
10019
+ switch (key) {
10020
+ case "$defs":
10021
+ case "properties":
10022
+ case "patternProperties":
10023
+ case "dependentSchemas":
10024
+ transformed = mapObject(value, (value) => walk(value, inEmbeddedResource)) ?? value;
10025
+ break;
10026
+ case "allOf":
10027
+ case "anyOf":
10028
+ case "oneOf":
10029
+ case "prefixItems":
10030
+ transformed = Array.isArray(value) ? value.map((value) => walk(value, inEmbeddedResource)) : value;
10031
+ break;
10032
+ case "not":
10033
+ case "additionalProperties":
10034
+ case "propertyNames":
10035
+ case "unevaluatedProperties":
10036
+ case "items":
10037
+ case "contains":
10038
+ case "unevaluatedItems":
10039
+ case "if":
10040
+ case "then":
10041
+ case "else":
10042
+ case "contentSchema":
10043
+ transformed = walk(value, inEmbeddedResource);
10044
+ }
10045
+ assignProperty(out, key, transformed);
10046
+ }
10047
+ transform(out, inEmbeddedResource);
10048
+ return out;
10049
+ }
10050
+ }
10051
+ function rewriteRefs(schema, rewrite) {
10052
+ return transformSchema(schema, (schema) => {
10053
+ rewriteSchemaRef(schema, rewrite);
10054
+ });
10055
+ }
10056
+ function rewriteSchemaRef(schema, rewrite) {
10057
+ if (typeof schema.$ref === "string") {
10058
+ assignProperty(schema, "$ref", rewrite(schema.$ref, "$ref"));
10059
+ }
10060
+ if (typeof schema.$dynamicRef === "string") {
10061
+ assignProperty(schema, "$dynamicRef", rewrite(schema.$dynamicRef, "$dynamicRef"));
10062
+ }
10063
+ }
10064
+ function mapObject(value, f) {
10065
+ if (!isObject(value))
10066
+ return;
10067
+ const out = {};
10068
+ for (const key of Object.keys(value)) {
10069
+ assignProperty(out, key, f(value[key], key));
10070
+ }
10071
+ return out;
10072
+ }
10073
+ function createsResource(id) {
10074
+ return typeof id === "string" && id.length > 0 && id[0] !== "#";
10075
+ }
10076
+ var PRE_2020_TO_2020_COLLISIONS = ["$anchor", "$defs", "$dynamicAnchor", "$dynamicRef", "$vocabulary", "contentSchema", "dependentRequired", "dependentSchemas", "maxContains", "minContains", "prefixItems", "unevaluatedItems", "unevaluatedProperties"];
10077
+ var DRAFT_07_TO_2020_COLLISIONS = [...PRE_2020_TO_2020_COLLISIONS, "deprecated"];
10078
+ var OPEN_API_30_TO_2020_COLLISIONS = [...PRE_2020_TO_2020_COLLISIONS, "$comment", "$id", "$schema", "const", "contains", "contentEncoding", "contentMediaType", "else", "examples", "if", "patternProperties", "propertyNames", "then"];
10079
+
9967
10080
  // node_modules/effect/dist/internal/schema/toCodec.js
9968
10081
  function toCodecJson2(schema) {
9969
10082
  return make20(toCodecJsonAST(schema.ast), {
@@ -10131,6 +10244,1020 @@ var toCodecStringTreeAST = /* @__PURE__ */ applyToSelfOrLastLinkEncodingIdempote
10131
10244
  stopAt: isCodecArrayFromSingleLink
10132
10245
  });
10133
10246
 
10247
+ // node_modules/effect/dist/RegExp.js
10248
+ var RegExp2 = globalThis.RegExp;
10249
+ var escape = (string) => string.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
10250
+
10251
+ // node_modules/effect/dist/internal/errors.js
10252
+ function errorWithPath(message, path) {
10253
+ if (path.length > 0) {
10254
+ message += `
10255
+ at ${formatPath(path)}`;
10256
+ }
10257
+ return new Error(message);
10258
+ }
10259
+
10260
+ // node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
10261
+ function formatDefinitionReference(key) {
10262
+ return `#/$defs/${formatUriFragmentToken(key)}`;
10263
+ }
10264
+ var jsonSchemaAnnotationExcludedKeys = /* @__PURE__ */ new Set([...annotationExcludedKeys, IDENTIFIER_FALLBACK_KEY, ...jsonSchemaAnnotationKeys]);
10265
+ function collectJsonSchemaAnnotations(annotations, options) {
10266
+ if (annotations === undefined)
10267
+ return;
10268
+ const out = {};
10269
+ const title = annotations.title;
10270
+ if (typeof title === "string")
10271
+ out.title = title;
10272
+ const description = annotations.description;
10273
+ const expected = annotations.expected;
10274
+ if (typeof description === "string")
10275
+ out.description = description;
10276
+ else if (options?.generateDescriptions === true && typeof expected === "string")
10277
+ out.description = expected;
10278
+ const defaultValue = annotations.default;
10279
+ if (isJson(defaultValue))
10280
+ out.default = defaultValue;
10281
+ const examples = annotations.examples;
10282
+ if (Array.isArray(examples) && isJson(examples))
10283
+ out.examples = examples;
10284
+ const readOnly = annotations.readOnly;
10285
+ if (typeof readOnly === "boolean")
10286
+ out.readOnly = readOnly;
10287
+ const writeOnly = annotations.writeOnly;
10288
+ if (typeof writeOnly === "boolean")
10289
+ out.writeOnly = writeOnly;
10290
+ const format = annotations.format;
10291
+ if (typeof format === "string")
10292
+ out.format = format;
10293
+ const contentEncoding = annotations.contentEncoding;
10294
+ if (typeof contentEncoding === "string")
10295
+ out.contentEncoding = contentEncoding;
10296
+ const contentMediaType = annotations.contentMediaType;
10297
+ if (typeof contentMediaType === "string")
10298
+ out.contentMediaType = contentMediaType;
10299
+ const contentSchema = annotations.contentSchema;
10300
+ if (isJson(contentSchema))
10301
+ out.contentSchema = contentSchema;
10302
+ if (options?.includeAnnotationKey !== undefined) {
10303
+ for (const [key, value] of Object.entries(annotations)) {
10304
+ if (jsonSchemaAnnotationExcludedKeys.has(key) || !options.includeAnnotationKey(key)) {
10305
+ continue;
10306
+ }
10307
+ if (isJson(value))
10308
+ assignProperty(out, key, value);
10309
+ }
10310
+ }
10311
+ return Object.keys(out).length === 0 ? undefined : out;
10312
+ }
10313
+ function extractJsonSchemaNumberType(schema) {
10314
+ let type = schema.type === "number" || schema.type === "integer" ? schema.type : undefined;
10315
+ let out = schema;
10316
+ if (type !== undefined) {
10317
+ out = {
10318
+ ...schema
10319
+ };
10320
+ delete out.type;
10321
+ }
10322
+ if (Array.isArray(out.allOf)) {
10323
+ const members = [];
10324
+ let changed = false;
10325
+ for (const member of out.allOf) {
10326
+ const extracted = extractJsonSchemaNumberType(member);
10327
+ if (extracted.type !== undefined) {
10328
+ changed = true;
10329
+ if (type === undefined || extracted.type === "integer")
10330
+ type = extracted.type;
10331
+ }
10332
+ if (Object.keys(extracted.schema).length > 0)
10333
+ members.push(extracted.schema);
10334
+ }
10335
+ if (changed) {
10336
+ const {
10337
+ allOf: _,
10338
+ ...rest
10339
+ } = out;
10340
+ out = members.length === 0 ? rest : {
10341
+ ...rest,
10342
+ allOf: members
10343
+ };
10344
+ }
10345
+ }
10346
+ return {
10347
+ type,
10348
+ schema: out
10349
+ };
10350
+ }
10351
+ function isJsonSchemaNumberEncoding(schema) {
10352
+ if (!Array.isArray(schema.anyOf) || schema.anyOf.length !== 2 || schema.anyOf[0]?.type !== "number")
10353
+ return false;
10354
+ const special = schema.anyOf[1];
10355
+ return special?.type === "string" && Array.isArray(special.enum) && special.enum.length === 3 && special.enum.includes("NaN") && special.enum.includes("Infinity") && special.enum.includes("-Infinity");
10356
+ }
10357
+ var inlineableCheckKeywords = "|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|";
10358
+ function hasOnlyKeywords(schema, allowed) {
10359
+ return Object.keys(schema).every((key) => allowed.includes(`|${key}|`));
10360
+ }
10361
+ function hasNoCollisions(left, rightKeys) {
10362
+ return typeof left.$ref !== "string" && rightKeys.every((key) => !Object.hasOwn(left, key));
10363
+ }
10364
+ var promotableAnnotationKeywords = "|title|description|default|examples|readOnly|writeOnly|";
10365
+ var inlineableAnnotatedCheckKeywords = inlineableCheckKeywords + promotableAnnotationKeywords;
10366
+ function appendJsonSchema(left, right, inlineCheck) {
10367
+ if (Object.keys(left).length === 0)
10368
+ return right;
10369
+ const rightKeys = Object.keys(right);
10370
+ if (rightKeys.length === 0)
10371
+ return left;
10372
+ const leftType = left.type === "number" || left.type === "integer" ? left.type : undefined;
10373
+ const isNumberEncoding = isJsonSchemaNumberEncoding(left);
10374
+ if (leftType !== undefined || isNumberEncoding) {
10375
+ const extracted = extractJsonSchemaNumberType(right);
10376
+ if (extracted.type !== undefined) {
10377
+ const type = leftType === "integer" || extracted.type === "integer" ? "integer" : "number";
10378
+ const base = {
10379
+ ...left,
10380
+ type
10381
+ };
10382
+ if (isNumberEncoding)
10383
+ delete base.anyOf;
10384
+ const extractedKeys = Object.keys(extracted.schema);
10385
+ if (extractedKeys.length === 0)
10386
+ return base;
10387
+ return hasOnlyKeywords(extracted.schema, promotableAnnotationKeywords) && hasNoCollisions(base, extractedKeys) ? {
10388
+ ...base,
10389
+ ...extracted.schema
10390
+ } : appendJsonSchema(base, extracted.schema, inlineCheck);
10391
+ }
10392
+ }
10393
+ if (inlineCheck && hasNoCollisions(left, rightKeys)) {
10394
+ return {
10395
+ ...left,
10396
+ ...right
10397
+ };
10398
+ }
10399
+ const members = Array.isArray(right.allOf) && rightKeys.length === 1 ? right.allOf : [right];
10400
+ if (Array.isArray(left.allOf)) {
10401
+ return {
10402
+ ...left,
10403
+ allOf: [...left.allOf, ...members]
10404
+ };
10405
+ }
10406
+ if (typeof left.$ref === "string") {
10407
+ return {
10408
+ allOf: [left, ...members]
10409
+ };
10410
+ }
10411
+ return {
10412
+ ...left,
10413
+ allOf: members
10414
+ };
10415
+ }
10416
+ function isExact(exactness, seen = new Set) {
10417
+ if (typeof exactness === "boolean")
10418
+ return exactness;
10419
+ if (seen.has(exactness))
10420
+ return true;
10421
+ seen.add(exactness);
10422
+ return exactness.every((dependency) => isExact(dependency, seen));
10423
+ }
10424
+ function isApproximateCheckOutput(output) {
10425
+ return Array.isArray(output);
10426
+ }
10427
+ function compileJsonSchema(representations, rootPaths, references, options) {
10428
+ const compiledDefinitions = new Map;
10429
+ const definitionAliases = new Map;
10430
+ const compiledRepresentations = new WeakMap;
10431
+ const pendingOneOf = new Map;
10432
+ const fallbackDefinitions = new Map;
10433
+ const referenceKeys = Object.keys(references);
10434
+ for (const key of referenceKeys) {
10435
+ compileDefinition(key, ["references", key]);
10436
+ }
10437
+ const compiledSchemas = map3(representations, (representation, index) => recur(representation, rootPaths[index], []));
10438
+ for (const [branches, schemas] of pendingOneOf.values()) {
10439
+ if (!isExact(branches)) {
10440
+ for (const schema of schemas) {
10441
+ if (Array.isArray(schema.oneOf)) {
10442
+ schema.anyOf = schema.oneOf;
10443
+ delete schema.oneOf;
10444
+ }
10445
+ }
10446
+ }
10447
+ }
10448
+ for (const key of referenceKeys) {
10449
+ const representation = references[key];
10450
+ const fallback = getIdentifierFallback(representation);
10451
+ if (fallback === undefined)
10452
+ continue;
10453
+ const schema = compiledDefinitions.get(key)[0];
10454
+ const candidates = fallbackDefinitions.get(fallback);
10455
+ const match = candidates?.find((candidate) => equals(compiledDefinitions.get(candidate)[0], schema));
10456
+ if (match === undefined) {
10457
+ if (candidates === undefined)
10458
+ fallbackDefinitions.set(fallback, [key]);
10459
+ else
10460
+ candidates.push(key);
10461
+ } else {
10462
+ definitionAliases.set(key, match);
10463
+ }
10464
+ }
10465
+ const schemas = map3(compiledSchemas, finalizeJsonSchema);
10466
+ const definitions = {};
10467
+ for (const key of referenceKeys) {
10468
+ if (!definitionAliases.has(key)) {
10469
+ assignProperty(definitions, key, finalizeJsonSchema(compiledDefinitions.get(key)[0]));
10470
+ }
10471
+ }
10472
+ return {
10473
+ dialect: "draft-2020-12",
10474
+ schemas,
10475
+ definitions
10476
+ };
10477
+ function registerPendingOneOf(schema) {
10478
+ if (Array.isArray(schema.oneOf))
10479
+ pendingOneOf.get(schema.oneOf)?.[1].push(schema);
10480
+ return schema;
10481
+ }
10482
+ function compileDefinition(key, path) {
10483
+ if (!Object.hasOwn(references, key)) {
10484
+ throw errorWithPath(`Invalid reference ${key}`, [...path, "$ref"]);
10485
+ }
10486
+ const cached = compiledDefinitions.get(key);
10487
+ if (cached !== undefined)
10488
+ return cached;
10489
+ const result = [{}, []];
10490
+ compiledDefinitions.set(key, result);
10491
+ result[0] = recur(references[key], ["references", key], result[1]);
10492
+ return result;
10493
+ }
10494
+ function finalizeJsonSchema(schema) {
10495
+ return rewriteRefs(schema, ($ref) => {
10496
+ const pointer = decodeUriFragment($ref);
10497
+ if (pointer === undefined) {
10498
+ if (/^#(?:\/|%2f)/i.test($ref)) {
10499
+ throw new Error(`Invalid JSON Pointer URI fragment ${JSON.stringify($ref)}`);
10500
+ }
10501
+ return $ref;
10502
+ }
10503
+ if (!pointer.startsWith("/$defs/"))
10504
+ return $ref;
10505
+ const separator = pointer.indexOf("/", 7);
10506
+ const canonical = definitionAliases.get(unescapeToken(pointer.slice(7, separator < 0 ? undefined : separator)));
10507
+ if (canonical === undefined)
10508
+ return $ref;
10509
+ return $ref.replace(/^#(?:\/|%2f).*?(?:\/|%2f).*?(?=\/|%2f|$)/i, formatDefinitionReference(canonical));
10510
+ });
10511
+ }
10512
+ function getIdentifierFallback(representation) {
10513
+ if (representation._tag === "Reference")
10514
+ return;
10515
+ const annotations = representation.checks.length === 0 ? representation.annotations : representation.checks[representation.checks.length - 1].annotations;
10516
+ return typeof annotations?.identifier !== "string" && typeof annotations?.[IDENTIFIER_FALLBACK_KEY] === "string" ? annotations[IDENTIFIER_FALLBACK_KEY] : undefined;
10517
+ }
10518
+ function compileCheck(check, type, path, dependencies) {
10519
+ const annotations = check.annotations;
10520
+ const callback = annotations?.toJsonSchema;
10521
+ if (callback !== undefined) {
10522
+ const schemas = check.representation?.schemas?.map((schema, index) => recur(schema, [...path, "representation", "schemas", index], dependencies)) ?? [];
10523
+ const result = callback({
10524
+ type,
10525
+ schemas
10526
+ });
10527
+ const approximate = isApproximateCheckOutput(result);
10528
+ if (approximate) {
10529
+ dependencies.push(false);
10530
+ }
10531
+ const fragment = approximate ? result[0] : result;
10532
+ const ordinary = collectJsonSchemaAnnotations(annotations, options);
10533
+ const schema = ordinary === undefined ? fragment : {
10534
+ ...fragment,
10535
+ ...ordinary
10536
+ };
10537
+ const allowed = ordinary === undefined ? inlineableCheckKeywords : inlineableAnnotatedCheckKeywords;
10538
+ return [schema, check._tag === "Filter" && hasOnlyKeywords(schema, allowed) && (ordinary === undefined || hasOnlyKeywords(ordinary, promotableAnnotationKeywords)) ? true : undefined];
10539
+ }
10540
+ if (check._tag === "Filter") {
10541
+ dependencies.push(false);
10542
+ return;
10543
+ }
10544
+ const schemas = check.checks.flatMap((child, index) => {
10545
+ const result = compileCheck(child, type, [...path, "checks", index], dependencies);
10546
+ return result === undefined ? [] : [result[0]];
10547
+ });
10548
+ if (schemas.length === 0)
10549
+ return;
10550
+ const ordinary = collectJsonSchemaAnnotations(annotations, options);
10551
+ const schema = {
10552
+ allOf: schemas
10553
+ };
10554
+ return [ordinary === undefined ? schema : {
10555
+ ...schema,
10556
+ ...ordinary
10557
+ }];
10558
+ }
10559
+ function recur(representation, path, dependencies) {
10560
+ if (representation._tag === "Reference") {
10561
+ dependencies.push(compileDefinition(representation.$ref, path)[1]);
10562
+ return {
10563
+ $ref: formatDefinitionReference(representation.$ref)
10564
+ };
10565
+ }
10566
+ const cached = compiledRepresentations.get(representation);
10567
+ if (cached !== undefined) {
10568
+ dependencies.push(cached[1]);
10569
+ return cached[0];
10570
+ }
10571
+ const local = [];
10572
+ dependencies.push(local);
10573
+ let output = on(representation, path, local);
10574
+ const ordinary = collectJsonSchemaAnnotations(representation.annotations, options);
10575
+ if (ordinary !== undefined) {
10576
+ output = {
10577
+ ...output,
10578
+ ...ordinary
10579
+ };
10580
+ }
10581
+ for (let index = 0;index < representation.checks.length; index++) {
10582
+ const type = typeof output.type === "string" && isJsonSchemaType(output.type) ? output.type : undefined;
10583
+ const check = compileCheck(representation.checks[index], type, [...path, "checks", index], local);
10584
+ if (check !== undefined)
10585
+ output = appendJsonSchema(output, ...check);
10586
+ }
10587
+ compiledRepresentations.set(representation, [output, local]);
10588
+ return registerPendingOneOf(output);
10589
+ }
10590
+ function on(representation, path, dependencies) {
10591
+ switch (representation._tag) {
10592
+ case "Any":
10593
+ case "Unknown":
10594
+ return {};
10595
+ case "ObjectKeyword":
10596
+ return {
10597
+ anyOf: [{
10598
+ type: "object"
10599
+ }, {
10600
+ type: "array"
10601
+ }]
10602
+ };
10603
+ case "Void":
10604
+ case "Undefined":
10605
+ case "Null":
10606
+ return {
10607
+ type: "null"
10608
+ };
10609
+ case "BigInt":
10610
+ return {
10611
+ type: "string",
10612
+ allOf: [{
10613
+ pattern: "^-?\\d+$"
10614
+ }]
10615
+ };
10616
+ case "Symbol":
10617
+ return {
10618
+ type: "string",
10619
+ allOf: [{
10620
+ pattern: "^Symbol\\(([\\s\\S]*)\\)$"
10621
+ }]
10622
+ };
10623
+ case "UniqueSymbol":
10624
+ return globalThis.Symbol.keyFor(representation.symbol) === undefined ? {
10625
+ not: {}
10626
+ } : {
10627
+ type: "string",
10628
+ enum: [globalThis.String(representation.symbol)]
10629
+ };
10630
+ case "Declaration":
10631
+ dependencies.push(false);
10632
+ return {};
10633
+ case "Suspend":
10634
+ return recur(representation.thunk, [...path, "thunk"], dependencies);
10635
+ case "Never":
10636
+ return {
10637
+ not: {}
10638
+ };
10639
+ case "String":
10640
+ return {
10641
+ type: "string"
10642
+ };
10643
+ case "Number":
10644
+ return {
10645
+ anyOf: [{
10646
+ type: "number"
10647
+ }, {
10648
+ type: "string",
10649
+ enum: ["NaN", "Infinity", "-Infinity"]
10650
+ }]
10651
+ };
10652
+ case "Boolean":
10653
+ return {
10654
+ type: "boolean"
10655
+ };
10656
+ case "Literal": {
10657
+ const literal = representation.literal;
10658
+ return typeof literal === "bigint" ? {
10659
+ type: "string",
10660
+ enum: [globalThis.String(literal)]
10661
+ } : {
10662
+ type: typeof literal,
10663
+ enum: [literal]
10664
+ };
10665
+ }
10666
+ case "Enum": {
10667
+ const types = representation.enums.map(([title, literal], index) => {
10668
+ if (typeof literal === "number" && !globalThis.Number.isFinite(literal)) {
10669
+ throw errorWithPath(`Invalid numeric enum value ${globalThis.String(literal)}`, [...path, "enums", index, 1]);
10670
+ }
10671
+ return {
10672
+ type: typeof literal,
10673
+ enum: [literal],
10674
+ title
10675
+ };
10676
+ });
10677
+ return types.length === 0 ? {
10678
+ not: {}
10679
+ } : {
10680
+ anyOf: types
10681
+ };
10682
+ }
10683
+ case "TemplateLiteral":
10684
+ return {
10685
+ type: "string",
10686
+ pattern: `^${representation.parts.map(getPartPattern).join("")}$`
10687
+ };
10688
+ case "Arrays": {
10689
+ if (representation.rest.length > 1) {
10690
+ throw errorWithPath("Invalid schema representation document", [...path, "rest"]);
10691
+ }
10692
+ const out = {
10693
+ type: "array"
10694
+ };
10695
+ let minItems = representation.elements.length;
10696
+ const prefixItems = representation.elements.map((element, index) => {
10697
+ if (element.isOptional)
10698
+ minItems--;
10699
+ const schema = recur(element.type, [...path, "elements", index, "type"], dependencies);
10700
+ const annotations = collectJsonSchemaAnnotations(element.annotations, options);
10701
+ return annotations === undefined ? schema : registerPendingOneOf(appendJsonSchema(schema, annotations));
10702
+ });
10703
+ if (prefixItems.length > 0) {
10704
+ out.prefixItems = prefixItems;
10705
+ out.maxItems = representation.elements.length;
10706
+ if (minItems > 0)
10707
+ out.minItems = minItems;
10708
+ } else {
10709
+ out.items = false;
10710
+ }
10711
+ if (representation.rest.length === 1) {
10712
+ delete out.maxItems;
10713
+ const rest = recur(representation.rest[0], [...path, "rest", 0], dependencies);
10714
+ if (Object.keys(rest).length > 0)
10715
+ out.items = rest;
10716
+ else
10717
+ delete out.items;
10718
+ }
10719
+ return out;
10720
+ }
10721
+ case "Objects": {
10722
+ if (representation.propertySignatures.length === 0 && representation.indexSignatures.length === 0) {
10723
+ return {
10724
+ not: {
10725
+ type: "null"
10726
+ }
10727
+ };
10728
+ }
10729
+ const out = {
10730
+ type: "object"
10731
+ };
10732
+ const properties = {};
10733
+ const required = [];
10734
+ for (let index = 0;index < representation.propertySignatures.length; index++) {
10735
+ const property = representation.propertySignatures[index];
10736
+ if (typeof property.name !== "string") {
10737
+ throw errorWithPath("Invalid schema representation document", [...path, "propertySignatures", index, "name"]);
10738
+ }
10739
+ const name = property.name;
10740
+ const schema = recur(property.type, [...path, "propertySignatures", index, "type"], dependencies);
10741
+ const annotations = collectJsonSchemaAnnotations(property.annotations, options);
10742
+ assignProperty(properties, name, annotations === undefined ? schema : registerPendingOneOf(appendJsonSchema(schema, annotations)));
10743
+ if (!property.isOptional)
10744
+ required.push(name);
10745
+ }
10746
+ if (representation.propertySignatures.length > 0)
10747
+ out.properties = properties;
10748
+ if (required.length > 0)
10749
+ out.required = required;
10750
+ const patternProperties = {};
10751
+ const additionalPropertySchemas = [];
10752
+ const indexValueSchemas = [];
10753
+ let hasUnrepresentableIndexPattern = false;
10754
+ for (let index = 0;index < representation.indexSignatures.length; index++) {
10755
+ const signature = representation.indexSignatures[index];
10756
+ let type = recur(signature.type, [...path, "indexSignatures", index, "type"], dependencies);
10757
+ if (equals(type, {
10758
+ not: {}
10759
+ }))
10760
+ type = false;
10761
+ indexValueSchemas.push(type);
10762
+ const patterns = getParameterPatterns(signature.parameter, [...path, "indexSignatures", index, "parameter"], new Set);
10763
+ if (patterns === undefined) {
10764
+ hasUnrepresentableIndexPattern = true;
10765
+ dependencies.push(false);
10766
+ continue;
10767
+ }
10768
+ if (patterns.length === 0) {
10769
+ additionalPropertySchemas.push(type);
10770
+ } else {
10771
+ for (const pattern of patterns) {
10772
+ const previous = patternProperties[pattern];
10773
+ assignProperty(patternProperties, pattern, previous === undefined ? type : previous === false || type === false ? false : registerPendingOneOf(appendJsonSchema(previous, type)));
10774
+ }
10775
+ }
10776
+ }
10777
+ const hasPatternProperties = Object.keys(patternProperties).length > 0;
10778
+ if (hasPatternProperties) {
10779
+ out.patternProperties = patternProperties;
10780
+ }
10781
+ if (hasUnrepresentableIndexPattern && options?.onExcessProperty === "error") {
10782
+ const propertyNames = [];
10783
+ if (representation.propertySignatures.length > 0) {
10784
+ propertyNames.push({
10785
+ enum: Object.keys(properties)
10786
+ });
10787
+ }
10788
+ for (let index = 0;index < representation.indexSignatures.length; index++) {
10789
+ propertyNames.push(recur(representation.indexSignatures[index].parameter, [...path, "indexSignatures", index, "parameter"], dependencies));
10790
+ }
10791
+ out.propertyNames = propertyNames.length === 1 ? propertyNames[0] : {
10792
+ anyOf: propertyNames
10793
+ };
10794
+ out.additionalProperties = indexValueSchemas.length === 1 ? indexValueSchemas[0] : {
10795
+ anyOf: indexValueSchemas
10796
+ };
10797
+ if (additionalPropertySchemas.length > 0) {
10798
+ out.allOf = additionalPropertySchemas.map((type) => ({
10799
+ type: "object",
10800
+ additionalProperties: type
10801
+ }));
10802
+ }
10803
+ } else if (additionalPropertySchemas.length === 0) {
10804
+ out.additionalProperties = hasUnrepresentableIndexPattern || options?.onExcessProperty !== "error";
10805
+ } else if (additionalPropertySchemas.length === 1 && representation.propertySignatures.length === 0 && !hasPatternProperties) {
10806
+ out.additionalProperties = additionalPropertySchemas[0];
10807
+ } else if (additionalPropertySchemas.length > 0) {
10808
+ out.allOf = additionalPropertySchemas.map((type) => ({
10809
+ type: "object",
10810
+ additionalProperties: type
10811
+ }));
10812
+ }
10813
+ if (typeof out.additionalProperties === "object" && out.additionalProperties !== null && Object.keys(out.additionalProperties).length === 0) {
10814
+ delete out.additionalProperties;
10815
+ }
10816
+ return out;
10817
+ }
10818
+ case "Union": {
10819
+ const branches = [];
10820
+ const types = representation.types.map((type, index) => recur(type, [...path, "types", index], branches));
10821
+ dependencies.push(branches);
10822
+ if (types.length === 0)
10823
+ return {
10824
+ not: {}
10825
+ };
10826
+ const mode = representation.options?.mode ?? "anyOf";
10827
+ if (mode === "anyOf" && types.length > 1) {
10828
+ const compacted = compactEnums(types);
10829
+ if (compacted !== undefined)
10830
+ return compacted;
10831
+ }
10832
+ if (mode === "oneOf")
10833
+ pendingOneOf.set(types, [branches, []]);
10834
+ return {
10835
+ [mode]: types
10836
+ };
10837
+ }
10838
+ }
10839
+ }
10840
+ function getParameterPatterns(parameter, path, seenReferences) {
10841
+ switch (parameter._tag) {
10842
+ case "Reference": {
10843
+ if (!Object.hasOwn(references, parameter.$ref)) {
10844
+ throw errorWithPath(`Invalid reference ${parameter.$ref}`, [...path, "$ref"]);
10845
+ }
10846
+ compileDefinition(parameter.$ref, path);
10847
+ if (seenReferences.has(parameter.$ref))
10848
+ return;
10849
+ const next = new Set(seenReferences).add(parameter.$ref);
10850
+ return getParameterPatterns(references[parameter.$ref], ["references", parameter.$ref], next);
10851
+ }
10852
+ case "String": {
10853
+ if (parameter.checks.length === 0)
10854
+ return [];
10855
+ if (parameter.checks.length !== 1 || parameter.checks[0]._tag !== "Filter" || parameter.checks[0].annotations?.toJsonSchema === undefined) {
10856
+ return;
10857
+ }
10858
+ const dependencies = [];
10859
+ const schema = recur(parameter, path, dependencies);
10860
+ if (!isExact(dependencies))
10861
+ return;
10862
+ return schema.type === "string" && typeof schema.pattern === "string" && hasOnlyKeywords(schema, "|type|pattern|title|description|default|examples|readOnly|writeOnly|") ? [schema.pattern] : undefined;
10863
+ }
10864
+ case "TemplateLiteral":
10865
+ return parameter.checks.length === 0 ? [`^${parameter.parts.map(getPartPattern).join("")}$`] : undefined;
10866
+ case "Union": {
10867
+ if (parameter.types.length === 0 || parameter.checks.length > 0 || parameter.options?.mode === "oneOf") {
10868
+ return;
10869
+ }
10870
+ const patterns = [];
10871
+ for (let index = 0;index < parameter.types.length; index++) {
10872
+ const memberPatterns = getParameterPatterns(parameter.types[index], [...path, "types", index], seenReferences);
10873
+ if (memberPatterns === undefined)
10874
+ return;
10875
+ if (memberPatterns.length === 0)
10876
+ return [];
10877
+ patterns.push(...memberPatterns);
10878
+ }
10879
+ return patterns;
10880
+ }
10881
+ default:
10882
+ throw errorWithPath("Invalid schema representation document", path);
10883
+ }
10884
+ }
10885
+ }
10886
+ function isJsonSchemaType(input) {
10887
+ return input === "string" || input === "number" || input === "boolean" || input === "array" || input === "object" || input === "null" || input === "integer";
10888
+ }
10889
+ function compactEnums(schemas) {
10890
+ let sharedType = undefined;
10891
+ const values = [];
10892
+ for (const schema of schemas) {
10893
+ const keys = Object.keys(schema);
10894
+ if (keys.length !== 2 || schema.type === undefined || !Array.isArray(schema.enum) || schema.enum.length === 0) {
10895
+ return;
10896
+ }
10897
+ if (sharedType === undefined)
10898
+ sharedType = schema.type;
10899
+ else if (schema.type !== sharedType)
10900
+ return;
10901
+ for (const value of schema.enum) {
10902
+ if (values.includes(value))
10903
+ return;
10904
+ values.push(value);
10905
+ }
10906
+ }
10907
+ return {
10908
+ type: sharedType,
10909
+ enum: values
10910
+ };
10911
+ }
10912
+ function getPartPattern(part) {
10913
+ switch (part._tag) {
10914
+ case "Literal":
10915
+ return escape(globalThis.String(part.literal));
10916
+ case "String":
10917
+ return STRING_PATTERN;
10918
+ case "Number":
10919
+ return FINITE_PATTERN;
10920
+ case "TemplateLiteral":
10921
+ return part.parts.map(getPartPattern).join("");
10922
+ case "Union":
10923
+ return `(?:${part.types.map(getPartPattern).join("|")})`;
10924
+ default:
10925
+ throw errorWithPath("Invalid schema representation document", []);
10926
+ }
10927
+ }
10928
+ function toJsonSchemaDocument2(document, options) {
10929
+ const output = compileJsonSchema([document.representation], [["representation"]], document.references, options);
10930
+ return {
10931
+ dialect: output.dialect,
10932
+ schema: output.schemas[0],
10933
+ definitions: output.definitions
10934
+ };
10935
+ }
10936
+
10937
+ // node_modules/effect/dist/internal/schema/toRepresentation.js
10938
+ var defaultReferencePolicy = ({
10939
+ identifier
10940
+ }) => identifier;
10941
+ function annotationsField(annotations) {
10942
+ return annotations === undefined ? undefined : {
10943
+ annotations
10944
+ };
10945
+ }
10946
+ function toRepresentation(ast, options) {
10947
+ const {
10948
+ references,
10949
+ representations
10950
+ } = toRepresentations([ast], options);
10951
+ return {
10952
+ representation: representations[0],
10953
+ references
10954
+ };
10955
+ }
10956
+ function toRepresentations(asts, options) {
10957
+ const references = {};
10958
+ const referenceOwners = new Map;
10959
+ const buildingReferences = new Set;
10960
+ const candidates = new Map;
10961
+ const visitingCandidates = new Set;
10962
+ for (const ast of asts)
10963
+ visit(ast);
10964
+ const referencePolicy = options?.referencePolicy ?? defaultReferencePolicy;
10965
+ for (const candidatesByIdentifier of candidates.values()) {
10966
+ for (const candidate of candidatesByIdentifier.values()) {
10967
+ const requestedReference = referencePolicy({
10968
+ ast: candidate.ast,
10969
+ occurrences: candidate.occurrences,
10970
+ identifier: candidate.identifier
10971
+ });
10972
+ if (requestedReference !== undefined) {
10973
+ const separator = requestedReference === candidate.identifier || !requestedReference.endsWith("_") ? "_" : "";
10974
+ candidate.reference = getReference(requestedReference, candidate, separator);
10975
+ } else if (candidate.isRecursive) {
10976
+ candidate.reference = getReference(`${candidate.ast._tag}_`, candidate, "");
10977
+ }
10978
+ }
10979
+ }
10980
+ const representations = map3(asts, (ast) => recur(ast));
10981
+ return {
10982
+ representations,
10983
+ references
10984
+ };
10985
+ function getReference(prefix, owner, separator = "_") {
10986
+ let candidate = prefix;
10987
+ let suffix = 0;
10988
+ while (referenceOwners.has(candidate)) {
10989
+ if (referenceOwners.get(candidate) === owner)
10990
+ return candidate;
10991
+ candidate = `${prefix}${separator}${++suffix}`;
10992
+ }
10993
+ referenceOwners.set(candidate, owner);
10994
+ return candidate;
10995
+ }
10996
+ function annotateReference(ast, candidate, reference) {
10997
+ const fallback = candidate.fallback;
10998
+ if (fallback !== undefined) {
10999
+ return resolveIdentifierFallback(ast) === fallback ? ast : annotate(ast, {
11000
+ [IDENTIFIER_FALLBACK_KEY]: fallback
11001
+ });
11002
+ }
11003
+ return reference === candidate.identifier ? ast : annotate(ast, {
11004
+ identifier: reference
11005
+ });
11006
+ }
11007
+ function makeReference(reference, ast) {
11008
+ if (!Object.hasOwn(references, reference) && !buildingReferences.has(reference)) {
11009
+ buildingReferences.add(reference);
11010
+ const representation = on(ast);
11011
+ buildingReferences.delete(reference);
11012
+ assignProperty(references, reference, representation);
11013
+ }
11014
+ return {
11015
+ _tag: "Reference",
11016
+ $ref: reference
11017
+ };
11018
+ }
11019
+ function getCandidate(input) {
11020
+ const ast = getLastEncoding(input);
11021
+ const owner = getContextOwner(ast);
11022
+ let identifier = resolveIdentifier(ast);
11023
+ const fallback = identifier === undefined ? (ast !== input ? resolveIdentifier(input) : undefined) ?? resolveIdentifierFallback(ast) : undefined;
11024
+ if (fallback !== undefined)
11025
+ identifier = `${fallback}Encoded`;
11026
+ let candidatesByIdentifier = candidates.get(owner);
11027
+ if (candidatesByIdentifier === undefined) {
11028
+ candidatesByIdentifier = new Map;
11029
+ candidates.set(owner, candidatesByIdentifier);
11030
+ }
11031
+ let candidate = candidatesByIdentifier.get(identifier);
11032
+ if (candidate === undefined) {
11033
+ candidate = {
11034
+ ast: owner,
11035
+ identifier,
11036
+ fallback,
11037
+ occurrences: 0,
11038
+ isRecursive: false,
11039
+ reference: undefined
11040
+ };
11041
+ candidatesByIdentifier.set(identifier, candidate);
11042
+ }
11043
+ return candidate;
11044
+ }
11045
+ function visit(input) {
11046
+ const candidate = getCandidate(input);
11047
+ const ast = candidate.ast;
11048
+ candidate.occurrences++;
11049
+ if (visitingCandidates.has(candidate)) {
11050
+ candidate.isRecursive = true;
11051
+ return;
11052
+ }
11053
+ if (candidate.occurrences > 1)
11054
+ return;
11055
+ visitingCandidates.add(candidate);
11056
+ visitChecks(ast.checks);
11057
+ switch (ast._tag) {
11058
+ case "Declaration":
11059
+ case "Arrays":
11060
+ case "Objects":
11061
+ case "Union":
11062
+ ast.recur((child) => {
11063
+ visit(child);
11064
+ return child;
11065
+ });
11066
+ break;
11067
+ case "TemplateLiteral":
11068
+ ast.parts.forEach(visit);
11069
+ break;
11070
+ case "Suspend":
11071
+ visit(ast.thunk());
11072
+ break;
11073
+ }
11074
+ visitingCandidates.delete(candidate);
11075
+ }
11076
+ function visitChecks(checks) {
11077
+ checks?.forEach((check) => {
11078
+ check.annotations?.representation?.schemas?.forEach((schema) => visit(toType2(schema)));
11079
+ if (check._tag === "FilterGroup")
11080
+ visitChecks(check.checks);
11081
+ });
11082
+ }
11083
+ function recur(input) {
11084
+ const candidate = getCandidate(input);
11085
+ const ast = candidate.ast;
11086
+ const reference = candidate.reference;
11087
+ if (reference !== undefined) {
11088
+ const annotated = candidate.identifier === undefined ? ast : annotateReference(ast, candidate, reference);
11089
+ return makeReference(reference, annotated);
11090
+ }
11091
+ return on(ast);
11092
+ }
11093
+ function on(ast) {
11094
+ const checks = fromChecks(ast.checks);
11095
+ switch (ast._tag) {
11096
+ case "Declaration":
11097
+ return {
11098
+ _tag: "Declaration",
11099
+ typeParameters: ast.typeParameters.map((ast) => recur(ast)),
11100
+ checks,
11101
+ ...fromDeclarationAnnotations(ast.annotations)
11102
+ };
11103
+ case "Null":
11104
+ case "Undefined":
11105
+ case "Void":
11106
+ case "Never":
11107
+ case "Unknown":
11108
+ case "Any":
11109
+ case "String":
11110
+ case "Boolean":
11111
+ case "Number":
11112
+ case "BigInt":
11113
+ case "Symbol":
11114
+ case "ObjectKeyword":
11115
+ return {
11116
+ _tag: ast._tag,
11117
+ checks,
11118
+ ...annotationsField(ast.annotations)
11119
+ };
11120
+ case "Literal":
11121
+ return {
11122
+ _tag: "Literal",
11123
+ literal: ast.literal,
11124
+ checks,
11125
+ ...annotationsField(ast.annotations)
11126
+ };
11127
+ case "UniqueSymbol":
11128
+ return {
11129
+ _tag: "UniqueSymbol",
11130
+ symbol: ast.symbol,
11131
+ checks,
11132
+ ...annotationsField(ast.annotations)
11133
+ };
11134
+ case "Enum":
11135
+ return {
11136
+ _tag: "Enum",
11137
+ enums: ast.enums,
11138
+ checks,
11139
+ ...annotationsField(ast.annotations)
11140
+ };
11141
+ case "TemplateLiteral":
11142
+ return {
11143
+ _tag: "TemplateLiteral",
11144
+ parts: ast.parts.map((ast) => recur(ast)),
11145
+ checks,
11146
+ ...annotationsField(ast.annotations)
11147
+ };
11148
+ case "Arrays":
11149
+ return {
11150
+ _tag: "Arrays",
11151
+ elements: ast.elements.map((element) => {
11152
+ const projected = getLastEncoding(element);
11153
+ const annotations = projected.context?.annotations;
11154
+ return {
11155
+ isOptional: isOptional(projected),
11156
+ type: recur(element),
11157
+ ...annotationsField(annotations)
11158
+ };
11159
+ }),
11160
+ rest: ast.rest.map((ast) => recur(ast)),
11161
+ checks,
11162
+ ...annotationsField(ast.annotations)
11163
+ };
11164
+ case "Objects":
11165
+ return {
11166
+ _tag: "Objects",
11167
+ propertySignatures: ast.propertySignatures.map((property) => {
11168
+ const projected = getLastEncoding(property.type);
11169
+ const annotations = projected.context?.annotations;
11170
+ return {
11171
+ name: property.name,
11172
+ type: recur(property.type),
11173
+ isOptional: isOptional(projected),
11174
+ isMutable: isMutable(projected),
11175
+ ...annotationsField(annotations)
11176
+ };
11177
+ }),
11178
+ indexSignatures: ast.indexSignatures.map((index) => ({
11179
+ parameter: recur(index.parameter),
11180
+ type: recur(index.type)
11181
+ })),
11182
+ checks,
11183
+ ...annotationsField(ast.annotations)
11184
+ };
11185
+ case "Union":
11186
+ return {
11187
+ _tag: "Union",
11188
+ types: ast.types.map((ast) => recur(ast)),
11189
+ ...ast.options === undefined ? {} : {
11190
+ options: ast.options
11191
+ },
11192
+ checks,
11193
+ ...annotationsField(ast.annotations)
11194
+ };
11195
+ case "Suspend":
11196
+ return {
11197
+ _tag: "Suspend",
11198
+ checks: [],
11199
+ thunk: recur(ast.thunk()),
11200
+ ...annotationsField(ast.annotations)
11201
+ };
11202
+ }
11203
+ }
11204
+ function fromChecks(checks) {
11205
+ return checks?.map(fromCheck) ?? [];
11206
+ }
11207
+ function fromCheck(check) {
11208
+ switch (check._tag) {
11209
+ case "Filter":
11210
+ return {
11211
+ _tag: "Filter",
11212
+ aborted: check.aborted,
11213
+ ...fromCheckAnnotations(check.annotations)
11214
+ };
11215
+ case "FilterGroup":
11216
+ return {
11217
+ _tag: "FilterGroup",
11218
+ checks: map3(check.checks, fromCheck),
11219
+ ...fromCheckAnnotations(check.annotations)
11220
+ };
11221
+ }
11222
+ }
11223
+ function fromDeclarationAnnotations(annotations) {
11224
+ if (annotations === undefined)
11225
+ return;
11226
+ const {
11227
+ representation,
11228
+ ...ordinary
11229
+ } = annotations;
11230
+ return {
11231
+ ...representation === undefined ? undefined : {
11232
+ representation
11233
+ },
11234
+ ...Object.keys(ordinary).length === 0 ? undefined : {
11235
+ annotations: ordinary
11236
+ }
11237
+ };
11238
+ }
11239
+ function fromCheckAnnotations(annotations) {
11240
+ if (annotations === undefined)
11241
+ return;
11242
+ const {
11243
+ representation,
11244
+ ...ordinary
11245
+ } = annotations;
11246
+ const projected = representation === undefined ? undefined : representation.schemas === undefined ? representation : {
11247
+ ...representation,
11248
+ schemas: representation.schemas.map((schema) => recur(toType2(schema)))
11249
+ };
11250
+ return {
11251
+ ...projected === undefined ? undefined : {
11252
+ representation: projected
11253
+ },
11254
+ ...Object.keys(ordinary).length === 0 ? undefined : {
11255
+ annotations: ordinary
11256
+ }
11257
+ };
11258
+ }
11259
+ }
11260
+
10134
11261
  // node_modules/effect/dist/Struct.js
10135
11262
  var omit = /* @__PURE__ */ dual(2, (self, keys) => {
10136
11263
  return buildStruct(self, (k, v) => !hasPropertyKey(keys, k) ? [k, v] : undefined);
@@ -10259,6 +11386,7 @@ function encodeUnknownEffect(schema, options) {
10259
11386
  };
10260
11387
  }
10261
11388
  var encodeEffect = encodeUnknownEffect;
11389
+ var encodeUnknownOption = encodeUnknownOption2;
10262
11390
  function encodeUnknownSync(schema, options) {
10263
11391
  const parser = encodeUnknownEffect(schema, options);
10264
11392
  return (input, options) => {
@@ -10814,7 +11942,7 @@ function Defect(options) {
10814
11942
  defectSchemaCache[key] = schema;
10815
11943
  return schema;
10816
11944
  }
10817
- var RegExp2 = /* @__PURE__ */ instanceOf(globalThis.RegExp, {
11945
+ var RegExp3 = /* @__PURE__ */ instanceOf(globalThis.RegExp, {
10818
11946
  representation: {
10819
11947
  id: "effect/schema/RegExp",
10820
11948
  payload: null
@@ -11295,6 +12423,10 @@ var TaggedError2 = (identifier) => {
11295
12423
  return Error2(identifier ?? tagValue)(struct, annotations);
11296
12424
  };
11297
12425
  };
12426
+ function toJsonSchemaDocument(schema, options) {
12427
+ const document = toRepresentation(toCodecJsonAST(schema.ast), options);
12428
+ return toJsonSchemaDocument2(document, options);
12429
+ }
11298
12430
  var toCodecJson = toCodecJson2;
11299
12431
  var toCodecStringTree = toCodecStringTree2;
11300
12432
  var Json = /* @__PURE__ */ make11(/* @__PURE__ */ annotate(Json2, {
@@ -14744,4 +15876,4 @@ var layer13 = layer12;
14744
15876
 
14745
15877
  // node_modules/@effect/platform-node/dist/NodeServices.js
14746
15878
  var layer2 = /* @__PURE__ */ provideMerge(layer4, /* @__PURE__ */ mergeAll(layer8, layer6, layer10, layer, layer13));
14747
- export { hash, equals, redact, format, NodeInspectSymbol, toJson, getStackTraceLimit, setStackTraceLimit, assignProperty, PipeInspectableProto, withFiber, Prototype, isGreaterThanOrEqualTo, none, some, isNone, isSome, match, getOrElse, fromUndefinedOr, getOrUndefined, map, flatMap, exists, Service2, makeUnsafe2, empty, make4, add, getOrUndefined2, getOrUndefinedUnsafe, getUnsafe, get, merge, Reference, fromInputUnsafe, isFinite2, isZero, zero, millis, toMillis, normalize, succeed, fail, isResult, isFailure, isSuccess, map2, filter, match2, isReadonlyArrayNonEmpty, isCanonicalArrayIndex, take, findFirstIndex, findFirst, findLast, empty2, map3, reduce, Scheduler, Class, taggedEnum, TaggedError, ParentSpan, externalSpan, getCurrentFiber, succeed2, sync, suspend, succeedNone, void_, callback, asSome, flatMap2, onExitPrimitive, uninterruptibleMask, ClockRef, currentTimeMillis, ConsoleRef, LogLevelOrder, reportCauseUnsafe, isExit, succeed3, failCause, fail2, die, interrupt, void_2, isSuccess2, isFailure2, hasInterrupts, asVoid, isDeferred, makeUnsafe3, make5, _await, done, fail3, interruptWith, succeed4, doneUnsafe, CurrentLogLevel, MinimumLogLevel, Scope, make6, makeUnsafe4, provide, addFinalizerExit, addFinalizer, fork, forkUnsafe, close, closeUnsafe, use, succeed5, effect, effectContext, effectDiscard, mergeAll, provide2, provideMerge, launch, map4, squash, hasDies, hasInterrupts2, interruptors, IllegalArgumentError, ExceededCapacityError, StackTrace, catchDone, modifyDelay, spaced, setInputType, isEffect, all, forEach, whileLoop, promise, tryPromise, succeed6, succeedNone2, suspend2, sync2, void_3, callback2, never, gen, fail4, die2, try_, withFiber2, fromResult, flatMap3, andThen, tap, result, option2, exit, map5, as, asVoid2, catch_, catchTag, catchTags, catchCause, catchDefect, catchIf, catchFilter, catchCauseIf, mapError, orDie, tapError, tapCause, retry, sandbox, ignore, ignoreCause, orElseSucceed, timeout, timeoutOption, timeoutOrElse, sleep, race, raceFirst, when, match3, matchCauseEffect, matchEffect, context, contextWith, provide3, provideContext, serviceOption, provideService, scope, scoped, acquireRelease, acquireUseRelease, ensuring, onError, onExit, interrupt2, interruptible, onInterrupt, uninterruptible, uninterruptibleMask2, forever, repeat, makeSpanScoped, useSpan, withSpan, withParentSpan, forkChild, forkIn, forkScoped, forkDetach, runFork, runForkWith, runPromise, runSync, fnUntraced, fn, logFatal, logError, logDebug, annotateLogs, mapEager, flatMapEager, catchEager, empty3, make7, value, empty4, fromInput, fromRecordUnsafe, set, setAll, merge2, remove, join, interrupt3, getCurrent, runIn, make8, set2, makeUnsafe5, Empty, make9, append, prepend, takeAll, take2, remove2, make10, bounded, dropping, offer, offerUnsafe, offerAll, failCause2, end, shutdownUnsafe, takeAll2, take3, isStream, fromQueue, unwrap, provideContext2, run2, runForEach, runForEachArray, FileSystem, encode, decode, Pointer, defaultFormatter, passthrough, transformEffect, transformOptional, withDefault2, Transformation, unknown, applyToSelfOrLastLinkEncoding, decodeTo, toEncoded, _is, decodeUnknownEffect, omit, declare, SchemaError, is, decodeUnknownEffect2, decodeUnknownOption, decodeUnknownResult, decodeUnknownSync, decodeSync, encodeUnknownEffect, encodeEffect, encodeSync, make11, isSchema, optionalKey, optional, toType, toEncoded2, Literal, TemplateLiteral, Never, Any, Unknown, Null, String3, Number2, Boolean3, Void, Struct, fieldsAssign, Record, StructWithRest, Tuple, ArraySchema, NonEmptyArray, Union, Literals, NullOr, UndefinedOr, decodeTo2, TrueLiterals, FalseLiterals, BooleanLiterals, decode2, withConstructorDefault, tag, TaggedStruct, TaggedUnion, Opaque, makeFilter, isPattern, Finite, isGreaterThan, isGreaterThanOrEqualTo2, isBetween, isInt, Int2, isMaxLength, NonEmptyString, Defect, Uint8ArrayFromBase64, Exit, Class2, Error2, TaggedError2, toCodecJson, toCodecStringTree, Json, JsonObject, empty5, jsonUnsafe, get2, post, setHeader, bodyJson, HttpClient, layerNodeHttp, exports_NodeHttpClient, errorExitCode, errorReported, runMain, exports_NodeRuntime, Path, Stdio, layer, exports_NodeStdio, QuitError, isQuitError, Terminal, layer2, exports_NodeServices };
15879
+ export { hash, equals, redact, format, NodeInspectSymbol, toJson, getStackTraceLimit, setStackTraceLimit, assignProperty, PipeInspectableProto, withFiber, Prototype, isGreaterThanOrEqualTo, none, some, isNone, isSome, match, getOrElse, fromUndefinedOr, getOrUndefined, map, flatMap, exists, Service2, makeUnsafe2, empty, make4, add, getOrUndefined2, getOrUndefinedUnsafe, getUnsafe, get, merge, Reference, fromInputUnsafe, isFinite2, isZero, zero, millis, toMillis, normalize, succeed, fail, isResult, isFailure, isSuccess, map2, filter, match2, isReadonlyArrayNonEmpty, isCanonicalArrayIndex, take, findFirstIndex, findFirst, findLast, empty2, map3, reduce, Scheduler, Class, taggedEnum, TaggedError, ParentSpan, externalSpan, getCurrentFiber, succeed2, sync, suspend, succeedNone, void_, callback, asSome, flatMap2, onExitPrimitive, uninterruptibleMask, ClockRef, currentTimeMillis, ConsoleRef, LogLevelOrder, reportCauseUnsafe, isExit, succeed3, failCause, fail2, die, interrupt, void_2, isSuccess2, isFailure2, hasInterrupts, asVoid, isDeferred, makeUnsafe3, make5, _await, done, fail3, interruptWith, succeed4, doneUnsafe, CurrentLogLevel, MinimumLogLevel, Scope, make6, makeUnsafe4, provide, addFinalizerExit, addFinalizer, fork, forkUnsafe, close, closeUnsafe, use, succeed5, effect, effectContext, effectDiscard, mergeAll, provide2, provideMerge, launch, map4, squash, hasDies, hasInterrupts2, interruptors, IllegalArgumentError, ExceededCapacityError, StackTrace, catchDone, modifyDelay, spaced, setInputType, isEffect, all, forEach, whileLoop, promise, tryPromise, succeed6, succeedNone2, suspend2, sync2, void_3, callback2, never, gen, fail4, die2, try_, withFiber2, fromResult, flatMap3, andThen, tap, result, option2, exit, map5, as, asVoid2, catch_, catchTag, catchTags, catchCause, catchDefect, catchIf, catchFilter, catchCauseIf, mapError, orDie, tapError, tapCause, retry, sandbox, ignore, ignoreCause, orElseSucceed, timeout, timeoutOption, timeoutOrElse, sleep, race, raceFirst, when, match3, matchCauseEffect, matchEffect, context, contextWith, provide3, provideContext, serviceOption, provideService, scope, scoped, acquireRelease, acquireUseRelease, ensuring, onError, onExit, interrupt2, interruptible, onInterrupt, uninterruptible, uninterruptibleMask2, forever, repeat, makeSpanScoped, useSpan, withSpan, withParentSpan, forkChild, forkIn, forkScoped, forkDetach, runFork, runForkWith, runPromise, runSync, fnUntraced, fn, logFatal, logError, logDebug, annotateLogs, mapEager, flatMapEager, catchEager, empty3, make7, value, empty4, fromInput, fromRecordUnsafe, set, setAll, merge2, remove, join, interrupt3, getCurrent, runIn, make8, set2, makeUnsafe5, Empty, make9, append, prepend, takeAll, take2, remove2, make10, bounded, dropping, offer, offerUnsafe, offerAll, failCause2, end, shutdownUnsafe, takeAll2, take3, isStream, fromQueue, unwrap, provideContext2, run2, runForEach, runForEachArray, FileSystem, encode, decode, Pointer, defaultFormatter, passthrough, transformEffect, transformOptional, withDefault2, Transformation, unknown, applyToSelfOrLastLinkEncoding, decodeTo, toEncoded, _is, decodeUnknownEffect, omit, declare, SchemaError, is, decodeUnknownEffect2, decodeUnknownOption, decodeUnknownResult, decodeUnknownSync, decodeSync, encodeUnknownEffect, encodeEffect, encodeUnknownOption, encodeSync, make11, isSchema, optionalKey, optional, toType, toEncoded2, Literal, TemplateLiteral, Never, Any, Unknown, Null, String3, Number2, Boolean3, Void, Struct, fieldsAssign, Record, StructWithRest, Tuple, ArraySchema, NonEmptyArray, Union, Literals, NullOr, UndefinedOr, decodeTo2, TrueLiterals, FalseLiterals, BooleanLiterals, decode2, withConstructorDefault, tag, TaggedStruct, TaggedUnion, Opaque, makeFilter, isPattern, Finite, isGreaterThan, isGreaterThanOrEqualTo2, isBetween, isInt, Int2, isMaxLength, NonEmptyString, Defect, Uint8ArrayFromBase64, Exit, Class2, Error2, TaggedError2, toJsonSchemaDocument, toCodecJson, toCodecStringTree, Json, JsonObject, empty5, jsonUnsafe, get2, post, setHeader, bodyJson, HttpClient, layerNodeHttp, exports_NodeHttpClient, errorExitCode, errorReported, runMain, exports_NodeRuntime, Path, Stdio, layer, exports_NodeStdio, QuitError, isQuitError, Terminal, layer2, exports_NodeServices };