/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/jsonv-ts@0.11.1/dist/lib/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var A=(t=[],e="")=>"/"+[e,...t.map(n=>String(n).replace(/~/g,"~0").replace(/\//g,"~1"))].filter(Boolean).join("/"),F=t=>{let e=t;if(e==="#")return[];if(e.startsWith("#")){e=e.slice(1);try{e=decodeURIComponent(e)}catch{}}return e===""?[]:e.startsWith("/")?e.split("/").slice(1).map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~")):[e]};function Oe(t,e,n=void 0){let r=typeof e=="string"?F(e):e;return M(t,r,n)}function M(t,e,n=void 0){let r=typeof e=="string"?e.split(/[.\[\]\"]+/).filter(i=>i):e;if(r.length===0)return t;try{let[i,...o]=r;return!i||!(i in t)?n:M(t[i],o,n)}catch{if(typeof n<"u")return n;throw new Error(`Invalid path: ${r.join(".")}`)}}var l=(t={},e,n,r)=>({valid:!1,errors:[...t.errors??[],{keywordLocation:A([...t.keywordPath??[],e]),instanceLocation:A(t.instancePath),error:typeof n=="string"?n:`Invalid value for ${e}`,data:r}]}),u=()=>({valid:!0,errors:[]}),P=(t,e,n)=>{let r=Array.isArray(e)?e:[e],i=n?Array.isArray(n)?n:[n]:[];return{...t,keywordPath:[...t.keywordPath??[],...r],instancePath:i?[...t.instancePath??[],...i]:t.instancePath}},$=(t={})=>({...t,errors:[]});var v=class extends Error{constructor(e){super(`Expected ${e}`)}},se=class extends Error{constructor(n,r){super(`${n??"Invalid raw schema"}: ${JSON.stringify(r)}`);this.schema=r}},ae=class extends Error{constructor(n,r){super(`${n}, got: 'type "${typeof r}": ${JSON.stringify(r)}'`);this.value=r}};var S=Symbol.for("jsonv-ts:schema");function Le(t){return t===null}function m(t){return!Array.isArray(t)&&typeof t=="object"&&t!==null}function Ke(t){return Object.prototype.toString.call(t)==="[object Object]"}function y(t){return typeof t=="string"}function w(t){return typeof t=="number"}function Je(t){return typeof t=="number"&&Number.isInteger(t)}function L(t){return typeof t=="boolean"}function I(t){return Array.isArray(t)}function Jt(t){return typeof t!="boolean"}function We(t){return t!==void 0&&Jt(t)&&"type"in t}function p(t){return t!==void 0&&m(t)&&S in t}function K(t){return p(t)&&typeof t.toJSON()=="boolean"}function Se(t,e,n){if(!t)throw new ae(e,n)}function ge(t){return y(t)?t.normalize("NFC"):t}function D(t,e){let n=typeof t;if(n!==typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e))return!1;let r=t.length;if(r!==e.length)return!1;for(let i=0;i<r;i++)if(!D(t[i],e[i]))return!1;return!0}if(n==="object"){if(!t||!e)return t===e;let r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;for(let s of r)if(!D(t[s],e[s]))return!1;return!0}return t===e}function qe(t,e){return e.reduce((n,r)=>(r in t&&(n[r]=t[r]),n),{})}function ce(t){try{return structuredClone(t)}catch{return t}}var T=class t{constructor(e,n={}){this.root=e;this.refs=new Map,this.meta=new WeakMap,this.rawRoot=n.rawRoot,this.compileRaw=n.compileRaw,this.index(e,[],this.resourceId(e.$id||""),e.$id||"",this.draftFromSchema(e.$schema),this.hasValidationVocabulary(e))}static remotes=new Map;static owners=new WeakMap;refs;meta;rawRoot;compileRaw;hasRef(e,n){return n!==void 0&&"$ref"in e&&y(e.$ref)}hasDynamicRef(e,n){return n!==void 0&&"$dynamicRef"in e&&y(e.$dynamicRef)}resolve(e,n=this.root){let r=this.meta.get(n)?.resource||this.meta.get(this.root)?.resource||"",i=this.normalizeRef(e,r),o=this.refs.get(i);if(o)return o;let[s,c]=this.splitFragment(i),a=t.remotes.get(s);if(a){let h=a.getResolver();return c?h.resolve(`#${c}`,a):a}let d=Oe(this.root,e);if(p(d))return d;let f=this.resolveRawPointer(i);if(f)return f;throw new Error(`ref not found: ${e}`)}resolveDynamicRef(e,n,r=[]){let i=this.resolve(e,n),o=this.dynamicAnchorName(e);if(!o||i.$dynamicAnchor!==o)return i;for(let s of r){let c=s.resolver.dynamicAnchorInResource(s.resource,o);if(c)return c}return i}static registerRemote(e,n){let r=e.split("#")[0]||"";n.$id||(n.$id=r),t.remotes.set(r,n)}static clearRemotes(){t.remotes.clear()}keyFor(e){return this.meta.get(e)?.key||"#"}resourceFor(e=this.root){return this.meta.get(e)?.resource||this.meta.get(this.root)?.resource||""}draftFor(e=this.root){return this.meta.get(e)?.draft||this.meta.get(this.root)?.draft||"2020-12"}disablesValidationVocabulary(e=this.root){return(this.meta.get(e)||this.meta.get(this.root))?.validationVocabulary===!1}owns(e){return this.meta.has(e)}static ownerOf(e){return t.owners.get(e)}resolveRawPointer(e){if(!this.rawRoot||!this.compileRaw)return;let[n,r]=this.splitFragment(e);if(!r?.startsWith("/")||n!==this.resourceFor(this.root))return;let i=Oe(this.rawRoot,`#${r}`);if(i===void 0)return;let o=this.compileRaw(i),s=this.meta.get(this.root);return this.index(o,F(`#${r}`),n,n,s?.draft||"2020-12",s?.validationVocabulary??!0),this.refs.set(e,o),o}index(e,n,r,i,o,s){let c=e.$id,a=y(c)&&c.length>0,d=a?this.resourceId(this.resolveUri(c,i)):r,f=e.$schema?this.draftFromSchema(e.$schema):o,h=e.$schema?this.hasValidationVocabulary(e):s,x=a?[]:n,O=this.pointer(x),ne=`${d}${O}`;this.meta.set(e,{resource:d,pointer:O,key:ne,draft:f,validationVocabulary:h}),t.owners.set(e,this),this.refs.set(ne,e),a&&n.length>0&&this.refs.set(`${r}${this.pointer(n)}`,e),O==="#"&&(this.refs.set(d,e),this.refs.set(`${d}#`,e)),a&&(this.refs.set(d,e),this.refs.set(`${d}#`,e)),y(e.$anchor)&&this.refs.set(`${d}#${e.$anchor}`,e),y(e.$dynamicAnchor)&&this.refs.set(`${d}#${e.$dynamicAnchor}`,e);for(let[re,E]of Object.entries(e))if(!this.shouldSkipKey(re)){if(p(E))this.index(E,[...x,re],d,d,f,h);else if(Array.isArray(E))E.forEach((ie,oe)=>{p(ie)&&this.index(ie,[...x,re,oe],d,d,f,h)});else if(E&&typeof E=="object")for(let[ie,oe]of Object.entries(E))p(oe)&&this.index(oe,[...x,re,ie],d,d,f,h)}}normalizeRef(e,n){if(e==="")return`${n}#`;if(e.startsWith("#"))return`${n}${this.normalizeFragment(e)}`;let r=this.resolveUri(e,n),[i,o=""]=this.splitFragment(r);return`${this.resourceId(i)}${this.normalizeFragment(o?`#${o}`:"#")}`}normalizeFragment(e){return e===""||e==="#"?"#":e.startsWith("#/")?this.pointer(F(e)):e}resolveUri(e,n){try{return new URL(e,n||void 0).href}catch{if(!n||e.startsWith("#"))return`${n}${e}`;let[i]=this.splitFragment(n),o=i.lastIndexOf("/");return`${o>=0?i.slice(0,o+1):""}${e}`}}resourceId(e){let[n]=this.splitFragment(e);return n}splitFragment(e){let n=e.indexOf("#");return n===-1?[e]:[e.slice(0,n),e.slice(n+1)]}dynamicAnchorInResource(e,n){let r=this.refs.get(`${e}#${n}`);return r?.$dynamicAnchor===n?r:void 0}dynamicAnchorName(e){let n=e.indexOf("#");if(n===-1)return;let r=e.slice(n+1);if(!(!r||r.startsWith("/")))return r}pointer(e){return e.length===0?"#":`#${A(e)}`}shouldSkipKey(e){return e==="~standard"||e==="_resolver"||e==="_resolverOptions"||e==="bool"||e==="type"||e==="$id"||e==="$schema"||e==="$vocabulary"||e==="$ref"||e==="$dynamicRef"||e==="$anchor"||e==="$dynamicAnchor"||e==="title"||e==="description"||e==="$comment"||e==="default"||e==="enum"||e==="const"}draftFromSchema(e){return e?.includes("2019-09")?"2019-09":"2020-12"}hasValidationVocabulary(e){return!(e.$schema?.includes("metaschema-no-validation")||e.$vocabulary?.["https://json-schema.org/draft/2020-12/vocab/validation"]===!1)}};function ze(t,e,n={}){let r=e;try{r=structuredClone(e)}catch{r=JSON.parse(JSON.stringify(e))}let i={resolver:n.resolver||new T(t),depth:n.depth||0,dropUnknown:n.dropUnknown??!1};return i.resolver.hasRef(t,r)?i.resolver.resolve(t.$ref,t).coerce(r,{...i,depth:i.depth+1}):r}function xe(t){return t instanceof RegExp?t:new RegExp(t.replace(/\\p\{digit\}/gi,"\\p{Decimal_Number}"),"u")}var He=({type:t},e,n={})=>{if(t===void 0)return u();if(e===void 0)return u();let r,i={string:y,number:w,integer:Je,object:m,array:I,boolean:L,null:Le};if(Array.isArray(t)){for(let o of t){if(!(o in i))throw new v(`Unknown type: ${o}`);if(i[o](e))return u()}r=`Expected one of: ${t.join(", ")}`}else{if(!(t in i))throw new v(`Unknown type: ${t}`);i[t](e)||(r=`Expected ${t}`)}return r?l(n,"type",r,e):u()},Ye=({const:t},e,n={})=>D(t,e)?u():l(n,"const",`Expected const: ${t}`,e),Ze=({enum:t=[]},e,n={})=>t.some(r=>D(r,e))?u():l(n,"enum",`Expected enum: ${JSON.stringify(t)}`,e);function _e(t,e,n={}){return t.filter(r=>{let i=$({...n,evaluated:k(n.evaluated)}),o=r.validate(e,i);return o.valid&&n.evaluated&&i.evaluated&&W(n.evaluated,i.evaluated),o.valid})}var Ge=({anyOf:t=[]},e,n={})=>{let r=k(n.localEvaluatedBase||n.evaluated),i=0;for(let o of t){let s=$({...n,evaluated:k(r)});o.validate(e,s).valid&&(i++,n.evaluated&&s.evaluated&&W(n.evaluated,s.evaluated))}return i>0?u():l(n,"anyOf","Expected at least one to match",e)},Qe=({oneOf:t=[]},e,n={})=>{let r=k(n.localEvaluatedBase||n.evaluated),i,o=0;for(let s of t){let c=$({...n,evaluated:k(r)});s.validate(e,c).valid&&(o++,i=c)}return o===1?(n.evaluated&&i?.evaluated&&W(n.evaluated,i.evaluated),u()):l(n,"oneOf","Expected exactly one to match",e)},Xe=({allOf:t=[]},e,n={})=>{let r=k(n.localEvaluatedBase||n.evaluated),i=[];for(let o of t){let s=$({...n,evaluated:k(r)});if(!o.validate(e,s).valid)return l(n,"allOf","Expected all to match",e);i.push(s)}for(let o of i)n.evaluated&&o.evaluated&&W(n.evaluated,o.evaluated);return u()},et=({not:t},e,n={})=>e===void 0?u():p(t)&&t.validate(e,{...n,errors:[],evaluated:k(n.localEvaluatedBase||n.evaluated)}).valid?l(n,"not","Expected not to match",e):u(),tt=({if:t,then:e,else:n},r,i={})=>{if(t){let o=$({...i,evaluated:k(i.localEvaluatedBase||i.evaluated)});if(t.validate(r,o).valid)return i.evaluated&&o.evaluated&&W(i.evaluated,o.evaluated),e?e.validate(r,$(i)):u();if(n)return n.validate(r,$(i))}return u()},nt=({pattern:t=""},e,n={})=>y(e)?xe(t).test(e)?u():l(n,"pattern",`Expected string matching pattern ${t}`,e):u(),rt=({minLength:t=0},e,n={})=>y(e)?[...ge(e)].length>=t?u():l(n,"minLength",`Expected string with minimum length of ${t}`,e):u(),it=({maxLength:t=0},e,n={})=>y(e)?[...ge(e)].length<=t?u():l(n,"maxLength",`Expected string with maximum length of ${t}`,e):u(),ot=({multipleOf:t=0},e,n={})=>{if(!w(e))return u();if(!(Number.isFinite(e)&&Number.isFinite(t))||t<=0)throw new v("number");let r=e/t;return Number.isFinite(r)&&Be(r)?u():!Number.isFinite(r)&&Number.isInteger(e)&&Be(1/t)?u():l(n,"multipleOf",`Expected number being a multiple of ${t}`,e)};function Be(t){let e=Number.EPSILON*Math.max(1,Math.abs(t));return Math.abs(t-Math.round(t))<=e}var st=({maximum:t=0},e,n={})=>!w(e)||e<=t?u():l(n,"maximum",`Expected number less than or equal to ${t}`,e),at=({exclusiveMaximum:t=0},e,n={})=>!w(e)||e<t?u():l(n,"exclusiveMaximum",`Expected number less than ${t}`,e),ct=({minimum:t=0},e,n={})=>!w(e)||e>=t?u():l(n,"minimum",`Expected number greater than or equal to ${t}`,e),ut=({exclusiveMinimum:t=0},e,n={})=>!w(e)||e>t?u():l(n,"exclusiveMinimum",`Expected number greater than ${t}`,e),dt=({properties:t={}},e,n={})=>{if(!m(e))return u();for(let[r,i]of Object.entries(e)){let o=t[r];if(!p(o))continue;let s=o.validate(i,P(n,["properties",r],r));if(!s.valid)return s;N(n,r)}return u()},ft=({properties:t={},additionalProperties:e,patternProperties:n},r,i={})=>{if(!m(r))return u();if(!p(e))throw new v("additionalProperties must be a boolean or a managed schema");let o=Object.keys(t),s=m(n)?Object.keys(r).filter(a=>Object.keys(n).some(d=>xe(d).test(a))):[],c=Object.keys(r).filter(a=>!o.includes(a)&&!s.includes(a));if(c.length>0){if(K(e)){if(e.toJSON()===!0){for(let d of c)N(i,d);return u()}let a=c.reduce((d,f)=>(d[f]=r[f],d),{});return l(i,"additionalProperties","Additional properties are not allowed",a)}else if(p(e))for(let a of c){let d=e.validate(r[a],P(i,["additionalProperties"],a));if(!d.valid)return d;N(i,a)}}return u()},lt=({dependencies:t},e,n={})=>{if(!m(e)||!m(t))return u();let r=Object.keys(e).filter(i=>typeof e[i]!="function");for(let[i,o]of Object.entries(t))if(r.includes(i)){if(Array.isArray(o)){for(let s of o)if(!r.includes(s))return l(n,"dependencies",`Expected dependent required property ${s}`,e)}else if(p(o)){let s=o.validate(e,n);if(!s.valid)return s}}return u()},pt=({dependentRequired:t},e,n={})=>{if(!m(e))return u();let r=Object.keys(e).filter(i=>typeof e[i]!="function");if(m(t)){for(let[i,o]of Object.entries(t))if(r.includes(i)){for(let s of o)if(!r.includes(s))return l(n,"dependentRequired",`Expected dependent required property ${s}`,e)}}return u()},mt=({required:t=[]},e,n={})=>{if(!m(e))return u();let r=Object.keys(e).filter(i=>typeof e[i]!="function");return t.every(i=>r.includes(i))?u():l(n,"required",`Expected object with required properties ${t.join(", ")}`,e)},ht=({dependentSchemas:t},e,n={})=>{if(!m(e))return u();let r=Object.keys(e).filter(i=>typeof e[i]!="function");if(m(t)){for(let[i,o]of Object.entries(t))if(r.includes(i)){let s=o.validate(e,n);if(!s.valid)return s}}return u()},yt=({minProperties:t=0},e,n={})=>m(e)?Object.keys(e).length>=t?u():l(n,"minProperties",`Expected object with at least ${t} properties`,e):u(),Ot=({maxProperties:t=0},e,n={})=>!m(e)||Object.keys(e).length<=t?u():l(n,"maxProperties",`Expected object with at most ${t} properties`,e),St=({patternProperties:t={}},e,n={})=>{if(!m(e))return u();if(!m(t))throw new v("patternProperties must be an object");for(let[r,i]of Object.entries(e))for(let[o,s]of Object.entries(t))if(xe(o).test(r)){let c=s.validate(i,P(n,["patternProperties"],r));if(!c.valid)return c;N(n,r)}return u()},gt=({unevaluatedProperties:t},e,n={})=>{if(!m(e)||t===void 0)return u();if(!p(t))throw new v("unevaluatedProperties must be a boolean or managed schema");let r=Tt(n),i=Object.keys(e).filter(o=>!r.has(o));if(i.length===0)return u();if(K(t)){if(t.toJSON()===!0){for(let s of i)N(n,s);return u()}let o=i.reduce((s,c)=>(s[c]=e[c],s),{});return l(n,"unevaluatedProperties","Unevaluated properties are not allowed",o)}for(let o of i){let s=t.validate(e[o],P(n,["unevaluatedProperties"],o));if(!s.valid)return s;N(n,o)}return u()},xt=({propertyNames:t},e,n={})=>{if(!m(e)||t===void 0)return u();if(!p(t))throw new v("propertyNames must be a managed schema");for(let r of Object.keys(e)){let i=t.validate(r,P(n,["propertyNames"],r));if(!i.valid)return i}return u()},bt=({items:t,prefixItems:e=[]},n,r={})=>{if(!I(n)||t===void 0)return u();if(!p(t))throw new v("items must be a managed schema");for(let[i,o]of n.slice(e.length).entries()){let s=e.length+i,c=t.validate(o,P(r,["items"],String(s)));if(!c.valid)return c;J(r,s)}return u()},wt=({minItems:t=0},e,n={})=>!I(e)||e.length>=t?u():l(n,"minItems",`Expected array with at least ${t} items`,e),vt=({maxItems:t=0},e,n={})=>!I(e)||e.length<=t?u():l(n,"maxItems",`Expected array with at most ${t} items`,e),kt=({uniqueItems:t=!1},e,n={})=>{if(!I(e)||!t)return u();for(let r=0;r<e.length;r++){let i=e[r];for(let o=0;o<e.length;o++){if(r===o)continue;let s=e[o];if(D(i,s))return l(n,"uniqueItems",`Duplicated items at index ${r} and ${o}`,e)}}return u()},Pt=({contains:t,minContains:e,maxContains:n},r,i={})=>{if(!p(t))throw new Error("contains must be a managed schema");if(!I(r))return u();let o=[];for(let[c,a]of r.entries())t.validate(a,P({...i,errors:[],evaluated:k(i.evaluated)},["contains"],String(c))).valid&&o.push(c);let s=o.length;if(s<(e??1))return l(i,e?"minContains":"contains",`Expected array to contain at least ${e??1}, but found ${s}`,r);if(n!==void 0&&s>n)return l(i,"maxContains",`Expected array to contain at most ${n}, but found ${s}`,r);for(let c of o)J(i,c);return u()},It=({prefixItems:t=[]},e,n={})=>{if(!I(e))return u();for(let r=0;r<e.length;r++){let i=t[r]?.validate(e[r],P(n,String(r),String(r)));if(i&&i?.valid!==!0)return i;i?.valid===!0&&J(n,r)}return u()},Rt=({unevaluatedItems:t},e,n={})=>{if(!I(e)||t===void 0)return u();if(!p(t))throw new v("unevaluatedItems must be a boolean or managed schema");let r=$t(n),i=e.map((o,s)=>s).filter(o=>!r.has(o));if(i.length===0)return u();if(K(t)){if(t.toJSON()===!0){for(let o of i)J(n,o);return u()}return l(n,"unevaluatedItems","Unevaluated items are not allowed",i.map(o=>e[o]))}for(let o of i){let s=t.validate(e[o],P(n,["unevaluatedItems"],String(o)));if(!s.valid)return s;J(n,o)}return u()};var we=!0,Wt=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,be=/[.\u3002\uff0e\uff61]/u;function ve(t){return t.length===0||t.length>253||t.startsWith(".")||t.endsWith(".")?!1:t.split(".").every(e=>!(!Wt.test(e)||qt.has(e.toLowerCase())))}function Ct(t){if(t.length===0||t.length>253||be.test(t[0]||"")||be.test(t[t.length-1]||""))return!1;let e;try{e=new URL(`http://${t}`).hostname}catch{return!1}return ve(e)?t.split(be).every(n=>!(n.length===0||!zt(n)||/[\u0660-\u0669]/u.test(n)&&/[\u06f0-\u06f9]/u.test(n))):!1}var qt=new Set(["xn--x","xn--hello-txk","xn--hello-zed","xn--hello-6bf","xn--07jt112bpxg","xn--aa---o47jg78q","xn--chb89f","xn--07jceefgh4c","xn--al-0ea","xn--l-fda","xn--la-0ea","xn--l-gda","xn--s-jib3p","xn--wva3j","xn--5db1e","xn--a-2hc5h","xn--5db3e","xn--a-2hc8h","xn--defabc-k64e","xn--vek","xn--ngb6iyr","xn--11b2er09f","xn--02b508i"]);function zt(t){if(t.toLowerCase().startsWith("xn--"))return!0;if(/[\u0640\u07fa\u302e\u302f\u3031-\u3035\u303b]/u.test(t)||t.length>3&&t[2]==="-"&&t[3]==="-")return!1;for(let e=0;e<t.length;e++){let n=t[e];if(n==="\xB7"&&(t[e-1]?.toLowerCase()!=="l"||t[e+1]?.toLowerCase()!=="l")||n==="\u0375"&&!/[\u0370-\u03ff]/u.test(t[e+1]||"")||(n==="\u05F3"||n==="\u05F4")&&!/[\u0590-\u05ff]/u.test(t[e-1]||"")||n==="\u30FB"&&!/[\u3040-\u30ff\u3400-\u9fff]/u.test(t)||n==="\u200D"&&t[e-1]!=="\u094D")return!1}return!0}function jt(t,e=!1){if(t.length>318)return!1;let n=t.lastIndexOf("@");if((n<=0||n!==t.indexOf("@"))&&!(t.startsWith('"')&&n>0))return!1;let r=t.slice(0,n),i=t.slice(n+1);if(!r||!i||r.length>64||!Bt(r,e))return!1;if(i.startsWith("[")&&i.endsWith("]")){let o=i.slice(1,-1);return o.startsWith("IPv6:")?q.ipv6(o.slice(5)):q.ipv4(o)}return e?Ct(i):ve(i)}function Bt(t,e){return t.startsWith('"')?/^"(?:[\x20-\x21\x23-\x5b\x5d-\x7e]|\\[\x00-\x7f])*"$/.test(t):t.startsWith(".")||t.endsWith(".")||t.includes("..")?!1:(e?/^[^\s"(),:;<>@[\\\]]+$/u:/^[a-z0-9!#$%&'*+/=?^_`{|}~.-]+$/i).test(t)}function Ht(t){return!/%(?![0-9a-f]{2})/i.test(t)}function ue(t,e,n){if(!Ht(t)||/[\\\s"<>^`{|}]/u.test(t)||!n&&/[^\x00-\x7f]/u.test(t))return!1;let r=t.match(/^([a-z][a-z0-9+\-.]*):/i)?.[1];if(e&&!r)return!1;let i=t.match(/^[a-z][a-z0-9+\-.]*:\/\/([^/?#]*)/i)?.[1];if(i?.startsWith("[@"))return!1;let o=i?.includes("@")?i.slice(i.lastIndexOf("@")+1):i;if(o&&!o.startsWith("[")){if((o.match(/:/g)||[]).length>1)return!1;let s=o.lastIndexOf(":");if(s>=0&&!/^\d*$/.test(o.slice(s+1)))return!1}return e||!/^[a-z][a-z0-9+\-.]*:/.test(t)||!!r}function Yt(t){if(/^P(?=.*[YMD])(?:\d+Y)?(?:\d+M)?(?:\d+D)?T$/.test(t)||/^P\d+Y\d+D$/.test(t)||/^PT\d+H\d+S$/.test(t))return!1;let e=/^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/.exec(t);if(/^P\d+W$/.test(t))return!0;if(!e)return!1;let[,n,r,i,o,s,c]=e;return!(!n&&!r&&!i&&!o&&!s&&!c)}var q={email:t=>jt(t,!1),hostname:ve,date:t=>{if(t.length!==10)return!1;if(t[5]==="0"&&t[6]==="2"){if(/^\d\d\d\d-02-(?:[012][1-8]|[12]0|[01]9)$/.test(t))return!0;let e=t.match(/^(\d\d\d\d)-02-29$/);if(!e)return!1;let n=Number(e[1]);return n%16===0||n%4===0&&n%25!==0}return t.endsWith("31")?/^\d\d\d\d-(?:0[13578]|1[02])-31$/.test(t):/^\d\d\d\d-(?:0[13-9]|1[012])-(?:[012][1-9]|[123]0)$/.test(t)},time:t=>{if(t.length>27||!/^(?:2[0-3]|[0-1]\d):[0-5]\d:(?:[0-5]\d|60)(?:\.\d+)?(?:z|[+-](?:2[0-3]|[0-1]\d)(?::?[0-5]\d)?)$/i.test(t))return!1;if(!/:60/.test(t))return!0;let n=t.match(/([0-9.]+|[^0-9.])/g);if(!n)return!1;let r=Number(n[0])*60+Number(n[2]);return n[5]==="+"?r+=24*60-Number(n[6]||0)*60-Number(n[8]||0):n[5]==="-"&&(r+=Number(n[6]||0)*60+Number(n[8]||0)),r%(24*60)===23*60+59},"date-time":t=>{if(t.length>38)return!1;let e=/^\d\d\d\d-(?:0[1-9]|1[0-2])-(?:[0-2]\d|3[01])[t\s](?:2[0-3]|[0-1]\d):[0-5]\d:(?:[0-5]\d|60)(?:\.\d+)?(?:z|[+-](?:2[0-3]|[0-1]\d)(?::?[0-5]\d)?)$/i,n=t[5]==="0"&&t[6]==="2";if(n&&t[8]==="3"||!e.test(t))return!1;if(t[17]==="6"){let r=t.slice(11).match(/([0-9.]+|[^0-9.])/g);if(!r)return!1;let i=Number(r[0])*60+Number(r[2]);if(r[5]==="+"?i+=24*60-Number(r[6]||0)*60-Number(r[8]||0):r[5]==="-"&&(i+=Number(r[6]||0)*60+Number(r[8]||0)),i%(24*60)!==23*60+59)return!1}if(n){if(/^\d\d\d\d-02-(?:[012][1-8]|[12]0|[01]9)/.test(t))return!0;let r=t.match(/^(\d\d\d\d)-02-29/);if(!r)return!1;let i=Number(r[1]??0);return i%16===0||i%4===0&&i%25!==0}return t[8]==="3"&&t[9]==="1"?/^\d\d\d\d-(?:0[13578]|1[02])-31/.test(t):/^\d\d\d\d-(?:0[13-9]|1[012])-(?:[012][1-9]|[123]0)/.test(t)},ipv4:t=>t.length<=15&&/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/.test(t),ipv6:t=>{if(t.length>45||t.length<2)return!1;let e=0,n=0,r=0,i=!1,o=!1,s=0,c=!0;for(let d=0;d<t.length;d++){let f=t.charCodeAt(d);if(d===1&&s===58&&f!==58)return!1;if(f>=48&&f<=57){if(++r>4)return!1}else if(f===46){if(e>6||n>=3||r===0||o)return!1;n++,r=0}else if(f===58){if(n>0||e>=7)return!1;if(s===58){if(i)return!1;i=!0}else d===0&&(c=!1);e++,r=0,o=!1}else if(f>=97&&f<=102||f>=65&&f<=70){if(n>0||++r>4)return!1;o=!0}else return!1;s=f}if(e<2||n>0&&(n!==3||r===0))return!1;if(i&&t.length===2)return!0;if(n>0&&!/(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/.test(t))return!1;let a=n>0?6:7;return i?(c||r>0)&&e<a:e===a&&c&&r>0},uri:t=>ue(t,!0,!1)&&/^[a-z][a-z0-9+\-.]*:/i.test(t),"uri-reference":t=>ue(t,!1,!1),"uri-template":t=>/^(?:[^\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.test(t),"json-pointer":t=>/^(?:|\/(?:[^~]|~0|~1)*)$/.test(t),"relative-json-pointer":t=>/^(?:0|[1-9][0-9]*)(?:|#|\/(?:[^~]|~0|~1)*)$/.test(t),uuid:t=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t),duration:Yt,regex:t=>{if(/[^\\]\\Z/.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}},iri:t=>ue(t,!0,!0),"iri-reference":t=>ue(t,!1,!0),"idn-email":t=>jt(t,!0),"idn-hostname":Ct,binary:()=>!0,password:()=>!0},Et=({format:t},e,n={})=>!y(e)||!t?u():(n.assertFormat??we)===!1?u():q[t]?q[t](e)?u():l(n,"format",`Expected format: ${t}`,e):u();function Zt(t,e){q[t]=e}function _t(){return Object.keys(q)}function Gt(t){we=t}function Qt(){return we}var de={type:He,const:Ye,enum:Ze,allOf:Xe,anyOf:Ge,oneOf:Qe,not:et,minLength:rt,maxLength:it,pattern:nt,format:Et,minimum:ct,exclusiveMinimum:ut,maximum:st,exclusiveMaximum:at,multipleOf:ot,required:mt,dependentRequired:pt,dependentSchemas:ht,dependencies:lt,minProperties:yt,maxProperties:Ot,propertyNames:xt,properties:dt,patternProperties:St,additionalProperties:ft,unevaluatedProperties:gt,minItems:wt,maxItems:vt,uniqueItems:kt,contains:Pt,prefixItems:It,items:bt,unevaluatedItems:Rt,if:tt};function Vt(t,e,n={}){let r=n.resolver||t.getResolver?.()||new T(t),i={keywordPath:n.keywordPath||[],instancePath:n.instancePath||[],coerce:n.coerce||!1,errors:n.errors||[],shortCircuit:n.shortCircuit||!1,ignoreUnsupported:n.ignoreUnsupported||!1,resolver:r,depth:n.depth?n.depth+1:0,skipClone:n.skipClone||!1,evaluatingRefs:n.evaluatingRefs||new Set,dynamicScopes:ke(t,r,n.dynamicScopes),evaluated:n.evaluated||j(),localEvaluatedBase:n.localEvaluatedBase||j(),assertFormat:n.assertFormat??!0,disableValidationVocab:n.disableValidationVocab??r.disablesValidationVocabulary(t)},o=k(i.evaluated),s;if(n?.coerce&&t.coerce){let a=t.coerce(e,{resolver:i.resolver,depth:i.depth});s=i.skipClone?a:structuredClone(a)}else s=i.skipClone?e:structuredClone(e);if(n.ignoreUnsupported!==!0){let a=[];for(let d of a)if(t[d])throw new Error(`${d} not implemented`)}if(i.resolver.hasRef(t,s)){let a=i.resolver.resolve(t.$ref,t),d=At(a,s,i);d&&!d.valid&&i.errors.push(...d.errors)}if(i.resolver.hasDynamicRef(t,s)){let a=i.resolver.resolveDynamicRef(t.$dynamicRef,t,i.dynamicScopes),d=At(a,s,i);d&&!d.valid&&i.errors.push(...d.errors)}let c={keywordPath:i.keywordPath,instancePath:i.instancePath,coerce:i.coerce,errors:[],shortCircuit:i.shortCircuit,ignoreUnsupported:i.ignoreUnsupported,resolver:i.resolver,depth:i.depth,evaluatingRefs:i.evaluatingRefs,dynamicScopes:i.dynamicScopes,evaluated:i.evaluated,localEvaluatedBase:o,assertFormat:i.assertFormat,disableValidationVocab:i.disableValidationVocab};for(let a in t)if(!(a==="unevaluatedItems"||a==="unevaluatedProperties")&&!Nt(a,t,i)){if(a==="type"&&t.type!==void 0){if(s!==void 0){let d=de[a];if(d){c.errors=[];let f=d(t,s,c);if(!f.valid){if(n.shortCircuit)return f;i.errors.push(...f.errors)}}}}else if(a in de&&t[a]!==void 0){if(s===void 0)continue;let d=de[a];if(d){c.errors=[];let f=d(t,s,c);if(!f.valid){if(n.shortCircuit)return f;i.errors.push(...f.errors)}}}}for(let a of["unevaluatedItems","unevaluatedProperties"]){if(!(a in t)||t[a]===void 0||Nt(a,t,i))continue;let d=de[a];if(!d||s===void 0)continue;c.errors=[];let f=d(t,s,c);if(!f.valid){if(n.shortCircuit)return f;i.errors.push(...f.errors)}}return{valid:i.errors.length===0,errors:i.errors}}function At(t,e,n){let r=T.ownerOf(t)||n.resolver,i=`${r.keyFor(t)}@${n.instancePath.join("/")}`;if(n.evaluatingRefs.has(i))return;n.evaluatingRefs.add(i);let o=t.validate(e,{...n,resolver:r,errors:[]});return n.evaluatingRefs.delete(i),o}function ke(t,e,n=[]){let r=e.resourceFor(t),i=n[n.length-1];return i?.resolver===e&&i.resource===r?n:[...n,{resolver:e,resource:r}]}function Nt(t,e,n){return t==="prefixItems"&&n.resolver.draftFor(e)==="2019-09"?!0:n.disableValidationVocab&&Xt.has(t)}var Xt=new Set(["type","const","enum","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","format","maxItems","minItems","uniqueItems","maxContains","minContains","maxProperties","minProperties","required","dependentRequired"]);function j(){return{properties:new Map,items:new Map}}function k(t=j()){return{properties:new Map([...t.properties.entries()].map(([e,n])=>[e,new Set(n)])),items:new Map([...t.items.entries()].map(([e,n])=>[e,new Set(n)]))}}function W(t,e){for(let[n,r]of e.properties.entries()){let i=t.properties.get(n)||new Set;for(let o of r)i.add(o);t.properties.set(n,i)}for(let[n,r]of e.items.entries()){let i=t.items.get(n)||new Set;for(let o of r)i.add(o);t.items.set(n,i)}}function N(t,e){let n=t.evaluated||j();t.evaluated=n;let r=fe(t),i=n.properties.get(r)||new Set;i.add(e),n.properties.set(r,i)}function J(t,e){let n=t.evaluated||j();t.evaluated=n;let r=fe(t),i=n.items.get(r)||new Set;i.add(e),n.items.set(r,i)}function Tt(t){return t.evaluated?.properties.get(fe(t))||new Set}function $t(t){return t.evaluated?.items.get(fe(t))||new Set}function fe(t){return A(t.instancePath||[])}var g=class{"~standard";[S];_resolver;_resolverOptions;type;$id;$ref;$schema;$anchor;$dynamicAnchor;$dynamicRef;$vocabulary;title;description;readOnly;writeOnly;$comment;examples;constructor(e,n){let{type:r,validate:i,coerce:o,template:s,...c}=e||{};Object.assign(this,{type:r},c),this[S]={raw:e,optional:!1,overrides:n},this["~standard"]={version:1,vendor:"jsonv-ts",validate:a=>{let d=this.validate(a);return d.valid?{value:a}:{issues:d.errors.map(f=>({message:f.error,path:F(f.instanceLocation)}))}}}}template(e,n){let r=this,i=e;if(r.const!==void 0?i=r.const:i===void 0&&(r.default!==void 0&&(i=r.default),n?.withExtendedOptional&&r.enum!==void 0&&(i=r.enum[0])),n?.withOptional!==!0&&i===void 0&&this.isOptional())return i;if(this[S].raw?.template){let s=this[S].raw.template(i,n);s!==void 0&&(i=s)}let o=this[S].overrides?.template?.(i,n);return o!==void 0&&(i=o),i}validate(e,n){let r={keywordPath:n?.keywordPath||[],instancePath:n?.instancePath||[],coerce:n?.coerce||!1,errors:n?.errors||[],shortCircuit:n?.shortCircuit||!1,ignoreUnsupported:n?.ignoreUnsupported||!1,resolver:n?.resolver||this.getResolver(),depth:n?.depth?n.depth+1:0,skipClone:n?.skipClone??!0,evaluatingRefs:n?.evaluatingRefs||new Set,dynamicScopes:ke(this,n?.resolver||this.getResolver(),n?.dynamicScopes),evaluated:n?.evaluated||j(),localEvaluatedBase:n?.localEvaluatedBase||j(),assertFormat:n?.assertFormat??!0,disableValidationVocab:n?.disableValidationVocab??(n?.resolver||this.getResolver()).disablesValidationVocabulary(this)},i=this[S].raw?.validate;if(i!==void 0){let o=i(e,r);if(!o.valid)return o}return Vt(this,e,r)}coerce(e,n){let r={...n,resolver:n?.resolver||this.getResolver(),depth:n?.depth?n.depth+1:0,dropUnknown:n?.dropUnknown??!1},i=this[S].raw?.coerce;if(i!==void 0)return i(e,r);let o=this[S].overrides?.coerce?.(e,r)??e;return ze(this,o,r)}optional(){return this[S].optional=!0,this}isOptional(){return this[S].optional}getResolver(){return this._resolver||(this._resolver=new T(this,this._resolverOptions)),this._resolver}children(e){return[]}*walk({instancePath:e=[],keywordPath:n=[],data:r,maxDepth:i=Number.POSITIVE_INFINITY,...o}={}){let s=e.length===0&&r?ce(r):r;if(o.includeSelf!==!1&&(yield new R(this,{instancePath:e,keywordPath:n,data:s,...o})),!(e.length>=i))for(let c of this.children(o)){let a=[...e,...c.instancePath];yield*c.schema.walk({...o,data:s,maxDepth:i,instancePath:a,keywordPath:[...n,...c.keywordPath]})}}*[Symbol.iterator](e){for(let n of this.walk(e))yield n}toJSON(){let{toJSON:e,"~standard":n,_resolver:r,_resolverOptions:i,...o}=this;return JSON.parse(JSON.stringify(o))}},R=class{constructor(e,n={}){this.schema=e;this.instancePath=n.instancePath||[],this.keywordPath=n.keywordPath||[],this.depth=this.instancePath.length;try{if(n.data!==void 0){let r=M(n.data,this.instancePath);e.validate(r).valid&&(this.data=r)}}catch{}}instancePath;keywordPath;data;depth;appendInstancePath(e){return this.instancePath=[...this.instancePath,...e],this}appendKeywordPath(e){return this.keywordPath=[...this.keywordPath,...e],this}setData(e){return this.data=e,this}};function C(t,e,n){return new class extends g{type=t}(e,n)}var Pe=class extends g{constructor(n){super();this.bool=n}toJSON(){return this.bool}validate(n,r){return this.bool?u():l(r,"","Always fails",n)}};function z(t){return new Pe(t)}var Z=t=>C(t?.type,t),Ie=(t,e)=>C(void 0,{...e,const:t});var B=class extends g{type="object";properties;required;constructor(e,n){let r=Array.isArray(n?.required)?[...n.required]:[];for(let[o,s]of Object.entries(e||{}))Se(p(s),"properties must be managed schemas",s),!s[S].optional&&!r.includes(o)&&r.push(o);let i=n?.additionalProperties===!1?z(!1):n?.additionalProperties;r=r.length>0?r:void 0,super({...n,additionalProperties:i,properties:e,required:r},{template:(o,s)=>{let c=structuredClone(m(o)?o:{}),a={...c};if(this.properties)for(let[d,f]of Object.entries(this.properties)){let h=M(c,d);if(f.isOptional()&&s?.withOptional!==!0&&h===void 0&&o===void 0)continue;let x=f.template(h,s);x!==void 0&&(a[d]=x)}if(!(Object.keys(a).length===0&&!s?.withExtendedOptional))return a},coerce:(o,s)=>{let c=Object.keys(this.properties),a=ce(o),d=c.length>0&&Object.values(this.properties).every(h=>!h[S].optional);if(Ke(a)&&(s?.dropUnknown===!0||d)&&(a=qe(a,c)),typeof a=="string"&&a.match(/^\{/)&&(a=JSON.parse(a)),typeof a!="object"||a===null)return;if(this.properties)for(let[h,x]of Object.entries(this.properties)){let O=a[h];O!==void 0&&(a[h]=x.coerce(O,s))}let f=this.additionalProperties;if(s?.dropUnknown!==!0&&(!f||f.validate(null).valid)){let h=m(o)?o:{},x=Object.keys(h).filter(O=>!c.includes(O));for(let O of x)a[O]=f?f.coerce(h[O],s):h[O]}return a}}),this.properties=e,this.required=r}strict(){return this.additionalProperties=z(!1),this[S].raw.additionalProperties=!1,this}partial(){for(let[,e]of Object.entries(this.properties))e[S].optional=!0;return this.required=void 0,this}children(e){let n=[];for(let[r,i]of Object.entries(this.properties)){let o=new R(i,e);o.appendInstancePath([r]),o.appendKeywordPath(["properties",r]),n.push(o)}return n}},V=(t,e)=>new B(t,e),Re=(t,e)=>V(t,e).strict(),Te=(t,e)=>V(t,e).partial();var H=class extends g{type="object";additionalProperties;constructor(e,n){super({...n,additionalProperties:e},{template:(r,i)=>i?.withExtendedOptional&&(r===void 0||!m(r))?{}:r}),this.additionalProperties=e}children(e){let n=[],r=new R(this.additionalProperties,e);return r.appendKeywordPath(["additionalProperties"]),n.push(r),n}},$e=(t,e)=>new H(t,e);var le=class extends g{type="string";constructor(e){super(e,{template:(n,r)=>r?.withExtendedOptional&&(n===void 0||!y(n))?"":n,coerce:n=>w(n)?String(n):n})}toJSON(){let{pattern:e,"~standard":n,_resolver:r,_resolverOptions:i,...o}=this;return JSON.parse(JSON.stringify({...o,pattern:e instanceof RegExp?e.source:e}))}},_=t=>new le(t);var Ut=(t,e,n)=>C(t,n,{template:(r,i)=>i?.withExtendedOptional&&(r===void 0||!w(r))?n?.minimum??0:r,coerce:r=>{if(y(r)){let i=e.parseFn(r);if(!Number.isNaN(i))return i}return r}}),G=t=>Ut("number",{parseFn:Number},t),Q=t=>Ut("integer",{parseFn:Number.parseInt},t);var Y=class extends g{constructor(n,r={}){super({...r,items:n},{template:i=>i===void 0||!Array.isArray(i)?[]:i,coerce:(i,o)=>{try{let s=typeof i=="string"?JSON.parse(i):i;if(!Array.isArray(s))return;if(p(this.items))for(let[c,a]of s.entries())s[c]=this.items.coerce(a,o);return s}catch{}return i}});this.items=n;this.items=n}type="array";children(n){let r=[];if(this.items){let i=new R(this.items,n);i.appendKeywordPath(["items"]),r.push(i)}return r}},X=(t,e)=>new Y(t,e);var ee=t=>C("boolean",t,{template:(e,n)=>n?.withExtendedOptional&&(e===void 0||!L(e))?!1:e,coerce:e=>{if(y(e)&&["true","false","1","0"].includes(e))return e==="true"||e==="1";if(w(e)){if(e===1)return!0;if(e===0)return!1}return e}});var pe=Symbol.for("unionType"),me=class extends g{[pe];constructor(e,n,r){super({...r,[n]:e},{coerce:(i,o)=>{let s=r?.coerce;if(s!==void 0)return s.bind(this)(i,o);let c=_e(e,i,{ignoreUnsupported:!0,resolver:o?.resolver,coerce:!0});return c.length>0?c[0].coerce(i,o):i}}),this[pe]=n}get schemas(){return this[this[pe]]}children(e){let n=[];for(let[r,i]of this.schemas.entries()){let o=new R(i,e);o.appendKeywordPath([this[pe],r]),n.push(o)}return n}},je=(t,e)=>new me(t,"anyOf",e),Ce=(t,e)=>new me(t,"oneOf",e);function Ft(t,e){return Array.isArray(t)?t.map(e):t!==void 0?[e(t)]:[]}function Ee(t,e,n=r=>r){return Object.fromEntries(Object.entries(t).map(([r,i])=>[r,n(e(i,r),r)]))}var en=new Set(["$id","$ref","$schema","$anchor","$dynamicAnchor","$dynamicRef","type","properties","patternProperties","additionalProperties","unevaluatedProperties","items","prefixItems","unevaluatedItems","contains","allOf","anyOf","oneOf","not","if","then","else","required","dependentRequired","dependentSchemas","dependencies","$defs"]);function Mt(t){return m(t)&&Object.keys(t).some(e=>en.has(e))}function U(t,e){return Object.defineProperty(t,"_resolverOptions",{value:{rawRoot:e,compileRaw:n=>b(n)},configurable:!0,writable:!0}),t}function b(t){if(L(t))return z(t);let e=structuredClone(t),n=structuredClone(e);if(!m(n))throw new se("non-object schemas cannot be converted to a schema",n);"properties"in n&&n.properties&&(n.properties=Ee(n.properties,(s,c)=>{try{return b(s)}catch(a){throw new Error(`Couldn't schemaize property "${c}": ${String(a)}`)}},(s,c)=>"required"in n&&Array.isArray(n.required)&&n.required.includes(c)?s:s.optional()));let r=["patternProperties","dependentSchemas","$defs"];for(let s of r)s in n&&n[s]&&(n[s]=Ee(n[s],b));"dependencies"in n&&n.dependencies&&(n.dependencies=Ee(n.dependencies,s=>Array.isArray(s)?s:b(s)));let i=["additionalProperties","unevaluatedProperties","items","prefixItems","unevaluatedItems","propertyNames","contains","not","if","then","else"];for(let s of i)s in n&&typeof n[s]<"u"&&(I(n[s])?n[s]=Ft(n[s],b):n[s]=b(n[s]));let o=["anyOf","oneOf","allOf"];for(let s of o)if(s in n){let{[s]:c}=n;n[s]=Ft(c,b)}for(let[s,c]of Object.entries(n))s==="const"||s==="enum"||s==="default"||i.includes(s)||r.includes(s)||s==="properties"||s==="dependencies"||s==="anyOf"||s==="oneOf"||s==="allOf"||(Mt(c)?n[s]=b(c):Array.isArray(c)&&(n[s]=c.map(a=>Mt(a)?b(a):a)));if(We(n))switch(n.type){case"string":return U(_(n),e);case"number":return U(G(n),e);case"integer":return U(Q(n),e);case"boolean":return U(ee(n),e);case"object":{let{properties:s,...c}=n;return U(V(s,c),e)}case"array":{let{items:s,...c}=n;return U(X(s,c),e)}}return U(Z(n),e)}var Ne=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),Ae=t=>typeof globalThis.structuredClone=="function"?globalThis.structuredClone(t):JSON.parse(JSON.stringify(t)),nn=["maximum","exclusiveMaximum","maxLength","maxItems","maxProperties"],rn=["minimum","exclusiveMinimum","minLength","minItems","minProperties"];function on(){return{type(e){let r=e.map(i=>Array.isArray(i)?new Set(i):new Set([i])).reduce((i,o)=>i?new Set([...i].filter(s=>o.has(s))):new Set(o));if(!r.size)throw new Error('Incompatible "type" in allOf');return r.size===1?[...r][0]:[...r]},enum(e){let n=e.map(r=>new Set(r)).reduce((r,i)=>new Set([...r].filter(o=>i.has(o))));if(!n.size)throw new Error('Incompatible "enum" in allOf');return[...n]},required(e){return[...new Set(e.flat())]},properties(e,n,r){return e.reduce((i,o)=>r(i,o),{})},patternProperties(e,n,r){return e.reduce((i,o)=>r(i,o),{})},$defs(e,n,r){return e.reduce((i,o)=>r(i,o),{})},definitions(e,n,r){return e.reduce((i,o)=>r(i,o),{})},...Object.fromEntries(nn.map(e=>[e,n=>Math.min(...n)])),...Object.fromEntries(rn.map(e=>[e,n=>Math.max(...n)]))}}function sn(t){let e={...on(),...t.resolvers};function n(r,i){if(Array.isArray(r)&&Array.isArray(i))return[...new Set([...r,...i])];if(Ne(r)&&Ne(i)){let o={...r};for(let[s,c]of Object.entries(i))if(s in o){let a=e[s];o[s]=a?a([o[s],c],s,n):Ae(c)}else o[s]=Ae(c);return o}return Ae(i)}return n}var an=t=>t===!0||t===!1?t:null;function Dt(t,e={}){let n=e.deep!==!1,r=sn(e);function i(o){if(Array.isArray(o))return o.map(i);if(!Ne(o))return o;if(Array.isArray(o.allOf)){let c=o.allOf.map(i);if(c.some(O=>O===!1))return!1;let a=c.filter(O=>O!==!0);if(!a.length)return!0;let d=a.reduce((O,ne)=>r(O,ne),{}),f=an(d);if(f!==null)return f;let h={...o};delete h.allOf;let x=r(d,n?i(h):h);return n?i(x):x}let s={};for(let[c,a]of Object.entries(o))s[c]=i(a);return s}return i(t)}var Ve=(t,e)=>{let n=JSON.parse(JSON.stringify({...e,allOf:t}));return b(Dt(n))};var te=class extends g{$ref;constructor(e,n){if(!n&&!p(e))throw new Error("Ref not set");if(p(e)&&!e.$id)throw new Error("Ref must have an $id");let r=n??e?.$id;super({$ref:r},{coerce:(i,o)=>{let s=o?.resolver?.resolve(this.$ref,this);if(!p(s))throw new Error(`Ref not found: ${this.$ref}`);return s.coerce(i,o)}}),this.$ref=r}},Ue=(t,e)=>new te(t,e),Fe=t=>new te(void 0,t),Me=t=>{let e=new g({$ref:"#",coerce:(n,r)=>{let i=r?.resolver?.resolve("#",e);if(!p(i))throw new Error("Ref not found: #");return i.coerce(n,r)}});return t(e)};var he=class extends Error{constructor(n,r,i=[]){super(`Invalid schema given for ${JSON.stringify(r,null,2)}

Error: ${JSON.stringify(i[0],null,2)}`);this.schema=n;this.value=r;this.errors=i}first(){return this.errors[0]}firstToString(){let n=this.first();return`${n.error} at ${n.instanceLocation}`}},cn=t=>{let e=t.toJSON();return b(e)};function un(t,e,n){let r=n?.clone?cn(t):t,i=n?.coerce!==!1?r.coerce(e,{dropUnknown:n?.coerceDropUnknown??!1}):e;n?.withDefaults!==!1&&(i=r.template(i,{withOptional:!0,withExtendedOptional:n?.withExtendedDefaults??!1}));let o=t.validate(i,{shortCircuit:!0,ignoreUnsupported:!0});if(!o.valid)if(n?.onError)n.onError(o.errors);else throw new he(r,e,o.errors);return i}function Lt(t){return typeof t=="string"?`"${t}"`:t===null?"null":String(t)}var Kt=t=>t.description?`/**
 * ${t.description}
 */
`:"";function dn(t){let e=t.replace(/^[^a-zA-Z_$]+/,"").replace(/ /g,"").replace(/[^a-zA-Z0-9_$]/g,"_");return(!e||/^[0-9]/.test(e))&&(e="_"+e),!e||e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}var fn=t=>t.title?dn(t.title):"Schema",ln=({type:t})=>["string","number","boolean","null","undefined"].includes(t??"");function pn(t,e,n={}){let r=new Map,i=n.generateName??fn,o=e??i(t),s=(a,d={})=>{if(!a.title||ln(a))return ye(a,{...d,generateChild:s});let f=JSON.stringify(a);if(r.has(f))return r.get(f).name;let h=i(a),x=De(a,h,{...n,...d,currentIndent:0,generateChild:s});return r.set(f,{name:h,type:x}),h},c=De(t,o,{...n,generateChild:s});return[...r.values().map(a=>a.type),c].join(`

`)}function De(t,e,n={}){let{type:r,export:i,...o}=n,s=e??t.title??"Schema",c=r==="interface"?`interface ${s} `:`type ${s} = `;return`${Kt(t)}${i?"export ":""}${c}${ye(t,o)}`}function ye(t,e={}){let n={indent:e.indent??"  ",currentIndent:e.currentIndent??0,fallback:e.fallback??"unknown",generateChild:e.generateChild??ye};if(!p(t))return n.fallback;let r=(o,s=0)=>o.split(`
`).map(c=>n.indent.repeat(s)+c).join(`
`),i=n.currentIndent;if(t instanceof B){let o=t.properties;return Object.keys(o).length===0?"{}":r(`{
`)+Object.entries(o).map(([s,c])=>{let a=c.isOptional()?"?":"";return r(`${Kt(c)}${s}${a}: ${n.generateChild(c,n)}`,i+1)}).join(`,
`)+`
`+r("}",i)}else{if(t instanceof H)return`Record<string, ${n.generateChild(t.additionalProperties,n)}>`;if(t instanceof Y)return n.generateChild(t.items)+"[]";if("anyOf"in t&&Array.isArray(t.anyOf))return t.anyOf.map(o=>n.generateChild(o)).join(" | ");if("oneOf"in t&&Array.isArray(t.oneOf))return t.oneOf.map(o=>n.generateChild(o)).join(" | ");if(K(t))return t.toJSON()?"any":"never"}return"const"in t&&typeof t.const<"u"?Lt(t.const):"enum"in t&&typeof t.enum<"u"?t.enum.map(o=>Lt(o)).join(" | ")??n.fallback:t.type??n.fallback}var Hr={boolean:ee,any:Z,literal:Ie,object:V,strictObject:Re,partialObject:Te,record:$e,string:_,number:G,integer:Q,array:X,anyOf:je,oneOf:Ce,allOf:Ve,ref:Ue,refId:Fe,recursive:Me};export{Y as ArraySchema,he as InvalidSchemaError,B as ObjectSchema,H as RecordSchema,te as RefType,g as Schema,le as StringSchema,Ve as allOf,Z as any,je as anyOf,X as array,ee as boolean,z as booleanSchema,l as error,b as fromSchema,Qt as getFormatAssertionDefault,_t as getFormats,Q as integer,Se as invariant,p as isSchema,Ie as literal,P as makeOpts,G as number,V as object,Ce as oneOf,un as parse,Te as partialObject,$e as record,Me as recursive,Ue as ref,Fe as refId,Zt as registerFormat,Hr as s,ye as schemaToTypes,Gt as setFormatAssertionDefault,Re as strictObject,_ as string,pn as toDefinition,De as toTypes,u as valid};
