@hyperjump/json-schema-core
Advanced tools
Comparing version 0.26.0 to 0.27.0
@@ -8,3 +8,3 @@ define(["exports"],(function(e){"use strict";var r=function(e,r){return function t(){null==r&&(r=e.length);var n=[].slice.call(arguments);return n.length>=r?e.apply(this,n):function(){return t.apply(this,n.concat([].slice.call(arguments)))}}};var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e,r){return e(r={exports:{}},r.exports),r.exports}var o=n((function(e,r){var n,o;n="object"==typeof window&&window||t,o={},n.PubSub?(o=n.PubSub,console.warn("PubSub already loaded, using existing version")):(n.PubSub=o,function(e){var r={},t=-1,n="*";function o(e){var r;for(r in e)if(Object.prototype.hasOwnProperty.call(e,r))return!0;return!1}function a(e){return function(){throw e}}function i(e,r,t){try{e(r,t)}catch(e){setTimeout(a(e),0)}}function s(e,r,t){e(r,t)}function c(e,t,n,o){var a,c=r[t],u=o?s:i;if(Object.prototype.hasOwnProperty.call(r,t))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&u(c[a],e,n)}function u(e,r,t){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,r,t);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,r,t);c(e,n,r,t)}}function l(e){var t=String(e);return Boolean(Object.prototype.hasOwnProperty.call(r,t)&&o(r[t]))}function p(e){for(var r=String(e),t=l(r)||l(n),o=r.lastIndexOf(".");!t&&-1!==o;)o=(r=r.substr(0,o)).lastIndexOf("."),t=l(r);return t}function f(e,r,t,n){var o=u(e="symbol"==typeof e?e.toString():e,r,n);return!!p(e)&&(!0===t?o():setTimeout(o,0),!0)}e.publish=function(r,t){return f(r,t,!1,e.immediateExceptions)},e.publishSync=function(r,t){return f(r,t,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(r,e)||(r[e]={});var o="uid_"+String(++t);return r[e][o]=n,o},e.subscribeAll=function(r){return e.subscribe(n,r)},e.subscribeOnce=function(r,t){var n=e.subscribe(r,(function(){e.unsubscribe(n),t.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){r={}},e.clearSubscriptions=function(e){var t;for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)&&delete r[t]},e.countSubscriptions=function(e){var t,n,o=0;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)){for(n in r[t])o++;break}return o},e.getSubscriptions=function(e){var t,n=[];for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)&&n.push(t);return n},e.unsubscribe=function(t){var n,o,a,i=function(e){var t;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e))return!0;return!1},s="string"==typeof t&&(Object.prototype.hasOwnProperty.call(r,t)||i(t)),c=!s&&"string"==typeof t,u="function"==typeof t,l=!1;if(!s){for(n in r)if(Object.prototype.hasOwnProperty.call(r,n)){if(o=r[n],c&&o[t]){delete o[t],l=t;break}if(u)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===t&&(delete o[a],l=!0)}return l}e.clearSubscriptions(t)}}(o)),void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o}));o.PubSub;var a,i=n((function(e,r){ | ||
* MIT Licensed | ||
*/function Y(e){var r=String(e);if(J.test(r))return r;if(r.length>0&&!Z.test(r))throw new TypeError("invalid parameter value");return'"'+r.replace(G,"\\$1")+'"'}function X(e){this.parameters=Object.create(null),this.type=e}var ee={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var r=e.parameters,t=e.type;if(!t||!W.test(t))throw new TypeError("invalid type");var n=t;if(r&&"object"==typeof r)for(var o,a=Object.keys(r).sort(),i=0;i<a.length;i++){if(o=a[i],!J.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Y(r[o])}return n},parse:Q};const re={};var te={addPlugin:(e,r)=>{re[e]=r},parse:e=>{const r=ee.parse(e.headers.get("content-type")).type;if(!(r in re))throw Error(`${e.url} is not a schema. Found a document with media type: ${r}`);return re[r].parse(e)},getContentType:e=>{for(const r in re)if(re[r].matcher(e))return r;return"application/octet-stream"}};const{jsonTypeOf:ne,resolveUrl:oe,urlFragment:ae,pathRelative:ie}=c,se="https://json-schema.org/draft/2019-09/vocab/core",ce="https://json-schema.org/draft/2020-12/vocab/core",ue={},le={},pe=(e,r)=>{const t=le[e];return ue[t]?.[r]},fe={},de={},he=(e,r="",t="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(r,""),o=oe(e.$schema||t,"");if(!o)throw Error("Couldn't determine schema dialect");if(delete e.$schema,!(o in le))if(!0===e?.$vocabulary?.[se]&&o===ve(e,n,se)[0])le[o]=se;else if(!0===e?.$vocabulary?.[ce]&&o===ve(e,n,ce)[0])le[o]=ce;else if(o===ve(e,n,o)[0])le[o]=o;else{if(!(o in fe))throw Error(`Couldn't determine JSON Schema version for dialect: '${o}'`);{const e=fe[o];!0===e.vocabulary[se]?le[o]=se:!0===e.vocabulary[ce]?le[o]=ce:le[o]=le[e.dialectId]}}const[a,i]=ve(e,n,le[o]);if(!a)throw Error("Couldn't determine an identifier for the schema");const s=pe(o,"baseToken");delete e[s],n&&(de[n]=a);const c=pe(o,"anchorToken");i&&s===c&&(e[c]=c!==s?encodeURI(i):`#${encodeURI(i)}`);const u={},l=pe(o,"recursiveAnchorToken");let p;!0===e[l]&&(u[""]=`${a}#`,e[c]="",delete e[l]);const f=pe(o,"vocabularyToken");ne(e[f],"object")?(p=e[f],delete e[f]):p={[le[o]]:!0};const d={"":""};return fe[a]={id:a,dialectId:o,schema:ye(e,a,o,w.nil,d,u),anchors:d,dynamicAnchors:u,vocabulary:p,validated:!1},a},ve=(e,r,t)=>{const n=ue[t]?.baseToken,o=oe(r,e[n]||"");return[oe(o,""),ae(o)]},ye=(e,r,t,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema,""):t,s=pe(i,"embeddedToken"),c=pe(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(r,e[s]);return e[pe(i,"baseToken")]=n,he(e,n,t),C.cons(e[s],e)}const u=pe(t,"anchorToken"),l=pe(t,"dynamicAnchorToken");"string"==typeof e[l]&&(a[e[l]]=`${r}#${encodeURI(n)}`,o[e[l]]=n,delete e[l]);const p=pe(t,"embeddedToken");if("string"==typeof e[u]){const r=u!==p?e[u]:e[u].slice(1);o[r]=n,delete e[u]}const f=pe(t,"jrefToken");if("string"==typeof e[f])return C.cons(e[f],e);for(const i in e)e[i]=ye(e[i],r,t,w.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ye(e,r,t,w.append(i,n),o,a))):e},me=e=>fe[de[e]]||fe[e],ge=Object.freeze({id:"",dialectId:void 0,vocabulary:{},pointer:w.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),be=async(e,r=ge)=>{const t=oe(Se(r),e),n=oe(t,""),o=ae(t);if(!(e=>e in fe||e in de)(n)){const e=await M(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);he(await te.parse(e),n)}const a=me(n),i="/"!==o[0]?Ee(a,o):o,s=Object.freeze({...a,pointer:i,value:w.get(i,a.schema)});return we(s)},we=e=>C.isReference(e.value)?be(C.href(e.value),e):e,Ee=(e,r)=>{if(!(r in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(r)}'`);return e.anchors[r]},Se=e=>`${e.id}#${encodeURI(e.pointer)}`,Ce=e=>C.isReference(e.value)?C.value(e.value):e.value,Oe=(e,r)=>{const t=me(r.id),n=Object.freeze({...r,pointer:w.append(e,r.pointer),value:Ce(r)[e],validated:t.validated});return we(n)},Ae=r(((e,r)=>V.pipeline([Ce,V.map((async(t,n)=>e(await Oe(n,r),n))),V.all],r))),Ie={parentId:"",parentDialect:"",includeEmbedded:!0},je=(e,r)=>{if(r.startsWith("file://")){const t=e.slice(7,e.lastIndexOf("/"));return""===e?"":ie(t,r.slice(7))}return r};var Te={setConfig:(e,r,t)=>{ue[e]||(ue[e]={}),ue[e][r]=t},getConfig:pe,add:he,get:be,markValidated:e=>{fe[e].validated=!0},uri:Se,value:Ce,getAnchorPointer:Ee,typeOf:(e,r)=>ne(Ce(e),r),has:(e,r)=>e in Ce(r),step:Oe,keys:e=>Object.keys(Ce(e)),entries:e=>V.pipeline([Ce,Object.keys,V.map((async r=>[r,await Oe(r,e)])),V.all],e),map:Ae,length:e=>Ce(e).length,toSchema:(e,r={})=>{const t={...Ie,...r},n=JSON.parse(JSON.stringify(e.schema,((r,n)=>{if(!C.isReference(n))return n;const o=C.value(n),a="string"==typeof o.$schema?oe(o.$schema,""):e.dialectId,i=pe(a,"embeddedToken");return!t.includeEmbedded&&i in o?void 0:C.value(n)}))),o=pe(e.dialectId,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,r])=>{const t=ae(r);w.assign(t,n,{[o]:e,...w.get(t,n)})}));const a=pe(e.dialectId,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,r])=>{w.assign(r,n,{[a]:e,...w.get(r,n)})}));const i=pe(e.dialectId,"baseToken"),s=je(t.parentId,e.id),c=t.parentDialect===e.dialectId?"":e.dialectId;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};Te.setConfig,Te.getConfig,Te.add,Te.get,Te.markValidated,Te.uri,Te.value,Te.getAnchorPointer,Te.typeOf,Te.has,Te.step,Te.keys,Te.entries,Te.map,Te.length,Te.toSchema;class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=xe;const{resolveUrl:$e}=c,De="FLAG",Re="BASIC",Ne="DETAILED",_e="VERBOSE";let Fe=Ne,ke=!0;te.addPlugin("application/schema+json",{parse:async e=>await e.json(),matcher:e=>e.endsWith(".schema.json")});const Ue=async e=>{const r={metaData:{}};return{ast:r,schemaUri:await Ze(e,r)}},qe=r((({ast:e,schemaUri:r},t,n=De)=>{if(![De,Re,Ne,_e].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Le(n,a));return Be(r,t,e,{}),o.unsubscribe(i),a[0]})),Le=(e,r)=>{const t=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a,errors:[]};t.push(i)}else if("result.start"===n)t.push(n);else if("result.end"===n){const n=t.pop();for(;"result.start"!==t[t.length-1];){const r=t.pop(),o=[r];e===Re&&(o.push(...r.errors),delete r.errors),(e===_e||e!==De&&!r.valid)&&n.errors.unshift(...o)}t[t.length-1]=n,r[0]=n}}},ze={},He=e=>ze[e],Ve=e=>e in ze,Me={},Ke={},Ze=async(e,r)=>{if(e=await Je(e),!Ve(`${e.dialectId}#validate`)){const r=await Te.get(e.dialectId);(Te.getConfig(r.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!r.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(r.vocabulary).forEach((([e,t])=>{if(e in Me)Object.entries(Me[e]).forEach((([e,t])=>{((e,r)=>{ze[e]={collectEvaluatedItems:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&new Set,collectEvaluatedProperties:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&[],...r}})(`${r.id}#${e}`,t)}));else if(t)throw Error(`Missing required vocabulary: ${e}`)}))}if(ke&&!e.validated){if(Te.markValidated(e.id),!(e.dialectId in Ke)){const r=await Te.get(e.dialectId),t=await Ue(r);Ke[r.id]=qe(t)}const r=_.cons(e.schema,e.id),t=Ke[e.dialectId](r,Fe);if(!t.valid)throw new Pe(t)}return e.id in r.metaData||(r.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),He(`${e.dialectId}#validate`).compile(e,r)},Je=async e=>Te.typeOf(e,"string")?Je(await Te.get(Te.value(e),e)):e,Be=(e,r,t,n)=>{const o=Ge(e,t),a=$e(e,"");return He(o).interpret(e,r,t,{...t.metaData[a].dynamicAnchors,...n})},Ge=(e,r)=>{if(!(e in r))throw Error(`No schema found at ${e}`);return r[e][0]};var We={validate:async(e,r,t)=>{const n=await Ue(e),o=(e,r)=>qe(n,_.cons(e),r);return void 0===r?o:o(r,t)},compile:Ue,interpret:qe,setMetaOutputFormat:e=>{Fe=e},setShouldMetaValidate:e=>{ke=e},FLAG:De,BASIC:Re,DETAILED:Ne,VERBOSE:_e,add:(e,r="",t="")=>{const n=Te.add(e,r,t);delete Ke[n]},getKeyword:He,hasKeyword:Ve,defineVocabulary:(e,r)=>{Me[e]=r},compileSchema:Ze,interpretSchema:Be,collectEvaluatedProperties:(e,r,t,n,o)=>{const a=Ge(e,t);return He(a).collectEvaluatedProperties(e,r,t,n,o)},collectEvaluatedItems:(e,r,t,n,o)=>{const a=Ge(e,t);return He(a).collectEvaluatedItems(e,r,t,n,o)},addMediaTypePlugin:te.addPlugin};var Qe={compile:e=>Te.value(e),interpret:()=>!0};var Ye={compile:async(e,r)=>{const t=Te.uri(e);if(!(t in r)){r[t]=!1;const n=Te.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Te.uri(e)}'`);r[t]=[`${e.dialectId}#validate`,Te.uri(e),"boolean"==typeof n?n:await V.pipeline([Te.entries,V.map((([r,t])=>[`${e.dialectId}#${r}`,t])),V.filter((([r])=>We.hasKeyword(r)&&r!==`${e.dialectId}#validate`)),V.map((async([t,n])=>{const o=await We.getKeyword(t).compile(n,r,e);return[t,Te.uri(n),o]})),V.all],e)]}return t},interpret:(e,r,t,n)=>{const[a,i,s]=t[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=We.getKeyword(e).interpret(i,r,t,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:_.uri(r),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:_.uri(r),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&We.getKeyword(o).collectEvaluatedProperties(a,r,t,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&We.getKeyword(o).collectEvaluatedItems(a,r,t,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Xe={metaData:Qe,validate:Ye},er={Core:We,Schema:Te,Instance:_,Reference:C,Keywords:Xe,InvalidSchemaError:Pe},rr=er.Core,tr=er.Schema,nr=er.Instance,or=er.Reference,ar=er.Keywords,ir=er.InvalidSchemaError;e.Core=rr,e.Instance=nr,e.InvalidSchemaError=ir,e.Keywords=ar,e.Reference=or,e.Schema=tr,e.default=er,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/function Y(e){var r=String(e);if(J.test(r))return r;if(r.length>0&&!Z.test(r))throw new TypeError("invalid parameter value");return'"'+r.replace(G,"\\$1")+'"'}function X(e){this.parameters=Object.create(null),this.type=e}var ee={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var r=e.parameters,t=e.type;if(!t||!W.test(t))throw new TypeError("invalid type");var n=t;if(r&&"object"==typeof r)for(var o,a=Object.keys(r).sort(),i=0;i<a.length;i++){if(o=a[i],!J.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Y(r[o])}return n},parse:Q};const re={};var te={addPlugin:(e,r)=>{re[e]=r},parse:e=>{const r=ee.parse(e.headers.get("content-type")).type;if(!(r in re))throw Error(`${e.url} is not a schema. Found a document with media type: ${r}`);return re[r].parse(e)},getContentType:e=>{for(const r in re)if(re[r].matcher(e))return r;return"application/octet-stream"}};const{jsonTypeOf:ne,resolveUrl:oe,urlFragment:ae,pathRelative:ie}=c,se="https://json-schema.org/draft/2019-09/vocab/core",ce="https://json-schema.org/draft/2020-12/vocab/core",ue={},le={},pe=(e,r)=>{const t=le[e];return ue[t]?.[r]},fe={},de={},he=(e,r="",t="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(r,""),o=oe(e.$schema||t,"");if(!o)throw Error("Couldn't determine schema dialect");if(delete e.$schema,!(o in le))if(!0===e?.$vocabulary?.[se]&&o===ve(e,n,se)[0])le[o]=se;else if(!0===e?.$vocabulary?.[ce]&&o===ve(e,n,ce)[0])le[o]=ce;else if(o===ve(e,n,o)[0])le[o]=o;else{if(!(o in fe))throw Error(`Couldn't determine JSON Schema version for dialect: '${o}'`);{const e=fe[o];!0===e.vocabulary[se]?le[o]=se:!0===e.vocabulary[ce]?le[o]=ce:le[o]=le[e.dialectId]}}const[a,i]=ve(e,n,le[o]);if(!a)throw Error("Couldn't determine an identifier for the schema");const s=pe(o,"baseToken");delete e[s],n&&(de[n]=a);const c=pe(o,"anchorToken");i&&s===c&&(e[c]=c!==s?encodeURI(i):`#${encodeURI(i)}`);const u={},l=pe(o,"recursiveAnchorToken");let p;!0===e[l]&&(u[""]=`${a}#`,e[c]="",delete e[l]);const f=pe(o,"vocabularyToken");ne(e[f],"object")?(p=e[f],delete e[f]):p={[le[o]]:!0};const d={"":""};return fe[a]={id:a,dialectId:o,schema:ye(e,a,o,w.nil,d,u),anchors:d,dynamicAnchors:u,vocabulary:p,validated:!1},a},ve=(e,r,t)=>{const n=ue[t]?.baseToken,o=oe(r,e[n]||"");return[oe(o,""),ae(o)]},ye=(e,r,t,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema,""):t,s=pe(i,"embeddedToken"),c=pe(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(r,e[s]);return e[pe(i,"baseToken")]=n,he(e,n,t),C.cons(e[s],e)}const u=pe(t,"anchorToken"),l=pe(t,"dynamicAnchorToken");"string"==typeof e[l]&&(a[e[l]]=`${r}#${encodeURI(n)}`,o[e[l]]=n,delete e[l]);const p=pe(t,"embeddedToken");if("string"==typeof e[u]){const r=u!==p?e[u]:e[u].slice(1);o[r]=n,delete e[u]}const f=pe(t,"jrefToken");if("string"==typeof e[f])return C.cons(e[f],e);for(const i in e)e[i]=ye(e[i],r,t,w.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ye(e,r,t,w.append(i,n),o,a))):e},me=e=>fe[de[e]]||fe[e],ge=Object.freeze({id:"",dialectId:void 0,vocabulary:{},pointer:w.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),be=async(e,r=ge)=>{const t=oe(Se(r),e),n=oe(t,""),o=ae(t);if(!(e=>e in fe||e in de)(n)){const e=await M(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);he(await te.parse(e),n)}const a=me(n),i="/"!==o[0]?Ee(a,o):o,s=Object.freeze({...a,pointer:i,value:w.get(i,a.schema)});return we(s)},we=e=>C.isReference(e.value)?be(C.href(e.value),e):e,Ee=(e,r)=>{if(!(r in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(r)}'`);return e.anchors[r]},Se=e=>`${e.id}#${encodeURI(e.pointer)}`,Ce=e=>C.isReference(e.value)?C.value(e.value):e.value,Oe=(e,r)=>{const t=me(r.id),n=Object.freeze({...r,pointer:w.append(e,r.pointer),value:Ce(r)[e],validated:t.validated});return we(n)},Ae=r(((e,r)=>V.pipeline([Ce,V.map((async(t,n)=>e(await Oe(n,r),n))),V.all],r))),Ie={parentId:"",parentDialect:"",includeEmbedded:!0},je=(e,r)=>{if(r.startsWith("file://")){const t=e.slice(7,e.lastIndexOf("/"));return""===e?"":ie(t,r.slice(7))}return r};var Te={setConfig:(e,r,t)=>{ue[e]||(ue[e]={}),ue[e][r]=t},getConfig:pe,add:he,get:be,markValidated:e=>{fe[e].validated=!0},uri:Se,value:Ce,getAnchorPointer:Ee,typeOf:(e,r)=>ne(Ce(e),r),has:(e,r)=>e in Ce(r),step:Oe,keys:e=>Object.keys(Ce(e)),entries:e=>V.pipeline([Ce,Object.keys,V.map((async r=>[r,await Oe(r,e)])),V.all],e),map:Ae,length:e=>Ce(e).length,toSchema:(e,r={})=>{const t={...Ie,...r},n=JSON.parse(JSON.stringify(e.schema,((r,n)=>{if(!C.isReference(n))return n;const o=C.value(n),a="string"==typeof o.$schema?oe(o.$schema,""):e.dialectId,i=pe(a,"embeddedToken");return!t.includeEmbedded&&i in o?void 0:C.value(n)}))),o=pe(e.dialectId,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,r])=>{const t=ae(r);w.assign(t,n,{[o]:e,...w.get(t,n)})}));const a=pe(e.dialectId,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,r])=>{w.assign(r,n,{[a]:e,...w.get(r,n)})}));const i=pe(e.dialectId,"baseToken"),s=je(t.parentId,e.id),c=t.parentDialect===e.dialectId?"":e.dialectId;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};Te.setConfig,Te.getConfig,Te.add,Te.get,Te.markValidated,Te.uri,Te.value,Te.getAnchorPointer,Te.typeOf,Te.has,Te.step,Te.keys,Te.entries,Te.map,Te.length,Te.toSchema;class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=xe;var $e={compile:e=>Te.value(e),interpret:()=>!0};const{resolveUrl:De}=c,Re="FLAG",Ne="BASIC",_e="DETAILED",Fe="VERBOSE";let ke=_e,Ue=!0;te.addPlugin("application/schema+json",{parse:async e=>await e.json(),matcher:e=>e.endsWith(".schema.json")});const qe=async e=>{const r={metaData:{}};return{ast:r,schemaUri:await Je(e,r)}},Le=r((({ast:e,schemaUri:r},t,n=Re)=>{if(![Re,Ne,_e,Fe].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",ze(n,a));return Ge(r,t,e,{}),o.unsubscribe(i),a[0]})),ze=(e,r)=>{const t=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a,errors:[]};t.push(i)}else if("result.start"===n)t.push(n);else if("result.end"===n){const n=t.pop();for(;"result.start"!==t[t.length-1];){const r=t.pop(),o=[r];e===Ne&&(o.push(...r.errors),delete r.errors),(e===Fe||e!==Re&&!r.valid)&&n.errors.unshift(...o)}t[t.length-1]=n,r[0]=n}}},He={},Ve=e=>He[e]||$e,Me=e=>e in He,Ke={},Ze={},Je=async(e,r)=>{if(e=await Be(e),!Me(`${e.dialectId}#validate`)){const r=await Te.get(e.dialectId);(Te.getConfig(r.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!r.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(r.vocabulary).forEach((([e,t])=>{if(e in Ke)Object.entries(Ke[e]).forEach((([e,t])=>{((e,r)=>{He[e]={collectEvaluatedItems:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&new Set,collectEvaluatedProperties:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&[],...r}})(`${r.id}#${e}`,t)}));else if(t)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ue&&!e.validated){if(Te.markValidated(e.id),!(e.dialectId in Ze)){const r=await Te.get(e.dialectId),t=await qe(r);Ze[r.id]=Le(t)}const r=_.cons(e.schema,e.id),t=Ze[e.dialectId](r,ke);if(!t.valid)throw new Pe(t)}return e.id in r.metaData||(r.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ve(`${e.dialectId}#validate`).compile(e,r)},Be=async e=>Te.typeOf(e,"string")?Be(await Te.get(Te.value(e),e)):e,Ge=(e,r,t,n)=>{const o=We(e,t),a=De(e,"");return Ve(o).interpret(e,r,t,{...t.metaData[a].dynamicAnchors,...n})},We=(e,r)=>{if(!(e in r))throw Error(`No schema found at ${e}`);return r[e][0]};var Qe={validate:async(e,r,t)=>{const n=await qe(e),o=(e,r)=>Le(n,_.cons(e),r);return void 0===r?o:o(r,t)},compile:qe,interpret:Le,setMetaOutputFormat:e=>{ke=e},setShouldMetaValidate:e=>{Ue=e},FLAG:Re,BASIC:Ne,DETAILED:_e,VERBOSE:Fe,add:(e,r="",t="")=>{const n=Te.add(e,r,t);delete Ze[n]},getKeyword:Ve,hasKeyword:Me,defineVocabulary:(e,r)=>{Ke[e]=r},compileSchema:Je,interpretSchema:Ge,collectEvaluatedProperties:(e,r,t,n,o)=>{const a=We(e,t);return Ve(a).collectEvaluatedProperties(e,r,t,n,o)},collectEvaluatedItems:(e,r,t,n,o)=>{const a=We(e,t);return Ve(a).collectEvaluatedItems(e,r,t,n,o)},addMediaTypePlugin:te.addPlugin};var Ye={compile:async(e,r)=>{const t=Te.uri(e);if(!(t in r)){r[t]=!1;const n=Te.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Te.uri(e)}'`);r[t]=[`${e.dialectId}#validate`,Te.uri(e),"boolean"==typeof n?n:await V.pipeline([Te.entries,V.map((([r,t])=>[`${e.dialectId}#${r}`,t])),V.filter((([r])=>r!==`${e.dialectId}#validate`)),V.map((async([t,n])=>{const o=await Qe.getKeyword(t).compile(n,r,e);return[t,Te.uri(n),o]})),V.all],e)]}return t},interpret:(e,r,t,n)=>{const[a,i,s]=t[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=Qe.getKeyword(e).interpret(i,r,t,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:_.uri(r),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:_.uri(r),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Qe.getKeyword(o).collectEvaluatedProperties(a,r,t,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Qe.getKeyword(o).collectEvaluatedItems(a,r,t,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Xe={metaData:$e,validate:Ye},er={Core:Qe,Schema:Te,Instance:_,Reference:C,Keywords:Xe,InvalidSchemaError:Pe},rr=er.Core,tr=er.Schema,nr=er.Instance,or=er.Reference,ar=er.Keywords,ir=er.InvalidSchemaError;e.Core=rr,e.Instance=nr,e.InvalidSchemaError=ir,e.Keywords=ar,e.Reference=or,e.Schema=tr,e.default=er,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-amd.min.js.map |
@@ -8,3 +8,3 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=function(e,r){return function t(){null==r&&(r=e.length);var n=[].slice.call(arguments);return n.length>=r?e.apply(this,n):function(){return t.apply(this,n.concat([].slice.call(arguments)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,r){return e(r={exports:{}},r.exports),r.exports}var n=t((function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub?(o=n.PubSub,console.warn("PubSub already loaded, using existing version")):(n.PubSub=o,function(e){var r={},t=-1,n="*";function o(e){var r;for(r in e)if(Object.prototype.hasOwnProperty.call(e,r))return!0;return!1}function a(e){return function(){throw e}}function i(e,r,t){try{e(r,t)}catch(e){setTimeout(a(e),0)}}function s(e,r,t){e(r,t)}function c(e,t,n,o){var a,c=r[t],u=o?s:i;if(Object.prototype.hasOwnProperty.call(r,t))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&u(c[a],e,n)}function u(e,r,t){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,r,t);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,r,t);c(e,n,r,t)}}function l(e){var t=String(e);return Boolean(Object.prototype.hasOwnProperty.call(r,t)&&o(r[t]))}function p(e){for(var r=String(e),t=l(r)||l(n),o=r.lastIndexOf(".");!t&&-1!==o;)o=(r=r.substr(0,o)).lastIndexOf("."),t=l(r);return t}function f(e,r,t,n){var o=u(e="symbol"==typeof e?e.toString():e,r,n);return!!p(e)&&(!0===t?o():setTimeout(o,0),!0)}e.publish=function(r,t){return f(r,t,!1,e.immediateExceptions)},e.publishSync=function(r,t){return f(r,t,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(r,e)||(r[e]={});var o="uid_"+String(++t);return r[e][o]=n,o},e.subscribeAll=function(r){return e.subscribe(n,r)},e.subscribeOnce=function(r,t){var n=e.subscribe(r,(function(){e.unsubscribe(n),t.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){r={}},e.clearSubscriptions=function(e){var t;for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)&&delete r[t]},e.countSubscriptions=function(e){var t,n,o=0;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)){for(n in r[t])o++;break}return o},e.getSubscriptions=function(e){var t,n=[];for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)&&n.push(t);return n},e.unsubscribe=function(t){var n,o,a,i=function(e){var t;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e))return!0;return!1},s="string"==typeof t&&(Object.prototype.hasOwnProperty.call(r,t)||i(t)),c=!s&&"string"==typeof t,u="function"==typeof t,l=!1;if(!s){for(n in r)if(Object.prototype.hasOwnProperty.call(r,n)){if(o=r[n],c&&o[t]){delete o[t],l=t;break}if(u)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===t&&(delete o[a],l=!0)}return l}e.clearSubscriptions(t)}}(o)),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}));n.PubSub;var o,a=t((function(e,r){ | ||
* MIT Licensed | ||
*/function Q(e){var r=String(e);if(Z.test(r))return r;if(r.length>0&&!K.test(r))throw new TypeError("invalid parameter value");return'"'+r.replace(B,"\\$1")+'"'}function Y(e){this.parameters=Object.create(null),this.type=e}var X={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var r=e.parameters,t=e.type;if(!t||!G.test(t))throw new TypeError("invalid type");var n=t;if(r&&"object"==typeof r)for(var o,a=Object.keys(r).sort(),i=0;i<a.length;i++){if(o=a[i],!Z.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Q(r[o])}return n},parse:W};const ee={};var re={addPlugin:(e,r)=>{ee[e]=r},parse:e=>{const r=X.parse(e.headers.get("content-type")).type;if(!(r in ee))throw Error(`${e.url} is not a schema. Found a document with media type: ${r}`);return ee[r].parse(e)},getContentType:e=>{for(const r in ee)if(ee[r].matcher(e))return r;return"application/octet-stream"}};const{jsonTypeOf:te,resolveUrl:ne,urlFragment:oe,pathRelative:ae}=s,ie="https://json-schema.org/draft/2019-09/vocab/core",se="https://json-schema.org/draft/2020-12/vocab/core",ce={},ue={},le=(e,r)=>{const t=ue[e];return ce[t]?.[r]},pe={},fe={},de=(e,r="",t="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(r,""),o=ne(e.$schema||t,"");if(!o)throw Error("Couldn't determine schema dialect");if(delete e.$schema,!(o in ue))if(!0===e?.$vocabulary?.[ie]&&o===he(e,n,ie)[0])ue[o]=ie;else if(!0===e?.$vocabulary?.[se]&&o===he(e,n,se)[0])ue[o]=se;else if(o===he(e,n,o)[0])ue[o]=o;else{if(!(o in pe))throw Error(`Couldn't determine JSON Schema version for dialect: '${o}'`);{const e=pe[o];!0===e.vocabulary[ie]?ue[o]=ie:!0===e.vocabulary[se]?ue[o]=se:ue[o]=ue[e.dialectId]}}const[a,i]=he(e,n,ue[o]);if(!a)throw Error("Couldn't determine an identifier for the schema");const s=le(o,"baseToken");delete e[s],n&&(fe[n]=a);const c=le(o,"anchorToken");i&&s===c&&(e[c]=c!==s?encodeURI(i):`#${encodeURI(i)}`);const u={},l=le(o,"recursiveAnchorToken");let p;!0===e[l]&&(u[""]=`${a}#`,e[c]="",delete e[l]);const f=le(o,"vocabularyToken");te(e[f],"object")?(p=e[f],delete e[f]):p={[ue[o]]:!0};const d={"":""};return pe[a]={id:a,dialectId:o,schema:ve(e,a,o,b.nil,d,u),anchors:d,dynamicAnchors:u,vocabulary:p,validated:!1},a},he=(e,r,t)=>{const n=ce[t]?.baseToken,o=ne(r,e[n]||"");return[ne(o,""),oe(o)]},ve=(e,r,t,n,o,a)=>{if(te(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema,""):t,s=le(i,"embeddedToken"),c=le(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ne(r,e[s]);return e[le(i,"baseToken")]=n,de(e,n,t),S.cons(e[s],e)}const u=le(t,"anchorToken"),l=le(t,"dynamicAnchorToken");"string"==typeof e[l]&&(a[e[l]]=`${r}#${encodeURI(n)}`,o[e[l]]=n,delete e[l]);const p=le(t,"embeddedToken");if("string"==typeof e[u]){const r=u!==p?e[u]:e[u].slice(1);o[r]=n,delete e[u]}const f=le(t,"jrefToken");if("string"==typeof e[f])return S.cons(e[f],e);for(const i in e)e[i]=ve(e[i],r,t,b.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ve(e,r,t,b.append(i,n),o,a))):e},ye=e=>pe[fe[e]]||pe[e],me=Object.freeze({id:"",dialectId:void 0,vocabulary:{},pointer:b.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ge=async(e,r=me)=>{const t=ne(Ee(r),e),n=ne(t,""),o=oe(t);if(!(e=>e in pe||e in fe)(n)){const e=await V(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);de(await re.parse(e),n)}const a=ye(n),i="/"!==o[0]?we(a,o):o,s=Object.freeze({...a,pointer:i,value:b.get(i,a.schema)});return be(s)},be=e=>S.isReference(e.value)?ge(S.href(e.value),e):e,we=(e,r)=>{if(!(r in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(r)}'`);return e.anchors[r]},Ee=e=>`${e.id}#${encodeURI(e.pointer)}`,Se=e=>S.isReference(e.value)?S.value(e.value):e.value,Ce=(e,r)=>{const t=ye(r.id),n=Object.freeze({...r,pointer:b.append(e,r.pointer),value:Se(r)[e],validated:t.validated});return be(n)},Oe=e(((e,r)=>H.pipeline([Se,H.map((async(t,n)=>e(await Ce(n,r),n))),H.all],r))),Ae={parentId:"",parentDialect:"",includeEmbedded:!0},Ie=(e,r)=>{if(r.startsWith("file://")){const t=e.slice(7,e.lastIndexOf("/"));return""===e?"":ae(t,r.slice(7))}return r};var je={setConfig:(e,r,t)=>{ce[e]||(ce[e]={}),ce[e][r]=t},getConfig:le,add:de,get:ge,markValidated:e=>{pe[e].validated=!0},uri:Ee,value:Se,getAnchorPointer:we,typeOf:(e,r)=>te(Se(e),r),has:(e,r)=>e in Se(r),step:Ce,keys:e=>Object.keys(Se(e)),entries:e=>H.pipeline([Se,Object.keys,H.map((async r=>[r,await Ce(r,e)])),H.all],e),map:Oe,length:e=>Se(e).length,toSchema:(e,r={})=>{const t={...Ae,...r},n=JSON.parse(JSON.stringify(e.schema,((r,n)=>{if(!S.isReference(n))return n;const o=S.value(n),a="string"==typeof o.$schema?ne(o.$schema,""):e.dialectId,i=le(a,"embeddedToken");return!t.includeEmbedded&&i in o?void 0:S.value(n)}))),o=le(e.dialectId,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,r])=>{const t=oe(r);b.assign(t,n,{[o]:e,...b.get(t,n)})}));const a=le(e.dialectId,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,r])=>{b.assign(r,n,{[a]:e,...b.get(r,n)})}));const i=le(e.dialectId,"baseToken"),s=Ie(t.parentId,e.id),c=t.parentDialect===e.dialectId?"":e.dialectId;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};je.setConfig,je.getConfig,je.add,je.get,je.markValidated,je.uri,je.value,je.getAnchorPointer,je.typeOf,je.has,je.step,je.keys,je.entries,je.map,je.length,je.toSchema;class Te extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Te;const{resolveUrl:Pe}=s,$e="FLAG",De="BASIC",Re="DETAILED",Ne="VERBOSE";let _e=Re,Fe=!0;re.addPlugin("application/schema+json",{parse:async e=>await e.json(),matcher:e=>e.endsWith(".schema.json")});const ke=async e=>{const r={metaData:{}};return{ast:r,schemaUri:await Ke(e,r)}},Ue=e((({ast:e,schemaUri:r},t,o=$e)=>{if(![$e,De,Re,Ne].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",qe(o,a));return Je(r,t,e,{}),n.unsubscribe(i),a[0]})),qe=(e,r)=>{const t=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a,errors:[]};t.push(i)}else if("result.start"===n)t.push(n);else if("result.end"===n){const n=t.pop();for(;"result.start"!==t[t.length-1];){const r=t.pop(),o=[r];e===De&&(o.push(...r.errors),delete r.errors),(e===Ne||e!==$e&&!r.valid)&&n.errors.unshift(...o)}t[t.length-1]=n,r[0]=n}}},Le={},ze=e=>Le[e],He=e=>e in Le,Ve={},Me={},Ke=async(e,r)=>{if(e=await Ze(e),!He(`${e.dialectId}#validate`)){const r=await je.get(e.dialectId);(je.getConfig(r.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!r.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(r.vocabulary).forEach((([e,t])=>{if(e in Ve)Object.entries(Ve[e]).forEach((([e,t])=>{((e,r)=>{Le[e]={collectEvaluatedItems:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&new Set,collectEvaluatedProperties:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&[],...r}})(`${r.id}#${e}`,t)}));else if(t)throw Error(`Missing required vocabulary: ${e}`)}))}if(Fe&&!e.validated){if(je.markValidated(e.id),!(e.dialectId in Me)){const r=await je.get(e.dialectId),t=await ke(r);Me[r.id]=Ue(t)}const r=N.cons(e.schema,e.id),t=Me[e.dialectId](r,_e);if(!t.valid)throw new xe(t)}return e.id in r.metaData||(r.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ze(`${e.dialectId}#validate`).compile(e,r)},Ze=async e=>je.typeOf(e,"string")?Ze(await je.get(je.value(e),e)):e,Je=(e,r,t,n)=>{const o=Be(e,t),a=Pe(e,"");return ze(o).interpret(e,r,t,{...t.metaData[a].dynamicAnchors,...n})},Be=(e,r)=>{if(!(e in r))throw Error(`No schema found at ${e}`);return r[e][0]};var Ge={validate:async(e,r,t)=>{const n=await ke(e),o=(e,r)=>Ue(n,N.cons(e),r);return void 0===r?o:o(r,t)},compile:ke,interpret:Ue,setMetaOutputFormat:e=>{_e=e},setShouldMetaValidate:e=>{Fe=e},FLAG:$e,BASIC:De,DETAILED:Re,VERBOSE:Ne,add:(e,r="",t="")=>{const n=je.add(e,r,t);delete Me[n]},getKeyword:ze,hasKeyword:He,defineVocabulary:(e,r)=>{Ve[e]=r},compileSchema:Ke,interpretSchema:Je,collectEvaluatedProperties:(e,r,t,n,o)=>{const a=Be(e,t);return ze(a).collectEvaluatedProperties(e,r,t,n,o)},collectEvaluatedItems:(e,r,t,n,o)=>{const a=Be(e,t);return ze(a).collectEvaluatedItems(e,r,t,n,o)},addMediaTypePlugin:re.addPlugin};var We={compile:e=>je.value(e),interpret:()=>!0};var Qe={compile:async(e,r)=>{const t=je.uri(e);if(!(t in r)){r[t]=!1;const n=je.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${je.uri(e)}'`);r[t]=[`${e.dialectId}#validate`,je.uri(e),"boolean"==typeof n?n:await H.pipeline([je.entries,H.map((([r,t])=>[`${e.dialectId}#${r}`,t])),H.filter((([r])=>Ge.hasKeyword(r)&&r!==`${e.dialectId}#validate`)),H.map((async([t,n])=>{const o=await Ge.getKeyword(t).compile(n,r,e);return[t,je.uri(n),o]})),H.all],e)]}return t},interpret:(e,r,t,o)=>{const[a,i,s]=t[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=Ge.getKeyword(e).interpret(i,r,t,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:N.uri(r),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:N.uri(r),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Ge.getKeyword(o).collectEvaluatedProperties(a,r,t,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Ge.getKeyword(o).collectEvaluatedItems(a,r,t,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ye={metaData:We,validate:Qe},Xe={Core:Ge,Schema:je,Instance:N,Reference:S,Keywords:Ye,InvalidSchemaError:xe},er=Xe.Core,rr=Xe.Schema,tr=Xe.Instance,nr=Xe.Reference,or=Xe.Keywords,ar=Xe.InvalidSchemaError;exports.Core=er,exports.Instance=tr,exports.InvalidSchemaError=ar,exports.Keywords=or,exports.Reference=nr,exports.Schema=rr,exports.default=Xe; | ||
*/function Q(e){var r=String(e);if(Z.test(r))return r;if(r.length>0&&!K.test(r))throw new TypeError("invalid parameter value");return'"'+r.replace(B,"\\$1")+'"'}function Y(e){this.parameters=Object.create(null),this.type=e}var X={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var r=e.parameters,t=e.type;if(!t||!G.test(t))throw new TypeError("invalid type");var n=t;if(r&&"object"==typeof r)for(var o,a=Object.keys(r).sort(),i=0;i<a.length;i++){if(o=a[i],!Z.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Q(r[o])}return n},parse:W};const ee={};var re={addPlugin:(e,r)=>{ee[e]=r},parse:e=>{const r=X.parse(e.headers.get("content-type")).type;if(!(r in ee))throw Error(`${e.url} is not a schema. Found a document with media type: ${r}`);return ee[r].parse(e)},getContentType:e=>{for(const r in ee)if(ee[r].matcher(e))return r;return"application/octet-stream"}};const{jsonTypeOf:te,resolveUrl:ne,urlFragment:oe,pathRelative:ae}=s,ie="https://json-schema.org/draft/2019-09/vocab/core",se="https://json-schema.org/draft/2020-12/vocab/core",ce={},ue={},le=(e,r)=>{const t=ue[e];return ce[t]?.[r]},pe={},fe={},de=(e,r="",t="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(r,""),o=ne(e.$schema||t,"");if(!o)throw Error("Couldn't determine schema dialect");if(delete e.$schema,!(o in ue))if(!0===e?.$vocabulary?.[ie]&&o===he(e,n,ie)[0])ue[o]=ie;else if(!0===e?.$vocabulary?.[se]&&o===he(e,n,se)[0])ue[o]=se;else if(o===he(e,n,o)[0])ue[o]=o;else{if(!(o in pe))throw Error(`Couldn't determine JSON Schema version for dialect: '${o}'`);{const e=pe[o];!0===e.vocabulary[ie]?ue[o]=ie:!0===e.vocabulary[se]?ue[o]=se:ue[o]=ue[e.dialectId]}}const[a,i]=he(e,n,ue[o]);if(!a)throw Error("Couldn't determine an identifier for the schema");const s=le(o,"baseToken");delete e[s],n&&(fe[n]=a);const c=le(o,"anchorToken");i&&s===c&&(e[c]=c!==s?encodeURI(i):`#${encodeURI(i)}`);const u={},l=le(o,"recursiveAnchorToken");let p;!0===e[l]&&(u[""]=`${a}#`,e[c]="",delete e[l]);const f=le(o,"vocabularyToken");te(e[f],"object")?(p=e[f],delete e[f]):p={[ue[o]]:!0};const d={"":""};return pe[a]={id:a,dialectId:o,schema:ve(e,a,o,b.nil,d,u),anchors:d,dynamicAnchors:u,vocabulary:p,validated:!1},a},he=(e,r,t)=>{const n=ce[t]?.baseToken,o=ne(r,e[n]||"");return[ne(o,""),oe(o)]},ve=(e,r,t,n,o,a)=>{if(te(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema,""):t,s=le(i,"embeddedToken"),c=le(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ne(r,e[s]);return e[le(i,"baseToken")]=n,de(e,n,t),S.cons(e[s],e)}const u=le(t,"anchorToken"),l=le(t,"dynamicAnchorToken");"string"==typeof e[l]&&(a[e[l]]=`${r}#${encodeURI(n)}`,o[e[l]]=n,delete e[l]);const p=le(t,"embeddedToken");if("string"==typeof e[u]){const r=u!==p?e[u]:e[u].slice(1);o[r]=n,delete e[u]}const f=le(t,"jrefToken");if("string"==typeof e[f])return S.cons(e[f],e);for(const i in e)e[i]=ve(e[i],r,t,b.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ve(e,r,t,b.append(i,n),o,a))):e},ye=e=>pe[fe[e]]||pe[e],me=Object.freeze({id:"",dialectId:void 0,vocabulary:{},pointer:b.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ge=async(e,r=me)=>{const t=ne(Ee(r),e),n=ne(t,""),o=oe(t);if(!(e=>e in pe||e in fe)(n)){const e=await V(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);de(await re.parse(e),n)}const a=ye(n),i="/"!==o[0]?we(a,o):o,s=Object.freeze({...a,pointer:i,value:b.get(i,a.schema)});return be(s)},be=e=>S.isReference(e.value)?ge(S.href(e.value),e):e,we=(e,r)=>{if(!(r in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(r)}'`);return e.anchors[r]},Ee=e=>`${e.id}#${encodeURI(e.pointer)}`,Se=e=>S.isReference(e.value)?S.value(e.value):e.value,Ce=(e,r)=>{const t=ye(r.id),n=Object.freeze({...r,pointer:b.append(e,r.pointer),value:Se(r)[e],validated:t.validated});return be(n)},Oe=e(((e,r)=>H.pipeline([Se,H.map((async(t,n)=>e(await Ce(n,r),n))),H.all],r))),Ae={parentId:"",parentDialect:"",includeEmbedded:!0},Ie=(e,r)=>{if(r.startsWith("file://")){const t=e.slice(7,e.lastIndexOf("/"));return""===e?"":ae(t,r.slice(7))}return r};var je={setConfig:(e,r,t)=>{ce[e]||(ce[e]={}),ce[e][r]=t},getConfig:le,add:de,get:ge,markValidated:e=>{pe[e].validated=!0},uri:Ee,value:Se,getAnchorPointer:we,typeOf:(e,r)=>te(Se(e),r),has:(e,r)=>e in Se(r),step:Ce,keys:e=>Object.keys(Se(e)),entries:e=>H.pipeline([Se,Object.keys,H.map((async r=>[r,await Ce(r,e)])),H.all],e),map:Oe,length:e=>Se(e).length,toSchema:(e,r={})=>{const t={...Ae,...r},n=JSON.parse(JSON.stringify(e.schema,((r,n)=>{if(!S.isReference(n))return n;const o=S.value(n),a="string"==typeof o.$schema?ne(o.$schema,""):e.dialectId,i=le(a,"embeddedToken");return!t.includeEmbedded&&i in o?void 0:S.value(n)}))),o=le(e.dialectId,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,r])=>{const t=oe(r);b.assign(t,n,{[o]:e,...b.get(t,n)})}));const a=le(e.dialectId,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,r])=>{b.assign(r,n,{[a]:e,...b.get(r,n)})}));const i=le(e.dialectId,"baseToken"),s=Ie(t.parentId,e.id),c=t.parentDialect===e.dialectId?"":e.dialectId;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};je.setConfig,je.getConfig,je.add,je.get,je.markValidated,je.uri,je.value,je.getAnchorPointer,je.typeOf,je.has,je.step,je.keys,je.entries,je.map,je.length,je.toSchema;class Te extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Te;var Pe={compile:e=>je.value(e),interpret:()=>!0};const{resolveUrl:$e}=s,De="FLAG",Re="BASIC",Ne="DETAILED",_e="VERBOSE";let Fe=Ne,ke=!0;re.addPlugin("application/schema+json",{parse:async e=>await e.json(),matcher:e=>e.endsWith(".schema.json")});const Ue=async e=>{const r={metaData:{}};return{ast:r,schemaUri:await Ze(e,r)}},qe=e((({ast:e,schemaUri:r},t,o=De)=>{if(![De,Re,Ne,_e].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",Le(o,a));return Be(r,t,e,{}),n.unsubscribe(i),a[0]})),Le=(e,r)=>{const t=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a,errors:[]};t.push(i)}else if("result.start"===n)t.push(n);else if("result.end"===n){const n=t.pop();for(;"result.start"!==t[t.length-1];){const r=t.pop(),o=[r];e===Re&&(o.push(...r.errors),delete r.errors),(e===_e||e!==De&&!r.valid)&&n.errors.unshift(...o)}t[t.length-1]=n,r[0]=n}}},ze={},He=e=>ze[e]||Pe,Ve=e=>e in ze,Me={},Ke={},Ze=async(e,r)=>{if(e=await Je(e),!Ve(`${e.dialectId}#validate`)){const r=await je.get(e.dialectId);(je.getConfig(r.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!r.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(r.vocabulary).forEach((([e,t])=>{if(e in Me)Object.entries(Me[e]).forEach((([e,t])=>{((e,r)=>{ze[e]={collectEvaluatedItems:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&new Set,collectEvaluatedProperties:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&[],...r}})(`${r.id}#${e}`,t)}));else if(t)throw Error(`Missing required vocabulary: ${e}`)}))}if(ke&&!e.validated){if(je.markValidated(e.id),!(e.dialectId in Ke)){const r=await je.get(e.dialectId),t=await Ue(r);Ke[r.id]=qe(t)}const r=N.cons(e.schema,e.id),t=Ke[e.dialectId](r,Fe);if(!t.valid)throw new xe(t)}return e.id in r.metaData||(r.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),He(`${e.dialectId}#validate`).compile(e,r)},Je=async e=>je.typeOf(e,"string")?Je(await je.get(je.value(e),e)):e,Be=(e,r,t,n)=>{const o=Ge(e,t),a=$e(e,"");return He(o).interpret(e,r,t,{...t.metaData[a].dynamicAnchors,...n})},Ge=(e,r)=>{if(!(e in r))throw Error(`No schema found at ${e}`);return r[e][0]};var We={validate:async(e,r,t)=>{const n=await Ue(e),o=(e,r)=>qe(n,N.cons(e),r);return void 0===r?o:o(r,t)},compile:Ue,interpret:qe,setMetaOutputFormat:e=>{Fe=e},setShouldMetaValidate:e=>{ke=e},FLAG:De,BASIC:Re,DETAILED:Ne,VERBOSE:_e,add:(e,r="",t="")=>{const n=je.add(e,r,t);delete Ke[n]},getKeyword:He,hasKeyword:Ve,defineVocabulary:(e,r)=>{Me[e]=r},compileSchema:Ze,interpretSchema:Be,collectEvaluatedProperties:(e,r,t,n,o)=>{const a=Ge(e,t);return He(a).collectEvaluatedProperties(e,r,t,n,o)},collectEvaluatedItems:(e,r,t,n,o)=>{const a=Ge(e,t);return He(a).collectEvaluatedItems(e,r,t,n,o)},addMediaTypePlugin:re.addPlugin};var Qe={compile:async(e,r)=>{const t=je.uri(e);if(!(t in r)){r[t]=!1;const n=je.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${je.uri(e)}'`);r[t]=[`${e.dialectId}#validate`,je.uri(e),"boolean"==typeof n?n:await H.pipeline([je.entries,H.map((([r,t])=>[`${e.dialectId}#${r}`,t])),H.filter((([r])=>r!==`${e.dialectId}#validate`)),H.map((async([t,n])=>{const o=await We.getKeyword(t).compile(n,r,e);return[t,je.uri(n),o]})),H.all],e)]}return t},interpret:(e,r,t,o)=>{const[a,i,s]=t[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=We.getKeyword(e).interpret(i,r,t,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:N.uri(r),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:N.uri(r),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&We.getKeyword(o).collectEvaluatedProperties(a,r,t,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&We.getKeyword(o).collectEvaluatedItems(a,r,t,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ye={metaData:Pe,validate:Qe},Xe={Core:We,Schema:je,Instance:N,Reference:S,Keywords:Ye,InvalidSchemaError:xe},er=Xe.Core,rr=Xe.Schema,tr=Xe.Instance,nr=Xe.Reference,or=Xe.Keywords,ar=Xe.InvalidSchemaError;exports.Core=er,exports.Instance=tr,exports.InvalidSchemaError=ar,exports.Keywords=or,exports.Reference=nr,exports.Schema=rr,exports.default=Xe; | ||
//# sourceMappingURL=json-schema-core-cjs.min.js.map |
var e=function(e,r){return function t(){null==r&&(r=e.length);var n=[].slice.call(arguments);return n.length>=r?e.apply(this,n):function(){return t.apply(this,n.concat([].slice.call(arguments)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,r){return e(r={exports:{}},r.exports),r.exports}var n=t((function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub?(o=n.PubSub,console.warn("PubSub already loaded, using existing version")):(n.PubSub=o,function(e){var r={},t=-1,n="*";function o(e){var r;for(r in e)if(Object.prototype.hasOwnProperty.call(e,r))return!0;return!1}function a(e){return function(){throw e}}function i(e,r,t){try{e(r,t)}catch(e){setTimeout(a(e),0)}}function s(e,r,t){e(r,t)}function c(e,t,n,o){var a,c=r[t],u=o?s:i;if(Object.prototype.hasOwnProperty.call(r,t))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&u(c[a],e,n)}function u(e,r,t){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,r,t);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,r,t);c(e,n,r,t)}}function l(e){var t=String(e);return Boolean(Object.prototype.hasOwnProperty.call(r,t)&&o(r[t]))}function p(e){for(var r=String(e),t=l(r)||l(n),o=r.lastIndexOf(".");!t&&-1!==o;)o=(r=r.substr(0,o)).lastIndexOf("."),t=l(r);return t}function f(e,r,t,n){var o=u(e="symbol"==typeof e?e.toString():e,r,n);return!!p(e)&&(!0===t?o():setTimeout(o,0),!0)}e.publish=function(r,t){return f(r,t,!1,e.immediateExceptions)},e.publishSync=function(r,t){return f(r,t,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(r,e)||(r[e]={});var o="uid_"+String(++t);return r[e][o]=n,o},e.subscribeAll=function(r){return e.subscribe(n,r)},e.subscribeOnce=function(r,t){var n=e.subscribe(r,(function(){e.unsubscribe(n),t.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){r={}},e.clearSubscriptions=function(e){var t;for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)&&delete r[t]},e.countSubscriptions=function(e){var t,n,o=0;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)){for(n in r[t])o++;break}return o},e.getSubscriptions=function(e){var t,n=[];for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)&&n.push(t);return n},e.unsubscribe=function(t){var n,o,a,i=function(e){var t;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e))return!0;return!1},s="string"==typeof t&&(Object.prototype.hasOwnProperty.call(r,t)||i(t)),c=!s&&"string"==typeof t,u="function"==typeof t,l=!1;if(!s){for(n in r)if(Object.prototype.hasOwnProperty.call(r,n)){if(o=r[n],c&&o[t]){delete o[t],l=t;break}if(u)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===t&&(delete o[a],l=!0)}return l}e.clearSubscriptions(t)}}(o)),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}));n.PubSub;var o,a=t((function(e,r){ | ||
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ | ||
!function(e){function r(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];if(r.length>1){r[0]=r[0].slice(0,-1);for(var n=r.length-1,o=1;o<n;++o)r[o]=r[o].slice(1,-1);return r[n]=r[n].slice(1),r.join("")}return r[0]}function t(e){return"(?:"+e+")"}function n(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function o(e){return e.toUpperCase()}function a(e){return null!=e?e instanceof Array?e:"number"!=typeof e.length||e.split||e.setInterval||e.call?[e]:Array.prototype.slice.call(e):[]}function i(e,r){var t=e;if(r)for(var n in r)t[n]=r[n];return t}function s(e){var n="[A-Za-z]",o="[0-9]",a=r(o,"[A-Fa-f]"),i=t(t("%[EFef]"+a+"%"+a+a+"%"+a+a)+"|"+t("%[89A-Fa-f]"+a+"%"+a+a)+"|"+t("%"+a+a)),s="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",c=r("[\\:\\/\\?\\#\\[\\]\\@]",s),u=e?"[\\uE000-\\uF8FF]":"[]",l=r(n,o,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]");t(n+r(n,o,"[\\+\\-\\.]")+"*"),t(t(i+"|"+r(l,s,"[\\:]"))+"*");var p=t(t("25[0-5]")+"|"+t("2[0-4]"+o)+"|"+t("1"+o+o)+"|"+t("0?[1-9]"+o)+"|0?0?"+o),f=t(p+"\\."+p+"\\."+p+"\\."+p),d=t(a+"{1,4}"),h=t(t(d+"\\:"+d)+"|"+f),v=t(t(d+"\\:")+"{6}"+h),y=t("\\:\\:"+t(d+"\\:")+"{5}"+h),m=t(t(d)+"?\\:\\:"+t(d+"\\:")+"{4}"+h),g=t(t(t(d+"\\:")+"{0,1}"+d)+"?\\:\\:"+t(d+"\\:")+"{3}"+h),b=t(t(t(d+"\\:")+"{0,2}"+d)+"?\\:\\:"+t(d+"\\:")+"{2}"+h),w=t(t(t(d+"\\:")+"{0,3}"+d)+"?\\:\\:"+d+"\\:"+h),E=t(t(t(d+"\\:")+"{0,4}"+d)+"?\\:\\:"+h),S=t(t(t(d+"\\:")+"{0,5}"+d)+"?\\:\\:"+d),C=t(t(t(d+"\\:")+"{0,6}"+d)+"?\\:\\:"),O=t([v,y,m,g,b,w,E,S,C].join("|")),A=t(t(l+"|"+i)+"+");t("[vV]"+a+"+\\."+r(l,s,"[\\:]")+"+"),t(t(i+"|"+r(l,s))+"*");var I=t(i+"|"+r(l,s,"[\\:\\@]"));return t(t(i+"|"+r(l,s,"[\\@]"))+"+"),t(t(I+"|"+r("[\\/\\?]",u))+"*"),{NOT_SCHEME:new RegExp(r("[^]",n,o,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(r("[^\\%\\:]",l,s),"g"),NOT_HOST:new RegExp(r("[^\\%\\[\\]\\:]",l,s),"g"),NOT_PATH:new RegExp(r("[^\\%\\/\\:\\@]",l,s),"g"),NOT_PATH_NOSCHEME:new RegExp(r("[^\\%\\/\\@]",l,s),"g"),NOT_QUERY:new RegExp(r("[^\\%]",l,s,"[\\:\\@\\/\\?]",u),"g"),NOT_FRAGMENT:new RegExp(r("[^\\%]",l,s,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(r("[^]",l,s),"g"),UNRESERVED:new RegExp(l,"g"),OTHER_CHARS:new RegExp(r("[^\\%]",l,c),"g"),PCT_ENCODED:new RegExp(i,"g"),IPV4ADDRESS:new RegExp("^("+f+")$"),IPV6ADDRESS:new RegExp("^\\[?("+O+")"+t(t("\\%25|\\%(?!"+a+"{2})")+"("+A+")")+"?\\]?$")}}var c=s(!1),u=s(!0),l=function(){function e(e,r){var t=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(t.push(i.value),!r||t.length!==r);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return t}return function(r,t){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return e(r,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(e){if(Array.isArray(e)){for(var r=0,t=Array(e.length);r<e.length;r++)t[r]=e[r];return t}return Array.from(e)},f=2147483647,d=36,h=1,v=26,y=38,m=700,g=72,b=128,w="-",E=/^xn--/,S=/[^\0-\x7E]/,C=/[\x2E\u3002\uFF0E\uFF61]/g,O={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},A=d-h,I=Math.floor,T=String.fromCharCode;function j(e){throw new RangeError(O[e])}function x(e,r){for(var t=[],n=e.length;n--;)t[n]=r(e[n]);return t}function P(e,r){var t=e.split("@"),n="";return t.length>1&&(n=t[0]+"@",e=t[1]),n+x((e=e.replace(C,".")).split("."),r).join(".")}function $(e){for(var r=[],t=0,n=e.length;t<n;){var o=e.charCodeAt(t++);if(o>=55296&&o<=56319&&t<n){var a=e.charCodeAt(t++);56320==(64512&a)?r.push(((1023&o)<<10)+(1023&a)+65536):(r.push(o),t--)}else r.push(o)}return r}var D=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:d},R=function(e,r){return e+22+75*(e<26)-((0!=r)<<5)},N=function(e,r,t){var n=0;for(e=t?I(e/m):e>>1,e+=I(e/r);e>A*v>>1;n+=d)e=I(e/A);return I(n+(A+1)*e/(e+y))},F=function(e){var r=[],t=e.length,n=0,o=b,a=g,i=e.lastIndexOf(w);i<0&&(i=0);for(var s=0;s<i;++s)e.charCodeAt(s)>=128&&j("not-basic"),r.push(e.charCodeAt(s));for(var c=i>0?i+1:0;c<t;){for(var u=n,l=1,p=d;;p+=d){c>=t&&j("invalid-input");var y=D(e.charCodeAt(c++));(y>=d||y>I((f-n)/l))&&j("overflow"),n+=y*l;var m=p<=a?h:p>=a+v?v:p-a;if(y<m)break;var E=d-m;l>I(f/E)&&j("overflow"),l*=E}var S=r.length+1;a=N(n-u,S,0==u),I(n/S)>f-o&&j("overflow"),o+=I(n/S),n%=S,r.splice(n++,0,o)}return String.fromCodePoint.apply(String,r)},_=function(e){var r=[],t=(e=$(e)).length,n=b,o=0,a=g,i=!0,s=!1,c=void 0;try{for(var u,l=e[Symbol.iterator]();!(i=(u=l.next()).done);i=!0){var p=u.value;p<128&&r.push(T(p))}}catch(e){s=!0,c=e}finally{try{!i&&l.return&&l.return()}finally{if(s)throw c}}var y=r.length,m=y;for(y&&r.push(w);m<t;){var E=f,S=!0,C=!1,O=void 0;try{for(var A,x=e[Symbol.iterator]();!(S=(A=x.next()).done);S=!0){var P=A.value;P>=n&&P<E&&(E=P)}}catch(e){C=!0,O=e}finally{try{!S&&x.return&&x.return()}finally{if(C)throw O}}var D=m+1;E-n>I((f-o)/D)&&j("overflow"),o+=(E-n)*D,n=E;var F=!0,_=!1,k=void 0;try{for(var U,q=e[Symbol.iterator]();!(F=(U=q.next()).done);F=!0){var L=U.value;if(L<n&&++o>f&&j("overflow"),L==n){for(var z=o,H=d;;H+=d){var V=H<=a?h:H>=a+v?v:H-a;if(z<V)break;var K=z-V,M=d-V;r.push(T(R(V+K%M,0))),z=I(K/M)}r.push(T(R(z,0))),a=N(o,D,m==y),o=0,++m}}}catch(e){_=!0,k=e}finally{try{!F&&q.return&&q.return()}finally{if(_)throw k}}++o,++n}return r.join("")},k=function(e){return P(e,(function(e){return E.test(e)?F(e.slice(4).toLowerCase()):e}))},U=function(e){return P(e,(function(e){return S.test(e)?"xn--"+_(e):e}))},q={version:"2.1.0",ucs2:{decode:$,encode:function(e){return String.fromCodePoint.apply(String,p(e))}},decode:F,encode:_,toASCII:U,toUnicode:k},L={};function z(e){var r=e.charCodeAt(0);return r<16?"%0"+r.toString(16).toUpperCase():r<128?"%"+r.toString(16).toUpperCase():r<2048?"%"+(r>>6|192).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase():"%"+(r>>12|224).toString(16).toUpperCase()+"%"+(r>>6&63|128).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase()}function H(e){for(var r="",t=0,n=e.length;t<n;){var o=parseInt(e.substr(t+1,2),16);if(o<128)r+=String.fromCharCode(o),t+=3;else if(o>=194&&o<224){if(n-t>=6){var a=parseInt(e.substr(t+4,2),16);r+=String.fromCharCode((31&o)<<6|63&a)}else r+=e.substr(t,6);t+=6}else if(o>=224){if(n-t>=9){var i=parseInt(e.substr(t+4,2),16),s=parseInt(e.substr(t+7,2),16);r+=String.fromCharCode((15&o)<<12|(63&i)<<6|63&s)}else r+=e.substr(t,9);t+=9}else r+=e.substr(t,3),t+=3}return r}function V(e,r){function t(e){var t=H(e);return t.match(r.UNRESERVED)?t:e}return e.scheme&&(e.scheme=String(e.scheme).replace(r.PCT_ENCODED,t).toLowerCase().replace(r.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(r.PCT_ENCODED,t).replace(r.NOT_USERINFO,z).replace(r.PCT_ENCODED,o)),void 0!==e.host&&(e.host=String(e.host).replace(r.PCT_ENCODED,t).toLowerCase().replace(r.NOT_HOST,z).replace(r.PCT_ENCODED,o)),void 0!==e.path&&(e.path=String(e.path).replace(r.PCT_ENCODED,t).replace(e.scheme?r.NOT_PATH:r.NOT_PATH_NOSCHEME,z).replace(r.PCT_ENCODED,o)),void 0!==e.query&&(e.query=String(e.query).replace(r.PCT_ENCODED,t).replace(r.NOT_QUERY,z).replace(r.PCT_ENCODED,o)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(r.PCT_ENCODED,t).replace(r.NOT_FRAGMENT,z).replace(r.PCT_ENCODED,o)),e}function K(e){return e.replace(/^0*(.*)/,"$1")||"0"}function M(e,r){var t=e.match(r.IPV4ADDRESS)||[],n=l(t,2)[1];return n?n.split(".").map(K).join("."):e}function Z(e,r){var t=e.match(r.IPV6ADDRESS)||[],n=l(t,3),o=n[1],a=n[2];if(o){for(var i=o.toLowerCase().split("::").reverse(),s=l(i,2),c=s[0],u=s[1],p=u?u.split(":").map(K):[],f=c.split(":").map(K),d=r.IPV4ADDRESS.test(f[f.length-1]),h=d?7:8,v=f.length-h,y=Array(h),m=0;m<h;++m)y[m]=p[m]||f[v+m]||"";d&&(y[h-1]=M(y[h-1],r));var g=y.reduce((function(e,r,t){if(!r||"0"===r){var n=e[e.length-1];n&&n.index+n.length===t?n.length++:e.push({index:t,length:1})}return e}),[]).sort((function(e,r){return r.length-e.length}))[0],b=void 0;if(g&&g.length>1){var w=y.slice(0,g.index),E=y.slice(g.index+g.length);b=w.join(":")+"::"+E.join(":")}else b=y.join(":");return a&&(b+="%"+a),b}return e}var J=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,B=void 0==="".match(/(){0}/)[1];function G(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={},n=!1!==r.iri?u:c;"suffix"===r.reference&&(e=(r.scheme?r.scheme+":":"")+"//"+e);var o=e.match(J);if(o){B?(t.scheme=o[1],t.userinfo=o[3],t.host=o[4],t.port=parseInt(o[5],10),t.path=o[6]||"",t.query=o[7],t.fragment=o[8],isNaN(t.port)&&(t.port=o[5])):(t.scheme=o[1]||void 0,t.userinfo=-1!==e.indexOf("@")?o[3]:void 0,t.host=-1!==e.indexOf("//")?o[4]:void 0,t.port=parseInt(o[5],10),t.path=o[6]||"",t.query=-1!==e.indexOf("?")?o[7]:void 0,t.fragment=-1!==e.indexOf("#")?o[8]:void 0,isNaN(t.port)&&(t.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?o[4]:void 0)),t.host&&(t.host=Z(M(t.host,n),n)),void 0!==t.scheme||void 0!==t.userinfo||void 0!==t.host||void 0!==t.port||t.path||void 0!==t.query?void 0===t.scheme?t.reference="relative":void 0===t.fragment?t.reference="absolute":t.reference="uri":t.reference="same-document",r.reference&&"suffix"!==r.reference&&r.reference!==t.reference&&(t.error=t.error||"URI is not a "+r.reference+" reference.");var a=L[(r.scheme||t.scheme||"").toLowerCase()];if(r.unicodeSupport||a&&a.unicodeSupport)V(t,n);else{if(t.host&&(r.domainHost||a&&a.domainHost))try{t.host=q.toASCII(t.host.replace(n.PCT_ENCODED,H).toLowerCase())}catch(e){t.error=t.error||"Host's domain name can not be converted to ASCII via punycode: "+e}V(t,c)}a&&a.parse&&a.parse(t,r)}else t.error=t.error||"URI can not be parsed.";return t}function W(e,r){var t=!1!==r.iri?u:c,n=[];return void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host&&n.push(Z(M(String(e.host),t),t).replace(t.IPV6ADDRESS,(function(e,r,t){return"["+r+(t?"%25"+t:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0}var Q=/^\.\.?\//,Y=/^\/\.(\/|$)/,X=/^\/\.\.(\/|$)/,ee=/^\/?(?:.|\n)*?(?=\/|$)/;function re(e){for(var r=[];e.length;)if(e.match(Q))e=e.replace(Q,"");else if(e.match(Y))e=e.replace(Y,"/");else if(e.match(X))e=e.replace(X,"/"),r.pop();else if("."===e||".."===e)e="";else{var t=e.match(ee);if(!t)throw new Error("Unexpected dot segment condition");var n=t[0];e=e.slice(n.length),r.push(n)}return r.join("")}function te(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=r.iri?u:c,n=[],o=L[(r.scheme||e.scheme||"").toLowerCase()];if(o&&o.serialize&&o.serialize(e,r),e.host)if(t.IPV6ADDRESS.test(e.host));else if(r.domainHost||o&&o.domainHost)try{e.host=r.iri?q.toUnicode(e.host):q.toASCII(e.host.replace(t.PCT_ENCODED,H).toLowerCase())}catch(t){e.error=e.error||"Host's domain name can not be converted to "+(r.iri?"Unicode":"ASCII")+" via punycode: "+t}V(e,t),"suffix"!==r.reference&&e.scheme&&(n.push(e.scheme),n.push(":"));var a=W(e,r);if(void 0!==a&&("suffix"!==r.reference&&n.push("//"),n.push(a),e.path&&"/"!==e.path.charAt(0)&&n.push("/")),void 0!==e.path){var i=e.path;r.absolutePath||o&&o.absolutePath||(i=re(i)),void 0===a&&(i=i.replace(/^\/\//,"/%2F")),n.push(i)}return void 0!==e.query&&(n.push("?"),n.push(e.query)),void 0!==e.fragment&&(n.push("#"),n.push(e.fragment)),n.join("")}function ne(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};return arguments[3]||(e=G(te(e,t),t),r=G(te(r,t),t)),!(t=t||{}).tolerant&&r.scheme?(n.scheme=r.scheme,n.userinfo=r.userinfo,n.host=r.host,n.port=r.port,n.path=re(r.path||""),n.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(n.userinfo=r.userinfo,n.host=r.host,n.port=r.port,n.path=re(r.path||""),n.query=r.query):(r.path?("/"===r.path.charAt(0)?n.path=re(r.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+r.path:n.path=r.path:n.path="/"+r.path,n.path=re(n.path)),n.query=r.query):(n.path=e.path,void 0!==r.query?n.query=r.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=r.fragment,n}function oe(e,r,t){var n=i({scheme:"null"},t);return te(ne(G(e,n),G(r,n),n,!0),n)}function ae(e,r){return"string"==typeof e?e=te(G(e,r),r):"object"===n(e)&&(e=G(te(e,r),r)),e}function ie(e,r,t){return"string"==typeof e?e=te(G(e,t),t):"object"===n(e)&&(e=te(e,t)),"string"==typeof r?r=te(G(r,t),t):"object"===n(r)&&(r=te(r,t)),e===r}function se(e,r){return e&&e.toString().replace(r&&r.iri?u.ESCAPE:c.ESCAPE,z)}function ce(e,r){return e&&e.toString().replace(r&&r.iri?u.PCT_ENCODED:c.PCT_ENCODED,H)}var ue={scheme:"http",domainHost:!0,parse:function(e,r){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,r){var t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},le={scheme:"https",domainHost:ue.domainHost,parse:ue.parse,serialize:ue.serialize};function pe(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var fe={scheme:"ws",domainHost:!0,parse:function(e,r){var t=e;return t.secure=pe(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t},serialize:function(e,r){if(e.port!==(pe(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var t=e.resourceName.split("?"),n=l(t,2),o=n[0],a=n[1];e.path=o&&"/"!==o?o:void 0,e.query=a,e.resourceName=void 0}return e.fragment=void 0,e}},de={scheme:"wss",domainHost:fe.domainHost,parse:fe.parse,serialize:fe.serialize},he={},ve="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ye="[0-9A-Fa-f]",me=t(t("%[EFef]"+ye+"%"+ye+ye+"%"+ye+ye)+"|"+t("%[89A-Fa-f]"+ye+"%"+ye+ye)+"|"+t("%"+ye+ye)),ge="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",be=r("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),we="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Ee=new RegExp(ve,"g"),Se=new RegExp(me,"g"),Ce=new RegExp(r("[^]",ge,"[\\.]",'[\\"]',be),"g"),Oe=new RegExp(r("[^]",ve,we),"g"),Ae=Oe;function Ie(e){var r=H(e);return r.match(Ee)?r:e}var Te={scheme:"mailto",parse:function(e,r){var t=e,n=t.to=t.path?t.path.split(","):[];if(t.path=void 0,t.query){for(var o=!1,a={},i=t.query.split("&"),s=0,c=i.length;s<c;++s){var u=i[s].split("=");switch(u[0]){case"to":for(var l=u[1].split(","),p=0,f=l.length;p<f;++p)n.push(l[p]);break;case"subject":t.subject=ce(u[1],r);break;case"body":t.body=ce(u[1],r);break;default:o=!0,a[ce(u[0],r)]=ce(u[1],r)}}o&&(t.headers=a)}t.query=void 0;for(var d=0,h=n.length;d<h;++d){var v=n[d].split("@");if(v[0]=ce(v[0]),r.unicodeSupport)v[1]=ce(v[1],r).toLowerCase();else try{v[1]=q.toASCII(ce(v[1],r).toLowerCase())}catch(e){t.error=t.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}n[d]=v.join("@")}return t},serialize:function(e,r){var t=e,n=a(e.to);if(n){for(var i=0,s=n.length;i<s;++i){var c=String(n[i]),u=c.lastIndexOf("@"),l=c.slice(0,u).replace(Se,Ie).replace(Se,o).replace(Ce,z),p=c.slice(u+1);try{p=r.iri?q.toUnicode(p):q.toASCII(ce(p,r).toLowerCase())}catch(e){t.error=t.error||"Email address's domain name can not be converted to "+(r.iri?"Unicode":"ASCII")+" via punycode: "+e}n[i]=l+"@"+p}t.path=n.join(",")}var f=e.headers=e.headers||{};e.subject&&(f.subject=e.subject),e.body&&(f.body=e.body);var d=[];for(var h in f)f[h]!==he[h]&&d.push(h.replace(Se,Ie).replace(Se,o).replace(Oe,z)+"="+f[h].replace(Se,Ie).replace(Se,o).replace(Ae,z));return d.length&&(t.query=d.join("&")),t}},je=/^([^\:]+)\:(.*)/,xe={scheme:"urn",parse:function(e,r){var t=e.path&&e.path.match(je),n=e;if(t){var o=r.scheme||n.scheme||"urn",a=t[1].toLowerCase(),i=t[2],s=o+":"+(r.nid||a),c=L[s];n.nid=a,n.nss=i,n.path=void 0,c&&(n=c.parse(n,r))}else n.error=n.error||"URN can not be parsed.";return n},serialize:function(e,r){var t=r.scheme||e.scheme||"urn",n=e.nid,o=t+":"+(r.nid||n),a=L[o];a&&(e=a.serialize(e,r));var i=e,s=e.nss;return i.path=(n||r.nid)+":"+s,i}},Pe=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,$e={scheme:"urn:uuid",parse:function(e,r){var t=e;return t.uuid=t.nss,t.nss=void 0,r.tolerant||t.uuid&&t.uuid.match(Pe)||(t.error=t.error||"UUID is not valid."),t},serialize:function(e,r){var t=e;return t.nss=(e.uuid||"").toLowerCase(),t}};L[ue.scheme]=ue,L[le.scheme]=le,L[fe.scheme]=fe,L[de.scheme]=de,L[Te.scheme]=Te,L[xe.scheme]=xe,L[$e.scheme]=$e,e.SCHEMES=L,e.pctEncChar=z,e.pctDecChars=H,e.parse=G,e.removeDotSegments=re,e.serialize=te,e.resolveComponents=ne,e.resolve=oe,e.normalize=ae,e.equal=ie,e.escapeComponent=se,e.unescapeComponent=ce,Object.defineProperty(e,"__esModule",{value:!0})}(r)}));(o=a)&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")&&o.default;const i={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var s={jsonTypeOf:(e,r)=>i[r](e),resolveUrl:(e,r)=>{const t=a.resolve(e,r,{iri:!0});if(a.resolve(e,"",{iri:!0})&&"file"===a.parse(t).scheme&&"file"!==a.parse(e).scheme)throw Error(`Can't access file '${t}' resource from network context '${e}'`);return t},urlFragment:e=>a.unescapeComponent(a.parse(e).fragment)||"",pathRelative:(e,r)=>{if(e===r)return"";let t=1;const n=e.length-1,o=r.length-t,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==r.charCodeAt(t+s))break;47===n&&(i=s)}if(o>a){if(47===r.charCodeAt(t+s))return r.slice(t+s+1);if(0===s)return r.slice(t+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return t+=i,c.length>0?`${c}${r.slice(t,r.length)}`:(47===r.charCodeAt(t)&&++t,r.slice(t,r.length))}};const c=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(v)},u=(e,r,t,n)=>{if(0===e.length)return t;if(e.length>1){const o=e.shift();return{...r,[o]:u(e,m(r,o,n),t,d(o,n))}}if(Array.isArray(r)){const n=[...r];return n[y(r,e[0])]=t,n}return"object"==typeof r&&null!==r?{...r,[e[0]]:t}:m(r,e[0],n)},l=(e,r,t,n)=>{if(0!==e.length)if(1!==e.length||g(r)){const o=e.shift();l(e,m(r,o,n),t,d(o,n))}else{r[y(r,e[0])]=t}},p=(e,r,t)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=m(r,n,t);return{...r,[n]:p(e,o,d(n,t))}}if(Array.isArray(r))return r.filter(((r,t)=>t!=e[0]));if("object"==typeof r&&null!==r){const{[e[0]]:t,...n}=r;return n}return m(r,e[0],t)}},f=(e,r,t)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=m(r,n,t);f(e,o,d(n,t))}else Array.isArray(r)?r.splice(e[0],1):"object"==typeof r&&null!==r?delete r[e[0]]:m(r,e[0],t)},d=e(((e,r)=>r+"/"+h(e))),h=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),v=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),y=(e,r)=>Array.isArray(e)&&"-"===r?e.length:r,m=(e,r,t="")=>{if(void 0===e)throw TypeError(`Value at '${t}' is undefined and does not have property '${r}'`);if(null===e)throw TypeError(`Value at '${t}' is null and does not have property '${r}'`);if(g(e))throw TypeError(`Value at '${t}' is a ${typeof e} and does not have property '${r}'`);return e[y(e,r)]},g=e=>null===e||"object"!=typeof e;var b={nil:"",append:d,get:(e,r)=>{const t=c(e),n=e=>t.reduce((([e,r],t)=>[m(e,t,r),d(t,r)]),[e,""])[0];return void 0===r?n:n(r)},set:(r,t,n)=>{const o=c(r),a=e(((e,r)=>u(o,e,r,"")));return void 0===t?a:a(t,n)},assign:(r,t,n)=>{const o=c(r),a=e(((e,r)=>l(o,e,r,"")));return void 0===t?a:a(t,n)},unset:(e,r)=>{const t=c(e),n=e=>p(t,e,"");return void 0===r?n:n(r)},remove:(e,r)=>{const t=c(e),n=e=>f(t,e,"");return void 0===r?n:n(r)}};b.nil,b.append,b.get,b.set,b.assign,b.unset,b.remove;const w=Symbol("$__value"),E=Symbol("$__href");var S={cons:(e,r)=>Object.freeze({[E]:e,[w]:r}),isReference:e=>e&&void 0!==e[E],href:e=>e[E],value:e=>e[w]};const{resolveUrl:C,jsonTypeOf:O}=s,A=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),I=e=>S.isReference(e.value)?S.value(e.value):e.value,T=e(((e,r)=>O(I(e),r))),j=(e,r)=>Object.freeze({...r,pointer:b.append(e,r.pointer),value:I(r)[e]}),x=e(((e,r)=>I(r).map(((t,n,o,a)=>e(j(n,r),n,o,a))))),P=e(((e,r)=>I(r).map(((e,t,n,o)=>j(t,r))).filter(((r,t,n,o)=>e(r,t,n,o))))),$=e(((e,r,t)=>I(t).reduce(((r,n,o)=>e(r,j(o,t),o)),r))),D=e(((e,r)=>I(r).every(((t,n,o,a)=>e(j(n,r),n,o,a))))),R=e(((e,r)=>I(r).some(((t,n,o,a)=>e(j(n,r),n,o,a)))));var N={nil:A,cons:(e,r="")=>Object.freeze({...A,id:C(r,""),instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:I,has:(e,r)=>e in I(r),typeOf:T,step:j,entries:e=>Object.keys(I(e)).map((r=>[r,j(r,e)])),keys:e=>Object.keys(I(e)),map:x,filter:P,reduce:$,every:D,some:R,length:e=>I(e).length},F=async e=>Object.entries(await e),_=e((async(e,r)=>(await r).map(e))),k=e((async(e,r,t)=>(await t).reduce((async(r,t)=>e(await r,t)),r))),U=e((async(e,r,t={})=>k((async(r,t)=>await e(t)?r.concat([t]):r),[],r,t))),q=e((async(e,r)=>{const t=await _(e,r);return(await Promise.all(t)).some((e=>e))})),L=e((async(e,r)=>{const t=await _(e,r);return(await Promise.all(t)).every((e=>e))})),z=e(((e,r)=>e.reduce((async(e,r)=>r(await e)),r))),H={entries:F,map:_,filter:U,reduce:k,some:q,every:L,pipeline:z,all:e=>Promise.all(e),allValues:e=>z([F,k((async(e,[r,t])=>(e[r]=await t,e)),{})],e)};H.entries,H.map,H.filter,H.reduce,H.some,H.every,H.pipeline,H.all,H.allValues;var V=fetch,K=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,M=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,Z=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,J=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,G=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,W=function(e){if(!e)throw new TypeError("argument string is required");var r="object"==typeof e?function(e){var r;"function"==typeof e.getHeader?r=e.getHeader("content-type"):"object"==typeof e.headers&&(r=e.headers&&e.headers["content-type"]);if("string"!=typeof r)throw new TypeError("content-type header is missing from object");return r}(e):e;if("string"!=typeof r)throw new TypeError("argument string is required to be a string");var t=r.indexOf(";"),n=-1!==t?r.substr(0,t).trim():r.trim();if(!G.test(n))throw new TypeError("invalid media type");var o=new Y(n.toLowerCase());if(-1!==t){var a,i,s;for(K.lastIndex=t;i=K.exec(r);){if(i.index!==t)throw new TypeError("invalid parameter format");t+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(J,"$1")),o.parameters[a]=s}if(t!==r.length)throw new TypeError("invalid parameter format")}return o}; | ||
!function(e){function r(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];if(r.length>1){r[0]=r[0].slice(0,-1);for(var n=r.length-1,o=1;o<n;++o)r[o]=r[o].slice(1,-1);return r[n]=r[n].slice(1),r.join("")}return r[0]}function t(e){return"(?:"+e+")"}function n(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function o(e){return e.toUpperCase()}function a(e){return null!=e?e instanceof Array?e:"number"!=typeof e.length||e.split||e.setInterval||e.call?[e]:Array.prototype.slice.call(e):[]}function i(e,r){var t=e;if(r)for(var n in r)t[n]=r[n];return t}function s(e){var n="[A-Za-z]",o="[0-9]",a=r(o,"[A-Fa-f]"),i=t(t("%[EFef]"+a+"%"+a+a+"%"+a+a)+"|"+t("%[89A-Fa-f]"+a+"%"+a+a)+"|"+t("%"+a+a)),s="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",c=r("[\\:\\/\\?\\#\\[\\]\\@]",s),u=e?"[\\uE000-\\uF8FF]":"[]",l=r(n,o,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]");t(n+r(n,o,"[\\+\\-\\.]")+"*"),t(t(i+"|"+r(l,s,"[\\:]"))+"*");var p=t(t("25[0-5]")+"|"+t("2[0-4]"+o)+"|"+t("1"+o+o)+"|"+t("0?[1-9]"+o)+"|0?0?"+o),f=t(p+"\\."+p+"\\."+p+"\\."+p),d=t(a+"{1,4}"),h=t(t(d+"\\:"+d)+"|"+f),v=t(t(d+"\\:")+"{6}"+h),y=t("\\:\\:"+t(d+"\\:")+"{5}"+h),m=t(t(d)+"?\\:\\:"+t(d+"\\:")+"{4}"+h),g=t(t(t(d+"\\:")+"{0,1}"+d)+"?\\:\\:"+t(d+"\\:")+"{3}"+h),b=t(t(t(d+"\\:")+"{0,2}"+d)+"?\\:\\:"+t(d+"\\:")+"{2}"+h),w=t(t(t(d+"\\:")+"{0,3}"+d)+"?\\:\\:"+d+"\\:"+h),E=t(t(t(d+"\\:")+"{0,4}"+d)+"?\\:\\:"+h),S=t(t(t(d+"\\:")+"{0,5}"+d)+"?\\:\\:"+d),C=t(t(t(d+"\\:")+"{0,6}"+d)+"?\\:\\:"),O=t([v,y,m,g,b,w,E,S,C].join("|")),A=t(t(l+"|"+i)+"+");t("[vV]"+a+"+\\."+r(l,s,"[\\:]")+"+"),t(t(i+"|"+r(l,s))+"*");var I=t(i+"|"+r(l,s,"[\\:\\@]"));return t(t(i+"|"+r(l,s,"[\\@]"))+"+"),t(t(I+"|"+r("[\\/\\?]",u))+"*"),{NOT_SCHEME:new RegExp(r("[^]",n,o,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(r("[^\\%\\:]",l,s),"g"),NOT_HOST:new RegExp(r("[^\\%\\[\\]\\:]",l,s),"g"),NOT_PATH:new RegExp(r("[^\\%\\/\\:\\@]",l,s),"g"),NOT_PATH_NOSCHEME:new RegExp(r("[^\\%\\/\\@]",l,s),"g"),NOT_QUERY:new RegExp(r("[^\\%]",l,s,"[\\:\\@\\/\\?]",u),"g"),NOT_FRAGMENT:new RegExp(r("[^\\%]",l,s,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(r("[^]",l,s),"g"),UNRESERVED:new RegExp(l,"g"),OTHER_CHARS:new RegExp(r("[^\\%]",l,c),"g"),PCT_ENCODED:new RegExp(i,"g"),IPV4ADDRESS:new RegExp("^("+f+")$"),IPV6ADDRESS:new RegExp("^\\[?("+O+")"+t(t("\\%25|\\%(?!"+a+"{2})")+"("+A+")")+"?\\]?$")}}var c=s(!1),u=s(!0),l=function(){function e(e,r){var t=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(t.push(i.value),!r||t.length!==r);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return t}return function(r,t){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return e(r,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(e){if(Array.isArray(e)){for(var r=0,t=Array(e.length);r<e.length;r++)t[r]=e[r];return t}return Array.from(e)},f=2147483647,d=36,h=1,v=26,y=38,m=700,g=72,b=128,w="-",E=/^xn--/,S=/[^\0-\x7E]/,C=/[\x2E\u3002\uFF0E\uFF61]/g,O={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},A=d-h,I=Math.floor,T=String.fromCharCode;function j(e){throw new RangeError(O[e])}function x(e,r){for(var t=[],n=e.length;n--;)t[n]=r(e[n]);return t}function P(e,r){var t=e.split("@"),n="";return t.length>1&&(n=t[0]+"@",e=t[1]),n+x((e=e.replace(C,".")).split("."),r).join(".")}function $(e){for(var r=[],t=0,n=e.length;t<n;){var o=e.charCodeAt(t++);if(o>=55296&&o<=56319&&t<n){var a=e.charCodeAt(t++);56320==(64512&a)?r.push(((1023&o)<<10)+(1023&a)+65536):(r.push(o),t--)}else r.push(o)}return r}var D=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:d},R=function(e,r){return e+22+75*(e<26)-((0!=r)<<5)},N=function(e,r,t){var n=0;for(e=t?I(e/m):e>>1,e+=I(e/r);e>A*v>>1;n+=d)e=I(e/A);return I(n+(A+1)*e/(e+y))},F=function(e){var r=[],t=e.length,n=0,o=b,a=g,i=e.lastIndexOf(w);i<0&&(i=0);for(var s=0;s<i;++s)e.charCodeAt(s)>=128&&j("not-basic"),r.push(e.charCodeAt(s));for(var c=i>0?i+1:0;c<t;){for(var u=n,l=1,p=d;;p+=d){c>=t&&j("invalid-input");var y=D(e.charCodeAt(c++));(y>=d||y>I((f-n)/l))&&j("overflow"),n+=y*l;var m=p<=a?h:p>=a+v?v:p-a;if(y<m)break;var E=d-m;l>I(f/E)&&j("overflow"),l*=E}var S=r.length+1;a=N(n-u,S,0==u),I(n/S)>f-o&&j("overflow"),o+=I(n/S),n%=S,r.splice(n++,0,o)}return String.fromCodePoint.apply(String,r)},_=function(e){var r=[],t=(e=$(e)).length,n=b,o=0,a=g,i=!0,s=!1,c=void 0;try{for(var u,l=e[Symbol.iterator]();!(i=(u=l.next()).done);i=!0){var p=u.value;p<128&&r.push(T(p))}}catch(e){s=!0,c=e}finally{try{!i&&l.return&&l.return()}finally{if(s)throw c}}var y=r.length,m=y;for(y&&r.push(w);m<t;){var E=f,S=!0,C=!1,O=void 0;try{for(var A,x=e[Symbol.iterator]();!(S=(A=x.next()).done);S=!0){var P=A.value;P>=n&&P<E&&(E=P)}}catch(e){C=!0,O=e}finally{try{!S&&x.return&&x.return()}finally{if(C)throw O}}var D=m+1;E-n>I((f-o)/D)&&j("overflow"),o+=(E-n)*D,n=E;var F=!0,_=!1,k=void 0;try{for(var U,q=e[Symbol.iterator]();!(F=(U=q.next()).done);F=!0){var L=U.value;if(L<n&&++o>f&&j("overflow"),L==n){for(var z=o,H=d;;H+=d){var V=H<=a?h:H>=a+v?v:H-a;if(z<V)break;var M=z-V,K=d-V;r.push(T(R(V+M%K,0))),z=I(M/K)}r.push(T(R(z,0))),a=N(o,D,m==y),o=0,++m}}}catch(e){_=!0,k=e}finally{try{!F&&q.return&&q.return()}finally{if(_)throw k}}++o,++n}return r.join("")},k=function(e){return P(e,(function(e){return E.test(e)?F(e.slice(4).toLowerCase()):e}))},U=function(e){return P(e,(function(e){return S.test(e)?"xn--"+_(e):e}))},q={version:"2.1.0",ucs2:{decode:$,encode:function(e){return String.fromCodePoint.apply(String,p(e))}},decode:F,encode:_,toASCII:U,toUnicode:k},L={};function z(e){var r=e.charCodeAt(0);return r<16?"%0"+r.toString(16).toUpperCase():r<128?"%"+r.toString(16).toUpperCase():r<2048?"%"+(r>>6|192).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase():"%"+(r>>12|224).toString(16).toUpperCase()+"%"+(r>>6&63|128).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase()}function H(e){for(var r="",t=0,n=e.length;t<n;){var o=parseInt(e.substr(t+1,2),16);if(o<128)r+=String.fromCharCode(o),t+=3;else if(o>=194&&o<224){if(n-t>=6){var a=parseInt(e.substr(t+4,2),16);r+=String.fromCharCode((31&o)<<6|63&a)}else r+=e.substr(t,6);t+=6}else if(o>=224){if(n-t>=9){var i=parseInt(e.substr(t+4,2),16),s=parseInt(e.substr(t+7,2),16);r+=String.fromCharCode((15&o)<<12|(63&i)<<6|63&s)}else r+=e.substr(t,9);t+=9}else r+=e.substr(t,3),t+=3}return r}function V(e,r){function t(e){var t=H(e);return t.match(r.UNRESERVED)?t:e}return e.scheme&&(e.scheme=String(e.scheme).replace(r.PCT_ENCODED,t).toLowerCase().replace(r.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(r.PCT_ENCODED,t).replace(r.NOT_USERINFO,z).replace(r.PCT_ENCODED,o)),void 0!==e.host&&(e.host=String(e.host).replace(r.PCT_ENCODED,t).toLowerCase().replace(r.NOT_HOST,z).replace(r.PCT_ENCODED,o)),void 0!==e.path&&(e.path=String(e.path).replace(r.PCT_ENCODED,t).replace(e.scheme?r.NOT_PATH:r.NOT_PATH_NOSCHEME,z).replace(r.PCT_ENCODED,o)),void 0!==e.query&&(e.query=String(e.query).replace(r.PCT_ENCODED,t).replace(r.NOT_QUERY,z).replace(r.PCT_ENCODED,o)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(r.PCT_ENCODED,t).replace(r.NOT_FRAGMENT,z).replace(r.PCT_ENCODED,o)),e}function M(e){return e.replace(/^0*(.*)/,"$1")||"0"}function K(e,r){var t=e.match(r.IPV4ADDRESS)||[],n=l(t,2)[1];return n?n.split(".").map(M).join("."):e}function Z(e,r){var t=e.match(r.IPV6ADDRESS)||[],n=l(t,3),o=n[1],a=n[2];if(o){for(var i=o.toLowerCase().split("::").reverse(),s=l(i,2),c=s[0],u=s[1],p=u?u.split(":").map(M):[],f=c.split(":").map(M),d=r.IPV4ADDRESS.test(f[f.length-1]),h=d?7:8,v=f.length-h,y=Array(h),m=0;m<h;++m)y[m]=p[m]||f[v+m]||"";d&&(y[h-1]=K(y[h-1],r));var g=y.reduce((function(e,r,t){if(!r||"0"===r){var n=e[e.length-1];n&&n.index+n.length===t?n.length++:e.push({index:t,length:1})}return e}),[]).sort((function(e,r){return r.length-e.length}))[0],b=void 0;if(g&&g.length>1){var w=y.slice(0,g.index),E=y.slice(g.index+g.length);b=w.join(":")+"::"+E.join(":")}else b=y.join(":");return a&&(b+="%"+a),b}return e}var J=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,B=void 0==="".match(/(){0}/)[1];function G(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={},n=!1!==r.iri?u:c;"suffix"===r.reference&&(e=(r.scheme?r.scheme+":":"")+"//"+e);var o=e.match(J);if(o){B?(t.scheme=o[1],t.userinfo=o[3],t.host=o[4],t.port=parseInt(o[5],10),t.path=o[6]||"",t.query=o[7],t.fragment=o[8],isNaN(t.port)&&(t.port=o[5])):(t.scheme=o[1]||void 0,t.userinfo=-1!==e.indexOf("@")?o[3]:void 0,t.host=-1!==e.indexOf("//")?o[4]:void 0,t.port=parseInt(o[5],10),t.path=o[6]||"",t.query=-1!==e.indexOf("?")?o[7]:void 0,t.fragment=-1!==e.indexOf("#")?o[8]:void 0,isNaN(t.port)&&(t.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?o[4]:void 0)),t.host&&(t.host=Z(K(t.host,n),n)),void 0!==t.scheme||void 0!==t.userinfo||void 0!==t.host||void 0!==t.port||t.path||void 0!==t.query?void 0===t.scheme?t.reference="relative":void 0===t.fragment?t.reference="absolute":t.reference="uri":t.reference="same-document",r.reference&&"suffix"!==r.reference&&r.reference!==t.reference&&(t.error=t.error||"URI is not a "+r.reference+" reference.");var a=L[(r.scheme||t.scheme||"").toLowerCase()];if(r.unicodeSupport||a&&a.unicodeSupport)V(t,n);else{if(t.host&&(r.domainHost||a&&a.domainHost))try{t.host=q.toASCII(t.host.replace(n.PCT_ENCODED,H).toLowerCase())}catch(e){t.error=t.error||"Host's domain name can not be converted to ASCII via punycode: "+e}V(t,c)}a&&a.parse&&a.parse(t,r)}else t.error=t.error||"URI can not be parsed.";return t}function W(e,r){var t=!1!==r.iri?u:c,n=[];return void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host&&n.push(Z(K(String(e.host),t),t).replace(t.IPV6ADDRESS,(function(e,r,t){return"["+r+(t?"%25"+t:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0}var Q=/^\.\.?\//,Y=/^\/\.(\/|$)/,X=/^\/\.\.(\/|$)/,ee=/^\/?(?:.|\n)*?(?=\/|$)/;function re(e){for(var r=[];e.length;)if(e.match(Q))e=e.replace(Q,"");else if(e.match(Y))e=e.replace(Y,"/");else if(e.match(X))e=e.replace(X,"/"),r.pop();else if("."===e||".."===e)e="";else{var t=e.match(ee);if(!t)throw new Error("Unexpected dot segment condition");var n=t[0];e=e.slice(n.length),r.push(n)}return r.join("")}function te(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=r.iri?u:c,n=[],o=L[(r.scheme||e.scheme||"").toLowerCase()];if(o&&o.serialize&&o.serialize(e,r),e.host)if(t.IPV6ADDRESS.test(e.host));else if(r.domainHost||o&&o.domainHost)try{e.host=r.iri?q.toUnicode(e.host):q.toASCII(e.host.replace(t.PCT_ENCODED,H).toLowerCase())}catch(t){e.error=e.error||"Host's domain name can not be converted to "+(r.iri?"Unicode":"ASCII")+" via punycode: "+t}V(e,t),"suffix"!==r.reference&&e.scheme&&(n.push(e.scheme),n.push(":"));var a=W(e,r);if(void 0!==a&&("suffix"!==r.reference&&n.push("//"),n.push(a),e.path&&"/"!==e.path.charAt(0)&&n.push("/")),void 0!==e.path){var i=e.path;r.absolutePath||o&&o.absolutePath||(i=re(i)),void 0===a&&(i=i.replace(/^\/\//,"/%2F")),n.push(i)}return void 0!==e.query&&(n.push("?"),n.push(e.query)),void 0!==e.fragment&&(n.push("#"),n.push(e.fragment)),n.join("")}function ne(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};return arguments[3]||(e=G(te(e,t),t),r=G(te(r,t),t)),!(t=t||{}).tolerant&&r.scheme?(n.scheme=r.scheme,n.userinfo=r.userinfo,n.host=r.host,n.port=r.port,n.path=re(r.path||""),n.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(n.userinfo=r.userinfo,n.host=r.host,n.port=r.port,n.path=re(r.path||""),n.query=r.query):(r.path?("/"===r.path.charAt(0)?n.path=re(r.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+r.path:n.path=r.path:n.path="/"+r.path,n.path=re(n.path)),n.query=r.query):(n.path=e.path,void 0!==r.query?n.query=r.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=r.fragment,n}function oe(e,r,t){var n=i({scheme:"null"},t);return te(ne(G(e,n),G(r,n),n,!0),n)}function ae(e,r){return"string"==typeof e?e=te(G(e,r),r):"object"===n(e)&&(e=G(te(e,r),r)),e}function ie(e,r,t){return"string"==typeof e?e=te(G(e,t),t):"object"===n(e)&&(e=te(e,t)),"string"==typeof r?r=te(G(r,t),t):"object"===n(r)&&(r=te(r,t)),e===r}function se(e,r){return e&&e.toString().replace(r&&r.iri?u.ESCAPE:c.ESCAPE,z)}function ce(e,r){return e&&e.toString().replace(r&&r.iri?u.PCT_ENCODED:c.PCT_ENCODED,H)}var ue={scheme:"http",domainHost:!0,parse:function(e,r){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,r){var t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},le={scheme:"https",domainHost:ue.domainHost,parse:ue.parse,serialize:ue.serialize};function pe(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var fe={scheme:"ws",domainHost:!0,parse:function(e,r){var t=e;return t.secure=pe(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t},serialize:function(e,r){if(e.port!==(pe(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var t=e.resourceName.split("?"),n=l(t,2),o=n[0],a=n[1];e.path=o&&"/"!==o?o:void 0,e.query=a,e.resourceName=void 0}return e.fragment=void 0,e}},de={scheme:"wss",domainHost:fe.domainHost,parse:fe.parse,serialize:fe.serialize},he={},ve="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ye="[0-9A-Fa-f]",me=t(t("%[EFef]"+ye+"%"+ye+ye+"%"+ye+ye)+"|"+t("%[89A-Fa-f]"+ye+"%"+ye+ye)+"|"+t("%"+ye+ye)),ge="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",be=r("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),we="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Ee=new RegExp(ve,"g"),Se=new RegExp(me,"g"),Ce=new RegExp(r("[^]",ge,"[\\.]",'[\\"]',be),"g"),Oe=new RegExp(r("[^]",ve,we),"g"),Ae=Oe;function Ie(e){var r=H(e);return r.match(Ee)?r:e}var Te={scheme:"mailto",parse:function(e,r){var t=e,n=t.to=t.path?t.path.split(","):[];if(t.path=void 0,t.query){for(var o=!1,a={},i=t.query.split("&"),s=0,c=i.length;s<c;++s){var u=i[s].split("=");switch(u[0]){case"to":for(var l=u[1].split(","),p=0,f=l.length;p<f;++p)n.push(l[p]);break;case"subject":t.subject=ce(u[1],r);break;case"body":t.body=ce(u[1],r);break;default:o=!0,a[ce(u[0],r)]=ce(u[1],r)}}o&&(t.headers=a)}t.query=void 0;for(var d=0,h=n.length;d<h;++d){var v=n[d].split("@");if(v[0]=ce(v[0]),r.unicodeSupport)v[1]=ce(v[1],r).toLowerCase();else try{v[1]=q.toASCII(ce(v[1],r).toLowerCase())}catch(e){t.error=t.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}n[d]=v.join("@")}return t},serialize:function(e,r){var t=e,n=a(e.to);if(n){for(var i=0,s=n.length;i<s;++i){var c=String(n[i]),u=c.lastIndexOf("@"),l=c.slice(0,u).replace(Se,Ie).replace(Se,o).replace(Ce,z),p=c.slice(u+1);try{p=r.iri?q.toUnicode(p):q.toASCII(ce(p,r).toLowerCase())}catch(e){t.error=t.error||"Email address's domain name can not be converted to "+(r.iri?"Unicode":"ASCII")+" via punycode: "+e}n[i]=l+"@"+p}t.path=n.join(",")}var f=e.headers=e.headers||{};e.subject&&(f.subject=e.subject),e.body&&(f.body=e.body);var d=[];for(var h in f)f[h]!==he[h]&&d.push(h.replace(Se,Ie).replace(Se,o).replace(Oe,z)+"="+f[h].replace(Se,Ie).replace(Se,o).replace(Ae,z));return d.length&&(t.query=d.join("&")),t}},je=/^([^\:]+)\:(.*)/,xe={scheme:"urn",parse:function(e,r){var t=e.path&&e.path.match(je),n=e;if(t){var o=r.scheme||n.scheme||"urn",a=t[1].toLowerCase(),i=t[2],s=o+":"+(r.nid||a),c=L[s];n.nid=a,n.nss=i,n.path=void 0,c&&(n=c.parse(n,r))}else n.error=n.error||"URN can not be parsed.";return n},serialize:function(e,r){var t=r.scheme||e.scheme||"urn",n=e.nid,o=t+":"+(r.nid||n),a=L[o];a&&(e=a.serialize(e,r));var i=e,s=e.nss;return i.path=(n||r.nid)+":"+s,i}},Pe=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,$e={scheme:"urn:uuid",parse:function(e,r){var t=e;return t.uuid=t.nss,t.nss=void 0,r.tolerant||t.uuid&&t.uuid.match(Pe)||(t.error=t.error||"UUID is not valid."),t},serialize:function(e,r){var t=e;return t.nss=(e.uuid||"").toLowerCase(),t}};L[ue.scheme]=ue,L[le.scheme]=le,L[fe.scheme]=fe,L[de.scheme]=de,L[Te.scheme]=Te,L[xe.scheme]=xe,L[$e.scheme]=$e,e.SCHEMES=L,e.pctEncChar=z,e.pctDecChars=H,e.parse=G,e.removeDotSegments=re,e.serialize=te,e.resolveComponents=ne,e.resolve=oe,e.normalize=ae,e.equal=ie,e.escapeComponent=se,e.unescapeComponent=ce,Object.defineProperty(e,"__esModule",{value:!0})}(r)}));(o=a)&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")&&o.default;const i={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var s={jsonTypeOf:(e,r)=>i[r](e),resolveUrl:(e,r)=>{const t=a.resolve(e,r,{iri:!0});if(a.resolve(e,"",{iri:!0})&&"file"===a.parse(t).scheme&&"file"!==a.parse(e).scheme)throw Error(`Can't access file '${t}' resource from network context '${e}'`);return t},urlFragment:e=>a.unescapeComponent(a.parse(e).fragment)||"",pathRelative:(e,r)=>{if(e===r)return"";let t=1;const n=e.length-1,o=r.length-t,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==r.charCodeAt(t+s))break;47===n&&(i=s)}if(o>a){if(47===r.charCodeAt(t+s))return r.slice(t+s+1);if(0===s)return r.slice(t+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return t+=i,c.length>0?`${c}${r.slice(t,r.length)}`:(47===r.charCodeAt(t)&&++t,r.slice(t,r.length))}};const c=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(v)},u=(e,r,t,n)=>{if(0===e.length)return t;if(e.length>1){const o=e.shift();return{...r,[o]:u(e,m(r,o,n),t,d(o,n))}}if(Array.isArray(r)){const n=[...r];return n[y(r,e[0])]=t,n}return"object"==typeof r&&null!==r?{...r,[e[0]]:t}:m(r,e[0],n)},l=(e,r,t,n)=>{if(0!==e.length)if(1!==e.length||g(r)){const o=e.shift();l(e,m(r,o,n),t,d(o,n))}else{r[y(r,e[0])]=t}},p=(e,r,t)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=m(r,n,t);return{...r,[n]:p(e,o,d(n,t))}}if(Array.isArray(r))return r.filter(((r,t)=>t!=e[0]));if("object"==typeof r&&null!==r){const{[e[0]]:t,...n}=r;return n}return m(r,e[0],t)}},f=(e,r,t)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=m(r,n,t);f(e,o,d(n,t))}else Array.isArray(r)?r.splice(e[0],1):"object"==typeof r&&null!==r?delete r[e[0]]:m(r,e[0],t)},d=e(((e,r)=>r+"/"+h(e))),h=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),v=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),y=(e,r)=>Array.isArray(e)&&"-"===r?e.length:r,m=(e,r,t="")=>{if(void 0===e)throw TypeError(`Value at '${t}' is undefined and does not have property '${r}'`);if(null===e)throw TypeError(`Value at '${t}' is null and does not have property '${r}'`);if(g(e))throw TypeError(`Value at '${t}' is a ${typeof e} and does not have property '${r}'`);return e[y(e,r)]},g=e=>null===e||"object"!=typeof e;var b={nil:"",append:d,get:(e,r)=>{const t=c(e),n=e=>t.reduce((([e,r],t)=>[m(e,t,r),d(t,r)]),[e,""])[0];return void 0===r?n:n(r)},set:(r,t,n)=>{const o=c(r),a=e(((e,r)=>u(o,e,r,"")));return void 0===t?a:a(t,n)},assign:(r,t,n)=>{const o=c(r),a=e(((e,r)=>l(o,e,r,"")));return void 0===t?a:a(t,n)},unset:(e,r)=>{const t=c(e),n=e=>p(t,e,"");return void 0===r?n:n(r)},remove:(e,r)=>{const t=c(e),n=e=>f(t,e,"");return void 0===r?n:n(r)}};b.nil,b.append,b.get,b.set,b.assign,b.unset,b.remove;const w=Symbol("$__value"),E=Symbol("$__href");var S={cons:(e,r)=>Object.freeze({[E]:e,[w]:r}),isReference:e=>e&&void 0!==e[E],href:e=>e[E],value:e=>e[w]};const{resolveUrl:C,jsonTypeOf:O}=s,A=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),I=e=>S.isReference(e.value)?S.value(e.value):e.value,T=e(((e,r)=>O(I(e),r))),j=(e,r)=>Object.freeze({...r,pointer:b.append(e,r.pointer),value:I(r)[e]}),x=e(((e,r)=>I(r).map(((t,n,o,a)=>e(j(n,r),n,o,a))))),P=e(((e,r)=>I(r).map(((e,t,n,o)=>j(t,r))).filter(((r,t,n,o)=>e(r,t,n,o))))),$=e(((e,r,t)=>I(t).reduce(((r,n,o)=>e(r,j(o,t),o)),r))),D=e(((e,r)=>I(r).every(((t,n,o,a)=>e(j(n,r),n,o,a))))),R=e(((e,r)=>I(r).some(((t,n,o,a)=>e(j(n,r),n,o,a)))));var N={nil:A,cons:(e,r="")=>Object.freeze({...A,id:C(r,""),instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:I,has:(e,r)=>e in I(r),typeOf:T,step:j,entries:e=>Object.keys(I(e)).map((r=>[r,j(r,e)])),keys:e=>Object.keys(I(e)),map:x,filter:P,reduce:$,every:D,some:R,length:e=>I(e).length},F=async e=>Object.entries(await e),_=e((async(e,r)=>(await r).map(e))),k=e((async(e,r,t)=>(await t).reduce((async(r,t)=>e(await r,t)),r))),U=e((async(e,r,t={})=>k((async(r,t)=>await e(t)?r.concat([t]):r),[],r,t))),q=e((async(e,r)=>{const t=await _(e,r);return(await Promise.all(t)).some((e=>e))})),L=e((async(e,r)=>{const t=await _(e,r);return(await Promise.all(t)).every((e=>e))})),z=e(((e,r)=>e.reduce((async(e,r)=>r(await e)),r))),H={entries:F,map:_,filter:U,reduce:k,some:q,every:L,pipeline:z,all:e=>Promise.all(e),allValues:e=>z([F,k((async(e,[r,t])=>(e[r]=await t,e)),{})],e)};H.entries,H.map,H.filter,H.reduce,H.some,H.every,H.pipeline,H.all,H.allValues;var V=fetch,M=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,K=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,Z=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,J=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,G=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,W=function(e){if(!e)throw new TypeError("argument string is required");var r="object"==typeof e?function(e){var r;"function"==typeof e.getHeader?r=e.getHeader("content-type"):"object"==typeof e.headers&&(r=e.headers&&e.headers["content-type"]);if("string"!=typeof r)throw new TypeError("content-type header is missing from object");return r}(e):e;if("string"!=typeof r)throw new TypeError("argument string is required to be a string");var t=r.indexOf(";"),n=-1!==t?r.substr(0,t).trim():r.trim();if(!G.test(n))throw new TypeError("invalid media type");var o=new Y(n.toLowerCase());if(-1!==t){var a,i,s;for(M.lastIndex=t;i=M.exec(r);){if(i.index!==t)throw new TypeError("invalid parameter format");t+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(J,"$1")),o.parameters[a]=s}if(t!==r.length)throw new TypeError("invalid parameter format")}return o}; | ||
/*! | ||
@@ -8,3 +8,3 @@ * content-type | ||
* MIT Licensed | ||
*/function Q(e){var r=String(e);if(Z.test(r))return r;if(r.length>0&&!M.test(r))throw new TypeError("invalid parameter value");return'"'+r.replace(B,"\\$1")+'"'}function Y(e){this.parameters=Object.create(null),this.type=e}var X={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var r=e.parameters,t=e.type;if(!t||!G.test(t))throw new TypeError("invalid type");var n=t;if(r&&"object"==typeof r)for(var o,a=Object.keys(r).sort(),i=0;i<a.length;i++){if(o=a[i],!Z.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Q(r[o])}return n},parse:W};const ee={};var re={addPlugin:(e,r)=>{ee[e]=r},parse:e=>{const r=X.parse(e.headers.get("content-type")).type;if(!(r in ee))throw Error(`${e.url} is not a schema. Found a document with media type: ${r}`);return ee[r].parse(e)},getContentType:e=>{for(const r in ee)if(ee[r].matcher(e))return r;return"application/octet-stream"}};const{jsonTypeOf:te,resolveUrl:ne,urlFragment:oe,pathRelative:ae}=s,ie="https://json-schema.org/draft/2019-09/vocab/core",se="https://json-schema.org/draft/2020-12/vocab/core",ce={},ue={},le=(e,r)=>{const t=ue[e];return ce[t]?.[r]},pe={},fe={},de=(e,r="",t="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(r,""),o=ne(e.$schema||t,"");if(!o)throw Error("Couldn't determine schema dialect");if(delete e.$schema,!(o in ue))if(!0===e?.$vocabulary?.[ie]&&o===he(e,n,ie)[0])ue[o]=ie;else if(!0===e?.$vocabulary?.[se]&&o===he(e,n,se)[0])ue[o]=se;else if(o===he(e,n,o)[0])ue[o]=o;else{if(!(o in pe))throw Error(`Couldn't determine JSON Schema version for dialect: '${o}'`);{const e=pe[o];!0===e.vocabulary[ie]?ue[o]=ie:!0===e.vocabulary[se]?ue[o]=se:ue[o]=ue[e.dialectId]}}const[a,i]=he(e,n,ue[o]);if(!a)throw Error("Couldn't determine an identifier for the schema");const s=le(o,"baseToken");delete e[s],n&&(fe[n]=a);const c=le(o,"anchorToken");i&&s===c&&(e[c]=c!==s?encodeURI(i):`#${encodeURI(i)}`);const u={},l=le(o,"recursiveAnchorToken");let p;!0===e[l]&&(u[""]=`${a}#`,e[c]="",delete e[l]);const f=le(o,"vocabularyToken");te(e[f],"object")?(p=e[f],delete e[f]):p={[ue[o]]:!0};const d={"":""};return pe[a]={id:a,dialectId:o,schema:ve(e,a,o,b.nil,d,u),anchors:d,dynamicAnchors:u,vocabulary:p,validated:!1},a},he=(e,r,t)=>{const n=ce[t]?.baseToken,o=ne(r,e[n]||"");return[ne(o,""),oe(o)]},ve=(e,r,t,n,o,a)=>{if(te(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema,""):t,s=le(i,"embeddedToken"),c=le(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ne(r,e[s]);return e[le(i,"baseToken")]=n,de(e,n,t),S.cons(e[s],e)}const u=le(t,"anchorToken"),l=le(t,"dynamicAnchorToken");"string"==typeof e[l]&&(a[e[l]]=`${r}#${encodeURI(n)}`,o[e[l]]=n,delete e[l]);const p=le(t,"embeddedToken");if("string"==typeof e[u]){const r=u!==p?e[u]:e[u].slice(1);o[r]=n,delete e[u]}const f=le(t,"jrefToken");if("string"==typeof e[f])return S.cons(e[f],e);for(const i in e)e[i]=ve(e[i],r,t,b.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ve(e,r,t,b.append(i,n),o,a))):e},ye=e=>pe[fe[e]]||pe[e],me=Object.freeze({id:"",dialectId:void 0,vocabulary:{},pointer:b.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ge=async(e,r=me)=>{const t=ne(Ee(r),e),n=ne(t,""),o=oe(t);if(!(e=>e in pe||e in fe)(n)){const e=await V(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);de(await re.parse(e),n)}const a=ye(n),i="/"!==o[0]?we(a,o):o,s=Object.freeze({...a,pointer:i,value:b.get(i,a.schema)});return be(s)},be=e=>S.isReference(e.value)?ge(S.href(e.value),e):e,we=(e,r)=>{if(!(r in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(r)}'`);return e.anchors[r]},Ee=e=>`${e.id}#${encodeURI(e.pointer)}`,Se=e=>S.isReference(e.value)?S.value(e.value):e.value,Ce=(e,r)=>{const t=ye(r.id),n=Object.freeze({...r,pointer:b.append(e,r.pointer),value:Se(r)[e],validated:t.validated});return be(n)},Oe=e(((e,r)=>H.pipeline([Se,H.map((async(t,n)=>e(await Ce(n,r),n))),H.all],r))),Ae={parentId:"",parentDialect:"",includeEmbedded:!0},Ie=(e,r)=>{if(r.startsWith("file://")){const t=e.slice(7,e.lastIndexOf("/"));return""===e?"":ae(t,r.slice(7))}return r};var Te={setConfig:(e,r,t)=>{ce[e]||(ce[e]={}),ce[e][r]=t},getConfig:le,add:de,get:ge,markValidated:e=>{pe[e].validated=!0},uri:Ee,value:Se,getAnchorPointer:we,typeOf:(e,r)=>te(Se(e),r),has:(e,r)=>e in Se(r),step:Ce,keys:e=>Object.keys(Se(e)),entries:e=>H.pipeline([Se,Object.keys,H.map((async r=>[r,await Ce(r,e)])),H.all],e),map:Oe,length:e=>Se(e).length,toSchema:(e,r={})=>{const t={...Ae,...r},n=JSON.parse(JSON.stringify(e.schema,((r,n)=>{if(!S.isReference(n))return n;const o=S.value(n),a="string"==typeof o.$schema?ne(o.$schema,""):e.dialectId,i=le(a,"embeddedToken");return!t.includeEmbedded&&i in o?void 0:S.value(n)}))),o=le(e.dialectId,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,r])=>{const t=oe(r);b.assign(t,n,{[o]:e,...b.get(t,n)})}));const a=le(e.dialectId,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,r])=>{b.assign(r,n,{[a]:e,...b.get(r,n)})}));const i=le(e.dialectId,"baseToken"),s=Ie(t.parentId,e.id),c=t.parentDialect===e.dialectId?"":e.dialectId;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};Te.setConfig,Te.getConfig,Te.add,Te.get,Te.markValidated,Te.uri,Te.value,Te.getAnchorPointer,Te.typeOf,Te.has,Te.step,Te.keys,Te.entries,Te.map,Te.length,Te.toSchema;class je extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=je;const{resolveUrl:Pe}=s,$e="FLAG",De="BASIC",Re="DETAILED",Ne="VERBOSE";let Fe=Re,_e=!0;re.addPlugin("application/schema+json",{parse:async e=>await e.json(),matcher:e=>e.endsWith(".schema.json")});const ke=async e=>{const r={metaData:{}};return{ast:r,schemaUri:await Me(e,r)}},Ue=e((({ast:e,schemaUri:r},t,o=$e)=>{if(![$e,De,Re,Ne].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",qe(o,a));return Je(r,t,e,{}),n.unsubscribe(i),a[0]})),qe=(e,r)=>{const t=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a,errors:[]};t.push(i)}else if("result.start"===n)t.push(n);else if("result.end"===n){const n=t.pop();for(;"result.start"!==t[t.length-1];){const r=t.pop(),o=[r];e===De&&(o.push(...r.errors),delete r.errors),(e===Ne||e!==$e&&!r.valid)&&n.errors.unshift(...o)}t[t.length-1]=n,r[0]=n}}},Le={},ze=e=>Le[e],He=e=>e in Le,Ve={},Ke={},Me=async(e,r)=>{if(e=await Ze(e),!He(`${e.dialectId}#validate`)){const r=await Te.get(e.dialectId);(Te.getConfig(r.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!r.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(r.vocabulary).forEach((([e,t])=>{if(e in Ve)Object.entries(Ve[e]).forEach((([e,t])=>{((e,r)=>{Le[e]={collectEvaluatedItems:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&new Set,collectEvaluatedProperties:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&[],...r}})(`${r.id}#${e}`,t)}));else if(t)throw Error(`Missing required vocabulary: ${e}`)}))}if(_e&&!e.validated){if(Te.markValidated(e.id),!(e.dialectId in Ke)){const r=await Te.get(e.dialectId),t=await ke(r);Ke[r.id]=Ue(t)}const r=N.cons(e.schema,e.id),t=Ke[e.dialectId](r,Fe);if(!t.valid)throw new xe(t)}return e.id in r.metaData||(r.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ze(`${e.dialectId}#validate`).compile(e,r)},Ze=async e=>Te.typeOf(e,"string")?Ze(await Te.get(Te.value(e),e)):e,Je=(e,r,t,n)=>{const o=Be(e,t),a=Pe(e,"");return ze(o).interpret(e,r,t,{...t.metaData[a].dynamicAnchors,...n})},Be=(e,r)=>{if(!(e in r))throw Error(`No schema found at ${e}`);return r[e][0]};var Ge={validate:async(e,r,t)=>{const n=await ke(e),o=(e,r)=>Ue(n,N.cons(e),r);return void 0===r?o:o(r,t)},compile:ke,interpret:Ue,setMetaOutputFormat:e=>{Fe=e},setShouldMetaValidate:e=>{_e=e},FLAG:$e,BASIC:De,DETAILED:Re,VERBOSE:Ne,add:(e,r="",t="")=>{const n=Te.add(e,r,t);delete Ke[n]},getKeyword:ze,hasKeyword:He,defineVocabulary:(e,r)=>{Ve[e]=r},compileSchema:Me,interpretSchema:Je,collectEvaluatedProperties:(e,r,t,n,o)=>{const a=Be(e,t);return ze(a).collectEvaluatedProperties(e,r,t,n,o)},collectEvaluatedItems:(e,r,t,n,o)=>{const a=Be(e,t);return ze(a).collectEvaluatedItems(e,r,t,n,o)},addMediaTypePlugin:re.addPlugin};var We={compile:e=>Te.value(e),interpret:()=>!0};var Qe={compile:async(e,r)=>{const t=Te.uri(e);if(!(t in r)){r[t]=!1;const n=Te.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Te.uri(e)}'`);r[t]=[`${e.dialectId}#validate`,Te.uri(e),"boolean"==typeof n?n:await H.pipeline([Te.entries,H.map((([r,t])=>[`${e.dialectId}#${r}`,t])),H.filter((([r])=>Ge.hasKeyword(r)&&r!==`${e.dialectId}#validate`)),H.map((async([t,n])=>{const o=await Ge.getKeyword(t).compile(n,r,e);return[t,Te.uri(n),o]})),H.all],e)]}return t},interpret:(e,r,t,o)=>{const[a,i,s]=t[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=Ge.getKeyword(e).interpret(i,r,t,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:N.uri(r),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:N.uri(r),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Ge.getKeyword(o).collectEvaluatedProperties(a,r,t,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Ge.getKeyword(o).collectEvaluatedItems(a,r,t,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ye={metaData:We,validate:Qe},Xe={Core:Ge,Schema:Te,Instance:N,Reference:S,Keywords:Ye,InvalidSchemaError:xe},er=Xe.Core,rr=Xe.Schema,tr=Xe.Instance,nr=Xe.Reference,or=Xe.Keywords,ar=Xe.InvalidSchemaError;export{er as Core,tr as Instance,ar as InvalidSchemaError,or as Keywords,nr as Reference,rr as Schema,Xe as default}; | ||
*/function Q(e){var r=String(e);if(Z.test(r))return r;if(r.length>0&&!K.test(r))throw new TypeError("invalid parameter value");return'"'+r.replace(B,"\\$1")+'"'}function Y(e){this.parameters=Object.create(null),this.type=e}var X={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var r=e.parameters,t=e.type;if(!t||!G.test(t))throw new TypeError("invalid type");var n=t;if(r&&"object"==typeof r)for(var o,a=Object.keys(r).sort(),i=0;i<a.length;i++){if(o=a[i],!Z.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Q(r[o])}return n},parse:W};const ee={};var re={addPlugin:(e,r)=>{ee[e]=r},parse:e=>{const r=X.parse(e.headers.get("content-type")).type;if(!(r in ee))throw Error(`${e.url} is not a schema. Found a document with media type: ${r}`);return ee[r].parse(e)},getContentType:e=>{for(const r in ee)if(ee[r].matcher(e))return r;return"application/octet-stream"}};const{jsonTypeOf:te,resolveUrl:ne,urlFragment:oe,pathRelative:ae}=s,ie="https://json-schema.org/draft/2019-09/vocab/core",se="https://json-schema.org/draft/2020-12/vocab/core",ce={},ue={},le=(e,r)=>{const t=ue[e];return ce[t]?.[r]},pe={},fe={},de=(e,r="",t="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(r,""),o=ne(e.$schema||t,"");if(!o)throw Error("Couldn't determine schema dialect");if(delete e.$schema,!(o in ue))if(!0===e?.$vocabulary?.[ie]&&o===he(e,n,ie)[0])ue[o]=ie;else if(!0===e?.$vocabulary?.[se]&&o===he(e,n,se)[0])ue[o]=se;else if(o===he(e,n,o)[0])ue[o]=o;else{if(!(o in pe))throw Error(`Couldn't determine JSON Schema version for dialect: '${o}'`);{const e=pe[o];!0===e.vocabulary[ie]?ue[o]=ie:!0===e.vocabulary[se]?ue[o]=se:ue[o]=ue[e.dialectId]}}const[a,i]=he(e,n,ue[o]);if(!a)throw Error("Couldn't determine an identifier for the schema");const s=le(o,"baseToken");delete e[s],n&&(fe[n]=a);const c=le(o,"anchorToken");i&&s===c&&(e[c]=c!==s?encodeURI(i):`#${encodeURI(i)}`);const u={},l=le(o,"recursiveAnchorToken");let p;!0===e[l]&&(u[""]=`${a}#`,e[c]="",delete e[l]);const f=le(o,"vocabularyToken");te(e[f],"object")?(p=e[f],delete e[f]):p={[ue[o]]:!0};const d={"":""};return pe[a]={id:a,dialectId:o,schema:ve(e,a,o,b.nil,d,u),anchors:d,dynamicAnchors:u,vocabulary:p,validated:!1},a},he=(e,r,t)=>{const n=ce[t]?.baseToken,o=ne(r,e[n]||"");return[ne(o,""),oe(o)]},ve=(e,r,t,n,o,a)=>{if(te(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema,""):t,s=le(i,"embeddedToken"),c=le(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ne(r,e[s]);return e[le(i,"baseToken")]=n,de(e,n,t),S.cons(e[s],e)}const u=le(t,"anchorToken"),l=le(t,"dynamicAnchorToken");"string"==typeof e[l]&&(a[e[l]]=`${r}#${encodeURI(n)}`,o[e[l]]=n,delete e[l]);const p=le(t,"embeddedToken");if("string"==typeof e[u]){const r=u!==p?e[u]:e[u].slice(1);o[r]=n,delete e[u]}const f=le(t,"jrefToken");if("string"==typeof e[f])return S.cons(e[f],e);for(const i in e)e[i]=ve(e[i],r,t,b.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ve(e,r,t,b.append(i,n),o,a))):e},ye=e=>pe[fe[e]]||pe[e],me=Object.freeze({id:"",dialectId:void 0,vocabulary:{},pointer:b.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ge=async(e,r=me)=>{const t=ne(Ee(r),e),n=ne(t,""),o=oe(t);if(!(e=>e in pe||e in fe)(n)){const e=await V(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);de(await re.parse(e),n)}const a=ye(n),i="/"!==o[0]?we(a,o):o,s=Object.freeze({...a,pointer:i,value:b.get(i,a.schema)});return be(s)},be=e=>S.isReference(e.value)?ge(S.href(e.value),e):e,we=(e,r)=>{if(!(r in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(r)}'`);return e.anchors[r]},Ee=e=>`${e.id}#${encodeURI(e.pointer)}`,Se=e=>S.isReference(e.value)?S.value(e.value):e.value,Ce=(e,r)=>{const t=ye(r.id),n=Object.freeze({...r,pointer:b.append(e,r.pointer),value:Se(r)[e],validated:t.validated});return be(n)},Oe=e(((e,r)=>H.pipeline([Se,H.map((async(t,n)=>e(await Ce(n,r),n))),H.all],r))),Ae={parentId:"",parentDialect:"",includeEmbedded:!0},Ie=(e,r)=>{if(r.startsWith("file://")){const t=e.slice(7,e.lastIndexOf("/"));return""===e?"":ae(t,r.slice(7))}return r};var Te={setConfig:(e,r,t)=>{ce[e]||(ce[e]={}),ce[e][r]=t},getConfig:le,add:de,get:ge,markValidated:e=>{pe[e].validated=!0},uri:Ee,value:Se,getAnchorPointer:we,typeOf:(e,r)=>te(Se(e),r),has:(e,r)=>e in Se(r),step:Ce,keys:e=>Object.keys(Se(e)),entries:e=>H.pipeline([Se,Object.keys,H.map((async r=>[r,await Ce(r,e)])),H.all],e),map:Oe,length:e=>Se(e).length,toSchema:(e,r={})=>{const t={...Ae,...r},n=JSON.parse(JSON.stringify(e.schema,((r,n)=>{if(!S.isReference(n))return n;const o=S.value(n),a="string"==typeof o.$schema?ne(o.$schema,""):e.dialectId,i=le(a,"embeddedToken");return!t.includeEmbedded&&i in o?void 0:S.value(n)}))),o=le(e.dialectId,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,r])=>{const t=oe(r);b.assign(t,n,{[o]:e,...b.get(t,n)})}));const a=le(e.dialectId,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,r])=>{b.assign(r,n,{[a]:e,...b.get(r,n)})}));const i=le(e.dialectId,"baseToken"),s=Ie(t.parentId,e.id),c=t.parentDialect===e.dialectId?"":e.dialectId;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};Te.setConfig,Te.getConfig,Te.add,Te.get,Te.markValidated,Te.uri,Te.value,Te.getAnchorPointer,Te.typeOf,Te.has,Te.step,Te.keys,Te.entries,Te.map,Te.length,Te.toSchema;class je extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=je;var Pe={compile:e=>Te.value(e),interpret:()=>!0};const{resolveUrl:$e}=s,De="FLAG",Re="BASIC",Ne="DETAILED",Fe="VERBOSE";let _e=Ne,ke=!0;re.addPlugin("application/schema+json",{parse:async e=>await e.json(),matcher:e=>e.endsWith(".schema.json")});const Ue=async e=>{const r={metaData:{}};return{ast:r,schemaUri:await Ze(e,r)}},qe=e((({ast:e,schemaUri:r},t,o=De)=>{if(![De,Re,Ne,Fe].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",Le(o,a));return Be(r,t,e,{}),n.unsubscribe(i),a[0]})),Le=(e,r)=>{const t=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a,errors:[]};t.push(i)}else if("result.start"===n)t.push(n);else if("result.end"===n){const n=t.pop();for(;"result.start"!==t[t.length-1];){const r=t.pop(),o=[r];e===Re&&(o.push(...r.errors),delete r.errors),(e===Fe||e!==De&&!r.valid)&&n.errors.unshift(...o)}t[t.length-1]=n,r[0]=n}}},ze={},He=e=>ze[e]||Pe,Ve=e=>e in ze,Me={},Ke={},Ze=async(e,r)=>{if(e=await Je(e),!Ve(`${e.dialectId}#validate`)){const r=await Te.get(e.dialectId);(Te.getConfig(r.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!r.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(r.vocabulary).forEach((([e,t])=>{if(e in Me)Object.entries(Me[e]).forEach((([e,t])=>{((e,r)=>{ze[e]={collectEvaluatedItems:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&new Set,collectEvaluatedProperties:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&[],...r}})(`${r.id}#${e}`,t)}));else if(t)throw Error(`Missing required vocabulary: ${e}`)}))}if(ke&&!e.validated){if(Te.markValidated(e.id),!(e.dialectId in Ke)){const r=await Te.get(e.dialectId),t=await Ue(r);Ke[r.id]=qe(t)}const r=N.cons(e.schema,e.id),t=Ke[e.dialectId](r,_e);if(!t.valid)throw new xe(t)}return e.id in r.metaData||(r.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),He(`${e.dialectId}#validate`).compile(e,r)},Je=async e=>Te.typeOf(e,"string")?Je(await Te.get(Te.value(e),e)):e,Be=(e,r,t,n)=>{const o=Ge(e,t),a=$e(e,"");return He(o).interpret(e,r,t,{...t.metaData[a].dynamicAnchors,...n})},Ge=(e,r)=>{if(!(e in r))throw Error(`No schema found at ${e}`);return r[e][0]};var We={validate:async(e,r,t)=>{const n=await Ue(e),o=(e,r)=>qe(n,N.cons(e),r);return void 0===r?o:o(r,t)},compile:Ue,interpret:qe,setMetaOutputFormat:e=>{_e=e},setShouldMetaValidate:e=>{ke=e},FLAG:De,BASIC:Re,DETAILED:Ne,VERBOSE:Fe,add:(e,r="",t="")=>{const n=Te.add(e,r,t);delete Ke[n]},getKeyword:He,hasKeyword:Ve,defineVocabulary:(e,r)=>{Me[e]=r},compileSchema:Ze,interpretSchema:Be,collectEvaluatedProperties:(e,r,t,n,o)=>{const a=Ge(e,t);return He(a).collectEvaluatedProperties(e,r,t,n,o)},collectEvaluatedItems:(e,r,t,n,o)=>{const a=Ge(e,t);return He(a).collectEvaluatedItems(e,r,t,n,o)},addMediaTypePlugin:re.addPlugin};var Qe={compile:async(e,r)=>{const t=Te.uri(e);if(!(t in r)){r[t]=!1;const n=Te.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Te.uri(e)}'`);r[t]=[`${e.dialectId}#validate`,Te.uri(e),"boolean"==typeof n?n:await H.pipeline([Te.entries,H.map((([r,t])=>[`${e.dialectId}#${r}`,t])),H.filter((([r])=>r!==`${e.dialectId}#validate`)),H.map((async([t,n])=>{const o=await We.getKeyword(t).compile(n,r,e);return[t,Te.uri(n),o]})),H.all],e)]}return t},interpret:(e,r,t,o)=>{const[a,i,s]=t[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=We.getKeyword(e).interpret(i,r,t,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:N.uri(r),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:N.uri(r),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&We.getKeyword(o).collectEvaluatedProperties(a,r,t,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&We.getKeyword(o).collectEvaluatedItems(a,r,t,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ye={metaData:Pe,validate:Qe},Xe={Core:We,Schema:Te,Instance:N,Reference:S,Keywords:Ye,InvalidSchemaError:xe},er=Xe.Core,rr=Xe.Schema,tr=Xe.Instance,nr=Xe.Reference,or=Xe.Keywords,ar=Xe.InvalidSchemaError;export{er as Core,tr as Instance,ar as InvalidSchemaError,or as Keywords,nr as Reference,rr as Schema,Xe as default}; | ||
//# sourceMappingURL=json-schema-core-esm.min.js.map |
@@ -8,3 +8,3 @@ var JSC=function(e){"use strict";var r=function(e,r){return function t(){null==r&&(r=e.length);var n=[].slice.call(arguments);return n.length>=r?e.apply(this,n):function(){return t.apply(this,n.concat([].slice.call(arguments)))}}};var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e,r){return e(r={exports:{}},r.exports),r.exports}var o=n((function(e,r){var n,o;n="object"==typeof window&&window||t,o={},n.PubSub?(o=n.PubSub,console.warn("PubSub already loaded, using existing version")):(n.PubSub=o,function(e){var r={},t=-1,n="*";function o(e){var r;for(r in e)if(Object.prototype.hasOwnProperty.call(e,r))return!0;return!1}function a(e){return function(){throw e}}function i(e,r,t){try{e(r,t)}catch(e){setTimeout(a(e),0)}}function s(e,r,t){e(r,t)}function c(e,t,n,o){var a,c=r[t],u=o?s:i;if(Object.prototype.hasOwnProperty.call(r,t))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&u(c[a],e,n)}function u(e,r,t){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,r,t);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,r,t);c(e,n,r,t)}}function l(e){var t=String(e);return Boolean(Object.prototype.hasOwnProperty.call(r,t)&&o(r[t]))}function p(e){for(var r=String(e),t=l(r)||l(n),o=r.lastIndexOf(".");!t&&-1!==o;)o=(r=r.substr(0,o)).lastIndexOf("."),t=l(r);return t}function f(e,r,t,n){var o=u(e="symbol"==typeof e?e.toString():e,r,n);return!!p(e)&&(!0===t?o():setTimeout(o,0),!0)}e.publish=function(r,t){return f(r,t,!1,e.immediateExceptions)},e.publishSync=function(r,t){return f(r,t,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(r,e)||(r[e]={});var o="uid_"+String(++t);return r[e][o]=n,o},e.subscribeAll=function(r){return e.subscribe(n,r)},e.subscribeOnce=function(r,t){var n=e.subscribe(r,(function(){e.unsubscribe(n),t.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){r={}},e.clearSubscriptions=function(e){var t;for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)&&delete r[t]},e.countSubscriptions=function(e){var t,n,o=0;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)){for(n in r[t])o++;break}return o},e.getSubscriptions=function(e){var t,n=[];for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)&&n.push(t);return n},e.unsubscribe=function(t){var n,o,a,i=function(e){var t;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e))return!0;return!1},s="string"==typeof t&&(Object.prototype.hasOwnProperty.call(r,t)||i(t)),c=!s&&"string"==typeof t,u="function"==typeof t,l=!1;if(!s){for(n in r)if(Object.prototype.hasOwnProperty.call(r,n)){if(o=r[n],c&&o[t]){delete o[t],l=t;break}if(u)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===t&&(delete o[a],l=!0)}return l}e.clearSubscriptions(t)}}(o)),void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o}));o.PubSub;var a,i=n((function(e,r){ | ||
* MIT Licensed | ||
*/function Y(e){var r=String(e);if(J.test(r))return r;if(r.length>0&&!Z.test(r))throw new TypeError("invalid parameter value");return'"'+r.replace(G,"\\$1")+'"'}function X(e){this.parameters=Object.create(null),this.type=e}var ee={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var r=e.parameters,t=e.type;if(!t||!W.test(t))throw new TypeError("invalid type");var n=t;if(r&&"object"==typeof r)for(var o,a=Object.keys(r).sort(),i=0;i<a.length;i++){if(o=a[i],!J.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Y(r[o])}return n},parse:Q};const re={};var te={addPlugin:(e,r)=>{re[e]=r},parse:e=>{const r=ee.parse(e.headers.get("content-type")).type;if(!(r in re))throw Error(`${e.url} is not a schema. Found a document with media type: ${r}`);return re[r].parse(e)},getContentType:e=>{for(const r in re)if(re[r].matcher(e))return r;return"application/octet-stream"}};const{jsonTypeOf:ne,resolveUrl:oe,urlFragment:ae,pathRelative:ie}=c,se="https://json-schema.org/draft/2019-09/vocab/core",ce="https://json-schema.org/draft/2020-12/vocab/core",ue={},le={},pe=(e,r)=>{const t=le[e];return ue[t]?.[r]},fe={},de={},he=(e,r="",t="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(r,""),o=oe(e.$schema||t,"");if(!o)throw Error("Couldn't determine schema dialect");if(delete e.$schema,!(o in le))if(!0===e?.$vocabulary?.[se]&&o===ve(e,n,se)[0])le[o]=se;else if(!0===e?.$vocabulary?.[ce]&&o===ve(e,n,ce)[0])le[o]=ce;else if(o===ve(e,n,o)[0])le[o]=o;else{if(!(o in fe))throw Error(`Couldn't determine JSON Schema version for dialect: '${o}'`);{const e=fe[o];!0===e.vocabulary[se]?le[o]=se:!0===e.vocabulary[ce]?le[o]=ce:le[o]=le[e.dialectId]}}const[a,i]=ve(e,n,le[o]);if(!a)throw Error("Couldn't determine an identifier for the schema");const s=pe(o,"baseToken");delete e[s],n&&(de[n]=a);const c=pe(o,"anchorToken");i&&s===c&&(e[c]=c!==s?encodeURI(i):`#${encodeURI(i)}`);const u={},l=pe(o,"recursiveAnchorToken");let p;!0===e[l]&&(u[""]=`${a}#`,e[c]="",delete e[l]);const f=pe(o,"vocabularyToken");ne(e[f],"object")?(p=e[f],delete e[f]):p={[le[o]]:!0};const d={"":""};return fe[a]={id:a,dialectId:o,schema:ye(e,a,o,w.nil,d,u),anchors:d,dynamicAnchors:u,vocabulary:p,validated:!1},a},ve=(e,r,t)=>{const n=ue[t]?.baseToken,o=oe(r,e[n]||"");return[oe(o,""),ae(o)]},ye=(e,r,t,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema,""):t,s=pe(i,"embeddedToken"),c=pe(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(r,e[s]);return e[pe(i,"baseToken")]=n,he(e,n,t),C.cons(e[s],e)}const u=pe(t,"anchorToken"),l=pe(t,"dynamicAnchorToken");"string"==typeof e[l]&&(a[e[l]]=`${r}#${encodeURI(n)}`,o[e[l]]=n,delete e[l]);const p=pe(t,"embeddedToken");if("string"==typeof e[u]){const r=u!==p?e[u]:e[u].slice(1);o[r]=n,delete e[u]}const f=pe(t,"jrefToken");if("string"==typeof e[f])return C.cons(e[f],e);for(const i in e)e[i]=ye(e[i],r,t,w.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ye(e,r,t,w.append(i,n),o,a))):e},me=e=>fe[de[e]]||fe[e],ge=Object.freeze({id:"",dialectId:void 0,vocabulary:{},pointer:w.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),be=async(e,r=ge)=>{const t=oe(Se(r),e),n=oe(t,""),o=ae(t);if(!(e=>e in fe||e in de)(n)){const e=await M(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);he(await te.parse(e),n)}const a=me(n),i="/"!==o[0]?Ee(a,o):o,s=Object.freeze({...a,pointer:i,value:w.get(i,a.schema)});return we(s)},we=e=>C.isReference(e.value)?be(C.href(e.value),e):e,Ee=(e,r)=>{if(!(r in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(r)}'`);return e.anchors[r]},Se=e=>`${e.id}#${encodeURI(e.pointer)}`,Ce=e=>C.isReference(e.value)?C.value(e.value):e.value,Oe=(e,r)=>{const t=me(r.id),n=Object.freeze({...r,pointer:w.append(e,r.pointer),value:Ce(r)[e],validated:t.validated});return we(n)},Ae=r(((e,r)=>V.pipeline([Ce,V.map((async(t,n)=>e(await Oe(n,r),n))),V.all],r))),Ie={parentId:"",parentDialect:"",includeEmbedded:!0},je=(e,r)=>{if(r.startsWith("file://")){const t=e.slice(7,e.lastIndexOf("/"));return""===e?"":ie(t,r.slice(7))}return r};var Te={setConfig:(e,r,t)=>{ue[e]||(ue[e]={}),ue[e][r]=t},getConfig:pe,add:he,get:be,markValidated:e=>{fe[e].validated=!0},uri:Se,value:Ce,getAnchorPointer:Ee,typeOf:(e,r)=>ne(Ce(e),r),has:(e,r)=>e in Ce(r),step:Oe,keys:e=>Object.keys(Ce(e)),entries:e=>V.pipeline([Ce,Object.keys,V.map((async r=>[r,await Oe(r,e)])),V.all],e),map:Ae,length:e=>Ce(e).length,toSchema:(e,r={})=>{const t={...Ie,...r},n=JSON.parse(JSON.stringify(e.schema,((r,n)=>{if(!C.isReference(n))return n;const o=C.value(n),a="string"==typeof o.$schema?oe(o.$schema,""):e.dialectId,i=pe(a,"embeddedToken");return!t.includeEmbedded&&i in o?void 0:C.value(n)}))),o=pe(e.dialectId,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,r])=>{const t=ae(r);w.assign(t,n,{[o]:e,...w.get(t,n)})}));const a=pe(e.dialectId,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,r])=>{w.assign(r,n,{[a]:e,...w.get(r,n)})}));const i=pe(e.dialectId,"baseToken"),s=je(t.parentId,e.id),c=t.parentDialect===e.dialectId?"":e.dialectId;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};Te.setConfig,Te.getConfig,Te.add,Te.get,Te.markValidated,Te.uri,Te.value,Te.getAnchorPointer,Te.typeOf,Te.has,Te.step,Te.keys,Te.entries,Te.map,Te.length,Te.toSchema;class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=xe;const{resolveUrl:$e}=c,De="FLAG",Re="BASIC",Ne="DETAILED",_e="VERBOSE";let Fe=Ne,ke=!0;te.addPlugin("application/schema+json",{parse:async e=>await e.json(),matcher:e=>e.endsWith(".schema.json")});const Ue=async e=>{const r={metaData:{}};return{ast:r,schemaUri:await Ze(e,r)}},qe=r((({ast:e,schemaUri:r},t,n=De)=>{if(![De,Re,Ne,_e].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Le(n,a));return Be(r,t,e,{}),o.unsubscribe(i),a[0]})),Le=(e,r)=>{const t=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a,errors:[]};t.push(i)}else if("result.start"===n)t.push(n);else if("result.end"===n){const n=t.pop();for(;"result.start"!==t[t.length-1];){const r=t.pop(),o=[r];e===Re&&(o.push(...r.errors),delete r.errors),(e===_e||e!==De&&!r.valid)&&n.errors.unshift(...o)}t[t.length-1]=n,r[0]=n}}},ze={},He=e=>ze[e],Ve=e=>e in ze,Me={},Ke={},Ze=async(e,r)=>{if(e=await Je(e),!Ve(`${e.dialectId}#validate`)){const r=await Te.get(e.dialectId);(Te.getConfig(r.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!r.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(r.vocabulary).forEach((([e,t])=>{if(e in Me)Object.entries(Me[e]).forEach((([e,t])=>{((e,r)=>{ze[e]={collectEvaluatedItems:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&new Set,collectEvaluatedProperties:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&[],...r}})(`${r.id}#${e}`,t)}));else if(t)throw Error(`Missing required vocabulary: ${e}`)}))}if(ke&&!e.validated){if(Te.markValidated(e.id),!(e.dialectId in Ke)){const r=await Te.get(e.dialectId),t=await Ue(r);Ke[r.id]=qe(t)}const r=_.cons(e.schema,e.id),t=Ke[e.dialectId](r,Fe);if(!t.valid)throw new Pe(t)}return e.id in r.metaData||(r.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),He(`${e.dialectId}#validate`).compile(e,r)},Je=async e=>Te.typeOf(e,"string")?Je(await Te.get(Te.value(e),e)):e,Be=(e,r,t,n)=>{const o=Ge(e,t),a=$e(e,"");return He(o).interpret(e,r,t,{...t.metaData[a].dynamicAnchors,...n})},Ge=(e,r)=>{if(!(e in r))throw Error(`No schema found at ${e}`);return r[e][0]};var We={validate:async(e,r,t)=>{const n=await Ue(e),o=(e,r)=>qe(n,_.cons(e),r);return void 0===r?o:o(r,t)},compile:Ue,interpret:qe,setMetaOutputFormat:e=>{Fe=e},setShouldMetaValidate:e=>{ke=e},FLAG:De,BASIC:Re,DETAILED:Ne,VERBOSE:_e,add:(e,r="",t="")=>{const n=Te.add(e,r,t);delete Ke[n]},getKeyword:He,hasKeyword:Ve,defineVocabulary:(e,r)=>{Me[e]=r},compileSchema:Ze,interpretSchema:Be,collectEvaluatedProperties:(e,r,t,n,o)=>{const a=Ge(e,t);return He(a).collectEvaluatedProperties(e,r,t,n,o)},collectEvaluatedItems:(e,r,t,n,o)=>{const a=Ge(e,t);return He(a).collectEvaluatedItems(e,r,t,n,o)},addMediaTypePlugin:te.addPlugin};var Qe={compile:e=>Te.value(e),interpret:()=>!0};var Ye={compile:async(e,r)=>{const t=Te.uri(e);if(!(t in r)){r[t]=!1;const n=Te.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Te.uri(e)}'`);r[t]=[`${e.dialectId}#validate`,Te.uri(e),"boolean"==typeof n?n:await V.pipeline([Te.entries,V.map((([r,t])=>[`${e.dialectId}#${r}`,t])),V.filter((([r])=>We.hasKeyword(r)&&r!==`${e.dialectId}#validate`)),V.map((async([t,n])=>{const o=await We.getKeyword(t).compile(n,r,e);return[t,Te.uri(n),o]})),V.all],e)]}return t},interpret:(e,r,t,n)=>{const[a,i,s]=t[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=We.getKeyword(e).interpret(i,r,t,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:_.uri(r),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:_.uri(r),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&We.getKeyword(o).collectEvaluatedProperties(a,r,t,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&We.getKeyword(o).collectEvaluatedItems(a,r,t,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Xe={metaData:Qe,validate:Ye},er={Core:We,Schema:Te,Instance:_,Reference:C,Keywords:Xe,InvalidSchemaError:Pe},rr=er.Core,tr=er.Schema,nr=er.Instance,or=er.Reference,ar=er.Keywords,ir=er.InvalidSchemaError;return e.Core=rr,e.Instance=nr,e.InvalidSchemaError=ir,e.Keywords=ar,e.Reference=or,e.Schema=tr,e.default=er,Object.defineProperty(e,"__esModule",{value:!0}),e}({}); | ||
*/function Y(e){var r=String(e);if(J.test(r))return r;if(r.length>0&&!Z.test(r))throw new TypeError("invalid parameter value");return'"'+r.replace(G,"\\$1")+'"'}function X(e){this.parameters=Object.create(null),this.type=e}var ee={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var r=e.parameters,t=e.type;if(!t||!W.test(t))throw new TypeError("invalid type");var n=t;if(r&&"object"==typeof r)for(var o,a=Object.keys(r).sort(),i=0;i<a.length;i++){if(o=a[i],!J.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Y(r[o])}return n},parse:Q};const re={};var te={addPlugin:(e,r)=>{re[e]=r},parse:e=>{const r=ee.parse(e.headers.get("content-type")).type;if(!(r in re))throw Error(`${e.url} is not a schema. Found a document with media type: ${r}`);return re[r].parse(e)},getContentType:e=>{for(const r in re)if(re[r].matcher(e))return r;return"application/octet-stream"}};const{jsonTypeOf:ne,resolveUrl:oe,urlFragment:ae,pathRelative:ie}=c,se="https://json-schema.org/draft/2019-09/vocab/core",ce="https://json-schema.org/draft/2020-12/vocab/core",ue={},le={},pe=(e,r)=>{const t=le[e];return ue[t]?.[r]},fe={},de={},he=(e,r="",t="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(r,""),o=oe(e.$schema||t,"");if(!o)throw Error("Couldn't determine schema dialect");if(delete e.$schema,!(o in le))if(!0===e?.$vocabulary?.[se]&&o===ve(e,n,se)[0])le[o]=se;else if(!0===e?.$vocabulary?.[ce]&&o===ve(e,n,ce)[0])le[o]=ce;else if(o===ve(e,n,o)[0])le[o]=o;else{if(!(o in fe))throw Error(`Couldn't determine JSON Schema version for dialect: '${o}'`);{const e=fe[o];!0===e.vocabulary[se]?le[o]=se:!0===e.vocabulary[ce]?le[o]=ce:le[o]=le[e.dialectId]}}const[a,i]=ve(e,n,le[o]);if(!a)throw Error("Couldn't determine an identifier for the schema");const s=pe(o,"baseToken");delete e[s],n&&(de[n]=a);const c=pe(o,"anchorToken");i&&s===c&&(e[c]=c!==s?encodeURI(i):`#${encodeURI(i)}`);const u={},l=pe(o,"recursiveAnchorToken");let p;!0===e[l]&&(u[""]=`${a}#`,e[c]="",delete e[l]);const f=pe(o,"vocabularyToken");ne(e[f],"object")?(p=e[f],delete e[f]):p={[le[o]]:!0};const d={"":""};return fe[a]={id:a,dialectId:o,schema:ye(e,a,o,w.nil,d,u),anchors:d,dynamicAnchors:u,vocabulary:p,validated:!1},a},ve=(e,r,t)=>{const n=ue[t]?.baseToken,o=oe(r,e[n]||"");return[oe(o,""),ae(o)]},ye=(e,r,t,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema,""):t,s=pe(i,"embeddedToken"),c=pe(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(r,e[s]);return e[pe(i,"baseToken")]=n,he(e,n,t),C.cons(e[s],e)}const u=pe(t,"anchorToken"),l=pe(t,"dynamicAnchorToken");"string"==typeof e[l]&&(a[e[l]]=`${r}#${encodeURI(n)}`,o[e[l]]=n,delete e[l]);const p=pe(t,"embeddedToken");if("string"==typeof e[u]){const r=u!==p?e[u]:e[u].slice(1);o[r]=n,delete e[u]}const f=pe(t,"jrefToken");if("string"==typeof e[f])return C.cons(e[f],e);for(const i in e)e[i]=ye(e[i],r,t,w.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ye(e,r,t,w.append(i,n),o,a))):e},me=e=>fe[de[e]]||fe[e],ge=Object.freeze({id:"",dialectId:void 0,vocabulary:{},pointer:w.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),be=async(e,r=ge)=>{const t=oe(Se(r),e),n=oe(t,""),o=ae(t);if(!(e=>e in fe||e in de)(n)){const e=await M(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);he(await te.parse(e),n)}const a=me(n),i="/"!==o[0]?Ee(a,o):o,s=Object.freeze({...a,pointer:i,value:w.get(i,a.schema)});return we(s)},we=e=>C.isReference(e.value)?be(C.href(e.value),e):e,Ee=(e,r)=>{if(!(r in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(r)}'`);return e.anchors[r]},Se=e=>`${e.id}#${encodeURI(e.pointer)}`,Ce=e=>C.isReference(e.value)?C.value(e.value):e.value,Oe=(e,r)=>{const t=me(r.id),n=Object.freeze({...r,pointer:w.append(e,r.pointer),value:Ce(r)[e],validated:t.validated});return we(n)},Ae=r(((e,r)=>V.pipeline([Ce,V.map((async(t,n)=>e(await Oe(n,r),n))),V.all],r))),Ie={parentId:"",parentDialect:"",includeEmbedded:!0},je=(e,r)=>{if(r.startsWith("file://")){const t=e.slice(7,e.lastIndexOf("/"));return""===e?"":ie(t,r.slice(7))}return r};var Te={setConfig:(e,r,t)=>{ue[e]||(ue[e]={}),ue[e][r]=t},getConfig:pe,add:he,get:be,markValidated:e=>{fe[e].validated=!0},uri:Se,value:Ce,getAnchorPointer:Ee,typeOf:(e,r)=>ne(Ce(e),r),has:(e,r)=>e in Ce(r),step:Oe,keys:e=>Object.keys(Ce(e)),entries:e=>V.pipeline([Ce,Object.keys,V.map((async r=>[r,await Oe(r,e)])),V.all],e),map:Ae,length:e=>Ce(e).length,toSchema:(e,r={})=>{const t={...Ie,...r},n=JSON.parse(JSON.stringify(e.schema,((r,n)=>{if(!C.isReference(n))return n;const o=C.value(n),a="string"==typeof o.$schema?oe(o.$schema,""):e.dialectId,i=pe(a,"embeddedToken");return!t.includeEmbedded&&i in o?void 0:C.value(n)}))),o=pe(e.dialectId,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,r])=>{const t=ae(r);w.assign(t,n,{[o]:e,...w.get(t,n)})}));const a=pe(e.dialectId,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,r])=>{w.assign(r,n,{[a]:e,...w.get(r,n)})}));const i=pe(e.dialectId,"baseToken"),s=je(t.parentId,e.id),c=t.parentDialect===e.dialectId?"":e.dialectId;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};Te.setConfig,Te.getConfig,Te.add,Te.get,Te.markValidated,Te.uri,Te.value,Te.getAnchorPointer,Te.typeOf,Te.has,Te.step,Te.keys,Te.entries,Te.map,Te.length,Te.toSchema;class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=xe;var $e={compile:e=>Te.value(e),interpret:()=>!0};const{resolveUrl:De}=c,Re="FLAG",Ne="BASIC",_e="DETAILED",Fe="VERBOSE";let ke=_e,Ue=!0;te.addPlugin("application/schema+json",{parse:async e=>await e.json(),matcher:e=>e.endsWith(".schema.json")});const qe=async e=>{const r={metaData:{}};return{ast:r,schemaUri:await Je(e,r)}},Le=r((({ast:e,schemaUri:r},t,n=Re)=>{if(![Re,Ne,_e,Fe].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",ze(n,a));return Ge(r,t,e,{}),o.unsubscribe(i),a[0]})),ze=(e,r)=>{const t=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a,errors:[]};t.push(i)}else if("result.start"===n)t.push(n);else if("result.end"===n){const n=t.pop();for(;"result.start"!==t[t.length-1];){const r=t.pop(),o=[r];e===Ne&&(o.push(...r.errors),delete r.errors),(e===Fe||e!==Re&&!r.valid)&&n.errors.unshift(...o)}t[t.length-1]=n,r[0]=n}}},He={},Ve=e=>He[e]||$e,Me=e=>e in He,Ke={},Ze={},Je=async(e,r)=>{if(e=await Be(e),!Me(`${e.dialectId}#validate`)){const r=await Te.get(e.dialectId);(Te.getConfig(r.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!r.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(r.vocabulary).forEach((([e,t])=>{if(e in Ke)Object.entries(Ke[e]).forEach((([e,t])=>{((e,r)=>{He[e]={collectEvaluatedItems:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&new Set,collectEvaluatedProperties:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&[],...r}})(`${r.id}#${e}`,t)}));else if(t)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ue&&!e.validated){if(Te.markValidated(e.id),!(e.dialectId in Ze)){const r=await Te.get(e.dialectId),t=await qe(r);Ze[r.id]=Le(t)}const r=_.cons(e.schema,e.id),t=Ze[e.dialectId](r,ke);if(!t.valid)throw new Pe(t)}return e.id in r.metaData||(r.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ve(`${e.dialectId}#validate`).compile(e,r)},Be=async e=>Te.typeOf(e,"string")?Be(await Te.get(Te.value(e),e)):e,Ge=(e,r,t,n)=>{const o=We(e,t),a=De(e,"");return Ve(o).interpret(e,r,t,{...t.metaData[a].dynamicAnchors,...n})},We=(e,r)=>{if(!(e in r))throw Error(`No schema found at ${e}`);return r[e][0]};var Qe={validate:async(e,r,t)=>{const n=await qe(e),o=(e,r)=>Le(n,_.cons(e),r);return void 0===r?o:o(r,t)},compile:qe,interpret:Le,setMetaOutputFormat:e=>{ke=e},setShouldMetaValidate:e=>{Ue=e},FLAG:Re,BASIC:Ne,DETAILED:_e,VERBOSE:Fe,add:(e,r="",t="")=>{const n=Te.add(e,r,t);delete Ze[n]},getKeyword:Ve,hasKeyword:Me,defineVocabulary:(e,r)=>{Ke[e]=r},compileSchema:Je,interpretSchema:Ge,collectEvaluatedProperties:(e,r,t,n,o)=>{const a=We(e,t);return Ve(a).collectEvaluatedProperties(e,r,t,n,o)},collectEvaluatedItems:(e,r,t,n,o)=>{const a=We(e,t);return Ve(a).collectEvaluatedItems(e,r,t,n,o)},addMediaTypePlugin:te.addPlugin};var Ye={compile:async(e,r)=>{const t=Te.uri(e);if(!(t in r)){r[t]=!1;const n=Te.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Te.uri(e)}'`);r[t]=[`${e.dialectId}#validate`,Te.uri(e),"boolean"==typeof n?n:await V.pipeline([Te.entries,V.map((([r,t])=>[`${e.dialectId}#${r}`,t])),V.filter((([r])=>r!==`${e.dialectId}#validate`)),V.map((async([t,n])=>{const o=await Qe.getKeyword(t).compile(n,r,e);return[t,Te.uri(n),o]})),V.all],e)]}return t},interpret:(e,r,t,n)=>{const[a,i,s]=t[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=Qe.getKeyword(e).interpret(i,r,t,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:_.uri(r),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:_.uri(r),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Qe.getKeyword(o).collectEvaluatedProperties(a,r,t,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Qe.getKeyword(o).collectEvaluatedItems(a,r,t,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Xe={metaData:$e,validate:Ye},er={Core:Qe,Schema:Te,Instance:_,Reference:C,Keywords:Xe,InvalidSchemaError:Pe},rr=er.Core,tr=er.Schema,nr=er.Instance,or=er.Reference,ar=er.Keywords,ir=er.InvalidSchemaError;return e.Core=rr,e.Instance=nr,e.InvalidSchemaError=ir,e.Keywords=ar,e.Reference=or,e.Schema=tr,e.default=er,Object.defineProperty(e,"__esModule",{value:!0}),e}({}); | ||
//# sourceMappingURL=json-schema-core-iife.min.js.map |
System.register("JSC",[],(function(e){"use strict";return{execute:function(){var r=function(e,r){return function t(){null==r&&(r=e.length);var n=[].slice.call(arguments);return n.length>=r?e.apply(this,n):function(){return t.apply(this,n.concat([].slice.call(arguments)))}}};var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e,r){return e(r={exports:{}},r.exports),r.exports}var o=n((function(e,r){var n,o;n="object"==typeof window&&window||t,o={},n.PubSub?(o=n.PubSub,console.warn("PubSub already loaded, using existing version")):(n.PubSub=o,function(e){var r={},t=-1,n="*";function o(e){var r;for(r in e)if(Object.prototype.hasOwnProperty.call(e,r))return!0;return!1}function a(e){return function(){throw e}}function i(e,r,t){try{e(r,t)}catch(e){setTimeout(a(e),0)}}function s(e,r,t){e(r,t)}function c(e,t,n,o){var a,c=r[t],u=o?s:i;if(Object.prototype.hasOwnProperty.call(r,t))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&u(c[a],e,n)}function u(e,r,t){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,r,t);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,r,t);c(e,n,r,t)}}function l(e){var t=String(e);return Boolean(Object.prototype.hasOwnProperty.call(r,t)&&o(r[t]))}function p(e){for(var r=String(e),t=l(r)||l(n),o=r.lastIndexOf(".");!t&&-1!==o;)o=(r=r.substr(0,o)).lastIndexOf("."),t=l(r);return t}function f(e,r,t,n){var o=u(e="symbol"==typeof e?e.toString():e,r,n);return!!p(e)&&(!0===t?o():setTimeout(o,0),!0)}e.publish=function(r,t){return f(r,t,!1,e.immediateExceptions)},e.publishSync=function(r,t){return f(r,t,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(r,e)||(r[e]={});var o="uid_"+String(++t);return r[e][o]=n,o},e.subscribeAll=function(r){return e.subscribe(n,r)},e.subscribeOnce=function(r,t){var n=e.subscribe(r,(function(){e.unsubscribe(n),t.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){r={}},e.clearSubscriptions=function(e){var t;for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)&&delete r[t]},e.countSubscriptions=function(e){var t,n,o=0;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)){for(n in r[t])o++;break}return o},e.getSubscriptions=function(e){var t,n=[];for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)&&n.push(t);return n},e.unsubscribe=function(t){var n,o,a,i=function(e){var t;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e))return!0;return!1},s="string"==typeof t&&(Object.prototype.hasOwnProperty.call(r,t)||i(t)),c=!s&&"string"==typeof t,u="function"==typeof t,l=!1;if(!s){for(n in r)if(Object.prototype.hasOwnProperty.call(r,n)){if(o=r[n],c&&o[t]){delete o[t],l=t;break}if(u)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===t&&(delete o[a],l=!0)}return l}e.clearSubscriptions(t)}}(o)),void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o}));o.PubSub;var a,i=n((function(e,r){ | ||
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ | ||
!function(e){function r(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];if(r.length>1){r[0]=r[0].slice(0,-1);for(var n=r.length-1,o=1;o<n;++o)r[o]=r[o].slice(1,-1);return r[n]=r[n].slice(1),r.join("")}return r[0]}function t(e){return"(?:"+e+")"}function n(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function o(e){return e.toUpperCase()}function a(e){return null!=e?e instanceof Array?e:"number"!=typeof e.length||e.split||e.setInterval||e.call?[e]:Array.prototype.slice.call(e):[]}function i(e,r){var t=e;if(r)for(var n in r)t[n]=r[n];return t}function s(e){var n="[A-Za-z]",o="[0-9]",a=r(o,"[A-Fa-f]"),i=t(t("%[EFef]"+a+"%"+a+a+"%"+a+a)+"|"+t("%[89A-Fa-f]"+a+"%"+a+a)+"|"+t("%"+a+a)),s="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",c=r("[\\:\\/\\?\\#\\[\\]\\@]",s),u=e?"[\\uE000-\\uF8FF]":"[]",l=r(n,o,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]");t(n+r(n,o,"[\\+\\-\\.]")+"*"),t(t(i+"|"+r(l,s,"[\\:]"))+"*");var p=t(t("25[0-5]")+"|"+t("2[0-4]"+o)+"|"+t("1"+o+o)+"|"+t("0?[1-9]"+o)+"|0?0?"+o),f=t(p+"\\."+p+"\\."+p+"\\."+p),d=t(a+"{1,4}"),h=t(t(d+"\\:"+d)+"|"+f),v=t(t(d+"\\:")+"{6}"+h),y=t("\\:\\:"+t(d+"\\:")+"{5}"+h),m=t(t(d)+"?\\:\\:"+t(d+"\\:")+"{4}"+h),g=t(t(t(d+"\\:")+"{0,1}"+d)+"?\\:\\:"+t(d+"\\:")+"{3}"+h),b=t(t(t(d+"\\:")+"{0,2}"+d)+"?\\:\\:"+t(d+"\\:")+"{2}"+h),w=t(t(t(d+"\\:")+"{0,3}"+d)+"?\\:\\:"+d+"\\:"+h),E=t(t(t(d+"\\:")+"{0,4}"+d)+"?\\:\\:"+h),S=t(t(t(d+"\\:")+"{0,5}"+d)+"?\\:\\:"+d),C=t(t(t(d+"\\:")+"{0,6}"+d)+"?\\:\\:"),O=t([v,y,m,g,b,w,E,S,C].join("|")),A=t(t(l+"|"+i)+"+");t("[vV]"+a+"+\\."+r(l,s,"[\\:]")+"+"),t(t(i+"|"+r(l,s))+"*");var I=t(i+"|"+r(l,s,"[\\:\\@]"));return t(t(i+"|"+r(l,s,"[\\@]"))+"+"),t(t(I+"|"+r("[\\/\\?]",u))+"*"),{NOT_SCHEME:new RegExp(r("[^]",n,o,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(r("[^\\%\\:]",l,s),"g"),NOT_HOST:new RegExp(r("[^\\%\\[\\]\\:]",l,s),"g"),NOT_PATH:new RegExp(r("[^\\%\\/\\:\\@]",l,s),"g"),NOT_PATH_NOSCHEME:new RegExp(r("[^\\%\\/\\@]",l,s),"g"),NOT_QUERY:new RegExp(r("[^\\%]",l,s,"[\\:\\@\\/\\?]",u),"g"),NOT_FRAGMENT:new RegExp(r("[^\\%]",l,s,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(r("[^]",l,s),"g"),UNRESERVED:new RegExp(l,"g"),OTHER_CHARS:new RegExp(r("[^\\%]",l,c),"g"),PCT_ENCODED:new RegExp(i,"g"),IPV4ADDRESS:new RegExp("^("+f+")$"),IPV6ADDRESS:new RegExp("^\\[?("+O+")"+t(t("\\%25|\\%(?!"+a+"{2})")+"("+A+")")+"?\\]?$")}}var c=s(!1),u=s(!0),l=function(){function e(e,r){var t=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(t.push(i.value),!r||t.length!==r);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return t}return function(r,t){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return e(r,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(e){if(Array.isArray(e)){for(var r=0,t=Array(e.length);r<e.length;r++)t[r]=e[r];return t}return Array.from(e)},f=2147483647,d=36,h=1,v=26,y=38,m=700,g=72,b=128,w="-",E=/^xn--/,S=/[^\0-\x7E]/,C=/[\x2E\u3002\uFF0E\uFF61]/g,O={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},A=d-h,I=Math.floor,T=String.fromCharCode;function j(e){throw new RangeError(O[e])}function x(e,r){for(var t=[],n=e.length;n--;)t[n]=r(e[n]);return t}function P(e,r){var t=e.split("@"),n="";return t.length>1&&(n=t[0]+"@",e=t[1]),n+x((e=e.replace(C,".")).split("."),r).join(".")}function $(e){for(var r=[],t=0,n=e.length;t<n;){var o=e.charCodeAt(t++);if(o>=55296&&o<=56319&&t<n){var a=e.charCodeAt(t++);56320==(64512&a)?r.push(((1023&o)<<10)+(1023&a)+65536):(r.push(o),t--)}else r.push(o)}return r}var D=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:d},R=function(e,r){return e+22+75*(e<26)-((0!=r)<<5)},N=function(e,r,t){var n=0;for(e=t?I(e/m):e>>1,e+=I(e/r);e>A*v>>1;n+=d)e=I(e/A);return I(n+(A+1)*e/(e+y))},F=function(e){var r=[],t=e.length,n=0,o=b,a=g,i=e.lastIndexOf(w);i<0&&(i=0);for(var s=0;s<i;++s)e.charCodeAt(s)>=128&&j("not-basic"),r.push(e.charCodeAt(s));for(var c=i>0?i+1:0;c<t;){for(var u=n,l=1,p=d;;p+=d){c>=t&&j("invalid-input");var y=D(e.charCodeAt(c++));(y>=d||y>I((f-n)/l))&&j("overflow"),n+=y*l;var m=p<=a?h:p>=a+v?v:p-a;if(y<m)break;var E=d-m;l>I(f/E)&&j("overflow"),l*=E}var S=r.length+1;a=N(n-u,S,0==u),I(n/S)>f-o&&j("overflow"),o+=I(n/S),n%=S,r.splice(n++,0,o)}return String.fromCodePoint.apply(String,r)},_=function(e){var r=[],t=(e=$(e)).length,n=b,o=0,a=g,i=!0,s=!1,c=void 0;try{for(var u,l=e[Symbol.iterator]();!(i=(u=l.next()).done);i=!0){var p=u.value;p<128&&r.push(T(p))}}catch(e){s=!0,c=e}finally{try{!i&&l.return&&l.return()}finally{if(s)throw c}}var y=r.length,m=y;for(y&&r.push(w);m<t;){var E=f,S=!0,C=!1,O=void 0;try{for(var A,x=e[Symbol.iterator]();!(S=(A=x.next()).done);S=!0){var P=A.value;P>=n&&P<E&&(E=P)}}catch(e){C=!0,O=e}finally{try{!S&&x.return&&x.return()}finally{if(C)throw O}}var D=m+1;E-n>I((f-o)/D)&&j("overflow"),o+=(E-n)*D,n=E;var F=!0,_=!1,k=void 0;try{for(var U,q=e[Symbol.iterator]();!(F=(U=q.next()).done);F=!0){var L=U.value;if(L<n&&++o>f&&j("overflow"),L==n){for(var z=o,H=d;;H+=d){var V=H<=a?h:H>=a+v?v:H-a;if(z<V)break;var K=z-V,M=d-V;r.push(T(R(V+K%M,0))),z=I(K/M)}r.push(T(R(z,0))),a=N(o,D,m==y),o=0,++m}}}catch(e){_=!0,k=e}finally{try{!F&&q.return&&q.return()}finally{if(_)throw k}}++o,++n}return r.join("")},k=function(e){return P(e,(function(e){return E.test(e)?F(e.slice(4).toLowerCase()):e}))},U=function(e){return P(e,(function(e){return S.test(e)?"xn--"+_(e):e}))},q={version:"2.1.0",ucs2:{decode:$,encode:function(e){return String.fromCodePoint.apply(String,p(e))}},decode:F,encode:_,toASCII:U,toUnicode:k},L={};function z(e){var r=e.charCodeAt(0);return r<16?"%0"+r.toString(16).toUpperCase():r<128?"%"+r.toString(16).toUpperCase():r<2048?"%"+(r>>6|192).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase():"%"+(r>>12|224).toString(16).toUpperCase()+"%"+(r>>6&63|128).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase()}function H(e){for(var r="",t=0,n=e.length;t<n;){var o=parseInt(e.substr(t+1,2),16);if(o<128)r+=String.fromCharCode(o),t+=3;else if(o>=194&&o<224){if(n-t>=6){var a=parseInt(e.substr(t+4,2),16);r+=String.fromCharCode((31&o)<<6|63&a)}else r+=e.substr(t,6);t+=6}else if(o>=224){if(n-t>=9){var i=parseInt(e.substr(t+4,2),16),s=parseInt(e.substr(t+7,2),16);r+=String.fromCharCode((15&o)<<12|(63&i)<<6|63&s)}else r+=e.substr(t,9);t+=9}else r+=e.substr(t,3),t+=3}return r}function V(e,r){function t(e){var t=H(e);return t.match(r.UNRESERVED)?t:e}return e.scheme&&(e.scheme=String(e.scheme).replace(r.PCT_ENCODED,t).toLowerCase().replace(r.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(r.PCT_ENCODED,t).replace(r.NOT_USERINFO,z).replace(r.PCT_ENCODED,o)),void 0!==e.host&&(e.host=String(e.host).replace(r.PCT_ENCODED,t).toLowerCase().replace(r.NOT_HOST,z).replace(r.PCT_ENCODED,o)),void 0!==e.path&&(e.path=String(e.path).replace(r.PCT_ENCODED,t).replace(e.scheme?r.NOT_PATH:r.NOT_PATH_NOSCHEME,z).replace(r.PCT_ENCODED,o)),void 0!==e.query&&(e.query=String(e.query).replace(r.PCT_ENCODED,t).replace(r.NOT_QUERY,z).replace(r.PCT_ENCODED,o)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(r.PCT_ENCODED,t).replace(r.NOT_FRAGMENT,z).replace(r.PCT_ENCODED,o)),e}function K(e){return e.replace(/^0*(.*)/,"$1")||"0"}function M(e,r){var t=e.match(r.IPV4ADDRESS)||[],n=l(t,2)[1];return n?n.split(".").map(K).join("."):e}function Z(e,r){var t=e.match(r.IPV6ADDRESS)||[],n=l(t,3),o=n[1],a=n[2];if(o){for(var i=o.toLowerCase().split("::").reverse(),s=l(i,2),c=s[0],u=s[1],p=u?u.split(":").map(K):[],f=c.split(":").map(K),d=r.IPV4ADDRESS.test(f[f.length-1]),h=d?7:8,v=f.length-h,y=Array(h),m=0;m<h;++m)y[m]=p[m]||f[v+m]||"";d&&(y[h-1]=M(y[h-1],r));var g=y.reduce((function(e,r,t){if(!r||"0"===r){var n=e[e.length-1];n&&n.index+n.length===t?n.length++:e.push({index:t,length:1})}return e}),[]).sort((function(e,r){return r.length-e.length}))[0],b=void 0;if(g&&g.length>1){var w=y.slice(0,g.index),E=y.slice(g.index+g.length);b=w.join(":")+"::"+E.join(":")}else b=y.join(":");return a&&(b+="%"+a),b}return e}var J=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,B=void 0==="".match(/(){0}/)[1];function G(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={},n=!1!==r.iri?u:c;"suffix"===r.reference&&(e=(r.scheme?r.scheme+":":"")+"//"+e);var o=e.match(J);if(o){B?(t.scheme=o[1],t.userinfo=o[3],t.host=o[4],t.port=parseInt(o[5],10),t.path=o[6]||"",t.query=o[7],t.fragment=o[8],isNaN(t.port)&&(t.port=o[5])):(t.scheme=o[1]||void 0,t.userinfo=-1!==e.indexOf("@")?o[3]:void 0,t.host=-1!==e.indexOf("//")?o[4]:void 0,t.port=parseInt(o[5],10),t.path=o[6]||"",t.query=-1!==e.indexOf("?")?o[7]:void 0,t.fragment=-1!==e.indexOf("#")?o[8]:void 0,isNaN(t.port)&&(t.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?o[4]:void 0)),t.host&&(t.host=Z(M(t.host,n),n)),void 0!==t.scheme||void 0!==t.userinfo||void 0!==t.host||void 0!==t.port||t.path||void 0!==t.query?void 0===t.scheme?t.reference="relative":void 0===t.fragment?t.reference="absolute":t.reference="uri":t.reference="same-document",r.reference&&"suffix"!==r.reference&&r.reference!==t.reference&&(t.error=t.error||"URI is not a "+r.reference+" reference.");var a=L[(r.scheme||t.scheme||"").toLowerCase()];if(r.unicodeSupport||a&&a.unicodeSupport)V(t,n);else{if(t.host&&(r.domainHost||a&&a.domainHost))try{t.host=q.toASCII(t.host.replace(n.PCT_ENCODED,H).toLowerCase())}catch(e){t.error=t.error||"Host's domain name can not be converted to ASCII via punycode: "+e}V(t,c)}a&&a.parse&&a.parse(t,r)}else t.error=t.error||"URI can not be parsed.";return t}function W(e,r){var t=!1!==r.iri?u:c,n=[];return void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host&&n.push(Z(M(String(e.host),t),t).replace(t.IPV6ADDRESS,(function(e,r,t){return"["+r+(t?"%25"+t:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0}var Q=/^\.\.?\//,Y=/^\/\.(\/|$)/,X=/^\/\.\.(\/|$)/,ee=/^\/?(?:.|\n)*?(?=\/|$)/;function re(e){for(var r=[];e.length;)if(e.match(Q))e=e.replace(Q,"");else if(e.match(Y))e=e.replace(Y,"/");else if(e.match(X))e=e.replace(X,"/"),r.pop();else if("."===e||".."===e)e="";else{var t=e.match(ee);if(!t)throw new Error("Unexpected dot segment condition");var n=t[0];e=e.slice(n.length),r.push(n)}return r.join("")}function te(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=r.iri?u:c,n=[],o=L[(r.scheme||e.scheme||"").toLowerCase()];if(o&&o.serialize&&o.serialize(e,r),e.host)if(t.IPV6ADDRESS.test(e.host));else if(r.domainHost||o&&o.domainHost)try{e.host=r.iri?q.toUnicode(e.host):q.toASCII(e.host.replace(t.PCT_ENCODED,H).toLowerCase())}catch(t){e.error=e.error||"Host's domain name can not be converted to "+(r.iri?"Unicode":"ASCII")+" via punycode: "+t}V(e,t),"suffix"!==r.reference&&e.scheme&&(n.push(e.scheme),n.push(":"));var a=W(e,r);if(void 0!==a&&("suffix"!==r.reference&&n.push("//"),n.push(a),e.path&&"/"!==e.path.charAt(0)&&n.push("/")),void 0!==e.path){var i=e.path;r.absolutePath||o&&o.absolutePath||(i=re(i)),void 0===a&&(i=i.replace(/^\/\//,"/%2F")),n.push(i)}return void 0!==e.query&&(n.push("?"),n.push(e.query)),void 0!==e.fragment&&(n.push("#"),n.push(e.fragment)),n.join("")}function ne(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};return arguments[3]||(e=G(te(e,t),t),r=G(te(r,t),t)),!(t=t||{}).tolerant&&r.scheme?(n.scheme=r.scheme,n.userinfo=r.userinfo,n.host=r.host,n.port=r.port,n.path=re(r.path||""),n.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(n.userinfo=r.userinfo,n.host=r.host,n.port=r.port,n.path=re(r.path||""),n.query=r.query):(r.path?("/"===r.path.charAt(0)?n.path=re(r.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+r.path:n.path=r.path:n.path="/"+r.path,n.path=re(n.path)),n.query=r.query):(n.path=e.path,void 0!==r.query?n.query=r.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=r.fragment,n}function oe(e,r,t){var n=i({scheme:"null"},t);return te(ne(G(e,n),G(r,n),n,!0),n)}function ae(e,r){return"string"==typeof e?e=te(G(e,r),r):"object"===n(e)&&(e=G(te(e,r),r)),e}function ie(e,r,t){return"string"==typeof e?e=te(G(e,t),t):"object"===n(e)&&(e=te(e,t)),"string"==typeof r?r=te(G(r,t),t):"object"===n(r)&&(r=te(r,t)),e===r}function se(e,r){return e&&e.toString().replace(r&&r.iri?u.ESCAPE:c.ESCAPE,z)}function ce(e,r){return e&&e.toString().replace(r&&r.iri?u.PCT_ENCODED:c.PCT_ENCODED,H)}var ue={scheme:"http",domainHost:!0,parse:function(e,r){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,r){var t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},le={scheme:"https",domainHost:ue.domainHost,parse:ue.parse,serialize:ue.serialize};function pe(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var fe={scheme:"ws",domainHost:!0,parse:function(e,r){var t=e;return t.secure=pe(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t},serialize:function(e,r){if(e.port!==(pe(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var t=e.resourceName.split("?"),n=l(t,2),o=n[0],a=n[1];e.path=o&&"/"!==o?o:void 0,e.query=a,e.resourceName=void 0}return e.fragment=void 0,e}},de={scheme:"wss",domainHost:fe.domainHost,parse:fe.parse,serialize:fe.serialize},he={},ve="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ye="[0-9A-Fa-f]",me=t(t("%[EFef]"+ye+"%"+ye+ye+"%"+ye+ye)+"|"+t("%[89A-Fa-f]"+ye+"%"+ye+ye)+"|"+t("%"+ye+ye)),ge="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",be=r("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),we="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Ee=new RegExp(ve,"g"),Se=new RegExp(me,"g"),Ce=new RegExp(r("[^]",ge,"[\\.]",'[\\"]',be),"g"),Oe=new RegExp(r("[^]",ve,we),"g"),Ae=Oe;function Ie(e){var r=H(e);return r.match(Ee)?r:e}var Te={scheme:"mailto",parse:function(e,r){var t=e,n=t.to=t.path?t.path.split(","):[];if(t.path=void 0,t.query){for(var o=!1,a={},i=t.query.split("&"),s=0,c=i.length;s<c;++s){var u=i[s].split("=");switch(u[0]){case"to":for(var l=u[1].split(","),p=0,f=l.length;p<f;++p)n.push(l[p]);break;case"subject":t.subject=ce(u[1],r);break;case"body":t.body=ce(u[1],r);break;default:o=!0,a[ce(u[0],r)]=ce(u[1],r)}}o&&(t.headers=a)}t.query=void 0;for(var d=0,h=n.length;d<h;++d){var v=n[d].split("@");if(v[0]=ce(v[0]),r.unicodeSupport)v[1]=ce(v[1],r).toLowerCase();else try{v[1]=q.toASCII(ce(v[1],r).toLowerCase())}catch(e){t.error=t.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}n[d]=v.join("@")}return t},serialize:function(e,r){var t=e,n=a(e.to);if(n){for(var i=0,s=n.length;i<s;++i){var c=String(n[i]),u=c.lastIndexOf("@"),l=c.slice(0,u).replace(Se,Ie).replace(Se,o).replace(Ce,z),p=c.slice(u+1);try{p=r.iri?q.toUnicode(p):q.toASCII(ce(p,r).toLowerCase())}catch(e){t.error=t.error||"Email address's domain name can not be converted to "+(r.iri?"Unicode":"ASCII")+" via punycode: "+e}n[i]=l+"@"+p}t.path=n.join(",")}var f=e.headers=e.headers||{};e.subject&&(f.subject=e.subject),e.body&&(f.body=e.body);var d=[];for(var h in f)f[h]!==he[h]&&d.push(h.replace(Se,Ie).replace(Se,o).replace(Oe,z)+"="+f[h].replace(Se,Ie).replace(Se,o).replace(Ae,z));return d.length&&(t.query=d.join("&")),t}},je=/^([^\:]+)\:(.*)/,xe={scheme:"urn",parse:function(e,r){var t=e.path&&e.path.match(je),n=e;if(t){var o=r.scheme||n.scheme||"urn",a=t[1].toLowerCase(),i=t[2],s=o+":"+(r.nid||a),c=L[s];n.nid=a,n.nss=i,n.path=void 0,c&&(n=c.parse(n,r))}else n.error=n.error||"URN can not be parsed.";return n},serialize:function(e,r){var t=r.scheme||e.scheme||"urn",n=e.nid,o=t+":"+(r.nid||n),a=L[o];a&&(e=a.serialize(e,r));var i=e,s=e.nss;return i.path=(n||r.nid)+":"+s,i}},Pe=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,$e={scheme:"urn:uuid",parse:function(e,r){var t=e;return t.uuid=t.nss,t.nss=void 0,r.tolerant||t.uuid&&t.uuid.match(Pe)||(t.error=t.error||"UUID is not valid."),t},serialize:function(e,r){var t=e;return t.nss=(e.uuid||"").toLowerCase(),t}};L[ue.scheme]=ue,L[le.scheme]=le,L[fe.scheme]=fe,L[de.scheme]=de,L[Te.scheme]=Te,L[xe.scheme]=xe,L[$e.scheme]=$e,e.SCHEMES=L,e.pctEncChar=z,e.pctDecChars=H,e.parse=G,e.removeDotSegments=re,e.serialize=te,e.resolveComponents=ne,e.resolve=oe,e.normalize=ae,e.equal=ie,e.escapeComponent=se,e.unescapeComponent=ce,Object.defineProperty(e,"__esModule",{value:!0})}(r)}));(a=i)&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")&&a.default;const s={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var c={jsonTypeOf:(e,r)=>s[r](e),resolveUrl:(e,r)=>{const t=i.resolve(e,r,{iri:!0});if(i.resolve(e,"",{iri:!0})&&"file"===i.parse(t).scheme&&"file"!==i.parse(e).scheme)throw Error(`Can't access file '${t}' resource from network context '${e}'`);return t},urlFragment:e=>i.unescapeComponent(i.parse(e).fragment)||"",pathRelative:(e,r)=>{if(e===r)return"";let t=1;const n=e.length-1,o=r.length-t,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==r.charCodeAt(t+s))break;47===n&&(i=s)}if(o>a){if(47===r.charCodeAt(t+s))return r.slice(t+s+1);if(0===s)return r.slice(t+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return t+=i,c.length>0?`${c}${r.slice(t,r.length)}`:(47===r.charCodeAt(t)&&++t,r.slice(t,r.length))}};const u=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(y)},l=(e,r,t,n)=>{if(0===e.length)return t;if(e.length>1){const o=e.shift();return{...r,[o]:l(e,g(r,o,n),t,h(o,n))}}if(Array.isArray(r)){const n=[...r];return n[m(r,e[0])]=t,n}return"object"==typeof r&&null!==r?{...r,[e[0]]:t}:g(r,e[0],n)},p=(e,r,t,n)=>{if(0!==e.length)if(1!==e.length||b(r)){const o=e.shift();p(e,g(r,o,n),t,h(o,n))}else{r[m(r,e[0])]=t}},f=(e,r,t)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=g(r,n,t);return{...r,[n]:f(e,o,h(n,t))}}if(Array.isArray(r))return r.filter(((r,t)=>t!=e[0]));if("object"==typeof r&&null!==r){const{[e[0]]:t,...n}=r;return n}return g(r,e[0],t)}},d=(e,r,t)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=g(r,n,t);d(e,o,h(n,t))}else Array.isArray(r)?r.splice(e[0],1):"object"==typeof r&&null!==r?delete r[e[0]]:g(r,e[0],t)},h=r(((e,r)=>r+"/"+v(e))),v=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),y=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),m=(e,r)=>Array.isArray(e)&&"-"===r?e.length:r,g=(e,r,t="")=>{if(void 0===e)throw TypeError(`Value at '${t}' is undefined and does not have property '${r}'`);if(null===e)throw TypeError(`Value at '${t}' is null and does not have property '${r}'`);if(b(e))throw TypeError(`Value at '${t}' is a ${typeof e} and does not have property '${r}'`);return e[m(e,r)]},b=e=>null===e||"object"!=typeof e;var w={nil:"",append:h,get:(e,r)=>{const t=u(e),n=e=>t.reduce((([e,r],t)=>[g(e,t,r),h(t,r)]),[e,""])[0];return void 0===r?n:n(r)},set:(e,t,n)=>{const o=u(e),a=r(((e,r)=>l(o,e,r,"")));return void 0===t?a:a(t,n)},assign:(e,t,n)=>{const o=u(e),a=r(((e,r)=>p(o,e,r,"")));return void 0===t?a:a(t,n)},unset:(e,r)=>{const t=u(e),n=e=>f(t,e,"");return void 0===r?n:n(r)},remove:(e,r)=>{const t=u(e),n=e=>d(t,e,"");return void 0===r?n:n(r)}};w.nil,w.append,w.get,w.set,w.assign,w.unset,w.remove;const E=Symbol("$__value"),S=Symbol("$__href");var C={cons:(e,r)=>Object.freeze({[S]:e,[E]:r}),isReference:e=>e&&void 0!==e[S],href:e=>e[S],value:e=>e[E]};const{resolveUrl:O,jsonTypeOf:A}=c,I=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>C.isReference(e.value)?C.value(e.value):e.value,j=r(((e,r)=>A(T(e),r))),x=(e,r)=>Object.freeze({...r,pointer:w.append(e,r.pointer),value:T(r)[e]}),P=r(((e,r)=>T(r).map(((t,n,o,a)=>e(x(n,r),n,o,a))))),$=r(((e,r)=>T(r).map(((e,t,n,o)=>x(t,r))).filter(((r,t,n,o)=>e(r,t,n,o))))),D=r(((e,r,t)=>T(t).reduce(((r,n,o)=>e(r,x(o,t),o)),r))),R=r(((e,r)=>T(r).every(((t,n,o,a)=>e(x(n,r),n,o,a))))),N=r(((e,r)=>T(r).some(((t,n,o,a)=>e(x(n,r),n,o,a)))));var F={nil:I,cons:(e,r="")=>Object.freeze({...I,id:O(r,""),instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,has:(e,r)=>e in T(r),typeOf:j,step:x,entries:e=>Object.keys(T(e)).map((r=>[r,x(r,e)])),keys:e=>Object.keys(T(e)),map:P,filter:$,reduce:D,every:R,some:N,length:e=>T(e).length},_=async e=>Object.entries(await e),k=r((async(e,r)=>(await r).map(e))),U=r((async(e,r,t)=>(await t).reduce((async(r,t)=>e(await r,t)),r))),q=r((async(e,r,t={})=>U((async(r,t)=>await e(t)?r.concat([t]):r),[],r,t))),L=r((async(e,r)=>{const t=await k(e,r);return(await Promise.all(t)).some((e=>e))})),z=r((async(e,r)=>{const t=await k(e,r);return(await Promise.all(t)).every((e=>e))})),H=r(((e,r)=>e.reduce((async(e,r)=>r(await e)),r))),V={entries:_,map:k,filter:q,reduce:U,some:L,every:z,pipeline:H,all:e=>Promise.all(e),allValues:e=>H([_,U((async(e,[r,t])=>(e[r]=await t,e)),{})],e)};V.entries,V.map,V.filter,V.reduce,V.some,V.every,V.pipeline,V.all,V.allValues;var K=fetch,M=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,Z=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,J=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,B=/\\([\u000b\u0020-\u00ff])/g,G=/([\\"])/g,W=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,Q=function(e){if(!e)throw new TypeError("argument string is required");var r="object"==typeof e?function(e){var r;"function"==typeof e.getHeader?r=e.getHeader("content-type"):"object"==typeof e.headers&&(r=e.headers&&e.headers["content-type"]);if("string"!=typeof r)throw new TypeError("content-type header is missing from object");return r}(e):e;if("string"!=typeof r)throw new TypeError("argument string is required to be a string");var t=r.indexOf(";"),n=-1!==t?r.substr(0,t).trim():r.trim();if(!W.test(n))throw new TypeError("invalid media type");var o=new X(n.toLowerCase());if(-1!==t){var a,i,s;for(M.lastIndex=t;i=M.exec(r);){if(i.index!==t)throw new TypeError("invalid parameter format");t+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(B,"$1")),o.parameters[a]=s}if(t!==r.length)throw new TypeError("invalid parameter format")}return o}; | ||
!function(e){function r(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];if(r.length>1){r[0]=r[0].slice(0,-1);for(var n=r.length-1,o=1;o<n;++o)r[o]=r[o].slice(1,-1);return r[n]=r[n].slice(1),r.join("")}return r[0]}function t(e){return"(?:"+e+")"}function n(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function o(e){return e.toUpperCase()}function a(e){return null!=e?e instanceof Array?e:"number"!=typeof e.length||e.split||e.setInterval||e.call?[e]:Array.prototype.slice.call(e):[]}function i(e,r){var t=e;if(r)for(var n in r)t[n]=r[n];return t}function s(e){var n="[A-Za-z]",o="[0-9]",a=r(o,"[A-Fa-f]"),i=t(t("%[EFef]"+a+"%"+a+a+"%"+a+a)+"|"+t("%[89A-Fa-f]"+a+"%"+a+a)+"|"+t("%"+a+a)),s="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",c=r("[\\:\\/\\?\\#\\[\\]\\@]",s),u=e?"[\\uE000-\\uF8FF]":"[]",l=r(n,o,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]");t(n+r(n,o,"[\\+\\-\\.]")+"*"),t(t(i+"|"+r(l,s,"[\\:]"))+"*");var p=t(t("25[0-5]")+"|"+t("2[0-4]"+o)+"|"+t("1"+o+o)+"|"+t("0?[1-9]"+o)+"|0?0?"+o),f=t(p+"\\."+p+"\\."+p+"\\."+p),d=t(a+"{1,4}"),h=t(t(d+"\\:"+d)+"|"+f),v=t(t(d+"\\:")+"{6}"+h),y=t("\\:\\:"+t(d+"\\:")+"{5}"+h),m=t(t(d)+"?\\:\\:"+t(d+"\\:")+"{4}"+h),g=t(t(t(d+"\\:")+"{0,1}"+d)+"?\\:\\:"+t(d+"\\:")+"{3}"+h),b=t(t(t(d+"\\:")+"{0,2}"+d)+"?\\:\\:"+t(d+"\\:")+"{2}"+h),w=t(t(t(d+"\\:")+"{0,3}"+d)+"?\\:\\:"+d+"\\:"+h),E=t(t(t(d+"\\:")+"{0,4}"+d)+"?\\:\\:"+h),S=t(t(t(d+"\\:")+"{0,5}"+d)+"?\\:\\:"+d),C=t(t(t(d+"\\:")+"{0,6}"+d)+"?\\:\\:"),O=t([v,y,m,g,b,w,E,S,C].join("|")),A=t(t(l+"|"+i)+"+");t("[vV]"+a+"+\\."+r(l,s,"[\\:]")+"+"),t(t(i+"|"+r(l,s))+"*");var I=t(i+"|"+r(l,s,"[\\:\\@]"));return t(t(i+"|"+r(l,s,"[\\@]"))+"+"),t(t(I+"|"+r("[\\/\\?]",u))+"*"),{NOT_SCHEME:new RegExp(r("[^]",n,o,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(r("[^\\%\\:]",l,s),"g"),NOT_HOST:new RegExp(r("[^\\%\\[\\]\\:]",l,s),"g"),NOT_PATH:new RegExp(r("[^\\%\\/\\:\\@]",l,s),"g"),NOT_PATH_NOSCHEME:new RegExp(r("[^\\%\\/\\@]",l,s),"g"),NOT_QUERY:new RegExp(r("[^\\%]",l,s,"[\\:\\@\\/\\?]",u),"g"),NOT_FRAGMENT:new RegExp(r("[^\\%]",l,s,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(r("[^]",l,s),"g"),UNRESERVED:new RegExp(l,"g"),OTHER_CHARS:new RegExp(r("[^\\%]",l,c),"g"),PCT_ENCODED:new RegExp(i,"g"),IPV4ADDRESS:new RegExp("^("+f+")$"),IPV6ADDRESS:new RegExp("^\\[?("+O+")"+t(t("\\%25|\\%(?!"+a+"{2})")+"("+A+")")+"?\\]?$")}}var c=s(!1),u=s(!0),l=function(){function e(e,r){var t=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(t.push(i.value),!r||t.length!==r);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return t}return function(r,t){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return e(r,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(e){if(Array.isArray(e)){for(var r=0,t=Array(e.length);r<e.length;r++)t[r]=e[r];return t}return Array.from(e)},f=2147483647,d=36,h=1,v=26,y=38,m=700,g=72,b=128,w="-",E=/^xn--/,S=/[^\0-\x7E]/,C=/[\x2E\u3002\uFF0E\uFF61]/g,O={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},A=d-h,I=Math.floor,T=String.fromCharCode;function j(e){throw new RangeError(O[e])}function x(e,r){for(var t=[],n=e.length;n--;)t[n]=r(e[n]);return t}function P(e,r){var t=e.split("@"),n="";return t.length>1&&(n=t[0]+"@",e=t[1]),n+x((e=e.replace(C,".")).split("."),r).join(".")}function $(e){for(var r=[],t=0,n=e.length;t<n;){var o=e.charCodeAt(t++);if(o>=55296&&o<=56319&&t<n){var a=e.charCodeAt(t++);56320==(64512&a)?r.push(((1023&o)<<10)+(1023&a)+65536):(r.push(o),t--)}else r.push(o)}return r}var D=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:d},R=function(e,r){return e+22+75*(e<26)-((0!=r)<<5)},N=function(e,r,t){var n=0;for(e=t?I(e/m):e>>1,e+=I(e/r);e>A*v>>1;n+=d)e=I(e/A);return I(n+(A+1)*e/(e+y))},F=function(e){var r=[],t=e.length,n=0,o=b,a=g,i=e.lastIndexOf(w);i<0&&(i=0);for(var s=0;s<i;++s)e.charCodeAt(s)>=128&&j("not-basic"),r.push(e.charCodeAt(s));for(var c=i>0?i+1:0;c<t;){for(var u=n,l=1,p=d;;p+=d){c>=t&&j("invalid-input");var y=D(e.charCodeAt(c++));(y>=d||y>I((f-n)/l))&&j("overflow"),n+=y*l;var m=p<=a?h:p>=a+v?v:p-a;if(y<m)break;var E=d-m;l>I(f/E)&&j("overflow"),l*=E}var S=r.length+1;a=N(n-u,S,0==u),I(n/S)>f-o&&j("overflow"),o+=I(n/S),n%=S,r.splice(n++,0,o)}return String.fromCodePoint.apply(String,r)},_=function(e){var r=[],t=(e=$(e)).length,n=b,o=0,a=g,i=!0,s=!1,c=void 0;try{for(var u,l=e[Symbol.iterator]();!(i=(u=l.next()).done);i=!0){var p=u.value;p<128&&r.push(T(p))}}catch(e){s=!0,c=e}finally{try{!i&&l.return&&l.return()}finally{if(s)throw c}}var y=r.length,m=y;for(y&&r.push(w);m<t;){var E=f,S=!0,C=!1,O=void 0;try{for(var A,x=e[Symbol.iterator]();!(S=(A=x.next()).done);S=!0){var P=A.value;P>=n&&P<E&&(E=P)}}catch(e){C=!0,O=e}finally{try{!S&&x.return&&x.return()}finally{if(C)throw O}}var D=m+1;E-n>I((f-o)/D)&&j("overflow"),o+=(E-n)*D,n=E;var F=!0,_=!1,k=void 0;try{for(var U,q=e[Symbol.iterator]();!(F=(U=q.next()).done);F=!0){var L=U.value;if(L<n&&++o>f&&j("overflow"),L==n){for(var z=o,H=d;;H+=d){var V=H<=a?h:H>=a+v?v:H-a;if(z<V)break;var M=z-V,K=d-V;r.push(T(R(V+M%K,0))),z=I(M/K)}r.push(T(R(z,0))),a=N(o,D,m==y),o=0,++m}}}catch(e){_=!0,k=e}finally{try{!F&&q.return&&q.return()}finally{if(_)throw k}}++o,++n}return r.join("")},k=function(e){return P(e,(function(e){return E.test(e)?F(e.slice(4).toLowerCase()):e}))},U=function(e){return P(e,(function(e){return S.test(e)?"xn--"+_(e):e}))},q={version:"2.1.0",ucs2:{decode:$,encode:function(e){return String.fromCodePoint.apply(String,p(e))}},decode:F,encode:_,toASCII:U,toUnicode:k},L={};function z(e){var r=e.charCodeAt(0);return r<16?"%0"+r.toString(16).toUpperCase():r<128?"%"+r.toString(16).toUpperCase():r<2048?"%"+(r>>6|192).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase():"%"+(r>>12|224).toString(16).toUpperCase()+"%"+(r>>6&63|128).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase()}function H(e){for(var r="",t=0,n=e.length;t<n;){var o=parseInt(e.substr(t+1,2),16);if(o<128)r+=String.fromCharCode(o),t+=3;else if(o>=194&&o<224){if(n-t>=6){var a=parseInt(e.substr(t+4,2),16);r+=String.fromCharCode((31&o)<<6|63&a)}else r+=e.substr(t,6);t+=6}else if(o>=224){if(n-t>=9){var i=parseInt(e.substr(t+4,2),16),s=parseInt(e.substr(t+7,2),16);r+=String.fromCharCode((15&o)<<12|(63&i)<<6|63&s)}else r+=e.substr(t,9);t+=9}else r+=e.substr(t,3),t+=3}return r}function V(e,r){function t(e){var t=H(e);return t.match(r.UNRESERVED)?t:e}return e.scheme&&(e.scheme=String(e.scheme).replace(r.PCT_ENCODED,t).toLowerCase().replace(r.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(r.PCT_ENCODED,t).replace(r.NOT_USERINFO,z).replace(r.PCT_ENCODED,o)),void 0!==e.host&&(e.host=String(e.host).replace(r.PCT_ENCODED,t).toLowerCase().replace(r.NOT_HOST,z).replace(r.PCT_ENCODED,o)),void 0!==e.path&&(e.path=String(e.path).replace(r.PCT_ENCODED,t).replace(e.scheme?r.NOT_PATH:r.NOT_PATH_NOSCHEME,z).replace(r.PCT_ENCODED,o)),void 0!==e.query&&(e.query=String(e.query).replace(r.PCT_ENCODED,t).replace(r.NOT_QUERY,z).replace(r.PCT_ENCODED,o)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(r.PCT_ENCODED,t).replace(r.NOT_FRAGMENT,z).replace(r.PCT_ENCODED,o)),e}function M(e){return e.replace(/^0*(.*)/,"$1")||"0"}function K(e,r){var t=e.match(r.IPV4ADDRESS)||[],n=l(t,2)[1];return n?n.split(".").map(M).join("."):e}function Z(e,r){var t=e.match(r.IPV6ADDRESS)||[],n=l(t,3),o=n[1],a=n[2];if(o){for(var i=o.toLowerCase().split("::").reverse(),s=l(i,2),c=s[0],u=s[1],p=u?u.split(":").map(M):[],f=c.split(":").map(M),d=r.IPV4ADDRESS.test(f[f.length-1]),h=d?7:8,v=f.length-h,y=Array(h),m=0;m<h;++m)y[m]=p[m]||f[v+m]||"";d&&(y[h-1]=K(y[h-1],r));var g=y.reduce((function(e,r,t){if(!r||"0"===r){var n=e[e.length-1];n&&n.index+n.length===t?n.length++:e.push({index:t,length:1})}return e}),[]).sort((function(e,r){return r.length-e.length}))[0],b=void 0;if(g&&g.length>1){var w=y.slice(0,g.index),E=y.slice(g.index+g.length);b=w.join(":")+"::"+E.join(":")}else b=y.join(":");return a&&(b+="%"+a),b}return e}var J=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,B=void 0==="".match(/(){0}/)[1];function G(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={},n=!1!==r.iri?u:c;"suffix"===r.reference&&(e=(r.scheme?r.scheme+":":"")+"//"+e);var o=e.match(J);if(o){B?(t.scheme=o[1],t.userinfo=o[3],t.host=o[4],t.port=parseInt(o[5],10),t.path=o[6]||"",t.query=o[7],t.fragment=o[8],isNaN(t.port)&&(t.port=o[5])):(t.scheme=o[1]||void 0,t.userinfo=-1!==e.indexOf("@")?o[3]:void 0,t.host=-1!==e.indexOf("//")?o[4]:void 0,t.port=parseInt(o[5],10),t.path=o[6]||"",t.query=-1!==e.indexOf("?")?o[7]:void 0,t.fragment=-1!==e.indexOf("#")?o[8]:void 0,isNaN(t.port)&&(t.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?o[4]:void 0)),t.host&&(t.host=Z(K(t.host,n),n)),void 0!==t.scheme||void 0!==t.userinfo||void 0!==t.host||void 0!==t.port||t.path||void 0!==t.query?void 0===t.scheme?t.reference="relative":void 0===t.fragment?t.reference="absolute":t.reference="uri":t.reference="same-document",r.reference&&"suffix"!==r.reference&&r.reference!==t.reference&&(t.error=t.error||"URI is not a "+r.reference+" reference.");var a=L[(r.scheme||t.scheme||"").toLowerCase()];if(r.unicodeSupport||a&&a.unicodeSupport)V(t,n);else{if(t.host&&(r.domainHost||a&&a.domainHost))try{t.host=q.toASCII(t.host.replace(n.PCT_ENCODED,H).toLowerCase())}catch(e){t.error=t.error||"Host's domain name can not be converted to ASCII via punycode: "+e}V(t,c)}a&&a.parse&&a.parse(t,r)}else t.error=t.error||"URI can not be parsed.";return t}function W(e,r){var t=!1!==r.iri?u:c,n=[];return void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host&&n.push(Z(K(String(e.host),t),t).replace(t.IPV6ADDRESS,(function(e,r,t){return"["+r+(t?"%25"+t:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0}var Q=/^\.\.?\//,Y=/^\/\.(\/|$)/,X=/^\/\.\.(\/|$)/,ee=/^\/?(?:.|\n)*?(?=\/|$)/;function re(e){for(var r=[];e.length;)if(e.match(Q))e=e.replace(Q,"");else if(e.match(Y))e=e.replace(Y,"/");else if(e.match(X))e=e.replace(X,"/"),r.pop();else if("."===e||".."===e)e="";else{var t=e.match(ee);if(!t)throw new Error("Unexpected dot segment condition");var n=t[0];e=e.slice(n.length),r.push(n)}return r.join("")}function te(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=r.iri?u:c,n=[],o=L[(r.scheme||e.scheme||"").toLowerCase()];if(o&&o.serialize&&o.serialize(e,r),e.host)if(t.IPV6ADDRESS.test(e.host));else if(r.domainHost||o&&o.domainHost)try{e.host=r.iri?q.toUnicode(e.host):q.toASCII(e.host.replace(t.PCT_ENCODED,H).toLowerCase())}catch(t){e.error=e.error||"Host's domain name can not be converted to "+(r.iri?"Unicode":"ASCII")+" via punycode: "+t}V(e,t),"suffix"!==r.reference&&e.scheme&&(n.push(e.scheme),n.push(":"));var a=W(e,r);if(void 0!==a&&("suffix"!==r.reference&&n.push("//"),n.push(a),e.path&&"/"!==e.path.charAt(0)&&n.push("/")),void 0!==e.path){var i=e.path;r.absolutePath||o&&o.absolutePath||(i=re(i)),void 0===a&&(i=i.replace(/^\/\//,"/%2F")),n.push(i)}return void 0!==e.query&&(n.push("?"),n.push(e.query)),void 0!==e.fragment&&(n.push("#"),n.push(e.fragment)),n.join("")}function ne(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};return arguments[3]||(e=G(te(e,t),t),r=G(te(r,t),t)),!(t=t||{}).tolerant&&r.scheme?(n.scheme=r.scheme,n.userinfo=r.userinfo,n.host=r.host,n.port=r.port,n.path=re(r.path||""),n.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(n.userinfo=r.userinfo,n.host=r.host,n.port=r.port,n.path=re(r.path||""),n.query=r.query):(r.path?("/"===r.path.charAt(0)?n.path=re(r.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+r.path:n.path=r.path:n.path="/"+r.path,n.path=re(n.path)),n.query=r.query):(n.path=e.path,void 0!==r.query?n.query=r.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=r.fragment,n}function oe(e,r,t){var n=i({scheme:"null"},t);return te(ne(G(e,n),G(r,n),n,!0),n)}function ae(e,r){return"string"==typeof e?e=te(G(e,r),r):"object"===n(e)&&(e=G(te(e,r),r)),e}function ie(e,r,t){return"string"==typeof e?e=te(G(e,t),t):"object"===n(e)&&(e=te(e,t)),"string"==typeof r?r=te(G(r,t),t):"object"===n(r)&&(r=te(r,t)),e===r}function se(e,r){return e&&e.toString().replace(r&&r.iri?u.ESCAPE:c.ESCAPE,z)}function ce(e,r){return e&&e.toString().replace(r&&r.iri?u.PCT_ENCODED:c.PCT_ENCODED,H)}var ue={scheme:"http",domainHost:!0,parse:function(e,r){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,r){var t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},le={scheme:"https",domainHost:ue.domainHost,parse:ue.parse,serialize:ue.serialize};function pe(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var fe={scheme:"ws",domainHost:!0,parse:function(e,r){var t=e;return t.secure=pe(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t},serialize:function(e,r){if(e.port!==(pe(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var t=e.resourceName.split("?"),n=l(t,2),o=n[0],a=n[1];e.path=o&&"/"!==o?o:void 0,e.query=a,e.resourceName=void 0}return e.fragment=void 0,e}},de={scheme:"wss",domainHost:fe.domainHost,parse:fe.parse,serialize:fe.serialize},he={},ve="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ye="[0-9A-Fa-f]",me=t(t("%[EFef]"+ye+"%"+ye+ye+"%"+ye+ye)+"|"+t("%[89A-Fa-f]"+ye+"%"+ye+ye)+"|"+t("%"+ye+ye)),ge="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",be=r("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),we="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Ee=new RegExp(ve,"g"),Se=new RegExp(me,"g"),Ce=new RegExp(r("[^]",ge,"[\\.]",'[\\"]',be),"g"),Oe=new RegExp(r("[^]",ve,we),"g"),Ae=Oe;function Ie(e){var r=H(e);return r.match(Ee)?r:e}var Te={scheme:"mailto",parse:function(e,r){var t=e,n=t.to=t.path?t.path.split(","):[];if(t.path=void 0,t.query){for(var o=!1,a={},i=t.query.split("&"),s=0,c=i.length;s<c;++s){var u=i[s].split("=");switch(u[0]){case"to":for(var l=u[1].split(","),p=0,f=l.length;p<f;++p)n.push(l[p]);break;case"subject":t.subject=ce(u[1],r);break;case"body":t.body=ce(u[1],r);break;default:o=!0,a[ce(u[0],r)]=ce(u[1],r)}}o&&(t.headers=a)}t.query=void 0;for(var d=0,h=n.length;d<h;++d){var v=n[d].split("@");if(v[0]=ce(v[0]),r.unicodeSupport)v[1]=ce(v[1],r).toLowerCase();else try{v[1]=q.toASCII(ce(v[1],r).toLowerCase())}catch(e){t.error=t.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}n[d]=v.join("@")}return t},serialize:function(e,r){var t=e,n=a(e.to);if(n){for(var i=0,s=n.length;i<s;++i){var c=String(n[i]),u=c.lastIndexOf("@"),l=c.slice(0,u).replace(Se,Ie).replace(Se,o).replace(Ce,z),p=c.slice(u+1);try{p=r.iri?q.toUnicode(p):q.toASCII(ce(p,r).toLowerCase())}catch(e){t.error=t.error||"Email address's domain name can not be converted to "+(r.iri?"Unicode":"ASCII")+" via punycode: "+e}n[i]=l+"@"+p}t.path=n.join(",")}var f=e.headers=e.headers||{};e.subject&&(f.subject=e.subject),e.body&&(f.body=e.body);var d=[];for(var h in f)f[h]!==he[h]&&d.push(h.replace(Se,Ie).replace(Se,o).replace(Oe,z)+"="+f[h].replace(Se,Ie).replace(Se,o).replace(Ae,z));return d.length&&(t.query=d.join("&")),t}},je=/^([^\:]+)\:(.*)/,xe={scheme:"urn",parse:function(e,r){var t=e.path&&e.path.match(je),n=e;if(t){var o=r.scheme||n.scheme||"urn",a=t[1].toLowerCase(),i=t[2],s=o+":"+(r.nid||a),c=L[s];n.nid=a,n.nss=i,n.path=void 0,c&&(n=c.parse(n,r))}else n.error=n.error||"URN can not be parsed.";return n},serialize:function(e,r){var t=r.scheme||e.scheme||"urn",n=e.nid,o=t+":"+(r.nid||n),a=L[o];a&&(e=a.serialize(e,r));var i=e,s=e.nss;return i.path=(n||r.nid)+":"+s,i}},Pe=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,$e={scheme:"urn:uuid",parse:function(e,r){var t=e;return t.uuid=t.nss,t.nss=void 0,r.tolerant||t.uuid&&t.uuid.match(Pe)||(t.error=t.error||"UUID is not valid."),t},serialize:function(e,r){var t=e;return t.nss=(e.uuid||"").toLowerCase(),t}};L[ue.scheme]=ue,L[le.scheme]=le,L[fe.scheme]=fe,L[de.scheme]=de,L[Te.scheme]=Te,L[xe.scheme]=xe,L[$e.scheme]=$e,e.SCHEMES=L,e.pctEncChar=z,e.pctDecChars=H,e.parse=G,e.removeDotSegments=re,e.serialize=te,e.resolveComponents=ne,e.resolve=oe,e.normalize=ae,e.equal=ie,e.escapeComponent=se,e.unescapeComponent=ce,Object.defineProperty(e,"__esModule",{value:!0})}(r)}));(a=i)&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")&&a.default;const s={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var c={jsonTypeOf:(e,r)=>s[r](e),resolveUrl:(e,r)=>{const t=i.resolve(e,r,{iri:!0});if(i.resolve(e,"",{iri:!0})&&"file"===i.parse(t).scheme&&"file"!==i.parse(e).scheme)throw Error(`Can't access file '${t}' resource from network context '${e}'`);return t},urlFragment:e=>i.unescapeComponent(i.parse(e).fragment)||"",pathRelative:(e,r)=>{if(e===r)return"";let t=1;const n=e.length-1,o=r.length-t,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==r.charCodeAt(t+s))break;47===n&&(i=s)}if(o>a){if(47===r.charCodeAt(t+s))return r.slice(t+s+1);if(0===s)return r.slice(t+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return t+=i,c.length>0?`${c}${r.slice(t,r.length)}`:(47===r.charCodeAt(t)&&++t,r.slice(t,r.length))}};const u=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(y)},l=(e,r,t,n)=>{if(0===e.length)return t;if(e.length>1){const o=e.shift();return{...r,[o]:l(e,g(r,o,n),t,h(o,n))}}if(Array.isArray(r)){const n=[...r];return n[m(r,e[0])]=t,n}return"object"==typeof r&&null!==r?{...r,[e[0]]:t}:g(r,e[0],n)},p=(e,r,t,n)=>{if(0!==e.length)if(1!==e.length||b(r)){const o=e.shift();p(e,g(r,o,n),t,h(o,n))}else{r[m(r,e[0])]=t}},f=(e,r,t)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=g(r,n,t);return{...r,[n]:f(e,o,h(n,t))}}if(Array.isArray(r))return r.filter(((r,t)=>t!=e[0]));if("object"==typeof r&&null!==r){const{[e[0]]:t,...n}=r;return n}return g(r,e[0],t)}},d=(e,r,t)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=g(r,n,t);d(e,o,h(n,t))}else Array.isArray(r)?r.splice(e[0],1):"object"==typeof r&&null!==r?delete r[e[0]]:g(r,e[0],t)},h=r(((e,r)=>r+"/"+v(e))),v=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),y=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),m=(e,r)=>Array.isArray(e)&&"-"===r?e.length:r,g=(e,r,t="")=>{if(void 0===e)throw TypeError(`Value at '${t}' is undefined and does not have property '${r}'`);if(null===e)throw TypeError(`Value at '${t}' is null and does not have property '${r}'`);if(b(e))throw TypeError(`Value at '${t}' is a ${typeof e} and does not have property '${r}'`);return e[m(e,r)]},b=e=>null===e||"object"!=typeof e;var w={nil:"",append:h,get:(e,r)=>{const t=u(e),n=e=>t.reduce((([e,r],t)=>[g(e,t,r),h(t,r)]),[e,""])[0];return void 0===r?n:n(r)},set:(e,t,n)=>{const o=u(e),a=r(((e,r)=>l(o,e,r,"")));return void 0===t?a:a(t,n)},assign:(e,t,n)=>{const o=u(e),a=r(((e,r)=>p(o,e,r,"")));return void 0===t?a:a(t,n)},unset:(e,r)=>{const t=u(e),n=e=>f(t,e,"");return void 0===r?n:n(r)},remove:(e,r)=>{const t=u(e),n=e=>d(t,e,"");return void 0===r?n:n(r)}};w.nil,w.append,w.get,w.set,w.assign,w.unset,w.remove;const E=Symbol("$__value"),S=Symbol("$__href");var C={cons:(e,r)=>Object.freeze({[S]:e,[E]:r}),isReference:e=>e&&void 0!==e[S],href:e=>e[S],value:e=>e[E]};const{resolveUrl:O,jsonTypeOf:A}=c,I=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>C.isReference(e.value)?C.value(e.value):e.value,j=r(((e,r)=>A(T(e),r))),x=(e,r)=>Object.freeze({...r,pointer:w.append(e,r.pointer),value:T(r)[e]}),P=r(((e,r)=>T(r).map(((t,n,o,a)=>e(x(n,r),n,o,a))))),$=r(((e,r)=>T(r).map(((e,t,n,o)=>x(t,r))).filter(((r,t,n,o)=>e(r,t,n,o))))),D=r(((e,r,t)=>T(t).reduce(((r,n,o)=>e(r,x(o,t),o)),r))),R=r(((e,r)=>T(r).every(((t,n,o,a)=>e(x(n,r),n,o,a))))),N=r(((e,r)=>T(r).some(((t,n,o,a)=>e(x(n,r),n,o,a)))));var F={nil:I,cons:(e,r="")=>Object.freeze({...I,id:O(r,""),instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,has:(e,r)=>e in T(r),typeOf:j,step:x,entries:e=>Object.keys(T(e)).map((r=>[r,x(r,e)])),keys:e=>Object.keys(T(e)),map:P,filter:$,reduce:D,every:R,some:N,length:e=>T(e).length},_=async e=>Object.entries(await e),k=r((async(e,r)=>(await r).map(e))),U=r((async(e,r,t)=>(await t).reduce((async(r,t)=>e(await r,t)),r))),q=r((async(e,r,t={})=>U((async(r,t)=>await e(t)?r.concat([t]):r),[],r,t))),L=r((async(e,r)=>{const t=await k(e,r);return(await Promise.all(t)).some((e=>e))})),z=r((async(e,r)=>{const t=await k(e,r);return(await Promise.all(t)).every((e=>e))})),H=r(((e,r)=>e.reduce((async(e,r)=>r(await e)),r))),V={entries:_,map:k,filter:q,reduce:U,some:L,every:z,pipeline:H,all:e=>Promise.all(e),allValues:e=>H([_,U((async(e,[r,t])=>(e[r]=await t,e)),{})],e)};V.entries,V.map,V.filter,V.reduce,V.some,V.every,V.pipeline,V.all,V.allValues;var M=fetch,K=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,Z=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,J=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,B=/\\([\u000b\u0020-\u00ff])/g,G=/([\\"])/g,W=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,Q=function(e){if(!e)throw new TypeError("argument string is required");var r="object"==typeof e?function(e){var r;"function"==typeof e.getHeader?r=e.getHeader("content-type"):"object"==typeof e.headers&&(r=e.headers&&e.headers["content-type"]);if("string"!=typeof r)throw new TypeError("content-type header is missing from object");return r}(e):e;if("string"!=typeof r)throw new TypeError("argument string is required to be a string");var t=r.indexOf(";"),n=-1!==t?r.substr(0,t).trim():r.trim();if(!W.test(n))throw new TypeError("invalid media type");var o=new X(n.toLowerCase());if(-1!==t){var a,i,s;for(K.lastIndex=t;i=K.exec(r);){if(i.index!==t)throw new TypeError("invalid parameter format");t+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(B,"$1")),o.parameters[a]=s}if(t!==r.length)throw new TypeError("invalid parameter format")}return o}; | ||
/*! | ||
@@ -8,3 +8,3 @@ * content-type | ||
* MIT Licensed | ||
*/function Y(e){var r=String(e);if(J.test(r))return r;if(r.length>0&&!Z.test(r))throw new TypeError("invalid parameter value");return'"'+r.replace(G,"\\$1")+'"'}function X(e){this.parameters=Object.create(null),this.type=e}var ee={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var r=e.parameters,t=e.type;if(!t||!W.test(t))throw new TypeError("invalid type");var n=t;if(r&&"object"==typeof r)for(var o,a=Object.keys(r).sort(),i=0;i<a.length;i++){if(o=a[i],!J.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Y(r[o])}return n},parse:Q};const re={};var te={addPlugin:(e,r)=>{re[e]=r},parse:e=>{const r=ee.parse(e.headers.get("content-type")).type;if(!(r in re))throw Error(`${e.url} is not a schema. Found a document with media type: ${r}`);return re[r].parse(e)},getContentType:e=>{for(const r in re)if(re[r].matcher(e))return r;return"application/octet-stream"}};const{jsonTypeOf:ne,resolveUrl:oe,urlFragment:ae,pathRelative:ie}=c,se="https://json-schema.org/draft/2019-09/vocab/core",ce="https://json-schema.org/draft/2020-12/vocab/core",ue={},le={},pe=(e,r)=>{const t=le[e];return ue[t]?.[r]},fe={},de={},he=(e,r="",t="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(r,""),o=oe(e.$schema||t,"");if(!o)throw Error("Couldn't determine schema dialect");if(delete e.$schema,!(o in le))if(!0===e?.$vocabulary?.[se]&&o===ve(e,n,se)[0])le[o]=se;else if(!0===e?.$vocabulary?.[ce]&&o===ve(e,n,ce)[0])le[o]=ce;else if(o===ve(e,n,o)[0])le[o]=o;else{if(!(o in fe))throw Error(`Couldn't determine JSON Schema version for dialect: '${o}'`);{const e=fe[o];!0===e.vocabulary[se]?le[o]=se:!0===e.vocabulary[ce]?le[o]=ce:le[o]=le[e.dialectId]}}const[a,i]=ve(e,n,le[o]);if(!a)throw Error("Couldn't determine an identifier for the schema");const s=pe(o,"baseToken");delete e[s],n&&(de[n]=a);const c=pe(o,"anchorToken");i&&s===c&&(e[c]=c!==s?encodeURI(i):`#${encodeURI(i)}`);const u={},l=pe(o,"recursiveAnchorToken");let p;!0===e[l]&&(u[""]=`${a}#`,e[c]="",delete e[l]);const f=pe(o,"vocabularyToken");ne(e[f],"object")?(p=e[f],delete e[f]):p={[le[o]]:!0};const d={"":""};return fe[a]={id:a,dialectId:o,schema:ye(e,a,o,w.nil,d,u),anchors:d,dynamicAnchors:u,vocabulary:p,validated:!1},a},ve=(e,r,t)=>{const n=ue[t]?.baseToken,o=oe(r,e[n]||"");return[oe(o,""),ae(o)]},ye=(e,r,t,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema,""):t,s=pe(i,"embeddedToken"),c=pe(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(r,e[s]);return e[pe(i,"baseToken")]=n,he(e,n,t),C.cons(e[s],e)}const u=pe(t,"anchorToken"),l=pe(t,"dynamicAnchorToken");"string"==typeof e[l]&&(a[e[l]]=`${r}#${encodeURI(n)}`,o[e[l]]=n,delete e[l]);const p=pe(t,"embeddedToken");if("string"==typeof e[u]){const r=u!==p?e[u]:e[u].slice(1);o[r]=n,delete e[u]}const f=pe(t,"jrefToken");if("string"==typeof e[f])return C.cons(e[f],e);for(const i in e)e[i]=ye(e[i],r,t,w.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ye(e,r,t,w.append(i,n),o,a))):e},me=e=>fe[de[e]]||fe[e],ge=Object.freeze({id:"",dialectId:void 0,vocabulary:{},pointer:w.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),be=async(e,r=ge)=>{const t=oe(Se(r),e),n=oe(t,""),o=ae(t);if(!(e=>e in fe||e in de)(n)){const e=await K(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);he(await te.parse(e),n)}const a=me(n),i="/"!==o[0]?Ee(a,o):o,s=Object.freeze({...a,pointer:i,value:w.get(i,a.schema)});return we(s)},we=e=>C.isReference(e.value)?be(C.href(e.value),e):e,Ee=(e,r)=>{if(!(r in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(r)}'`);return e.anchors[r]},Se=e=>`${e.id}#${encodeURI(e.pointer)}`,Ce=e=>C.isReference(e.value)?C.value(e.value):e.value,Oe=(e,r)=>{const t=me(r.id),n=Object.freeze({...r,pointer:w.append(e,r.pointer),value:Ce(r)[e],validated:t.validated});return we(n)},Ae=r(((e,r)=>V.pipeline([Ce,V.map((async(t,n)=>e(await Oe(n,r),n))),V.all],r))),Ie={parentId:"",parentDialect:"",includeEmbedded:!0},Te=(e,r)=>{if(r.startsWith("file://")){const t=e.slice(7,e.lastIndexOf("/"));return""===e?"":ie(t,r.slice(7))}return r};var je={setConfig:(e,r,t)=>{ue[e]||(ue[e]={}),ue[e][r]=t},getConfig:pe,add:he,get:be,markValidated:e=>{fe[e].validated=!0},uri:Se,value:Ce,getAnchorPointer:Ee,typeOf:(e,r)=>ne(Ce(e),r),has:(e,r)=>e in Ce(r),step:Oe,keys:e=>Object.keys(Ce(e)),entries:e=>V.pipeline([Ce,Object.keys,V.map((async r=>[r,await Oe(r,e)])),V.all],e),map:Ae,length:e=>Ce(e).length,toSchema:(e,r={})=>{const t={...Ie,...r},n=JSON.parse(JSON.stringify(e.schema,((r,n)=>{if(!C.isReference(n))return n;const o=C.value(n),a="string"==typeof o.$schema?oe(o.$schema,""):e.dialectId,i=pe(a,"embeddedToken");return!t.includeEmbedded&&i in o?void 0:C.value(n)}))),o=pe(e.dialectId,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,r])=>{const t=ae(r);w.assign(t,n,{[o]:e,...w.get(t,n)})}));const a=pe(e.dialectId,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,r])=>{w.assign(r,n,{[a]:e,...w.get(r,n)})}));const i=pe(e.dialectId,"baseToken"),s=Te(t.parentId,e.id),c=t.parentDialect===e.dialectId?"":e.dialectId;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};je.setConfig,je.getConfig,je.add,je.get,je.markValidated,je.uri,je.value,je.getAnchorPointer,je.typeOf,je.has,je.step,je.keys,je.entries,je.map,je.length,je.toSchema;class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=xe;const{resolveUrl:$e}=c,De="FLAG",Re="BASIC",Ne="DETAILED",Fe="VERBOSE";let _e=Ne,ke=!0;te.addPlugin("application/schema+json",{parse:async e=>await e.json(),matcher:e=>e.endsWith(".schema.json")});const Ue=async e=>{const r={metaData:{}};return{ast:r,schemaUri:await Ze(e,r)}},qe=r((({ast:e,schemaUri:r},t,n=De)=>{if(![De,Re,Ne,Fe].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Le(n,a));return Be(r,t,e,{}),o.unsubscribe(i),a[0]})),Le=(e,r)=>{const t=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a,errors:[]};t.push(i)}else if("result.start"===n)t.push(n);else if("result.end"===n){const n=t.pop();for(;"result.start"!==t[t.length-1];){const r=t.pop(),o=[r];e===Re&&(o.push(...r.errors),delete r.errors),(e===Fe||e!==De&&!r.valid)&&n.errors.unshift(...o)}t[t.length-1]=n,r[0]=n}}},ze={},He=e=>ze[e],Ve=e=>e in ze,Ke={},Me={},Ze=async(e,r)=>{if(e=await Je(e),!Ve(`${e.dialectId}#validate`)){const r=await je.get(e.dialectId);(je.getConfig(r.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!r.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(r.vocabulary).forEach((([e,t])=>{if(e in Ke)Object.entries(Ke[e]).forEach((([e,t])=>{((e,r)=>{ze[e]={collectEvaluatedItems:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&new Set,collectEvaluatedProperties:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&[],...r}})(`${r.id}#${e}`,t)}));else if(t)throw Error(`Missing required vocabulary: ${e}`)}))}if(ke&&!e.validated){if(je.markValidated(e.id),!(e.dialectId in Me)){const r=await je.get(e.dialectId),t=await Ue(r);Me[r.id]=qe(t)}const r=F.cons(e.schema,e.id),t=Me[e.dialectId](r,_e);if(!t.valid)throw new Pe(t)}return e.id in r.metaData||(r.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),He(`${e.dialectId}#validate`).compile(e,r)},Je=async e=>je.typeOf(e,"string")?Je(await je.get(je.value(e),e)):e,Be=(e,r,t,n)=>{const o=Ge(e,t),a=$e(e,"");return He(o).interpret(e,r,t,{...t.metaData[a].dynamicAnchors,...n})},Ge=(e,r)=>{if(!(e in r))throw Error(`No schema found at ${e}`);return r[e][0]};var We={validate:async(e,r,t)=>{const n=await Ue(e),o=(e,r)=>qe(n,F.cons(e),r);return void 0===r?o:o(r,t)},compile:Ue,interpret:qe,setMetaOutputFormat:e=>{_e=e},setShouldMetaValidate:e=>{ke=e},FLAG:De,BASIC:Re,DETAILED:Ne,VERBOSE:Fe,add:(e,r="",t="")=>{const n=je.add(e,r,t);delete Me[n]},getKeyword:He,hasKeyword:Ve,defineVocabulary:(e,r)=>{Ke[e]=r},compileSchema:Ze,interpretSchema:Be,collectEvaluatedProperties:(e,r,t,n,o)=>{const a=Ge(e,t);return He(a).collectEvaluatedProperties(e,r,t,n,o)},collectEvaluatedItems:(e,r,t,n,o)=>{const a=Ge(e,t);return He(a).collectEvaluatedItems(e,r,t,n,o)},addMediaTypePlugin:te.addPlugin};var Qe={compile:e=>je.value(e),interpret:()=>!0};var Ye={compile:async(e,r)=>{const t=je.uri(e);if(!(t in r)){r[t]=!1;const n=je.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${je.uri(e)}'`);r[t]=[`${e.dialectId}#validate`,je.uri(e),"boolean"==typeof n?n:await V.pipeline([je.entries,V.map((([r,t])=>[`${e.dialectId}#${r}`,t])),V.filter((([r])=>We.hasKeyword(r)&&r!==`${e.dialectId}#validate`)),V.map((async([t,n])=>{const o=await We.getKeyword(t).compile(n,r,e);return[t,je.uri(n),o]})),V.all],e)]}return t},interpret:(e,r,t,n)=>{const[a,i,s]=t[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=We.getKeyword(e).interpret(i,r,t,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:F.uri(r),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:F.uri(r),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&We.getKeyword(o).collectEvaluatedProperties(a,r,t,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&We.getKeyword(o).collectEvaluatedItems(a,r,t,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Xe={metaData:Qe,validate:Ye},er=e("default",{Core:We,Schema:je,Instance:F,Reference:C,Keywords:Xe,InvalidSchemaError:Pe});e("Core",er.Core),e("Schema",er.Schema),e("Instance",er.Instance),e("Reference",er.Reference),e("Keywords",er.Keywords),e("InvalidSchemaError",er.InvalidSchemaError)}}})); | ||
*/function Y(e){var r=String(e);if(J.test(r))return r;if(r.length>0&&!Z.test(r))throw new TypeError("invalid parameter value");return'"'+r.replace(G,"\\$1")+'"'}function X(e){this.parameters=Object.create(null),this.type=e}var ee={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var r=e.parameters,t=e.type;if(!t||!W.test(t))throw new TypeError("invalid type");var n=t;if(r&&"object"==typeof r)for(var o,a=Object.keys(r).sort(),i=0;i<a.length;i++){if(o=a[i],!J.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Y(r[o])}return n},parse:Q};const re={};var te={addPlugin:(e,r)=>{re[e]=r},parse:e=>{const r=ee.parse(e.headers.get("content-type")).type;if(!(r in re))throw Error(`${e.url} is not a schema. Found a document with media type: ${r}`);return re[r].parse(e)},getContentType:e=>{for(const r in re)if(re[r].matcher(e))return r;return"application/octet-stream"}};const{jsonTypeOf:ne,resolveUrl:oe,urlFragment:ae,pathRelative:ie}=c,se="https://json-schema.org/draft/2019-09/vocab/core",ce="https://json-schema.org/draft/2020-12/vocab/core",ue={},le={},pe=(e,r)=>{const t=le[e];return ue[t]?.[r]},fe={},de={},he=(e,r="",t="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(r,""),o=oe(e.$schema||t,"");if(!o)throw Error("Couldn't determine schema dialect");if(delete e.$schema,!(o in le))if(!0===e?.$vocabulary?.[se]&&o===ve(e,n,se)[0])le[o]=se;else if(!0===e?.$vocabulary?.[ce]&&o===ve(e,n,ce)[0])le[o]=ce;else if(o===ve(e,n,o)[0])le[o]=o;else{if(!(o in fe))throw Error(`Couldn't determine JSON Schema version for dialect: '${o}'`);{const e=fe[o];!0===e.vocabulary[se]?le[o]=se:!0===e.vocabulary[ce]?le[o]=ce:le[o]=le[e.dialectId]}}const[a,i]=ve(e,n,le[o]);if(!a)throw Error("Couldn't determine an identifier for the schema");const s=pe(o,"baseToken");delete e[s],n&&(de[n]=a);const c=pe(o,"anchorToken");i&&s===c&&(e[c]=c!==s?encodeURI(i):`#${encodeURI(i)}`);const u={},l=pe(o,"recursiveAnchorToken");let p;!0===e[l]&&(u[""]=`${a}#`,e[c]="",delete e[l]);const f=pe(o,"vocabularyToken");ne(e[f],"object")?(p=e[f],delete e[f]):p={[le[o]]:!0};const d={"":""};return fe[a]={id:a,dialectId:o,schema:ye(e,a,o,w.nil,d,u),anchors:d,dynamicAnchors:u,vocabulary:p,validated:!1},a},ve=(e,r,t)=>{const n=ue[t]?.baseToken,o=oe(r,e[n]||"");return[oe(o,""),ae(o)]},ye=(e,r,t,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema,""):t,s=pe(i,"embeddedToken"),c=pe(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(r,e[s]);return e[pe(i,"baseToken")]=n,he(e,n,t),C.cons(e[s],e)}const u=pe(t,"anchorToken"),l=pe(t,"dynamicAnchorToken");"string"==typeof e[l]&&(a[e[l]]=`${r}#${encodeURI(n)}`,o[e[l]]=n,delete e[l]);const p=pe(t,"embeddedToken");if("string"==typeof e[u]){const r=u!==p?e[u]:e[u].slice(1);o[r]=n,delete e[u]}const f=pe(t,"jrefToken");if("string"==typeof e[f])return C.cons(e[f],e);for(const i in e)e[i]=ye(e[i],r,t,w.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ye(e,r,t,w.append(i,n),o,a))):e},me=e=>fe[de[e]]||fe[e],ge=Object.freeze({id:"",dialectId:void 0,vocabulary:{},pointer:w.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),be=async(e,r=ge)=>{const t=oe(Se(r),e),n=oe(t,""),o=ae(t);if(!(e=>e in fe||e in de)(n)){const e=await M(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);he(await te.parse(e),n)}const a=me(n),i="/"!==o[0]?Ee(a,o):o,s=Object.freeze({...a,pointer:i,value:w.get(i,a.schema)});return we(s)},we=e=>C.isReference(e.value)?be(C.href(e.value),e):e,Ee=(e,r)=>{if(!(r in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(r)}'`);return e.anchors[r]},Se=e=>`${e.id}#${encodeURI(e.pointer)}`,Ce=e=>C.isReference(e.value)?C.value(e.value):e.value,Oe=(e,r)=>{const t=me(r.id),n=Object.freeze({...r,pointer:w.append(e,r.pointer),value:Ce(r)[e],validated:t.validated});return we(n)},Ae=r(((e,r)=>V.pipeline([Ce,V.map((async(t,n)=>e(await Oe(n,r),n))),V.all],r))),Ie={parentId:"",parentDialect:"",includeEmbedded:!0},Te=(e,r)=>{if(r.startsWith("file://")){const t=e.slice(7,e.lastIndexOf("/"));return""===e?"":ie(t,r.slice(7))}return r};var je={setConfig:(e,r,t)=>{ue[e]||(ue[e]={}),ue[e][r]=t},getConfig:pe,add:he,get:be,markValidated:e=>{fe[e].validated=!0},uri:Se,value:Ce,getAnchorPointer:Ee,typeOf:(e,r)=>ne(Ce(e),r),has:(e,r)=>e in Ce(r),step:Oe,keys:e=>Object.keys(Ce(e)),entries:e=>V.pipeline([Ce,Object.keys,V.map((async r=>[r,await Oe(r,e)])),V.all],e),map:Ae,length:e=>Ce(e).length,toSchema:(e,r={})=>{const t={...Ie,...r},n=JSON.parse(JSON.stringify(e.schema,((r,n)=>{if(!C.isReference(n))return n;const o=C.value(n),a="string"==typeof o.$schema?oe(o.$schema,""):e.dialectId,i=pe(a,"embeddedToken");return!t.includeEmbedded&&i in o?void 0:C.value(n)}))),o=pe(e.dialectId,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,r])=>{const t=ae(r);w.assign(t,n,{[o]:e,...w.get(t,n)})}));const a=pe(e.dialectId,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,r])=>{w.assign(r,n,{[a]:e,...w.get(r,n)})}));const i=pe(e.dialectId,"baseToken"),s=Te(t.parentId,e.id),c=t.parentDialect===e.dialectId?"":e.dialectId;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};je.setConfig,je.getConfig,je.add,je.get,je.markValidated,je.uri,je.value,je.getAnchorPointer,je.typeOf,je.has,je.step,je.keys,je.entries,je.map,je.length,je.toSchema;class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=xe;var $e={compile:e=>je.value(e),interpret:()=>!0};const{resolveUrl:De}=c,Re="FLAG",Ne="BASIC",Fe="DETAILED",_e="VERBOSE";let ke=Fe,Ue=!0;te.addPlugin("application/schema+json",{parse:async e=>await e.json(),matcher:e=>e.endsWith(".schema.json")});const qe=async e=>{const r={metaData:{}};return{ast:r,schemaUri:await Je(e,r)}},Le=r((({ast:e,schemaUri:r},t,n=Re)=>{if(![Re,Ne,Fe,_e].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",ze(n,a));return Ge(r,t,e,{}),o.unsubscribe(i),a[0]})),ze=(e,r)=>{const t=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a,errors:[]};t.push(i)}else if("result.start"===n)t.push(n);else if("result.end"===n){const n=t.pop();for(;"result.start"!==t[t.length-1];){const r=t.pop(),o=[r];e===Ne&&(o.push(...r.errors),delete r.errors),(e===_e||e!==Re&&!r.valid)&&n.errors.unshift(...o)}t[t.length-1]=n,r[0]=n}}},He={},Ve=e=>He[e]||$e,Me=e=>e in He,Ke={},Ze={},Je=async(e,r)=>{if(e=await Be(e),!Me(`${e.dialectId}#validate`)){const r=await je.get(e.dialectId);(je.getConfig(r.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!r.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(r.vocabulary).forEach((([e,t])=>{if(e in Ke)Object.entries(Ke[e]).forEach((([e,t])=>{((e,r)=>{He[e]={collectEvaluatedItems:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&new Set,collectEvaluatedProperties:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&[],...r}})(`${r.id}#${e}`,t)}));else if(t)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ue&&!e.validated){if(je.markValidated(e.id),!(e.dialectId in Ze)){const r=await je.get(e.dialectId),t=await qe(r);Ze[r.id]=Le(t)}const r=F.cons(e.schema,e.id),t=Ze[e.dialectId](r,ke);if(!t.valid)throw new Pe(t)}return e.id in r.metaData||(r.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ve(`${e.dialectId}#validate`).compile(e,r)},Be=async e=>je.typeOf(e,"string")?Be(await je.get(je.value(e),e)):e,Ge=(e,r,t,n)=>{const o=We(e,t),a=De(e,"");return Ve(o).interpret(e,r,t,{...t.metaData[a].dynamicAnchors,...n})},We=(e,r)=>{if(!(e in r))throw Error(`No schema found at ${e}`);return r[e][0]};var Qe={validate:async(e,r,t)=>{const n=await qe(e),o=(e,r)=>Le(n,F.cons(e),r);return void 0===r?o:o(r,t)},compile:qe,interpret:Le,setMetaOutputFormat:e=>{ke=e},setShouldMetaValidate:e=>{Ue=e},FLAG:Re,BASIC:Ne,DETAILED:Fe,VERBOSE:_e,add:(e,r="",t="")=>{const n=je.add(e,r,t);delete Ze[n]},getKeyword:Ve,hasKeyword:Me,defineVocabulary:(e,r)=>{Ke[e]=r},compileSchema:Je,interpretSchema:Ge,collectEvaluatedProperties:(e,r,t,n,o)=>{const a=We(e,t);return Ve(a).collectEvaluatedProperties(e,r,t,n,o)},collectEvaluatedItems:(e,r,t,n,o)=>{const a=We(e,t);return Ve(a).collectEvaluatedItems(e,r,t,n,o)},addMediaTypePlugin:te.addPlugin};var Ye={compile:async(e,r)=>{const t=je.uri(e);if(!(t in r)){r[t]=!1;const n=je.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${je.uri(e)}'`);r[t]=[`${e.dialectId}#validate`,je.uri(e),"boolean"==typeof n?n:await V.pipeline([je.entries,V.map((([r,t])=>[`${e.dialectId}#${r}`,t])),V.filter((([r])=>r!==`${e.dialectId}#validate`)),V.map((async([t,n])=>{const o=await Qe.getKeyword(t).compile(n,r,e);return[t,je.uri(n),o]})),V.all],e)]}return t},interpret:(e,r,t,n)=>{const[a,i,s]=t[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=Qe.getKeyword(e).interpret(i,r,t,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:F.uri(r),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:F.uri(r),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Qe.getKeyword(o).collectEvaluatedProperties(a,r,t,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Qe.getKeyword(o).collectEvaluatedItems(a,r,t,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Xe={metaData:$e,validate:Ye},er=e("default",{Core:Qe,Schema:je,Instance:F,Reference:C,Keywords:Xe,InvalidSchemaError:Pe});e("Core",er.Core),e("Schema",er.Schema),e("Instance",er.Instance),e("Reference",er.Reference),e("Keywords",er.Keywords),e("InvalidSchemaError",er.InvalidSchemaError)}}})); | ||
//# sourceMappingURL=json-schema-core-system.min.js.map |
@@ -8,3 +8,3 @@ !function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).JSC={})}(this,(function(e){"use strict";var r=function(e,r){return function t(){null==r&&(r=e.length);var n=[].slice.call(arguments);return n.length>=r?e.apply(this,n):function(){return t.apply(this,n.concat([].slice.call(arguments)))}}};var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e,r){return e(r={exports:{}},r.exports),r.exports}var o=n((function(e,r){var n,o;n="object"==typeof window&&window||t,o={},n.PubSub?(o=n.PubSub,console.warn("PubSub already loaded, using existing version")):(n.PubSub=o,function(e){var r={},t=-1,n="*";function o(e){var r;for(r in e)if(Object.prototype.hasOwnProperty.call(e,r))return!0;return!1}function a(e){return function(){throw e}}function i(e,r,t){try{e(r,t)}catch(e){setTimeout(a(e),0)}}function s(e,r,t){e(r,t)}function c(e,t,n,o){var a,c=r[t],u=o?s:i;if(Object.prototype.hasOwnProperty.call(r,t))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&u(c[a],e,n)}function u(e,r,t){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,r,t);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,r,t);c(e,n,r,t)}}function l(e){var t=String(e);return Boolean(Object.prototype.hasOwnProperty.call(r,t)&&o(r[t]))}function p(e){for(var r=String(e),t=l(r)||l(n),o=r.lastIndexOf(".");!t&&-1!==o;)o=(r=r.substr(0,o)).lastIndexOf("."),t=l(r);return t}function f(e,r,t,n){var o=u(e="symbol"==typeof e?e.toString():e,r,n);return!!p(e)&&(!0===t?o():setTimeout(o,0),!0)}e.publish=function(r,t){return f(r,t,!1,e.immediateExceptions)},e.publishSync=function(r,t){return f(r,t,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(r,e)||(r[e]={});var o="uid_"+String(++t);return r[e][o]=n,o},e.subscribeAll=function(r){return e.subscribe(n,r)},e.subscribeOnce=function(r,t){var n=e.subscribe(r,(function(){e.unsubscribe(n),t.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){r={}},e.clearSubscriptions=function(e){var t;for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)&&delete r[t]},e.countSubscriptions=function(e){var t,n,o=0;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)){for(n in r[t])o++;break}return o},e.getSubscriptions=function(e){var t,n=[];for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e)&&n.push(t);return n},e.unsubscribe=function(t){var n,o,a,i=function(e){var t;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&0===t.indexOf(e))return!0;return!1},s="string"==typeof t&&(Object.prototype.hasOwnProperty.call(r,t)||i(t)),c=!s&&"string"==typeof t,u="function"==typeof t,l=!1;if(!s){for(n in r)if(Object.prototype.hasOwnProperty.call(r,n)){if(o=r[n],c&&o[t]){delete o[t],l=t;break}if(u)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===t&&(delete o[a],l=!0)}return l}e.clearSubscriptions(t)}}(o)),void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o}));o.PubSub;var a,i=n((function(e,r){ | ||
* MIT Licensed | ||
*/function Y(e){var r=String(e);if(J.test(r))return r;if(r.length>0&&!Z.test(r))throw new TypeError("invalid parameter value");return'"'+r.replace(G,"\\$1")+'"'}function X(e){this.parameters=Object.create(null),this.type=e}var ee={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var r=e.parameters,t=e.type;if(!t||!W.test(t))throw new TypeError("invalid type");var n=t;if(r&&"object"==typeof r)for(var o,a=Object.keys(r).sort(),i=0;i<a.length;i++){if(o=a[i],!J.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Y(r[o])}return n},parse:Q};const re={};var te={addPlugin:(e,r)=>{re[e]=r},parse:e=>{const r=ee.parse(e.headers.get("content-type")).type;if(!(r in re))throw Error(`${e.url} is not a schema. Found a document with media type: ${r}`);return re[r].parse(e)},getContentType:e=>{for(const r in re)if(re[r].matcher(e))return r;return"application/octet-stream"}};const{jsonTypeOf:ne,resolveUrl:oe,urlFragment:ae,pathRelative:ie}=c,se="https://json-schema.org/draft/2019-09/vocab/core",ce="https://json-schema.org/draft/2020-12/vocab/core",ue={},le={},pe=(e,r)=>{const t=le[e];return ue[t]?.[r]},fe={},de={},he=(e,r="",t="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(r,""),o=oe(e.$schema||t,"");if(!o)throw Error("Couldn't determine schema dialect");if(delete e.$schema,!(o in le))if(!0===e?.$vocabulary?.[se]&&o===ve(e,n,se)[0])le[o]=se;else if(!0===e?.$vocabulary?.[ce]&&o===ve(e,n,ce)[0])le[o]=ce;else if(o===ve(e,n,o)[0])le[o]=o;else{if(!(o in fe))throw Error(`Couldn't determine JSON Schema version for dialect: '${o}'`);{const e=fe[o];!0===e.vocabulary[se]?le[o]=se:!0===e.vocabulary[ce]?le[o]=ce:le[o]=le[e.dialectId]}}const[a,i]=ve(e,n,le[o]);if(!a)throw Error("Couldn't determine an identifier for the schema");const s=pe(o,"baseToken");delete e[s],n&&(de[n]=a);const c=pe(o,"anchorToken");i&&s===c&&(e[c]=c!==s?encodeURI(i):`#${encodeURI(i)}`);const u={},l=pe(o,"recursiveAnchorToken");let p;!0===e[l]&&(u[""]=`${a}#`,e[c]="",delete e[l]);const f=pe(o,"vocabularyToken");ne(e[f],"object")?(p=e[f],delete e[f]):p={[le[o]]:!0};const d={"":""};return fe[a]={id:a,dialectId:o,schema:ye(e,a,o,w.nil,d,u),anchors:d,dynamicAnchors:u,vocabulary:p,validated:!1},a},ve=(e,r,t)=>{const n=ue[t]?.baseToken,o=oe(r,e[n]||"");return[oe(o,""),ae(o)]},ye=(e,r,t,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema,""):t,s=pe(i,"embeddedToken"),c=pe(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(r,e[s]);return e[pe(i,"baseToken")]=n,he(e,n,t),C.cons(e[s],e)}const u=pe(t,"anchorToken"),l=pe(t,"dynamicAnchorToken");"string"==typeof e[l]&&(a[e[l]]=`${r}#${encodeURI(n)}`,o[e[l]]=n,delete e[l]);const p=pe(t,"embeddedToken");if("string"==typeof e[u]){const r=u!==p?e[u]:e[u].slice(1);o[r]=n,delete e[u]}const f=pe(t,"jrefToken");if("string"==typeof e[f])return C.cons(e[f],e);for(const i in e)e[i]=ye(e[i],r,t,w.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ye(e,r,t,w.append(i,n),o,a))):e},me=e=>fe[de[e]]||fe[e],ge=Object.freeze({id:"",dialectId:void 0,vocabulary:{},pointer:w.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),be=async(e,r=ge)=>{const t=oe(Se(r),e),n=oe(t,""),o=ae(t);if(!(e=>e in fe||e in de)(n)){const e=await M(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);he(await te.parse(e),n)}const a=me(n),i="/"!==o[0]?Ee(a,o):o,s=Object.freeze({...a,pointer:i,value:w.get(i,a.schema)});return we(s)},we=e=>C.isReference(e.value)?be(C.href(e.value),e):e,Ee=(e,r)=>{if(!(r in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(r)}'`);return e.anchors[r]},Se=e=>`${e.id}#${encodeURI(e.pointer)}`,Ce=e=>C.isReference(e.value)?C.value(e.value):e.value,Oe=(e,r)=>{const t=me(r.id),n=Object.freeze({...r,pointer:w.append(e,r.pointer),value:Ce(r)[e],validated:t.validated});return we(n)},Ae=r(((e,r)=>V.pipeline([Ce,V.map((async(t,n)=>e(await Oe(n,r),n))),V.all],r))),Ie={parentId:"",parentDialect:"",includeEmbedded:!0},Te=(e,r)=>{if(r.startsWith("file://")){const t=e.slice(7,e.lastIndexOf("/"));return""===e?"":ie(t,r.slice(7))}return r};var je={setConfig:(e,r,t)=>{ue[e]||(ue[e]={}),ue[e][r]=t},getConfig:pe,add:he,get:be,markValidated:e=>{fe[e].validated=!0},uri:Se,value:Ce,getAnchorPointer:Ee,typeOf:(e,r)=>ne(Ce(e),r),has:(e,r)=>e in Ce(r),step:Oe,keys:e=>Object.keys(Ce(e)),entries:e=>V.pipeline([Ce,Object.keys,V.map((async r=>[r,await Oe(r,e)])),V.all],e),map:Ae,length:e=>Ce(e).length,toSchema:(e,r={})=>{const t={...Ie,...r},n=JSON.parse(JSON.stringify(e.schema,((r,n)=>{if(!C.isReference(n))return n;const o=C.value(n),a="string"==typeof o.$schema?oe(o.$schema,""):e.dialectId,i=pe(a,"embeddedToken");return!t.includeEmbedded&&i in o?void 0:C.value(n)}))),o=pe(e.dialectId,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,r])=>{const t=ae(r);w.assign(t,n,{[o]:e,...w.get(t,n)})}));const a=pe(e.dialectId,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,r])=>{w.assign(r,n,{[a]:e,...w.get(r,n)})}));const i=pe(e.dialectId,"baseToken"),s=Te(t.parentId,e.id),c=t.parentDialect===e.dialectId?"":e.dialectId;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};je.setConfig,je.getConfig,je.add,je.get,je.markValidated,je.uri,je.value,je.getAnchorPointer,je.typeOf,je.has,je.step,je.keys,je.entries,je.map,je.length,je.toSchema;class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=xe;const{resolveUrl:$e}=c,De="FLAG",Re="BASIC",Ne="DETAILED",_e="VERBOSE";let Fe=Ne,ke=!0;te.addPlugin("application/schema+json",{parse:async e=>await e.json(),matcher:e=>e.endsWith(".schema.json")});const Ue=async e=>{const r={metaData:{}};return{ast:r,schemaUri:await Ze(e,r)}},qe=r((({ast:e,schemaUri:r},t,n=De)=>{if(![De,Re,Ne,_e].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Le(n,a));return Be(r,t,e,{}),o.unsubscribe(i),a[0]})),Le=(e,r)=>{const t=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a,errors:[]};t.push(i)}else if("result.start"===n)t.push(n);else if("result.end"===n){const n=t.pop();for(;"result.start"!==t[t.length-1];){const r=t.pop(),o=[r];e===Re&&(o.push(...r.errors),delete r.errors),(e===_e||e!==De&&!r.valid)&&n.errors.unshift(...o)}t[t.length-1]=n,r[0]=n}}},ze={},He=e=>ze[e],Ve=e=>e in ze,Me={},Ke={},Ze=async(e,r)=>{if(e=await Je(e),!Ve(`${e.dialectId}#validate`)){const r=await je.get(e.dialectId);(je.getConfig(r.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!r.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(r.vocabulary).forEach((([e,t])=>{if(e in Me)Object.entries(Me[e]).forEach((([e,t])=>{((e,r)=>{ze[e]={collectEvaluatedItems:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&new Set,collectEvaluatedProperties:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&[],...r}})(`${r.id}#${e}`,t)}));else if(t)throw Error(`Missing required vocabulary: ${e}`)}))}if(ke&&!e.validated){if(je.markValidated(e.id),!(e.dialectId in Ke)){const r=await je.get(e.dialectId),t=await Ue(r);Ke[r.id]=qe(t)}const r=_.cons(e.schema,e.id),t=Ke[e.dialectId](r,Fe);if(!t.valid)throw new Pe(t)}return e.id in r.metaData||(r.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),He(`${e.dialectId}#validate`).compile(e,r)},Je=async e=>je.typeOf(e,"string")?Je(await je.get(je.value(e),e)):e,Be=(e,r,t,n)=>{const o=Ge(e,t),a=$e(e,"");return He(o).interpret(e,r,t,{...t.metaData[a].dynamicAnchors,...n})},Ge=(e,r)=>{if(!(e in r))throw Error(`No schema found at ${e}`);return r[e][0]};var We={validate:async(e,r,t)=>{const n=await Ue(e),o=(e,r)=>qe(n,_.cons(e),r);return void 0===r?o:o(r,t)},compile:Ue,interpret:qe,setMetaOutputFormat:e=>{Fe=e},setShouldMetaValidate:e=>{ke=e},FLAG:De,BASIC:Re,DETAILED:Ne,VERBOSE:_e,add:(e,r="",t="")=>{const n=je.add(e,r,t);delete Ke[n]},getKeyword:He,hasKeyword:Ve,defineVocabulary:(e,r)=>{Me[e]=r},compileSchema:Ze,interpretSchema:Be,collectEvaluatedProperties:(e,r,t,n,o)=>{const a=Ge(e,t);return He(a).collectEvaluatedProperties(e,r,t,n,o)},collectEvaluatedItems:(e,r,t,n,o)=>{const a=Ge(e,t);return He(a).collectEvaluatedItems(e,r,t,n,o)},addMediaTypePlugin:te.addPlugin};var Qe={compile:e=>je.value(e),interpret:()=>!0};var Ye={compile:async(e,r)=>{const t=je.uri(e);if(!(t in r)){r[t]=!1;const n=je.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${je.uri(e)}'`);r[t]=[`${e.dialectId}#validate`,je.uri(e),"boolean"==typeof n?n:await V.pipeline([je.entries,V.map((([r,t])=>[`${e.dialectId}#${r}`,t])),V.filter((([r])=>We.hasKeyword(r)&&r!==`${e.dialectId}#validate`)),V.map((async([t,n])=>{const o=await We.getKeyword(t).compile(n,r,e);return[t,je.uri(n),o]})),V.all],e)]}return t},interpret:(e,r,t,n)=>{const[a,i,s]=t[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=We.getKeyword(e).interpret(i,r,t,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:_.uri(r),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:_.uri(r),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&We.getKeyword(o).collectEvaluatedProperties(a,r,t,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&We.getKeyword(o).collectEvaluatedItems(a,r,t,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Xe={metaData:Qe,validate:Ye},er={Core:We,Schema:je,Instance:_,Reference:C,Keywords:Xe,InvalidSchemaError:Pe},rr=er.Core,tr=er.Schema,nr=er.Instance,or=er.Reference,ar=er.Keywords,ir=er.InvalidSchemaError;e.Core=rr,e.Instance=nr,e.InvalidSchemaError=ir,e.Keywords=ar,e.Reference=or,e.Schema=tr,e.default=er,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/function Y(e){var r=String(e);if(J.test(r))return r;if(r.length>0&&!Z.test(r))throw new TypeError("invalid parameter value");return'"'+r.replace(G,"\\$1")+'"'}function X(e){this.parameters=Object.create(null),this.type=e}var ee={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var r=e.parameters,t=e.type;if(!t||!W.test(t))throw new TypeError("invalid type");var n=t;if(r&&"object"==typeof r)for(var o,a=Object.keys(r).sort(),i=0;i<a.length;i++){if(o=a[i],!J.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Y(r[o])}return n},parse:Q};const re={};var te={addPlugin:(e,r)=>{re[e]=r},parse:e=>{const r=ee.parse(e.headers.get("content-type")).type;if(!(r in re))throw Error(`${e.url} is not a schema. Found a document with media type: ${r}`);return re[r].parse(e)},getContentType:e=>{for(const r in re)if(re[r].matcher(e))return r;return"application/octet-stream"}};const{jsonTypeOf:ne,resolveUrl:oe,urlFragment:ae,pathRelative:ie}=c,se="https://json-schema.org/draft/2019-09/vocab/core",ce="https://json-schema.org/draft/2020-12/vocab/core",ue={},le={},pe=(e,r)=>{const t=le[e];return ue[t]?.[r]},fe={},de={},he=(e,r="",t="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(r,""),o=oe(e.$schema||t,"");if(!o)throw Error("Couldn't determine schema dialect");if(delete e.$schema,!(o in le))if(!0===e?.$vocabulary?.[se]&&o===ve(e,n,se)[0])le[o]=se;else if(!0===e?.$vocabulary?.[ce]&&o===ve(e,n,ce)[0])le[o]=ce;else if(o===ve(e,n,o)[0])le[o]=o;else{if(!(o in fe))throw Error(`Couldn't determine JSON Schema version for dialect: '${o}'`);{const e=fe[o];!0===e.vocabulary[se]?le[o]=se:!0===e.vocabulary[ce]?le[o]=ce:le[o]=le[e.dialectId]}}const[a,i]=ve(e,n,le[o]);if(!a)throw Error("Couldn't determine an identifier for the schema");const s=pe(o,"baseToken");delete e[s],n&&(de[n]=a);const c=pe(o,"anchorToken");i&&s===c&&(e[c]=c!==s?encodeURI(i):`#${encodeURI(i)}`);const u={},l=pe(o,"recursiveAnchorToken");let p;!0===e[l]&&(u[""]=`${a}#`,e[c]="",delete e[l]);const f=pe(o,"vocabularyToken");ne(e[f],"object")?(p=e[f],delete e[f]):p={[le[o]]:!0};const d={"":""};return fe[a]={id:a,dialectId:o,schema:ye(e,a,o,w.nil,d,u),anchors:d,dynamicAnchors:u,vocabulary:p,validated:!1},a},ve=(e,r,t)=>{const n=ue[t]?.baseToken,o=oe(r,e[n]||"");return[oe(o,""),ae(o)]},ye=(e,r,t,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema,""):t,s=pe(i,"embeddedToken"),c=pe(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(r,e[s]);return e[pe(i,"baseToken")]=n,he(e,n,t),C.cons(e[s],e)}const u=pe(t,"anchorToken"),l=pe(t,"dynamicAnchorToken");"string"==typeof e[l]&&(a[e[l]]=`${r}#${encodeURI(n)}`,o[e[l]]=n,delete e[l]);const p=pe(t,"embeddedToken");if("string"==typeof e[u]){const r=u!==p?e[u]:e[u].slice(1);o[r]=n,delete e[u]}const f=pe(t,"jrefToken");if("string"==typeof e[f])return C.cons(e[f],e);for(const i in e)e[i]=ye(e[i],r,t,w.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ye(e,r,t,w.append(i,n),o,a))):e},me=e=>fe[de[e]]||fe[e],ge=Object.freeze({id:"",dialectId:void 0,vocabulary:{},pointer:w.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),be=async(e,r=ge)=>{const t=oe(Se(r),e),n=oe(t,""),o=ae(t);if(!(e=>e in fe||e in de)(n)){const e=await M(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);he(await te.parse(e),n)}const a=me(n),i="/"!==o[0]?Ee(a,o):o,s=Object.freeze({...a,pointer:i,value:w.get(i,a.schema)});return we(s)},we=e=>C.isReference(e.value)?be(C.href(e.value),e):e,Ee=(e,r)=>{if(!(r in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(r)}'`);return e.anchors[r]},Se=e=>`${e.id}#${encodeURI(e.pointer)}`,Ce=e=>C.isReference(e.value)?C.value(e.value):e.value,Oe=(e,r)=>{const t=me(r.id),n=Object.freeze({...r,pointer:w.append(e,r.pointer),value:Ce(r)[e],validated:t.validated});return we(n)},Ae=r(((e,r)=>V.pipeline([Ce,V.map((async(t,n)=>e(await Oe(n,r),n))),V.all],r))),Ie={parentId:"",parentDialect:"",includeEmbedded:!0},Te=(e,r)=>{if(r.startsWith("file://")){const t=e.slice(7,e.lastIndexOf("/"));return""===e?"":ie(t,r.slice(7))}return r};var je={setConfig:(e,r,t)=>{ue[e]||(ue[e]={}),ue[e][r]=t},getConfig:pe,add:he,get:be,markValidated:e=>{fe[e].validated=!0},uri:Se,value:Ce,getAnchorPointer:Ee,typeOf:(e,r)=>ne(Ce(e),r),has:(e,r)=>e in Ce(r),step:Oe,keys:e=>Object.keys(Ce(e)),entries:e=>V.pipeline([Ce,Object.keys,V.map((async r=>[r,await Oe(r,e)])),V.all],e),map:Ae,length:e=>Ce(e).length,toSchema:(e,r={})=>{const t={...Ie,...r},n=JSON.parse(JSON.stringify(e.schema,((r,n)=>{if(!C.isReference(n))return n;const o=C.value(n),a="string"==typeof o.$schema?oe(o.$schema,""):e.dialectId,i=pe(a,"embeddedToken");return!t.includeEmbedded&&i in o?void 0:C.value(n)}))),o=pe(e.dialectId,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,r])=>{const t=ae(r);w.assign(t,n,{[o]:e,...w.get(t,n)})}));const a=pe(e.dialectId,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,r])=>{w.assign(r,n,{[a]:e,...w.get(r,n)})}));const i=pe(e.dialectId,"baseToken"),s=Te(t.parentId,e.id),c=t.parentDialect===e.dialectId?"":e.dialectId;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};je.setConfig,je.getConfig,je.add,je.get,je.markValidated,je.uri,je.value,je.getAnchorPointer,je.typeOf,je.has,je.step,je.keys,je.entries,je.map,je.length,je.toSchema;class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=xe;var $e={compile:e=>je.value(e),interpret:()=>!0};const{resolveUrl:De}=c,Re="FLAG",Ne="BASIC",_e="DETAILED",Fe="VERBOSE";let ke=_e,Ue=!0;te.addPlugin("application/schema+json",{parse:async e=>await e.json(),matcher:e=>e.endsWith(".schema.json")});const qe=async e=>{const r={metaData:{}};return{ast:r,schemaUri:await Je(e,r)}},Le=r((({ast:e,schemaUri:r},t,n=Re)=>{if(![Re,Ne,_e,Fe].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",ze(n,a));return Ge(r,t,e,{}),o.unsubscribe(i),a[0]})),ze=(e,r)=>{const t=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:r,instanceLocation:n,valid:a,errors:[]};t.push(i)}else if("result.start"===n)t.push(n);else if("result.end"===n){const n=t.pop();for(;"result.start"!==t[t.length-1];){const r=t.pop(),o=[r];e===Ne&&(o.push(...r.errors),delete r.errors),(e===Fe||e!==Re&&!r.valid)&&n.errors.unshift(...o)}t[t.length-1]=n,r[0]=n}}},He={},Ve=e=>He[e]||$e,Me=e=>e in He,Ke={},Ze={},Je=async(e,r)=>{if(e=await Be(e),!Me(`${e.dialectId}#validate`)){const r=await je.get(e.dialectId);(je.getConfig(r.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!r.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(r.vocabulary).forEach((([e,t])=>{if(e in Ke)Object.entries(Ke[e]).forEach((([e,t])=>{((e,r)=>{He[e]={collectEvaluatedItems:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&new Set,collectEvaluatedProperties:(e,t,n,o,a)=>r.interpret(e,t,n,o,a)&&[],...r}})(`${r.id}#${e}`,t)}));else if(t)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ue&&!e.validated){if(je.markValidated(e.id),!(e.dialectId in Ze)){const r=await je.get(e.dialectId),t=await qe(r);Ze[r.id]=Le(t)}const r=_.cons(e.schema,e.id),t=Ze[e.dialectId](r,ke);if(!t.valid)throw new Pe(t)}return e.id in r.metaData||(r.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ve(`${e.dialectId}#validate`).compile(e,r)},Be=async e=>je.typeOf(e,"string")?Be(await je.get(je.value(e),e)):e,Ge=(e,r,t,n)=>{const o=We(e,t),a=De(e,"");return Ve(o).interpret(e,r,t,{...t.metaData[a].dynamicAnchors,...n})},We=(e,r)=>{if(!(e in r))throw Error(`No schema found at ${e}`);return r[e][0]};var Qe={validate:async(e,r,t)=>{const n=await qe(e),o=(e,r)=>Le(n,_.cons(e),r);return void 0===r?o:o(r,t)},compile:qe,interpret:Le,setMetaOutputFormat:e=>{ke=e},setShouldMetaValidate:e=>{Ue=e},FLAG:Re,BASIC:Ne,DETAILED:_e,VERBOSE:Fe,add:(e,r="",t="")=>{const n=je.add(e,r,t);delete Ze[n]},getKeyword:Ve,hasKeyword:Me,defineVocabulary:(e,r)=>{Ke[e]=r},compileSchema:Je,interpretSchema:Ge,collectEvaluatedProperties:(e,r,t,n,o)=>{const a=We(e,t);return Ve(a).collectEvaluatedProperties(e,r,t,n,o)},collectEvaluatedItems:(e,r,t,n,o)=>{const a=We(e,t);return Ve(a).collectEvaluatedItems(e,r,t,n,o)},addMediaTypePlugin:te.addPlugin};var Ye={compile:async(e,r)=>{const t=je.uri(e);if(!(t in r)){r[t]=!1;const n=je.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${je.uri(e)}'`);r[t]=[`${e.dialectId}#validate`,je.uri(e),"boolean"==typeof n?n:await V.pipeline([je.entries,V.map((([r,t])=>[`${e.dialectId}#${r}`,t])),V.filter((([r])=>r!==`${e.dialectId}#validate`)),V.map((async([t,n])=>{const o=await Qe.getKeyword(t).compile(n,r,e);return[t,je.uri(n),o]})),V.all],e)]}return t},interpret:(e,r,t,n)=>{const[a,i,s]=t[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=Qe.getKeyword(e).interpret(i,r,t,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:_.uri(r),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:_.uri(r),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Qe.getKeyword(o).collectEvaluatedProperties(a,r,t,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,r,t,n,o=!1)=>{const a=t[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Qe.getKeyword(o).collectEvaluatedItems(a,r,t,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Xe={metaData:$e,validate:Ye},er={Core:Qe,Schema:je,Instance:_,Reference:C,Keywords:Xe,InvalidSchemaError:Pe},rr=er.Core,tr=er.Schema,nr=er.Instance,or=er.Reference,ar=er.Keywords,ir=er.InvalidSchemaError;e.Core=rr,e.Instance=nr,e.InvalidSchemaError=ir,e.Keywords=ar,e.Reference=or,e.Schema=tr,e.default=er,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-umd.min.js.map |
@@ -8,2 +8,3 @@ const curry = require("just-curry-it"); | ||
const MediaTypes = require("./media-types"); | ||
const metaData = require("./keywords/meta-data"); | ||
@@ -88,3 +89,3 @@ | ||
const _keywords = {}; | ||
const getKeyword = (id) => _keywords[id]; | ||
const getKeyword = (id) => _keywords[id] || metaData; | ||
const hasKeyword = (id) => id in _keywords; | ||
@@ -91,0 +92,0 @@ const addKeyword = (id, keywordHandler) => { |
@@ -24,3 +24,3 @@ const Pact = require("@hyperjump/pact"); | ||
Pact.map(([keyword, keywordSchema]) => [`${schema.dialectId}#${keyword}`, keywordSchema]), | ||
Pact.filter(([keywordId]) => Core.hasKeyword(keywordId) && keywordId !== `${schema.dialectId}#validate`), | ||
Pact.filter(([keywordId]) => keywordId !== `${schema.dialectId}#validate`), | ||
Pact.map(async ([keywordId, keywordSchema]) => { | ||
@@ -27,0 +27,0 @@ const keywordAst = await Core.getKeyword(keywordId).compile(keywordSchema, ast, schema); |
{ | ||
"name": "@hyperjump/json-schema-core", | ||
"version": "0.26.0", | ||
"version": "0.27.0", | ||
"description": "A framework for building JSON Schema tools", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3344329
18210