1var Yo = Object.defineProperty; 2var Xo = (s, e, r) => e in s ? Yo(s, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[e] = r; 3var Xe = (s, e, r) => Xo(s, typeof e != "symbol" ? e + "" : e, r); 4var hs, Er, Re, bn; 5(function(s) { 6 s.POST_MESSAGE = "postMessage"; 7})(hs || (hs = {})), function(s) { 8 s.SDK_ANGIE_READY_PING = "sdk-angie-ready-ping", s.SDK_REQUEST_CLIENT_CREATION = "sdk-request-client-creation", s.SDK_REQUEST_INIT_SERVER = "sdk-request-init-server"; 9}(Er || (Er = {})); 10class eu { 11 constructor() { 12 Xe(this, "isAngieReady", !1); 13 Xe(this, "readyPromise"); 14 Xe(this, "readyResolve"); 15 if (this.readyPromise = new Promise((a) => { 16 this.readyResolve = a; 17 }), typeof window > "u") return; 18 let e = 0; 19 const r = () => { 20 if (this.isAngieReady || e >= 500) return void (!this.isAngieReady && e >= 500 && this.handleDetectionTimeout()); 21 const a = new MessageChannel(); 22 a.port1.onmessage = (n) => { 23 this.handleAngieReady(n.data), a.port1.close(), a.port2.close(); 24 }; 25 const t = { type: Er.SDK_ANGIE_READY_PING, timestamp: Date.now() }; 26 window.postMessage(t, window.location.origin, [a.port2]), e++, setTimeout(r, 500); 27 }; 28 r(); 29 } 30 handleAngieReady(e) { 31 this.isAngieReady = !0; 32 const r = { isReady: !0, version: e.version, capabilities: e.capabilities }; 33 this.readyResolve && this.readyResolve(r); 34 } 35 handleDetectionTimeout() { 36 this.readyResolve && this.readyResolve({ isReady: !1 }), console.warn("AngieMcpSdk: AngieDetector: Detection timeout - Angie may
36not be available"); 37 } 38 isReady() { 39 return this.isAngieReady; 40 } 41 async waitForReady() { 42 return this.readyPromise; 43 } 44} 45class tu { 46 constructor() { 47 Xe(this, "queue", []); 48 Xe(this, "isProcessing", !1); 49 } 50 add(e) { 51 const r = { id: this.generateId(e), config: e, timestamp: Date.now(), status: "pending" }; 52 return this.queue.push(r), console.log(`RegistrationQueue: Added server "${e.name}" to queue`), r; 53 } 54 getAll() { 55 return [...this.queue]; 56 } 57 getPending() { 58 return this.queue.filter((e) => e.status === "pending"); 59 } 60 updateStatus(e, r, a) { 61 const t = this.queue.find((n) => n.id === e); 62 t && (t.status = r, a && (t.error = a), console.log(`RegistrationQueue: Updated server ${e} status to ${r}`)); 63 } 64 async processQueue(e) { 65 if (this.isProcessing) return void console.log("RegistrationQueue: Already processing queue"); 66 this.isProcessing = !0; 67 const r = this.getPending(); 68 console.log(`RegistrationQueue: Processing ${r.length} pending registrations`); 69 try { 70 for (const a of r) try { 71 await e(a), this.updateStatus(a.id, "registered"); 72 } catch (t) { 73 const n = t instanceof Error ? t.message : String(t); 74 this.updateStatus(a.id, "failed", n), console.error(`RegistrationQueue: Failed to process registration ${a.id}:`, n); 75 } 76 } finally { 77 this.isProcessing = !1; 78 } 79 } 80 clear() { 81 this.queue = [], console.log("RegistrationQueue: Cleared all registrations"); 82 } 83 remove(e) { 84 const r = this.queue.findIndex((a) => a.id === e); 85 return r !== -1 && (this.queue.splice(r, 1), console.log(`RegistrationQueue: Removed registration ${e}`), !0); 86 } 87 generateId(e) { 88 return `reg_${e.name}_${e.version}_${Date.now()}`; 89 } 90} 91class ru { 92 async requestClientCreation(e) { 93 const { config: r } = e, a = { serverId: e.id, serverName: r.name, serverVersion: r.version, description: r.description, transport: hs.POST_MESSAGE, capabilities: r.capabilities }; 94 return new Promise((t, n) => { 95 const i = new MessageChannel(), o = setTimeout(() => { 96 n(new Error("Client creation request timed out after 10000ms")); 97 }, 1e4); 98 i.port1.onmessage = (l) => { 99 clearTimeout(o), t(l.data); 100 }; 101 const u = { type: Er.SDK_REQUEST_CLIENT_CREATION, payload: a, timestamp: Date.now() }; 102 window.postMessage(u, window.location.origin, [i.port2]); 103 }); 104 } 105} 106(function(s) { 107 s.assertEqual = (e) => { 108 }, s.assertIs = function(e) { 109 }, s.assertNever = function(e) { 110 throw new Error(); 111 }, s.arrayToEnum = (e) => { 112 const r = {}; 113 for (const a of e) r[a] = a; 114 return r; 115 }, s.getValidEnumValues = (e) => { 116 const r = s.objectKeys(e).filter((t) => typeof e[e[t]] != "number"), a = {}; 117 for (const t of r) a[t] = e[t]; 118 return s.objectValues(a); 119 }, s.objectValues = (e) => s.objectKeys(e).map(function(r) { 120 return e[r]; 121 }), s.objectKeys = typeof Object.keys == "function" ? (e) => Object.keys(e) : (e) => { 122 const r = []; 123 for (const a in e) Object.prototype.hasOwnProperty.call(e, a) && r.push(a); 124 return r; 125 }, s.find = (e, r) => { 126 for (const a of e) if (r(a)) return a; 127 }, s.isInteger = typeof Number.isInteger == "function" ? (e) => Number.isInteger(e) : (e) => typeof e == "number" && Number.isFinite(e) && Math.floor(e) === e, s.joinValues = function(e, r = " | ") { 128 return e.map((a) => typeof a == "string" ? `'${a}'` : a).join(r); 129 }, s.jsonStringifyReplacer = (e, r) => typeof r == "bigint" ? r.toString() : r; 130})(Re || (Re = {})), function(s) { 131 s.mergeShapes = (e, r) => ({ ...e, ...r }); 132}(bn || (bn = {})); 133const G = Re.arrayToEnum(["string", "nan", "number", "integer", "float", "boolean", "date", "bigint", "symbol", "function", "undefined", "null", "array", "object", "unknown", "promise", "void", "never", "map", "set"]), Jt = (s) => { 134 switch (typeof s) { 135 case "undefined": 136 return G.undefined; 137 case "string": 138 return G.string; 139 case "number": 140 return Number.isNaN(s) ? G.nan : G.number; 141 case "boolean": 142 return G.boolean; 143 case "function": 144 return G.function; 145 case "bigint": 146 return G.bigint; 147 case "symbol": 148 return G.symbol; 149 case "object": 150 return Array.isArray(s) ? G.array : s === null ? G.null : s.then && typeof s.then == "function" && s.catch && typeof s.catch == "function" ? G.promise : typeof Map < "u" && s instanceof Map ? G.map : typeof Set < "u" && s instanceof Set ? G.set : typeof Date < "u" && s instanceof Date ? G.date : G.object; 151 default: 152 return G.unknown; 153 } 154}, M = Re.arrayToEnum(["invalid_type", "invalid_literal", "custom", "invalid_union", "invalid_union_discriminator", "invalid_enum_value", "unrecognized_keys", "invalid_arguments", "invalid_return_type", "invalid_date", "invalid_string", "too_small", "too_big", "invalid_intersection_types", "not_multiple_of", "not_finite"]);
vendor: 19,485 bytes, lines 155-503
155class Vt extends Error { 156 get errors() { 157 return this.issues; 158 } 159 constructor(e) { 160 super(), this.issues = [], this.addIssue = (a) => { 161 this.issues = [...this.issues, a]; 162 }, this.addIssues = (a = []) => { 163 this.issues = [...this.issues, ...a]; 164 }; 165 const r = new.target.prototype; 166 Object.setPrototypeOf ? Object.setPrototypeOf(this, r) : this.__proto__ = r, this.name = "ZodError", this.issues = e; 167 } 168 format(e) { 169 const r = e || function(n) { 170 return n.message; 171 }, a = { _errors: [] }, t = (n) => { 172 for (const i of n.issues) if (i.code === "invalid_union") i.unionErrors.map(t); 173 else if (i.code === "invalid_return_type") t(i.returnTypeError); 174 else if (i.code === "invalid_arguments") t(i.argumentsError); 175 else if (i.path.length === 0) a._errors.push(r(i)); 176 else { 177 let o = a, u = 0; 178 for (; u < i.path.length; ) { 179 const l = i.path[u]; 180 u === i.path.length - 1 ? (o[l] = o[l] || { _errors: [] }, o[l]._errors.push(r(i))) : o[l] = o[l] || { _errors: [] }, o = o[l], u++; 181 } 182 } 183 }; 184 return t(this), a; 185 } 186 static assert(e) { 187 if (!(e instanceof Vt)) throw new Error(`Not a ZodError: ${e}`); 188 } 189 toString() { 190 return this.message; 191 } 192 get message() { 193 return JSON.stringify(this.issues, Re.jsonStringifyReplacer, 2); 194 } 195 get isEmpty() { 196 return this.issues.length === 0; 197 } 198 flatten(e = (r) => r.message) { 199 const r = {}, a = []; 200 for (const t of this.issues) t.path.length > 0 ? (r[t.path[0]] = r[t.path[0]] || [], r[t.path[0]].push(e(t))) : a.push(e(t)); 201 return { formErrors: a, fieldErrors: r }; 202 } 203 get formErrors() { 204 return this.flatten(); 205 } 206} 207Vt.create = (s) => new Vt(s); 208const fs = (s, e) => { 209 let r; 210 switch (s.code) { 211 case M.invalid_type: 212 r = s.received === G.undefined ? "Required" : `Expected ${s.expected}, received ${s.received}`; 213 break; 214 case M.invalid_literal: 215 r = `Invalid literal value, expected ${JSON.stringify(s.expected, Re.jsonStringifyReplacer)}`; 216 break; 217 case M.unrecognized_keys: 218 r = `Unrecognized key(s) in object: ${Re.joinValues(s.keys, ", ")}`; 219 break; 220 case M.invalid_union: 221 r = "Invalid input"; 222 break; 223 case M.invalid_union_discriminator: 224 r = `Invalid discriminator value. Expected ${Re.joinValues(s.options)}`; 225 break; 226 case M.invalid_enum_value: 227 r = `Invalid enum value. Expected ${Re.joinValues(s.options)}, received '${s.received}'`; 228 break; 229 case M.invalid_arguments: 230 r = "Invalid function arguments"; 231 break; 232 case M.invalid_return_type: 233 r = "Invalid function return type"; 234 break; 235 case M.invalid_date: 236 r = "Invalid date"; 237 break; 238 case M.invalid_string: 239 typeof s.validation == "object" ? "includes" in s.validation ? (r = `Invalid input: must include "${s.validation.includes}"`, typeof s.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${s.validation.position}`)) : "startsWith" in s.validation ? r = `Invalid input: must start with "${s.validation.startsWith}"` : "endsWith" in s.validation ? r = `Invalid input: must end with "${s.validation.endsWith}"` : Re.assertNever(s.validation) : r = s.validation !== "regex" ? `Invalid ${s.validation}` : "Invalid"; 240 break; 241 case M.too_small: 242 r = s.type === "array" ? `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "more than"} ${s.minimum} element(s)` : s.type === "string" ? `String must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "over"} ${s.minimum} character(s)` : s.type === "number" ? `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "date" ? `Date must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(s.minimum))}` : "Invalid input"; 243 break; 244 case M.too_big: 245 r = s.type === "array" ? `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "less than"} ${s.maximum} element(s)` : s.type === "string" ? `String must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "under"} ${s.maximum} character(s)` : s.type === "number" ? `Number must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "bigint" ? `BigInt must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "date" ? `Date must be ${s.exact ? "exactly" : s.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(s.maximum))}` : "Invalid input"; 246 break; 247 case M.custom: 248 r = "Invalid input"; 249 break; 250 case M.invalid_intersection_types: 251 r = "Intersection results could not be merged"; 252 break; 253 case M.not_multiple_of: 254 r = `Number must be a multiple of ${s.multipleOf}`; 255 break; 256 case M.not_finite: 257 r = "Number must be finite"; 258 break; 259 default: 260 r = e.defaultError, Re.assertNever(s); 261 } 262 return { message: r }; 263}; 264let au = fs; 265function Q(s, e) { 266 const r = au, a = ((t) => { 267 const { data: n, path: i, errorMaps: o, issueData: u } = t, l = [...i, ...u.path || []], h = { ...u, path: l }; 268 if (u.message !== void 0) return { ...u, path: l, message: u.message }; 269 let m = ""; 270 const _ = o.filter((c) => !!c).slice().reverse(); 271 for (const c of _) m = c(h, { data: n, defaultError: m }).message; 272 return { ...u, path: l, message: m }; 273 })({ issueData: e, data: s.data, path: s.path, errorMaps: [s.common.contextualErrorMap, s.schemaErrorMap, r, r === fs ? void 0 : fs].filter((t) => !!t) }); 274 s.common.issues.push(a); 275} 276class it { 277 constructor() { 278 this.value = "valid"; 279 } 280 dirty() { 281 this.value === "valid" && (this.value = "dirty"); 282 } 283 abort() { 284 this.value !== "aborted" && (this.value = "aborted"); 285 } 286 static mergeArray(e, r) { 287 const a = []; 288 for (const t of r) { 289 if (t.status === "aborted") return ie; 290 t.status === "dirty" && e.dirty(), a.push(t.value); 291 } 292 return { status: e.value, value: a }; 293 } 294 static async mergeObjectAsync(e, r) { 295 const a = []; 296 for (const t of r) { 297 const n = await t.key, i = await t.value; 298 a.push({ key: n, value: i }); 299 } 300 return it.mergeObjectSync(e, a); 301 } 302 static mergeObjectSync(e, r) { 303 const a = {}; 304 for (const t of r) { 305 const { key: n, value: i } = t; 306 if (n.status === "aborted" || i.status === "aborted") return ie; 307 n.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), n.value === "__proto__" || i.value === void 0 && !t.alwaysSet || (a[n.value] = i.value); 308 } 309 return { status: e.value, value: a }; 310 } 311} 312const ie = Object.freeze({ status: "aborted" }), ps = (s) => ({ status: "dirty", value: s }), gt = (s) => ({ status: "valid", value: s }), Pn = (s) => s.status === "aborted", Sn = (s) => s.status === "dirty", fr = (s) => s.status === "valid", zr = (s) => typeof Promise < "u" && s instanceof Promise; 313var ee; 314(function(s) { 315 s.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, s.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message; 316})(ee || (ee = {})); 317class $t { 318 constructor(e, r, a, t) { 319 this._cachedPath = [], this.parent = e, this.data = r, this._path = a, this._key = t; 320 } 321 get path() { 322 return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath; 323 } 324} 325const wn = (s, e) => { 326 if (fr(e)) return { success: !0, data: e.value }; 327 if (!s.common.issues.length) throw new Error("Validation failed but no issues detected."); 328 return { success: !1, get error() { 329 if (this._error) return this._error; 330 const r = new Vt(s.common.issues); 331 return this._error = r, this._error; 332 } }; 333}; 334function ge(s) { 335 if (!s) return {}; 336 const { errorMap: e, invalid_type_error: r, required_error: a, description: t } = s; 337 if (e && (r || a)) throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`); 338 return e ? { errorMap: e, description: t } : { errorMap: (n, i) => { 339 const { message: o } = s; 340 return n.code === "invalid_enum_value" ? { message: o ?? i.defaultError } : i.data === void 0 ? { message: o ?? a ?? i.defaultError } : n.code !== "invalid_type" ? { message: i.defaultError } : { message: o ?? r ?? i.defaultError }; 341 }, description: t }; 342} 343class xe { 344 get description() { 345 return this._def.description; 346 } 347 _getType(e) { 348 return Jt(e.data); 349 } 350 _getOrReturnCtx(e, r) { 351 return r || { common: e.parent.common, data: e.data, parsedType: Jt(e.data), schemaErrorMap: this._def.errorMap, path: e.path, parent: e.parent }; 352 } 353 _processInputParams(e) { 354 return { status: new it(), ctx: { common: e.parent.common, data: e.data, parsedType: Jt(e.data), schemaErrorMap: this._def.errorMap, path: e.path, parent: e.parent } }; 355 } 356 _parseSync(e) { 357 const r = this._parse(e); 358 if (zr(r)) throw new Error("Synchronous parse encountered promise."); 359 return r; 360 } 361 _parseAsync(e) { 362 const r = this._parse(e); 363 return Promise.resolve(r); 364 } 365 parse(e, r) { 366 const a = this.safeParse(e, r); 367 if (a.success) return a.data; 368 throw a.error; 369 } 370 safeParse(e, r) { 371 const a = { common: { issues: [], async: (r == null ? void 0 : r.async) ?? !1, contextualErrorMap: r == null ? void 0 : r.errorMap }, path: (r == null ? void 0 : r.path) || [], schemaErrorMap: this._def.errorMap, parent: null, data: e, parsedType: Jt(e) }, t = this._parseSync({ data: e, path: a.path, parent: a }); 372 return wn(a, t); 373 } 374 "~validate"(e) { 375 var a, t; 376 const r = { common: { issues: [], async: !!this["~standard"].async }, path: [], schemaErrorMap: this._def.errorMap, parent: null, data: e, parsedType: Jt(e) }; 377 if (!this["~standard"].async) try { 378 const n = this._parseSync({ data: e, path: [], parent: r }); 379 return fr(n) ? { value: n.value } : { issues: r.common.issues }; 380 } catch (n) { 381 (t = (a = n == null ? void 0 : n.message) == null ? void 0 : a.toLowerCase()) != null && t.includes("encountered") && (this["~standard"].async = !0), r.common = { issues: [], async: !0 }; 382 } 383 return this._parseAsync({ data: e, path: [], parent: r }).then((n) => fr(n) ? { value: n.value } : { issues: r.common.issues }); 384 } 385 async parseAsync(e, r) { 386 const a = await this.safeParseAsync(e, r); 387 if (a.success) return a.data; 388 throw a.error; 389 } 390 async safeParseAsync(e, r) { 391 const a = { common: { issues: [], contextualErrorMap: r == null ? void 0 : r.errorMap, async: !0 }, path: (r == null ? void 0 : r.path) || [], schemaErrorMap: this._def.errorMap, parent: null, data: e, parsedType: Jt(e) }, t = this._parse({ data: e, path: a.path, parent: a }), n = await (zr(t) ? t : Promise.resolve(t)); 392 return wn(a, n); 393 } 394 refine(e, r) { 395 const a = (t) => typeof r == "string" || r === void 0 ? { message: r } : typeof r == "function" ? r(t) : r; 396 return this._refinement((t, n) => { 397 const i = e(t), o = () => n.addIssue({ code: M.custom, ...a(t) }); 398 return typeof Promise < "u" && i instanceof Promise ? i.then((u) => !!u || (o(), !1)) : !!i || (o(), !1); 399 }); 400 } 401 refinement(e, r) { 402 return this._refinement((a, t) => !!e(a) || (t.addIssue(typeof r == "function" ? r(a, t) : r), !1)); 403 } 404 _refinement(e) { 405 return new tr({ schema: this, typeName: ue.ZodEffects, effect: { type: "refinement", refinement: e } }); 406 } 407 superRefine(e) { 408 return this._refinement(e); 409 } 410 constructor(e) { 411 this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = { version: 1, vendor: "zod", validate: (r) => this["~validate"](r) }; 412 } 413 optional() { 414 return zt.create(this, this._def); 415 } 416 nullable() { 417 return sr.create(this, this._def); 418 } 419 nullish() { 420 return this.nullable().optional(); 421 } 422 array() { 423 return Ot.create(this); 424 } 425 promise() { 426 return Qr.create(this, this._def); 427 } 428 or(e) { 429 return Vr.create([this, e], this._def); 430 } 431 and(e) { 432 return Hr.create(this, e, this._def); 433 } 434 transform(e) { 435 return new tr({ ...ge(this._def), schema: this, typeName: ue.ZodEffects, effect: { type: "transform", transform: e } }); 436 } 437 default(e) { 438 const r = typeof e == "function" ? e : () => e; 439 return new Kr({ ...ge(this._def), innerType: this, defaultValue: r, typeName: ue.ZodDefault }); 440 } 441 brand() { 442 return new Bi({ typeName: ue.ZodBranded, type: this, ...ge(this._def) }); 443 } 444 catch(e) { 445 const r = typeof e == "function" ? e : () => e; 446 return new Jr({ ...ge(this._def), innerType: this, catchValue: r, typeName: ue.ZodCatch }); 447 } 448 describe(e) { 449 return new this.constructor({ ...this._def, description: e }); 450 } 451 pipe(e) { 452 return Us.create(this, e); 453 } 454 readonly() { 455 return Wr.create(this); 456 } 457 isOptional() { 458 return this.safeParse(void 0).success; 459 } 460 isNullable() { 461 return this.safeParse(null).success; 462 } 463} 464const su = /^c[^\s-]{8,}$/i, nu = /^[0-9a-z]+$/, iu = /^[0-9A-HJKMNP-TV-Z]{26}$/i, ou = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, uu = /^[a-z0-9_-]{21}$/i, lu = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, cu = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, du = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i; 465let _a; 466const hu = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, fu = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, pu = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, mu = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, vu = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, gu = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Ui = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", yu = new RegExp(`^${Ui}$`); 467function Vi(s) { 468 let e = "[0-5]\\d"; 469 return s.precision ? e = `${e}\\.\\d{${s.precision}}` : s.precision == null && (e = `${e}(\\.\\d+)?`), `([01]\\d|2[0-3]):[0-5]\\d(:${e})${s.precision ? "+" : "?"}`; 470} 471function _u(s) { 472 let e = `${Ui}T${Vi(s)}`; 473 const r = []; 474 return r.push(s.local ? "Z?" : "Z"), s.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`); 475} 476function bu(s, e) { 477 if (!lu.test(s)) return !1; 478 try { 479 const [r] = s.split("."), a = r.replace(/-/g, "+").replace(/_/g, "/").padEnd(r.length + (4 - r.length % 4) % 4, "="), t = JSON.parse(atob(a)); 480 return !(typeof t != "object" || t === null || "typ" in t && (t == null ? void 0 : t.typ) !== "JWT" || !t.alg || e && t.alg !== e); 481 } catch { 482 return !1; 483 } 484} 485function Pu(s, e) { 486 return !(e !== "v4" && e || !fu.test(s)) || !(e !== "v6" && e || !mu.test(s)); 487} 488class Zt extends xe { 489 _parse(e) { 490 if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== G.string) { 491 const i = this._getOrReturnCtx(e); 492 return Q(i, { code: M.invalid_type, expected: G.string, received: i.parsedType }), ie; 493 } 494 const r = new it(); 495 let a; 496 for (const i of this._def.checks) if (i.kind === "min") e.data.length < i.value && (a = this._getOrReturnCtx(e, a), Q(a, { code: M.too_small, minimum: i.value, type: "string", inclusive: !0, exact: !1, message: i.message }), r.dirty()); 497 else if (i.kind === "max") e.data.length > i.value && (a = this._getOrReturnCtx(e, a), Q(a, { code: M.too_big, maximum: i.value, type: "string", inclusive: !0, exact: !1, message: i.message }), r.dirty()); 498 else if (i.kind === "length") { 499 const o = e.data.length > i.value, u = e.data.length < i.value; 500 (o || u) && (a = this._getOrReturnCtx(e, a), o ? Q(a, { code: M.too_big, maximum: i.value, type: "string", inclusive: !0, exact: !0, message: i.message }) : u && Q(a, { code: M.too_small, minimum: i.value, type: "string", inclusive: !0, exact: !0, message: i.message }), r.dirty()); 501 } else if (i.kind === "email") du.test(e.data) || (a = this._getOrReturnCtx(e, a), Q(a, { validation: "email", code: M.invalid_string, message: i.message }), r.dirty()); 502 else if (i.kind === "emoji") _a || (_a = new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), _a.test(e.data) || (a = this._getOrReturnCtx(e, a), Q(a, { validation: "emoji", code: M.invalid_string, message: i.message }), r.dirty()); 503 else if (i.kind === "uuid") ou.test(e.data) || (a = this._getOrReturnCtx(e, a), Q(a, { validation: "uuid", code: M.invalid_string, message: i.message }), r.dirty());
504 else if (i.kind === "nanoid") uu.test(e.data) || (a = this._getOrReturnCtx(e, a), Q(a, { validation: "nanoid", code: M.invalid_string, message: i.message }), r.dirty()); 505 else if (i.kind === "cuid") su.test(e.data) || (a = this._getOrReturnCtx(e, a), Q(a, { validation: "cuid", code: M.invalid_string, message: i.message }), r.dirty()); 506 else if (i.kind === "cuid2") nu.test(e.data) || (a = this._getOrReturnCtx(e, a), Q(a, { validation: "cuid2", code: M.invalid_string, message: i.message }), r.dirty()); 507 else if (i.kind === "ulid") iu.test(e.data) || (a = this._getOrReturnCtx(e, a), Q(a, { validation: "ulid", code: M.invalid_string, message: i.message }), r.dirty()); 508 else if (i.kind === "url") try { 509 new URL(e.data); 510 } catch { 511 a = this._getOrReturnCtx(e, a), Q(a, { validation: "url", code: M.invalid_string, message: i.message }), r.dirty(); 512 } 513 else i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), Q(a, { validation: "regex", code: M.invalid_string, message: i.message }), r.dirty())) : i.kind === "trim" ? e.data = e.data.trim() : i.kind === "includes" ? e.data.includes(i.value, i.position) || (a = this._getOrReturnCtx(e, a), Q(a, { code: M.invalid_string, validation: { includes: i.value, position: i.position }, message: i.message }), r.dirty()) : i.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : i.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : i.kind === "startsWith" ? e.data.startsWith(i.value) || (a = this._getOrReturnCtx(e, a), Q(a, { code: M.invalid_string, validation: { startsWith: i.value }, message: i.message }), r.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (a = this._getOrReturnCtx(e, a), Q(a, { code: M.invalid_string, validation: { endsWith: i.value }, message: i.message }), r.dirty()) : i.kind === "datetime" ? _u(i).test(e.data) || (a = this._getOrReturnCtx(e, a), Q(a, { code: M.invalid_string, validation: "datetime", message: i.message }), r.dirty()) : i.kind === "date" ? yu.test(e.data) || (a = this._getOrReturnCtx(e, a), Q(a, { code: M.invalid_string, validation: "date", message: i.message }), r.dirty()) : i.kind === "time" ? new RegExp(`^${Vi(i)}$`).test(e.data) || (a = this._getOrReturnCtx(e, a), Q(a, { code: M.invalid_string, validation: "time", message: i.message }), r.dirty()) : i.kind === "duration" ? cu.test(e.data) || (a = this._getOrReturnCtx(e, a), Q(a, { validation: "duration", code: M.invalid_string, message: i.message }), r.dirty()) : i.kind === "ip" ? (t = e.data, ((n = i.version) !== "v4" && n || !hu.test(t)) && (n !== "v6" && n || !pu.test(t)) && (a = this._getOrReturnCtx(e, a), Q(a, { validation: "ip", code: M.invalid_string, message: i.message }
vendor: 38,415 bytes, lines 513-1405
513), r.dirty())) : i.kind === "jwt" ? bu(e.data, i.alg) || (a = this._getOrReturnCtx(e, a), Q(a, { validation: "jwt", code: M.invalid_string, message: i.message }), r.dirty()) : i.kind === "cidr" ? Pu(e.data, i.version) || (a = this._getOrReturnCtx(e, a), Q(a, { validation: "cidr", code: M.invalid_string, message: i.message }), r.dirty()) : i.kind === "base64" ? vu.test(e.data) || (a = this._getOrReturnCtx(e, a), Q(a, { validation: "base64", code: M.invalid_string, message: i.message }), r.dirty()) : i.kind === "base64url" ? gu.test(e.data) || (a = this._getOrReturnCtx(e, a), Q(a, { validation: "base64url", code: M.invalid_string, message: i.message }), r.dirty()) : Re.assertNever(i); 514 var t, n; 515 return { status: r.value, value: e.data }; 516 } 517 _regex(e, r, a) { 518 return this.refinement((t) => e.test(t), { validation: r, code: M.invalid_string, ...ee.errToObj(a) }); 519 } 520 _addCheck(e) { 521 return new Zt({ ...this._def, checks: [...this._def.checks, e] }); 522 } 523 email(e) { 524 return this._addCheck({ kind: "email", ...ee.errToObj(e) }); 525 } 526 url(e) { 527 return this._addCheck({ kind: "url", ...ee.errToObj(e) }); 528 } 529 emoji(e) { 530 return this._addCheck({ kind: "emoji", ...ee.errToObj(e) }); 531 } 532 uuid(e) { 533 return this._addCheck({ kind: "uuid", ...ee.errToObj(e) }); 534 } 535 nanoid(e) { 536 return this._addCheck({ kind: "nanoid", ...ee.errToObj(e) }); 537 } 538 cuid(e) { 539 return this._addCheck({ kind: "cuid", ...ee.errToObj(e) }); 540 } 541 cuid2(e) { 542 return this._addCheck({ kind: "cuid2", ...ee.errToObj(e) }); 543 } 544 ulid(e) { 545 return this._addCheck({ kind: "ulid", ...ee.errToObj(e) }); 546 } 547 base64(e) { 548 return this._addCheck({ kind: "base64", ...ee.errToObj(e) }); 549 } 550 base64url(e) { 551 return this._addCheck({ kind: "base64url", ...ee.errToObj(e) }); 552 } 553 jwt(e) { 554 return this._addCheck({ kind: "jwt", ...ee.errToObj(e) }); 555 } 556 ip(e) { 557 return this._addCheck({ kind: "ip", ...ee.errToObj(e) }); 558 } 559 cidr(e) { 560 return this._addCheck({ kind: "cidr", ...ee.errToObj(e) }); 561 } 562 datetime(e) { 563 return typeof e == "string" ? this._addCheck({ kind: "datetime", precision: null, offset: !1, local: !1, message: e }) : this._addCheck({ kind: "datetime", precision: (e == null ? void 0 : e.precision) === void 0 ? null : e == null ? void 0 : e.precision, offset: (e == null ? void 0 : e.offset) ?? !1, local: (e == null ? void 0 : e.local) ?? !1, ...ee.errToObj(e == null ? void 0 : e.message) }); 564 } 565 date(e) { 566 return this._addCheck({ kind: "date", message: e }); 567 } 568 time(e) { 569 return typeof e == "string" ? this._addCheck({ kind: "time", precision: null, message: e }) : this._addCheck({ kind: "time", precision: (e == null ? void 0 : e.precision) === void 0 ? null : e == null ? void 0 : e.precision, ...ee.errToObj(e == null ? void 0 : e.message) }); 570 } 571 duration(e) { 572 return this._addCheck({ kind: "duration", ...ee.errToObj(e) }); 573 } 574 regex(e, r) { 575 return this._addCheck({ kind: "regex", regex: e, ...ee.errToObj(r) }); 576 } 577 includes(e, r) { 578 return this._addCheck({ kind: "includes", value: e, position: r == null ? void 0 : r.position, ...ee.errToObj(r == null ? void 0 : r.message) }); 579 } 580 startsWith(e, r) { 581 return this._addCheck({ kind: "startsWith", value: e, ...ee.errToObj(r) }); 582 } 583 endsWith(e, r) { 584 return this._addCheck({ kind: "endsWith", value: e, ...ee.errToObj(r) }); 585 } 586 min(e, r) { 587 return this._addCheck({ kind: "min", value: e, ...ee.errToObj(r) }); 588 } 589 max(e, r) { 590 return this._addCheck({ kind: "max", value: e, ...ee.errToObj(r) }); 591 } 592 length(e, r) { 593 return this._addCheck({ kind: "length", value: e, ...ee.errToObj(r) }); 594 } 595 nonempty(e) { 596 return this.min(1, ee.errToObj(e)); 597 } 598 trim() { 599 return new Zt({ ...this._def, checks: [...this._def.checks, { kind: "trim" }] }); 600 } 601 toLowerCase() { 602 return new Zt({ ...this._def, checks: [...this._def.checks, { kind: "toLowerCase" }] }); 603 } 604 toUpperCase() { 605 return new Zt({ ...this._def, checks: [...this._def.checks, { kind: "toUpperCase" }] }); 606 } 607 get isDatetime() { 608 return !!this._def.checks.find((e) => e.kind === "datetime"); 609 } 610 get isDate() { 611 return !!this._def.checks.find((e) => e.kind === "date"); 612 } 613 get isTime() { 614 return !!this._def.checks.find((e) => e.kind === "time"); 615 } 616 get isDuration() { 617 return !!this._def.checks.find((e) => e.kind === "duration"); 618 } 619 get isEmail() { 620 return !!this._def.checks.find((e) => e.kind === "email"); 621 } 622 get isURL() { 623 return !!this._def.checks.find((e) => e.kind === "url"); 624 } 625 get isEmoji() { 626 return !!this._def.checks.find((e) => e.kind === "emoji"); 627 } 628 get isUUID() { 629 return !!this._def.checks.find((e) => e.kind === "uuid"); 630 } 631 get isNANOID() { 632 return !!this._def.checks.find((e) => e.kind === "nanoid"); 633 } 634 get isCUID() { 635 return !!this._def.checks.find((e) => e.kind === "cuid"); 636 } 637 get isCUID2() { 638 return !!this._def.checks.find((e) => e.kind === "cuid2"); 639 } 640 get isULID() { 641 return !!this._def.checks.find((e) => e.kind === "ulid"); 642 } 643 get isIP() { 644 return !!this._def.checks.find((e) => e.kind === "ip"); 645 } 646 get isCIDR() { 647 return !!this._def.checks.find((e) => e.kind === "cidr"); 648 } 649 get isBase64() { 650 return !!this._def.checks.find((e) => e.kind === "base64"); 651 } 652 get isBase64url() { 653 return !!this._def.checks.find((e) => e.kind === "base64url"); 654 } 655 get minLength() { 656 let e = null; 657 for (const r of this._def.checks) r.kind === "min" && (e === null || r.value > e) && (e = r.value); 658 return e; 659 } 660 get maxLength() { 661 let e = null; 662 for (const r of this._def.checks) r.kind === "max" && (e === null || r.value < e) && (e = r.value); 663 return e; 664 } 665} 666function Su(s, e) { 667 const r = (s.toString().split(".")[1] || "").length, a = (e.toString().split(".")[1] || "").length, t = r > a ? r : a; 668 return Number.parseInt(s.toFixed(t).replace(".", "")) % Number.parseInt(e.toFixed(t).replace(".", "")) / 10 ** t; 669} 670Zt.create = (s) => new Zt({ checks: [], typeName: ue.ZodString, coerce: (s == null ? void 0 : s.coerce) ?? !1, ...ge(s) }); 671class pr extends xe { 672 constructor() { 673 super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf; 674 } 675 _parse(e) { 676 if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== G.number) { 677 const t = this._getOrReturnCtx(e); 678 return Q(t, { code: M.invalid_type, expected: G.number, received: t.parsedType }), ie; 679 } 680 let r; 681 const a = new it(); 682 for (const t of this._def.checks) t.kind === "int" ? Re.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), Q(r, { code: M.invalid_type, expected: "integer", received: "float", message: t.message }), a.dirty()) : t.kind === "min" ? (t.inclusive ? e.data < t.value : e.data <= t.value) && (r = this._getOrReturnCtx(e, r), Q(r, { code: M.too_small, minimum: t.value, type: "number", inclusive: t.inclusive, exact: !1, message: t.message }), a.dirty()) : t.kind === "max" ? (t.inclusive ? e.data > t.value : e.data >= t.value) && (r = this._getOrReturnCtx(e, r), Q(r, { code: M.too_big, maximum: t.value, type: "number", inclusive: t.inclusive, exact: !1, message: t.message }), a.dirty()) : t.kind === "multipleOf" ? Su(e.data, t.value) !== 0 && (r = this._getOrReturnCtx(e, r), Q(r, { code: M.not_multiple_of, multipleOf: t.value, message: t.message }), a.dirty()) : t.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), Q(r, { code: M.not_finite, message: t.message }), a.dirty()) : Re.assertNever(t); 683 return { status: a.value, value: e.data }; 684 } 685 gte(e, r) { 686 return this.setLimit("min", e, !0, ee.toString(r)); 687 } 688 gt(e, r) { 689 return this.setLimit("min", e, !1, ee.toString(r)); 690 } 691 lte(e, r) { 692 return this.setLimit("max", e, !0, ee.toString(r)); 693 } 694 lt(e, r) { 695 return this.setLimit("max", e, !1, ee.toString(r)); 696 } 697 setLimit(e, r, a, t) { 698 return new pr({ ...this._def, checks: [...this._def.checks, { kind: e, value: r, inclusive: a, message: ee.toString(t) }] }); 699 } 700 _addCheck(e) { 701 return new pr({ ...this._def, checks: [...this._def.checks, e] }); 702 } 703 int(e) { 704 return this._addCheck({ kind: "int", message: ee.toString(e) }); 705 } 706 positive(e) { 707 return this._addCheck({ kind: "min", value: 0, inclusive: !1, message: ee.toString(e) }); 708 } 709 negative(e) { 710 return this._addCheck({ kind: "max", value: 0, inclusive: !1, message: ee.toString(e) }); 711 } 712 nonpositive(e) { 713 return this._addCheck({ kind: "max", value: 0, inclusive: !0, message: ee.toString(e) }); 714 } 715 nonnegative(e) { 716 return this._addCheck({ kind: "min", value: 0, inclusive: !0, message: ee.toString(e) }); 717 } 718 multipleOf(e, r) { 719 return this._addCheck({ kind: "multipleOf", value: e, message: ee.toString(r) }); 720 } 721 finite(e) { 722 return this._addCheck({ kind: "finite", message: ee.toString(e) }); 723 } 724 safe(e) { 725 return this._addCheck({ kind: "min", inclusive: !0, value: Number.MIN_SAFE_INTEGER, message: ee.toString(e) })._addCheck({ kind: "max", inclusive: !0, value: Number.MAX_SAFE_INTEGER, message: ee.toString(e) }); 726 } 727 get minValue() { 728 let e = null; 729 for (const r of this._def.checks) r.kind === "min" && (e === null || r.value > e) && (e = r.value); 730 return e; 731 } 732 get maxValue() { 733 let e = null; 734 for (const r of this._def.checks) r.kind === "max" && (e === null || r.value < e) && (e = r.value); 735 return e; 736 } 737 get isInt() { 738 return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && Re.isInteger(e.value)); 739 } 740 get isFinite() { 741 let e = null, r = null; 742 for (const a of this._def.checks) { 743 if (a.kind === "finite" || a.kind === "int" || a.kind === "multipleOf") return !0; 744 a.kind === "min" ? (r === null || a.value > r) && (r = a.value) : a.kind === "max" && (e === null || a.value < e) && (e = a.value); 745 } 746 return Number.isFinite(r) && Number.isFinite(e); 747 } 748} 749pr.create = (s) => new pr({ checks: [], typeName: ue.ZodNumber, coerce: (s == null ? void 0 : s.coerce) || !1, ...ge(s) }); 750class Rr extends xe { 751 constructor() { 752 super(...arguments), this.min = this.gte, this.max = this.lte; 753 } 754 _parse(e) { 755 if (this._def.coerce) try { 756 e.data = BigInt(e.data); 757 } catch { 758 return this._getInvalidInput(e); 759 } 760 if (this._getType(e) !== G.bigint) return this._getInvalidInput(e); 761 let r; 762 const a = new it(); 763 for (const t of this._def.checks) t.kind === "min" ? (t.inclusive ? e.data < t.value : e.data <= t.value) && (r = this._getOrReturnCtx(e, r), Q(r, { code: M.too_small, type: "bigint", minimum: t.value, inclusive: t.inclusive, message: t.message }), a.dirty()) : t.kind === "max" ? (t.inclusive ? e.data > t.value : e.data >= t.value) && (r = this._getOrReturnCtx(e, r), Q(r, { code: M.too_big, type: "bigint", maximum: t.value, inclusive: t.inclusive, message: t.message }), a.dirty()) : t.kind === "multipleOf" ? e.data % t.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), Q(r, { code: M.not_multiple_of, multipleOf: t.value, message: t.message }), a.dirty()) : Re.assertNever(t); 764 return { status: a.value, value: e.data }; 765 } 766 _getInvalidInput(e) { 767 const r = this._getOrReturnCtx(e); 768 return Q(r, { code: M.invalid_type, expected: G.bigint, received: r.parsedType }), ie; 769 } 770 gte(e, r) { 771 return this.setLimit("min", e, !0, ee.toString(r)); 772 } 773 gt(e, r) { 774 return this.setLimit("min", e, !1, ee.toString(r)); 775 } 776 lte(e, r) { 777 return this.setLimit("max", e, !0, ee.toString(r)); 778 } 779 lt(e, r) { 780 return this.setLimit("max", e, !1, ee.toString(r)); 781 } 782 setLimit(e, r, a, t) { 783 return new Rr({ ...this._def, checks: [...this._def.checks, { kind: e, value: r, inclusive: a, message: ee.toString(t) }] }); 784 } 785 _addCheck(e) { 786 return new Rr({ ...this._def, checks: [...this._def.checks, e] }); 787 } 788 positive(e) { 789 return this._addCheck({ kind: "min", value: BigInt(0), inclusive: !1, message: ee.toString(e) }); 790 } 791 negative(e) { 792 return this._addCheck({ kind: "max", value: BigInt(0), inclusive: !1, message: ee.toString(e) }); 793 } 794 nonpositive(e) { 795 return this._addCheck({ kind: "max", value: BigInt(0), inclusive: !0, message: ee.toString(e) }); 796 } 797 nonnegative(e) { 798 return this._addCheck({ kind: "min", value: BigInt(0), inclusive: !0, message: ee.toString(e) }); 799 } 800 multipleOf(e, r) { 801 return this._addCheck({ kind: "multipleOf", value: e, message: ee.toString(r) }); 802 } 803 get minValue() { 804 let e = null; 805 for (const r of this._def.checks) r.kind === "min" && (e === null || r.value > e) && (e = r.value); 806 return e; 807 } 808 get maxValue() { 809 let e = null; 810 for (const r of this._def.checks) r.kind === "max" && (e === null || r.value < e) && (e = r.value); 811 return e; 812 } 813} 814Rr.create = (s) => new Rr({ checks: [], typeName: ue.ZodBigInt, coerce: (s == null ? void 0 : s.coerce) ?? !1, ...ge(s) }); 815class ms extends xe { 816 _parse(e) { 817 if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== G.boolean) { 818 const r = this._getOrReturnCtx(e); 819 return Q(r, { code: M.invalid_type, expected: G.boolean, received: r.parsedType }), ie; 820 } 821 return gt(e.data); 822 } 823} 824ms.create = (s) => new ms({ typeName: ue.ZodBoolean, coerce: (s == null ? void 0 : s.coerce) || !1, ...ge(s) }); 825class Ur extends xe { 826 _parse(e) { 827 if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== G.date) { 828 const t = this._getOrReturnCtx(e); 829 return Q(t, { code: M.invalid_type, expected: G.date, received: t.parsedType }), ie; 830 } 831 if (Number.isNaN(e.data.getTime())) return Q(this._getOrReturnCtx(e), { code: M.invalid_date }), ie; 832 const r = new it(); 833 let a; 834 for (const t of this._def.checks) t.kind === "min" ? e.data.getTime() < t.value && (a = this._getOrReturnCtx(e, a), Q(a, { code: M.too_small, message: t.message, inclusive: !0, exact: !1, minimum: t.value, type: "date" }), r.dirty()) : t.kind === "max" ? e.data.getTime() > t.value && (a = this._getOrReturnCtx(e, a), Q(a, { code: M.too_big, message: t.message, inclusive: !0, exact: !1, maximum: t.value, type: "date" }), r.dirty()) : Re.assertNever(t); 835 return { status: r.value, value: new Date(e.data.getTime()) }; 836 } 837 _addCheck(e) { 838 return new Ur({ ...this._def, checks: [...this._def.checks, e] }); 839 } 840 min(e, r) { 841 return this._addCheck({ kind: "min", value: e.getTime(), message: ee.toString(r) }); 842 } 843 max(e, r) { 844 return this._addCheck({ kind: "max", value: e.getTime(), message: ee.toString(r) }); 845 } 846 get minDate() { 847 let e = null; 848 for (const r of this._def.checks) r.kind === "min" && (e === null || r.value > e) && (e = r.value); 849 return e != null ? new Date(e) : null; 850 } 851 get maxDate() { 852 let e = null; 853 for (const r of this._def.checks) r.kind === "max" && (e === null || r.value < e) && (e = r.value); 854 return e != null ? new Date(e) : null; 855 } 856} 857Ur.create = (s) => new Ur({ checks: [], coerce: (s == null ? void 0 : s.coerce) || !1, typeName: ue.ZodDate, ...ge(s) }); 858class xn extends xe { 859 _parse(e) { 860 if (this._getType(e) !== G.symbol) { 861 const r = this._getOrReturnCtx(e); 862 return Q(r, { code: M.invalid_type, expected: G.symbol, received: r.parsedType }), ie; 863 } 864 return gt(e.data); 865 } 866} 867xn.create = (s) => new xn({ typeName: ue.ZodSymbol, ...ge(s) }); 868class vs extends xe { 869 _parse(e) { 870 if (this._getType(e) !== G.undefined) { 871 const r = this._getOrReturnCtx(e); 872 return Q(r, { code: M.invalid_type, expected: G.undefined, received: r.parsedType }), ie; 873 } 874 return gt(e.data); 875 } 876} 877vs.create = (s) => new vs({ typeName: ue.ZodUndefined, ...ge(s) }); 878class gs extends xe { 879 _parse(e) { 880 if (this._getType(e) !== G.null) { 881 const r = this._getOrReturnCtx(e); 882 return Q(r, { code: M.invalid_type, expected: G.null, received: r.parsedType }), ie; 883 } 884 return gt(e.data); 885 } 886} 887gs.create = (s) => new gs({ typeName: ue.ZodNull, ...ge(s) }); 888class En extends xe { 889 constructor() { 890 super(...arguments), this._any = !0; 891 } 892 _parse(e) { 893 return gt(e.data); 894 } 895} 896En.create = (s) => new En({ typeName: ue.ZodAny, ...ge(s) }); 897class ys extends xe { 898 constructor() { 899 super(...arguments), this._unknown = !0; 900 } 901 _parse(e) { 902 return gt(e.data); 903 } 904} 905ys.create = (s) => new ys({ typeName: ue.ZodUnknown, ...ge(s) }); 906class Gt extends xe { 907 _parse(e) { 908 const r = this._getOrReturnCtx(e); 909 return Q(r, { code: M.invalid_type, expected: G.never, received: r.parsedType }), ie; 910 } 911} 912Gt.create = (s) => new Gt({ typeName: ue.ZodNever, ...ge(s) }); 913class Rn extends xe { 914 _parse(e) { 915 if (this._getType(e) !== G.undefined) { 916 const r = this._getOrReturnCtx(e); 917 return Q(r, { code: M.invalid_type, expected: G.void, received: r.parsedType }), ie; 918 } 919 return gt(e.data); 920 } 921} 922Rn.create = (s) => new Rn({ typeName: ue.ZodVoid, ...ge(s) }); 923class Ot extends xe { 924 _parse(e) { 925 const { ctx: r, status: a } = this._processInputParams(e), t = this._def; 926 if (r.parsedType !== G.array) return Q(r, { code: M.invalid_type, expected: G.array, received: r.parsedType }), ie; 927 if (t.exactLength !== null) { 928 const i = r.data.length > t.exactLength.value, o = r.data.length < t.exactLength.value; 929 (i || o) && (Q(r, { code: i ? M.too_big : M.too_small, minimum: o ? t.exactLength.value : void 0, maximum: i ? t.exactLength.value : void 0, type: "array", inclusive: !0, exact: !0, message: t.exactLength.message }), a.dirty()); 930 } 931 if (t.minLength !== null && r.data.length < t.minLength.value && (Q(r, { code: M.too_small, minimum: t.minLength.value, type: "array", inclusive: !0, exact: !1, message: t.minLength.message }), a.dirty()), t.maxLength !== null && r.data.length > t.maxLength.value && (Q(r, { code: M.too_big, maximum: t.maxLength.value, type: "array", inclusive: !0, exact: !1, message: t.maxLength.message }), a.dirty()), r.common.async) return Promise.all([...r.data].map((i, o) => t.type._parseAsync(new $t(r, i, r.path, o)))).then((i) => it.mergeArray(a, i)); 932 const n = [...r.data].map((i, o) => t.type._parseSync(new $t(r, i, r.path, o))); 933 return it.mergeArray(a, n); 934 } 935 get element() { 936 return this._def.type; 937 } 938 min(e, r) { 939 return new Ot({ ...this._def, minLength: { value: e, message: ee.toString(r) } }); 940 } 941 max(e, r) { 942 return new Ot({ ...this._def, maxLength: { value: e, message: ee.toString(r) } }); 943 } 944 length(e, r) { 945 return new Ot({ ...this._def, exactLength: { value: e, message: ee.toString(r) } }); 946 } 947 nonempty(e) { 948 return this.min(1, e); 949 } 950} 951function dr(s) { 952 if (s instanceof Be) { 953 const e = {}; 954 for (const r in s.shape) { 955 const a = s.shape[r]; 956 e[r] = zt.create(dr(a)); 957 } 958 return new Be({ ...s._def, shape: () => e }); 959 } 960 return s instanceof Ot ? new Ot({ ...s._def, type: dr(s.element) }) : s instanceof zt ? zt.create(dr(s.unwrap())) : s instanceof sr ? sr.create(dr(s.unwrap())) : s instanceof rr ? rr.create(s.items.map((e) => dr(e))) : s; 961} 962Ot.create = (s, e) => new Ot({ type: s, minLength: null, maxLength: null, exactLength: null, typeName: ue.ZodArray, ...ge(e) }); 963class Be extends xe { 964 constructor() { 965 super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend; 966 } 967 _getCached() { 968 if (this._cached !== null) return this._cached; 969 const e = this._def.shape(), r = Re.objectKeys(e); 970 return this._cached = { shape: e, keys: r }, this._cached; 971 } 972 _parse(e) { 973 if (this._getType(e) !== G.object) { 974 const u = this._getOrReturnCtx(e); 975 return Q(u, { code: M.invalid_type, expected: G.object, received: u.parsedType }), ie; 976 } 977 const { status: r, ctx: a } = this._processInputParams(e), { shape: t, keys: n } = this._getCached(), i = []; 978 if (!(this._def.catchall instanceof Gt && this._def.unknownKeys === "strip")) for (const u in a.data) n.includes(u) || i.push(u); 979 const o = []; 980 for (const u of n) { 981 const l = t[u], h = a.data[u]; 982 o.push({ key: { status: "valid", value: u }, value: l._parse(new $t(a, h, a.path, u)), alwaysSet: u in a.data }); 983 } 984 if (this._def.catchall instanceof Gt) { 985 const u = this._def.unknownKeys; 986 if (u === "passthrough") for (const l of i) o.push({ key: { status: "valid", value: l }, value: { status: "valid", value: a.data[l] } }); 987 else if (u === "strict") i.length > 0 && (Q(a, { code: M.unrecognized_keys, keys: i }), r.dirty()); 988 else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value."); 989 } else { 990 const u = this._def.catchall; 991 for (const l of i) { 992 const h = a.data[l]; 993 o.push({ key: { status: "valid", value: l }, value: u._parse(new $t(a, h, a.path, l)), alwaysSet: l in a.data }); 994 } 995 } 996 return a.common.async ? Promise.resolve().then(async () => { 997 const u = []; 998 for (const l of o) { 999 const h = await l.key, m = await l.value; 1000 u.push({ key: h, value: m, alwaysSet: l.alwaysSet }); 1001 } 1002 return u; 1003 }).then((u) => it.mergeObjectSync(r, u)) : it.mergeObjectSync(r, o); 1004 } 1005 get shape() { 1006 return this._def.shape(); 1007 } 1008 strict(e) { 1009 return ee.errToObj, new Be({ ...this._def, unknownKeys: "strict", ...e !== void 0 ? { errorMap: (r, a) => { 1010 var n, i; 1011 const t = ((i = (n = this._def).errorMap) == null ? void 0 : i.call(n, r, a).message) ?? a.defaultError; 1012 return r.code === "unrecognized_keys" ? { message: ee.errToObj(e).message ?? t } : { message: t }; 1013 } } : {} }); 1014 } 1015 strip() { 1016 return new Be({ ...this._def, unknownKeys: "strip" }); 1017 } 1018 passthrough() { 1019 return new Be({ ...this._def, unknownKeys: "passthrough" }); 1020 } 1021 extend(e) { 1022 return new Be({ ...this._def, shape: () => ({ ...this._def.shape(), ...e }) }); 1023 } 1024 merge(e) { 1025 return new Be({ unknownKeys: e._def.unknownKeys, catchall: e._def.catchall, shape: () => ({ ...this._def.shape(), ...e._def.shape() }), typeName: ue.ZodObject }); 1026 } 1027 setKey(e, r) { 1028 return this.augment({ [e]: r }); 1029 } 1030 catchall(e) { 1031 return new Be({ ...this._def, catchall: e }); 1032 } 1033 pick(e) { 1034 const r = {}; 1035 for (const a of Re.objectKeys(e)) e[a] && this.shape[a] && (r[a] = this.shape[a]); 1036 return new Be({ ...this._def, shape: () => r }); 1037 } 1038 omit(e) { 1039 const r = {}; 1040 for (const a of Re.objectKeys(this.shape)) e[a] || (r[a] = this.shape[a]); 1041 return new Be({ ...this._def, shape: () => r }); 1042 } 1043 deepPartial() { 1044 return dr(this); 1045 } 1046 partial(e) { 1047 const r = {}; 1048 for (const a of Re.objectKeys(this.shape)) { 1049 const t = this.shape[a]; 1050 e && !e[a] ? r[a] = t : r[a] = t.optional(); 1051 } 1052 return new Be({ ...this._def, shape: () => r }); 1053 } 1054 required(e) { 1055 const r = {}; 1056 for (const a of Re.objectKeys(this.shape)) if (e && !e[a]) r[a] = this.shape[a]; 1057 else { 1058 let t = this.shape[a]; 1059 for (; t instanceof zt; ) t = t._def.innerType; 1060 r[a] = t; 1061 } 1062 return new Be({ ...this._def, shape: () => r }); 1063 } 1064 keyof() { 1065 return Hi(Re.objectKeys(this.shape)); 1066 } 1067} 1068Be.create = (s, e) => new Be({ shape: () => s, unknownKeys: "strip", catchall: Gt.create(), typeName: ue.ZodObject, ...ge(e) }), Be.strictCreate = (s, e) => new Be({ shape: () => s, unknownKeys: "strict", catchall: Gt.create(), typeName: ue.ZodObject, ...ge(e) }), Be.lazycreate = (s, e) => new Be({ shape: s, unknownKeys: "strip", catchall: Gt.create(), typeName: ue.ZodObject, ...ge(e) }); 1069class Vr extends xe { 1070 _parse(e) { 1071 const { ctx: r } = this._processInputParams(e), a = this._def.options; 1072 if (r.common.async) return Promise.all(a.map(async (t) => { 1073 const n = { ...r, common: { ...r.common, issues: [] }, parent: null }; 1074 return { result: await t._parseAsync({ data: r.data, path: r.path, parent: n }), ctx: n }; 1075 })).then(function(t) { 1076 for (const i of t) if (i.result.status === "valid") return i.result; 1077 for (const i of t) if (i.result.status === "dirty") return r.common.issues.push(...i.ctx.common.issues), i.result; 1078 const n = t.map((i) => new Vt(i.ctx.common.issues)); 1079 return Q(r, { code: M.invalid_union, unionErrors: n }), ie; 1080 }); 1081 { 1082 let t; 1083 const n = []; 1084 for (const o of a) { 1085 const u = { ...r, common: { ...r.common, issues: [] }, parent: null }, l = o._parseSync({ data: r.data, path: r.path, parent: u }); 1086 if (l.status === "valid") return l; 1087 l.status !== "dirty" || t || (t = { result: l, ctx: u }), u.common.issues.length && n.push(u.common.issues); 1088 } 1089 if (t) return r.common.issues.push(...t.ctx.common.issues), t.result; 1090 const i = n.map((o) => new Vt(o)); 1091 return Q(r, { code: M.invalid_union, unionErrors: i }), ie; 1092 } 1093 } 1094 get options() { 1095 return this._def.options; 1096 } 1097} 1098Vr.create = (s, e) => new Vr({ options: s, typeName: ue.ZodUnion, ...ge(e) }); 1099const Kt = (s) => s instanceof bs ? Kt(s.schema) : s instanceof tr ? Kt(s.innerType()) : s instanceof Br ? [s.value] : s instanceof ar ? s.options : s instanceof Ps ? Re.objectValues(s.enum) : s instanceof Kr ? Kt(s._def.innerType) : s instanceof vs ? [void 0] : s instanceof gs ? [null] : s instanceof zt ? [void 0, ...Kt(s.unwrap())] : s instanceof sr ? [null, ...Kt(s.unwrap())] : s instanceof Bi || s instanceof Wr ? Kt(s.unwrap()) : s instanceof Jr ? Kt(s._def.innerType) : []; 1100class Ms extends xe { 1101 _parse(e) { 1102 const { ctx: r } = this._processInputParams(e); 1103 if (r.parsedType !== G.object) return Q(r, { code: M.invalid_type, expected: G.object, received: r.parsedType }), ie; 1104 const a = this.discriminator, t = r.data[a], n = this.optionsMap.get(t); 1105 return n ? r.common.async ? n._parseAsync({ data: r.data, path: r.path, parent: r }) : n._parseSync({ data: r.data, path: r.path, parent: r }) : (Q(r, { code: M.invalid_union_discriminator, options: Array.from(this.optionsMap.keys()), path: [a] }), ie); 1106 } 1107 get discriminator() { 1108 return this._def.discriminator; 1109 } 1110 get options() { 1111 return this._def.options; 1112 } 1113 get optionsMap() { 1114 return this._def.optionsMap; 1115 } 1116 static create(e, r, a) { 1117 const t = /* @__PURE__ */ new Map(); 1118 for (const n of r) { 1119 const i = Kt(n.shape[e]); 1120 if (!i.length) throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`); 1121 for (const o of i) { 1122 if (t.has(o)) throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`); 1123 t.set(o, n); 1124 } 1125 } 1126 return new Ms({ typeName: ue.ZodDiscriminatedUnion, discriminator: e, options: r, optionsMap: t, ...ge(a) }); 1127 } 1128} 1129function _s(s, e) { 1130 const r = Jt(s), a = Jt(e); 1131 if (s === e) return { valid: !0, data: s }; 1132 if (r === G.object && a === G.object) { 1133 const t = Re.objectKeys(e), n = Re.objectKeys(s).filter((o) => t.indexOf(o) !== -1), i = { ...s, ...e }; 1134 for (const o of n) { 1135 const u = _s(s[o], e[o]); 1136 if (!u.valid) return { valid: !1 }; 1137 i[o] = u.data; 1138 } 1139 return { valid: !0, data: i }; 1140 } 1141 if (r === G.array && a === G.array) { 1142 if (s.length !== e.length) return { valid: !1 }; 1143 const t = []; 1144 for (let n = 0; n < s.length; n++) { 1145 const i = _s(s[n], e[n]); 1146 if (!i.valid) return { valid: !1 }; 1147 t.push(i.data); 1148 } 1149 return { valid: !0, data: t }; 1150 } 1151 return r === G.date && a === G.date && +s == +e ? { valid: !0, data: s } : { valid: !1 }; 1152} 1153class Hr extends xe { 1154 _parse(e) { 1155 const { status: r, ctx: a } = this._processInputParams(e), t = (n, i) => { 1156 if (Pn(n) || Pn(i)) return ie; 1157 const o = _s(n.value, i.value); 1158 return o.valid ? ((Sn(n) || Sn(i)) && r.dirty(), { status: r.value, value: o.data }) : (Q(a, { code: M.invalid_intersection_types }), ie); 1159 }; 1160 return a.common.async ? Promise.all([this._def.left._parseAsync({ data: a.data, path: a.path, parent: a }), this._def.right._parseAsync({ data: a.data, path: a.path, parent: a })]).then(([n, i]) => t(n, i)) : t(this._def.left._parseSync({ data: a.data, path: a.path, parent: a }), this._def.right._parseSync({ data: a.data, path: a.path, parent: a })); 1161 } 1162} 1163Hr.create = (s, e, r) => new Hr({ left: s, right: e, typeName: ue.ZodIntersection, ...ge(r) }); 1164class rr extends xe { 1165 _parse(e) { 1166 const { status: r, ctx: a } = this._processInputParams(e); 1167 if (a.parsedType !== G.array) return Q(a, { code: M.invalid_type, expected: G.array, received: a.parsedType }), ie; 1168 if (a.data.length < this._def.items.length) return Q(a, { code: M.too_small, minimum: this._def.items.length, inclusive: !0, exact: !1, type: "array" }), ie; 1169 !this._def.rest && a.data.length > this._def.items.length && (Q(a, { code: M.too_big, maximum: this._def.items.length, inclusive: !0, exact: !1, type: "array" }), r.dirty()); 1170 const t = [...a.data].map((n, i) => { 1171 const o = this._def.items[i] || this._def.rest; 1172 return o ? o._parse(new $t(a, n, a.path, i)) : null; 1173 }).filter((n) => !!n); 1174 return a.common.async ? Promise.all(t).then((n) => it.mergeArray(r, n)) : it.mergeArray(r, t); 1175 } 1176 get items() { 1177 return this._def.items; 1178 } 1179 rest(e) { 1180 return new rr({ ...this._def, rest: e }); 1181 } 1182} 1183rr.create = (s, e) => { 1184 if (!Array.isArray(s)) throw new Error("You must pass an array of schemas to z.tuple([ ... ])"); 1185 return new rr({ items: s, typeName: ue.ZodTuple, rest: null, ...ge(e) }); 1186}; 1187class zs extends xe { 1188 get keySchema() { 1189 return this._def.keyType; 1190 } 1191 get valueSchema() { 1192 return this._def.valueType; 1193 } 1194 _parse(e) { 1195 const { status: r, ctx: a } = this._processInputParams(e); 1196 if (a.parsedType !== G.object) return Q(a, { code: M.invalid_type, expected: G.object, received: a.parsedType }), ie; 1197 const t = [], n = this._def.keyType, i = this._def.valueType; 1198 for (const o in a.data) t.push({ key: n._parse(new $t(a, o, a.path, o)), value: i._parse(new $t(a, a.data[o], a.path, o)), alwaysSet: o in a.data }); 1199 return a.common.async ? it.mergeObjectAsync(r, t) : it.mergeObjectSync(r, t); 1200 } 1201 get element() { 1202 return this._def.valueType; 1203 } 1204 static create(e, r, a) { 1205 return new zs(r instanceof xe ? { keyType: e, valueType: r, typeName: ue.ZodRecord, ...ge(a) } : { keyType: Zt.create(), valueType: e, typeName: ue.ZodRecord, ...ge(r) }); 1206 } 1207} 1208class kn extends xe { 1209 get keySchema() { 1210 return this._def.keyType; 1211 } 1212 get valueSchema() { 1213 return this._def.valueType; 1214 } 1215 _parse(e) { 1216 const { status: r, ctx: a } = this._processInputParams(e); 1217 if (a.parsedType !== G.map) return Q(a, { code: M.invalid_type, expected: G.map, received: a.parsedType }), ie; 1218 const t = this._def.keyType, n = this._def.valueType, i = [...a.data.entries()].map(([o, u], l) => ({ key: t._parse(new $t(a, o, a.path, [l, "key"])), value: n._parse(new $t(a, u, a.path, [l, "value"])) })); 1219 if (a.common.async) { 1220 const o = /* @__PURE__ */ new Map(); 1221 return Promise.resolve().then(async () => { 1222 for (const u of i) { 1223 const l = await u.key, h = await u.value; 1224 if (l.status === "aborted" || h.status === "aborted") return ie; 1225 l.status !== "dirty" && h.status !== "dirty" || r.dirty(), o.set(l.value, h.value); 1226 } 1227 return { status: r.value, value: o }; 1228 }); 1229 } 1230 { 1231 const o = /* @__PURE__ */ new Map(); 1232 for (const u of i) { 1233 const l = u.key, h = u.value; 1234 if (l.status === "aborted" || h.status === "aborted") return ie; 1235 l.status !== "dirty" && h.status !== "dirty" || r.dirty(), o.set(l.value, h.value); 1236 } 1237 return { status: r.value, value: o }; 1238 } 1239 } 1240} 1241kn.create = (s, e, r) => new kn({ valueType: e, keyType: s, typeName: ue.ZodMap, ...ge(r) }); 1242class kr extends xe { 1243 _parse(e) { 1244 const { status: r, ctx: a } = this._processInputParams(e); 1245 if (a.parsedType !== G.set) return Q(a, { code: M.invalid_type, expected: G.set, received: a.parsedType }), ie; 1246 const t = this._def; 1247 t.minSize !== null && a.data.size < t.minSize.value && (Q(a, { code: M.too_small, minimum: t.minSize.value, type: "set", inclusive: !0, exact: !1, message: t.minSize.message }), r.dirty()), t.maxSize !== null && a.data.size > t.maxSize.value && (Q(a, { code: M.too_big, maximum: t.maxSize.value, type: "set", inclusive: !0, exact: !1, message: t.maxSize.message }), r.dirty()); 1248 const n = this._def.valueType; 1249 function i(u) { 1250 const l = /* @__PURE__ */ new Set(); 1251 for (const h of u) { 1252 if (h.status === "aborted") return ie; 1253 h.status === "dirty" && r.dirty(), l.add(h.value); 1254 } 1255 return { status: r.value, value: l }; 1256 } 1257 const o = [...a.data.values()].map((u, l) => n._parse(new $t(a, u, a.path, l))); 1258 return a.common.async ? Promise.all(o).then((u) => i(u)) : i(o); 1259 } 1260 min(e, r) { 1261 return new kr({ ...this._def, minSize: { value: e, message: ee.toString(r) } }); 1262 } 1263 max(e, r) { 1264 return new kr({ ...this._def, maxSize: { value: e, message: ee.toString(r) } }); 1265 } 1266 size(e, r) { 1267 return this.min(e, r).max(e, r); 1268 } 1269 nonempty(e) { 1270 return this.min(1, e); 1271 } 1272} 1273kr.create = (s, e) => new kr({ valueType: s, minSize: null, maxSize: null, typeName: ue.ZodSet, ...ge(e) }); 1274class bs extends xe { 1275 get schema() { 1276 return this._def.getter(); 1277 } 1278 _parse(e) { 1279 const { ctx: r } = this._processInputParams(e); 1280 return this._def.getter()._parse({ data: r.data, path: r.path, parent: r }); 1281 } 1282} 1283bs.create = (s, e) => new bs({ getter: s, typeName: ue.ZodLazy, ...ge(e) }); 1284class Br extends xe { 1285 _parse(e) { 1286 if (e.data !== this._def.value) { 1287 const r = this._getOrReturnCtx(e); 1288 return Q(r, { received: r.data, code: M.invalid_literal, expected: this._def.value }), ie; 1289 } 1290 return { status: "valid", value: e.data }; 1291 } 1292 get value() { 1293 return this._def.value; 1294 } 1295} 1296function Hi(s, e) { 1297 return new ar({ values: s, typeName: ue.ZodEnum, ...ge(e) }); 1298} 1299Br.create = (s, e) => new Br({ value: s, typeName: ue.ZodLiteral, ...ge(e) }); 1300class ar extends xe { 1301 _parse(e) { 1302 if (typeof e.data != "string") { 1303 const r = this._getOrReturnCtx(e), a = this._def.values; 1304 return Q(r, { expected: Re.joinValues(a), received: r.parsedType, code: M.invalid_type }), ie; 1305 } 1306 if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) { 1307 const r = this._getOrReturnCtx(e), a = this._def.values; 1308 return Q(r, { received: r.data, code: M.invalid_enum_value, options: a }), ie; 1309 } 1310 return gt(e.data); 1311 } 1312 get options() { 1313 return this._def.values; 1314 } 1315 get enum() { 1316 const e = {}; 1317 for (const r of this._def.values) e[r] = r; 1318 return e; 1319 } 1320 get Values() { 1321 const e = {}; 1322 for (const r of this._def.values) e[r] = r; 1323 return e; 1324 } 1325 get Enum() { 1326 const e = {}; 1327 for (const r of this._def.values) e[r] = r; 1328 return e; 1329 } 1330 extract(e, r = this._def) { 1331 return ar.create(e, { ...this._def, ...r }); 1332 } 1333 exclude(e, r = this._def) { 1334 return ar.create(this.options.filter((a) => !e.includes(a)), { ...this._def, ...r }); 1335 } 1336} 1337ar.create = Hi; 1338class Ps extends xe { 1339 _parse(e) { 1340 const r = Re.getValidEnumValues(this._def.values), a = this._getOrReturnCtx(e); 1341 if (a.parsedType !== G.string && a.parsedType !== G.number) { 1342 const t = Re.objectValues(r); 1343 return Q(a, { expected: Re.joinValues(t), received: a.parsedType, code: M.invalid_type }), ie; 1344 } 1345 if (this._cache || (this._cache = new Set(Re.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) { 1346 const t = Re.objectValues(r); 1347 return Q(a, { received: a.data, code: M.invalid_enum_value, options: t }), ie; 1348 } 1349 return gt(e.data); 1350 } 1351 get enum() { 1352 return this._def.values; 1353 } 1354} 1355Ps.create = (s, e) => new Ps({ values: s, typeName: ue.ZodNativeEnum, ...ge(e) }); 1356class Qr extends xe { 1357 unwrap() { 1358 return this._def.type; 1359 } 1360 _parse(e) { 1361 const { ctx: r } = this._processInputParams(e); 1362 if (r.parsedType !== G.promise && r.common.async === !1) return Q(r, { code: M.invalid_type, expected: G.promise, received: r.parsedType }), ie; 1363 const a = r.parsedType === G.promise ? r.data : Promise.resolve(r.data); 1364 return gt(a.then((t) => this._def.type.parseAsync(t, { path: r.path, errorMap: r.common.contextualErrorMap }))); 1365 } 1366} 1367Qr.create = (s, e) => new Qr({ type: s, typeName: ue.ZodPromise, ...ge(e) }); 1368class tr extends xe { 1369 innerType() { 1370 return this._def.schema; 1371 } 1372 sourceType() { 1373 return this._def.schema._def.typeName === ue.ZodEffects ? this._def.schema.sourceType() : this._def.schema; 1374 } 1375 _parse(e) { 1376 const { status: r, ctx: a } = this._processInputParams(e), t = this._def.effect || null, n = { addIssue: (i) => { 1377 Q(a, i), i.fatal ? r.abort() : r.dirty(); 1378 }, get path() { 1379 return a.path; 1380 } }; 1381 if (n.addIssue = n.addIssue.bind(n), t.type === "preprocess") { 1382 const i = t.transform(a.data, n); 1383 if (a.common.async) return Promise.resolve(i).then(async (o) => { 1384 if (r.value === "aborted") return ie; 1385 const u = await this._def.schema._parseAsync({ data: o, path: a.path, parent: a }); 1386 return u.status === "aborted" ? ie : u.status === "dirty" || r.value === "dirty" ? ps(u.value) : u; 1387 }); 1388 { 1389 if (r.value === "aborted") return ie; 1390 const o = this._def.schema._parseSync({ data: i, path: a.path, parent: a }); 1391 return o.status === "aborted" ? ie : o.status === "dirty" || r.value === "dirty" ? ps(o.value) : o; 1392 } 1393 } 1394 if (t.type === "refinement") { 1395 const i = (o) => { 1396 const u = t.refinement(o, n); 1397 if (a.common.async) return Promise.resolve(u); 1398 if (u instanceof Promise) throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead."); 1399 return o; 1400 }; 1401 if (a.common.async === !1) { 1402 const o = this._def.schema._parseSync({ data: a.data, path: a.path, parent: a }); 1403 return o.status === "aborted" ? ie : (o.status === "dirty" && r.dirty(), i(o.value), { status: r.value, value: o.value }); 1404 } 1405 return this._def.schema._parseAsync({ data: a.data, path: a.path, parent: a }).then((o) => o.status === "aborted" ? ie : (o.status === "dirty" && r.dirty(), i(o.value).then(() => ({ status: r.value, value: o.value }
1405)))); 1406 } 1407 if (t.type === "transform") { 1408 if (a.common.async === !1) { 1409 const i = this._def.schema._parseSync({ data: a.data, path: a.path, parent: a }); 1410 if (!fr(i)) return ie; 1411 const o = t.transform(i.value, n); 1412 if (o instanceof Promise) throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead."); 1413 return { status: r.value, value: o }; 1414 } 1415 return this._def.schema._parseAsync({ data: a.data, path: a.path, parent: a }).then((i) => fr(i) ? Promise.resolve(t.transform(i.value, n)).then((o) => ({ status: r.value, value: o })) : ie); 1416 } 1417 Re.assertNever(t); 1418 } 1419} 1420tr.create = (s, e, r) => new tr({ schema: s, typeName: ue.ZodEffects, effect: e, ...ge(r) }), tr.createWithPreprocess = (s, e, r) => new tr({ schema: e, effect: { type: "preprocess", transform: s }, typeName: ue.ZodEffects, ...ge(r) }); 1421class zt extends xe { 1422 _parse(e) { 1423 return this._getType(e) === G.undefined ? gt(void 0) : this._def.innerType._parse(e); 1424 } 1425 unwrap() { 1426 return this._def.innerType; 1427 } 1428} 1429zt.create = (s, e) => new zt({ innerType: s, typeName: ue.ZodOptional, ...ge(e) }); 1430class sr extends xe { 1431 _parse(e) { 1432 return this._getType(e) === G.null ? gt(null) : this._def.innerType._parse(e); 1433 } 1434 unwrap() { 1435 return this._def.innerType; 1436 } 1437} 1438sr.create = (s, e) => new sr({ innerType: s, typeName: ue.ZodNullable, ...ge(e) }); 1439class Kr extends xe { 1440 _parse(e) { 1441 const { ctx: r } = this._processInputParams(e); 1442 let a = r.data; 1443 return r.parsedType === G.undefined && (a = this._def.defaultValue()), this._def.innerType._parse({ data: a, path: r.path, parent: r }); 1444 } 1445 removeDefault() { 1446 return this._def.innerType; 1447 } 1448} 1449Kr.create = (s, e) => new Kr({ innerType: s, typeName: ue.ZodDefault, defaultValue: typeof e.default == "function" ? e.default : () => e.default, ...ge(e) }); 1450class Jr extends xe { 1451 _parse(e) { 1452 const { ctx: r } = this._processInputParams(e), a = { ...r, common: { ...r.common, issues: [] } }, t = this._def.innerType._parse({ data: a.data, path: a.path, parent: { ...a } }); 1453 return zr(t) ? t.then((n) => ({ status: "valid", value: n.status === "valid" ? n.value : this._def.catchValue({ get error() { 1454 return new Vt(a.common.issues); 1455 }, input: a.data }) })) : { status: "valid", value: t.status === "valid" ? t.value : this._def.catchValue({ get error() { 1456 return new Vt(a.common.issues); 1457 }, input: a.data }) }; 1458 } 1459 removeCatch() { 1460 return this._def.innerType; 1461 } 1462} 1463Jr.create = (s, e) => new Jr({ innerType: s, typeName: ue.ZodCatch, catchValue: typeof e.catch == "function" ? e.catch : () => e.catch, ...ge(e) }); 1464class Tn extends xe { 1465 _parse(e) { 1466 if (this._getType(e) !== G.nan) { 1467 const r = this._getOrReturnCtx(e); 1468 return Q(r, { code: M.invalid_type, expected: G.nan, received: r.parsedType }), ie; 1469 } 1470 return { status: "valid", value: e.data }; 1471 } 1472} 1473Tn.create = (s) => new Tn({ typeName: ue.ZodNaN, ...ge(s) }); 1474class Bi extends xe { 1475 _parse(e) { 1476 const { ctx: r } = this._processInputParams(e), a = r.data; 1477 return this._def.type._parse({ data: a, path: r.path, parent: r }); 1478 } 1479 unwrap() { 1480 return this._def.type; 1481 } 1482} 1483class Us extends xe { 1484 _parse(e) { 1485 const { status: r, ctx: a } = this._processInputParams(e); 1486 if (a.common.async) return (async () => { 1487 const t = await this._def.in._parseAsync({ data: a.data, path: a.path, parent: a }); 1488 return t.status === "aborted" ? ie : t.status === "dirty" ? (r.dirty(), ps(t.value)) : this._def.out._parseAsync({ data: t.value, path: a.path, parent: a }); 1489 })(); 1490 { 1491 const t = this._def.in._parseSync({ data: a.data, path: a.path, parent: a }); 1492 return t.status === "aborted" ? ie : t.status === "dirty" ? (r.dirty(), { status: "dirty", value: t.value }) : this._def.out._parseSync({ data: t.value, path: a.path, parent: a }); 1493 } 1494 } 1495 static create(e, r) { 1496 return new Us({ in: e, out: r, typeName: ue.ZodPipeline }); 1497 } 1498} 1499class Wr extends xe { 1500 _parse(e) { 1501 const r = this._def.innerType._parse(e), a = (t) => (fr(t) && (t.value = Object.freeze(t.value)), t); 1502 return zr(r) ? r.then((t) => a(t)) : a(r); 1503 } 1504 unwrap() { 1505 return this._def.innerType; 1506 } 1507} 1508var ue; 1509Wr.create = (s, e) => new Wr({ innerType: s, typeName: ue.ZodReadonly, ...ge(e) }), function(s) { 1510 s.ZodString = "ZodString", s.ZodNumber = "ZodNumber", s.ZodNaN = "ZodNaN", s.ZodBigInt = "ZodBigInt", s.ZodBoolean = "ZodBoolean", s.ZodDate = "ZodDate", s.ZodSymbol = "ZodSymbol", s.ZodUndefined = "ZodUndefined", s.ZodNull = "ZodNull", s.ZodAny = "ZodAny", s.ZodUnknown = "ZodUnknown", s.ZodNever = "ZodNever", s.ZodVoid = "ZodVoid", s.ZodArray = "ZodArray", s.ZodObject = "ZodObject", s.ZodUnion = "ZodUnion", s.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", s.ZodIntersection = "ZodIntersection", s.ZodTuple = "ZodTuple", s.ZodRecord = "ZodRecord", s.ZodMap = "ZodMap", s.ZodSet = "ZodSet", s.ZodFunction = "ZodFunction", s.ZodLazy = "ZodLazy", s.ZodLiteral = "ZodLiteral", s.ZodEnum = "ZodEnum", s.ZodEffects = "ZodEffects", s.ZodNativeEnum = "ZodNativeEnum", s.ZodOptional = "ZodOptional", s.ZodNullable = "ZodNullable", s.ZodDefault = "ZodDefault", s.ZodCatch = "ZodCatch", s.ZodPromise = "ZodPromise", s.ZodBranded = "ZodBranded", s.ZodPipeline = "ZodPipeline", s.ZodReadonly = "ZodReadonly"; 1511}(ue || (ue = {})); 1512const J = Zt.create, nt = pr.create, pt = ms.create, Tr = ys.create, We = (Gt.create, Ot.create), X = Be.create, st = Vr.create, wu = Ms.create, Cr = (Hr.create, rr.create, zs.create), pe = Br.create, Ht = ar.create, F = (Qr.create, zt.create), ua = (sr.create, "2.0"), Qi = st([J(), nt().int()]), Ki = J(), xu = X({ progressToken: F(Qi) }).passthrough(), yt = X({ _meta: F(xu) }).passthrough(), ht = X({ method: J(), params: F(yt) }), $r = X({ _meta: F(X({}).passthrough()) }).passthrough(), Dt = X({ method: J(), params: F($r) }), _t = X({ _meta: F(X({}).passthrough()) }).passthrough(), la = st([J(), nt().int()]), Eu = X({ jsonrpc: pe(ua), id: la }).merge(ht).strict(), Ru = X({ jsonrpc: pe(ua) }).merge(Dt).strict(), ku = X({ jsonrpc: pe(ua), id: la, result: _t }).strict(); 1513var An; 1514(function(s) { 1515 s[s.ConnectionClosed = -32e3] = "ConnectionClosed", s[s.RequestTimeout = -32001] = "RequestTimeout", s[s.ParseError = -32700] = "ParseError", s[s.InvalidRequest = -32600] = "InvalidRequest", s[s.MethodNotFound = -32601] = "MethodNotFound", s[s.InvalidParams = -32602] = "InvalidParams", s[s.InternalError = -32603] = "InternalError"; 1516})(An || (An = {})); 1517const Tu = st([Eu, Ru, ku, X({ jsonrpc: pe(ua), id: la, error: X({ co
1517de: nt().int(), message: J(), data: F(Tr()) }) }).strict()]), On = _t.strict(), Cn = Dt.extend({ method: pe("notifications/cancelled"), params: $r.extend({ requestId: la, reason: J().optional() }) }), Ir = X({ name: J(), title: F(J()) }).passthrough(), Ji = Ir.extend({ version: J() }), Au = X({ experimental: F(X({}).passthrough()), sampling: F(X({}).passthrough()), elicitation: F(X({}).passthrough()), roots: F(X({ listChanged: F(pt()) }).passthrough()) }).passthrough(), Ou = ht.extend({ method: pe("initialize"), params: yt.extend({ protocolVersion: J(), capabilities: Au, clientInfo: Ji }) }), Cu = X({ experimental: F(X({}).passthrough()), logging: F(X({}).passthrough()), completions: F(X({}).passthrough()), prompts: F(X({ listChanged: F(pt()) }).passthrough()), resources: F(X({ subscribe: F(pt()), listChanged: F(pt()) }).passthrough()), tools: F(X({ listChanged: F(pt()) }).passthrough()) }).passthrough(), $u = _t.extend({ protocolVersion: J(), capabilities: Cu, serverInfo: Ji, instructions: F(J()) }), Iu = Dt.extend({ method: pe("notifications/initialized") }), $n = ht.extend({ method: pe("ping") }), Nu = X({ progress: nt(), total: F(nt()), message: F(J()) }).passthrough(), In = Dt.extend({ method: pe("notifications/progress"), params: $r.merge(Nu).extend({ progressToken: Qi }) }), ca = ht.extend({ params: yt.extend({ cursor: F(Ki) }).optional() }), da = _t.extend({ nextCursor: F(Ki) }), Wi = X({ uri: J(), mimeType: F(J()), _meta: F(X({}).passthrough()) }).passthrough(), Gi = Wi.extend({ text: J() }), Yi = Wi.extend({ blob: J().base64() }), Xi = Ir.extend({ uri: J(), description: F(J()), mimeType: F(J()), _meta: F(X({}).passthrough()) }), Du = Ir.extend({ uriTemplate: J(), description: F(J()), mimeType: F(J()), _meta: F(X({}).passthrough()) }), ju = ca.extend({ method: pe("resources/list") }), Fu = da.extend({ resources: We(Xi) }), qu = ca.extend({ method: pe("resources/templates/list") }), Lu = da.extend({ resourceTemplates: We(Du) }), Zu = ht.extend({ method: pe("resources/read"), params: yt.extend({ uri: J() }) }), Mu = _t.extend({ contents: We(st([Gi, Yi])) }), zu = Dt.extend({ method: pe("notifications/resources/list_changed") }), Uu = ht.extend({ method: pe("resources/subscribe"), params: yt.extend({ uri: J() }) }), Vu = ht.extend({ method: pe("resources/unsubscribe"), params: yt.extend({ uri: J() }) }), Hu = Dt.extend({ method: pe("notifications/resources/updated"), params: $r.extend({ uri: J() }) }), Bu = X({ name: J(), description: F(J()), required: F(pt()) }).passthrough(), Qu = Ir.extend({ description: F(J()), arguments: F(We(Bu)), _meta: F(X({}).passthrough()) }), Ku = ca.extend({ method: pe("prompts/list") }), Ju = da.extend({ prompts: We(Qu) }), Wu = ht.extend({ method: pe("prompts/get"), params: yt.extend({ name: J(), arguments: F(Cr(J())) }) }), Vs = X({ type: pe("text"), text: J(), _meta: F(X({}).passthrough()) }).passthrough(), Hs = X({ type: pe("image"), data: J().base64(), mimeType: J(), _meta: F(X({}).passthrough()) }).passthrough(), Bs = X({ type: pe("audio"), data: J().base64(), mimeType: J(), _meta: F(X({}).passthrough()) }).passthrough(), Gu = X({ type: pe("resource"), resource: st([Gi, Yi]), _meta: F(X({}).passthrough()) }).passthrough(), eo = st([Vs, Hs, Bs, Xi.extend({ type: pe("resource_link") }), Gu]), Yu = X({ role: Ht(["user", "assistant"]), content: eo }).passthrough(), Xu = _t.extend({ description: F(J()), messages: We(Yu) }), el = Dt.extend({ method: pe("notifications/prompts/list_changed") }), tl = X({ title: F(J()), readOnlyHint: F(pt()), destructiveHint: F(pt()), idempotentHint: F(pt()), openWorldHint: F(pt()) }).passthrough(), rl = Ir.extend({ description: F(J()), inputSchema: X({ type: pe("object"), properties: F(X({}).passthrough()), required: F(We(J())) }).passthrough(), outputSchema: F(X({ type: pe("object"), properties: F(X({}).passthrough()), required: F(We(J())) }).passthrough()), annotations: F(tl), _meta: F(X({}).passthrough()) }), al = ca.extend({ method: pe("tools/list") }), sl = da.extend({ tools: We(rl) }), to = _t.extend({ content: We(eo).default([]), structuredContent: X({}).passthrough().optional(), isError: F(pt()) }), nl = (to.or(_t.extend({ toolResult: Tr() })), ht.extend({ method: pe("tools/call"), params: yt.extend({ name: J(), arguments: F(Cr(Tr())) }) })), il = Dt.extend({ method: pe("notifications/tools/list_changed") }), ro = Ht(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]), ol = ht.extend({ method: pe("logging/setLevel"), params: yt.extend({ level: ro }) }), ul = Dt.extend({ method: pe("notifications/message"), params: $r.extend({ level: ro, logger: F(J()), data: Tr() }) }), ll = X({ name: J().optional() }).passthrough(), cl = X({ hints: F(We(ll)), costPriority: F(nt().min(0).max(1)), speedPriority: F(nt().min(0).max(1)), intelligencePriority: F(nt().min(0).max(1)) }).passthrough(), dl = X({ role: Ht(["user", "assistant"]), content: st([Vs, Hs, Bs]) }).passthrough(), hl = ht.extend({ method: pe("sampling/createMessage"), params: yt.extend({ messages: We(dl), systemPrompt: F(J()), includeContext: F(Ht(["none", "thisServer", "allServers"])), temperature: F(nt()), maxTokens: nt().int(), stopSequences: F(We(J())), metadata: F(X({}).passthrough()), modelPreferences: F(cl) }) }), fl = _t.extend({ model: J(), stopReason: F(Ht(["endTurn", "stopSequence", "maxTokens"]).or(J())), role: Ht(["user", "assistant"]), content: wu("type", [Vs, Hs, Bs]) }), pl = st([X({ type: pe("boolean"), title: F(J()), description: F(J()), default: F(pt()) }
1517).passthrough(), X({ type: pe("string"), title: F(J()), description: F(J()), minLength: F(nt()), maxLength: F(nt()), format: F(Ht(["email", "uri", "date", "date-time"])) }).passthrough(), X({ type: Ht(["number", "integer"]), title: F(J()), description: F(J()), minimum: F(nt()), maximum: F(nt()) }).passthrough(), X({ type: pe("string"), title: F(J()), description: F(J()), enum: We(J()), enumNames: F(We(J())) }).passthrough()]), ml = ht.extend({ method: pe("elicitation/create"), params: yt.extend({ message: J(), requestedSchema: X({ type: pe("object"), properties: Cr(J(), pl), required: F(We(J())) }).passthrough() }) }), vl = _t.extend({ action: Ht(["accept", "reject", "cancel"]), content: F(Cr(J(), Tr())) }), gl = X({ type: pe("ref/resource"), uri: J() }).passthrough(), yl = X({ type: pe("ref/prompt"), name: J() }).passthrough(), _l = ht.extend({ method: pe("completion/complete"), params: yt.extend({ ref: st([yl, gl]), argument: X({ name: J(), value: J() }).passthrough(), context: F(X({ arguments: F(Cr(J(), J())) })) }) }), bl = _t.extend({ completion: X({ values: We(J()).max(100), total: F(nt().int()), hasMore: F(pt()) }).passthrough() }), Pl = X({ uri: J().startsWith("file://"), name: F(J()), _meta: F(X({}).passthrough()) }).passthrough(), Sl = ht.extend({ method: pe("roots/list") }), wl = _t.extend({ roots: We(Pl) }), xl = Dt.extend({ method: pe("notifications/roots/list_changed") }); 1518st([$n, Ou, _l, ol, Wu, Ku, ju, qu, Zu, Uu, Vu, nl, al]), st([Cn, In, Iu, xl]), st([On, fl, vl, wl]), st([$n, hl, ml, Sl]), st([Cn, In, ul, Hu, zu, il, el]), st([On, $u, bl, Xu, Ju, Fu, Lu, Mu, to, sl]); 1519class Qs { 1520 constructor(e, r) { 1521 Xe(this, "sessionId"); 1522 Xe(this, "onmessage"); 1523 Xe(this, "onerror"); 1524 Xe(this, "onclose"); 1525 Xe(this, "_port"); 1526 Xe(this, "_started", !1); 1527 Xe(this, "_closed", !1); 1528 if (!e) throw new Error("MessagePort is required"); 1529 this._port = e, this.sessionId = r || this.generateId(), this._port.onmessage = (a) => { 1530 var t, n; 1531 try { 1532 const i = Tu.parse(a.data); 1533 (t = this.onmessage) == null || t.call(this, i); 1534 } catch (i) { 1535 const o = new Error(`Failed to parse message: ${i}`); 1536 (n = this.onerror) == null || n.call(this, o); 1537 } 1538 }, this._port.onmessageerror = (a) => { 1539 var n; 1540 const t = new Error(`MessagePort error: ${JSON.stringify(a)}`); 1541 (n = this.onerror) == null || n.call(this, t); 1542 }; 1543 } 1544 static generateSessionId() { 1545 return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 10)}`; 1546 } 1547 async start() { 1548 if (this._started) throw new Error("BrowserContextTransport already started! If using Client or Server class, note that connect() calls start() automatically."); 1549 if (this._closed) throw new Error("Cannot start a closed BrowserContextTransport"); 1550 this._started = !0, this._port.start(); 1551 } 1552 async send(e) { 1553 if (this._closed) throw new Error("Cannot send on a closed BrowserContextTransport"); 1554 return new Promise((r, a) => { 1555 var t; 1556 try { 1557 this._port.postMessage(e), r(); 1558 } catch (n) { 1559 const i = n instanceof Error ? n : new Error(String(n)); 1560 (t = this.onerror) == null || t.call(this, i), a(i); 1561 } 1562 }); 1563 } 1564 async close() { 1565 var e; 1566 this._closed || (this._closed = !0, this._port.close(), (e = this.onclose) == null || e.call(this)); 1567 } 1568 generateId() { 1569 return Qs.generateSessionId(); 1570 } 1571} 1572class El { 1573 constructor() { 1574 Xe(this, "angieDetector"); 1575 Xe(this, "registrationQueue"); 1576 Xe(this, "clientManager"); 1577 Xe(this, "isInitialized", !1); 1578 this.angieDetector = new eu(), this.registrationQueue = new tu(), this.clientManager = new ru(), this.setupAngieReadyHandler(), this.setupServerInitHandler(); 1579 } 1580 setupAngieReadyHandler() { 1581 this.angieDetector.waitForReady().then((e) => { 1582 e.isReady ? this.handleAngieReady() : console.warn("AngieMcpSdk: Angie not detected - servers will remain queued"); 1583 }).catch((e) => { 1584 console.error("AngieMcpSdk: Error waiting for Angie:", e); 1585 }); 1586 } 1587 async handleAngieReady() { 1588 console.log("AngieMcpSdk: Angie is ready, processing queued registrations"); 1589 try { 1590 await this.registrationQueue.processQueue(async (e) => { 1591 await this.processRegistration(e); 1592 }), this.isInitialized = !0, console.log("AngieMcpSdk: Initialization complete"); 1593 } catch (e) { 1594 console.error("AngieMcpSdk: Error processing registration queue:", e); 1595 } 1596 } 1597 async processRegistration(e) { 1598 console.log(`AngieMcpSdk: Processing registration for server "${e.config.name}"`); 1599 try { 1600 await this.clientManager.requestClientCreation(e), console.log(`AngieMcpSdk: Successfully registered server "${e.config.name}"`); 1601 } catch (r) { 1602 throw console.error(`AngieMcpSdk: Failed to register server "${e.config.name}":`, r), r; 1603 } 1604 } 1605 async registerServer(e) { 1606 if (!e.server) throw new Error("Server instance is required"); 1607 if (!e.name) throw new Error("Server name is required"); 1608 if (!e.description) throw new Error("Server description is required"); 1609 console.log(`AngieMcpSdk: Registering server "${e.name}"`); 1610 const r = this.registrationQueue.add(e); 1611 if (this.angieDetector.isReady()) try { 1612 await this.processRegistration(r), this.registrationQueue.updateStatus(r.id, "registered"), console.log(`AngieMcpSdk: Server "${e.name}" registered successfully`); 1613 } catch (a) {
1614 const t = a instanceof Error ? a.message : String(a); 1615 throw this.registrationQueue.updateStatus(r.id, "failed", t), a; 1616 } 1617 else console.log(`AngieMcpSdk: Server "${e.name}" queued until Angie is ready`); 1618 } 1619 getRegistrations() { 1620 return this.registrationQueue.getAll(); 1621 } 1622 getPendingRegistrations() { 1623 return this.registrationQueue.getPending(); 1624 } 1625 isAngieReady() { 1626 return this.angieDetector.isReady(); 1627 } 1628 isReady() { 1629 return this.isInitialized; 1630 } 1631 async waitForReady() { 1632 if (!(await this.angieDetector.waitForReady()).isReady) throw new Error("Angie is not available"); 1633 for (; !this.isInitialized; ) await new Promise((e) => setTimeout(e, 100)); 1634 } 1635 destroy() { 1636 this.registrationQueue.clear(), console.log("AngieMcpSdk: SDK destroyed"); 1637 } 1638 setupServerInitHandler() { 1639 window.addEventListener("message", (e) => { 1640 var r; 1641 ((r = e.data) == null ? void 0 : r.type) === Er.SDK_REQUEST_INIT_SERVER && this.handleServerInitRequest(e); 1642 }); 1643 } 1644 handleServerInitRequest(e) { 1645 const { clientId: r, serverId: a } = e.data.payload || {}; 1646 if (r && a) { 1647 console.log(`AngieMcpSdk: Handling server init request for clientId: ${r}, serverId: ${a}`); 1648 try { 1649 const t = this.registrationQueue.getAll().find((u) => u.id === a); 1650 if (!t) return void console.error(`AngieMcpSdk: No registration found for serverId: ${a}`); 1651 const n = e.ports[0]; 1652 if (!n) return void console.error("AngieMcpSdk: No port provided in server init request"); 1653 const i = t.config.server, o = new Qs(n); 1654 i.connect(o), console.log(`AngieMcpSdk: Server "${t.config.name}" initialized successfully`); 1655 } catch (t) { 1656 console.error(`AngieMcpSdk: Error initializing server for clientId ${r}:`, t); 1657 } 1658 } else console.error("AngieMcpSdk: Invalid server init request - missing clientId or serverId"); 1659 } 1660} 1661var ke; 1662(function(s) { 1663 s.assertEqual = (t) => { 1664 }; 1665 function e(t) { 1666 } 1667 s.assertIs = e; 1668 function r(t) { 1669 throw new Error(); 1670 } 1671 s.assertNever = r, s.arrayToEnum = (t) => { 1672 const n = {}; 1673 for (const i of t) 1674 n[i] = i; 1675 return n; 1676 }, s.getValidEnumValues = (t) => { 1677 const n = s.objectKeys(t).filter((o) => typeof t[t[o]] != "number"), i = {}; 1678 for (const o of n) 1679 i[o] = t[o]; 1680 return s.objectValues(i); 1681 }, s.objectValues = (t) => s.objectKeys(t).map(function(n) { 1682 return t[n]; 1683 }), s.objectKeys = typeof Object.keys == "function" ? (t) => Object.keys(t) : (t) => { 1684 const n = []; 1685 for (const i in t) 1686 Object.prototype.hasOwnProperty.call(t, i) && n.push(i); 1687 return n; 1688 }, s.find = (t, n) => { 1689 for (const i of t) 1690 if (n(i)) 1691 return i; 1692 }, s.isInteger = typeof Number.isInteger == "function" ? (t) => Number.isInteger(t) : (t) => typeof t == "number" && Number.isFinite(t) && Math.floor(t) === t; 1693 function a(t, n = " | ") { 1694 return t.map((i) => typeof i == "string" ? `'${i}'` : i).join(n); 1695 } 1696 s.joinValues = a, s.jsonStringifyReplacer = (t, n) => typeof n == "bigint" ? n.toString() : n; 1697})(ke || (ke = {})); 1698var Nn; 1699(function(s) { 1700 s.mergeShapes = (e, r) => ({ 1701 ...e, 1702 ...r 1703 // second overwrites first 1704 }); 1705})(Nn || (Nn = {})); 1706const Y = ke.arrayToEnum([ 1707 "string", 1708 "nan", 1709 "number", 1710 "integer", 1711 "float", 1712 "boolean", 1713 "date", 1714 "bigint", 1715 "symbol", 1716 "function", 1717 "undefined", 1718 "null", 1719 "array", 1720 "object", 1721 "unknown", 1722 "promise", 1723 "void", 1724 "never", 1725 "map", 1726 "set" 1727]), Wt = (s) => { 1728 switch (typeof s) { 1729 case "undefined": 1730 return Y.undefined; 1731 case "string": 1732 return Y.string; 1733 case "number": 1734 return Number.isNaN(s) ? Y.nan : Y.number; 1735 case "boolean": 1736 return Y.boolean; 1737 case "function": 1738 return Y.function; 1739 case "bigint": 1740 return Y.bigint; 1741 case "symbol": 1742 return Y.symbol; 1743 case "object": 1744 return Array.isArray(s) ? Y.array : s === null ? Y.null : s.then && typeof s.then == "function" && s.catch && typeof s.catch == "function" ? Y.promise : typeof Map < "u" && s instanceof Map ? Y.map : typeof Set < "u" && s instanceof Set ? Y.set : typeof Date < "u" && s instanceof Date ? Y.date : Y.object; 1745 default: 1746 return Y.unknown; 1747 } 1748}, z = ke.arrayToEnum([ 1749 "invalid_type", 1750 "invalid_literal", 1751 "custom", 1752 "invalid_union", 1753 "invalid_union_discriminator", 1754 "invalid_enum_value", 1755 "unrecognized_keys", 1756 "invalid_arguments", 1757 "invalid_return_type", 1758 "invalid_date", 1759 "invalid_string", 1760 "too_small", 1761 "too_big", 1762 "invalid_intersection_types", 1763 "not_multiple_of", 1764 "not_finite" 1765]);
vendor: 29,388 bytes, lines 1766-2584
1766class Bt extends Error { 1767 get errors() { 1768 return this.issues; 1769 } 1770 constructor(e) { 1771 super(), this.issues = [], this.addIssue = (a) => { 1772 this.issues = [...this.issues, a]; 1773 }, this.addIssues = (a = []) => { 1774 this.issues = [...this.issues, ...a]; 1775 }; 1776 const r = new.target.prototype; 1777 Object.setPrototypeOf ? Object.setPrototypeOf(this, r) : this.__proto__ = r, this.name = "ZodError", this.issues = e; 1778 } 1779 format(e) { 1780 const r = e || function(n) { 1781 return n.message; 1782 }, a = { _errors: [] }, t = (n) => { 1783 for (const i of n.issues) 1784 if (i.code === "invalid_union") 1785 i.unionErrors.map(t); 1786 else if (i.code === "invalid_return_type") 1787 t(i.returnTypeError); 1788 else if (i.code === "invalid_arguments") 1789 t(i.argumentsError); 1790 else if (i.path.length === 0) 1791 a._errors.push(r(i)); 1792 else { 1793 let o = a, u = 0; 1794 for (; u < i.path.length; ) { 1795 const l = i.path[u]; 1796 u === i.path.length - 1 ? (o[l] = o[l] || { _errors: [] }, o[l]._errors.push(r(i))) : o[l] = o[l] || { _errors: [] }, o = o[l], u++; 1797 } 1798 } 1799 }; 1800 return t(this), a; 1801 } 1802 static assert(e) { 1803 if (!(e instanceof Bt)) 1804 throw new Error(`Not a ZodError: ${e}`); 1805 } 1806 toString() { 1807 return this.message; 1808 } 1809 get message() { 1810 return JSON.stringify(this.issues, ke.jsonStringifyReplacer, 2); 1811 } 1812 get isEmpty() { 1813 return this.issues.length === 0; 1814 } 1815 flatten(e = (r) => r.message) { 1816 const r = {}, a = []; 1817 for (const t of this.issues) 1818 if (t.path.length > 0) { 1819 const n = t.path[0]; 1820 r[n] = r[n] || [], r[n].push(e(t)); 1821 } else 1822 a.push(e(t)); 1823 return { formErrors: a, fieldErrors: r }; 1824 } 1825 get formErrors() { 1826 return this.flatten(); 1827 } 1828} 1829Bt.create = (s) => new Bt(s); 1830const Ss = (s, e) => { 1831 let r; 1832 switch (s.code) { 1833 case z.invalid_type: 1834 s.received === Y.undefined ? r = "Required" : r = `Expected ${s.expected}, received ${s.received}`; 1835 break; 1836 case z.invalid_literal: 1837 r = `Invalid literal value, expected ${JSON.stringify(s.expected, ke.jsonStringifyReplacer)}`; 1838 break; 1839 case z.unrecognized_keys: 1840 r = `Unrecognized key(s) in object: ${ke.joinValues(s.keys, ", ")}`; 1841 break; 1842 case z.invalid_union: 1843 r = "Invalid input"; 1844 break; 1845 case z.invalid_union_discriminator: 1846 r = `Invalid discriminator value. Expected ${ke.joinValues(s.options)}`; 1847 break; 1848 case z.invalid_enum_value: 1849 r = `Invalid enum value. Expected ${ke.joinValues(s.options)}, received '${s.received}'`; 1850 break; 1851 case z.invalid_arguments: 1852 r = "Invalid function arguments"; 1853 break; 1854 case z.invalid_return_type: 1855 r = "Invalid function return type"; 1856 break; 1857 case z.invalid_date: 1858 r = "Invalid date"; 1859 break; 1860 case z.invalid_string: 1861 typeof s.validation == "object" ? "includes" in s.validation ? (r = `Invalid input: must include "${s.validation.includes}"`, typeof s.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${s.validation.position}`)) : "startsWith" in s.validation ? r = `Invalid input: must start with "${s.validation.startsWith}"` : "endsWith" in s.validation ? r = `Invalid input: must end with "${s.validation.endsWith}"` : ke.assertNever(s.validation) : s.validation !== "regex" ? r = `Invalid ${s.validation}` : r = "Invalid"; 1862 break; 1863 case z.too_small: 1864 s.type === "array" ? r = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "more than"} ${s.minimum} element(s)` : s.type === "string" ? r = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "over"} ${s.minimum} character(s)` : s.type === "number" ? r = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "bigint" ? r = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "date" ? r = `Date must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(s.minimum))}` : r = "Invalid input"; 1865 break; 1866 case z.too_big: 1867 s.type === "array" ? r = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "less than"} ${s.maximum} element(s)` : s.type === "string" ? r = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "under"} ${s.maximum} character(s)` : s.type === "number" ? r = `Number must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "bigint" ? r = `BigInt must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "date" ? r = `Date must be ${s.exact ? "exactly" : s.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(s.maximum))}` : r = "Invalid input"; 1868 break; 1869 case z.custom: 1870 r = "Invalid input"; 1871 break; 1872 case z.invalid_intersection_types: 1873 r = "Intersection results could not be merged"; 1874 break; 1875 case z.not_multiple_of: 1876 r = `Number must be a multiple of ${s.multipleOf}`; 1877 break; 1878 case z.not_finite: 1879 r = "Number must be finite"; 1880 break; 1881 default: 1882 r = e.defaultError, ke.assertNever(s); 1883 } 1884 return { message: r }; 1885}; 1886let Rl = Ss; 1887function kl() { 1888 return Rl; 1889} 1890const Tl = (s) => { 1891 const { data: e, path: r, errorMaps: a, issueData: t } = s, n = [...r, ...t.path || []], i = { 1892 ...t, 1893 path: n 1894 }; 1895 if (t.message !== void 0) 1896 return { 1897 ...t, 1898 path: n, 1899 message: t.message 1900 }; 1901 let o = ""; 1902 const u = a.filter((l) => !!l).slice().reverse(); 1903 for (const l of u) 1904 o = l(i, { data: e, defaultError: o }).message; 1905 return { 1906 ...t, 1907 path: n, 1908 message: o 1909 }; 1910}; 1911function K(s, e) { 1912 const r = kl(), a = Tl({ 1913 issueData: e, 1914 data: s.data, 1915 path: s.path, 1916 errorMaps: [ 1917 s.common.contextualErrorMap, 1918 // contextual error map is first priority 1919 s.schemaErrorMap, 1920 // then schema-bound map if available 1921 r, 1922 // then global override map 1923 r === Ss ? void 0 : Ss 1924 // then global default map 1925 ].filter((t) => !!t) 1926 }); 1927 s.common.issues.push(a); 1928} 1929class ot { 1930 constructor() { 1931 this.value = "valid"; 1932 } 1933 dirty() { 1934 this.value === "valid" && (this.value = "dirty"); 1935 } 1936 abort() { 1937 this.value !== "aborted" && (this.value = "aborted"); 1938 } 1939 static mergeArray(e, r) { 1940 const a = []; 1941 for (const t of r) { 1942 if (t.status === "aborted") 1943 return oe; 1944 t.status === "dirty" && e.dirty(), a.push(t.value); 1945 } 1946 return { status: e.value, value: a }; 1947 } 1948 static async mergeObjectAsync(e, r) { 1949 const a = []; 1950 for (const t of r) { 1951 const n = await t.key, i = await t.value; 1952 a.push({ 1953 key: n, 1954 value: i 1955 }); 1956 } 1957 return ot.mergeObjectSync(e, a); 1958 } 1959 static mergeObjectSync(e, r) { 1960 const a = {}; 1961 for (const t of r) { 1962 const { key: n, value: i } = t; 1963 if (n.status === "aborted" || i.status === "aborted") 1964 return oe; 1965 n.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), n.value !== "__proto__" && (typeof i.value < "u" || t.alwaysSet) && (a[n.value] = i.value); 1966 } 1967 return { status: e.value, value: a }; 1968 } 1969} 1970const oe = Object.freeze({ 1971 status: "aborted" 1972}), wr = (s) => ({ status: "dirty", value: s }), bt = (s) => ({ status: "valid", value: s }), Dn = (s) => s.status === "aborted", jn = (s) => s.status === "dirty", mr = (s) => s.status === "valid", Gr = (s) => typeof Promise < "u" && s instanceof Promise; 1973var te; 1974(function(s) { 1975 s.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, s.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message; 1976})(te || (te = {})); 1977class It { 1978 constructor(e, r, a, t) { 1979 this._cachedPath = [], this.parent = e, this.data = r, this._path = a, this._key = t; 1980 } 1981 get path() { 1982 return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath; 1983 } 1984} 1985const Fn = (s, e) => { 1986 if (mr(e)) 1987 return { success: !0, data: e.value }; 1988 if (!s.common.issues.length) 1989 throw new Error("Validation failed but no issues detected."); 1990 return { 1991 success: !1, 1992 get error() { 1993 if (this._error) 1994 return this._error; 1995 const r = new Bt(s.common.issues); 1996 return this._error = r, this._error; 1997 } 1998 }; 1999}; 2000function ye(s) { 2001 if (!s) 2002 return {}; 2003 const { errorMap: e, invalid_type_error: r, required_error: a, description: t } = s; 2004 if (e && (r || a)) 2005 throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`); 2006 return e ? { errorMap: e, description: t } : { errorMap: (i, o) => { 2007 const { message: u } = s; 2008 return i.code === "invalid_enum_value" ? { message: u ?? o.defaultError } : typeof o.data > "u" ? { message: u ?? a ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: u ?? r ?? o.defaultError }; 2009 }, description: t }; 2010} 2011class Pe { 2012 get description() { 2013 return this._def.description; 2014 } 2015 _getType(e) { 2016 return Wt(e.data); 2017 } 2018 _getOrReturnCtx(e, r) { 2019 return r || { 2020 common: e.parent.common, 2021 data: e.data, 2022 parsedType: Wt(e.data), 2023 schemaErrorMap: this._def.errorMap, 2024 path: e.path, 2025 parent: e.parent 2026 }; 2027 } 2028 _processInputParams(e) { 2029 return { 2030 status: new ot(), 2031 ctx: { 2032 common: e.parent.common, 2033 data: e.data, 2034 parsedType: Wt(e.data), 2035 schemaErrorMap: this._def.errorMap, 2036 path: e.path, 2037 parent: e.parent 2038 } 2039 }; 2040 } 2041 _parseSync(e) { 2042 const r = this._parse(e); 2043 if (Gr(r)) 2044 throw new Error("Synchronous parse encountered promise."); 2045 return r; 2046 } 2047 _parseAsync(e) { 2048 const r = this._parse(e); 2049 return Promise.resolve(r); 2050 } 2051 parse(e, r) { 2052 const a = this.safeParse(e, r); 2053 if (a.success) 2054 return a.data; 2055 throw a.error; 2056 } 2057 safeParse(e, r) { 2058 const a = { 2059 common: { 2060 issues: [], 2061 async: (r == null ? void 0 : r.async) ?? !1, 2062 contextualErrorMap: r == null ? void 0 : r.errorMap 2063 }, 2064 path: (r == null ? void 0 : r.path) || [], 2065 schemaErrorMap: this._def.errorMap, 2066 parent: null, 2067 data: e, 2068 parsedType: Wt(e) 2069 }, t = this._parseSync({ data: e, path: a.path, parent: a }); 2070 return Fn(a, t); 2071 } 2072 "~validate"(e) { 2073 var a, t; 2074 const r = { 2075 common: { 2076 issues: [], 2077 async: !!this["~standard"].async 2078 }, 2079 path: [], 2080 schemaErrorMap: this._def.errorMap, 2081 parent: null, 2082 data: e, 2083 parsedType: Wt(e) 2084 }; 2085 if (!this["~standard"].async) 2086 try { 2087 const n = this._parseSync({ data: e, path: [], parent: r }); 2088 return mr(n) ? { 2089 value: n.value 2090 } : { 2091 issues: r.common.issues 2092 }; 2093 } catch (n) { 2094 (t = (a = n == null ? void 0 : n.message) == null ? void 0 : a.toLowerCase()) != null && t.includes("encountered") && (this["~standard"].async = !0), r.common = { 2095 issues: [], 2096 async: !0 2097 }; 2098 } 2099 return this._parseAsync({ data: e, path: [], parent: r }).then((n) => mr(n) ? { 2100 value: n.value 2101 } : { 2102 issues: r.common.issues 2103 }); 2104 } 2105 async parseAsync(e, r) { 2106 const a = await this.safeParseAsync(e, r); 2107 if (a.success) 2108 return a.data; 2109 throw a.error; 2110 } 2111 async safeParseAsync(e, r) { 2112 const a = { 2113 common: { 2114 issues: [], 2115 contextualErrorMap: r == null ? void 0 : r.errorMap, 2116 async: !0 2117 }, 2118 path: (r == null ? void 0 : r.path) || [], 2119 schemaErrorMap: this._def.errorMap, 2120 parent: null, 2121 data: e, 2122 parsedType: Wt(e) 2123 }, t = this._parse({ data: e, path: a.path, parent: a }), n = await (Gr(t) ? t : Promise.resolve(t)); 2124 return Fn(a, n); 2125 } 2126 refine(e, r) { 2127 const a = (t) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(t) : r; 2128 return this._refinement((t, n) => { 2129 const i = e(t), o = () => n.addIssue({ 2130 code: z.custom, 2131 ...a(t) 2132 }); 2133 return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1); 2134 }); 2135 } 2136 refinement(e, r) { 2137 return this._refinement((a, t) => e(a) ? !0 : (t.addIssue(typeof r == "function" ? r(a, t) : r), !1)); 2138 } 2139 _refinement(e) { 2140 return new or({ 2141 schema: this, 2142 typeName: U.ZodEffects, 2143 effect: { type: "refinement", refinement: e } 2144 }); 2145 } 2146 superRefine(e) { 2147 return this._refinement(e); 2148 } 2149 constructor(e) { 2150 this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = { 2151 version: 1, 2152 vendor: "zod", 2153 validate: (r) => this["~validate"](r) 2154 }; 2155 } 2156 optional() { 2157 return Ut.create(this, this._def); 2158 } 2159 nullable() { 2160 return ur.create(this, this._def); 2161 } 2162 nullish() { 2163 return this.nullable().optional(); 2164 } 2165 array() { 2166 return Ct.create(this); 2167 } 2168 promise() { 2169 return aa.create(this, this._def); 2170 } 2171 or(e) { 2172 return Xr.create([this, e], this._def); 2173 } 2174 and(e) { 2175 return ea.create(this, e, this._def); 2176 } 2177 transform(e) { 2178 return new or({ 2179 ...ye(this._def), 2180 schema: this, 2181 typeName: U.ZodEffects, 2182 effect: { type: "transform", transform: e } 2183 }); 2184 } 2185 default(e) { 2186 const r = typeof e == "function" ? e : () => e; 2187 return new sa({ 2188 ...ye(this._def), 2189 innerType: this, 2190 defaultValue: r, 2191 typeName: U.ZodDefault 2192 }); 2193 } 2194 brand() { 2195 return new io({ 2196 typeName: U.ZodBranded, 2197 type: this, 2198 ...ye(this._def) 2199 }); 2200 } 2201 catch(e) { 2202 const r = typeof e == "function" ? e : () => e; 2203 return new na({ 2204 ...ye(this._def), 2205 innerType: this, 2206 catchValue: r, 2207 typeName: U.ZodCatch 2208 }); 2209 } 2210 describe(e) { 2211 const r = this.constructor; 2212 return new r({ 2213 ...this._def, 2214 description: e 2215 }); 2216 } 2217 pipe(e) { 2218 return Js.create(this, e); 2219 } 2220 readonly() { 2221 return ia.create(this); 2222 } 2223 isOptional() { 2224 return this.safeParse(void 0).success; 2225 } 2226 isNullable() { 2227 return this.safeParse(null).success; 2228 } 2229} 2230const Al = /^c[^\s-]{8,}$/i, Ol = /^[0-9a-z]+$/, Cl = /^[0-9A-HJKMNP-TV-Z]{26}$/i, $l = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Il = /^[a-z0-9_-]{21}$/i, Nl = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Dl = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, jl = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Fl = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$"; 2231let ba; 2232const ql = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Ll = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Zl = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Ml = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, zl = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ul = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, ao = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Vl = new RegExp(`^${ao}$`); 2233function so(s) { 2234 let e = "[0-5]\\d"; 2235 s.precision ? e = `${e}\\.\\d{${s.precision}}` : s.precision == null && (e = `${e}(\\.\\d+)?`); 2236 const r = s.precision ? "+" : "?"; 2237 return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`; 2238} 2239function Hl(s) { 2240 return new RegExp(`^${so(s)}$`); 2241} 2242function Bl(s) { 2243 let e = `${ao}T${so(s)}`; 2244 const r = []; 2245 return r.push(s.local ? "Z?" : "Z"), s.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`); 2246} 2247function Ql(s, e) { 2248 return !!((e === "v4" || !e) && ql.test(s) || (e === "v6" || !e) && Zl.test(s)); 2249} 2250function Kl(s, e) { 2251 if (!Nl.test(s)) 2252 return !1; 2253 try { 2254 const [r] = s.split("."); 2255 if (!r) 2256 return !1; 2257 const a = r.replace(/-/g, "+").replace(/_/g, "/").padEnd(r.length + (4 - r.length % 4) % 4, "="), t = JSON.parse(atob(a)); 2258 return !(typeof t != "object" || t === null || "typ" in t && (t == null ? void 0 : t.typ) !== "JWT" || !t.alg || e && t.alg !== e); 2259 } catch { 2260 return !1; 2261 } 2262} 2263function Jl(s, e) { 2264 return !!((e === "v4" || !e) && Ll.test(s) || (e === "v6" || !e) && Ml.test(s)); 2265} 2266class Mt extends Pe { 2267 _parse(e) { 2268 if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== Y.string) { 2269 const n = this._getOrReturnCtx(e); 2270 return K(n, { 2271 code: z.invalid_type, 2272 expected: Y.string, 2273 received: n.parsedType 2274 }), oe; 2275 } 2276 const a = new ot(); 2277 let t; 2278 for (const n of this._def.checks) 2279 if (n.kind === "min") 2280 e.data.length < n.value && (t = this._getOrReturnCtx(e, t), K(t, { 2281 code: z.too_small, 2282 minimum: n.value, 2283 type: "string", 2284 inclusive: !0, 2285 exact: !1, 2286 message: n.message 2287 }), a.dirty()); 2288 else if (n.kind === "max") 2289 e.data.length > n.value && (t = this._getOrReturnCtx(e, t), K(t, { 2290 code: z.too_big, 2291 maximum: n.value, 2292 type: "string", 2293 inclusive: !0, 2294 exact: !1, 2295 message: n.message 2296 }), a.dirty()); 2297 else if (n.kind === "length") { 2298 const i = e.data.length > n.value, o = e.data.length < n.value; 2299 (i || o) && (t = this._getOrReturnCtx(e, t), i ? K(t, { 2300 code: z.too_big, 2301 maximum: n.value, 2302 type: "string", 2303 inclusive: !0, 2304 exact: !0, 2305 message: n.message 2306 }) : o && K(t, { 2307 code: z.too_small, 2308 minimum: n.value, 2309 type: "string", 2310 inclusive: !0, 2311 exact: !0, 2312 message: n.message 2313 }), a.dirty()); 2314 } else if (n.kind === "email") 2315 jl.test(e.data) || (t = this._getOrReturnCtx(e, t), K(t, { 2316 validation: "email", 2317 code: z.invalid_string, 2318 message: n.message 2319 }), a.dirty()); 2320 else if (n.kind === "emoji") 2321 ba || (ba = new RegExp(Fl, "u")), ba.test(e.data) || (t = this._getOrReturnCtx(e, t), K(t, { 2322 validation: "emoji", 2323 code: z.invalid_string, 2324 message: n.message 2325 }), a.dirty()); 2326 else if (n.kind === "uuid") 2327 $l.test(e.data) || (t = this._getOrReturnCtx(e, t), K(t, { 2328 validation: "uuid", 2329 code: z.invalid_string, 2330 message: n.message 2331 }), a.dirty()); 2332 else if (n.kind === "nanoid") 2333 Il.test(e.data) || (t = this._getOrReturnCtx(e, t), K(t, { 2334 validation: "nanoid", 2335 code: z.invalid_string, 2336 message: n.message 2337 }), a.dirty()); 2338 else if (n.kind === "cuid") 2339 Al.test(e.data) || (t = this._getOrReturnCtx(e, t), K(t, { 2340 validation: "cuid", 2341 code: z.invalid_string, 2342 message: n.message 2343 }), a.dirty()); 2344 else if (n.kind === "cuid2") 2345 Ol.test(e.data) || (t = this._getOrReturnCtx(e, t), K(t, { 2346 validation: "cuid2", 2347 code: z.invalid_string, 2348 message: n.message 2349 }), a.dirty()); 2350 else if (n.kind === "ulid") 2351 Cl.test(e.data) || (t = this._getOrReturnCtx(e, t), K(t, { 2352 validation: "ulid", 2353 code: z.invalid_string, 2354 message: n.message 2355 }), a.dirty()); 2356 else if (n.kind === "url") 2357 try { 2358 new URL(e.data); 2359 } catch { 2360 t = this._getOrReturnCtx(e, t), K(t, { 2361 validation: "url", 2362 code: z.invalid_string, 2363 message: n.message 2364 }), a.dirty(); 2365 } 2366 else n.kind === "regex" ? (n.regex.lastIndex = 0, n.regex.test(e.data) || (t = this._getOrReturnCtx(e, t), K(t, { 2367 validation: "regex", 2368 code: z.invalid_string, 2369 message: n.message 2370 }), a.dirty())) : n.kind === "trim" ? e.data = e.data.trim() : n.kind === "includes" ? e.data.includes(n.value, n.position) || (t = this._getOrReturnCtx(e, t), K(t, { 2371 code: z.invalid_string, 2372 validation: { includes: n.value, position: n.position }, 2373 message: n.message 2374 }), a.dirty()) : n.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : n.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : n.kind === "startsWith" ? e.data.startsWith(n.value) || (t = this._getOrReturnCtx(e, t), K(t, { 2375 code: z.invalid_string, 2376 validation: { startsWith: n.value }, 2377 message: n.message 2378 }), a.dirty()) : n.kind === "endsWith" ? e.data.endsWith(n.value) || (t = this._getOrReturnCtx(e, t), K(t, { 2379 code: z.invalid_string, 2380 validation: { endsWith: n.value }, 2381 message: n.message 2382 }), a.dirty()) : n.kind === "datetime" ? Bl(n).test(e.data) || (t = this._getOrReturnCtx(e, t), K(t, { 2383 code: z.invalid_string, 2384 validation: "datetime", 2385 message: n.message 2386 }), a.dirty()) : n.kind === "date" ? Vl.test(e.data) || (t = this._getOrReturnCtx(e, t), K(t, { 2387 code: z.invalid_string, 2388 validation: "date", 2389 message: n.message 2390 }), a.dirty()) : n.kind === "time" ? Hl(n).test(e.data) || (t = this._getOrReturnCtx(e, t), K(t, { 2391 code: z.invalid_string, 2392 validation: "time", 2393 message: n.message 2394 }), a.dirty()) : n.kind === "duration" ? Dl.test(e.data) || (t = this._getOrReturnCtx(e, t), K(t, { 2395 validation: "duration", 2396 code: z.invalid_string, 2397 message: n.message 2398 }), a.dirty()) : n.kind === "ip" ? Ql(e.data, n.version) || (t = this._getOrReturnCtx(e, t), K(t, { 2399 validation: "ip", 2400 code: z.invalid_string, 2401 message: n.message 2402 }), a.dirty()) : n.kind === "jwt" ? Kl(e.data, n.alg) || (t = this._getOrReturnCtx(e, t), K(t, { 2403 validation: "jwt", 2404 code: z.invalid_string, 2405 message: n.message 2406 }), a.dirty()) : n.kind === "cidr" ? Jl(e.data, n.version) || (t = this._getOrReturnCtx(e, t), K(t, { 2407 validation: "cidr", 2408 code: z.invalid_string, 2409 message: n.message 2410 }), a.dirty()) : n.kind === "base64" ? zl.test(e.data) || (t = this._getOrReturnCtx(e, t), K(t, { 2411 validation: "base64", 2412 code: z.invalid_string, 2413 message: n.message 2414 }), a.dirty()) : n.kind === "base64url" ? Ul.test(e.data) || (t = this._getOrReturnCtx(e, t), K(t, { 2415 validation: "base64url", 2416 code: z.invalid_string, 2417 message: n.message 2418 }), a.dirty()) : ke.assertNever(n); 2419 return { status: a.value, value: e.data }; 2420 } 2421 _regex(e, r, a) { 2422 return this.refinement((t) => e.test(t), { 2423 validation: r, 2424 code: z.invalid_string, 2425 ...te.errToObj(a) 2426 }); 2427 } 2428 _addCheck(e) { 2429 return new Mt({ 2430 ...this._def, 2431 checks: [...this._def.checks, e] 2432 }); 2433 } 2434 email(e) { 2435 return this._addCheck({ kind: "email", ...te.errToObj(e) }); 2436 } 2437 url(e) { 2438 return this._addCheck({ kind: "url", ...te.errToObj(e) }); 2439 } 2440 emoji(e) { 2441 return this._addCheck({ kind: "emoji", ...te.errToObj(e) }); 2442 } 2443 uuid(e) { 2444 return this._addCheck({ kind: "uuid", ...te.errToObj(e) }); 2445 } 2446 nanoid(e) { 2447 return this._addCheck({ kind: "nanoid", ...te.errToObj(e) }); 2448 } 2449 cuid(e) { 2450 return this._addCheck({ kind: "cuid", ...te.errToObj(e) }); 2451 } 2452 cuid2(e) { 2453 return this._addCheck({ kind: "cuid2", ...te.errToObj(e) }); 2454 } 2455 ulid(e) { 2456 return this._addCheck({ kind: "ulid", ...te.errToObj(e) }); 2457 } 2458 base64(e) { 2459 return this._addCheck({ kind: "base64", ...te.errToObj(e) }); 2460 } 2461 base64url(e) { 2462 return this._addCheck({ 2463 kind: "base64url", 2464 ...te.errToObj(e) 2465 }); 2466 } 2467 jwt(e) { 2468 return this._addCheck({ kind: "jwt", ...te.errToObj(e) }); 2469 } 2470 ip(e) { 2471 return this._addCheck({ kind: "ip", ...te.errToObj(e) }); 2472 } 2473 cidr(e) { 2474 return this._addCheck({ kind: "cidr", ...te.errToObj(e) }); 2475 } 2476 datetime(e) { 2477 return typeof e == "string" ? this._addCheck({ 2478 kind: "datetime", 2479 precision: null, 2480 offset: !1, 2481 local: !1, 2482 message: e 2483 }) : this._addCheck({ 2484 kind: "datetime", 2485 precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision, 2486 offset: (e == null ? void 0 : e.offset) ?? !1, 2487 local: (e == null ? void 0 : e.local) ?? !1, 2488 ...te.errToObj(e == null ? void 0 : e.message) 2489 }); 2490 } 2491 date(e) { 2492 return this._addCheck({ kind: "date", message: e }); 2493 } 2494 time(e) { 2495 return typeof e == "string" ? this._addCheck({ 2496 kind: "time", 2497 precision: null, 2498 message: e 2499 }) : this._addCheck({ 2500 kind: "time", 2501 precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision, 2502 ...te.errToObj(e == null ? void 0 : e.message) 2503 }); 2504 } 2505 duration(e) { 2506 return this._addCheck({ kind: "duration", ...te.errToObj(e) }); 2507 } 2508 regex(e, r) { 2509 return this._addCheck({ 2510 kind: "regex", 2511 regex: e, 2512 ...te.errToObj(r) 2513 }); 2514 } 2515 includes(e, r) { 2516 return this._addCheck({ 2517 kind: "includes", 2518 value: e, 2519 position: r == null ? void 0 : r.position, 2520 ...te.errToObj(r == null ? void 0 : r.message) 2521 }); 2522 } 2523 startsWith(e, r) { 2524 return this._addCheck({ 2525 kind: "startsWith", 2526 value: e, 2527 ...te.errToObj(r) 2528 }); 2529 } 2530 endsWith(e, r) { 2531 return this._addCheck({ 2532 kind: "endsWith", 2533 value: e, 2534 ...te.errToObj(r) 2535 }); 2536 } 2537 min(e, r) { 2538 return this._addCheck({ 2539 kind: "min", 2540 value: e, 2541 ...te.errToObj(r) 2542 }); 2543 } 2544 max(e, r) { 2545 return this._addCheck({ 2546 kind: "max", 2547 value: e, 2548 ...te.errToObj(r) 2549 }); 2550 } 2551 length(e, r) { 2552 return this._addCheck({ 2553 kind: "length", 2554 value: e, 2555 ...te.errToObj(r) 2556 }); 2557 } 2558 /** 2559 * Equivalent to `.min(1)` 2560 */ 2561 nonempty(e) { 2562 return this.min(1, te.errToObj(e)); 2563 } 2564 trim() { 2565 return new Mt({ 2566 ...this._def, 2567 checks: [...this._def.checks, { kind: "trim" }] 2568 }); 2569 } 2570 toLowerCase() { 2571 return new Mt({ 2572 ...this._def, 2573 checks: [...this._def.checks, { kind: "toLowerCase" }] 2574 }); 2575 } 2576 toUpperCase() { 2577 return new Mt({ 2578 ...this._def, 2579 checks: [...this._def.checks, { kind: "toUpperCase" }] 2580 }); 2581 } 2582 get isDatetime() { 2583 return !!this._def.checks.find((e) => e.kind === "datetime"); 2584 }
vendor: 6,728 bytes, lines 2585-2830
2585 get isDate() { 2586 return !!this._def.checks.find((e) => e.kind === "date"); 2587 } 2588 get isTime() { 2589 return !!this._def.checks.find((e) => e.kind === "time"); 2590 } 2591 get isDuration() { 2592 return !!this._def.checks.find((e) => e.kind === "duration"); 2593 } 2594 get isEmail() { 2595 return !!this._def.checks.find((e) => e.kind === "email"); 2596 } 2597 get isURL() { 2598 return !!this._def.checks.find((e) => e.kind === "url"); 2599 } 2600 get isEmoji() { 2601 return !!this._def.checks.find((e) => e.kind === "emoji"); 2602 } 2603 get isUUID() { 2604 return !!this._def.checks.find((e) => e.kind === "uuid"); 2605 } 2606 get isNANOID() { 2607 return !!this._def.checks.find((e) => e.kind === "nanoid"); 2608 } 2609 get isCUID() { 2610 return !!this._def.checks.find((e) => e.kind === "cuid"); 2611 } 2612 get isCUID2() { 2613 return !!this._def.checks.find((e) => e.kind === "cuid2"); 2614 } 2615 get isULID() { 2616 return !!this._def.checks.find((e) => e.kind === "ulid"); 2617 } 2618 get isIP() { 2619 return !!this._def.checks.find((e) => e.kind === "ip"); 2620 } 2621 get isCIDR() { 2622 return !!this._def.checks.find((e) => e.kind === "cidr"); 2623 } 2624 get isBase64() { 2625 return !!this._def.checks.find((e) => e.kind === "base64"); 2626 } 2627 get isBase64url() { 2628 return !!this._def.checks.find((e) => e.kind === "base64url"); 2629 } 2630 get minLength() { 2631 let e = null; 2632 for (const r of this._def.checks) 2633 r.kind === "min" && (e === null || r.value > e) && (e = r.value); 2634 return e; 2635 } 2636 get maxLength() { 2637 let e = null; 2638 for (const r of this._def.checks) 2639 r.kind === "max" && (e === null || r.value < e) && (e = r.value); 2640 return e; 2641 } 2642} 2643Mt.create = (s) => new Mt({ 2644 checks: [], 2645 typeName: U.ZodString, 2646 coerce: (s == null ? void 0 : s.coerce) ?? !1, 2647 ...ye(s) 2648}); 2649function Wl(s, e) { 2650 const r = (s.toString().split(".")[1] || "").length, a = (e.toString().split(".")[1] || "").length, t = r > a ? r : a, n = Number.parseInt(s.toFixed(t).replace(".", "")), i = Number.parseInt(e.toFixed(t).replace(".", "")); 2651 return n % i / 10 ** t; 2652} 2653class vr extends Pe { 2654 constructor() { 2655 super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf; 2656 } 2657 _parse(e) { 2658 if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== Y.number) { 2659 const n = this._getOrReturnCtx(e); 2660 return K(n, { 2661 code: z.invalid_type, 2662 expected: Y.number, 2663 received: n.parsedType 2664 }), oe; 2665 } 2666 let a; 2667 const t = new ot(); 2668 for (const n of this._def.checks) 2669 n.kind === "int" ? ke.isInteger(e.data) || (a = this._getOrReturnCtx(e, a), K(a, { 2670 code: z.invalid_type, 2671 expected: "integer", 2672 received: "float", 2673 message: n.message 2674 }), t.dirty()) : n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (a = this._getOrReturnCtx(e, a), K(a, { 2675 code: z.too_small, 2676 minimum: n.value, 2677 type: "number", 2678 inclusive: n.inclusive, 2679 exact: !1, 2680 message: n.message 2681 }), t.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (a = this._getOrReturnCtx(e, a), K(a, { 2682 code: z.too_big, 2683 maximum: n.value, 2684 type: "number", 2685 inclusive: n.inclusive, 2686 exact: !1, 2687 message: n.message 2688 }), t.dirty()) : n.kind === "multipleOf" ? Wl(e.data, n.value) !== 0 && (a = this._getOrReturnCtx(e, a), K(a, { 2689 code: z.not_multiple_of, 2690 multipleOf: n.value, 2691 message: n.message 2692 }), t.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (a = this._getOrReturnCtx(e, a), K(a, { 2693 code: z.not_finite, 2694 message: n.message 2695 }), t.dirty()) : ke.assertNever(n); 2696 return { status: t.value, value: e.data }; 2697 } 2698 gte(e, r) { 2699 return this.setLimit("min", e, !0, te.toString(r)); 2700 } 2701 gt(e, r) { 2702 return this.setLimit("min", e, !1, te.toString(r)); 2703 } 2704 lte(e, r) { 2705 return this.setLimit("max", e, !0, te.toString(r)); 2706 } 2707 lt(e, r) { 2708 return this.setLimit("max", e, !1, te.toString(r)); 2709 } 2710 setLimit(e, r, a, t) { 2711 return new vr({ 2712 ...this._def, 2713 checks: [ 2714 ...this._def.checks, 2715 { 2716 kind: e, 2717 value: r, 2718 inclusive: a, 2719 message: te.toString(t) 2720 } 2721 ] 2722 }); 2723 } 2724 _addCheck(e) { 2725 return new vr({ 2726 ...this._def, 2727 checks: [...this._def.checks, e] 2728 }); 2729 } 2730 int(e) { 2731 return this._addCheck({ 2732 kind: "int", 2733 message: te.toString(e) 2734 }); 2735 } 2736 positive(e) { 2737 return this._addCheck({ 2738 kind: "min", 2739 value: 0, 2740 inclusive: !1, 2741 message: te.toString(e) 2742 }); 2743 } 2744 negative(e) { 2745 return this._addCheck({ 2746 kind: "max", 2747 value: 0, 2748 inclusive: !1, 2749 message: te.toString(e) 2750 }); 2751 } 2752 nonpositive(e) { 2753 return this._addCheck({ 2754 kind: "max", 2755 value: 0, 2756 inclusive: !0, 2757 message: te.toString(e) 2758 }); 2759 } 2760 nonnegative(e) { 2761 return this._addCheck({ 2762 kind: "min", 2763 value: 0, 2764 inclusive: !0, 2765 message: te.toString(e) 2766 }); 2767 } 2768 multipleOf(e, r) { 2769 return this._addCheck({ 2770 kind: "multipleOf", 2771 value: e, 2772 message: te.toString(r) 2773 }); 2774 } 2775 finite(e) { 2776 return this._addCheck({ 2777 kind: "finite", 2778 message: te.toString(e) 2779 }); 2780 } 2781 safe(e) { 2782 return this._addCheck({ 2783 kind: "min", 2784 inclusive: !0, 2785 value: Number.MIN_SAFE_INTEGER, 2786 message: te.toString(e) 2787 })._addCheck({ 2788 kind: "max", 2789 inclusive: !0, 2790 value: Number.MAX_SAFE_INTEGER, 2791 message: te.toString(e) 2792 }); 2793 } 2794 get minValue() { 2795 let e = null; 2796 for (const r of this._def.checks) 2797 r.kind === "min" && (e === null || r.value > e) && (e = r.value); 2798 return e; 2799 } 2800 get maxValue() { 2801 let e = null; 2802 for (const r of this._def.checks) 2803 r.kind === "max" && (e === null || r.value < e) && (e = r.value); 2804 return e; 2805 } 2806 get isInt() { 2807 return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && ke.isInteger(e.value)); 2808 } 2809 get isFinite() { 2810 let e = null, r = null; 2811 for (const a of this._def.checks) { 2812 if (a.kind === "finite" || a.kind === "int" || a.kind === "multipleOf") 2813 return !0; 2814 a.kind === "min" ? (r === null || a.value > r) && (r = a.value) : a.kind === "max" && (e === null || a.value < e) && (e = a.value); 2815 } 2816 return Number.isFinite(r) && Number.isFinite(e); 2817 } 2818} 2819vr.create = (s) => new vr({ 2820 checks: [], 2821 typeName: U.ZodNumber, 2822 coerce: (s == null ? void 0 : s.coerce) || !1, 2823 ...ye(s) 2824}); 2825class Ar extends Pe { 2826 constructor() { 2827 super(...arguments), this.min = this.gte, this.max = this.lte; 2828 } 2829 _parse(e) { 2830 if (this._def.coerce)
vendor: 9,573 bytes, lines 2831-3225
2831 try { 2832 e.data = BigInt(e.data); 2833 } catch { 2834 return this._getInvalidInput(e); 2835 } 2836 if (this._getType(e) !== Y.bigint) 2837 return this._getInvalidInput(e); 2838 let a; 2839 const t = new ot(); 2840 for (const n of this._def.checks) 2841 n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (a = this._getOrReturnCtx(e, a), K(a, { 2842 code: z.too_small, 2843 type: "bigint", 2844 minimum: n.value, 2845 inclusive: n.inclusive, 2846 message: n.message 2847 }), t.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (a = this._getOrReturnCtx(e, a), K(a, { 2848 code: z.too_big, 2849 type: "bigint", 2850 maximum: n.value, 2851 inclusive: n.inclusive, 2852 message: n.message 2853 }), t.dirty()) : n.kind === "multipleOf" ? e.data % n.value !== BigInt(0) && (a = this._getOrReturnCtx(e, a), K(a, { 2854 code: z.not_multiple_of, 2855 multipleOf: n.value, 2856 message: n.message 2857 }), t.dirty()) : ke.assertNever(n); 2858 return { status: t.value, value: e.data }; 2859 } 2860 _getInvalidInput(e) { 2861 const r = this._getOrReturnCtx(e); 2862 return K(r, { 2863 code: z.invalid_type, 2864 expected: Y.bigint, 2865 received: r.parsedType 2866 }), oe; 2867 } 2868 gte(e, r) { 2869 return this.setLimit("min", e, !0, te.toString(r)); 2870 } 2871 gt(e, r) { 2872 return this.setLimit("min", e, !1, te.toString(r)); 2873 } 2874 lte(e, r) { 2875 return this.setLimit("max", e, !0, te.toString(r)); 2876 } 2877 lt(e, r) { 2878 return this.setLimit("max", e, !1, te.toString(r)); 2879 } 2880 setLimit(e, r, a, t) { 2881 return new Ar({ 2882 ...this._def, 2883 checks: [ 2884 ...this._def.checks, 2885 { 2886 kind: e, 2887 value: r, 2888 inclusive: a, 2889 message: te.toString(t) 2890 } 2891 ] 2892 }); 2893 } 2894 _addCheck(e) { 2895 return new Ar({ 2896 ...this._def, 2897 checks: [...this._def.checks, e] 2898 }); 2899 } 2900 positive(e) { 2901 return this._addCheck({ 2902 kind: "min", 2903 value: BigInt(0), 2904 inclusive: !1, 2905 message: te.toString(e) 2906 }); 2907 } 2908 negative(e) { 2909 return this._addCheck({ 2910 kind: "max", 2911 value: BigInt(0), 2912 inclusive: !1, 2913 message: te.toString(e) 2914 }); 2915 } 2916 nonpositive(e) { 2917 return this._addCheck({ 2918 kind: "max", 2919 value: BigInt(0), 2920 inclusive: !0, 2921 message: te.toString(e) 2922 }); 2923 } 2924 nonnegative(e) { 2925 return this._addCheck({ 2926 kind: "min", 2927 value: BigInt(0), 2928 inclusive: !0, 2929 message: te.toString(e) 2930 }); 2931 } 2932 multipleOf(e, r) { 2933 return this._addCheck({ 2934 kind: "multipleOf", 2935 value: e, 2936 message: te.toString(r) 2937 }); 2938 } 2939 get minValue() { 2940 let e = null; 2941 for (const r of this._def.checks) 2942 r.kind === "min" && (e === null || r.value > e) && (e = r.value); 2943 return e; 2944 } 2945 get maxValue() { 2946 let e = null; 2947 for (const r of this._def.checks) 2948 r.kind === "max" && (e === null || r.value < e) && (e = r.value); 2949 return e; 2950 } 2951} 2952Ar.create = (s) => new Ar({ 2953 checks: [], 2954 typeName: U.ZodBigInt, 2955 coerce: (s == null ? void 0 : s.coerce) ?? !1, 2956 ...ye(s) 2957}); 2958class ws extends Pe { 2959 _parse(e) { 2960 if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== Y.boolean) { 2961 const a = this._getOrReturnCtx(e); 2962 return K(a, { 2963 code: z.invalid_type, 2964 expected: Y.boolean, 2965 received: a.parsedType 2966 }), oe; 2967 } 2968 return bt(e.data); 2969 } 2970} 2971ws.create = (s) => new ws({ 2972 typeName: U.ZodBoolean, 2973 coerce: (s == null ? void 0 : s.coerce) || !1, 2974 ...ye(s) 2975}); 2976class Yr extends Pe { 2977 _parse(e) { 2978 if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== Y.date) { 2979 const n = this._getOrReturnCtx(e); 2980 return K(n, { 2981 code: z.invalid_type, 2982 expected: Y.date, 2983 received: n.parsedType 2984 }), oe; 2985 } 2986 if (Number.isNaN(e.data.getTime())) { 2987 const n = this._getOrReturnCtx(e); 2988 return K(n, { 2989 code: z.invalid_date 2990 }), oe; 2991 } 2992 const a = new ot(); 2993 let t; 2994 for (const n of this._def.checks) 2995 n.kind === "min" ? e.data.getTime() < n.value && (t = this._getOrReturnCtx(e, t), K(t, { 2996 code: z.too_small, 2997 message: n.message, 2998 inclusive: !0, 2999 exact: !1, 3000 minimum: n.value, 3001 type: "date" 3002 }), a.dirty()) : n.kind === "max" ? e.data.getTime() > n.value && (t = this._getOrReturnCtx(e, t), K(t, { 3003 code: z.too_big, 3004 message: n.message, 3005 inclusive: !0, 3006 exact: !1, 3007 maximum: n.value, 3008 type: "date" 3009 }), a.dirty()) : ke.assertNever(n); 3010 return { 3011 status: a.value, 3012 value: new Date(e.data.getTime()) 3013 }; 3014 } 3015 _addCheck(e) { 3016 return new Yr({ 3017 ...this._def, 3018 checks: [...this._def.checks, e] 3019 }); 3020 } 3021 min(e, r) { 3022 return this._addCheck({ 3023 kind: "min", 3024 value: e.getTime(), 3025 message: te.toString(r) 3026 }); 3027 } 3028 max(e, r) { 3029 return this._addCheck({ 3030 kind: "max", 3031 value: e.getTime(), 3032 message: te.toString(r) 3033 }); 3034 } 3035 get minDate() { 3036 let e = null; 3037 for (const r of this._def.checks) 3038 r.kind === "min" && (e === null || r.value > e) && (e = r.value); 3039 return e != null ? new Date(e) : null; 3040 } 3041 get maxDate() { 3042 let e = null; 3043 for (const r of this._def.checks) 3044 r.kind === "max" && (e === null || r.value < e) && (e = r.value); 3045 return e != null ? new Date(e) : null; 3046 } 3047} 3048Yr.create = (s) => new Yr({ 3049 checks: [], 3050 coerce: (s == null ? void 0 : s.coerce) || !1, 3051 typeName: U.ZodDate, 3052 ...ye(s) 3053}); 3054class qn extends Pe { 3055 _parse(e) { 3056 if (this._getType(e) !== Y.symbol) { 3057 const a = this._getOrReturnCtx(e); 3058 return K(a, { 3059 code: z.invalid_type, 3060 expected: Y.symbol, 3061 received: a.parsedType 3062 }), oe; 3063 } 3064 return bt(e.data); 3065 } 3066} 3067qn.create = (s) => new qn({ 3068 typeName: U.ZodSymbol, 3069 ...ye(s) 3070}); 3071class xs extends Pe { 3072 _parse(e) { 3073 if (this._getType(e) !== Y.undefined) { 3074 const a = this._getOrReturnCtx(e); 3075 return K(a, { 3076 code: z.invalid_type, 3077 expected: Y.undefined, 3078 received: a.parsedType 3079 }), oe; 3080 } 3081 return bt(e.data); 3082 } 3083} 3084xs.create = (s) => new xs({ 3085 typeName: U.ZodUndefined, 3086 ...ye(s) 3087}); 3088class Es extends Pe { 3089 _parse(e) { 3090 if (this._getType(e) !== Y.null) { 3091 const a = this._getOrReturnCtx(e); 3092 return K(a, { 3093 code: z.invalid_type, 3094 expected: Y.null, 3095 received: a.parsedType 3096 }), oe; 3097 } 3098 return bt(e.data); 3099 } 3100} 3101Es.create = (s) => new Es({ 3102 typeName: U.ZodNull, 3103 ...ye(s) 3104}); 3105class Rs extends Pe { 3106 constructor() { 3107 super(...arguments), this._any = !0; 3108 } 3109 _parse(e) { 3110 return bt(e.data); 3111 } 3112} 3113Rs.create = (s) => new Rs({ 3114 typeName: U.ZodAny, 3115 ...ye(s) 3116}); 3117class ks extends Pe { 3118 constructor() { 3119 super(...arguments), this._unknown = !0; 3120 } 3121 _parse(e) { 3122 return bt(e.data); 3123 } 3124} 3125ks.create = (s) => new ks({ 3126 typeName: U.ZodUnknown, 3127 ...ye(s) 3128}); 3129class Yt extends Pe { 3130 _parse(e) { 3131 const r = this._getOrReturnCtx(e); 3132 return K(r, { 3133 code: z.invalid_type, 3134 expected: Y.never, 3135 received: r.parsedType 3136 }), oe; 3137 } 3138} 3139Yt.create = (s) => new Yt({ 3140 typeName: U.ZodNever, 3141 ...ye(s) 3142}); 3143class Ln extends Pe { 3144 _parse(e) { 3145 if (this._getType(e) !== Y.undefined) { 3146 const a = this._getOrReturnCtx(e); 3147 return K(a, { 3148 code: z.invalid_type, 3149 expected: Y.void, 3150 received: a.parsedType 3151 }), oe; 3152 } 3153 return bt(e.data); 3154 } 3155} 3156Ln.create = (s) => new Ln({ 3157 typeName: U.ZodVoid, 3158 ...ye(s) 3159}); 3160class Ct extends Pe { 3161 _parse(e) { 3162 const { ctx: r, status: a } = this._processInputParams(e), t = this._def; 3163 if (r.parsedType !== Y.array) 3164 return K(r, { 3165 code: z.invalid_type, 3166 expected: Y.array, 3167 received: r.parsedType 3168 }), oe; 3169 if (t.exactLength !== null) { 3170 const i = r.data.length > t.exactLength.value, o = r.data.length < t.exactLength.value; 3171 (i || o) && (K(r, { 3172 code: i ? z.too_big : z.too_small, 3173 minimum: o ? t.exactLength.value : void 0, 3174 maximum: i ? t.exactLength.value : void 0, 3175 type: "array", 3176 inclusive: !0, 3177 exact: !0, 3178 message: t.exactLength.message 3179 }), a.dirty()); 3180 } 3181 if (t.minLength !== null && r.data.length < t.minLength.value && (K(r, { 3182 code: z.too_small, 3183 minimum: t.minLength.value, 3184 type: "array", 3185 inclusive: !0, 3186 exact: !1, 3187 message: t.minLength.message 3188 }), a.dirty()), t.maxLength !== null && r.data.length > t.maxLength.value && (K(r, { 3189 code: z.too_big, 3190 maximum: t.maxLength.value, 3191 type: "array", 3192 inclusive: !0, 3193 exact: !1, 3194 message: t.maxLength.message 3195 }), a.dirty()), r.common.async) 3196 return Promise.all([...r.data].map((i, o) => t.type._parseAsync(new It(r, i, r.path, o)))).then((i) => ot.mergeArray(a, i)); 3197 const n = [...r.data].map((i, o) => t.type._parseSync(new It(r, i, r.path, o))); 3198 return ot.mergeArray(a, n); 3199 } 3200 get element() { 3201 return this._def.type; 3202 } 3203 min(e, r) { 3204 return new Ct({ 3205 ...this._def, 3206 minLength: { value: e, message: te.toString(r) } 3207 }); 3208 } 3209 max(e, r) { 3210 return new Ct({ 3211 ...this._def, 3212 maxLength: { value: e, message: te.toString(r) } 3213 }); 3214 } 3215 length(e, r) { 3216 return new Ct({ 3217 ...this._def, 3218 exactLength: { value: e, message: te.toString(r) } 3219 }); 3220 } 3221 nonempty(e) { 3222 return this.min(1, e); 3223 } 3224} 3225Ct.create = (s, e) => new Ct({
vendor: 6,741 bytes, lines 3226-3463
3226 type: s, 3227 minLength: null, 3228 maxLength: null, 3229 exactLength: null, 3230 typeName: U.ZodArray, 3231 ...ye(e) 3232}); 3233function hr(s) { 3234 if (s instanceof Qe) { 3235 const e = {}; 3236 for (const r in s.shape) { 3237 const a = s.shape[r]; 3238 e[r] = Ut.create(hr(a)); 3239 } 3240 return new Qe({ 3241 ...s._def, 3242 shape: () => e 3243 }); 3244 } else return s instanceof Ct ? new Ct({ 3245 ...s._def, 3246 type: hr(s.element) 3247 }) : s instanceof Ut ? Ut.create(hr(s.unwrap())) : s instanceof ur ? ur.create(hr(s.unwrap())) : s instanceof nr ? nr.create(s.items.map((e) => hr(e))) : s; 3248} 3249class Qe extends Pe { 3250 constructor() { 3251 super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend; 3252 } 3253 _getCached() { 3254 if (this._cached !== null) 3255 return this._cached; 3256 const e = this._def.shape(), r = ke.objectKeys(e); 3257 return this._cached = { shape: e, keys: r }, this._cached; 3258 } 3259 _parse(e) { 3260 if (this._getType(e) !== Y.object) { 3261 const l = this._getOrReturnCtx(e); 3262 return K(l, { 3263 code: z.invalid_type, 3264 expected: Y.object, 3265 received: l.parsedType 3266 }), oe; 3267 } 3268 const { status: a, ctx: t } = this._processInputParams(e), { shape: n, keys: i } = this._getCached(), o = []; 3269 if (!(this._def.catchall instanceof Yt && this._def.unknownKeys === "strip")) 3270 for (const l in t.data) 3271 i.includes(l) || o.push(l); 3272 const u = []; 3273 for (const l of i) { 3274 const h = n[l], m = t.data[l]; 3275 u.push({ 3276 key: { status: "valid", value: l }, 3277 value: h._parse(new It(t, m, t.path, l)), 3278 alwaysSet: l in t.data 3279 }); 3280 } 3281 if (this._def.catchall instanceof Yt) { 3282 const l = this._def.unknownKeys; 3283 if (l === "passthrough") 3284 for (const h of o) 3285 u.push({ 3286 key: { status: "valid", value: h }, 3287 value: { status: "valid", value: t.data[h] } 3288 }); 3289 else if (l === "strict") 3290 o.length > 0 && (K(t, { 3291 code: z.unrecognized_keys, 3292 keys: o 3293 }), a.dirty()); 3294 else if (l !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value."); 3295 } else { 3296 const l = this._def.catchall; 3297 for (const h of o) { 3298 const m = t.data[h]; 3299 u.push({ 3300 key: { status: "valid", value: h }, 3301 value: l._parse( 3302 new It(t, m, t.path, h) 3303 //, ctx.child(key), value, getParsedType(value) 3304 ), 3305 alwaysSet: h in t.data 3306 }); 3307 } 3308 } 3309 return t.common.async ? Promise.resolve().then(async () => { 3310 const l = []; 3311 for (const h of u) { 3312 const m = await h.key, _ = await h.value; 3313 l.push({ 3314 key: m, 3315 value: _, 3316 alwaysSet: h.alwaysSet 3317 }); 3318 } 3319 return l; 3320 }).then((l) => ot.mergeObjectSync(a, l)) : ot.mergeObjectSync(a, u); 3321 } 3322 get shape() { 3323 return this._def.shape(); 3324 } 3325 strict(e) { 3326 return te.errToObj, new Qe({ 3327 ...this._def, 3328 unknownKeys: "strict", 3329 ...e !== void 0 ? { 3330 errorMap: (r, a) => { 3331 var n, i; 3332 const t = ((i = (n = this._def).errorMap) == null ? void 0 : i.call(n, r, a).message) ?? a.defaultError; 3333 return r.code === "unrecognized_keys" ? { 3334 message: te.errToObj(e).message ?? t 3335 } : { 3336 message: t 3337 }; 3338 } 3339 } : {} 3340 }); 3341 } 3342 strip() { 3343 return new Qe({ 3344 ...this._def, 3345 unknownKeys: "strip" 3346 }); 3347 } 3348 passthrough() { 3349 return new Qe({ 3350 ...this._def, 3351 unknownKeys: "passthrough" 3352 }); 3353 } 3354 // const AugmentFactory = 3355 // <Def extends ZodObjectDef>(def: Def) => 3356 // <Augmentation extends ZodRawShape>( 3357 // augmentation: Augmentation 3358 // ): ZodObject< 3359 // extendShape<ReturnType<Def["shape"]>, Augmentation>, 3360 // Def["unknownKeys"], 3361 // Def["catchall"] 3362 // > => { 3363 // return new ZodObject({ 3364 // ...def, 3365 // shape: () => ({ 3366 // ...def.shape(), 3367 // ...augmentation, 3368 // }), 3369 // }) as any; 3370 // }; 3371 extend(e) { 3372 return new Qe({ 3373 ...this._def, 3374 shape: () => ({ 3375 ...this._def.shape(), 3376 ...e 3377 }) 3378 }); 3379 } 3380 /** 3381 * Prior to [email protected] there was a bug in the 3382 * inferred type of merged objects. Please 3383 * upgrade if you are experiencing issues. 3384 */ 3385 merge(e) { 3386 return new Qe({ 3387 unknownKeys: e._def.unknownKeys, 3388 catchall: e._def.catchall, 3389 shape: () => ({ 3390 ...this._def.shape(), 3391 ...e._def.shape() 3392 }), 3393 typeName: U.ZodObject 3394 }); 3395 } 3396 // merge< 3397 // Incoming extends AnyZodObject, 3398 // Augmentation extends Incoming["shape"], 3399 // NewOutput extends { 3400 // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation 3401 // ? Augmentation[k]["_output"] 3402 // : k extends keyof Output 3403 // ? Output[k] 3404 // : never; 3405 // }, 3406 // NewInput extends { 3407 // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation 3408 // ? Augmentation[k]["_input"] 3409 // : k extends keyof Input 3410 // ? Input[k] 3411 // : never; 3412 // } 3413 // >( 3414 // merging: Incoming 3415 // ): ZodObject< 3416 // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>, 3417 // Incoming["_def"]["unknownKeys"], 3418 // Incoming["_def"]["catchall"], 3419 // NewOutput, 3420 // NewInput 3421 // > { 3422 // const merged: any = new ZodObject({ 3423 // unknownKeys: merging._def.unknownKeys, 3424 // catchall: merging._def.catchall, 3425 // shape: () => 3426 // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()), 3427 // typeName: ZodFirstPartyTypeKind.ZodObject, 3428 // }) as any; 3429 // return merged; 3430 // } 3431 setKey(e, r) { 3432 return this.augment({ [e]: r }); 3433 } 3434 // merge<Incoming extends AnyZodObject>( 3435 // merging: Incoming 3436 // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => { 3437 // ZodObject< 3438 // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>, 3439 // Incoming["_def"]["unknownKeys"], 3440 // Incoming["_def"]["catchall"] 3441 // > { 3442 // // const mergedShape = objectUtil.mergeShapes( 3443 // // this._def.shape(), 3444 // // merging._def.shape() 3445 // // ); 3446 // const merged: any = new ZodObject({ 3447 // unknownKeys: merging._def.unknownKeys, 3448 // catchall: merging._def.catchall, 3449 // shape: () => 3450 // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()), 3451 // typeName: ZodFirstPartyTypeKind.ZodObject, 3452 // }) as any; 3453 // return merged; 3454 // } 3455 catchall(e) { 3456 return new Qe({ 3457 ...this._def, 3458 catchall: e 3459 }); 3460 } 3461 pick(e) { 3462 const r = {}; 3463 for (const a of ke.objectKeys(e))
vendor: 18,511 bytes, lines 3464-4148
3464 e[a] && this.shape[a] && (r[a] = this.shape[a]); 3465 return new Qe({ 3466 ...this._def, 3467 shape: () => r 3468 }); 3469 } 3470 omit(e) { 3471 const r = {}; 3472 for (const a of ke.objectKeys(this.shape)) 3473 e[a] || (r[a] = this.shape[a]); 3474 return new Qe({ 3475 ...this._def, 3476 shape: () => r 3477 }); 3478 } 3479 /** 3480 * @deprecated 3481 */ 3482 deepPartial() { 3483 return hr(this); 3484 } 3485 partial(e) { 3486 const r = {}; 3487 for (const a of ke.objectKeys(this.shape)) { 3488 const t = this.shape[a]; 3489 e && !e[a] ? r[a] = t : r[a] = t.optional(); 3490 } 3491 return new Qe({ 3492 ...this._def, 3493 shape: () => r 3494 }); 3495 } 3496 required(e) { 3497 const r = {}; 3498 for (const a of ke.objectKeys(this.shape)) 3499 if (e && !e[a]) 3500 r[a] = this.shape[a]; 3501 else { 3502 let n = this.shape[a]; 3503 for (; n instanceof Ut; ) 3504 n = n._def.innerType; 3505 r[a] = n; 3506 } 3507 return new Qe({ 3508 ...this._def, 3509 shape: () => r 3510 }); 3511 } 3512 keyof() { 3513 return no(ke.objectKeys(this.shape)); 3514 } 3515} 3516Qe.create = (s, e) => new Qe({ 3517 shape: () => s, 3518 unknownKeys: "strip", 3519 catchall: Yt.create(), 3520 typeName: U.ZodObject, 3521 ...ye(e) 3522}); 3523Qe.strictCreate = (s, e) => new Qe({ 3524 shape: () => s, 3525 unknownKeys: "strict", 3526 catchall: Yt.create(), 3527 typeName: U.ZodObject, 3528 ...ye(e) 3529}); 3530Qe.lazycreate = (s, e) => new Qe({ 3531 shape: s, 3532 unknownKeys: "strip", 3533 catchall: Yt.create(), 3534 typeName: U.ZodObject, 3535 ...ye(e) 3536}); 3537class Xr extends Pe { 3538 _parse(e) { 3539 const { ctx: r } = this._processInputParams(e), a = this._def.options; 3540 function t(n) { 3541 for (const o of n) 3542 if (o.result.status === "valid") 3543 return o.result; 3544 for (const o of n) 3545 if (o.result.status === "dirty") 3546 return r.common.issues.push(...o.ctx.common.issues), o.result; 3547 const i = n.map((o) => new Bt(o.ctx.common.issues)); 3548 return K(r, { 3549 code: z.invalid_union, 3550 unionErrors: i 3551 }), oe; 3552 } 3553 if (r.common.async) 3554 return Promise.all(a.map(async (n) => { 3555 const i = { 3556 ...r, 3557 common: { 3558 ...r.common, 3559 issues: [] 3560 }, 3561 parent: null 3562 }; 3563 return { 3564 result: await n._parseAsync({ 3565 data: r.data, 3566 path: r.path, 3567 parent: i 3568 }), 3569 ctx: i 3570 }; 3571 })).then(t); 3572 { 3573 let n; 3574 const i = []; 3575 for (const u of a) { 3576 const l = { 3577 ...r, 3578 common: { 3579 ...r.common, 3580 issues: [] 3581 }, 3582 parent: null 3583 }, h = u._parseSync({ 3584 data: r.data, 3585 path: r.path, 3586 parent: l 3587 }); 3588 if (h.status === "valid") 3589 return h; 3590 h.status === "dirty" && !n && (n = { result: h, ctx: l }), l.common.issues.length && i.push(l.common.issues); 3591 } 3592 if (n) 3593 return r.common.issues.push(...n.ctx.common.issues), n.result; 3594 const o = i.map((u) => new Bt(u)); 3595 return K(r, { 3596 code: z.invalid_union, 3597 unionErrors: o 3598 }), oe; 3599 } 3600 } 3601 get options() { 3602 return this._def.options; 3603 } 3604} 3605Xr.create = (s, e) => new Xr({ 3606 options: s, 3607 typeName: U.ZodUnion, 3608 ...ye(e) 3609}); 3610const Lt = (s) => s instanceof As ? Lt(s.schema) : s instanceof or ? Lt(s.innerType()) : s instanceof ra ? [s.value] : s instanceof ir ? s.options : s instanceof Os ? ke.objectValues(s.enum) : s instanceof sa ? Lt(s._def.innerType) : s instanceof xs ? [void 0] : s instanceof Es ? [null] : s instanceof Ut ? [void 0, ...Lt(s.unwrap())] : s instanceof ur ? [null, ...Lt(s.unwrap())] : s instanceof io || s instanceof ia ? Lt(s.unwrap()) : s instanceof na ? Lt(s._def.innerType) : []; 3611class Ks extends Pe { 3612 _parse(e) { 3613 const { ctx: r } = this._processInputParams(e); 3614 if (r.parsedType !== Y.object) 3615 return K(r, { 3616 code: z.invalid_type, 3617 expected: Y.object, 3618 received: r.parsedType 3619 }), oe; 3620 const a = this.discriminator, t = r.data[a], n = this.optionsMap.get(t); 3621 return n ? r.common.async ? n._parseAsync({ 3622 data: r.data, 3623 path: r.path, 3624 parent: r 3625 }) : n._parseSync({ 3626 data: r.data, 3627 path: r.path, 3628 parent: r 3629 }) : (K(r, { 3630 code: z.invalid_union_discriminator, 3631 options: Array.from(this.optionsMap.keys()), 3632 path: [a] 3633 }), oe); 3634 } 3635 get discriminator() { 3636 return this._def.discriminator; 3637 } 3638 get options() { 3639 return this._def.options; 3640 } 3641 get optionsMap() { 3642 return this._def.optionsMap; 3643 } 3644 /** 3645 * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor. 3646 * However, it only allows a union of objects, all of which need to share a discriminator property. This property must 3647 * have a different value for each object in the union. 3648 * @param discriminator the name of the discriminator property 3649 * @param types an array of object schemas 3650 * @param params 3651 */ 3652 static create(e, r, a) { 3653 const t = /* @__PURE__ */ new Map(); 3654 for (const n of r) { 3655 const i = Lt(n.shape[e]); 3656 if (!i.length) 3657 throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`); 3658 for (const o of i) { 3659 if (t.has(o)) 3660 throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`); 3661 t.set(o, n); 3662 } 3663 } 3664 return new Ks({ 3665 typeName: U.ZodDiscriminatedUnion, 3666 discriminator: e, 3667 options: r, 3668 optionsMap: t, 3669 ...ye(a) 3670 }); 3671 } 3672} 3673function Ts(s, e) { 3674 const r = Wt(s), a = Wt(e); 3675 if (s === e) 3676 return { valid: !0, data: s }; 3677 if (r === Y.object && a === Y.object) { 3678 const t = ke.objectKeys(e), n = ke.objectKeys(s).filter((o) => t.indexOf(o) !== -1), i = { ...s, ...e }; 3679 for (const o of n) { 3680 const u = Ts(s[o], e[o]); 3681 if (!u.valid) 3682 return { valid: !1 }; 3683 i[o] = u.data; 3684 } 3685 return { valid: !0, data: i }; 3686 } else if (r === Y.array && a === Y.array) { 3687 if (s.length !== e.length) 3688 return { valid: !1 }; 3689 const t = []; 3690 for (let n = 0; n < s.length; n++) { 3691 const i = s[n], o = e[n], u = Ts(i, o); 3692 if (!u.valid) 3693 return { valid: !1 }; 3694 t.push(u.data); 3695 } 3696 return { valid: !0, data: t }; 3697 } else return r === Y.date && a === Y.date && +s == +e ? { valid: !0, data: s } : { valid: !1 }; 3698} 3699class ea extends Pe { 3700 _parse(e) { 3701 const { status: r, ctx: a } = this._processInputParams(e), t = (n, i) => { 3702 if (Dn(n) || Dn(i)) 3703 return oe; 3704 const o = Ts(n.value, i.value); 3705 return o.valid ? ((jn(n) || jn(i)) && r.dirty(), { status: r.value, value: o.data }) : (K(a, { 3706 code: z.invalid_intersection_types 3707 }), oe); 3708 }; 3709 return a.common.async ? Promise.all([ 3710 this._def.left._parseAsync({ 3711 data: a.data, 3712 path: a.path, 3713 parent: a 3714 }), 3715 this._def.right._parseAsync({ 3716 data: a.data, 3717 path: a.path, 3718 parent: a 3719 }) 3720 ]).then(([n, i]) => t(n, i)) : t(this._def.left._parseSync({ 3721 data: a.data, 3722 path: a.path, 3723 parent: a 3724 }), this._def.right._parseSync({ 3725 data: a.data, 3726 path: a.path, 3727 parent: a 3728 })); 3729 } 3730} 3731ea.create = (s, e, r) => new ea({ 3732 left: s, 3733 right: e, 3734 typeName: U.ZodIntersection, 3735 ...ye(r) 3736}); 3737class nr extends Pe { 3738 _parse(e) { 3739 const { status: r, ctx: a } = this._processInputParams(e); 3740 if (a.parsedType !== Y.array) 3741 return K(a, { 3742 code: z.invalid_type, 3743 expected: Y.array, 3744 received: a.parsedType 3745 }), oe; 3746 if (a.data.length < this._def.items.length) 3747 return K(a, { 3748 code: z.too_small, 3749 minimum: this._def.items.length, 3750 inclusive: !0, 3751 exact: !1, 3752 type: "array" 3753 }), oe; 3754 !this._def.rest && a.data.length > this._def.items.length && (K(a, { 3755 code: z.too_big, 3756 maximum: this._def.items.length, 3757 inclusive: !0, 3758 exact: !1, 3759 type: "array" 3760 }), r.dirty()); 3761 const n = [...a.data].map((i, o) => { 3762 const u = this._def.items[o] || this._def.rest; 3763 return u ? u._parse(new It(a, i, a.path, o)) : null; 3764 }).filter((i) => !!i); 3765 return a.common.async ? Promise.all(n).then((i) => ot.mergeArray(r, i)) : ot.mergeArray(r, n); 3766 } 3767 get items() { 3768 return this._def.items; 3769 } 3770 rest(e) { 3771 return new nr({ 3772 ...this._def, 3773 rest: e 3774 }); 3775 } 3776} 3777nr.create = (s, e) => { 3778 if (!Array.isArray(s)) 3779 throw new Error("You must pass an array of schemas to z.tuple([ ... ])"); 3780 return new nr({ 3781 items: s, 3782 typeName: U.ZodTuple, 3783 rest: null, 3784 ...ye(e) 3785 }); 3786}; 3787class ta extends Pe { 3788 get keySchema() { 3789 return this._def.keyType; 3790 } 3791 get valueSchema() { 3792 return this._def.valueType; 3793 } 3794 _parse(e) { 3795 const { status: r, ctx: a } = this._processInputParams(e); 3796 if (a.parsedType !== Y.object) 3797 return K(a, { 3798 code: z.invalid_type, 3799 expected: Y.object, 3800 received: a.parsedType 3801 }), oe; 3802 const t = [], n = this._def.keyType, i = this._def.valueType; 3803 for (const o in a.data) 3804 t.push({ 3805 key: n._parse(new It(a, o, a.path, o)), 3806 value: i._parse(new It(a, a.data[o], a.path, o)), 3807 alwaysSet: o in a.data 3808 }); 3809 return a.common.async ? ot.mergeObjectAsync(r, t) : ot.mergeObjectSync(r, t); 3810 } 3811 get element() { 3812 return this._def.valueType; 3813 } 3814 static create(e, r, a) { 3815 return r instanceof Pe ? new ta({ 3816 keyType: e, 3817 valueType: r, 3818 typeName: U.ZodRecord, 3819 ...ye(a) 3820 }) : new ta({ 3821 keyType: Mt.create(), 3822 valueType: e, 3823 typeName: U.ZodRecord, 3824 ...ye(r) 3825 }); 3826 } 3827} 3828class Zn extends Pe { 3829 get keySchema() { 3830 return this._def.keyType; 3831 } 3832 get valueSchema() { 3833 return this._def.valueType; 3834 } 3835 _parse(e) { 3836 const { status: r, ctx: a } = this._processInputParams(e); 3837 if (a.parsedType !== Y.map) 3838 return K(a, { 3839 code: z.invalid_type, 3840 expected: Y.map, 3841 received: a.parsedType 3842 }), oe; 3843 const t = this._def.keyType, n = this._def.valueType, i = [...a.data.entries()].map(([o, u], l) => ({ 3844 key: t._parse(new It(a, o, a.path, [l, "key"])), 3845 value: n._parse(new It(a, u, a.path, [l, "value"])) 3846 })); 3847 if (a.common.async) { 3848 const o = /* @__PURE__ */ new Map(); 3849 return Promise.resolve().then(async () => { 3850 for (const u of i) { 3851 const l = await u.key, h = await u.value; 3852 if (l.status === "aborted" || h.status === "aborted") 3853 return oe; 3854 (l.status === "dirty" || h.status === "dirty") && r.dirty(), o.set(l.value, h.value); 3855 } 3856 return { status: r.value, value: o }; 3857 }); 3858 } else { 3859 const o = /* @__PURE__ */ new Map(); 3860 for (const u of i) { 3861 const l = u.key, h = u.value; 3862 if (l.status === "aborted" || h.status === "aborted") 3863 return oe; 3864 (l.status === "dirty" || h.status === "dirty") && r.dirty(), o.set(l.value, h.value); 3865 } 3866 return { status: r.value, value: o }; 3867 } 3868 } 3869} 3870Zn.create = (s, e, r) => new Zn({ 3871 valueType: e, 3872 keyType: s, 3873 typeName: U.ZodMap, 3874 ...ye(r) 3875}); 3876class Or extends Pe { 3877 _parse(e) { 3878 const { status: r, ctx: a } = this._processInputParams(e); 3879 if (a.parsedType !== Y.set) 3880 return K(a, { 3881 code: z.invalid_type, 3882 expected: Y.set, 3883 received: a.parsedType 3884 }), oe; 3885 const t = this._def; 3886 t.minSize !== null && a.data.size < t.minSize.value && (K(a, { 3887 code: z.too_small, 3888 minimum: t.minSize.value, 3889 type: "set", 3890 inclusive: !0, 3891 exact: !1, 3892 message: t.minSize.message 3893 }), r.dirty()), t.maxSize !== null && a.data.size > t.maxSize.value && (K(a, { 3894 code: z.too_big, 3895 maximum: t.maxSize.value, 3896 type: "set", 3897 inclusive: !0, 3898 exact: !1, 3899 message: t.maxSize.message 3900 }), r.dirty()); 3901 const n = this._def.valueType; 3902 function i(u) { 3903 const l = /* @__PURE__ */ new Set(); 3904 for (const h of u) { 3905 if (h.status === "aborted") 3906 return oe; 3907 h.status === "dirty" && r.dirty(), l.add(h.value); 3908 } 3909 return { status: r.value, value: l }; 3910 } 3911 const o = [...a.data.values()].map((u, l) => n._parse(new It(a, u, a.path, l))); 3912 return a.common.async ? Promise.all(o).then((u) => i(u)) : i(o); 3913 } 3914 min(e, r) { 3915 return new Or({ 3916 ...this._def, 3917 minSize: { value: e, message: te.toString(r) } 3918 }); 3919 } 3920 max(e, r) { 3921 return new Or({ 3922 ...this._def, 3923 maxSize: { value: e, message: te.toString(r) } 3924 }); 3925 } 3926 size(e, r) { 3927 return this.min(e, r).max(e, r); 3928 } 3929 nonempty(e) { 3930 return this.min(1, e); 3931 } 3932} 3933Or.create = (s, e) => new Or({ 3934 valueType: s, 3935 minSize: null, 3936 maxSize: null, 3937 typeName: U.ZodSet, 3938 ...ye(e) 3939}); 3940class As extends Pe { 3941 get schema() { 3942 return this._def.getter(); 3943 } 3944 _parse(e) { 3945 const { ctx: r } = this._processInputParams(e); 3946 return this._def.getter()._parse({ data: r.data, path: r.path, parent: r }); 3947 } 3948} 3949As.create = (s, e) => new As({ 3950 getter: s, 3951 typeName: U.ZodLazy, 3952 ...ye(e) 3953}); 3954class ra extends Pe { 3955 _parse(e) { 3956 if (e.data !== this._def.value) { 3957 const r = this._getOrReturnCtx(e); 3958 return K(r, { 3959 received: r.data, 3960 code: z.invalid_literal, 3961 expected: this._def.value 3962 }), oe; 3963 } 3964 return { status: "valid", value: e.data }; 3965 } 3966 get value() { 3967 return this._def.value; 3968 } 3969} 3970ra.create = (s, e) => new ra({ 3971 value: s, 3972 typeName: U.ZodLiteral, 3973 ...ye(e) 3974}); 3975function no(s, e) { 3976 return new ir({ 3977 values: s, 3978 typeName: U.ZodEnum, 3979 ...ye(e) 3980 }); 3981} 3982class ir extends Pe { 3983 _parse(e) { 3984 if (typeof e.data != "string") { 3985 const r = this._getOrReturnCtx(e), a = this._def.values; 3986 return K(r, { 3987 expected: ke.joinValues(a), 3988 received: r.parsedType, 3989 code: z.invalid_type 3990 }), oe; 3991 } 3992 if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) { 3993 const r = this._getOrReturnCtx(e), a = this._def.values; 3994 return K(r, { 3995 received: r.data, 3996 code: z.invalid_enum_value, 3997 options: a 3998 }), oe; 3999 } 4000 return bt(e.data); 4001 } 4002 get options() { 4003 return this._def.values; 4004 } 4005 get enum() { 4006 const e = {}; 4007 for (const r of this._def.values) 4008 e[r] = r; 4009 return e; 4010 } 4011 get Values() { 4012 const e = {}; 4013 for (const r of this._def.values) 4014 e[r] = r; 4015 return e; 4016 } 4017 get Enum() { 4018 const e = {}; 4019 for (const r of this._def.values) 4020 e[r] = r; 4021 return e; 4022 } 4023 extract(e, r = this._def) { 4024 return ir.create(e, { 4025 ...this._def, 4026 ...r 4027 }); 4028 } 4029 exclude(e, r = this._def) { 4030 return ir.create(this.options.filter((a) => !e.includes(a)), { 4031 ...this._def, 4032 ...r 4033 }); 4034 } 4035} 4036ir.create = no; 4037class Os extends Pe { 4038 _parse(e) { 4039 const r = ke.getValidEnumValues(this._def.values), a = this._getOrReturnCtx(e); 4040 if (a.parsedType !== Y.string && a.parsedType !== Y.number) { 4041 const t = ke.objectValues(r); 4042 return K(a, { 4043 expected: ke.joinValues(t), 4044 received: a.parsedType, 4045 code: z.invalid_type 4046 }), oe; 4047 } 4048 if (this._cache || (this._cache = new Set(ke.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) { 4049 const t = ke.objectValues(r); 4050 return K(a, { 4051 received: a.data, 4052 code: z.invalid_enum_value, 4053 options: t 4054 }), oe; 4055 } 4056 return bt(e.data); 4057 } 4058 get enum() { 4059 return this._def.values; 4060 } 4061} 4062Os.create = (s, e) => new Os({ 4063 values: s, 4064 typeName: U.ZodNativeEnum, 4065 ...ye(e) 4066}); 4067class aa extends Pe { 4068 unwrap() { 4069 return this._def.type; 4070 } 4071 _parse(e) { 4072 const { ctx: r } = this._processInputParams(e); 4073 if (r.parsedType !== Y.promise && r.common.async === !1) 4074 return K(r, { 4075 code: z.invalid_type, 4076 expected: Y.promise, 4077 received: r.parsedType 4078 }), oe; 4079 const a = r.parsedType === Y.promise ? r.data : Promise.resolve(r.data); 4080 return bt(a.then((t) => this._def.type.parseAsync(t, { 4081 path: r.path, 4082 errorMap: r.common.contextualErrorMap 4083 }))); 4084 } 4085} 4086aa.create = (s, e) => new aa({ 4087 type: s, 4088 typeName: U.ZodPromise, 4089 ...ye(e) 4090}); 4091class or extends Pe { 4092 innerType() { 4093 return this._def.schema; 4094 } 4095 sourceType() { 4096 return this._def.schema._def.typeName === U.ZodEffects ? this._def.schema.sourceType() : this._def.schema; 4097 } 4098 _parse(e) { 4099 const { status: r, ctx: a } = this._processInputParams(e), t = this._def.effect || null, n = { 4100 addIssue: (i) => { 4101 K(a, i), i.fatal ? r.abort() : r.dirty(); 4102 }, 4103 get path() { 4104 return a.path; 4105 } 4106 }; 4107 if (n.addIssue = n.addIssue.bind(n), t.type === "preprocess") { 4108 const i = t.transform(a.data, n); 4109 if (a.common.async) 4110 return Promise.resolve(i).then(async (o) => { 4111 if (r.value === "aborted") 4112 return oe; 4113 const u = await this._def.schema._parseAsync({ 4114 data: o, 4115 path: a.path, 4116 parent: a 4117 }); 4118 return u.status === "aborted" ? oe : u.status === "dirty" || r.value === "dirty" ? wr(u.value) : u; 4119 }); 4120 { 4121 if (r.value === "aborted") 4122 return oe; 4123 const o = this._def.schema._parseSync({ 4124 data: i, 4125 path: a.path, 4126 parent: a 4127 }); 4128 return o.status === "aborted" ? oe : o.status === "dirty" || r.value === "dirty" ? wr(o.value) : o; 4129 } 4130 } 4131 if (t.type === "refinement") { 4132 const i = (o) => { 4133 const u = t.refinement(o, n); 4134 if (a.common.async) 4135 return Promise.resolve(u); 4136 if (u instanceof Promise) 4137 throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead."); 4138 return o; 4139 }; 4140 if (a.common.async === !1) { 4141 const o = this._def.schema._parseSync({ 4142 data: a.data, 4143 path: a.path, 4144 parent: a 4145 }); 4146 return o.status === "aborted" ? oe : (o.status === "dirty" && r.dirty(), i(o.value), { status: r.value, value: o.value }); 4147 } else 4148 return this._def.schema._parseAsync({ data: a.data, path: a.path, parent: a }).then((o) => o.status === "aborted" ? oe : (o.status === "dirty" && r.dirty(), i(o.value).then(() => ({ status: r.value, value: o.value }
vendor: 8,635 bytes, lines 4148-4430
4148)))); 4149 } 4150 if (t.type === "transform") 4151 if (a.common.async === !1) { 4152 const i = this._def.schema._parseSync({ 4153 data: a.data, 4154 path: a.path, 4155 parent: a 4156 }); 4157 if (!mr(i)) 4158 return oe; 4159 const o = t.transform(i.value, n); 4160 if (o instanceof Promise) 4161 throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead."); 4162 return { status: r.value, value: o }; 4163 } else 4164 return this._def.schema._parseAsync({ data: a.data, path: a.path, parent: a }).then((i) => mr(i) ? Promise.resolve(t.transform(i.value, n)).then((o) => ({ 4165 status: r.value, 4166 value: o 4167 })) : oe); 4168 ke.assertNever(t); 4169 } 4170} 4171or.create = (s, e, r) => new or({ 4172 schema: s, 4173 typeName: U.ZodEffects, 4174 effect: e, 4175 ...ye(r) 4176}); 4177or.createWithPreprocess = (s, e, r) => new or({ 4178 schema: e, 4179 effect: { type: "preprocess", transform: s }, 4180 typeName: U.ZodEffects, 4181 ...ye(r) 4182}); 4183class Ut extends Pe { 4184 _parse(e) { 4185 return this._getType(e) === Y.undefined ? bt(void 0) : this._def.innerType._parse(e); 4186 } 4187 unwrap() { 4188 return this._def.innerType; 4189 } 4190} 4191Ut.create = (s, e) => new Ut({ 4192 innerType: s, 4193 typeName: U.ZodOptional, 4194 ...ye(e) 4195}); 4196class ur extends Pe { 4197 _parse(e) { 4198 return this._getType(e) === Y.null ? bt(null) : this._def.innerType._parse(e); 4199 } 4200 unwrap() { 4201 return this._def.innerType; 4202 } 4203} 4204ur.create = (s, e) => new ur({ 4205 innerType: s, 4206 typeName: U.ZodNullable, 4207 ...ye(e) 4208}); 4209class sa extends Pe { 4210 _parse(e) { 4211 const { ctx: r } = this._processInputParams(e); 4212 let a = r.data; 4213 return r.parsedType === Y.undefined && (a = this._def.defaultValue()), this._def.innerType._parse({ 4214 data: a, 4215 path: r.path, 4216 parent: r 4217 }); 4218 } 4219 removeDefault() { 4220 return this._def.innerType; 4221 } 4222} 4223sa.create = (s, e) => new sa({ 4224 innerType: s, 4225 typeName: U.ZodDefault, 4226 defaultValue: typeof e.default == "function" ? e.default : () => e.default, 4227 ...ye(e) 4228}); 4229class na extends Pe { 4230 _parse(e) { 4231 const { ctx: r } = this._processInputParams(e), a = { 4232 ...r, 4233 common: { 4234 ...r.common, 4235 issues: [] 4236 } 4237 }, t = this._def.innerType._parse({ 4238 data: a.data, 4239 path: a.path, 4240 parent: { 4241 ...a 4242 } 4243 }); 4244 return Gr(t) ? t.then((n) => ({ 4245 status: "valid", 4246 value: n.status === "valid" ? n.value : this._def.catchValue({ 4247 get error() { 4248 return new Bt(a.common.issues); 4249 }, 4250 input: a.data 4251 }) 4252 })) : { 4253 status: "valid", 4254 value: t.status === "valid" ? t.value : this._def.catchValue({ 4255 get error() { 4256 return new Bt(a.common.issues); 4257 }, 4258 input: a.data 4259 }) 4260 }; 4261 } 4262 removeCatch() { 4263 return this._def.innerType; 4264 } 4265} 4266na.create = (s, e) => new na({ 4267 innerType: s, 4268 typeName: U.ZodCatch, 4269 catchValue: typeof e.catch == "function" ? e.catch : () => e.catch, 4270 ...ye(e) 4271}); 4272class Mn extends Pe { 4273 _parse(e) { 4274 if (this._getType(e) !== Y.nan) { 4275 const a = this._getOrReturnCtx(e); 4276 return K(a, { 4277 code: z.invalid_type, 4278 expected: Y.nan, 4279 received: a.parsedType 4280 }), oe; 4281 } 4282 return { status: "valid", value: e.data }; 4283 } 4284} 4285Mn.create = (s) => new Mn({ 4286 typeName: U.ZodNaN, 4287 ...ye(s) 4288}); 4289class io extends Pe { 4290 _parse(e) { 4291 const { ctx: r } = this._processInputParams(e), a = r.data; 4292 return this._def.type._parse({ 4293 data: a, 4294 path: r.path, 4295 parent: r 4296 }); 4297 } 4298 unwrap() { 4299 return this._def.type; 4300 } 4301} 4302class Js extends Pe { 4303 _parse(e) { 4304 const { status: r, ctx: a } = this._processInputParams(e); 4305 if (a.common.async) 4306 return (async () => { 4307 const n = await this._def.in._parseAsync({ 4308 data: a.data, 4309 path: a.path, 4310 parent: a 4311 }); 4312 return n.status === "aborted" ? oe : n.status === "dirty" ? (r.dirty(), wr(n.value)) : this._def.out._parseAsync({ 4313 data: n.value, 4314 path: a.path, 4315 parent: a 4316 }); 4317 })(); 4318 { 4319 const t = this._def.in._parseSync({ 4320 data: a.data, 4321 path: a.path, 4322 parent: a 4323 }); 4324 return t.status === "aborted" ? oe : t.status === "dirty" ? (r.dirty(), { 4325 status: "dirty", 4326 value: t.value 4327 }) : this._def.out._parseSync({ 4328 data: t.value, 4329 path: a.path, 4330 parent: a 4331 }); 4332 } 4333 } 4334 static create(e, r) { 4335 return new Js({ 4336 in: e, 4337 out: r, 4338 typeName: U.ZodPipeline 4339 }); 4340 } 4341} 4342class ia extends Pe { 4343 _parse(e) { 4344 const r = this._def.innerType._parse(e), a = (t) => (mr(t) && (t.value = Object.freeze(t.value)), t); 4345 return Gr(r) ? r.then((t) => a(t)) : a(r); 4346 } 4347 unwrap() { 4348 return this._def.innerType; 4349 } 4350} 4351ia.create = (s, e) => new ia({ 4352 innerType: s, 4353 typeName: U.ZodReadonly, 4354 ...ye(e) 4355}); 4356var U; 4357(function(s) { 4358 s.ZodString = "ZodString", s.ZodNumber = "ZodNumber", s.ZodNaN = "ZodNaN", s.ZodBigInt = "ZodBigInt", s.ZodBoolean = "ZodBoolean", s.ZodDate = "ZodDate", s.ZodSymbol = "ZodSymbol", s.ZodUndefined = "ZodUndefined", s.ZodNull = "ZodNull", s.ZodAny = "ZodAny", s.ZodUnknown = "ZodUnknown", s.ZodNever = "ZodNever", s.ZodVoid = "ZodVoid", s.ZodArray = "ZodArray", s.ZodObject = "ZodObject", s.ZodUnion = "ZodUnion", s.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", s.ZodIntersection = "ZodIntersection", s.ZodTuple = "ZodTuple", s.ZodRecord = "ZodRecord", s.ZodMap = "ZodMap", s.ZodSet = "ZodSet", s.ZodFunction = "ZodFunction", s.ZodLazy = "ZodLazy", s.ZodLiteral = "ZodLiteral", s.ZodEnum = "ZodEnum", s.ZodEffects = "ZodEffects", s.ZodNativeEnum = "ZodNativeEnum", s.ZodOptional = "ZodOptional", s.ZodNullable = "ZodNullable", s.ZodDefault = "ZodDefault", s.ZodCatch = "ZodCatch", s.ZodPromise = "ZodPromise", s.ZodBranded = "ZodBranded", s.ZodPipeline = "ZodPipeline", s.ZodReadonly = "ZodReadonly"; 4359})(U || (U = {})); 4360const H = Mt.create, et = vr.create, ct = ws.create, Gl = Rs.create, Nr = ks.create; 4361Yt.create; 4362const Ke = Ct.create, W = Qe.create, ut = Xr.create, Yl = Ks.create; 4363ea.create; 4364nr.create; 4365const gr = ta.create, me = ra.create, Nt = ir.create; 4366aa.create; 4367const q = Ut.create; 4368ur.create; 4369const oo = "2025-06-18", Xl = [ 4370 oo, 4371 "2025-03-26", 4372 "2024-11-05", 4373 "2024-10-07" 4374], ha = "2.0", uo = ut([H(), et().int()]), lo = H(), ec = W({ 4375 /** 4376 * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. 4377 */ 4378 progressToken: q(uo) 4379}).passthrough(), Pt = W({ 4380 _meta: q(ec) 4381}).passthrough(), ft = W({ 4382 method: H(), 4383 params: q(Pt) 4384}), Dr = W({ 4385 /** 4386 * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) 4387 * for notes on _meta usage. 4388 */ 4389 _meta: q(W({}).passthrough()) 4390}).passthrough(), jt = W({ 4391 method: H(), 4392 params: q(Dr) 4393}), St = W({ 4394 /** 4395 * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) 4396 * for notes on _meta usage. 4397 */ 4398 _meta: q(W({}).passthrough()) 4399}).passthrough(), fa = ut([H(), et().int()]), co = W({ 4400 jsonrpc: me(ha), 4401 id: fa 4402}).merge(ft).strict(), tc = (s) => co.safeParse(s).success, ho = W({ 4403 jsonrpc: me(ha) 4404}).merge(jt).strict(), rc = (s) => ho.safeParse(s).success, fo = W({ 4405 jsonrpc: me(ha), 4406 id: fa, 4407 result: St 4408}).strict(), zn = (s) => fo.safeParse(s).success; 4409var qe; 4410(function(s) { 4411 s[s.ConnectionClosed = -32e3] = "ConnectionClosed", s[s.RequestTimeout = -32001] = "RequestTimeout", s[s.ParseError = -32700] = "ParseError", s[s.InvalidRequest = -32600] = "InvalidRequest", s[s.MethodNotFound = -32601] = "MethodNotFound", s[s.InvalidParams = -32602] = "InvalidParams", s[s.InternalError = -32603] = "InternalError"; 4412})(qe || (qe = {})); 4413const po = W({ 4414 jsonrpc: me(ha), 4415 id: fa, 4416 error: W({ 4417 /** 4418 * The error type that occurred. 4419 */ 4420 code: et().int(), 4421 /** 4422 * A short description of the error. The message SHOULD be limited to a concise single sentence. 4423 */ 4424 message: H(), 4425 /** 4426 * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.). 4427 */ 4428 data: q(Nr()) 4429 }) 4430}
4430).strict(), ac = (s) => po.safeParse(s).success; 4431ut([ 4432 co, 4433 ho, 4434 fo, 4435 po 4436]); 4437const Ws = St.strict(), Gs = jt.extend({ 4438 method: me("notifications/cancelled"), 4439 params: Dr.extend({ 4440 /** 4441 * The ID of the request to cancel. 4442 * 4443 * This MUST correspond to the ID of a request previously issued in the same direction. 4444 */ 4445 requestId: fa, 4446 /** 4447 * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user. 4448 */ 4449 reason: H().optional() 4450 }) 4451}), jr = W({ 4452 /** Intended for programmatic or logical use, but used as a display name in past specs or fallback */ 4453 name: H(), 4454 /** 4455 * Intended for UI and end-user contexts — optimized to be human-readable and easily understood, 4456 * even by those unfamiliar with domain-specific terminology. 4457 * 4458 * If not provided, the name should be used for display (except for Tool, 4459 * where `annotations.title` should be given precedence over using `name`, 4460 * if present). 4461 */ 4462 title: q(H()) 4463}).passthrough(), mo = jr.extend({ 4464 version: H() 4465}), sc = W({ 4466 /** 4467 * Experimental, non-standard capabilities that the client supports. 4468 */ 4469 experimental: q(W({}).passthrough()), 4470 /** 4471 * Present if the client supports sampling from an LLM. 4472 */ 4473 sampling: q(W({}).passthrough()), 4474 /** 4475 * Present if the client supports eliciting user input. 4476 */ 4477 elicitation: q(W({}).passthrough()), 4478 /** 4479 * Present if the client supports listing roots. 4480 */ 4481 roots: q(W({ 4482 /** 4483 * Whether the client supports issuing notifications for changes to the roots list. 4484 */ 4485 listChanged: q(ct()) 4486 }).passthrough()) 4487}).passthrough(), vo = ft.extend({ 4488 method: me("initialize"), 4489 params: Pt.extend({ 4490 /** 4491 * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well. 4492 */ 4493 protocolVersion: H(), 4494 capabilities: sc, 4495 clientInfo: mo 4496 }) 4497}), nc = W({ 4498 /** 4499 * Experimental, non-standard capabilities that the server supports. 4500 */ 4501 experimental: q(W({}).passthrough()), 4502 /** 4503 * Present if the server supports sending log messages to the client. 4504 */ 4505 logging: q(W({}).passthrough()), 4506 /** 4507 * Present if the server supports sending completions to the client. 4508 */ 4509 completions: q(W({}).passthrough()), 4510 /** 4511 * Present if the server offers any prompt templates. 4512 */ 4513 prompts: q(W({ 4514 /** 4515 * Whether this server supports issuing notifications for changes to the prompt list. 4516 */ 4517 listChanged: q(ct()) 4518 }).passthrough()), 4519 /** 4520 * Present if the server offers any resources to read. 4521 */ 4522 resources: q(W({ 4523 /** 4524 * Whether this server supports clients subscribing to resource updates. 4525 */ 4526 subscribe: q(ct()), 4527 /** 4528 * Whether this server supports issuing notifications for changes to the resource list. 4529 */ 4530 listChanged: q(ct()) 4531 }).passthrough()), 4532 /** 4533 * Present if the server offers any tools to call. 4534 */ 4535 tools: q(W({ 4536 /** 4537 * Whether this server supports issuing notifications for changes to the tool list. 4538 */ 4539 listChanged: q(ct()) 4540 }).passthrough()) 4541}).passthrough(), ic = St.extend({ 4542 /** 4543 * The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect. 4544 */ 4545 protocolVersion: H(), 4546 capabilities: nc, 4547 serverInfo: mo, 4548 /** 4549 * Instructions describing how to use the server and its features. 4550 * 4551 * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt. 4552 */ 4553 instructions: q(H()) 4554}), go = jt.extend({ 4555 method: me("notifications/initialized") 4556}), Ys = ft.extend({ 4557 method: me("ping") 4558}), oc = W({ 4559 /** 4560 * The progress thus far. This should increase every time progress is made, even if the total is unknown. 4561 */ 4562 progress: et(), 4563 /** 4564 * Total number of items to process (or total progress required), if known. 4565 */
4566 total: q(et()), 4567 /** 4568 * An optional message describing the current progress. 4569 */ 4570 message: q(H()) 4571}).passthrough(), Xs = jt.extend({ 4572 method: me("notifications/progress"), 4573 params: Dr.merge(oc).extend({ 4574 /** 4575 * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding. 4576 */ 4577 progressToken: uo 4578 }) 4579}), pa = ft.extend({ 4580 params: Pt.extend({ 4581 /** 4582 * An opaque token representing the current pagination position. 4583 * If provided, the server should return results starting after this cursor. 4584 */ 4585 cursor: q(lo) 4586 }).optional() 4587}), ma = St.extend({ 4588 /** 4589 * An opaque token representing the pagination position after the last returned result. 4590 * If present, there may be more results available. 4591 */ 4592 nextCursor: q(lo) 4593}), yo = W({ 4594 /** 4595 * The URI of this resource. 4596 */ 4597 uri: H(), 4598 /** 4599 * The MIME type of this resource, if known. 4600 */ 4601 mimeType: q(H()), 4602 /** 4603 * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) 4604 * for notes on _meta usage. 4605 */ 4606 _meta: q(W({}).passthrough()) 4607}).passthrough(), _o = yo.extend({ 4608 /** 4609 * The text of the item. This must only be set if the item can actually be represented as text (not binary data). 4610 */ 4611 text: H() 4612}), en = H().refine((s) => { 4613 try { 4614 return atob(s), !0; 4615 } catch { 4616 return !1; 4617 } 4618}, { message: "Invalid Base64 string" }), bo = yo.extend({ 4619 /** 4620 * A base64-encoded string representing the binary data of the item. 4621 */ 4622 blob: en 4623}), Po = jr.extend({ 4624 /** 4625 * The URI of this resource. 4626 */ 4627 uri: H(), 4628 /** 4629 * A description of what this resource represents. 4630 * 4631 * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model. 4632 */ 4633 description: q(H()), 4634 /** 4635 * The MIME type of this resource, if known. 4636 */ 4637 mimeType: q(H()), 4638 /** 4639 * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) 4640 * for notes on _meta usage. 4641 */ 4642 _meta: q(W({}).passthrough()) 4643}), uc = jr.extend({ 4644 /** 4645 * A URI template (according to RFC 6570) that can be used to construct resource URIs. 4646 */ 4647 uriTemplate: H(), 4648 /** 4649 * A description of what this template is for. 4650 * 4651 * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model. 4652 */ 4653 description: q(H()), 4654 /** 4655 * The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type. 4656 */ 4657 mimeType: q(H()), 4658 /** 4659 * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) 4660 * for notes on _meta usage. 4661 */ 4662 _meta: q(W({}).passthrough()) 4663}), Cs = pa.extend({ 4664 method: me("resources/list") 4665}), lc = ma.extend({ 4666 resources: Ke(Po) 4667}), $s = pa.extend({ 4668 method: me("resources/templates/list") 4669}), cc = ma.extend({ 4670 resourceTemplates: Ke(uc) 4671}), Is = ft.extend({ 4672 method: me("resources/read"), 4673 params: Pt.extend({ 4674 /** 4675 * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it. 4676 */ 4677 uri: H() 4678 }) 4679}), dc = St.extend({ 4680 contents: Ke(ut([_o, bo])) 4681}), hc = jt.extend({ 4682 method: me("notifications/resources/list_changed") 4683}), fc = ft.extend({ 4684 method: me("resources/subscribe"), 4685 params: Pt.extend({ 4686 /** 4687 * The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it. 4688 */ 4689 uri: H() 4690 }) 4691}), pc = ft.extend({ 4692 method: me("resources/unsubscribe"), 4693 params: Pt.extend({ 4694 /** 4695 * The URI of the resource to unsubscribe from. 4696 */ 4697 uri: H() 4698 }) 4699}), mc = jt.extend({ 4700 method: me("notifications/resources/updated"), 4701 params: Dr.extend({ 4702 /** 4703 * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to. 4704 */ 4705 uri: H() 4706 }) 4707}), vc = W({ 4708 /** 4709 * The name of the argument. 4710 */ 4711 name: H(), 4712 /** 4713 * A human-readable description of the argument. 4714 */ 4715 description: q(H()), 4716 /** 4717 * Whether this argument must be provided. 4718 */ 4719 required: q(ct()) 4720}).passthrough(), gc = jr.extend({ 4721 /** 4722 * An optional description of what this prompt provides 4723 */ 4724 description: q(H()), 4725 /** 4726 * A list of arguments to use for templating the prompt. 4727 */ 4728 arguments: q(Ke(vc)), 4729 /** 4730 * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) 4731 * for notes on _meta usage. 4732 */ 4733 _meta: q(W({}).passthrough()) 4734}), Ns = pa.extend({ 4735 method: me("prompts/list") 4736}), yc = ma.extend({ 4737 prompts: Ke(gc) 4738}), Ds = ft.extend({ 4739 method: me("prompts/get"), 4740 params: Pt.extend({ 4741 /** 4742 * The name of the prompt or prompt template. 4743 */ 4744 name: H(), 4745 /** 4746 * Arguments to use for templating the prompt. 4747 */ 4748 arguments: q(gr(H())) 4749 }) 4750}), tn = W({ 4751 type: me("text"), 4752 /** 4753 * The text content of the message. 4754 */ 4755 text: H(), 4756 /** 4757 * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) 4758 * for notes on _meta usage. 4759 */ 4760 _meta: q(W({}).passthrough()) 4761}).passthrough(), rn = W({ 4762 type: me("image"), 4763 /** 4764 * The base64-encoded image data. 4765 */ 4766 data: en, 4767 /** 4768 * The MIME type of the image. Different providers may support different image types. 4769 */ 4770 mimeType: H(), 4771 /** 4772 * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) 4773 * for notes on _meta usage. 4774 */ 4775 _meta: q(W({}).passthrough()) 4776}).passthrough(), an = W({ 4777 type: me("audio"), 4778 /** 4779 * The base64-encoded audio data. 4780 */ 4781 data: en, 4782 /** 4783 * The MIME type of the audio. Different providers may support different audio types. 4784 */ 4785 mimeType: H(), 4786 /** 4787 * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) 4788 * for notes on _meta usage. 4789 */ 4790 _meta: q(W({}).passthrough()) 4791}).passthrough(), _c = W({ 4792 type: me("resource"), 4793 resource: ut([_o, bo]), 4794 /** 4795 * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) 4796 * for notes on _meta usage. 4797 */ 4798 _meta: q(W({}).passthrough()) 4799}).passthrough(), bc = Po.extend({ 4800 type: me("resource_link") 4801}), So = ut([ 4802 tn, 4803 rn, 4804 an, 4805 bc, 4806 _c 4807]), Pc = W({ 4808 role: Nt(["user", "assistant"]), 4809 content: So 4810}).passthrough(), Sc = St.extend({ 4811 /** 4812 * An optional description for the prompt. 4813 */ 4814 description: q(H()), 4815 messages: Ke(Pc) 4816}), wc = jt.extend({ 4817 method: me("notifications/prompts/list_changed") 4818}), xc = W({ 4819 /** 4820 * A human-readable title for the tool. 4821 */ 4822 title: q(H()), 4823 /** 4824 * If true, the tool does not modify its environment. 4825 * 4826 * Default: false 4827 */ 4828 readOnlyHint: q(ct()), 4829 /** 4830 * If true, the tool may perform destructive updates to its environment. 4831 * If false, the tool performs only additive updates. 4832 * 4833 * (This property is meaningful only when `readOnlyHint == false`) 4834 * 4835 * Default: true 4836 */ 4837 destructiveHint: q(ct()), 4838 /** 4839 * If true, calling the tool repeatedly with the same arguments 4840 * will have no additional effect on the its environment. 4841 * 4842 * (This property is meaningful only when `readOnlyHint == false`) 4843 * 4844 * Default: false 4845 */ 4846 idempotentHint: q(ct()), 4847 /** 4848 * If true, this tool may interact with an "open world" of external 4849 * entities. If false, the tool's domain of interaction is closed. 4850 * For example, the world of a web search tool is open, whereas that 4851 * of a memory tool is not. 4852 * 4853 * Default: true 4854 */ 4855 openWorldHint: q(ct()) 4856}).passthrough(), Ec = jr.extend({ 4857 /** 4858 * A human-readable description of the tool. 4859 */ 4860 description: q(H()), 4861 /** 4862 * A JSON Schema object defining the expected parameters for the tool. 4863 */ 4864 inputSchema: W({ 4865 type: me("object"), 4866 properties: q(W({}).passthrough()), 4867 required: q(Ke(H())) 4868 }).passthrough(), 4869 /** 4870 * An optional JSON Schema object defining the structure of the tool's output returned in 4871 * the structuredContent field of a CallToolResult. 4872 */
4873 outputSchema: q(W({ 4874 type: me("object"), 4875 properties: q(W({}).passthrough()), 4876 required: q(Ke(H())) 4877 }).passthrough()), 4878 /** 4879 * Optional additional tool information. 4880 */ 4881 annotations: q(xc), 4882 /** 4883 * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) 4884 * for notes on _meta usage. 4885 */ 4886 _meta: q(W({}).passthrough()) 4887}), js = pa.extend({ 4888 method: me("tools/list") 4889}), Rc = ma.extend({ 4890 tools: Ke(Ec) 4891}), wo = St.extend({ 4892 /** 4893 * A list of content objects that represent the result of the tool call. 4894 * 4895 * If the Tool does not define an outputSchema, this field MUST be present in the result. 4896 * For backwards compatibility, this field is always present, but it may be empty. 4897 */ 4898 content: Ke(So).default([]), 4899 /** 4900 * An object containing structured tool output. 4901 * 4902 * If the Tool defines an outputSchema, this field MUST be present in the result, and contain a JSON object that matches the schema. 4903 */ 4904 structuredContent: W({}).passthrough().optional(), 4905 /** 4906 * Whether the tool call ended in an error. 4907 * 4908 * If not set, this is assumed to be false (the call was successful). 4909 * 4910 * Any errors that originate from the tool SHOULD be reported inside the result 4911 * object, with `isError` set to true, _not_ as an MCP protocol-level error 4912 * response. Otherwise, the LLM would not be able to see that an error occurred 4913 * and self-correct. 4914 * 4915 * However, any errors in _finding_ the tool, an error indicating that the 4916 * server does not support tool calls, or any other exceptional conditions, 4917 * should be reported as an MCP error response. 4918 */ 4919 isError: q(ct()) 4920}); 4921wo.or(St.extend({ 4922 toolResult: Nr() 4923})); 4924const Fs = ft.extend({ 4925 method: me("tools/call"), 4926 params: Pt.extend({ 4927 name: H(), 4928 arguments: q(gr(Nr())) 4929 }) 4930}), kc = jt.extend({ 4931 method: me("notifications/tools/list_changed") 4932}), xo = Nt([ 4933 "debug", 4934 "info", 4935 "notice", 4936 "warning", 4937 "error", 4938 "critical", 4939 "alert", 4940 "emergency" 4941]), Tc = ft.extend({ 4942 method: me("logging/setLevel"), 4943 params: Pt.extend({ 4944 /** 4945 * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/logging/message. 4946 */ 4947 level: xo 4948 }) 4949}), Ac = jt.extend({ 4950 method: me("notifications/message"), 4951 params: Dr.extend({ 4952 /** 4953 * The severity of this log message. 4954 */ 4955 level: xo, 4956 /** 4957 * An optional name of the logger issuing this message. 4958 */ 4959 logger: q(H()), 4960 /** 4961 * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here. 4962 */ 4963 data: Nr() 4964 }) 4965}), Oc = W({ 4966 /** 4967 * A hint for a model name. 4968 */ 4969 name: H().optional() 4970}).passthrough(), Cc = W({ 4971 /** 4972 * Optional hints to use for model selection. 4973 */ 4974 hints: q(Ke(Oc)), 4975 /** 4976 * How much to prioritize cost when selecting a model. 4977 */ 4978 costPriority: q(et().min(0).max(1)), 4979 /** 4980 * How much to prioritize sampling speed (latency) when selecting a model. 4981 */ 4982 speedPriority: q(et().min(0).max(1)), 4983 /** 4984 * How much to prioritize intelligence and capabilities when selecting a model. 4985 */ 4986 intelligencePriority: q(et().min(0).max(1)) 4987}).passthrough(), $c = W({ 4988 role: Nt(["user", "assistant"]), 4989 content: ut([tn, rn, an]) 4990}).passthrough(), Ic = ft.extend({ 4991 method: me("sampling/createMessage"), 4992 params: Pt.extend({ 4993 messages: Ke($c), 4994 /** 4995 * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt. 4996 */ 4997 systemPrompt: q(H()), 4998 /** 4999 * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request. 5000 */ 5001 includeContext: q(Nt(["none", "thisServer", "allServers"])), 5002 temperature: q(et()), 5003 /** 5004 * The maximum number of tokens to sample, as requested by the server. The client MAY cho
5004ose to sample fewer tokens than requested. 5005 */ 5006 maxTokens: et().int(), 5007 stopSequences: q(Ke(H())), 5008 /** 5009 * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific. 5010 */ 5011 metadata: q(W({}).passthrough()), 5012 /** 5013 * The server's preferences for which model to select. 5014 */ 5015 modelPreferences: q(Cc) 5016 }) 5017}), Eo = St.extend({ 5018 /** 5019 * The name of the model that generated the message. 5020 */ 5021 model: H(), 5022 /** 5023 * The reason why sampling stopped. 5024 */ 5025 stopReason: q(Nt(["endTurn", "stopSequence", "maxTokens"]).or(H())), 5026 role: Nt(["user", "assistant"]), 5027 content: Yl("type", [ 5028 tn, 5029 rn, 5030 an 5031 ]) 5032}), Nc = W({ 5033 type: me("boolean"), 5034 title: q(H()), 5035 description: q(H()), 5036 default: q(ct()) 5037}).passthrough(), Dc = W({ 5038 type: me("string"), 5039 title: q(H()), 5040 description: q(H()), 5041 minLength: q(et()), 5042 maxLength: q(et()), 5043 format: q(Nt(["email", "uri", "date", "date-time"])) 5044}).passthrough(), jc = W({ 5045 type: Nt(["number", "integer"]), 5046 title: q(H()), 5047 description: q(H()), 5048 minimum: q(et()), 5049 maximum: q(et()) 5050}).passthrough(), Fc = W({ 5051 type: me("string"), 5052 title: q(H()), 5053 description: q(H()), 5054 enum: Ke(H()), 5055 enumNames: q(Ke(H())) 5056}).passthrough(), qc = ut([ 5057 Nc, 5058 Dc, 5059 jc, 5060 Fc 5061]), Lc = ft.extend({ 5062 method: me("elicitation/create"), 5063 params: Pt.extend({ 5064 /** 5065 * The message to present to the user. 5066 */ 5067 message: H(), 5068 /** 5069 * The schema for the requested user input. 5070 */ 5071 requestedSchema: W({ 5072 type: me("object"), 5073 properties: gr(H(), qc), 5074 required: q(Ke(H())) 5075 }).passthrough() 5076 }) 5077}), Ro = St.extend({ 5078 /** 5079 * The user's response action. 5080 */ 5081 action: Nt(["accept", "decline", "cancel"]), 5082 /** 5083 * The collected user input content (only present if action is "accept"). 5084 */ 5085 content: q(gr(H(), Nr())) 5086}), Zc = W({ 5087 type: me("ref/resource"), 5088 /** 5089 * The URI or URI template of the resource. 5090 */ 5091 uri: H() 5092}).passthrough(), Mc = W({ 5093 type: me("ref/prompt"), 5094 /** 5095 * The name of the prompt or prompt template 5096 */ 5097 name: H() 5098}).passthrough(), qs = ft.extend({ 5099 method: me("completion/complete"), 5100 params: Pt.extend({ 5101 ref: ut([Mc, Zc]), 5102 /** 5103 * The argument's information 5104 */ 5105 argument: W({ 5106 /** 5107 * The name of the argument 5108 */ 5109 name: H(), 5110 /** 5111 * The value of the argument to use for completion matching. 5112 */ 5113 value: H() 5114 }).passthrough(), 5115 context: q(W({ 5116 /** 5117 * Previously-resolved variables in a URI template or prompt. 5118 */ 5119 arguments: q(gr(H(), H())) 5120 })) 5121 }) 5122}), zc = St.extend({ 5123 completion: W({ 5124 /** 5125 * An array of completion values. Must not exceed 100 items. 5126 */ 5127 values: Ke(H()).max(100), 5128 /** 5129 * The total number of completion options available. This can exceed the number of values actually sent in the response. 5130 */ 5131 total: q(et().int()), 5132 /** 5133 * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown. 5134 */ 5135 hasMore: q(ct()) 5136 }).passthrough() 5137}), Uc = W({ 5138 /** 5139 * The URI identifying the root. This *must* start with file:// for now. 5140 */ 5141 uri: H().startsWith("file://"), 5142 /** 5143 * An optional name for the root. 5144 */ 5145 name: q(H()), 5146 /** 5147 * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) 5148 * for notes on _meta usage. 5149 */ 5150 _meta: q(W({}).passthrough()) 5151}).passthrough(), Vc = ft.extend({ 5152 method: me("roots/list") 5153}), ko = St.extend({ 5154 roots: Ke(Uc) 5155}), Hc = jt.extend({ 5156 method: me("notifications/roots/list_changed") 5157}); 5158ut([ 5159 Ys, 5160 vo, 5161 qs, 5162 Tc, 5163 Ds, 5164 Ns, 5165 Cs, 5166 $s, 5167 Is, 5168 fc, 5169 pc, 5170 Fs, 5171 js 5172]); 5173ut([ 5174 Gs, 5175 Xs, 5176 go, 5177 Hc 5178]); 5179ut([ 5180 Ws, 5181 Eo, 5182 Ro, 5183 ko 5184]); 5185ut([ 5186 Ys, 5187 Ic, 5188 Lc, 5189 Vc 5190]); 5191ut([ 5192 Gs, 5193 Xs, 5194 Ac, 5195 mc, 5196 hc, 5197 kc, 5198 wc 5199]); 5200ut([ 5201 Ws, 5202 ic, 5203 zc, 5204 Sc, 5205 yc, 5206 lc, 5207 cc, 5208 dc, 5209 wo, 5210 Rc 5211]);
5212class Ve extends Error { 5213 constructor(e, r, a) { 5214 super(`MCP error ${e}: ${r}`), this.code = e, this.data = a, this.name = "McpError"; 5215 } 5216} 5217const Bc = 6e4; 5218class Qc { 5219 constructor(e) { 5220 this._options = e, this._requestMessageId = 0, this._requestHandlers = /* @__PURE__ */ new Map(), this._requestHandlerAbortControllers = /* @__PURE__ */ new Map(), this._notificationHandlers = /* @__PURE__ */ new Map(), this._responseHandlers = /* @__PURE__ */ new Map(), this._progressHandlers = /* @__PURE__ */ new Map(), this._timeoutInfo = /* @__PURE__ */ new Map(), this._pendingDebouncedNotifications = /* @__PURE__ */ new Set(), this.setNotificationHandler(Gs, (r) => { 5221 const a = this._requestHandlerAbortControllers.get(r.params.requestId); 5222 a == null || a.abort(r.params.reason); 5223 }), this.setNotificationHandler(Xs, (r) => { 5224 this._onprogress(r); 5225 }), this.setRequestHandler( 5226 Ys, 5227 // Automatic pong by default. 5228 (r) => ({}) 5229 ); 5230 } 5231 _setupTimeout(e, r, a, t, n = !1) { 5232 this._timeoutInfo.set(e, { 5233 timeoutId: setTimeout(t, r), 5234 startTime: Date.now(), 5235 timeout: r, 5236 maxTotalTimeout: a, 5237 resetTimeoutOnProgress: n, 5238 onTimeout: t 5239 }); 5240 } 5241 _resetTimeout(e) { 5242 const r = this._timeoutInfo.get(e); 5243 if (!r) 5244 return !1; 5245 const a = Date.now() - r.startTime; 5246 if (r.maxTotalTimeout && a >= r.maxTotalTimeout) 5247 throw this._timeoutInfo.delete(e), new Ve(qe.RequestTimeout, "Maximum total timeout exceeded", { maxTotalTimeout: r.maxTotalTimeout, totalElapsed: a }); 5248 return clearTimeout(r.timeoutId), r.timeoutId = setTimeout(r.onTimeout, r.timeout), !0; 5249 } 5250 _cleanupTimeout(e) { 5251 const r = this._timeoutInfo.get(e); 5252 r && (clearTimeout(r.timeoutId), this._timeoutInfo.delete(e)); 5253 } 5254 /** 5255 * Attaches to the given transport, starts it, and starts listening for messages. 5256 * 5257 * The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward. 5258 */ 5259 async connect(e) { 5260 var r, a, t; 5261 this._transport = e; 5262 const n = (r = this.transport) === null || r === void 0 ? void 0 : r.onclose; 5263 this._transport.onclose = () => { 5264 n == null || n(), this._onclose(); 5265 }; 5266 const i = (a = this.transport) === null || a === void 0 ? void 0 : a.onerror; 5267 this._transport.onerror = (u) => { 5268 i == null || i(u), this._onerror(u); 5269 }; 5270 const o = (t = this._transport) === null || t === void 0 ? void 0 : t.onmessage; 5271 this._transport.onmessage = (u, l) => { 5272 o == null || o(u, l), zn(u) || ac(u) ? this._onresponse(u) : tc(u) ? this._onrequest(u, l) : rc(u) ? this._onnotification(u) : this._onerror(new Error(`Unknown message type: ${JSON.stringify(u)}`)); 5273 }, await this._transport.start(); 5274 } 5275 _onclose() { 5276 var e; 5277 const r = this._responseHandlers; 5278 this._responseHandlers = /* @__PURE__ */ new Map(), this._progressHandlers.clear(), this._pendingDebouncedNotifications.clear(), this._transport = void 0, (e = this.onclose) === null || e === void 0 || e.call(this); 5279 const a = new Ve(qe.ConnectionClosed, "Connection closed"); 5280 for (const t of r.values()) 5281 t(a); 5282 } 5283 _onerror(e) { 5284 var r; 5285 (r = this.onerror) === null || r === void 0 || r.call(this, e); 5286 } 5287 _onnotification(e) { 5288 var r; 5289 const a = (r = this._notificationHandlers.get(e.method)) !== null && r !== void 0 ? r : this.fallbackNotificationHandler; 5290 a !== void 0 && Promise.resolve().then(() => a(e)).catch((t) => this._onerror(new Error(`Uncaught error in notification handler: ${t}`))); 5291 } 5292 _onrequest(e, r) { 5293 var a, t; 5294 const n = (a = this._requestHandlers.get(e.method)) !== null && a !== void 0 ? a : this.fallbackRequestHandler, i = this._transport; 5295 if (n === void 0) { 5296 i == null || i.send({ 5297 jsonrpc: "2.0", 5298 id: e.id, 5299 error: { 5300 code: qe.MethodNotFound, 5301 message: "Method not found" 5302 } 5303 }).catch((l) => this._onerror(new Error(`Failed to send an error response: ${l}`))); 5304 return; 5305 } 5306 const o = new AbortController(); 5307 this._requestHandlerAbortControllers.set(e.id, o); 5308 const u = { 5309 signal: o.signal, 5310 sessionId: i == null ? void 0 : i.sessionId, 5311 _meta: (t = e.params) === null || t === void 0 ? void 0 : t._meta, 5312 sendNotification: (l) => this.notification(l, { relatedRequestId: e.id }), 5313 sendRequest: (l, h, m) => this.request(l, h, { ...m, relatedRequestId: e.id }), 5314 authInfo: r == null ? void 0 : r.authInfo, 5315 requestId: e.id, 5316 requestInfo: r == null ? void 0 : r.requestInfo 5317 }; 5318 Promise.resolve().then(() => n(e, u)).then((l) => { 5319 if (!o.signal.aborted) 5320 return i == null ? void 0 : i.send({ 5321 result: l, 5322 jsonrpc: "2.0", 5323 id: e.id 5324 }); 5325 }, (l) => { 5326 var h; 5327 if (!o.signal.aborted) 5328 return i == null ? void 0 : i.send({ 5329 jsonrpc: "2.0", 5330 id: e.id, 5331 error: { 5332 code: Number.isSafeInteger(l.code) ? l.code : qe.InternalError, 5333 message: (h = l.message) !== null && h !== void 0 ? h : "Internal error" 5334 } 5335 }); 5336 }).catch((l) =>
5336 this._onerror(new Error(`Failed to send response: ${l}`))).finally(() => { 5337 this._requestHandlerAbortControllers.delete(e.id); 5338 }); 5339 } 5340 _onprogress(e) { 5341 const { progressToken: r, ...a } = e.params, t = Number(r), n = this._progressHandlers.get(t); 5342 if (!n) { 5343 this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`)); 5344 return; 5345 } 5346 const i = this._responseHandlers.get(t), o = this._timeoutInfo.get(t); 5347 if (o && i && o.resetTimeoutOnProgress) 5348 try { 5349 this._resetTimeout(t); 5350 } catch (u) { 5351 i(u); 5352 return; 5353 } 5354 n(a); 5355 } 5356 _onresponse(e) { 5357 const r = Number(e.id), a = this._responseHandlers.get(r); 5358 if (a === void 0) { 5359 this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`)); 5360 return; 5361 } 5362 if (this._responseHandlers.delete(r), this._progressHandlers.delete(r), this._cleanupTimeout(r), zn(e)) 5363 a(e); 5364 else { 5365 const t = new Ve(e.error.code, e.error.message, e.error.data); 5366 a(t); 5367 } 5368 } 5369 get transport() { 5370 return this._transport; 5371 } 5372 /** 5373 * Closes the connection. 5374 */ 5375 async close() { 5376 var e; 5377 await ((e = this._transport) === null || e === void 0 ? void 0 : e.close()); 5378 } 5379 /** 5380 * Sends a request and wait for a response. 5381 * 5382 * Do not use this method to emit notifications! Use notification() instead. 5383 */ 5384 request(e, r, a) { 5385 const { relatedRequestId: t, resumptionToken: n, onresumptiontoken: i } = a ?? {}; 5386 return new Promise((o, u) => { 5387 var l, h, m, _, c, f; 5388 if (!this._transport) { 5389 u(new Error("Not connected")); 5390 return; 5391 } 5392 ((l = this._options) === null || l === void 0 ? void 0 : l.enforceStrictCapabilities) === !0 && this.assertCapabilityForMethod(e.method), (h = a == null ? void 0 : a.signal) === null || h === void 0 || h.throwIfAborted(); 5393 const y = this._requestMessageId++, v = { 5394 ...e, 5395 jsonrpc: "2.0", 5396 id: y 5397 }; 5398 a != null && a.onprogress && (this._progressHandlers.set(y, a.onprogress), v.params = { 5399 ...e.params, 5400 _meta: { 5401 ...((m = e.params) === null || m === void 0 ? void 0 : m._meta) || {}, 5402 progressToken: y 5403 } 5404 }); 5405 const P = (b) => { 5406 var x; 5407 this._responseHandlers.delete(y), this._progressHandlers.delete(y), this._cleanupTimeout(y), (x = this._transport) === null || x === void 0 || x.send({ 5408 jsonrpc: "2.0", 5409 method: "notifications/cancelled", 5410 params: { 5411 requestId: y, 5412 reason: String(b) 5413 } 5414 }, { relatedRequestId: t, resumptionToken: n, onresumptiontoken: i }).catch((T) => this._onerror(new Error(`Failed to send cancellation: ${T}`))), u(b); 5415 }; 5416 this._responseHandlers.set(y, (b) => { 5417 var x; 5418 if (!(!((x = a == null ? void 0 : a.signal) === null || x === void 0) && x.aborted)) { 5419 if (b instanceof Error) 5420 return u(b); 5421 try { 5422 const T = r.parse(b.result); 5423 o(T); 5424 } catch (T) { 5425 u(T); 5426 } 5427 } 5428 }), (_ = a == null ? void 0 : a.signal) === null || _ === void 0 || _.addEventListener("abort", () => { 5429 var b; 5430 P((b = a == null ? void 0 : a.signal) === null || b === void 0 ? void 0 : b.reason); 5431 }); 5432 const I = (c = a == null ? void 0 : a.timeout) !== null && c !== void 0 ? c : Bc, A = () => P(new Ve(qe.RequestTimeout, "Request timed out", { timeout: I })); 5433 this._setupTimeout(y, I, a == null ? void 0 : a.maxTotalTimeout, A, (f = a == null ? void 0 : a.resetTimeoutOnProgress) !== null && f !== void 0 ? f : !1), this._transport.send(v, { relatedRequestId: t, resumptionToken: n, onresumptiontoken: i }).catch((b) => { 5434 this._cleanupTimeout(y), u(b); 5435 }); 5436 }); 5437 } 5438 /** 5439 * Emits a notification, which is a one-way message that does not expect a response. 5440 */ 5441 async notification(e, r) { 5442 var a, t; 5443 if (!this._transport) 5444 throw new Error("Not connected"); 5445 if (this.assertNotificationCapability(e.method), ((t = (a = this._options) === null || a === void 0 ? void 0 : a.debouncedNotificationMethods) !== null && t !== void 0 ? t : []).includes(e.method) && !e.params && !(r != null && r.relatedRequestId)) {
5446 if (this._pendingDebouncedNotifications.has(e.method)) 5447 return; 5448 this._pendingDebouncedNotifications.add(e.method), Promise.resolve().then(() => { 5449 var u; 5450 if (this._pendingDebouncedNotifications.delete(e.method), !this._transport) 5451 return; 5452 const l = { 5453 ...e, 5454 jsonrpc: "2.0" 5455 }; 5456 (u = this._transport) === null || u === void 0 || u.send(l, r).catch((h) => this._onerror(h)); 5457 }); 5458 return; 5459 } 5460 const o = { 5461 ...e, 5462 jsonrpc: "2.0" 5463 }; 5464 await this._transport.send(o, r); 5465 } 5466 /** 5467 * Registers a handler to invoke when this protocol object receives a request with the given method. 5468 * 5469 * Note that this will replace any previous request handler for the same method. 5470 */ 5471 setRequestHandler(e, r) { 5472 const a = e.shape.method.value; 5473 this.assertRequestHandlerCapability(a), this._requestHandlers.set(a, (t, n) => Promise.resolve(r(e.parse(t), n))); 5474 } 5475 /** 5476 * Removes the request handler for the given method. 5477 */ 5478 removeRequestHandler(e) { 5479 this._requestHandlers.delete(e); 5480 } 5481 /** 5482 * Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed. 5483 */ 5484 assertCanSetRequestHandler(e) { 5485 if (this._requestHandlers.has(e)) 5486 throw new Error(`A request handler for ${e} already exists, which would be overridden`); 5487 } 5488 /** 5489 * Registers a handler to invoke when this protocol object receives a notification with the given method. 5490 * 5491 * Note that this will replace any previous notification handler for the same method. 5492 */ 5493 setNotificationHandler(e, r) { 5494 this._notificationHandlers.set(e.shape.method.value, (a) => Promise.resolve(r(e.parse(a)))); 5495 } 5496 /** 5497 * Removes the notification handler for the given method. 5498 */ 5499 removeNotificationHandler(e) { 5500 this._notificationHandlers.delete(e); 5501 } 5502} 5503function Kc(s, e) { 5504 return Object.entries(e).reduce((r, [a, t]) => (t && typeof t == "object" ? r[a] = r[a] ? { ...r[a], ...t } : t : r[a] = t, r), { ...s }); 5505} 5506function Jc(s) { 5507 return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s; 5508} 5509var xr = { exports: {} }; 5510/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ 5511var Wc = xr.exports, Un; 5512function Gc() { 5513 return Un || (Un = 1, function(s, e) { 5514 (function(r, a) { 5515 a(e); 5516 })(Wc, function(r) { 5517 function a() { 5518 for (var p = arguments.length, d = Array(p), g = 0; g < p; g++) 5519 d[g] = arguments[g]; 5520 if (d.length > 1) { 5521 d[0] = d[0].slice(0, -1); 5522 for (var k = d.length - 1, R = 1; R < k; ++R) 5523 d[R] = d[R].slice(1, -1); 5524 return d[k] = d[k].slice(1), d.join(""); 5525 } else 5526 return d[0]; 5527 } 5528 function t(p) { 5529 return "(?:" + p + ")"; 5530 } 5531 function n(p) { 5532 return p === void 0 ? "undefined" : p === null ? "null" : Object.prototype.toString.call(p).split(" ").pop().split("]").shift().toLowerCase(); 5533 } 5534 function i(p) { 5535 return p.toUpperCase(); 5536 } 5537 function o(p) { 5538 return p != null ? p instanceof Array ? p : typeof p.length != "number" || p.split || p.setInterval || p.call ? [p] : Array.prototype.slice.call(p) : []; 5539 } 5540 function u(p, d) { 5541 var g = p; 5542 if (d) 5543 for (var k in d) 5544 g[k] = d[k]; 5545 return g; 5546 } 5547 function l(p) { 5548 var d = "[A-Za-z]", g = "[0-9]", k = a(g, "[A-Fa-f]"), R = t(t("%[EFef]" + k + "%" + k + k + "%" + k + k) + "|" + t("%[89A-Fa-f]" + k + "%" + k + k) + "|" + t("%" + k + k)), ae = "[\\:\\/\\?\\#\\[\\]\\@]", se = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", Ee = a(ae, se), Ie = p ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", ze = p ? "[\\uE000-\\uF8FF]" : "[]", we = a(d, g, "[\\-\\.\\_\\~]", Ie); 5549 t(d + a(d, g, "[\\+\\-\\.]") + "*"), t(t(R + "|" + a(we, se, "[\\:]")) + "*"); 5550 var $e = t(t("25[0-5]") + "|" + t("2[0-4]" + g) + "|" + t("1" + g + g) + "|" + t("0?[1-9]" + g) + "|0?0?" + g), Ue = t($e + "\\." + $e + "\\." + $e + "\\." + $e), he = t(k + "{1,4}"), De = t(t(he + "\\:" + he) + "|" + Ue), He = t(t(he + "\\:") + "{6}" + De), je = t("\\:\\:" + t(he + "\\:") + "{5}" + De), Qt = t(t(he) + "?\\:\\:" + t(he + "\\:") + "{4}" + De), kt = t(t(t(he + "\\:") + "{0,1}" + he) + "?\\:\\:" + t(he + "\\:") + "{3}" + De), Tt = t(t(t(he + "\\:") + "{0,2}" + he) + "?\\:\\:" + t(he + "\\:") + "{2}" + De), cr = t(t(t(he + "\\:") + "{0,3}" + he) + "?\\:\\:" + he + "\\:" + De), Xt = t(t(t(he + "\\:") + "{0,4}" + he) + "?\\:\\:" + De), vt = t(t(t(he + "\\:") + "{0,5}" + he) + "?\\:\\:" + he), At = t(t(t(he + "\\:") + "{0,6}" + he) + "?\\:\\:"), er = t([He, je, Qt, kt, Tt, cr, Xt, vt, At].join("|")), qt = t(t(we + "|" + R) + "+"); 5551 t("[vV]" + k + "+\\." + a(we, se, "[\\:]") + "+"), t(t(R + "|" + a(we, se)) + "*"); 5552 var Pr = t(R + "|" + a(we, se, "[\\:\\@]"));
5553 return t(t(R + "|" + a(we, se, "[\\@]")) + "+"), t(t(Pr + "|" + a("[\\/\\?]", ze)) + "*"), { 5554 NOT_SCHEME: new RegExp(a("[^]", d, g, "[\\+\\-\\.]"), "g"), 5555 NOT_USERINFO: new RegExp(a("[^\\%\\:]", we, se), "g"), 5556 NOT_HOST: new RegExp(a("[^\\%\\[\\]\\:]", we, se), "g"), 5557 NOT_PATH: new RegExp(a("[^\\%\\/\\:\\@]", we, se), "g"), 5558 NOT_PATH_NOSCHEME: new RegExp(a("[^\\%\\/\\@]", we, se), "g"), 5559 NOT_QUERY: new RegExp(a("[^\\%]", we, se, "[\\:\\@\\/\\?]", ze), "g"), 5560 NOT_FRAGMENT: new RegExp(a("[^\\%]", we, se, "[\\:\\@\\/\\?]"), "g"), 5561 ESCAPE: new RegExp(a("[^]", we, se), "g"), 5562 UNRESERVED: new RegExp(we, "g"), 5563 OTHER_CHARS: new RegExp(a("[^\\%]", we, Ee), "g"), 5564 PCT_ENCODED: new RegExp(R, "g"), 5565 IPV4ADDRESS: new RegExp("^(" + Ue + ")$"), 5566 IPV6ADDRESS: new RegExp("^\\[?(" + er + ")" + t(t("\\%25|\\%(?!" + k + "{2})") + "(" + qt + ")") + "?\\]?$") 5567 //RFC 6874, with relaxed parsing rules 5568 }; 5569 } 5570 var h = l(!1), m = l(!0), _ = /* @__PURE__ */ function() { 5571 function p(d, g) { 5572 var k = [], R = !0, ae = !1, se = void 0; 5573 try { 5574 for (var Ee = d[Symbol.iterator](), Ie; !(R = (Ie = Ee.next()).done) && (k.push(Ie.value), !(g && k.length === g)); R = !0) 5575 ; 5576 } catch (ze) { 5577 ae = !0, se = ze; 5578 } finally { 5579 try { 5580 !R && Ee.return && Ee.return(); 5581 } finally { 5582 if (ae) throw se; 5583 } 5584 } 5585 return k; 5586 } 5587 return function(d, g) { 5588 if (Array.isArray(d)) 5589 return d; 5590 if (Symbol.iterator in Object(d)) 5591 return p(d, g); 5592 throw new TypeError("Invalid attempt to destructure non-iterable instance"); 5593 }; 5594 }(), c = function(p) { 5595 if (Array.isArray(p)) { 5596 for (var d = 0, g = Array(p.length); d < p.length; d++) g[d] = p[d]; 5597 return g; 5598 } else 5599 return Array.from(p); 5600 }, f = 2147483647, y = 36, v = 1, P = 26, I = 38, A = 700, b = 72, x = 128, T = "-", O = /^xn--/, C = /[^\0-\x7E]/, $ = /[\x2E\u3002\uFF0E\uFF61]/g, S = { 5601 overflow: "Overflow: input needs wider integers to process", 5602 "not-basic": "Illegal input >= 0x80 (not a basic code point)", 5603 "invalid-input": "Invalid input" 5604 }, E = y - v, N = Math.floor, L = String.fromCharCode; 5605 function Z(p) { 5606 throw new RangeError(S[p]); 5607 } 5608 function re(p, d) { 5609 for (var g = [], k = p.length; k--; ) 5610 g[k] = d(p[k]); 5611 return g; 5612 } 5613 function fe(p, d) { 5614 var g = p.split("@"), k = ""; 5615 g.length > 1 && (k = g[0] + "@", p = g[1]), p = p.replace($, "."); 5616 var R = p.split("."), ae = re(R, d).join("."); 5617 return k + ae; 5618 } 5619 function ne(p) { 5620 for (var d = [], g = 0, k = p.length; g < k; ) { 5621 var R = p.charCodeAt(g++); 5622 if (R >= 55296 && R <= 56319 && g < k) { 5623 var ae = p.charCodeAt(g++); 5624 (ae & 64512) == 56320 ? d.push(((R & 1023) << 10) + (ae & 1023) + 65536) : (d.push(R), g--); 5625 } else 5626 d.push(R); 5627 } 5628 return d; 5629 } 5630 var _e = function(d) { 5631 return String.fromCodePoint.apply(String, c(d)); 5632 }, ce = function(d) { 5633 return d - 48 < 10 ? d - 22 : d - 65 < 26 ? d - 65 : d - 97 < 26 ? d - 97 : y; 5634 }, de = function(d, g) { 5635 return d + 22 + 75 * (d < 26) - ((g != 0) << 5); 5636 }, tt = function(d, g, k) { 5637 var R = 0; 5638 for ( 5639 d = k ? N(d / A) : d >> 1, d += N(d / g); 5640 /* no initialization */ 5641 d > E * P >> 1; 5642 R += y 5643 ) 5644 d = N(d / E); 5645 return N(R + (E + 1) * d / (d + I)); 5646 }, Ge = function(d) { 5647 var g = [], k = d.length, R = 0, ae = x, se = b, Ee = d.lastIndexOf(T); 5648 Ee < 0 && (Ee = 0); 5649 for (var Ie = 0; Ie < Ee; ++Ie) 5650 d.charCodeAt(Ie) >= 128 && Z("not-basic"), g.push(d.charCodeAt(Ie)); 5651 for (var ze = Ee > 0 ? Ee + 1 : 0; ze < k; ) { 5652 for ( 5653 var we = R, $e = 1, Ue = y; 5654 ; 5655 /* no condition */ 5656 Ue += y 5657 ) { 5658 ze >= k && Z("invalid-input");
5659 var he = ce(d.charCodeAt(ze++)); 5660 (he >= y || he > N((f - R) / $e)) && Z("overflow"), R += he * $e; 5661 var De = Ue <= se ? v : Ue >= se + P ? P : Ue - se; 5662 if (he < De) 5663 break; 5664 var He = y - De; 5665 $e > N(f / He) && Z("overflow"), $e *= He; 5666 } 5667 var je = g.length + 1; 5668 se = tt(R - we, je, we == 0), N(R / je) > f - ae && Z("overflow"), ae += N(R / je), R %= je, g.splice(R++, 0, ae); 5669 } 5670 return String.fromCodePoint.apply(String, g); 5671 }, Je = function(d) { 5672 var g = []; 5673 d = ne(d); 5674 var k = d.length, R = x, ae = 0, se = b, Ee = !0, Ie = !1, ze = void 0; 5675 try { 5676 for (var we = d[Symbol.iterator](), $e; !(Ee = ($e = we.next()).done); Ee = !0) { 5677 var Ue = $e.value; 5678 Ue < 128 && g.push(L(Ue)); 5679 } 5680 } catch (Sr) { 5681 Ie = !0, ze = Sr; 5682 } finally { 5683 try { 5684 !Ee && we.return && we.return(); 5685 } finally { 5686 if (Ie) 5687 throw ze; 5688 } 5689 } 5690 var he = g.length, De = he; 5691 for (he && g.push(T); De < k; ) { 5692 var He = f, je = !0, Qt = !1, kt = void 0; 5693 try { 5694 for (var Tt = d[Symbol.iterator](), cr; !(je = (cr = Tt.next()).done); je = !0) { 5695 var Xt = cr.value; 5696 Xt >= R && Xt < He && (He = Xt); 5697 } 5698 } catch (Sr) { 5699 Qt = !0, kt = Sr; 5700 } finally { 5701 try { 5702 !je && Tt.return && Tt.return(); 5703 } finally { 5704 if (Qt) 5705 throw kt; 5706 } 5707 } 5708 var vt = De + 1; 5709 He - R > N((f - ae) / vt) && Z("overflow"), ae += (He - R) * vt, R = He; 5710 var At = !0, er = !1, qt = void 0; 5711 try { 5712 for (var Pr = d[Symbol.iterator](), vn; !(At = (vn = Pr.next()).done); At = !0) { 5713 var gn = vn.value; 5714 if (gn < R && ++ae > f && Z("overflow"), gn == R) { 5715 for ( 5716 var qr = ae, Lr = y; 5717 ; 5718 /* no condition */ 5719 Lr += y 5720 ) { 5721 var Zr = Lr <= se ? v : Lr >= se + P ? P : Lr - se; 5722 if (qr < Zr) 5723 break; 5724 var yn = qr - Zr, _n = y - Zr; 5725 g.push(L(de(Zr + yn % _n, 0))), qr = N(yn / _n); 5726 } 5727 g.push(L(de(qr, 0))), se = tt(ae, vt, De == he), ae = 0, ++De; 5728 } 5729 } 5730 } catch (Sr) { 5731 er = !0, qt = Sr; 5732 } finally { 5733 try { 5734 !At && Pr.return && Pr.return(); 5735 } finally { 5736 if (er) 5737 throw qt; 5738 } 5739 } 5740 ++ae, ++R; 5741 } 5742 return g.join(""); 5743 }, Ze = function(d) { 5744 return fe(d, function(g) { 5745 return O.test(g) ? Ge(g.slice(4).toLowerCase()) : g; 5746 }); 5747 }, mt = function(d) { 5748 return fe(d, function(g) { 5749 return C.test(g) ? "xn--" + Je(g) : g; 5750 }); 5751 }, w = { 5752 /** 5753 * A string representing the current Punycode.js version number. 5754 * @memberOf punycode
5755 * @type String 5756 */ 5757 version: "2.1.0", 5758 /** 5759 * An object of methods to convert from JavaScript's internal character 5760 * representation (UCS-2) to Unicode code points, and back. 5761 * @see <https://mathiasbynens.be/notes/javascript-encoding> 5762 * @memberOf punycode 5763 * @type Object 5764 */ 5765 ucs2: { 5766 decode: ne, 5767 encode: _e 5768 }, 5769 decode: Ge, 5770 encode: Je, 5771 toASCII: mt, 5772 toUnicode: Ze 5773 }, D = {}; 5774 function B(p) { 5775 var d = p.charCodeAt(0), g = void 0; 5776 return d < 16 ? g = "%0" + d.toString(16).toUpperCase() : d < 128 ? g = "%" + d.toString(16).toUpperCase() : d < 2048 ? g = "%" + (d >> 6 | 192).toString(16).toUpperCase() + "%" + (d & 63 | 128).toString(16).toUpperCase() : g = "%" + (d >> 12 | 224).toString(16).toUpperCase() + "%" + (d >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (d & 63 | 128).toString(16).toUpperCase(), g; 5777 } 5778 function le(p) { 5779 for (var d = "", g = 0, k = p.length; g < k; ) { 5780 var R = parseInt(p.substr(g + 1, 2), 16); 5781 if (R < 128) 5782 d += String.fromCharCode(R), g += 3; 5783 else if (R >= 194 && R < 224) { 5784 if (k - g >= 6) { 5785 var ae = parseInt(p.substr(g + 4, 2), 16); 5786 d += String.fromCharCode((R & 31) << 6 | ae & 63); 5787 } else 5788 d += p.substr(g, 6); 5789 g += 6; 5790 } else if (R >= 224) { 5791 if (k - g >= 9) { 5792 var se = parseInt(p.substr(g + 4, 2), 16), Ee = parseInt(p.substr(g + 7, 2), 16); 5793 d += String.fromCharCode((R & 15) << 12 | (se & 63) << 6 | Ee & 63); 5794 } else 5795 d += p.substr(g, 9); 5796 g += 9; 5797 } else 5798 d += p.substr(g, 3), g += 3; 5799 } 5800 return d; 5801 } 5802 function j(p, d) { 5803 function g(k) { 5804 var R = le(k); 5805 return R.match(d.UNRESERVED) ? R : k; 5806 } 5807 return p.scheme && (p.scheme = String(p.scheme).replace(d.PCT_ENCODED, g).toLowerCase().replace(d.NOT_SCHEME, "")), p.userinfo !== void 0 && (p.userinfo = String(p.userinfo).replace(d.PCT_ENCODED, g).replace(d.NOT_USERINFO, B).replace(d.PCT_ENCODED, i)), p.host !== void 0 && (p.host = String(p.host).replace(d.PCT_ENCODED, g).toLowerCase().replace(d.NOT_HOST, B).replace(d.PCT_ENCODED, i)), p.path !== void 0 && (p.path = String(p.path).replace(d.PCT_ENCODED, g).replace(p.scheme ? d.NOT_PATH : d.NOT_PATH_NOSCHEME, B).replace(d.PCT_ENCODED, i)), p.query !== void 0 && (p.query = String(p.query).replace(d.PCT_ENCODED, g).replace(d.NOT_QUERY, B).replace(d.PCT_ENCODED, i)), p.fragment !== void 0 && (p.fragment = String(p.fragment).replace(d.PCT_ENCODED, g).replace(d.NOT_FRAGMENT, B).replace(d.PCT_ENCODED, i)), p; 5808 } 5809 function V(p) { 5810 return p.replace(/^0*(.*)/, "$1") || "0"; 5811 } 5812 function ve(p, d) { 5813 var g = p.match(d.IPV4ADDRESS) || [], k = _(g, 2), R = k[1]; 5814 return R ? R.split(".").map(V).join(".") : p; 5815 } 5816 function Se(p, d) { 5817 var g = p.match(d.IPV6ADDRESS) || [], k = _(g, 3), R = k[1], ae = k[2]; 5818 if (R) { 5819 for (var se = R.toLowerCase().split("::").reverse(), Ee = _(se, 2), Ie = Ee[0], ze = Ee[1], we = ze ? ze.split(":").map(V) : [], $e = Ie.split(":").map(V), Ue = d.IPV4ADDRESS.test($e[$e.length - 1]), he = Ue ? 7 : 8, De = $e.length - he, He = Array(he), je = 0; je < he; ++je) 5820 He[je] = we[je] || $e[De + je] || ""; 5821 Ue && (He[he - 1] = ve(He[he - 1], d)); 5822 var Qt = He.reduce(function(vt, At, er) { 5823 if (!At || At === "0") { 5824 var qt = vt[vt.length - 1]; 5825 qt && qt.index + qt.length === er ? qt.length++ : vt.push({ index: er, length: 1 }); 5826 } 5827 return vt; 5828 }, []), kt = Qt.sort(function(vt, At) { 5829 return At.length - vt.length; 5830 })[0], Tt = void 0; 5831 if (kt && kt.length > 1) { 5832 var cr = He.slice(0, kt.index), Xt = He.slice(kt.index + kt.length); 5833 Tt = cr.join(":") + "::" + Xt.join(":"); 5834 } else 5835 Tt = He.join(":"); 5836 return ae && (Tt += "%" + ae), Tt; 5837 } else 5838 return p; 5839 } 5840 var be = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, Ne = "".match(/(){0}
5840/)[1] === void 0; 5841 function Te(p) { 5842 var d = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, g = {}, k = d.iri !== !1 ? m : h; 5843 d.reference === "suffix" && (p = (d.scheme ? d.scheme + ":" : "") + "//" + p); 5844 var R = p.match(be); 5845 if (R) { 5846 Ne ? (g.scheme = R[1], g.userinfo = R[3], g.host = R[4], g.port = parseInt(R[5], 10), g.path = R[6] || "", g.query = R[7], g.fragment = R[8], isNaN(g.port) && (g.port = R[5])) : (g.scheme = R[1] || void 0, g.userinfo = p.indexOf("@") !== -1 ? R[3] : void 0, g.host = p.indexOf("//") !== -1 ? R[4] : void 0, g.port = parseInt(R[5], 10), g.path = R[6] || "", g.query = p.indexOf("?") !== -1 ? R[7] : void 0, g.fragment = p.indexOf("#") !== -1 ? R[8] : void 0, isNaN(g.port) && (g.port = p.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? R[4] : void 0)), g.host && (g.host = Se(ve(g.host, k), k)), g.scheme === void 0 && g.userinfo === void 0 && g.host === void 0 && g.port === void 0 && !g.path && g.query === void 0 ? g.reference = "same-document" : g.scheme === void 0 ? g.reference = "relative" : g.fragment === void 0 ? g.reference = "absolute" : g.reference = "uri", d.reference && d.reference !== "suffix" && d.reference !== g.reference && (g.error = g.error || "URI is not a " + d.reference + " reference."); 5847 var ae = D[(d.scheme || g.scheme || "").toLowerCase()]; 5848 if (!d.unicodeSupport && (!ae || !ae.unicodeSupport)) { 5849 if (g.host && (d.domainHost || ae && ae.domainHost)) 5850 try { 5851 g.host = w.toASCII(g.host.replace(k.PCT_ENCODED, le).toLowerCase()); 5852 } catch (se) { 5853 g.error = g.error || "Host's domain name can not be converted to ASCII via punycode: " + se; 5854 } 5855 j(g, h); 5856 } else 5857 j(g, k); 5858 ae && ae.parse && ae.parse(g, d); 5859 } else 5860 g.error = g.error || "URI can not be parsed."; 5861 return g; 5862 } 5863 function Ae(p, d) { 5864 var g = d.iri !== !1 ? m : h, k = []; 5865 return p.userinfo !== void 0 && (k.push(p.userinfo), k.push("@")), p.host !== void 0 && k.push(Se(ve(String(p.host), g), g).replace(g.IPV6ADDRESS, function(R, ae, se) { 5866 return "[" + ae + (se ? "%25" + se : "") + "]"; 5867 })), (typeof p.port == "number" || typeof p.port == "string") && (k.push(":"), k.push(String(p.port))), k.length ? k.join("") : void 0; 5868 } 5869 var Ye = /^\.\.?\//, Fe = /^\/\.(\/|$)/, wt = /^\/\.\.(\/|$)/, rt = /^\/?(?:.|\n)*?(?=\/|$)/; 5870 function Le(p) { 5871 for (var d = []; p.length; ) 5872 if (p.match(Ye)) 5873 p = p.replace(Ye, ""); 5874 else if (p.match(Fe)) 5875 p = p.replace(Fe, "/"); 5876 else if (p.match(wt)) 5877 p = p.replace(wt, "/"), d.pop(); 5878 else if (p === "." || p === "..") 5879 p = ""; 5880 else { 5881 var g = p.match(rt); 5882 if (g) { 5883 var k = g[0]; 5884 p = p.slice(k.length), d.push(k); 5885 } else 5886 throw new Error("Unexpected dot segment condition"); 5887 } 5888 return d.join(""); 5889 } 5890 function Me(p) { 5891 var d = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, g = d.iri ? m : h, k = [], R = D[(d.scheme || p.scheme || "").toLowerCase()]; 5892 if (R && R.serialize && R.serialize(p, d), p.host && !g.IPV6ADDRESS.test(p.host)) { 5893 if (d.domainHost || R && R.domainHost) 5894 try { 5895 p.host = d.iri ? w.toUnicode(p.host) : w.toASCII(p.host.replace(g.PCT_ENCODED, le).toLowerCase()); 5896 } catch (Ee) { 5897 p.error = p.error || "Host's domain name can not be converted to " + (d.iri ? "Unicode" : "ASCII") + " via punycode: " + Ee; 5898 } 5899 } 5900 j(p, g), d.reference !== "suffix" && p.scheme && (k.push(p.scheme), k.push(":")); 5901 var ae = Ae(p, d); 5902 if (ae !== void 0 && (d.reference !== "suffix" && k.push("//"), k.push(ae), p.path && p.path.charAt(0) !== "/" && k.push("/")), p.path !== void 0) { 5903 var se = p.path; 5904 !d.absolutePath && (!R || !R.absolutePath) && (se = Le(se)), ae === void 0 && (se = se.replace(/^\/\//, "/%2F")), k.push(se); 5905 } 5906 return p.query !== void 0 && (k.push("?"), k.push(p.query
5906)), p.fragment !== void 0 && (k.push("#"), k.push(p.fragment)), k.join(""); 5907 } 5908 function lt(p, d) { 5909 var g = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, k = arguments[3], R = {}; 5910 return k || (p = Te(Me(p, g), g), d = Te(Me(d, g), g)), g = g || {}, !g.tolerant && d.scheme ? (R.scheme = d.scheme, R.userinfo = d.userinfo, R.host = d.host, R.port = d.port, R.path = Le(d.path || ""), R.query = d.query) : (d.userinfo !== void 0 || d.host !== void 0 || d.port !== void 0 ? (R.userinfo = d.userinfo, R.host = d.host, R.port = d.port, R.path = Le(d.path || ""), R.query = d.query) : (d.path ? (d.path.charAt(0) === "/" ? R.path = Le(d.path) : ((p.userinfo !== void 0 || p.host !== void 0 || p.port !== void 0) && !p.path ? R.path = "/" + d.path : p.path ? R.path = p.path.slice(0, p.path.lastIndexOf("/") + 1) + d.path : R.path = d.path, R.path = Le(R.path)), R.query = d.query) : (R.path = p.path, d.query !== void 0 ? R.query = d.query : R.query = p.query), R.userinfo = p.userinfo, R.host = p.host, R.port = p.port), R.scheme = p.scheme), R.fragment = d.fragment, R; 5911 } 5912 function Fr(p, d, g) { 5913 var k = u({ scheme: "null" }, g); 5914 return Me(lt(Te(p, k), Te(d, k), k, !0), k); 5915 } 5916 function va(p, d) { 5917 return typeof p == "string" ? p = Me(Te(p, d), d) : n(p) === "object" && (p = Te(Me(p, d), d)), p; 5918 } 5919 function ga(p, d, g) { 5920 return typeof p == "string" ? p = Me(Te(p, g), g) : n(p) === "object" && (p = Me(p, g)), typeof d == "string" ? d = Me(Te(d, g), g) : n(d) === "object" && (d = Me(d, g)), p === d; 5921 } 5922 function Zo(p, d) { 5923 return p && p.toString().replace(!d || !d.iri ? h.ESCAPE : m.ESCAPE, B); 5924 } 5925 function Ft(p, d) { 5926 return p && p.toString().replace(!d || !d.iri ? h.PCT_ENCODED : m.PCT_ENCODED, le); 5927 } 5928 var _r = { 5929 scheme: "http", 5930 domainHost: !0, 5931 parse: function(d, g) { 5932 return d.host || (d.error = d.error || "HTTP URIs must have a host."), d; 5933 }, 5934 serialize: function(d, g) { 5935 var k = String(d.scheme).toLowerCase() === "https"; 5936 return (d.port === (k ? 443 : 80) || d.port === "") && (d.port = void 0), d.path || (d.path = "/"), d; 5937 } 5938 }, un = { 5939 scheme: "https", 5940 domainHost: _r.domainHost, 5941 parse: _r.parse, 5942 serialize: _r.serialize 5943 }; 5944 function ln(p) { 5945 return typeof p.secure == "boolean" ? p.secure : String(p.scheme).toLowerCase() === "wss"; 5946 } 5947 var br = { 5948 scheme: "ws", 5949 domainHost: !0, 5950 parse: function(d, g) { 5951 var k = d; 5952 return k.secure = ln(k), k.resourceName = (k.path || "/") + (k.query ? "?" + k.query : ""), k.path = void 0, k.query = void 0, k; 5953 }, 5954 serialize: function(d, g) { 5955 if ((d.port === (ln(d) ? 443 : 80) || d.port === "") && (d.port = void 0), typeof d.secure == "boolean" && (d.scheme = d.secure ? "wss" : "ws", d.secure = void 0), d.resourceName) { 5956 var k = d.resourceName.split("?"), R = _(k, 2), ae = R[0], se = R[1]; 5957 d.path = ae && ae !== "/" ? ae : void 0, d.query = se, d.resourceName = void 0; 5958 } 5959 return d.fragment = void 0, d; 5960 } 5961 }, cn = { 5962 scheme: "wss", 5963 domainHost: br.domainHost, 5964 parse: br.parse, 5965 serialize: br.serialize 5966 }, Mo = {}, dn = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", Rt = "[0-9A-Fa-f]", zo = t(t("%[EFef]" + Rt + "%" + Rt + Rt + "%" + Rt + Rt) + "|" + t("%[89A-Fa-f]" + Rt + "%" + Rt + Rt) + "|" + t("%" + Rt + Rt)), Uo = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", Vo = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", Ho = a(Vo, '[\\"\\\\]'), Bo = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", Qo = new RegExp(dn, "g"), lr = new RegExp(zo, "g"), Ko = new RegExp(a("[^]", Uo, "[\\.]", '[\\"]', Ho), "g"), hn = new RegExp(a("[^]", dn, Bo), "g"), Jo = hn; 5967 function ya(p) { 5968 var d = le(p); 5969 return d.match(Qo) ? d : p; 5970 } 5971 var fn = { 5972 scheme: "mailto", 5973 parse: function(d, g) { 5974 var k = d, R = k.to = k.path ? k.path.split(",") : [];
5975 if (k.path = void 0, k.query) { 5976 for (var ae = !1, se = {}, Ee = k.query.split("&"), Ie = 0, ze = Ee.length; Ie < ze; ++Ie) { 5977 var we = Ee[Ie].split("="); 5978 switch (we[0]) { 5979 case "to": 5980 for (var $e = we[1].split(","), Ue = 0, he = $e.length; Ue < he; ++Ue) 5981 R.push($e[Ue]); 5982 break; 5983 case "subject": 5984 k.subject = Ft(we[1], g); 5985 break; 5986 case "body": 5987 k.body = Ft(we[1], g); 5988 break; 5989 default: 5990 ae = !0, se[Ft(we[0], g)] = Ft(we[1], g); 5991 break; 5992 } 5993 } 5994 ae && (k.headers = se); 5995 } 5996 k.query = void 0; 5997 for (var De = 0, He = R.length; De < He; ++De) { 5998 var je = R[De].split("@"); 5999 if (je[0] = Ft(je[0]), g.unicodeSupport) 6000 je[1] = Ft(je[1], g).toLowerCase(); 6001 else 6002 try { 6003 je[1] = w.toASCII(Ft(je[1], g).toLowerCase()); 6004 } catch (Qt) { 6005 k.error = k.error || "Email address's domain name can not be converted to ASCII via punycode: " + Qt; 6006 } 6007 R[De] = je.join("@"); 6008 } 6009 return k; 6010 }, 6011 serialize: function(d, g) { 6012 var k = d, R = o(d.to); 6013 if (R) { 6014 for (var ae = 0, se = R.length; ae < se; ++ae) { 6015 var Ee = String(R[ae]), Ie = Ee.lastIndexOf("@"), ze = Ee.slice(0, Ie).replace(lr, ya).replace(lr, i).replace(Ko, B), we = Ee.slice(Ie + 1); 6016 try { 6017 we = g.iri ? w.toUnicode(we) : w.toASCII(Ft(we, g).toLowerCase()); 6018 } catch (De) { 6019 k.error = k.error || "Email address's domain name can not be converted to " + (g.iri ? "Unicode" : "ASCII") + " via punycode: " + De; 6020 } 6021 R[ae] = ze + "@" + we; 6022 } 6023 k.path = R.join(","); 6024 } 6025 var $e = d.headers = d.headers || {}; 6026 d.subject && ($e.subject = d.subject), d.body && ($e.body = d.body); 6027 var Ue = []; 6028 for (var he in $e) 6029 $e[he] !== Mo[he] && Ue.push(he.replace(lr, ya).replace(lr, i).replace(hn, B) + "=" + $e[he].replace(lr, ya).replace(lr, i).replace(Jo, B)); 6030 return Ue.length && (k.query = Ue.join("&")), k; 6031 } 6032 }, Wo = /^([^\:]+)\:(.*)/, pn = { 6033 scheme: "urn", 6034 parse: function(d, g) { 6035 var k = d.path && d.path.match(Wo), R = d; 6036 if (k) { 6037 var ae = g.scheme || R.scheme || "urn", se = k[1].toLowerCase(), Ee = k[2], Ie = ae + ":" + (g.nid || se), ze = D[Ie]; 6038 R.nid = se, R.nss = Ee, R.path = void 0, ze && (R = ze.parse(R, g)); 6039 } else 6040 R.error = R.error || "URN can not be parsed."; 6041 return R; 6042 }, 6043 serialize: function(d, g) { 6044 var k = g.scheme || d.scheme || "urn", R = d.nid, ae = k + ":" + (g.nid || R), se = D[ae]; 6045 se && (d = se.serialize(d, g)); 6046 var Ee = d, Ie = d.nss; 6047 return Ee.path = (R || g.nid) + ":" + Ie, Ee; 6048 } 6049 }, Go = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, mn = { 6050 scheme: "urn:uuid", 6051 parse: function(d, g) { 6052 var k = d; 6053 return k.uuid = k.nss, k.nss = void 0, !g.tolerant && (!k.uuid || !k.uuid.match(Go)) && (k.error = k.error || "UUID is not valid."), k; 6054 }, 6055 serialize: function(d, g) { 6056 var k = d; 6057 return k.nss = (d.uuid || "").toLowerCase(), k; 6058 } 6059 }; 6060 D[_r.scheme] = _r, D[un.scheme] = un, D[br.scheme] = br, D[cn.scheme] = cn, D[fn.scheme] = fn, D[pn.scheme] = pn, D[mn.scheme] = mn, r.SCHEMES = D, r.pctEncChar = B, r.pctDecChars = le, r.parse = Te, r.removeDotSegments = Le, r.serialize = Me, r.resolveComponents = lt, r.resolve = Fr, r.normalize = va, r.equal = ga, r.escapeComponent = Zo, r.unescapeComponent = Ft, Object.defineProperty(r, "__esModule", { value: !0 }); 6061 }); 6062 }(xr, xr.exports)), xr.exports; 6063} 6064var Pa, Vn; 6065function sn() { 6066 return Vn || (Vn = 1, Pa = function s(e, r) { 6067 if (e === r) return !0; 6068 if (e && r && typeof e == "object" && typeof r == "object") { 6069 if (e.constructor !== r.constructor) return !1; 6070 var a, t, n; 6071 if (Array.isArray(e)) { 6072 if (a = e.length, a != r.length) return !1; 6073 for (t = a; t-- !== 0; ) 6074 if (!s(e[t], r[t])) return !1; 6075 return !0; 6076 } 6077 if (e.constructor === RegExp) return e.source === r.source && e.flags === r.flags; 6078 if (e.valueOf !== Object.prototype.valueOf) return e.valueOf() === r.valueOf(); 6079 if (e.toString !== Object.prototype.toString) return e.toString() === r.toString(); 6080 if (n = Object.keys(e), a = n.length, a !== Object.keys(r).length) return !1; 6081 for (t = a; t-- !== 0; ) 6082 if (!Object.prototype.hasOwnProperty.call(r, n[t])) return !1; 6083 for (t = a; t-- !== 0; ) { 6084 var i = n[t]; 6085 if (!s(e[i], r[i])) return !1; 6086 } 6087 return !0; 6088 } 6089 return e !== e && r !== r; 6090 }), Pa; 6091} 6092var Sa, Hn; 6093function Yc() { 6094 return Hn || (Hn = 1, Sa = function(e) { 6095 for (var r = 0, a = e.length, t = 0, n; t < a; ) 6096 r++, n = e.charCodeAt(t++), n >= 55296 && n <= 56319 && t < a && (n = e.charCodeAt(t), (n & 64512) == 56320 && t++); 6097 return r; 6098 }), Sa; 6099} 6100var wa, Bn; 6101function yr() { 6102 if (Bn) return wa; 6103 Bn = 1, wa = { 6104 copy: s, 6105 checkDataType: e, 6106 checkDataTypes: r, 6107 coerceToTypes: t, 6108 toHash: n, 6109 getProperty: u, 6110 escapeQuotes: l, 6111 equal: sn(), 6112 ucs2length: Yc(), 6113 varOccurences: h, 6114 varReplace: m, 6115 schemaHasRules: _, 6116 schemaHasRulesExcept: c, 6117 schemaUnknownRules: f, 6118 toQuotedString: y, 6119 getPathExpr: v, 6120 getPath: P, 6121 getData: b, 6122 unescapeFragment: T, 6123 unescapeJsonPointer: $, 6124 escapeFragment: O, 6125 escapeJsonPointer: C 6126 }; 6127 function s(S, E) { 6128 E = E || {}; 6129 for (var N in S) E[N] = S[N]; 6130 return E; 6131 } 6132 function e(S, E, N, L) { 6133 var Z = L ? " !== " : " === ", re = L ? " || " : " && ", fe = L ? "!" : "", ne = L ? "" : "!"; 6134 switch (S) { 6135 case "null": 6136 return E + Z + "null"; 6137 case "array": 6138 return fe + "Array.isArray(" + E + ")"; 6139 case "object": 6140 return "(" + fe + E + re + "typeof " + E + Z + '"object"' + re + ne + "Array.isArray(" + E + "))"; 6141 case "integer":
6142 return "(typeof " + E + Z + '"number"' + re + ne + "(" + E + " % 1)" + re + E + Z + E + (N ? re + fe + "isFinite(" + E + ")" : "") + ")"; 6143 case "number": 6144 return "(typeof " + E + Z + '"' + S + '"' + (N ? re + fe + "isFinite(" + E + ")" : "") + ")"; 6145 default: 6146 return "typeof " + E + Z + '"' + S + '"'; 6147 } 6148 } 6149 function r(S, E, N) { 6150 switch (S.length) { 6151 case 1: 6152 return e(S[0], E, N, !0); 6153 default: 6154 var L = "", Z = n(S); 6155 Z.array && Z.object && (L = Z.null ? "(" : "(!" + E + " || ", L += "typeof " + E + ' !== "object")', delete Z.null, delete Z.array, delete Z.object), Z.number && delete Z.integer; 6156 for (var re in Z) 6157 L += (L ? " && " : "") + e(re, E, N, !0); 6158 return L; 6159 } 6160 } 6161 var a = n(["string", "number", "integer", "boolean", "null"]); 6162 function t(S, E) { 6163 if (Array.isArray(E)) { 6164 for (var N = [], L = 0; L < E.length; L++) { 6165 var Z = E[L]; 6166 (a[Z] || S === "array" && Z === "array") && (N[N.length] = Z); 6167 } 6168 if (N.length) return N; 6169 } else { 6170 if (a[E]) 6171 return [E]; 6172 if (S === "array" && E === "array") 6173 return ["array"]; 6174 } 6175 } 6176 function n(S) { 6177 for (var E = {}, N = 0; N < S.length; N++) E[S[N]] = !0; 6178 return E; 6179 } 6180 var i = /^[a-z$_][a-z$_0-9]*$/i, o = /'|\\/g; 6181 function u(S) { 6182 return typeof S == "number" ? "[" + S + "]" : i.test(S) ? "." + S : "['" + l(S) + "']"; 6183 } 6184 function l(S) { 6185 return S.replace(o, "\\$&").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\f/g, "\\f").replace(/\t/g, "\\t"); 6186 } 6187 function h(S, E) { 6188 E += "[^0-9]"; 6189 var N = S.match(new RegExp(E, "g")); 6190 return N ? N.length : 0; 6191 } 6192 function m(S, E, N) { 6193 return E += "([^0-9])", N = N.replace(/\$/g, "$$$$"), S.replace(new RegExp(E, "g"), N + "$1"); 6194 } 6195 function _(S, E) { 6196 if (typeof S == "boolean") return !S; 6197 for (var N in S) if (E[N]) return !0; 6198 } 6199 function c(S, E, N) { 6200 if (typeof S == "boolean") return !S && N != "not"; 6201 for (var L in S) if (L != N && E[L]) return !0; 6202 } 6203 function f(S, E) { 6204 if (typeof S != "boolean") { 6205 for (var N in S) if (!E[N]) return N; 6206 } 6207 } 6208 function y(S) { 6209 return "'" + l(S) + "'"; 6210 } 6211 function v(S, E, N, L) { 6212 var Z = N ? "'/' + " + E + (L ? "" : ".replace(/~/g, '~0').replace(/\\//g, '~1')") : L ? "'[' + " + E + " + ']'" : "'[\\'' + " + E + " + '\\']'"; 6213 return x(S, Z); 6214 } 6215 function P(S, E, N) { 6216 var L = y(N ? "/" + C(E) : u(E)); 6217 return x(S, L); 6218 } 6219 var I = /^\/(?:[^~]|~0|~1)*$/, A = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; 6220 function b(S, E, N) { 6221 var L, Z, re, fe; 6222 if (S === "") return "rootData"; 6223 if (S[0] == "/") { 6224 if (!I.test(S)) throw new Error("Invalid JSON-pointer: " + S); 6225 Z = S, re = "rootData"; 6226 } else { 6227 if (fe = S.match(A), !fe) throw new Error("Invalid JSON-pointer: " + S); 6228 if (L = +fe[1], Z = fe[2], Z == "#") { 6229 if (L >= E) throw new Error("Cannot access property/index " + L + " levels up, current level is " + E); 6230 return N[E - L]; 6231 } 6232 if (L > E) throw new Error("Cannot access data " + L + " levels up, current level is " + E); 6233 if (re = "data" + (E - L || ""), !Z) return re; 6234 } 6235 for (var ne = re, _e = Z.split("/"), ce = 0; ce < _e.length; ce++) { 6236 var de = _e[ce]; 6237 de && (re += u($(de)), ne += " && " + re); 6238 } 6239 return ne; 6240 } 6241 function x(S, E) { 6242 return S == '""' ? E : (S + " + " + E).replace(/([^\\])' \+ '/g, "$1"); 6243 } 6244 function T(S) { 6245 return $(decodeURIComponent(S)); 6246 } 6247 function O(S) { 6248 return encodeURIComponent(C(S)); 6249 } 6250 function C(S) { 6251 return S.replace(/~/g, "~0").replace(/\//g, "~1"); 6252 } 6253 function $(S) { 6254 return S.replace(/~1/g, "/").replace(/~0/g, "~"); 6255 } 6256 return wa; 6257} 6258var xa, Qn; 6259function To() { 6260 if (Qn) return xa; 6261 Qn = 1; 6262 var s = yr(); 6263 xa = e; 6264 function e(r) { 6265 s.copy(r, this); 6266 } 6267 return xa; 6268} 6269var Ea = { exports: {} }, Kn; 6270function Xc() { 6271 if (Kn) return Ea.exports; 6272 Kn = 1; 6273 var s = Ea.exports = function(a, t, n) { 6274 typeof t == "function" && (n = t, t = {}), n = t.cb || n; 6275 var i = typeof n == "function" ? n : n.pre || function() { 6276 }, o = n.post || function() { 6277 }; 6278 e(t, i, o, a, "", a); 6279 }; 6280 s.keywords = { 6281 additionalItems: !0, 6282 items: !0, 6283 contains: !0, 6284 additionalProperties: !0, 6285 propertyNames: !0, 6286 not: !0 6287 }, s.arrayKeywords = { 6288 items: !0, 6289 allOf: !0, 6290 anyOf: !0, 6291 oneOf: !0 6292 }, s.propsKeywords = { 6293 definitions: !0, 6294 properties: !0, 6295 patternProperties: !0, 6296 dependencies: !0 6297 }, s.skipKeywords = { 6298 default: !0, 6299 enum: !0, 6300 const: !0, 6301 required: !0, 6302 maximum: !0, 6303 minimum: !0, 6304 exclusiveMaximum: !0, 6305 exclusiveMinimum: !0, 6306 multipleOf: !0, 6307 maxLength: !0, 6308 minLength: !0, 6309 pattern: !0, 6310 format: !0, 6311 maxItems: !0, 6312 minItems: !0, 6313 uniqueItems: !0, 6314 maxProperties: !0, 6315 minProperties: !0 6316 }; 6317 function e(a, t, n, i, o, u, l, h, m, _) { 6318 if (i && typeof i == "object" && !Array.isArray(i)) { 6319 t(i, o, u, l, h, m, _); 6320 for (var c in i) { 6321 var f = i[c]; 6322 if (Array.isArray(f)) { 6323 if (c in s.arrayKeywords) 6324 for (var y = 0; y < f.length; y++) 6325 e(a, t, n, f[y], o + "/" + c + "/" + y, u, o, c, i, y); 6326 } else if (c in s.propsKeywords) { 6327 if (f && typeof f == "object") 6328 for (var v in f) 6329 e(a, t, n, f[v], o + "/" + c + "/" + r(v), u, o, c, i, v); 6330 } else (c in s.keywords || a.allKeys && !(c in s.skipKeywords)) && e(a, t, n, f, o + "/" + c, u, o, c, i); 6331 } 6332 n(i, o, u, l, h, m, _); 6333 } 6334 } 6335 function r(a) { 6336 return a.replace(/~/g, "~0").replace(/\//g, "~1"); 6337 } 6338 return Ea.exports; 6339} 6340var Ra, Jn; 6341function nn() { 6342 if (Jn) return Ra; 6343 Jn = 1; 6344 var s = Gc(), e = sn(), r = yr(), a = To(), t = Xc(); 6345 Ra = n, n.normalizeId = P, n.fullPath = f, n.url = I, n.ids = A, n.inlineRef = m, n.schema = i; 6346 function n(b, x, T) { 6347 var O = this._refs[T]; 6348 if (typeof O == "string") 6349 if (this._refs[O]) O = this._refs[O]; 6350 else return n.call(this, b, x, O); 6351 if (O = O || this._schemas[T], O instanceof a) 6352 return m(O.schema, this._opts.inlineRefs) ? O.schema : O.validate || this._compile(O); 6353 var C = i.call(this, x, T), $, S, E; 6354 return C && ($ = C.schema, x = C.root, E = C.baseId), $ instanceof a ? S = $.validate || b.call(this, $.schema, x, void 0, E) : $ !== void 0 && (S = m($, this._opts.inlineRefs) ? $ : b.call(this, $, x, void 0, E)), S; 6355 } 6356 function i(b, x) { 6357 var T = s.parse(x), O = y(T), C = f(this._getId(b.schema)); 6358 if (Object.keys(b.schema).length === 0 || O !== C) { 6359 var $ = P(O), S = this._refs[$]; 6360 if (typeof S == "string") 6361 return o.call(this, b, S, T); 6362 if (S instanceof a) 6363 S.validate || this._compile(S), b = S; 6364 else if (S = this._schemas[$], S instanceof a) { 6365 if (S.validate || this._compile(S), $ == P(x)) 6366 return { schema: S, root: b, baseId: C }; 6367 b = S; 6368 } else 6369 return; 6370 if (!b.schema) return; 6371 C = f(this._getId(b.schema)); 6372 } 6373 return l.call(this, T, C, b.schema, b); 6374 } 6375 function o(b, x, T) { 6376 var O = i.call(this, b, x); 6377 if (O) { 6378 var C = O.schema, $ = O.baseId; 6379 b = O.root; 6380 var S = this._getId(C); 6381 return S && ($ = I($, S)), l.call(this, T, $, C, b); 6382 } 6383 } 6384 var u = r.toHash(["properties", "patternProperties", "enum", "depen
6384dencies", "definitions"]); 6385 function l(b, x, T, O) { 6386 if (b.fragment = b.fragment || "", b.fragment.slice(0, 1) == "/") { 6387 for (var C = b.fragment.split("/"), $ = 1; $ < C.length; $++) { 6388 var S = C[$]; 6389 if (S) { 6390 if (S = r.unescapeFragment(S), T = T[S], T === void 0) break; 6391 var E; 6392 if (!u[S] && (E = this._getId(T), E && (x = I(x, E)), T.$ref)) { 6393 var N = I(x, T.$ref), L = i.call(this, O, N); 6394 L && (T = L.schema, O = L.root, x = L.baseId); 6395 } 6396 } 6397 } 6398 if (T !== void 0 && T !== O.schema) 6399 return { schema: T, root: O, baseId: x }; 6400 } 6401 } 6402 var h = r.toHash([ 6403 "type", 6404 "format", 6405 "pattern", 6406 "maxLength", 6407 "minLength", 6408 "maxProperties", 6409 "minProperties", 6410 "maxItems", 6411 "minItems", 6412 "maximum", 6413 "minimum", 6414 "uniqueItems", 6415 "multipleOf", 6416 "required", 6417 "enum" 6418 ]); 6419 function m(b, x) { 6420 if (x === !1) return !1; 6421 if (x === void 0 || x === !0) return _(b); 6422 if (x) return c(b) <= x; 6423 } 6424 function _(b) { 6425 var x; 6426 if (Array.isArray(b)) { 6427 for (var T = 0; T < b.length; T++) 6428 if (x = b[T], typeof x == "object" && !_(x)) return !1; 6429 } else 6430 for (var O in b) 6431 if (O == "$ref" || (x = b[O], typeof x == "object" && !_(x))) return !1; 6432 return !0; 6433 } 6434 function c(b) { 6435 var x = 0, T; 6436 if (Array.isArray(b)) { 6437 for (var O = 0; O < b.length; O++) 6438 if (T = b[O], typeof T == "object" && (x += c(T)), x == 1 / 0) return 1 / 0; 6439 } else 6440 for (var C in b) { 6441 if (C == "$ref") return 1 / 0; 6442 if (h[C]) 6443 x++; 6444 else if (T = b[C], typeof T == "object" && (x += c(T) + 1), x == 1 / 0) return 1 / 0; 6445 } 6446 return x; 6447 } 6448 function f(b, x) { 6449 x !== !1 && (b = P(b)); 6450 var T = s.parse(b); 6451 return y(T); 6452 } 6453 function y(b) { 6454 return s.serialize(b).split("#")[0] + "#"; 6455 } 6456 var v = /#\/?$/; 6457 function P(b) { 6458 return b ? b.replace(v, "") : ""; 6459 } 6460 function I(b, x) { 6461 return x = P(x), s.resolve(b, x); 6462 } 6463 function A(b) { 6464 var x = P(this._getId(b)), T = { "": x }, O = { "": f(x, !1) }, C = {}, $ = this; 6465 return t(b, { allKeys: !0 }, function(S, E, N, L, Z, re, fe) { 6466 if (E !== "") { 6467 var ne = $._getId(S), _e = T[L], ce = O[L] + "/" + Z; 6468 if (fe !== void 0 && (ce += "/" + (typeof fe == "number" ? fe : r.escapeFragment(fe))), typeof ne == "string") { 6469 ne = _e = P(_e ? s.resolve(_e, ne) : ne); 6470 var de = $._refs[ne]; 6471 if (typeof de == "string" && (de = $._refs[de]), de && de.schema) { 6472 if (!e(S, de.schema)) 6473 throw new Error('id "' + ne + '" resolves to more than one schema'); 6474 } else if (ne != P(ce)) 6475 if (ne[0] == "#") { 6476 if (C[ne] && !e(S, C[ne])) 6477 throw new Error('id "' + ne + '" resolves to more than one schema'); 6478 C[ne] = S; 6479 } else 6480 $._refs[ne] = ce; 6481 } 6482 T[E] = _e, O[E] = ce; 6483 } 6484 }), C; 6485 } 6486 return Ra; 6487} 6488var ka, Wn; 6489function on() { 6490 if (Wn) return ka; 6491 Wn = 1; 6492 var s = nn(); 6493 ka = { 6494 Validation: a(e), 6495 MissingRef: a(r) 6496 }; 6497 function e(t) { 6498 this.message = "validation failed", this.errors = t, this.ajv = this.validation = !0; 6499 } 6500 r.message = function(t, n) { 6501 return "can't resolve reference " + n + " from id " + t; 6502 }; 6503 function r(t, n, i) { 6504 this.message = i || r.message(t, n), this.missingRef = s.url(t, n), this.missingSchema = s.normalizeId(s.fullPath(this.missingRef)); 6505 } 6506 function a(t) { 6507 return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t; 6508 } 6509 return ka; 6510} 6511var Ta, Gn; 6512function Ao() { 6513 return Gn || (Gn = 1, Ta = function(s, e) { 6514 e || (e = {}), typeof e == "function" && (e = { cmp: e }); 6515 var r = typeof e.cycles == "boolean" ? e.cycles : !1, a = e.cmp && /* @__P
6515URE__ */ function(n) { 6516 return function(i) { 6517 return function(o, u) { 6518 var l = { key: o, value: i[o] }, h = { key: u, value: i[u] }; 6519 return n(l, h); 6520 }; 6521 }; 6522 }(e.cmp), t = []; 6523 return function n(i) { 6524 if (i && i.toJSON && typeof i.toJSON == "function" && (i = i.toJSON()), i !== void 0) { 6525 if (typeof i == "number") return isFinite(i) ? "" + i : "null"; 6526 if (typeof i != "object") return JSON.stringify(i); 6527 var o, u; 6528 if (Array.isArray(i)) { 6529 for (u = "[", o = 0; o < i.length; o++) 6530 o && (u += ","), u += n(i[o]) || "null"; 6531 return u + "]"; 6532 } 6533 if (i === null) return "null"; 6534 if (t.indexOf(i) !== -1) { 6535 if (r) return JSON.stringify("__cycle__"); 6536 throw new TypeError("Converting circular structure to JSON"); 6537 } 6538 var l = t.push(i) - 1, h = Object.keys(i).sort(a && a(i)); 6539 for (u = "", o = 0; o < h.length; o++) { 6540 var m = h[o], _ = n(i[m]); 6541 _ && (u && (u += ","), u += JSON.stringify(m) + ":" + _); 6542 } 6543 return t.splice(l, 1), "{" + u + "}"; 6544 } 6545 }(s); 6546 }), Ta; 6547} 6548var Aa, Yn; 6549function Oo() { 6550 return Yn || (Yn = 1, Aa = function(e, r, a) { 6551 var t = "", n = e.schema.$async === !0, i = e.util.schemaHasRulesExcept(e.schema, e.RULES.all, "$ref"), o = e.self._getId(e.schema); 6552 if (e.opts.strictKeywords) { 6553 var u = e.util.schemaUnknownRules(e.schema, e.RULES.keywords); 6554 if (u) { 6555 var l = "unknown keyword: " + u; 6556 if (e.opts.strictKeywords === "log") e.logger.warn(l); 6557 else throw new Error(l); 6558 } 6559 } 6560 if (e.isTop && (t += " var validate = ", n && (e.async = !0, t += "async "), t += "function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ", o && (e.opts.sourceCode || e.opts.processCode) && (t += " " + ("/*# sourceURL=" + o + " */") + " ")), typeof e.schema == "boolean" || !(i || e.schema.$ref)) { 6561 var r = "false schema", h = e.level, m = e.dataLevel, _ = e.schema[r], c = e.schemaPath + e.util.getProperty(r), f = e.errSchemaPath + "/" + r, x = !e.opts.allErrors, C, y = "data" + (m || ""), b = "valid" + h; 6562 if (e.schema === !1) { 6563 e.isTop ? x = !0 : t += " var " + b + " = false; "; 6564 var v = v || []; 6565 v.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: '" + (C || "false schema") + "' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(f) + " , params: {} ", e.opts.messages !== !1 && (t += " , message: 'boolean schema is false' "), e.opts.verbose && (t += " , schema: false , parentSchema: validate.schema" + e.schemaPath + " , data: " + y + " "), t += " } ") : t += " {} "; 6566 var P = t; 6567 t = v.pop(), !e.compositeRule && x ? e.async ? t += " throw new ValidationError([" + P + "]); " : t += " validate.errors = [" + P + "]; return false; " : t += " var err = " + P + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; 6568 } else 6569 e.isTop ? n ? t += " return data; " : t += " validate.errors = null; return true; " : t += " var " + b + " = true; "; 6570 return e.isTop && (t += " }; return validate; "), t; 6571 } 6572 if (e.isTop) { 6573 var I = e.isTop, h = e.level = 0, m = e.dataLevel = 0, y = "data"; 6574 if (e.rootId = e.resolve.fullPath(e.self._getId(e.root.schema)), e.baseId = e.baseId || e.rootId, delete e.isTop, e.dataPathArr = [""], e.schema.default !== void 0 && e.opts.useDefaults && e.opts.strictDefaults) { 6575 var A = "default is ignored in the schema root"; 6576 if (e.opts.strictDefaults === "log") e.logger.warn(A); 6577 else throw new Error(A); 6578 } 6579 t += " var vErrors = null; ", t += " var errors = 0; ", t += " if (rootData === undefined) rootData = data; "; 6580 } else { 6581 var h = e.level, m = e.dataLevel, y = "data" + (m || ""); 6582 if (o && (e.baseId = e.resolve.url(e.baseId, o)), n && !e.async) throw new Error("async schema in sync schema"); 6583 t += " var errs_" + h + " = errors;"; 6584 } 6585 var b = "valid" + h, x = !e.opts.allErrors, T = "", O = "", C, $ = e.schema.type, S = Array.isArray($); 6586 if ($ && e.opts.nullable && e.schema.nullable === !0 && (S ? $.indexOf("null") == -1 && ($ = $.concat("null")) : $ != "null" && ($ = [$, "null"], S = !0)), S && $.length == 1 && ($ = $[0], S = !1), e.schema.$ref && i) { 6587 if (e.opts.extendRefs == "fail") 6588 throw new Error('$ref: validation keywords used in schema at path "' + e.errSchemaPath + '" (see option extendRefs)'); 6589 e.opts.extendRefs !== !0 && (i = !1, e.logger.warn('$ref: keywords ignored in schema at path "' + e.errSchemaPath + '"')); 6590 } 6591 if (e.schema.$comment && e.opts.$comment && (t += " " + e.RULES.all.$comment.code(e, "$comment")), $) {
6592 if (e.opts.coerceTypes) 6593 var E = e.util.coerceToTypes(e.opts.coerceTypes, $); 6594 var N = e.RULES.types[$]; 6595 if (E || S || N === !0 || N && !Fe(N)) { 6596 var c = e.schemaPath + ".type", f = e.errSchemaPath + "/type", c = e.schemaPath + ".type", f = e.errSchemaPath + "/type", L = S ? "checkDataTypes" : "checkDataType"; 6597 if (t += " if (" + e.util[L]($, y, e.opts.strictNumbers, !0) + ") { ", E) { 6598 var Z = "dataType" + h, re = "coerced" + h; 6599 t += " var " + Z + " = typeof " + y + "; var " + re + " = undefined; ", e.opts.coerceTypes == "array" && (t += " if (" + Z + " == 'object' && Array.isArray(" + y + ") && " + y + ".length == 1) { " + y + " = " + y + "[0]; " + Z + " = typeof " + y + "; if (" + e.util.checkDataType(e.schema.type, y, e.opts.strictNumbers) + ") " + re + " = " + y + "; } "), t += " if (" + re + " !== undefined) ; "; 6600 var fe = E; 6601 if (fe) 6602 for (var ne, _e = -1, ce = fe.length - 1; _e < ce; ) 6603 ne = fe[_e += 1], ne == "string" ? t += " else if (" + Z + " == 'number' || " + Z + " == 'boolean') " + re + " = '' + " + y + "; else if (" + y + " === null) " + re + " = ''; " : ne == "number" || ne == "integer" ? (t += " else if (" + Z + " == 'boolean' || " + y + " === null || (" + Z + " == 'string' && " + y + " && " + y + " == +" + y + " ", ne == "integer" && (t += " && !(" + y + " % 1)"), t += ")) " + re + " = +" + y + "; ") : ne == "boolean" ? t += " else if (" + y + " === 'false' || " + y + " === 0 || " + y + " === null) " + re + " = false; else if (" + y + " === 'true' || " + y + " === 1) " + re + " = true; " : ne == "null" ? t += " else if (" + y + " === '' || " + y + " === 0 || " + y + " === false) " + re + " = null; " : e.opts.coerceTypes == "array" && ne == "array" && (t += " else if (" + Z + " == 'string' || " + Z + " == 'number' || " + Z + " == 'boolean' || " + y + " == null) " + re + " = [" + y + "]; "); 6604 t += " else { "; 6605 var v = v || []; 6606 v.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: '" + (C || "type") + "' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(f) + " , params: { type: '", S ? t += "" + $.join(",") : t += "" + $, t += "' } ", e.opts.messages !== !1 && (t += " , message: 'should be ", S ? t += "" + $.join(",") : t += "" + $, t += "' "), e.opts.verbose && (t += " , schema: validate.schema" + c + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + y + " "), t += " } ") : t += " {} "; 6607 var P = t; 6608 t = v.pop(), !e.compositeRule && x ? e.async ? t += " throw new ValidationError([" + P + "]); " : t += " validate.errors = [" + P + "]; return false; " : t += " var err = " + P + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += " } if (" + re + " !== undefined) { "; 6609 var de = m ? "data" + (m - 1 || "") : "parentData", tt = m ? e.dataPathArr[m] : "parentDataProperty"; 6610 t += " " + y + " = " + re + "; ", m || (t += "if (" + de + " !== undefined)"), t += " " + de + "[" + tt + "] = " + re + "; } "; 6611 } else { 6612 var v = v || []; 6613 v.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: '" + (C || "type") + "' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(f) + " , params: { type: '", S ? t += "" + $.join(",") : t += "" + $, t += "' } ", e.opts.messages !== !1 && (t += " , message: 'should be ", S ? t += "" + $.join(",") : t += "" + $, t += "' "), e.opts.verbose && (t += " , schema: validate.schema" + c + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + y + " "), t += " } ") : t += " {} "; 6614 var P = t; 6615 t = v.pop(), !e.compositeRule && x ? e.async ? t += " throw new ValidationError([" + P + "]); " : t += " validate.errors = [" + P + "]; return false; " : t += " var err = " + P + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; 6616 } 6617 t += " } "; 6618 } 6619 } 6620 if (e.schema.$ref && !i) 6621 t += " " + e.RULES.all.$ref.code(e, "$ref") + " ", x && (t += " } if (errors === ", I ? t += "0" : t += "errs_" + h, t += ") { ", O += "}"); 6622 else { 6623 var Ge = e.RULES; 6624 if (Ge) { 6625 for (var N, Je = -1, Ze = Ge.length - 1; Je < Ze; ) 6626 if (N = Ge[Je += 1], Fe(N)) { 6627 if (N.type && (t += " if (" + e.util.checkDataType(N.type, y, e.o
6627pts.strictNumbers) + ") { "), e.opts.useDefaults) { 6628 if (N.type == "object" && e.schema.properties) { 6629 var _ = e.schema.properties, mt = Object.keys(_), w = mt; 6630 if (w) 6631 for (var D, B = -1, le = w.length - 1; B < le; ) { 6632 D = w[B += 1]; 6633 var j = _[D]; 6634 if (j.default !== void 0) { 6635 var V = y + e.util.getProperty(D); 6636 if (e.compositeRule) { 6637 if (e.opts.strictDefaults) { 6638 var A = "default is ignored for: " + V; 6639 if (e.opts.strictDefaults === "log") e.logger.warn(A); 6640 else throw new Error(A); 6641 } 6642 } else 6643 t += " if (" + V + " === undefined ", e.opts.useDefaults == "empty" && (t += " || " + V + " === null || " + V + " === '' "), t += " ) " + V + " = ", e.opts.useDefaults == "shared" ? t += " " + e.useDefault(j.default) + " " : t += " " + JSON.stringify(j.default) + " ", t += "; "; 6644 } 6645 } 6646 } else if (N.type == "array" && Array.isArray(e.schema.items)) { 6647 var ve = e.schema.items; 6648 if (ve) { 6649 for (var j, _e = -1, Se = ve.length - 1; _e < Se; ) 6650 if (j = ve[_e += 1], j.default !== void 0) { 6651 var V = y + "[" + _e + "]"; 6652 if (e.compositeRule) { 6653 if (e.opts.strictDefaults) { 6654 var A = "default is ignored for: " + V; 6655 if (e.opts.strictDefaults === "log") e.logger.warn(A); 6656 else throw new Error(A); 6657 } 6658 } else 6659 t += " if (" + V + " === undefined ", e.opts.useDefaults == "empty" && (t += " || " + V + " === null || " + V + " === '' "), t += " ) " + V + " = ", e.opts.useDefaults == "shared" ? t += " " + e.useDefault(j.default) + " " : t += " " + JSON.stringify(j.default) + " ", t += "; "; 6660 } 6661 } 6662 } 6663 } 6664 var be = N.rules; 6665 if (be) { 6666 for (var Ne, Te = -1, Ae = be.length - 1; Te < Ae; ) 6667 if (Ne = be[Te += 1], wt(Ne)) { 6668 var Ye = Ne.code(e, Ne.keyword, N.type); 6669 Ye && (t += " " + Ye + " ", x && (T += "}")); 6670 } 6671 } 6672 if (x && (t += " " + T + " ", T = ""), N.type && (t += " } ", $ && $ === N.type && !E)) { 6673 t += " else { "; 6674 var c = e.schemaPath + ".type", f = e.errSchemaPath + "/type", v = v || []; 6675 v.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: '" + (C || "type") + "' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(f) + " , params: { type: '", S ? t += "" + $.join(",") : t += "" + $, t += "' } ", e.opts.messages !== !1 && (t += " , message: 'should be ", S ? t += "" + $.join(",") : t += "" + $, t += "' "), e.opts.verbose && (t += " , schema: validate.schema" + c + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + y + " "), t += " } ") : t += " {} "; 6676 var P = t; 6677 t = v.pop(), !e.compositeRule && x ? e.async ? t += " throw new ValidationError([" + P + "]); " : t += " validate.errors = [" + P + "]; return false; " : t += " var err = " + P + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += " } "; 6678 } 6679 x && (t += " if (errors === ", I ? t += "0" : t += "errs_" + h, t += ") { ", O += "}"); 6680 } 6681 } 6682 } 6683 x && (t += " " + O + " "), I ? (n ? (t += " if (errors === 0) return data; ", t += " else throw new ValidationError(vErrors); ") : (t += " validate.errors = vErrors; ", t += " return errors === 0; "), t += " }; return validate;") : t += " var " + b + " = errors === errs_" + h + ";"; 6684 function Fe(Le) { 6685 for (var Me = Le.rules, lt = 0; lt < Me.length; lt++) 6686 if (wt(Me[lt])) return !0; 6687 } 6688 function wt(Le) { 6689 return e.schema[Le.keyword] !== void 0 || Le.implements && rt(Le); 6690 } 6691 function rt(Le) { 6692 for (var Me = Le.implements, lt = 0; lt < Me.length; lt++) 6693 if (e.schema[Me[lt]] !== void 0) return !0; 6694 } 6695 return t; 6696 }), Aa; 6697} 6698var Oa, Xn; 6699function ed() { 6700 if (Xn) return Oa;
6701 Xn = 1; 6702 var s = nn(), e = yr(), r = on(), a = Ao(), t = Oo(), n = e.ucs2length, i = sn(), o = r.Validation; 6703 Oa = u; 6704 function u(P, I, A, b) { 6705 var x = this, T = this._opts, O = [void 0], C = {}, $ = [], S = {}, E = [], N = {}, L = []; 6706 I = I || { schema: P, refVal: O, refs: C }; 6707 var Z = l.call(this, P, I, b), re = this._compilations[Z.index]; 6708 if (Z.compiling) return re.callValidate = de; 6709 var fe = this._formats, ne = this.RULES; 6710 try { 6711 var _e = tt(P, I, A, b); 6712 re.validate = _e; 6713 var ce = re.callValidate; 6714 return ce && (ce.schema = _e.schema, ce.errors = null, ce.refs = _e.refs, ce.refVal = _e.refVal, ce.root = _e.root, ce.$async = _e.$async, T.sourceCode && (ce.source = _e.source)), _e; 6715 } finally { 6716 h.call(this, P, I, b); 6717 } 6718 function de() { 6719 var j = re.validate, V = j.apply(this, arguments); 6720 return de.errors = j.errors, V; 6721 } 6722 function tt(j, V, ve, Se) { 6723 var be = !V || V && V.schema == j; 6724 if (V.schema != I.schema) 6725 return u.call(x, j, V, ve, Se); 6726 var Ne = j.$async === !0, Te = t({ 6727 isTop: !0, 6728 schema: j, 6729 isRoot: be, 6730 baseId: Se, 6731 root: V, 6732 schemaPath: "", 6733 errSchemaPath: "#", 6734 errorPath: '""', 6735 MissingRefError: r.MissingRef, 6736 RULES: ne, 6737 validate: t, 6738 util: e, 6739 resolve: s, 6740 resolveRef: Ge, 6741 usePattern: D, 6742 useDefault: B, 6743 useCustomRule: le, 6744 opts: T, 6745 formats: fe, 6746 logger: x.logger, 6747 self: x 6748 }); 6749 Te = v(O, f) + v($, _) + v(E, c) + v(L, y) + Te, T.processCode && (Te = T.processCode(Te, j)); 6750 var Ae; 6751 try { 6752 var Ye = new Function( 6753 "self", 6754 "RULES", 6755 "formats", 6756 "root", 6757 "refVal", 6758 "defaults", 6759 "customRules", 6760 "equal", 6761 "ucs2length", 6762 "ValidationError", 6763 Te 6764 ); 6765 Ae = Ye( 6766 x, 6767 ne, 6768 fe, 6769 I, 6770 O, 6771 E, 6772 L, 6773 i, 6774 n, 6775 o 6776 ), O[0] = Ae; 6777 } catch (Fe) { 6778 throw x.logger.error("Error compiling schema, function code:", Te), Fe; 6779 } 6780 return Ae.schema = j, Ae.errors = null, Ae.refs = C, Ae.refVal = O, Ae.root = be ? Ae : V, Ne && (Ae.$async = !0), T.sourceCode === !0 && (Ae.source = { 6781 code: Te, 6782 patterns: $, 6783 defaults: E 6784 }), Ae; 6785 } 6786 function Ge(j, V, ve) { 6787 V = s.url(j, V); 6788 var Se = C[V], be, Ne; 6789 if (Se !== void 0) 6790 return be = O[Se], Ne = "refVal[" + Se + "]", w(be, Ne); 6791 if (!ve && I.refs) { 6792 var Te = I.refs[V]; 6793 if (Te !== void 0) 6794 return be = I.refVal[Te], Ne = Je(V, be), w(be, Ne); 6795 } 6796 Ne = Je(V); 6797 var Ae = s.call(x, tt, I, V); 6798 if (Ae === void 0) { 6799 var Ye = A && A[V]; 6800 Ye && (Ae = s.inlineRef(Ye, T.inlineRefs) ? Ye : u.call(x, Ye, I, A, j)); 6801 } 6802 if (Ae === void 0) 6803 Ze(V); 6804 else 6805 return mt(V, Ae), w(Ae, Ne); 6806 } 6807 function Je(j, V) { 6808 var ve = O.length; 6809 return O[ve] = V, C[j] = ve, "refVal" + ve; 6810 } 6811 function Ze(j) { 6812 delete C[j]; 6813 } 6814 function mt(j, V) { 6815 var ve = C[j]; 6816 O[ve] = V; 6817 } 6818 function w(j, V) { 6819 return typeof j == "object" || typeof j == "boolean" ? { code: V, schema: j, inline: !0 } : { code: V, $async: j && !!j.$async }; 6820 } 6821 function D(j) { 6822 var V = S[j]; 6823 return V === void 0 && (V = S[j] = $.length, $[V] = j), "pattern" + V; 6824 } 6825 function B(j) { 6826 switch (typeof j) { 6827 case "boolean": 6828 case "number": 6829 return "" + j; 6830 case "string": 6831 return e.toQuotedString(j); 6832 case "object": 6833 if (j === null) return "null"; 6834 var V = a(j), ve = N[V]; 6835 return ve === void 0 && (ve = N[V] = E.length, E[ve] = j), "default" + ve; 6836 } 6837 } 6838 function le(j, V, ve, Se) { 6839 if (x._opts.validateSchema !== !1) { 6840 var be = j.definition.dependencies; 6841 if (be && !be.every(function(Me) { 6842 return Object.prototype.hasOwnProperty.call(ve, Me); 6843 })) 6844 throw new Error("parent schema must have all required keywords: " + be.join(",")); 6845 var Ne = j.definition.validateSchema; 6846 if (Ne) { 6847 var Te = Ne(V); 6848 if (!Te) {
6849 var Ae = "keyword schema is invalid: " + x.errorsText(Ne.errors); 6850 if (x._opts.validateSchema == "log") x.logger.error(Ae); 6851 else throw new Error(Ae); 6852 } 6853 } 6854 } 6855 var Ye = j.definition.compile, Fe = j.definition.inline, wt = j.definition.macro, rt; 6856 if (Ye) 6857 rt = Ye.call(x, V, ve, Se); 6858 else if (wt) 6859 rt = wt.call(x, V, ve, Se), T.validateSchema !== !1 && x.validateSchema(rt, !0); 6860 else if (Fe) 6861 rt = Fe.call(x, Se, j.keyword, V, ve); 6862 else if (rt = j.definition.validate, !rt) return; 6863 if (rt === void 0) 6864 throw new Error('custom keyword "' + j.keyword + '"failed to compile'); 6865 var Le = L.length; 6866 return L[Le] = rt, { 6867 code: "customRule" + Le, 6868 validate: rt 6869 }; 6870 } 6871 } 6872 function l(P, I, A) { 6873 var b = m.call(this, P, I, A); 6874 return b >= 0 ? { index: b, compiling: !0 } : (b = this._compilations.length, this._compilations[b] = { 6875 schema: P, 6876 root: I, 6877 baseId: A 6878 }, { index: b, compiling: !1 }); 6879 } 6880 function h(P, I, A) { 6881 var b = m.call(this, P, I, A); 6882 b >= 0 && this._compilations.splice(b, 1); 6883 } 6884 function m(P, I, A) { 6885 for (var b = 0; b < this._compilations.length; b++) { 6886 var x = this._compilations[b]; 6887 if (x.schema == P && x.root == I && x.baseId == A) return b; 6888 } 6889 return -1; 6890 } 6891 function _(P, I) { 6892 return "var pattern" + P + " = new RegExp(" + e.toQuotedString(I[P]) + ");"; 6893 } 6894 function c(P) { 6895 return "var default" + P + " = defaults[" + P + "];"; 6896 } 6897 function f(P, I) { 6898 return I[P] === void 0 ? "" : "var refVal" + P + " = refVal[" + P + "];"; 6899 } 6900 function y(P) { 6901 return "var customRule" + P + " = customRules[" + P + "];"; 6902 } 6903 function v(P, I) { 6904 if (!P.length) return ""; 6905 for (var A = "", b = 0; b < P.length; b++) 6906 A += I(b, P); 6907 return A; 6908 } 6909 return Oa; 6910} 6911var Ca = { exports: {} }, ei; 6912function td() { 6913 if (ei) return Ca.exports; 6914 ei = 1; 6915 var s = Ca.exports = function() { 6916 this._cache = {}; 6917 }; 6918 return s.prototype.put = function(r, a) { 6919 this._cache[r] = a; 6920 }, s.prototype.get = function(r) { 6921 return this._cache[r]; 6922 }, s.prototype.del = function(r) { 6923 delete this._cache[r]; 6924 }, s.prototype.clear = function() { 6925 this._cache = {}; 6926 }, Ca.exports; 6927} 6928var $a, ti; 6929function rd() { 6930 if (ti) return $a; 6931 ti = 1; 6932 var s = yr(), e = /^(\d\d\d\d)-(\d\d)-(\d\d)$/, r = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], a = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i, t = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i, n = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i, i = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4}
6932)?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i, o = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i, u = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i, l = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i, h = /^(?:\/(?:[^~/]|~0|~1)*)*$/, m = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i, _ = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/; 6933 $a = c; 6934 function c(O) { 6935 return O = O == "full" ? "full" : "fast", s.copy(c[O]); 6936 } 6937 c.fast = { 6938 // date: http://tools.ietf.org/html/rfc3339#section-5.6 6939 date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/, 6940 // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 6941 time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, 6942 "date-time": /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, 6943 // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js 6944 uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i, 6945 "uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, 6946 "uri-template": o, 6947 url: u, 6948 // email (sources from jsen validator): 6949 // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 6950 // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation') 6951 email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, 6952 hostname: t, 6953 // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html 6954 ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, 6955 // optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
6956 ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, 6957 regex: T, 6958 // uuid: http://tools.ietf.org/html/rfc4122 6959 uuid: l, 6960 // JSON-pointer: https://tools.ietf.org/html/rfc6901 6961 // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A 6962 "json-pointer": h, 6963 "json-pointer-uri-fragment": m, 6964 // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 6965 "relative-json-pointer": _ 6966 }, c.full = { 6967 date: y, 6968 time: v, 6969 "date-time": I, 6970 uri: b, 6971 "uri-reference": i, 6972 "uri-template": o, 6973 url: u, 6974 email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, 6975 hostname: t, 6976 ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, 6977 ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, 6978 regex: T, 6979 uuid: l, 6980 "json-pointer": h, 6981 "json-pointer-uri-fragment": m, 6982 "relative-json-pointer": _ 6983 }; 6984 function f(O) { 6985 return O % 4 === 0 && (O % 100 !== 0 || O % 400 === 0); 6986 } 6987 function y(O) { 6988 var C = O.match(e); 6989 if (!C) return !1; 6990 var $ = +C[1], S = +C[2], E = +C[3]; 6991 return S >= 1 && S <= 12 && E >= 1 && E <= (S == 2 && f($) ? 29 : r[S]); 6992 } 6993 function v(O, C) { 6994 var $ = O.match(a); 6995 if (!$) return !1; 6996 var S = $[1], E = $[2], N = $[3], L = $[5]; 6997 return (S <= 23 && E <= 59 && N <= 59 || S == 23 && E == 59 && N == 60) && (!C || L); 6998 } 6999 var P = /t|\s/i; 7000 function I(O) { 7001 var C = O.split(P); 7002 return C.length == 2 && y(C[0]) && v(C[1], !0); 7003 } 7004 var A = /\/|:/; 7005 function b(O) { 7006 return A.test(O) && n.test(O); 7007 } 7008 var x = /[^\\]\\Z/; 7009 function T(O) { 7010 if (x.test(O)) return !1; 7011 try { 7012 return new RegExp(O), !0; 7013 } catch { 7014 return !1; 7015 } 7016 } 7017 return $a; 7018} 7019var Ia, ri; 7020function ad() { 7021 return ri || (ri = 1, Ia = function(e, r, a) { 7022 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.errSchemaPath + "/" + r, l = !e.opts.allErrors, h = "data" + (i || ""), m = "valid" + n, _, c; 7023 if (o == "#" || o == "#/") 7024 e.isRoot ? (_ = e.async, c = "validate") : (_ = e.root.schema.$async === !0, c = "root.refVal[0]"); 7025 else { 7026 var f = e.resolveRef(e.baseId, o, e.isRoot); 7027 if (f === void 0) { 7028 var y = e.MissingRefError.message(e.baseId, o); 7029 if (e.opts.missingRefs == "fail") { 7030 e.logger.error(y); 7031 var v = v || []; 7032 v.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: '$ref' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(u) + " , params: { ref: '" + e.util.escapeQuotes(o) + "' } ", e.opts.messages !== !1 && (t += " , message: 'can\\'t resolve reference " + e.util.escapeQuotes(o) + "' "), e.opts.verbose && (t += " , schema: " + e.util.toQuotedString(o) + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + h + " "), t += " } ") : t += " {} "; 7033 var P = t; 7034 t = v.pop(), !e.compositeRule && l ? e.async ? t += " throw new ValidationError([" + P + "]); " : t += " validate.errors = [" + P + "]; return false; " : t += " var err = " + P + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", l && (t += " if (false) { "); 7035 } else if (e.opts.missingRefs == "ignore") 7036 e.logger.warn(y), l && (t += " if (true) { "); 7037 else 7038 throw new e.MissingRefError(e.baseId, o, y); 7039 } else if (f.inline) { 7040 var I = e.util.copy(e); 7041 I.level++; 7042 var A = "valid" + I.level; 7043 I.schema = f.schema, I.schemaPath = "", I.errSchemaPath = o; 7044 var b = e.validate(I).replace(/validate\.schema/g, f.code); 7045 t += " " + b + " ", l && (t += " if (" + A + ") { "); 7046 } else 7047 _ = f.$async === !0 || e.async && f.$async !== !1, c = f.code; 7048 } 7049 if (c) { 7050 var v = v || []; 7051 v.push(t), t = "", e.opts.passContext ? t += " " + c + ".call(this, " : t += " " + c + "( ", t += " " + h + ", (dataPath || '')", e.errorPath != '""' && (t += " + " + e.errorPath); 7052 var x = i ? "data" + (i - 1 || "") : "parentData", T = i ? e.dataPathArr[i] : "parentDataProperty"; 7053 t += " , " + x + " , " + T + ", rootData) "; 7054 var O = t; 7055 if (t = v.pop(), _) { 7056 if (!e.async) throw new Error("async schema referenced by sync schema"); 7057 l && (t += " var " + m + "; "), t += " try { await " + O + "; ", l && (t += " " + m + " = true; "), t += " } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ", l && (t += " " + m + " = false; "), t += " } ", l && (t += " if (" + m + ") { "); 7058 } else 7059 t += " if (!" + O + ") { if (vErrors === null) vErrors = " + c + ".errors; else vErrors = vErrors.concat(" + c + ".errors); errors = vErrors.length; } ", l && (t += " else { "); 7060 } 7061 return t; 7062 }), Ia; 7063} 7064var Na, ai; 7065function sd() { 7066 return ai || (ai = 1, Na = function(e, r, a) { 7067 var t = " ", n = e.schema[r], i = e.schemaPath + e.util.getProperty(r), o = e.errSchemaPath + "/" + r, u = !e.opts.allErrors, l = e.util.copy(e), h = "";
7068 l.level++; 7069 var m = "valid" + l.level, _ = l.baseId, c = !0, f = n; 7070 if (f) 7071 for (var y, v = -1, P = f.length - 1; v < P; ) 7072 y = f[v += 1], (e.opts.strictKeywords ? typeof y == "object" && Object.keys(y).length > 0 || y === !1 : e.util.schemaHasRules(y, e.RULES.all)) && (c = !1, l.schema = y, l.schemaPath = i + "[" + v + "]", l.errSchemaPath = o + "/" + v, t += " " + e.validate(l) + " ", l.baseId = _, u && (t += " if (" + m + ") { ", h += "}")); 7073 return u && (c ? t += " if (true) { " : t += " " + h.slice(0, -1) + " "), t; 7074 }), Na; 7075} 7076var Da, si; 7077function nd() { 7078 return si || (si = 1, Da = function(e, r, a) { 7079 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""), _ = "valid" + n, c = "errs__" + n, f = e.util.copy(e), y = ""; 7080 f.level++; 7081 var v = "valid" + f.level, P = o.every(function(C) { 7082 return e.opts.strictKeywords ? typeof C == "object" && Object.keys(C).length > 0 || C === !1 : e.util.schemaHasRules(C, e.RULES.all); 7083 }); 7084 if (P) { 7085 var I = f.baseId; 7086 t += " var " + c + " = errors; var " + _ + " = false; "; 7087 var A = e.compositeRule; 7088 e.compositeRule = f.compositeRule = !0; 7089 var b = o; 7090 if (b) 7091 for (var x, T = -1, O = b.length - 1; T < O; ) 7092 x = b[T += 1], f.schema = x, f.schemaPath = u + "[" + T + "]", f.errSchemaPath = l + "/" + T, t += " " + e.validate(f) + " ", f.baseId = I, t += " " + _ + " = " + _ + " || " + v + "; if (!" + _ + ") { ", y += "}"; 7093 e.compositeRule = f.compositeRule = A, t += " " + y + " if (!" + _ + ") { var err = ", e.createErrors !== !1 ? (t += " { keyword: 'anyOf' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: {} ", e.opts.messages !== !1 && (t += " , message: 'should match some schema in anyOf' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} ", t += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", !e.compositeRule && h && (e.async ? t += " throw new ValidationError(vErrors); " : t += " validate.errors = vErrors; return false; "), t += " } else { errors = " + c + "; if (vErrors !== null) { if (" + c + ") vErrors.length = " + c + "; else vErrors = null; } ", e.opts.allErrors && (t += " } "); 7094 } else 7095 h && (t += " if (true) { "); 7096 return t; 7097 }), Da; 7098} 7099var ja, ni; 7100function id() { 7101 return ni || (ni = 1, ja = function(e, r, a) { 7102 var t = " ", n = e.schema[r], i = e.errSchemaPath + "/" + r; 7103 e.opts.allErrors; 7104 var o = e.util.toQuotedString(n); 7105 return e.opts.$comment === !0 ? t += " console.log(" + o + ");
7105" : typeof e.opts.$comment == "function" && (t += " self._opts.$comment(" + o + ", " + e.util.toQuotedString(i) + ", validate.root.schema);"), t; 7106 }), ja; 7107} 7108var Fa, ii; 7109function od() { 7110 return ii || (ii = 1, Fa = function(e, r, a) { 7111 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""), _ = "valid" + n, c = e.opts.$data && o && o.$data; 7112 c && (t += " var schema" + n + " = " + e.util.getData(o.$data, i, e.dataPathArr) + "; "), c || (t += " var schema" + n + " = validate.schema" + u + ";"), t += "var " + _ + " = equal(" + m + ", schema" + n + "); if (!" + _ + ") { "; 7113 var f = f || []; 7114 f.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: 'const' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { allowedValue: schema" + n + " } ", e.opts.messages !== !1 && (t += " , message: 'should be equal to constant' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7115 var y = t; 7116 return t = f.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + y + "]); " : t += " validate.errors = [" + y + "]; return false; " : t += " var err = " + y + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += " }", h && (t += " else { "), t; 7117 }), Fa; 7118} 7119var qa, oi; 7120function ud() { 7121 return oi || (oi = 1, qa = function(e, r, a) { 7122 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""), _ = "valid" + n, c = "errs__" + n, f = e.util.copy(e), y = ""; 7123 f.level++; 7124 var v = "valid" + f.level, P = "i" + n, I = f.dataLevel = e.dataLevel + 1, A = "data" + I, b = e.baseId, x = e.opts.strictKeywords ? typeof o == "object" && Object.keys(o).length > 0 || o === !1 : e.util.schemaHasRules(o, e.RULES.all); 7125 if (t += "var " + c + " = errors;var " + _ + ";", x) { 7126 var T = e.compositeRule; 7127 e.compositeRule = f.compositeRule = !0, f.schema = o, f.schemaPath = u, f.errSchemaPath = l, t += " var " + v + " = false; for (var " + P + " = 0; " + P + " < " + m + ".length; " + P + "++) { ", f.errorPath = e.util.getPathExpr(e.errorPath, P, e.opts.jsonPointers, !0); 7128 var O = m + "[" + P + "]"; 7129 f.dataPathArr[I] = P; 7130 var C = e.validate(f); 7131 f.baseId = b, e.util.varOccurences(C, A) < 2 ? t += " " + e.util.varReplace(C, A, O) + " " : t += " var " + A + " = " + O + "; " + C + " ", t += " if (" + v + ") break; } ", e.compositeRule = f.compositeRule = T, t += " " + y + " if (!" + v + ") {"; 7132 } else 7133 t += " if (" + m + ".length == 0) {"; 7134 var $ = $ || []; 7135 $.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: 'contains' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: {} ", e.opts.messages !== !1 && (t += " , message: 'should contain a valid item' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7136 var S = t; 7137 return t = $.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + S + "]); " : t += " validate.errors = [" + S + "]; return false; " : t += " var err = " + S + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += " } else { ", x && (t += " errors = " + c + "; if (vErrors !== null) { if (" + c + ") vErrors.length = " + c + "; else vErrors = null; } "), e.opts.allErrors && (t += " } "), t; 7138 }), qa; 7139} 7140var La, ui; 7141function ld() { 7142 return ui || (ui = 1, La = function(e, r, a) { 7143 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""), _ = "errs__" + n, c = e.util.copy(e), f = ""; 7144 c.level++; 7145 var y = "valid" + c.level, v = {}, P = {}, I = e.opts.ownProperties; 7146 for (T in o) 7147 if (T != "__proto__") { 7148 var A = o[T], b = Array.isArray(A) ? P : v; 7149 b[T] = A; 7150 } 7151 t += "var " + _ + " = errors;"; 7152 var x = e.errorPath; 7153 t += "var missing" + n + ";"; 7154 for (var T in P) 7155 if (b = P[T], b.length) { 7156 if (t += " if ( " + m + e.util.getProperty(T) + " !== undefined ", I && (t += " && Object.prototype.hasOwnProperty.call(" + m + ", '" + e.util.escapeQuotes(T) + "') "), h) { 7157 t += " && ( "; 7158 var O = b; 7159 if (O) 7160 for (var C, $ = -1, S = O.length - 1; $ < S; ) { 7161 C = O[$ += 1], $ && (t += " || "); 7162 var E = e.util.getProperty(C), N = m + E; 7163 t += " ( ( " + N + " === undefined ", I && (t += " || ! Object.prototype.hasOwnProperty.call(" + m + ", '" + e.util.escapeQuotes(C) + "') "), t += ") && (missing" + n + " = " + e.util.toQuotedString(e.opts.jsonPointers ? C : E) + ") ) "; 7164 } 7165 t += ")) { "; 7166 var L = "missing" + n, Z = "' + " + L + " + '"; 7167 e.opts._errorDataPathProperty && (e.errorPath = e.opts.jsonPointers ? e.util.getPathExpr(x, L, !0) : x + " + " + L); 7168 var re = re || []; 7169 re.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: 'dependencies' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { property: '" + e.util.escapeQuotes(T) + "', missingProperty: '" + Z + "', depsCount: " + b.length + ", deps: '" + e.util.escapeQuotes(b.length == 1 ? b[0] : b.join(", ")) + "' } ", e.opts.messages !== !1 && (t += " , message: 'should have ", b.length == 1 ? t += "property " + e.util.escapeQuotes(b[0]) : t += "properties " + e.util.escapeQuotes(b.join(", ")), t += " when property " + e.util.escapeQuotes(T) + " is present' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7170 var fe = t; 7171 t = re.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + fe + "]); " : t += " validate.errors = [" + fe + "]; return false; " : t += " var err = " + fe + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; 7172 } else { 7173 t += " ) { "; 7174 var ne = b; 7175 if (ne) 7176 for (var C, _e = -1, ce = ne.length - 1; _e < ce; ) { 7177 C = ne[_e += 1]; 7178 var E = e.util.getProperty(C), Z = e.util.escapeQuotes(C), N = m + E; 7179 e.opts._errorDataPathProperty && (e.errorPath = e.util.getPath(x, C, e.opts.jsonPointers)), t += " if ( " + N + " === undefined ", I && (t += " || ! Object.prototype.hasOwnProperty.call(" + m + ", '" + e.util.escapeQuotes(C) + "') "), t += ") { var err = ", e.createErrors !== !1 ? (t += " { keyword: 'dependencies' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { property: '" + e.util.escapeQuotes(T) + "', missingProperty: '" + Z + "', depsCount: " + b.length + ", deps: '" + e.util.escapeQuotes(b.length == 1 ? b[0] : b.join(", ")) + "' } ", e.opts.messages !== !1 && (t += " , message: 'should have ", b.length == 1 ? t += "property " + e.util.escapeQuotes(b[0]) : t += "properties " + e.util.escapeQuotes(b.join(", ")), t += " when property " + e.util.escapeQuotes(T) + " is present' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} ", t += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "; 7180 } 7181 } 7182 t += " } ", h && (f += "}", t += " else { "); 7183 } 7184 e.errorPath = x; 7185 var de = c.baseId; 7186 for (var T in v) { 7187 var A = v[T]; 7188 (e.opts.strictKeywords ? typeof A == "object" && Object.keys(A).length > 0 || A === !1 : e.util.schemaHasRules(A, e.RULES.all)) && (t += " " + y + " = true; if ( " + m + e.util.getProperty(T) + " !== undefined ", I && (t += " && Object.prototype.hasOwnProperty.call(" + m + ", '" + e.util.escapeQuotes(T) + "') "), t += ") { ", c.schema = A, c.schemaPath = u + e.util.getProperty(T), c.errSchemaPath = l + "/" + e.util.escapeFragment(T), t += " " + e.validate(c) + " ", c.baseId = de, t += " } ", h && (t += " if (" + y + ") { ", f += "}")); 7189 } 7190 return h && (t += " " + f + " if (" + _ + " == errors) {"), t; 7191 }), La; 7192} 7193var Za, li; 7194function cd() { 7195 return li || (li = 1, Za = function(e, r, a) { 7196 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""), _ = "valid" + n, c = e.opts.$data && o && o.$data; 7197 c && (t += " var schema" + n + " = " + e.util.getData(o.$data, i, e.dataPathArr) + "; "); 7198 var f = "i" + n, y = "schema" + n; 7199 c || (t += " var " + y + " = validate.schema" + u + ";"), t += "var " + _ + ";", c && (t += " if (schema" + n + " === undefined) " + _ + " = true; else if (!Array.isArray(schema" + n + ")) " + _ + " = false; else {"), t += "" + _ + " = false;for (var " + f + "=0; " + f + "<" + y + ".length; " + f + "++) if (equal(" + m + ", " + y + "[" + f + "])) { " + _ + " = true; break; }", c && (t += " } "), t += " if (!" + _ + ") { "; 7200 var v = v || []; 7201 v.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: 'enum' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { allowedValues: schema" + n + " } ", e.opts.messages !== !1 && (t += " , message: 'should be equal to one of the allowed values' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7202 var P = t; 7203 return t = v.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + P + "]); " : t += " validate.errors = [" + P + "]; return false; " : t += " var err = " + P + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += " }", h && (t += " else { "), t; 7204 }), Za; 7205} 7206var Ma, ci; 7207function dd() { 7208 return ci || (ci = 1, Ma = function(e, r, a) { 7209 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""); 7210 if (e.opts.format === !1) 7211 return h && (t += " if (true) { "), t; 7212 var _ = e.opts.$data && o && o.$data, c; 7213 _ ? (t += " var schema" + n + " = " + e.util.getData(o.$data, i, e.dataPathArr) + "; ", c = "schema" + n) : c = o; 7214 var f = e.opts.unknownFormats, y = Array.isArray(f); 7215 if (_) { 7216 var v = "format" + n, P = "isObject" + n, I = "formatType" + n; 7217 t += " var " + v + " = formats[" + c + "]; var " + P + " = typeof " + v + " == 'object' && !(" + v + " instanceof RegExp) && " + v + ".validate; var " + I + " = " + P + " && " + v + ".type || 'string'; if (" + P + ") { ", e.async && (t += " var async" + n + " = " + v + ".async; "), t += " " + v + " = " + v + ".validate; } if ( ", _ && (t += " (" + c + " !== undefined && typeof " + c + " != 'string') || "), t += " (", f != "ignore" && (t += " (" + c + " && !" + v + " ", y && (t += " && self._opts.unknownFormats.indexOf(" + c + ") == -1 "), t += ") || "), t += " (" + v + " && " + I + " == '" + a + "' && !(typeof " + v + " == 'function' ? ", e.async ? t += " (async" + n + " ? await " + v + "(" + m + ") : " + v + "(" + m + ")) " : t += " " + v + "(" + m + ") ", t += " : " + v + ".test(" + m + "))))) {"; 7218 } else { 7219 var v = e.formats[o]; 7220 if (!v) { 7221 if (f == "ignore") 7222 return e.logger.warn('unknown format "' + o + '" ignored in schema at path "' + e.errSchemaPath + '"'), h && (t += " if (true) { "), t; 7223 if (y && f.indexOf(o) >= 0) 7224 return h && (t += " if (true) { "), t; 7225 throw new Error('unknown format "' + o + '" is used in schema at path "' + e.errSchemaPath + '"'); 7226 } 7227 var P = typeof v == "object" && !(v instanceof RegExp) && v.validate, I = P && v.type || "string"; 7228 if (P) { 7229 var A = v.async === !0; 7230 v = v.validate; 7231 } 7232 if (I != a) 7233 return h && (t += " if (true) { "), t; 7234 if (A) { 7235 if (!e.async) throw new Error("async format in sync schema"); 7236 var b = "formats" + e.util.getProperty(o) + ".validate"; 7237 t += " if (!(await " + b + "(" + m + "))) { "; 7238 } else { 7239 t += " if (! "; 7240 var b = "formats" + e.util.getProperty(o); 7241 P && (b += ".validate"), typeof v == "function" ? t += " " + b + "(" + m + ") " : t += " " + b + ".test(" + m + ") ", t += ") { "; 7242 } 7243 } 7244 var x = x || []; 7245 x.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: 'format' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { format: ", _ ? t += "" + c : t += "" + e.util.toQuotedString(o), t += " } ", e.opts.messages !== !1 && (t += ` , message: 'should match format "`, _ ? t += "' + " + c + " + '" : t += "" + e.util.escapeQuotes(o), t += `"' `), e.opts.verbose && (t += " , schema: ", _ ? t += "validate.schema" + u : t += "" + e.util.toQuotedString(o), t += " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7246 var T = t; 7247 return t = x.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + T + "]); " : t += " validate.errors = [" + T + "]; return false; " : t += " var err = " + T + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += " } ", h && (t += " else { "), t; 7248 }), Ma; 7249} 7250var za, di; 7251function hd() { 7252 return di || (di = 1, za = function(e, r, a) { 7253 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""), _ = "valid" + n, c = "errs__" + n, f = e.util.copy(e); 7254 f.level++; 7255 var y = "valid" + f.level, v = e.schema.then, P = e.schema.else, I = v !== void 0 && (e.opts.strictKeywords ? typeof v == "object" && Object.keys(v).length > 0 || v === !1 : e.util.schemaHasRules(v, e.RULES.all)), A = P !== void 0 && (e.opts.strictKeywords ? typeof P == "object" && Object.keys(P).length > 0 || P === !1 : e.util.schemaHasRules(P, e.RULES.all)), b = f.baseId; 7256 if (I || A) { 7257 var x; 7258 f.createErrors = !1, f.schema = o, f.schemaPath = u, f.errSchemaPath = l, t += " var " + c + " = errors; var " + _ + " = true; "; 7259 var T = e.compositeRule; 7260 e.compositeRule = f.compositeRule = !0, t += " " + e.validate(f) + " ", f.baseId = b, f.createErrors = !0, t += " errors = " + c + "; if (vErrors !== null) { if (" + c + ") vErrors.length = " + c + "; else vErrors = null; } ", e.compositeRule = f.compositeRule = T, I ? (t += " if (" + y + ") { ", f.schema = e.schema.then, f.schemaPath = e.schemaPath + ".then", f.errSchemaPath = e.errSchemaPath + "/then", t += " " + e.validate(f) + " ", f.baseId = b, t += " " + _ + " = " + y + "; ", I && A ? (x = "ifClause" + n, t += " var " + x + " = 'then'; ") : x = "'then'", t += " } ", A && (t += " else { ")) : t += " if (!" + y + ") { ", A && (f.schema = e.schema.else, f.schemaPath = e.schemaPath + ".else", f.errSchemaPath = e.errSchemaPath + "/else", t += " " + e.validate(f) + " ", f.baseId = b, t += " " + _ + " = " + y + "; ", I && A ? (x = "ifClause" + n, t += " var " + x + " = 'else'; ") : x = "'else'", t += " } "), t += " if (!" + _ + ") { var err = ", e.createErrors !== !1 ? (t += " { keyword: 'if' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { failingKeyword: " + x + " } ", e.opts.messages !== !1 && (t += ` , message: 'should match "' + ` + x + ` + '" schema' `), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} ", t += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", !e.composit
7260eRule && h && (e.async ? t += " throw new ValidationError(vErrors); " : t += " validate.errors = vErrors; return false; "), t += " } ", h && (t += " else { "); 7261 } else 7262 h && (t += " if (true) { "); 7263 return t; 7264 }), za; 7265} 7266var Ua, hi; 7267function fd() { 7268 return hi || (hi = 1, Ua = function(e, r, a) { 7269 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""), _ = "valid" + n, c = "errs__" + n, f = e.util.copy(e), y = ""; 7270 f.level++; 7271 var v = "valid" + f.level, P = "i" + n, I = f.dataLevel = e.dataLevel + 1, A = "data" + I, b = e.baseId; 7272 if (t += "var " + c + " = errors;var " + _ + ";", Array.isArray(o)) { 7273 var x = e.schema.additionalItems; 7274 if (x === !1) { 7275 t += " " + _ + " = " + m + ".length <= " + o.length + "; "; 7276 var T = l; 7277 l = e.errSchemaPath + "/additionalItems", t += " if (!" + _ + ") { "; 7278 var O = O || []; 7279 O.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: 'additionalItems' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { limit: " + o.length + " } ", e.opts.messages !== !1 && (t += " , message: 'should NOT have more than " + o.length + " items' "), e.opts.verbose && (t += " , schema: false , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7280 var C = t; 7281 t = O.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + C + "]); " : t += " validate.errors = [" + C + "]; return false; " : t += " var err = " + C + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += " } ", l = T, h && (y += "}", t += " else { "); 7282 } 7283 var $ = o; 7284 if ($) { 7285 for (var S, E = -1, N = $.length - 1; E < N; ) 7286 if (S = $[E += 1], e.opts.strictKeywords ? typeof S == "object" && Object.keys(S).length > 0 || S === !1 : e.util.schemaHasRules(S, e.RULES.all)) { 7287 t += " " + v + " = true; if (" + m + ".length > " + E + ") { "; 7288 var L = m + "[" + E + "]"; 7289 f.schema = S, f.schemaPath = u + "[" + E + "]", f.errSchemaPath = l + "/" + E, f.errorPath = e.util.getPathExpr(e.errorPath, E, e.opts.jsonPointers, !0), f.dataPathArr[I] = E; 7290 var Z = e.validate(f); 7291 f.baseId = b, e.util.varOccurences(Z, A) < 2 ? t += " " + e.util.varReplace(Z, A, L) + " " : t += " var " + A + " = " + L + "; " + Z + " ", t += " } ", h && (t += " if (" + v + ") { ", y += "}"); 7292 } 7293 } 7294 if (typeof x == "object" && (e.opts.strictKeywords ? typeof x == "object" && Object.keys(x).length > 0 || x === !1 : e.util.schemaHasRules(x, e.RULES.all))) { 7295 f.schema = x, f.schemaPath = e.schemaPath + ".additionalItems", f.errSchemaPath = e.errSchemaPath + "/additionalItems", t += " " + v + " = true; if (" + m + ".length > " + o.length + ") { for (var " + P + " = " + o.length + "; " + P + " < " + m + ".length; " + P + "++) { ", f.errorPath = e.util.getPathExpr(e.errorPath, P, e.opts.jsonPointers, !0); 7296 var L = m + "[" + P + "]"; 7297 f.dataPathArr[I] = P; 7298 var Z = e.validate(f); 7299 f.baseId = b, e.util.varOccurences(Z, A) < 2 ? t += " " + e.util.varReplace(Z, A, L) + " " : t += " var " + A + " = " + L + "; " + Z + " ", h && (t += " if (!" + v + ") break; "), t += " } } ", h && (t += " if (" + v + ") { ", y += "}"); 7300 } 7301 } else if (e.opts.strictKeywords ? typeof o == "object" && Object.keys(o).length > 0 || o === !1 : e.util.schemaHasRules(o, e.RULES.all)) { 7302 f.schema = o, f.schemaPath = u, f.errSchemaPath = l, t += " for (var " + P + " = 0; " + P + " < " + m + ".length; " + P + "++) { ", f.errorPath = e.util.getPathExpr(e.errorPath, P, e.opts.jsonPointers, !0); 7303 var L = m + "[" + P + "]"; 7304 f.dataPathArr[I] = P; 7305 var Z = e.validate(f); 7306 f.baseId = b, e.util.varOccurences(Z, A) < 2 ? t += " " + e.util.varReplace(Z, A, L) + " " : t += " var " + A + " = " + L + "; " + Z + " ", h && (t += " if (!" + v + ") break; "), t += " }"; 7307 } 7308 return h && (t += " " + y + " if (" + c + " == errors) {"), t; 7309 }), Ua; 7310} 7311var Va, fi; 7312function pi() { 7313 return fi || (fi = 1, Va = function(e, r, a) { 7314 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, b, m = "data" + (i || ""), _ = e.opts.$data && o && o.$data, c; 7315 _ ? (t += " var schema" + n + " = " + e.util.getData(o.$data, i, e.dataPathArr) + "; ", c = "schema" + n) : c = o; 7316 var f = r == "maximum", y = f ? "exclusiveMaximum" : "exclusiveMinimum", v = e.schema[y], P = e.opts.$data && v && v.$data, I = f ? "<" : ">", A = f ? ">" : "<", b = void 0; 7317 if (!(_ || typeof o == "number" || o === void 0)) 7318 throw new Error(r + " must be number"); 7319 if (!(P || v === void 0 || typeof v == "number" || typeof v == "boolean")) 7320 throw new Error(y + " must be number or boolean"); 7321 if (P) { 7322 var x = e.util.getData(v.$data, i, e.dataPathArr), T = "exclusive" + n, O = "exclType" + n, C = "exclIsNumber" + n, $ = "o
7322p" + n, S = "' + " + $ + " + '"; 7323 t += " var schemaExcl" + n + " = " + x + "; ", x = "schemaExcl" + n, t += " var " + T + "; var " + O + " = typeof " + x + "; if (" + O + " != 'boolean' && " + O + " != 'undefined' && " + O + " != 'number') { "; 7324 var b = y, E = E || []; 7325 E.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: '" + (b || "_exclusiveLimit") + "' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: {} ", e.opts.messages !== !1 && (t += " , message: '" + y + " should be boolean' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7326 var N = t; 7327 t = E.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + N + "]); " : t += " validate.errors = [" + N + "]; return false; " : t += " var err = " + N + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += " } else if ( ", _ && (t += " (" + c + " !== undefined && typeof " + c + " != 'number') || "), t += " " + O + " == 'number' ? ( (" + T + " = " + c + " === undefined || " + x + " " + I + "= " + c + ") ? " + m + " " + A + "= " + x + " : " + m + " " + A + " " + c + " ) : ( (" + T + " = " + x + " === true) ? " + m + " " + A + "= " + c + " : " + m + " " + A + " " + c + " ) || " + m + " !== " + m + ") { var op" + n + " = " + T + " ? '" + I + "' : '" + I + "='; ", o === void 0 && (b = y, l = e.errSchemaPath + "/" + y, c = x, _ = P); 7328 } else { 7329 var C = typeof v == "number", S = I; 7330 if (C && _) { 7331 var $ = "'" + S + "'"; 7332 t += " if ( ", _ && (t += " (" + c + " !== undefined && typeof " + c + " != 'number') || "), t += " ( " + c + " === undefined || " + v + " " + I + "= " + c + " ? " + m + " " + A + "= " + v + " : " + m + " " + A + " " + c + " ) || " + m + " !== " + m + ") { "; 7333 } else { 7334 C && o === void 0 ? (T = !0, b = y, l = e.errSchemaPath + "/" + y, c = v, A += "=") : (C && (c = Math[f ? "min" : "max"](v, o)), v === (C ? c : !0) ? (T = !0, b = y, l = e.errSchemaPath + "/" + y, A += "=") : (T = !1, S += "=")); 7335 var $ = "'" + S + "'"; 7336 t += " if ( ", _ && (t += " (" + c + " !== undefined && typeof " + c + " != 'number') || "), t += " " + m + " " + A + " " + c + " || " + m + " !== " + m + ") { "; 7337 } 7338 } 7339 b = b || r; 7340 var E = E || []; 7341 E.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: '" + (b || "_limit") + "' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { comparison: " + $ + ", limit: " + c + ", exclusive: " + T + " } ", e.opts.messages !== !1 && (t += " , message: 'should be " + S + " ", _ ? t += "' + " + c : t += "" + c + "'"), e.opts.verbose && (t += " , schema: ", _ ? t += "validate.schema" + u : t += "" + o, t += " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7342 var N = t; 7343 return t = E.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + N + "]); " : t += " validate.errors = [" + N + "]; return false; " : t += " var err = " + N + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += " } ", h && (t += " else { "), t; 7344 }), Va; 7345} 7346var Ha, mi; 7347function vi() { 7348 return mi || (mi = 1, Ha = function(e, r, a) { 7349 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, y, m = "data" + (i || ""), _ = e.opts.$data && o && o.$data, c; 7350 if (_ ? (t += " var schema" + n + " = " + e.util.getData(o.$data, i, e.dataPathArr) + "; ", c = "schema" + n) : c = o, !(_ || typeof o == "number")) 7351 throw new Error(r + " must be number"); 7352 var f = r == "maxItems" ? ">" : "<"; 7353 t += "if ( ", _ && (t += " (" + c + " !== undefined && typeof " + c + " != 'number') || "), t += " " + m + ".length " + f + " " + c + ") { "; 7354 var y = r, v = v || []; 7355 v.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: '" + (y || "_limitItems") + "' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { limit: " + c + " } ", e.opts.messages !== !1 && (t += " , message: 'should NOT have ", r == "maxItems" ? t += "more" : t += "fewer", t += " than ", _ ? t += "' + " + c + " + '" : t += "" + o, t += " items' "), e.opts.verbose && (t += " , schema: ", _ ? t += "validate.schema" + u : t += "" + o, t += " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7356 var P = t; 7357 return t = v.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + P + "]); " : t += " validate.errors = [" + P + "]; return false; " : t += " var err = " + P + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += "} ", h && (t += " else { "), t; 7358 }), Ha; 7359} 7360var Ba, gi; 7361function yi() { 7362 return gi || (gi = 1, Ba = function(e, r, a) { 7363 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, y, m = "data" + (i || ""), _ = e.opts.$data && o && o.$data, c; 7364 if (_ ? (t += " var schema" + n + " = " + e.util.getData(o.$data, i, e.dataPathArr) + "; ", c = "schema" + n) : c = o, !(_ || typeof o == "number")) 7365 throw new Error(r + " must be number"); 7366 var f = r == "maxLength" ? ">" : "<"; 7367 t += "if ( ", _ && (t += " (" + c + " !== undefined && typeof " + c + " != 'number') || "), e.opts.unicode === !1 ? t += " " + m + ".length " : t += " ucs2length(" + m + ") ", t += " " + f + " " + c + ") { "; 7368 var y = r, v = v || []; 7369 v.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: '" + (y || "_limitLength") + "' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { limit: " + c + " } ", e.opts.messages !== !1 && (t += " , message: 'should NOT be ", r == "maxLength" ? t += "longer" : t += "shorter", t += " than ", _ ? t += "' + " + c + " + '" : t += "" + o, t += " characters' "), e.opts.verbose && (t += " , schema: ", _ ? t += "validate.schema" + u : t += "" + o, t += " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7370 var P = t; 7371 return t = v.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + P + "]); " : t += " validate.errors = [" + P + "]; return false; " : t += " var err = " + P + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += "} ", h && (t += " else { "), t; 7372 }), Ba; 7373} 7374var Qa, _i; 7375function bi() { 7376 return _i || (_i = 1, Qa = function(e, r, a) { 7377 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, y, m = "data" + (i || ""), _ = e.opts.$data && o && o.$data, c; 7378 if (_ ? (t += " var schema" + n + " = " + e.util.getData(o.$data, i, e.dataPathArr) + "; ", c = "schema" + n) : c = o, !(_ || typeof o == "number")) 7379 throw new Error(r + " must be number"); 7380 var f = r == "maxProperties" ? ">" : "<"; 7381 t += "if ( ", _ && (t += " (" + c + " !== undefined && typeof " + c + " != 'number') || "), t += " Object.keys(" + m + ").length " + f + " " + c + ") { "; 7382 var y = r, v = v || []; 7383 v.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: '" + (y || "_limitProperties") + "' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { limit: " + c + " } ", e.opts.messages !== !1 && (t += " , message: 'should NOT have ", r == "maxProperties" ? t += "more" : t += "fewer", t += " than ", _ ? t += "' + " + c + " + '" : t += "" + o, t += " properties' "), e.opts.verbose && (t += " , schema: ", _ ? t += "validate.schema" + u : t += "" + o, t += " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7384 var P = t; 7385 return t = v.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + P + "]); " : t += " validate.errors = [" + P + "]; return false; " : t += " var err = " + P + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += "} ", h && (t += " else { "), t; 7386 }), Qa; 7387} 7388var Ka, Pi; 7389function pd() { 7390 return Pi || (Pi = 1, Ka = function(e, r, a) { 7391 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""), _ = e.opts.$data && o && o.$data, c; 7392 if (_ ? (t += " var schema" + n + " = " + e.util.getData(o.$data, i, e.dataPathArr) + "; ", c = "schema" + n) : c = o, !(_ || typeof o == "number")) 7393 throw new Error(r + " must be number"); 7394 t += "var division" + n + ";if (", _ && (t += " " + c + " !== undefined && ( typeof " + c + " != 'number' || "), t += " (division" + n + " = " + m + " / " + c + ", ", e.opts.multipleOfPrecision ? t += " Math.abs(Math.round(division" + n + ") - division" + n + ") > 1e-" + e.opts.multipleOfPrecision + " " : t += " division" + n + " !== parseInt(division" + n + ") ", t += " ) ", _ && (t += " ) "), t += " ) { "; 7395 var f = f || []; 7396 f.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: 'multipleOf' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { multipleOf: " + c + " } ", e.opts.messages !== !1 && (t += " , message: 'should be multiple of ", _ ? t += "' + " + c : t += "" + c + "'"), e.opts.verbose && (t += " , schema: ", _ ? t += "validate.schema" + u : t += "" + o, t += " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7397 var y = t; 7398 return t = f.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + y + "]); " : t += " validate.errors = [" + y + "]; return false; " : t += " var err = " + y + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += "} ", h && (t += " else { "), t; 7399 }), Ka; 7400} 7401var Ja, Si; 7402function md() { 7403 return Si || (Si = 1, Ja = function(e, r, a) { 7404 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""), _ = "errs__" + n, c = e.util.copy(e); 7405 c.level++; 7406 var f = "valid" + c.level; 7407 if (e.opts.strictKeywords ? typeof o == "object" && Object.keys(o).length > 0 || o === !1 : e.util.schemaHasRules(o, e.RULES.all)) { 7408 c.schema = o, c.schemaPath = u, c.errSchemaPath = l, t += " var " + _ + " = errors; "; 7409 var y = e.compositeRule; 7410 e.compositeRule = c.compositeRule = !0, c.createErrors = !1; 7411 var v; 7412 c.opts.allErrors && (v = c.opts.allErrors, c.opts.allErrors = !1), t += " " + e.validate(c) + " ", c.createErrors = !0, v && (c.opts.allErrors = v), e.compositeRule = c.compositeRule = y, t += " if (" + f + ") { "; 7413 var P = P || []; 7414 P.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: 'not' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: {} ", e.opts.messages !== !1 && (t += " , message: 'should NOT be valid' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7415 var I = t; 7416 t = P.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + I + "]); " : t += " validate.errors = [" + I + "]; return false; " : t += " var err = " + I + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += " } else { errors = " + _ + "; if (vErrors !== null) { if (" + _ + ") vErrors.length = " + _ + "; else vErrors = null; } ", e.opts.allErrors && (t += " } "); 7417 } else 7418 t += " var err = ", e.createErrors !== !1 ? (t += " { keyword: 'not' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: {} ", e.opts.messages !== !1 && (t += " , message: 'should NOT be valid' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} ", t += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", h && (t += " if (false) { "); 7419 return t; 7420 }), Ja; 7421} 7422var Wa, wi; 7423function vd() { 7424 return wi || (wi = 1, Wa = function(e, r, a) { 7425 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""), _ = "valid" + n, c = "errs__" + n, f = e.util.copy(e), y = ""; 7426 f.level++; 7427 var v = "valid" + f.level, P = f.baseId, I = "prevValid" + n, A = "passingSchemas" + n; 7428 t += "var " + c + " = errors , " + I + " = false , " + _ + " = false , " + A + " = null; "; 7429 var b = e.compositeRule; 7430 e.compositeRule = f.compositeRule = !0; 7431 var x = o; 7432 if (x) 7433 for (var T, O = -1, C = x.length - 1; O < C; ) 7434 T = x[O += 1], (e.opts.strictKeywords ? typeof T == "object" && Object.keys(T).length > 0 || T === !1 : e.util.schemaHasRules(T, e.RULES.all)) ? (f.schema = T, f.schemaPath = u + "[" + O + "]", f.errSchemaPath = l + "/" + O, t += " " + e.validate(f) + " ", f.baseId = P) : t += " var " + v + " = true; ", O && (t += " if (" + v + " && " + I + ") { " + _ + " = false; " + A + " = [" + A + ", " + O + "]; } else { ", y += "}"), t += " if (" + v + ") { " + _ + " = " + I + " = true; " + A + " = " + O + "; }"; 7435 return e.compositeRule = f.compositeRule = b, t += "" + y + "if (!" + _ + ") { var err = ", e.createErrors !== !1 ? (t += " { keyword: 'oneOf' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { passingSchemas: " + A + " } ", e.opts.messages !== !1 && (t += " , message: 'should match exactly one schema in oneOf' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} ", t += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", !e.compositeRule && h && (e.async ? t += " throw new ValidationError(vErrors); " : t += " validate.errors = vErrors; return false; "), t += "} else { errors = " + c + "; if (vErrors !== null) { if (" + c + ") vErrors.length = " + c + "; else vErrors = null; }", e.opts.allErrors && (t += " } "), t; 7436 }), Wa; 7437} 7438var Ga, xi; 7439function gd() { 7440 return xi || (xi = 1, Ga = function(e, r, a) { 7441 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""), _ = e.opts.$data && o && o.$data, c; 7442 _ ? (t += " var schema" + n + " = " + e.util.getData(o.$data, i, e.dataPathArr) + "; ", c = "schema" + n) : c = o; 7443 var f = _ ? "(new RegExp(" + c + "))" : e.usePattern(o); 7444 t += "if ( ", _ && (t += " (" + c + " !== undefined && typeof " + c + " != 'string') || "), t += " !" + f + ".test(" + m + ") ) { "; 7445 var y = y || []; 7446 y.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: 'pattern' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { pattern: ", _ ? t += "" + c : t += "" + e.util.toQuotedString(o), t += " } ", e.opts.messages !== !1 && (t += ` , message: 'should match pattern "`, _ ? t += "' + " + c + " + '" : t += "" + e.util.escapeQuotes(o), t += `"' `), e.opts.verbose && (t += " , schema: ", _ ? t += "validate.schema" + u : t += "" + e.util.toQuotedString(o), t += " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7447 var v = t; 7448 return t = y.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + v + "]); " : t += " validate.errors = [" + v + "]; return false; " : t += " var err = " + v + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += "} ", h && (t += " else
7448{ "), t; 7449 }), Ga; 7450} 7451var Ya, Ei; 7452function yd() { 7453 return Ei || (Ei = 1, Ya = function(e, r, a) { 7454 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""), _ = "errs__" + n, c = e.util.copy(e), f = ""; 7455 c.level++; 7456 var y = "valid" + c.level, v = "key" + n, P = "idx" + n, I = c.dataLevel = e.dataLevel + 1, A = "data" + I, b = "dataProperties" + n, x = Object.keys(o || {}).filter(_e), T = e.schema.patternProperties || {}, O = Object.keys(T).filter(_e), C = e.schema.additionalProperties, $ = x.length || O.length, S = C === !1, E = typeof C == "object" && Object.keys(C).length, N = e.opts.removeAdditional, L = S || E || N, Z = e.opts.ownProperties, re = e.baseId, fe = e.schema.required; 7457 if (fe && !(e.opts.$data && fe.$data) && fe.length < e.opts.loopRequired) 7458 var ne = e.util.toHash(fe); 7459 function _e(ga) { 7460 return ga !== "__proto__"; 7461 } 7462 if (t += "var " + _ + " = errors;var " + y + " = true;", Z && (t += " var " + b + " = undefined;"), L) { 7463 if (Z ? t += " " + b + " = " + b + " || Object.keys(" + m + "); for (var " + P + "=0; " + P + "<" + b + ".length; " + P + "++) { var " + v + " = " + b + "[" + P + "]; " : t += " for (var " + v + " in " + m + ") { ", $) { 7464 if (t += " var isAdditional" + n + " = !(false ", x.length) 7465 if (x.length > 8) 7466 t += " || validate.schema" + u + ".hasOwnProperty(" + v + ") "; 7467 else { 7468 var ce = x; 7469 if (ce) 7470 for (var de, tt = -1, Ge = ce.length - 1; tt < Ge; ) 7471 de = ce[tt += 1], t += " || " + v + " == " + e.util.toQuotedString(de) + " "; 7472 } 7473 if (O.length) { 7474 var Je = O; 7475 if (Je) 7476 for (var Ze, mt = -1, w = Je.length - 1; mt < w; ) 7477 Ze = Je[mt += 1], t += " || " + e.usePattern(Ze) + ".test(" + v + ") "; 7478 } 7479 t += " ); if (isAdditional" + n + ") { "; 7480 } 7481 if (N == "all") 7482 t += " delete " + m + "[" + v + "]; "; 7483 else { 7484 var D = e.errorPath, B = "' + " + v + " + '"; 7485 if (e.opts._errorDataPathProperty && (e.errorPath = e.util.getPathExpr(e.errorPath, v, e.opts.jsonPointers)), S) 7486 if (N) 7487 t += " delete " + m + "[" + v + "]; "; 7488 else { 7489 t += " " + y + " = false; "; 7490 var le = l; 7491 l = e.errSchemaPath + "/additionalProperties"; 7492 var j = j || []; 7493 j.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: 'additionalProperties' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { additionalProperty: '" + B + "' } ", e.opts.messages !== !1 && (t += " , message: '", e.opts._errorDataPathProperty ? t += "is an invalid additional property" : t += "should NOT have additional properties", t += "' "), e.opts.verbose && (t += " , schema: false , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7494 var V = t; 7495 t = j.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + V + "]); " : t += " validate.errors = [" + V + "]; return false; " : t += " var err = " + V + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", l = le, h && (t += " break; "); 7496 } 7497 else if (E) 7498 if (N == "failing") { 7499 t += " var " + _ + " = errors; "; 7500 var ve = e.compositeRule; 7501 e.compositeRule = c.compositeRule = !0, c.schema = C, c.schemaPath = e.schemaPath + ".additionalProperties", c.errSchemaPath = e.errSchemaPath + "/additionalProperties", c.errorPath = e.opts._errorDataPathProperty ? e.errorPath : e.util.getPathExpr(e.errorPath, v, e.opts.jsonPointers); 7502 var Se = m + "[" + v + "]"; 7503 c.dataPathArr[I] = v; 7504 var be = e.validate(c); 7505 c.baseId = re, e.util.varOccurences(be, A) < 2 ? t += " " + e.util.varReplace(be, A, Se) + " " : t += " var " + A + " = " + Se + "; " + be + " ", t += " if (!" + y + ") { errors = " + _ + "; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete " + m + "[" + v + "]; } ", e.compositeRule = c.compositeRule = ve; 7506 } else { 7507 c.schema = C, c.schemaPath = e.schemaPath + ".additionalProperties", c.errSchemaPath = e.errSchemaPath + "/additionalProperties", c.errorPath = e.opts._errorDataPathProperty ? e.errorPath : e.util.getPathExpr(e.errorPath, v, e.opts.jsonPointers); 7508 var Se = m + "[" + v + "]"; 7509 c.dataPathArr[I] = v; 7510 var be = e.validate(c); 7511 c.baseId = re, e.util.varOccurences(be, A) < 2 ? t += " " + e.util.varReplace(be, A, Se) + " " : t += " var " + A + " = " + Se + "; " + be + " ", h && (t += " if (!" + y + ") break; "); 7512 } 7513 e.errorPath = D; 7514 } 7515 $ && (t += " } "), t += " } ", h && (t += " if (" + y + ") { ", f += "}"); 7516 } 7517 var Ne = e.opts.useDefaults && !e.compositeRule; 7518 if (x.length) { 7519 var Te = x; 7520 if (Te) 7521 for (var de, Ae = -1, Ye = Te.length - 1; Ae < Ye; ) { 7522 de = Te[Ae += 1]; 7523 var Fe = o[de]; 7524 if (e.opts.strictKeywords ? typeof Fe == "object" && Object.keys(Fe).length > 0 || Fe === !1 : e.util.schemaHasRules(Fe, e.RULES.all)) { 7525 var wt = e.util.getProperty(de), Se = m + wt, rt = Ne && Fe.default !== void 0; 7526 c.schema = Fe, c.schemaPath = u + wt, c.errSchemaPath = l + "/" + e.util.escapeFragment(de), c.errorPath = e.util.getPath(e.errorPath, de, e.opts.jsonPointers), c.dataPathArr[I] = e.util.toQuotedString(de); 7527 var be = e.validate(c); 7528 if (c.baseId = re, e.util.varOccurences(be, A) < 2) { 7529 be = e.util.varReplace(be, A, Se); 7530 var Le = Se; 7531 } else { 7532 var Le = A; 7533 t += " var " + A + " = " + Se + "; "; 7534 } 7535 if (rt) 7536 t += " " + be + " "; 7537 else { 7538 if (ne && ne[de]) { 7539 t += " if ( " + Le + " === undefined ", Z && (t += " || ! Object.prototype.hasOwnProperty.call(" + m + ", '" + e.util.escapeQuotes(de) + "') "), t += ") { " + y + " = false; "; 7540 var D = e.errorPath, le = l, Me = e.util.escapeQuotes(de); 7541 e.opts._errorDataPathProperty && (e.errorPath = e.util.getPath(D, de, e.opts.jsonPointers)), l = e.errSchemaPath + "/required"; 7542 var j = j || []; 7543 j.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: 'required' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { missingProperty: '" + Me + "' } ", e.opts.messages !== !1 && (t += " , message: '", e.opts._errorDataPathProperty ? t += "is a required property" : t += "should have required property \\'" + Me + "\\'", t += "' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7544 var V = t; 7545 t = j.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + V + "]); " : t += " validate.errors = [" + V + "]; return false; " : t += " var err = " + V + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", l = le, e.errorPath = D, t += " } else { "; 7546 } else 7547 h ? (t += " if ( " + Le + " === undefined ", Z && (t += " || ! Object.prototype.hasOwnProperty.call(" + m + ", '" + e.util.escapeQuotes(de) + "') "), t += ") { " + y + " = true; } else { ") : (t += " if (" + Le + " !== undefined ", Z && (t += " && Object.prototype.hasOwnProperty.call(" + m + ", '" + e.util.escapeQuotes(de) + "') "), t += " ) { "); 7548 t += " " + be + " } "; 7549 } 7550 } 7551 h && (t += " if (" + y + ") { ", f += "}"); 7552 } 7553 } 7554 if (O.length) { 7555 var lt = O; 7556 if (lt) 7557 for (var Ze, Fr = -1, va = lt.length - 1; Fr < va; ) { 7558 Ze = lt[Fr += 1]; 7559 var Fe = T[Ze]; 7560 if (e.opts.strictKeywords ? typeof Fe == "object" && Object.keys(Fe).length > 0 || Fe === !1 : e.util.schemaHasRules(Fe, e.RULES.all)) { 7561 c.schema = Fe, c.schemaPath = e.schemaPath + ".patternProperties" + e.util.getProperty(Ze), c.errSchemaPath = e.errSchemaPath + "/patternProperties/" + e.util.escapeFragment(Ze), Z ? t += " " + b + " = " + b + " || Object.keys(" + m + "); for (var " + P + "=0; " + P + "<" + b + ".length; " + P + "++) { var " + v + " = " + b + "[" + P + "]; " : t += " for (var " + v + " in " + m + ") { ", t += " if (" + e.usePattern(Ze) + ".test(" + v + ")) { ", c.errorPath = e.util.getPathExpr(e.errorPath, v, e.opts.jsonPointers); 7562 var Se = m + "[" + v + "]"; 7563 c.dataPathArr[I] = v; 7564 var be = e.validate(c); 7565 c.baseId = re, e.util.varOccurences(be, A) < 2 ? t += " " + e.util.varReplace(be, A, Se) + " " : t += " var " + A + " = " + Se + "; " + be + " ", h && (t += " if (!" + y + ") break; "), t += " } ", h && (t += " else " + y + " = true; "), t += " } ", h && (t += " if (" + y + ") { ", f += "}"); 7566 } 7567 } 7568 } 7569 return h && (t += " " + f + " if (" + _ + " == errors) {"), t; 7570 }), Ya; 7571} 7572var Xa, Ri; 7573function _d() { 7574 return Ri || (Ri = 1, Xa = function(e, r, a) { 7575 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""), _ = "errs__" + n, c = e.util.copy(e), f = ""; 7576 c.level++; 7577 var y = "valid" + c.level; 7578 if (t += "var " + _ + " = errors;", e.opts.strictKeywords ? typeof o == "object" && Object.keys(o).length > 0 || o === !1 : e.util.schemaHasRules(o, e.RULES.all)) { 7579 c.schema = o, c.schemaPath = u, c.errSchemaPath = l; 7580 var v = "key" + n, P = "idx" + n, I = "i" + n, A = "' + " + v + " + '", b = c.dataLevel = e.dataLevel + 1, x = "data" + b, T = "dataProperties" + n, O = e.opts.ownProperties, C = e.baseId; 7581 O && (t += " var " + T + " = undefined; "), O ? t += " " + T + " = " + T + " || Object.keys(" + m + "); for (var " + P + "=0; " + P + "<" + T + ".length; " + P + "++) { var " + v + " = " + T + "[" + P + "]; " : t += " for (var " + v + " in " + m + ") { ", t += " var startErrs" + n + " = errors; "; 7582 var $ = v, S = e.compositeRule; 7583 e.compositeRule = c.compositeRule = !0; 7584 var E = e.validate(c); 7585 c.baseId = C, e.util.varOccurences(E, x) < 2 ? t += " " + e.util.varReplace(E, x, $) + " " : t += " var " + x + " = " + $ + "; " + E + " ", e.compositeRule = c.compositeRule = S, t += " if (!" + y + ") { for (var " + I + "=startErrs" + n + "; " + I + "<errors; " + I + "++) { vErrors[" + I + "].propertyName = " + v + "; } var err = ", e.createErrors !== !1 ? (t += " { keyword: 'propertyNames' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { propertyName: '" + A + "' } ", e.opts.messages !== !1 && (t += " , message: 'property name \\'" + A + "\\' is invali
7585d' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} ", t += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", !e.compositeRule && h && (e.async ? t += " throw new ValidationError(vErrors); " : t += " validate.errors = vErrors; return false; "), h && (t += " break; "), t += " } }"; 7586 } 7587 return h && (t += " " + f + " if (" + _ + " == errors) {"), t; 7588 }), Xa; 7589} 7590var es, ki; 7591function bd() { 7592 return ki || (ki = 1, es = function(e, r, a) { 7593 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""), _ = "valid" + n, c = e.opts.$data && o && o.$data; 7594 c && (t += " var schema" + n + " = " + e.util.getData(o.$data, i, e.dataPathArr) + "; "); 7595 var f = "schema" + n; 7596 if (!c) 7597 if (o.length < e.opts.loopRequired && e.schema.properties && Object.keys(e.schema.properties).length) { 7598 var y = [], v = o; 7599 if (v) 7600 for (var P, I = -1, A = v.length - 1; I < A; ) { 7601 P = v[I += 1]; 7602 var b = e.schema.properties[P]; 7603 b && (e.opts.strictKeywords ? typeof b == "object" && Object.keys(b).length > 0 || b === !1 : e.util.schemaHasRules(b, e.RULES.all)) || (y[y.length] = P); 7604 } 7605 } else 7606 var y = o; 7607 if (c || y.length) { 7608 var x = e.errorPath, T = c || y.length >= e.opts.loopRequired, O = e.opts.ownProperties; 7609 if (h) 7610 if (t += " var missing" + n + "; ", T) { 7611 c || (t += " var " + f + " = validate.schema" + u + "; "); 7612 var C = "i" + n, $ = "schema" + n + "[" + C + "]", S = "' + " + $ + " + '"; 7613 e.opts._errorDataPathProperty && (e.errorPath = e.util.getPathExpr(x, $, e.opts.jsonPointers)), t += " var " + _ + " = true; ", c && (t += " if (schema" + n + " === undefined) " + _ + " = true; else if (!Array.isArray(schema" + n + ")) " + _ + " = false; else {"), t += " for (var " + C + " = 0; " + C + " < " + f + ".length; " + C + "++) { " + _ + " = " + m + "[" + f + "[" + C + "]] !== undefined ", O && (t += " && Object.prototype.hasOwnProperty.call(" + m + ", " + f + "[" + C + "]) "), t += "; if (!" + _ + ") break; } ", c && (t += " } "), t += " if (!" + _ + ") { "; 7614 var E = E || []; 7615 E.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: 'required' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { missingProperty: '" + S + "' } ", e.opts.messages !== !1 && (t += " , message: '", e.opts._errorDataPathProperty ? t += "is a required property" : t += "should have required property \\'" + S + "\\'", t += "' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7616 var N = t; 7617 t = E.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + N + "]); " : t += " validate.errors = [" + N + "]; return false; " : t += " var err = " + N + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += " } else { "; 7618 } else { 7619 t += " if ( "; 7620 var L = y; 7621 if (L) 7622 for (var Z, C = -1, re = L.length - 1; C < re; ) { 7623 Z = L[C += 1], C && (t += " || "); 7624 var fe = e.util.getProperty(Z), ne = m + fe; 7625 t += " ( ( " + ne + " === undefined ", O && (t += " || ! Object.prototype.hasOwnProperty.call(" + m + ", '" + e.util.escapeQuotes(Z) + "') "), t += ") && (missing" + n + " = " + e.util.toQuotedString(e.opts.jsonPointers ? Z : fe) + ") ) "; 7626 } 7627 t += ") { "; 7628 var $ = "missing" + n, S = "' + " + $ + " + '"; 7629 e.opts._errorDataPathProperty && (e.errorPath = e.opts.jsonPointers ? e.util.getPathExpr(x, $, !0) : x + " + " + $); 7630 var E = E || []; 7631 E.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: 'required' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { missingProperty: '" + S + "' } ", e.opts.messages !== !1 && (t += " , message: '", e.opts._errorDataPathProperty ? t += "is a required property" : t += "should have required property \\'" + S + "\\'", t += "' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7632 var N = t; 7633 t = E.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + N + "]); " : t += " validate.errors = [" + N + "]; return false; " : t += " var err = " + N + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += " } else { "; 7634 } 7635 else if (T) { 7636 c || (t += " var " + f + " = validate.schema" + u + "; "); 7637 var C = "i" + n, $ = "schema" + n + "[" + C + "]", S = "' + " + $ + " + '"; 7638 e.opts._errorDataPathProperty && (e.errorPath = e.util.getPathExpr(x, $, e.opts.jsonPointers)), c && (t += " if (" + f + " && !Array.isArray(" + f + ")) { var err = ", e.createErrors !== !1 ? (t += " { keyword: 'required' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { missingProperty: '" + S + "' } ", e.opts.messages !== !1 && (t += " , message: '", e.opts._errorDataPathProperty ? t += "is a required property" : t += "should have required property \\'" + S + "\\'", t += "' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} ", t += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (" + f + " !== undefined) { "), t += " for (var " + C + " = 0; " + C + " < " + f + ".length; " + C + "++) { if (" + m + "[" + f + "[" + C + "]] === undefined ", O && (t += " || ! Object.prototype.hasOwnProperty.call(" + m + ", " + f + "[" + C + "]) "), t += ") { var err = ", e.createErrors !== !1 ? (t += " { keyword: 'required' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { missingProperty: '" + S + "' } ", e.opts.messages !== !1 && (t += " , message: '", e.opts._errorDataPathProperty ? t += "is a required property" : t += "should have required property \\'" + S + "\\'", t += "' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} ", t += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ", c && (t += " } "); 7639 } else { 7640 var _e = y; 7641 if (_e) 7642 for (var Z, ce = -1, de = _e.length - 1; ce < de; ) { 7643 Z = _e[ce += 1]; 7644 var fe = e.util.getProperty(Z), S = e.util.escapeQuotes(Z), ne = m + fe; 7645 e.opts._errorDataPathProperty && (e.errorPath = e.util.getPath(x, Z, e.opts.jsonPointers)), t += " if ( " + ne + " === undefined ", O && (t += " || ! Object.prototype.hasOwnProperty.call(" + m + ", '" + e.util.escapeQuotes(Z) + "') "), t += ") { var err = ", e.createErrors !== !1 ? (t += " { keyword: 'required' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { missingProperty: '" + S + "' } ", e.opts.messages !== !1 && (t += " , message: '", e.opts._errorDataPathProperty ? t += "is a required property" : t += "should have required property \\'" + S + "\\'", t += "' "), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} ", t += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "; 7646 } 7647 } 7648 e.errorPath = x; 7649 } else h && (t += " if (true) {"); 7650 return t; 7651 }), es; 7652} 7653var ts, Ti; 7654function Pd() { 7655 return Ti || (Ti = 1, ts = function(e, r, a) { 7656 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m = "data" + (i || ""), _ = "valid" + n, c = e.opts.$data && o && o.$data, f; 7657 if (c ? (t += " var schema" + n + " = " + e.util.getData(o.$data, i, e.dataPathArr) + ";
7657 ", f = "schema" + n) : f = o, (o || c) && e.opts.uniqueItems !== !1) { 7658 c && (t += " var " + _ + "; if (" + f + " === false || " + f + " === undefined) " + _ + " = true; else if (typeof " + f + " != 'boolean') " + _ + " = false; else { "), t += " var i = " + m + ".length , " + _ + " = true , j; if (i > 1) { "; 7659 var y = e.schema.items && e.schema.items.type, v = Array.isArray(y); 7660 if (!y || y == "object" || y == "array" || v && (y.indexOf("object") >= 0 || y.indexOf("array") >= 0)) 7661 t += " outer: for (;i--;) { for (j = i; j--;) { if (equal(" + m + "[i], " + m + "[j])) { " + _ + " = false; break outer; } } } "; 7662 else { 7663 t += " var itemIndices = {}, item; for (;i--;) { var item = " + m + "[i]; "; 7664 var P = "checkDataType" + (v ? "s" : ""); 7665 t += " if (" + e.util[P](y, "item", e.opts.strictNumbers, !0) + ") continue; ", v && (t += ` if (typeof item == 'string') item = '"' + item; `), t += " if (typeof itemIndices[item] == 'number') { " + _ + " = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "; 7666 } 7667 t += " } ", c && (t += " } "), t += " if (!" + _ + ") { "; 7668 var I = I || []; 7669 I.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: 'uniqueItems' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { i: i, j: j } ", e.opts.messages !== !1 && (t += " , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "), e.opts.verbose && (t += " , schema: ", c ? t += "validate.schema" + u : t += "" + o, t += " , parentSchema: validate.schema" + e.schemaPath + " , data: " + m + " "), t += " } ") : t += " {} "; 7670 var A = t; 7671 t = I.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + A + "]); " : t += " validate.errors = [" + A + "]; return false; " : t += " var err = " + A + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", t += " } ", h && (t += " else { "); 7672 } else 7673 h && (t += " if (true) { "); 7674 return t; 7675 }), ts; 7676} 7677var rs, Ai; 7678function Sd() { 7679 return Ai || (Ai = 1, rs = { 7680 $ref: ad(), 7681 allOf: sd(), 7682 anyOf: nd(), 7683 $comment: id(), 7684 const: od(), 7685 contains: ud(), 7686 dependencies: ld(), 7687 enum: cd(), 7688 format: dd(), 7689 if: hd(), 7690 items: fd(), 7691 maximum: pi(), 7692 minimum: pi(), 7693 maxItems: vi(), 7694 minItems: vi(), 7695 maxLength: yi(), 7696 minLength: yi(), 7697 maxProperties: bi(), 7698 minProperties: bi(), 7699 multipleOf: pd(), 7700 not: md(), 7701 oneOf: vd(), 7702 pattern: gd(), 7703 properties: yd(), 7704 propertyNames: _d(), 7705 required: bd(), 7706 uniqueItems: Pd(), 7707 validate: Oo() 7708 }), rs; 7709} 7710var as, Oi; 7711function wd() { 7712 if (Oi) return as; 7713 Oi = 1; 7714 var s = Sd(), e = yr().toHash; 7715 return as = function() { 7716 var a = [ 7717 { 7718 type: "number", 7719 rules: [ 7720 { maximum: ["exclusiveMaximum"] }, 7721 { minimum: ["exclusiveMinimum"] }, 7722 "multipleOf", 7723 "format" 7724 ] 7725 }, 7726 { 7727 type: "string", 7728 rules: ["maxLength", "minLength", "pattern", "format"] 7729 }, 7730 { 7731 type: "array", 7732 rules: ["maxItems", "minItems", "items", "contains", "uniqueItems"] 7733 }, 7734 { 7735 type: "object", 7736 rules: [ 7737 "maxProperties", 7738 "minProperties", 7739 "required", 7740 "dependencies", 7741 "propertyNames", 7742 { properties: ["additionalProperties", "patternProperties"] } 7743 ] 7744 }, 7745 { rules: ["$ref", "const", "enum", "not", "anyOf", "oneOf", "allOf", "if"] } 7746 ], t = ["type", "$comment"], n = [ 7747 "$schema", 7748 "$id", 7749 "id", 7750 "$data", 7751 "$async", 7752 "title", 7753 "description", 7754 "default", 7755 "definitions", 7756 "examples", 7757 "readOnly", 7758 "writeOnly", 7759 "contentMediaType", 7760 "contentEncoding", 7761 "additionalItems", 7762 "then", 7763 "else" 7764 ], i = ["number", "integer", "string", "array", "object", "boolean", "null"]; 7765 return a.all = e(t), a.types = e(i), a.forEach(function(o) { 7766 o.rules = o.rules.map(function(u) { 7767 var l; 7768 if (typeof u == "object") { 7769 var h = Object.keys(u)[0]; 7770 l = u[h], u = h, l.forEach(function(_) { 7771 t.push(_), a.all[_] = !0; 7772 }); 7773 } 7774 t.push(u); 7775 var m = a.all[u] = { 7776 keyword: u, 7777 code: s[u], 7778 implements: l 7779 }; 7780 return m; 7781 }), a.all.$comment = { 7782 keyword: "$comment", 7783 code: s.$comment 7784 }, o.type && (a.types[o.type] = o); 7785 }), a.keywords = e(t.concat(n)), a.custom = {}, a; 7786 }, as; 7787} 7788var ss, Ci; 7789function xd() { 7790 if (Ci) return ss; 7791 Ci = 1; 7792 var s = [ 7793 "multipleOf", 7794 "maximum", 7795 "exclusiveMaximum", 7796 "minimum", 7797 "exclusiveMinimum", 7798 "maxLength", 7799 "minLength", 7800 "pattern", 7801 "additionalItems", 7802 "maxItems", 7803 "minItems", 7804 "uniqueItems",
7805 "maxProperties", 7806 "minProperties", 7807 "required", 7808 "additionalProperties", 7809 "enum", 7810 "format", 7811 "const" 7812 ]; 7813 return ss = function(e, r) { 7814 for (var a = 0; a < r.length; a++) { 7815 e = JSON.parse(JSON.stringify(e)); 7816 var t = r[a].split("/"), n = e, i; 7817 for (i = 1; i < t.length; i++) 7818 n = n[t[i]]; 7819 for (i = 0; i < s.length; i++) { 7820 var o = s[i], u = n[o]; 7821 u && (n[o] = { 7822 anyOf: [ 7823 u, 7824 { $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#" } 7825 ] 7826 }); 7827 } 7828 } 7829 return e; 7830 }, ss; 7831} 7832var ns, $i; 7833function Ed() { 7834 if ($i) return ns; 7835 $i = 1; 7836 var s = on().MissingRef; 7837 ns = e; 7838 function e(r, a, t) { 7839 var n = this; 7840 if (typeof this._opts.loadSchema != "function") 7841 throw new Error("options.loadSchema should be a function"); 7842 typeof a == "function" && (t = a, a = void 0); 7843 var i = o(r).then(function() { 7844 var l = n._addSchema(r, void 0, a); 7845 return l.validate || u(l); 7846 }); 7847 return t && i.then( 7848 function(l) { 7849 t(null, l); 7850 }, 7851 t 7852 ), i; 7853 function o(l) { 7854 var h = l.$schema; 7855 return h && !n.getSchema(h) ? e.call(n, { $ref: h }, !0) : Promise.resolve(); 7856 } 7857 function u(l) { 7858 try { 7859 return n._compile(l); 7860 } catch (m) { 7861 if (m instanceof s) return h(m); 7862 throw m; 7863 } 7864 function h(m) { 7865 var _ = m.missingSchema; 7866 if (y(_)) throw new Error("Schema " + _ + " is loaded but " + m.missingRef + " cannot be resolved"); 7867 var c = n._loadingSchemas[_]; 7868 return c || (c = n._loadingSchemas[_] = n._opts.loadSchema(_), c.then(f, f)), c.then(function(v) { 7869 if (!y(_)) 7870 return o(v).then(function() { 7871 y(_) || n.addSchema(v, _, void 0, a); 7872 }); 7873 }).then(function() { 7874 return u(l); 7875 }); 7876 function f() { 7877 delete n._loadingSchemas[_]; 7878 } 7879 function y(v) { 7880 return n._refs[v] || n._schemas[v]; 7881 } 7882 } 7883 } 7884 } 7885 return ns; 7886} 7887var is, Ii; 7888function Rd() { 7889 return Ii || (Ii = 1, is = function(e, r, a) { 7890 var t = " ", n = e.level, i = e.dataLevel, o = e.schema[r], u = e.schemaPath + e.util.getProperty(r), l = e.errSchemaPath + "/" + r, h = !e.opts.allErrors, m, _ = "data" + (i || ""), c = "valid" + n, f = "errs__" + n, y = e.opts.$data && o && o.$data, v; 7891 y ? (t += " var schema" + n + " = " + e.util.getData(o.$data, i, e.dataPathArr) + "; ", v = "schema" + n) : v = o; 7892 var P = this, I = "definition" + n, A = P.definition, b = "", x, T, O, C, $; 7893 if (y && A.$data) { 7894 $ = "keywordValidate" + n; 7895 var S = A.validateSchema; 7896 t += " var " + I + " = RULES.custom['" + r + "'].definition; var " + $ + " = " + I + ".validate;"; 7897 } else { 7898 if (C = e.useCustomRule(P, o, e.schema, e), !C) return; 7899 v = "validate.schema" + u, $ = C.code, x = A.compile, T = A.inline, O = A.macro; 7900 } 7901 var E = $ + ".errors", N = "i" + n, L = "ruleErr" + n, Z = A.async; 7902 if (Z && !e.async) throw new Error("async keyword in sync schema"); 7903 if (T || O || (t += "" + E + " = null;"), t += "var " + f + " = errors;var " + c + ";", y && A.$data && (b += "}", t += " if (" + v + " === undefined) { " + c + " = true; } else { ", S && (b += "}", t += " " + c + " = " + I + ".validateSchema(" + v + "); if (" + c + ") { ")), T) 7904 A.statements ? t += " " + C.validate + " " : t += " " + c + " = " + C.validate + "; "; 7905 else if (O) { 7906 var re = e.util.copy(e), b = ""; 7907 re.level++; 7908 var fe = "valid" + re.level; 7909 re.schema = C.validate, re.schemaPath = ""; 7910 var ne = e.compositeRule; 7911 e.compositeRule = re.compositeRule = !0; 7912 var _e = e.validate(re).replace(/validate\.schema/g, $); 7913 e.compositeRule = re.compositeRule = ne, t += " " + _e; 7914 } else { 7915 var ce = ce || []; 7916 ce.push(t), t = "", t += " " + $ + ".call( ", e.opts.passContext ? t += "this" : t += "self", x || A.schema === !1 ? t += " , " + _ + " " : t += " , " + v + " , " + _ + " , validate.schema" + e.schemaPath + " ", t += " , (dataPath || '')", e.errorPath != '""' && (t += " + " + e.errorPath); 7917 var de = i ? "data" + (i - 1 || "") : "parentData", tt = i ? e.dataPathArr[i] : "parentDataProperty"; 7918 t += " , " + de + " , " + tt + " , rootData ) "; 7919 var Ge = t; 7920 t = ce.pop(), A.errors === !1 ? (t += " " + c + " = ", Z && (t += "await "), t += "" + Ge + "; ") : Z ? (E = "customErrors" + n, t += " var " + E + " = null; try { " + c + " = await " + Ge + "; } catch (e) { " + c + " = false; if (e instanceof ValidationError) " + E + " = e.errors; else throw e; } ") : t += " " + E + " = null; " + c + " = " + Ge + "; "; 7921 } 7922 if (A.modifying && (t += " if (" + de + ") " + _ + " = " + de + "[" + tt + "];"), t += "" + b, A.valid) 7923 h && (t += " if (true) { "); 7924 else { 7925 t += " if ( ", A.valid === void 0 ? (t += " !", O ? t += "" + fe : t += "" + c) : t += " " + !A.valid + " ", t += ") { ", m = P.keyword; 7926 var ce = ce || []; 7927 ce.push(t), t = ""; 7928 var ce = ce || []; 7929 ce.push(t), t = "", e.createErrors !== !1 ? (t += " { keyword: '" + (m || "custom") + "' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { keyword: '" + P.ke
7929yword + "' } ", e.opts.messages !== !1 && (t += ` , message: 'should pass "` + P.keyword + `" keyword validation' `), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + _ + " "), t += " } ") : t += " {} "; 7930 var Je = t; 7931 t = ce.pop(), !e.compositeRule && h ? e.async ? t += " throw new ValidationError([" + Je + "]); " : t += " validate.errors = [" + Je + "]; return false; " : t += " var err = " + Je + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; 7932 var Ze = t; 7933 t = ce.pop(), T ? A.errors ? A.errors != "full" && (t += " for (var " + N + "=" + f + "; " + N + "<errors; " + N + "++) { var " + L + " = vErrors[" + N + "]; if (" + L + ".dataPath === undefined) " + L + ".dataPath = (dataPath || '') + " + e.errorPath + "; if (" + L + ".schemaPath === undefined) { " + L + '.schemaPath = "' + l + '"; } ', e.opts.verbose && (t += " " + L + ".schema = " + v + "; " + L + ".data = " + _ + "; "), t += " } ") : A.errors === !1 ? t += " " + Ze + " " : (t += " if (" + f + " == errors) { " + Ze + " }
7933 else { for (var " + N + "=" + f + "; " + N + "<errors; " + N + "++) { var " + L + " = vErrors[" + N + "]; if (" + L + ".dataPath === undefined) " + L + ".dataPath = (dataPath || '') + " + e.errorPath + "; if (" + L + ".schemaPath === undefined) { " + L + '.schemaPath = "' + l + '"; } ', e.opts.verbose && (t += " " + L + ".schema = " + v + "; " + L + ".data = " + _ + "; "), t += " } } ") : O ? (t += " var err = ", e.createErrors !== !1 ? (t += " { keyword: '" + (m || "custom") + "' , dataPath: (dataPath || '') + " + e.errorPath + " , schemaPath: " + e.util.toQuotedString(l) + " , params: { keyword: '" + P.keyword + "' } ", e.opts.messages !== !1 && (t += ` , message: 'should pass "` + P.keyword + `" keyword validation' `), e.opts.verbose && (t += " , schema: validate.schema" + u + " , parentSchema: validate.schema" + e.schemaPath + " , data: " + _ + " "), t += " } ") : t += " {} ", t += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ", !e.compositeRule && h && (e.async ? t += " throw new ValidationError(vErrors); " : t += " validate.errors = vErrors; return false; ")) : A.errors === !1 ? t += " " + Ze + " " : (t += " if (Array.isArray(" + E + ")) { if (vErrors === null) vErrors = " + E + "; else vErrors = vErrors.concat(" + E + "); errors = vErrors.length;
7933 for (var " + N + "=" + f + "; " + N + "<errors; " + N + "++) { var " + L + " = vErrors[" + N + "]; if (" + L + ".dataPath === undefined) " + L + ".dataPath = (dataPath || '') + " + e.errorPath + "; " + L + '.schemaPath = "' + l + '"; ', e.opts.verbose && (t += " " + L + ".schema = " + v + "; " + L + ".data = " + _ + "; "), t += " } } else { " + Ze + " } "), t += " } ", h && (t += " else { "); 7934 } 7935 return t; 7936 }), is; 7937} 7938const kd = "http://json-schema.org/draft-07/schema#", Td = "http://json-schema.org/draft-07/schema#", Ad = "Core schema meta-schema", Od = { schemaArray: { type: "array", minItems: 1, items: { $ref: "#" } }, nonNegativeInteger: { type: "integer", minimum: 0 }, nonNegativeIntegerDefault0: { allOf: [{ $ref: "#/definitions/nonNegativeInteger" }, { default: 0 }] }, simpleTypes: { enum: ["array", "boolean", "integer", "null", "number", "object", "string"] }, stringArray: { type: "array", items: { type: "string" }, uniqueItems: !0, default: [] } }, Cd = ["object", "boolean"], $d = { $id: { type: "string", format: "uri-reference" }, $schema: { type: "string", format: "uri" }, $ref: { type: "string", format: "uri-reference" }, $comment: { type: "string" }, title: { type: "string" }, description: { type: "string" }, default: !0, readOnly: { type: "boolean", default: !1 }, examples: { type: "array", items: !0 }, multipleOf: { type: "number", exclusiveMinimum: 0 }, maximum: { type: "number" }, exclusiveMaximum: { type: "number" }, minimum: { type: "number" }, exclusiveMinimum: { type: "number" }, maxLength: { $ref: "#/definitions/nonNegativeInteger" }, minLength: { $ref: "#/definitions/nonNegativeIntegerDefault0" }, pattern: { type: "string", format: "regex" }, additionalItems: { $ref: "#" }, items: { anyOf: [{ $ref: "#" }, { $ref: "#/definitions/schemaArray" }], default: !0 }, maxItems: { $ref: "#/definitions/nonNegativeInteger" }, minItems: { $ref: "#/definitions/nonNegativeIntegerDefault0" }, uniqueItems: { type: "boolean", default: !1 }, contains: { $ref: "#" }, maxProperties: { $ref: "#/definitions/nonNegativeInteger" }, minProperties: { $ref: "#/definitions/nonNegativeIntegerDefault0" }, required: { $ref: "#/definitions/stringArray" }, additionalProperties: { $ref: "#" }, definitions: { type: "object", additionalProperties: { $ref: "#" }, default: {} }, properties: { type: "object", additionalProperties: { $ref: "#" }, default: {} }, patternProperties: { type: "object", additionalProperties: { $ref: "#" }, propertyNames: { format: "regex" }, default: {} }, dependencies: { type: "object", additionalProperties: { anyOf: [{ $ref: "#" }, { $ref: "#/definitions/stringArray" }] } }, propertyNames: { $ref: "#" }, const: !0, enum: { type: "array", items: !0, minItems: 1, uniqueItems: !0 }, type: { anyOf: [{ $ref: "#/definitions/simpleTypes" }, { type: "array", items: { $ref: "#/definitions/simpleTypes" }, minItems: 1, uniqueItems: !0 }] }, format: { type: "string" }, contentMediaType: { type: "string" }, contentEncoding: { type: "string" }, if: { $ref: "#" }, then: { $ref: "#" }, else: { $ref: "#" }, allOf: { $ref: "#/definitions/schemaArray" }, anyOf: { $ref: "#/definitions/schemaArray" }, oneOf: { $ref: "#/definitions/schemaArray" }, not: { $ref: "#" } }, Co = { 7939 $schema: kd, 7940 $id: Td, 7941 title: Ad, 7942 definitions: Od, 7943 type: Cd, 7944 properties: $d, 7945 default: !0 7946}; 7947var os, Ni; 7948function Id() { 7949 if (Ni) return os; 7950 Ni = 1; 7951 var s = Co; 7952 return os = { 7953 $id: "https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js", 7954 definitions: { 7955 simpleTypes: s.definitions.simpleTypes 7956 }, 7957 type: "object", 7958 dependencies: { 7959 schema: ["validate"], 7960 $data: ["validate"], 7961 statements: ["inline"], 7962 valid: { not: { required: ["macro"] } } 7963 }, 7964 properties: { 7965 type: s.properties.type, 7966 schema: { type: "boolean" }, 7967 statements: { type: "boolean" }, 7968 dependencies: { 7969 type: "array", 7970 items: { type: "string" } 7971 }, 7972 metaSchema: { type: "object" }, 7973 modifying: { type: "boolean" }, 7974 valid: { type: "boolean" }, 7975 $data: { type: "boolean" }, 7976 async: { type: "boolean" }, 7977 errors: { 7978 anyOf: [ 7979 { type: "boolean" }, 7980 { const: "full" } 7981 ] 7982 } 7983 } 7984 }, os; 7985} 7986var us, Di; 7987function Nd() { 7988 if (Di) return us; 7989 Di = 1; 7990 var s = /^[a-z_$][a-z0-9_$-]*$/i, e = Rd(), r = Id(); 7991 us = { 7992 add: a, 7993 get: t, 7994 remove: n, 7995 validate: i 7996 }; 7997 function a(o, u) { 7998 var l = this.RULES; 7999 if (l.keywords[o])
8000 throw new Error("Keyword " + o + " is already defined"); 8001 if (!s.test(o)) 8002 throw new Error("Keyword " + o + " is not a valid identifier"); 8003 if (u) { 8004 this.validateKeyword(u, !0); 8005 var h = u.type; 8006 if (Array.isArray(h)) 8007 for (var m = 0; m < h.length; m++) 8008 c(o, h[m], u); 8009 else 8010 c(o, h, u); 8011 var _ = u.metaSchema; 8012 _ && (u.$data && this._opts.$data && (_ = { 8013 anyOf: [ 8014 _, 8015 { $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#" } 8016 ] 8017 }), u.validateSchema = this.compile(_, !0)); 8018 } 8019 l.keywords[o] = l.all[o] = !0; 8020 function c(f, y, v) { 8021 for (var P, I = 0; I < l.length; I++) { 8022 var A = l[I]; 8023 if (A.type == y) { 8024 P = A; 8025 break; 8026 } 8027 } 8028 P || (P = { type: y, rules: [] }, l.push(P)); 8029 var b = { 8030 keyword: f, 8031 definition: v, 8032 custom: !0, 8033 code: e, 8034 implements: v.implements 8035 }; 8036 P.rules.push(b), l.custom[f] = b; 8037 } 8038 return this; 8039 } 8040 function t(o) { 8041 var u = this.RULES.custom[o]; 8042 return u ? u.definition : this.RULES.keywords[o] || !1; 8043 } 8044 function n(o) { 8045 var u = this.RULES; 8046 delete u.keywords[o], delete u.all[o], delete u.custom[o]; 8047 for (var l = 0; l < u.length; l++) 8048 for (var h = u[l].rules, m = 0; m < h.length; m++) 8049 if (h[m].keyword == o) { 8050 h.splice(m, 1); 8051 break; 8052 } 8053 return this; 8054 } 8055 function i(o, u) { 8056 i.errors = null; 8057 var l = this._validateKeyword = this._validateKeyword || this.compile(r, !0); 8058 if (l(o)) return !0; 8059 if (i.errors = l.errors, u) 8060 throw new Error("custom keyword definition is invalid: " + this.errorsText(l.errors)); 8061 return !1; 8062 } 8063 return us; 8064} 8065const Dd = "http://json-schema.org/draft-07/schema#", jd = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", Fd = "Meta-schema for $data reference (JSON Schema extension proposal)", qd = "object", Ld = ["$data"], Zd = { $data: { type: "string", anyOf: [{ format: "relative-json-pointer" }, { format: "json-pointer" }] } }, Md = !1, zd = { 8066 $schema: Dd, 8067 $id: jd, 8068 description: Fd, 8069 type: qd, 8070 required: Ld, 8071 properties: Zd, 8072 additionalProperties: Md 8073}; 8074var ls, ji; 8075function Ud() { 8076 if (ji) return ls; 8077 ji = 1; 8078 var s = ed(), e = nn(), r = td(), a = To(), t = Ao(), n = rd(), i = wd(), o = xd(), u = yr(); 8079 ls = f, f.prototype.validate = y, f.prototype.compile = v, f.prototype.addSchema = P, f.prototype.addMetaSchema = I, f.prototype.validateSchema = A, f.prototype.getSchema = x, f.prototype.removeSchema = C, f.prototype.addFormat = ne, f.prototype.errorsText = fe, f.prototype._addSchema = S, f.prototype._compile = E, f.prototype.compileAsync = Ed(); 8080 var l = Nd(); 8081 f.prototype.addKeyword = l.add, f.prototype.getKeyword = l.get, f.prototype.removeKeyword = l.remove, f.prototype.validateKeyword = l.validate; 8082 var h = on(); 8083 f.ValidationError = h.Validation, f.MissingRefError = h.MissingRef, f.$dataMetaSchema = o; 8084 var m = "http://json-schema.org/draft-07/schema", _ = ["removeAdditional", "useDefaults", "coerceTypes", "strictDefaults"], c = ["/properties"]; 8085 function f(w) { 8086 if (!(this instanceof f)) return new f(w); 8087 w = this._opts = u.copy(w) || {}, Ze(this), this._schemas = {}, this._refs = {}, this._fragments = {}, this._formats = n(w.format), this._cache = w.cache || new r(), this._loadingSchemas = {}, this._compilations = [], this.RULES = i(), this._getId = N(w), w.loopRequired = w.loopRequired || 1 / 0, w.errorDataPath == "property" && (w._errorDataPathProperty = !0), w.serialize === void 0 && (w.serialize = t), this._metaOpts = Je(this), w.formats && de(this), w.keywords && tt(this), _e(this), typeof w.meta == "object" && this.addMetaSchema(w.meta), w.nullable && this.addKeyword("nullable", { metaSchema: { type: "boolean" } }), ce(this); 8088 } 8089 function y(w, D) { 8090 var B; 8091 if (typeof w == "string") { 8092 if (B = this.getSchema(w), !B) throw new Error('no schema with key or ref "' + w + '"'); 8093 } else { 8094 var le = this._addSchema(w); 8095 B = le.validate || this._compile(le); 8096 } 8097 var j = B(D); 8098 return B.$async !== !0 && (this.errors = B.errors), j; 8099 } 8100 function v(w, D) { 8101 var B = this._addSchema(w, void 0, D); 8102 return B.validate || this._compile(B); 8103 } 8104 function P(w, D, B, le) { 8105 if (Array.isArray(w)) { 8106 for (var j = 0; j < w.length; j++) this.addSchema(w[j], void 0, B, le); 8107 return this; 8108 } 8109 var V = this._getId(w); 8110 if (V !== void 0 && typeof V != "string") 8111 throw new Error("schema id must be string"); 8112 return D = e.normalizeId(D || V), Ge(this, D), this._schemas[D] = this._addSchema(w, B, le, !0), this; 8113 } 8114 function I(w, D, B) { 8115 return this.addSchema(w, D, B, !0), this; 8116 } 8117 function A(w, D) { 8118 var B = w.$schema; 8119 if (B !== void 0 && typeof B != "string") 8120 throw new Error("$schema must be a string"); 8121 if (B = B || this._opts.defaultMeta || b(this), !B) 8122 return this.logger.warn("meta-schema not available"), this.errors = null, !0; 8123 var le = this.validate(B, w); 8124 if (!le && D) {
8125 var j = "schema is invalid: " + this.errorsText(); 8126 if (this._opts.validateSchema == "log") this.logger.error(j); 8127 else throw new Error(j); 8128 } 8129 return le; 8130 } 8131 function b(w) { 8132 var D = w._opts.meta; 8133 return w._opts.defaultMeta = typeof D == "object" ? w._getId(D) || D : w.getSchema(m) ? m : void 0, w._opts.defaultMeta; 8134 } 8135 function x(w) { 8136 var D = O(this, w); 8137 switch (typeof D) { 8138 case "object": 8139 return D.validate || this._compile(D); 8140 case "string": 8141 return this.getSchema(D); 8142 case "undefined": 8143 return T(this, w); 8144 } 8145 } 8146 function T(w, D) { 8147 var B = e.schema.call(w, { schema: {} }, D); 8148 if (B) { 8149 var le = B.schema, j = B.root, V = B.baseId, ve = s.call(w, le, j, void 0, V); 8150 return w._fragments[D] = new a({ 8151 ref: D, 8152 fragment: !0, 8153 schema: le, 8154 root: j, 8155 baseId: V, 8156 validate: ve 8157 }), ve; 8158 } 8159 } 8160 function O(w, D) { 8161 return D = e.normalizeId(D), w._schemas[D] || w._refs[D] || w._fragments[D]; 8162 } 8163 function C(w) { 8164 if (w instanceof RegExp) 8165 return $(this, this._schemas, w), $(this, this._refs, w), this; 8166 switch (typeof w) { 8167 case "undefined": 8168 return $(this, this._schemas), $(this, this._refs), this._cache.clear(), this; 8169 case "string": 8170 var D = O(this, w); 8171 return D && this._cache.del(D.cacheKey), delete this._schemas[w], delete this._refs[w], this; 8172 case "object": 8173 var B = this._opts.serialize, le = B ? B(w) : w; 8174 this._cache.del(le); 8175 var j = this._getId(w); 8176 j && (j = e.normalizeId(j), delete this._schemas[j], delete this._refs[j]); 8177 } 8178 return this; 8179 } 8180 function $(w, D, B) { 8181 for (var le in D) { 8182 var j = D[le]; 8183 !j.meta && (!B || B.test(le)) && (w._cache.del(j.cacheKey), delete D[le]); 8184 } 8185 } 8186 function S(w, D, B, le) { 8187 if (typeof w != "object" && typeof w != "boolean") 8188 throw new Error("schema should be object or boolean"); 8189 var j = this._opts.serialize, V = j ? j(w) : w, ve = this._cache.get(V); 8190 if (ve) return ve; 8191 le = le || this._opts.addUsedSchema !== !1; 8192 var Se = e.normalizeId(this._getId(w)); 8193 Se && le && Ge(this, Se); 8194 var be = this._opts.validateSchema !== !1 && !D, Ne; 8195 be && !(Ne = Se && Se == e.normalizeId(w.$schema)) && this.validateSchema(w, !0); 8196 var Te = e.ids.call(this, w), Ae = new a({ 8197 id: Se, 8198 schema: w, 8199 localRefs: Te, 8200 cacheKey: V, 8201 meta: B 8202 }); 8203 return Se[0] != "#" && le && (this._refs[Se] = Ae), this._cache.put(V, Ae), be && Ne && this.validateSchema(w, !0), Ae; 8204 } 8205 function E(w, D) { 8206 if (w.compiling) 8207 return w.validate = j, j.schema = w.schema, j.errors = null, j.root = D || j, w.schema.$async === !0 && (j.$async = !0), j; 8208 w.compiling = !0; 8209 var B; 8210 w.meta && (B = this._opts, this._opts = this._metaOpts); 8211 var le; 8212 try { 8213 le = s.call(this, w.schema, D, w.localRefs); 8214 } catch (V) { 8215 throw delete w.validate, V; 8216 } finally { 8217 w.compiling = !1, w.meta && (this._opts = B); 8218 } 8219 return w.validate = le, w.refs = le.refs, w.refVal = le.refVal, w.root = le.root, le; 8220 function j() { 8221 var V = w.validate, ve = V.apply(this, arguments); 8222 return j.errors = V.errors, ve; 8223 } 8224 } 8225 function N(w) { 8226 switch (w.schemaId) { 8227 case "auto": 8228 return re; 8229 case "id": 8230 return L; 8231 default: 8232 return Z; 8233 } 8234 } 8235 function L(w) { 8236 return w.$id && this.logger.warn("schema $id ignored", w.$id), w.id; 8237 } 8238 function Z(w) { 8239 return w.id && this.logger.warn("schema id ignored", w.id), w.$id; 8240 } 8241 function re(w) { 8242 if (w.$id && w.id && w.$id != w.id) 8243 throw new Error("schema $id is different from id"); 8244 return w.$id || w.id; 8245 } 8246 function fe(w, D) { 8247 if (w = w || this.errors, !w) return "No errors"; 8248 D = D || {}; 8249 for (var B = D.separator === void 0 ? ", " : D.separator, le = D.dataVar === void 0 ? "data" : D.dataVar, j = "", V = 0; V < w.length; V++) { 8250 var ve = w[V]; 8251 ve && (j += le + ve.dataPath + " " + ve.message + B); 8252 } 8253 return j.slice(0, -B.length); 8254 } 8255 function ne(w, D) { 8256 return typeof D == "string" && (D = new RegExp(D)), this._formats[w] = D, this; 8257 } 8258 function _e(w) { 8259 var D; 8260 if (w._opts.$data && (D = zd, w.addMetaSchema(D, D.$id, !0)), w._opts.meta !== !1) { 8261 var B = Co; 8262 w._opts.$data && (B = o(B, c)), w.addMetaSchema(B, m, !0), w._refs["http://json-schema.org/schema"] = m; 8263 } 8264 } 8265 function ce(w) { 8266 var D = w._opts.schemas; 8267 if (D) 8268 if (Array.isArray(D)) w.addSchema(D); 8269 else for (var B in D) w.addSchema(D[B], B); 8270 } 8271 function de(w) { 8272 for (var D in w._opts.formats) { 8273 var B = w._opts.formats[D]; 8274 w.addFormat(D, B); 8275 } 8276 } 8277 function tt(w) { 8278 for (var D in w._opts.keywords) { 8279 var B = w._opts.keywords[D]; 8280 w.addKeyword(D, B); 8281 } 8282 } 8283 function Ge(w, D) { 8284 if (w._schemas[D] || w._refs[D]) 8285 throw new Error('schema with key or id "' + D + '" already exists'); 8286 } 8287 function Je(w) { 8288 for (var D = u.copy(w._opts), B = 0; B < _.length; B++) 8289 delete D[_[B]]; 8290 return D; 8291 } 8292 function Ze(w) { 8293 var D = w._opts.logger; 8294 if (D === !1) 8295 w.logger = { log: mt, warn: mt, error: mt }; 8296 else { 8297 if (D === void 0 && (D = console), !(typeof D == "object" && D.log && D.warn && D.error)) 8298 throw new Error("logger must implement log, warn and error methods"); 8299 w.logger = D; 8300 } 8301 } 8302 function mt() { 8303 } 8304 return ls; 8305} 8306var Vd = Ud(); 8307const Hd = /* @__PURE__ */ Jc(Vd); 8308class Bd extends Qc { 8309 /** 8310 * Initializes this server with the given name and version information. 8311 */ 8312 constructor(e, r) { 8313 var a; 8314 super(r), this._serverInfo = e, this._capabilities = (a = r == null ? void 0 : r.capabilities) !== null && a !== void 0 ? a : {}, this._instructions = r == null ? void 0 : r.instructions, this.setRequestHandler(vo, (t) => this._oninitialize(t)), this.setNotificationHandler(go, () => { 8315 var t; 8316 return (t = this.oninitialized) === null || t === void 0 ? void 0 : t.call(this); 8317 }); 8318 } 8319 /** 8320 * Registers new capabilities. This can only be called before connecting to a transport. 8321 * 8322 * The new capabilities will be merged with any existing capabilities previously given (e.g., at initialization). 8323 */ 8324 registerCapabilities(e) { 8325 if (this.transport) 8326 throw new Error("Cannot register capabilities after connecting to transport");
8327 this._capabilities = Kc(this._capabilities, e); 8328 } 8329 assertCapabilityForMethod(e) { 8330 var r, a, t; 8331 switch (e) { 8332 case "sampling/createMessage": 8333 if (!(!((r = this._clientCapabilities) === null || r === void 0) && r.sampling)) 8334 throw new Error(`Client does not support sampling (required for ${e})`); 8335 break; 8336 case "elicitation/create": 8337 if (!(!((a = this._clientCapabilities) === null || a === void 0) && a.elicitation)) 8338 throw new Error(`Client does not support elicitation (required for ${e})`); 8339 break; 8340 case "roots/list": 8341 if (!(!((t = this._clientCapabilities) === null || t === void 0) && t.roots)) 8342 throw new Error(`Client does not support listing roots (required for ${e})`); 8343 break; 8344 } 8345 } 8346 assertNotificationCapability(e) { 8347 switch (e) { 8348 case "notifications/message": 8349 if (!this._capabilities.logging) 8350 throw new Error(`Server does not support logging (required for ${e})`); 8351 break; 8352 case "notifications/resources/updated": 8353 case "notifications/resources/list_changed": 8354 if (!this._capabilities.resources) 8355 throw new Error(`Server does not support notifying about resources (required for ${e})`); 8356 break; 8357 case "notifications/tools/list_changed": 8358 if (!this._capabilities.tools) 8359 throw new Error(`Server does not support notifying of tool list changes (required for ${e})`); 8360 break; 8361 case "notifications/prompts/list_changed": 8362 if (!this._capabilities.prompts) 8363 throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`); 8364 break; 8365 } 8366 } 8367 assertRequestHandlerCapability(e) { 8368 switch (e) { 8369 case "sampling/createMessage": 8370 if (!this._capabilities.sampling) 8371 throw new Error(`Server does not support sampling (required for ${e})`); 8372 break; 8373 case "logging/setLevel": 8374 if (!this._capabilities.logging) 8375 throw new Error(`Server does not support logging (required for ${e})`); 8376 break; 8377 case "prompts/get": 8378 case "prompts/list": 8379 if (!this._capabilities.prompts) 8380 throw new Error(`Server does not support prompts (required for ${e})`); 8381 break; 8382 case "resources/list": 8383 case "resources/templates/list": 8384 case "resources/read": 8385 if (!this._capabilities.resources) 8386 throw new Error(`Server does not support resources (required for ${e})`); 8387 break; 8388 case "tools/call": 8389 case "tools/list": 8390 if (!this._capabilities.tools) 8391 throw new Error(`Server does not support tools (required for ${e})`); 8392 break; 8393 } 8394 } 8395 async _oninitialize(e) { 8396 const r = e.params.protocolVersion; 8397 return this._clientCapabilities = e.params.capabilities, this._clientVersion = e.params.clientInfo, { 8398 protocolVersion: Xl.includes(r) ? r : oo, 8399 capabilities: this.getCapabilities(), 8400 serverInfo: this._serverInfo, 8401 ...this._instructions && { instructions: this._instructions } 8402 }; 8403 } 8404 /** 8405 * After initialization has completed, this will be populated with the client's reported capabilities. 8406 */ 8407 getClientCapabilities() { 8408 return this._clientCapabilities; 8409 } 8410 /** 8411 * After initialization has completed, this will be populated with information about the client's name and version. 8412 */ 8413 getClientVersion() { 8414 return this._clientVersion; 8415 } 8416 getCapabilities() { 8417 return this._capabilities; 8418 } 8419 async ping() { 8420 return this.request({ method: "ping" }, Ws); 8421 } 8422 async createMessage(e, r) { 8423 return this.request({ method: "sampling/createMessage", params: e }, Eo, r); 8424 } 8425 async elicitInput(e, r) { 8426 const a = await this.request({ method: "elicitation/create", params: e }, Ro, r); 8427 if (a.action === "accept" && a.content) 8428 try { 8429 const t = new Hd(), n = t.compile(e.requestedSchema); 8430 if (!n(a.content)) 8431 throw new Ve(qe.InvalidParams, `Elicitation response content does not match requested schema: ${t.errorsText(n.errors)}`); 8432 } catch (t) { 8433 throw t instanceof Ve ? t : new Ve(qe.InternalError, `Error validating elicitation response: ${t}`); 8434 } 8435 return a; 8436 } 8437 async listRoots(e, r) { 8438 return this.request({ method: "roots/list", params: e }, ko, r); 8439 } 8440 async sendLoggingMessage(e) { 8441 return this.notification({ method: "notifications/message", params: e }); 8442 } 8443 async sendResourceUpdated(e) { 8444 return this.notification({ 8445 method: "notifications/resources/updated", 8446 params: e 8447 }); 8448 } 8449 async sendResourceListChanged() { 8450 return this.notification({ 8451 method: "notifications/resources/list_changed" 8452 }); 8453 } 8454 async sendToolListChanged() { 8455 return this.notification({ method: "notifications/tools/list_changed" }); 8456 } 8457 async sendPromptListChanged() { 8458 return this.notification({ method: "notifications/prompts/list_changed" }); 8459 } 8460} 8461const Qd = Symbol("Let zodToJsonSchema decide on which parser to use"), Fi = { 8462 name: void 0, 8463 $refStrategy: "root", 8464 basePath: ["#"], 8465 effectStrategy: "input", 8466 pipeStrategy: "all", 8467 dateStrategy: "format:date-time", 8468 mapStrategy: "entries", 8469 removeAdditionalStrategy: "passthrough", 8470 allowedAdditionalProperties: !0, 8471 rejectedAdditionalProperties: !1, 8472 definitionPath: "definitions", 8473 target: "jsonSchema7", 8474 strictUnions: !1, 8475 definitions: {}, 8476 errorMessages: !1, 8477 markdownDescription: !1, 8478 patternStrategy: "escape", 8479 applyRegexFlags: !1, 8480 emailStrategy: "format:email", 8481 base64Strategy: "contentEncoding:base64", 8482 nameStrategy: "ref", 8483 openAiAnyTypeName: "OpenAiAnyType" 8484}, Kd = (s) => typeof s == "string" ? { 8485 ...Fi, 8486 name: s 8487} : { 8488 ...Fi, 8489 ...s 8490}, Jd = (s) => { 8491 const e = Kd(s), r = e.name !== void 0 ? [...e.basePath, e.definitionPath, e.name] : e.basePath; 8492 return { 8493 ...e, 8494 flags: { hasReferencedOpenAiAnyType: !1 },
8495 currentPath: r, 8496 propertyPath: void 0, 8497 seen: new Map(Object.entries(e.definitions).map(([a, t]) => [ 8498 t._def, 8499 { 8500 def: t._def, 8501 path: [...e.basePath, e.definitionPath, a], 8502 // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now. 8503 jsonSchema: void 0 8504 } 8505 ])) 8506 }; 8507}; 8508function $o(s, e, r, a) { 8509 a != null && a.errorMessages && r && (s.errorMessage = { 8510 ...s.errorMessage, 8511 [e]: r 8512 }); 8513} 8514function Ce(s, e, r, a, t) { 8515 s[e] = r, $o(s, e, a, t); 8516} 8517const Io = (s, e) => { 8518 let r = 0; 8519 for (; r < s.length && r < e.length && s[r] === e[r]; r++) 8520 ; 8521 return [(s.length - r).toString(), ...e.slice(r)].join("/"); 8522}; 8523function dt(s) { 8524 if (s.target !== "openAi") 8525 return {}; 8526 const e = [ 8527 ...s.basePath, 8528 s.definitionPath, 8529 s.openAiAnyTypeName 8530 ]; 8531 return s.flags.hasReferencedOpenAiAnyType = !0, { 8532 $ref: s.$refStrategy === "relative" ? Io(e, s.currentPath) : e.join("/") 8533 }; 8534} 8535function Wd(s, e) { 8536 var a, t, n; 8537 const r = { 8538 type: "array" 8539 }; 8540 return (a = s.type) != null && a._def && ((n = (t = s.type) == null ? void 0 : t._def) == null ? void 0 : n.typeName) !== U.ZodAny && (r.items = Oe(s.type._def, { 8541 ...e, 8542 currentPath: [...e.currentPath, "items"] 8543 })), s.minLength && Ce(r, "minItems", s.minLength.value, s.minLength.message, e), s.maxLength && Ce(r, "maxItems", s.maxLength.value, s.maxLength.message, e), s.exactLength && (Ce(r, "minItems", s.exactLength.value, s.exactLength.message, e), Ce(r, "maxItems", s.exactLength.value, s.exactLength.message, e)), r; 8544} 8545function Gd(s, e) { 8546 const r = { 8547 type: "integer", 8548 format: "int64" 8549 }; 8550 if (!s.checks) 8551 return r; 8552 for (const a of s.checks) 8553 switch (a.kind) { 8554 case "min": 8555 e.target === "jsonSchema7" ? a.inclusive ? Ce(r, "minimum", a.value, a.message, e) : Ce(r, "exclusiveMinimum", a.value, a.message, e) : (a.inclusive || (r.exclusiveMinimum = !0), Ce(r, "minimum", a.value, a.message, e)); 8556 break; 8557 case "max": 8558 e.target === "jsonSchema7" ? a.inclusive ? Ce(r, "maximum", a.value, a.message, e) : Ce(r, "exclusiveMaximum", a.value, a.message, e) : (a.inclusive || (r.exclusiveMaximum = !0), Ce(r, "maximum", a.value, a.message, e)); 8559 break; 8560 case "multipleOf": 8561 Ce(r, "multipleOf", a.value, a.message, e); 8562 break; 8563 } 8564 return r; 8565} 8566function Yd() { 8567 return { 8568 type: "boolean" 8569 }; 8570} 8571function No(s, e) { 8572 return Oe(s.type._def, e); 8573} 8574const Xd = (s, e) => Oe(s.innerType._def, e); 8575function Do(s, e, r) { 8576 const a = r ?? e.dateStrategy; 8577 if (Array.isArray(a)) 8578 return { 8579 anyOf: a.map((t, n) => Do(s, e, t)) 8580 }; 8581 switch (a) { 8582 case "string": 8583 case "format:date-time": 8584 return { 8585 type: "string", 8586 format: "date-time" 8587 }; 8588 case "format:date": 8589 return { 8590 type: "string", 8591 format: "date" 8592 }; 8593 case "integer": 8594 return eh(s, e); 8595 } 8596} 8597const eh = (s, e) => { 8598 const r = { 8599 type: "integer", 8600 format: "unix-time" 8601 }; 8602 if (e.target === "openApi3") 8603 return r; 8604 for (const a of s.checks) 8605 switch (a.kind) { 8606 case "min": 8607 Ce( 8608 r, 8609 "minimum", 8610 a.value, 8611 // This is in milliseconds 8612 a.message, 8613 e 8614 ); 8615 break; 8616 case "max": 8617 Ce( 8618 r, 8619 "maximum", 8620 a.value, 8621 // This is in milliseconds 8622 a.message, 8623 e 8624 ); 8625 break; 8626 } 8627 return r; 8628}; 8629function th(s, e) { 8630 return { 8631 ...Oe(s.innerType._def, e), 8632 default: s.defaultValue() 8633 }; 8634} 8635function rh(s, e) { 8636 return e.effectStrategy === "input" ? Oe(s.schema._def, e) : dt(e); 8637} 8638function ah(s) { 8639 return { 8640 type: "string", 8641 enum: Array.from(s.values) 8642 }; 8643} 8644const sh = (s) => "type" in s && s.type === "string" ? !1 : "allOf" in s; 8645function nh(s, e) { 8646 const r = [ 8647 Oe(s.left._def, { 8648 ...e, 8649 currentPath: [...e.currentPath, "allOf", "0"] 8650 }), 8651 Oe(s.right._def, { 8652 ...e, 8653 currentPath: [...e.currentPath, "allOf", "1"] 8654 }) 8655 ].filter((n) => !!n); 8656 let a = e.target === "jsonSchema2019-09" ? { unevaluatedProperties: !1 } : void 0; 8657 const t = []; 8658 return r.forEach((n) => { 8659 if (sh(n)) 8660 t.push(...n.allOf), n.unevaluatedProperties === void 0 && (a = void 0); 8661 else { 8662 let i = n; 8663 if ("additionalProperties" in n && n.additionalProperties === !1) { 8664 const { additionalProperties: o, ...u } = n; 8665 i = u; 8666 } else 8667 a = void 0; 8668 t.push(i); 8669 } 8670 }), t.length ? { 8671 allOf: t, 8672 ...a 8673 } : void 0; 8674} 8675function ih(s, e) { 8676 const r = typeof s.value; 8677 return r !== "bigint" && r !== "number" && r !== "boolean" && r !== "string" ? { 8678 type: Array.isArray(s.value) ? "array" : "object" 8679 } : e.target === "openApi3" ? { 8680 type: r === "bigint" ? "integer" : r, 8681 enum: [s.value] 8682 } : { 8683 type: r === "bigint" ? "integer" : r, 8684 const: s.value 8685 }; 8686} 8687let cs; 8688const xt = { 8689 /** 8690 * `c` was changed to `[cC]` to replicate /i flag 8691 */ 8692 cuid: /^[cC][^\s-]{8,}$/, 8693 cuid2: /^[0-9a-z]+$/,
8694 ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/, 8695 /** 8696 * `a-z` was added to replicate /i flag 8697 */ 8698 email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/, 8699 /** 8700 * Constructed a valid Unicode RegExp 8701 * 8702 * Lazily instantiate since this type of regex isn't supported 8703 * in all envs (e.g. React Native). 8704 * 8705 * See: 8706 * https://github.com/colinhacks/zod/issues/2433 8707 * Fix in Zod: 8708 * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b 8709 */ 8710 emoji: () => (cs === void 0 && (cs = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), cs), 8711 /** 8712 * Unused 8713 */ 8714 uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/, 8715 /** 8716 * Unused 8717 */ 8718 ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, 8719 ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, 8720 /** 8721 * Unused 8722 */ 8723 ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, 8724 ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, 8725 base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, 8726 base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, 8727 nanoid: /^[a-zA-Z0-9_-]{21}$/, 8728 jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/ 8729}; 8730function jo(s, e) { 8731 const r = { 8732 type: "string" 8733 }; 8734 if (s.checks) 8735 for (const a of s.checks) 8736 switch (a.kind) { 8737 case "min": 8738 Ce(r, "minLength", typeof r.minLength == "number" ? Math.max(r.minLength, a.value) : a.value, a.message, e); 8739 break; 8740 case "max": 8741 Ce(r, "maxLength", typeof r.maxLength == "number" ? Math.min(r.maxLength, a.value) : a.value, a.message, e); 8742 break; 8743 case "email": 8744 switch (e.emailStrategy) { 8745 case "format:email": 8746 Et(r, "email", a.message, e); 8747 break; 8748 case "format:idn-email": 8749 Et(r, "idn-email", a.message, e); 8750 break; 8751 case "pattern:zod": 8752 at(r, xt.email, a.message, e); 8753 break; 8754 } 8755 break; 8756 case "url": 8757 Et(r, "uri", a.message, e); 8758 break; 8759 case "uuid": 8760 Et(r, "uuid", a.message, e); 8761 break; 8762 case "regex": 8763 at(r, a.regex, a.message, e); 8764 break; 8765 case "cuid": 8766 at(r, xt.cuid, a.message, e); 8767 break; 8768 case "cuid2": 8769 at(r, xt.cuid2, a.message, e); 8770 break; 8771 case "startsWith": 8772 at(r, RegExp(`^${ds(a.value, e)}`), a.message, e); 8773 break; 8774 case "endsWith": 8775 at(r, RegExp(`${ds(a.value, e)}$`), a.message, e); 8776 break; 8777 case "datetime": 8778 Et(r, "date-time", a.message, e); 8779 break; 8780 case "date": 8781 Et(r, "date", a.message, e); 8782 break; 8783 case "time": 8784 Et(r, "time", a.message, e); 8785 break; 8786 case "duration": 8787 Et(r, "duration", a.message, e); 8788 break; 8789 case "length": 8790 Ce(r, "minLength", typeof r.minLength == "number" ? Math.max(r.minLength, a.value) : a.value, a.message, e), Ce(r, "maxLength", typeof r.maxLength == "number" ? Math.min(r.maxLength, a.value) : a.value, a.message, e); 8791 break; 8792 case "includes": { 8793 at(r, RegExp(ds(a.value, e)), a.message, e); 8794 break; 8795 } 8796 case "ip": { 8797 a.version !== "v6" && Et(r, "ipv4", a.message, e), a.version !== "v4" && Et(r, "ipv6", a.message, e); 8798 break; 8799 } 8800 case "base64url": 8801 at(r, xt.base64url, a.message, e); 8802 break; 8803 case "jwt": 8804 at(r, xt.jwt, a.message, e); 8805 break; 8806 case "cidr": { 8807 a.version !== "v6" && at(r, xt.ipv4Cidr, a.message, e), a.version !== "v4" && at(r, xt.ipv6Cidr, a.message, e); 8808 break; 8809 } 8810 case "emoji": 8811 at(r, xt.emoji(), a.message, e); 8812 break; 8813 case "ulid": { 8814 at(r, xt.ulid, a.message, e); 8815 break; 8816 } 8817 case "base64": { 8818 switch (e.base64Strategy) { 8819 case "format:binary": { 8820 Et(r, "binary", a.message, e); 8821 break; 8822 } 8823 case "contentEncoding:base64": { 8824 Ce(r, "contentEncoding", "base64", a.message, e); 8825 break; 8826 } 8827 case "pattern:zod": { 8828 at(r, xt.base64, a.message, e); 8829 break; 8830 } 8831 } 8832 break; 8833 } 8834 case "nanoid": 8835 at(r, xt.nanoid, a.message, e); 8836 } 8837 return r; 8838} 8839function ds(s, e) { 8840 return e.patternStrategy === "escape" ? uh(s) : s; 8841} 8842const oh = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"); 8843function uh(s) { 8844 let e = ""; 8845 for (let r = 0; r < s.length; r++) 8846 oh.has(s[r]) || (e += "\\"), e += s[r]; 8847 return e; 8848} 8849function Et(s, e, r, a) { 8850 var t; 8851 s.format || (t = s.anyOf) != null && t.some((n) => n.format) ? (s.anyOf || (s.anyOf = []), s.format && (s.anyOf.push({ 8852 format: s.format, 8853 ...s.errorMessage && a.errorMessages && { 8854 errorMessage: { format: s.errorMessage.format } 8855 } 8856 }), delete s.format, s.errorMessage && (delete s.errorMessage.format, Object.keys(s.errorMessage).length === 0 && delete s.errorMessage)), s.anyOf.push({ 8857 format: e, 8858 ...r && a.errorMessages && { errorMessage: { format: r } } 8859 })) : Ce(s, "format", e, r, a); 8860} 8861function at(s, e, r, a) { 8862 var t; 8863 s.pattern || (t = s.allOf) != null && t.some((n) => n.pattern) ? (s.allOf || (s.allOf = []), s.pattern && (s.allOf.push({ 8864 pattern: s.pattern, 8865 ...s.errorMessage && a.errorMessages && { 8866 errorMessage: { pattern: s.errorMessage.pattern } 8867 } 8868 }), delete s.pattern, s.errorMessage && (delete s.errorMessage.pattern, Ob
8868ject.keys(s.errorMessage).length === 0 && delete s.errorMessage)), s.allOf.push({ 8869 pattern: qi(e, a), 8870 ...r && a.errorMessages && { errorMessage: { pattern: r } } 8871 })) : Ce(s, "pattern", qi(e, a), r, a); 8872} 8873function qi(s, e) { 8874 var u; 8875 if (!e.applyRegexFlags || !s.flags) 8876 return s.source; 8877 const r = { 8878 i: s.flags.includes("i"), 8879 m: s.flags.includes("m"), 8880 s: s.flags.includes("s") 8881 // `.` matches newlines 8882 }, a = r.i ? s.source.toLowerCase() : s.source; 8883 let t = "", n = !1, i = !1, o = !1; 8884 for (let l = 0; l < a.length; l++) { 8885 if (n) { 8886 t += a[l], n = !1; 8887 continue; 8888 } 8889 if (r.i) { 8890 if (i) { 8891 if (a[l].match(/[a-z]/)) { 8892 o ? (t += a[l], t += `${a[l - 2]}-${a[l]}`.toUpperCase(), o = !1) : a[l + 1] === "-" && ((u = a[l + 2]) != null && u.match(/[a-z]/)) ? (t += a[l], o = !0) : t += `${a[l]}${a[l].toUpperCase()}`; 8893 continue; 8894 } 8895 } else if (a[l].match(/[a-z]/)) { 8896 t += `[${a[l]}${a[l].toUpperCase()}]`; 8897 continue; 8898 } 8899 } 8900 if (r.m) { 8901 if (a[l] === "^") { 8902 t += `(^|(?<=[\r 8903]))`; 8904 continue; 8905 } else if (a[l] === "$") { 8906 t += `($|(?=[\r 8907]))`; 8908 continue; 8909 } 8910 } 8911 if (r.s && a[l] === ".") { 8912 t += i ? `${a[l]}\r 8913` : `[${a[l]}\r 8914]`; 8915 continue; 8916 } 8917 t += a[l], a[l] === "\\" ? n = !0 : i && a[l] === "]" ? i = !1 : !i && a[l] === "[" && (i = !0); 8918 } 8919 try { 8920 new RegExp(t); 8921 } catch { 8922 return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`), s.source; 8923 } 8924 return t; 8925} 8926function Fo(s, e) { 8927 var a, t, n, i, o, u; 8928 if (e.target === "openAi" && console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."), e.target === "openApi3" && ((a = s.keyType) == null ? void 0 : a._def.typeName) === U.ZodEnum) 8929 return { 8930 type: "object", 8931 required: s.keyType._def.values, 8932 properties: s.keyType._def.values.reduce((l, h) => ({ 8933 ...l, 8934 [h]: Oe(s.valueType._def, { 8935 ...e, 8936 currentPath: [...e.currentPath, "properties", h] 8937 }) ?? dt(e) 8938 }), {}), 8939 additionalProperties: e.rejectedAdditionalProperties 8940 }; 8941 const r = { 8942 type: "object", 8943 additionalProperties: Oe(s.valueType._def, { 8944 ...e, 8945 currentPath: [...e.currentPath, "additionalProperties"] 8946 }) ?? e.allowedAdditionalProperties 8947 }; 8948 if (e.target === "openApi3") 8949 return r; 8950 if (((t = s.keyType) == null ? void 0 : t._def.typeName) === U.ZodString && ((n = s.keyType._def.checks) != null && n.length)) { 8951 const { type: l, ...h } = jo(s.keyType._def, e); 8952 return { 8953 ...r, 8954 propertyNames: h 8955 }; 8956 } else { 8957 if (((i = s.keyType) == null ? void 0 : i._def.typeName) === U.ZodEnum) 8958 return { 8959 ...r, 8960 propertyNames: { 8961 enum: s.keyType._def.values 8962 } 8963 }; 8964 if (((o = s.keyType) == null ? void 0 : o._def.typeName) === U.ZodBranded && s.keyType._def.type._def.typeName === U.ZodString && ((u = s.keyType._def.type._def.checks) != null && u.length)) { 8965 const { type: l, ...h } = No(s.keyType._def, e); 8966 return { 8967 ...r, 8968 propertyNames: h 8969 }; 8970 } 8971 } 8972 return r; 8973} 8974function lh(s, e) { 8975 if (e.mapStrategy === "record") 8976 return Fo(s, e); 8977 const r = Oe(s.keyType._def, { 8978 ...e, 8979 currentPath: [...e.currentPath, "items", "items", "0"] 8980 }) || dt(e), a = Oe(s.valueType._def, { 8981 ...e, 8982 currentPath: [...e.currentPath, "items", "items", "1"] 8983 }) || dt(e); 8984 return { 8985 type: "array", 8986 maxItems: 125, 8987 items: { 8988 type: "array", 8989 items: [r, a], 8990 minItems: 2, 8991 maxItems: 2 8992 } 8993 }; 8994} 8995function ch(s) { 8996 const e = s.values, a = Object.keys(s.values).filter((n) => typeof e[e[n]] != "number").map((n) => e[n]), t = Array.from(new Set(a.map((n) => typeof n))); 8997 return { 8998 type: t.length === 1 ? t[0] === "string" ? "string" : "number" : ["string", "number"], 8999 enum: a 9000 }; 9001} 9002function dh(s) { 9003 return s.target === "openAi" ? void 0 : { 9004 not: dt({ 9005 ...s, 9006 currentPath: [...s.currentPath, "not"] 9007 }) 9008 }; 9009} 9010function hh(s) { 9011 return s.target === "openApi3" ? { 9012 enum: ["null"], 9013 nullable: !0 9014 } : { 9015 type: "null" 9016 }; 9017} 9018const oa = { 9019 ZodString: "string", 9020 ZodNumber: "number", 9021 ZodBigInt: "integer", 9022 ZodBoolean: "boolean", 9023 ZodNull: "null" 9024}; 9025function fh(s, e) { 9026 if (e.target === "openApi3") 9027 return Li(s, e); 9028 const r = s.options instanceof Map ? Array.from(s.options.values()) : s.options; 9029 if (r.every((a) => a._def.typeName in oa && (!a._def.checks || !a._def.checks.length))) { 9030 const a = r.reduce((t, n) => { 9031 const i = oa[n._def.typeName]; 9032 return i && !t.includes(i) ? [...t, i] : t; 9033 }, []); 9034 return { 9035 type: a.length > 1 ? a : a[0] 9036 }; 9037 } else if (r.every((a) => a._def.typeName === "ZodLiteral" && !a.description)) { 9038 const a = r.reduce((t, n) => { 9039 const i = typeof n._def.value; 9040 switch (i) { 9041 case "string": 9042 case "number": 9043 case "boolean": 9044 return [...t, i]; 9045 case "bigint": 9046 return [...t, "integer"]; 9047 case "object": 9048 if (n._def.value === null) 9049 return [...t, "null"]; 9050 case "symbol": 9051 case "undefined": 9052 case "function": 9053 default: 9054 return t; 9055 } 9056 }, []); 9057 if (a.length === r.length) { 9058 const t = a.filter((n, i, o) => o.indexOf(n) === i); 9059 return { 9060 type: t.length > 1 ? t : t[0], 9061 enum: r.reduce((n, i) => n.includes(i._def.value) ? n : [...n, i._def.value], []) 9062 }; 9063 } 9064 } else if (r.every((a) => a._def.typeName === "ZodEnum")) 9065 return { 9066 type: "string", 9067 enum: r.reduce((a, t) => [ 9068 ...a, 9069 ...t._def.values.filter((n) => !a.includes(n)) 9070 ], []) 9071 }; 9072 return Li(s, e); 9073} 9074const Li = (s, e) => { 9075 const r = (s.options instanceof Map ? Array.from(s.options.values()) : s.options).map((a, t) => Oe(a._def, { 9076 ...e, 9077 currentPath: [...e.currentPath, "anyOf", `${t}`] 9078 })).filter((a) => !!a && (!e.strictUnions || typeof a == "object" && Object.keys(a).length > 0)); 9079 return r.length ? { anyOf: r } : void 0; 9080}; 9081function ph(s, e) { 9082 if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(s.innerType._def.typeName) && (!s.innerType._def.checks || !s.innerType._def.checks.length)) 9083 return e.target === "openApi3" ? { 9084 type: oa[s.innerType._def.typeName], 9085 nullable: !0 9086 } : { 9087 type: [ 9088 oa[s.innerType._def.typeName], 9089 "null" 9090 ] 9091 }; 9092 if (e.target === "openApi3") { 9093 const a = Oe(s.innerType._def, { 9094 ...e, 9095 currentPath: [...e.currentPath] 9096 }); 9097 return a && "$ref" in a ? { allOf: [a], nullable: !0 } : a && { ...a, nullable: !0 }; 9098 } 9099 const r = Oe(s.innerType._def, { 9100 ...e, 9101 currentPath: [...e.currentPath, "anyOf", "0"] 9102 }); 9103 return r && { anyOf: [r, { type: "null" }] }; 9104} 9105function mh(s, e) { 9106 const r = { 9107 type: "number" 9108 }; 9109 if (!s.checks) 9110 return r; 9111 for (const a of s.checks) 9112 switch (a.kind) { 9113 case "int": 9114 r.type = "integer", $o(r, "type", a.message, e); 9115 break; 9116 case "min": 9117 e.target === "jsonSchema7" ? a.inclusive ? Ce(r, "minimum", a.value, a.message, e) : Ce(r, "exclusiveMinimum", a.value, a.message, e) : (a.inclusive || (r.exclusiveMinimum = !0), Ce(r, "minimum", a.value, a.message, e)); 9118 break; 9119 case "max": 9120 e.target === "jsonSchema7" ? a.inclusive ? Ce(r, "maximum", a.value, a.message, e) : Ce(r, "exclusiveMaximum", a.value, a.message, e) : (a.inclusive || (r.exclusiveMaximum = !0), Ce(r, "maximum", a.value, a.message, e)); 9121 break; 9122 case "multipleOf": 9123 Ce(r, "multipleOf", a.value, a.message, e); 9124 break; 9125 } 9126 return r; 9127} 9128function vh(s, e) { 9129 const r = e.target === "openAi", a = { 9130 type: "object", 9131 properties: {} 9132 }, t = [], n = s.shape(); 9133 for (const o in n) { 9134 let u = n[o]; 9135 if (u === void 0 || u._def === void 0) 9136 continue; 9137 let l = yh(u); 9138 l && r && (u._def.typeName === "ZodOptional" && (u = u._def.innerType), u.isNullable() || (u = u.nullable()), l = !1); 9139 const h = Oe(u._def, { 9140 ...e, 9141 currentPath: [...e.currentPath, "properties", o], 9142 propertyPath: [...e.currentPath, "properties", o] 9143 }); 9144 h !== void 0 && (a.properties[o] = h, l || t.push(o)); 9145 } 9146 t.length && (a.required = t); 9147 const i = gh(s, e); 9148 return i !== void 0 && (a.additionalProperties = i), a; 9149} 9150function gh(s, e) { 9151 if (s.catchall._def.typeName !== "ZodNever") 9152 return Oe(s.catchall._def, { 9153 ...e, 9154 currentPath: [...e.currentPath, "additionalProperties"] 9155 }); 9156 switch (s.unknownKeys) { 9157 case "passthrough": 9158 return e.allowedAdditionalProperties; 9159 case "strict": 9160 return e.rejectedAdditionalProperties; 9161 case "strip": 9162 return e.removeAdditionalStrategy === "strict" ? e.allowedAdditionalProperties : e.rejectedAdditionalProperties; 9163 } 9164} 9165function yh(s) { 9166 try { 9167 return s.isOptional(); 9168 } catch { 9169 return !0; 9170 } 9171} 9172const _h = (s, e) => { 9173 var a; 9174 if (e.currentPath.toString() === ((a = e.propertyPath) == null ? void 0 : a.toString())) 9175 return Oe(s.innerType._def, e); 9176 const r = Oe(s.innerType._def, { 9177 ...e, 9178 currentPath: [...e.currentPath, "anyOf", "1"] 9179 }); 9180 return r ? { 9181 anyOf: [ 9182 { 9183 not: dt(e) 9184 }, 9185 r 9186 ] 9187 } : dt(e); 9188}, bh = (s, e) => { 9189 if (e.pipeStrategy === "input") 9190 return Oe(s.in._def, e); 9191 if (e.pipeStrategy === "output") 9192 return Oe(s.out._def, e); 9193 const r = Oe(s.in._def, { 9194 ...e, 9195 currentPath: [...e.currentPath, "allOf", "0"] 9196 }), a = Oe(s.out._def, { 9197 ...e, 9198 currentPath: [...e.currentPath, "allOf", r ? "1" : "0"] 9199 }); 9200 return { 9201 allOf: [r, a].filter((t) => t !== void 0) 9202 }; 9203}; 9204function Ph(s, e) { 9205 return Oe(s.type._def, e); 9206} 9207function Sh(s, e) { 9208 const a = { 9209 type: "array", 9210 uniqueItems: !0, 9211 items: Oe(s.valueType._def, { 9212 ...e, 9213 currentPath: [...e.currentPath, "items"] 9214 }) 9215 }; 9216 return s.minSize && Ce(a, "minItems", s.minSize.value, s.minSize.message, e), s.maxSize && Ce(a, "maxItems", s.maxSize.value, s.maxSize.message, e), a; 9217} 9218function wh(s, e) { 9219 return s.rest ? { 9220 type: "array", 9221 minItems: s.items.length, 9222 items: s.items.map((r, a) => Oe(r._def, { 9223 ...e, 9224 currentPath: [...e.currentPath, "items", `${a}`] 9225 })).reduce((r, a) => a === void 0 ? r : [...r, a], []), 9226 additionalItems: Oe(s.rest._def, { 9227 ...e, 9228 currentPath: [...e.currentPath, "additionalItems"] 9229 }) 9230 } : { 9231 type: "array", 9232 minItems: s.items.length, 9233 maxItems: s.items.length, 9234 items: s.items.map((r, a) => Oe(r._def, { 9235 ...e, 9236 currentPath: [...e.currentPath, "items", `${a}`] 9237 })).reduce((r, a) => a === void 0 ? r : [...r, a], []) 9238 }; 9239} 9240function xh(s) { 9241 return { 9242 not: dt(s) 9243 }; 9244} 9245function Eh(s) { 9246 return dt(s); 9247} 9248const Rh = (s, e) => Oe(s.innerType._def, e), kh = (s, e, r) => { 9249 switch (e) { 9250 case U.ZodString: 9251 return jo(s, r); 9252 case U.ZodNumber: 9253 return mh(s, r); 9254 case U.ZodObject: 9255 return vh(s, r); 9256 case U.ZodBigInt: 9257 return Gd(s, r); 9258 case U.ZodBoolean: 9259 return Yd(); 9260 case U.ZodDate: 9261 return Do(s, r); 9262 case U.ZodUndefined: 9263 return xh(r); 9264 case U.ZodNull: 9265 return hh(r); 9266 case U.ZodArray: 9267 return Wd(s, r); 9268 case U.ZodUnion: 9269 case U.ZodDiscriminatedUnion: 9270 return fh(s, r); 9271 case U.ZodIntersection: 9272 return nh(s, r); 9273 case U.ZodTuple: 9274 return wh(s, r); 9275 case U.ZodRecord: 9276 return Fo(s, r); 9277 case U.ZodLiteral: 9278 return ih(s, r); 9279 case U.ZodEnum: 9280 return ah(s); 9281 case U.ZodNativeEnum: 9282 return ch(s); 9283 case U.ZodNullable: 9284 return ph(s, r); 9285 case U.ZodOptional: 9286 return _h(s, r); 9287 case U.ZodMap: 9288 return lh(s, r); 9289 case U.ZodSet: 9290 return Sh(s, r); 9291 case U.ZodLazy: 9292 return () => s.getter()._def; 9293 case U.ZodPromise: 9294 return Ph(s, r); 9295 case U.ZodNaN: 9296 case U.ZodNever: 9297 return dh(r); 9298 case U.ZodEffects: 9299 return rh(s, r); 9300 case U.ZodAny: 9301 return dt(r); 9302 case U.ZodUnknown: 9303 return Eh(r); 9304 case U.ZodDefault: 9305 return th(s, r); 9306 case U.ZodBranded: 9307 return No(s, r); 9308 case U.ZodReadonly: 9309 return Rh(s, r); 9310 case U.ZodCatch: 9311 return Xd(s, r); 9312 case U.ZodPipeline: 9313 return bh(s, r); 9314 case U.ZodFunction: 9315 case U.ZodVoid: 9316 case U.ZodSymbol: 9317 return; 9318 default: 9319 return /* @__PURE__ */ ((a) => { 9320 })(); 9321 } 9322}; 9323function Oe(s, e, r = !1) { 9324 var o; 9325 const a = e.seen.get(s); 9326 if (e.override) { 9327 const u = (o = e.override) == null ? void 0 : o.call(e, s, e, a, r); 9328 if (u !== Qd) 9329 return u; 9330 } 9331 if (a && !r) { 9332 const u = Th(a, e); 9333 if (u !== void 0) 9334 return u; 9335 } 9336 const t = { def: s, path: e.currentPath, jsonSchema: void 0 }; 9337 e.seen.set(s, t); 9338 const n = kh(s, s.typeName, e), i = typeof n == "function" ? Oe(n(), e) : n; 9339 if (i && Ah(s, e, i), e.postProcess) { 9340 const u = e.postProcess(i, s, e); 9341 return t.jsonSchema = i, u; 9342 } 9343 return t.jsonSchema = i, i; 9344} 9345const Th = (s, e) => { 9346 switch (e.$refStrategy) { 9347 case "root": 9348 return { $ref: s.path.join("/") }; 9349 case "relative": 9350 return { $ref: Io(e.currentPath, s.path) }; 9351 case "none": 9352 case "seen": 9353 return s.path.length < e.currentPath.length && s.path.every((r, a) => e.currentPath[a] === r) ? (console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`), dt(e)) : e.$refStrategy === "seen" ? dt(e) : void 0; 9354 } 9355}, Ah = (s, e, r) => (s.description && (r.description = s.description, e.markdownDescription && (r.markdownDescription = s.description)), r), Zi
9355= (s, e) => { 9356 const r = Jd(e); 9357 let a = typeof e == "object" && e.definitions ? Object.entries(e.definitions).reduce((u, [l, h]) => ({ 9358 ...u, 9359 [l]: Oe(h._def, { 9360 ...r, 9361 currentPath: [...r.basePath, r.definitionPath, l] 9362 }, !0) ?? dt(r) 9363 }), {}) : void 0; 9364 const t = typeof e == "string" ? e : (e == null ? void 0 : e.nameStrategy) === "title" || e == null ? void 0 : e.name, n = Oe(s._def, t === void 0 ? r : { 9365 ...r, 9366 currentPath: [...r.basePath, r.definitionPath, t] 9367 }, !1) ?? dt(r), i = typeof e == "object" && e.name !== void 0 && e.nameStrategy === "title" ? e.name : void 0; 9368 i !== void 0 && (n.title = i), r.flags.hasReferencedOpenAiAnyType && (a || (a = {}), a[r.openAiAnyTypeName] || (a[r.openAiAnyTypeName] = { 9369 // Skipping "object" as no properties can be defined and additionalProperties must be "false" 9370 type: ["string", "number", "integer", "boolean", "array", "null"], 9371 items: { 9372 $ref: r.$refStrategy === "relative" ? "1" : [ 9373 ...r.basePath, 9374 r.definitionPath, 9375 r.openAiAnyTypeName 9376 ].join("/") 9377 } 9378 })); 9379 const o = t === void 0 ? a ? { 9380 ...n, 9381 [r.definitionPath]: a 9382 } : n : { 9383 $ref: [ 9384 ...r.$refStrategy === "relative" ? [] : r.basePath, 9385 r.definitionPath, 9386 t 9387 ].join("/"), 9388 [r.definitionPath]: { 9389 ...a, 9390 [t]: n 9391 } 9392 }; 9393 return r.target === "jsonSchema7" ? o.$schema = "http://json-schema.org/draft-07/schema#" : (r.target === "jsonSchema2019-09" || r.target === "openAi") && (o.$schema = "https://json-schema.org/draft/2019-09/schema#"), r.target === "openAi" && ("anyOf" in o || "oneOf" in o || "allOf" in o || "type" in o && Array.isArray(o.type)) && console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."), o; 9394}; 9395var Ls; 9396(function(s) { 9397 s.Completable = "McpCompletable"; 9398})(Ls || (Ls = {})); 9399class Zs extends Pe { 9400 _parse(e) { 9401 const { ctx: r } = this._processInputParams(e), a = r.data; 9402 return this._def.type._parse({ 9403 data: a, 9404 path: r.path, 9405 parent: r 9406 }); 9407 } 9408 unwrap() { 9409 return this._def.type; 9410 } 9411} 9412Zs.create = (s, e) => new Zs({ 9413 type: s, 9414 typeName: Ls.Completable, 9415 complete: e.complete, 9416 ...Oh(e) 9417}); 9418function Oh(s) { 9419 if (!s) 9420 return {}; 9421 const { errorMap: e, invalid_type_error: r, required_error: a, description: t } = s; 9422 if (e && (r || a)) 9423 throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`); 9424 return e ? { errorMap: e, description: t } : { errorMap: (i, o) => { 9425 var u, l; 9426 const { message: h } = s; 9427 return i.code === "invalid_enum_value" ? { message: h ?? o.defaultError } : typeof o.data > "u" ? { message: (u = h ?? a) !== null && u !== void 0 ? u : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (l = h ?? r) !== null && l !== void 0 ? l : o.defaultError }; 9428 }, description: t }; 9429} 9430class Ch { 9431 constructor(e, r) { 9432 this._registeredResources = {}, this._registeredResourceTemplates = {}, this._registeredTools = {}, this._registeredPrompts = {}, this._toolHandlersInitialized = !1, this._completionHandlerInitialized = !1, this._resourceHandlersInitialized = !1, this._promptHandlersInitialized = !1, this.server = new Bd(e, r); 9433 } 9434 /** 9435 * Attaches to the given transport, starts it, and starts listening for messages. 9436 * 9437 * The `server` object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward. 9438 */ 9439 async connect(e) { 9440 return await this.server.connect(e); 9441 } 9442 /** 9443 * Closes the connection. 9444 */ 9445 async close() { 9446 await this.server.close(); 9447 } 9448 setToolRequestHandlers() { 9449 this._toolHandlersInitialized || (this.server.assertCanSetRequestHandler(js.shape.method.value), this.server.assertCanSetRequestHandler(Fs.shape.method.value), this.server.registerCapabilities({ 9450 tools: { 9451 listChanged: !0 9452 } 9453 }), this.server.setRequestHandler(js, () => ({ 9454 tools: Object.entries(this._registeredTools).filter(([, e]) => e.enabled).map(([e, r]) => { 9455 const a = { 9456 name: e, 9457 title: r.title, 9458 description: r.description, 9459 inputSchema: r.inputSchema ? Zi(r.inputSchema, {
9460 strictUnions: !0 9461 }) : $h, 9462 annotations: r.annotations 9463 }; 9464 return r.outputSchema && (a.outputSchema = Zi(r.outputSchema, { strictUnions: !0 })), a; 9465 }) 9466 })), this.server.setRequestHandler(Fs, async (e, r) => { 9467 const a = this._registeredTools[e.params.name]; 9468 if (!a) 9469 throw new Ve(qe.InvalidParams, `Tool ${e.params.name} not found`); 9470 if (!a.enabled) 9471 throw new Ve(qe.InvalidParams, `Tool ${e.params.name} disabled`); 9472 let t; 9473 if (a.inputSchema) { 9474 const n = await a.inputSchema.safeParseAsync(e.params.arguments); 9475 if (!n.success) 9476 throw new Ve(qe.InvalidParams, `Invalid arguments for tool ${e.params.name}: ${n.error.message}`); 9477 const i = n.data, o = a.callback; 9478 try { 9479 t = await Promise.resolve(o(i, r)); 9480 } catch (u) { 9481 t = { 9482 content: [ 9483 { 9484 type: "text", 9485 text: u instanceof Error ? u.message : String(u) 9486 } 9487 ], 9488 isError: !0 9489 }; 9490 } 9491 } else { 9492 const n = a.callback; 9493 try { 9494 t = await Promise.resolve(n(r)); 9495 } catch (i) { 9496 t = { 9497 content: [ 9498 { 9499 type: "text", 9500 text: i instanceof Error ? i.message : String(i) 9501 } 9502 ], 9503 isError: !0 9504 }; 9505 } 9506 } 9507 if (a.outputSchema && !t.isError) { 9508 if (!t.structuredContent) 9509 throw new Ve(qe.InvalidParams, `Tool ${e.params.name} has an output schema but no structured content was provided`); 9510 const n = await a.outputSchema.safeParseAsync(t.structuredContent); 9511 if (!n.success) 9512 throw new Ve(qe.InvalidParams, `Invalid structured content for tool ${e.params.name}: ${n.error.message}`); 9513 } 9514 return t; 9515 }), this._toolHandlersInitialized = !0); 9516 } 9517 setCompletionRequestHandler() { 9518 this._completionHandlerInitialized || (this.server.assertCanSetRequestHandler(qs.shape.method.value), this.server.registerCapabilities({ 9519 completions: {} 9520 }), this.server.setRequestHandler(qs, async (e) => { 9521 switch (e.params.ref.type) { 9522 case "ref/prompt": 9523 return this.handlePromptCompletion(e, e.params.ref); 9524 case "ref/resource": 9525 return this.handleResourceCompletion(e, e.params.ref); 9526 default: 9527 throw new Ve(qe.InvalidParams, `Invalid completion reference: ${e.params.ref}`); 9528 } 9529 }), this._completionHandlerInitialized = !0); 9530 } 9531 async handlePromptCompletion(e, r) { 9532 const a = this._registeredPrompts[r.name]; 9533 if (!a) 9534 throw new Ve(qe.InvalidParams, `Prompt ${r.name} not found`); 9535 if (!a.enabled) 9536 throw new Ve(qe.InvalidParams, `Prompt ${r.name} disabled`); 9537 if (!a.argsSchema) 9538 return Mr; 9539 const t = a.argsSchema.shape[e.params.argument.name]; 9540 if (!(t instanceof Zs)) 9541 return Mr; 9542 const i = await t._def.complete(e.params.argument.value, e.params.context); 9543 return zi(i); 9544 } 9545 async handleResourceCompletion(e, r) { 9546 const a = Object.values(this._registeredResourceTemplates).find((i) => i.resourceTemplate.uriTemplate.toString() === r.uri); 9547 if (!a) { 9548 if (this._registeredResources[r.uri]) 9549 return Mr; 9550 throw new Ve(qe.InvalidParams, `Resource template ${e.params.ref.uri} not found`); 9551 } 9552 const t = a.resourceTemplate.completeCallback(e.params.argument.name); 9553 if (!t) 9554 return Mr; 9555 const n = await t(e.params.argument.value, e.params.context); 9556 return zi(n); 9557 } 9558 setResourceRequestHandlers() { 9559 this._resourceHandlersInitialized || (this.server.assertCanSetRequestHandler(Cs.shape.method.value), this.server.assertCanSetRequestHandler($s.shape.method.value), this.server.assertCanSetRequestHandler(Is.shape.method.value), this.server.registerCapabilities({ 9560 resources: { 9561 listChanged: !0 9562 } 9563 }), this.server.setRequestHandler(Cs, async (e, r) => { 9564 const a = Object.entries(this._registeredResources).filter(([n, i]) => i.enabled).map(([n, i]) => ({ 9565 uri: n, 9566 name: i.name, 9567 ...i.metadata 9568 })), t = []; 9569 for (const n of Object.values(this._registeredResourceTemplates)) { 9570 if (!n.resourceTemplate.listCallback) 9571 continue; 9572 const i = await n.resourceTemplate.listCallback(r); 9573 for (const o of i.resources) 9574 t.push({ 9575 ...n.metadata, 9576 // the defined resource metadata should override the template metadata if present 9577 ...o 9578 }); 9579 } 9580 return { resources: [...a, ...t] }; 9581 }), this.server.setRequestHandler($s, async () => ({ resourceTemplates: Object.entries(this._registeredResourceTemplates).map(([r, a]) => ({ 9582 name: r, 9583 uriTemplate: a.resourceTemplate.uriTemplate.toString(), 9584 ...a.metadata 9585 })) })), this.server.setRequestHandler(Is, async (e, r) => { 9586 const a = new URL(e.params.uri), t = this._registeredResources[a.toString()]; 9587 if (t) { 9588 if (!t.enabled) 9589 throw new Ve(qe.InvalidParams, `Resource ${a} disabled`); 9590 return t.readCallback(a, r); 9591 } 9592 for (const n of Object.values(this._registeredResourceTemplates)) { 9593 const i = n.resourceTemplate.uriTemplate.match(a.toString()); 9594 if (i) 9595 return n.readCallback(a, i, r); 9596 } 9597 throw new Ve(qe.InvalidParams, `Resource ${a} not found`); 9598 }), this.setCompletionRequestHandler(), this._resourceHandlersInitialized = !0); 9599 } 9600 setPromptRequestHandlers() { 9601 this._promptHandlersInitialized || (this.server.assertCanSetRequestHandler(Ns.shape.method.value), this.server.assertCanSetRequestHandler(Ds.shape.method.value), this.server.registerCapabilities({ 9602 prompts: { 9603 listChanged: !0 9604 } 9605 }), this.server.setRequestHandler(Ns, () => ({ 9606 prompts: Object.entries(this._registeredPrompts).filter(([, e]) => e.enabled).map(([e, r]) => ({ 9607 name: e, 9608 title: r.title, 9609 description: r.description, 9610 arguments: r.argsSchema ? Nh(r.argsSchema) : void 0 9611 })) 9612 })), this.server.setRequestHandler(Ds, async (e, r) => { 9613 const a = this._registeredPrompts[e.params.name]; 9614 if (!a) 9615 throw new Ve(qe.InvalidParams, `Prompt ${e.params.name} not found`); 9616 if (!a.enabled) 9617 throw new Ve(qe.InvalidParams, `Prompt ${e.params.name} disabled`); 9618 if (a.argsSchema) { 9619 const t = await a.argsSchema.safeParseAsync(e.params.arguments); 9620 if (!t.success) 9621 throw new Ve(qe.InvalidParams, `Invalid arguments for prompt ${e.params.name}: ${t.error.message}`); 9622 const n = t.data, i = a.callback; 9623 return await Promise.resolve(i(n, r)); 9624 } else { 9625 const t = a.callback; 9626 return await Promise.resolve(t(r)); 9627 } 9628 }), this.setCompletionRequestHandler(), this._promptHandlersInitialized = !0); 9629 } 9630 resource(e, r, ...a) { 9631 let t; 9632 typeof a[0] == "object" && (t = a.shift()); 9633 const n = a[0]; 9634 if (typeof r == "string") { 9635 if (this._registeredResources[r]) 9636 throw new Error(`Resource ${r} is already registered`); 9637 const i = this._createRegisteredResource(e, void 0, r, t, n); 9638 return this.setResourceRequestHandlers(), this.sendResourceListChanged(), i; 9639 } else { 9640 if (this._registeredResourceTemplates[e]) 9641 throw new Error(`Resource template ${e} is already registered`); 9642 const i = this._createRegisteredResourceTemplate(e, void 0, r, t, n); 9643 return this.setResourceRequestHandlers(), this.sendResourceListChanged(), i; 9644 } 9645 } 9646 registerResource(e, r, a, t) { 9647 if (typeof r == "string") { 9648 if (this._registeredResources[r]) 9649 throw new Error(`Resource ${r} is already registered`); 9650 const n = this._createRegisteredResource(e, a.title, r, a, t); 9651 return this.setResourceRequestHandlers(), this.sendResourceListChanged(), n; 9652 } else { 9653 if (this._registeredResourceTemplates[e]) 9654 throw new Error(`Resource template ${e} is already registered`); 9655 const n = this._createRegisteredResourceTemplate(e, a.title, r, a, t); 9656 return this.setResourceRequestHandlers(), this.sendResourceListChanged(), n; 9657 } 9658 } 9659 _createRegisteredResource(e, r, a, t, n) { 9660 const i = { 9661 name: e, 9662 title: r, 9663 metadata: t, 9664 readCallback: n, 9665 enabled: !0, 9666 disable: () => i.update({ enabled: !1 }), 9667 enable: () => i.update({ enabled: !0 }), 9668 remove: () => i.update({ uri: null }), 9669 update: (o) => { 9670 typeof o.uri < "u" && o.uri !== a && (delete this._registeredResources[a], o.uri && (this._registeredResources[o.uri] = i)), typeof o.name < "u" && (i.name = o.name), typeof o.title < "u" && (i.title = o.title), typeof o.metadata < "u" && (i.metadata = o.metadata), typeof o.callback < "u" && (i.readCallback = o.callback), typeof o.enabled < "u" && (i.enabled = o.enabled), this.sendResourceListChanged(); 9671 } 9672 }; 9673 return this._registeredResources[a] = i, i; 9674 } 9675 _createRegisteredResourceTemplate(e, r, a, t, n) { 9676 const i = { 9677 resourceTemplate: a, 9678 title: r, 9679 metadata: t, 9680 readCallback: n, 9681 enabled: !0, 9682 disable: () => i.update({ enabled: !1 }), 9683 enable: () => i.update({ enabled: !0 }), 9684 remove: () => i.update({ name: null }), 9685 update: (o) => { 9686 typeof o.name < "u" && o.name !== e && (delete this._registeredResourceTemplates[e], o.name && (this._registeredResourceTemplates[o.name] = i)), typeof o.title < "u" && (i.title = o.title), typeof o.template < "u" && (i.resourceTemplate = o.template), typeof o.metadata < "u" && (i.metadata = o.metadata), typeof o.callback < "u" && (i.readCallback = o.callback), typeof o.enabled < "u" && (i.enabled = o.enabled), this.sendResourceListChanged(); 9687 } 9688 }; 9689 return this._registeredResourceTemplates[e] = i, i; 9690 } 9691 _createRegisteredPrompt(e, r, a, t, n) { 9692 const i = { 9693 title: r, 9694 description: a, 9695 argsSchema: t === void 0 ? void 0 : W(t), 9696 callback: n, 9697 enabled: !0, 9698 disable: () => i.update({ enabled: !1 }), 9699 enable: () => i.update({ enabled: !0 }), 9700 remove: () => i.update({ name: null }), 9701 update: (o) => { 9702 typeof o.name < "u" && o.name !== e && (delete this._registeredPrompts[e], o.name && (this._registeredPrompts[o.name] = i)), typeof o.title < "u" && (i.title = o.title), typeof o.description < "u" && (i.description = o.description), typeof o.argsSchema < "u" && (i.argsSchema = W(o.argsSchema)), typeof o.callback < "u" && (i.callback = o.callback), typeof o.enabled < "u" && (i.enabled = o.enabled), this.sendPromptListChanged(); 9703 } 9704 }; 9705 return this._registeredPrompts[e] = i, i; 9706 } 9707 _createRegisteredTool(e, r, a, t, n, i, o) { 9708 const u = { 9709 title: r, 9710 description: a, 9711 inputSchema: t === void 0 ? void 0 : W(t),
9712 outputSchema: n === void 0 ? void 0 : W(n), 9713 annotations: i, 9714 callback: o, 9715 enabled: !0, 9716 disable: () => u.update({ enabled: !1 }), 9717 enable: () => u.update({ enabled: !0 }), 9718 remove: () => u.update({ name: null }), 9719 update: (l) => { 9720 typeof l.name < "u" && l.name !== e && (delete this._registeredTools[e], l.name && (this._registeredTools[l.name] = u)), typeof l.title < "u" && (u.title = l.title), typeof l.description < "u" && (u.description = l.description), typeof l.paramsSchema < "u" && (u.inputSchema = W(l.paramsSchema)), typeof l.callback < "u" && (u.callback = l.callback), typeof l.annotations < "u" && (u.annotations = l.annotations), typeof l.enabled < "u" && (u.enabled = l.enabled), this.sendToolListChanged(); 9721 } 9722 }; 9723 return this._registeredTools[e] = u, this.setToolRequestHandlers(), this.sendToolListChanged(), u; 9724 } 9725 /** 9726 * tool() implementation. Parses arguments passed to overrides defined above. 9727 */ 9728 tool(e, ...r) { 9729 if (this._registeredTools[e]) 9730 throw new Error(`Tool ${e} is already registered`); 9731 let a, t, n, i; 9732 if (typeof r[0] == "string" && (a = r.shift()), r.length > 1) { 9733 const u = r[0]; 9734 Mi(u) ? (t = r.shift(), r.length > 1 && typeof r[0] == "object" && r[0] !== null && !Mi(r[0]) && (i = r.shift())) : typeof u == "object" && u !== null && (i = r.shift()); 9735 } 9736 const o = r[0]; 9737 return this._createRegisteredTool(e, void 0, a, t, n, i, o); 9738 } 9739 /** 9740 * Registers a tool with a config object and callback. 9741 */ 9742 registerTool(e, r, a) { 9743 if (this._registeredTools[e]) 9744 throw new Error(`Tool ${e} is already registered`); 9745 const { title: t, description: n, inputSchema: i, outputSchema: o, annotations: u } = r; 9746 return this._createRegisteredTool(e, t, n, i, o, u, a); 9747 } 9748 prompt(e, ...r) { 9749 if (this._registeredPrompts[e]) 9750 throw new Error(`Prompt ${e} is already registered`); 9751 let a; 9752 typeof r[0] == "string" && (a = r.shift()); 9753 let t; 9754 r.length > 1 && (t = r.shift()); 9755 const n = r[0], i = this._createRegisteredPrompt(e, void 0, a, t, n); 9756 return this.setPromptRequestHandlers(), this.sendPromptListChanged(), i; 9757 } 9758 /** 9759 * Registers a prompt with a config object and callback. 9760 */ 9761 registerPrompt(e, r, a) { 9762 if (this._registeredPrompts[e]) 9763 throw new Error(`Prompt ${e} is already registered`); 9764 const { title: t, description: n, argsSchema: i } = r, o = this._createRegisteredPrompt(e, t, n, i, a); 9765 return this.setPromptRequestHandlers(), this.sendPromptListChanged(), o; 9766 } 9767 /** 9768 * Checks if the server is connected to a transport. 9769 * @returns True if the server is connected 9770 */ 9771 isConnected() { 9772 return this.server.transport !== void 0; 9773 } 9774 /** 9775 * Sends a resource list changed event to the client, if connected. 9776 */ 9777 sendResourceListChanged() { 9778 this.isConnected() && this.server.sendResourceListChanged(); 9779 } 9780 /** 9781 * Sends a tool list changed event to the client, if connected. 9782 */ 9783 sendToolListChanged() { 9784 this.isConnected() && this.server.sendToolListChanged(); 9785 } 9786 /** 9787 * Sends a prompt list changed event to the client, if connected. 9788 */ 9789 sendPromptListChanged() { 9790 this.isConnected() && this.server.sendPromptListChanged(); 9791 } 9792} 9793const $h = { 9794 type: "object", 9795 properties: {} 9796}; 9797function Mi(s) { 9798 return typeof s != "object" || s === null ? !1 : Object.keys(s).length === 0 || Object.values(s).some(Ih); 9799} 9800function Ih(s) { 9801 return s !== null && typeof s == "object" && "parse" in s && typeof s.parse == "function" && "safeParse" in s && typeof s.safeParse == "function"; 9802} 9803function Nh(s) { 9804 return Object.entries(s.shape).map(([e, r]) => ({ 9805 name: e, 9806 description: r.description, 9807 required: !r.isOptional() 9808 })); 9809} 9810function zi(s) { 9811 return { 9812 completion: { 9813 values: s.slice(0, 100), 9814 total: s.length, 9815 hasMore: s.length > 100 9816 } 9817 }; 9818} 9819const Mr = { 9820 completion: { 9821 values: [], 9822 hasMore: !1 9823 } 9824}; 9825async function Dh(s, e) { 9826 var a, t, n; 9827 if (!((a = window.jetEngineCompatibilityAngie) != null && a.api_base)) 9828 throw new Error("API base URL is not defined"); 9829 const r = await fetch( 9830 ((t = window.jetEngineCompatibilityAngie) == null ? void 0 : t.api_base) + s, 9831 { 9832 method: "POST", 9833 headers: { 9834 "Content-Type": "application/json", 9835 "X-WP-Nonce": ((n = window.jetEngineCompatibilityAngie) == null ? void 0 : n.nonce) || "" 9836 }, 9837 body: JSON.stringify({ input: e }) 9838 } 9839 ); 9840 if (!r.ok) 9841 throw new Error(`HTTP error! status: ${r.status}`); 9842 return await r.json(); 9843} 9844function qo(s) { 9845 const e = {}; 9846 for (const r in s) 9847 e[r] = Lo(s[r]); 9848 return e; 9849} 9850const Lo = (s) => { 9851 let e; 9852 switch (s.type) { 9853 case "string": 9854 s.enum ? e = Nt(s.enum) : e = H(); 9855 break; 9856 case "number": 9857 e = et(); 9858 break; 9859 case "boolean": 9860 e = ct(); 9861 break; 9862 case "array": 9863 e = Ke(Lo(s.items)); 9864 break; 9865 case "object": 9866 s.properties ? e = W(qo(s.properties)) : e = gr(H(), Gl()); 9867 break; 9868 default: 9869 e = H(); 9870 }
9871 return s.description && (e = e.describe(s.description)), e; 9872}; 9873function jh() { 9874 var e; 9875 const s = new Ch( 9876 { 9877 name: "croco-angie-mcp-server", 9878 version: "1.0.0" 9879 }, 9880 { 9881 capabilities: { 9882 tools: {} 9883 } 9884 } 9885 ); 9886 for (const r of ((e = window.jetEngineCompatibilityAngie) == null ? void 0 : e.features) || []) { 9887 let a = r.id; 9888 a = a.replace(/\//g, "-"), a = a.replace(/-/g, "_"), s.registerTool( 9889 a, 9890 { 9891 title: r.label, 9892 description: r.description, 9893 inputSchema: qo(r.input_schema.properties) 9894 }, 9895 async (t, n) => { 9896 const i = await Dh(r.name, t); 9897 return console.log(n), { 9898 content: [{ 9899 type: "text", 9900 text: JSON.stringify(i, null, 2) 9901 }] 9902 }; 9903 } 9904 ); 9905 } 9906 return s; 9907} 9908const Fh = async () => { 9909 try { 9910 const s = jh(); 9911 await new El().registerServer({ 9912 name: "croco-angie-mcp-server", 9913 version: "1.0.0", 9914 description: "Crocoblock MCP Server for Angie AI assistant", 9915 server: s 9916 }), console.log("Crocoblock MCP Server registered with Angie successfully"); 9917 } catch (s) { 9918 console.error("Failed to register Crocoblock MCP Server with Angie:", s); 9919 } 9920}; 9921Fh();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.