@graffiti-garden/implementation-local 0.2.0

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 (50) hide show
  1. package/README.md +78 -0
  2. package/dist/database.browser.js +27 -0
  3. package/dist/database.browser.js.map +1 -0
  4. package/dist/database.cjs.js +2 -0
  5. package/dist/database.cjs.js.map +1 -0
  6. package/dist/database.js +2 -0
  7. package/dist/database.js.map +1 -0
  8. package/dist/index.browser.js +32 -0
  9. package/dist/index.browser.js.map +1 -0
  10. package/dist/index.cjs.js +2 -0
  11. package/dist/index.cjs.js.map +1 -0
  12. package/dist/index.js +2 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/session-manager.browser.js +2 -0
  15. package/dist/session-manager.browser.js.map +1 -0
  16. package/dist/session-manager.cjs.js +2 -0
  17. package/dist/session-manager.cjs.js.map +1 -0
  18. package/dist/session-manager.js +2 -0
  19. package/dist/session-manager.js.map +1 -0
  20. package/dist/src/database.d.ts +57 -0
  21. package/dist/src/database.d.ts.map +1 -0
  22. package/dist/src/index.d.ts +26 -0
  23. package/dist/src/index.d.ts.map +1 -0
  24. package/dist/src/session-manager.d.ts +22 -0
  25. package/dist/src/session-manager.d.ts.map +1 -0
  26. package/dist/src/synchronize.d.ts +25 -0
  27. package/dist/src/synchronize.d.ts.map +1 -0
  28. package/dist/src/tests.spec.d.ts +2 -0
  29. package/dist/src/tests.spec.d.ts.map +1 -0
  30. package/dist/src/utilities.d.ts +15 -0
  31. package/dist/src/utilities.d.ts.map +1 -0
  32. package/dist/synchronize.browser.js +18 -0
  33. package/dist/synchronize.browser.js.map +1 -0
  34. package/dist/synchronize.cjs.js +2 -0
  35. package/dist/synchronize.cjs.js.map +1 -0
  36. package/dist/synchronize.js +2 -0
  37. package/dist/synchronize.js.map +1 -0
  38. package/dist/utilities.browser.js +2 -0
  39. package/dist/utilities.browser.js.map +1 -0
  40. package/dist/utilities.cjs.js +2 -0
  41. package/dist/utilities.cjs.js.map +1 -0
  42. package/dist/utilities.js +2 -0
  43. package/dist/utilities.js.map +1 -0
  44. package/package.json +110 -0
  45. package/src/database.ts +450 -0
  46. package/src/index.ts +58 -0
  47. package/src/session-manager.ts +122 -0
  48. package/src/synchronize.ts +154 -0
  49. package/src/tests.spec.ts +16 -0
  50. package/src/utilities.ts +128 -0
@@ -0,0 +1,2 @@
1
+ class t{sessionEvents=new EventTarget;constructor(){(async()=>{await Promise.resolve();for(const t of this.getLoggedInActors()){const o=new CustomEvent("login",{detail:{session:{actor:t}}});this.sessionEvents.dispatchEvent(o)}const t=new CustomEvent("initialized");this.sessionEvents.dispatchEvent(t)})()}loggedInActors=[];getLoggedInActors(){if("undefined"!=typeof window){const t=window.localStorage.getItem("graffiti-actor");return t?t.split(",").map(decodeURIComponent):[]}return this.loggedInActors}setLoggedInActors(t){"undefined"!=typeof window?window.localStorage.setItem("graffiti-actor",t.map(encodeURIComponent).join(",")):this.loggedInActors=t}login=async t=>{let o,e=t?.actor;if(!e&&"undefined"!=typeof window){const t=window.prompt("This is an insecure implementation of the Graffiti API for *demo purposes only*. Do not store any sensitive information here. \n\n Simply choose a username to log in.");t&&(e=t)}if(e){const t=this.getLoggedInActors();t.includes(e)||this.setLoggedInActors([...t,e]),o={session:{actor:e}}}else o={error:new Error("No actor ID provided to login")};const n=new CustomEvent("login",{detail:o});this.sessionEvents.dispatchEvent(n)};logout=async t=>{const o=this.getLoggedInActors(),e=o.includes(t.actor);e&&this.setLoggedInActors(o.filter((o=>o!==t.actor)));const n=e?{actor:t.actor}:{actor:t.actor,error:new Error("Not logged in with that actor")},s=new CustomEvent("logout",{detail:n});this.sessionEvents.dispatchEvent(s)}}export{t as GraffitiLocalSessionManager};
2
+ //# sourceMappingURL=session-manager.browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-manager.browser.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";exports.GraffitiLocalSessionManager=class{sessionEvents=new EventTarget;constructor(){(async()=>{await Promise.resolve();for(const t of this.getLoggedInActors()){const o=new CustomEvent("login",{detail:{session:{actor:t}}});this.sessionEvents.dispatchEvent(o)}const t=new CustomEvent("initialized");this.sessionEvents.dispatchEvent(t)})()}loggedInActors=[];getLoggedInActors(){if("undefined"!=typeof window){const t=window.localStorage.getItem("graffiti-actor");return t?t.split(",").map(decodeURIComponent):[]}return this.loggedInActors}setLoggedInActors(t){"undefined"!=typeof window?window.localStorage.setItem("graffiti-actor",t.map(encodeURIComponent).join(",")):this.loggedInActors=t}login=async t=>{let o,e=t?.actor;if(!e&&"undefined"!=typeof window){const t=window.prompt("This is an insecure implementation of the Graffiti API for *demo purposes only*. Do not store any sensitive information here. \n\n Simply choose a username to log in.");t&&(e=t)}if(e){const t=this.getLoggedInActors();t.includes(e)||this.setLoggedInActors([...t,e]),o={session:{actor:e}}}else o={error:new Error("No actor ID provided to login")};const n=new CustomEvent("login",{detail:o});this.sessionEvents.dispatchEvent(n)};logout=async t=>{const o=this.getLoggedInActors(),e=o.includes(t.actor);e&&this.setLoggedInActors(o.filter((o=>o!==t.actor)));const n=e?{actor:t.actor}:{actor:t.actor,error:new Error("Not logged in with that actor")},s=new CustomEvent("logout",{detail:n});this.sessionEvents.dispatchEvent(s)}};
2
+ //# sourceMappingURL=session-manager.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-manager.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ class t{sessionEvents=new EventTarget;constructor(){(async()=>{await Promise.resolve();for(const t of this.getLoggedInActors()){const o=new CustomEvent("login",{detail:{session:{actor:t}}});this.sessionEvents.dispatchEvent(o)}const t=new CustomEvent("initialized");this.sessionEvents.dispatchEvent(t)})()}loggedInActors=[];getLoggedInActors(){if("undefined"!=typeof window){const t=window.localStorage.getItem("graffiti-actor");return t?t.split(",").map(decodeURIComponent):[]}return this.loggedInActors}setLoggedInActors(t){"undefined"!=typeof window?window.localStorage.setItem("graffiti-actor",t.map(encodeURIComponent).join(",")):this.loggedInActors=t}login=async t=>{let o,e=t?.actor;if(!e&&"undefined"!=typeof window){const t=window.prompt("This is an insecure implementation of the Graffiti API for *demo purposes only*. Do not store any sensitive information here. \n\n Simply choose a username to log in.");t&&(e=t)}if(e){const t=this.getLoggedInActors();t.includes(e)||this.setLoggedInActors([...t,e]),o={session:{actor:e}}}else o={error:new Error("No actor ID provided to login")};const n=new CustomEvent("login",{detail:o});this.sessionEvents.dispatchEvent(n)};logout=async t=>{const o=this.getLoggedInActors(),e=o.includes(t.actor);e&&this.setLoggedInActors(o.filter((o=>o!==t.actor)));const n=e?{actor:t.actor}:{actor:t.actor,error:new Error("Not logged in with that actor")},s=new CustomEvent("logout",{detail:n});this.sessionEvents.dispatchEvent(s)}}export{t as GraffitiLocalSessionManager};
2
+ //# sourceMappingURL=session-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-manager.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,57 @@
1
+ import type { Graffiti, GraffitiObjectBase, GraffitiLocation } from "@graffiti-garden/api";
2
+ import Ajv from "ajv-draft-04";
3
+ /**
4
+ * Constructor options for the GraffitiPoubchDB class.
5
+ */
6
+ export interface GraffitiLocalOptions {
7
+ /**
8
+ * Options to pass to the PouchDB constructor.
9
+ * Defaults to `{ name: "graffitiDb" }`.
10
+ *
11
+ * See the [PouchDB documentation](https://pouchdb.com/api.html#create_database)
12
+ * for available options.
13
+ */
14
+ pouchDBOptions?: PouchDB.Configuration.DatabaseConfiguration;
15
+ /**
16
+ * Defines the name of the {@link https://api.graffiti.garden/interfaces/GraffitiObjectBase.html#source | `source` }
17
+ * under which to store objects.
18
+ * Defaults to `"local"`.
19
+ */
20
+ sourceName?: string;
21
+ /**
22
+ * The time in milliseconds to keep tombstones before deleting them.
23
+ * See the {@link https://api.graffiti.garden/classes/Graffiti.html#discover | `discover` }
24
+ * documentation for more information.
25
+ */
26
+ tombstoneRetention?: number;
27
+ }
28
+ /**
29
+ * An implementation of only the database operations of the
30
+ * GraffitiAPI without synchronization or session management.
31
+ */
32
+ export declare class GraffitiLocalDatabase implements Pick<Graffiti, "get" | "put" | "patch" | "delete" | "discover" | "listChannels" | "listOrphans"> {
33
+ protected readonly db: PouchDB.Database<GraffitiObjectBase>;
34
+ protected readonly source: string;
35
+ protected readonly tombstoneRetention: number;
36
+ protected readonly ajv: Ajv;
37
+ constructor(options?: GraffitiLocalOptions, ajv?: Ajv);
38
+ protected queryByLocation(location: GraffitiLocation): Promise<PouchDB.Core.ExistingDocument<GraffitiObjectBase & PouchDB.Core.AllDocsMeta>[]>;
39
+ protected docId(location: GraffitiLocation): string;
40
+ get: Graffiti["get"];
41
+ /**
42
+ * Deletes all docs at a particular location.
43
+ * If the `keepLatest` flag is set to true,
44
+ * the doc with the most recent timestamp will be
45
+ * spared. If there are multiple docs with the same
46
+ * timestamp, the one with the highest `_id` will be
47
+ * spared.
48
+ */
49
+ protected deleteAtLocation(location: GraffitiLocation, keepLatest?: boolean): Promise<GraffitiObjectBase | undefined>;
50
+ delete: Graffiti["delete"];
51
+ put: Graffiti["put"];
52
+ patch: Graffiti["patch"];
53
+ discover: Graffiti["discover"];
54
+ listChannels: Graffiti["listChannels"];
55
+ listOrphans: Graffiti["listOrphans"];
56
+ }
57
+ //# sourceMappingURL=database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAkB9B,OAAO,GAAG,MAAM,cAAc,CAAC;AAG/B;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC;IAC7D;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;GAGG;AACH,qBAAa,qBACX,YACE,IAAI,CACF,QAAQ,EACN,KAAK,GACL,KAAK,GACL,OAAO,GACP,QAAQ,GACR,UAAU,GACV,cAAc,GACd,aAAa,CAChB;IAEH,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAC5D,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAW;IAC5C,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAY;IACzD,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;gBAEhB,OAAO,CAAC,EAAE,oBAAoB,EAAE,GAAG,CAAC,EAAE,GAAG;cAkDrC,eAAe,CAAC,QAAQ,EAAE,gBAAgB;IAuB1D,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,gBAAgB;IAI1C,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CA4BlB;IAEF;;;;;;;OAOG;cACa,gBAAgB,CAC9B,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,GAAE,OAAe;IAiE7B,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAYxB;IAEF,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAmClB;IAEF,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CA0DtB;IAEF,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAwE5B;IAEF,YAAY,EAAE,QAAQ,CAAC,cAAc,CAAC,CAGpC;IAEF,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,CAGlC;CACH"}
@@ -0,0 +1,26 @@
1
+ import { Graffiti } from "@graffiti-garden/api";
2
+ import { type GraffitiLocalOptions } from "./database";
3
+ /**
4
+ * A local implementation of the [Graffiti API](https://api.graffiti.garden/classes/Graffiti.html)
5
+ * based on [PouchDB](https://pouchdb.com/). PouchDb will automatically persist data in a local
6
+ * database, either in the browser or in Node.js.
7
+ * It can also be configured to work with an external [CouchDB](https://couchdb.apache.org/) server,
8
+ * although using it with a remote server will not be secure.
9
+ */
10
+ export declare class GraffitiLocal extends Graffiti {
11
+ locationToUri: (location: import("@graffiti-garden/api").GraffitiLocation) => string;
12
+ uriToLocation: (uri: string) => import("@graffiti-garden/api").GraffitiLocation;
13
+ login: Graffiti["login"];
14
+ logout: Graffiti["logout"];
15
+ sessionEvents: Graffiti["sessionEvents"];
16
+ put: Graffiti["put"];
17
+ get: Graffiti["get"];
18
+ patch: Graffiti["patch"];
19
+ delete: Graffiti["delete"];
20
+ discover: Graffiti["discover"];
21
+ synchronize: Graffiti["synchronize"];
22
+ listChannels: Graffiti["listChannels"];
23
+ listOrphans: Graffiti["listOrphans"];
24
+ constructor(options?: GraffitiLocalOptions);
25
+ }
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,OAAO,EAAyB,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAI9E;;;;;;GAMG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IACzC,aAAa,wEAAiB;IAC9B,aAAa,mEAAiB;IAE9B,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzB,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC3B,aAAa,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;IACzC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrB,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrB,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzB,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC3B,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC/B,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;IACrC,YAAY,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IACvC,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;gBAEzB,OAAO,CAAC,EAAE,oBAAoB;CA2B3C"}
@@ -0,0 +1,22 @@
1
+ import type { Graffiti } from "@graffiti-garden/api";
2
+ /**
3
+ * A class that implements the login methods
4
+ * of the [Graffiti API]() for use in the browser.
5
+ * It is completely insecure and should only be used
6
+ * for testing and demonstrations.
7
+ *
8
+ * It uses `localStorage` to store login state and
9
+ * window prompts rather than an oauth flow for log in.
10
+ * It can be used in node.js but will not persist
11
+ * login state and a proposed username must be provided.
12
+ */
13
+ export declare class GraffitiLocalSessionManager {
14
+ sessionEvents: Graffiti["sessionEvents"];
15
+ constructor();
16
+ loggedInActors: string[];
17
+ protected getLoggedInActors(): string[];
18
+ protected setLoggedInActors(actors: string[]): void;
19
+ login: Graffiti["login"];
20
+ logout: Graffiti["logout"];
21
+ }
22
+ //# sourceMappingURL=session-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../../src/session-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EAIT,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;GAUG;AACH,qBAAa,2BAA2B;IACtC,aAAa,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAqB;;IAwB7D,cAAc,EAAE,MAAM,EAAE,CAAM;IAE9B,SAAS,CAAC,iBAAiB,IAAI,MAAM,EAAE;IAWvC,SAAS,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE;IAW5C,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CA+BtB;IAEF,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAoBxB;CACH"}
@@ -0,0 +1,25 @@
1
+ import Ajv from "ajv-draft-04";
2
+ import type { Graffiti } from "@graffiti-garden/api";
3
+ import type { GraffitiObjectBase } from "@graffiti-garden/api";
4
+ type GraffitiDatabaseMethods = Pick<Graffiti, "get" | "put" | "patch" | "delete" | "discover">;
5
+ /**
6
+ * Wraps a partial implementation of the [Graffiti API](https://api.graffiti.garden/classes/Graffiti.html)
7
+ * to provide the [`synchronize`](https://api.graffiti.garden/classes/Graffiti.html#synchronize) method.
8
+ * The partial implementation must include the primary database methods:
9
+ * `get`, `put`, `patch`, `delete`, and `discover`.
10
+ */
11
+ export declare class GraffitiSynchronize implements Pick<Graffiti, "put" | "get" | "patch" | "delete" | "discover" | "synchronize"> {
12
+ protected readonly synchronizeEvents: EventTarget;
13
+ protected readonly ajv: Ajv;
14
+ protected readonly graffiti: GraffitiDatabaseMethods;
15
+ constructor(graffiti: GraffitiDatabaseMethods, ajv?: Ajv);
16
+ protected synchronizeDispatch(oldObject: GraffitiObjectBase, newObject?: GraffitiObjectBase): void;
17
+ get: Graffiti["get"];
18
+ put: Graffiti["put"];
19
+ patch: Graffiti["patch"];
20
+ delete: Graffiti["delete"];
21
+ discover: Graffiti["discover"];
22
+ synchronize: Graffiti["synchronize"];
23
+ }
24
+ export {};
25
+ //# sourceMappingURL=synchronize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"synchronize.d.ts","sourceRoot":"","sources":["../../src/synchronize.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAe/D,KAAK,uBAAuB,GAAG,IAAI,CACjC,QAAQ,EACR,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,CAChD,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,mBACX,YACE,IAAI,CACF,QAAQ,EACR,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,aAAa,CAChE;IAEH,SAAS,CAAC,QAAQ,CAAC,iBAAiB,cAAqB;IACzD,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAC5B,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;gBAIzC,QAAQ,EAAE,uBAAuB,EAAE,GAAG,CAAC,EAAE,GAAG;IAKxD,SAAS,CAAC,mBAAmB,CAC3B,SAAS,EAAE,kBAAkB,EAC7B,SAAS,CAAC,EAAE,kBAAkB;IAWhC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAIlB;IAEF,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAYlB;IAEF,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CAStB;IAEF,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAIxB;IAEF,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAe5B;IAEF,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,CAuClC;CACH"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=tests.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tests.spec.d.ts","sourceRoot":"","sources":["../../src/tests.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import type { Graffiti, GraffitiObjectBase, GraffitiLocation, GraffitiPatch, JSONSchema4, GraffitiSession } from "@graffiti-garden/api";
2
+ import type { Ajv } from "ajv";
3
+ import type { applyPatch } from "fast-json-patch";
4
+ export declare const locationToUri: Graffiti["locationToUri"];
5
+ export declare const uriToLocation: Graffiti["uriToLocation"];
6
+ export declare function randomBase64(numBytes?: number): string;
7
+ export declare function unpackLocationOrUri(locationOrUri: GraffitiLocation | string): {
8
+ location: GraffitiLocation;
9
+ uri: string;
10
+ };
11
+ export declare function applyGraffitiPatch<Prop extends keyof GraffitiPatch>(apply: typeof applyPatch, prop: Prop, patch: GraffitiPatch, object: GraffitiObjectBase): void;
12
+ export declare function attemptAjvCompile<Schema extends JSONSchema4>(ajv: Ajv, schema: Schema): import("ajv").ValidateFunction<import("ajv/dist/core").JTDDataType<Schema>>;
13
+ export declare function maskGraffitiObject(object: GraffitiObjectBase, channels: string[], session?: GraffitiSession): void;
14
+ export declare function isActorAllowedGraffitiObject(object: GraffitiObjectBase, session?: GraffitiSession): boolean;
15
+ //# sourceMappingURL=utilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../src/utilities.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,eAAe,CAEnD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,eAAe,CAYnD,CAAC;AAEF,wBAAgB,YAAY,CAAC,QAAQ,GAAE,MAAW,UAOjD;AAED,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,gBAAgB,GAAG,MAAM;;;EAgB3E;AAED,wBAAgB,kBAAkB,CAAC,IAAI,SAAS,MAAM,aAAa,EACjE,KAAK,EAAE,OAAO,UAAU,EACxB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,kBAAkB,GACzB,IAAI,CAuBN;AAED,wBAAgB,iBAAiB,CAAC,MAAM,SAAS,WAAW,EAC1D,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,+EASf;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,CAAC,EAAE,eAAe,GACxB,IAAI,CAON;AACD,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,kBAAkB,EAC1B,OAAO,CAAC,EAAE,eAAe,WAQ1B"}
@@ -0,0 +1,18 @@
1
+ function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,r={exports:{}},n={},o={},s={},a={},i={},c={};function u(){return t||(t=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce(((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function o(e,...t){const r=[e[0]];let o=0;for(;o<t.length;)i(r,t[o]),r.push(e[++o]);return new n(r)}e._Code=n,e.nil=new n(""),e._=o;const s=new n("+");function a(e,...t){const r=[u(e[0])];let o=0;for(;o<t.length;)r.push(s),i(r,t[o]),r.push(s,u(e[++o]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===s){const r=c(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new n(r)}function i(e,t){var o;t instanceof n?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(o=t)||"boolean"==typeof o||null===o?o:u(Array.isArray(o)?o.join(","):o))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof r||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof r?void 0:`"${e}${t.slice(1)}`}function u(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=a,e.addCodeArg=i,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},e.stringify=function(e){return new n(u(e))},e.safeStringify=u,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new n(`.${t}`):o`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new n(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new n(e.toString())}}(c)),c}var l,d,f={};function h(){return l||(l=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=u();class r extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var n;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}e.Scope=o;class s extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=t._`.${new t.Name(r)}[${n}]`}}e.ValueScopeName=s;const a=t._`\n`;e.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?a:t.nil}}get(){return this._scope}name(e){return new s(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const n=this.toName(e),{prefix:o}=n,s=null!==(r=t.key)&&void 0!==r?r:t.ref;let a=this._values[o];if(a){const e=a.get(s);if(e)return e}else a=this._values[o]=new Map;a.set(s,n);const i=this._scope[o]||(this._scope[o]=[]),c=i.length;return i[c]=t.ref,n.setValue(t,{property:o,itemIndex:c}),n}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,r=this._values){return this._reduceValues(r,(r=>{if(void 0===r.scopePath)throw new Error(`CodeGen: name "${r}" has no value`);return t._`${e}${r.scopePath}`}))}scopeCode(e=this._values,t,r){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,r)}_reduceValues(o,s,a={},i){let c=t.nil;for(const u in o){const l=o[u];if(!l)continue;const d=a[u]=a[u]||new Map;l.forEach((o=>{if(d.has(o))return;d.set(o,n.Started);let a=s(o);if(a){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;c=t._`${c}${r} ${o} = ${a};${this.opts._n}`}else{if(!(a=null==i?void 0:i(o)))throw new r(o);c=t._`${c}${a}${this.opts._n}`}d.set(o,n.Completed)}))}return c}}}(f)),f}function p(){return d||(d=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=u(),r=h();var n=u();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=h();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class s{optimizeNodes(){return this}optimizeNames(e,t){return this}}class a extends s{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const n=e?r.varKinds.var:this.varKind,o=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=I(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class i extends s{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=I(this.rhs,e,r),this}get names(){return x(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class c extends i{constructor(e,t,r,n){super(e,r,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class l extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class d extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class f extends s{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class p extends s{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=I(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class m extends s{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce(((t,r)=>t+r.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let n=r.length;for(;n--;){const o=r[n];o.optimizeNames(e,t)||(T(e,o.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>j(e,t.names)),{})}}class y extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class v extends m{}class g extends y{}g.kind="else";class $ extends y{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new g(e):e}return t?!1===e?t instanceof $?t:t.nodes:this.nodes.length?this:new $(C(e),t instanceof $?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=I(this.condition,e,t),this}get names(){const e=super.names;return x(e,this.condition),this.else&&j(e,this.else.names),e}}$.kind="if";class w extends y{}w.kind="for";class _ extends w{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=I(this.iteration,e,t),this}get names(){return j(super.names,this.iteration.names)}}class b extends w{constructor(e,t,r,n){super(),this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${t} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){const e=x(super.names,this.from);return x(e,this.to)}}class P extends w{constructor(e,t,r,n){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=I(this.iterable,e,t),this}get names(){return j(super.names,this.iterable.names)}}class E extends y{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}E.kind="func";class S extends m{render(e){return"return "+super.render(e)}}S.kind="return";class O extends y{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&j(e,this.catch.names),this.finally&&j(e,this.finally.names),e}}class k extends y{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}k.kind="catch";class N extends y{render(e){return"finally"+super.render(e)}}N.kind="finally";function j(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function x(e,r){return r instanceof t._CodeOrName?j(e,r.names):e}function I(e,r,n){return e instanceof t.Name?s(e):(o=e)instanceof t._Code&&o._items.some((e=>e instanceof t.Name&&1===r[e.str]&&void 0!==n[e.str]))?new t._Code(e._items.reduce(((e,r)=>(r instanceof t.Name&&(r=s(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e)),[])):e;var o;function s(e){const t=n[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function T(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function C(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:t._`!${M(e)}`}e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){const o=this._scope.toName(t);return void 0!==r&&n&&(this._constants[o.str]=r),this._leafNode(new a(e,o,r)),o}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,r){return this._leafNode(new i(e,t,r))}add(t,r){return this._leafNode(new c(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new p(e)),this}object(...e){const r=["{"];for(const[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,o));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new $(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new $(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode($,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new _(e),t)}forRange(e,t,n,o,s=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const a=this._scope.toName(e);return this._for(new b(s,a,t,n),(()=>o(a)))}forOf(e,n,o,s=r.varKinds.const){const a=this._scope.toName(e);if(this.opts.es5){const e=n instanceof t.Name?n:this.var("_arr",n);return this.forRange("_i",0,t._`${e}.length`,(r=>{this.var(a,t._`${e}[${r}]`),o(a)}))}return this._for(new P("of",s,a,n),(()=>o(a)))}forIn(e,n,o,s=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,t._`Object.keys(${n})`,o);const a=this._scope.toName(e);return this._for(new P("in",s,a,n),(()=>o(a)))}endFor(){return this._endBlockNode(w)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new S;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(S)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new O;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new k(e),t(e)}return r&&(this._currNode=n.finally=new N,this.code(r)),this._endBlockNode(k,N)}throw(e){return this._leafNode(new f(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,n,o){return this._blockNode(new E(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(E)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof $))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},e.not=C;const R=D(e.operators.AND);e.and=function(...e){return e.reduce(R)};const A=D(e.operators.OR);function D(e){return(r,n)=>r===t.nil?n:n===t.nil?r:t._`${M(r)} ${e} ${M(n)}`}function M(e){return e instanceof t.Name?e:t._`(${e})`}e.or=function(...e){return e.reduce(A)}}(i)),i}var m,y={};function v(){if(m)return y;m=1,Object.defineProperty(y,"__esModule",{value:!0}),y.checkStrictMode=y.getErrorPath=y.Type=y.useFunc=y.setEvaluated=y.evaluatedPropsToName=y.mergeEvaluated=y.eachItem=y.unescapeJsonPointer=y.escapeJsonPointer=y.escapeFragment=y.unescapeFragment=y.schemaRefOrVal=y.schemaHasRulesButRef=y.schemaHasRules=y.checkUnknownRules=y.alwaysValidSchema=y.toHash=void 0;const e=p(),t=u();function r(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const o=n.RULES.keywords;for(const r in t)o[r]||f(e,`unknown keyword: "${r}"`)}function n(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function o(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function s(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function a({mergeNames:t,mergeToName:r,mergeValues:n,resultToName:o}){return(s,a,i,c)=>{const u=void 0===i?a:i instanceof e.Name?(a instanceof e.Name?t(s,a,i):r(s,a,i),i):a instanceof e.Name?(r(s,i,a),a):n(a,i);return c!==e.Name||u instanceof e.Name?u:o(s,u)}}function i(t,r){if(!0===r)return t.var("props",!0);const n=t.var("props",e._`{}`);return void 0!==r&&c(t,n,r),n}function c(t,r,n){Object.keys(n).forEach((n=>t.assign(e._`${r}${(0,e.getProperty)(n)}`,!0)))}y.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},y.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(r(e,t),!n(t,e.self.RULES.all))},y.checkUnknownRules=r,y.schemaHasRules=n,y.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},y.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},n,o,s){if(!s){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return e._`${n}`}return e._`${t}${r}${(0,e.getProperty)(o)}`},y.unescapeFragment=function(e){return s(decodeURIComponent(e))},y.escapeFragment=function(e){return encodeURIComponent(o(e))},y.escapeJsonPointer=o,y.unescapeJsonPointer=s,y.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},y.mergeEvaluated={props:a({mergeNames:(t,r,n)=>t.if(e._`${n} !== true && ${r} !== undefined`,(()=>{t.if(e._`${r} === true`,(()=>t.assign(n,!0)),(()=>t.assign(n,e._`${n} || {}`).code(e._`Object.assign(${n}, ${r})`)))})),mergeToName:(t,r,n)=>t.if(e._`${n} !== true`,(()=>{!0===r?t.assign(n,!0):(t.assign(n,e._`${n} || {}`),c(t,n,r))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:i}),items:a({mergeNames:(t,r,n)=>t.if(e._`${n} !== true && ${r} !== undefined`,(()=>t.assign(n,e._`${r} === true ? true : ${n} > ${r} ? ${n} : ${r}`))),mergeToName:(t,r,n)=>t.if(e._`${n} !== true`,(()=>t.assign(n,!0===r||e._`${n} > ${r} ? ${n} : ${r}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},y.evaluatedPropsToName=i,y.setEvaluated=c;const l={};var d;function f(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}return y.useFunc=function(e,r){return e.scopeValue("func",{ref:r,code:l[r.code]||(l[r.code]=new t._Code(r.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(d||(y.Type=d={})),y.getErrorPath=function(t,r,n){if(t instanceof e.Name){const o=r===d.Num;return n?o?e._`"[" + ${t} + "]"`:e._`"['" + ${t} + "']"`:o?e._`"/" + ${t}`:e._`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,e.getProperty)(t).toString():"/"+o(t)},y.checkStrictMode=f,y}var g,$,w,_={};function b(){if(g)return _;g=1,Object.defineProperty(_,"__esModule",{value:!0});const e=p(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return _.default=t,_}function P(){return $||($=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=p(),r=v(),n=b();function o(e,r){const o=e.const("err",r);e.if(t._`${n.default.vErrors} === null`,(()=>e.assign(n.default.vErrors,t._`[${o}]`)),t._`${n.default.vErrors}.push(${o})`),e.code(t._`${n.default.errors}++`)}function s(e,r){const{gen:n,validateName:o,schemaEnv:s}=e;s.$async?n.throw(t._`new ${e.ValidationError}(${r})`):(n.assign(t._`${o}.errors`,r),n.return(!1))}e.keywordError={message:({keyword:e})=>t.str`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?t.str`"${e}" keyword must be ${r} ($data)`:t.str`"${e}" keyword is invalid ($data)`},e.reportError=function(r,n=e.keywordError,a,c){const{it:u}=r,{gen:l,compositeRule:d,allErrors:f}=u,h=i(r,n,a);(null!=c?c:d||f)?o(l,h):s(u,t._`[${h}]`)},e.reportExtraError=function(t,r=e.keywordError,a){const{it:c}=t,{gen:u,compositeRule:l,allErrors:d}=c;o(u,i(t,r,a)),l||d||s(c,n.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(n.default.errors,r),e.if(t._`${n.default.vErrors} !== null`,(()=>e.if(r,(()=>e.assign(t._`${n.default.vErrors}.length`,r)),(()=>e.assign(n.default.vErrors,null)))))},e.extendErrors=function({gen:e,keyword:r,schemaValue:o,data:s,errsCount:a,it:i}){if(void 0===a)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",a,n.default.errors,(a=>{e.const(c,t._`${n.default.vErrors}[${a}]`),e.if(t._`${c}.instancePath === undefined`,(()=>e.assign(t._`${c}.instancePath`,(0,t.strConcat)(n.default.instancePath,i.errorPath)))),e.assign(t._`${c}.schemaPath`,t.str`${i.errSchemaPath}/${r}`),i.opts.verbose&&(e.assign(t._`${c}.schema`,o),e.assign(t._`${c}.data`,s))}))};const a={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function i(e,r,o){const{createErrors:s}=e.it;return!1===s?t._`{}`:function(e,r,o={}){const{gen:s,it:i}=e,l=[c(i,o),u(e,o)];return function(e,{params:r,message:o},s){const{keyword:i,data:c,schemaValue:u,it:l}=e,{opts:d,propertyName:f,topSchemaRef:h,schemaPath:p}=l;s.push([a.keyword,i],[a.params,"function"==typeof r?r(e):r||t._`{}`]),d.messages&&s.push([a.message,"function"==typeof o?o(e):o]);d.verbose&&s.push([a.schema,u],[a.parentSchema,t._`${h}${p}`],[n.default.data,c]);f&&s.push([a.propertyName,f])}(e,r,l),s.object(...l)}(e,r,o)}function c({errorPath:e},{instancePath:o}){const s=o?t.str`${e}${(0,r.getErrorPath)(o,r.Type.Str)}`:e;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,s)]}function u({keyword:e,it:{errSchemaPath:n}},{schemaPath:o,parentSchema:s}){let i=s?n:t.str`${n}/${e}`;return o&&(i=t.str`${i}${(0,r.getErrorPath)(o,r.Type.Str)}`),[a.schemaPath,i]}}(a)),a}var E,S={},O={};function k(){if(E)return O;E=1,Object.defineProperty(O,"__esModule",{value:!0}),O.getRules=O.isJSONType=void 0;const e=new Set(["string","number","integer","boolean","null","object","array"]);return O.isJSONType=function(t){return"string"==typeof t&&e.has(t)},O.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}},O}var N,j,x={};function I(){if(N)return x;function e(e,r){return r.rules.some((r=>t(e,r)))}function t(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some((t=>void 0!==e[t])))}return N=1,Object.defineProperty(x,"__esModule",{value:!0}),x.shouldUseRule=x.shouldUseGroup=x.schemaHasRulesForType=void 0,x.schemaHasRulesForType=function({schema:t,self:r},n){const o=r.RULES.types[n];return o&&!0!==o&&e(t,o)},x.shouldUseGroup=e,x.shouldUseRule=t,x}function T(){if(j)return S;j=1,Object.defineProperty(S,"__esModule",{value:!0}),S.reportTypeError=S.checkDataTypes=S.checkDataType=S.coerceAndCheckDataType=S.getJSONTypes=S.getSchemaTypes=S.DataType=void 0;const e=k(),t=I(),r=P(),n=p(),o=v();var s;function a(t){const r=Array.isArray(t)?t:t?[t]:[];if(r.every(e.isJSONType))return r;throw new Error("type must be JSONType or JSONType[]: "+r.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(s||(S.DataType=s={})),S.getSchemaTypes=function(e){const t=a(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},S.getJSONTypes=a,S.coerceAndCheckDataType=function(e,r){const{gen:o,data:a,opts:c}=e,l=function(e,t){return t?e.filter((e=>i.has(e)||"array"===t&&"array"===e)):[]}(r,c.coerceTypes),f=r.length>0&&!(0===l.length&&1===r.length&&(0,t.schemaHasRulesForType)(e,r[0]));if(f){const t=u(r,a,c.strictNumbers,s.Wrong);o.if(t,(()=>{l.length?function(e,t,r){const{gen:o,data:s,opts:a}=e,c=o.let("dataType",n._`typeof ${s}`),l=o.let("coerced",n._`undefined`);"array"===a.coerceTypes&&o.if(n._`${c} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,(()=>o.assign(s,n._`${s}[0]`).assign(c,n._`typeof ${s}`).if(u(t,s,a.strictNumbers),(()=>o.assign(l,s)))));o.if(n._`${l} !== undefined`);for(const e of r)(i.has(e)||"array"===e&&"array"===a.coerceTypes)&&f(e);function f(e){switch(e){case"string":return void o.elseIf(n._`${c} == "number" || ${c} == "boolean"`).assign(l,n._`"" + ${s}`).elseIf(n._`${s} === null`).assign(l,n._`""`);case"number":return void o.elseIf(n._`${c} == "boolean" || ${s} === null
2
+ || (${c} == "string" && ${s} && ${s} == +${s})`).assign(l,n._`+${s}`);case"integer":return void o.elseIf(n._`${c} === "boolean" || ${s} === null
3
+ || (${c} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(l,n._`+${s}`);case"boolean":return void o.elseIf(n._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(l,!1).elseIf(n._`${s} === "true" || ${s} === 1`).assign(l,!0);case"null":return o.elseIf(n._`${s} === "" || ${s} === 0 || ${s} === false`),void o.assign(l,null);case"array":o.elseIf(n._`${c} === "string" || ${c} === "number"
4
+ || ${c} === "boolean" || ${s} === null`).assign(l,n._`[${s}]`)}}o.else(),d(e),o.endIf(),o.if(n._`${l} !== undefined`,(()=>{o.assign(s,l),function({gen:e,parentData:t,parentDataProperty:r},o){e.if(n._`${t} !== undefined`,(()=>e.assign(n._`${t}[${r}]`,o)))}(e,l)}))}(e,r,l):d(e)}))}return f};const i=new Set(["string","number","integer","boolean","null"]);function c(e,t,r,o=s.Correct){const a=o===s.Correct?n.operators.EQ:n.operators.NEQ;let i;switch(e){case"null":return n._`${t} ${a} null`;case"array":i=n._`Array.isArray(${t})`;break;case"object":i=n._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=c(n._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=c();break;default:return n._`typeof ${t} ${a} ${e}`}return o===s.Correct?i:(0,n.not)(i);function c(e=n.nil){return(0,n.and)(n._`typeof ${t} == "number"`,e,r?n._`isFinite(${t})`:n.nil)}}function u(e,t,r,s){if(1===e.length)return c(e[0],t,r,s);let a;const i=(0,o.toHash)(e);if(i.array&&i.object){const e=n._`typeof ${t} != "object"`;a=i.null?e:n._`!${t} || ${e}`,delete i.null,delete i.array,delete i.object}else a=n.nil;i.number&&delete i.integer;for(const e in i)a=(0,n.and)(a,c(e,t,r,s));return a}S.checkDataType=c,S.checkDataTypes=u;const l={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?n._`{type: ${e}}`:n._`{type: ${t}}`};function d(e){const t=function(e){const{gen:t,data:r,schema:n}=e,s=(0,o.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}(e);(0,r.reportError)(t,l)}return S.reportTypeError=d,S}var C,R={};var A,D,M={},V={};function z(){if(A)return V;A=1,Object.defineProperty(V,"__esModule",{value:!0}),V.validateUnion=V.validateArray=V.usePattern=V.callValidateCode=V.schemaProperties=V.allSchemaProperties=V.noPropertyInData=V.propertyInData=V.isOwnProperty=V.hasPropFunc=V.reportMissingProp=V.checkMissingProp=V.checkReportMissingProp=void 0;const e=p(),t=v(),r=b(),n=v();function o(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:e._`Object.prototype.hasOwnProperty`})}function s(t,r,n){return e._`${o(t)}.call(${r}, ${n})`}function a(t,r,n,o){const a=e._`${r}${(0,e.getProperty)(n)} === undefined`;return o?(0,e.or)(a,(0,e.not)(s(t,r,n))):a}function i(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}V.checkReportMissingProp=function(t,r){const{gen:n,data:o,it:s}=t;n.if(a(n,o,r,s.opts.ownProperties),(()=>{t.setParams({missingProperty:e._`${r}`},!0),t.error()}))},V.checkMissingProp=function({gen:t,data:r,it:{opts:n}},o,s){return(0,e.or)(...o.map((o=>(0,e.and)(a(t,r,o,n.ownProperties),e._`${s} = ${o}`))))},V.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},V.hasPropFunc=o,V.isOwnProperty=s,V.propertyInData=function(t,r,n,o){const a=e._`${r}${(0,e.getProperty)(n)} !== undefined`;return o?e._`${a} && ${s(t,r,n)}`:a},V.noPropertyInData=a,V.allSchemaProperties=i,V.schemaProperties=function(e,r){return i(r).filter((n=>!(0,t.alwaysValidSchema)(e,r[n])))},V.callValidateCode=function({schemaCode:t,data:n,it:{gen:o,topSchemaRef:s,schemaPath:a,errorPath:i},it:c},u,l,d){const f=d?e._`${t}, ${n}, ${s}${a}`:n,h=[[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,i)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&h.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const p=e._`${f}, ${o.object(...h)}`;return l!==e.nil?e._`${u}.call(${l}, ${p})`:e._`${u}(${p})`};const c=e._`new RegExp`;return V.usePattern=function({gen:t,it:{opts:r}},o){const s=r.unicodeRegExp?"u":"",{regExp:a}=r.code,i=a(o,s);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:e._`${"new RegExp"===a.code?c:(0,n.useFunc)(t,a)}(${o}, ${s})`})},V.validateArray=function(r){const{gen:n,data:o,keyword:s,it:a}=r,i=n.name("valid");if(a.allErrors){const e=n.let("valid",!0);return c((()=>n.assign(e,!1))),e}return n.var(i,!0),c((()=>n.break())),i;function c(a){const c=n.const("len",e._`${o}.length`);n.forRange("i",0,c,(o=>{r.subschema({keyword:s,dataProp:o,dataPropType:t.Type.Num},i),n.if((0,e.not)(i),a)}))}},V.validateUnion=function(r){const{gen:n,schema:o,keyword:s,it:a}=r;if(!Array.isArray(o))throw new Error("ajv implementation error");if(o.some((e=>(0,t.alwaysValidSchema)(a,e)))&&!a.opts.unevaluated)return;const i=n.let("valid",!1),c=n.name("_valid");n.block((()=>o.forEach(((t,o)=>{const a=r.subschema({keyword:s,schemaProp:o,compositeRule:!0},c);n.assign(i,e._`${i} || ${c}`);r.mergeValidEvaluated(a,c)||n.if((0,e.not)(i))})))),r.result(i,(()=>r.reset()),(()=>r.error(!0)))},V}function q(){if(D)return M;D=1,Object.defineProperty(M,"__esModule",{value:!0}),M.validateKeywordUsage=M.validSchemaType=M.funcKeywordCode=M.macroKeywordCode=void 0;const e=p(),t=b(),r=z(),n=P();function o(t){const{gen:r,data:n,it:o}=t;r.if(o.parentData,(()=>r.assign(n,e._`${o.parentData}[${o.parentDataProperty}]`)))}function s(t,r,n){if(void 0===n)throw new Error(`keyword "${r}" failed to compile`);return t.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,e.stringify)(n)})}return M.macroKeywordCode=function(t,r){const{gen:n,keyword:o,schema:a,parentSchema:i,it:c}=t,u=r.macro.call(c.self,a,i,c),l=s(n,o,u);!1!==c.opts.validateSchema&&c.self.validateSchema(u,!0);const d=n.name("valid");t.subschema({schema:u,schemaPath:e.nil,errSchemaPath:`${c.errSchemaPath}/${o}`,topSchemaRef:l,compositeRule:!0},d),t.pass(d,(()=>t.error(!0)))},M.funcKeywordCode=function(a,i){var c;const{gen:u,keyword:l,schema:d,parentSchema:f,$data:h,it:p}=a;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(p,i);const m=!h&&i.compile?i.compile.call(p.self,d,f,p):i.validate,y=s(u,l,m),v=u.let("valid");function g(n=(i.async?e._`await `:e.nil)){const o=p.opts.passContext?t.default.this:t.default.self,s=!("compile"in i&&!h||!1===i.schema);u.assign(v,e._`${n}${(0,r.callValidateCode)(a,y,o,s)}`,i.modifying)}function $(t){var r;u.if((0,e.not)(null!==(r=i.valid)&&void 0!==r?r:v),t)}a.block$data(v,(function(){if(!1===i.errors)g(),i.modifying&&o(a),$((()=>a.error()));else{const r=i.async?function(){const t=u.let("ruleErrs",null);return u.try((()=>g(e._`await `)),(r=>u.assign(v,!1).if(e._`${r} instanceof ${p.ValidationError}`,(()=>u.assign(t,e._`${r}.errors`)),(()=>u.throw(r))))),t}():function(){const t=e._`${y}.errors`;return u.assign(t,null),g(e.nil),t}();i.modifying&&o(a),$((()=>function(r,o){const{gen:s}=r;s.if(e._`Array.isArray(${o})`,(()=>{s.assign(t.default.vErrors,e._`${t.default.vErrors} === null ? ${o} : ${t.default.vErrors}.concat(${o})`).assign(t.default.errors,e._`${t.default.vErrors}.length`),(0,n.extendErrors)(r)}),(()=>r.error()))}(a,r)))}})),a.ok(null!==(c=i.valid)&&void 0!==c?c:v)},M.validSchemaType=function(e,t,r=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e))},M.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");const a=o.dependencies;if(null==a?void 0:a.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${s}: ${a.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[s])){const e=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},M}var L,U={};var K,F,G={};function H(){return F||(F=1,K=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!=o--;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;0!=o--;){var a=s[o];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r}),K}var J,B,W,Q={exports:{}};function X(){if(J)return Q.exports;J=1;var e=Q.exports=function(e,r,n){"function"==typeof r&&(n=r,r={}),t(r,"function"==typeof(n=r.cb||n)?n:n.pre||function(){},n.post||function(){},e,"",e)};function t(r,n,o,s,a,i,c,u,l,d){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var f in n(s,a,i,c,u,l,d),s){var h=s[f];if(Array.isArray(h)){if(f in e.arrayKeywords)for(var p=0;p<h.length;p++)t(r,n,o,h[p],a+"/"+f+"/"+p,i,a,f,s,p)}else if(f in e.propsKeywords){if(h&&"object"==typeof h)for(var m in h)t(r,n,o,h[m],a+"/"+f+"/"+m.replace(/~/g,"~0").replace(/\//g,"~1"),i,a,f,s,m)}else(f in e.keywords||r.allKeys&&!(f in e.skipKeywords))&&t(r,n,o,h,a+"/"+f,i,a,f,s)}o(s,a,i,c,u,l,d)}}return e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},Q.exports}function Y(){if(B)return G;B=1,Object.defineProperty(G,"__esModule",{value:!0}),G.getSchemaRefs=G.resolveUrl=G.normalizeId=G._getFullPath=G.getFullPath=G.inlineRef=void 0;const e=v(),t=H(),r=X(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);G.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!s(e):!!t&&a(e)<=t)};const o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(e){for(const t in e){if(o.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(s))return!0;if("object"==typeof r&&s(r))return!0}return!1}function a(t){let r=0;for(const o in t){if("$ref"===o)return 1/0;if(r++,!n.has(o)&&("object"==typeof t[o]&&(0,e.eachItem)(t[o],(e=>r+=a(e))),r===1/0))return 1/0}return r}function i(e,t="",r){!1!==r&&(t=l(t));const n=e.parse(t);return c(e,n)}function c(e,t){return e.serialize(t).split("#")[0]+"#"}G.getFullPath=i,G._getFullPath=c;const u=/#\/?$/;function l(e){return e?e.replace(u,""):""}G.normalizeId=l,G.resolveUrl=function(e,t,r){return r=l(r),e.resolve(t,r)};const d=/^[a-z_][-a-z0-9._]*$/i;return G.getSchemaRefs=function(e,n){if("boolean"==typeof e)return{};const{schemaId:o,uriResolver:s}=this.opts,a=l(e[o]||n),c={"":a},u=i(s,a,!1),f={},h=new Set;return r(e,{allKeys:!0},((e,t,r,n)=>{if(void 0===n)return;const s=u+t;let a=c[n];function i(t){const r=this.opts.uriResolver.resolve;if(t=l(a?r(a,t):t),h.has(t))throw m(t);h.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?p(e,n.schema,t):t!==l(s)&&("#"===t[0]?(p(e,f[t],t),f[t]=e):this.refs[t]=s),t}function y(e){if("string"==typeof e){if(!d.test(e))throw new Error(`invalid anchor "${e}"`);i.call(this,`#${e}`)}}"string"==typeof e[o]&&(a=i.call(this,e[o])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),c[t]=a})),f;function p(e,r,n){if(void 0!==r&&!t(e,r))throw m(n)}function m(e){return new Error(`reference "${e}" resolves to more than one schema`)}},G}function Z(){if(W)return o;W=1,Object.defineProperty(o,"__esModule",{value:!0}),o.getData=o.KeywordCxt=o.validateFunctionCode=void 0;const e=function(){if(w)return s;w=1,Object.defineProperty(s,"__esModule",{value:!0}),s.boolOrEmptySchema=s.topBoolOrEmptySchema=void 0;const e=P(),t=p(),r=b(),n={message:"boolean schema is false"};function o(t,r){const{gen:o,data:s}=t,a={gen:o,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,e.reportError)(a,n,void 0,r)}return s.topBoolOrEmptySchema=function(e){const{gen:n,schema:s,validateName:a}=e;!1===s?o(e,!1):"object"==typeof s&&!0===s.$async?n.return(r.default.data):(n.assign(t._`${a}.errors`,null),n.return(!0))},s.boolOrEmptySchema=function(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),o(e)):r.var(t,!0)},s}(),t=T(),r=I(),n=T(),a=function(){if(C)return R;C=1,Object.defineProperty(R,"__esModule",{value:!0}),R.assignDefaults=void 0;const e=p(),t=v();function r(r,n,o){const{gen:s,compositeRule:a,data:i,opts:c}=r;if(void 0===o)return;const u=e._`${i}${(0,e.getProperty)(n)}`;if(a)return void(0,t.checkStrictMode)(r,`default is ignored for: ${u}`);let l=e._`${u} === undefined`;"empty"===c.useDefaults&&(l=e._`${l} || ${u} === null || ${u} === ""`),s.if(l,e._`${u} = ${(0,e.stringify)(o)}`)}return R.assignDefaults=function(e,t){const{properties:n,items:o}=e.schema;if("object"===t&&n)for(const t in n)r(e,t,n[t].default);else"array"===t&&Array.isArray(o)&&o.forEach(((t,n)=>r(e,n,t.default)))},R}(),i=q(),c=function(){if(L)return U;L=1,Object.defineProperty(U,"__esModule",{value:!0}),U.extendSubschemaMode=U.extendSubschemaData=U.getSubschema=void 0;const e=p(),t=v();return U.getSubschema=function(r,{keyword:n,schemaProp:o,schema:s,schemaPath:a,errSchemaPath:i,topSchemaRef:c}){if(void 0!==n&&void 0!==s)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==n){const s=r.schema[n];return void 0===o?{schema:s,schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(n)}`,errSchemaPath:`${r.errSchemaPath}/${n}`}:{schema:s[o],schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(n)}${(0,e.getProperty)(o)}`,errSchemaPath:`${r.errSchemaPath}/${n}/${(0,t.escapeFragment)(o)}`}}if(void 0!==s){if(void 0===a||void 0===i||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:a,topSchemaRef:c,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')},U.extendSubschemaData=function(r,n,{dataProp:o,dataPropType:s,data:a,dataTypes:i,propertyName:c}){if(void 0!==a&&void 0!==o)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:u}=n;if(void 0!==o){const{errorPath:a,dataPathArr:i,opts:c}=n;l(u.let("data",e._`${n.data}${(0,e.getProperty)(o)}`,!0)),r.errorPath=e.str`${a}${(0,t.getErrorPath)(o,s,c.jsPropertySyntax)}`,r.parentDataProperty=e._`${o}`,r.dataPathArr=[...i,r.parentDataProperty]}function l(e){r.data=e,r.dataLevel=n.dataLevel+1,r.dataTypes=[],n.definedProperties=new Set,r.parentData=n.data,r.dataNames=[...n.dataNames,e]}void 0!==a&&(l(a instanceof e.Name?a:u.let("data",a,!0)),void 0!==c&&(r.propertyName=c)),i&&(r.dataTypes=i)},U.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){void 0!==n&&(e.compositeRule=n),void 0!==o&&(e.createErrors=o),void 0!==s&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r},U}(),u=p(),l=b(),d=Y(),f=v(),h=P();function m({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,u._`${l.default.data}, ${l.default.valCxt}`,n.$async,(()=>{e.code(u._`"use strict"; ${y(r,o)}`),function(e,t){e.if(l.default.valCxt,(()=>{e.var(l.default.instancePath,u._`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,u._`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,u._`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,u._`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,u._`${l.default.valCxt}.${l.default.dynamicAnchors}`)}),(()=>{e.var(l.default.instancePath,u._`""`),e.var(l.default.parentData,u._`undefined`),e.var(l.default.parentDataProperty,u._`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,u._`{}`)}))}(e,o),e.code(s)})):e.func(t,u._`${l.default.data}, ${function(e){return u._`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?u._`, ${l.default.dynamicAnchors}={}`:u.nil}}={}`}(o)}`,n.$async,(()=>e.code(y(r,o)).code(s)))}function y(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?u._`/*# sourceURL=${r} */`:u.nil}function g(t,r){_(t)&&(E(t),$(t))?function(e,t){const{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&O(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,d.resolveUrl)(e.opts.uriResolver,e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const s=n.const("_errs",l.default.errors);S(e,s),n.var(t,u._`${s} === ${l.default.errors}`)}(t,r):(0,e.boolOrEmptySchema)(t,r)}function $({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function _(e){return"boolean"!=typeof e.schema}function E(e){(0,f.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,f.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function S(e,r){if(e.opts.jtd)return k(e,[],!1,r);const n=(0,t.getSchemaTypes)(e.schema);k(e,n,!(0,t.coerceAndCheckDataType)(e,n),r)}function O({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){const s=r.$comment;if(!0===o.$comment)e.code(u._`${l.default.self}.logger.log(${s})`);else if("function"==typeof o.$comment){const r=u.str`${n}/$comment`,o=e.scopeValue("root",{ref:t.root});e.code(u._`${l.default.self}.opts.$comment(${s}, ${r}, ${o}.schema)`)}}function k(e,t,o,s){const{gen:a,schema:i,data:c,allErrors:d,opts:h,self:p}=e,{RULES:m}=p;function y(f){(0,r.shouldUseGroup)(i,f)&&(f.type?(a.if((0,n.checkDataType)(f.type,c,h.strictNumbers)),N(e,f),1===t.length&&t[0]===f.type&&o&&(a.else(),(0,n.reportTypeError)(e)),a.endIf()):N(e,f),d||a.if(u._`${l.default.errors} === ${s||0}`))}!i.$ref||!h.ignoreKeywordsWithRef&&(0,f.schemaHasRulesButRef)(i,m)?(h.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach((t=>{x(e.dataTypes,t)||A(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),function(e,t){const r=[];for(const n of e.dataTypes)x(t,n)?r.push(n):t.includes("integer")&&"number"===n&&r.push("integer");e.dataTypes=r}(e,t)})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&A(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){const n=e.self.RULES.all;for(const o in n){const s=n[o];if("object"==typeof s&&(0,r.shouldUseRule)(e.schema,s)){const{type:r}=s.definition;r.length&&!r.some((e=>j(t,e)))&&A(e,`missing type "${r.join(",")}" for keyword "${o}"`)}}}(e,e.dataTypes)}(e,t),a.block((()=>{for(const e of m.rules)y(e);y(m.post)}))):a.block((()=>M(e,"$ref",m.all.$ref.definition)))}function N(e,t){const{gen:n,schema:o,opts:{useDefaults:s}}=e;s&&(0,a.assignDefaults)(e,t.type),n.block((()=>{for(const n of t.rules)(0,r.shouldUseRule)(o,n)&&M(e,n.keyword,n.definition,t.type)}))}function j(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function x(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function A(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,f.checkStrictMode)(e,t,e.opts.strictTypes)}o.validateFunctionCode=function(t){_(t)&&(E(t),$(t))?function(e){const{schema:t,opts:r,gen:n}=e;m(e,(()=>{r.$comment&&t.$comment&&O(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,f.checkStrictMode)(e,"default is ignored in the schema root")}(e),n.let(l.default.vErrors,null),n.let(l.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",u._`${r}.evaluated`),t.if(u._`${e.evaluated}.dynamicProps`,(()=>t.assign(u._`${e.evaluated}.props`,u._`undefined`))),t.if(u._`${e.evaluated}.dynamicItems`,(()=>t.assign(u._`${e.evaluated}.items`,u._`undefined`)))}(e),S(e),function(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if(u._`${l.default.errors} === 0`,(()=>t.return(l.default.data)),(()=>t.throw(u._`new ${o}(${l.default.vErrors})`))):(t.assign(u._`${n}.errors`,l.default.vErrors),s.unevaluated&&function({gen:e,evaluated:t,props:r,items:n}){r instanceof u.Name&&e.assign(u._`${t}.props`,r);n instanceof u.Name&&e.assign(u._`${t}.items`,n)}(e),t.return(u._`${l.default.errors} === 0`))}(e)}))}(t):m(t,(()=>(0,e.topBoolOrEmptySchema)(t)))};class D{constructor(e,t,r){if((0,i.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,f.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",K(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",l.default.errors))}result(e,t,r){this.failResult((0,u.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,u.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(u._`${t} !== undefined && (${(0,u.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?h.reportExtraError:h.reportError)(this,this.def.error,t)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=u.nil){this.gen.block((()=>{this.check$data(e,r),t()}))}check$data(e=u.nil,t=u.nil){if(!this.$data)return;const{gen:r,schemaCode:n,schemaType:o,def:s}=this;r.if((0,u.or)(u._`${n} === undefined`,t)),e!==u.nil&&r.assign(e,!0),(o.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==u.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:o,it:s}=this;return(0,u.or)(function(){if(r.length){if(!(t instanceof u.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return u._`${(0,n.checkDataTypes)(e,t,s.opts.strictNumbers,n.DataType.Wrong)}`}return u.nil}(),function(){if(o.validateSchema){const r=e.scopeValue("validate$data",{ref:o.validateSchema});return u._`!${r}(${t})`}return u.nil}())}subschema(e,t){const r=(0,c.getSubschema)(this.it,e);(0,c.extendSubschemaData)(r,this.it,e),(0,c.extendSubschemaMode)(r,e);const n={...this.it,...r,items:void 0,props:void 0};return g(n,t),n}mergeEvaluated(e,t){const{it:r,gen:n}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=f.mergeEvaluated.props(n,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=f.mergeEvaluated.items(n,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(t,(()=>this.mergeEvaluated(e,u.Name))),!0}}function M(e,t,r,n){const o=new D(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,i.funcKeywordCode)(o,r):"macro"in r?(0,i.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,i.funcKeywordCode)(o,r)}o.KeywordCxt=D;const V=/^\/(?:[^~]|~0|~1)*$/,z=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function K(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(""===e)return l.default.rootData;if("/"===e[0]){if(!V.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=l.default.rootData}else{const a=z.exec(e);if(!a)throw new Error(`Invalid JSON-pointer: ${e}`);const i=+a[1];if(o=a[2],"#"===o){if(i>=t)throw new Error(c("property/index",i));return n[t-i]}if(i>t)throw new Error(c("data",i));if(s=r[t-i],!o)return s}let a=s;const i=o.split("/");for(const e of i)e&&(s=u._`${s}${(0,u.getProperty)((0,f.unescapeJsonPointer)(e))}`,a=u._`${a} && ${s}`);return a;function c(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}return o.getData=K,o}var ee,te={};function re(){if(ee)return te;ee=1,Object.defineProperty(te,"__esModule",{value:!0});class e extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}return te.default=e,te}var ne,oe={};function se(){if(ne)return oe;ne=1,Object.defineProperty(oe,"__esModule",{value:!0});const e=Y();class t extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,e.resolveUrl)(t,r,n),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(t,this.missingRef))}}return oe.default=t,oe}var ae,ie={};function ce(){if(ae)return ie;ae=1,Object.defineProperty(ie,"__esModule",{value:!0}),ie.resolveSchema=ie.getCompilingSchema=ie.resolveRef=ie.compileSchema=ie.SchemaEnv=void 0;const e=p(),t=re(),r=b(),n=Y(),o=v(),s=Z();class a{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,n.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function i(o){const a=u.call(this,o);if(a)return a;const i=(0,n.getFullPath)(this.opts.uriResolver,o.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:d}=this.opts,f=new e.CodeGen(this.scope,{es5:c,lines:l,ownProperties:d});let h;o.$async&&(h=f.scopeValue("Error",{ref:t.default,code:e._`require("ajv/dist/runtime/validation_error").default`}));const p=f.scopeName("validate");o.validateName=p;const m={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue("schema",!0===this.opts.code.source?{ref:o.schema,code:(0,e.stringify)(o.schema)}:{ref:o.schema}),validateName:p,ValidationError:h,schema:o.schema,schemaEnv:o,rootId:i,baseId:o.baseId||i,schemaPath:e.nil,errSchemaPath:o.schemaPath||(this.opts.jtd?"":"#"),errorPath:e._`""`,opts:this.opts,self:this};let y;try{this._compilations.add(o),(0,s.validateFunctionCode)(m),f.optimize(this.opts.code.optimize);const t=f.toString();y=`${f.scopeRefs(r.default.scope)}return ${t}`,this.opts.code.process&&(y=this.opts.code.process(y,o));const n=new Function(`${r.default.self}`,`${r.default.scope}`,y)(this,this.scope.get());if(this.scope.value(p,{ref:n}),n.errors=null,n.schema=o.schema,n.schemaEnv=o,o.$async&&(n.$async=!0),!0===this.opts.code.source&&(n.source={validateName:p,validateCode:t,scopeValues:f._values}),this.opts.unevaluated){const{props:t,items:r}=m;n.evaluated={props:t instanceof e.Name?void 0:t,items:r instanceof e.Name?void 0:r,dynamicProps:t instanceof e.Name,dynamicItems:r instanceof e.Name},n.source&&(n.source.evaluated=(0,e.stringify)(n.evaluated))}return o.validate=n,o}catch(e){throw delete o.validate,delete o.validateName,y&&this.logger.error("Error compiling schema, function code:",y),e}finally{this._compilations.delete(o)}}function c(e){return(0,n.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:i.call(this,e)}function u(e){for(const n of this._compilations)if(r=e,(t=n).schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return n;var t,r}function l(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||d.call(this,e,t)}function d(e,t){const r=this.opts.uriResolver.parse(t),o=(0,n._getFullPath)(this.opts.uriResolver,r);let s=(0,n.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===s)return h.call(this,r,e);const c=(0,n.normalizeId)(o),u=this.refs[c]||this.schemas[c];if("string"==typeof u){const t=d.call(this,e,u);if("object"!=typeof(null==t?void 0:t.schema))return;return h.call(this,r,t)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||i.call(this,u),c===(0,n.normalizeId)(t)){const{schema:t}=u,{schemaId:r}=this.opts,o=t[r];return o&&(s=(0,n.resolveUrl)(this.opts.uriResolver,s,o)),new a({schema:t,schemaId:r,root:e,baseId:s})}return h.call(this,r,u)}}ie.SchemaEnv=a,ie.compileSchema=i,ie.resolveRef=function(e,t,r){var o;r=(0,n.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let i=l.call(this,e,r);if(void 0===i){const n=null===(o=e.localRefs)||void 0===o?void 0:o[r],{schemaId:s}=this.opts;n&&(i=new a({schema:n,schemaId:s,root:e,baseId:t}))}return void 0!==i?e.refs[r]=c.call(this,i):void 0},ie.getCompilingSchema=u,ie.resolveSchema=d;const f=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function h(e,{baseId:t,schema:r,root:s}){var i;if("/"!==(null===(i=e.fragment)||void 0===i?void 0:i[0]))return;for(const s of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,o.unescapeFragment)(s)];if(void 0===e)return;const a="object"==typeof(r=e)&&r[this.opts.schemaId];!f.has(s)&&a&&(t=(0,n.resolveUrl)(this.opts.uriResolver,t,a))}let c;if("boolean"!=typeof r&&r.$ref&&!(0,o.schemaHasRulesButRef)(r,this.RULES)){const e=(0,n.resolveUrl)(this.opts.uriResolver,t,r.$ref);c=d.call(this,s,e)}const{schemaId:u}=this.opts;return c=c||new a({schema:r,schemaId:u,root:s,baseId:t}),c.schema!==c.root.schema?c:void 0}return ie}var ue,le,de,fe,he,pe,me,ye,ve,ge={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1},$e={},we={exports:{}};function _e(){if(fe)return de;fe=1;const{HEX:e}=le?ue:(le=1,ue={HEX:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15}}),t=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function r(e){if(a(e,".")<3)return{host:e,isIPV4:!1};const r=e.match(t)||[],[n]=r;return n?{host:s(n,"."),isIPV4:!0}:{host:e,isIPV4:!1}}function n(t,r=!1){let n="",o=!0;for(const r of t){if(void 0===e[r])return;"0"!==r&&!0===o&&(o=!1),o||(n+=r)}return r&&0===n.length&&(n="0"),n}function o(e){if(a(e,":")<2)return{host:e,isIPV6:!1};const t=function(e){let t=0;const r={error:!1,address:"",zone:""},o=[],s=[];let a=!1,i=!1,c=!1;function u(){if(s.length){if(!1===a){const e=n(s);if(void 0===e)return r.error=!0,!1;o.push(e)}s.length=0}return!0}for(let n=0;n<e.length;n++){const l=e[n];if("["!==l&&"]"!==l)if(":"!==l)if("%"===l){if(!u())break;a=!0}else s.push(l);else{if(!0===i&&(c=!0),!u())break;if(t++,o.push(":"),t>7){r.error=!0;break}n-1>=0&&":"===e[n-1]&&(i=!0)}}return s.length&&(a?r.zone=s.join(""):c?o.push(s.join("")):o.push(n(s))),r.address=o.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,escapedHost:r,isIPV6:!0}}}function s(e,t){let r="",n=!0;const o=e.length;for(let s=0;s<o;s++){const a=e[s];"0"===a&&n?(s+1<=o&&e[s+1]===t||s+1===o)&&(r+=a,n=!1):(n=a===t,r+=a)}return r}function a(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}const i=/^\.\.?\//u,c=/^\/\.(?:\/|$)/u,u=/^\/\.\.(?:\/|$)/u,l=/^\/?(?:.|\n)*?(?=\/|$)/u;return de={recomposeAuthority:function(e){const t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let n=unescape(e.host);const s=r(n);if(s.isIPV4)n=s.host;else{const t=o(s.host);n=!0===t.isIPV6?`[${t.escapedHost}]`:e.host}t.push(n)}return"number"!=typeof e.port&&"string"!=typeof e.port||(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},normalizeComponentEncoding:function(e,t){const r=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=r(e.scheme)),void 0!==e.userinfo&&(e.userinfo=r(e.userinfo)),void 0!==e.host&&(e.host=r(e.host)),void 0!==e.path&&(e.path=r(e.path)),void 0!==e.query&&(e.query=r(e.query)),void 0!==e.fragment&&(e.fragment=r(e.fragment)),e},removeDotSegments:function(e){const t=[];for(;e.length;)if(e.match(i))e=e.replace(i,"");else if(e.match(c))e=e.replace(c,"/");else if(e.match(u))e=e.replace(u,"/"),t.pop();else if("."===e||".."===e)e="";else{const r=e.match(l);if(!r)throw new Error("Unexpected dot segment condition");{const n=r[0];e=e.slice(n.length),t.push(n)}}return t.join("")},normalizeIPv4:r,normalizeIPv6:o,stringArrayToHexStripped:n},de}function be(){if(me)return we.exports;me=1;const{normalizeIPv6:e,normalizeIPv4:t,removeDotSegments:r,recomposeAuthority:n,normalizeComponentEncoding:o}=_e(),s=function(){if(pe)return he;pe=1;const e=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function r(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}function n(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function o(e){const t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const s={scheme:"http",domainHost:!0,parse:n,serialize:o},a={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=r(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(r(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},i={http:s,https:{scheme:"https",domainHost:s.domainHost,parse:n,serialize:o},ws:a,wss:{scheme:"wss",domainHost:a.domainHost,parse:a.parse,serialize:a.serialize},urn:{scheme:"urn",parse:function(e,r){if(!e.path)return e.error="URN can not be parsed",e;const n=e.path.match(t);if(n){const t=r.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];const o=`${t}:${r.nid||e.nid}`,s=i[o];e.path=void 0,s&&(e=s.parse(e,r))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){const r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,s=i[o];s&&(e=s.serialize(e,t));const a=e,c=e.nss;return a.path=`${n||t.nid}:${c}`,t.skipEscape=!0,a},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){const n=t;return n.uuid=n.nss,n.nss=void 0,r.tolerant||n.uuid&&e.test(n.uuid)||(n.error=n.error||"UUID is not valid."),n},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};return he=i}();function a(e,t,n,o){const s={};return o||(e=l(i(e,n),n),t=l(i(t,n),n)),!(n=n||{}).tolerant&&t.scheme?(s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=r(t.path||""),s.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=r(t.path||""),s.query=t.query):(t.path?("/"===t.path.charAt(0)?s.path=r(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:s.path=t.path:s.path="/"+t.path,s.path=r(s.path)),s.query=t.query):(s.path=e.path,void 0!==t.query?s.query=t.query:s.query=e.query),s.userinfo=e.userinfo,s.host=e.host,s.port=e.port),s.scheme=e.scheme),s.fragment=t.fragment,s}function i(e,t){const o={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},a=Object.assign({},t),i=[],c=s[(a.scheme||o.scheme||"").toLowerCase()];c&&c.serialize&&c.serialize(o,a),void 0!==o.path&&(a.skipEscape?o.path=unescape(o.path):(o.path=escape(o.path),void 0!==o.scheme&&(o.path=o.path.split("%3A").join(":")))),"suffix"!==a.reference&&o.scheme&&i.push(o.scheme,":");const u=n(o);if(void 0!==u&&("suffix"!==a.reference&&i.push("//"),i.push(u),o.path&&"/"!==o.path.charAt(0)&&i.push("/")),void 0!==o.path){let e=o.path;a.absolutePath||c&&c.absolutePath||(e=r(e)),void 0===u&&(e=e.replace(/^\/\//u,"/%2F")),i.push(e)}return void 0!==o.query&&i.push("?",o.query),void 0!==o.fragment&&i.push("#",o.fragment),i.join("")}const c=Array.from({length:127},((e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t))));const u=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function l(r,n){const o=Object.assign({},n),a={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=-1!==r.indexOf("%");let l=!1;"suffix"===o.reference&&(r=(o.scheme?o.scheme+":":"")+"//"+r);const d=r.match(u);if(d){if(a.scheme=d[1],a.userinfo=d[3],a.host=d[4],a.port=parseInt(d[5],10),a.path=d[6]||"",a.query=d[7],a.fragment=d[8],isNaN(a.port)&&(a.port=d[5]),a.host){const r=t(a.host);if(!1===r.isIPV4){const t=e(r.host);a.host=t.host.toLowerCase(),l=t.isIPV6}else a.host=r.host,l=!0}void 0!==a.scheme||void 0!==a.userinfo||void 0!==a.host||void 0!==a.port||void 0!==a.query||a.path?void 0===a.scheme?a.reference="relative":void 0===a.fragment?a.reference="absolute":a.reference="uri":a.reference="same-document",o.reference&&"suffix"!==o.reference&&o.reference!==a.reference&&(a.error=a.error||"URI is not a "+o.reference+" reference.");const r=s[(o.scheme||a.scheme||"").toLowerCase()];if(!(o.unicodeSupport||r&&r.unicodeSupport)&&a.host&&(o.domainHost||r&&r.domainHost)&&!1===l&&function(e){let t=0;for(let r=0,n=e.length;r<n;++r)if(t=e.charCodeAt(r),t>126||c[t])return!0;return!1}(a.host))try{a.host=URL.domainToASCII(a.host.toLowerCase())}catch(e){a.error=a.error||"Host's domain name can not be converted to ASCII: "+e}(!r||r&&!r.skipNormalize)&&(i&&void 0!==a.scheme&&(a.scheme=unescape(a.scheme)),i&&void 0!==a.host&&(a.host=unescape(a.host)),a.path&&(a.path=escape(unescape(a.path))),a.fragment&&(a.fragment=encodeURI(decodeURIComponent(a.fragment)))),r&&r.parse&&r.parse(a,o)}else a.error=a.error||"URI can not be parsed.";return a}const d={SCHEMES:s,normalize:function(e,t){return"string"==typeof e?e=i(l(e,t),t):"object"==typeof e&&(e=l(i(e,t),t)),e},resolve:function(e,t,r){const n=Object.assign({scheme:"null"},r);return i(a(l(e,n),l(t,n),n,!0),{...n,skipEscape:!0})},resolveComponents:a,equal:function(e,t,r){return"string"==typeof e?(e=unescape(e),e=i(o(l(e,r),!0),{...r,skipEscape:!0})):"object"==typeof e&&(e=i(o(e,!0),{...r,skipEscape:!0})),"string"==typeof t?(t=unescape(t),t=i(o(l(t,r),!0),{...r,skipEscape:!0})):"object"==typeof t&&(t=i(o(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:i,parse:l};return we.exports=d,we.exports.default=d,we.exports.fastUri=d,we.exports}function Pe(){return ve||(ve=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Z();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=p();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=re(),o=se(),s=k(),a=ce(),i=p(),c=Y(),u=T(),l=v(),d=ge,f=function(){if(ye)return $e;ye=1,Object.defineProperty($e,"__esModule",{value:!0});const e=be();return e.code='require("ajv/dist/runtime/uri").default',$e.default=e,$e}(),h=(e,t)=>new RegExp(e,t);h.code="new RegExp";const m=["removeAdditional","useDefaults","coerceTypes"],y=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},$={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function w(e){var t,r,n,o,s,a,i,c,u,l,d,p,m,y,v,g,$,w,_,b,P,E,S,O,k;const N=e.strict,j=null===(t=e.code)||void 0===t?void 0:t.optimize,x=!0===j||void 0===j?1:j||0,I=null!==(n=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:h,T=null!==(o=e.uriResolver)&&void 0!==o?o:f.default;return{strictSchema:null===(a=null!==(s=e.strictSchema)&&void 0!==s?s:N)||void 0===a||a,strictNumbers:null===(c=null!==(i=e.strictNumbers)&&void 0!==i?i:N)||void 0===c||c,strictTypes:null!==(l=null!==(u=e.strictTypes)&&void 0!==u?u:N)&&void 0!==l?l:"log",strictTuples:null!==(p=null!==(d=e.strictTuples)&&void 0!==d?d:N)&&void 0!==p?p:"log",strictRequired:null!==(y=null!==(m=e.strictRequired)&&void 0!==m?m:N)&&void 0!==y&&y,code:e.code?{...e.code,optimize:x,regExp:I}:{optimize:x,regExp:I},loopRequired:null!==(v=e.loopRequired)&&void 0!==v?v:200,loopEnum:null!==(g=e.loopEnum)&&void 0!==g?g:200,meta:null===($=e.meta)||void 0===$||$,messages:null===(w=e.messages)||void 0===w||w,inlineRefs:null===(_=e.inlineRefs)||void 0===_||_,schemaId:null!==(b=e.schemaId)&&void 0!==b?b:"$id",addUsedSchema:null===(P=e.addUsedSchema)||void 0===P||P,validateSchema:null===(E=e.validateSchema)||void 0===E||E,validateFormats:null===(S=e.validateFormats)||void 0===S||S,unicodeRegExp:null===(O=e.unicodeRegExp)||void 0===O||O,int32range:null===(k=e.int32range)||void 0===k||k,uriResolver:T}}class _{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...w(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new i.ValueScope({scope:{},prefixes:y,es5:t,lines:r}),this.logger=function(e){if(!1===e)return j;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,s.getRules)(),b.call(this,g,e,"NOT SUPPORTED"),b.call(this,$,e,"DEPRECATED","warn"),this._metaOpts=N.call(this),e.formats&&S.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&O.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),E.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let n=d;"id"===r&&(n={...d},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const n=r(t);return"$async"in r||(this.errors=r.errors),n}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(e,t){await s.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||a.call(this,r)}async function s(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function a(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return i.call(this,t),await c.call(this,t.missingSchema),a.call(this,e)}}function i({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await u.call(this,e);this.refs[e]||await s.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function u(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,n);return this}let o;if("object"==typeof e){const{schemaId:t}=this.opts;if(o=e[t],void 0!==o&&"string"!=typeof o)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const n=this.validate(r,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=P.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,n=new a.SchemaEnv({schema:{},schemaId:r});if(t=a.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=P.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(I.call(this,r,t),!t)return(0,l.eachItem)(r,(e=>C.call(this,e))),this;A.call(this,t);const n={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,l.eachItem)(r,0===n.type.length?e=>C.call(this,e,n):e=>n.type.forEach((t=>C.call(this,e,n,t)))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex((t=>t.keyword===e));t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map((e=>`${r}${e.instancePath} ${e.message}`)).reduce(((e,r)=>e+t+r)):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const n of t){const t=n.split("/").slice(1);let o=e;for(const e of t)o=o[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,s=o[e];n&&s&&(o[e]=M(s))}}return e}_removeAllSchemas(e,t){for(const r in e){const n=e[r];t&&!t.test(r)||("string"==typeof n?delete e[r]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[r]))}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s;const{schemaId:i}=this.opts;if("object"==typeof e)s=e[i];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let u=this._cache.get(e);if(void 0!==u)return u;r=(0,c.normalizeId)(s||r);const l=c.getSchemaRefs.call(this,e,r);return u=new a.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:l}),this._cache.set(u.schema,u),o&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=u),n&&this.validateSchema(e,!0),u}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):a.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,e)}finally{this.opts=t}}}function b(e,t,r,n="error"){for(const o in e){const s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function P(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function E(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function S(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function O(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function N(){const e={...this.opts};for(const t of m)delete e[t];return e}_.ValidationError=n.default,_.MissingRefError=o.default,e.default=_;const j={log(){},warn(){},error(){}};const x=/^[a-z_$][a-z0-9_$:-]*$/i;function I(e,t){const{RULES:r}=this;if((0,l.eachItem)(e,(e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!x.test(e))throw new Error(`Keyword ${e} has invalid name`)})),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function C(e,t,r){var n;const o=null==t?void 0:t.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:s}=this;let a=o?s.post:s.rules.find((({type:e})=>e===r));if(a||(a={type:r,rules:[]},s.rules.push(a)),s.keywords[e]=!0,!t)return;const i={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?R.call(this,a,i,t.before):a.rules.push(i),s.all[e]=i,null===(n=t.implements)||void 0===n||n.forEach((e=>this.addKeyword(e)))}function R(e,t,r){const n=e.rules.findIndex((e=>e.keyword===r));n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function A(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=M(t)),e.validateSchema=this.compile(t,!0))}const D={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function M(e){return{anyOf:[e,D]}}}(n)),n}var Ee,Se,Oe={},ke={},Ne={};function je(){if(Se)return ke;Se=1,Object.defineProperty(ke,"__esModule",{value:!0});const e=function(){if(Ee)return Ne;Ee=1,Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.callRef=Ne.getValidate=void 0;const e=se(),t=z(),r=p(),n=b(),o=ce(),s=v(),a={keyword:"$ref",schemaType:"string",code(t){const{gen:n,schema:s,it:a}=t,{baseId:u,schemaEnv:l,validateName:d,opts:f,self:h}=a,{root:p}=l;if(("#"===s||"#/"===s)&&u===p.baseId)return function(){if(l===p)return c(t,d,l,l.$async);const e=n.scopeValue("root",{ref:p});return c(t,r._`${e}.validate`,p,p.$async)}();const m=o.resolveRef.call(h,p,u,s);if(void 0===m)throw new e.default(a.opts.uriResolver,u,s);return m instanceof o.SchemaEnv?function(e){const r=i(t,e);c(t,r,e,e.$async)}(m):function(e){const o=n.scopeValue("schema",!0===f.code.source?{ref:e,code:(0,r.stringify)(e)}:{ref:e}),a=n.name("valid"),i=t.subschema({schema:e,dataTypes:[],schemaPath:r.nil,topSchemaRef:o,errSchemaPath:s},a);t.mergeEvaluated(i),t.ok(a)}(m)}};function i(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):r._`${n.scopeValue("wrapper",{ref:t})}.validate`}function c(e,o,a,i){const{gen:c,it:u}=e,{allErrors:l,schemaEnv:d,opts:f}=u,h=f.passContext?n.default.this:r.nil;function p(e){const t=r._`${e}.errors`;c.assign(n.default.vErrors,r._`${n.default.vErrors} === null ? ${t} : ${n.default.vErrors}.concat(${t})`),c.assign(n.default.errors,r._`${n.default.vErrors}.length`)}function m(e){var t;if(!u.opts.unevaluated)return;const n=null===(t=null==a?void 0:a.validate)||void 0===t?void 0:t.evaluated;if(!0!==u.props)if(n&&!n.dynamicProps)void 0!==n.props&&(u.props=s.mergeEvaluated.props(c,n.props,u.props));else{const t=c.var("props",r._`${e}.evaluated.props`);u.props=s.mergeEvaluated.props(c,t,u.props,r.Name)}if(!0!==u.items)if(n&&!n.dynamicItems)void 0!==n.items&&(u.items=s.mergeEvaluated.items(c,n.items,u.items));else{const t=c.var("items",r._`${e}.evaluated.items`);u.items=s.mergeEvaluated.items(c,t,u.items,r.Name)}}i?function(){if(!d.$async)throw new Error("async schema referenced by sync schema");const n=c.let("valid");c.try((()=>{c.code(r._`await ${(0,t.callValidateCode)(e,o,h)}`),m(o),l||c.assign(n,!0)}),(e=>{c.if(r._`!(${e} instanceof ${u.ValidationError})`,(()=>c.throw(e))),p(e),l||c.assign(n,!1)})),e.ok(n)}():e.result((0,t.callValidateCode)(e,o,h),(()=>m(o)),(()=>p(o)))}return Ne.getValidate=i,Ne.callRef=c,Ne.default=a,Ne}(),t=["$schema","id","$defs",{keyword:"$comment"},"definitions",e.default];return ke.default=t,ke}var xe,Ie={},Te={};var Ce,Re={};var Ae,De={};var Me,Ve,ze={},qe={};function Le(){if(Ve)return ze;Ve=1,Object.defineProperty(ze,"__esModule",{value:!0});const e=p(),t=v(),r=function(){if(Me)return qe;function e(e){const t=e.length;let r,n=0,o=0;for(;o<t;)n++,r=e.charCodeAt(o++),r>=55296&&r<=56319&&o<t&&(r=e.charCodeAt(o),56320==(64512&r)&&o++);return n}return Me=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',qe}(),n={message({keyword:t,schemaCode:r}){const n="maxLength"===t?"more":"fewer";return e.str`must NOT have ${n} than ${r} characters`},params:({schemaCode:t})=>e._`{limit: ${t}}`},o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:n,code(n){const{keyword:o,data:s,schemaCode:a,it:i}=n,c="maxLength"===o?e.operators.GT:e.operators.LT,u=!1===i.opts.unicode?e._`${s}.length`:e._`${(0,t.useFunc)(n.gen,r.default)}(${s})`;n.fail$data(e._`${u} ${c} ${a}`)}};return ze.default=o,ze}var Ue,Ke={};var Fe,Ge={};var He,Je={};function Be(){if(He)return Je;He=1,Object.defineProperty(Je,"__esModule",{value:!0});const e=z(),t=p(),r=v(),n={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>t.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>t._`{missingProperty: ${e}}`},code(n){const{gen:o,schema:s,schemaCode:a,data:i,$data:c,it:u}=n,{opts:l}=u;if(!c&&0===s.length)return;const d=s.length>=l.loopRequired;if(u.allErrors?function(){if(d||c)n.block$data(t.nil,f);else for(const t of s)(0,e.checkReportMissingProp)(n,t)}():function(){const r=o.let("missing");if(d||c){const s=o.let("valid",!0);n.block$data(s,(()=>function(r,s){n.setParams({missingProperty:r}),o.forOf(r,a,(()=>{o.assign(s,(0,e.propertyInData)(o,i,r,l.ownProperties)),o.if((0,t.not)(s),(()=>{n.error(),o.break()}))}),t.nil)}(r,s))),n.ok(s)}else o.if((0,e.checkMissingProp)(n,s,r)),(0,e.reportMissingProp)(n,r),o.else()}(),l.strictRequired){const e=n.parentSchema.properties,{definedProperties:t}=n.it;for(const n of s)if(void 0===(null==e?void 0:e[n])&&!t.has(n)){const e=`required property "${n}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(u,e,u.opts.strictRequired)}}function f(){o.forOf("prop",a,(t=>{n.setParams({missingProperty:t}),o.if((0,e.noPropertyInData)(o,i,t,l.ownProperties),(()=>n.error()))}))}}};return Je.default=n,Je}var We,Qe={};var Xe,Ye,Ze={},et={};function tt(){if(Xe)return et;Xe=1,Object.defineProperty(et,"__esModule",{value:!0});const e=H();return e.code='require("ajv/dist/runtime/equal").default',et.default=e,et}function rt(){if(Ye)return Ze;Ye=1,Object.defineProperty(Ze,"__esModule",{value:!0});const e=T(),t=p(),r=v(),n=tt(),o={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:r}})=>t.str`must NOT have duplicate items (items ## ${r} and ${e} are identical)`,params:({params:{i:e,j:r}})=>t._`{i: ${e}, j: ${r}}`},code(o){const{gen:s,data:a,$data:i,schema:c,parentSchema:u,schemaCode:l,it:d}=o;if(!i&&!c)return;const f=s.let("valid"),h=u.items?(0,e.getSchemaTypes)(u.items):[];function p(r,n){const i=s.name("item"),c=(0,e.checkDataTypes)(h,i,d.opts.strictNumbers,e.DataType.Wrong),u=s.const("indices",t._`{}`);s.for(t._`;${r}--;`,(()=>{s.let(i,t._`${a}[${r}]`),s.if(c,t._`continue`),h.length>1&&s.if(t._`typeof ${i} == "string"`,t._`${i} += "_"`),s.if(t._`typeof ${u}[${i}] == "number"`,(()=>{s.assign(n,t._`${u}[${i}]`),o.error(),s.assign(f,!1).break()})).code(t._`${u}[${i}] = ${r}`)}))}function m(e,i){const c=(0,r.useFunc)(s,n.default),u=s.name("outer");s.label(u).for(t._`;${e}--;`,(()=>s.for(t._`${i} = ${e}; ${i}--;`,(()=>s.if(t._`${c}(${a}[${e}], ${a}[${i}])`,(()=>{o.error(),s.assign(f,!1).break(u)}))))))}o.block$data(f,(function(){const e=s.let("i",t._`${a}.length`),r=s.let("j");o.setParams({i:e,j:r}),s.assign(f,!0),s.if(t._`${e} > 1`,(()=>(h.length>0&&!h.some((e=>"object"===e||"array"===e))?p:m)(e,r)))}),t._`${l} === false`),o.ok(f)}};return Ze.default=o,Ze}var nt,ot={};var st,at,it={};function ct(){if(st)return it;st=1,Object.defineProperty(it,"__esModule",{value:!0});const e=p(),t=v(),r=tt(),n={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>e._`{allowedValues: ${t}}`},code(n){const{gen:o,data:s,$data:a,schema:i,schemaCode:c,it:u}=n;if(!a&&0===i.length)throw new Error("enum must have non-empty array");const l=i.length>=u.opts.loopEnum;let d;const f=()=>null!=d?d:d=(0,t.useFunc)(o,r.default);let h;if(l||a)h=o.let("valid"),n.block$data(h,(function(){o.assign(h,!1),o.forOf("v",c,(t=>o.if(e._`${f()}(${s}, ${t})`,(()=>o.assign(h,!0).break()))))}));else{if(!Array.isArray(i))throw new Error("ajv implementation error");const t=o.const("vSchema",c);h=(0,e.or)(...i.map(((r,n)=>function(t,r){const n=i[r];return"object"==typeof n&&null!==n?e._`${f()}(${s}, ${t}[${r}])`:e._`${s} === ${n}`}(t,n))))}n.pass(h)}};return it.default=n,it}function ut(){if(at)return Ie;at=1,Object.defineProperty(Ie,"__esModule",{value:!0});const e=function(){if(xe)return Te;xe=1,Object.defineProperty(Te,"__esModule",{value:!0});const e=Pe(),t=p().operators,r={maximum:{exclusive:"exclusiveMaximum",ops:[{okStr:"<=",ok:t.LTE,fail:t.GT},{okStr:"<",ok:t.LT,fail:t.GTE}]},minimum:{exclusive:"exclusiveMinimum",ops:[{okStr:">=",ok:t.GTE,fail:t.LT},{okStr:">",ok:t.GT,fail:t.LTE}]}},n={message:t=>e.str`must be ${s(t).okStr} ${t.schemaCode}`,params:t=>e._`{comparison: ${s(t).okStr}, limit: ${t.schemaCode}}`},o={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:n,code(t){const{data:r,schemaCode:n}=t;t.fail$data(e._`${r} ${s(t).fail} ${n} || isNaN(${r})`)}};function s(e){var t;const n=e.keyword,o=(null===(t=e.parentSchema)||void 0===t?void 0:t[r[n].exclusive])?1:0;return r[n].ops[o]}return Te.default=o,Te}(),t=function(){if(Ce)return Re;Ce=1,Object.defineProperty(Re,"__esModule",{value:!0});const e={exclusiveMaximum:"maximum",exclusiveMinimum:"minimum"},t={keyword:Object.keys(e),type:"number",schemaType:"boolean",code({keyword:t,parentSchema:r}){const n=e[t];if(void 0===r[n])throw new Error(`${t} can only be used with ${n}`)}};return Re.default=t,Re}(),r=function(){if(Ae)return De;Ae=1,Object.defineProperty(De,"__esModule",{value:!0});const e=p(),t={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>e.str`must be multiple of ${t}`,params:({schemaCode:t})=>e._`{multipleOf: ${t}}`},code(t){const{gen:r,data:n,schemaCode:o,it:s}=t,a=s.opts.multipleOfPrecision,i=r.let("res"),c=a?e._`Math.abs(Math.round(${i}) - ${i}) > 1e-${a}`:e._`${i} !== parseInt(${i})`;t.fail$data(e._`(${o} === 0 || (${i} = ${n}/${o}, ${c}))`)}};return De.default=t,De}(),n=Le(),o=function(){if(Ue)return Ke;Ue=1,Object.defineProperty(Ke,"__esModule",{value:!0});const e=z(),t=p(),r={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>t.str`must match pattern "${e}"`,params:({schemaCode:e})=>t._`{pattern: ${e}}`},code(r){const{data:n,$data:o,schema:s,schemaCode:a,it:i}=r,c=i.opts.unicodeRegExp?"u":"",u=o?t._`(new RegExp(${a}, ${c}))`:(0,e.usePattern)(r,s);r.fail$data(t._`!${u}.test(${n})`)}};return Ke.default=r,Ke}(),s=function(){if(Fe)return Ge;Fe=1,Object.defineProperty(Ge,"__esModule",{value:!0});const e=p(),t={message({keyword:t,schemaCode:r}){const n="maxProperties"===t?"more":"fewer";return e.str`must NOT have ${n} than ${r} properties`},params:({schemaCode:t})=>e._`{limit: ${t}}`},r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:t,code(t){const{keyword:r,data:n,schemaCode:o}=t,s="maxProperties"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`Object.keys(${n}).length ${s} ${o}`)}};return Ge.default=r,Ge}(),a=Be(),i=function(){if(We)return Qe;We=1,Object.defineProperty(Qe,"__esModule",{value:!0});const e=p(),t={message({keyword:t,schemaCode:r}){const n="maxItems"===t?"more":"fewer";return e.str`must NOT have ${n} than ${r} items`},params:({schemaCode:t})=>e._`{limit: ${t}}`},r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:t,code(t){const{keyword:r,data:n,schemaCode:o}=t,s="maxItems"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`${n}.length ${s} ${o}`)}};return Qe.default=r,Qe}(),c=rt(),u=function(){if(nt)return ot;nt=1,Object.defineProperty(ot,"__esModule",{value:!0});const e=p(),t=v(),r=tt(),n={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>e._`{allowedValue: ${t}}`},code(n){const{gen:o,data:s,$data:a,schemaCode:i,schema:c}=n;a||c&&"object"==typeof c?n.fail$data(e._`!${(0,t.useFunc)(o,r.default)}(${s}, ${i})`):n.fail(e._`${c} !== ${s}`)}};return ot.default=n,ot}(),l=ct(),d=[e.default,t.default,r.default,n.default,o.default,s.default,a.default,i.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,l.default];return Ie.default=d,Ie}var lt,dt={},ft={};function ht(){if(lt)return ft;lt=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.validateAdditionalItems=void 0;const e=p(),t=v(),r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(e){const{parentSchema:r,it:o}=e,{items:s}=r;Array.isArray(s)?n(e,s):(0,t.checkStrictMode)(o,'"additionalItems" is ignored when "items" is not an array of schemas')}};function n(r,n){const{gen:o,schema:s,data:a,keyword:i,it:c}=r;c.items=!0;const u=o.const("len",e._`${a}.length`);if(!1===s)r.setParams({len:n.length}),r.pass(e._`${u} <= ${n.length}`);else if("object"==typeof s&&!(0,t.alwaysValidSchema)(c,s)){const s=o.var("valid",e._`${u} <= ${n.length}`);o.if((0,e.not)(s),(()=>function(s){o.forRange("i",n.length,u,(n=>{r.subschema({keyword:i,dataProp:n,dataPropType:t.Type.Num},s),c.allErrors||o.if((0,e.not)(s),(()=>o.break()))}))}(s))),r.ok(s)}}return ft.validateAdditionalItems=n,ft.default=r,ft}var pt,mt,yt={},vt={};function gt(){if(pt)return vt;pt=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.validateTuple=void 0;const e=p(),t=v(),r=z(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:n,it:s}=e;if(Array.isArray(n))return o(e,"additionalItems",n);s.items=!0,(0,t.alwaysValidSchema)(s,n)||e.ok((0,r.validateArray)(e))}};function o(r,n,o=r.schema){const{gen:s,parentSchema:a,data:i,keyword:c,it:u}=r;!function(e){const{opts:r,errSchemaPath:s}=u,a=o.length,i=a===e.minItems&&(a===e.maxItems||!1===e[n]);if(r.strictTuples&&!i){const e=`"${c}" is ${a}-tuple, but minItems or maxItems/${n} are not specified or different at path "${s}"`;(0,t.checkStrictMode)(u,e,r.strictTuples)}}(a),u.opts.unevaluated&&o.length&&!0!==u.items&&(u.items=t.mergeEvaluated.items(s,o.length,u.items));const l=s.name("valid"),d=s.const("len",e._`${i}.length`);o.forEach(((n,o)=>{(0,t.alwaysValidSchema)(u,n)||(s.if(e._`${d} > ${o}`,(()=>r.subschema({keyword:c,schemaProp:o,dataProp:o},l))),r.ok(l))}))}return vt.validateTuple=o,vt.default=n,vt}var $t,wt={};var _t,bt={};function Pt(){if(_t)return bt;_t=1,Object.defineProperty(bt,"__esModule",{value:!0});const e=p(),t=v(),r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:r}})=>void 0===r?e.str`must contain at least ${t} valid item(s)`:e.str`must contain at least ${t} and no more than ${r} valid item(s)`,params:({params:{min:t,max:r}})=>void 0===r?e._`{minContains: ${t}}`:e._`{minContains: ${t}, maxContains: ${r}}`},code(r){const{gen:n,schema:o,parentSchema:s,data:a,it:i}=r;let c,u;const{minContains:l,maxContains:d}=s;i.opts.next?(c=void 0===l?1:l,u=d):c=1;const f=n.const("len",e._`${a}.length`);if(r.setParams({min:c,max:u}),void 0===u&&0===c)return void(0,t.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==u&&c>u)return(0,t.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),void r.fail();if((0,t.alwaysValidSchema)(i,o)){let t=e._`${f} >= ${c}`;return void 0!==u&&(t=e._`${t} && ${f} <= ${u}`),void r.pass(t)}i.items=!0;const h=n.name("valid");function p(){const t=n.name("_valid"),r=n.let("count",0);m(t,(()=>n.if(t,(()=>function(t){n.code(e._`${t}++`),void 0===u?n.if(e._`${t} >= ${c}`,(()=>n.assign(h,!0).break())):(n.if(e._`${t} > ${u}`,(()=>n.assign(h,!1).break())),1===c?n.assign(h,!0):n.if(e._`${t} >= ${c}`,(()=>n.assign(h,!0))))}(r)))))}function m(e,o){n.forRange("i",0,f,(n=>{r.subschema({keyword:"contains",dataProp:n,dataPropType:t.Type.Num,compositeRule:!0},e),o()}))}void 0===u&&1===c?m(h,(()=>n.if(h,(()=>n.break())))):0===c?(n.let(h,!0),void 0!==u&&n.if(e._`${a}.length > 0`,p)):(n.let(h,!1),p()),r.result(h,(()=>r.reset()))}};return bt.default=r,bt}var Et,St={};function Ot(){return Et||(Et=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=p(),r=v(),n=z();e.error={message:({params:{property:e,depsCount:r,deps:n}})=>{const o=1===r?"property":"properties";return t.str`must have ${o} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:r,deps:n,missingProperty:o}})=>t._`{property: ${e},
5
+ missingProperty: ${o},
6
+ depsCount: ${r},
7
+ deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const n in e){if("__proto__"===n)continue;(Array.isArray(e[n])?t:r)[n]=e[n]}return[t,r]}(e);s(e,t),a(e,r)}};function s(e,r=e.schema){const{gen:o,data:s,it:a}=e;if(0===Object.keys(r).length)return;const i=o.let("missing");for(const c in r){const u=r[c];if(0===u.length)continue;const l=(0,n.propertyInData)(o,s,c,a.opts.ownProperties);e.setParams({property:c,depsCount:u.length,deps:u.join(", ")}),a.allErrors?o.if(l,(()=>{for(const t of u)(0,n.checkReportMissingProp)(e,t)})):(o.if(t._`${l} && (${(0,n.checkMissingProp)(e,u,i)})`),(0,n.reportMissingProp)(e,i),o.else())}}function a(e,t=e.schema){const{gen:o,data:s,keyword:a,it:i}=e,c=o.name("valid");for(const u in t)(0,r.alwaysValidSchema)(i,t[u])||(o.if((0,n.propertyInData)(o,s,u,i.opts.ownProperties),(()=>{const t=e.subschema({keyword:a,schemaProp:u},c);e.mergeValidEvaluated(t,c)}),(()=>o.var(c,!0))),e.ok(c))}e.validatePropertyDeps=s,e.validateSchemaDeps=a,e.default=o}(St)),St}var kt,Nt={};var jt,xt={};function It(){if(jt)return xt;jt=1,Object.defineProperty(xt,"__esModule",{value:!0});const e=z(),t=p(),r=b(),n=v(),o={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>t._`{additionalProperty: ${e.additionalProperty}}`},code(o){const{gen:s,schema:a,parentSchema:i,data:c,errsCount:u,it:l}=o;if(!u)throw new Error("ajv implementation error");const{allErrors:d,opts:f}=l;if(l.props=!0,"all"!==f.removeAdditional&&(0,n.alwaysValidSchema)(l,a))return;const h=(0,e.allSchemaProperties)(i.properties),p=(0,e.allSchemaProperties)(i.patternProperties);function m(e){s.code(t._`delete ${c}[${e}]`)}function y(e){if("all"===f.removeAdditional||f.removeAdditional&&!1===a)m(e);else{if(!1===a)return o.setParams({additionalProperty:e}),o.error(),void(d||s.break());if("object"==typeof a&&!(0,n.alwaysValidSchema)(l,a)){const r=s.name("valid");"failing"===f.removeAdditional?(v(e,r,!1),s.if((0,t.not)(r),(()=>{o.reset(),m(e)}))):(v(e,r),d||s.if((0,t.not)(r),(()=>s.break())))}}}function v(e,t,r){const s={keyword:"additionalProperties",dataProp:e,dataPropType:n.Type.Str};!1===r&&Object.assign(s,{compositeRule:!0,createErrors:!1,allErrors:!1}),o.subschema(s,t)}s.forIn("key",c,(r=>{h.length||p.length?s.if(function(r){let a;if(h.length>8){const t=(0,n.schemaRefOrVal)(l,i.properties,"properties");a=(0,e.isOwnProperty)(s,t,r)}else a=h.length?(0,t.or)(...h.map((e=>t._`${r} === ${e}`))):t.nil;return p.length&&(a=(0,t.or)(a,...p.map((n=>t._`${(0,e.usePattern)(o,n)}.test(${r})`)))),(0,t.not)(a)}(r),(()=>y(r))):y(r)})),o.ok(t._`${u} === ${r.default.errors}`)}};return xt.default=o,xt}var Tt,Ct={};var Rt,At={};var Dt,Mt={};var Vt,zt={};var qt,Lt={};var Ut,Kt={};var Ft,Gt={};var Ht,Jt,Bt={};function Wt(){if(Jt)return dt;Jt=1,Object.defineProperty(dt,"__esModule",{value:!0});const e=ht(),t=function(){if(mt)return yt;mt=1,Object.defineProperty(yt,"__esModule",{value:!0});const e=gt(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,e.validateTuple)(t,"items")};return yt.default=t,yt}(),r=gt(),n=function(){if($t)return wt;$t=1,Object.defineProperty(wt,"__esModule",{value:!0});const e=p(),t=v(),r=z(),n=ht(),o={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(e){const{schema:o,parentSchema:s,it:a}=e,{prefixItems:i}=s;a.items=!0,(0,t.alwaysValidSchema)(a,o)||(i?(0,n.validateAdditionalItems)(e,i):e.ok((0,r.validateArray)(e)))}};return wt.default=o,wt}(),o=Pt(),s=Ot(),a=function(){if(kt)return Nt;kt=1,Object.defineProperty(Nt,"__esModule",{value:!0});const e=p(),t=v(),r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>e._`{propertyName: ${t.propertyName}}`},code(r){const{gen:n,schema:o,data:s,it:a}=r;if((0,t.alwaysValidSchema)(a,o))return;const i=n.name("valid");n.forIn("key",s,(t=>{r.setParams({propertyName:t}),r.subschema({keyword:"propertyNames",data:t,dataTypes:["string"],propertyName:t,compositeRule:!0},i),n.if((0,e.not)(i),(()=>{r.error(!0),a.allErrors||n.break()}))})),r.ok(i)}};return Nt.default=r,Nt}(),i=It(),c=function(){if(Tt)return Ct;Tt=1,Object.defineProperty(Ct,"__esModule",{value:!0});const e=Z(),t=z(),r=v(),n=It(),o={keyword:"properties",type:"object",schemaType:"object",code(o){const{gen:s,schema:a,parentSchema:i,data:c,it:u}=o;"all"===u.opts.removeAdditional&&void 0===i.additionalProperties&&n.default.code(new e.KeywordCxt(u,n.default,"additionalProperties"));const l=(0,t.allSchemaProperties)(a);for(const e of l)u.definedProperties.add(e);u.opts.unevaluated&&l.length&&!0!==u.props&&(u.props=r.mergeEvaluated.props(s,(0,r.toHash)(l),u.props));const d=l.filter((e=>!(0,r.alwaysValidSchema)(u,a[e])));if(0===d.length)return;const f=s.name("valid");for(const e of d)h(e)?p(e):(s.if((0,t.propertyInData)(s,c,e,u.opts.ownProperties)),p(e),u.allErrors||s.else().var(f,!0),s.endIf()),o.it.definedProperties.add(e),o.ok(f);function h(e){return u.opts.useDefaults&&!u.compositeRule&&void 0!==a[e].default}function p(e){o.subschema({keyword:"properties",schemaProp:e,dataProp:e},f)}}};return Ct.default=o,Ct}(),u=function(){if(Rt)return At;Rt=1,Object.defineProperty(At,"__esModule",{value:!0});const e=z(),t=p(),r=v(),n=v(),o={keyword:"patternProperties",type:"object",schemaType:"object",code(o){const{gen:s,schema:a,data:i,parentSchema:c,it:u}=o,{opts:l}=u,d=(0,e.allSchemaProperties)(a),f=d.filter((e=>(0,r.alwaysValidSchema)(u,a[e])));if(0===d.length||f.length===d.length&&(!u.opts.unevaluated||!0===u.props))return;const h=l.strictSchema&&!l.allowMatchingProperties&&c.properties,p=s.name("valid");!0===u.props||u.props instanceof t.Name||(u.props=(0,n.evaluatedPropsToName)(s,u.props));const{props:m}=u;function y(e){for(const t in h)new RegExp(e).test(t)&&(0,r.checkStrictMode)(u,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){s.forIn("key",i,(a=>{s.if(t._`${(0,e.usePattern)(o,r)}.test(${a})`,(()=>{const e=f.includes(r);e||o.subschema({keyword:"patternProperties",schemaProp:r,dataProp:a,dataPropType:n.Type.Str},p),u.opts.unevaluated&&!0!==m?s.assign(t._`${m}[${a}]`,!0):e||u.allErrors||s.if((0,t.not)(p),(()=>s.break()))}))}))}!function(){for(const e of d)h&&y(e),u.allErrors?v(e):(s.var(p,!0),v(e),s.if(p))}()}};return At.default=o,At}(),l=function(){if(Dt)return Mt;Dt=1,Object.defineProperty(Mt,"__esModule",{value:!0});const e=v(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:r,schema:n,it:o}=t;if((0,e.alwaysValidSchema)(o,n))return void t.fail();const s=r.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),t.failResult(s,(()=>t.reset()),(()=>t.error()))},error:{message:"must NOT be valid"}};return Mt.default=t,Mt}(),d=function(){if(Vt)return zt;Vt=1,Object.defineProperty(zt,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:z().validateUnion,error:{message:"must match a schema in anyOf"}};return zt.default=e,zt}(),f=function(){if(qt)return Lt;qt=1,Object.defineProperty(Lt,"__esModule",{value:!0});const e=p(),t=v(),r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>e._`{passingSchemas: ${t.passing}}`},code(r){const{gen:n,schema:o,parentSchema:s,it:a}=r;if(!Array.isArray(o))throw new Error("ajv implementation error");if(a.opts.discriminator&&s.discriminator)return;const i=o,c=n.let("valid",!1),u=n.let("passing",null),l=n.name("_valid");r.setParams({passing:u}),n.block((function(){i.forEach(((o,s)=>{let i;(0,t.alwaysValidSchema)(a,o)?n.var(l,!0):i=r.subschema({keyword:"oneOf",schemaProp:s,compositeRule:!0},l),s>0&&n.if(e._`${l} && ${c}`).assign(c,!1).assign(u,e._`[${u}, ${s}]`).else(),n.if(l,(()=>{n.assign(c,!0),n.assign(u,s),i&&r.mergeEvaluated(i,e.Name)}))}))})),r.result(c,(()=>r.reset()),(()=>r.error(!0)))}};return Lt.default=r,Lt}(),h=function(){if(Ut)return Kt;Ut=1,Object.defineProperty(Kt,"__esModule",{value:!0});const e=v(),t={keyword:"allOf",schemaType:"array",code(t){const{gen:r,schema:n,it:o}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");const s=r.name("valid");n.forEach(((r,n)=>{if((0,e.alwaysValidSchema)(o,r))return;const a=t.subschema({keyword:"allOf",schemaProp:n},s);t.ok(s),t.mergeEvaluated(a)}))}};return Kt.default=t,Kt}(),m=function(){if(Ft)return Gt;Ft=1,Object.defineProperty(Gt,"__esModule",{value:!0});const e=p(),t=v(),r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>e.str`must match "${t.ifClause}" schema`,params:({params:t})=>e._`{failingKeyword: ${t.ifClause}}`},code(r){const{gen:o,parentSchema:s,it:a}=r;void 0===s.then&&void 0===s.else&&(0,t.checkStrictMode)(a,'"if" without "then" and "else" is ignored');const i=n(a,"then"),c=n(a,"else");if(!i&&!c)return;const u=o.let("valid",!0),l=o.name("_valid");if(function(){const e=r.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);r.mergeEvaluated(e)}(),r.reset(),i&&c){const e=o.let("ifClause");r.setParams({ifClause:e}),o.if(l,d("then",e),d("else",e))}else i?o.if(l,d("then")):o.if((0,e.not)(l),d("else"));function d(t,n){return()=>{const s=r.subschema({keyword:t},l);o.assign(u,l),r.mergeValidEvaluated(s,u),n?o.assign(n,e._`${t}`):r.setParams({ifClause:t})}}r.pass(u,(()=>r.error(!0)))}};function n(e,r){const n=e.schema[r];return void 0!==n&&!(0,t.alwaysValidSchema)(e,n)}return Gt.default=r,Gt}(),y=function(){if(Ht)return Bt;Ht=1,Object.defineProperty(Bt,"__esModule",{value:!0});const e=v(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:r,it:n}){void 0===r.if&&(0,e.checkStrictMode)(n,`"${t}" without "if" is ignored`)}};return Bt.default=t,Bt}();return dt.default=function(p=!1){const v=[l.default,d.default,f.default,h.default,m.default,y.default,a.default,i.default,s.default,c.default,u.default];return p?v.push(t.default,n.default):v.push(e.default,r.default),v.push(o.default),v},dt}var Qt,Xt,Yt,Zt={},er={};function tr(){if(Qt)return er;Qt=1,Object.defineProperty(er,"__esModule",{value:!0});const e=p(),t={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>e.str`must match format "${t}"`,params:({schemaCode:t})=>e._`{format: ${t}}`},code(t,r){const{gen:n,data:o,$data:s,schema:a,schemaCode:i,it:c}=t,{opts:u,errSchemaPath:l,schemaEnv:d,self:f}=c;u.validateFormats&&(s?function(){const s=n.scopeValue("formats",{ref:f.formats,code:u.code.formats}),a=n.const("fDef",e._`${s}[${i}]`),c=n.let("fType"),l=n.let("format");n.if(e._`typeof ${a} == "object" && !(${a} instanceof RegExp)`,(()=>n.assign(c,e._`${a}.type || "string"`).assign(l,e._`${a}.validate`)),(()=>n.assign(c,e._`"string"`).assign(l,a))),t.fail$data((0,e.or)(!1===u.strictSchema?e.nil:e._`${i} && !${l}`,function(){const t=d.$async?e._`(${a}.async ? await ${l}(${o}) : ${l}(${o}))`:e._`${l}(${o})`,n=e._`(typeof ${l} == "function" ? ${t} : ${l}.test(${o}))`;return e._`${l} && ${l} !== true && ${c} === ${r} && !${n}`}()))}():function(){const s=f.formats[a];if(!s)return void function(){if(!1===u.strictSchema)return void f.logger.warn(e());throw new Error(e());function e(){return`unknown format "${a}" ignored in schema at path "${l}"`}}();if(!0===s)return;const[i,c,h]=function(t){const r=t instanceof RegExp?(0,e.regexpCode)(t):u.code.formats?e._`${u.code.formats}${(0,e.getProperty)(a)}`:void 0,o=n.scopeValue("formats",{key:a,ref:t,code:r});if("object"==typeof t&&!(t instanceof RegExp))return[t.type||"string",t.validate,e._`${o}.validate`];return["string",t,o]}(s);i===r&&t.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!d.$async)throw new Error("async format in sync schema");return e._`await ${h}(${o})`}return"function"==typeof c?e._`${h}(${o})`:e._`${h}.test(${o})`}())}())}};return er.default=t,er}function rr(){if(Yt)return Oe;Yt=1,Object.defineProperty(Oe,"__esModule",{value:!0});const e=je(),t=ut(),r=Wt(),n=function(){if(Xt)return Zt;Xt=1,Object.defineProperty(Zt,"__esModule",{value:!0});const e=[tr().default];return Zt.default=e,Zt}(),o=[e.default,t.default,r.default(),n.default,["title","description","default"]];return Oe.default=o,Oe}var nr,or,sr={},ar={};function ir(){if(or)return sr;or=1,Object.defineProperty(sr,"__esModule",{value:!0});const e=p(),t=(nr||(nr=1,Object.defineProperty(ar,"__esModule",{value:!0}),ar.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(r||(ar.DiscrError=r={}))),ar);var r;const n=ce(),o=se(),s=v(),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:r}})=>e===t.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:r,tagName:n}})=>e._`{error: ${t}, tag: ${n}, tagValue: ${r}}`},code(r){const{gen:a,data:i,schema:c,parentSchema:u,it:l}=r,{oneOf:d}=u;if(!l.opts.discriminator)throw new Error("discriminator: requires discriminator option");const f=c.propertyName;if("string"!=typeof f)throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!d)throw new Error("discriminator: requires oneOf keyword");const h=a.let("valid",!1),p=a.const("tag",e._`${i}${(0,e.getProperty)(f)}`);function m(t){const n=a.name("valid"),o=r.subschema({keyword:"oneOf",schemaProp:t},n);return r.mergeEvaluated(o,e.Name),n}a.if(e._`typeof ${p} == "string"`,(()=>function(){const i=function(){var e;const t={},r=i(u);let a=!0;for(let t=0;t<d.length;t++){let u=d[t];if((null==u?void 0:u.$ref)&&!(0,s.schemaHasRulesButRef)(u,l.self.RULES)){const e=u.$ref;if(u=n.resolveRef.call(l.self,l.schemaEnv.root,l.baseId,e),u instanceof n.SchemaEnv&&(u=u.schema),void 0===u)throw new o.default(l.opts.uriResolver,l.baseId,e)}const h=null===(e=null==u?void 0:u.properties)||void 0===e?void 0:e[f];if("object"!=typeof h)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);a=a&&(r||i(u)),c(h,t)}if(!a)throw new Error(`discriminator: "${f}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(f)}function c(e,t){if(e.const)h(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${f}" must have "const" or "enum"`);for(const r of e.enum)h(r,t)}}function h(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${f}" values must be unique strings`);t[e]=r}}();a.if(!1);for(const t in i)a.elseIf(e._`${p} === ${t}`),a.assign(h,m(i[t]));a.else(),r.error(!1,{discrError:t.DiscrError.Mapping,tag:p,tagName:f}),a.endIf()}()),(()=>r.error(!1,{discrError:t.DiscrError.Tag,tag:p,tagName:f}))),r.ok(h)}};return sr.default=a,sr}var cr,ur={id:"http://json-schema.org/draft-04/schema#",$schema:"http://json-schema.org/draft-04/schema#",description:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},positiveInteger:{type:"integer",minimum:0},positiveIntegerDefault0:{allOf:[{$ref:"#/definitions/positiveInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},minItems:1,uniqueItems:!0}},type:"object",properties:{id:{type:"string",format:"uri"},$schema:{type:"string",format:"uri"},title:{type:"string"},description:{type:"string"},default:{},multipleOf:{type:"number",minimum:0,exclusiveMinimum:!0},maximum:{type:"number"},exclusiveMaximum:{type:"boolean",default:!1},minimum:{type:"number"},exclusiveMinimum:{type:"boolean",default:!1},maxLength:{$ref:"#/definitions/positiveInteger"},minLength:{$ref:"#/definitions/positiveIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:{}},maxItems:{$ref:"#/definitions/positiveInteger"},minItems:{$ref:"#/definitions/positiveIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxProperties:{$ref:"#/definitions/positiveInteger"},minProperties:{$ref:"#/definitions/positiveIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},enum:{type:"array",minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},dependencies:{exclusiveMaximum:["maximum"],exclusiveMinimum:["minimum"]},default:{}};var lr=(cr||(cr=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const r=Pe(),n=rr(),o=ir(),s=ur,a=["/properties"],i="http://json-schema.org/draft-04/schema";class c extends r.default{constructor(e={}){super({...e,schemaId:"id"})}_addVocabularies(){super._addVocabularies(),n.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(s,a):s;this.addMetaSchema(e,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=Pe();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var l=Pe();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}})}(r,r.exports)),r.exports),dr=e(lr),fr=function(e,t){return fr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},fr(e,t)};function hr(e,t,r,n){return new(r||(r=Promise))((function(t,o){function s(e){try{i(n.next(e))}catch(e){o(e)}}function a(e){try{i(n.throw(e))}catch(e){o(e)}}function i(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(s,a)}i((n=n.apply(e,[])).next())}))}function pr(e,t){var r,n,o,s,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function i(s){return function(i){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,i])}}}function mr(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function yr(e){return this instanceof yr?(this.v=e,this):new yr(e)}function vr(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),s=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){s.push([e,t,r,n])>1||i(e,t)}))})}function i(e,t){try{(r=o[e](t)).value instanceof yr?Promise.resolve(r.value.v).then(c,u):l(s[0][2],r)}catch(e){l(s[0][3],e)}var r}function c(e){i("next",e)}function u(e){i("throw",e)}function l(e,t){e(t),s.shift(),s.length&&i(s[0][0],s[0][1])}}var gr=function(e){function t(t){var r=e.call(this,t)||this;return Object.defineProperty(r,"name",{value:"RepeaterOverflowError",enumerable:!1}),"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(r,r.constructor.prototype):r.__proto__=r.constructor.prototype,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(r,r.constructor),r}return function(e,t){function r(){this.constructor=e}fr(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,e),t}(Error);function $r(e){null!=e&&"function"==typeof e.then&&e.then(_r,_r)}!function(){function e(e){if(e<0)throw new RangeError("Capacity may not be less than 0");this._c=e,this._q=[]}Object.defineProperty(e.prototype,"empty",{get:function(){return 0===this._q.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return this._q.length>=this._c},enumerable:!1,configurable:!0}),e.prototype.add=function(e){if(this.full)throw new Error("Buffer full");this._q.push(e)},e.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()}}(),function(){function e(e){if(e<1)throw new RangeError("Capacity may not be less than 1");this._c=e,this._q=[]}Object.defineProperty(e.prototype,"empty",{get:function(){return 0===this._q.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.add=function(e){for(;this._q.length>=this._c;)this._q.shift();this._q.push(e)},e.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()}}(),function(){function e(e){if(e<1)throw new RangeError("Capacity may not be less than 1");this._c=e,this._q=[]}Object.defineProperty(e.prototype,"empty",{get:function(){return 0===this._q.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.add=function(e){this._q.length<this._c&&this._q.push(e)},e.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()}}();var wr=1024,_r=function(){};function br(e){var t=e.err,r=Promise.resolve(e.execution).then((function(e){if(null!=t)throw t;return e}));return e.err=void 0,e.execution=r.then((function(){}),(function(){})),void 0===e.pending?r:e.pending.then((function(){return r}))}function Pr(e,t){var r=e.state>=3;return Promise.resolve(t).then((function(t){return!r&&e.state>=4?br(e).then((function(e){return{value:e,done:!0}})):{value:t,done:r}}))}function Er(e,t){var r,n;if(!(e.state>=2))if(e.state=2,e.onnext(),e.onstop(),null==e.err&&(e.err=t),0!==e.pushes.length||void 0!==e.buffer&&!e.buffer.empty)try{for(var o=mr(e.pushes),s=o.next();!s.done;s=o.next()){s.value.resolve()}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}else Sr(e)}function Sr(e){var t,r;if(!(e.state>=3)){e.state<2&&Er(e),e.state=3,e.buffer=void 0;try{for(var n=mr(e.nexts),o=n.next();!o.done;o=n.next()){var s=o.value,a=void 0===e.pending?br(e):e.pending.then((function(){return br(e)}));s.resolve(Pr(e,a))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.pushes=[],e.nexts=[]}}function Or(e){e.state>=4||(e.state<3&&Sr(e),e.state=4)}function kr(e,t){if($r(t),e.pushes.length>=wr)throw new gr("No more than 1024 pending calls to push are allowed on a single repeater.");if(e.state>=2)return Promise.resolve(void 0);var r,n=void 0===e.pending?Promise.resolve(t):e.pending.then((function(){return t}));(n=n.catch((function(t){e.state<2&&(e.err=t),Or(e)})),e.nexts.length)?(e.nexts.shift().resolve(Pr(e,n)),r=e.nexts.length?Promise.resolve(e.nexts[0].value):void 0===e.buffer||e.buffer.full?new Promise((function(t){return e.onnext=t})):Promise.resolve(void 0)):void 0===e.buffer||e.buffer.full?r=new Promise((function(t){return e.pushes.push({resolve:t,value:n})})):(e.buffer.add(n),r=Promise.resolve(void 0));var o=!0,s={},a=r.catch((function(e){if(o)throw e}));return s.then=function(e,t){return o=!1,Promise.prototype.then.call(r,e,t)},s.catch=function(e){return o=!1,Promise.prototype.catch.call(r,e)},s.finally=r.finally.bind(r),e.pending=n.then((function(){return a})).catch((function(t){e.err=t,Or(e)})),s}function Nr(e){if(!(e.state>=1)){e.state=1;var t=kr.bind(null,e),r=function(e){var t=Er.bind(null,e),r=new Promise((function(t){return e.onstop=t}));return t.then=r.then.bind(r),t.catch=r.catch.bind(r),t.finally=r.finally.bind(r),t}(e);e.execution=new Promise((function(n){return n(e.executor(t,r))})),e.execution.catch((function(){return Er(e)}))}}var jr=new WeakMap,xr=function(){function e(e,t){jr.set(this,{executor:e,buffer:t,err:void 0,state:0,pushes:[],nexts:[],pending:void 0,execution:void 0,onnext:_r,onstop:_r})}return e.prototype.next=function(e){$r(e);var t=jr.get(this);if(void 0===t)throw new Error("WeakMap error");if(t.nexts.length>=wr)throw new gr("No more than 1024 pending calls to next are allowed on a single repeater.");if(t.state<=0&&Nr(t),t.onnext(e),void 0!==t.buffer&&!t.buffer.empty){var r=Pr(t,t.buffer.remove());if(t.pushes.length){var n=t.pushes.shift();t.buffer.add(n.value),t.onnext=n.resolve}return r}if(t.pushes.length){var o=t.pushes.shift();return t.onnext=o.resolve,Pr(t,o.value)}return t.state>=2?(Sr(t),Pr(t,br(t))):new Promise((function(r){return t.nexts.push({resolve:r,value:e})}))},e.prototype.return=function(e){$r(e);var t=jr.get(this);if(void 0===t)throw new Error("WeakMap error");return Sr(t),t.execution=Promise.resolve(t.execution).then((function(){return e})),Pr(t,br(t))},e.prototype.throw=function(e){var t=jr.get(this);if(void 0===t)throw new Error("WeakMap error");return t.state<=0||t.state>=2||void 0!==t.buffer&&!t.buffer.empty?(Sr(t),null==t.err&&(t.err=e),Pr(t,br(t))):this.next(Promise.reject(e))},e.prototype[Symbol.asyncIterator]=function(){return this},e.race=Tr,e.merge=Cr,e.zip=Rr,e.latest=Ar,e}();function Ir(e,t){var r,n,o=[],s=function(e){null!=e&&"function"==typeof e[Symbol.asyncIterator]?o.push(e[Symbol.asyncIterator]()):null!=e&&"function"==typeof e[Symbol.iterator]?o.push(e[Symbol.iterator]()):o.push(function(){return vr(this,arguments,(function(){return pr(this,(function(r){switch(r.label){case 0:return t.yieldValues?[4,yr(e)]:[3,3];case 1:return[4,r.sent()];case 2:r.sent(),r.label=3;case 3:return t.returnValues?[4,yr(e)]:[3,5];case 4:return[2,r.sent()];case 5:return[2]}}))}))}())};try{for(var a=mr(e),i=a.next();!i.done;i=a.next()){s(i.value)}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o}function Tr(e){var t=this,r=Ir(e,{returnValues:!0});return new xr((function(e,n){return hr(t,0,void 0,(function(){var t,o,s,a,i,c;return pr(this,(function(u){switch(u.label){case 0:if(!r.length)return n(),[2];o=!1,n.then((function(){t(),o=!0})),u.label=1;case 1:u.trys.push([1,,5,7]),a=void 0,i=0,c=function(){var o,c,u,l,d,f;return pr(this,(function(h){switch(h.label){case 0:o=i;try{for(d=void 0,c=mr(r),u=c.next();!u.done;u=c.next())l=u.value,Promise.resolve(l.next()).then((function(e){e.done?(n(),void 0===s&&(s=e)):i===o&&(i++,t(e))}),(function(e){return n(e)}))}catch(e){d={error:e}}finally{try{u&&!u.done&&(f=c.return)&&f.call(c)}finally{if(d)throw d.error}}return[4,new Promise((function(e){return t=e}))];case 1:return void 0===(a=h.sent())?[3,3]:[4,e(a.value)];case 2:h.sent(),h.label=3;case 3:return[2]}}))},u.label=2;case 2:return o?[3,4]:[5,c()];case 3:return u.sent(),[3,2];case 4:return[2,s&&s.value];case 5:return n(),[4,Promise.race(r.map((function(e){return e.return&&e.return()})))];case 6:return u.sent(),[7];case 7:return[2]}}))}))}))}function Cr(e){var t=this,r=Ir(e,{yieldValues:!0});return new xr((function(e,n){return hr(t,0,void 0,(function(){var t,o,s,a=this;return pr(this,(function(i){switch(i.label){case 0:if(!r.length)return n(),[2];t=[],o=!1,n.then((function(){var e,r;o=!0;try{for(var n=mr(t),s=n.next();!s.done;s=n.next()){(0,s.value)()}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}})),i.label=1;case 1:return i.trys.push([1,,3,4]),[4,Promise.all(r.map((function(r,i){return hr(a,0,void 0,(function(){var a;return pr(this,(function(c){switch(c.label){case 0:c.trys.push([0,,6,9]),c.label=1;case 1:return o?[3,5]:(Promise.resolve(r.next()).then((function(e){return t[i](e)}),(function(e){return n(e)})),[4,new Promise((function(e){t[i]=e}))]);case 2:return void 0===(a=c.sent())?[3,4]:a.done?(s=a,[2]):[4,e(a.value)];case 3:c.sent(),c.label=4;case 4:return[3,1];case 5:return[3,9];case 6:return r.return?[4,r.return()]:[3,8];case 7:c.sent(),c.label=8;case 8:return[7];case 9:return[2]}}))}))})))];case 2:return i.sent(),[2,s&&s.value];case 3:return n(),[7];case 4:return[2]}}))}))}))}function Rr(e){var t=this,r=Ir(e,{returnValues:!0});return new xr((function(e,n){return hr(t,0,void 0,(function(){var t,o,s,a;return pr(this,(function(i){switch(i.label){case 0:if(!r.length)return n(),[2,[]];o=!1,n.then((function(){t(),o=!0})),i.label=1;case 1:i.trys.push([1,,6,8]),i.label=2;case 2:return o?[3,5]:(Promise.all(r.map((function(e){return e.next()}))).then((function(e){return t(e)}),(function(e){return n(e)})),[4,new Promise((function(e){return t=e}))]);case 3:return void 0===(s=i.sent())?[2]:(a=s.map((function(e){return e.value})),s.some((function(e){return e.done}))?[2,a]:[4,e(a)]);case 4:return i.sent(),[3,2];case 5:return[3,8];case 6:return n(),[4,Promise.all(r.map((function(e){return e.return&&e.return()})))];case 7:return i.sent(),[7];case 8:return[2]}}))}))}))}function Ar(e){var t=this,r=Ir(e,{yieldValues:!0,returnValues:!0});return new xr((function(e,n){return hr(t,0,void 0,(function(){var t,o,s,a,i,c=this;return pr(this,(function(u){switch(u.label){case 0:if(!r.length)return n(),[2,[]];o=[],s=!1,n.then((function(){var e,r;t();try{for(var n=mr(o),a=n.next();!a.done;a=n.next()){(0,a.value)()}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}s=!0})),u.label=1;case 1:return u.trys.push([1,,5,7]),Promise.all(r.map((function(e){return e.next()}))).then((function(e){return t(e)}),(function(e){return n(e)})),[4,new Promise((function(e){return t=e}))];case 2:return void 0===(a=u.sent())?[2]:(i=a.map((function(e){return e.value})),a.every((function(e){return e.done}))?[2,i]:[4,e(i.slice())]);case 3:return u.sent(),[4,Promise.all(r.map((function(t,r){return hr(c,0,void 0,(function(){var c;return pr(this,(function(u){switch(u.label){case 0:if(a[r].done)return[2,a[r].value];u.label=1;case 1:return s?[3,4]:(Promise.resolve(t.next()).then((function(e){return o[r](e)}),(function(e){return n(e)})),[4,new Promise((function(e){return o[r]=e}))]);case 2:return void 0===(c=u.sent())?[2,a[r].value]:c.done?[2,c.value]:(i[r]=c.value,[4,e(i.slice())]);case 3:return u.sent(),[3,1];case 4:return[2]}}))}))})))];case 4:return[2,u.sent()];case 5:return n(),[4,Promise.all(r.map((function(e){return e.return&&e.return()})))];case 6:return u.sent(),[7];case 7:return[2]}}))}))}))}
8
+ /*!
9
+ * https://github.com/Starcounter-Jack/JSON-Patch
10
+ * (c) 2017-2022 Joachim Wester
11
+ * MIT licensed
12
+ */var Dr=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Mr=Object.prototype.hasOwnProperty;function Vr(e,t){return Mr.call(e,t)}function zr(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var o in e)Vr(e,o)&&n.push(o);return n}function qr(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Lr(e){for(var t,r=0,n=e.length;r<n;){if(!((t=e.charCodeAt(r))>=48&&t<=57))return!1;r++}return!0}function Ur(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Kr(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Fr(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Fr(e[t]))return!0}else if("object"==typeof e)for(var n=zr(e),o=n.length,s=0;s<o;s++)if(Fr(e[n[s]]))return!0;return!1}function Gr(e,t){var r=[e];for(var n in t){var o="object"==typeof t[n]?JSON.stringify(t[n],null,2):t[n];void 0!==o&&r.push(n+": "+o)}return r.join("\n")}var Hr=function(e){function t(t,r,n,o,s){var a=this.constructor,i=e.call(this,Gr(t,{name:r,index:n,operation:o,tree:s}))||this;return i.name=r,i.index=n,i.operation=o,i.tree=s,Object.setPrototypeOf(i,a.prototype),i.message=Gr(t,{name:r,index:n,operation:o,tree:s}),i}return Dr(t,e),t}(Error),Jr=Hr,Br=qr,Wr={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=Xr(r,this.path);n&&(n=qr(n));var o=Yr(r,{op:"remove",path:this.from}).removed;return Yr(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Xr(r,this.from);return Yr(r,{op:"add",path:this.path,value:qr(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:rn(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},Qr={add:function(e,t,r){return Lr(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){return{newDocument:r,removed:e.splice(t,1)[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:Wr.move,copy:Wr.copy,test:Wr.test,_get:Wr._get};function Xr(e,t){if(""==t)return e;var r={op:"_get",path:t};return Yr(e,r),r.value}function Yr(e,t,r,n,o,s){if(void 0===r&&(r=!1),void 0===n&&(n=!0),void 0===o&&(o=!0),void 0===s&&(s=0),r&&("function"==typeof r?r(t,0,e,t.path):en(t,0)),""===t.path){var a={newDocument:e};if("add"===t.op)return a.newDocument=t.value,a;if("replace"===t.op)return a.newDocument=t.value,a.removed=e,a;if("move"===t.op||"copy"===t.op)return a.newDocument=Xr(e,t.from),"move"===t.op&&(a.removed=e),a;if("test"===t.op){if(a.test=rn(e,t.value),!1===a.test)throw new Jr("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return a.newDocument=e,a}if("remove"===t.op)return a.removed=e,a.newDocument=null,a;if("_get"===t.op)return t.value=e,a;if(r)throw new Jr("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,t,e);return a}n||(e=qr(e));var i=(t.path||"").split("/"),c=e,u=1,l=i.length,d=void 0,f=void 0,h=void 0;for(h="function"==typeof r?r:en;;){if((f=i[u])&&-1!=f.indexOf("~")&&(f=Kr(f)),o&&("__proto__"==f||"prototype"==f&&u>0&&"constructor"==i[u-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&void 0===d&&(void 0===c[f]?d=i.slice(0,u).join("/"):u==l-1&&(d=t.path),void 0!==d&&h(t,0,e,d)),u++,Array.isArray(c)){if("-"===f)f=c.length;else{if(r&&!Lr(f))throw new Jr("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,t,e);Lr(f)&&(f=~~f)}if(u>=l){if(r&&"add"===t.op&&f>c.length)throw new Jr("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,t,e);if(!1===(a=Qr[t.op].call(t,c,f,e)).test)throw new Jr("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return a}}else if(u>=l){if(!1===(a=Wr[t.op].call(t,c,f,e)).test)throw new Jr("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return a}if(c=c[f],r&&u<l&&(!c||"object"!=typeof c))throw new Jr("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,t,e)}}function Zr(e,t,r,n,o){if(void 0===n&&(n=!0),void 0===o&&(o=!0),r&&!Array.isArray(t))throw new Jr("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=qr(e));for(var s=new Array(t.length),a=0,i=t.length;a<i;a++)s[a]=Yr(e,t[a],r,!0,o,a),e=s[a].newDocument;return s.newDocument=e,s}function en(e,t,r,n){if("object"!=typeof e||null===e||Array.isArray(e))throw new Jr("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(!Wr[e.op])throw new Jr("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r);if("string"!=typeof e.path)throw new Jr("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new Jr('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new Jr("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new Jr("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&Fr(e.value))throw new Jr("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r)if("add"==e.op){var o=e.path.split("/").length,s=n.split("/").length;if(o!==s+1&&o!==s)throw new Jr("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==n)throw new Jr("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if("move"===e.op||"copy"===e.op){var a=tn([{op:"_get",path:e.from,value:void 0}],r);if(a&&"OPERATION_PATH_UNRESOLVABLE"===a.name)throw new Jr("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}function tn(e,t,r){try{if(!Array.isArray(e))throw new Jr("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Zr(qr(t),qr(e),r||!0);else{r=r||en;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(e){if(e instanceof Jr)return e;throw e}}function rn(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var r,n,o,s=Array.isArray(e),a=Array.isArray(t);if(s&&a){if((n=e.length)!=t.length)return!1;for(r=n;0!=r--;)if(!rn(e[r],t[r]))return!1;return!0}if(s!=a)return!1;var i=Object.keys(e);if((n=i.length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!t.hasOwnProperty(i[r]))return!1;for(r=n;0!=r--;)if(!rn(e[o=i[r]],t[o]))return!1;return!0}return e!=e&&t!=t}var nn=Object.freeze({__proto__:null,JsonPatchError:Jr,_areEquals:rn,applyOperation:Yr,applyPatch:Zr,applyReducer:function(e,t,r){var n=Yr(e,t);if(!1===n.test)throw new Jr("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument},deepClone:Br,getValueByPointer:Xr,validate:tn,validator:en}),on=new WeakMap,sn=function(e){this.observers=new Map,this.obj=e},an=function(e,t){this.callback=e,this.observer=t};
13
+ /*!
14
+ * https://github.com/Starcounter-Jack/JSON-Patch
15
+ * (c) 2017-2021 Joachim Wester
16
+ * MIT license
17
+ */function cn(e,t){void 0===t&&(t=!1);var r=on.get(e.object);un(r.value,e.object,e.patches,"",t),e.patches.length&&Zr(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function un(e,t,r,n,o){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var s=zr(t),a=zr(e),i=!1,c=a.length-1;c>=0;c--){var u=e[d=a[c]];if(!Vr(t,d)||void 0===t[d]&&void 0!==u&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Ur(d),value:qr(u)}),r.push({op:"remove",path:n+"/"+Ur(d)}),i=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}));else{var l=t[d];"object"==typeof u&&null!=u&&"object"==typeof l&&null!=l&&Array.isArray(u)===Array.isArray(l)?un(u,l,r,n+"/"+Ur(d),o):u!==l&&(o&&r.push({op:"test",path:n+"/"+Ur(d),value:qr(u)}),r.push({op:"replace",path:n+"/"+Ur(d),value:qr(l)}))}}if(i||s.length!=a.length)for(c=0;c<s.length;c++){var d;Vr(e,d=s[c])||void 0===t[d]||r.push({op:"add",path:n+"/"+Ur(d),value:qr(t[d])})}}}var ln=Object.freeze({__proto__:null,compare:function(e,t,r){void 0===r&&(r=!1);var n=[];return un(e,t,n,"",r),n},generate:cn,observe:function(e,t){var r,n=function(e){return on.get(e)}(e);if(n){var o=function(e,t){return e.observers.get(t)}(n,t);r=o&&o.observer}else n=new sn(e),on.set(e,n);if(r)return r;if(r={},n.value=qr(e),t){r.callback=t,r.next=null;var s=function(){cn(r)},a=function(){clearTimeout(r.next),r.next=setTimeout(s)};"undefined"!=typeof window&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return r.patches=[],r.object=e,r.unobserve=function(){cn(r),clearTimeout(r.next),function(e,t){e.observers.delete(t.callback)}(n,r),"undefined"!=typeof window&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},n.observers.set(t,new an(t,r)),r},unobserve:function(e,t){t.unobserve()}});Object.assign({},nn,ln,{JsonPatchError:Hr,deepClone:qr,escapePathComponent:Ur,unescapePathComponent:Kr});class dn extends Error{constructor(e){super(e),this.name="GraffitiErrorInvalidSchema",Object.setPrototypeOf(this,dn.prototype)}}class fn extends Error{constructor(e){super(e),this.name="GraffitiErrorPatchTestFailed",Object.setPrototypeOf(this,fn.prototype)}}class hn extends Error{constructor(e){super(e),this.name="GraffitiErrorPatchError",Object.setPrototypeOf(this,hn.prototype)}}function pn(e,t,r,n){const o=r[t];if(o&&o.length)try{n[t]=e(n[t],o,!0,!1).newDocument}catch(e){throw"object"==typeof e&&e&&"name"in e&&"string"==typeof e.name&&"message"in e&&"string"==typeof e.message?"TEST_OPERATION_FAILED"===e.name?new fn(e.message):new hn(e.name+": "+e.message):e}}function mn(e,t,r){e.actor!==r?.actor&&(e.allowed=e.allowed&&r?[r.actor]:void 0,e.channels=e.channels.filter((e=>t.includes(e))))}function yn(e,t){return void 0===e.allowed||!!t?.actor&&(e.actor===t.actor||e.allowed.includes(t.actor))}class vn{synchronizeEvents=new EventTarget;ajv;graffiti;constructor(e,t){this.ajv=t??new dr({strict:!1}),this.graffiti=e}synchronizeDispatch(e,t){const r=new CustomEvent("change",{detail:{oldObject:e,newObject:t}});this.synchronizeEvents.dispatchEvent(r)}get=async(...e)=>{const t=await this.graffiti.get(...e);return this.synchronizeDispatch(t),t};put=async(...e)=>{const t=await this.graffiti.put(...e),r=e[0],n={...t,value:r.value,channels:r.channels,allowed:r.allowed,tombstone:!1};return this.synchronizeDispatch(t,n),t};patch=async(...e)=>{const t=await this.graffiti.patch(...e),r={...t};r.tombstone=!1;for(const t of["value","channels","allowed"])pn(Zr,t,e[0],r);return this.synchronizeDispatch(t,r),t};delete=async(...e)=>{const t=await this.graffiti.delete(...e);return this.synchronizeDispatch(t),t};discover=(...e)=>{const t=this.graffiti.discover(...e),r=this.synchronizeDispatch.bind(this);return async function*(){let e=await t.next();for(;!e.done;)e.value.error||r(e.value.value),yield e.value,e=await t.next();return e.value}()};synchronize=(...e)=>{const[t,r,n]=e,o=function(e,t){try{return e.compile(t)}catch(e){throw new dn(e instanceof Error?e.message:void 0)}}(this.ajv,r),s=new xr((async(e,r)=>{const s=r=>{const{oldObject:s,newObject:a}=r.detail;for(const r of[a,s])if(r&&r.channels.some((e=>t.includes(e)))&&yn(r,n)){const s={...r};if(mn(s,t,n),o(s)){e({value:s});break}}};this.synchronizeEvents.addEventListener("change",s),await r,this.synchronizeEvents.removeEventListener("change",s)}));return s}}export{vn as GraffitiSynchronize};
18
+ //# sourceMappingURL=synchronize.browser.js.map