@schmock/faker 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +45 -0
  3. package/dist/constants.d.ts +82 -1
  4. package/dist/constants.d.ts.map +1 -1
  5. package/dist/field-name-matcher.d.ts +19 -0
  6. package/dist/field-name-matcher.d.ts.map +1 -1
  7. package/dist/index.d.ts +3 -0
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +4 -1
  10. package/dist/jsf-config.d.ts +19 -4
  11. package/dist/jsf-config.d.ts.map +1 -1
  12. package/dist/output-limits.d.ts +3 -0
  13. package/dist/output-limits.d.ts.map +1 -0
  14. package/dist/overrides.d.ts +2 -1
  15. package/dist/overrides.d.ts.map +1 -1
  16. package/dist/schema-children.d.ts +14 -0
  17. package/dist/schema-children.d.ts.map +1 -0
  18. package/dist/schema-enhancement.d.ts +1 -0
  19. package/dist/schema-enhancement.d.ts.map +1 -1
  20. package/dist/validation.d.ts +24 -5
  21. package/dist/validation.d.ts.map +1 -1
  22. package/package.json +17 -7
  23. package/dist/constants.js +0 -8
  24. package/dist/field-mappings.js +0 -1114
  25. package/dist/field-name-matcher.js +0 -148
  26. package/dist/jsf-config.js +0 -117
  27. package/dist/overrides.js +0 -137
  28. package/dist/schema-enhancement.js +0 -104
  29. package/dist/test-utils.d.ts +0 -57
  30. package/dist/test-utils.d.ts.map +0 -1
  31. package/dist/test-utils.js +0 -284
  32. package/dist/validation.js +0 -300
  33. package/src/advanced-features.test.ts +0 -912
  34. package/src/audit-faker-args.test.ts +0 -97
  35. package/src/constants.d.ts.map +0 -1
  36. package/src/constants.ts +0 -9
  37. package/src/data-quality.test.ts +0 -415
  38. package/src/error-handling.test.ts +0 -504
  39. package/src/field-mappings.test.ts +0 -351
  40. package/src/field-mappings.ts +0 -1148
  41. package/src/field-name-matcher.test.ts +0 -292
  42. package/src/field-name-matcher.ts +0 -187
  43. package/src/index.d.ts.map +0 -1
  44. package/src/index.test.ts +0 -1320
  45. package/src/index.ts +0 -185
  46. package/src/integration.test.ts +0 -634
  47. package/src/jsf-config.d.ts.map +0 -1
  48. package/src/jsf-config.test.ts +0 -65
  49. package/src/jsf-config.ts +0 -156
  50. package/src/overrides.d.ts.map +0 -1
  51. package/src/overrides.property.test.ts +0 -172
  52. package/src/overrides.test.ts +0 -38
  53. package/src/overrides.ts +0 -179
  54. package/src/performance.test.ts +0 -441
  55. package/src/plugin-integration.test.ts +0 -575
  56. package/src/post-process.test.ts +0 -177
  57. package/src/real-world.test.ts +0 -636
  58. package/src/schema-enhancement.d.ts.map +0 -1
  59. package/src/schema-enhancement.test.ts +0 -222
  60. package/src/schema-enhancement.ts +0 -144
  61. package/src/steps/deterministic-seeds.steps.ts +0 -112
  62. package/src/steps/faker-plugin.steps.ts +0 -301
  63. package/src/test-utils.ts +0 -385
  64. package/src/validation.d.ts.map +0 -1
  65. package/src/validation.ts +0 -417
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Khalic Lab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # @schmock/faker
2
+
3
+ Faker-powered automatic data generation for Schmock. Turns JSON Schema into realistic, field-name-aware mock data.
4
+
5
+ Part of [Schmock](https://github.com/khalic-lab/schmock) — mock APIs from OpenAPI specs or hand-crafted routes.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ bun add -d @schmock/faker
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```typescript
16
+ import { schmock } from "@schmock/core";
17
+ import { fakerPlugin } from "@schmock/faker";
18
+
19
+ const mock = schmock();
20
+
21
+ // Plugins are instance-wide: this fills any route that produced no response.
22
+ mock.pipe(
23
+ fakerPlugin({
24
+ seed: 42,
25
+ count: 3,
26
+ schema: {
27
+ type: "array",
28
+ items: {
29
+ type: "object",
30
+ properties: { id: { type: "integer" }, email: { type: "string" } },
31
+ },
32
+ },
33
+ }),
34
+ );
35
+ mock("GET /users", undefined);
36
+ ```
37
+
38
+ ## Documentation
39
+
40
+ - [Getting started](https://github.com/khalic-lab/schmock/blob/main/docs/getting-started.md)
41
+ - [API reference](https://github.com/khalic-lab/schmock/blob/main/docs/api.md)
42
+
43
+ ## License
44
+
45
+ MIT © Khalic Lab
@@ -1,7 +1,88 @@
1
1
  export declare const MAX_ARRAY_SIZE = 10000;
2
- export declare const MAX_NESTING_DEPTH = 10;
3
2
  export declare const DEFAULT_ARRAY_COUNT = 3;
4
3
  export declare const DEEP_NESTING_THRESHOLD = 3;
5
4
  export declare const LARGE_ARRAY_THRESHOLD = 100;
5
+ /**
6
+ * How deep a schema may nest before generation is refused.
7
+ *
8
+ * Calibrated against the OpenAPI fixtures in `packages/openapi/src/__fixtures__`,
9
+ * measured as the height `validateSchema` computes over each dereferenced and
10
+ * normalized response schema:
11
+ *
12
+ * petstore-openapi3 2 · openapi31 2 · train-travel 3 · scalar-galaxy 6 ·
13
+ * stripe-spec3 up to 47
14
+ *
15
+ * Stripe's heights are not a continuum: 1176 response schemas land on 0-13 or
16
+ * on 28-47, with NOTHING in between. The 28+ cluster is Stripe's mutually
17
+ * referencing object graph (`account` → `external_accounts` → … → `account`),
18
+ * dereferenced into a very tall DAG. Generating from it with the ceiling
19
+ * bypassed measures 97 MB (`GET /v1/setup_attempts`), 127 MB
20
+ * (`/v1/invoices/:id/lines`) and 188 MB (`/v1/checkout/sessions/:id/line_items`)
21
+ * for ONE response, so it stays out. Every ceiling from 14 to 27 admits exactly
22
+ * the same set, and 15 sits in that band with 2.5x headroom over the deepest
23
+ * non-Stripe fixture.
24
+ *
25
+ * A breach is reported as `schema_nesting_depth` with the longest value path
26
+ * measured by the iterative graph walk.
27
+ */
28
+ export declare const MAX_NESTING_DEPTH = 15;
29
+ /**
30
+ * Depth ceiling handed to json-schema-faker.
31
+ *
32
+ * Its default is 5, and past it JSF silently emits `{}` or `null` instead of
33
+ * the declared value — so a schema nested deeper than 5 generated a body that
34
+ * violated its own `required` contract while this package advertised
35
+ * `MAX_NESTING_DEPTH` levels.
36
+ *
37
+ * Derived from `MAX_NESTING_DEPTH` so the two cannot drift: JSF must never
38
+ * truncate a schema validation admitted, and must never generate far past the
39
+ * depth validation reasoned about — the depth of a generated body is bounded
40
+ * here and nowhere else.
41
+ *
42
+ * JSF's counter is NOT this package's nesting depth: it also counts levels
43
+ * `validateSchema` treats as free, and a level reached through a `$ref` costs
44
+ * two units (one for the reference hop, one for the property). Measured
45
+ * minimum `maxDepth` for the shapes this package promises to generate: a
46
+ * 10-object chain needs 9, a 5-object/4-array alternation needs 8, a chain as
47
+ * deep as the ceiling needs 14, and that same chain expressed as `$defs`
48
+ * linked by `$ref` needs 18. The margin covers all of them; it is headroom,
49
+ * not an exact bound.
50
+ */
51
+ export declare const JSF_MAX_DEPTH: number;
52
+ /**
53
+ * Cumulative generation budgets.
54
+ *
55
+ * `MAX_SCHEMA_NODES` bounds the number of distinct schema nodes validation,
56
+ * enhancement and generation can inspect. Shared DAG nodes count once here;
57
+ * their multiplicity is charged to `MAX_GENERATED_NODES` instead.
58
+ *
59
+ * `MAX_GENERATED_NODES` bounds the RESULT. json-schema-faker runs with
60
+ * `alwaysFakeOptionals`, so every optional property is materialized and the
61
+ * size of a response is the product of array sizes and object widths down each
62
+ * branch — width, not merely the number of schema nodes.
63
+ *
64
+ * Both are plain constants rather than plugin options, mirroring
65
+ * `packages/openapi/src/limits.ts`: a mock has no legitimate reason to emit a
66
+ * million-node body, and a configurable ceiling is a footgun. The documented
67
+ * per-request opt-out remains `onSchema` returning a trimmed schema.
68
+ */
69
+ export declare const MAX_SCHEMA_NODES = 50000;
70
+ export declare const MAX_GENERATED_NODES = 1000000;
71
+ /** Maximum number of own properties Schmock will materialize on one object. */
72
+ export declare const MAX_OBJECT_PROPERTIES = 10000;
73
+ /**
74
+ * Maximum number of UTF-16 code units Schmock will generate for one string.
75
+ * 64 KiB admits the repository's largest real API constraints while refusing
76
+ * lengths large enough for one field to become an accidental bulk payload.
77
+ */
78
+ export declare const MAX_STRING_LENGTH = 65536;
79
+ /**
80
+ * Reference date used when generation must be reproducible.
81
+ * Faker's `date.*` methods default their reference date to `Date.now()`, so a
82
+ * seed alone does not reproduce dates — pinning the reference date does.
83
+ * This instant is part of the reproducible-output contract: changing it changes
84
+ * every date a seeded generation produces.
85
+ */
86
+ export declare const DETERMINISTIC_REF_DATE = "2024-01-01T00:00:00.000Z";
6
87
  export declare const NULLABLE_NULL_PROBABILITY = 0.05;
7
88
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAGzC,eAAO,MAAM,yBAAyB,OAAO,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,aAAa,QAAwB,CAAC;AAEnD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB,QAAS,CAAC;AACvC,eAAO,MAAM,mBAAmB,UAAY,CAAC;AAE7C,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAS,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,6BAA6B,CAAC;AAGjE,eAAO,MAAM,yBAAyB,OAAO,CAAC"}
@@ -1,5 +1,24 @@
1
1
  import type { JSONSchema7 } from "json-schema";
2
2
  import type { FieldMapping } from "./field-mappings.js";
3
+ /**
4
+ * Formats json-schema-faker can actually generate a value for.
5
+ *
6
+ * Deferring to a declared `format` only helps when something downstream honors
7
+ * it. A spec is free to declare a vocabulary format nothing implements
8
+ * (`format: iso-country-code` in the wild), and for those json-schema-faker
9
+ * falls back to an arbitrary string — strictly worse than the name-based
10
+ * mapping this module would otherwise supply. So the skip below applies to
11
+ * known formats only.
12
+ *
13
+ * The source of truth is json-schema-faker's own built-in format registry, and
14
+ * `generateWithJsf` starts from that registry alone (`formats: {}`), so nothing
15
+ * can add to it at runtime. `uri-template` and `regex` are standard Draft 7
16
+ * formats but are NOT in it — they generated the plain random string this set
17
+ * exists to avoid — so they are deliberately absent. `field-name-matcher.test.ts`
18
+ * pins every member against real generation, which is what keeps this list from
19
+ * drifting on a json-schema-faker upgrade.
20
+ */
21
+ export declare const GENERATABLE_FORMATS: Set<string>;
3
22
  /**
4
23
  * Split a field name (camelCase, snake_case, kebab-case) into lowercase tokens.
5
24
  * "userFirstName" → ["user", "first", "name"]
@@ -1 +1 @@
1
- {"version":3,"file":"field-name-matcher.d.ts","sourceRoot":"","sources":["../src/field-name-matcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAsC5E;AAED,UAAU,WAAW;IACnB,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,EACnB,QAAQ,GAAE,YAAY,EAAuB,GAC5C,WAAW,GAAG,SAAS,CA4FzB"}
1
+ {"version":3,"file":"field-name-matcher.d.ts","sourceRoot":"","sources":["../src/field-name-matcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mBAAmB,aAkB9B,CAAC;AAOH;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBxD;AA0ED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAM5E;AAED,UAAU,WAAW;IACnB,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,EACnB,QAAQ,GAAE,YAAY,EAAuB,GAC5C,WAAW,GAAG,SAAS,CAsHzB"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
+ import type * as Schmock from "@schmock/core";
2
+ import { MAX_OBJECT_PROPERTIES, MAX_STRING_LENGTH } from "./constants.js";
1
3
  export type SchemaGenerationContext = Schmock.SchemaGenerationContext;
2
4
  export type FakerPluginOptions = Schmock.FakerPluginOptions;
5
+ export { MAX_OBJECT_PROPERTIES, MAX_STRING_LENGTH };
3
6
  export declare function fakerPlugin(options: FakerPluginOptions): Schmock.Plugin;
4
7
  export declare function generateFromSchema(options: SchemaGenerationContext): Promise<unknown>;
5
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAC;AAEtE,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;AAM5D,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CA+CvE;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,OAAO,CAAC,CAwClB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAC;AAQ9C,OAAO,EAEL,qBAAqB,EACrB,iBAAiB,EAElB,MAAM,gBAAgB,CAAC;AAaxB,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAC;AAEtE,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,CAAC;AAMpD,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAoEvE;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,OAAO,CAAC,CA+ClB"}
package/dist/index.js CHANGED
@@ -1 +1,4 @@
1
- import{ResourceLimitError as m,SchemaGenerationError as A0,SchemaValidationError as R0}from"@schmock/core";var E="2.3.0";var F=1e4,O=10,C=3,P=3,M=100,f=0.05;import{base as c,en as s,Faker as a}from"@faker-js/faker";import{generate as e}from"json-schema-faker";var Q0=2147483647;function R(Q){let $=new a({locale:[s,c]});if(Q!==void 0)$.seed(Q);return $}function k(Q){return Q??Math.floor(Math.random()*Q0)}function u(Q){let $=Q;return()=>{$+=1831565813;let Z=$;return Z=Math.imul(Z^Z>>>15,Z|1),Z^=Z+Math.imul(Z^Z>>>7,Z|61),((Z^Z>>>14)>>>0)/4294967296}}function b(Q){return typeof Q==="boolean"?Q:S(Q)}function _(Q){return Object.fromEntries(Object.entries(Q).map(([$,Z])=>[$,b(Z)]))}function S(Q){let $={};for(let[Z,B]of Object.entries(Q))$[Z]=B;if(Q.properties)$.properties=_(Q.properties);if(Q.definitions)$.definitions=_(Q.definitions);if(Q.$defs)$.$defs=_(Q.$defs);if(Q.patternProperties)$.patternProperties=_(Q.patternProperties);if(Array.isArray(Q.items))$.prefixItems=Q.items.map(b),$.items=Q.additionalItems===void 0?!0:b(Q.additionalItems),delete $.additionalItems;else if(Q.items!==void 0)$.items=b(Q.items);for(let Z of["allOf","anyOf","oneOf"]){let B=Q[Z];if(B)$[Z]=B.map(b)}if(Q.additionalProperties!==void 0)$.additionalProperties=b(Q.additionalProperties);for(let Z of["contains","not","if","then","else","propertyNames"]){let B=Q[Z];if(B!==void 0)$[Z]=b(B)}if(Q.dependencies)$.dependencies=Object.fromEntries(Object.entries(Q.dependencies).map(([Z,B])=>[Z,Array.isArray(B)?[...B]:b(B)]));return $}async function l(Q,$){let Z={seed:$,optionalsProbability:1,alwaysFakeOptionals:!0,useDefaultValue:!0,failOnInvalidTypes:!1,extensions:{faker:R($)}};return e(S(Q),Z)}var v=new Set(["__proto__","constructor","prototype"]);function z(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function d(Q,$,Z=Math.random){if($!==void 0){if($<0)return 0;return $}if(Q.minItems!==void 0&&Q.maxItems!==void 0){let B=Q.minItems,K=Math.max(B,Q.maxItems);return Math.floor(Z()*(K-B+1))+B}if(Q.minItems!==void 0)return Math.max(Q.minItems,C);if(Q.maxItems!==void 0)return Math.min(Q.maxItems,C);if(Array.isArray(Q.items))return Q.items.length;return C}function L(Q,$,Z,B,K){if(!$)return Q;if(!z(Q))return Q;let j=structuredClone(Q);for(let[W,X]of Object.entries($)){if(v.has(W))continue;if(W.includes("."))$0(j,W,X,{params:Z,state:B,query:K});else if(z(X))if(z(j[W]))j[W]=L(j[W],X,Z,B,K);else j[W]=L({},X,Z,B,K);else if(typeof X==="string"&&X.includes("{{"))j[W]=o(X,{params:Z,state:B,query:K});else j[W]=X}return j}function $0(Q,$,Z,B){let K=$.split("."),j=Q;for(let X=0;X<K.length-1;X++){let q=K[X];if(v.has(q))return;let V=j[q];if(z(V))j=V;else{let w={};j[q]=w,j=w}}let W=K[K.length-1];if(v.has(W))return;if(typeof Z==="string"&&Z.includes("{{"))j[W]=o(Z,B);else j[W]=Z}function p(Q,$){let Z=$.trim().split("."),B=Q;for(let K of Z)if(z(B))B=B[K];else return;return B}function o(Q,$){let Z=Q.match(/^\{\{\s*([^}]+)\s*\}\}$/);if(Z){let B=p($,Z[1]);return B!==void 0?B:Q}return Q.replace(/\{\{\s*([^}]+)\s*\}\}/g,(B,K)=>{let j=p($,K);return j!==void 0?String(j):B})}var B0=[{keywords:["email"],fakerMethod:"internet.email",schemaType:"string",minScore:0.6,format:"email"},{keywords:["username","user_name","login","handle"],fakerMethod:"internet.username",schemaType:"string",minScore:0.6},{keywords:["password","passwd","secret"],fakerMethod:"internet.password",schemaType:"string",minScore:0.6},{keywords:["token","api_key","apikey","access_token","refresh_token"],fakerMethod:"string.alphanumeric",schemaType:"string",minScore:0.8}],Z0=[{keywords:["first_name","firstname","given_name","forename"],fakerMethod:"person.firstName",schemaType:"string",minScore:0.6},{keywords:["last_name","lastname","surname","family_name"],fakerMethod:"person.lastName",schemaType:"string",minScore:0.6},{keywords:["full_name","fullname","display_name","displayname","full_name"],fakerMethod:"person.fullName",schemaType:"string",minScore:0.6},{keywords:["name"],fakerMethod:"person.fullName",schemaType:"string",minScore:0.6},{keywords:["middle_name","middlename"],fakerMethod:"person.middleName",schemaType:"string",minScore:0.8},{keywords:["prefix","honorific","salutation"],fakerMethod:"person.prefix",schemaType:"string",minScore:0.8},{keywords:["suffix"],fakerMethod:"person.suffix",schemaType:"string",minScore:0.9},{keywords:["gender","sex"],fakerMethod:"person.sex",schemaType:"string",minScore:0.8},{keywords:["bio","biography"],fakerMethod:"lorem.paragraph",schemaType:"string",minScore:0.8},{keywords:["job_title","jobtitle","position","occupation","job","role"],fakerMethod:"person.jobTitle",schemaType:"string",minScore:0.6},{keywords:["job_area","department","division","team"],fakerMethod:"person.jobArea",schemaType:"string",minScore:0.8},{keywords:["zodiac","zodiac_sign"],fakerMethod:"person.zodiacSign",schemaType:"string",minScore:0.9}],K0=[{keywords:["phone","mobile","cell","tel","telephone","cellphone","fax"],fakerMethod:"phone.number",schemaType:"string",minScore:0.6},{keywords:["imei"],fakerMethod:"phone.imei",schemaType:"string",minScore:0.9}],j0=[{keywords:["street","street_address"],fakerMethod:"location.streetAddress",schemaType:"string",minScore:0.6},{keywords:["address","mailing_address","postal_address"],fakerMethod:"location.streetAddress",schemaType:"string",minScore:0.6},{keywords:["city","town"],fakerMethod:"location.city",schemaType:"string",minScore:0.6},{keywords:["state","province","region"],fakerMethod:"location.state",schemaType:"string",minScore:0.8},{keywords:["country"],fakerMethod:"location.country",schemaType:"string",minScore:0.8},{keywords:["country_code","countrycode"],fakerMethod:"location.countryCode",schemaType:"string",minScore:0.8},{keywords:["county"],fakerMethod:"location.county",schemaType:"string",minScore:0.9},{keywords:["continent"],fakerMethod:"location.continent",schemaType:"string",minScore:0.9},{keywords:["zip","zipcode","zip_code","postal","postal_code"],fakerMethod:"location.zipCode",schemaType:"string",minScore:0.6},{keywords:["latitude","lat"],fakerMethod:"location.latitude",schemaType:"number",minScore:0.6},{keywords:["longitude","lng","lon","long"],fakerMethod:"location.longitude",schemaType:"number",minScore:0.6},{keywords:["timezone","time_zone","tz"],fakerMethod:"location.timeZone",schemaType:"string",minScore:0.8},{keywords:["building_number"],fakerMethod:"location.buildingNumber",schemaType:"string",minScore:0.9}],X0=[{keywords:["url","website","link","href","homepage","webpage"],fakerMethod:"internet.url",schemaType:"string",minScore:0.6},{keywords:["avatar","photo_url","profile_image","image_url","picture","thumbnail","icon"],fakerMethod:"image.avatar",schemaType:"string",minScore:0.6},{keywords:["domain","hostname","domain_name"],fakerMethod:"internet.domainName",schemaType:"string",minScore:0.8},{keywords:["ip","ip_address","ipaddress","ipv4"],fakerMethod:"internet.ipv4",schemaType:"string",minScore:0.8},{keywords:["ipv6"],fakerMethod:"internet.ipv6",schemaType:"string",minScore:0.9},{keywords:["mac","mac_address"],fakerMethod:"internet.mac",schemaType:"string",minScore:0.9},{keywords:["user_agent","useragent"],fakerMethod:"internet.userAgent",schemaType:"string",minScore:0.9},{keywords:["port"],fakerMethod:"internet.port",schemaType:"number",minScore:0.9},{keywords:["protocol"],fakerMethod:"internet.protocol",schemaType:"string",minScore:0.9}],W0=[{keywords:["uuid","guid"],fakerMethod:"string.uuid",schemaType:"string",minScore:0.6},{keywords:["sku"],fakerMethod:"string.alphanumeric",schemaType:"string",minScore:0.9},{keywords:["slug"],fakerMethod:"lorem.slug",schemaType:"string",minScore:0.8},{keywords:["isbn"],fakerMethod:"commerce.isbn",schemaType:"string",minScore:0.9},{keywords:["vin"],fakerMethod:"vehicle.vin",schemaType:"string",minScore:0.9},{keywords:["iban"],fakerMethod:"finance.iban",schemaType:"string",minScore:0.9},{keywords:["bic","swift"],fakerMethod:"finance.bic",schemaType:"string",minScore:0.9},{keywords:["ssn","social_security"],fakerMethod:"string.numeric",schemaType:"string",minScore:0.9}],q0=[{keywords:["description","desc","summary","overview","about","excerpt"],fakerMethod:"lorem.paragraph",schemaType:"string",minScore:0.6},{keywords:["content","body","text","message"],fakerMethod:"lorem.paragraphs",schemaType:"string",minScore:0.6},{keywords:["title","heading","subject","headline"],fakerMethod:"lorem.sentence",schemaType:"string",minScore:0.6},{keywords:["tag","label","category","keyword"],fakerMethod:"lorem.word",schemaType:"string",minScore:0.8},{keywords:["comment","note","remark","feedback","review"],fakerMethod:"lorem.sentence",schemaType:"string",minScore:0.8},{keywords:["sentence"],fakerMethod:"lorem.sentence",schemaType:"string",minScore:0.9},{keywords:["paragraph"],fakerMethod:"lorem.paragraph",schemaType:"string",minScore:0.9},{keywords:["word"],fakerMethod:"lorem.word",schemaType:"string",minScore:0.9}],U0=[{keywords:["company","organization","org","employer","brand","operator"],fakerMethod:"company.name",schemaType:"string",minScore:0.6},{keywords:["product","product_name","item_name"],fakerMethod:"commerce.productName",schemaType:"string",minScore:0.8},{keywords:["price","amount","cost","fee","salary","wage","total","subtotal","balance","revenue","income"],fakerMethod:"commerce.price",minScore:0.6},{keywords:["currency","currency_code"],fakerMethod:"finance.currencyCode",schemaType:"string",minScore:0.8},{keywords:["currency_name"],fakerMethod:"finance.currencyName",schemaType:"string",minScore:0.8},{keywords:["currency_symbol"],fakerMethod:"finance.currencySymbol",schemaType:"string",minScore:0.8},{keywords:["account_number","account_no"],fakerMethod:"finance.accountNumber",schemaType:"string",minScore:0.8},{keywords:["credit_card","card_number"],fakerMethod:"finance.creditCardNumber",schemaType:"string",minScore:0.8},{keywords:["cvv"],fakerMethod:"finance.creditCardCVV",schemaType:"string",minScore:0.9},{keywords:["transaction_type"],fakerMethod:"finance.transactionType",schemaType:"string",minScore:0.9}],V0=[{keywords:["created_at","createdat","creation_date","date_created","createddate"],fakerMethod:"date.recent",schemaType:"string",minScore:0.6,format:"date-time"},{keywords:["updated_at","updatedat","modified_at","modifiedat","date_updated","last_modified","date_modified"],fakerMethod:"date.recent",schemaType:"string",minScore:0.6,format:"date-time"},{keywords:["deleted_at","deletedat"],fakerMethod:"date.recent",schemaType:"string",minScore:0.6,format:"date-time"},{keywords:["published_at","publishedat","publish_date"],fakerMethod:"date.recent",schemaType:"string",minScore:0.6,format:"date-time"},{keywords:["expires_at","expiresat","expiration","expiry"],fakerMethod:"date.future",schemaType:"string",minScore:0.6,format:"date-time"},{keywords:["birthday","date_of_birth","dob","birthdate","born"],fakerMethod:"date.birthdate",schemaType:"string",minScore:0.8},{keywords:["start_date","begin_date"],fakerMethod:"date.past",schemaType:"string",minScore:0.8},{keywords:["end_date","due_date","deadline"],fakerMethod:"date.future",schemaType:"string",minScore:0.8},{keywords:["timestamp","ts"],fakerMethod:"date.recent",schemaType:"string",minScore:0.8}],Y0=[{keywords:["color","colour"],fakerMethod:"color.human",schemaType:"string",minScore:0.8},{keywords:["hex_color","hexcolor"],fakerMethod:"color.rgb",schemaType:"string",minScore:0.9}],b0=[{keywords:["age"],fakerMethod:"number.int",schemaType:"number",minScore:0.8,fakerArgs:{min:18,max:80}},{keywords:["rating","score","stars"],fakerMethod:"number.int",schemaType:"number",minScore:0.8,fakerArgs:{min:1,max:5}},{keywords:["count","quantity","qty"],fakerMethod:"number.int",schemaType:"number",minScore:0.8,fakerArgs:{min:1,max:100}},{keywords:["percentage","percent"],fakerMethod:"number.int",schemaType:"number",minScore:0.8,fakerArgs:{min:0,max:100}},{keywords:["weight"],fakerMethod:"number.float",schemaType:"number",minScore:0.8,fakerArgs:{min:0.1,max:200}},{keywords:["height"],fakerMethod:"number.int",schemaType:"number",minScore:0.8,fakerArgs:{min:100,max:220}},{keywords:["width","length","depth"],fakerMethod:"number.int",schemaType:"number",minScore:0.8,fakerArgs:{min:1,max:1000}},{keywords:["priority","order","rank","level"],fakerMethod:"number.int",schemaType:"number",minScore:0.8,fakerArgs:{min:1,max:10}},{keywords:["version"],fakerMethod:"system.semver",schemaType:"string",minScore:0.8}],w0=[{keywords:["is_active","isactive","active","enabled","is_enabled"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.9},{keywords:["is_deleted","isdeleted","deleted"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.05},{keywords:["is_archived","isarchived","archived"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.1},{keywords:["is_verified","isverified","verified","confirmed","is_confirmed"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.8},{keywords:["is_admin","isadmin","admin"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.1},{keywords:["is_public","ispublic","public","visible","is_visible"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.7},{keywords:["is_read","isread","read","seen","is_seen"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.6},{keywords:["is_default","isdefault"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.8,trueProbability:0.1},{keywords:["is_required","isrequired","required","mandatory"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.5},{keywords:["is_featured","isfeatured","featured","promoted"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.8,trueProbability:0.15},{keywords:["available","in_stock"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.8,trueProbability:0.85}],H0=[{keywords:["filename","file_name"],fakerMethod:"system.fileName",schemaType:"string",minScore:0.8},{keywords:["file_type","filetype","mime_type","mimetype","content_type"],fakerMethod:"system.mimeType",schemaType:"string",minScore:0.8},{keywords:["file_ext","extension"],fakerMethod:"system.fileExt",schemaType:"string",minScore:0.9},{keywords:["file_path","filepath","path"],fakerMethod:"system.filePath",schemaType:"string",minScore:0.9},{keywords:["cron","cron_expression"],fakerMethod:"system.cron",schemaType:"string",minScore:0.9},{keywords:["semver"],fakerMethod:"system.semver",schemaType:"string",minScore:0.9}],C0=[{keywords:["aircraft_type","airplane","aircraft"],fakerMethod:"airline.aircraftType",schemaType:"string",minScore:0.9},{keywords:["flight_number","flight"],fakerMethod:"airline.flightNumber",schemaType:"string",minScore:0.9},{keywords:["record_locator","booking_ref","pnr"],fakerMethod:"airline.recordLocator",schemaType:"string",minScore:0.9},{keywords:["seat","seat_number"],fakerMethod:"airline.seat",schemaType:"string",minScore:0.9}],G0=[{keywords:["animal","animal_type","species"],fakerMethod:"animal.type",schemaType:"string",minScore:0.9},{keywords:["pet_name"],fakerMethod:"animal.petName",schemaType:"string",minScore:0.9},{keywords:["breed"],fakerMethod:"animal.dog",schemaType:"string",minScore:0.9},{keywords:["bird"],fakerMethod:"animal.bird",schemaType:"string",minScore:0.9},{keywords:["fish"],fakerMethod:"animal.fish",schemaType:"string",minScore:0.9},{keywords:["horse"],fakerMethod:"animal.horse",schemaType:"string",minScore:0.9},{keywords:["insect"],fakerMethod:"animal.insect",schemaType:"string",minScore:0.9}],I0=[{keywords:["book_title"],fakerMethod:"book.title",schemaType:"string",minScore:0.9},{keywords:["author","book_author","writer"],fakerMethod:"book.author",schemaType:"string",minScore:0.9},{keywords:["genre","book_genre"],fakerMethod:"book.genre",schemaType:"string",minScore:0.9},{keywords:["publisher","publishing_house"],fakerMethod:"book.publisher",schemaType:"string",minScore:0.9},{keywords:["book_series","series_name"],fakerMethod:"book.series",schemaType:"string",minScore:0.9}],F0=[{keywords:["dish","meal","recipe_name"],fakerMethod:"food.dish",schemaType:"string",minScore:0.9},{keywords:["ingredient"],fakerMethod:"food.ingredient",schemaType:"string",minScore:0.9},{keywords:["spice"],fakerMethod:"food.spice",schemaType:"string",minScore:0.9},{keywords:["fruit"],fakerMethod:"food.fruit",schemaType:"string",minScore:0.9},{keywords:["vegetable"],fakerMethod:"food.vegetable",schemaType:"string",minScore:0.9},{keywords:["meat"],fakerMethod:"food.meat",schemaType:"string",minScore:0.9},{keywords:["food_description"],fakerMethod:"food.description",schemaType:"string",minScore:0.9},{keywords:["ethnic_category","cuisine"],fakerMethod:"food.ethnicCategory",schemaType:"string",minScore:0.9}],P0=[{keywords:["song","song_name","track","track_name"],fakerMethod:"music.songName",schemaType:"string",minScore:0.9},{keywords:["album","album_name"],fakerMethod:"music.album",schemaType:"string",minScore:0.9},{keywords:["artist","musician","band"],fakerMethod:"music.artist",schemaType:"string",minScore:0.9},{keywords:["music_genre"],fakerMethod:"music.genre",schemaType:"string",minScore:0.9}],J0=[],M0=[{keywords:["vehicle","vehicle_name"],fakerMethod:"vehicle.vehicle",schemaType:"string",minScore:0.9},{keywords:["vehicle_type"],fakerMethod:"vehicle.type",schemaType:"string",minScore:0.9},{keywords:["vehicle_manufacturer","car_make"],fakerMethod:"vehicle.manufacturer",schemaType:"string",minScore:0.9},{keywords:["vehicle_model","car_model"],fakerMethod:"vehicle.model",schemaType:"string",minScore:0.9},{keywords:["fuel","fuel_type"],fakerMethod:"vehicle.fuel",schemaType:"string",minScore:0.9},{keywords:["bicycle"],fakerMethod:"vehicle.bicycle",schemaType:"string",minScore:0.9},{keywords:["vehicle_color","car_color"],fakerMethod:"vehicle.color",schemaType:"string",minScore:0.9}],z0=[{keywords:["branch","branch_name","git_branch"],fakerMethod:"git.branch",schemaType:"string",minScore:0.9},{keywords:["commit_sha","commit_hash","sha"],fakerMethod:"git.commitSha",schemaType:"string",minScore:0.9},{keywords:["commit_message"],fakerMethod:"git.commitMessage",schemaType:"string",minScore:0.9}],L0=[{keywords:["db_column","column_name"],fakerMethod:"database.column",schemaType:"string",minScore:0.9},{keywords:["db_type","column_type"],fakerMethod:"database.type",schemaType:"string",minScore:0.9},{keywords:["db_engine","database_engine"],fakerMethod:"database.engine",schemaType:"string",minScore:0.9},{keywords:["collation"],fakerMethod:"database.collation",schemaType:"string",minScore:0.9},{keywords:["mongodb_id","object_id"],fakerMethod:"database.mongodbObjectId",schemaType:"string",minScore:0.9}],O0=[{keywords:["abbreviation","tech_abbreviation"],fakerMethod:"hacker.abbreviation",schemaType:"string",minScore:0.9},{keywords:["hacker_phrase","tech_phrase"],fakerMethod:"hacker.phrase",schemaType:"string",minScore:0.9}],_0=[{keywords:["adjective"],fakerMethod:"word.adjective",schemaType:"string",minScore:0.8},{keywords:["adverb"],fakerMethod:"word.adverb",schemaType:"string",minScore:0.8},{keywords:["noun"],fakerMethod:"word.noun",schemaType:"string",minScore:0.8},{keywords:["verb"],fakerMethod:"word.verb",schemaType:"string",minScore:0.8}],i=[...B0,...Z0,...K0,...j0,...X0,...W0,...q0,...U0,...V0,...Y0,...b0,...w0,...H0,...C0,...G0,...I0,...F0,...P0,...J0,...M0,...z0,...L0,...O0,..._0];function r(Q){let $=Q.split(/[_-]/),Z=[];for(let B of $){if(!B)continue;let K=B.replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z0-9])([A-Z])/g,"$1_$2").split("_");for(let j of K)if(j)Z.push(j.toLowerCase())}return Z}function g0(Q,$){let Z=Q.join(""),B=0;for(let K of $){let j=r(K),W=j.join("");if(Z===W)return 1;if(j.length>0&&j.every((X)=>Q.includes(X))){let q=j.length/Q.length>0.5?0.9:0.65;B=Math.max(B,q)}if(j.length>0&&j.length<=Q.length){if(Q.slice(-j.length).every((q,V)=>q===j[V]))B=Math.max(B,0.8)}if(W.length>=3&&Z.includes(W))B=Math.max(B,0.7)}return B}function n(Q,$,Z=i){let B=typeof $.type==="string"?$.type:void 0;if(B==="string"&&$.format==="uuid")return{mapping:{keywords:["uuid"],fakerMethod:"string.uuid",schemaType:"string",minScore:0.5},score:1};if($.pattern||$.enum||"faker"in $&&$.faker||$.$ref||B==="string"&&($.minLength!==void 0||$.maxLength!==void 0))return;let K=$.minimum!==void 0||$.maximum!==void 0||$.exclusiveMinimum!==void 0||$.exclusiveMaximum!==void 0,j=r(Q),W;for(let X of Z){if(K&&(X.schemaType==="number"||X.schemaType==="integer"))continue;if(B==="object"||B==="array")continue;if(X.schemaType&&B&&X.schemaType!==B){if(!(X.schemaType==="number"&&B==="integer"||X.schemaType==="integer"&&B==="number"))continue}let q=g0(j,X.keywords);if(q>=X.minScore&&(!W||q>W.score))W={mapping:X,score:q}}if(B==="string"){if(j[j.length-1]==="id"&&j.length>1){if(!W||W.score<0.8)W={mapping:{keywords:["id"],fakerMethod:"string.uuid",schemaType:"string",minScore:0.5},score:0.8}}}return W}import{ResourceLimitError as x,SchemaValidationError as Y}from"@schmock/core";var N;function U(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function J(Q,$="$"){if(!Q||typeof Q!=="object")throw new Y($,"Schema must be a valid JSON Schema object");if(Object.keys(Q).length===0)throw new Y($,"Schema cannot be empty");let Z=["object","array","string","number","integer","boolean","null"];if(Q.type&&typeof Q.type==="string"&&!Z.includes(Q.type))throw new Y($,`Invalid schema type: "${Q.type}"`,"Supported types are: object, array, string, number, integer, boolean, null");if(Q.type==="object"&&Q.properties){if(typeof Q.properties!=="object"||Array.isArray(Q.properties))throw new Y(`${$}.properties`,"Properties must be an object mapping property names to schemas",'Use { "propertyName": { "type": "string" } } format');for(let[B,K]of Object.entries(Q.properties))if(typeof K==="object"&&K!==null){let j="faker"in K?String(K.faker):void 0;if(j)try{y(j)}catch(W){if(W instanceof Y){let X=W.context,q="Invalid faker method",V;if(X&&typeof X==="object"){if("issue"in X&&typeof X.issue==="string")q=X.issue;if("suggestion"in X&&typeof X.suggestion==="string")V=X.suggestion}throw new Y(`${$}.properties.${B}.faker`,q,V)}if(W instanceof Error)throw W;throw Error(String(W))}J(K,`${$}.properties.${B}`)}}if(Q.type==="array"){if(Q.items===null||Q.items===void 0)throw new Y(`${$}.items`,"Array schema must have valid items definition","Define items as a schema object or array of schemas");if(Array.isArray(Q.items)){if(Q.items.length===0)throw new Y(`${$}.items`,"Array items cannot be empty array","Provide at least one item schema");Q.items.forEach((B,K)=>{if(typeof B==="object"&&B!==null)J(B,`${$}.items[${K}]`)})}else if(typeof Q.items==="object"&&Q.items!==null)J(Q.items,`${$}.items`)}if($==="$"){if(T(Q))throw new Y($,"Schema contains circular references which are not supported");if(Q.$ref==="#")throw new Y($,"Self-referencing schemas are not supported");let B=D(Q);if(B>O)throw new x("schema_nesting_depth",O,B);if(B>=P)x0(Q,$);g(Q,$)}}function T(Q,$=new Set){if($.has(Q))return!0;if(Q.$ref==="#")return!0;if($.add(Q),Q.type==="object"&&Q.properties){for(let Z of Object.values(Q.properties))if(U(Z)){if(T(Z,$))return!0}}if(Q.type==="array"&&Q.items){let Z=Array.isArray(Q.items)?Q.items:[Q.items];for(let B of Z)if(U(B)){if(T(B,$))return!0}}return $.delete(Q),!1}function D(Q,$=0){if($>O)return $;let Z=$;if(Q.type==="object"&&Q.properties){for(let B of Object.values(Q.properties))if(U(B))Z=Math.max(Z,D(B,$+1))}if(Q.type==="array"&&Q.items){let B=Array.isArray(Q.items)?Q.items:[Q.items];for(let K of B)if(U(K))Z=Math.max(Z,D(K,$+1))}return Z}function x0(Q,$){function Z(B,K){let j=B.type;if(Array.isArray(j)?j.includes("array"):j==="array"){let X=B.maxItems||C;if(K>=P&&X>=M)throw new x("deep_nesting_memory_risk",P*M,K*X);if(B.items){let q=Array.isArray(B.items)?B.items:[B.items];for(let V of q)if(U(V))Z(V,K+1)}return}if(j==="object"&&B.properties){for(let X of Object.values(B.properties))if(U(X))Z(X,K+1)}}Z(Q,0)}function g(Q,$){if(Q.type==="array"){if(Q.maxItems&&Q.maxItems>F)throw new x("array_max_items",F,Q.maxItems);let Z=D(Q),B=Q.maxItems||Q.minItems||C;if(Z>P&&B>M)throw new x("memory_estimation",P*M,Z*B)}if(Q.type==="object"&&Q.properties){for(let[Z,B]of Object.entries(Q.properties))if(U(B))g(B,`${$}.properties.${Z}`)}if(Q.type==="array"&&Q.items){if(Array.isArray(Q.items))Q.items.forEach((Z,B)=>{if(U(Z))g(Z,`${$}.items[${B}]`)});else if(U(Q.items))g(Q.items,`${$}.items`)}}function y(Q){let $=Q.split(".");if($.length<2)throw new Y("$.faker",`Invalid faker method format: "${Q}"`,"Use format like 'person.firstName' or 'internet.email'");if(!N)N=R();let B=N;for(let K of $)if(B&&typeof B==="object"&&K in B)B=Reflect.get(B,K);else throw new Y("$.faker",`Invalid faker method: "${Q}"`,"Check faker.js documentation for valid methods");if(typeof B!=="function")throw new Y("$.faker",`Invalid faker method: "${Q}" is not a function`,"Check faker.js documentation for valid methods")}function t(Q){return Q.type==="string"&&Q.faker===void 0&&Q.format===void 0&&Q.pattern===void 0&&Q.enum===void 0&&Q.const===void 0&&Q.$ref===void 0&&Q.minLength===void 0&&Q.maxLength===void 0}function G(Q){if(!Q||typeof Q!=="object")return Q;let $={...Q};if($.properties){$.properties={...$.properties};for(let[Z,B]of Object.entries($.properties))if(U(B))$.properties[Z]=D0(Z,B)}for(let Z of["allOf","anyOf","oneOf"]){let B=$[Z];if(Array.isArray(B))$[Z]=B.map((K)=>U(K)?G(K):K)}if($.items){if(Array.isArray($.items))$.items=$.items.map((Z)=>U(Z)?G(Z):Z);else if(U($.items))$.items=G($.items)}if(U($.additionalProperties))$.additionalProperties=G($.additionalProperties);if(t($))$.faker="lorem.word";return $}function D0(Q,$){let Z={...$};if(Z.faker){if(typeof Z.faker==="string")y(Z.faker);return Z}let B=Z.allOf||Z.anyOf||Z.oneOf;if(Z.properties||B||Z.items){let j=G(Z);Object.assign(Z,j)}if(B)return Z;if(Z.const!==void 0||Z.enum)return Z;let K=n(Q,Z);if(K){let{fakerMethod:j,format:W,trueProbability:X,fakerArgs:q}=K.mapping;if(q)Z.faker={[j]:[q]};else Z.faker=j;if(W)Z.format=W;if(X!==void 0)Z.schmockTrueProbability=X}else if(t(Z))Z.faker="lorem.word";return Z}function v0(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function Z1(Q){return J(Q.schema),{name:"faker",version:E,async process($,Z){if(Z!==void 0&&Z!==null)return{context:$,response:Z};try{let B=await N0({schema:Q.schema,count:Q.count,overrides:Q.overrides,params:$.params,state:$.routeState,query:$.query,seed:Q.seed});return{context:$,response:B}}catch(B){if(B instanceof R0||B instanceof m)throw B;throw new A0($.path,B instanceof Error?B:Error(String(B)),Q.schema)}}}}async function N0(Q){let{schema:$,count:Z,overrides:B,params:K,state:j,query:W,seed:X}=Q;J($);let q=k(X),V=u(q),w=G($);if($.type==="array"&&$.items){let I=d($,Z,V);if(I>F)throw new m("array_size",F,I);w={...w,minItems:I,maxItems:I}}let H=await l(w,q);if(H=A(H,w,V),Array.isArray(H))return H.map((I)=>L(I,B,K,j,W));return H=L(H,B,K,j,W),H}function A(Q,$,Z){if(Q===null||Q===void 0||!$||typeof $!=="object")return Q;if("schmockNullable"in $&&$.schmockNullable===!0){if(Z()<f)return null}if($.type==="boolean"&&"schmockTrueProbability"in $&&typeof $.schmockTrueProbability==="number")return Z()<$.schmockTrueProbability;if(v0(Q)&&$.properties){for(let[B,K]of Object.entries($.properties))if(B in Q&&U(K))Q[B]=A(Q[B],K,Z)}if(Array.isArray(Q)&&Array.isArray($.items))for(let B=0;B<Q.length;B++){let K=$.items[B];if(K&&U(K))Q[B]=A(Q[B],K,Z)}else if(Array.isArray(Q)&&$.items&&U($.items))for(let B=0;B<Q.length;B++)Q[B]=A(Q[B],$.items,Z);return Q}export{N0 as generateFromSchema,Z1 as fakerPlugin};
1
+ import{ResourceLimitError as X6,SchemaGenerationError as e4,SchemaValidationError as E0}from"@schmock/core";var X0="2.3.1";var E=1e4,i=3,n=3,c=100,C0=15,f0=20,Y0=50000,m=1e6,o=1e4,Z=65536,M0="2024-01-01T00:00:00.000Z",Z0=0.05;import{base as t7,en as s7,Faker as $7}from"@faker-js/faker";function u6(j){let q=j|0;return()=>{q=q+1831565813|0;let b=Math.imul(q^q>>>15,1|q);return b=b+Math.imul(b^b>>>7,61|b)^b,((b^b>>>14)>>>0)/4294967296}}function c0(j){let q=u6(j),b=0,K={next(){return b++,q()},int(P,V){return P+Math.floor(K.next()*(V-P+1))},bool(P=0.5){return K.next()<P},pick(P){return P[K.int(0,P.length-1)]},shuffle(P){let V=[...P];for(let B=V.length-1;B>0;B--){let U=K.int(0,B);[V[B],V[U]]=[V[U],V[B]]}return V},fork(){let P=Math.floor(K.next()*4294967296);return c0(P)}};return K}function l6(j){return null}function d6(j){return j.random.bool()}function t0(j,q,b=!1){let K=-1000,P=1000,V=!1,B=!1;if(j.minimum!==void 0)K=j.minimum;if(j.maximum!==void 0)P=j.maximum;if(j.exclusiveMinimum!==void 0)K=j.exclusiveMinimum,V=!0;if(j.exclusiveMaximum!==void 0)P=j.exclusiveMaximum,B=!0;if(j.multipleOf!==void 0)return h6(j.multipleOf,K,P,V,B,q);if(b){let w=V?Math.floor(K)+1:Math.ceil(K),L=B?Math.ceil(P)-1:Math.floor(P);return q.random.int(w,L)}let U=V?K+Number.EPSILON:K,W=B?P-Number.EPSILON:P;return U+q.random.next()*(W-U)}function h6(j,q,b,K,P,V){let B=Math.ceil(q/j),U=Math.floor(b/j);if(K&&B*j===q)B++;if(P&&U*j===b)U--;if(B>U)return B*j;return V.random.int(B,U)*j}function o6(j,q){if(j.autoIncrement){let b=j.initialOffset??1,K=r6(q.path),P=q.autoIncrementCounters??new Map,V=(P.get(K)??b-1)+1;if(P.set(K,V),q.autoIncrementCounters)q.autoIncrementCounters.set(K,V);return V}return t0(j,q,!0)}function r6(j){return j.split("/").filter((q)=>q!==""&&!/^\d+$/.test(q)).join("/")}function v0(j,q){let b=s0(j,0);return s(b.node,q)}function s(j,q){switch(j.type){case"literal":return j.value;case"dot":return q.pick([..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#%&*()-_=+[]{}|;:',.<>/? "]);case"anchor":return"";case"charClass":return i6(j,q);case"sequence":return j.nodes.map((b)=>s(b,q)).join("");case"alternation":return s(q.pick(j.branches),q);case"quantifier":{let b=q.int(j.min,Math.min(j.max,j.min+5));return Array.from({length:b},()=>s(j.node,q)).join("")}case"group":return s(j.node,q)}}function i6(j,q){if(!j.negated)return q.pick(j.chars);let b=new Set(j.chars),K=[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#%&*()-_=+[]{}|;:',.<>/? "].filter((P)=>!b.has(P));return K.length>0?q.pick(K):"a"}function s0(j,q){let b=[],K=[];while(q<j.length){let P=j[q];if(P===")")break;if(P==="|"){b.push(p0(K)),K=[],q++;continue}if(P==="("){let U=q+1;if(j[U]==="?")if(j[U+1]===":")U+=2;else if(j[U+1]==="="||j[U+1]==="!"){let I=1,C=U;while(C<j.length&&I>0){if(C++,j[C]==="(")I++;if(j[C]===")")I--}q=C+1;continue}else{U+=2;while(U<j.length&&j[U]!==">")U++;U++}let W=s0(j,U),w={type:"group",node:W.node};q=W.pos+1;let L=t(j,q,w);K.push(L.node),q=L.pos;continue}if(P==="["){let U=G6(j,q),W=t(j,U.pos,U.node);K.push(W.node),q=W.pos;continue}if(P==="."){let U={type:"dot"};q++;let W=t(j,q,U);K.push(W.node),q=W.pos;continue}if(P==="^"||P==="$"){K.push({type:"anchor"}),q++;continue}if(P==="\\"){q++;let U=m6(j,q);q=U.pos;let W=t(j,q,U.node);K.push(W.node),q=W.pos;continue}let V={type:"literal",value:P};q++;let B=t(j,q,V);K.push(B.node),q=B.pos}return b.push(p0(K)),{node:b.length===1?b[0]:{type:"alternation",branches:b},pos:q}}function p0(j){if(j.length===0)return{type:"literal",value:""};if(j.length===1)return j[0];return{type:"sequence",nodes:j}}function m6(j,q){let b=j[q];switch(q++,b){case"d":return{node:{type:"charClass",chars:[..."0123456789"],negated:!1},pos:q};case"D":return{node:{type:"charClass",chars:[..."0123456789"],negated:!0},pos:q};case"w":return{node:{type:"charClass",chars:[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"],negated:!1},pos:q};case"W":return{node:{type:"charClass",chars:[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"],negated:!0},pos:q};case"s":return{node:{type:"charClass",chars:[...`
2
+ `],negated:!1},pos:q};case"S":return{node:{type:"charClass",chars:[...`
3
+ `],negated:!0},pos:q};case"b":case"B":return{node:{type:"anchor"},pos:q};default:return{node:{type:"literal",value:b},pos:q}}}function G6(j,q){q++;let b=!1;if(j[q]==="^")b=!0,q++;let K=[];while(q<j.length&&j[q]!=="]"){if(j[q]==="\\"&&q+1<j.length){q++;let P=j[q];switch(P){case"d":K.push(..."0123456789");break;case"w":K.push(..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_");break;case"s":K.push(...`
4
+ `);break;default:K.push(P)}q++;continue}if(q+2<j.length&&j[q+1]==="-"&&j[q+2]!=="]"){let P=j.charCodeAt(q),V=j.charCodeAt(q+2);for(let B=P;B<=V;B++)K.push(String.fromCharCode(B));q+=3;continue}K.push(j[q]),q++}return q++,{node:{type:"charClass",chars:K,negated:b},pos:q}}function t(j,q,b){if(q>=j.length)return{node:b,pos:q};let K=j[q],P,V;switch(K){case"*":P=0,V=5,q++;break;case"+":P=1,V=5,q++;break;case"?":P=0,V=1,q++;break;case"{":{let B=n6(j,q);if(B)P=B.min,V=B.max,q=B.pos;else return{node:b,pos:q};break}default:return{node:b,pos:q}}if(q<j.length&&(j[q]==="?"||j[q]==="+"))q++;return{node:{type:"quantifier",node:b,min:P,max:V},pos:q}}function n6(j,q){let b=j.slice(q).match(/^\{(\d+)(?:,(\d*))?\}/);if(!b)return null;let K=parseInt(b[1],10),P;if(b[2]===void 0)P=K;else if(b[2]==="")P=K+5;else P=parseInt(b[2],10);return{min:K,max:P,pos:q+b[0].length}}function X(j){return j<10?`0${j}`:`${j}`}function c6(j,q){return new Date(j,q,0).getDate()}var $0="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";function t6(j){if(j==="^"||j==="$"||j==="^$")return!1;return!0}function s6(j,q){if(j.format){if(j.format==="date-time"&&(q.minDateTime!==void 0||q.maxDateTime!==void 0))return $6(q);let B=q.formatRegistry.get(j.format);if(B){let U=B(q.random),W=q.minLength??j.minLength,w=q.maxLength??j.maxLength;if(W!==void 0&&U.length<W)return D0(U,W,q);if(w!==void 0&&U.length>w)return U.slice(0,w);return U}}if(j.pattern){let B=q.minLength??j.minLength,U=q.maxLength??j.maxLength,W=50;for(let I=0;I<50;I++){let C=v0(j.pattern,q.random);if(B!==void 0&&C.length<B)continue;if(U!==void 0&&C.length>U)continue;return C}let w=v0(j.pattern,q.random),L=t6(j.pattern);if(B!==void 0&&w.length<B){if(L)return D0(w,B,q)}if(U!==void 0&&w.length>U)return w.slice(0,U);return w}let b=j.minLength??0,K=j.maxLength??Math.max(b+10,10),P=q.random.int(b,K),V="";for(let B=0;B<P;B++)V+=q.random.pick([...$0]);if(q.maxLength!==void 0&&V.length>q.maxLength)V=V.slice(0,q.maxLength);if(q.minLength!==void 0&&V.length<q.minLength)V=D0(V,q.minLength,q);return V}function D0(j,q,b){while(j.length<q)j+=b.random.pick([...$0]);return j}function $6(j){let q=j.minDateTime?new Date(j.minDateTime):new Date("1970-01-01"),b=j.maxDateTime?new Date(j.maxDateTime):new Date,K=q.getTime(),P=b.getTime(),V=K+j.random.next()*(P-K),B=new Date(V),U=B.getFullYear(),W=X(B.getMonth()+1),w=X(B.getDate());return`${U}-${W}-${w}T01:01:01.0Z`}function u0(j,q){if(j.const!==void 0)return structuredClone(j.const);if(j.enum!==void 0&&j.enum.length>0){let b=j.enum;if(j.minimum!==void 0||j.maximum!==void 0||j.exclusiveMinimum!==void 0||j.exclusiveMaximum!==void 0||j.multipleOf!==void 0){let P=j.exclusiveMinimum??j.minimum??-1/0,V=j.exclusiveMaximum??j.maximum??1/0,B=j.exclusiveMinimum!==void 0,U=j.exclusiveMaximum!==void 0;b=b.filter((W)=>{if(typeof W!=="number")return!0;let w=B?W>P:W>=P,L=U?W<V:W<=V;if(!w||!L)return!1;if(j.multipleOf!==void 0){let I=j.multipleOf,C=I.toString().includes(".")?I.toString().split(".")[1].length:0,k=Math.pow(10,C),T=Math.round(W*k),S=Math.round(I*k);if(T%S!==0)return!1}return!0})}if(j.minLength!==void 0||j.maxLength!==void 0){let P=j.minLength??0,V=j.maxLength??1/0;b=b.filter((B)=>{if(typeof B!=="string")return!0;return B.length>=P&&B.length<=V})}if(j.minItems!==void 0||j.maxItems!==void 0){let P=j.minItems??0,V=j.maxItems??1/0;b=b.filter((B)=>{if(!Array.isArray(B))return!0;return B.length>=P&&B.length<=V})}if(j.minProperties!==void 0||j.maxProperties!==void 0){let P=j.minProperties??0,V=j.maxProperties??1/0;b=b.filter((B)=>{if(typeof B!=="object"||B===null||Array.isArray(B))return!0;return Object.keys(B).length>=P&&Object.keys(B).length<=V})}if(b.length===0){let P=[];if(j.minLength!==void 0)P.push(`minLength: ${j.minLength}`);if(j.maxLength!==void 0)P.push(`maxLength: ${j.maxLength}`);if(j.minItems!==void 0)P.push(`minItems: ${j.minItems}`);if(j.maxItems!==void 0)P.push(`maxItems: ${j.maxItems}`);if(j.minProperties!==void 0)P.push(`minProperties: ${j.minProperties}`);if(j.maxProperties!==void 0)P.push(`maxProperties: ${j.maxProperties}`);if(j.minimum!==void 0)P.push(`minimum: ${j.minimum}`);if(j.maximum!==void 0)P.push(`maximum: ${j.maximum}`);if(j.exclusiveMinimum!==void 0)P.push(`exclusiveMinimum: ${j.exclusiveMinimum}`);if(j.exclusiveMaximum!==void 0)P.push(`exclusiveMaximum: ${j.exclusiveMaximum}`);if(j.multipleOf!==void 0)P.push(`multipleOf: ${j.multipleOf}`);throw Error(`enum values conflict with constraints [${P.join(", ")}] at ${q.path}`)}let K=q.random.pick(b);return typeof K==="object"&&K!==null?structuredClone(K):K}throw Error(`generateEnumConst called without enum or const at ${q.path}`)}function v(j){let q={};for(let b of j){if(typeof b==="boolean"){if(!b)return{not:{}};continue}e0(q,b)}return q}function a0(j,q){if(typeof j==="boolean"||typeof q==="boolean")return{};if(typeof j!=="object"||j===null)return typeof q==="object"&&q!==null?q:{};if(typeof q!=="object"||q===null)return j;let b={...j};return e0(b,q),b}function e0(j,q){if(q.type!==void 0)if(j.type===void 0)j.type=q.type;else j.type=a6(j.type,q.type);if(q.minimum!==void 0)j.minimum=j.minimum!==void 0?Math.max(j.minimum,q.minimum):q.minimum;if(q.maximum!==void 0)j.maximum=j.maximum!==void 0?Math.min(j.maximum,q.maximum):q.maximum;if(q.exclusiveMinimum!==void 0)j.exclusiveMinimum=j.exclusiveMinimum!==void 0?Math.max(j.exclusiveMinimum,q.exclusiveMinimum):q.exclusiveMinimum;if(q.exclusiveMaximum!==void 0)j.exclusiveMaximum=j.exclusiveMaximum!==void 0?Math.min(j.exclusiveMaximum,q.exclusiveMaximum):q.exclusiveMaximum;if(q.multipleOf!==void 0)j.multipleOf=q.multipleOf;if(q.minLength!==void 0)j.minLength=j.minLength!==void 0?Math.max(j.minLength,q.minLength):q.minLength;if(q.maxLength!==void 0)j.maxLength=j.maxLength!==void 0?Math.min(j.maxLength,q.maxLength):q.maxLength;if(q.pattern!==void 0)j.pattern=q.pattern;if(q.format!==void 0)j.format=q.format;if(q.minItems!==void 0)j.minItems=j.minItems!==void 0?Math.max(j.minItems,q.minItems):q.minItems;if(q.maxItems!==void 0)j.maxItems=j.maxItems!==void 0?Math.min(j.maxItems,q.maxItems):q.maxItems;if(q.uniqueItems)j.uniqueItems=!0;if(q.items!==void 0)j.items=q.items;if(q.prefixItems!==void 0)if(j.prefixItems===void 0)j.prefixItems=q.prefixItems;else{let b=[],K=Math.max(j.prefixItems.length,q.prefixItems.length);for(let P=0;P<K;P++){let V=j.prefixItems[P],B=q.prefixItems[P];if(V!==void 0&&B!==void 0)b.push(a0(V,B));else if(V!==void 0)b.push(V);else if(B!==void 0)b.push(B)}j.prefixItems=b}if(q.contains!==void 0)if(j.containsAll!==void 0)j.containsAll=[...j.containsAll,q.contains];else if(j.contains!==void 0)j.containsAll=[j.contains,q.contains],delete j.contains;else j.contains=q.contains;if(q.properties)j.properties=e6(j.properties??{},q.properties);if(q.required)j.required=[...new Set([...j.required??[],...q.required])];if(q.additionalProperties!==void 0)j.additionalProperties=q.additionalProperties;if(q.patternProperties)j.patternProperties={...j.patternProperties??{},...q.patternProperties};if(q.minProperties!==void 0)j.minProperties=j.minProperties!==void 0?Math.max(j.minProperties,q.minProperties):q.minProperties;if(q.maxProperties!==void 0)j.maxProperties=j.maxProperties!==void 0?Math.min(j.maxProperties,q.maxProperties):q.maxProperties;if(q.const!==void 0)j.const=q.const;if(q.enum!==void 0)if(j.enum!==void 0){let b=new Set(q.enum.map((K)=>JSON.stringify(K)));j.enum=j.enum.filter((K)=>b.has(JSON.stringify(K)))}else j.enum=q.enum;if(q.$ref)j.$ref=q.$ref;if(q.$defs)j.$defs={...j.$defs??{},...q.$defs};if(q.allOf)j.allOf=[...j.allOf??[],...q.allOf];if(q.anyOf)j.anyOf=q.anyOf;if(q.oneOf)j.oneOf=q.oneOf}function a6(j,q){let b=Array.isArray(j)?j:[j],K=Array.isArray(q)?q:[q],P=b.filter((V)=>K.includes(V));if(P.length===0)return b[0];if(P.length===1)return P[0];return P}function e6(j,q){let b={...j};for(let[K,P]of Object.entries(q)){let V=j[K];if(V===void 0)b[K]=P;else if(typeof V==="object"&&typeof P==="object")b[K]=a0(V,P);else b[K]=P}return b}var V0=new Set(["$schema","$id","$ref","$defs","$anchor","$dynamicRef","$dynamicAnchor","$vocabulary","$comment","type","enum","const","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","minLength","maxLength","pattern","format","contentEncoding","contentMediaType","contentSchema","items","prefixItems","contains","minItems","maxItems","uniqueItems","minContains","maxContains","properties","required","additionalProperties","patternProperties","minProperties","maxProperties","propertyNames","dependentRequired","dependentSchemas","allOf","anyOf","oneOf","not","if","then","else","faker","chance","jsonPath","template","default","examples","description","title","readOnly","writeOnly","deprecated"]);function j6(j){if(typeof j!=="object"||j===null)return!1;return Object.keys(j).some((q)=>V0.has(q))}function l0(j,q){if(typeof q!=="object"||q===null)return!1;let b=q;if(b.const!==void 0)return j===b.const;if(b.enum!==void 0)return b.enum.some((K)=>K===j);return!1}function j7(j){if(typeof j==="boolean")return!j;if(typeof j!=="object"||j===null)return!1;if(j.not===!0||typeof j.not==="object"&&j.not!==null&&Object.keys(j.not).length===0)return!0;return!1}function q7(j){if(j.properties)return j.properties;if(j.type==="object"||j.type===void 0){let q={},b=!1;for(let[K,P]of Object.entries(j)){if(V0.has(K))continue;if(j6(P))q[K]=P,b=!0;else q[K]={const:P},b=!0}if(b)return q}return{}}function b7(j,q){if(j.required)return j.required;if(j.properties===void 0&&Object.keys(q).length>0)return Object.keys(q);return[]}async function K7(j,q){let b=q7(j),K=b7(j,b);if(q.depth>=q.maxDepth){if(K.length===0)return{};let F={};for(let Y of K){let z=b[Y];if(z&&typeof z==="object"&&z!==null){let M=z;if(M.const!==void 0)F[Y]=M.const;else if(M.default!==void 0)F[Y]=M.default;else if(M.enum!==void 0&&M.enum.length>0)F[Y]=M.enum[0];else F[Y]=U7(M.type)}else F[Y]=null}return F}if(j.additionalProperties===!1){let F=Object.keys(b).length>0,Y=j.patternProperties&&Object.keys(j.patternProperties).length>0,z=new Set(Object.keys(b)),M=[...new Set(K)].filter((D)=>!z.has(D));if((j.minProperties??0)>0&&!F&&!Y)throw Error(`missing properties for ${j.minProperties} in ${q.path}: additionalProperties is false but no properties or patternProperties defined`);if(M.length>0&&!Y&&!F)throw Error(`missing properties for ${M.join(", ")} in ${q.path}: additionalProperties is false but required properties not defined in properties`)}let P=q.path==="/"?"/properties":`${q.path}/properties`,V={...q,depth:q.depth+1,path:P},B={},U=new Set,W=new Set(K),w=q.alwaysFakeOptionals??!1,L=q.fillProperties??!0,I=q.fixedProbabilities??!1,C=q.optionalsProbability??0.5,k=Object.keys(b).filter((F)=>!W.has(F)),T;if(I&&!w&&k.length>0){let F=Math.round(k.length*C);T=new Set(k.slice(0,F))}let S=(F)=>{if(w)return!0;if(T)return T.has(F);return q.random.bool(C)};if(Object.keys(b).length>0)for(let[F,Y]of Object.entries(b)){if(j7(Y))continue;U.add(F);let z=d(V,F),M=W.has(F),D=typeof Y==="object"&&Y!==null&&Y.type==="object",O=Y;if(j.patternProperties&&typeof Y==="object"&&Y!==null){let x=[];for(let[N,J]of Object.entries(j.patternProperties))try{if(new RegExp(N).test(F))x.push(J)}catch{}if(x.length>0)O=v([Y,...x])}if(M){let x=await Q(O,z);if(x!==void 0)B[F]=x}else if(S(F)){let x=await Q(O,z);if(x!==void 0)B[F]=x}else if(D&&!L){let x=Y.required??[];if(x.length>0){let N={};for(let J of x){let Z6=(Y.properties??{})[J]??{},v6=d(z,J),S0=await Q(Z6,v6);if(S0!==void 0)N[J]=S0}B[F]=N}}}for(let F of W){if(B[F]!==void 0||U.has(F))continue;if(j.patternProperties){let Y=[];for(let[z,M]of Object.entries(j.patternProperties))if(new RegExp(z).test(F))Y.push(M);if(Y.length>0){let z=Y.length===1?Y[0]:v(Y),M=d(V,F),D=await Q(z,M);if(D!==void 0)B[F]=D;U.add(F)}}if(!U.has(F)){let Y=j.additionalProperties??!0;if(Y!==!1){let z=d(V,F),M=await Q(Y===!0?{}:Y,z);if(M!==void 0)B[F]=M;U.add(F)}}}if(j.dependencies)for(let[F,Y]of Object.entries(j.dependencies)){if(typeof Y!=="object"||Y===null||Array.isArray(Y))continue;if(B[F]!==void 0&&!U.has(F+"_dep")){U.add(F+"_dep");let z=Y.oneOf??Y.anyOf??Y.allOf??[Y],M=null;for(let D of z){if(typeof D!=="object"||D===null)continue;let{properties:O,not:x}=D;if(O&&O[F]){let N=O[F],J=B[F];if(l0(J,N)){M=D;break}}if(x?.properties){let N=x.properties[F];if(N){let J=B[F];if(!l0(J,N)){M=D;break}}}}if(!M&&z.length>0&&typeof z[0]==="object")M=z[0];if(M?.not){let D=M.not;if(D.required&&Array.isArray(D.required))for(let O of D.required)delete B[O]}if(M?.required)for(let D of M.required){if(D===F)continue;if(B[D]!==void 0)continue;let O=M.properties?.[D]??{type:"object"},x=d(V,D),N=await Q(O,x);if(N!==void 0)B[D]=N}if(M&&M.properties)for(let[D,O]of Object.entries(M.properties)){if(D===F)continue;let x=d(V,D),N=await Q(O,x);if(N!==void 0)B[D]=N}}}let R=j.minProperties??0,y=j.maxProperties;if(Object.keys(B).length<R){if(j.patternProperties&&Object.keys(j.patternProperties).length>0){let F=Object.entries(j.patternProperties),Y=0,z=1000;while(Object.keys(B).length<R&&Y<z){Y++;let[M,D]=q.random.pick(F),O=B7(M,q);if(O&&!B[O]){let x=d(V,O),N=await Q(D,x);if(N!==void 0)B[O]=N;U.add(O)}}}if(Object.keys(B).length<R){let F=j.additionalProperties,Y=F===void 0||F===!0?{type:"string"}:F;if(Y!==!1){let z=0,M=1000;while(Object.keys(B).length<R&&z<M){z++;let D=`prop${q.random.int(0,99999)}`;if(!B[D]){let O=d(V,D),x=await Q(Y,O);if(x!==void 0)B[D]=x;U.add(D)}}}}if(Object.keys(B).length<R){let F=Object.keys(b).join(", ");throw Error(`properties '${F}' were not found while additionalProperties is false in ${q.path}`)}}if(y!==void 0&&Object.keys(B).length>y){let F=Object.keys(B).filter((Y)=>!W.has(Y));q.random.shuffle(F);while(Object.keys(B).length>y&&F.length>0){let Y=F.pop();delete B[Y]}}if(q.pruneProperties&&q.pruneProperties.length>0)z0(B,q.pruneProperties);return V7(B,b),B}function d(j,q){let b=P7(q),K=j.outputPath==="/"?`/${b}`:`${j.outputPath}/${b}`;return{...j,path:`${j.path}/${q}`,outputPath:K}}function P7(j){return j.replace(/~/g,"~0").replace(/\//g,"~1")}function V7(j,q){for(let[b,K]of Object.entries(q)){if(typeof K!=="object"||K===null)continue;let P=K;if(P.template===void 0)continue;let V=P.template;if(typeof V!=="string")continue;let B=V.replace(/#\{(\w+)\}/g,(U,W)=>{let w=j[W];return w!==void 0?String(w):""});j[b]=B}}function B7(j,q){let b=j.match(/^\^([a-zA-Z]+)(\.\*|\(\?\:.*\))?/);if(b){let W=b[1],w=b[2];if(w===".*"||w?.includes("?:")){let L=q.random.int(0,10),I="abcdefghijklmnopqrstuvwxyz",C="";for(let k=0;k<L;k++)C+=q.random.pick("abcdefghijklmnopqrstuvwxyz".split(""));return W+C}return W}let K=j.match(/(.*\*)?([a-zA-Z]+)\$$/);if(K){let W=K[2],w=q.random.int(1,10),L="abcdefghijklmnopqrstuvwxyz",I="";for(let C=0;C<w;C++)I+=q.random.pick("abcdefghijklmnopqrstuvwxyz".split(""));return I+W}let P=j.match(/^\^([a-zA-Z]+)\$$/);if(P)return P[1];let V=q.random.int(3,10),B="abcdefghijklmnopqrstuvwxyz",U="";for(let W=0;W<V;W++)U+=q.random.pick(B.split(""));try{if(new RegExp(j).test(U))return U}catch{}return null}function z0(j,q){if(typeof j!=="object"||j===null)return;if(Array.isArray(j)){for(let K of j)z0(K,q);return}let b=j;for(let K of Object.keys(b))if(q.includes(K))delete b[K];else z0(b[K],q)}function U7(j){switch(Array.isArray(j)?j[0]:j){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"null":return null;case"array":return[];case"object":return{};default:return null}}async function W7(j,q){if(q.depth>=q.maxDepth){let F=j.minItems??0;return F>0?Array.from({length:F},()=>null):[]}if(q.refDepthReached){let F=j.minItems??0;return F>0?Array.from({length:F},()=>null):[]}if(j.items===!1&&(j.minItems??0)>0){let F=j.prefixItems?.length??0;if((j.minItems??0)>F)throw Error(`missing items for ${j.minItems} in ${q.path}: items is false but minItems (${j.minItems}) exceeds prefixItems count (${F})`)}let b=q.path==="/"?"/items":`${q.path}/items`,K={...q,depth:q.depth+1,path:b},P=[],V=q.refDepthMax,B=q.minItems??j.minItems??0,U=q.maxItems??j.maxItems??Math.max(B,q.maxDefaultItems);if(j.maxItems!==void 0&&U>j.maxItems)U=j.maxItems;if(j.minItems!==void 0&&B<j.minItems)B=j.minItems;if(U<B)if(j.maxItems!==void 0)B=U;else U=B;if(q.alwaysFakeOptionals)U=Math.max(B,U);let W=j.uniqueItems?new Set:null,w=async(F,Y)=>{let z=await Q(F,Y);if(z===void 0)return"omitted";if(W){let M=JSON.stringify(z);if(W.has(M)){for(let D=0;D<50;D++){if(z=await Q(F,h(K,P.length)),z===void 0)continue;let O=JSON.stringify(z);if(!W.has(O))return W.add(O),P.push(z),"added"}return"failed"}W.add(M)}return P.push(z),"added"};if(j.prefixItems)for(let F=0;F<j.prefixItems.length&&P.length<U;F++){let Y=h(K,F);if(await w(j.prefixItems[F],Y)==="failed")break}let L;if(V!==void 0&&q.refDepth>=V-1){let F=j.minItems??0;return F>0?Array.from({length:F},()=>null):[]}let I=q.alwaysFakeOptionals??!1,C=q.fixedProbabilities??!1,k=q.optionalsProbability??0.5;if(I)L=U;else if(C){let F=U-Math.max(B,P.length),Y=Math.round(F*k);L=Math.max(B,P.length)+Y}else L=q.random.int(Math.max(B,P.length),U);let T=j.items!==void 0,S=j.prefixItems!==void 0,R=j.additionalItems!==void 0,y;if(S){if(R)y=j.additionalItems;else if(j.items!==void 0)y=j.items}else y=j.items;if(y!==!1&&y!==void 0){let F=y??{},Y=0,z=Math.max(L*20,50);while(P.length<L){let M=await w(F,h(K,P.length));if(M==="added"){Y=0;continue}if(Y++,M==="failed"||Y>=z)break}}if(j.contains){let F=j.minContains??1,Y=j.maxContains??Math.max(F,1),z=q.random.int(F,Y);for(let M=0;M<z;M++){let D=await Q(j.contains,h(K,P.length));if(D===void 0)continue;if(W){let O=JSON.stringify(D);if(W.has(O)){let x=!1;for(let N=0;N<50;N++){if(D=await Q(j.contains,h(K,P.length)),D===void 0)continue;let J=JSON.stringify(D);if(!W.has(J)){W.add(J),x=!0;break}}if(!x)continue}else W.add(O)}if(P.length<U){let O=q.random.int(0,P.length);P.splice(O,0,D)}else if(P.length>0){let O=q.random.int(0,P.length-1);P[O]=D}}while(P.length>U)P.pop()}if(j.containsAll){let F=new Set;for(let Y of j.containsAll){let z=await Q(Y,h(K,P.length));if(z===void 0)continue;if(W){let M=JSON.stringify(z);if(W.has(M)){let D=!1;for(let O=0;O<50;O++){if(z=await Q(Y,h(K,P.length)),z===void 0)continue;let x=JSON.stringify(z);if(!W.has(x)){W.add(x),D=!0;break}}if(!D)continue}else W.add(M)}if(P.length<U){let M=q.random.int(0,P.length);P.splice(M,0,z);let D=new Set;for(let O of F)D.add(O>=M?O+1:O);F.clear();for(let O of D)F.add(O);F.add(M)}else if(P.length>0){let M=Array.from({length:P.length},(D,O)=>O).filter((D)=>!F.has(D));if(M.length>0){let D=M[q.random.int(0,M.length-1)];P[D]=z,F.add(D)}else P.push(z),F.add(P.length-1)}}while(P.length>U)P.pop()}if(j.uniqueItems&&P.length>0)return w7(P,j,K,B,U,W);return P}async function w7(j,q,b,K,P,V){let B=q.items??{},U=0,W=100;while(j.length<K&&U<W){U++;let w=await Q(B,h(b,j.length));if(w===void 0)continue;let L=JSON.stringify(w);if(!V.has(L))V.add(L),j.push(w)}while(j.length>P)j.pop();return j}function h(j,q){let b=j.outputPath==="/"?`/${q}`:`${j.outputPath}/${q}`;return{...j,path:`${j.path}/${q}`,outputPath:b}}function d0(j,q){if(!q||q==="")return j;if(typeof j!=="object"||j===null)throw Error(`Cannot resolve fragment "${q}" in non-object schema`);if(q.startsWith("/"))return I7(j,q);throw Error(`Unsupported fragment type: ${q}. Only JSON pointers (starting with /) are supported.`)}function I7(j,q){if(q===""||q==="/")return j;let b=q.slice(1).split("/"),K=j;for(let P of b){let V=P.replace(/~1/g,"/").replace(/~0/g,"~");if(typeof K!=="object"||K===null)throw Error(`Cannot resolve JSON pointer "${q}": not an object at "${V}"`);if(Array.isArray(K)){let B=parseInt(V,10);if(isNaN(B)||B<0||B>=K.length)throw Error(`Cannot resolve JSON pointer "${q}": invalid array index "${V}"`);K=K[B]}else{if(!(V in K))throw Error(`Cannot resolve JSON pointer "${q}": property "${V}" not found`);K=K[V]}}return K}function F7(j){let q=new Map;if(typeof j==="boolean")return q;if(j.$id&&typeof j==="object"){let b=j,K=b.$id,{$id:P,...V}=b;q.set(K,V)}if(j.$defs)for(let[b,K]of Object.entries(j.$defs))q.set(`#/$defs/${b}`,K);return q}async function P0(j,q){let b=j.$ref;if(!b)return{schema:j,ctx:q};let K=q.refDepth+1;if(q.refDepthMax!==void 0&&K>=q.refDepthMax)return{schema:{},ctx:{...q,refDepthReached:!0}};if(q.refStack.has(b)){if(q.refDepthMax!==void 0){if(q.refDepth>=q.refDepthMax)return{schema:{},ctx:{...q,refDepthReached:!0}}}else if(q.depth>=q.maxDepth)return{schema:{type:"null"},ctx:q}}let P,V;if(b.startsWith("#/")){if(P=q.refRegistry.get(b),P===void 0&&b.length>2){let I=q.refRegistry.get("#");if(I!==void 0&&typeof I==="object")try{P=d0(I,b.slice(1))}catch{}}if(P===void 0&&q.refResolver){if(P=await q.refResolver(b),P!==void 0)q.refRegistry.set(b,P)}}else if(b==="#")P=q.refRegistry.get("#")??{};else if(P=q.refRegistry.get(b),P===void 0&&q.refResolver){V=await q.refResolver(b);let I=b.indexOf("#");if(I!==-1){let C=b.slice(I+1);if(C)P=d0(V,C);else P=V}else P=V;if(V&&typeof V==="object"&&V!==null){let C=V;if(C.$defs)for(let[k,T]of Object.entries(C.$defs))q.refRegistry.set(`#/$defs/${k}`,T)}}if(P===void 0)throw Error(`Unresolved $ref: ${b}`);let B=new Set(["description","title","$comment","readOnly","writeOnly","deprecated"]),{$ref:U,...W}=j,w=Object.fromEntries(Object.entries(W).filter(([I])=>!B.has(I)));if(Object.keys(w).length>0&&typeof P==="object"&&P!==null)P={...P,...w};let L={...q,refStack:new Set([...q.refStack,b]),refDepth:q.refDepth+1};return{schema:P,ctx:L}}function L7(j,q){if(typeof j==="boolean")return;q.set("#",j),O0(j,"#",q)}function O0(j,q,b){if(j.$id){let{$id:K,...P}=j;b.set(K,P)}if(j.$defs)for(let[K,P]of Object.entries(j.$defs)){let V=`${q}/$defs/${K}`;if(b.set(V,P),typeof P==="object"&&P!==null)O0(P,V,b)}if(j.properties){for(let[K,P]of Object.entries(j.properties))if(typeof P==="object"&&P!==null)O0(P,`${q}/properties/${K}`,b)}}async function C7(j,q){if(!j.$ref)return j;return(await P0(j,q)).schema}async function Y7(j,q){let b=[];for(let K of j)if(typeof K==="object"&&K!==null&&"$ref"in K){let P=await C7(K,q);b.push(P)}else if(typeof K==="object"&&K!==null)b.push(K);return b}async function M7(j,q){let{allOf:b,anyOf:K,oneOf:P,not:V,if:B,then:U,else:W,...w}=j;if(b){let L=await Y7(b,q),I=v([w,...L]);return Q(I,q)}if(P){let L=q.random.shuffle([...P]),I=w.required??[];for(let Y of L){let z=typeof Y==="object"&&Y!==null?Y:{};if(z.$ref)z=(await P0(z,q)).schema;let M=z.required??[],D=[...new Set([...I,...M])],O={...w,required:D},x=v([O,z]),N={...q,optionalsProbability:0,alwaysFakeOptionals:!1};try{return await Q(x,N)}catch{}}let C=P[0],k=typeof C==="object"&&C!==null?C:{};if(k.$ref)k=(await P0(k,q)).schema;let T=k.required??[],S=[...new Set([...I,...T])],R={...w,required:S},y=v([R,k]),F={...q,optionalsProbability:0,alwaysFakeOptionals:!1};return Q(y,F)}if(K){let L=q.random.shuffle([...K]);for(let k of L){let T=v([w,k]);try{return await Q(T,q)}catch{}}let I=K[0],C=v([w,I]);return Q(C,q)}if(B!==void 0)return D7(w,B,U,W,q);if(V)return z7(w,V,q);return Q(w,q)}async function D7(j,q,b,K,P){if(b!==void 0){let V=v([j,q,b]);try{return await Q(V,P)}catch{}}if(K!==void 0){let V=v([j,K]);try{return await Q(V,P)}catch{}}return Q(j,P)}async function z7(j,q,b){if(typeof q==="boolean"){if(q===!0)throw Error(`Cannot generate value for 'not: true' at ${b.path}`);return Q(j,b)}if(q.type&&!q.enum&&!q.const){let K=Array.isArray(q.type)?q.type:[q.type],P=["string","number","integer","boolean","null","object","array"].filter((V)=>!K.includes(V));if(P.length>0){let V=b.random.pick(P),B=v([j,{type:V}]);return Q(B,b)}}if(q.const!==void 0||q.enum!==void 0){let K=q.enum??[q.const],P=new Set(K.map((V)=>JSON.stringify(V)));for(let V=0;V<20;V++){let B=await Q(j,b);if(!P.has(JSON.stringify(B)))return B}}return Q(j,b)}class q6{extensions=new Map;define(j,q){this.extensions.set(j,{callback:q,context:{}})}has(j){return this.extensions.has(j)}reset(j){if(j){let q=this.extensions.get(j);if(q)q.context={},this.extensions.delete(j)}else this.extensions.clear()}keys(){return this.extensions.keys()}generate(j,q){let b=Object.keys(j);for(let K=b.length-1;K>=0;K--){let P=b[K],V=P.startsWith("x-")?P.slice(2):P,B=this.extensions.get(V);if(B){let U=j[P],W=B.callback.call(B.context,U,j,q);if(W!==void 0)return W}}return}getContext(j){return this.extensions.get(j)?.context}}var O7=new q6;function k7(j,q){return O7.generate(j,q)}var x7=["string","number","integer","boolean","null","object","array"];function h0(j,q,b){if(j.faker!==void 0&&j.chance!==void 0)throw Error(`ambiguous generator: both faker and chance are defined in ${q.path}`);if(j.faker!==void 0)try{let K=Q7(j.faker,q),P=r0(K,b??j.type,q.path);if(typeof P==="string"&&j.format)return o0(P,j.format,q);return P}catch{}if(j.chance!==void 0)try{let K=N7(j.chance,q),P=r0(K,b??j.type,q.path);if(typeof P==="string"&&j.format)return o0(P,j.format,q);return P}catch{}return}function o0(j,q,b){if(q==="date"){let K=typeof j==="string"?new Date(j):j;if(K instanceof Date&&!isNaN(K.getTime())){let P=K.getFullYear(),V=X(K.getMonth()+1),B=X(K.getDate());return`${P}-${V}-${B}`}if(typeof j==="string"){let P=Date.parse(j);if(!isNaN(P)){let V=new Date(P),B=V.getFullYear(),U=X(V.getMonth()+1),W=X(V.getDate());return`${B}-${U}-${W}`}}}if(q==="date-time"){let K=typeof j==="string"?new Date(j):j;if(K instanceof Date&&!isNaN(K.getTime()))return K.toISOString();if(typeof j==="string"&&Date.parse(j))return new Date(j).toISOString()}return j}function r0(j,q,b){if(q===void 0)return j;let K=Array.isArray(q)?q[0]:q;switch(K){case"string":return j===null?"null":j===void 0?"undefined":String(j);case"number":case"integer":let P=Number(j);return K==="integer"?Math.floor(P):P;case"boolean":return Boolean(j);case"null":return null;default:return j}}function Q7(j,q){if(!q.extensions?.faker){let B=typeof j==="string"?j:JSON.stringify(j);throw Error(`cannot resolve faker-generator for ${B} in ${q.path}`)}let b,K;if(typeof j==="object"&&j!==null){let B=j,U=Object.keys(B);if(U.length>0)b=U[0],K=B[b];else throw Error(`cannot resolve faker-generator for ${JSON.stringify(j)} in ${q.path}`)}else b=j;let P=b.split("."),V=q.extensions.faker;for(let B of P)try{V=V[B]}catch{throw Error(`failed to resolve .${B} (${b})`)}if(typeof V==="function")return K?V(...K):V();else throw Error(`cannot resolve faker-generator for ${b} in ${q.path}`)}function N7(j,q){if(!q.extensions?.chance){let b=typeof j==="string"?j:Object.keys(j)[0];throw Error(`cannot resolve chance-generator for ${b} in ${q.path}`)}if(typeof j==="string"){let b=q.extensions.chance[j];if(typeof b==="function")return b.call(q.extensions.chance);throw Error(`cannot resolve chance-generator for ${j} in ${q.path}`)}if(typeof j==="object"&&j!==null){let b=j,K=Object.keys(b)[0],P=b[K],V=q.extensions.chance[K];if(typeof V==="function")return P?V.call(q.extensions.chance,P):V.call(q.extensions.chance)}throw Error(`cannot resolve chance-generator in ${q.path}`)}function g7(j,q){let b=j.path==="/"?`/${q}`:`${j.path}/${q}`;return{...j,depth:j.depth+1,path:b,refDepthReached:j.refDepthReached}}async function _(j,q,b){if(!b.outputTransform)return j;return b.outputTransform(j,q,b.outputPath)}async function Q(j,q){if(j===!0)return Q({},q);if(j===!1)throw Error(`Cannot generate value for 'false' schema at ${q.path}`);if(q.propAliases&&typeof j==="object"&&j!==null){let V=j,B=null;for(let[U,W]of Object.entries(q.propAliases))if(U in V&&!(W in V)){if(!B)B={...V};B[W]=B[U],delete B[U]}if(B)j=B}let b;if(Array.isArray(j.type)){let V=j.type;b=q.random.pick(V);let B={...q,resolvedType:b},U=h0(j,B,b);if(U!==void 0){if(typeof U==="string"&&B.maxLength!==void 0&&U.length>B.maxLength)return _(U.slice(0,B.maxLength),j,B);return _(U,j,B)}}else{let V=h0(j,q,b);if(V!==void 0){if(typeof V==="string"&&q.maxLength!==void 0&&V.length>q.maxLength)return _(V.slice(0,q.maxLength),j,q);return _(V,j,q)}}let K=k7(j,q);if(K!==void 0)return _(K,j,q);if(j.$ref){let V=await P0(j,q);return Q(V.schema,g7(V.ctx,"$ref"))}if(j.allOf||j.anyOf||j.oneOf||j.not||j.if)return M7(j,q);if(j.const!==void 0)return _(u0(j,q),j,q);if(q.useDefaultValue&&j.default!==void 0)return _(j.default,j,q);if(j.enum!==void 0)return _(u0(j,q),j,q);if(q.useExamplesValue){if(Array.isArray(j.examples)&&j.examples.length>0)return _(q.random.pick(j.examples),j,q);if(j.example!==void 0)return _(j.example,j,q)}let P=R7(j,q);if(P===null){if(q.failOnInvalidTypes===!1){if(q.defaultInvalidTypeProduct!==void 0){let V=q.defaultInvalidTypeProduct;if(typeof V==="string")return T7(V,q);return V}return null}throw Error(`unknown primitive ${j.type} in ${q.path}/type`)}switch(P){case"null":return _(l6(q),j,q);case"boolean":return _(d6(q),j,q);case"number":return _(t0(j,q),j,q);case"integer":return _(o6(j,q),j,q);case"string":return _(s6(j,q),j,q);case"object":return _(await K7(j,q),j,q);case"array":return _(await W7(j,q),j,q);default:throw Error(`Unknown type: ${P} at ${q.path}`)}}function R7(j,q){if(q.resolvedType!==void 0)return q.resolvedType;if(typeof j.type==="string"){if(!["string","number","integer","boolean","null","object","array"].includes(j.type))return null;return j.type}if(Array.isArray(j.type))return q.random.pick(j.type);if(j.properties||j.required||j.additionalProperties!==void 0||j.patternProperties||j.minProperties!==void 0||j.maxProperties!==void 0)return"object";if(A7(j))return"object";if(j.items||j.prefixItems||j.contains||j.minItems!==void 0||j.maxItems!==void 0||j.uniqueItems)return"array";if(j.minimum!==void 0||j.maximum!==void 0||j.exclusiveMinimum!==void 0||j.exclusiveMaximum!==void 0||j.multipleOf!==void 0)return"number";if(j.minLength!==void 0||j.maxLength!==void 0||j.pattern||j.format||j.faker!==void 0||j.chance!==void 0)return"string";return q.random.pick(x7)}function A7(j){if(j.properties||j.type==="object"||j.type==="array")return!1;for(let q of Object.keys(j)){if(V0.has(q))continue;let b=j[q];if(typeof b==="object"&&b!==null&&!Array.isArray(b))return!0}return!1}function T7(j,q){switch(j){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"null":return null;case"object":return{};case"array":return[];default:return null}}function _7(j){let q=b6(j),b=K6(j);return`${q}T${b}`}function b6(j){let q=j.int(2000,2030),b=j.int(1,12),K=c6(q,b),P=j.int(1,K);return`${q}-${X(b)}-${X(P)}`}function K6(j){let q=j.int(0,23),b=j.int(0,59),K=j.int(0,59);return`${X(q)}:${X(b)}:${X(K)}Z`}var y7=["alice","bob","charlie","dave","eve","frank","grace","heidi"],H7=["example.com","test.org","demo.net","sample.io"];function i0(j){let q=j.pick(y7),b=j.int(1,999),K=j.pick(H7);return`${q}${b}@${K}`}var J7=["https"],E7=["example.com","test.org","demo.net"],S7=["api","v1","users","items","data","resource"];function K0(j){let q=j.pick(J7),b=j.pick(E7),K=j.int(1,3),P=[];for(let V=0;V<K;V++)P.push(j.pick(S7));return`${q}://${b}/${P.join("/")}`}var X7=["alpha","beta","gamma","delta","echo","fox","golf","hotel"],f7=["com","org","net","io","dev"];function m0(j){let q=j.int(1,3),b=[];for(let K=0;K<q;K++)b.push(j.pick(X7));return b.push(j.pick(f7)),b.join(".")}function Z7(j){return`${j.int(1,254)}.${j.int(0,255)}.${j.int(0,255)}.${j.int(1,254)}`}function v7(j){let q=[];for(let b=0;b<8;b++)q.push(j.int(0,65535).toString(16));return q.join(":")}function p7(j){let q=(b)=>{let K="";for(let P=0;P<b;P++)K+=j.int(0,15).toString(16);return K};return`${q(8)}-${q(4)}-4${q(3)}-${["8","9","a","b"][j.int(0,3)]}${q(3)}-${q(12)}`}var u7=["foo","bar","baz","items","0","1","2","name","value"];function G0(j){let q=j.int(1,4),b=[];for(let K=0;K<q;K++)b.push(j.pick(u7));return"/"+b.join("/")}function l7(j){let q=["P"],b=j.bool(),K=j.bool();if(b){if(j.bool())q.push(`${j.int(0,100)}Y`);if(j.bool())q.push(`${j.int(0,12)}M`);if(j.bool())q.push(`${j.int(0,30)}D`)}if(K){if(q.push("T"),j.bool())q.push(`${j.int(0,23)}H`);if(j.bool())q.push(`${j.int(0,59)}M`);if(j.bool())q.push(`${j.int(0,59)}S`)}if(q.length===1||q.length===2&&q[1]==="T")q.push("0D");return q.join("")}var d7=new Map([["date-time",_7],["date",b6],["time",K6],["duration",l7],["email",i0],["idn-email",i0],["uri",K0],["uri-reference",K0],["iri",K0],["iri-reference",K0],["hostname",m0],["idn-hostname",m0],["ipv4",Z7],["ipv6",v7],["uuid",p7],["json-pointer",G0],["relative-json-pointer",(j)=>`${j.int(0,5)}${G0(j)}`]]);function P6(j){let q=new Map(d7);if(j)for(let[b,K]of Object.entries(j))q.set(b,K);return q}function h7(j,q){if(!j.startsWith("$"))throw Error(`Invalid JSONPath: ${j} (must start with $)`);let b=j.slice(1).split(/\.|\[(\d+|\*)\]/).filter(Boolean),K=[q];for(let P of b){if(P==="")continue;let V=[];for(let B of K){if(B===null||B===void 0)continue;if(P==="*"){if(Array.isArray(B))V.push(...B)}else if(/^\d+$/.test(P)){let U=parseInt(P,10);if(Array.isArray(B)&&U<B.length)V.push(B[U])}else if(P==="")k0(B,V);else if(typeof B==="object"&&B!==null&&P in B)V.push(B[P])}K=V}return K}function k0(j,q){if(j===null||j===void 0)return;if(Array.isArray(j))for(let b of j)q.push(b),k0(b,q);else if(typeof j==="object")for(let b of Object.values(j))q.push(b),k0(b,q)}function o7(j){if(j.properties)return j.properties;if(j.type==="object"||j.type===void 0){let q={},b=!1;for(let[K,P]of Object.entries(j)){if(V0.has(K))continue;if(j6(P))q[K]=P,b=!0;else q[K]={const:P},b=!0}if(b)return q}return{}}async function x0(j,q,b,K){if(!b.resolveJsonPath)return j;let P=K??j;if(q===!0||q===!1)return j;if(q.$ref)return j;let V=q;if(V.allOf||V.anyOf||V.oneOf)return j;if(typeof j==="object"&&j!==null&&!Array.isArray(j)){let B={...j},U=o7(V);for(let[W,w]of Object.entries(U))if(W in B){let L=B[W];if(typeof w==="object"&&w!==null&&"jsonPath"in w&&typeof w.jsonPath==="string"){let I=h7(w.jsonPath,P);if(I.length>0)B[W]=b.random.pick(I)}else{let I=await x0(L,w,b,P);B[W]=I}}return B}if(Array.isArray(j)&&V.items){let B=[];for(let U of j){let W=await x0(U,V.items,b,P);B.push(W)}return B}return j}var r7=P6(),n0=new Set(["https://json-schema.org/draft/2020-12/schema","https://json-schema.org/draft/2019-09/schema"]);async function V6(j,q){if(q?.validateSchemaVersion===!0&&!q?.propAliases){if(typeof j==="object"&&j!==null&&"$schema"in j){let I=j.$schema;if(typeof I==="string"&&!n0.has(I))throw Error(`Unsupported JSON Schema version: ${I}. Supported versions: ${[...n0].join(", ")}`)}}let b=m7(q),K=c0(q?.seed??1),P=b.propAliases?i7(j,b.propAliases):j,V=F7(P);L7(P,V);let B=b.formats?P6(b.formats):new Map(r7),U=b.refDepthMin??b.refDepth,W=b.refDepthMax??b.refDepth;if(U!==void 0&&W!==void 0&&U>W)throw Error(`refDepthMin (${U}) cannot be greater than refDepthMax (${W})`);let w={random:K,maxDepth:b.maxDepth??(W?W+20:5),maxDefaultItems:b.maxDefaultItems??3,optionalsProbability:b.optionalsProbability??0.5,depth:0,refRegistry:V,refStack:new Set,formatRegistry:B,refResolver:b.refResolver,minItems:b.minItems,maxItems:b.maxItems,minLength:b.minLength,maxLength:b.maxLength,useDefaultValue:b.useDefaultValue,path:"/",outputPath:"/",alwaysFakeOptionals:b.alwaysFakeOptionals,fixedProbabilities:b.fixedProbabilities,fillProperties:b.fillProperties,extensions:b.extensions,resolveJsonPath:b.resolveJsonPath,autoIncrementCounters:new Map,refDepth:0,refDepthMin:U,refDepthMax:W,useExamplesValue:b.useExamplesValue,pruneProperties:b.pruneProperties,failOnInvalidTypes:b.failOnInvalidTypes,defaultInvalidTypeProduct:b.defaultInvalidTypeProduct,minDateTime:b.minDateTime,maxDateTime:b.maxDateTime,propAliases:b.propAliases,outputTransform:b.outputTransform},L=await Q(P,w);if(b.resolveJsonPath)return x0(L,j,w,L);return L}function i7(j,q){if(typeof j!=="object"||j===null)return j;let b=j,K=null;for(let[P,V]of Object.entries(q))if(P in b&&!(V in b)){if(!K)K={...b};K[V]=K[P],delete K[P]}return K??j}function m7(j){if(!j)return{};let q=j,b={...j};if(q.requiredOnly===!0&&b.optionalsProbability===void 0)b={...b,optionalsProbability:0,alwaysFakeOptionals:!1};if(q.ignoreProperties&&q.ignoreProperties.length>0)b={...b,outputTransform:G7(b.outputTransform,n7(q.ignoreProperties))};return b}function G7(j,q){if(!j)return q;if(!q)return j;return async(b,K,P)=>{let V=await j(b,K,P);return q(V,K,P)}}function n7(j){return(q,b,K)=>{if(K==="/")return q;let P=c7(K.slice(K.lastIndexOf("/")+1));return j.some((V)=>{if(typeof V==="string")return V===P;if(V instanceof RegExp)return V.test(P);return V(b)})?void 0:q}}function c7(j){return j.replace(/~1/g,"/").replace(/~0/g,"~")}import{ResourceLimitError as B0}from"@schmock/core";function $(j){let q=[{value:j,exiting:!1}],b=new Set,K=0;while(q.length>0){let P=q.pop();if(!P)break;let V=P.value;if(P.exiting){if(typeof V==="object"&&V!==null)b.delete(V);continue}if(K+=1,K>m)throw new B0("generated_nodes",m,K);if(typeof V==="string"){if(V.length>Z)throw new B0("string_length",Z,V.length);continue}if(typeof V!=="object"||V===null||b.has(V))continue;if(b.add(V),q.push({value:V,exiting:!0}),Array.isArray(V)){if(V.length>E)throw new B0("array_size",E,V.length);for(let U=0;U<V.length;U+=1)q.push({value:V[U],exiting:!1});continue}let B=Object.entries(V);if(B.length>o)throw new B0("object_properties",o,B.length);for(let[,U]of B)q.push({value:U,exiting:!1})}}var a7=2147483647,e7=new Set(["$schema","$id","$ref","$defs","$anchor","$dynamicRef","$dynamicAnchor","$vocabulary","$comment","definitions","type","enum","const","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","autoIncrement","initialOffset","minLength","maxLength","pattern","format","contentEncoding","contentMediaType","contentSchema","items","prefixItems","additionalItems","contains","containsAll","minItems","maxItems","uniqueItems","minContains","maxContains","properties","required","additionalProperties","patternProperties","minProperties","maxProperties","propertyNames","dependencies","dependentRequired","dependentSchemas","allOf","anyOf","oneOf","not","if","then","else","default","examples","description","title","readOnly","writeOnly","deprecated","faker","chance","jsonPath","template","example"]);function N0(j,q){let b=new $7({locale:[s7,t7]});if(j!==void 0)b.seed(j);if(q!==void 0)b.setDefaultRefDate(q);return b}function Q0(j,q){if(j===null||typeof j!=="object")return j;if(q.has(j))return j;if(j instanceof Date)return new Date(j.getTime());let b=Object.getPrototypeOf(j),K=b===Object.prototype||b===null;if(!Array.isArray(j)&&!K)try{return structuredClone(j)}catch{return j}q.add(j);try{if(Array.isArray(j))return j.map((V)=>Q0(V,q));let P={};for(let[V,B]of Object.entries(j))Object.defineProperty(P,V,{value:Q0(B,q),writable:!0,enumerable:!0,configurable:!0});return P}finally{q.delete(j)}}function a(j){return Q0(j,new Set)}function G(j,q){if(j===null||typeof j!=="object")return j;let b=q.get(j);if(b!==void 0)return b;if(j instanceof Date){let V=new Date(j.getTime());return q.set(j,V),V}if(j instanceof RegExp){let V=new RegExp(j.source,j.flags);return V.lastIndex=j.lastIndex,q.set(j,V),V}if(j instanceof Map){let V=new Map;q.set(j,V);for(let[B,U]of j)V.set(G(B,q),G(U,q));return V}if(j instanceof Set){let V=new Set;q.set(j,V);for(let B of j)V.add(G(B,q));return V}if(j instanceof ArrayBuffer){let V=j.slice(0);return q.set(j,V),V}if(ArrayBuffer.isView(j)){let V=structuredClone(j);return q.set(j,V),V}if(j instanceof URL){let V=new URL(j.href);return q.set(j,V),V}if(Array.isArray(j)){let V=Array(j.length);q.set(j,V);for(let B=0;B<j.length;B+=1)if(Object.hasOwn(j,B))V[B]=G(j[B],q);return V}let K=Object.getPrototypeOf(j);if(K!==Object.prototype&&K!==null)return j;let P=Object.create(K);q.set(j,P);for(let[V,B]of Object.entries(j))Object.defineProperty(P,V,{value:G(B,q),writable:!0,enumerable:!0,configurable:!0});return P}function B6(j){let q=new Map;return j.map((b)=>G(b,q))}function U6(j){return j??Math.floor(Math.random()*a7)}function W6(j){let q=j;return()=>{q+=1831565813;let b=q;return b=Math.imul(b^b>>>15,b|1),b^=b+Math.imul(b^b>>>7,b|61),((b^b>>>14)>>>0)/4294967296}}function l(j,q){return typeof j==="boolean"?j:g0(j,q)}function U0(j,q){if(typeof j==="boolean")return j;return j4(j)?g0(j,q):void 0}function j4(j){return j!==null&&typeof j==="object"&&!Array.isArray(j)}function W0(j,q){return Object.fromEntries(Object.entries(j).map(([b,K])=>[b,l(K,q)]))}function q4(j){return g0(j,new Map)}function g0(j,q){let b=q.get(j);if(b)return b;let K={};q.set(j,K);for(let[W,w]of Object.entries(j))if(e7.has(W))K[W]=w;if(j.properties)K.properties=W0(j.properties,q);if(j.definitions)K.definitions=W0(j.definitions,q);if(j.$defs)K.$defs=W0(j.$defs,q);if(j.patternProperties)K.patternProperties=W0(j.patternProperties,q);if(Array.isArray(j.items))K.prefixItems=j.items.map((W)=>l(W,q)),K.items=j.additionalItems===void 0?!0:l(j.additionalItems,q),delete K.additionalItems;else if(j.items!==void 0){if(K.items=l(j.items,q),j.additionalItems!==void 0)K.additionalItems=l(j.additionalItems,q)}let P=Reflect.get(j,"prefixItems");if(!Array.isArray(j.items)&&Array.isArray(P))K.prefixItems=P.flatMap((W)=>{let w=U0(W,q);return w===void 0?[]:[w]});for(let W of["allOf","anyOf","oneOf"]){let w=j[W];if(w)K[W]=w.map((L)=>l(L,q))}if(j.additionalProperties!==void 0)K.additionalProperties=l(j.additionalProperties,q);for(let W of["contains","not","if","then","else","propertyNames"]){let w=j[W];if(w!==void 0)K[W]=l(w,q)}if(j.dependencies)K.dependencies=Object.fromEntries(Object.entries(j.dependencies).map(([W,w])=>[W,Array.isArray(w)?[...w]:l(w,q)]));let V=U0(Reflect.get(j,"contentSchema"),q);if(V!==void 0)K.contentSchema=V;let B=Reflect.get(j,"dependentSchemas");if(B!==null&&typeof B==="object"&&!Array.isArray(B))K.dependentSchemas=Object.fromEntries(Object.entries(B).flatMap(([W,w])=>{let L=U0(w,q);return L===void 0?[]:[[W,L]]}));let U=Reflect.get(j,"containsAll");if(Array.isArray(U))K.containsAll=U.flatMap((W)=>{let w=U0(W,q);return w===void 0?[]:[w]});return K}async function w6(j,q,b){let K={seed:q,maxDepth:f0,optionalsProbability:1,alwaysFakeOptionals:!0,useDefaultValue:!0,failOnInvalidTypes:!1,formats:{},extensions:{faker:N0(q,b)}},P=await V6(q4(j),K);return $(P),a(P)}var R0=new Set(["__proto__","constructor","prototype"]);function e(j){return typeof j==="object"&&j!==null&&!Array.isArray(j)}function F6(j,q,b=Math.random){if(q!==void 0&&!Number.isNaN(q)){if(q<0)return 0;return Math.floor(q)}if(j.minItems!==void 0&&j.maxItems!==void 0){let K=j.minItems,P=Math.max(K,j.maxItems);return Math.floor(b()*(P-K+1))+K}if(j.minItems!==void 0)return Math.max(j.minItems,i);if(j.maxItems!==void 0)return Math.min(j.maxItems,i);if(Array.isArray(j.items))return j.items.length;return i}function j0(j,q,b,K,P){if(!q)return j;if(!e(j))return j;let V=structuredClone(j);for(let[B,U]of Object.entries(q)){if(R0.has(B))continue;if(B.includes("."))b4(V,B,U,{params:b,state:K,query:P});else if(e(U))if(e(V[B]))V[B]=j0(V[B],U,b,K,P);else V[B]=j0({},U,b,K,P);else if(typeof U==="string"&&U.includes("{{"))V[B]=L6(U,{params:b,state:K,query:P});else V[B]=a(U)}return V}function b4(j,q,b,K){let P=q.split("."),V=j;for(let U=0;U<P.length-1;U++){let W=P[U];if(R0.has(W))return;let w=V[W];if(e(w))V=w;else{let L={};V[W]=L,V=L}}let B=P[P.length-1];if(R0.has(B))return;if(typeof b==="string"&&b.includes("{{"))V[B]=L6(b,K);else V[B]=a(b)}function I6(j,q){let b=q.trim().split("."),K=j;for(let P of b)if(e(K))K=K[P];else return;return K}function L6(j,q){let b=j.match(/^\{\{\s*([^}]+)\s*\}\}$/);if(b){let K=I6(q,b[1]);return K!==void 0?a(K):j}return j.replace(/\{\{\s*([^}]+)\s*\}\}/g,(K,P)=>{let V=I6(q,P);return V!==void 0?String(V):K})}var K4=[{keywords:["email"],fakerMethod:"internet.email",schemaType:"string",minScore:0.6,format:"email"},{keywords:["username","user_name","login","handle"],fakerMethod:"internet.username",schemaType:"string",minScore:0.6},{keywords:["password","passwd","secret"],fakerMethod:"internet.password",schemaType:"string",minScore:0.6},{keywords:["token","api_key","apikey","access_token","refresh_token"],fakerMethod:"string.alphanumeric",schemaType:"string",minScore:0.8}],P4=[{keywords:["first_name","firstname","given_name","forename"],fakerMethod:"person.firstName",schemaType:"string",minScore:0.6},{keywords:["last_name","lastname","surname","family_name"],fakerMethod:"person.lastName",schemaType:"string",minScore:0.6},{keywords:["full_name","fullname","display_name","displayname","full_name"],fakerMethod:"person.fullName",schemaType:"string",minScore:0.6},{keywords:["name"],fakerMethod:"person.fullName",schemaType:"string",minScore:0.6},{keywords:["middle_name","middlename"],fakerMethod:"person.middleName",schemaType:"string",minScore:0.8},{keywords:["prefix","honorific","salutation"],fakerMethod:"person.prefix",schemaType:"string",minScore:0.8},{keywords:["suffix"],fakerMethod:"person.suffix",schemaType:"string",minScore:0.9},{keywords:["gender","sex"],fakerMethod:"person.sex",schemaType:"string",minScore:0.8},{keywords:["bio","biography"],fakerMethod:"lorem.paragraph",schemaType:"string",minScore:0.8},{keywords:["job_title","jobtitle","position","occupation","job","role"],fakerMethod:"person.jobTitle",schemaType:"string",minScore:0.6},{keywords:["job_area","department","division","team"],fakerMethod:"person.jobArea",schemaType:"string",minScore:0.8},{keywords:["zodiac","zodiac_sign"],fakerMethod:"person.zodiacSign",schemaType:"string",minScore:0.9}],V4=[{keywords:["phone","mobile","cell","tel","telephone","cellphone","fax"],fakerMethod:"phone.number",schemaType:"string",minScore:0.6},{keywords:["imei"],fakerMethod:"phone.imei",schemaType:"string",minScore:0.9}],B4=[{keywords:["street","street_address"],fakerMethod:"location.streetAddress",schemaType:"string",minScore:0.6},{keywords:["address","mailing_address","postal_address"],fakerMethod:"location.streetAddress",schemaType:"string",minScore:0.6},{keywords:["city","town"],fakerMethod:"location.city",schemaType:"string",minScore:0.6},{keywords:["state","province","region"],fakerMethod:"location.state",schemaType:"string",minScore:0.8},{keywords:["country"],fakerMethod:"location.country",schemaType:"string",minScore:0.8},{keywords:["country_code","countrycode"],fakerMethod:"location.countryCode",schemaType:"string",minScore:0.8},{keywords:["county"],fakerMethod:"location.county",schemaType:"string",minScore:0.9},{keywords:["continent"],fakerMethod:"location.continent",schemaType:"string",minScore:0.9},{keywords:["zip","zipcode","zip_code","postal","postal_code"],fakerMethod:"location.zipCode",schemaType:"string",minScore:0.6},{keywords:["latitude","lat"],fakerMethod:"location.latitude",schemaType:"number",minScore:0.6},{keywords:["longitude","lng","lon","long"],fakerMethod:"location.longitude",schemaType:"number",minScore:0.6},{keywords:["timezone","time_zone","tz"],fakerMethod:"location.timeZone",schemaType:"string",minScore:0.8},{keywords:["building_number"],fakerMethod:"location.buildingNumber",schemaType:"string",minScore:0.9}],U4=[{keywords:["url","website","link","href","homepage","webpage"],fakerMethod:"internet.url",schemaType:"string",minScore:0.6},{keywords:["avatar","photo_url","profile_image","image_url","picture","thumbnail","icon"],fakerMethod:"image.avatar",schemaType:"string",minScore:0.6},{keywords:["domain","hostname","domain_name"],fakerMethod:"internet.domainName",schemaType:"string",minScore:0.8},{keywords:["ip","ip_address","ipaddress","ipv4"],fakerMethod:"internet.ipv4",schemaType:"string",minScore:0.8},{keywords:["ipv6"],fakerMethod:"internet.ipv6",schemaType:"string",minScore:0.9},{keywords:["mac","mac_address"],fakerMethod:"internet.mac",schemaType:"string",minScore:0.9},{keywords:["user_agent","useragent"],fakerMethod:"internet.userAgent",schemaType:"string",minScore:0.9},{keywords:["port"],fakerMethod:"internet.port",schemaType:"number",minScore:0.9},{keywords:["protocol"],fakerMethod:"internet.protocol",schemaType:"string",minScore:0.9}],W4=[{keywords:["uuid","guid"],fakerMethod:"string.uuid",schemaType:"string",minScore:0.6},{keywords:["sku"],fakerMethod:"string.alphanumeric",schemaType:"string",minScore:0.9},{keywords:["slug"],fakerMethod:"lorem.slug",schemaType:"string",minScore:0.8},{keywords:["isbn"],fakerMethod:"commerce.isbn",schemaType:"string",minScore:0.9},{keywords:["vin"],fakerMethod:"vehicle.vin",schemaType:"string",minScore:0.9},{keywords:["iban"],fakerMethod:"finance.iban",schemaType:"string",minScore:0.9},{keywords:["bic","swift"],fakerMethod:"finance.bic",schemaType:"string",minScore:0.9},{keywords:["ssn","social_security"],fakerMethod:"string.numeric",schemaType:"string",minScore:0.9}],w4=[{keywords:["description","desc","summary","overview","about","excerpt"],fakerMethod:"lorem.paragraph",schemaType:"string",minScore:0.6},{keywords:["content","body","text","message"],fakerMethod:"lorem.paragraphs",schemaType:"string",minScore:0.6},{keywords:["title","heading","subject","headline"],fakerMethod:"lorem.sentence",schemaType:"string",minScore:0.6},{keywords:["tag","label","category","keyword"],fakerMethod:"lorem.word",schemaType:"string",minScore:0.8},{keywords:["comment","note","remark","feedback","review"],fakerMethod:"lorem.sentence",schemaType:"string",minScore:0.8},{keywords:["sentence"],fakerMethod:"lorem.sentence",schemaType:"string",minScore:0.9},{keywords:["paragraph"],fakerMethod:"lorem.paragraph",schemaType:"string",minScore:0.9},{keywords:["word"],fakerMethod:"lorem.word",schemaType:"string",minScore:0.9}],I4=[{keywords:["company","organization","org","employer","brand","operator"],fakerMethod:"company.name",schemaType:"string",minScore:0.6},{keywords:["product","product_name","item_name"],fakerMethod:"commerce.productName",schemaType:"string",minScore:0.8},{keywords:["price","amount","cost","fee","salary","wage","total","subtotal","balance","revenue","income"],fakerMethod:"commerce.price",minScore:0.6},{keywords:["currency","currency_code"],fakerMethod:"finance.currencyCode",schemaType:"string",minScore:0.8},{keywords:["currency_name"],fakerMethod:"finance.currencyName",schemaType:"string",minScore:0.8},{keywords:["currency_symbol"],fakerMethod:"finance.currencySymbol",schemaType:"string",minScore:0.8},{keywords:["account_number","account_no"],fakerMethod:"finance.accountNumber",schemaType:"string",minScore:0.8},{keywords:["credit_card","card_number"],fakerMethod:"finance.creditCardNumber",schemaType:"string",minScore:0.8},{keywords:["cvv"],fakerMethod:"finance.creditCardCVV",schemaType:"string",minScore:0.9},{keywords:["transaction_type"],fakerMethod:"finance.transactionType",schemaType:"string",minScore:0.9}],F4=[{keywords:["created_at","createdat","creation_date","date_created","createddate"],fakerMethod:"date.recent",schemaType:"string",minScore:0.6,format:"date-time"},{keywords:["updated_at","updatedat","modified_at","modifiedat","date_updated","last_modified","date_modified"],fakerMethod:"date.recent",schemaType:"string",minScore:0.6,format:"date-time"},{keywords:["deleted_at","deletedat"],fakerMethod:"date.recent",schemaType:"string",minScore:0.6,format:"date-time"},{keywords:["published_at","publishedat","publish_date"],fakerMethod:"date.recent",schemaType:"string",minScore:0.6,format:"date-time"},{keywords:["expires_at","expiresat","expiration","expiry"],fakerMethod:"date.future",schemaType:"string",minScore:0.6,format:"date-time"},{keywords:["birthday","date_of_birth","dob","birthdate","born"],fakerMethod:"date.birthdate",schemaType:"string",minScore:0.8},{keywords:["start_date","begin_date"],fakerMethod:"date.past",schemaType:"string",minScore:0.8},{keywords:["end_date","due_date","deadline"],fakerMethod:"date.future",schemaType:"string",minScore:0.8},{keywords:["timestamp","ts"],fakerMethod:"date.recent",schemaType:"string",minScore:0.8}],L4=[{keywords:["color","colour"],fakerMethod:"color.human",schemaType:"string",minScore:0.8},{keywords:["hex_color","hexcolor"],fakerMethod:"color.rgb",schemaType:"string",minScore:0.9}],C4=[{keywords:["age"],fakerMethod:"number.int",schemaType:"number",minScore:0.8,fakerArgs:{min:18,max:80}},{keywords:["rating","score","stars"],fakerMethod:"number.int",schemaType:"number",minScore:0.8,fakerArgs:{min:1,max:5}},{keywords:["count","quantity","qty"],fakerMethod:"number.int",schemaType:"number",minScore:0.8,fakerArgs:{min:1,max:100}},{keywords:["percentage","percent"],fakerMethod:"number.int",schemaType:"number",minScore:0.8,fakerArgs:{min:0,max:100}},{keywords:["weight"],fakerMethod:"number.float",schemaType:"number",minScore:0.8,fakerArgs:{min:0.1,max:200}},{keywords:["height"],fakerMethod:"number.int",schemaType:"number",minScore:0.8,fakerArgs:{min:100,max:220}},{keywords:["width","length","depth"],fakerMethod:"number.int",schemaType:"number",minScore:0.8,fakerArgs:{min:1,max:1000}},{keywords:["priority","order","rank","level"],fakerMethod:"number.int",schemaType:"number",minScore:0.8,fakerArgs:{min:1,max:10}},{keywords:["version"],fakerMethod:"system.semver",schemaType:"string",minScore:0.8}],Y4=[{keywords:["is_active","isactive","active","enabled","is_enabled"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.9},{keywords:["is_deleted","isdeleted","deleted"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.05},{keywords:["is_archived","isarchived","archived"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.1},{keywords:["is_verified","isverified","verified","confirmed","is_confirmed"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.8},{keywords:["is_admin","isadmin","admin"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.1},{keywords:["is_public","ispublic","public","visible","is_visible"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.7},{keywords:["is_read","isread","read","seen","is_seen"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.6},{keywords:["is_default","isdefault"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.8,trueProbability:0.1},{keywords:["is_required","isrequired","required","mandatory"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.6,trueProbability:0.5},{keywords:["is_featured","isfeatured","featured","promoted"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.8,trueProbability:0.15},{keywords:["available","in_stock"],fakerMethod:"datatype.boolean",schemaType:"boolean",minScore:0.8,trueProbability:0.85}],M4=[{keywords:["filename","file_name"],fakerMethod:"system.fileName",schemaType:"string",minScore:0.8},{keywords:["file_type","filetype","mime_type","mimetype","content_type"],fakerMethod:"system.mimeType",schemaType:"string",minScore:0.8},{keywords:["file_ext","extension"],fakerMethod:"system.fileExt",schemaType:"string",minScore:0.9},{keywords:["file_path","filepath","path"],fakerMethod:"system.filePath",schemaType:"string",minScore:0.9},{keywords:["cron","cron_expression"],fakerMethod:"system.cron",schemaType:"string",minScore:0.9},{keywords:["semver"],fakerMethod:"system.semver",schemaType:"string",minScore:0.9}],D4=[{keywords:["aircraft_type","airplane","aircraft"],fakerMethod:"airline.aircraftType",schemaType:"string",minScore:0.9},{keywords:["flight_number","flight"],fakerMethod:"airline.flightNumber",schemaType:"string",minScore:0.9},{keywords:["record_locator","booking_ref","pnr"],fakerMethod:"airline.recordLocator",schemaType:"string",minScore:0.9},{keywords:["seat","seat_number"],fakerMethod:"airline.seat",schemaType:"string",minScore:0.9}],z4=[{keywords:["animal","animal_type","species"],fakerMethod:"animal.type",schemaType:"string",minScore:0.9},{keywords:["pet_name"],fakerMethod:"animal.petName",schemaType:"string",minScore:0.9},{keywords:["breed"],fakerMethod:"animal.dog",schemaType:"string",minScore:0.9},{keywords:["bird"],fakerMethod:"animal.bird",schemaType:"string",minScore:0.9},{keywords:["fish"],fakerMethod:"animal.fish",schemaType:"string",minScore:0.9},{keywords:["horse"],fakerMethod:"animal.horse",schemaType:"string",minScore:0.9},{keywords:["insect"],fakerMethod:"animal.insect",schemaType:"string",minScore:0.9}],O4=[{keywords:["book_title"],fakerMethod:"book.title",schemaType:"string",minScore:0.9},{keywords:["author","book_author","writer"],fakerMethod:"book.author",schemaType:"string",minScore:0.9},{keywords:["genre","book_genre"],fakerMethod:"book.genre",schemaType:"string",minScore:0.9},{keywords:["publisher","publishing_house"],fakerMethod:"book.publisher",schemaType:"string",minScore:0.9},{keywords:["book_series","series_name"],fakerMethod:"book.series",schemaType:"string",minScore:0.9}],k4=[{keywords:["dish","meal","recipe_name"],fakerMethod:"food.dish",schemaType:"string",minScore:0.9},{keywords:["ingredient"],fakerMethod:"food.ingredient",schemaType:"string",minScore:0.9},{keywords:["spice"],fakerMethod:"food.spice",schemaType:"string",minScore:0.9},{keywords:["fruit"],fakerMethod:"food.fruit",schemaType:"string",minScore:0.9},{keywords:["vegetable"],fakerMethod:"food.vegetable",schemaType:"string",minScore:0.9},{keywords:["meat"],fakerMethod:"food.meat",schemaType:"string",minScore:0.9},{keywords:["food_description"],fakerMethod:"food.description",schemaType:"string",minScore:0.9},{keywords:["ethnic_category","cuisine"],fakerMethod:"food.ethnicCategory",schemaType:"string",minScore:0.9}],x4=[{keywords:["song","song_name","track","track_name"],fakerMethod:"music.songName",schemaType:"string",minScore:0.9},{keywords:["album","album_name"],fakerMethod:"music.album",schemaType:"string",minScore:0.9},{keywords:["artist","musician","band"],fakerMethod:"music.artist",schemaType:"string",minScore:0.9},{keywords:["music_genre"],fakerMethod:"music.genre",schemaType:"string",minScore:0.9}],Q4=[],N4=[{keywords:["vehicle","vehicle_name"],fakerMethod:"vehicle.vehicle",schemaType:"string",minScore:0.9},{keywords:["vehicle_type"],fakerMethod:"vehicle.type",schemaType:"string",minScore:0.9},{keywords:["vehicle_manufacturer","car_make"],fakerMethod:"vehicle.manufacturer",schemaType:"string",minScore:0.9},{keywords:["vehicle_model","car_model"],fakerMethod:"vehicle.model",schemaType:"string",minScore:0.9},{keywords:["fuel","fuel_type"],fakerMethod:"vehicle.fuel",schemaType:"string",minScore:0.9},{keywords:["bicycle"],fakerMethod:"vehicle.bicycle",schemaType:"string",minScore:0.9},{keywords:["vehicle_color","car_color"],fakerMethod:"vehicle.color",schemaType:"string",minScore:0.9}],g4=[{keywords:["branch","branch_name","git_branch"],fakerMethod:"git.branch",schemaType:"string",minScore:0.9},{keywords:["commit_sha","commit_hash","sha"],fakerMethod:"git.commitSha",schemaType:"string",minScore:0.9},{keywords:["commit_message"],fakerMethod:"git.commitMessage",schemaType:"string",minScore:0.9}],R4=[{keywords:["db_column","column_name"],fakerMethod:"database.column",schemaType:"string",minScore:0.9},{keywords:["db_type","column_type"],fakerMethod:"database.type",schemaType:"string",minScore:0.9},{keywords:["db_engine","database_engine"],fakerMethod:"database.engine",schemaType:"string",minScore:0.9},{keywords:["collation"],fakerMethod:"database.collation",schemaType:"string",minScore:0.9},{keywords:["mongodb_id","object_id"],fakerMethod:"database.mongodbObjectId",schemaType:"string",minScore:0.9}],A4=[{keywords:["abbreviation","tech_abbreviation"],fakerMethod:"hacker.abbreviation",schemaType:"string",minScore:0.9},{keywords:["hacker_phrase","tech_phrase"],fakerMethod:"hacker.phrase",schemaType:"string",minScore:0.9}],T4=[{keywords:["adjective"],fakerMethod:"word.adjective",schemaType:"string",minScore:0.8},{keywords:["adverb"],fakerMethod:"word.adverb",schemaType:"string",minScore:0.8},{keywords:["noun"],fakerMethod:"word.noun",schemaType:"string",minScore:0.8},{keywords:["verb"],fakerMethod:"word.verb",schemaType:"string",minScore:0.8}],C6=[...K4,...P4,...V4,...B4,...U4,...W4,...w4,...I4,...F4,...L4,...C4,...Y4,...M4,...D4,...z4,...O4,...k4,...x4,...Q4,...N4,...g4,...R4,...A4,...T4];var _4=new Set(["date-time","date","time","duration","email","idn-email","hostname","idn-hostname","ipv4","ipv6","uri","uri-reference","iri","iri-reference","json-pointer","relative-json-pointer","uuid"]);function y4(j){return typeof j==="string"&&_4.has(j)}function M6(j){let q=j.split(/[_-]/),b=[];for(let K of q){if(!K)continue;let P=K.replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z0-9])([A-Z])/g,"$1_$2").split("_");for(let V of P)if(V)b.push(V.toLowerCase())}return b}function H4(j){let q=M6(j);return{tokens:q,joined:q.join("")}}var Y6=new WeakMap;function J4(j){let q=Y6.get(j);if(!q)q=j.keywords.map(H4),Y6.set(j,q);return q}function E4(j,q,b){let K=0;for(let{tokens:P,joined:V}of b){if(q===V)return 1;if(P.length>0&&P.every((B)=>j.includes(B))){let U=P.length/j.length>0.5?0.9:0.65;K=Math.max(K,U)}if(P.length>0&&P.length<=j.length){if(j.slice(-P.length).every((U,W)=>U===P[W]))K=Math.max(K,0.8)}if(V.length>=3&&q.includes(V))K=Math.max(K,0.7)}return K}function D6(j,q,b=C6){let K=typeof q.type==="string"?q.type:void 0;if(K==="string"&&q.format==="uuid")return{mapping:{keywords:["uuid"],fakerMethod:"string.uuid",schemaType:"string",minScore:0.5},score:1};if(q.pattern||q.enum||"faker"in q&&q.faker||q.$ref||y4(q.format)||K==="string"&&(q.minLength!==void 0||q.maxLength!==void 0))return;let P=q.minimum!==void 0||q.maximum!==void 0||q.exclusiveMinimum!==void 0||q.exclusiveMaximum!==void 0||q.multipleOf!==void 0,V=K==="number"||K==="integer",B=M6(j),U=B.join(""),W;for(let w of b){if(P&&(V||w.schemaType==="number"||w.schemaType==="integer"))continue;if(K==="object"||K==="array")continue;if(w.schemaType&&K&&w.schemaType!==K){if(!(w.schemaType==="number"&&K==="integer"||w.schemaType==="integer"&&K==="number"))continue}let L=E4(B,U,J4(w));if(L>=w.minScore&&(!W||L>W.score))W={mapping:w,score:L}}if(K==="string"){if(B[B.length-1]==="id"&&B.length>1){if(!W||W.score<0.8)W={mapping:{keywords:["id"],fakerMethod:"string.uuid",schemaType:"string",minScore:0.5},score:0.8}}}return W}import{ResourceLimitError as r,SchemaValidationError as H}from"@schmock/core";function S4(j){return typeof j==="object"&&j!==null&&!Array.isArray(j)}function z6(j){return typeof j==="object"&&j!==null&&!Array.isArray(j)}function O6(j,q){let b=[],K=(W,w,L,I,C=!1)=>{if(S4(W))b.push({schema:W,path:w,depthCost:L,frameCost:I,typedContinuation:C})},P=(W)=>j.type===W||Array.isArray(j.type)&&j.type.includes(W);if(Array.isArray(j.items))j.items.forEach((W,w)=>{K(W,`${q}.items[${w}]`,1,0,P("array"))});else K(j.items,`${q}.items`,1,0,P("array"));let V=Reflect.get(j,"prefixItems");if(Array.isArray(V))V.forEach((W,w)=>{K(W,`${q}.prefixItems[${w}]`,1,0,P("array"))});K(j.additionalItems,`${q}.additionalItems`,1,0),K(j.contains,`${q}.contains`,1,0);let B=Reflect.get(j,"containsAll");if(Array.isArray(B))B.forEach((W,w)=>{K(W,`${q}.containsAll[${w}]`,1,0)});for(let[W,w]of[["properties",j.properties],["patternProperties",j.patternProperties]]){if(!w)continue;for(let[L,I]of Object.entries(w))K(I,`${q}.${W}.${L}`,1,0,W==="properties"&&P("object"))}K(j.additionalProperties,`${q}.additionalProperties`,1,0),K(j.propertyNames,`${q}.propertyNames`,1,0);for(let W of["allOf","anyOf","oneOf"])j[W]?.forEach((w,L)=>{K(w,`${q}.${W}[${L}]`,0,1)});for(let W of["not","if","then","else"])K(j[W],`${q}.${W}`,0,1);for(let W of["definitions","$defs"]){let w=Reflect.get(j,W);if(!z6(w))continue;for(let[L,I]of Object.entries(w))K(I,`${q}.${W}.${L}`,0,1)}if(j.dependencies){for(let[W,w]of Object.entries(j.dependencies))if(!Array.isArray(w))K(w,`${q}.dependencies.${W}`,0,1)}let U=Reflect.get(j,"dependentSchemas");if(z6(U))for(let[W,w]of Object.entries(U))K(w,`${q}.dependentSchemas.${W}`,0,1);return K(Reflect.get(j,"contentSchema"),`${q}.contentSchema`,0,1),b}var A0,k6=200;function A(j){return typeof j==="object"&&j!==null&&!Array.isArray(j)}function b0(j,q){return j.type===q||Array.isArray(j.type)&&j.type.includes(q)}var q0={height:0,nodes:1};function H0(j,q="$",b){if(!j||typeof j!=="object")throw new H(q,"Schema must be a valid JSON Schema object");let K={visited:0,circular:!1,edges:new Map,postOrder:[],resolveRef:Z4(j)};if(X4(j,q,K),K.circular)throw new H(q,"Schema contains circular references which are not supported");let P=m4(b),V=l4(j,K,P),B=V.get(j)??q0,{maxDepth:U,maxFrames:W}=h4(j,K,P);if(U>C0)throw new r("schema_nesting_depth",C0,U);if(W>k6)K.composition??={resource:"schema_composition_depth",limit:k6,actual:W};for(let[w,L]of V)$4(w,L.height,K,w===j?P:void 0);for(let w of[K.composition,K.deepArray,K.arraySize,K.objectSize,K.stringLength,K.memory])if(w)throw new r(w.resource,w.limit,w.actual);if(P!==void 0&&F0(j)&&P>E)throw new r("array_size",E,P);if(B.nodes>m)throw new r("generated_nodes",m,B.nodes)}function X4(j,q,b){let K=new Set,P=new Set,V=[{schema:j,path:q,typedChain:!0,exiting:!1}];while(V.length>0){let B=V.pop();if(!B)break;if(B.exiting){K.delete(B.schema),P.add(B.schema),b.postOrder.push(B.schema);continue}if(P.has(B.schema)){if(B.typedChain)N6(B.schema,B.path,!0);continue}if(K.has(B.schema)){b.circular=!0;continue}if(b.visited+=1,b.visited>Y0)throw new r("schema_nodes",Y0,b.visited);N6(B.schema,B.path,B.typedChain),G4(B.schema,b),n4(B.schema,b),c4(B.schema,b);let U=f4(B.schema,B.path,b.resolveRef);b.edges.set(B.schema,U),K.add(B.schema),V.push({...B,exiting:!0});for(let W=U.length-1;W>=0;W-=1){let w=U[W];if(K.has(w.schema))b.circular=!0;else if(!P.has(w.schema))V.push({schema:w.schema,path:w.path,typedChain:B.typedChain&&w.typedContinuation,exiting:!1})}}}function f4(j,q,b){let K=A6(j,q);for(let P of["$ref","$dynamicRef"]){let V=Reflect.get(j,P);if(typeof V!=="string")continue;let B=b(j,V);if(A(B))K.unshift({schema:B,path:`${q}.${P}`,depthCost:0,frameCost:1,typedContinuation:!1})}return K}function A6(j,q){return O6(j,q)}var x6="schmock://local/root.json";function Z4(j){let q=v4(j),b=new Map;return(K,P)=>{let V=b.get(K);if(!V)V=new Map,b.set(K,V);let B=V.get(P);if(B!==void 0)return B===null?void 0:B;let U=q.scopes.get(K)??q.rootScope,W=u4(P,U,q.resources);return V.set(P,W??null),W}}function v4(j){let q=new Map,b=new Map,K={baseUri:x6,resourceRoot:j};q.set(x6,j);let P=[{schema:j,inheritedScope:K,path:"$"}];while(P.length>0){let V=P.pop();if(!V||b.has(V.schema))continue;let B=p4(V.schema,V.inheritedScope,q,V.path);b.set(V.schema,B);for(let U of A6(V.schema,V.path))P.push({schema:U.schema,inheritedScope:B,path:U.path})}return{resources:q,scopes:b,rootScope:b.get(j)??K}}function p4(j,q,b,K){let P=q;if(typeof j.$id==="string"){let V=T6(j.$id,q.baseUri);if(V)if(T0(b,V,j,K),_6(V)===""){let B=y0(V);T0(b,B,j,K),P={baseUri:B,resourceRoot:j}}else P={...q,baseUri:V}}for(let V of["$anchor","$dynamicAnchor"]){let B=Reflect.get(j,V);if(typeof B==="string"&&B.length>0)T0(b,`${y0(P.baseUri)}#${B}`,j,`${K}.${V}`)}return P}function T0(j,q,b,K){let P=j.get(q);if(P!==void 0&&P!==b)throw new H(K,`Duplicate canonical schema identifier: "${q}"`,"Give each embedded resource and anchor a unique canonical identifier");j.set(q,b)}function u4(j,q,b){if(j==="#")return q.resourceRoot;if(j.startsWith("#/"))return Q6(q.resourceRoot,j.slice(1));let K=T6(j,q.baseUri);if(!K)return;let P=b.get(K);if(P!==void 0)return P;let V=b.get(y0(K));if(V===void 0)return;let B=_6(K);if(B==="")return V;return B.startsWith("/")?Q6(V,B):void 0}function T6(j,q){try{return new URL(j,q).href}catch{return}}function y0(j){let q=new URL(j);return q.hash="",q.href}function _6(j){return new URL(j).hash.slice(1)}function Q6(j,q){let b;try{b=decodeURIComponent(q)}catch{return}if(b==="")return j;if(!b.startsWith("/"))return;let K=j;for(let P of b.slice(1).split("/")){let V=P.replace(/~1/g,"/").replace(/~0/g,"~");if(typeof K!=="object"||K===null||!Object.hasOwn(K,V))return;K=Reflect.get(K,V)}return typeof K==="boolean"||A(K)?K:void 0}function l4(j,q,b){let K=new Map;for(let P of q.postOrder)K.set(P,d4(P,K,q.resolveRef,P===j?b:void 0));return K}function d4(j,q,b,K){let P=typeof j.$ref==="string"?j.$ref:Reflect.get(j,"$dynamicRef");if(typeof P==="string")return _0(b(j,P),q);let V=0,B=1,U=(I)=>{let C=_0(I,q);return V=Math.max(V,C.height+1),C},W=(I)=>{let C=_0(I,q);return V=Math.max(V,C.height),C};if(F0(j)){let I=K??J0(j),C=0;if(Array.isArray(j.items)){j.items.forEach((T,S)=>{let R=U(T);if(S<I)C=p(C+R.nodes)});let k=j.additionalItems===void 0?q0:U(j.additionalItems);C=p(C+Math.max(0,I-j.items.length)*k.nodes)}else if(j.items!==void 0)C=p(I*U(j.items).nodes);else C=I;if(j.contains!==void 0)U(j.contains);B=p(B+C)}if(H6(j)){let I=new Set(Object.keys(j.properties??{}));for(let R of Object.values(j.properties??{}))B=p(B+U(R).nodes);let C=q0;for(let R of Object.values(j.patternProperties??{})){let y=U(R);if(B=p(B+y.nodes),y.nodes>C.nodes)C=y}if(j.additionalProperties!==void 0){let R=U(j.additionalProperties);if(R.nodes>C.nodes)C=R}if(j.propertyNames!==void 0)U(j.propertyNames);let k=new Set((j.required??[]).filter((R)=>!I.has(R))).size,T=Math.max(0,(j.minProperties??0)-I.size),S=Math.max(k,T);B=p(B+S*C.nodes)}if(j.allOf)for(let I of j.allOf)B=p(B+Math.max(0,W(I).nodes-1));let w=0;for(let I of["anyOf","oneOf"])for(let C of j[I]??[])w=Math.max(w,W(C).nodes-1);if(B=p(B+Math.max(0,w)),j.if!==void 0)W(j.if);let L=0;for(let I of["then","else"])if(j[I]!==void 0)L=Math.max(L,W(j[I]).nodes-1);if(B=p(B+Math.max(0,L)),j.not!==void 0)W(j.not);return{height:V,nodes:B}}function _0(j,q){return A(j)?q.get(j)??q0:q0}function h4(j,q,b){let K=new Map([[j,0]]),P=new Map([[j,0]]),V=0,B=0;for(let U=q.postOrder.length-1;U>=0;U-=1){let W=q.postOrder[U],w=K.get(W),L=P.get(W);if(w===void 0||L===void 0)continue;V=Math.max(V,w),B=Math.max(B,L);let I=W===j&&b!==void 0?b:J0(W);if(F0(W)&&w>=n&&I>=c)q.deepArray??={resource:"deep_nesting_memory_risk",limit:n*c,actual:w*I};for(let C of q.edges.get(W)??[]){let k=w+C.depthCost,T=L+C.frameCost;if(k>(K.get(C.schema)??-1))K.set(C.schema,k);if(T>(P.get(C.schema)??-1))P.set(C.schema,T)}}return{maxDepth:V,maxFrames:B}}function N6(j,q,b){if(b&&Object.keys(j).length===0)throw new H(q,"Schema cannot be empty");let K=["object","array","string","number","integer","boolean","null"];if(j.type&&typeof j.type==="string"&&!K.includes(j.type))throw new H(q,`Invalid schema type: "${j.type}"`,"Supported types are: object, array, string, number, integer, boolean, null");if(j.properties!==void 0&&(typeof j.properties!=="object"||Array.isArray(j.properties)))throw new H(`${q}.properties`,"Properties must be an object mapping property names to schemas",'Use { "propertyName": { "type": "string" } } format');if(j.type==="array"){if(j.items===null||j.items===void 0)throw new H(`${q}.items`,"Array schema must have valid items definition","Define items as a schema object or array of schemas");if(Array.isArray(j.items)&&j.items.length===0)throw new H(`${q}.items`,"Array items cannot be empty array","Provide at least one item schema")}if("faker"in j&&j.faker!==void 0)try{o4(j.faker)}catch(P){if(P instanceof H){let V=P.context,B="Invalid faker method",U;if(V&&typeof V==="object"){if("issue"in V&&typeof V.issue==="string")B=V.issue;if("suggestion"in V&&typeof V.suggestion==="string")U=V.suggestion}throw new H(`${q}.faker`,B,U)}if(P instanceof Error)throw P;throw Error(String(P))}}function o4(j){if(typeof j==="string"){I0(j);return}if(typeof j!=="object"||j===null||Array.isArray(j))throw new H("$.faker","Faker must be a method string or an object with exactly one own method key",'Use "person.fullName" or { "number.int": [{ "min": 1, "max": 2 }] }');let q=Reflect.ownKeys(j),b=Object.keys(j);if(q.length!==1||b.length!==1||typeof q[0]!=="string"||q[0]!==b[0])throw new H("$.faker","Object-form faker must contain exactly one own method key",'Use { "number.int": [{ "min": 1, "max": 2 }] }');let K=b[0],P=Object.getOwnPropertyDescriptor(j,K);if(!P||!("value"in P)||!Array.isArray(P.value))throw new H("$.faker",`Arguments for faker method "${K}" must be an array`,'Wrap options in an array, for example [{ "min": 1, "max": 2 }]');I0(K),i4(K,P.value)}var g={resource:"string_length",limit:Z},w0={resource:"array_size",limit:E},r4={"string.fromCharacters":[{argumentIndex:1,direct:!0,...g}],"string.alpha":[{argumentIndex:0,direct:!0,property:"length",...g}],"string.alphanumeric":[{argumentIndex:0,direct:!0,property:"length",...g}],"string.binary":[{argumentIndex:0,direct:!1,property:"length",...g}],"string.octal":[{argumentIndex:0,direct:!1,property:"length",...g}],"string.hexadecimal":[{argumentIndex:0,direct:!1,property:"length",...g}],"string.numeric":[{argumentIndex:0,direct:!0,property:"length",...g}],"string.sample":[{argumentIndex:0,direct:!0,...g}],"string.nanoid":[{argumentIndex:0,direct:!0,...g}],"string.symbol":[{argumentIndex:0,direct:!0,...g}],"word.sample":[{argumentIndex:0,direct:!0,property:"length",...g}],"word.words":[{argumentIndex:0,direct:!0,property:"count",...g}],"lorem.word":[{argumentIndex:0,direct:!0,property:"length",...g}],"lorem.words":[{argumentIndex:0,direct:!0,...g}],"lorem.sentence":[{argumentIndex:0,direct:!0,...g}],"lorem.sentences":[{argumentIndex:0,direct:!0,...g}],"lorem.slug":[{argumentIndex:0,direct:!0,...g}],"lorem.lines":[{argumentIndex:0,direct:!0,...g}],"lorem.paragraph":[{argumentIndex:0,direct:!0,...g}],"lorem.paragraphs":[{argumentIndex:0,direct:!0,...g}],"lorem.text":[{argumentIndex:0,direct:!0,...g}],"internet.password":[{argumentIndex:0,direct:!1,property:"length",...g}],"helpers.uniqueArray":[{argumentIndex:1,direct:!0,...w0}],"helpers.arrayElements":[{argumentIndex:1,direct:!0,...w0}],"helpers.multiple":[{argumentIndex:1,direct:!1,property:"count",...w0}],"date.betweens":[{argumentIndex:0,direct:!1,property:"count",...w0}]};function i4(j,q){for(let P of r4[j]??[]){let V=q[P.argumentIndex],B=P.direct?g6(V):0;if(P.property&&y6(V))B=Math.max(B,g6(Reflect.get(V,P.property)));if(B>P.limit)throw new r(P.resource,P.limit,B)}let b=[...q],K=new Set;while(b.length>0){let P=b.pop();if(typeof P==="string"&&P.length>Z)throw new r("string_length",Z,P.length);if(typeof P!=="object"||P===null||K.has(P))continue;if(K.add(P),Array.isArray(P)){for(let V of P)b.push(V);continue}for(let V of Object.values(P))b.push(V)}}function y6(j){return typeof j==="object"&&j!==null&&!Array.isArray(j)}function g6(j){if(typeof j==="number")return j;if(!y6(j))return 0;let q=0;for(let b of["min","max"]){let K=Reflect.get(j,b);if(typeof K==="number")q=Math.max(q,K)}return q}function F0(j){return b0(j,"array")||j.items!==void 0||j.minItems!==void 0||j.maxItems!==void 0}function J0(j){let{minItems:q,maxItems:b}=j;if(q!==void 0&&b!==void 0)return Math.max(q,b);if(b!==void 0)return b;if(q!==void 0)return q;return i}function m4(j){if(j===void 0||Number.isNaN(j))return;return Math.floor(Math.max(0,j))}function G4(j,q){let b=Math.max(j.minItems??0,j.maxItems??0);if(b>E)q.arraySize??={resource:"array_max_items",limit:E,actual:b}}function n4(j,q){if(!H6(j))return;let b=new Set(Object.keys(j.properties??{})),K=new Set((j.required??[]).filter((V)=>!b.has(V))).size,P=Math.max(j.minProperties??0,b.size+K);if(P>o)q.objectSize??={resource:"object_properties",limit:o,actual:P}}function c4(j,q){if(t4(j)){for(let b of[j.minLength,j.maxLength])if(b!==void 0)R6(b,q)}for(let b of[j.const,j.default,j.enum,Reflect.get(j,"template")])R6(s4(b),q)}function t4(j){if(j.type!==void 0)return b0(j,"string");if(j.const!==void 0)return typeof j.const==="string";if(j.enum!==void 0)return j.enum.some((q)=>typeof q==="string");if(j.default!==void 0)return typeof j.default==="string";return!0}function R6(j,q){if(j>Z&&(!q.stringLength||j>q.stringLength.actual))q.stringLength={resource:"string_length",limit:Z,actual:j}}function s4(j){let q=[j],b=new Set,K=0;while(q.length>0){let P=q.pop();if(typeof P==="string"){K=Math.max(K,P.length);continue}if(typeof P!=="object"||P===null||b.has(P))continue;b.add(P),q.push(...Object.values(P))}return K}function H6(j){if(j.type!==void 0)return b0(j,"object");return j.properties!==void 0||j.required!==void 0||j.additionalProperties!==void 0||j.patternProperties!==void 0||j.minProperties!==void 0||j.maxProperties!==void 0}function $4(j,q,b,K){if(!F0(j))return;let P=K??J0(j);if(q>n&&P>c)b.memory??={resource:"memory_estimation",limit:n*c,actual:q*P}}function p(j){return Math.min(j,Number.MAX_SAFE_INTEGER)}function I0(j){let q=j.split(".");if(q.length<2)throw new H("$.faker",`Invalid faker method format: "${j}"`,"Use format like 'person.firstName' or 'internet.email'");if(!A0)A0=N0();let K=A0;for(let P of q)if(K&&typeof K==="object"&&P in K)K=Reflect.get(K,P);else throw new H("$.faker",`Invalid faker method: "${j}"`,"Check faker.js documentation for valid methods");if(typeof K!=="function")throw new H("$.faker",`Invalid faker method: "${j}" is not a function`,"Check faker.js documentation for valid methods")}function J6(j){return j.type==="string"&&j.faker===void 0&&j.format===void 0&&j.pattern===void 0&&j.enum===void 0&&j.const===void 0&&j.$ref===void 0&&j.minLength===void 0&&j.maxLength===void 0}function a4(j){if(j.schmockNullable!==!0)return j;if(Array.isArray(j.anyOf)&&j.anyOf.length===2){let[q,b]=j.anyOf;if(A(q)&&q.type==="null"&&Object.keys(q).length===1&&A(b)){let{anyOf:K,...P}=j;return{...b,...P,schmockNullable:!0}}}if(Array.isArray(j.type)){let q=j.type.filter((b)=>b!=="null");if(q.length===1)j.type=q[0];else if(q.length>0)j.type=q}if(Array.isArray(j.enum)){let q=j.enum.filter((b)=>b!==null);if(q.length>0)j.enum=q}return j}var f=Symbol("root-schema");function E6(j){return typeof j==="object"&&j!==null&&!Array.isArray(j)}function S6(j){if(!j||typeof j!=="object")return j;return u(j,{cache:new Map},f)}function u(j,q,b){let K=q.cache.get(j);if(!K)K=new Map,q.cache.set(j,K);let P=K.get(b);if(P)return P;let V=a4({...j});if(K.set(b,V),b!==f&&V.faker){if(typeof V.faker==="string")I0(V.faker);return V}if(V.properties){let w={...V.properties};for(let[L,I]of Object.entries(w))if(A(I))w[L]=u(I,q,L);V.properties=w}for(let w of["definitions","$defs","patternProperties"]){let L=Reflect.get(V,w);if(!E6(L))continue;let I={...L};for(let[C,k]of Object.entries(I))if(A(k))I[C]=u(k,q,f);Reflect.set(V,w,I)}if(V.dependencies){let w={...V.dependencies};for(let[L,I]of Object.entries(w))if(!Array.isArray(I)&&A(I))w[L]=u(I,q,f);V.dependencies=w}let B=Reflect.get(V,"dependentSchemas");if(E6(B)){let w={...B};for(let[L,I]of Object.entries(w))if(A(I))w[L]=u(I,q,f);Reflect.set(V,"dependentSchemas",w)}if(Array.isArray(V.items))V.items=V.items.map((w)=>A(w)?u(w,q,f):w);else if(A(V.items))V.items=u(V.items,q,f);for(let w of["allOf","anyOf","oneOf"]){let L=V[w];if(L)V[w]=L.map((I)=>A(I)?u(I,q,f):I)}for(let w of["prefixItems","containsAll"]){let L=Reflect.get(V,w);if(Array.isArray(L))Reflect.set(V,w,L.map((I)=>A(I)?u(I,q,f):I))}for(let w of["additionalItems","contains","additionalProperties","propertyNames","not","if","then","else","contentSchema"]){let L=Reflect.get(V,w);if(A(L))Reflect.set(V,w,u(L,q,f))}if(b===f){if(J6(V))V.faker="lorem.word";return V}if(V.allOf||V.anyOf||V.oneOf||V.const!==void 0||V.enum)return V;let W=D6(b,V);if(W){let{fakerMethod:w,format:L,trueProbability:I,fakerArgs:C}=W.mapping;if(V.faker=C?{[w]:[C]}:w,L&&V.format===void 0)V.format=L;if(I!==void 0)V.schmockTrueProbability=I}else if(J6(V))V.faker="lorem.word";return V}function f6(j){return typeof j==="object"&&j!==null&&!Array.isArray(j)}function Z5(j){let[q,b]=B6([j.schema,j.overrides]);if(!A(q))throw new E0("$","Schema must be a valid JSON Schema object");if(b!==void 0&&!f6(b))throw new E0("$.overrides","Overrides must be an object mapping paths to values");let K=q,P=b,V=j.count,B=j.seed;return H0(K,"$",V),{name:"faker",version:X0,async process(U,W){if(W!==void 0&&W!==null)return{context:U,response:W};try{let w=await j5({schema:K,count:V,overrides:P,params:U.params,state:U.routeState,query:U.query,seed:B});return{context:U,response:w}}catch(w){if(w instanceof E0||w instanceof X6)throw w;throw new e4(U.path,w instanceof Error?w:Error(String(w)),K)}}}}async function j5(j){let{schema:q,count:b,overrides:K,params:P,state:V,query:B,seed:U}=j;H0(q,"$",b);let W=U6(U),w=W6(W),L=S6(q);if(b0(q,"array")&&q.items){let C=F6(q,b,w);if(C>E)throw new X6("array_size",E,C);L={...L,minItems:C,maxItems:C}}let I=await w6(L,W,U!==void 0?M0:void 0);if(I=L0(I,L,w),Array.isArray(I)){let C=I.map((k)=>j0(k,K,P,V,B));return $(C),C}return I=j0(I,K,P,V,B),$(I),I}function L0(j,q,b){if(j===null||j===void 0||!q||typeof q!=="object")return j;if("schmockNullable"in q&&q.schmockNullable===!0){if(b()<Z0)return null}if(q.type==="boolean"&&"schmockTrueProbability"in q&&typeof q.schmockTrueProbability==="number")return b()<q.schmockTrueProbability;if(f6(j)&&q.properties){for(let[K,P]of Object.entries(q.properties))if(K in j&&A(P))j[K]=L0(j[K],P,b)}if(Array.isArray(j)&&Array.isArray(q.items))for(let K=0;K<j.length;K++){let P=q.items[K];if(P&&A(P))j[K]=L0(j[K],P,b)}else if(Array.isArray(j)&&q.items&&A(q.items))for(let K=0;K<j.length;K++)j[K]=L0(j[K],q.items,b);return j}export{j5 as generateFromSchema,Z5 as fakerPlugin,Z as MAX_STRING_LENGTH,o as MAX_OBJECT_PROPERTIES};
@@ -1,12 +1,28 @@
1
1
  import { Faker } from "@faker-js/faker";
2
2
  import type { JSONSchema7 } from "json-schema";
3
- import { type JsonSchema } from "json-schema-faker";
3
+ import { type JsonSchema } from "json-schema-faker-private";
4
+ import { DETERMINISTIC_REF_DATE } from "./constants.js";
5
+ export { DETERMINISTIC_REF_DATE };
4
6
  type JsfObjectSchema = Exclude<JsonSchema, boolean>;
5
7
  /**
6
8
  * Create isolated faker instance to avoid race conditions.
7
9
  * Each generation gets its own faker instance to ensure thread-safety.
10
+ *
11
+ * @param refDate - Anchors faker's relative date methods. Supplied for seeded
12
+ * generation so `date.recent`/`date.future` reproduce; omitted otherwise, so
13
+ * unseeded output stays wall-clock relative.
8
14
  */
9
- export declare function createFakerInstance(seed?: number): Faker;
15
+ export declare function createFakerInstance(seed?: number, refDate?: string): Faker;
16
+ /**
17
+ * Detach a value from its owner so mutating it cannot reach the owner.
18
+ *
19
+ * Returns `unknown` rather than echoing the input type: a clone of a class
20
+ * instance may come back as a plain object (see the `structuredClone`
21
+ * fallback), so promising the caller its own type back would be a lie.
22
+ */
23
+ export declare function cloneOwned(value: unknown): unknown;
24
+ /** Clone related option graphs together while retaining aliases and callbacks. */
25
+ export declare function snapshotGraphs(values: readonly unknown[]): unknown[];
10
26
  export declare function resolveGenerationSeed(seed?: number): number;
11
27
  export declare function createSeededRandom(seed: number): () => number;
12
28
  /**
@@ -18,6 +34,5 @@ export declare function normalizeSchemaForJsf(schema: JSONSchema7): JsfObjectSch
18
34
  * Generate data from a JSON schema using json-schema-faker 0.6.0 async API.
19
35
  * Stateless — each call is self-contained with its own faker instance and options.
20
36
  */
21
- export declare function generateWithJsf(schema: JSONSchema7, seed: number): Promise<unknown>;
22
- export {};
37
+ export declare function generateWithJsf(schema: JSONSchema7, seed: number, refDate?: string): Promise<unknown>;
23
38
  //# sourceMappingURL=jsf-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsf-config.d.ts","sourceRoot":"","sources":["../src/jsf-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAyB,MAAM,aAAa,CAAC;AACtE,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAG3B,KAAK,eAAe,GAAG,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAEpD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,CAAC,EAAE,MAAM,SAMhD;AAED,wBAAgB,qBAAqB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,MAAM,CAS7D;AAqBD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,eAAe,CA0E1E;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,OAAO,CAAC,CAWlB"}
1
+ {"version":3,"file":"jsf-config.d.ts","sourceRoot":"","sources":["../src/jsf-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAyB,MAAM,aAAa,CAAC;AACtE,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAiB,MAAM,gBAAgB,CAAC;AAKvE,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAGlC,KAAK,eAAe,GAAG,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AA8EpD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,SASlE;AAwDD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAElD;AAsFD,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,CAGpE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,MAAM,CAS7D;AAqCD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,eAAe,CAE1E;AA8JD;;;GAGG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CA4BlB"}
@@ -0,0 +1,3 @@
1
+ /** Enforce limits against the value that will actually leave the plugin. */
2
+ export declare function assertOutputWithinLimits(value: unknown): void;
3
+ //# sourceMappingURL=output-limits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-limits.d.ts","sourceRoot":"","sources":["../src/output-limits.ts"],"names":[],"mappings":"AAQA,4EAA4E;AAC5E,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAyE7D"}
@@ -3,7 +3,8 @@ import type { JSONSchema7 } from "json-schema";
3
3
  * Determine number of items to generate for array schema
4
4
  * Prefers explicit count, then schema minItems/maxItems, with sane defaults
5
5
  * @param schema - Array schema with optional minItems/maxItems
6
- * @param explicitCount - Explicit count override from plugin options
6
+ * @param explicitCount - Explicit count override from plugin options; negative
7
+ * counts yield 0, fractional counts round down, and NaN is treated as absent
7
8
  * @returns Number of array items to generate
8
9
  */
9
10
  export declare function determineArrayCount(schema: JSONSchema7, explicitCount?: number, random?: () => number): number;
@@ -1 +1 @@
1
- {"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../src/overrides.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAS/C;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,WAAW,EACnB,aAAa,CAAC,EAAE,MAAM,EACtB,MAAM,GAAE,MAAM,MAAoB,GACjC,MAAM,CA4BR;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,OAAO,EACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,OAAO,CAoCT"}
1
+ {"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../src/overrides.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAU/C;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,WAAW,EACnB,aAAa,CAAC,EAAE,MAAM,EACtB,MAAM,GAAE,MAAM,MAAoB,GACjC,MAAM,CA6BR;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,OAAO,EACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,OAAO,CAoCT"}