Last commit july 5th

This commit is contained in:
2024-07-05 13:46:23 +02:00
parent dad0d86e8c
commit b0e4dfbb76
24982 changed files with 2621219 additions and 413 deletions

View File

@@ -0,0 +1,6 @@
import type { CodeKeywordDefinition } from "../../types";
import { _JTDTypeError } from "./error";
import { DiscrError, DiscrErrorObj } from "../discriminator/types";
export type JTDDiscriminatorError = _JTDTypeError<"discriminator", "object", string> | DiscrErrorObj<DiscrError.Tag> | DiscrErrorObj<DiscrError.Mapping>;
declare const def: CodeKeywordDefinition;
export default def;

View File

@@ -0,0 +1,71 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const codegen_1 = require("../../compile/codegen");
const metadata_1 = require("./metadata");
const nullable_1 = require("./nullable");
const error_1 = require("./error");
const types_1 = require("../discriminator/types");
const error = {
message: (cxt) => {
const { schema, params } = cxt;
return params.discrError
? params.discrError === types_1.DiscrError.Tag
? `tag "${schema}" must be string`
: `value of tag "${schema}" must be in mapping`
: (0, error_1.typeErrorMessage)(cxt, "object");
},
params: (cxt) => {
const { schema, params } = cxt;
return params.discrError
? (0, codegen_1._) `{error: ${params.discrError}, tag: ${schema}, tagValue: ${params.tag}}`
: (0, error_1.typeErrorParams)(cxt, "object");
},
};
const def = {
keyword: "discriminator",
schemaType: "string",
implements: ["mapping"],
error,
code(cxt) {
(0, metadata_1.checkMetadata)(cxt);
const { gen, data, schema, parentSchema } = cxt;
const [valid, cond] = (0, nullable_1.checkNullableObject)(cxt, data);
gen.if(cond);
validateDiscriminator();
gen.elseIf((0, codegen_1.not)(valid));
cxt.error();
gen.endIf();
cxt.ok(valid);
function validateDiscriminator() {
const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(schema)}`);
gen.if((0, codegen_1._) `${tag} === undefined`);
cxt.error(false, { discrError: types_1.DiscrError.Tag, tag });
gen.elseIf((0, codegen_1._) `typeof ${tag} == "string"`);
validateMapping(tag);
gen.else();
cxt.error(false, { discrError: types_1.DiscrError.Tag, tag }, { instancePath: schema });
gen.endIf();
}
function validateMapping(tag) {
gen.if(false);
for (const tagValue in parentSchema.mapping) {
gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`);
gen.assign(valid, applyTagSchema(tagValue));
}
gen.else();
cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag }, { instancePath: schema, schemaPath: "mapping", parentSchema: true });
gen.endIf();
}
function applyTagSchema(schemaProp) {
const _valid = gen.name("valid");
cxt.subschema({
keyword: "mapping",
schemaProp,
jtdDiscriminator: schema,
}, _valid);
return _valid;
}
},
};
exports.default = def;
//# sourceMappingURL=discriminator.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"discriminator.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/discriminator.ts"],"names":[],"mappings":";;AAEA,mDAA+D;AAC/D,yCAAwC;AACxC,yCAA8C;AAC9C,mCAAwE;AACxE,kDAAgE;AAOhE,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACf,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;QAC5B,OAAO,MAAM,CAAC,UAAU;YACtB,CAAC,CAAC,MAAM,CAAC,UAAU,KAAK,kBAAU,CAAC,GAAG;gBACpC,CAAC,CAAC,QAAQ,MAAM,kBAAkB;gBAClC,CAAC,CAAC,iBAAiB,MAAM,sBAAsB;YACjD,CAAC,CAAC,IAAA,wBAAgB,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACrC,CAAC;IACD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;QACd,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;QAC5B,OAAO,MAAM,CAAC,UAAU;YACtB,CAAC,CAAC,IAAA,WAAC,EAAA,WAAW,MAAM,CAAC,UAAU,UAAU,MAAM,eAAe,MAAM,CAAC,GAAG,GAAG;YAC3E,CAAC,CAAC,IAAA,uBAAe,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;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AAU,CAAC,GAAG,EAAE,GAAG,EAAC,EAAE,EAAC,YAAY,EAAE,MAAM,EAAC,CAAC,CAAA;YAC3E,GAAG,CAAC,KAAK,EAAE,CAAA;QACb,CAAC;QAED,SAAS,eAAe,CAAC,GAAS;YAChC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;YACb,KAAK,MAAM,QAAQ,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC5C,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,QAAQ,EAAE,CAAC,CAAA;gBACrC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAA;YAC7C,CAAC;YACD,GAAG,CAAC,IAAI,EAAE,CAAA;YACV,GAAG,CAAC,KAAK,CACP,KAAK,EACL,EAAC,UAAU,EAAE,kBAAU,CAAC,OAAO,EAAE,GAAG,EAAC,EACrC,EAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAC,CAClE,CAAA;YACD,GAAG,CAAC,KAAK,EAAE,CAAA;QACb,CAAC;QAED,SAAS,cAAc,CAAC,UAAkB;YACxC,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAChC,GAAG,CAAC,SAAS,CACX;gBACE,OAAO,EAAE,SAAS;gBAClB,UAAU;gBACV,gBAAgB,EAAE,MAAM;aACzB,EACD,MAAM,CACP,CAAA;YACD,OAAO,MAAM,CAAA;QACf,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"}

View File

@@ -0,0 +1,5 @@
import type { CodeKeywordDefinition, SchemaObject } from "../../types";
import { _JTDTypeError } from "./error";
export type JTDElementsError = _JTDTypeError<"elements", "array", SchemaObject>;
declare const def: CodeKeywordDefinition;
export default def;

24
spa/node_modules/ajv/dist/vocabularies/jtd/elements.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("../../compile/util");
const code_1 = require("../code");
const codegen_1 = require("../../compile/codegen");
const metadata_1 = require("./metadata");
const nullable_1 = require("./nullable");
const error_1 = require("./error");
const def = {
keyword: "elements",
schemaType: "object",
error: (0, error_1.typeError)("array"),
code(cxt) {
(0, metadata_1.checkMetadata)(cxt);
const { gen, data, schema, it } = cxt;
if ((0, util_1.alwaysValidSchema)(it, schema))
return;
const [valid] = (0, nullable_1.checkNullable)(cxt);
gen.if((0, codegen_1.not)(valid), () => gen.if((0, codegen_1._) `Array.isArray(${data})`, () => gen.assign(valid, (0, code_1.validateArray)(cxt)), () => cxt.error()));
cxt.ok(valid);
},
};
exports.default = def;
//# sourceMappingURL=elements.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/elements.ts"],"names":[],"mappings":";;AAEA,6CAAoD;AACpD,kCAAqC;AACrC,mDAA4C;AAC5C,yCAAwC;AACxC,yCAAwC;AACxC,mCAAgD;AAIhD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAA,iBAAS,EAAC,OAAO,CAAC;IACzB,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClC,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CACtB,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,iBAAiB,IAAI,GAAG,EACzB,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAA,oBAAa,EAAC,GAAG,CAAC,CAAC,EAC3C,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAClB,CACF,CAAA;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"}

6
spa/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import type { CodeKeywordDefinition, ErrorObject } from "../../types";
export type JTDEnumError = ErrorObject<"enum", {
allowedValues: string[];
}, string[]>;
declare const def: CodeKeywordDefinition;
export default def;

43
spa/node_modules/ajv/dist/vocabularies/jtd/enum.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const codegen_1 = require("../../compile/codegen");
const metadata_1 = require("./metadata");
const nullable_1 = require("./nullable");
const error = {
message: "must be equal to one of the allowed values",
params: ({ schemaCode }) => (0, codegen_1._) `{allowedValues: ${schemaCode}}`,
};
const def = {
keyword: "enum",
schemaType: "array",
error,
code(cxt) {
(0, metadata_1.checkMetadata)(cxt);
const { gen, data, schema, schemaValue, parentSchema, it } = cxt;
if (schema.length === 0)
throw new Error("enum must have non-empty array");
if (schema.length !== new Set(schema).size)
throw new Error("enum items must be unique");
let valid;
const isString = (0, codegen_1._) `typeof ${data} == "string"`;
if (schema.length >= it.opts.loopEnum) {
let cond;
[valid, cond] = (0, nullable_1.checkNullable)(cxt, isString);
gen.if(cond, loopEnum);
}
else {
/* istanbul ignore if */
if (!Array.isArray(schema))
throw new Error("ajv implementation error");
valid = (0, codegen_1.and)(isString, (0, codegen_1.or)(...schema.map((value) => (0, codegen_1._) `${data} === ${value}`)));
if (parentSchema.nullable)
valid = (0, codegen_1.or)((0, codegen_1._) `${data} === null`, valid);
}
cxt.pass(valid);
function loopEnum() {
gen.forOf("v", schemaValue, (v) => gen.if((0, codegen_1._) `${valid} = ${data} === ${v}`, () => gen.break()));
}
},
};
exports.default = def;
//# sourceMappingURL=enum.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/enum.ts"],"names":[],"mappings":";;AAEA,mDAAsD;AACtD,yCAAwC;AACxC,yCAAwC;AAIxC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,4CAA4C;IACrD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,mBAAmB,UAAU,GAAG;CAC5D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,OAAO;IACnB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC9D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QAC1E,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;QACxF,IAAI,KAAW,CAAA;QACf,MAAM,QAAQ,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,cAAc,CAAA;QAC9C,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACtC,IAAI,IAAU,CACb;YAAA,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,IAAA,wBAAa,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YAC7C,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;QACxB,CAAC;aAAM,CAAC;YACN,wBAAwB;YACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;YACvE,KAAK,GAAG,IAAA,aAAG,EAAC,QAAQ,EAAE,IAAA,YAAE,EAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;YACpF,IAAI,YAAY,CAAC,QAAQ;gBAAE,KAAK,GAAG,IAAA,YAAE,EAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EAAE,KAAK,CAAC,CAAA;QACnE,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAEf,SAAS,QAAQ;YACf,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,WAAmB,EAAE,CAAC,CAAC,EAAE,EAAE,CACxC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,MAAM,IAAI,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAC1D,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"}

View File

@@ -0,0 +1,9 @@
import type { KeywordErrorDefinition, KeywordErrorCxt, ErrorObject } from "../../types";
import { Code } from "../../compile/codegen";
export type _JTDTypeError<K extends string, T extends string, S> = ErrorObject<K, {
type: T;
nullable: boolean;
}, S>;
export declare function typeError(t: string): KeywordErrorDefinition;
export declare function typeErrorMessage({ parentSchema }: KeywordErrorCxt, t: string): string;
export declare function typeErrorParams({ parentSchema }: KeywordErrorCxt, t: string): Code;

20
spa/node_modules/ajv/dist/vocabularies/jtd/error.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.typeErrorParams = exports.typeErrorMessage = exports.typeError = void 0;
const codegen_1 = require("../../compile/codegen");
function typeError(t) {
return {
message: (cxt) => typeErrorMessage(cxt, t),
params: (cxt) => typeErrorParams(cxt, t),
};
}
exports.typeError = typeError;
function typeErrorMessage({ parentSchema }, t) {
return (parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.nullable) ? `must be ${t} or null` : `must be ${t}`;
}
exports.typeErrorMessage = typeErrorMessage;
function typeErrorParams({ parentSchema }, t) {
return (0, codegen_1._) `{type: ${t}, nullable: ${!!(parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.nullable)}}`;
}
exports.typeErrorParams = typeErrorParams;
//# sourceMappingURL=error.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/error.ts"],"names":[],"mappings":";;;AACA,mDAA6C;AAQ7C,SAAgB,SAAS,CAAC,CAAS;IACjC,OAAO;QACL,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC,CAAC;QAC1C,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC;KACzC,CAAA;AACH,CAAC;AALD,8BAKC;AAED,SAAgB,gBAAgB,CAAC,EAAC,YAAY,EAAkB,EAAE,CAAS;IACzE,OAAO,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,EAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAA;AACzE,CAAC;AAFD,4CAEC;AAED,SAAgB,eAAe,CAAC,EAAC,YAAY,EAAkB,EAAE,CAAS;IACxE,OAAO,IAAA,WAAC,EAAA,UAAU,CAAC,eAAe,CAAC,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,CAAA,GAAG,CAAA;AAC/D,CAAC;AAFD,0CAEC"}

10
spa/node_modules/ajv/dist/vocabularies/jtd/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import type { Vocabulary } from "../../types";
import { JTDTypeError } from "./type";
import { JTDEnumError } from "./enum";
import { JTDElementsError } from "./elements";
import { JTDPropertiesError } from "./properties";
import { JTDDiscriminatorError } from "./discriminator";
import { JTDValuesError } from "./values";
declare const jtdVocabulary: Vocabulary;
export default jtdVocabulary;
export type JTDErrorObject = JTDTypeError | JTDEnumError | JTDElementsError | JTDPropertiesError | JTDDiscriminatorError | JTDValuesError;

29
spa/node_modules/ajv/dist/vocabularies/jtd/index.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ref_1 = require("./ref");
const type_1 = require("./type");
const enum_1 = require("./enum");
const elements_1 = require("./elements");
const properties_1 = require("./properties");
const optionalProperties_1 = require("./optionalProperties");
const discriminator_1 = require("./discriminator");
const values_1 = require("./values");
const union_1 = require("./union");
const metadata_1 = require("./metadata");
const jtdVocabulary = [
"definitions",
ref_1.default,
type_1.default,
enum_1.default,
elements_1.default,
properties_1.default,
optionalProperties_1.default,
discriminator_1.default,
values_1.default,
union_1.default,
metadata_1.default,
{ keyword: "additionalProperties", schemaType: "boolean" },
{ keyword: "nullable", schemaType: "boolean" },
];
exports.default = jtdVocabulary;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/index.ts"],"names":[],"mappings":";;AACA,+BAA8B;AAC9B,iCAAgD;AAChD,iCAAgD;AAChD,yCAAqD;AACrD,6CAA2D;AAC3D,6DAAqD;AACrD,mDAAoE;AACpE,qCAA+C;AAC/C,mCAA2B;AAC3B,yCAAiC;AAEjC,MAAM,aAAa,GAAe;IAChC,aAAa;IACb,aAAU;IACV,cAAW;IACX,cAAW;IACX,kBAAQ;IACR,oBAAU;IACV,4BAAkB;IAClB,uBAAa;IACb,gBAAM;IACN,eAAK;IACL,kBAAQ;IACR,EAAC,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,SAAS,EAAC;IACxD,EAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAC;CAC7C,CAAA;AAED,kBAAe,aAAa,CAAA"}

View File

@@ -0,0 +1,5 @@
import { KeywordCxt } from "../../ajv";
import type { CodeKeywordDefinition } from "../../types";
declare const def: CodeKeywordDefinition;
export declare function checkMetadata({ it, keyword }: KeywordCxt, metadata?: boolean): void;
export default def;

25
spa/node_modules/ajv/dist/vocabularies/jtd/metadata.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkMetadata = void 0;
const util_1 = require("../../compile/util");
const def = {
keyword: "metadata",
schemaType: "object",
code(cxt) {
checkMetadata(cxt);
const { gen, schema, it } = cxt;
if ((0, util_1.alwaysValidSchema)(it, schema))
return;
const valid = gen.name("valid");
cxt.subschema({ keyword: "metadata", jtdMetadata: true }, valid);
cxt.ok(valid);
},
};
function checkMetadata({ it, keyword }, metadata) {
if (it.jtdMetadata !== metadata) {
throw new Error(`JTD: "${keyword}" cannot be used in this schema location`);
}
}
exports.checkMetadata = checkMetadata;
exports.default = def;
//# sourceMappingURL=metadata.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/metadata.ts"],"names":[],"mappings":";;;AAEA,6CAAoD;AAEpD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,aAAa,CAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC7B,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;QAC9D,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;CACF,CAAA;AAED,SAAgB,aAAa,CAAC,EAAC,EAAE,EAAE,OAAO,EAAa,EAAE,QAAkB;IACzE,IAAI,EAAE,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,SAAS,OAAO,0CAA0C,CAAC,CAAA;IAC7E,CAAC;AACH,CAAC;AAJD,sCAIC;AAED,kBAAe,GAAG,CAAA"}

View File

@@ -0,0 +1,4 @@
import type { KeywordCxt } from "../../compile/validate";
import { Code, Name } from "../../compile/codegen";
export declare function checkNullable({ gen, data, parentSchema }: KeywordCxt, cond?: Code): [Name, Code];
export declare function checkNullableObject(cxt: KeywordCxt, cond: Code): [Name, Code];

22
spa/node_modules/ajv/dist/vocabularies/jtd/nullable.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkNullableObject = exports.checkNullable = void 0;
const codegen_1 = require("../../compile/codegen");
function checkNullable({ gen, data, parentSchema }, cond = codegen_1.nil) {
const valid = gen.name("valid");
if (parentSchema.nullable) {
gen.let(valid, (0, codegen_1._) `${data} === null`);
cond = (0, codegen_1.not)(valid);
}
else {
gen.let(valid, false);
}
return [valid, cond];
}
exports.checkNullable = checkNullable;
function checkNullableObject(cxt, cond) {
const [valid, cond_] = checkNullable(cxt, cond);
return [valid, (0, codegen_1._) `${cond_} && typeof ${cxt.data} == "object" && !Array.isArray(${cxt.data})`];
}
exports.checkNullableObject = checkNullableObject;
//# sourceMappingURL=nullable.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"nullable.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/nullable.ts"],"names":[],"mappings":";;;AACA,mDAA6D;AAE7D,SAAgB,aAAa,CAC3B,EAAC,GAAG,EAAE,IAAI,EAAE,YAAY,EAAa,EACrC,OAAa,aAAG;IAEhB,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/B,IAAI,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC1B,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,CAAC,CAAA;QACnC,IAAI,GAAG,IAAA,aAAG,EAAC,KAAK,CAAC,CAAA;IACnB,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IACvB,CAAC;IACD,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAZD,sCAYC;AAED,SAAgB,mBAAmB,CAAC,GAAe,EAAE,IAAU;IAC7D,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC/C,OAAO,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,KAAK,cAAc,GAAG,CAAC,IAAI,kCAAkC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAA;AAC9F,CAAC;AAHD,kDAGC"}

View File

@@ -0,0 +1,3 @@
import type { CodeKeywordDefinition } from "../../types";
declare const def: CodeKeywordDefinition;
export default def;

View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const properties_1 = require("./properties");
const def = {
keyword: "optionalProperties",
schemaType: "object",
error: properties_1.error,
code(cxt) {
if (cxt.parentSchema.properties)
return;
(0, properties_1.validateProperties)(cxt);
},
};
exports.default = def;
//# sourceMappingURL=optionalProperties.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"optionalProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/optionalProperties.ts"],"names":[],"mappings":";;AAEA,6CAAsD;AAEtD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,oBAAoB;IAC7B,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAL,kBAAK;IACL,IAAI,CAAC,GAAe;QAClB,IAAI,GAAG,CAAC,YAAY,CAAC,UAAU;YAAE,OAAM;QACvC,IAAA,+BAAkB,EAAC,GAAG,CAAC,CAAA;IACzB,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"}

View File

@@ -0,0 +1,22 @@
import type { CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition, SchemaObject } from "../../types";
import type { KeywordCxt } from "../../compile/validate";
import { _JTDTypeError } from "./error";
declare enum PropError {
Additional = "additional",
Missing = "missing"
}
type PropKeyword = "properties" | "optionalProperties";
type PropSchema = {
[P in string]?: SchemaObject;
};
export type JTDPropertiesError = _JTDTypeError<PropKeyword, "object", PropSchema> | ErrorObject<PropKeyword, {
error: PropError.Additional;
additionalProperty: string;
}, PropSchema> | ErrorObject<PropKeyword, {
error: PropError.Missing;
missingProperty: string;
}, PropSchema>;
export declare const error: KeywordErrorDefinition;
declare const def: CodeKeywordDefinition;
export declare function validateProperties(cxt: KeywordCxt): void;
export default def;

View File

@@ -0,0 +1,149 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateProperties = exports.error = void 0;
const code_1 = require("../code");
const util_1 = require("../../compile/util");
const codegen_1 = require("../../compile/codegen");
const metadata_1 = require("./metadata");
const nullable_1 = require("./nullable");
const error_1 = require("./error");
var PropError;
(function (PropError) {
PropError["Additional"] = "additional";
PropError["Missing"] = "missing";
})(PropError || (PropError = {}));
exports.error = {
message: (cxt) => {
const { params } = cxt;
return params.propError
? params.propError === PropError.Additional
? "must NOT have additional properties"
: `must have property '${params.missingProperty}'`
: (0, error_1.typeErrorMessage)(cxt, "object");
},
params: (cxt) => {
const { params } = cxt;
return params.propError
? params.propError === PropError.Additional
? (0, codegen_1._) `{error: ${params.propError}, additionalProperty: ${params.additionalProperty}}`
: (0, codegen_1._) `{error: ${params.propError}, missingProperty: ${params.missingProperty}}`
: (0, error_1.typeErrorParams)(cxt, "object");
},
};
const def = {
keyword: "properties",
schemaType: "object",
error: exports.error,
code: validateProperties,
};
// const error: KeywordErrorDefinition = {
// message: "should NOT have additional properties",
// params: ({params}) => _`{additionalProperty: ${params.additionalProperty}}`,
// }
function validateProperties(cxt) {
(0, metadata_1.checkMetadata)(cxt);
const { gen, data, parentSchema, it } = cxt;
const { additionalProperties, nullable } = parentSchema;
if (it.jtdDiscriminator && nullable)
throw new Error("JTD: nullable inside discriminator mapping");
if (commonProperties()) {
throw new Error("JTD: properties and optionalProperties have common members");
}
const [allProps, properties] = schemaProperties("properties");
const [allOptProps, optProperties] = schemaProperties("optionalProperties");
if (properties.length === 0 && optProperties.length === 0 && additionalProperties) {
return;
}
const [valid, cond] = it.jtdDiscriminator === undefined
? (0, nullable_1.checkNullableObject)(cxt, data)
: [gen.let("valid", false), true];
gen.if(cond, () => gen.assign(valid, true).block(() => {
validateProps(properties, "properties", true);
validateProps(optProperties, "optionalProperties");
if (!additionalProperties)
validateAdditional();
}));
cxt.pass(valid);
function commonProperties() {
const props = parentSchema.properties;
const optProps = parentSchema.optionalProperties;
if (!(props && optProps))
return false;
for (const p in props) {
if (Object.prototype.hasOwnProperty.call(optProps, p))
return true;
}
return false;
}
function schemaProperties(keyword) {
const schema = parentSchema[keyword];
const allPs = schema ? (0, code_1.allSchemaProperties)(schema) : [];
if (it.jtdDiscriminator && allPs.some((p) => p === it.jtdDiscriminator)) {
throw new Error(`JTD: discriminator tag used in ${keyword}`);
}
const ps = allPs.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p]));
return [allPs, ps];
}
function validateProps(props, keyword, required) {
const _valid = gen.var("valid");
for (const prop of props) {
gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties), () => applyPropertySchema(prop, keyword, _valid), () => missingProperty(prop));
cxt.ok(_valid);
}
function missingProperty(prop) {
if (required) {
gen.assign(_valid, false);
cxt.error(false, { propError: PropError.Missing, missingProperty: prop }, { schemaPath: prop });
}
else {
gen.assign(_valid, true);
}
}
}
function applyPropertySchema(prop, keyword, _valid) {
cxt.subschema({
keyword,
schemaProp: prop,
dataProp: prop,
}, _valid);
}
function validateAdditional() {
gen.forIn("key", data, (key) => {
const addProp = isAdditional(key, allProps, "properties", it.jtdDiscriminator);
const addOptProp = isAdditional(key, allOptProps, "optionalProperties");
const extra = addProp === true ? addOptProp : addOptProp === true ? addProp : (0, codegen_1.and)(addProp, addOptProp);
gen.if(extra, () => {
if (it.opts.removeAdditional) {
gen.code((0, codegen_1._) `delete ${data}[${key}]`);
}
else {
cxt.error(false, { propError: PropError.Additional, additionalProperty: key }, { instancePath: key, parentSchema: true });
if (!it.opts.allErrors)
gen.break();
}
});
});
}
function isAdditional(key, props, keyword, jtdDiscriminator) {
let additional;
if (props.length > 8) {
// TODO maybe an option instead of hard-coded 8?
const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema[keyword], keyword);
additional = (0, codegen_1.not)((0, code_1.isOwnProperty)(gen, propsSchema, key));
if (jtdDiscriminator !== undefined) {
additional = (0, codegen_1.and)(additional, (0, codegen_1._) `${key} !== ${jtdDiscriminator}`);
}
}
else if (props.length || jtdDiscriminator !== undefined) {
const ps = jtdDiscriminator === undefined ? props : [jtdDiscriminator].concat(props);
additional = (0, codegen_1.and)(...ps.map((p) => (0, codegen_1._) `${key} !== ${p}`));
}
else {
additional = true;
}
return additional;
}
}
exports.validateProperties = validateProperties;
exports.default = def;
//# sourceMappingURL=properties.js.map

File diff suppressed because one or more lines are too long

4
spa/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import type { CodeKeywordDefinition, AnySchemaObject } from "../../types";
declare const def: CodeKeywordDefinition;
export declare function hasRef(schema: AnySchemaObject): boolean;
export default def;

67
spa/node_modules/ajv/dist/vocabularies/jtd/ref.js generated vendored Normal file
View File

@@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hasRef = void 0;
const compile_1 = require("../../compile");
const codegen_1 = require("../../compile/codegen");
const ref_error_1 = require("../../compile/ref_error");
const names_1 = require("../../compile/names");
const ref_1 = require("../core/ref");
const metadata_1 = require("./metadata");
const def = {
keyword: "ref",
schemaType: "string",
code(cxt) {
(0, metadata_1.checkMetadata)(cxt);
const { gen, data, schema: ref, parentSchema, it } = cxt;
const { schemaEnv: { root }, } = it;
const valid = gen.name("valid");
if (parentSchema.nullable) {
gen.var(valid, (0, codegen_1._) `${data} === null`);
gen.if((0, codegen_1.not)(valid), validateJtdRef);
}
else {
gen.var(valid, false);
validateJtdRef();
}
cxt.ok(valid);
function validateJtdRef() {
var _a;
const refSchema = (_a = root.schema.definitions) === null || _a === void 0 ? void 0 : _a[ref];
if (!refSchema) {
throw new ref_error_1.default(it.opts.uriResolver, "", ref, `No definition ${ref}`);
}
if (hasRef(refSchema) || !it.opts.inlineRefs)
callValidate(refSchema);
else
inlineRefSchema(refSchema);
}
function callValidate(schema) {
const sch = compile_1.compileSchema.call(it.self, new compile_1.SchemaEnv({ schema, root, schemaPath: `/definitions/${ref}` }));
const v = (0, ref_1.getValidate)(cxt, sch);
const errsCount = gen.const("_errs", names_1.default.errors);
(0, ref_1.callRef)(cxt, v, sch, sch.$async);
gen.assign(valid, (0, codegen_1._) `${errsCount} === ${names_1.default.errors}`);
}
function inlineRefSchema(schema) {
const schName = gen.scopeValue("schema", it.opts.code.source === true ? { ref: schema, code: (0, codegen_1.stringify)(schema) } : { ref: schema });
cxt.subschema({
schema,
dataTypes: [],
schemaPath: codegen_1.nil,
topSchemaRef: schName,
errSchemaPath: `/definitions/${ref}`,
}, valid);
}
},
};
function hasRef(schema) {
for (const key in schema) {
let sch;
if (key === "ref" || (typeof (sch = schema[key]) == "object" && hasRef(sch)))
return true;
}
return false;
}
exports.hasRef = hasRef;
exports.default = def;
//# sourceM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aACrC,EACD,KAAK,CACN,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,SAAgB,MAAM,CAAC,MAAuB;IAC5C,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,GAAoB,CAAA;QACxB,IAAI,GAAG,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;YAAE,OAAO,IAAI,CAAA;IAC3F,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAND,wBAMC;AAED,kBAAe,GAAG,CAAA"}

10
spa/node_modules/ajv/dist/vocabularies/jtd/type.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import type { CodeKeywordDefinition } from "../../types";
import { _JTDTypeError } from "./error";
export type JTDTypeError = _JTDTypeError<"type", JTDType, JTDType>;
export type IntType = "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32";
export declare const intRange: {
[T in IntType]: [number, number, number];
};
export type JTDType = "boolean" | "string" | "timestamp" | "float32" | "float64" | IntType;
declare const def: CodeKeywordDefinition;
export default def;

69
spa/node_modules/ajv/dist/vocabularies/jtd/type.js generated vendored Normal file
View File

@@ -0,0 +1,69 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.intRange = void 0;
const codegen_1 = require("../../compile/codegen");
const timestamp_1 = require("../../runtime/timestamp");
const util_1 = require("../../compile/util");
const metadata_1 = require("./metadata");
const error_1 = require("./error");
exports.intRange = {
int8: [-128, 127, 3],
uint8: [0, 255, 3],
int16: [-32768, 32767, 5],
uint16: [0, 65535, 5],
int32: [-2147483648, 2147483647, 10],
uint32: [0, 4294967295, 10],
};
const error = {
message: (cxt) => (0, error_1.typeErrorMessage)(cxt, cxt.schema),
params: (cxt) => (0, error_1.typeErrorParams)(cxt, cxt.schema),
};
function timestampCode(cxt) {
const { gen, data, it } = cxt;
const { timestamp, allowDate } = it.opts;
if (timestamp === "date")
return (0, codegen_1._) `${data} instanceof Date `;
const vts = (0, util_1.useFunc)(gen, timestamp_1.default);
const allowDateArg = allowDate ? (0, codegen_1._) `, true` : codegen_1.nil;
const validString = (0, codegen_1._) `typeof ${data} == "string" && ${vts}(${data}${allowDateArg})`;
return timestamp === "string" ? validString : (0, codegen_1.or)((0, codegen_1._) `${data} instanceof Date`, validString);
}
const def = {
keyword: "type",
schemaType: "string",
error,
code(cxt) {
(0, metadata_1.checkMetadata)(cxt);
const { data, schema, parentSchema, it } = cxt;
let cond;
switch (schema) {
case "boolean":
case "string":
cond = (0, codegen_1._) `typeof ${data} == ${schema}`;
break;
case "timestamp": {
cond = timestampCode(cxt);
break;
}
case "float32":
case "float64":
cond = (0, codegen_1._) `typeof ${data} == "number"`;
break;
default: {
const sch = schema;
cond = (0, codegen_1._) `typeof ${data} == "number" && isFinite(${data}) && !(${data} % 1)`;
if (!it.opts.int32range && (sch === "int32" || sch === "uint32")) {
if (sch === "uint32")
cond = (0, codegen_1._) `${cond} && ${data} >= 0`;
}
else {
const [min, max] = exports.intRange[sch];
cond = (0, codegen_1._) `${cond} && ${data} >= ${min} && ${data} <= ${max}`;
}
}
}
cxt.pass(parentSchema.nullable ? (0, codegen_1.or)((0, codegen_1._) `${data} === null`, cond) : cond);
},
};
exports.default = def;
//# sourceMappingURL=type.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/type.ts"],"names":[],"mappings":";;;AAEA,mDAAsD;AACtD,uDAAoD;AACpD,6CAA0C;AAC1C,yCAAwC;AACxC,mCAAwE;AAM3D,QAAA,QAAQ,GAA+C;IAClE,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IACpB,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAClB,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,C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,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAA,YAAE,EAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACxE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"}

View File

@@ -0,0 +1,3 @@
import type { CodeKeywordDefinition } from "../../types";
declare const def: CodeKeywordDefinition;
export default def;

12
spa/node_modules/ajv/dist/vocabularies/jtd/union.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const code_1 = require("../code");
const def = {
keyword: "union",
schemaType: "array",
trackErrors: true,
code: code_1.validateUnion,
error: { message: "must match a schema in union" },
};
exports.default = def;
//# sourceMappingURL=union.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"union.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/union.ts"],"names":[],"mappings":";;AACA,kCAAqC;AAErC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,IAAI;IACjB,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE,EAAC,OAAO,EAAE,8BAA8B,EAAC;CACjD,CAAA;AAED,kBAAe,GAAG,CAAA"}

View File

@@ -0,0 +1,5 @@
import type { CodeKeywordDefinition, SchemaObject } from "../../types";
import { _JTDTypeError } from "./error";
export type JTDValuesError = _JTDTypeError<"values", "object", SchemaObject>;
declare const def: CodeKeywordDefinition;
export default def;

51
spa/node_modules/ajv/dist/vocabularies/jtd/values.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("../../compile/util");
const codegen_1 = require("../../compile/codegen");
const metadata_1 = require("./metadata");
const nullable_1 = require("./nullable");
const error_1 = require("./error");
const def = {
keyword: "values",
schemaType: "object",
error: (0, error_1.typeError)("object"),
code(cxt) {
(0, metadata_1.checkMetadata)(cxt);
const { gen, data, schema, it } = cxt;
const [valid, cond] = (0, nullable_1.checkNullableObject)(cxt, data);
if ((0, util_1.alwaysValidSchema)(it, schema)) {
gen.if((0, codegen_1.not)((0, codegen_1.or)(cond, valid)), () => cxt.error());
}
else {
gen.if(cond);
gen.assign(valid, validateMap());
gen.elseIf((0, codegen_1.not)(valid));
cxt.error();
gen.endIf();
}
cxt.ok(valid);
function validateMap() {
const _valid = gen.name("valid");
if (it.allErrors) {
const validMap = gen.let("valid", true);
validateValues(() => gen.assign(validMap, false));
return validMap;
}
gen.var(_valid, true);
validateValues(() => gen.break());
return _valid;
function validateValues(notValid) {
gen.forIn("key", data, (key) => {
cxt.subschema({
keyword: "values",
dataProp: key,
dataPropType: util_1.Type.Str,
}, _valid);
gen.if((0, codegen_1.not)(_valid), notValid);
});
}
}
},
};
exports.default = def;
//# sourceMappingURL=values.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/values.ts"],"names":[],"mappings":";;AAEA,6CAA0D;AAC1D,mDAAmD;AACnD,yCAAwC;AACxC,yCAA8C;AAC9C,mCAAgD;AAIhD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,QAAQ;IACjB,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAA,iBAAS,EAAC,QAAQ,CAAC;IAC1B,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,IAAA,8BAAmB,EAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QACpD,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;YAClC,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,I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